From 9492ee9beab4bbb8b7d083cb7717cb0161c60a1b Mon Sep 17 00:00:00 2001 From: SVN Migration Date: Sun, 12 Dec 1999 15:55:58 +0000 Subject: This commit was manufactured by cvs2svn to create branch 'RETURN_REF'. --- CODING_STANDARDS | 149 - CREDITS | 3 - ChangeLog | 11008 ----------------------------------- FUNCTION_LIST.txt | 538 -- INSTALL | 184 - LICENSE | 70 - MAINTAINERS | 101 - MODULES_STATUS | 21 - Makefile.am | 41 - NEWS | 356 -- README-BCMATH | 17 - README.CVS-RULES | 102 - README.QNX | 57 - TODO | 36 - TODO-LeftOver | 75 - TSRM/Makefile.am | 4 - TSRM/TSRM.c | 453 -- TSRM/TSRM.dsp | 100 - TSRM/TSRM.h | 110 - TSRM/acconfig.h | 1 - TSRM/acinclude.m4 | 5 - TSRM/build.mk | 43 - TSRM/buildconf | 33 - TSRM/configure.in | 33 - Zend/FlexLexer.h | 186 - Zend/LICENSE | 116 - Zend/Makefile.am | 39 - Zend/ZEND_CHANGES | 111 - Zend/ZendCore.dep | 258 - Zend/acconfig.h | 89 - Zend/acinclude.m4 | 25 - Zend/build.mk | 43 - Zend/buildconf | 33 - Zend/configure.in | 210 - Zend/flex.skl | 1541 ----- Zend/libzend.dsp | 373 -- Zend/libzendts.dsp | 379 -- Zend/zend-parser.y | 680 --- Zend/zend-scanner.h | 58 - Zend/zend-scanner.l | 1611 ----- Zend/zend.c | 444 -- Zend/zend.h | 301 - Zend/zend.ico | Bin 1382 -> 0 bytes Zend/zend_API.c | 857 --- Zend/zend_API.h | 292 - Zend/zend_alloc.c | 557 -- Zend/zend_alloc.h | 130 - Zend/zend_builtin_functions.c | 465 -- Zend/zend_builtin_functions.h | 26 - Zend/zend_compile.c | 2173 ------- Zend/zend_compile.h | 612 -- Zend/zend_config.w32.h | 67 - Zend/zend_constants.c | 268 - Zend/zend_constants.h | 64 - Zend/zend_errors.h | 37 - Zend/zend_execute.c | 2128 ------- Zend/zend_execute.h | 78 - Zend/zend_execute_API.c | 553 -- Zend/zend_extensions.c | 157 - Zend/zend_extensions.h | 96 - Zend/zend_globals.h | 186 - Zend/zend_globals_macros.h | 88 - Zend/zend_hash.c | 1224 ---- Zend/zend_hash.h | 175 - Zend/zend_highlight.c | 168 - Zend/zend_highlight.h | 49 - Zend/zend_indent.c | 152 - Zend/zend_indent.h | 26 - Zend/zend_list.c | 295 - Zend/zend_list.h | 87 - Zend/zend_llist.c | 217 - Zend/zend_llist.h | 61 - Zend/zend_modules.h | 64 - Zend/zend_opcode.c | 414 -- Zend/zend_operators.c | 1395 ----- Zend/zend_operators.h | 131 - Zend/zend_ptr_stack.c | 114 - Zend/zend_ptr_stack.h | 42 - Zend/zend_sprintf.c | 40 - Zend/zend_stack.c | 164 - Zend/zend_stack.h | 47 - Zend/zend_variables.c | 192 - Zend/zend_variables.h | 61 - acconfig.h.in | 126 - acinclude.m4 | 362 -- apidoc-zend.txt | 276 - apidoc.txt | 492 -- build-defs.h.in | 90 - build.mk | 93 - buildcheck.sh | 69 - buildconf | 29 - calendar.mak | 244 - config.guess | 1087 ---- config.sub | 1215 ---- configure.in | 842 --- crypt.mak | 204 - dbase.mak | 234 - dbm.mak | 201 - dlist.c | 421 -- dlist.h | 137 - ext/Makefile.am | 4 - ext/apache/Makefile.am | 5 - ext/apache/apache.c | 449 -- ext/apache/config.m4 | 2 - ext/aspell/Makefile.am | 5 - ext/aspell/aspell.c | 204 - ext/aspell/config.h.stub | 4 - ext/aspell/config.m4 | 28 - ext/aspell/php_aspell.h | 54 - ext/bcmath/Makefile.am | 4 - ext/bcmath/bcmath.c | 434 -- ext/bcmath/config.h.stub | 2 - ext/bcmath/config.m4 | 20 - ext/bcmath/php_bcmath.h | 64 - ext/bcmath/setup.stub | 6 - ext/com/php_COM.h | 24 - ext/cpdf/Makefile.am | 5 - ext/cpdf/config.h.stub | 2 - ext/cpdf/config.m4 | 72 - ext/cpdf/cpdf.c | 2563 -------- ext/cpdf/php_cpdf.h | 122 - ext/cybercash/Makefile.am | 2 - ext/cybercash/config.h.stub | 1 - ext/cybercash/config.m4 | 26 - ext/cybercash/cybercash.c | 198 - ext/cybercash/cybercash.h | 56 - ext/cybercash/cyberlib.php | 214 - ext/cybercash/test.php | 26 - ext/dav/Makefile.am | 5 - ext/dav/config.h.stub | 2 - ext/dav/config.m4 | 29 - ext/dav/dav.c | 289 - ext/dav/php_dav.h | 66 - ext/dav/setup.stub | 2 - ext/db/Makefile.am | 5 - ext/db/config.h.stub | 5 - ext/db/config.m4 | 55 - ext/db/db.c | 1162 ---- ext/db/php_db.h | 95 - ext/dba/Makefile.am | 6 - ext/dba/config.h.stub | 19 - ext/dba/config.m4 | 238 - ext/dba/dba.c | 483 -- ext/dba/dba_cdb.c | 220 - ext/dba/dba_db2.c | 207 - ext/dba/dba_db3.c | 212 - ext/dba/dba_dbm.c | 190 - ext/dba/dba_gdbm.c | 189 - ext/dba/dba_ndbm.c | 169 - ext/dba/php_cdb.h | 12 - ext/dba/php_db2.h | 12 - ext/dba/php_db3.h | 12 - ext/dba/php_dba.h | 115 - ext/dba/php_dbm.h | 12 - ext/dba/php_gdbm.h | 12 - ext/dba/php_ndbm.h | 12 - ext/dba/setup.stub | 6 - ext/dbase/Makefile.am | 4 - ext/dbase/config.h.stub | 3 - ext/dbase/config.m4 | 21 - ext/dbase/dbase.c | 754 --- ext/dbase/dbf.h | 94 - ext/dbase/dbf_head.c | 261 - ext/dbase/dbf_head.h | 9 - ext/dbase/dbf_misc.c | 168 - ext/dbase/dbf_misc.h | 13 - ext/dbase/dbf_ndx.c | 183 - ext/dbase/dbf_ndx.h | 98 - ext/dbase/dbf_rec.c | 182 - ext/dbase/dbf_rec.h | 10 - ext/dbase/php_dbase.h | 55 - ext/dbase/setup.stub | 4 - ext/domxml/Makefile.am | 5 - ext/domxml/config.h.stub | 3 - ext/domxml/config.m4 | 66 - ext/domxml/domxml.c | 621 -- ext/domxml/php_domxml.h | 68 - ext/ereg/ereg.c | 653 --- ext/ereg/php_ereg.h | 71 - ext/ereg/php_regex.h | 43 - ext/ereg/regex/COPYRIGHT | 20 - ext/ereg/regex/Makefile.am | 3 - ext/ereg/regex/README | 32 - ext/ereg/regex/WHATSNEW | 92 - ext/ereg/regex/cclass.h | 31 - ext/ereg/regex/cname.h | 102 - ext/ereg/regex/debug.c | 242 - ext/ereg/regex/debug.ih | 14 - ext/ereg/regex/engine.c | 1019 ---- ext/ereg/regex/engine.ih | 35 - ext/ereg/regex/main.c | 510 -- ext/ereg/regex/main.ih | 19 - ext/ereg/regex/mkh | 76 - ext/ereg/regex/regcomp.c | 1605 ----- ext/ereg/regex/regcomp.ih | 51 - ext/ereg/regex/regerror.c | 126 - ext/ereg/regex/regerror.ih | 12 - ext/ereg/regex/regex.3 | 502 -- ext/ereg/regex/regex.7 | 233 - ext/ereg/regex/regex.dsp | 106 - ext/ereg/regex/regex.dsw | 29 - ext/ereg/regex/regex.h | 83 - ext/ereg/regex/regex.mak | 304 - ext/ereg/regex/regex2.h | 140 - ext/ereg/regex/regex_extra.h | 23 - ext/ereg/regex/regexec.c | 138 - ext/ereg/regex/regfree.c | 37 - ext/ereg/regex/split.c | 316 - ext/ereg/regex/tests | 475 -- ext/ereg/regex/utils.h | 25 - ext/ext_skel | 92 - ext/fdf/Makefile.am | 5 - ext/fdf/config.h.stub | 2 - ext/fdf/config.m4 | 39 - ext/fdf/fdf.c | 577 -- ext/fdf/php_fdf.h | 65 - ext/fdf/setup.stub | 7 - ext/filepro/Makefile.am | 5 - ext/filepro/config.h.stub | 2 - ext/filepro/config.m4 | 17 - ext/filepro/filepro.c | 544 -- ext/filepro/php_filepro.h | 58 - ext/filepro/setup.stub | 5 - ext/ftp/Makefile.am | 4 - ext/ftp/config.h.stub | 2 - ext/ftp/config.m4 | 18 - ext/ftp/ftp.c | 1165 ---- ext/ftp/ftp.h | 158 - ext/ftp/php_ftp.c | 796 --- ext/ftp/php_ftp.h | 79 - ext/gd/Makefile.am | 13 - ext/gd/config.h.stub | 14 - ext/gd/config.m4 | 193 - ext/gd/gd.c | 1940 ------ ext/gd/gdcache.c | 201 - ext/gd/gdcache.h | 87 - ext/gd/gdt1.c | 532 -- ext/gd/gdt1.h | 27 - ext/gd/gdttf.c | 827 --- ext/gd/gdttf.h | 16 - ext/gd/php_gd.h | 114 - ext/gd/setup.stub | 6 - ext/gettext/Makefile.am | 5 - ext/gettext/config.h.stub | 3 - ext/gettext/config.m4 | 45 - ext/gettext/gettext.c | 158 - ext/gettext/php_gettext.h | 57 - ext/gettext/setup.stub | 6 - ext/hyperwave/Makefile.am | 5 - ext/hyperwave/config.h.stub | 2 - ext/hyperwave/config.m4 | 18 - ext/hyperwave/debug.h | 194 - ext/hyperwave/hg_comm.c | 4921 ---------------- ext/hyperwave/hg_comm.h | 214 - ext/hyperwave/hw.c | 3720 ------------ ext/hyperwave/hw_error.h | 117 - ext/hyperwave/php_hyperwave.h | 166 - ext/hyperwave/setup.stub | 6 - ext/icap/Makefile.am | 5 - ext/icap/config.h.stub | 2 - ext/icap/config.m4 | 25 - ext/icap/php3_icap.c | 955 --- ext/icap/php_icap.h | 57 - ext/imap/Makefile.am | 5 - ext/imap/config.h.stub | 2 - ext/imap/config.m4 | 63 - ext/imap/imap.c | 2692 --------- ext/imap/imap.h | 86 - ext/imap/setup.stub | 7 - ext/informix/Makefile.am | 15 - ext/informix/config.h.stub | 9 - ext/informix/config.m4 | 110 - ext/informix/ifx.dsp | 98 - ext/informix/ifx.dsw | 44 - ext/informix/ifx.ec | 4782 --------------- ext/informix/ifx_custom_build.dsp | 113 - ext/informix/ifx_custom_build.dsw | 29 - ext/informix/php_informix.h | 231 - ext/informix/setup.stub | 9 - ext/informix/stub.c | 0 ext/interbase/Makefile.am | 5 - ext/interbase/config.h.stub | 3 - ext/interbase/config.m4 | 29 - ext/interbase/interbase.c | 1117 ---- ext/interbase/php_interbase.h | 111 - ext/interbase/setup.stub | 7 - ext/java/Makefile.am | 25 - ext/java/README | 154 - ext/java/config.h.stub | 3 - ext/java/config.m4 | 67 - ext/java/java.c | 528 -- ext/java/java.dsp | 258 - ext/java/jawt.php | 28 - ext/java/jver.php | 15 - ext/java/reflect.java | 279 - ext/ldap/Makefile.am | 5 - ext/ldap/config.h.stub | 2 - ext/ldap/config.m4 | 81 - ext/ldap/ldap.c | 1305 ----- ext/ldap/php_ldap.h | 127 - ext/ldap/setup.stub | 8 - ext/mcal/Makefile.am | 5 - ext/mcal/config.h.stub | 2 - ext/mcal/config.m4 | 25 - ext/mcal/php3_mcal.c | 1645 ------ ext/mcal/php_mcal.h | 86 - ext/mcrypt/Makefile.am | 5 - ext/mcrypt/config.h.stub | 2 - ext/mcrypt/config.m4 | 31 - ext/mcrypt/mcrypt.c | 368 -- ext/mcrypt/php_mcrypt.h | 30 - ext/mcrypt/setup.stub | 6 - ext/mhash/Makefile.am | 5 - ext/mhash/config.h.stub | 2 - ext/mhash/config.m4 | 31 - ext/mhash/mhash.c | 146 - ext/mhash/php_mhash.h | 26 - ext/mhash/setup.stub | 6 - ext/msql/Makefile.am | 5 - ext/msql/config.h.stub | 2 - ext/msql/config.m4 | 46 - ext/msql/php_msql.c | 1303 ----- ext/msql/php_msql.h | 99 - ext/msql/setup.stub | 11 - ext/mssql/Readme_w32.txt | 10 - ext/mssql/mssql.dsp | 168 - ext/mssql/php_mssql.c | 1421 ----- ext/mssql/php_mssql.h | 150 - ext/mysql/Makefile.am | 13 - ext/mysql/Readme_w32.txt | 14 - ext/mysql/config.h.stub | 3 - ext/mysql/config.m4 | 79 - ext/mysql/mysql.dsp | 171 - ext/mysql/php_mysql.c | 1802 ------ ext/mysql/php_mysql.h | 122 - ext/mysql/setup.stub | 7 - ext/oci8/Makefile.am | 5 - ext/oci8/config.h.stub | 4 - ext/oci8/config.m4 | 174 - ext/oci8/oci8.c | 3712 ------------ ext/oci8/php_oci8.h | 208 - ext/oci8/setup.stub | 6 - ext/odbc/Makefile.am | 3 - ext/odbc/config.h.stub | 12 - ext/odbc/config.m4 | 401 -- ext/odbc/php_odbc.c | 3074 ---------- ext/odbc/php_odbc.h | 310 - ext/odbc/php_velocis.h | 109 - ext/odbc/setup.stub | 113 - ext/odbc/velocis.c | 648 --- ext/oracle/Makefile.am | 4 - ext/oracle/config.h.stub | 2 - ext/oracle/config.m4 | 172 - ext/oracle/oracle.c | 1727 ------ ext/oracle/php_oracle.h | 148 - ext/oracle/setup.stub | 9 - ext/pcre/Makefile.am | 7 - ext/pcre/config.h.stub | 5 - ext/pcre/config.m4 | 64 - ext/pcre/config0.m4 | 64 - ext/pcre/pcrelib/ChangeLog | 519 -- ext/pcre/pcrelib/LICENCE | 32 - ext/pcre/pcrelib/Makefile.am | 2 - ext/pcre/pcrelib/README | 416 -- ext/pcre/pcrelib/RunTest | 94 - ext/pcre/pcrelib/Tech.Notes | 239 - ext/pcre/pcrelib/chartables.c | 146 - ext/pcre/pcrelib/dftables.c | 146 - ext/pcre/pcrelib/dll.mk | 60 - ext/pcre/pcrelib/get.c | 189 - ext/pcre/pcrelib/internal.h | 343 -- ext/pcre/pcrelib/maketables.c | 113 - ext/pcre/pcrelib/pcre.3 | 1499 ----- ext/pcre/pcrelib/pcre.3.html | 1973 ------- ext/pcre/pcrelib/pcre.3.txt | 1739 ------ ext/pcre/pcrelib/pcre.c | 4477 -------------- ext/pcre/pcrelib/pcre.def | 19 - ext/pcre/pcrelib/pcre.h | 94 - ext/pcre/pcrelib/pcreposix.3 | 141 - ext/pcre/pcrelib/pcreposix.3.html | 182 - ext/pcre/pcrelib/pcreposix.3.txt | 150 - ext/pcre/pcrelib/pcreposix.c | 250 - ext/pcre/pcrelib/pcreposix.h | 82 - ext/pcre/pcrelib/pcretest.c | 1010 ---- ext/pcre/pcrelib/perltest | 143 - ext/pcre/pcrelib/pgrep.1 | 76 - ext/pcre/pcrelib/pgrep.1.html | 105 - ext/pcre/pcrelib/pgrep.1.txt | 86 - ext/pcre/pcrelib/pgrep.c | 225 - ext/pcre/pcrelib/study.c | 397 -- ext/pcre/pcrelib/testinput1 | 1890 ------ ext/pcre/pcrelib/testinput2 | 589 -- ext/pcre/pcrelib/testinput3 | 1692 ------ ext/pcre/pcrelib/testinput4 | 64 - ext/pcre/pcrelib/testoutput1 | 2887 --------- ext/pcre/pcrelib/testoutput2 | 1624 ------ ext/pcre/pcrelib/testoutput3 | 2929 ---------- ext/pcre/pcrelib/testoutput4 | 115 - ext/pcre/php_pcre.c | 1221 ---- ext/pcre/php_pcre.h | 98 - ext/pcre/setup.stub | 6 - ext/pdf/Makefile.am | 5 - ext/pdf/config.h.stub | 3 - ext/pdf/config.m4 | 108 - ext/pdf/pdf.c | 2539 -------- ext/pdf/php_pdf.h | 125 - ext/pdf/setup.stub | 7 - ext/pgsql/Makefile.am | 13 - ext/pgsql/config.h.stub | 8 - ext/pgsql/config.m4 | 63 - ext/pgsql/pgsql.c | 1503 ----- ext/pgsql/pgsql.dsp | 111 - ext/pgsql/php_pgsql.h | 150 - ext/pgsql/setup.stub | 8 - ext/posix/Makefile.am | 5 - ext/posix/config.h.stub | 0 ext/posix/config.m4 | 18 - ext/posix/php_posix.h | 97 - ext/posix/posix.c | 889 --- ext/readline/Makefile.am | 5 - ext/readline/config.h.stub | 3 - ext/readline/config.m4 | 34 - ext/readline/php_readline.h | 43 - ext/readline/readline.c | 420 -- ext/readline/setup.stub | 3 - ext/rpc/Makefile.am | 25 - ext/rpc/com/COM.c | 1044 ---- ext/rpc/com/php_com.h | 24 - ext/rpc/config.h.stub | 3 - ext/rpc/java/Makefile.am | 25 - ext/rpc/java/README | 154 - ext/rpc/java/config.h.stub | 3 - ext/rpc/java/config.m4 | 67 - ext/rpc/java/java.c | 528 -- ext/rpc/java/java.dsp | 258 - ext/rpc/java/jawt.php | 28 - ext/rpc/java/jver.php | 15 - ext/rpc/java/reflect.java | 279 - ext/session/Makefile.am | 5 - ext/session/config.h.stub | 4 - ext/session/config.m4 | 42 - ext/session/mod_files.c | 288 - ext/session/mod_files.h | 38 - ext/session/mod_files.sh | 16 - ext/session/mod_mm.c | 342 -- ext/session/mod_mm.h | 52 - ext/session/mod_user.c | 186 - ext/session/mod_user.h | 39 - ext/session/modules.c | 15 - ext/session/php_session.h | 165 - ext/session/session.c | 1183 ---- ext/session/setup.stub | 6 - ext/snmp/Makefile.am | 12 - ext/snmp/config.h.stub | 4 - ext/snmp/config.m4 | 85 - ext/snmp/php_snmp.h | 54 - ext/snmp/snmp.c | 378 -- ext/snmp/winsnmp.c | 228 - ext/standard/Makefile.am | 15 - ext/standard/array.c | 2068 ------- ext/standard/assert.c | 354 -- ext/standard/base64.c | 193 - ext/standard/base64.h | 47 - ext/standard/basic_functions.c | 1527 ----- ext/standard/basic_functions.h | 145 - ext/standard/browscap.c | 123 - ext/standard/config.h.stub | 17 - ext/standard/config.m4 | 143 - ext/standard/crypt.c | 189 - ext/standard/cyr_convert.c | 290 - ext/standard/cyr_convert.h | 40 - ext/standard/datetime.c | 630 -- ext/standard/datetime.h | 52 - ext/standard/dir.c | 312 - ext/standard/dl.c | 181 - ext/standard/dl.h | 61 - ext/standard/dns.c | 318 - ext/standard/dns.h | 53 - ext/standard/exec.c | 417 -- ext/standard/exec.h | 43 - ext/standard/file.c | 1767 ------ ext/standard/file.h | 81 - ext/standard/filestat.c | 606 -- ext/standard/flock_compat.c | 219 - ext/standard/flock_compat.h | 28 - ext/standard/formatted_print.c | 592 -- ext/standard/fsock.c | 770 --- ext/standard/fsock.h | 104 - ext/standard/global.h | 62 - ext/standard/head.c | 585 -- ext/standard/head.h | 67 - ext/standard/html.c | 172 - ext/standard/html.h | 41 - ext/standard/image.c | 384 -- ext/standard/info.c | 511 -- ext/standard/info.h | 67 - ext/standard/iptc.c | 387 -- ext/standard/lcg.c | 102 - ext/standard/link.c | 201 - ext/standard/mail.c | 172 - ext/standard/math.c | 712 --- ext/standard/md5.c | 392 -- ext/standard/md5.h | 71 - ext/standard/metaphone.c | 475 -- ext/standard/microtime.c | 143 - ext/standard/microtime.h | 39 - ext/standard/output.c | 386 -- ext/standard/pack.c | 874 --- ext/standard/pack.h | 44 - ext/standard/pageinfo.c | 146 - ext/standard/pageinfo.h | 11 - ext/standard/parsedate.y | 917 --- ext/standard/php_array.h | 106 - ext/standard/php_assert.h | 28 - ext/standard/php_browscap.h | 45 - ext/standard/php_crypt.h | 15 - ext/standard/php_dir.h | 39 - ext/standard/php_filestat.h | 69 - ext/standard/php_image.h | 26 - ext/standard/php_iptc.h | 39 - ext/standard/php_lcg.h | 43 - ext/standard/php_link.h | 41 - ext/standard/php_mail.h | 49 - ext/standard/php_metaphone.h | 28 - ext/standard/php_output.h | 34 - ext/standard/php_rand.h | 37 - ext/standard/php_standard.h | 75 - ext/standard/php_string.h | 107 - ext/standard/php_syslog.h | 53 - ext/standard/php_var.h | 42 - ext/standard/phpdir.h | 44 - ext/standard/phpmath.h | 70 - ext/standard/post.c | 420 -- ext/standard/post.h | 45 - ext/standard/quot_print.c | 98 - ext/standard/quot_print.h | 37 - ext/standard/rand.c | 364 -- ext/standard/reg.c | 653 --- ext/standard/reg.h | 71 - ext/standard/soundex.c | 120 - ext/standard/string.c | 2326 -------- ext/standard/syslog.c | 283 - ext/standard/type.c | 96 - ext/standard/type.h | 41 - ext/standard/uniqid.c | 100 - ext/standard/uniqid.h | 37 - ext/standard/url.c | 432 -- ext/standard/url.h | 60 - ext/standard/url_scanner.c | 536 -- ext/standard/url_scanner.h | 25 - ext/standard/url_scanner.re | 198 - ext/standard/var.c | 522 -- ext/sybase/Makefile.am | 5 - ext/sybase/config.h.stub | 4 - ext/sybase/config.m4 | 31 - ext/sybase/php_sybase.h | 143 - ext/sybase/setup.stub | 11 - ext/sybase/sybase.c | 1235 ---- ext/sybase_ct/Makefile.am | 5 - ext/sybase_ct/config.h.stub | 4 - ext/sybase_ct/config.m4 | 42 - ext/sybase_ct/php_sybase_ct.c | 1575 ----- ext/sybase_ct/php_sybase_ct.h | 124 - ext/sybase_ct/setup.stub | 6 - ext/sysvsem/Makefile.am | 5 - ext/sysvsem/config.h.stub | 7 - ext/sysvsem/config.m4 | 37 - ext/sysvsem/php_sysvsem.h | 76 - ext/sysvsem/setup.stub | 5 - ext/sysvsem/sysvsem.c | 352 -- ext/sysvshm/Makefile.am | 5 - ext/sysvshm/config.h.stub | 3 - ext/sysvshm/config.m4 | 17 - ext/sysvshm/php_sysvshm.h | 103 - ext/sysvshm/setup.stub | 5 - ext/sysvshm/sysvshm.c | 409 -- ext/wddx/Makefile.am | 5 - ext/wddx/config.h.stub | 2 - ext/wddx/config.m4 | 20 - ext/wddx/php_wddx.h | 59 - ext/wddx/php_wddx_api.h | 54 - ext/wddx/setup.stub | 6 - ext/wddx/wddx.c | 894 --- ext/xml/Makefile.am | 12 - ext/xml/config.h.stub | 4 - ext/xml/config.m4 | 58 - ext/xml/php_xml.h | 156 - ext/xml/xml.c | 1519 ----- ext/yp/Makefile.am | 5 - ext/yp/config.h.stub | 5 - ext/yp/config.m4 | 29 - ext/yp/php_yp.h | 62 - ext/yp/setup.stub | 6 - ext/yp/yp.c | 180 - ext/zlib/Makefile.am | 5 - ext/zlib/config.h.stub | 2 - ext/zlib/config.m4 | 38 - ext/zlib/php_zlib.h | 79 - ext/zlib/setup.stub | 7 - ext/zlib/zlib.c | 743 --- fhttpd.c | 185 - filepro.mak | 194 - footer | 7 - gd.mak | 214 - genfiles | 7 - genif.pl | 24 - genif.sh | 40 - getopt.c | 170 - header | 18 - hyperwave.mak | 214 - imap4.mak | 194 - ldap.mak | 194 - ltconfig | 3017 ---------- ltmain.sh | 4064 ------------- main.h | 56 - main/SAPI.c | 357 -- main/SAPI.h | 169 - main/alloca.c | 490 -- main/config.w32.h | 316 - main/configuration-parser.y | 440 -- main/configuration-scanner.l | 179 - main/fopen_wrappers.c | 1007 ---- main/fopen_wrappers.h | 89 - main/internal_functions.c.in | 86 - main/internal_functions_registry.h | 46 - main/internal_functions_win32.c | 117 - main/logos.h | 942 --- main/main.c | 1293 ---- main/mergesort.c | 344 -- main/output.c | 386 -- main/php.h | 390 -- main/php3_compat.h | 93 - main/php_content_types.c | 29 - main/php_content_types.h | 7 - main/php_globals.h | 112 - main/php_ini.c | 460 -- main/php_ini.h | 149 - main/php_output.h | 34 - main/php_realpath.h | 30 - main/php_reentrancy.h | 85 - main/php_regex.h | 43 - main/php_version.h | 3 - main/reentrancy.c | 309 - main/rfc1867.c | 265 - main/rfc1867.h | 12 - main/safe_mode.c | 144 - main/safe_mode.h | 7 - main/snprintf.c | 934 --- main/snprintf.h | 45 - main/strlcat.c | 77 - main/strlcpy.c | 74 - main/win95nt.h | 74 - makeall.bat | 13 - makedist | 134 - makeparser.bat | 4 - makerpm | 173 - msql.mak | 194 - msql1.mak | 212 - mtparser.bat | 4 - mysql.mak | 197 - patch-aa | 80 - patch-ab | 126 - php.ini-dist | 319 - php3_realpath.c | 275 - php3_sprintf.c | 42 - php4.dsp | 101 - php4.dsw | 59 - php4.gif | Bin 2123 -> 0 bytes php4.spec.in | 48 - php4dll.dsp | 918 --- php4dllts.dsp | 906 --- php4ext.dsw | 29 - php4ts.dsp | 101 - php4ts.dsw | 92 - php_custom_build.mak | 269 - php_getopt.h | 9 - regex/COPYRIGHT | 20 - regex/Makefile.am | 3 - regex/README | 32 - regex/WHATSNEW | 92 - regex/cclass.h | 31 - regex/cname.h | 102 - regex/debug.c | 242 - regex/debug.ih | 14 - regex/engine.c | 1019 ---- regex/engine.ih | 35 - regex/main.c | 510 -- regex/main.ih | 19 - regex/mkh | 76 - regex/regcomp.c | 1605 ----- regex/regcomp.ih | 51 - regex/regerror.c | 126 - regex/regerror.ih | 12 - regex/regex.3 | 502 -- regex/regex.7 | 233 - regex/regex.dsp | 106 - regex/regex.dsw | 29 - regex/regex.h | 83 - regex/regex.mak | 304 - regex/regex2.h | 140 - regex/regex_extra.h | 23 - regex/regexec.c | 138 - regex/regfree.c | 37 - regex/split.c | 316 - regex/tests | 475 -- regex/utils.h | 25 - request_info.c | 103 - request_info.h | 43 - sapi/Makefile.am | 4 - sapi/README | 20 - sapi/aolserver/Makefile.am | 4 - sapi/aolserver/aolserver.c | 609 -- sapi/aolserver/config.h.stub | 1 - sapi/aolserver/config.m4 | 24 - sapi/aolserver/php.sym | 2 - sapi/apache/Makefile.am | 6 - sapi/apache/apMakefile.libdir | 4 - sapi/apache/apMakefile.tmpl | 77 - sapi/apache/config.h.stub | 0 sapi/apache/config.m4 | 209 - sapi/apache/libphp4.module.in | 7 - sapi/apache/mod_php4.c | 629 -- sapi/apache/mod_php4.exp | 1 - sapi/apache/mod_php4.h | 49 - sapi/apache/php.sym | 1 - sapi/apache/sapi_apache.c | 100 - sapi/cgi/Makefile.am | 4 - sapi/cgi/cgi_main.c | 497 -- sapi/cgi/config.h.in | 0 sapi/cgi/config.m4 | 84 - sapi/cgi/php.sym | 0 sapi/isapi/Makefile.am | 5 - sapi/isapi/config.m4 | 28 - sapi/isapi/php.sym | 5 - sapi/isapi/php4isapi.c | 493 -- sapi/isapi/php4isapi.def | 5 - sapi/isapi/php4isapi.dsp | 106 - sapi/roxen/Makefile.am | 4 - sapi/roxen/README | 17 - sapi/roxen/config.h.stub | 12 - sapi/roxen/config.m4 | 63 - sapi/roxen/phpmod.pike | 363 -- sapi/roxen/roxen.c | 745 --- sapi/servlet/Makefile.am | 28 - sapi/servlet/README | 52 - sapi/servlet/config.h.stub | 3 - sapi/servlet/config.m4 | 40 - sapi/servlet/servlet.c | 380 -- sapi/servlet/servlet.dsp | 271 - sapi/servlet/servlet.java | 138 - sapi/servlet/web.xml | 24 - scripts/apache/apconf-conv.sh | 24 - scripts/apache/aphtaccess-conv.sh | 24 - scripts/apache/conffix.awk | 23 - scripts/apache/htaccessfix.awk | 23 - scripts/armerge | 83 - scripts/config-stubs | 8 - scripts/conv_proto | 30 - scripts/mkextlib.in | 17 - scripts/preconfig | 32 - snmp.mak | 194 - stamp-h.in | 1 - strtok_r.c | 113 - stub.c | 0 tests/foo | 5 - tests/foo2 | 3 - tests/foo3 | 43 - tests/foo4 | 41 - tests/recurse | 21 - tests/test.php4 | 15 - tests/test.pl | 34 - tests/test_class_inheritance | 29 - tests/testarray | 20 - tests/testarray.pl | 5 - tests/testarray2 | 4 - tests/testarray2.pl | 3 - tests/testclassfunc | 9 - tests/testcom | 9 - tests/testcpdf | 97 - tests/testfe | 18 - tests/testfunc | 34 - tests/testfunc.pl | 20 - tests/testfunc2 | 19 - tests/testfunc2.pl | 22 - tests/testfuncref | 10 - tests/testhyperwave | 200 - tests/testinclude | 5 - tests/testobj | 31 - win32/flock.c | 83 - win32/flock.h | 11 - win32/grp.h | 31 - win32/param.h | 16 - win32/php_modules.dsw | 41 - win32/php_registry.h | 7 - win32/pwd.c | 74 - win32/pwd.h | 57 - win32/readdir.c | 112 - win32/readdir.h | 38 - win32/registry.c | 74 - win32/sendmail.c | 501 -- win32/sendmail.h | 46 - win32/signal.h | 16 - win32/syslog.h | 73 - win32/time.c | 153 - win32/time.h | 43 - win32/unistd.h | 1 - win32/wfile.c | 17 - win32/wfile.h | 16 - win32/winutil.c | 21 - win32/winutil.h | 1 - win32/wsyslog.c | 122 - zlib.mak | 194 - 812 files changed, 218901 deletions(-) delete mode 100644 CODING_STANDARDS delete mode 100644 CREDITS delete mode 100644 ChangeLog delete mode 100644 FUNCTION_LIST.txt delete mode 100644 INSTALL delete mode 100644 LICENSE delete mode 100644 MAINTAINERS delete mode 100644 MODULES_STATUS delete mode 100644 Makefile.am delete mode 100644 NEWS delete mode 100644 README-BCMATH delete mode 100644 README.CVS-RULES delete mode 100644 README.QNX delete mode 100644 TODO delete mode 100644 TODO-LeftOver delete mode 100644 TSRM/Makefile.am delete mode 100644 TSRM/TSRM.c delete mode 100644 TSRM/TSRM.dsp delete mode 100644 TSRM/TSRM.h delete mode 100644 TSRM/acconfig.h delete mode 100644 TSRM/acinclude.m4 delete mode 100644 TSRM/build.mk delete mode 100755 TSRM/buildconf delete mode 100644 TSRM/configure.in delete mode 100644 Zend/FlexLexer.h delete mode 100644 Zend/LICENSE delete mode 100644 Zend/Makefile.am delete mode 100644 Zend/ZEND_CHANGES delete mode 100644 Zend/ZendCore.dep delete mode 100644 Zend/acconfig.h delete mode 100644 Zend/acinclude.m4 delete mode 100644 Zend/build.mk delete mode 100755 Zend/buildconf delete mode 100644 Zend/configure.in delete mode 100644 Zend/flex.skl delete mode 100644 Zend/libzend.dsp delete mode 100644 Zend/libzendts.dsp delete mode 100644 Zend/zend-parser.y delete mode 100644 Zend/zend-scanner.h delete mode 100644 Zend/zend-scanner.l delete mode 100644 Zend/zend.c delete mode 100644 Zend/zend.h delete mode 100644 Zend/zend.ico delete mode 100644 Zend/zend_API.c delete mode 100644 Zend/zend_API.h delete mode 100644 Zend/zend_alloc.c delete mode 100644 Zend/zend_alloc.h delete mode 100644 Zend/zend_builtin_functions.c delete mode 100644 Zend/zend_builtin_functions.h delete mode 100644 Zend/zend_compile.c delete mode 100644 Zend/zend_compile.h delete mode 100644 Zend/zend_config.w32.h delete mode 100644 Zend/zend_constants.c delete mode 100644 Zend/zend_constants.h delete mode 100644 Zend/zend_errors.h delete mode 100644 Zend/zend_execute.c delete mode 100644 Zend/zend_execute.h delete mode 100644 Zend/zend_execute_API.c delete mode 100644 Zend/zend_extensions.c delete mode 100644 Zend/zend_extensions.h delete mode 100644 Zend/zend_globals.h delete mode 100644 Zend/zend_globals_macros.h delete mode 100644 Zend/zend_hash.c delete mode 100644 Zend/zend_hash.h delete mode 100644 Zend/zend_highlight.c delete mode 100644 Zend/zend_highlight.h delete mode 100644 Zend/zend_indent.c delete mode 100644 Zend/zend_indent.h delete mode 100644 Zend/zend_list.c delete mode 100644 Zend/zend_list.h delete mode 100644 Zend/zend_llist.c delete mode 100644 Zend/zend_llist.h delete mode 100644 Zend/zend_modules.h delete mode 100644 Zend/zend_opcode.c delete mode 100644 Zend/zend_operators.c delete mode 100644 Zend/zend_operators.h delete mode 100644 Zend/zend_ptr_stack.c delete mode 100644 Zend/zend_ptr_stack.h delete mode 100644 Zend/zend_sprintf.c delete mode 100644 Zend/zend_stack.c delete mode 100644 Zend/zend_stack.h delete mode 100644 Zend/zend_variables.c delete mode 100644 Zend/zend_variables.h delete mode 100644 acconfig.h.in delete mode 100644 acinclude.m4 delete mode 100644 apidoc-zend.txt delete mode 100644 apidoc.txt delete mode 100644 build-defs.h.in delete mode 100644 build.mk delete mode 100755 buildcheck.sh delete mode 100755 buildconf delete mode 100644 calendar.mak delete mode 100644 config.guess delete mode 100644 config.sub delete mode 100644 configure.in delete mode 100644 crypt.mak delete mode 100644 dbase.mak delete mode 100644 dbm.mak delete mode 100644 dlist.c delete mode 100644 dlist.h delete mode 100644 ext/Makefile.am delete mode 100644 ext/apache/Makefile.am delete mode 100644 ext/apache/apache.c delete mode 100644 ext/apache/config.m4 delete mode 100644 ext/aspell/Makefile.am delete mode 100644 ext/aspell/aspell.c delete mode 100644 ext/aspell/config.h.stub delete mode 100644 ext/aspell/config.m4 delete mode 100644 ext/aspell/php_aspell.h delete mode 100644 ext/bcmath/Makefile.am delete mode 100644 ext/bcmath/bcmath.c delete mode 100644 ext/bcmath/config.h.stub delete mode 100644 ext/bcmath/config.m4 delete mode 100644 ext/bcmath/php_bcmath.h delete mode 100644 ext/bcmath/setup.stub delete mode 100644 ext/com/php_COM.h delete mode 100644 ext/cpdf/Makefile.am delete mode 100644 ext/cpdf/config.h.stub delete mode 100644 ext/cpdf/config.m4 delete mode 100644 ext/cpdf/cpdf.c delete mode 100644 ext/cpdf/php_cpdf.h delete mode 100644 ext/cybercash/Makefile.am delete mode 100644 ext/cybercash/config.h.stub delete mode 100644 ext/cybercash/config.m4 delete mode 100644 ext/cybercash/cybercash.c delete mode 100644 ext/cybercash/cybercash.h delete mode 100644 ext/cybercash/cyberlib.php delete mode 100644 ext/cybercash/test.php delete mode 100644 ext/dav/Makefile.am delete mode 100644 ext/dav/config.h.stub delete mode 100644 ext/dav/config.m4 delete mode 100644 ext/dav/dav.c delete mode 100644 ext/dav/php_dav.h delete mode 100644 ext/dav/setup.stub delete mode 100644 ext/db/Makefile.am delete mode 100644 ext/db/config.h.stub delete mode 100644 ext/db/config.m4 delete mode 100644 ext/db/db.c delete mode 100644 ext/db/php_db.h delete mode 100644 ext/dba/Makefile.am delete mode 100644 ext/dba/config.h.stub delete mode 100644 ext/dba/config.m4 delete mode 100644 ext/dba/dba.c delete mode 100644 ext/dba/dba_cdb.c delete mode 100644 ext/dba/dba_db2.c delete mode 100644 ext/dba/dba_db3.c delete mode 100644 ext/dba/dba_dbm.c delete mode 100644 ext/dba/dba_gdbm.c delete mode 100644 ext/dba/dba_ndbm.c delete mode 100644 ext/dba/php_cdb.h delete mode 100644 ext/dba/php_db2.h delete mode 100644 ext/dba/php_db3.h delete mode 100644 ext/dba/php_dba.h delete mode 100644 ext/dba/php_dbm.h delete mode 100644 ext/dba/php_gdbm.h delete mode 100644 ext/dba/php_ndbm.h delete mode 100644 ext/dba/setup.stub delete mode 100644 ext/dbase/Makefile.am delete mode 100644 ext/dbase/config.h.stub delete mode 100644 ext/dbase/config.m4 delete mode 100644 ext/dbase/dbase.c delete mode 100644 ext/dbase/dbf.h delete mode 100644 ext/dbase/dbf_head.c delete mode 100644 ext/dbase/dbf_head.h delete mode 100644 ext/dbase/dbf_misc.c delete mode 100644 ext/dbase/dbf_misc.h delete mode 100644 ext/dbase/dbf_ndx.c delete mode 100644 ext/dbase/dbf_ndx.h delete mode 100644 ext/dbase/dbf_rec.c delete mode 100644 ext/dbase/dbf_rec.h delete mode 100644 ext/dbase/php_dbase.h delete mode 100644 ext/dbase/setup.stub delete mode 100644 ext/domxml/Makefile.am delete mode 100644 ext/domxml/config.h.stub delete mode 100644 ext/domxml/config.m4 delete mode 100644 ext/domxml/domxml.c delete mode 100644 ext/domxml/php_domxml.h delete mode 100644 ext/ereg/ereg.c delete mode 100644 ext/ereg/php_ereg.h delete mode 100644 ext/ereg/php_regex.h delete mode 100644 ext/ereg/regex/COPYRIGHT delete mode 100644 ext/ereg/regex/Makefile.am delete mode 100644 ext/ereg/regex/README delete mode 100644 ext/ereg/regex/WHATSNEW delete mode 100644 ext/ereg/regex/cclass.h delete mode 100644 ext/ereg/regex/cname.h delete mode 100644 ext/ereg/regex/debug.c delete mode 100644 ext/ereg/regex/debug.ih delete mode 100644 ext/ereg/regex/engine.c delete mode 100644 ext/ereg/regex/engine.ih delete mode 100644 ext/ereg/regex/main.c delete mode 100644 ext/ereg/regex/main.ih delete mode 100644 ext/ereg/regex/mkh delete mode 100644 ext/ereg/regex/regcomp.c delete mode 100644 ext/ereg/regex/regcomp.ih delete mode 100644 ext/ereg/regex/regerror.c delete mode 100644 ext/ereg/regex/regerror.ih delete mode 100644 ext/ereg/regex/regex.3 delete mode 100644 ext/ereg/regex/regex.7 delete mode 100644 ext/ereg/regex/regex.dsp delete mode 100644 ext/ereg/regex/regex.dsw delete mode 100644 ext/ereg/regex/regex.h delete mode 100644 ext/ereg/regex/regex.mak delete mode 100644 ext/ereg/regex/regex2.h delete mode 100644 ext/ereg/regex/regex_extra.h delete mode 100644 ext/ereg/regex/regexec.c delete mode 100644 ext/ereg/regex/regfree.c delete mode 100644 ext/ereg/regex/split.c delete mode 100644 ext/ereg/regex/tests delete mode 100644 ext/ereg/regex/utils.h delete mode 100755 ext/ext_skel delete mode 100644 ext/fdf/Makefile.am delete mode 100644 ext/fdf/config.h.stub delete mode 100644 ext/fdf/config.m4 delete mode 100644 ext/fdf/fdf.c delete mode 100644 ext/fdf/php_fdf.h delete mode 100644 ext/fdf/setup.stub delete mode 100644 ext/filepro/Makefile.am delete mode 100644 ext/filepro/config.h.stub delete mode 100644 ext/filepro/config.m4 delete mode 100644 ext/filepro/filepro.c delete mode 100644 ext/filepro/php_filepro.h delete mode 100644 ext/filepro/setup.stub delete mode 100644 ext/ftp/Makefile.am delete mode 100644 ext/ftp/config.h.stub delete mode 100644 ext/ftp/config.m4 delete mode 100644 ext/ftp/ftp.c delete mode 100644 ext/ftp/ftp.h delete mode 100644 ext/ftp/php_ftp.c delete mode 100644 ext/ftp/php_ftp.h delete mode 100644 ext/gd/Makefile.am delete mode 100644 ext/gd/config.h.stub delete mode 100644 ext/gd/config.m4 delete mode 100644 ext/gd/gd.c delete mode 100644 ext/gd/gdcache.c delete mode 100644 ext/gd/gdcache.h delete mode 100644 ext/gd/gdt1.c delete mode 100644 ext/gd/gdt1.h delete mode 100644 ext/gd/gdttf.c delete mode 100644 ext/gd/gdttf.h delete mode 100644 ext/gd/php_gd.h delete mode 100644 ext/gd/setup.stub delete mode 100644 ext/gettext/Makefile.am delete mode 100644 ext/gettext/config.h.stub delete mode 100644 ext/gettext/config.m4 delete mode 100644 ext/gettext/gettext.c delete mode 100644 ext/gettext/php_gettext.h delete mode 100644 ext/gettext/setup.stub delete mode 100644 ext/hyperwave/Makefile.am delete mode 100644 ext/hyperwave/config.h.stub delete mode 100644 ext/hyperwave/config.m4 delete mode 100644 ext/hyperwave/debug.h delete mode 100644 ext/hyperwave/hg_comm.c delete mode 100644 ext/hyperwave/hg_comm.h delete mode 100644 ext/hyperwave/hw.c delete mode 100644 ext/hyperwave/hw_error.h delete mode 100644 ext/hyperwave/php_hyperwave.h delete mode 100644 ext/hyperwave/setup.stub delete mode 100644 ext/icap/Makefile.am delete mode 100644 ext/icap/config.h.stub delete mode 100644 ext/icap/config.m4 delete mode 100644 ext/icap/php3_icap.c delete mode 100644 ext/icap/php_icap.h delete mode 100644 ext/imap/Makefile.am delete mode 100644 ext/imap/config.h.stub delete mode 100644 ext/imap/config.m4 delete mode 100644 ext/imap/imap.c delete mode 100644 ext/imap/imap.h delete mode 100644 ext/imap/setup.stub delete mode 100644 ext/informix/Makefile.am delete mode 100644 ext/informix/config.h.stub delete mode 100644 ext/informix/config.m4 delete mode 100644 ext/informix/ifx.dsp delete mode 100644 ext/informix/ifx.dsw delete mode 100644 ext/informix/ifx.ec delete mode 100644 ext/informix/ifx_custom_build.dsp delete mode 100644 ext/informix/ifx_custom_build.dsw delete mode 100644 ext/informix/php_informix.h delete mode 100644 ext/informix/setup.stub delete mode 100644 ext/informix/stub.c delete mode 100644 ext/interbase/Makefile.am delete mode 100644 ext/interbase/config.h.stub delete mode 100644 ext/interbase/config.m4 delete mode 100644 ext/interbase/interbase.c delete mode 100644 ext/interbase/php_interbase.h delete mode 100644 ext/interbase/setup.stub delete mode 100644 ext/java/Makefile.am delete mode 100644 ext/java/README delete mode 100644 ext/java/config.h.stub delete mode 100644 ext/java/config.m4 delete mode 100644 ext/java/java.c delete mode 100644 ext/java/java.dsp delete mode 100644 ext/java/jawt.php delete mode 100644 ext/java/jver.php delete mode 100644 ext/java/reflect.java delete mode 100644 ext/ldap/Makefile.am delete mode 100644 ext/ldap/config.h.stub delete mode 100644 ext/ldap/config.m4 delete mode 100644 ext/ldap/ldap.c delete mode 100644 ext/ldap/php_ldap.h delete mode 100644 ext/ldap/setup.stub delete mode 100644 ext/mcal/Makefile.am delete mode 100644 ext/mcal/config.h.stub delete mode 100644 ext/mcal/config.m4 delete mode 100644 ext/mcal/php3_mcal.c delete mode 100644 ext/mcal/php_mcal.h delete mode 100644 ext/mcrypt/Makefile.am delete mode 100644 ext/mcrypt/config.h.stub delete mode 100644 ext/mcrypt/config.m4 delete mode 100644 ext/mcrypt/mcrypt.c delete mode 100644 ext/mcrypt/php_mcrypt.h delete mode 100644 ext/mcrypt/setup.stub delete mode 100644 ext/mhash/Makefile.am delete mode 100644 ext/mhash/config.h.stub delete mode 100644 ext/mhash/config.m4 delete mode 100644 ext/mhash/mhash.c delete mode 100644 ext/mhash/php_mhash.h delete mode 100644 ext/mhash/setup.stub delete mode 100644 ext/msql/Makefile.am delete mode 100644 ext/msql/config.h.stub delete mode 100644 ext/msql/config.m4 delete mode 100644 ext/msql/php_msql.c delete mode 100644 ext/msql/php_msql.h delete mode 100644 ext/msql/setup.stub delete mode 100644 ext/mssql/Readme_w32.txt delete mode 100644 ext/mssql/mssql.dsp delete mode 100644 ext/mssql/php_mssql.c delete mode 100644 ext/mssql/php_mssql.h delete mode 100644 ext/mysql/Makefile.am delete mode 100644 ext/mysql/Readme_w32.txt delete mode 100644 ext/mysql/config.h.stub delete mode 100644 ext/mysql/config.m4 delete mode 100644 ext/mysql/mysql.dsp delete mode 100644 ext/mysql/php_mysql.c delete mode 100644 ext/mysql/php_mysql.h delete mode 100644 ext/mysql/setup.stub delete mode 100644 ext/oci8/Makefile.am delete mode 100644 ext/oci8/config.h.stub delete mode 100644 ext/oci8/config.m4 delete mode 100644 ext/oci8/oci8.c delete mode 100644 ext/oci8/php_oci8.h delete mode 100644 ext/oci8/setup.stub delete mode 100644 ext/odbc/Makefile.am delete mode 100644 ext/odbc/config.h.stub delete mode 100644 ext/odbc/config.m4 delete mode 100644 ext/odbc/php_odbc.c delete mode 100644 ext/odbc/php_odbc.h delete mode 100644 ext/odbc/php_velocis.h delete mode 100644 ext/odbc/setup.stub delete mode 100644 ext/odbc/velocis.c delete mode 100644 ext/oracle/Makefile.am delete mode 100644 ext/oracle/config.h.stub delete mode 100644 ext/oracle/config.m4 delete mode 100644 ext/oracle/oracle.c delete mode 100644 ext/oracle/php_oracle.h delete mode 100644 ext/oracle/setup.stub delete mode 100644 ext/pcre/Makefile.am delete mode 100644 ext/pcre/config.h.stub delete mode 100644 ext/pcre/config.m4 delete mode 100644 ext/pcre/config0.m4 delete mode 100644 ext/pcre/pcrelib/ChangeLog delete mode 100644 ext/pcre/pcrelib/LICENCE delete mode 100644 ext/pcre/pcrelib/Makefile.am delete mode 100644 ext/pcre/pcrelib/README delete mode 100755 ext/pcre/pcrelib/RunTest delete mode 100644 ext/pcre/pcrelib/Tech.Notes delete mode 100644 ext/pcre/pcrelib/chartables.c delete mode 100644 ext/pcre/pcrelib/dftables.c delete mode 100644 ext/pcre/pcrelib/dll.mk delete mode 100644 ext/pcre/pcrelib/get.c delete mode 100644 ext/pcre/pcrelib/internal.h delete mode 100644 ext/pcre/pcrelib/maketables.c delete mode 100644 ext/pcre/pcrelib/pcre.3 delete mode 100644 ext/pcre/pcrelib/pcre.3.html delete mode 100644 ext/pcre/pcrelib/pcre.3.txt delete mode 100644 ext/pcre/pcrelib/pcre.c delete mode 100644 ext/pcre/pcrelib/pcre.def delete mode 100644 ext/pcre/pcrelib/pcre.h delete mode 100644 ext/pcre/pcrelib/pcreposix.3 delete mode 100644 ext/pcre/pcrelib/pcreposix.3.html delete mode 100644 ext/pcre/pcrelib/pcreposix.3.txt delete mode 100644 ext/pcre/pcrelib/pcreposix.c delete mode 100644 ext/pcre/pcrelib/pcreposix.h delete mode 100644 ext/pcre/pcrelib/pcretest.c delete mode 100755 ext/pcre/pcrelib/perltest delete mode 100644 ext/pcre/pcrelib/pgrep.1 delete mode 100644 ext/pcre/pcrelib/pgrep.1.html delete mode 100644 ext/pcre/pcrelib/pgrep.1.txt delete mode 100644 ext/pcre/pcrelib/pgrep.c delete mode 100644 ext/pcre/pcrelib/study.c delete mode 100644 ext/pcre/pcrelib/testinput1 delete mode 100644 ext/pcre/pcrelib/testinput2 delete mode 100644 ext/pcre/pcrelib/testinput3 delete mode 100644 ext/pcre/pcrelib/testinput4 delete mode 100644 ext/pcre/pcrelib/testoutput1 delete mode 100644 ext/pcre/pcrelib/testoutput2 delete mode 100644 ext/pcre/pcrelib/testoutput3 delete mode 100644 ext/pcre/pcrelib/testoutput4 delete mode 100644 ext/pcre/php_pcre.c delete mode 100644 ext/pcre/php_pcre.h delete mode 100644 ext/pcre/setup.stub delete mode 100644 ext/pdf/Makefile.am delete mode 100644 ext/pdf/config.h.stub delete mode 100644 ext/pdf/config.m4 delete mode 100644 ext/pdf/pdf.c delete mode 100644 ext/pdf/php_pdf.h delete mode 100644 ext/pdf/setup.stub delete mode 100644 ext/pgsql/Makefile.am delete mode 100644 ext/pgsql/config.h.stub delete mode 100644 ext/pgsql/config.m4 delete mode 100644 ext/pgsql/pgsql.c delete mode 100644 ext/pgsql/pgsql.dsp delete mode 100644 ext/pgsql/php_pgsql.h delete mode 100644 ext/pgsql/setup.stub delete mode 100644 ext/posix/Makefile.am delete mode 100644 ext/posix/config.h.stub delete mode 100644 ext/posix/config.m4 delete mode 100644 ext/posix/php_posix.h delete mode 100644 ext/posix/posix.c delete mode 100644 ext/readline/Makefile.am delete mode 100644 ext/readline/config.h.stub delete mode 100644 ext/readline/config.m4 delete mode 100644 ext/readline/php_readline.h delete mode 100644 ext/readline/readline.c delete mode 100644 ext/readline/setup.stub delete mode 100644 ext/rpc/Makefile.am delete mode 100644 ext/rpc/com/COM.c delete mode 100644 ext/rpc/com/php_com.h delete mode 100644 ext/rpc/config.h.stub delete mode 100644 ext/rpc/java/Makefile.am delete mode 100644 ext/rpc/java/README delete mode 100644 ext/rpc/java/config.h.stub delete mode 100644 ext/rpc/java/config.m4 delete mode 100644 ext/rpc/java/java.c delete mode 100644 ext/rpc/java/java.dsp delete mode 100644 ext/rpc/java/jawt.php delete mode 100644 ext/rpc/java/jver.php delete mode 100644 ext/rpc/java/reflect.java delete mode 100644 ext/session/Makefile.am delete mode 100644 ext/session/config.h.stub delete mode 100644 ext/session/config.m4 delete mode 100644 ext/session/mod_files.c delete mode 100644 ext/session/mod_files.h delete mode 100644 ext/session/mod_files.sh delete mode 100644 ext/session/mod_mm.c delete mode 100644 ext/session/mod_mm.h delete mode 100644 ext/session/mod_user.c delete mode 100644 ext/session/mod_user.h delete mode 100644 ext/session/modules.c delete mode 100644 ext/session/php_session.h delete mode 100644 ext/session/session.c delete mode 100644 ext/session/setup.stub delete mode 100644 ext/snmp/Makefile.am delete mode 100644 ext/snmp/config.h.stub delete mode 100644 ext/snmp/config.m4 delete mode 100644 ext/snmp/php_snmp.h delete mode 100644 ext/snmp/snmp.c delete mode 100644 ext/snmp/winsnmp.c delete mode 100644 ext/standard/Makefile.am delete mode 100644 ext/standard/array.c delete mode 100644 ext/standard/assert.c delete mode 100644 ext/standard/base64.c delete mode 100644 ext/standard/base64.h delete mode 100644 ext/standard/basic_functions.c delete mode 100644 ext/standard/basic_functions.h delete mode 100644 ext/standard/browscap.c delete mode 100644 ext/standard/config.h.stub delete mode 100644 ext/standard/config.m4 delete mode 100644 ext/standard/crypt.c delete mode 100644 ext/standard/cyr_convert.c delete mode 100644 ext/standard/cyr_convert.h delete mode 100644 ext/standard/datetime.c delete mode 100644 ext/standard/datetime.h delete mode 100644 ext/standard/dir.c delete mode 100644 ext/standard/dl.c delete mode 100644 ext/standard/dl.h delete mode 100644 ext/standard/dns.c delete mode 100644 ext/standard/dns.h delete mode 100644 ext/standard/exec.c delete mode 100644 ext/standard/exec.h delete mode 100644 ext/standard/file.c delete mode 100644 ext/standard/file.h delete mode 100644 ext/standard/filestat.c delete mode 100644 ext/standard/flock_compat.c delete mode 100644 ext/standard/flock_compat.h delete mode 100644 ext/standard/formatted_print.c delete mode 100644 ext/standard/fsock.c delete mode 100644 ext/standard/fsock.h delete mode 100644 ext/standard/global.h delete mode 100644 ext/standard/head.c delete mode 100644 ext/standard/head.h delete mode 100644 ext/standard/html.c delete mode 100644 ext/standard/html.h delete mode 100644 ext/standard/image.c delete mode 100644 ext/standard/info.c delete mode 100644 ext/standard/info.h delete mode 100644 ext/standard/iptc.c delete mode 100644 ext/standard/lcg.c delete mode 100644 ext/standard/link.c delete mode 100644 ext/standard/mail.c delete mode 100644 ext/standard/math.c delete mode 100644 ext/standard/md5.c delete mode 100644 ext/standard/md5.h delete mode 100644 ext/standard/metaphone.c delete mode 100644 ext/standard/microtime.c delete mode 100644 ext/standard/microtime.h delete mode 100644 ext/standard/output.c delete mode 100644 ext/standard/pack.c delete mode 100644 ext/standard/pack.h delete mode 100644 ext/standard/pageinfo.c delete mode 100644 ext/standard/pageinfo.h delete mode 100644 ext/standard/parsedate.y delete mode 100644 ext/standard/php_array.h delete mode 100644 ext/standard/php_assert.h delete mode 100644 ext/standard/php_browscap.h delete mode 100644 ext/standard/php_crypt.h delete mode 100644 ext/standard/php_dir.h delete mode 100644 ext/standard/php_filestat.h delete mode 100644 ext/standard/php_image.h delete mode 100644 ext/standard/php_iptc.h delete mode 100644 ext/standard/php_lcg.h delete mode 100644 ext/standard/php_link.h delete mode 100644 ext/standard/php_mail.h delete mode 100644 ext/standard/php_metaphone.h delete mode 100644 ext/standard/php_output.h delete mode 100644 ext/standard/php_rand.h delete mode 100644 ext/standard/php_standard.h delete mode 100644 ext/standard/php_string.h delete mode 100644 ext/standard/php_syslog.h delete mode 100644 ext/standard/php_var.h delete mode 100644 ext/standard/phpdir.h delete mode 100644 ext/standard/phpmath.h delete mode 100644 ext/standard/post.c delete mode 100644 ext/standard/post.h delete mode 100644 ext/standard/quot_print.c delete mode 100644 ext/standard/quot_print.h delete mode 100644 ext/standard/rand.c delete mode 100644 ext/standard/reg.c delete mode 100644 ext/standard/reg.h delete mode 100644 ext/standard/soundex.c delete mode 100644 ext/standard/string.c delete mode 100644 ext/standard/syslog.c delete mode 100644 ext/standard/type.c delete mode 100644 ext/standard/type.h delete mode 100644 ext/standard/uniqid.c delete mode 100644 ext/standard/uniqid.h delete mode 100644 ext/standard/url.c delete mode 100644 ext/standard/url.h delete mode 100644 ext/standard/url_scanner.c delete mode 100644 ext/standard/url_scanner.h delete mode 100644 ext/standard/url_scanner.re delete mode 100644 ext/standard/var.c delete mode 100644 ext/sybase/Makefile.am delete mode 100644 ext/sybase/config.h.stub delete mode 100644 ext/sybase/config.m4 delete mode 100644 ext/sybase/php_sybase.h delete mode 100644 ext/sybase/setup.stub delete mode 100644 ext/sybase/sybase.c delete mode 100644 ext/sybase_ct/Makefile.am delete mode 100644 ext/sybase_ct/config.h.stub delete mode 100644 ext/sybase_ct/config.m4 delete mode 100644 ext/sybase_ct/php_sybase_ct.c delete mode 100644 ext/sybase_ct/php_sybase_ct.h delete mode 100644 ext/sybase_ct/setup.stub delete mode 100644 ext/sysvsem/Makefile.am delete mode 100644 ext/sysvsem/config.h.stub delete mode 100644 ext/sysvsem/config.m4 delete mode 100644 ext/sysvsem/php_sysvsem.h delete mode 100644 ext/sysvsem/setup.stub delete mode 100644 ext/sysvsem/sysvsem.c delete mode 100644 ext/sysvshm/Makefile.am delete mode 100644 ext/sysvshm/config.h.stub delete mode 100644 ext/sysvshm/config.m4 delete mode 100644 ext/sysvshm/php_sysvshm.h delete mode 100644 ext/sysvshm/setup.stub delete mode 100644 ext/sysvshm/sysvshm.c delete mode 100644 ext/wddx/Makefile.am delete mode 100644 ext/wddx/config.h.stub delete mode 100644 ext/wddx/config.m4 delete mode 100644 ext/wddx/php_wddx.h delete mode 100644 ext/wddx/php_wddx_api.h delete mode 100644 ext/wddx/setup.stub delete mode 100644 ext/wddx/wddx.c delete mode 100644 ext/xml/Makefile.am delete mode 100644 ext/xml/config.h.stub delete mode 100644 ext/xml/config.m4 delete mode 100644 ext/xml/php_xml.h delete mode 100644 ext/xml/xml.c delete mode 100644 ext/yp/Makefile.am delete mode 100644 ext/yp/config.h.stub delete mode 100644 ext/yp/config.m4 delete mode 100644 ext/yp/php_yp.h delete mode 100644 ext/yp/setup.stub delete mode 100644 ext/yp/yp.c delete mode 100644 ext/zlib/Makefile.am delete mode 100644 ext/zlib/config.h.stub delete mode 100644 ext/zlib/config.m4 delete mode 100644 ext/zlib/php_zlib.h delete mode 100644 ext/zlib/setup.stub delete mode 100644 ext/zlib/zlib.c delete mode 100644 fhttpd.c delete mode 100644 filepro.mak delete mode 100644 footer delete mode 100644 gd.mak delete mode 100755 genfiles delete mode 100644 genif.pl delete mode 100644 genif.sh delete mode 100644 getopt.c delete mode 100644 header delete mode 100644 hyperwave.mak delete mode 100644 imap4.mak delete mode 100644 ldap.mak delete mode 100644 ltconfig delete mode 100644 ltmain.sh delete mode 100644 main.h delete mode 100644 main/SAPI.c delete mode 100644 main/SAPI.h delete mode 100644 main/alloca.c delete mode 100644 main/config.w32.h delete mode 100644 main/configuration-parser.y delete mode 100644 main/configuration-scanner.l delete mode 100644 main/fopen_wrappers.c delete mode 100644 main/fopen_wrappers.h delete mode 100644 main/internal_functions.c.in delete mode 100644 main/internal_functions_registry.h delete mode 100644 main/internal_functions_win32.c delete mode 100644 main/logos.h delete mode 100644 main/main.c delete mode 100644 main/mergesort.c delete mode 100644 main/output.c delete mode 100644 main/php.h delete mode 100644 main/php3_compat.h delete mode 100644 main/php_content_types.c delete mode 100644 main/php_content_types.h delete mode 100644 main/php_globals.h delete mode 100644 main/php_ini.c delete mode 100644 main/php_ini.h delete mode 100644 main/php_output.h delete mode 100644 main/php_realpath.h delete mode 100644 main/php_reentrancy.h delete mode 100644 main/php_regex.h delete mode 100644 main/php_version.h delete mode 100644 main/reentrancy.c delete mode 100644 main/rfc1867.c delete mode 100644 main/rfc1867.h delete mode 100644 main/safe_mode.c delete mode 100644 main/safe_mode.h delete mode 100644 main/snprintf.c delete mode 100644 main/snprintf.h delete mode 100644 main/strlcat.c delete mode 100644 main/strlcpy.c delete mode 100644 main/win95nt.h delete mode 100755 makeall.bat delete mode 100755 makedist delete mode 100755 makeparser.bat delete mode 100644 makerpm delete mode 100644 msql.mak delete mode 100644 msql1.mak delete mode 100755 mtparser.bat delete mode 100644 mysql.mak delete mode 100644 patch-aa delete mode 100644 patch-ab delete mode 100644 php.ini-dist delete mode 100644 php3_realpath.c delete mode 100644 php3_sprintf.c delete mode 100644 php4.dsp delete mode 100644 php4.dsw delete mode 100644 php4.gif delete mode 100644 php4.spec.in delete mode 100644 php4dll.dsp delete mode 100644 php4dllts.dsp delete mode 100644 php4ext.dsw delete mode 100644 php4ts.dsp delete mode 100644 php4ts.dsw delete mode 100644 php_custom_build.mak delete mode 100644 php_getopt.h delete mode 100644 regex/COPYRIGHT delete mode 100644 regex/Makefile.am delete mode 100644 regex/README delete mode 100644 regex/WHATSNEW delete mode 100644 regex/cclass.h delete mode 100644 regex/cname.h delete mode 100644 regex/debug.c delete mode 100644 regex/debug.ih delete mode 100644 regex/engine.c delete mode 100644 regex/engine.ih delete mode 100644 regex/main.c delete mode 100644 regex/main.ih delete mode 100644 regex/mkh delete mode 100644 regex/regcomp.c delete mode 100644 regex/regcomp.ih delete mode 100644 regex/regerror.c delete mode 100644 regex/regerror.ih delete mode 100644 regex/regex.3 delete mode 100644 regex/regex.7 delete mode 100644 regex/regex.dsp delete mode 100644 regex/regex.dsw delete mode 100644 regex/regex.h delete mode 100644 regex/regex.mak delete mode 100644 regex/regex2.h delete mode 100644 regex/regex_extra.h delete mode 100644 regex/regexec.c delete mode 100644 regex/regfree.c delete mode 100644 regex/split.c delete mode 100644 regex/tests delete mode 100644 regex/utils.h delete mode 100644 request_info.c delete mode 100644 request_info.h delete mode 100644 sapi/Makefile.am delete mode 100644 sapi/README delete mode 100644 sapi/aolserver/Makefile.am delete mode 100644 sapi/aolserver/aolserver.c delete mode 100644 sapi/aolserver/config.h.stub delete mode 100644 sapi/aolserver/config.m4 delete mode 100644 sapi/aolserver/php.sym delete mode 100644 sapi/apache/Makefile.am delete mode 100644 sapi/apache/apMakefile.libdir delete mode 100644 sapi/apache/apMakefile.tmpl delete mode 100644 sapi/apache/config.h.stub delete mode 100644 sapi/apache/config.m4 delete mode 100644 sapi/apache/libphp4.module.in delete mode 100644 sapi/apache/mod_php4.c delete mode 100644 sapi/apache/mod_php4.exp delete mode 100644 sapi/apache/mod_php4.h delete mode 100644 sapi/apache/php.sym delete mode 100644 sapi/apache/sapi_apache.c delete mode 100644 sapi/cgi/Makefile.am delete mode 100644 sapi/cgi/cgi_main.c delete mode 100644 sapi/cgi/config.h.in delete mode 100644 sapi/cgi/config.m4 delete mode 100644 sapi/cgi/php.sym delete mode 100644 sapi/isapi/Makefile.am delete mode 100644 sapi/isapi/config.m4 delete mode 100644 sapi/isapi/php.sym delete mode 100644 sapi/isapi/php4isapi.c delete mode 100644 sapi/isapi/php4isapi.def delete mode 100644 sapi/isapi/php4isapi.dsp delete mode 100644 sapi/roxen/Makefile.am delete mode 100644 sapi/roxen/README delete mode 100644 sapi/roxen/config.h.stub delete mode 100644 sapi/roxen/config.m4 delete mode 100644 sapi/roxen/phpmod.pike delete mode 100644 sapi/roxen/roxen.c delete mode 100644 sapi/servlet/Makefile.am delete mode 100644 sapi/servlet/README delete mode 100644 sapi/servlet/config.h.stub delete mode 100644 sapi/servlet/config.m4 delete mode 100644 sapi/servlet/servlet.c delete mode 100644 sapi/servlet/servlet.dsp delete mode 100644 sapi/servlet/servlet.java delete mode 100644 sapi/servlet/web.xml delete mode 100755 scripts/apache/apconf-conv.sh delete mode 100755 scripts/apache/aphtaccess-conv.sh delete mode 100644 scripts/apache/conffix.awk delete mode 100644 scripts/apache/htaccessfix.awk delete mode 100755 scripts/armerge delete mode 100755 scripts/config-stubs delete mode 100755 scripts/conv_proto delete mode 100755 scripts/mkextlib.in delete mode 100755 scripts/preconfig delete mode 100644 snmp.mak delete mode 100644 stamp-h.in delete mode 100644 strtok_r.c delete mode 100644 stub.c delete mode 100644 tests/foo delete mode 100644 tests/foo2 delete mode 100644 tests/foo3 delete mode 100644 tests/foo4 delete mode 100644 tests/recurse delete mode 100644 tests/test.php4 delete mode 100644 tests/test.pl delete mode 100644 tests/test_class_inheritance delete mode 100644 tests/testarray delete mode 100644 tests/testarray.pl delete mode 100644 tests/testarray2 delete mode 100644 tests/testarray2.pl delete mode 100644 tests/testclassfunc delete mode 100644 tests/testcom delete mode 100644 tests/testcpdf delete mode 100644 tests/testfe delete mode 100644 tests/testfunc delete mode 100644 tests/testfunc.pl delete mode 100644 tests/testfunc2 delete mode 100644 tests/testfunc2.pl delete mode 100644 tests/testfuncref delete mode 100644 tests/testhyperwave delete mode 100644 tests/testinclude delete mode 100644 tests/testobj delete mode 100644 win32/flock.c delete mode 100644 win32/flock.h delete mode 100644 win32/grp.h delete mode 100644 win32/param.h delete mode 100644 win32/php_modules.dsw delete mode 100644 win32/php_registry.h delete mode 100644 win32/pwd.c delete mode 100644 win32/pwd.h delete mode 100644 win32/readdir.c delete mode 100644 win32/readdir.h delete mode 100644 win32/registry.c delete mode 100644 win32/sendmail.c delete mode 100644 win32/sendmail.h delete mode 100644 win32/signal.h delete mode 100644 win32/syslog.h delete mode 100644 win32/time.c delete mode 100644 win32/time.h delete mode 100644 win32/unistd.h delete mode 100644 win32/wfile.c delete mode 100644 win32/wfile.h delete mode 100644 win32/winutil.c delete mode 100644 win32/winutil.h delete mode 100644 win32/wsyslog.c delete mode 100644 zlib.mak diff --git a/CODING_STANDARDS b/CODING_STANDARDS deleted file mode 100644 index 477cad33c9..0000000000 --- a/CODING_STANDARDS +++ /dev/null @@ -1,149 +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. -This is an initial version - it'll most probably grow as time passes. - - -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. _php3_addslashes()) - -[5] Use php3_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 functions implementation should be prefixed with - "php3_", and followed by a word or an underscore-delimited list of words, - in lowercase letters, that describes the function. - -[2] Function names used by user functions implementations should be prefixed - with "_php3_", 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'. - -[3] 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++) ...). - -[4] 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 she's 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. - -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 */ -void php3_abs(INTERNAL_FUNCTION_PARAMETERS) { - ... -} -/* }}} */ - -The {{{ symbols are the default folding symbols for the folding mode in -Emacs. vim will soon have support for folding as well. 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]]]) - -And yes, please keep everything on a single line, even if that line is massive. - - diff --git a/CREDITS b/CREDITS deleted file mode 100644 index dbb3f0bcea..0000000000 --- a/CREDITS +++ /dev/null @@ -1,3 +0,0 @@ -For the list of people who've put work into PHP 4.0, please see -http://www.php.net/version4/credits.php - diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 8b8d1e3ddf..0000000000 --- a/ChangeLog +++ /dev/null @@ -1,11008 +0,0 @@ -1999-12-11 Andrei Zmievski - - * ext/standard/array.c - ext/standard/php_array.h: - Added array globals in preparation for multisort() changes. - - * TODO - ext/standard/string.c: - (PHP php_implode) Made binary-safe. - - * ext/standard/file.c - ext/standard/php_string.h: - get_meta_tags() was using php_stristr() so it needed to be changed. - Optimized it to use php_memnstr() directly. - - * ext/standard/string.c - TODO: - Made strstr(), stristr(), and ucwords() binary-safe(). Also corrected - stristr() behavior to match that of strstr() if needle is not a string. - -1999-12-11 Sascha Schumann - - * sapi/apache/config.m4 - configure.in: - Moving APXS-specific checks into respective config.m4. The placement of - `%APXS -q..` caused error messages, if APXS was not used. - -1999-12-11 Andreas Karajannis - - * ext/odbc/php_odbc.h - ext/odbc/php_odbc.c: Don't include functions not supported by Solid - -1999-12-10 Andrei Zmievski - - * pear/DB/mysql.php: Copy & paste correction. - - * pear/DB/mysql.php: (DB_mysql::fetchInto) new method. - - * ext/xml/xml.c: Fixed #2952. - -1999-12-10 Stig Bakken - - * makerpm: Added makerpm by Samuel Liddicott - -1999-12-10 Sascha Schumann - - * sapi/aolserver/aolserver.c: Output information about HTTP headers - - * SAPI.c - SAPI.h: Export sapi_free_header() - -1999-12-10 Stig Bakken - - * NEWS: remove uninteresting NEWS entries - -1999-12-10 Andrei Zmievski - - * ext/standard/string.c: A few more fixes for php_strtolower(). - -1999-12-09 Andrei Zmievski - - * ext/standard/php_string.h - ext/standard/string.c - ext/xml/xml.c - ext/ldap/ldap.c - TODO: - (PHP strtoupper, strtolower, substr_replace) Made binary-safe. - -1999-12-09 Sascha Schumann - - * ext/session/session.c (php_set_session_var): logic fix: - - gpc_globals set? Add it to the global symbol table - track_vars set? Add it to the HTTP_STATE_VARS array - -1999-12-09 Zeev Suraski - - * sapi/apache/sapi_apache.c: -1999-12-09 Thies C. Arntzen - - * TODO: - just went thru string.c and wrote down the functions that are obviously NOT binary-safe - - * ext/standard/var.c: (unserialize) closed mem-leak - - * ext/oracle/oracle.c - ext/oracle/php_oracle.h - ext/oci8/oci8.c - ext/oci8/php_oci8.h: small cleanups in MINIT code - OCIInitialize is now called at the "right" spot again - -1999-12-09 Nick Gorham - - * ext/odbc/php_odbc.c - NEWS: - Report all ODBC error's not just the top of the stack - -1999-12-09 Uwe Steinmann - - * ext/pdf/config.m4 - ext/domxml/config.m4 - ext/cpdf/config.m4: - - improved configuration due to compile problems which suddently show up - -1999-12-08 Zeev Suraski - - * ext/session/session.c - configuration-parser.y: - - Use Set-Cookie for consistency with SetCookie() (and possibly for adherence with - with some clients?) - - Remove unnecessary directive from configuration-parser.y - -1999-12-08 Sascha Schumann - - * ext/standard/assert.c: Use global ctor in non-ZTS mode as well - -1999-12-08 Thies C. Arntzen - - * ext/standard/var.c: (unserialize) now cleans up better on failure! - - * ext/standard/assert.c: make non-ZTS happy again - - * ext/oci8/oci8.c: -1999-12-08 Stig Bakken - - * pear/DB/common.php - pear/DB/mysql.php - pear/DB.php: Added some more error defines (CANNOT_CREATE/DELETE/DROP). - Folded up the methods in DB.php. - Started adding documentation for DB_result methods. - Added doOne() doRow() and doAssoc() methods in DB_common. - Added numCols() to DB_mysql. - -1999-12-08 Thies C. Arntzen - - * ext/ftp/php_ftp.c - ext/readline/php_readline.h - ext/readline/readline.c: ZTS compile fixes - - * ext/standard/assert.c: this is the "right" ZTS-fix - -1999-12-07 Andrei Zmievski - - * pear/DB.php: Oops. - - * pear/DB.php: - (DB::parseDSN) check for an extra / at the end purely to guard against - user error - - * pear/DB/mysql.php: MySQL is capable of pconnect, I think. - - * pear/DB.php: - (DB::parseDSN) Remove extraneous / at the end of the spec if no database - is specified. - -1999-12-07 Sam Ruby - - * ext/standard/assert.c: - Fill in empty constructor in order to appease Sascha ;-) - More seriously, uninitialized values cause MSHUTDOWN to trap. - Only an issue because assert was added to internal_functions. - - * SAPI.c - internal_functions.c.in - internal_functions_win32.c - main.c - main.h - php.h: - Provide basis for shared libraries/dlls to contain internal extensions - -1999-12-07 Andrei Zmievski - - * TODO: Apparently already implemented by Thies. - - * configure.in: Revert the patch. - -1999-12-07 Rasmus Lerdorf - - * configure.in: Add check for broken apxs script - -1999-12-07 Thies C. Arntzen - - * ext/standard/assert.c - php.ini-dist: - added assert.quiet_eval plus a bit of cleaning (docs to follow!) - -1999-12-07 Sam Ruby - - * ext/standard/assert.c - php4dllts.dsp: - fixed just enough to enable assert to build on win32 and Linux/ZTS - -1999-12-07 Andrei Zmievski - - * ext/pcre/php_pcre.c - configure.in: Need to check for __inet_aton on Solaris. - -1999-12-07 Sascha Schumann - - * configure.in: Move it to the right place - -1999-12-07 Thies C. Arntzen - - * ext/standard/assert.c: fixed NPR - - * ext/readline/config.m4: the order *does* matter! - - * ext/standard/assert.c - php.ini-dist: - * ext/standard/assert.c: getting there - -1999-12-07 Sascha Schumann - - * ext/cybercash/.cvsignore: Ignore generated files - -1999-12-07 Thies C. Arntzen - - * ext/standard/Makefile.am - ext/standard/assert.c - ext/standard/php_assert.h - internal_functions.c.in - internal_functions_win32.c: new assert() module. (Not yet finished!) - -1999-12-07 Uwe Steinmann - - * ext/pdf/config.m4 - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/fdf/config.m4 - ext/domxml/domxml.c: - Several small corrections, typos, ... - -1999-12-07 Thies C. Arntzen - - * ext/standard/string.c: - (explode) fixed newly introduced bug (them shall check twice *before* committing!) - -1999-12-07 Evan Klinger - - * ext/standard/info.c - MAINTAINERS: Mention CyberCash. - -1999-12-07 Sam Ruby - - * ext/standard/parsedate.y: - -kludges -warning +reentrancy(more) +compiles(Unix) - -1999-12-07 Evan Klinger - - * ext/cybercash/cyberlib.php - ext/cybercash/test.php: More clean up. - - * ext/cybercash/config.m4: Now it compiles - couldn't find lib before. - - * ext/cybercash/cybercash.c: Eliminate some warnings. - - * ext/cybercash/cyberlib.php: Minor changes and clean up. - - * ext/cybercash/Makefile.am - ext/cybercash/config.h.stub - ext/cybercash/config.m4 - ext/cybercash/cybercash.c - ext/cybercash/cybercash.h - ext/cybercash/cyberlib.php - ext/cybercash/test.php: CyberCash support. - -1999-12-06 Zeev Suraski - - * ext/standard/parsedate.y: - First step in making parsedate.y thread safe - use a pure parser - -1999-12-06 Thies C. Arntzen - - * ext/standard/string.c: fixed warning - - * ext/standard/string.c: we save one buffer-copy as well (hehe) - - * ext/standard/string.c: -1999-12-06 Andrei Zmievski - - * ext/pcre/php_pcre.c: Add another item. - -1999-12-06 Zeev Suraski - - * ext/standard/parsedate.y: - This is no longer needed. Note that we'll always need to undefine YYSTYPE, since - the template bison generated .h file defines it if it's not already defined. - -1999-12-06 Sascha Schumann - - * sapi/apache/libphp4.module.in - configure.in - acinclude.m4: - Separate libpaths into PHP_LDFLAGS, so that we can address them - separately (required for Apache build). - -1999-12-06 Zeev Suraski - - * fopen-wrappers.c: opened_path could end up uninitialized - fixed - -1999-12-06 Thies C. Arntzen - - * ext/standard/parsedate.y: removed unneded CLS_FETCH() - -1999-12-06 Sam Ruby - - * ext/standard/parsedate.y: build error: wrong num parms to date_parse - - * ext/java/reflect.java: first pass at method overloading - - * sapi/servlet/servlet.c: - Hmmm...must have misplaced the getcwd/chdir logic... - -1999-12-06 Evan Klinger - - * NEWS: *** empty log message *** - -1999-12-05 Sascha Schumann - - * ext/session/session.c: Give it a nicer looking module name - - * ext/informix/ifx.ec: php3_* => php_* - - * ext/informix/Makefile.am - ext/informix/config.m4: Create helper library during configure time - - * acinclude.m4: Allow AC_ADD_LIBRARY to append library - - * acinclude.m4 - configure.in: Add rpaths to LDFLAGS during configure, drop them later. - -1999-12-05 Evan Klinger - - * ext/informix/config.m4: Revert changes. - - * ext/informix/config.m4: Fix --with-informix. Was adding wrong library. - -1999-12-05 Egon Schmid - - * ext/xml/xml.c: - Thies, can you provide some docs? I need something to show to my German translators. - Is the &obj correct? - -1999-12-05 Thies C. Arntzen - - * ext/xml/php_xml.h - ext/xml/xml.c: (XML_Set_Object) new function. - -1999-12-05 Sascha Schumann - - * SAPI.h - mergesort.c - php_content_types.c - php_content_types.h - sapi/cgi/cgi_main.c - ext/standard/dir.c - ext/standard/file.c - ext/standard/fsock.c - ext/standard/lcg.c - ext/standard/reg.c - ext/session/session.c - ext/pgsql/pgsql.c - SAPI.c - ext/pcre/php_pcre.c - main.c - rfc1867.c: Fix some warnings - - * acinclude.m4 - configure.in: Prepend added libraries and separate LDFLAGS handling - -1999-12-05 Rasmus Lerdorf - - * sapi/apache/mod_php4.c - php_content_types.h - ext/xml/php_xml.h - ext/standard/basic_functions.c - ext/standard/lcg.c - ext/standard/output.c - ext/standard/parsedate.y - ext/standard/php_filestat.h - ext/standard/string.c - main.c - main.h: More maintainer-mode cleanups - - * ext/standard/lcg.c - ext/standard/php_lcg.h: Fix a maintainer-mode warning - -1999-12-05 Stig Bakken - - * ext/standard/fsock.h - ext/standard/php_array.h - ext/standard/php_metaphone.h - pear/Makefile.am - ext/pcre/php_pcre.h - ext/session/php_session.h - ext/session/session.c - ext/mysql/php_mysql.c - main.h: Fix warnings compiling in maintainer mode. - Install DB/common.php and DB/mysql.php on "make install". - -1999-12-04 Zeev Suraski - - * php4dllts.dsp: Win32 .dsp update - - * php.h - php3_compat.h - php_compat.h: - That one is actually supposed to have 'php3' on it - it's the PHP 3.0 compatibility defines for 4.0 - -1999-12-04 Stig Bakken - - * ext/standard/config.h.stub - ext/standard/dl.c - ext/standard/dl.h: in libzend). - -1999-12-04 Sascha Schumann - - * configure.in: - Create ``libs'' subdirectory as the current user and add /usr/ucblib - always to the libpath, if it exists (#2752). - -1999-12-04 Sam Ruby - - * configuration-parser.y: Build error - -1999-12-04 Andrei Zmievski - - * ext/session/session.c: - Cast val to (char *) to avoid compile warning. - Forgot ; at the end and need to derefence the ent pointer. - -1999-12-04 Sascha Schumann - - * ext/icap/php3_icap.h - ext/icap/php_icap.h - ext/interbase/php3_interbase.h - ext/interbase/php_interbase.h - ext/gettext/php3_gettext.h - ext/gettext/php_gettext.h - ext/hyperwave/php3_hyperwave.h - ext/hyperwave/php_hyperwave.h - ext/fdf/php3_fdf.h - ext/fdf/php_fdf.h - ext/gd/php3_gd.h - ext/gd/php_gd.h - ext/db/php3_db.h - ext/db/php_db.h - ext/dba/php3_cdb.h - ext/dba/php3_db2.h - ext/dba/php3_db3.h - ext/dba/php3_dba.h - ext/dba/php3_dbm.h - ext/dba/php3_gdbm.h - ext/dba/php3_ndbm.h - ext/dba/php_cdb.h - ext/dba/php_db2.h - ext/dba/php_db3.h - ext/dba/php_dba.h - ext/dba/php_dbm.h - ext/dba/php_gdbm.h - ext/dba/php_ndbm.h - ext/bcmath/php3_bcmath.h - ext/bcmath/php_bcmath.h - ext/dav/php3_dav.h - ext/dav/php_dav.h - ext/aspell/php3_aspell.h - ext/aspell/php_aspell.h - sapi/servlet/servlet.c - sapi/apache/sapi_apache.c - sapi/cgi/cgi_main.c - ext/zlib/php3_zlib.h - ext/zlib/php_zlib.h - ext/zlib/zlib.c - sapi/apache/mod_php4.c - ext/xml/php3_xml.h - ext/xml/php_xml.h - ext/xml/xml.c - ext/yp/php3_yp.h - ext/yp/php_yp.h - ext/yp/yp.c - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/php_sysvshm.h - ext/sysvshm/sysvshm.c - ext/sybase_ct/php_sybase_ct.c - ext/sysvsem/php3_sysvsem.h - ext/sysvsem/php_sysvsem.h - ext/sysvsem/sysvsem.c - ext/standard/syslog.c - ext/standard/var.c - ext/sybase/php3_sybase.h - ext/sybase/php_sybase.h - ext/sybase/sybase.c - ext/standard/reg.c - ext/standard/soundex.c - ext/standard/string.c - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_iptc.h - ext/standard/php3_link.h - ext/standard/php3_mail.h - ext/standard/php3_standard.h - ext/standard/php3_string.h - ext/standard/php3_syslog.h - ext/standard/php3_var.h - ext/standard/php_browscap.h - ext/standard/php_crypt.h - ext/standard/php_dir.h - ext/standard/php_filestat.h - ext/standard/php_iptc.h - ext/standard/php_link.h - ext/standard/php_mail.h - ext/standard/php_standard.h - ext/standard/php_string.h - ext/standard/php_syslog.h - ext/standard/php_var.h - ext/standard/post.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/dir.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/head.c - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/pack.c - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/session/session.c - ext/snmp/php3_snmp.h - ext/snmp/php_snmp.h - ext/snmp/snmp.c - ext/posix/php3_posix.h - ext/posix/php_posix.h - ext/posix/posix.c - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/pdf/php_pdf.h - ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pgsql/php_pgsql.h - ext/pcre/php_pcre.c - ext/oracle/oracle.c - ext/oracle/php3_oracle.h - ext/oracle/php_oracle.h - ext/odbc/config.m4 - ext/odbc/php3_velocis.h - ext/odbc/php_odbc.c - ext/odbc/php_velocis.h - ext/odbc/velocis.c - ext/mysql/php_mysql.c - ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ext/oci8/php_oci8.h - ext/msql/php_msql.c - ext/mssql/php_mssql.c - ext/mcal/php3_mcal.c - ext/mcal/php3_mcal.h - ext/mcal/php_mcal.h - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/ldap/php_ldap.h - ext/interbase/interbase.c - ext/icap/php3_icap.c - ext/gettext/gettext.c - ext/hyperwave/hw.c - ext/gd/gd.c - ext/domxml/domxml.c - ext/domxml/php3_domxml.h - ext/domxml/php_domxml.h - ext/fdf/fdf.c - ext/db/db.c - ext/dba/dba.c - ext/dba/dba_cdb.c - ext/dba/dba_db2.c - ext/dba/dba_db3.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c - ext/dav/dav.c - ext/cpdf/cpdf.c - ext/cpdf/php3_cpdf.h - ext/cpdf/php_cpdf.h - ext/aspell/aspell.c - ext/bcmath/bcmath.c - dl/mssql/mssql.c - dl/mssql/php3_mssql.h - dl/mssql/php_mssql.h - dl/snmp/php3_snmp.h - dl/snmp/php_snmp.h - dl/snmp/snmp.c - dl/snmp/winsnmp.c - fopen-wrappers.c - internal_functions_win32.c - main.c - php.h - php3_compat.h - php3_realpath.h - php_compat.h - php_realpath.h - rfc1867.c: - Clean up php3.*\.h files. The files itself are renamed, and references in all - .*\.[ch] files were changed. There is a slight chance that my script missed - a few changes, please correct them manually. - -1999-12-04 Andrei Zmievski - - * ext/session/session.c: - (php_set_session_var) Initialize the refcount here. - -1999-12-04 Sascha Schumann - - * ext/session/session.c: ZTS fixes - - * ext/pgsql/config.m4: Remove custom LDFLAGS/LIBS changes - - * configure.in: - Don't overwrite EXTRA_LIBS, some ext config.m4s access it directly - - * main.c - sapi/servlet/servlet.c - sapi/cgi/cgi_main.c: Remove code references to serverapi - - * acinclude.m4 - configure.in: - Use LIBS instead of EXTRA_LIBS, so that inter-library dependences can - be tested for using standard autoconf macros. - -1999-12-04 Thies C. Arntzen - - * TODO: some more ideas - -1999-12-04 Andrei Zmievski - - * ext/session/session.c: - (PHP session_register) Correct calling convention. - - * ext/session/php_session.h - ext/session/session.c - main.c: - Session variables now obey track_vars and gpc_globals settings. - If track_vars is on then decoded variables appear in $HTTP_STATE_VARS - array. If gpc_globals is on, then session vars are decoded into global - variables. If both are on, then globals and $HTTP_STATE_VARS contents - are references to each other. - - The /decoder functions now just need to call php_set_session_var() - this behavior. - - - -1999-12-04 Stig Bakken - - * ext/mysql/php_mysql.c - ext/xml/xml.c - ext/gd/gd.c - acinclude.m4: Fix shared mode for gd/xml/mysql extensions. - -1999-12-04 Zeev Suraski - - * NEWS: - - Added get_used_files() function - returns a hash mapping the use()'d files - to their full path (Zeev) - - * sapi/roxen/roxen.c - sapi/servlet/servlet.c - sapi/isapi/php4isapi.c - sapi/apache/sapi_apache.c - sapi/cgi/cgi_main.c - main.c - sapi/aolserver/aolserver.c: - - zend_file_handles must now flag whether their .filename property should be - free by Zend or not (uses e*() functions) - -1999-12-04 Sascha Schumann - - * ext/standard/config.m4 - configure.in: - Check for htonl in libsocket (sol251), and move inet_aton check in libbind to configure.in, so that our later AC_CHECK_FUNCS(inet_aton) will find inet_aton in libbind (if it is there). - -1999-12-04 Thies C. Arntzen - - * ext/oci8/oci8.c: fixed tiny leak - -1999-12-03 Sascha Schumann - - * acconfig.h.in - configure.in: Fix for #2909 - -1999-12-03 Sam Ruby - - * ext/standard/fsock.h - ext/standard/info.c: windows build errors - -1999-12-03 Sascha Schumann - - * configure.in: inet_aton is in libresolv on Solaris 2.5.1 - -1999-12-03 David Hedbor - - * ext/standard/info.c: Added credit notes for Roxen SAPI module - -1999-12-03 Andrei Zmievski - - * ext/session/mod_files.c: Include errno.h. - -1999-12-03 Sascha Schumann - - * ext/session/mod_files.c: Improve locking when O_EXCL is available - - * ext/java/config.m4: - PHP_BUILD_* m4 macros are not intended to be used by extensions. - If you want to tell the user that the current choice of a specific SAPI - module is bad, check $php_build_target. - - * main.c: 2<<30 (== 1<<31) overflows 32-bit signed int, reverting to 1<<30 - - * configure.in: - Solaris needs -D_REENTRANT to define prototypes for localtime_r etc. - - * ext/standard/fsock.h - ext/standard/fsock.c: Use socklen_t where appropiate - - * configure.in: - Add check for socklen_t (we cannot use AC_CHECK_TYPE, because socklen_t - is defined in sys/socket.h). - -1999-12-03 Stig Bakken - - * NEWS: forgot the "@" - - * ext/standard/info.c - build-defs.h.in - configure.in: Add configure command to phpinfo() output (Stig) - -1999-12-03 Sascha Schumann - - * ext/posix/config.h.stub - ext/posix/config.m4 - ext/posix/php3_posix.h: Add configure stuff - (note that --with-xxx should be only used, if it references something - external.) - - * ext/posix/Makefile.am - ext/posix/config.h.stub - ext/posix/config.m4 - ext/posix/php3_posix.h - ext/posix/posix.c - ext/posix/.cvsignore: Add posix module - - * sapi/isapi/php4isapi.c - main.c: - Add X-Powered-By header in all configurations to ease PHP usage metering - - * sapi/aolserver/aolserver.c (php_ns_sapi_header_handler): use sapi_free_header() - -1999-12-03 Rasmus Lerdorf - - * NEWS: - * php_globals.h - main.c: -1999-12-03 Sam Ruby - - * ext/com/COM.c: Support DATE_to_pval and DISPATCH_to_pval - -1999-12-02 Rasmus Lerdorf - - * main.c: - * ext/mysql/php_mysql.c: Add optional socket path to mysql_?connect() functions - -1999-12-02 Sascha Schumann - - * buildconf: Let user override default setting of ``make'' - -1999-12-01 Sascha Schumann - - * acinclude.m4: - Define COMPILE_DL_MODNAME, if module is built as dynamic module - -1999-12-01 Stig Bakken - - * ext/mysql/php_mysql.c - ext/gd/gd.c: Back out PIC/COMPILE_DL hack from gd/mysql. - - * ext/standard/php_output.h - pear/README - ext/gd/gd.c - ext/gd/gdttf.c - ext/gd/php3_gd.h - ext/mysql/php_mysql.c - ext/mysql/php_mysql.h - dl/phpdl.h - SAPI.h - configure.in - php_ini.h: - Fixed some warnings in maintainer-mode. - - Made mysql and gd work as shared extensions again by defining - COMPILE_DL if PIC is defined. - -1999-12-01 Zeev Suraski - - * ext/standard/post.c: Test commit, ignore - - * ext/standard/post.c: - * ext/standard/post.c: -1999-12-01 Stig Bakken - - * pear/DB.php: remove some debug output - -1999-12-01 Sascha Schumann - - * ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/fsock.c - ext/standard/string.c: Make array.c thread-safe - - * php_globals.h: Remove fsock-specific members - - * ext/standard/fsock.c - ext/standard/fsock.h - main.c: Make fsock module thread-safe - -1999-12-01 Sam Ruby - - * sapi/servlet/config.m4: use new PHP_BUILD_THREAD_SAFE macro - - * ext/standard/parsedate.y: - libzend/zend_compile.h's #define YYSTYPE causes parsedate to barf on Windows - -1999-12-01 Thies C. Arntzen - - * ext/oci8/oci8.c: just a remark - -1999-12-01 Rasmus Lerdorf - - * ltconfig - ltmain.sh: -1999-11-30 Sascha Schumann - - * php_regex.h: Avoid Apache's regex.h, if system regex was chosen - -1999-11-30 Rasmus Lerdorf - - * ext/imap/imap.h - ext/imap/imap.c: - * ext/imap/imap.c: Kill some warnings - -1999-11-30 Sascha Schumann - - * configure.in: Add '--enable-low-memory' option. - - * php_reentrancy.h - reentrancy.c: Add PHPAPI for Windows. - -1999-11-30 Andi Gutmans - - * ext/standard/file.c - ext/standard/basic_functions.c - ext/gd/gd.c - fopen-wrappers.c - fopen-wrappers.h - main.c - php4dllts.dsp: - - Added opened_path to php_fopen_wrapper() and the URL fopen wrapper (it's not - always properly set, it's a TODO for all of us). This enables us to implement - true 'use' support. - -1999-11-30 Nick Gorham - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - NEWS - ltconfig - ltmain.sh - php.ini-dist: - Added check in the ODBC module that a connection is still valid before - reuse in a persistent connection. - -1999-11-30 Thies C. Arntzen - - * sapi/isapi/php.sym: - the Zeus-Guys were nice enoug to give us a call similar to DllMain()! - -1999-11-30 Shane Caraveo - - * win32/time.h: need to prevent multiple usage - -1999-11-29 Sander Steffann - - * ext/gd/gd.c: Show some extra info for GD with phpinfo() - -1999-11-29 Sascha Schumann - - * ext/session/session.c: Clean up code - -1999-11-29 Thies C. Arntzen - - * sapi/isapi/config.m4: ISAPI wants to run in ZTS - -1999-11-29 Sander Steffann - - * ext/gd/config.m4: Oops, forgot to check for GIF support. Fixed. - -1999-11-29 Danny Heijl - - * ext/informix/ifx.ec: Typo - -1999-11-29 Andrei Zmievski - - * pear/DB.php: Modified to use preg_* functions. - -1999-11-29 Sam Ruby - - * sapi/servlet/.cvsignore: add .cvsignore - - * sapi/servlet/Makefile.am - sapi/servlet/README - sapi/servlet/config.h.stub - sapi/servlet/config.m4 - sapi/servlet/servlet.c - sapi/servlet/servlet.dsp - sapi/servlet/servlet.java - sapi/servlet/web.xml - ext/standard/info.c - ext/java/java.dsp - ext/java/reflect.java - ext/java/Makefile.am - ext/java/config.m4 - ext/java/java.c: - Initial alpha-level of sapi/servlet. See README for details. - -1999-11-29 Stig Bakken - - * pear/Makefile.am - pear/README: more PECL -> PEAR renaming - - * pear/DB/common.php - pear/DB/mysql.php - pear/DB/odbc.php - pear/.cvsignore - pear/DB.php: - DB classes now inherit DB_common - - Added DB_ERROR_NODBSELECTED - - Added DB::connect($dsn[, $persistent] which creates a DB object and connects - $dsn is a "data source name" in a format specific to DB: - phptype(dbsyntax)://username:password@protocol+hostspec/database - Don't worry, such a dsn can be as short as "mysql" - - Added mysql support - -1999-11-29 Andrei Zmievski - - * NEWS: Name update. - -1999-11-29 Sam Ruby - - * ext/standard/parsedate.y: - Use thread-safe versions of localtime and gmtime on Win32 too - -1999-11-29 Stig Bakken - - * buildcheck.sh - buildconf: - Remove some more redundant checks. buildconf is not but a simple wrapper - for build.mk & co. - -1999-11-29 Sascha Schumann - - * sapi/aolserver/aolserver.c: - Revert last patch (leak in libzend is fixed now) - -1999-11-29 Stig Bakken - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/setup.stub: Added DBMaker support (patch by Pax Tsai ) - -1999-11-28 Stig Bakken - - * Makefile.am - build.mk - configure.in: Renamed "PECL" to "PEAR" (PHP Extension and Add-on Repository). - New name courtesy of Peter Bowen . - - * build.mk - buildconf: Removed redundancy in buildconf/build.mk, buildconf now runs "make -f build.mk" - -1999-11-28 Andi Gutmans - - * ext/standard/output.c: - - Add OLS_C so that we can call php_output_init_globals() with it. - -1999-11-28 Sascha Schumann - - * ext/informix/ifx.ec: Prevent mod_ssl's ap_hook.h from being included. - -1999-11-28 Rasmus Lerdorf - - * ext/standard/link.c: - * ext/standard/link.c: (symlink) Disable symlinks to urls - -1999-11-28 Sascha Schumann - - * .cvsignore: Add buildmk.stamp - - * build.mk - buildcheck.sh: Add version checks from buildconf - -1999-11-28 Danny Heijl - - * ext/informix/ifx.ec: - (ext/informix/ifx.ec) Reflect ESQL/C version used (Danny) - -1999-11-28 Sascha Schumann - - * ext/ext_skel: Remove INCLUDES line from Makefile.am skeleton - - * ext/standard/basic_functions.h - ext/standard/php3_string.h - ext/standard/string.c - ext/standard/basic_functions.c: Make basic/string functions thread-safe - - * ext/session/session.c: ZTS fix - -1999-11-27 Sascha Schumann - - * ext/informix/Makefile.am - ext/informix/config.m4: - Improved build (now sets also runtime library search paths, works - out-of-the-box with Apache) - -1999-11-27 Andrei Zmievski - - * ext/domxml/.cvsignore: Don't cry, CVS. - - * ext/session/session.c: - (PHP session_register) Modified to accept variable number of arguments, - any of which can be either string holding the variable name or an array - consisting of such variable names or other arrays. - -1999-11-27 Sascha Schumann - - * ext/standard/parsedate.y: one tmbuf is enough - -1999-11-27 Zeev Suraski - - * php4.dsp - php4dll.dsp: - Win32 thread unsafe build updates - -1999-11-27 Andrew Skalski - - * ext/ftp/ftp.c: typecast void pointer to char* for pointer arithmetic - -1999-11-27 Jouni Ahto - - * ext/standard/parsedate.y - ext/dbase/dbf_misc.c: - Use thread-safe versions of localtime and gmtime - -1999-11-27 Zeev Suraski - - * php4dllts.dsp - php_reentrancy.h: Update Win32 build - -1999-11-27 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: - Only compile the scanner, if trans_sid is enabled - - * configure.in: Test for PHP_THREAD_SAFETY - - * configure.in: PERL_PATH is used nowhere - - * acinclude.m4 - configure.in: Add --enable-experimental-zts - -1999-11-27 Zeev Suraski - - * php.h - php4dllts.dsp - strlcat.c - strlcpy.c - strtok_r.c: Get Win32 to compile again - -1999-11-26 Sascha Schumann - - * ext/standard/basic_functions.c: Kill undefined reference - - * configure.in: - Enable _POSIX_THREAD_SEMANTICS for all configurations testwise - - * ext/standard/basic_functions.c: Undefine HAVE_PUTENV, if ZTS is used - - * ext/standard/basic_functions.c: Kill one race. - - * reentrancy.c: unposixfy calls to TSRM - - * reentrancy.c: - Define macros only, if one of the locking _r functions is used - - * sapi/aolserver/aolserver.c: - Avoid fd leak which appears when using ZEND_HANDLE_FILENAME - - * ext/standard/output.c: - Use php_init_output_globals() also in non-ZTS mode - - * reentrancy.c: Fix typo (shutdown -> startup) - - * Makefile.am - configure.in - php_reentrancy.h - reentrancy.c - strtok_r.c: - move strtok_r into reentrancy.c - - add rand_r() - - * ext/mhash/mhash.c - php_reentrancy.h - reentrancy.c: Add/update copyright headers - - * php_globals.h: Back out last commit. - - * Makefile.am - configure.in - php.h - php_globals.h - php_reentrancy.h - reentrancy.c - sapi/aolserver/aolserver.c: - Add reentrant versions of ctime, localtime, gmtime, asctime. - - These cannot be implemented platform-independent, so we fall back to the native - non-reentrant versions, but lock during each access (only if ZTS is used). - - To initialize/destroy the used data structures, you need to call - reentrancy_startup() before sapi_startup(), and reentrancy_shutdown() after - sapi_shutdown(). - - * win32/registry.c - sapi/isapi/php4isapi.c - ext/ftp/ftp.c - ext/hyperwave/hw.c - ext/filepro/filepro.c - ext/com/COM.c: Convert more source files to use thread-safe functions - - * main.c: Use thread-safe versions of asctime and localtime - - * ext/standard/datetime.c: - Use thread-safe versions of localtime and gmtime - -1999-11-26 Zeev Suraski - - * config.guess - config.sub - ltconfig - ltmain.sh: Undo previous bogus commit - - * ext/standard/dl.c - config.guess - config.sub - ltconfig - ltmain.sh: *** empty log message *** - -1999-11-26 Sascha Schumann - - * ext/session/session.c: - (PHP_RINIT(session)) Never return FAILURE on trivial issues from a request - startup handler - - * ext/standard/post.c: Replace strtok with strtok_r - - * configure.in - strtok_r.c: Add strtok_r replacement function from FreeBSD-current. - - * strlcat.c - strlcpy.c: - Include php_config.h in both files, otherwise HAVE_STRLCAT/HAVE_STRLCPY - will never be defined, even on systems which have these functions. - -1999-11-25 Zeev Suraski - - * main.c: *** empty log message *** - -1999-11-25 Uwe Steinmann - - * ext/cpdf/cpdf.c: - - changed encoding parameter of cpdf_set_font to string on advice from - fastio to better support asian fonts. - - * ext/domxml/Makefile.am - ext/domxml/config.m4 - ext/domxml/php3_domxml.h: - made domxml compile - -1999-11-25 David Hedbor - - * sapi/roxen/phpmod.pike: Now the new direct write is enabled too... - - * sapi/roxen/README - sapi/roxen/phpmod.pike - sapi/roxen/roxen.c: - Implemented direct writing to the client's FD if RXML parsing of the result isn't selected. - - * sapi/roxen/config.h.stub - sapi/roxen/config.m4 - sapi/roxen/phpmod.pike - sapi/roxen/roxen.c: - Now ZTS can be used. Unless --enable-roxen-zts is specified at the - configure line the default process global Roxen PHP lock will be - used. In tests this was a lot faster for some reason and until the - reasons are figured out, it's recommended to use the non-thead-safe - version. - Cvs: ---------------------------------------------------------------------- - -1999-11-24 Egon Schmid - - * ext/gd/gd.c: - I'm dreaming that someone else can format this when he/she is looking at it. - -1999-11-24 Sander Steffann - - * ext/gd/config.h.stub - ext/gd/config.m4 - ext/gd/gd.c: - Some patched versions of GD support both GIF and PNG. The GD module now - checks for both instead of assuming that PNG support means that there is no - GIF support anymore. - - * ext/gd/config.m4: - Removed an empty -L from LDFLAGS which caused errors in configure when - running it with --with-gd (without path). Because of this configure detected - every GD as GD-1.2. - -1999-11-24 Sascha Schumann - - * ext/standard/exec.c - ext/standard/file.c - ext/standard/info.c - main.c - request_info.c: Killing some unused variable warnings - - * sapi/aolserver/aolserver.c: some cosmetical changes - -1999-11-24 Egon Schmid - - * ext/domxml/domxml.c: - Descriptions should be different for different function names. - -1999-11-24 Thies C. Arntzen - - * acinclude.m4: fix typo - -1999-11-24 David Hedbor - - * sapi/roxen/roxen.c: Removed some forgotten C++ style comments - - * sapi/roxen/config.m4: Now actually correctly checks for Pike paths etc. - -1999-11-24 Uwe Steinmann - - * ext/domxml/Makefile.am - ext/domxml/config.h.stub - ext/domxml/config.m4 - ext/domxml/domxml.c - ext/domxml/php3_domxml.h: - new xml parser with dom support - -1999-11-24 Evan Klinger - - * ext/standard/file.c: Freeing the memory would be a good idea... - - * NEWS: Mention new select(), fd_set() and fd_isset() functions - -1999-11-24 Andrei Zmievski - - * NEWS: Cleaning up remnants of ChangeLog manipulations. - -1999-11-24 Evan Klinger - - * ext/standard/file.c - ext/standard/file.h: Can't forget fd_isset() - -1999-11-24 Sascha Schumann - - * sapi/aolserver/config.h.stub - sapi/aolserver/config.m4 - acconfig.h.in - acinclude.m4: - add PHP_BUILD_THREAD_SAFE - - move #undef HAVE_AOLSERVER into its own config.h.stub - -1999-11-24 Evan Klinger - - * ext/standard/file.c - ext/standard/file.h: First attempt at fd_set() and select() - -1999-11-24 David Hedbor - - * sapi/roxen/roxen.c: - - Added a couple of static for functions that don't need to be public. - - Removed some unused code. - - Started writing better comments. - - * sapi/roxen/phpmod.pike: - Don't create a new thread for each php-script - use the handler thread. - - * acconfig.h.in - sapi/roxen/config.h.stub: Moved HAVE_ROXEN to sapi/roxen/config.h.stub - - * sapi/roxen/.cvsignore: Added .cvsignore - - * sapi/roxen/Makefile - sapi/roxen/Makefile.am: Added the wrong file. - -1999-11-23 David Hedbor - - * acconfig.h.in: Added HAVE_ROXEN for the Roxen sapi module - - * sapi/roxen/Makefile - sapi/roxen/README - sapi/roxen/config.m4 - sapi/roxen/phpmod.pike - sapi/roxen/roxen.c: - First version of Pike/Roxen module for embedding PHP. - -1999-11-23 Andrei Zmievski - - * TODO: Re-arranging a bit. - -1999-11-23 Zeev Suraski - - * ext/standard/output.c: Use the unified notation... - - * ext/standard/basic_functions.c: Cosmetic changes - -1999-11-23 Sascha Schumann - - * TODO: add some points - -1999-11-23 Andrei Zmievski - - * sapi/cgi/cgi_main.c: - (main) In this special case, free path_translated. Fix for #2795. - -1999-11-23 Sascha Schumann - - * acinclude.m4 - configure.in: - Only create regex/Makefile, if we use the bundled regex library - - * sapi/cgi/cgi_main.c: - (main) Remove redundant statement, this is part of the initialization - function. - -1999-11-23 Sascha Schumann - - * pecl/Makefile.am: - Don't bail out, if PECL cannot be installed. PHP is often only an - intermediate step of the installation, so it is often not performed - by root. - -1999-11-23 Thies C. Arntzen - - * sapi/isapi/Makefile.am - sapi/isapi/config.m4 - sapi/isapi/php.sym: - Getting Zeus-Support in place - i can already see phpinfo()! - -1999-11-23 Uwe Steinmann - - * NEWS: - inform everybody about cpdf support - - * tests/testcpdf: - extended test script for cpdf by GD image insertion - -1999-11-23 Evan Klinger - - * ext/apache/apache.c - ext/aspell/aspell.c - ext/standard/formatted_print.c: Convert to Ex API - -1999-11-23 Sam Ruby - - * ext/standard/output.c - main.c: errors during startup trap server - -1999-11-23 Andrei Zmievski - - * NEWS: Formatting. - - * ext/cpdf/.cvsignore: Add .cvsignore. - -1999-11-23 changelog - - * NEWS: NEWS update - -1999-11-22 Zeev Suraski - - * ext/standard/output.c - main.c: Fixed a leak when using automatic output buffering - -1999-11-22 Andrei Zmievski - - * buildconf: Don't forget the pickle. - - * MODULES_STATUS: Reformatting. - -1999-11-22 Frank M. Kromann - - * MODULES_STATUS: add MS SQL module seams to be working - - * ext/standard/info.c: add MS SQL module to credit info - - * ext/mssql/mssql.dsp: - Project changed to allow compilation for MS SQL 6.5 or 7.0 - -1999-11-22 Uwe Steinmann - - * tests/testhyperwave: - test for hyperwave module - - * tests/testcpdf: - test for cpdf module - - * ext/cpdf/Makefile.am - ext/cpdf/config.h.stub - ext/cpdf/config.m4 - ext/cpdf/cpdf.c - ext/cpdf/php3_cpdf.h: - port of clibpdf module based on ClibPDF 2.x. - This module is not tested yet, it just compiles. - I don't expect any real problem since the api hasn't changed. - ClibPDF 1.x isn't support anymore. - -1999-11-22 Stig Bakken - - * pecl/DB/odbc.php - pecl/.cvsignore - pecl/DB.php - pecl/Makefile.am - pecl/README - Makefile.am - build.mk - configure.in: Introduced PECL - PHP Extension and Code Library (prounounced "picke"), in - the "pecl" subdir. "make install" will now install the database abstraction - layer in PREFIX/lib/php. - I hereby dedicate this part of PHP to my daughter-of-yesterday Malin. :-) - -1999-11-22 Evan Klinger - - * ext/standard/math.c: Optimize a tiny bit - - * ext/ldap/ldap.c: Optimize LDAP a little with Ex API - -1999-11-22 changelog - - * NEWS: NEWS update - -1999-11-22 Sascha Schumann - - * sapi/aolserver/aolserver.c: - (php_ns_hash_environment) Ns_ConnHost() may return NULL, check for it - - * sapi/aolserver/aolserver.c: - (PHP getallheaders) added function for AOLserver - - (php_ns_hash_environment) added REMOTE_PORT, SERVER_PORT, SERVER_NAME, - PATH_TRANSLATED, GATEWAY_INTERFACE variables - -1999-11-21 Sascha Schumann - - * ext/standard/url.c: - (PHP urldecode) Fix for #2788, function changed parameter in place - -1999-11-21 Thies C. Arntzen - - * ext/standard/array.c: convert_to_long() after compare_function() destroys float-compares! - -1999-11-21 Egon Schmid - - * ext/standard/array.c - ext/standard/html.c: Maybe later on today. Must buy some beer first. - -1999-11-21 Thies C. Arntzen - - * ext/standard/basic_functions.c - ext/standard/html.c - ext/standard/html.h: (PHP get_html_translation_table) new function. - - * ext/standard/array.c - ext/standard/php_array.h: (PHP array_flip) new function. no clash detection, only works for IS_STRING and IS_LONG datatypes in src-array. - - * ext/standard/array.c: -renamed some macros - -return_value_used now used in a few more functions - - * ext/standard/string.c: (PHP strtr) little smarter - -1999-11-21 Stefan Roehrich - - * ext/java/README - ext/java/java.c: Java module now works with Linux jdk 1.2pre2. - -1999-11-21 Rasmus Lerdorf - - * ext/gd/config.m4 - ext/gd/gdttf.c - stamp-h.in: Fix gd problems - -1999-11-21 changelog - - * NEWS: NEWS update - -1999-11-20 Sascha Schumann - - * ext/dba/config.h.stub - ext/dba/config.m4 - ext/dba/dba.c - ext/dba/dba_db3.c - ext/dba/php3_db3.h - ext/dba/Makefile.am: add Berkeley DB3 support - -1999-11-20 Andrei Zmievski - - * ext/standard/string.c: - (PHP substr_replace) Changed the order of the arguments. - -1999-11-20 Sascha Schumann - - * sapi/cgi/php.sym - sapi/aolserver/php.sym - sapi/apache/php.sym - acinclude.m4 - configure.in - php.sym: - --enable-versioning can now be used with CGI/AOLserver as well. Note that - we do not use versioning per se anymore, but export only the required - symbols. - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.dsp - ext/mysql/mysql.dsp: - Changed path to MySQL library in Win32 project - -1999-11-20 Thies C. Arntzen - - * ext/standard/string.c: (PHP strtr) new 2-Arg version. - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.dsp - ext/pgsql/pqsql.dsp: - - Fixed a typo in the name of the project file. It links now - -1999-11-20 changelog - - * NEWS: NEWS update - -1999-11-20 Andi Gutmans - - * ext/pgsql/pgsql.c - ext/pgsql/pqsql.dsp: - - More PGSQL thread-safe updates. It still doesn't work though. Crashes for - some reason at .dll load time - - * ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pgsql/pqsql.dsp: - Should pretty much work now - - * ext/pgsql/pgsql.c - ext/pgsql/pqsql.dsp: - Add project file - - * ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h: - - Start PostgreSQL support for Win32. Just added preliminary ZTS support. - Still need to make minit ZTS. - -1999-11-19 Andrei Zmievski - - * ext/pcre/php_pcre.c: - (PHP preg_replace) Fixed a bug that cause backreferences to lose - their value after the first occurrence. - - * ext/pcre/php_pcre.c: - Fixed a bug that would replace only the first occurrence and result in - a parse error for the rest when using /e modifier. - -1999-11-19 Thies C. Arntzen - - * ext/ftp/ftp.c: is needed on linux - -1999-11-19 Andi Gutmans - - * internal_functions_win32.c: - - Make it consistent with the rest of the stuff there. - - * ext/standard/array.c - internal_functions_win32.c - php4dllts.dsp: - Add array.c to the Win32 project - -1999-11-19 Thies C. Arntzen - - * ext/xml/xml.c: (PHP xml_parse_into_struct) buffer was sometimes short by 1. - -1999-11-19 Zeev Suraski - - * ext/sybase_ct/php_sybase_ct.c - ext/sybase/sybase.c: Optimize a bit - - * ext/sybase_ct/php_sybase_ct.c: Fix a bug in sybase_fetch_hash() - -1999-11-18 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h: - Removed stdio wrapper from sockets; added timeouts to socket ops. - -1999-11-18 Sascha Schumann - - * sapi/apache/apMakefile.libdir - sapi/apache/apMakefile.tmpl - sapi/apache/config.m4 - apMakefile.libdir - apMakefile.tmpl: - Moving apMakefile.{libdir,tmpl} to sapi/apache directory. - -1999-11-18 Sam Ruby - - * ext/standard/info.c: arg! alphabetize correctly! - - * ext/standard/info.c: add Java module to credit info - -1999-11-17 Sascha Schumann - - * php_globals.h: - Add post request startup handlers. These are called at the end of the - request startup function, and can use the initialized structures like - the symbol table. - - * ext/session/session.c (php_rinit_session): - use post request startups to reenable session.auto_start - - * main.c - php.h: - Add post request startup handlers. These are called at the end of the - request startup function, and can use the initialized structures like - the symbol table. - - * configure.in: - Remove --enable-thread-safety. There is no reason people should be able - to set this manually; most likely, they will burn themselves by using it. - -1999-11-17 Stig Bakken - - * NEWS - php_version.h: Bump version to 4.0b4-dev. - -1999-11-17 Thies C. Arntzen - - * configure.in: b3 is already tagged in CVS - -1999-11-17 changelog - - * NEWS: NEWS update - -1999-11-16 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: (PHP substr_replace) New function. - - * ext/standard/array.c: Just some rearranging. - -1999-11-16 Andi Gutmans - - * ext/standard/array.c: - Change used_return_value to return_value_used - - * ext/standard/array.c: - - Initial support for Thies' idea of passing functions a flag telling them - they don't need to return a value. Adjusted reset() to work with this. - It is a bit problematic because if internal functions don't look at the - flag and still return a value orginally this leaked. So I free the value - in any case, which kind of makes the speed gain a bit smaller - -1999-11-16 Stig Bakken - - * NEWS: final news update before 4.0b3 - - * php_version.h - configure.in: 4.0b3 coming up - -1999-11-15 Andrei Zmievski - - * NEWS: cleaning up - -1999-11-15 changelog - - * NEWS: NEWS update - -1999-11-15 Sascha Schumann - - * ext/mcrypt/mcrypt.c (php_minit_mcrypt): Also allow never versions of mcrypt - - * ext/mhash/mhash.c: - (php_minit_mhash): Don't use REGISTER_LONG_CONSTANT macro, because we - don't have a fixed size array of chars (this used to work nevertheless). - -1999-11-14 Sascha Schumann - - * ext/mhash/mhash.c (PHP mhash): don't segfault, if mhash_end() returns NULL - - * ext/db/config.m4 - ext/db/db.c: Check for db1/ndbm.h and use it in db. Fixes #2647 - -1999-11-14 Andi Gutmans - - * sapi/isapi/php4isapi.dsp - regex/engine.c - regex/regcomp.c: - Fixing warnings in regex - -1999-11-14 Thies C. Arntzen - - * NEWS - ext/standard/array.c: - (PHP k[r]sort) now use compare_function from libzend to be consistent with the language-core. - -1999-11-14 Andi Gutmans - - * sapi/isapi/php4isapi.c - php4ts.dsw: - - Remove ISAPI project from main dir as it's been copied to sapi/isapi - -1999-11-14 Thies C. Arntzen - - * NEWS: clearify - - * ext/standard/string.c: (PHP ucfirst,ucwords) no longer modify arg1 - - * ext/standard/string.c: (PHP strtr) no longer modifies arg1. - -1999-11-14 Danny Heijl - - * ext/informix/ifx_custom_build.dsp - ext/informix/ifx_custom_build.dsw - ext/informix/php_informix.h - ext/informix/ifx.dsp - ext/informix/ifx.dsw - ext/informix/ifx.ec: - (ext/informix) Added WIN32 build files for informix driver - and make it compile with ZTS - -1999-11-14 Stig Bakken - - * ext/standard/file.c - ext/standard/file.h - configure.in - php.h: Removed the mkstemp stuff and added tmpfile() function instead. - -1999-11-13 Andrei Zmievski - - * internal_functions.c.in: These are inserted automatically now. - - * ext/standard/basic_functions.c: It's in array.c now. - - * ext/standard/Makefile.am - ext/standard/array.c - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/php_array.h - internal_functions.c.in: Split array functions into separate module. - -1999-11-13 Sascha Schumann - - * regex/regex_extra.h - php_regex.h: - Suck in prototypes correctly with applied aliases - (otherwise php_reg* would not be prototyped) - -1999-11-13 Andi Gutmans - - * regex/regex_extra.h - php4dllts.dsp: - Make Win32 compile again - -1999-11-13 Sascha Schumann - - * sapi/apache/config.m4: Allow --with-apxs and --with-regex=apache - - * sapi/apache/config.m4 - sapi/apache/libphp4.module.in - regex/regex_extra.h - regex/utils.h - ext/standard/config.m4 - ext/standard/reg.c - Makefile.am - acinclude.m4 - configure.in - php.h - php_regex.h: - Improve regex library selection. It lets user specify whether they want - system, apache, or php's regex library by using the --with-regex option. - "php" is the default; if you use --with-apache in combination with - Apache 1.3.x, the default is "apache". - - * .cvsignore: Remove libtool targets - - * ext/standard/config.m4 - Makefile.am - acinclude.m4 - configure.in: - - remove extra CPPFLAGS from top-level Makefile - - HSREGEX defaults to what the user wants, but can be changed now internally - - * configure.in: Export CPPFLAGS to propagate additional flags - - * configure.in: Fix typo (escape sign was one off) - - * configure.in - php_version.h: preparing 4.0b3-RC5 - - * sapi/cgi/Makefile.am - sapi/isapi/Makefile.am - ext/zlib/Makefile.am - sapi/aolserver/Makefile.am - ext/wddx/Makefile.am - ext/yp/Makefile.am - ext/sysvsem/Makefile.am - ext/sysvshm/Makefile.am - ext/sybase/Makefile.am - ext/sybase_ct/Makefile.am - ext/session/Makefile.am - ext/standard/Makefile.am - ext/pdf/Makefile.am - ext/readline/Makefile.am - ext/oracle/Makefile.am - ext/pcre/Makefile.am - ext/oci8/Makefile.am - ext/odbc/Makefile.am - ext/msql/Makefile.am - ext/mhash/Makefile.am - ext/mcal/Makefile.am - ext/mcrypt/Makefile.am - ext/interbase/Makefile.am - ext/ldap/Makefile.am - ext/imap/Makefile.am - ext/informix/Makefile.am - ext/hyperwave/Makefile.am - ext/icap/Makefile.am - ext/gettext/Makefile.am - ext/gd/Makefile.am - ext/filepro/Makefile.am - ext/ftp/Makefile.am - ext/dbase/Makefile.am - ext/fdf/Makefile.am - ext/db/Makefile.am - ext/dba/Makefile.am - ext/bcmath/Makefile.am - ext/dav/Makefile.am - ext/apache/Makefile.am - ext/aspell/Makefile.am - configure.in: - Remove the extra INCLUDES line from most automake Mafiles. This is not - necessary, because we can change the value of INCLUDES globally in one - place (configure.in). - - Also add two defines in thread-safe mode - (_REENTRANT and POSIX_PTHREAD_SEMANTICS) - - * acinclude.m4: (AC_EXPAND_PATH) Expand relative paths completely - -1999-11-13 changelog - - * NEWS: NEWS update - -1999-11-12 Sascha Schumann - - * sapi/apache/config.m4 - acinclude.m4 - configure.in - ext/standard/config.m4: Enable selective regex library compilation. - - * regex/cclass.h - regex/cname.h - regex/engine.c - regex/regcomp.c - regex/regcomp.ih - regex/regerror.c - regex/regex.h - regex/regex2.h - regex/regexec.c - regex/utils.h: upgrade regex library to alpha3.8 - -1999-11-12 Thies C. Arntzen - - * ext/oci8/oci8.c: added missing function-alias - - * ext/oci8/oci8.c: oops, didn't mean to activate this! - - * ext/oci8/oci8.c: fixed mested-tables again (broke it when resourcified the driver) - -1999-11-12 changelog - - * NEWS: NEWS update - -1999-11-11 Rasmus Lerdorf - - * MAINTAINERS: -1999-11-11 Thies C. Arntzen - - * fopen-wrappers.c: (PHP fopen) commands send to a FTP-server need to end in "\r\n" (RFC 854) - -1999-11-10 Frank M. Kromann - - * ext/mssql/php_mssql.c: Fixing the use of mssql.textsize in pconnect() - -1999-11-10 Rasmus Lerdorf - - * ext/gd/config.m4: - * ext/gd/gd.c: This arg is optional - -1999-11-10 Stig Bakken - - * makedist: "import" libtool file preservation code from build.mk - - * build.mk: Shut up warning from automake. - -1999-11-10 Rasmus Lerdorf - - * ext/oci8/oci8.c: -1999-11-10 Andrei Zmievski - - * NEWS: Remove duplicates. - -1999-11-10 changelog - - * NEWS: NEWS update - -1999-11-10 Sam Ruby - - * ext/java/.cvsignore: add Java and MSDev outputs - -1999-11-09 Frank M. Kromann - - * php.ini-dist: Adding default mssql ini-setings - -1999-11-09 Stig Bakken - - * config.w32.h: -1999-11-09 Thies C. Arntzen - - * ext/oracle/config.m4 - ext/oci8/config.m4: IRIX ld likes this order better - -1999-11-09 Sascha Schumann - - * build.mk: Move only, if the file exists. - - * build.mk: - automake overwrites libtool's files, if - - - --add-missing was used - - *_LTLIBRARIES targets are used - - Thus, we preserve our customized files while automake runs - - * config.guess - config.sub: Add libtool helper files - -1999-11-09 Sam Ruby - - * php4dll.dsp: add mergesort into build - -1999-11-09 Stig Bakken - - * ext/java/.cvsignore - ext/java/config.m4: - - substitute JAVA_LFLAGS (not set, but used in libphp_java_la_LIBADD) - - add .cvsignore file - - * configure.in - php_version.h: 4.0b3-RC4 - - * makedist: - Preserve the CVS versions of ltconfig/ltmain.sh during makedist. - -1999-11-09 Rasmus Lerdorf - - * ext/snmp/config.m4: Better lib detection for ucd-snmp - -1999-11-09 Sam Ruby - - * php4dll.dsp: location of output.c moved. - -1999-11-09 Rasmus Lerdorf - - * ext/snmp/config.m4: Find ucd-snmp include files more intelligently - -1999-11-09 Stig Bakken - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php3_velocis.h - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/velocis.c: - Clean up ODBC HAVE_XXX symbols, compile fixes for OpenLink and Solid. - -1999-11-09 Sascha Schumann - - * ext/session/session.c - php.ini-dist: - set default path for cookie to the root directory ("/") - - complete session documentation in php.ini-dist - -1999-11-09 Sam Ruby - - * MAINTAINERS: add java - -1999-11-09 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: - Include proper header files (replacement functions were not used). - -1999-11-09 Stig Bakken - - * ext/odbc/config.m4: Fix OpenLink ODBC support - - * configure.in - php_version.h: Bump version to 4.0b3-RC3. - -1999-11-09 Sam Ruby - - * ext/java/Makefile.am - ext/java/README - ext/java/config.h.stub - ext/java/config.m4 - ext/java/java.c - ext/java/java.dsp - ext/java/jawt.php - ext/java/jver.php - ext/java/reflect.java: Users of PHP are hereby granted a non-exclusive, irrevocable, world-wide, - royalty-free, non-transferable license to use, execute, prepare derivative - works of, and distribute (internally and externally, and including derivative - works) the code accompanying this license as part of, and integrated into PHP. - WARRANTY OF ANY KIND EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO - THE IMPLIED WARRANTY OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - AND ANY WARRANTY OF NON-INFRINGEMENT. THE ENTIRE RISK ARISING OUT OF THE USE - OR PERFORMANCE OF THIS CODE REMAINS WITH USERS OF PHP. The owner of this code - represents and warrants that it is legally entitled to grant the above license. - -1999-11-09 Stig Bakken - - * makedist: Makedist can now be run from outside the CVS tree. - - * ext/standard/basic_functions.c: -1999-11-09 changelog - - * NEWS: NEWS update - -1999-11-08 Jakub Skopal - - * ext/sybase_ct/php_sybase_ct.c: - "sybase" is definitelly six characters long :-) - -1999-11-08 Stig Bakken - - * configure.in - makedist: Cleaned up makedist a bit more. - - * .cvsignore: ignore distribution files - -1999-11-08 Sascha Schumann - - * build.mk - buildconf - ltconfig - ltmain.sh: - Add libtool files to CVS. Advantages: - - - PHP-specific changes are easier to maintain - - it removes one dependency for users (i.e. GNU vs. FreeBSD ports) - - I have not removed the libtool check in buildconf, since libzend/TSRM still - depend on a local version of libtool. - - * ext/snmp/snmp.c: - Remove prototype. The prototype was not necessary for UCD SNMP 3.5.3, and - broke the build for UCD SNMP 4.0.1. - -1999-11-08 Stig Bakken - - * configure.in - php.h: (PHP tempnam) now uses mkstemp() if available - -1999-11-07 Sascha Schumann - - * sapi/aolserver/aolserver.c: - (php_ns_request_ctor) enable HTTP Access Authentication - - (php_ns_hash_environment) supply PATH_TRANSLATED to scripts - -1999-11-07 changelog - - * NEWS: NEWS update - -1999-11-06 Sascha Schumann - - * build.mk: - limit find to PHP's automake Makefiles - - check whether patches were applied correctly - - * ext/session/session.c: - Disable auto_start until we find a way to access the necessary data fields. - -1999-11-06 Zeev Suraski - - * configure.in - php_version.h: Version update - - * ext/standard/basic_functions.c - ext/session/session.c - ext/com/COM.c - NEWS - mergesort.c - php_ini.h: - Win32 fixes - - COM module improvements from Boris Wedl - -1999-11-06 Thies C. Arntzen - - * ext/standard/var.c: - (PHP var_dump, serialize) now use php.ini's precision size when displying/serializing doubles - -1999-11-06 changelog - - * NEWS: NEWS update - -1999-11-05 Rasmus Lerdorf - - * ext/mysql/php_mysql.c: - We need to use mysql_field_count() instead of mysql_num_fields() if - we are using MySQL 3.22.24 or newer when we want to check a mysql struct - instead of a result struct. The reference is here: - http://www.mysql.com/Manual_chapter/manual_Clients.html#mysql_num_fields - -1999-11-05 Sam Ruby - - * main.c: configuration failures trap server - -1999-11-05 Rasmus Lerdorf - - * LICENSE: -1999-11-05 Thies C. Arntzen - - * ext/sybase/sybase.c: - (php3_sybase_get_column_content) initialize buffer before call to dbconvert() - -1999-11-04 Andrei Zmievski - - * ext/standard/basic_functions.c: - (PHP multisort) More work, not yet done though. - -1999-11-04 Rasmus Lerdorf - - * ext/dba/config.m4: Try to avoid IBM/Berkeley DB2 confusion - -1999-11-04 Stig Bakken - - * makedist - configure.in - php_version.h - buildconf: -1999-11-04 Andi Gutmans - - * ext/mssql/mssql.dsp: - - Add include path. Used relative include path assuming php4 and bindlib_w32 - are in the same directory. - -1999-11-03 Frank M. Kromann - - * MAINTAINERS - NEWS: Added MS SQL server module - - * ext/mssql/.cvsignore: Changed directory names to match project - - * ext/mssql/.cvsignore - ext/mssql/Readme_w32.txt - ext/mssql/mssql.dsp - ext/mssql/php_mssql.c - ext/mssql/php_mssql.h: Adding MS SQL Server module for Win32 - -1999-11-03 Andi Gutmans - - * NEWS: -1999-11-03 Evan Klinger - - * ext/standard/basic_functions.c: Fix compile warning - -1999-11-03 changelog - - * NEWS: NEWS update - -1999-11-02 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: Add
tag - - * configure.in: - Additional check for concurrent use of --with-{apache,apxs} - -1999-11-02 Andrei Zmievski - - * ext/standard/basic_functions.c: Remove extraneous comment. - -1999-11-02 Evan Klinger - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - (PHP getprotoby{name,number}) New Functions - -1999-11-02 changelog - - * NEWS: NEWS update - -1999-11-01 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_pad() function. - -1999-11-01 Charles Hagenbuch - - * ext/imap/imap.c: - Trying to clean up the last of the body->id/body->description confusion. - -1999-11-01 Andrei Zmievski - - * php.ini-dist: Added new session configuration directives. - -1999-11-01 Sascha Schumann - - * ext/snmp/config.m4: Fix for #2631 - -1999-11-01 changelog - - * NEWS: NEWS update - -1999-11-01 Evan Klinger - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - (PHP getservby{name,port}) New functions. - -1999-10-31 Sascha Schumann - - * ext/session/session.c: Add missing initialization entry - - * ext/mcrypt/mcrypt.c: Support current mcrypt. Tested with libmcrypt-2.2.4 - - * ext/session/php_session.h - ext/session/session.c: - Change session.lifetime to session.cookie_lifetime. And: - -1999-10-31 Sam Ruby - - * configuration-parser.y: -1999-10-30 Rasmus Lerdorf - - * php_regex.h: typing in the dark - - * php_regex.h: - Damn, can't see underscores correctly on this silly terminal I am on - - * sapi/apache/mod_php4.c - sapi/apache/sapi_apache.c - ext/standard/browscap.c - ext/standard/reg.c - ext/standard/url.c - php_regex.h - php.h: - Clean up regex header file mess. php.h now explicitly includes php_regex.h - and php_regex.h figures out which regex header files to include and - defines symbols that prevents other stuff from including the wrong versions - of regex header files. - -1999-10-29 Rasmus Lerdorf - - * ext/imap/imap.c: Fix typo found by hholzgra@media-engineering.de - - * ext/standard/dl.c - regex/regex.h - php_regex.h: Kill the regex header file warnings - - * NEWS: Looked like this was done by RedHat the way I wrote it. - -1999-10-29 changelog - - * NEWS: NEWS update - -1999-10-28 Rasmus Lerdorf - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - (IBM DB2 Support) Fix stuff to allow IBM DB2 to work with PHP 4. - Tested against DB2 6.1 UDB on Linux (RH-6.0) - -1999-10-28 Sascha Schumann - - * Makefile.am: - Remove set-if-not-set colon, since CPPFLAGS is never set by automake. - -1999-10-28 Andrei Zmievski - - * ext/pcre/php_pcre.c: Fix bug #2623. - - * NEWS: New function. - -1999-10-28 changelog - - * NEWS: NEWS update - -1999-10-28 Sam Ruby - - * php4dllts.dsp: - look for output.c in its new location in the windows build - -1999-10-27 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: (PHP str_repeat) New function. - -1999-10-27 Thies C. Arntzen - - * ext/standard/basic_functions.h - ext/standard/output.c - ext/standard/php_output.h - Makefile.am - ext/standard/Makefile.am - ext/standard/basic_functions.c - internal_functions.c.in - internal_functions_win32.c - output.c - output.h - php.h: moved output.c into ext/standart and made it thread-safe. - moved output-buffering related functions from basic_functions to output.c - Win32 project need to be updated to reflect new position. - - * ext/oci8/oci8.c: -1999-10-27 Andrei Zmievski - - * ext/standard/basic_functions.c: Forgot to remove function entry. - -1999-10-26 Thies C. Arntzen - - * ext/standard/file.c: eliminated warinigs - -1999-10-26 Andrei Zmievski - - * TODO: No tabs please. - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: (PHP array_map) Away with it. - - * TODO: Some todo things. - -1999-10-25 Thies C. Arntzen - - * ext/readline/readline.c: added some more options - -1999-10-24 Thies C. Arntzen - - * ext/standard/fsock.c: kill warning - - * ext/standard/basic_functions.c: - folding fix (xemacs 21 loads the file again;-) - -1999-10-24 Sascha Schumann - - * ext/pcre/config.h.stub - ext/pcre/config.m4: - Define USE_BCOPY, if memmove is not found (i.e. SunOS 4). Fix for #2480 - -1999-10-24 Sam Ruby - - * php4dllts.dsp - php4dll.dsp: - Allow CYGWIN directory to be specified as via environment variable - -1999-10-24 Sascha Schumann - - * ext/session/session.c: - (PHP session_register, session_unregister) always return true - -1999-10-23 Thies C. Arntzen - - * ext/readline/readline.c: - one can now use callbacks for custom completion functions (still work-in-progress) - -1999-10-22 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c - NEWS - php.ini-dist: Add session.use_cookies option - -1999-10-22 Thies C. Arntzen - - * ext/standard/var.c: - unserialize no longer complaints about unserializing empty-strings (started that just a few days ago) - -1999-10-21 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: Add - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/php3_hyperwave.h: - Added hw_mapid(), read comment in hg_comm.c - -1999-10-21 Sascha Schumann - - * ext/session/mod_files.c (_ps_files_open): evaluate key (session id) before path creation - -1999-10-21 changelog - - * NEWS: NEWS update - -1999-10-20 Sascha Schumann - - * sapi/aolserver/aolserver.c: - (php_ns_hash_environment): provide more CGI/1.1 variables to scripts. - - Added REQUEST_METHOD, QUERY_STRING, REMOTE_ADDR - -1999-10-20 Andi Gutmans - - * ext/com/COM.c - internal_functions_win32.c - php4dllts.dsp: - Make COM compile again - - * ext/com/php3_COM.h - ext/com/php_COM.h - ext/standard/dir.c - config.w32.h - php4ts.dsp: - Make CVS compile on Win32. - - Rename php3_COM.h -> php_COM.h - -1999-10-20 Thies C. Arntzen - - * ext/standard/config.h.stub - ext/standard/config.m4 - ext/standard/dir.c - ext/standard/php3_dir.h: (PHP getcwd()) added, needs to porting to Win32 - -1999-10-20 Sascha Schumann - - * ext/standard/info.c (_display_module_info): Add anchor for module names - - * sapi/aolserver/aolserver.c (php_info_aolserver): add more information from the server context - -1999-10-20 Thies C. Arntzen - - * ext/xml/xml.c: - (PHP xml_parse_into_struct) sometimes the value was truncated - - * ext/standard/var.c: (PHP var_dump, serialize) fixed mem_leak. - -1999-10-20 Andrei Zmievski - - * .cvsignore: Ignore shared modules directory. - - * .cvsignore: Ignore generated libs. - -1999-10-20 Thies C. Arntzen - - * ext/xml/xml.c (PHP xml_parse_into_struct): fixed mem-leak when encountering invalid XML. - -1999-10-20 Sascha Schumann - - * sapi/aolserver/aolserver.c: - (php_ns_hash_environment) add SERVER_SOFTWARE, SERVER_BOOTTIME, SERVER_BUILDDATE, SERVER_PROTOCOL - -1999-10-20 changelog - - * NEWS: NEWS update - -1999-10-19 Andrei Zmievski - - * main.c: Revert my patches to error functions. - -1999-10-19 Thies C. Arntzen - - * NEWS: added === operator support (type *and* value match) . samples: - (1 == "1") is true - (1 === "1") is false (integer != string) - (0 == false) is true - (0 === false) is false (integer != boolean) - -1999-10-19 Andrei Zmievski - - * ext/standard/basic_functions.c (PHP extract): - Fixed bug that would mess up global and referenced - variables in certain cases. - - * ext/ldap/ldap.c (PHP ldap_get_entries): Fix string function name. - -1999-10-19 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - - some tiny changes to possible improve link extraction/insertion of HTML-docs - -1999-10-19 Thies C. Arntzen - - * ext/standard/url.c: (parse_url) fix for #2569: parse_url('-') crashes - -1999-10-19 changelog - - * NEWS: NEWS update - -1999-10-18 Egon Schmid - - * ext/standard/formatted_print.c: More forgotten prototypes. - -1999-10-18 Stefan Roehrich - - * MAINTAINERS: - Added zlib module to list of maintained extensions. (Stefan). - -1999-10-18 Thies C. Arntzen - - * ext/standard/var.c: - * ext/standard/var.c: (PHP unserialize) - fixed mem-leak. - -1999-10-18 changelog - - * NEWS: NEWS update - -1999-10-17 Sascha Schumann - - * ext/gd/Makefile.am - ext/gd/config.h.stub - ext/gd/config.m4 - ext/gd/gd.c - ext/gd/php3_gd.h: Add PNG support. Tested with gd 1.7.3. - -1999-10-17 Egon Schmid - - * ext/standard/dl.c: Looks better, but isn't wrong - - * ext/standard/math.c: One typo corrected. - -1999-10-17 Andrei Zmievski - - * ext/zlib/zlib.c: Fix bug #2548. - -1999-10-16 Andrei Zmievski - - * ext/xml/xml.c - ext/standard/file.c - ext/standard/php3_string.h - ext/standard/string.c - fopen-wrappers.c: _php3/_php3i -> php rename - -1999-10-16 Andi Gutmans - - * sapi/cgi/cgi_main.c: - It's OK if we link dynamically. - - * sapi/cgi/cgi_main.c - ext/standard/basic_functions.c - ext/standard/basic_functions.h - php4ts.dsp - mergesort.c - php4dllts.dsp: - - Get windows version to compile again. No biggy if array_map is not #if 0'd - out even if it doesn't work. - -1999-10-15 Andrei Zmievski - - * ext/standard/basic_functions.h: *** empty log message *** - - * ext/standard/basic_functions.c: (PHP array_map) Temporarily #if 0 this. - - * php.h: Update mergesort() proto. - - * ext/pcre/php_pcre.c: Make string copying a little more efficient. - - * main.c: Small tweak in the error format. - - * main.c (php3_log_err): Don't output error message to stderr when - running as CGI binary. - - * ext/pcre/php_pcre.c - ext/standard/php3_string.h - ext/standard/string.c: - Renamed a couple of functions to have proper php_ prefix. - - * main.c (php_error): finally get rid of those annoying html tags - when running as CGI binary - - * ext/standard/basic_functions.c: - Massive change of zend_error() to php_error(). - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - * Makefile.am: Add mergesort.c to compilation list. - - * mergesort.c - php.h: Added mergesort.c from FreeBSD. - -1999-10-15 Thies C. Arntzen - - * ext/standard/basic_functions.h - ext/standard/basic_functions.c: (is_resource, is_bool) new functions - -1999-10-15 Andrei Zmievski - - * ext/pcre/php_pcre.c: - (_php_replace_in_subject) - (PHP preg_replace): - Fixed a bug that happened when regex was an array and replacement was a - single non-string value. Also changed conversions to use - convert_to_string_ex(). - - (PHP preg_grep): use convert_to_string_ex() for proper conversion - -1999-10-15 Thies C. Arntzen - - * ext/standard/file.h - ext/standard/fsock.c - ext/standard/file.c - ext/pdf/pdf.c - ext/ftp/php_ftp.c - rfc1867.c - fopen-wrappers.h - php.h: - files are now resources, file.c is thread-safe, the le_ vars are no longer shared, - but they are accessible thru "php_file_le_socket(), php_file_le_uploads()..." - i also updated the ftp, pdf and file-upload stuff to match the new requirements. - -1999-10-15 Andrei Zmievski - - * ext/standard/string.c (PHP implode): Properly separate zval for another case. - -1999-10-15 Zeev Suraski - - * ext/standard/string.c: - That should do the trick - fix implode() not to modify its arguments - - * ext/odbc/php_odbc.c - config.w32.h: Make ODBC work under Win32 - -1999-10-15 Andi Gutmans - - * tests/testarray - tests/testfuncref - ext/standard/math.c - php4dllts.dsp: - - Converted math.c to use new convert_to_number_ex() macro. - -1999-10-14 Thies C. Arntzen - - * ext/readline/config.m4 - ext/readline/php_readline.h - ext/readline/readline.c: configure works for me (RH 6.1) - - * ext/readline/.cvsignore: forgot - - * ext/readline/Makefile.am - ext/readline/config.h.stub - ext/readline/config.m4 - ext/readline/php_readline.h - ext/readline/readline.c - ext/readline/setup.stub: - interface to GNU-Readline! (not yet active, autoconf needs to be done) - very neat - but only usable in standalone (command-promt) mode! - -1999-10-13 Sascha Schumann - - * MAINTAINERS: Add dba and mcrypt extensions to list. - -1999-10-13 Thies C. Arntzen - - * configuration-parser.y - ext/standard/dl.c - ext/standard/dl.h - ext/standard/file.c - php3_compat.h: - new api fo dl() - renamed php3_dl to php_dl (added compat header) - - * ext/standard/html.c (PHP: htmlspecialchars, htmlentities): - new zend-api for html-function (not worth mentioning in NEWS) - - * ext/standard/math.c: -1999-10-13 Andrei Zmievski - - * MAINTAINERS: Add mhash module. - -1999-10-13 Thies C. Arntzen - - * ext/standard/exec.c: - (shell_exec) use pclose for FILE* that has been opened via popen! - -1999-10-13 changelog - - * NEWS: NEWS update - -1999-10-12 Thies C. Arntzen - - * ext/standard/file.c - ext/standard/file.h - ext/standard/fsock.c - fopen-wrappers.h - rfc1867.c: - starting to clean-up/new API'ize and resourcify the file-stuff - nothing happened yet - just renaming things around. - -1999-10-12 Danny Heijl - - * ext/informix/ifx.ec: - (Informix driver) Thies introduced ZEND_FETCH_RESOURCE2 (Danny). - -1999-10-12 Thies C. Arntzen - - * MAINTAINERS: made nice - - * MAINTAINERS: add myself - - * ext/wddx/wddx.c: (wddx_add_vars) adjusted to new resource-API - - * ext/sybase_ct/php_sybase_ct.c: (php sybase_close) fixed obvious bug. - - * ext/sybase_ct/php_sybase_ct.c - ext/oracle/oracle.c - ext/odbc/php_odbc.c - ext/oci8/oci8.c - ext/mysql/php_mysql.c - ext/msql/php_msql.c: - new improved resource-API (i hope everything still compiles) - -1999-10-12 Andrei Zmievski - - * MAINTAINERS: Just some formatting. - -1999-10-12 Danny Heijl - - * MAINTAINERS: - Added Informix driver to list of maintained extensions. (Danny). - -1999-10-12 changelog - - * NEWS: *** empty log message *** - - * NEWS: NEWS update - -1999-10-11 Andrei Zmievski - - * ext/standard/basic_functions.c: - Modified sorting functions to use updated zend_hash() prototype. - - * README.CVS-RULES: Added notice about LXR and Bonsai. - - * MAINTAINERS: First revision. - -1999-10-11 Danny Heijl - - * ext/informix/config.m4: *** empty log message *** - - * ext/informix/ifx.ec: - (ext/informix) Changed ifx.ec to use the new high-performance - ZEND API now that it compiles with libtool. (Danny) - - * ext/informix/config.m4: - (configure) Allow IFX_LIBDIR environment variable to specify the - Informix library path to allow linking with the static - libraries (libtool related). (Danny). - path for configure (Danny). - -1999-10-10 Sascha Schumann - - * build.mk: automake scans aclocal.m4 as well - -1999-10-10 Thies C. Arntzen - - * build.mk: (build.mk) fix suggested by sascha. - - * build.mk: - (build.mk) make cvsclean now also deletes the libzend & TSRM symlinks. - -1999-10-10 Sascha Schumann - - * ext/informix/stub.c: Add stub.c for helper library. - -1999-10-10 Thies C. Arntzen - - * build.mk: - (build.mk) added target cvsclean: removed all files listed in all .cvsignore files found in the current tree. - -1999-10-10 Sascha Schumann - - * ext/informix/Makefile.am - ext/informix/config.m4: - Workaround for Informix set of libraries. One library depends on - another "library" (an object file). We build a standard library - out of this object here, so that we can link it in at the right place - later. - - * ext/gd/gd.c - ext/pgsql/pgsql.c - ext/snmp/snmp.c: - Remove -DPIC preprocessor macros. This is defined by libtool - automatically, if a shared library is built. This would lead - to multiple definitions of get_module(). If you want to build - modules, add -DCOMPILE_DL to your CFLAGS. - - * ext/informix/Makefile.am - ext/informix/config.m4: Link in IFX_LIBS properly. - - * build.mk: - Clean up and add 'clean' target which removes standard targets recursively - - * build.mk: build.mk can be used to generate build tools. It is usually - faster than buildconf, since it rebuilds only components, if - it is necessary. To use it, run - - $ make -f build.mk - -1999-10-09 Sascha Schumann - - * Makefile.am: Remove redundant library declaration. All libtool libraries - are referenced through DEPENDENCIES now. - - * Makefile.am: Only link with bundled regex, if the user wants it. - - * regex/regcomp.c: POSIX_MISTAKE is enabled by default. - -1999-10-09 Thies C. Arntzen - - * sapi/apache/config.m4: - fix suggested by sascha for xml-build in apxs mode - -1999-10-09 changelog - - * NEWS: NEWS update - -1999-10-08 Andreas Karajannis - - * ext/odbc/php_odbc.c: - Forgot to remove workaround for SQLANY_BUG which is no longer needed - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - Moved Environment handle to connection struct for thread safety - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: Mention php-cvs-daily list. - -1999-10-08 Sascha Schumann - - * main.c: Use correct data type for mutex. - - * main.c: - Implement temporary workaround for thread-safety issues. This - serializes all request accesses. To disable, define NO_GLOBAL_LOCK - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: More emphasis on ChangeLog and NEWS daily updates. - -1999-10-08 changelog - - * tests/testclassfunc: mailing list test - - * tests/testfe: testing - - * tests/test.php4: test - -1999-10-08 Andrei Zmievski - - * README.CVS-RULES: - More information on how to use the special prefixes and the frequency - of NEWS and ChangeLog updates. - -1999-10-08 Sascha Schumann - - * sapi/aolserver/aolserver.c: - (php_info_aolserver): Show information about the SAPI module - (php_ns_module_main): Return early, if request startup failed - -1999-10-08 Jouni Ahto - - * ext/gd/gdt1.c - ext/gd/gdt1.h: - Added the files for t1lib support. No porting from PHP3 done yet. - - * ext/standard/datetime.c: - (PHP gmmktime) Should now give right values. Note that there was never need for - the acrobacy adjusting the time for GMT. mktime() fills - tm_gmtoff with just the right offset to add. (Jouni) - - * ext/standard/php3_string.h - ext/standard/string.c - ext/standard/basic_functions.c: - (PHP setlocale) Locale settings are now correctly restored to the values - set in environment at request shutdown. (Jouni) - -1999-10-07 Sascha Schumann - - * sapi/aolserver/aolserver.c: - Apparently, we did too much cleanup. The server survives now much longer. - -1999-10-07 Andrei Zmievski - - * NEWS: NEWS update - - * MAINTAINERS - README.CVS-RULES - TODO: - New files. - - Please read README.CVS-RULES! - -1999-10-07 Sascha Schumann - - * sapi/aolserver/aolserver.c: POST works now and does not block anymore. - - * sapi/cgi/config.m4 - sapi/isapi/config.m4 - sapi/apache/config.m4 - sapi/aolserver/config.m4 - configure.in: Remove SAPI_TARGET and use PHP_SAPI completely. - - The target filename is now available as SAPI_PROGRAM, SAPI_SHARED, and - SAPI_STATIC. - - * sapi/aolserver/aolserver.c: - (ns_globals_struct): remove content_type member - - (php_ns_request_dtor): remove content_type destructor, re-add path_translated destructor - - * sapi/aolserver/aolserver.c: - Add comments to the source code and fix POST-read-data bug. - -1999-10-07 Andrei Zmievski - - * TODO-LeftOver: Some ChangeLog surgery. - -1999-10-07 Sascha Schumann - - * ext/ext_skel: Add help to get people started. - -1999-10-07 Andreas Karajannis - - * ext/odbc/php_odbc.c - ext/odbc/php_odbc.h: - Made henv a real global var. Seems to work basically when multithreaded - -1999-10-07 Sascha Schumann - - * sapi/aolserver/Makefile.am - sapi/aolserver/config.m4: nsapi => aolserver changes - -1999-10-07 Andrei Zmievski - - * NEWS: - Renaming ChangeLog to NEWS. All future entries intended for public should - go into NEWS. - -1999-10-07 Sascha Schumann - - * configure.in: - PHP_SHOW_LD_LIBRARY_PATH leaked out of my test environment. - -1999-10-07 Uwe Steinmann - - * ext/pdf/pdf.c - ext/pdf/php3_pdf.h: - - new functions pdf_get_font, pdf_get_fontsize, pdf_get_fontname - -1999-10-07 Andrei Zmievski - - * tests/testfunc: Test commit again. - - * tests/testfunc: Testing commit. - - * sapi/aolserver/.cvsignore - sapi/cgi/.cvsignore - sapi/isapi/.cvsignore - sapi/apache/.cvsignore - regex/.cvsignore - .cvsignore: Ignore generated files. - - * ext/db/db.c: Put PLS_FETCH() in the correct place. - - * ext/pcre/pcrelib/.cvsignore - ext/yp/.cvsignore - ext/zlib/.cvsignore - ext/sysvshm/.cvsignore - ext/wddx/.cvsignore - ext/sysvsem/.cvsignore - ext/sybase/.cvsignore - ext/sybase_ct/.cvsignore - ext/standard/.cvsignore - ext/session/.cvsignore - ext/snmp/.cvsignore - ext/pdf/.cvsignore - ext/pgsql/.cvsignore - ext/pcre/.cvsignore - ext/oracle/.cvsignore - ext/oci8/.cvsignore - ext/odbc/.cvsignore - ext/msql/.cvsignore - ext/mysql/.cvsignore - ext/mcrypt/.cvsignore - ext/mhash/.cvsignore - ext/mcal/.cvsignore - ext/interbase/.cvsignore - ext/ldap/.cvsignore - ext/imap/.cvsignore - ext/informix/.cvsignore - ext/icap/.cvsignore - ext/gettext/.cvsignore - ext/hyperwave/.cvsignore - ext/ftp/.cvsignore - ext/gd/.cvsignore - ext/fdf/.cvsignore - ext/filepro/.cvsignore - ext/dbase/.cvsignore - ext/db/.cvsignore - ext/dba/.cvsignore - ext/com/.cvsignore - ext/dav/.cvsignore - ext/bcmath/.cvsignore - ext/apache/.cvsignore - ext/aspell/.cvsignore - ext/ext_skel: Ignore generated files. - - * request_info.c: Fix for #2457. - -1999-10-07 Thies C. Arntzen - - * ext/db/db.c: fix ZTS compile - - * ext/xml/xml.c: fixed hopefully last XML problem. that one was hard! - -1999-10-07 Sascha Schumann - - * sapi/aolserver/aolserver.c (php_ns_request_handler): call ts_free_thread() to clean up - -1999-10-07 Thies C. Arntzen - - * ext/db/db.c: compiles again - and gets compiled - -1999-10-07 Sascha Schumann - - * configure.in: - Pass -avoid-version when building a shared library to avoid problems - with "installing" symbolic links. We need to do this conditional, since - some libtool versions imply --disable-static with this option. - -1999-10-07 Thies C. Arntzen - - * php_content_types.c: - SET_VAR_STR* expect a emalloc'ed copy of the string! - -1999-10-06 Sascha Schumann - - * patch-aa - buildconf: - Enable hardcoding runpaths for more platforms and allow Solaris' patch to run - buildconf. - - * buildconf: Ignore already applied patches. - - If somebody could make this work on Solaris, I'd appreciate it. - - * buildconf - patch-aa - patch-ab - patch-ltmain.sh: - Allow *.a and *.o as libtool objects, and hardcode runpaths into - shared libraries. - - (Both taken from FreeBSD's libtool port.) - -1999-10-06 Andrei Zmievski - - * ext/standard/rand.c - ext/standard/php_rand.h: - Move random functions related defines into its own header file. - -1999-10-06 Thies C. Arntzen - - * ChangeLog: *** empty log message *** - -1999-10-06 Sascha Schumann - - * ext/informix/Makefile.am: - Fix "make clean". automake does not define an extra target for clean. - - * patch-ltmain.sh: - unidiff isn't widely recognized, change to context format. - - * ext/pgsql/pgsql.c - ChangeLog: Fixed pg_fetch_array() with three arguments. - - Submitted by: brian@soda.berkeley.edu - -1999-10-06 Thies C. Arntzen - - * ext/standard/basic_functions.c - ChangeLog: - replaced most getParamters against getParamtersEx calls - - removed ParamterPassedByReference where appropiate - -1999-10-06 Sascha Schumann - - * buildconf: * --copy always, since we need to change ltmain.sh - * make patch on some obscure UNIX happy - -1999-10-06 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - fixed some memory leaks - - * ChangeLog: - as always forgot the Changelog entry - - * SAPI.c - ext/standard/post.c: - - support for mimetype application/vnd.fdf needed by fdf module - (only active if fdf support is compiled in) - - * ext/fdf/config.m4 - ext/fdf/fdf.c: - fix to work with new version of FdfTk - -1999-10-05 Sascha Schumann - - * Makefile.am: - FreeBSD's libtool port seems to contain a bug which is triggered by - -avoid-version. Removing it, since we don't absolutely need this option. - - * buildconf - patch-ltmain.sh: Apply patch automatically at buildconf time - - * ext/standard/dir.c: Fix typo (xml_globals => dir_globals) - -1999-10-05 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ChangeLog: - use reference counting for emulating child<->parent (cursor<->connection) relationships. - - * ext/standard/dir.c - ext/standard/php3_dir.h - ChangeLog: dir modules is now resourcified & thread-safe! - -1999-10-05 Sascha Schumann - - * genfiles - makedist: Generate files for distribution (also adds parsedate.c) - - * sapi/apache/config.m4: Fix typo. - - * sapi/apache/config.m4: - Get rid of *_SHLIB variables. Our config scripts don't need Perl, - unfortunately the "apxs" utility does. Someone slap the creator of apxs. - -1999-10-05 Andrei Zmievski - - * ext/wddx/wddx.c: Remove _A. - -1999-10-05 Sascha Schumann - - * Makefile.am: Fix automake dependencies - -1999-10-05 Thies C. Arntzen - - * ChangeLog: *** empty log message *** - - * ext/oracle/oracle.c: fixed ora_close again - - * ext/standard/basic_functions.c: fix some warnings - -1999-10-05 Sascha Schumann - - * SAPI.c: Fix logic. - - * ext/msql/Makefile.am: Use libtool - - * buildconf: automake does not find all subdirectories automatically. - - * regex/.cvsignore - regex/regex.h - .cvsignore - Makefile.am: * Get rid of libphp_util.la - * Don't build CGI from convenience library - * Add additional checks to regex.h (Apache build broke) - - * buildconf: 100% speedup in buildconf. - We have a top-level Makefile.am, so find becomes superflicious - - * configure.in: Build program static. - -1999-10-05 Marko Karppinen - - * regex/regex.h: Fix a typo? (compile bustage on Solaris 2.6) - -1999-10-04 Andrei Zmievski - - * ext/standard/basic_functions.h - ext/standard/basic_functions.c - ChangeLog: Taken from PHP3 source. - - * tests/testobj: *** empty log message *** - - * tests/testobj - tests/testfunc - tests/testarray: test - -1999-10-04 Sascha Schumann - - * configure.in: -module is already set in Makefile.am - -1999-10-04 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added delete and rename functions. - -1999-10-04 Sascha Schumann - - * sapi/README - ChangeLog - SAPI.c - configure.in: * Fix header("HTTP/..") behaviour - * Fix leak WRT http_status_line - * Update sapi/README - * Remove %PHP_OUTPUT_FILES sort - - * Makefile.am: Move %(EXTRA_LIBS). - - * php.sym: The .sym format isn't that complex. - - * sapi/aolserver/Makefile.am - sapi/aolserver/Makefile.inc - sapi/aolserver/config.m4 - sapi/nsapi/Makefile.am - sapi/nsapi/Makefile.inc - sapi/nsapi/config.m4 - sapi/apache/Makefile.inc - sapi/apache/apache.c - sapi/apache/config.m4 - sapi/apache/libphp4.module.in - sapi/apache/mod_php4.c - sapi/apache/sapi_apache.c - sapi/cgi/Makefile.am - sapi/cgi/Makefile.inc - sapi/isapi/Makefile.inc - sapi/Makefile.am - sapi/README - sapi/apache/Makefile.am - ext/zlib/Makefile.am - regex/Makefile.am - regex/Makefile.in - ext/xml/Makefile.am - ext/xml/config.m4 - ext/xml/xml.c - ext/yp/Makefile.am - ext/sysvshm/Makefile.am - ext/wddx/Makefile.am - ext/sybase_ct/Makefile.am - ext/sysvsem/Makefile.am - ext/standard/Makefile.am - ext/standard/info.c - ext/sybase/Makefile.am - ext/session/Makefile.am - ext/snmp/Makefile.am - ext/pdf/Makefile.am - ext/pgsql/Makefile.am - ext/pgsql/config.m4 - ext/pcre/config.m4 - ext/pcre/pcrelib/Makefile.am - ext/oracle/Makefile.am - ext/pcre/Makefile.am - ext/mysql/php_mysql.h - ext/oci8/Makefile.am - ext/odbc/Makefile.am - ext/mhash/Makefile.am - ext/mysql/Makefile.am - ext/mysql/config.m4 - ext/mysql/php_mysql.c - ext/mcal/Makefile.am - ext/mcrypt/Makefile.am - ext/interbase/Makefile.am - ext/ldap/Makefile.am - ext/imap/Makefile.am - ext/informix/Makefile.am - ext/hyperwave/Makefile.am - ext/icap/Makefile.am - ext/gd/Makefile.am - ext/gd/config.m4 - ext/gettext/Makefile.am - ext/filepro/Makefile.am - ext/ftp/Makefile.am - ext/dbase/Makefile.am - ext/fdf/Makefile.am - ext/db/Makefile.am - ext/dba/Makefile.am - ext/bcmath/Makefile.am - ext/dav/Makefile.am - ext/apache/Makefile.am - ext/apache/config.m4 - ext/aspell/Makefile.am - ext/Makefile.am - ext/ext_skel - Makefile.in - acinclude.m4 - buildconf - configure.in - install-sh - php.map - php.sym - stub.c - Makefile.am - .cvsignore: - * archive-based convenience libraries completely replaced - with libtool components - - * SAPI targets can enable thread-safe mode and define - shared/static/program build target - - * all configure scripts use the same config.cache - - * phplibdir is $(top_builddir)/modules to avoid - permission problems - - * sapi/*/Makefile.inc are gone - - * runpath handling cleaned up - - * top-level Makefile.in obsoleted through Makefile.am - - * --enable-versioning uses libtool's cleaner and more - portable -export-symbols feature - - * sapi/aolserver/aolserver.c - sapi/nsapi/aolserver.c: Polish this. - -1999-10-04 Thies C. Arntzen - - * ChangeLog: upgraded the former basic_functions.c code to use new API. - - * ext/standard/reg.c - ChangeLog: - ereg now returns a continious array 0..9 again - empty values are returned as false. - i think this is *more* compatible with PHP3 - unless anybody really dislikes it i'd prefer it like this. - - * main.c: i swear, i compiled (at least) before i committed! - -1999-10-04 Sascha Schumann - - * sapi/apache/Makefile.inc: - Object files are usually not found in the srcdir. - -1999-10-04 Thies C. Arntzen - - * main.c: - "cc -32" on IRIX 6.4 does not like (PHP_TRACK_VARS?"1":"0") - at least not if PHP_TRACK_VARS is 0. - -1999-10-04 Sascha Schumann - - * acinclude.m4: - Fix typo. This caused strange errors when using --with-apxs. - -1999-10-03 Andi Gutmans - - * ChangeLog: - Update changelog - -1999-10-03 Sascha Schumann - - * configure.in: *_config are executable, thus we don't need %(SHELL) - - * configure.in: Fix Apache-module build - -1999-10-02 Andrei Zmievski - - * tests/testobj - tests/testarray2 - tests/testarray - tests/testfe - tests/testfunc: test commit - - * tests/testfunc: commit test - - * tests/testfunc: test - - * tests/testfunc: test commit - - * tests/testfunc: test commit 1 - - * tests/testfunc: test commit - -1999-10-02 Sascha Schumann - - * sapi/apache/Makefile.inc: - Use the already compiled `mod_php4.o'. This avoids the trouble - apxs has with VPATH builds (assumes source dir = build dir). - -1999-10-01 Andi Gutmans - - * ChangeLog - php4dllts.dsp: - I forgot this - -1999-10-01 Andrei Zmievski - - * ChangeLog - ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_reverse() function. - - * ext/standard/info.c - ext/wddx/php_wddx.h - ext/wddx/php_wddx_api.h - ext/wddx/wddx.c - ext/session/session.c - ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: rename. - -1999-10-01 Thies C. Arntzen - - * ext/xml/xml.c - ChangeLog: one zval fix - cleanups - -1999-09-30 Andrei Zmievski - - * ChangeLog: test commit - - * ChangeLog - ext/pcre/php_pcre.c: - preg_replace() now makes copies of array entries if arrays are passed in, - so that convert_to_string() preserves the originals. Is this the correct way to do it? - -1999-09-30 Sascha Schumann - - * ext/gd/config.m4: Fix typo--GD_* is for shared build mode. - -1999-09-30 Andrei Zmievski - - * ext/standard/string.c: Fix nl2br crash. - -1999-09-30 Sascha Schumann - - * ChangeLog: Test commit II. - -1999-09-30 Andrei Zmievski - - * setup: No need for this anymore. - -1999-09-30 Sascha Schumann - - * ChangeLog: Test commit. - - * configure.in - sapi/apache/config.m4: - Automatically add the SAPI target's Makefile to the list. This - frees us from doing this in each config.m4. - -1999-09-30 Thies C. Arntzen - - * ChangeLog - ext/oci8/oci8.c - ext/oci8/php3_oci8.h: - major rework here - the refcount stuff gets better and better! - -1999-09-29 Sascha Schumann - - * configure.in - ext/pcre/config.m4 - sapi/apache/config.m4: * create Makefiles for ext, pcrelib, sapi/* - * copy files for Apache from $(srcdir) - - * buildconf - configure.in: * VPATH work - * add "--local" switch to buildconf which only recrates the local - autoconf scripts. - -1999-09-29 Charles Hagenbuch - - * ext/imap/imap.c: cjh: closing bug #2407. - -1999-09-29 Thies C. Arntzen - - * ext/xml/xml.c: fix the order.. (thanx, andi) - -1999-09-29 Sascha Schumann - - * sapi/apache/Makefile.inc: Fix a VPATH issue. - -1999-09-29 Stig Bakken - - * scripts/preconfig - sapi/apache/Makefile.am - sapi/apache/Makefile.inc - sapi/apache/apache.c - sapi/apache/config.m4 - sapi/apache/libphp4.module.in - sapi/apache/mod_php4.c - Makefile.in - acconfig.h.in - acinclude.m4 - buildconf - configure.in - configure.in.in - libphp4.module.in - sapi/apache/.cvsignore - .cvsignore: - Decent configure speedup. Makefiles are now generated only for the - extensions you are including. Got rid of configure.in.in. - Moved the last Apache-specific files into sapi/apache and made both - static and DSO build work again (it still doesn't run properly). - - * ext/gd/config.m4: - The $shared variable should normally never be used outside of a call to - AC_ARG_(ENABLE|WITH). If it is necessary anyway, make sure it is set to - "no" before starting. - -1999-09-29 Andrei Zmievski - - * ext/standard/url.c: Fix for my fix. - -1999-09-29 Thies C. Arntzen - - * ChangeLog - ext/oci8/oci8.c - ext/oci8/php3_oci8.h: fixed crash in connection shutdown! - - * ext/oci8/oci8.c: just some renaming. - -1999-09-28 Andi Gutmans - - * tests/testfunc2 - ext/standard/string.c: - Get rid of warning - -1999-09-28 Stig Bakken - - * sapi/isapi/config.m4: disable --with-zeus for now. - - * sapi/isapi/config.m4 - sapi/isapi/php4isapi.c - INSTALL - acconfig.h.in: - Started working on the Zeus support. Zeus's ISAPI obviously differs from - Windows's, does someone have docs for the Windows API? - -1999-09-28 Thies C. Arntzen - - * ext/oci8/oci8.c: initialize OCI in threaded mode if ZTS is defined. - - * ext/oracle/oracle.c: init in thread-safe mode if ZTS isdefined - - * ext/oracle/oracle.c: fixed startup-deadlock. - - * ext/xml/config.m4: found a typo! - -1999-09-27 Andi Gutmans - - * php4ts.dsp: - Update project. - -1999-09-27 Sascha Schumann - - * ext/standard/string.c: Make an extra copy of input parameter. - - * Makefile.in - sapi/aolserver/Makefile.inc - sapi/nsapi/Makefile.inc: * include from $(srcdir) - * use proper target for nsapi - - * configure.in.in: - Create directories, if they do not exist (for VPATH builds). - -1999-09-27 Stig Bakken - - * sapi/README: added README file with very brief docs - - * sapi/aolserver/.cvsignore - sapi/aolserver/Makefile.am - sapi/aolserver/Makefile.inc - sapi/aolserver/aolserver.c - sapi/aolserver/config.m4 - sapi/cgi/.cvsignore - sapi/cgi/Makefile.am - sapi/cgi/Makefile.inc - sapi/cgi/cgi_main.c - sapi/cgi/config.h.in - sapi/cgi/config.m4 - sapi/isapi/.cvsignore - sapi/isapi/Makefile.am - sapi/isapi/Makefile.inc - sapi/isapi/config.m4 - sapi/isapi/php4isapi.c - sapi/isapi/php4isapi.def - sapi/isapi/php4isapi.dsp - sapi/nsapi/.cvsignore - sapi/nsapi/Makefile.am - sapi/nsapi/Makefile.inc - sapi/nsapi/aolserver.c - sapi/nsapi/config.m4 - scripts/config-stubs - scripts/preconfig - Makefile.in - aolserver.c - cgi_main.c - configure.in.in - ext/apache/apache.c - header - main.c - mod_php4.c - mod_php4.exp - mod_php4.h - sapi/.cvsignore - sapi/Makefile.am - sapi/apache/.cvsignore - sapi/apache/Makefile.am - sapi/apache/Makefile.inc - sapi/apache/config.h.stub - sapi/apache/config.m4 - sapi/apache/mod_php4.c - sapi/apache/mod_php4.exp - sapi/apache/mod_php4.h - ChangeLog: Generalized server-API build process on UNIX. Each SAPI - implementation now has its own directory under sapi/, just like - extensions have theirs under ext/. To make the final targets appear - in the main dir, the top-level Makefile includes sapi/NN/Makefile.inc - from the selected sapi backend. This is a plan Makefile stub without - any autoconf substitutions. Each SAPI backend also has its own - config.m4 like extensions (read at the end of diversion 2) and - config.h.stub files. - - Each SAPI backend has to contain: - - config.m4: just like for extensions, this file contains - autoconf/automake 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 SAPI_TARGET - (the name of the resulting library or program, previously BINNAME). - If they are not specified, they will default to "cgi" and "php", - respectively. - - Makefile.inc: has to exist, has to define "INSTALL_IT" to the command - used to install the final target (or ":" for no operation). It also - has to define a plain Makefile rule (without autoconf substitutions) - to build $(SAPI_TARGET) - - Makefile.am: just what you think. Make sure your target is called - "libphpsapi_NNN.a", where NNN is the value of PHP_SAPI. - - Some testing and fixing probably remains. To make everything hang - together, I've done some ugly tricks that I can imagine causing some - problems. I've built and run the CGI version and built the Apache - DSO. - -1999-09-27 Andrei Zmievski - - * ext/standard/url.c: - Fix for bug #2199. Redirect was returning http:// which resulted in a crash. - - * ext/ext_skel: I will follow portability guidelines. - I will follow portability guidelines. - I will follow portability guidelines. - I will follow... - -1999-09-27 Andrew Skalski - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added functions ftp_{pasv,size,mdtm,fget,fput} - PASV mode is now supported; file size and last-modified time can now - be fetched from servers that support them; files now may be stored to and - retrieved from open files, in addition to disk files. - -1999-09-27 Andrei Zmievski - - * ext/ext_skel: Make it portable. - -1999-09-27 Stig Bakken - - * acinclude.m4: added AC_SYS_LFS from fileutils - -1999-09-26 Sascha Schumann - - * configure.in.in - Makefile.in: - Now thread safe version builds out of the box. libzend/TSRM - contain extra config scripts which pass the necessary libs back - to our Makefile. - - * configure.in.in - Makefile.in: Use new tsrm_config script to determine libraries. - -1999-09-26 Stig Bakken - - * configure.in.in: - Have to keep using AM_PROG_LIBTOOL to keep all automake versions happy. - -1999-09-26 Sascha Schumann - - * acinclude.m4: - Avoid specifying standard paths. This might result in compiler problems - (see #1937, #2367) - - * ext/gd/config.m4: - Expand relative paths properly, otherwise build process will fail. - - * acinclude.m4: Do nothing, if PHP_RPATHS is empty. - - * ChangeLog - acinclude.m4 - configure.in.in: Disable rpaths optionally. - -1999-09-25 Sascha Schumann - - * ChangeLog - aolserver.c: * Use per-thread structure for request data - * Update ChangeLog - - * ext/session/session.c: Do not try to free NULLs. - - * aolserver.c: * use faster Ns_ConnWrite() - * access cookies correctly - * set HTTP_* variables for script - - * aolserver.c: * cleanup - * make cookies work - -1999-09-25 Thies C. Arntzen - - * ChangeLog - ext/xml/xml.c: - fixed callback code -> now $parser is passed as a resource! - -1999-09-25 Sascha Schumann - - * aolserver.c: * use consistent php_ns prefix - * improve configuration code - * shutdown SAPI/TSRM correctly - - * ext/standard/info.c: Add entry for AOLserver. - - * aolserver.c: * remove debugging message - * use SAPI's http response code - * improve POST read (still blocks in Ns_ConnRead, even if there is enough - data to read) - * improve config data handling - - * ext/standard/dns.c - ext/standard/mail.c - ext/standard/rand.c - ext/standard/soundex.c - ext/standard/syslog.c: New Zend API - - * ext/standard/string.c: Use new Zend API - -1999-09-25 Andreas Karajannis - - * ext/odbc/php_odbc.c: odbc now uses the new Zend function api - -1999-09-25 Stefan Roehrich - - * ChangeLog - ext/zlib/zlib.c: Use new Zend API. - -1999-09-25 Sascha Schumann - - * aolserver.c: - support POST and HEAD requests - - clean up module_main() - - allow arbitrary mappings - - * Makefile.in - acconfig.h.in - aolserver.c - configure.in.in: - Initial AOLserver support. Note that the current way of creating - the shared library works only with GNU utilities. Some features - have to be added yet (i.e. POST and cookie support). - -1999-09-24 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ChangeLog: - Updated array functions to use high-performance API - - Updated preg_split() to allow returning only non-empty pieces - - * ext/pcre/php_pcre.c - ChangeLog: Update to new high-performance function API. - -1999-09-24 Sascha Schumann - - * ext/standard/base64.c - ext/standard/crypt.c - ext/standard/link.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/uniqid.c - ext/standard/url.c: Use new Zend API. - - * ext/gettext/gettext.c - ChangeLog - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/sysvshm.c: Use new Zend API and some minor cleanup. - -1999-09-24 Andrei Zmievski - - * ext/standard/var.c: Extended var_dump to handle IS_RESOURCE somewhat. - - * ext/wddx/wddx.c - ChangeLog: Update WDDX for new high-performance function API. - -1999-09-24 Thies C. Arntzen - - * ChangeLog: we want to know who to "blame";-) - - * ChangeLog - ext/standard/info.c - ext/xml/xml.c: updated XML (only partly tested) - -1999-09-24 Stig Bakken - - * ext/xml/Makefile.am - ext/xml/config.m4: more high-tech shared building - - * ext/standard/string.c: kill another warning - - * ext/standard/parsedate.y: kill warning - - * configure.in.in: - set "phplibdir" in configure so it doesn't have to be set in Makefile.am - -1999-09-24 Thies C. Arntzen - - * ChangeLog - ext/oracle/oracle.c: use getParameterEx - -1999-09-24 Stig Bakken - - * strlcat.c - strlcpy.c: - * configure.in.in: - AM_PROG_LIBTOOL is obsolete in libtool 1.3.3, which we now require. - Using AC_PROG_LIBTOOL instead. - - * buildconf: - Detect automake/libtool that are installed with different prefixes. - -1999-09-24 Thies C. Arntzen - - * ext/xml/xml.c: fixed warning - -1999-09-24 Zeev Suraski - - * ext/wddx/wddx.c - ext/xml/xml.c - ext/zlib/zlib.c: Compile fixes for WDDX, XML and Zlib (untested) - - * ext/sybase_ct/php_sybase_ct.c: - This should make the Sybase CT module compile again (untested) - - * ext/msql/php_msql.c: - This should make the mSQL module compile again (untested) - - * ext/mysql/php_mysql.c - ChangeLog: - Ok guys, the prototype for zend_fetch_resource*() has changed - it now - accepts a zval ** instead of a zval *, to be suitable for use with the - getParametersEx() API. - You don't have to switch to the getParametersEx() API, but you will have to - go over your code and add &'s where it's applicable (of course, if you have - the mental strength to go over your code and convert it to use the Ex API, - it's best). - - The MySQL module now uses the getParametersEx() API completely. - -1999-09-23 Sascha Schumann - - * Makefile.in: Link with libtsrm.a, if thread-safety is chosen. - - * configure.in.in: Exit, if subsequent configure scripts fail. - -1999-09-23 Andrew Skalski - - * ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: fixed php3 code problem - -1999-09-23 Andrei Zmievski - - * ext/pcre/config.m4: Small clarification. - -1999-09-23 Sascha Schumann - - * ext/standard/url_scanner.c: - This version is finally the standard one. The last one was created - using the 'nested ifs mode' which seems to be the source of the problem. - -1999-09-23 Nick Gorham - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/setup.stub - ChangeLog: - Added support for Easysoft ODBC-ODBC Bridge - Fixed bug in odbc_setoption - -1999-09-23 Andrew Skalski - - * ext/mcal/php3_mcal.c - ChangeLog: fixed typo in mcal_list_alarms() - -1999-09-23 Sascha Schumann - - * ext/standard/Makefile.am - ext/standard/url_scanner.c: - re2c's bit vectors appear to be not binary clean. Revert to - standard mode for the moment. - -1999-09-23 Thies C. Arntzen - - * ext/oracle/oracle.c: tiny optimisation - - * ChangeLog - ext/oracle/oracle.c: - Ora_Fetch_Into now resets the returned array in all cases - - * ext/oracle/oracle.c - ext/oracle/php3_oracle.h - ChangeLog: fixed NULL column - cleanups - -1999-09-22 Nick Gorham - - * ChangeLog: - Added odbc metadata update log - - * ext/odbc/php_odbc.h - ext/odbc/php_odbc.c: - Added support for metadata functions, odbc_tables, odbc_columns, - odbc_columnprivileges, odbc_foreignkeys, odbc_gettypeinfo, - odbc_primarykeys, odbc_procedurecolumns, odbc_procedures, - odbc_procedurecolumns, odbc_procedures, odbc_specialcolumns, - odbc_statistics, odbc_tableprivileges - -1999-09-22 Andrew Skalski - - * ChangeLog: mcal fix - - * ext/mcal/php3_mcal.c: added null-checking in make_event_object - - * ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Added optional port argument to ftp_connect() - -1999-09-22 Thies C. Arntzen - - * ext/oracle/oracle.c: i always forget something;-) - - * ext/oracle/oracle.c - ext/oracle/oracle_hack.c - ChangeLog: fixed Ora_PLogon (rewrote ora_do_logon using php_mysql.c) - oracle_hack.c should no longer be needed! - - * ChangeLog - ext/oracle/oracle.c: resourcified Oracle - -1999-09-22 Stefan Roehrich - - * ChangeLog: Added new allowable_tags for gzgetss() in ChangeLog, too. - - * ext/zlib/zlib.c: - Fixed gzgetss() with new _php3_strip_tags, corrected prototype. - -1999-09-22 Uwe Steinmann - - * ext/fdf/config.m4: - fixed misleading explaination of fdftk option - -1999-09-22 Andi Gutmans - - * ext/standard/lcg.c: - Get rid of warning on win32, non-threadsafe mode. - -1999-09-21 Andrew Skalski - - * ext/ftp/php_ftp.c: removed NULL reference - - * ext/ftp/ftp.c: - added missing "addr.sin_family = AF_INET" to socket routines - -1999-09-21 Andrei Zmievski - - * ext/wddx/wddx.c: - WDDX can now serialize and deserialize objects. It uses a variable named - 'php_classname' to store the class name as part of the structure. This way - WDDX modules in other languages don't get broken by extensions to DTD - we would have had to make otherwise. - -1999-09-21 Rasmus Lerdorf - - * ext/standard/config.m4: - Slightly redundant to check for crypt() here again, but the TRY_RUN stuff - needs it defined in the same m4 file or it won't work, and it will just - get pulled out of the cache anyway, so it isn't a big deal. - - * ext/standard/string.c - ext/zlib/zlib.c - ext/standard/file.c: fgetss/gzgetss fixes - -1999-09-21 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/string.c: A couple of fixes. - -1999-09-21 Sascha Schumann - - * ext/standard/config.m4: - AC_CRYPT_CAP depends on symbol checks performed later. - - * configure.in.in: - * Do not check explicitly for symbols in the C library (fixes #2339) - - * sort function checks - -1999-09-21 Thies C. Arntzen - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ChangeLog: added krsort() function - -1999-09-21 Sascha Schumann - - * ext/standard/Makefile.am: Continue, if re2c is not available. - - Using the ".new" suffix, we prevent the shell from zeroing the file. - - * ext/standard/microtime.c: Fix typo. - - catched by: ssb - - * configure.in.in: - Use install-sh (autoconf) script to install php. This automatically - creates the bindir path, so that the effect described in #2304 disappears. - - * ext/standard/microtime.c: - On at least Win32, gettimeofday() returns values in tv_usec which exceed - 1,000,000. - - For portability reasons we set the integer part of our result to 0. - This is equivalent to using tv_usec % 1000000. - -1999-09-21 Rasmus Lerdorf - - * ext/zlib/zlib.c: woops - - * ext/zlib/zlib.c: Fix zlib compile problem - -1999-09-20 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: - - Move some more language specific functions over to Zend. - get_class() and friends. - -1999-09-20 Sascha Schumann - - * ext/standard/url_scanner.c: - Timestamp commit. I do consider removing the rule from Makefile.am - -1999-09-20 Egon Schmid - - * ext/standard/file.c - ext/standard/string.c: Here was also something missing. - -1999-09-20 Andrew Skalski - - * ChangeLog: added FTP module - -1999-09-20 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/php3_string.h - ext/standard/string.c - tests/testarray - php.h: - - Internal functions which are basic language functions should be in Zend - and not in PHP. I.e. strlen(), each(), error_reporting(), count(), - get_class_name(). - -1999-09-20 Rasmus Lerdorf - - * ext/standard/string.c - ChangeLog - ext/standard/file.c - ext/standard/php3_string.h: - Added optional allowable_tags arguments to strip_tags() and fgetss() to - allow you to specify a string of tags that are not to be stripped - - Could have used flex for this, and Andrew sent me a flex file to do this, - but I could do the same thing with only minor additions to the existing - state machine and the resulting code is much smaller and tighter. - -1999-09-20 Andrew Skalski - - * ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: php3 compatibility added - -1999-09-20 Andrei Zmievski - - * ext/standard/php3_var.h - ext/standard/var.c - ext/sysvshm/sysvshm.c - ext/session/session.c: - Upgraded var_dump() to take multiple arguments - - php3api_ is changed to php_ - -1999-09-20 Andrew Skalski - - * ext/ftp/Makefile.am - ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/ftplib.c - ext/ftp/ftplib.h - ext/ftp/php_ftp.c - ext/ftp/php_ftp.h: Replaced ftplib because of incompatible license. - -1999-09-20 Stig Bakken - - * ext/standard/uniqid.c: logic fix - -1999-09-20 Thies C. Arntzen - - * ChangeLog - ext/xml/php3_xml.h - ext/xml/xml.c: resource API & ZTS stuff - -1999-09-20 Zeev Suraski - - * ChangeLog - mod_php4.c: - Fixed a memory leak in the Apache per-directory directives handler - -1999-09-20 Thies C. Arntzen - - * ChangeLog - ext/standard/basic_functions.c - ext/standard/basic_functions.h: added array_count_values function. - - * ext/standard/var.c: new API for var_dump - -1999-09-18 Andi Gutmans - - * ext/mcal/php3_mcal.c: - Fix bug #2278 - - * serverapi/isapi_sapi.c - win32/readdir.c - php4dll.dsp - php4dllts.dsp: - Make Win32 compile again - -1999-09-18 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed prototype. - -1999-09-18 Sascha Schumann - - * ext/standard/url_scanner.re - ext/standard/url_scanner.c: Aline escape signs in macro definitions. - - * configure.in.in: - Pipe header names through sort and put only one on each line. This - makes them better accessible. - - Add stdlib.h to check headers. - - * alloca.c: - There is no reason to define malloc() to xmalloc() in this context. - -1999-09-17 Andrei Zmievski - - * ext/ftp/.cvsignore: Make CVS quiet. - -1999-09-17 Thies C. Arntzen - - * ext/standard/url_scanner.c - ext/standard/url_scanner.re: - SUN c89 doesn't like } direct after a label;-( - -1999-09-17 Gergely Madarász - - * ChangeLog: note the shared modules in the changelog - -1999-09-17 Sascha Schumann - - * ext/dba/dba_db2.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c - ext/dba/php3_dba.h - ext/dba/dba.c: Convert to Ex API. Does anyone have a better name for it? - - * ext/mcrypt/mcrypt.c - ext/mhash/mhash.c: Use Ex API here as well. - - * ext/session/session.c: Convert module to use Ex API. - -1999-09-17 Thies C. Arntzen - - * ext/oci8/oci8.c - ChangeLog: fix #2316 - fetching empty LOBs via OCI8 - -1999-09-17 Sascha Schumann - - * ext/session/mod_user.c: don't call empty function names - - * ext/session/Makefile.am - ext/session/mod_user.c - ext/session/mod_user.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ChangeLog: add user-level callbacks - -1999-09-17 Zeev Suraski - - * php4dllts.dsp: *** empty log message *** - -1999-09-17 Sascha Schumann - - * configure.in.in - ext/xml/config.m4: supply path to xml include dir for APXS and APACI - - * ext/wddx/php_wddx.h: This format is also used by the XML module - allows us to compile with Apache's expat-lite dir - - * main.c: `0' flag ignored with precision specifier and `X' format - - * ext/xml/config.m4: If available, use Apache's embedded expat - - * Makefile.in: fix Unix build - -1999-09-16 Zeev Suraski - - * ChangeLog.TODO - SAPI.c - SAPI.h - cgi_main.c - config.w32.h - ext/standard/string.c - main.c - mod_php4.c - php4dll.dsp - php4dllts.dsp - php4isapi/php4isapi.c - php_content_types.c - rfc1867.c - ChangeLog: - Added support for unknown POST content types (Zeev) - - Introduce the convert_to_*_ex() API in strlen() - - * Makefile.in - php_content_types.h: *** empty log message *** - - * ext/standard/info.c - Makefile.in - php_content_types.c: Generalize SAPI a bit - -1999-09-16 Andrei Zmievski - - * ext/session/session.c: Fixed memory leak. - -1999-09-16 Andrew Skalski - - * ext/ftp/ftp.c: Added documentation hooks to ftp.c - - * ext/ftp/ftp.c - ext/ftp/ftp.h: added ftp_pwd() ftp_cdup() ftp_mkdir() and ftp_rmdir() - - * ext/ftp/ftp.c - ext/ftp/ftp.h: added ftp_systype() and ftp_listraw() functions - - * ext/ftp/Makefile.am - ext/ftp/config.h.stub - ext/ftp/config.m4 - ext/ftp/ftp.c - ext/ftp/ftp.h - ext/ftp/ftplib.c - ext/ftp/ftplib.h: Added rudimentary FTP support. - -1999-09-16 Sascha Schumann - - * ext/odbc/config.m4 - ext/pcre/config.m4 - ext/session/session.c - ext/imap/config.m4 - ext/gd/config.m4 - configure.in.in: improve short help messages - - * configure.in.in: this was twice here - -1999-09-16 Rasmus Lerdorf - - * buildconf: libtool check fix - -1999-09-16 Sascha Schumann - - * INSTALL: . - - * ext/wddx/php_wddx_api.h - ext/wddx/wddx.c: - Make some things accessible from outside for session module - - * ChangeLog: . - - * ext/session/php_session.h - ext/session/session.c: wddx decode works as well - - * ext/session/php_session.h - ext/session/session.c: wddx serialization works now - - * ext/session/session.c: Since Thies fixed var.c, objects work now, too. - - * configure.in.in: - use AM_PROG_CC_STDC which covers AIX, Ultrix, OSF/1, HP-UX, and SVR4 - - * acinclude.m4 - configure.in.in: silence libtool - -1999-09-16 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: php4 now deserialized php3 objects correctly! - php3 will ignore objects serialized by php4 (that's the price we have to pay!) - small fix in deserializing objects with static initializers (thanx boris) - -1999-09-15 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: when unserializing classes: - if the class is not known the standard class (no methods) will be used. - if the class is known - the created object will functional again! - -1999-09-15 Andrei Zmievski - - * ext/standard/var.c: Fixed printf format. - - * ext/wddx/wddx.c: HASH_OF is now in php.h. - -1999-09-15 Thies C. Arntzen - - * ext/standard/var.c - ChangeLog: use new API in var.c - - * ext/standard/var.c: i love id-strings - - * ext/standard/var.c - ChangeLog: - made serialize/unserialize work with classes! (also made the code "shorter") - CHANGES: - - the serialized string now also contains the class name (was not available in PHP3)! - - when unserializing php will create a fully working object of that class again - therby the class has to be defined when unserializing - else you get a warning! - -1999-09-15 Stig Bakken - - * Makefile.in: add LIBOBJS, used by AC_REPLACE_FUNCS - -1999-09-15 Thies C. Arntzen - - * ext/standard/basic_functions.c - php.h: - HASH_OF is usable enough (i hate duplicating macros all over the place) - -1999-09-15 Stig Bakken - - * configure.in.in - php.h - Makefile.in: Clean up the strlcat/strlcpy checks. - -1999-09-15 Andi Gutmans - - * regex/regerror.c: - Leave this for now. - - * ext/zlib/zlib.c - regex/regerror.c - ext/hyperwave/hw.c - ext/standard/file.c - php4dll.dsp: - Thread-unsafe win32 compiles again - - Some strlcpy changes including one bug fix. - - * ext/standard/microtime.h - ext/standard/basic_functions.c: - gettimeofday wasn't registered. - -1999-09-14 Andi Gutmans - - * ext/apache/apache.c: - Another small one. I'll leave the rest for now... - - * fopen-wrappers.c: - First go at using strlcat(). - - * config.w32.h - php4dllts.dsp: - Support strlcpy/strlcat in windows. - -1999-09-14 Andrei Zmievski - - * ChangeLog - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcrelib/ChangeLog - ext/pcre/pcrelib/README - ext/pcre/pcrelib/chartables.c - ext/pcre/pcrelib/dftables.c - ext/pcre/pcrelib/dll.mk - ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/maketables.c - ext/pcre/pcrelib/pcre.3 - ext/pcre/pcrelib/pcre.3.html - ext/pcre/pcrelib/pcre.3.txt - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.def - ext/pcre/pcrelib/pcre.h - ext/pcre/pcrelib/pcreposix.3 - ext/pcre/pcrelib/pcreposix.3.html - ext/pcre/pcrelib/pcreposix.3.txt - ext/pcre/pcrelib/pcreposix.c - ext/pcre/pcrelib/pcretest.c - ext/pcre/pcrelib/pgrep.1 - ext/pcre/pcrelib/pgrep.1.html - ext/pcre/pcrelib/pgrep.1.txt - ext/pcre/pcrelib/pgrep.c - ext/pcre/pcrelib/testinput1 - ext/pcre/pcrelib/testinput2 - ext/pcre/pcrelib/testinput3 - ext/pcre/pcrelib/testoutput1 - ext/pcre/pcrelib/testoutput2 - ext/pcre/pcrelib/testoutput3 - ext/pcre/pcrelib/testoutput4 - ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: - Updated bundled PCRE library to version 2.08 - - Made it possible to specify external location of the PCRE library - - Reworked PCRE extension to use updated PCRE library API - - Hopefully now everything behaves just like Perl.. - -1999-09-14 Andi Gutmans - - * Makefile.in - configure.in.in - php.h - strlcat.c - strlcpy.c: Add strlcpy/strlcat to the build process - -1999-09-14 Uwe Steinmann - - * ext/pdf/pdf.c: - - fixed memory leaks in pdf_open_memory_image() and pdf_add_bookmark() - -1999-09-14 Thies C. Arntzen - - * ChangeLog: forgot - - * ext/standard/basic_functions.c: is_array & friens speedups - -1999-09-14 Rasmus Lerdorf - - * ext/standard/basic_functions.c: Fix a warning - -1999-09-14 Thies C. Arntzen - - * ChangeLog - ext/standard/basic_functions.c: - count() now uses the new getParamertersEx API. - - * SAPI.c: i'm sure this was left-over debugging code! - - * ext/oci8/oci8.c - ChangeLog: you can now position when doing lob-writes. - -1999-09-13 Andi Gutmans - - * output.c - SAPI.h: - X-* is probably more standard. - -1999-09-13 Stig Bakken - - * ext/mhash/config.m4 - ext/mysql/config.m4 - ext/oci8/config.m4 - ext/yp/config.m4 - acinclude.m4 - configure.in.in - ext/bcmath/config.m4 - ext/gettext/config.m4 - ext/icap/config.m4 - ext/mcal/config.m4: - Added PHP_WITH_SHARED for checking "shared,*" prefix when configuring - extensions. - -1999-09-13 Thies C. Arntzen - - * ChangeLog - ext/standard/Makefile.am - ext/standard/metaphone.c - ext/standard/php_metaphone.h - internal_functions.c.in: added Metaphone support - - * ext/oci8/php3_oci8.h - ChangeLog - ext/oci8/oci8.c: - got rid of the define-callback stuff there's a bug in oracle-oci8! - -1999-09-13 Andrei Zmievski - - * ext/oci8/config.m4: Per Stig's suggestion. - -1999-09-13 Thies C. Arntzen - - * ext/oci8/oci8.c: ported $lob->savefile($filename) method from PHP3 - - * ext/oci8/oci8.c: cleanups - - * ChangeLog - ext/oci8/oci8.c - ext/standard/var.c: ported oci8 to use new class API - var_dump no longer tries to traverse avr->value.ht for objects but uses var->value.obj.properties instead - -1999-09-13 Zeev Suraski - - * ext/standard/info.c: - Modified phpinfo() to show the contents of arrays in HTTP_*_VARS[] - - * ext/standard/info.c - ext/standard/post.c - mod_php4.c: - Fix a buglet, and avoid crashing in phpinfo() (fixes an elusive legacy bug too) - -1999-09-12 Zeev Suraski - - * ChangeLog - ext/standard/post.c - ext/standard/post.h - rfc1867.c: - - Rewrote the GET/POST/Cookie data reader to support multi-dimensional - arrays! (Zeev) - - This still needs a lot of more testing, but it seems to work more or less. - - * SAPI.h - php4isapi/php4isapi.c: Add PHP-Version header in IIS - - * ext/standard/file.c - mod_php4.c - php_globals.h - main.c: That's important enough to be cached - -1999-09-12 Sascha Schumann - - * ext/standard/Makefile.am - ext/standard/url_scanner.c - ext/standard/url_scanner.re: - use static buffer for URLs instead of allocating/freeing memory - for each one - - * ext/session/session.c: calculate length of cookie string correctly - - * acinclude.m4: add missing result msg - - * output.c: - move session URL stuff to the last place before SAPI takes over - - * ChangeLog: These shouldn't be here - -1999-09-12 Andi Gutmans - - * ext/session/session.c: - Oops - - * ext/session/session.c: - Make it compile on Win32 - -1999-09-12 Zeev Suraski - - * cgi_main.c - ext/standard/basic_functions.c - main.c - output.c - output.h - php.h: Time to do that - rename the output layer prefix - - * ChangeLog - mod_php4.c - output.c: *** empty log message *** - -1999-09-12 Sascha Schumann - - * INSTALL: expand version number - - * ChangeLog: update - -1999-09-12 Andrei Zmievski - - * output.c: Reverting to previous state. - -1999-09-12 Sascha Schumann - - * ext/session/php_session.h: update macro - -1999-09-12 Andrei Zmievski - - * ext/session/session.c: Use global symbol table instead.. - - * output.c: Use TRANS_SID macro for selective compilation.. - - * ChangeLog - ext/wddx/wddx.c: - - Fixed mem leak when undefined variable was passed in for serialization - - Made it properly serialize object properties - -1999-09-12 Sascha Schumann - - * ext/standard/Makefile.am: add rule for url_scanner.c - -1999-09-11 Sascha Schumann - - * ext/standard/url_scanner.c - ext/standard/url_scanner.h - ext/standard/url_scanner.re: - add standard disclaimer - - regenerate scanner with re2c -s - - * ext/session/config.h.stub - ext/session/config.m4 - ext/session/php_session.h - ext/session/session.c - ext/standard/Makefile.am - ext/standard/url_scanner.c - ext/standard/url_scanner.h - ext/standard/url_scanner.re - output.c: add transparent session id propagation - this uses a custom scanner which detects relative URIs and changes - them appropiately. - must be explicitly enabled with --enable-trans-sid - (normal case is not affected, since session_adapt_uris defaults to - void statement. Compiler should eliminate dead code in output.c then.) - -1999-09-11 Andrei Zmievski - - * ChangeLog - ext/session/php_session.h - ext/session/session.c: - Added session_unset() function - - Fixed double session globals shutdown crash - - Added warning when session_destroy() is called without session_start() - - * ChangeLog - main.c: Use OnUpdateBool for Boolean entries. - -1999-09-11 Sascha Schumann - - * ext/standard/file.c: avoid mmap overhead for small files - - * configure.in.in - ext/standard/file.c: - optimize fpassthru/readfile to use mmap instead of fread - which especially increases speed on large files. - - * ChangeLog - ext/session/mod_files.c - ext/session/php_session.h - ext/session/session.c: - support for external entropy sources - - extern_referer_chk => extern_referer_check - - kill a warning in mod_files.c - -1999-09-11 Zeev Suraski - - * ext/standard/info.c - main.c - php.ini-dist: Rename allow_builtin_links to expose_php - - * main.c: More cleanup - - * ext/standard/post.c: Except for this small bug fix - it works - - * ChangeLog - ext/standard/post.c - main.c - php.ini-dist - php_globals.h: - Seriously optimize and clean php_parse_gpc_data() - - Added gpc_globals directive to turn global definitions of GPC variables on/off - (untested) - - * cgi_main.c - ext/standard/post.c - ext/standard/post.h - ext/standard/string.c - main.c - rfc1867.c: Cleanups & optimizations - - * ext/standard/post.c - ext/standard/post.h - rfc1867.c: Cleanups - -1999-09-10 Sascha Schumann - - * configure.in.in: Move Linux check => more general --version-script check - - * INSTALL: add info about php3/php4 apache modules - - * INSTALL: tweak the INSTALL document a little bit - - * configure.in.in: pass flag correctly to linker - - * Makefile.in - configure.in.in - php.map: - better use of scoping - - support Solaris 2.x - -1999-09-10 Andrei Zmievski - - * ext/oci8/config.m4: Workaround for m4 weirdness. - -1999-09-10 Mark Musone - - * ext/mcal/php3_mcal.c: - lets not go down that road..were onyl going to use the internal event structure. No passing objects - - * ext/mcal/php3_mcal.c: wrong preprocessor command - - * ext/mcal/php3_mcal.c - ext/mcal/php3_mcal.h: - ported the php3 stuff to php4. This module should work intechangably between the two versions also - -1999-09-10 Zeev Suraski - - * ext/gd/Makefile.am: *** empty log message *** - -1999-09-10 Uwe Steinmann - - * ext/pdf/pdf.c: - wrong use of php_print corrected - -1999-09-10 Zeev Suraski - - * ext/pgsql/pgsql.c: - Lost functionality in earlier fix... That should really work. - - * ext/pgsql/pgsql.c: That should do the trick (untested) - -1999-09-10 Mark Musone - - * ext/pgsql/pgsql.c: my bad, sorry - - * ext/pgsql/pgsql.c: fixed memory leak - -1999-09-09 Andi Gutmans - - * php4dllts.dsp: - - Add mcal to TS project. It seems that mcal needs to be patched a bit in - order to work TSRM. Right now it has globals. - -1999-09-09 Uwe Steinmann - - * ext/pdf/pdf.c: forgot to change prototype - - * ext/pdf/pdf.c: pdf_setfont got optional parameter to embed fonts - -1999-09-08 Andrei Zmievski - - * ext/standard/dl.c: - Remove extraneous debug dlerror() call which results in the subsequent - dlerror() returning NULL. - -1999-09-08 Gergely Madarász - - * configure.in.in - Makefile.in: - remove -Wl,--version-script from RPATHS, put it into a separate - variable - -1999-09-08 Danny Heijl - - * ext/informix/ifx.ec: Be consistent. - -1999-09-08 Uwe Steinmann - - * ext/hyperwave/hw.c: - - add posibility to specify how objrec to objarr conversion - is performed (not ready yet) - -1999-09-08 Sascha Schumann - - * ChangeLog - configure.in.in - php.map: add versioning support - -1999-09-08 Jakub Skopal - - * mod_php4.c: Correct compiler warning. - -1999-09-07 Andi Gutmans - - * php4dll.dsp: - Update non-threadsafe project file - - * ext/standard/string.c - config.w32.h: - Fix warnings and win32 compile - -1999-09-07 Andrei Zmievski - - * ext/standard/basic_functions.c: Here you go, Egon. - -1999-09-07 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed behavior with empty doc_root. - gzgetss() now uses _php3_strip_tags. - -1999-09-07 Stig Bakken - - * ext/standard/fsock.c: - Add thread-safety notice here. The solution is using gethostbyname_r, - but it seems that it takes different parameters on Solaris and - Linux. ;-P We should probably make a wrapper function, and make a - configure test that checks if there is a reentrant version available, - and if not protect gethostbyname and similar calls with a mutex until - the results have been copied. Ugly. - -1999-09-07 Andrei Zmievski - - * ext/standard/basic_functions.c - ChangeLog: - Added second parameter to array_keys() which allows returning keys - only for a specific value in an array. - - * ext/standard/math.c: Kill compiler warning. - - * ext/mcal/.cvsignore: Shut up, CVS. - - * ext/standard/string.c: Kill warnings. - -1999-09-07 Uwe Steinmann - - * ext/standard/uniqid.c: - - uniqid() used the additional parameter even if it was not provided - this caused an segm fault. fixed it. - -1999-09-06 Zeev Suraski - - * ext/standard/dl.c - main.c: A couple of BoundsChecker fixes - -1999-09-06 Andi Gutmans - - * config.w32.h: - Should fix Win32 compile - -1999-09-06 Egon Schmid - - * ext/standard/basic_functions.c: File should here be string. - -1999-09-06 Danny Heijl - - * ChangeLog: Forgot to update ChangeLog - -1999-09-06 Stefan Roehrich - - * ext/zlib/php3_zlib.h - ext/zlib/zlib.c: Removed remaining PHP_31 defines. - First try with ZTS support, can someone with a working ZTS enabled setup test this, please? - -1999-09-06 Gergely Madarász - - * ext/gd/Makefile.am - ext/gd/config.m4 - ext/gd/gd.c: Enabled shared build of gd module - -1999-09-06 Danny Heijl - - * ext/informix/ifx.ec: - "Resourcified" the Informix driver. - -1999-09-06 Stig Bakken - - * LICENSE: untabified - -1999-09-06 Jakub Skopal - - * ext/standard/crypt.c: - Workaround for crypt() getting too few characters for salt. - -1999-09-06 Stefan Roehrich - - * ext/zlib/zlib.c: Fixed prototype. - -1999-09-06 Zeev Suraski - - * ext/mysql/php_mysql.c: Fix the 4.0 tree (forgot to commit) - -1999-09-06 Jakub Skopal - - * cgi_main.c: Corrected the argument-list for getopt. -c expects argument. - -1999-09-05 Jakub Skopal - - * ext/standard/basic_functions.c - ext/standard/php3_string.h - ext/standard/string.c: Added addcslashes(), stripcslashes(). - Reverted addslashes() to the very original behaviour. - -1999-09-05 Sascha Schumann - - * main.c: fix warning - -1999-09-05 Andi Gutmans - - * main.c - php_ini.c - php_ini.h: - Should fix short_tags and co. problem. - - * internal_functions_win32.c - php4dllts.dsp: - Make Win32 compile once again. - - * ext/standard/basic_functions.c - ext/standard/dir.c - win32/readdir.h - SAPI.c - ext/session/mod_files.c - php4dll.dsp: - Make dir functions compile in Win32 - - Fix too early memory manager initialization (For you Thies) - -1999-09-05 Stefan Roehrich - - * ext/ldap/config.m4: Find debian umich-ldap libraries/include files. - -1999-09-05 Andreas Karajannis - - * ChangeLog - build-defs.h.in: Changes for updated odbc module - - * ext/odbc/odbc.c - ext/odbc/php3_odbc.h: Renaming odbc files - - * ext/odbc/Makefile.am - ext/odbc/config.h.stub - ext/odbc/php_odbc.c - ext/odbc/php_odbc.h - ext/odbc/velocis.c: New resource handling for odbc module - -1999-09-05 Sascha Schumann - - * php_globals.h: work around gcc bug, otherwise compiler would die with - - toplev.c:2261: Internal compiler error in function float_signal - - in basic_functions.c - -1999-09-05 Andi Gutmans - - * main.c: - - php_error(E_ERROR,...) won't ever return so change the connection_status - before it is called. - -1999-09-05 Jakub Skopal - - * ext/standard/string.c: C++ comment fix... sorry. - - * ext/standard/php3_string.h - ext/standard/string.c: Appended second argument of addslashes(), - Changed php_addslashes() to add \000 instead of just \0 - -1999-09-04 Rasmus Lerdorf - - * php.h: Forgot one - - * ext/standard/exec.c: Kill a warning - -1999-09-04 Zeev Suraski - - * php.h: This was actually intentional... put it back in and improve - -1999-09-04 Rasmus Lerdorf - - * php.h - php_globals.h: Cleanups - - What the heck was that dangling (c) for in the PUTC macros? Were they - supposed to serve some sort of purpose, because I sure don't see one for - them. - -1999-09-04 Stefan Roehrich - - * ext/zlib/zlib.c: First try with new resource handling in zlib module. - -1999-09-04 Rasmus Lerdorf - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: - Add connection handling stuff to ISAPI and NSAPI code. This will - likely need some reworking, but this way it won't get overlooked. - - * ChangeLog - configure.in.in: - Oops, set_time_limit() would never have worked becase HAVE_SETITIMER - never got defined anywhere. - - * ChangeLog - mod_php4.c: Oops - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - main.c: - Catch a timeout and add user-level interface for connection handling - - * mod_php4.c - serverapi/cgi_sapi.c - main.c: - Might as well bail as soon as we know we should since this is now - possible. We still need to set our connection status bit field so a - shutdown function can figure out if a script was terminated due to an - abort, timeout or finished normally. - - * main.c - mod_php4.c - php.h - php_globals.h - serverapi/cgi_sapi.c - serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c - serverapi/sapi.h: - First part of the connection_status work. No user-callable functions - yet. That is coming next. Have also only done Apache and CGI so far. - Will have to crack open my ISAPI book to do that one. - - Also changed the SAPI output functions to return an int. We'll check - the connection status inside each one, but we might need the return - code at some other level and I don't see a good reason for just tossing - these return codes. - -1999-09-04 Andrei Zmievski - - * ext/wddx/wddx.c: Oops, don't need those commented out blocks. - - * output.c: Kill compiler warnings. - - * ext/wddx/wddx.c: Conform to new resource handling guidelines. - -1999-09-04 Zeev Suraski - - * ext/zlib/zlib.c - ext/standard/file.c - ext/standard/php3_string.h - ext/standard/post.c - ext/standard/string.c - ext/sybase/sybase.c - ext/sybase_ct/php_sybase_ct.c - ext/msql/php_msql.c - ext/mysql/php_mysql.c - ext/pgsql/pgsql.c - ext/standard/exec.c - dl/mssql/mssql.c - ext/db/db.c - ext/interbase/interbase.c - php3_compat.h: *** empty log message *** - - * ext/sybase_ct/php_sybase_ct.c - ext/sybase_ct/php_sybase_ct.h - ChangeLog: Add resource support to the Sybase CT module - -1999-09-04 Sascha Schumann - - * ext/session/session.c: First try at WDDX serializer - (not active currently) - -1999-09-04 Zeev Suraski - - * ext/msql/php_msql.c - ext/msql/php_msql.h: - - - - - - - - - - A few fixes - -1999-09-04 Sascha Schumann - - * ext/session/mod_files.c: cleanup - - * ext/session/php_session.h: remove superflicious enumaration - - * ext/session/mod_mm.c: - bail out, if ps_mm_instance wasn't initialized correctly - (should take place in global startup) - - * ext/session/mod_files.c: implement single directory garbage collector - -1999-09-04 Zeev Suraski - - * ext/msql/Makefile.am - ext/msql/msql.c - ext/msql/php3_msql.h - ext/msql/php_msql.c - ext/msql/php_msql.h - ChangeLog: Update the mSQL module with the latest tech - -1999-09-03 Zeev Suraski - - * ext/mysql/mysql.dsp: *** empty log message *** - -1999-09-03 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Static is good... - -1999-09-03 Zeev Suraski - - * ChangeLog - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/mysql/php_mysql.c - ext/mysql/php_mysql.h: Final MySQL tweaks - -1999-09-03 Danny Heijl - - * ext/informix/ifx.ec: - - backed out IS_RESOURCE stuff in favour of old php3-style IS_LONG - for now. This makes the Informix driver work again. - -1999-09-03 Zeev Suraski - - * ext/mysql/Makefile.am - ext/mysql/mysql.dsp - php_modules.dsw: More cleanups - - * ChangeLog - ext/mysql/mysql.c: Use the new API for resources in MySQL - -1999-09-03 Stefan Roehrich - - * ext/oci8/config.m4 - ext/oracle/config.m4: Added detection of Oracle 8.1 (aka 8i) from PHP3. - -1999-09-03 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Practice what you preach, I guess. - -1999-09-03 Sascha Schumann - - * internal_functions_win32.c: - Add global startup/shutdown functions in Win32 version as well - - * php.h: Add prototypes for new functions in internal_functions.c.in - - * SAPI.c - acinclude.m4 - ext/session/config.m4 - ext/session/mod_mm.c - ext/session/mod_mm.h - ext/session/session.c - genif.sh - internal_functions.c.in - main.c - php.h - ChangeLog: - add global startup/shutdown handlers - - improve genif.sh to also consider all header files for inclusion - (checks for phpext_) - - use vsnprintf in main.c to avoid buffer overflows - - improve sessions's mm module to cope better with OOM situations - within the shared memory segment - - fix typo wrt session.auto_start - - * ext/mcal/Makefile.in: - Makefile.in and other generated do not belong under CVS control - -1999-09-03 Gergely Madarász - - * ext/mysql/Makefile.am - ext/mysql/config.m4 - ext/mysql/mysql.c: Enabled shared build of mysql module - - * ext/xml/config.m4: Small cleanup - - * ext/snmp/Makefile.am - ext/snmp/config.m4 - ext/snmp/snmp.c: Enabled shared build of snmp module - - * ext/pgsql/Makefile.am - ext/pgsql/config.m4 - ext/pgsql/pgsql.c: Enabled shared build of pgsql module - -1999-09-03 Andrei Zmievski - - * ext/wddx/wddx.c: Fixed resource handling to conform to PHP4 guidelines. - -1999-09-03 Uwe Steinmann - - * ext/hyperwave/hw.c: - complete rewrite of object to array conversion - -1999-09-03 Zeev Suraski - - * php_version.h - configure.in.in: Version update - - * php4isapi/php4isapi.c - output.c - ChangeLog - main.c: - - Fixed several problems with output buffering and HEAD requests (Zeev) - - Fixed HTTP Status code issue with ISAPI module (Zeev) - -1999-09-02 Stig Bakken - - * ext/xml/Makefile.am - ext/xml/config.m4: clean up library naming - -1999-09-02 Thies C. Arntzen - - * ext/standard/image.c - ext/standard/image.h - ext/standard/php3_standard.h - ext/standard/php_image.h - ChangeLog: newest GetImageSize renamed header-file - -1999-09-02 Andi Gutmans - - * ChangeLog: - - Small fix but it's important for people to know when B3 is released. - -1999-09-01 Mark Musone - - * ext/mcal/Makefile.am - ext/mcal/Makefile.in - ext/mcal/config.h.stub - ext/mcal/config.m4 - ext/mcal/php3_mcal.c - ext/mcal/php3_mcal.h: Added mcal module - -1999-09-01 Andi Gutmans - - * internal_functions_win32.c - main.c - php4dllts.dsp: - Add sessions module to standard win32 build. - -1999-09-01 Andrei Zmievski - - * ext/session/session.c: Fix lcg.h location. - -1999-09-01 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: - - Group-attribute may now appear multiple times in objrec record. - -1999-08-31 Stig Bakken - - * ext/session/session.c - ext/standard/uniqid.c - buildconf - internal_functions_win32.c: ext/lcg -> ext/standard in various places - - * ext/standard/uniqid.c: oops - -1999-08-31 Thies C. Arntzen - - * Makefile.in: we need DEFS when compiling this dir - -1999-08-31 Stig Bakken - - * main.c: fix for bug #2165 - - * ext/standard/basic_functions.c: fix for bug #2191 - - * ext/standard/uniqid.c: compat fix, bug #2201 - -1999-08-31 Thies C. Arntzen - - * ext/apache/apache.c: "fix" for #2202 - -1999-08-30 Andreas Karajannis - - * ext/odbc/config.h.stub - ext/odbc/config.m4 - ext/odbc/php3_odbc.h - ext/odbc/setup.stub: Add support for unixODBC - -1999-08-29 Stig Bakken - - * internal_functions.c.in - ext/standard/Makefile.am - ext/standard/lcg.c - ext/standard/php_lcg.h: moved lcg stuff to ext/standard - -1999-08-29 Sascha Schumann - - * cgi_main.c: - PATH_TRANSLATED was not used at all, even if one comment implied - it should be used. After adding this, the CGI version works for me - w/ Apache + suexec - -1999-08-29 Egon Schmid - - * ext/pgsql/pgsql.c: This one was nonesense. - - * ext/pgsql/pgsql.c: Missing return type. - - * ext/standard/basic_functions.c: Oops, file should be string here. - -1999-08-28 Rasmus Lerdorf - - * mod_php4.c: - This check actually doesn't make a whole lot of sense. We need - something here, but if a mod_auth_* module declines, the type is - still set. So, we need a check to see if there have been a - non-declined auth hook previously for this request. I will ponder - a good approach to this. - -1999-08-28 Zeev Suraski - - * ChangeLog - cgi_main.c: Add -d switch - -1999-08-28 Philippe Verdy - - * ext/standard/datetime.c: semicolon syntax error - - * ext/standard/datetime.c: Bug in gmmktime(): - it produced wrong results in New Foundland, - Central Australia, India, Iran, and Java, with - half-hour timezones. - -1999-08-28 Sascha Schumann - - * main.c: - when "track_vars" is disabled and a script which contains is - accessed for the first time, track vars were not created properly. - - * ext/standard/file.c: merge in fix from php3 - -1999-08-28 Zeev Suraski - - * main.c: New relay code - -1999-08-28 Sascha Schumann - - * ChangeLog: - If we stick to this style, parsing becomes easier (for humans and computers). - -1999-08-27 Sascha Schumann - - * ext/session/config.h.stub - ext/session/config.m4 - ext/session/mod_files.c - ext/session/mod_mm.c - ext/session/mod_mm.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ext/session/Makefile.am: - fix potential buffer problem in send_cookie - - fix gc probability algorithm - - don't access mod_data directly - - initial version of mm support for session data storage - - This works pretty good, but we need to create the initial mm pool - from the parent process/thread. Still looking for a clean way to do that. - -1999-08-27 Zeev Suraski - - * ext/standard/browscap.c: Better debug macros - -1999-08-27 Andreas Karajannis - - * ext/odbc/odbc.c: Typo fix - -1999-08-27 Zeev Suraski - - * main.c: *** empty log message *** - - * ext/imap/imap.c: Tiny fixes - - * main.c: Log date&time on script logs - -1999-08-27 Mark Musone - - * ext/imap/imap.c: - lets not make global functions unless we need to..actually this should be taken out someday - - * ext/icap/php3_icap.c: cleand up storing new events - -1999-08-26 Rasmus Lerdorf - - * ext/pcre/php_pcre.c: Missing return types in prototypes - -1999-08-26 Andrei Zmievski - - * ext/sybase_ct/.cvsignore: shut up CVS - - * ext/wddx/wddx.c: Fix for #2161 - -1999-08-26 Andi Gutmans - - * ChangeLog: - Make Win32 compile again. - -1999-08-25 Sascha Schumann - - * ChangeLog: . - - * ext/sysvsem/sysvsem.c: - AIX wants the value, not the pointer to the value. - - Fixes #2149 - -1999-08-25 Andi Gutmans - - * ext/standard/fsock.h - ext/standard/fsock.c - fopen-wrappers.c - main.c - ChangeLog: Make fopen() work with URL's in Win32 - - * ChangeLog: - Fix for include_path for Win32 (Zend library) - -1999-08-24 Zeev Suraski - - * ext/com/COM.c - output.c - php.ini-dist - php4dll.dsp - php_globals.h - ChangeLog - main.c: Add output_buffering directive - -1999-08-24 Mark Musone - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: argh..Finally - -1999-08-23 Sascha Schumann - - * ext/Makefile.am: suppress error exit status on non Rhapsody systems - - * buildconf: don't print out error message - - * dlist.c: malloc.h is deprecated, use stdlib.h instead - -1999-08-23 Andi Gutmans - - * php4isapi/php4isapi.c: - Commit fix proposed in bug report. - -1999-08-23 Mark Musone - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: - changed to use the new, soon to be public libicap 0.99 - -1999-08-23 Sascha Schumann - - * ext/session/session.c: return true to match documentation - -1999-08-22 Andi Gutmans - - * internal_functions_win32.c - php4dllts.dsp: - Add lcg to windows project. - -1999-08-22 Sascha Schumann - - * ChangeLog: . - - * acinclude.m4 - configure.in.in - libphp4.module.in: remove all references to RAW_RPATHs - Apache builds now correctly when shared core is used - - * ext/session/mod_files.c - ext/session/mod_files.sh: - cleanup code - - add script which creates the directory tree for better scaling - of mod_files - - I have to decide yet whether we implement the garbage collection in the - module or if we simply let the user do - - find path -ctime +1 | xargs rm - - * ext/session/mod_files.c: Use O_EXCL where possible. - -1999-08-21 Sascha Schumann - - * ChangeLog - ext/session/php_session.h - ext/session/session.c: - add session.extern_referer_chk - - use combined lcg in session id creation - - * ChangeLog: . - - * ext/standard/uniqid.c: - get rid of that usleep() and add some entropy using the combined lcg - -1999-08-20 Andrei Zmievski - - * ext/ldap/ldap.c: Fix bug #2025 - -1999-08-19 Egon Schmid - - * ext/pcre/php_pcre.c: Here was also something missing - -1999-08-19 Mark Musone - - * ext/icap/php3_icap.c: *smack*...must..initialize...return...value.. - -1999-08-19 Uwe Steinmann - - * ext/pdf/config.m4: On the way to make configure more robust - -1999-08-19 Andi Gutmans - - * ext/standard/dir.c - ext/pcre/php_pcre.c - main.c: - - Fixed memory leaks. tsrm resource id deallocation still needs to be implemented. - -1999-08-19 Uwe Steinmann - - * ext/hyperwave/hw.c: - fixed several memory leaks - - fixed broken hw_cp and hw_mv functions - -1999-08-19 Uwe Steinmann - - * ext/pdf/pdf.c: missing return type - -1999-08-19 Rasmus Lerdorf - - * ext/gd/gdcache.c: TTF support tested and working now - - * ext/gd/php3_gd.h: This should fix TTF support - untested - -1999-08-19 Andi Gutmans - - * ext/oci8/oci8.c: - Fixed typo in oci8 error message - -1999-08-18 Andrei Zmievski - - * ext/standard/exec.c: Fixed bug #2105 - -1999-08-18 Charles Hagenbuch - - * ext/imap/imap.c: cjh: fixing the imap_add_body crash in php4. - -1999-08-18 Thies C. Arntzen - - * ext/oracle/php3_oracle.h - ext/oracle/oracle.c - ext/oci8/oci8.c: ZTS - -1999-08-18 Andrei Zmievski - - * ext/wddx/wddx.c: Ported fixed for bug #2103 from PHP3. - -1999-08-18 Thies C. Arntzen - - * ext/xml/xml.c: ZTS fix - - * ext/oracle/oracle.c: some ZTS stuff - - * ChangeLog - ext/oci8/oci8.c: ocifetchinto fix - -1999-08-17 Zeev Suraski - - * ext/mysql/mysql.c - ChangeLog: Fix #2090 - - * ext/standard/basic_functions.c: Fix #2096 - -1999-08-17 Sascha Schumann - - * ext/standard/crypt.c: merge in change: - - Date: Monday June 28, 1999 @ 4:40 - Author: bjh - - Update of /repository/php3/functions - In directory php:/tmp/cvs-serv5697 - - Modified Files: - crypt.c - Log Message: - Stop core dump using crypt() with standard DES. When PHP3_MAX_SALT_LEN = 2 - adding the null terminator to the salt exceeds allocated space causing - stack corruption. - - * ChangeLog: update - - * ext/gd/php3_gd.h: - HAVE_FREETYPE_H isn't defined anywhere. HAVE_LIBTTF should be sufficient - - * ChangeLog - ext/mhash/mhash.c: fix persistency of mhash_* constants - -1999-08-17 Mark Musone - - * ext/icap/php3_icap.c: dont have these library functiosn yet - - * ext/icap/php3_icap.h: argh..heh..par for the course.. - - * ext/icap/php3_icap.h: argh..bad day.. - - * ext/icap/php3_icap.h: please work... - - * ext/icap/Makefile.am: hrmmm - - * ext/icap/php3_icap.c: last few compile fixes - - * ext/icap/php3_icap.c: - maybe it'll compile now..more php3->php4 conversions - - * ext/icap/php3_icap.c: more changes - -1999-08-17 Thies C. Arntzen - - * ext/oracle/php3_oracle.h - ChangeLog - ext/oracle/oracle.c: ZTS stuff - -1999-08-17 Mark Musone - - * ext/icap/config.m4: thanks Andrei! - -1999-08-17 Sascha Schumann - - * ext/dba/dba_db2.c - ChangeLog: fix flushing cached information to disk - -1999-08-17 Thies C. Arntzen - - * ext/oci8/php3_oci8.h - ChangeLog - ext/oci8/oci8.c: cleanups & ZTS stuff (ZTS untested!) - - * configure.in.in - ext/standard/filestat.c - ChangeLog: imported diskfreespace from 3.0 - -1999-08-17 Uwe Steinmann - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c: fixed potential segm faults - -1999-08-16 Andrei Zmievski - - * ext/standard/basic_functions.c - ChangeLog: Removed internal pointer reset from array_walk. - -1999-08-15 Philippe Verdy - - * ext/pcre/pcrelib/pcreposix.c: - make pcre test program compile again with Zeev's - additions in the pcre_exec() function parameters - -1999-08-15 Thies C. Arntzen - - * ext/standard/filestat.c - ext/standard/link.c: added a few PLS_FETCH() - -1999-08-14 Zeev Suraski - - * apMakefile.tmpl - php.h: Close bug #1742 - -1999-08-14 Andrei Zmievski - - * ext/standard/basic_functions.c: Forgot to have internal pointer reset. - -1999-08-14 Danny Heijl - - * ext/informix/ifx.ec: more of the new ini stuff - -1999-08-14 Zeev Suraski - - * ext/standard/basic_functions.c: Rename TestClass to OverloadedTestClass - - * ext/mysql/mysql.c - php_ini.h: Fix thread unsafe version - -1999-08-14 Andi Gutmans - - * main.c: - Make the non-threadsafe version compile again - -1999-08-13 Zeev Suraski - - * ext/mysql/mysql.c - ext/mysql/mysql.dsp - ext/standard/dl.c - ChangeLog - main.c - php.ini-dist - php4ts.dsw - php_ini.c - php_ini.h - php_modules.dsw: - Add PHP Modules workspace - - Get the MySQL module to compile&work under thread-safe Win32 - - Fix various thread safety issues with dynamic modules - -1999-08-13 Andrei Zmievski - - * ext/standard/filestat.c: Fixed bug #2023. - -1999-08-13 Sascha Schumann - - * buildconf: rerun checks if buildconf is newer than the time stamp file - -1999-08-13 Zeev Suraski - - * ext/sybase/config.h.stub - ext/sybase/config.m4 - ext/sybase/php3_sybase-ct.h - ext/sybase/sybase-ct.c - ext/sybase_ct/Makefile.am - ext/sybase_ct/config.h.stub - ext/sybase_ct/config.m4 - ext/sybase_ct/php_sybase_ct.c - ext/sybase_ct/php_sybase_ct.h - ext/sybase_ct/setup.stub - ChangeLog - ext/sybase/Makefile.am: - Separate Sybase-CT from Sybase, and fix build process for Sybase-CT - -1999-08-12 Uwe Steinmann - - * ext/pdf/pdf.c: - fixed unresolved symbol pdf_open_memory_image when pdflib 2.01 is used - -1999-08-12 Philippe Verdy - - * main.c: no return warning removed. fixed TSRM constructor prototype - - * ext/standard/string.c: signed/unsigned warning removed - - * ext/standard/.cvsignore: Bison generated files - -1999-08-12 Uwe Steinmann - - * ext/pdf/config.m4: config for pdf module should now be similar to php3 - -1999-08-11 Mark Musone - - * ext/icap/php3_icap.c: whoops, forgot to actually return the alarms :^) - -1999-08-10 Uwe Steinmann - - * ext/pdf/config.h.stub - ext/pdf/config.m4: slight changes to config of pdf module - -1999-08-10 Stig Bakken - - * ext/icap/.cvsignore - ext/icap/Makefile.in: Makefile.in should not be added to CVS - -1999-08-10 Thies C. Arntzen - - * ext/oci8/oci8.c: starting to clean up - - * Makefile.in - regex/Makefile.in: - you can now override the CFLAGS while doing make - eg: - make CFLAGS="-g" - -1999-08-09 Mark Musone - - * ext/icap/Makefile.in - ext/icap/config.m4 - ext/icap/php3_icap.c: more ports - - * ext/icap/php3_icap.c: ports to php4 - - * ext/icap/Makefile.am - ext/icap/Makefile.in - ext/icap/config.h.stub - ext/icap/config.m4: more moudle stuff - - * ext/icap/php3_icap.c - ext/icap/php3_icap.h: added icap files from php3 sources - -1999-08-09 Egon Schmid - - * ext/standard/string.c: More typos. - - * ext/zlib/zlib.c: I missed that also. - - * ext/pgsql/pgsql.c: Another typo. - -1999-08-09 Zeev Suraski - - * ChangeLog: that too - -1999-08-09 Andi Gutmans - - * ChangeLog - configure.in.in - internal_functions_win32.c - php_version.h: Go beta 2 (final) - - * SAPI.c: Fix HTTP/ header handling - -1999-08-09 Andreas Karajannis - - * MODULES_STATUS - ext/odbc/odbc.c: Fixed odbc_fetch_into, added prototype return values. - Pconnects are not working - -1999-08-09 Thies C. Arntzen - - * ChangeLog - MODULES_STATUS - ext/sysvshm/sysvshm.c: fixed sysv_shm* - -1999-08-09 Uwe Steinmann - - * ChangeLog - ext/pdf/pdf.c: add changelog entries which I forget a couple of days ago - -1999-08-08 Philippe Verdy - - * win32/signal.h: solve infinite recursion error when including - -1999-08-08 Andreas Karajannis - - * ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h: First shot at odbc for PHP4 - Problems with LONGs to be investigated - -1999-08-08 Thies C. Arntzen - - * ext/xml/xml.c: fix for #1995 (this module needs some more work.) - -1999-08-07 Danny Heijl - - * ext/informix/ifx.ec: More zend-izing. - -1999-08-07 Zeev Suraski - - * ChangeLog - ext/standard/info.c - main.c - php.ini-dist: - Built-in phpinfo() links are now turned off by default. They can be - turned on using the allow_builtin_links INI directive - - * ChangeLog - ext/standard/info.c - php4.dsp - php4dll.dsp: - - Changed phpinfo() to list modules that have no info function - -1999-08-07 Andrei Zmievski - - * ext/standard/basic_functions.c: - Modified array_walk() function so that the userland callback is passed - a key and possible user data in addition to the value. It's still backward - compatible with one argument version. - -1999-08-07 Zeev Suraski - - * ChangeLog - ext/ldap/ldap.c: Fix for bug #1980 - - * ChangeLog - ext/apache/apache.c: Fix for bug #1754 - -1999-08-07 Philippe Verdy - - * configuration-scanner.l: unreferenced variable warning - -1999-08-07 Stefan Roehrich - - * ext/standard/info.c: Corrected spelling. - -1999-08-07 Zeev Suraski - - * ext/standard/basic_functions.c - scripts/apache/conffix.awk - scripts/apache/htaccessfix.awk: Fix&improve conversion scripts - -1999-08-06 Zeev Suraski - - * LICENSE: bump up the version number - - * ext/standard/basic_functions.c: - count/sizeof had their arguments setup wrong (messup between Beta 1 and 2) - - * ChangeLog - ext/standard/basic_functions.c: - - Improved register_shutdown_function() - you may now supply arguments that - will be passed to the shutdown function - - Improved call_user_func() and call_user_method() - they now support passing - arguments by reference - - Fixed usort() and uksort() - -1999-08-06 Uwe Steinmann - - * ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/php3_hyperwave.h: Made Hypwerwave module threat safe - -1999-08-06 Thies C. Arntzen - - * ext/standard/basic_functions.c: fix for #1947 - -1999-08-06 Uwe Steinmann - - * ext/fdf/fdf.c - ext/fdf/php3_fdf.h: Fdf module should now be up to date - - * ext/hyperwave/hg_comm.c: - Order of freeing memory cause segm fault since efree seems to wipe - out the memory. - -1999-08-05 Uwe Steinmann - - * ext/hyperwave/hw.h - ext/hyperwave/php3_hyperwave.h: renamed file - - * ext/hyperwave/hw.c: - zend_hash_update() seems to be a bit different form php3_hash_update - - * ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/hw_error.h - ext/pdf/config.m4 - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/gd/gd.c: Huge patch to update the hyperwave and pdflib module. - Only pdflib >2.0 is supported. - None is tested yet. Hyperwave seems to be broken now. - -1999-08-05 Andrei Zmievski - - * ext/msql/msql.c: Fixed. - -1999-08-05 Thies C. Arntzen - - * main.c: - hope i haven't missed anything - but we're no longer in the 3.x tree - -1999-08-04 Zeev Suraski - - * makedist: Fix makedist to work with the libtool enabled distribution - - * ChangeLog - php4isapi/php4isapi.c: * Fix bug #1963 - * Support large ISAPI server variables - -1999-08-04 Steven Lawrance - - * ChangeLog: Added a note about the SNMP changes - - * ext/snmp/php3_snmp.h - ext/snmp/snmp.c: - Fixed a little boo-boo I made during the PHP3->PHP4 conversion. - - * ext/snmp/php3_snmp.h - ext/snmp/snmp.c: - Updated the files so that they have all the functionality of - PHP 3.0.12. These include snmpwalkoid, snmp_get_quick_print, snmp_set_quick_print, and snmpset. - -1999-08-03 Mike Gerdts - - * acinclude.m4: - Fix bug #1949: -rdynamic not handled properly with Sun's C compiler - -1999-08-03 Rasmus Lerdorf - - * ext/standard/formatted_print.c: [s]printf fix for bug #1952 - (note, [s]printf doesn't work in PHP4 yet) - -1999-08-03 Mike Gerdts - - * rfc1867.h: - Last character of file not a newline, causing problems with Sun's C compiler - - * php_regex.h: - file did not end with a newline, causing problems for Sun's C compiler - -1999-08-02 Zeev Suraski - - * buildconf: This should sort the buildconf bug... - -1999-08-02 Stefan Roehrich - - * ext/zlib/zlib.c - ext/zlib/php3_zlib.h - ChangeLog - MODULES_STATUS: - Fix for Redhat libc 2.1 and dynamic loading in zlib module. - Adapted zlib module to new PHP_Mxxx macros. - -1999-08-02 Zeev Suraski - - * ext/standard/fsock.c - configure.in.in: AIX needs this include... - - * configure.in.in - php_version.h: Go Beta 2 - - * php4isapi/php4isapi.c - serverapi/cgi_sapi.c - serverapi/isapi_sapi.c - ext/xml/php3_xml.h - ext/xml/xml.c - ext/zlib/zlib.c - ext/sysvshm/sysvshm.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/sysvsem.c - ext/snmp/snmp.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/cyr_convert.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/image.c - ext/standard/info.c - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/rand.c - ext/pcre/php_pcre.c - ext/pdf/pdf.c - ext/pgsql/pgsql.c - ext/session/session.c - ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ext/odbc/odbc.c - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/mysql/mysql.c - ext/mhash/mhash.c - ext/msql/msql.c - ext/mcrypt/mcrypt.c - ext/ldap/ldap.c - ext/imap/imap.c - ext/interbase/interbase.c - ext/filepro/filepro.c - ext/gd/gd.c - ext/gettext/gettext.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/dba/dba.c - ext/dbase/dbase.c - ext/fdf/fdf.c - ext/aspell/aspell.c - ext/bcmath/bcmath.c - ext/com/COM.c - ext/db/db.c - dl/log/log_sql.c - dl/mssql/mssql.c - dl/snmp/snmp.c - dl/snmp/winsnmp.c - ext/apache/apache.c - dl/crypt/crypt.c - dl/log/log_db.c - cgi_main.c - configuration-parser.y - configuration-scanner.l - fopen-wrappers.c - main.c - mod_php4.c - php.h - php3_compat.h - php3_sprintf.c - php_ini.c - rfc1867.c - safe_mode.c - snprintf.h: - Removed '3' from key functions in PHP (maintained compatibility through - php3_compat.h) - -1999-08-02 Andrei Zmievski - - * ext/oracle/php3_oracle.h: Fix function declarations. - - * ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/oracle/php3_oracle.h - ext/oci8/oci8.c - ext/odbc/odbc.c - ext/mhash/mhash.c - ext/msql/msql.c - ext/msql/php3_msql.h - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/interbase/interbase.c - ext/interbase/php3_interbase.h - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/mcrypt/mcrypt.c - ext/imap/imap.c - ext/imap/imap.h: More symbol work. - - * ext/standard/datetime.c: Updated proto - -1999-08-01 Egon Schmid - - * ext/pcre/php_pcre.c: - Another forgotten prototype. Andrei, why is preg_grep in PHP3 missing? - -1999-08-01 Andi Gutmans - - * ext/standard/basic_functions.c - tests/testobj: Support resource type in gettype() - -1999-08-01 Zeev Suraski - - * ChangeLog - ext/sybase/sybase-ct.c - ext/sybase/sybase.c: Fix bug #1872 - - * ChangeLog - ext/imap/imap.c: Final IMAP fixes - -1999-07-31 Zeev Suraski - - * ext/imap/imap.c: More IMAP fixes - - * snprintf.c: Fix another compile warning - - * ext/sybase/sybase.c: That should fix bug #1903 - - * ChangeLog: Fix problem with include/require of URLs (bug #1832) - - * main.c: Fix problem with include/require of URLs - - * ext/standard/math.c: Fix bug #1914 - - * ext/imap/imap.c: Declaration fix - -1999-07-30 Zeev Suraski - - * ext/imap/imap.c: - Ok, that should be a good start. Can somebody verify that this actually compiles, - and perhaps check if it runs? - - * ext/imap/imap.c: - Early steps towards making the IMAP module PHP 4.0 compatible - (and readable - indent people, INDENT) - - * ChangeLog - ext/standard/string.c: This should fix the implode() problem - -1999-07-30 Andrei Zmievski - - * main.c: Fix for bug #1907. - -1999-07-29 Andi Gutmans - - * ext/standard/basic_functions.c - tests/testobj: -Tiny fix - - * ext/standard/basic_functions.c: - - Added function documentation prototypes. Thanks to Egon Schmid for - straightening me out :) - -1999-07-28 Andi Gutmans - - * ext/standard/basic_functions.h - ext/standard/soundex.c - tests/testobj - ChangeLog - ext/standard/basic_functions.c: - - Added get_class($obj), get_parent_class($obj) and method_exists($obj,"name") - -1999-07-28 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/link.c - php.h: Fix link functions problem. - -1999-07-28 Danny Heijl - - * ext/standard/soundex.c: Make it compile again - -1999-07-28 Philippe Verdy - - * ext/standard/soundex.c: Commited changes in php3 function/soundex 1.32 - -1999-07-27 Zeev Suraski - - * LICENSE: License update - -1999-07-27 Andrei Zmievski - - * ext/hyperwave/hw.h - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/hyperwave/hw.c - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/filepro/filepro.c - ext/filepro/php_filepro.h - ext/gd/gd.c - ext/gd/php3_gd.h: Symbol work. - -1999-07-27 Andi Gutmans - - * ChangeLog: - Update Changelog - - * ext/standard/basic_functions.c - ext/standard/datetime.c: - strttotime is compiled in on win32 again. - -1999-07-27 Andrei Zmievski - - * ext/dbase/dbase.c: Oops. - - * ext/dba/dba.c - ext/dbase/dbase.c - ext/dbase/php_dbase.h: More symbol work. - - * ext/standard/basic_functions.c - ChangeLog: check for nKeyLength not arKey - - * ext/standard/basic_functions.c: Fix for bug #1887. - - * ext/standard/basic_functions.c: Fix for bug #1891 - -1999-07-27 Stig Bakken - - * buildconf: forgot to mention the password - - * buildconf: spoonfeed - -1999-07-27 Danny Heijl - - * ext/informix/php_informix.h - ext/informix/ifx.ec: - >... If you can, please update your module to use these macros. - I could, so I did. - -1999-07-26 Zeev Suraski - - * ChangeLog: Fix bug #1867 - - * ChangeLog: Fix bug #1851 - -1999-07-26 Andrei Zmievski - - * ext/db/db.c - ext/db/php3_db.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/file.c - ext/standard/file.h - ext/standard/filestat.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/head.c - ext/standard/head.h - ext/standard/mail.c - ext/standard/pack.c - ext/standard/pack.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_mail.h - ext/standard/php3_syslog.h - ext/standard/reg.c - ext/standard/syslog.c - ext/aspell/aspell.c - ext/aspell/php3_aspell.h - ext/bcmath/bcmath.c - ext/bcmath/php3_bcmath.h - ext/com/COM.c - ext/com/php3_COM.h - ext/apache/apache.c - configuration-parser.y - php.h: More symbol work. - - I've defined a few macros to help with module/request init/startup function definitions. - Basically: - - PHP_MINIT_FUNCTION(module) - PHP_MSHUTDOWN_FUNCTION(module) - PHP_RINIT_FUNCTION(module) - PHP_RSHUTDOWN_FUNCTION(module) - PHP_MINFO_FUNCTION(module) - - These will expand to proper function prototypes. - - Now to specify these in the module entry, use: - - PHP_MINIT(module) - PHP_MSHUTDOWN(module) - PHP_RINIT(module) - PHP_RSHUTDOWN(module) - PHP_MINFO(module) - - I've updated all modules in ext/standard and everything from ext/apache to ext/db. - If you can, please update your module to use these macros. - -1999-07-26 Andi Gutmans - - * ext/standard/basic_functions.c - ext/standard/datetime.c - tests/testobj - ext/com/COM.c: - Fix the new operator incompatibility. - - I commented PHP_FUNCTION(strtotime) in datetime.c because it stopped - win32 from compiling. This needs to be fixed!!! - - Check out libzend to compile the tree now. - -1999-07-25 Stig Bakken - - * ext/gd/config.m4: "gd", not "-lgd" - - * ext/gd/config.m4: use AC_ADD_ macros - - * acconfig.h.in - configure.in.in: final php3.ini -> php.ini renaming? - -1999-07-24 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/head.h - ext/standard/link.c - ext/standard/mail.c - ext/standard/microtime.h - ext/standard/pack.c - ext/standard/php3_filestat.h - ext/standard/php3_string.h - ext/standard/reg.c - ext/standard/reg.h - ext/standard/soundex.c - ext/standard/string.c - ext/standard/syslog.c - main.c: - A bunch of grunt work updating function entries and declarations. - -1999-07-24 Sascha Schumann - - * ext/xml/config.m4: overlooked them - -1999-07-24 Andrei Zmievski - - * Makefile.in: Remove buildconf.stamp on make distclean - -1999-07-24 Zeev Suraski - - * main.c - ChangeLog: Congrats Andrei - -1999-07-24 Stig Bakken - - * acinclude.m4: more Solaris fun - - * php4.spec.in - scripts/mkextlib.in - .cvsignore - acinclude.m4 - configure.in.in: added workaround for Solaris PIC weirdness. - added RPM spec file for a future "official" RPM, work-in-progress - - * php4.gif: - temporary icon for RPMs until Colin gets back and can make us a spiffy new one - -1999-07-24 Zeev Suraski - - * ext/standard/fsock.c - ext/standard/parsedate.y - main.c - php4dll.dsp - php4dllts.dsp: * Make Win32 build work again - * Make error_reporting value prior to the standard initialization be - set so that errors show up - -1999-07-24 Stig Bakken - - * buildconf: Solaris 7 fix - -1999-07-24 Zeev Suraski - - * ChangeLog - mod_php4.c: *** empty log message *** - - * ext/standard/fsock.c - php4dllts.dsp - ChangeLog: * Fix a warning - * Update ChangeLog - -1999-07-24 Danny Heijl - - * ext/informix/ifx.ec: Get rid of most compiler warnings. - -1999-07-24 Rasmus Lerdorf - - * ChangeLog: Changelog - - * ext/standard/datetime.c: Fix broken build - - * ext/standard/rand.c: Bring rand.c up to date - -1999-07-24 Sascha Schumann - - * ext/xml/Makefile.am - ext/xml/config.m4: fix for missing include path in CFLAGS - - * buildconf: Bourne Shell does not have -nt. - -1999-07-23 Andrei Zmievski - - * ChangeLog - ext/standard/basic_functions.c: Added function entry for similar_text(). - - * ext/standard/basic_functions.c - ext/standard/php3_string.h: Added function entry for strip_tags. - - * .cvsignore: Ignore generated file. - - * ext/standard/.cvsignore: Ignore parsedate.c - - * ext/wddx/wddx.c: - Fixed a bug in WDDX that occured when a number was passed in instead - of a variable name. - -1999-07-23 Stig Bakken - - * config.guess - config.sub: generated and not required by windows - - * php_version.h: required for the Windows build, re-adding - -1999-07-23 Andrei Zmievski - - * ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/parsedate.y - ext/standard/Makefile.am - ext/standard/basic_functions.c: Ported strtotime() function. - -1999-07-23 Sascha Schumann - - * .cvsignore - buildconf: Improve speed on subsequent runs of buildconf - -1999-07-23 Andrei Zmievski - - * buildconf: Fix for compatibility. - -1999-07-23 Zeev Suraski - - * ext/gd/gd.c: Fix bug #1807 (requires libzend update) - -1999-07-23 Sascha Schumann - - * ext/gd/config.h.stub - ext/gd/config.m4 - ext/gd/gdttf.c - ChangeLog: gdttf update - -1999-07-23 Stig Bakken - - * buildconf - ltconfig - ltmain.sh: - run libtoolize during buildconf since we depend on libtool anyway - - * php_version.h: generated file - - * configure.in.in: in case ltconfig isn't checked out executable - - * ChangeLog: good boy - - * ext/xml/config.m4: updated the docstring for --with-xml - -1999-07-23 Zeev Suraski - - * ext/gd/config.m4 - ext/gd/gd.c - ext/gd/gdcache.c - ext/gd/gdttf.c - ext/gd/php3_gd.h - ChangeLog: Added check for freetype.h - -1999-07-23 Stig Bakken - - * buildconf: small fix to libtool check - - * buildconf: require libtool to be installed as well - -1999-07-23 Andi Gutmans - - * config.w32.h: - Make Win32 compile again. - -1999-07-23 Andrei Zmievski - - * php_version.h - ChangeLog: Changeloggin' - -1999-07-23 Danny Heijl - - * ChangeLog: ChangeLog - - * ext/informix/ifx.ec - MODULES_STATUS: - New ini-stuff incorporated. Porting to PHP4 and ZTS hopefully complete. - -1999-07-23 Sascha Schumann - - * ChangeLog: ChangeLog - -1999-07-22 Zeev Suraski - - * ext/msql/msql.c - ext/mysql/mysql.c - ext/pgsql/pgsql.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ChangeLog - buildconf: - Please add in any changes/bug fixes you've made - we need to keep a details ChangeLog... - - * ChangeLog - ChangeLog.3: Time to remove the PHP 3.0 ChangeLog - -1999-07-22 Sascha Schumann - - * configure.in.in: add the HPUX ANSI detection from php3 - -1999-07-22 Stig Bakken - - * buildconf: - add checks for autoconf, automake and whether libzend/TSRM is around - -1999-07-22 Sascha Schumann - - * ext/session/session.c: - Implement additional heuristic for session id search. Now looks into - REQUEST_URI as well. - -1999-07-22 Stig Bakken - - * Makefile.in: temporary hack-fix - -1999-07-22 Andrei Zmievski - - * ext/standard/datetime.c - ext/standard/basic_functions.c - php_version.h: -Ported all remaining date() options - -Made array_walk() work somewhat, but it's not - possible to change array values from inside the - walk function yet - - * ext/pcre/php_pcre.c: *** empty log message *** - -1999-07-22 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec: Blobs now working too. - - * MODULES_STATUS - ext/informix/ifx.ec: - Blobs don't work, hash problems. - -1999-07-21 Stig Bakken - - * ext/Makefile.am - ext/xml/.cvsignore - ext/xml/Makefile.am - ext/xml/config.m4 - ext/xml/xml.c - Makefile.in - acinclude.m4 - config.guess - config.sub - configure.in.in - ltconfig - ltmain.sh - php_version.h: - First cut at standard way of making dynamically loadable extensions on UNIX. - Examples on how to test: - - ./configure --with-xml static - ./configure --with-xml=/opt static - ./configure --with-xml=shared shared - ./configure --with-xml=shared,/opt shared - - The difference between these two is that when the extension is shared, it - is not merged into libphpext.a. The shared extension is currently always - built. I can't find a way to do just one or the other with automake/libtool, - if someone has a clever idea, please come forward. :-) - - "make install" installs the .so (as well as a lot of other cruft) in - $prefix/lib/php. - -1999-07-21 Zeev Suraski - - * mod_php4.c: Fixed the Apache cookie problem (untested) - -1999-07-21 Andrei Zmievski - - * ext/fdf/fdf.c: Fix for bug #1806 - - * ext/session/session.c - objects: *** empty log message *** - -1999-07-21 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec: - Informix extension now works but php_ini stuff still needs rewriting. - -1999-07-21 Sascha Schumann - - * ext/standard/fsock.c: sync with 1.133 - - * MODULES_STATUS: - since we all seem to use different tabwidths, reformat this with :set tw=4 - - * MODULES_STATUS: update - - * ext/dba/dba.c: merge in change from php3 - - * ext/dba/php3_cdb.h - ext/dba/php3_db2.h - ext/dba/php3_dba.h - ext/dba/php3_dbm.h - ext/dba/php3_gdbm.h - ext/dba/php3_ndbm.h - ext/dba/setup.stub - MODULES_STATUS - ext/dba/.cvsignore - ext/dba/Makefile.am - ext/dba/config.h.stub - ext/dba/config.m4 - ext/dba/dba.c - ext/dba/dba_cdb.c - ext/dba/dba_db2.c - ext/dba/dba_dbm.c - ext/dba/dba_gdbm.c - ext/dba/dba_ndbm.c: initial import of DBA - - * ext/msql/config.m4: the ; is superflicious - -1999-07-21 Andrei Zmievski - - * main.c: *** empty log message *** - -1999-07-21 Stig Bakken - - * ext/xml/config.m4: that's better - - * ext/imap/config.m4 - ext/pgsql/config.m4 - ext/snmp/config.m4 - ext/xml/config.m4 - ext/xml/php3_xml.h - ext/xml/xml.c: Debian fixes - - * configure.in.in: change version number to 4.0b2-dev - - * ext/standard/base64.c: - fix to reiterate that one should _always_ use braces around if/else/for/while - -1999-07-21 Andrei Zmievski - - * MODULES_STATUS: It really does work. - -1999-07-21 Danny Heijl - - * MODULES_STATUS - ext/informix/ifx.ec - ext/informix/php_informix.h: - Started php4/ZTS port of Informix driver. - -1999-07-21 Sascha Schumann - - * ext/standard/string.c: use the same version as in php3 - - * ext/standard/base64.c: - use reverse lookup array, submitted by bfranklin@dct.com, #1755 - - * ext/sybase/sybase-ct.c: fix for #1748 - - * configure.in.in: disable broken sprintf test - - * configure.in.in: defaults to empty string - -1999-07-20 Andrei Zmievski - - * ext/pcre/php_pcre.c - ext/pcre/php_pcre.h: Added locale support. - -1999-07-20 Mike Gerdts - - * ext/standard/exec.c: - exec() can now properly handle lines longer than (EXEC_INPUT_BUF-2) bytes. - - Lines being returned via the array that that contain only "\n" now are - trimmed down to "" to be consistent with exec's whitespace trimming - behavior for all other lines. - -1999-07-20 Andrei Zmievski - - * ext/standard/datetime.c - ChangeLog.TODO: Added 'n' option to date(). - - * ext/standard/basic_functions.c - ext/standard/head.c - ext/standard/head.h: Added headers_sent() function - - * ext/standard/datetime.c: Fix for bug #1750. - -1999-07-20 Sascha Schumann - - * acinclude.m4 - configure.in.in - libphp4.module.in: get rid of --with-shared-apache - it's currently broken and redundant (use APXS instead) - -1999-07-20 jim - - * BUGS - CHANGES-3.0 - COPYING - EXTENSION_STATUS - TODO - WISHLIST - WISHLIST-3.1 - cvsusers - press-release-3.0.txt: Remove a bunch of old junk. - -1999-07-19 Egon Schmid - - * ext/pgsql/pgsql.c: The last forgotten prototypes I know. - -1999-07-19 Andrei Zmievski - - * ext/standard/info.c - MODULES_STATUS: Updated status - - * ext/wddx/.cvsignore: Don't forget .cvsignore - - * ext/wddx/config.h.stub - ext/wddx/config.m4 - ext/wddx/php_wddx.h - ext/wddx/setup.stub - ext/wddx/wddx.c - ext/wddx/Makefile.am: Ported WDDX module. - -1999-07-19 Egon Schmid - - * ext/mysql/mysql.c: It's in PHP 3 and 4. - - * ext/msql/msql.c: Test, will document this soon. - -1999-07-19 Andrei Zmievski - - * ext/bcmath/.cvsignore: Updating cvsignore - - * dlist.c - dlist.h - ext/hyperwave/DList.h - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - Makefile.in: Moving dlist stuff into core. - -1999-07-19 Zeev Suraski - - * INSTALL - ext/standard/info.c - LICENSE - makedist: *** empty log message *** - -1999-07-19 Andi Gutmans - - * config.w32.h - internal_functions_win32.c: Fix Win32 compilation - -1999-07-19 Andrei Zmievski - - * ext/standard/file.c: Kill compiler warnings. - -1999-07-19 Danny Heijl - - * ext/informix/ifx.ec: - license change - -1999-07-19 Sascha Schumann - - * ext/standard/info.c: update - -1999-07-19 Andrei Zmievski - - * ext/standard/info.c: More credits. - -1999-07-18 Sascha Schumann - - * fopen-wrappers.c: - allow access to std{in,out,err} by using the php domain - - * ext/session/session.c: more to do - - * ext/session/session.c - php.ini-dist: - add session config to php.ini and adapt the naming scheme for it - -1999-07-17 Andrei Zmievski - - * ext/standard/info.c: Update credits a bit. - "Overall Work" line should probably be extended. - - * ext/apache/apache.c - ext/pcre/php_pcre.c: -Kill compile warnings in apache.c - -Make preg_grep() work with copies of array entries - - * ext/standard/basic_functions.c: Proto change - -1999-07-17 Zeev Suraski - - * ext/standard/info.c: *** empty log message *** - - * cgi_main.c - ext/standard/basic_functions.c - ext/standard/info.c - ext/standard/info.h - main.c: I was sure I committed these already. Weird - - * php4dll.dsp - php4dllts.dsp: One more necessary .dsp update - - * ext/standard/info.c: *** empty log message *** - - * CREDITS - configure.in.in: * Turn on debug by default - * Remove CREDITS file, point to web page instead - - * php4isapi/php4isapi.dsp - MODULES_STATUS - php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: Update DSPs - -1999-07-17 Sascha Schumann - - * ext/pgsql/pgsql.c: void some warnings - - * makedist: use optional copy - - * buildconf: make copy optional - -1999-07-17 Zeev Suraski - - * buildconf - makedist: Oki doki - - * buildconf - makedist: Some work on makedist - - * README-BCMATH - configure.in.in: Handle BCMath - Add a license pointer - - * ext/bcmath/number.c - ext/bcmath/number.h: We'll have to live without these files somehow. - - * ext/bcmath/number.c - ext/bcmath/number.h: Dummies - - * ext/bcmath/config.m4 - ext/bcmath/number.c - ext/bcmath/number.h: We need to disable bcmath by default - - * acconfig.h.in - configure.in.in: Remove MEMORY_LIMIT from PHP, it's a Zend issue... - -1999-07-16 Zeev Suraski - - * ext/sybase/sybase.c - ext/sybase/sybase-ct.c: Get the Sybase modules uptodate - - * ext/ldap/ldap.c: *** empty log message *** - -1999-07-16 Andrei Zmievski - - * ext/standard/basic_functions.c: - A little change in how array_splice/array_slice handle length parameter. - - Makes it compatible with Perl. - - * ext/standard/basic_functions.c: - Updated the functionality of array_splice. - -1999-07-16 Sascha Schumann - - * configure.in.in: - the regex check relies on a previously set APXS variable, - so it needs to be after the apxs check - - * configure.in.in: merge fix - - * ext/pgsql/php3_pgsql.h: unnecessary, breaks the build - - * ext/msql/msql.c: This is so ugly, I hate myself for committing it - -1999-07-16 Zeev Suraski - - * ext/ldap/ldap.c: Get the LDAP module uptodate - -1999-07-16 Sascha Schumann - - * acinclude.m4: avoid nameclash - - * ext/msql/config.m4: fix detection - -1999-07-16 Zeev Suraski - - * ext/pgsql/pgsql.c: *** empty log message *** - - * ext/mysql/mysql.c - ext/pgsql/pgsql.c: Get postgresql module uptodate - - * ext/msql/msql.c: Oops #2 - - * ext/msql/msql.c: Oops - - * ext/standard/string.c - ext/msql/msql.c: * Get the mSQL module up to date - - * ext/msql/msql.c: Minor fix - - * ext/session/session.c: Fix TS version - - * ext/xml/xml.c - ext/yp/yp.c - ext/zlib/zlib.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/quot_print.c - ext/standard/rand.c - ext/standard/reg.c - ext/standard/soundex.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/type.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/sysvsem.c - ext/sysvshm/sysvshm.c - ext/standard/filestat.c - ext/standard/flock_compat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/image.c - ext/standard/info.c - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/md5.c - ext/standard/microtime.c - ext/session/mod_files.c - ext/session/session.c - ext/snmp/snmp.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/crypt.c - ext/standard/cyr_convert.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/pcre/php_pcre.c - ext/pdf/pdf.c - ext/pgsql/pgsql.c - ext/odbc/odbc.c - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/mysql/mysql.c - ext/oci8/oci8.c - ext/msql/msql.c - ext/interbase/interbase.c - ext/ldap/ldap.c - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/hyperwave/hw.c - ext/imap/imap.c - ext/hyperwave/hg_comm.c - ext/gd/gd.c - ext/gettext/gettext.c - ext/db/db.c - ext/dbase/dbase.c - ext/fdf/fdf.c - ext/filepro/filepro.c - ext/dav/dav.c - ext/bcmath/bcmath.c - ext/bcmath/number.c - ext/com/COM.c - ext/apache/apache.c - ext/aspell/aspell.c - mod_php4.h - output.c - output.h - php.h - php3_realpath.c - php3_realpath.h - php3_sprintf.c - php_globals.h - php_ini.c - php_ini.h - request_info.c - request_info.h - rfc1867.c - safe_mode.c - snprintf.h - SAPI.h - cgi_main.c - configuration-parser.y - configuration-scanner.l - fhttpd.c - fopen-wrappers.c - fopen-wrappers.h - internal_functions_registry.h - internal_functions_win32.c - main.c - main.h - mod_php4.c - SAPI.c: License update - -1999-07-15 Sascha Schumann - - * ext/session/session.c: define sid to "", if we are in cookie mode - - * ext/session/php_session.h - ext/session/session.c: we don't need php_sid - - * ext/session/mod_files.c: that should be included 1st - - * ext/session/session.c: define SID appropiately - -1999-07-15 Andi Gutmans - - * mod_php4.c: *** empty log message *** - -1999-07-15 Sascha Schumann - - * ext/session/php_session.h: that should be included 1st - -1999-07-15 Andi Gutmans - - * mod_php4.c: *** empty log message *** - - * CHANGES - CHANGES-3.0 - README.WIN32: More 3->4 changes - - * INSTALL - mod_php4.c - php4dllts.dsp: * PHP 3.0 -> 4.0 changes - * Add php_admin Apache directives - - * scripts/apache/apconf-conv.sh - scripts/apache/aphtaccess-conv.sh - scripts/apache/conffix.awk - scripts/apache/htaccessfix.awk: Sooner than you think, Sascha :) - - * php.ini-dist - php3.ini-dist: *** empty log message *** - -1999-07-15 Andrei Zmievski - - * ext/aspell/.cvsignore: Added .cvsignore - -1999-07-15 Rasmus Lerdorf - - * ext/imap/config.m4: A useless check - -1999-07-14 Zeev Suraski - - * ext/standard/info.c - serverapi/cgi_sapi.c: php3.ini -> php.ini - - * ext/standard/info.c - logos.h - main.c - php_version.h - configure.in.in: * Update logos - * Move from PreAlpha 1 to Beta 1. - -1999-07-14 Rasmus Lerdorf - - * ext/apache/apache.c: How did this ever work without this #define ? - - * ext/mysql/config.m4: Remove some useless stuff - - * ext/imap/config.m4: Fix imap build problem - - * LICENSE: Small grammar fix - -1999-07-14 Andi Gutmans - - * LICENSE - php4dllts.dsp: *** empty log message *** - - * ext/apache/apache.c - ext/standard/basic_functions.c - ext/standard/info.c - ext/standard/info.h - LICENSE - cgi_main.c - php_ini.c: - Add a bitwise flag to phpinfo() - - Import a draft of the new PHP license - -1999-07-14 Rasmus Lerdorf - - * ext/imap/config.m4: - Fix logic here - the error message was bogus when it couldn't find the - imap lib - - * configure.in.in: Woops, this was in the wrong place - -1999-07-14 Zeev Suraski - - * mod_php4.c: change php4_value and php4_flag to php_value and php_flag - -1999-07-13 Thies C. Arntzen - - * MODULES_STATUS: *** empty log message *** - -1999-07-12 Sascha Schumann - - * build-defs.h.in: add some which are always substituted - -1999-07-12 Rasmus Lerdorf - - * MODULES_STATUS: - Tested imap, and had a look at ldap. ldap should be working, but my - ldap server is currently in a box. - - * regex/regex.h - ext/aspell/aspell.c - ext/aspell/config.h.stub - ext/aspell/config.m4 - ext/aspell/php3_aspell.h - MODULES_STATUS: Finish porting aspell - tested and works ok now - -1999-07-12 Sascha Schumann - - * MODULES_STATUS: update - -1999-07-12 Andrei Zmievski - - * ext/pcre/config.m4 - MODULES_STATUS: *** empty log message *** - -1999-07-12 Andi Gutmans - - * MODULES_STATUS: *** empty log message *** - -1999-07-12 Sascha Schumann - - * ChangeLog.TODO: test commit (new format inspired by FreeBSD cvs-all) - -1999-07-12 Thies C. Arntzen - - * mod_php4.c: destructors should return 1, shouldn't they? - - * ext/oracle/oracle.c: par with 3.0 - - * ext/oci8/oci8.c: fixed mem-problem - - * ext/oci8/oci8.c: small php4 fixes - -1999-07-11 Sascha Schumann - - * acinclude.m4: typo - - * acinclude.m4 - configure.in.in - libphp4.module.in: merge in some autoconf stuff - -1999-07-09 Zeev Suraski - - * ext/standard/var.c - ext/xml/xml.c - php4isapi/php4isapi.c - ext/com/COM.c - ext/oci8/oci8.c - ext/oracle/oracle.c - ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/iptc.c - ext/standard/post.c - main.c - rfc1867.c: Don't touch refcount and EA directly - - * ext/xml/xml.c - php4isapi/php4isapi.c - ext/oracle/oracle.c - ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/fsock.c - ext/standard/iptc.c - ext/standard/post.c - ext/standard/var.c - ext/com/COM.c - ext/oci8/oci8.c - main.c - rfc1867.c: Step 2: - Rename is_ref to EA - - * ext/pcre/php_pcre.c - ext/standard/basic_functions.c - ext/standard/reg.c - configuration-parser.y: Step 1 in nuking the garbage collector: - - Change the hash destructor to return int - -1999-07-09 Rasmus Lerdorf - - * ext/aspell/Makefile.am - ext/aspell/aspell.c - ext/aspell/config.h.stub - ext/aspell/config.m4 - ext/aspell/php3_aspell.h: Add Aspell module - -1999-07-08 Andrei Zmievski - - * foo - foo2 - foo3 - foo4 - recurse - tests/foo - tests/foo2 - tests/foo3 - tests/foo4 - tests/recurse: More cleanup. - - * ext/pcre/php_pcre.c - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tests/test.php4 - tests/test.pl - tests/test_class_inheritance - tests/testarray - tests/testarray.pl - tests/testarray2 - tests/testarray2.pl - tests/testclassfunc - tests/testcom - tests/testfe - tests/testfunc - tests/testfunc.pl - tests/testfunc2 - tests/testfunc2.pl - tests/testfuncref - tests/testinclude - tests/testobj: Reduce clutter a bit. - -1999-07-08 Zeev Suraski - - * php.h: *** empty log message *** - - * main.c: Avoid sending NULL argument to printf - -1999-07-08 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: on par with latest php3 - -1999-07-07 Andrei Zmievski - - * ext/session/session.c: - Fix a memory leak by not allowing session_start() to be called more than once. - -1999-07-06 Sascha Schumann - - * build-defs.h.in: add sendmail - -1999-07-06 Zeev Suraski - - * config.w32.h - ext/pcre/php_pcre.c - internal_functions_win32.c - php4dll.dsp - php4dllts.dsp: Support PCRE under Win32 - - * ext/pcre/pcre.c - ext/pcre/php_pcre.c - ext/pcre/Makefile.am: avoid two copies of pcre.c in the repository - -1999-07-05 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: Correct option caching - -1999-07-05 Thies C. Arntzen - - * ext/oci8/oci8.c: ups - - * ext/oci8/oci8.c: fixed mem-leak - - * ext/standard/basic_functions.c - ext/standard/iptc.c - ext/standard/php3_iptc.h: ported IPTC fro php3 - - * ext/oracle/oracle.c: added RESOURCE-returning - - * ext/oci8/oci8.c: up to php3 version - returns resources now! - -1999-07-04 Thies C. Arntzen - - * ext/xml/xml.c: updated to latest php3 - -1999-07-03 Zeev Suraski - - * ext/session/mod_files.c: *** empty log message *** - - * main.c: Support x-httpd-php-source - -1999-07-03 Sascha Schumann - - * Makefile.in: *** empty log message *** - - * Makefile.in: remove cvsignore files as well - - * Makefile.in: 'make dist' builds an easy distributable tarball - - * ext/session/mod_files.c: add missing include - - * ext/Makefile.am: ignore this - - * mod_php4.c: would be logical to enable display source mode - - * scripts/armerge: ar t is a little bit noisy on Rhapsody - - * build-defs.h.in: almost no config.m4 substitutes these anymore. - - * php.h: work around the Apache problem that it pollutes the namespace - - * ext/Makefile.am: there must be a better way - - * configure.in.in: let's start OS X hacking - -1999-07-02 Sascha Schumann - - * ChangeLog: .. - - * ChangeLog: ... - - * ChangeLog: . - - * ChangeLog: test commit - -1999-07-02 Thies C. Arntzen - - * ext/xml/xml.c: added some refcount stuff - - * ext/xml/php3_xml.h - ext/xml/xml.c: losses memory like hell, but seems to work! - - 3 things (this is a bad hack as of now!): - - xml.c uses _php3_strtoupper - is #include "../standard/php3_string.h" the right way to get the prototype? - - - i've copied php3i_long_pval/php3i_string_pval from the php3 tree into - xml.c (this is defnetly WRONG, but where do i find those?) - - - as php3tls_pval_destructor is not available in zend, i've - #define php3tls_pval_destructor(a) pval_destructor(a) which is maybe not what we want! - -1999-07-02 Sascha Schumann - - * ext/standard/crypt.c: fix from php3 - - * configure.in.in: suppress No such file or directory - -1999-07-01 Sascha Schumann - - * ext/sybase/config.m4: - someone please try whether the autoconf stuff works - for sybase and sybase-ct - I've neither one. - - * ext/sybase/sybase.c: maybe fix, following Joey's description - - * ext/zlib/config.m4: --with-zlib should work now - -1999-07-01 Thies C. Arntzen - - * ext/standard/var.c: changed boolean behaviour: - - var_dump( - -1999-07-01 Sascha Schumann - - * ext/standard/php3_var.h - ext/standard/var.c: some additional consts - - * regex/Makefile.in: vpath thingie - - * ext/session/php_session.h - ext/session/session.c: - implement a simple API in the case someone wants to define his/her own serialization stuff - -1999-06-29 Zeev Suraski - - * ext/session/session.c: - No need for a PSLS_FETCH() if PSLS_D/PSLS_DC are supplied as function arguments - -1999-06-29 Andrei Zmievski - - * ext/session/session.c: *** empty log message *** - - * ext/session/php_session.h - ext/session/session.c: Added session expiration. - -1999-06-29 Thies C. Arntzen - - * ext/oracle/oracle.c - ext/oracle/php3_oracle.h: synced with 3.0.11 - ora_bind works! - -1999-06-28 Zeev Suraski - - * request_info.c: No need for that either... - -1999-06-28 Rasmus Lerdorf - - * request_info.c: Don't break the tree - -1999-06-28 Andrei Zmievski - - * ext/session/php_session.h - ext/session/session.c: Added session_is_registered(varname) function. - - * ext/mysql/mysql.c: - Ported MYSQL_NUM, MYSQL_ASSOC, and MYSQL_BOTH additions from php3. - - * ext/standard/basic_functions.c: oops - - * ext/standard/basic_functions.c: *** empty log message *** - -1999-06-28 Sascha Schumann - - * acinclude.m4: work around that solaris bug - - * Makefile.in: ugly and working - - * Makefile.in: BSD derived tests want -h for symlink test - -1999-06-27 Sascha Schumann - - * ext/mcrypt/mcrypt.c: port - - * ext/snmp/config.h.stub - ext/snmp/config.m4 - ext/snmp/snmp.c - ext/standard/base64.c - ext/standard/datetime.c - ext/standard/file.c: more porting - - * Makefile.in - configure.in.in - mod_php4.exp: port Rasmus' APXS changes for AIX - - * ext/dbase/dbase.c: port over from php3 - - * Makefile.in - configure.in.in: lex optimizations - - * ext/dbase/dbase.c: add dbase_replace_record - - * Makefile.in - acinclude.m4 - configure.in.in: port over autoconf fixes from php3 - -1999-06-26 Zeev Suraski - - * cgi_main.c - ext/standard/pageinfo.c - request_info.c: Win32/general patches - - * cgi_main.c - ext/standard/pageinfo.c - fopen-wrappers.c - request_info.c - request_info.h - safe_mode.c: * Get rid of another request_info element (filename) - * CGI through Apache should work now - - * ext/standard/fsock.h: *** empty log message *** - - * main.c: Protect against NULL arguments in filename - -1999-06-26 Sascha Schumann - - * acconfig.h.in - configure.in.in - php.h: add dmalloc - -1999-06-25 Sascha Schumann - - * Makefile.in: - APXS link thingie - - functions/ game obsolete. Should make compiling faster on slow machines (hi Kristian :-) - -1999-06-23 Andrei Zmievski - - * regex/engine.ih - regex/regcomp.ih - regex/regerror.ih: *** empty log message *** - -1999-06-22 Thies C. Arntzen - - * ext/standard/basic_functions.c: gettype now reports "boolean" correct - -1999-06-22 Andrei Zmievski - - * ext/standard/php3_string.h: Making function accessible. - - * ext/standard/string.c: Making the function accessible. - -1999-06-22 Zeev Suraski - - * main.c: Fix compile-time definition of track_vars default - -1999-06-22 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/pcrelib/internal.h: Made preg_split() consistent with split(). - Added a new /e modifier for preg_replace - Kill a warning in pcrelib. - -1999-06-22 Thies C. Arntzen - - * ext/standard/url.c: - urlencode and decode return an empty-string if the input-string is empty (matches php3 behaviour "more" closly) - Please read my previous mail and comment! - -1999-06-22 Stig Bakken - - * fopen-wrappers.c: cosmetics - -1999-06-22 Danny Heijl - - * ext/informix/ifx.ec: - Bad html in ifx_htmltbl_result(). - -1999-06-22 Stig Bakken - - * fopen-wrappers.c: fix some potential buffer overflows - -1999-06-21 Andrei Zmievski - - * ext/standard/reg.c: Backing out changes. - -1999-06-21 Thies C. Arntzen - - * ext/standard/string.c: fixed implode "again" - - -1999-06-20 Sascha Schumann - - * acinclude.m4: whoops, kill debugging message - - * ext/snmp/config.m4 - ext/mysql/config.m4 - ext/pgsql/config.m4 - ext/msql/config.m4 - ext/mcrypt/config.m4 - ext/mhash/config.m4 - ext/ldap/config.m4 - acinclude.m4 - configure.in.in - Makefile.in: Introduce AC_ADD_* macros - - The use of AC_EXPAND_PATH makes it possible to continue - to use relative paths when configuring PHP. - (e.g. --with-apache=../apache-1.3.x works again) - - * Makefile.in: avoid error message - - * acinclude.m4: use standard autoconf variables - -1999-06-19 Zeev Suraski - - * main.c: *** empty log message *** - - * main.c - php_ini.c - php_ini.h: Implement new get_ini_entry() for Zend - - * win32/sendmail.c - cgi_main.c - config.w32.h - configuration-parser.y: Use php.ini instead of php3.ini - - * ext/standard/fsock.c: *** empty log message *** - - * ext/standard/fsock.c - fopen-wrappers.h - php_globals.h - fopen-wrappers.c: Win32/ZTS compiles again - -1999-06-18 Andrei Zmievski - - * ext/standard/fsock.h: for struct sockaddr - -1999-06-18 Stig Bakken - - * fopen-wrappers.c: update php3 sync info - - * fopen-wrappers.c: - optimize php3_fopen_url_wrapper() a bit (fewer recv() and send() calls) - - * ext/standard/fsock.h - ext/standard/fsock.c: Apply Sascha's fsock fixes to php4. - - * fopen-wrappers.c: make CGI version work again - -1999-06-17 Sascha Schumann - - * configure.in.in: typo - -1999-06-17 Andrei Zmievski - - * configure.in.in: Need to check if it exists first. - -1999-06-17 Zeev Suraski - - * config.w32.h: Win32 patches (does not compile still) - -1999-06-16 Stig Bakken - - * fopen-wrappers.c: MIME headers may be 512 characters long. - - * win32/time.c - ext/standard/file.h - ext/standard/filestat.c - ext/standard/flock_compat.c - ext/standard/flock_compat.h - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/microtime.c - ext/standard/php3_string.h - ext/standard/string.c - acconfig.h.in - config.w32.h - configure.in.in - ext/standard/basic_functions.c - ext/standard/dir.c - ext/standard/file.c - fopen-wrappers.c - fopen-wrappers.h - main.c: * fixed some #if/#ifdef issues - * hand-patched in php3 changes from 3.0.6 to HEAD in these files: - fopen-wrappers.[ch] ext/standard/file.[ch] ext/standard/fsock.[ch] - ext/standard/php3_string.h ext/standard/string.c - * added some new file/socket macros for more readable code: - FP_FGETS(buf,len,sock,fp,issock) - FP_FREAD(buf,len,sock,fp,issock) - FP_FEOF(sock,fp,issock) - FP_FGETC(sock,fp,issock) - -1999-06-15 Stig Bakken - - * ext/standard/file.c: reversing another patch that slipped - - * ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/php3_string.h - ext/standard/string.c - ext/standard/file.c - ext/standard/file.h - fopen-wrappers.h - fopen-wrappers.c: * reverse fsock/string import patches - -1999-06-15 Zeev Suraski - - * php_globals.h: - Change four spaces back to tabs (Why the hell did you change the tabs to four spaces?!) - -1999-06-15 Stig Bakken - - * ext/standard/file.c - ext/standard/file.h - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/php3_string.h - ext/standard/string.c - ext/standard/var.c - cgi_main.c - fopen-wrappers.c - fopen-wrappers.h - php_globals.h: * now using php4.ini instead of php3.ini - * re-imported fopen-wrappers, fsock and string code from php3 - NB! I have not tested all of the imported functions yet. - - * ext/session/.cvsignore - .cvsignore: fix some .cvsignore files - -1999-06-15 Rasmus Lerdorf - - * ext/standard/datetime.c: gmmktime() fix - -1999-06-14 Andrei Zmievski - - * buildconf: Need to test for directory. - -1999-06-14 Stig Bakken - - * buildconf: make symlinks if they are not present already - -1999-06-12 Zeev Suraski - - * ext/standard/mime.h - ext/standard/php3_standard.h - SAPI.c - SAPI.h - ext/standard/Makefile.am - ext/standard/mime.c - php4dllts.dsp - rfc1867.c: - First attempt at moving the old RFC1867 support to the right place - -1999-06-11 Sascha Schumann - - * ext/standard/var.c: it's obj.properties, not ht - -1999-06-11 Andrei Zmievski - - * ext/standard/var.c: Fix up var.c a bit. - -1999-06-11 Rasmus Lerdorf - - * ext/standard/crypt.c: Same Fix here - -1999-06-11 Stig Bakken - - * configure.in.in: append DEBUG_CFLAGS to CFLAGS - -1999-06-11 Zeev Suraski - - * main.c: Print out include_path in include/require failures - - * ext/session/mod_files.c - ext/session/php_session.h - ext/session/session.c - ext/standard/basic_functions.c - ext/standard/file.c - main.c: * Fix a buglet in the session module - * Make some renames in the session module - avoid having a function called 'delete' - so that we don't piss any C++ compilers. Also rename the {startup,shutdown}_globals - to {startup,shutdown}_session_globals, so that they're a bit less general names, - and made them static. - * Remove uselss variables - -1999-06-10 Sascha Schumann - - * ext/standard/var.c: make serialize work - unserialize does not work yet - -1999-06-10 Andrei Zmievski - - * ext/standard/var.c: Fixing serialize a bit. - - * ext/standard/basic_functions.c - ext/pcre/pcre.c - ext/pcre/php_pcre.h: Added preg_grep() function. - -1999-06-10 Frank M. Kromann - - * win32/sendmail.c: - Sync. with php3. Only add Date: and From: if not supplied by user - -1999-06-09 Andrei Zmievski - - * ext/standard/basic_functions.c: Make array_shift/array_pop work better. - - * ext/pcre/pcre.c: A fix for a fix. - - * ext/pcre/pcre.c - ext/standard/basic_functions.c: Fixed a bug in preg_split. - Fixed a bug in array_shift/array_pop. - -1999-06-09 Thies C. Arntzen - - * ext/standard/string.c - ext/oci8/oci8.c: oci8 to 3.0.9 - implode works! - -1999-06-09 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: *** empty log message *** - - * ext/standard/reg.c - ext/pcre/pcre.c: Fixed a bug in preg_replace. - -1999-06-09 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: up to 3.0.9 - -1999-06-09 Danny Heijl - - * ext/informix/ifx.ec - ext/informix/php_informix.h: - - resync informix driver with php 3.09 version - -1999-06-07 Sascha Schumann - - * ext/session/session.c - ext/session/mod_files.c: - better scaling for large servers using many session ids - -1999-06-07 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Don't set is_ref in _phpi_splice() - More checking in array_merge() - Added keys() and values() array functions. - -1999-06-07 Sascha Schumann - - * ext/session/mod_files.c - ext/session/mod_files.h - ext/session/php_session.h - ext/session/session.c: - some cleanups - - add gc logic - - add session_destroy() - -1999-06-07 Zeev Suraski - - * ext/standard/reg.c: Fix an ereg_replace() crash bug - -1999-06-06 Zeev Suraski - - * ext/session/mod_files.c - ext/session/session.c - php4dllts.dsp: - Fix PSLS issues - - Add a standard info function for the session module (use them!) - - Replace PATH_MAX with MAXPATHLEN (that's our platform indepedent constant) - -1999-06-06 Sascha Schumann - - * ext/session/session.c: one C too much - - * ext/session/session.c: - avoid unnecessary PSLS_FETCH() in internal functions - -1999-06-06 Andi Gutmans - - * ext/session/session.c: -Init tsrm on minit - - * ext/session/session.c: - Use PS() everywhere. - - * ext/session/session.c: - - Make sessions compile on win32 but it still doesn't link. - - * ext/session/session.c - php4dllts.dsp: - - Add some *_FETCH()'s. Still some work to be done so that it'll compile on win32. - -1999-06-06 Sascha Schumann - - * ext/session/php_session.h - ext/session/session.c: - s/encoded/encode/ - - new TODO entry - -1999-06-06 Andi Gutmans - - * ext/standard/basic_functions.c: - - Remove the is_ref =1 from the push() function. - -1999-06-06 Sascha Schumann - - * ext/session/session.c: add some protos - - * ext/session/session.c: add some thoughts - -1999-06-05 Sascha Schumann - - * ext/session/session.c: - auto startup when calling register - - auto startup using a configuration option - - * ext/session/session.c: moving start code into its own function - -1999-06-05 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added array_merge() function. - -1999-06-05 Sascha Schumann - - * ext/session/session.c: SAPI does not want line endings - -1999-06-05 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/reg.c: - Added push(), pop(), shift(), unshift(), splice(), and slice() array functions. - The first 5 work like their Perl counterparts. slice() returns a chunk of the array - specified by offset and length arguments. - - Backport to PHP3 and docs will be coming soon. - -1999-06-05 Sascha Schumann - - * ext/session/Makefile.am - ext/session/config.h.stub - ext/session/config.m4 - ext/session/mod_files.c - ext/session/mod_files.h - ext/session/modules.c - ext/session/php_session.h - ext/session/session.c - ext/session/setup.stub: first import of session module - -1999-06-05 Zeev Suraski - - * main.c: Move shutdown order into Zend - - * mod_php4.c: I got the order wrong earlier :I - - * ext/standard/reg.c: - Not sure that's the right fix, but at least it fixes the symptom - -1999-06-05 Sascha Schumann - - * ext/oci8/.cvsignore - ext/yp/.cvsignore - ext/pcre/pcrelib/.cvsignore: add some .cvsignores - -1999-06-04 Andrei Zmievski - - * ext/pcre/php_pcre.h - ext/pcre/pcre.c: Added preg_quote() function. - - * ext/pcre/pcre.c: *** empty log message *** - -1999-06-04 Zeev Suraski - - * ext/mysql/php3_mysql.h: Fix UNIX MySQL build - - * php3sapi.dsw - php3extra.dsw: Remove old workspaces - - * ext/mysql/Readme_w32.txt - ext/mysql/mysql.c - ext/mysql/mysql.dsp - ext/mysql/php3_mysql.h - config.w32.h - php.h - php4ext.dsw - php_globals.h - php_ini.c - php_ini.h: * Add a new workspace for dynamic PHP extensions. - * Add a few functions to PHP's API. - * Get the MySQL extension up-to-date and thread safe. - * Add a project for building the MySQL extension under Win32. - -1999-06-01 Andrei Zmievski - - * ext/standard/Makefile.am: function dir doesn't exist anymore - - * ext/pcre/config.m4: *** empty log message *** - -1999-06-01 Sascha Schumann - - * scripts/armerge: avoid touching libraries which have not changed - -1999-06-01 Andi Gutmans - - * ext/standard/exec.c: - Fix for exec to use API - -1999-05-31 Zeev Suraski - - * main.c - php4dll.dsp: thread-safety fix - -1999-05-31 Andi Gutmans - - * ext/standard/browscap.c: *** empty log message *** - -1999-05-31 Zeev Suraski - - * main.c: *** empty log message *** - -1999-05-30 Andrei Zmievski - - * ext/pcre/pcre.c: - preg_match_all() now returns the number of global matches. - -1999-05-30 Sascha Schumann - - * main.c - php_ini.c: kill some warnings - - * ext/standard/browscap.c: zend_hash_merge was changed - -1999-05-29 Andrei Zmievski - - * ext/pcre/pcre.c: Updated preg_split(). - - * ext/pcre/pcre.c: Fix preg_match_all to do proper matching with \b. - - * ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/pcre.c: - Fixed PCRE so that global matching with patterns with \b works. - -1999-05-29 Zeev Suraski - - * Makefile.in - libphp4.module.in - mod_php4.c: - * Changed the way INI entries work in Apache to allow .conf entries to work right too. - * vpath fixes for standard Apache build - - * ext/standard/browscap.c - testobj: Fix - -1999-05-29 Sascha Schumann - - * regex/Makefile.in: more VPATH work - - * SAPI.c: kill warning - - * Makefile.in - configure.in.in: - fix APXS VPATH build - - libzend/TSRM build in their own directories - - ext/Makefile was generated twice - - ****NOTE****** - - If you use any kind of VPATH, you need to do a "make distclean" in your - libzend/TSRM directory, before running configure again. - -1999-05-29 Zeev Suraski - - * mod_php4.c: - avoid crashing with php4 directives in .conf files (they still don't work) - - * scripts/preconfig - Makefile.in: fixes - -1999-05-29 Sascha Schumann - - * serverapi/cgi_sapi.c - cgi_main.c - getopt.c - getopt.h - main.c - php_getopt.h: getopt.h conflicted with system include file - - * ext/pgsql/pgsql.c: . - -1999-05-28 Zeev Suraski - - * mod_php4.c: no need for those - - * SAPI.c - configure.in.in - ext/pcre/config.m4 - mod_php4.c - rfc1867.c: * Get Apache module to compile again with the regex stuff. - * Get Apache to propertly work with POST, and some SAPI fixes - -1999-05-28 Sascha Schumann - - * ext/standard/var.c: that seems to fix it - - * ext/standard/var.c: - Either I'm playing the EG(symbol_table) game wrong or var.c leaks memory - when unserializing arrays/objects. Still testing - -1999-05-28 Andrei Zmievski - - * ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h: - -Modified PCRE library slightly to do what needs to be done - -Updated preg_replace() code to handle stuff properly - -Removed ability to specify external PCRE library source to link against - (since our bundled version is patched now) - -1999-05-28 Sascha Schumann - - * apidoc.txt: I think that is the preferred way as of now - -1999-05-28 Zeev Suraski - - * ext/mysql/mysql.c: *** empty log message *** - - * ext/com/COM.c - ext/standard/basic_functions.c - ext/standard/dir.c - main.c - testobj: * Use new Zend macros for standardized definition of classes. - * Reverse bogus shutdown order. - * Use the new object/class support of Zend to make the dir functions work again. - -1999-05-28 Rasmus Lerdorf - - * Makefile.in - main.c - main.h - mod_php4.c - mod_php4.h: Some innocent cleanups - -1999-05-27 Andrei Zmievski - - * ext/pcre/config.m4: We don't need those there. - - * ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h: - Really fix the configuration now so that it's possible to compile both - against the bundled PCRE library and the one external to the source tree. - Crossing my fingers while Zeev compiles this. :) - -1999-05-27 Stig Bakken - - * configure.in.in - scripts/preconfig: self-contained extensions please :-) - -1999-05-27 Zeev Suraski - - * main.c: - Generate Visual Studio compatible error messages when compiling under Win32 - -1999-05-27 Sascha Schumann - - * ext/pcre/pcrelib/Makefile - ext/pcre/pcrelib/Makefile.am - ext/xml/xml.c - configure.in.in - ext/pcre/Makefile.am - ext/pcre/config.m4: - fix CGI build (at least) - - * Makefile.in: add rfc1867.c - -1999-05-27 Zeev Suraski - - * ext/pcre/php_pcre.h: Fix pcre build - - * php.h: Moved all SET_ and RETURN_ macros to Zend - Fixed all RETVAL_ macros - -1999-05-26 Andrei Zmievski - - * ext/pcre/pcrelib/ChangeLog - ext/pcre/pcrelib/LICENCE - ext/pcre/pcrelib/Makefile - ext/pcre/pcrelib/README - ext/pcre/pcrelib/RunTest - ext/pcre/pcrelib/Tech.Notes - ext/pcre/pcrelib/chartables.c - ext/pcre/pcrelib/dftables.c - ext/pcre/pcrelib/get.c - ext/pcre/pcrelib/internal.h - ext/pcre/pcrelib/maketables.c - ext/pcre/pcrelib/pcre.3 - ext/pcre/pcrelib/pcre.c - ext/pcre/pcrelib/pcre.h - ext/pcre/pcrelib/pcreposix.3 - ext/pcre/pcrelib/pcreposix.c - ext/pcre/pcrelib/pcreposix.h - ext/pcre/pcrelib/pcretest.c - ext/pcre/pcrelib/perltest - ext/pcre/pcrelib/pgrep.1 - ext/pcre/pcrelib/pgrep.c - ext/pcre/pcrelib/study.c - ext/pcre/pcrelib/testinput1 - ext/pcre/pcrelib/testinput2 - ext/pcre/pcrelib/testinput3 - ext/pcre/pcrelib/testinput4 - ext/pcre/pcrelib/testoutput1 - ext/pcre/pcrelib/testoutput2 - ext/pcre/pcrelib/testoutput3 - ext/pcre/pcrelib/testoutput4 - ext/pcre/Makefile.am - ext/pcre/config.m4 - ext/pcre/setup.stub: -Added PCRE library source - -Updated configuration process - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: Added preg_split. Same syntax as regular split(). - - * ext/standard/reg.c: Fixing a couple of long standing bugs. - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: A few changes here. - - First of all, as per extensive discussion on the list, the functions are now - prefixed with "preg" instead of "pcre". - - Secondly, global matching is now possible using preg_match_all. Please, give - suggestions on a better name if this one doesn't sit well with you. Possible - names are preg_global_match and preg_gmatch. - - preg_match_all takes 4 arguments: a regex pattern, a subject string, - the array for capturing subpatterns, and a parameter that tells how the results - in the subpatterns array are arranged. - - Basically, preg_match_all will go through the subject string and try to capture - all the matches that it finds, not just the first one like preg_match. - - 4th parameter can be PREG_PATTERN_ORDER (default) or PREG_SET_ORDER. - - Example: - preg_match_all("|]+)>|", "
a test
", $out, PREG_PATTERN_ORDER); - - This returns results so that $out[0] is an array of full pattern matches, $out[1] is an array - of first captured subpattern matches, and so on. - - $out[0] -> ("
", "
") - $out[1] -> ("div align=left", "div") - - Example: - preg_match_all("|]+)>|", "
a test
", $out, PREG_SET_ORDER); - - This returns results so that $out[0] is an array of first full pattern match and subpatterns, - $out[1] is an array of second full pattern match and subpatterns. - - $out[0] -> ("
", "div align=left") - $out[1] -> ("
", "div") - - If anyone has a better name for these PREG_ constants and also which one should be the default, - I'd like to hear it. - -1999-05-25 Zeev Suraski - - * SAPI.c - SAPI.h - php4dllts.dsp - rfc1867.c - rfc1867.h: - Add container for file-upload. It's not quite implemented yet. - -1999-05-25 Andrei Zmievski - - * ext/standard/basic_functions.c: Just a little sanity check. - -1999-05-25 Zeev Suraski - - * SAPI.c - SAPI.h: Allow unregistering content types as well. - - * SAPI.h - php4isapi/php4isapi.c - SAPI.c: - * Add generic POST content-type support. Only application/x-www-form-urlencoded - supported at this time, but the framework allows for any other types, including - runtime addition of types. - - * php4isapi/php4isapi.c: Load all ISAPI request headers as variables - -1999-05-24 Zeev Suraski - - * internal_functions_win32.c: include regex in Win32 build - -1999-05-23 Zeev Suraski - - * ext/standard/dns.c: Thou shalt use the API, and thou shalt be safe - -1999-05-22 Andrei Zmievski - - * ext/pcre/pcre.c: Some comments. - -1999-05-22 Sascha Schumann - - * configure.in.in: - add -lregex - - change module name to php4 - -1999-05-22 Andrei Zmievski - - * ext/pcre/pcre.c: Added ability to pass array parameters to pcre_replace. - -1999-05-22 Sascha Schumann - - * Makefile.in: add a $(srcdir) - - * ext/xml/php3_xml.h - ext/xml/xml.c - ext/ldap/php3_ldap.h: fix compile issues in LDAP/XML exts - - * Makefile.in: fix APXS compile - -1999-05-22 Zeev Suraski - - * php_ini.c - main.c: More fixes. Should hopefully work well now. - - * php_ini.c: php_ini fixes - - * cgi_main.c - main.c: * Minor fixes - * Better handling for multiple repeated memory leaks (libzend updated) - - * ext/apache/apache.c - apMakefile.tmpl - apidoc-zend.txt - apidoc.txt - configure.in.in - libphp3.module.in - libphp4.module.in - main.c - mod_php3.c - mod_php3.h - mod_php4.c - mod_php4.h - .cvsignore - ChangeLog - INSTALL - Makefile.in: Time to rename the child - - * main.c: Small fix - -1999-05-21 Zeev Suraski - - * php_ini.c: Fix a memory leak - - * SAPI.c - cgi_main.c - php4isapi/php4isapi.c: This should be centralized... - -1999-05-21 Sascha Schumann - - * ext/mhash/mhash.c - ext/mhash/php_mhash.h - ext/mhash/config.m4: add support for mhash 0.5.0 - - see http://sasweb.de/mhash/ - -1999-05-21 Andrei Zmievski - - * ext/pcre/pcre.c - ext/pcre/php_pcre.h: -Added regex cache - -Made module thread-safe - -1999-05-21 Zeev Suraski - - * cgi_main.c - main.c: * Fix error handling startup on the thread-safe CGI version - * A failed require() is a compile-time error, consider it as one - -1999-05-21 Andrei Zmievski - - * ext/pcre/pcre.c: Get rid of debug printf's. - - * ext/pcre/.cvsignore - ext/pcre/Makefile.am - ext/pcre/config.h.stub - ext/pcre/config.m4 - ext/pcre/pcre.c - ext/pcre/php_pcre.h - ext/pcre/setup.stub: - Initial check-in of PCRE (Perl Compatible Regular Expressions) extension. - - PCRE library can be found at ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/ - - config.m4 will be updated to be more robust later on. - - perl_match() takes a regular expression, the source string, and the array - for subpattern matches. - - perl_replace() takes a regular expression, the search string, and the replacement - string. - - Regular expression is specified using delimiters and options. Example: - - perl_match("/<[a-z]*>/i", $text, $tags); - - More stuff is coming soon. - -1999-05-21 Sascha Schumann - - * ext/zlib/php3_zlib.h - ext/zlib/zlib.c - ext/sysvshm/sysvshm.c - ext/xml/php3_xml.h - ext/xml/xml.c - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvsem/php3_sysvsem.h - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/snmp/php3_snmp.h - ext/snmp/snmp.c - ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pdf/php3_pdf.h - ext/oracle/php3_oracle.h - ext/pdf/pdf.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oracle.c - ext/odbc/odbc.c - ext/mysql/php3_mysql.h - ext/oci8/oci8.c - ext/mysql/mysql.c - ext/msql/php3_msql.h - ext/msql/msql.c - ext/ldap/php3_ldap.h - ext/ldap/ldap.c - ext/interbase/php3_interbase.h - ext/interbase/interbase.c - ext/informix/php_informix.h - ext/informix/readme.ifx - ext/informix/ifx.ec - ext/informix/php3_ifx.h - ext/imap/imap.h - ext/hyperwave/hw.h - ext/imap/imap.c - ext/gettext/php3_gettext.h - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/gd/php3_gd.h - ext/gettext/gettext.c - ext/filepro/filepro.h - ext/filepro/php_filepro.h - ext/gd/gd.c - ext/filepro/filepro.c - ext/fdf/php3_fdf.h - ext/dbase/dbase.c - ext/dbase/dbf_head.h - ext/dbase/dbf_misc.h - ext/dbase/dbf_rec.h - ext/dbase/php_dbase.h - ext/fdf/fdf.c - ext/db/db.c - ext/db/php3_db.h - ext/dav/php3_dav.h - ext/com/php3_COM.h - ext/bcmath/bcmath.c - ext/bcmath/number.h - ext/bcmath/php3_bcmath.h - ext/com/COM.c - ext/apache/apache.c - ChangeLog.TODO - genif.sh: - run ext sources through conv_proto - - add necessary phpext_*_ptr - - * ext/standard/microtime.c - ChangeLog.TODO: merge in some PHP3 stuff - - * ext/yp/Makefile.am - ext/yp/config.h.stub - ext/yp/config.m4 - ext/yp/php3_yp.h - ext/yp/setup.stub - ext/yp/yp.c: incorporate YP/NIS support - - * ext/zlib/php3_zlib.h - ext/mcrypt/mcrypt.c - ext/mhash/mhash.c - ext/sysvsem/php3_sysvsem.h - ext/sysvsem/sysvsem.c - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/sysvshm.c - ext/dbase/dbase.c - ext/dbase/dbase.h - ext/dbase/php_dbase.h - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/mcrypt/config.m4: - - fix compile issues for various packages (dbase, sysv*, zlib) - - some cleanup in mhash/mcrypt - - * ext/pgsql/php3_pgsql.h - ext/sysvsem/sysvsem.c: - add phpext_pgsql_ptr - - semaphore update for glibc-2.1 systems - - * ext/mysql/config.m4: Add default path for binary mysql distributions - - * ext/standard/reg.c: remove debug messages - -1999-05-20 Zeev Suraski - - * main.c: Use OutputDebugString() or fprintf(stderr,) for memory leaks - -1999-05-20 Sascha Schumann - - * ext/standard/file.c - ext/standard/fsock.c - ext/standard/fsock.h: Apply the fix for feof() - -1999-05-20 Andi Gutmans - - * ext/standard/info.c - php4isapi/php4isapi.dsp - config.w32.h - configuration-parser.y - php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: - Small fixes - -1999-05-16 Sascha Schumann - - * ext/mhash/.cvsignore - ext/mhash/Makefile.am - ext/mhash/config.h.stub - ext/mhash/config.m4 - ext/mhash/mhash.c - ext/mhash/php_mhash.h - ext/mhash/setup.stub: add mhash support - - * ext/standard/global.h - configure.in.in: kill another 64-bit issue. - this affected at least md5 which produced wrong values on 64-bit platforms - - * ext/standard/string.c: char * => unsigned char * - - * ext/standard/filestat.c - ext/standard/fsock.h - ext/standard/head.c - ext/standard/head.h - ext/standard/html.c - ext/standard/html.h - ext/standard/image.c - ext/standard/image.h - ext/standard/info.c - ext/standard/info.h - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/md5.h - ext/standard/microtime.c - ext/standard/microtime.h - ext/standard/mime.h - ext/standard/pack.h - ext/standard/pageinfo.c - ext/standard/pageinfo.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_iptc.h - ext/standard/php3_link.h - ext/standard/php3_mail.h - ext/standard/php3_string.h - ext/standard/php3_syslog.h - ext/standard/phpdir.h - ext/standard/phpmath.h - ext/standard/quot_print.c - ext/standard/quot_print.h - ext/standard/rand.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/uniqid.c - ext/standard/uniqid.h - ext/standard/url.c - ext/standard/url.h - ext/standard/base64.c - ext/standard/base64.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - 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.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: conv_proto *.[ch] - - * scripts/conv_proto: - this script automatically converts the ugly void php3_... prototypes - to PHP_FUNCTION(...) prototypes. Also kills some unnecessary extern - declarations in front of function prototypes. - - * ext/standard/php3_string.h - ext/standard/string.c: add fast bin2hex string function - - * ext/standard/file.c: kill some compiler warnings - -1999-05-15 Zeev Suraski - - * internal_functions_win32.c: *** empty log message *** - -1999-05-14 Zeev Suraski - - * ext/standard/basic_functions.c - ext/standard/dl.h - ext/standard/file.h - ext/standard/fsock.h - ext/standard/head.h - ext/standard/pack.h - ext/standard/php3_browscap.h - ext/standard/php3_crypt.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_mail.h - ext/standard/php3_syslog.h - ext/mysql/mysql.c - internal_functions.c.in: - * Include all of the standard modules in internal_functions.c.in. Stig - is that - the way you intended it to be? How does the basic_functions module get in there? - * Fix to get MySQL objects working, even though I'll probably make a dedicated - MySQL object in the future. - -1999-05-13 Zeev Suraski - - * ext/standard/reg.c - ext/standard/reg.h - main.c: * HTTP-auth bugfix - * Patch the regex thread safe code to compile in thread safe mode - -1999-05-12 Zeev Suraski - - * ext/standard/post.c - mod_php3.c: Enable Apache HTTP Auth - - * main.c - php4isapi/php4isapi.c - SAPI.c: - Support HTTP Auth under ISAPI. Now, these short pieces of code took *A LOT* of - research :( - -1999-05-12 Andrei Zmievski - - * ext/standard/basic_functions.c: It's been there long enough. - -1999-05-12 Zeev Suraski - - * php4isapi/php4isapi.c: Minor patches - -1999-05-12 Thies C. Arntzen - - * ext/oci8/php3_oci8.h: compiles - - * php3_compat.h: added _php3_hash_next_index_pointer_insert - -1999-05-12 Sascha Schumann - - * ext/standard/reg.c - ext/standard/reg.h - ext/standard/string.c - internal_functions.c.in: - regex cache (needs some work) - - str_replace changes from php3 - -1999-05-12 Thies C. Arntzen - - * ext/oci8/oci8.c - ext/oci8/php3_oci8.h: up-to-date with 3.0.8 - - * ext/oci8/Makefile.am - ext/oci8/config.h.stub - ext/oci8/config.m4 - ext/oci8/oci8.c - ext/oci8/php3_oci8.h - ext/oci8/setup.stub - ext/oracle/Makefile.am - ext/oracle/config.h.stub - ext/oracle/oci8.c - ext/oracle/php3_oci8.h: - move oci8 from oracle to it's own ext-directory - configure stuff needs more work - but it configures and compiles - - * ext/oracle/oracle.c - ext/oracle/oracle.h - ext/oracle/php3_oracle.h: builds and configures again - -1999-05-12 Rasmus Lerdorf - - * ext/standard/string.c: substr() fix - - * ext/standard/string.c: substr() fix for PHP4 as well - -1999-05-11 Zeev Suraski - - * php4isapi/php4isapi.c - php4isapi/php4isapi.def - ext/standard/head.c - ext/standard/head.h - SAPI.h - cgi_main.c - php4dllts.dsp - SAPI.c: * Finally commit that -q patch - * Refine SAPI built in header support - * Use DllMain() in ISAPI to clean after threads and initialize tsrm/sapi as soon as possible. - -1999-05-11 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added compact() function. - -1999-05-11 Zeev Suraski - - * SAPI.c - mod_php3.c: Handle the Location: header centrally for all SAPI modules. - - * ext/standard/post.c - ext/standard/string.c - main.c - php_globals.h - php_ini.c: * Move unclean_shutdown from PHP to Zend. - * The Master/Local headers in the phpinfo() table were reversed. - * Fix a gpc bug - - * mod_php3.c: Support POST in Apache - - * serverapi/isapi_sapi.c - ext/apache/apache.c - ext/standard/info.c - ext/standard/info.h - main.c - php_ini.c: beatify Apache's info func - - * mod_php3.c: Memory leak fix - - * ext/sysvshm/sysvshm.c - ext/sysvsem/sysvsem.c - ext/standard/browscap.c - ext/standard/post.c - ext/standard/reg.c - ext/standard/url.c - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/pgsql/pgsql.c - ext/hyperwave/hw.c - ext/interbase/interbase.c - ext/odbc/odbc.c - ext/gd/gdcache.c - ext/gd/gdttf.c - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - Makefile.in - alloca.c - configure.in.in - genif.sh - libphp3.module.in - main.c - mod_php3.c - php.h - php3_sprintf.c - php_regex.h - request_info.c - snprintf.c: * Get Apache to work. POST doesn't work yet. - * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for - the Apache module, so we can #include any php/Zend header. - * Rename config.h to php_config.h - -1999-05-10 Andrei Zmievski - - * ext/standard/basic_functions.c: Minor updates. - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: Added in_array() function. - - * cgi_main.c - main.c: A couple of fixes. - -1999-05-10 Zeev Suraski - - * SAPI.c - cgi_main.c - main.c - php_globals.h: Weed out all BoundsChecker-found bugs - -1999-05-09 Zeev Suraski - - * php4isapi/php4isapi.c - SAPI.c: Only read POST info if the request method is POST. - -1999-05-09 Andi Gutmans - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - cgi_main.c - ext/standard/basic_functions.c - ext/standard/post.c: - * Make read_post() read input by chunks instead of returning a single string. - This will allow us to efficiently support file upload through SAPI in the future. - * Fixes - -1999-05-09 Zeev Suraski - - * ext/apache/apache.c - ext/gd/gd.c - ext/gd/php3_gd.h - ext/standard/post.c - php_ini.h - request_info.c: A few other minor fixes - - * ext/standard/basic_functions.c - main.c - php4isapi/php4isapi.c: Several minor fixes - - * php4isapi/php4isapi.c - ext/zlib/php3_zlib.h - ext/zlib/zlib.c - ext/xml/xml.c - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/snmp/snmp.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/head.c - ext/standard/info.c - ext/standard/info.h - ext/standard/mail.c - ext/standard/php3_mail.h - ext/standard/post.c - ext/oracle/oracle.c - ext/oracle/oracle.h - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/snmp/php3_snmp.h - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/velocis.c - ext/oracle/oci8.c - ext/msql/php3_msql.h - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/msql/msql.c - ext/interbase/php3_interbase.h - ext/informix/php3_ifx.h - ext/interbase/interbase.c - ext/gettext/gettext.c - ext/gettext/php3_gettext.h - ext/hyperwave/hw.c - ext/hyperwave/hw.h - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/gd/gd.c - ext/dav/dav.c - ext/db/db.c - ext/db/php3_db.h - ext/apache/apache.c - ext/com/COM.c - SAPI.c - SAPI.h - cgi_main.c - dl/mssql/mssql.c - main.c - mod_php3.c - php_ini.c - php_ini.h - request_info.c - request_info.h: - * Finalizing the PHP version of SAPI. Support POST and cookies among other things. - * Fully implement ISAPI support - POST and cookies among other things. - * Almost completely rewrote phpinfo(). Allow modules to easily display their - information in phpinfo() without modifying phpinfo() itself (prototype for - the module info function was changed, thus the large amount of updated module - files). - * Initial extended SAPI support for Apache, completely untested. - * CGI now uses SAPI fully as well. - -1999-05-08 Sascha Schumann - - * genif.sh: get rid of the binary character, execute sed only once - - * genif.sh: this is faster than parsing the file line by line - -1999-05-08 Andrei Zmievski - - * ext/standard/basic_functions.c - ext/standard/basic_functions.h: -Added extract() function - -Added function_exists() function - - * ext/mysql/php3_mysql.h - configure.in.in - genif.sh: -fixed configure.in.in to use genif.sh instead of genif.pl - -fixed genif.sh - -updated php3_mysql.h to have phpext_mysql_ptr - -1999-05-06 Zeev Suraski - - * SAPI.c: Oh yeah, wrong license - - * SAPI.c - SAPI.h - cgi_main.c - main.c - php4isapi/php4isapi.c: * Get output buffering to work again - * Warn about adding header information after headers are sent - * Several fixes - -1999-05-06 Sascha Schumann - - * ext/mcrypt/php_mcrypt.h: add compat #define - - * genif.sh: - Do we really want to depend on Perl? Shell scripts are handy and run on - virtually every Unix box whereas Perl does not. I don't think Perl should - be required when actually configuring PHP4. Open to comments... - -1999-05-06 Zeev Suraski - - * ext/standard/info.c - ext/standard/post.c: - * Optimize _php3_parse_gpc_data() and clean it up, plus fix a couple of Zend related memory leaks in it - -1999-05-05 Zeev Suraski - - * SAPI.c - SAPI.h - Makefile.in: vpath fix - Apache compatability fix - - * php4isapi/php4isapi.c - ext/standard/basic_functions.c - ext/standard/head.c - main.c - SAPI.c: Fixes - - * SAPI.h: fix - - * php4isapi/php4isapi.c - ext/standard/head.c - SAPI.c - SAPI.h - cgi_main.c - main.c - main.h - output.c - output.h: Get CGI to work with the new headers code. - Now Apache is the only interface that doesn't use it. - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - main.c - output.c: ISAPI WORKS! - -1999-05-05 Andi Gutmans - - * php4isapi/php4isapi.c - SAPI.c - SAPI.h - ext/standard/head.c - ext/standard/head.h - logos.h - main.c - output.c: Added initial headers support in SAPI - *untested* - It definitely broke the thread-safe CGI, it may have broken other stuff as well. - -1999-05-04 Zeev Suraski - - * internal_functions_win32.c - php4dll.dsp - php4dllts.dsp: Get Win32 to compile again - - * internal_functions_win32.c: - An initial default builtin modules file for Win32 - - * acconfig.h.in - configure.in.in: ZTS fixes - Stig - --enable-thread-safety belongs in libzend, since libzend doesn't #include config.h, whereas - PHP does #include zend_config.h - -1999-05-03 Zeev Suraski - - * configure.in.in - genif.pl: vpath patches (cool job Stig!) - -1999-05-03 Stig Bakken - - * scripts/armerge - ext/gd/php3_gd.h - ext/standard/php3_standard.h - ext/db/db.h - ext/db/php3_db.h - .cvsignore - Makefile.in - acconfig.h.in - acinclude.m4 - buildconf - configure.in.in - ext/bcmath/php3_bcmath.h - ext/db/db.c - foo - genif.pl - internal_functions.c - internal_functions.c.in - internal_functions_registry.h: * added --enable-thread-safety switch - * now generating internal_functions.c - -1999-05-02 Zeev Suraski - - * request_info.c: Get apache uptodate - - * php4isapi/php4isapi.c: Minor rearrangements - - * ext/hyperwave/hw.c - ext/standard/info.c - php4isapi/php4isapi.c - cgi_main.c - fopen-wrappers.c - main.c - request_info.c: Move path_info to the SAPI structure - - * SAPI.h - request_info.c - request_info.h: Get rid of request_info.path_translated - - * mod_php3.c: Apache compile fix - - * cgi_main.c: UNIX CGI build fix - -1999-05-02 Andi Gutmans - - * php4isapi/php4isapi.c - php4isapi/php4isapi.def - SAPI.c - SAPI.h - cgi_main.c - ext/hyperwave/hw.c - ext/standard/post.c - main.c - main.h - mod_php3.c - output.c - request_info.c - request_info.h: - Make ISAPI hook in as an extension too. - - Some work on moving stuff to SAPI. - -1999-05-01 Sascha Schumann - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: func name changes, remove arbitrary limit - - * ext/mcrypt/config.m4 - ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: mcrypt 2.1.18 support, better autoconf checking - -1999-04-30 Thies C. Arntzen - - * ext/oracle/oracle.c - ext/oracle/oracle.h: - forward port of current oracle.c + fixes to make it actually work;-)!!! - - * ext/oracle/config.m4: oracle links again (at least on linux!!!) - -1999-04-28 Zeev Suraski - - * ext/mysql/mysql.c: - Get the MySQL module to use the new INI mechanism feature - - * main.c: Remove redundant code - - * main.c - php_ini.c - php_ini.h: - Additional generalization of the INI mechanism. Avoid needing specialized - message handlers in 99% of the cases. - - * ext/standard/basic_functions.c - ext/odbc/odbc.c - ext/mysql/mysql.c - ext/apache/apache.c - ext/com/COM.c - main.c - php_ini.c - php_ini.h: A step towards generalizing the INI mechanism even more - - * ext/standard/basic_functions.c: get rid of some stupid warnings - -1999-04-28 Andi Gutmans - - * main.c: - Small startup fix. - -1999-04-27 Rasmus Lerdorf - - * ext/standard/file.c - ext/standard/file.h: Add fgetcsv() here as well - -1999-04-27 Zeev Suraski - - * php4isapi/php4isapi.dsp - configuration-parser.y - configuration-scanner.l - main.c - php4dll.dsp - php4dllts.dsp - php_globals.h: - * Get rid of the memory leak messages in case of fatal errors or exit() - * .dsp fixes - * Minor fixes - -1999-04-26 Zeev Suraski - - * ext/standard/basic_functions.c - main.c: * Small startup fix - * Fix min() and max() - - * Makefile.in - cgi_main.c: Temporary fix for CGI compilation under UNIX - - * configuration-parser.y - configuration-scanner.l - php4dll.dsp - php4dllts.dsp: - Somehow the rules for the configuration parser/scanners disappeared - -1999-04-26 Andrei Zmievski - - * acinclude.m4: Fixing a few thing to make AC_CHECK_CC_OPTION work. - -1999-04-26 Zeev Suraski - - * ext/sybase/sybase.c - ext/standard/basic_functions.c - ext/standard/exec.c - ext/standard/head.c - ext/standard/info.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/gd/gd.c - ext/gd/php3_gd.h - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - dl/mssql/mssql.c - ext/apache/apache.c - Makefile.in - SAPI.c - configure.in.in - fhttpd.c - main.c - mod_php3.c - php.h - request_info.c - safe_mode.c: * Get the Apache module to compile again - * Get rid of php3_rqst, use SG(server_context) instead (there's still Apache-specific code, - but it nuked a global) - - * php4.dsp - php4dll.dsp - php4dllts.dsp - php4ts.dsp: Match the CVS name - - * php4isapi/php4isapi.c - php4isapi/php4isapi.dsp - ext/standard/datetime.c - ext/standard/head.c - ext/standard/head.h - ext/standard/info.c - ext/standard/info.h - ext/standard/post.c - ext/standard/post.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - SAPI.c - SAPI.h - cgi_main.c - configuration-parser.y - fopen-wrappers.c - fopen-wrappers.h - getopt.c - getopt.h - main.c - main.h - mod_php3.c - output.c - output.h - php.h - php4.dsp - php4.dsw - php4dll.dsp - php4dllts.dsp - php4libts.dsp - php4ts.dsp - php4ts.dsw - php_globals.h - request_info.c - request_info.h: * Plenty of thread safety and Win32 work. - * Changed PHP4 to compile as a DLL, both ISAPI and the the CGI run with the same DLL. - * Switched to using the DLL runtime library under Win32. PHP will NOT work if - compiled against the static library! - * Removed yesterday's php4libts project (with php4dllts, it's obsolete). - - This *does* affect thread-unsafe Windows as well - the thread unsafe CGI is also - dependant on the thread-unsafe DLL. - -1999-04-26 Andi Gutmans - - * php4libts.dsp: -Add .dsp file - - * php4isapi/php4isapi.dsp - main.c: -More - -1999-04-25 Rasmus Lerdorf - - * ext/gd/config.m4: Make GD config fail if it doesn't find the gd files - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c: PHP3 compat stuff - -1999-04-25 Rasmus Lerdorf - - * Makefile.in - configure.in.in: Ok, apxs build works nicely now - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c: oops, the 0th byte should be set, too - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: final change (?), add get_algorithms_name - - * ext/mcrypt/mcrypt.c: make code more compact - - * ext/mcrypt/mcrypt.c: remove some redundant code - - * ext/mcrypt/mcrypt.c: that was a silly one - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add OFB mode, the final one - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add mcrypt_create_iv() - -1999-04-25 Zeev Suraski - - * SAPI.c - SAPI.h - sapi.c - sapi.h: Win32 isn't a good os to commit uppercase files with... - -1999-04-25 Sascha Schumann - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: - cleanup, add new stream mode, allow IV for CBC mode - - * ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h: add get_(key|block)_size - -1999-04-25 Andi Gutmans - - * cgi_main.c - sapi.c - sapi.h: Ah, these too - - * output.c - php.h - php4isapi/php4isapi.c - php4isapi/php4isapi.def - php4isapi/php4isapi.dsp - php4ts.dsp - php4ts.dsw - main.c: * Fix a couple of thread safety issues - * Add initial ISAPI support. Very very experimental. - * In the thread safe version, generate php4 as a library so that we can link it with both - php.exe and the ISAPI dll. We should probably consider doing that under all circumstances, - under UNIX as well. - - The thread-unsafe version *should* be unharmed. - -1999-04-25 Sascha Schumann - - * ext/mcrypt/php_mcrypt.h - ext/mcrypt/mcrypt.c: add CBC - - * ext/mcrypt/.cvsignore - ext/mcrypt/Makefile.am - ext/mcrypt/config.h.stub - ext/mcrypt/config.m4 - ext/mcrypt/mcrypt.c - ext/mcrypt/php_mcrypt.h - ext/mcrypt/setup.stub - acinclude.m4 - internal_functions.c: add mcrypt module - -1999-04-25 Rasmus Lerdorf - - * ext/mysql/config.m4 - Makefile.in - acconfig.h.in - configure.in.in - ext/ldap/config.m4: Ok, this beast compiles via --with-apxs - Not sure if it actually works yet though. I have a feeling there are - some -fpic flags missing in the libzend build. Will test later on - today. - -1999-04-25 Sascha Schumann - - * scripts/preconfig: - -f tests for plain files only. We need a way to find out whether we could do any damage to existing files. If we cannot write to them, we probably cannot do harmful things hopefully. - -1999-04-25 Thies C. Arntzen - - * ext/standard/php3_var.h - ext/standard/var.c: serialize & unserialize working (with mem-leak) - -1999-04-25 Rasmus Lerdorf - - * ext/mysql/config.m4 - ext/standard/config.m4: - Argh! That typo took me over an hour to find. Grr.. - -1999-04-25 Andrei Zmievski - - * scripts/preconfig: test -e fails in sh. Used test -f instead. - -1999-04-24 Sascha Schumann - - * acinclude.m4 - configure.in.in: unreliable check whether cc option can be used really - - * scripts/preconfig: security check and disclaimer for generated files - -1999-04-24 Rasmus Lerdorf - - * acconfig.h.in: - Oops, would be a good idea to edit the .in file instead of acconfig.h - - * ext/standard/config.m4: libbind check - -1999-04-24 Sascha Schumann - - * configure.in.in: add function checks - -1999-04-24 Andrei Zmievski - - * configure.in.in - scripts/preconfig: Change cmp'risons to be cross-shell compatible. - -1999-04-24 Sascha Schumann - - * ext/standard/datetime.c: bugfix port - - * acconfig.h.in - configure.in.in: port from PHP3 - - * ext/standard/flock_compat.h: include some header files explicitly - -1999-04-24 Zeev Suraski - - * php4.dsp - php4ts.dsp: Use relative paths - -1999-04-24 Thies C. Arntzen - - * ext/oracle/oci8.c - ext/oracle/php3_oci8.h: forward-port of php3-CVS version - my 1st zend-array stuff (ocifetchinto) is WORKING!! - - * ext/standard/php3_var.h - ext/standard/var.c: made var_dump zend-aware.... - "tubu"); - - var_dump($ar); - ?> - works again!!! - - zeev, andi -> please review what i've done!!! - - (no i can start "debugging" other stuff, as i often use var_dump) - -1999-04-24 Zeev Suraski - - * apidoc-zend.txt: Add my API letters to the CVS - - * php4ts.dsp - php_globals.h - main.c: Small fixes - - * main.c: We'd have to find a different way of allowing timeouts in Win32 - - * win32/sendmail.c - win32/time.c - win32/wsyslog.c - serverapi/sapi.h - win32/pwd.c - ext/standard/post.c - ext/standard/reg.c - ext/standard/string.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/image.c - ext/standard/info.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/mime.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/dir.c - ext/odbc/odbc.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hw.c - ext/bcmath/number.c - ext/apache/apache.c - ext/bcmath/bcmath.c - main.c - main.h - mod_php3.c - output.c - php.h - php3_threads.c - php3_threads.h - php4.dsp - php4ts.dsp - request_info.c - safe_mode.c - bison.simple - configuration-parser.y - control_structures.h - fhttpd.c - fopen-wrappers.c: - A lot of cleanups... Removed old thread-safe code and other redundant code and files - -1999-04-23 Zeev Suraski - - * ext/standard/head.c - main.c - main.h - php_globals.h: Remove redundant code - - * ext/standard/head.c - main.c - main.h - php_globals.h: Thread-safe header_is_being_sent - - * win32/pwd.c - win32/sendmail.c - win32/time.c - win32/winutil.c - win32/wsyslog.c - ext/standard/string.c - ext/standard/syslog.c - ext/standard/uniqid.c - ext/standard/url.c - ext/standard/var.c - ext/zlib/zlib.c - ext/standard/base64.c - ext/standard/basic_functions.c - ext/standard/browscap.c - ext/standard/datetime.c - ext/standard/dir.c - ext/standard/dl.c - ext/standard/dns.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/head.c - ext/standard/html.c - ext/standard/info.c - ext/standard/link.c - ext/standard/mail.c - ext/standard/math.c - ext/standard/md5.c - ext/standard/microtime.c - ext/standard/mime.c - ext/standard/pack.c - ext/standard/pageinfo.c - ext/standard/post.c - ext/standard/reg.c - ext/imap/imap.h - ext/informix/ifx.ec - ext/ldap/ldap.c - ext/msql/msql.c - ext/gd/gd.c - ext/dbase/dbase.c - ext/filepro/filepro.c - dl/mssql/mssql.c - ext/apache/apache.c - ext/bcmath/number.c - tls.h - fhttpd.c - fopen-wrappers.c - main.c - mod_php3.c - php3_realpath.c - request_info.c - safe_mode.c - tls.c: Remove tls.[ch] - - * ext/ldap/ldap.c - ext/imap/imap.c: cleanups - - * ext/bcmath/bcmath.c - ext/mysql/mysql.c: * MySQL fix (thanks Stig) - * Remove reundant includes from bcmath - -1999-04-23 Stig Bakken - - * libphp3.module.in: use only EXTRA_LIBS - -1999-04-23 Zeev Suraski - - * ext/mysql/mysql.c - ext/mysql/php3_mysql.h: Minor MySQL thread safety issues - - * main.c: Testing unified diffs - -1999-04-23 Rasmus Lerdorf - - * ext/standard/config.m4: - Ok, finally.. These now work nicely on a RH-5.2 box: - --with-mysql --with-ldap --with-imap --with-zlib --with-snmp - - * ext/zlib/zlib.c: Make zlib compile - -1999-04-23 Zeev Suraski - - * php4ts.dsp - main.c: *** empty log message *** - -1999-04-23 Rasmus Lerdorf - - * ext/ldap/ldap.c - ext/mysql/config.m4 - ext/snmp/config.m4: Module work - -1999-04-22 Zeev Suraski - - * Makefile.in: vpath fix - -1999-04-22 Rasmus Lerdorf - - * ext/zlib/Makefile.in - ext/sysvshm/Makefile.in - ext/sysvsem/Makefile.in - ext/sybase/Makefile.in - ext/imap/Makefile.in - ext/imap/config.m4 - ext/xml/Makefile.in - ext/snmp/Makefile.in: This is generated - - * ext/zlib/Makefile.in - ext/sysvshm/Makefile.in - ext/xml/Makefile.in - ext/sysvsem/Makefile.in - ext/imap/Makefile.in - ext/imap/config.m4 - ext/snmp/Makefile.in - ext/sybase/Makefile.in - acconfig.h.in: - Bring imap build rules up to date. We still have a problem here though. - In this new build structure we are adding libraries to $LIBS as we add - modules instead of doing an AC_SUBST into the Makefile. One reason for - doing the subst in php3 was to get around the libraries that could not - be included in $LIBS because doing so would mess up the various configure - tests. For example, you can't do a -limap as part of the various simple - configure compile programs because -limap requires a bunch of callback - symbols to be present. - -1999-04-22 Andi Gutmans - - * php4.dsp: - Update the regular VC project file. - -1999-04-22 Stig Bakken - - * ext/db/config.m4: db was not linked in - - * ext/zlib/.cvsignore - ext/zlib/Makefile.am - ext/zlib/Makefile.in - ext/zlib/config.h.stub - ext/zlib/config.m4 - ext/zlib/php3_zlib.h - ext/zlib/setup.stub - ext/zlib/zlib.c - ext/sysvshm/.cvsignore - ext/sysvshm/Makefile.am - ext/sysvshm/Makefile.in - ext/sysvshm/config.h.stub - ext/sysvshm/config.m4 - ext/sysvshm/php3_sysvshm.h - ext/sysvshm/setup.stub - ext/sysvshm/sysvshm.c - ext/xml/.cvsignore - ext/xml/Makefile.am - ext/xml/Makefile.in - ext/xml/config.h.stub - ext/xml/config.m4 - ext/xml/php3_xml.h - ext/xml/xml.c - ext/sybase/.cvsignore - ext/sybase/Makefile.am - ext/sybase/Makefile.in - ext/sybase/config.h.stub - ext/sybase/config.m4 - ext/sybase/php3_sybase-ct.h - ext/sybase/php3_sybase.h - ext/sybase/setup.stub - ext/sybase/sybase-ct.c - ext/sybase/sybase.c - ext/sysvsem/.cvsignore - ext/sysvsem/Makefile.am - ext/sysvsem/Makefile.in - ext/sysvsem/config.h.stub - ext/sysvsem/config.m4 - ext/sysvsem/php3_sysvsem.h - ext/sysvsem/setup.stub - ext/sysvsem/sysvsem.c - ext/snmp/config.m4 - ext/snmp/php3_snmp.h - ext/snmp/snmp.c - ext/standard/Makefile.am - ext/standard/basic_functions.c - ext/standard/config.h.stub - ext/standard/config.m4 - ext/standard/fsock.c - ext/standard/mime.c - ext/standard/mime.h - ext/standard/php3_standard.h - ext/standard/post.c - ext/standard/post.h - ext/standard/string.c - ext/standard/var.c - ext/interbase/.cvsignore - ext/interbase/Makefile.am - ext/interbase/config.h.stub - ext/interbase/config.m4 - ext/interbase/interbase.c - ext/interbase/php3_interbase.h - ext/interbase/setup.stub - ext/pdf/.cvsignore - ext/pdf/Makefile.am - ext/pdf/config.h.stub - ext/pdf/config.m4 - ext/pdf/pdf.c - ext/pdf/php3_pdf.h - ext/pdf/setup.stub - ext/pgsql/.cvsignore - ext/pgsql/Makefile.am - ext/pgsql/config.h.stub - ext/pgsql/config.m4 - ext/pgsql/pgsql.c - ext/pgsql/php3_pgsql.h - ext/pgsql/setup.stub - ext/snmp/.cvsignore - ext/snmp/Makefile.am - ext/snmp/Makefile.in - ext/snmp/config.h.stub - ext/imap/Makefile.in - ext/informix/Makefile.am - ext/informix/config.h.stub - ext/informix/readme.ifx - ext/informix/setup.stub - Makefile.in - acconfig.h.in - acinclude.m4 - configure.in.in - fhttpd.c - internal_functions.c - main.c - setup: last bunch of extensions moving to ext/ - fhttpd module taken out of functions, functions is ready to go. - The only extensions I have tested are gd+freetype and odbc(solid). - Please try compiling in your favourite extensions and let me know how it - works. - - * ext/ldap/.cvsignore - ext/ldap/Makefile.am - ext/ldap/config.h.stub - ext/ldap/config.m4 - ext/ldap/ldap.c - ext/ldap/php3_ldap.h - ext/ldap/setup.stub - ext/standard/config.h.stub - Makefile.in - acconfig.h.in - configure.in.in - ext/imap/.cvsignore - ext/imap/Makefile.am - ext/imap/Makefile.in - ext/imap/config.h.stub - ext/imap/config.m4 - ext/imap/imap.c - ext/imap/imap.h - ext/imap/setup.stub - internal_functions.c - setup: moved imap and ldap - - * serverapi/nsapi_sapi.c - ext/standard/formatted_print.c - ext/standard/head.c - ext/standard/head.h - ext/standard/info.c - ext/standard/pack.c - ext/standard/php3_crypt.h - ext/standard/php3_standard.h - ext/odbc/odbc.c - ext/standard/Makefile.am - ext/standard/crypt.c - ext/standard/dl.c - ext/standard/dl.h - ext/standard/exec.c - ext/standard/file.c - ext/hyperwave/hw.c - ext/informix/.cvsignore - ext/informix/Makefile.am - ext/informix/config.h.stub - ext/informix/config.m4 - ext/informix/ifx.ec - ext/informix/php3_ifx.h - ext/informix/setup.stub - ext/gd/gd.c - ext/fdf/config.h.stub - ext/fdf/config.m4 - ext/fdf/fdf.c - ext/fdf/php3_fdf.h - ext/fdf/setup.stub - ext/apache/apache.c - ext/fdf/.cvsignore - ext/fdf/Makefile.am - Makefile.in - acconfig.h.in - configuration-parser.y - configure.in.in - fopen-wrappers.c - internal_functions.c - main.c - output.c - setup - tls.h: moved fdf, hyperwave, informix and some smaller files - -1999-04-21 Stig Bakken - - * ext/hyperwave/debug.h - acconfig.h.in - acinclude.m4 - configure.in.in - ext/db/.cvsignore - ext/db/Makefile.am - ext/db/config.h.stub - ext/db/config.m4 - ext/db/db.c - ext/db/db.h - internal_functions.c - Makefile.in: moved db - - * ext/bcmath/.cvsignore - ext/bcmath/Makefile.am - ext/bcmath/bcmath.c - ext/bcmath/config.h.stub - ext/bcmath/config.m4 - ext/bcmath/number.c - ext/bcmath/number.h - ext/bcmath/php3_bcmath.h - ext/bcmath/setup.stub - Makefile.in - acconfig.h.in - configure.in.in - internal_functions.c - php.h - setup - tls.h: moved bcmath - - * ext/com/.cvsignore - ext/com/COM.c - ext/com/php3_COM.h - ext/hyperwave/.cvsignore - ext/hyperwave/DList.h - ext/hyperwave/Makefile.am - ext/hyperwave/config.h.stub - ext/hyperwave/config.m4 - ext/hyperwave/dlist.c - ext/hyperwave/hg_comm.c - ext/hyperwave/hg_comm.h - ext/hyperwave/hw.c - ext/hyperwave/hw.h - ext/hyperwave/hw_error.h - ext/hyperwave/setup.stub - ext/apache/.cvsignore - ext/apache/Makefile.am - ext/apache/apache.c - ext/apache/config.m4 - Makefile.in - acconfig.h.in - configure.in.in - setup: moved apache, com and hyperwave into ext/ - - * ext/oracle/.cvsignore - ext/oracle/Makefile.am - ext/oracle/config.h.stub - ext/oracle/config.m4 - ext/oracle/oci8.c - ext/oracle/oracle.c - ext/oracle/oracle.h - ext/oracle/oracle_hack.c - ext/oracle/php3_oci8.h - ext/oracle/setup.stub - ext/dav/.cvsignore - ext/dav/Makefile.am - ext/dav/config.h.stub - ext/dav/config.m4 - ext/dav/dav.c - ext/dav/php3_dav.h - ext/dav/setup.stub - ext/ext_skel - ext/msql/.cvsignore - ext/msql/Makefile.am - ext/msql/config.h.stub - ext/msql/config.m4 - ext/msql/msql.c - ext/msql/php3_msql.h - ext/msql/setup.stub - ext/mysql/setup.stub - Makefile.in - acconfig.h.in - acinclude.m4 - configure.in.in - internal_functions.c - setup: moved dav, msql and oracle to ext/ - - * acconfig.h.in - configure.in.in - Makefile.in - ext/filepro/config.h.stub - ext/filepro/config.m4 - ext/filepro/filepro.c - ext/filepro/filepro.h - ext/filepro/setup.stub - ext/filepro/.cvsignore - ext/filepro/Makefile.am: moved filepro to ext - - * ext/mysql/config.m4: - mysql should work again now, can someone with mysql installed test it? - - * ext/gd/gd.c: gd compile fix - - * Makefile.in - ext/mysql/config.h.stub - ext/mysql/config.m4 - ext/mysql/mysql.c - ext/mysql/php3_mysql.h - ext/mysql/setup.stub - ext/mysql/.cvsignore - ext/mysql/Makefile.am - acconfig.h.in - configure.in.in - internal_functions.c: moving mysql to ext/ - - * ext/ext_skel: create .cvsignore only once :-) - - * ext/ext_skel: create .cvsignore as well - - * buildconf: state which aclocal.m4 and configure files are created - - * scripts/armerge: merge the object files in a temporary directory - -1999-04-21 Zeev Suraski - - * php4ts.dsp: Thread safe project update - -1999-04-21 Stig Bakken - - * php.h: added PHP_API_VERSION, simply set it to 19990421 for now - -1999-04-21 Zeev Suraski - - * php.h: Minor fixes - - * ext/standard/Makefile.am - ext/standard/file.c - ext/standard/flock_compat.c - ext/standard/flock_compat.h - ext/standard/string.c - config.w32.h - php.h - php4.dsp - php_compat.c - php_compat.h - Makefile.in: - * Rename php_compat.[ch] to flock_compat.[ch] and move it to ext/standard - * Fix Win32 compilation - -1999-04-21 Sascha Schumann - - * ext/gettext/php3_gettext.h: forgot that one - - * ext/standard/file.h - ChangeLog.TODO - ext/standard/file.c: cleanup, flock() support - - * ext/standard/file.c - ext/standard/php3_string.h - ChangeLog.TODO - internal_functions.c: crypt constants - - * php_compat.c - configure.in.in - internal_functions.c: cleanup - -1999-04-21 Zeev Suraski - - * configuration-parser.y - ext/standard/basic_functions.c - ext/standard/syslog.c - main.c - php4ts.dsw - php_ini.c - testfunc: - Thread safety patch. It works now with just-in-time resource initialization! - -1999-04-21 Sascha Schumann - - * ext/gettext/.cvsignore - ext/gettext/Makefile.am - ext/gettext/config.h.stub - ext/gettext/config.m4 - ext/gettext/gettext.c - ext/gettext/setup.stub: incorporate gettext support - - * ext/standard/datetime.c - ext/standard/reg.c - ext/standard/string.c - ChangeLog.TODO - Makefile.in - fopen-wrappers.c - php.h - php_compat.c - php_compat.h: port some fixes, add compat routines - - * ChangeLog.TODO - ext/standard/string.c: str_replace fix - -1999-04-21 Stig Bakken - - * ext/ext_skel: make config.h.stub as well - - * acinclude.m4: - remove old libtool and automake stuff that was borrowed using 3.0 - -1999-04-21 Zeev Suraski - - * php4.dsp - php4.dsw - php4ts.dsp - php4ts.dsw: Update thread-safe projects - -1999-04-21 Sascha Schumann - - * .cvsignore: config.h.in is a generated file and should be ignored by CVS - -1999-04-21 Stig Bakken - - * buildconf: move automake back to before autoconf - - * buildconf - scripts/preconfig: - autoheader must be called after autoconf, automake after autoheader - -1999-04-21 Sascha Schumann - - * ext/ext_skel: generates basic skeleton for new extension - -1999-04-21 Zeev Suraski - - * ext/standard/basic_functions.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/filestat.c - ext/standard/link.c - fopen-wrappers.c - main.c - main.h - php.h - php4.dsw - php_globals.h - configuration-parser.y: More thread safety work - -1999-04-20 Stig Bakken - - * buildconf - config.h.in - ext/dbase/config.h.stub - ext/gd/config.h.stub - ext/odbc/config.h.stub: added ext/*/config.h.stub files - removed config.h.in (generated) - - * scripts/preconfig - ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - Makefile.in - acconfig.h.in - acinclude.m4 - build-defs.h.in - config.h.in - internal_functions.c - php.h: odbc compiles and runs on UNIX again (tested with Solid 2.3) - -1999-04-19 Stig Bakken - - * buildconf: convert libzend to automake - -1999-04-19 Andi Gutmans - - * php4.dsp: Rearrange the .dsp for the new ODBC layout - -1999-04-19 Stig Bakken - - * .cvsignore: ignore acconfig.h - - * ext/odbc/odbc.c: include the right header files - - * scripts/preconfig - acconfig.h - acconfig.h.in: - generate acconfig.h from acconfig.h.in and ext/*/config.h.stub - - * ext/odbc/.cvsignore - ext/odbc/Makefile.am - ext/odbc/config.m4 - ext/odbc/odbc.c - ext/odbc/php3_odbc.h - ext/odbc/php3_velocis.h - ext/odbc/setup.stub - ext/odbc/velocis.c - Makefile.in - configure.in.in - internal_functions.c - setup: moved odbc into ext/ - - * buildconf: keep old files if they are not modified - - * configure.in.in - internal_functions.c - setup - Makefile.in: moved dbase into ext/ - - * ext/dbase/.cvsignore - ext/dbase/Makefile.am - ext/dbase/config.m4 - ext/dbase/dbase.c - ext/dbase/dbase.h - ext/dbase/dbf.h - ext/dbase/dbf_head.c - ext/dbase/dbf_head.h - ext/dbase/dbf_misc.c - ext/dbase/dbf_misc.h - ext/dbase/dbf_ndx.c - ext/dbase/dbf_ndx.h - ext/dbase/dbf_rec.c - ext/dbase/dbf_rec.h - ext/dbase/setup.stub: - moved dbase into ext/ along with the bundled library - dbase programs are no longer included - - * buildconf: run automake and run autoconf in libzend - -1999-04-18 Zeev Suraski - - * ext/Makefile.am - main.c: Ah, so that file is generated too - - * scripts/mkextlib.in - Makefile.in - buildconf - configure.in.in: - * Added buildconf, runs all the scripts necessary to build configure (Stig - if there's any way - to detect whether we need to run 'automake --add-missing', please add it...) - * Make vpath work again - * Minor UNIX bugfixes - - * ext/standard/pack.c - ext/standard/string.c - ext/standard/var.c - ext/standard/exec.c - ext/standard/file.c - ext/standard/formatted_print.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/info.c - main.c - php4.dsp: Make Win32 happy with the recent changes. - - * win32/php_registry.h - win32/registry.c: Forgot to add these - Win32 registry support - - * main.c - php3_compat.h: Win32 registry support - -1999-04-17 Andi Gutmans - - * ext/standard/basic_functions.c: - - Make gettype() behave like it used to where it returned "object" for - objects. - -1999-04-17 Stig Bakken - - * scripts/armerge - configure.in.in - ext/gd/config.m4 - libphp3.module.in - Makefile.in: Apache module compiles again - - * aclocal.m4: this file is now generated - - * ext/standard/info.c: - make sure the images on the phpinfo() page point to PHP-enabled pages - - * .cvsignore: ignore configure.in - - * configure.in: this file is now generated - - * scripts/.cvsignore - scripts/armerge - scripts/config-stubs - scripts/mkextlib.in - scripts/preconfig - ext/standard/math.c - ext/standard/md5.c - ext/standard/md5.h - ext/standard/microtime.c - ext/standard/microtime.h - ext/standard/pack.c - ext/standard/pack.h - ext/standard/pageinfo.c - ext/standard/pageinfo.h - ext/standard/php3_browscap.h - ext/standard/php3_dir.h - ext/standard/php3_filestat.h - ext/standard/php3_iptc.h - ext/standard/php3_link.h - ext/standard/php3_mail.h - ext/standard/php3_standard.h - ext/standard/php3_string.h - ext/standard/php3_syslog.h - ext/standard/php3_var.h - ext/standard/phpdir.h - ext/standard/phpmath.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/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/var.c - ext/gd/.cvsignore - ext/gd/Makefile.am - ext/gd/config.m4 - ext/gd/gd.c - ext/gd/php3_gd.h - ext/gd/setup.stub - ext/standard/.cvsignore - ext/standard/Makefile.am - ext/standard/base64.c - ext/standard/base64.h - ext/standard/basic_functions.c - ext/standard/basic_functions.h - ext/standard/browscap.c - ext/standard/config.m4 - ext/standard/cyr_convert.c - ext/standard/cyr_convert.h - ext/standard/datetime.c - ext/standard/datetime.h - ext/standard/dir.c - 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/formatted_print.c - ext/standard/fsock.c - ext/standard/fsock.h - ext/standard/global.h - ext/standard/html.c - ext/standard/html.h - ext/standard/image.c - ext/standard/image.h - ext/standard/info.c - ext/standard/info.h - ext/standard/iptc.c - ext/standard/link.c - ext/standard/mail.c - .cvsignore - Makefile.in - acinclude.m4 - aclocal.m4 - configuration-parser.y - configure.in - configure.in.in - ext/.cvsignore - ext/Makefile.am - fopen-wrappers.c - internal_functions.c - main.c - php_version.h - safe_mode.c - setup: - First commit of re-structuring phase one. We have started using automake in - sub-directories and started to move extension code into ext/. For now, - I have moved the "standard" extension (which is quite a mix of everything - right now) and the GD extension into their own subdirs in ext/. - The configure script now also runs configure in the libzend directory - automatically and makes sure php4 and libzend use the same config.cache file. - To avoid running configure in libzend, use the --no-recursion option. - "make" in php4 also builds libzend now. - The Apache module doesn't compile right now, but a fix for that is - coming up. - -1999-04-16 Stig Bakken - - * ext/gd/gd.c - ext/gd/gdcache.c - ext/gd/gdcache.h - ext/gd/gdttf.c - ext/gd/gdttf.h: - updated GD from php3 repository, using it as a test extension for the new - directory structure - -1999-04-16 Andi Gutmans - - * main.c - php4.dsp: - Make the memory leak message print PHP4. - -1999-04-12 Zeev Suraski - - * php_ini.c: NULL's should remain NULLs (at least in strings) - -1999-04-12 Stig Bakken - - * php_ini.c: - tolerate uninitialized ini settings in php_ini_{long,double,string}() - -1999-04-12 Sascha Schumann - - * ChangeLog.TODO: This should help in keeping PHP4 up to date - -1999-04-10 Zeev Suraski - - * main.c: Test patch... - - * main.c: test patch - - * main.c: Oops - - * mod_php3.h - Makefile.in - main.c - mod_php3.c: php3_ini? What's that? - - * configuration-parser.y - fopen-wrappers.c - internal_functions.c - main.c - mod_php3.c - mod_php3.h - php.h - php_globals.h - php_ini.c - php_ini.h - request_info.c - tls.h: Buh-bye php3_ini - - * main.c - mod_php3.c - mod_php3.h - php_globals.h - win32/sendmail.c: A lot of php3_ini -> php_ini work - - * configuration-parser.y - fopen-wrappers.c - main.c - mod_php3.c - mod_php3.h - php_globals.h: Move safe_mode to the new php_ini mechanism - - * main.c - mod_php3.c - mod_php3.h - php_globals.h: - Move asp_tags and short_open_tag to the new php_ini mechanism - - * php_ini.c: * php_ini fixes - * convert the MySQL module to use the new php_ini mechanism - -1999-04-09 Zeev Suraski - - * mod_php3.c - php_ini.c: Apache php_ini support - - * main.c: testing 123 - - * main.c: test, ignore - - * php_ini.c: Testing 123 - - * php_ini.c: *** empty log message *** - - * mod_php3.c: Get the apache module to compile - - * php_globals.h: *** empty log message *** - - * main.c - mod_php3.h - php.h - php4.dsp - php_ini.c - php_ini.h: * A lot of work on php_ini stuff - * A lot of work on getting rid from php3_ini - -1999-04-08 Zeev Suraski - - * php_ini.c - php_ini.h: Type library support in COM module - - * configuration-parser.y - dl/mssql/mssql.c - dl/mssql/php3_mssql.h - main.c - php_ini.c - php_ini.h: * Add arguments to shutdown function - * Bring php_ini uptodate - - * main.c: Fix for php -v - -1999-04-08 Stig Bakken - - * fopen-wrappers.c: patched in fsock.c from php3 - -1999-04-08 Kristian Köhntopp - - * Makefile.in: Spurious $ removed in Makefile.in - -1999-04-08 Stig Bakken - - * .cvsignore - configure.in - regex/.cvsignore: get rid of extra and doc dirs, more cvs ignore stuff - -1999-04-07 Stig Bakken - - * .cvsignore - configure.in: fix configure warnings - -1999-04-07 Zeev Suraski - - * php4.dsw: Update deps - - * php4.dsp - php4.dsw - regex/debug.ih - regex/engine.ih - regex/main.ih - regex/regcomp.ih - regex/regerror.ih: Win32 patches - - * win32/wsyslog.c: New file. - - * win32/wsyslog.c: PHP 4.0 - - * serverapi/isapiwrapper/cgiwrap.c - serverapi/sapi.h - win32/flock.c - win32/flock.h - win32/grp.h - win32/param.h - win32/pwd.c - win32/pwd.h - win32/readdir.c - win32/readdir.h - win32/sendmail.c - win32/sendmail.h - win32/signal.h - win32/syslog.h - win32/time.c - win32/time.h - win32/unistd.h - win32/wfile.c - win32/wfile.h - win32/winutil.c - win32/winutil.h: New file. - - * serverapi/isapiwrapper/cgiwrap.c - serverapi/sapi.h - win32/flock.c - win32/flock.h - win32/grp.h - win32/param.h - win32/pwd.c - win32/pwd.h - win32/readdir.c - win32/readdir.h - win32/sendmail.c - win32/sendmail.h - win32/signal.h - win32/syslog.h - win32/time.c - win32/time.h - win32/unistd.h - win32/wfile.c - win32/wfile.h - win32/winutil.c - win32/winutil.h: PHP 4.0 - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: New file. - - * serverapi/isapi_sapi.c - serverapi/nsapi_sapi.c: PHP 4.0 - - * regex/tests - regex/utils.h - serverapi/cgi_sapi.c: New file. - - * regex/tests - regex/utils.h - serverapi/cgi_sapi.c: PHP 4.0 - - * regex/regex2.h - regex/regexec.c - regex/regfree.c - regex/split.c: New file. - - * regex/regex2.h - regex/regexec.c - regex/regfree.c - regex/split.c: PHP 4.0 - - * regex/regex.h - regex/regex.mak: New file. - - * regex/regex.h - regex/regex.mak: PHP 4.0 - - * regex/engine.c - regex/main.c - regex/mkh - regex/regcomp.c - regex/regerror.c - regex/regex.3 - regex/regex.7 - regex/regex.dsp - regex/regex.dsw: New file. - - * regex/engine.c - regex/main.c - regex/mkh - regex/regcomp.c - regex/regerror.c - regex/regex.3 - regex/regex.7 - regex/regex.dsp - regex/regex.dsw: PHP 4.0 - - * regex/debug.c: New file. - - * regex/debug.c: PHP 4.0 - - * regex/README - regex/WHATSNEW - regex/cclass.h - regex/cname.h: New file. - - * regex/README - regex/WHATSNEW - regex/cclass.h - regex/cname.h: PHP 4.0 - - * regex/COPYRIGHT - regex/Makefile.in: New file. - - * regex/COPYRIGHT - regex/Makefile.in: PHP 4.0 - - * dl/vmailmgr/docs.php3 - dl/vmailmgr/php3_vmailmgr.c - dl/vmailmgr/phpvmail.cc - dl/vmailmgr/phpvmail.h: New file. - - * dl/vmailmgr/docs.php3 - dl/vmailmgr/php3_vmailmgr.c - dl/vmailmgr/phpvmail.cc - dl/vmailmgr/phpvmail.h: PHP 4.0 - - * dl/snmp/snmp.c - dl/snmp/winsnmp.c - dl/vmailmgr/Makefile: New file. - - * dl/snmp/snmp.c - dl/snmp/winsnmp.c - dl/vmailmgr/Makefile: PHP 4.0 - - * dl/snmp/README - dl/snmp/php3_snmp.h: New file. - - * dl/snmp/README - dl/snmp/php3_snmp.h: PHP 4.0 - - * dl/mssql/sqlfront.h: New file. - - * dl/mssql/sqlfront.h: PHP 4.0 - - * dl/mssql/mssql.c - dl/mssql/php3_mssql.h - dl/mssql/sqldb.h: New file. - - * dl/mssql/mssql.c - dl/mssql/php3_mssql.h - dl/mssql/sqldb.h: PHP 4.0 - - * dl/log/log_sql.c - dl/mssql/README - dl/mssql/mssql.dsp: New file. - - * dl/log/log_sql.c - dl/mssql/README - dl/mssql/mssql.dsp: PHP 4.0 - - * dl/log/README - dl/log/log.c - dl/log/log.h - dl/log/log_db.c: New file. - - * dl/log/README - dl/log/log.c - dl/log/log.h - dl/log/log_db.c: PHP 4.0 - - * dl/imap/README - dl/imap/examples/dlimap_ping.php3 - dl/imap/examples/espanol/dlimap_ping.php3 - dl/imap/examples/espanol/dlimapbd1.php3 - dl/imap/examples/espanol/dlimapbd2.php3 - dl/imap/examples/espanol/dlimapbd3.php3 - dl/imap/examples/espanol/dlimapbd4.php3 - dl/imap/examples/espanol/dlimapbody.php3 - dl/imap/examples/simple.php3: New file. - - * dl/imap/README - dl/imap/examples/dlimap_ping.php3 - dl/imap/examples/espanol/dlimap_ping.php3 - dl/imap/examples/espanol/dlimapbd1.php3 - dl/imap/examples/espanol/dlimapbd2.php3 - dl/imap/examples/espanol/dlimapbd3.php3 - dl/imap/examples/espanol/dlimapbd4.php3 - dl/imap/examples/espanol/dlimapbody.php3 - dl/imap/examples/simple.php3: PHP 4.0 - - * dl/crypt/sflcryp.c - dl/crypt/sflcryp.h - dl/imap/IMAP_IS_NO_LONGER_HERE: New file. - - * dl/crypt/sflcryp.c - dl/crypt/sflcryp.h - dl/imap/IMAP_IS_NO_LONGER_HERE: PHP 4.0 - - * dl/crypt/crypt.c: New file. - - * dl/crypt/crypt.c: PHP 4.0 - - * dl/crypt/prelude.h: New file. - - * dl/crypt/prelude.h: PHP 4.0 - - * dl/calendar/gregor.c - dl/calendar/jewish.c - dl/calendar/julian.c - dl/calendar/sdncal.h: New file. - - * dl/calendar/gregor.c - dl/calendar/jewish.c - dl/calendar/julian.c - dl/calendar/sdncal.h: PHP 4.0 - - * dl/calendar/dow.c - dl/calendar/french.c: New file. - - * dl/calendar/dow.c - dl/calendar/french.c: PHP 4.0 - - * dl/calendar/calendar.c - dl/phpdl.h - dl/setup - dl/win32vc5.mak: New file. - - * dl/calendar/calendar.c - dl/phpdl.h - dl/setup - dl/win32vc5.mak: PHP 4.0 - - * dl/Makefile.tmpl - dl/README: New file. - - * dl/Makefile.tmpl - dl/README: PHP 4.0 - - * win95nt.h - zlib.mak: New file. - - * win95nt.h - zlib.mak: PHP 4.0 - - * snprintf.c - snprintf.h - stamp-h.in - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tls.c - tls.h: New file. - - * snprintf.c - snprintf.h - stamp-h.in - test.php4 - test.pl - test_class_inheritance - testarray - testarray.pl - testarray2 - testarray2.pl - testclassfunc - testcom - testfe - testfunc - testfunc.pl - testfunc2 - testfunc2.pl - testfuncref - testinclude - testobj - tls.c - tls.h: PHP 4.0 - - * snmp.mak: New file. - - * snmp.mak: PHP 4.0 - - * setup: New file. - - * setup: PHP 4.0 - - * request_info.h - safe_mode.c - safe_mode.h: New file. - - * request_info.h - safe_mode.c - safe_mode.h: PHP 4.0 - - * press-release-3.0.txt - recurse - request_info.c: New file. - - * press-release-3.0.txt - recurse - request_info.c: PHP 4.0 - - * php4.dsp - php_custom_build.mak - php_ini.c - php_ini.h - php_version.h: New file. - - * php4.dsp - php_custom_build.mak - php_ini.c - php_ini.h - php_version.h: PHP 4.0 - - * php3_realpath.c - php3_realpath.h - php3_sprintf.c - php3_threads.c - php3_threads.h - php3extra.dsw - php3sapi.dsw: New file. - - * php3_realpath.c - php3_realpath.h - php3_sprintf.c - php3_threads.c - php3_threads.h - php3extra.dsw - php3sapi.dsw: PHP 4.0 - - * php3.ini-dist - php3_compat.h: New file. - - * php3.ini-dist - php3_compat.h: PHP 4.0 - - * php.h: New file. - - * php.h: PHP 4.0 - - * msql1.mak - mtparser.bat - mysql.mak - objects - output.c - output.h: New file. - - * msql1.mak - mtparser.bat - mysql.mak - objects - output.c - output.h: PHP 4.0 - - * mod_php3.c - mod_php3.h - msql.mak: New file. - - * mod_php3.c - mod_php3.h - msql.mak: PHP 4.0 - - * main.c - main.h - makeall.bat - makedist - makeparser.bat: New file. - - * main.c - main.h - makeall.bat - makedist - makeparser.bat: PHP 4.0 - - * ltmain.sh: New file. - - * ltmain.sh: PHP 4.0 - - * ltconfig: New file. - - * ltconfig: PHP 4.0 - - * logos.h: New file. - - * logos.h: PHP 4.0 - - * internal_functions_registry.h - ldap.mak - libphp3.module.in: New file. - - * internal_functions_registry.h - ldap.mak - libphp3.module.in: PHP 4.0 - - * install-sh - internal_functions.c: New file. - - * install-sh - internal_functions.c: PHP 4.0 - - * imap4.mak: New file. - - * imap4.mak: PHP 4.0 - - * fopen-wrappers.h - gd.mak - getopt.c - getopt.h - header - hyperwave.mak: New file. - - * fopen-wrappers.h - gd.mak - getopt.c - getopt.h - header - hyperwave.mak: PHP 4.0 - - * fopen-wrappers.c: New file. - - * fopen-wrappers.c: PHP 4.0 - - * dbm.mak - filepro.mak - foo - foo2 - foo3 - foo4 - footer: New file. - - * dbm.mak - filepro.mak - foo - foo2 - foo3 - foo4 - footer: PHP 4.0 - - * configure.in - control_structures.h - crypt.mak - cvsusers - dbase.mak: New file. - - * configure.in - control_structures.h - crypt.mak - cvsusers - dbase.mak: PHP 4.0 - - * config.w32.h - configuration-parser.y - configuration-scanner.l: New file. - - * config.w32.h - configuration-parser.y - configuration-scanner.l: PHP 4.0 - - * config.sub: New file. - - * config.sub: PHP 4.0 - - * config.h.in: New file. - - * config.h.in: PHP 4.0 - - * config.guess: New file. - - * config.guess: PHP 4.0 - - * calendar.mak: New file. - - * calendar.mak: PHP 4.0 - - * bison.simple - build-defs.h.in: New file. - - * bison.simple - build-defs.h.in: PHP 4.0 - - * apMakefile.tmpl - apidoc.txt: New file. - - * apMakefile.tmpl - apidoc.txt: PHP 4.0 - - * alloca.c - apMakefile.libdir: New file. - - * alloca.c - apMakefile.libdir: PHP 4.0 - - * Makefile.in - README.QNX - README.WIN32 - TODO - WISHLIST - WISHLIST-3.1 - acconfig.h - aclocal.m4: New file. - - * Makefile.in - README.QNX - README.WIN32 - TODO - WISHLIST - WISHLIST-3.1 - acconfig.h - aclocal.m4: PHP 4.0 - - * LICENSE: New file. - - * LICENSE: PHP 4.0 - - * FUNCTION_LIST.txt - INSTALL: New file. - - * FUNCTION_LIST.txt - INSTALL: PHP 4.0 - - * CREDITS - EXTENSION_STATUS: New file. - - * CREDITS - EXTENSION_STATUS: PHP 4.0 - - * CODING_STANDARDS: New file. - - * CODING_STANDARDS: PHP 4.0 - - * COPYING: New file. - - * COPYING: PHP 4.0 - - * CHANGES: New file. - - * CHANGES: PHP 4.0 - - * BUGS - ChangeLog: New file. - - * BUGS - ChangeLog: PHP 4.0 - diff --git a/FUNCTION_LIST.txt b/FUNCTION_LIST.txt deleted file mode 100644 index 2d567f7be6..0000000000 --- a/FUNCTION_LIST.txt +++ /dev/null @@ -1,538 +0,0 @@ -Functions: - -Functions marked with 'u' do not work, or may not work correctly under windows. - -basic_functions - include - _include - isset - - intval - doubleval - strval - short_tags - sleep -u usleep - ksort - asort - sort - count - chr - ord - flush - end - prev - next - reset - current - key - gettype - settype - min - max - - addslashes - chop - pos - - fsockopen - getimagesize - htmlspecialchars - md5 - - parse_url - - parse_str - phpinfo - phpversion - strlen - strtok - strtoupper - strtolower - strchr - basename - dirname - stripslashes - strstr - strrchr - substr - quotemeta - urlencode - urldecode - ucfirst - strtr - sprintf - printf - - exec - system - escapeshellcmd - passthru - - soundex - - rand - srand - getrandmax - gethostbyaddr - gethostbyname - explode - implode - error_reporting - clearstatcache - - get_current_user - getmyuid - getmypid -u getmyinode - getlastmod - - base64_decode - base64_encode - - abs - ceil - floor - sin - cos - tan - asin - acos - atan - pi - pow - exp - log - log10 - sqrt - bindec - hexdec - octdec - decbin - decoct - dechex - - getenv - putenv - - time - mktime - date - gmdate - getdate - checkdate - microtime - uniqid - -u linkinfo -u readlink -u symlink -u link -u unlink - - -bcmath_functions - bcadd - bcsub - bcmul - bcdiv - bcmod - bcpow - bcsqrt - bcscale - bccomp - -dir_functions - opendir - closedir - chdir - rewinddir - readdir - dir - -dl_functions - dl(string module_name); dynamicly load a module - -dns_functions - gethostbyaddr - gethostbyname - -file_functions - pclose - popen - readfile - rewind - rmdir - umask - fclose - feof - fgets - fgetss - fopen - fpassthru - fseek - ftell - fputs - mkdir - rename - copy - tempnam - file - -filestat_functions - fileatime - filectime -u filegroup -u fileinode - filemtime -u fileowner - fileperms - filesize - filetype - stat -u chown -u chgrp -u chmod - touch - file_exists - is_executable - is_dir - is_readable - is_writeable -u is_link - -header_functions - setcookie - header - -mail_functions - mail - -reg_functions - ereg - ereg_replace - eregi - eregi_replace - split - sql_regcase - -syslog_functions (writes to event log on win NT) - openlog - syslog - closelog - -The following are optional modules and may or may not be compiled into php, or may be compiled as a loadable module. - -odbc_functions (obsolete, use uodbc below) - sqlconnect - sqldisconnect - sqlfetch - sqlexecdirect - sqlgetdata - sqlfree - sqlrowcount - -uodbc_functions - (int) odbc_autocommit($connection_id, $OnOff) - (void) odbc_close($connection_id) - (void) odbc_close_all(void) - (int) odbc_commit($connection_id) - (int) odbc_connect($dsn, $user, $password) - (int) odbc_pconnect($dsn, $user, $password) - (string) odbc_cursor($result_id) - (int) odbc_do($connection_id, $query_string) - (int) odbc_exec($connection_id, $query_string) - (int) odbc_prepare($connection_id, $query_string) - (int) odbc_execute($result_id, $array) - (int) odbc_fetch_row($result_id, $row_number) - (int) odbc_fetch_into($result_id, $row_number, $array_ptr) - (int) odbc_field_len($result_id, $field_number) - (string) odbc_field_name($result_id, $field_number) - (string) odbc_field_type($result_id, $field) - (int) odbc_free_result($result_id) - (int) odbc_num_fields($result_id) - (int) odbc_num_rows($result_id) - (string) odbc_result($result_id, $field) - (int) odbc_result_all($result_id, $format) - (int) odbc_rollback($connection_id) - -msql_functions - msql_connect - msql_pconnect - msql_close - msql_select_db - msql_create_db - msql_drop_db - msql_query - msql - msql_list_dbs - msql_list_tables - msql_list_fields - msql_result - msql_num_rows - msql_num_fields - msql_fetch_row - msql_fetch_array - msql_fetch_object - msql_data_seek - msql_fetch_field - msql_field_seek - msql_free_result - msql_fieldname - msql_fieldtable - msql_fieldlen - msql_fieldtype - msql_fieldflags - msql_regcase - /* for downwards compatability */ - msql_selectdb - msql_createdb - msql_dropdb - msql_freeresult - msql_numfields - msql_numrows - msql_listdbs - msql_listtables - msql_listfields - msql_dbname - msql_tablename - -ldap_functions - ldap_connect - ldap_bind - ldap_unbind - ldap_read - ldap_list - ldap_search - ldap_free_result - ldap_count_entries - ldap_first_entry - ldap_next_entry - ldap_get_entries - ldap_free_entry - ldap_first_attribute - ldap_next_attribute - ldap_get_attributes - ldap_get_values - ldap_get_dn - ldap_dn2ufn - ldap_add - ldap_delete - ldap_modify - -gd_functions - imagearc - imagechar - imagecharup - imagecolorallocate - imagecolorclosest - imagecolorexact - imagecolortransparent - imagecopyresized - imagecreate - imagecreatefromgif - imagedestroy - imagefill - imagefilledpolygon - imagefilledrectangle - imagefilltoborder - imagegif - imageinterlace - imageline - imagepolygon - imagerectangle - imagesetpixel - imagestring - imagestringup - imagesx - imagesy - -filepro_functions - filepro - filepro_rowcount - filepro_fieldname - filepro_fieldtype - filepro_fieldwidth - filepro_fieldcount - filepro_retrieve - -dbm_functions - dblist - dbmopen - dbmclose - dbminsert - dbmfetch - dbmreplace - dbmexists - dbmdelete - dbmfirstkey - dbmnextkey - -dbase_functions - dbase_open - dbase_create - dbase_close - dbase_numrecords - dbase_numfields - dbase_add_record - dbase_get_record - dbase_delete_record - dbase_pack - -calendar_functions - jdtogregorian - gregoriantojd - jdtojulian - juliantojd - jdtojewish - jewishtojd - jdtofrench - frenchtojd - jddayofweek - jdmonthname - -adabas_functions -(int) ada_afetch($result_id, $rownumber, $result array) -(int) ada_autocommit($connection_id, $OnOff) -(void) ada_close($connection_id) - ada_closeall -(int) ada_commit($connection_id) -(int) ada_connect($dsn, $user, $password) -(int) ada_exec($connection_id, $query_string) -(int) ada_fetchrow($result_id, $row?number) - ada_fieldlen -(string) ada_fieldname($result_id, $field_number) -(string) ada_fieldtype($result_id, $field) -(int) ada_freeresult($result_id) -(int) ada_numfields($result_id) -(int) ada_numrows($result_id) -(string) ada_result($result_id, $field) -(int) ada_resultall($result_id, $format) -(int) ada_rollback($connection_id) -***(int) ada_fieldnum($result_id, $field_name) (this function is not in adabase.c - -crypt_functions - crypt - -mysql_functions - mysql_connect - mysql_pconnect - mysql_close - mysql_select_db - mysql_create_db - mysql_drop_db - mysql_query - mysql - mysql_list_dbs - mysql_list_tables - mysql_list_fields - mysql_affected_rows - mysql_insert_id - mysql_result - mysql_num_rows - mysql_num_fields - mysql_fetch_row - mysql_fetch_array - mysql_fetch_object - mysql_data_seek - mysql_fetch_lengths - mysql_fetch_field - mysql_field_seek - mysql_free_result - mysql_fieldname - mysql_fieldtable - mysql_fieldlen - mysql_fieldtype - mysql_fieldflags - /* for downwards compatability */ - mysql_selectdb - mysql_createdb - mysql_dropdb - mysql_freeresult - mysql_numfields - mysql_numrows - mysql_listdbs - mysql_listtables - mysql_listfields - mysql_dbname - mysql_tablename - -oracle_functions - ora_close - ora_commit - ora_commitoff - ora_commiton - ora_error - ora_errorcode - ora_exec - ora_fetch - ora_getcolumn - ora_logoff - ora_logon - ora_open - ora_parse - ora_rollback - -pgsql_functions - pg_connect - pg_pconnect - pg_close - pg_dbname - pg_errormessage - pg_options - pg_port - pg_tty - pg_host - pg_exec - pg_numrows - pg_numfields - pg_fieldname - pg_fieldsize - pg_fieldtype - pg_fieldnum - pg_result - pg_fieldprtlen - pg_getlastoid - pg_freeresult - pg_locreate - pg_lounlink - pg_loopen - pg_loclose - pg_loread - pg_lowrite - pg_loreadall - -sybase_functions - sybase_connect - sybase_pconnect - sybase_close - sybase_select_db - sybase_query - sybase_free_result - sybase_get_last_message - sybase_num_rows - sybase_num_fields - sybase_fetch_row - sybase_fetch_array - sybase_fetch_object - sybase_data_seek - sybase_fetch_field - sybase_field_seek - sybase_result - -sybase_old_functions - sybsql_seek - sybsql_exit - sybsql_dbuse - sybsql_query - sybsql_isrow - sybsql_result - sybsql_connect - sybsql_nextrow - sybsql_numrows - sybsql_getfield - sybsql_numfields - sybsql_fieldname - sybsql_result_all - sybsql_checkconnect - diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 79405cd8fd..0000000000 --- a/INSTALL +++ /dev/null @@ -1,184 +0,0 @@ -Installation Instructions for PHP 4.0 -------------------------------------- - -Note! As of 4.0b3, PHP will require GNU make. - -For the impatient here is a quick set of steps that will build PHP as -an Apache module for Apache 1.3.x with MySQL support. A more verbose -explanation follows. - - -QUICK INSTALL - -$ 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) -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 - -Installing PHP can be done in four simple steps: - -1. Unpack your distribution file. - - You will have downloaded a file named something like php4xn.tar.gz. - Unzip this file with a command like: gunzip php4xn.tar.gz - - Next you have to untar it with: tar -xvf php4xn.tar - - This will create a php-4.0.x directory. cd into this new directory. - -2. Configure PHP. - - 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. - -3. Compile and install the files. Simply type: make install - - 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=//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 - -4. Setting up the server. - - 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/srm.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. - - When you are finished making changes to your srm.conf file, you can - start up your server. - -USING PHP3 AND PHP4 AS CONCURRENT APACHE MODULES - - Recent operating systems provide the ability to perform versioning and - scoping. This features make it possible to let PHP3 and PHP4 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) - - To enable it, configure PHP3 and PHP4 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 537c22acbb..0000000000 --- a/LICENSE +++ /dev/null @@ -1,70 +0,0 @@ --------------------------------------------------------------------- - The PHP License, version 2.01 -Copyright (c) 1999 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. Permission to freely distribute and use Zend as an integrated - part of PHP is granted, under the conditions of version 0.91 - of the Zend License. - The license is bundled with the Zend engine, and is available - at http://www.zend.com/license/0_91.txt, or by contacting - license@zend.com. - - - -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 . diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index 781ffb374b..0000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,101 +0,0 @@ - List of PHP maintainers - ======================= - -Status 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. - --------------------------------------------------------------------------------- -EXTENSION: apache -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: cybercash -PRIMARY MAINTAINER: Evan Klinger -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: dba -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: fdf -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: gd -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: hyperwave -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: informix -PRIMARY MAINTAINER: Danny Heijl -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: java -PRIMARY MAINTAINER: Sam Ruby -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: ldap -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Odd Fixes --------------------------------------------------------------------------------- -EXTENSION: mcrypt -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: mhash -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: mssql -PRIMARY MAINTAINER: Frank M. Kromann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: oci8 -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: oracle -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained -COMMENT: Using the new OCI8 driver is encouraged where possible. --------------------------------------------------------------------------------- -EXTENSION: pcre -PRIMARY MAINTAINER: Andrei Zmievski -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: pdf -PRIMARY MAINTAINER: Uwe Steinmann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: session -PRIMARY MAINTAINER: Sascha Schumann -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: snmp -PRIMARY MAINTAINER: Rasmus Lerdorf -STATUS: Odd Fixes --------------------------------------------------------------------------------- -EXTENSION: wddx -PRIMARY MAINTAINER: Andrei Zmievski -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: xml -PRIMARY MAINTAINER: Thies C. Arntzen -STATUS: Maintained --------------------------------------------------------------------------------- -EXTENSION: zlib -PRIMARY MAINTAINER: Stefan Roehrich -STATUS: Maintained --------------------------------------------------------------------------------- diff --git a/MODULES_STATUS b/MODULES_STATUS deleted file mode 100644 index 398a2f3a01..0000000000 --- a/MODULES_STATUS +++ /dev/null @@ -1,21 +0,0 @@ -Module Status ------- ------ -MySQL Working -COM Working -WDDX Working -PCRE Working -DBA Working -mcrypt Working -mhash Working -dbase Working -aspell Working -imap Working -ldap Working -oci8 Working (but no blob-support yet) -oracle Working -iptc Working -informix Working -zlib Working -sysvshm Working -odbc Working (except for persistent connections) -MS SQL Working (tested on phpts and isapi versions) diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index baf67868c0..0000000000 --- a/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -AUTOMAKE_OPTIONS = foreign - -ZEND_DIR = $(srcdir)/libzend -SUBDIRS = libzend ext sapi $(TSRM_DIR) $(REGEX_DIR) . pear - -BUILDLDFLAGS = $(EXTRA_LDFLAGS) $(LDFLAGS) - -phptemp_LTLIBRARIES = libphp4.la -libphp4_la_SOURCES = \ - main.c internal_functions.c snprintf.c php3_sprintf.c \ - configuration-parser.y configuration-scanner.l request_info.c \ - safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c \ - php_ini.c SAPI.c rfc1867.c dlist.c php_content_types.c strlcpy.c \ - strlcat.c mergesort.c reentrancy.c - -libphp4_la_DEPENDENCIES = \ - libzend/libzend.la \ - sapi/$(PHP_SAPI)/libphpsapi_$(PHP_SAPI).la \ - $(REGEX_LIB) \ - $(EXT_LTLIBS) \ - $(TSRM_LIB) - -libphp4_la_LIBADD = $(libphp4_la_DEPENDENCIES) $(EXTRA_LIBS) - -libphp4_la_LDFLAGS = $(BUILDLDFLAGS) $(PHP_RPATHS) - -configuration-parser.h configuration-parser.c: configuration-parser.y - $(YACC) -p cfg -v -d $< -o configuration-parser.c - -configuration-scanner.c: configuration-scanner.l - $(LEX) -Pcfg -o$@ -i $< - -EXTRA_PROGRAMS = php - -noinst_PROGRAMS = $(PHP_PROGRAM) -php_SOURCES = stub.c -php_LDADD = libphp4.la -php_LDFLAGS = -export-dynamic - -install-data-local: - $(INSTALL_IT) diff --git a/NEWS b/NEWS deleted file mode 100644 index 2864c2e3ec..0000000000 --- a/NEWS +++ /dev/null @@ -1,356 +0,0 @@ -PHP 4.0 NEWS -||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - -?? ?? ????, Version 4.0 Beta 4 -- Made implode() binary-safe (Andrei) -- Made strstr(), stristr(), and ucwords() binary-safe() (Andrei) -- Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei) -- Fix 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) -- explode() is now binary-safe. (Thies) -- strpos() is now 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) -- Add configure command to phpinfo() output (Stig) -- Add 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 library) -- 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 ) -- 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 library) -- 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 library) -- 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) -- Fix 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 library) -- 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 library) -- 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 library) -- 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 PHP3 to PHP4 (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 library) -- Fixed backwards incompatibility with ereg() (Thies) -- Updated Zend garbage collection with a much more thorough method. - (Andi, Zend library) -- Added the ability to use variable references in the array() construct. - For example, array("foo" => &$foo). (Andi, Zend library) -- 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) -- Add support for the Easysoft ODBC-ODCB Bridge (martin@easysoft.com) -- Fix 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 library) -- Fixed sem_get() on AIX (Sascha) -- Fixed fopen() to work with URL's in Win32 (Andi & Zeev) -- Fixed include_path for Win32 (Andi, Zend library) -- Fixed bug in ISAPI header sending function (Charles) -- Fixed memory leak when using undefined values (Andi & Zeev, Zend library) -- 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 library) -- 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 library) -- 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 library) -- Fixed backwards incompatibility with the "new" operator (Andi, Zend library) -- 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 library) -- Fixed a problem in inheritance from classes that are defined in include()d - files (Zeev, Zend library) -- 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 library) -- Fixed a crash problem in switch statements that had a string offset - as a conditional (Andi & Zeev, Zend library) -- 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 library) -- 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-BCMATH b/README-BCMATH deleted file mode 100644 index 7d5bac19a6..0000000000 --- a/README-BCMATH +++ /dev/null @@ -1,17 +0,0 @@ -How to install PHP with the BCMath arbitrary precision math library? --------------------------------------------------------------------- - -Due to license restrictions, the BC math library can no longer be distributed -along with PHP. The BC math library is distributed under the restrictive -GNU Public License, and PHP is no longer distributed under that license, but -under a less restrictive license, the PHP License. - -If you want to enable BC math support (recommended), all you have to do is -simply download http://www.php.net/extra/number4.tar.gz, and untar it on the -top level php4 directory. - -A typical way of doing this would be (assuming that you have lynx): -cd ~/php4 -lynx -dump -source http://www.php.net/extra/number4.tar.gz | gzip -d | tar xvf - - -The PHP Group diff --git a/README.CVS-RULES b/README.CVS-RULES deleted file mode 100644 index e865b470a7..0000000000 --- a/README.CVS-RULES +++ /dev/null @@ -1,102 +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 MAINTANERS 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. - -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.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 - 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/TODO b/TODO deleted file mode 100644 index e5d32e6e36..0000000000 --- a/TODO +++ /dev/null @@ -1,36 +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. - -global ------- - * replace standard functions which work on static data with - reentrant-save functions - * there is only one current directory per process; to make - chdir() etc. thread-safe, we must introduce a per-thread - current directory - * on some platforms unimplemented function will just do nothing (eg symlink) - they should print a warning or be not even defined! - -documentation -------------- - * add remarks in the documentation which functions are not implemented on win32. - * add remarks in the documentation which functions are not binary-safe. - -ext/oci8 --------- - * map boolean value false to oracle NULL. - * all OCIFetch*() functions should return 0 for no more data and false on error. - -ext/standard ------------- - * strpad() (Andrei) - * advanced sort (Andrei) - * NOT binary safe: - strcspn() - strtok() - basename() - dirname() - strrpos() - strrchr() - quotemeta() - strip_tags() diff --git a/TODO-LeftOver b/TODO-LeftOver deleted file mode 100644 index 17b9223544..0000000000 --- a/TODO-LeftOver +++ /dev/null @@ -1,75 +0,0 @@ - - -This is the ChangeLog from PHP3 as of Apr 12 1999. - -Entries should be removed from this file, if you transfer changes -over to PHP4. - -============================================================================ - -?? 1999, Version 3.0.8 -- added Oracle-OCI8 persistent connections -- fixed OCIDefineByName crash. -- fixed some NULL-column related problems in OCI8-module. -- Some Informix driver improvements. -- PUT method support (mlemos@acm.org) -- Fix parameter count problem in odbc_setoption() -- Really fix implode() this time. The fix in 3.0.7 was bogus -- Make fgetss() slightly smarter -- Add strip_tags() which uses the fgetss state-machine but acts on a string - -March 1 1999, Version 3.0.7 -- Added pdf_put_image and pdf_execute_image -- Initial work on an ImageMagick module - doesn't do anything yet -- Make configure script detect Netscape's LDAP SDK automagically -- Fixed Oracle-OCI8 module for windows. -- Add OCIRowCount function. (Number of affected rows for update-statements) -- Add OCIDefineByName function. -- Change the behaviour of open_basedir. It's now possible to supply more - than one directory. open_basedir paths from parent directories are now - automatically inherited. -- fix rand() and mt_rand() to make the ranges work correctly -- htmlspecialchars() and htmlentities() are now binary safe. -- Add extract() function. -- Oracle-OCI8 driver now supports BLOBS/CLOBS and IN/OUT binding of local php - variables. -- Clean up apxs build -- Add INSTALL.REDHAT file to walk RedHat users through the install -- Add function_exists() function. -- Add another version of WDDX module - (we need to pick a single implementation here) -- Fixed includes for iODBC to support both the old and the new LGPL version -- Fix implode() bug - When imploding an array that contained unset() elements - it wasn't correctly skipping past these -- Add connection_status() function. This returns the raw bitfield which - indicates whether the script terminated due to a user abort, a timeout - or normally. Note that if ignore_user_abort is enabled, then both the - timeout state and the user abort state can be active -- Add connection_timeout() function. This one can be called in a shutdown - function to tell you if you got there because of a timeout -- Add ignore_user_abort() function and .ini/.conf directive of same name -- Fix connection abort detection code - It should now work reliably with - Apache. Also added a user-level connection_aborted() function designed to - let people check whether the user aborted the connection in a user-level - shutdown function. -- Add pfsockopen() function -- Improvements in FreeType support: Macintosh fonts work, and non-antialiased - output is considerably cleaner -- Fixed checkdate() function, range of valid years is now 0 to 32767 -- hw_insertdocument() returns object id now -- Add pdf_open() warning in configure and documentation -- Add diskfreespace() function -- Added aspell support -- Iptcparse would sometimes find a wrong tag. -- Force var_dump() to output headers -- Add optional 3th parameter to ora_fetchinto. -- Serialize and var_dump no longer show array elements that - have been unset. -- Add IptcEmbed() function (can replace an APP13-Marker in a JPEG file) -- Add OCI8 module for Windows -- Fix bug in pdf_close() function -- Add WDDX support (see http://www.wddx.org for more info) -- Add similar_text() function -- Introduce simple regex compilation cache - - diff --git a/TSRM/Makefile.am b/TSRM/Makefile.am deleted file mode 100644 index a779ca8552..0000000000 --- a/TSRM/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## process this file with automake to produce Makefile.am -AUTOMAKE_OPTIONS=foreign -noinst_LTLIBRARIES=libtsrm.la -libtsrm_la_SOURCES = TSRM.c diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c deleted file mode 100644 index 8cf563075b..0000000000 --- a/TSRM/TSRM.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to the Zend license, that is bundled | - | with this package in the file LICENSE. If you did not receive a | - | copy of the Zend license, please mail us at zend@zend.com so we can | - | send you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "TSRM.h" -#include -#include - -#if HAVE_STDARG_H -#include -#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; - - -/* The memory manager table */ -static tsrm_tls_entry **tsrm_tls_table; -static int tsrm_tls_table_size; -static ts_rsrc_id id_count; - -/* The resource sizes table */ -static tsrm_resource_type *resource_types_table; -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 */ -static int tsrm_debug(const char *format, ...); -static int tsrm_debug_status; - - -/* Startup TSRM (call once for the entire process) */ -TSRM_API int tsrm_startup(int expected_threads, int expected_resources, int debug_status) -{ -#if defined(GNUPTH) - pth_init(); -#endif - - 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) { - 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) { - free(tsrm_tls_table); - return 0; - } - - tsmm_mutex = tsrm_mutex_alloc(); - - tsrm_new_thread_begin_handler = tsrm_new_thread_end_handler = NULL; - - tsrm_debug_status = debug_status; - - tsrm_debug("Started up TSRM, %d expected threads, %d expected resources\n", 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; inext; - for (j=0; jstorage[j]); - } - free(p->storage); - free(p); - p = next_p; - } - } - free(tsrm_tls_table); - } - if (resource_types_table) { - free(resource_types_table); - } - tsrm_mutex_free(tsmm_mutex); - tsrm_debug("Shutdown TSRM\n"); -#if defined(GNUPTH) - pth_kill(); -#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_debug("Obtaining a new resource id, %d bytes\n", size); - - tsrm_mutex_lock(tsmm_mutex); - - /* obtain a resource id */ - new_id = id_count++; - tsrm_debug("Obtained resource id %d\n", 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) { - return -1; - } - 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; icount < id_count) { - int j; - - p->storage = (void *) realloc(p->storage, sizeof(void *)*id_count); - for (j=p->count; jstorage[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_debug("Successfully allocated new resource id %d\n", new_id); - return new_id; -} - - -static void allocate_new_resource(tsrm_tls_entry **thread_resources_ptr, THREAD_T thread_id) -{ - int i; - - (*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; - - tsrm_mutex_unlock(tsmm_mutex); - - if (tsrm_new_thread_begin_handler) { - tsrm_new_thread_begin_handler(thread_id); - } - for (i=0; istorage[i] = (void *) malloc(resource_types_table[i].size); - if (resource_types_table[i].ctor) { - resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]); - } - } - if (tsrm_new_thread_end_handler) { - tsrm_new_thread_end_handler(thread_id); - } -} - - -/* fetches the requested resource for the current thread */ -void *ts_resource(ts_rsrc_id id) -{ - THREAD_T thread_id = tsrm_thread_id(); - int hash_value; - tsrm_tls_entry *thread_resources; - void *resource; - - tsrm_debug("Fetching resource id %d for thread %ld\n", 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(id); - /* thread_resources = tsrm_tls_table[hash_value]; */ - } 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(id); - /* - * thread_resources = thread_resources->next; - * break; - */ - } - } while (thread_resources); - } - - resource = thread_resources->storage[id]; - - tsrm_mutex_unlock(tsmm_mutex); - - tsrm_debug("Successfully fetched resource id %d for thread id %ld - %x\n", id, (long) thread_id, (long) resource); - return resource; -} - - -/* frees all resources allocated for the current thread */ -void ts_free_thread(void) -{ - THREAD_T thread_id = tsrm_thread_id(); - int hash_value; - tsrm_tls_entry *thread_resources; - 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) { - int i; - - for (i=0; icount; i++) { - if (resource_types_table[i].dtor) { - resource_types_table[i].dtor(thread_resources->storage[i]); - } - free(thread_resources->storage[i]); - } - free(thread_resources->storage); - if (last) { - last->next = thread_resources->next; - } else { - tsrm_tls_table[hash_value]=NULL; - } - 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 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(); -#endif -} - - -/* Allocate a mutex */ -TSRM_API MUTEX_T tsrm_mutex_alloc( void ) -{ - MUTEX_T mutexp; - -#ifdef WIN32 - mutexp = CreateMutex(NULL,FALSE,NULL); -#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(); -#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 WIN32 - CloseHandle(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) -#endif - } -#ifdef THR_DEBUG - printf("Mutex freed thread: %d\n",mythreadid()); -#endif -} - - -/* Lock a mutex */ -TSRM_API int tsrm_mutex_lock( MUTEX_T mutexp ) -{ -#if 0 - tsrm_debug("Mutex locked thread: %ld\n",tsrm_thread_id()); -#endif -#ifdef WIN32 - return WaitForSingleObject(mutexp,1000); -#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); -#endif -} - - -/* Unlock a mutex */ -TSRM_API int tsrm_mutex_unlock( MUTEX_T mutexp ) -{ -#if 0 - tsrm_debug("Mutex unlocked thread: %ld\n",tsrm_thread_id()); -#endif -#ifdef WIN32 - return ReleaseMutex(mutexp); -#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); -#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 - */ - -static int tsrm_debug(const char *format, ...) -{ - if (tsrm_debug_status) { - va_list args; - int size; - - va_start(args, format); - size = vprintf(format, args); - va_end(args); - return size; - } else { - return 0; - } -} - - -void tsrm_debug_set(int status) -{ - tsrm_debug_status = status; -} diff --git a/TSRM/TSRM.dsp b/TSRM/TSRM.dsp deleted file mode 100644 index 7b284ab3eb..0000000000 --- a/TSRM/TSRM.dsp +++ /dev/null @@ -1,100 +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 - -# 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 "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "_LIB" /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 "WIN32" /D "_MBCS" /D "_LIB" /D "TSRM_EXPORTS" /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" -# 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 -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\TSRM.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 35eb53676b..0000000000 --- a/TSRM/TSRM.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Thread Safe Resource Manager | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to the Zend license, that is bundled | - | with this package in the file LICENSE. If you did not receive a | - | copy of the Zend license, please mail us at zend@zend.com so we can | - | send you a copy immediately. | - +----------------------------------------------------------------------+ - | Author: Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _TSRM_H -#define _TSRM_H - -#ifdef HAVE_CONFIG_H -# undef PACKAGE -# undef VERSION -# include "tsrm_config.h" -# undef PACKAGE -# undef VERSION -#endif - -#if WIN32||WINNT -# include -#elif defined(GNUPTH) -# include -#elif defined(PTHREADS) -# include -#endif - -typedef int ts_rsrc_id; - -#if WIN32||WINNT -# 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 */ -#if defined(WIN32) -# define THREAD_T DWORD -# define MUTEX_T void * -#elif defined(GNUPTH) -# define THREAD_T pth_attr_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 * -#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_status); -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(ts_rsrc_id id); - -/* 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 */ -TSRM_API void tsrm_debug_set(int status); - -/* 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 /* _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 ded8166948..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) -AM_CONFIG_HEADER(tsrm_config.h) - -AC_PROG_CC -AM_PROG_CC_STDC -AC_PROG_CC_C_O -AC_PROG_RANLIB - -AM_PROG_LIBTOOL -if test "$enable_debug" != "yes"; then - AM_SET_LIBTOOL_VARIABLE([--silent]) -fi - -AC_CHECK_LIB(c_r, pthread_kill) -AC_CHECK_LIB(pthread, pthread_kill) - -AC_CHECK_FUNCS(pthread_kill) - -if test "$ac_cv_func_pthread_kill" != "yes"; then - AC_MSG_ERROR(You need pthreads to build TSRM.) -fi - -AC_DEFINE(PTHREADS) - -AC_CHECK_HEADERS(stdarg.h) - -AC_OUTPUT(Makefile) diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h deleted file mode 100644 index 549177b8b9..0000000000 --- a/Zend/FlexLexer.h +++ /dev/null @@ -1,186 +0,0 @@ -// $Header$ - -// FlexLexer.h -- define interfaces for lexical analyzer classes generated -// by flex - -// Copyright (c) 1993 The Regents of the University of California. -// All rights reserved. -// -// This code is derived from software contributed to Berkeley by -// Kent Williams and Tom Epperly. -// -// Redistribution and use in source and binary forms with or without -// modification are permitted provided that: (1) source distributions retain -// this entire copyright notice and comment, and (2) distributions including -// binaries display the following acknowledgement: ``This product includes -// software developed by the University of California, Berkeley and its -// contributors'' in the documentation or other materials provided with the -// distribution and in all advertising materials mentioning features or use -// of this software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - -// This file defines FlexLexer, an abstract class which specifies the -// external interface provided to flex C++ lexer objects, and yyFlexLexer, -// which defines a particular lexer class. -// -// If you want to create multiple lexer classes, you use the -P flag -// to rename each yyFlexLexer to some other xxFlexLexer. You then -// include in your other sources once per lexer class: -// -// #undef yyFlexLexer -// #define yyFlexLexer xxFlexLexer -// #include -// -// #undef yyFlexLexer -// #define yyFlexLexer zzFlexLexer -// #include -// ... - -#ifndef __FLEX_LEXER_H -// Never included before - need to define base class. -#define __FLEX_LEXER_H -#include - -extern "C++" { - -struct yy_buffer_state; -typedef int yy_state_type; - -class FlexLexer { -public: - virtual ~FlexLexer() { } - - const char* YYText() { return yytext; } - int YYLeng() { return yyleng; } - - virtual void - yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0; - virtual struct yy_buffer_state* - yy_create_buffer( istream* s, int size ) = 0; - virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0; - virtual void yyrestart( istream* s ) = 0; - - virtual int yylex() = 0; - - // Call yylex with new input/output sources. - int yylex( istream* new_in, ostream* new_out = 0 ) - { - switch_streams( new_in, new_out ); - return yylex(); - } - - // Switch to new input/output streams. A nil stream pointer - // indicates "keep the current one". - virtual void switch_streams( istream* new_in = 0, - ostream* new_out = 0 ) = 0; - - int lineno() const { return yylineno; } - - int debug() const { return yy_flex_debug; } - void set_debug( int flag ) { yy_flex_debug = flag; } - -protected: - char* yytext; - int yyleng; - int yylineno; // only maintained if you use %option yylineno - int yy_flex_debug; // only has effect with -d or "%option debug" -}; - -} -#endif - -#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce) -// Either this is the first time through (yyFlexLexerOnce not defined), -// or this is a repeated include to define a different flavor of -// yyFlexLexer, as discussed in the flex man page. -#define yyFlexLexerOnce - -class yyFlexLexer : public FlexLexer { -public: - // arg_yyin and arg_yyout default to the cin and cout, but we - // only make that assignment when initializing in yylex(). - yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 ); - - virtual ~yyFlexLexer(); - - void yy_switch_to_buffer( struct yy_buffer_state* new_buffer ); - struct yy_buffer_state* yy_create_buffer( istream* s, int size ); - void yy_delete_buffer( struct yy_buffer_state* b ); - void yyrestart( istream* s ); - - virtual int yylex(); - virtual void switch_streams( istream* new_in, ostream* new_out ); - -protected: - virtual int LexerInput( char* buf, int max_size ); - virtual void LexerOutput( const char* buf, int size ); - virtual void LexerError( const char* msg ); - - void yyunput( int c, char* buf_ptr ); - int yyinput(); - - void yy_load_buffer_state(); - void yy_init_buffer( struct yy_buffer_state* b, istream* s ); - void yy_flush_buffer( struct yy_buffer_state* b ); - - int yy_start_stack_ptr; - int yy_start_stack_depth; - int* yy_start_stack; - - void yy_push_state( int new_state ); - void yy_pop_state(); - int yy_top_state(); - - yy_state_type yy_get_previous_state(); - yy_state_type yy_try_NUL_trans( yy_state_type current_state ); - int yy_get_next_buffer(); - - istream* yyin; // input source for default LexerInput - ostream* yyout; // output sink for default LexerOutput - - struct yy_buffer_state* yy_current_buffer; - - // yy_hold_char holds the character lost when yytext is formed. - char yy_hold_char; - - // Number of characters read into yy_ch_buf. - int yy_n_chars; - - // Points to current character in buffer. - char* yy_c_buf_p; - - int yy_init; // whether we need to initialize - int yy_start; // start state number - - // Flag which is used to allow yywrap()'s to do buffer switches - // instead of setting up a fresh yyin. A bit of a hack ... - int yy_did_buffer_switch_on_eof; - - // The following are not always needed, but may be depending - // on use of certain flex features (like REJECT or yymore()). - - yy_state_type yy_last_accepting_state; - char* yy_last_accepting_cpos; - - yy_state_type* yy_state_buf; - yy_state_type* yy_state_ptr; - - char* yy_full_match; - int* yy_full_state; - int yy_full_lp; - - int yy_lp; - int yy_looking_for_trail_begin; - - int yy_more_flag; - int yy_more_len; - int yy_more_offset; - int yy_prev_more_offset; -}; - -#endif diff --git a/Zend/LICENSE b/Zend/LICENSE deleted file mode 100644 index 1dd42f1ff3..0000000000 --- a/Zend/LICENSE +++ /dev/null @@ -1,116 +0,0 @@ ---------------------------------------------------------------------------- - The Zend License, version 0.91 - Copyright (C) 1999 Andi Gutmans & Zeev Suraski ---------------------------------------------------------------------------- - -The Zend scripting engine library is a product of Andi Gutmans and -Zeev Suraski. It may be used and/or distributed under the terms of the -Q Public License (QPL) version 1.0, enclosed below. - -For more information about Zend please visit http://www.zend.com/ -For license related questions please mail license@zend.com - -=========================================================================== - - THE Q PUBLIC LICENSE - version 1.0 - - Copyright (C) 1999 Troll Tech AS, Norway. - Everyone is permitted to copy and - distribute this license document. - -The intent of this license is to establish freedom to share and change the -software regulated by this license under the open source model. - -This license applies to any software containing a notice placed by the -copyright holder saying that it may be distributed under the terms of -the Q Public License version 1.0. Such software is herein referred to as -the Software. This license covers modification and distribution of the -Software, use of third-party application programs based on the Software, -and development of free software which uses the Software. - - Granted Rights - -1. You are granted the non-exclusive rights set forth in this license - provided you agree to and comply with any and all conditions in this - license. Whole or partial distribution of the Software, or software - items that link with the Software, in any form signifies acceptance of - this license. - -2. You may copy and distribute the Software in unmodified form provided - that the entire package, including - but not restricted to - copyright, - trademark notices and disclaimers, as released by the initial developer - of the Software, is distributed. - -3. You may make modifications to the Software and distribute your - modifications, in a form that is separate from the Software, such as - patches. The following restrictions apply to modifications: - - a. Modifications must not alter or remove any copyright notices in - the Software. - - b. When modifications to the Software are released under this - license, a non-exclusive royalty-free right is granted to the - initial developer of the Software to distribute your modification - in future versions of the Software provided such versions remain - available under these terms in addition to any other license(s) of - the initial developer. - -4. You may distribute machine-executable forms of the Software or - machine-executable forms of modified versions of the Software, provided - that you meet these restrictions: - - a. You must include this license document in the distribution. - - b. You must ensure that all recipients of the machine-executable forms - are also able to receive the complete machine-readable source code - to the distributed Software, including all modifications, without - any charge beyond the costs of data transfer, and place prominent - notices in the distribution explaining this. - - c. You must ensure that all modifications included in the - machine-executable forms are available under the terms of this - license. - -5. You may use the original or modified versions of the Software to - compile, link and run application programs legally developed by you - or by others. - -6. You may develop application programs, reusable components and other - software items that link with the original or modified versions of the - Software. These items, when distributed, are subject to the following - requirements: - - a. You must ensure that all recipients of machine-executable forms of - these items are also able to receive and use the complete - machine-readable source code to the items without any charge - beyond the costs of data transfer. - - b. You must explicitly license all recipients of your items to use - and re-distribute original and modified versions of the items in - both machine-executable and source code forms. The recipients must - be able to do so without any charges whatsoever, and they must be - able to re-distribute to anyone they choose. - - - c. If the items are not available to the general public, and the - initial developer of the Software requests a copy of the items, - then you must supply one. - - Limitations of Liability - -In no event shall the initial developers or copyright holders be liable -for any damages whatsoever, including - but not restricted to - lost -revenue or profits or other direct, indirect, special, incidental or -consequential damages, even if they have been advised of the possibility -of such damages, except to the extent invariable law, if any, provides -otherwise. - - No Warranty - -The Software and this license document are provided AS IS with NO WARRANTY -OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE. - - -=========================================================================== \ No newline at end of file diff --git a/Zend/Makefile.am b/Zend/Makefile.am deleted file mode 100644 index 3a0c970714..0000000000 --- a/Zend/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- - -#CLEANFILES = zend-parser.c zend-parser.h zend-scanner.c zend-parser.output - -ZEND_SCANNER = @ZEND_SCANNER@ - -AUTOMAKE_OPTIONS=foreign -EXTRA_LTLIBRARIES=libzend_cc.la libzend_c.la -noinst_LTLIBRARIES=$(ZEND_SCANNER) libzend.la - -libzend_cc_la_SOURCES=zend-scanner-cc.cc -libzend_c_la_SOURCES=zend-scanner.c - -libzend_la_SOURCES=\ - zend-parser.y \ - zend_alloc.c zend_compile.c zend_constants.c \ - zend_execute.c zend_execute_API.c zend_highlight.c zend_llist.c \ - zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ - zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \ - zend_list.c zend_indent.c zend_builtin_functions.c - -libzend_la_LIBADD = $(ZEND_SCANNER) -libzend_la_LDFLAGS = @EXTRA_LIBS@ -libzend_la_DEPENDENCIES = $(ZEND_SCANNER) - -# automake isn't too clever about "non-standard" use of lex and yacc - -zend-scanner.l: zend-parser.h - -zend-scanner.c: zend-scanner.l - $(LEX) -Pzend -o$@ -i $(srcdir)/zend-scanner.l - -zend-scanner-cc.cc: zend-scanner.l - $(LEX) -+ -B -i -S$(srcdir)/flex.skl -Pzend -o$@ $(srcdir)/zend-scanner.l - -zend-parser.h: zend-parser.c -zend-parser.c: zend-parser.y - $(YACC) -p zend -v -d $(srcdir)/zend-parser.y -o zend-parser.c - diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES deleted file mode 100644 index 0c144e2d5c..0000000000 --- a/Zend/ZEND_CHANGES +++ /dev/null @@ -1,111 +0,0 @@ -Improvements ------------- - -Zend was designed from the ground up for increased speed, -reduced memory consumption and more reliable execution. We dare -say it meets all of these goals and does so pretty well. Beyond -that, there are several improvements in the language engine -features: - -* References support. $foo = &$a; would make $foo and $a be two - names to the same variable. This works with arrays as well, - on either side; e.g., $foo = &$a[7]; would make $foo and $a[7] - be two names to the same variable. Changing one would change - the other and vice versa. -* Object overloading support. This feature allows various OO - libraries to use the OO notation of PHP to access their - functionality. Right now, no use is made of that feature, - but we'd have a COM module ready by the time PHP 4.0 is released. - A CORBA module would probably follow. -* include() and eval() are now functions, and not statements. - That means they return a value. The default return value from - include() and eval() is 1, so that you can do if (include()) - without further coding. The return value may be changed by - returning a value from the global scope of the included file - or the evaluated string. For example, if 'return 7;' is executed - in the global scope of foo.inc, include("foo.inc") would evaluate - to 7. -* Automatic resource deallocation. Several people have been bitten - by the fact that PHP 3.0 had no concept of reference counting. - Zend adds full reference counting for every value in the system, - including resources. As soon as a resource is no longer referenced - from any variable, it is automatically destroyed to save memory - and resources. The most obvious example for the advantage in this - is a loop that has an SQL query inside it, something like - '$result = sql_query(...);'. In PHP 3.0, every iteration resulted - in another SQL result-set allocated in the memory, and all of the - result sets weren't destroyed until the end of the script's execution. - In Zend, as soon as we overwrite an old result set with a new one, - the old result set which is no longer referenced, is destroyed. -* Full support for nesting arrays and objects within each other, in - as many levels as you want. -* Boolean type. true and false are now constants of type boolean. - Comparing any other value to them would convert that value to a - boolean first, and conduct the comparison later. That means, for - example, that 5==true would evaluate to true (in PHP 3.0, true - was nothing but a constant for the integer value of 1, so 5==true - was identical to 5==1, which was false). -* Runtime binding of function names. This complex name has a simple - explanation - you can now call functions before they're declared! -* Added here-docs support. -* Added foreach. Two syntaxes supported: - foreach(array_expr as $val) statement - foreach(array_expr as $key => $val) statement -* A true unset() implementation. A variable or element that is unset(), is now - sent to oblivion in its entirely, no trace remains from it. -* Output buffering support! Use ob_start() to begin output buffering, ob_end_flush() - to end buffering and send out the buffered contents, ob_end_clean() to end buffering - without sending the buffered contents, and ob_get_contents() to retreive the current - contents of the output buffer. - Header information (header(), content type, cookies) are not buffered. By turning - on output buffering, you can effectively send header information all throughout your - file, regardless of whether you've emitted body output or not. -* Full variable reference within quoted strings: - ${expr} - full indirect reference support for scalar variables - {variable} - full variable support - For example: - $foo[5]["bar"] = "foobar"; - print "{$foo[5]["bar"]}"; // would print "foobar" -* Ability to call member functions of other classes from within member functions or from - the global scope. You can now, for example, override a parent function with a child function, - and call the parent function from it. -* Runtime information for classes (class name, parent, available functions, etc.). -* Much more efficient syntax highlighter - runs much quicker, performs more reliably, and - generates much tighter HTML. -* A full-featured debugger has been integrated with the language (supports breakpoints, - expression evaluation, step-in/over, function call backtrace, and more). - - -Incompatabilities ------------------ - -Zend claims 100% compatability with the engine of PHP 3.0, and is -shamelessly lying about it. Here's why: - -* static variable initializers only accept scalar values - (in PHP 3.0 they accepted any valid expression). The impact - should be somewhere in between void and non existant, since - initializing a static variable with anything but a simple - static value makes no sense at all. - -* The scope of break and continue is local to that of an - include()'d file or an eval()'d string. The impact should - be somewhat smaller of the one above. - -* return statement from a require()'d file no longer works. It - hardly worked in PHP 3.0, so the impact should be fairly small. - If you want this functionality - use include() instead. - -* unset() is no longer a function, but a statement. It was never - documented as a function so the impact should be no bigger than - nada. - -* The following letter combination is not supported within encapsulated - strings: "{$". If you have a string that includes this letter - combination, for example, print "{$somevar"; (which printed the - letter { and the contents of the variable $somevar in PHP 3.0), - it will result in a parse error under Zend. In this case, you - would have to change the code to print "\{$somevar"; - This incompatability is due to the full variable reference - within quoted strings feature added in Zend. - diff --git a/Zend/ZendCore.dep b/Zend/ZendCore.dep deleted file mode 100644 index 5320a0b674..0000000000 --- a/Zend/ZendCore.dep +++ /dev/null @@ -1,258 +0,0 @@ -# Microsoft Developer Studio Generated Dependency File, included by ZendCore.mak - -.\zend_alloc.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\alloca.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_compile.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_constants.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_operators.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_execute.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_highlight.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_highlight.h"\ - ".\zend_llist.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend-parser.tab.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\zend_llist.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_llist.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_opcode.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -.\zend_operators.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - - -.\zend_ptr_stack.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_ptr_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_stack.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_stack.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_variables.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\modules.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - ".\zend_list.h"\ - - -.\zend.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend_operators.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_API.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_compile.h"\ - ".\zend_config.w32.h"\ - ".\zend_constants.h"\ - ".\zend_execute.h"\ - ".\zend_llist.h"\ - ".\modules.h"\ - ".\zend_operators.h"\ - ".\zend_ptr_stack.h"\ - ".\zend_stack.h"\ - ".\zend_variables.h"\ - ".\zend.h"\ - ".\zend_API.h"\ - ".\zend_errors.h"\ - ".\zend_globals.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - ".\zend_list.h"\ - - -.\zend_hash.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - - -.\zend_ini.c : \ - "..\..\..\program files\microsoft visual studio\vc98\include\basetsd.h"\ - ".\zend_alloc.h"\ - ".\zend_config.w32.h"\ - ".\zend.h"\ - ".\zend_errors.h"\ - ".\zend_hash.h"\ - ".\zend_ini.h"\ - - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - -!IF "$(CFG)" == "ZendCore - Win32 Release" - -!ELSEIF "$(CFG)" == "ZendCore - Win32 Debug" - -!ENDIF - diff --git a/Zend/acconfig.h b/Zend/acconfig.h deleted file mode 100644 index ae8de50c84..0000000000 --- a/Zend/acconfig.h +++ /dev/null @@ -1,89 +0,0 @@ -#undef HAVE_CLASS_ISTDIOSTREAM - -#define ZEND_API - -@TOP@ - -/* This is the default configuration file to read */ -#define USE_CONFIG_FILE 1 - -/* these are defined by automake */ -#undef PACKAGE -#undef VERSION - -/* define uint by configure if it is missed (QNX and BSD derived) */ -#undef uint - -/* define ulong by configure if it is missed (most probably is) */ -#undef ulong - -/* Undefine if you want stricter XML/SGML compliance by default */ -/* (this disables "" by default) */ -#define T_DEFAULT_SHORT_OPEN_TAG 1 - -/* Define both of these if you want the bundled REGEX library */ -#define REGEX 0 -#define HSREGEX 0 - -#undef ZEND_DEBUG - -/* Define if you want to enable bc style precision math support */ -#define WITH_BCMATH 0 - -/* Define if you want to enable memory limit support */ -#define MEMORY_LIMIT 0 - -/* Define if you have broken sprintf function like SunOS 4 */ -#define BROKEN_SPRINTF 0 - -/* Define to compile Zend thread safe */ -#undef ZTS - -#undef HAVE_LIBDL - -@BOTTOM@ - -#ifdef HAVE_STDLIB_H -# include -#endif - -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#ifdef HAVE_STRING_H -# include -#else -# include -#endif - -/* Define if you have stdiostream.h */ -#undef HAVE_STDIOSTREAM_H - -#ifdef HAVE_DLFCN_H -# include -#endif - -#if defined(HAVE_LIBDL) && defined(RTLD_NOW) -# define DL_LOAD(libname) dlopen(libname, RTLD_NOW) -# define DL_UNLOAD dlclose -# define DL_FETCH_SYMBOL dlsym -# define DL_HANDLE void * -# define ZEND_EXTENSIONS_SUPPORT 1 -#else -# define DL_HANDLE void * -# define ZEND_EXTENSIONS_SUPPORT 0 -#endif - -#if ZEND_BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...); -#else -# define zend_sprintf sprintf -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4 deleted file mode 100644 index 3202fc7207..0000000000 --- a/Zend/acinclude.m4 +++ /dev/null @@ -1,25 +0,0 @@ -dnl $Id$ -dnl -dnl This file contains local autoconf functions. - -dnl -dnl Check for broken sprintf() -dnl -AC_DEFUN(AC_ZEND_BROKEN_SPRINTF,[ - AC_MSG_CHECKING([for broken sprintf]) - AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[ - AC_DEFINE(ZEND_BROKEN_SPRINTF,0) - AC_MSG_RESULT(ok) - ],[ - AC_DEFINE(ZEND_BROKEN_SPRINTF,1) - AC_MSG_RESULT(broken) - ],[ - AC_DEFINE(ZEND_BROKEN_SPRINTF,0) - AC_MSG_RESULT(cannot check, guessing ok) - ]) -]) - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - diff --git a/Zend/build.mk b/Zend/build.mk deleted file mode 100644 index 6105ff12c4..0000000000 --- a/Zend/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 = zend_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/Zend/buildconf b/Zend/buildconf deleted file mode 100755 index fe8dee6f76..0000000000 --- a/Zend/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/Zend/configure.in b/Zend/configure.in deleted file mode 100644 index ad8b78a370..0000000000 --- a/Zend/configure.in +++ /dev/null @@ -1,210 +0,0 @@ -dnl $Id$ -dnl Process this file with autoconf to produce a configure script. - -AC_INIT(zend.c) -AM_INIT_AUTOMAKE(zend, 0.80A) -AM_CONFIG_HEADER(zend_config.h) -AM_SANITY_CHECK -AM_MAINTAINER_MODE -ZEND_VERSION=$VERSION - -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_YACC -if test "$YACC" != "bison -y"; then - AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.) -else - AC_MSG_CHECKING(bison version) - set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'` - if test "$1" = "1" -a "$2" -lt "25"; then - AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the Zend parser (found $1.$2).) - fi - AC_MSG_RESULT($1.$2 (ok)) -fi -AC_PROG_CC -if test "$enable_thread_safety" = "yes" ; then -AC_PROG_CXX -fi -AC_PROG_CC_C_O -AM_PROG_LEX - -AM_PROG_LIBTOOL -if test "$enable_debug" != "yes"; then - AM_SET_LIBTOOL_VARIABLE([--silent]) -fi -AM_PROG_CC_STDC -AC_C_INLINE - -dnl Hack to work around a Mac OS X cpp problem -dnl Known versions needing this workaround are 5.3 and 5.4 -if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then - CPPFLAGS="$CPPFLAGS -traditional-cpp" -fi - -dnl Ugly hack to get around a problem with gcc on AIX. -if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ - "`uname -sv`" = "AIX 4"; then - CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` -fi - -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 - CFLAGS="$CFLAGS -I/usr/pkg/include" - LDFLAGS="$LDFLAGS -L/usr/pkg/lib" -fi - -AC_CHECK_LIB(c, dlopen, [ - # fake it - AC_DEFINE(HAVE_LIBDL) ], [ - AC_CHECK_LIB(dl, dlopen, [ - LIBS="-ldl $LIBS" - AC_DEFINE(HAVE_LIBDL) ], []) ]) - -dnl Checks for header files. -AC_HEADER_STDC - -dnl QNX requires unix.h to allow functions in libunix to work properly -AC_CHECK_HEADERS(limits.h malloc.h string.h unistd.h stdarg.h sys/types.h signal.h unix.h dlfcn.h) - -if test "$enable_thread_safety" = "yes" ; then -dnl C++ specific header files -AC_LANG_CPLUSPLUS -AC_CHECK_HEADER(stdiostream.h, [ AC_DEFINE(HAVE_STDIOSTREAM_H) ]) -AC_LANG_C -fi - -dnl Checks for types -AC_TYPE_SIZE_T -AC_TYPE_SIGNAL - -dnl This is required for QNX and may be some BSD derived systems -AC_CHECK_TYPE( uint, unsigned int ) -AC_CHECK_TYPE( ulong, unsigned long ) - -dnl Checks for library functions. -AC_FUNC_VPRINTF -AC_FUNC_MEMCMP -AC_FUNC_ALLOCA -AC_CHECK_FUNCS(memcpy strdup getpid kill strtod strtol) -AC_ZEND_BROKEN_SPRINTF - -AC_MSG_CHECKING(whether to include debugging symbols) -AC_ARG_ENABLE(debug, -[ --disable-debug Compile without debugging symbols], -[ - if test "$enableval" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(ZEND_DEBUG,1) - DEBUG_CFLAGS="-g" - test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall" - test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \ - DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" - else - AC_MSG_RESULT(no) - AC_DEFINE(ZEND_DEBUG,0) - DEBUG_CFLAGS="" - fi -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(ZEND_DEBUG,1) - DEBUG_CFLAGS="-g" -]) -AC_SUBST(DEBUG_CFLAGS) -CFLAGS="$CFLAGS $DEBUG_CFLAGS" - -RESULT=yes -AC_MSG_CHECKING(whether to enable inline) -AC_ARG_ENABLE(inline, -[ --disable-inline Disable the inline specifier], -[ - if test "$enableval" = "no"; then - RESULT=no - fi -]) -AC_MSG_RESULT($RESULT) - -if test "$RESULT" = "yes"; then - AC_C_INLINE -else - AC_DEFINE(inline, []) -fi - -AC_MSG_CHECKING(whether to enable a memory limit) -AC_ARG_ENABLE(memory-limit, -[ --enable-memory-limit Compile with memory limit support. ], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(MEMORY_LIMIT, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(MEMORY_LIMIT, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(MEMORY_LIMIT, 0) - AC_MSG_RESULT(no) -]) - - -ZEND_SCANNER_TYPE=c -dnl Sigh. This will probably break automake's automatic dependencies.. -AC_MSG_CHECKING(whether to build Zend thread-safe) -AC_ARG_ENABLE(thread-safety, -[ --enable-thread-safety Whether to build Zend thread-safe.],[ - if test "$enableval" = "yes"; then - AC_DEFINE(ZTS) - ZEND_SCANNER_TYPE=cc - CPPFLAGS="$CPPFLAGS -I../TSRM" - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) -AC_SUBST(TSRM_DIR) -AC_SUBST(TSRM_LIB) -ZEND_SCANNER="libzend_${ZEND_SCANNER_TYPE}.la" -AC_SUBST(ZEND_SCANNER) - -if test "$enable_thread_safety" = "yes" ; then -AC_CHECK_LIB(C, cin) -AC_CHECK_LIB(g++, cin) -AC_CHECK_LIB(stdc++, cin) -dnl Digital Unix 4.0 -AC_CHECK_LIB(cxx, cin) -AC_CHECK_LIB(cxxstd, __array_delete) - -AC_LANG_SAVE -AC_LANG_CPLUSPLUS -AC_MSG_CHECKING(for class istdiostream) -AC_TRY_COMPILE([ -#include -#include -#include -#include -],[ -istdiostream *foo = new istdiostream((FILE *) 0); -],[ - AC_DEFINE(HAVE_CLASS_ISTDIOSTREAM, 1) - AC_MSG_RESULT(yes) -],[ - AC_MSG_RESULT(no) -]) -AC_LANG_RESTORE - -fi - -EXTRA_LIBS="$LIBS" -LIBS="" -AC_SUBST(EXTRA_LIBS) -AC_OUTPUT(Makefile) - -# Local Variables: -# tab-width: 4 -# End: diff --git a/Zend/flex.skl b/Zend/flex.skl deleted file mode 100644 index 7c87706948..0000000000 --- a/Zend/flex.skl +++ /dev/null @@ -1,1541 +0,0 @@ -/* A lexical scanner generated by flex */ - -/* Scanner skeleton version: - * $Header$ - */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 - -%- -#include -%* - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - -#include -%+ -class istream; -%* -#if HAVE_UNISTD_H -#include -#endif - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -#if __STDC__ - -#define YY_USE_PROTOS -#define YY_USE_CONST - -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN yy_start = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START ((yy_start - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#define YY_BUF_SIZE 16384 - -typedef struct yy_buffer_state *YY_BUFFER_STATE; - -extern int yyleng; -%- -extern FILE *yyin, *yyout; -%* - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; - - -struct yy_buffer_state - { -%- - FILE *yy_input_file; -%+ - istream* yy_input_file; -%* - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - }; - -%- Standard (non-C++) definition -static YY_BUFFER_STATE yy_current_buffer = 0; -%* - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - */ -#define YY_CURRENT_BUFFER yy_current_buffer - - -%- Standard (non-C++) definition -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart YY_PROTO(( FILE *input_file )); - -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) - -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); -%* - -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) - -%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here - -%- Standard (non-C++) definition -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); -%* - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ -%% code to fiddle yytext and yyleng for yymore() goes here - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ -%% code to copy yytext_ptr to yytext[] goes here, if %array - yy_c_buf_p = yy_cp; - -%% data tables for the DFA and the user's section 1 definitions go here - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); -#else -extern int yywrap YY_PROTO(( void )); -#endif -#endif - -%- -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif -%* - -#ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); -#endif - -#ifndef YY_NO_INPUT -%- Standard (non-C++) definition -#ifdef __cplusplus -static int yyinput YY_PROTO(( void )); -#else -static int input YY_PROTO(( void )); -#endif -%* -#endif - -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#define YY_READ_BUF_SIZE 8192 -#endif - -/* Copy whatever the last rule matched to the standard output. */ - -#ifndef ECHO -%- Standard (non-C++) definition -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) -%+ C++ definition -#define ECHO LexerOutput( yytext, yyleng ) -%* -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ -%% fread()/read() definition of YY_INPUT goes here unless we're doing C++ -%+ C++ definition - if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); -%* -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -%- -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -%+ -#define YY_FATAL_ERROR(msg) LexerError( msg ) -%* -#endif - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -%- Standard (non-C++) definition -#define YY_DECL int yylex YY_PROTO(( void )) -%+ C++ definition -#define YY_DECL int yyFlexLexer::yylex() -%* -#endif - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK break; -#endif - -%% YY_RULE_SETUP definition goes here - -YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - -%% user's declarations go here - - if ( yy_init ) - { - yy_init = 0; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! yy_start ) - yy_start = 1; /* first start state */ - - if ( ! yyin ) -%- - yyin = stdin; -%+ - yyin = &cin; -%* - - if ( ! yyout ) -%- - yyout = stdout; -%+ - yyout = &cout; -%* - - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_load_buffer_state(); - } - - while ( 1 ) /* loops until end-of-file is reached */ - { -%% yymore()-related code goes here - yy_cp = yy_c_buf_p; - - /* Support of yytext. */ - *yy_cp = yy_hold_char; - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - -%% code to set up and find next match goes here - -yy_find_action: -%% code to find the action number goes here - - YY_DO_BEFORE_ACTION; - -%% code for yylineno update goes here - -do_action: /* This label is used only to access EOF actions. */ - -%% debug code goes here - - switch ( yy_act ) - { /* beginning of action switch */ -%% actions go here - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = yytext_ptr + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { -%% code to do back-up for compressed tables and set up yy_cp goes here - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; - - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; - - yy_current_state = yy_get_previous_state(); - - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ - -%+ -yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout ) - { - yyin = arg_yyin; - yyout = arg_yyout; - yy_c_buf_p = 0; - yy_init = 1; - yy_start = 0; - yy_flex_debug = 0; - yylineno = 1; // this will only get updated if %option yylineno - - yy_did_buffer_switch_on_eof = 0; - - yy_looking_for_trail_begin = 0; - yy_more_flag = 0; - yy_more_len = 0; - yy_more_offset = yy_prev_more_offset = 0; - - yy_start_stack_ptr = yy_start_stack_depth = 0; - yy_start_stack = 0; - - yy_current_buffer = 0; - -#ifdef YY_USES_REJECT - yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2]; -#else - yy_state_buf = 0; -#endif - } - -yyFlexLexer::~yyFlexLexer() - { - delete yy_state_buf; - yy_delete_buffer( yy_current_buffer ); - } - -void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out ) - { - if ( new_in ) - { - yy_delete_buffer( yy_current_buffer ); - yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) ); - } - - if ( new_out ) - yyout = new_out; - } - -#ifdef YY_INTERACTIVE -int yyFlexLexer::LexerInput( char* buf, int /* max_size */ ) -#else -int yyFlexLexer::LexerInput( char* buf, int max_size ) -#endif - { - if ( yyin->eof() || yyin->fail() ) - return 0; - -#ifdef YY_INTERACTIVE - yyin->get( buf[0] ); - - if ( yyin->eof() ) - return 0; - - if ( yyin->bad() ) - return -1; - - return 1; - -#else - (void) yyin->read( buf, max_size ); - - if ( yyin->bad() ) - return -1; - else - return yyin->gcount(); -#endif - } - -void yyFlexLexer::LexerOutput( const char* buf, int size ) - { - (void) yyout->write( buf, size ); - } -%* - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ - -%- -static int yy_get_next_buffer() -%+ -int yyFlexLexer::yy_get_next_buffer() -%* - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; - register int number_to_move, i; - int ret_val; - - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; - - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; - - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } - - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - -%- -static yy_state_type yy_get_previous_state() -%+ -yy_state_type yyFlexLexer::yy_get_previous_state() -%* - { - register yy_state_type yy_current_state; - register char *yy_cp; - -%% code to get the start state into yy_current_state goes here - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { -%% code to find the next state goes here - } - - return yy_current_state; - } - - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - -%- -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif -%+ -yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) -%* - { - register int yy_is_jam; -%% code to find the next state, and perhaps do backing up, goes here - - return yy_is_jam ? 0 : yy_current_state; - } - - -%- -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif -%+ -void yyFlexLexer::yyunput( int c, register char* yy_bp ) -%* - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - -%% update yylineno here - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -%- -#endif /* ifndef YY_NO_UNPUT */ -%* - - -%- -#ifdef __cplusplus -static int yyinput() -#else -static int input() -#endif -%+ -int yyFlexLexer::yyinput() -%* - { - int c; - - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; - - else - { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; - - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /* fall through */ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; - - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; - break; - } - } - } - - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - -%% update BOL and yylineno - - return c; - } - - -%- -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif -%+ -void yyFlexLexer::yyrestart( istream* input_file ) -%* - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -%- -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif -%+ -void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -%* - { - if ( yy_current_buffer == new_buffer ) - return; - - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } - - yy_current_buffer = new_buffer; - yy_load_buffer_state(); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif -%+ -void yyFlexLexer::yy_load_buffer_state() -%* - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif -%+ -YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size ) -%* - { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; - } - - -%- -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif -%+ -void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) -%* - { - if ( ! b ) - return; - - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - -%- -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - -%+ -extern "C" int isatty YY_PROTO(( int )); -void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file ) -%* - - { - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -%- -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif -%+ - b->yy_is_interactive = 0; -%* - } - - -%- -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - -%+ -void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) -%* - { - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } -%* - - -#ifndef YY_NO_SCAN_BUFFER -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; - } -%* -#endif - - -#ifndef YY_NO_SCAN_STRING -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -%* -#endif - - -#ifndef YY_NO_SCAN_BYTES -%- -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -%* -#endif - - -#ifndef YY_NO_PUSH_STATE -%- -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif -%+ -void yyFlexLexer::yy_push_state( int new_state ) -%* - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -%- -static void yy_pop_state() -%+ -void yyFlexLexer::yy_pop_state() -%* - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -%- -static int yy_top_state() -%+ -int yyFlexLexer::yy_top_state() -%* - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -%- -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - -%+ - -void yyFlexLexer::LexerError( yyconst char msg[] ) - { - cerr << msg << '\n'; - exit( YY_EXIT_FAILURE ); - } -%* - - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) - - -/* Internal utility routines. */ - -#ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } -#endif - -#ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; - } -#endif - - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } - -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } - -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } - -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif diff --git a/Zend/libzend.dsp b/Zend/libzend.dsp deleted file mode 100644 index 34336ce277..0000000000 --- a/Zend/libzend.dsp +++ /dev/null @@ -1,373 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libzend" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libzend - 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 "libzend.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 "libzend.mak" CFG="libzend - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libzend - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libzend - Win32 Debug" (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)" == "libzend - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# 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 "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c -# SUBTRACT CPP /YX -# 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)" == "libzend - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /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 "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=1 /FR /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 - -!ENDIF - -# Begin Target - -# Name "libzend - Win32 Release" -# Name "libzend - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=".\zend-parser.c" -# End Source File -# Begin Source File - -SOURCE=".\zend-scanner.c" -# End Source File -# Begin Source File - -SOURCE=.\zend.c -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.c -# End Source File -# Begin Source File - -SOURCE=.\zend_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.c -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.c -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.c -# End Source File -# Begin Source File - -SOURCE=.\zend_list.c -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.c -# End Source File -# Begin Source File - -SOURCE=.\zend_opcode.c -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_sprintf.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\FlexLexer.h -# End Source File -# Begin Source File - -SOURCE=.\modules.h -# End Source File -# Begin Source File - -SOURCE=".\zend-parser.h" -# End Source File -# Begin Source File - -SOURCE=".\zend-scanner.h" -# End Source File -# Begin Source File - -SOURCE=.\zend.h -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.h -# End Source File -# Begin Source File - -SOURCE=.\zend_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.h -# End Source File -# Begin Source File - -SOURCE=.\zend_config.w32.h -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.h -# End Source File -# Begin Source File - -SOURCE=.\zend_errors.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.h -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals.h -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.h -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.h -# End Source File -# Begin Source File - -SOURCE=.\zend_list.h -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.h -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.h -# End Source File -# End Group -# Begin Group "Parsers" - -# PROP Default_Filter "y" -# Begin Source File - -SOURCE=".\zend-parser.y" - -!IF "$(CFG)" == "libzend - Win32 Release" - -# Begin Custom Build -InputDir=. -InputPath=".\zend-parser.y" - -BuildCmds= \ - if not "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend zend-parser.y \ - if "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y - -"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "libzend - Win32 Debug" - -# Begin Custom Build -InputDir=. -InputPath=".\zend-parser.y" - -BuildCmds= \ - if not "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend zend-parser.y \ - if "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y - -"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Scanners" - -# PROP Default_Filter "l" -# Begin Source File - -SOURCE=".\zend-scanner.l" - -!IF "$(CFG)" == "libzend - Win32 Release" - -# Begin Custom Build -InputPath=".\zend-scanner.l" - -"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -i -Pzend -ozend-scanner.c zend-scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "libzend - Win32 Debug" - -# Begin Custom Build -InputPath=".\zend-scanner.l" - -"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -i -Pzend -ozend-scanner.c zend-scanner.l - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Text Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ZEND_BUGS -# End Source File -# Begin Source File - -SOURCE=.\ZEND_CHANGES -# End Source File -# Begin Source File - -SOURCE=.\ZEND_TODO -# End Source File -# End Group -# Begin Group "Resources" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\zend.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Zend/libzendts.dsp b/Zend/libzendts.dsp deleted file mode 100644 index 70e6e35021..0000000000 --- a/Zend/libzendts.dsp +++ /dev/null @@ -1,379 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libzendts" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libzendts - 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 "libzendts.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 "libzendts.mak" CFG="libzendts - Win32 Debug_TS" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libzendts - Win32 Release_TS" (based on "Win32 (x86) Static Library") -!MESSAGE "libzendts - Win32 Debug_TS" (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)" == "libzendts - Win32 Release_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Release_TS" -# PROP BASE Intermediate_Dir "Release_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 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_TS" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x40d /d "NDebug_TS" -# ADD RSC /l 0x40d /d "NDebug_TS" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS" - -# PROP BASE Use_MFC 0 -# PROP BASE Output_Dir "Debug_TS" -# PROP BASE Intermediate_Dir "Debug_TS" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Output_Dir "Debug_TS" -# PROP Intermediate_Dir "Debug_TS" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZTS" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c -# ADD BASE RSC /l 0x40d /d "_Debug_TS" -# ADD RSC /l 0x40d /d "_Debug_TS" -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 "libzendts - Win32 Release_TS" -# Name "libzendts - Win32 Debug_TS" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=".\zend-parser.c" -# End Source File -# Begin Source File - -SOURCE=".\zend-scanner.cpp" -# End Source File -# Begin Source File - -SOURCE=.\zend.c -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.c -# End Source File -# Begin Source File - -SOURCE=.\zend_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.c -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.c -# End Source File -# Begin Source File - -SOURCE=.\zend_execute_API.c -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.c -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.c -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.c -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.c -# End Source File -# Begin Source File - -SOURCE=.\zend_list.c -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.c -# End Source File -# Begin Source File - -SOURCE=.\zend_opcode.c -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.c -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_sprintf.c -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.c -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\FlexLexer.h -# End Source File -# Begin Source File - -SOURCE=.\modules.h -# End Source File -# Begin Source File - -SOURCE=".\zend-parser.h" -# End Source File -# Begin Source File - -SOURCE=".\zend-scanner.h" -# End Source File -# Begin Source File - -SOURCE=.\zend.h -# End Source File -# Begin Source File - -SOURCE=.\zend_alloc.h -# End Source File -# Begin Source File - -SOURCE=.\zend_API.h -# End Source File -# Begin Source File - -SOURCE=.\zend_builtin_functions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_compile.h -# End Source File -# Begin Source File - -SOURCE=.\zend_config.w32.h -# End Source File -# Begin Source File - -SOURCE=.\zend_constants.h -# End Source File -# Begin Source File - -SOURCE=.\zend_errors.h -# End Source File -# Begin Source File - -SOURCE=.\zend_execute.h -# End Source File -# Begin Source File - -SOURCE=.\zend_extensions.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals.h -# End Source File -# Begin Source File - -SOURCE=.\zend_globals_macros.h -# End Source File -# Begin Source File - -SOURCE=.\zend_hash.h -# End Source File -# Begin Source File - -SOURCE=.\zend_highlight.h -# End Source File -# Begin Source File - -SOURCE=.\zend_indent.h -# End Source File -# Begin Source File - -SOURCE=.\zend_list.h -# End Source File -# Begin Source File - -SOURCE=.\zend_llist.h -# End Source File -# Begin Source File - -SOURCE=.\zend_operators.h -# End Source File -# Begin Source File - -SOURCE=.\zend_ptr_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_stack.h -# End Source File -# Begin Source File - -SOURCE=.\zend_variables.h -# End Source File -# End Group -# Begin Group "Parsers" - -# PROP Default_Filter "y" -# Begin Source File - -SOURCE=".\zend-parser.y" - -!IF "$(CFG)" == "libzendts - Win32 Release_TS" - -# Begin Custom Build -InputDir=. -InputPath=".\zend-parser.y" - -BuildCmds= \ - if not "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend zend-parser.y \ - if "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y \ - - -"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS" - -# Begin Custom Build -InputDir=. -InputPath=".\zend-parser.y" - -BuildCmds= \ - if not "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "%CYGWIN%\share\bison.simple" -p zend zend-parser.y \ - if "X%CYGWIN%"=="X" bison --output=zend-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p zend zend-parser.y \ - - -"$(InputDir)\zend-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) - -"$(InputDir)\zend-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - $(BuildCmds) -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Scanners" - -# PROP Default_Filter "l" -# Begin Source File - -SOURCE=".\zend-scanner.l" - -!IF "$(CFG)" == "libzendts - Win32 Release_TS" - -# Begin Custom Build -InputPath=".\zend-scanner.l" - -"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -+ -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l - -# End Custom Build - -!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS" - -# Begin Custom Build -InputPath=".\zend-scanner.l" - -"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - flex -+ -B -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Text Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\LICENSE -# End Source File -# Begin Source File - -SOURCE=.\ZEND_BUGS -# End Source File -# Begin Source File - -SOURCE=.\ZEND_CHANGES -# End Source File -# End Group -# Begin Group "Resources" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\zend.ico -# End Source File -# End Group -# End Target -# End Project diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y deleted file mode 100644 index 1a8f3e6fdb..0000000000 --- a/Zend/zend-parser.y +++ /dev/null @@ -1,680 +0,0 @@ -%{ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -/* - * LALR shift/reduce conflicts and how they are resolved: - * - * - 2 shift/reduce conflicts due to the dangeling elseif/else ambiguity. Solved by shift. - * - 1 shift/reduce conflict due to arrays within encapsulated strings. Solved by shift. - * - 1 shift/reduce conflict due to objects within encapsulated strings. Solved by shift. - * - */ - - -#include "zend_compile.h" -#include "zend.h" -#include "zend_list.h" -#include "zend_globals.h" -#include "zend_API.h" -#include "zend_variables.h" -#include "zend_operators.h" - -#define YYERROR_VERBOSE -#define YYSTYPE znode -#ifdef ZTS -# define YYPARSE_PARAM compiler_globals -# define YYLEX_PARAM compiler_globals -#endif - - -%} - -%pure_parser -%expect 4 - -%left T_INCLUDE T_EVAL T_IMPORT -%left ',' -%left T_LOGICAL_OR -%left T_LOGICAL_XOR -%left T_LOGICAL_AND -%right T_PRINT -%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL XT_OR_EQUAL T_SL_EQUAL T_SR_EQUAL -%left '?' ':' -%left T_BOOLEAN_OR -%left T_BOOLEAN_AND -%left '|' -%left '^' -%left '&' -%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL T_IS_IDENTICAL -%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL -%left T_SL T_SR -%left '+' '-' '.' -%left '*' '/' '%' -%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST '@' -%right '[' -%nonassoc T_NEW -%token T_EXIT -%token T_IF -%left T_ELSEIF -%left T_ELSE -%left T_ENDIF -%token T_LNUMBER -%token T_DNUMBER -%token T_STRING -%token T_STRING_VARNAME -%token T_VARIABLE -%token T_NUM_STRING -%token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER -%token T_ENCAPSED_AND_WHITESPACE -%token T_CONSTANT_ENCAPSED_STRING -%token T_ECHO -%token T_DO -%token T_WHILE -%token T_ENDWHILE -%token T_FOR -%token T_ENDFOR -%token T_FOREACH -%token T_ENDFOREACH -%token T_AS -%token T_SWITCH -%token T_ENDSWITCH -%token T_CASE -%token T_DEFAULT -%token T_BREAK -%token T_CONTINUE -%token T_OLD_FUNCTION -%token T_FUNCTION -%token T_CONST -%token T_RETURN -%token T_REQUIRE -%token T_USE -%token T_GLOBAL -%token T_STATIC -%token T_VAR -%token T_UNSET -%token T_ISSET -%token T_EMPTY -%token T_CLASS -%token T_EXTENDS -%token T_OBJECT_OPERATOR -%token T_DOUBLE_ARROW -%token T_LIST -%token T_ARRAY -%token T_LINE -%token T_FILE -%token T_COMMENT -%token T_ML_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE -%token T_HEREDOC -%token T_DOLLAR_OPEN_CURLY_BRACES -%token T_CURLY_OPEN -%token T_PAAMAYIM_NEKUDOTAYIM -%token T_PHP_TRACK_VARS - -%% /* Rules */ - -top_statement_list: - top_statement_list { do_extended_info(CLS_C); } top_statement { HANDLE_INTERACTIVE(); } - | /* empty */ -; - - -top_statement: - statement - | declaration_statement { do_early_binding(CLS_C); } -; - - -inner_statement_list: - inner_statement_list { do_extended_info(CLS_C); } inner_statement { HANDLE_INTERACTIVE(); } - | /* empty */ -; - - -inner_statement: - statement - | declaration_statement -; - - -statement: - '{' inner_statement_list '}' - | T_IF '(' expr ')' { do_if_cond(&$3, &$4 CLS_CC); } statement { do_if_after_statement(&$4, 1 CLS_CC); } elseif_list else_single { do_if_end(CLS_C); } - | T_IF '(' expr ')' ':' { do_if_cond(&$3, &$4 CLS_CC); } inner_statement_list { do_if_after_statement(&$4, 1 CLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { do_if_end(CLS_C); } - | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { do_while_cond(&$4, &$5 CLS_CC); } while_statement { do_while_end(&$1, &$5 CLS_CC); } - | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); do_do_while_begin(CLS_C); } statement T_WHILE '(' expr ')' ';' { do_do_while_end(&$1, &$6 CLS_CC); } - | T_FOR - '(' - for_expr - ';' { do_free(&$3 CLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); } - for_expr - ';' { do_for_cond(&$6, &$7 CLS_CC); } - for_expr - ')' { do_free(&$9 CLS_CC); do_for_before_statement(&$4, &$7 CLS_CC); } - for_statement { do_for_end(&$7 CLS_CC); } - | T_SWITCH '(' expr ')' { do_switch_cond(&$3 CLS_CC); } switch_case_list { do_switch_end(&$6 CLS_CC); } - | T_BREAK ';' { do_brk_cont(ZEND_BRK, NULL CLS_CC); } - | T_BREAK expr ';' { do_brk_cont(ZEND_BRK, &$2 CLS_CC); } - | T_CONTINUE ';' { do_brk_cont(ZEND_CONT, NULL CLS_CC); } - | T_CONTINUE expr ';' { do_brk_cont(ZEND_CONT, &$2 CLS_CC); } - | T_RETURN ';' { do_return(NULL CLS_CC); } - | T_RETURN expr ';' { do_return(&$2 CLS_CC); } - | T_GLOBAL global_var_list - | T_STATIC static_var_list - | T_ECHO echo_expr_list ';' - | T_INLINE_HTML { do_echo(&$1 CLS_CC); } - | expr ';' { do_free(&$1 CLS_CC); } - | T_REQUIRE expr ';' { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } } - | T_USE use_filename ';' { use_filename($2.u.constant.value.str.val, $2.u.constant.value.str.len CLS_CC); zval_dtor(&$2.u.constant); } - | T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); } - | T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); } - | ';' /* empty statement */ -; - - -use_filename: - T_CONSTANT_ENCAPSED_STRING { $$ = $1; } - | '(' T_CONSTANT_ENCAPSED_STRING ')' { $$ = $2; } -; - - -declaration_statement: - T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); } - '(' parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); } - | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); } - parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); } - | T_CLASS T_STRING { do_begin_class_declaration(&$2, NULL CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); } - | T_CLASS T_STRING T_EXTENDS T_STRING { do_begin_class_declaration(&$2, &$4 CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); } -; - - -foreach_optional_arg: - /* empty */ { $$.op_type = IS_UNUSED; } - | T_DOUBLE_ARROW w_cvar { $$ = $2; } -; - - -for_statement: - statement - | ':' inner_statement_list T_ENDFOR ';' -; - - -foreach_statement: - statement - | ':' inner_statement_list T_ENDFOREACH ';' -; - - -switch_case_list: - '{' case_list '}' { $$ = $2; } - | '{' ';' case_list '}' { $$ = $3; } - | ':' case_list T_ENDSWITCH ';' { $$ = $2; } - | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; } -; - - -case_list: - /* empty */ { $$.u.opline_num = -1; } - | case_list T_CASE expr case_separator { do_case_before_statement(&$1, &$2, &$3 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); } - | case_list T_DEFAULT case_separator { do_default_before_statement(&$1, &$2 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); } -; - - -case_separator: - ':' - | ';' -; - - -while_statement: - statement - | ':' inner_statement_list T_ENDWHILE ';' -; - - - -elseif_list: - /* empty */ - | elseif_list T_ELSEIF '(' expr ')' { do_if_cond(&$4, &$5 CLS_CC); } statement { do_if_after_statement(&$5, 0 CLS_CC); } -; - - -new_elseif_list: - /* empty */ - | new_elseif_list T_ELSEIF '(' expr ')' ':' { do_if_cond(&$4, &$5 CLS_CC); } inner_statement_list { do_if_after_statement(&$5, 0 CLS_CC); } -; - - -else_single: - /* empty */ - | T_ELSE statement -; - - -new_else_single: - /* empty */ - | T_ELSE ':' inner_statement_list -; - - - - -parameter_list: - non_empty_parameter_list - | /* empty */ -; - - -non_empty_parameter_list: - T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } - | '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); } - | T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } - | T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE CLS_CC); } - | T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } - | non_empty_parameter_list ',' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } - | non_empty_parameter_list ',' '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); } - | non_empty_parameter_list ',' T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } - | non_empty_parameter_list ',' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE CLS_CC); } - | non_empty_parameter_list ',' T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); } -; - - -function_call_parameter_list: - non_empty_function_call_parameter_list { $$ = $1; } - | /* empty */ { $$.u.constant.value.lval = 0; } -; - - -non_empty_function_call_parameter_list: - expr_without_variable { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); } - | cvar { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); } - | '&' w_cvar { $$.u.constant.value.lval = 1; do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); } - | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); } - | non_empty_function_call_parameter_list ',' cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); } - | non_empty_function_call_parameter_list ',' '&' w_cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); } -; - -global_var_list: - global_var_list ',' global_var { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_GLOBAL CLS_CC); } - | global_var { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_GLOBAL CLS_CC); } -; - - -global_var: - T_VARIABLE { $$ = $1; } - | '$' r_cvar { $$ = $2; } - | '$' '{' expr '}' { $$ = $3; } -; - - -static_var_list: - static_var_list ',' T_VARIABLE { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC CLS_CC); } - | static_var_list ',' T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC CLS_CC); } - | T_VARIABLE { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC CLS_CC); } - | T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$1, &$3, ZEND_FETCH_STATIC CLS_CC); } - -; - - -class_statement_list: - class_statement_list class_statement - | /* empty */ -; - - -class_statement: - T_VAR class_variable_decleration ';' - | T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); } '(' - parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); } - | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); } - parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); } - -; - - -class_variable_decleration: - class_variable_decleration ',' T_VARIABLE { do_declare_property(&$3, NULL CLS_CC); } - | class_variable_decleration ',' T_VARIABLE '=' static_scalar { do_declare_property(&$3, &$5 CLS_CC); } - | T_VARIABLE { do_declare_property(&$1, NULL CLS_CC); } - | T_VARIABLE '=' static_scalar { do_declare_property(&$1, &$3 CLS_CC); } -; - - -echo_expr_list: - | echo_expr_list ',' expr { do_echo(&$3 CLS_CC); } - | expr { do_echo(&$1 CLS_CC); } -; - - -for_expr: - /* empty */ { $$.op_type = IS_CONST; $$.u.constant.type = IS_BOOL; $$.u.constant.value.lval = 1; } - | non_empty_for_expr { $$ = $1; } -; - -non_empty_for_expr: - non_empty_for_expr ',' { do_free(&$1 CLS_CC); } expr { $$ = $4; } - | expr { $$ = $1; } -; - - -expr_without_variable: - T_LIST '(' { do_list_init(CLS_C); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); } - | cvar '=' expr { do_end_variable_parse(BP_VAR_W, 0 CLS_CC); do_assign(&$$, &$1, &$3 CLS_CC); } - | cvar '=' '&' w_cvar { do_end_variable_parse(BP_VAR_W, 0 CLS_CC); do_assign_ref(&$$, &$1, &$4 CLS_CC); } - | T_NEW class_name { do_extended_fcall_begin(CLS_C); do_begin_new_object(&$1, &$2 CLS_CC); } ctor_arguments { do_end_new_object(&$$, &$2, &$1, &$4 CLS_CC); do_extended_fcall_end(CLS_C);} - | cvar T_PLUS_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); } - | cvar T_MINUS_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); } - | cvar T_MUL_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 CLS_CC); } - | cvar T_DIV_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 CLS_CC); } - | cvar T_CONCAT_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 CLS_CC); } - | cvar T_MOD_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 CLS_CC); } - | cvar T_AND_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 CLS_CC); } - | cvar T_OR_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 CLS_CC); } - | cvar XT_OR_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 CLS_CC); } - | cvar T_SL_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 CLS_CC); } - | cvar T_SR_EQUAL expr { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 CLS_CC); } - | rw_cvar T_INC { do_post_incdec(&$$, &$1, ZEND_POST_INC CLS_CC); } - | T_INC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_INC CLS_CC); } - | rw_cvar T_DEC { do_post_incdec(&$$, &$1, ZEND_POST_DEC CLS_CC); } - | T_DEC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_DEC CLS_CC); } - | expr T_BOOLEAN_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); } - | expr T_BOOLEAN_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); } - | expr T_LOGICAL_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); } - | expr T_LOGICAL_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); } - | expr T_LOGICAL_XOR expr { do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 CLS_CC); } - | expr '|' expr { do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 CLS_CC); } - | expr '&' expr { do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 CLS_CC); } - | expr '^' expr { do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 CLS_CC); } - | expr '.' expr { do_binary_op(ZEND_CONCAT,&$$,&$1,&$3 CLS_CC); } - | expr '+' expr { do_binary_op(ZEND_ADD,&$$,&$1,&$3 CLS_CC); } - | expr '-' expr { do_binary_op(ZEND_SUB,&$$,&$1,&$3 CLS_CC); } - | expr '*' expr { do_binary_op(ZEND_MUL,&$$,&$1,&$3 CLS_CC); } - | expr '/' expr { do_binary_op(ZEND_DIV,&$$,&$1,&$3 CLS_CC); } - | expr '%' expr { do_binary_op(ZEND_MOD,&$$,&$1,&$3 CLS_CC); } - | expr T_SL expr { do_binary_op(ZEND_SL, &$$, &$1, &$3 CLS_CC); } - | expr T_SR expr { do_binary_op(ZEND_SR, &$$, &$1, &$3 CLS_CC); } - | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_ADD, &$$, &$1, &$2 CLS_CC); } - | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_SUB, &$$, &$1, &$2 CLS_CC); } - | '!' expr { do_unary_op(ZEND_BOOL_NOT, &$$, &$2 CLS_CC); } - | '~' expr { do_unary_op(ZEND_BW_NOT, &$$, &$2 CLS_CC); } - | expr T_IS_IDENTICAL expr { do_binary_op(ZEND_IS_IDENTICAL, &$$, &$1, &$3 CLS_CC); } - | expr T_IS_EQUAL expr { do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 CLS_CC); } - | expr T_IS_NOT_EQUAL expr { do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 CLS_CC); } - | expr '<' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 CLS_CC); } - | expr T_IS_SMALLER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 CLS_CC); } - | expr '>' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 CLS_CC); } - | expr T_IS_GREATER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 CLS_CC); } - | '(' expr ')' { $$ = $2; } - | expr '?' { do_begin_qm_op(&$1, &$2 CLS_CC); } - expr ':' { do_qm_true(&$4, &$2, &$5 CLS_CC); } - expr { do_qm_false(&$$, &$7, &$2, &$5 CLS_CC); } - | T_STRING '(' { do_extended_fcall_begin(CLS_C); $2.u.opline_num = do_begin_function_call(&$1 CLS_CC); } - function_call_parameter_list - ')' { do_end_function_call(&$1, &$$, &$4, 0, $2.u.opline_num CLS_CC); do_extended_fcall_end(CLS_C); } - | r_cvar '(' { do_extended_fcall_begin(CLS_C); do_begin_dynamic_function_call(&$1 CLS_CC); } - function_call_parameter_list - ')' { do_end_function_call(&$1, &$$, &$4, 0, 1 CLS_CC); do_extended_fcall_end(CLS_C);} - | T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { do_extended_fcall_begin(CLS_C); do_begin_class_member_function_call(&$1, &$3 CLS_CC); } - function_call_parameter_list - ')' { do_end_function_call(&$3, &$$, &$6, 1, 1 CLS_CC); do_extended_fcall_end(CLS_C);} - | internal_functions_in_yacc { $$ = $1; } - | T_INT_CAST expr { do_cast(&$$, &$2, IS_LONG CLS_CC); } - | T_DOUBLE_CAST expr { do_cast(&$$, &$2, IS_DOUBLE CLS_CC); } - | T_STRING_CAST expr { do_cast(&$$, &$2, IS_STRING CLS_CC); } - | T_ARRAY_CAST expr { do_cast(&$$, &$2, IS_ARRAY CLS_CC); } - | T_OBJECT_CAST expr { do_cast(&$$, &$2, IS_OBJECT CLS_CC); } - | T_BOOL_CAST expr { do_cast(&$$, &$2, IS_BOOL CLS_CC); } - | T_EXIT exit_expr { do_exit(&$$, &$2 CLS_CC); } - | '@' { do_begin_silence(&$1 CLS_CC); } expr { do_end_silence(&$1 CLS_CC); $$ = $3; } - | scalar { $$ = $1; } - | T_ARRAY '(' array_pair_list ')' { $$ = $3; } - | '`' encaps_list '`' { do_shell_exec(&$$, &$2 CLS_CC); } - | T_PRINT expr { do_print(&$$, &$2 CLS_CC); } -; - - -exit_expr: - /* empty */ { $$.op_type = IS_UNUSED; } - | '(' ')' { $$.op_type = IS_UNUSED; } - | '(' expr ')' { $$ = $2; } -; - - -ctor_arguments: - /* empty */ { $$.u.constant.value.lval=0; } - | '(' function_call_parameter_list ')' { $$ = $2; } -; - - -class_name: - T_STRING { $$ = $1; } - | r_cvar { $$ = $1; } -; - - - -common_scalar: - T_LNUMBER { $$=$1; } - | T_DNUMBER { $$=$1; } - | T_CONSTANT_ENCAPSED_STRING { $$ = $1; } - | T_LINE { $$ = $1; } - | T_FILE { $$ = $1; } -; - - -static_scalar: /* compile-time evaluated scalars */ - common_scalar { $$ = $1; } - | T_STRING { do_fetch_constant(&$$, &$1, ZEND_CT CLS_CC); } - | '+' static_scalar { $$ = $1; } - | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one); $$ = $2; } - | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; } -; - - -scalar: - T_STRING { do_fetch_constant(&$$, &$1, ZEND_RT CLS_CC); } - | T_STRING_VARNAME { $$ = $1; } - | common_scalar { $$ = $1; } - | '"' encaps_list '"' { $$ = $2; } - | '\'' encaps_list '\'' { $$ = $2; } - | T_HEREDOC encaps_list T_HEREDOC { $$ = $2; do_end_heredoc(CLS_C); } -; - - -static_array_pair_list: - /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); } - | non_empty_static_array_pair_list { $$ = $1; } -; - - -non_empty_static_array_pair_list: - non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { do_add_static_array_element(&$$, &$3, &$5); } - | non_empty_static_array_pair_list ',' static_scalar { do_add_static_array_element(&$$, NULL, &$3); } - | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, &$1, &$3); } - | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, NULL, &$1); } -; - -expr: - r_cvar { $$ = $1; } - | expr_without_variable { $$ = $1; } -; - - - -r_cvar: - cvar { do_end_variable_parse(BP_VAR_R, 0 CLS_CC); $$ = $1; } -; - - -w_cvar: - cvar { do_end_variable_parse(BP_VAR_W, 0 CLS_CC); $$ = $1; } -; - - -rw_cvar: - cvar { do_end_variable_parse(BP_VAR_RW, 0 CLS_CC); $$ = $1; } -; - - -cvar: - cvar_without_objects { $$ = $1; } - | cvar_without_objects T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } ref_list { $$ = $4; } -; - - -cvar_without_objects: - reference_variable { $$ = $1; } - | simple_indirect_reference reference_variable { do_indirect_references(&$$, &$1, &$2 CLS_CC); } -; - - -reference_variable: - dim_list ']' { $$ = $1; } - | compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); } -; - - -compound_variable: - T_VARIABLE { $$ = $1; } - | '$' '{' expr '}' { $$ = $3; } -; - - -dim_list: - dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); } - | compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); } '[' dim_offset { fetch_array_begin(&$$, &$1, &$4 CLS_CC); } -; - - -dim_offset: - /* empty */ { $$.op_type = IS_UNUSED; } - | expr { $$ = $1; } -; - - -ref_list: - object_property { $$ = $1; } - | ref_list T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } object_property { $$ = $4; } -; - -object_property: - scalar_object_property { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC); } - | object_dim_list ']' { $$ = $1; } -; - -scalar_object_property: - T_STRING { $$ = $1; } - | '{' expr '}' { $$ = $2; } - | cvar_without_objects { do_end_variable_parse(BP_VAR_R, 0 CLS_CC); $$ = $1; } -; - - -object_dim_list: - object_dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); } - | T_STRING { znode tmp_znode, res; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&res, &tmp_znode, &$1 CLS_CC); $1 = res; } '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); } -; - - -simple_indirect_reference: - '$' { $$.u.constant.value.lval = 1; } - | simple_indirect_reference '$' { $$.u.constant.value.lval++; } -; - -assignment_list: - assignment_list ',' assignment_list_element - | assignment_list_element -; - - -assignment_list_element: - w_cvar { do_add_list_element(&$1 CLS_CC); } - | T_LIST '(' { do_new_list_begin(CLS_C); } assignment_list ')' { do_new_list_end(CLS_C); } - | /* empty */ { do_add_list_element(NULL CLS_CC); } -; - - -array_pair_list: - /* empty */ { do_init_array(&$$, NULL, NULL, 0 CLS_CC); } - | non_empty_array_pair_list { $$ = $1; } -; - -non_empty_array_pair_list: - non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { do_add_array_element(&$$, &$5, &$3, 0 CLS_CC); } - | non_empty_array_pair_list ',' expr { do_add_array_element(&$$, &$3, NULL, 0 CLS_CC); } - | expr T_DOUBLE_ARROW expr { do_init_array(&$$, &$3, &$1, 0 CLS_CC); } - | expr { do_init_array(&$$, &$1, NULL, 0 CLS_CC); } - | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_cvar { do_add_array_element(&$$, &$6, &$3, 1 CLS_CC); } - | non_empty_array_pair_list ',' '&' w_cvar { do_add_array_element(&$$, &$4, NULL, 1 CLS_CC); } - | expr T_DOUBLE_ARROW '&' w_cvar { do_init_array(&$$, &$4, &$1, 1 CLS_CC); } - | '&' w_cvar { do_init_array(&$$, &$2, NULL, 1 CLS_CC); } -; - -encaps_list: - encaps_list encaps_var { do_end_variable_parse(BP_VAR_R, 0 CLS_CC); do_add_variable(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_NUM_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_ENCAPSED_AND_WHITESPACE { do_add_string(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_CHARACTER { do_add_char(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_BAD_CHARACTER { do_add_string(&$$, &$1, &$2 CLS_CC); } - | encaps_list '[' { $2.u.constant.value.chval = '['; do_add_char(&$$, &$1, &$2 CLS_CC); } - | encaps_list ']' { $2.u.constant.value.chval = ']'; do_add_char(&$$, &$1, &$2 CLS_CC); } - | encaps_list '{' { $2.u.constant.value.chval = '{'; do_add_char(&$$, &$1, &$2 CLS_CC); } - | encaps_list '}' { $2.u.constant.value.chval = '}'; do_add_char(&$$, &$1, &$2 CLS_CC); } - | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.chval = '-'; do_add_char(&tmp, &$1, &$2 CLS_CC); $2.u.constant.value.chval = '>'; do_add_char(&$$, &tmp, &$2 CLS_CC); } - | /* empty */ { do_init_string(&$$ CLS_CC); } - -; - - - -encaps_var: - T_VARIABLE { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); } - | T_VARIABLE '[' { do_begin_variable_parse(CLS_C); } encaps_var_offset ']' { do_fetch_globals(&$1 CLS_CC); fetch_array_begin(&$$, &$1, &$4 CLS_CC); } - | T_VARIABLE T_OBJECT_OPERATOR T_STRING { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$2, &$1, 1 CLS_CC); do_fetch_property(&$$, &$2, &$3 CLS_CC); } - | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$2, 1 CLS_CC); } - | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { do_begin_variable_parse(CLS_C); fetch_array_begin(&$$, &$2, &$4 CLS_CC); } - | T_CURLY_OPEN cvar '}' { $$ = $2; } -; - - -encaps_var_offset: - T_STRING { $$ = $1; } - | T_NUM_STRING { $$ = $1; } - | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 CLS_CC); } -; - - -internal_functions_in_yacc: - T_ISSET '(' cvar ')' { do_isset_or_isempty(ZEND_ISSET, &$$, &$3 CLS_CC); } - | T_EMPTY '(' cvar ')' { do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 CLS_CC); } - | T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } - | T_EVAL '(' expr ')' { do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); } - | T_IMPORT '(' expr ')' { do_include_or_eval(ZEND_IMPORT, &$$, &$3 CLS_CC); } -; - - -%% - diff --git a/Zend/zend-scanner.h b/Zend/zend-scanner.h deleted file mode 100644 index 7a77986cc9..0000000000 --- a/Zend/zend-scanner.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _LANGUAGE_SCANNER_H -#define _LANGUAGE_SCANNER_H - -#ifdef ZTS -class ZendFlexLexer : public yyFlexLexer -{ -public: - virtual ~ZendFlexLexer(); - int lex_scan(zval *zendlval CLS_DC); - void BeginState(int state); -}; - -#endif /* ZTS */ - - -#ifndef ZTS -typedef struct _zend_lex_state { - YY_BUFFER_STATE buffer_state; - int state; - uint return_offset; - uint lineno; - FILE *in; - char *filename; -} zend_lex_state; -#else -typedef struct _zend_lex_state { - ZendFlexLexer *ZFL; - istream *input_file; -} zend_lex_state; -#endif - -void zend_fatal_scanner_error(char *); -inline void restore_lexical_state(zend_lex_state * CLS_DC); -BEGIN_EXTERN_C() -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2); -END_EXTERN_C() - -#endif diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l deleted file mode 100644 index a4edba40a0..0000000000 --- a/Zend/zend-scanner.l +++ /dev/null @@ -1,1611 +0,0 @@ -%{ - -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -%} - -%x ST_IN_SCRIPTING -%x ST_DOUBLE_QUOTES -%x ST_SINGLE_QUOTE -%x ST_BACKQUOTE -%x ST_HEREDOC -%x ST_LOOKING_FOR_PROPERTY -%x ST_LOOKING_FOR_VARNAME -%x ST_COMMENT -%option stack - -%{ - -#if WIN32|WINNT -#include -#include -#endif - -#include -#include "zend.h" -#include "zend_alloc.h" -#include "zend-parser.h" -#include "zend_compile.h" -#include "zend-scanner.h" -#include "zend_highlight.h" -#include "zend_constants.h" -#include "zend_variables.h" -#include "zend_operators.h" - -#ifdef ZTS -# include -# ifdef HAVE_STDIOSTR_H -# include -# endif -# ifdef HAVE_STDIOSTREAM_H -# include -# endif -# if WIN32||WINNT -# include -# else -# include -# endif -#endif - -#ifdef HAVE_STDARG_H -# include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifdef ZTS -#define YY_DECL int ZendFlexLexer::lex_scan(zval *zendlval CLS_DC) -#else -#define YY_DECL int lex_scan(zval *zendlval CLS_DC) -#endif -#define ECHO { ZEND_WRITE( yytext, yyleng ); } - -#ifdef ZTS -# define MY_INPUT yyinput -#else -# define MY_INPUT input -#endif - -#if defined(ZTS) && !defined(HAVE_CLASS_ISTDIOSTREAM) -class istdiostream : public istream -{ -private: - stdiobuf _file; -public: - istdiostream (FILE* __f) : istream(), _file(__f) { init(&_file); } -}; -#endif - -#define YY_FATAL_ERROR zend_fatal_scanner_error - -#define HANDLE_NEWLINES(s,l) \ -do { \ - char *p = (s),*boundary = p+(l); \ -\ - while(p='0' && (c)<'8') -#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F')) - - -void zend_fatal_scanner_error(char *message) -{ - zend_error(E_COMPILE_ERROR, message); -} - -BEGIN_EXTERN_C() -void startup_scanner(CLS_D) -{ - CG(heredoc) = NULL; - CG(heredoc_len)=0; -} - - -void shutdown_scanner(CLS_D) -{ - if (CG(heredoc)) { - efree(CG(heredoc)); - CG(heredoc_len)=0; - } -} -END_EXTERN_C() - - -static inline void save_lexical_state(zend_lex_state *lex_state CLS_DC) -{ -#ifndef ZTS - memcpy(&lex_state->buffer_state,&YY_CURRENT_BUFFER,sizeof(YY_BUFFER_STATE)); - lex_state->in = yyin; - lex_state->lineno = CG(zend_lineno); - lex_state->state = YYSTATE; - lex_state->filename = zend_get_compiled_filename(); -#else - lex_state->ZFL = CG(ZFL); -#endif -} - - -inline void restore_lexical_state(zend_lex_state *lex_state CLS_DC) -{ -#ifndef ZTS - YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER; - - if (lex_state->buffer_state) { - yy_switch_to_buffer(lex_state->buffer_state); - } else { - YY_CURRENT_BUFFER = NULL; - } - - yy_delete_buffer(original_buffer_state); - yyin = lex_state->in; - CG(zend_lineno) = lex_state->lineno; - BEGIN(lex_state->state); - zend_restore_compiled_filename(lex_state->filename); -#else - delete((ZendFlexLexer *) CG(ZFL)); - CG(ZFL) = lex_state->ZFL; -#endif -} - - -BEGIN_EXTERN_C() - - -ZEND_API void zend_open_file_dtor(zend_file_handle *fh) -{ - switch (fh->type) { - case ZEND_HANDLE_FP: - fclose(fh->handle.fp); - break; - case ZEND_HANDLE_FILENAME: - /* We're only supposed to get here when destructing the used_files hash, - * which doesn't really contain open files, but references to their names/paths - */ - break; -#ifdef ZTS - case ZEND_HANDLE_FSTREAM: - delete ((ifstream *) fh->handle.is); - break; - case ZEND_HANDLE_STDIOSTREAM: - istdiostream *pstdiostream = (istdiostream *) fh->handle.is; - - fclose(pstdiostream->rdbuf()->stdiofile()); - delete pstdiostream; - break; -#endif - } - if (fh->opened_path) { - free(fh->opened_path); - } - if (fh->free_filename && fh->filename) { - efree(fh->filename); - } -} - - -int zend_compare_file_handles(zend_file_handle *fh1, zend_file_handle *fh2) -{ - if (fh1->type != fh2->type) { - return 0; - } - switch (fh1->type) { - case ZEND_HANDLE_FP: - return fh1->handle.fp==fh2->handle.fp; - break; -#ifdef ZTS - case ZEND_HANDLE_FSTREAM: - case ZEND_HANDLE_STDIOSTREAM: - return fh1->handle.is==fh2->handle.is; - break; -#endif - } - return 0; -} - - -ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC) -{ - zend_llist_del_element(&CG(open_files), file_handle, (int (*)(void *, void *)) zend_compare_file_handles); -} - - -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle CLS_DC) -{ -#ifndef ZTS - switch (file_handle->type) { - case ZEND_HANDLE_FILENAME: - file_handle->handle.fp = zend_fopen(file_handle->filename, &file_handle->opened_path); - break; - case ZEND_HANDLE_FD: - file_handle->opened_path = NULL; - file_handle->handle.fp = fdopen(file_handle->handle.fd, "r"); - break; - case ZEND_HANDLE_FP: - file_handle->opened_path = NULL; - file_handle->handle.fp = file_handle->handle.fp; - break; - } - if (!file_handle->handle.fp) { - return FAILURE; - } - file_handle->type = ZEND_HANDLE_FP; - if (file_handle->handle.fp != stdin) { - zend_llist_add_element(&CG(open_files), file_handle); - } - /* Reset the scanner for scanning the new file */ - yyin = file_handle->handle.fp; - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); - BEGIN(INITIAL); -#else - switch (file_handle->type) { - case ZEND_HANDLE_FD: - file_handle->opened_path = NULL; - file_handle->handle.is = new ifstream(file_handle->handle.fd); - file_handle->type = ZEND_HANDLE_FSTREAM; - break; - case ZEND_HANDLE_FILENAME: - { - file_handle->handle.fp = zend_fopen(file_handle->filename, &file_handle->opened_path); - if (!file_handle->handle.fp) { - return FAILURE; - } - file_handle->handle.is = new istdiostream(file_handle->handle.fp); - file_handle->type = ZEND_HANDLE_STDIOSTREAM; - break; - } - case ZEND_HANDLE_FP: - file_handle->opened_path = NULL; - if (file_handle->handle.fp==stdin) { - file_handle->handle.is = (ifstream *) &cin; - } else { - if (!file_handle->handle.fp) { - return FAILURE; - } - file_handle->handle.is = new istdiostream(file_handle->handle.fp); - file_handle->type = ZEND_HANDLE_STDIOSTREAM; - } - break; - } - if (file_handle->handle.is->fail()) { - delete file_handle->handle.is; - return FAILURE; - } - if (file_handle->handle.is != &cin) { - zend_llist_add_element(&CG(open_files), file_handle); - } - - CG(ZFL) = new ZendFlexLexer; - CG(ZFL)->switch_streams(file_handle->handle.is, &cout); -#endif - zend_set_compiled_filename(file_handle->filename); - CG(zend_lineno) = 1; - return SUCCESS; -} -END_EXTERN_C() - - -ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...) -{ - va_list files; - zend_op_array *op_array; - - va_start(files, file_count); - op_array = v_compile_files(mark_as_ref CLS_CC, file_count, files); - va_end(files); - return op_array; -} - - -ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count, va_list files) -{ - zend_lex_state original_lex_state; - zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array)); - zend_op_array *original_active_op_array = CG(active_op_array); - zend_op_array *retval=NULL; - zend_file_handle *file_handle; - int i; - int compiler_result; - int compiled_files=0; - - init_op_array(op_array, INITIAL_OP_ARRAY_SIZE); - save_lexical_state(&original_lex_state CLS_CC); - - retval = op_array; /* success oriented */ - for (i=0; ifilename); - } else { - CG(active_op_array) = op_array; - compiler_result = zendparse(CLS_C); - zend_close_file_handle(file_handle CLS_CC); - restore_lexical_state(&original_lex_state CLS_CC); - CG(active_op_array) = original_active_op_array; - if (compiler_result==1) { /* parser error */ - CG(unclean_shutdown) = 1; - retval = NULL; - break; - } - compiled_files++; - } - } - - if (retval) { - if (compiled_files>0) { - pass_two(op_array); - if (mark_as_ref) { - pass_include_eval(op_array); - } - } else { - destroy_op_array(op_array); - efree(op_array); - retval = NULL; - } - } - return retval; -} - - -zend_op_array *compile_filename(zval *filename, zend_bool unique CLS_DC) -{ - zend_file_handle file_handle; - zval tmp; - zend_op_array *retval; - - if (filename->type != IS_STRING) { - tmp = *filename; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - filename = &tmp; - } - file_handle.filename = filename->value.str.val; - file_handle.free_filename = 0; - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.opened_path = NULL; - retval = zend_compile_files(1 CLS_CC, 1, &file_handle); - if (filename==&tmp) { - zval_dtor(&tmp); - } - return retval; -} - - -static inline int prepare_string_for_scanning(zval *str CLS_DC) -{ -#ifndef ZTS - /* enforce two trailing NULLs for flex... */ - str->value.str.val = (char *) erealloc(str->value.str.val,str->value.str.len+2); - - str->value.str.val[str->value.str.len+1]=0; - - yyin=NULL; - yy_scan_buffer(str->value.str.val, str->value.str.len+2); -#else - istrstream *input_stream = new istrstream(str->value.str.val, str->value.str.len); - CG(ZFL) = new ZendFlexLexer; - - CG(ZFL)->switch_streams(input_stream, &cout); -#endif - return SUCCESS; -} - - -zend_op_array *compile_string(zval *source_string CLS_DC) -{ - zend_lex_state original_lex_state; - zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array)); - zend_op_array *original_active_op_array = CG(active_op_array); - zend_op_array *retval; - zval tmp; - int compiler_result; - - if (source_string->value.str.len==0) { - efree(op_array); - return NULL; - } - tmp = *source_string; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - source_string = &tmp; - - init_op_array(op_array, INITIAL_OP_ARRAY_SIZE); - op_array->type = ZEND_EVAL_CODE; - save_lexical_state(&original_lex_state CLS_CC); - if (prepare_string_for_scanning(source_string CLS_CC)==FAILURE) { - destroy_op_array(op_array); - efree(op_array); - retval = NULL; - } else { - CG(active_op_array) = op_array; -#ifndef ZTS - BEGIN(ST_IN_SCRIPTING); -#else - CG(ZFL)->BeginState(ST_IN_SCRIPTING); -#endif - compiler_result = zendparse(CLS_C); - restore_lexical_state(&original_lex_state CLS_CC); - CG(active_op_array) = original_active_op_array; - - if (compiler_result==1) { - CG(unclean_shutdown)=1; - retval = NULL; - } else { - pass_two(op_array); - pass_include_eval(op_array); - retval = op_array; - } - } - zval_dtor(&tmp); - return retval; -} - - -BEGIN_EXTERN_C() -int require_filename(char *filename CLS_DC) -{ - zend_file_handle file_handle; - - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.filename = filename; - file_handle.free_filename = 0; - if (require_file(&file_handle, 0 CLS_CC)==FAILURE) { - zend_bailout(); - return FAILURE; /* will never get here */ - } - return SUCCESS; -} - - -int use_filename(char *filename, uint filename_length CLS_DC) -{ - zend_file_handle file_handle; - - file_handle.filename = (char *) emalloc(filename_length + zend_uv.import_use_extension_length); - memcpy(file_handle.filename, filename, filename_length); - memcpy(file_handle.filename+filename_length, zend_uv.import_use_extension, zend_uv.import_use_extension_length); - file_handle.filename[filename_length+zend_uv.import_use_extension_length] = 0; - file_handle.free_filename = 1; - - file_handle.type = ZEND_HANDLE_FILENAME; - if (require_file(&file_handle, 1 CLS_CC)==FAILURE) { - efree(file_handle.filename); - zend_bailout(); - return FAILURE; /* will never get here */ - } - return SUCCESS; -} - - -int require_file(zend_file_handle *file_handle, zend_bool unique CLS_DC) -{ - zend_lex_state original_lex_state; - int compiler_result; - - save_lexical_state(&original_lex_state CLS_CC); - if (open_file_for_scanning(file_handle CLS_CC)==FAILURE) { - zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename); - return FAILURE; - } - if (file_handle->opened_path) { - if (unique) { - zend_file_handle *pfh; - - if (zend_hash_add(&CG(used_files), file_handle->opened_path, strlen(file_handle->opened_path)+1, file_handle, sizeof(zend_file_handle), (void **) &pfh)==FAILURE) { - zend_close_file_handle(file_handle CLS_CC); - restore_lexical_state(&original_lex_state CLS_CC); - return SUCCESS; - } else { - /* pfh is a copy we only save for get_used_files() */ - pfh->type = ZEND_HANDLE_FILENAME; - if (pfh->filename) { - pfh->filename = estrdup(pfh->filename); - } - if (pfh->opened_path) { - pfh->opened_path = strdup(pfh->opened_path); - } - } - } - } - compiler_result = zendparse(CLS_C); - zend_close_file_handle(file_handle CLS_CC); - restore_lexical_state(&original_lex_state CLS_CC); - if (compiler_result==1) { - zend_bailout(); - } - return SUCCESS; -} - - -int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini) -{ - zend_lex_state original_lex_state; - zend_file_handle file_handle; - CLS_FETCH(); - - file_handle.type = ZEND_HANDLE_FILENAME; - file_handle.filename = filename; - file_handle.free_filename = 0; - file_handle.opened_path = NULL; - save_lexical_state(&original_lex_state CLS_CC); - if (open_file_for_scanning(&file_handle CLS_CC)==FAILURE) { - zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename); - return FAILURE; - } - zend_highlight(syntax_highlighter_ini); - zend_close_file_handle(&file_handle CLS_CC); - restore_lexical_state(&original_lex_state CLS_CC); - return SUCCESS; -} - - -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini) -{ - zend_lex_state original_lex_state; - zval tmp = *str; - CLS_FETCH(); - - str = &tmp; - zval_copy_ctor(str); - save_lexical_state(&original_lex_state CLS_CC); - if (prepare_string_for_scanning(str CLS_CC)==FAILURE) { - return FAILURE; - } - zend_highlight(syntax_highlighter_ini); - restore_lexical_state(&original_lex_state CLS_CC); - zval_dtor(str); - return SUCCESS; -} -END_EXTERN_C() - -#ifdef ZTS -BEGIN_EXTERN_C() -int lex_scan(zval *zendlval CLS_DC) -{ - return CG(ZFL)->lex_scan(zendlval CLS_CC); -} - - -const char *zend_get_zendtext(CLS_D) -{ - return CG(ZFL)->YYText(); -} - - -int zend_get_zendleng(CLS_D) -{ - return CG(ZFL)->YYLeng(); -} -END_EXTERN_C() - - -void ZendFlexLexer::BeginState(int state) -{ - BEGIN(state); -} - - -ZendFlexLexer::~ZendFlexLexer() -{ - if (yy_start_stack) { - yy_flex_free(yy_start_stack); - } -} - - -int yyFlexLexer::yylex() -{ - fprintf(stderr, "Error: yyFlexLexer::yylex() called\n"); - return -1; -} - -#endif - - -/* redefine YY_INPUT to handle urls for win32*/ -#if 0 /*WIN32|WINNT*/ -#define YY_INPUT(buf,result,max_size) \ - if ( yyin->_tmpfname != "url" ){ \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - }else{ /* this is a url */ \ - int recv_char=0,socketd=0; \ - /*memset(buf,0,max_size);*/ \ - socketd=yyin->_file; \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - ( (recv_char=recv( socketd,(char *)&c,1,0 ))) >0 && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( recv_char == SOCKET_ERROR ) \ - YY_FATAL_ERROR( "input from url in flex scanner failed" ); \ - result = n; \ - } \ - else if ((result = recv( socketd, (char *)buf, max_size, 0)) == SOCKET_ERROR) \ - YY_FATAL_ERROR( "input from url read in flex scanner failed" ); \ - } -#endif - -%} - -LNUM [0-9]+ -DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*) -EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM}) -HNUM "0x"[0-9a-fA-F]+ -LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* -WHITESPACE [ \n\r\t]+ -TABS_AND_SPACES [ \t]* -TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@] -ENCAPSED_TOKENS [\[\]{}$] -ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+ - -%option noyylineno -%option noyywrap -%% - -"exit" { - return T_EXIT; -} - -"die" { - return T_EXIT; -} - -"old_function" { - return T_OLD_FUNCTION; -} - -"function"|"cfunction" { - return T_FUNCTION; -} - -"const" { - return T_CONST; -} - -"return" { - return T_RETURN; -} - -"if" { - return T_IF; -} - -"elseif" { - return T_ELSEIF; -} - -"endif" { - return T_ENDIF; -} - -"else" { - return T_ELSE; -} - -"while" { - return T_WHILE; -} - -"endwhile" { - return T_ENDWHILE; -} - -"do" { - return T_DO; -} - -"for" { - return T_FOR; -} - -"endfor" { - return T_ENDFOR; -} - -"foreach" { - return T_FOREACH; -} - -"endforeach" { - return T_ENDFOREACH; -} - -"as" { - return T_AS; -} - -"switch" { - return T_SWITCH; -} - -"endswitch" { - return T_ENDSWITCH; -} - -"case" { - return T_CASE; -} - -"default" { - return T_DEFAULT; -} - -"break" { - return T_BREAK; -} - -"continue" { - return T_CONTINUE; -} - -"echo" { - return T_ECHO; -} - -"print" { - return T_PRINT; -} - -"class" { - return T_CLASS; -} - -"extends" { - return T_EXTENDS; -} - -"->" { - yy_push_state(ST_LOOKING_FOR_PROPERTY); - return T_OBJECT_OPERATOR; -} - -{LABEL} { - yy_pop_state(); - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - -. { - /*unput(yytext[0]);*/ - yyless(0); - yy_pop_state(); -} - -"::" { - return T_PAAMAYIM_NEKUDOTAYIM; -} - -"new" { - return T_NEW; -} - -"var" { - return T_VAR; -} - -"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" { - return T_INT_CAST; -} - -"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" { - return T_DOUBLE_CAST; -} - -"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" { - return T_STRING_CAST; -} - -"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" { - return T_ARRAY_CAST; -} - -"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" { - return T_OBJECT_CAST; -} - -"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" { - return T_BOOL_CAST; -} - -"eval" { - return T_EVAL; -} - -"include" { - return T_INCLUDE; -} - -"import" { - return T_IMPORT; -} - -"require" { - return T_REQUIRE; -} - -"use" { - return T_USE; -} - -"global" { - return T_GLOBAL; -} - -"isset" { - return T_ISSET; -} - -"empty" { - return T_EMPTY; -} - -"static" { - return T_STATIC; -} - -"unset" { - return T_UNSET; -} - -"=>" { - return T_DOUBLE_ARROW; -} - -"list" { - return T_LIST; -} - -"array" { - return T_ARRAY; -} - -"++" { - return T_INC; -} - -"--" { - return T_DEC; -} - -"===" { - return T_IS_IDENTICAL; -} - -"==" { - return T_IS_EQUAL; -} - -"!="|"<>" { - return T_IS_NOT_EQUAL; -} - -"<=" { - return T_IS_SMALLER_OR_EQUAL; -} - -">=" { - return T_IS_GREATER_OR_EQUAL; -} - -"+=" { - return T_PLUS_EQUAL; -} - -"-=" { - return T_MINUS_EQUAL; -} - -"*=" { - return T_MUL_EQUAL; -} - -"/=" { - return T_DIV_EQUAL; -} - -".=" { - return T_CONCAT_EQUAL; -} - - -"%=" { - return T_MOD_EQUAL; -} - -"<<=" { - return T_SL_EQUAL; -} - -">>=" { - return T_SR_EQUAL; -} - -"&=" { - return T_AND_EQUAL; -} - -"|=" { - return T_OR_EQUAL; -} - -"^=" { - return XT_OR_EQUAL; -} - -"||" { - return T_BOOLEAN_OR; -} - -"&&" { - return T_BOOLEAN_AND; -} - -"OR" { - return T_LOGICAL_OR; -} - -"AND" { - return T_LOGICAL_AND; -} - -"XOR" { - return T_LOGICAL_XOR; -} - -"<<" { - return T_SL; -} - -">>" { - return T_SR; -} - -{TOKENS} { - return yytext[0]; -} - - -"{" { - yy_push_state(ST_IN_SCRIPTING); - return '{'; -} - - -"${" { - yy_push_state(ST_LOOKING_FOR_VARNAME); - return T_DOLLAR_OPEN_CURLY_BRACES; -} - - -"}" { - /* This is a temporary fix which is dependant on flex and it's implementation */ - if (yy_start_stack_ptr) { - yy_pop_state(); - } - return '}'; -} - - -{LABEL} { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - yy_pop_state(); - yy_push_state(ST_IN_SCRIPTING); - return T_STRING_VARNAME; -} - - -. { - /*unput(yytext[0]);*/ - yyless(0); - yy_pop_state(); - yy_push_state(ST_IN_SCRIPTING); -} - - -{LNUM}|{HNUM} { - errno = 0; - zendlval->value.lval = strtol(yytext, NULL, 0); - if (errno == ERANGE) { /* overflow */ - zendlval->value.dval = strtod(yytext,NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; - } else { - zendlval->type = IS_LONG; - return T_LNUMBER; - } -} - -{LNUM}|{HNUM} { /* treat numbers (almost) as strings inside encapsulated strings */ - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_NUM_STRING; -} - -{DNUM}|{EXPONENT_DNUM} { - zendlval->value.dval = strtod(yytext,NULL); - zendlval->type = IS_DOUBLE; - return T_DNUMBER; -} - -"__LINE__" { - zendlval->value.lval = CG(zend_lineno); - zendlval->type = IS_LONG; - return T_LINE; -} - -"__FILE__" { - char *filename = zend_get_compiled_filename(); - - if (!filename) { - filename = ""; - } - zendlval->value.str.len = strlen(filename); - zendlval->value.str.val = estrndup(filename,zendlval->value.str.len); - zendlval->type = IS_STRING; - return T_FILE; -} - - -(([^<]|"<"[^?%s<]){1,400})|"value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext,yyleng); - return T_INLINE_HTML; -} - -"" { - HANDLE_NEWLINES(yytext,yyleng); - if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not */ - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"<%="|"value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG_WITH_ECHO; - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"<%" { - if (CG(asp_tags)) { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - BEGIN(ST_IN_SCRIPTING); - } else { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_INLINE_HTML; - } -} - - -"value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINE(yytext[yyleng-1]); - BEGIN(ST_IN_SCRIPTING); - return T_OPEN_TAG; -} - - -""([\n]|"\r\n")? { - zend_message_dispatcher(ZMSG_ENABLE_TRACK_VARS, NULL); - HANDLE_NEWLINE(yytext[yyleng-1]); - return T_PHP_TRACK_VARS; -} - -"$"{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1); - zendlval->value.str.len = yyleng-1; - zendlval->type = IS_STRING; - return T_VARIABLE; -} - - -{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - - -{LABEL} { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; -} - - -{WHITESPACE} { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext,yyleng); - return T_WHITESPACE; -} - - -([#]|"//")([^\n\r?]|"?"[^>\n\r])*("?\n"|"?\r\n")? { /* eat one line comments */ - HANDLE_NEWLINE(yytext[yyleng-1]); - return T_COMMENT; -} - -"/*" { - CG(comment_start_line) = CG(zend_lineno); - BEGIN(ST_COMMENT); - yymore(); -} - - -[^*]+ { - yymore(); -} - -"*/" { - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(ST_IN_SCRIPTING); - return T_COMMENT; -} - -"*" { - yymore(); -} - -("?>"|"")([\n]|"\r\n")? { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext, yyleng); - BEGIN(INITIAL); - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ -} - - -"%>"([\n]|"\r\n")? { - zendlval->value.str.val = yytext; /* no copying - intentional */ - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext,yyleng); - if (CG(asp_tags)) { - BEGIN(INITIAL); - return T_CLOSE_TAG; /* implicit ';' at php-end tag */ - } else { - return T_INLINE_HTML; - } -} - - -(["]([^$"\\]|("\\".))*["]) { - register char *s, *t; - char *end; - - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext,yyleng); - - /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; - while (s=end) { - continue; - } - switch(*s) { - case 'n': - *t++ = '\n'; - zendlval->value.str.len--; - break; - case 'r': - *t++ = '\r'; - zendlval->value.str.len--; - break; - case 't': - *t++ = '\t'; - zendlval->value.str.len--; - break; - case '\\': - case '$': - case '"': - *t++ = *s; - zendlval->value.str.len--; - break; - default: - /* check for an octal */ - if (ZEND_IS_OCT(*s)) { - char octal_buf[4] = { 0, 0, 0, 0 }; - - octal_buf[0] = *s; - zendlval->value.str.len--; - if ((s+1)value.str.len--; - if ((s+1)value.str.len--; - } - } - *t++ = (char) strtol(octal_buf, NULL, 8); - } else if (*s=='x' && (s+1)value.str.len--; /* for the 'x' */ - - hex_buf[0] = *(++s); - zendlval->value.str.len--; - if ((s+1)value.str.len--; - } - *t++ = (char) strtol(hex_buf, NULL, 16); - } else { - *t++ = '\\'; - *t++ = *s; - } - break; - } - s++; - } else { - *t++ = *s++; - } - } - *t = 0; - - return T_CONSTANT_ENCAPSED_STRING; -} - - -([']([^'\\]|("\\".))*[']) { - register char *s, *t; - char *end; - - zendlval->value.str.val = estrndup(yytext+1, yyleng-2); - zendlval->value.str.len = yyleng-2; - zendlval->type = IS_STRING; - HANDLE_NEWLINES(yytext,yyleng); - - /* convert escape sequences */ - s = t = zendlval->value.str.val; - end = s+zendlval->value.str.len; - while (s=end) { - continue; - } - switch(*s) { - case '\\': - case '\'': - *t++ = *s; - zendlval->value.str.len--; - break; - default: - *t++ = '\\'; - *t++ = *s; - break; - } - s++; - } else { - *t++ = *s++; - } - } - *t = 0; - - return T_CONSTANT_ENCAPSED_STRING; -} - - -["] { - BEGIN(ST_DOUBLE_QUOTES); - return '\"'; -} - - -"<<<"{TABS_AND_SPACES}{LABEL}("\r")?"\n" { - char *s; - CG(zend_lineno)++; - CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0); - s = yytext+3; - while ((*s == ' ') || (*s == '\t')) { - s++; - CG(heredoc_len)--; - } - CG(heredoc) = estrndup(s, CG(heredoc_len)); - BEGIN(ST_HEREDOC); - return T_HEREDOC; -} - - -[`] { - BEGIN(ST_BACKQUOTE); - return '`'; -} - - -['] { - BEGIN(ST_SINGLE_QUOTE); - return '\''; -} - - -^{LABEL}(";")?("\r")?"\n" { - int label_len; - unsigned char unput_semicolon; - - CG(zend_lineno)++; - if (yytext[yyleng-2]=='\r') { - label_len = yyleng-2; - } else { - label_len = yyleng-1; - } - - if (yytext[label_len-1]==';') { - label_len--; - unput_semicolon=1; - } else{ - unput_semicolon=0; - } - - if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) { - if (unput_semicolon) { - unput(';'); - } - efree(CG(heredoc)); - CG(heredoc)=NULL; - CG(heredoc_len)=0; - BEGIN(ST_IN_SCRIPTING); - return T_HEREDOC; - } else { - zendlval->value.str.val = (char *)estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_STRING; - } -} - - -{ESCAPED_AND_WHITESPACE} { - HANDLE_NEWLINES(yytext,yyleng); - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - -([^'\\]|\\[^'\\])+ { - HANDLE_NEWLINES(yytext,yyleng); - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -[`]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -["]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -"$"[^a-zA-Z_\x7f-\xff{] { - zendlval->value.chval = yytext[0]; - if (yyleng == 2) { - yyless(1); - /*unput(yytext[1]); - yytext[1] = 0; - yyleng--;*/ - } - return T_CHARACTER; -} - - -{ENCAPSED_TOKENS} { - zendlval->value.chval = yytext[0]; - return yytext[0]; -} - -"{$" { - zendlval->value.chval = yytext[0]; - yy_push_state(ST_IN_SCRIPTING); - /*unput('$');*/ - yyless(1); - return T_CURLY_OPEN; -} - - -"\\'" { - zendlval->value.chval='\''; - return T_CHARACTER; -} - -"\\\\" { - zendlval->value.chval='\\'; - return T_CHARACTER; -} - -"\\\"" { - zendlval->value.chval='"'; - return T_CHARACTER; -} - -"\\`" { - zendlval->value.chval='`'; - return T_CHARACTER; -} - -"\\"[0-7]{1,3} { - zendlval->value.chval = (char) strtol (yytext+1, NULL, 8); - return T_CHARACTER; -} - -"\\x"[0-9A-Fa-f]{1,2} { - zendlval->value.chval = (char) strtol (yytext+2, NULL, 16); - return T_CHARACTER; -} - -"\\". { - switch (yytext[1]) { - case 'n': - zendlval->value.chval='\n'; - break; - case 't': - zendlval->value.chval='\t'; - break; - case 'r': - zendlval->value.chval='\r'; - break; - case '\\': - zendlval->value.chval='\\'; - break; - case '$': - zendlval->value.chval=yytext[1]; - break; - case '{': - zendlval->value.chval=yytext[1]; - break; - default: - zendlval->value.str.val = estrndup(yytext,yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_BAD_CHARACTER; - break; - } - return T_CHARACTER; -} - - -["'`]+ { - zendlval->value.str.val = (char *) estrndup(yytext, yyleng); - zendlval->value.str.len = yyleng; - zendlval->type = IS_STRING; - return T_ENCAPSED_AND_WHITESPACE; -} - - -["] { - BEGIN(ST_IN_SCRIPTING); - return '\"'; -} - - -[`] { - BEGIN(ST_IN_SCRIPTING); - return '`'; -} - - -['] { - BEGIN(ST_IN_SCRIPTING); - return '\''; -} - - -<> { - return 0; -} - -<> { - zend_error(E_COMPILE_WARNING,"Unterminated comment starting line %d", CG(comment_start_line)); - return 0; -} - - - -. { - zend_error(E_COMPILE_WARNING,"Unexpected character in input: '%c' (ASCII=%d) state=%d",yytext[0],yytext[0],YYSTATE); -} diff --git a/Zend/zend.c b/Zend/zend.c deleted file mode 100644 index 83800b54e4..0000000000 --- a/Zend/zend.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_extensions.h" -#include "modules.h" -#include "zend_constants.h" -#include "zend_list.h" -#include "zend_API.h" -#include "zend_builtin_functions.h" - -#ifdef ZTS -# define GLOBAL_FUNCTION_TABLE global_function_table -# define GLOBAL_CLASS_TABLE global_class_table -# define GLOBAL_CONSTANTS_TABLE global_constants_table -#else -# define GLOBAL_FUNCTION_TABLE CG(function_table) -# define GLOBAL_CLASS_TABLE CG(class_table) -# define GLOBAL_CONSTANTS_TABLE CG(zend_constants) -#endif - -/* true multithread-shared globals */ -ZEND_API zend_class_entry zend_standard_class_def; -ZEND_API int (*zend_printf)(const char *format, ...); -ZEND_API int (*zend_write)(const char *str, uint str_length); -ZEND_API void (*zend_error)(int type, const char *format, ...); -ZEND_API void (*zend_message_dispatcher)(long message, void *data); -ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); -ZEND_API void (*zend_block_interruptions)(void); -ZEND_API void (*zend_unblock_interruptions)(void); -ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents); - -#ifdef ZTS -ZEND_API int compiler_globals_id; -ZEND_API int executor_globals_id; -int alloc_globals_id; -HashTable *global_function_table; -HashTable *global_class_table; -HashTable *global_constants_table; -#endif - -zend_utility_values zend_uv; - -/* version information */ -static char *zend_version_info; -static uint zend_version_info_length; -#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski\n" - - -#define PRINT_PVAL_INDENT 4 - -static void print_hash(HashTable *ht, int indent) -{ - zval **tmp; - char *string_key; - unsigned long num_key; - int i; - - for (i=0; i "); - zend_print_zval_r(*tmp, indent+PRINT_PVAL_INDENT); - ZEND_PUTS("\n"); - zend_hash_move_forward(ht); - } - indent -= PRINT_PVAL_INDENT; - for (i=0; itype==IS_STRING) { - *use_copy = 0; - return; - } - switch (expr->type) { - case IS_BOOL: -#if 1 - if (expr->value.lval) { - expr_copy->value.str.len = 1; - expr_copy->value.str.val = estrndup("1", 1); - } else { - expr_copy->value.str.len = 0; - expr_copy->value.str.val = empty_string; - } -#else - if (expr->value.lval) { - expr_copy->value.str.len = sizeof("true")-1; - expr_copy->value.str.val = estrndup("true", expr_copy->value.str.len); - } else { - expr_copy->value.str.len = sizeof("false")-1; - expr_copy->value.str.val = estrndup("false", expr_copy->value.str.len); - } -#endif - break; - case IS_RESOURCE: - expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG); - expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval); - break; - case IS_ARRAY: - expr_copy->value.str.len = sizeof("Array")-1; - expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len); - break; - case IS_OBJECT: { - zval function_name; - - function_name.value.str.len = sizeof("to_string")-1; - function_name.value.str.val = estrndup("to_string", function_name.value.str.len); - function_name.type = IS_STRING; - - if (call_user_function(NULL, expr, &function_name, expr_copy, 0, NULL)==FAILURE) { - expr_copy->value.str.len = sizeof("Object")-1; - expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len); - } - efree(function_name.value.str.val); - } - break; - default: - *expr_copy = *expr; - zval_copy_ctor(expr_copy); - convert_to_string(expr_copy); - break; - } - expr_copy->type = IS_STRING; - *use_copy = 1; -} - - -ZEND_API int zend_print_zval(zval *expr, int indent) -{ - zval expr_copy; - int use_copy; - - zend_make_printable_zval(expr, &expr_copy, &use_copy); - if (use_copy) { - expr = &expr_copy; - } - if (expr->value.str.len==0) { /* optimize away empty strings */ - if (use_copy) { - zval_dtor(expr); - } - return 0; - } - ZEND_WRITE(expr->value.str.val,expr->value.str.len); - if (use_copy) { - zval_dtor(expr); - } - return expr->value.str.len; -} - - -ZEND_API void zend_print_zval_r(zval *expr, int indent) -{ - switch(expr->type) { - case IS_ARRAY: - ZEND_PUTS("Array\n"); - print_hash(expr->value.ht,indent); - break; - case IS_OBJECT: - zend_printf("%s Object\n", expr->value.obj.ce->name); - print_hash(expr->value.obj.properties, indent); - break; - default: - zend_print_variable(expr); - break; - } -} - - -static FILE *zend_fopen_wrapper(const char *filename, char **opened_path) -{ - if (opened_path) { - *opened_path = strdup(filename); - } - return fopen(filename, "r"); -} - - -static void register_standard_class(void) -{ - zend_standard_class_def.type = ZEND_INTERNAL_CLASS; - zend_standard_class_def.name_length = sizeof("stdClass") - 1; - zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length); - zend_standard_class_def.parent = NULL; - zend_hash_init(&zend_standard_class_def.default_properties, 0, NULL, PVAL_PTR_DTOR, 1); - zend_hash_init(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1); - zend_standard_class_def.handle_function_call = NULL; - zend_standard_class_def.handle_property_get = NULL; - zend_standard_class_def.handle_property_set = NULL; - zend_standard_class_def.refcount = (int *) malloc(sizeof(int)); - *zend_standard_class_def.refcount = 1; - zend_hash_add(GLOBAL_CLASS_TABLE, "stdclass", sizeof("stdclass"), &zend_standard_class_def, sizeof(zend_class_entry), NULL); -} - - -#ifdef ZTS -static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) -{ - zend_function tmp_func; - zend_class_entry tmp_class; - - compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1); - zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function)); - - compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1); - zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref, &tmp_class, sizeof(zend_class_entry)); -} - - -static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) -{ - if (compiler_globals->function_table != global_function_table) { - zend_hash_destroy(compiler_globals->function_table); - free(compiler_globals->function_table); - } - if (compiler_globals->class_table != global_class_table) { - zend_hash_destroy(compiler_globals->class_table); - free(compiler_globals->class_table); - } -} - - -static void executor_globals_ctor(zend_executor_globals *executor_globals) -{ - if (global_constants_table) { - zend_startup_constants(ELS_C); - zend_copy_constants(executor_globals->zend_constants, global_constants_table); - } - init_resource_plist(ELS_C); -} - - -static void executor_globals_dtor(zend_executor_globals *executor_globals) -{ - zend_shutdown_constants(ELS_C); - destroy_resource_plist(); -} - - -static void alloc_globals_ctor(zend_alloc_globals *alloc_globals) -{ - start_memory_manager(ALS_C); -} - -#endif - - -int zend_startup(zend_utility_functions *utility_functions, char **extensions) -{ -#ifdef ZTS - zend_compiler_globals *compiler_globals; - zend_executor_globals *executor_globals; - - alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, NULL); -#else - start_memory_manager(ALS_C); -#endif - - /* Set up utility functions and values */ - zend_error = utility_functions->error_function; - zend_printf = utility_functions->printf_function; - zend_write = utility_functions->write_function; - zend_fopen = utility_functions->fopen_function; - if (!zend_fopen) { - zend_fopen = zend_fopen_wrapper; - } - zend_message_dispatcher = utility_functions->message_handler; - zend_block_interruptions = utility_functions->block_interruptions; - zend_unblock_interruptions = utility_functions->unblock_interruptions; - zend_get_ini_entry = utility_functions->get_ini_entry; - - zend_compile_files = compile_files; - zend_execute = execute; - - zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1); - - /* set up version */ - zend_version_info = strdup(ZEND_CORE_VERSION_INFO); - zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1; - - GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable)); - GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable)); - zend_hash_init(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1); - zend_hash_init(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1); - register_standard_class(); - zend_hash_init(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1); - zend_hash_init(&list_destructors, 50, NULL, NULL, 1); - -#ifdef ZTS - global_constants_table = NULL; - compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals), (void (*)(void *)) compiler_globals_ctor, (void (*)(void *)) compiler_globals_dtor); - executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals), (void (*)(void *)) executor_globals_ctor, (void (*)(void *)) executor_globals_dtor); - compiler_globals = ts_resource(compiler_globals_id); - executor_globals = ts_resource(executor_globals_id); - compiler_globals_dtor(compiler_globals); - compiler_globals->function_table = GLOBAL_FUNCTION_TABLE; - compiler_globals->class_table = GLOBAL_CLASS_TABLE; - zend_startup_constants(executor_globals); - GLOBAL_CONSTANTS_TABLE = EG(zend_constants); -#else - zend_startup_constants(); -#endif - zend_register_standard_constants(ELS_C); - -#ifndef ZTS - init_resource_plist(ELS_C); -#endif - - zend_startup_builtin_functions(); - - return SUCCESS; -} - - -void zend_shutdown() -{ -#ifndef ZTS - destroy_resource_plist(); -#endif - zend_hash_destroy(&list_destructors); - zend_hash_destroy(&module_registry); - zend_hash_destroy(GLOBAL_FUNCTION_TABLE); - free(GLOBAL_FUNCTION_TABLE); - zend_hash_destroy(GLOBAL_CLASS_TABLE); - free(GLOBAL_CLASS_TABLE); - zend_shutdown_extensions(); - free(zend_version_info); -#ifndef ZTS - zend_shutdown_constants(ELS_C); -#endif -} - - -void zend_set_utility_values(zend_utility_values *utility_values) -{ - zend_uv = *utility_values; - zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension); -} - - -/* this should be compatible with the standard zenderror */ -void zenderror(char *error) -{ - zend_error(E_PARSE, error); -} - - -BEGIN_EXTERN_C() -ZEND_API void zend_bailout() -{ - CLS_FETCH(); - ELS_FETCH(); - - CG(unclean_shutdown) = 1; - longjmp(EG(bailout), FAILURE); -} -END_EXTERN_C() - - -void zend_append_version_info(zend_extension *extension) -{ - char *new_info; - uint new_info_length; - - new_info_length = sizeof(" with v, by \n") - + strlen(extension->name) - + strlen(extension->version) - + strlen(extension->copyright) - + strlen(extension->author); - - new_info = (char *) malloc(new_info_length+1); - - sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author); - - zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1); - strcat(zend_version_info, new_info); - zend_version_info_length += new_info_length; - free(new_info); -} - - -ZEND_API char *get_zend_version() -{ - return zend_version_info; -} - - -void zend_activate(CLS_D ELS_DC) -{ - init_compiler(CLS_C ELS_CC); - init_executor(CLS_C ELS_CC); - startup_scanner(CLS_C); -} - -void zend_deactivate(CLS_D ELS_DC) -{ - zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_cleanup); - shutdown_scanner(CLS_C); - shutdown_executor(ELS_C); - shutdown_compiler(CLS_C); -} diff --git a/Zend/zend.h b/Zend/zend.h deleted file mode 100644 index 2129970352..0000000000 --- a/Zend/zend.h +++ /dev/null @@ -1,301 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_H -#define _ZEND_H - -#define ZEND_VERSION "0.90" - -#ifdef __cplusplus -#define BEGIN_EXTERN_C() extern "C" { -#define END_EXTERN_C() } -#else -#define BEGIN_EXTERN_C() -#define END_EXTERN_C() -#endif - -#include - -/* - * general definitions - */ - -#if (defined(WINNT) && WINNT) || (defined(WIN32) && WIN32) -# include "zend_config.w32.h" -#else -# include "zend_config.h" -#endif - -/* all HAVE_XXX test have to be after the include of zend_config above */ - -#ifdef HAVE_UNIX_H -# include -#endif - -#ifdef HAVE_STDARG_H -# include -#endif - -#if ZEND_DEBUG -#define ZEND_FILE_LINE_D char *__zend_filename, uint __zend_lineno -#define ZEND_FILE_LINE_DC , ZEND_FILE_LINE_D -#define ZEND_FILE_LINE_ORIG_D char *__zend_orig_filename, uint __zend_orig_lineno -#define ZEND_FILE_LINE_ORIG_DC , ZEND_FILE_LINE_ORIG_D -#define ZEND_FILE_LINE_RELAY_C __zend_filename, __zend_lineno -#define ZEND_FILE_LINE_RELAY_CC , ZEND_FILE_LINE_RELAY_C -#define ZEND_FILE_LINE_C __FILE__, __LINE__ -#define ZEND_FILE_LINE_CC , ZEND_FILE_LINE_C -#define ZEND_FILE_LINE_EMPTY_C NULL, 0 -#define ZEND_FILE_LINE_EMPTY_CC , ZEND_FILE_LINE_EMPTY_C -#define ZEND_FILE_LINE_ORIG_RELAY_C __zend_orig_filename, __zend_orig_lineno -#define ZEND_FILE_LINE_ORIG_RELAY_CC , ZEND_FILE_LINE_ORIG_RELAY_C -#else -#define ZEND_FILE_LINE_D -#define ZEND_FILE_LINE_DC -#define ZEND_FILE_LINE_ORIG_D -#define ZEND_FILE_LINE_ORIG_DC -#define ZEND_FILE_LINE_RELAY_C -#define ZEND_FILE_LINE_RELAY_CC -#define ZEND_FILE_LINE_C -#define ZEND_FILE_LINE_CC -#define ZEND_FILE_LINE_EMPTY_C -#define ZEND_FILE_LINE_EMPTY_CC -#define ZEND_FILE_LINE_ORIG_RELAY_C -#define ZEND_FILE_LINE_ORIG_RELAY_CC -#endif /* ZEND_DEBUG */ - - -#include "zend_errors.h" -#include "zend_alloc.h" - -typedef unsigned char zend_bool; - -#undef SUCCESS -#undef FAILURE -#define SUCCESS 0 -#define FAILURE -1 /* this MUST stay a negative number, or it may affect functions! */ - - -#include "zend_hash.h" -#include "zend_llist.h" - -#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist, zval *this_ptr, int return_value_used -#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr, return_value_used - -/* - * zval - */ -typedef struct _zval_struct zval; -typedef struct _zend_class_entry zend_class_entry; - -typedef union _zvalue_value { - long lval; /* long value */ - double dval; /* double value */ - struct { - char *val; - int len; - } str; - char chval; /* char value */ - HashTable *ht; /* hash table value */ - struct { - zend_class_entry *ce; - HashTable *properties; - } obj; -} zvalue_value; - - -struct _zval_struct { - /* Variable information */ - zvalue_value value; /* value */ - unsigned char type; /* active type */ - unsigned char is_ref; - short refcount; -}; - - - -typedef struct _zend_function_entry { - char *fname; - void (*handler)(INTERNAL_FUNCTION_PARAMETERS); - unsigned char *func_arg_types; -} zend_function_entry; - - -typedef struct _zend_property_reference { - int type; /* read, write or r/w */ - zval *object; - zend_llist elements_list; -} zend_property_reference; - - - -typedef struct _zend_overloaded_element { - int type; /* array offset or object proprety */ - zval element; -} zend_overloaded_element; - -/* excpt.h on Digital Unix 4.0 defines function_table */ -#undef function_table - -struct _zend_class_entry { - char type; - char *name; - uint name_length; - struct _zend_class_entry *parent; - int *refcount; - zend_bool constants_updated; - - HashTable function_table; - HashTable default_properties; - zend_function_entry *builtin_functions; - - /* handlers */ - void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference); - zval (*handle_property_get)(zend_property_reference *property_reference); - int (*handle_property_set)(zend_property_reference *property_reference, zval *value); -}; - - - -typedef struct _zend_utility_functions { - void (*error_function)(int type, const char *format, ...); - int (*printf_function)(const char *format, ...); - int (*write_function)(const char *str, uint str_length); - FILE *(*fopen_function)(const char *filename, char **opened_path); - void (*message_handler)(long message, void *data); - void (*block_interruptions)(void); - void (*unblock_interruptions)(void); - int (*get_ini_entry)(char *name, uint name_length, zval *contents); -} zend_utility_functions; - - -typedef struct _zend_utility_values { - unsigned char short_tags; - unsigned char asp_tags; - char *import_use_extension; - uint import_use_extension_length; -} zend_utility_values; - - -#undef MIN -#undef MAX -#define MAX(a,b) (((a)>(b))?(a):(b)) -#define MIN(a,b) (((a)<(b))?(a):(b)) - -/* data types */ -#define IS_LONG 1 -#define IS_DOUBLE 2 -#define IS_STRING 3 -#define IS_ARRAY 4 -#define IS_OBJECT 5 -#define IS_BC 6 /* for parser internal use only */ -#define IS_BOOL 7 -#define IS_RESOURCE 8 -#define IS_CONSTANT 9 -#define IS_METHOD 10 /* for overloaded function calls */ - -int zend_startup(zend_utility_functions *utility_functions, char **extensions); -void zend_shutdown(void); - -void zend_set_utility_values(zend_utility_values *utility_values); -BEGIN_EXTERN_C() -ZEND_API void zend_bailout(void); -END_EXTERN_C() -ZEND_API char *get_zend_version(void); - -ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy); -ZEND_API int zend_print_zval(zval *expr, int indent); -ZEND_API void zend_print_zval_r(zval *expr, int indent); - -ZEND_API extern char *empty_string; -ZEND_API extern char *undefined_variable_string; - -#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); } -#define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree_rel(ptr); } - -/* output support */ -#define ZEND_WRITE(str, str_len) zend_write((str), (str_len)) -#define ZEND_PUTS(str) zend_write((str), strlen((str))) -#define ZEND_PUTC(c) zend_write(&(c), 1), (c) - -BEGIN_EXTERN_C() -extern ZEND_API int (*zend_printf)(const char *format, ...); -extern ZEND_API int (*zend_write)(const char *str, uint str_length); -extern ZEND_API void (*zend_error)(int type, const char *format, ...); -extern ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path); -extern ZEND_API void (*zend_block_interruptions)(void); -extern ZEND_API void (*zend_unblock_interruptions)(void); -extern ZEND_API void (*zend_message_dispatcher)(long message, void *data); -extern ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents); - -void zenderror(char *error); - -extern ZEND_API zend_class_entry zend_standard_class_def; -extern zend_utility_values zend_uv; -END_EXTERN_C() - -#define ZEND_UV(name) (zend_uv.name) - - -#define HANDLE_BLOCK_INTERRUPTIONS() if (zend_block_interruptions) { zend_block_interruptions(); } -#define HANDLE_UNBLOCK_INTERRUPTIONS() if (zend_unblock_interruptions) { zend_unblock_interruptions(); } - - -/* Messages for applications of Zend */ -#define ZMSG_ENABLE_TRACK_VARS 1L -#define ZMSG_FAILED_INCLUDE_FOPEN 2L -#define ZMSG_FAILED_REQUIRE_FOPEN 3L -#define ZMSG_FAILED_HIGHLIGHT_FOPEN 4L -#define ZMSG_MEMORY_LEAK_DETECTED 5L -#define ZMSG_MEMORY_LEAK_REPEATED 6L -#define ZMSG_LOG_SCRIPT_NAME 7L - -#define INIT_PZVAL(z) \ - (z)->refcount = 1; \ - (z)->is_ref = 0; - -#define MAKE_STD_ZVAL(zv) \ - zv = (zval *) emalloc(sizeof(zval)); \ - INIT_PZVAL(zv); - -#define SEPARATE_ZVAL(ppzv) \ - { \ - zval *orig_ptr = *(ppzv); \ - \ - if (orig_ptr->refcount>1) { \ - orig_ptr->refcount--; \ - *(ppzv) = (zval *) emalloc(sizeof(zval)); \ - **(ppzv) = *orig_ptr; \ - zval_copy_ctor(*(ppzv)); \ - (*(ppzv))->refcount=1; \ - (*(ppzv))->is_ref = 0; \ - } \ - } - -#define ZEND_MAX_RESERVED_RESOURCES 1 - -#endif /* _ZEND_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend.ico b/Zend/zend.ico deleted file mode 100644 index 80978a6c7e..0000000000 Binary files a/Zend/zend.ico and /dev/null differ diff --git a/Zend/zend_API.c b/Zend/zend_API.c deleted file mode 100644 index 912811eb44..0000000000 --- a/Zend/zend_API.c +++ /dev/null @@ -1,857 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_variables.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "modules.h" -#include "zend_constants.h" -#include "zend_operators.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -/* these variables are true statics/globals, and have to be mutex'ed on every access */ -static int module_count=0; -HashTable list_destructors, module_registry; - -/* this function doesn't check for too many parameters */ -ZEND_API int getParameters(int ht, int param_count,...) -{ - void **p; - int arg_count; - va_list ptr; - zval **param, *param_ptr; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - va_start(ptr, param_count); - - while (param_count>0) { - param = va_arg(ptr, zval **); - param_ptr = *(p-param_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { - zval *new_tmp; - - new_tmp = (zval *) emalloc(sizeof(zval)); - *new_tmp = *param_ptr; - zval_copy_ctor(new_tmp); - INIT_PZVAL(new_tmp); - param_ptr = new_tmp; - ((zval *) *(p-param_count))->refcount--; - *(p-param_count) = param_ptr; - } - *param = param_ptr; - param_count--; - } - va_end(ptr); - - return SUCCESS; -} - - -ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array) -{ - void **p; - int arg_count; - zval *param_ptr; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - - while (param_count>0) { - param_ptr = *(p-param_count); - if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) { - zval *new_tmp; - - new_tmp = (zval *) emalloc(sizeof(zval)); - *new_tmp = *param_ptr; - zval_copy_ctor(new_tmp); - INIT_PZVAL(new_tmp); - param_ptr = new_tmp; - ((zval *) *(p-param_count))->refcount--; - *(p-param_count) = param_ptr; - } - *(argument_array++) = param_ptr; - param_count--; - } - - return SUCCESS; -} - - - - -/* Zend-optimized Extended functions */ -/* this function doesn't check for too many parameters */ -ZEND_API int getParametersEx(int param_count,...) -{ - void **p; - int arg_count; - va_list ptr; - zval ***param; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - va_start(ptr, param_count); - while (param_count>0) { - param = va_arg(ptr, zval ***); - *param = (zval **) p-(param_count--); - } - va_end(ptr); - - return SUCCESS; -} - - -ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array) -{ - void **p; - int arg_count; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; - - if (param_count>arg_count) { - return FAILURE; - } - - while (param_count>0) { - *(argument_array++) = (zval **) p-(param_count--); - } - - return SUCCESS; -} - - -ZEND_API int ParameterPassedByReference(int ht, uint n) -{ - void **p; - ulong arg_count; - zval *arg; - ELS_FETCH(); - - p = EG(argument_stack).elements+EG(argument_stack).top-1; - arg_count = (ulong) *p; - - if (n>arg_count) { - return FAILURE; - } - arg = (zval *) *(p-arg_count+n-1); - return PZVAL_IS_REF(arg); -} - - -ZEND_API void wrong_param_count() -{ - zend_error(E_WARNING,"Wrong parameter count for %s()",get_active_function_name()); -} - - -ZEND_API inline int array_init(zval *arg) -{ - arg->value.ht = (HashTable *) emalloc(sizeof(HashTable)); - if (!arg->value.ht || zend_hash_init(arg->value.ht, 0, NULL, PVAL_PTR_DTOR, 0)) { - zend_error(E_CORE_ERROR, "Cannot allocate memory for array"); - return FAILURE; - } - arg->type = IS_ARRAY; - return SUCCESS; -} - - -ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type) -{ - zval *tmp; - - if (!class_type->constants_updated) { - zend_hash_apply(&class_type->default_properties, (int (*)(void *)) zval_update_constant); - class_type->constants_updated = 1; - } - arg->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(arg->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0); - zend_hash_copy(arg->value.obj.properties, &class_type->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *)); - arg->type = IS_OBJECT; - arg->value.obj.ce = class_type; - return SUCCESS; -} - - -ZEND_API inline int object_init(zval *arg) -{ - return object_init_ex(arg, &zend_standard_class_def); -} - - -ZEND_API inline int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) -{ - zend_error(E_WARNING, "add_assoc_function() is no longer supported"); - return FAILURE; -} - - -ZEND_API inline int add_assoc_long(zval *arg, char *key, long n) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_LONG; - tmp->value.lval = n; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_assoc_bool(zval *arg, char *key, int b) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_BOOL; - tmp->value.lval = b; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_assoc_resource(zval *arg, char *key, int r) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_RESOURCE; - tmp->value.lval = r; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_assoc_double(zval *arg, char *key, double d) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_DOUBLE; - tmp->value.dval = d; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_index_long(zval *arg, uint index, long n) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_LONG; - tmp->value.lval = n; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_index_bool(zval *arg, uint index, int b) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_BOOL; - tmp->value.lval = b; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_index_resource(zval *arg, uint index, int r) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_RESOURCE; - tmp->value.lval = r; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_index_double(zval *arg, uint index, double d) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_DOUBLE; - tmp->value.dval = d; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_next_index_long(zval *arg, long n) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_LONG; - tmp->value.lval = n; - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_next_index_bool(zval *arg, int b) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_BOOL; - tmp->value.lval = b; - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_next_index_resource(zval *arg, int r) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_RESOURCE; - tmp->value.lval = r; - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_next_index_double(zval *arg, double d) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_DOUBLE; - tmp->value.dval = d; - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL); -} - - -ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest); -} - - -ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **dest) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_LONG; - tmp->value.lval = l; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest); -} - - -ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void **dest) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_DOUBLE; - tmp->value.dval= d; - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest); -} - - -ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest); -} - - -ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest); -} - - -ZEND_API inline int add_property_long(zval *arg, char *key, long n) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_LONG; - tmp->value.lval = n; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - -ZEND_API inline int add_property_resource(zval *arg, char *key, long n) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_RESOURCE; - tmp->value.lval = n; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_property_double(zval *arg, char *key, double d) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_DOUBLE; - tmp->value.dval = d; - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = strlen(str); - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -ZEND_API inline int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate) -{ - zval *tmp = (zval *) emalloc(sizeof(zval)); - - tmp->type = IS_STRING; - tmp->value.str.len = length; - if (duplicate) { - tmp->value.str.val = estrndup(str,tmp->value.str.len); - } else { - tmp->value.str.val = str; - } - INIT_PZVAL(tmp); - return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); -} - - -int zend_startup_module(zend_module_entry *module) -{ - if (module) { - module->module_number = zend_next_free_module(); - if (module->module_startup_func) { - if (module->module_startup_func(MODULE_PERSISTENT, module->module_number)==FAILURE) { - zend_error(E_CORE_ERROR,"Unable to start %s module",module->name); - return FAILURE; - } - } - module->type = MODULE_PERSISTENT; - zend_register_module(module); - } - return SUCCESS; -} - - -ZEND_API int _register_list_destructors(void (*list_destructor)(void *), void (*plist_destructor)(void *), int module_number) -{ - list_destructors_entry ld; - -#if 0 - printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number); -#endif - - ld.list_destructor=(void (*)(void *)) list_destructor; - ld.plist_destructor=(void (*)(void *)) plist_destructor; - ld.module_number = module_number; - ld.resource_id = list_destructors.nNextFreeElement; - - if (zend_hash_next_index_insert(&list_destructors,(void *) &ld,sizeof(list_destructors_entry),NULL)==FAILURE) { - return FAILURE; - } - return list_destructors.nNextFreeElement-1; -} - - -/* registers all functions in *library_functions in the function hash */ -int zend_register_functions(zend_function_entry *functions, HashTable *function_table) -{ - zend_function_entry *ptr = functions; - zend_internal_function internal_function; - int count=0,unload=0; - HashTable *target_function_table = function_table; - CLS_FETCH(); - - if (!target_function_table) { - target_function_table = CG(function_table); - } - internal_function.type = ZEND_INTERNAL_FUNCTION; - - while (ptr->fname) { - internal_function.handler = ptr->handler; - internal_function.arg_types = ptr->func_arg_types; - internal_function.function_name = ptr->fname; - if (!internal_function.handler) { - zend_error(E_CORE_WARNING,"Null function defined as active function"); - zend_unregister_functions(functions, count, target_function_table); - return FAILURE; - } - if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &internal_function, sizeof(zend_internal_function), NULL) == FAILURE) { - unload=1; - break; - } - ptr++; - count++; - } - if (unload) { /* before unloading, display all remaining bad function in the module */ - while (ptr->fname) { - if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) { - zend_error(E_CORE_WARNING, "Function registration failed - duplicate name - %s",ptr->fname); - } - ptr++; - } - zend_unregister_functions(functions, count, target_function_table); - return FAILURE; - } - return SUCCESS; -} - -/* count=-1 means erase all functions, otherwise, - * erase the first count functions - */ -void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table) -{ - zend_function_entry *ptr = functions; - int i=0; - HashTable *target_function_table = function_table; - CLS_FETCH(); - - if (!target_function_table) { - target_function_table = CG(function_table); - } - while (ptr->fname) { - if (count!=-1 && i>=count) { - break; - } -#if 0 - zend_printf("Unregistering %s()\n", ptr->fname); -#endif - zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1); - ptr++; - i++; - } -} - - -ZEND_API int zend_register_module(zend_module_entry *module) -{ -#if 0 - zend_printf("%s: Registering module %d\n",module->name, module->module_number); -#endif - if (module->functions && zend_register_functions(module->functions, NULL)==FAILURE) { - zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load",module->name); - return FAILURE; - } - module->module_started=1; - return zend_hash_add(&module_registry, module->name,strlen(module->name)+1,(void *)module,sizeof(zend_module_entry),NULL); -} - - -void module_destructor(zend_module_entry *module) -{ - if (module->type == MODULE_TEMPORARY) { - zend_hash_apply_with_argument(&list_destructors, (int (*)(void *,void *)) clean_module_resource_destructors, (void *) &(module->module_number)); - clean_module_constants(module->module_number); - } - - if (module->module_started && module->module_shutdown_func) { -#if 0 - zend_printf("%s: Module shutdown\n",module->name); -#endif - module->module_shutdown_func(module->type, module->module_number); - } - module->module_started=0; - if (module->functions) { - zend_unregister_functions(module->functions, -1, NULL); - } - -#if HAVE_LIBDL - if (module->handle) { - dlclose(module->handle); - } -#endif -} - - -/* call request startup for all modules */ -int module_registry_request_startup(zend_module_entry *module) -{ - if (module->request_startup_func) { -#if 0 - zend_printf("%s: Request startup\n",module->name); -#endif - if (module->request_startup_func(module->type, module->module_number)==FAILURE) { - zend_error(E_WARNING, "request_startup() for %s module failed", module->name); - exit(1); - } - } - return 0; -} - - -/* for persistent modules - call request shutdown and flag NOT to erase - * for temporary modules - do nothing, and flag to erase - */ -int module_registry_cleanup(zend_module_entry *module) -{ - switch(module->type) { - case MODULE_PERSISTENT: - if (module->request_shutdown_func) { -#if 0 - zend_printf("%s: Request shutdown\n",module->name); -#endif - module->request_shutdown_func(module->type, module->module_number); - } - return 0; - break; - case MODULE_TEMPORARY: - return 1; - break; - } - return 0; -} - - -/* return the next free module number */ -int zend_next_free_module(void) -{ - return ++module_count; -} - - -ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry) -{ - zend_class_entry *register_class; - char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length); - CLS_FETCH(); - - zend_str_tolower(lowercase_name, class_entry->name_length); - - class_entry->type = ZEND_INTERNAL_CLASS; - class_entry->parent = NULL; - class_entry->refcount = (int *) malloc(sizeof(int)); - *class_entry->refcount = 1; - class_entry->constants_updated = 0; - zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1); - zend_hash_init(&class_entry->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1); - - zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, class_entry, sizeof(zend_class_entry), (void **) ®ister_class); - free(lowercase_name); - - if (class_entry->builtin_functions) { - zend_register_functions(class_entry->builtin_functions, &class_entry->function_table); - } - return register_class; -} - - -ZEND_API zend_module_entry *zend_get_module(int module_number) -{ - zend_module_entry *module; - - if (zend_hash_index_find(&module_registry, module_number, (void **) &module)==SUCCESS) { - return module; - } else { - return NULL; - } -} - -ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, - int is_ref, int num_symbol_tables, ...) -{ - HashTable *symbol_table; - va_list symbol_table_list; - - if (num_symbol_tables <= 0) return FAILURE; - - symbol->is_ref = is_ref; - - va_start(symbol_table_list, num_symbol_tables); - while(num_symbol_tables-- > 0) { - symbol_table = va_arg(symbol_table_list, HashTable *); - zend_hash_update_ptr(symbol_table, name, name_length + 1, symbol, sizeof(zval *), NULL); - zval_add_ref(&symbol); - } - va_end(symbol_table_list); - return SUCCESS; -} diff --git a/Zend/zend_API.h b/Zend/zend_API.h deleted file mode 100644 index c5d7460600..0000000000 --- a/Zend/zend_API.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_API_H -#define _ZEND_API_H - -#include "modules.h" -#include "zend_list.h" - - -#define ZEND_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS) -#define ZEND_FUNCTION(name) ZEND_NAMED_FUNCTION(zend_if_##name) - -#define ZEND_NAMED_FE(runtime_name, name, arg_types) { #runtime_name, name, arg_types }, -#define ZEND_FE(name, arg_types) ZEND_NAMED_FE(name, zend_if_##name, arg_types) - - -#define INIT_CLASS_ENTRY(class_container, class_name, functions) \ - { \ - class_container.name = strdup(class_name); \ - class_container.name_length = sizeof(class_name)-1; \ - class_container.builtin_functions = functions; \ - class_container.handle_function_call = NULL; \ - class_container.handle_property_get = NULL; \ - class_container.handle_property_set = NULL; \ - } - -#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \ - { \ - class_container.name = strdup(class_name); \ - class_container.name_length = sizeof(class_name)-1; \ - class_container.builtin_functions = functions; \ - class_container.handle_function_call = handle_fcall; \ - class_container.handle_property_get = handle_propget; \ - class_container.handle_property_set = handle_propset; \ - } - - - -int zend_next_free_module(void); - -ZEND_API int getParameters(int ht, int param_count,...); -ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array); -ZEND_API int getParametersEx(int param_count,...); -ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array); - -ZEND_API int ParameterPassedByReference(int ht, uint n); - -int zend_register_functions(zend_function_entry *functions, HashTable *function_table); -void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table); -ZEND_API int zend_register_module(zend_module_entry *module_entry); -ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry); -ZEND_API zend_module_entry *zend_get_module(int module_number); - -ZEND_API void wrong_param_count(void); - -#define getThis() (this_ptr) - -#define WRONG_PARAM_COUNT { wrong_param_count(); return; } -#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; } -#define ARG_COUNT(ht) (ht) - -#define BYREF_NONE 0 -#define BYREF_FORCE 1 -#define BYREF_ALLOW 2 -#define BYREF_FORCE_REST 3 - -#if !(WIN32||WINNT) -#define DLEXPORT -#endif - -int zend_startup_module(zend_module_entry *module); - -ZEND_API int array_init(zval *arg); -ZEND_API int object_init(zval *arg); -ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce); - -/* no longer supported */ -ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); - -ZEND_API int add_assoc_long(zval *arg, char *key, long n); -ZEND_API int add_assoc_bool(zval *arg, char *key, int b); -ZEND_API int add_assoc_resource(zval *arg, char *key, int r); -ZEND_API int add_assoc_double(zval *arg, char *key, double d); -ZEND_API int add_assoc_string(zval *arg, char *key, char *str, int duplicate); -ZEND_API int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate); - -ZEND_API int add_index_long(zval *arg, uint idx, long n); -ZEND_API int add_index_bool(zval *arg, uint idx, int b); -ZEND_API int add_index_resource(zval *arg, uint idx, int r); -ZEND_API int add_index_double(zval *arg, uint idx, double d); -ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate); -ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate); - -ZEND_API int add_next_index_long(zval *arg, long n); -ZEND_API int add_next_index_bool(zval *arg, int b); -ZEND_API int add_next_index_resource(zval *arg, int r); -ZEND_API int add_next_index_double(zval *arg, double d); -ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate); -ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate); - -ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest); -ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest); -ZEND_API int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate); -ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate); -ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate); - -ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[]); -ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval **params[], int no_separation); - -ZEND_API int add_property_long(zval *arg, char *key, long l); -ZEND_API int add_property_resource(zval *arg, char *key, long r); -ZEND_API int add_property_double(zval *arg, char *key, double d); -ZEND_API int add_property_string(zval *arg, char *key, char *str, int duplicate); -ZEND_API int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate); - -ZEND_API int zend_set_hash_symbol(zval *symbol, char *name, int name_length, - int is_ref, int num_symbol_tables, ...); - -#define add_method(arg,key,method) add_assoc_function((arg),(key),(method)) - -#define RETVAL_RESOURCE(l) { \ - return_value->type = IS_RESOURCE;\ - return_value->value.lval = l; \ - } -#define RETVAL_LONG(l) { \ - return_value->type = IS_LONG; \ - return_value->value.lval = l; \ - } -#define RETVAL_DOUBLE(d) { \ - return_value->type = IS_DOUBLE; \ - return_value->value.dval = d; \ - } -#define RETVAL_STRING(s,duplicate) { \ - char *__s=(s); \ - return_value->value.str.len = strlen(__s); \ - return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \ - return_value->type = IS_STRING; \ - } -#define RETVAL_STRINGL(s,l,duplicate) { \ - char *__s=(s); int __l=l; \ - return_value->value.str.len = __l; \ - return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \ - return_value->type = IS_STRING; \ - } - -#define RETVAL_FALSE { return_value->value.lval = 0; return_value->type = IS_BOOL; } -#define RETVAL_TRUE { return_value->value.lval = 1; return_value->type = IS_BOOL; } - -#define RETURN_RESOURCE(l) { \ - return_value->type = IS_RESOURCE;\ - return_value->value.lval = l; \ - return; \ - } -#define RETURN_LONG(l) { \ - return_value->type = IS_LONG; \ - return_value->value.lval = l; \ - return; \ - } -#define RETURN_DOUBLE(d) { \ - return_value->type = IS_DOUBLE; \ - return_value->value.dval = d; \ - return; \ - } -#define RETURN_STRING(s,duplicate) { \ - char *__s=(s); \ - return_value->value.str.len = strlen(__s); \ - return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \ - return_value->type = IS_STRING; \ - return; \ - } -#define RETURN_STRINGL(s,l,duplicate) { \ - char *__s=(s); int __l=l; \ - return_value->value.str.len = __l; \ - return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \ - return_value->type = IS_STRING; \ - return; \ - } - -#define RETURN_FALSE { RETVAL_FALSE; return; } -#define RETURN_TRUE { RETVAL_TRUE; return; } - -#define SET_VAR_STRING(n,v) { \ - { \ - zval *var = (zval *) emalloc(sizeof(zval)); \ - char *str=(v); /* prevent 'v' from being evaluated more than once */ \ - \ - var->value.str.val = (str); \ - var->value.str.len = strlen((str)); \ - var->type = IS_STRING; \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_STRINGL(n,v,l) { \ - { \ - zval *var = (zval *) emalloc(sizeof(zval)); \ - \ - var->value.str.val = (v); \ - var->value.str.len = (l); \ - var->type = IS_STRING; \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_LONG(n,v) { \ - { \ - zval *var = (zval *) emalloc(sizeof(zval)); \ - \ - var->value.lval = (v); \ - var->type = IS_LONG; \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - -#define SET_VAR_DOUBLE(n,v) { \ - { \ - zval *var = (zval *) emalloc(sizeof(zval)); \ - \ - var->value.dval = (v); \ - var->type = IS_DOUBLE; \ - ZEND_SET_GLOBAL_VAR(n, var); \ - } \ - } - - -#define ZEND_SET_SYMBOL(symtable, name, var) \ - { \ - char *_name = (name); \ - \ - ZEND_SET_SYMBOL_WITH_LENGTH(symtable, _name, strlen(_name)+1, var, 1, 0); \ - } - -#define ZEND_SET_SYMBOL_WITH_LENGTH(symtable, name, name_length, var, _refcount, _is_ref) \ - { \ - zval **orig_var; \ - \ - if (zend_hash_find(symtable, (name), (name_length), (void **) &orig_var)==SUCCESS \ - && PZVAL_IS_REF(*orig_var)) { \ - (var)->refcount = (*orig_var)->refcount; \ - (var)->is_ref = 1; \ - \ - if (_refcount) { \ - (var)->refcount += _refcount-1; \ - } \ - zval_dtor(*orig_var); \ - **orig_var = *(var); \ - efree(var); \ - } else { \ - (var)->is_ref = _is_ref; \ - if (_refcount) { \ - (var)->refcount = _refcount; \ - } \ - zend_hash_update(symtable, (name), (name_length), &(var), sizeof(zval *), NULL); \ - } \ - } - - -#define ZEND_SET_GLOBAL_VAR(name, var) \ - ZEND_SET_SYMBOL(&EG(symbol_table), name, var) - -#define ZEND_SET_GLOBAL_VAR_WITH_LENGTH(name, name_length, var, _refcount, _is_ref) \ - ZEND_SET_SYMBOL_WITH_LENGTH(&EG(symbol_table), name, name_length, var, _refcount, _is_ref) - -#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? (p)->value.obj.properties : NULL))) - -#endif /* _ZEND_API_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c deleted file mode 100644 index ed1a7b9f48..0000000000 --- a/Zend/zend_alloc.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include - -#include "zend.h" -#include "zend_alloc.h" -#include "zend_globals.h" -#ifdef HAVE_SIGNAL_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif - -#ifndef ZTS -static zend_alloc_globals alloc_globals; -#endif - - -#define ZEND_DISABLE_MEMORY_CACHE 0 - - -#if ZEND_DEBUG -# define END_MAGIC_SIZE sizeof(long) -# define END_ALIGNMENT(size) (((size)%PLATFORM_ALIGNMENT)?(PLATFORM_ALIGNMENT-((size)%PLATFORM_ALIGNMENT)):0) -#else -# define END_MAGIC_SIZE 0 -# define END_ALIGNMENT(size) 0 -#endif - - -# if MEMORY_LIMIT -# if ZEND_DEBUG -#define CHECK_MEMORY_LIMIT(s) _CHECK_MEMORY_LIMIT(s, __zend_filename, __zend_lineno) -# else -#define CHECK_MEMORY_LIMIT(s) _CHECK_MEMORY_LIMIT(s,NULL,0) -# endif - -#define _CHECK_MEMORY_LIMIT(s,file,lineno) { AG(allocated_memory) += (s);\ - if (AG(memory_limit)persistent && p==AG(head)) { \ - AG(head) = p->pNext; \ - } else if (p->persistent && p==AG(phead)) { \ - AG(phead) = p->pNext; \ - } else { \ - p->pLast->pNext = p->pNext; \ - } \ - if (p->pNext) { \ - p->pNext->pLast = p->pLast; \ - } - -#define ADD_POINTER_TO_LIST(p) \ - if (p->persistent) { \ - p->pNext = AG(phead); \ - if (AG(phead)) { \ - AG(phead)->pLast = p; \ - } \ - AG(phead) = p; \ - } else { \ - p->pNext = AG(head); \ - if (AG(head)) { \ - AG(head)->pLast = p; \ - } \ - AG(head) = p; \ - } \ - p->pLast = (mem_header *) NULL; - - - -ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p; - ALS_FETCH(); - - HANDLE_BLOCK_INTERRUPTIONS(); - - if (!ZEND_DISABLE_MEMORY_CACHE && (size < MAX_CACHED_MEMORY) && (AG(cache_count)[size] > 0)) { - p = AG(cache)[size][--AG(cache_count)[size]]; -#if ZEND_DEBUG - p->filename = __zend_filename; - p->lineno = __zend_lineno; - p->orig_filename = __zend_orig_filename; - p->orig_lineno = __zend_orig_lineno; - p->magic = MEM_BLOCK_START_MAGIC; - p->reported = 0; -#endif - HANDLE_UNBLOCK_INTERRUPTIONS(); - p->persistent = 0; - p->cached = 0; - return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING); - } else { - p = (mem_header *) malloc(sizeof(mem_header) + size + PLATFORM_PADDING + END_ALIGNMENT(size) + END_MAGIC_SIZE); - } - - if (!p) { - fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size); -#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID) - kill(getpid(), SIGSEGV); -#else - exit(1); -#endif - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *)p; - } - p->persistent = p->cached = 0; - ADD_POINTER_TO_LIST(p); - p->size = size; -#if ZEND_DEBUG - p->filename = __zend_filename; - p->lineno = __zend_lineno; - p->orig_filename = __zend_orig_filename; - p->orig_lineno = __zend_orig_lineno; - p->magic = MEM_BLOCK_START_MAGIC; - p->reported = 0; - *((long *)(((char *) p) + sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size))) = MEM_BLOCK_END_MAGIC; -#endif -#if MEMORY_LIMIT - CHECK_MEMORY_LIMIT(size); -#endif - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING); -} - - -ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING); - ALS_FETCH(); - -#if ZEND_DEBUG - if (!_mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) { - return; - } - memset(ptr, 0x5a, p->size); -#endif - - if (!ZEND_DISABLE_MEMORY_CACHE - && !p->persistent && (p->size < MAX_CACHED_MEMORY) && (AG(cache_count)[p->size] < MAX_CACHED_ENTRIES)) { - AG(cache)[p->size][AG(cache_count)[p->size]++] = p; - p->cached = 1; -#if ZEND_DEBUG - p->magic = MEM_BLOCK_CACHED_MAGIC; -#endif - return; - } - HANDLE_BLOCK_INTERRUPTIONS(); - REMOVE_POINTER_FROM_LIST(p); - -#if MEMORY_LIMIT - AG(allocated_memory) -= p->size; -#endif - - free(p); - HANDLE_UNBLOCK_INTERRUPTIONS(); -} - - -ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - void *p; - int final_size=size*nmemb; - - HANDLE_BLOCK_INTERRUPTIONS(); - p = _emalloc(final_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *) p; - } - memset(p,(int)NULL,final_size); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return p; -} - - -ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING); - mem_header *orig = p; - ALS_FETCH(); - - if (!ptr) { - return _emalloc(size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - HANDLE_BLOCK_INTERRUPTIONS(); - REMOVE_POINTER_FROM_LIST(p); - p = (mem_header *) realloc(p,sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size)+END_MAGIC_SIZE); - if (!p) { - if (!allow_failure) { - fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size); -#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID - kill(getpid(), SIGSEGV); -#else - exit(1); -#endif - } - ADD_POINTER_TO_LIST(orig); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *)NULL; - } - ADD_POINTER_TO_LIST(p); -#if ZEND_DEBUG - p->filename = __zend_filename; - p->lineno = __zend_lineno; - p->magic = MEM_BLOCK_START_MAGIC; - *((long *)(((char *) p) + sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size))) = MEM_BLOCK_END_MAGIC; -#endif -#if MEMORY_LIMIT - CHECK_MEMORY_LIMIT(size - p->size); -#endif - p->size = size; - - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (void *)((char *)p+sizeof(mem_header)+PLATFORM_PADDING); -} - - -ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - int length; - char *p; - - length = strlen(s)+1; - HANDLE_BLOCK_INTERRUPTIONS(); - p = (char *) _emalloc(length ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (char *)NULL; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - memcpy(p,s,length); - return p; -} - - -ZEND_API char *_estrndup(const char *s, uint length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - char *p; - - HANDLE_BLOCK_INTERRUPTIONS(); - p = (char *) _emalloc(length+1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - if (!p) { - HANDLE_UNBLOCK_INTERRUPTIONS(); - return (char *)NULL; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - memcpy(p,s,length); - p[length]=0; - return p; -} - - -ZEND_API char *zend_strndup(const char *s, uint length) -{ - char *p; - - p = (char *) malloc(length+1); - if (!p) { - return (char *)NULL; - } - if (length) { - memcpy(p,s,length); - } - p[length]=0; - return p; -} - - -ZEND_API int zend_set_memory_limit(unsigned int memory_limit) -{ -#if MEMORY_LIMIT - ALS_FETCH(); - - AG(memory_limit) = memory_limit; - return SUCCESS; -#else - return FAILURE; -#endif -} - - -ZEND_API void start_memory_manager(ALS_D) -{ - AG(phead) = AG(head) = NULL; - -#if MEMORY_LIMIT - AG(memory_limit)=1<<30; /* rediculous limit, effectively no limit */ - AG(allocated_memory)=0; - AG(memory_exhausted)=0; -#endif - - memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char)); -} - - -ZEND_API void shutdown_memory_manager(int silent, int clean_cache) -{ - mem_header *p, *t; -#if ZEND_DEBUG - int had_leaks=0; -#endif - ALS_FETCH(); - - p=AG(head); - t=AG(head); - while (t) { - if (!t->cached || clean_cache) { -#if ZEND_DEBUG - if (!t->cached && !t->reported) { - mem_header *iterator; - int total_leak=0, total_leak_count=0; - - had_leaks=1; - if (!silent) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t); - } - t->reported = 1; - for (iterator=t->pNext; iterator; iterator=iterator->pNext) { - if (!iterator->cached - && iterator->filename==t->filename - && iterator->lineno==t->lineno) { - total_leak += iterator->size; - total_leak_count++; - iterator->reported = 1; - } - } - if (!silent && total_leak_count>0) { - zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count)); - } - } -#endif - p = t->pNext; - REMOVE_POINTER_FROM_LIST(t); - free(t); - t = p; - } else { - t = t->pNext; - } - } -} - - -#if ZEND_DEBUG -void zend_debug_alloc_output(char *format, ...) -{ - char output_buf[256]; - va_list args; - - va_start(args, format); - vsprintf(output_buf, format, args); - va_end(args); - -#if WIN32||WINNT - OutputDebugString(output_buf); -#else - fprintf(stderr, output_buf); -#endif -} - - -ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING); - int no_cache_notice=0; - int valid_beginning=1; - int had_problems=0; - - if (silent==2) { - silent=1; - no_cache_notice=1; - } - if (silent==3) { - silent=0; - no_cache_notice=1; - } - if (!silent) { - zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL); - zend_debug_alloc_output("---------------------------------------\n"); - zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n" ZEND_FILE_LINE_RELAY_CC, (long) p); - if (__zend_orig_filename) { - zend_debug_alloc_output("%s(%d) : Actual location (location was relayed)\n" ZEND_FILE_LINE_ORIG_RELAY_CC); - } - zend_debug_alloc_output("%10s\t","Beginning: "); - } - - switch (p->magic) { - case MEM_BLOCK_START_MAGIC: - if (!silent) { - zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size); - } - break; /* ok */ - case MEM_BLOCK_FREED_MAGIC: - if (!silent) { - zend_debug_alloc_output("Freed\n"); - had_problems=1; - } else { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - break; - case MEM_BLOCK_CACHED_MAGIC: - if (!silent) { - if (!no_cache_notice) { - zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size); - had_problems=1; - } - } else { - if (!no_cache_notice) { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - } - break; - default: - if (!silent) { - zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC); - } else { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - had_problems=1; - valid_beginning=0; - break; - } - - - if (valid_beginning - && *((long *)(((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING+END_ALIGNMENT(p->size))) != MEM_BLOCK_END_MAGIC) { - long magic_num = MEM_BLOCK_END_MAGIC; - char *overflow_ptr, *magic_ptr=(char *) &magic_num; - int overflows=0; - int i; - - if (silent) { - return _mem_block_check(ptr, 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); - } - had_problems=1; - overflow_ptr = ((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING; - - for (i=0; isize+PLATFORM_PADDING+END_ALIGNMENT(p->size))), MEM_BLOCK_END_MAGIC); - zend_debug_alloc_output("%10s\t",""); - if (overflows>=sizeof(long)) { - zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long)); - } else { - zend_debug_alloc_output("%d byte(s) overflown\n", overflows); - } - } else if (!silent) { - zend_debug_alloc_output("%10s\t", "End:"); - if (valid_beginning) { - zend_debug_alloc_output("OK\n"); - } else { - zend_debug_alloc_output("Unknown\n"); - } - } - - if (had_problems) { - int foo = 5; - - foo+=1; - } - - if (!silent) { - zend_debug_alloc_output("---------------------------------------\n"); - } - return ((!had_problems) ? 1 : 0); -} - - -ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p; - int errors=0; - ALS_FETCH(); - - p = AG(head); - - - zend_debug_alloc_output("------------------------------------------------\n"); - zend_debug_alloc_output("Full Memory Check at %s:%d\n" ZEND_FILE_LINE_RELAY_CC); - - while (p) { - if (!_mem_block_check((void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING), (silent?2:3) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC)) { - errors++; - } - p = p->pNext; - } - zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n" ZEND_FILE_LINE_RELAY_CC, errors); - zend_debug_alloc_output("------------------------------------------------\n"); -} -#endif - - -ZEND_API void _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) -{ - mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING); - ALS_FETCH(); - -#if ZEND_DEBUG - _mem_block_check(ptr, 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); -#endif - - HANDLE_BLOCK_INTERRUPTIONS(); - - /* remove the block from the non persistent list */ - REMOVE_POINTER_FROM_LIST(p); - - p->persistent = 1; - - /* add the block to the persistent list */ - ADD_POINTER_TO_LIST(p); - HANDLE_UNBLOCK_INTERRUPTIONS(); -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h deleted file mode 100644 index ae31881675..0000000000 --- a/Zend/zend_alloc.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ALLOC_H -#define _ALLOC_H - -#include - -#include "zend_globals_macros.h" - -#define MEM_BLOCK_START_MAGIC 0x7312F8DCL -#define MEM_BLOCK_END_MAGIC 0x2A8FCC84L -#define MEM_BLOCK_FREED_MAGIC 0x99954317L -#define MEM_BLOCK_CACHED_MAGIC 0xFB8277DCL - -typedef struct _mem_header { -#if ZEND_DEBUG - long magic; - char *filename; - uint lineno; - int reported; - char *orig_filename; - uint orig_lineno; -#endif - struct _mem_header *pNext; - struct _mem_header *pLast; - unsigned int size:30; - unsigned int persistent:1; - unsigned int cached:1; -} mem_header; - -typedef union _align_test { - void *ptr; - double dbl; - long lng; -} align_test; - -#define MAX_CACHED_MEMORY 64 -#define MAX_CACHED_ENTRIES 16 - -#define PLATFORM_ALIGNMENT (sizeof(align_test)) -#define PLATFORM_PADDING (((PLATFORM_ALIGNMENT-sizeof(mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT) - -ZEND_API char *zend_strndup(const char *s, unsigned int length); - -BEGIN_EXTERN_C() - -ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API char *_estrndup(const char *s, unsigned int length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void _persist_alloc(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); - -/* Standard wrapper macros */ -#define emalloc(size) _emalloc((size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define efree(ptr) _efree((ptr) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define ecalloc(nmemb,size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define erealloc(ptr,size) _erealloc((ptr), (size),0 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define erealloc_recoverable(ptr,size) _erealloc((ptr), (size),1 ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define estrndup(s,length) _estrndup((s), (length) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define persist_alloc(p) _persist_alloc((p) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) - -/* Relay wrapper macros */ -#define emalloc_rel(size) _emalloc((size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define efree_rel(ptr) _efree((ptr) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define ecalloc_rel(nmemb, size) _ecalloc((nmemb), (size) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define erealloc_rel(ptr, size) _erealloc((ptr), (size), 0 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define erealloc_recoverable_rel(ptr, size) _erealloc((ptr), (size), 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define estrdup_rel(s) _estrdup((s) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define estrndup_rel(s, length) _estrndup((s), (length) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) -#define persist_alloc_rel(p) _persist_alloc((p) ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC) - -/* Selective persistent/non persistent allocation macros */ -#define pemalloc(size,persistent) ((persistent)?malloc(size):emalloc(size)) -#define pefree(ptr,persistent) ((persistent)?free(ptr):efree(ptr)) -#define pecalloc(nmemb,size,persistent) ((persistent)?calloc((nmemb),(size)):ecalloc((nmemb),(size))) -#define perealloc(ptr,size,persistent) ((persistent)?realloc((ptr),(size)):erealloc((ptr),(size))) -#define perealloc_recoverable(ptr,size,persistent) ((persistent)?realloc((ptr),(size)):erealloc_recoverable((ptr),(size))) -#define pestrdup(s,persistent) ((persistent)?strdup(s):estrdup(s)) - -#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string)) -#define safe_estrndup(ptr,len) ((ptr)?(estrndup((ptr),(len))):(empty_string)) - -ZEND_API int zend_set_memory_limit(unsigned int memory_limit); - -ZEND_API void start_memory_manager(ALS_D); -ZEND_API void shutdown_memory_manager(int silent, int clean_cache); - -#if ZEND_DEBUG -ZEND_API int _mem_block_check(void *ptr, int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -ZEND_API void _full_mem_check(int silent ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC); -void zend_debug_alloc_output(char *format, ...); -#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#define full_mem_check(silent) _full_mem_check(silent ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC) -#else -#define mem_block_check(type, ptr, silent) -#define full_mem_check(silent) -#endif - - -END_EXTERN_C() - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c deleted file mode 100644 index 4e70e460a2..0000000000 --- a/Zend/zend_builtin_functions.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_API.h" -#include "zend_builtin_functions.h" -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_constants.h" - -static ZEND_FUNCTION(zend_version); -static ZEND_FUNCTION(func_num_args); -static ZEND_FUNCTION(func_get_arg); -static ZEND_FUNCTION(func_get_args); -static ZEND_FUNCTION(strlen); -static ZEND_FUNCTION(strcmp); -static ZEND_FUNCTION(strcasecmp); -static ZEND_FUNCTION(each); -static ZEND_FUNCTION(error_reporting); -static ZEND_FUNCTION(define); -static ZEND_FUNCTION(defined); -static ZEND_FUNCTION(get_class); -static ZEND_FUNCTION(get_parent_class); -static ZEND_FUNCTION(method_exists); -static ZEND_FUNCTION(leak); -static ZEND_FUNCTION(get_used_files); -static ZEND_FUNCTION(get_imported_files); - -extern unsigned char first_arg_force_ref[]; - -static zend_function_entry builtin_functions[] = { - ZEND_FE(zend_version, NULL) - ZEND_FE(func_num_args, NULL) - ZEND_FE(func_get_arg, NULL) - ZEND_FE(func_get_args, NULL) - ZEND_FE(strlen, NULL) - ZEND_FE(strcmp, NULL) - ZEND_FE(strcasecmp, NULL) - ZEND_FE(each, first_arg_force_ref) - ZEND_FE(error_reporting, NULL) - ZEND_FE(define, NULL) - ZEND_FE(defined, NULL) - ZEND_FE(get_class, NULL) - ZEND_FE(get_parent_class, NULL) - ZEND_FE(method_exists, NULL) - ZEND_FE(leak, NULL) - ZEND_FE(get_used_files, NULL) - ZEND_FE(get_imported_files, NULL) - { NULL, NULL, NULL } -}; - - -int zend_startup_builtin_functions() -{ - return zend_register_functions(builtin_functions, NULL); -} - - -ZEND_FUNCTION(zend_version) -{ - RETURN_STRINGL(ZEND_VERSION, sizeof(ZEND_VERSION)-1, 1); -} - - -ZEND_FUNCTION(func_num_args) -{ - void **p; - int arg_count; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */ - - p = EG(argument_stack).top_element-1-arg_count-1; - if (p>=EG(argument_stack).elements) { - RETURN_LONG((ulong) *p); - } else { - zend_error(E_WARNING, "func_num_args(): Called from the global scope - no function context"); - RETURN_LONG(-1); - } -} - - -ZEND_FUNCTION(func_get_arg) -{ - void **p; - int arg_count; - zval **z_requested_offset; - zval *arg; - long requested_offset; - ELS_FETCH(); - - if (ARG_COUNT(ht)!=1 || getParametersEx(1, &z_requested_offset)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(z_requested_offset); - requested_offset = (*z_requested_offset)->value.lval; - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */ - - p = EG(argument_stack).top_element-1-arg_count-1; - if (parg_count) { - zend_error(E_WARNING, "func_get_arg(): Only %d arguments passed to function (argument %d requested)", arg_count, requested_offset); - RETURN_FALSE; - } - - arg = *(p-(arg_count-requested_offset)); - *return_value = *arg; - zval_copy_ctor(return_value); -} - - -ZEND_FUNCTION(func_get_args) -{ - void **p; - int arg_count; - int i; - ELS_FETCH(); - - p = EG(argument_stack).top_element-1; - arg_count = (ulong) *p; /* this is the amount of arguments passed to func_num_args(); */ - - p = EG(argument_stack).top_element-1-arg_count-1; - if (pvalue.ht, &element, sizeof(zval *), NULL); - } -} - - -/* {{{ proto int strlen(string str) - Get string length */ -ZEND_FUNCTION(strlen) -{ - zval **str; - - if (ARG_COUNT(ht) != 1 || getParametersEx(1, &str) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(str); - RETVAL_LONG((*str)->value.str.len); -} -/* }}} */ - -/* {{{ proto int strcmp(string str1, string str2) - Binary safe string comparison */ -ZEND_FUNCTION(strcmp) -{ - zval **s1, **s2; - - if (ARG_COUNT(ht) != 2 || getParametersEx(2, &s1, &s2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - RETURN_LONG(zend_binary_strcmp(*s1,*s2)); -} -/* }}} */ - -/* {{{ proto int strcasecmp(string str1, string str2) - Binary safe case-insensitive string comparison */ -ZEND_FUNCTION(strcasecmp) -{ - zval **s1, **s2; - - if (ARG_COUNT(ht)!=2 || getParametersEx(2, &s1, &s2) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(s1); - convert_to_string_ex(s2); - RETURN_LONG(zend_binary_strcasecmp(*s1, *s2)); -} -/* }}} */ - -ZEND_FUNCTION(each) -{ - zval **array,*entry,**entry_ptr, *tmp; - char *string_key; - ulong num_key; - zval **inserted_pointer; - HashTable *target_hash; - - if (ARG_COUNT(ht) != 1 || getParametersEx(1, &array) == FAILURE) { - WRONG_PARAM_COUNT; - } - target_hash = HASH_OF(*array); - if (!target_hash) { - zend_error(E_WARNING,"Variable passed to each() is not an array or object"); - return; - } - if (zend_hash_get_current_data(target_hash, (void **) &entry_ptr)==FAILURE) { - RETURN_FALSE; - } - array_init(return_value); - entry = *entry_ptr; - - /* add value elements */ - if (entry->is_ref) { - tmp = (zval *)emalloc(sizeof(zval)); - *tmp = *entry; - zval_copy_ctor(tmp); - tmp->is_ref=0; - tmp->refcount=0; - entry=tmp; - } - zend_hash_index_update(return_value->value.ht, 1, &entry, sizeof(zval *), NULL); - entry->refcount++; - zend_hash_update_ptr(return_value->value.ht, "value", sizeof("value"), entry, sizeof(zval *), NULL); - entry->refcount++; - - /* add the key elements */ - switch (zend_hash_get_current_key(target_hash, &string_key, &num_key)) { - case HASH_KEY_IS_STRING: - add_get_index_string(return_value,0,string_key,(void **) &inserted_pointer,0); - break; - case HASH_KEY_IS_LONG: - add_get_index_long(return_value,0,num_key, (void **) &inserted_pointer); - break; - } - zend_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(zval *), NULL); - (*inserted_pointer)->refcount++; - zend_hash_move_forward(target_hash); -} - -ZEND_FUNCTION(error_reporting) -{ - zval **arg; - int old_error_reporting; - ELS_FETCH(); - - old_error_reporting = EG(error_reporting); - switch (ARG_COUNT(ht)) { - case 0: - break; - case 1: - if (getParametersEx(1,&arg) == FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(arg); - EG(error_reporting)=(*arg)->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - RETVAL_LONG(old_error_reporting); -} - -ZEND_FUNCTION(define) -{ - zval **var, **val, **non_cs; - int case_sensitive; - zend_constant c; - ELS_FETCH(); - - switch(ARG_COUNT(ht)) { - case 2: - if (getParametersEx(2, &var, &val)==FAILURE) { - RETURN_FALSE; - } - case_sensitive = CONST_CS; - break; - case 3: - if (getParametersEx(3, &var, &val, &non_cs)==FAILURE) { - RETURN_FALSE; - } - convert_to_long_ex(non_cs); - if ((*non_cs)->value.lval) { - case_sensitive = 0; - } else { - case_sensitive = CONST_CS; - } - break; - default: - WRONG_PARAM_COUNT; - break; - } - switch((*val)->type) { - case IS_LONG: - case IS_DOUBLE: - case IS_STRING: - case IS_BOOL: - case IS_RESOURCE: - break; - default: - zend_error(E_WARNING,"Constants may only evaluate to scalar values"); - RETURN_FALSE; - break; - } - convert_to_string_ex(var); - - c.value = **val; - zval_copy_ctor(&c.value); - c.flags = case_sensitive | ~CONST_PERSISTENT; /* non persistent */ - c.name = zend_strndup((*var)->value.str.val, (*var)->value.str.len); - c.name_len = (*var)->value.str.len+1; - zend_register_constant(&c ELS_CC); - RETURN_TRUE; -} - - -ZEND_FUNCTION(defined) -{ - zval **var; - zval c; - - if (ARG_COUNT(ht)!=1 || getParametersEx(1, &var)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(var); - if (zend_get_constant((*var)->value.str.val, (*var)->value.str.len, &c)) { - zval_dtor(&c); - RETURN_LONG(1); - } else { - RETURN_LONG(0); - } -} - -/* {{{ proto string get_class(object object) - Retrieves the class name ... -*/ -ZEND_FUNCTION(get_class) -{ - zval **arg; - - if (ARG_COUNT(ht)!=1 || getParametersEx(1, &arg)==FAILURE) { - RETURN_FALSE; - } - if ((*arg)->type != IS_OBJECT) { - RETURN_FALSE; - } - RETURN_STRINGL((*arg)->value.obj.ce->name, (*arg)->value.obj.ce->name_length, 1); -} -/* }}} */ - -/* {{{ proto string get_parent_class(object object) - Retrieves the parent class name ... -*/ -ZEND_FUNCTION(get_parent_class) -{ - zval **arg; - - if (ARG_COUNT(ht)!=1 || getParametersEx(1, &arg)==FAILURE) { - RETURN_FALSE; - } - if (((*arg)->type != IS_OBJECT) || !(*arg)->value.obj.ce->parent) { - RETURN_FALSE; - } - RETURN_STRINGL((*arg)->value.obj.ce->parent->name, (*arg)->value.obj.ce->parent->name_length, 1); -} -/* }}} */ - -/* {{{ proto bool method_exists(object object, string method) - Checks if the class method exists ... -*/ -ZEND_FUNCTION(method_exists) -{ - zval **arg1, **arg2; - - if (ARG_COUNT(ht)!=2 || getParametersEx(2, &arg1, &arg2)==FAILURE) { - RETURN_FALSE; - } - if ((*arg1)->type != IS_OBJECT) { - RETURN_FALSE; - } - convert_to_string_ex(arg2); - if(zend_hash_exists(&(*arg1)->value.obj.ce->function_table, (*arg2)->value.str.val, (*arg2)->value.str.len+1)) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} -/* }}} */ - -ZEND_FUNCTION(leak) -{ - int leakbytes=3; - zval **leak; - - if (ARG_COUNT(ht)>=1) { - if (getParametersEx(1, &leak)==SUCCESS) { - convert_to_long_ex(leak); - leakbytes = (*leak)->value.lval; - } - } - - emalloc(leakbytes); -} - - -static int copy_import_use_file(zend_file_handle *fh, zval *array) -{ - if (fh->filename) { - char *extension_start; - - extension_start = strstr(fh->filename, zend_uv.import_use_extension); - if (extension_start) { - *extension_start = 0; - if (fh->opened_path) { - add_assoc_string(array, fh->filename, fh->opened_path, 1); - } else { - add_assoc_stringl(array, fh->filename, "N/A", sizeof("N/A")-1, 1); - } - *extension_start = zend_uv.import_use_extension[0]; - } - } - return 0; -} - - -ZEND_FUNCTION(get_used_files) -{ - CLS_FETCH(); - - array_init(return_value); - zend_hash_apply_with_argument(&CG(used_files), (int (*)(void *, void *)) copy_import_use_file, return_value); -} - - -ZEND_FUNCTION(get_imported_files) -{ - ELS_FETCH(); - - array_init(return_value); - zend_hash_apply_with_argument(&EG(imported_files), (int (*)(void *, void *)) copy_import_use_file, return_value); -} diff --git a/Zend/zend_builtin_functions.h b/Zend/zend_builtin_functions.h deleted file mode 100644 index fa3f529463..0000000000 --- a/Zend/zend_builtin_functions.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_BUILTIN_FUNCTIONS_H -#define _ZEND_BUILTIN_FUNCTIONS_H - -int zend_startup_builtin_functions(void); - -#endif /* _ZEND_BUILTIN_FUNCTIONS_H */ diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c deleted file mode 100644 index b56bd50f13..0000000000 --- a/Zend/zend_compile.c +++ /dev/null @@ -1,2173 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend-parser.h" -#include "zend.h" -#include "zend_compile.h" -#include "zend_llist.h" -#include "zend_API.h" -#include "zend_variables.h" -#include "zend_operators.h" - - -ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); - - -#ifndef ZTS -ZEND_API zend_compiler_globals compiler_globals; -ZEND_API zend_executor_globals executor_globals; -#endif - - -#define SET_UNUSED(op) (op).op_type = IS_UNUSED - -static int is_not_internal_function(zend_function *function) -{ - return(function->type != ZEND_INTERNAL_FUNCTION); -} - - -static int is_not_internal_class(zend_class_entry *ce) -{ - return(ce->type != ZEND_INTERNAL_CLASS); -} - - -static void free_filename(void *p) -{ - efree(*((char **) p)); -} - - -static void build_runtime_defined_function_key(zval *result, zval *name, zend_op *opline) -{ - char lineno_buf[32]; - uint lineno_len; - char *filename; - - lineno_len = zend_sprintf(lineno_buf, "%d", opline->lineno); - if (opline->filename) { - filename = opline->filename; - } else { - filename = "-"; - } - - /* NULL, name length, filename length, line number length */ - result->value.str.len = 1+name->value.str.len+strlen(filename)+lineno_len+1; - result->value.str.val = (char *) emalloc(result->value.str.len+1); - sprintf(result->value.str.val, "%c%s%s%s", '\0', name->value.str.val, filename, lineno_buf); - result->type = IS_STRING; - result->refcount = 1; -} - - -static int zend_open_file_dtor_wrapper(zend_file_handle *fh) -{ - zend_open_file_dtor(fh); - return 1; -} - - -void init_compiler(CLS_D ELS_DC) -{ - zend_stack_init(&CG(bp_stack)); - zend_stack_init(&CG(function_call_stack)); - zend_stack_init(&CG(switch_cond_stack)); - zend_stack_init(&CG(foreach_copy_stack)); - zend_stack_init(&CG(object_stack)); - CG(active_class_entry) = NULL; - zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0); - zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0); - zend_llist_init(&CG(filenames_list), sizeof(char *), free_filename, 0); - CG(short_tags) = ZEND_UV(short_tags); - CG(asp_tags) = ZEND_UV(asp_tags); - CG(handle_op_arrays) = 1; - zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_request_startup); - init_resource_list(ELS_C); - CG(unclean_shutdown) = 0; - zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) zend_open_file_dtor, 0); - zend_hash_init(&CG(used_files), 5, NULL, (int (*)(void *)) zend_open_file_dtor_wrapper, 0); -} - - -void shutdown_compiler(CLS_D) -{ - zend_stack_destroy(&CG(bp_stack)); - zend_stack_destroy(&CG(function_call_stack)); - zend_stack_destroy(&CG(switch_cond_stack)); - zend_stack_destroy(&CG(foreach_copy_stack)); - zend_stack_destroy(&CG(object_stack)); - zend_llist_destroy(&CG(filenames_list)); - zend_hash_apply(CG(function_table), (int (*)(void *)) is_not_internal_function); - zend_hash_apply(CG(class_table), (int (*)(void *)) is_not_internal_class); - zend_llist_destroy(&CG(open_files)); - zend_hash_destroy(&CG(used_files)); -} - - -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename) -{ - char *p = estrdup(new_compiled_filename); - CLS_FETCH(); - - zend_llist_add_element(&CG(filenames_list), &p); - CG(compiled_filename) = p; - return p; -} - - -ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename) -{ - CLS_FETCH(); - - CG(compiled_filename) = original_compiled_filename; -} - -ZEND_API char *zend_get_compiled_filename() -{ - CLS_FETCH(); - - return CG(compiled_filename); -} - - -static int get_temporary_variable(zend_op_array *op_array) -{ - return (op_array->T)++; -} - - -void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - opline->op2 = *op2; - *result = opline->result; -} - - -void do_unary_op(int op, znode *result, znode *op1 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - *result = opline->result; - SET_UNUSED(opline->op2); -} - - -void do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - opline->op2 = *op2; - *result = opline->result; -} - - - -void do_fetch_globals(znode *varname CLS_DC) -{ - if (!CG(active_op_array)->uses_globals - && varname->op_type == IS_CONST - && varname->u.constant.type == IS_STRING - && varname->u.constant.value.str.len == (sizeof("GLOBALS")-1) - && !memcmp(varname->u.constant.value.str.val, "GLOBALS", sizeof("GLOBALS")-1)) { - CG(active_op_array)->uses_globals = 1; - } -} - -void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op CLS_DC) -{ - zend_op opline; - zend_op *opline_ptr; - zend_llist *fetch_list_ptr; - - if (bp) { - opline_ptr = &opline; - init_op(opline_ptr CLS_CC); - } else { - opline_ptr = get_next_op(CG(active_op_array) CLS_CC); - } - - opline_ptr->opcode = op; - opline_ptr->result.op_type = IS_VAR; - opline_ptr->result.u.EA.type = 0; - opline_ptr->result.u.var = get_temporary_variable(CG(active_op_array)); - opline_ptr->op1 = *varname; - *result = opline_ptr->result; - SET_UNUSED(opline_ptr->op2); - opline_ptr->op2.u.fetch_type = ZEND_FETCH_LOCAL; - - if (bp) { - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - zend_llist_add_element(fetch_list_ptr, opline_ptr); - } -} - -void fetch_simple_variable(znode *result, znode *varname, int bp CLS_DC) -{ - /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ - fetch_simple_variable_ex(result, varname, bp, ZEND_FETCH_W CLS_CC); -} - - -void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC) -{ - fetch_simple_variable(result, varname, 1 CLS_CC); - - fetch_array_dim(result, result, first_dim CLS_CC); -} - - -void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC) -{ - zend_op opline; - zend_llist *fetch_list_ptr; - - init_op(&opline CLS_CC); - opline.opcode = ZEND_FETCH_DIM_W; /* the backpatching routine assumes W */ - opline.result.op_type = IS_VAR; - opline.result.u.EA.type = 0; - opline.result.u.var = get_temporary_variable(CG(active_op_array)); - opline.op1 = *parent; - opline.op2 = *dim; - opline.extended_value = ZEND_FETCH_STANDARD; - *result = opline.result; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - zend_llist_add_element(fetch_list_ptr, &opline); -} - - -void do_print(znode *result, znode *arg CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->opcode = ZEND_PRINT; - opline->op1 = *arg; - SET_UNUSED(opline->op2); - *result = opline->result; -} - - -void do_echo(znode *arg CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ECHO; - opline->op1 = *arg; - SET_UNUSED(opline->op2); -} - - -void do_assign(znode *result, znode *variable, znode *value CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ASSIGN; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *variable; - opline->op2 = *value; - *result = opline->result; -} - - -void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ASSIGN_REF; - if (result) { - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - } else { - SET_UNUSED(opline->result); - } - opline->op1 = *lvar; - opline->op2 = *rvar; -} - - -static inline void do_begin_loop(CLS_D) -{ - zend_brk_cont_element *brk_cont_element; - int parent; - - parent = CG(active_op_array)->current_brk_cont; - CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont; - brk_cont_element = get_next_brk_cont_element(CG(active_op_array)); - brk_cont_element->parent = parent; -} - - -static inline void do_end_loop(int cont_addr CLS_DC) -{ - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = cont_addr; - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent; -} - - -void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC) -{ - int while_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *expr; - close_bracket_token->u.opline_num = while_cond_op_number; - SET_UNUSED(opline->op2); - - do_begin_loop(CLS_C); - INC_BPC(CG(active_op_array)); -} - - -void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - /* add unconditional jump */ - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = while_token->u.opline_num; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - /* update while's conditional jmp */ - CG(active_op_array)->opcodes[close_bracket_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - - do_end_loop(while_token->u.opline_num CLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC) -{ - int for_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPZNZ; - opline->result = *expr; /* the conditional expression */ - second_semicolon_token->u.opline_num = for_cond_op_number; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = cond_start->u.opline_num; - CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - do_begin_loop(CLS_C); - - INC_BPC(CG(active_op_array)); -} - - -void do_for_end(znode *second_semicolon_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = second_semicolon_token->u.opline_num+1; - CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - do_end_loop(second_semicolon_token->u.opline_num+1 CLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void do_pre_incdec(znode *result, znode *op1, int op CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - *result = opline->result; - SET_UNUSED(opline->op2); -} - - -void do_post_incdec(znode *result, znode *op1, int op CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - *result = opline->result; - SET_UNUSED(opline->op2); -} - - -void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC) -{ - int if_cond_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *cond; - closing_bracket_token->u.opline_num = if_cond_op_number; - SET_UNUSED(opline->op2); - INC_BPC(CG(active_op_array)); -} - - -void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC) -{ - int if_end_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - zend_llist *jmp_list_ptr; - - opline->opcode = ZEND_JMP; - /* save for backpatching */ - if (initialize) { - zend_llist jmp_list; - - zend_llist_init(&jmp_list, sizeof(int), NULL, 0); - zend_stack_push(&CG(bp_stack), (void *) &jmp_list, sizeof(zend_llist)); - } - zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); - zend_llist_add_element(jmp_list_ptr, &if_end_op_number); - - CG(active_op_array)->opcodes[closing_bracket_token->u.opline_num].op2.u.opline_num = if_end_op_number+1; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_if_end(CLS_D) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_llist *jmp_list_ptr; - zend_llist_element *le; - - zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr); - for (le=jmp_list_ptr->head; le; le = le->next) { - CG(active_op_array)->opcodes[*((int *) le->data)].op1.u.opline_num = next_op_number; - } - zend_llist_destroy(jmp_list_ptr); - zend_stack_del_top(&CG(bp_stack)); - DEC_BPC(CG(active_op_array)); -} - - -void do_begin_variable_parse(CLS_D) -{ - zend_llist fetch_list; - - /* zend_llist_init(&fetch_list, sizeof(int), NULL, 0); - zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));*/ - zend_llist_init(&fetch_list, sizeof(zend_op), NULL, 0); - zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist)); -} - - -void do_end_variable_parse(int type, int arg_offset CLS_DC) -{ - zend_llist *fetch_list_ptr; - zend_llist_element *le; - zend_op *opline, *opline_ptr; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - - le = fetch_list_ptr->head; - - while (le) { - opline_ptr = (zend_op *)le->data; - opline = get_next_op(CG(active_op_array) CLS_CC); - memcpy(opline, opline_ptr, sizeof(zend_op)); - switch (type) { - case BP_VAR_R: - if (opline->opcode == ZEND_FETCH_DIM_W && opline->op2.op_type == IS_UNUSED) { - zend_error(E_COMPILE_ERROR, "Cannot use [] for reading"); - } - opline->opcode -= 3; - break; - case BP_VAR_W: - break; - case BP_VAR_RW: - opline->opcode += 3; - break; - case BP_VAR_IS: - opline->opcode += 6; /* 3+3 */ - break; - case BP_VAR_FUNC_ARG: - opline->opcode += 9; /* 3+3+3 */ - opline->extended_value = arg_offset; - break; - } - le = le->next; - } - zend_llist_destroy(fetch_list_ptr); - zend_stack_del_top(&CG(bp_stack)); -} - - -void do_init_string(znode *result CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ADD_CHAR; - opline->op1 = *op1; - opline->op2 = *op2; - opline->op2.op_type = IS_CONST; - opline->result = opline->op1; - *result = opline->result; -} - - -void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ADD_STRING; - opline->op1 = *op1; - opline->op2 = *op2; - opline->op2.op_type = IS_CONST; - opline->result = opline->op1; - *result = opline->result; -} - - -void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC) -{ - zend_op *opline; - - if (op1->op_type == IS_CONST) { - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_INIT_STRING; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - *result = opline->result; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - if (op1->u.constant.value.str.len>0) { - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_ADD_STRING; - opline->result = *result; - opline->op1 = *result; - opline->op2 = *op1; - opline->result = opline->op1; - } else { - zval_dtor(&op1->u.constant); - } - } else { - *result = *op1; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_ADD_VAR; - opline->result = *result; - opline->op1 = *result; - opline->op2 = *op2; - *result = opline->result; -} - - -void do_free(znode *op1 CLS_DC) -{ - if (op1->op_type==IS_TMP_VAR) { - zend_op *last_opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - if ((last_opline->opcode == ZEND_DO_FCALL) || (last_opline->opcode == ZEND_DO_FCALL_BY_NAME)) { - last_opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } else { - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_FREE; - opline->op1 = *op1; - SET_UNUSED(opline->op2); - } - } else if (op1->op_type==IS_VAR) { - zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - if (opline->result.op_type == op1->op_type - && opline->result.u.var == op1->u.var) { - opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } else { - /* This should be an object instanciation - * Find JMP_NO_CTOR, mark the preceding ASSIGN and the - * proceeding INIT_FCALL_BY_NAME as unused - */ - while (opline>CG(active_op_array)->opcodes) { - if (opline->opcode == ZEND_JMP_NO_CTOR) { - (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED; - (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED; - break; - } - opline--; - } - } - } -} - - -void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC) -{ - zend_op_array op_array; - char *name = function_name->u.constant.value.str.val; - int name_len = function_name->u.constant.value.str.len; - int function_begin_line = function_token->u.opline_num; - - function_token->u.op_array = CG(active_op_array); - zend_str_tolower(name, name_len); - - init_op_array(&op_array, INITIAL_OP_ARRAY_SIZE); - op_array.function_name = name; - op_array.arg_types = NULL; - - if (is_method) { - zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } else { - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_DECLARE_FUNCTION_OR_CLASS; - opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, &function_name->u.constant, opline); - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_STRING; - opline->op2.u.constant.value.str.val = estrndup(name, name_len); - opline->op2.u.constant.value.str.len = name_len; - opline->op2.u.constant.refcount = 1; - opline->extended_value = ZEND_DECLARE_FUNCTION; - zend_hash_update(CG(function_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array)); - } - - if (CG(extended_info)) { - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_EXT_NOP; - opline->lineno = function_begin_line; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } - - { - /* Push a seperator to the switch and foreach stacks */ - zend_switch_entry switch_entry; - - switch_entry.cond.op_type = IS_UNUSED; - switch_entry.default_case = 0; - switch_entry.control_var = 0; - - zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); - - zend_stack_push(&CG(foreach_copy_stack), (void *) &switch_entry.cond, sizeof(znode)); - } -} - - -void do_end_function_declaration(znode *function_token CLS_DC) -{ - pass_two(CG(active_op_array)); - CG(active_op_array) = function_token->u.op_array; - - /* Pop the switch and foreach seperators */ - zend_stack_del_top(&CG(switch_cond_stack)); - zend_stack_del_top(&CG(foreach_copy_stack)); -} - - -void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->result = *var; - opline->op1 = *offset; - if ((op == ZEND_RECV_INIT) && initialization) { - opline->op2 = *initialization; - } else { - SET_UNUSED(opline->op2); - } - if (pass_type==BYREF_FORCE && !CG(active_op_array)->arg_types) { - int i; - - CG(active_op_array)->arg_types = (unsigned char *) emalloc(sizeof(unsigned char)*(offset->u.constant.value.lval+1)); - for (i=1; iu.constant.value.lval; i++) { - CG(active_op_array)->arg_types[i] = BYREF_NONE; - } - CG(active_op_array)->arg_types[0]=(unsigned char) offset->u.constant.value.lval; - } - if (CG(active_op_array)->arg_types) { - CG(active_op_array)->arg_types = (unsigned char *) erealloc(CG(active_op_array)->arg_types, sizeof(unsigned char)*(offset->u.constant.value.lval+1)); - CG(active_op_array)->arg_types[offset->u.constant.value.lval] = pass_type; - CG(active_op_array)->arg_types[0]++; - } -} - - -int do_begin_function_call(znode *function_name CLS_DC) -{ - zend_function *function; - - zend_str_tolower(function_name->u.constant.value.str.val, function_name->u.constant.value.str.len); - if (zend_hash_find(CG(function_table), function_name->u.constant.value.str.val,function_name->u.constant.value.str.len+1, (void **) &function)==FAILURE) { - znode tmp = *function_name; - - zval_copy_ctor(&tmp.u.constant); - do_begin_dynamic_function_call(&tmp CLS_CC); - return 1; /* Dynamic */ - } - - switch (function->type) { - case ZEND_USER_FUNCTION: { - zend_op_array *op_array = (zend_op_array *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *)); - } - break; - case ZEND_INTERNAL_FUNCTION: { - zend_internal_function *internal_function = (zend_internal_function *) function; - - zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *)); - } - break; - } - return 0; -} - - -void do_begin_dynamic_function_call(znode *function_name CLS_DC) -{ - unsigned char *ptr = NULL; - int last_op_number = get_next_op_number(CG(active_op_array))-1; - - if (last_op_number>=0 && CG(active_op_array)->opcodes[last_op_number].opcode == ZEND_FETCH_OBJ_R) { - CG(active_op_array)->opcodes[last_op_number].opcode = ZEND_INIT_FCALL_BY_NAME; - CG(active_op_array)->opcodes[last_op_number].extended_value = ZEND_MEMBER_FUNC_CALL; - } else { - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_INIT_FCALL_BY_NAME; - opline->op2 = *function_name; - opline->extended_value = 0; - SET_UNUSED(opline->op1); - } - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); -} - - -void do_begin_class_member_function_call(znode *class_name, znode *function_name CLS_DC) -{ - unsigned char *ptr = NULL; - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_INIT_FCALL_BY_NAME; - zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len); - opline->op1 = *class_name; - opline->op2 = *function_name; - opline->extended_value = ZEND_MEMBER_FUNC_CALL; - zval_copy_ctor(&opline->op2.u.constant); - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *)); -} - - -void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - if (function_name->op_type==IS_CONST && !is_method && !is_dynamic_fcall) { - opline->opcode = ZEND_DO_FCALL; - } else { - opline->opcode = ZEND_DO_FCALL_BY_NAME; - } - opline->op1 = *function_name; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - *result = opline->result; - SET_UNUSED(opline->op2); - opline->op2.u.constant.value.lval = is_method; - zend_stack_del_top(&CG(function_call_stack)); - opline->extended_value = argument_list->u.constant.value.lval; -} - - -void do_pass_param(znode *param, int op, int offset CLS_DC) -{ - zend_op *opline; - unsigned char *arg_types; - int original_op=op; - zend_function **function_ptr_ptr, *function_ptr; - - zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr); - function_ptr = *function_ptr_ptr; - if (function_ptr) { - arg_types = function_ptr->common.arg_types; - } else { - arg_types = NULL; - } - - if (op == ZEND_SEND_VAL) { - switch (param->op_type) { - case IS_CONST: /* constants behave like variables when passed to functions, - * as far as reference counting is concerned. Treat them - * as if they were variables here. - */ - case IS_VAR: - op = ZEND_SEND_VAR; - break; - } - } - - - if (ARG_SHOULD_BE_SENT_BY_REF(offset, 1, arg_types)) { - /* change to passing by reference */ - switch (param->op_type) { - case IS_VAR: - op = ZEND_SEND_REF; - break; - default: - zend_error(E_COMPILE_ERROR, "Only variables can be passed by reference"); - break; - } - } - - if (original_op==ZEND_SEND_VAR) { - switch(op) { - case ZEND_SEND_VAR: - if (function_ptr) { - do_end_variable_parse(BP_VAR_R, 0 CLS_CC); - } else { - do_end_variable_parse(BP_VAR_FUNC_ARG, offset CLS_CC); - } - break; - case ZEND_SEND_REF: - do_end_variable_parse(BP_VAR_W, 0 CLS_CC); - break; - } - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - if (function_ptr) { - opline->extended_value = ZEND_DO_FCALL; - } else { - opline->extended_value = ZEND_DO_FCALL_BY_NAME; - } - opline->opcode = op; - opline->op1 = *param; - opline->op2.u.opline_num = offset; - SET_UNUSED(opline->op2); -} - - -static int generate_free_switch_expr(zend_switch_entry *switch_entry CLS_DC) -{ - zend_op *opline; - - if (switch_entry->cond.op_type == IS_UNUSED) { - return 1; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_SWITCH_FREE; - opline->op1 = switch_entry->cond; - SET_UNUSED(opline->op2); - return 0; -} - -static int generate_free_foreach_copy(znode *foreach_copy CLS_DC) -{ - zend_op *opline; - - if (foreach_copy->op_type == IS_UNUSED) { - return 1; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_FREE; - opline->op1 = *foreach_copy; - SET_UNUSED(opline->op2); - return 0; -} - -void do_return(znode *expr CLS_DC) -{ - zend_op *opline; - -#ifdef ZTS - zend_stack_apply_with_argument(&CG(switch_cond_stack), (int (*)(void *element, void *)) generate_free_switch_expr, ZEND_STACK_APPLY_TOPDOWN CLS_CC); - zend_stack_apply_with_argument(&CG(foreach_copy_stack), (int (*)(void *element, void *)) generate_free_foreach_copy, ZEND_STACK_APPLY_TOPDOWN CLS_CC); -#else - zend_stack_apply(&CG(switch_cond_stack), (int (*)(void *element)) generate_free_switch_expr, ZEND_STACK_APPLY_TOPDOWN); - zend_stack_apply(&CG(foreach_copy_stack), (int (*)(void *element)) generate_free_foreach_copy, ZEND_STACK_APPLY_TOPDOWN); -#endif - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_RETURN; - if (expr) { - opline->op1 = *expr; - } else { - var_uninit(&opline->op1.u.constant); - opline->op1.op_type = IS_CONST; - INIT_PZVAL(&opline->op1.u.constant); - } - SET_UNUSED(opline->op2); -} - - -static void function_add_ref(zend_function *function) -{ - if (function->type == ZEND_USER_FUNCTION) { - (*((zend_op_array *) function)->refcount)++; - } -} - - -static void do_inherit_parent_constructor(zend_class_entry *ce) -{ - if (ce->parent - && !zend_hash_exists(&ce->function_table, ce->name, ce->name_length+1)) { - zend_function *function; - - if (zend_hash_find(&ce->parent->function_table, ce->parent->name, ce->parent->name_length+1, (void **) &function)==SUCCESS) { - /* inherit parent's constructor */ - zend_hash_update(&ce->function_table, ce->name, ce->name_length+1, function, sizeof(zend_function), NULL); - function_add_ref(function); - } - } -} - - -ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time) -{ - switch (opline->extended_value) { - case ZEND_DECLARE_FUNCTION: { - zend_function *function; - - zend_hash_find(function_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &function); - (*function->op_array.refcount)++; - if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) { - if (!compile_time) { - zend_error(E_ERROR, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val); - } - return FAILURE; - } else { - return SUCCESS; - } - } - break; - case ZEND_DECLARE_CLASS: { - zend_class_entry *ce; - - zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce); - (*ce->refcount)++; - if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, ce, sizeof(zend_class_entry), NULL)==FAILURE) { - (*ce->refcount)--; - if (!compile_time) { - zend_error(E_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val); - } - return FAILURE; - } else { - return SUCCESS; - } - } - break; - case ZEND_DECLARE_INHERITED_CLASS: { - zend_class_entry *ce, *parent_ce; - char *class_name, *parent_name; - zend_function tmp_zend_function; - zval *tmp; - - zend_hash_find(class_table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, (void **) &ce); - (*ce->refcount)++; - - /* Restore base class / derived class names */ - parent_name = opline->op2.u.constant.value.str.val; - class_name = strchr(opline->op2.u.constant.value.str.val, ':'); - if (!class_name) { - zend_error(E_CORE_ERROR, "Invalid runtime class entry"); - } - *class_name++ = 0; - - /* Obtain parent class */ - if (zend_hash_find(class_table, parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) { - if (!compile_time) { - zend_error(E_ERROR, "Class %s: Cannot inherit from undefined class %s", class_name, parent_name); - } - (*ce->refcount)--; - *(class_name-1) = ':'; - return FAILURE; - } - - /* Perform inheritence */ - zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); - zend_hash_merge(&ce->function_table, &parent_ce->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function), 0); - ce->parent = parent_ce; - do_inherit_parent_constructor(ce); - - /* Register the derived class */ - if (zend_hash_add(class_table, class_name, strlen(class_name)+1, ce, sizeof(zend_class_entry), NULL)==FAILURE) { - if (!compile_time) { - zend_error(E_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val); - } - (*ce->refcount)--; - zend_hash_destroy(&ce->function_table); - zend_hash_destroy(&ce->default_properties); - return FAILURE; - } - return SUCCESS; - } - break; - } - return FAILURE; -} - - -void do_early_binding(CLS_D) -{ - zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - HashTable *table; - - if (do_bind_function_or_class(opline, CG(function_table), CG(class_table), 1)==FAILURE) { - return; - } - switch (opline->extended_value) { - case ZEND_DECLARE_FUNCTION: - table = CG(function_table); - break; - case ZEND_DECLARE_CLASS: - table = CG(class_table); - break; - default: - zend_error(E_COMPILE_ERROR, "Invalid binding type"); - return; - } - zend_hash_del(table, opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len); - zval_dtor(&opline->op1.u.constant); - zval_dtor(&opline->op2.u.constant); - opline->opcode = ZEND_NOP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPNZ_EX; - if (expr1->op_type == IS_TMP_VAR) { - opline->result = *expr1; - } else { - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - } - opline->op1 = *expr1; - SET_UNUSED(opline->op2); - - op_token->u.opline_num = next_op_number; - - *expr1 = opline->result; -} - - -void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - *result = *expr1; /* we saved the original result in expr1 */ - opline->opcode = ZEND_BOOL; - opline->result = *result; - opline->op1 = *expr2; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); -} - - -void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPZ_EX; - if (expr1->op_type == IS_TMP_VAR) { - opline->result = *expr1; - } else { - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - } - opline->op1 = *expr1; - SET_UNUSED(opline->op2); - - op_token->u.opline_num = next_op_number; - - *expr1 = opline->result; -} - - -void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - *result = *expr1; /* we saved the original result in expr1 */ - opline->opcode = ZEND_BOOL; - opline->result = *result; - opline->op1 = *expr2; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); -} - - -void do_do_while_begin(CLS_D) -{ - do_begin_loop(CLS_C); - INC_BPC(CG(active_op_array)); -} - - -void do_do_while_end(znode *do_token, znode *expr CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPNZ; - opline->op1 = *expr; - opline->op2.u.opline_num = do_token->u.opline_num; - SET_UNUSED(opline->op2); - - do_end_loop(do_token->u.opline_num CLS_CC); - - DEC_BPC(CG(active_op_array)); -} - - -void do_brk_cont(int op, znode *expr CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = op; - opline->op1.u.opline_num = CG(active_op_array)->current_brk_cont; - SET_UNUSED(opline->op1); - if (expr) { - opline->op2 = *expr; - } else { - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 1; - INIT_PZVAL(&opline->op2.u.constant); - opline->op2.op_type = IS_CONST; - } -} - - -void do_switch_cond(znode *cond CLS_DC) -{ - zend_switch_entry switch_entry; - zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1]; - - switch_entry.cond = *cond; - switch_entry.default_case = -1; - switch_entry.control_var = -1; - zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); - - if (opline->result.op_type == IS_VAR) { - opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } - - do_begin_loop(CLS_C); - - INC_BPC(CG(active_op_array)); -} - - - -void do_switch_end(znode *case_list CLS_DC) -{ - zend_op *opline; - zend_switch_entry *switch_entry_ptr; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - if (case_list->u.opline_num != -1) { /* empty switch */ - int next_op_number = get_next_op_number(CG(active_op_array)); - - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; - } - - /* add code to jmp to default case */ - if (switch_entry_ptr->default_case != -1) { - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_JMPZ; - opline->op1.op_type = IS_TMP_VAR; - opline->op1.u.var = switch_entry_ptr->control_var; - opline->op2.u.opline_num = switch_entry_ptr->default_case; - SET_UNUSED(opline->op2); - } - - - /* remember break/continue loop information */ - CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent; - - /* emit free for the switch condition*/ - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_SWITCH_FREE; - opline->op1 = switch_entry_ptr->cond; - SET_UNUSED(opline->op2); - if (switch_entry_ptr->cond.op_type == IS_CONST) { - zval_dtor(&switch_entry_ptr->cond.u.constant); - } - - zend_stack_del_top(&CG(switch_cond_stack)); - - DEC_BPC(CG(active_op_array)); -} - - -void do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - int next_op_number; - zend_switch_entry *switch_entry_ptr; - znode result; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - opline->opcode = ZEND_CASE; - if (switch_entry_ptr->control_var==-1) { - switch_entry_ptr->control_var = get_temporary_variable(CG(active_op_array)); - } - opline->result.u.var = switch_entry_ptr->control_var; - opline->result.op_type = IS_TMP_VAR; - opline->op1 = switch_entry_ptr->cond; - opline->op2 = *case_expr; - if (opline->op1.op_type == IS_CONST) { - zval_copy_ctor(&opline->op1.u.constant); - } - result = opline->result; - - next_op_number = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_JMPZ; - opline->op1 = result; - SET_UNUSED(opline->op2); - case_token->u.opline_num = next_op_number; - - if (case_list->u.opline_num==-1) { - return; - } - next_op_number = get_next_op_number(CG(active_op_array)); - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; -} - - -void do_case_after_statement(znode *result, znode *case_token CLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - result->u.opline_num = next_op_number; - - switch (CG(active_op_array)->opcodes[case_token->u.opline_num].opcode) { - case ZEND_JMP: - CG(active_op_array)->opcodes[case_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array)); - break; - case ZEND_JMPZ: - CG(active_op_array)->opcodes[case_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - break; - } -} - - - -void do_default_before_statement(znode *case_list, znode *default_token CLS_DC) -{ - int next_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - zend_switch_entry *switch_entry_ptr; - - zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr); - - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - default_token->u.opline_num = next_op_number; - - next_op_number = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_BOOL; - if (switch_entry_ptr->control_var==-1) { - switch_entry_ptr->control_var = get_temporary_variable(CG(active_op_array)); - } - opline->result.u.var = switch_entry_ptr->control_var; - opline->result.op_type = IS_TMP_VAR; - opline->op1.op_type = IS_CONST; - opline->op1.u.constant.type = IS_LONG; - opline->op1.u.constant.value.lval = 1; - INIT_PZVAL(&opline->op1.u.constant); - SET_UNUSED(opline->op2); - switch_entry_ptr->default_case = next_op_number; - - next_op_number = get_next_op_number(CG(active_op_array)); - if (case_list->u.opline_num==-1) { - return; - } - CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number; -} - - -void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - int runtime_inheritence = 0; - - if (CG(active_class_entry)) { - zend_error(E_COMPILE_ERROR, "Class declarations may not be nested"); - return; - } - CG(class_entry).type = ZEND_USER_CLASS; - CG(class_entry).name = class_name->u.constant.value.str.val; - CG(class_entry).name_length = class_name->u.constant.value.str.len; - CG(class_entry).refcount = (int *) emalloc(sizeof(int)); - *CG(class_entry).refcount = 1; - CG(class_entry).constants_updated = 0; - - zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length); - - zend_hash_init(&CG(class_entry).function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0); - zend_hash_init(&CG(class_entry).default_properties, 10, NULL, PVAL_PTR_DTOR, 0); - - /* code for inheritance from parent class */ - if (parent_class_name) { - zend_class_entry *parent_class; - zend_function tmp_zend_function; - zval *tmp; - - zend_str_tolower(parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len); - - if (zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) { - /* copy functions */ - zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function)); - - /* copy default properties */ - zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *)); - - CG(class_entry).parent = parent_class; - - zval_dtor(&parent_class_name->u.constant); - } else { - runtime_inheritence = 1; - CG(class_entry).parent = NULL; - } - } else { - CG(class_entry).parent = NULL; - } - - CG(class_entry).handle_function_call = NULL; - CG(class_entry).handle_property_set = NULL; - CG(class_entry).handle_property_get = NULL; - - opline->opcode = ZEND_DECLARE_FUNCTION_OR_CLASS; - opline->op1.op_type = IS_CONST; - build_runtime_defined_function_key(&opline->op1.u.constant, &class_name->u.constant, opline); - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_STRING; - opline->op2.u.constant.refcount = 1; - if (runtime_inheritence) { - char *full_class_name; - - opline->op2.u.constant.value.str.len = parent_class_name->u.constant.value.str.len+1+CG(class_entry).name_length; - full_class_name = opline->op2.u.constant.value.str.val = (char *) emalloc(opline->op2.u.constant.value.str.len+1); - - memcpy(full_class_name, parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len); - full_class_name += parent_class_name->u.constant.value.str.len; - full_class_name[0] = ':'; - full_class_name++; - memcpy(full_class_name, CG(class_entry).name, CG(class_entry).name_length); - zval_dtor(&parent_class_name->u.constant); - full_class_name += CG(class_entry).name_length; - full_class_name[0] = 0; - opline->extended_value = ZEND_DECLARE_INHERITED_CLASS; - } else { - opline->op2.u.constant.value.str.val = estrndup(CG(class_entry).name, CG(class_entry).name_length); - opline->op2.u.constant.value.str.len = CG(class_entry).name_length; - opline->extended_value = ZEND_DECLARE_CLASS; - } - - zend_hash_update(CG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry)); -} - - -void do_end_class_declaration(CLS_D) -{ - do_inherit_parent_constructor(CG(active_class_entry)); - CG(active_class_entry) = NULL; -} - - -void do_declare_property(znode *var_name, znode *value CLS_DC) -{ - if (value) { - zval *property = (zval *) emalloc(sizeof(zval)); - - *property = value->u.constant; - zend_hash_update(&CG(active_class_entry)->default_properties, var_name->u.constant.value.str.val, var_name->u.constant.value.str.len+1, &property, sizeof(zval *), NULL); - } - FREE_PNODE(var_name); -} - - -void do_fetch_property(znode *result, znode *object, znode *property CLS_DC) -{ - zend_op opline; - zend_llist *fetch_list_ptr; - - init_op(&opline CLS_CC); - opline.opcode = ZEND_FETCH_OBJ_W; /* the backpatching routine assumes W */ - opline.result.op_type = IS_VAR; - opline.result.u.EA.type = 0; - opline.result.u.var = get_temporary_variable(CG(active_op_array)); - opline.op1 = *object; - opline.op2 = *property; - *result = opline.result; - - zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr); - zend_llist_add_element(fetch_list_ptr, &opline); -} - - -void do_push_object(znode *object CLS_DC) -{ - zend_stack_push(&CG(object_stack), object, sizeof(znode)); -} - - -void do_pop_object(znode *object CLS_DC) -{ - znode *tmp; - - zend_stack_top(&CG(object_stack), (void **) &tmp); - *object = *tmp; - zend_stack_del_top(&CG(object_stack)); -} - - -void do_begin_new_object(znode *new_token, znode *class_name CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - unsigned char *ptr = NULL; - - opline->opcode = ZEND_NEW; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *class_name; - SET_UNUSED(opline->op2); - - /* *result = opline->result; - do_assign(result, variable, &opline->result CLS_CC); */ - - - new_token->u.opline_num = get_next_op_number(CG(active_op_array)); - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_JMP_NO_CTOR; - opline->op1 = (opline-1)->result; - SET_UNUSED(opline->op2); - - if (class_name->op_type == IS_CONST) { - zval_copy_ctor(&class_name->u.constant); - } - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_INIT_FCALL_BY_NAME; - opline->op1 = (opline-2)->result; - opline->op2 = *class_name; - opline->extended_value = ZEND_MEMBER_FUNC_CALL | ZEND_CTOR_CALL; - zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *)); -} - - -void do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list CLS_DC) -{ - znode ctor_result; - - if (class_name->op_type == IS_CONST) { - zval_copy_ctor(&class_name->u.constant); - } - do_end_function_call(class_name, &ctor_result, argument_list, 1, 0 CLS_CC); - do_free(&ctor_result CLS_CC); - - CG(active_op_array)->opcodes[new_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - *result = CG(active_op_array)->opcodes[new_token->u.opline_num].op1; -} - - -void do_fetch_constant(znode *result, znode *constant_name, int mode CLS_DC) -{ - switch (mode) { - case ZEND_CT: - *result = *constant_name; - result->u.constant.type = IS_CONSTANT; - break; - case ZEND_RT: { - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_FETCH_CONSTANT; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *constant_name; - *result = opline->result; - SET_UNUSED(opline->op2); - } - break; - } -} - - -void do_shell_exec(znode *result, znode *cmd CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - switch (cmd->op_type) { - case IS_TMP_VAR: - opline->opcode = ZEND_SEND_VAL; - break; - default: - opline->opcode = ZEND_SEND_VAR; - break; - } - opline->op1 = *cmd; - opline->op2.u.opline_num = 0; - opline->extended_value = ZEND_DO_FCALL; - SET_UNUSED(opline->op2); - - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_DO_FCALL; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - opline->op1.u.constant.value.str.val = estrndup("shell_exec",sizeof("shell_exec")-1); - opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1; - INIT_PZVAL(&opline->op1.u.constant); - opline->op1.u.constant.type = IS_STRING; - opline->op1.op_type = IS_CONST; - opline->extended_value = 1; - SET_UNUSED(opline->op2); - *result = opline->result; -} - - - -void do_init_array(znode *result, znode *expr, znode *offset, int is_ref CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_INIT_ARRAY; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->result.op_type = IS_TMP_VAR; - *result = opline->result; - if (expr) { - opline->op1 = *expr; - if (offset) { - opline->op2 = *offset; - } else { - SET_UNUSED(opline->op2); - } - } else { - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - } - opline->extended_value = is_ref; -} - - -void do_add_array_element(znode *result, znode *expr, znode *offset, int is_ref CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ADD_ARRAY_ELEMENT; - opline->result = *result; - opline->op1 = *expr; - if (offset) { - opline->op2 = *offset; - } else { - SET_UNUSED(opline->op2); - } - opline->extended_value = is_ref; -} - - - -void do_add_static_array_element(znode *result, znode *offset, znode *expr) -{ - zval *element = (zval *) emalloc(sizeof(zval)); - - *element = expr->u.constant; - if (offset) { - switch (offset->u.constant.type) { - case IS_STRING: - zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL); - zval_dtor(&offset->u.constant); - break; - case IS_LONG: - zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL); - break; - } - } else { - zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL); - } -} - - -void do_add_list_element(znode *element CLS_DC) -{ - list_llist_element lle; - - if (element) { - lle.var = *element; - zend_llist_copy(&lle.dimensions, &CG(dimension_llist)); - zend_llist_add_element(&CG(list_llist), &lle); - } - (*((int *)CG(dimension_llist).tail->data))++; -} - - -void do_new_list_begin(CLS_D) -{ - int current_dimension = 0; - zend_llist_add_element(&CG(dimension_llist), ¤t_dimension); -} - - -void do_new_list_end(CLS_D) -{ - zend_llist_remove_tail(&CG(dimension_llist)); - (*((int *)CG(dimension_llist).tail->data))++; -} - - -void do_list_init(CLS_D) -{ - zend_llist_init(&CG(list_llist), sizeof(list_llist_element), NULL, 0); - zend_llist_init(&CG(dimension_llist), sizeof(int), NULL, 0); - do_new_list_begin(CLS_C); -} - - -void do_list_end(znode *result, znode *expr CLS_DC) -{ - zend_llist_element *le; - zend_llist_element *dimension; - zend_op *opline; - znode last_container; - - le = CG(list_llist).head; - while (le) { - zend_llist *tmp_dimension_llist = &((list_llist_element *)le->data)->dimensions; - dimension = tmp_dimension_llist->head; - while (dimension) { - opline = get_next_op(CG(active_op_array) CLS_CC); - if (dimension == tmp_dimension_llist->head) { /* first */ - last_container = *expr; - switch(expr->op_type) { - case IS_VAR: - opline->opcode = ZEND_FETCH_DIM_R; - break; - case IS_TMP_VAR: - case IS_CONST: /* fetch_dim_tmp_var will handle this bogus fetch */ - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - break; - } - } else { - opline->opcode = ZEND_FETCH_DIM_R; - } - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = last_container; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = *((int *) dimension->data); - INIT_PZVAL(&opline->op2.u.constant); - if (le == CG(list_llist).tail) { - opline->extended_value = ZEND_FETCH_STANDARD; - } else { - opline->extended_value = ZEND_FETCH_ADD_LOCK; - } - last_container = opline->result; - dimension = dimension->next; - } - ((list_llist_element *) le->data)->value = last_container; - zend_llist_destroy(&((list_llist_element *) le->data)->dimensions); - le = le->next; - } - - le = CG(list_llist).head; - while (le) { - do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value CLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - le = le->next; - } - zend_llist_destroy(&CG(dimension_llist)); - zend_llist_destroy(&CG(list_llist)); - *result = *expr; -} - - -void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - znode lval; - - if (fetch_type==ZEND_FETCH_STATIC && static_assignment) { - zval *tmp = (zval *) emalloc(sizeof(zval)); - - convert_to_string(&varname->u.constant); - *tmp = static_assignment->u.constant; - if (!CG(active_op_array)->static_variables) { - CG(active_op_array)->static_variables = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, PVAL_PTR_DTOR, 0); - } - zend_hash_update_ptr(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, tmp, sizeof(zval *), NULL); - } - - - opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */ - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *varname; - SET_UNUSED(opline->op2); - opline->op2.u.fetch_type = fetch_type; - - if (varname->op_type == IS_CONST) { - zval_copy_ctor(&varname->u.constant); - } - fetch_simple_variable(&lval, varname, 0 CLS_CC); /* Relies on the fact that the default fetch is BP_VAR_W */ - - - do_assign_ref(NULL, &lval, &opline->result CLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; -} - - -void do_cast(znode *result, znode *expr, int type CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_CAST; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *expr; - SET_UNUSED(opline->op2); - opline->op2.u.constant.type = type; - *result = opline->result; -} - - -void do_include_or_eval(int type, znode *result, znode *op1 CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_INCLUDE_OR_EVAL; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *op1; - SET_UNUSED(opline->op2); - opline->op2.u.constant.value.lval = type; - *result = opline->result; -} - - -void do_indirect_references(znode *result, znode *num_references, znode *variable CLS_DC) -{ - int i; - - do_end_variable_parse(BP_VAR_R, 0 CLS_CC); - for (i=1; iu.constant.value.lval; i++) { - fetch_simple_variable_ex(result, variable, 0, ZEND_FETCH_R CLS_CC); - *variable = *result; - } - do_begin_variable_parse(CLS_C); - fetch_simple_variable(result, variable, 1 CLS_CC); -} - - -void do_unset(znode *variable CLS_DC) -{ - zend_op *last_op; - - last_op = &CG(active_op_array)->opcodes[get_next_op_number(CG(active_op_array))-1]; - - switch (last_op->opcode) { - case ZEND_FETCH_R: - last_op->opcode = ZEND_UNSET_VAR; - break; - case ZEND_FETCH_DIM_R: - case ZEND_FETCH_OBJ_R: - last_op->opcode = ZEND_UNSET_DIM_OBJ; - break; - - } -} - - -void do_isset_or_isempty(int type, znode *result, znode *variable CLS_DC) -{ - zend_op *opline; - - do_end_variable_parse(BP_VAR_IS, 0 CLS_CC); - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_ISSET_ISEMPTY; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *variable; - opline->op2.u.constant.value.lval = type; - SET_UNUSED(opline->op2); - *result = opline->result; -} - - -void do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - /* Preform array reset */ - opline->opcode = ZEND_FE_RESET; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *array; - SET_UNUSED(opline->op2); - *open_brackets_token = opline->result; - - zend_stack_push(&CG(foreach_copy_stack), (void *) &opline->result, sizeof(znode)); - - /* save the location of the beginning of the loop (array fetching) */ - foreach_token->u.opline_num = get_next_op_number(CG(active_op_array)); - - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_FE_FETCH; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *open_brackets_token; - SET_UNUSED(opline->op2); - *as_token = opline->result; -} - - -void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - znode result_value, result_key, dummy; - - if (key->op_type != IS_UNUSED) { - znode *tmp; - - /* switch between the key and value... */ - tmp = key; - key = value; - value = tmp; - } - - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.opline_num = get_temporary_variable(CG(active_op_array)); - opline->op1 = *as_token; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 0; - opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */ - result_value = opline->result; - - if (key->op_type != IS_UNUSED) { - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_FETCH_DIM_TMP_VAR; - opline->result.op_type = IS_VAR; - opline->result.u.EA.type = 0; - opline->result.u.opline_num = get_temporary_variable(CG(active_op_array)); - opline->op1 = *as_token; - opline->op2.op_type = IS_CONST; - opline->op2.u.constant.type = IS_LONG; - opline->op2.u.constant.value.lval = 1; - opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */ - result_key = opline->result; - } - - do_assign(&dummy, value, &result_value CLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - if (key->op_type != IS_UNUSED) { - do_assign(&dummy, key, &result_key CLS_CC); - CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED; - } - do_free(as_token CLS_CC); - - do_begin_loop(CLS_C); - INC_BPC(CG(active_op_array)); -} - - -void do_foreach_end(znode *foreach_token, znode *open_brackets_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMP; - opline->op1.u.opline_num = foreach_token->u.opline_num; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[foreach_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array)); - - do_end_loop(foreach_token->u.opline_num CLS_CC); - - do_free(open_brackets_token CLS_CC); - - zend_stack_del_top(&CG(foreach_copy_stack)); - - DEC_BPC(CG(active_op_array)); -} - - -void do_end_heredoc(CLS_D) -{ - int opline_num = get_next_op_number(CG(active_op_array))-1; - zend_op *opline = &CG(active_op_array)->opcodes[opline_num]; - - if (opline->opcode != ZEND_ADD_STRING) { - return; - } - - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; - if (opline->op2.u.constant.value.str.len>0) { - if (opline->op2.u.constant.value.str.val[opline->op2.u.constant.value.str.len-1]=='\r') { - opline->op2.u.constant.value.str.val[(opline->op2.u.constant.value.str.len--)-1] = 0; - } - } -} - - -void do_exit(znode *result, znode *message CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_EXIT; - opline->op1 = *message; - SET_UNUSED(opline->op2); - - result->op_type = IS_CONST; - result->u.constant.type = IS_BOOL; - result->u.constant.value.lval = 1; -} - - -void do_begin_silence(znode *strudel_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_BEGIN_SILENCE; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - *strudel_token = opline->result; -} - - -void do_end_silence(znode *strudel_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_END_SILENCE; - opline->op1 = *strudel_token; - SET_UNUSED(opline->op2); -} - - -void do_begin_qm_op(znode *cond, znode *qm_token CLS_DC) -{ - int jmpz_op_number = get_next_op_number(CG(active_op_array)); - zend_op *opline; - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_JMPZ; - opline->op1 = *cond; - SET_UNUSED(opline->op2); - opline->op2.u.opline_num = jmpz_op_number; - *qm_token = opline->op2; - - INC_BPC(CG(active_op_array)); -} - - -void do_qm_true(znode *true_value, znode *qm_token, znode *colon_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - CG(active_op_array)->opcodes[qm_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array))+1; /* jmp over the ZEND_JMP */ - - opline->opcode = ZEND_QM_ASSIGN; - opline->result.op_type = IS_TMP_VAR; - opline->result.u.var = get_temporary_variable(CG(active_op_array)); - opline->op1 = *true_value; - SET_UNUSED(opline->op2); - - *qm_token = opline->result; - colon_token->u.opline_num = get_next_op_number(CG(active_op_array)); - - opline = get_next_op(CG(active_op_array) CLS_CC); - opline->opcode = ZEND_JMP; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token CLS_DC) -{ - zend_op *opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_QM_ASSIGN; - opline->result = *qm_token; - opline->op1 = *false_value; - SET_UNUSED(opline->op2); - - CG(active_op_array)->opcodes[colon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array)); - - *result = opline->result; - - DEC_BPC(CG(active_op_array)); -} - -void do_extended_info(CLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_EXT_STMT; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - -void do_extended_fcall_begin(CLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_EXT_FCALL_BEGIN; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -void do_extended_fcall_end(CLS_D) -{ - zend_op *opline; - - if (!CG(extended_info)) { - return; - } - - opline = get_next_op(CG(active_op_array) CLS_CC); - - opline->opcode = ZEND_EXT_FCALL_END; - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); -} - - -int zendlex(znode *zendlval CLS_DC) -{ - int retval; - - zendlval->u.constant.type = IS_LONG; - retval = lex_scan(&zendlval->u.constant CLS_CC); - switch(retval) { - case T_COMMENT: - case T_OPEN_TAG: - case T_WHITESPACE: - case T_PHP_TRACK_VARS: - retval = zendlex(zendlval CLS_CC); - break; - case T_CLOSE_TAG: - retval = ';'; /* implicit ; */ - break; - case T_OPEN_TAG_WITH_ECHO: - retval = T_ECHO; - break; - } - - INIT_PZVAL(&zendlval->u.constant); - zendlval->op_type = IS_CONST; - return retval; -} diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h deleted file mode 100644 index b76d107ba6..0000000000 --- a/Zend/zend_compile.h +++ /dev/null @@ -1,612 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _COMPILE_H -#define _COMPILE_H - -#include "zend.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -#include "zend_llist.h" - -#define DEBUG_ZEND 0 - -#ifndef ZTS -# define SUPPORT_INTERACTIVE 1 -#else -# define SUPPORT_INTERACTIVE 0 -#endif - -#define FREE_PNODE(znode) zval_dtor(&znode->u.constant); -#define FREE_OP(op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var); - - -#if SUPPORT_INTERACTIVE -#define INC_BPC(op_array) ((op_array)->backpatch_count++) -#define DEC_BPC(op_array) ((op_array)->backpatch_count--) -#define HANDLE_INTERACTIVE() if (EG(interactive)) { execute_new_code(CLS_C); } -#else -#define INC_BPC(op_array) -#define DEC_BPC(op_array) -#define HANDLE_INTERACTIVE() -#endif - -typedef struct _zend_op_array zend_op_array; - -typedef struct _znode { - int op_type; - union { - zval constant; - - int var; - int opline_num; - int fetch_type; - zend_op_array *op_array; - struct { - int var; /* dummy */ - int type; - } EA; - } u; -} znode; - - -typedef struct _zend_op { - int opcode; - znode result; - znode op1; - znode op2; - ulong extended_value; - char *filename; - uint lineno; -} zend_op; - - -typedef struct _zend_brk_cont_element { - int cont; - int brk; - int parent; -} zend_brk_cont_element; - - -struct _zend_op_array { - int type; /* MUST be the first element of this struct! */ - - unsigned char *arg_types; /* MUST be the second element of this struct! */ - char *function_name; /* MUST be the third element of this struct! */ - - int *refcount; - - zend_op *opcodes; - int last, size; - - int T; - - - zend_brk_cont_element *brk_cont_array; - int last_brk_cont; - int current_brk_cont; - unsigned char uses_globals; - - /* static variables support */ - HashTable *static_variables; - -#if SUPPORT_INTERACTIVE - int start_op_number, end_op_number; - int last_executed_op_number; - int backpatch_count; -#endif - - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -}; - - -typedef struct _zend_internal_function { - int type; /* MUST be the first element of this struct! */ - - unsigned char *arg_types; /* MUST be the second element of this struct */ - char *function_name; /* MUST be the third element of this struct */ - - void (*handler)(INTERNAL_FUNCTION_PARAMETERS); -} zend_internal_function; - - -typedef union _zend_function { - int type; /* MUST be the first element of this struct! */ - struct { - int type; /* never used */ - unsigned char *arg_types; - char *function_name; - } common; - - zend_op_array op_array; - zend_internal_function internal_function; -} zend_function; - - -typedef struct _zend_function_state { - HashTable *function_symbol_table; - zend_function *function; - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -} zend_function_state; - - -typedef struct _zend_switch_entry { - znode cond; - int default_case; - int control_var; -} zend_switch_entry; - - -typedef struct _list_llist_element { - znode var; - zend_llist dimensions; - znode value; -} list_llist_element; - - -typedef struct _zend_file_handle { - int type; - char *filename; - char *opened_path; - union { - int fd; - FILE *fp; -#ifdef __cplusplus - istream *is; -#endif - } handle; - zend_bool free_filename; -} zend_file_handle; - - -#include "zend_globals.h" - -#define IS_CONST (1<<0) -#define IS_TMP_VAR (1<<1) -#define IS_VAR (1<<2) -#define IS_UNUSED (1<<3) /* Unused variable */ - - -#define EXT_TYPE_UNUSED (1<<0) - -void init_compiler(CLS_D ELS_DC); -void shutdown_compiler(CLS_D); - -BEGIN_EXTERN_C() -extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...); - -void zend_activate(CLS_D ELS_DC); -void zend_deactivate(CLS_D ELS_DC); - -int lex_scan(zval *zendlval CLS_DC); -void startup_scanner(CLS_D); -void shutdown_scanner(CLS_D); - -ZEND_API char *zend_set_compiled_filename(char *new_compiled_filename); -ZEND_API void zend_restore_compiled_filename(char *original_compiled_filename); -ZEND_API char *zend_get_compiled_filename(void); - -#ifdef ZTS -const char *zend_get_zendtext(CLS_D); -int zend_get_zendleng(CLS_D); -#endif - -END_EXTERN_C() - -/* parser-driven code generators */ -void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC); -void do_unary_op(int op, znode *result, znode *op1 CLS_DC); -void do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 CLS_DC); -void do_assign(znode *result, znode *variable, znode *value CLS_DC); -void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC); -void fetch_simple_variable(znode *result, znode *varname, int bp CLS_DC); -void fetch_simple_variable_ex(znode *result, znode *varname, int bp, int op CLS_DC); -void do_indirect_references(znode *result, znode *num_references, znode *variable CLS_DC); -void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC); -void do_fetch_globals(znode *varname CLS_DC); - -void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC); -void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC); -void do_print(znode *result, znode *arg CLS_DC); -void do_echo(znode *arg CLS_DC); -typedef int (*unary_op_type)(zval *, zval *); -ZEND_API unary_op_type get_unary_op(int opcode); -ZEND_API void *get_binary_op(int opcode); - -void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC); -void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC); -void do_do_while_begin(CLS_D); -void do_do_while_end(znode *do_token, znode *expr CLS_DC); - - -void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC); -void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC); -void do_if_end(CLS_D); - -void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC); -void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC); -void do_for_end(znode *second_semicolon_token CLS_DC); - -void do_pre_incdec(znode *result, znode *op1, int op CLS_DC); -void do_post_incdec(znode *result, znode *op1, int op CLS_DC); - -void do_begin_variable_parse(CLS_D); -void do_end_variable_parse(int type, int arg_offset CLS_DC); - -void do_free(znode *op1 CLS_DC); - -void do_init_string(znode *result CLS_DC); -void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC); -void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC); -void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC); - -void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC); -void do_end_function_declaration(znode *function_token CLS_DC); -void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type CLS_DC); -int do_begin_function_call(znode *function_name CLS_DC); -void do_begin_dynamic_function_call(znode *function_name CLS_DC); -void do_begin_class_member_function_call(znode *class_name, znode *function_name CLS_DC); -void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method, int is_dynamic_fcall CLS_DC); -void do_return(znode *expr CLS_DC); -ZEND_API int do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table, int compile_time); -void do_early_binding(CLS_D); - -void do_pass_param(znode *param, int op, int offset CLS_DC); - - -void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC); -void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC); -void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC); -void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC); - -void do_brk_cont(int op, znode *expr CLS_DC); - -void do_switch_cond(znode *cond CLS_DC); -void do_switch_end(znode *case_list CLS_DC); -void do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr CLS_DC); -void do_case_after_statement(znode *result, znode *case_token CLS_DC); -void do_default_before_statement(znode *case_list, znode *default_token CLS_DC); - -void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC); -void do_end_class_declaration(CLS_D); -void do_declare_property(znode *var_name, znode *value CLS_DC); - -void do_fetch_property(znode *result, znode *object, znode *property CLS_DC); - - -void do_push_object(znode *object CLS_DC); -void do_pop_object(znode *object CLS_DC); - - -void do_begin_new_object(znode *new_token, znode *class_name CLS_DC); -void do_end_new_object(znode *result, znode *class_name, znode *new_token, znode *argument_list CLS_DC); - -void do_fetch_constant(znode *result, znode *constant_name, int mode CLS_DC); - -void do_shell_exec(znode *result, znode *cmd CLS_DC); - -void do_init_array(znode *result, znode *expr, znode *offset, int is_ref CLS_DC); -void do_add_array_element(znode *result, znode *expr, znode *offset, int is_ref CLS_DC); -void do_add_static_array_element(znode *result, znode *offset, znode *expr); -void do_list_init(CLS_D); -void do_list_end(znode *result, znode *expr CLS_DC); -void do_add_list_element(znode *element CLS_DC); -void do_new_list_begin(CLS_D); -void do_new_list_end(CLS_D); - -void do_cast(znode *result, znode *expr, int type CLS_DC); -void do_include_or_eval(int type, znode *result, znode *op1 CLS_DC); - -void do_unset(znode *variable CLS_DC); -void do_isset_or_isempty(int type, znode *result, znode *variable CLS_DC); - -void do_foreach_begin(znode *foreach_token, znode *array, znode *open_brackets_token, znode *as_token CLS_DC); -void do_foreach_cont(znode *value, znode *key, znode *as_token CLS_DC); -void do_foreach_end(znode *foreach_token, znode *open_brackets_token CLS_DC); - -void do_end_heredoc(CLS_D); - -void do_exit(znode *result, znode *message CLS_DC); - -void do_begin_silence(znode *strudel_token CLS_DC); -void do_end_silence(znode *strudel_token CLS_DC); - -void do_begin_qm_op(znode *cond, znode *qm_token CLS_DC); -void do_qm_true(znode *true_value, znode *qm_token, znode *colon_token CLS_DC); -void do_qm_false(znode *result, znode *false_value, znode *qm_token, znode *colon_token CLS_DC); - -void do_extended_info(CLS_D); -void do_extended_fcall_begin(CLS_D); -void do_extended_fcall_end(CLS_D); - -#define INITIAL_OP_ARRAY_SIZE 64 - - -/* helper functions in zend-scanner.l */ -BEGIN_EXTERN_C() -ZEND_API int require_file(zend_file_handle *file_handle, zend_bool unique CLS_DC); -ZEND_API int require_filename(char *filename CLS_DC); -ZEND_API int use_filename(char *filename, uint filename_length CLS_DC); -ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...); -ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count, va_list files); -ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC); -ZEND_API zend_op_array *compile_filename(zval *filename, zend_bool unique CLS_DC); -ZEND_API int open_file_for_scanning(zend_file_handle *file_handle CLS_DC); -ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size); -ZEND_API void destroy_op_array(zend_op_array *op_array); -ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC); -ZEND_API void zend_open_file_dtor(zend_file_handle *fh); -END_EXTERN_C() - -ZEND_API int destroy_zend_function(zend_function *function); -ZEND_API int destroy_zend_class(zend_class_entry *ce); -void zend_class_add_ref(zend_class_entry *ce); - -#define ZEND_FUNCTION_DTOR (int (*)(void *)) destroy_zend_function -#define ZEND_CLASS_DTOR (int (*)(void *)) destroy_zend_class - -zend_op *get_next_op(zend_op_array *op_array CLS_DC); -void init_op(zend_op *op CLS_DC); -int get_next_op_number(zend_op_array *op_array); -int print_class(zend_class_entry *class_entry); -void print_op_array(zend_op_array *op_array, int optimizations); -BEGIN_EXTERN_C() -int pass_two(zend_op_array *op_array); -void pass_include_eval(zend_op_array *op_array); -END_EXTERN_C() -zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array); - - -int zendlex(znode *zendlval CLS_DC); - - -#define ZEND_NOP 0 - -#define ZEND_ADD 1 -#define ZEND_SUB 2 -#define ZEND_MUL 3 -#define ZEND_DIV 4 -#define ZEND_MOD 5 -#define ZEND_SL 6 -#define ZEND_SR 7 -#define ZEND_CONCAT 8 -#define ZEND_BW_OR 9 -#define ZEND_BW_AND 10 -#define ZEND_BW_XOR 11 -#define ZEND_BW_NOT 12 -#define ZEND_BOOL_NOT 13 -#define ZEND_BOOL_XOR 14 -#define ZEND_IS_IDENTICAL 15 -#define ZEND_IS_EQUAL 16 -#define ZEND_IS_NOT_EQUAL 17 -#define ZEND_IS_SMALLER 18 -#define ZEND_IS_SMALLER_OR_EQUAL 19 -#define ZEND_CAST 20 -#define ZEND_QM_ASSIGN 21 - -#define ZEND_ASSIGN_ADD 22 -#define ZEND_ASSIGN_SUB 23 -#define ZEND_ASSIGN_MUL 24 -#define ZEND_ASSIGN_DIV 25 -#define ZEND_ASSIGN_MOD 26 -#define ZEND_ASSIGN_SL 27 -#define ZEND_ASSIGN_SR 28 -#define ZEND_ASSIGN_CONCAT 29 -#define ZEND_ASSIGN_BW_OR 30 -#define ZEND_ASSIGN_BW_AND 31 -#define ZEND_ASSIGN_BW_XOR 32 - -#define ZEND_PRE_INC 33 -#define ZEND_PRE_DEC 34 -#define ZEND_POST_INC 35 -#define ZEND_POST_DEC 36 - -#define ZEND_ASSIGN 37 -#define ZEND_ASSIGN_REF 38 - -#define ZEND_ECHO 39 -#define ZEND_PRINT 40 - -#define ZEND_JMP 41 -#define ZEND_JMPZ 42 -#define ZEND_JMPNZ 43 -#define ZEND_JMPZNZ 44 -#define ZEND_JMPZ_EX 45 -#define ZEND_JMPNZ_EX 46 -#define ZEND_CASE 47 -#define ZEND_SWITCH_FREE 48 -#define ZEND_BRK 49 -#define ZEND_CONT 50 -#define ZEND_BOOL 51 - -#define ZEND_INIT_STRING 52 -#define ZEND_ADD_CHAR 53 -#define ZEND_ADD_STRING 54 -#define ZEND_ADD_VAR 55 - -#define ZEND_BEGIN_SILENCE 56 -#define ZEND_END_SILENCE 57 - -#define ZEND_INIT_FCALL_BY_NAME 58 -#define ZEND_DO_FCALL 59 -#define ZEND_DO_FCALL_BY_NAME 60 -#define ZEND_RETURN 61 - -#define ZEND_RECV 62 -#define ZEND_RECV_INIT 63 - -#define ZEND_SEND_VAL 64 -#define ZEND_SEND_VAR 65 -#define ZEND_SEND_REF 66 - -#define ZEND_NEW 67 -#define ZEND_JMP_NO_CTOR 68 -#define ZEND_FREE 69 - -#define ZEND_INIT_ARRAY 70 -#define ZEND_ADD_ARRAY_ELEMENT 71 - -#define ZEND_INCLUDE_OR_EVAL 72 - -#define ZEND_UNSET_VAR 73 -#define ZEND_UNSET_DIM_OBJ 74 -#define ZEND_ISSET_ISEMPTY 75 - -#define ZEND_FE_RESET 76 -#define ZEND_FE_FETCH 77 - -#define ZEND_EXIT 78 - - -/* the following 15 opcodes are 5 groups of 3 opcodes each, and must - * remain in that order! - */ -#define ZEND_FETCH_R 79 -#define ZEND_FETCH_DIM_R 80 -#define ZEND_FETCH_OBJ_R 81 -#define ZEND_FETCH_W 82 -#define ZEND_FETCH_DIM_W 83 -#define ZEND_FETCH_OBJ_W 84 -#define ZEND_FETCH_RW 85 -#define ZEND_FETCH_DIM_RW 86 -#define ZEND_FETCH_OBJ_RW 87 -#define ZEND_FETCH_IS 88 -#define ZEND_FETCH_DIM_IS 89 -#define ZEND_FETCH_OBJ_IS 90 -#define ZEND_FETCH_FUNC_ARG 91 -#define ZEND_FETCH_DIM_FUNC_ARG 92 -#define ZEND_FETCH_OBJ_FUNC_ARG 93 - -#define ZEND_FETCH_DIM_TMP_VAR 94 -#define ZEND_FETCH_CONSTANT 95 - -#define ZEND_DECLARE_FUNCTION_OR_CLASS 96 - -#define ZEND_EXT_STMT 97 -#define ZEND_EXT_FCALL_BEGIN 98 -#define ZEND_EXT_FCALL_END 99 -#define ZEND_EXT_NOP 100 - -/* end of block */ - - - - -/* global/local fetches */ -#define ZEND_FETCH_GLOBAL 0 -#define ZEND_FETCH_LOCAL 1 -#define ZEND_FETCH_STATIC 2 - -/* var status for backpatching */ -#define BP_VAR_R 0 -#define BP_VAR_W 1 -#define BP_VAR_RW 2 -#define BP_VAR_IS 3 -#define BP_VAR_NA 4 /* if not applicable */ -#define BP_VAR_FUNC_ARG 5 - - -#define ZEND_INTERNAL_FUNCTION 1 -#define ZEND_USER_FUNCTION 2 -#define ZEND_OVERLOADED_FUNCTION 3 -#define ZEND_EVAL_CODE 4 - -#define ZEND_INTERNAL_CLASS 1 -#define ZEND_USER_CLASS 2 - -#define ZEND_EVAL (1<<0) -#define ZEND_INCLUDE (1<<1) -#define ZEND_IMPORT (1<<2) - -#define ZEND_ISSET (1<<0) -#define ZEND_ISEMPTY (1<<1) - -#define ZEND_CT (1<<0) -#define ZEND_RT (1<<1) - - -#define ZEND_HANDLE_FILENAME 0 -#define ZEND_HANDLE_FD 1 -#define ZEND_HANDLE_FP 2 -#define ZEND_HANDLE_STDIOSTREAM 3 -#define ZEND_HANDLE_FSTREAM 4 - -#define ZEND_DECLARE_CLASS 1 -#define ZEND_DECLARE_FUNCTION 2 -#define ZEND_DECLARE_INHERITED_CLASS 3 - -#define ZEND_FETCH_STANDARD 0 -#define ZEND_FETCH_ADD_LOCK 1 - -#define ZEND_MEMBER_FUNC_CALL 1<<0 -#define ZEND_CTOR_CALL 1<<1 - - -#define AI_USE_PTR(ai) \ - if ((ai).ptr_ptr) { \ - (ai).ptr = *((ai).ptr_ptr); \ - (ai).ptr_ptr = &((ai).ptr); \ - } else { \ - (ai).ptr = NULL; \ - } - -#define PZVAL_IS_REF(z) ((z)->is_ref) - -#define PZVAL_LOCK(z) ((z)->refcount++) -#define PZVAL_UNLOCK(z) { ((z)->refcount--); \ - if (!(z)->refcount) { \ - EG(garbage)[EG(garbage_ptr)++] = (z); \ - if (EG(garbage_ptr) == 4) { \ - zval_dtor(EG(garbage)[0]); \ - efree(EG(garbage)[0]); \ - zval_dtor(EG(garbage)[1]); \ - efree(EG(garbage)[1]); \ - EG(garbage)[0] = EG(garbage)[2]; \ - EG(garbage)[1] = EG(garbage)[3]; \ - EG(garbage_ptr) -= 2; \ - } \ - } \ - } - -#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); } - - -/* Lost In Stupid Parentheses */ -#define ARG_SHOULD_BE_SENT_BY_REF(offset, conduct_check, arg_types) \ - ( \ - conduct_check \ - && arg_types \ - && \ - ( \ - ( \ - offset<=arg_types[0] \ - && arg_types[offset]==BYREF_FORCE \ - ) \ - || ( \ - offset>=arg_types[0] \ - && arg_types[arg_types[0]]==BYREF_FORCE_REST \ - ) \ - ) \ - ) - -#endif /* _COMPILE_H */ diff --git a/Zend/zend_config.w32.h b/Zend/zend_config.w32.h deleted file mode 100644 index 08fe908c5b..0000000000 --- a/Zend/zend_config.w32.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_CONFIG_W32_H -#define _ZEND_CONFIG_W32_H - - -#include -#include - -typedef unsigned long ulong; -typedef unsigned int uint; - -#define HAVE_ALLOCA 1 -#define HAVE_LIMITS_H 1 -#include - -#undef HAVE_KILL -#define HAVE_GETPID 1 -/* #define HAVE_ALLOCA_H 1 */ -#define HAVE_MEMCPY 1 -#define HAVE_STRDUP 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIOSTR_H 1 -#define HAVE_CLASS_ISTDIOSTREAM -#define istdiostream stdiostream - -#ifdef inline -#undef inline -#endif - -#define zend_sprintf sprintf - -/* Visual C++ doesn't really work with inline for C */ -#define inline - - -#define DL_LOAD(libname) LoadLibrary(libname) -#define DL_FETCH_SYMBOL GetProcAddress -#define DL_UNLOAD FreeLibrary -#define DL_HANDLE HMODULE -#define ZEND_EXTENSIONS_SUPPORT 1 - -#ifdef LIBZEND_EXPORTS -# define ZEND_API __declspec(dllexport) -#else -# define ZEND_API __declspec(dllimport) -#endif - -#endif /* _ZEND_CONFIG_W32_H */ diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c deleted file mode 100644 index 345c246ae5..0000000000 --- a/Zend/zend_constants.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_constants.h" -#include "zend_variables.h" -#include "zend_operators.h" -#include "zend_globals.h" - - -int free_zend_constant(zend_constant *c) -{ - if (!(c->flags & CONST_PERSISTENT)) { - zval_dtor(&c->value); - } - free(c->name); - return 1; -} - - -void copy_zend_constant(zend_constant *c) -{ - c->name = zend_strndup(c->name, c->name_len); - zval_copy_ctor(&c->value); -} - - -void zend_copy_constants(HashTable *target, HashTable *source) -{ - zend_constant tmp_constant; - - zend_hash_copy(target, source, (void (*)(void *)) copy_zend_constant, &tmp_constant, sizeof(zend_constant)); -} - - -static int clean_non_persistent_constant(zend_constant *c) -{ - if (c->flags & CONST_PERSISTENT) { - return 0; - } else { - return 1; - } -} - - -static int clean_module_constant(zend_constant *c, int *module_number) -{ - if (c->module_number == *module_number) { - return 1; - } else { - return 0; - } -} - - -void clean_module_constants(int module_number) -{ - ELS_FETCH(); - - zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number); -} - - -int zend_startup_constants(ELS_D) -{ -#if WIN32|WINNT - DWORD dwBuild=0; - DWORD dwVersion = GetVersion(); - DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); - DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); -#endif - - EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable)); - - if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) { - return FAILURE; - } - return SUCCESS; -} - - - -void zend_register_standard_constants(ELS_D) -{ - /* ZEND_FIX: Move to PHP */ -#if 0 -#if WIN32|WINNT - /* Get build numbers for Windows NT or Win95 */ - if (dwVersion < 0x80000000){ - php3_os="WINNT"; - } else { - php3_os="WIN32"; - } -#else - php3_os=PHP_OS; -#endif -#endif - - -#if 0 - /* This should go back to PHP */ - REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php3_os, strlen(php3_os), CONST_PERSISTENT | CONST_CS); -#endif - REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS); - REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS); - - REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS); - - /* true/false constants */ - { - zend_constant c; - - c.value.type = IS_BOOL; - c.flags = CONST_PERSISTENT; - c.module_number = 0; - - c.name = zend_strndup("TRUE",4); - c.name_len = 5; - c.value.value.lval = 1; - c.value.type = IS_BOOL; - zend_register_constant(&c ELS_CC); - - c.name = zend_strndup("FALSE",5); - c.name_len = 6; - c.value.value.lval = 0; - c.value.type = IS_BOOL; - zend_register_constant(&c ELS_CC); - } -} - - -int zend_shutdown_constants(ELS_D) -{ - zend_hash_destroy(EG(zend_constants)); - free(EG(zend_constants)); - return SUCCESS; -} - - -void clean_non_persistent_constants(void) -{ - ELS_FETCH(); - - zend_hash_apply(EG(zend_constants), (int (*)(void *)) clean_non_persistent_constant); -} - - -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC) -{ - zend_constant c; - - c.value.type = IS_LONG; - c.value.value.lval = lval; - c.flags = flags; - c.name = zend_strndup(name,name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c ELS_CC); -} - - -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC) -{ - zend_constant c; - - c.value.type = IS_DOUBLE; - c.value.value.dval = dval; - c.flags = flags; - c.name = zend_strndup(name,name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c ELS_CC); -} - - -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC) -{ - zend_constant c; - - c.value.type = IS_STRING; - c.value.value.str.val = strval; - c.value.value.str.len = strlen; - c.flags = flags; - c.name = zend_strndup(name,name_len); - c.name_len = name_len; - c.module_number = module_number; - zend_register_constant(&c ELS_CC); -} - - -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC) -{ - zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number ELS_CC); -} - - -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result) -{ - zend_constant *c; - char *lookup_name = estrndup(name,name_len); - int retval; - ELS_FETCH(); - - zend_str_tolower(lookup_name, name_len); - - if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) { - if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) { - retval=0; - } else { - retval=1; - *result = c->value; - zval_copy_ctor(result); - } - } else { - retval=0; - } - - efree(lookup_name); - return retval; -} - - -ZEND_API void zend_register_constant(zend_constant *c ELS_DC) -{ - char *lowercase_name = zend_strndup(c->name, c->name_len); - -#if 0 - printf("Registering constant for module %d\n",c->module_number); -#endif - - zend_str_tolower(lowercase_name, c->name_len); - if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) { - zval_dtor(&c->value); - } - free(lowercase_name); -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h deleted file mode 100644 index 9722979f94..0000000000 --- a/Zend/zend_constants.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _CONSTANTS_H -#define _CONSTANTS_H - -#include "zend_globals.h" - -#define CONST_CS 0x1 /* Case Sensitive */ -#define CONST_PERSISTENT 0x2 - -typedef struct _zend_constant { - zval value; - int flags; - char *name; - uint name_len; - int module_number; -} zend_constant; - -#define REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),module_number ELS_CC) -#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number ELS_CC) -#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number ELS_CC) -#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number ELS_CC) - -#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0 ELS_CC) -#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0 ELS_CC) -#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0 ELS_CC) -#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 ELS_CC) - -void clean_module_constants(int module_number); -int free_zend_constant(zend_constant *c); -int zend_startup_constants(ELS_D); -int zend_shutdown_constants(ELS_D); -void zend_register_standard_constants(ELS_D); -void clean_non_persistent_constants(void); -ZEND_API int zend_get_constant(char *name, uint name_len, zval *result); -ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC); -ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC); -ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC); -ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC); -ZEND_API void zend_register_constant(zend_constant *c ELS_DC); -void zend_copy_constants(HashTable *target, HashTable *sourc); -void copy_zend_constant(zend_constant *c); - -#define ZEND_CONSTANT_DTOR (int (*)(void *)) free_zend_constant - -#endif diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h deleted file mode 100644 index 36b6123d14..0000000000 --- a/Zend/zend_errors.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_ERRORS_H -#define _ZEND_ERRORS_H - -#define E_ERROR (1<<0L) -#define E_WARNING (1<<1L) -#define E_PARSE (1<<2L) -#define E_NOTICE (1<<3L) -#define E_CORE_ERROR (1<<4L) -#define E_CORE_WARNING (1<<5L) -#define E_COMPILE_ERROR (1<<6L) -#define E_COMPILE_WARNING (1<<7L) - -#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING) -#define E_CORE (E_CORE_ERROR | E_CORE_WARNING) - -#endif /* _ZEND_ERRORS_H */ - diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c deleted file mode 100644 index b1ebfb0b86..0000000000 --- a/Zend/zend_execute.c +++ /dev/null @@ -1,2128 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include -#include - -#include "zend.h" -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" -#include "zend_variables.h" -#include "zend_operators.h" -#include "zend_constants.h" -#include "zend_extensions.h" - -#if defined(HAVE_ALLOCA) && defined(HAVE_ALLOCA_H) -# include -#endif - -#define get_zval_ptr(node, Ts, should_free, type) _get_zval_ptr(node, Ts, should_free ELS_CC) -#define get_zval_ptr_ptr(node, Ts, type) _get_zval_ptr_ptr(node, Ts ELS_CC) - -#define get_incdec_op(op, opcode) \ - switch (opcode) { \ - case ZEND_PRE_INC: \ - case ZEND_POST_INC: \ - (op) = increment_function; \ - break; \ - case ZEND_PRE_DEC: \ - case ZEND_POST_DEC: \ - (op) = decrement_function; \ - break; \ - default: \ - (op) = NULL; \ - break; \ - } \ - -/* These globals don't have to be thread safe since they're never modified */ - - -/* Prototypes */ -static zval get_overloaded_property(ELS_D); -static void set_overloaded_property(zval *value ELS_DC); -static void call_overloaded_function(int arg_count, zval *return_value, HashTable *list, HashTable *plist ELS_DC); -static inline void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC); -static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC); -static inline void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC); -static inline void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts ELS_DC); -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array); -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array); -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array); - - - -#define SEPARATE_ON_READ_OBJECT(obj, _type) \ -if ((obj) && ((_type) == BP_VAR_R) && ((*(obj))->type == IS_OBJECT) && (!(*(obj))->is_ref)) { \ - SEPARATE_ZVAL((obj)); \ - (*(obj))->is_ref = 1; \ - } - -static inline zval *_get_zval_ptr(znode *node, temp_variable *Ts, int *should_free ELS_DC) -{ - switch(node->op_type) { - case IS_CONST: - *should_free = 0; - return &node->u.constant; - break; - case IS_TMP_VAR: - *should_free = 1; - return &Ts[node->u.var].tmp_var; - break; - case IS_VAR: - if (Ts[node->u.var].var.ptr) { - PZVAL_UNLOCK(Ts[node->u.var].var.ptr); - *should_free = 0; - return Ts[node->u.var].var.ptr; - } else { - *should_free = 1; - - switch (Ts[node->u.var].EA.type) { - case IS_OVERLOADED_OBJECT: - Ts[node->u.var].tmp_var = get_overloaded_property(ELS_C); - Ts[node->u.var].tmp_var.refcount=1; - Ts[node->u.var].tmp_var.is_ref=1; - return &Ts[node->u.var].tmp_var; - break; - case IS_STRING_OFFSET: { - temp_variable *T = &Ts[node->u.var]; - zval *str = T->EA.str; - - if (T->EA.str->type != IS_STRING - || (T->EA.str->value.str.len <= T->EA.offset)) { - T->tmp_var.value.str.val = empty_string; - T->tmp_var.value.str.len = 0; - } else { - char c = str->value.str.val[T->EA.offset]; - - T->tmp_var.value.str.val = estrndup(&c, 1); - T->tmp_var.value.str.len = 1; - } - PZVAL_UNLOCK(str); - T->tmp_var.refcount=1; - T->tmp_var.is_ref=1; - T->tmp_var.type = IS_STRING; - return &T->tmp_var; - } - break; - } - } - break; - case IS_UNUSED: - *should_free = 0; - return NULL; - break; -#if DEBUG_ZEND - default: - zend_error(E_ERROR, "Unknown temporary variable type"); - break; -#endif - } - return NULL; -} - -static inline zval *_get_object_zval_ptr(znode *node, temp_variable *Ts, int *should_free ELS_DC) -{ - switch(node->op_type) { - case IS_TMP_VAR: - *should_free = 1; - return &Ts[node->u.var].tmp_var; - break; - case IS_VAR: - if (Ts[node->u.var].var.ptr) { - PZVAL_UNLOCK(Ts[node->u.var].var.ptr); - *should_free = 0; - return Ts[node->u.var].var.ptr; - } else { - if (Ts[node->u.var].EA.type==IS_STRING_OFFSET) { - PZVAL_UNLOCK(Ts[node->u.var].EA.str); - } - *should_free = 1; - return NULL; - } - break; - case IS_UNUSED: - return NULL; - break; -#if DEBUG_ZEND - default: - zend_error(E_ERROR, "Unknown temporary variable type"); - break; -#endif - } - return NULL; -} - - -static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts ELS_DC) -{ - switch(node->op_type) { - case IS_VAR: - if (Ts[node->u.var].var.ptr_ptr) { - PZVAL_UNLOCK(*Ts[node->u.var].var.ptr_ptr); - } else if (Ts[node->u.var].EA.type==IS_STRING_OFFSET) { - PZVAL_UNLOCK(Ts[node->u.var].EA.str); - } - return Ts[node->u.var].var.ptr_ptr; - break; - default: - return NULL; - break; - } -} - -static inline zval **zend_fetch_property_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC) -{ - int free_op2; - zval *prop_ptr = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); - zval **retval; - zval tmp; - - - switch (op2->op_type) { - case IS_CONST: - /* already a constant string */ - break; - case IS_VAR: - tmp = *prop_ptr; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - prop_ptr = &tmp; - break; - case IS_TMP_VAR: - convert_to_string(prop_ptr); - break; - } - - if (zend_hash_find(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined property: %s", prop_ptr->value.str.val); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined property: %s", prop_ptr->value.str.val); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_update_ptr(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - - if (prop_ptr == &tmp) { - zval_dtor(prop_ptr); - } - FREE_OP(op2, free_op2); - return retval; -} - - -static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts ELS_DC) -{ - zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W); - zval *variable_ptr; - - if (!variable_ptr_ptr) { - switch (Ts[op1->u.var].EA.type) { - case IS_OVERLOADED_OBJECT: - set_overloaded_property(value ELS_CC); - if (type == IS_TMP_VAR) { - zval_dtor(value); - } - break; - case IS_STRING_OFFSET: { - temp_variable *T = &Ts[op1->u.var]; - - if (T->EA.str->type == IS_STRING - && (T->EA.offset < T->EA.str->value.str.len)) { - zval tmp; - zval *final_value = value; - - if (value->type!=IS_STRING) { - tmp = *value; - if (op2 && op2->op_type == IS_VAR) { - zval_copy_ctor(&tmp); - } - convert_to_string(&tmp); - final_value = &tmp; - } - - T->EA.str->value.str.val[T->EA.offset] = final_value->value.str.val[0]; - if (op2 - && op2->op_type == IS_VAR - && value==&Ts[op2->u.var].tmp_var) { - efree(value->value.str.val); - } - if (final_value == &tmp) { - zval_dtor(final_value); - } - /* - * the value of an assignment to a string offset is undefined - Ts[result->u.var].var = &T->EA.str; - */ - } - /* zval_ptr_dtor(&T->EA.str); Nuke this line if it doesn't cause a leak */ - T->tmp_var.type = IS_STRING; - } - break; - } - Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result); - AI_USE_PTR(Ts[result->u.var].var); - return; - } - - variable_ptr = *variable_ptr_ptr; - - if (variable_ptr == EG(error_zval_ptr)) { - if (result) { - Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result); - AI_USE_PTR(Ts[result->u.var].var); - } - return; - } - - if (PZVAL_IS_REF(variable_ptr)) { - if (variable_ptr!=value) { - short refcount=variable_ptr->refcount; - - if (type!=IS_TMP_VAR) { - value->refcount++; - } - zendi_zval_dtor(*variable_ptr); - *variable_ptr = *value; - variable_ptr->refcount = refcount; - variable_ptr->is_ref = 1; - if (type!=IS_TMP_VAR) { - zendi_zval_copy_ctor(*variable_ptr); - zval_ptr_dtor(&value); - } - } - } else { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - switch (type) { - case IS_VAR: - /* - if (PZVAL_IS_LOCKED(value)) { - zval *orig_value = value; - - value = (zval *) emalloc(sizeof(zval)); - *value = *orig_value; - value->refcount=0; - zval_copy_ctor(value); - } - */ - /* break missing intentionally */ - case IS_CONST: - if (variable_ptr==value) { - variable_ptr->refcount++; - } else if (PZVAL_IS_REF(value)) { - zval tmp = *value; - - tmp = *value; - zval_copy_ctor(&tmp); - tmp.refcount=1; - zendi_zval_dtor(*variable_ptr); - *variable_ptr = tmp; - } else { - value->refcount++; - zendi_zval_dtor(*variable_ptr); - safe_free_zval_ptr(variable_ptr); - *variable_ptr_ptr = value; - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(*variable_ptr); - value->refcount=1; - *variable_ptr = *value; - break; - } - } else { /* we need to split */ - switch (type) { - case IS_VAR: - /* - if (PZVAL_IS_LOCKED(value)) { - zval *orig_value = value; - - value = (zval *) emalloc(sizeof(zval)); - *value = *orig_value; - value->refcount=0; - zval_copy_ctor(value); - } - */ - /* break missing intentionally */ - case IS_CONST: - if (PZVAL_IS_REF(value)) { - variable_ptr = *variable_ptr_ptr = (zval *) emalloc(sizeof(zval)); - *variable_ptr = *value; - zval_copy_ctor(variable_ptr); - variable_ptr->refcount=1; - break; - } - *variable_ptr_ptr = value; - value->refcount++; - break; - case IS_TMP_VAR: - (*variable_ptr_ptr) = (zval *) emalloc(sizeof(zval)); - value->refcount=1; - **variable_ptr_ptr = *value; - break; - } - } - (*variable_ptr_ptr)->is_ref=0; - } - if (result) { - Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr; - SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result); - AI_USE_PTR(Ts[result->u.var].var); - } -} - - -/* Utility Functions for Extensions */ -static void zend_extension_statement_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->statement_handler) { - extension->statement_handler(op_array); - } -} - - -static void zend_extension_fcall_begin_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->fcall_begin_handler) { - extension->fcall_begin_handler(op_array); - } -} - - -static void zend_extension_fcall_end_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->fcall_end_handler) { - extension->fcall_end_handler(op_array); - } -} - - -static void print_refcount(zval *p, char *str) -{ - print_refcount(NULL, NULL); -} - - -static inline void zend_fetch_var_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC) -{ - int free_op1; - zval *varname = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R); - zval **retval; - zval tmp_varname; - HashTable *target_symbol_table; - - switch (op2->u.fetch_type) { - case ZEND_FETCH_LOCAL: - default: /* just to shut gcc up */ - target_symbol_table = EG(active_symbol_table); - break; - case ZEND_FETCH_GLOBAL: - if (op1->op_type == IS_VAR) { - PZVAL_LOCK(varname); - } - target_symbol_table = &EG(symbol_table); - break; - case ZEND_FETCH_STATIC: - if (!EG(active_op_array)->static_variables) { - EG(active_op_array)->static_variables = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, PVAL_PTR_DTOR, 0); - } - target_symbol_table = EG(active_op_array)->static_variables; - break; - } - - if (varname->type != IS_STRING) { - tmp_varname = *varname; - zval_copy_ctor(&tmp_varname); - convert_to_string(&tmp_varname); - varname = &tmp_varname; - } - if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_update_ptr(target_symbol_table, varname->value.str.val, varname->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - if (op2->u.fetch_type == ZEND_FETCH_LOCAL) { - FREE_OP(op1, free_op1); - } else if (op2->u.fetch_type == ZEND_FETCH_STATIC) { - zval_update_constant(retval); - } - - if (varname == &tmp_varname) { - zval_dtor(varname); - } - Ts[result->u.var].var.ptr_ptr = retval; - SEPARATE_ON_READ_OBJECT(retval, type); - SELECTIVE_PZVAL_LOCK(*retval, result); -} - - -static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC) -{ - int free_op2; - zval *dim = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); - zval **retval; - - switch (dim->type) { - case IS_STRING: { - if (zend_hash_find(ht, dim->value.str.val, dim->value.str.len+1, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined index: %s", dim->value.str.val); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", dim->value.str.val); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_update_ptr(ht, dim->value.str.val, dim->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - } - break; - case IS_DOUBLE: - case IS_RESOURCE: - case IS_LONG: { - long index; - - if (dim->type == IS_LONG || dim->type == IS_RESOURCE) { - index = dim->value.lval; - } else { - index = (long)dim->value.dval; - } - if (zend_hash_index_find(ht, index, (void **) &retval) == FAILURE) { - switch (type) { - case BP_VAR_R: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_IS: - retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined offset: %d", index); - /* break missing intentionally */ - case BP_VAR_W: { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_index_update(ht, index, &new_zval, sizeof(zval *), (void **) &retval); - } - break; - } - } - } - break; - default: - zend_error(E_WARNING, "Illegal offset type"); - if (type == BP_VAR_R || type == BP_VAR_IS) { - retval = &EG(uninitialized_zval_ptr); - } else { - retval = &EG(error_zval_ptr); - } - break; - } - FREE_OP(op2, free_op2); - return retval; -} - - -static inline void zend_fetch_dimension_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC) -{ - int free_op2; - zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type); - zval *container; - zval ***retval = &Ts[result->u.var].var.ptr_ptr; - - - if (container_ptr == NULL) { - zend_property_reference *property_reference; - zend_overloaded_element overloaded_element; - - if (Ts[op1->u.var].EA.type == IS_STRING_OFFSET) { - zval_ptr_dtor(&Ts[op1->u.var].EA.str); - switch (type) { - case BP_VAR_R: - case BP_VAR_IS: - *retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_W: - case BP_VAR_RW: - *retval = &EG(error_zval_ptr); - break; - } - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - /* prepare the new element */ - overloaded_element.element = *get_zval_ptr(op2, Ts, &free_op2, type); - overloaded_element.type = IS_ARRAY; - if (!free_op2) { - zval_copy_ctor(&overloaded_element.element); - } - - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - - zend_llist_add_element(&property_reference->elements_list, &overloaded_element); - - Ts[result->u.var].EA.type = IS_OVERLOADED_OBJECT; - *retval = NULL; - return; - } - container = *container_ptr; - - if (container == EG(error_zval_ptr)) { - *retval = &EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - if (container->type == IS_STRING && container->value.str.len==0) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - container->refcount--; - if (container->refcount>0) { - container = *container_ptr = (zval *) emalloc(sizeof(zval)); - container->is_ref=0; - } - container->refcount=1; - } - array_init(container); - break; - } - } - - switch (container->type) { - case IS_ARRAY: - if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { - container->refcount--; - *container_ptr = (zval *) emalloc(sizeof(zval)); - **container_ptr = *container; - container = *container_ptr; - INIT_PZVAL(container); - zendi_zval_copy_ctor(*container); - } - if (op2->op_type == IS_UNUSED) { - zval *new_zval = &EG(uninitialized_zval); - - new_zval->refcount++; - zend_hash_next_index_insert_ptr(container->value.ht, new_zval, sizeof(zval *), (void **) retval); - } else { - *retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type ELS_CC); - } - SEPARATE_ON_READ_OBJECT(*retval, type); - SELECTIVE_PZVAL_LOCK(**retval, result); - break; - case IS_STRING: { - zval *offset; - offset = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); - - if (container->value.str.val == undefined_variable_string) { - /* for read-mode only */ - *retval = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - FREE_OP(op2, free_op2); - } else { - zval tmp; - - if (offset->type != IS_LONG) { - tmp = *offset; - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - offset = &tmp; - } - if (!container->is_ref && type!=BP_VAR_R && type!=BP_VAR_IS) { - SEPARATE_ZVAL(container_ptr); - } - container = *container_ptr; - Ts[result->u.var].EA.str = container; - PZVAL_LOCK(container); - Ts[result->u.var].EA.offset = offset->value.lval; - Ts[result->u.var].EA.type = IS_STRING_OFFSET; - FREE_OP(op2, free_op2); - *retval = NULL; - return; - } - } - break; - default: { - zval *offset; - - offset = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); - if (type==BP_VAR_R || type==BP_VAR_IS) { - *retval = &EG(uninitialized_zval_ptr); - } else { - *retval = &EG(error_zval_ptr); - } - FREE_OP(op2, free_op2); - SELECTIVE_PZVAL_LOCK(**retval, result); - } - break; - } -} - - -static inline void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts ELS_DC) -{ - int free_op1; - zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R); - - if (container->type != IS_ARRAY) { - Ts[result->u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result); - return; - } - - Ts[result->u.var].var.ptr_ptr = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R ELS_CC); - SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var.ptr_ptr, result); -} - - -static inline void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC) -{ - int free_op2; - zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type); - zval *container; - zval ***retval = &Ts[result->u.var].var.ptr_ptr; - - - if (container_ptr == NULL) { - zend_property_reference *property_reference; - zend_overloaded_element overloaded_element; - - if (Ts[op1->u.var].EA.type == IS_STRING_OFFSET) { - zval_ptr_dtor(&Ts[op1->u.var].EA.str); - switch (type) { - case BP_VAR_R: - case BP_VAR_IS: - *retval = &EG(uninitialized_zval_ptr); - break; - case BP_VAR_W: - case BP_VAR_RW: - *retval = &EG(error_zval_ptr); - break; - } - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - overloaded_element.element = *get_zval_ptr(op2, Ts, &free_op2, type); - overloaded_element.type = IS_OBJECT; - if (!free_op2) { - zval_copy_ctor(&overloaded_element.element); - } - - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - - zend_llist_add_element(&property_reference->elements_list, &overloaded_element); - - Ts[result->u.var].EA.type = IS_OVERLOADED_OBJECT; - *retval = NULL; - return; - } - - container = *container_ptr; - if (container == EG(error_zval_ptr)) { - *retval = &EG(error_zval_ptr); - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - if (container->type == IS_OBJECT - && container->value.obj.ce->handle_property_get) { - zend_property_reference property_reference; - zend_overloaded_element overloaded_element; - - property_reference.object = container; - property_reference.type = type; - zend_llist_init(&property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0); - overloaded_element.element = *get_zval_ptr(op2, Ts, &free_op2, type); - overloaded_element.type = IS_OBJECT; - if (!free_op2) { - zval_copy_ctor(&overloaded_element.element); - } - zend_llist_add_element(&property_reference.elements_list, &overloaded_element); - zend_stack_push(&EG(overloaded_objects_stack), &property_reference, sizeof(zend_property_reference)); - Ts[result->u.var].EA.type = IS_OVERLOADED_OBJECT; - *retval = NULL; - return; - } - - - - if (container->type == IS_STRING && container->value.str.len==0) { - switch (type) { - case BP_VAR_RW: - case BP_VAR_W: - if (!PZVAL_IS_REF(container)) { - container->refcount--; - if (container->refcount>0) { - container = *container_ptr = (zval *) emalloc(sizeof(zval)); - container->is_ref=0; - } - container->refcount=1; - } - object_init(container); - break; - } - } - - if (container->type != IS_OBJECT) { - zval *offset; - - offset = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R); - FREE_OP(op2, free_op2); - if (type==BP_VAR_R || type==BP_VAR_IS) { - *retval = &EG(uninitialized_zval_ptr); - } else { - *retval = &EG(error_zval_ptr); - } - SELECTIVE_PZVAL_LOCK(**retval, result); - return; - } - - - if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) { - container->refcount--; - *container_ptr = (zval *) emalloc(sizeof(zval)); - **container_ptr = *container; - container = *container_ptr; - INIT_PZVAL(container); - zendi_zval_copy_ctor(*container); - } - *retval = zend_fetch_property_address_inner(container->value.obj.properties, op2, Ts, type ELS_CC); - SEPARATE_ON_READ_OBJECT(*retval, type); - SELECTIVE_PZVAL_LOCK(**retval, result); -} - - -static zval get_overloaded_property(ELS_D) -{ - zend_property_reference *property_reference; - zval result; - - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - result = (property_reference->object)->value.obj.ce->handle_property_get(property_reference); - - zend_llist_destroy(&property_reference->elements_list); - - zend_stack_del_top(&EG(overloaded_objects_stack)); - return result; -} - - -static void set_overloaded_property(zval *value ELS_DC) -{ - zend_property_reference *property_reference; - - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - (property_reference->object)->value.obj.ce->handle_property_set(property_reference, value); - - zend_llist_destroy(&property_reference->elements_list); - - zend_stack_del_top(&EG(overloaded_objects_stack)); -} - - -static void call_overloaded_function(int arg_count, zval *return_value, HashTable *list, HashTable *plist ELS_DC) -{ - zend_property_reference *property_reference; - - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - (property_reference->object)->value.obj.ce->handle_function_call(arg_count, return_value, list, plist, property_reference->object, 1, property_reference); - zend_llist_destroy(&property_reference->elements_list); - - zend_stack_del_top(&EG(overloaded_objects_stack)); -} - - -#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && (WINNT|WIN32)) -# define do_alloca(p) alloca(p) -# define free_alloca(p) -#else -# define do_alloca(p) emalloc(p) -# define free_alloca(p) efree(p) -#endif - -typedef struct _object_info { - zval *ptr; -} object_info; - -void execute(zend_op_array *op_array ELS_DC) -{ - zend_op *opline = op_array->opcodes; - zend_op *end = op_array->opcodes + op_array->last; - zend_function_state function_state; - zend_function *fbc=NULL; /* Function Being Called */ - object_info object = {NULL}; -#if !defined (__GNUC__) || __GNUC__ < 2 - temp_variable *Ts = (temp_variable *) do_alloca(sizeof(temp_variable)*op_array->T); -#else - temp_variable Ts[op_array->T]; -#endif - -#if SUPPORT_INTERACTIVE - if (EG(interactive)) { - opline = op_array->opcodes + op_array->start_op_number; - end = op_array->opcodes + op_array->end_op_number; - } -#endif - - EG(opline_ptr) = &opline; - - function_state.function = (zend_function *) op_array; - EG(function_state_ptr) = &function_state; -#if ZEND_DEBUG - /* function_state.function_symbol_table is saved as-is to a stack, - * which is an intentional UMR. Shut it up if we're in DEBUG. - */ - function_state.function_symbol_table = NULL; -#endif - - if (op_array->uses_globals) { - zval *globals = (zval *) emalloc(sizeof(zval)); - - globals->refcount=1; - globals->is_ref=1; - globals->type = IS_ARRAY; - globals->value.ht = &EG(symbol_table); - if (zend_hash_add(EG(active_symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL)==FAILURE) { - efree(globals); - } - } - - while (oplineopcode) { - case ZEND_ADD: - EG(binary_op) = add_function; - goto binary_op_addr; - case ZEND_SUB: - EG(binary_op) = sub_function; - goto binary_op_addr; - case ZEND_MUL: - EG(binary_op) = mul_function; - goto binary_op_addr; - case ZEND_DIV: - EG(binary_op) = div_function; - goto binary_op_addr; - case ZEND_MOD: - EG(binary_op) = mod_function; - goto binary_op_addr; - case ZEND_SL: - EG(binary_op) = shift_left_function; - goto binary_op_addr; - case ZEND_SR: - EG(binary_op) = shift_right_function; - goto binary_op_addr; - case ZEND_CONCAT: - EG(binary_op) = concat_function; - goto binary_op_addr; - case ZEND_IS_IDENTICAL: - EG(binary_op) = is_identical_function; - goto binary_op_addr; - case ZEND_IS_EQUAL: - EG(binary_op) = is_equal_function; - goto binary_op_addr; - case ZEND_IS_NOT_EQUAL: - EG(binary_op) = is_not_equal_function; - goto binary_op_addr; - case ZEND_IS_SMALLER: - EG(binary_op) = is_smaller_function; - goto binary_op_addr; - case ZEND_IS_SMALLER_OR_EQUAL: - EG(binary_op) = is_smaller_or_equal_function; - goto binary_op_addr; - case ZEND_BW_OR: - EG(binary_op) = bitwise_or_function; - goto binary_op_addr; - case ZEND_BW_AND: - EG(binary_op) = bitwise_and_function; - goto binary_op_addr; - case ZEND_BW_XOR: - EG(binary_op) = bitwise_xor_function; - goto binary_op_addr; - case ZEND_BOOL_XOR: - EG(binary_op) = boolean_xor_function; - /* Fall through */ -binary_op_addr: - EG(binary_op)(&Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R), - get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R) ); - FREE_OP(&opline->op1, EG(free_op1)); - FREE_OP(&opline->op2, EG(free_op2)); - break; - case ZEND_BW_NOT: - case ZEND_BOOL_NOT: - EG(unary_op) = get_unary_op(opline->opcode); - EG(unary_op)(&Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R) ); - FREE_OP(&opline->op1, EG(free_op1)); - break; - - case ZEND_ASSIGN_ADD: - EG(binary_op) = add_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_SUB: - EG(binary_op) = sub_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_MUL: - EG(binary_op) = mul_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_DIV: - EG(binary_op) = div_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_MOD: - EG(binary_op) = mod_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_SL: - EG(binary_op) = shift_left_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_SR: - EG(binary_op) = shift_right_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_CONCAT: - EG(binary_op) = concat_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_BW_OR: - EG(binary_op) = bitwise_or_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_BW_AND: - EG(binary_op) = bitwise_and_function; - goto binary_assign_op_addr; - case ZEND_ASSIGN_BW_XOR: - EG(binary_op) = bitwise_xor_function; - /* Fall through */ -binary_assign_op_addr: { - zval **var_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_RW); - - if (!var_ptr) { - zend_error(E_ERROR, "Cannot use assign-op operators with overloaded objects nor string offsets"); - } - if (*var_ptr == EG(error_zval_ptr)) { - Ts[opline->result.u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*Ts[opline->result.u.var].var.ptr_ptr, &opline->result); - AI_USE_PTR(Ts[opline->result.u.var].var); - opline++; - continue; - } - if (!PZVAL_IS_REF(*var_ptr)) { - if ((*var_ptr)->refcount>1) { - zval *orig_var=*var_ptr; - - (*var_ptr)->refcount--; - *var_ptr = (zval *) emalloc(sizeof(zval)); - **var_ptr = *orig_var; - zendi_zval_copy_ctor(**var_ptr); - (*var_ptr)->refcount=1; - } - } - EG(binary_op)(*var_ptr, *var_ptr, get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R)); - Ts[opline->result.u.var].var.ptr_ptr = var_ptr; - SELECTIVE_PZVAL_LOCK(*var_ptr, &opline->result); - FREE_OP(&opline->op2, EG(free_op2)); - AI_USE_PTR(Ts[opline->result.u.var].var); - } - break; - case ZEND_PRE_INC: - case ZEND_PRE_DEC: - case ZEND_POST_INC: - case ZEND_POST_DEC: { - int (*incdec_op)(zval *op); - zval **var_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_RW); - - if (!var_ptr) { - zend_error(E_ERROR, "Cannot increment/decrement overloaded objects nor string offsets"); - } - if (*var_ptr == EG(error_zval_ptr)) { - Ts[opline->result.u.var].var.ptr_ptr = &EG(uninitialized_zval_ptr); - SELECTIVE_PZVAL_LOCK(*Ts[opline->result.u.var].var.ptr_ptr, &opline->result); - AI_USE_PTR(Ts[opline->result.u.var].var); - opline++; - continue; - } - - get_incdec_op(incdec_op, opline->opcode); - - switch (opline->opcode) { - case ZEND_POST_INC: - case ZEND_POST_DEC: - Ts[opline->result.u.var].tmp_var = **var_ptr; - zendi_zval_copy_ctor(Ts[opline->result.u.var].tmp_var); - break; - } - if (!PZVAL_IS_REF(*var_ptr)) { - if ((*var_ptr)->refcount>1) { - zval *orig_var = *var_ptr; - - (*var_ptr)->refcount--; - *var_ptr = (zval *) emalloc(sizeof(zval)); - **var_ptr = *orig_var; - zendi_zval_copy_ctor(**var_ptr); - (*var_ptr)->refcount=1; - } - } - incdec_op(*var_ptr); - switch (opline->opcode) { - case ZEND_PRE_INC: - case ZEND_PRE_DEC: - Ts[opline->result.u.var].var.ptr_ptr = var_ptr; - SELECTIVE_PZVAL_LOCK(*var_ptr, &opline->result); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - } - } - break; - case ZEND_PRINT: - zend_print_variable(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - Ts[opline->result.u.var].tmp_var.value.lval = 1; - Ts[opline->result.u.var].tmp_var.type = IS_LONG; - FREE_OP(&opline->op1, EG(free_op1)); - break; - case ZEND_ECHO: - zend_print_variable(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - FREE_OP(&opline->op1, EG(free_op1)); - break; - case ZEND_FETCH_R: - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_W: - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - break; - case ZEND_FETCH_RW: - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC); - break; - case ZEND_FETCH_FUNC_ARG: - if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) { - /* Behave like FETCH_W */ - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - } else { - /* Behave like FETCH_R */ - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - } - break; - case ZEND_FETCH_IS: - zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_DIM_R: - if (opline->extended_value == ZEND_FETCH_ADD_LOCK) { - PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr); - } - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_DIM_W: - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - break; - case ZEND_FETCH_DIM_RW: - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC); - break; - case ZEND_FETCH_DIM_IS: - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_DIM_FUNC_ARG: - if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) { - /* Behave like FETCH_DIM_W */ - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - } else { - /* Behave like FETCH_DIM_R, except for locking used for list() */ - zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - } - break; - case ZEND_FETCH_OBJ_R: - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_OBJ_W: - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - break; - case ZEND_FETCH_OBJ_RW: - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_RW ELS_CC); - break; - case ZEND_FETCH_OBJ_IS: - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_FETCH_OBJ_FUNC_ARG: - if (ARG_SHOULD_BE_SENT_BY_REF(opline->extended_value, fbc, fbc->common.arg_types)) { - /* Behave like FETCH_OBJ_W */ - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_W ELS_CC); - } else { - zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - } - break; - case ZEND_FETCH_DIM_TMP_VAR: - zend_fetch_dimension_address_from_tmp_var(&opline->result, &opline->op1, &opline->op2, Ts ELS_CC); - AI_USE_PTR(Ts[opline->result.u.var].var); - break; - case ZEND_ASSIGN: { - zval *value = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - - zend_assign_to_variable(&opline->result, &opline->op1, &opline->op2, value, (EG(free_op2)?IS_TMP_VAR:opline->op2.op_type), Ts ELS_CC); - /* zend_assign_to_variable() always takes care of op2, never free it! */ - } - break; - case ZEND_ASSIGN_REF: - zend_assign_to_variable_reference(&opline->result, get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W), get_zval_ptr_ptr(&opline->op2, Ts, BP_VAR_W), Ts ELS_CC); - break; - case ZEND_JMP: -#if DEBUG_ZEND>=2 - printf("Jumping to %d\n", opline->op1.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op1.u.opline_num]; - continue; - break; - case ZEND_JMPZ: { - znode *op1 = &opline->op1; - - if (!i_zend_is_true(get_zval_ptr(op1, Ts, &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", opline->op2.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op2.u.opline_num]; - FREE_OP(op1, EG(free_op1)); - continue; - } - FREE_OP(op1, EG(free_op1)); - } - break; - case ZEND_JMPNZ: { - znode *op1 = &opline->op1; - - if (zend_is_true(get_zval_ptr(op1, Ts, &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", opline->op2.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op2.u.opline_num]; - FREE_OP(op1, EG(free_op1)); - continue; - } - FREE_OP(op1, EG(free_op1)); - } - break; - case ZEND_JMPZNZ: { - znode *res = &opline->result; - - if (!zend_is_true(get_zval_ptr(res, Ts, &EG(free_op1), BP_VAR_R))) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op2.u.opline_num]; - } else { -#if DEBUG_ZEND>=2 - printf("Conditional jmp on true to %d\n", opline->op1.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op1.u.opline_num]; - } - FREE_OP(res, EG(free_op1)); - } - continue; - break; - case ZEND_JMPZ_EX: { - zend_op *original_opline = opline; - int retval = zend_is_true(get_zval_ptr(&original_opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - - if (!retval) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", opline->op2.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op2.u.opline_num]; - FREE_OP(&original_opline->op1, EG(free_op1)); - Ts[original_opline->result.u.var].tmp_var.value.lval = retval; - Ts[original_opline->result.u.var].tmp_var.type = IS_LONG; - continue; - } - FREE_OP(&original_opline->op1, EG(free_op1)); - Ts[original_opline->result.u.var].tmp_var.value.lval = retval; - Ts[original_opline->result.u.var].tmp_var.type = IS_LONG; - } - break; - case ZEND_JMPNZ_EX: { - zend_op *original_opline = opline; - int retval = zend_is_true(get_zval_ptr(&original_opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - - if (retval) { -#if DEBUG_ZEND>=2 - printf("Conditional jmp to %d\n", opline->op2.u.opline_num); -#endif - opline = &op_array->opcodes[opline->op2.u.opline_num]; - FREE_OP(&original_opline->op1, EG(free_op1)); - Ts[original_opline->result.u.var].tmp_var.value.lval = retval; - Ts[original_opline->result.u.var].tmp_var.type = IS_LONG; - continue; - } - FREE_OP(&original_opline->op1, EG(free_op1)); - Ts[original_opline->result.u.var].tmp_var.value.lval = retval; - Ts[original_opline->result.u.var].tmp_var.type = IS_LONG; - } - break; - case ZEND_FREE: - zendi_zval_dtor(Ts[opline->op1.u.var].tmp_var); - break; - case ZEND_INIT_STRING: - Ts[opline->result.u.var].tmp_var.value.str.val = emalloc(1); - Ts[opline->result.u.var].tmp_var.value.str.val[0] = 0; - Ts[opline->result.u.var].tmp_var.value.str.len = 0; - Ts[opline->result.u.var].tmp_var.refcount = 1; - break; - case ZEND_ADD_CHAR: - add_char_to_string( &Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_NA), - &opline->op2.u.constant); - /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ - break; - case ZEND_ADD_STRING: - add_string_to_string( &Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_NA), - &opline->op2.u.constant); - /* FREE_OP is missing intentionally here - we're always working on the same temporary variable */ - break; - case ZEND_ADD_VAR: { - zval *var = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - zval var_copy; - int use_copy; - - zend_make_printable_zval(var, &var_copy, &use_copy); - if (use_copy) { - var = &var_copy; - } - add_string_to_string( &Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_NA), - var); - if (use_copy) { - zval_dtor(var); - } - /* original comment, possibly problematic: - * FREE_OP is missing intentionally here - we're always working on the same temporary variable - * (Zeev): I don't think it's problematic, we only use variables - * which aren't affected by FREE_OP()'s anyway, unless they're - * string offsets or overloaded objects - */ - FREE_OP(&opline->op2, EG(free_op2)); - } - break; - case ZEND_INIT_FCALL_BY_NAME: { - zval *function_name; - zend_function *function; - HashTable *active_function_table; - zval tmp; - - zend_ptr_stack_n_push(&EG(arg_types_stack), 2, fbc, object.ptr); - if (opline->extended_value & ZEND_CTOR_CALL) { - /* constructor call */ - - if (opline->op1.op_type == IS_VAR) { - PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr); - } - if (opline->op2.op_type==IS_VAR) { - PZVAL_LOCK(*Ts[opline->op2.u.var].var.ptr_ptr); - } - } - function_name = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - - tmp = *function_name; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - function_name = &tmp; - zend_str_tolower(tmp.value.str.val, tmp.value.str.len); - - if (opline->op1.op_type != IS_UNUSED) { - if (opline->op1.op_type==IS_CONST) { /* used for class_name::function() */ - zend_class_entry *ce; - zval **object_ptr_ptr; - - if (zend_hash_find(EG(class_table), opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len+1, (void **) &ce)==FAILURE) { - zend_error(E_ERROR, "Undefined class name '%s'", opline->op1.u.constant.value.str.val); - } - active_function_table = &ce->function_table; - if (zend_hash_find(EG(active_symbol_table), "this", sizeof("this"), (void **) &object_ptr_ptr)==FAILURE) { - object.ptr=NULL; - } else { - /* We assume that "this" is already is_ref and pointing to the object. - If it isn't then tough */ - object.ptr = *object_ptr_ptr; - object.ptr->refcount++; /* For this pointer */ - } - } else { /* used for member function calls */ - object.ptr = _get_object_zval_ptr(&opline->op1, Ts, &EG(free_op1) ELS_CC); - - if ((!object.ptr && Ts[opline->op1.u.var].EA.type==IS_OVERLOADED_OBJECT) - || ((object.ptr && object.ptr->type==IS_OBJECT) && (object.ptr->value.obj.ce->handle_function_call))) { /* overloaded function call */ - zend_overloaded_element overloaded_element; - zend_property_reference *property_reference; - - overloaded_element.element = *function_name; - overloaded_element.type = IS_METHOD; - - if (object.ptr) { - zend_property_reference property_reference; - - property_reference.object = object.ptr; - property_reference.type = BP_VAR_NA; - zend_llist_init(&property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0); - zend_stack_push(&EG(overloaded_objects_stack), &property_reference, sizeof(zend_property_reference)); - } - zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference); - zend_llist_add_element(&property_reference->elements_list, &overloaded_element); - fbc = (zend_function *) emalloc(sizeof(zend_function)); - fbc->type = ZEND_OVERLOADED_FUNCTION; - fbc->common.arg_types = NULL; - goto overloaded_function_call_cont; - } - - if (!object.ptr || object.ptr->type != IS_OBJECT) { - zend_error(E_ERROR, "Call to a member function on a non-object"); - } - object.ptr->refcount++; /* For this pointer */ - active_function_table = &(object.ptr->value.obj.ce->function_table); - } - } else { /* function pointer */ - object.ptr = NULL; - active_function_table = EG(function_table); - } - if (zend_hash_find(active_function_table, function_name->value.str.val, function_name->value.str.len+1, (void **) &function)==FAILURE) { - zend_error(E_ERROR, "Call to undefined function: %s()", function_name->value.str.val); - } - zval_dtor(&tmp); - fbc = function; -overloaded_function_call_cont: - FREE_OP(&opline->op2, EG(free_op2)); - } - break; - case ZEND_DO_FCALL_BY_NAME: - function_state.function = fbc; - goto do_fcall_common; - case ZEND_DO_FCALL: { - zval *fname = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &function_state.function)==FAILURE) { - zend_error(E_ERROR, "Unknown function: %s()\n", fname->value.str.val); - } - FREE_OP(&opline->op1, EG(free_op1)); - zend_ptr_stack_push(&EG(arg_types_stack), object.ptr); - object.ptr = NULL; - goto do_fcall_common; - } -do_fcall_common: - { - zval *original_return_value; - int return_value_not_used = (opline->result.u.EA.type & EXT_TYPE_UNUSED); - - zend_ptr_stack_push(&EG(argument_stack), (void *) opline->extended_value); - var_uninit(&Ts[opline->result.u.var].tmp_var); - if (function_state.function->type==ZEND_INTERNAL_FUNCTION) { - ((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list), object.ptr, !return_value_not_used); - if (object.ptr) { - object.ptr->refcount--; - } - } else if (function_state.function->type==ZEND_USER_FUNCTION) { - HashTable *calling_symbol_table; - - if (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/ - function_state.function_symbol_table = *(EG(symtable_cache_ptr)--); - } else { - function_state.function_symbol_table = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(function_state.function_symbol_table, 0, NULL, PVAL_PTR_DTOR, 0); - /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/ - } - calling_symbol_table = EG(active_symbol_table); - EG(active_symbol_table) = function_state.function_symbol_table; - if (opline->opcode==ZEND_DO_FCALL_BY_NAME - && object.ptr - && fbc->type!=ZEND_OVERLOADED_FUNCTION) { - zval **this_ptr; - - zend_hash_update_ptr(function_state.function_symbol_table, "this", sizeof("this"), NULL, sizeof(zval *), (void **) &this_ptr); - if (!PZVAL_IS_REF(object.ptr)) { - zend_error(E_WARNING,"Problem with method call. Report this bug\n"); - } - *this_ptr = object.ptr; - object.ptr = NULL; - } - original_return_value = EG(return_value); - EG(return_value) = &Ts[opline->result.u.var].tmp_var; - EG(active_op_array) = (zend_op_array *) function_state.function; - zend_execute(EG(active_op_array) ELS_CC); - EG(opline_ptr) = &opline; - EG(active_op_array) = op_array; - EG(return_value)=original_return_value; - if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) { - zend_hash_destroy(function_state.function_symbol_table); - efree(function_state.function_symbol_table); - } else { - *(++EG(symtable_cache_ptr)) = function_state.function_symbol_table; - zend_hash_clean(*EG(symtable_cache_ptr)); - } - EG(active_symbol_table) = calling_symbol_table; - } else { /* ZEND_OVERLOADED_FUNCTION */ - call_overloaded_function(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list) ELS_CC); - efree(fbc); - } - if (return_value_not_used) { - zendi_zval_dtor(Ts[opline->result.u.var].tmp_var); - } - object.ptr = zend_ptr_stack_pop(&EG(arg_types_stack)); - if (opline->opcode == ZEND_DO_FCALL_BY_NAME) { - fbc = zend_ptr_stack_pop(&EG(arg_types_stack)); - } - function_state.function = (zend_function *) op_array; - EG(function_state_ptr) = &function_state; - zend_ptr_stack_clear_multiple(ELS_C); - } - break; - case ZEND_RETURN: { - zval *retval = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - *EG(return_value) = *retval; - if (!EG(free_op1)) { - zendi_zval_copy_ctor(*EG(return_value)); - } -#if SUPPORT_INTERACTIVE - op_array->last_executed_op_number = opline-op_array->opcodes; -#endif - free_alloca(Ts); - return; - } - break; - case ZEND_SEND_VAL: - if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(opline->op2.u.opline_num, fbc, fbc->common.arg_types)) { - zend_error(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num); - } - { - zval *valptr = (zval *) emalloc(sizeof(zval)); - - *valptr = Ts[opline->op1.u.var].tmp_var; - INIT_PZVAL(valptr); - zend_ptr_stack_push(&EG(argument_stack), valptr); - } - break; - case ZEND_SEND_VAR: - if (opline->extended_value==ZEND_DO_FCALL_BY_NAME - && ARG_SHOULD_BE_SENT_BY_REF(opline->op2.u.opline_num, fbc, fbc->common.arg_types)) { - goto send_by_ref; - } - { - zval *varptr = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - if (varptr == &EG(uninitialized_zval)) { - varptr = (zval *) emalloc(sizeof(zval)); - var_uninit(varptr); - varptr->refcount=0; - varptr->is_ref=0; - } else if (PZVAL_IS_REF(varptr)) { - zval *original_var = varptr; - - varptr = (zval *) emalloc(sizeof(zval)); - *varptr = *original_var; - varptr->is_ref = 0; - varptr->refcount = 0; - zval_copy_ctor(varptr); - } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - FREE_OP(&opline->op1, EG(free_op1)); /* for string offsets */ - } - break; -send_by_ref: - case ZEND_SEND_REF: { - zval **varptr_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W); - zval *varptr = *varptr_ptr; - - if (!PZVAL_IS_REF(varptr)) { - /* code to break away this variable */ - if (varptr->refcount>1) { - varptr->refcount--; - *varptr_ptr = (zval *) emalloc(sizeof(zval)); - **varptr_ptr = *varptr; - varptr = *varptr_ptr; - varptr->refcount = 1; - zval_copy_ctor(varptr); - } - varptr->is_ref = 1; - /* at the end of this code refcount is always 1 */ - } - varptr->refcount++; - zend_ptr_stack_push(&EG(argument_stack), varptr); - } - break; - case ZEND_RECV: { - zval **param; - - if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) ¶m ELS_CC)==FAILURE) { - zend_error(E_NOTICE, "Missing argument %d for %s()\n", opline->op1.u.constant.value.lval, get_active_function_name()); - if (opline->result.op_type == IS_VAR) { - PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr); - } - } else if (PZVAL_IS_REF(*param)) { - zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC); - } else { - zend_assign_to_variable(NULL, &opline->result, NULL, *param, IS_VAR, Ts ELS_CC); - } - } - break; - case ZEND_RECV_INIT: { - zval **param, *assignment_value; - - if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) ¶m ELS_CC)==FAILURE) { - if (opline->op2.op_type == IS_UNUSED) { - if (opline->result.op_type == IS_VAR) { - PZVAL_UNLOCK(*Ts[opline->result.u.var].var.ptr_ptr); - } - break; - } - if (opline->op2.u.constant.type == IS_CONSTANT) { - zval *default_value = (zval *) emalloc(sizeof(zval)); - zval tmp; - - *default_value = opline->op2.u.constant; - if (!zend_get_constant(default_value->value.str.val, default_value->value.str.len, &tmp)) { - default_value->type = IS_STRING; - zval_copy_ctor(default_value); - } else { - *default_value = tmp; - } - default_value->refcount=0; - default_value->is_ref=0; - param = &default_value; - assignment_value = default_value; - } else { - param = NULL; - assignment_value = &opline->op2.u.constant; - } - } else { - assignment_value = *param; - } - - if (PZVAL_IS_REF(assignment_value)) { - zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC); - } else { - zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, Ts ELS_CC); - } - } - break; - case ZEND_BOOL: - /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */ - Ts[opline->result.u.var].tmp_var.value.lval = zend_is_true(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - Ts[opline->result.u.var].tmp_var.type = IS_LONG; - FREE_OP(&opline->op1, EG(free_op1)); - break; - case ZEND_BRK: - case ZEND_CONT: { - zval *nest_levels_zval = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - zval tmp; - int array_offset, nest_levels, original_nest_levels; - zend_brk_cont_element *jmp_to; - - if (nest_levels_zval->type != IS_LONG) { - tmp = *nest_levels_zval; - zval_copy_ctor(&tmp); - convert_to_long(&tmp); - nest_levels = tmp.value.lval; - } else { - nest_levels = nest_levels_zval->value.lval; - } - original_nest_levels = nest_levels; - array_offset = opline->op1.u.opline_num; - do { - if (array_offset==-1) { - zend_error(E_ERROR, "Cannot break/continue %d levels\n", original_nest_levels); - } - jmp_to = &op_array->brk_cont_array[array_offset]; - array_offset = jmp_to->parent; - } while (--nest_levels > 0); - - if (opline->opcode == ZEND_BRK) { - opline = op_array->opcodes+jmp_to->brk; - } else { - opline = op_array->opcodes+jmp_to->cont; - } - FREE_OP(&opline->op2, EG(free_op2)); - continue; - } - break; - case ZEND_CASE: { - int switch_expr_is_overloaded=0; - - if (opline->op1.op_type==IS_VAR) { - if (Ts[opline->op1.u.var].var.ptr_ptr) { - PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr); - } else { - switch_expr_is_overloaded = 1; - if (Ts[opline->op1.u.var].EA.type==IS_STRING_OFFSET) { - Ts[opline->op1.u.var].EA.str->refcount++; - } - } - } - is_equal_function(&Ts[opline->result.u.var].tmp_var, - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R), - get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R)); - - FREE_OP(&opline->op2, EG(free_op2)); - if (switch_expr_is_overloaded) { - /* We only free op1 if this is a string offset, - * Since if it is a TMP_VAR, it'll be reused by - * other CASE opcodes (whereas string offsets - * are allocated at each get_zval_ptr()) - */ - FREE_OP(&opline->op1, EG(free_op1)); - Ts[opline->op1.u.var].var.ptr_ptr = NULL; - AI_USE_PTR(Ts[opline->op1.u.var].var); - } - } - break; - case ZEND_SWITCH_FREE: - switch (opline->op1.op_type) { - case IS_VAR: - if (!Ts[opline->op1.u.var].var.ptr_ptr) { - get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - FREE_OP(&opline->op1, EG(free_op1)); - } - break; - case IS_TMP_VAR: - zendi_zval_dtor(Ts[opline->op1.u.var].tmp_var); - break; - } - break; - case ZEND_NEW: { - zval *tmp = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - zval class_name; - zend_class_entry *ce; - - class_name = *tmp; - zval_copy_ctor(&class_name); - convert_to_string(&class_name); - zend_str_tolower(class_name.value.str.val, class_name.value.str.len); - - if (zend_hash_find(EG(class_table), class_name.value.str.val, class_name.value.str.len+1, (void **) &ce)==FAILURE) { - zend_error(E_ERROR, "Cannot instanciate non-existant class: %s", class_name.value.str.val); - } - object_init_ex(&Ts[opline->result.u.var].tmp_var, ce); - Ts[opline->result.u.var].tmp_var.refcount=1; - Ts[opline->result.u.var].tmp_var.is_ref=1; - zval_dtor(&class_name); - FREE_OP(&opline->op1, EG(free_op1)); - } - break; - case ZEND_FETCH_CONSTANT: - if (!zend_get_constant(opline->op1.u.constant.value.str.val, opline->op1.u.constant.value.str.len, &Ts[opline->result.u.var].tmp_var)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - opline->op1.u.constant.value.str.val, - opline->op1.u.constant.value.str.val); - Ts[opline->result.u.var].tmp_var = opline->op1.u.constant; - zval_copy_ctor(&Ts[opline->result.u.var].tmp_var); - } - break; - case ZEND_INIT_ARRAY: - case ZEND_ADD_ARRAY_ELEMENT: { - zval *array_ptr = &Ts[opline->result.u.var].tmp_var; - zval *expr_ptr, **expr_ptr_ptr = NULL; - zval *offset=get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - - if (opline->extended_value) { - expr_ptr_ptr=get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_R); - expr_ptr = *expr_ptr_ptr; - } else { - expr_ptr=get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - } - - if (opline->opcode==ZEND_INIT_ARRAY) { - array_init(array_ptr); - if (!expr_ptr) { - break; - } - } - if (opline->op1.op_type == IS_TMP_VAR) { /* temporary variable */ - zval *new_expr = (zval *) emalloc(sizeof(zval)); - - *new_expr = *expr_ptr; - expr_ptr = new_expr; - INIT_PZVAL(expr_ptr); - } else { - if (opline->extended_value) { - if (!PZVAL_IS_REF(expr_ptr)) { - SEPARATE_ZVAL(expr_ptr_ptr); - expr_ptr = *expr_ptr_ptr; - expr_ptr->is_ref = 1; - } - expr_ptr->refcount++; - } else if (PZVAL_IS_REF(expr_ptr)) { - zval *new_expr = (zval *) emalloc(sizeof(zval)); - - *new_expr = *expr_ptr; - expr_ptr = new_expr; - zendi_zval_copy_ctor(*expr_ptr); - INIT_PZVAL(expr_ptr); - } else { - expr_ptr->refcount++; - } - } - if (offset) { - switch(offset->type) { - case IS_DOUBLE: - zend_hash_index_update(array_ptr->value.ht, (long) offset->value.lval, &expr_ptr, sizeof(zval *), NULL); - break; - case IS_LONG: - zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr_ptr, sizeof(zval *), NULL); - break; - case IS_STRING: - zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr_ptr, sizeof(zval *), NULL); - break; - default: - /* do nothing */ - break; - } - FREE_OP(&opline->op2, EG(free_op2)); - } else { - zend_hash_next_index_insert(array_ptr->value.ht, &expr_ptr, sizeof(zval *), NULL); - } - } - break; - case ZEND_CAST: { - zval *expr = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - zval *result = &Ts[opline->result.u.var].tmp_var; - - *result = *expr; - if (!EG(free_op1)) { - zendi_zval_copy_ctor(*result); - } - switch (opline->op2.u.constant.type) { - case IS_BOOL: - convert_to_boolean(result); - break; - case IS_LONG: - convert_to_long(result); - break; - case IS_DOUBLE: - convert_to_double(result); - break; - case IS_STRING: - convert_to_string(result); - break; - case IS_ARRAY: - convert_to_array(result); - break; - case IS_OBJECT: - convert_to_object(result); - break; - } - } - break; - case ZEND_INCLUDE_OR_EVAL: { - zend_op_array *new_op_array=NULL; - zval *original_return_value = EG(return_value); - CLS_FETCH(); - - switch (opline->op2.u.constant.value.lval) { - case ZEND_INCLUDE: - new_op_array = compile_filename(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R), 0 CLS_CC); - break; - case ZEND_EVAL: - new_op_array = compile_string(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R) CLS_CC); - break; - case ZEND_IMPORT: - new_op_array = compile_filename(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R), 1 CLS_CC); - break; - } - FREE_OP(&opline->op1, EG(free_op1)); - if (new_op_array) { - Ts[opline->result.u.var].tmp_var.value.lval = 1; - Ts[opline->result.u.var].tmp_var.type = IS_LONG; - EG(return_value) = &Ts[opline->result.u.var].tmp_var; - EG(active_op_array) = new_op_array; - zend_execute(new_op_array ELS_CC); - - EG(opline_ptr) = &opline; - EG(active_op_array) = op_array; - EG(function_state_ptr) = &function_state; - destroy_op_array(new_op_array); - efree(new_op_array); - } else { - var_uninit(&Ts[opline->result.u.var].tmp_var); - } - EG(return_value) = original_return_value; - } - break; - case ZEND_UNSET_VAR: { - zval tmp, *variable = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - if (variable->type != IS_STRING) { - tmp = *variable; - zval_copy_ctor(&tmp); - convert_to_string(&tmp); - variable = &tmp; - } - - zend_hash_del(EG(active_symbol_table), variable->value.str.val, variable->value.str.len+1); - - if (variable == &tmp) { - zval_dtor(&tmp); - } - FREE_OP(&opline->op1, EG(free_op1)); - } - break; - case ZEND_UNSET_DIM_OBJ: { - zval **container = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_R); - zval *offset = get_zval_ptr(&opline->op2, Ts, &EG(free_op2), BP_VAR_R); - - if (container) { - HashTable *ht; - - switch ((*container)->type) { - case IS_ARRAY: - ht = (*container)->value.ht; - break; - case IS_OBJECT: - ht = (*container)->value.obj.properties; - break; - default: - ht = NULL; - break; - } - if (ht) { - switch (offset->type) { - case IS_LONG: - zend_hash_index_del(ht, offset->value.lval); - break; - case IS_STRING: - zend_hash_del(ht, offset->value.str.val, offset->value.str.len+1); - break; - } - } - } else { - /* overloaded element */ - } - FREE_OP(&opline->op2, EG(free_op2)); - } - break; - case ZEND_FE_RESET: { - zval *array = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - Ts[opline->result.u.var].tmp_var = *array; - array = &Ts[opline->result.u.var].tmp_var; - if (!EG(free_op1)) { - zval_copy_ctor(array); - } - if (array->type == IS_ARRAY) { - /* probably redundant */ - zend_hash_internal_pointer_reset(array->value.ht); - } else { - /* JMP to the end of foreach - TBD */ - } - } - break; - case ZEND_FE_FETCH: { - zval *array = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - zval *result = &Ts[opline->result.u.var].tmp_var; - zval **value, *key; - char *str_key; - ulong int_key; - - if (array->type != IS_ARRAY) { - zend_error(E_WARNING, "Non array argument supplied for foreach()"); - opline = op_array->opcodes+opline->op2.u.opline_num; - continue; - } else if (zend_hash_get_current_data(array->value.ht, (void **) &value)==FAILURE) { - opline = op_array->opcodes+opline->op2.u.opline_num; - continue; - } - array_init(result); - - - (*value)->refcount++; - zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL); - - key = (zval *) emalloc(sizeof(zval)); - INIT_PZVAL(key); - switch (zend_hash_get_current_key(array->value.ht, &str_key, &int_key)) { - case HASH_KEY_IS_STRING: - key->value.str.val = str_key; - key->value.str.len = strlen(str_key); - key->type = IS_STRING; - break; - case HASH_KEY_IS_LONG: - key->value.lval = int_key; - key->type = IS_LONG; - break; - } - zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL); - zend_hash_move_forward(array->value.ht); - } - break; - case ZEND_JMP_NO_CTOR: { - zval *object; - - if (opline->op1.op_type == IS_VAR) { - PZVAL_LOCK(*Ts[opline->op1.u.var].var.ptr_ptr); - } - - object = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - if (!object->value.obj.ce->handle_function_call - && !zend_hash_exists(&object->value.obj.ce->function_table, object->value.obj.ce->name, object->value.obj.ce->name_length+1)) { - opline = op_array->opcodes + opline->op2.u.opline_num; - continue; - } - } - break; - case ZEND_ISSET_ISEMPTY: { - zval **var = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_IS); - int isset; - - if (!var) { - if (Ts[opline->op1.u.var].EA.type==IS_STRING_OFFSET) { - if (Ts[opline->op1.u.var].EA.offset>=0 - && Ts[opline->op1.u.var].EA.offsetop1.u.var].EA.str->value.str.len) { - isset = 1; - } else { - isset = 0; - } - } else { - isset = 1; - } - } else if (*var==EG(uninitialized_zval_ptr) - || ((*var)->type == IS_STRING && (*var)->value.str.val == undefined_variable_string)) { - isset = 0; - } else { - isset = 1; - } - - switch (opline->op2.u.constant.value.lval) { - case ZEND_ISSET: - Ts[opline->result.u.var].tmp_var.value.lval = isset; - break; - case ZEND_ISEMPTY: - if (!var) { - if (!isset - || Ts[opline->op1.u.var].EA.str->value.str.val[Ts[opline->op1.u.var].EA.offset]=='0') { - Ts[opline->result.u.var].tmp_var.value.lval = 1; - } else { - Ts[opline->result.u.var].tmp_var.value.lval = 0; - } - } else if (!isset || !zend_is_true((*var))) { - Ts[opline->result.u.var].tmp_var.value.lval = 1; - } else { - Ts[opline->result.u.var].tmp_var.value.lval = 0; - } - break; - } - Ts[opline->result.u.var].tmp_var.type = IS_BOOL; - } - break; - case ZEND_EXIT: - if (opline->op1.op_type != IS_UNUSED) { - zend_print_variable(get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R)); - FREE_OP(&opline->op1, EG(free_op1)); - } - zend_bailout(); - break; - case ZEND_BEGIN_SILENCE: - Ts[opline->result.u.var].tmp_var.value.lval = EG(error_reporting); - Ts[opline->result.u.var].tmp_var.type = IS_LONG; /* shouldn't be necessary */ - EG(error_reporting) = 0; - break; - case ZEND_END_SILENCE: - EG(error_reporting) = Ts[opline->op1.u.var].tmp_var.value.lval; - break; - case ZEND_QM_ASSIGN: { - zval *value = get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); - - Ts[opline->result.u.var].tmp_var = *value; - if (!EG(free_op1)) { - zval_copy_ctor(&Ts[opline->result.u.var].tmp_var); - } - } - break; - case ZEND_EXT_STMT: - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_statement_handler, op_array); - } - break; - case ZEND_EXT_FCALL_BEGIN: - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_begin_handler, op_array); - } - break; - case ZEND_EXT_FCALL_END: - if (!EG(no_extensions)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_fcall_end_handler, op_array); - } - break; - case ZEND_DECLARE_FUNCTION_OR_CLASS: - do_bind_function_or_class(opline, EG(function_table), EG(class_table), 0); - break; - case ZEND_EXT_NOP: - case ZEND_NOP: - break; - default: - break; - } - opline++; - } -#if SUPPORT_INTERACTIVE - op_array->last_executed_op_number = opline-op_array->opcodes; -#endif - free_alloca(Ts); -} diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h deleted file mode 100644 index 4075588703..0000000000 --- a/Zend/zend_execute.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _EXECUTE_H -#define _EXECUTE_H - -#include "zend_compile.h" -#include "zend_hash.h" - -typedef union _temp_variable { - zval tmp_var; - struct { - zval **ptr_ptr; - zval *ptr; - } var; - struct { - zval tmp_var; /* a dummy */ - - zval *str; - int offset; - unsigned char type; - } EA; -} temp_variable; - - -ZEND_API extern void (*zend_execute)(zend_op_array *op_array ELS_DC); - -void init_executor(CLS_D ELS_DC); -void shutdown_executor(ELS_D); -void execute(zend_op_array *op_array ELS_DC); -ZEND_API int zend_is_true(zval *op); -ZEND_API inline void safe_free_zval_ptr(zval *p); -ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC); -ZEND_API inline int i_zend_is_true(zval *op); -ZEND_API int zval_update_constant(zval **pp); -ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC); - -/* dedicated Zend executor functions - do not use! */ -ZEND_API inline void zend_ptr_stack_clear_multiple(ELS_D); -ZEND_API inline int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC); - -#if SUPPORT_INTERACTIVE -void execute_new_code(CLS_D); -#endif - - -/* services */ -ZEND_API char *get_active_function_name(void); -ZEND_API char *zend_get_executed_filename(ELS_D); -ZEND_API uint zend_get_executed_lineno(ELS_D); - -#define zendi_zval_copy_ctor(p) zval_copy_ctor(&(p)) -#define zendi_zval_dtor(p) zval_dtor(&(p)) - -#define active_opline (*EG(opline_ptr)) - - -#define IS_OVERLOADED_OBJECT 1 -#define IS_STRING_OFFSET 2 - -#endif /* _EXECUTE_H */ diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c deleted file mode 100644 index 40bea67381..0000000000 --- a/Zend/zend_execute_API.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include -#include - -#include "zend.h" -#include "zend_compile.h" -#include "zend_execute.h" -#include "zend_API.h" -#include "zend_ptr_stack.h" -#include "zend_variables.h" -#include "zend_operators.h" -#include "zend_constants.h" -#include "zend_extensions.h" - - -ZEND_API void (*zend_execute)(zend_op_array *op_array ELS_DC); - - -#if ZEND_DEBUG -static void (*original_sigsegv_handler)(int); -static void zend_handle_sigsegv(int dummy) -{ - fflush(stdout); - fflush(stderr); - if (original_sigsegv_handler==zend_handle_sigsegv) { - signal(SIGSEGV, original_sigsegv_handler); - } else { - signal(SIGSEGV, SIG_DFL); - } - { - ELS_FETCH(); - - fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n", - active_opline->opcode, - active_opline-EG(active_op_array)->opcodes, - get_active_function_name(), - zend_get_executed_filename(ELS_C), - zend_get_executed_lineno(ELS_C)); - } - if (original_sigsegv_handler!=zend_handle_sigsegv) { - original_sigsegv_handler(dummy); - } -} -#endif - - -static void zend_extension_activator(zend_extension *extension) -{ - if (extension->activate) { - extension->activate(); - } -} - - -static void zend_extension_deactivator(zend_extension *extension) -{ - if (extension->deactivate) { - extension->deactivate(); - } -} - - -void init_executor(CLS_D ELS_DC) -{ - var_uninit(&EG(uninitialized_zval)); - var_uninit(&EG(error_zval)); - EG(uninitialized_zval).refcount = 1; - EG(uninitialized_zval).is_ref=0; - EG(uninitialized_zval_ptr)=&EG(uninitialized_zval); - EG(error_zval).refcount = 1; - EG(error_zval).is_ref=0; - EG(error_zval_ptr)=&EG(error_zval); - zend_ptr_stack_init(&EG(arg_types_stack)); - zend_stack_init(&EG(overloaded_objects_stack)); -/* destroys stack frame, therefore makes core dumps worthless */ -#if 0 -#if ZEND_DEBUG - original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv); -#endif -#endif - EG(return_value) = &EG(global_return_value); - var_reset(EG(return_value)); - EG(symtable_cache_ptr) = EG(symtable_cache)-1; - EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1; - EG(no_extensions)=0; - - EG(function_table) = CG(function_table); - EG(class_table) = CG(class_table); - - zend_ptr_stack_init(&EG(argument_stack)); - - EG(main_op_array) = NULL; - zend_hash_init(&EG(symbol_table), 50, NULL, PVAL_PTR_DTOR, 0); - EG(active_symbol_table) = &EG(symbol_table); - - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_activator); - EG(opline_ptr) = NULL; - EG(garbage_ptr) = 0; - - zend_hash_init(&EG(imported_files), 5, NULL, NULL, 0); -} - - -void shutdown_executor(ELS_D) -{ - zval_dtor(&EG(global_return_value)); - zend_ptr_stack_destroy(&EG(arg_types_stack)); - zend_stack_destroy(&EG(overloaded_objects_stack)); - - while (EG(symtable_cache_ptr)>=EG(symtable_cache)) { - zend_hash_destroy(*EG(symtable_cache_ptr)); - efree(*EG(symtable_cache_ptr)); - EG(symtable_cache_ptr)--; - } - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_deactivator); - - zend_hash_destroy(&EG(symbol_table)); - - destroy_resource_list(); /* must be destroyed after the main symbol table is destroyed */ - - zend_ptr_stack_destroy(&EG(argument_stack)); - if (EG(main_op_array)) { - destroy_op_array(EG(main_op_array)); - efree(EG(main_op_array)); - } - clean_non_persistent_constants(); -#if ZEND_DEBUG - signal(SIGSEGV, original_sigsegv_handler); -#endif - while (EG(garbage_ptr)--) { - zval_dtor(EG(garbage)[EG(garbage_ptr)]); - efree(EG(garbage)[EG(garbage_ptr)]); - } - - zend_hash_destroy(&EG(imported_files)); -} - - -ZEND_API char *get_active_function_name() -{ - ELS_FETCH(); - - switch(EG(function_state_ptr)->function->type) { - case ZEND_USER_FUNCTION: { - char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name; - - if (function_name) { - return function_name; - } else { - return "main"; - } - } - break; - case ZEND_INTERNAL_FUNCTION: - return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name; - break; - default: - return NULL; - } -} - - -ZEND_API char *zend_get_executed_filename(ELS_D) -{ - if (EG(opline_ptr)) { - return active_opline->filename; - } else { - return "[no active file]"; - } -} - - -ZEND_API uint zend_get_executed_lineno(ELS_D) -{ - if (EG(opline_ptr)) { - return active_opline->lineno; - } else { - return 0; - } -} - - -ZEND_API inline void safe_free_zval_ptr(zval *p) -{ - ELS_FETCH(); - - if (p!=EG(uninitialized_zval_ptr)) { - efree(p); - } -} - - -ZEND_API int _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC) -{ -#if DEBUG_ZEND>=2 - printf("Reducing refcount for %x (%x): %d->%d\n", *zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)->refcount-1); -#endif - (*zval_ptr)->refcount--; - if ((*zval_ptr)->refcount==0) { - zval_dtor(*zval_ptr); - safe_free_zval_ptr(*zval_ptr); - } - return 1; -} - - -ZEND_API inline int i_zend_is_true(zval *op) -{ - int result; - - switch (op->type) { - case IS_LONG: - case IS_BOOL: - case IS_RESOURCE: - result = (op->value.lval?1:0); - break; - case IS_DOUBLE: - result = (op->value.dval ? 1 : 0); - break; - case IS_STRING: - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - result = 0; - } else { - result = 1; - } - break; - case IS_ARRAY: - result = (zend_hash_num_elements(op->value.ht)?1:0); - break; - case IS_OBJECT: - result = (zend_hash_num_elements(op->value.obj.properties)?1:0); - break; - default: - result = 0; - break; - } - return result; -} - - -ZEND_API int zend_is_true(zval *op) -{ - return i_zend_is_true(op); -} - - -ZEND_API int zval_update_constant(zval **pp) -{ - zval *p = *pp; - - if (p->type == IS_CONSTANT) { - zval c; - int refcount = p->refcount; - - if (!zend_get_constant(p->value.str.val, p->value.str.len, &c)) { - zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", - p->value.str.val, - p->value.str.val); - p->type = IS_STRING; - } else { - STR_FREE(p->value.str.val); - *p = c; - } - INIT_PZVAL(p); - p->refcount = refcount; - } else if (p->type == IS_ARRAY) { - zend_hash_apply(p->value.ht, (int (*)(void *)) zval_update_constant); - } - return 0; -} - - -int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[]) -{ - zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count); - int i; - int ex_retval; - - for (i=0; itype != IS_OBJECT) { - return FAILURE; - } - function_table = &object->value.obj.ce->function_table; - } - original_function_state_ptr = EG(function_state_ptr); - zend_str_tolower(function_name->value.str.val, function_name->value.str.len); - if (zend_hash_find(function_table, function_name->value.str.val, function_name->value.str.len+1, (void **) &function_state.function)==FAILURE) { - return FAILURE; - } - - for (i=0; icommon.arg_types - && icommon.arg_types[0] - && function_state.function->common.arg_types[i+1]==BYREF_FORCE - && !PZVAL_IS_REF(*params[i])) { - if ((*params[i])->refcount>1) { - zval *new_zval; - - if (no_separation) { - return FAILURE; - } - new_zval = (zval *) emalloc(sizeof(zval)); - *new_zval = **params[i]; - zval_copy_ctor(new_zval); - new_zval->refcount = 1; - (*params[i])->refcount--; - *params[i] = new_zval; - } - (*params[i])->refcount++; - (*params[i])->is_ref = 1; - param = *params[i]; - } else if (*params[i] != &EG(uninitialized_zval)) { - (*params[i])->refcount++; - param = *params[i]; - } else { - param = (zval *) emalloc(sizeof(zval)); - *param = **(params[i]); - INIT_PZVAL(param); - } - zend_ptr_stack_push(&EG(argument_stack), param); - } - - zend_ptr_stack_push(&EG(argument_stack), (void *) (long) param_count); - - var_uninit(retval); - if (function_state.function->type == ZEND_USER_FUNCTION) { - calling_symbol_table = EG(active_symbol_table); - EG(active_symbol_table) = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(EG(active_symbol_table), 0, NULL, PVAL_PTR_DTOR, 0); - if (object) { - zval *dummy = (zval *) emalloc(sizeof(zval)), **this_ptr; - - var_uninit(dummy); - INIT_PZVAL(dummy); - zend_hash_update_ptr(EG(active_symbol_table), "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr); - zend_assign_to_variable_reference(NULL, this_ptr, &object, NULL ELS_CC); - } - original_return_value = EG(return_value); - original_op_array = EG(active_op_array); - EG(return_value) = retval; - EG(active_op_array) = (zend_op_array *) function_state.function; - original_opline_ptr = EG(opline_ptr); - zend_execute(EG(active_op_array) ELS_CC); - zend_hash_destroy(EG(active_symbol_table)); - efree(EG(active_symbol_table)); - EG(active_symbol_table) = calling_symbol_table; - EG(active_op_array) = original_op_array; - EG(return_value)=original_return_value; - EG(opline_ptr) = original_opline_ptr; - } else { - ((zend_internal_function *) function_state.function)->handler(param_count, retval, &EG(regular_list), &EG(persistent_list), object, 1); - } - zend_ptr_stack_clear_multiple(ELS_C); - EG(function_state_ptr) = original_function_state_ptr; - - return SUCCESS; -} - - -ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC) -{ - zval pv; - zend_op_array *new_op_array; - zend_op_array *original_active_op_array = EG(active_op_array); - zend_function_state *original_function_state_ptr = EG(function_state_ptr); - int original_handle_op_arrays; - - if (retval) { - pv.value.str.len = strlen(str)+sizeof("return ;")-1; - pv.value.str.val = emalloc(pv.value.str.len+1); - strcpy(pv.value.str.val, "return "); - strcat(pv.value.str.val, str); - strcat(pv.value.str.val, " ;"); - } else { - pv.value.str.len = strlen(str); - pv.value.str.val = estrndup(str, pv.value.str.len); - } - pv.type = IS_STRING; - - /*printf("Evaluating '%s'\n", pv.value.str.val);*/ - - original_handle_op_arrays = CG(handle_op_arrays); - CG(handle_op_arrays) = 0; - new_op_array = compile_string(&pv CLS_CC); - CG(handle_op_arrays) = original_handle_op_arrays; - - if (new_op_array) { - zval dummy_retval; - zval *original_return_value = EG(return_value); - zend_op **original_opline_ptr = EG(opline_ptr); - - EG(return_value) = (retval?retval:&dummy_retval); - var_reset(EG(return_value)); - EG(active_op_array) = new_op_array; - EG(no_extensions)=1; - zend_execute(new_op_array ELS_CC); - EG(no_extensions)=0; - EG(opline_ptr) = original_opline_ptr; - EG(active_op_array) = original_active_op_array; - EG(function_state_ptr) = original_function_state_ptr; - destroy_op_array(new_op_array); - efree(new_op_array); - EG(return_value) = original_return_value; - if (!retval) { - zval_dtor(&dummy_retval); - } - } else { - printf("Failed executing:\n%s\n", str); - } - zval_dtor(&pv); -} - - -ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC) -{ - zval *variable_ptr = *variable_ptr_ptr; - zval *value_ptr; - - - if (!value_ptr_ptr) { - zend_error(E_ERROR, "Cannot create references to string offsets nor overloaded objects"); - return; - } - - value_ptr = *value_ptr_ptr; - if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) { - variable_ptr_ptr = &EG(uninitialized_zval_ptr); -/* } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) { */ - } else if (variable_ptr_ptr != value_ptr_ptr) { - variable_ptr->refcount--; - if (variable_ptr->refcount==0) { - zendi_zval_dtor(*variable_ptr); - efree(variable_ptr); - } - - if (!PZVAL_IS_REF(value_ptr)) { - /* break it away */ - value_ptr->refcount--; - if (value_ptr->refcount>0) { - *value_ptr_ptr = (zval *) emalloc(sizeof(zval)); - **value_ptr_ptr = *value_ptr; - value_ptr = *value_ptr_ptr; - zendi_zval_copy_ctor(*value_ptr); - } - value_ptr->refcount = 1; - value_ptr->is_ref = 1; - } - - *variable_ptr_ptr = value_ptr; - value_ptr->refcount++; - } else { - /* nothing to do */ - } - - if (result && (result->op_type != IS_UNUSED)) { - Ts[result->u.var].var.ptr_ptr = variable_ptr_ptr; - SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, result); - AI_USE_PTR(Ts[result->u.var].var); - } -} - - -#if SUPPORT_INTERACTIVE -void execute_new_code(CLS_D) -{ - ELS_FETCH(); - - if (!EG(interactive) - || CG(active_op_array)->backpatch_count>0 - || CG(active_op_array)->function_name - || CG(active_op_array)->type!=ZEND_USER_FUNCTION) { - return; - } - CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number; - CG(active_op_array)->end_op_number = CG(active_op_array)->last; - EG(active_op_array) = CG(active_op_array); - zend_execute(CG(active_op_array) ELS_CC); - CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number; -} -#endif - - -/* these are a dedicated, optimized, function, and shouldn't be used for any purpose - * other than by Zend's executor - */ -ZEND_API inline void zend_ptr_stack_clear_multiple(ELS_D) -{ - void **p = EG(argument_stack).top_element-1; - int delete_count = (ulong) *p; - - EG(argument_stack).top -= (delete_count+1); - while (--delete_count>=0) { - zval_ptr_dtor((zval **) --p); - } - EG(argument_stack).top_element = p; -} - - - -ZEND_API int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC) -{ - void **p = EG(argument_stack).top_element-1; - int arg_count = (ulong) *p; - - if (requested_arg>arg_count) { - return FAILURE; - } - *data = (p-arg_count+requested_arg-1); - return SUCCESS; -} - diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c deleted file mode 100644 index c08e0c086a..0000000000 --- a/Zend/zend_extensions.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend_extensions.h" - -ZEND_API zend_llist zend_extensions; -static int last_resource_number; - -int zend_load_extensions(char **extension_paths) -{ - char **p = extension_paths; - - if (!p) { - return SUCCESS; - } - while (*p) { - if (zend_load_extension(*p)==FAILURE) { - return FAILURE; - } - p++; - } - return SUCCESS; -} - - -int zend_load_extension(char *path) -{ -#if ZEND_EXTENSIONS_SUPPORT - DL_HANDLE handle; - zend_extension extension, *new_extension; - zend_extension_version_info *extension_version_info; - - handle = DL_LOAD(path); - if (!handle) { -#if !(WIN32||WINNT) - fprintf(stderr, "Failed loading %s: %s\n", path, dlerror()); -#else - fprintf(stderr, "Failed loading %s\n", path); -#endif - return FAILURE; - } - - extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info"); - new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry"); - if (!extension_version_info || !new_extension) { - fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path); - return FAILURE; - } - - if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) { - fprintf(stderr, "%s requires Zend version %s or later\n" - "Current version %s, API version %d\n", - new_extension->name, - extension_version_info->required_zend_version, - ZEND_VERSION, - ZEND_EXTENSION_API_NO); - DL_UNLOAD(handle); - return FAILURE; - } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) { - /* we may be able to allow for downwards compatability in some harmless cases. */ - fprintf(stderr, "%s is outdated (API version %d, current version %d)\n" - "Contact %s at %s for a later version of this module.\n", - new_extension->name, - extension_version_info->zend_extension_api_no, - ZEND_EXTENSION_API_NO, - new_extension->author, - new_extension->URL); - DL_UNLOAD(handle); - return FAILURE; - } else if (ZTS_V!=extension_version_info->thread_safe) { - fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n", - new_extension->name, - (extension_version_info->thread_safe?"is":"isn't"), - (ZTS_V?"is":"isn't")); - DL_UNLOAD(handle); - return FAILURE; - } else if (ZEND_DEBUG!=extension_version_info->debug) { - fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n", - new_extension->name, - (extension_version_info->debug?"contains":"does not contain"), - (ZEND_DEBUG?"does":"does not")); - DL_UNLOAD(handle); - return FAILURE; - } - - if (new_extension->startup) { - if (new_extension->startup(new_extension)!=SUCCESS) { - DL_UNLOAD(handle); - return FAILURE; - } - } - extension = *new_extension; - extension.handle = handle; - - zend_llist_add_element(&zend_extensions, &extension); - - /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/ - - zend_append_version_info(&extension); - return SUCCESS; -#else - fprintf(stderr, "Extensions are not supported on this platform.\n"); - return FAILURE; -#endif -} - -static void zend_extension_shutdown(zend_extension *extension) -{ -#if ZEND_EXTENSIONS_SUPPORT - if (extension->shutdown) { - extension->shutdown(extension); - } -#endif -} - - -void zend_shutdown_extensions() -{ - zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown); - zend_llist_destroy(&zend_extensions); -} - - -void zend_extension_dtor(zend_extension *extension) -{ -#if ZEND_EXTENSIONS_SUPPORT - DL_UNLOAD(extension->handle); -#endif -} - - -ZEND_API int zend_get_resource_handle(zend_extension *extension) -{ - if (last_resource_number<4) { - extension->resource_number = last_resource_number; - return last_resource_number; - } else { - return -1; - } -} diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h deleted file mode 100644 index 4b3299ac84..0000000000 --- a/Zend/zend_extensions.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_EXTENSIONS_H -#define _ZEND_EXTENSIONS_H - -#include "zend_compile.h" - -#define ZEND_EXTENSION_API_NO 19990619 - -typedef struct _zend_extension_version_info { - int zend_extension_api_no; - char *required_zend_version; - unsigned char thread_safe; - unsigned char debug; -} zend_extension_version_info; - - -typedef struct _zend_extension zend_extension; - -struct _zend_extension { - char *name; - char *version; - char *author; - char *URL; - char *copyright; - - int (*startup)(zend_extension *extension); - void (*shutdown)(zend_extension *extension); - void (*activate)(void); - void (*deactivate)(void); - - void (*op_array_handler)(zend_op_array *op_array); - - void (*statement_handler)(zend_op_array *op_array); - void (*fcall_begin_handler)(zend_op_array *op_array); - void (*fcall_end_handler)(zend_op_array *op_array); - - void (*op_array_ctor)(void **resource); - void (*op_array_dtor)(void **resource); - - void *reserved1; - void *reserved2; - void *reserved3; - void *reserved4; - void *reserved5; - void *reserved6; - void *reserved7; - void *reserved8; - - DL_HANDLE handle; - int resource_number; -}; - - -ZEND_API int zend_get_resource_handle(zend_extension *extension); - -#ifdef ZTS -#define ZTS_V 1 -#else -#define ZTS_V 0 -#endif - - -#define ZEND_EXTENSION() \ - ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, "0.90", ZTS_V, ZEND_DEBUG } - -#define STANDARD_ZEND_EXTENSION_PROPERTIES NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, -1 - - -ZEND_API extern zend_llist zend_extensions; - -void zend_extension_dtor(zend_extension *extension); -int zend_load_extension(char *path); -int zend_load_extensions(char **extension_paths); -void zend_append_version_info(zend_extension *extension); -void zend_shutdown_extensions(void); - -#endif /* _ZEND_EXTENSIONS_H */ diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h deleted file mode 100644 index 947fc0044d..0000000000 --- a/Zend/zend_globals.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _T_GLOBALS_H -#define _T_GLOBALS_H - - -#include - -#include "zend_globals_macros.h" - -#include "zend_stack.h" -#include "zend_ptr_stack.h" -#include "zend_hash.h" -#include "zend_llist.h" - -/* Define ZTS if you want a thread-safe Zend */ -/*#undef ZTS*/ - -#ifdef ZTS -#include "../TSRM/TSRM.h" - -#ifdef __cplusplus -class ZendFlexLexer; -#endif - -BEGIN_EXTERN_C() -ZEND_API extern int compiler_globals_id; -ZEND_API extern int executor_globals_id; -extern int alloc_globals_id; -END_EXTERN_C() - -#endif - -#define SYMTABLE_CACHE_SIZE 32 - - -#include "zend_compile.h" -#include "zend_execute.h" - -/* excpt.h on Digital Unix 4.0 defines function_table */ -#undef function_table - -struct _zend_compiler_globals { - zend_stack bp_stack; - zend_stack switch_cond_stack; - zend_stack foreach_copy_stack; - zend_stack object_stack; - - zend_class_entry class_entry, *active_class_entry; - - /* variables for list() compilation */ - zend_llist list_llist; - zend_llist dimension_llist; - - zend_stack function_call_stack; - - char *compiled_filename; - - int zend_lineno; - int comment_start_line; - char *heredoc; - int heredoc_len; - - zend_op_array *active_op_array; - - HashTable *function_table; /* function symbol table */ - HashTable *class_table; /* class table */ - - HashTable used_files; /* files already included using 'use' */ - - zend_llist filenames_list; - - zend_bool short_tags; - zend_bool asp_tags; - - /* For extensions support */ - zend_bool extended_info; /* generate extension information for debugger/profiler */ - zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */ - - zend_bool unclean_shutdown; - - zend_llist open_files; -#ifdef ZTS -#ifdef __cplusplus - ZendFlexLexer *ZFL; -#else - void *ZFL; -#endif -#endif -}; - - -struct _zend_executor_globals { - zval *return_value; - - zval uninitialized_zval; - zval *uninitialized_zval_ptr; - - zval error_zval; - zval *error_zval_ptr; - - zend_function_state *function_state_ptr; - zend_ptr_stack arg_types_stack; - zend_stack overloaded_objects_stack; - zval global_return_value; - - /* symbol table cache */ - HashTable *symtable_cache[SYMTABLE_CACHE_SIZE]; - HashTable **symtable_cache_limit; - HashTable **symtable_cache_ptr; - - zend_op **opline_ptr; - - HashTable *active_symbol_table; - HashTable symbol_table; /* main symbol table */ - - HashTable imported_files; /* files already included using 'import' */ - - jmp_buf bailout; - - int error_reporting; - - zend_op_array *active_op_array; - zend_op_array *main_op_array; - - HashTable *function_table; /* function symbol table */ - HashTable *class_table; /* class table */ - HashTable *zend_constants; /* constants table */ - - long precision; - - /* for extended information support */ - zend_bool no_extensions; - - HashTable regular_list; - HashTable persistent_list; - - zend_ptr_stack argument_stack; - int free_op1, free_op2; - int (*unary_op)(zval *result, zval *op1); - int (*binary_op)(zval *result, zval *op1, zval *op2); - - zval *garbage[4]; - int garbage_ptr; - - void *reserved[ZEND_MAX_RESERVED_RESOURCES]; -#if SUPPORT_INTERACTIVE - int interactive; -#endif -}; - - - -struct _zend_alloc_globals { - mem_header *head; /* standard list */ - mem_header *phead; /* persistent list */ - void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES]; - unsigned char cache_count[MAX_CACHED_MEMORY]; - -#if MEMORY_LIMIT - unsigned int memory_limit; - unsigned int allocated_memory; - unsigned char memory_exhausted; -#endif -}; - - -#endif /* _T_GLOBALS_H */ diff --git a/Zend/zend_globals_macros.h b/Zend/zend_globals_macros.h deleted file mode 100644 index 75be8f27e2..0000000000 --- a/Zend/zend_globals_macros.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_GLOBALS_MACROS_H -#define _ZEND_GLOBALS_MACROS_H - -typedef struct _zend_compiler_globals zend_compiler_globals; -typedef struct _zend_executor_globals zend_executor_globals; -typedef struct _zend_alloc_globals zend_alloc_globals; - -/* Compiler */ -#ifdef ZTS -# define CLS_D zend_compiler_globals *compiler_globals -# define CLS_DC , CLS_D -# define CLS_C compiler_globals -# define CLS_CC , CLS_C -# define CG(v) (((zend_compiler_globals *) compiler_globals)->v) -# define CLS_FETCH() zend_compiler_globals *compiler_globals = (zend_compiler_globals *) ts_resource(compiler_globals_id) -BEGIN_EXTERN_C() -int zendparse(void *compiler_globals); -END_EXTERN_C() -#else -# define CLS_D void -# define CLS_DC -# define CLS_C -# define CLS_CC -# define CG(v) (compiler_globals.v) -# define CLS_FETCH() -extern ZEND_API struct _zend_compiler_globals compiler_globals; -int zendparse(void); -#endif - - -/* Executor */ -#ifdef ZTS -# define ELS_D zend_executor_globals *executor_globals -# define ELS_DC , ELS_D -# define ELS_C executor_globals -# define ELS_CC , ELS_C -# define EG(v) (executor_globals->v) -# define ELS_FETCH() zend_executor_globals *executor_globals = (zend_executor_globals *) ts_resource(executor_globals_id) -#else -# define ELS_D void -# define ELS_DC -# define ELS_C -# define ELS_CC -# define EG(v) (executor_globals.v) -# define ELS_FETCH() -extern ZEND_API zend_executor_globals executor_globals; -#endif - - -/* Memory Manager */ -#ifdef ZTS -# define ALS_D zend_alloc_globals *alloc_globals -# define ALS_DC , ALS_D -# define ALS_C alloc_globals -# define ALS_CC , ALS_C -# define AG(v) (((zend_alloc_globals *) alloc_globals)->v) -# define ALS_FETCH() zend_alloc_globals *alloc_globals = (zend_alloc_globals *) ts_resource(alloc_globals_id) -#else -# define ALS_D void -# define ALS_DC -# define ALS_C -# define ALS_CC -# define AG(v) (alloc_globals.v) -# define ALS_FETCH() -#endif - -#endif /* _ZEND_GLOBALS_MACROS_H */ - diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c deleted file mode 100644 index 9eb2b6cf97..0000000000 --- a/Zend/zend_hash.c +++ /dev/null @@ -1,1224 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" - -#include - -#ifdef HAVE_STDLIB_H -# include -#endif - -#ifdef HAVE_LIMITS_H -# include -#endif - -#define HANDLE_NUMERIC(key,length,func) { \ - register char *tmp=key; \ -\ - if ((*tmp>='0' && *tmp<='9')) do { /* possibly a numeric index */ \ - char *end=tmp+length-1; \ - ulong idx; \ - \ - if (*tmp++=='0' && length>2) { /* don't accept numbers with leading zeros */ \ - break; \ - } \ - while (tmp='0' && *tmp<='9')) { \ - break; \ - } \ - tmp++; \ - } \ - if (tmp==end && *tmp=='\0') { /* a numeric index */ \ - idx = strtol(key,NULL,10); \ - if (idx!=LONG_MAX) { \ - return func; \ - } \ - } \ - } while(0); \ -} - -/* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */ -static uint PrimeNumbers[] = -{5, 11, 19, 53, 107, 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793, 2097397, 4194103, 8388857, 16777447, 33554201, 67108961, 134217487, 268435697, 536870683, 1073741621, 2147483399}; - -static int if_full_do_resize(HashTable *ht); - -static uint nNumPrimeNumbers = sizeof(PrimeNumbers) / sizeof(ulong); - -ZEND_API ulong hashpjw(char *arKey, uint nKeyLength) -{ - ulong h = 0, g; - char *arEnd=arKey+nKeyLength; - - while (arKey < arEnd) { - h = (h << 4) + *arKey++; - if ((g = (h & 0xF0000000))) { - h = h ^ (g >> 24); - h = h ^ g; - } - } - return h; -} - - -ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData),int persistent) -{ - uint i; - - for (i = 0; i < nNumPrimeNumbers; i++) { - if (nSize <= PrimeNumbers[i]) { - nSize = PrimeNumbers[i]; - ht->nHashSizeIndex = i; - break; - } - } - if (i == nNumPrimeNumbers) { /* This shouldn't really happen unless the ask for a ridiculous size */ - nSize = PrimeNumbers[i - 1]; - ht->nHashSizeIndex = i - 1; - } - - /* Uses ecalloc() so that Bucket* == NULL */ - ht->arBuckets = (Bucket **) pecalloc(nSize, sizeof(Bucket *), persistent); - - if (!ht->arBuckets) { - return FAILURE; - } - if (pHashFunction == NULL) { - ht->pHashFunction = hashpjw; - } else { - ht->pHashFunction = pHashFunction; - } - ht->pDestructor = pDestructor; - ht->nTableSize = nSize; - ht->pListHead = NULL; - ht->pListTail = NULL; - ht->nNumOfElements = 0; - ht->nNextFreeElement = 0; - ht->pInternalPointer = NULL; - ht->persistent = persistent; - return SUCCESS; -} - -ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag) -{ - ulong h; - uint nIndex; - Bucket *p; - - if (nKeyLength <= 0) { -#if ZEND_DEBUG - ZEND_PUTS("zend_hash_update: Can't put in empty key\n"); -#endif - return FAILURE; - } - - HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_index_update_or_next_insert(ht,idx,pData,nDataSize,pDest,flag)); - - h = ht->pHashFunction(arKey, nKeyLength); - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - if (flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (flag & HASH_ADD_PTR) { - if (!p->pDataPtr) { - efree(p->pData); - } - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - if (p->pDataPtr) { - p->pData = (void *) emalloc(nDataSize); - p->pDataPtr=NULL; - } - memcpy(p->pData, pData, nDataSize); - } - if (pDest) { - *pDest = p->pData; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - } - p = p->pNext; - } - - p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent); - if (!p) { - return FAILURE; - } - memcpy(p->arKey, arKey, nKeyLength); - p->nKeyLength = nKeyLength; - if (flag & HASH_ADD_PTR) { - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - p->pData = (void *) pemalloc(nDataSize,ht->persistent); - if (!p->pData) { - pefree(p,ht->persistent); - pefree(p->arKey,ht->persistent); - return FAILURE; - } - memcpy(p->pData, pData, nDataSize); - p->pDataPtr=NULL; - } - p->h = h; - p->bIsPointer = 0; - p->pNext = ht->arBuckets[nIndex]; - if (pDest) { - *pDest = p->pData; - } - - HANDLE_BLOCK_INTERRUPTIONS(); - if (ht->pInternalPointer == NULL) { - ht->pInternalPointer = p; - } - ht->arBuckets[nIndex] = p; - - /* Setup the double linked list */ - p->pListLast = ht->pListTail; - ht->pListTail = p; - p->pListNext = NULL; - if (p->pListLast != NULL) { - p->pListLast->pListNext = p; - } - if (!ht->pListHead) { - ht->pListHead = p; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - ht->nNumOfElements++; - if_full_do_resize(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - -ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - uint nIndex; - Bucket *p; - - if (nKeyLength <= 0) { -#if ZEND_DEBUG - ZEND_PUTS("zend_hash_update: Can't put in empty key\n"); -#endif - return FAILURE; - } - - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - if (flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (flag & HASH_ADD_PTR) { - if (!p->pDataPtr) { - efree(p->pData); - } - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - if (p->pDataPtr) { - p->pData = (void *) emalloc(nDataSize); - p->pDataPtr=NULL; - } - memcpy(p->pData, pData, nDataSize); - } - if (pDest) { - *pDest = p->pData; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - } - p = p->pNext; - } - - p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent); - if (!p) { - return FAILURE; - } - - memcpy(p->arKey, arKey, nKeyLength); - p->nKeyLength = nKeyLength; - if (flag & HASH_ADD_PTR) { - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - p->pData = (void *) pemalloc(nDataSize,ht->persistent); - if (!p->pData) { - pefree(p,ht->persistent); - pefree(p->arKey,ht->persistent); - return FAILURE; - } - - memcpy(p->pData, pData, nDataSize); - p->pDataPtr=NULL; - } - p->h = h; - p->bIsPointer = 0; - p->pNext = ht->arBuckets[nIndex]; - if (pDest) { - *pDest = p->pData; - } - - HANDLE_BLOCK_INTERRUPTIONS(); - if (ht->pInternalPointer == NULL) { - ht->pInternalPointer = p; - } - ht->arBuckets[nIndex] = p; - - /* Setup the double linked list */ - p->pListLast = ht->pListTail; - ht->pListTail = p; - p->pListNext = NULL; - if (p->pListLast != NULL) { - p->pListLast->pListNext = p; - } - if (!ht->pListHead) { - ht->pListHead = p; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - ht->nNumOfElements++; - if_full_do_resize(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - - -ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag) -{ - uint nIndex; - Bucket *p; - - if (flag & HASH_NEXT_INSERT) { - h = ht->nNextFreeElement; - } - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->nKeyLength == 0) && (p->h == h)) { - if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) { - return FAILURE; - } - HANDLE_BLOCK_INTERRUPTIONS(); -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_index_update: p->pData == pData\n"); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return FAILURE; - } -#endif - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (flag & HASH_ADD_PTR) { - if (!p->pDataPtr) { - efree(p->pData); - } - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - if (p->pDataPtr) { - p->pData = (void *) emalloc(nDataSize); - p->pDataPtr=NULL; - } - memcpy(p->pData, pData, nDataSize); - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - if (h >= ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - if (pDest) { - *pDest = p->pData; - } - return SUCCESS; - } - p = p->pNext; - } - p = (Bucket *) pemalloc(sizeof(Bucket)-1,ht->persistent); - if (!p) { - return FAILURE; - } - p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */ - p->h = h; - - if (flag & HASH_ADD_PTR) { - p->pDataPtr = pData; - p->pData = &p->pDataPtr; - } else { - p->pData = (void *) pemalloc(nDataSize,ht->persistent); - if (!p->pData) { - pefree(p,ht->persistent); - return FAILURE; - } - memcpy(p->pData, pData, nDataSize); - p->pDataPtr=NULL; - } - p->bIsPointer = 0; - if (pDest) { - *pDest = p->pData; - } - - p->pNext = ht->arBuckets[nIndex]; - HANDLE_BLOCK_INTERRUPTIONS(); - if (ht->pInternalPointer == NULL) { - ht->pInternalPointer = p; - } - ht->arBuckets[nIndex] = p; - - /* Setup the double linked list */ - p->pListLast = ht->pListTail; - ht->pListTail = p; - p->pListNext = NULL; - if (p->pListLast != NULL) { - p->pListLast->pListNext = p; - } - if (!ht->pListHead) { - ht->pListHead = p; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - if (h >= ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - ht->nNumOfElements++; - if_full_do_resize(ht); - return SUCCESS; -} - -ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData) -{ - ulong h; - uint nIndex; - Bucket *p; - - - if (nKeyLength <= 0) { -#if ZEND_DEBUG - ZEND_PUTS("zend_hash_update: Can't put in empty key\n"); -#endif - return FAILURE; - } - - HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_pointer_index_update_or_next_insert(ht,idx,pData,HASH_UPDATE)); - - h = ht->pHashFunction(arKey, nKeyLength); - nIndex = h % ht->nTableSize; - - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_pointer_update: p->pData == pData\n"); - return FAILURE; - } -#endif - HANDLE_BLOCK_INTERRUPTIONS(); - if (!p->bIsPointer && ht->pDestructor) { - ht->pDestructor(p->pData); - pefree(p->pData,ht->persistent); - } - p->pData = pData; - p->bIsPointer = 1; - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - } - p = p->pNext; - } - p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent); - if (!p) { - return FAILURE; - } - p->nKeyLength = nKeyLength; - p->pData = pData; - p->h = h; - p->bIsPointer = 1; - memcpy(p->arKey, arKey, nKeyLength); - - p->pNext = ht->arBuckets[nIndex]; - - HANDLE_BLOCK_INTERRUPTIONS(); - if (ht->pInternalPointer == NULL) { - ht->pInternalPointer = p; - } - ht->arBuckets[nIndex] = p; - - /* Setup the double linked list */ - p->pListLast = ht->pListTail; - ht->pListTail = p; - p->pListNext = NULL; - if (p->pListLast != NULL) { - p->pListLast->pListNext = p; - } - if (!ht->pListHead) { - ht->pListHead = p; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - - ht->nNumOfElements++; - if_full_do_resize(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - - -ZEND_API int zend_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, int flag) -{ - uint nIndex; - Bucket *p; - - if (flag & HASH_NEXT_INSERT) { - h = ht->nNextFreeElement; - } - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->nKeyLength == 0) && (p->h == h)) { - if (flag & HASH_NEXT_INSERT) { - return FAILURE; - } -#if ZEND_DEBUG - if (p->pData == pData) { - ZEND_PUTS("Fatal error in zend_hash_pointer_update: p->pData == pData\n"); - return FAILURE; - } -#endif - HANDLE_BLOCK_INTERRUPTIONS(); - if (!p->bIsPointer && ht->pDestructor) { - ht->pDestructor(p->pData); - pefree(p->pData,ht->persistent); - } - p->pData = pData; - p->bIsPointer = 1; - if (h >= ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - p = p->pNext; - } - p = (Bucket *) pemalloc(sizeof(Bucket)-1,ht->persistent); - if (!p) { - return FAILURE; - } - p->nKeyLength = 0; - p->pData = pData; - p->h = h; - p->bIsPointer = 1; - - p->pNext = ht->arBuckets[nIndex]; - - HANDLE_BLOCK_INTERRUPTIONS(); - if (ht->pInternalPointer == NULL) { - ht->pInternalPointer = p; - } - ht->arBuckets[nIndex] = p; - - /* Setup the double linked list */ - p->pListLast = ht->pListTail; - ht->pListTail = p; - p->pListNext = NULL; - if (p->pListLast != NULL) { - p->pListLast->pListNext = p; - } - if (!ht->pListHead) { - ht->pListHead = p; - } - HANDLE_UNBLOCK_INTERRUPTIONS(); - - ht->nNumOfElements++; - if (h >= ht->nNextFreeElement) { - ht->nNextFreeElement = h + 1; - } - if_full_do_resize(ht); /* If the Hash table is full, resize it */ - return SUCCESS; -} - - -ZEND_API int zend_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength) -{ - ulong h; - uint nIndex; - Bucket *p; - - if (nKeyLength <= 0) { -#if ZEND_DEBUG - ZEND_PUTS("zend_hash_update: Can't check for empty key\n"); -#endif - return FAILURE; - } - - HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_index_is_pointer(ht, idx)); - - h = ht->pHashFunction(arKey, nKeyLength); - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - return (p->bIsPointer); - } - } - p = p->pNext; - } - return 0; -} - -ZEND_API int zend_hash_index_is_pointer(HashTable *ht, ulong h) -{ - uint nIndex; - Bucket *p; - - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->nKeyLength == 0) && (p->h == h)) { - return (p->bIsPointer); - } - p = p->pNext; - } - return 0; -} - - -static int if_full_do_resize(HashTable *ht) -{ - Bucket **t; - - if ((ht->nNumOfElements > ht->nTableSize) && (ht->nHashSizeIndex < nNumPrimeNumbers - 1)) { /* Let's double the table - size */ - t = (Bucket **) perealloc_recoverable(ht->arBuckets, PrimeNumbers[ht->nHashSizeIndex + 1] * sizeof(Bucket *),ht->persistent); - if (t) { - HANDLE_BLOCK_INTERRUPTIONS(); - ht->arBuckets = t; - ht->nTableSize = PrimeNumbers[ht->nHashSizeIndex + 1]; - ht->nHashSizeIndex++; - zend_hash_rehash(ht); - HANDLE_UNBLOCK_INTERRUPTIONS(); - return SUCCESS; - } - return FAILURE; - } - return SUCCESS; -} - -ZEND_API int zend_hash_rehash(HashTable *ht) -{ - Bucket *p; - uint nIndex; - - memset(ht->arBuckets, 0, PrimeNumbers[ht->nHashSizeIndex] * sizeof(Bucket *)); - p = ht->pListHead; - while (p != NULL) { - nIndex = p->h % ht->nTableSize; - p->pNext = ht->arBuckets[nIndex]; - ht->arBuckets[nIndex] = p; - p = p->pListNext; - } - return SUCCESS; -} - -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag) -{ - uint nIndex; - Bucket *p, *t = NULL; /* initialize just to shut gcc up with -Wall */ - - if (flag == HASH_DEL_KEY) { - HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_del_key_or_index(ht,arKey,nKeyLength,idx,HASH_DEL_INDEX)); - h = ht->pHashFunction(arKey, nKeyLength); - } - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && ((p->nKeyLength == 0) || /* Numeric index */ - ((p->nKeyLength == nKeyLength) && (!memcmp(p->arKey, arKey, nKeyLength))))) { - HANDLE_BLOCK_INTERRUPTIONS(); - if (p == ht->arBuckets[nIndex]) { - ht->arBuckets[nIndex] = p->pNext; - } else { - t->pNext = p->pNext; - } - if (p->pListLast != NULL) { - p->pListLast->pListNext = p->pListNext; - } else { - /* Deleting the head of the list */ - ht->pListHead = p->pListNext; - } - if (p->pListNext != NULL) { - p->pListNext->pListLast = p->pListLast; - } else { - ht->pListTail = p->pListLast; - } - if (!p->bIsPointer) { - if (ht->pDestructor) { - ht->pDestructor(p->pData); - } - if (!p->pDataPtr) { - pefree(p->pData,ht->persistent); - } - } - if (ht->pInternalPointer == p) { - ht->pInternalPointer = p->pListNext; - } - pefree(p,ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); - ht->nNumOfElements--; - return SUCCESS; - } - t = p; - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API void zend_hash_destroy(HashTable *ht) -{ - Bucket *p, *q; - int delete_bucket; - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (!q->bIsPointer) { - if (ht->pDestructor) { - delete_bucket = ht->pDestructor(q->pData); - } else { - delete_bucket = 1; - } - if (!q->pDataPtr && q->pData && delete_bucket) { - pefree(q->pData,ht->persistent); - } - } else { - delete_bucket = 1; - } - if (delete_bucket) { - pefree(q,ht->persistent); - } - } - pefree(ht->arBuckets,ht->persistent); -} - - -ZEND_API void zend_hash_clean(HashTable *ht) -{ - Bucket *p, *q; - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (!q->bIsPointer) { - if (ht->pDestructor) { - ht->pDestructor(q->pData); - } - if (!q->pDataPtr && q->pData) { - pefree(q->pData,ht->persistent); - } - } - pefree(q,ht->persistent); - } - memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *)); - ht->pListHead = NULL; - ht->pListTail = NULL; - ht->nNumOfElements = 0; - ht->nNextFreeElement = 0; - ht->pInternalPointer = NULL; -} - - -/* This is used to selectively delete certain entries from a hashtable. - * destruct() receives the data and decides if the entry should be deleted - * or not - */ -ZEND_API void zend_hash_apply(HashTable *ht,int (*destruct) (void *)) -{ - Bucket *p, *q; - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (destruct(q->pData)) { - if (q->nKeyLength==0) { - zend_hash_index_del(ht, q->h); - } else { - zend_hash_del(ht,q->arKey,q->nKeyLength); - } - } - } -} - - -ZEND_API void zend_hash_apply_with_argument(HashTable *ht,int (*destruct) (void *, void *), void *argument) -{ - Bucket *p, *q; - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - if (destruct(q->pData, argument)) { - if (q->nKeyLength == 0) { - zend_hash_index_del(ht, q->h); - } else { - zend_hash_del(ht,q->arKey,q->nKeyLength); - } - } - } -} - - -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht,int (*destruct)(void *, int, va_list, zend_hash_key *), int num_args, ...) -{ - Bucket *p, *q; - va_list args; - zend_hash_key hash_key; - - va_start(args, num_args); - - p = ht->pListHead; - while (p != NULL) { - q = p; - p = p->pListNext; - hash_key.arKey = q->arKey; - hash_key.nKeyLength = q->nKeyLength; - hash_key.h = q->h; - if (destruct(q->pData, num_args, args, &hash_key)) { - if (q->nKeyLength == 0) { - zend_hash_index_del(ht, q->h); - } else { - zend_hash_del(ht,q->arKey,q->nKeyLength); - } - } - } - - va_end(args); -} - - - -ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size) -{ - Bucket *p; - - p = source->pListHead; - while (p) { - memcpy(tmp, p->pData, size); - if (pCopyConstructor) { - pCopyConstructor(tmp); - } - if (p->nKeyLength) { - zend_hash_update(target, p->arKey, p->nKeyLength, tmp, size, NULL); - } else { - zend_hash_index_update(target, p->h, tmp, size, NULL); - } - p = p->pListNext; - } - target->pInternalPointer = target->pListHead; -} - - -ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite) -{ - Bucket *p; - void *t; - int mode = (overwrite?HASH_UPDATE:HASH_ADD); - - p = source->pListHead; - while (p) { - memcpy(tmp, p->pData, size); - if (p->nKeyLength>0) { - if (zend_hash_add_or_update(target, p->arKey, p->nKeyLength, tmp, size, &t, mode)==SUCCESS && pCopyConstructor) { - pCopyConstructor(t); - } - } else { - if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, tmp, size, &t)==SUCCESS && pCopyConstructor) { - pCopyConstructor(t); - } - } - p = p->pListNext; - } - target->pInternalPointer = target->pListHead; -} - - -ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength) -{ - return ht->pHashFunction(arKey, nKeyLength); -} - - -/* Returns SUCCESS if found and FAILURE if not. The pointer to the - * data is returned in pData. The reason is that there's no reason - * someone using the hash table might not want to have NULL data - */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData) -{ - ulong h; - uint nIndex; - Bucket *p; - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht,idx,pData)); - - h = ht->pHashFunction(arKey, nKeyLength); - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - *pData = p->pData; - return SUCCESS; - } - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData) -{ - uint nIndex; - Bucket *p; - - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - *pData = p->pData; - return SUCCESS; - } - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength) -{ - ulong h; - uint nIndex; - Bucket *p; - - HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht,idx)); - - h = ht->pHashFunction(arKey, nKeyLength); - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == nKeyLength)) { - if (!memcmp(p->arKey, arKey, nKeyLength)) { - return 1; - } - } - p = p->pNext; - } - return 0; -} - - -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData) -{ - uint nIndex; - Bucket *p; - - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == 0)) { - *pData = p->pData; - return SUCCESS; - } - p = p->pNext; - } - return FAILURE; -} - - -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h) -{ - uint nIndex; - Bucket *p; - - nIndex = h % ht->nTableSize; - - p = ht->arBuckets[nIndex]; - while (p != NULL) { - if ((p->h == h) && (p->nKeyLength == 0)) { - return 1; - } - p = p->pNext; - } - return 0; -} - - -ZEND_API int zend_hash_num_elements(HashTable *ht) -{ - return ht->nNumOfElements; -} - - -ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht) -{ - ht->pInternalPointer = ht->pListHead; -} - - -/* This function will be extremely optimized by remembering - * the end of the list - */ -ZEND_API void zend_hash_internal_pointer_end(HashTable *ht) -{ - ht->pInternalPointer = ht->pListTail; -} - - -ZEND_API void zend_hash_move_forward(HashTable *ht) -{ - if (ht->pInternalPointer) { - ht->pInternalPointer = ht->pInternalPointer->pListNext; - } -} - -ZEND_API void zend_hash_move_backwards(HashTable *ht) -{ - if (ht->pInternalPointer) { - ht->pInternalPointer = ht->pInternalPointer->pListLast; - } -} - - -/* This function should be made binary safe */ -ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index) -{ - Bucket *p = ht->pInternalPointer; - - if (p) { - if (p->nKeyLength) { - *str_index = (char *) pemalloc(p->nKeyLength,ht->persistent); - memcpy(*str_index, p->arKey, p->nKeyLength); - return HASH_KEY_IS_STRING; - } else { - *num_index = p->h; - return HASH_KEY_IS_LONG; - } - } - return HASH_KEY_NON_EXISTANT; -} - - -ZEND_API int zend_hash_get_current_key_type(HashTable *ht) -{ - Bucket *p = ht->pInternalPointer; - - if (p) { - if (p->nKeyLength) { - return HASH_KEY_IS_STRING; - } else { - return HASH_KEY_IS_LONG; - } - } - return HASH_KEY_NON_EXISTANT; -} - - -ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData) -{ - Bucket *p = ht->pInternalPointer; - - if (p) { - *pData = p->pData; - return SUCCESS; - } else { - return FAILURE; - } -} - - -ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, - compare_func_t compar, int renumber) -{ - Bucket **arTmp; - Bucket *p; - int i, j; - - if (ht->nNumOfElements <= 1) { /* Doesn't require sorting */ - return SUCCESS; - } - arTmp = (Bucket **) pemalloc(ht->nNumOfElements * sizeof(Bucket *),ht->persistent); - if (!arTmp) { - return FAILURE; - } - p = ht->pListHead; - i = 0; - while (p) { - arTmp[i] = p; - p = p->pListNext; - i++; - } - - (*sort_func)((void *) arTmp, i, sizeof(Bucket *), compar); - - HANDLE_BLOCK_INTERRUPTIONS(); - ht->pListHead = arTmp[0]; - ht->pListTail = NULL; - ht->pInternalPointer = ht->pListHead; - - for (j = 0; j < i; j++) { - if (ht->pListTail) { - ht->pListTail->pListNext = arTmp[j]; - } - arTmp[j]->pListLast = ht->pListTail; - arTmp[j]->pListNext = NULL; - ht->pListTail = arTmp[j]; - } - pefree(arTmp,ht->persistent); - HANDLE_UNBLOCK_INTERRUPTIONS(); - - if (renumber) { - p = ht->pListHead; - i=0; - while (p != NULL) { - p->nKeyLength = 0; - p->h = i++; - p = p->pListNext; - } - ht->nNextFreeElement = i; - zend_hash_rehash(ht); - } - return SUCCESS; -} - - -ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const void *), int flag, void **pData) -{ - Bucket *p,*res; - - if (ht->nNumOfElements == 0 ) { - *pData=NULL; - return FAILURE; - } - - res = p = ht->pListHead; - while ((p = p->pListNext)) { - if (flag) { - if (compar(&res,&p) < 0) { /* max */ - res = p; - } - } else { - if (compar(&res,&p) > 0) { /* min */ - res = p; - } - } - } - *pData = res->pData; - return SUCCESS; -} - -ZEND_API ulong zend_hash_next_free_element(HashTable *ht) -{ - return ht->nNextFreeElement; - -} - -#if ZEND_DEBUG -void zend_hash_display_pListTail(HashTable *ht) -{ - Bucket *p; - - p = ht->pListTail; - while (p != NULL) { - zend_printf("pListTail has key %s\n", p->arKey); - p = p->pListLast; - } -} - -void zend_hash_display(HashTable *ht) -{ - Bucket *p; - uint i; - - for (i = 0; i < ht->nTableSize; i++) { - p = ht->arBuckets[i]; - while (p != NULL) { - zend_printf("%s <==> 0x%X\n", p->arKey, p->h); - p = p->pNext; - } - } - - p = ht->pListTail; - while (p != NULL) { - zend_printf("%s <==> 0x%X\n", p->arKey, p->h); - p = p->pListLast; - } -} -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_hash.h b/Zend/zend_hash.h deleted file mode 100644 index dc2a469a54..0000000000 --- a/Zend/zend_hash.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - -#ifndef _HASH_ -#define _HASH_ - -#include - -#define HASH_KEY_IS_STRING 1 -#define HASH_KEY_IS_LONG 2 -#define HASH_KEY_NON_EXISTANT 3 - -#define HASH_UPDATE (1<<0) -#define HASH_ADD (1<<1) -#define HASH_NEXT_INSERT (1<<2) -#define HASH_ADD_PTR (1<<3) - -#define HASH_DEL_KEY 0 -#define HASH_DEL_INDEX 1 - -struct hashtable; - -typedef struct bucket { - ulong h; /* Used for numeric indexing */ - uint nKeyLength; - void *pData; - void *pDataPtr; - char bIsPointer; - struct bucket *pListNext; - struct bucket *pListLast; - struct bucket *pNext; - char arKey[1]; /* Must be last element */ -} Bucket; - -typedef struct hashtable { - uint nTableSize; - uint nHashSizeIndex; - uint nNumOfElements; - ulong nNextFreeElement; - ulong(*pHashFunction) (char *arKey, uint nKeyLength); - Bucket *pInternalPointer; /* Used for element traversal */ - Bucket *pListHead; - Bucket *pListTail; - Bucket **arBuckets; - int (*pDestructor) (void *pData); - unsigned char persistent; -} HashTable; - -typedef int (*compare_func_t) (const void *, const void *); -typedef void (*sort_func_t) (void *, size_t, register size_t, compare_func_t); - -BEGIN_EXTERN_C() - -/* startup/shutdown */ -ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData), int persistent); -ZEND_API void zend_hash_destroy(HashTable *ht); - -ZEND_API void zend_hash_clean(HashTable *ht); - -/* additions/updates/changes */ -ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest,int flag); -#define zend_hash_update(ht,arKey,nKeyLength,pData,nDataSize,pDest) \ - zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_UPDATE) -#define zend_hash_add(ht,arKey,nKeyLength,pData,nDataSize,pDest) \ - zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_ADD) -#define zend_hash_update_ptr(ht,arKey,nKeyLength,pData,nDataSize,pDest) \ - zend_hash_add_or_update(ht,arKey,nKeyLength,pData,0,pDest,(HASH_UPDATE|HASH_ADD_PTR)) - -ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest,int flag); -#define zend_hash_quick_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \ - zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_UPDATE) -#define zend_hash_quick_add(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \ - zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_ADD) -#define zend_hash_quick_update_ptr(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \ - zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,0,pDest,HASH_UPDATE|HASH_ADD_PTR) - -ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag); -#define zend_hash_index_update(ht,h,pData,nDataSize,pDest) \ - zend_hash_index_update_or_next_insert(ht,h,pData,nDataSize,pDest,HASH_UPDATE) -#define zend_hash_next_index_insert(ht,pData,nDataSize,pDest) \ - zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT) -#define zend_hash_next_index_insert_ptr(ht,pData,nDataSize,pDest) \ - zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT|HASH_ADD_PTR) - -ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData); - -typedef struct _zend_hash_key { - char *arKey; - uint nKeyLength; - ulong h; -} zend_hash_key; - - -#define ZEND_STD_HASH_APPLIER \ - int (*)(void *element, int num_args, va_list args, zend_hash_key *hash_key) - -ZEND_API int zend_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, int flag); -#define zend_hash_pointer_index_update(ht,h,pData) \ - zend_hash_pointer_index_update_or_next_insert(ht,h,pData,HASH_UPDATE) -#define zend_hash_next_index_pointer_insert(ht,pData) \ - zend_hash_pointer_index_update_or_next_insert(ht,0,pData,HASH_NEXT_INSERT) -ZEND_API void zend_hash_apply(HashTable *ht,int (*destruct)(void *)); -ZEND_API void zend_hash_apply_with_argument(HashTable *ht,int (*destruct)(void *, void *), void *); -ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, ZEND_STD_HASH_APPLIER, int, ...); - - - - -/* Deletes */ -ZEND_API int zend_hash_del_key_or_index(HashTable *ht, char *arKey, uint nKeyLength, ulong h, int flag); -#define zend_hash_del(ht,arKey,nKeyLength) \ - zend_hash_del_key_or_index(ht,arKey,nKeyLength,0,HASH_DEL_KEY) -#define zend_hash_index_del(ht,h) \ - zend_hash_del_key_or_index(ht,NULL,0,h,HASH_DEL_INDEX) - -ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength); - -/* Data retreival */ -ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData); -ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData); -ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData); - -/* Misc */ -ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h); -ZEND_API int zend_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength); -ZEND_API int zend_hash_index_is_pointer(HashTable *ht, ulong h); -ZEND_API ulong zend_hash_next_free_element(HashTable *ht); - -/* traversing */ -ZEND_API void zend_hash_move_forward(HashTable *ht); -ZEND_API void zend_hash_move_backwards(HashTable *ht); -ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index); -ZEND_API int zend_hash_get_current_key_type(HashTable *ht); -ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData); -ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht); -ZEND_API void zend_hash_internal_pointer_end(HashTable *ht); - -/* Copying, merging and sorting */ -ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size); -ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite); -ZEND_API int zend_hash_sort(HashTable *ht, sort_func_t sort_func, compare_func_t compare_func, int renumber); -ZEND_API int zend_hash_minmax(HashTable *ht, int (*compar) (const void *, const void *), int flag, void **pData); - -ZEND_API int zend_hash_num_elements(HashTable *ht); - -ZEND_API int zend_hash_rehash(HashTable *ht); - -ZEND_API ulong hashpjw(char *arKey, uint nKeyLength); - -#if ZEND_DEBUG -/* debug */ -void zend_hash_display_pListTail(HashTable *ht); -void zend_hash_display(HashTable *ht); -#endif - -END_EXTERN_C() - -#endif /* _HASH_ */ diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c deleted file mode 100644 index c68542c0d1..0000000000 --- a/Zend/zend_highlight.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend-parser.h" -#include "zend_compile.h" -#include "zend_highlight.h" -#include "zend_ptr_stack.h" -#include "zend_globals.h" - -#ifndef ZTS -extern char *zendtext; -extern int zendleng; -#else -#define zendtext ((char *) zend_get_zendtext(CLS_C)) -#define zendleng zend_get_zendleng(CLS_C) -#endif - -static void html_putc(char c) -{ - switch (c) { - case '\n': - ZEND_PUTS("
"); - break; - case '<': - ZEND_PUTS("<"); - break; - case '>': - ZEND_PUTS(">"); - break; - case '&': - ZEND_PUTS("&"); - break; - case ' ': - ZEND_PUTS(" "); - break; - case '\t': - ZEND_PUTS("    "); - break; - default: - ZEND_PUTC(c); - break; - } -} - - -static void html_puts(char *s, uint len) -{ - register char *ptr=s, *end=s+len; - - while (ptrhighlight_html; - char *next_color; - int in_string=0; - CLS_FETCH(); - - zend_printf("\n", last_color); - /* highlight stuff coming back from zendlex() */ - token.type = 0; - while ((token_type=lex_scan(&token CLS_CC))) { - switch (token_type) { - case T_INLINE_HTML: - next_color = syntax_highlighter_ini->highlight_html; - break; - case T_COMMENT: - next_color = syntax_highlighter_ini->highlight_comment; - break; - case T_OPEN_TAG: - next_color = syntax_highlighter_ini->highlight_default; - break; - case T_CLOSE_TAG: - next_color = syntax_highlighter_ini->highlight_default; - break; - case T_CONSTANT_ENCAPSED_STRING: - next_color = syntax_highlighter_ini->highlight_string; - break; - case '"': - next_color = syntax_highlighter_ini->highlight_string; - in_string = !in_string; - break; - case T_WHITESPACE: - html_puts(zendtext, zendleng); /* no color needed */ - token.type = 0; - continue; - break; - default: - if (token.type==0) { - next_color = syntax_highlighter_ini->highlight_keyword; - } else { - if (in_string) { - next_color = syntax_highlighter_ini->highlight_string; - } else { - next_color = syntax_highlighter_ini->highlight_default; - } - } - break; - } - - if (last_color != next_color) { - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf(""); - } - last_color = next_color; - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("", last_color); - } - } - switch (token_type) { - case T_DOLLAR_OPEN_CURLY_BRACES: - html_puts("{", 1); - break; - default: - html_puts(zendtext, zendleng); - break; - } - - if (token.type == IS_STRING) { - switch (token_type) { - case T_OPEN_TAG: - case T_CLOSE_TAG: - case T_WHITESPACE: - break; - default: - efree(token.value.str.val); - break; - } - } - token.type = 0; - } - if (last_color != syntax_highlighter_ini->highlight_html) { - zend_printf("\n"); - } - zend_printf("\n"); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_highlight.h b/Zend/zend_highlight.h deleted file mode 100644 index 61b75ebab9..0000000000 --- a/Zend/zend_highlight.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _HIGHLIGHT_H -#define _HIGHLIGHT_H - -#define HL_COMMENT_COLOR "#FF8000" /* orange */ -#define HL_DEFAULT_COLOR "#0000BB" /* blue */ -#define HL_HTML_COLOR "#000000" /* black */ -#define HL_STRING_COLOR "#DD0000" /* red */ -#define HL_BG_COLOR "#FFFFFF" /* white */ -#define HL_KEYWORD_COLOR "#007700" /* green */ - - -typedef struct _zend_syntax_highlighter_ini { - char *highlight_html; - char *highlight_comment; - char *highlight_default; - char *highlight_string; - char *highlight_keyword; -} zend_syntax_highlighter_ini; - - -BEGIN_EXTERN_C() -ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini); -int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini); -int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini); -END_EXTERN_C() - -extern zend_syntax_highlighter_ini syntax_highlighter_ini; - -#endif diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c deleted file mode 100644 index 969848d1e9..0000000000 --- a/Zend/zend_indent.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -/* This indenter doesn't really work, it's here for no particular reason. */ - - -#include "zend.h" -#include "zend-parser.h" -#include "zend_compile.h" -#include "zend_indent.h" - -#ifndef ZTS -extern char *zendtext; -extern int zendleng; -#else -#define zendtext ((char *) zend_get_zendtext(CLS_C)) -#define zendleng zend_get_zendleng(CLS_C) -#endif - - -static void handle_whitespace(int *emit_whitespace) -{ - unsigned char c; - int i; - - for (c=0; c<128; c++) { - if (emit_whitespace[c]>0) { - for (i=0; i0) { - ZEND_PUTS(" {\n"); - memset(emit_whitespace, 0, sizeof(int)*256); - } else { - ZEND_PUTS("{"); - } - break; - case '}': - nest_level--; - if (emit_whitespace['\n']==0) { - ZEND_PUTS("\n"); - } - for (i=0; i0) { - for (i=0; i | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_INDENT_H -#define _ZEND_INDENT_H - -ZEND_API void zend_indent(void); - -#endif /* _ZEND_INDENT_H */ diff --git a/Zend/zend_list.c b/Zend/zend_list.c deleted file mode 100644 index fd579990b5..0000000000 --- a/Zend/zend_list.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -/* resource lists */ - -#include "zend.h" -#include "zend_list.h" -#include "zend_API.h" -#include "zend_globals.h" - -ZEND_API int le_index_ptr; - -static inline int zend_list_do_insert(HashTable *list,void *ptr, int type) -{ - int index; - list_entry le; - - index = zend_hash_next_free_element(list); - - if (index==0) index++; - - le.ptr=ptr; - le.type=type; - le.refcount=1; - zend_hash_index_update(list, index, (void *) &le, sizeof(list_entry), NULL); - return index; -} - -static inline int zend_list_do_delete(HashTable *list,int id) -{ - list_entry *le; - ELS_FETCH(); - - if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */ - if (--le->refcount<=0) { - return zend_hash_index_del(&EG(regular_list), id); - } else { - return SUCCESS; - } - } else { - return FAILURE; - } -} - - -static inline void *zend_list_do_find(HashTable *list,int id, int *type) -{ - list_entry *le; - - if (zend_hash_index_find(list, id, (void **) &le)==SUCCESS) { - *type = le->type; - return le->ptr; - } else { - *type = -1; - return NULL; - } -} - - -ZEND_API int zend_list_insert(void *ptr, int type) -{ - ELS_FETCH(); - - return zend_list_do_insert(&EG(regular_list), ptr, type); -} - - -ZEND_API int zend_plist_insert(void *ptr, int type) -{ - ELS_FETCH(); - - return zend_list_do_insert(&EG(persistent_list), ptr, type); -} - - -ZEND_API int zend_list_addref(int id) -{ - list_entry *le; - ELS_FETCH(); - - if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) { -/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */ - le->refcount++; - return SUCCESS; - } else { - return FAILURE; - } -} - - -ZEND_API int zend_list_delete(int id) -{ - ELS_FETCH(); - - return zend_list_do_delete(&EG(regular_list), id); -} - - -ZEND_API int zend_plist_delete(int id) -{ - ELS_FETCH(); - - return zend_list_do_delete(&EG(persistent_list), id); -} - - -ZEND_API void *zend_list_find(int id, int *type) -{ - ELS_FETCH(); - - return zend_list_do_find(&EG(regular_list), id, type); -} - - -ZEND_API void *zend_plist_find(int id, int *type) -{ - ELS_FETCH(); - - return zend_list_do_find(&EG(persistent_list), id, type); -} - - -ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type) -{ - int rsrc_id; - - rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type); - - if (rsrc_result) { - rsrc_result->value.lval = rsrc_id; - rsrc_result->type = IS_RESOURCE; - } - - return rsrc_id; -} - - -ZEND_API void *zend_fetch_resource(zval **passed_id, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...) -{ - int id; - int actual_resource_type; - void *resource; - va_list resource_types; - int i; - - if (default_id==-1) { /* use id */ - if (!passed_id) { - if (resource_type_name) { - zend_error(E_WARNING, "No %s resource supplied", resource_type_name); - } - return NULL; - } else if ((*passed_id)->type != IS_RESOURCE) { - if (resource_type_name) { - zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name); - } - return NULL; - } - id = (*passed_id)->value.lval; - } else { - id = default_id; - } - - resource = zend_list_find(id, &actual_resource_type); - if (!resource) { - if (resource_type_name) - zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name); - return NULL; - } - - va_start(resource_types, num_resource_types); - for (i=0; itype,(void **) &ld)==SUCCESS) { - if (ld->list_destructor) { - (ld->list_destructor)(le->ptr); - } - } else { - zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type); - } - return 1; -} - - -int plist_entry_destructor(void *ptr) -{ - list_entry *le = (list_entry *) ptr; - list_destructors_entry *ld; - - if (zend_hash_index_find(&list_destructors,le->type,(void **) &ld)==SUCCESS) { - if (ld->plist_destructor) { - (ld->plist_destructor)(le->ptr); - } - } else { - zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type); - } - return 1; -} - - -int init_resource_list(ELS_D) -{ - return zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0); -} - - -int init_resource_plist(ELS_D) -{ - return zend_hash_init(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1); -} - - -void destroy_resource_list(void) -{ - ELS_FETCH(); - - zend_hash_destroy(&EG(regular_list)); -} - - -void destroy_resource_plist(void) -{ - ELS_FETCH(); - - zend_hash_destroy(&EG(persistent_list)); -} - - -static int clean_module_resource(list_entry *le, int *resource_id) -{ - if (le->type == *resource_id) { - return 1; - } else { - return 0; - } -} - - -int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number) -{ - if (ld->module_number == *module_number) { - ELS_FETCH(); - - zend_hash_apply_with_argument(&EG(persistent_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id)); - return 1; - } else { - return 0; - } -} - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_list.h b/Zend/zend_list.h deleted file mode 100644 index ac0b4038e5..0000000000 --- a/Zend/zend_list.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _LIST_H -#define _LIST_H - -#include "zend_hash.h" -#include "zend_globals.h" - -extern HashTable list_destructors; - -typedef struct _list_entry { - void *ptr; - int type; - int refcount; -} list_entry; - -typedef struct _list_destructors_entry { - void (*list_destructor)(void *); - void (*plist_destructor)(void *); - int module_number; - int resource_id; -} list_destructors_entry; - -#define register_list_destructors(ld,pld) _register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number); -ZEND_API int _register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number); - -enum list_entry_type { - LE_DB=1000 -}; - -int list_entry_destructor(void *ptr); -int plist_entry_destructor(void *ptr); - -int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number); -int init_resource_list(ELS_D); -int init_resource_plist(ELS_D); -void destroy_resource_list(void); -void destroy_resource_plist(void); - -ZEND_API int zend_list_insert(void *ptr, int type); -ZEND_API int zend_plist_insert(void *ptr, int type); -ZEND_API int zend_list_addref(int id); -ZEND_API int zend_list_delete(int id); -ZEND_API int zend_plist_delete(int id); -ZEND_API void *zend_list_find(int id, int *type); -ZEND_API void *zend_plist_find(int id, int *type); - -ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type); -ZEND_API void *zend_fetch_resource(zval **passed_id, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...); - -extern ZEND_API int le_index_ptr; /* list entry type for index pointers */ - -#define ZEND_VERIFY_RESOURCE(rsrc) \ - if (!rsrc) { \ - RETURN_FALSE; \ - } - -#define ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type) \ - rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 1, resource_type); \ - ZEND_VERIFY_RESOURCE(rsrc); - -#define ZEND_FETCH_RESOURCE2(rsrc, rsrc_type, passed_id, default_id, resource_type_name, resource_type1,resource_type2) \ - rsrc = (rsrc_type) zend_fetch_resource(passed_id, default_id, resource_type_name, NULL, 2, resource_type1, resource_type2); \ - ZEND_VERIFY_RESOURCE(rsrc); - -#define ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type) \ - zend_register_resource(rsrc_result, rsrc_pointer, rsrc_type); - -#endif diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c deleted file mode 100644 index 1024f0fa8e..0000000000 --- a/Zend/zend_llist.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_llist.h" - -ZEND_API void zend_llist_init(zend_llist *l, size_t size, void (*dtor)(void *data), unsigned char persistent) -{ - l->head = NULL; - l->tail = NULL; - l->size = size; - l->dtor = dtor; - l->persistent = persistent; -} - - -ZEND_API void zend_llist_add_element(zend_llist *l, void *element) -{ - zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); - - tmp->prev = l->tail; - tmp->next = NULL; - if (l->tail) { - l->tail->next = tmp; - } else { - l->head = tmp; - } - l->tail = tmp; - memcpy(tmp->data, element, l->size); -} - - -ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) -{ - zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); - - tmp->next = l->head; - tmp->prev = NULL; - if (l->head) { - l->head->prev = tmp; - } else { - l->tail = tmp; - } - l->head = tmp; - memcpy(tmp->data, element, l->size); -} - - -ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)) -{ - zend_llist_element *current=l->head; - - while (current) { - if (compare(current->data, element)) { - if (current->prev) { - current->prev->next = current->next; - } else { - l->head = current->next; - } - if (current->next) { - current->next->prev = current->prev; - } else { - l->tail = current->prev; - } - if (l->dtor) { - l->dtor(current->data); - efree(current); - } - break; - } - current = current->next; - } -} - - -ZEND_API void zend_llist_destroy(zend_llist *l) -{ - zend_llist_element *current=l->head, *next; - - while (current) { - next = current->next; - if (l->dtor) { - l->dtor(current->data); - } - pefree(current, l->persistent); - current = next; - } -} - - -ZEND_API void zend_llist_clean(zend_llist *l) -{ - zend_llist_destroy(l); - l->head = l->tail = NULL; -} - - -ZEND_API void zend_llist_remove_tail(zend_llist *l) -{ - zend_llist_element *old_tail; - - if ((old_tail = l->tail)) { - if (l->tail->prev) { - l->tail->prev->next = NULL; - } - l->tail = l->tail->prev; - efree(old_tail); - } -} - - -ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src) -{ - zend_llist_element *ptr; - - zend_llist_init(dst, src->size, src->dtor, src->persistent); - ptr = src->head; - while (ptr) { - zend_llist_add_element(dst, ptr->data); - ptr = ptr->next; - } -} - - -ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data)) -{ - zend_llist_element *element; - - for (element=l->head; element; element=element->next) { - func(element->data); - } -} - - -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg) -{ - zend_llist_element *element; - - for (element=l->head; element; element=element->next) { - func(element->data, arg); - } -} - - -ZEND_API int zend_llist_count(zend_llist *l) -{ - zend_llist_element *element; - int element_count=0; - - for (element=l->head; element; element=element->next) { - element_count++; - } - return element_count; -} - - -ZEND_API void *zend_llist_get_first(zend_llist *l) -{ - l->traverse_ptr = l->head; - if (l->traverse_ptr) { - return l->traverse_ptr->data; - } else { - return NULL; - } -} - - -ZEND_API void *zend_llist_get_last(zend_llist *l) -{ - l->traverse_ptr = l->tail; - if (l->traverse_ptr) { - return l->traverse_ptr->data; - } else { - return NULL; - } -} - - -ZEND_API void *zend_llist_get_next(zend_llist *l) -{ - if (l->traverse_ptr) { - l->traverse_ptr = l->traverse_ptr->next; - if (l->traverse_ptr) { - return l->traverse_ptr->data; - } - } - return NULL; -} - - -ZEND_API void *zend_llist_get_prev(zend_llist *l) -{ - if (l->traverse_ptr) { - l->traverse_ptr = l->traverse_ptr->prev; - if (l->traverse_ptr) { - return l->traverse_ptr->data; - } - } - return NULL; -} diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h deleted file mode 100644 index c6eddb59b2..0000000000 --- a/Zend/zend_llist.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_LLIST_H -#define _ZEND_LLIST_H - -#include - -typedef struct _zend_llist_element { - struct _zend_llist_element *next; - struct _zend_llist_element *prev; - char data[1]; /* Needs to always be last in the struct */ -} zend_llist_element; - -typedef struct _zend_llist { - zend_llist_element *head; - zend_llist_element *tail; - size_t size; - void (*dtor)(void *data); - unsigned char persistent; - zend_llist_element *traverse_ptr; -} zend_llist; - -BEGIN_EXTERN_C() -ZEND_API void zend_llist_init(zend_llist *l, size_t size, void (*dtor)(void *data), unsigned char persistent); -ZEND_API void zend_llist_add_element(zend_llist *l, void *element); -ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element); -ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2)); -ZEND_API void zend_llist_destroy(zend_llist *l); -ZEND_API void zend_llist_clean(zend_llist *l); -ZEND_API void zend_llist_remove_tail(zend_llist *l); -ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src); -ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data)); -ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg); -ZEND_API int zend_llist_count(zend_llist *l); - -/* traversal */ -ZEND_API void *zend_llist_get_first(zend_llist *l); -ZEND_API void *zend_llist_get_last(zend_llist *l); -ZEND_API void *zend_llist_get_next(zend_llist *l); -ZEND_API void *zend_llist_get_prev(zend_llist *l); -END_EXTERN_C() - -#endif /* _ZEND_LLIST_H */ diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h deleted file mode 100644 index e028ef2e4f..0000000000 --- a/Zend/zend_modules.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _MODULES_H -#define _MODULES_H - -#define INIT_FUNC_ARGS int type, int module_number -#define INIT_FUNC_ARGS_PASSTHRU type, module_number -#define SHUTDOWN_FUNC_ARGS int type, int module_number -#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number -#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module - -#define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0 - -#define STANDARD_MODULE_PROPERTIES \ - NULL, NULL, STANDARD_MODULE_PROPERTIES_EX - -#define MODULE_PERSISTENT 1 -#define MODULE_TEMPORARY 2 - -typedef struct _zend_module_entry zend_module_entry; - -struct _zend_module_entry { - char *name; - zend_function_entry *functions; - int (*module_startup_func)(INIT_FUNC_ARGS); - int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS); - int (*request_startup_func)(INIT_FUNC_ARGS); - int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS); - void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS); - int (*global_startup_func)(void); - int (*global_shutdown_func)(void); - int module_started; - unsigned char type; - void *handle; - int module_number; -}; - - -extern HashTable module_registry; - -void module_destructor(zend_module_entry *module); -int module_registry_cleanup(zend_module_entry *module); -int module_registry_request_startup(zend_module_entry *module); - -#define ZEND_MODULE_DTOR (int (*)(void *)) module_destructor -#endif diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c deleted file mode 100644 index 5aa107305b..0000000000 --- a/Zend/zend_opcode.c +++ /dev/null @@ -1,414 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include - -#include "zend.h" -#include "zend_alloc.h" -#include "zend_compile.h" -#include "zend_variables.h" -#include "zend_operators.h" -#include "zend_extensions.h" -#include "zend_API.h" - - -static void zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->op_array_ctor) { - if (extension->resource_number>=0) { - extension->op_array_ctor(&op_array->reserved[extension->resource_number]); - } else { - extension->op_array_ctor(NULL); - } - } -} - - -static void zend_extension_op_array_dtor_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->op_array_dtor) { - if (extension->resource_number>=0) { - extension->op_array_dtor(&op_array->reserved[extension->resource_number]); - } else { - extension->op_array_dtor(NULL); - } - } -} - - -static void op_array_alloc_ops(zend_op_array *op_array) -{ - op_array->opcodes = erealloc(op_array->opcodes, (op_array->size)*sizeof(zend_op)); -} - - - -void init_op_array(zend_op_array *op_array, int initial_ops_size) -{ - op_array->type = ZEND_USER_FUNCTION; -#if SUPPORT_INTERACTIVE - { - ELS_FETCH(); - - op_array->start_op_number = op_array->end_op_number = op_array->last_executed_op_number = 0; - op_array->backpatch_count = 0; - if (EG(interactive)) { - /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants - * will become invalid - */ - initial_ops_size = 8192; - } - } -#endif - - op_array->refcount = (int *) emalloc(sizeof(int)); - *op_array->refcount = 1; - op_array->size = initial_ops_size; - op_array->last = 0; - op_array->opcodes = NULL; - op_array_alloc_ops(op_array); - - op_array->T = 0; - - op_array->function_name = NULL; - - op_array->arg_types = NULL; - - op_array->brk_cont_array = NULL; - op_array->last_brk_cont = 0; - op_array->current_brk_cont = -1; - - op_array->static_variables = NULL; - - op_array->uses_globals = 0; - - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_ctor_handler, op_array); -} - - -ZEND_API int destroy_zend_function(zend_function *function) -{ - switch (function->type) { - case ZEND_USER_FUNCTION: - destroy_op_array((zend_op_array *) function); - break; - case ZEND_INTERNAL_FUNCTION: - /* do nothing */ - break; - } - return 1; -} - - -ZEND_API int destroy_zend_class(zend_class_entry *ce) -{ - if (--(*ce->refcount)>0) { - return 1; - } - switch (ce->type) { - case ZEND_USER_CLASS: - efree(ce->name); - efree(ce->refcount); - zend_hash_destroy(&ce->function_table); - zend_hash_destroy(&ce->default_properties); - break; - case ZEND_INTERNAL_CLASS: - free(ce->name); - free(ce->refcount); - zend_hash_destroy(&ce->function_table); - zend_hash_destroy(&ce->default_properties); - break; - } - return 1; -} - - -void zend_class_add_ref(zend_class_entry *ce) -{ - (*ce->refcount)++; -} - - -ZEND_API void destroy_op_array(zend_op_array *op_array) -{ - zend_op *opline = op_array->opcodes; - zend_op *end = op_array->opcodes+op_array->last; - - if (--(*op_array->refcount)>0) { - return; - } - - efree(op_array->refcount); - - while (oplineop1.op_type==IS_CONST) { -#if DEBUG_ZEND>2 - printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op1.u.constant); -#endif - zval_dtor(&opline->op1.u.constant); - } - if (opline->op2.op_type==IS_CONST) { -#if DEBUG_ZEND>2 - printf("Reducing refcount for %x 1=>0 (destroying)\n", &opline->op2.u.constant); -#endif - zval_dtor(&opline->op2.u.constant); - } - opline++; - } - efree(op_array->opcodes); - if (op_array->function_name) { - efree(op_array->function_name); - } - if (op_array->arg_types) { - efree(op_array->arg_types); - } - if (op_array->brk_cont_array) { - efree(op_array->brk_cont_array); - } - if (op_array->static_variables) { - zend_hash_destroy(op_array->static_variables); - efree(op_array->static_variables); - } - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_dtor_handler, op_array); -} - - -void init_op(zend_op *op CLS_DC) -{ - op->lineno = CG(zend_lineno); - op->filename = zend_get_compiled_filename(); - op->result.op_type = IS_UNUSED; - op->extended_value = 0; - op->op1.u.EA.var = 0; - op->op1.u.EA.type = 0; - op->op2.u.EA.var = 0; - op->op2.u.EA.type = 0; - op->result.u.EA.var = 0; - op->result.u.EA.type = 0; -} - -zend_op *get_next_op(zend_op_array *op_array CLS_DC) -{ - int next_op_num = op_array->last++; - zend_op *next_op; - - if (next_op_num >= op_array->size) { -#if SUPPORT_INTERACTIVE - ELS_FETCH(); - - if (EG(interactive)) { - /* we messed up */ - zend_printf("Ran out of opcode space!\n" - "You should probably consider writing this huge script into a file!\n"); - zend_bailout(); - } -#endif - op_array->size *= 2; - op_array_alloc_ops(op_array); - } - - next_op = &(op_array->opcodes[next_op_num]); - - init_op(next_op CLS_CC); - - return next_op; -} - - -int get_next_op_number(zend_op_array *op_array) -{ - return op_array->last; -} - - - - -zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array) -{ - op_array->last_brk_cont++; - op_array->brk_cont_array = erealloc(op_array->brk_cont_array, sizeof(zend_brk_cont_element)*op_array->last_brk_cont); - return &op_array->brk_cont_array[op_array->last_brk_cont-1]; -} - - -static void zend_update_extended_info(zend_op_array *op_array CLS_DC) -{ - zend_op *opline = op_array->opcodes, *end=opline+op_array->last; - - while (oplineopcode == ZEND_EXT_STMT) { - if (opline+1opcode == ZEND_EXT_STMT) { - opline->opcode = ZEND_NOP; - opline++; - continue; - } - opline->lineno = (opline+1)->lineno; - opline->filename = (opline+1)->filename; - } else { - opline->opcode = ZEND_NOP; - } - } - opline++; - } - opline = get_next_op(op_array CLS_CC); - opline->opcode = ZEND_EXT_STMT; - opline->op1.op_type = IS_UNUSED; - opline->op2.op_type = IS_UNUSED; - if (op_array->last>0) { - opline->filename = op_array->opcodes[op_array->last-2].filename; - opline->lineno= op_array->opcodes[op_array->last-2].lineno; - } -} - - - -static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array) -{ - if (extension->op_array_handler) { - extension->op_array_handler(op_array); - } -} - - -int pass_two(zend_op_array *op_array) -{ - CLS_FETCH(); - - if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) { - return 0; - } - if (CG(extended_info)) { - zend_update_extended_info(op_array CLS_CC); - } - if (CG(handle_op_arrays)) { - zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_handler, op_array); - } - return 0; -} - - -void pass_include_eval(zend_op_array *op_array) -{ - zend_op *opline=op_array->opcodes, *end=opline+op_array->last; - - while (oplineop1.op_type==IS_CONST) { - opline->op1.u.constant.is_ref = 1; - } - if (opline->op2.op_type==IS_CONST) { - opline->op2.u.constant.is_ref = 1; - } - opline++; - } -} - - -int print_class(zend_class_entry *class_entry) -{ - printf("Class %s:\n", class_entry->name); - zend_hash_apply(&class_entry->function_table, (int (*)(void *)) pass_two); - printf("End of class %s.\n\n", class_entry->name); - return 0; -} - -ZEND_API unary_op_type get_unary_op(int opcode) -{ - switch(opcode) { - case ZEND_BW_NOT: - return (unary_op_type) bitwise_not_function; - break; - case ZEND_BOOL_NOT: - return (unary_op_type) boolean_not_function; - break; - default: - return (unary_op_type) NULL; - break; - } -} - - -ZEND_API void *get_binary_op(int opcode) -{ - switch (opcode) { - case ZEND_ADD: - case ZEND_ASSIGN_ADD: - return (void *) add_function; - break; - case ZEND_SUB: - case ZEND_ASSIGN_SUB: - return (void *) sub_function; - break; - case ZEND_MUL: - case ZEND_ASSIGN_MUL: - return (void *) mul_function; - break; - case ZEND_DIV: - case ZEND_ASSIGN_DIV: - return (void *) div_function; - break; - case ZEND_MOD: - case ZEND_ASSIGN_MOD: - return (void *) mod_function; - break; - case ZEND_SL: - case ZEND_ASSIGN_SL: - return (void *) shift_left_function; - break; - case ZEND_SR: - case ZEND_ASSIGN_SR: - return (void *) shift_right_function; - break; - case ZEND_CONCAT: - case ZEND_ASSIGN_CONCAT: - return (void *) concat_function; - break; - case ZEND_IS_IDENTICAL: - return (void *) is_identical_function; - break; - case ZEND_IS_EQUAL: - return (void *) is_equal_function; - break; - case ZEND_IS_NOT_EQUAL: - return (void *) is_not_equal_function; - break; - case ZEND_IS_SMALLER: - return (void *) is_smaller_function; - break; - case ZEND_IS_SMALLER_OR_EQUAL: - return (void *) is_smaller_or_equal_function; - break; - case ZEND_BW_OR: - case ZEND_ASSIGN_BW_OR: - return (void *) bitwise_or_function; - break; - case ZEND_BW_AND: - case ZEND_ASSIGN_BW_AND: - return (void *) bitwise_and_function; - break; - case ZEND_BW_XOR: - case ZEND_ASSIGN_BW_XOR: - return (void *) bitwise_xor_function; - break; - default: - return (void *) NULL; - break; - } -} diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c deleted file mode 100644 index 4368028bb4..0000000000 --- a/Zend/zend_operators.c +++ /dev/null @@ -1,1395 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include -#include -#include -#include -#include - -#include "zend.h" -#include "zend_operators.h" -#include "zend_variables.h" -#include "zend_globals.h" -#include "zend_list.h" - -#if WITH_BCMATH -#include "functions/number.h" -#endif - -ZEND_API void convert_scalar_to_number(zval *op) -{ - char *strval; - - if (op->type == IS_STRING) { - strval = op->value.str.val; - switch ((op->type=is_numeric_string(strval, op->value.str.len, &op->value.lval, &op->value.dval))) { - case IS_DOUBLE: - case IS_LONG: - break; - case IS_BOOL: - op->type = IS_LONG; - break; -#if WITH_BCMATH - case IS_BC: - op->type = IS_DOUBLE; /* may have lost significant digits */ - break; -#endif - default: - op->value.lval = strtol(op->value.str.val, NULL, 10); - op->type = IS_LONG; - break; - } - STR_FREE(strval); - } else if (op->type==IS_BOOL || op->type==IS_RESOURCE) { - op->type = IS_LONG; - } -} - -#define zendi_convert_scalar_to_number(op, holder, result) \ - if (op==result) { \ - convert_scalar_to_number(op); \ - } else if ((op)->type == IS_STRING) { \ - switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval))) { \ - case IS_DOUBLE: \ - case IS_LONG: \ - break; \ - case IS_BC: \ - (holder).type = IS_DOUBLE; /* may have lost significant digits */ \ - break; \ - default: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ - (holder).type = IS_LONG; \ - break; \ - } \ - (op) = &(holder); \ - } else if ((op)->type==IS_BOOL || (op)->type==IS_RESOURCE) { \ - (holder).value.lval = (op)->value.lval; \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - } - - - -#define zendi_convert_to_long(op, holder, result) \ - if (op==result) { \ - convert_to_long(op); \ - } else if ((op)->type==IS_BOOL || (op)->type==IS_RESOURCE) { \ - (holder).value.lval = (op)->value.lval; \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - } else if ((op)->type != IS_LONG) { \ - switch ((op)->type) { \ - case IS_DOUBLE: \ - (holder).value.lval = (long) (op)->value.dval; \ - break; \ - case IS_STRING: \ - (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \ - break; \ - case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ - break; \ - case IS_OBJECT: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.obj.properties)?1:0); \ - break; \ - default: \ - zend_error(E_WARNING, "Cannot convert to ordinal value"); \ - (holder).value.lval = 0; \ - break; \ - } \ - (holder).type = IS_LONG; \ - (op) = &(holder); \ - } - - -#define zendi_convert_to_boolean(op, holder, result) \ - if (op==result) { \ - convert_to_boolean(op); \ - } else if ((op)->type != IS_BOOL) { \ - switch ((op)->type) { \ - case IS_RESOURCE: \ - case IS_LONG: \ - (holder).value.lval = ((op)->value.lval ? 1 : 0); \ - break; \ - case IS_DOUBLE: \ - (holder).value.lval = ((op)->value.dval ? 1 : 0); \ - break; \ - case IS_STRING: \ - if ((op)->value.str.len == 0 \ - || ((op)->value.str.len==1 && (op)->value.str.val[0]=='0')) { \ - (holder).value.lval = 0; \ - } else { \ - (holder).value.lval = 1; \ - } \ - break; \ - case IS_ARRAY: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \ - break; \ - case IS_OBJECT: \ - (holder).value.lval = (zend_hash_num_elements((op)->value.obj.properties)?1:0); \ - break; \ - default: \ - (holder).value.lval = 0; \ - break; \ - } \ - (holder).type = IS_BOOL; \ - (op) = &(holder); \ - } - - -ZEND_API void convert_to_long(zval *op) -{ - convert_to_long_base(op, 10); -} - - -ZEND_API void convert_to_long_base(zval *op, int base) -{ - char *strval; - long tmp; - - switch (op->type) { - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: - break; - case IS_DOUBLE: - op->value.lval = (long) op->value.dval; - break; - case IS_STRING: - strval = op->value.str.val; - op->value.lval = strtol(strval, NULL, base); - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - case IS_OBJECT: - tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - default: - zend_error(E_WARNING, "Cannot convert to ordinal value"); - zval_dtor(op); - op->value.lval = 0; - break; - } - - op->type = IS_LONG; -} - - -ZEND_API void convert_to_double(zval *op) -{ - char *strval; - double tmp; - - switch (op->type) { - case IS_RESOURCE: - case IS_BOOL: - case IS_LONG: - op->value.dval = (double) op->value.lval; - op->type = IS_DOUBLE; - break; - case IS_DOUBLE: - break; - case IS_STRING: - strval = op->value.str.val; - - op->value.dval = strtod(strval, NULL); - op->type = IS_DOUBLE; - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.dval = tmp; - op->type = IS_DOUBLE; - break; - case IS_OBJECT: - tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0); - zval_dtor(op); - op->value.dval = tmp; - op->type = IS_DOUBLE; - break; - default: - zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type); - zval_dtor(op); - op->value.dval = 0; - op->type = IS_DOUBLE; - break; - } -} - - -ZEND_API void convert_to_boolean(zval *op) -{ - char *strval; - int tmp; - - switch (op->type) { - case IS_BOOL: - break; - case IS_RESOURCE: - case IS_LONG: - op->value.lval = (op->value.lval ? 1 : 0); - break; - case IS_DOUBLE: - op->value.lval = (op->value.dval ? 1 : 0); - break; - case IS_STRING: - strval = op->value.str.val; - - if (op->value.str.len == 0 - || (op->value.str.len==1 && op->value.str.val[0]=='0')) { - op->value.lval = 0; - } else { - op->value.lval = 1; - } - STR_FREE(strval); - break; - case IS_ARRAY: - tmp = (zend_hash_num_elements(op->value.ht)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - case IS_OBJECT: - tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0); - zval_dtor(op); - op->value.lval = tmp; - break; - default: - zval_dtor(op); - op->value.lval = 0; - break; - } - op->type = IS_BOOL; -} - - -ZEND_API void convert_to_string(zval *op) -{ - long lval; - double dval; - ELS_FETCH(); - - switch (op->type) { - case IS_STRING: - break; - case IS_BOOL: - if (op->value.lval) { - op->value.str.val = estrndup("1", 1); - op->value.str.len = 1; - } else { - op->value.str.val = empty_string; - op->value.str.len = 0; - } - break; - case IS_LONG: - lval = op->value.lval; - - op->value.str.val = (char *) emalloc(MAX_LENGTH_OF_LONG + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */ - break; - case IS_DOUBLE: { - dval = op->value.dval; - op->value.str.val = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); - op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */ - /* %G already handles removing trailing zeros from the fractional part, yay */ - break; - } - case IS_ARRAY: - zval_dtor(op); - op->value.str.val = estrndup("Array",sizeof("Array")-1); - op->value.str.len = sizeof("Array")-1; - break; - case IS_OBJECT: - zval_dtor(op); - op->value.str.val = estrndup("Object",sizeof("Object")-1); - op->value.str.len = sizeof("Object")-1; - break; - default: - zval_dtor(op); - var_reset(op); - break; - } - op->type = IS_STRING; -} - - -static void convert_scalar_to_array(zval *op, int type) -{ - zval *entry = (zval *) emalloc(sizeof(zval)); - - *entry = *op; - INIT_PZVAL(entry); - - switch (type) { - case IS_ARRAY: - op->value.ht = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(op->value.ht, 0, NULL, PVAL_PTR_DTOR, 0); - zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL); - op->type = IS_ARRAY; - break; - case IS_OBJECT: - op->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable)); - zend_hash_init(op->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0); - zend_hash_update(op->value.obj.properties, "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL); - op->value.obj.ce = &zend_standard_class_def; - op->type = IS_OBJECT; - break; - } -} - - -ZEND_API void convert_to_array(zval *op) -{ - switch(op->type) { - case IS_ARRAY: - return; - break; - case IS_OBJECT: - op->type = IS_ARRAY; - op->value.ht = op->value.obj.properties; - return; - break; - default: - convert_scalar_to_array(op, IS_ARRAY); - break; - } -} - - -ZEND_API void convert_to_object(zval *op) -{ - switch(op->type) { - case IS_ARRAY: - op->type = IS_OBJECT; - op->value.obj.properties = op->value.ht; - op->value.obj.ce = &zend_standard_class_def; - return; - break; - case IS_OBJECT: - return; - break; - default: - convert_scalar_to_array(op, IS_OBJECT); - break; - } -} - - -ZEND_API int add_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) { - zval *tmp; - - if ((result == op1) && (result == op2)) { - /* $a += $a */ - return SUCCESS; - } - if (result != op1) { - /* $a += $b */ - *result = *op1; - zval_copy_ctor(result); - } - zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0); - return SUCCESS; - } - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval + (double) op2->value.lval; - - if (dval > (double) LONG_MAX) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval + op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) + op2->value.dval) : - (op1->value.dval + ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval + op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int sub_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval - (double) op2->value.lval; - - if (dval < (double) LONG_MIN) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval - op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) - op2->value.dval) : - (op1->value.dval - ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval - op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int mul_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - double dval = (double) op1->value.lval * (double) op2->value.lval; - - if (dval > (double) LONG_MAX) { - result->value.dval = dval; - result->type = IS_DOUBLE; - } else { - result->value.lval = op1->value.lval * op2->value.lval; - result->type = IS_LONG; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) * op2->value.dval) : - (op1->value.dval * ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval * op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - -ZEND_API int div_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if ((op2->type == IS_LONG && op2->value.lval == 0) || (op2->type == IS_DOUBLE && op2->value.dval == 0.0)) { - zend_error(E_WARNING, "Division by zero"); - var_reset(result); - return FAILURE; /* division by zero */ - } - if (op1->type == IS_LONG && op2->type == IS_LONG) { - if (op1->value.lval % op2->value.lval == 0) { /* integer */ - result->type = IS_LONG; - result->value.lval = op1->value.lval / op2->value.lval; - } else { - result->type = IS_DOUBLE; - result->value.dval = ((double) op1->value.lval) / op2->value.lval; - } - return SUCCESS; - } - if ((op1->type == IS_DOUBLE && op2->type == IS_LONG) - || (op1->type == IS_LONG && op2->type == IS_DOUBLE)) { - result->value.dval = (op1->type == IS_LONG ? - (((double) op1->value.lval) / op2->value.dval) : - (op1->value.dval / ((double) op2->value.lval))); - result->type = IS_DOUBLE; - return SUCCESS; - } - if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) { - result->type = IS_DOUBLE; - result->value.dval = op1->value.dval / op2->value.dval; - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int mod_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - if (op2->value.lval == 0) { - var_reset(result); - return FAILURE; /* modulus by zero */ - } - - result->type = IS_LONG; - result->value.lval = op1->value.lval % op2->value.lval; - return SUCCESS; -} - - -ZEND_API int boolean_or_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - result->type = IS_BOOL; - - zendi_convert_to_boolean(op1, op1_copy, result); - if (op1->value.lval) { - result->value.lval = 1; - return SUCCESS; - } - zendi_convert_to_boolean(op2, op2_copy, result); - if (op2->value.lval) { - result->value.lval = 1; - return SUCCESS; - } - result->value.lval = 0; - return SUCCESS; -} - - -ZEND_API int boolean_and_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - result->type = IS_BOOL; - - zendi_convert_to_boolean(op1, op1_copy, result); - if (!op1->value.lval) { - result->value.lval = 0; - return SUCCESS; - } - zendi_convert_to_boolean(op2, op2_copy, result); - if (!op2->value.lval) { - result->value.lval = 0; - return SUCCESS; - } - result->value.lval = 1; - return SUCCESS; -} - - -ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - result->type = IS_BOOL; - - zendi_convert_to_boolean(op1, op1_copy, result); - zendi_convert_to_boolean(op2, op2_copy, result); - result->value.lval = op1->value.lval ^ op2->value.lval; - return SUCCESS; -} - - -ZEND_API int boolean_not_function(zval *result, zval *op1) -{ - zval op1_copy; - - zendi_convert_to_boolean(op1, op1_copy, result); - - result->type = IS_BOOL; - result->value.lval = !op1->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_not_function(zval *result, zval *op1) -{ - zval op1_copy = *op1; - - op1 = &op1_copy; - - if (op1->type == IS_DOUBLE) { - op1->value.lval = (long) op1->value.dval; - op1->type = IS_LONG; - } - if (op1->type == IS_LONG) { - result->value.lval = ~op1->value.lval; - result->type = IS_LONG; - return SUCCESS; - } - if (op1->type == IS_STRING) { - int i; - - result->type = IS_STRING; - result->value.str.val = estrndup(op1->value.str.val, op1->value.str.len); - result->value.str.len = op1->value.str.len; - for (i = 0; i < op1->value.str.len; i++) { - result->value.str.val[i] = ~op1->value.str.val[i]; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; /* unknown datatype */ -} - - -ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - int i; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->value.str.len = longer->value.str.len; - result->value.str.val = estrndup(longer->value.str.val, longer->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result->value.str.val[i] |= shorter->value.str.val[i]; - } - return SUCCESS; - } - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval | op2->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - int i; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->value.str.len = shorter->value.str.len; - result->value.str.val = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result->value.str.val[i] &= longer->value.str.val[i]; - } - return SUCCESS; - } - - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval & op2->value.lval; - return SUCCESS; -} - - -ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zval *longer, *shorter; - int i; - - if (op1->value.str.len >= op2->value.str.len) { - longer = op1; - shorter = op2; - } else { - longer = op2; - shorter = op1; - } - - result->value.str.len = shorter->value.str.len; - result->value.str.val = estrndup(shorter->value.str.val, shorter->value.str.len); - for (i = 0; i < shorter->value.str.len; i++) { - result->value.str.val[i] ^= longer->value.str.val[i]; - } - return SUCCESS; - } - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - - result->type = IS_LONG; - result->value.lval = op1->value.lval ^ op2->value.lval; - return SUCCESS; -} - - -ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval << op2->value.lval; - result->type = IS_LONG; - return SUCCESS; -} - - -ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - zendi_convert_to_long(op1, op1_copy, result); - zendi_convert_to_long(op2, op2_copy, result); - result->value.lval = op1->value.lval >> op2->value.lval; - result->type = IS_LONG; - return SUCCESS; -} - - - -/* must support result==op1 */ -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2) -{ - result->value.str.len = op1->value.str.len + 1; - result->value.str.val = (char *) erealloc(op1->value.str.val, result->value.str.len+1); - result->value.str.val[result->value.str.len - 1] = op2->value.chval; - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; - return SUCCESS; -} - - -/* must support result==op1 */ -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2) -{ - int length = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) erealloc(op1->value.str.val, length+1); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[length] = 0; - result->value.str.len = length; - result->type = IS_STRING; - return SUCCESS; -} - - -ZEND_API int concat_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - int use_copy1, use_copy2; - - - zend_make_printable_zval(op1, &op1_copy, &use_copy1); - zend_make_printable_zval(op2, &op2_copy, &use_copy2); - - if (use_copy1) { - op1 = &op1_copy; - } - if (use_copy2) { - op2 = &op2_copy; - } - if (result==op1) { /* special case, perform operations on result */ - uint res_len = op1->value.str.len + op2->value.str.len; - - if (result->value.str.len == 0) { /* handle empty_string */ - STR_FREE(result->value.str.val); - result->value.str.val = emalloc(res_len+1); - } else { - result->value.str.val = erealloc(result->value.str.val, res_len+1); - } - memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len); - result->value.str.val[res_len]=0; - result->value.str.len = res_len; - } else { - result->value.str.len = op1->value.str.len + op2->value.str.len; - result->value.str.val = (char *) emalloc(result->value.str.len + 1); - memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len); - memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val,op2->value.str.len); - result->value.str.val[result->value.str.len] = 0; - result->type = IS_STRING; - } - if (use_copy1) { - zval_dtor(op1); - } - if (use_copy2) { - zval_dtor(op2); - } - return SUCCESS; -} - - -ZEND_API int compare_function(zval *result, zval *op1, zval *op2) -{ - zval op1_copy, op2_copy; - - if (op1->type == IS_STRING && op2->type == IS_STRING) { - zendi_smart_strcmp(result, op1, op2); - return SUCCESS; - } - - if (op1->type == IS_BOOL || op2->type == IS_BOOL) { - zendi_convert_to_boolean(op1, op1_copy, result); - zendi_convert_to_boolean(op2, op2_copy, result); - result->type = IS_LONG; - result->value.lval = op1->value.lval - op2->value.lval; - return SUCCESS; - } - zendi_convert_scalar_to_number(op1, op1_copy, result); - zendi_convert_scalar_to_number(op2, op2_copy, result); - - if (op1->type == IS_LONG && op2->type == IS_LONG) { - result->type = IS_LONG; - result->value.lval = op1->value.lval - op2->value.lval; - return SUCCESS; - } - if ((op1->type == IS_DOUBLE || op1->type == IS_LONG) - && (op2->type == IS_DOUBLE || op2->type == IS_LONG)) { - result->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval); - result->type = IS_DOUBLE; - return SUCCESS; - } - if ((op1->type==IS_ARRAY || op1->type==IS_OBJECT) - && (op2->type==IS_ARRAY || op2->type==IS_OBJECT)) { - zend_error(E_WARNING,"Cannot compare arrays or objects"); - } - var_reset(result); - return FAILURE; -} - - -ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2) -{ - result->type = IS_BOOL; - if (op1->type != op2->type) { - result->value.lval = 0; - return SUCCESS; - } - switch (op1->type) { - case IS_BOOL: - case IS_LONG: - case IS_RESOURCE: - result->value.lval = (op1->value.lval == op2->value.lval); - return SUCCESS; - break; - case IS_DOUBLE: - result->value.lval = (op1->value.dval == op2->value.dval); - return SUCCESS; - break; - case IS_STRING: - if ((op1->value.str.len == op2->value.str.len) - && (!memcmp(op1->value.str.val, op2->value.str.val, op1->value.str.len))) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - break; - case IS_ARRAY: - case IS_OBJECT: - zend_error(E_WARNING,"Cannot compare arrays or objects"); - break; - } - var_reset(result); - return FAILURE; -} - -ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2) -{ - if (compare_function(result, op1, op2) == FAILURE) { - return FAILURE; - } - convert_to_boolean(result); - if (result->value.lval == 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; -} - - -ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2) -{ - if (compare_function(result, op1, op2) == FAILURE) { - return FAILURE; - } - convert_to_boolean(result); - if (result->value.lval) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; -} - - -ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2) -{ - if (compare_function(result, op1, op2) == FAILURE) { - return FAILURE; - } - if (result->type == IS_LONG) { - if (result->value.lval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_LONG; - if (result->value.dval < 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; -} - - -ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) -{ - if (compare_function(result, op1, op2) == FAILURE) { - return FAILURE; - } - if (result->type == IS_LONG) { - if (result->value.lval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - if (result->type == IS_DOUBLE) { - result->type = IS_LONG; - if (result->value.dval <= 0) { - result->value.lval = 1; - } else { - result->value.lval = 0; - } - return SUCCESS; - } - zend_error(E_ERROR, "Unsupported operand types"); - return FAILURE; -} - - -#define LOWER_CASE 1 -#define UPPER_CASE 2 -#define NUMERIC 3 - - -static void increment_string(zval *str) -{ - int carry=0; - int pos=str->value.str.len-1; - char *s=str->value.str.val; - char *t; - int last=0; /* Shut up the compiler warning */ - int ch; - - while(pos >= 0) { - ch = s[pos]; - if (ch >= 'a' && ch <= 'z') { - if (ch == 'z') { - s[pos] = 'a'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last=LOWER_CASE; - } else if (ch >= 'A' && ch <= 'Z') { - if (ch == 'Z') { - s[pos] = 'A'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last=UPPER_CASE; - } else if (ch >= '0' && ch <= '9') { - if (ch == '9') { - s[pos] = '0'; - carry=1; - } else { - s[pos]++; - carry=0; - } - last = NUMERIC; - } else { - carry=0; - break; - } - if (carry == 0) { - break; - } - pos--; - } - - if (carry) { - t = (char *) emalloc(str->value.str.len+1+1); - memcpy(t+1,str->value.str.val, str->value.str.len); - str->value.str.len++; - t[str->value.str.len] = '\0'; - switch (last) { - case NUMERIC: - t[0] = '1'; - break; - case UPPER_CASE: - t[0] = 'A'; - break; - case LOWER_CASE: - t[0] = 'a'; - break; - } - STR_FREE(str->value.str.val); - str->value.str.val = t; - } -} - - -ZEND_API int increment_function(zval *op1) -{ - switch (op1->type) { - case IS_LONG: - op1->value.lval++; - break; - case IS_DOUBLE: - op1->value.dval = op1->value.dval + 1; - break; - case IS_STRING: /* Perl style string increment */ - if (op1->value.str.len==0) { /* consider as 0 */ - STR_FREE(op1->value.str.val); - op1->value.lval = 1; - op1->type = IS_LONG; - } else { - increment_string(op1); - } - break; - default: - return FAILURE; - } - return SUCCESS; -} - - -ZEND_API int decrement_function(zval *op1) -{ - long lval; - - switch (op1->type) { - case IS_LONG: - op1->value.lval--; - break; - case IS_DOUBLE: - op1->value.dval = op1->value.dval - 1; - break; - case IS_STRING: /* Like perl we only support string increment */ - if (op1->value.str.len==0) { /* consider as 0 */ - STR_FREE(op1->value.str.val); - op1->value.lval = -1; - op1->type = IS_LONG; - break; - } else if (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, NULL)==IS_LONG) { /* long */ - STR_FREE(op1->value.str.val); - op1->value.lval = lval-1; - op1->type = IS_LONG; - break; - } - break; - default: - return FAILURE; - } - - return SUCCESS; -} - - -ZEND_API int zval_is_true(zval *op) -{ - convert_to_boolean(op); - return (op->value.lval ? 1 : 0); -} - - -ZEND_API void zend_str_tolower(char *str, unsigned int length) -{ - register char *p=str, *end=p+length; - - while (pvalue.str.val, s2->value.str.val, MIN(s1->value.str.len,s2->value.str.len)); - if (!retval) { - return (s1->value.str.len - s2->value.str.len); - } else { - return retval; - } -} - - -ZEND_API int zend_binary_strcasecmp(zval *s1, zval *s2) -{ - const unsigned char *p1 = (const unsigned char *)s1->value.str.val; - const unsigned char *p2 = (const unsigned char *)s2->value.str.val; - unsigned char c1 = 0, c2 = 0; - int len1, len2; - - len1 = s1->value.str.len; - len2 = s2->value.str.len; - if (len1 != len2 || !len1) { - return len1 - len2; - } - - while (len1--) { - c1 = tolower(*p1++); - c2 = tolower(*p2++); - if (c1 != c2) { - break; - } - } - - return c1 - c2; -} - -ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2) -{ - int ret1,ret2; - long lval1, lval2; - double dval1, dval2; - - if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1)) && - (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2))) { -#if WITH_BCMATH - if ((ret1==IS_BC) || (ret2==IS_BC)) { - bc_num first, second; - - /* use the BC math library to compare the numbers */ - init_num(&first); - init_num(&second); - str2num(&first,s1->value.str.val,100); /* this scale should do */ - str2num(&second,s2->value.str.val,100); /* ditto */ - result->value.lval = bc_compare(first,second); - result->type = IS_LONG; - free_num(&first); - free_num(&second); - } else -#endif - if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) { - if (ret1!=IS_DOUBLE) { - dval1 = strtod(s1->value.str.val, NULL); - } else if (ret2!=IS_DOUBLE) { - dval2 = strtod(s2->value.str.val, NULL); - } - result->value.dval = dval1 - dval2; - result->type = IS_DOUBLE; - } else { /* they both have to be long's */ - result->value.lval = lval1 - lval2; - result->type = IS_LONG; - } - } else { - result->value.lval = zend_binary_strcmp(s1,s2); - result->type = IS_LONG; - } - return; -} - - -/* returns 0 for non-numeric string - * returns IS_DOUBLE for floating point string, and assigns the value to *dval (if it's not NULL) - * returns IS_LONG for integer strings, and assigns the value to *lval (if it's not NULL) - * returns IS_BC if the number might lose accuracy when converted to a double - */ - -#if 1 -ZEND_API inline int is_numeric_string(char *str, int length, long *lval, double *dval) -{ - long local_lval; - double local_dval; - char *end_ptr; - - if (!length) { - return 0; - } - - errno=0; - local_lval = strtol(str, &end_ptr, 10); - if (errno!=ERANGE && end_ptr == str+length) { /* integer string */ - if (lval) { - *lval = local_lval; - } - return IS_LONG; - } - - errno=0; - local_dval = strtod(str, &end_ptr); - if (errno!=ERANGE && end_ptr == str+length) { /* floating point string */ - if (dval) { - *dval = local_dval; - } -#if WITH_BCMATH - if (length>16) { - register char *ptr=str, *end=str+length; - - while(ptr | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _OPERATORS_H -#define _OPERATORS_H - -#define MAX_LENGTH_OF_LONG 18 -#define MAX_LENGTH_OF_DOUBLE 32 - -ZEND_API int add_function(zval *result, zval *op1, zval *op2); -ZEND_API int sub_function(zval *result, zval *op1, zval *op2); -ZEND_API int mul_function(zval *result, zval *op1, zval *op2); -ZEND_API int div_function(zval *result, zval *op1, zval *op2); -ZEND_API int mod_function(zval *result, zval *op1, zval *op2); -ZEND_API int boolean_or_function(zval *result, zval *op1, zval *op2); -ZEND_API int boolean_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int boolean_and_function(zval *result, zval *op1, zval *op2); -ZEND_API int boolean_not_function(zval *result, zval *op1); -ZEND_API int bitwise_not_function(zval *result, zval *op1); -ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2); -ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2); -ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2); -ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2); -ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2); -ZEND_API int concat_function(zval *result, zval *op1, zval *op2); - -ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int is_identical_function(zval *result, zval *op1, zval *op2); -ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2); -ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2); -ZEND_API inline int is_numeric_string(char *str, int length, long *lval, double *dval); - -ZEND_API int increment_function(zval *op1); -ZEND_API int decrement_function(zval *op2); - -BEGIN_EXTERN_C() -ZEND_API void convert_scalar_to_number(zval *op); -ZEND_API void convert_to_string(zval *op); -ZEND_API void convert_to_long(zval *op); -ZEND_API void convert_to_long_base(zval *op, int base); -ZEND_API void convert_to_boolean(zval *op); -ZEND_API void convert_to_array(zval *op); -ZEND_API void convert_to_object(zval *op); -ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2); -ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2); -ZEND_API void convert_to_double(zval *op); -END_EXTERN_C() - -ZEND_API int zval_is_true(zval *op); -ZEND_API int compare_function(zval *result, zval *op1, zval *op2); - -ZEND_API void zend_str_tolower(char *str, unsigned int length); -ZEND_API int zend_binary_strcmp(zval *s1, zval *s2); -ZEND_API int zend_binary_strcasecmp(zval *s1, zval *s2); -ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2); - -#define convert_to_long_ex(ppzv) \ - if ((*ppzv)->type!=IS_LONG) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_long(*ppzv); \ - } - -#define convert_to_double_ex(ppzv) \ - if ((*ppzv)->type!=IS_DOUBLE) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_double(*ppzv); \ - } - -#define convert_to_string_ex(ppzv) \ - if ((*ppzv)->type!=IS_STRING) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_string(*ppzv); \ - } - -#define convert_to_array_ex(ppzv) \ - if ((*ppzv)->type!=IS_ARRAY) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_array(*ppzv); \ - } - -#define convert_to_object_ex(ppzv) \ - if ((*ppzv)->type!=IS_OBJECT) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_object(*ppzv); \ - } - -#define convert_to_boolean_ex(ppzv) \ - if ((*ppzv)->type!=IS_BOOL) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_to_boolean(*ppzv); \ - } - -#define convert_scalar_to_number_ex(ppzv) \ - if ((*ppzv)->type!=IS_LONG && (*ppzv)->type!=IS_DOUBLE) { \ - if (!(*ppzv)->is_ref) { \ - SEPARATE_ZVAL(ppzv); \ - } \ - convert_scalar_to_number(*ppzv); \ - } - -#endif diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c deleted file mode 100644 index 17ed0a4b1f..0000000000 --- a/Zend/zend_ptr_stack.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_ptr_stack.h" -#ifdef HAVE_STDARG_H -# include -#endif - -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack) -{ - stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*PTR_STACK_BLOCK_SIZE); - stack->max = PTR_STACK_BLOCK_SIZE; - stack->top = 0; -} - - -ZEND_API inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr) -{ - if (stack->top >= stack->max) { /* we need to allocate more memory */ - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 ))); - stack->top_element = stack->elements+stack->top; - } - stack->top++; - *(stack->top_element++) = ptr; -} - -ZEND_API inline void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count,...) -{ - va_list ptr; - void *elem; - - if (stack->top+count > stack->max) { /* we need to allocate more memory */ - stack->max *= 2; - stack->max += count; - stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max))); - stack->top_element = stack->elements+stack->top; - } - va_start(ptr, count); - while (count>0) { - elem = va_arg(ptr, void *); - stack->top++; - *(stack->top_element++) = elem; - count--; - } - va_end(ptr); -} - - -ZEND_API inline void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count,...) -{ - va_list ptr; - void **elem; - - va_start(ptr, count); - while (count>0) { - elem = va_arg(ptr, void **); - *elem = *(--stack->top_element); - stack->top--; - count--; - } - va_end(ptr); -} - -ZEND_API inline void *zend_ptr_stack_pop(zend_ptr_stack *stack) -{ - stack->top--; - return *(--stack->top_element); -} - - -ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack) -{ - if (stack->elements) { - efree(stack->elements); - } -} - - -ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)) -{ - int i = stack->top; - - while (--i >= 0) { - func(stack->elements[i]); - } -} - - -ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *)) -{ - zend_ptr_stack_apply(stack, func); - stack->top = 0; - stack->top_element = stack->elements; -} - - diff --git a/Zend/zend_ptr_stack.h b/Zend/zend_ptr_stack.h deleted file mode 100644 index fd0770c647..0000000000 --- a/Zend/zend_ptr_stack.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_PTR_STACK_H -#define _ZEND_PTR_STACK_H - -typedef struct _zend_ptr_stack { - short top, max; - void **elements; - void **top_element; -} zend_ptr_stack; - - -#define PTR_STACK_BLOCK_SIZE 64 - -ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack); -ZEND_API void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr); -ZEND_API void zend_ptr_stack_n_push(zend_ptr_stack *stack, int count,...); -ZEND_API void *zend_ptr_stack_pop(zend_ptr_stack *stack); -ZEND_API void zend_ptr_stack_n_pop(zend_ptr_stack *stack, int count,...); -ZEND_API void zend_ptr_stack_destroy(zend_ptr_stack *stack); -ZEND_API void zend_ptr_stack_apply(zend_ptr_stack *stack, void (*func)(void *)); -ZEND_API void zend_ptr_stack_clean(zend_ptr_stack *stack, void (*func)(void *)); - -#endif /* _ZEND_PTR_STACK_H */ diff --git a/Zend/zend_sprintf.c b/Zend/zend_sprintf.c deleted file mode 100644 index 878ba32d28..0000000000 --- a/Zend/zend_sprintf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include - -#include "zend.h" - -#ifdef HAVE_STDARG_H -# include -#endif - -#if BROKEN_SPRINTF -int zend_sprintf(char *buffer, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsprintf(buffer, format, args); - va_end(args); - - return strlen(buffer); -} -#endif diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c deleted file mode 100644 index 011e8519c9..0000000000 --- a/Zend/zend_stack.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include "zend.h" -#include "zend_stack.h" - -ZEND_API int zend_stack_init(zend_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; - return SUCCESS; - } -} - -ZEND_API int zend_stack_push(zend_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++; -} - - -ZEND_API int zend_stack_top(zend_stack *stack, void **element) -{ - if (stack->top > 0) { - *element = stack->elements[stack->top - 1]; - return SUCCESS; - } else { - *element = NULL; - return FAILURE; - } -} - - -ZEND_API int zend_stack_del_top(zend_stack *stack) -{ - if (stack->top > 0) { - efree(stack->elements[--stack->top]); - } - return SUCCESS; -} - - -ZEND_API int zend_stack_int_top(zend_stack *stack) -{ - int *e; - - if (zend_stack_top(stack, (void **) &e) == FAILURE) { - return FAILURE; /* this must be a negative number, since negative numbers can't be address numbers */ - } else { - return *e; - } -} - - -ZEND_API int zend_stack_is_empty(zend_stack *stack) -{ - if (stack->top == 0) { - return 1; - } else { - return 0; - } -} - - -ZEND_API int zend_stack_destroy(zend_stack *stack) -{ - register int i; - - for (i = 0; i < stack->top; i++) { - efree(stack->elements[i]); - } - - if (stack->elements) { - efree(stack->elements); - } - return SUCCESS; -} - - -ZEND_API void **zend_stack_base(zend_stack *stack) -{ - return stack->elements; -} - - -ZEND_API int zend_stack_count(zend_stack *stack) -{ - return stack->top; -} - - -ZEND_API void zend_stack_apply(zend_stack *stack, int (*apply_function)(void *element), int type) -{ - int i; - - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if (apply_function(stack->elements[i])) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if (apply_function(stack->elements[i])) { - break; - } - } - break; - } -} - - -ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int (*apply_function)(void *element, void *arg), int type, void *arg) -{ - int i; - - switch (type) { - case ZEND_STACK_APPLY_TOPDOWN: - for (i=stack->top-1; i>=0; i--) { - if (apply_function(stack->elements[i], arg)) { - break; - } - } - break; - case ZEND_STACK_APPLY_BOTTOMUP: - for (i=0; itop; i++) { - if (apply_function(stack->elements[i], arg)) { - break; - } - } - break; - } -} diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h deleted file mode 100644 index 053d44632d..0000000000 --- a/Zend/zend_stack.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _ZEND_STACK_H -#define _ZEND_STACK_H - -typedef struct _zend_stack { - int top, max; - void **elements; -} zend_stack; - - -#define STACK_BLOCK_SIZE 64 - -ZEND_API int zend_stack_init(zend_stack *stack); -ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size); -ZEND_API int zend_stack_top(zend_stack *stack, void **element); -ZEND_API int zend_stack_del_top(zend_stack *stack); -ZEND_API int zend_stack_int_top(zend_stack *stack); -ZEND_API int zend_stack_is_empty(zend_stack *stack); -ZEND_API int zend_stack_destroy(zend_stack *stack); -ZEND_API void **zend_stack_base(zend_stack *stack); -ZEND_API int zend_stack_count(zend_stack *stack); -ZEND_API void zend_stack_apply(zend_stack *stack, int (*apply_function)(void *element), int type); -ZEND_API void zend_stack_apply_with_argument(zend_stack *stack, int (*apply_function)(void *element, void *arg), int type, void *arg); - -#define ZEND_STACK_APPLY_TOPDOWN 1 -#define ZEND_STACK_APPLY_BOTTOMUP 2 - -#endif /* _ZEND_STACK_H */ diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c deleted file mode 100644 index 6d5452c94e..0000000000 --- a/Zend/zend_variables.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#include -#include "zend.h" -#include "zend_API.h" -#include "zend_globals.h" -#include "zend_constants.h" -#include "zend_variables.h" -#include "zend_list.h" - -ZEND_API char *empty_string = ""; /* in order to save emalloc() and efree() time for - * empty strings (usually used to denote empty - * return values in failed functions). - * The macro STR_FREE() will not efree() it. - */ - -ZEND_API char *undefined_variable_string = "\0"; - -/* this function MUST set the value for the variable to an empty string */ -/* and empty strings must be evaluated as FALSE */ -ZEND_API inline void var_reset(zval *var) -{ - var->type = IS_STRING; - var->value.str.val = empty_string; - var->value.str.len = 0; -} - -ZEND_API inline void var_uninit(zval *var) -{ - var->type = IS_STRING; - var->value.str.val = undefined_variable_string; - var->value.str.len = 0; -} - - -ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC) -{ - if (zvalue->type==IS_LONG) { - return 1; - } - switch(zvalue->type) { - case IS_STRING: - case IS_CONSTANT: - STR_FREE_REL(zvalue->value.str.val); - break; - case IS_ARRAY: { - ELS_FETCH(); - - if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) { - zend_hash_destroy(zvalue->value.ht); - efree_rel(zvalue->value.ht); - } - } - break; - case IS_OBJECT: - zend_hash_destroy(zvalue->value.obj.properties); - efree_rel(zvalue->value.obj.properties); - break; - case IS_RESOURCE: - /* destroy resource */ - zend_list_delete(zvalue->value.lval); - break; - case IS_LONG: - case IS_DOUBLE: - case IS_BOOL: - default: - return 1; - break; - } - return 1; -} - - -void zval_del_ref(zval **p) -{ - (*p)->refcount--; - if ((*p)->refcount==0) { - zval_dtor(*p); - efree(*p); - } -} - - -void zval_add_ref(zval **p) -{ - (*p)->refcount++; -} - - -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC) -{ - switch (zvalue->type) { - case IS_RESOURCE: - zend_list_addref(zvalue->value.lval); - break; - case IS_BOOL: - case IS_LONG: - break; - case IS_STRING: - if (zvalue->value.str.val) { - if (zvalue->value.str.len==0) { - if (zvalue->value.str.val==undefined_variable_string) { - zvalue->value.str.val = undefined_variable_string; - } else { - zvalue->value.str.val = empty_string; - } - return SUCCESS; - } - } - zvalue->value.str.val = (char *) estrndup_rel(zvalue->value.str.val, zvalue->value.str.len); - break; - case IS_ARRAY: { - zval *tmp; - HashTable *original_ht = zvalue->value.ht; - ELS_FETCH(); - - if (!zvalue->value.ht) { - var_reset(zvalue); - return FAILURE; - } else if (zvalue->value.ht==&EG(symbol_table)) { - return SUCCESS; /* do nothing */ - } - zvalue->value.ht = (HashTable *) emalloc_rel(sizeof(HashTable)); - zend_hash_init(zvalue->value.ht, 0, NULL, PVAL_PTR_DTOR, 0); - zend_hash_copy(zvalue->value.ht, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *)); - } - break; - case IS_OBJECT: { - zval *tmp; - HashTable *original_ht = zvalue->value.obj.properties; - - zvalue->value.obj.properties = (HashTable *) emalloc_rel(sizeof(HashTable)); - zend_hash_init(zvalue->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0); - zend_hash_copy(zvalue->value.obj.properties, original_ht, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *)); - } - break; - } - return SUCCESS; -} - - -ZEND_API int zend_print_variable(zval *var) -{ - return zend_print_zval(var, 0); -} - - -#if ZEND_DEBUG -ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue) -{ - return zval_copy_ctor(zvalue); -} - - -ZEND_API int _zval_dtor_wrapper(zval *zvalue) -{ - return zval_dtor(zvalue); -} - - - -ZEND_API int _zval_ptr_dtor_wrapper(zval **zval_ptr) -{ - return zval_ptr_dtor(zval_ptr); -} -#endif - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/Zend/zend_variables.h b/Zend/zend_variables.h deleted file mode 100644 index ce1d7f06d5..0000000000 --- a/Zend/zend_variables.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | Zend Engine | - +----------------------------------------------------------------------+ - | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski | - +----------------------------------------------------------------------+ - | This source file is subject to version 0.91 of the Zend license, | - | that is bundled with this package in the file LICENSE, and is | - | available at through the world-wide-web at | - | http://www.zend.com/license/0_91.txt. | - | If you did not receive a copy of the Zend license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@zend.com so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - | Zeev Suraski | - +----------------------------------------------------------------------+ -*/ - - -#ifndef _VARIABLES_H -#define _VARIABLES_H - - -ZEND_API int zend_print_variable(zval *var); - -BEGIN_EXTERN_C() -ZEND_API int _zval_copy_ctor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API int _zval_dtor(zval *zvalue ZEND_FILE_LINE_DC); -ZEND_API int _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC); -#define zval_copy_ctor(zvalue) _zval_copy_ctor((zvalue) ZEND_FILE_LINE_CC) -#define zval_dtor(zvalue) _zval_dtor((zvalue) ZEND_FILE_LINE_CC) -#define zval_ptr_dtor(zval_ptr) _zval_ptr_dtor((zval_ptr) ZEND_FILE_LINE_CC) - -#if ZEND_DEBUG -ZEND_API int _zval_copy_ctor_wrapper(zval *zvalue); -ZEND_API int _zval_dtor_wrapper(zval *zvalue); -ZEND_API int _zval_ptr_dtor_wrapper(zval **zval_ptr); -#define zval_copy_ctor_wrapper _zval_copy_ctor_wrapper -#define zval_dtor_wrapper _zval_dtor_wrapper -#define zval_ptr_dtor_wrapper _zval_ptr_dtor_wrapper -#else -#define zval_copy_ctor_wrapper _zval_copy_ctor -#define zval_dtor_wrapper _zval_dtor -#define zval_ptr_dtor_wrapper _zval_ptr_dtor -#endif - -END_EXTERN_C() - - -void zval_add_ref(zval **p); -void zval_del_ref(zval **p); - -#define PVAL_DESTRUCTOR (int (*)(void *)) zval_dtor_wrapper -#define PVAL_PTR_DTOR (int (*)(void *)) zval_ptr_dtor_wrapper -#define PVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor_wrapper - -ZEND_API void var_reset(zval *var); -ZEND_API void var_uninit(zval *var); - -#endif diff --git a/acconfig.h.in b/acconfig.h.in deleted file mode 100644 index 760d55e2a1..0000000000 --- a/acconfig.h.in +++ /dev/null @@ -1,126 +0,0 @@ -/* This is the default configuration file to read -*- C -*- */ - -#undef socklen_t - -/* these are defined by automake */ -#undef PACKAGE -#undef VERSION - -#undef HAVE_STRUCT_FLOCK -#undef HAVE_TM_GMTOFF - -#define CONFIGURATION_FILE_PATH "php.ini" -#define USE_CONFIG_FILE 1 - -#undef HAVE_DMALLOC - -/* Some global constants defined by conigure */ -#undef PHP_BUILD_DATE -#undef PHP_OS -#undef PHP_UNAME - -/* define uint by configure if it is missed (QNX and BSD derived) */ -#undef uint - -/* define ulong by configure if it is missed (most probably is) */ -#undef ulong - -/* type check for in_addr_t */ -#undef in_addr_t - -/* Define if you have dirent.h but opendir() resides in libc rather than in libdir */ -/* This will cause HAVE_DIRENT_H defined twice sometimes, but it should be problem */ -#undef HAVE_DIRENT_H - -/* Define if you have the resolv library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define if you have the pam library (-lpam). */ -#define HAVE_LIBPAM 0 - -/* Define if you have the bind library (-lbind). */ -#define HAVE_LIBBIND 0 - -/* Define if you have Netscape LDAP instead of umich ldap or openldap*/ -#define HAVE_NSLDAP 0 - -/* Define if you want safe mode enabled by default. */ -#define PHP_SAFE_MODE 0 - -/* Set to the path to the dir containing safe mode executables */ -#define PHP_SAFE_MODE_EXEC_DIR /usr/local/php/bin - -/* Define if you want POST/GET/Cookie track variables by default */ -#define PHP_TRACK_VARS 0 - -/* Undefine if you want stricter XML/SGML compliance by default */ -/* (this disables "" by default) */ -#define DEFAULT_SHORT_OPEN_TAG 1 - -/* Undefine if you do not want PHP by default to escape "'" */ -/* in GET/POST/Cookie data */ -#define MAGIC_QUOTES 1 - -/* Define both of these if you want the bundled REGEX library */ -#define REGEX 0 -#define HSREGEX 0 - -/* Define if you have and want to use libnsl */ -#undef HAVE_LIBNSL - -/* Define if you have and want to use libsocket */ -#undef HAVE_LIBSOCKET - -/* Define if you have the sendmail program available */ -#define HAVE_SENDMAIL 0 - -/* Define if you are compiling PHP as an Apache module */ -#define APACHE 0 - -/* Define if you are compiling PHP as an Apache module with mod_charset patch applied (aka Russian Apache)*/ -#define USE_TRANSFER_TABLES 0 - -/* Define if you are compiling PHP as an fhttpd module */ -#define FHTTPD 0 - -/* Define if your Apache creates an ap_config.h header file (only 1.3b6 and later) */ -#define HAVE_AP_CONFIG_H 0 - -/* Define if your Apache has src/include/compat.h */ -#define HAVE_OLD_COMPAT_H 0 - -/* Define if your Apache has src/include/ap_compat.h */ -#define HAVE_AP_COMPAT_H 0 - -#ifndef DEBUG /* should be set to ZEND_DEBUG */ -#define DEBUG 0 -#endif - -/* Define if you want to enable PHP RPC (experimental) */ -#define PHP_RPC 0 - -/* Define if you want to prevent the CGI from working unless REDIRECT_STATUS is defined in the environment */ -#define FORCE_CGI_REDIRECT 0 - -/* Define if you want to prevent the CGI from using path_info and path_translated */ -#define DISCARD_PATH 0 - -/* Define if you want include() and other functions to be able to open - * http and ftp URLs as files. - */ -#define PHP3_URL_FOPEN 0 - -/* Define if you have broken header files like SunOS 4 */ -#define MISSING_FCLOSE_DECL 0 - -/* Define if you have broken sprintf function like SunOS 4 */ -#define BROKEN_SPRINTF 0 - -/* Define to compile PHP/Zend thread safe */ -#undef ZTS - -/* Define when compiling with Zeus support */ -#undef WITH_ZEUS - -/* Define if struct sockaddr contains the field sa_len */ -#undef HAVE_SOCKADDR_SA_LEN diff --git a/acinclude.m4 b/acinclude.m4 deleted file mode 100644 index aec18cfa50..0000000000 --- a/acinclude.m4 +++ /dev/null @@ -1,362 +0,0 @@ -dnl $Id$ -dnl -dnl This file contains local autoconf functions. - -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,[ - PHP_THREAD_SAFETY=yes -]) - -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,[ - unique=`echo $ac_n "$2$ac_c" | tr -c -d a-zA-Z0-9` - cmd="echo $ac_n \"\$$1$unique$ac_c\"" - if test -n "$unique" && test "`eval $cmd`" = "" ; then - eval "$1$unique=set" - $3 - fi -]) - -dnl -dnl AC_EXPAND_PATH(path, variable) -dnl -dnl expands path to an absolute path and assigns it to variable -dnl -AC_DEFUN(AC_EXPAND_PATH,[ - if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then - $2="$1" - else - ep_dir="`dirname \"$1\"`" - ep_realdir="`(cd \"$ep_dir\" && pwd)`" - $2="$ep_realdir/`basename \"$1\"`" - fi -]) - -dnl -dnl AC_ADD_LIBPATH(path) -dnl -dnl add a library to linkpath/runpath -dnl -AC_DEFUN(AC_ADD_LIBPATH,[ - if test "$1" != "/usr/lib"; then - AC_EXPAND_PATH($1, ai_p) - 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 -]) - -dnl -dnl AC_BUILD_RPATH() -dnl -dnl builds RPATH from PHP_RPATHS -dnl -AC_DEFUN(AC_BUILD_RPATH,[ - if test "$enable_rpath" = "yes" && test -n "$PHP_RPATHS"; then - OLD_RPATHS="$PHP_RPATHS" - 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 AC_ADD_INCLUDE(path) -dnl -dnl add a include path -dnl -AC_DEFUN(AC_ADD_INCLUDE,[ - if test "$1" != "/usr/include"; then - AC_EXPAND_PATH($1, ai_p) - AC_PHP_ONCE(INCLUDEPATH, $ai_p, [ - INCLUDES="$INCLUDES -I$ai_p" - ]) - fi -]) - -dnl -dnl AC_ADD_LIBRARY(library[, append]) -dnl -dnl add a library to the link line -dnl -AC_DEFUN(AC_ADD_LIBRARY,[ - AC_PHP_ONCE(LIBRARY, $1, [ - if test -z "$2"; then - LIBS="-l$1 $LIBS" - else - LIBS="$LIBS -l$1" - fi - ]) -]) - -dnl -dnl AC_ADD_LIBRARY_WITH_PATH(library, path) -dnl -dnl add a library to the link line and path to linkpath/runpath -dnl -AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[ - AC_ADD_LIBPATH($2) - AC_ADD_LIBRARY($1) -]) - - -AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[ - LIBTOOL='$(SHELL) $(top_builddir)/libtool $1' -]) - -dnl -dnl Check for cc option -dnl -AC_DEFUN(AC_CHECK_CC_OPTION,[ - echo "main(){return 0;}" > conftest.$ac_ext - opt="$1" - var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _` - 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) - AC_DEFINE(REGEX,1) - PHP_OUTPUT(regex/Makefile) -elif test "$REGEX_TYPE" = "system"; then - AC_DEFINE(REGEX,0) -elif test "$REGEX_TYPE" = "apache"; then - AC_DEFINE(REGEX,2) -fi - -AC_MSG_CHECKING(which regex library to use) -AC_MSG_RESULT($REGEX_TYPE) - -AC_SUBST(REGEX_DIR) -AC_SUBST(REGEX_LIB) -AC_SUBST(HSREGEX) -]) - -dnl -dnl See if we have broken header files like SunOS has. -dnl -AC_DEFUN(AC_MISSING_FCLOSE_DECL,[ - AC_MSG_CHECKING([for fclose declaration]) - AC_TRY_COMPILE([#include ],[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(AC_BROKEN_SPRINTF,[ - AC_MSG_CHECKING([for broken sprintf]) - AC_TRY_RUN([main() { char buf[20]; exit (sprintf(buf,"testing 123")!=11); }],[ - AC_DEFINE(BROKEN_SPRINTF,0) - AC_MSG_RESULT(ok) - ],[ - AC_DEFINE(BROKEN_SPRINTF,1) - AC_MSG_RESULT(broken) - ],[ - AC_DEFINE(BROKEN_SPRINTF,0) - AC_MSG_RESULT(cannot check, guessing ok) - ]) -]) - -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,[ - if test -d "$cwd/$srcdir/ext/$1" ; then - EXT_SUBDIRS="$EXT_SUBDIRS $1" - if test "$2" != "shared" -a "$2" != "yes"; then - _extlib="libphpext_$1.a" - EXT_LTLIBS="$EXT_LTLIBS ext/$1/libphpext_$1.la" - EXT_LIBS="$EXT_LIBS $1/$_extlib" - EXT_STATIC="$EXT_STATIC $1" - else - AC_DEFINE_UNQUOTED(COMPILE_DL_`echo $1|tr a-z A-Z`, 1, Whether to build $1 as dynamic module) - EXT_SHARED="$EXT_SHARED $1" - fi - PHP_OUTPUT(ext/$1/Makefile) - fi -]) - -AC_SUBST(EXT_SUBDIRS) -AC_SUBST(EXT_STATIC) -AC_SUBST(EXT_SHARED) -AC_SUBST(EXT_LIBS) -AC_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 "$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 -]) - -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 . - -AC_DEFUN(AC_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(AC_SOCKADDR_SA_LEN,[ - AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[ - AC_TRY_COMPILE([#include -#include ], - [struct sockaddr s; s.sa_len;], - [ac_cv_sockaddr_sa_len=yes - AC_DEFINE(HAVE_SOCKADDR_SA_LEN)], - [ac_cv_sockaddr_sa_len=no]) - ]) -]) - -dnl ## PHP_AC_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" -]) diff --git a/apidoc-zend.txt b/apidoc-zend.txt deleted file mode 100644 index 4667ed501a..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 = (pval *) emalloc(sizeof(pval)); - - 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 "foo" 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-defs.h.in b/build-defs.h.in deleted file mode 100644 index fd9f697597..0000000000 --- a/build-defs.h.in +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- C -*- - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken | - +----------------------------------------------------------------------+ - */ - -#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_BINNAME "@BINNAME@" -#define PHP_CFLAGS "@CFLAGS@" -#define PHP_DBASE_LIB "" -#define PHP_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 "" -#define PHP_MYSQL_LFLAGS "" -#define PHP_MYSQL_LIBS "" -#define PHP_ODBC_TYPE "@ODBC_TYPE@" -#define PHP_ODBC_INCLUDE "@ODBC_INCLUDE@" -#define PHP_ODBC_LFLAGS "@ODBC_LFLAGS@" -#define PHP_ODBC_LIBS "@ODBC_LIBS@" -#define PHP_ORACLE_HOME "" -#define PHP_ORACLE_INCLUDE "" -#define PHP_ORACLE_LFLAGS "" -#define PHP_ORACLE_LIBS "" -#define PHP_ORACLE_SHLIBS "" -#define PHP_ORACLE_STLIBS "" -#define PHP_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 "" diff --git a/build.mk b/build.mk deleted file mode 100644 index 8511eb94bb..0000000000 --- a/build.mk +++ /dev/null @@ -1,93 +0,0 @@ -# Makefile to generate build tools -# -# Standard usage: -# make -f build.mk -# -# To prepare a self-contained distribution: -# make -f build.mk dist -# -# -# Written by Sascha Schumann -# -# $Id$ - -LT_TARGETS = ltconfig ltmain.sh config.guess config.sub - -SUBDIRS = libzend TSRM - -STAMP = buildmk.stamp - -makefile_am_files = Makefile.am $(shell find ext sapi regex pear -name Makefile.am) -makefile_in_files = $(makefile_am_files:.am=.in) -makefile_files = $(makefile_am_files:e.am=e) - -config_h_in = php_config.h.in - -config_h_files = \ - $(shell echo ext/*/config.h.stub sapi/*/config.h.stub) - -config_m4_files = \ - $(shell echo ext/*/config.m4 sapi/*/config.m4) - -acconfig_h_SOURCES = acconfig.h.in $(config_h_files) - -targets = $(makefile_in_files) configure $(config_h_in) - -all: $(targets) - @for i in $(SUBDIRS); do \ - test -d $$i || (test -d ../$$i && ln -s ../$$i $$i); \ - (cd $$i>/dev/null && $(MAKE) -f build.mk AMFLAGS=$(AMFLAGS)); \ - done - -all: $(STAMP) - -$(STAMP): buildcheck.sh - @./buildcheck.sh && touch $(STAMP) - -dist: - @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.mk - -clean: - rm -f $(targets) - @for i in $(SUBDIRS); do \ - (cd $$i && $(MAKE) -f build.mk clean); \ - done - -cvsclean: - @for i in $(shell find . -follow -name .cvsignore); do \ - (cd `dirname $$i` && rm -rf `cat .cvsignore`); \ - done - @rm -f $(SUBDIRS) 2>/dev/null || true - -acconfig.h: $(acconfig_h_SOURCES) - @echo rebuilding $@ - @cat $(acconfig_h_SOURCES) > $@ - -$(makefile_in_files): $(makefile_am_files) aclocal.m4 - @echo rebuilding Makefile.in\'s - @for i in $(LT_TARGETS); do \ - if test -f "$$i"; then \ - mv $$i $$i.bak; \ - cp $$i.bak $$i; \ - fi; \ - done - @automake -a -i $(AMFLAGS) $(makefile_files) 2>&1 \ - | grep -v PHP_OUTPUT_FILES || true >&2 - @for i in $(LT_TARGETS); do mv $$i.bak $$i; done - -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 $(config_m4_files) - autoconf diff --git a/buildcheck.sh b/buildcheck.sh deleted file mode 100755 index 96974450fd..0000000000 --- a/buildcheck.sh +++ /dev/null @@ -1,69 +0,0 @@ -#! /bin/sh - -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]* *$//'` -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; 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.3.3 or newer -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.3 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" -gt "3" || test "$2" = "3" -a "$3" -ge "3" -then -echo "buildconf: libtool version $lt_pversion (ok)" -else -echo "buildconf: libtool version $lt_pversion found." -echo " You need libtool version 1.3.3 or newer installed" -echo " to build PHP from CVS." -exit 1 -fi - -am_prefix=`which automake | sed -e 's#/[^/]*/[^/]*$##'` -lt_prefix=`which 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/buildconf b/buildconf deleted file mode 100755 index 0dd249756b..0000000000 --- a/buildconf +++ /dev/null @@ -1,29 +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 - -${MAKE:-make} -s -f build.mk AMFLAGS="$automake_flags" $subdirs diff --git a/calendar.mak b/calendar.mak deleted file mode 100644 index f82afc2f6c..0000000000 --- a/calendar.mak +++ /dev/null @@ -1,244 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on calendar.dsp -!IF "$(CFG)" == "" -CFG=calendar - Win32 Debug -!MESSAGE No configuration specified. Defaulting to calendar - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "calendar - Win32 Release" && "$(CFG)" != "calendar - 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 "calendar.mak" CFG="calendar - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "calendar - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "calendar - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "calendar - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_calendar.dll" - - -CLEAN : - -@erase "$(INTDIR)\calendar.obj" - -@erase "$(INTDIR)\dow.obj" - -@erase "$(INTDIR)\french.obj" - -@erase "$(INTDIR)\gregor.obj" - -@erase "$(INTDIR)\jewish.obj" - -@erase "$(INTDIR)\julian.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_calendar.dll" - -@erase "$(OUTDIR)\php3_calendar.exp" - -@erase "$(OUTDIR)\php3_calendar.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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:1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_calendar.pdb" /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\calendar.obj" \ - "$(INTDIR)\dow.obj" \ - "$(INTDIR)\french.obj" \ - "$(INTDIR)\gregor.obj" \ - "$(INTDIR)\jewish.obj" \ - "$(INTDIR)\julian.obj" - -"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "calendar - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_calendar.dll" - - -CLEAN : - -@erase "$(INTDIR)\calendar.obj" - -@erase "$(INTDIR)\dow.obj" - -@erase "$(INTDIR)\french.obj" - -@erase "$(INTDIR)\gregor.obj" - -@erase "$(INTDIR)\jewish.obj" - -@erase "$(INTDIR)\julian.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_calendar.dll" - -@erase "$(OUTDIR)\php3_calendar.exp" - -@erase "$(OUTDIR)\php3_calendar.ilk" - -@erase "$(OUTDIR)\php3_calendar.lib" - -@erase "$(OUTDIR)\php3_calendar.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\calendar.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\calendar.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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:1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_calendar.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_calendar.dll" /implib:"$(OUTDIR)\php3_calendar.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\calendar.obj" \ - "$(INTDIR)\dow.obj" \ - "$(INTDIR)\french.obj" \ - "$(INTDIR)\gregor.obj" \ - "$(INTDIR)\jewish.obj" \ - "$(INTDIR)\julian.obj" - -"$(OUTDIR)\php3_calendar.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("calendar.dep") -!INCLUDE "calendar.dep" -!ELSE -!MESSAGE Warning: cannot find "calendar.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "calendar - Win32 Release" || "$(CFG)" == "calendar - Win32 Debug" -SOURCE=.\dl\calendar\calendar.c - -"$(INTDIR)\calendar.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\dow.c - -"$(INTDIR)\dow.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\french.c - -"$(INTDIR)\french.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\gregor.c - -"$(INTDIR)\gregor.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\jewish.c - -"$(INTDIR)\jewish.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\calendar\julian.c - -"$(INTDIR)\julian.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/config.guess b/config.guess deleted file mode 100644 index 6cb567b8ae..0000000000 --- a/config.guess +++ /dev/null @@ -1,1087 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 -# Free Software Foundation, Inc. -# -# 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 . -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# Please send patches to the Autoconf mailing list . -# -# 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 system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi - - -# 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 - -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - 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 <$dummy.s - .globl main - .ent main -main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - 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-cbm-sysv4 - exit 0;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - 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 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - arm32:NetBSD:*:*) - echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - SR2?01: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*:NetBSD:*:*) - echo m68k-atari-netbsd${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*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${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 ;; - macppc:NetBSD:*:*) - echo powerpc-apple-netbsd${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 - 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 $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - echo mips-mips-riscos${UNAME_RELEASE} - 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 -o $UNAME_PROCESSOR = mc88110 ] ; then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${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 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $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:*:4) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${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=4.${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 NetBSD 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:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - sed 's/^ //' << EOF >$dummy.c - #include - #include - - 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 - ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` - rm -f $dummy.c $dummy - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >$dummy.c - #include - 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 $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} - exit 0 ;; - CRAY*T3E:*:*:*) - echo t3e-cray-unicosmk${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - F300:UNIX_System_V:*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - i?86:BSD/386:*:* | i?86:BSD/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:*:*) - if test -x /usr/bin/objformat; then - if test "elf" = "`/usr/bin/objformat`"; then - echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'` - exit 0 - fi - fi - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`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*: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 ;; - *:Linux:*:*) - # uname on the ARM produces all sorts of strangeness, and we need to - # filter it out. - case "$UNAME_MACHINE" in - armv*) UNAME_MACHINE=$UNAME_MACHINE ;; - arm* | sa110*) UNAME_MACHINE="arm" ;; - esac - - # 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_help_string=`cd /; ld --help 2>&1` - ld_supported_emulations=`echo $ld_help_string \ - | 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 ;; - i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; - sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; - elf32ppc) - # Determine Lib Version - cat >$dummy.c < -#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("unkown\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 ;; - esac - - if test "${UNAME_MACHINE}" = "alpha" ; then - sed 's/^ //' <$dummy.s - .globl main - .ent main - main: - .frame \$30,0,\$26,0 - .prologue 0 - .long 0x47e03d80 # implver $0 - lda \$2,259 - .long 0x47e20c21 # amask $2,$1 - srl \$1,8,\$2 - sll \$2,2,\$2 - sll \$0,3,\$0 - addl \$1,\$0,\$0 - addl \$2,\$0,\$0 - ret \$31,(\$26),1 - .end main -EOF - LIBC="" - $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null - if test "$?" = 0 ; then - ./$dummy - case "$?" in - 7) - UNAME_MACHINE="alpha" - ;; - 15) - UNAME_MACHINE="alphaev5" - ;; - 14) - UNAME_MACHINE="alphaev56" - ;; - 10) - UNAME_MACHINE="alphapca56" - ;; - 16) - UNAME_MACHINE="alphaev6" - ;; - 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 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c </dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - else - # 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. - echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" - test $? != 0 && 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 < -#ifdef __cplusplus - 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 $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - fi ;; -# 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.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i?86:*:5:7*) - 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=i585 - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE} - exit 0 ;; - i?86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /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 ;; - pc:*:*:*) - # 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]??,*:*: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.*:*) - 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]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) - echo rs6000-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 - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # 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 ;; -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 < -# include -#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 - 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) - printf ("vax-dec-bsd\n"); exit (0); -#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 $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 - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/config.sub b/config.sub deleted file mode 100644 index 2436b45347..0000000000 --- a/config.sub +++ /dev/null @@ -1,1215 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc. -# 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. - -# 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. - -if [ x$1 = x ] -then - echo Configuration name missing. 1>&2 - echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 - echo "or $0 ALIAS" 1>&2 - echo where ALIAS is a recognized configuration type. 1>&2 - exit 1 -fi - -# First pass through any local machine types. -case $1 in - *local*) - echo $1 - exit 0 - ;; - *) - ;; -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 - linux-gnu*) - 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) - 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 - ;; -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 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ - | 580 | i960 | h8300 \ - | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ - | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \ - | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ - | mips64orion | mips64orionel | mipstx39 | mipstx39el \ - | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ - | mips64vr5000 | miprs64vr5000el \ - | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v) - basic_machine=$basic_machine-unknown - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | 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[34567]86) - 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. - vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ - | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ - | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ - | xmp-* | ymp-* \ - | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \ - | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \ - | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ - | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ - | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ - | mips64el-* | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ - | mipstx39-* | mipstx39el-* \ - | f301-* | armv*-* | t3e-* \ - | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ - | thumb-* | v850-* | d30v-* | tic30-* | c30-* ) - ;; - # 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-cbm - ;; - amigaos | amigados) - basic_machine=m68k-cbm - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-cbm - 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 - ;; - [ctj]90-cray) - basic_machine=c90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - 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 - ;; - 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 - os=-mvs - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i[34567]86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i[34567]86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i[34567]86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i[34567]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 - ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; - 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 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | *MiNT) - 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 - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - msdos) - basic_machine=i386-unknown - os=-msdos - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-corel - 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 - ;; - np1) - basic_machine=np1-gould - ;; - 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 | nexen) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86) - basic_machine=i686-pc - ;; - pentiumii | pentium2) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexen-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=rs6000-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 - ;; - 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 - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=t3e-cray - os=-unicos - ;; - 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 - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sparc | sparcv9) - 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 - ;; - *) - 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* | -openstep* | -oskit*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ - | -macos* | -mpw* | -magic* | -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|'` - ;; - -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 - ;; - # 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) - 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*-corel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - 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 - ;; - f301-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*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -vxsim* | -vxworks*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -*MiNT) - vendor=atari - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os diff --git a/configure.in b/configure.in deleted file mode 100644 index 13ea7784eb..0000000000 --- a/configure.in +++ /dev/null @@ -1,842 +0,0 @@ -dnl ## $Id$ -*- sh -*- -dnl ## Process this file with autoconf to produce a configure script. - -divert(0) - -AC_INIT(main.c) - -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. -test -d libs || mkdir libs - -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` -for i in $@; do passthru="$passthru \"$i\""; done - -CONFIGURE_COMMAND=$0 -for arg in "$@"; do - CONFIGURE_COMMAND="$CONFIGURE_COMMAND '$arg'" -done -AC_SUBST(CONFIGURE_COMMAND) - -dnl ## Diversion 1 is the initial checking of OS features, programs, -dnl ## libraries and so on. - -dnl ## In diversion 2 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 3 we check which extensions should be compiled. -dnl ## All of these are normally in the extension directories. - -dnl ## Diversion 4 is the last one. Here we generate files and clean up. - -divert(1) - -dnl ## This is where the version number is changed from now on! -AM_INIT_AUTOMAKE(php, 4.0b4-dev) - -PHP_VERSION=$VERSION -echo "/* automatically generated by configure */" > php_version.h.new -echo "/* edit configure.in.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(php_config.h) -AM_MAINTAINER_MODE - -phplibdir=$libdir/php -AC_SUBST(phplibdir) -AC_SUBST(PHP_VERSION) - -dnl We want this one before the checks, so the checks can modify CFLAGS. -test -z "$CFLAGS" && auto_cflags=1 - -dnl If we're using cc on HP-UX, add -Ae -D_HPUX_SOURCE [obsolete] -dnl if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then -dnl test -n "$GCC" || CFLAGS="-Ae $CFLAGS -D_HPUX_SOURCE" -dnl fi - -dnl Checks for programs. -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 - -dnl ## there has to be a better way... -dnl## OLDLIBS=$LIBS; LIBS="" -AC_PROG_CC -dnl## LIBS=$OLDLIBS - -AM_PROG_CC_STDC - -AC_PROG_RANLIB -AC_PROG_CC_C_O -AC_PROG_LN_S - -AM_PROG_LEX - -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 -AC_SUBST(LEX_CFLAGS) - -dnl Hack to work around a Mac OS X cpp problem -dnl Known versions needing this workaround are 5.3 and 5.4 -if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then - CPPFLAGS="$CPPFLAGS -traditional-cpp" -fi - -dnl Ugly hack to get around a problem with gcc on AIX. -if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \ - "`uname -sv`" = "AIX 4"; then - CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` -fi - -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 - -dnl AC_PROG_INSTALL -AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib) -if test -n "$PROG_SENDMAIL"; then - AC_DEFINE(HAVE_SENDMAIL) -fi - -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 - CFLAGS="$CFLAGS -I/usr/pkg/include" - LDFLAGS="$LDFLAGS -L/usr/pkg/lib" -fi - -INCLUDES="-I\$(top_builddir)/libzend -I\$(top_srcdir) -I\$(top_srcdir)/libzend" -AC_SUBST(INCLUDES) - -AC_CHECK_LIB(nsl, gethostname, [ - AC_ADD_LIBRARY(nsl) - AC_DEFINE(HAVE_LIBNSL) ], []) - -AC_CHECK_LIB(socket, socket, [ - AC_ADD_LIBRARY(socket) - AC_DEFINE(HAVE_LIBSOCKET) ], [ - AC_CHECK_LIB(socket, htonl, [ - AC_ADD_LIBRARY(socket) - ])]) - -AC_CHECK_LIB(nsl, gethostbyaddr, [ - AC_ADD_LIBRARY(nsl) - AC_DEFINE(HAVE_LIBNSL) ], []) - -AC_CHECK_LIB(crypt, crypt, [ - AC_ADD_LIBRARY(crypt) - AC_DEFINE(HAVE_LIBCRYPT) ], []) - -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) - -AC_CHECK_LIB(bind, inet_aton, [ - AC_ADD_LIBRARY(bind) - AC_DEFINE(HAVE_LIBBIND) ], []) - -AC_CHECK_LIB(resolv, 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) ], [ - AC_CHECK_LIB(resolv, res_search, [ - LIBS="$LIBS -lresolv" - AC_DEFINE(HAVE_LIBRESOLV) - ], [ - 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 -AC_MISSING_FCLOSE_DECL -dnl QNX requires unix.h to allow functions in libunix to work properly -AC_CHECK_HEADERS( -arpa/inet.h \ -crypt.h \ -dlfcn.h \ -fcntl.h \ -grp.h \ -limits.h \ -locale.h \ -memory.h \ -netinet/in.h \ -pwd.h \ -signal.h \ -stdarg.h \ -stdlib.h \ -string.h \ -sys/file.h \ -sys/mman.h \ -sys/select.h \ -sys/socket.h \ -sys/statfs.h \ -sys/statvfs.h \ -sys/time.h \ -sys/types.h \ -sys/varargs.h \ -sys/wait.h \ -syslog.h \ -unistd.h \ -unix.h \ -) - -dnl Checks for typedefs, structures, and compiler characteristics. -AC_STRUCT_TM -AC_STRUCT_TIMEZONE - -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#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) -fi - -AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock, - AC_TRY_COMPILE([ -#include -#include - ], - [struct flock x;], - [ - ac_cv_struct_flock=yes - ],[ - ac_cv_struct_flock=no - ]) -) - -AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t, - AC_TRY_COMPILE([ -#include -#include -],[ -socklen_t x; -],[ - ac_cv_socklen_t=yes -],[ - ac_cv_socklen_t=no -])) - - -if test "$ac_cv_struct_flock" = "yes" ; then - AC_DEFINE(HAVE_STRUCT_FLOCK, 1) -fi - -if test "$ac_cv_socklen_t" = "no"; then - AC_CHECK_TYPE(socklen_t, unsigned int) -fi - -AC_CHECK_SIZEOF(long, 8) -AC_CHECK_SIZEOF(int, 4) - -test -d /usr/ucblib && AC_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 - AC_SUBST(WARNING_LEVEL) -fi -AC_STRUCT_ST_RDEV - -dnl Checks for types -AC_TYPE_SIZE_T -AC_TYPE_UID_T -dnl This is required for QNX and may be some BSD derived systems -AC_CHECK_TYPE( uint, unsigned int ) -AC_CHECK_TYPE( ulong, unsigned long ) - -dnl Checks for library functions. -AC_FUNC_VPRINTF -AC_CHECK_FUNCS( -asctime_r \ -crypt \ -ctime_r \ -cuserid \ -flock \ -gcvt \ -getlogin \ -gethostbyaddr \ -gettimeofday \ -gmtime_r \ -inet_aton \ -link \ -localtime_r \ -lockf \ -lrand48 \ -memcpy \ -memmove \ -mmap \ -putenv \ -random \ -rand_r \ -regcomp \ -rint \ -setitimer \ -setlocale \ -setsockopt \ -setvbuf \ -shutdown \ -sin \ -snprintf \ -srand48 \ -srandom \ -statfs \ -statvfs \ -strcasecmp \ -strdup \ -strerror \ -strftime \ -strstr \ -strtok_r \ -symlink \ -tempnam \ -tzset \ -unsetenv \ -usleep \ -utime \ -vsnprintf \ -) - -AC_REPLACE_FUNCS(strlcat strlcpy getopt) -AC_FUNC_UTIME_NULL -AC_FUNC_ALLOCA -dnl## OLDLIBS=$LIBS; LIBS="" -dnl This is also defined/used in libzend. To avoid a redefinition -dnl we use that version -dnl AC_BROKEN_SPRINTF -dnl## LIBS=$OLDLIBS - -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 -<>dnl -changequote([,]), [#include -#if STDC_HEADERS -#include -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#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(2) - -abs_srcdir=`(cd $srcdir; pwd)` -abs_builddir=`pwd` -AC_SUBST(abs_srcdir) -AC_SUBST(abs_builddir) - -AC_MSG_CHECKING(whether to use a configuration file) -AC_ARG_WITH(config-file-path, -[ --with-config-file-path=PATH - Sets the path in which to look for php.ini. - defaults to /usr/local/lib], -[ - if test "$withval" = "yes"; then - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) - else - if test "$withval" != "no"; then - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "$withval") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(CONFIGURATION_FILE_PATH, 0) - AC_DEFINE(USE_CONFIG_FILE, 0) - AC_MSG_RESULT(no) - fi - fi -],[ - AC_DEFINE_UNQUOTED(CONFIGURATION_FILE_PATH, "/usr/local/lib") - AC_DEFINE(USE_CONFIG_FILE, 1) - AC_MSG_RESULT(yes) -]) - - -AC_MSG_CHECKING(whether to include debugging symbols) -AC_ARG_ENABLE(debug, -[ --disable-debug Compile without debugging symbols], -[ - if test "$enableval" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(DEBUG,1) - PHP_DEBUG=1 - DEBUG_CFLAGS="-g" - test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall" - test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \ - DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations" - else - AC_MSG_RESULT(no) - AC_DEFINE(DEBUG,0) - PHP_DEBUG=0 - DEBUG_CFLAGS="" - fi -],[ - AC_MSG_RESULT(yes) - AC_DEFINE(DEBUG,1) - PHP_DEBUG=1 - DEBUG_CFLAGS="-g" -]) -AC_SUBST(DEBUG_CFLAGS) -AC_SUBST(PHP_DEBUG) -CFLAGS="$CFLAGS $DEBUG_CFLAGS" - - -AC_MSG_CHECKING(whether to enable safe mode by default) -AC_ARG_ENABLE(safe-mode, -[ --enable-safe-mode Enable safe mode by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(PHP_SAFE_MODE, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(PHP_SAFE_MODE, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(PHP_SAFE_MODE, 0) - AC_MSG_RESULT(no) -]) - - -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) -]) - - -AC_MSG_CHECKING(whether to enable track_vars variables by default) -AC_ARG_ENABLE(track-vars, -[ --enable-track-vars Enable GET/POST/Cookie track variables by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(PHP_TRACK_VARS, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(PHP_TRACK_VARS, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(PHP_TRACK_VARS, 0) - AC_MSG_RESULT(no) -]) - - -AC_MSG_CHECKING(whether to enable magic quotes by default) -AC_ARG_ENABLE(magic-quotes, -[ --enable-magic-quotes Enable magic quotes by default.], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(MAGIC_QUOTES, 1) - AC_MSG_RESULT(yes) - else - AC_DEFINE(MAGIC_QUOTES, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(MAGIC_QUOTES, 0) - AC_MSG_RESULT(no) -]) - - -AC_MSG_CHECKING(whether to enable runpaths) -AC_ARG_ENABLE(rpath, -[ --disable-rpath Disable passing additional runtime library - search paths], -[ - if test "$enableval" = "no"; then - enable_rpath=no - else - enable_rpath=yes - fi -],[ - enable_rpath=yes -]) -AC_MSG_RESULT($enable_rpath) - -AC_MSG_CHECKING(whether to enable short tags by default) -AC_ARG_ENABLE(short-tags, -[ --disable-short-tags Disable the short-form $srcdir/ext/bcmath/number.c - echo "creating number.h" - echo "/* Dummy File */" > $srcdir/ext/bcmath/number.h -fi - -if test "$no_recursion" != "yes"; then - (set -x; test -d libzend || mkdir libzend; cd libzend; $cwd/$srcdir/libzend/configure --cache-file=../$cache_file $passthru) || exit 1 - if test "$PHP_THREAD_SAFETY" = "yes"; then - (set -x; test -d TSRM || mkdir TSRM; cd TSRM && $cwd/$srcdir/TSRM/configure --cache-file=../$cache_file $passthru) || exit 1 - fi -dnl (set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cache_file ltmain.sh) -fi - -# run this only when generating all the files? -if true; then - chmod +x scripts/mkextlib - # Hacking while airborne considered harmful. - # - echo "creating internal_functions.c" - extensions=\`grep '^s.@EXT_STATIC@' \$0|sed -e 's/^.*@% *//' -e 's/%.*$//'\` - mv -f internal_functions.c internal_functions.c.old 2>/dev/null - sh $srcdir/genif.sh $srcdir/internal_functions.c.in $srcdir \$extensions > internal_functions.c - if cmp internal_functions.c.old internal_functions.c > /dev/null 2>&1; then - echo "internal_functions.c is unchanged" - mv internal_functions.c.old internal_functions.c - else - rm -f internal_functions.c.old - 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.php3#4.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 "| 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/config-security.php3 for more details. |" - fi - fi - 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 "+--------------------------------------------------------------------+" - -fi - -]) - -divert - -dnl ## Local Variables: -dnl ## tab-width: 4 -dnl ## End: diff --git a/crypt.mak b/crypt.mak deleted file mode 100644 index 9488b28710..0000000000 --- a/crypt.mak +++ /dev/null @@ -1,204 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on crypt.dsp -!IF "$(CFG)" == "" -CFG=crypt - Win32 Debug -!MESSAGE No configuration specified. Defaulting to crypt - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "crypt - Win32 Release" && "$(CFG)" != "crypt - 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 "crypt.mak" CFG="crypt - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "crypt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "crypt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "crypt - Win32 Release" - -OUTDIR=.\module_Release -INTDIR=.\module_Release -# Begin Custom Macros -OutDir=.\module_Release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_crypt.dll" - - -CLEAN : - -@erase "$(INTDIR)\crypt.obj" - -@erase "$(INTDIR)\sflcryp.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_crypt.dll" - -@erase "$(OUTDIR)\php3_crypt.exp" - -@erase "$(OUTDIR)\php3_crypt.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /D HAVE_SFLCRYPT=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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 /incremental:no /pdb:"$(OUTDIR)\php3_crypt.pdb" /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\crypt.obj" \ - "$(INTDIR)\sflcryp.obj" - -"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "crypt - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_crypt.dll" - - -CLEAN : - -@erase "$(INTDIR)\crypt.obj" - -@erase "$(INTDIR)\sflcryp.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_crypt.dll" - -@erase "$(OUTDIR)\php3_crypt.exp" - -@erase "$(OUTDIR)\php3_crypt.ilk" - -@erase "$(OUTDIR)\php3_crypt.lib" - -@erase "$(OUTDIR)\php3_crypt.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /D HAVE_SFLCRYPT=1 /D "DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\crypt.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\crypt.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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 /incremental:yes /pdb:"$(OUTDIR)\php3_crypt.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_crypt.dll" /implib:"$(OUTDIR)\php3_crypt.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\crypt.obj" \ - "$(INTDIR)\sflcryp.obj" - -"$(OUTDIR)\php3_crypt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("crypt.dep") -!INCLUDE "crypt.dep" -!ELSE -!MESSAGE Warning: cannot find "crypt.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "crypt - Win32 Release" || "$(CFG)" == "crypt - Win32 Debug" -SOURCE=.\dl\crypt\crypt.c - -"$(INTDIR)\crypt.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dl\crypt\sflcryp.c - -"$(INTDIR)\sflcryp.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dbase.mak b/dbase.mak deleted file mode 100644 index d1dfd306c9..0000000000 --- a/dbase.mak +++ /dev/null @@ -1,234 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on dbase.dsp -!IF "$(CFG)" == "" -CFG=dbase - Win32 Debug -!MESSAGE No configuration specified. Defaulting to dbase - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "dbase - Win32 Release" && "$(CFG)" != "dbase - 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 "dbase.mak" CFG="dbase - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dbase - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "dbase - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "dbase - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbase.dll" - - -CLEAN : - -@erase "$(INTDIR)\dbase.obj" - -@erase "$(INTDIR)\dbf_head.obj" - -@erase "$(INTDIR)\dbf_misc.obj" - -@erase "$(INTDIR)\dbf_ndx.obj" - -@erase "$(INTDIR)\dbf_rec.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_dbase.dll" - -@erase "$(OUTDIR)\php3_dbase.exp" - -@erase "$(OUTDIR)\php3_dbase.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "NDEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbase.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\dbase.obj" \ - "$(INTDIR)\dbf_head.obj" \ - "$(INTDIR)\dbf_misc.obj" \ - "$(INTDIR)\dbf_ndx.obj" \ - "$(INTDIR)\dbf_rec.obj" - -"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "dbase - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug -# Begin Custom Macros -OutDir=.\module_debug -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbase.dll" - - -CLEAN : - -@erase "$(INTDIR)\dbase.obj" - -@erase "$(INTDIR)\dbf_head.obj" - -@erase "$(INTDIR)\dbf_misc.obj" - -@erase "$(INTDIR)\dbf_ndx.obj" - -@erase "$(INTDIR)\dbf_rec.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_dbase.dll" - -@erase "$(OUTDIR)\php3_dbase.exp" - -@erase "$(OUTDIR)\php3_dbase.ilk" - -@erase "$(OUTDIR)\php3_dbase.lib" - -@erase "$(OUTDIR)\php3_dbase.pdb" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "dbase\\" /I "./" /I "../" /D DBASE=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbase.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbase.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.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 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbase.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_dbase.dll" /implib:"$(OUTDIR)\php3_dbase.lib" /pdbtype:sept /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\dbase.obj" \ - "$(INTDIR)\dbf_head.obj" \ - "$(INTDIR)\dbf_misc.obj" \ - "$(INTDIR)\dbf_ndx.obj" \ - "$(INTDIR)\dbf_rec.obj" - -"$(OUTDIR)\php3_dbase.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("dbase.dep") -!INCLUDE "dbase.dep" -!ELSE -!MESSAGE Warning: cannot find "dbase.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "dbase - Win32 Release" || "$(CFG)" == "dbase - Win32 Debug" -SOURCE=.\functions\dbase.c - -"$(INTDIR)\dbase.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_head.c - -"$(INTDIR)\dbf_head.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_misc.c - -"$(INTDIR)\dbf_misc.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_ndx.c - -"$(INTDIR)\dbf_ndx.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\dbase\dbf_rec.c - -"$(INTDIR)\dbf_rec.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dbm.mak b/dbm.mak deleted file mode 100644 index 3931f58b68..0000000000 --- a/dbm.mak +++ /dev/null @@ -1,201 +0,0 @@ -# Microsoft Developer Studio Generated NMAKE File, Based on dbm.dsp -!IF "$(CFG)" == "" -CFG=dbm - Win32 Debug -!MESSAGE No configuration specified. Defaulting to dbm - Win32 Debug. -!ENDIF - -!IF "$(CFG)" != "dbm - Win32 Release" && "$(CFG)" != "dbm - 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 "dbm.mak" CFG="dbm - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dbm - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "dbm - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE -!ERROR An invalid configuration is specified. -!ENDIF - -!IF "$(OS)" == "Windows_NT" -NULL= -!ELSE -NULL=nul -!ENDIF - -!IF "$(CFG)" == "dbm - Win32 Release" - -OUTDIR=.\module_release -INTDIR=.\module_release -# Begin Custom Macros -OutDir=.\module_release -# End Custom Macros - -ALL : "$(OUTDIR)\php3_dbm.dll" - - -CLEAN : - -@erase "$(INTDIR)\db.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(OUTDIR)\php3_dbm.dll" - -@erase "$(OUTDIR)\php3_dbm.exp" - -@erase "$(OUTDIR)\php3_dbm.lib" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib libdb.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:2 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_dbm.pdb" /machine:I386 /out:"$(OUTDIR)\php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /libpath:"..\..\lib" /libpath:"cgi_release" -LINK32_OBJS= \ - "$(INTDIR)\db.obj" \ - "$(INTDIR)\flock.obj" - -"$(OUTDIR)\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ELSEIF "$(CFG)" == "dbm - Win32 Debug" - -OUTDIR=.\module_debug -INTDIR=.\module_debug - -ALL : "c:\php3\php3_dbm.dll" - - -CLEAN : - -@erase "$(INTDIR)\db.obj" - -@erase "$(INTDIR)\flock.obj" - -@erase "$(INTDIR)\vc60.idb" - -@erase "$(INTDIR)\vc60.pdb" - -@erase "$(OUTDIR)\php3_dbm.exp" - -@erase "$(OUTDIR)\php3_dbm.lib" - -@erase "$(OUTDIR)\php3_dbm.pdb" - -@erase "c:\php3\php3_dbm.dll" - -@erase "c:\php3\php3_dbm.ilk" - -"$(OUTDIR)" : - if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" - -CPP=cl.exe -CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D NDBM=1 /D GDBM=0 /D BSD2=1 /D "DEBUG" /D "_DEBUG" /D COMPILE_DL=1 /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\dbm.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c - -.c{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.obj:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.c{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cpp{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -.cxx{$(INTDIR)}.sbr:: - $(CPP) @<< - $(CPP_PROJ) $< -<< - -MTL=midl.exe -MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -RSC=rc.exe -BSC32=bscmake.exe -BSC32_FLAGS=/nologo /o"$(OUTDIR)\dbm.bsc" -BSC32_SBRS= \ - -LINK32=link.exe -LINK32_FLAGS=php.lib libdb.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:2 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_dbm.pdb" /debug /machine:I386 /out:"c:\php3/php3_dbm.dll" /implib:"$(OUTDIR)\php3_dbm.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug" -LINK32_OBJS= \ - "$(INTDIR)\db.obj" \ - "$(INTDIR)\flock.obj" - -"c:\php3\php3_dbm.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) - $(LINK32) @<< - $(LINK32_FLAGS) $(LINK32_OBJS) -<< - -!ENDIF - - -!IF "$(NO_EXTERNAL_DEPS)" != "1" -!IF EXISTS("dbm.dep") -!INCLUDE "dbm.dep" -!ELSE -!MESSAGE Warning: cannot find "dbm.dep" -!ENDIF -!ENDIF - - -!IF "$(CFG)" == "dbm - Win32 Release" || "$(CFG)" == "dbm - Win32 Debug" -SOURCE=.\functions\db.c - -"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - -SOURCE=.\win32\flock.c - -"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" - $(CPP) $(CPP_PROJ) $(SOURCE) - - - -!ENDIF - diff --git a/dlist.c b/dlist.c deleted file mode 100644 index ea707fc6fb..0000000000 --- a/dlist.c +++ /dev/null @@ -1,421 +0,0 @@ -/**************************************************************************** -* -* Copyright (C) 1991 Kendall Bennett. -* All rights reserved. -* -* Filename: $RCSfile$ -* Version: $Revision$ -* -* Language: ANSI C -* Environment: any -* -* Description: Module to implement doubly linked lists. Includes a routine -* to peform a mergesort on the doubly linked list. -* -* $Id$ -* -* Revision History: -* ----------------- -* -* $Log$ -* Revision 1.1 1999/07/19 18:58:44 andrey -* Moving dlist stuff into core. -* -* Revision 1.2 1999/05/11 00:01:42 zeev -* * Get Apache to work. POST doesn't work yet. -* * There are now -I directives for the absolute path of php4, php4/libzend and the builddir for -* the Apache module, so we can #include any php/Zend header. -* * Rename config.h to php_config.h -* -* Revision 1.1 1999/04/21 23:11:20 ssb -* moved apache, com and hyperwave into ext/ -* -* Revision 1.1.1.1 1999/04/07 21:03:31 zeev -* PHP 4.0 -* -* Revision 1.1.1.1 1999/03/17 04:29:11 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.5 91/12/31 19:39:49 kjb -* Modified include file directories. -* -* Revision 1.4 91/10/28 03:16:39 kjb -* Ported to the Iris. -* -* Revision 1.3 91/09/27 03:09:18 kjb -* Cosmetic change. -* -* Revision 1.2 91/09/03 18:27:42 ROOT_DOS -* Ported to UNIX. -* -* Revision 1.1 91/09/01 18:35:23 ROOT_DOS -* Initial revision -* -****************************************************************************/ - -#ifndef MSVC5 -#include "php_config.h" -#endif - -#include -#include -#include -#include "dlist.h" - -#define PUBLIC -#define PRIVATE static - -PUBLIC void *dlst_newnode(int size) -/**************************************************************************** -* -* Function: dlst_newnode -* Parameters: size - Amount of memory to allocate for node -* Returns: Pointer to the allocated node's user space. -* -* Description: Allocates the memory required for a node, adding a small -* header at the start of the node. We return a reference to -* the user space of the node, as if it had been allocated via -* malloc(). -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *node; - - if ( !(node = (PHP_DLST_BUCKET*)malloc(size + sizeof(PHP_DLST_BUCKET))) ) { - fprintf(stderr,"Not enough memory to allocate list node.\n"); -/* raise(SIGABRT);*/ - return NULL; - } - - return PHP_DLST_USERSPACE(node); /* Return pointer to user space */ -} - -PUBLIC void dlst_freenode(void *node) -/**************************************************************************** -* -* Function: dlst_freenode -* Parameters: node - Node to free. -* -* Description: Frees a node previously allocated with lst_newnode(). -* -****************************************************************************/ -{ - free(PHP_DLST_HEADER(node)); -} - -PUBLIC DLIST *dlst_init(void) -/**************************************************************************** -* -* Function: dlst_init -* Returns: Pointer to a newly created list. -* -* Description: Initialises a list and returns a pointer to it. -* -****************************************************************************/ -{ - DLIST *l; - - if ((l = (DLIST*)malloc(sizeof(DLIST))) != NULL) { - l->count = 0; - l->head = &(l->hz[0]); - l->z = &(l->hz[1]); - l->head->next = l->z->next = l->z; - l->z->prev = l->head->prev = l->head; - } - else { - fprintf(stderr,"Insufficient memory to allocate list\n"); - /*raise(SIGABRT);*/ - return NULL; - } - - return l; -} - -PUBLIC void dlst_kill(DLIST *l,void (*freeNode)(void *node)) -/**************************************************************************** -* -* Function: dlst_kill -* Parameters: l - List to kill -* freeNode - Pointer to user routine to free a node -* -* Description: Kills the list l, by deleting all of the elements contained -* within the list one by one and then deleting the list -* itself. Note that we call the user supplied routine -* (*freeNode)() to free each list node. This allows the user -* program to perform any extra processing needed to kill each -* node (if each node contains pointers to other items on the -* heap for example). If no extra processing is required, just -* pass the address of dlst_freenode(), ie: -* -* dlst_kill(myList,dlst_freenode); -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n,*p; - - n = l->head->next; - while (n != l->z) { /* Free all nodes in list */ - p = n; - n = n->next; - (*freeNode)(PHP_DLST_USERSPACE(p)); - } - free(l); /* Free the list itself */ -} - -PUBLIC void dlst_insertafter(DLIST *l,void *node,void *after) -/**************************************************************************** -* -* Function: lst_insertafter -* Parameters: l - List to insert node into -* node - Pointer to user space of node to insert -* after - Pointer to user space of node to insert node after -* -* Description: Inserts a new node into the list after the node 'after'. To -* insert a new node at the beginning of the list, user the -* macro PHP_DLST_HEAD in place of 'after'. ie: -* -* dlst_insertafter(mylist,node,PHP_DLST_HEAD(mylist)); -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node),*a = PHP_DLST_HEADER(after); - - n->next = a->next; - a->next = n; - n->prev = a; - n->next->prev = n; - l->count++; -} - -PUBLIC void *dlst_deletenext(DLIST *l,void *node) -/**************************************************************************** -* -* Function: lst_deletenext -* Parameters: l - List to delete node from. -* node - Node to delete the next node from -* Returns: Pointer to the deleted node's userspace. -* -* Description: Removes the node AFTER 'node' from the list l. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node); - - node = PHP_DLST_USERSPACE(n->next); - n->next->next->prev = n; - n->next = n->next->next; - l->count--; - return node; -} - -PUBLIC void *dlst_first(DLIST *l) -/**************************************************************************** -* -* Function: dlst_first -* Parameters: l - List to obtain first node from -* Returns: Pointer to first node in list, NULL if list is empty. -* -* Description: Returns a pointer to the user space of the first node in -* the list. If the list is empty, we return NULL. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n; - - n = l->head->next; - return (n == l->z ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_last(DLIST *l) -/**************************************************************************** -* -* Function: dlst_last -* Parameters: l - List to obtain last node from -* Returns: Pointer to last node in list, NULL if list is empty. -* -* Description: Returns a pointer to the user space of the last node in -* the list. If the list is empty, we return NULL. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n; - - n = l->z->prev; - return (n == l->head ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_next(void *prev) -/**************************************************************************** -* -* Function: dlst_next -* Parameters: prev - Previous node in list to obtain next node from -* Returns: Pointer to the next node in the list, NULL at end of list. -* -* Description: Returns a pointer to the user space of the next node in the -* list given a pointer to the user space of the previous node. -* If we have reached the end of the list, we return NULL. The -* end of the list is detected when the next pointer of a node -* points back to itself, as does the dummy last node's next -* pointer. This enables us to detect the end of the list -* without needed access to the list data structure itself. -* -* NOTE: We do no checking to ensure that 'prev' is NOT a -* NULL pointer. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(prev); - - n = n->next; - return (n == n->next ? NULL : PHP_DLST_USERSPACE(n)); -} - -PUBLIC void *dlst_prev(void *next) -/**************************************************************************** -* -* Function: dlst_prev -* Parameters: next - Next node in list to obtain previous node from -* Returns: Pointer to the previous node in the list, NULL at start list. -* -* Description: Returns a pointer to the user space of the prev node in the -* list given a pointer to the user space of the next node. -* If we have reached the start of the list, we return NULL. The -* start of the list is detected when the prev pointer of a node -* points back to itself, as does the dummy head node's prev -* pointer. This enables us to detect the start of the list -* without needed access to the list data structure itself. -* -* NOTE: We do no checking to ensure that 'next' is NOT a -* NULL pointer. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *n = PHP_DLST_HEADER(next); - - n = n->prev; - return (n == n->prev ? NULL : PHP_DLST_USERSPACE(n)); -} - -/* Static globals required by merge() */ - -static PHP_DLST_BUCKET *z; -static int (*cmp)(void*,void*); - -PRIVATE PHP_DLST_BUCKET *merge(PHP_DLST_BUCKET *a,PHP_DLST_BUCKET *b,PHP_DLST_BUCKET **end) -/**************************************************************************** -* -* Function: merge -* Parameters: a,b - Sublist's to merge -* Returns: Pointer to the merged sublists. -* -* Description: Merges two sorted lists of nodes together into a single -* sorted list. -* -****************************************************************************/ -{ - PHP_DLST_BUCKET *c; - - /* Go through the lists, merging them together in sorted order */ - - c = z; - while (a != z && b != z) { - if ((*cmp)(PHP_DLST_USERSPACE(a),PHP_DLST_USERSPACE(b)) <= 0) { - c->next = a; c = a; a = a->next; - } - else { - c->next = b; c = b; b = b->next; - } - }; - - /* If one of the lists is not exhausted, then re-attach it to the end - * of the newly merged list - */ - - if (a != z) c->next = a; - if (b != z) c->next = b; - - /* Set *end to point to the end of the newly merged list */ - - while (c->next != z) c = c->next; - *end = c; - - /* Determine the start of the merged lists, and reset z to point to - * itself - */ - - c = z->next; z->next = z; - return c; -} - -PUBLIC void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)) -/**************************************************************************** -* -* Function: dlst_mergesort -* Parameters: l - List to merge sort -* cmp_func - Function to compare two user spaces -* -* Description: Mergesort's all the nodes in the list. 'cmp' must point to -* a comparison function that can compare the user spaces of -* two different nodes. 'cmp' should work the same as -* strcmp(), in terms of the values it returns. Rather than -* waste processing time keeping the previous pointers up to -* date while performing the mergesort, we simply run through -* the list at the end of the sort to fix the previous pointers. -* -****************************************************************************/ -{ - int i,N; - PHP_DLST_BUCKET *a,*b; /* Pointers to sublists to merge */ - PHP_DLST_BUCKET *c; /* Pointer to end of sorted sublists */ - PHP_DLST_BUCKET *head; /* Pointer to dummy head node for list */ - PHP_DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */ - PHP_DLST_BUCKET *t; /* Temporary */ - - /* Set up globals required by merge() and pointer to head */ - - z = l->z; cmp = cmp_func; head = l->head; - - for (N = 1,a = z; a != head->next; N = N + N) { - todo = head->next; c = head; - while (todo != z) { - - /* Build first sublist to be merged, and splice from main list - */ - - a = t = todo; - for (i = 1; i < N; i++) t = t->next; - b = t->next; t->next = z; t = b; - - /* Build second sublist to be merged and splice from main list - */ - - for (i = 1; i < N; i++) t = t->next; - todo = t->next; t->next = z; - - /* Merge the two sublists created, and set 'c' to point to the - * end of the newly merged sublists. - */ - - c->next = merge(a,b,&t); c = t; - } - } - - /* Fix the previous pointers for the list */ - - a = b = l->head; - b = b->next; - while (1) { - b->prev = a; - if (b == z) - break; - a = a->next; - b = b->next; - } -} - diff --git a/dlist.h b/dlist.h deleted file mode 100644 index 7381bb6554..0000000000 --- a/dlist.h +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -* -* Copyright (C) 1991 Kendall Bennett. -* All rights reserved. -* -* Filename: $RCSfile$ -* Version: $Revision$ -* -* Language: ANSI C -* Environment: any -* -* Description: Header file for doubly linked list routines. -* -* $Id$ -* -* Revision History: -* ----------------- -* -* $Log$ -* Revision 1.1 1999/04/21 23:11:20 ssb -* moved apache, com and hyperwave into ext/ -* -* Revision 1.1.1.1 1999/04/07 21:03:20 zeev -* PHP 4.0 -* -* Revision 1.1.1.1 1999/03/17 04:29:11 andi -* PHP4 -* -* Revision 1.1.1.1 1998/12/21 07:56:22 andi -* Trying to start the zend CVS tree -* -* Revision 1.2 1998/08/14 15:51:12 shane -* Some work on getting hyperwave to work on windows. hg_comm needs a lot of work. -* -* Mainly, signals, fnctl, bzero, bcopy, etc are not portable functions. Most of this -* will have to be rewriten for windows. -* -* Revision 1.1 1998/08/12 09:29:16 steinm -* First version of Hyperwave module. -* -* Revision 1.5 91/12/31 19:40:54 kjb -* -* Modified include files directories. -* -* Revision 1.4 91/09/27 03:10:41 kjb -* Added compatibility with C++. -* -* Revision 1.3 91/09/26 10:07:16 kjb -* Took out extern references -* -* Revision 1.2 91/09/01 19:37:20 ROOT_DOS -* Changed DLST_TAIL macro so that it returns a pointer to the REAL last -* node of the list, not the dummy last node (l->z). -* -* Revision 1.1 91/09/01 18:38:23 ROOT_DOS -* Initial revision -* -****************************************************************************/ - -#ifndef __DLIST_H -#define __DLIST_H - -#ifndef __DEBUG_H -/*#include "debug.h"*/ -#endif - -/*---------------------- Macros and type definitions ----------------------*/ - -typedef struct PHP_DLST_BUCKET { - struct PHP_DLST_BUCKET *next; - struct PHP_DLST_BUCKET *prev; - } PHP_DLST_BUCKET; - -/* necessary for AIX 4.2.x */ - -#ifdef hz -#undef hz -#endif - -typedef struct { - int count; /* Number of elements currently in list */ - PHP_DLST_BUCKET *head; /* Pointer to head element of list */ - PHP_DLST_BUCKET *z; /* Pointer to last node of list */ - PHP_DLST_BUCKET hz[2]; /* Space for head and z nodes */ - } DLIST; - -/* Return a pointer to the user space given the address of the header of - * a node. - */ - -#define PHP_DLST_USERSPACE(h) ((void*)((PHP_DLST_BUCKET*)(h) + 1)) - -/* Return a pointer to the header of a node, given the address of the - * user space. - */ - -#define PHP_DLST_HEADER(n) ((PHP_DLST_BUCKET*)(n) - 1) - -/* Return a pointer to the user space of the list's head node. This user - * space does not actually exist, but it is useful to be able to address - * it to enable insertion at the start of the list. - */ - -#define PHP_DLST_HEAD(l) PHP_DLST_USERSPACE((l)->head) - -/* Return a pointer to the user space of the last node in list. */ - -#define PHP_DLST_TAIL(l) PHP_DLST_USERSPACE((l)->z->prev) - -/* Determine if a list is empty - */ - -#define PHP_DLST_EMPTY(l) ((l)->count == 0) - -/*-------------------------- Function Prototypes --------------------------*/ - -#ifdef __cplusplus -extern "C" { -#endif - -void *dlst_newnode(int size); -void dlst_freenode(void *node); -DLIST *dlst_init(void); -void dlst_kill(DLIST *l,void (*freeNode)(void *node)); -void dlst_insertafter(DLIST *l,void *node,void *after); -void *dlst_deletenext(DLIST *l,void *node); -void *dlst_first(DLIST *l); -void *dlst_last(DLIST *l); -void *dlst_next(void *prev); -void *dlst_prev(void *next); -void dlst_mergesort(DLIST *l,int (*cmp_func)(void*,void*)); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ext/Makefile.am b/ext/Makefile.am deleted file mode 100644 index 49372bc0d3..0000000000 --- a/ext/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SUBDIRS = @EXT_SUBDIRS@ - diff --git a/ext/apache/Makefile.am b/ext/apache/Makefile.am deleted file mode 100644 index 32b246cf00..0000000000 --- a/ext/apache/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_apache.la -libphpext_apache_la_SOURCES=apache.c - diff --git a/ext/apache/apache.c b/ext/apache/apache.c deleted file mode 100644 index cda5fab222..0000000000 --- a/ext/apache/apache.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | Stig Sæther Bakken | - | David Sklar | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -#include "php.h" -#include "ext/standard/head.h" -#include "php_globals.h" -#include "php_ini.h" -#include "SAPI.h" -#include "sapi/apache/mod_php4.h" -#include "ext/standard/info.h" - -#include -#if HAVE_UNISTD_H -#include -#endif -#include -#include -#include - -#if APACHE -#include "http_request.h" -#include "build-defs.h" - -#define SECTION(name) PUTS("

" name "

\n") - -extern module *top_module; - -PHP_FUNCTION(virtual); -PHP_FUNCTION(getallheaders); -PHP_FUNCTION(apachelog); -PHP_FUNCTION(apache_note); -PHP_FUNCTION(apache_lookup_uri); - -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) - {NULL, NULL, NULL} -}; - - -static PHP_INI_MH(OnChangeApacheInt) -{ - long *p; - char *base = (char *) &php_apache_info; - - p = (long *) (base+(size_t) mh_arg1); - - if (new_value) { - *p = atoi(new_value); - return SUCCESS; - } else { - return FAILURE; - } -} - - -static PHP_INI_MH(OnChangeApacheString) -{ - char **p; - char *base = (char *) &php_apache_info; - - p = (char **) (base+(size_t) mh_arg1); - - if (new_value) { - *p = new_value; - return SUCCESS; - } else { - return FAILURE; - } -} - -PHP_INI_BEGIN() - PHP_INI_ENTRY1("xbithack", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, xbithack)) - PHP_INI_ENTRY1("engine", "1", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, engine)) - PHP_INI_ENTRY1("last_modified", "0", PHP_INI_ALL, OnChangeApacheInt, (void *) XtOffsetOf(php_apache_info_struct, last_modified)) - PHP_INI_ENTRY1("dav_script", NULL, PHP_INI_ALL, OnChangeApacheString, (void *) XtOffsetOf(php_apache_info_struct, dav_script)) -PHP_INI_END() - - -static PHP_MINIT_FUNCTION(apache) -{ - REGISTER_INI_ENTRIES(); - return SUCCESS; -} - - -static PHP_MSHUTDOWN_FUNCTION(apache) -{ - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} - - -php3_module_entry apache_module_entry = { - "Apache", apache_functions, PHP_MINIT(apache), PHP_MSHUTDOWN(apache), NULL, NULL, PHP_MINFO(apache), STANDARD_MODULE_PROPERTIES -}; - -/* {{{ 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 || - getParametersEx(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(apache) -{ - module *modp = NULL; - char output_buf[128]; -#if !defined(WIN32) && !defined(WINNT) - char name[64]; - 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; - - PUTS("\n"); - php_info_print_table_header(2, "Entry", "Value"); -#if WIN32|WINNT - PUTS("Apache for Windows 95/NT
"); -#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
keep alive: %s
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
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); - - - PUTS("\n"); - PUTS("
Loaded modules"); - 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 */ - } - PUTS(name); - if (modp->next) { - PUTS(", "); - } - } -#endif - PUTS("
\n"); - - - { - 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"); - PUTS("\n"); - 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); - } - PUTS("
\n"); - } - - { - array_header *env_arr; - table_entry *env; - int i; - request_rec *r; - SLS_FETCH(); - - r = ((request_rec *) SG(server_context)); - SECTION("HTTP Headers Information"); - PUTS("\n"); - PUTS(" \n"); - 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); - } - } - PUTS(" \n"); - 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); - } - } - PUTS("
HTTP Request Headers
HTTP Response Headers
\n\n"); - } - -} - -/* This function is equivalent to - * 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 . This only works when PHP is compiled - * as an Apache module, since it uses the Apache API for doing - * sub requests. - */ -/* {{{ proto int virtual(string filename) - Perform an Apache sub-request */ -PHP_FUNCTION(virtual) -{ - pval **filename; - request_rec *rr = NULL; - SLS_FETCH(); - - if (ARG_COUNT(ht) != 1 || getParametersEx(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; - } - - /* Cannot include another PHP file because of global conflicts */ - if (rr->content_type && - !strcmp(rr->content_type, PHP3_MIME_TYPE)) { - php_error(E_WARNING, "Cannot include a PHP file " - "(use <?include \"%s\"> instead)", (*filename)->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } - - 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 || getParametersEx(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 || getParametersEx(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 - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/apache/config.m4 b/ext/apache/config.m4 deleted file mode 100644 index 88575c9e98..0000000000 --- a/ext/apache/config.m4 +++ /dev/null @@ -1,2 +0,0 @@ -dnl $Id$ - diff --git a/ext/aspell/Makefile.am b/ext/aspell/Makefile.am deleted file mode 100644 index 355308958b..0000000000 --- a/ext/aspell/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_aspell.la -libphpext_aspell_la_SOURCES=aspell.c - diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c deleted file mode 100644 index 69f8db3fcb..0000000000 --- a/ext/aspell/aspell.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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" -#if defined(COMPILE_DL) -#include "phpdl.h" -#endif -#include -#include -#include - -#if HAVE_ASPELL - -#include "php_aspell.h" -#if APACHE -# ifndef DEBUG -# undef palloc -# endif -#endif -#include - -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; - -php3_module_entry aspell_module_entry = { - "Aspell", aspell_functions, PHP_MINIT(aspell), NULL, NULL, NULL, PHP_MINFO(aspell), STANDARD_MODULE_PROPERTIES -}; - - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &aspell_module_entry; } -#endif - -PHP_MINIT_FUNCTION(aspell) -{ - le_aspell = register_list_destructors(php3_aspell_close,NULL); - return SUCCESS; - -} -void php3_aspell_close(aspell *sc) -{ - aspell_free(sc); -} - -/* {{{ 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 = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParametersEx(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 = php3_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 = ARG_COUNT(ht); - if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(scin); - convert_to_string_ex(word); - sc = (aspell *)php3_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 = ARG_COUNT(ht); - if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(scin); - convert_to_string_ex(word); - sc= (aspell *) php3_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 = ARG_COUNT(ht); - if (argc != 2 || getParametersEx(argc, &scin,&word) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long_ex(scin); - convert_to_string_ex(word); - sc = (aspell *)php3_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(aspell) -{ - php_printf("ASpell support enabled"); - -} - -#endif diff --git a/ext/aspell/config.h.stub b/ext/aspell/config.h.stub deleted file mode 100644 index 4be31d352a..0000000000 --- a/ext/aspell/config.h.stub +++ /dev/null @@ -1,4 +0,0 @@ -/* Define if you want the ASPELL interface */ -#ifndef HAVE_ASPELL -#define HAVE_ASPELL 0 -#endif diff --git a/ext/aspell/config.m4 b/ext/aspell/config.m4 deleted file mode 100644 index bfec9c4223..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 - - AC_ADD_INCLUDE($ASPELL_DIR/include) - AC_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) - AC_MSG_RESULT(yes) - PHP_EXTENSION(aspell) - else - AC_MSG_ERROR(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 d0c8b35a82..0000000000 --- a/ext/aspell/php_aspell.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _ASPELL_H -#define _ASPELL_H -#if HAVE_ASPELL -extern php3_module_entry aspell_module_entry; -#define aspell_module_ptr &aspell_module_entry - -extern PHP_MINIT_FUNCTION(aspell); -extern PHP_MINFO_FUNCTION(aspell); -extern void php3_aspell_close(); - -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 /* _ASPELL_H */ diff --git a/ext/bcmath/Makefile.am b/ext/bcmath/Makefile.am deleted file mode 100644 index e529f579ae..0000000000 --- a/ext/bcmath/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_bcmath.la -libphpext_bcmath_la_SOURCES=bcmath.c number.c diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c deleted file mode 100644 index e39f602445..0000000000 --- a/ext/bcmath/bcmath.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - +----------------------------------------------------------------------+ - */ - -#include "php.h" - -#if WITH_BCMATH - -#include "number.h" -#include "php_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} -}; - -php3_module_entry bcmath_module_entry = { - "bcmath", bcmath_functions, NULL, NULL, PHP_RINIT(bcmath), PHP_RSHUTDOWN(bcmath), NULL, STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -php3_module_entry *get_module() { return &bcmath_module_entry; }; -#endif - -#ifndef THREAD_SAFE -static long bc_precision; -#endif - -PHP_RINIT_FUNCTION(bcmath) -{ - init_numbers(); - if (cfg_get_long("bcmath.scale",&bc_precision)==FAILURE) { - bc_precision=0; - } - return SUCCESS; -} - -PHP_RSHUTDOWN_FUNCTION(bcmath) -{ - destruct_numbers(); - return SUCCESS; -} - -/* {{{ 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_add (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - free_num(&result); - return; -} -/* }}} */ - -/* {{{ proto string bcsub(string left_operand, string right_operand [, int scale]) - Returns the difference between two arbitrary precision numbers (subtration) */ -PHP_FUNCTION(bcsub) -{ - pval *left, *right,*scale_param; - bc_num first, second, result; - int scale=bc_precision; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_sub (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_multiply (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - switch (bc_divide (first,second,&result, scale)) { - case 0: /* OK */ - return_value->value.str.val = 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; - } - free_num(&first); - free_num(&second); - 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,0); - str2num(&second,right->value.str.val,0); - switch (bc_modulo(first,second,&result, 0)) { - case 0: - return_value->value.str.val = 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; - } - free_num(&first); - free_num(&second); - 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - init_num(&result); - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - bc_raise (first,second,&result, scale); - return_value->value.str.val = num2str(result); - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - free_num(&first); - free_num(&second); - 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 (ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &left) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &left, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - convert_to_string(left); - init_num(&result); - str2num(&result,left->value.str.val,scale); - if (bc_sqrt (&result, scale) != 0) { - return_value->value.str.val = 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"); - } - 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 (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &left, &right) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 3: - if (getParameters(ht, 3, &left, &right, &scale_param) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(scale_param); - scale = (int) scale_param->value.lval; - break; - default: - WRONG_PARAM_COUNT; - break; - } - - convert_to_string(left); - convert_to_string(right); - init_num(&first); - init_num(&second); - - str2num(&first,left->value.str.val,scale); - str2num(&second,right->value.str.val,scale); - return_value->value.lval = bc_compare(first,second); - return_value->type = IS_LONG; - - free_num(&first); - 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 (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_scale)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(new_scale); - bc_precision = new_scale->value.lval; - RETURN_TRUE; -} -/* }}} */ - - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/bcmath/config.h.stub b/ext/bcmath/config.h.stub deleted file mode 100644 index 6346c81f10..0000000000 --- a/ext/bcmath/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define if you want to enable bc style precision math support */ -#define WITH_BCMATH 0 diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4 deleted file mode 100644 index 960d3863f6..0000000000 --- a/ext/bcmath/config.m4 +++ /dev/null @@ -1,20 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to enable bc style precision math functions) -AC_ARG_ENABLE(bcmath, -[ --enable-bcmath Compile with bc style precision math functions. - Read README-BCMATH for instructions on how to - get this module installed. ], -[ - if test "$enableval" = "yes"; then - AC_DEFINE(WITH_BCMATH, 1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(bcmath) - else - AC_DEFINE(WITH_BCMATH, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(WITH_BCMATH, 0) - AC_MSG_RESULT(no) -]) diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h deleted file mode 100644 index 397ff03dd5..0000000000 --- a/ext/bcmath/php_bcmath.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Andi Gutmans | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP_BCMATH_H -#define _PHP_BCMATH_H - -#if COMPILE_DL -#undef WITH_BCMATH -#define WITH_BCMATH 1 -#endif - -#if WITH_BCMATH - -extern php3_module_entry bcmath_module_entry; -#define phpext_bcmath_ptr &bcmath_module_entry - -extern PHP_RINIT_FUNCTION(bcmath); -extern PHP_RSHUTDOWN_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/com/php_COM.h b/ext/com/php_COM.h deleted file mode 100644 index 64d9c16548..0000000000 --- a/ext/com/php_COM.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _PHP_COM_H -#define _PHP_COM_H - -#if WIN32|WINNT - -extern PHP_MINIT_FUNCTION(COM); -extern PHP_MSHUTDOWN_FUNCTION(COM); -PHP_FUNCTION(COM_load); -PHP_FUNCTION(COM_invoke); - -PHP_FUNCTION(com_propget); -PHP_FUNCTION(com_propput); -extern zend_module_entry COM_module_entry; -#define COM_module_ptr &COM_module_entry - -#else - -#define COM_module_ptr NULL - -#endif /* Win32|WINNT */ - -#define phpext_COM_ptr COM_module_ptr - -#endif /* _PHP_COM_H */ diff --git a/ext/cpdf/Makefile.am b/ext/cpdf/Makefile.am deleted file mode 100644 index 5118f95250..0000000000 --- a/ext/cpdf/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_cpdf.la -libphpext_cpdf_la_SOURCES=cpdf.c - diff --git a/ext/cpdf/config.h.stub b/ext/cpdf/config.h.stub deleted file mode 100644 index 26412fe3be..0000000000 --- a/ext/cpdf/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define if you have the zlib library */ -#define HAVE_CPDFLIB 0 diff --git a/ext/cpdf/config.m4 b/ext/cpdf/config.m4 deleted file mode 100644 index b3b52ea107..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(cpdflib) - AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB)], - [AC_MSG_ERROR(Cpdf module requires cpdflib >= 2.)]) - AC_ADD_LIBRARY(cpdf) - AC_ADD_LIBRARY(tiff) - AC_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)],) - AC_ADD_LIBRARY_WITH_PATH(jpeg, $withval/lib) - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-jpeg-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)],) - AC_ADD_LIBRARY_WITH_PATH(tiff, $withval/lib) - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-tiff-dir=) - ]) - withval=$old_withval - - LIBS="$LIBS -L$withval/lib" - AC_CHECK_LIB(cpdf, cpdf_open, [AC_DEFINE(HAVE_CPDFLIB)], - [AC_MSG_ERROR(Cpdflib module requires cpdflib >= 2.)]) - LIBS=$old_LIBS - AC_ADD_LIBRARY_WITH_PATH(cpdf, $withval/lib) - AC_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 cacb476ef5..0000000000 --- a/ext/cpdf/cpdf.c +++ /dev/null @@ -1,2563 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ - -/* $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 - -#include "php.h" -#include "php_globals.h" -#include -#if HAVE_LIBGD13 -#include -#endif - -#ifdef HAVE_UNISTD_H -# include -#endif -#if WIN32|WINNT -# include -# include -#endif - -#if HAVE_CPDFLIB -#include "php_cpdf.h" - -#ifdef THREAD_SAFE -DWORD CPDFlibTls; -static int numthreads=0; - -typedef struct cpdflib_global_struct{ - int le_cpdf; - int le_outline; -} 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; -#endif - -function_entry cpdf_functions[] = { - 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_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} -}; - -php3_module_entry cpdf_module_entry = { - "cpdf", cpdf_functions, PHP_MINIT(cpdf), PHP_MSHUTDOWN(cpdf), PHP_RINIT(cpdf), NULL, PHP_MINFO(cpdf), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -#include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &cpdf_module_entry; } -#endif - -static void _free_outline(CPDFoutlineEntry *outline) -{ -} - -static void _free_doc(CPDFdoc *pdf) -{ - cpdf_close(pdf); -} - -PHP_MINIT_FUNCTION(cpdf) -{ - CPDF_GLOBAL(le_outline) = register_list_destructors(_free_outline, NULL); - CPDF_GLOBAL(le_cpdf) = register_list_destructors(_free_doc, NULL); - 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 */ - php3_printf("Version %s", cpdf_version()); -} - -PHP_MSHUTDOWN_FUNCTION(cpdf){ - return SUCCESS; -} - -/* {{{ 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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if (!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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, int pagemode) - How to show the document by the viewer */ -PHP_FUNCTION(cpdf_set_viewer_preferences) { - pval *argv[6]; - int id, type, pagemode; - int argc; - CPDFdoc *pdf; - CPDF_TLS_VARS; - - argc = ARG_COUNT(ht); - if(argc < 1 || argc > 2) - WRONG_PARAM_COUNT; - if (getParametersArray(ht, argc, argv) == FAILURE) - WRONG_PARAM_COUNT; - - convert_to_long(argv[0]); - convert_to_long(argv[1]); - id=argv[0]->value.lval; - pagemode=argv[1]->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - -// cpdf_setViewerPreferences(pdf, pagemode, 0, 0, 0, 0, 0, 0, pagemode); - - 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, type, argc; - FILE *fp; - CPDFdoc *cpdf; - CPDF_TLS_VARS; - - argc = ARG_COUNT(ht); - 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) - php3_error(E_WARNING,"Writing to stdout as described in the ClibPDF manual is not possible if php3 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 = php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if(arg4->value.lval > 6) { - php3_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_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_long(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if(_php3_hash_num_elements(matrix) != 6) { - php3_error(E_WARNING,"Text matrix must have 6 elements"); - RETURN_FALSE; - } - - pdfmatrixptr = pdfmatrix; - _php3_hash_internal_pointer_reset(matrix); - for(i=0; i<_php3_hash_num_elements(matrix); i++) { - _php3_hash_get_current_data(matrix, (void *) &data); - switch(data->type) { - case IS_DOUBLE: - *pdfmatrixptr++ = (float) data->value.dval; - break; - default: - *pdfmatrixptr++ = 0.0; - break; - } - _php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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; - int flatness; - CPDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if((arg2->value.lval > 100) && (arg2->value.lval < 0)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_long(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if((arg2->value.lval > 2) && (arg2->value.lval < 0)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_long(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if((arg2->value.lval > 2) && (arg2->value.lval < 0)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - if(arg2->value.dval < 1) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - snprintf(buffer, BUFFERLEN, "[%d %d] 0", arg2->value.lval, 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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_double(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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; - pval out_arr; - int id, type, lenght; - CPDFdoc *pdf; - char *buffer; - CPDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - buffer = cpdf_getBufferForPDF(pdf, &lenght); - php3_header(); - php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - pdf = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - -#if APACHE - if(strcmp(arg2->value.str.val, "-") == 0) - php3_error(E_WARNING,"Writing to stdout as described in the ClibPDF manual is not possible if php3 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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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; - float width, height; - CPDFdoc *pdf; - unsigned char *buffer, *ptr; - gdImagePtr im; - CPDF_TLS_VARS; - - argc = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - gid=argv[1]->value.lval; - im = php3_list_find(gid, &type); - if (!im || type != phpi_get_le_gd()) { - php3_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; isy; i++) { - for(j=0; jsx; 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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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 = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_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, mode=0; - CPDFdoc *pdf; - CPDFoutlineEntry *lastoutline; - CPDF_TLS_VARS; - - argc = ARG_COUNT(ht); - 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 = php3_list_find(id,&type); - if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) { - php3_error(E_WARNING,"Unable to find identifier %d",id); - RETURN_FALSE; - } - - oid=argv[1]->value.lval; - lastoutline = php3_list_find(oid,&type); - if(!lastoutline || type!=CPDF_GLOBAL(le_outline)) { - lastoutline = NULL; -/* php3_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 = php3_list_insert(lastoutline,CPDF_GLOBAL(le_outline)); - RETURN_LONG(id); -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/cpdf/php_cpdf.h b/ext/cpdf/php_cpdf.h deleted file mode 100644 index 48823a9216..0000000000 --- a/ext/cpdf/php_cpdf.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifndef _PHP_CPDF_H -#define _PHP_CPDF_H - -#if HAVE_CPDFLIB - -#include - -extern php3_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_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_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 /* _PHP3_PDF_H */ diff --git a/ext/cybercash/Makefile.am b/ext/cybercash/Makefile.am deleted file mode 100644 index 486524e47c..0000000000 --- a/ext/cybercash/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -noinst_LTLIBRARIES=libphpext_cybercash.la -libphpext_cybercash_la_SOURCES=cybercash.c diff --git a/ext/cybercash/config.h.stub b/ext/cybercash/config.h.stub deleted file mode 100644 index fb5502d911..0000000000 --- a/ext/cybercash/config.h.stub +++ /dev/null @@ -1 +0,0 @@ -#define HAVE_MCK 0 diff --git a/ext/cybercash/config.m4 b/ext/cybercash/config.m4 deleted file mode 100644 index 648968b9e3..0000000000 --- a/ext/cybercash/config.m4 +++ /dev/null @@ -1,26 +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) - LIBS="$LIBS -L$MCK_DIR/lib" - AC_ADD_LIBRARY_WITH_PATH(mckcrypto, $MCK_DIR/lib) - AC_ADD_INCLUDE($MCK_DIR) - AC_DEFINE(HAVE_MCK) - else - AC_MSG_ERROR(Please reinstall the CyberCash MCK - I cannot find mckcrypt.h) - 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 9c5784886a..0000000000 --- a/ext/cybercash/cybercash.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Evan Klinger | - | Timothy Whitfield | - +----------------------------------------------------------------------+ - */ - -#include "php.h" - -#if HAVE_MCK -#include "cybercash.h" -#include "mckcrypt.h" -#include "base64.h" - -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) - {0} - }; - -zend_module_entry cybercash_module_entry = { - "CyberCash", - cybercash_functions, - NULL,NULL, - NULL,NULL, - NULL, - STANDARD_MODULE_PROPERTIES, -}; - -PHP_FUNCTION(cybercash_encr) -{ - pval **wmk, **sk, **inbuff; - unsigned char *outbuff, *macbuff; - unsigned int outAlloc, outLth; - long errcode; - - if(ARG_COUNT(ht) != 3 || getParametersEx(3,&wmk,&sk,&inbuff) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(wmk); - convert_to_string_ex(sk); - convert_to_string_ex(inbuff); - - outAlloc = (*inbuff)->value.str.len + 10; - - outbuff = (unsigned char *)emalloc(outAlloc); - macbuff = (unsigned char *)emalloc(20); - - errcode = mck_encr((*wmk)->value.str.val,(*sk)->value.str.val, - (*inbuff)->value.str.len+1, - (*inbuff)->value.str.val, - outAlloc, - outbuff, - &outLth, - macbuff); - - array_init(return_value); - - 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); - } -} - -PHP_FUNCTION(cybercash_decr) -{ - pval **wmk,**sk,**inbuff; - unsigned char *outbuff, *macbuff; - unsigned int outAlloc, outLth; - long errcode; - - - if(ARG_COUNT(ht) != 3 || getParametersEx(3,&wmk,&sk,&inbuff) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(wmk); - convert_to_string_ex(sk); - convert_to_string_ex(inbuff); - - outAlloc=(*inbuff)->value.str.len; - - outbuff=(unsigned char *)emalloc(outAlloc); - macbuff=(unsigned char *)emalloc(20); - - errcode=mck_decr((*wmk)->value.str.val, - (*sk)->value.str.val, - (*inbuff)->value.str.len, - (*inbuff)->value.str.val, - outAlloc, - outbuff, - &outLth, - macbuff); - - array_init(return_value); - - 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); - } -} - -PHP_FUNCTION(cybercash_base64_encode) -{ - pval **inbuff; - char *outbuff; - long ret_length; - - if(ARG_COUNT(ht) != 1 || - getParametersEx(1,&inbuff) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(inbuff); - - outbuff=(char *)emalloc( - base64_enc_size((unsigned int)(*inbuff)->value.str.len)); - - ret_length=base64_encode(outbuff, - (*inbuff)->value.str.val,(*inbuff)->value.str.len); - - return_value->value.str.val=outbuff; - return_value->value.str.len=ret_length; - return_value->type=IS_STRING; - -} - -PHP_FUNCTION(cybercash_base64_decode) -{ - pval **inbuff; - char *outbuff; - long ret_length; - - if(ARG_COUNT(ht) != 1 || - getParametersEx(1,&inbuff) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string_ex(inbuff); - - outbuff=(char *)emalloc( - base64_dec_size((unsigned int)(*inbuff)->value.str.len)); - - ret_length=base64_decode(outbuff, - (*inbuff)->value.str.val,(*inbuff)->value.str.len); - - return_value->value.str.val=outbuff; - return_value->value.str.len=ret_length; - return_value->type=IS_STRING; - -} -#endif diff --git a/ext/cybercash/cybercash.h b/ext/cybercash/cybercash.h deleted file mode 100644 index 27bba3edd1..0000000000 --- a/ext/cybercash/cybercash.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Evan Klinger | - +----------------------------------------------------------------------+ - */ - -#ifndef _CYBERCASH_H -#define _CYBERCASH_H - - -#if HAVE_MCK - -#if PHP_API_VERSION < 19990421 -#define zend_module_entry cybercash_module_entry -#include "modules.h" -#include "internal_functions.h" -#endif - -extern zend_module_entry cybercash_module_entry; -#define cybercash_module_ptr &cybercash_module_entry - -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 5625e92c3e..0000000000 --- a/ext/cybercash/cyberlib.php +++ /dev/null @@ -1,214 +0,0 @@ - * - * * - * PHP Cybercash API - This requires that CyberCash support be * - * compiled. * - * * - * * - * This is an attempt to duplicate the cybercash API for PHP3 * - * 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"],$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 @@ - "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."
"; - } - -?> diff --git a/ext/dav/Makefile.am b/ext/dav/Makefile.am deleted file mode 100644 index 63d0510a97..0000000000 --- a/ext/dav/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_dav.la -libphpext_dav_la_SOURCES=dav.c - diff --git a/ext/dav/config.h.stub b/ext/dav/config.h.stub deleted file mode 100644 index 90a0bc1de4..0000000000 --- a/ext/dav/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define to compile with mod_dav support */ -#define HAVE_MOD_DAV 0 diff --git a/ext/dav/config.m4 b/ext/dav/config.m4 deleted file mode 100644 index c2b83adbc7..0000000000 --- a/ext/dav/config.m4 +++ /dev/null @@ -1,29 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension dav -dnl don't forget to call PHP_EXTENSION(dav) - -AC_MSG_CHECKING(whether to enable DAV support through mod_dav) -AC_ARG_WITH(mod-dav, -[ --with-mod-dav=DIR Include DAV support through Apache's mod_dav, - DIR is mod_dav's installation directory (Apache - module version only!)], -[ - if test "$withval" = "yes"; then - AC_MSG_ERROR(Must give parameter to --with-mod-dav!) - else - if test "$withval" != "no"; then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MOD_DAV, 1) - CFLAGS="$CFLAGS -DHAVE_MOD_DAV -I$withval" - INCLUDES="$INCLUDES -I$withval" - PHP_EXTENSION(dav) - else - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_MOD_DAV, 0) - fi - fi -],[ - AC_MSG_RESULT(no) - AC_DEFINE(HAVE_MOD_DAV, 0) -]) - diff --git a/ext/dav/dav.c b/ext/dav/dav.c deleted file mode 100644 index 0f8cd56a7a..0000000000 --- a/ext/dav/dav.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#define IS_EXT_MODULE -#if COMPILE_DL -# if PHP_31 -# include "../phpdl.h" -# else -# include "dl/phpdl.h" -# endif -#endif -#include "php.h" -#include "php_dav.h" - -#if defined(THREAD_SAFE) && !PHP_31 -# undef THREAD_SAFE -#endif - -#if HAVE_MOD_DAV - -# include "mod_dav.h" -# include "phpdav.h" -# include "variables.h" - -/* {{{ thread safety stuff */ - -# ifdef THREAD_SAFE -# define DAV_GLOBAL(a) phpdav_globals->a -# define DAV_TLS_VARS phpdav_global_struct *phpdav_globals = TlsGetValue(PHPDAVTls); - -void *phpdav_mutex; -DWORD PHPDAVTls; -static int numthreads=0; - -typedef struct phpdav_global_struct { - phpdav_module php3_dav_module; -} phpdav_global_struct; - -# else /* !defined(THREAD_SAFE) */ -# define DAV_GLOBAL(a) a -# define DAV_TLS_VARS - -phpdav_module php3_dav_module; - -# endif /* defined(THREAD_SAFE) */ - -# define DAV_HANDLER(a) DAV_GLOBAL(php3_dav_module).a##_handler -# define DAV_SET_HANDLER(a,b) \ - dav_set_handler(&DAV_GLOBAL(php3_dav_module).a##_handler,(b)) - - -/* }}} */ -/* {{{ dynamically loadable module stuff */ - -# if COMPILE_DL -DLEXPORT php3_module_entry *get_module() { return &phpdav_module_entry; }; -# endif /* COMPILE_DL */ - -/* }}} */ -/* {{{ function prototypes */ - -int php3_minit_phpdav(INIT_FUNC_ARGS); -int php3_rinit_phpdav(INIT_FUNC_ARGS); -int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS); -int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS); -void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS); - -/* }}} */ -/* {{{ extension definition structures */ - -function_entry phpdav_functions[] = { - PHP_FE(dav_set_mkcol_handlers, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry phpdav_module_entry = { - "DAV", /* extension name */ - phpdav_functions, /* extension function list */ - php3_minit_phpdav, /* extension-wide startup function */ - php3_mshutdown_phpdav, /* extension-wide shutdown function */ - php3_rinit_phpdav, /* per-request startup function */ - php3_rshutdown_phpdav, /* per-request shutdown function */ - php3_info_phpdav, /* information function */ - STANDARD_MODULE_PROPERTIES -}; - -/* }}} */ -/* {{{ startup, shutdown and info functions */ - - /* {{{ php3_minit_phpdav */ - -int php3_minit_phpdav(INIT_FUNC_ARGS) -{ -#if defined(THREAD_SAFE) - phpdav_global_struct *phpdav_globals; - PHP3_MUTEX_ALLOC(phpdav_mutex); - PHP3_MUTEX_LOCK(phpdav_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(PHPDAVTls)){ - PHP3_MUTEX_UNLOCK(phpdav_mutex); - PHP3_MUTEX_FREE(phpdav_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(phdpav_mutex); - if(!PHP3_TLS_THREAD_INIT(PHPDAVTls,phpdav_globals,phpdav_global_struct)){ - PHP3_MUTEX_FREE(phpdav_mutex); - return FAILURE; - } -#endif - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_rinit_phpdav */ - -int php3_rinit_phpdav(INIT_FUNC_ARGS) -{ - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_mshutdown_phpdav() */ - -int php3_mshutdown_phpdav(SHUTDOWN_FUNC_ARGS) -{ - DAV_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(phpdav_globals); - PHP3_MUTEX_LOCK(phpdav_mutex); - numthreads--; - if (numthreads < 1) { - PHP3_TLS_PROC_SHUTDOWN(PHPDAVTls); - PHP3_MUTEX_UNLOCK(phpdav_mutex); - PHP3_MUTEX_FREE(phpdav_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(phpdav_mutex); -#endif - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_rshutdown_phpdav() */ - -int php3_rshutdown_phpdav(SHUTDOWN_FUNC_ARGS) -{ - if (DAV_HANDLER(mkcol_test)) { - efree(DAV_HANDLER(mkcol_test)); - } - if (DAV_HANDLER(mkcol_create)) { - efree(DAV_HANDLER(mkcol_create)); - } - return SUCCESS; -} - -/* }}} */ - /* {{{ php3_info_phpdav() */ - -void php3_info_phpdav(ZEND_MODULE_INFO_FUNC_ARGS) -{ -} - -/* }}} */ - -/* }}} */ -/* {{{ extension-internal functions */ - - /* {{{ dav_set_handler() */ - -static void -dav_set_handler(char **nameBufp, pval *data) -{ - if (data->value.str.len > 0) { - if (*nameBufp != NULL) { - efree(*nameBufp); - } - *nameBufp = php3i_pval_strdup(data); - } else { - if (*nameBufp != NULL) { - efree(*nameBufp); - } - *nameBufp = NULL; - } -} - -/* }}} */ - /* {{{ dav_call_handler() */ - -static int -dav_call_handler(char *funcName, int argc, pval **argv) -{ - if (funcName) { - pval *retval, *func; - int i, ret; - HashTable *function_table; - - func = php3i_string_pval(funcName); - retval = emalloc(sizeof(pval)); - function_table = php3i_get_function_table(); - if (call_user_function(function_table, NULL, func, retval, argc, argv) == FAILURE) { - php3tls_pval_destructor(retval); - efree(retval); - return HTTP_INTERNAL_SERVER_ERROR; - } - php3tls_pval_destructor(func); - efree(func); - for (i = 0; i < argc; i++) { - php3tls_pval_destructor(argv[i]); - efree(argv[i]); - } - convert_to_long(retval); - ret = retval->value.lval; - efree(retval); - return ret; - } - return DECLINED; -} - -/* }}} */ - -int phpdav_mkcol_test_handler(request_rec *r) -{ - pval *arg; - - if (DAV_HANDLER(mkcol_test) == NULL) { - return DECLINED; - } - arg = php3i_string_pval(r->filename); - return dav_call_handler(DAV_HANDLER(mkcol_test), 1, &arg); -} - -int phpdav_mkcol_create_handler(request_rec *r) -{ - pval *arg; - - if (DAV_HANDLER(mkcol_create) == NULL) { - return DECLINED; - } - arg = php3i_string_pval(r->filename); - return dav_call_handler(DAV_HANDLER(mkcol_create), 1, &arg); -} - -/* }}} */ - -/************************* EXTENSION FUNCTIONS *************************/ - -/* {{{ proto void dav_set_mkcol_handlers(string test, string create) - Sets the function to test whether a DAV collection exists for MKCOL */ -PHP_FUNCTION(dav_set_mkcol_handlers) -{ - pval *test, *create; - DAV_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &test, &create) == FAILURE) { - WRONG_PARAM_COUNT; - } - DAV_SET_HANDLER(mkcol_test, test); - DAV_SET_HANDLER(mkcol_create, create); - RETVAL_TRUE; -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/dav/php_dav.h b/ext/dav/php_dav.h deleted file mode 100644 index b1ab062de1..0000000000 --- a/ext/dav/php_dav.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Stig Sæther Bakken | - +----------------------------------------------------------------------+ - */ - -/* $Id */ - -#ifndef _PHP_DAV_H -# define _PHP_DAV_H - -# if HAVE_MOD_DAV - -typedef struct { - int foo; - char *mkcol_test_handler; - char *mkcol_create_handler; -} phpdav_module; - -extern php3_module_entry phpdav_module_entry; -# define phpdav_module_ptr &phpdav_module_entry - -int phpdav_mkcol_test_handler(request_rec *); - -PHP_FUNCTION(dav_set_mkcol_handlers); - -# else /* !HAVE_MOD_DAV */ - -# define phpdav_module_ptr NULL - -# endif /* HAVE_MOD_DAV */ - -#define phpext_dav_ptr phpdav_module_ptr - -#endif /* _PHP_DAV_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/dav/setup.stub b/ext/dav/setup.stub deleted file mode 100644 index 881144c1ca..0000000000 --- a/ext/dav/setup.stub +++ /dev/null @@ -1,2 +0,0 @@ -# $Id$ -# This extension is still very much under construction. diff --git a/ext/db/Makefile.am b/ext/db/Makefile.am deleted file mode 100644 index 7dc6e32d07..0000000000 --- a/ext/db/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_db.la -libphpext_db_la_SOURCES=db.c - diff --git a/ext/db/config.h.stub b/ext/db/config.h.stub deleted file mode 100644 index e952d61fac..0000000000 --- a/ext/db/config.h.stub +++ /dev/null @@ -1,5 +0,0 @@ -/* Define if you have an ndbm compatible library (-ldbm). */ -#define NDBM 0 - -/* Define if you have the gdbm library (-lgdbm). */ -#define GDBM 0 diff --git a/ext/db/config.m4 b/ext/db/config.m4 deleted file mode 100644 index 319174dd51..0000000000 --- a/ext/db/config.m4 +++ /dev/null @@ -1,55 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension db -dnl don't forget to call PHP_EXTENSION(db) - -divert(1) - -AC_CHECK_HEADERS(db1/ndbm.h) - -# 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) DBM_TYPE=gdbm; DBM_LIB=-lgdbm], - [AC_CHECK_LIB(db, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldb], - [AC_CHECK_LIB(c, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=], - [AC_CHECK_LIB(dbm, dbm_open,[AC_DEFINE(NDBM) DBM_TYPE=ndbm; DBM_LIB=-ldbm], - [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 - AC_SUBST(DBM_LIB) - AC_SUBST(DBM_TYPE) -]) - -AC_PREFERRED_DB_LIB - -divert(3) - -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) - diff --git a/ext/db/db.c b/ext/db/db.c deleted file mode 100644 index c26d3aef57..0000000000 --- a/ext/db/db.c +++ /dev/null @@ -1,1162 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ -#define IS_EXT_MODULE -#if COMPILE_DL -# include "dl/phpdl.h" -#endif - -#if 1 - -#include "php.h" -#include "php_globals.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include "ext/standard/flock_compat.h" - -#include -#include -#include -#if HAVE_UNISTD_H -#include -#endif - -#ifdef PHP_31 -#include "os/nt/flock.h" -#else -#if WIN32|WINNT -#include "win32/flock.h" -#else -#include -#endif -#endif - -#if HAVE_FCNTL_H -#include -#endif - -#if GDBM -#include - -#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 -#else -#ifdef HAVE_DB1_NDBM_H -#include -#else -#include -#endif -#endif - -#define DBM_TYPE DBM * -#define DBM_MODE_TYPE int -#define DBM_WRITE_MODE O_RDWR -#define DBM_CREATE_MODE O_RDWR | O_APPEND | 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) _php3_dbm_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) - -static int _php3_dbm_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) 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" - -#if THREAD_SAFE -DWORD DbmTls; -static int numthreads=0; - -typedef struct dbm_global_struct{ - int le_db; -}dbm_global_struct; - -#define DBM_GLOBAL(a) dbm_globals->a -#define DBM_TLS_VARS dbm_global_struct *dbm_globals = TlsGetValue(DbmTls); - -#else -static int le_db; -#define DBM_GLOBAL(a) a -#define DBM_TLS_VARS -#endif - -/*needed for blocking calls in windows*/ -void *dbm_mutex; - -dbm_info *_php3_finddbm(pval *id,HashTable *list) -{ - list_entry *le; - dbm_info *info; - int numitems, i; - int info_type; - DBM_TLS_VARS; - - if (id->type == IS_STRING) { - numitems = zend_hash_num_elements(list); - for (i=1; i<=numitems; i++) { - if (zend_hash_index_find(list, i, (void **) &le)==FAILURE) { - continue; - } - if (le->type == DBM_GLOBAL(le_db)) { - info = (dbm_info *)(le->ptr); - if (!strcmp(info->filename, id->value.str.val)) { - return (dbm_info *)(le->ptr); - } - } - } - } - - /* didn't find it as a database filename, try as a number */ - convert_to_long(id); - info = php3_list_find(id->value.lval, &info_type); - if (info_type != DBM_GLOBAL(le_db)) - return NULL; - return info; -} - -static char *php3_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(db) -{ - php_printf(php3_get_info_db()); -} - -PHP_FUNCTION(dblist) -{ - char *str = php3_get_info_db(); - RETURN_STRING(str,1); -} - - -PHP_FUNCTION(dbmopen) { - pval *filename, *mode; - dbm_info *info=NULL; - int ret; - DBM_TLS_VARS; - - if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&mode)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(filename); - convert_to_string(mode); - - info = _php3_dbmopen(filename->value.str.val, mode->value.str.val); - if (info) { - ret = php3_list_insert(info, DBM_GLOBAL(le_db)); - RETURN_LONG(ret); - } else { - RETURN_FALSE; - } -} - -dbm_info *_php3_dbmopen(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 _php3_dbmopen()"); - return NULL; - } - - if (PG(safe_mode) && (!_php3_checkuid(filename, 2))) { - return NULL; - } - - if (_php3_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 = stat(lockfn,&sb))==0) { - retries++; - 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 = 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 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 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) { - unlink(lockfn); - } -#endif - if (lockfn) efree(lockfn); - } - - return NULL; -} - -PHP_FUNCTION(dbmclose) { - pval *id; - - if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(id); - - if (php3_list_delete(id->value.lval) == SUCCESS) { - RETURN_TRUE; - } else { - RETURN_FALSE; - } -} - -int _php3_dbmclose(dbm_info *info) { - int ret = 0; - DBM_TYPE dbf; - int lockfd; - - dbf = info->dbf; - -#if NFS_HACK - unlink(info->lockfn); -#else - if (info->lockfn) { - lockfd = 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 - */ -PHP_FUNCTION(dbminsert) -{ - pval *id, *key, *value; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=3||getParameters(ht,3,&id,&key,&value) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - convert_to_string(value); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbminsert(info, key->value.str.val, value->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbminsert(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); -} - -PHP_FUNCTION(dbmreplace) -{ - pval *id, *key, *value; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=3||getParameters(ht,3,&id,&key,&value) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - convert_to_string(value); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmreplace(info, key->value.str.val, value->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmreplace(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); -} - -PHP_FUNCTION(dbmfetch) -{ - pval *id, *key; - dbm_info *info; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - return_value->value.str.val = _php3_dbmfetch(info, key->value.str.val); - if (return_value->value.str.val) { - return_value->value.str.len = strlen(return_value->value.str.val); - return_value->type = IS_STRING; - } else { - RETURN_FALSE; - } -} - -char *_php3_dbmfetch(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); -} - - -PHP_FUNCTION(dbmexists) -{ - pval *id, *key; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmexists(info, key->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmexists(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); -} - -PHP_FUNCTION(dbmdelete) -{ - pval *id, *key; - dbm_info *info; - int ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmdelete(info, key->value.str.val); - RETURN_LONG(ret); -} - -int _php3_dbmdelete(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); -} - -PHP_FUNCTION(dbmfirstkey) -{ - pval *id; - dbm_info *info; - char *ret; - - if (ARG_COUNT(ht)!=1||getParameters(ht,1,&id)==FAILURE) { - WRONG_PARAM_COUNT; - } - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmfirstkey(info); - if (!ret) { - RETURN_FALSE; - } else { - return_value->value.str.val = ret; - return_value->value.str.len = strlen(ret); - return_value->type = IS_STRING; - } -} - -char *_php3_dbmfirstkey(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); -} - -PHP_FUNCTION(dbmnextkey) -{ - pval *id, *key; - dbm_info *info; - char *ret; - - if (ARG_COUNT(ht)!=2||getParameters(ht,2,&id,&key)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(key); - - info = _php3_finddbm(id,list); - if (!info) { - php_error(E_WARNING, "not a valid database identifier %d", id->value.lval); - RETURN_FALSE; - } - - ret = _php3_dbmnextkey(info, key->value.str.val); - if (!ret) { - RETURN_FALSE; - } else { - return_value->value.str.val = ret; - return_value->value.str.len = strlen(ret); - return_value->type = IS_STRING; - } -} - -char *_php3_dbmnextkey(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; - -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; -} - -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; -} - -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; -} - -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); -} - -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); -} - -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(db) -{ -#if defined(THREAD_SAFE) - dbm_global_struct *dbm_globals; - PHP3_MUTEX_ALLOC(dbm_mutex); - PHP3_MUTEX_LOCK(dbm_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(DbmTls)){ - PHP3_MUTEX_UNLOCK(dbm_mutex); - PHP3_MUTEX_FREE(dbm_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(dbm_mutex); - if(!PHP3_TLS_THREAD_INIT(DbmTls,dbm_globals,dbm_global_struct)){ - PHP3_MUTEX_FREE(dbm_mutex); - return FAILURE; - } -#endif - - DBM_GLOBAL(le_db) = register_list_destructors(_php3_dbmclose,NULL); - return SUCCESS; -} - -static PHP_MSHUTDOWN_FUNCTION(db) -{ - DBM_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(dbm_globals); - PHP3_MUTEX_LOCK(dbm_mutex); - numthreads--; - if (numthreads<1) { - PHP3_TLS_PROC_SHUTDOWN(DbmTls); - PHP3_MUTEX_UNLOCK(dbm_mutex); - PHP3_MUTEX_FREE(dbm_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(dbm_mutex); -#endif - return SUCCESS; -} - -PHP_RINIT_FUNCTION(db) -{ -#if !GDBM && !NDBM - CurrentFlatFilePos = 0L; -#endif - return SUCCESS; -} - - -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} -}; - -php3_module_entry dbm_module_entry = { - "DBM", dbm_functions, PHP_MINIT(db), PHP_MSHUTDOWN(db), PHP_RINIT(db), NULL, PHP_MINFO(db), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &dbm_module_entry; } -#endif - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/db/php_db.h b/ext/db/php_db.h deleted file mode 100644 index 30c8f809a3..0000000000 --- a/ext/db/php_db.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - - -#ifndef _PHP_DB_H -#define _PHP_DB_H - - -#ifndef DLEXPORT -#define DLEXPORT -#endif - - -extern php3_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(MSVC5) && !defined(COMPILE_DL) -#undef phpext_db_ptr -#define phpext_db_ptr NULL -#endif - -dbm_info *_php3_finddbm(pval *id,HashTable *list); -int _php3_dbmclose(dbm_info *info); -dbm_info *_php3_dbmopen(char *filename, char *mode); -int _php3_dbminsert(dbm_info *info, char *key, char *value); -char *_php3_dbmfetch(dbm_info *info, char *key); -int _php3_dbmreplace(dbm_info *info, char *key, char *value); -int _php3_dbmexists(dbm_info *info, char *key); -int _php3_dbmdelete(dbm_info *info, char *key); -char *_php3_dbmfirstkey(dbm_info *info); -char *_php3_dbmnextkey(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); - -#undef phpext_db_ptr -#define phpext_db_ptr NULL - -#endif /* _PHP_DB_H */ diff --git a/ext/dba/Makefile.am b/ext/dba/Makefile.am deleted file mode 100644 index 2ab929391e..0000000000 --- a/ext/dba/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_dba.la -libphpext_dba_la_SOURCES=dba.c dba_cdb.c dba_db2.c dba_dbm.c dba_gdbm.c \ - dba_ndbm.c dba_db3.c - diff --git a/ext/dba/config.h.stub b/ext/dba/config.h.stub deleted file mode 100644 index df25632a4b..0000000000 --- a/ext/dba/config.h.stub +++ /dev/null @@ -1,19 +0,0 @@ -/* define if you want to use the dba extension */ - -#define NDBM_DB1_NDBM_H 0 -#define NDBM_NDBM_H 0 -#define DB2_DB2_DB_H 0 -#define DB2_DB_DB2_H 0 -#define DB2_DB_H 0 -#define DB2_DB2_H 0 -#define DB3_DB_H 0 -#define HAVE_DBA 0 -#define DBA_GDBM 0 -#define DBA_NDBM 0 -#define DBA_DBOPEN 0 -#define DBA_DB2 0 -#define DBA_DB3 0 -#define DBA_DBM 0 -#define DBA_CDB 0 - - diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 deleted file mode 100644 index 7ddcd8eb3b..0000000000 --- a/ext/dba/config.m4 +++ /dev/null @@ -1,238 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension dba -dnl don't forget to call PHP_EXTENSION(dba) - -AC_DEFUN(AC_TEMP_LDFLAGS,[ - old_LDFLAGS="$LDFLAGS" - LDFLAGS="$1 $LDFLAGS" - $2 - LDFLAGS="$old_LDFLAGS" -]) - - -dnl Assign INCLUDE/LFLAGS from PREFIX -AC_DEFUN(AC_DBA_STD_ASSIGN,[ - if test "$THIS_PREFIX" != "" -a "$THIS_PREFIX" != "/usr"; then - THIS_INCLUDE="$THIS_PREFIX/include" - THIS_LFLAGS="$THIS_PREFIX/lib" - fi -]) - -dnl Standard check -AC_DEFUN(AC_DBA_STD_CHECK,[ - THIS_RESULT="yes" - if test "$THIS_PREFIX" != "/usr"; then - if test "$THIS_INCLUDE" = "" ; then - AC_MSG_ERROR(cannot find necessary header file(s)) - elif test "$THIS_LIBS" = "" ; then - AC_MSG_ERROR(cannot find necessary library) - fi - fi -]) - -dnl Attach THIS_x to DBA_x -AC_DEFUN(AC_DBA_STD_ATTACH,[ - AC_ADD_INCLUDE($THIS_INCLUDE) - AC_ADD_LIBRARY_WITH_PATH($THIS_LIBS, $THIS_LFLAGS) - - 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 - THIS_RESULT="" -]) - - - -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 - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB(gdbm, gdbm_open, [AC_DEFINE(DBA_GDBM, 1) THIS_LIBS="gdbm"]) - ]) - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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="NDBM_DB1_NDBM_H" - elif test -f "$i/include/ndbm.h" ; then - THIS_PREFIX="$i" - NDBM_EXTRA="NDBM_NDBM_H" - fi - done - - if test "$NDBM_EXTRA" != ""; then - eval "AC_DEFINE($NDBM_EXTRA, 1)" - fi - - for LIB in db1 ndbm c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbm_open, [AC_DEFINE(DBA_NDBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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_DB2_DB_H" - elif test -f "$i/include/db/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_DB2_H" - elif test -f "$i/include/db2.h"; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB2_H" - elif test -f "$i/include/db.h" ; then - THIS_PREFIX="$i" - DB2_EXTRA="DB2_DB_H" - fi - done - - if test "$DB2_EXTRA" = "db2" ; then - DBA_INCLUDE="$DBA_INCLUDE -I$THIS_PREFIX/db2" - DB2_EXTRA="DB2_DB_H" - fi - - if test -n "$DB2_EXTRA"; then - eval "AC_DEFINE($DB2_EXTRA, 1)" - fi - - for LIB in db db2 c; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, db_appinit, [AC_DEFINE(DBA_DB2,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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 $withval; do - if test -f "$i/include/db.h" ; then - THIS_PREFIX="$i" - DB3_EXTRA="DB3_DB_H" - fi - done - - if test -n "$DB3_EXTRA"; then - eval "AC_DEFINE($DB3_EXTRA, 1)" - fi - - for LIB in db; do - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, db_create, [AC_DEFINE(DBA_DB3,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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 - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, dbminit, [AC_DEFINE(DBA_DBM,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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 - AC_TEMP_LDFLAGS(-L$THIS_PREFIX/lib,[ - AC_CHECK_LIB($LIB, cdb_bread, [AC_DEFINE(DBA_CDB,1) THIS_LIBS="$LIB"]) - ]) - done - - AC_DBA_STD_ASSIGN - AC_DBA_STD_CHECK - AC_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) -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 468d29d0ce..0000000000 --- a/ext/dba/dba.c +++ /dev/null @@ -1,483 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_DBA - -#include "php_dba.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" - -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); - -php3_module_entry dba_module_entry = { - "DataBase API", dba_functions, - PHP_MINIT(dba), - PHP_MSHUTDOWN(dba), - NULL, NULL, - PHP_MINFO(dba), - STANDARD_MODULE_PROPERTIES -}; - -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 = ARG_COUNT(ht) - -/* these are used to get the standard arguments */ - -#define DBA_GET1 \ - if(ac != 1 || getParametersEx(ac, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } - -#define DBA_GET2 \ - pval **key; \ - if(ac != 2 || getParametersEx(ac, &key, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } \ - convert_to_string_ex(key) - -#define DBA_IF_NOT_CORRECT_TYPE(link_id) \ - info = php3_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((*id)->value.lval) { \ - php_error(E_WARNING, "Unable to find DBA identifier %d", \ - (*id)->value.lval); \ - 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; -/* }}} */ - -/* {{{ helper routines */ - /* {{{ dba_close */ - -static void dba_close(dba_info *info) -{ - if(info->hnd) info->hnd->close(info); - if(info->path) free(info->path); - free(info); -} -/* }}} */ - /* {{{ php3_minit_dba */ - -static PHP_MINIT_FUNCTION(dba) -{ - zend_hash_init(&ht_keys, 0, NULL, NULL, 1); - GLOBAL(le_db) = register_list_destructors(dba_close, NULL); - GLOBAL(le_pdb) = register_list_destructors(NULL, dba_close); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_mshutdown_dba */ - -static PHP_MSHUTDOWN_FUNCTION(dba) -{ - zend_hash_destroy(&ht_keys); - return SUCCESS; -} -/* }}} */ - /* {{{ php3_info_dba */ - -static PHP_MINFO_FUNCTION(dba) -{ - dba_handler *hptr; - - PUTS("V1 ($Id$)"); - for(hptr = handler; hptr->name; hptr++) { - PUTS(" "); - PUTS(hptr->name); - } -} -/* }}} */ - /* {{{ _php3_dba_update */ - -static void _php3_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) -{ - DBA_ID_PARS; - pval **val, **key; - - if(ac != 3 || getParametersEx(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; -} -/* }}} */ - /* {{{ _php3_dba_open */ - -#define FREENOW if(args) efree(args); if(key) efree(key) - -static void _php3_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) -{ - pval ***args = (pval ***) NULL; - int ac = ARG_COUNT(ht); - 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(getParametersArrayEx(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 += (*args[i])->value.str.len; - } - - if(persistent) { - /* calculate hash */ - key = emalloc(keylen); - keylen = 0; - - for(i = 0; i < ac; i++) { - memcpy(key+keylen,(*args[i])->value.str.val,(*args[i])->value.str.len); - keylen += (*args[i])->value.str.len; - } - - if(zend_hash_find(&ht_keys, key, keylen, (void **) &info) == SUCCESS) { - FREENOW; - RETURN_LONG(php3_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 = php3_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[, ...]) - opens path using the specified handler in mode persistently */ -PHP_FUNCTION(dba_popen) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* {{{ proto int dba_open(string path, string mode, string handlername[, ...]) - opens path using the specified handler in mode*/ -PHP_FUNCTION(dba_open) -{ - _php3_dba_open(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto void dba_close(int handle) - closes database */ -PHP_FUNCTION(dba_close) -{ - DBA_ID_GET1; - - php3_list_delete((*id)->value.lval); -} -/* }}} */ - -/* {{{ 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) -{ - _php3_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) -{ - _php3_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 diff --git a/ext/dba/dba_cdb.c b/ext/dba/dba_cdb.c deleted file mode 100644 index fa38de931b..0000000000 --- a/ext/dba/dba_cdb.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_CDB -#include "php_cdb.h" - -#include -#include -#include - -#include -#include - -#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 = 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 diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c deleted file mode 100644 index b662a644aa..0000000000 --- a/ext/dba/dba_db2.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DB2 -#include "php_db2.h" -#include - -#include -#if DB2_DB2_DB_H -#include -#elif DB2_DB_DB2_H -#include -#elif DB2_DB2_H -#include -#elif DB2_DB_H -#include -#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 : - 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 diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c deleted file mode 100644 index 38a2065537..0000000000 --- a/ext/dba/dba_db3.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DB3 -#include "php_db3.h" -#include - -#include -#if DB3_DB3_DB_H -#include -#elif DB3_DB_DB3_H -#include -#elif DB3_DB3_H -#include -#elif DB3_DB_H -#include -#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 : - 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 diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c deleted file mode 100644 index 0fab79f002..0000000000 --- a/ext/dba/dba_dbm.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_DBM -#include "php_dbm.h" - -#include - -#include -#include -#include -#include - -#define DBM_DATA dba_dbm_data *dba = info->dbf -#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen - -#ifndef PATH_MAX -#define PATH_MAX 255 -#endif - -#define TRUNC_IT(extension, mode) \ - snprintf(buf, PATH_MAX, "%s" extension, info->path); \ - buf[PATH_MAX] = '\0'; \ - if((fd = 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[PATH_MAX + 1]; - - /* dbm/ndbm original */ - TRUNC_IT(".pag", O_TRUNC); - TRUNC_IT(".dir", O_TRUNC); - } - - if(info->mode == DBA_CREAT) { - char buf[PATH_MAX + 1]; - - 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 diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c deleted file mode 100644 index fd345997d9..0000000000 --- a/ext/dba/dba_gdbm.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_GDBM -#include "php_gdbm.h" - -#include - -#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 diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c deleted file mode 100644 index 974794701f..0000000000 --- a/ext/dba/dba_ndbm.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if DBA_NDBM -#include "php_ndbm.h" - -#include - -#if NDBM_DB1_NDBM_H -#include -#elif NDBM_NDBM_H -#include -#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 diff --git a/ext/dba/php_cdb.h b/ext/dba/php_cdb.h deleted file mode 100644 index 5574038991..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 d88582f1eb..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 126afe98a6..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 4a1470c503..0000000000 --- a/ext/dba/php_dba.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: Sascha Schumann | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _DBA_H -#define _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 php3_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) (*p)->value.str.val, (*p)->value.str.len - -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 e99b8cc3a0..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 0ee6e612e7..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 798916b6c7..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/Makefile.am b/ext/dbase/Makefile.am deleted file mode 100644 index 0805cabe74..0000000000 --- a/ext/dbase/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -## Process this file with automake to produce Makefile.in -*- makefile -*- -noinst_LTLIBRARIES=libphpext_dbase.la -libphpext_dbase_la_SOURCES=dbf_head.c dbf_rec.c dbf_misc.c dbf_ndx.c dbase.c - diff --git a/ext/dbase/config.h.stub b/ext/dbase/config.h.stub deleted file mode 100644 index c8bf0adbe2..0000000000 --- a/ext/dbase/config.h.stub +++ /dev/null @@ -1,3 +0,0 @@ -/* Define if you want to use the supplied dbase library */ -#define DBASE 0 - diff --git a/ext/dbase/config.m4 b/ext/dbase/config.m4 deleted file mode 100644 index 29f54923bf..0000000000 --- a/ext/dbase/config.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to include the bundled dbase library) -AC_ARG_WITH(dbase, -[ --with-dbase Include the bundled dbase library], -[ - if test "$withval" = "yes"; then - AC_MSG_RESULT(yes) - AC_DEFINE(DBASE,1) - PHP_EXTENSION(dbase) - else - AC_MSG_RESULT(no) - AC_DEFINE(DBASE,0) - DBASE_LIB= - fi -],[ - AC_MSG_RESULT(no) - AC_DEFINE(DBASE,0) - DBASE_LIB= -]) -AC_SUBST(DBASE_LIB) diff --git a/ext/dbase/dbase.c b/ext/dbase/dbase.c deleted file mode 100644 index 475e20a3b8..0000000000 --- a/ext/dbase/dbase.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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) | - +----------------------------------------------------------------------+ - */ -#if defined(COMPILE_DL) -#include "dl/phpdl.h" -#endif - -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include "php.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include "php_globals.h" - -#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 -#include - - -static void _close_dbase(dbhead_t *dbhead) -{ - close(dbhead->db_fd); - free_dbf_head(dbhead); -} - - -PHP_MINIT_FUNCTION(dbase) -{ -#if defined(THREAD_SAFE) - dbase_global_struct *dbase_globals; -#if !defined(COMPILE_DL) - 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) = register_list_destructors(_close_dbase,NULL); - 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); -#if !defined(COMPILE_DL) - 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 (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbf_name,&options)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(dbf_name); - convert_to_long(options); - - if (PG(safe_mode) && (!_php3_checkuid(dbf_name->value.str.val, 2))) { - RETURN_FALSE; - } - - if (_php3_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 = php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_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; - } - - php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_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 (ARG_COUNT(ht) != 1 || getParameters(ht,1,&dbh_id)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - dbh = php3_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 (ARG_COUNT(ht) != 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 = php3_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; - } - - 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 */ -void php3_dbase_replace_record(INTERNAL_FUNCTION_PARAMETERS) { - 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 (ARG_COUNT(ht) != 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 = php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_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 (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_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 */ -/* {{{ 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 (ARG_COUNT(ht) != 2 || getParameters(ht,2,&dbh_id,&record)==FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(dbh_id); - convert_to_long(record); - - dbh = php3_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 (ARG_COUNT(ht) != 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) && (!_php3_checkuid(filename->value.str.val, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(filename->value.str.val)) { - RETURN_FALSE; - } - - if ((fd = open(filename->value.str.val, 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; - - 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 (field->type != 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(field->value.ht, 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(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(field->value.ht,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(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(field->value.ht,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(value); - cur_f->db_flen = value->value.lval; - - if (cur_f->db_type == 'N') { - if (zend_hash_index_find(field->value.ht,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(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 = php3_list_insert(dbh, DBase_GLOBAL(le_dbhead)); - RETURN_LONG(handle); -} -/* }}} */ - -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} -}; - -php3_module_entry dbase_module_entry = { - "DBase", dbase_functions, PHP_MINIT(dbase), PHP_MSHUTDOWN(dbase), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES -}; - - -#if defined(COMPILE_DL) -DLEXPORT php3_module_entry *get_module(void) { return &dbase_module_entry; } - -#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: - */ diff --git a/ext/dbase/dbf.h b/ext/dbase/dbf.h deleted file mode 100644 index 08bc70dd41..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 -#include -#ifdef WIN32 -#include -#else -#include -#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 1f104e3d81..0000000000 --- a/ext/dbase/dbf_head.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#include "dbf.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 = open(cp, o_flags|O_BINARY)) < 0) { - cp = (char *)malloc(256); - strcpy(cp, dp); strcat(cp, ".dbf"); - if ((fd = 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); - } -} 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 fedb0d0f9c..0000000000 --- a/ext/dbase/dbf_misc.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ -#include -#include -#include - -#include "dbf_misc.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 - -char *db_cur_date(char *cp) -{ - struct tm *ctm, tmbuf; - time_t c_time; - - c_time = time((time_t *)NULL); - ctm = 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; -} 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 9263b02b0c..0000000000 --- a/ext/dbase/dbf_ndx.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#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 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 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 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 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; -} - diff --git a/ext/dbase/dbf_ndx.h b/ext/dbase/dbf_ndx.h deleted file mode 100644 index 3faff04025..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 fa342005fb..0000000000 --- a/ext/dbase/dbf_rec.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 1993 Brad Eacker, - * (Music, Intuition, Software, and Computers) - * All Rights Reserved - */ - -#include -#include - -#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); -} 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 1f083e7b3a..0000000000 --- a/ext/dbase/php_dbase.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Jim Winstead (jimw@php.net) | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _DBASE_H -#define _DBASE_H -#if DBASE -extern php3_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 /* _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/domxml/Makefile.am b/ext/domxml/Makefile.am deleted file mode 100644 index 36775910d3..0000000000 --- a/ext/domxml/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_domxml.la -libphpext_domxml_la_SOURCES=domxml.c - diff --git a/ext/domxml/config.h.stub b/ext/domxml/config.h.stub deleted file mode 100644 index 0a9d0706b5..0000000000 --- a/ext/domxml/config.h.stub +++ /dev/null @@ -1,3 +0,0 @@ -/* Define if you have the gnome xml library */ -#define HAVE_DOMXML 0 - diff --git a/ext/domxml/config.m4 b/ext/domxml/config.m4 deleted file mode 100644 index 308f98d2b0..0000000000 --- a/ext/domxml/config.m4 +++ /dev/null @@ -1,66 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to include DOM support) -AC_ARG_WITH(dom, -[ --with-dom[=DIR] Include DOM support (requires libxml >= 1.0). - DIR is the libxml install directory, - defaults to /usr.], -[ - case "$withval" in - no) - AC_MSG_RESULT(no) ;; - yes) - AC_MSG_RESULT(yes) - PHP_EXTENSION(domxml) - old_LIBS=$LIBS - LIBS="$LIBS -lgz" - AC_CHECK_LIB(xml, xmlNewDoc, [AC_DEFINE(HAVE_DOMXML)], - [AC_MSG_ERROR(DOM module requires libxml >= 1.0)]) - LIBS=$old_LIBS - AC_ADD_LIBRARY(gz) - AC_ADD_LIBRARY(xml) - AC_ADD_INCLUDE(/usr/local/include) - ;; - *) - test -f $withval/include/gnome-xml/tree.h && DOMXML_INCLUDE="$withval/include" - test -f $withval/include/tree.h && DOMXML_INCLUDE="$withval/include" - if test -n "$DOMXML_INCLUDE" ; then - AC_MSG_RESULT(yes) - PHP_EXTENSION(domxml) - old_LIBS=$LIBS - LIBS="$LIBS -L$withval/lib" - - if test $HAVE_ZLIB; then - old_withval=$withval - AC_MSG_CHECKING([for zlib (needed by DOM support)]) - AC_ARG_WITH(zlib-dir, - [ --with-zlib-dir[=DIR] zlib dir for pdflib 2.0 or include zlib support],[ - AC_MSG_RESULT( ) - if test -z $withval; then - withval="/usr/local" - fi - LIBS="$LIBS -L$withval/lib -lz" - AC_CHECK_LIB(z,deflate, ,[AC_MSG_RESULT(no)],) - AC_ADD_LIBRARY_WITH_PATH(z, $withval/lib) - ],[ - AC_MSG_RESULT(no) - AC_MSG_WARN(If configure fails try --with-zlib=) - ]) - withval=$old_withval - else - echo "checking for libz needed by pdflib 2.0... already zlib support" - LIBS="$LIBS -L$withval/lib -lz" - fi - - AC_CHECK_LIB(xml, xmlNewDoc, [AC_DEFINE(HAVE_DOMXML)], - [AC_MSG_ERROR(DOM module requires libxml >= 1.0.)]) - LIBS=$old_LIBS - AC_ADD_LIBRARY_WITH_PATH(xml, $withval/lib) - AC_ADD_INCLUDE($DOMXML_INCLUDE) - else - AC_MSG_RESULT(no) - fi ;; - esac -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/domxml/domxml.c b/ext/domxml/domxml.c deleted file mode 100644 index 6dae8c887c..0000000000 --- a/ext/domxml/domxml.c +++ /dev/null @@ -1,621 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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_domxml.h" - -#if HAVE_DOMXML - -static int le_domxmldocp; -static int le_domxmldtdp; -static int le_domxmlnodep; -static int le_domxmlattrp; -static zend_class_entry *domxmldoc_class_entry_ptr; -static zend_class_entry *domxmldtd_class_entry_ptr; -static zend_class_entry *domxmlnode_class_entry_ptr; -static zend_class_entry *domxmlattr_class_entry_ptr; - -static zend_function_entry php_domxml_functions[] = { - PHP_FE(getdom, NULL) - PHP_FE(domxml_root, NULL) - PHP_FE(domxml_attributes, NULL) - PHP_FE(domxml_getattr, NULL) - PHP_FE(domxml_setattr, NULL) - PHP_FE(domxml_children, NULL) - PHP_FALIAS(dom, getdom, NULL) - {NULL, NULL, NULL} -}; - - -static zend_function_entry php_domxmldoc_class_functions[] = { - PHP_FALIAS(root, domxml_root, NULL) - PHP_FALIAS(intdtd, domxml_intdtd, 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(lastchild, domxml_lastchild, NULL) - PHP_FALIAS(children, domxml_children, NULL) - PHP_FALIAS(parent, domxml_parent, NULL) - PHP_FALIAS(getattr, domxml_getattr, NULL) - PHP_FALIAS(setattr, domxml_setattr, NULL) - PHP_FALIAS(attributes, domxml_attributes, NULL) - {NULL, NULL, NULL} -}; - -static zend_function_entry php_domxmlattr_class_functions[] = { - PHP_FALIAS(name, domxml_attrname, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry php3_domxml_module_entry = { - "DOM", php_domxml_functions, PHP_MINIT(domxml), NULL, NULL, NULL, PHP_MINFO(domxml), STANDARD_MODULE_PROPERTIES -}; - - -PHP_MINIT_FUNCTION(domxml) -{ - zend_class_entry domxmldoc_class_entry; - zend_class_entry domxmldtd_class_entry; - zend_class_entry domxmlnode_class_entry; - zend_class_entry domxmlattr_class_entry; - - le_domxmldocp = register_list_destructors(xmlFreeDoc, NULL); - /* Freeing the document contains freeing the complete tree. - Therefore nodes, attributes etc. may not be freed seperately. - le_domxmlnodep = register_list_destructors(xmlFreeNode, NULL); - le_domxmlattrp = register_list_destructors(xmlFreeProp, NULL); - */ - - INIT_CLASS_ENTRY(domxmldoc_class_entry, "Dom document", php_domxmldoc_class_functions); - INIT_CLASS_ENTRY(domxmldtd_class_entry, "Dtd", php_domxmldtd_class_functions); - INIT_CLASS_ENTRY(domxmlnode_class_entry, "Dom node", php_domxmlnode_class_functions); - INIT_CLASS_ENTRY(domxmlattr_class_entry, "Dom Attribute", php_domxmlattr_class_functions); - - domxmldoc_class_entry_ptr = register_internal_class(&domxmldoc_class_entry); - domxmldtd_class_entry_ptr = register_internal_class(&domxmldtd_class_entry); - domxmlnode_class_entry_ptr = register_internal_class(&domxmlnode_class_entry); - domxmlattr_class_entry_ptr = register_internal_class(&domxmlattr_class_entry); - - 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); - return SUCCESS; -} - -PHP_MINFO_FUNCTION(domxml) -{ - PUTS("DOM/XML support active (compiled with libxml "); - PUTS(XML_DEFAULT_VERSION); - PUTS(".)"); -} - -/* {{{ proto string domxml_attrname([int dir_handle]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_attrname) -{ - pval *id, **tmp; - int id_to_find; - xmlNode *nodep; - xmlAttr *attr; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - attr = nodep->properties; - if (!attr) { - RETURN_FALSE; - } - while(attr) { - ret = zend_list_insert(attr, le_domxmlattrp); - - /* construct an object with some methods */ - object_init_ex(return_value, domxmlattr_class_entry_ptr); - add_property_long(return_value, "attribute", ret); - attr = attr->next; - } -} -/* }}} */ - -/* {{{ proto string domxml_lastchild([int node]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_lastchild) -{ - pval *id, **tmp; - int id_to_find; - xmlNode *nodep, *last; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - last = nodep->last; - if (!last) { - RETURN_FALSE; - } - - ret = zend_list_insert(last, le_domxmlnodep); - - /* construct an object with some methods */ - object_init_ex(return_value, domxmlnode_class_entry_ptr); - add_property_long(return_value, "node", ret); - add_property_long(return_value, "type", last->type); - add_property_stringl(return_value, "name", (char *) last->name, strlen(last->name), 1); - if(last->content) - add_property_stringl(return_value, "content", (char *) last->content, strlen(last->content), 1); -} -/* }}} */ - -/* {{{ proto string domxml_parent([int node]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_parent) -{ - pval *id, **tmp; - int id_to_find; - xmlNode *nodep, *last; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - last = nodep->parent; - if (!last) { - RETURN_FALSE; - } - - ret = zend_list_insert(last, le_domxmlnodep); - - /* construct an object with some methods */ - object_init_ex(return_value, domxmlnode_class_entry_ptr); - add_property_long(return_value, "node", ret); - add_property_long(return_value, "type", last->type); - add_property_stringl(return_value, "name", (char *) last->name, strlen(last->name), 1); - if(last->content) - add_property_stringl(return_value, "content", (char *) last->content, strlen(last->content), 1); -} -/* }}} */ - -/* {{{ proto string domxml_children([int node]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_children) -{ - pval *id, **tmp; - int id_to_find; - xmlNode *nodep, *last; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - last = nodep->childs; - if (!last) { - RETURN_FALSE; - } - - if (array_init(return_value) == FAILURE) { - RETURN_FALSE; - } - - while(last) { - zval *child; - MAKE_STD_ZVAL(child); - - ret = zend_list_insert(last, le_domxmlnodep); - - /* construct a node object */ - object_init_ex(child, domxmlnode_class_entry_ptr); - add_property_stringl(child, "name", (char *) last->name, strlen(last->name), 1); - if(last->content) - add_property_stringl(child, "content", (char *) last->content, strlen(last->content), 1); - add_property_long(child, "node", ret); - add_property_long(child, "type", last->type); - zend_hash_next_index_insert(return_value->value.ht, &child, sizeof(zval *), NULL); - last = last->next; - } -} -/* }}} */ - -/* {{{ proto string domxml_getattr([int node,] string attrname) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_getattr) -{ - pval *id, *arg1, **tmp; - int id_to_find; - xmlNode *nodep, *last; - char *value; - int type; - int ret; - - if ((ARG_COUNT(ht) == 1) && getParameters(ht, 1, &arg1) == SUCCESS) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - convert_to_string(arg1); - } else if ((ARG_COUNT(ht) == 2) && getParameters(ht, 2, &id, &arg1) == SUCCESS) { - convert_to_long(id); - id_to_find = id->value.lval; - convert_to_string(arg1); - } else { - WRONG_PARAM_COUNT; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - value = xmlGetProp(nodep, arg1->value.str.val); - if (!value) { - php_error(E_WARNING, "No such attribute '%s'", arg1->value.str.val); - RETURN_FALSE; - } - RETURN_STRING(value, 1); -} -/* }}} */ - -/* {{{ proto string domxml_setattr([int node,] string attrname, string value) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_setattr) -{ - pval *id, *arg1, *arg2, **tmp; - int id_to_find; - xmlNode *nodep, *last; - xmlAttr *attr; - int type; - int ret; - - if ((ARG_COUNT(ht) == 2) && getParameters(ht, 2, &arg1, &arg2) == SUCCESS) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - convert_to_string(arg1); - convert_to_string(arg2); - } else if ((ARG_COUNT(ht) == 3) && getParameters(ht, 3, &id, &arg1, &arg2) == SUCCESS) { - convert_to_long(id); - id_to_find = id->value.lval; - convert_to_string(arg1); - convert_to_string(arg2); - } else { - WRONG_PARAM_COUNT; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - 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; - } - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto string domxml_attributes([int node]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_attributes) -{ - pval *id, *arg1, **tmp; - int id_to_find; - xmlNode *nodep; - xmlAttr *attr; - char *value; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "node", sizeof("node"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my node (%d)", id); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - nodep = (xmlNode *)zend_list_find(id_to_find, &type); - if (!nodep || type != le_domxmlnodep) { - php_error(E_WARNING, "unable to find node identifier (%d)", id_to_find); - RETURN_FALSE; - } - - 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, attr->val->content, 1); - attr = attr->next; - } -} -/* }}} */ - -/* {{{ proto string domxml_root([int doc_handle]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_root) -{ - pval *id, **tmp; - int id_to_find; - xmlDoc *docp; - xmlNode *node; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "doc", sizeof("doc"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - docp = (xmlDoc *)zend_list_find(id_to_find, &type); - if (!docp || type != le_domxmldocp) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - node = docp->root; - if (!node) { - RETURN_FALSE; - } - ret = zend_list_insert(node, le_domxmlnodep); - - /* construct an object with some methods */ - object_init_ex(return_value, domxmlnode_class_entry_ptr); - add_property_long(return_value, "node", ret); - add_property_long(return_value, "type", node->type); - add_property_stringl(return_value, "name", (char *) node->name, strlen(node->name), 1); - if(node->content) - add_property_stringl(return_value, "content", (char *) node->content, strlen(node->content), 1); - zend_list_addref(ret); -} -/* }}} */ - -/* {{{ proto string domxml_dtd([int dir_handle]) - Read directory entry from dir_handle */ -PHP_FUNCTION(domxml_intdtd) -{ - pval *id, **tmp; - int id_to_find; - xmlDoc *docp; - xmlDtd *dtd; - int type; - int ret; - - if (ARG_COUNT(ht) == 0) { - id = getThis(); - if (id) { - if (zend_hash_find(id->value.obj.properties, "doc", sizeof("doc"), (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find my handle property"); - RETURN_FALSE; - } - id_to_find = (*tmp)->value.lval; - } else { - RETURN_FALSE; - } - } else if ((ARG_COUNT(ht) != 1) || getParameters(ht, 1, &id) == FAILURE) { - WRONG_PARAM_COUNT; - } else { - convert_to_long(id); - id_to_find = id->value.lval; - } - - docp = (xmlDoc *)zend_list_find(id_to_find, &type); - if (!docp || type != le_domxmldocp) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); - RETURN_FALSE; - } - - dtd = docp->intSubset; - if (!dtd) { - RETURN_FALSE; - } - ret = zend_list_insert(dtd, le_domxmldtdp); - - /* construct an object with some methods */ - object_init_ex(return_value, domxmldtd_class_entry_ptr); - add_property_long(return_value, "dtd", ret); - if(dtd->ExternalID) - add_property_string(return_value, "extid", (char *) dtd->ExternalID, 1); - add_property_string(return_value, "sysid", (char *) dtd->SystemID, 1); - add_property_string(return_value, "name", (char *) dtd->name, 1); - zend_list_addref(ret); -} -/* }}} */ - -/* {{{ proto class dom(string directory) - Directory class with properties, handle and class and methods read, rewind and close */ -PHP_FUNCTION(getdom) -{ - pval *arg; - xmlDoc *docp; - int ret; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(arg); - - docp = xmlParseMemory(arg->value.str.val, arg->value.str.len); - 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_ptr); - add_property_long(return_value, "doc", ret); - add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1); - zend_list_addref(ret); -} -/* }}} */ - -#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 70fc1c5c9d..0000000000 --- a/ext/domxml/php_domxml.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de | - | | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP_DOMXML_H -#define _PHP_DOMXML_H - -#if HAVE_DOMXML -#include - -extern php3_module_entry php3_domxml_module_entry; -#define php3_domxml_module_ptr &php3_domxml_module_entry - -/* directory functions */ -extern PHP_MINIT_FUNCTION(domxml); -extern PHP_MINFO_FUNCTION(domxml); -PHP_FUNCTION(getdom); - -/* Class Document methods */ -PHP_FUNCTION(domxml_root); -PHP_FUNCTION(domxml_intdtd); - -/* Class Node methods */ -PHP_FUNCTION(domxml_attributes); -PHP_FUNCTION(domxml_getattr); -PHP_FUNCTION(domxml_setattr); -PHP_FUNCTION(domxml_children); -PHP_FUNCTION(domxml_lastchild); -PHP_FUNCTION(domxml_parent); - -/* Class Attribute methods */ -PHP_FUNCTION(domxml_attrname); - -#else -#define php3_domxml_module_ptr NULL -#endif /* HAVE_DOMXML */ -#define phpext_domxml_ptr php3_domxml_module_ptr - -#endif /* _PHP3_DIR_H */ diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c deleted file mode 100644 index 58c8fc82f2..0000000000 --- a/ext/ereg/ereg.c +++ /dev/null @@ -1,653 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | Jim Winstead | - | Jaakko Hyvätti | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#include -#include "php.h" -#include "php_string.h" -#include "reg.h" - -unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; - -function_entry reg_functions[] = { - 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_FALIAS(join, implode, NULL) - PHP_FE(sql_regcase, NULL) - {NULL, NULL, NULL} -}; - - -static PHP_MINIT_FUNCTION(regex); -static PHP_MSHUTDOWN_FUNCTION(regex); -static PHP_MINFO_FUNCTION(regex); - -zend_module_entry regexp_module_entry = { - "Regular Expressions", - reg_functions, - PHP_MINIT(regex), PHP_MSHUTDOWN(regex), - NULL, NULL, PHP_MINFO(regex), - STANDARD_MODULE_PROPERTIES -}; - -#ifdef ZTS -int reg_globals_id; -#else -static php_reg_globals reg_globals; -#endif - -typedef struct { - regex_t preg; - int cflags; -} reg_cache; - -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(®(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(®(ht_rc), (char *) pattern, patlen+1, - (void *) &rcp, sizeof(rcp), NULL); - } - } else { - memcpy(preg, &rc->preg, sizeof(*preg)); - } - - return r; -} - -static int _free_reg_cache(reg_cache *rc) -{ - regfree(&rc->preg); - return 1; -} - -#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(®_globals->ht_rc, 0, NULL, (int (*)(void *)) _free_reg_cache, 1); -} - -static 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(®_globals); -#endif - - return SUCCESS; -} - -static PHP_MSHUTDOWN_FUNCTION(regex) -{ - REGLS_FETCH(); - - zend_hash_destroy(®(ht_rc)); - return SUCCESS; -} - -static PHP_MINFO_FUNCTION(regex) -{ -#if HSREGEX - PUTS("Bundled regex library enabled\n"); -#else - PUTS("System regex library enabled\n"); -#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 - -/* - * _php3_reg_eprint - convert error number to name - */ -static void _php3_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); -} - -static void _php3_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(ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, ®ex, &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 (getParameters(ht, 3, ®ex, &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(regex); /* get rid of decimal places */ - convert_to_string(regex); - /* don't bother doing an extended regex with just a number */ - err = regcomp(&re, regex->value.str.val, copts); - } - - if (err) { - _php3_reg_eprint(err, &re); - RETURN_FALSE; - } - - /* make a copy of the string we're looking in */ - convert_to_string(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) { - _php3_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 _php3_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) -{ - _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int eregi(string pattern, string string [, array registers]) - Case-insensitive regular expression match */ -PHP_FUNCTION(eregi) -{ - _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* this is the meat and potatoes of regex replacement! */ -char *_php3_regreplace(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) { - _php3_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 _php3_regreplace"); - 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) { - _php3_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 - */ - - 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); -} - -static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase) -{ - pval *arg_pattern, - *arg_replace, - *arg_string; - char *pattern; - char *string; - char *replace; - char *ret; - - if (ARG_COUNT(ht) != 3 || getParameters(ht, 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(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(arg_replace); - replace = emalloc(2); - replace[0] = (char) arg_replace->value.lval; - replace[1] = '\0'; - } - - convert_to_string(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 = _php3_regreplace(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 string [, array registers]) - Replace regular expression */ -PHP_FUNCTION(ereg_replace) -{ - _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto string eregi_replace(string pattern, string string [, array registers]) - Case insensitive replace regular expression */ -PHP_FUNCTION(eregi_replace) -{ - _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - -/* ("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) -{ - pval *spliton, *str, *arg_count = NULL; - regex_t re; - regmatch_t subs[1]; - char *strp, *endp; - int err, size, count; - - switch (ARG_COUNT(ht)) { - case 2: - if (getParameters(ht, 2, &spliton, &str) == FAILURE) - WRONG_PARAM_COUNT; - count = -1; - break; - case 3: - if (getParameters(ht, 3, &spliton, &str, &arg_count) == FAILURE) - WRONG_PARAM_COUNT; - convert_to_long(arg_count); - count = arg_count->value.lval; - break; - default: - WRONG_PARAM_COUNT; - } - - convert_to_string(spliton); - convert_to_string(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); - 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); - - return; -} -/* }}} */ - -/* {{{ 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 (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &string)==FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(string); - - tmp = (char *) emalloc(string->value.str.len*4+1); - - for (i=j=0; ivalue.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: - */ diff --git a/ext/ereg/php_ereg.h b/ext/ereg/php_ereg.h deleted file mode 100644 index c261abf4d2..0000000000 --- a/ext/ereg/php_ereg.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _REG_H -#define _REG_H - -extern php3_module_entry regexp_module_entry; -#define regexp_module_ptr ®exp_module_entry - -char *_php3_regreplace(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); -PHPAPI PHP_FUNCTION(sql_regcase); - -typedef struct { - HashTable ht_rc; -} php_reg_globals; - - -#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 - -#define phpext_regex_ptr regexp_module_ptr - -#endif /* _REG_H */ diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h deleted file mode 100644 index be0f445af7..0000000000 --- a/ext/ereg/php_regex.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _PHP_REGEX_H -#define _PHP_REGEX_H - -/* - * REGEX means: - * 0.. system regex - * 1.. bundled regex - * 2.. Apache's regex - */ - -#if REGEX == 1 -/* 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 - -#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 -#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.am b/ext/ereg/regex/Makefile.am deleted file mode 100644 index 993db56b1a..0000000000 --- a/ext/ereg/regex/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -noinst_LTLIBRARIES = libregex.la - -libregex_la_SOURCES = regcomp.c regexec.c regerror.c regfree.c 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 . - -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' - 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 0c293028e9..0000000000 --- a/ext/ereg/regex/cclass.h +++ /dev/null @@ -1,31 +0,0 @@ -/* character-class table */ -static struct cclass { - char *name; - char *chars; - char *multis; -} cclasses[] = { - "alnum", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ -0123456789", "", - "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 02e86e912e..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 -#include -#include -#include -#include -#include -#include - -#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®_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®_NOSUB) - nmatch = 0; - if (eflags®_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®_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®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OEOL: - if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OBOW: - if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_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®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_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®_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 -#include -#include -#include -#include -#include - -#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®_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®_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®_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)®_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®_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 2569b1c629..0000000000 --- a/ext/ereg/regex/regcomp.c +++ /dev/null @@ -1,1605 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define POSIX_MISTAKE - -#include "utils.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) ((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 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®_EXTENDED) && (cflags®_NOSPEC)) - return(REG_INVARG); - - if (cflags®_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®_EXTENDED) - p_ere(p, OUT); - else if (cflags®_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); - 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®_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<g->cflags®_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®_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®_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®_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'; -} - -/* - - 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); -} - -/* - - 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<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<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 0776e7185c..0000000000 --- a/ext/ereg/regex/regcomp.ih +++ /dev/null @@ -1,51 +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); -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); -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 9158870322..0000000000 --- a/ext/ereg/regex/regerror.c +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#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®_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 -.br -#include -.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 -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< 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 -#include -#include -#include -#include -#include -#include - -#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®_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 -#include -#include -#include - -#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 -#include - -/* - - 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 - -/* for old systems with bcopy() but no memmove() */ -#ifdef USEBCOPY -#define memmove(d, s, c) bcopy(s, d, c) -#endif diff --git a/ext/ext_skel b/ext/ext_skel deleted file mode 100755 index a1b0406e6b..0000000000 --- a/ext/ext_skel +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -extname="$1" -EXTNAME=`echo $1|tr a-z A-Z` - -givup() { - echo $* - exit 1 -} - -if test "$extname" = ""; then - givup "usage: $0 extension-name" -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" - -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 - -echo "Creating directory" - -mkdir $extname || givup "Cannot create directory $extname" - -cd $extname -chmod 755 . - -$ECHO_N "Creating basic files:$ECHO_C" - -$ECHO_N " config.m4$ECHO_C" -cat >config.m4 <Makefile.am <.cvsignore <config.h.stub< | - +----------------------------------------------------------------------+ - */ - -/* $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 */ - -#if !PHP_31 && defined(THREAD_SAFE) -#undef THREAD_SAFE -#endif - -#include "php.h" -#include "ext/standard/head.h" -#include -#include "php_fdf.h" - -#if HAVE_SYS_WAIT_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif -#if WIN32|WINNT -# include -# include -#endif - -#if HAVE_FDFLIB - -#ifdef THREAD_SAFE -DWORD FDFlibTls; -static int numthreads=0; - -typedef struct fdflib_global_struct{ - int le_fdf; -} fdflib_global_struct; - -# define FDF_GLOBAL(a) fdflib_globals->a -# define FDF_TLS_VARS fdflib_global_struct *fdflib_globals=TlsGetValue(FDFlibTls) - -#else -# define FDF_GLOBAL(a) a -# define FDF_TLS_VARS -int le_fdf_info; -int le_fdf; -#endif - -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) - {NULL, NULL, NULL} -}; - -php3_module_entry fdf_module_entry = { - "fdf", fdf_functions, PHP_MINIT(fdf), PHP_MSHUTDOWN(fdf), NULL, NULL, - PHP_MINFO(fdf), STANDARD_MODULE_PROPERTIES -}; - -#if COMPILE_DL -#include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &fdf_module_entry; } -#endif - -static void phpi_FDFClose(FDFDoc fdf) { - (void)FDFClose(fdf); -} - -PHP_MINIT_FUNCTION(fdf) -{ - FDFErc err; - FDF_GLOBAL(le_fdf) = register_list_destructors(phpi_FDFClose, NULL); - err = FDFInitialize(); - if(err == FDFErcOK) - return SUCCESS; - return FAILURE; -} - -PHP_MINFO_FUNCTION(fdf) -{ - /* need to use a PHPAPI function here because it is external module in windows */ - php_printf("FdfTk Version %s", FDFGetVersion()); -} - -PHP_MSHUTDOWN_FUNCTION(fdf) -{ - FDFErc err; - err = FDFFinalize(); - if(err == FDFErcOK) - return SUCCESS; - return FAILURE; -} - -/* {{{ proto int fdf_open(string filename) - Opens a new fdf document */ -PHP_FUNCTION(fdf_open) { - pval *file; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - err = FDFOpen(file->value.str.val, 0, &fdf); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(!fdf) - RETURN_FALSE; - - id = php3_list_insert(fdf,FDF_GLOBAL(le_fdf)); - RETURN_LONG(id); -} /* }}} */ - -/* {{{ proto void fdf_close(int fdfdoc) - Closes the fdf document */ -PHP_FUNCTION(fdf_close) { - pval *arg1; - int id, type; - FDFDoc fdf; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - -/* FDFClose(fdf); */ - php3_list_delete(id); - - RETURN_TRUE; -} /* }}} */ - -/* {{{ proto void fdf_create(void) - Creates a new fdf document */ -PHP_FUNCTION(fdf_create) { - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - err = FDFCreate(&fdf); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(!fdf) - RETURN_FALSE; - - id = php3_list_insert(fdf,FDF_GLOBAL(le_fdf)); - RETURN_LONG(id); -} -/* }}} */ - -/* {{{ proto void fdf_get_value(int fdfdoc, string fieldname) - Gets the value of a field as string */ -PHP_FUNCTION(fdf_get_value) { - pval *arg1, *arg2; - int id, type; - ASInt32 nr; - char *buffer; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetValue(fdf, arg2->value.str.val, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - /* In the inofficial version of FdfTK 4.0 (as FDFGetVersion says. The - library has a name with version 3.0, don't know what adobe has in - mind) the number of bytes of the value doesn't include the trailing - '\0'. This was not the case in 2.0 - */ - if(strcmp(FDFGetVersion(), "2.0")) - nr++; - buffer = emalloc(nr); - err = FDFGetValue(fdf, arg2->value.str.val, buffer, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buffer, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_value(int fdfdoc, string fieldname, string value, int isName) - Sets the value of a field */ -PHP_FUNCTION(fdf_set_value) { - pval *arg1, *arg2, *arg3, *arg4; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - convert_to_string(arg3); - convert_to_long(arg4); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetValue(fdf, arg2->value.str.val, arg3->value.str.val, (ASBool) arg4->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void 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) { - pval *argv[2]; - int id, type, argc; - ASInt32 nr; - char *buffer, *fieldname; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - argc = ARG_COUNT(ht); - if((argc > 2) || (argc < 1)) - WRONG_PARAM_COUNT; - - if (getParametersArray(ht, argc, argv) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(argv[0]); - if(argc == 2) { - convert_to_string(argv[1]); - fieldname = argv[1]->value.str.val; - } else { - fieldname = NULL; - } - id=argv[0]->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFNextFieldName(fdf, fieldname, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - - buffer = emalloc(nr); - err = FDFNextFieldName(fdf, fieldname, buffer, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buffer, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_ap(int fdfdoc, string fieldname, int face, string filename, int pagenr) - Sets the value of a field */ -PHP_FUNCTION(fdf_set_ap) { - pval *arg1, *arg2, *arg3, *arg4, *arg5; - int id, type; - FDFDoc fdf; - FDFErc err; - FDFAppFace face; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - convert_to_long(arg3); - convert_to_string(arg4); - convert_to_long(arg5); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - switch(arg3->value.lval) { - case 1: - face = FDFNormalAP; - break; - case 2: - face = FDFRolloverAP; - break; - case 3: - face = FDFDownAP; - break; - default: - face = FDFNormalAP; - } - - err = FDFSetAP(fdf, arg2->value.str.val, face, NULL, arg4->value.str.val, (ASInt32) arg5->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_set_status(int fdfdoc, string status) - Sets the value in the /Status key. */ -PHP_FUNCTION(fdf_set_status) { - pval *arg1, *arg2; - int id, type; - ASInt32 nr; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetStatus(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_get_status(int fdfdoc) - Gets the value in the /Status key. */ -PHP_FUNCTION(fdf_get_status) { - pval *arg1; - int id, type; - ASInt32 nr; - char *buf; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetStatus(fdf, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - buf = emalloc(nr); - err = FDFGetStatus(fdf, buf, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buf, 0); -} -/* }}} */ - -/* {{{ proto void fdf_set_file(int fdfdoc, string filename) - Sets the value of the FDF's /F key */ -PHP_FUNCTION(fdf_set_file) { - pval *arg1, *arg2; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSetFile(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto void fdf_get_file(int fdfdoc) - Gets the value in the /F key. */ -PHP_FUNCTION(fdf_get_file) { - pval *arg1; - int id, type; - ASInt32 nr; - char *buf; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFGetFile(fdf, NULL, 0, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - if(nr == 0) - RETURN_STRING(empty_string, 1); - buf = emalloc(nr); - err = FDFGetFile(fdf, buf, nr, &nr); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_STRING(buf, 0); -} -/* }}} */ - -/* {{{ proto void fdf_save(int fdfdoc, string filename) - Writes out an FDF file. */ -PHP_FUNCTION(fdf_save) { - pval *arg1, *arg2; - int id, type; - FDFDoc fdf; - FDFErc err; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_string(arg2); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - err = FDFSave(fdf, arg2->value.str.val); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} /* }}} */ - -/* {{{ proto void fdf_add_template(int fdfdoc, int newpage, string filename, string template, int rename) - Adds a template to the FDF*/ -PHP_FUNCTION(fdf_add_template) { - pval *arg1, *arg2, *arg3, *arg4, *arg5; - int id, type; - FDFDoc fdf; - FDFErc err; - pdfFileSpecRec filespec; - FDF_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &arg1, &arg2, &arg3, &arg4, &arg5) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(arg1); - convert_to_long(arg2); - convert_to_string(arg3); - convert_to_string(arg4); - convert_to_long(arg5); - id=arg1->value.lval; - fdf = php3_list_find(id,&type); - if(!fdf || type!=FDF_GLOBAL(le_fdf)) { - php3_error(E_WARNING,"Unable to find file identifier %d",id); - RETURN_FALSE; - } - - filespec.FS = NULL; - filespec.F = arg3->value.str.val; - filespec.Mac = NULL; - filespec.DOS = NULL; - filespec.Unix = NULL; - filespec.ID[0] = NULL; - filespec.ID[1] = NULL; - filespec.bVolatile = false; - err = FDFAddTemplate(fdf, arg2->value.lval, &filespec, arg4->value.str.val, arg5->value.lval); - if(err != FDFErcOK) - printf("Aiii, error\n"); - - RETURN_TRUE; -} -/* }}} */ - -#endif - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ diff --git a/ext/fdf/php_fdf.h b/ext/fdf/php_fdf.h deleted file mode 100644 index ab2256c5fe..0000000000 --- a/ext/fdf/php_fdf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Uwe Steinmann | - +----------------------------------------------------------------------+ - */ -/* $Id$ */ - -#ifndef _PHP_FDF_H -#define _PHP_FDF_H - -#if HAVE_FDFLIB -#if WIN32|WINNT -#else -#define UNIX_DEV -#endif - -#include - -extern php3_module_entry fdf_module_entry; -#define phpext_fdf_ptr &fdf_module_entry - -extern PHP_MINIT_FUNCTION(fdf); -extern 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); -#else -#define phpext_fdf_ptr NULL -#endif -#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/Makefile.am b/ext/filepro/Makefile.am deleted file mode 100644 index 4a97e91f97..0000000000 --- a/ext/filepro/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_filepro.la -libphpext_filepro_la_SOURCES=filepro.c - diff --git a/ext/filepro/config.h.stub b/ext/filepro/config.h.stub deleted file mode 100644 index 0a273b1502..0000000000 --- a/ext/filepro/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -#define HAVE_FILEPRO 0 - diff --git a/ext/filepro/config.m4 b/ext/filepro/config.m4 deleted file mode 100644 index 2c0fd3b43b..0000000000 --- a/ext/filepro/config.m4 +++ /dev/null @@ -1,17 +0,0 @@ -dnl $Id$ - -AC_MSG_CHECKING(whether to include the bundled filePro support) -AC_ARG_WITH(filepro, -[ --with-filepro Include the bundled read-only filePro support],[ - if test "$withval" != "no"; then - AC_DEFINE(HAVE_FILEPRO, 1) - AC_MSG_RESULT(yes) - PHP_EXTENSION(filepro) - else - AC_DEFINE(HAVE_FILEPRO, 0) - AC_MSG_RESULT(no) - fi -],[ - AC_DEFINE(HAVE_FILEPRO, 0) - AC_MSG_RESULT(no) -]) diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c deleted file mode 100644 index 44601f9e22..0000000000 --- a/ext/filepro/filepro.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - +----------------------------------------------------------------------+ - - 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/ - - */ - -#include "php.h" -#include "safe_mode.h" -#include "fopen-wrappers.h" -#include -#if MSVC5 -#include -#else -#include -#endif -#include -#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(filepro) -{ -#ifdef THREAD_SAFE - fp_global_struct *fp_globals; -#if !COMPILE_DL - 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(filepro) -{ -#ifdef THREAD_SAFE - fp_global_struct *fp_globals; - fp_globals = TlsGetValue(FPTls); - if (fp_globals != 0) - LocalFree((HLOCAL) fp_globals); -#if !COMPILE_DL - 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} -}; - -php3_module_entry filepro_module_entry = { - "FilePro", filepro_functions, PHP_MINIT(filepro), PHP_MSHUTDOWN(filepro), NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES -}; - - -#if COMPILE_DL -#include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &filepro_module_entry; } -#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. - */ -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 (ARG_COUNT(ht) != 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) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = 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(strtok_r(readbuf, ":", &strtok_buf), "map")) { - php_error(E_WARNING, "filePro: map file corrupt or encrypted"); - RETURN_FALSE; - } - FP_GLOBAL(fp_keysize) = atoi(strtok_r(NULL, ":", &strtok_buf)); - strtok_r(NULL, ":", &strtok_buf); - FP_GLOBAL(fp_fcount) = atoi(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(strtok_r(readbuf, ":", &strtok_buf)); - new_field->width = atoi(strtok_r(NULL, ":", &strtok_buf)); - new_field->format = estrdup(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. - * - * Errors return false, success returns the row count. - */ -PHP_FUNCTION(filepro_rowcount) -{ - FILE *fp; - char workbuf[MAXPATHLEN]; - char readbuf[256]; - int recsize = 0, records = 0; - PLS_FETCH(); - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 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) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = 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. - */ -PHP_FUNCTION(filepro_fieldname) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 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 - */ -PHP_FUNCTION(filepro_fieldtype) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 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. - */ -PHP_FUNCTION(filepro_fieldwidth) -{ - pval *fno; - FP_FIELD *lp; - int i; - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 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. - */ -PHP_FUNCTION(filepro_fieldcount) -{ - FP_TLS_VARS; - - if (ARG_COUNT(ht) != 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. - */ -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 (ARG_COUNT(ht) != 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) && (!_php3_checkuid(workbuf, 2))) { - RETURN_FALSE; - } - - if (_php3_check_open_basedir(workbuf)) { - RETURN_FALSE; - } - - if (!(fp = 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: - */ diff --git a/ext/filepro/php_filepro.h b/ext/filepro/php_filepro.h deleted file mode 100644 index 850eeb8dcd..0000000000 --- a/ext/filepro/php_filepro.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997,1998 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. | - +----------------------------------------------------------------------+ - | Authors: Chad Robinson | - +----------------------------------------------------------------------+ - - 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/ - - */ - -/* $Id$ */ - -#ifndef _FILEPRO_H -#define _FILEPRO_H -#if HAVE_FILEPRO -extern php3_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 /* _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/ftp/Makefile.am b/ext/ftp/Makefile.am deleted file mode 100644 index 8ba82c10d1..0000000000 --- a/ext/ftp/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_ftp.la -libphpext_ftp_la_SOURCES=php_ftp.c ftp.c diff --git a/ext/ftp/config.h.stub b/ext/ftp/config.h.stub deleted file mode 100644 index d63248456c..0000000000 --- a/ext/ftp/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* define if you want to use the ftp extension */ -#define HAVE_FTP 0 diff --git a/ext/ftp/config.m4 b/ext/ftp/config.m4 deleted file mode 100644 index 7b01e6b54d..0000000000 --- a/ext/ftp/config.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension ftp -dnl don't forget to call PHP_EXTENSION(ftp) - -AC_MSG_CHECKING(for FTP support) -AC_ARG_WITH(ftp, -[ --with-ftp Include FTP support.], -[ - if test "$withval" != "no"; then - AC_DEFINE(HAVE_FTP) - PHP_EXTENSION(ftp) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c deleted file mode 100644 index 4ced3839a0..0000000000 --- a/ext/ftp/ftp.c +++ /dev/null @@ -1,1165 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_FTP - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if HAVE_SYS_TIME_H -#include -#endif - -#include "ftp.h" - -/* 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]; -}; - - -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) - close(fd); - free(ftp); - return NULL; -} - - -ftpbuf_t* -ftp_close(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return NULL; - if (ftp->fd) - close(ftp->fd); - ftp_gc(ftp); - free(ftp); - return NULL; -} - - -void -ftp_gc(ftpbuf_t *ftp) -{ - if (ftp == NULL) - return; - - free(ftp->pwd); - ftp->pwd = NULL; - free(ftp->syst); - ftp->syst = NULL; -} - - -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; -} - - -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); -} - - -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; -} - - -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; -} - - -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; -} - - -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; -} - - -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; -} - - -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) - return NULL; - end = strrchr(++mkd, '"'); - *end = 0; - mkd = strdup(mkd); - *end = '"'; - - return mkd; -} - - -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; -} - - -char** -ftp_nlist(ftpbuf_t *ftp, const char *path) -{ - return ftp_genlist(ftp, "NLST", path); -} - - -char** -ftp_list(ftpbuf_t *ftp, const char *path) -{ - return ftp_genlist(ftp, "LIST", path); -} - - -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; -} - - -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] = 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; -} - - -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) - 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) - goto bail; - - return 1; -bail: - data_close(data); - return 0; -} - - -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) - 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) - goto bail; - - return 1; -bail: - data_close(data); - return 0; -} - - -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); -} - - -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 = 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; -} - - -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; -} - - -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; -} - -/* static functions */ - -int -ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args) -{ - int size; - char *data; - - /* build the output buffer */ - if (args) { - /* "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; -} - - -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; -} - - -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; - if (ftp->inbuf[3] == '-') - continue; - else if (ftp->inbuf[3] != ' ') - return 0; - 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; -} - - -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) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - sent = send(s, buf, size, 0); - if (sent == -1) - return -1; - - buf = (char*) buf + sent; - size -= sent; - } - - return len; -} - - -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) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - return recv(s, buf, len, 0); -} - - -int -my_connect(int s, const struct sockaddr *addr, int addrlen) -{ - 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; -} - - -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) { - if (n == 0) - errno = ETIMEDOUT; - return -1; - } - - return accept(s, addr, addrlen); -} - - -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"); - close(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) - close(fd); - free(data); - return NULL; -} - - -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); - close(data->listener); - data->listener = -1; - - if (data->fd == -1) { - free(data); - return NULL; - } - - return data; -} - - -databuf_t* -data_close(databuf_t *data) -{ - if (data == NULL) - return NULL; - if (data->listener != -1) - close(data->listener); - if (data->fd != -1) - close(data->fd); - free(data); - return NULL; -} - - -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) - 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) { - free(ret); - return NULL; - } - - return ret; -bail: - data_close(data); - fclose(tmpfp); - free(ret); - return NULL; -} - -#endif /* HAVE_FTP */ diff --git a/ext/ftp/ftp.h b/ext/ftp/ftp.h deleted file mode 100644 index b202981d9a..0000000000 --- a/ext/ftp/ftp.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _FTP_H -#define _FTP_H - -#include -#include - - -/* 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); - -/* 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); - -#endif diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c deleted file mode 100644 index 7bd7f4b495..0000000000 --- a/ext/ftp/php_ftp.c +++ /dev/null @@ -1,796 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include "php.h" - -#if HAVE_FTP - -#ifndef ZEND_VERSION -#include "internal_functions.h" -#include "php3_list.h" -#define php_error php3_error -#endif - -#include "ext/standard/file.h" - -#include "php_ftp.h" -#include "ftp.h" - -static int le_ftpbuf; - - -function_entry php3_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_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_quit, NULL) - {NULL, NULL, NULL} -}; - -php3_module_entry php3_ftp_module_entry = { - "FTP Functions", - php3_ftp_functions, -#ifdef ZEND_VERSION - PHP_MINIT(ftp), -#else - php3_minit_ftp, -#endif - NULL, - NULL, - NULL, - NULL, - STANDARD_MODULE_PROPERTIES -}; - -static void ftp_destructor_ftpbuf(ftpbuf_t *ftp) -{ - ftp_close(ftp); -} - -#ifndef ZEND_VERSION -int php3_minit_ftp(INIT_FUNC_ARGS) -#else -PHP_MINIT_FUNCTION(ftp) -#endif -{ - - ELS_FETCH(); - - le_ftpbuf = register_list_destructors(ftp_destructor_ftpbuf, NULL); - 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; -} - - -#define FTPBUF(ftp, pval) { \ - int id, type; \ - convert_to_long(pval); \ - id = (pval)->value.lval; \ - (ftp) = php3_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 ( pval->value.lval != FTPTYPE_ASCII && \ - pval->value.lval != FTPTYPE_IMAGE) \ - { \ - php_error(E_WARNING, "arg4 must be FTP_ASCII or FTP_IMAGE"); \ - RETURN_FALSE; \ - } \ - (xtype) = pval->value.lval; \ - } - -#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]) - Open a FTP stream */ -PHP_FUNCTION(ftp_connect) -{ - pval *arg1, *arg2; - ftpbuf_t *ftp; - short port = 0; - - /* arg1 - hostname - * arg2 - [port] - */ - switch (ARG_COUNT(ht)) { - 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 = arg2->value.lval; - break; - default: - WRONG_PARAM_COUNT; - } - - convert_to_string(arg1); - - /* connect */ - ftp = ftp_open(arg1->value.str.val, htons(port)); - if (ftp == NULL) - RETURN_FALSE; - - RETURN_LONG(php3_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 ( ARG_COUNT(ht) != 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, arg2->value.str.val, arg3->value.str.val)) { - 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 (ARG_COUNT(ht) != 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 (ARG_COUNT(ht) != 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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - if (!ftp_chdir(ftp, arg2->value.str.val)) { - php_error(E_WARNING, "ftp_chdir: %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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - tmp = ftp_mkdir(ftp, arg2->value.str.val); - 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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* change directories */ - if (!ftp_rmdir(ftp, arg2->value.str.val)) { - 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 ( ARG_COUNT(ht) != 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, arg2->value.str.val); - 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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_string(arg2); - - FTPBUF(ftp, arg1); - - /* get directory listing */ - llist = ftp_list(ftp, arg2->value.str.val); - 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 (ARG_COUNT(ht) != 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 ( ARG_COUNT(ht) != 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, arg3->value.str.val, xtype) || ferror(fp)) { - php_error(E_WARNING, "ftp_get: %s", ftp->inbuf); - RETURN_FALSE; - } - - if (ferror(fp)) { - php_error(E_WARNING, "error writing %s", arg2->value.str.val); - 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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_long(arg2); - - if (!ftp_pasv(ftp, (arg2->value.lval) ? 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 ( ARG_COUNT(ht) != 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, arg3->value.str.val, xtype) || - ferror(tmpfp)) - { - fclose(tmpfp); - php_error(E_WARNING, "ftp_get: %s", ftp->inbuf); - RETURN_FALSE; - } - - if ((outfp = fopen(arg2->value.str.val, "w")) == NULL) { - fclose(tmpfp); - php_error(E_WARNING, "error opening %s", arg2->value.str.val); - 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", arg2->value.str.val); - 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 ( ARG_COUNT(ht) != 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, arg2->value.str.val, 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 ( ARG_COUNT(ht) != 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); - - if ((infp = fopen(arg3->value.str.val, "r")) == NULL) { - php_error(E_WARNING, "error opening %s", arg3->value.str.val); - RETURN_FALSE; - } - if ( !ftp_put(ftp, arg2->value.str.val, 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 ( ARG_COUNT(ht) != 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, arg2->value.str.val)); -} -/* }}} */ - -/* {{{ 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 ( ARG_COUNT(ht) != 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, arg2->value.str.val)); -} -/* }}} */ - -/* {{{ 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 ( ARG_COUNT(ht) != 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, arg2->value.str.val, arg3->value.str.val)) { - 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 ( ARG_COUNT(ht) != 2 || - getParameters(ht, 2, &arg1, &arg2) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - FTPBUF(ftp, arg1); - convert_to_string(arg2); - - /* delete the file */ - if (!ftp_delete(ftp, arg2->value.str.val)) { - php_error(E_WARNING, "ftp_delete: %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 (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) { - WRONG_PARAM_COUNT; - } - - id = arg1->value.lval; - if (php3_list_find(id, &type) && type == le_ftpbuf) - php3_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 7da896cc8d..0000000000 --- a/ext/ftp/php_ftp.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Authors: | - | Andrew Skalski | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _INCLUDED_FTP_H -#define _INCLUDED_FTP_H - -#if COMPILE_DL -#undef HAVE_FTP -#define HAVE_FTP 1 -#endif - -#if HAVE_FTP - -extern php3_module_entry php3_ftp_module_entry; -#define php3_ftp_module_ptr &php3_ftp_module_entry - -#ifdef ZEND_VERSION -PHP_MINIT_FUNCTION(ftp); -#else -int php3_minit_ftp(INIT_FUNC_ARGS); -#endif - -PHP_FUNCTION(ftp_connect); -PHP_FUNCTION(ftp_login); -PHP_FUNCTION(ftp_pwd); -PHP_FUNCTION(ftp_cdup); -PHP_FUNCTION(ftp_chdir); -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_quit); - -#define phpext_ftp_ptr php3_ftp_module_ptr - -#else -#define php3_ftp_module_ptr NULL -#endif /* HAVE_FTP */ - -#endif diff --git a/ext/gd/Makefile.am b/ext/gd/Makefile.am deleted file mode 100644 index fca3e4c513..0000000000 --- a/ext/gd/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to produce Makefile.in - -SRC=gd.c gdcache.c gdttf.c -noinst_LTLIBRARIES=@GD_STATIC@ -EXTRA_LTLIBRARIES=libphpext_gd.la gd.la -libphpext_gd_la_SOURCES=$(SRC) - -phplib_LTLIBRARIES=@GD_SHARED@ -gd_la_SOURCES=$(SRC) -gd_la_LIBADD=@GD_LFLAGS@ @GD_LIBS@ -gd_la_LDFLAGS=-avoid-version -module -rpath $(phplibdir) -EXTRA_LIBS= - diff --git a/ext/gd/config.h.stub b/ext/gd/config.h.stub deleted file mode 100644 index 1fce8aa1a0..0000000000 --- a/ext/gd/config.h.stub +++ /dev/null @@ -1,14 +0,0 @@ -/* Define if you have the gd library (-lgd). */ -#define HAVE_LIBGD 0 - -/* Define if you have the gd version 1.3 library (-lgd). */ -#define HAVE_LIBGD13 0 - -#undef HAVE_GDIMAGECOLORRESOLVE -#undef FREETYPE_4BIT_ANTIALIAS_HACK -#undef HAVE_LIBFREETYPE -#undef HAVE_LIBTTF - -/* Some versions of GD support both PNG and GIF. Set defines for both. */ -#undef HAVE_GD_PNG -#undef HAVE_GD_GIF diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 deleted file mode 100644 index 192b7e7acd..0000000000 --- a/ext/gd/config.m4 +++ /dev/null @@ -1,193 +0,0 @@ -shared=no -AC_MSG_CHECKING(whether to include GD support) -AC_ARG_WITH(gd, -[ --without-gd Disable 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.], -[ - PHP_WITH_SHARED - - case "$withval" in - no) - AC_MSG_RESULT(no) ;; - yes) - AC_DEFINE(HAVE_LIBGD) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd" - else - AC_MSG_RESULT(yes (static)) - AC_ADD_LIBRARY(gd) - fi - old_LDFLAGS=$LDFLAGS - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) -dnl Some versions of GD support both PNG and GIF. Check for both. - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - ;; - *) -dnl A whole whack of possible places where this might be - test -f $withval/include/gd1.3/gd.h && GD_INCLUDE="$withval/include/gd1.3" - test -f $withval/include/gd/gd.h && GD_INCLUDE="$withval/include/gd" - test -f $withval/include/gd.h && GD_INCLUDE="$withval/include" - test -f $withval/gd1.3/gd.h && GD_INCLUDE="$withval/gd1.3" - test -f $withval/gd/gd.h && GD_INCLUDE="$withval/gd" - test -f $withval/gd.h && GD_INCLUDE="$withval" - - test -f $withval/lib/libgd.so && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.so && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.so && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.so && GD_LIB="$withval" - test -f $withval/gd/libgd.so && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.so && GD_LIB="$withval/gd1.3" - - test -f $withval/lib/libgd.a && GD_LIB="$withval/lib" - test -f $withval/lib/gd/libgd.a && GD_LIB="$withval/lib/gd" - test -f $withval/lib/gd1.3/libgd.a && GD_LIB="$withval/lib/gd1.3" - test -f $withval/libgd.a && GD_LIB="$withval" - test -f $withval/gd/libgd.a && GD_LIB="$withval/gd" - test -f $withval/gd1.3/libgd.a && GD_LIB="$withval/gd1.3" - if test -n "$GD_INCLUDE" && test -n "$GD_LIB" ; then - AC_DEFINE(HAVE_LIBGD) - if test "$shared" = "yes"; then - AC_MSG_RESULT(yes (shared)) - GD_LIBS="-lgd" - GD_LFLAGS="-L$GD_LIB" - else - AC_MSG_RESULT(yes (static)) - AC_ADD_LIBRARY_WITH_PATH(gd, $GD_LIB) - fi - old_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -L$GD_LIB" - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - else - AC_MSG_ERROR([Unable to find libgd.(a|so) anywhere under $withval]) - fi ;; - esac -],[ - AC_CHECK_LIB(gd, gdImageLine) - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then - old_LIBS=$LIBS - AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ]) - LIBS="$LIBS -lpng -lz" - AC_CHECK_LIB(gd, gdImageColorResolve, [AC_DEFINE(HAVE_GDIMAGECOLORRESOLVE,1)]) - AC_CHECK_LIB(gd, gdImageCreateFromPng, [AC_DEFINE(HAVE_GD_PNG, 1)]) - AC_CHECK_LIB(gd, gdImageCreateFromGif, [AC_DEFINE(HAVE_GD_GIF, 1)]) - - LIBS=$old_LIBS - LDFLAGS=$old_LDFLAGS - if test "$ac_cv_lib_gd_gdImageCreateFromPng" = "yes"; then - AC_ADD_LIBRARY(png) - AC_ADD_LIBRARY(z) - fi - ac_cv_lib_gd_gdImageLine=yes - fi -]) -if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then - CHECK_TTF="yes" - AC_ARG_WITH(ttf, - [ --with-ttf[=DIR] Include Freetype support],[ - if test $withval = "no" ; then - CHECK_TTF="" - else - CHECK_TTF="$withval" - fi - ]) - - AC_MSG_CHECKING(whether to include ttf support) - if test -n "$CHECK_TTF" ; then - for i in /usr /usr/local "$CHECK_TTF" ; do - if test -f "$i/include/truetype.h" ; then - FREETYPE_DIR="$i" - fi - if test -f "$i/include/freetype.h" ; then - TTF_DIR="$i" - fi - done - if test -n "$FREETYPE_DIR" ; then - AC_DEFINE(HAVE_LIBFREETYPE) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lfreetype" - GD_LFLAGS="$GD_LFLAGS -L$FREETYPE_DIR/lib" - else - AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib) - fi - AC_ADD_INCLUDE($FREETYPE_DIR/include) - AC_MSG_RESULT(yes) - else - if test -n "$TTF_DIR" ; then - AC_DEFINE(HAVE_LIBTTF) - if test "$shared" = "yes"; then - GD_LIBS="$GD_LIBS -lttf" - GD_LFLAGS="$GD_LFLAGS -L$TTF_DIR/lib" - else - AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib) - fi - AC_ADD_INCLUDE($TTF_DIR/include) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - fi - else - AC_MSG_RESULT(no) - fi - - if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then - GD_INCLUDE="/usr/pkg/include/gd" - fi - - AC_MSG_CHECKING(whether to enable 4bit antialias hack with FreeType2) - AC_ARG_ENABLE(freetype-4bit-antialias-hack, - [ --enable-freetype-4bit-antialias-hack - Include support for FreeType2 (experimental).],[ - if test "$enableval" = "yes" ; then - AC_DEFINE(FREETYPE_4BIT_ANTIALIAS_HACK, 1) - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - ],[ - AC_MSG_RESULT(no) - ]) - - AC_EXPAND_PATH($GD_INCLUDE, GD_INCLUDE) - AC_ADD_INCLUDE($GD_INCLUDE) - PHP_EXTENSION(gd, $shared) - if test "$shared" != "yes"; then - GD_STATIC="libphpext_gd.la" - else - GD_SHARED="gd.la" - fi -fi - -AC_SUBST(GD_LFLAGS) -AC_SUBST(GD_LIBS) -AC_SUBST(GD_STATIC) -AC_SUBST(GD_SHARED) diff --git a/ext/gd/gd.c b/ext/gd/gd.c deleted file mode 100644 index 7296b3e919..0000000000 --- a/ext/gd/gd.c +++ /dev/null @@ -1,1940 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | Stig Bakken | - | Jim Winstead | - +----------------------------------------------------------------------+ - */ - -/* $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 */ - -#include "php.h" -#include "ext/standard/head.h" -#include -#include "SAPI.h" -#include "php_gd.h" - -#if HAVE_SYS_WAIT_H -# include -#endif -#if HAVE_UNISTD_H -# include -#endif -#if WIN32|WINNT -# include -# include -#endif - -#if HAVE_LIBGD -#include -#include /* 1 Tiny font */ -#include /* 2 Small font */ -#include /* 3 Medium bold font */ -#include /* 4 Large font */ -#include /* 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 php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int); -#endif - -#ifdef THREAD_SAFE -DWORD GDlibTls; -static int numthreads=0; -void *gdlib_mutex=NULL; - -typedef struct gdlib_global_struct{ - int le_gd; - int le_gd_font; -} gdlib_global_struct; - -# define GD_GLOBAL(a) gdlib_globals->a -# define GD_TLS_VARS gdlib_global_struct *gdlib_globals = TlsGetValue(GDlibTls); - -#else -# define GD_GLOBAL(a) a -# define GD_TLS_VARS -int le_gd; -int le_gd_font; -#endif - -function_entry gd_functions[] = { - PHP_FE(imagearc, NULL) - PHP_FE(imagechar, NULL) - PHP_FE(imagecharup, NULL) - PHP_FE(imagecolorallocate, NULL) - PHP_FE(imagecolorat, NULL) - PHP_FE(imagecolorclosest, 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(imagecopyresized, NULL) - PHP_FE(imagecreate, NULL) -#ifdef HAVE_GD_PNG - PHP_FE(imagecreatefrompng, NULL) - PHP_FE(imagepng, NULL) -#endif -#ifdef HAVE_GD_GIF - PHP_FE(imagecreatefromgif, NULL) - PHP_FE(imagegif, NULL) -#endif - PHP_FE(imagedestroy, 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) -#ifdef ENABLE_GD_TTF - PHP_FE(imagettfbbox, NULL) - PHP_FE(imagettftext, NULL) -#endif - {NULL, NULL, NULL} -}; - -php3_module_entry gd_module_entry = { - "gd", gd_functions, PHP_MINIT(gd), PHP_MSHUTDOWN(gd), NULL, NULL, PHP_MINFO(gd), STANDARD_MODULE_PROPERTIES -}; - -#ifdef COMPILE_DL_GD -# include "dl/phpdl.h" -DLEXPORT php3_module_entry *get_module(void) { return &gd_module_entry; } -#endif - - -#define PolyMaxPoints 256 - - -PHP_MINIT_FUNCTION(gd) -{ -#if defined(THREAD_SAFE) - gdlib_global_struct *gdlib_globals; - PHP3_MUTEX_ALLOC(gdlib_mutex); - PHP3_MUTEX_LOCK(gdlib_mutex); - numthreads++; - if (numthreads==1){ - if (!PHP3_TLS_PROC_STARTUP(GDlibTls)){ - PHP3_MUTEX_UNLOCK(gdlib_mutex); - PHP3_MUTEX_FREE(gdlib_mutex); - return FAILURE; - } - } - PHP3_MUTEX_UNLOCK(gdlib_mutex); - if(!PHP3_TLS_THREAD_INIT(GDlibTls,gdlib_globals,gdlib_global_struct)){ - PHP3_MUTEX_FREE(gdlib_mutex); - return FAILURE; - } -#endif - GD_GLOBAL(le_gd) = register_list_destructors(gdImageDestroy, NULL); - GD_GLOBAL(le_gd_font) = register_list_destructors(php3_free_gd_font, NULL); - return SUCCESS; -} - -PHP_MINFO_FUNCTION(gd) -{ - /* need to use a PHPAPI function here because it is external module in windows */ -#if HAVE_GDIMAGECOLORRESOLVE - php_printf("Version 1.6.2 or higher"); -#elif HAVE_LIBGD13 - php_printf("Version between 1.3 and 1.6.1"); -#else - php_printf("Version 1.2"); -#endif - -#ifdef ENABLE_GD_TTF - php_printf(" with FreeType support"); -#if HAVE_LIBFREETYPE - php_printf(" (linked with freetype)"); -#elif HAVE_LIBTTF - php_printf(" (linked with ttf library)"); -#else - php_printf(" (linked with unknown library)"); -#endif -#endif - - php_printf(" which supports:"); - -#ifdef HAVE_GD_GIF - php_printf(" GIF"); -#endif -#ifdef HAVE_GD_PNG - php_printf(" PNG"); -#endif -} - -PHP_MSHUTDOWN_FUNCTION(gd) -{ - GD_TLS_VARS; -#ifdef THREAD_SAFE - PHP3_TLS_THREAD_FREE(gdlib_globals); - PHP3_MUTEX_LOCK(gdlib_mutex); - numthreads--; - if (numthreads<1) { - PHP3_TLS_PROC_SHUTDOWN(GDlibTls); - PHP3_MUTEX_UNLOCK(gdlib_mutex); - PHP3_MUTEX_FREE(gdlib_mutex); - return SUCCESS; - } - PHP3_MUTEX_UNLOCK(gdlib_mutex); -#endif - return SUCCESS; -} - -/* Need this for cpdf. See also comment in file.c php3i_get_le_fp() */ -PHPAPI int phpi_get_le_gd(void){ - GD_TLS_VARS; - return GD_GLOBAL(le_gd); -} - -#ifndef HAVE_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 - -void php3_free_gd_font(gdFontPtr fp) -{ - if (fp->data) { - efree(fp->data); - } - efree(fp); -} - -/* {{{ proto int imageloadfont(string filename) - Load a new font */ -PHP_FUNCTION(imageloadfont) { - pval *file; - int hdr_size = sizeof(gdFont) - sizeof(char *); - int ind, body_size, n=0, b; - gdFontPtr font; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "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; - } - body_size = font->w * font->h * font->nchars; - 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 + php3_list_insert(font, GD_GLOBAL(le_gd_font)); - - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagecreate(int x_size, int y_size) - Create a new image */ -PHP_FUNCTION(imagecreate) -{ - pval *x_size, *y_size; - int ind; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &x_size, &y_size) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(x_size); - convert_to_long(y_size); - - im = gdImageCreate(x_size->value.lval, y_size->value.lval); - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - - RETURN_LONG(ind); -} -/* }}} */ - -#ifdef HAVE_GD_PNG - -/* {{{ proto int imagecreatefrompng(string filename) - Create a new image from file or URL */ -void php3_imagecreatefrompng (INTERNAL_FUNCTION_PARAMETERS) { - pval *file; - int ind; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string(file); - fn = file->value.str.val; -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL); -#endif - if (!fp) { - php3_strip_url_passwd(fn); - php3_error(E_WARNING, - "ImageCreateFromPng: Unable to open %s for reading", fn); - RETURN_FALSE; - } - im = gdImageCreateFromPng (fp); - fflush(fp); - fclose(fp); - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagepng(int im [, string filename]) - Output image to browser or file */ -void php3_imagepng (INTERNAL_FUNCTION_PARAMETERS) { - pval *imgind, *file; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int argc; - int ind_type; - int output=1; - GD_TLS_VARS; - argc = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParameters(ht, argc, &imgind, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(imgind); - if (argc == 2) { - convert_to_string(file); - fn = file->value.str.val; - if (!fn || fn == empty_string || _php3_check_open_basedir(fn)) { - php3_error(E_WARNING, "ImagePng: Invalid filename"); - RETURN_FALSE; - } - } - im = php3_list_find(imgind->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php3_error(E_WARNING, "ImagePng: unable to find image pointer"); - RETURN_FALSE; - } - if (argc == 2) { - fp = fopen(fn, "wb"); - if (!fp) { - php3_error(E_WARNING, "ImagePng: unable to open %s for writing", fn); - RETURN_FALSE; - } - gdImagePng (im,fp); - fflush(fp); - fclose(fp); - } - else { - int b; - FILE *tmp; - char buf[4096]; - tmp = tmpfile(); - if (tmp == NULL) { - php3_error(E_WARNING, "Unable to open temporary file"); - RETURN_FALSE; - } - output = php3_header(); - if (output) { - gdImagePng (im, tmp); - fseek(tmp, 0, SEEK_SET); -#if APACHE && defined(CHARSET_EBCDIC) - /* 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) { - php3_write(buf, b); - } - } - fclose(tmp); - /* the temporary file is automatically deleted */ - } - RETURN_TRUE; -} -/* }}} */ - -#endif /* HAVE_GD_PNG */ - -#ifdef HAVE_GD_GIF - -/* {{{ proto int imagecreatefromgif(string filename) - Create a new image from file or URL */ -PHP_FUNCTION(imagecreatefromgif ) -{ - pval *file; - int ind; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int issock=0, socketd=0; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - fn = file->value.str.val; - -#if WIN32|WINNT - fp = fopen(file->value.str.val, "rb"); -#else - fp = php3_fopen_wrapper(file->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL); -#endif - if (!fp) { - php3_strip_url_passwd(fn); - php_error(E_WARNING, - "ImageCreateFromGif: Unable to open %s for reading", fn); - RETURN_FALSE; - } - - im = gdImageCreateFromGif (fp); - - fflush(fp); - fclose(fp); - - ind = php3_list_insert(im, GD_GLOBAL(le_gd)); - - RETURN_LONG(ind); -} -/* }}} */ - -/* {{{ proto int imagegif(int im [, string filename]) - Output image to browser or file */ -PHP_FUNCTION(imagegif ) -{ - pval *imgind, *file; - gdImagePtr im; - char *fn=NULL; - FILE *fp; - int argc; - int ind_type; - int output=1; - GD_TLS_VARS; - - argc = ARG_COUNT(ht); - if (argc < 1 || argc > 2 || getParameters(ht, argc, &imgind, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - - if (argc == 2) { - convert_to_string(file); - fn = file->value.str.val; - if (!fn || fn == empty_string || _php3_check_open_basedir(fn)) { - php_error(E_WARNING, "ImageGif: Invalid filename"); - RETURN_FALSE; - } - } - - im = php3_list_find(imgind->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageGif: unable to find image pointer"); - RETURN_FALSE; - } - - if (argc == 2) { - fp = fopen(fn, "wb"); - if (!fp) { - php_error(E_WARNING, "ImageGif: unable to open %s for writing", fn); - RETURN_FALSE; - } - gdImageGif (im,fp); - fflush(fp); - fclose(fp); - } - else { - int b; - FILE *tmp; - char buf[4096]; - - tmp = tmpfile(); - if (tmp == NULL) { - php_error(E_WARNING, "Unable to open temporary file"); - RETURN_FALSE; - } - - output = php3_header(); - - if (output) { - gdImageGif (im, tmp); - fseek(tmp, 0, SEEK_SET); -#if APACHE && defined(CHARSET_EBCDIC) - { - SLS_FETCH(); - /* This is a binary file already: avoid EBCDIC->ASCII conversion */ - ap_bsetflag(((request_rec *) SG(server_context))->connection->client, B_EBCDIC2ASCII, 0); - } -#endif - while ((b = fread(buf, 1, sizeof(buf), tmp)) > 0) { - php3_write(buf, b); - } - } - - fclose(tmp); - /* the temporary file is automatically deleted */ - } - - RETURN_TRUE; -} -/* }}} */ - -#endif /* HAVE_GD_GIF */ - -/* {{{ proto int imagedestroy(int im) - Destroy an image */ -PHP_FUNCTION(imagedestroy) -{ - pval *imgind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &imgind) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - - php3_list_delete(imgind->value.lval); - - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue) - Allocate a color for an image */ -PHP_FUNCTION(imagecolorallocate) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorAllocate: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorAllocate(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* im, x, y */ -/* {{{ proto int imagecolorat(int im, int x, int y) - Get the index of the color of a pixel */ -PHP_FUNCTION(imagecolorat) -{ - pval *imgind, *x, *y; - int ind, ind_type; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &imgind, &x, &y) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(x); - convert_to_long(y); - - ind = imgind->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorAt: Unable to find image pointer"); - RETURN_FALSE; - } - if (gdImageBoundsSafe(im, x->value.lval, y->value.lval)) { -#if HAVE_LIBGD13 - RETURN_LONG(im->pixels[y->value.lval][x->value.lval]); -#else - RETURN_LONG(im->pixels[x->value.lval][y->value.lval]); -#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) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorClosest: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorClosest(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolordeallocate(int im, int index) - De-allocate a color for an image */ -PHP_FUNCTION(imagecolordeallocate) -{ - pval *imgind, *index; - int ind, ind_type, col; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &imgind, &index) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(index); - ind = imgind->value.lval; - col = index->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorDeallocate: Unable to find image pointer"); - RETURN_FALSE; - } - - 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) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorResolve: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorResolve(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolorexact(int im, int red, int green, int blue) - Get the index of the specified color */ -PHP_FUNCTION(imagecolorexact) -{ - pval *imgind, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &imgind, &red, - &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorExact: Unable to find image pointer"); - RETURN_FALSE; - } - col = gdImageColorExact(im, r, g, b); - RETURN_LONG(col); -} -/* }}} */ - -/* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue) - Set the color for the specified palette index */ -PHP_FUNCTION(imagecolorset) -{ - pval *imgind, *color, *red, *green, *blue; - int ind, ind_type; - int col; - int r, g, b; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || getParameters(ht, 5, &imgind, &color, &red, &green, &blue) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(color); - convert_to_long(red); - convert_to_long(green); - convert_to_long(blue); - - ind = imgind->value.lval; - col = color->value.lval; - r = red->value.lval; - g = green->value.lval; - b = blue->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorSet: Unable to find image pointer"); - RETURN_FALSE; - } - if (col >= 0 && col < gdImageColorsTotal(im)) { - im->red[col] = r; - im->green[col] = g; - im->blue[col] = b; - } - else { - RETURN_FALSE; - } -} -/* }}} */ - -/* {{{ proto array imagecolorsforindex(int im, int col) - Get the colors for an index */ -PHP_FUNCTION(imagecolorsforindex) -{ - pval *imgind, *index; - int col, ind, ind_type; - gdImagePtr im; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &imgind, &index) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(imgind); - convert_to_long(index); - ind = imgind->value.lval; - col = index->value.lval; - - im = php3_list_find(ind, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "ImageColorsForIndex: Unable to find image pointer"); - RETURN_FALSE; - } - - 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 imagesetpixel(int im, int x, int y, int col) - Set a single pixel */ -PHP_FUNCTION(imagesetpixel) -{ - pval *imarg, *xarg, *yarg, *colarg; - gdImagePtr im; - int col, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &imarg, &xarg, &yarg, &colarg) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(imarg); - convert_to_long(xarg); - convert_to_long(yarg); - convert_to_long(colarg); - - col = colarg->value.lval; - y = yarg->value.lval; - x = xarg->value.lval; - - im = php3_list_find(imarg->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageSetPixel(im,x,y,col); - - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col) - Draw a line */ -PHP_FUNCTION(imageline) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageLine(im,x1,y1,x2,y2,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) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageDashedLine(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col) - Draw a rectangle */ -PHP_FUNCTION(imagerectangle) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageRectangle(im,x1,y1,x2,y2,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x1, y1, x2, y2, col */ -/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col) - Draw a filled rectangle */ -PHP_FUNCTION(imagefilledrectangle) -{ - pval *IM, *COL, *X1, *Y1, *X2, *Y2; - gdImagePtr im; - int col, y2, x2, y1, x1; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &X1, &Y1, &X2, &Y2, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X1); - convert_to_long(Y1); - convert_to_long(X2); - convert_to_long(Y2); - convert_to_long(COL); - - x1 = X1->value.lval; - y1 = Y1->value.lval; - x2 = X2->value.lval; - y2 = Y2->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFilledRectangle(im,x1,y1,x2,y2,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) -{ - pval *COL, *E, *ST, *H, *W, *CY, *CX, *IM; - gdImagePtr im; - int col, e, st, h, w, cy, cx; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 8 || - getParameters(ht, 8, &IM, &CX, &CY, &W, &H, &ST, &E, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(CX); - convert_to_long(CY); - convert_to_long(W); - convert_to_long(H); - convert_to_long(ST); - convert_to_long(E); - convert_to_long(COL); - - col = COL->value.lval; - e = E->value.lval; - st = ST->value.lval; - h = H->value.lval; - w = W->value.lval; - cy = CY->value.lval; - cx = CX->value.lval; - - if (e < 0) { - e %= 360; - } - if (st < 0) { - st %= 360; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageArc(im,cx,cy,w,h,st,e,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x, y, border, col */ -/* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col) - Flood fill to specific color */ -PHP_FUNCTION(imagefilltoborder) -{ - pval *IM, *X, *Y, *BORDER, *COL; - gdImagePtr im; - int col, border, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 5 || - getParameters(ht, 5, &IM, &X, &Y, &BORDER, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X); - convert_to_long(Y); - convert_to_long(BORDER); - convert_to_long(COL); - - col = COL->value.lval; - border = BORDER->value.lval; - y = Y->value.lval; - x = X->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFillToBorder(im,x,y,border,col); - RETURN_TRUE; -} -/* }}} */ - -/* im, x, y, col */ -/* {{{ proto int imagefill(int im, int x, int y, int col) - Flood fill */ -PHP_FUNCTION(imagefill) -{ - pval *IM, *X, *Y, *COL; - gdImagePtr im; - int col, y, x; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &IM, &X, &Y, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(X); - convert_to_long(Y); - convert_to_long(COL); - - col = COL->value.lval; - y = Y->value.lval; - x = X->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageFill(im,x,y,col); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecolorstotal(int im) - Find out the number of colors in an image's palette */ -PHP_FUNCTION(imagecolorstotal) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageColorsTotal(im)); -} -/* }}} */ - -/* im, col */ -/* {{{ proto int imagecolortransparent(int im [, int col]) - Define a color as transparent */ -PHP_FUNCTION(imagecolortransparent) -{ - pval *IM, *COL = NULL; - gdImagePtr im; - int col; - int ind_type; - GD_TLS_VARS; - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &IM, &COL) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(COL); - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (COL != NULL) { - col = COL->value.lval; - gdImageColorTransparent(im,col); - } - col = gdImageGetTransparent(im); - RETURN_LONG(col); -} -/* }}} */ - -/* im, interlace */ -/* {{{ proto int imageinterlace(int im [, int interlace]) - Enable or disable interlace */ -PHP_FUNCTION(imageinterlace) -{ - pval *IM, *INT = NULL; - gdImagePtr im; - int interlace; - int ind_type; - GD_TLS_VARS; - - switch(ARG_COUNT(ht)) { - case 1: - if (getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - break; - case 2: - if (getParameters(ht, 2, &IM, &INT) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(INT); - break; - default: - WRONG_PARAM_COUNT; - } - convert_to_long(IM); - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (INT != NULL) { - interlace = INT->value.lval; - gdImageInterlace(im,interlace); - } - interlace = gdImageGetInterlaced(im); - RETURN_LONG(interlace); -} -/* }}} */ - -/* arg = 0 normal polygon - arg = 1 filled polygon */ -/* im, points, num_points, col */ -static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) { - pval *IM, *POINTS, *NPOINTS, *COL, **var; - gdImagePtr im; - gdPoint points[PolyMaxPoints]; - int npoints, col, nelem, i; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 4 || - getParameters(ht, 4, &IM, &POINTS, &NPOINTS, &COL) == FAILURE) - { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(NPOINTS); - convert_to_long(COL); - - npoints = NPOINTS->value.lval; - col = COL->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - if (POINTS->type != IS_ARRAY) { - php_error(E_WARNING, "2nd argument to imagepolygon not an array"); - RETURN_FALSE; - } - -/* - ** we shouldn't need this check, should we? ** - - if (!ParameterPassedByReference(ht, 2)) { - php_error(E_WARNING, "2nd argument to imagepolygon not passed by reference"); - 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; - } - - if (npoints > PolyMaxPoints) { - php_error(E_WARNING, "maximum %d points", PolyMaxPoints); - RETURN_FALSE; - } - - 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 = (*var)->value.lval; - } - if (zend_hash_index_find(POINTS->value.ht, (i * 2) + 1, (void **)&var) == SUCCESS) { - SEPARATE_ZVAL(var); - convert_to_long(*var); - points[i].y = (*var)->value.lval; - } - } - - if (filled) { - gdImageFilledPolygon(im, points, npoints, col); - } - else { - gdImagePolygon(im, points, npoints, col); - } - - RETURN_TRUE; -} - - -/* {{{ proto int imagepolygon(int im, array point, int num_points, int col) - Draw a polygon */ -PHP_FUNCTION(imagepolygon) -{ - _php3_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) -{ - _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - - -static gdFontPtr _php3_find_gd_font(int size) -{ - gdFontPtr font; - int ind_type; - GD_TLS_VARS; - - 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 = php3_list_find(size - 5, &ind_type); - if (!font || ind_type != GD_GLOBAL(le_gd_font)) { - if (size < 1) { - font = gdFontTiny; - } else { - font = gdFontGiant; - } - } - break; - } - - return font; -} - - -/* - * arg = 0 ImageFontWidth - * arg = 1 ImageFontHeight - */ -static void _php3_imagefontsize(INTERNAL_FUNCTION_PARAMETERS, int arg) -{ - pval *SIZE; - gdFontPtr font; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &SIZE) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_long(SIZE); - font = _php3_find_gd_font(SIZE->value.lval); - RETURN_LONG(arg ? font->h : font->w); -} - - -/* {{{ proto int imagefontwidth(int font) - Get font width */ -PHP_FUNCTION(imagefontwidth) -{ - _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); -} -/* }}} */ - -/* {{{ proto int imagefontheight(int font) -Get font height */ -PHP_FUNCTION(imagefontheight) -{ - _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); -} -/* }}} */ - - -/* workaround for a bug in gd 1.2 */ -void _php3_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++; - } -} - -/* - * arg = 0 ImageChar - * arg = 1 ImageCharUp - * arg = 2 ImageString - * arg = 3 ImageStringUp - */ -static void _php3_imagechar(INTERNAL_FUNCTION_PARAMETERS, int mode) { - pval *IM, *SIZE, *X, *Y, *C, *COL; - gdImagePtr im; - int ch = 0, col, x, y, size, i, l = 0; - unsigned char *string = NULL; - int ind_type; - gdFontPtr font; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 6 || - getParameters(ht, 6, &IM, &SIZE, &X, &Y, &C, &COL) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(IM); - convert_to_long(SIZE); - convert_to_long(X); - convert_to_long(Y); - convert_to_string(C); - convert_to_long(COL); - - col = COL->value.lval; - - if (mode < 2) { - ch = (int)((unsigned char)*(C->value.str.val)); - } else { - string = (unsigned char *) estrndup(C->value.str.val,C->value.str.len); - l = strlen(string); - } - - y = Y->value.lval; - x = X->value.lval; - size = SIZE->value.lval; - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - if (string) { - efree(string); - } - RETURN_FALSE; - } - - font = _php3_find_gd_font(size); - - switch(mode) { - case 0: - gdImageChar(im, font, x, y, ch, col); - break; - case 1: - _php3_gdimagecharup(im, font, x, y, ch, col); - break; - case 2: - for (i = 0; (i < l); i++) { - gdImageChar(im, font, x, y, (int)((unsigned char)string[i]), - col); - x += font->w; - } - break; - case 3: { - for (i = 0; (i < l); i++) { - /* _php3_gdimagecharup(im, font, x, y, (int)string[i], col); */ - gdImageCharUp(im, font, x, y, (int)string[i], col); - y -= font->w; - } - break; - } - } - if (string) { - efree(string); - } - RETURN_TRUE; -} - -/* {{{ proto int imagechar(int im, int font, int x, int y, string c, int col) - Draw a character */ -PHP_FUNCTION(imagechar) { - _php3_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) { - _php3_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) { - _php3_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) { - _php3_imagechar(INTERNAL_FUNCTION_PARAM_PASSTHRU, 3); -} -/* }}} */ - -/* {{{ proto int imagecopy(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int srcW, int srcH) - Copy part of an image */ -PHP_FUNCTION(imagecopy) -{ - pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY; - gdImagePtr im_dst; - gdImagePtr im_src; - int srcH, srcW, srcY, srcX, dstY, dstX; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 8 || - getParameters(ht, 8, &DIM, &SIM, &DX, &DY, &SX, &SY, &SW, &SH) - == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(SIM); - convert_to_long(DIM); - convert_to_long(SX); - convert_to_long(SY); - convert_to_long(SW); - convert_to_long(SH); - convert_to_long(DX); - convert_to_long(DY); - - srcX = SX->value.lval; - srcY = SY->value.lval; - srcH = SH->value.lval; - srcW = SW->value.lval; - dstX = DX->value.lval; - dstY = DY->value.lval; - - im_src = php3_list_find(SIM->value.lval, &ind_type); - if (!im_src || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - im_dst = php3_list_find(DIM->value.lval, &ind_type); - if (!im_dst || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - gdImageCopy(im_dst, im_src, dstX, dstY, srcX, srcY, srcW, srcH); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto int imagecopyresized(int dst_im, int src_im, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH); - Copy and resize part of an image */ -PHP_FUNCTION(imagecopyresized) -{ - pval *SIM, *DIM, *SX, *SY, *SW, *SH, *DX, *DY, *DW, *DH; - gdImagePtr im_dst; - gdImagePtr im_src; - int srcH, srcW, dstH, dstW, srcY, srcX, dstY, dstX; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 10 || - getParameters(ht, 10, &DIM, &SIM, &DX, &DY, &SX, &SY, &DW, &DH, - &SW, &SH) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(SIM); - convert_to_long(DIM); - convert_to_long(SX); - convert_to_long(SY); - convert_to_long(SW); - convert_to_long(SH); - convert_to_long(DX); - convert_to_long(DY); - convert_to_long(DW); - convert_to_long(DH); - - srcX = SX->value.lval; - srcY = SY->value.lval; - srcH = SH->value.lval; - srcW = SW->value.lval; - dstX = DX->value.lval; - dstY = DY->value.lval; - dstH = DH->value.lval; - dstW = DW->value.lval; - - im_src = php3_list_find(SIM->value.lval, &ind_type); - if (!im_src || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - im_dst = php3_list_find(DIM->value.lval, &ind_type); - if (!im_dst || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - 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) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageSX(im)); -} -/* }}} */ - -/* {{{ proto int imagesy(int im) -Get image height */ -PHP_FUNCTION(imagesy) -{ - pval *IM; - gdImagePtr im; - int ind_type; - GD_TLS_VARS; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &IM) == FAILURE) { - WRONG_PARAM_COUNT; - } - - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - RETURN_LONG(gdImageSY(im)); -} -/* }}} */ - -#ifdef ENABLE_GD_TTF - -#define TTFTEXT_DRAW 0 -#define TTFTEXT_BBOX 1 - -/* {{{ 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) -{ - php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_BBOX); -} -/* }}} */ - -/* {{{ 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) -{ - php3_imagettftext_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, TTFTEXT_DRAW); -} -/* }}} */ - -static -void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode) -{ - pval *IM, *PTSIZE, *ANGLE, *X, *Y, *C, *FONTNAME, *COL; - gdImagePtr im; - int col, x, y, l=0, i; - int brect[8]; - double ptsize, angle; - unsigned char *string = NULL, *fontname = NULL; - int ind_type; - char *error; - - GD_TLS_VARS; - - if (mode == TTFTEXT_BBOX) { - if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &PTSIZE, &ANGLE, &FONTNAME, &C) == FAILURE) { - WRONG_PARAM_COUNT; - } - } else { - if (ARG_COUNT(ht) != 8 || getParameters(ht, 8, &IM, &PTSIZE, &ANGLE, &X, &Y, &COL, &FONTNAME, &C) == FAILURE) { - WRONG_PARAM_COUNT; - } - } - - convert_to_double(PTSIZE); - convert_to_double(ANGLE); - convert_to_string(FONTNAME); - convert_to_string(C); - if (mode == TTFTEXT_BBOX) { - im = NULL; - col = x = y = -1; - } else { - convert_to_long(X); - convert_to_long(Y); - convert_to_long(IM); - convert_to_long(COL); - col = COL->value.lval; - y = Y->value.lval; - x = X->value.lval; - im = php3_list_find(IM->value.lval, &ind_type); - if (!im || ind_type != GD_GLOBAL(le_gd)) { - php_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - } - - ptsize = PTSIZE->value.dval; - angle = ANGLE->value.dval * (M_PI/180); /* convert to radians */ - - string = (unsigned char *) C->value.str.val; - l = strlen(string); - fontname = (unsigned char *) FONTNAME->value.str.val; - - error = gdttf(im, brect, col, fontname, ptsize, angle, x, y, string); - - if (error) { - php_error(E_WARNING, 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 -#endif - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - */ 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 - -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 cdfbf71f95..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 */ -/*********************************************************/ - -#ifndef _OSD_POSIX -#include -#else -#include /* 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 d26a4926d4..0000000000 --- a/ext/gd/gdt1.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -void _php3_free_ps_font(gd_ps_font *f_ind) -{ - T1_DeleteFont(f_ind->font_id); - efree(f_ind); -} - -void _php3_free_ps_enc(char **enc) -{ - T1_DeleteEncoding(enc); -} - -/* {{{ proto int imagepsloadfont(string pathname) -Load a new font from specified file */ -void php3_imagepsloadfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *file; - int l_ind; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &file) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_string(file); - - f_ind = emalloc(sizeof(gd_ps_font)); - f_ind->font_id = T1_AddFont(file->value.str.val); - - if (f_ind->font_id < 0) { - l_ind = f_ind->font_id; - efree(f_ind); - switch (l_ind) { - case -1: - php3_error(E_WARNING, "Couldn't find the font file"); - RETURN_FALSE; - break; - case -2: - case -3: - php3_error(E_WARNING, "Memory allocation fault in t1lib"); - RETURN_FALSE; - break; - default: - php3_error(E_WARNING, "An unknown error occurred in t1lib"); - RETURN_FALSE; - break; - } - } - - T1_LoadFont(f_ind->font_id); - f_ind->extend = 1; - l_ind = php3_list_insert(f_ind, GD_GLOBAL(le_ps_font)); - RETURN_LONG(l_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 */ -/* -void php3_imagepscopyfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt; - int l_ind, type; - gd_ps_font *nf_ind, *of_ind; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fnt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - - of_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_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: - php3_error(E_WARNING, "FontID %d is not loaded in memory", l_ind); - RETURN_FALSE; - break; - case -2: - php3_error(E_WARNING, "Tried to copy a logical font"); - RETURN_FALSE; - break; - case -3: - php3_error(E_WARNING, "Memory allocation fault in t1lib"); - RETURN_FALSE; - break; - default: - php3_error(E_WARNING, "An unknown error occurred in t1lib"); - RETURN_FALSE; - break; - } - } - - nf_ind->extend = 1; - l_ind = php3_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 */ -void php3_imagepsfreefont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt; - int type; - - if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &fnt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - - php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - php3_list_delete(fnt->value.lval); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool imagepsencodefont(int font_index, string filename) -To change a fonts character encoding vector */ -void php3_imagepsencodefont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *enc; - char **enc_vector; - int type; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &enc) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_string(enc); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_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) { - php3_error(E_WARNING, "Couldn't load encoding vector from %s", enc->value.str.val); - RETURN_FALSE; - } - - T1_DeleteAllSizes(f_ind->font_id); - if (T1_ReencodeFont(f_ind->font_id, enc_vector)) { - T1_DeleteEncoding(enc_vector); - php3_error(E_WARNING, "Couldn't reencode font"); - RETURN_FALSE; - } - php3_list_insert(enc_vector, GD_GLOBAL(le_ps_enc)); - RETURN_TRUE; -} -/* }}} */ - -/* {{{ proto bool imagepsextendfont(int font_index, double extend) -Extend or or condense (if extend < 1) a font */ -void php3_imagepsextendfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *ext; - int type; - gd_ps_font *f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &ext) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_double(ext); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - if (T1_ExtendFont(f_ind->font_id, 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 */ -void php3_imagepsslantfont(INTERNAL_FUNCTION_PARAMETERS) { - pval *fnt, *slt; - int type; - gd_ps_font*f_ind; - - if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fnt, &slt) == FAILURE) { - WRONG_PARAM_COUNT; - } - - convert_to_long(fnt); - convert_to_double(slt); - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_error(E_WARNING, "%d is not a Type 1 font index", fnt->value.lval); - RETURN_FALSE; - } - - if (T1_SlantFont(f_ind->font_id, 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 */ -void php3_imagepstext(INTERNAL_FUNCTION_PARAMETERS) { - pval *img, *str, *fnt, *sz, *fg, *bg, *sp, *px, *py, *aas, *wd, *ang; - int i, j, x, y; - int space, type; - gd_ps_font *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; -#ifdef HAVE_LIBT1_OUTLINE - T1_OUTLINE *char_path, *str_path; - T1_TMATRIX *transform = NULL; -#endif - - switch(ARG_COUNT(ht)) { - case 8: - if (getParameters(ht, 8, &img, &str, &fnt, &sz, &fg, &bg, &px, &py) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - convert_to_long(fg); - convert_to_long(bg); - convert_to_long(px); - convert_to_long(py); - x = px->value.lval; - y = py->value.lval; - space = 0; - aa_steps = 4; - width = 0; - angle = 0; - break; - case 12: - if (getParameters(ht, 12, &img, &str, &fnt, &sz, &fg, &bg, &px, &py, &sp, &wd, &ang, &aas) == FAILURE) { - RETURN_FALSE; - } - convert_to_string(str); - convert_to_long(fnt); - convert_to_long(sz); - convert_to_long(sp); - convert_to_long(fg); - convert_to_long(bg); - convert_to_long(px); - convert_to_long(py); - x = px->value.lval; - y = py->value.lval; - convert_to_long(sp); - space = sp->value.lval; - convert_to_long(aas); - aa_steps = aas->value.lval; - convert_to_long(wd); - width = wd->value.lval; - convert_to_double(ang); - angle = ang->value.dval; - break; - default: - WRONG_PARAM_COUNT; - } - - bg_img = php3_list_find(img->value.lval, &type); - - if (!bg_img || type != GD_GLOBAL(le_gd)) { - php3_error(E_WARNING, "Unable to find image pointer"); - RETURN_FALSE; - } - - f_ind = php3_list_find(fnt->value.lval, &type); - - if (!f_ind || type != GD_GLOBAL(le_ps_font)) { - php3_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: - php3_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 - php3_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 */ -void php3_imagepsbbox(INTERNAL_FUNCTION_PARAMETERS) { - 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(ARG_COUNT(ht)) { - case 3: - if (getParameters(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 (getParameters(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 = php3_list_find(fnt->value.lval, &type); - - if (type != GD_GLOBAL(le_ps_font)) { - php3_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)); -} -/* }}} */ - -/* - * 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 253823fea4..0000000000 --- a/ext/gd/gdt1.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 | - | | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -/* - * 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 733800ab0d..0000000000 --- a/ext/gd/gdttf.c +++ /dev/null @@ -1,827 +0,0 @@ -/* gd interface to freetype library */ -/* */ -/* John Ellson ellson@lucent.com */ - -/* $Id$ */ - -#if WIN32|WINNT -#include "config.w32.h" -#else -#include "php_config.h" -#endif -#if HAVE_LIBTTF|HAVE_LIBFREETYPE -#include -#include -#include -#include -#include -#include "gdttf.h" -#include "gdcache.h" -#if HAVE_LIBFREETYPE -#include -#else -#include -#endif - -#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 */ -#if FREETYPE_4BIT_ANTIALIAS_HACK -#define TWEENCOLORCACHESIZE 128 -#else -#define TWEENCOLORCACHESIZE 32 -#endif - -/* 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 */ -#if FREETYPE_4BIT_ANTIALIAS_HACK -#define NUMCOLORS 16 -#else -#define NUMCOLORS 4 -#endif - -/* 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 - -#define MAX(a,b) ((a)>(b)?(a):(b)) -#define MIN(a,b) ((a)<(b)?(a):(b)) - -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; - 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. Å */ - 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; - short platform, encoding; - - a = (font_t *)malloc(sizeof(font_t)); - a->fontname = (char *)malloc(strlen(b->fontname) + 1); - strcpy(a->fontname,b->fontname); - 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 HAVE_LIBFREETYPE - if (err == 0x008) { /* The FT2 oldapi is missing this code */ -#else - if (err == TT_Err_Could_Not_Open_File) { -#endif - *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; - } - - 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) || - (platform == 2 && encoding == 1) || - (platform == 0)) { - TT_Get_CharMap(a->face, i, &a->char_map); - i = n+1; - } - } - - if (i == n) { - *error = "Sorry, but this font doesn't contain any Unicode mapping table"; - 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; - } - glyph_code = TT_Char_Index(b->font->char_map, 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++; - } - /**************/ - - len = gdTcl_UtfToUniChar(*next, &ch); - *next += len; - - 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 *string) -{ - 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=string; - 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|HAVE_LIBFREETYPE */ - -/* - * 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 86a5eca1fe..0000000000 --- a/ext/gd/gdttf.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $Id$ */ - -#ifdef _OSD_POSIX -#ifndef APACHE -#error On this EBCDIC platform, PHP3 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 *string); - diff --git a/ext/gd/php_gd.h b/ext/gd/php_gd.h deleted file mode 100644 index f5e92e4fbb..0000000000 --- a/ext/gd/php_gd.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997 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. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - | Stig Bakken | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _PHP_GD_H -#define _PHP_GD_H - -#define HAVE_GDIMAGECREATEFROMPNG 1 - -#if HAVE_LIBTTF|HAVE_LIBFREETYPE -#define ENABLE_GD_TTF -#endif - -#if COMPILE_DL -#undef HAVE_LIBGD -#define HAVE_LIBGD 1 -#endif - -#if HAVE_LIBGD - -#include - -extern php3_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 -extern int gdImageColorResolve(gdImagePtr, int, int, int); -#endif -PHP_FUNCTION(imagearc); -PHP_FUNCTION(imagechar); -PHP_FUNCTION(imagecharup); -PHP_FUNCTION(imagecolorallocate); -PHP_FUNCTION(imagecolorat); -PHP_FUNCTION(imagecolorclosest); -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(imagecopyresized); -PHP_FUNCTION(imagecreate); -PHP_FUNCTION(imagecreatefromgif ); -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(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); -PHP_FUNCTION(imagecreatefrompng); -PHP_FUNCTION(imagepng); -void php3_free_gd_font(gdFontPtr); -void _php3_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int); -PHP_FUNCTION(imagedashedline); -#ifdef ENABLE_GD_TTF -PHP_FUNCTION(imagettfbbox); -PHP_FUNCTION(imagettftext); -#endif -PHPAPI int phpi_get_le_gd(void); -#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/Makefile.am b/ext/gettext/Makefile.am deleted file mode 100644 index d6ef557cce..0000000000 --- a/ext/gettext/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_gettext.la -libphpext_gettext_la_SOURCES=gettext.c - diff --git a/ext/gettext/config.h.stub b/ext/gettext/config.h.stub deleted file mode 100644 index 54fe1349ce..0000000000 --- a/ext/gettext/config.h.stub +++ /dev/null @@ -1,3 +0,0 @@ -/* define if you want to use the gettext extension */ - -#define HAVE_LIBINTL 0 diff --git a/ext/gettext/config.m4 b/ext/gettext/config.m4 deleted file mode 100644 index b14673527a..0000000000 --- a/ext/gettext/config.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl $Id$ -dnl config.m4 for extension gettext -dnl don't forget to call PHP_EXTENSION(gettext) - -AC_MSG_CHECKING(whether to include GNU gettext support) -AC_ARG_WITH(gettext, -[ --with-gettext[=DIR] Include GNU gettext support. DIR is the gettext - install directory, defaults to /usr/local], -[ - if test "$withval" != "no"; then - if test "$withval" = "yes"; then - GETTEXT_INCDIR=/usr/local/include - test -f /usr/local/include/libintl.h && GETTEXT_INCDIR=/usr/local/include/ - GETTEXT_LIBDIR=/usr/local/lib - else - GETTEXT_INCDIR=$withval/include - test -f $withval/include/libintl.h && GETTEXT_INCDIR=$withval/include - GETTEXT_LIBDIR=$withval/lib - fi - GETTEXT_INCLUDE=-I$GETTEXT_INCDIR - GETTEXT_LFLAGS=-L$GETTEXT_LIBDIR - O_CPPFLAGS="$CPPFLAGS" - O_LDFLAGS=$LDFLAGS - CPPFLAGS="$CPPFLAGS -I$GETTEXT_INCDIR" - LDFLAGS="$LDFLAGS -L$GETTEXT_LIBDIR" - GETTEXT_LIBS= - AC_MSG_RESULT(yes) - AC_CHECK_LIB(intl, bindtextdomain, GETTEXT_LIBS="-lintl",[ - AC_CHECK_LIB(c, bindtextdomain, GETTEXT_LIBS=,[ - AC_MSG_ERROR(Unable to find required gettext library) - ],) - ],) - - AC_DEFINE(HAVE_LIBINTL) - PHP_EXTENSION(gettext) - - EXTRA_LIBS="$EXTRA_LIBS $GETTEXT_LFLAGS $GETTEXT_LIBS" - INCLUDES="$INCLUDES $GETTEXT_INCLUDE" - - else - AC_MSG_RESULT(no) - fi -],[ - AC_MSG_RESULT(no) -]) diff --git a/ext/gettext/gettext.c b/ext/gettext/gettext.c deleted file mode 100644 index 860d26de43..0000000000 --- a/ext/gettext/gettext.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable 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 | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#include -#include "php.h" -#include "php_gettext.h" - -#if HAVE_LIBINTL - -#include - -function_entry php3_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} -}; - -php3_module_entry php3_gettext_module_entry = { - "gettext", php3_gettext_functions, NULL, NULL, NULL, NULL, PHP_MINFO(gettext), STANDARD_MODULE_PROPERTIES -}; - -PHP_MINFO_FUNCTION(gettext) -{ - php_printf("GNU gettext support active."); -} - -PHP_FUNCTION(textdomain) -{ - pval **domain; - char *domain_name, *retval; - char *val; - - if (ARG_COUNT(ht) != 1 || getParametersEx(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); -} - -PHP_FUNCTION(gettext) -{ - pval **msgid; - char *msgstr; - - if (ARG_COUNT(ht) != 1 || getParametersEx(1, &msgid) == FAILURE) { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(msgid); - - msgstr = gettext((*msgid)->value.str.val); - - RETURN_STRING(msgstr, 1); -} - -PHP_FUNCTION(dgettext) -{ - pval **domain_name, **msgid; - char *msgstr; - - if (ARG_COUNT(ht) != 2 - || getParametersEx(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); -} - -PHP_FUNCTION(dcgettext) -{ - pval **domain_name, **msgid, **category; - char *msgstr; - - if (ARG_COUNT(ht) != 3 - || getParametersEx(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); -} - -PHP_FUNCTION(bindtextdomain) -{ - pval **domain_name, **dir; - char *retval, *dir_name; - char *val; - - if (ARG_COUNT(ht) != 2 - || getParametersEx(2, &domain_name, &dir) == FAILURE) - { - WRONG_PARAM_COUNT; - } - convert_to_string_ex(domain_name); - convert_to_string_ex(dir); - - val = (*dir)->value.str.val; - if (strcmp(val, "") && strcmp(val, "0")) { - dir_name = val; - } else { - dir_name = NULL; - } - - 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: - */ diff --git a/ext/gettext/php_gettext.h b/ext/gettext/php_gettext.h deleted file mode 100644 index e01d041b94..0000000000 --- a/ext/gettext/php_gettext.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 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. | - +----------------------------------------------------------------------+ - | Author: Alex Plotnick | - +----------------------------------------------------------------------+ - */ - -/* $Id$ */ - -#ifndef _GETTEXT_H -#define _GETTEXT_H - -#if HAVE_LIBINTL -#ifndef INIT_FUNC_ARGS -#include "modules.h" -#endif - -extern php3_module_entry php3_gettext_module_entry; -#define gettext_module_ptr &php3_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 /* _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/hyperwave/Makefile.am b/ext/hyperwave/Makefile.am deleted file mode 100644 index 17277ee0f2..0000000000 --- a/ext/hyperwave/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -# $Id$ - -noinst_LTLIBRARIES=libphpext_hyperwave.la -libphpext_hyperwave_la_SOURCES=hw.c hg_comm.c - diff --git a/ext/hyperwave/config.h.stub b/ext/hyperwave/config.h.stub deleted file mode 100644 index d8e8bf43ab..0000000000 --- a/ext/hyperwave/config.h.stub +++ /dev/null @@ -1,2 +0,0 @@ -/* Define if you want Hyperwave support */ -#define HYPERWAVE 0 diff --git a/ext/hyperwave/config.m4 b/ext/hyperwave/config.m4 deleted file mode 100644 index ef48f24954..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 7b6756a5ab..0000000000 --- a/ext/hyperwave/debug.h +++ /dev/null @@ -1,194 +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.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 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 , 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 , 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 b0629b918f..0000000000 --- a/ext/hyperwave/hg_comm.c +++ /dev/null @@ -1,4921 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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 -#include "php.h" -#include "php_globals.h" -#include "SAPI.h" - -#if HYPERWAVE - -#include -#include -#include -#if WIN32|WINNT -# include -# define EWOULDBLOCK WSAEWOULDBLOCK -# define ETIMEDOUT WSAETIMEDOUT -# define bcopy memcpy -# define bzero(a,b) memset(a,0,b) -#else -# include -# include -# include -# include -# include -#endif -#include -#include -#include "hg_comm.h" -#include "dlist.h" -#include "ext/standard/head.h" - -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 * -***********************************************************************/ -ANCHOR *fnAddAnchor(DLIST *pAnchorList, - int objectID, - int start, int end) -{ - ANCHOR *cur_ptr; - - if((cur_ptr = (ANCHOR *) dlst_newnode(sizeof(ANCHOR))) == NULL) { - return NULL; - } - - 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; - - dlst_insertafter(pAnchorList, cur_ptr, PHP_DLST_HEAD(pAnchorList)); - - return(cur_ptr); -} - -/*********************************************************************** -* Function fnDeleteAnchor() * -* * -* Inserts new anchor into anchor list. * -* Parameter: ptr: pointer to node * -* Return: void * -***********************************************************************/ -void fnDeleteAnchor(ANCHOR *ptr) -{ - - 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); - - dlst_freenode(ptr); -} - -/*********************************************************************** -* Function fnCmpAnchors() * -* * -* Compares to Anchors by its start position * -* Parameter: ANCHOR a1: First Anchor * -* ANCHOR a2: Second Anchor * -* Return: As strcmp * -***********************************************************************/ -int fnCmpAnchors(ANCHOR *a1, ANCHOR *a2) -{ - 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() * -* * -* 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 **dest: object records of destinations * -* int ancount: number of anchors * -* Return: List of Anchors, NULL if error * -***********************************************************************/ -DLIST *fnCreateAnchorList(hw_objectID objID, char **anchors, char **docofanchorrec, char **reldestrec, int ancount, int anchormode) -{ - int start, end, i, destid, anchordestid, objectID; - ANCHOR *cur_ptr = NULL; - DLIST *pAnchorList = dlst_init(); - - 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]; - 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(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); - } - - cur_ptr->htmlattr = NULL; - if(NULL != (str = strstr(object, "HtmlAttr="))) { - str += 9; - str1 = str; - while((*str1 != '\n') && (*str1 != '\0')) - str1++; - cur_ptr->htmlattr = emalloc(str1 - str + 1); - strncpy(cur_ptr->htmlattr, str, str1 - str); - cur_ptr->htmlattr[str1 - str] = '\0'; - } - - if(NULL != (str = strstr(object, "LinkType="))) { - str += 9; - if(strncmp(str, "background", 10) == 0) - cur_ptr->linktype=HW_BACKGROUND_LINK; - 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[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 -char *fnInsAnchorsIntoText(char *text, DLIST *pAnchorList, char **bodytag, char *urlprefix) { - ANCHOR *cur_ptr; - char bgstr[BUFFERLEN], istr[BUFFERLEN]; - char *scriptname; - char *newtext; - int offset = 0; - int laststart=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://. - 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 hw_pipedocument. -*/ - if(urlprefix) { - scriptname = urlprefix; - } else { -#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")) - break; - } - scriptname = elts[j].val; - } -#else - scriptname = getenv("SCRIPT_FILENAME"); -#endif - } - - newtext = text; - bgstr[0] = '\0'; - dlst_mergesort(pAnchorList, fnCmpAnchors); - - cur_ptr = (ANCHOR *) dlst_last(pAnchorList); - while(NULL != cur_ptr) { - 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(bgstr, 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 */ -/* 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, ""); - if(cur_ptr->fragment) - snprintf(istr, BUFFERLEN, "", cur_ptr->link, cur_ptr->fragment, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - snprintf(istr, BUFFERLEN, "", cur_ptr->link, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - } - } else { - switch(cur_ptr->linktype) { - case HW_BACKGROUND_LINK: - if(NULL != cur_ptr->destdocname) - snprintf(bgstr, BUFFERLEN, " background='%s/%s'", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname); - else - bgstr[0] = '\0'; - break; - case HW_INTAG_LINK: - if(cur_ptr->fragment) -/* snprintf(istr, BUFFERLEN, " %s='%s/%s#%s'", cur_ptr->tagattr, scriptname == NULL ? "." : scriptname, cur_ptr->destdocname, 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 == NULL ? "." : scriptname, cur_ptr->destdocname); - offset -= 4; /* because there is no closing tag */ -/* laststart = cur_ptr->start; */ - 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' 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, ""); - - if(cur_ptr->nameanchor) - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "schade" : scriptname, cur_ptr->destdocname, cur_ptr->nameanchor, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - if(cur_ptr->fragment) - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->fragment, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - else - snprintf(istr, BUFFERLEN, "", scriptname == NULL ? "" : scriptname, cur_ptr->destdocname, cur_ptr->htmlattr == NULL ? "" : cur_ptr->htmlattr); - } - } - 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 */ - offset += strlen(istr) + 4; - laststart = cur_ptr->start; - } else { - if(laststart >= cur_ptr->end) - offset = 0; - newtext = fnInsStr(newtext, cur_ptr->end+offset, ""); - - /* 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, "", cur_ptr->keyword); - else if(cur_ptr->nameanchor) - snprintf(istr, BUFFERLEN, "", 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 */ - offset += strlen(istr) + 4; - laststart = cur_ptr->start; - } - cur_ptr = (ANCHOR *) dlst_prev(cur_ptr); - } - snprintf(istr, BUFFERLEN, "", bgstr); - *bodytag = estrdup(istr); - 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) || (WIN32|WINNT) - 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 - * - *====================================================================*/ -#if WIN32|WINNT -#include -#else -#include -#include -#include -#endif -#include -#include - -#if !(WIN32|WINNT) -static sigset_t newmask, oldmask, zeromask; -#endif - -static int set_noblock(int fd) -{ -#if WIN32|WINNT - 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; - char *bptr; - int error; -#if defined(SYSV) || (WIN32|WINNT) - int width = 20; -#else - int width = getdtablesize(); -#endif - fd_set writefds; - struct timeval select_timeout; - - select_timeout.tv_sec = timeout; -#if WIN32|WINNT - 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; - } - } -#if !(WIN32|WINNT) - 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; - char *bptr; - int error; - -#if defined(SYSV) || (WIN32|WINNT) - int width = 20; -#else - int width = getdtablesize(); -#endif - fd_set readfds; - struct timeval select_timeout; - - select_timeout.tv_sec = timeout; -#if WIN32|WINNT - 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; - } - } - -#if !(WIN32|WINNT) - 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 ( (hp = gethostbyname(server_name)) == NULL ) { - return(-1); - } - - 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(-2); - } - -#if defined(SUN) || (WIN32|WINNT) - 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(-3); - } - -#if !(WIN32|WINNT) - if ( (sock_flags = fcntl(sockfd, F_GETFL, 0)) == -1 ) -#endif - - if ( set_nonblocking(sockfd) == -1 ) { - HWSOCK_FCLOSE(sockfd); - return(-4); - } - - 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) -{ -#if WIN32|WINNT - 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) -{ -#if WIN32|WINNT - 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(0); -} - - -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); - 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); - sleep(1); - } - else return(-1); - } - else { - size -= len; - buf += len; - try = 0; - } - } - return(0); -} - - -hg_msg *recv_hg_msg(int sockfd) -{ - hg_msg *msg; - - if ( (msg = (hg_msg *)emalloc(sizeof(hg_msg))) == NULL ) { -/* php3_printf("recv_hg_msg"); */ - lowerror = LE_MALLOC; - return(NULL); - } - - if ( hg_read_exact(sockfd, (char *)&(msg->length), 4) == -1 ) { -/* php3_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 ) { -/* php3_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 ) { -/* php3_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 ) { -/* php3_printf("recv_hg_msg"); */ - lowerror = LE_MALLOC; - efree(msg); - return(NULL); - } - if ( hg_read_exact(sockfd, msg->buf, msg->length-HEADER_LENGTH) == -1 ) { -/* php3_printf("recv_hg_msg: hg_read (4) returned -1\n"); */ - efree(msg->buf); - efree(msg); - return(NULL); - } - } - else - msg->buf = NULL; - -#ifdef HW_DEBUG - php3_printf(" Recv msg: type = %d -- id = %d
\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 ) { -/* php3_printf("recv_ready: recv_hg_msg returned NULL\n"); */ - return(NULL); - } - if ( ready_msg->msg_type != READY_MESSAGE ) { -/* php3_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 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, error; - 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; ibuf; - 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; - - 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; - DLIST *pAnchorList; - - 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; - - newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix); - dlst_kill(pAnchorList, fnDeleteAnchor); - *bodytag = strdup(body); - efree(body); - *text = newtext; - *count = strlen(newtext); - } - } - } - - if(documenttype) efree(documenttype); - 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; ibuf); - 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, **objptr; - 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 */ - 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); - } - } - } - } - - 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, **objptr; - 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 */ - 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); - } - } - } - } - - 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, i, error; - char *tmp, **objptr; - 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 */ - 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); - } - } - } - } - - 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; - char **objptr; - - 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 */ - 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); - } - } - } - } - - 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 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 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= 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 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; ibuf; - efree(retmsg); - - return(0); -} - -int send_objectbyidquery(int sockfd, hw_objectID *IDs, int *count, char *query, char ***objrecs) -{ - hg_msg msg, *retmsg; - int length, error; - char *tmp, *str; - int *ptr, i, *ptr1; - int *offsets, *childIDs; - char **childrec; - - 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); - 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++) { - childrec[i] = estrdup(str); - str += offsets[i]; - } - *objrecs = childrec; - } - - efree(retmsg->buf); - 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; - char **objptr; - 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(-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 */ - 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); - } - } - } - } - - 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; - char **objptr; - 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 */ - 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); - } - } - } - } - - 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; - char **objptr; - 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 */ - 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); - } - } - } - } - 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) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - 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) { -/* php3_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; - DLIST *pAnchorList = NULL; - - 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; - - newtext = fnInsAnchorsIntoText(*text, pAnchorList, &body, urlprefix); - dlst_kill(pAnchorList, fnDeleteAnchor); - *bodytag = strdup(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) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - 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: -/* php3_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) { - php3_error(E_WARNING, "gethostbyname failed for %s", host); - /* 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, i, error; - char *tmp; - int *ptr, *ptr1; - - 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 - php3_printf("Sending msg: type = %d -- id = %d
\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 - php3_printf(" Added int to header: %d
\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 - php3_printf(" Added str to header: %s (%d)
\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 5056060310..0000000000 --- a/ext/hyperwave/hg_comm.h +++ /dev/null @@ -1,214 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP HTML Embedded Scripting Language Version 3.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-1999 PHP Development Team (See Credits file) | - +----------------------------------------------------------------------+ - | 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., 675 Mass Ave, Cambridge, MA 02139, USA. | - +----------------------------------------------------------------------+ - | Authors: Rasmus Lerdorf | - +----------------------------------------------------------------------+ - */ - - -/* $Id$ */ - -#ifndef _HG_COMM_H -#define _HG_COMM_H - -#if HYPERWAVE - -#include "hw_error.h" -#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 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 COPY 0 -#define MOVE 1 -#define DOCUMENT 0 -#define COLLECTION 1 - - -#if WIN32|WINNT -# 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; - -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 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_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 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 80a37b61d8..0000000000 --- a/ext/hyperwave/hw.c +++ /dev/null @@ -1,3720 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP version 4.0 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997, 1998, 1999 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_0.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | 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$ */ -#if COMPILE_DL -#include "dl/phpdl.h" -#endif - -#include -#include - -#include "php.h" -#include "php_globals.h" -#include "ext/standard/php_standard.h" -#include "ext/standard/head.h" -#include "ext/standard/info.h" -#include "SAPI.h" - -#if WIN32|WINNT -#include -#else -#include "build-defs.h" -#endif - -#if HYPERWAVE - -#include "php_ini.h" -#include "php_hyperwave.h" - -//hw_module php3_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_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_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_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} -}; - -php3_module_entry hw_module_entry = { - "HyperWave", hw_functions, PHP_MINIT(hw), PHP_MSHUTDOWN(hw), NULL, NULL, PHP_MINFO(hw), 0, 0, 0, NULL -}; - -#ifdef ZTS -int hw_globals_id; -#else -PHP_HW_API php_hw_globals hw_globals; -#endif - -#ifdef COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &hw_module_entry; } -#endif - -void print_msg(hg_msg *msg, char *str, int txt); - -#if COMPILE_DL -DLEXPORT php3_module_entry *get_module(void) { return &hw_module_entry; } -#endif - -void _close_hw_link(hw_connection *conn) -{ - if(conn->hostname) - free(conn->hostname); - if(conn->username) - free(conn->username); - close(conn->socket); - free(conn); - HwSG(num_links)--; -} - -void _close_hw_plink(hw_connection *conn) -{ - 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(hw_document *doc) -{ - if(doc->data) - free(doc->data); - if(doc->attributes) - free(doc->attributes); - if(doc->bodytag) - free(doc->bodytag); - free(doc); -} - -#ifdef ZTS -static void php_hw_init_globals(php_hw_globals *hw_globals) -{ - HwSG(num_persistent) = 0; -} -#endif - -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, php_hw_globals, hw_globals) - PHP_INI_ENTRY("hyperwave.default_port", "418", PHP_INI_ALL, OnHyperwavePort) -PHP_INI_END() - -PHP_MINIT_FUNCTION(hw) { - -#ifdef ZTS - hw_globals_id = ts_allocate_id(sizeof(php_hw_globals), php_hw_init_globals, NULL); -#else - HwSG(num_persistent)=0; -#endif - REGISTER_INI_ENTRIES(); - HwSG(le_socketp) = register_list_destructors(_close_hw_link,NULL); - HwSG(le_psocketp) = register_list_destructors(NULL,_close_hw_plink); - HwSG(le_document) = register_list_destructors(_free_hw_document,NULL); - 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; -} - -/* 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