summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>1999-04-20 23:58:03 +0000
committerSVN Migration <svn@php.net>1999-04-20 23:58:03 +0000
commit361f0489c886a3e97b6777f6ca001b278ca3ba57 (patch)
tree6b555e4587bd3c8fad9e37c3fd0004b62d6eb457
parent37fe04b887f84e1a6eff7e356f614d7293aaee58 (diff)
downloadphp-git-361f0489c886a3e97b6777f6ca001b278ca3ba57.tar.gz
This commit was manufactured by cvs2svn to create branch 'INITIAL'.
-rw-r--r--BUGS11
-rw-r--r--CHANGES624
-rw-r--r--CODING_STANDARDS149
-rw-r--r--COPYING339
-rw-r--r--CREDITS176
-rw-r--r--ChangeLog859
-rw-r--r--ChangeLog.TODO103
-rw-r--r--EXTENSION_STATUS54
-rw-r--r--FUNCTION_LIST.txt538
-rw-r--r--INSTALL159
-rw-r--r--LICENSE64
-rw-r--r--Makefile.in204
-rw-r--r--README.QNX57
-rw-r--r--README.WIN3259
-rw-r--r--TODO100
-rw-r--r--WISHLIST17
-rw-r--r--WISHLIST-3.155
-rw-r--r--Zend/LICENSE37
-rw-r--r--Zend/Makefile.am23
-rw-r--r--Zend/ZEND_CHANGES111
-rw-r--r--Zend/ZendCore.dep258
-rw-r--r--Zend/acconfig.h47
-rw-r--r--Zend/acinclude.m420
-rwxr-xr-xZend/buildconf28
-rw-r--r--Zend/config.unix.h39
-rw-r--r--Zend/config.w32.h41
-rw-r--r--Zend/configure.in134
-rw-r--r--Zend/libzend.dsp355
-rw-r--r--Zend/zend-parser.y634
-rw-r--r--Zend/zend-scanner.h29
-rw-r--r--Zend/zend-scanner.l1221
-rw-r--r--Zend/zend.c263
-rw-r--r--Zend/zend.h207
-rw-r--r--Zend/zend.icobin1382 -> 0 bytes
-rw-r--r--Zend/zend_API.c765
-rw-r--r--Zend/zend_API.h103
-rw-r--r--Zend/zend_alloc.c515
-rw-r--r--Zend/zend_alloc.h119
-rw-r--r--Zend/zend_compile.c1850
-rw-r--r--Zend/zend_compile.h510
-rw-r--r--Zend/zend_constants.c236
-rw-r--r--Zend/zend_constants.h53
-rw-r--r--Zend/zend_errors.h33
-rw-r--r--Zend/zend_execute.c1915
-rw-r--r--Zend/zend_execute.h71
-rw-r--r--Zend/zend_execute_API.c479
-rw-r--r--Zend/zend_extensions.c142
-rw-r--r--Zend/zend_extensions.h91
-rw-r--r--Zend/zend_globals.h212
-rw-r--r--Zend/zend_hash.c1163
-rw-r--r--Zend/zend_hash.h153
-rw-r--r--Zend/zend_highlight.c160
-rw-r--r--Zend/zend_highlight.h43
-rw-r--r--Zend/zend_indent.c141
-rw-r--r--Zend/zend_indent.h22
-rw-r--r--Zend/zend_list.c238
-rw-r--r--Zend/zend_list.h61
-rw-r--r--Zend/zend_llist.c197
-rw-r--r--Zend/zend_llist.h53
-rw-r--r--Zend/zend_modules.h50
-rw-r--r--Zend/zend_opcode.c381
-rw-r--r--Zend/zend_operators.c1329
-rw-r--r--Zend/zend_operators.h66
-rw-r--r--Zend/zend_ptr_stack.c74
-rw-r--r--Zend/zend_ptr_stack.h37
-rw-r--r--Zend/zend_sprintf.c34
-rw-r--r--Zend/zend_stack.c114
-rw-r--r--Zend/zend_stack.h39
-rw-r--r--Zend/zend_variables.c167
-rw-r--r--Zend/zend_variables.h35
-rw-r--r--acconfig.h.in219
-rw-r--r--acinclude.m4386
-rw-r--r--apMakefile.libdir4
-rw-r--r--apMakefile.tmpl77
-rw-r--r--apidoc.txt492
-rw-r--r--bison.simple705
-rw-r--r--build-defs.h.in92
-rwxr-xr-xbuildconf30
-rw-r--r--calendar.mak244
-rw-r--r--config.guess743
-rw-r--r--config.sub939
-rw-r--r--configure.in.in1681
-rw-r--r--control_structures.h46
-rw-r--r--crypt.mak204
-rw-r--r--cvsusers62
-rw-r--r--dbase.mak234
-rw-r--r--dbm.mak201
-rw-r--r--ext/Makefile.am8
-rw-r--r--ext/dbase/Makefile.am5
-rw-r--r--ext/dbase/config.h.stub3
-rw-r--r--ext/dbase/config.m421
-rw-r--r--ext/dbase/dbase.c686
-rw-r--r--ext/dbase/dbase.h52
-rw-r--r--ext/dbase/dbf.h94
-rw-r--r--ext/dbase/dbf_head.c261
-rw-r--r--ext/dbase/dbf_head.h9
-rw-r--r--ext/dbase/dbf_misc.c168
-rw-r--r--ext/dbase/dbf_misc.h13
-rw-r--r--ext/dbase/dbf_ndx.c183
-rw-r--r--ext/dbase/dbf_ndx.h98
-rw-r--r--ext/dbase/dbf_rec.c182
-rw-r--r--ext/dbase/dbf_rec.h10
-rw-r--r--ext/dbase/setup.stub4
-rw-r--r--ext/ereg/ereg.c569
-rw-r--r--ext/ereg/php_ereg.h48
-rw-r--r--ext/ereg/regex/COPYRIGHT20
-rw-r--r--ext/ereg/regex/Makefile.in141
-rw-r--r--ext/ereg/regex/README32
-rw-r--r--ext/ereg/regex/WHATSNEW92
-rw-r--r--ext/ereg/regex/cclass.h31
-rw-r--r--ext/ereg/regex/cname.h102
-rw-r--r--ext/ereg/regex/debug.c242
-rw-r--r--ext/ereg/regex/debug.ih14
-rw-r--r--ext/ereg/regex/engine.c1019
-rw-r--r--ext/ereg/regex/engine.ih35
-rw-r--r--ext/ereg/regex/main.c510
-rw-r--r--ext/ereg/regex/main.ih19
-rw-r--r--ext/ereg/regex/mkh76
-rw-r--r--ext/ereg/regex/regcomp.c1546
-rw-r--r--ext/ereg/regex/regcomp.ih48
-rw-r--r--ext/ereg/regex/regerror.c124
-rw-r--r--ext/ereg/regex/regerror.ih12
-rw-r--r--ext/ereg/regex/regex.3502
-rw-r--r--ext/ereg/regex/regex.7233
-rw-r--r--ext/ereg/regex/regex.dsp106
-rw-r--r--ext/ereg/regex/regex.dsw29
-rw-r--r--ext/ereg/regex/regex.h79
-rw-r--r--ext/ereg/regex/regex.mak304
-rw-r--r--ext/ereg/regex/regex2.h138
-rw-r--r--ext/ereg/regex/regexec.c140
-rw-r--r--ext/ereg/regex/regfree.c37
-rw-r--r--ext/ereg/regex/split.c316
-rw-r--r--ext/ereg/regex/tests475
-rw-r--r--ext/ereg/regex/utils.h22
-rw-r--r--ext/gd/Makefile.am4
-rw-r--r--ext/gd/config.h.stub6
-rw-r--r--ext/gd/config.m454
-rw-r--r--ext/gd/gd.c1786
-rw-r--r--ext/gd/gdcache.c201
-rw-r--r--ext/gd/gdcache.h87
-rw-r--r--ext/gd/gdttf.c862
-rw-r--r--ext/gd/gdttf.h16
-rw-r--r--ext/gd/php3_gd.h102
-rw-r--r--ext/gd/setup.stub6
-rw-r--r--ext/odbc/Makefile.am4
-rw-r--r--ext/odbc/config.h.stub9
-rw-r--r--ext/odbc/config.m4263
-rw-r--r--ext/odbc/odbc.c2167
-rw-r--r--ext/odbc/php3_odbc.h261
-rw-r--r--ext/odbc/php3_velocis.h108
-rw-r--r--ext/odbc/setup.stub76
-rw-r--r--ext/odbc/velocis.c646
-rw-r--r--ext/snmp/winsnmp.c228
-rw-r--r--ext/standard/Makefile.am11
-rw-r--r--ext/standard/base64.c197
-rw-r--r--ext/standard/base64.h47
-rw-r--r--ext/standard/basic_functions.c2158
-rw-r--r--ext/standard/basic_functions.h130
-rw-r--r--ext/standard/browscap.c137
-rw-r--r--ext/standard/config.m43
-rw-r--r--ext/standard/cyr_convert.c301
-rw-r--r--ext/standard/cyr_convert.h40
-rw-r--r--ext/standard/datetime.c510
-rw-r--r--ext/standard/datetime.h51
-rw-r--r--ext/standard/dir.c287
-rw-r--r--ext/standard/dns.c343
-rw-r--r--ext/standard/dns.h53
-rw-r--r--ext/standard/exec.c388
-rw-r--r--ext/standard/exec.h43
-rw-r--r--ext/standard/file.c1435
-rw-r--r--ext/standard/file.h65
-rw-r--r--ext/standard/filestat.c509
-rw-r--r--ext/standard/formatted_print.c602
-rw-r--r--ext/standard/fsock.c478
-rw-r--r--ext/standard/fsock.h57
-rw-r--r--ext/standard/global.h58
-rw-r--r--ext/standard/html.c134
-rw-r--r--ext/standard/html.h38
-rw-r--r--ext/standard/image.c386
-rw-r--r--ext/standard/image.h36
-rw-r--r--ext/standard/info.c442
-rw-r--r--ext/standard/info.h40
-rw-r--r--ext/standard/iptc.c132
-rw-r--r--ext/standard/link.c214
-rw-r--r--ext/standard/mail.c188
-rw-r--r--ext/standard/math.c708
-rw-r--r--ext/standard/md5.c407
-rw-r--r--ext/standard/md5.h71
-rw-r--r--ext/standard/microtime.c88
-rw-r--r--ext/standard/microtime.h37
-rw-r--r--ext/standard/pack.c890
-rw-r--r--ext/standard/pack.h42
-rw-r--r--ext/standard/pageinfo.c159
-rw-r--r--ext/standard/pageinfo.h11
-rw-r--r--ext/standard/php3_browscap.h43
-rw-r--r--ext/standard/php3_dir.h48
-rw-r--r--ext/standard/php3_filestat.h64
-rw-r--r--ext/standard/php3_iptc.h38
-rw-r--r--ext/standard/php3_link.h41
-rw-r--r--ext/standard/php3_mail.h46
-rw-r--r--ext/standard/php3_standard.h71
-rw-r--r--ext/standard/php3_string.h99
-rw-r--r--ext/standard/php3_syslog.h44
-rw-r--r--ext/standard/php3_var.h42
-rw-r--r--ext/standard/phpdir.h44
-rw-r--r--ext/standard/phpmath.h70
-rw-r--r--ext/standard/quot_print.c109
-rw-r--r--ext/standard/quot_print.h37
-rw-r--r--ext/standard/rand.c343
-rw-r--r--ext/standard/reg.c569
-rw-r--r--ext/standard/reg.h48
-rw-r--r--ext/standard/soundex.c136
-rw-r--r--ext/standard/string.c1590
-rw-r--r--ext/standard/syslog.c296
-rw-r--r--ext/standard/type.c108
-rw-r--r--ext/standard/type.h41
-rw-r--r--ext/standard/uniqid.c103
-rw-r--r--ext/standard/uniqid.h37
-rw-r--r--ext/standard/url.c439
-rw-r--r--ext/standard/url.h60
-rw-r--r--ext/standard/var.c391
-rw-r--r--filepro.mak194
-rw-r--r--foo9
-rw-r--r--foo23
-rw-r--r--foo343
-rw-r--r--foo441
-rw-r--r--footer7
-rw-r--r--gd.mak214
-rw-r--r--getopt.c171
-rw-r--r--getopt.h9
-rw-r--r--header29
-rw-r--r--hyperwave.mak214
-rw-r--r--imap4.mak194
-rw-r--r--install-sh238
-rw-r--r--internal_functions.c146
-rw-r--r--ldap.mak194
-rw-r--r--libphp3.module.in7
-rw-r--r--ltconfig1064
-rw-r--r--ltmain.sh1813
-rw-r--r--main.h72
-rw-r--r--main/alloca.c505
-rw-r--r--main/config.w32.h294
-rw-r--r--main/configuration-parser.y415
-rw-r--r--main/configuration-scanner.l170
-rw-r--r--main/fopen_wrappers.c995
-rw-r--r--main/fopen_wrappers.h90
-rw-r--r--main/internal_functions_registry.h57
-rw-r--r--main/logos.h805
-rw-r--r--main/main.c2147
-rw-r--r--main/php.h521
-rw-r--r--main/php3_compat.h83
-rw-r--r--main/php_globals.h66
-rw-r--r--main/php_ini.c314
-rw-r--r--main/php_ini.h75
-rw-r--r--main/php_version.h1
-rw-r--r--main/safe_mode.c156
-rw-r--r--main/safe_mode.h7
-rw-r--r--main/snprintf.c935
-rw-r--r--main/snprintf.h56
-rw-r--r--main/win95nt.h74
-rwxr-xr-xmakeall.bat13
-rwxr-xr-xmakedist126
-rwxr-xr-xmakeparser.bat4
-rw-r--r--mod_php3.c429
-rw-r--r--mod_php3.h60
-rw-r--r--msql.mak194
-rw-r--r--msql1.mak212
-rwxr-xr-xmtparser.bat4
-rw-r--r--mysql.mak197
-rw-r--r--objects7
-rw-r--r--output.c226
-rw-r--r--output.h18
-rw-r--r--php3.ini-dist243
-rw-r--r--php3_realpath.c290
-rw-r--r--php3_realpath.h41
-rw-r--r--php3_sprintf.c54
-rw-r--r--php3_threads.c79
-rw-r--r--php3_threads.h33
-rw-r--r--php3extra.dsw41
-rw-r--r--php3sapi.dsw89
-rw-r--r--php4.dsp685
-rw-r--r--php4.dsw44
-rw-r--r--php_custom_build.mak269
-rw-r--r--press-release-3.0.txt47
-rw-r--r--recurse21
-rw-r--r--regex/COPYRIGHT20
-rw-r--r--regex/Makefile.in141
-rw-r--r--regex/README32
-rw-r--r--regex/WHATSNEW92
-rw-r--r--regex/cclass.h31
-rw-r--r--regex/cname.h102
-rw-r--r--regex/debug.c242
-rw-r--r--regex/debug.ih14
-rw-r--r--regex/engine.c1019
-rw-r--r--regex/engine.ih35
-rw-r--r--regex/main.c510
-rw-r--r--regex/main.ih19
-rw-r--r--regex/mkh76
-rw-r--r--regex/regcomp.c1546
-rw-r--r--regex/regcomp.ih48
-rw-r--r--regex/regerror.c124
-rw-r--r--regex/regerror.ih12
-rw-r--r--regex/regex.3502
-rw-r--r--regex/regex.7233
-rw-r--r--regex/regex.dsp106
-rw-r--r--regex/regex.dsw29
-rw-r--r--regex/regex.h79
-rw-r--r--regex/regex.mak304
-rw-r--r--regex/regex2.h138
-rw-r--r--regex/regexec.c140
-rw-r--r--regex/regfree.c37
-rw-r--r--regex/split.c316
-rw-r--r--regex/tests475
-rw-r--r--regex/utils.h22
-rw-r--r--request_info.c258
-rw-r--r--request_info.h62
-rwxr-xr-xscripts/armerge67
-rwxr-xr-xscripts/config-stubs7
-rwxr-xr-xscripts/mkextlib.in16
-rwxr-xr-xscripts/preconfig25
-rw-r--r--setup461
-rw-r--r--snmp.mak194
-rw-r--r--stamp-h.in0
-rw-r--r--test.php416
-rw-r--r--test.pl34
-rw-r--r--test_class_inheritance29
-rw-r--r--testarray21
-rw-r--r--testarray.pl5
-rw-r--r--testarray25
-rw-r--r--testarray2.pl3
-rw-r--r--testclassfunc10
-rw-r--r--testcom9
-rw-r--r--testfe21
-rw-r--r--testfunc36
-rw-r--r--testfunc.pl20
-rw-r--r--testfunc219
-rw-r--r--testfunc2.pl22
-rw-r--r--testfuncref8
-rw-r--r--testinclude5
-rw-r--r--testobj9
-rw-r--r--tls.c113
-rw-r--r--tls.h207
-rw-r--r--win32/flock.c83
-rw-r--r--win32/flock.h11
-rw-r--r--win32/grp.h31
-rw-r--r--win32/param.h16
-rw-r--r--win32/php_registry.h7
-rw-r--r--win32/pwd.c79
-rw-r--r--win32/pwd.h57
-rw-r--r--win32/readdir.c111
-rw-r--r--win32/readdir.h37
-rw-r--r--win32/registry.c74
-rw-r--r--win32/sendmail.c511
-rw-r--r--win32/sendmail.h46
-rw-r--r--win32/signal.h4
-rw-r--r--win32/syslog.h73
-rw-r--r--win32/time.c156
-rw-r--r--win32/time.h40
-rw-r--r--win32/unistd.h1
-rw-r--r--win32/wfile.c17
-rw-r--r--win32/wfile.h16
-rw-r--r--win32/winutil.c29
-rw-r--r--win32/winutil.h1
-rw-r--r--win32/wsyslog.c128
-rw-r--r--zlib.mak194
365 files changed, 0 insertions, 83354 deletions
diff --git a/BUGS b/BUGS
deleted file mode 100644
index 8966692d58..0000000000
--- a/BUGS
+++ /dev/null
@@ -1,11 +0,0 @@
-If you think you've found a bug in PHP3, you can report it on the bug
-reporting page at:
- http://www.php.net/
-
-Current Known Bugs:
-
-* split() function doesn't return regex errors nicely
-* Preprocessed scripts don't work with require() and define()
-* unset() doesn't actually erase the variables it just marks them as uninitialized
-* Some parts in the language core prevent more than 256 arguments in function
- calls from being possible \ No newline at end of file
diff --git a/CHANGES b/CHANGES
deleted file mode 100644
index b3b9d8bea5..0000000000
--- a/CHANGES
+++ /dev/null
@@ -1,624 +0,0 @@
-Noticeable Changes between PHP/FI 2.0 and PHP 3.0
-=================================================
-
-This file was designed to be viewed with a tab size of 4 characters.
-
-This file is divided into 4 sections:
-1. Downwards incompatible language changes. This section includes all of
- the changes in the core language which may require people to modify
- their scripts before using them with PHP 3.0. It does NOT list
- changes made in the behavior of specific functions.
-2. New language features. This section includes all of the new additions
- to the core language, that may be used to enhance scripts designed for
- PHP 3.0. Likewise, it does not include a listing of new functions.
-3. Structural changes not directly effecting the end user. The core
- of PHP 3.0 is a complete rewrite. As such, many issues effecting
- PHP/FI 2.0 were addressed and vastly improved in this version,
- resulting in a much more stable and efficient implementation. This
- section lists these changes in design.
-4. Other changes that don't fit in any of the above categories.
-
-Please remember that PHP 3.0's core is a complete rewrite, and thus,
-there may be other undocumented incompatibilities we haven't thought
-of ourselves. If you think you've found a incompatibility (or a new
-feature) which is not listed here, please mail us at
-php-dev@php.iquest.net.
-
-
-
- - Zeev
-
-------------------------------------------------------------------------------
-
-Downwards incompatible language changes
-=======================================
-
-[1] The close-PHP tag has changed from > to ?>
-
- This means that instead of writing:
-
- <?echo $title;>
-
- You should write:
-
- <?echo $title;?>
-
- PHP3 also includes support for a longer-form start tag that is
- XML-compliant:
-
- <?php echo $title;?>
-
- The ability to use the short start tag ('<?') can be turned on and
- off using the short_tags() function. Whether it is enabled or not by
- default is a compile-time option (normally set to enabled by default).
-
-
-[2] Semicolons in if/elseif/else must be replaced with colons.
-
- For example, the equivalent of:
-
- if (expr);
- statements
- ...
- elseif (expr);
- statements
- ...
- else;
- statements
- endif;
-
- in PHP 3.0 would be:
-
- if (expr):
- statements
- ...
- elseif (expr):
- statements
- ...
- else:
- statements
- endif;
-
- Note that the endif is followed by a semicolon and not a colon even in
- PHP 3.0, which marks the end of the entire IF sentence.
-
- Also note that the implementation of the colon-mode and curly-braces
- mode in PHP 3.0 is identical, one isn't buggier than the other (note
- that I'm not saying they're not buggy, though :)
-
-
-[3] Semicolons in while loops must also be replaced with colons.
-
- For example, the equivalent of:
-
- while (expr);
- statements
- ...
- endwhile;
-
- in PHP 3.0 would be:
-
- while (expr):
- statements
- ...
- endwhile;
-
- Note that the endwhile is followed by a semicolon and not a colon even
- in PHP 3.0, which marks the end of the WHILE sentence. As with the IF
- statement, the implementation of the colon-mode and curly-braces mode
- in PHP 3.0 is identical, one isn't buggier than the other.
-
- Also note that failing to change the semicolon to a colon can result in
- scripts that get stuck in the while loop because the loop-condition never
- changes.
-
-
-[4] $foo[0] is no longer identical to $foo.
-
- In PHP/FI 2.0, a side-effect of the implementation caused $foo[0] to be
- identical to $foo. This is not the case in PHP 3.0.
-
-
-[5] Expressions determine their types differently.
-
- The way expressions are evaluated has changed radically in PHP 3.0.
- Expressions are no longer given the type of the left argument, but are
- assigned types taking both types into account, and regardless of which
- is on the left side and which is on the right side. On simple scripts
- that should probably not effect you, but if you've relied on this fact
- (even without realizing you do) it may change the way your scripts work.
- Consider the next example:
-
- $a[0]=5;
- $a[1]=7;
-
- $key = key($a);
- while ("" != $key) {
- echo "$key\n";
- next($a);
- }
-
-
- In PHP/FI 2.0, this would display both of $a's indices. In PHP 3.0, it
- wouldn't display anything. The reason is that in PHP/FI 2.0, because the
- left argument's type was string, a string comparison was made, and indeed
- "" does not equal "0", and the loop went through. In PHP 3.0, when a
- string is compared with an integer, an integer comparison is made (the
- string is converted to an integer). This results in comparing atoi("")
- which is 0, and $key which is also 0, and since 0==0, the loop doesn't
- go through even once. The fix for this is simple, by replacing the
- while statement with:
-
- while ("" != stringval($key)) {
-
- This would first convert the integer 0 to a string "0", and then
- compare "" and "0", which are not equal, and the loop would go through
- as expected. As mentioned later, casting operators are supported in
- PHP 3.0 for a quicker and more readable way of changing variables'
- types. For example, you could use:
-
- while ("" != (string)$key) {
-
-
-[6] The structure of error messages has changed.
-
- Although the error messages are usually more accurate, you won't be shown
- the actual line of text and actual place in which the error occured.
- You'll be supplied with the line number in which the error has occured,
- though.
-
-
-[7] The format string argument to echo is no longer supported.
-
- Use printf(format,arg1,arg2,arg3,...) instead (unlimited arguments).
-
-
-[8] The use of read-mode $array[] is no longer supported.
-
- That is, you cannot traverse an array by having a loop that does $data =
- $array[]. Use current() and next() instead. Also, $array1[] = $array2
- does not append the values of $array2 to $array1, but appends $array2
- as the last entry of $array1 (see the multidimensional array support).
-
-
-[9] Apache versions older than 1.2 are not supported anymore.
-
- The apache module requires apache 1.2 or later (1.3-beta is supported).
-
-
-[10] Indirect references inside quoted strings
-
- PHP2-style indirect reference inside quoted strings is no longer
- supported. That is, if $foo="bar", and $bar="abc", in PHP2,
- "$$foo" would print out "abc". In PHP3, this would print
- "$bar" (the contents of $foo is replaced with "bar").
- To use indirect reference in PHP3 inside quoted strings, you should use
- the new notation: "${$foo}". The standard $$foo notation will work
- outside of the quoted string.
-
-[11]
- Some functions have changed names, are missing, or have been deprecated
- by other functions
-
- As a whole new rewrite, written by many more people and supporting many
- more APIs than it's predecessor, there's a good chance some of the functions
- you're used to from PHP/FI 2 aren't available in release 3, or have changed
- names. Many functions that do exist behave a bit differently, mainly
- because they return different values for errors (false) but also for other
- reasons. We can't list all of these functions here, simply because drawing
- a full comparison between the function sets of the two versions is way too
- much work. If a converted PHP/FI 2 script doesn't work for you, nothing
- can replace the good old human eye going over the code, doublechecking
- with the online manual that each function still does what you expected it
- to do.
-
-[12] Other incompatibilities.
-
- It's not too unlikely that other documented behavior of PHP2 has changed
- in this release. If you think you've found an example, please mail
- us at php-dev@php.iquest.net. Even if you've found an undocumented
- feature of PHP2 that stopped working in PHP3, we'd like to know about it
- (although it's more than likely that it will not be supported).
-
-
-
-------------------------------------------------------------------------------
-
-
-New Language Features
-=====================
-
-[1] Expressions
-
- PHP 3.0 includes a rich implementation of expressions, much more advanced
- than this of 2.0. Just about any complex C-like or perl-like expression
- would work. Support was added for assignment operators (+=, -=, *= etc),
- pre and post increment/decerement (e.g. $i++, ++$i) and the questionmark
- operator ( (expr?expr:expr) ). Every assignment is now an expression
- with a value, which means stuff like $a = $b = $c = $d = 0; would work.
- It is difficult to describe the power of expressions within a few lines
- of text, but if you're familiar with them, you probably get the picture.
-
-
-[2] for loops are now supported.
-
- for loops were fairly difficult to implement (in fact, we didn't find
- any parallel interpreter that supports for loops anywhere (no, perl is
- not an interpreter)). The bottom line is that for loops work, and are
- around 5% slower than comparable while loops (that may vary), but often
- they're much nicer.
-
- The syntax is identical to the one of C:
-
- for (expr; expr; expr) statement;
-
- or
-
- for (expr; expr; expr) { statements ... }
-
- The first expression is executed the first time the loop is encountered,
- the loop is run as long as the second expression is evaluated as TRUE,
- and after each iteration, the 3rd expression is evaluated.
-
- Colon-mode FOR loops are also supported:
- for (expr; expr; expr):
- statements
- ...
- endfor;
-
-
-[3] do..while(expr) loops are now supported.
-
- Like with its C parallel, the statements inside a do..while loop are
- run once the first time the loop is encountered, and then as long as
- the expression evaluates as true.
-
- For example:
-
- do {
- statements;
- } while ($i++ < $max);
-
-
-[4] break and continue statements are now supported inside loops.
-
- You can break out of loops, or continue to the next iteration of the
- loop using these statements. A special feature of PHP is the ability
- to specify an expression argument to break or continue, which specifies
- how many loops you want to break out from or continue to. For example:
-
- for ($i=0; $i<10; $i++) {
- for ($j=0; $j<10; $j++) {
- if ($j>5)
- break;
- if ($i>5)
- break 2;
- }
- }
-
- The first break statement would end the inner loop every time $j is
- greater than 5. The second break statement would end both the inner
- and outer loop when $i is greater than 5.
-
- Note: For this matter, switch statements are considered as loops. So
- if you write "break 2;" inside a switch statement, you would be asking
- to break out of the switch, and the innermost loop in which is nested.
-
-
-[5] Switched to C-style declaration of functions.
-
- Here's a pretty useless function which makes a good example:
-
- function concat($str1,$str2)
- {
- return $str1.$str2;
- }
-
- NOTE: The old style function definition is still supported, to
- allow easier upgrading from PHP/FI 2.0 scripts. Simply
- change 'function' to 'old_function' for these functions.
-
-
-[6] OOP support
-
- Classes and inheritance are supported to a limited extent in PHP 3.0.
- Here's how to declare a simple class:
-
- class simple_class {
- var $property1,$property2;
- var $property3=5;
-
- function display() {
- printf("p1=%d, p2=%d, p3=%d\n",
- $this->property1,
- $this->property2,
- $this->property3);
- }
- function init($p1,$p2) {
- $this->property1 = $p1;
- $this->property2 = $p2;
- }
- };
-
- Here's how to create an object of that class:
-
- $obj = new simple_class;
-
- At this point, $obj is an object with 2 uninitialized variables, 1
- initialized variable, and 2 member functions. No protection is made on
- the internals of the object, and using its properties is simple:
-
- $obj->property1 = 7;
-
- would assign 7 to $property1 inside $obj. Calling member functions is
- also simple:
-
- $obj->display()
-
- would run the display() member function of $obj. Note that the
- implementation of display() uses the special variable $this, which is
- replaced with the object the function is called on.
-
- Inheritance is pretty simple too:
-
- class complex_class extends simple_class {
- var $property4="test";
-
- function display() {
- printf("p1=%d, p2=%d, p3=%d, p4=%d\n",
- $this->property1,
- $this->property2,
- $this->property3,
- $this->property4);
- }
- }
-
- Basically, the class complex_class inherits everything from its parent,
- simple_class, except properties or member functions which override the
- ones in the parent. In this example, since we supply an alternative
- display() function, it would be used with complex_class objects instead
- of the display() function that was declared in simple_class. On the other
- hand, since we don't supply an alternative init() function, complex_class
- objects would have the same init() function as simple_class objects do.
-
- As with expressions, it's impossible to teach OOP in a few lines, and
- personally I'm unclear as to how useful this would be in day to day
- scripting. If you like this, play with this until you figure it out :)
-
- Objects can reside in arrays, and can contain arrays. However,
- a limitation of the current implementation doesn't allow an object
- to contain an array of objects (actually, this is allowed, but
- there's no way to address the properties of such an object directly,
- but only indirectly). For example, assuming $a[3] is an object,
- $a[3]->b[2] is an object as well, you can't address the properties
- of $a[3]->b[2] (i.e. you can't write $a[3]->b[2]->foo = "bar", for
- instance).
-
-
-[7] Function pointers are now supported.
-
- A simple illustrative example:
-
- $func_ptr = "time";
- $current_time = $func_ptr();
-
- is identical to
-
- $current_time = time();
-
-
-[8] Indirect references are much more powerful.
-
- For example, one can use the dollar operator an infinite amount of times:
-
- $a = "b";
- $b = "c";
- $c = "d";
- $d = "e";
- $e = "Testing\n";
-
- echo $$$$$a;
-
- Would display $e's content, which is "Testing\n".
-
- In addition, one can use complex expressions to generate variable names
- using a perl-like notation:
-
- $i="123";
- ${"test".$i} = 5;
-
- would assign 5 to $test123.
-
-[9] A string concatenation operator was added, '+' no longer concatenates strings.
-
- A perl-like string concatenation operator was added, the '.' operator.
- It converts both of its arguments to strings, and concatenates them.
- For example:
-
- $result = "abcd".5;
-
- assigns "abcd5" to result. Note that under PHP 3.0, the '+' operator
- no longer performs concatenation if its arguments are strings. Use
- the '.' operator instead.
-
-[10] Supports passing function arguments by references instead of by value.
-
- Support for passing function arguments by reference instead of by value
- has been added. This doesn't result in having to change the function
- implementations in any way, but, when calling the function, you can
- decide on whether the variable you supply would actually be changed by
- the function, or a copy of it.
-
- Example:
-
- function inc($arg)
- {
- $arg++;
- }
-
- $i=0;
- inc($i); # here $i in the outer scope wouldn't change, and remain 0
- inc(&$i); # here $i is passed by reference, and would change to 1
-
-
-[11] Support for multidimensional arrays.
-
- (Or as Andi calls them, 'hyperdimensional variables'.)
-
- The easiest way to define this support of PHP 3.0 is inductive -
- arrays can contain any type of variables, including other arrays.
- A simple example:
-
- $a[0]=5;
- $a[1]["testing"]=17;
- $b["foo"]=$a;
-
- Ok, so it may be not so simple. Play with it, it's pretty powerful.
-
-
-[12] Array initialization is now supported.
-
- For example, let's say you want to initialize a lookup table to convert
- number to month names:
-
- $months = array("January", "February", "March",
- "April", "May", "June", "July", "August",
- "September", "October", "November", "December");
-
- would assign $months[0] to be January, $months[1] to be February, etc.
- Alternately, you may want the count to start at '1' instead of 0.
- You can do so easily:
-
- $months = array(1=>"January", "February", "March",
- "April", "May", "June", "July", "August",
- "September", "October", "November", "December");
-
- Also, you can specify an index for every entry, not just the first one:
-
- $first_names = array("Doe"=>"John", "Gates"=>"William",
- "Clinton"=>"Bill" });
-
- would assign $first_names["Doe"]="John", etc.
-
-
-[13] Perl style lists now supported.
-
- Multiple values from arrays may now be assigned into several
- variables using one assignment. For example:
-
- $str = "johndoe:x:555:555:Doe, John:/home/johndoe:/bin/tcsh";
-
- list($username,$passwd,$uid,$gid,$realname,$homedir,$shell) =
- explode(":",$str);
-
- Would assign 'johndoe' into $username, 'x' into $passwd, etc.
-
-
-[14] Colons are supported in 'case' and 'default' statements.
-
- For example:
-
- switch($value) {
- case 'A':
- statement;
- break;
- case 'B':
- statement;
- break;
- case 'C':
- statement;
- /* fall-through */
- default:
- statement;
- }
-
- Semicolons are still supported, but when writing new scripts, they
- should be phased out in favour of colons.
-
-
-------------------------------------------------------------------------------
-
-
-Non Language Related New Features
-=================================
-
-[1] Persistent resource lists.
-
- In plain english this means that there's now an easy way of writing the
- SQL drivers so that they don't open and close the SQL link every time,
- but instead open it the first time it's required, and then use it on
- every later hit. As of PHP 3.0a1, only the MySQL, mSQL and PostgresSQL
- drivers have been changed (rewritten) to take advantage of this option.
- To use it, use mysql_pconnect() instead of mysql_connect() (or the
- equivalents for the two other databases).
-
-
-[2] Configuration file.
-
- PHP now has its own configuration file, and many compile-time options
- of PHP2 are now configurable at runtime.
-
-
-[3] Syntax Highlighting.
-
- A syntax highlighter has been built into PHP 3.0, which means PHP 3.0 can
- display your code, syntax highlighted, instead of executing it.
- There are currently two ways to use the syntax highlighter. One is to
- use the show_source() statement. This statement is identical to the
- include() statement, except instead of executing the file, it displays
- its source syntax highlighted.
- The second way is possible only when running as an apache module, and is
- to define a special extension for PHP 3.0 source files (e.g. .php3s)
- and instruct apache to automatically syntax highlight them.
-
-
-[4] Loadable modules.
-
- This would have a huge impact on the Windows version, and would probably
- be used in the UNIX environment as well. One can now add PHP internal
- functions in runtime by loading a dynamic module. This is known to work
- under Solaris, Linux and Win32 at this time, but would be ported to any
- other capable platform if an incompatability is found.
-
-
-------------------------------------------------------------------------------
-
-
-Other Interesting Issues
-========================
-
-
-[1] Improved performance.
-
- The performance of PHP 3.0 is much better than the one of PHP/FI 2.0.
- Memory consumption has been dramatically reduced in many cases, due
- to the use of an internal memory manager, instead of apache's pools.
- Speedwise, PHP 3.0 is somewhere between 2 and 3 times faster than
- PHP/FI 2.0.
-
-
-[2] More reliable parser.
-
- After PHP 3.0 is well tested, it'll be pretty safe to say that it's
- more reliable than PHP/FI 2.0 is. While PHP/FI 2.0 performed well on
- simple, and fairly complex scripts, a fundamental design difference
- from PHP 3.0 makes it more prone to errors. In PHP 3.0, obscure parser
- problems are much less likely.
-
-
-[3] Improved C API.
-
- If you're a C coder, adding functionality to PHP was never easier.
- A pretty well documented API is available (apidoc.txt), and you no longer
- have to touch the parser or scanner code when adding your function.
- Also, it's more complicated to 'go wrong' when implementing a PHP3
- function than it was in PHP2 (no stack to maintain) - but of course,
- you can mess up here too :)
-
-
-[4] Name change.
-
- PHP/FI 2.0 was renamed to PHP 3.0, and the meaning has changed from
- 'Personal Home Pages / Forms Interpreter' to 'PHP: Hypertext Preprocessor'.
- 'Personal' home pages was an understatement for PHP/FI 2.0, and is
- definitely an understatement for PHP 3.0.
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/COPYING b/COPYING
deleted file mode 100644
index a43ea2126f..0000000000
--- a/COPYING
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- 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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/CREDITS b/CREDITS
deleted file mode 100644
index 19cc505032..0000000000
--- a/CREDITS
+++ /dev/null
@@ -1,176 +0,0 @@
-PHP Version 3.0 Development Team
-
-------------------------------------------------------------------------------
-
-Core Developers
-===============
-
-Rasmus Lerdorf (rasmus@lerdorf.on.ca)
-
-* Original language definition and implementation
-* CGI loader and many internal functions
-* Apache module support
-* SNMP module
-* Original mSQL, MySQL and Sybase modules
-* Oracle module work
-
-
-Andi Gutmans (andi@php.net) and Zeev Suraski (zeev@php.net)
-
-* New language definition and implementation
-* Internal functions API design
-* General hash table implementation for symbol tables, arrays and objects
-* Memory manager
-* Token cache manager
-* A lot of internal functions (including hebrev :) and migration from PHP 2.0
-* Syntax highlighting mode
-* Configuration file parser
-* New persistent/multilink MySQL, PosgresSQL, Sybase and mSQL modules
-* Win32 COM support
-
-
-Stig Bakken (ssb@guardian.no)
-
-* Oracle support
-* configure/install script work
-* sprintf reimplementation
-* XML support
-* SGML documentation framework
-
-
-Shane Caraveo (shane@caraveo.com)
-
-* Porting to Visual C++
-* Generalization to support different server APIs
-* Work on ISAPI and NSAPI APIs
-
-
-Jim Winstead (jimw@php.net)
-
-* Lots of PHP2 -> PHP3 porting
-* dBase support
-* URL parsing functions
-* Makefile work
-* Regex rewrite
-* Win32 work
-
-
-------------------------------------------------------------------------------
-
-Major Contributors
-==================
-
-* Jouni Ahto (jah@cultnet.fi)
- Postgres, Informix
-
-* Alex Belits (abelits@phobos.illtel.denver.co.us)
- fhttpd support
-
-* Bjørn Borud (borud@guardian.no)
- soundex code and lots of enthusiasm
-
-* Christian Cartus (chc@idgruppe.de)
- Informix Universal Server support
-
-* John Ellson (ellson@lucent.com)
- Freetype support
-
-* Dean Gaudet (dgaudet@arctic.org)
- Apache module debugging + helpful hints along the way
-
-* Mitch Golden (mgolden@interport.net)
- Oracle testing and bug fixes
-
-* Danny Heijl (Danny.Heijl@cevi.be)
- Informix SE support
-
-* Mark Henderson (mark@togglemedia.com)
- Various odds and ends
-
-* Jaakko Hyvätti (jaakko@hyvatti.iki.fi)
- Prototype cop, regular expression code fixes, CGI security issues
-
-* Amitay Isaacs (amitay@w-o-i.com)
- LDAP
-
-* Andreas Karajannis (Andreas.Karajannis@gmd.de)
- Adabas D, ODBC, Oracle
-
-* Igor Kovalenko (owl@infomarket.ru)
- QNX support issues
-
-* Richard Lynch (lynch@lscorp.com)
- Documentation
-
-* Tom May (tom@go2net.com)
- Sybase-CT work
-
-* Muhammad A Muquit (MA_Muquit@fccc.ed)
- Original Sybase module
-
-* Mark Musone (musone@edgeglobal.com)
- IMAP
-
-* Jeroen van der Most (jvdmost@digiface.nl)
- Solid
-
-* Chad Robinson (chadr@brttech.com)
- Documentation, FilePro
-
-* Lachlan Roche (lr@www.wwi.com.au)
- MD5
-
-* Stefan Roehrich (sr@linux.de)
- zlib
-
-* Nikolay P. Romanyuk (mag@redcom.ru)
- Velocis support
-
-* Brian Schaffner (brian@tool.net)
- ODBC support, PHP3 API testing
-
-* Egon Schmid (eschmid@delos.lf.net)
- Documentation
-
-* (sopwith@redhat.com)
- Solid
-
-* Colin Viebrock (cmv@privateworld.com)
- Website graphic design and layout, PHP logo
-
-* Eric Warnke (ericw@albany.edu)
- LDAP
-
-* Lars Torben Wilson (torben@netmill.com)
- Documentation
-
-* Uwe Steinmann (Uwe.Steinmann@fernuni-hagen.de)
- Hyperwave, PDF, Acrobat FDF Toolkit
-
-------------------------------------------------------------------------------
-
-Beta Testers
-------------
-
-* Niklas Saers (berenmls@saers.com)
- FreeBSD/x86
-
-* Chuck Hagenbuch <chuck@osmos.ml.org>
- Linux/x86 glibc2, MySQL, mod_ssl
-
-* Sascha Schumann (sas@schell.de)
- FreeBSD/x86, PostgreSQL, IMAP, gdttf
-
-* Jim Jagielski (jim@jagunet.com)
- A/UX, FreeBSD/x86
-
-* Jouni Ahto (jah@cultnet.fi)
- Debian Linux 2.0
-
-
-
-
-------------------------------------------------------------------------------
-
-Andi Gutmans and Zeev Suraski would like to thank Professor Michael Rodeh for
-his positive input during the initial development of the interpreter.
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index 76e826b96b..0000000000
--- a/ChangeLog
+++ /dev/null
@@ -1,859 +0,0 @@
-PHP 3.0 CHANGE LOG ChangeLog
-|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-December 24 1998, Version 3.0.6
-- Fix GetImageSize() to work with non-standard jpg images
-- Add Mersenne Twister functions (mt_rand, mt_srand, etc)
-- Add str_replace() function
-- Add chunk_split() function
-- Fixed a bug in the memory limit code, in cases where $php_errormsg was
- also used.
-- Add iptcparse() function
-- Adobe FDF supported
-- getallheaders() NULL string fix <michale@utko.fee.vutbr.cz>
-- Add all configuration directives to phpinfo() page
-- Functions pack() and unpack() rewritten to be binary and buffer overrun
- safe and behave like the Perl functions for all implemented format codes.
-- Ensured that msql_error() will not return error messages generated by
- previously-run scripts.
-- Add base_convert() function
-- Make sprintf() and printf() output binary safe
-- Made gzgetc binary safe
-- Add convert_cyr_string() and quoted_printable_decode() functions
-- Fix ldap_free_result() core dump bug
-- Add support for current OpenLDAP-2.0-devel library
-- Add php3_asp_tags directive so it can be set from Apache config files
-- Added UTF-8 support in the XML extension
-- Make rand(min,max) safer on older platforms where the low-order bits have
- short cycles.
-- Added new pdf (Portable Document Format) module
-- Added an XML parsing extension using James Clark's "expat" library
-- Optimized parts of the token cache code.
-- Terminate on out-of-memory errors. Until now, PHP could crash in out of
- memory situations (clean-up, no real effect).
-- Unterminated comments in include files were being reported with the wrong line
- number. Fixed.
-- Added ImageCopy() and ImageColorDeallocate(). ImageCopy() is about
- 20% faster than ImageCopyResized(). ImageColorDeallocate() marks
- palette entries free for reuse (by <mka@satama.com>).
-- In the CGI version, it was impossible to access resources (e.g. SQL links,
- images) from user-defined shutdown functions. Fixed.
-- Added optional third parameter to strpos() to specify the offset to
- start searching from.
-- Fixed a crash bug in unset() when unsetting illegal variables (rare).
-- Made ImageInterlace and ImageTransparentColor parameters optional, and made
- them return the current/new settings.
-- Optimized GetImageSize() <thies@digicol.de>.
-- Made odbc_autocommit() without args return status
-- Added connect workaround for OpenLink ODBC
-- Added minimal InterBase support. Tested only on 4.0 & Linux.
-- Fixed some memory leaks and bogus error messages in the URL handler of
- the various file open functions. Should only affect error handling
- in bad URLs.
-
-October 5 1998 Version 3.0.5
-- mysql_field_flags now reports all MySQL flags and the result is suitable
- for automatic parsing. Compatibility warning: The result format has
- changed. If you have scripts parsing the result of this function, you
- may need to adapt them.
-- Made nl2br() binary safe (not that it's of much use).
-- Fixed a bug in the API function getThis(). It affected mostly the dir
- functions, if nested within objects.
-- Fixed a problem in require() in conjunction with switch(), and in some other
- cases. Also fixed an identical problem with the call_user_function() API
- function.
-- Removed -lpthread when compiling with MySQL support. It caused various
- serious problems when compiled into Apache.
-- Add serialize() and unserialize() functions from jkl@njet.net
-- Fix in_addr_t check for systems with in_addr_t in netinet/in.h
-- Add atan2() function
-
-September 22 1998 Version 3.0.4
-- Added uksort() - array key sort using a user defined comparison function.
-- Added 'j' support to date() - generates the day of the month, without
- possible leading zeros.
-- Added support for multiple crypt() encryptions if the system supports it
-- Added optional support for ASP-style <% %> and <%= tags
-- Fixed data loss problems with very large numeric array indices on 64-bit
- platforms (e.g. DEC UNIX).
-- 2 cursor_type parameters for ifx_query() and ifx_prepare changed
- to 1 (bitmask). Added a few constants for use in Informix module.
-- Added php3.ini option ifx.charasvarchar. If set, trailing blanks
- are stripped from fixed-length char columns. (Makes life easier
- for people using Informix SE.)
-- Static SNMP module which compiles with ucd-snmp 3.5.2
-- fixed imap_header & header_info from crashing when a header line
- is > 1024 characters.
-- Added patch for rfc822_parse_adr to return an array of objects instead
- of a single object.
-- Informix Online 7.x & SE 7.x support now fairly complete and stable
-- Add dbase_get_record_with_names() function
-- Added a special case for open_basedir. When open_basedir is set to "."
- the directory in which the script is stored will be used as basedir.
-- Include alloca.c in the distribution for platforms without alloca().
-- Improved stripping of URL passwords from error messages - the length of the
- username/password isn't obvious now, and all protocols are handled properly
- (most importantly, http).
-- Copying objects that had member functions with static variables produced
- undetermined results. Fixed.
-- Added function lstat() and cleaned up the status functions,
- added tests for file status functions (this may break on some plattforms)
-- Fixed is_link() - it was returning always false.
-- Fixed apache_note() - it was corrupting memory.
-- New Function. void get_meta_tags(string filename); Parses filename until
- closing head tag and turns all meta tags into variables prefixed with 'meta_'.
- The below meta tag would produce $meta_test="some string here"
- <meta name="test" content="some string here">
-- Generalized some internal functions in order to better support calling
- user-level functions from C code. Fixes a few sporadic problems related
- to constructors inside eval() and more.
-- Fixed an endless loop in explode(), strstr() and strpos() in case of an
- invalid empty delimiter.
-- rand() now accepts two optional arguments, which denote the requested range
- of the generated number. E.g., rand(3,7) would generate a random number
- between 3 and 7.
-- Added M_PI constant.
-- Added deg2rad() and rad2deg() for converting radians<->degrees.
-- ImageArc() misbehaved when given negative angles, fixed.
-- Fixed a bug in ereg() that may have caused buglets under some circumstances.
-- Added imap_status
-- Shutdown functions, registered via register_shutdown_function(), could never
- generate output in the Apache module version. Fixed.
-- Brought IMAP docs into sync with acutal imap code
-- imap_fetchstructure now takes in optional flags
-- Fix potential core dumps in imap_append and imap_fetchtext_full
-- Fix problem in SetCookie() function related to long cookies
-- Add uasort() function to go along with usort (like sort() and asort())
-- Add port number to Host header as per section 14.23 of the HTTP 1.1 RFC
-- Fix imap_reopen to only take 2 arguments with an optional 3rd flags arg
-- Add optional 2nd argument to imap_close
-- Add CL_EXPUNGE flag to imap_open() flags
-- Fix 4th arg on imap_append(). It was getting converted to a long by mistake.
-- Fix shutdown warning in the LDAP module
-- *COMPATIBILITY WARNING* imap_fetchstructure() "parametres" object and property
- name changed to "parameters" to match the documentation and to be consistent
- with the rest of the API.
-- Delete uploaded temporary files automatically at the end of a request
-- Add upload_max_filesize and correponsing php3_upload_max_filesize directive
- to control the maximum size of an uploaded file. Setting this to 0 would
- completely eliminate file uploads.
-- Force $PHP_SELF to PATH_INFO value when running in CGI FORCE_CGI_REDIRECT mode
-- Add apache_lookup_uri() function which does an internal sub-request lookup
- and returns an object containing the request_rec fields for the URI. (Yes,
- you have to be a bit of a gearhead to figure this one out)
-- Fix a few signed char problems causing functions like ucfirst() not to work
- correctly with non-English charsets
-- md5() function not binary safe - fixed
-
-August 15 1998 Version 3.0.3
-- Changed the name of fopen_basedir to open_basedir, to be a little more
- accurate about what it does.
-- Added Hyperwave module
-- Added config-option (php3_)enable_dl <on/off>. This enables/disables the
- dl() function. In safe-mode dl() is always disabled.
-- Auto-prepended files were crashing under some circumstances - fixed.
-- Win32 mail fixes provided by walton@nordicdms.com
-- Comparing between arrays and/or objects now generates a warning (it always
- returns false, as it used to; no comparison is made)
-- Fixed a bug in the syntax highlighting code, that made ending-double-quotes
- appear twice under certain circumstances.
-- Fix bug in filetype() function related to symlinks
-- Started integrating Informix SE support to PHP configure/makefile setup.
-- gdttf roundoff fixes from ellson@lucent.com
-- Added initial Informix SE support files from Danny Heijl - This code still
- needs to be integrated into the PHP configure/makefile setup and the code
- itself needs more work.
-- return in the global scope now terminates the execution of the current file.
-- Added the ability to register shutdown function(s), via
- register_shutdown_function($function_name).
-- Clean up const warnings
-- Add write support to ftp fopen wrappers
-- Add strspn() and strcspn() functions
-- On systems without strerror use Apache version if compiling as Apache module
-- The PHP start tag was being ignored under some circumstances - fixed.
-- The db, dbase and filepro functions are now Safe-Mode aware.
-- Added config-option (php3_)fopen_basedir <path>. This limits the directory-
- tree scripts can open files in to <path>.
-- Fixed pg_loreadall that didn't always return all the contents in a PostgreSQL
- large object. Also, doesn't pass through anything if method is HEAD.
-- configure fix to create target Apache module dir
-- Fix core dump in imageTTFtext() function
-- Added static IMAP support
-- Syntax highlighting was generating additional whitespace - fixed.
-- Added ucwords. Works like ucfirst, but works on all words within a string.
-- Added array_walk() - apply user function to every element of an array
-- Added usort() - array sort that accepts a user defined comparison function!
-- Added the ability to call user-level functions and object methods on demand
- from the C source using a completely generalized, slick API function.
- Miracles do happen every once in a while.
-- Added constructors. Don't even squeek about destructors! :) (we mean that)
-- Make pg_lowrite() binary safe
-- Fixed mod_charset option in ./setup
-- Fixed rewinddir() and dir()::rewind() under Win32 (they didn't work before).
-- Add Win32 COM support! By-name referencing is supported using the IDispatch
- interface (automation). Available functions - COM_Load(), COM_Invoke(),
- COM_PropGet() and COM_PropSet().
-
-July 20 1998 Version 3.0.2a
-- Fix a quirk in the configuration file parser, the endless fountain of joy
- and fun.
-- Fix a bug in the API function add_method() that made dir() crash.
-
-July 18 1998 Version 3.0.2
-- Compile cleanups for *BSD
-- Add support for the OpenLink ODBC Drivers
-- Add PHP_SELF, PHP_AUTH_* and HTTP_*_VARS PHP variables to phpinfo() output
-- Add workaround for broken makes
-- Add Apache 1.3.1 support (some Apache header files were moved around)
-- Added apache_note() function.
-- Fix order of system libraries and detect libresolv correctly
-- Fixed a bug in the Sybase-DB module. Several numeric field types were
- getting truncated when having large values.
-- Added testpages for unified odbc
-- Fix php -s seg fault when filename was missing
-- Made getdate() without args default to current time
-- Added ImageColorResolve() and some fixes to the freetype support.
-- Added strcasecmp()
-- Added error_prepend_string and error_append_string .ini and .conf directives
- to make it possible to configure the look of error messages displayed by PHP
- to some extent
-- Added E_ERROR, E_WARNING, E_NOTICE, E_PARSE and E_ALL constants, that can be
- used in conjunction with error_reporting()
- (e.g. error_reporting(E_ERROR|E_WARNING|E_NOTICE);
-- Fixed a crash problem with classes that contained function(s) with default
- values.
-- Fixed a problem in the browscap module. Browscap files weren't being read
- properly.
-- Fix -L path in libphp3.module to make ApacheSSL compile without errors
-- Fix StripSlashes so it correctly decodes a \0 to a NUL
-
-July 04 1998 Version 3.0.1
-- echo/print of empty strings don't trigger sending the header anymore.
-- Implemented shift left and shift right operators (<< and >>)
-- Compile fix for cc on HP-UX.
-- Look for beta-version Solid libraries as well.
-- Make GD module show more info in phpinfo().
-- Compile fix for NextStep 3.0.
-- Fix for Oracle extension on OSF/1.
-- Fix gd 1.3 bug in ImageColorAt().
-- pg_loread() hopefully handles binary data now.
-- Turned off some warnings in dns.c
-- Added ImageTTFBBox() and made ImageTTFText() return bounding box.
-- Added constants for Ora_Bind()'s modes.
-- Renamed all hash_*() routines to _php3_hash_*() to avoid clashes with other
- libraries.
-- Changed uodbc default LONG behaviour: longreadlen 4096 bytes, binmode 1.
- The module now actually uses the php.ini settings.
-- New PostgreSQL functions: pg_fetch_row(), pg_fetch_array()
- and pg_fetch_object()
-- Fix a segmentation fault when calling invalid functions in certain
- circumstances
-- Fix bug that caused link-related functions to not pay attention to
- run-time safe mode setting (it was using whatever was set at compile time).
-- Fix bug in exec() function when used in safe mode
-
-June 6 1998 Version 3.0
-- Add checkdnsrr function (check availability DNS records)
-- Add getmxrr function (get MX hostnames and weights)
-- Fixed bug in nl2br() function
-- Fix for an RC5 related problem in the Sybase module, when dealing
- with very long data types.
-- Speed up string concatenation by roughly a factor of 2
-- Add escape-handling to date function
-- Make base64 functions binary safe
-- Add strrpos function to complement strpos function added in RC5
-- Add ltrim function (strips only at the start of string)
-- Add rtrim as an alias to chop() for completeness sake
-- Add trim function (similar to chop, except it strips at the start as well)
-- Added 2 optional args to fsockopen function - errno and errstr
-- Fixed bug in split() function related to leading matches
-- Fixed problem in error_log() function (thanks to Jan Legenhausen)
-- empty("0") was returning true - fixed
-- Removed the old sybsql module. Use the new sybase_*() functions instead.
-- Several fixes to the configuration file parser
-- LDAP fixes - fixed return values on several functions
-
-May 23 1998 Version 3.0RC5
-- The BC math library functions now compile in by default.
-- Fixed a bug in virtual() and other types of SSI's (e.g. <!--#exec). Under
- certain circumstances, this used to result in random problems.
-- Fixed a bug in virtual(). It was misbehaving if it was called before any
- other output.
-- Added mysql.default_port, mysql.default_host, mysql.default_user and
- mysql.default_password ini-file directives.
-- Improved handling of the MySQL default port. It now honors /etc/services
- and $MYSQL_TCP_PORT.
-- Fixed a crash in opening of broken ftp:// URLs, and improved error reporting
- in opening of URLs.
-- Fixed several non-critical scanner issues with syntax highlighting mode and
- the <script language=php> tag.
-- Fixed fseek on windows. (windows only): fseek will not return proper results
- on files opened as text mode. PHP uses binary mode as the default for file
- operations, but this can be overiden by fopen. Do not open files in text
- mode and use fseek on them!
-- Add strpos() function
-- Added zlib module, requires zlib >= 1.0.9
-- Improved the module API implementation. Dynamic modules may now register
- persistent resources (not that it makes much sense, but at least PHP
- won't crash). The API itself remains unchanged.
-- bcmod() wasn't always behaving like modulus should behave (it was behaving
- exactly like GNU bc's % operator). Fixed.
-- Changed the Sybase-DB module to always return strings, instead of auto-typing
- result sets. This was done for consistency with the other database modules,
- and in order to avoid overflows due to the platform-dependant limitations
- of the numeric data types of PHP. You can turn compatability mode on using
- the sybase.compatability_mode directive in the php3.ini file.
-- Fixed problems with the TINYINT field in the Sybase-CT module.
-- Applied some small speed optimizations to the Sybase-DB module querying code.
-- Added 'numeric' and 'type' properties to the object returned by
- sybase_fetch_field().
-- The 'new' operator doesn't accept all expressions anymore. Instead, it
- accepts a class name, or a variable reference (scalar, array element, etc).
-- Add ora_numcols() function
-- Add ora_do() and ora_fetch_into() functions to Oracle driver
-- Add persistent connection support to Oracle driver
-- Make Oracle driver clean up open connections and open cursors automatically
-- Added fread() and fwrite() that properly handle binary data.
-- Add Ora_ColumnSize() to Oracle code
-- The string "0" means FALSE again. This was done in order to maintain type
- conversion consistency.
-- Added solid_fetch_prev() for fetching the previous result row from Solid.
-- Huge integers are now automatically converted to floating point numbers
- (that have a wider range).
-- Floating point numbers are now displayed using scientific notation when
- they're extremely big or extremely small. The 'precision' php3.ini directive
- no longer designates the number of decimal digits, but rather, the maximum
- number of significant digits required.
-- Added support for scientific notation for floating point numbers (e.g. 1E7)
- throughout the entire language.
-- Fixed a potential/probable memory corruption problem with HEAD request
- handling.
-- Using un-encapsulated strings now generates a NOTICE-level warning
- (e.g. $a = foo; instead of $a = "foo";)
-- Added defined("name") function to check if a certain constant is defined
- or not.
-- Support new Apache mechanism for setting SERVER_SUBVERSION
-- Added PHP_OS and PHP_VERSION constants
-- Added the ability to define constants in runtime! Constants are script-wide,
- (there's no scope, once the constant is defined, it's valid everywhere).
- Syntax is define("name", $value [, $case_insensitive]). 'name' can be any name
- that is a valid variable name, *without* the $ prefix. 'value' can be
- any *scalar* value. If the optional 'case_insensitive' parameter is 1,
- then the constant is created case-insensitive (the default is case
- sensitive). Note: define() is currently *NOT* supported in preprocessed
- scripts.
-- Added general support for constants. The Syslog constants (e.g.
- LOG_ERR, LOG_CRIT, etc.) should be accessed as constants from now on (that
- is, without a $ prefix). You can still set define_syslog_variables to On
- in the php3.ini file if you want to define the various $ variables. The
- default for this directive in the php3.ini-dist file has been changed to
- Off.
-- The configuration file path variable now expands . and .. into their
- respective directories. You can obtain the path of the php3.ini file
- that was used by printing get_cfg_var("cfg_file_path").
-- Fixed a crash-recovery parser crash ($a=7; $a[3]+=5;)
-- Add gmmktime() function
-- Fixed a crash with implode() and empty arrays.
-- Fixed a bug that, under fairly rare circumstances, caused PHP not to
- recognize if(), require() and other statements as statements, and
- to complain about them as being unsupported functions.
-- Beautified php3.ini-dist and added more comments to it. Also changed
- the behavior of the configuration file parser to be brighter about
- the various constants (TRUE/FALSE/ON/OFF etc).
-- Fixed a bug in openlog() - the specified device name was being mangled.
-- Memory leaks were sometimes reported erroneously - fixed.
-- Improved the convertor to handle some quirks of the PHP/FI 2 parser with
- comments.
-- Fixed number_format() to properly handle negative numbers, and optimized it
- a bit.
-- Fixed static variables inside class member functions. Note that using such
- static variables inside member functions usually defeats the purpose of
- objects, so it is not recommended.
-- Fixed a bug in fpassthru() (the file was being closed twice).
-- Added strftime().
-- Add set_socket_blocking() function to control blocking on socket fd's
-- The sendmail_path in php3.ini was being ignored - fixed.
-- Fixed a bug with file upload, with files that contained the MIME boundary
- inside them.
-- Fixed a bug with form variables of type array, with spaces in their
- index (e.g. name="foo[bar bar]").
-- gd-1.3 autodetect and support
-- Year 2000 compliance is now togglable from the php3.ini file. Setting PHP
- to be y2k compliant effects the way it creates cookies, and means it'll
- NOT work with many browsers out there that are not y2k compliant! For
- that reason, the default for this option is off.
-- safe mode / fix from monti@vesatec.com
-- Integrated the FreeType support in the GD extension.
-- Added --with-gd=DIR and --without-gd options to configure
-
-April 18 1998 Version 3.0 Release Candidate 4
-- Auto-prepended and auto-appended files were reporting the wrong filename
- in errors and in __FILE__ - fixed.
-- Fix GPC problem related to mixed scalar and array vars with the same name
-- Made putenv() Apache-safe. Environment variables may no longer leak in
- between requests.
-- The trailing semicolon is no longer required in class declarations.
-- Fixed a memory leak in the (array) and (object) operators under certain
- conditions.
-- <script> tags weren't working unless short tags were enabled - Fixed.
-- Fixed a bug in certain array indices that weren't treated as numbers
- even though they looked like numbers (e.g. "10", "20").
-- Changes to support renamed API functions in Apache-1.3
-- Fixed the -p and -e command line switches
-- Fix a segfault when calling command line version without parameters
-- Fix for feof() when used on a socket
-- Fix off-by-one error in fgets() when used on a socket
-- Fix bug in ImageSetPixel() (Thanks to ecain@Phosphor.net)
-
-March 31 1998 Version 3.0 Release Candidate 3
-- Tiny bugfix for magic_quotes_sybase
-- Fix Apache build problems introduced in RC2
-- $a["0"]==$a[0] fix
-- Apache-1.3 build changes to support 100% automatic builds and shared library
- module builds. See INSTALL file.
-
-March 30 1998 Version 3.0 Release Candidate 2
-- Changed the socket implementation under UNIX to not use FILE pointers, in
- order to work around the buggy Solaris libc (and possibly buggy libc's
- in other platforms).
-- Fixed a bug in min() and max() with certain arrays.
-- *WARNING* Move Apache 1.3 php3 file install to src/modules/php3 instead of
- src/modules/extra. Make sure you change your AddModule line correctly
- in your Apache Configuration file. This change is to take advantage of
- new Apache-1.3 configuration mechanism which makes it easier to build an
- Apache server with PHP automatically enabled. It will also help building
- a shared library module version of PHP soon.
-- Fixed a crash bug with auto-appended files.
-- Made --enable-discard-path work on all Unix servers #!/path/php CGI scripts
- should now work everywhere. I have tested on Apache, WN and Netscape 2.0
-- Made $a["123"] and $a[123] be identical. $a["0123"] is still different,
- though.
-- Added 'precision' ini directive, to set the number of decimal digits
- displayed for floating point numbers (default - 6).
-- Made integer/integer divisions evaluate to floating point numbers when
- applicable (e.g., 5/2==2.5(float), but 4/2==2(int))
-- Get rid of reliance on tied streams and move all socket reads and writes
- to recv/send calls
-- Cleaned up head.c a bit and fixed CGI SetCookie order problem
-- Changed default variable parsing order to Get-Cookie-Post (GPC)
-- Fixed setup so it has all configure options and defaults.
-- Added optional decimal point and thousands seperator to number_format()
- e.g., number_format(1500,2,',','.') == 1.500,00
-- Fixed cgi bug in windows that prevented files from being parsed on many
- systems and servers.
-
-March 23 1998 Version 3.0 Release Candidate
-- Added support for the Raima database (ALPHA)
-- Fixed a bug in persistent PostgreSQL links and the connection-string method.
-- Added EXTENSION_STATUS file, that specifies the stability and status of
- every module in the distribution.
-- Added optional parameters to user functions with default values, variables
- that are forced to be passed by reference and variables that can be
- optionally passed by reference. The ini file directive
- 'ignore_missing_userfunc_args' is no longer supported.
-- Added fhttpd support (by Alex Belits)
-- Improved performance by approximately 20-30%.
-- Added mysql_error(), mysql_errno() (if available) and msql_error().
- Errors coming back from the database backend no longer issue warnings.
- Instead, use these functions to retreive the error.
-- Patched count(), each(), prev(), next(), reset() and end() to work around
- the implementation side effects of unset(). As far as the users are
- concerned, this should be transparent now (even though it's slower now,
- until it's thoroughly fixed in 3.1).
-- Added number_format(). number_format(2499,2)=='2,499.00'.
-- error_reporting() now sets the error reporting level to the supplied
- argument, without any interpretations.
-- Fixed a lookahead parser bug that occured under rare circumstances.
-- Change the comparison operators to compare numeric strings as numbers. If
- you want to compare them as strings, you can use the new C-like strcmp()
-- Fixed Ora_GetColumn() bug when fetching strings
-- Added Ora_ColumnName() and Ora_ColumnType()
-- Preliminary LONG and LONG RAW support in Oracle extension
-- Add \123 and \xAB style octal and hex escapes to "" and `` strings
-- Add "-c" command line flag for specifying path to php3.ini file
-- Improved list() so that elements can be skipped, for example:
- list($name,,,$realname) = explode(":",fgets($passwd_file));
-- Fixed a tiny bug in the hash initialization which caused excessive use of
- memory. Report and fix by short@k332.feld.cvut.cz
-- Fixed strtolower() and strtoupper() to work with 8-bit chars
-- Fixed to compile and run on SunOS 4.1
-- Fixed a crash in soundex() of an empty string
-- Fixed parse_str() - it wasn't always defining the right variables,
- and didn't work with arrays.
-- Made [m,My]SQL create/drop database functions return success status
-- Fixed some memory leak/crash problems in the Adabas module
-- Added each() in order to allow for easy and correct array traversing.
-- Make Apache module version respect LOCALE setting
-- Add support for Apache 1.3b6+ ap_config.h file
-- Fixed a nasty corruption bug in eval() and show_source() that resulted in
- script termination (e.g. eval("exit();").
-- Fixed a syntax highlighting problem with keywords used as variable
- names.
-- Fixed a possible crash and/or file descriptor leak
-- Fixed line number being off by one in #! shell style execution
-- Made it possible to disable auto_prepend/append with "none" filename
-- Allow safe CGI calling through #!php style scripts
-
-March 2 1998 Version 3.0b6
-- Made [s]printf handle %ld
-- Changed CGI version to only open regular files as input script
-- Added ignore_missing_userfunc_args directive to suppress warnings messages
- about missing arguments to user-defined functions
-- Added Postgres function - pg_cmdtuples(), by Vladimir Litovka
-- Disabled command line options if used as CGI
-- Changed CGI version to use PATH_TRANSLATED as the script file name
-- Link with solid shared library instead of static one
-- Fixed a crash with functions that aren't being called correctly
-- Fixed file descriptor leak in auto-prepend/append
-- Imap module is usable. See README in dl/imap.
-
-February 24 1998 Version 3.0b5
-- Made the URL aware file functions be enabled by default
-- Fixed an unlikely crash bug in the parser, with uninitialized array elements
- which are refered to as objects.
-- Fixed several fields that were being incorrectly read in Sybase CT.
-- Fix Apache-1.3 related SIGHUP problem which was preventing php3.ini from
- getting re-read on a SIGHUP
-- *** WARNING *** Downwards incompatible change: The plus operator (+) is not
- longer overloaded as concatenation for strings. Instead, it converts its
- arguments to numbers and performs numeric addition.
-- Add Stig and Tin's bdf2gdfont script to extra/gd directory
-- Added join() as an alias to implode()
-- Made implode() accept arguments in the order used by explode() as well
-- Made $php_errormsg local in function calls
-- Fixed Apache configuration directive bugs
-- Added a number of .ini directives to Apache .conf directive list
-- Fixed a 'memory leak' with strtok()
-- echo/print now handle binary data correctly.
-- NEW now accepts any expression for the class name argument.
-- Add ImageDashedLine() GD function
-- Add arg_separator .ini directive so the '&' GET method separator can be
- changed to ';' for example. Corresponding php3_arg_separator Apache .conf
- directive works as well.
-- Walked around an implementation side effect of switch(). <? switch(expr) { ?>
- now works.
-- Added memory caching, resulting in a significant performance boost
-- Added support for for(): .. endfor; loops
-- Added a new predicate - empty($var). Returns true if $var is not set,
- or is FALSE. Returns false otherwise.
-- Added is_integer() (same as is_long()) and is_real() (same as is_double()).
-- Added sizeof() as an alias to the count() function
-- Added --enable-force-cgi-redirect, to prevent the CGI from working if
- someone directly accesses PHP not through Apache's CGI redirect
- (off by default).
-- Fixed marking of deleted dBase records. Noticed by Simon Gornall
- <simon@oyster.co.uk>.
-- Fixed fixed "%%" bug in [s]printf
-- Fixed a UMR (initialized memory read) in the Oracle code
-- Potential fix for mysql-related SIGPIPE problem which caused httpd to spin
-- Made PHP responsive to the Apache link status (stop executing if the link
- dies).
-- Fixed a crash bug with StrongHold and secure pages
-- Fixed StrongHold installation
-- Optimized the function call sequence a bit.
-- Fixed Sybase/CT date/datetime/money fields work to correctly.
-- Fixed Apache module startup problems - php3_module_startup should only be
- called once.
-- Fixed ord() with characters >127
-- Fixed bug in file_exists() function
-- Fixed stripslashes() to remove the escaping quote (instead of backslash)
- in case magic_quotes_sybase is true.
-- Also make echo and print automatically remove trailing decimal zeros.
-- Added htmlentities(), currently handling only ISO-8859-1 entities
-- "0" is no longer considered false, the only string which is false is the
- empty string "".
-- Added 'true' and 'false' keywords
-- Added 'xor' (logical exclusive or)
-- Automatic conversion from double to string removes decimal trailing zeros.
-- Added arsort() and rsort() to sort in descending order.
-- Turned on "XLATOPT_NOCNV" by default for uODBC/Solid.
-- Added support for a port number in the mysql_(p)connect() functions
-- Fixed a file descriptor leak in the configuration parser.
-- Fixed a few buglets with syntax highlighting with certain language keywords
-- Added functions to control minimum severity level of Sybase messages to
- display.
-- Added highlight_string() - behaves like highlight_file(), only instead
- of highlighting a file, it syntax highlights the contents of its
- argument.
-- Renamed show_source() to highlight_file(). show_source() is still
- supported for downwards compatability.
-- Fixed a bug in class inheritence - member functions with upper case
- letters in their names couldn't be redefined.
-- Made chown(), chgrp() and chmod() return TRUE/FALSE instead of 0/-1.
-
-February 02 1998 Version 3.0b4
-- Fixed a segfault bug in one of the unified ODBC error messages.
-- Set default file modes to binary on Win32 (solved a lot of bs)
-- Fixed file copy on Win32
-- MIME file uploads fixed on Win32
-- Added contributed icons by Colin Viebrock (undex extra/icons)
-- Fixed the debugger enough to call it "beta code".
-- Fixed some leaks in the Oracle module, tidied up the code a bit.
-- Added __FILE__ and __LINE__ which evaluate to the currently parsed file
- and currently parsed line respectively.
-- Added ImageColorAt(), ImageColorSet(), ImageColorsForIndex(), and
- ImageColorsTotal() to allow manipulating the palette of GIF images.
-- Rename '--enable-url-includes' option to '--enable-url-fopen-wrapper' to
- better describe what it does, and pay attention to the setting.
-- Added optional parameter to the file(), readfile() and fopen() functions
- to look for files located in the include path.
-- Fixed bug that allowed the file() and readfile() to open files in the
- include path inadvertantly.
-- Fixed a (documented) bug in printf()/sprintf() with hard limited strings
- and alignment (e.g. %-.20s).
-- Optimized several quoted string routines.
-- Added error_log ini directive to select where errors get logged when
- log_errors is turned on or the error_log() function is used.
-- Added the ability to direct errors to log files instead of or in addition
- to the script output. Use the new display_errors and log_errors
- php3.ini directives.
-- Made environment variables uneraseable by POST/GET/Cookie variables.
-- Fixed a bug in the elseif() construct. The expression was being evaluated
- even if a previous if/elseif already evaluated to true and got executed.
-- Fixed a bug in the exit code parameter of system()
-- Tighten up all exec() related functions in safe mode
-- Added error_log() function to log messages to the server error log, or
- stderr for the CGI version.
-- Added support for a general memory limit of scripts.
-- Fixed a segfault bug that occured under certain circumstances with shell
- escapes ($foo = `...`)
-- Made keywords be valid property names of objects.
-- Fixed a segfault bug when creating new objects of an unknown class.
-- Fixed a problem with the maximum execution time limit, that may have
- prevented this feature from working on certain platforms.
-- PHP would now warn you with E_NOTICE about unknown escape characters,
- e.g. "\f". It would still be considered as a backslash followed by f,
- but the proper way of writing this is "\\f" or '\f'.
-- Added support for ${...} inside encapsulated strings. Supported: ${foo},
- ${foo[bar]}, ${foo[0]}, ${$foo[$bar]}, ${$foo->bar} and ${$foo}
-- Fixed a bug in automatic persistent link reconnect of the Sybase/DB module.
- Thanks to Steve Willer for finding that 'stealth' bug!
-- Fixed a crash bug in the GET/POST/Cookie parser in case of regular
- and array variables with the same name.
-- Added round() function.
-- Can't use encapsed strings as variable names anymore, ie. $"blah blah".
-- Fixed bug in gethostby*() functions that resulted in a core dump.
- (Noticed by torben@coastnet.com.)
-- Fixed bug in dbase_get_record that prevented number and date fields
- from being properly decoded. (Thanks again to colins@infofind.com.)
-- Make dbase_get_record include a 'deleted' field that indicates whether
- that record had been marked for deletion.
-- Fixed bug in dbase library that stomped on the deleted flag of the first
- record in the file if it was set. (Thanks to colins@infofind.com.)
-- Fixed putenv() to not report a memory leak and possibly prevent a bug
- from that memory being freed.
-- Added setlocale()
-- Added pg_fieldisnull() (by Stephan Duehr)
-- Changed pg_exec() to always return a result identifier on succees
-- Solid linking fixes (tries to find the right library)
-- Fixed a but with date() and the 'w' element.
-- Tried to eliminate unimportant memory leak notifications.
-- Made min() and max() backwards compatible and able to handle doubles.
-- Add fgetc() function
-- Fixed bug in getmyuid(), getmyinode() and getlastmod(). Thanks to
- khim@sch57.msk.ru for pointing this out.
-- Fixed http:// URL includes with no path specified send request for /.
-- Added GetAllHeaders() (Apache-only)
-- Added workaround that made the Image text functions 8-bit clean
-- Made snmp internally compilable for Win32 (not the unix one though),
- only adds 2k to binary size, so no reason not to have it there.
-- Fixed ldap loading on Win32
-- Fixed MySQL Info function on Win32 platform
-- Fixed compilation of syntax highlighting mode
-
-January 17 1998 Version 3.0b3
-- Added mysql support under windows ;) happy happy joy joy
-- Fixed dbase.dll for Win32 to actualy load now.
-- Enhanced the convertor to recognize ?> as a php-close-block as well.
-- Fixed potential SetCookie() core dumps
-- Changed print to be an expression instead of a statement. That means you can
- now do stuff like foobar() or print("Unable to foobar!"). echo has NOT been
- changed.
-- Removed the flex optimization flags to reduce the size of the scanner
-- Added memory leak logging into apache log files (apache module only)
-- Fixed a nasty bug in one of the internal stacks. This may have caused
- random crashes in several occassions.
-- Fixed bug in ImageGif() making it hang sometimes
-- Added ImageLoadFont(), ImageFontWidth() and ImageFontHeight()
-- error_reporting() now returns the old error reporting level
-- Fixed url includes/opens not working under Win32
-- Fixed errorneous handling of multipart/form-data input
-- Added rawurlencode(), rawurldecode() and changed urlencode() and urldecode()
- a bit too.
-- Fixed a bug in [s]printf, sign was forgotten for doubles.
-- Fixed a segfault bug in pg_fieldprtlen(), and made it accept field names
- in addition to field offsets.
-- Made the setup script a little more user-friendly.
-- Added is_long(), is_double(), is_string(), is_array() and is_object()
-- Fixed a bug in freeing of mSQL results.
-- Improved pg_exec() to properly return true or false with queries that don't
- return rows (i.e. insert, update, create, etc)
-- Added get_cfg_var() to enable checking cfg file directives from within
- a script.
-- Fixed a bug with urlencode() and characters 0x80-0xff
-- Changed the behaviour of ereg_replace to more intuitive. The
- backslashes other than valid existing back references in the second
- argument are no more evaluated as escape sequences.
-- Fixed a bug in the configuration file loader and safe mode.
-- Fixed a bug with configuration variables taken from the environment.
-- Added <script language=php> </script> as PHP open/close tags, to allow
- the use of editors such as Microsoft Frontpage.
-- Fixed a bug in the default php3.ini directory - it wasn't defaulting to
- /usr/local/lib properly.
-- Added support for \r\n line endings
-- Fixed a bug that may have prevented POST method variables from working
- with certain scripts when using the CGI version.
-- Convertor: Added support for single-quoted strings
-- Fixed segfault bug in the Adabas module, with queries that don't return
- rows (update, insert, etc).
-
-December 22 1997 Version 3.0b2
-- Changed variable type conversions that do not specify base to always use
- base 10. "010" is no more 8, it is 10. Use intval ($x, 0) to get C-style
- octal and hex numbers recognized.
-- Fixed a possible segfault bug in several functions, when using the concat
- operator and possibly other operators/functions.
-- # is no longer accepted as a comment in php3.ini. Use ; instead.
-- Added browscap support
-- Configuration file directives are now case-sensitive
-- Fixed msql_tablename() and msql_dbname()
-- Added a PHP/FI 2.0 -> PHP 3.0 convertor
-- Added support for shell/perl-style single quotes
-- Added support for execution of external programs using backquotes ($a=`ls -l`)
-- fixed mail() on windows, also fixed memory leaks in mail on windows
-- added sendmail_from to handle return route on windows
-- Changed the way the config file is searched. The file name is now
- php3.ini (hardcoded), and it'll be looked for in: local directory, $PHPRC
- and builtin path designated by ./configure under UNIX or Windows directory
- under Windows.
-- Fixed ereg_replace replacing empty matches and a one off buffer overflow
-- Fixed File upload on windows platform
-- Fixed a bug that caused 'HTTP/1.1 100 Continue' messages with
- Internet Explorer 4.0 and certain scripts that receive POST variables
-- Get/POST/Cookie data variables are from now *ALWAYS* strings. If you want
- to use them in integer/real context, you must explicitly change their types.
- This was done in order to avoid possible loss of data when doing these
- conversions automatically.
-- Variables named as keywords are now allowed (e.g. $function, $class, etc)
-- Fixed a problem with msql() and mysql() with NULL fields
-- Fixed a segfault bug with class declarations
-- Fixed bugs with FOR loops and include() from within eval()
-- Changed include() to be executed conditionally. PHP-3.0 efficient
- unconditional include is now require()
-
-December 08 1997 Version 3.0b1
-- Switched to public beta test phase
-- Generalized unset() and isset() to work on any type of variables, including
- specific array indices or object properties (e.g., unset($a[4]) now works).
-- Added support for object references inside encapsulated strings
- (for example, 'echo "Username: $user->name"' now works)
-- Added arbitary precision math support (basic operations with
- unlimited range numbers, and support for unlimited decimal digits)
-- Apache module can now handle preprocessed scripts (by using:
- AddType application/x-httpd-php3-preprocessed .php3p
- in the Apache configuration)
-- Made settype() pass its first parameter by value. Improved it to be able
- to convert to arrays and objects (originally by Steve Willer)
-- Implemented CPU time limit on scripts when setitimer() is available
-- Computed field names in the Sybase/CT and Sybase/DB modules are now named
- computed, computed1, computed2, ...
-- Added Sybase/CT client/server message handlers and updated the Sybase/DB ones
-- Made the regexp function automatically take arguments by reference
- when necessary
-- Added builtin support for auto append and prepend in the parser level
-- Improved the Sybase/CT sybase_query(). Should be more stable now, and
- hopefully work with a wider range of queries. It's difficult to work
- without docs, though, so it may still not be 100% right...
-- Changed error messages to show error type, file and line with bold
-- Added support for autoprepend and autoprepend
-- Added some more warning flags if gcc is used
-
-December 03 1997 Version 3.0a4
-- Improved the internal functions API - no need to explicitly pass
- parameters by reference to internal functions that specifically
- require them, e.g. sort(), ksort(), reset(), count(), etc.
- This is *STILL* downwards compatible with the previous alphas,
- in the sense that you can explicitly pass the arguments by reference
- if you want to.
-- use srandom/random instead of srand/rand if available
-- Added [m,My]sql_listfields() for downwards compatability
-- -p now replaces .php3 extension with .php3p (otherwise it adds .php3p)
-- Added C++ style comments (// comment)
-- Fixed # commenting to terminate at a close PHP tag
-- Added \0 back reference for full string match to *reg*_replace and
- added backslash escaping to replace string
-- Fixed a few bugs in the Sybase DB-library module.
-- Added Sybase CT-library support. It should be considered experimental.
- Syntax is identical to the one of the DB-library. Allows people to
- connect to MS-SQL servers from Linux without having to pay for a
- library!
-- Beautified phpinfo()
-- Add ImageColorClosest() and ImageColorExact() GD functions
-- Make all .ini directives work as Apache .conf directives as well
-- Added PHP2-like File() function with PHP3 URL support
-- Upgraded the Sybase interface. It's practically MySQL compatible now!
- Among other things, added sybase_fetch_array() and sybase_fetch_object().
-- Fixed problem in multi dimensional array handling and self modifying
- operators (+=, -=, etc).
-- Safe Mode file open implementation
-- SVR3 portability problem fix
-
-November 23 1997 Version 3.0a3
-- Made the global statement behave like PHP 2 with undefined variables
-- Added msql_fetch_object() and msql_fetch_array()
-- Switched between the 1st and 2nd parameters to explode(), so that it acts
- like split()
-- Fixed passthru(), exec() and system() functions
-- Implemented second optional parameter to intval() to specify conversion base
- (The default is to assume you want to do a base 10 conversion.)
-- Implemented SQL safe mode for MySQL
-- Read UploadTmpDir from php3.ini instead of apache conf files
-- Added mysql_fetch_object() and mysql_fetch_array()
-- Changed function->old_function. function is now an alias to cfunction.
-- Split the magic_quotes directive to get/post/data and other
-- Added generic copy() function
-- Added a $GLOBALS[] array, which contains all global variables
-- Fix broken getimagesize() function
-- Made mysql_fetch_field() and msql_fetch_field() optionally accept a 2nd argument
-- Fixed mysql_data_seek() and msql_data_seek()
-- Changed list assignment to list(...) and array init to array(...)
-- Made <?php_track_vars?> work
-- cgi when not in debug mode uses regular malloc(), free() functions now
-- Added preliminary support for perl-style list assignments
-- Fixed a bug in mysql_result() and msql_result() when specifying table
-- renamed internal error-handling function and levels
-- Added basename and dirname functions similar to sh counterparts
-- Added base64_encode() and base64_decode()
-- Support Basic authorization for http url includes
-- Added parse_url() function to extract url components
-- Made it possible to use anonymous ftp on URL includes
-- Fixed url includes to handle different URLs better
-- Fixed mysql_field*() functions
-- Made mysql_connect() smarter, after a mysql_close() (applies to msql and pgsql too)
-
-November 6 1997 Version 3.0a2
-- Fixed a segfault bug caused by non-persistent connect in [m,My,Postgres]SQL modules
-- Fix command line argument handling
-- Made empty array list assignments work ($a=({});)
-- Made '$' escaping optional when a variable name parsing isn't possible
-- Added support for mysql_[p]connect(host) and mysql_[p]connect(host,user)
-- New layout in phpinfo()
-- Update Oracle extension to use php3_list functions
-- Add includepath support
-- Add #!php shell script escape support
-- Change name of CGI/command line version from php3.cgi to php
-- Add SNMP extension
-- show_source() support
-- Parsing of command-line args for CGI version
-- Support for backreferences in ereg_replace
-- Support for hexadecimal numbers directly at the scanner level
-- Support octal numbers directly at the scanner level
-- Fixed problem with huge html files (with little or no php code)
-- Fix eval() empty string argument core dump
-- renamed 'install' to 'setup' to be more accurate and avoid name conflict
-- Fixed Oracle compilation
-- Fixed mSQL 1.0 compilation
-- Fixed a problem in the mSQL, MySQL and PostgresSQL drivers and NULL fields.
-- Fixed the GLOBAL statement to be able to declare an array.
-
-October 29 1997 Version 3.0a1
-- Start with excellent new parser from Andi and Zeev
diff --git a/ChangeLog.TODO b/ChangeLog.TODO
deleted file mode 100644
index db7230a5fd..0000000000
--- a/ChangeLog.TODO
+++ /dev/null
@@ -1,103 +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.
-- avoid stripping double slashes when fopen'ing files (Sascha)
-- sql_regcase() change: only apply to alphabetic characters (Sascha)
-- add snmprealwalk() (Sascha Schumann)
-- fix serious bug in strftime() (Sascha Schumann)
-- fix bug in ucwords() (Sascha Schumann)
-- optimized fgets() and fread()
-- memory leak in operators.c fixed
-- socket leak fixed (Sascha Schumann)
-- Fixed the XML bug that caused garbage behind attributes
-- Some Informix driver improvements.
-- PUT method support (mlemos@acm.org)
-- Add ldap_mod_add(), ldap_mod_del() and ldap_mod_replace() (Gerritt Thomson)
-- Fix parameter count problem in odbc_setoption()
-- Replace broken str_replace(). The fix in 3.0.7 was bogus (Sascha Schumann)
-- Really fix implode() this time. The fix in 3.0.7 was bogus
-- Added more option to the date() function: (Colin Viebrock)
- 'g' - hour, 12-hour format, no leading zeros
- 'G' - hour, 24-hour format, no leading zeros
- 'n' - month, numeric, no leading zeros
-- Make fgetss() slightly smarter
-- Add strip_tags() which uses the fgetss state-machine but acts on a string
-- Add CRYPT_SALT_LENGTH constant
-
-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
-- Added YP/NIS module from Stephanie Wehner
-- Added optional second argument to mysql_fetch_array(); MYSQL_ASSOC will
- cause the resulting array to contain the associative indices only,
- MYSQL_NUM will cause the array to contain the numeric indices only (like
- mysql_fetch_row()) and MYSQL_BOTH would cause them both to be defined
- (default).
-- Backport the Zend debugging memory manager into the PHP 3.0.x tree.
-- 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
-- Add flock() function
-- 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 <mka@satama.com>
-- Fixed checkdate() function, range of valid years is now 0 to 32767
-- Make sure XML element attributes have the right character encoding
-- 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
-- Constructors of parent classes weren't accessible to derived classes (as
- of 3.0.6). Fixed.
-- Introduce simple regex compilation cache
-- Add gettimeofday() function
-- Add getrusage() function
-
-
diff --git a/EXTENSION_STATUS b/EXTENSION_STATUS
deleted file mode 100644
index 48be544e2d..0000000000
--- a/EXTENSION_STATUS
+++ /dev/null
@@ -1,54 +0,0 @@
-The core of PHP 3.0 is considered to be stable at this time. However, some of
-the modules that are bundled with it are still undergoing development, or
-contain known bugs. The purpose of this file is to document the status of
-each module (extension). Patches to unstable modules will be available through
-the CVS, and through periodic maintenance releases.
-
-Stability scale:
-Rock solid - We believe it's safe to base a production site on it.
-Stable - It should be safe to base a production site on it.
- Isn't rated as rock-solid because it contained problems
- in the not-so-far past, or doesn't have enough users
- to test it to know it's rock solid.
-Beta - This module probably contains bugs, sometimes even known
- bugs. You can give it a try and there's a good chance
- it'll work fine, but it might not be a good idea to base
- a production site on it.
-Alpha - This module is in initial development steps. Don't trust
- it, play with it at your own risk.
-Deprecated - This module is only available for downwards compatability,
- and will not be supported in any way. The code quality
- is usually around the Beta status.
-
-The standard disclaimers apply, that is, if a rock-solid module blows up on
-you and ruins your site, nobody in the PHP development team is responsible.
-We'll probably try to help, though.
-
-
-Extension Name Status Comments
------------------------------------------------------------------------------
-DBM Rock Solid That relies on a working DBM library.
- The flatfile support is probably not
- as stable.
-MySQL Rock Solid
-mSQL Rock Solid
-Sybase DB Stable
-Sybase CT Stable
-BC Math Rock Solid Arbitary precision math library
-Postgres SQL Stable Postgres 6.2 and earlier is stable,
- but problems were reported with 6.3
-Debugger Beta
-Unified ODBC Beta
-Solid Deprecated Replaced by Unified ODBC
-iODBC Deprecated Replaced by Unified ODBC
-Adabas Deprecated Replaced by Unified ODBC
-LDAP Stable Lightweight Directory Access Protocol.
-dBase
-FilePro
-Oracle Beta Not tested thoroughly enough.
-IMAP Beta Bundled in the dl/ directory
-SNMP Stable Very solid, but also very limited.
- Only supports GET and WALK requests.
-Raima Velocis Beta If use with Unified ODBC, replaced
- by Unified ODBC
-Raima Velocis Alpha If use without Unified ODBC
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 6ab6615791..0000000000
--- a/INSTALL
+++ /dev/null
@@ -1,159 +0,0 @@
-Installation Instructions for PHP3
-----------------------------------
-
-For the impatient here is a quick set of steps that will build PHP3
-as an Apache module for Apache 1.3.0 with MySQL support. A more verbose
-explanation follows.
-
-
-QUICK INSTALL
-
-gunzip apache_1.3.x.tar.gz
-tar xvf apache_1.3.x.tar
-gunzip php-3.0.x.tar.gz
-tar xvf php-3.0.x.tar
-cd apache_1.3.x
-./configure --prefix=/www
-cd ../php-3.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/php3/libphp3.a
- (The above line is correct! Yes, we know libphp3.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-3.0.x
-cp php3.ini-dist /usr/local/lib/php3.ini
-You can edit /usr/local/lib/php3.ini file to set PHP options.
-Edit your httpd.conf or srm.conf file and add:
- AddType application/x-httpd-php3 .php3
-
-
-VERBOSE INSTALL
-
-Installing PHP3 can be done in four simple steps:
-
-1. Unpack your distribution file.
-
- You will have downloaded a file named something like php3xn.tar.gz.
- Unzip this file with a command like: gunzip php3xn.tar.gz
-
- Next you have to untar it with: tar -xvf php3xn.tar
-
- This will create a php-3.0.x directory. cd into this new directory.
-
-2. Configure PHP3.
-
- You now have to choose the options you would like. There are quite
- a few of them. To see a list, type: ./configure --help
-
- You can also use the supplied 'setup' script, which will ask you
- a series of questions and automatically run the configure script
- for you.
-
- 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/php3 directory in your Apache distribution if
- you are using Apache 1.3.x. If you are still running Apache 1.2.x
- these files will be copied directly to the main src directory.
-
- For Apache 1.3b6 and later, you can use the new APACI configuration
- mechanism. To automatically build Apache with PHP support, use:
-
- cd apache_1.3.x
- ./configure --prefix=/<path>/apache \
- --activate-module=src/modules/php3/libphp3.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/php3/libphp3.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 php3_module mod_php3.o
-
- For Apache 1.2.x you will also have to look in the libphp3.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 libphp3.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. -lphp3 -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 libphp3.module file.
-
- Also, look at the RULE_WANTHSREGEX setting in the libphp3.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-php3 .php3
-
- 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-php3-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.
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index a59e164971..0000000000
--- a/LICENSE
+++ /dev/null
@@ -1,64 +0,0 @@
- --------------------------------------------------------------------
- Copyright (c) 1998 The PHP Development Team. All rights reserved.
- --------------------------------------------------------------------
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Commercial redistribution of larger works derived from, or
- works which bundle PHP, requires written permission from the
- PHP Development Team. You may charge a fee for the physical
- act of transferring a copy, and must make it clear that the
- fee being charged is for the distribution, and not for the
- software itself. You may, at your option, offer warranty
- protection in exchange for a fee.
-
- 2. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 3. 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.
-
- 4. All advertising materials mentioning features or use of this
- software must display the following acknowledgment:
- "This product includes software written by the PHP Development
- Team"
-
- 5. The name "PHP" must not be used to endorse or promote products
- derived from this software without prior written permission
- from the PHP Development Team. 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.
-
- 6. Redistributions of any form whatsoever must retain the following
- acknowledgment:
- "This product includes software written by the PHP Development
- Team".
-
- 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 Development Team.
-
- The PHP Development Team can be contacted via Email at core@php.net.
-
- For more information on the PHP Development Team and the PHP
- project, please see <http://www.php.net>.
-
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index f363e5eac8..0000000000
--- a/Makefile.in
+++ /dev/null
@@ -1,204 +0,0 @@
-# +----------------------------------------------------------------------+
-# | PHP HTML Embedded Scripting Language Version 4.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. |
-# +----------------------------------------------------------------------+
-
-#
-# $Id$
-#
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-srcdir = @srcdir@
-VPATH = @srcdir@
-bindir = @bindir@
-
-ZEND_DIR = $(srcdir)/libzend
-SUBDIRS=$(srcdir)/libzend ext
-
-CC = @CC@
-AR = ar rc
-BINNAME = @BINNAME@
-INSTALL_IT = @INSTALL_IT@
-EXTRA_LIBS = @EXTRA_LIBS@
-EXT_LIBS = @EXT_LIBS@
-INCLUDES = @INCLUDES@
-INCLUDE = -I$(srcdir) -I. -I$(ZEND_DIR) $(INCLUDES)
-PROF_CFLAGS =
-CFLAGS_SHLIB = @CFLAGS_SHLIB@
-LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
-LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
-CPPFLAGS = @CPPFLAGS@
-CFLAGS = @CFLAGS@ $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) @DEBUG_CFLAGS@ @STRONGHOLD@ $(PROF_CFLAGS)
-LDFLAGS = @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT) -L$(ZEND_DIR)
-REGCFLAGS = $(CFLAGS)
-RANLIB = @RANLIB@
-YACC = @YACC@
-MAINT = @MAINT@
-APXS = @APXS@
-APXS_LDFLAGS = @APXS_LDFLAGS@
-WARNING_LEVEL = @WARNING_LEVEL@
-
-SOURCE = main.c internal_functions.c snprintf.c php3_sprintf.c \
- configuration-parser.c configuration-scanner.c request_info.c \
- safe_mode.c fopen-wrappers.c php3_realpath.c alloca.c output.c \
- php_ini.c
-OBJS = main.o internal_functions.o snprintf.o php3_sprintf.o \
- configuration-parser.o configuration-scanner.o request_info.o \
- safe_mode.o fopen-wrappers.o php3_realpath.o alloca.o output.o \
- php_ini.o
-
-FUNCTIONS_SOURCE = functions/apache.c functions/fhttpd.c \
- functions/crypt.c functions/db.c functions/dl.c functions/filepro.c \
- functions/head.c functions/imap.c functions/mime.c \
- functions/msql.c functions/mysql.c \
- functions/oracle.c functions/oci8.c functions/pgsql.c \
- functions/post.c functions/sybase.c \
- functions/sybase-ct.c @BCMATH_SRC@ functions/xml.c \
- functions/ldap.c functions/zlib.c functions/COM.c functions/ifx.c \
- functions/pdf.c functions/hw.c functions/hg_comm.c functions/dlist.c \
- functions/fdf.c functions/snmp.c functions/interbase.c \
- functions/sysvsem.c functions/sysvshm.c functions/dav.c
-
-FUNCTIONS = $(FUNCTIONS_SOURCE:.c=.o)
-PHPLIBS = -L@top_srcdir@/libzend -lzend -Lext -lphpext
-LIBS = $(PHPLIBS) $(EXTRA_LIBS) @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@ @FHTTPD_LIB@ @REGEX_LIB@ @DBM_LIB@ @ORACLE_LFLAGS@ @ORACLE_LIBS@ @SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@ @MYSQL_LFLAGS@ @MYSQL_LIBS@ @MSQL_LFLAGS@ @MSQL_LIBS@ @PGSQL_LFLAGS@ @PGSQL_LIBS@ @LDAP_LFLAGS@ @LDAP_LIBS@ @IMAP_LIBS@ @ZLIB_LIBS@ @PDFLIB_LIBS@ @FDFLIB_LIBS@ @IFX_LFLAGS@ @IFX_LIBS@ @SNMP_LFLAGS@ @SNMP_LIBS@ @IBASE_LFLAGS@ @IBASE_LIBS@ @XML_LIBS@ @LIBS@
-
-all: $(BINNAME)
-
-all-recursive clean-recursive distclean-recursive \
-maintainer-clean-depend-recursive:
- @set fnord $(MAKEFLAGS); amf=$$2; \
- for subdir in $(SUBDIRS); do \
- target=`echo $@ | sed s/-recursive//`; \
- echo "Making $$target in $$subdir"; \
- (cd $$subdir && $(MAKE) $$target) || fail=yes; \
- done && test -z "$$fail"
-
-# CGI binary or fhttpd module
-php: all-recursive $(OBJS) $(FUNCTIONS) @REGEX_LIB@ @FHTTPD_LIB@
- $(CC) $(CFLAGS) -o $(BINNAME) $(LDFLAGS) $(OBJS) $(FUNCTIONS) $(LIBS)
-
-# Apache modules
-libphp3.a libmodphp3.a libmodphp3-so.a: all-recursive $(OBJS) $(FUNCTIONS)
- $(AR) $@.tmp $(OBJS) $(FUNCTIONS)
- $(srcdir)/scripts/armerge $@ $@.tmp ext/libphpext.a $(srcdir)/libzend/libzend.a
- @rm -f $@.tmp
- $(RANLIB) $(BINNAME)
-
-# Apache 1.3 shared module
-libphp3.so: $(srcdir)/mod_php3.c libmodphp3-so.a
- $(APXS) -c -o libphp3.so $(APXS_LDFLAGS) mod_php3.c libmodphp3-so.a
-
-regex/libregex.a:
- (cd regex; $(MAKE) lib)
-
-functions/ifx.c: functions/ifx.ec
- (if test @INFORMIXDIR@; then esql -e @IFX_ESQL_FLAGS@ functions/ifx.ec; mv ifx.c functions; else touch functions/ifx.c; fi)
-
-configuration-parser.h configuration-parser.c: $(srcdir)/configuration-parser.y
- bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-parser.c
-
-configuration-scanner.o: configuration-scanner.c
- $(CC) $(CFLAGS) -w$(WARNING_LEVEL) -c configuration-scanner.c
-
-configuration-scanner.c: $(srcdir)/configuration-scanner.l
- flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner.l
-
-clean: clean-recursive
- -rm -f libphp3.a libmodphp3.a php *.o
- -rm -f $(FUNCTIONS) functions/ifx.c
- -rm -f test/php.desc test/php.in test/php.out test/php.test
- -rm -f test/a.tmp test/b.tmp test/test.dbm*
-
-distclean: clean distclean-recursive
- -rm -f *-parser.[ch] *-scanner.c *.output
- -rm -f config.status config.cache config.log
- -rm -f Makefile Makefile.depend config.h build-defs.h
- -rm -f libphp3.module stamp-h
- -rm -f regex/*.o regex/*.a regex/*.ih
- -rm -f doc/checkdoc doc/funcparse doc/version.ent
- -rm -f do-conf test/test.log extra/gd/bdf2gdfont
- -rm -f doc/Makefile regex/Makefile
-
-maintainer-clean-depend: maintainer-clean-depend-recursive
-
-bench: $(BINNAME)
- ./$(BINNAME) -c. tests/bench.phtml
-
-# can't use a single rule for this because 'test' is a directory
-test: regression
-regression check: $(BINNAME)
- cd test && ./testall
-
-config.status: configure
- ./config.status --recheck
-
-build-defs.h config.h: stamp-h
-stamp-h: config.h.in config.status
- CONFIG_FILES='build-defs.h stamp-h' ./config.status
-
-Makefile: Makefile.in config.status
- CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
-
-#
-# You must use '--enable-maintainer-mode' with configure to enable
-# these rules, which requires autoconf be installed.
-#
-configure: @MAINT@ configure.in aclocal.m4
- cd $(srcdir) && autoconf
-
-config.h.in: @MAINT@ stamp-h.in
-stamp-h.in: configure.in aclocal.m4 acconfig.h
- cd ${srcdir} && autoheader && touch ${srcdir}/stamp-h.in
-
-install: $(BINNAME)
- $(INSTALL_IT)
-
-indent: clean
- indent -v -kr -cli4 -ts4 \
- -T pval -T HashTable -T Bucket -T Token -T TokenCache -T TokenCacheManager \
- -T switch_expr -T internal_function -T control_structure_data \
- -T MemoryHashTable -T MemoryBucket \
- -T pvalue_value -T Stack *.c *.h functions/*.c functions/*.h
- rm -f *~ functions/*~
-
-.c.o:
- $(CC) $(CFLAGS) -c $< -o $@
- @bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
- (test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)
-
-functions/number.o: functions/number.c
- $(CC) $(CFLAGS) -w$(WARNING_LEVEL) -c $< -o $@
- @bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
- (test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)
-
-parser-scanner: configuration-parser.c configuration-scanner.c
-
-depend: parser-scanner
- $(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend
- $(CC) $(CFLAGS) -MM $(FUNCTIONS_SOURCE) | perl -pe 's|^(.+\.o)|functions/$$1|; s|regex/regex.h||;' >> Makefile.depend
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/README.QNX b/README.QNX
deleted file mode 100644
index d70d2e5d8b..0000000000
--- a/README.QNX
+++ /dev/null
@@ -1,57 +0,0 @@
-QNX4 Installation Notes
------------------------
-
-NOTE: General installation instructions are in the INSTALL file
-
-
-1. To compile and test PHP3 you have to grab, compile and install:
- - GNU dbm library or another db library;
- - GNU bison (1.25 or later; 1.25 tested);
- - GNU flex (any version supporting -o and -P options; 2.5.4 tested);
- - GNU diffutils (any version supporting -w option; 2.7 tested);
-
-2. To use CVS version you may need also:
- - GNU CVS (1.9 tested);
- - GNU autoconf (2.12 tested);
- - GNU m4 (1.3 or later preferable; 1.4 tested);
-
-3. To run configure define -lunix in command line:
- LDFLAGS=-lunix ./configure
-
-4. To use Sybase SQL Anywhere define ODBC_QNX and CUSTOM_ODBC_LIBS in
- command line and run configure with --with-custom-odbc:
- CFLAGS=-DODBC_QNX LDFLAGS=-lunix CUSTOM_ODBC_LIBS="-ldblib -lodbc" ./configure --with-custom-odbc=/usr/lib/sqlany50
- If you have SQL Anywhere version 5.5.00, then you have to add
- CFLAGS=-DSQLANY_BUG
- to workaround its SQLFreeEnv() bug. Other versions has not been tested,
- so try without this flag first.
-
-5. To build the Apache module, you may have to hardcode an include path for
- alloc.h in your Apache base directory:
- - APACHE_DIRECTORY/src/httpd.h:
- change #include "alloc.h"
- to #include "APACHE_DIRECTORY/src/alloc.h"
- Unless you want to use system regex library, you have to hardcode also
- a path to regex.h:
- - APACHE_DIRECTORY/src/conf.h:
- change #include <regex.h>
- to #include "APACHE_DIRECTORY/src/regex/regex.h"
- I don't know so far why this required for QNX, may be it is Watcom
- compiler problem.
-
- If you building Apache module with SQL Anywhere support, you'll get
- symbol conflict with BOOL. It is defined in Apache (httpd.h) and in
- SQL Anywhere (odbc.h). This has nothing to do with PHP, so you have to
- fix it yourself someway.
-
-6. With above precautions, it should compile as is and pass regression
- tests completely:
- make
- make check
- make install
-
- Don't bother me unless you really sure you made that all but it
- still doesn't work.
-
-June 28, 1998
-Igor Kovalenko -- owl@infomarket.ru
diff --git a/README.WIN32 b/README.WIN32
deleted file mode 100644
index 4e667d17ea..0000000000
--- a/README.WIN32
+++ /dev/null
@@ -1,59 +0,0 @@
-Windows 95/NT Specific Notes on Compilation
-
-Windows compilation has only been tested with Microsoft Visual C++
-Version 5 Standard Edition. The PHP executable has only had limited
-testing under Windows 95. SAFE MODE and any User or Group functionality
-has not been ported/tested.
-
------------------------------------------------------------------------
-Compiling PHP with MSVC5
-
-There are three msvc workspaces provided with this distribution. The one
-most people will use is php3.dsw. This contains project files for two
-versions on PHP, one with mySQL compiled internaly, and one without (both
-have ODBC internaly compiled). It also contains all the modules.
-
-The next workspace is php3extras.dsw. This project contains the converter
-and a program called phpwatch, which is a simple program to watch debugger
-output under windows. The 'socket' program is also available from the php
-site, which is a better alternative to phpwatch.
-
-The third workspace is php3sapi.dsw. These projects are experimental and
-will probably not compile most of the time. It contains preliminary work
-on the server api's for windows.
-
------------------------------------------------------------------------
-Base Configuration and Configuration Issues
-
-*The base configuration for the windows php version contains odbc
- support. Support for other database modules will be provided as external dll files.
-*ODBC can be used to connect to many of the databases previously
-supported by php (though they can still be compiled in if you have
-the libraries!)
-
------------------------------------------------------------------------
-Makefiles
-
-Be sure to edit any windows makefile and change the include directories
-to be appropriate for your system.
-
------------------------------------------------------------------------
-CGI Version
-
-The makefile for the cgi version of php is located in the win32
-subdirectory of the php source tree. This make file is specificaly
-for Visual C++ V5.
-
------------------------------------------------------------------------
-ISAPI/NSAPI/WSAPI/Apache Versions
-
-These versions are not yet working. They are located in the php3sapi.dsw
-workspace.
-
-
------------------------------------------------------------------------
-Other Libraries
-
-See the php faq at php.net for information on where to obtain the various
-libraries needed to compile some modules.
-
diff --git a/TODO b/TODO
deleted file mode 100644
index 5a35e411df..0000000000
--- a/TODO
+++ /dev/null
@@ -1,100 +0,0 @@
-$Id$
-
-+----
-| * -- to be done
-| ? -- to be done sometime if possible
-| P -- in progress (name should appear in parentheses after task)
-| D -- delayed until later date (specify in parentheses after task)
-| U -- done, untested
-| V -- done
-+----
-
-Configuration Issues
---------------------
-* properly detect dbm routines when they're in libc
-* add the appropriate #define magic for memmove and friends (see
- GNU autoconf info pages for details)
-* make it possible to disable support for some extensions (gd, dbm)
-* make it possible to build selected extensions so they are
- dynamically-loadable
-
-Core Language Issues
---------------------
-* go through PHP2's php.h and see how each special #define might be
- applied/supported in PHP3
-* move Treatdata() to language-scanner.lex where hash_environment()
- is called including a decision about priority of variables and moving
- Treatdata() to use hash_add() instead of hash_update() for insertions
- to the symbol table.
-* go through FIXME and XXX lines (egrep 'FIXME|XXX' *.[ch])
-* make lexer and parser thread-safe
-* verify that binary strings are handled correctly
-V don't evaluate truth expressions more than once
-V make unset() work on arrays (tricky)
-
-Core Functions
---------------
-* go through all file functions and make sure they are opened in binary
- mode in win32 if needed (ie copy)
-* go through all functions and look at PHP_SAFE_MODE issues
-* have a look at return codes of fsockopen() function - we should
- probably RETURN_FALSE and then set an error code somewhere (Rasmus)
-* go through FIXME and XXX lines (egrep 'FIXME|XXX' functions/*.[ch])
-* add user-level flock() implementation to let people lock and unlock files
-* add "'" modifier to sprintf to group thousands by comma
-* Add an improved eval() that doesn't "leak"
-? sorting of objects with a user-defined comparison function (like Perl)
- (this shouldn't be expected before 3.1, if at all).
-
-
-Extensions
-----------
-* add version strings for all extensions
-* Oracle persistent connections
-U gd support for windows
-* Illustra support (APIS)
-? CQL++ support (http://www.cql.com/)
-? GNU SQL support (does anybody actually use this?)
-? DB2 support (http://www.sleepycat.com/)
-? Shore support (http://www.cs.wisc.edu/shore/)
-? PGP Interface (use PGPlib?)
-? more Perl-like regex handling?
-
-Server Support
---------------
-P ISAPI (Shane)
- * process cookies
- * blocking functions
- * make sure it's Microsoft-clean so it can be used with other ISAPI
- implementations
-* WSAPI
-* NSAPI
- * process cookies
- * check POST method handling code
- * use Netscape memory allocation inside emalloc() and company
-* FastCGI support - see http://fastcgi.idle.com/
-
-Win32 Specific
---------------
-* implement some kind of syslog->file log support for win95.
-* change all file open/read/write functions from c library to win32
- api file functions. The win32 api functions handle both disk files
- and network files. This will allow include and require to use http
- or ftp files as the unix version does, and do away with my
- workaround to support this. (3.1?)
-* implement symlinks via windows shell links (shortcuts). This will
- work only at the script level and is not a c language level port.
-
-Testing
--------
-* truss/strace a typical PHP request and see if there are some system
- calls that could be optimized out
-* verify that regression tests exist for all core functions
-
-Miscellaneous
--------------
-* remove hard-coded compilation options
-? locale issues - funny things happen in PHP2 when the locale is set to
- use , instead of . as the decimal seperator. ie. 1.5+1.5 = 1
-? SSI->PHP3 conversion script
-? SQL-based access logging (start with examples/log-*.php3)
diff --git a/WISHLIST b/WISHLIST
deleted file mode 100644
index 99d3876a00..0000000000
--- a/WISHLIST
+++ /dev/null
@@ -1,17 +0,0 @@
-- Persistant per-process scripting
-
- Apache 1.3 has added things that makes this much easier than before.
- The module structure now contains a child_init hook and a child_exit
- hook where you can register functions to be called when an httpd
- process starts up and when one shuts down (due to MaxRequestsPerChild
- or a Kill). The only real trick now is to come up with some sort of
- syntax for specifying what to do from the child_init call and the
- child_exit call.
-
- One idea is to be able to add a <PHP>...</PHP> block to the Apache
- httpd.conf file which would somehow define a series of PHP statements
- to be executed from the child_* calls. One for startup and another
- block for shutdown. These blocks would work with the per-process
- memory pool, so any variables initialized here would have a lifespan
- equal to that of the httpd process. Basically request-spanning
- global variables.
diff --git a/WISHLIST-3.1 b/WISHLIST-3.1
deleted file mode 100644
index 1320f71907..0000000000
--- a/WISHLIST-3.1
+++ /dev/null
@@ -1,55 +0,0 @@
-V Do yystype_ptr and hash pointers the right way - use the hash
- pointer and the bucket pointer, instead of a pointer to the data.
- Allows for a real unset() among other things.
-V Improve performance of simple variable lookups
-* Improve string performance by using smarter memory allocation methods
-- Improve preprocessor (handle require() efficiently), possibly handle
- automatic preprocessing for sites based on timestamp
-V Use a reference count mechanism to prevent unnecessary duplication of data.
-* Write and stabilize a complete persistent data API. Feature wishlist:
- - memory manager using shared memory
- - process-global symbol table
- - make api inter-thread capable for win32 and some far off future where unix
- version will be multithreaded
-V Handle out of memory (inside emalloc()?)
-* Try to figure out a way to declare *real* global variables
-* Improve the reading of configuration variables into php3_ini (generalize)
- Make it possible to implement config_get("configuration_variable") and
- config_set("configuration_variable","value") that'll work with *php3_ini*,
- not the configuration hash!
-* Bundle some nice classes (like Bjørn's graphing class)
-* Bundle some database abstraction classes
-* Distribute binaries
-* Clean up API and modules to make .so modules portable across CGI and server
- binaries
-* dbm cleanup (don't arbitrarily pick, and support multiple concurrent formats)
-* start system defines so that we can move away from the standard c lib on
- windows to the win32 lib. (file functions primarily)
-* COM implementation so php can be used as an asp language (cant find any docs
- on how this is done though)
-* Clean up the file structure so the top-level directory isn't such a mess.
-* Bring the module concept to maturity: use libtool and make it
- possible to decide at compile time whether you want to compile a
- module statically or dynamically. Remove the distinction between
- the stuff currently in dl/ and functions/.
-* a way of letting each module specify its options, so ini file options and
- Apache directives can be set up from the same specification.
-V Make it possible to declare smarter user functions: (done in 3.0)
- - Optional parameters
- - Parameters that are forced/prefered by reference
-* Make object parsing more general, and allow nested arrays/objects with
- unlimited levels.
-V Make it possible to copy references of variables.
-* data tainting (like perl -T)
-* multi-dimensional array support in GET/POST/COOKIE handling code
-* Persistent functions and classes
-* odbc_fetch_assoc
-* Add env handling to gpc_order
-* Populate track_vars regardless of gpc_order
-* a real exec() function
-* Support passing arguments to functions by name (e.g. foo(arg1 => "bar", arg2 => "foobar"))
-* Add an optional setting to destroy persistent resources if a PHP script terminates
- abnormally
-V COM automation support for Win32
-? Add a setting for making function names case sensitive
-* stat() files before feeding them to flex - it doesn't handle special files very well
diff --git a/Zend/LICENSE b/Zend/LICENSE
deleted file mode 100644
index df4543ee10..0000000000
--- a/Zend/LICENSE
+++ /dev/null
@@ -1,37 +0,0 @@
-Zend Temporary License
-======================
-
-This is a temporary license, that is in effect until the final Zend license
-is available.
-
-* The final license will include the ability to distribute Zend freely,
- as a part of PHP (in both compiled and source code formats). It may
- (and probably will) allow to redistribute Zend under other circumstances
- as well, but at the very least, it'll be freely distributed as a part
- of PHP.
-
-* The source code in the Zend engine is the property of Andi Gutmans and
- Zeev Suraski. Parts of this code are based on source code taken from
- PHP 3.0, which may include several patches and enhancements that weren't
- made by us (Andi&Zeev). If you're the author of such a patch and you're
- not willing to give up ownership over your patch to us, please contact
- us as soon as possible, so we can remove it. We're doing this so that
- we'd be eligible to sell the Zend engine for uses other than PHP, most
- notably - as an embedded part of possible commercial products that we'd
- have.
-
-* Patches submitted to the Zend CVS automatically fall under this license,
- and by submitting them you're implicitly giving up your ownership over
- this patch to us.
-
-* Until further notice, Zend is in a status of a closed beta test. That means
- that only people that were explicitly given the right to access the Zend
- CVS repository are allowed to use it. If you're reading this file and you
- weren't explicitly given the right to access the Zend CVS repository from
- either Andi Gutmans or Zeev Suraski - you're not supposed to have it - please
- erase the Zend files from your system. When the closed beta period finishes,
- the Zend CVS tree will be open for the public (in read-only mode, of course).
-
-
-Any questions regarding Zend or this license should be addressed via Email to
-zend@zend.com.
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
deleted file mode 100644
index c321447901..0000000000
--- a/Zend/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-AUTOMAKE_OPTIONS=foreign
-noinst_LIBRARIES=libzend.a
-libzend_a_SOURCES=\
- zend-parser.y zend-scanner.l \
- 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-parser.c zend-scanner.c zend.c zend_API.c \
- zend_extensions.c zend_hash.c zend_list.c zend_indent.c
-
-# automake isn't too clever about "non-standard" use of lex and yacc
-
-zend-scanner.c: zend-scanner.l
- $(LEX) -Pzend -ozend-scanner.c -i zend-scanner.l
-
-zend-parser.h: zend-parser.c
-zend-parser.c: zend-parser.y
- $(YACC) -p zend -v -d zend-parser.y -o zend-parser.c
-
-clean:
- -rm -f zend-parser.c zend-parser.h zend-scanner.c zend-parser.output
-
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 bc420a02f1..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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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"\
- ".\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 6008a973e2..0000000000
--- a/Zend/acconfig.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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
-
-/* 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 */
-#define HAVE_DIRENT_H 0
-
-/* Define if you have struct flock */
-#define HAVE_STRUCT_FLOCK 0
-
-/* Define if you have the resolv library (-lresolv). */
-#define HAVE_LIBRESOLV 0
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* (this disables "<?expression?>" by default) */
-#define DEFAULT_SHORT_OPEN_TAG 1
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 0
-#define HSREGEX 0
-
-/* Define if you have libdl (used for dynamic linking) */
-#define HAVE_LIBDL 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
diff --git a/Zend/acinclude.m4 b/Zend/acinclude.m4
deleted file mode 100644
index 9b1421eb6e..0000000000
--- a/Zend/acinclude.m4
+++ /dev/null
@@ -1,20 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-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)
- ])
-])
diff --git a/Zend/buildconf b/Zend/buildconf
deleted file mode 100755
index 22361b4a65..0000000000
--- a/Zend/buildconf
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-if test -f mkinstalldirs; then
- automake
-else
- automake --add-missing
-fi
-
-autoheader
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo keeping aclocal.m4
- mv aclocal.m4.old aclocal.m4
-else
- echo created or modified aclocal.m4
-fi
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo keeping configure
- mv configure.old configure
-else
- echo created or modified configure
-fi
-
diff --git a/Zend/config.unix.h b/Zend/config.unix.h
deleted file mode 100644
index ecbfd70b3d..0000000000
--- a/Zend/config.unix.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _CONFIG_UNIX_H
-#define _CONFIG_UNIX_H
-
-#define ZEND_API
-
-#include <stdlib.h>
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-#if HAVE_LIBDL
-# include <dlfcn.h>
-# 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 ZEND_EXTENSIONS_SUPPORT 0
-#endif
-
-#if BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...);
-#else
-# define zend_sprintf sprintf
-#endif
-
-#if ZEND_DEBUG
-# define inline
-#endif
-
-#endif /* _CONFIG_UNIX_H */
diff --git a/Zend/config.w32.h b/Zend/config.w32.h
deleted file mode 100644
index dac03e3b46..0000000000
--- a/Zend/config.w32.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _ZEND_CONFIG_W32_H
-#define _ZEND_CONFIG_W32_H
-
-
-#include <string.h>
-#include <windows.h>
-
-typedef unsigned long ulong;
-typedef unsigned int uint;
-
-#define HAVE_ALLOCA 1
-#include <malloc.h>
-
-#define HAVE_DIRENT_H 0
-
-#ifdef inline
-#undef inline
-#endif
-
-#define ZEND_DEBUG 1
-
-#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 COMPILE_LIBZEND
-# define ZEND_API __declspec(dllexport)
-#else
-# define ZEND_API __declspec(dllimport)
-#endif
-
-
-#endif /* _ZEND_CONFIG_W32_H */ \ No newline at end of file
diff --git a/Zend/configure.in b/Zend/configure.in
deleted file mode 100644
index f839ef079a..0000000000
--- a/Zend/configure.in
+++ /dev/null
@@ -1,134 +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
-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
-AC_PROG_RANLIB
-AC_PROG_CC_C_O
-AM_PROG_LEX
-
-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 The sin may be in a library which need not be specifed
-dnl as well as res_search resides in libsocket
-AC_CHECK_LIB(c, sin, [:], [
- AC_CHECK_LIB(m, sin) ])
-
-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
-dnl QNX requires unix.h to allow functions in libunix to work properly
-AC_CHECK_HEADERS(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/resource.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h sys/statvfs.h sys/statfs.h unix.h db.h ndbm.h)
-
-dnl Checks for types
-AC_TYPE_SIZE_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(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt setitimer rint unsetenv strftime setsockopt tzset statvfs statfs inet_aton)
-AC_FUNC_UTIME_NULL
-AC_FUNC_ALLOCA
-AC_BROKEN_SPRINTF
-AC_REPLACE_FUNCS(getopt)
-
-AC_MSG_CHECKING(whether to include debugging symbols)
-AC_ARG_ENABLE(debug,
-[ --enable-debug Compile with 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(no)
- AC_DEFINE(ZEND_DEBUG,0)
- DEBUG_CFLAGS=""
-])
-AC_SUBST(DEBUG_CFLAGS)
-
-
-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)
-])
-
-
-AC_SUBST(CFLAGS_SHLIB)
-AC_SUBST(LDFLAGS_SHLIB)
-AC_SUBST(LDFLAGS_SHLIB_EXPORT)
-
-AC_OUTPUT(Makefile, [], [])
-
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/Zend/libzend.dsp b/Zend/libzend.dsp
deleted file mode 100644
index dca4dcd67c..0000000000
--- a/Zend/libzend.dsp
+++ /dev/null
@@ -1,355 +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 Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILE_LIBZEND" /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 Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "COMPILE_LIBZEND" /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_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=.\config.w32.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_compile.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= \
- 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= \
- 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"
-
-!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/zend-parser.y b/Zend/zend-parser.y
deleted file mode 100644
index 520e222778..0000000000
--- a/Zend/zend-parser.y
+++ /dev/null
@@ -1,634 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/*
- * 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
-
-%}
-
-%pure_parser
-%expect 4
-
-%left INCLUDE EVAL
-%left ','
-%left LOGICAL_OR
-%left LOGICAL_XOR
-%left LOGICAL_AND
-%right ZEND_PRINT
-%left '=' PLUS_EQUAL MINUS_EQUAL MUL_EQUAL DIV_EQUAL CONCAT_EQUAL MOD_EQUAL AND_EQUAL OR_EQUAL XOR_EQUAL SHIFT_LEFT_EQUAL SHIFT_RIGHT_EQUAL
-%left '?' ':'
-%left BOOLEAN_OR
-%left BOOLEAN_AND
-%left '|'
-%left '^'
-%left '&'
-%nonassoc IS_EQUAL IS_NOT_EQUAL
-%nonassoc '<' IS_SMALLER_OR_EQUAL '>' IS_GREATER_OR_EQUAL
-%left SHIFT_LEFT SHIFT_RIGHT
-%left '+' '-' '.'
-%left '*' '/' '%'
-%right '!' '~' INCREMENT DECREMENT INT_CAST DOUBLE_CAST STRING_CAST ARRAY_CAST OBJECT_CAST '@'
-%right '['
-%nonassoc NEW
-%token T_EXIT
-%token IF
-%left ELSEIF
-%left ELSE
-%left ENDIF
-%token LNUMBER
-%token DNUMBER
-%token STRING
-%token VARIABLE
-%token NUM_STRING
-%token INLINE_HTML
-%token CHARACTER
-%token BAD_CHARACTER
-%token ENCAPSED_AND_WHITESPACE
-%token CONSTANT_ENCAPSED_STRING
-%token ZEND_ECHO
-%token DO
-%token WHILE
-%token ENDWHILE
-%token FOR
-%token ENDFOR
-%token ZEND_FOREACH
-%token T_ENDFOREACH
-%token ZEND_AS
-%token SWITCH
-%token ENDSWITCH
-%token CASE
-%token DEFAULT
-%token BREAK
-%token CONTINUE
-%token CONTINUED_WHILE
-%token CONTINUED_DOWHILE
-%token CONTINUED_FOR
-%token OLD_FUNCTION
-%token FUNCTION
-%token ZEND_CONST
-%token RETURN
-%token REQUIRE
-%token ZEND_GLOBAL
-%token ZEND_STATIC
-%token ZEND_UNSET
-%token T_ISSET
-%token T_EMPTY
-%token CLASS
-%token EXTENDS
-%token ZEND_OBJECT_OPERATOR
-%token ZEND_DOUBLE_ARROW
-%token ZEND_LIST
-%token ZEND_ARRAY
-%token VAR
-%token ZEND_LINE
-%token ZEND_FILE
-%token ZEND_COMMENT
-%token ZEND_ML_COMMENT
-%token PHP_OPEN_TAG
-%token PHP_OPEN_TAG_WITH_ECHO
-%token PHP_CLOSE_TAG
-%token T_WHITESPACE
-%token ZEND_HEREDOC
-%token DOLLAR_OPEN_CURLY_BRACES
-%token T_CURLY_OPEN
-%token T_PAAMAYIM_NEKUDOTAYIM
-%token T_PHP_TRACK_VARS
-
-%% /* Rules */
-
-statement_list:
- statement_list { do_extended_info(CLS_C); } statement { HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-statement:
- '{' statement_list '}'
- | 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); }
- | IF '(' expr ')' ':' { do_if_cond(&$3, &$4 CLS_CC); } statement_list { do_if_after_statement(&$4, 1 CLS_CC); } new_elseif_list new_else_single ENDIF ';' { do_if_end(CLS_C); }
- | 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); }
- | DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); do_do_while_begin(CLS_C); } statement WHILE '(' expr ')' ';' { do_do_while_end(&$1, &$6 CLS_CC); }
- | 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); }
- | SWITCH '(' expr ')' { do_switch_cond(&$3 CLS_CC); } switch_case_list { do_switch_end(&$6 CLS_CC); }
- | BREAK ';' { do_brk_cont(ZEND_BRK, NULL CLS_CC); }
- | BREAK expr ';' { do_brk_cont(ZEND_BRK, &$2 CLS_CC); }
- | CONTINUE ';' { do_brk_cont(ZEND_CONT, NULL CLS_CC); }
- | CONTINUE expr ';' { do_brk_cont(ZEND_CONT, &$2 CLS_CC); }
- | FUNCTION { $1.u.opline_num = CG(zend_lineno); } STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
- '(' parameter_list ')' '{' statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
- | OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
- parameter_list '(' statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
- | RETURN ';' { do_return(NULL CLS_CC); }
- | RETURN expr ';' { do_return(&$2 CLS_CC); }
- | ZEND_GLOBAL global_var_list
- | ZEND_STATIC static_var_list
- | CLASS STRING { do_begin_class_declaration(&$2, NULL CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
- | CLASS STRING EXTENDS STRING { do_begin_class_declaration(&$2, &$4 CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
- | ZEND_ECHO echo_expr_list ';'
- | INLINE_HTML { do_echo(&$1 CLS_CC); }
- | expr ';' { do_free(&$1 CLS_CC); }
- | REQUIRE CONSTANT_ENCAPSED_STRING ';' { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); }
- | REQUIRE '(' CONSTANT_ENCAPSED_STRING ')' ';' { require_filename($3.u.constant.value.str.val CLS_CC); zval_dtor(&$3.u.constant); }
- | ZEND_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); }
- | ZEND_FOREACH '(' expr ZEND_AS { do_foreach_begin(&$1, &$3, &$2, &$4); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); }
- | ';' /* empty statement */
-;
-
-
-foreach_optional_arg:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | ZEND_DOUBLE_ARROW w_cvar { $$ = $2; }
-;
-
-
-for_statement:
- statement
- | ':' statement_list ENDFOR ';'
-;
-
-
-foreach_statement:
- statement
- | ':' statement_list T_ENDFOREACH ';'
-;
-
-
-switch_case_list:
- '{' case_list '}' { $$ = $2; }
- | '{' ';' case_list '}' { $$ = $3; }
- | ':' case_list ENDSWITCH ';' { $$ = $2; }
- | ':' ';' case_list ENDSWITCH ';' { $$ = $3; }
-;
-
-
-case_list:
- /* empty */ { $$.u.opline_num = -1; }
- | case_list CASE expr case_separator { do_case_before_statement(&$1, &$2, &$3 CLS_CC); } statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
- | case_list DEFAULT case_separator { do_default_before_statement(&$1, &$2 CLS_CC); } statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
-;
-
-
-case_separator:
- ':'
- | ';'
-;
-
-
-while_statement:
- statement
- | ':' statement_list ENDWHILE ';'
-;
-
-
-
-elseif_list:
- /* empty */
- | elseif_list 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 ELSEIF '(' expr ')' ':' { do_if_cond(&$4, &$5 CLS_CC); } statement_list { do_if_after_statement(&$5, 0 CLS_CC); }
-;
-
-
-else_single:
- /* empty */
- | ELSE statement
-;
-
-
-new_else_single:
- /* empty */
- | ELSE ':' statement_list
-;
-
-
-
-
-parameter_list:
- non_empty_parameter_list
- | /* empty */
-;
-
-
-non_empty_parameter_list:
- 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; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | '&' 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; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
- | ZEND_CONST 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; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | 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; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE CLS_CC); }
- | VARIABLE '=' ZEND_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; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | non_empty_parameter_list ',' 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 ',' '&' 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 ',' ZEND_CONST 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 ',' 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 ',' VARIABLE '=' ZEND_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:
- VARIABLE { $$ = $1; }
- | '$' r_cvar { $$ = $2; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-static_var_list:
- static_var_list ',' VARIABLE { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC CLS_CC); }
- | static_var_list ',' VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC CLS_CC); }
- | VARIABLE { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC CLS_CC); }
- | 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:
- VAR class_variable_decleration ';'
- | FUNCTION { $1.u.opline_num = CG(zend_lineno); } STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); } '('
- parameter_list ')' '{' statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
- | OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); }
- parameter_list '(' statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
-
-;
-
-
-class_variable_decleration:
- class_variable_decleration ',' VARIABLE { do_declare_property(&$3, NULL CLS_CC); }
- | class_variable_decleration ',' VARIABLE '=' static_scalar { do_declare_property(&$3, &$5 CLS_CC); }
- | VARIABLE { do_declare_property(&$1, NULL CLS_CC); }
- | VARIABLE '=' static_scalar { do_declare_property(&$1, &$3 CLS_CC); }
-;
-
-
-echo_expr_list:
- /* empty */
- | 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; }
- | for_expr ',' expr { $$ = $3; }
- | expr { $$ = $1; }
-;
-
-
-expr_without_variable:
- ZEND_LIST '(' { do_list_init(); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); }
- | w_cvar '=' expr { do_assign(&$$, &$1, &$3 CLS_CC); }
- | w_cvar '=' '&' w_cvar { do_assign_ref(&$$, &$1, &$4 CLS_CC); }
- | w_cvar '=' NEW class_name { do_extended_fcall_begin(CLS_C); do_begin_new_object(&$2, &$1, &$3, &$4 CLS_CC); } ctor_arguments { do_end_new_object(&$4, &$3, &$6 CLS_CC); do_extended_fcall_end(CLS_C); $$ = $2;}
- | rw_cvar PLUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar MINUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar MUL_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar DIV_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar CONCAT_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar MOD_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar AND_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar OR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar XOR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar SHIFT_LEFT_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar SHIFT_RIGHT_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar INCREMENT { do_post_incdec(&$$, &$1, ZEND_POST_INC CLS_CC); }
- | INCREMENT rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_INC CLS_CC); }
- | rw_cvar DECREMENT { do_post_incdec(&$$, &$1, ZEND_POST_DEC CLS_CC); }
- | DECREMENT rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_DEC CLS_CC); }
- | expr BOOLEAN_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr BOOLEAN_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr LOGICAL_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr LOGICAL_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr 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 SHIFT_LEFT expr { do_binary_op(ZEND_SL, &$$, &$1, &$3 CLS_CC); }
- | expr SHIFT_RIGHT 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; $1.u.constant.refcount=1; 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; $1.u.constant.refcount=1; 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 IS_EQUAL expr { do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 CLS_CC); }
- | expr 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 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 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); }
- | STRING '(' { do_extended_fcall_begin(CLS_C); do_begin_function_call(&$1 CLS_CC); }
- function_call_parameter_list
- ')' { do_end_function_call(&$1, &$$, &$4, 0 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 CLS_CC); do_extended_fcall_end(CLS_C);}
- | STRING T_PAAMAYIM_NEKUDOTAYIM 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 CLS_CC); do_extended_fcall_end(CLS_C);}
- | internal_functions_in_yacc { $$ = $1; }
- | INT_CAST expr { do_cast(&$$, &$2, IS_LONG CLS_CC); }
- | DOUBLE_CAST expr { do_cast(&$$, &$2, IS_DOUBLE CLS_CC); }
- | STRING_CAST expr { do_cast(&$$, &$2, IS_STRING CLS_CC); }
- | ARRAY_CAST expr { do_cast(&$$, &$2, IS_ARRAY CLS_CC); }
- | OBJECT_CAST expr { do_cast(&$$, &$2, IS_OBJECT 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; }
- | ZEND_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '`' encaps_list '`' { do_shell_exec(&$$, &$2 CLS_CC); }
- | ZEND_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:
- STRING { $$ = $1; }
- | r_cvar { $$ = $1; }
-;
-
-
-
-common_scalar:
- LNUMBER { $$=$1; }
- | DNUMBER { $$=$1; }
- | CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | ZEND_LINE { $$ = $1; }
- | ZEND_FILE { $$ = $1; }
-;
-
-
-static_scalar: /* compile-time evaluated scalars */
- common_scalar { $$ = $1; }
- | 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; }
- | ZEND_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
-;
-
-
-scalar:
- STRING { do_fetch_constant(&$$, &$1, ZEND_RT CLS_CC); }
- | common_scalar { $$ = $1; }
- | '"' encaps_list '"' { $$ = $2; }
- | '\'' encaps_list '\'' { $$ = $2; }
- | ZEND_HEREDOC encaps_list ZEND_HEREDOC { $$ = $2; do_end_heredoc(CLS_C); }
-;
-
-
-static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; 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 ZEND_DOUBLE_ARROW static_scalar { do_add_static_array_element(&$$, &$3, &$5); }
- | non_empty_static_array_pair_list ',' static_scalar { do_add_static_array_element(&$$, &$3, NULL); }
- | static_scalar ZEND_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; array_init(&$$.u.constant); do_add_static_array_element(&$$, &$1, &$3); }
- | static_scalar { $$.op_type = IS_CONST; $$.u.constant.refcount=1; $$.u.constant.is_ref=0; array_init(&$$.u.constant); do_add_static_array_element(&$$, &$1, NULL); }
-;
-
-expr:
- r_cvar { $$ = $1; }
- | expr_without_variable { $$ = $1; }
-;
-
-
-
-r_cvar:
- cvar { do_end_variable_parse(BP_VAR_R CLS_CC); $$ = $1; }
-;
-
-
-w_cvar:
- cvar { do_end_variable_parse(BP_VAR_W CLS_CC); $$ = $1; }
-;
-
-
-rw_cvar:
- cvar { do_end_variable_parse(BP_VAR_RW CLS_CC); $$ = $1; }
-;
-
-
-cvar:
- cvar_without_objects { $$ = $1; }
- | cvar_without_objects ZEND_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); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
-;
-
-
-compound_variable:
- VARIABLE { $$ = $1; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-dim_list:
- dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
- | compound_variable { do_fetch_globals(&$1); 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 ZEND_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:
- STRING { $$ = $1; }
- | '{' expr '}' { $$ = $2; }
- | cvar_without_objects { do_end_variable_parse(BP_VAR_R CLS_CC); $$ = $1; }
-;
-
-
-object_dim_list:
- object_dim_list ']' '[' expr { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
- | STRING { znode tmp_znode, res; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&res, &tmp_znode, &$1 CLS_CC); $1 = res; } '[' expr { 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); }
- | ZEND_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 CLS_CC); }
- | non_empty_array_pair_list { $$ = $1; }
-;
-
-non_empty_array_pair_list:
- non_empty_array_pair_list ',' expr ZEND_DOUBLE_ARROW expr { do_add_array_element(&$$, &$5, &$3 CLS_CC); }
- | non_empty_array_pair_list ',' expr { do_add_array_element(&$$, &$3, NULL CLS_CC); }
- | expr ZEND_DOUBLE_ARROW expr { do_init_array(&$$, &$3, &$1 CLS_CC); }
- | expr { do_init_array(&$$, &$1, NULL CLS_CC); }
-;
-
-
-encaps_list:
- encaps_list encaps_var { do_end_variable_parse(BP_VAR_R CLS_CC); do_add_variable(&$$, &$1, &$2 CLS_CC); }
- | encaps_list STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list NUM_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list ENCAPSED_AND_WHITESPACE { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list CHARACTER { do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list BAD_CHARACTER { 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 '}' { $2.u.constant.value.chval = '}'; do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list ZEND_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(&$$); }
-
-;
-
-
-
-encaps_var:
- VARIABLE { do_fetch_globals(&$1); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
- | VARIABLE '[' { do_begin_variable_parse(CLS_C); } encaps_var_offset ']' { do_fetch_globals(&$1); fetch_array_begin(&$$, &$1, &$4 CLS_CC); }
- | VARIABLE ZEND_OBJECT_OPERATOR STRING { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$2, &$1, 1 CLS_CC); do_fetch_property(&$$, &$2, &$3 CLS_CC); }
- | DOLLAR_OPEN_CURLY_BRACES expr '}' { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$2, 1 CLS_CC); }
- | DOLLAR_OPEN_CURLY_BRACES STRING '[' expr ']' '}' { do_begin_variable_parse(CLS_C); fetch_array_begin(&$$, &$2, &$4 CLS_CC); }
- | T_CURLY_OPEN cvar '}' { $$ = $2; }
-;
-
-
-encaps_var_offset:
- STRING { $$ = $1; }
- | NUM_STRING { $$ = $1; }
- | 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); }
- | INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); }
- | EVAL '(' expr ')' { do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); }
-;
-
-
-%%
-
diff --git a/Zend/zend-scanner.h b/Zend/zend-scanner.h
deleted file mode 100644
index e28cf599bf..0000000000
--- a/Zend/zend-scanner.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _LANGUAGE_SCANNER_H
-#define _LANGUAGE_SCANNER_H
-
-typedef struct {
- YY_BUFFER_STATE buffer_state;
- int state;
- uint return_offset;
- uint lineno;
- FILE *in;
- char *filename;
-} zend_lex_state;
-
-#endif
diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l
deleted file mode 100644
index 279c94da42..0000000000
--- a/Zend/zend-scanner.l
+++ /dev/null
@@ -1,1221 +0,0 @@
-%{
-
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-%}
-
-%x IN_SCRIPTING
-%x DOUBLE_QUOTES
-%x SINGLE_QUOTE
-%x BACKQUOTE
-%x HEREDOC
-%x LOOKING_FOR_PROPERTY
-%option stack
-
-%{
-
-#if WIN32|WINNT
-#include <winsock.h>
-#endif
-
-#include <errno.h>
-
-#include "zend.h"
-#include "zend_alloc.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"
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#define YY_DECL int lex_scan(zval *zendlval CLS_DC)
-#define ECHO { ZEND_WRITE( yytext, yyleng ); }
-
-#ifdef __cplusplus
-# define MY_INPUT yyinput
-#else
-# define MY_INPUT input
-#endif
-
-
-#ifndef YY_TLS_VARS
-/* NOTE, YY_TLS_VARS CANNOT have a semicolon after in
- in the code or it will break compilation in msvc5 */
-#define YY_TLS_VARS
-#endif
-
-#ifndef TLS_VARS /* just to make sure ;) */
-#define TLS_VARS
-#endif
-
-#define HANDLE_NEWLINES(s,l) \
-do { \
- char *p = (s),*boundary = p+(l); \
-\
- while(p<boundary) { \
- if (*p++=='\n') { \
- CG(zend_lineno)++; \
- } \
- } \
-} while(0)
-
-#define HANDLE_NEWLINE(c) \
-{ \
- if (c=='\n') { \
- CG(zend_lineno)++; \
- } \
-}
-
-
-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;
- }
-}
-
-
-void reset_scanner(CLS_D)
-{
- YY_TLS_VARS
-
- BEGIN(INITIAL);
- CG(zend_lineno)=1;
-}
-
-
-static inline void save_lexical_state(zend_lex_state *lex_state CLS_DC)
-{
- 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();
-}
-
-
-static inline void restore_lexical_state(zend_lex_state *lex_state CLS_DC)
-{
- 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);
-}
-
-
-inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC)
-{
- FILE *tmp;
- YY_BUFFER_STATE buffer_state = YY_CURRENT_BUFFER;
-
- switch (file_handle->type) {
- case ZEND_HANDLE_FILENAME:
- tmp = zend_fopen(file_handle->filename);
- break;
- case ZEND_HANDLE_FD:
- tmp = fdopen(file_handle->handle.fd, "r");
- break;
- case ZEND_HANDLE_FP:
- tmp = file_handle->handle.fp;
- break;
- }
- if (!tmp) {
- return FAILURE;
- }
-
- /* Reset the scanner for scanning the new file */
- yyin = tmp;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- CG(zend_lineno) = 1;
- BEGIN(INITIAL);
-
- zend_set_compiled_filename(file_handle->filename);
- return SUCCESS;
-}
-
-
-
-ZEND_API zend_op_array *compile_files(int mark_as_ref ELS_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 ELS_CC, file_count, files);
- va_end(files);
- return op_array;
-}
-
-
-ZEND_API zend_op_array *v_compile_files(int mark_as_ref ELS_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;
-
- init_op_array(op_array, INITIAL_OP_ARRAY_SIZE);
- save_lexical_state(&original_lex_state CLS_CC);
-
- for (i=0; i<file_count; i++) {
- file_handle = va_arg(files, zend_file_handle *);
- if (!file_handle) {
- continue;
- }
- if (open_file_for_scanning(file_handle CLS_CC)==FAILURE) {
- zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, file_handle->filename);
- destroy_op_array(op_array);
- efree(op_array);
- retval = NULL;
- break;
- } else {
- CG(active_op_array) = op_array;
- if (zendparse(CLS_C)==1) {
- retval = NULL;
- break;
- } else {
- fclose(yyin);
- restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
- retval = op_array;
- }
- }
- }
- if (retval) {
- pass_two(op_array);
- if (mark_as_ref) {
- pass_include_eval(op_array);
- }
- }
- return retval;
-}
-
-
-zend_op_array *compile_filename(zval *filename 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.type = ZEND_HANDLE_FILENAME;
- retval = zend_compile_files(0 CLS_CC, 1, &file_handle);
- if (filename==&tmp) {
- zval_dtor(&tmp);
- }
- return retval;
-}
-
-
-static inline int prepare_string_for_scanning(zval *str)
-{
- /* 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);
- 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;
-
- tmp = *source_string;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- source_string = &tmp;
-
- init_op_array(op_array, INITIAL_OP_ARRAY_SIZE);
- save_lexical_state(&original_lex_state CLS_CC);
- if (prepare_string_for_scanning(source_string)==FAILURE) {
- destroy_op_array(op_array);
- efree(op_array);
- retval = NULL;
- } else {
- CG(active_op_array) = op_array;
- BEGIN(IN_SCRIPTING);
- if (zendparse(CLS_C)==1) {
- retval = NULL;
- } else {
- pass_two(op_array);
- pass_include_eval(op_array);
- restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
- retval = op_array;
- }
- }
-
- zval_dtor(&tmp);
-
- return retval;
-}
-
-
-int require_filename(char *filename CLS_DC)
-{
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- return require_file(&file_handle CLS_CC);
-}
-
-
-int require_file(zend_file_handle *file_handle CLS_DC)
-{
- zend_lex_state original_lex_state;
-
- 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;
- }
- zendparse(CLS_C);
- fclose(yyin);
- restore_lexical_state(&original_lex_state CLS_CC);
- 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;
- 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);
- fclose(yyin);
- 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)==FAILURE) {
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini);
- restore_lexical_state(&original_lex_state CLS_CC);
- zval_dtor(str);
- return SUCCESS;
-}
-
-
-/* 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
-%%
-%{
-TLS_VARS;
-%}
-
-<IN_SCRIPTING>"exit" {
- return T_EXIT;
-}
-
-<IN_SCRIPTING>"die" {
- return T_EXIT;
-}
-
-<IN_SCRIPTING>"old_function" {
- return OLD_FUNCTION;
-}
-
-<IN_SCRIPTING>"function"|"cfunction" {
- return FUNCTION;
-}
-
-<IN_SCRIPTING>"const" {
- return ZEND_CONST;
-}
-
-<IN_SCRIPTING>"return" {
- return RETURN;
-}
-
-<IN_SCRIPTING>"if" {
- return IF;
-}
-
-<IN_SCRIPTING>"elseif" {
- return ELSEIF;
-}
-
-<IN_SCRIPTING>"endif" {
- return ENDIF;
-}
-
-<IN_SCRIPTING>"else" {
- return ELSE;
-}
-
-<IN_SCRIPTING>"while" {
- return WHILE;
-}
-
-<IN_SCRIPTING>"endwhile" {
- return ENDWHILE;
-}
-
-<IN_SCRIPTING>"do" {
- return DO;
-}
-
-<IN_SCRIPTING>"for" {
- return FOR;
-}
-
-<IN_SCRIPTING>"endfor" {
- return ENDFOR;
-}
-
-<IN_SCRIPTING>"foreach" {
- return ZEND_FOREACH;
-}
-
-<IN_SCRIPTING>"endforeach" {
- return T_ENDFOREACH;
-}
-
-<IN_SCRIPTING>"as" {
- return ZEND_AS;
-}
-
-<IN_SCRIPTING>"switch" {
- return SWITCH;
-}
-
-<IN_SCRIPTING>"endswitch" {
- return ENDSWITCH;
-}
-
-<IN_SCRIPTING>"case" {
- return CASE;
-}
-
-<IN_SCRIPTING>"default" {
- return DEFAULT;
-}
-
-<IN_SCRIPTING>"break" {
- return BREAK;
-}
-
-<IN_SCRIPTING>"continue" {
- return CONTINUE;
-}
-
-<IN_SCRIPTING>"echo" {
- return ZEND_ECHO;
-}
-
-<IN_SCRIPTING>"print" {
- return ZEND_PRINT;
-}
-
-<IN_SCRIPTING>"class" {
- return CLASS;
-}
-
-<IN_SCRIPTING>"extends" {
- return EXTENDS;
-}
-
-<IN_SCRIPTING,DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"->" {
- yy_push_state(LOOKING_FOR_PROPERTY);
- return ZEND_OBJECT_OPERATOR;
-}
-
-<LOOKING_FOR_PROPERTY>{LABEL} {
- yy_pop_state();
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return STRING;
-}
-
-<LOOKING_FOR_PROPERTY>. {
- unput(yytext[0]);
- yy_pop_state();
-}
-
-<IN_SCRIPTING>"::" {
- return T_PAAMAYIM_NEKUDOTAYIM;
-}
-
-<IN_SCRIPTING>"new" {
- return NEW;
-}
-
-<IN_SCRIPTING>"var" {
- return VAR;
-}
-
-<IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" {
- return INT_CAST;
-}
-
-<IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
- return DOUBLE_CAST;
-}
-
-<IN_SCRIPTING>"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" {
- return STRING_CAST;
-}
-
-<IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
- return ARRAY_CAST;
-}
-
-<IN_SCRIPTING>"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" {
- return OBJECT_CAST;
-}
-
-<IN_SCRIPTING>"eval" {
- return EVAL;
-}
-
-<IN_SCRIPTING>"include" {
- return INCLUDE;
-}
-
-<IN_SCRIPTING>"require" {
- return REQUIRE;
-}
-
-<IN_SCRIPTING>"global" {
- return ZEND_GLOBAL;
-}
-
-<IN_SCRIPTING>"isset" {
- return T_ISSET;
-}
-
-<IN_SCRIPTING>"empty" {
- return T_EMPTY;
-}
-
-<IN_SCRIPTING>"static" {
- return ZEND_STATIC;
-}
-
-<IN_SCRIPTING>"unset" {
- return ZEND_UNSET;
-}
-
-<IN_SCRIPTING>"=>" {
- return ZEND_DOUBLE_ARROW;
-}
-
-<IN_SCRIPTING>"list" {
- return ZEND_LIST;
-}
-
-<IN_SCRIPTING>"array" {
- return ZEND_ARRAY;
-}
-
-<IN_SCRIPTING>"++" {
- return INCREMENT;
-}
-
-<IN_SCRIPTING>"--" {
- return DECREMENT;
-}
-
-<IN_SCRIPTING>"==" {
- return IS_EQUAL;
-}
-
-<IN_SCRIPTING>"!="|"<>" {
- return IS_NOT_EQUAL;
-}
-
-<IN_SCRIPTING>"<=" {
- return IS_SMALLER_OR_EQUAL;
-}
-
-<IN_SCRIPTING>">=" {
- return IS_GREATER_OR_EQUAL;
-}
-
-<IN_SCRIPTING>"+=" {
- return PLUS_EQUAL;
-}
-
-<IN_SCRIPTING>"-=" {
- return MINUS_EQUAL;
-}
-
-<IN_SCRIPTING>"*=" {
- return MUL_EQUAL;
-}
-
-<IN_SCRIPTING>"/=" {
- return DIV_EQUAL;
-}
-
-<IN_SCRIPTING>".=" {
- return CONCAT_EQUAL;
-}
-
-
-<IN_SCRIPTING>"%=" {
- return MOD_EQUAL;
-}
-
-<IN_SCRIPTING>"<<=" {
- return SHIFT_LEFT_EQUAL;
-}
-
-<IN_SCRIPTING>">>=" {
- return SHIFT_RIGHT_EQUAL;
-}
-
-<IN_SCRIPTING>"&=" {
- return AND_EQUAL;
-}
-
-<IN_SCRIPTING>"|=" {
- return OR_EQUAL;
-}
-
-<IN_SCRIPTING>"^=" {
- return XOR_EQUAL;
-}
-
-<IN_SCRIPTING>"||" {
- return BOOLEAN_OR;
-}
-
-<IN_SCRIPTING>"&&" {
- return BOOLEAN_AND;
-}
-
-<IN_SCRIPTING>"OR" {
- return LOGICAL_OR;
-}
-
-<IN_SCRIPTING>"AND" {
- return LOGICAL_AND;
-}
-
-<IN_SCRIPTING>"XOR" {
- return LOGICAL_XOR;
-}
-
-<IN_SCRIPTING>"<<" {
- return SHIFT_LEFT;
-}
-
-<IN_SCRIPTING>">>" {
- return SHIFT_RIGHT;
-}
-
-<IN_SCRIPTING>{TOKENS} {
- return yytext[0];
-}
-
-
-<IN_SCRIPTING>"{" {
- yy_push_state(IN_SCRIPTING);
- return '{';
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"${" {
- yy_push_state(IN_SCRIPTING);
- return DOLLAR_OPEN_CURLY_BRACES;
-}
-
-
-<IN_SCRIPTING>"}" {
- yy_pop_state();
- return '}';
-}
-
-
-
-<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 DNUMBER;
- } else {
- zendlval->type = IS_LONG;
- return LNUMBER;
- }
-}
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>{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 NUM_STRING;
-}
-
-<IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
- zendlval->value.dval = strtod(yytext,NULL);
- zendlval->type = IS_DOUBLE;
- return DNUMBER;
-}
-
-<IN_SCRIPTING>"__LINE__" {
- zendlval->value.lval = CG(zend_lineno);
- zendlval->type = IS_LONG;
- return ZEND_LINE;
-}
-
-<IN_SCRIPTING>"__FILE__" {
- char *filename = zend_get_compiled_filename();
-
- zendlval->value.str.len = strlen(filename);
- zendlval->value.str.val = estrndup(filename,zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return ZEND_FILE;
-}
-
-
-<INITIAL>(([^<]|"<"[^?%s<]){1,400})|"<s"|"<" {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINES(yytext,yyleng);
- return INLINE_HTML;
-}
-
-<INITIAL>"<?"|"<script"{WHITESPACE}+"language"{WHITESPACE}*"="{WHITESPACE}*("php"|"\"php\""|"\'php\'"){WHITESPACE}*">" {
- HANDLE_NEWLINES(yytext,yyleng);
- if (CG(short_tags) || yyleng>2) { /* yyleng>2 means it's not <? but <script> */
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(IN_SCRIPTING);
- return PHP_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%=" {
- HANDLE_NEWLINES(yytext,yyleng);
- if (CG(asp_tags)) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(IN_SCRIPTING);
- return PHP_OPEN_TAG_WITH_ECHO;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%" {
- HANDLE_NEWLINES(yytext,yyleng);
- if (CG(asp_tags)) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(IN_SCRIPTING);
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<?php"[ \n\r\t] {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- HANDLE_NEWLINE(yytext[yyleng-1]);
- BEGIN(IN_SCRIPTING);
- return PHP_OPEN_TAG;
-}
-
-
-<INITIAL>"<?php_track_vars?>"([\n]|"\r\n")? {
- zend_message_dispatcher(ZMSG_ENABLE_TRACK_VARS, NULL);
- HANDLE_NEWLINE(yytext[yyleng-1]);
- return T_PHP_TRACK_VARS;
-}
-
-<IN_SCRIPTING,DOUBLE_QUOTES,HEREDOC>"$"{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1);
- zendlval->value.str.len = yyleng-1;
- zendlval->type = IS_STRING;
- return VARIABLE;
-}
-
-
-<IN_SCRIPTING>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return STRING;
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return STRING;
-}
-
-
-<IN_SCRIPTING>{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;
-}
-
-
-<IN_SCRIPTING>([#]|"//")([^\n\r?]|"?"[^>\n\r])*("?\n"|"?\r\n")? { /* eat one line comments */
- HANDLE_NEWLINE(yytext[yyleng-1]);
- return ZEND_COMMENT;
-}
-
-<IN_SCRIPTING>"/*"([^*]|"*"[^/])*(("*/")?) {
- HANDLE_NEWLINES(yytext, yyleng);
- return ZEND_COMMENT;
-}
-
-
-<IN_SCRIPTING>("?>"|"</script"{WHITESPACE}*">")([\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 PHP_CLOSE_TAG; /* implicit ';' at php-end tag */
-}
-
-
-<IN_SCRIPTING>"%>"([\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 PHP_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- return INLINE_HTML;
- }
-}
-
-
-<IN_SCRIPTING>(["]([^"$\\]|([\\]+[^\\$]))*["])|([']([^'\\]|([\\]+['\\]))*[']) {
- 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) {
- if (*s=='\\') {
- s++;
- if (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 '\\':
- *t++ = '\\';
- zendlval->value.str.len--;
- break;
- case '$':
- case '"':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return CONSTANT_ENCAPSED_STRING;
-}
-
-
-<IN_SCRIPTING>["] {
- BEGIN(DOUBLE_QUOTES);
- return '\"';
-}
-
-
-<IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}("\r")?"\n" {
- char *s;
- 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(HEREDOC);
- return ZEND_HEREDOC;
-}
-
-
-<IN_SCRIPTING>[`] {
- BEGIN(BACKQUOTE);
- return '`';
-}
-
-
-<IN_SCRIPTING>['] {
- BEGIN(SINGLE_QUOTE);
- return '\'';
-}
-
-
-<HEREDOC>^{LABEL}(";")?("\r")?"\n" {
- int label_len;
- unsigned char unput_semicolon;
-
- 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(IN_SCRIPTING);
- return ZEND_HEREDOC;
- } else {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return STRING;
- }
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>{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 ENCAPSED_AND_WHITESPACE;
-}
-
-<SINGLE_QUOTE>([^'\\]|\\[^'\\])+ {
- HANDLE_NEWLINES(yytext,yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return ENCAPSED_AND_WHITESPACE;
-}
-
-
-<DOUBLE_QUOTES>[`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return ENCAPSED_AND_WHITESPACE;
-}
-
-
-<BACKQUOTE>["]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return ENCAPSED_AND_WHITESPACE;
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
- zendlval->value.chval = yytext[0];
- if (yyleng == 2) {
- unput(yytext[1]);
- yytext[1] = 0;
- yyleng--;
- }
- return CHARACTER;
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>{ENCAPSED_TOKENS} {
- zendlval->value.chval = yytext[0];
- return yytext[0];
-}
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"{$" {
- zendlval->value.chval = yytext[0];
- yy_push_state(IN_SCRIPTING);
- unput('$');
- return T_CURLY_OPEN;
-}
-
-<SINGLE_QUOTE>"\\'" {
- zendlval->value.chval='\'';
- return CHARACTER;
-}
-
-<SINGLE_QUOTE>"\\\\" {
- zendlval->value.chval='\\';
- return CHARACTER;
-}
-
-<DOUBLE_QUOTES>"\\\"" {
- zendlval->value.chval='"';
- return CHARACTER;
-}
-
-<BACKQUOTE>"\\`" {
- zendlval->value.chval='`';
- return CHARACTER;
-}
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.chval = (char) strtol (yytext+1, NULL, 8);
- return CHARACTER;
-}
-
-<DOUBLE_QUOTES,BACKQUOTE,HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
- zendlval->value.chval = (char) strtol (yytext+2, NULL, 16);
- return CHARACTER;
-}
-
-<DOUBLE_QUOTES,BACKQUOTE>"\\". {
- 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 BAD_CHARACTER;
- break;
- }
- return CHARACTER;
-}
-
-
-<HEREDOC>"\\$"|"\\{" {
- zendlval->value.chval = yytext[1];
- return CHARACTER;
-}
-
-
-<HEREDOC>["'`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return ENCAPSED_AND_WHITESPACE;
-}
-
-
-<DOUBLE_QUOTES>["] {
- BEGIN(IN_SCRIPTING);
- return '\"';
-}
-
-
-<BACKQUOTE>[`] {
- BEGIN(IN_SCRIPTING);
- return '`';
-}
-
-
-<SINGLE_QUOTE>['] {
- BEGIN(IN_SCRIPTING);
- return '\'';
-}
-
-
-<DOUBLE_QUOTES,BACKQUOTE,INITIAL,IN_SCRIPTING,LOOKING_FOR_PROPERTY><<EOF>> {
- return 0;
-}
-
-
-
-
-<IN_SCRIPTING,INITIAL,DOUBLE_QUOTES,BACKQUOTE,SINGLE_QUOTE>. {
- 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 df5f38ce2c..0000000000
--- a/Zend/zend.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#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"
-
-/* true multithread-shared globals */
-zend_class_entry standard_class;
-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, ...);
-void (*zend_message_dispatcher)(long message, void *data);
-FILE *(*zend_fopen)(const char *filename);
-void (*zend_block_interruptions)();
-void (*zend_unblock_interruptions)();
-
-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<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("(\n");
- indent += PRINT_PVAL_INDENT;
- zend_hash_internal_pointer_reset(ht);
- while (zend_hash_get_current_data(ht, (void **) &tmp) == SUCCESS) {
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS("[");
- switch (zend_hash_get_current_key(ht, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- ZEND_PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- zend_printf("%ld",num_key);
- break;
- }
- ZEND_PUTS("] => ");
- zend_print_zval_r(*tmp, indent+PRINT_PVAL_INDENT);
- ZEND_PUTS("\n");
- zend_hash_move_forward(ht);
- }
- indent -= PRINT_PVAL_INDENT;
- for (i=0; i<indent; i++) {
- ZEND_PUTS(" ");
- }
- ZEND_PUTS(")\n");
-}
-
-ZEND_API int zend_print_zval(zval *expr, int indent)
-{
- zval expr_copy;
- int destroy=0;
-
- if (expr->type != IS_STRING) {
- if (expr->type == IS_BOOL) {
- if (expr->value.lval) {
- expr_copy.value.str.val = estrndup("true",4);
- expr_copy.value.str.len = 4;
- } else {
- expr_copy.value.str.val = estrndup("false",5);
- expr_copy.value.str.len = 5;
- }
- expr_copy.type = IS_STRING;
- } else if (expr->type == 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);
- expr_copy.type = IS_STRING;
- } else {
- expr_copy = *expr;
- zval_copy_ctor(&expr_copy);
- convert_to_string(&expr_copy);
- }
- expr = &expr_copy;
- destroy=1;
- }
- if (expr->value.str.len==0) { /* optimize away empty strings */
- return 0;
- }
- ZEND_WRITE(expr->value.str.val,expr->value.str.len);
- if (destroy) {
- 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)
-{
- return fopen(filename, "r");
-}
-
-
-static void register_standard_class()
-{
- standard_class.type = ZEND_INTERNAL_CLASS;
- standard_class.name_length = sizeof("stdClass") - 1;
- standard_class.name = zend_strndup("stdClass", standard_class.name_length);
- standard_class.parent = NULL;
- zend_hash_init(&standard_class.default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
- zend_hash_init(&standard_class.function_table, 0, NULL, (void (*)(void *)) destroy_zend_function, 1);
- standard_class.handle_function_call = NULL;
- standard_class.handle_property_get = NULL;
- standard_class.handle_property_set = NULL;
- standard_class.refcount = (int *) malloc(sizeof(int));
- *standard_class.refcount = 1;
- zend_hash_add(CG(class_table), "stdClass", sizeof("stdClass"), &standard_class, sizeof(zend_class_entry), NULL);
-}
-
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions)
-{
- start_memory_manager();
-
- /* 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_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;
-
- /* Prepare data structures */
- zend_startup_constants();
- CG(function_table) = (HashTable *) malloc(sizeof(HashTable));
- CG(class_table) = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(CG(function_table), 100, NULL, (void (*)(void *)) destroy_zend_function, 1);
- zend_hash_init(CG(class_table), 10, NULL, (void (*)(void *)) destroy_zend_class, 1);
- register_standard_class();
- zend_hash_init(&module_registry, 50, NULL, (void (*)(void *)) module_destructor, 1);
- init_resource_plist();
- zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
-
- return SUCCESS;
-}
-
-
-void zend_shutdown()
-{
- destroy_resource_plist();
- zend_hash_destroy(&list_destructors);
- zend_hash_destroy(&module_registry);
- zend_hash_destroy(CG(function_table));
- free(CG(function_table));
- zend_hash_destroy(CG(class_table));
- free(CG(class_table));
- zend_shutdown_extensions();
- free(zend_version_info);
- zend_shutdown_constants();
-}
-
-
-void zend_set_utility_values(zend_utility_values *utility_values)
-{
- zend_uv = *utility_values;
-}
-
-
-/* this should be compatible with the standard zenderror */
-void zenderror(char *error)
-{
- zend_error(E_PARSE, error);
-}
-
-
-ZEND_API void zend_bailout()
-{
- ELS_FETCH();
-
- longjmp(EG(bailout), FAILURE);
-}
-
-
-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;
-}
diff --git a/Zend/zend.h b/Zend/zend.h
deleted file mode 100644
index 140dc65fed..0000000000
--- a/Zend/zend.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_H
-#define _ZEND_H
-
-#define ZEND_VERSION "0.80A"
-
-#include <stdio.h>
-
-/*
- * general definitions
- */
-
-#if WINNT||WIN32
-#include "config.w32.h"
-#else
-#include "zend_config.h"
-#include "config.unix.h"
-#endif
-
-#include "zend_errors.h"
-#include "zend_alloc.h"
-
-
-#undef SUCCESS
-#undef FAILURE
-#define SUCCESS 0
-#define FAILURE -1 /* this MUST stay a negative number, or it may effect functions! */
-
-
-#include "zend_hash.h"
-#include "zend_llist.h"
-
-
-#define INTERNAL_FUNCTION_PARAMETERS int ht, zval *return_value, HashTable *list, HashTable *plist
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist
-
-/*
- * zval
- */
-typedef struct _zval_struct zval;
-typedef struct _zend_class_entry zend_class_entry;
-
-typedef union {
- 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 {
- char *fname;
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- unsigned char *func_arg_types;
-} zend_function_entry;
-
-
-typedef struct {
- int type; /* read, write or r/w */
- zval **object;
- zend_llist elements_list;
-} zend_property_reference;
-
-
-
-typedef struct {
- int type; /* array offset or object proprety */
- zval element;
-} zend_overloaded_element;
-
-
-struct _zend_class_entry {
- char type;
- char *name;
- uint name_length;
- struct _zend_class_entry *parent;
- int *refcount;
-
- HashTable function_table;
- HashTable default_properties;
-
- /* 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 {
- 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);
- void (*message_handler)(long message, void *data);
- void (*block_interruptions)();
- void (*unblock_interruptions)();
-} zend_utility_functions;
-
-
-typedef struct {
- unsigned char short_tags;
- unsigned char asp_tags;
-} 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 zend_set_utility_values(zend_utility_values *utility_values);
-ZEND_API void zend_bailout();
-ZEND_API char *get_zend_version();
-
-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); }
-
-
-/* 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)
-
-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 FILE *(*zend_fopen)(const char *filename);
-extern void (*zend_message_dispatcher)(long message, void *data);
-extern void (*zend_block_interruptions)();
-extern void (*zend_unblock_interruptions)();
-
-
-void zenderror(char *error);
-
-extern zend_class_entry standard_class;
-extern zend_utility_values zend_uv;
-
-#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
-
-#endif /* _ZEND_H */
diff --git a/Zend/zend.ico b/Zend/zend.ico
deleted file mode 100644
index 80978a6c7e..0000000000
--- a/Zend/zend.ico
+++ /dev/null
Binary files differ
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
deleted file mode 100644
index f16fd71651..0000000000
--- a/Zend/zend_API.c
+++ /dev/null
@@ -1,765 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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"
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#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 = EG(argument_stack).top_element-1;
- int arg_count = (ulong) *p;
- va_list ptr;
- zval **param, *param_ptr;
- ELS_FETCH();
-
- 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 (!param_ptr->is_ref && param_ptr->refcount>1) {
- zval *new_tmp;
-
- new_tmp = (zval *) emalloc(sizeof(zval));
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- new_tmp->refcount = 1;
- new_tmp->is_ref = 0;
- 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 = EG(argument_stack).top_element-1;
- int arg_count = (ulong) *p;
- zval *param_ptr;
- ELS_FETCH();
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
-
- while (param_count>0) {
- param_ptr = *(p-param_count);
- if (!param_ptr->is_ref && param_ptr->refcount>1) {
- zval *new_tmp;
-
- new_tmp = (zval *) emalloc(sizeof(zval));
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- new_tmp->refcount = 1;
- new_tmp->is_ref = 0;
- 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 = EG(argument_stack).top_element-1;
- int arg_count = (ulong) *p;
- va_list ptr;
- zval ***param;
- ELS_FETCH();
-
- 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 = EG(argument_stack).top_element-1;
- int arg_count = (ulong) *p;
- ELS_FETCH();
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count>0) {
- *(argument_array++) = (zval **) p-(param_count--);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int getThis(zval **this)
-{
- /* NEEDS TO BE IMPLEMENTED FOR ZEND */
- /*
- zval *data;
-
- if (zend_hash_find(GLOBAL(function_state.calling_symbol_table), "this", sizeof("this"), (void **)&data) == FAILURE) {
- return FAILURE;
- }
-
- *this = data;
- */
- return SUCCESS;
-}
-
-
-ZEND_API int ParameterPassedByReference(int ht, uint n)
-{
- void **p = EG(argument_stack).elements+EG(argument_stack).top-1;
- ulong arg_count = (ulong) *p;
- zval *arg;
- ELS_FETCH();
-
- if (n>arg_count) {
- return FAILURE;
- }
- arg = (zval *) *(p-arg_count+n-1);
- return arg->is_ref;
-}
-
-
-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;
-}
-
-
-static void zval_update_const_and_ref(zval **p)
-{
- zval_update_constant(*p);
- zval_add_ref(p);
-}
-
-
-
-ZEND_API inline int object_init_ex(zval *arg, zend_class_entry *class_type)
-{
- zval *tmp;
-
- 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_update_const_and_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, &standard_class);
-}
-
-
-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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-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_index_long(zval *arg, uint index, long n)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_LONG;
- tmp->value.lval = n;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- 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;
- 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 register_functions(zend_function_entry *functions)
-{
- zend_function_entry *ptr = functions;
- zend_internal_function internal_function;
- int count=0,unload=0;
- CLS_FETCH();
-
- 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");
- unregister_functions(functions,count);
- return FAILURE;
- }
- if (zend_hash_add(CG(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(CG(function_table), ptr->fname, strlen(ptr->fname)+1)) {
- zend_error(E_CORE_WARNING,"Module load failed - duplicate function name - %s",ptr->fname);
- }
- ptr++;
- }
- unregister_functions(functions,count);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-/* count=-1 means erase all functions, otherwise,
- * erase the first count functions
- */
-void unregister_functions(zend_function_entry *functions,int count)
-{
- zend_function_entry *ptr = functions;
- int i=0;
- CLS_FETCH();
-
- while (ptr->fname) {
- if (count!=-1 && i>=count) {
- break;
- }
-#if 0
- zend_printf("Unregistering %s()\n",ptr->fname);
-#endif
- zend_hash_del(CG(function_table),ptr->fname,strlen(ptr->fname)+1);
- ptr++;
- i++;
- }
-}
-
-
-ZEND_API int register_module(zend_module_entry *module)
-{
-#if 0
- zend_printf("%s: Registering module %d\n",module->name, module->module_number);
-#endif
- if (register_functions(module->functions)==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->request_started && module->request_shutdown_func) {
-#if 0
- zend_printf("%s: Request shutdown\n",module->name);
-#endif
- module->request_shutdown_func(module->type, module->module_number);
- }
- module->request_started=0;
- 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;
- unregister_functions(module->functions,-1);
-
-#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_started && module->request_startup_func) {
-#if 0
- zend_printf("%s: Request startup\n",module->name);
-#endif
- module->request_startup_func(module->type, module->module_number);
- }
- module->request_started=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_started && module->request_shutdown_func) {
-#if 0
- zend_printf("%s: Request shutdown\n",module->name);
-#endif
- module->request_shutdown_func(module->type, module->module_number);
- }
- module->request_started=0;
- 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_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;
- zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->function_table, 0, NULL, (void (*)(void *)) destroy_zend_function, 1);
-
- zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, class_entry, sizeof(zend_class_entry), (void **) &register_class);
- free(lowercase_name);
- return register_class;
-}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
deleted file mode 100644
index ffed84be10..0000000000
--- a/Zend/zend_API.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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)
-
-
-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 getThis(zval **this);
-ZEND_API int ParameterPassedByReference(int ht, uint n);
-
-int register_functions(zend_function_entry *functions);
-void unregister_functions(zend_function_entry *functions, int count);
-ZEND_API int register_module(zend_module_entry *module_entry);
-zend_class_entry *register_internal_class(zend_class_entry *class_entry);
-
-ZEND_API void wrong_param_count(void);
-
-#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
-
-#if !MSVC5
-#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);
-ZEND_API int add_assoc_long(zval *arg, char *key, long n);
-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_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS));
-ZEND_API int add_index_long(zval *arg, uint idx, long n);
-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_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_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_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_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 add_property_long(zval *arg, char *key, long l);
-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);
-
-#define add_method(arg,key,method) add_assoc_function((arg),(key),(method))
-
-#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 92c939cd3f..0000000000
--- a/Zend/zend_alloc.c
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdlib.h>
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_globals.h"
-
-#ifndef ZTS
-static zend_alloc_globals alloc_globals;
-#endif
-
-
-#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,filename,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)<AG(allocated_memory)) {\
- if (!file) { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d bytes)", AG(memory_limit),s); \
- } else { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", AG(memory_limit), file, lineno, s); \
- } \
- } \
- }
-# endif
-
-#ifndef CHECK_MEMORY_LIMIT
-#define CHECK_MEMORY_LIMIT(s)
-#endif
-
-
-#define REMOVE_POINTER_FROM_LIST(p) \
- if (!p->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;
-
-
-/* used by ISAPI and NSAPI */
-
-#if ZEND_DEBUG
-ZEND_API void *_emalloc(size_t size, char *filename, uint lineno)
-#else
-ZEND_API void *_emalloc(size_t size)
-#endif
-{
- mem_header *p;
-
- HANDLE_BLOCK_INTERRUPTIONS();
-
- if ((size < MAX_CACHED_MEMORY) && (AG(cache_count)[size] > 0)) {
- p = AG(cache)[size][--AG(cache_count)[size]];
-#if ZEND_DEBUG
- p->filename = filename;
- p->lineno = lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
-#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 %d bytes\n", size);
- exit(1);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)p;
- }
- p->persistent = p->cached = 0;
- ADD_POINTER_TO_LIST(p);
- p->size = size;
-#if ZEND_DEBUG
- p->filename = filename;
- p->lineno = 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);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING);
-}
-
-
-#if ZEND_DEBUG
-ZEND_API void _efree(void *ptr, char *filename, uint lineno)
-#else
-ZEND_API void _efree(void *ptr)
-#endif
-{
- mem_header *p = (mem_header *) ((char *)ptr - sizeof(mem_header) - PLATFORM_PADDING);
-
-#if ZEND_DEBUG
- _mem_block_check(ptr, 1, filename, lineno);
- memset(ptr, 0x5a, p->size);
-#endif
-
- if (!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();
-}
-
-
-#if ZEND_DEBUG
-ZEND_API void *_ecalloc(size_t nmemb, size_t size, char *filename, uint lineno)
-#else
-ZEND_API void *_ecalloc(size_t nmemb, size_t size)
-#endif
-{
- void *p;
- int final_size=size*nmemb;
-
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- p = _emalloc(final_size,filename,lineno);
-#else
- p = emalloc(final_size);
-#endif
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *) p;
- }
- memset(p,(int)NULL,final_size);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return p;
-}
-
-
-#if ZEND_DEBUG
-ZEND_API void *_erealloc(void *ptr, size_t size, char *filename, uint lineno)
-#else
-ZEND_API void *_erealloc(void *ptr, size_t size)
-#endif
-{
- mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING);
- mem_header *orig = p;
-
- if (!ptr) {
-#if ZEND_DEBUG
- return _emalloc(size, filename, lineno);
-#else
- return emalloc(size);
-#endif
- }
- 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) {
- fprintf(stderr,"FATAL: erealloc(): Unable to allocate %d bytes\n", size);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- zend_bailout();
- ADD_POINTER_TO_LIST(orig);
- return (void *)NULL;
- }
- ADD_POINTER_TO_LIST(p);
-#if ZEND_DEBUG
- p->filename = filename;
- p->lineno = 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);
-}
-
-
-#if ZEND_DEBUG
-ZEND_API char *_estrdup(const char *s, char *filename, uint lineno)
-#else
-ZEND_API char *_estrdup(const char *s)
-#endif
-{
- int length;
- char *p;
-
- length = strlen(s)+1;
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- p = (char *) _emalloc(length,filename,lineno);
-#else
- p = (char *) emalloc(length);
-#endif
- if (!p) {
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (char *)NULL;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- memcpy(p,s,length);
- return p;
-}
-
-
-#if ZEND_DEBUG
-ZEND_API char *_estrndup(const char *s, uint length, char *filename, uint lineno)
-#else
-ZEND_API char *_estrndup(const char *s, uint length)
-#endif
-{
- char *p;
-
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- p = (char *) _emalloc(length+1,filename,lineno);
-#else
- p = (char *) emalloc(length+1);
-#endif
- 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(void)
-{
- 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;
-
- p=AG(head);
- t=AG(head);
- while (t) {
- if (!t->cached || clean_cache) {
-#if ZEND_DEBUG
- if (!t->cached) {
- /* does not use zend_error() *intentionally* */
- if (!silent) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
- }
- }
-#endif
- p = t->pNext;
- REMOVE_POINTER_FROM_LIST(t);
- free(t);
- t = p;
- } else {
- t = t->pNext;
- }
- }
-}
-
-
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent, char *filename, int lineno)
-{
- 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) {
- fprintf(stderr,"---------------------------------------\n");
- fprintf(stderr,"Block 0x%0.8lX status at %s:%d:\n", (long) p, filename, lineno);
- fprintf(stderr,"%10s\t","Beginning: ");
- }
-
- switch (p->magic) {
- case MEM_BLOCK_START_MAGIC:
- if (!silent) {
- fprintf(stderr, "OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- }
- break; /* ok */
- case MEM_BLOCK_FREED_MAGIC:
- if (!silent) {
- fprintf(stderr,"Freed\n");
- had_problems=1;
- } else {
- return _mem_block_check(ptr, 0, filename, lineno);
- }
- break;
- case MEM_BLOCK_CACHED_MAGIC:
- if (!silent) {
- if (!no_cache_notice) {
- fprintf(stderr,"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, filename, lineno);
- }
- }
- break;
- default:
- if (!silent) {
- fprintf(stderr,"Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
- } else {
- return _mem_block_check(ptr, 0, filename, lineno);
- }
- 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, filename, lineno);
- }
- had_problems=1;
- overflow_ptr = ((char *) p)+sizeof(mem_header)+p->size+PLATFORM_PADDING;
-
- for (i=0; i<sizeof(long); i++) {
- if (overflow_ptr[i]!=magic_ptr[i]) {
- overflows++;
- }
- }
-
- fprintf(stderr,"%10s\t", "End:");
- fprintf(stderr,"Overflown (magic=0x%0.8lX instead of 0x%0.8lX)\n",
- *((long *)(((char *) p) + sizeof(mem_header)+p->size+PLATFORM_PADDING+END_ALIGNMENT(p->size))), MEM_BLOCK_END_MAGIC);
- fprintf(stderr,"%10s\t","");
- if (overflows>=sizeof(long)) {
- fprintf(stderr, "At least %d bytes overflown\n", sizeof(long));
- } else {
- fprintf(stderr, "%d byte(s) overflown\n", overflows);
- }
- } else if (!silent) {
- fprintf(stderr,"%10s\t", "End:");
- if (valid_beginning) {
- fprintf(stderr,"OK\n");
- } else {
- fprintf(stderr,"Unknown\n");
- }
- }
-
- if (!silent) {
- fprintf(stderr,"---------------------------------------\n");
- }
- return ((!had_problems) ? 1 : 0);
-}
-
-
-ZEND_API void _full_mem_check(int silent, char *filename, uint lineno)
-{
- mem_header *p = AG(head);
- int errors=0;
-
- fprintf(stderr,"------------------------------------------------\n");
- fprintf(stderr,"Full Memory Check at %s:%d\n", filename, lineno);
-
- while (p) {
- if (!_mem_block_check((void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING), (silent?2:3), filename, lineno)) {
- errors++;
- }
- p = p->pNext;
- }
- fprintf(stderr,"End of full memory check %s:%d (%d errors)\n", filename, lineno, errors);
- fprintf(stderr,"------------------------------------------------\n");
-}
-#endif
-
-
-#if ZEND_DEBUG
-ZEND_API void _persist_alloc(void *ptr, char *filename, uint lineno)
-#else
-ZEND_API void _persist_alloc(void *ptr)
-#endif
-{
- mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING);
-
-#if ZEND_DEBUG
- _mem_block_check(ptr, 1, filename, lineno);
-#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 85492a2c43..0000000000
--- a/Zend/zend_alloc.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ALLOC_H
-#define _ALLOC_H
-
-#include <stdio.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;
-#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 {
- 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);
-
-#if ZEND_DEBUG
-ZEND_API void *_emalloc(size_t size,char *filename,uint lineno);
-ZEND_API void _efree(void *ptr,char *filename,uint lineno);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size,char *filename,uint lineno);
-ZEND_API void *_erealloc(void *ptr, size_t size,char *filename,uint lineno);
-ZEND_API char *_estrdup(const char *s,char *filename,uint lineno);
-ZEND_API char *_estrndup(const char *s, unsigned int length,char *filename,uint lineno);
-ZEND_API void _persist_alloc(void *ptr, char *filename, uint lineno);
-#define emalloc(size) _emalloc((size),__FILE__,__LINE__)
-#define efree(ptr) _efree((ptr),__FILE__,__LINE__)
-#define ecalloc(nmemb,size) _ecalloc((nmemb),(size),__FILE__,__LINE__)
-#define erealloc(ptr,size) _erealloc((ptr),(size),__FILE__,__LINE__)
-#define estrdup(s) _estrdup((s),__FILE__,__LINE__)
-#define estrndup(s,length) _estrndup((s),(length),__FILE__,__LINE__)
-#define persist_alloc(p) _persist_alloc((p),__FILE__,__LINE__)
-#else
-ZEND_API void *_emalloc(size_t size);
-ZEND_API void _efree(void *ptr);
-ZEND_API void *_ecalloc(size_t nmemb, size_t size);
-ZEND_API void *_erealloc(void *ptr, size_t size);
-ZEND_API char *_estrdup(const char *s);
-ZEND_API char *_estrndup(const char *s, unsigned int length);
-ZEND_API void _persist_alloc(void *ptr);
-#define emalloc(size) _emalloc((size))
-#define efree(ptr) _efree((ptr))
-#define ecalloc(nmemb,size) _ecalloc((nmemb),(size))
-#define erealloc(ptr,size) _erealloc((ptr),(size))
-#define estrdup(s) _estrdup((s))
-#define estrndup(s,length) _estrndup((s),(length))
-#define persist_alloc(p) _persist_alloc((p))
-#endif
-
-#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 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(void);
-ZEND_API void shutdown_memory_manager(int silent, int clean_cache);
-
-#if ZEND_DEBUG
-ZEND_API int _mem_block_check(void *ptr, int silent, char *filename, int lineno);
-ZEND_API void _full_mem_check(int silent, char *filename, uint lineno);
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent, __FILE__, __LINE__)
-#define mem_block_check(ptr, silent) _mem_block_check(ptr, silent, __FILE__, __LINE__)
-#define full_mem_check(silent) _full_mem_check(silent, __FILE__, __LINE__)
-#else
-#define mem_block_check(type, ptr, silent)
-#define full_mem_check(silent)
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
deleted file mode 100644
index 01c8ba41e0..0000000000
--- a/Zend/zend_compile.c
+++ /dev/null
@@ -1,1850 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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));
-}
-
-
-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(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();
-}
-
-
-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(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_hash_apply(&module_registry, (int (*)(void *)) module_registry_cleanup);
-}
-
-
-ZEND_API void 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;
-}
-
-
-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)
-{
- if (!CG(active_op_array)->initialized_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)) {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_INIT_GLOBALS;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- CG(active_op_array)->initialized_globals = 1;
- }
-}
-
-
-void fetch_simple_variable(znode *result, znode *varname, int bp 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_llist *fetch_list_ptr;
-
- 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;
- *result = opline->result;
- SET_UNUSED(opline->op2);
- opline->op2.u.constant.value.lval = ZEND_FETCH_LOCAL;
-
- if (bp) {
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &next_op_number);
- }
-}
-
-
-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)
-{
- 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_llist *fetch_list_ptr;
-
- 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;
- *result = opline->result;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &next_op_number);
-}
-
-
-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_OP;
- 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_OP;
- 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));
-}
-
-
-void do_end_variable_parse(int type CLS_DC)
-{
- zend_llist *fetch_list_ptr;
- zend_llist_element *le;
- zend_op *opline;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
-
- le = fetch_list_ptr->head;
-
- while (le) {
- opline = &CG(active_op_array)->opcodes[*((int *) le->data)];
- 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 */
- }
- le = le->next;
- }
- zend_llist_destroy(fetch_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
-}
-
-
-void do_init_string(znode *result)
-{
- 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 *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_hash_add(CG(function_table), name, name_len+1, &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));
-
- opline->opcode = ZEND_EXT_NOP;
- opline->lineno = function_begin_line;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
-}
-
-
-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;
-}
-
-
-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; i<offset->u.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]++;
- }
-}
-
-
-void do_begin_function_call(znode *function_name CLS_DC)
-{
- zend_op *opline ;
- 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;
- }
-
- opline = get_next_op(CG(active_op_array) CLS_CC);
-
- 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->arg_types, sizeof(unsigned char *));
- }
- break;
- case ZEND_INTERNAL_FUNCTION: {
- zend_internal_function *internal_function = (zend_internal_function *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &internal_function->arg_types, sizeof(unsigned char *));
- }
- break;
- }
- opline->opcode = ZEND_INIT_FCALL;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-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 (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;
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- opline->op2 = *function_name;
- SET_UNUSED(opline->op1);
- }
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-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;
- zval_copy_ctor(&opline->op2.u.constant);
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- ELS_FETCH();
-
- opline->opcode = ZEND_DO_FCALL;
- 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 = get_next_op(CG(active_op_array) CLS_CC);
- unsigned char **arg_types_ptr, *arg_types;
- int original_op=op;
-
- zend_stack_top(&CG(function_call_stack), (void **) &arg_types_ptr);
- arg_types = *arg_types_ptr;
-
- 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_types && offset<=arg_types[0]
- && arg_types[offset]==BYREF_FORCE) {
- /* 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:
- do_end_variable_parse(BP_VAR_R CLS_CC);
- break;
- case ZEND_SEND_REF:
- do_end_variable_parse(BP_VAR_W CLS_CC);
- break;
- }
- }
-
- opline->opcode = op;
- opline->op1 = *param;
- opline->op2.u.opline_num = offset;
- SET_UNUSED(opline->op2);
-}
-
-
-void do_return(znode *expr CLS_DC)
-{
- zend_op *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;
- opline->op1.u.constant.refcount=1;
- opline->op1.u.constant.is_ref=0;
- }
- 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;
-
- 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;
- opline->op2.u.constant.refcount=1;
- opline->op2.u.constant.is_ref=0;
- 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*/
- do_free(&switch_entry_ptr->cond CLS_CC);
- 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;
- opline->op1.u.constant.refcount=1;
- opline->op1.u.constant.is_ref=0;
- 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;
-}
-
-static void function_add_ref(zend_function *function)
-{
- if (function->type == ZEND_USER_FUNCTION) {
- (*((zend_op_array *) function)->refcount)++;
- }
-}
-
-
-void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC)
-{
- 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;
-
- zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
-
- zend_hash_init(&CG(class_entry).function_table, 10, NULL, (void (*)(void *)) destroy_zend_function, 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;
-
- 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)==FAILURE) {
- zend_error(E_ERROR, "Undefined parent class '%s'", parent_class_name->u.constant.value.str.val);
- return;
- }
- /* 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 *));
-
- zval_dtor(&parent_class_name->u.constant);
- } 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;
-
- if (zend_hash_add(CG(class_table), CG(class_entry).name, CG(class_entry).name_length+1, &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry))==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Class %s cannot be redeclared", CG(class_entry).name);
- }
-}
-
-
-void do_end_class_declaration(CLS_D)
-{
- 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)
-{
- 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_llist *fetch_list_ptr;
-
- 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, &next_op_number);
-}
-
-
-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 *result, znode *variable, 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);
-
- 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 = *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 = *result;
- opline->op2 = *class_name;
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-void do_end_new_object(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 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));
-}
-
-
-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;
- printf("Fetching compiletime constant: '%s'\n", result->u.constant.value.str.val);
- 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);
-
- opline->opcode = ZEND_INIT_FCALL;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- 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;
- 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;
- opline->op1.u.constant.refcount = 1;
- opline->op1.u.constant.is_ref = 0;
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.op_type = IS_CONST;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-
-void do_init_array(znode *result, znode *expr, znode *offset 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);
- }
-}
-
-
-void do_add_array_element(znode *result, znode *expr, znode *offset 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);
- }
-}
-
-
-
-void do_add_static_array_element(znode *result, znode *expr, znode *offset)
-{
- 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);
- 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), &current_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);
- opline->op2.u.constant.refcount = 1;
- opline->op2.u.constant.is_ref = 0;
- 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.constant.value.lval = 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;
-
- for (i=1; i<=num_references->u.constant.value.lval; i++) {
- fetch_simple_variable(result, variable, 1 CLS_CC);
- *variable = *result;
- }
-}
-
-
-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 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;
-
- /* 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;
- 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;
- 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->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);
-
- 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;
-
-#if 0
-#if (WIN32|WINNT)
- if (GLOBAL(wintimer) && !(++GLOBAL(wintimer_counter) & 0xff) && (GLOBAL(wintimer) < (unsigned int) clock())) {
- zend_error(E_WARNING, "PHP Timed out!<br>\n");
- }
-#endif
-#endif
-
- zendlval->u.constant.type = IS_LONG;
- retval = lex_scan(&zendlval->u.constant CLS_CC);
- switch(retval) {
- case ZEND_COMMENT:
- case PHP_OPEN_TAG:
- case T_WHITESPACE:
- retval = zendlex(zendlval CLS_CC);
- break;
- case PHP_CLOSE_TAG:
- retval = ';'; /* implicit ; */
- break;
- case PHP_OPEN_TAG_WITH_ECHO:
- retval = ZEND_ECHO;
- break;
- }
-
- zendlval->u.constant.refcount = 1;
- zendlval->u.constant.is_ref = 0;
- zendlval->op_type = IS_CONST;
- return retval;
-}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
deleted file mode 100644
index facde729de..0000000000
--- a/Zend/zend_compile.h
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _COMPILE_H
-#define _COMPILE_H
-
-#include "zend.h"
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#include "zend_llist.h"
-#define YYSTYPE znode
-#include "zend-parser.h"
-
-#define DEBUG_ZEND 0
-#define SUPPORT_INTERACTIVE 1
-
-#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 {
- int op_type;
- union {
- zval constant;
-
- int var;
- int opline_num;
- 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 {
- 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! */
-
- int *refcount;
-
- zend_op *opcodes;
- int last, size;
-
- int T;
-
- char *function_name;
-
- zend_brk_cont_element *brk_cont_array;
- int last_brk_cont;
- int current_brk_cont;
- unsigned char initialized_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[4];
-};
-
-
-typedef struct {
- int type; /* MUST be the first element of this struct! */
-
- unsigned char *arg_types; /* MUST be the second element of this struct */
-
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- char *function_name;
-} zend_internal_function;
-
-
-typedef union {
- int type; /* MUST be the first element of this struct! */
- struct {
- int type; /* never used */
- unsigned char *arg_types;
- } common;
-
- zend_op_array op_array;
- zend_internal_function internal_function;
-} zend_function;
-
-
-typedef struct {
- HashTable *function_symbol_table;
- zend_function *function;
- void *reserved[4];
-} zend_function_state;
-
-
-typedef struct {
- znode cond;
- int default_case;
- int control_var;
-} zend_switch_entry;
-
-
-typedef struct {
- znode var;
- zend_llist dimensions;
- znode value;
-} list_llist_element;
-
-
-typedef struct _zend_file_handle {
- int type;
- char *filename;
- union {
- int fd;
- FILE *fp;
-#ifdef __cplusplus
- istream *is;
-#endif
- } handle;
-} 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);
-
-extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...);
-
-int lex_scan(zval *zendlval CLS_DC);
-void reset_scanner(CLS_D);
-void startup_scanner(CLS_D);
-void shutdown_scanner(CLS_D);
-
-ZEND_API void 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();
-
-
-/* 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 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);
-
-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);
-ZEND_API void *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 CLS_DC);
-
-void do_free(znode *op1 CLS_DC);
-
-void do_init_string(znode *result);
-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);
-void 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 CLS_DC);
-void do_return(znode *expr CLS_DC);
-
-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 *result, znode *variable, znode *new_token, znode *class_name CLS_DC);
-void do_end_new_object(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 CLS_DC);
-void do_add_array_element(znode *result, znode *expr, znode *offset CLS_DC);
-void do_add_static_array_element(znode *result, znode *expr, znode *offset);
-void do_list_init();
-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);
-
-
-/* helper functions in zend-scanner.l */
-ZEND_API int require_file(zend_file_handle *file_handle CLS_DC);
-ZEND_API int require_filename(char *filename 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 ELS_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 CLS_DC);
-inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC);
-
-#define INITIAL_OP_ARRAY_SIZE 64
-
-
-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 destroy_zend_function(zend_function *function);
-ZEND_API void destroy_zend_class(zend_class_entry *ce);
-zend_op *get_next_op(zend_op_array *op_array 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);
-int pass_two(zend_op_array *op_array);
-void pass_include_eval(zend_op_array *op_array);
-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_EQUAL 15
-#define ZEND_IS_NOT_EQUAL 16
-#define ZEND_IS_SMALLER 17
-#define ZEND_IS_SMALLER_OR_EQUAL 18
-#define ZEND_CAST 19
-#define ZEND_QM_ASSIGN 20
-
-#define ZEND_ASSIGN_ADD 21
-#define ZEND_ASSIGN_SUB 22
-#define ZEND_ASSIGN_MUL 23
-#define ZEND_ASSIGN_DIV 24
-#define ZEND_ASSIGN_MOD 25
-#define ZEND_ASSIGN_SL 26
-#define ZEND_ASSIGN_SR 27
-#define ZEND_ASSIGN_CONCAT 28
-#define ZEND_ASSIGN_BW_OR 29
-#define ZEND_ASSIGN_BW_AND 30
-#define ZEND_ASSIGN_BW_XOR 31
-
-#define ZEND_PRE_INC 32
-#define ZEND_PRE_DEC 33
-#define ZEND_POST_INC 34
-#define ZEND_POST_DEC 35
-
-#define ZEND_ASSIGN 36
-#define ZEND_ASSIGN_REF 37
-
-#define ZEND_ECHO_OP 38
-#define ZEND_PRINT_OP 39
-
-#define ZEND_JMP 40
-#define ZEND_JMPZ 41
-#define ZEND_JMPNZ 42
-#define ZEND_JMPZNZ 43
-#define ZEND_JMPZ_EX 44
-#define ZEND_JMPNZ_EX 45
-#define ZEND_CASE 46
-#define ZEND_BRK 47
-#define ZEND_CONT 48
-#define ZEND_BOOL 49
-
-#define ZEND_INIT_STRING 50
-#define ZEND_ADD_CHAR 51
-#define ZEND_ADD_STRING 52
-#define ZEND_ADD_VAR 53
-
-#define ZEND_BEGIN_SILENCE 54
-#define ZEND_END_SILENCE 55
-
-#define ZEND_INIT_FCALL 56
-#define ZEND_INIT_FCALL_BY_NAME 57
-#define ZEND_DO_FCALL 58
-#define ZEND_RETURN 59
-
-#define ZEND_RECV 60
-#define ZEND_RECV_INIT 61
-
-#define ZEND_SEND_VAL 62
-#define ZEND_SEND_VAR 63
-#define ZEND_SEND_REF 64
-
-#define ZEND_NEW 65
-#define ZEND_JMP_NO_CTOR 66
-#define ZEND_FREE 67
-
-#define ZEND_INIT_ARRAY 68
-#define ZEND_ADD_ARRAY_ELEMENT 69
-
-#define ZEND_INCLUDE_OR_EVAL 70
-
-#define ZEND_UNSET_VAR 71
-#define ZEND_UNSET_DIM_OBJ 72
-#define ZEND_ISSET_ISEMPTY 73
-
-#define ZEND_FE_RESET 74
-#define ZEND_FE_FETCH 75
-
-#define ZEND_EXIT 76
-
-
-/* the following 12 opcodes are 4 groups of 3 opcodes each, and must
- * remain in that order!
- */
-#define ZEND_FETCH_R 77
-#define ZEND_FETCH_DIM_R 78
-#define ZEND_FETCH_OBJ_R 79
-#define ZEND_FETCH_W 80
-#define ZEND_FETCH_DIM_W 81
-#define ZEND_FETCH_OBJ_W 82
-#define ZEND_FETCH_RW 83
-#define ZEND_FETCH_DIM_RW 84
-#define ZEND_FETCH_OBJ_RW 85
-#define ZEND_FETCH_IS 86
-#define ZEND_FETCH_DIM_IS 87
-#define ZEND_FETCH_OBJ_IS 88
-
-#define ZEND_FETCH_DIM_TMP_VAR 89
-#define ZEND_FETCH_CONSTANT 90
-
-#define ZEND_INIT_GLOBALS 91
-
-#define ZEND_EXT_STMT 92
-#define ZEND_EXT_FCALL_BEGIN 93
-#define ZEND_EXT_FCALL_END 94
-#define ZEND_EXT_NOP 95
-
-/* 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 ZEND_INTERNAL_FUNCTION 1
-#define ZEND_USER_FUNCTION 2
-#define ZEND_OVERLOADED_FUNCTION 3
-
-#define ZEND_INTERNAL_CLASS 1
-#define ZEND_USER_CLASS 2
-
-#define ZEND_EVAL (1<<0)
-#define ZEND_INCLUDE (1<<1)
-
-#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_ISTREAM 3
-
-#endif /* _COMPILE_H */
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
deleted file mode 100644
index 6072227a82..0000000000
--- a/Zend/zend_constants.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_constants.h"
-#include "zend_variables.h"
-#include "zend_operators.h"
-#include "zend_globals.h"
-
-
-void free_zend_constant(zend_constant *c)
-{
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- free(c->name);
-}
-
-
-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)
-{
- zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number);
-}
-
-
-int zend_startup_constants(void)
-{
-#if WIN32|WINNT
- DWORD dwBuild=0;
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-#endif
-
-
-/* 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
-
-
- EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
-
- if (zend_hash_init(EG(zend_constants), 20, NULL, (void(*)(void *)) free_zend_constant, 1)==FAILURE) {
- return FAILURE;
- }
-
-#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_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, 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);
-
- c.name = zend_strndup("FALSE",5);
- c.name_len = 6;
- c.value.value.lval = 0;
- c.value.type = IS_BOOL;
- zend_register_constant(&c);
- }
-
- return SUCCESS;
-}
-
-
-int zend_shutdown_constants(void)
-{
- zend_hash_destroy(EG(zend_constants));
- free(EG(zend_constants));
- return SUCCESS;
-}
-
-
-void clean_non_persistent_constants(void)
-{
- 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)
-{
- 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);
-}
-
-
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number)
-{
- 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);
-}
-
-
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number)
-{
- 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);
-}
-
-
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number)
-{
- zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number);
-}
-
-
-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;
-
- 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)
-{
- 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 b03ac9c766..0000000000
--- a/Zend/zend_constants.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _CONSTANTS_H
-#define _CONSTANTS_H
-
-#define CONST_CS 0x1 /* Case Sensitive */
-#define CONST_PERSISTENT 0x2
-
-typedef struct {
- 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)
-#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number)
-#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number)
-#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number)
-
-#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0)
-#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0)
-#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0)
-#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0)
-
-void clean_module_constants(int module_number);
-void free_zend_constant(zend_constant *c);
-int zend_startup_constants(void);
-int zend_shutdown_constants(void);
-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);
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number);
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number);
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number);
-ZEND_API void zend_register_constant(zend_constant *c);
-
-#endif
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
deleted file mode 100644
index bfb0d4c908..0000000000
--- a/Zend/zend_errors.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_ERRORS_H
-#define _ZEND_ERRORS_H
-
-#define E_CORE_ERROR (1<<0L)
-#define E_CORE_WARNING (1<<1L)
-#define E_COMPILE_ERROR (1<<2L)
-#define E_COMPILE_WARNING (1<<3L)
-#define E_PARSE (1<<4L)
-#define E_ERROR (1<<5L)
-#define E_WARNING (1<<6L)
-#define E_NOTICE (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 eb2dc8873c..0000000000
--- a/Zend/zend_execute.c
+++ /dev/null
@@ -1,1915 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <signal.h>
-
-#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"
-
-
-static void destroy_garbage(HashTable *ht)
-{
- zend_hash_destroy(ht);
- efree(ht);
-}
-
-
-#define INC_AI_COUNT(znode_ptr) if (!((znode_ptr)->u.EA.type & EXT_TYPE_UNUSED)) { EG(AiCount)++; }
-#define DEC_AI_COUNT() if (--EG(AiCount)==0) { zend_ptr_stack_clean(&EG(garbage), (void (*)(void *)) destroy_garbage); }
-
-#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);
-
-
-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) {
- DEC_AI_COUNT();
- *should_free = 0;
- return *Ts[node->u.var].var;
- } 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;
- }
- zval_ptr_dtor(&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:
- 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) {
- DEC_AI_COUNT();
- }
- return Ts[node->u.var].var;
- 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 = (zval *) emalloc(sizeof(zval));
-
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- //zend_hash_update(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
- 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, 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;
-
- if (value->type!=IS_STRING) {
- tmp = *value;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- value = &tmp;
- }
-
- T->EA.str->value.str.val[T->EA.offset] = value->value.str.val[0];
- if (value == &tmp) {
- zval_dtor(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);
- T->tmp_var.type = IS_STRING;
- }
- break;
- }
- Ts[result->u.var].var = &EG(uninitialized_zval_ptr);
- INC_AI_COUNT(result);
- return;
- }
-
- variable_ptr = *variable_ptr_ptr;
-
- if (variable_ptr == EG(error_zval_ptr)) {
- if (result) {
- Ts[result->u.var].var = &EG(uninitialized_zval_ptr);
- INC_AI_COUNT(result);
- }
- return;
- }
-
- if (variable_ptr->is_ref) {
- if (variable_ptr!=value) {
- short refcount=variable_ptr->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);
- }
- }
- } else {
- variable_ptr->refcount--;
- variable_ptr = *variable_ptr_ptr;
- if (variable_ptr->refcount==0) {
- switch (type) {
- case IS_VAR:
- case IS_CONST:
- if (variable_ptr==value) {
- variable_ptr->refcount++;
- } else if (value->is_ref) {
- *variable_ptr = *value;
- zval_copy_ctor(variable_ptr);
- variable_ptr->refcount=1;
- } else {
- zendi_zval_dtor(*variable_ptr);
- safe_free_zval_ptr(variable_ptr);
- *variable_ptr_ptr = value;
- value->refcount++;
- }
- 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:
- case IS_CONST:
- if (value->is_ref) {
- 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 = variable_ptr_ptr;
- INC_AI_COUNT(result);
- }
-}
-
-
-/* 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)
-{
- //printf("*** refcount for %x - '%s': %d\n", p, str, p->refcount);
- 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.constant.value.lval) {
- case ZEND_FETCH_LOCAL:
- default: /* just to shut gcc up */
- target_symbol_table = EG(active_symbol_table);
- break;
- case ZEND_FETCH_GLOBAL:
- 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 = (zval *) emalloc(sizeof(zval));
-
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- //zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
- 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.constant.value.lval == ZEND_FETCH_LOCAL) {
- FREE_OP(op1, free_op1);
- } else if (op2->u.constant.value.lval == ZEND_FETCH_STATIC) {
- zval_update_constant(*retval);
- }
-
- if (varname == &tmp_varname) {
- zval_dtor(varname);
- }
- Ts[result->u.var].var = retval;
- INC_AI_COUNT(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 = (zval *) emalloc(sizeof(zval));
-
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- //zend_hash_update(ht, dim->value.str.val, dim->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
- zend_hash_update_ptr(ht, dim->value.str.val, dim->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- }
- break;
- case IS_LONG: {
- if (zend_hash_index_find(ht, dim->value.lval, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined offset: %d", dim->value.lval);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined offset: %d", dim->value.lval);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
-
- var_uninit(new_zval);
- new_zval->refcount=1;
- new_zval->is_ref=0;
- zend_hash_index_update(ht, dim->value.lval, &new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- }
- break;
- /* we need to do implement this nicely somehow ZA
- case IS_DOUBLE:
- 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;
-
-
- 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);
- return;
- case BP_VAR_W:
- case BP_VAR_RW:
- *retval = &EG(error_zval_ptr);
- 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)) {
- INC_AI_COUNT(result);
- *retval = &EG(error_zval_ptr);
- return;
- }
-
- if (container->type == IS_STRING && container->value.str.val == undefined_variable_string) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!container->is_ref) {
- 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 && !container->is_ref) {
- container->refcount--;
- *container_ptr = (zval *) emalloc(sizeof(zval));
- **container_ptr = *container;
- container = *container_ptr;
- container->refcount=1;
- container->is_ref=0;
- zendi_zval_copy_ctor(*container);
- }
- if (op2->op_type == IS_UNUSED) {
- zval *new_zval = (zval *) emalloc(sizeof(zval));
-
- var_uninit(new_zval);
- new_zval->refcount = 1;
- new_zval->is_ref = 0;
- 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);
- }
- 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
- || type==BP_VAR_IS) {
- /* for read-mode only */
- *retval = &EG(uninitialized_zval_ptr);
- 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;
- }
- Ts[result->u.var].EA.str = container;
- container->refcount++;
- 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);
- }
- break;
- }
- INC_AI_COUNT(result);
-}
-
-
-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) {
- INC_AI_COUNT(result);
- Ts[result->u.var].var = &EG(uninitialized_zval_ptr);
- return;
- }
-
- INC_AI_COUNT(result);
- Ts[result->u.var].var = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R ELS_CC);
-}
-
-
-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;
-
-
- 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);
- return;
- case BP_VAR_W:
- case BP_VAR_RW:
- *retval = &EG(error_zval_ptr);
- 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)) {
- INC_AI_COUNT(result);
- *retval = &EG(error_zval_ptr);
- 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_ptr;
- 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.val == undefined_variable_string) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!container->is_ref) {
- 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);
- INC_AI_COUNT(result);
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- return;
- } else {
- *retval = &EG(error_zval_ptr);
- return;
- }
- }
-
-
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !container->is_ref) {
- container->refcount--;
- *container_ptr = (zval *) emalloc(sizeof(zval));
- **container_ptr = *container;
- container = *container_ptr;
- container->refcount=1;
- container->is_ref=0;
- zendi_zval_copy_ctor(*container);
- }
- INC_AI_COUNT(result);
- *retval = zend_fetch_property_address_inner(container->value.obj.properties, op2, Ts, type ELS_CC);
-}
-
-
-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);
- //(*(property_reference->object))->value.obj.ce->handle_function_call(NULL, NULL, NULL, NULL, NULL);
- zend_llist_destroy(&property_reference->elements_list);
-
- zend_stack_del_top(&EG(overloaded_objects_stack));
-}
-
-
-#if HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)
-# define free_alloca(p)
-#else
-# define alloca(p) emalloc(p)
-# define free_alloca(p) efree(p)
-#endif
-
-
-void execute(zend_op_array *op_array ELS_DC)
-{
- zend_op *opline = op_array->opcodes;
- int free_op1, free_op2;
- int (*unary_op)(zval *result, zval *op1);
- int (*binary_op)(zval *result, zval *op1, zval *op2);
- zend_op *end = op_array->opcodes + op_array->last;
- zend_function_state function_state;
- HashTable *calling_symbol_table;
- zend_function *function_being_called=NULL;
- zval **object_ptr=NULL;
-#if !defined (__GNUC__) || __GNUC__ < 2
- temp_variable *Ts = (temp_variable *) 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
-
- while (opline<end) {
- switch(opline->opcode) {
- case ZEND_ADD:
- binary_op = add_function;
- goto binary_op_addr;
- case ZEND_SUB:
- binary_op = sub_function;
- goto binary_op_addr;
- case ZEND_MUL:
- binary_op = mul_function;
- goto binary_op_addr;
- case ZEND_DIV:
- binary_op = div_function;
- goto binary_op_addr;
- case ZEND_MOD:
- binary_op = mod_function;
- goto binary_op_addr;
- case ZEND_SL:
- binary_op = shift_left_function;
- goto binary_op_addr;
- case ZEND_SR:
- binary_op = shift_right_function;
- goto binary_op_addr;
- case ZEND_CONCAT:
- binary_op = concat_function;
- goto binary_op_addr;
- case ZEND_IS_EQUAL:
- binary_op = is_equal_function;
- goto binary_op_addr;
- case ZEND_IS_NOT_EQUAL:
- binary_op = is_not_equal_function;
- goto binary_op_addr;
- case ZEND_IS_SMALLER:
- binary_op = is_smaller_function;
- goto binary_op_addr;
- case ZEND_IS_SMALLER_OR_EQUAL:
- binary_op = is_smaller_or_equal_function;
- goto binary_op_addr;
- case ZEND_BW_OR:
- binary_op = bitwise_or_function;
- goto binary_op_addr;
- case ZEND_BW_AND:
- binary_op = bitwise_and_function;
- goto binary_op_addr;
- case ZEND_BW_XOR:
- binary_op = bitwise_xor_function;
- goto binary_op_addr;
- case ZEND_BOOL_XOR:
- binary_op = boolean_xor_function;
- /* Fall through */
-binary_op_addr:
- binary_op(&Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R),
- get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R) );
- FREE_OP(&opline->op1, free_op1);
- FREE_OP(&opline->op2, free_op2);
- break;
- case ZEND_BW_NOT:
- case ZEND_BOOL_NOT:
- unary_op = get_unary_op(opline->opcode);
- unary_op(&Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R) );
- FREE_OP(&opline->op1, free_op1);
- break;
-
- case ZEND_ASSIGN_ADD:
- binary_op = add_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SUB:
- binary_op = sub_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_MUL:
- binary_op = mul_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_DIV:
- binary_op = div_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_MOD:
- binary_op = mod_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SL:
- binary_op = shift_left_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_SR:
- binary_op = shift_right_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_CONCAT:
- binary_op = concat_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_OR:
- binary_op = bitwise_or_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_AND:
- binary_op = bitwise_and_function;
- goto binary_assign_op_addr;
- case ZEND_ASSIGN_BW_XOR:
- 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 = &EG(uninitialized_zval_ptr);
- INC_AI_COUNT(&opline->result);
- opline++;
- continue;
- }
- if (!(*var_ptr)->is_ref) {
- 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;
- }
- }
- binary_op(*var_ptr, *var_ptr, get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R));
- Ts[opline->result.u.var].var = var_ptr;
- INC_AI_COUNT(&opline->result);
- FREE_OP(&opline->op2, free_op2);
- }
- 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 = &EG(uninitialized_zval_ptr);
- INC_AI_COUNT(&opline->result);
- 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 (!(*var_ptr)->is_ref) {
- 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 = var_ptr;
- INC_AI_COUNT(&opline->result);
- break;
- }
- }
- break;
- case ZEND_PRINT_OP:
- zend_print_variable(get_zval_ptr(&opline->op1, Ts, &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, free_op1);
- break;
- case ZEND_ECHO_OP:
- zend_print_variable(get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R));
- FREE_OP(&opline->op1, free_op1);
- break;
- case ZEND_FETCH_R:
- zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
- 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_IS:
- zend_fetch_var_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_IS ELS_CC);
- break;
- case ZEND_FETCH_DIM_R:
- zend_fetch_dimension_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
- 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);
- break;
- case ZEND_FETCH_OBJ_R:
- zend_fetch_property_address(&opline->result, &opline->op1, &opline->op2, Ts, BP_VAR_R ELS_CC);
- 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);
- break;
- case ZEND_FETCH_DIM_TMP_VAR:
- zend_fetch_dimension_address_from_tmp_var(&opline->result, &opline->op1, &opline->op2, Ts ELS_CC);
- break;
- case ZEND_ASSIGN: {
- zval *value = get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R);
-
- zend_assign_to_variable(&opline->result, &opline->op1, value, (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);
- INC_AI_COUNT(&opline->result);
- 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, &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, free_op1);
- continue;
- }
- FREE_OP(op1, free_op1);
- }
- break;
- case ZEND_JMPNZ: {
- znode *op1 = &opline->op1;
-
- if (zend_is_true(get_zval_ptr(op1, Ts, &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, free_op1);
- continue;
- }
- FREE_OP(op1, free_op1);
- }
- break;
- case ZEND_JMPZNZ: {
- znode *res = &opline->result;
-
- if (!zend_is_true(get_zval_ptr(res, Ts, &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, 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, &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, 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, 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, &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, 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, 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, &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, &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, &free_op2, BP_VAR_R);
- zval var_copy;
- int destroy=0;
-
- if (var->type != IS_STRING) {
- var_copy = *var;
- zval_copy_ctor(&var_copy);
- var = &var_copy;
- convert_to_string(var);
- destroy=1;
- }
- add_string_to_string( &Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_NA),
- var);
- if (destroy) {
- 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, free_op2);
- }
- break;
- case ZEND_INIT_FCALL_BY_NAME: {
- zval *function_name;
- zend_function *function;
- HashTable *active_function_table;
- zval tmp;
-
- if ((opline>EG(active_op_array)->opcodes)
- && opline->op1.op_type==IS_VAR
- && opline->op1.u.EA.type & EXT_TYPE_UNUSED) {
- /* constructor call */
- EG(AiCount)++; /* for op1 */
- if (opline->op2.op_type==IS_VAR) {
- EG(AiCount)++;
- }
- }
- function_name = get_zval_ptr(&opline->op2, Ts, &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;
-
- 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)==FAILURE) {
- object_ptr=NULL;
- }
- } else { /* used for member function calls */
- object_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_R);
-
-
- if (!object_ptr || (*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;
-
- if ((*object_ptr)->type != IS_OBJECT) {
- zend_error(E_ERROR, "Call to a member function on a non-object");
- }
-
- 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);
- function_being_called = (zend_function *) emalloc(sizeof(zend_function));
- function_being_called->type = ZEND_OVERLOADED_FUNCTION;
- function_being_called->common.arg_types = NULL;
- goto overloaded_function_call_cont;
- }
-
- if ((*object_ptr)->type != IS_OBJECT) {
- zend_error(E_ERROR, "Call to a member function on a non-object");
- }
- 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()\n", function_name->value.str.val);
- }
- zval_dtor(&tmp);
- function_being_called = function;
-overloaded_function_call_cont:
- zend_ptr_stack_push(&EG(arg_types_stack), function_being_called);
- FREE_OP(&opline->op2, free_op2);
- }
- break;
- case ZEND_INIT_FCALL:
- object_ptr=NULL;
- function_being_called=NULL;
- break;
- case ZEND_DO_FCALL: {
- zval *original_return_value;
-
- if (function_being_called) {
- function_being_called = zend_ptr_stack_pop(&EG(arg_types_stack));
- function_state.function = function_being_called;
- } else {
- zval *fname = get_zval_ptr(&opline->op1, Ts, &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, free_op1);
- }
- zend_ptr_stack_push(&EG(argument_stack), (void *) opline->extended_value);
- if (function_state.function->type==ZEND_INTERNAL_FUNCTION) {
- var_uninit(&Ts[opline->result.u.var].tmp_var);
- ((zend_internal_function *) function_state.function)->handler(opline->extended_value, &Ts[opline->result.u.var].tmp_var, &EG(regular_list), &EG(persistent_list));
- } else if (function_state.function->type==ZEND_USER_FUNCTION) {
- 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 (object_ptr && function_being_called && function_being_called->type!=ZEND_OVERLOADED_FUNCTION) {
- zval *dummy = (zval *) emalloc(sizeof(zval)), **this_ptr;
-
- var_uninit(dummy);
- dummy->refcount=1;
- dummy->is_ref=0;
- zend_hash_update_ptr(function_state.function_symbol_table, "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr);
- zend_assign_to_variable_reference(NULL, this_ptr, object_ptr, NULL ELS_CC);
- object_ptr = NULL;
- }
- original_return_value = EG(return_value);
- EG(return_value) = &Ts[opline->result.u.var].tmp_var;
- var_uninit(EG(return_value));
- 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));
- efree(function_being_called);
- }
- 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, &free_op1, BP_VAR_R);
-
- *EG(return_value) = *retval;
- if (!free_op1) {
- zendi_zval_copy_ctor(*EG(return_value));
- }
- //return_value->refcount=1;
- //return_value->is_ref=0;
-#if SUPPORT_INTERACTIVE
- op_array->last_executed_op_number = opline-op_array->opcodes;
-#endif
- free_alloca(Ts);
- return;
- }
- break;
- case ZEND_SEND_VAL:
- if (function_being_called
- && function_being_called->common.arg_types
- && opline->op2.u.opline_num<=function_being_called->common.arg_types[0]
- && function_being_called->common.arg_types[opline->op2.u.opline_num]==BYREF_FORCE) {
- 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;
- valptr->refcount=1;
- valptr->is_ref=0;
- //zend_hash_next_index_insert_ptr(function_state.function_symbol_table, valptr, sizeof(zval *), NULL);
- zend_ptr_stack_push(&EG(argument_stack), valptr);
- }
- break;
- case ZEND_SEND_VAR:
- if (function_being_called
- && function_being_called->common.arg_types
- && opline->op2.u.opline_num<=function_being_called->common.arg_types[0]
- && function_being_called->common.arg_types[opline->op2.u.opline_num]==BYREF_FORCE) {
- goto send_by_ref;
- }
- {
- zval *varptr = get_zval_ptr(&opline->op1, Ts, &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 (varptr->is_ref) {
- 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_hash_next_index_insert_ptr(function_state.function_symbol_table, varptr, sizeof(zval *), NULL);
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- }
- 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 (!varptr->is_ref) {
- /* 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_hash_next_index_insert_ptr(function_state.function_symbol_table, varptr, sizeof(zval *), NULL);
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- }
- break;
- case ZEND_RECV: {
- zval **param;
-
- //if (zend_hash_index_find(EG(active_symbol_table), opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
- if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
- zend_error(E_NOTICE, "Missing argument %d for %s()\n", opline->op1.u.constant.value.lval, get_active_function_name());
- DEC_AI_COUNT();
- } else if ((*param)->is_ref) {
- 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, *param, IS_VAR, Ts ELS_CC);
- }
- }
- break;
- case ZEND_RECV_INIT: {
- zval **param, *assignment_value;
-
- //if (zend_hash_index_find(EG(active_symbol_table), opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
- if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param)==FAILURE) {
- if (opline->op2.op_type == IS_UNUSED) {
- DEC_AI_COUNT();
- 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 (assignment_value->is_ref) {
- 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, 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, &free_op1, BP_VAR_R));
- Ts[opline->result.u.var].tmp_var.type = IS_LONG;
- FREE_OP(&opline->op1, free_op1);
- break;
- case ZEND_BRK:
- case ZEND_CONT: {
- zval *nest_levels_zval = get_zval_ptr(&opline->op2, Ts, &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;
- // printf("Jumping to %d\n", jmp_to->brk);
- } else {
- opline = op_array->opcodes+jmp_to->cont;
- // printf("Jumping to %d\n", jmp_to->cont);
- }
- FREE_OP(&opline->op2, free_op2);
- continue;
- }
- break;
- case ZEND_CASE:
- if (opline->op1.op_type == IS_VAR) {
- EG(AiCount)++;
- }
- is_equal_function(&Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R),
- get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R) );
- FREE_OP(&opline->op2, free_op2);
- break;
- case ZEND_NEW: {
- zval *tmp = get_zval_ptr(&opline->op1, Ts, &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);
-
- zval_dtor(&class_name);
- FREE_OP(&opline->op1, 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=get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
- zval *offset=get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R);
-
- if (opline->opcode==ZEND_INIT_ARRAY) {
- array_init(array_ptr);
- if (!expr) {
- break;
- }
- }
- if (free_op1) { /* temporary variable */
- zval *new_expr = (zval *) emalloc(sizeof(zval));
-
- *new_expr = *expr;
- expr = new_expr;
- expr->refcount=1;
- expr->is_ref=0;
- } else {
- if (expr->is_ref) {
- zval *new_expr = (zval *) emalloc(sizeof(zval));
-
- *new_expr = *expr;
- expr = new_expr;
- zendi_zval_copy_ctor(*expr);
- expr->refcount=1;
- expr->is_ref=0;
- } else {
- expr->refcount++;
- }
- }
- if (offset) {
- switch(offset->type) {
- case IS_DOUBLE:
- zend_hash_index_update(array_ptr->value.ht, (long) offset->value.lval, &expr, sizeof(zval *), NULL);
- break;
- case IS_LONG:
- zend_hash_index_update(array_ptr->value.ht, offset->value.lval, &expr, sizeof(zval *), NULL);
- break;
- case IS_STRING:
- zend_hash_update(array_ptr->value.ht, offset->value.str.val, offset->value.str.len+1, &expr, sizeof(zval *), NULL);
- break;
- default:
- /* do nothing */
- break;
- }
- FREE_OP(&opline->op2, free_op2);
- } else {
- zend_hash_next_index_insert(array_ptr->value.ht, &expr, sizeof(zval *), NULL);
- }
- }
- break;
- case ZEND_CAST: {
- zval *expr = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
- zval *result = &Ts[opline->result.u.var].tmp_var;
-
- *result = *expr;
- if (!free_op1) {
- zendi_zval_copy_ctor(*result);
- }
- switch (opline->op2.u.constant.type) {
- 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, &free_op1, BP_VAR_R) CLS_CC);
- break;
- case ZEND_EVAL:
- new_op_array = compile_string(get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R) CLS_CC);
- break;
- }
- 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;
- FREE_OP(&opline->op1, free_op1);
- }
- break;
- case ZEND_UNSET_VAR: {
- zval tmp, *variable = get_zval_ptr(&opline->op1, Ts, &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, 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, &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, free_op2);
- }
- break;
- case ZEND_FE_RESET: {
- zval *array = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
-
- Ts[opline->result.u.var].tmp_var = *array;
- array = &Ts[opline->result.u.var].tmp_var;
- if (!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, &free_op1, BP_VAR_R);
- zval *result = &Ts[opline->result.u.var].tmp_var;
- zval **value, *key;
- char *str_key;
- ulong int_key;
-
- 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));
- key->refcount=1;
- key->is_ref=0;
- 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;
-
- EG(AiCount)++;
- object = get_zval_ptr(&opline->op1, Ts, &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==&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 (!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, &free_op1, BP_VAR_R));
- FREE_OP(&opline->op1, 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, &free_op1, BP_VAR_R);
-
- Ts[opline->result.u.var].tmp_var = *value;
- if (!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_INIT_GLOBALS: {
- zval *globals = (zval *) emalloc(sizeof(zval));
-
- globals->refcount=1;
- globals->is_ref=1;
- globals->type = IS_ARRAY;
- globals->value.ht = &EG(symbol_table);
- zend_hash_add(EG(active_symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
- }
- 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 206bcd6f6f..0000000000
--- a/Zend/zend_execute.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _EXECUTE_H
-#define _EXECUTE_H
-
-#include "zend_compile.h"
-#include "zend_hash.h"
-
-typedef union {
- zval tmp_var;
- zval **var;
- struct {
- zval **var_dummy; /* 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 void zval_update_constant(zval *p);
-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);
-
-#if SUPPORT_INTERACTIVE
-void execute_new_code(CLS_D);
-#endif
-
-
-/* services */
-ZEND_API char *get_active_function_name();
-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 0b02007642..0000000000
--- a/Zend/zend_execute_API.c
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <signal.h>
-
-#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);
-
-
-static void (*original_sigsegv_handler)(int);
-static void zend_handle_sigsegv(int dummy)
-{
- fflush(stdout);
- signal(SIGSEGV, original_sigsegv_handler);
-/*
- printf("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(),
- zend_get_executed_lineno());
- original_sigsegv_handler(dummy);
-*/
-}
-
-
-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));
- original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
- EG(return_value) = &EG(global_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(AiCount) = 0;
- zend_ptr_stack_init(&EG(garbage));
-
- 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);
-
- /* $GLOBALS array */
- {
- zval *globals = (zval *) emalloc(sizeof(zval));
-
- globals->value.ht = &EG(symbol_table);
- globals->type = IS_ARRAY;
- globals->refcount = 1;
- globals->is_ref = 0;
- zend_hash_update(&EG(symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL);
- }
-}
-
-
-void shutdown_executor(ELS_D)
-{
- 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_ptr_stack_destroy(&EG(garbage));
-
- 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();
-}
-
-
-ZEND_API char *get_active_function_name(ELS_D)
-{
- 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)
-{
- return active_opline->filename;
-}
-
-
-ZEND_API uint zend_get_executed_lineno(ELS_D)
-{
- return active_opline->lineno;
-}
-
-
-ZEND_API inline void safe_free_zval_ptr(zval *p)
-{
- ELS_FETCH();
-
- if (p!=EG(uninitialized_zval_ptr)) {
- efree(p);
- }
-}
-
-
-ZEND_API void zval_ptr_dtor(zval **zval_ptr)
-{
-#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);
- }
-}
-
-
-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 void zval_update_constant(zval *p)
-{
- if (p->type == IS_CONSTANT) {
- zval c;
-
- 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;
- }
- p->refcount = 1;
- p->is_ref = 0;
- }
-}
-
-int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[])
-{
- int i;
- zval *original_return_value;
- HashTable *calling_symbol_table;
- zend_function_state function_state;
- zend_function_state *original_function_state_ptr;
- zend_op_array *original_op_array;
- zend_op **original_opline_ptr;
- CLS_FETCH();
- ELS_FETCH();
-
- if (object) {
- if (object->type != IS_OBJECT) {
- return FAILURE;
- }
- function_table = &object->value.obj.ce->function_table;
- /* unimplemented */
- }
- 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) {
- zend_error(E_ERROR, "Unknown function: %s()\n", function_name->value.str.val);
- return FAILURE;
- }
-
-
- for (i=0; i<param_count; i++) {
- zval *param;
-
- param = (zval *) emalloc(sizeof(zval));
- *param = *(params[i]);
- param->refcount=1;
- param->is_ref=0;
- zval_copy_ctor(param);
- //zend_hash_next_index_insert_ptr(function_state.function_symbol_table, param, sizeof(zval *), NULL);
- zend_ptr_stack_push(&EG(argument_stack), param);
- }
-
- zend_ptr_stack_push(&EG(argument_stack), (void *) 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);
- dummy->refcount=1;
- dummy->is_ref=0;
- 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));
- }
- 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!=value_ptr) {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- zendi_zval_dtor(*variable_ptr);
- efree(variable_ptr);
- }
-
- if (!value_ptr->is_ref) {
- /* 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 = variable_ptr_ptr;
- }
-}
-
-
-#if SUPPORT_INTERACTIVE
-void execute_new_code(CLS_D)
-{
- ELS_FETCH();
-
- if (!EG(interactive)
- || CG(active_op_array)->backpatch_count>0) {
-
- 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)
-{
- 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 92eb410aa9..0000000000
--- a/Zend/zend_extensions.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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) {
- zend_printf("Failed loading %s\n", path);
- 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) {
- zend_printf("%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) {
- zend_printf("%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. */
- zend_printf("%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) {
- zend_printf("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;
- }
-
- 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);
-
- /*zend_printf("Loaded %s, version %s\n", extension.name, extension.version);*/
-
- zend_append_version_info(&extension);
- return SUCCESS;
-#else
- zend_printf("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 cd1c3cb974..0000000000
--- a/Zend/zend_extensions.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_EXTENSIONS_H
-#define _ZEND_EXTENSIONS_H
-
-#include "zend_compile.h"
-
-#define ZEND_EXTENSION_API_NO 2
-
-typedef struct {
- int zend_extension_api_no;
- char *required_zend_version;
- unsigned char thread_safe;
-} 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 (*deactivate)();
-
- 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();
-
-#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.80A", ZTS_V }
-
-#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();
-
-#endif /* _ZEND_EXTENSIONS_H */
diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h
deleted file mode 100644
index 727eb312a6..0000000000
--- a/Zend/zend_globals.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_GLOBALS_H
-#define _ZEND_GLOBALS_H
-
-#include <setjmp.h>
-
-#include "zend_stack.h"
-#include "zend_ptr_stack.h"
-#include "zend_hash.h"
-#include "zend_llist.h"
-
-#undef ZTS
-
-#ifdef ZTS
-#include "SAPI.h"
-
-extern int compiler_globals_id;
-extern int executor_globals_id;
-#endif
-
-typedef struct _zend_compiler_globals zend_compiler_globals;
-typedef struct _zend_executor_globals zend_executor_globals;
-typedef struct _zend_alloc_globals zend_alloc_globals;
-
-#define SYMTABLE_CACHE_SIZE 32
-
-
-/* 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 = ts_resource(compiler_globals_id)
-# define YYPARSE_PARAM compiler_globals
-# define YYLEX_PARAM compiler_globals
-int zendparse(void *compiler_globals);
-#else
-# define CLS_D
-# define CLS_DC
-# define CLS_C
-# define CLS_CC
-# define CG(v) (compiler_globals.v)
-# define CLS_FETCH()
-extern ZEND_API zend_compiler_globals compiler_globals;
-int zendparse();
-#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 = ts_resource(executor_globals_id)
-#else
-# define ELS_D
-# 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 = ts_resource(alloc_globals_id)
-#else
-# define ALS_D
-# define ALS_DC
-# define ALS_C
-# define ALS_CC
-# define AG(v) (alloc_globals.v)
-# define ALS_FETCH()
-#endif
-
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-
-struct _zend_compiler_globals {
- zend_stack bp_stack;
- zend_stack switch_cond_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;
- char *heredoc;
- int heredoc_len;
-
- zend_op_array *active_op_array;
-
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
-
- zend_llist filenames_list;
-
- unsigned char short_tags;
- unsigned char asp_tags;
-
- /* For extensions support */
- unsigned char extended_info; /* generate extension information for debugger/profiler */
- unsigned char handle_op_arrays; /* run op_arrays through op_array handlers */
-};
-
-
-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 */
-
- 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;
-
- unsigned int AiCount;
-
- zend_ptr_stack garbage;
-
- /* for extended information support */
- unsigned char no_extensions;
-
- HashTable regular_list;
- HashTable persistent_list;
-
- zend_ptr_stack argument_stack;
-
- void *reserved[4];
-#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 /* _ZEND_GLOBALS_H */
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
deleted file mode 100644
index 4cb93c9c69..0000000000
--- a/Zend/zend_hash.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-
-#include "zend.h"
-
-
-#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<end) { \
- if (!(*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 int zend_hash_rehash(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), void (*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(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;
-}
-
-static 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;
-
- 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);
- }
- 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->arKey == NULL) {
- 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->arKey == NULL) {
- zend_hash_index_del(ht, q->h);
- } else {
- zend_hash_del(ht,q->arKey,q->nKeyLength);
- }
- }
- }
-}
-
-
-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)
-{
- Bucket *p;
- void *t;
-
- p = source->pListHead;
- while (p) {
- memcpy(tmp, p->pData, size);
- if (p->arKey) {
- if (zend_hash_add(target, p->arKey, p->nKeyLength, tmp, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- } else {
- if (!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_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, int (*compar) (const void *, const void *), 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++;
- }
-
- qsort((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 2699b53978..0000000000
--- a/Zend/zend_hash.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _HASH_
-#define _HASH_
-
-#include <sys/types.h>
-
-#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;
- void (*pDestructor) (void *pData);
- unsigned char persistent;
-} HashTable;
-
-
-/* startup/shutdown */
-ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), void (*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);
-
-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 *);
-
-
-
-/* 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_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);
-ZEND_API int zend_hash_sort(HashTable *ht, int (*compar) (const void *, const void *), 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 ulong hashpjw(char *arKey, uint nKeyLength);
-
-#if DEBUG
-/* debug */
-void zend_hash_display_pListTail(HashTable *ht);
-void zend_hash_display(HashTable *ht);
-#endif
-
-#endif /* _HASH_ */
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
deleted file mode 100644
index 542d1989f0..0000000000
--- a/Zend/zend_highlight.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_highlight.h"
-#include "zend_ptr_stack.h"
-#include "zend_globals.h"
-
-extern char *zendtext;
-extern int zendleng;
-
-
-static void html_putc(char c)
-{
- switch (c) {
- case '\n':
- ZEND_PUTS("<br>");
- break;
- case '<':
- ZEND_PUTS("&lt;");
- break;
- case '>':
- ZEND_PUTS("&gt;");
- break;
- case '&':
- ZEND_PUTS("&amp;");
- break;
- case ' ':
- ZEND_PUTS("&nbsp;");
- break;
- case '\t':
- ZEND_PUTS("&nbsp;&nbsp;&nbsp;&nbsp;");
- break;
- default:
- ZEND_PUTC(c);
- break;
- }
-}
-
-
-static void html_puts(char *s, uint len)
-{
- register char *ptr=s, *end=s+len;
-
- while (ptr<end) {
- html_putc(*ptr++);
- }
-}
-
-
-
-
-void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- zval token;
- int token_type;
- char *last_color = syntax_highlighter_ini->highlight_html;
- char *next_color;
- int in_string=0;
- CLS_FETCH();
-
- zend_printf("<font color=\"%s\">\n", last_color);
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token CLS_CC))) {
- switch (token_type) {
- case INLINE_HTML:
- next_color = syntax_highlighter_ini->highlight_html;
- break;
- case ZEND_COMMENT:
- next_color = syntax_highlighter_ini->highlight_comment;
- break;
- case PHP_OPEN_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case PHP_CLOSE_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case 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("</font>");
- }
- last_color = next_color;
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("<font color=\"%s\">", last_color);
- }
- }
- switch (token_type) {
- case DOLLAR_OPEN_CURLY_BRACES:
- html_puts("{", 1);
- break;
- default:
- html_puts(zendtext, zendleng);
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case PHP_OPEN_TAG:
- case PHP_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("</font>\n");
- }
- zend_printf("</font>\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 77e7bc418c..0000000000
--- a/Zend/zend_highlight.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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 {
- char *highlight_html;
- char *highlight_comment;
- char *highlight_default;
- char *highlight_string;
- char *highlight_keyword;
-} zend_syntax_highlighter_ini;
-
-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);
-
-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 223cbea791..0000000000
--- a/Zend/zend_indent.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-/* This indenter doesn't really work, it's here for no particular reason. */
-
-
-#include "zend.h"
-#include "zend_compile.h"
-#include "zend_indent.h"
-
-extern char *zendtext;
-extern int zendleng;
-
-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; i<emit_whitespace[c]; i++) {
- zend_write(&c, 1);
- }
- }
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
-}
-
-
-void zend_indent()
-{
- zval token;
- int token_type;
- int in_string=0;
- int nest_level=0;
- int emit_whitespace[256];
- int i;
- CLS_FETCH();
-
- memset(emit_whitespace, 0, sizeof(int)*256);
-
- /* highlight stuff coming back from zendlex() */
- token.type = 0;
- while ((token_type=lex_scan(&token CLS_CC))) {
- switch (token_type) {
- case INLINE_HTML:
- zend_write(zendtext, zendleng);
- break;
- case T_WHITESPACE: {
- token.type = 0;
- /* eat whitespace, emit newlines */
- for (i=0; i<zendleng; i++) {
- emit_whitespace[(unsigned char) zendtext[i]]++;
- }
- continue;
- }
- break;
- case '"':
- in_string = !in_string;
- /* break missing intentionally */
- default:
- if (token.type==0) {
- /* keyword */
- switch(token_type) {
- case ',':
- ZEND_PUTS(", ");
- goto dflt_printout;
- break;
- case '{':
- nest_level++;
- if (emit_whitespace['\n']>0) {
- 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; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- goto dflt_printout;
- break;
-dflt_printout:
- default:
- if (emit_whitespace['\n']>0) {
- for (i=0; i<emit_whitespace['\n']; i++) {
- ZEND_PUTS("\n");
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
- for (i=0; i<nest_level; i++) {
- ZEND_PUTS(" ");
- }
- } else {
- handle_whitespace(emit_whitespace);
- }
- zend_write(zendtext, zendleng);
- break;
- }
- } else {
- handle_whitespace(emit_whitespace);
- if (in_string) {
- zend_write(zendtext, zendleng);
- /* a part of a string */
- } else {
- zend_write(zendtext, zendleng);
- }
- }
- break;
- }
- if (token.type == IS_STRING) {
- switch (token_type) {
- case PHP_OPEN_TAG:
- case PHP_CLOSE_TAG:
- case T_WHITESPACE:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- }
- token.type = 0;
- }
-}
diff --git a/Zend/zend_indent.h b/Zend/zend_indent.h
deleted file mode 100644
index 49cc9949f0..0000000000
--- a/Zend/zend_indent.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_INDENT_H
-#define _ZEND_INDENT_H
-
-void zend_indent();
-
-#endif /* _ZEND_INDENT_H */
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
deleted file mode 100644
index 9c5c6caf80..0000000000
--- a/Zend/zend_list.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-
-#if 0
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if MSVC5
-#if !(APACHE)
-#define NEEDRDH 1
-#endif
-#include "win32/readdir.h"
-#endif
-#endif
-
-
-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;
- }
-}
-
-
-int zend_list_insert(void *ptr, int type)
-{
- ELS_FETCH();
-
- return zend_list_do_insert(&EG(regular_list), ptr, type);
-}
-
-
-int zend_plist_insert(void *ptr, int type)
-{
- ELS_FETCH();
-
- return zend_list_do_insert(&EG(persistent_list), ptr, type);
-}
-
-
-int zend_list_delete(int id)
-{
- ELS_FETCH();
-
- return zend_list_do_delete(&EG(regular_list), id);
-}
-
-
-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;
- }
-}
-
-int zend_plist_delete(int id)
-{
- ELS_FETCH();
-
- return zend_list_do_delete(&EG(persistent_list), id);
-}
-
-
-void *zend_list_find(int id, int *type)
-{
- ELS_FETCH();
-
- return zend_list_do_find(&EG(regular_list), id, type);
-}
-
-
-void *zend_plist_find(int id, int *type)
-{
- ELS_FETCH();
-
- return zend_list_do_find(&EG(persistent_list), id, type);
-}
-
-
-void list_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->list_destructor) {
- (ld->list_destructor)(le->ptr);
- }
- } else {
- zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type);
- }
-}
-
-
-void 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);
- }
-}
-
-
-int init_resource_list(void)
-{
- ELS_FETCH();
-
- return zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0);
-}
-
-
-int init_resource_plist(void)
-{
- ELS_FETCH();
-
- 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 b3e11a0c69..0000000000
--- a/Zend/zend_list.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _LIST_H
-#define _LIST_H
-
-#include "zend_hash.h"
-
-extern HashTable list_destructors;
-
-typedef struct {
- void *ptr;
- int type;
- int refcount;
-} list_entry;
-
-typedef struct {
- 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
-};
-
-void list_entry_destructor(void *ptr);
-void plist_entry_destructor(void *ptr);
-
-int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number);
-int init_resource_list(void);
-int init_resource_plist(void);
-void destroy_resource_list(void);
-void destroy_resource_plist(void);
-
-int zend_list_insert(void *ptr, int type);
-int zend_plist_insert(void *ptr, int type);
-int zend_list_addref(int id);
-int zend_list_delete(int id);
-int zend_plist_delete(int id);
-void *zend_list_find(int id, int *type);
-void *zend_plist_find(int id, int *type);
-
-#endif
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
deleted file mode 100644
index 2a659cef88..0000000000
--- a/Zend/zend_llist.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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_del_element(zend_llist *l, void *element)
-{
- zend_llist_element *current=l->head;
-
- while (current) {
- if (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, *next;
-
- if (l->dtor) {
- current = l->head;
-
- while (current) {
- l->dtor(current->data);
- current = current->next;
- }
- }
-
- current = l->head;
- while (current) {
- next = current->next;
- pefree(current, l->persistent);
- current = next;
- }
-}
-
-
-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 0c591f55d9..0000000000
--- a/Zend/zend_llist.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_LLIST_H
-#define _ZEND_LLIST_H
-
-#include <stdlib.h>
-
-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_element *head;
- zend_llist_element *tail;
- size_t size;
- void (*dtor)(void *data);
- unsigned char persistent;
- zend_llist_element *traverse_ptr;
-} zend_llist;
-
-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_del_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_destroy(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);
-
-#endif /* _ZEND_LLIST_H */
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
deleted file mode 100644
index f4805f0663..0000000000
--- a/Zend/zend_modules.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _MODULES_H
-#define _MODULES_H
-
-#define INIT_FUNC_ARGS int type, int module_number
-#define SHUTDOWN_FUNC_ARGS int type, int module_number
-
-#define STANDARD_MODULE_PROPERTIES 0, 0, 0, NULL, 0
-
-
-#define MODULE_PERSISTENT 1
-#define MODULE_TEMPORARY 2
-
-typedef struct {
- 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)(void);
- int request_started,module_started;
- unsigned char type;
- void *handle;
- int module_number;
-} zend_module_entry;
-
-
-extern HashTable module_registry;
-
-extern void module_destructor(zend_module_entry *module);
-extern int module_registry_cleanup(zend_module_entry *module);
-extern int module_registry_request_startup(zend_module_entry *module);
-
-#endif
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
deleted file mode 100644
index 8c53e3e807..0000000000
--- a/Zend/zend_opcode.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-
-#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
- CLS_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->initialized_globals = 0;
-
- zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_ctor_handler, op_array);
-}
-
-
-ZEND_API void 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;
- }
-}
-
-
-ZEND_API void destroy_zend_class(zend_class_entry *ce)
-{
- if (--(*ce->refcount)>0) {
- return;
- }
- switch (ce->type) {
- case ZEND_USER_CLASS:
- efree(ce->name);
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- break;
- case ZEND_INTERNAL_CLASS:
- free(ce->name);
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- break;
- }
-}
-
-
-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 (opline<end) {
- if (opline->op1.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);
-}
-
-
-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]);
- next_op->lineno = CG(zend_lineno);
- next_op->filename = zend_get_compiled_filename();
- next_op->result.op_type = IS_UNUSED;
-
- 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)
-{
- zend_op *opline = op_array->opcodes, *end=opline+op_array->last;
-
- while (opline<end) {
- if (opline->opcode == ZEND_EXT_STMT) {
- if (opline+1<end) {
- if ((opline+1)->opcode == 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);
- 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) {
- return 0;
- }
- if (CG(extended_info)) {
- zend_update_extended_info(op_array);
- }
- 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 (opline<end) {
- if (opline->op1.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 void *get_unary_op(int opcode)
-{
- switch(opcode) {
- case ZEND_BW_NOT:
- return (void *) bitwise_not_function;
- break;
- case ZEND_BOOL_NOT:
- return (void *) boolean_not_function;
- break;
- default:
- return (void *) 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_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 242afc85b6..0000000000
--- a/Zend/zend_operators.c
+++ /dev/null
@@ -1,1329 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <ctype.h>
-
-#include "zend.h"
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_globals.h"
-
-#if WITH_BCMATH
-#include "functions/number.h"
-#endif
-
-static inline int is_numeric_string(char *str, int length, long *lval, double *dval);
-
-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;
-#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) \
- 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); \
- }
-
-
-#define zendi_convert_to_long(op, holder) \
- if ((op)->type != IS_LONG) { \
- switch ((op)->type) { \
- case IS_BOOL: \
- case IS_RESOURCE: \
- break; \
- 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: \
- case IS_OBJECT: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?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) \
- if ((op)->type != IS_BOOL) { \
- switch ((op)->type) { \
- case IS_LONG: \
- case IS_RESOURCE: \
- (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: \
- case IS_OBJECT: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- default: \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_BOOL; \
- (op) = &(holder); \
- } \
-
-
-static inline void zendi_convert_to_string(zval **op_ptr, zval *holder)
-{
- zval *op = *op_ptr;
- ELS_FETCH();
-
- if (op->type != IS_STRING) {
- switch (op->type) {
- case IS_BOOL:
- holder->value.str.val = (op->value.lval?estrndup("1",1):estrndup("0",1));
- holder->value.str.len = 1;
- break;
- case IS_RESOURCE:
- case IS_LONG:
- holder->value.str.val = (char *) emalloc(MAX_LENGTH_OF_LONG + 1);
- holder->value.str.len = zend_sprintf(holder->value.str.val, "%ld", op->value.lval); /* SAFE */
- break;
- case IS_DOUBLE: {
- holder->value.str.val = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- holder->value.str.len = zend_sprintf(holder->value.str.val, "%.*G", (int) EG(precision), op->value.dval); /* SAFE */
- /* %G already handles removing trailing zeros from the fractional part, yay */
- break;
- }
- case IS_ARRAY:
- holder->value.str.val = estrndup("Array",sizeof("Array")-1);
- holder->value.str.len = sizeof("Array")-1;
- break;
- case IS_OBJECT:
- holder->value.str.val = estrndup("Object",sizeof("Object")-1);
- holder->value.str.len = sizeof("Object")-1;
- break;
- default:
- var_reset(holder);
- break;
- }
- holder->type = IS_STRING;
- *op_ptr = 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_BOOL:
- case IS_RESOURCE:
- case IS_LONG:
- return;
- case IS_DOUBLE:
- op->value.lval = (long) op->value.dval;
- op->type = IS_LONG;
- break;
- case IS_STRING:
- strval = op->value.str.val;
- op->value.lval = strtol(strval, NULL, base);
- op->type = IS_LONG;
- STR_FREE(strval);
- break;
- case IS_ARRAY:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- op->type = IS_LONG;
- break;
- case IS_OBJECT:
- tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- op->type = IS_LONG;
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to ordinal value");
- zval_dtor(op);
- op->value.lval = 0;
- op->type = IS_LONG;
- break;
- }
-
- op->type = IS_LONG;
-}
-
-
-ZEND_API void convert_to_double(zval *op)
-{
- char *strval;
- double tmp;
-
- switch (op->type) {
- case IS_BOOL:
- case IS_RESOURCE:
- 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:
- case IS_OBJECT:
- tmp = (zend_hash_num_elements(op->value.ht)?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_LONG:
- case IS_RESOURCE:
- 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:
- case IS_OBJECT:
- tmp = (zend_hash_num_elements(op->value.ht)?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:
- op->value.str.val = (op->value.lval?estrndup("1",1):estrndup("0",0));
- op->value.str.len = 1;
- 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;
- entry->refcount = 1;
- entry->is_ref = 0;
-
- 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 = &standard_class;
- 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 = &standard_class;
- 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;
-
- zend_hash_merge(op1->value.ht,op2->value.ht,(void (*)(void *pData)) zval_copy_ctor, (void *) &tmp, sizeof(zval));
- *result = *op1;
- zval_dtor(op2);
- return SUCCESS;
- }
- zendi_convert_scalar_to_number(op1, op1_copy);
- zendi_convert_scalar_to_number(op2, op2_copy);
-
- 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->type = IS_DOUBLE;
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) + op2->value.dval) :
- (op1->value.dval + ((double) op2->value.lval)));
- 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);
- zendi_convert_scalar_to_number(op2, op2_copy);
-
- 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->type = IS_DOUBLE;
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) - op2->value.dval) :
- (op1->value.dval - ((double) op2->value.lval)));
- 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);
- zendi_convert_scalar_to_number(op2, op2_copy);
-
- 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->type = IS_DOUBLE;
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) * op2->value.dval) :
- (op1->value.dval * ((double) op2->value.lval)));
- 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);
- zendi_convert_scalar_to_number(op2, op2_copy);
-
- 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->type = IS_DOUBLE;
- result->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) / op2->value.dval) :
- (op1->value.dval / ((double) op2->value.lval)));
- 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);
- zendi_convert_to_long(op2, op2_copy);
-
- 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);
- if (op1->value.lval) {
- result->value.lval = 1;
- return SUCCESS;
- }
- zendi_convert_to_boolean(op2, op2_copy);
- 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);
- if (!op1->value.lval) {
- result->value.lval = 0;
- return SUCCESS;
- }
- zendi_convert_to_boolean(op2, op2_copy);
- 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);
- zendi_convert_to_boolean(op2, op2_copy);
- 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->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);
- zendi_convert_to_long(op2, op2_copy);
-
- 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);
- zendi_convert_to_long(op2, op2_copy);
-
- 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);
- zendi_convert_to_long(op2, op2_copy);
-
- 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);
- zendi_convert_to_long(op2, op2_copy);
- 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);
- zendi_convert_to_long(op2, op2_copy);
- 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;
- zval *orig_op1=op1, *orig_op2=op2;
-
- zendi_convert_to_string(&op1, &op1_copy);
- zendi_convert_to_string(&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 (orig_op1 != op1) {
- zval_dtor(op1);
- }
- if (orig_op2 != op2) {
- 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) {
- convert_to_boolean(op1);
- convert_to_boolean(op2);
- result->type = IS_LONG;
- result->value.lval = (op1->value.lval!=op2->value.lval);
- return SUCCESS;
- }
- zendi_convert_scalar_to_number(op1, op1_copy);
- zendi_convert_scalar_to_number(op2, op2_copy);
-
- 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->type = IS_DOUBLE;
- 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);
- 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_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)
-{
- //printf("Comparing %d and %d\n", op1->value.lval, op2->value.lval);
- 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 */
- 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 (p<end) {
- *p = tolower(*p);
- p++;
- }
-}
-
-
-ZEND_API int zend_binary_strcmp(zval *s1, zval *s2)
-{
- int retval;
-
- retval = memcmp(s1->value.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 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
-static 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<end) {
- switch(*ptr++) {
- case 'e':
- case 'E':
- /* scientific notation, not handled by the BC library */
- return IS_DOUBLE;
- break;
- default:
- break;
- }
- }
- return IS_BC;
- } else {
- return IS_DOUBLE;
- }
-#else
- return IS_DOUBLE;
-#endif
- }
-
- return 0;
-}
-
-#else
-
-static inline int is_numeric_string(char *str, int length, long *lval, double *dval)
-{
- register char *p=str, *end=str+length;
- unsigned char had_period=0,had_exponent=0;
- char *end_ptr;
-
- if (!length) {
- return 0;
- }
- switch (*p) {
- case '-':
- case '+':
- while (*++p==' '); /* ignore spaces after the sign */
- break;
- default:
- break;
- }
- while (p<end) {
- if (isdigit((int)(unsigned char)*p)) {
- p++;
- } else if (*p=='.') {
- if (had_period) {
- return 0;
- } else {
- had_period=1;
- p++;
- }
- } else if (*p=='e' || *p=='E') {
- p++;
- if (is_numeric_string(p, length - (int) (p-str), NULL, NULL)==IS_LONG) { /* valid exponent */
- had_exponent=1;
- break;
- } else {
- return 0;
- }
- } else {
- return 0;
- }
- }
- errno=0;
- if (had_period || had_exponent) { /* floating point number */
- double local_dval;
-
- local_dval = strtod(str, &end_ptr);
- if (errno==ERANGE || end_ptr != str+length) { /* overflow or bad string */
- return 0;
- } else {
- if (dval) {
- *dval = local_dval;
- }
- return IS_DOUBLE;
- }
- } else {
- long local_lval;
-
- local_lval = strtol(str, &end_ptr, 10);
- if (errno==ERANGE || end_ptr != str+length) { /* overflow or bad string */
- return 0;
- } else {
- if (lval) {
- *lval = local_lval;
- }
- return IS_LONG;
- }
- }
-}
-
-#endif
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h
deleted file mode 100644
index 873cbcb7ee..0000000000
--- a/Zend/zend_operators.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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_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 int increment_function(zval *op1);
-ZEND_API int decrement_function(zval *op2);
-
-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);
-
-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 void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
-
-#endif
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c
deleted file mode 100644
index f07f942aa2..0000000000
--- a/Zend/zend_ptr_stack.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include "zend.h"
-#include "zend_ptr_stack.h"
-
-
-ZEND_API void zend_ptr_stack_init(zend_ptr_stack *stack)
-{
- stack->top_element = stack->elements = (void **) emalloc(sizeof(void *)*STACK_BLOCK_SIZE);
- stack->max = 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 */
- short diff = stack->top_element-stack->elements;
-
- stack->elements = (void **) erealloc(stack->elements, (sizeof(void *) * (stack->max *= 2 )));
- stack->top_element = stack->elements+diff;
- }
- stack->top++;
- *(stack->top_element++) = 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 15f59de293..0000000000
--- a/Zend/zend_ptr_stack.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_PTR_STACK_H
-#define _ZEND_PTR_STACK_H
-
-typedef struct {
- short top, max;
- void **elements;
- void **top_element;
-} zend_ptr_stack;
-
-
-#define 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_pop(zend_ptr_stack *stack);
-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 bebfd2ae8f..0000000000
--- a/Zend/zend_sprintf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-
-#include "zend.h"
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-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);
-}
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
deleted file mode 100644
index 4744fed0b6..0000000000
--- a/Zend/zend_stack.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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;
-}
diff --git a/Zend/zend_stack.h b/Zend/zend_stack.h
deleted file mode 100644
index abd3652529..0000000000
--- a/Zend/zend_stack.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _ZEND_STACK_H
-#define _ZEND_STACK_H
-
-typedef struct {
- 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);
-
-
-#endif /* _ZEND_STACK_H */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
deleted file mode 100644
index a4365435d7..0000000000
--- a/Zend/zend_variables.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#include <stdio.h>
-#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 void zval_dtor(zval *zvalue)
-{
- if (zvalue->type==IS_LONG) {
- return;
- }
- switch(zvalue->type) {
- case IS_STRING:
- case IS_CONSTANT:
- STR_FREE(zvalue->value.str.val);
- break;
- case IS_ARRAY: {
- ELS_FETCH();
-
- if (zvalue->value.ht && (zvalue->value.ht != &EG(symbol_table))) {
- if (EG(AiCount)==0) {
- zend_hash_destroy(zvalue->value.ht);
- efree(zvalue->value.ht);
- } else {
- zend_ptr_stack_push(&EG(garbage), zvalue->value.ht);
- }
- }
- }
- break;
- case IS_OBJECT: {
- ELS_FETCH();
-
- if (EG(AiCount)==0) {
- zend_hash_destroy(zvalue->value.obj.properties);
- efree(zvalue->value.obj.properties);
- } else {
- zend_ptr_stack_push(&EG(garbage), 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;
- break;
- }
-}
-
-
-void zval_add_ref(zval **p)
-{
- (*p)->refcount++;
-}
-
-
-
-
-ZEND_API int zval_copy_ctor(zval *zvalue)
-{
- 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(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 || zvalue->value.ht==&EG(symbol_table)) {
- var_reset(zvalue);
- return FAILURE;
- }
- zvalue->value.ht = (HashTable *) emalloc(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(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);
-}
-
-
-/*
- * 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 a4525dae96..0000000000
--- a/Zend/zend_variables.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, 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. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#ifndef _VARIABLES_H
-#define _VARIABLES_H
-
-
-ZEND_API int zend_print_variable(zval *var);
-
-ZEND_API int zval_copy_ctor(zval *zvalue);
-ZEND_API void zval_dtor(zval *zvalue);
-ZEND_API void zval_ptr_dtor(zval **zval_ptr);
-void zval_add_ref(zval **p);
-
-#define PVAL_DESTRUCTOR (void (*)(void *)) zval_dtor
-#define PVAL_PTR_DTOR (void (*)(void *)) zval_ptr_dtor
-#define PVAL_COPY_CTOR (void (*)(void *)) zval_copy_ctor
-
-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 c5d3f9e1e4..0000000000
--- a/acconfig.h.in
+++ /dev/null
@@ -1,219 +0,0 @@
-/* This is the default configuration file to read -*- C -*- */
-
-/* these are defined by automake */
-#undef PACKAGE
-#undef VERSION
-
-#define CONFIGURATION_FILE_PATH "php3.ini"
-#define USE_CONFIG_FILE 1
-
-/* 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
-
-/* crypt capability checks */
-#undef PHP3_STD_DES_CRYPT
-#undef PHP3_EXT_DES_CRYPT
-#undef PHP3_MD5_CRYPT
-#undef PHP3_BLOWFISH_CRYPT
-
-/* 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 */
-#define HAVE_DIRENT_H 0
-
-/* Define if you have the resolv library (-lresolv). */
-#define HAVE_LIBRESOLV 0
-
-/* Define if you have the zlib library */
-#define HAVE_ZLIB 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 "<?expression?>" 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 if you have an ndbm compatible library (-ldbm). */
-#define NDBM 0
-
-/* Define if you have the gdbm library (-lgdbm). */
-#define GDBM 0
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 0
-#define HSREGEX 0
-
-/* Define if you want Hyperwave support */
-#define HYPERWAVE 0
-
-/* Define if you have the crypt() function */
-#define HAVE_CRYPT 1
-
-/* Define if you have the Oracle database client libraries */
-#define HAVE_ORACLE 0
-
-/* Define if you have the Oracle version 8 database client libraries */
-#define HAVE_OCI8 0
-
-/* Define if you want the LDAP directory interface */
-#define HAVE_LDAP 0
-
-/* Define if you want the SNMP interface */
-#define HAVE_SNMP 0
-
-/* Define if you want the IMAP directory interface */
-#define HAVE_IMAP 0
-
-/* Define if you have libdl (used for dynamic linking) */
-#define HAVE_LIBDL 0
-
-/* Define if you have libdnet_stub (used for Sybase support) */
-#define HAVE_LIBDNET_STUB 0
-
-/* Define if you have and want to use libcrypt */
-#define HAVE_LIBCRYPT 0
-
-/* Define if you have and want to use libnsl */
-#define HAVE_LIBNSL 0
-
-/* Define if you have and want to use libsocket */
-#define HAVE_LIBSOCKET 0
-
-/* 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
-
-#define HAVE_SYBASE 0
-#define HAVE_SYBASE_CT 0
-
-#ifndef HAVE_MYSQL
-#define HAVE_MYSQL 0
-#endif
-
-#ifndef HAVE_MSQL
-#define HAVE_MSQL 0
-#endif
-
-#ifndef HAVE_PGSQL
-#define HAVE_PGSQL 0
-#endif
-
-#ifndef HAVE_IFX
-#define HAVE_IFX 0
-#endif
-#ifndef HAVE_IFX_IUS
-#define HAVE_IFX_IUS 0
-#endif
-#ifndef IFX_VERSION
-#define IFX_VERSION 0
-#endif
-
-#ifndef HAVE_IBASE
-#define HAVE_IBASE 0
-#endif
-
-#ifndef HAVE_PQCMDTUPLES
-#define HAVE_PQCMDTUPLES 0
-#endif
-
-#define MSQL1 0
-#define HAVE_FILEPRO 0
-
-#ifndef DEBUG /* should be set to ZEND_DEBUG */
-#define DEBUG 0
-#endif
-
-/* Define if your system has the gettimeofday() call */
-#define HAVE_GETTIMEOFDAY 0
-
-/* Define if your system has the putenv() library call */
-#define HAVE_PUTENV 0
-
-/* Define if you want to enable PHP RPC (experimental) */
-#define PHP_RPC 0
-
-/* Define if you want to enable bc style precision math support */
-#define WITH_BCMATH 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 to enable memory limit support */
-#define MEMORY_LIMIT 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 want System V semaphore support.
- */
-#define HAVE_SYSVSEM 0
-
-/* Define if you have union semun.
- */
-#define HAVE_SEMUN 0
-
-/* Define if you want System V shared memory support.
- */
-#define HAVE_SYSVSHM 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 if you have the expat (XML Parser Toolkit) library */
-#define HAVE_LIBEXPAT 0
-
-/* Define if you have the pdflib library */
-#define HAVE_PDFLIB 0
-
-/* Define if you have the fdftk library */
-#define HAVE_FDFLIB 0
-
-/* Define to compile with mod_dav support */
-#define HAVE_MOD_DAV 0
diff --git a/acinclude.m4 b/acinclude.m4
deleted file mode 100644
index 84b3151b87..0000000000
--- a/acinclude.m4
+++ /dev/null
@@ -1,386 +0,0 @@
-dnl $Id$
-dnl
-dnl This file contains local autoconf functions.
-
-AC_DEFUN(AC_ORACLE_VERSION,[
- AC_MSG_CHECKING([Oracle version])
- if test -f "$ORACLEINST_TOP/orainst/unix.rgs"
- then
- ORACLE_VERSION=`grep '"ocommon"' $ORACLEINST_TOP/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
- test -z "$ORACLE_VERSION" && ORACLE_VERSION=7.3
- else
- ORACLE_VERSION=8.0
- fi
- AC_MSG_RESULT($ORACLE_VERSION)
-])
-
-dnl
-dnl Test mSQL version by checking if msql.h has "IDX_TYPE" defined.
-dnl
-AC_DEFUN(AC_MSQL_VERSION,[
- AC_MSG_CHECKING([mSQL version])
- ac_php_oldcflags=$CFLAGS
- CFLAGS="$MSQL_INCLUDE $CFLAGS";
- AC_TRY_COMPILE([#include <sys/types.h>
-#include "msql.h"],[int i = IDX_TYPE],[
- AC_DEFINE(MSQL1,0)
- MSQL_VERSION="2.0 or newer"
- ],[
- AC_DEFINE(MSQL1,1)
- MSQL_VERSION="1.0"
- ])
- CFLAGS=$ac_php_oldcflags
- AC_MSG_RESULT($MSQL_VERSION)
-])
-
-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 <stdio.h>],[int (*func)() = fclose],[
- AC_DEFINE(MISSING_FCLOSE_DECL,0)
- AC_MSG_RESULT(ok)
- ],[
- AC_DEFINE(MISSING_FCLOSE_DECL,1)
- AC_MSG_RESULT(missing)
- ])
-])
-
-# 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)
-])
-
-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 Check for crypt() capabilities
-dnl
-AC_DEFUN(AC_CRYPT_CAP,[
-
- AC_MSG_CHECKING([for standard DES crypt])
- AC_TRY_RUN([
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","rl"),"rl.3StKT.4T8M"));
-#else
- exit(0);
-#endif
-}],[
- AC_DEFINE(PHP3_STD_DES_CRYPT,1)
- AC_MSG_RESULT(yes)
- ],[
- AC_DEFINE(PHP3_STD_DES_CRYPT,0)
- AC_MSG_RESULT(no)
- ],[
- AC_DEFINE(PHP3_STD_DES_CRYPT,1)
- AC_MSG_RESULT(cannot check, guessing yes)
- ])
-
- AC_MSG_CHECKING([for extended DES crypt])
- AC_TRY_RUN([
-main() {
-#if HAVE_CRYPT
- exit (strcmp((char *)crypt("rasmuslerdorf","_J9..rasm"),"_J9..rasmBYk8r9AiWNc"));
-#else
- exit(0);
-#endif
-}],[
- AC_DEFINE(PHP3_EXT_DES_CRYPT,1)
- AC_MSG_RESULT(yes)
- ],[
- AC_DEFINE(PHP3_EXT_DES_CRYPT,0)
- AC_MSG_RESULT(no)
- ],[
- AC_DEFINE(PHP3_EXT_DES_CRYPT,0)
- AC_MSG_RESULT(cannot check, guessing no)
- ])
-
- AC_MSG_CHECKING([for MD5 crypt])
- AC_TRY_RUN([
-main() {
-#if HAVE_CRYPT
- char salt[15], answer[40];
-
- salt[0]='$'; salt[1]='1'; salt[2]='$';
- salt[3]='r'; salt[4]='a'; salt[5]='s';
- salt[6]='m'; salt[7]='u'; salt[8]='s';
- salt[9]='l'; salt[10]='e'; salt[11]='$';
- salt[12]='\0';
- strcpy(answer,salt);
- strcat(answer,"rISCgZzpwk3UhDidwXvin0");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- AC_DEFINE(PHP3_MD5_CRYPT,1)
- AC_MSG_RESULT(yes)
- ],[
- AC_DEFINE(PHP3_MD5_CRYPT,0)
- AC_MSG_RESULT(no)
- ],[
- AC_DEFINE(PHP3_MD5_CRYPT,0)
- AC_MSG_RESULT(cannot check, guessing no)
- ])
-
- AC_MSG_CHECKING([for Blowfish crypt])
- AC_TRY_RUN([
-main() {
-#if HAVE_CRYPT
- char salt[25], answer[70];
-
- salt[0]='$'; salt[1]='2'; salt[2]='a'; salt[3]='$'; salt[4]='0'; salt[5]='7'; salt[6]='$'; salt[7]='\0';
- strcat(salt,"rasmuslerd");
- strcpy(answer,salt);
- strcpy(&answer[16],"O............gl95GkTKn53Of.H4YchXl5PwvvW.5ri");
- exit (strcmp((char *)crypt("rasmuslerdorf",salt),answer));
-#else
- exit(0);
-#endif
-}],[
- AC_DEFINE(PHP3_BLOWFISH_CRYPT,1)
- AC_MSG_RESULT(yes)
- ],[
- AC_DEFINE(PHP3_BLOWFISH_CRYPT,0)
- AC_MSG_RESULT(no)
- ],[
- AC_DEFINE(PHP3_BLOWFISH_CRYPT,0)
- AC_MSG_RESULT(cannot check, guessing no)
- ])
-])
-
-## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
-## Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-##
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-##
-## As a special exception to the GNU General Public License, if you
-## distribute this file as part of a program that contains a
-## configuration script generated by Autoconf, you may include it under
-## the same distribution terms that you use for the rest of that program.
-
-# serial 9 AM_PROG_LIBTOOL
-AC_DEFUN(AM_PROG_LIBTOOL,
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_RANLIB])
-AC_REQUIRE([AM_PROG_LD])
-AC_REQUIRE([AC_PROG_LN_S])
-
-# Always use our own libtool.
-LIBTOOL='$(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)
-
-dnl Allow the --disable-shared flag to stop us from building shared libs.
-AC_ARG_ENABLE(shared,
-[ --enable-shared build shared libraries [default=yes]],
-test "$enableval" = no && libtool_shared=" --disable-shared",
-libtool_shared=)
-
-dnl Allow the --disable-static flag to stop us from building static libs.
-AC_ARG_ENABLE(static,
-[ --enable-static build static libraries [default=yes]],
-test "$enableval" = no && libtool_static=" --disable-static",
-libtool_static=)
-
-libtool_flags="$libtool_shared$libtool_static"
-test "$silent" = yes && libtool_flags="$libtool_flags --silent"
-test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
-test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-[case "$host" in
-*-*-irix6*)
- for f in '-32' '-64' '-cckr' '-n32' '-mips1' '-mips2' '-mips3' '-mips4'; do
- if echo " $CC $CFLAGS " | egrep -e "[ ]$f[ ]" > /dev/null; then
- LD="${LD-ld} $f"
- fi
- done
- ;;
-
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- CFLAGS="$CFLAGS -belf"
- ;;
-esac]
-
-# Actually configure libtool. ac_aux_dir is where install-sh is found.
-CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-LD="$LD" RANLIB="$RANLIB" LN_S="$LN_S" \
-${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
-$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
-|| AC_MSG_ERROR([libtool configure failed])
-])
-
-# AM_PROG_LD - find the path to the GNU or non-GNU linker
-AC_DEFUN(AM_PROG_LD,
-[AC_ARG_WITH(gnu-ld,
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-if test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(ac_cv_path_LD,
-[case "$LD" in
- /*)
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
- ;;
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/ld"; then
- ac_cv_path_LD="$ac_dir/ld"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
- test "$with_gnu_ld" = yes && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- ;;
-esac])
-LD="$ac_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_SUBST(LD)
-AM_PROG_LD_GNU
-])
-
-AC_DEFUN(AM_PROG_LD_GNU,
-[AC_CACHE_CHECK([whether we are using GNU ld], ac_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
- ac_cv_prog_gnu_ld=yes
-else
- ac_cv_prog_gnu_ld=no
-fi])
-])
-
-# the following 'borrwed' from automake until we switch over
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
-
-# serial 1
-
-AC_DEFUN(AM_MAINTAINER_MODE,
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT($USE_MAINTAINER_MODE)
- if test $USE_MAINTAINER_MODE = yes; then
- MAINT=
- else
- MAINT='#M#'
- fi
- AC_SUBST(MAINT)dnl
-]
-)
-
-# another one stolen from automake temporarily
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN(AM_SANITY_CHECK,
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$@" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl
-dnl Stuff to do when setting up a new extension.
-dnl XXX have to change the hardcoding of ".a" when we want to be able
-dnl to make dynamic libraries as well.
-dnl
-AC_DEFUN(PHP_EXTENSION,[
- EXT_SUBDIRS="$EXT_SUBDIRS $1"
- _extlib="libphpext_$1.a"
- EXT_LIBS="$EXT_LIBS $1/$_extlib"
- EXTINFO_DEPS="$EXTINFO_DEPS ../ext/$1/extinfo.c.stub"
-])
-
-AC_SUBST(EXT_SUBDIRS)
-AC_SUBST(EXT_LIBS)
-AC_SUBST(EXTINFO_DEPS)
diff --git a/apMakefile.libdir b/apMakefile.libdir
deleted file mode 100644
index 7b5254013a..0000000000
--- a/apMakefile.libdir
+++ /dev/null
@@ -1,4 +0,0 @@
-This is a place-holder which indicates to Configure that it shouldn't
-provide the default targets when building the Makefile in this directory.
-Instead it'll just prepend all the important variable definitions, and
-copy the Makefile.tmpl onto the end.
diff --git a/apMakefile.tmpl b/apMakefile.tmpl
deleted file mode 100644
index e7ba023ed0..0000000000
--- a/apMakefile.tmpl
+++ /dev/null
@@ -1,77 +0,0 @@
-##
-## Apache 1.3 Makefile template for PHP3 Module
-## [src/modules/php3/Makefile.tmpl]
-##
-
-# the parametrized target
-LIB=libphp3.$(LIBEXT)
-
-# objects for building the static library
-OBJS=mod_php3.o
-OBJS_LIB=libmodphp3.a
-
-# objects for building the shared object library
-SHLIB_OBJS=mod_php3.so-o
-SHLIB_OBJS_LIB=libmodphp3-so.a
-
-# the general targets
-all: lib
-lib: $(LIB)
-
-# build the static library by merging the object files
-libphp3.a: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
-
-# ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
-libphp3.: $(OBJS) $(OBJS_LIB)
- cp $(OBJS_LIB) $@
- ar r $@ $(OBJS)
- $(RANLIB) $@
- cp libphp3. libphp3.a
-
-# build the shared object library by linking the object files
-libphp3.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
- rm -f $@
- $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS)
-
-# 1. extension .o for shared objects cannot be used here because
-# first these files aren't still shared objects and second we
-# have to use a different name to trigger the different
-# implicit Make rule
-# 2. extension -so.o (as used elsewhere) cannot be used because
-# the suffix feature of Make really wants just .x, so we use
-# extension .so-o
-.SUFFIXES: .o .so-o
-.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $<
-.c.so-o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(SPACER) $< && mv $*.o $*.so-o
-
-# cleanup
-clean:
- -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
-
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
-# using it.
-depend:
- cp Makefile.tmpl Makefile.tmpl.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
- > Makefile.tmpl \
- && rm Makefile.new
-
-#Dependencies
-
-$(OBJS): Makefile
-
-# DO NOT REMOVE
-mod_php3.o: mod_php3.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
- $(INCDIR)/alloc.h $(INCDIR)/buff.h \
- $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
- $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
- $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php3.h
diff --git a/apidoc.txt b/apidoc.txt
deleted file mode 100644
index b24961be9a..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:
-
- void php3_foo(INTERNAL_FUNCTION_PARAMETERS) {
-
- }
-
- 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_php3.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_php3.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/bison.simple b/bison.simple
deleted file mode 100644
index 4e275822ec..0000000000
--- a/bison.simple
+++ /dev/null
@@ -1,705 +0,0 @@
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "bison.simple"
-
-/* Skeleton output parser for bison,
- Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-#ifndef alloca
-#ifdef __GNUC__
-#define alloca __builtin_alloca
-#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
-#include <alloca.h>
-#else /* not sparc */
-#if defined (MSDOS) && !defined (__TURBOC__)
-#include <malloc.h>
-#else /* not MSDOS, or __TURBOC__ */
-#if defined(_AIX)
-#include <malloc.h>
- #pragma alloca
-#else /* not MSDOS, __TURBOC__, or _AIX */
-#ifdef __hpux
-#ifdef __cplusplus
-extern "C" {
-void *alloca (unsigned int);
-};
-#else /* not __cplusplus */
-void *alloca ();
-#endif /* not __cplusplus */
-#endif /* __hpux */
-#endif /* not _AIX */
-#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc. */
-#endif /* not GNU C. */
-#endif /* alloca not defined. */
-
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* Note: there must be only one dollar sign in this file.
- It is replaced by the list of actions, each action
- as one case of the switch. */
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT return(0)
-#define YYABORT return(1)
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror.
- This remains here temporarily to ease the
- transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(token, value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { yychar = (token), yylval = (value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { yyerror ("syntax error: cannot back up"); YYERROR; } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-#ifndef YYPURE
-#define YYLEX yylex()
-#endif
-
-#ifdef YYPURE
-#ifdef YYLSP_NEEDED
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
-#else
-#define YYLEX yylex(&yylval, &yylloc)
-#endif
-#else /* not YYLSP_NEEDED */
-#ifdef YYLEX_PARAM
-#define YYLEX yylex(&yylval, YYLEX_PARAM)
-#else
-#ifdef PHP3_THREAD_SAFE /* PHP 3 Specific useage */
-#define YYLEX yylex(&yylval,php3_globals,php_gbl)
-#else
-#define YYLEX yylex(&yylval)
-#endif /* not using tls */
-#endif
-#endif /* not YYLSP_NEEDED */
-#endif
-
-/* If nonreentrant, generate the variables here */
-
-#ifndef YYPURE
-
-int yychar; /* the lookahead symbol */
-YYSTYPE yylval; /* the semantic value of the */
- /* lookahead symbol */
-
-#ifdef YYLSP_NEEDED
-YYLTYPE yylloc; /* location data for the lookahead */
- /* symbol */
-#endif
-
-int yynerrs; /* number of parse errors so far */
-#endif /* not YYPURE */
-
-#if YYDEBUG != 0
-int yydebug; /* nonzero means print parse trace */
-/* Since this is uninitialized, it does not stop multiple parsers
- from coexisting. */
-#endif
-
-/* YYINITDEPTH indicates the initial size of the parser's stacks */
-
-#ifndef YYINITDEPTH
-#define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH is the maximum size the stacks can grow to
- (effective only if the built-in stack extension method is used). */
-
-#if YYMAXDEPTH == 0
-#undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-#define YYMAXDEPTH 10000
-#endif
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-/* int yyparse (void); */
-#endif
-
-#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
-#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
-#else /* not GNU C or C++ */
-#ifndef __cplusplus
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (to, from, count)
- char *to;
- char *from;
- int count;
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#else /* __cplusplus */
-
-/* This is the most reliable way to avoid incompatibilities
- in available built-in functions on various systems. */
-static void
-__yy_memcpy (char *to, char *from, int count)
-{
- register char *f = from;
- register char *t = to;
- register int i = count;
-
- while (i-- > 0)
- *t++ = *f++;
-}
-
-#endif
-#endif
-
-#line 196 "bison.simple"
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-#ifdef __cplusplus
-#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL
-#else /* not __cplusplus */
-#define YYPARSE_PARAM_ARG YYPARSE_PARAM
-#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-#endif /* not __cplusplus */
-#else /* not YYPARSE_PARAM */
-#define YYPARSE_PARAM_ARG
-#define YYPARSE_PARAM_DECL
-#endif /* not YYPARSE_PARAM */
-
-#ifndef TLS_VARS
-#define TLS_VARS
-#endif
-#ifndef YY_TLS_VARS
-#define YY_TLS_VARS
-#endif
-
-int
-yyparse(YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- register int yystate;
- register int yyn;
- register short *yyssp;
- register YYSTYPE *yyvsp;
- int yyerrstatus; /* number of tokens to shift before error messages enabled */
- int yychar1 = 0; /* lookahead token as an internal (translated) token number */
-
- short yyssa[YYINITDEPTH]; /* the state stack */
- YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
-
- short *yyss = yyssa; /* refer to the stacks thru separate pointers */
- YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
-
-#ifdef YYLSP_NEEDED
- YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-
-#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-#define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- int yystacksize = YYINITDEPTH;
-
-#ifdef YYPURE
- int yychar;
- YYSTYPE yylval;
- int yynerrs;
-#ifdef YYLSP_NEEDED
- YYLTYPE yylloc;
-#endif
-#endif
-
- YYSTYPE yyval; /* the variable used to return */
- /* semantic values from the action */
- /* routines */
-
- int yylen;
- YY_TLS_VARS;
- TLS_VARS;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Starting parse\n");
-#endif
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss - 1;
- yyvsp = yyvs;
-#ifdef YYLSP_NEEDED
- yylsp = yyls;
-#endif
-
-/* Push a new state, which is found in yystate . */
-/* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks. */
-yynewstate:
-
- *++yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Give user a chance to reallocate the stack */
- /* Use copies of these so that the &'s don't force the real ones into memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-#ifdef YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
-#endif
-
- /* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- /* Each stack pointer address is followed by the size of
- the data in use in that stack, in bytes. */
-#ifdef YYLSP_NEEDED
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yyls1, size * sizeof (*yylsp),
- &yystacksize);
-#else
- yyoverflow("parser stack overflow",
- &yyss1, size * sizeof (*yyssp),
- &yyvs1, size * sizeof (*yyvsp),
- &yystacksize);
-#endif
-
- yyss = yyss1; yyvs = yyvs1;
-#ifdef YYLSP_NEEDED
- yyls = yyls1;
-#endif
-#else /* no yyoverflow */
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- {
- yyerror("parser stack overflow");
- return 2;
- }
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
- yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
- yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
-#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
-#endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + size - 1;
- yyvsp = yyvs + size - 1;
-#ifdef YYLSP_NEEDED
- yylsp = yyls + size - 1;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Stack size increased to %d\n", yystacksize);
-#endif
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Entering state %d\n", yystate);
-#endif
-
- goto yybackup;
- yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Reading a token: ");
-#endif
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Now at end of input.\n");
-#endif
- }
- else
- {
- yychar1 = YYTRANSLATE(yychar);
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise meaning
- of a token, for further debugging info. */
-#ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-#endif
- fprintf (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
-#endif
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* count tokens shifted since error; after three, turn off error status. */
- if (yyerrstatus) yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-/* Do the default action for the current state. */
-yydefault:
-
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
-
-/* Do a reduction. yyn is the number of a rule to reduce with. */
-yyreduce:
- yylen = yyr2[yyn];
- if (yylen > 0)
- yyval = yyvsp[1-yylen]; /* implement default value of the action */
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- int i;
-
- fprintf (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
- fprintf (stderr, "%s ", yytname[yyrhs[i]]);
- fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
-$ /* the action file gets copied in in place of this dollarsign */
-#line 498 "bison.simple"
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#ifdef YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-
-#ifdef YYLSP_NEEDED
- yylsp++;
- if (yylen == 0)
- {
- yylsp->first_line = yylloc.first_line;
- yylsp->first_column = yylloc.first_column;
- yylsp->last_line = (yylsp-1)->last_line;
- yylsp->last_column = (yylsp-1)->last_column;
- yylsp->text = 0;
- }
- else
- {
- yylsp->last_line = (yylsp+yylen-1)->last_line;
- yylsp->last_column = (yylsp+yylen-1)->last_column;
- }
-#endif
-
- /* Now "shift" the result of the reduction.
- Determine what state that goes to,
- based on the state we popped back to
- and the rule number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-yyerrlab: /* here on detecting error */
-
- if (! yyerrstatus)
- /* If not already recovering from an error, report this error. */
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- int size = 0;
- char *msg;
- int x, count;
-
- count = 0;
- /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- size += strlen(yytname[x]) + 15, count++;
- msg = (char *) malloc(size + 15);
- if (msg != 0)
- {
- strcpy(msg, "parse error");
-
- if (count < 5)
- {
- count = 0;
- for (x = (yyn < 0 ? -yyn : 0);
- x < (sizeof(yytname) / sizeof(char *)); x++)
- if (yycheck[x + yyn] == x)
- {
- strcat(msg, count == 0 ? ", expecting `" : " or `");
- strcat(msg, yytname[x]);
- strcat(msg, "'");
- count++;
- }
- }
- yyerror(msg);
- free(msg);
- }
- else
- yyerror ("parse error; also virtual memory exceeded");
- }
- else
-#endif /* YYERROR_VERBOSE */
- yyerror("parse error");
- }
-
- goto yyerrlab1;
-yyerrlab1: /* here on error raised explicitly by an action */
-
- if (yyerrstatus == 3)
- {
- /* if just tried and failed to reuse lookahead token after an error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
-#endif
-
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token
- after shifting the error token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-yyerrdefault: /* current state does not do anything special for the error token. */
-
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
- yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
- if (yyn) goto yydefault;
-#endif
-
-yyerrpop: /* pop the current state because it cannot handle the error token */
-
- if (yyssp == yyss) YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#ifdef YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG != 0
- if (yydebug)
- {
- short *ssp1 = yyss - 1;
- fprintf (stderr, "Error: state stack now");
- while (ssp1 != yyssp)
- fprintf (stderr, " %d", *++ssp1);
- fprintf (stderr, "\n");
- }
-#endif
-
-yyerrhandle:
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
-#if YYDEBUG != 0
- if (yydebug)
- fprintf(stderr, "Shifting error token, ");
-#endif
-
- *++yyvsp = yylval;
-#ifdef YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-}
diff --git a/build-defs.h.in b/build-defs.h.in
deleted file mode 100644
index 4bb83300a9..0000000000
--- a/build-defs.h.in
+++ /dev/null
@@ -1,92 +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 <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-#define PHP_ADA_INCLUDE "@ADA_INCLUDE@"
-#define PHP_ADA_LFLAGS "@ADA_LFLAGS@"
-#define PHP_ADA_LIBS "@ADA_LIBS@"
-#define PHP_APACHE_INCLUDE "@APACHE_INCLUDE@"
-#define PHP_APACHE_TARGET "@APACHE_TARGET@"
-#define PHP_FHTTPD_INCLUDE "@FHTTPD_INCLUDE@"
-#define PHP_FHTTPD_LIB "@FHTTPD_LIB@"
-#define PHP_FHTTPD_TARGET "@FHTTPD_TARGET@"
-#define PHP_BINNAME "@BINNAME@"
-#define PHP_CFLAGS "@CFLAGS@"
-#define PHP_DBASE_LIB "@DBASE_LIB@"
-#define PHP_DEBUG "@PHP_DEBUG@"
-#define PHP_GDBM_INCLUDE "@GDBM_INCLUDE@"
-#define PHP_HSREGEX "@HSREGEX@"
-#define PHP_IBASE_INCLUDE "@IBASE_INCLUDE@"
-#define PHP_IBASE_LFLAGS "@IBASE_LFLAGS@"
-#define PHP_IBASE_LIBS "@IBASE_LIBS@"
-#define PHP_IFX_INCLUDE "@IFX_INCLUDE@"
-#define PHP_IFX_LFLAGS "@IFX_LFLAGS@"
-#define PHP_IFX_LIBS "@IFX_LIBS@"
-#define PHP_INSTALL_IT "@INSTALL_IT@"
-#define PHP_IODBC_INCLUDE "@IODBC_INCLUDE@"
-#define PHP_IODBC_LFLAGS "@IODBC_LFLAGS@"
-#define PHP_IODBC_LIBS "@IODBC_LIBS@"
-#define PHP_MSQL_INCLUDE "@MSQL_INCLUDE@"
-#define PHP_MSQL_LFLAGS "@MSQL_LFLAGS@"
-#define PHP_MSQL_LIBS "@MSQL_LIBS@"
-#define PHP_MYSQL_INCLUDE "@MYSQL_INCLUDE@"
-#define PHP_MYSQL_LFLAGS "@MYSQL_LFLAGS@"
-#define PHP_MYSQL_LIBS "@MYSQL_LIBS@"
-#define PHP_ORACLE_HOME "@ORACLE_HOME@"
-#define PHP_ORACLE_INCLUDE "@ORACLE_INCLUDE@"
-#define PHP_ORACLE_LFLAGS "@ORACLE_LFLAGS@"
-#define PHP_ORACLE_LIBS "@ORACLE_LIBS@"
-#define PHP_ORACLE_SHLIBS "@ORACLE_SHLIBS@"
-#define PHP_ORACLE_STLIBS "@ORACLE_STLIBS@"
-#define PHP_ORACLE_VERSION "@ORACLE_VERSION@"
-#define PHP_PGSQL_INCLUDE "@PGSQL_INCLUDE@"
-#define PHP_PGSQL_LFLAGS "@PGSQL_LFLAGS@"
-#define PHP_PGSQL_LIBS "@PGSQL_LIBS@"
-#define PHP_PROG_SENDMAIL "@PROG_SENDMAIL@"
-#define PHP_REGEX_LIB "@REGEX_LIB@"
-#define PHP_SOLID_INCLUDE "@SOLID_INCLUDE@"
-#define PHP_SOLID_LIBS "@SOLID_LIBS@"
-#define PHP_EMPRESS_INCLUDE "@EMPRESS_INCLUDE@"
-#define PHP_EMPRESS_LIBS "@EMPRESS_LIBS@"
-#define PHP_SYBASE_INCLUDE "@SYBASE_INCLUDE@"
-#define PHP_SYBASE_LFLAGS "@SYBASE_LFLAGS@"
-#define PHP_SYBASE_LIBS "@SYBASE_LIBS@"
-#define PHP_DBM_TYPE "@DBM_TYPE@"
-#define PHP_DBM_LIB "@DBM_LIB@"
-#define PHP_LDAP_LFLAGS "@LDAP_LFLAGS@"
-#define PHP_LDAP_INCLUDE "@LDAP_INCLUDE@"
-#define PHP_LDAP_LIBS "@LDAP_LIBS@"
-#define PHP_VELOCIS_INCLUDE "@VELOCIS_INCLUDE@"
-#define PHP_VELOCIS_LIBS "@VELOCIS_LIBS@"
-
-#define ODBC_TYPE "@ODBC_TYPE@"
-#define ODBC_INCDIR "@ODBC_INCDIR@"
-#define ODBC_INCLUDE "@ODBC_INCLUDE@"
-#define ODBC_LIBDIR "@ODBC_LIBDIR@"
-#define ODBC_LFLAGS "@ODBC_LFLAGS@"
-#define ODBC_LIBS "@ODBC_LIBS@"
diff --git a/buildconf b/buildconf
deleted file mode 100755
index 297e2c9aca..0000000000
--- a/buildconf
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-./scripts/preconfig
-
-if test -f mkinstalldirs; then
- automake
-else
- automake --add-missing
-fi
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo keeping aclocal.m4
- mv aclocal.m4.old aclocal.m4
-else
- echo created or modified aclocal.m4
-fi
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo keeping configure
- mv configure.old configure
-else
- echo created or modified configure
-fi
-
-cd libzend; ./buildconf
-
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 b3dffc8bf9..0000000000
--- a/config.guess
+++ /dev/null
@@ -1,743 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 96, 1997 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 <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-#
-# 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).
-#
-
-# 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
-
-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:*:*)
- # 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.
- echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//'`
- 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 ;;
- 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;;
- SR2?01:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:*|MIS*: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 ;;
- 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 ;;
- 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 ;;
- 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 ;;
- 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:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >dummy.c
- int main (argc, argv) int argc; char **argv; {
- #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-cc} 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 <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- ${CC-cc} 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)
- if /usr/sbin/lsattr -EHl proc0 | 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/[3478]??:HP-UX:*:*)
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/7?? | 9000/8?[1679] ) HP_ARCH=hppa1.1 ;;
- 9000/8?? ) HP_ARCH=hppa1.0 ;;
- 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 <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- ${CC-cc} 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 ;;
- 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 ;;
- 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-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | 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:*:* | *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- 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 i386-pc-cygwin32
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin32
- 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:*:*)
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- if echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf_i.86"; then
- echo "${UNAME_MACHINE}-pc-linux-gnu" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86linux"; then
- echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: i.86coff"; then
- echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68kelf"; then
- echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: m68klinux"; then
- echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0
- elif echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations: elf32ppc"; then
- echo "powerpc-unknown-linux-gnu" ; exit 0
- elif test "${UNAME_MACHINE}" = "alpha" ; then
- echo alpha-unknown-linux-gnu ; exit 0
- elif test "${UNAME_MACHINE}" = "sparc" ; then
- echo sparc-unknown-linux-gnu ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >dummy.c <<EOF
-main(argc, argv)
-int argc;
-char *argv[];
-{
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} dummy.c -o dummy 2>/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.
- test ! -d /usr/lib/ldscripts/. \
- && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
- # Determine whether the default compiler is a.out or elf
- cat >dummy.c <<EOF
-main(argc, argv)
-int argc;
-char *argv[];
-{
-#ifdef __ELF__
- printf ("%s-pc-linux-gnu\n", argv[1]);
-#else
- printf ("%s-pc-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-cc} 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:*: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:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
- (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- 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.*:*)
- 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*: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 ;;
- BS2000:POSIX-BC:*:*) # EBCDIC based mainframe with POSIX subsystem
- echo bs2000-siemens-sysv4
- exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- printf ("%s-next-nextstep%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-cc} 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 0131946b93..0000000000
--- a/config.sub
+++ /dev/null
@@ -1,939 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92, 93, 94, 95, 1996 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
- ;;
- -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/'`
- ;;
- -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 | arm \
- | arme[lb] | pyramid | mn10300 \
- | tron | a29k | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 \
- | alpha | we32k | ns16k | clipper | i370 | sh \
- | powerpc | powerpcle | 1750a | dsp16xx | mips64 | mipsel \
- | pdp11 | mips64el | mips64orion | mips64orionel \
- | sparc | sparclet | sparclite | sparc64)
- basic_machine=$basic_machine-unknown
- ;;
- # 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[3456]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[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* | power-* \
- | none-* | 580-* | cray2-* | h8300-* | i960-* | xmp-* | ymp-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | alpha-* | we32k-* | cydra-* | ns16k-* \
- | pn-* | np1-* | xps100-* | clipper-* | orion-* | sparclite-* \
- | pdp11-* | sh-* | powerpc-* | powerpcle-* | sparc64-* | mips64-* | mipsel-* \
- | mips64el-* | mips64orion-* | mips64orionel-* | f301-*)
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- 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
- ;;
- amigados)
- basic_machine=m68k-cbm
- os=-amigados
- ;;
- amigaunix | amix)
- basic_machine=m68k-cbm
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- 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
- ;;
- 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
- ;;
- 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
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- os=-mvs
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[3456]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i[3456]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i[3456]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i[3456]86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- 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
- ;;
- mipsel*-linux*)
- basic_machine=mipsel-unknown
- os=-linux
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- 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
- ;;
- 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
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- 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)
- basic_machine=i586-intel
- ;;
- pentiumpro | p6)
- basic_machine=i686-intel
- ;;
- pentium-* | p5-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- k5)
- # We don't have specific support for AMD's K5 yet, so just call it a Pentium
- basic_machine=i586-amd
- ;;
- nexen)
- # We don't have specific support for Nexgen yet, so just call it a Pentium
- basic_machine=i586-nexgen
- ;;
- 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
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- 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
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- 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
- ;;
- xmp)
- basic_machine=xmp-cray
- os=-unicos
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- 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.
- mips)
- if [ x$os = x-linux ]; 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)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- *)
- 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
- ;;
- -unixware* | svr4*)
- os=-sysv4
- ;;
- -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* \
- | -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* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -linux-gnu* | -uxpv*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -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
- ;;
- -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*)
- ;;
- -xenix)
- os=-xenix
- ;;
- -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*-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
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-ibm)
- os=-aix
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigados
- ;;
- *-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
- ;;
- *)
- 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
- ;;
- -hpux*)
- 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
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
diff --git a/configure.in.in b/configure.in.in
deleted file mode 100644
index 40c409180c..0000000000
--- a/configure.in.in
+++ /dev/null
@@ -1,1681 +0,0 @@
-dnl $Id$ -*- sh -*-
-dnl Process this file with autoconf to produce a configure script.
-
-
-
-divert(0)
-AC_INIT(main.c)
-recurse=yes
-for arg in $@; do
- case $arg in
- ## This is to prevent "./config.status --recheck" from
- ## running configure in libzend again.
- --no-recursion) recurse=no;;
- *) ;;
- esac
-done
-
-if test "$recurse" = "yes"; then
- (cwd=`pwd`; set -x; cd $srcdir/libzend; ./configure --cache-file=$cwd/config.cache $@)
-fi
-
-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 php3.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.0pa1)
-
-
-
-PHP_VERSION=$VERSION
-echo "#define PHP_VERSION \"$PHP_VERSION\"" > php_version.h.new
-if ! cmp php_version.h.new php_version.h >/dev/null; 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
-AC_SUBST(PHP_VERSION)
-
-AM_CONFIG_HEADER(config.h)
-AM_MAINTAINER_MODE
-
-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 PHP parsers.)
-else
- AC_MSG_CHECKING(bison version)
- set `$YACC --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 PHP 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
-
-AC_PROG_RANLIB
-AC_PROG_CC_C_O
-AC_PATH_PROG(PERL_PATH, perl)
-
-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"
- apxs_runpath_switch="-Wl,-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,"
- apxs_runpath_switch="-Wl,-rpath "
- else
- dnl something innocuous
- ld_runpath_switch="-L"
- apxs_runpath_switch="-L"
- fi
-fi
-
-
-dnl Check compiler support for -rdynamic
-AC_MSG_CHECKING(if compiler supports -rdynamic)
-AC_CACHE_VAL(php_cc_rdynamic,[
- SAVE_LIBS="${LIBS}"
- LIBS="-rdynamic ${LIBS}"
- AC_TRY_LINK([], [], php_cc_rdynamic=yes, php_cc_rdynamic=no)
- LIBS="${SAVE_LIBS}"])
-AC_MSG_RESULT($php_cc_rdynamic)
-if test $php_cc_rdynamic = "yes"; then
- LDFLAGS="${LDFLAGS} -rdynamic"
- RDYNAMIC_LFLAGS="-rdynamic"
-else
- RDYNAMIC_LFLAGS=""
-fi
-AC_SUBST(RDYNAMIC_LFLAGS)
-
-
-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=""
-AC_SUBST(INCLUDES)
-
-AC_PREFERRED_DB_LIB
-
-AC_CHECK_LIB(nsl, gethostname, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], [])
-
-AC_CHECK_LIB(c, socket, [:], [
- AC_CHECK_LIB(socket, socket, [
- LIBS="-lsocket $LIBS"
- AC_DEFINE(HAVE_LIBSOCKET) ], []) ])
-
-AC_CHECK_LIB(c, gethostbyaddr, [:], [
- AC_CHECK_LIB(nsl, gethostbyaddr, [
- LIBS="-lnsl $LIBS"
- AC_DEFINE(HAVE_LIBNSL) ], []) ])
-
-AC_CHECK_LIB(c, crypt, [:], [
- AC_CHECK_LIB(crypt, crypt, [
- LIBS="-lcrypt $LIBS"
- AC_DEFINE(HAVE_LIBCRYPT) ], []) ])
-
-AC_CHECK_LIB(c, dlopen, [
- # fake it
- AC_DEFINE(HAVE_LIBDL) ], [
- AC_CHECK_LIB(dl, dlopen, [
- LIBS="-ldl $LIBS"
- AC_DEFINE(HAVE_LIBDL) ], []) ])
-
-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(c, sin, [:], [
- AC_CHECK_LIB(m, sin) ])
-
-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)
- 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)
- ])
-])
-
-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(fcntl.h unistd.h crypt.h sys/file.h memory.h pwd.h grp.h sys/socket.h sys/wait.h syslog.h string.h sys/varargs.h stdarg.h sys/time.h signal.h netinet/in.h dlfcn.h limits.h sys/types.h unix.h)
-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
- ])
- ])
- ])
- ])
- INCLUDES="$INCLUDES $GDBM_INCLUDES"
-dnl## AC_SUBST(GDBM_INCLUDE)
-fi
-
-dnl Checks for typedefs, structures, and compiler characteristics.
-AC_STRUCT_TM
-AC_STRUCT_TIMEZONE
-
-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(memcpy memmove strdup strerror strcasecmp strstr flock lockf putenv tempnam usleep setlocale gettimeofday setvbuf srand48 lrand48 srandom random link symlink regcomp getlogin cuserid vsnprintf snprintf gcvt utime crypt rint unsetenv strftime setsockopt tzset)
-AC_FUNC_UTIME_NULL
-AC_FUNC_ALLOCA
-dnl## OLDLIBS=$LIBS; LIBS=""
-AC_BROKEN_SPRINTF
-dnl## LIBS=$OLDLIBS
-AC_REPLACE_FUNCS(getopt)
-
-dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
-dnl AC_MSG_CHECKING(for in_addr_t)
-AC_CACHE_VAL(ac_cv_type_$1,
-[AC_EGREP_CPP(dnl
-changequote(<<,>>)dnl
-<<in_addr_t[^a-zA-Z_0-9]>>dnl
-changequote([,]), [#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif], ac_cv_type_in_addr_t=yes, ac_cv_type_in_addr_t=no)])dnl
-
-dnl AC_MSG_RESULT($ac_cv_type_in_addr_t)
-if test $ac_cv_type_in_addr_t = no; then
- AC_DEFINE(in_addr_t, u_int)
-fi
-
-AC_CRYPT_CAP
-
-divert(2)
-
-AC_MSG_CHECKING(whether to use bundled regex library)
-AC_ARG_WITH(system-regex,
-[ --with-system-regex Do not use the bundled regex library],
-[
- REGEX_LIB=
- HSREGEX=no
- AC_MSG_RESULT(no)
- AC_DEFINE(REGEX,0)
-],[
- REGEX_LIB=regex/libregex.a
- HSREGEX=yes
- AC_MSG_RESULT(yes)
- AC_DEFINE(HSREGEX)
- AC_DEFINE(REGEX,1)
-])
-AC_SUBST(REGEX_LIB)
-AC_SUBST(HSREGEX)
-
-AC_MSG_CHECKING(for Apache module support via DSO through APXS)
-AC_ARG_WITH(apxs,
-[ --with-apxs[=FILE] Build shared Apache module. FILE is the optional
- pathname to the Apache apxs tool; defaults to "apxs".
- (This option needs Perl installed)],
-[
- if test "$withval" = "yes"; then
- withval=apxs
- fi
- APXS="$withval"
- APXS_LDFLAGS="@ORACLE_LFLAGS@ @ORACLE_LIBS@ @IODBC_LFLAGS@ @IODBC_LIBS@ @SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@ @MYSQL_LFLAGS@ @MYSQL_LIBS@ @MSQL_LFLAGS@ @MSQL_LIBS@ @ADA_LFLAGS@ @ADA_LIBS@ @SOLID_LIBS@ @EMPRESS_LIBS@ @OPENLINK_LIBS@ @PGSQL_LFLAGS@ @PGSQL_LIBS@ @LDAP_LFLAGS@ @LDAP_LIBS@ @VELOCIS_LIBS@ @CODBC_LFLAGS@ @CODBC_LIBS@ @ZLIB_LIBS@ @PDFLIB_LIBS@ @FDFTK_LIBS@ @IFX_LFLAGS@ @IFX_LIBS@ @IBASE_LFLAGS@ @IBASE_LIBS@"
- APACHE_INCLUDE="-I`$APXS -q INCLUDEDIR`"
- BINNAME=libphp3.so
- INSTALL_IT="\$(APXS) -i -a -n php3 $BINNAME"
- CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2`
- LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2`
- LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2`
- PHP_LIBS=
- STRONGHOLD=
- AC_DEFINE(APACHE)
- AC_SUBST(APXS)
- AC_SUBST(APXS_LDFLAGS)
- AC_SUBST(BINNAME)
- AC_SUBST(INSTALL_IT)
- AC_SUBST(PHP_LIBS)
- AC_DEFINE(HAVE_AP_CONFIG_H)
- AC_DEFINE(HAVE_AP_COMPAT_H)
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-
-
-APACHE_INSTALL_FILES="$srcdir/mod_php3.* $srcdir/php_version.h libphp3.module"
-
-
-AC_MSG_CHECKING(for Apache module support via DSO through APACI)
-AC_ARG_WITH(shared-apache,
-[ --with-shared-apache[=DIR] Build shared Apache module. DIR is the top-level
- Apache build directory, defaults to /usr/local/etc/httpd.
- (This option needs Perl installed)],
-[
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/etc/httpd
- fi
- if test "$withval" != "no"; then
- if test -f $withval/src/include/httpd.h; then
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php3
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- CFLAGS_SHLIB=`perl -V:cccdlflags | cut -d\' -f2`
- LDFLAGS_SHLIB=`perl -V:lddlflags | cut -d\' -f2`
- LDFLAGS_SHLIB_EXPORT=`perl -V:ccdlflags | cut -d\' -f2`
- PHP_LIBS=
- BINNAME=libmodphp3-so.a
- INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_DEFINE(APACHE)
- AC_MSG_RESULT(yes - Shared Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval/src/include)
- fi
- fi
- INCLUDES="$INCLUDES $APACHE_INCLUDE"
- AC_SUBST(APACHE_INCLUDE)
- AC_SUBST(APACHE_TARGET)
- AC_SUBST(INSTALL_IT)
- AC_SUBST(BINNAME)
- AC_SUBST(PHP_LIBS)
-],[
- AC_MSG_RESULT(no)
-])
-
-
-
-if test "$BINNAME" != "libmodphp3-so.a"; then
-if test "$BINNAME" != "libphp3.so"; then
-AC_MSG_CHECKING(for Apache module support)
-AC_ARG_WITH(apache,
-[ --with-apache[=DIR] Build Apache module. DIR is the top-level Apache
- build directory, defaults to /usr/local/etc/httpd.],
-[
- if test "$withval" = "yes"; then
- # Apache's default directory
- withval=/usr/local/etc/httpd
- fi
- if test "$withval" != "no"; then
-# For Apache 1.2.x
- if test -f $withval/src/httpd.h; then
- APACHE_INCLUDE=-I$withval/src
- APACHE_TARGET=$withval/src
- BINNAME=libphp3.a
- INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
- PHP_LIBS="-L. -lphp3"
- AC_DEFINE(APACHE)
- AC_MSG_RESULT(yes - Apache 1.2.x)
- STRONGHOLD=
- if test -f $withval/src/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
-# For Apache 1.3.x
- elif test -f $withval/src/main/httpd.h; then
- APACHE_INCLUDE="-I$withval/src/main -I$withval/src/os/unix -I$withval/src/ap"
- APACHE_TARGET=$withval/src/modules/php3
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- BINNAME=libmodphp3.a
- INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- PHP_LIBS="-Lmodules/php3 -L../modules/php3 -L../../modules/php3 -lmodphp3"
- AC_DEFINE(APACHE)
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
-# Also for Apache 1.3.x
- elif test -f $withval/src/include/httpd.h; then
- APACHE_INCLUDE="-I$withval/src/include -I$withval/src/os/unix"
- APACHE_TARGET=$withval/src/modules/php3
- if test ! -d $APACHE_TARGET; then
- mkdir $APACHE_TARGET
- fi
- BINNAME=libmodphp3.a
- PHP_LIBS="-Lmodules/php3 -L../modules/php3 -L../../modules/php3 -lmodphp3"
- INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET; cp $srcdir/apMakefile.tmpl $APACHE_TARGET/Makefile.tmpl; cp $srcdir/apMakefile.libdir $APACHE_TARGET/Makefile.libdir"
- AC_DEFINE(APACHE)
- AC_MSG_RESULT(yes - Apache 1.3.x)
- STRONGHOLD=
- if test -f $withval/src/include/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/include/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/include/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
-# For StrongHold 2.2
- elif test -f $withval/apache/httpd.h; then
- APACHE_INCLUDE=-"I$withval/apache -I$withval/ssl/include"
- APACHE_TARGET=$withval/apache
- BINNAME=libmodphp3.a
- PHP_LIBS="-Lmodules/php3 -L../modules/php3 -L../../modules/php3 -lmodphp3"
- INSTALL_IT="mkdir -p $APACHE_TARGET; cp $BINNAME $APACHE_INSTALL_FILES $APACHE_TARGET"
- STRONGHOLD=-DSTRONGHOLD=1
- AC_DEFINE(APACHE)
- AC_MSG_RESULT(yes - StrongHold)
- if test -f $withval/apache/ap_config.h; then
- AC_DEFINE(HAVE_AP_CONFIG_H)
- fi
- if test -f $withval/src/ap_compat.h; then
- AC_DEFINE(HAVE_AP_COMPAT_H)
- if test ! -f $withval/src/include/ap_config_auto.h; then
- AC_MSG_ERROR(Please run Apache's configure or src/Configure program once and try again)
- fi
- else
- if test -f $withval/src/compat.h; then
- AC_DEFINE(HAVE_OLD_COMPAT_H)
- fi
- fi
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid Apache directory - unable to find httpd.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- BINNAME=php
- INSTALL_IT="cp $BINNAME \$(bindir)"
- fi
-],[
- AC_MSG_RESULT(no)
- BINNAME=php
- INSTALL_IT="cp $BINNAME \$(bindir)"
-])
-INCLUDES="$INCLUDES $APACHE_INCLUDE"
-dnl## AC_SUBST(APACHE_INCLUDE)
-AC_SUBST(APACHE_TARGET)
-AC_SUBST(INSTALL_IT)
-AC_SUBST(BINNAME)
-AC_SUBST(STRONGHOLD)
-AC_SUBST(PHP_LIBS)
-fi
-fi
-
-AC_MSG_CHECKING(for mod_charset compatibility option)
-AC_ARG_WITH(mod_charset,
-[ --with-mod_charset Enable transfer tables for mod_charset (Rus Apache).],
-[
- AC_MSG_RESULT(yes)
- AC_DEFINE(USE_TRANSFER_TABLES)
-],[
- AC_MSG_RESULT(no)
-])
-
-AC_MSG_CHECKING(for fhttpd module support)
-AC_ARG_WITH(fhttpd,
-[ --with-fhttpd[=DIR] Build fhttpd module. DIR is the fhttpd sources
- directory, defaults to /usr/local/src/fhttpd.],
-[
- if test "$withval" = "yes"; then
- # fhttpd source directory
- withval=/usr/local/src/fhttpd
- fi
- if test "$withval" != "no"; then
-# For fhttpd 0.3.x
- if test -f $withval/servproc.h; then
- FHTTPD_INCLUDE=-I$withval/
- FHTTPD_LIB=$withval/servproc.o
- FHTTPD_TARGET=$withval/
- BINNAME=php
- AC_DEFINE(FHTTPD)
- AC_MSG_RESULT(yes - fhttpd 0.3.x)
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid fhttpd directory - unable to find servproc.h under $withval)
- fi
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-INCLUDES="$INCLUDES $FHTTPD_INCLUDE"
-dnl## AC_SUBST(FHTTPD_INCLUDE)
-AC_SUBST(FHTTPD_LIB)
-AC_SUBST(FHTTPD_TARGET)
-
-
-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 php3.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,
-[ --enable-debug Compile with 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(no)
- AC_DEFINE(DEBUG,0)
- PHP_DEBUG=0
- DEBUG_CFLAGS=""
-])
-AC_SUBST(DEBUG_CFLAGS)
-AC_SUBST(PHP_DEBUG)
-
-
-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)
-])
-
-
-dnl AC_MSG_CHECKING(whether to enable PHP RPC support)
-dnl AC_ARG_ENABLE(php-rpc,
-dnl [ --enable-php-rpc Compile with PHP RPC support.],
-dnl [
-dnl if test "$enableval" = "yes"; then
-dnl AC_DEFINE(PHP_RPC, 1)
-dnl AC_MSG_RESULT(yes)
-dnl else
-dnl AC_DEFINE(PHP_RPC, 0)
-dnl AC_MSG_RESULT(no)
-dnl fi
-dnl ],[
-dnl AC_DEFINE(PHP_RPC, 0)
-dnl AC_MSG_RESULT(no)
-dnl ])
-
-AC_MSG_CHECKING(whether to enable bc style precision math functions)
-AC_ARG_ENABLE(bcmath,
-[ --disable-bcmath Compile without bc style precision math functions. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(WITH_BCMATH, 1)
- AC_MSG_RESULT(yes)
- BCMATH_SRC="functions/bcmath.c functions/number.c"
- else
- AC_DEFINE(WITH_BCMATH, 0)
- AC_MSG_RESULT(no)
- BCMATH_SRC=""
- fi
-],[
- AC_DEFINE(WITH_BCMATH, 1)
- AC_MSG_RESULT(yes)
- BCMATH_SRC="functions/bcmath.c functions/number.c"
-])
-AC_SUBST(BCMATH_SRC)
-
-if test "$BINNAME" = "php"; then
-AC_MSG_CHECKING(whether to force Apache CGI redirect)
-AC_ARG_ENABLE(force-cgi-redirect,
-[ --enable-force-cgi-redirect Enable the security check for internal server
- redirects. You should use this if you are
- running the CGI version with Apache. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(FORCE_CGI_REDIRECT, 1)
- AC_MSG_RESULT(yes)
- REDIRECT=1
- else
- AC_DEFINE(FORCE_CGI_REDIRECT, 0)
- AC_MSG_RESULT(no)
- REDIRECT=0
- fi
-],[
- AC_DEFINE(FORCE_CGI_REDIRECT, 0)
- AC_MSG_RESULT(no)
- REDIRECT=0
-])
-
-AC_MSG_CHECKING(whether to discard path_info + path_translated)
-AC_ARG_ENABLE(discard_path,
-[ --enable-discard-path If this is enabled, the PHP CGI binary
- can safely be placed outside of the
- web tree and people will not be able
- to circumvent .htaccess security. ],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(DISCARD_PATH, 1)
- AC_MSG_RESULT(yes)
- DISCARD_PATH=1
- else
- AC_DEFINE(DISCARD_PATH, 0)
- AC_MSG_RESULT(no)
- DISCARD_PATH=0
- fi
-],[
- AC_DEFINE(DISCARD_PATH, 0)
- AC_MSG_RESULT(no)
- DISCARD_PATH=0
-])
-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)
-])
-
-AC_MSG_CHECKING(whether to enable short tags by default)
-AC_ARG_ENABLE(short-tags,
-[ --disable-short-tags Disable the short-form <? start tag by default.],
-[
- if test "$enableval" = "no"; then
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 0)
- AC_MSG_RESULT(no)
- else
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
- AC_MSG_RESULT(yes)
- fi
-],[
- AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, 1)
- AC_MSG_RESULT(yes)
-])
-
-AC_MSG_CHECKING(whether to enable the URL-aware fopen wrapper)
-AC_ARG_ENABLE(url-fopen-wrapper,
-[ --disable-url-fopen-wrapper Disable the URL-aware fopen wrapper that allows
- accessing files via http or ftp.],
-[
- if test "$enableval" = "yes"; then
- AC_DEFINE(PHP3_URL_FOPEN, 1)
- AC_MSG_RESULT(yes)
- else
- AC_DEFINE(PHP3_URL_FOPEN, 0)
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(PHP3_URL_FOPEN, 1)
- AC_MSG_RESULT(yes)
-])
-
-
-divert(3)
-
-AC_SUBST(EXTRA_LIBS)
-
-# reading config stubs
-esyscmd(./scripts/config-stubs)
-
-AC_MSG_CHECKING(for IMAP support)
-AC_ARG_WITH(imap,
-[ --with-imap[=DIR] Include IMAP support (DIR is the IMAP include dir and c-client.a dir).],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- IMAP_DIR=/usr/local
- else
- IMAP_DIR=$withval
- fi
- if test ! -f $IMAP_DIR/include/mail.h; then
- AC_MSG_ERROR(could not find mail.h in $IMAP_DIR/include !)
- fi
- if test ! -f $IMAP_DIR/include/rfc822.h; then
- AC_MSG_ERROR(could not find rfc822.h in $IMAP_DIR/include !)
- fi
- if test ! -f $IMAP_DIR/include/linkage.h; then
- AC_MSG_ERROR(could not find linkage.h in $IMAP_DIR/include !)
- fi
- if test ! -f $IMAP_DIR/lib/c-client.a; then
- AC_MSG_ERROR(could not find c-client.a in $IMAP_DIR/lib !)
- fi
- IMAP_INCLUDE="-I$IMAP_DIR/include/"
- IMAP_LIBS="$IMAP_DIR/lib/c-client.a"
-
-dnl## AC_SUBST(IMAP_INCLUDE)
- INCLUDES="$INCLUDES $IMAP_INCLUDE"
- AC_SUBST(IMAP_LIBS)
- LIBS="$LIBS $IMAP_LIBS"
- AC_DEFINE(HAVE_IMAP)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_ERROR(could not find imap library!)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-
-
-AC_MSG_CHECKING(for Oracle support)
-AC_ARG_WITH(oracle,
-[ --with-oracle[=DIR] Include Oracle database support. DIR is Oracle's
- home directory, defaults to \$ORACLE_HOME.],
-[
- case "$withval" in
- yes)
- ORACLEINST_TOP=$ORACLE_HOME
- AC_MSG_RESULT(yes)
- ;;
- no)
- ORACLEINST_TOP=
- AC_MSG_RESULT(no)
- ;;
- *)
- AC_MSG_RESULT(yes)
- ORACLEINST_TOP=$withval
- ;;
- esac
-
- if test "$ORACLEINST_TOP" != ""
- then
-
- # Oracle include files
-
- if test -f "$ORACLEINST_TOP/rdbms/public/ocidfn.h"
- then
- # V8.0.5
- ORACLE_INCLUDE="$ORACLE_INCLUDE -I$ORACLEINST_TOP/rdbms/public"
- elif test -f "$ORACLEINST_TOP/rdbms/demo/ocidfn.h"
- then
- # V7.[0123]
- ORACLE_INCLUDE=-I$ORACLEINST_TOP/rdbms/demo
- fi
-
- if test -d "$ORACLEINST_TOP/network/public"
- then
- # V8
- ORACLE_INCLUDE="$ORACLE_INCLUDE -I$ORACLEINST_TOP/network/public"
- fi
-
- if test -d "$ORACLEINST_TOP/plsql/public"
- then
- # V8
- ORACLE_INCLUDE="$ORACLE_INCLUDE -I$ORACLEINST_TOP/plsql/public"
- fi
-
- # Need to know the version, otherwhise we will mixup nlsrtl
- AC_ORACLE_VERSION($ORACLEINST_TOP)
-
- # Oracle libs - nightmare :-)
-
- ORACLE_LIBDIR=lib
- ORACLE_LFLAGS="-L$ORACLEINST_TOP/$ORACLE_LIBDIR ${ld_runpath_switch}$ORACLEINST_TOP/$ORACLE_LIBDIR"
- if test -f "$ORACLEINST_TOP/rdbms/lib/sysliblist"
- then
- ORA_SYSLIB="`cat $ORACLEINST_TOP/rdbms/lib/sysliblist`"
- else
- ORA_SYSLIB="-lm"
- fi
-
- # Oracle Static libs
- case $ORACLE_VERSION in
- 7.0|7.1)
- ORACLE_STLIBS="-locic $ORACLEINST_TOP/$ORACLE_LIBDIR/osntab.o \
- -lsqlnet -lora -lsqlnet -lnlsrtl -lcv6 -lcore -lnlsrtl -lcv6 \
- -lcore $ORA_SYSLIB -lcore $ORA_SYSLIB"
- if test "`uname -s 2>/dev/null`" = "AIX"; then
- ORACLE_STLIBS="$ORACLE_STLIBS -bI:$ORACLE_HOME/lib/mili.exp"
- fi
- ;;
- 7.2)
- ORACLE_STLIBS="-locic $ORACLEINST_TOP/$ORACLE_LIBDIR/osntab.o \
- -lsqlnet -lora -lsqlnet -lora -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 \
- -lcore3 $ORA_SYSLIB -lcore3 $ORA_SYSLIB"
- ;;
- 7.3)
- ORACLE_STLIBS="-lclient -lsqlnet -lncr -lsqlnet -lclient -lcommon \
- -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric \
- -lepc -lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 \
- $ORA_SYSLIB -lcore3 $ORA_SYSLIB"
- ;;
- 8.0)
- ORACLE_STLIBS="-lclient -lsqlnet -lncr -lsqlnet -lclient -lcommon \
- -lgeneric -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric \
- -lepc -lnlsrtl3 -lc3v6 -lcore4 -lnlsrtl3 -lcore4 -lnlsrtl3 \
- $ORA_SYSLIB -lcore3 $ORA_SYSLIB"
- ;;
- *)
- ORACLE_STLIBS=
- ;;
- esac
-
- # Oracle shared libs
- case $ORACLE_VERSION in
- 7.0)
- # shared libs not supported
- ORACLE_SHLIBS="$ORACLE_STLIBS"
- ;;
- 7.1)
- if test -f $ORACLEINST_TOP/$ORACLE_LIBDIR/liboracle.s?
- then
- ORACLE_SHLIBS="-loracle $ORA_SYSLIB"
- else
- ORACLE_SHLIBS="$ORACLE_STLIBS"
- fi
- ;;
- 7.2|7.3)
- if test -f $ORACLEINST_TOP/$ORACLE_LIBDIR/libclntsh.s?
- then
- ORACLE_SHLIBS="-lclntsh $ORA_SYSLIB"
- else
- ORACLE_SHLIBS="$ORACLE_STLIBS"
- fi
- ;;
- 8.0)
- if test -f $ORACLEINST_TOP/$ORACLE_LIBDIR/libclntsh.s? -o \
- -f $ORACLEINST_TOP/$ORACLE_LIBDIR/libclntsh.a # AIX
- then
- if test "$CC" = "gcc" -a "`uname -sv`" = "AIX 4"; then
- # for Oracle 8 on AIX 4
- ORA_SYSLIB="$ORA_SYSLIB -nostdlib /lib/crt0_r.o /usr/lib/libpthreads.a /usr/lib/libc_r.a -lgcc"
- fi
- ORACLE_SHLIBS="-lclntsh -lpsa -lcore4 -lnlsrtl3 -lclntsh $ORA_SYSLIB"
- else
- ORACLE_SHLIBS="$ORACLE_STLIBS"
- fi
- AC_DEFINE(HAVE_OCI8)
- ;;
- *)
- ORACLE_SHLIBS=
- ;;
- esac
-
- # only using shared libs right now
- ORACLE_LIBS=$ORACLE_SHLIBS
-
- AC_DEFINE(HAVE_ORACLE)
-
- fi
-
-],[AC_MSG_RESULT(no)])
-AC_SUBST(ORACLE_SHLIBS)
-AC_SUBST(ORACLE_STLIBS)
-AC_SUBST(ORACLE_LIBS)
-AC_SUBST(ORACLE_LFLAGS)
-dnl## AC_SUBST(ORACLE_INCLUDE)
-INCLUDES="$INCLUDES $ORACLE_INCLUDE"
-AC_SUBST(ORACLE_HOME)
-AC_SUBST(ORACLE_VERSION)
-
-
-AC_MSG_CHECKING(for Sybase support)
-AC_ARG_WITH(sybase,
-[ --with-sybase[=DIR] Include Sybase-DB support. DIR is the Sybase home
- directory, defaults to /home/sybase.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- SYBASE_INCDIR=/home/sybase/include
- SYBASE_LIBDIR=/home/sybase/lib
- else
- SYBASE_INCDIR=$withval/include
- SYBASE_LIBDIR=$withval/lib
- fi
- SYBASE_INCLUDE=-I$SYBASE_INCDIR
- SYBASE_LFLAGS="-L$SYBASE_LIBDIR -L$SYBASE_LIBDIR"
- SYBASE_LIBS=-lsybdb
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(dnet_stub, dnet_addr,
- [ SYBASE_LIBS="$SYBASE_LIBS -ldnet_stub"
- AC_DEFINE(HAVE_LIBDNET_STUB)
- ])
- AC_DEFINE(HAVE_SYBASE)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(SYBASE_LIBS)
-AC_SUBST(SYBASE_LFLAGS)
-dnl## AC_SUBST(SYBASE_INCLUDE)
-INCLUDES="$INCLUDES $SYBASE_INCLUDE"
-
-AC_MSG_CHECKING(for Sybase-CT support)
-AC_ARG_WITH(sybase-ct,
-[ --with-sybase-ct[=DIR] Include Sybase-CT support. DIR is the Sybase home
- directory, defaults to /home/sybase.],
-[
- if test "$withval" != "no"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SYBASE_CT)
- if test "$withval" = "yes"; then
- SYBASE_CT_INCDIR=/home/sybase/include
- SYBASE_CT_LIBDIR=/home/sybase/lib
- else
- SYBASE_CT_INCDIR=$withval/include
- SYBASE_CT_LIBDIR=$withval/lib
- fi
- SYBASE_CT_INCLUDE=-I$SYBASE_CT_INCDIR
- SYBASE_CT_LFLAGS="-L$SYBASE_CT_LIBDIR"
- SYBASE_CT_LIBS="-lcs -lct -lcomn -lintl"
- old_LDFLAGS=$LDFLAGS
- LDFLAGS="$LDFLAGS -L$SYBASE_CT_LIBDIR"
- AC_CHECK_LIB(tcl, netg_errstr,
- [ SYBASE_CT_LIBS="$SYBASE_CT_LIBS -ltcl" ],
- [ SYBASE_CT_LIBS="$SYBASE_CT_LIBS -lsybtcl" ],
- [ $SYBASE_CT_LIBS ])
- AC_CHECK_LIB(insck, insck__getVdate,
- [ SYBASE_CT_LIBS="$SYBASE_CT_LIBS -linsck" ])
- LDFLAGS=$old_LDFLAGS
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(SYBASE_CT_LIBS)
-AC_SUBST(SYBASE_CT_LFLAGS)
-dnl## AC_SUBST(SYBASE_CT_INCLUDE)
-INCLUDES="$INCLUDES $SYBASE_CT_INCLUDE"
-
-
-AC_MSG_CHECKING(for MySQL support)
-AC_ARG_WITH(mysql,
-[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base
- install directory, defaults to /usr/local.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- MYSQL_INCDIR=/usr/local/include/mysql
- MYSQL_LIBDIR=/usr/local/lib/mysql
- else
- if test -f $withval/include/mysql/mysql.h; then
- MYSQL_INCDIR=$withval/include/mysql
- MYSQL_LIBDIR=$withval/lib/mysql
- elif test -f $withval/include/mysql.h; then
- MYSQL_INCDIR=$withval/include
- MYSQL_LIBDIR=$withval/lib
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval)
- fi
- fi
- MYSQL_INCLUDE=-I$MYSQL_INCDIR
- if test -n "$APXS"; then
- MYSQL_LFLAGS="'${apxs_runpath_switch}$MYSQL_LIBDIR' -L$MYSQL_LIBDIR"
- else
- MYSQL_LFLAGS="${ld_runpath_switch}$MYSQL_LIBDIR -L$MYSQL_LIBDIR"
- fi
- MYSQL_LIBS=-lmysqlclient
-
- AC_DEFINE(HAVE_MYSQL)
- AC_MSG_RESULT(yes)
-
- dnl check for errmsg.h, which isn't installed by some versions of 3.21
- old_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE"
- AC_CHECK_HEADERS(errmsg.h mysql.h)
- CPPFLAGS="$old_CPPFLAGS"
- else
- AC_MSG_RESULT(no)
-dnl Why are we defining HAVE_MYSQL here??
- AC_DEFINE(HAVE_MYSQL)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(MYSQL_LIBS)
-AC_SUBST(MYSQL_LFLAGS)
-dnl## AC_SUBST(MYSQL_INCLUDE)
-INCLUDES="$INCLUDES $MYSQL_INCLUDE"
-
-
-AC_MSG_CHECKING(for mSQL support)
-AC_ARG_WITH(msql,
-[ --with-msql[=DIR] Include mSQL support. DIR is the mSQL base
- install directory, defaults to /usr/local/Hughes.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- MSQL_INCDIR=/usr/local/Hughes/include
- MSQL_LIBDIR=/usr/local/Hughes/lib
- else
- MSQL_INCDIR=$withval/include
- MSQL_LIBDIR=$withval/lib
- fi
- MSQL_INCLUDE=-I$MSQL_INCDIR
- MSQL_LFLAGS=-L$MSQL_LIBDIR
- MSQL_LIBS=-lmsql
-
- AC_DEFINE(HAVE_MSQL)
- AC_MSG_RESULT(yes)
- AC_MSQL_VERSION
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(MSQL_LIBS)
-AC_SUBST(MSQL_LFLAGS)
-dnl## AC_SUBST(MSQL_INCLUDE)
-INCLUDES="$INCLUDES $MSQL_INCLUDE"
-
-AC_MSG_CHECKING(for PostgresSQL support)
-AC_ARG_WITH(pgsql,
-[ --with-pgsql[=DIR] Include PostgresSQL support. DIR is the PostgresSQL
- base install directory, defaults to /usr/local/pgsql.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- PGSQL_INCDIR=/usr/local/pgsql/include
- PGSQL_LIBDIR=/usr/local/pgsql/lib
- else
- PGSQL_INCDIR=$withval/include
- test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql
- PGSQL_LIBDIR=$withval/lib
- test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql
- fi
- PGSQL_INCLUDE=-I$PGSQL_INCDIR
- PGSQL_LFLAGS=-L$PGSQL_LIBDIR
- PGSQL_LIBS=-lpq
-
- old_CFLAGS=$CFLAGS; old_LDFLAGS=$LDFLAGS; old_LIBS=$LIBS
- CFLAGS="$CFLAGS $PGSQL_INCLUDE"
- LDFLAGS="$LDFLAGS $PGSQL_LFLAGS"
- LIBS="$LIBS $PGSQL_LIBS"
- AC_DEFINE(HAVE_PGSQL)
- AC_MSG_RESULT(yes)
- AC_CHECK_FUNC(PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES))
- CFLAGS=$old_CFLAGS; LDFLAGS=$old_LDFLAGS; LIBS=$old_LIBS
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(PGSQL_LIBS)
-AC_SUBST(PGSQL_LFLAGS)
-dnl## AC_SUBST(PGSQL_INCLUDE)
-INCLUDES="$INCLUDES $PGSQL_INCLUDE"
-
-
-AC_MSG_CHECKING(for LDAP support)
-AC_ARG_WITH(ldap,
-[ --with-ldap[=DIR] Include LDAP support. DIR is the LDAP base
- install directory, defaults to /usr/local/ldap],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- LDAP_INCDIR=/usr/local/ldap/include
- LDAP_LIBDIR=/usr/local/ldap/lib
- else
- LDAP_INCDIR=$withval/include
- LDAP_LIBDIR=$withval/lib
- fi
- LDAP_INCLUDE=-I$LDAP_INCDIR
- LDAP_LFLAGS="-L$LDAP_LIBDIR ${ld_runpath_switch}$LDAP_LIBDIR"
- LDAP_LIBS="-lldap -llber"
-
- AC_DEFINE(HAVE_LDAP)
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(LDAP_LIBS)
-AC_SUBST(LDAP_LFLAGS)
-dnl## AC_SUBST(LDAP_INCLUDE)
-INCLUDES="$INCLUDES $LDAP_INCLUDE"
-
-
-AC_MSG_CHECKING(for SNMP support)
-AC_ARG_WITH(snmp,
-[ --with-snmp[=DIR] Include SNMP support. DIR is the SNMP base
- install directory, defaults to /usr/local],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- SNMP_INCDIR=/usr/local/include
- test -d /usr/local/include/ucd-snmp && SNMP_INCDIR=/usr/local/include/ucd-snmp
- SNMP_LIBDIR=/usr/local/lib
- else
- SNMP_INCDIR=$withval/include
- test -d $withval/include/ucd-snmp && SNMP_INCDIR=$withval/include/ucd-snmp
- SNMP_LIBDIR=$withval/lib
- fi
- SNMP_INCLUDE=-I$SNMP_INCDIR
- SNMP_LFLAGS=-L$SNMP_LIBDIR
- SNMP_LIBS="-lsnmp"
-
- AC_DEFINE(HAVE_SNMP)
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(SNMP_LIBS)
-AC_SUBST(SNMP_LFLAGS)
-dnl## AC_SUBST(SNMP_INCLUDE)
-INCLUDES="$INCLUDES $SNMP_INCLUDE"
-
-
-AC_MSG_CHECKING(for Informix support)
-AC_ARG_WITH(informix,
-[ --with-informix[=DIR] Include Informix support. DIR is the Informix base
- install directory, defaults to ${INFORMIXDIR:-nothing}.],
-[
- if test "$withval" != "no"; then
- if test "$INFORMIXDIR" = ""; then
- INFORMIX_WARNING="
-WARNING: You asked for Informix support, but don't have \\\$INFORMIXDIR
- environment value set up. Configuring and compiling Informix
- support to PHP3 is impossible and has been turned off. Please
- try again after setting up your environment."
- AC_MSG_RESULT(no)
- else
- if test "$withval" = "yes"; then
- IFX_INCDIR=$INFORMIXDIR/incl/esql
- IFX_LIBDIR="-L$INFORMIXDIR/lib -L$INFORMIXDIR/lib/esql"
- else
- IFX_INCDIR=$withval/incl/esql
- IFX_LIBDIR="-L$withval/lib -L$withval/lib/esql"
- if test "$withval" != "$INFORMIXDIR"; then
- INFORMIX_WARNING="
-WARNING: You specified Informix base install directory that is different
- than your \\\$INFORMIXDIR environment variable. You'd better know
- exactly what you are doing."
- fi
- fi
- IFX_INCLUDE=-I$IFX_INCDIR
- IFX_LFLAGS=$IFX_LIBDIR
- if test -z "$IFX_LIBS"; then
- IFX_LIBS=`esql -libs | sed -e 's/-lm$//'`
- dnl -lm twice otherwise?
- IFX_LIBS=`echo $IFX_LIBS | sed -e 's/Libraries to be used://g' -e 's/esql: error -55923: No source or object file\.//g'`
- dnl Seems to get rid of newlines.
- dnl According to Perls DBD-Informix, might contain these strings.
- else
- dnl Allow override to use static and/or threaded libs
- IFX_LIBS="$IFX_LIBS"
- fi
- CFLAGS="$CFLAGS $IFX_INCLUDE"
- LDFLAGS="$LDFLAGS $IFX_LFLAGS"
-
- if test "`uname -s 2>/dev/null`" = "AIX"; then
- CFLAGS="$CFLAGS -D__H_LOCALEDEF"
- fi
- AC_DEFINE(HAVE_IFX)
- AC_MSG_CHECKING([Informix version])
- IFX_VERSION=[`esql -V | sed -ne '1 s/^[^0-9]*\([0-9]\)\.\([0-9]*\).*/\1\2/p'`]
- if test $IFX_VERSION -ge "900"; then
- AC_DEFINE(HAVE_IFX_IUS)
- IFX_ESQL_FLAGS="-EDHAVE_IFX_IUS"
- else
- IFX_ESQL_FLAGS="-EUHAVE_IFX_IUS"
- fi
- AC_SUBST(IFX_ESQL_FLAGS)
- AC_DEFINE_UNQUOTED(IFX_VERSION, $IFX_VERSION)
- AC_MSG_RESULT(yes)
- fi
- else
- INFORMIXDIR=
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(IFX_LIBS)
-AC_SUBST(IFX_LFLAGS)
-AC_SUBST(INFORMIXDIR)
-dnl## AC_SUBST(IFX_INCLUDE)
-INCLUDES="$INCLUDES $IFX_INCLUDE"
-
-
-AC_MSG_CHECKING(for InterBase support)
-AC_ARG_WITH(interbase,
-[ --with-interbase[=DIR] Include InterBase support. DIR is the InterBase base
- install directory, defaults to /usr/interbase],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- IBASE_INCDIR=/usr/interbase/include
- IBASE_LIBDIR=/usr/interbase/lib
- else
- IBASE_INCDIR=$withval/include
- IBASE_LIBDIR=$withval/lib
- fi
- IBASE_INCLUDE=-I$IBASE_INCDIR
- IBASE_LFLAGS=-L$IBASE_LIBDIR
- IBASE_LIBS="-lgds"
-
- AC_DEFINE(HAVE_IBASE)
-
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(IBASE_LIBS)
-AC_SUBST(IBASE_LFLAGS)
-dnl## AC_SUBST(IBASE_INCLUDE)
-INCLUDES="$INCLUDES $IBASE_INCLUDE"
-
-
-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)
- else
- AC_DEFINE(HYPERWAVE,0)
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(HYPERWAVE,0)
- AC_MSG_RESULT(no)
-])
-
-
-AC_MSG_CHECKING(for XML support)
-AC_ARG_WITH(xml,
-[ --with-xml Include XML support],[
- if test "$withval" = "yes"; then
- AC_DEFINE(HAVE_LIBEXPAT, 1)
- AC_MSG_RESULT(yes)
- XML_LIBS="-lexpat"
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(XML_LIBS)
-
-
-AC_MSG_CHECKING(whether to include zlib support)
-AC_ARG_WITH(zlib,
-[ --with-zlib[=DIR] Include zlib support (requires zlib >= 1.0.9).
- DIR is the zlib install directory,
- defaults to /usr.],
-[
- case "$withval" in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(z, gzgets, [AC_DEFINE(HAVE_ZLIB) ZLIB_LIBS="-lz"],
- [AC_MSG_ERROR(Zlib module requires zlib >= 1.0.9.)]) ;;
- *)
- test -f $withval/include/zlib/zlib.h && ZLIB_INCLUDE="-I$withval/include/zlib"
- test -f $withval/include/zlib.h && ZLIB_INCLUDE="-I$withval/include"
- if test -n "$ZLIB_INCLUDE" ; then
- AC_MSG_RESULT(yes)
- old_LIBS=$LIBS
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(z, gzgets, [AC_DEFINE(HAVE_ZLIB) ZLIB_LIBS="-L$withval/lib -lz"],
- [AC_MSG_ERROR(Zlib module requires zlib >= 1.0.9.)])
- LIBS=$old_LIBS
- else
- AC_MSG_RESULT(no)
- fi ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(ZLIB_LIBS)
-dnl## AC_SUBST(ZLIB_INCLUDE)
-INCLUDES="$INCLUDES $ZLIB_INCLUDE"
-
-
-AC_MSG_CHECKING(whether to include pdflib support)
-AC_ARG_WITH(pdflib,
-[ --with-pdflib[=DIR] Include pdflib support (tested with 0.6).
- DIR is the pdflib install directory,
- defaults to /usr/local.],
-[
- case "$withval" in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(pdf, PDF_open, [AC_DEFINE(HAVE_PDFLIB) PDFLIB_LIBS="-lpdf"],
- [AC_MSG_ERROR(pdflib module requires pdflib 0.6)]) ;;
- *)
- test -f $withval/include/pdf.h && PDFLIB_INCLUDE="-I$withval/include"
- if test -n "$PDFLIB_INCLUDE" ; then
- AC_MSG_RESULT(yes)
- old_LIBS=$LIBS
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(pdf, PDF_open, [AC_DEFINE(HAVE_PDFLIB) PDFLIB_LIBS="-L$withval/lib -lpdf"],
- [AC_MSG_ERROR(pdflib module requires pdflib 0.6.)])
- LIBS=$old_LIBS
- else
- AC_MSG_RESULT(no)
- fi ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(PDFLIB_LIBS)
-dnl## AC_SUBST(PDFLIB_INCLUDE)
-INCLUDES="$INCLUDES $PDFLIB_INCLUDE"
-
-
-AC_MSG_CHECKING(whether to include fdftk support)
-AC_ARG_WITH(fdftk,
-[ --with-fdftk[=DIR] Include fdftk support.
- DIR is the fdftk lib install directory,
- defaults to /usr/local.],
-[
- case "$withval" in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(FdfTk, FDFOpen, [AC_DEFINE(HAVE_FDFLIB) FDFLIB_LIBS="-lFdfTk"],
- [AC_MSG_ERROR(fdftk module requires fdftk 2.0)]) ;;
- *)
- test -f $withval/include/Fdftk.h && FDFLIB_INCLUDE="-I$withval/include"
- if test -n "$FDFLIB_INCLUDE" ; then
- AC_MSG_RESULT(yes)
- old_LIBS=$LIBS
- LIBS="$LIBS -L$withval/lib"
- AC_CHECK_LIB(FdfTk, FDFOpen, [AC_DEFINE(HAVE_FDFLIB) FDFLIB_LIBS="-L$withval/lib -lFdfTk"],
- [AC_MSG_ERROR(fdftk module requires ftftk lib 2.0.)])
- LIBS=$old_LIBS
- else
- AC_MSG_RESULT(no)
- fi ;;
- esac
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(FDFLIB_LIBS)
-dnl## AC_SUBST(FDFLIB_INCLUDE)
-INCLUDES="$INCLUDES $FDFLIB_INCLUDE"
-
-
-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" = "yes"; then
- AC_DEFINE(HAVE_FILEPRO, 1)
- AC_MSG_RESULT(yes)
- else
- AC_DEFINE(HAVE_FILEPRO, 0)
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(HAVE_FILEPRO, 0)
- AC_MSG_RESULT(no)
-])
-
-
-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)
- MOD_DAV_CFLAGS="-DHAVE_MOD_DAV -I$withval"
- INCLUDES="$INCLUDES -I$withval"
- else
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_MOD_DAV, 0)
- fi
- fi
-],[
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_MOD_DAV, 0)
-])
-AC_SUBST(MOD_DAV_CFLAGS)
-
-
-AC_MSG_CHECKING(whether to enable System V semaphore support)
-AC_ARG_ENABLE(sysvsem,
-[ --enable-sysvsem Enable System V semaphore support.],
-[
- if test "$enableval" = "yes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SYSVSEM, 1)
- AC_CACHE_CHECK(for union semun,php_cv_semun,
- AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
- ],
- [union semun x;],
- [
- php_cv_semun=yes
- ],[
- php_cv_semun=no
- ])
- )
- if test $php_cv_semun = "yes"; then
- AC_DEFINE(HAVE_SEMUN, 1)
- else
- AC_DEFINE(HAVE_SEMUN, 0)
- fi
- else
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_SYSVSEM, 0)
- fi
-],[
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_SYSVSEM, 0)
-])
-
-
-AC_MSG_CHECKING(whether to enable System V shared memory support)
-AC_ARG_ENABLE(sysvshm,
-[ --enable-sysvshm Enable the System V shared memory support],[
- if test "$enableval" = "yes"; then
- AC_DEFINE(HAVE_SYSVSHM, 1)
- AC_MSG_RESULT(yes)
- else
- AC_DEFINE(HAVE_SYSVSHM, 0)
- AC_MSG_RESULT(no)
- fi
-],[
- AC_DEFINE(HAVE_SYSVSHM, 0)
- AC_MSG_RESULT(no)
-])
-
-
-divert(4)
-
-dnl If we're using gcc and the user hasn't specified CFLAGS, add -O2.
-test -n "$auto_cflags" && test -n "$GCC" && CFLAGS="$CFLAGS -O2"
-
-dnl If we're using cc on HP-UX, add the -Ae to CFLAGS
-if test -n "$auto_cflags" && test "`uname -s 2>/dev/null`" = "HP-UX"; then
- test -n "$GCC" || CFLAGS="-Ae $CFLAGS"
-fi
-
-dnl *** Commented out - generates slow code and consumes a lot of
-dnl *** resources during compilation - we need to figure out how
-dnl *** to supply it only when absolutely necessary
-dnl If we are using gcc add -fpic to make dl() work on some platforms
-dnl test -n "$GCC" && CFLAGS="$CFLAGS -fpic"
-
-AC_SUBST(CFLAGS)
-AC_SUBST(PROG_SENDMAIL)
-AC_SUBST(CFLAGS_SHLIB)
-AC_SUBST(LDFLAGS_SHLIB)
-AC_SUBST(LDFLAGS_SHLIB_EXPORT)
-
-dnl Create the necessary directories if building using VPATH
-if test ! -d functions; then
- mkdir functions
-fi
-
-PHP_BUILD_DATE=`date '+%Y-%m-%d'`
-AC_SUBST(PHP_BUILD_DATE)
-AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE")
-PHP_UNAME=`uname -a`
-AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME")
-PHP_OS=`uname`
-AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS")
-
-AC_OUTPUT(Makefile build-defs.h libphp3.module
- scripts/mkextlib regex/Makefile ext/Makefile
- @@EXT_MAKEFILES@@, [
-chmod +x scripts/mkextlib
-], [
-
-dnl Warn about CGI version with no extra security options.
-if test "$BINNAME" = "php"; then
- if test "$REDIRECT" = "0"; then
- if test "$DISCARD_PATH" = "0"; then
- echo "WARNING: You will be compiling the CGI version of PHP without any"
- echo " redirection checking. By putting this cgi binary somewhere"
- echo " in 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
-dnl Warn if Informix support was requested but environment is not set up correctly.
-if test "$INFORMIX_WARNING" != ""; then
- echo "$INFORMIX_WARNING"
-fi
-])
-
-divert
-
-# Local Variables:
-# tab-width: 4
-# End:
diff --git a/control_structures.h b/control_structures.h
deleted file mode 100644
index cde2a9efa5..0000000000
--- a/control_structures.h
+++ /dev/null
@@ -1,46 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifndef _CONTROL_STRUCTURES_H
-#define _CONTROL_STRUCTURES_H
-
-#ifndef THREAD_SAFE
-extern unsigned int param_index;
-extern char *class_name;
-extern HashTable *class_symbol_table;
-#endif
-
-extern inline void start_display_source(int start_in_php INLINE_TLS);
-
-#endif
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/cvsusers b/cvsusers
deleted file mode 100644
index 9763c24bc3..0000000000
--- a/cvsusers
+++ /dev/null
@@ -1,62 +0,0 @@
-CVS login Name Email Works on
-andi Andi Gutmans andi@php.net Core + API
-jim Jim Winstead jimw@php.net Everything
-rasmus Rasmus Lerdorf rasmus@php.net Everything
-shane Shane Caraveo shane@php.net WIN32 + API
-ssb Stig Bakken stig@php.net Everything
-zeev Zeev Suraski zeev@php.net Everything
-jaakko Jaakko Hyvatti jaakko@hyvatti.iki.fi Everything
-veebert Rex Logan veebert@dimensional.com IMAP
-chad Chad Robinson chadr@brttech.com Documentation
-myddryn PostgreSQL
-wojtek
-mitch Mitch Golden Oracle
-brian
-lr Lachlan Roche lr@www.wwi.com.au MD5
-damian
-ian
-jah Jouni Ahto jah@cultnet.fi Postgres, Informix
-adam
-amitay Amitay Isaacs amitay@w-o-i.com LDAP
-dizzy
-mark
-guy
-jeffhu Jeffrey Hulten jeffh@premier1.net WIN32 + modules(?)
-eschmid Egon Schmid eschmid@delos.lf.net Documentation
-cslawi Torben Wilson torben@netmill.com Documentation
-bwk
-eric
-tcobb Troy Cobb www
-gareth www
-willer Steve Willer willer@interlog.com pack
-cmv Colin Viebrock cmv@privateworld.com www
-soderman
-tin
-musone Mark Musone musone@afterfive.com IMAP
-abelits Alex Belits abelits@phobos.illtel.denver.co.us fhttpd module
-ars Ariel Shkedi ars@ziplink.net setup
-mag Nikolay P. Romanyuk mag@redcom.ru Raima DB
-rse Ralf S. Engelschall rse@engelschall.com Apache configuration
-sr Stefan Roehrich sr@linux.de zlib module
-owl Igor Kovalenko owl@infomarket.ru QNX support
-pcurtis Paul Curtis pcurtis@netscape.com NSAPI work (??)
-lynch Richard Lynch lynch@lscorp.com Documentation
-steffann Sander Steffann steffann@nederland.net Safe Mode
-wdiestel Wolfram Diestel wdiestel@debis.com Oracle WebServer cartridge
-fmk Frank M. Kromann fmk@businessnet.dk Direct MS-SQL, NaVision, Lotus Notes
-steinm Uwe Steinmann Uwe.Steinmann@fernuni-hagen.de Hyperwave Module
-danny Danny Heijl Danny.Heijl@cevi.be Informix
-kara Andreas Karajannis Andreas.Karajannis@gmd.de ODBC, Oracle
-nyenyon Christian Cartus chc@idgruppe.de Informix
-kk Kristian Köhntopp kk@shonline.de Documentation
-ted Ted Rolle ted.rolle@usa.net Documentation
-holger Holger Zimmermann zimpel@t-online.de Pi3Web support
-sgk Shigeru Kanemoto sgk@happysize.co.jp Japanese language support
-jimjag Jim Jagielski jim@jaguNET.com Misc scraps
-martin Martin Kraemer Martin.Kraemer@Mch.SNI.De EBCDIC (BS2000 mainframe port)
-kwazy Landon Bradshaw landon@bradshaw.org Documentation
-thies Thies C. Arntzen thies@digicol.de implement IPTC reader, maybe some oracle stuff
-cschneid Christian Schneider cschneid@relog.ch gzip run-time encoding of output stream
-tommay Tom May tom@go2net.com Sybase-CT
-swilliam Steve Williams swilliam@empress.com Empress support in unified ODBC
-sas Sascha Schumann sas@schell.de Various tweaks
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/ext/Makefile.am b/ext/Makefile.am
deleted file mode 100644
index 56ba636b8a..0000000000
--- a/ext/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-SUBDIRS = @EXT_SUBDIRS@
-
-noinst_LIBRARIES=libphpext.a
-
-libphpext.a: @EXT_LIBS@
- top_srcdir=$(top_srcdir) $(top_builddir)/scripts/mkextlib $@ $(SUBDIRS)
diff --git a/ext/dbase/Makefile.am b/ext/dbase/Makefile.am
deleted file mode 100644
index c04a5ccb86..0000000000
--- a/ext/dbase/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
-noinst_LIBRARIES=libphpext_dbase.a
-libphpext_dbase_a_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 46b1162583..0000000000
--- a/ext/dbase/dbase.c
+++ /dev/null
@@ -1,686 +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) |
- +----------------------------------------------------------------------+
- */
-#if defined(COMPILE_DL)
-#include "dl/phpdl.h"
-#endif
-
-#if defined(THREAD_SAFE)
-#include "tls.h"
-#endif
-#include <stdlib.h>
-
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen-wrappers.h"
-#include "php_globals.h"
-
-#if DBASE
-#include "dbase.h"
-#include "../dbase/dbf.h"
-#if defined(THREAD_SAFE)
-DWORD DbaseTls;
-static int numthreads=0;
-void *dbase_mutex;
-
-typedef struct dbase_global_struct{
- int le_dbhead;
-}dbase_global_struct;
-
-#define DBase_GLOBAL(a) dbase_globals->a
-
-#define DBase_TLS_VARS \
- dbase_global_struct *dbase_globals; \
- dbase_globals=TlsGetValue(DbaseTls);
-
-#else
-static int le_dbhead;
-#define DBase_GLOBAL(a) a
-#define DBase_TLS_VARS
-#endif
-
-#include <fcntl.h>
-#include <errno.h>
-
-
-static void _close_dbase(dbhead_t *dbhead)
-{
- close(dbhead->db_fd);
- free_dbf_head(dbhead);
-}
-
-
-int php3_minit_dbase(INIT_FUNC_ARGS)
-{
-#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 int php3_mend_dbase(void){
-#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 */
-void php3_dbase_open(INTERNAL_FUNCTION_PARAMETERS) {
- pval *dbf_name, *options;
- dbhead_t *dbh;
- int handle;
- 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) {
- php3_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 */
-void php3_dbase_close(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_dbase_numrecords(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_dbase_numfields(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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) */
-void php3_dbase_pack(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_dbase_add_record(INTERNAL_FUNCTION_PARAMETERS) {
- 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) {
- php3_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)) {
- php3_error(E_WARNING, "Unable to find database for identifier %d", dbh_id->value.lval);
- RETURN_FALSE;
- }
-
- num_fields = _php3_hash_num_elements(fields->value.ht);
-
- if (num_fields != dbh->db_nfields) {
- php3_error(E_WARNING, "Wrong number of fields specified");
- RETURN_FALSE;
- }
-
- cp = t_cp = (char *)emalloc(dbh->db_rlen + 1);
- if (!cp) {
- php3_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 (_php3_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
- php3_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) {
- php3_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 */
-void php3_dbase_delete_record(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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) {
- php3_error(E_WARNING, "record %d out of bounds", record->value.lval);
- } else {
- php3_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 */
-void php3_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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) {
- php3_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_next_index_string(return_value,str_value,1);
- break;
- case 'N': /* FALLS THROUGH */
- case 'L': /* FALLS THROUGH */
- if (cur_f->db_fdc == 0) {
- add_next_index_long(return_value, strtol(str_value, NULL, 10));
- } else {
- add_next_index_double(return_value, atof(str_value));
- }
- break;
- case 'M':
- /* this is a memo field. don't know how to deal with
- this yet */
- break;
- default:
- /* should deal with this in some way */
- break;
- }
- efree(str_value);
- }
- efree(fnp);
-
- /* mark whether this record was deleted */
- if (data[0] == '*') {
- add_assoc_long(return_value,"deleted",1);
- }
- else {
- add_assoc_long(return_value,"deleted",0);
- }
-
- free(data);
-}
-/* }}} */
-
-/* From Martin Kuba <makub@aida.inet.cz> */
-/* {{{ proto array dbase_get_record_with_names(int identifier, int record)
- Returns an associative array representing a record from the database */
-void php3_dbase_get_record_with_names(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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) {
- php3_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 */
-void php3_dbase_create(INTERNAL_FUNCTION_PARAMETERS) {
- pval *filename, *fields, *field, *value;
- int fd;
- dbhead_t *dbh;
-
- int num_fields;
- dbfield_t *dbf, *cur_f;
- int i, rlen, handle;
- 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) {
- php3_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) {
- php3_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
- RETURN_FALSE;
- }
-
- num_fields = _php3_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) {
- php3_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 (_php3_hash_index_find(fields->value.ht, i, (void **)&field) == FAILURE) {
- php3_error(E_WARNING, "unable to find field %d", i);
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- if (field->type != IS_ARRAY) {
- php3_error(E_WARNING, "second parameter must be array of arrays");
- free_dbf_head(dbh);
- RETURN_FALSE;
- }
-
- /* field name */
- if (_php3_hash_index_find(field->value.ht, 0, (void **)&value) == FAILURE) {
- php3_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) {
- php3_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 (_php3_hash_index_find(field->value.ht,1,(void **)&value) == FAILURE) {
- php3_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 (_php3_hash_index_find(field->value.ht,2,(void **)&value) == FAILURE) {
- php3_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 (_php3_hash_index_find(field->value.ht,3,(void **)&value) == FAILURE) {
- php3_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:
- php3_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[] = {
- {"dbase_open", php3_dbase_open, NULL},
- {"dbase_create", php3_dbase_create, NULL},
- {"dbase_close", php3_dbase_close, NULL},
- {"dbase_numrecords", php3_dbase_numrecords, NULL},
- {"dbase_numfields", php3_dbase_numfields, NULL},
- {"dbase_add_record", php3_dbase_add_record, NULL},
- {"dbase_get_record", php3_dbase_get_record, NULL},
- {"dbase_get_record_with_names", php3_dbase_get_record_with_names, NULL},
- {"dbase_delete_record", php3_dbase_delete_record, NULL},
- {"dbase_pack", php3_dbase_pack, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry dbase_module_entry = {
- "DBase", dbase_functions, php3_minit_dbase, php3_mend_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/dbase.h b/ext/dbase/dbase.h
deleted file mode 100644
index bcc0b5777b..0000000000
--- a/ext/dbase/dbase.h
+++ /dev/null
@@ -1,52 +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 int php3_minit_dbase(INIT_FUNC_ARGS);
-extern void php3_dbase_open(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_create(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_close(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_numrecords(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_numfields(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_add_record(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_get_record(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_delete_record(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_pack(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dbase_get_record_with_names(INTERNAL_FUNCTION_PARAMETERS);
-#else
-#define dbase_module_ptr NULL
-#endif
-#endif /* _DBASE_H */
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 <stdlib.h>
-#include <string.h>
-#ifdef WIN32
-#include <io.h>
-#else
-#include <unistd.h>
-#endif
-
-/* So we can use O_BINARY on non-Win32 systems. */
-#if !defined(O_BINARY) && !defined(WIN32)
-#define O_BINARY (0)
-#endif
-
-struct dbf_dhead {
- char dbh_dbt; /* memo (dbt) file present */
- char dbh_date[3]; /* last update YY, MM, DD */
- char dbh_records[4]; /* number of records LE */
- char dbh_hlen[2]; /* header length LE */
- char dbh_rlen[2]; /* record length LE */
- char dbh_res[20]; /* padding */
-};
-#define DBH_DATE_YEAR 0 /* byte offset for year in dbh_date */
-#define DBH_DATE_MONTH 1
-#define DBH_DATE_DAY 2
-
-/*
- * field description on disk
- */
-
-#define DBF_NAMELEN 11
-
-struct dbf_dfield {
- char dbf_name[DBF_NAMELEN]; /* name of field */
- char dbf_type; /* type of field */
- char dbf_fda[4]; /* something for dbase III */
- char dbf_flen[2]; /* field length [and decimal if N] */
- char dbf_res[14]; /* padding */
-};
-
-struct db_field {
- char db_fname[DBF_NAMELEN+1]; /* 0 terminated */
- char db_type; /* type of field */
- int db_flen; /* length of field */
- int db_fdc; /* number of decimals in field */
-
- char *db_format; /* format for printing %s etc */
- int db_foffset; /* offset within record */
-};
-typedef struct db_field dbfield_t;
-
-struct db_head {
- int db_fd;
- unsigned char db_dbt; /* dbt present */
- char db_date[9]; /* date of last update in db format */
- long db_records; /* number of records */
- int db_hlen; /* header length */
- int db_rlen; /* record length */
-
- int db_nfields; /* number of fields */
- dbfield_t *db_fields; /* field info */
- char *db_name; /* name of dbf file */
- int db_cur_rec; /* current record */
-};
-typedef struct db_head dbhead_t;
-
-#define DBH_TYPE_NORMAL 0x03
-#define DBH_TYPE_MEMO 0x83
-
-#define VALID_RECORD ' '
-#define DELETED_RECORD '*'
-
-#include "dbf_head.h"
-#include "dbf_misc.h"
-#include "dbf_rec.h"
-
-#endif /* _DBF_H_ */
diff --git a/ext/dbase/dbf_head.c b/ext/dbase/dbf_head.c
deleted file mode 100644
index 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 <stdio.h>
-#include <fcntl.h>
-
-#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 481e085027..0000000000
--- a/ext/dbase/dbf_head.h
+++ /dev/null
@@ -1,9 +0,0 @@
-extern dbhead_t *get_dbf_head(int fd);
-extern 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);
-extern 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);
-extern 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 84573e47a4..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 <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-#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 <time.h>
-
-char *db_cur_date(char *cp)
-{
- struct tm *ctm;
- time_t c_time;
-
- c_time = time((time_t *)NULL);
- ctm = localtime(&c_time);
- 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 ce2e80d7a1..0000000000
--- a/ext/dbase/dbf_misc.h
+++ /dev/null
@@ -1,13 +0,0 @@
-extern void put_long(char *cp, long lval);
-extern long get_long(char *cp);
-extern int get_short(char *cp);
-extern void put_short(char *cp, int sval);
-extern void put_double(char *cp, double fval);
-extern double get_double(char *cp);
-extern void copy_fill(char *dp, char *sp, int len);
-extern void copy_crimp(char *dp, char *sp, int len);
-extern 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 <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-#include "dbf_ndx.h"
-
-/*
- * get the ndx header for this file
- */
-ndx_header_t *ndx_get_header(int fd)
-{
- dndx_header_t *dp;
- ndx_header_t *np;
-
- if ((dp = (dndx_header_t *)malloc(NDX_PAGE_SZ)) == NULL)
- return NULL;
- if ((np = (ndx_header_t *)malloc(sizeof(ndx_header_t))) == NULL) {
- free(dp);
- return NULL;
- }
- if ((lseek(fd, 0, 0) < 0) || (read(fd, dp, NDX_PAGE_SZ) < 0)) {
- free(dp); free(np);
- return NULL;
- }
- np->ndx_hpage = dp;
- np->ndx_fd = fd;
- np->ndx_start_pg = get_long(dp->dndx_st_pg);
- np->ndx_total_pgs = get_long(dp->dndx_tot_pg);
- np->ndx_key_len = get_short(dp->dndx_key_len);
- np->ndx_keys_ppg = get_short(dp->dndx_keys_ppg);
- np->ndx_key_type = get_short(dp->dndx_key_type);
- np->ndx_key_size = get_long(dp->dndx_size_key);
- np->ndx_key_name = dp->dndx_key_name;
- np->ndx_unique = dp->dndx_unique;
-
- np->ndx_fp = NULL;
-
- return np;
-}
-
-static ndx_page_t *ndx_get_page(ndx_header_t *hp, int pageno)
-{
- ndx_page_t *fp;
- dndx_page_t *dp;
- ndx_record_t *rp;
-
-#if 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 <stdio.h>
-#include <fcntl.h>
-
-#include "dbf.h"
-
-int get_piece(dbhead_t *dbh, long offset, char *cp, int len);
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len);
-
-/*
- * get a record off the database
- */
-char *get_dbf_record(dbhead_t *dbh, long rec_num)
-{
- long offset;
- char *cp;
-
- if (rec_num > dbh->db_records) {
- return NULL;
- }
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return NULL;
- }
-
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (get_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- free(cp);
- cp = NULL;
- }
- if (cp)
- dbh->db_cur_rec = rec_num;
- return cp;
-}
-
-int
-get_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* read the record into the allocated space */
- return read(dbh->db_fd, cp, len);
-}
-
-/*
- * put a record to the database
- */
-long put_dbf_record(dbhead_t *dbh, long rec_num, char *cp)
-{
- long offset;
-
- if (rec_num == 0) {
- rec_num = dbh->db_records;
- }
- if (rec_num > dbh->db_records) {
- return 0L;
- }
- /* go to the correct spot on the file */
- offset = dbh->db_hlen + (rec_num - 1) * dbh->db_rlen;
- if (put_piece(dbh, offset, cp, dbh->db_rlen) != dbh->db_rlen) {
- rec_num = -1;
- }
- return rec_num;
-}
-
-int put_piece(dbhead_t *dbh, long offset, char *cp, int len)
-{
- /* go to the correct spot on the file */
- if ( lseek(dbh->db_fd, offset, 0) < 0 ) {
- return -1;
- }
-
- /* write the record into the file */
- return write(dbh->db_fd, cp, len);
-}
-
-int del_dbf_record(dbhead_t *dbh, long rec_num)
-{
- int ret = 0;
- char *cp;
-
- if (rec_num > dbh->db_records)
- return -1;
- if ((cp = get_dbf_record(dbh, rec_num))) {
- *cp = DELETED_RECORD;
- ret = put_dbf_record(dbh, rec_num, cp);
- free(cp);
- }
- return ret;
-}
-
-void pack_dbf(dbhead_t *dbh)
-{
- long out_off, in_off;
- int rec_cnt, new_cnt;
- char *cp;
-
- if ((cp = (char *)malloc(dbh->db_rlen)) == NULL) {
- return;
- }
- in_off = out_off = dbh->db_hlen;
-
- new_cnt = 0;
- rec_cnt = dbh->db_records;
- while (rec_cnt > 0) {
- if (get_piece(dbh, in_off, cp, dbh->db_rlen) < 0)
- break;
-
- if (*cp != DELETED_RECORD) {
- /* write the record into the file */
- if (put_piece(dbh, out_off, cp, dbh->db_rlen) < 0)
- break;
- out_off += dbh->db_rlen;
- new_cnt++;
- }
- in_off += dbh->db_rlen;
- rec_cnt--;
- }
- free(cp);
- if (rec_cnt == 0)
- dbh->db_records = new_cnt;
-}
-
-/* routine to get a field from a record */
-char *get_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- int flen = fldp->db_flen;
-
- if ( !cp )
- cp = (char *)malloc(flen + 1);
- if ( cp ) {
- strncpy(cp, &rp[fldp->db_foffset], flen);
- cp[flen] = 0;
- }
- return cp;
-}
-
-void put_field_val(char *rp, dbfield_t *fldp, char *cp)
-{
- strncpy(&rp[fldp->db_foffset], cp, fldp->db_flen);
-}
-
-/*
- * output a record
- */
-void out_rec(dbhead_t *dbh, dbfield_t *dbf, char *cp)
-{
- dbfield_t *cur_f;
- int nfields = dbh->db_nfields;
- char *fnp = (char *)malloc(dbh->db_rlen);
-
- printf("%c", *cp);
- for (cur_f = dbf; cur_f < &dbf[nfields] ; cur_f++) {
- printf(" ");
- printf(cur_f->db_format, get_field_val(cp, cur_f, fnp));
- }
- printf("\n");
- free(fnp);
-}
-
-/* check for record validity */
-int is_valid_rec(char *cp)
-{
- if (cp && (*cp == VALID_RECORD))
- return 1;
- else
- return 0;
-}
-
-/* get the next record */
-char *dbf_get_next(dbhead_t *dbh)
-{
- return get_dbf_record(dbh, dbh->db_cur_rec + 1);
-}
diff --git a/ext/dbase/dbf_rec.h b/ext/dbase/dbf_rec.h
deleted file mode 100644
index 6eb40455a7..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);
-extern void pack_dbf(dbhead_t *dbh);
-extern char *get_field_val(char *rp, dbfield_t *fldp, char *cp);
-extern void put_field_val(char *rp, dbfield_t *fldp, char *cp);
-extern 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/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/ereg/ereg.c b/ext/ereg/ereg.c
deleted file mode 100644
index 42d36493d6..0000000000
--- a/ext/ereg/ereg.c
+++ /dev/null
@@ -1,569 +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 <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include "php.h"
-#include "php3_string.h"
-#include "reg.h"
-
-unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-function_entry reg_functions[] = {
- {"ereg", php3_ereg, third_argument_force_ref },
- {"ereg_replace", php3_eregreplace, NULL },
- {"eregi", php3_eregi, third_argument_force_ref },
- {"eregi_replace", php3_eregireplace, NULL },
- {"split", php3_split, NULL},
- {"join", php3_implode, NULL},
- {"sql_regcase", php3_sql_regcase, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry regexp_module_entry = {
- "Regular Expressions", reg_functions, NULL, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-/* 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);
-
- php3_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;
- TLS_VARS;
-
- if (icase)
- copts |= REG_ICASE;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &regex, &findin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* don't bother doing substring matching if we're not going
- to make use of the information */
- copts |= REG_NOSUB;
- break;
- case 3:
- if (getParameters(ht, 3, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 3)) {
- php3_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) {
- php3_error(E_WARNING, "Unable to allocate memory in _php3_ereg");
- RETURN_FALSE;
- }
-
- pval_destructor(array _INLINE_TLS); /* 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);
- }
- }
- 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 */
-void php3_ereg(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-void php3_eregi(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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 (!string_len)
- return (char *)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) {
- php3_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 <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
-
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- tmp = subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf,
- &string[pos + subs[walk[1] - '0'].rm_so],
- tmp);
- walkbuf += tmp;
- walk += 2;
- } else
- *walkbuf++ = *walk++;
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
- break;
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-
-static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval *arg_pattern,
- *arg_replace,
- *arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
- TLS_VARS;
-
- 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 */
-void php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string string [, array registers])
- Case insensitive replace regular expression */
-void php3_eregireplace(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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 */
-void php3_split(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *spliton, *str, *arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count;
- TLS_VARS;
-
- 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) {
- php3_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);
- php3_error(E_WARNING, "bad regular expression for split()");
- _php3_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) {
- php3_error(E_WARNING, "unexpected regex error (%d)", err);
- regfree(&re);
- _php3_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 void php3_sql_regcase(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *string;
- char *tmp;
- register int i;
-
- 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=0; i<string->value.str.len; i++) {
- tmp[i*4] = '[';
- tmp[i*4+1]=toupper((unsigned char)string->value.str.val[i]);
- tmp[i*4+2]=tolower((unsigned char)string->value.str.val[i]);
- tmp[i*4+3]=']';
- }
- tmp[string->value.str.len*4]=0;
-
- return_value->value.str.val = tmp;
- return_value->value.str.len = string->value.str.len*4;
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/*
- * 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 bb33aa768f..0000000000
--- a/ext/ereg/php_ereg.h
+++ /dev/null
@@ -1,48 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _REG_H
-#define _REG_H
-
-extern php3_module_entry regexp_module_entry;
-#define regexp_module_ptr &regexp_module_entry
-
-extern char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-extern void php3_ereg(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregi(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregireplace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_split(INTERNAL_FUNCTION_PARAMETERS);
-extern PHPAPI void php3_sql_regcase(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _REG_H */
diff --git a/ext/ereg/regex/COPYRIGHT b/ext/ereg/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/ext/ereg/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/ext/ereg/regex/Makefile.in b/ext/ereg/regex/Makefile.in
deleted file mode 100644
index 2ef89f767f..0000000000
--- a/ext/ereg/regex/Makefile.in
+++ /dev/null
@@ -1,141 +0,0 @@
-SHELL = /bin/sh
-
-srcdir=@srcdir@
-VPATH=@srcdir@
-
-CC=@CC@
-RANLIB=@RANLIB@
-
-# You probably want to take -DREDEBUG out of CFLAGS, and put something like
-# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
-# internal assertion checking and some debugging facilities).
-# Put -Dconst= in for a pre-ANSI compiler.
-# Do not take -DPOSIX_MISTAKE out.
-# REGCFLAGS isn't important to you (it's for my use in some special contexts).
-CFLAGS=-I$(srcdir) -DPOSIX_MISTAKE @CFLAGS@
-
-# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
-# the Berkeley __P macro, put -b in.
-MKHFLAGS=
-
-# Flags for linking but not compiling, if any.
-LDFLAGS=@LDFLAGS@
-
-# Extra libraries for linking, if any.
-LIBS=
-
-# Internal stuff, should not need changing.
-OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
-OBJS=$(OBJPRODN) split.o debug.o main.o
-H=cclass.h cname.h regex2.h utils.h
-REGSRC=regcomp.c regerror.c regexec.c regfree.c
-ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
-
-# Stuff that matters only if you're trying to lint the package.
-LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
-LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
-JUNKLINT=possible pointer alignment|null effect
-
-# arrangements to build forward-reference header files
-.SUFFIXES: .ih .h
-.c.ih:
- sh $(srcdir)/mkh $(MKHFLAGS) -p $< >$(srcdir)/$@
-
-all lib: libregex.a
-
-libregex.a: $(OBJPRODN)
- rm -f libregex.a
- ar cr libregex.a $(OBJPRODN)
- $(RANLIB) libregex.a
-
-default: r
-
-purge:
- rm -f *.o
-
-# stuff to build regex.h
-REGEXH=regex.h
-REGEXHSRC=regex2.h $(REGSRC)
-$(REGEXH): $(REGEXHSRC) mkh
- sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.h
- #cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
- #rm -f regex.tmp
-
-# dependencies
-$(OBJPRODN) debug.o: utils.h regex.h regex2.h
-regcomp.o: cclass.h cname.h regcomp.ih
-regexec.o: engine.c engine.ih
-regerror.o: regerror.ih
-debug.o: debug.ih
-main.o: main.ih
-
-# tester
-re: $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
-
-# regression test
-r: re tests
- ./re <tests
- ./re -el <tests
- ./re -er <tests
-
-# 57 variants, and other stuff, for development use -- not useful to you
-ra: ./re tests
- -./re <tests
- -./re -el <tests
- -./re -er <tests
-
-rx: ./re tests
- ./re -x <tests
- ./re -x -el <tests
- ./re -x -er <tests
-
-t: ./re tests
- -time ./re <tests
- -time ./re -cs <tests
- -time ./re -el <tests
- -time ./re -cs -el <tests
-
-l: $(LINTC)
- lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
-
-fullprint:
- ti README WHATSNEW notes todo | list
- ti *.h | list
- list *.c
- list regex.3 regex.7
-
-print:
- ti README WHATSNEW notes todo | list
- ti *.h | list
- list reg*.c engine.c
-
-
-mf.tmp: Makefile
- sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
-
-DTRH=cclass.h cname.h regex2.h utils.h
-PRE=COPYRIGHT README WHATSNEW
-POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
-FILES=$(PRE) Makefile $(POST)
-DTR=$(PRE) Makefile=mf.tmp $(POST)
-dtr: $(FILES) mf.tmp
- makedtr $(DTR) >$@
- rm mf.tmp
-
-cio: $(FILES)
- cio $(FILES)
-
-rdf: $(FILES)
- rcsdiff -c $(FILES) 2>&1 | p
-
-# various forms of cleanup
-tidy:
- rm -f junk* core core.* *.core dtr *.tmp lint
-
-clean: tidy
- rm -f *.o *.s re libregex.a
-
-# don't do this one unless you know what you're doing
-spotless: clean
- rm -f mkh regex.h
diff --git a/ext/ereg/regex/README b/ext/ereg/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/ext/ereg/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/ext/ereg/regex/WHATSNEW b/ext/ereg/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/ext/ereg/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/ext/ereg/regex/cclass.h b/ext/ereg/regex/cclass.h
deleted file mode 100644
index 727cbb9255..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 ff116e55e2..0000000000
--- a/ext/ereg/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- { "NUL", '\0' },
- { "SOH", '\001' },
- { "STX", '\002' },
- { "ETX", '\003' },
- { "EOT", '\004' },
- { "ENQ", '\005' },
- { "ACK", '\006' },
- { "BEL", '\007' },
- { "alert", '\007' },
- { "BS", '\010' },
- { "backspace", '\b' },
- { "HT", '\011' },
- { "tab", '\t' },
- { "LF", '\012' },
- { "newline", '\n' },
- { "VT", '\013' },
- { "vertical-tab", '\v' },
- { "FF", '\014' },
- { "form-feed", '\f' },
- { "CR", '\015' },
- { "carriage-return", '\r' },
- { "SO", '\016' },
- { "SI", '\017' },
- { "DLE", '\020' },
- { "DC1", '\021' },
- { "DC2", '\022' },
- { "DC3", '\023' },
- { "DC4", '\024' },
- { "NAK", '\025' },
- { "SYN", '\026' },
- { "ETB", '\027' },
- { "CAN", '\030' },
- { "EM", '\031' },
- { "SUB", '\032' },
- { "ESC", '\033' },
- { "IS4", '\034' },
- { "FS", '\034' },
- { "IS3", '\035' },
- { "GS", '\035' },
- { "IS2", '\036' },
- { "RS", '\036' },
- { "IS1", '\037' },
- { "US", '\037' },
- { "space", ' ' },
- { "exclamation-mark", '!' },
- { "quotation-mark", '"' },
- { "number-sign", '#' },
- { "dollar-sign", '$' },
- { "percent-sign", '%' },
- { "ampersand", '&' },
- { "apostrophe", '\'' },
- { "left-parenthesis", '(' },
- { "right-parenthesis", ')' },
- { "asterisk", '*' },
- { "plus-sign", '+' },
- { "comma", ',' },
- { "hyphen", '-' },
- { "hyphen-minus", '-' },
- { "period", '.' },
- { "full-stop", '.' },
- { "slash", '/' },
- { "solidus", '/' },
- { "zero", '0' },
- { "one", '1' },
- { "two", '2' },
- { "three", '3' },
- { "four", '4' },
- { "five", '5' },
- { "six", '6' },
- { "seven", '7' },
- { "eight", '8' },
- { "nine", '9' },
- { "colon", ':' },
- { "semicolon", ';' },
- { "less-than-sign", '<' },
- { "equals-sign", '=' },
- { "greater-than-sign", '>' },
- { "question-mark", '?' },
- { "commercial-at", '@' },
- { "left-square-bracket", '[' },
- { "backslash", '\\' },
- { "reverse-solidus", '\\' },
- { "right-square-bracket", ']' },
- { "circumflex", '^' },
- { "circumflex-accent", '^' },
- { "underscore", '_' },
- { "low-line", '_' },
- { "grave-accent", '`' },
- { "left-brace", '{' },
- { "left-curly-bracket", '{' },
- { "vertical-line", '|' },
- { "right-brace", '}' },
- { "right-curly-bracket", '}' },
- { "tilde", '~' },
- { "DEL", '\177' },
- { NULL, 0 }
-};
diff --git a/ext/ereg/regex/debug.c b/ext/ereg/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/ext/ereg/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/ext/ereg/regex/debug.ih b/ext/ereg/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/ext/ereg/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/engine.c b/ext/ereg/regex/engine.c
deleted file mode 100644
index 696774e1b3..0000000000
--- a/ext/ereg/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register unsigned int i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- register const sopno gf = g->firststate+1; /* +1 for OEND */
- register const sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return( NULL );
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register int i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/ext/ereg/regex/engine.ih b/ext/ereg/regex/engine.ih
deleted file mode 100644
index 1564a2f11f..0000000000
--- a/ext/ereg/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/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 ../../regex/mkh ========= */
diff --git a/ext/ereg/regex/main.c b/ext/ereg/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/ext/ereg/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/ext/ereg/regex/main.ih b/ext/ereg/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/ext/ereg/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/ext/ereg/regex/mkh b/ext/ereg/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/ext/ereg/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/ext/ereg/regex/regcomp.c b/ext/ereg/regex/regcomp.c
deleted file mode 100644
index 7f651bf845..0000000000
--- a/ext/ereg/regex/regcomp.c
+++ /dev/null
@@ -1,1546 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "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)) ? (NEXT1(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT1() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) ((void)((co) || SETERROR(e)))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT1();
-
- 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() != '}')
- NEXT1();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c &~ BACKSL);
- 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('\\', '}'))
- NEXT1();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT1();
- 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()))
- NEXT1();
- 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, ']'))
- NEXT1();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register unsigned int 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 unsigned int 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 unsigned int 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 unsigned int 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';
-}
-
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/ext/ereg/regex/regcomp.ih b/ext/ereg/regex/regcomp.ih
deleted file mode 100644
index ece1722f18..0000000000
--- a/ext/ereg/regex/regcomp.ih
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/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 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 ../../regex/mkh ========= */
diff --git a/ext/ereg/regex/regerror.c b/ext/ereg/regex/regerror.c
deleted file mode 100644
index 12edd4e164..0000000000
--- a/ext/ereg/regex/regerror.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_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_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" },
- { 0, "", "*** unknown regexp error code ***" }
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code != 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code != 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code != 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code == 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/ext/ereg/regex/regerror.ih b/ext/ereg/regex/regerror.ih
deleted file mode 100644
index 498a324f4b..0000000000
--- a/ext/ereg/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ../../regex/mkh ========= */
diff --git a/ext/ereg/regex/regex.3 b/ext/ereg/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/ext/ereg/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/ext/ereg/regex/regex.7 b/ext/ereg/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/ext/ereg/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/ext/ereg/regex/regex.dsp b/ext/ereg/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/ext/ereg/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/ext/ereg/regex/regex.dsw b/ext/ereg/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/ext/ereg/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/ext/ereg/regex/regex.h b/ext/ereg/regex/regex.h
deleted file mode 100644
index 162b2b0a34..0000000000
--- a/ext/ereg/regex/regex.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef _REGEX_H_
-#define _REGEX_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_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
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 3e8c0d65c4..0000000000
--- a/ext/ereg/regex/regex2.h
+++ /dev/null
@@ -1,138 +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 unsigned long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0xf8000000
-#define OPDMASK 0x07ffffff
-#define OPSHIFT ((unsigned)27)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16u<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17u<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18u<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19u<<OPSHIFT) /* begin word - */
-#define OEOW (20u<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-
-/* 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/regexec.c b/ext/ereg/regex/regexec.c
deleted file mode 100644
index a552f5a394..0000000000
--- a/ext/ereg/regex/regexec.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-#ifndef NDEBUG
-static int nope = 0; /* for use in asserts; shuts lint up */
-#endif
-
-/* macros for manipulating states, small version */
-#define states long
-#define states1 states /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~(1 << (n)))
-#define SET1(v, n) ((v) |= 1 << (n))
-#define ISSET(v, n) ((v) & (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 int
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/ext/ereg/regex/regfree.c b/ext/ereg/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/ext/ereg/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/ext/ereg/regex/split.c b/ext/ereg/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/ext/ereg/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/ext/ereg/regex/tests b/ext/ereg/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/ext/ereg/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/ext/ereg/regex/utils.h b/ext/ereg/regex/utils.h
deleted file mode 100644
index f271f759b1..0000000000
--- a/ext/ereg/regex/utils.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* utility definitions */
-#ifndef _POSIX2_RE_DUP_MAX
-#define _POSIX2_RE_DUP_MAX 255
-#endif
-
-#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/ext/gd/Makefile.am b/ext/gd/Makefile.am
deleted file mode 100644
index b2deac251d..0000000000
--- a/ext/gd/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
-noinst_LIBRARIES=libphpext_gd.a
-libphpext_gd_a_SOURCES=gd.c gdcache.c gdttf.c
diff --git a/ext/gd/config.h.stub b/ext/gd/config.h.stub
deleted file mode 100644
index 4e619595f7..0000000000
--- a/ext/gd/config.h.stub
+++ /dev/null
@@ -1,6 +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
-
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
deleted file mode 100644
index 7a2891ef03..0000000000
--- a/ext/gd/config.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-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).],
-[
- case "$withval" in
- no)
- AC_MSG_RESULT(no) ;;
- yes)
- GD_LIBS="-lgd"
- AC_DEFINE(HAVE_LIBGD)
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
- 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="-I$withval/include/gd1.3"
- test -f $withval/include/gd/gd.h && GD_INCLUDE="-I$withval/include/gd"
- test -f $withval/include/gd.h && GD_INCLUDE="-I$withval/include"
- test -f $withval/gd1.3/gd.h && GD_INCLUDE="-I$withval/gd1.3"
- test -f $withval/gd/gd.h && GD_INCLUDE="-I$withval/gd"
- test -f $withval/gd.h && GD_INCLUDE="-I$withval"
-
- 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
- GD_LIBS="-L$GD_LIB -lgd"
- AC_DEFINE(HAVE_LIBGD)
- AC_MSG_RESULT(yes)
- AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
- ac_cv_lib_gd_gdImageLine=yes
- else
- AC_MSG_RESULT(no)
- 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
- if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
- GD_INCLUDE="-I/usr/pkg/include/gd"
- fi
- AC_CHECK_LIB(ttf, TT_Open_Face)
- PHP_EXTENSION(gd)
- EXTRA_LIBS="$EXTRA_LIBS $GD_LIBS"
- INCLUDES="$INCLUDES $GD_INCLUDE"
-fi
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
deleted file mode 100644
index 32a980254f..0000000000
--- a/ext/gd/gd.c
+++ /dev/null
@@ -1,1786 +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 <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@guardian.no> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
- Cold Spring Harbor Labs. */
-
-/* Note that there is no code from the gd package in this file */
-#ifdef THREAD_SAFE
-# include "tls.h"
-#endif
-#include "php.h"
-#include "functions/head.h"
-#include <math.h>
-#include "php3_gd.h"
-
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#if WIN32|WINNT
-# include <io.h>
-# include <fcntl.h>
-#endif
-
-#if HAVE_LIBGD
-#include <gd.h>
-#include <gdfontt.h> /* 1 Tiny font */
-#include <gdfonts.h> /* 2 Small font */
-#include <gdfontmb.h> /* 3 Medium bold font */
-#include <gdfontl.h> /* 4 Large font */
-#include <gdfontg.h> /* 5 Giant font */
-#if HAVE_LIBTTF
-# if PHP_31
-# include "gdttf.h"
-# else
-# include "functions/gdttf.h"
-# endif
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-#if HAVE_LIBTTF
-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[] = {
- {"imagearc", php3_imagearc, NULL},
- {"imagechar", php3_imagechar, NULL},
- {"imagecharup", php3_imagecharup, NULL},
- {"imagecolorallocate", php3_imagecolorallocate, NULL},
- {"imagecolorat", php3_imagecolorat, NULL},
- {"imagecolorclosest", php3_imagecolorclosest, NULL},
- {"imagecolordeallocate", php3_imagecolordeallocate, NULL},
- {"imagecolorresolve", php3_imagecolorresolve, NULL},
- {"imagecolorexact", php3_imagecolorexact, NULL},
- {"imagecolorset", php3_imagecolorset, NULL},
- {"imagecolortransparent", php3_imagecolortransparent, NULL},
- {"imagecolorstotal", php3_imagecolorstotal, NULL},
- {"imagecolorsforindex", php3_imagecolorsforindex, NULL},
- {"imagecopy", php3_imagecopy, NULL},
- {"imagecopyresized", php3_imagecopyresized, NULL},
- {"imagecreate", php3_imagecreate, NULL},
- {"imagecreatefromgif", php3_imagecreatefromgif, NULL},
- {"imagedestroy", php3_imagedestroy, NULL},
- {"imagefill", php3_imagefill, NULL},
- {"imagefilledpolygon", php3_imagefilledpolygon, NULL},
- {"imagefilledrectangle", php3_imagefilledrectangle, NULL},
- {"imagefilltoborder", php3_imagefilltoborder, NULL},
- {"imagefontwidth", php3_imagefontwidth, NULL},
- {"imagefontheight", php3_imagefontheight, NULL},
- {"imagegif", php3_imagegif, NULL},
- {"imageinterlace", php3_imageinterlace, NULL},
- {"imageline", php3_imageline, NULL},
- {"imageloadfont", php3_imageloadfont, NULL},
- {"imagepolygon", php3_imagepolygon, NULL},
- {"imagerectangle", php3_imagerectangle, NULL},
- {"imagesetpixel", php3_imagesetpixel, NULL},
- {"imagestring", php3_imagestring, NULL},
- {"imagestringup", php3_imagestringup, NULL},
- {"imagesx", php3_imagesxfn, NULL},
- {"imagesy", php3_imagesyfn, NULL},
- {"imagedashedline", php3_imagedashedline, NULL},
-#if HAVE_LIBTTF
- {"imagettfbbox", php3_imagettfbbox, NULL},
- {"imagettftext", php3_imagettftext, NULL},
-#endif
- {NULL, NULL, NULL}
-};
-
-php3_module_entry gd_module_entry = {
- "gd", gd_functions, php3_minit_gd, php3_mend_gd, NULL, NULL, php3_info_gd, STANDARD_MODULE_PROPERTIES
-};
-
-#if COMPILE_DL
-# if PHP_31
-# include "../phpdl.h"
-# else
-# include "dl/phpdl.h"
-# endif
-DLEXPORT php3_module_entry *get_module(void) { return &gd_module_entry; }
-#endif
-
-
-#define PolyMaxPoints 256
-
-
-int php3_minit_gd(INIT_FUNC_ARGS)
-{
-#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;
-}
-
-void php3_info_gd(void) {
- /* need to use a PHPAPI function here because it is external module in windows */
-#if HAVE_LIBGD13
- php3_printf("Version 1.3");
-#else
- php3_printf("Version 1.2");
-#endif
-#if HAVE_LIBTTF
- php3_printf(" with FreeType support");
-#endif
-}
-
-int php3_mend_gd(void){
- 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;
-}
-
-/********************************************************************/
-/* 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 */
-}
-
-void php3_free_gd_font(gdFontPtr fp)
-{
- if (fp->data) {
- efree(fp->data);
- }
- efree(fp);
-}
-
-/* {{{ proto int imageloadfont(string filename)
-Load a new font */
-void php3_imageloadfont(INTERNAL_FUNCTION_PARAMETERS) {
- 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);
-#endif
- if (fp == NULL) {
- php3_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)) {
- php3_error(E_WARNING, "ImageFontLoad: end of file while reading header");
- } else {
- php3_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)) {
- php3_error(E_WARNING, "ImageFontLoad: end of file while reading body");
- } else {
- php3_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 */
-void php3_imagecreate(INTERNAL_FUNCTION_PARAMETERS) {
- 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);
-}
-/* }}} */
-
-/* {{{ proto int imagecreatefromgif(string filename)
-Create a new image from file or URL */
-void php3_imagecreatefromgif (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);
-#endif
- if (!fp) {
- php3_strip_url_passwd(fn);
- php3_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 imagedestroy(int im)
-Destroy an image */
-void php3_imagedestroy(INTERNAL_FUNCTION_PARAMETERS) {
- 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 */
-void php3_imagecolorallocate(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorat(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorclosest(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolordeallocate(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_error(E_WARNING, "ImageColorDeallocate: Unable to find image pointer");
- RETURN_FALSE;
- }
-
- if (col >= 0 && col < gdImageColorsTotal(im)) {
- gdImageColorDeallocate(im, col);
- RETURN_TRUE;
- }
- else {
- php3_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 */
-void php3_imagecolorresolve(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorexact(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorset(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorsforindex(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 {
- php3_error(E_WARNING, "Color index out of range");
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int imagegif(int im, string filename)
-Output image to browser or file */
-void php3_imagegif (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, "ImageGif: 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, "ImageGif: unable to find image pointer");
- RETURN_FALSE;
- }
-
- if (argc == 2) {
- fp = fopen(fn, "wb");
- if (!fp) {
- php3_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) {
- php3_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)
- /* 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;
-}
-/* }}} */
-
-/* {{{ proto int imagesetpixel(int im, int x, int y, int col)
-Set a single pixel */
-void php3_imagesetpixel(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imageline(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagedashedline(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagerectangle(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagefilledrectangle(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagearc(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagefilltoborder(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagefill(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolorstotal(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imagecolortransparent(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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 */
-void php3_imageinterlace(INTERNAL_FUNCTION_PARAMETERS) {
- 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)) {
- php3_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)) {
- php3_error(E_WARNING, "Unable to find image pointer");
- RETURN_FALSE;
- }
-
- if (POINTS->type != IS_ARRAY) {
- php3_error(E_WARNING, "2nd argument to imagepolygon not an array");
- RETURN_FALSE;
- }
-
-/*
- ** we shouldn't need this check, should we? **
-
- if (!ParameterPassedByReference(ht, 2)) {
- php3_error(E_WARNING, "2nd argument to imagepolygon not passed by reference");
- RETURN_FALSE;
- }
-*/
-
- nelem = _php3_hash_num_elements(POINTS->value.ht);
- if (nelem < 6) {
- php3_error(E_WARNING,
- "you must have at least 3 points in your array");
- RETURN_FALSE;
- }
-
- if (nelem < npoints * 2) {
- php3_error(E_WARNING,
- "trying to use %d points in array with only %d points",
- npoints, nelem/2);
- RETURN_FALSE;
- }
-
- if (npoints > PolyMaxPoints) {
- php3_error(E_WARNING, "maximum %d points", PolyMaxPoints);
- RETURN_FALSE;
- }
-
- for (i = 0; i < npoints; i++) {
- if (_php3_hash_index_find(POINTS->value.ht, (i * 2), (void **)&var) == SUCCESS) {
- convert_to_long(var);
- points[i].x = var->value.lval;
- }
- if (_php3_hash_index_find(POINTS->value.ht, (i * 2) + 1, (void **)&var) == SUCCESS) {
- 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 */
-void php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_imagepolygon(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefilledpolygon(int im, array point, int num_points, int col)
-Draw a filled polygon */
-void php3_imagefilledpolygon(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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 */
-void php3_imagefontwidth(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_imagefontsize(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int imagefontheight(int font)
-Get font height */
-void php3_imagefontheight(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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)) {
- php3_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 */
-void php3_imagechar(INTERNAL_FUNCTION_PARAMETERS) {
- _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 */
-void php3_imagecharup(INTERNAL_FUNCTION_PARAMETERS) {
- _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 */
-void php3_imagestring(INTERNAL_FUNCTION_PARAMETERS) {
- _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 */
-void php3_imagestringup(INTERNAL_FUNCTION_PARAMETERS) {
- _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 */
-void php3_imagecopy(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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)) {
- php3_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)) {
- php3_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 */
-void php3_imagecopyresized(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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)) {
- php3_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)) {
- php3_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 */
-void php3_imagesxfn(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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)) {
- php3_error(E_WARNING, "Unable to find image pointer");
- RETURN_FALSE;
- }
-
- RETURN_LONG(gdImageSX(im));
-}
-/* }}} */
-
-/* {{{ proto int imagesy(int im)
-Get image height */
-void php3_imagesyfn(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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)) {
- php3_error(E_WARNING, "Unable to find image pointer");
- RETURN_FALSE;
- }
-
- RETURN_LONG(gdImageSY(im));
-}
-/* }}} */
-
-#if HAVE_LIBTTF
-
-#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 */
-void php3_imagettfbbox(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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 */
-void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS)
-{
- 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)) {
- php3_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) {
- php3_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 3fd82dea70..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 HAVE_LIBTTF 1
-#else
-#include "config.h"
-#endif
-#if HAVE_LIBTTF
-
-#include "gdcache.h"
-
-/*********************************************************/
-/* implementation */
-/*********************************************************/
-
-
-/* create a new cache */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease )
-{
- gdCache_head_t *head;
-
- head = (gdCache_head_t *)malloc(sizeof(gdCache_head_t));
- head->mru = NULL;
- head->size = size;
- head->gdCacheTest = gdCacheTest;
- head->gdCacheFetch = gdCacheFetch;
- head->gdCacheRelease = gdCacheRelease;
- return head;
-}
-
-void
-gdCacheDelete( gdCache_head_t *head )
-{
- gdCache_element_t *elem, *prev;
-
- elem = head->mru;
- while(elem) {
- (*(head->gdCacheRelease))(elem->userdata);
- prev = elem;
- elem = elem->next;
- free((char *)prev);
- }
- free((char *)head);
-}
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata )
-{
- int i=0;
- gdCache_element_t *elem, *prev = NULL, *prevprev = NULL;
- void *userdata;
-
- elem = head->mru;
- while(elem) {
- if ((*(head->gdCacheTest))(elem->userdata, keydata)) {
- if (i) { /* if not already most-recently-used */
- /* relink to top of list */
- prev->next = elem->next;
- elem->next = head->mru;
- head->mru = elem;
- }
- return elem->userdata;
- }
- prevprev = prev;
- prev = elem;
- elem = elem->next;
- i++;
- }
- userdata = (*(head->gdCacheFetch))(&(head->error), keydata);
- if (! userdata) {
- /* if there was an error in the fetch then don't cache */
- return NULL;
- }
- if (i < head->size) { /* cache still growing - add new elem */
- elem = (gdCache_element_t *)malloc(sizeof(gdCache_element_t));
- }
- else { /* cache full - replace least-recently-used */
- /* preveprev becomes new end of list */
- prevprev->next = NULL;
- elem = prev;
- (*(head->gdCacheRelease))(elem->userdata);
- }
- /* relink to top of list */
- elem->next = head->mru;
- head->mru = elem;
- elem->userdata = userdata;
- return userdata;
-}
-
-
-
-/*********************************************************/
-/* test stub */
-/*********************************************************/
-
-
-#ifdef GDCACHE_TEST
-
-#include <stdio.h>
-
-typedef struct {
- int key;
- int value;
-} key_value_t;
-
-static int
-cacheTest( void *map, void *key )
-{
- return (((key_value_t *)map)->key == *(int *)key);
-}
-
-static void *
-cacheFetch( char **error, void *key )
-{
- key_value_t *map;
-
- map = (key_value_t *)malloc(sizeof(key_value_t));
- map->key = *(int *)key;
- map->value = 3;
-
- *error = NULL;
- return (void *)map;
-}
-
-static void
-cacheRelease( void *map)
-{
- free( (char *)map );
-}
-
-int
-main(char *argv[], int argc)
-{
- gdCache_head_t *cacheTable;
- int elem, key;
-
- cacheTable = gdCacheCreate(3, cacheTest, cacheFetch, cacheRelease);
-
- key = 20;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 40;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 50;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
- key = 30;
- elem = *(int *)gdCacheGet(cacheTable, &key);
-
- gdCacheDelete(cacheTable);
-
- return 0;
-}
-
-#endif
-
-#endif /* HAVE_LIBTTF */
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 <malloc.h>
-#else
-#include <stdlib.h> /* BS2000/OSD defines malloc() & friends in stdlib.h */
-#endif
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
-/* user defined function templates */
-typedef int (*gdCacheTestFn_t)(void *userdata, void *keydata);
-typedef void *(*gdCacheFetchFn_t)(char **error, void *keydata);
-typedef void (*gdCacheReleaseFn_t)(void *userdata);
-
-/* element structure */
-typedef struct gdCache_element_s gdCache_element_t;
-struct gdCache_element_s {
- gdCache_element_t *next;
- void *userdata;
-};
-
-/* head structure */
-typedef struct gdCache_head_s gdCache_head_t;
-struct gdCache_head_s {
- gdCache_element_t *mru;
- int size;
- char *error;
- gdCacheTestFn_t gdCacheTest;
- gdCacheFetchFn_t gdCacheFetch;
- gdCacheReleaseFn_t gdCacheRelease;
-};
-
-/* function templates */
-gdCache_head_t *
-gdCacheCreate(
- int size,
- gdCacheTestFn_t gdCacheTest,
- gdCacheFetchFn_t gdCacheFetch,
- gdCacheReleaseFn_t gdCacheRelease );
-
-void
-gdCacheDelete( gdCache_head_t *head );
-
-void *
-gdCacheGet( gdCache_head_t *head, void *keydata );
diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c
deleted file mode 100644
index 39e93ed339..0000000000
--- a/ext/gd/gdttf.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/* gd interface to freetype library */
-/* */
-/* John Ellson ellson@lucent.com */
-
-/* $Id$ */
-
-#if WIN32|WINNT
-#include "config.w32.h"
-#else
-#include "config.h"
-#endif
-#if HAVE_LIBTTF
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <gd.h>
-#include "gdttf.h"
-#include "gdcache.h"
-#include <freetype.h>
-
-/* number of fonts cached before least recently used is replaced */
-#define FONTCACHESIZE 6
-
-/* number of character glyphs cached per font before
- least-recently-used is replaced */
-#define GLYPHCACHESIZE 120
-
-/* number of bitmaps cached per glyph before
- least-recently-used is replaced */
-#define BITMAPCACHESIZE 8
-
-/* number of antialias color lookups cached */
-#define TWEENCOLORCACHESIZE 32
-
-/* ptsize below which anti-aliasing is ineffective */
-#define MINANTIALIASPTSIZE 0
-
-/* display resolution - (Not really. This has to be 72 or hinting is wrong) */
-#define RESOLUTION 72
-
-/* Number of colors used for anti-aliasing */
-#define NUMCOLORS 4
-
-/* Line separation as a factor of font height.
- No space between if LINESPACE = 1.00
- Line separation will be rounded up to next pixel row*/
-#define LINESPACE 1.05
-
-#ifndef TRUE
-#define FALSE 0
-#define TRUE !FALSE
-#endif
-
-#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);
-
-/* This prototype is missing from gd.h */
-/* FIXME Since when does GD have this function??? My copy of 1.3 doesnt
-int gdImageColorResolve(gdImagePtr im, int r, int g, int b);
-*/
-
-/********************************************************************/
-/* 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 */
-
-static 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 */
-}
-
-/********************************************************************
- * gdTcl_UtfToUniChar is borrowed from ...
- */
-/*
- * tclUtf.c --
- *
- * Routines for manipulating UTF-8 strings.
- *
- * Copyright (c) 1997-1998 Sun Microsystems, Inc.
- *
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- *
- * SCCS: @(#) tclUtf.c 1.25 98/01/28 18:02:43
- */
-
-/*
- *---------------------------------------------------------------------------
- *
- * gdTcl_UtfToUniChar --
- *
- * Extract the Tcl_UniChar represented by the UTF-8 string. Bad
- * UTF-8 sequences are converted to valid Tcl_UniChars and processing
- * continues. Equivalent to Plan 9 chartorune().
- *
- * The caller must ensure that the source buffer is long enough that
- * this routine does not run off the end and dereference non-existent
- * memory looking for trail bytes. If the source buffer is known to
- * be '\0' terminated, this cannot happen. Otherwise, the caller
- * should call Tcl_UtfCharComplete() before calling this routine to
- * ensure that enough bytes remain in the string.
- *
- * Results:
- * *chPtr is filled with the Tcl_UniChar, and the return value is the
- * number of bytes from the UTF-8 string that were consumed.
- *
- * Side effects:
- * None.
- *
- *---------------------------------------------------------------------------
- */
-
-#ifndef CHARSET_EBCDIC
-#define ASC(ch) (ch)
-#else /*CHARSET_EBCDIC*/
-#define ASC(ch) os_toascii[(unsigned char) (ch)]
-#endif /*CHARSET_EBCDIC*/
-
-#define Tcl_UniChar int
-#define TCL_UTF_MAX 3
-static int
-gdTcl_UtfToUniChar(char *str, Tcl_UniChar *chPtr)
-/* str is the UTF8 next character pointer */
-/* chPtr is the int for the result */
-{
- int byte;
-
- /* HTML4.0 entities in decimal form, e.g. &#197; */
- byte = *((unsigned char *) str);
- if (byte == '&') {
- int i, n=0;
-
- byte = *((unsigned char *) (str+1));
- if (byte == '#') {
- for (i = 2; i < 8; i++) {
- byte = *((unsigned char *) (str+i));
- if (byte >= '0' && byte <= '9') {
- n = (n * 10) + (byte - '0');
- }
- else
- break;
- }
- if (byte == ';') {
- *chPtr = (Tcl_UniChar) n;
- return ++i;
- }
- }
- }
-
- /*
- * Unroll 1 to 3 byte UTF-8 sequences, use loop to handle longer ones.
- */
-
- byte = ASC(*((unsigned char *) str));
- if (byte < 0xC0) {
- /*
- * Handles properly formed UTF-8 characters between 0x01 and 0x7F.
- * Also treats \0 and naked trail bytes 0x80 to 0xBF as valid
- * characters representing themselves.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xE0) {
- if ((ASC(str[1]) & 0xC0) == 0x80) {
- /*
- * Two-byte-character lead-byte followed by a trail-byte.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x1F) << 6) | (ASC(str[1]) & 0x3F));
- return 2;
- }
- /*
- * A two-byte-character lead-byte not followed by trail-byte
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- } else if (byte < 0xF0) {
- if (((ASC(str[1]) & 0xC0) == 0x80) && ((ASC(str[2]) & 0xC0) == 0x80)) {
- /*
- * Three-byte-character lead byte followed by two trail bytes.
- */
-
- *chPtr = (Tcl_UniChar) (((byte & 0x0F) << 12)
- | ((ASC(str[1]) & 0x3F) << 6) | (ASC(str[2]) & 0x3F));
- return 3;
- }
- /*
- * A three-byte-character lead-byte not followed by two trail-bytes
- * represents itself.
- */
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
- }
-#if TCL_UTF_MAX > 3
- else {
- int ch, total, trail;
-
- total = totalBytes[byte];
- trail = total - 1;
- if (trail > 0) {
- ch = byte & (0x3F >> trail);
- do {
- str++;
- if ((ASC(*str) & 0xC0) != 0x80) {
- *chPtr = byte;
- return 1;
- }
- ch <<= 6;
- ch |= (ASC(*str) & 0x3F);
- trail--;
- } while (trail > 0);
- *chPtr = ch;
- return total;
- }
- }
-#endif
-
- *chPtr = (Tcl_UniChar) byte;
- return 1;
-}
-
-/********************************************************************/
-/* font cache functions */
-
-static int
-fontTest ( void *element, void *key )
-{
- font_t *a=(font_t *)element;
- fontkey_t *b=(fontkey_t *)key;
-
- return ( strcmp(a->fontname, b->fontname) == 0
- && a->ptsize == b->ptsize
- && a->angle == b->angle);
-}
-
-static void *
-fontFetch ( char **error, void *key )
-{
- TT_Error err;
- font_t *a;
- fontkey_t *b=(fontkey_t *)key;
- int i, n;
- 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 (err == TT_Err_Could_Not_Open_File) {
- *error = "Could not find/open font";
- }
- else {
- *error = "Could not read font";
- }
- return NULL;
- }
- /* get face properties and allocate preload arrays */
- TT_Get_Face_Properties(a->face, &a->properties);
-
- /* create instance */
- if (TT_New_Instance(a->face, &a->instance)) {
- *error = "Could not create face instance";
- return NULL;
- }
-
- if (TT_Set_Instance_Resolutions(a->instance, RESOLUTION, RESOLUTION)) {
- *error = "Could not set device resolutions";
- return NULL;
- }
-
- 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 */
-
-/*
- * 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/php3_gd.h b/ext/gd/php3_gd.h
deleted file mode 100644
index d65213f9ef..0000000000
--- a/ext/gd/php3_gd.h
+++ /dev/null
@@ -1,102 +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 <rasmus@lerdorf.on.ca> |
- | Stig Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHP3_GD_H
-#define _PHP3_GD_H
-
-#if COMPILE_DL
-#undef HAVE_LIBGD
-#define HAVE_LIBGD 1
-#endif
-
-#if HAVE_LIBGD
-
-#include <gd.h>
-
-extern php3_module_entry gd_module_entry;
-#define gd_module_ptr &gd_module_entry
-
-/* gd.c functions */
-extern void php3_info_gd(void);
-extern int php3_minit_gd(INIT_FUNC_ARGS);
-extern int php3_mend_gd(void);
-extern int gdImageColorResolve(gdImagePtr, int, int, int);
-extern void php3_imagearc(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagechar(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecharup(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorallocate(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorat(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorclosest(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolordeallocate(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorresolve(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorexact(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorset(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorstotal(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolorsforindex(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecolortransparent(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecopy(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecopyresized(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecreate(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagecreatefromgif (INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagedestroy(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefill(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefilledpolygon(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefilledrectangle(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefilltoborder(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefontwidth(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagefontheight(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagegif (INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imageinterlace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imageline(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imageloadfont(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagerectangle(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagesetpixel(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagestring(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagestringup(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagesxfn(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagesyfn(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_free_gd_font(gdFontPtr);
-extern void _php3_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
-extern void php3_imagedashedline(INTERNAL_FUNCTION_PARAMETERS);
-#ifdef HAVE_LIBTTF
-extern void php3_imagettfbbox(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_imagettftext(INTERNAL_FUNCTION_PARAMETERS);
-#endif
-#else
-
-#define gd_module_ptr NULL
-
-#endif
-
-#endif /* _PHP3_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/odbc/Makefile.am b/ext/odbc/Makefile.am
deleted file mode 100644
index 9f78717c5d..0000000000
--- a/ext/odbc/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-## Process this file with automake to produce Makefile.in
-INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
-noinst_LIBRARIES=libphpext_odbc.a
-libphpext_odbc_a_SOURCES=odbc.c velocis.c
diff --git a/ext/odbc/config.h.stub b/ext/odbc/config.h.stub
deleted file mode 100644
index 74771af292..0000000000
--- a/ext/odbc/config.h.stub
+++ /dev/null
@@ -1,9 +0,0 @@
-#define HAVE_SOLID 0
-#define HAVE_IODBC 0
-#define HAVE_OPENLINK 0
-#define HAVE_ADABAS 0
-#define HAVE_CODBC 0
-#define HAVE_UODBC 0
-#define HAVE_EMPRESS 0
-#define HAVE_VELOCIS 0
-
diff --git a/ext/odbc/config.m4 b/ext/odbc/config.m4
deleted file mode 100644
index e1429cd8bf..0000000000
--- a/ext/odbc/config.m4
+++ /dev/null
@@ -1,263 +0,0 @@
-dnl ODBC_INCDIR
-dnl ODBC_INCLUDE
-dnl ODBC_LIBDIR
-dnl ODBC_LIBS
-dnl ODBC_LFLAGS
-
-dnl
-dnl Figure out which library file to link with for the Solid support.
-dnl
-AC_DEFUN(AC_FIND_SOLID_LIBS,[
- AC_MSG_CHECKING([Solid library file])
- ac_solid_uname_s=`uname -s 2>/dev/null`
- case $ac_solid_uname_s in
- AIX) ac_solid_os=a3x;;
- HP-UX) ac_solid_os=h9x;;
- IRIX) ac_solid_os=irx;;
- Linux) ac_solid_os=lux;;
- SunOS) ac_solid_os=ssx;; # should we deal with SunOS 4?
- FreeBSD) ac_solid_os=fbx;;
- # "uname -s" on SCO makes no sense.
- esac
- ODBC_LIBS=`echo $1/scl${ac_solid_os}*.so | cut -d' ' -f1`
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/scl${ac_solid_os}*.a | cut -d' ' -f1`
- fi
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
- fi
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
- fi
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/bcl${ac_solid_os}*.so | cut -d' ' -f1`
- fi
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/bcl${ac_solid_os}*.a | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-dnl
-dnl Figure out which library file to link with for the Empress support.
-dnl
-AC_DEFUN(AC_FIND_EMPRESS_LIBS,[
- AC_MSG_CHECKING([Empress library file])
- ODBC_LIBS=`echo $1/empodbc.so | cut -d' ' -f1`
- if test ! -f $ODBC_LIBS; then
- ODBC_LIBS=`echo $1/empodbc.a | cut -d' ' -f1`
- fi
- AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
-])
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Adabas support)
-AC_ARG_WITH(adabas,
-[ --with-adabas[=DIR] Include Adabas D support. DIR is the Adabas base
- install directory, defaults to /usr/local.],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/incl
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$ADA_LIBDIR
- ODBC_INCLUDE=-I$ADA_INCDIR
- ODBC_LIBS="${ADA_LIBDIR}/odbclib.a -lsqlrte -lsqlptc"
- ODBC_TYPE=adabas
- AC_DEFINE(HAVE_ADABAS)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Solid support)
-AC_ARG_WITH(solid,
-[ --with-solid[=DIR] Include Solid support. DIR is the Solid base
- install directory, defaults to /usr/local/solid],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local/solid
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=solid
- AC_DEFINE(HAVE_SOLID)
- AC_MSG_RESULT(yes)
- AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Empress support)
-AC_ARG_WITH(empress,
-[ --with-empress[=DIR] Include Empress support. DIR is the Empress base
- install directory, defaults to \$EMPRESSPATH],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=$EMPRESSPATH/odbccl/include
- ODBC_LIBDIR=$EMPRESSPATH/odbccl/lib
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_TYPE=empress
- AC_DEFINE(HAVE_EMPRESS)
- AC_MSG_RESULT(yes)
- AC_FIND_EMPRESS_LIBS($ODBC_LIBDIR)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for Velocis support)
-AC_ARG_WITH(velocis,
-[ --with-velocis[=DIR] Include Velocis support. DIR is the Velocis
- base install directory, defaults to /usr/local/velocis.],
-[
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- ODBC_INCDIR=/usr/local/velocis/include
- ODBC_LIBDIR=/usr/local/velocis
- else
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval
- fi
- ODBC_INCLUDE=-I$ODBC_INCDIR
- ODBC_LIBDIR="$ODBC_LIBDIR/bin"
- case `uname` in
- FreeBSD|BSD/OS)
- ODBC_LIBS="$ODBC_LIBDIR/../lib/rdscli.a -lcompat";;
- *)
- ODBC_LIBS="-l_rdbc -l_sql";;
- esac
- ODBC_TYPE=velocis
- AC_DEFINE(HAVE_VELOCIS)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for a custom ODBC support)
-AC_ARG_WITH(custom-odbc,
-[ --with-custom-odbc[=DIR] Include a user defined ODBC support.
- The DIR is ODBC install base directory,
- which defaults to /usr/local.
- Make sure to define CUSTOM_ODBC_LIBS and
- have some odbc.h in your include dirs.
- E.g., you should define following for
- Sybase SQL Anywhere 5.5.00 on QNX, prior to
- run configure script:
- CFLAGS=\"-DODBC_QNX -DSQLANY_BUG\"
- LDFLAGS=-lunix
- CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\".],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$CODBC_LIBDIR
- ODBC_INCLUDE=-I$CODBC_INCDIR
- ODBC_LIBS=$CUSTOM_ODBC_LIBS
- ODBC_TYPE=custom
- AC_DEFINE(HAVE_CODBC)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for iODBC support)
-AC_ARG_WITH(iodbc,
-[ --with-iodbc[=DIR] Include iODBC support. DIR is the iODBC base
- install directory, defaults to /usr/local.],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/include
- ODBC_LIBDIR=$withval/lib
- ODBC_LFLAGS=-L$IODBC_LIBDIR
- ODBC_INCLUDE=-I$IODBC_INCDIR
- ODBC_LIBS=-liodbc
- ODBC_TYPE=iodbc
- AC_DEFINE(HAVE_IODBC)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -z "$ODBC_TYPE"; then
-AC_MSG_CHECKING(for OpenLink ODBC support)
-AC_ARG_WITH(openlink,
-[ --with-openlink[=DIR] Include OpenLink ODBC support. DIR is the
- OpenLink base install directory, defaults to
- /usr/local/openlink.],
-[
- if test "$withval" = "yes"; then
- withval=/usr/local/openlink
- fi
- if test "$withval" != "no"; then
- ODBC_INCDIR=$withval/odbcsdk/include
- ODBC_LIBDIR=$withval/odbcsdk/lib
- ODBC_LFLAGS=-L$OPENLINK_LIBDIR
- ODBC_INCLUDE=-I$OPENLINK_INCDIR
- ODBC_LIBS=-liodbc
- ODBC_TYPE=openlink
- AC_DEFINE(HAVE_OPENLINK)
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-],[
- AC_MSG_RESULT(no)
-])
-fi
-
-if test -n "$ODBC_TYPE"; then
- INCLUDES="$INCLUDES $ODBC_INCLUDE"
- EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS"
- AC_DEFINE(HAVE_UODBC, 1)
- AC_SUBST(ODBC_INCDIR)
- AC_SUBST(ODBC_INCLUDE)
- AC_SUBST(ODBC_LIBDIR)
- AC_SUBST(ODBC_LIBS)
- AC_SUBST(ODBC_LFLAGS)
- AC_SUBST(ODBC_TYPE)
- PHP_EXTENSION(odbc)
-fi
diff --git a/ext/odbc/odbc.c b/ext/odbc/odbc.c
deleted file mode 100644
index 254feb9f48..0000000000
--- a/ext/odbc/odbc.c
+++ /dev/null
@@ -1,2167 +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 <ssb@fast.no> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- | Frank M. Kromann <fmk@businessnet.dk> Support for DB/2 CLI |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* This file is based on the Adabas D extension.
- * Adabas D will no longer be supported as separate module.
- */
-#include "php.h"
-
-#undef THREAD_SAFE
-
-#if HAVE_UODBC
-
-# if !(WIN32|WINNT)
-# include "config.h"
-# include "build-defs.h"
-# endif
-
-# include <fcntl.h>
-
-# include "dl/phpdl.h"
-# include "ext/standard/php3_standard.h"
-# include "php3_odbc.h"
-# include "functions/head.h"
-# include "snprintf.h"
-# include "php_ini.h"
-
-# ifndef ZS
-php_odbc_globals odbc_globals;
-# endif
-
-function_entry odbc_functions[] = {
- PHP_FE(odbc_setoption, NULL)
- PHP_FE(odbc_autocommit, NULL)
- PHP_FE(odbc_close, NULL)
- PHP_FE(odbc_close_all, NULL)
- PHP_FE(odbc_commit, NULL)
- PHP_FE(odbc_connect, NULL)
- PHP_FE(odbc_pconnect, NULL)
- PHP_FE(odbc_cursor, NULL)
- PHP_FE(odbc_exec, NULL)
- PHP_FE(odbc_prepare, NULL)
- PHP_FE(odbc_execute, NULL)
- PHP_FE(odbc_fetch_row, NULL)
- PHP_FE(odbc_fetch_into, NULL)
- PHP_FE(odbc_field_len, NULL)
- PHP_FE(odbc_field_name, NULL)
- PHP_FE(odbc_field_type, NULL)
- PHP_FE(odbc_field_num, NULL)
- PHP_FE(odbc_free_result, NULL)
- PHP_FE(odbc_num_fields, NULL)
- PHP_FE(odbc_num_rows, NULL)
- PHP_FE(odbc_result, NULL)
- PHP_FE(odbc_result_all, NULL)
- PHP_FE(odbc_rollback, NULL)
- PHP_FE(odbc_binmode, NULL)
- PHP_FE(odbc_longreadlen, NULL)
- PHP_FALIAS(odbc_do, odbc_exec, NULL)
- { NULL, NULL, NULL }
-};
-
-php3_module_entry odbc_module_entry = {
- "ODBC",
- odbc_functions,
- php3_minit_odbc,
- php3_mshutdown_odbc,
- php3_rinit_odbc,
- NULL,
- php3_info_odbc,
- STANDARD_MODULE_PROPERTIES
-};
-
-
-#if COMPILE_DL
-DLEXPORT php3_module_entry *get_module() { return &odbc_module_entry; };
-#endif
-
-
-static void _free_result(odbc_result *res)
-{
- int i;
-
- if (res){
- if (res->values) {
- for(i = 0; i < res->numcols; i++){
- if (res->values[i].value)
- efree(res->values[i].value);
- }
- efree(res->values);
- res->values = NULL;
- }
- if (res->stmt){
-#if HAVE_SOLID
- SQLTransact(ODBCG(henv), res->conn_ptr->hdbc,
- (UWORD)SQL_COMMIT);
-#endif
- SQLFreeStmt(res->stmt,SQL_DROP);
-#if !HAVE_DB2
- res->stmt = NULL;
-#endif
- }
- efree(res);
- }
-}
-
-static int _results_cleanup(list_entry *le)
-{
- ODBC_TLS_VARS;
-
- if (le->type == ODBCG(le_result)) {
- odbc_connection *conn = ((odbc_result *) le->ptr)->conn_ptr;
- if (!conn->open && ((odbc_result *) le->ptr)->stmt){
- SQLFreeStmt(((odbc_result *) le->ptr)->stmt,SQL_DROP);
-#if !HAVE_DB2
- ((odbc_result *) le->ptr)->stmt = NULL;
-#endif
- }
- }
- return 0;
-}
-
-static void _close_connection(odbc_connection *conn)
-{
- /* FIXME
- * Closing a connection will fail if there are
- * pending transactions
- */
- ODBC_TLS_VARS;
-
- conn->open = 0;
- _php3_hash_apply(ODBCG(resource_list),
- (int (*)(void *))_results_cleanup);
- SQLDisconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- efree(conn);
- ODBCG(num_links)--;
-}
-
-
-static void _close_pconnection(odbc_connection *conn)
-{
- ODBC_TLS_VARS;
-
-
- conn->open = 0;
- _php3_hash_apply(ODBCG(resource_plist),
- (int (*)(void *))_results_cleanup);
-
- SQLDisconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- free(conn);
-
- ODBCG(num_links)--;
- ODBCG(num_persistent)--;
-}
-
-
-static PHP_INI_MH(odbc_param_int)
-{
- long *p;
- ODBC_TLS_VARS;
-
- p = (long *) (globals + (size_t)mh_arg);
- *p = atoi(new_value);
-
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(odbc_param_str)
-{
- char **p;
- ODBC_TLS_VARS;
-
- p = (char **) (globals + (size_t)mh_arg);
- *p = new_value;
-
- return SUCCESS;
-}
-
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("odbc.allow_persistent", "1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, allow_persistent))
- PHP_INI_ENTRY("odbc.max_persistent", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_persistent))
- PHP_INI_ENTRY("odbc.max_links", "-1", PHP_INI_SYSTEM, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, max_links))
- PHP_INI_ENTRY("odbc.default_db", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defDB))
- PHP_INI_ENTRY("odbc.default_user", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defUser))
- PHP_INI_ENTRY("odbc.default_pw", NULL, PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
- PHP_INI_ENTRY("odbc.defaultlrl", "4096", PHP_INI_ALL, odbc_param_int, (void *)XtOffsetOf(php_odbc_globals, defaultlrl))
- PHP_INI_ENTRY("odbc.defaultbinmode", "1", PHP_INI_ALL, odbc_param_str, (void *)XtOffsetOf(php_odbc_globals, defPW))
-PHP_INI_END()
-
-
-int php3_minit_odbc(INIT_FUNC_ARGS)
-{
-#ifdef SQLANY_BUG
- HDBC foobar;
- RETCODE rc;
-#endif
- ODBC_TLS_VARS;
-
- REGISTER_INI_ENTRIES();
- SQLAllocEnv(&ODBCG(henv));
-
- ODBCG(num_persistent) = 0;
- ODBCG(le_result) = register_list_destructors(_free_result, NULL);
- ODBCG(le_conn) = register_list_destructors(_close_connection, NULL);
- ODBCG(le_pconn) = register_list_destructors(NULL, _close_pconnection);
-
-#ifdef SQLANY_BUG
-/* Make a dumb connection to avoid crash on SQLFreeEnv(),
- * then release it immediately.
- * This is required for SQL Anywhere 5.5.00 on QNX 4.24 at least.
- * The SQLANY_BUG should be defined in CFLAGS.
- */
- if ( SQLAllocConnect(ODBCG(henv), &foobar) != SQL_SUCCESS ) {
- ODBC_SQL_ERROR(SQL_NULL_HDBC, SQL_NULL_HSTMT, "SQLAllocConnect");
- } else {
- rc = SQLConnect(foobar, ODBCG(defDB), SQL_NTS, ODBCG(defUser),
- SQL_NTS, ODBCG(defPW), SQL_NTS);
- if(rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
- SQLDisconnect( foobar );
- SQLFreeConnect( foobar );
- }
-#endif
-
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_PASSTHRU", 0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_RETURN", 1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("ODBC_BINMODE_CONVERT", 2, CONST_CS | CONST_PERSISTENT);
- /* Define Constants for different cursor options
- these Constants are are defined in <sqlext.h>
- */
- REGISTER_MAIN_LONG_CONSTANT("SQL_CUR_USE_IF_NEEDED", SQL_CUR_USE_IF_NEEDED, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("SQL_CUR_USE_ODBC", SQL_CUR_USE_ODBC, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("SQL_CUR_USE_DRIVER", SQL_CUR_USE_DRIVER, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("SQL_CUR_DEFAULT", SQL_CUR_DEFAULT, CONST_PERSISTENT | CONST_CS);
- return SUCCESS;
-}
-
-
-int php3_rinit_odbc(INIT_FUNC_ARGS)
-{
- ODBC_TLS_VARS;
-
- ODBCG(defConn) = -1;
- ODBCG(num_links) = ODBCG(num_persistent);
-
- return SUCCESS;
-}
-
-int php3_mshutdown_odbc(SHUTDOWN_FUNC_ARGS)
-{
- ODBC_TLS_VARS;
-
- SQLFreeEnv(ODBCG(henv));
-
- return SUCCESS;
-}
-
-
-void php3_info_odbc(void)
-{
- ODBC_TLS_VARS;
-
- php3_printf("ODBC compiled with \"" ODBC_TYPE "\" library");
- php3_printf("<BR>");
-#if DEBUG
- php3_printf("default_db: %s<br>\n", ODBCG(defDB));
- php3_printf("default_user: %s<br>\n", ODBCG(defUser));
- php3_printf("default_pw: %s<br>\n", ODBCG(defPW));
-#endif
- php3_printf("allow_persistent: %d<br>\n", ODBCG(allow_persistent));
- php3_printf("max_persistent: %d<br>\n", ODBCG(max_persistent));
- php3_printf("max_links: %d<br>\n", ODBCG(max_links));
-}
-
-
-
-/*
- * List management functions
- */
-
-int odbc_add_result(HashTable *list,odbc_result *result)
-{
- ODBC_TLS_VARS;
- return php3_list_insert(result, ODBCG(le_result));
-}
-
-odbc_result *odbc_get_result(HashTable *list, int ind)
-{
- odbc_result *res;
- int type;
- ODBC_TLS_VARS;
-
- res = (odbc_result*)php3_list_find(ind, &type);
- if (!res || type != ODBCG(le_result)) {
- php3_error(E_WARNING, "Bad result index %d", ind);
- return NULL;
- }
- return res;
-}
-
-void odbc_del_result(HashTable *list, int ind)
-{
- odbc_result *res;
- int type;
- ODBC_TLS_VARS;
-
- res = (odbc_result *)php3_list_find(ind, &type);
- if (!res || type != ODBCG(le_result)) {
- php3_error(E_WARNING,"Can't find result %d", ind);
- return;
- }
- php3_list_delete(ind);
-}
-
-odbc_connection *odbc_get_conn(HashTable *list, int ind)
-{
- odbc_connection *conn = NULL;
- int type;
- HashTable *plist;
- ODBC_TLS_VARS;
-
- plist = ODBCG(resource_plist);
-
- conn = (odbc_connection *)php3_list_find(ind, &type);
- if (conn && (type == ODBCG(le_conn) || type == ODBCG(le_pconn))) {
- return conn;
- }
-
- conn = (odbc_connection *)php3_plist_find(ind, &type);
- if (conn && (type == ODBCG(le_conn) || type == ODBCG(le_pconn)))
- return conn;
-
- php3_error(E_WARNING,"Bad ODBC connection number (%d)", ind);
- return NULL;
-}
-
-#if HAVE_DB2
-void ODBC_SQL_ERROR(SQLHANDLE conn, SQLHANDLE stmt, char *func)
-#else
-void ODBC_SQL_ERROR(HDBC conn, HSTMT stmt, char *func)
-#endif
-{
- char state[6]; /* Not used */
- SDWORD error; /* Not used */
- char errormsg[255];
- SWORD errormsgsize; /* Not used */
- ODBC_TLS_VARS;
-
- SQLError(ODBCG(henv), conn, stmt, state,
- &error, errormsg, sizeof(errormsg)-1, &errormsgsize);
- if (func) {
- php3_error(E_WARNING, "SQL error: %s, SQL state %s in %s",
- errormsg, state, func);
- } else {
- php3_error(E_WARNING, "SQL error: %s, SQL state %s",
- errormsg, state);
- }
-}
-
-/* Main User Functions */
-/* {{{ proto odbc_close_all(void)
- Close all ODBC connections */
-PHP_FUNCTION(odbc_close_all)
-{
- void *ptr;
- int type;
- int i, nument = _php3_hash_next_free_element(list);
- ODBC_TLS_VARS;
-
- for (i = 1; i < nument; i++) {
- ptr = php3_list_find(i, &type);
- if (ptr && (type == ODBCG(le_conn) ||
- type == ODBCG(le_pconn))) {
- php3_list_delete(i);
- }
- }
-}
-/* }}} */
-
-void php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
-{
- int res_ind;
- odbc_result *result;
- pval *arg1, *arg2;
- ODBC_TLS_VARS;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- res_ind = arg1->value.lval;
-
- if (res_ind){
- if ((result = odbc_get_result(list, res_ind)) == NULL){
- RETURN_FALSE;
- }
- if (mode)
- result->longreadlen = arg2->value.lval;
- else
- result->binmode = arg2->value.lval;
- } else {
- if (mode)
- ODBCG(defaultlrl) = arg2->value.lval;
- else
- ODBCG(defaultbinmode) = arg2->value.lval;
- }
-
- RETURN_TRUE
-}
-
-/* {{{ proto odbc_binmode(int result_id, int mode)
- Handle binary column data */
-PHP_FUNCTION(odbc_binmode)
-{
- php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto odbc_longreadlen(int result_id, int length)
- Handle LONG columns */
-PHP_FUNCTION(odbc_longreadlen)
-{
- php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-int odbc_bindcols(odbc_result *result)
-{
- int i;
- SWORD colnamelen; /* Not used */
- SDWORD displaysize;
- ODBC_TLS_VARS;
-
- result->values = (odbc_result_value *)
- emalloc(sizeof(odbc_result_value)*result->numcols);
-
- if (result->values == NULL){
- php3_error(E_WARNING, "Out of memory");
- SQLFreeStmt(result->stmt, SQL_DROP);
- return 0;
- }
-
- result->longreadlen = ODBCG(defaultlrl);
- result->binmode = ODBCG(defaultbinmode);
-
- for(i = 0; i < result->numcols; i++){
- SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_NAME,
- result->values[i].name,
- sizeof(result->values[i].name),
- &colnamelen,
- 0);
- SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_TYPE,
- NULL, 0, NULL, &result->values[i].coltype);
-
- /* Don't bind LONG / BINARY columns, so that fetch behaviour can
- be controlled by odbc_binmode() / odbc_longreadlen()
- */
-
- switch(result->values[i].coltype){
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- result->values[i].value = NULL;
- break;
-
-#if HAVE_ADABAS
- case SQL_TIMESTAMP:
- result->values[i].value = (char *)emalloc(27);
- SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- 27, &result->values[i].vallen);
- break;
-#endif /* HAVE_ADABAS */
- default:
- SQLColAttributes(result->stmt, (UWORD)(i+1), SQL_COLUMN_DISPLAY_SIZE,
- NULL, 0, NULL, &displaysize);
- result->values[i].value = (char *)emalloc(displaysize + 1);
- SQLBindCol(result->stmt, (UWORD)(i+1), SQL_C_CHAR, result->values[i].value,
- displaysize + 1, &result->values[i].vallen);
- break;
- }
- }
- return 1;
-}
-
-/* {{{ proto odbc_prepare(int connection_id, string query)
- Prepares a statement for execution */
-PHP_FUNCTION(odbc_prepare)
-{
- pval *arg1, *arg2;
- int conn;
- char *query;
- odbc_result *result=NULL;
- odbc_connection *curr_conn=NULL;
- RETCODE rc;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE){
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- conn = arg1->value.lval;
- query = arg2->value.str.val;
-
- if ((curr_conn = odbc_get_conn(list, conn)) == NULL){
- RETURN_FALSE;
- }
-
-#if 0
- _php3_stripslashes(query,NULL);
-#endif
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL){
- php3_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- result->numparams = 0;
-
- rc = SQLAllocStmt(curr_conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE){
- efree(result);
- php3_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_prepare");
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
- if ((rc = SQLPrepare(result->stmt, query, SQL_NTS)) != SQL_SUCCESS){
- ODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLPrepare");
- SQLFreeStmt(result->stmt, SQL_DROP);
- RETURN_FALSE;
- }
-
- SQLNumParams(result->stmt, &(result->numparams));
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- if (result->numcols > 0){
- if (!odbc_bindcols(result)){
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = curr_conn;
- result->fetched = 0;
- RETURN_LONG(odbc_add_result(list, result));
-}
-/* }}} */
-
-/*
- * Execute prepared SQL statement. Supports only input parameters.
- */
-/* {{{ proto odbc_execute(int result_id [, array parameters_array])
- Execute a prepared statement */
-extern PHP_FUNCTION(odbc_execute)
-{
- pval *arg1, *arg2, arr, *tmp;
- typedef struct params_t {
- SDWORD vallen;
- int fp;
- } params_t;
- params_t *params = NULL;
- char *filename;
- SWORD sqltype, scale, nullable;
- UDWORD precision;
- odbc_result *result=NULL;
- int res_ind, numArgs, i, ne;
- RETCODE rc;
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1){
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
-
- arr = *arg2;
- if (arr.type != IS_ARRAY) {
- php3_error(E_WARNING, "No array passed to odbc_execute()");
- return;
- }
- }
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL){
- RETURN_FALSE;
- }
-
- if (result->numparams > 0 && numArgs == 1) {
- php3_error(E_WARNING, "No parameters to SQL statement given");
- RETURN_FALSE;
- }
-
- if (result->numparams > 0){
- if ((ne = _php3_hash_num_elements(arr.value.ht)) < result->numparams){
- php3_error(E_WARNING,"Not enough parameters (%d should be %d) given",
- ne, result->numparams);
- RETURN_FALSE;
- }
-
- pval_copy_constructor(arg2);
- _php3_hash_internal_pointer_reset(arr.value.ht);
- params = (params_t *)emalloc(sizeof(params_t) * result->numparams);
-
- for (i = 1; i <= result->numparams; i++) {
- if (_php3_hash_get_current_data(arr.value.ht, (void **) &tmp) == FAILURE) {
- php3_error(E_WARNING,"Error getting parameter");
- SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
- efree(params);
- RETURN_FALSE;
- }
- convert_to_string(tmp);
- if (tmp->type != IS_STRING) {
- php3_error(E_WARNING,"Error converting parameter");
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- _php3_hash_destroy(arr.value.ht);
- efree(arr.value.ht);
- efree(params);
- RETURN_FALSE;
- }
-
- SQLDescribeParam(result->stmt, (UWORD)i, &sqltype, &precision,
- &scale, &nullable);
- params[i-1].vallen = tmp->value.str.len;
- params[i-1].fp = -1;
-
-
- if (tmp->value.str.val[0] == '\'') {
- filename = &tmp->value.str.val[1];
- filename[tmp->value.str.len - 2] = '\0';
-
- if ((params[i-1].fp = open(filename,O_RDONLY)) == -1) {
- php3_error(E_WARNING,"Can't open file %s", filename);
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for (i = 0; i < result->numparams; i++) {
- if (params[i].fp != -1) {
- close(params[i].fp);
- }
- }
- _php3_hash_destroy(arr.value.ht);
- efree(arr.value.ht);
- efree(params);
- RETURN_FALSE;
- }
-
- params[i-1].vallen = SQL_LEN_DATA_AT_EXEC(0);
-
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- SQL_C_BINARY, sqltype, precision, scale,
- (void *)params[i-1].fp, 0,
- &params[i-1].vallen);
- } else {
- /*if (IS_SQL_BINARY(sqltype)){
- php3_error(E_WARNING,"No Filename for binary parameter");
- SQLFreeStmt(result->stmt,SQL_RESET_PARAMS);
- _php3_hash_destroy(arr.value.ht);
- efree(arr.value.ht);
- efree(params);
- RETURN_FALSE;
- }
-*/
- rc = SQLBindParameter(result->stmt, (UWORD)i, SQL_PARAM_INPUT,
- SQL_C_CHAR, sqltype, precision, scale,
- tmp->value.str.val, 0,
- &params[i-1].vallen);
- }
- _php3_hash_move_forward(arr.value.ht);
- }
- }
- /* Close cursor, needed for doing multiple selects */
- rc = SQLFreeStmt(result->stmt, SQL_CLOSE);
-
- if (rc == SQL_ERROR){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLFreeStmt");
- }
-
- rc = SQLExecute(result->stmt);
-
- result->fetched = 0;
- if (rc == SQL_NEED_DATA){
- char buf[4096];
- int fp, nbytes;
- while(rc == SQL_NEED_DATA){
- rc = SQLParamData(result->stmt, (PTR FAR *)&fp);
- if (rc == SQL_NEED_DATA){
- while((nbytes = read(fp, &buf, 4096)) > 0)
- SQLPutData(result->stmt,(UCHAR FAR*) &buf, nbytes);
- }
- }
- } else {
- if (rc != SQL_SUCCESS){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLExecute");
- RETVAL_FALSE;
- }
- }
-
- if (result->numparams > 0){
- SQLFreeStmt(result->stmt, SQL_RESET_PARAMS);
- for(i = 0; i < result->numparams; i++){
- if (params[i].fp != -1)
- close(params[i].fp);
- }
- _php3_hash_destroy(arr.value.ht);
- efree(arr.value.ht);
- efree(params);
- }
-
- if (rc == SQL_SUCCESS){
- RETVAL_TRUE;
- }
-}
-/* }}} */
-
-/* odbc_cursor simply returns a cursor name for the given stmt
- * Adabas automagically generates cursor names, other drivers may not
- */
-/* {{{ proto odbc_cursor(int result_id)
- Get cursor name */
-PHP_FUNCTION(odbc_cursor)
-{
- pval *arg1;
- int res_ind;
- SWORD len, max_len;
- char *cursorname;
- odbc_result *result;
- RETCODE rc;
-
- if (getParameters(ht, 1, &arg1) == FAILURE){
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL) {
- RETURN_FALSE;
- }
- rc = SQLGetInfo(result->conn_ptr->hdbc,SQL_MAX_CURSOR_NAME_LEN,
- (void *)&max_len,0,&len);
- if (rc != SQL_SUCCESS){
- RETURN_FALSE;
- }
-
- if (max_len > 0){
- cursorname = emalloc(max_len + 1);
- if (cursorname == NULL){
- php3_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
- rc = SQLGetCursorName(result->stmt,cursorname,(SWORD)max_len,&len);
- if (rc != SQL_SUCCESS){
- char state[6]; /* Not used */
- SDWORD error; /* Not used */
- char errormsg[255];
- SWORD errormsgsize; /* Not used */
- ODBC_TLS_VARS;
-
- SQLError(ODBCG(henv), result->conn_ptr->hdbc,
- result->stmt, state, &error, errormsg,
- sizeof(errormsg)-1, &errormsgsize);
- if (!strncmp(state,"S1015",5)){
- sprintf(cursorname,"php3_curs_%d", (int)result->stmt);
- if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc,result->stmt,
- "SQLSetCursorName");
- RETVAL_FALSE;
- } else {
- RETVAL_STRING(cursorname,1);
- }
- } else {
- php3_error(E_WARNING, "SQL error: %s, SQL state %s", errormsg, state);
- RETVAL_FALSE;
- }
- } else {
- RETVAL_STRING(cursorname,1);
- }
- efree(cursorname);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto odbc_exec(int connection_id, string query)
- Prepare and execute an SQL statement */
-PHP_FUNCTION(odbc_exec)
-{
- pval *arg1, *arg2;
- int conn;
- char *query;
- odbc_result *result=NULL;
- odbc_connection *curr_conn=NULL;
- RETCODE rc;
-#if HAVE_SQL_EXTENDED_FETCH
- UDWORD scrollopts;
-#endif
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE){
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_string(arg2);
- conn = arg1->value.lval;
- query = arg2->value.str.val;
-
- if ((curr_conn = odbc_get_conn(list, conn)) == NULL){
- RETURN_FALSE;
- }
-
-#if 0
- _php3_stripslashes(query,NULL);
-#endif
-
- result = (odbc_result *)emalloc(sizeof(odbc_result));
- if (result == NULL){
- php3_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- rc = SQLAllocStmt(curr_conn->hdbc, &(result->stmt));
- if (rc == SQL_INVALID_HANDLE){
- php3_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in PHP3_ODBC_DO");
- efree(result);
- RETURN_FALSE;
- }
-
- if (rc == SQL_ERROR){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "SQLAllocStmt");
- efree(result);
- RETURN_FALSE;
- }
-
-#if HAVE_SQL_EXTENDED_FETCH
- /* Solid doesn't have ExtendedFetch, if DriverManager is used, get Info,
- whether Driver supports ExtendedFetch */
- rc = SQLGetInfo(curr_conn->hdbc, SQL_FETCH_DIRECTION, (void *) &scrollopts, sizeof(scrollopts), NULL);
- if (rc == SQL_SUCCESS){
- if ((result->fetch_abs = (scrollopts & SQL_FD_FETCH_ABSOLUTE))){
- /* Try to set CURSOR_TYPE to dynamic. Driver will replace this with other
- type if not possible.
- */
- if (SQLSetStmtOption(result->stmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC)
- == SQL_ERROR){
- ODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, " SQLSetStmtOption");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
- }
- } else {
- result->fetch_abs = 0;
- }
-#endif
-
- rc = SQLExecDirect(result->stmt, query, SQL_NTS);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- /* XXX FIXME we should really check out SQLSTATE with SQLError
- * in case rc is SQL_SUCCESS_WITH_INFO here.
- */
- ODBC_SQL_ERROR(curr_conn->hdbc, result->stmt, "SQLExecDirect");
- SQLFreeStmt(result->stmt, SQL_DROP);
- efree(result);
- RETURN_FALSE;
- }
-
- SQLNumResultCols(result->stmt, &(result->numcols));
-
- /* For insert, update etc. cols == 0 */
- if (result->numcols > 0){
- if (!odbc_bindcols(result)){
- efree(result);
- RETURN_FALSE;
- }
- } else {
- result->values = NULL;
- }
- result->conn_ptr = curr_conn;
- result->fetched = 0;
- RETURN_LONG(odbc_add_result(list, result));
-}
-/* }}} */
-
-/* {{{ proto odbc_fetch_into(int result_id [, int rownumber], array result_array)
- Fetch one result row into an array */
-PHP_FUNCTION(odbc_fetch_into)
-{
- int res_ind, numArgs, i;
- odbc_result *result;
- RETCODE rc;
- SWORD sql_c_type;
- char *buf = NULL;
-#if HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
- SDWORD rownum = -1;
- pval *arg1, *arg2, *arr, tmp;
-
- numArgs = ARG_COUNT(ht);
-
- switch(numArgs){
- case 2:
- if (getParameters(ht, 2, &arg1, &arr) == FAILURE)
- WRONG_PARAM_COUNT;
- break;
- case 3:
- if (getParameters(ht, 3, &arg1, &arg2, &arr) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long(arg2);
- rownum = arg2->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- if (!ParameterPassedByReference(ht, numArgs)){
- php3_error(E_WARNING, "Array not passed by reference in call to odbc_fetch_into()");
- RETURN_FALSE;
- }
-#else
- pval *arg1, *arr, tmp;
-
- numArgs = ARG_COUNT(ht);
-
- if (numArgs != 2 || getParameters(ht, 2, &arg1, &arr) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (!ParameterPassedByReference(ht, numArgs)){
- php3_error(E_WARNING, "Array not passed by reference in call to odbc_fetch_into()");
- RETURN_FALSE;
- }
-#endif
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL){
- RETURN_FALSE;
- }
-
- if (result->numcols == 0) {
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (arr->type != IS_ARRAY){
- if (array_init(arr) == FAILURE){
- php3_error(E_WARNING, "Can't convert to type Array");
- RETURN_FALSE;
- }
- }
-
-#if HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs){
- if (rownum > 0)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- }else
-#endif
-
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
-#if HAVE_SQL_EXTENDED_FETCH
- if (rownum > 0 && result->fetch_abs)
- result->fetched = rownum;
- else
-#endif
- result->fetched++;
-
- for (i = 0; i < result->numcols; i++) {
- tmp.type = IS_STRING;
- tmp.value.str.len = 0;
- sql_c_type = SQL_C_CHAR;
-
- switch(result->values[i].coltype){
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0){
- tmp.value.str.val = empty_string;
- break;
- }
- if (result->binmode == 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0){
- tmp.value.str.val = empty_string;
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen + 1);
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen + 1, &result->values[i].vallen);
-
- if (rc == SQL_ERROR) {
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO){
- tmp.value.str.len = result->longreadlen;
- } else if (result->values[i].vallen == SQL_NULL_DATA){
- tmp.value.str.val = empty_string;
- break;
- } else {
- tmp.value.str.len = result->values[i].vallen;
- }
- tmp.value.str.val = estrndup(buf, tmp.value.str.len);
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA){
- tmp.value.str.val = empty_string;
- break;
- }
- tmp.value.str.len = result->values[i].vallen;
- tmp.value.str.val = estrndup(result->values[i].value,tmp.value.str.len);
- break;
- }
- _php3_hash_index_update(arr->value.ht, i, (void *) &tmp, sizeof(pval), NULL);
- }
- if (buf) efree(buf);
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-#if HAVE_SOLID
-void php3_solid_fetch_prev(INTERNAL_FUNCTION_PARAMETERS)
-{
- int res_ind;
- odbc_result *result;
- RETCODE rc;
- pval *arg1;
-
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0) {
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
- rc = SQLFetchPrev(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (result->fetched > 1) result->fetched--;
-
- RETURN_TRUE;
-}
-#endif
-
-/* {{{ proto odbc_fetch_row(int result_id [, int row_number])
- Fetch a row */
-PHP_FUNCTION(odbc_fetch_row)
-{
- int res_ind, numArgs;
- SDWORD rownum = 1;
- odbc_result *result;
- RETCODE rc;
- pval *arg1, *arg2;
-#if HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1){
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long(arg2);
- rownum = arg2->value.lval;
- }
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0) {
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
-#if HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs){
- if (numArgs > 1)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_ABSOLUTE,rownum,&crow,RowStatus);
- else
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- }else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- RETURN_FALSE;
- }
-
- if (numArgs > 1) {
- result->fetched = rownum;
- } else {
- result->fetched++;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto odbc_result(int result_id, mixed field)
- Get result data */
-PHP_FUNCTION(odbc_result)
-{
- char *field;
- int res_ind;
- int field_ind;
- SWORD sql_c_type = SQL_C_CHAR;
- odbc_result *result;
- int i = 0;
- RETCODE rc;
- SDWORD fieldsize;
- pval *arg1, *arg2;
-#if HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-#if !defined(COMPILE_DL) && defined(THREAD_SAFE)
- TLS_VARS;
-#endif
-
- field_ind = -1;
- field = NULL;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2 , &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- if (arg2->type == IS_STRING){
- field = arg2->value.str.val;
- } else {
- convert_to_long(arg2);
- field_ind = arg2->value.lval - 1;
- }
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL) {
- RETURN_FALSE;
- }
-
- if ((result->numcols == 0)){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- /* get field index if the field parameter was a string */
- if (field != NULL){
- for(i = 0; i < result->numcols; i++){
- if (!strcasecmp(result->values[i].name, field)){
- field_ind = i;
- break;
- }
- }
-
- if (field_ind < 0){
- php3_error(E_WARNING, "Field %s not found", field);
- RETURN_FALSE;
- }
- } else {
- /* check for limits of field_ind if the field parameter was an int */
- if (field_ind >= result->numcols || field_ind < 0){
- php3_error(E_WARNING, "Field index is larger than the number of fields");
- RETURN_FALSE;
- }
- }
-
- if (result->fetched == 0){
- /* User forgot to call odbc_fetchrow(), let's do it here */
-#if HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt, SQL_FETCH_NEXT, 1, &crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- RETURN_FALSE;
-
- result->fetched++;
- }
-
- switch(result->values[field_ind].coltype){
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- if (result->binmode <= 0) break;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[field_ind].coltype)){
- if (result->longreadlen <= 0)
- break;
- else
- fieldsize = result->longreadlen;
- } else {
-
- SQLColAttributes(result->stmt, (UWORD)(field_ind + 1),
- (UWORD)((sql_c_type == SQL_C_BINARY) ? SQL_COLUMN_LENGTH :
- SQL_COLUMN_DISPLAY_SIZE),
- NULL, 0, NULL, &fieldsize);
- }
- /* For char data, the length of the returned string will be longreadlen - 1 */
- fieldsize = (result->longreadlen <= 0) ? 4096 : result->longreadlen;
- field = emalloc(fieldsize);
- if (!field){
- php3_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
- /* SQLGetData will truncate CHAR data to fieldsize - 1 bytes and append \0.
- For binary data it is truncated to fieldsize bytes.
- */
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1), sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA || rc == SQL_NO_DATA_FOUND){
- efree(field);
- RETURN_FALSE;
- }
- /* Reduce fieldlen by 1 if we have char data. One day we might
- have binary strings... */
- if (result->values[field_ind].coltype == SQL_LONGVARCHAR) fieldsize -= 1;
- /* Don't duplicate result, saves one emalloc.
- For SQL_SUCCESS, the length is in vallen.
- */
- RETURN_STRINGL(field, (rc == SQL_SUCCESS_WITH_INFO) ? fieldsize :
- result->values[field_ind].vallen, 0);
- break;
-
- default:
- if (result->values[field_ind].vallen == SQL_NULL_DATA){
- RETURN_FALSE;
- } else {
- RETURN_STRINGL(result->values[field_ind].value, result->values[field_ind].vallen, 1);
- }
- break;
- }
-
-/* If we come here, output unbound LONG and/or BINARY column data to the client */
-
-
- /* We emalloc 1 byte more for SQL_C_CHAR (trailing \0) */
- fieldsize = (sql_c_type == SQL_C_CHAR) ? 4096 : 4095;
- if ((field = emalloc(fieldsize)) == NULL){
- php3_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
-
- /* Call SQLGetData() until SQL_SUCCESS is returned */
- while (1) {
- rc = SQLGetData(result->stmt, (UWORD)(field_ind + 1),sql_c_type,
- field, fieldsize, &result->values[field_ind].vallen);
-
- if (rc == SQL_ERROR) {
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
- efree(field);
- RETURN_FALSE;
- }
-
- if (result->values[field_ind].vallen == SQL_NULL_DATA){
- efree(field);
- RETURN_FALSE;
- }
- /* chop the trailing \0 by outputing only 4095 bytes */
- PHPWRITE(field,(rc == SQL_SUCCESS_WITH_INFO) ? 4095 :
- result->values[field_ind].vallen);
-
- if (rc == SQL_SUCCESS) { /* no more data avail */
- efree(field);
- RETURN_TRUE;
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto odbc_result_all(int result_id [, string format])
- Print result as HTML table */
-PHP_FUNCTION(odbc_result_all)
-{
- char *buf = NULL;
- int res_ind, numArgs;
- odbc_result *result;
- int i;
- RETCODE rc;
- pval *arg1, *arg2;
- SWORD sql_c_type;
-#if HAVE_SQL_EXTENDED_FETCH
- UDWORD crow;
- UWORD RowStatus[1];
-#endif
-#if !defined(COMPILE_DL) && defined(THREAD_SAFE)
- TLS_VARS
-#endif
-
- numArgs = ARG_COUNT(ht);
- if (numArgs == 1){
- if (getParameters(ht, 1, &arg1) == FAILURE)
- WRONG_PARAM_COUNT;
- } else {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE)
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- res_ind = arg1->value.lval;
-
- /* check result */
- if ((result = odbc_get_result(list, res_ind)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-#if HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
-
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- php3_printf("<h2>No rows found</h2>\n");
- RETURN_LONG(0);
- }
-
- /* Start table tag */
- if (numArgs == 1){
- php3_printf("<table><tr>");
- } else {
- convert_to_string(arg2);
- php3_printf("<table %s ><tr>",arg2->value.str.val);
- }
-
- for(i = 0; i < result->numcols; i++)
- php3_printf("<th>%s</th>", result->values[i].name);
-
- php3_printf("</tr>\n");
-
- while(rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO){
- result->fetched++;
- php3_printf("<tr>");
- for(i = 0; i < result->numcols; i++){
- sql_c_type = SQL_C_CHAR;
- switch(result->values[i].coltype){
- case SQL_BINARY:
- case SQL_VARBINARY:
- case SQL_LONGVARBINARY:
- if (result->binmode <= 0){
- php3_printf("<td>Not printable</td>");
- break;
- }
- if (result->binmode <= 1) sql_c_type = SQL_C_BINARY;
- case SQL_LONGVARCHAR:
- if (IS_SQL_LONG(result->values[i].coltype) &&
- result->longreadlen <= 0){
- php3_printf("<td>Not printable</td>");
- break;
- }
-
- if (buf == NULL) buf = emalloc(result->longreadlen);
-
- rc = SQLGetData(result->stmt, (UWORD)(i + 1),sql_c_type,
- buf, result->longreadlen, &result->values[i].vallen);
-
- php3_printf("<td>");
-
- if (rc == SQL_ERROR) {
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SQLGetData");
- php3_printf("</td></tr></table>");
- efree(buf);
- RETURN_FALSE;
- }
- if (rc == SQL_SUCCESS_WITH_INFO)
- php3_printf(buf,result->longreadlen);
- else if (result->values[i].vallen == SQL_NULL_DATA){
- php3_printf("&nbsp;</td>");
- break;
- }
- else
- {
- php3_printf(buf, result->values[i].vallen);
- }
- php3_printf("</td>");
- break;
-
- default:
- if (result->values[i].vallen == SQL_NULL_DATA){
- php3_printf("<td>&nbsp;</td>");
- } else {
- php3_printf("<td>%s</td>", result->values[i].value);
- }
- break;
- }
- }
- php3_printf("</tr>\n");
-
-#if HAVE_SQL_EXTENDED_FETCH
- if (result->fetch_abs)
- rc = SQLExtendedFetch(result->stmt,SQL_FETCH_NEXT,1,&crow,RowStatus);
- else
-#endif
- rc = SQLFetch(result->stmt);
- }
- php3_printf("</table>\n");
- if (buf) efree(buf);
- RETURN_LONG(result->fetched);
-}
-/* }}} */
-
-/* {{{ proto odbc_free_result(int result_id)
- Free resources associated with a result */
-PHP_FUNCTION(odbc_free_result)
-{
- pval *arg1;
-
- if ( getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- odbc_del_result(list, arg1->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto odbc_connect(string DSN, string user, string password [, int cursor_option])
- Connect to a datasource */
-PHP_FUNCTION(odbc_connect)
-{
- php3_odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto odbc_connect(string DSN, string user, string password [, int cursor_option])
- Establish a persistant connection to a datasource */
-PHP_FUNCTION(odbc_pconnect)
-{
- php3_odbc_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* Persistent connections: two list-types le_pconn, le_conn and a plist
- * where hashed connection info is stored together with index pointer to
- * the actual link of type le_pconn in the list. Only persistent
- * connections get hashed up. Normal connections use existing pconnections.
- * Maybe this has to change with regard to transactions on pconnections?
- * Possibly set autocommit to on on request shutdown.
- *
- * We do have to hash non-persistent connections, and reuse connections.
- * In the case where two connects were being made, without closing the first
- * connect, access violations were occuring. This is because some of the
- * "globals" in this module should actualy be per-connection variables. I
- * simply fixed things to get them working for now. Shane
- */
-void php3_odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
-{
- char *db = NULL;
- char *uid = NULL;
- char *pwd = NULL;
- pval *arg1, *arg2, *arg3, *arg4;
- odbc_connection *db_conn;
- RETCODE rc;
- list_entry *index_ptr;
- char *hashed_details;
- int hashed_len, len, id, cur_opt;
- int type;
- ODBC_TLS_VARS;
-
- ODBCG(resource_list) = list;
- ODBCG(resource_plist) = plist;
-
- /* Now an optional 4th parameter specifying the cursor type
- * defaulting to the cursors default
- */
- switch(ARG_COUNT(ht)) {
- case 3:
- if (getParameters(ht, 3, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* Use Default: Probably a better way to do this */
- cur_opt = SQL_CUR_DEFAULT;
- break;
- case 4:
- if (getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg4);
- cur_opt = arg4->value.lval;
-
- /* Confirm the cur_opt range */
- if (! (cur_opt == SQL_CUR_USE_IF_NEEDED ||
- cur_opt == SQL_CUR_USE_ODBC ||
- cur_opt == SQL_CUR_USE_DRIVER ||
- cur_opt == SQL_CUR_DEFAULT) ) {
- php3_error(E_WARNING, "odbc: Invalid Cursor type (%d)", cur_opt);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(arg1);
- convert_to_string(arg2);
- convert_to_string(arg3);
-
- db = arg1->value.str.val;
- uid = arg2->value.str.val;
- pwd = arg3->value.str.val;
-
- if (ODBCG(allow_persistent) <= 0) {
- persistent = 0;
- }
-
- if (ODBCG(max_links) != -1 && ODBCG(num_links) >= ODBCG(max_links)) {
- php3_error(E_WARNING, "odbc: Too many open links (%d)",
- ODBCG(num_links));
- RETURN_FALSE;
- }
-
- /* the user requested a persistent connection */
- if (persistent && ODBCG(max_persistent) != -1 && ODBCG(num_persistent) >= ODBCG(max_persistent)) {
- php3_error(E_WARNING,"odbc: Too many open persistent links (%d)",
- ODBCG(num_persistent));
- RETURN_FALSE;
- }
-
- len = strlen(db) + strlen(uid) + strlen(pwd) + sizeof(ODBC_TYPE) - 1 + 5;
- hashed_details = emalloc(len);
-
- if (hashed_details == NULL) {
- php3_error(E_WARNING, "Out of memory");
- RETURN_FALSE;
- }
-
- hashed_len = _php3_sprintf(hashed_details, "%s_%s_%s_%s_%d", ODBC_TYPE, db, uid, pwd, cur_opt);
-
- /* FIXME the idea of checking to see if our connection is already persistent
- is good, but it adds a lot of overhead to non-persistent connections. We
- should look and see if we can fix that somehow */
- /* try to find if we already have this link in our persistent list,
- * no matter if it is to be persistent or not
- */
-
- if ((persistent || (_php3_hash_find(list, hashed_details, hashed_len + 1,
- (void **) &index_ptr) == FAILURE || !php3_list_find((int) index_ptr->ptr, &type))) &&
- _php3_hash_find(plist, hashed_details, hashed_len + 1,
- (void **) &index_ptr) == FAILURE) {
- /* the link is not in the persistent list */
- list_entry new_le, new_index_ptr;
-
- if (persistent) {
- db_conn = (odbc_connection *)malloc(sizeof(odbc_connection));
- } else {
- db_conn = (odbc_connection *)emalloc(sizeof(odbc_connection));
- }
-
- SQLAllocConnect(ODBCG(henv), &db_conn->hdbc);
-#if HAVE_SOLID
- SQLSetConnectOption(db_conn->hdbc, SQL_TRANSLATE_OPTION,
- SQL_SOLID_XLATOPT_NOCNV);
-#endif
-#if HAVE_OPENLINK
- {
- char dsnbuf[300];
- short dsnbuflen;
-
- rc = SQLDriverConnect(db_conn->hdbc, NULL, db, SQL_NTS,
- dsnbuf, sizeof(dsnbuf)-1, &dsnbuflen,
- SQL_DRIVER_COMPLETE);
- }
-#else
- if(cur_opt != SQL_CUR_DEFAULT){
- rc = SQLSetConnectOption(db_conn->hdbc, SQL_ODBC_CURSORS, cur_opt);
- if (rc != SQL_SUCCESS ) { /* && rc != SQL_SUCCESS_WITH_INFO ? */
- ODBC_SQL_ERROR(db_conn->hdbc, SQL_NULL_HSTMT, "SQLSetConnectOption");
- SQLFreeConnect(db_conn->hdbc);
- if (persistent)
- free(db_conn);
- else
- efree(db_conn);
- RETURN_FALSE;
- }
- }
-
-#if HAVE_EMPRESS
- {
- int direct = 0;
- char dsnbuf[300];
- short dsnbuflen;
- char *ldb = 0;
-
- if (strstr ((char*)db, ";"))
- {
- direct = 1;
- if (uid && !strstr ((char*)db, "uid") &&
- !strstr ((char*)db, "UID"))
- {
- ldb = (char*) emalloc (strlen(db) +
- strlen (uid) +
- strlen (pwd) + 12);
- sprintf (ldb, "%s;UID=%s;PWD=%s",
- db, uid, pwd);
- }
- else
- {
- ldb = (char*) emalloc (strlen (db) + 1);
- strcat (ldb, db);
- }
- }
-
- if (direct)
- rc = SQLDriverConnect (db_conn->hdbc, NULL,
- ldb, strlen (ldb), dsnbuf, 300,
- &dsnbuflen, SQL_DRIVER_NOPROMPT);
-
- else
- rc = SQLConnect(db_conn->hdbc, db, SQL_NTS,
- uid, SQL_NTS, pwd, SQL_NTS);
-
- if (ldb)
- efree (ldb);
- }
-#else
- rc = SQLConnect(db_conn->hdbc, db, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS);
-
-#endif
-
-#endif
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
- ODBC_SQL_ERROR(db_conn->hdbc, SQL_NULL_HSTMT, "SQLConnect");
- SQLFreeConnect(db_conn->hdbc);
- if (persistent)
- free(db_conn);
- else
- efree(db_conn);
- RETURN_FALSE;
- }
- db_conn->open = 1;
- if (persistent){
- new_le.type = ODBCG(le_pconn);
- new_le.ptr = db_conn;
- return_value->value.lval =
- php3_plist_insert(db_conn, ODBCG(le_pconn));
- new_index_ptr.ptr = (void *) return_value->value.lval;
-#ifdef THREAD_SAFE
- new_index_ptr.type = _php3_le_index_ptr();
-#else
- new_index_ptr.type = le_index_ptr;
-#endif
- if (_php3_hash_update(plist,hashed_details,hashed_len + 1,(void *) &new_index_ptr,
- sizeof(list_entry),NULL)==FAILURE) {
- SQLDisconnect(db_conn->hdbc);
- SQLFreeConnect(db_conn->hdbc);
- free(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- ODBCG(num_persistent)++;
- } else {
- new_le.type = ODBCG(le_conn);
- new_le.ptr = db_conn;
- return_value->value.lval =
- php3_list_insert(db_conn, ODBCG(le_conn));
- new_index_ptr.ptr = (void *) return_value->value.lval;
-#ifdef THREAD_SAFE
- new_index_ptr.type = _php3_le_index_ptr();
-#else
- new_index_ptr.type = le_index_ptr;
-#endif
- if (_php3_hash_update(list,hashed_details,hashed_len + 1,(void *) &new_index_ptr,
- sizeof(list_entry),NULL)==FAILURE) {
- SQLDisconnect(db_conn->hdbc);
- SQLFreeConnect(db_conn->hdbc);
- efree(db_conn);
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
-
- ODBCG(num_links)++;
-
- } else {
- /* we are already connected */
-#ifdef THREAD_SAFE
- if (index_ptr->type != _php3_le_index_ptr()) {
-#else
- if (index_ptr->type != le_index_ptr) {
-#endif
- efree(hashed_details);
- RETURN_FALSE;
- }
- id = (int) index_ptr->ptr;
-
- /* first see if there is a persistent connection and use it,
- else, if we are making a non-persistent connect, check our
- non-persistent list */
- db_conn = (odbc_connection *)php3_plist_find(id, &type);
- if(!db_conn && !persistent)
- db_conn = (odbc_connection *)php3_list_find(id, &type);
-
-
- /* FIXME test if the connection is dead */
- /* For Adabas D and local db connections, a reconnect is performed
- * implicitly when needed. Cool.
- */
-
- if (db_conn && (type == ODBCG(le_conn) ||
- type == ODBCG(le_pconn))){
- return_value->value.lval = id;
- } else {
- efree(hashed_details);
- RETURN_FALSE;
- }
- }
- efree(hashed_details);
- return_value->type = IS_LONG;
-}
-
-/* {{{ proto odbc_close(int connection_id)
- Close an ODBC connection */
-PHP_FUNCTION(odbc_close)
-{
- pval *arg1;
- HDBC conn;
- int type, ind;
- ODBC_TLS_VARS;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- ind = (int)arg1->value.lval;
- conn = (HDBC)php3_list_find(ind, &type);
- if (!conn ||
- (type != ODBCG(le_conn) &&
- type != ODBCG(le_pconn))) {
- return;
- }
- php3_list_delete(ind);
-}
-/* }}} */
-
-/* {{{ proto odbc_num_rows(int result_id)
- Get number of rows in a result */
-PHP_FUNCTION(odbc_num_rows)
-{
- odbc_result *result;
- SDWORD rows;
- pval *arg1;
-
- if ( getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
-
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- SQLRowCount(result->stmt, &rows);
- RETURN_LONG(rows);
-}
-/* }}} */
-
-/* {{{ proto odbc_num_fields(int result_id)
- Get number of columns in a result */
-PHP_FUNCTION(odbc_num_fields)
-{
- odbc_result *result;
- pval *arg1;
-
- if ( getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
-
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
- RETURN_LONG(result->numcols);
-}
-/* }}} */
-
-/* {{{ proto odbc_field_name(int result_id, int field_number)
- Get a column name */
-PHP_FUNCTION(odbc_field_name)
-{
- odbc_result *result;
- pval *arg1, *arg2;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (arg2->value.lval > result->numcols){
- php3_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- if (arg2->value.lval < 1){
- php3_error(E_WARNING, "Field numbering starts at 1");
- RETURN_FALSE;
- }
-
- RETURN_STRING(result->values[arg2->value.lval - 1].name,1)
-}
-/* }}} */
-
-/* {{{ proto odbc_field_type(int result_id, int field_number)
- Get the datatype of a column */
-PHP_FUNCTION(odbc_field_type)
-{
- odbc_result *result;
- char tmp[32];
- SWORD tmplen;
- pval *arg1, *arg2;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (arg2->value.lval > result->numcols){
- php3_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
-
- SQLColAttributes(result->stmt, (UWORD)arg2->value.lval,
- SQL_COLUMN_TYPE_NAME, tmp, 31, &tmplen, NULL);
- RETURN_STRING(tmp,1)
-}
-/* }}} */
-
-/* {{{ proto odbc_field_len(int result_id, int field_number)
- Get the length of a column */
-PHP_FUNCTION(odbc_field_len)
-{
- odbc_result *result;
- SDWORD len;
- pval *arg1, *arg2;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
-
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- if (result->numcols == 0){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
-
- if (arg2->value.lval > result->numcols){
- php3_error(E_WARNING, "Field index larger than number of fields");
- RETURN_FALSE;
- }
- SQLColAttributes(result->stmt, (UWORD)arg2->value.lval,
- SQL_COLUMN_PRECISION, NULL, 0, NULL, &len);
-
- RETURN_LONG(len);
-}
-/* }}} */
-
-/* {{{ proto odbc_field_num(int result_id, string field_name)
- Return column number */
-PHP_FUNCTION(odbc_field_num)
-{
- int field_ind;
- char *fname;
- odbc_result *result;
- int i;
- pval *arg1, *arg2;
-
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_string(arg2);
- fname = arg2->value.str.val;
-
- if (arg1->value.lval == 1){
- php3_error(E_WARNING, "No tuples available at this result index");
- RETURN_FALSE;
- }
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- field_ind = -1;
- for(i = 0; i < result->numcols; i++){
- if (strcasecmp(result->values[i].name, fname) == 0)
- field_ind = i + 1;
- }
- if (field_ind == -1)
- RETURN_FALSE;
- RETURN_LONG(field_ind);
-}
-/* }}} */
-
-/* {{{ proto odbc_autocommit(int connection_id, int OnOff)
- Toggle autocommit mode */
-PHP_FUNCTION(odbc_autocommit)
-{
- odbc_connection *curr_conn;
- RETCODE rc;
- pval *arg1, *arg2 = NULL;
- int argc;
-
- argc = ARG_COUNT(ht);
- if (argc == 2) {
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (argc == 1) {
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- if (arg2) {
- convert_to_long(arg2);
- }
-
- if ((curr_conn = odbc_get_conn(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
-
- if (arg2) {
- rc = SQLSetConnectOption(curr_conn->hdbc, SQL_AUTOCOMMIT,
- (arg2->value.lval) ?
- SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "Set autocommit");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
- } else {
- SDWORD status;
-
- rc = SQLGetConnectOption(curr_conn->hdbc, SQL_AUTOCOMMIT, (PTR)&status);
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "Test autocommit");
- RETURN_FALSE;
- }
- RETVAL_LONG((long)status);
- }
-}
-/* }}} */
-
-void PHP3_ODBC_TRANSACT(INTERNAL_FUNCTION_PARAMETERS, int type)
-{
- odbc_connection *curr_conn;
- RETCODE rc;
- pval *arg1;
- ODBC_TLS_VARS;
-
- if ( getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
-
- if ((curr_conn = odbc_get_conn(list, arg1->value.lval)) == NULL){
- RETURN_FALSE;
- }
-
- rc = SQLTransact(ODBCG(henv), curr_conn->hdbc, (UWORD)((type)?SQL_COMMIT:SQL_ROLLBACK));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "SQLTransact");
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-/* {{{ proto odbc_commit(int connection_id)
- Commit an ODBC transaction */
-PHP_FUNCTION(odbc_commit)
-{
- PHP3_ODBC_TRANSACT(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* {{{ proto odbc_rollback(int connection_id)
- Rollback a transaction */
-PHP_FUNCTION(odbc_rollback)
-{
- PHP3_ODBC_TRANSACT(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto odbc_setoption(??)
- ?? */
-PHP_FUNCTION(odbc_setoption)
-{
- odbc_connection *curr_conn;
- odbc_result *result;
- RETCODE rc;
- pval *arg1, *arg2, *arg3, *arg4;
-
- if ( getParameters(ht, 3, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg1);
- convert_to_long(arg2);
- convert_to_long(arg3);
- convert_to_long(arg4);
-
- switch (arg2->value.lval) {
- case 1: /* SQLSetConnectOption */
- if ((curr_conn = odbc_get_conn(list, arg1->value.lval)) == NULL){
- RETURN_FALSE;
- }
- rc = SQLSetConnectOption(curr_conn->hdbc, (unsigned short)(arg3->value.lval), (arg4->value.lval));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(curr_conn->hdbc, SQL_NULL_HSTMT, "SetConnectOption");
- RETURN_FALSE;
- }
- break;
- case 2: /* SQLSetStmtOption */
- if ((result = odbc_get_result(list, arg1->value.lval)) == NULL) {
- RETURN_FALSE;
- }
- rc = SQLSetStmtOption(result->stmt, (unsigned short)(arg3->value.lval), (arg4->value.lval));
- if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO){
- ODBC_SQL_ERROR(result->conn_ptr->hdbc, result->stmt, "SetStmtOption");
- RETURN_FALSE;
- }
- break;
- default:
- php3_error(E_WARNING, "Unknown option type");
- RETURN_FALSE;
- break;
- }
-
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif /* HAVE_UODBC */
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/php3_odbc.h b/ext/odbc/php3_odbc.h
deleted file mode 100644
index 2e5abe9d22..0000000000
--- a/ext/odbc/php3_odbc.h
+++ /dev/null
@@ -1,261 +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 <ssb@guardian.no> |
- | Andreas Karajannis <Andreas.Karajannis@gmd.de> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP_ODBC_H
-# define _PHP_ODBC_H
-
-# if HAVE_UODBC
-
-# ifndef MSVC5
-# define FAR
-# endif
-
-/* checking in the same order as in configure.in */
-
-# if HAVE_SOLID /* Solid Server */
-
-# include <cli0core.h>
-# include <cli0ext1.h>
-# define HAVE_SQL_EXTENDED_FETCH 0
-extern void php3_solid_fetch_prev(INTERNAL_FUNCTION_PARAMETERS);
-
-# elif HAVE_EMPRESS /* Empress */
-
-# include <sql.h>
-# include <sqlext.h>
-# define HAVE_SQL_EXTENDED_FETCH 0
-
-# elif HAVE_ADABAS /* Adabas D */
-
-# include <WINDOWS.H>
-# include <sql.h>
-# include <sqlext.h>
-# define HAVE_SQL_EXTENDED_FETCH 1
-
-# elif HAVE_IODBC /* iODBC library */
-
-# include <isql.h>
-# include <isqlext.h>
-# include <odbc_types.h>
-# include <odbc_funcs.h>
-# define HAVE_SQL_EXTENDED_FETCH 1
-# define SQL_FD_FETCH_ABSOLUTE 0x00000010L
-# define SQL_CURSOR_DYNAMIC 2UL
-# define SQL_NO_TOTAL (-4)
-# define SQL_SO_DYNAMIC 0x00000004L
-# define SQL_LEN_DATA_AT_EXEC_OFFSET (-100)
-# define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
-
-# elif HAVE_OPENLINK /* OpenLink ODBC drivers */
-
-# include <iodbc.h>
-# include <isql.h>
-# include <isqlext.h>
-# include <udbcext.h>
-# define HAVE_SQL_EXTENDED_FETCH 1
-
-# elif HAVE_VELOCIS /* Raima Velocis */
-
-# define UNIX
-# define HAVE_SQL_EXTENDED_FETCH 1
-# include <sql.h>
-# include <sqlext.h>
-
-# elif HAVE_CODBC /* Custom ODBC */
-
-# define HAVE_SQL_EXTENDED_FETCH 1
-# include <odbc.h>
-
-# elif HAVE_DB2 /* DB2 CLI */
-
-# define HAVE_SQL_EXTENDED_FETCH 1
-# include <sqlcli1.h>
-# ifdef DB268K
-/* Need to include ASLM for 68K applications */
-# include <LibraryManager.h>
-# endif
-
-# else /* MS ODBC */
-
-# define HAVE_SQL_EXTENDED_FETCH 1
-# include <WINDOWS.H>
-# include <sql.h>
-# include <sqlext.h>
-# endif
-
-extern php3_module_entry odbc_module_entry;
-# define odbc_module_ptr &odbc_module_entry
-
-
-/* user functions */
-extern int php3_minit_odbc(INIT_FUNC_ARGS);
-extern int php3_mshutdown_odbc(SHUTDOWN_FUNC_ARGS);
-extern int php3_rinit_odbc(INIT_FUNC_ARGS);
-extern void php3_info_odbc(void);
-extern PHP_FUNCTION(odbc_setoption);
-extern PHP_FUNCTION(odbc_autocommit);
-extern PHP_FUNCTION(odbc_close);
-extern PHP_FUNCTION(odbc_close_all);
-extern PHP_FUNCTION(odbc_commit);
-extern PHP_FUNCTION(odbc_connect);
-extern PHP_FUNCTION(odbc_pconnect);
-extern void php3_odbc_do_connect(INTERNAL_FUNCTION_PARAMETERS, int);
-extern PHP_FUNCTION(odbc_cursor);
-extern PHP_FUNCTION(odbc_exec);
-extern PHP_FUNCTION(odbc_do);
-extern PHP_FUNCTION(odbc_execute);
-extern PHP_FUNCTION(odbc_fetch_into);
-extern PHP_FUNCTION(odbc_fetch_row);
-extern PHP_FUNCTION(odbc_field_len);
-extern PHP_FUNCTION(odbc_field_name);
-extern PHP_FUNCTION(odbc_field_type);
-extern PHP_FUNCTION(odbc_field_num);
-extern PHP_FUNCTION(odbc_free_result);
-extern PHP_FUNCTION(odbc_num_fields);
-extern PHP_FUNCTION(odbc_num_rows);
-extern PHP_FUNCTION(odbc_prepare);
-extern PHP_FUNCTION(odbc_result);
-extern PHP_FUNCTION(odbc_result_all);
-extern PHP_FUNCTION(odbc_rollback);
-extern void php3_odbc_transact(INTERNAL_FUNCTION_PARAMETERS, int);
-extern PHP_FUNCTION(odbc_binmode);
-extern PHP_FUNCTION(odbc_longreadlen);
-
-typedef struct odbc_connection {
-#if HAVE_DB2
- SQLHANDLE hdbc;
-#else
- HDBC hdbc;
-#endif
- int open;
-} odbc_connection;
-
-typedef struct odbc_result_value {
- char name[32];
- char *value;
- long int vallen;
- SDWORD coltype;
-} odbc_result_value;
-
-typedef struct odbc_result {
-#if HAVE_DB2
- SQLHANDLE stmt;
-#else
- HSTMT stmt;
-#endif
- odbc_result_value *values;
- SWORD numcols;
- SWORD numparams;
-# if HAVE_SQL_EXTENDED_FETCH
- int fetch_abs;
-# endif
- long longreadlen;
- int binmode;
- int fetched;
- odbc_connection *conn_ptr;
-} odbc_result;
-
-typedef struct {
-#if HAVE_DB2
- SQLHANDLE henv;
-#else
- HENV henv;
-#endif
- char *defDB;
- char *defUser;
- char *defPW;
- long allow_persistent;
- long max_persistent;
- long max_links;
- long num_persistent;
- long num_links;
- int defConn;
- int le_result, le_conn, le_pconn;
- long defaultlrl;
- long defaultbinmode;
- HashTable *resource_list;
- HashTable *resource_plist;
-} php_odbc_globals;
-
-# ifndef ZTS
-extern php_odbc_globals odbc_globals;
-# endif
-
-int odbc_add_result(HashTable *list, odbc_result *result);
-odbc_result *odbc_get_result(HashTable *list, int count);
-void odbc_del_result(HashTable *list, int count);
-int odbc_add_conn(HashTable *list, HDBC conn);
-odbc_connection *odbc_get_conn(HashTable *list, int count);
-void odbc_del_conn(HashTable *list, int ind);
-#if HAVE_DB2
-void odbc_sql_error(SQLHANDLE conn, SQLHANDLE stmt, char *func);
-#else
-void odbc_sql_error(HDBC conn, HSTMT stmt, char *func);
-#endif
-int odbc_bindcols(odbc_result *result);
-
-#define IS_SQL_LONG(x) (x == SQL_LONGVARBINARY || x == SQL_LONGVARCHAR)
-#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
-
-#ifdef ZTS
-# define ODBCLS_D php_odbc_globals *odbc_globals
-# define ODBCLS_DC , ODBCLS_D
-# define ODBCLS_C odbc_globals
-# define ODBCLS_CC , ODBCLS_C
-# define ODBCG(v) (odbc_globals->v)
-# define ODBCLS_FETCH() php_odbc_globals *odbc_globals = ts_resource(odbc_globals_id)
-# define ODBC_TLS_VARS char *globals; ODBCLS_FETCH(); globals = (char *)odbc_globals;
-#else
-# define ODBCLS_D
-# define ODBCLS_DC
-# define ODBCLS_C
-# define ODBCLS_CC
-# define ODBCG(v) (odbc_globals.v)
-# define ODBCLS_FETCH()
-# define ODBC_TLS_VARS char *globals = (char *)&odbc_globals
-extern ZEND_API php_odbc_globals odbc_globals;
-#endif
-
-#else
-
-# define odbc_module_ptr NULL
-
-#endif /* HAVE_UODBC */
-
-#endif /* _PHP_ODBC_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/php3_velocis.h b/ext/odbc/php3_velocis.h
deleted file mode 100644
index 19d9f4070a..0000000000
--- a/ext/odbc/php3_velocis.h
+++ /dev/null
@@ -1,108 +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: Nikolay P. Romanyuk <mag@redcom.ru> |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP3_VELOCIS_H
-#define _PHP3_VELOCIS_H
-
-#if COMPILE_DL
-#undef HAVE_VELOCIS
-#define HAVE_VELOCIS 1
-#endif
-
-#if HAVE_VELOCIS && !HAVE_UODBC
-#define UNIX
-#include <sql.h>
-#include <sqlext.h>
-
-typedef struct VConn {
- HDBC hdbc;
- long index;
-} VConn;
-
-typedef struct {
- char name[32];
- char *value;
- long vallen;
- SDWORD valtype;
-} VResVal;
-
-typedef struct Vresult {
- HSTMT hstmt;
- VConn *conn;
- long index;
- VResVal *values;
- long numcols;
- int fetched;
-} Vresult;
-
-typedef struct {
- long num_links;
- long max_links;
- int le_link,le_result;
-} velocis_module;
-
-extern php3_module_entry velocis_module_entry;
-#define velocis_module_ptr &velocis_module_entry
-
-/* velocis.c functions */
-extern int php3_minit_velocis(INIT_FUNC_ARGS);
-extern int php3_rinit_velocis(INIT_FUNC_ARGS);
-extern void php3_info_velocis(void);
-extern int php3_shutdown_velocis(void);
-extern void php3_velocis_connect(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_close(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_exec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_fetch(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_result(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_freeresult(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_autocommit(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_off_autocommit(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_commit(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_rollback(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_fieldnum(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_velocis_fieldname(INTERNAL_FUNCTION_PARAMETERS);
-
-extern velocis_module php3_velocis_module;
-
-#else
-
-#define velocis_module_ptr NULL
-
-#endif /* HAVE_VELOCIS */
-#endif /* _PHP3_VELOCIS_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/odbc/setup.stub b/ext/odbc/setup.stub
deleted file mode 100644
index 8f2b2a942c..0000000000
--- a/ext/odbc/setup.stub
+++ /dev/null
@@ -1,76 +0,0 @@
-# $Id$ -*- sh -*-
-
-# Solid
-define_option with-solid 'Solid support?' yesnodir \
- 'no /usr/local/solid Solid install' \
-' Whether to build PHP with Solid support.\n
- More information about Solid can be found at http://www.solidtech.com/.'
-
-# Empress
-if test "$option_value_with_solid" = "no"; then
-define_option with-empress 'Empress support?' yesnodir \
- "no $EMPRESSPATH Empress home" \
-' Whether to build PHP with Empress support. Has been confirmed to
- work with Empress Version 8.10. If you have not set up your
- Empress environment, enter what $EMPRESSPATH is usually set to here.
- More info about Empress can be found at http://www.empress.com/.'
-fi
-
-# iODBC
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no"; then
-define_option with-iodbc 'iODBC support?' yesnodir \
- 'no /usr/local iODBC install' \
-' Whether to build PHP with iODBC support. This feature was first\n
- developed for iODBC Driver Manager, a freely redistributable ODBC\n
- driver manager which runs under many flavors of UNIX.\n
- More info about iODBC can be found on the FreeODBC Pages at \n
- http://users.ids.net/~bjepson/freeODBC/.'
-fi
-
-# OpenLink
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no"; then
-define_option with-openlink 'OpenLink ODBC support?' yesnodir \
- 'no /usr/local/openlink OpenLink install' \
-' Whether to build PHP with OpenLink ODBC support. See
- http://www.openlinksw.com/ for more information.'
-fi
-
-# Adabas D
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_openlink" = "no"; then
-define_option with-adabas 'Adabas D support?' yesnodir \
- 'no /usr/local Adabas D install root' \
-' Whether to build with Adabas D support.\n
- More info about Adabas D can be found at http://www.adabas.com/.'
-fi
-
-# Velocis
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no"; then
-define_option with-velocis 'Velocis support?' yesnodir \
- 'no /usr/local/velocis Velocis install' \
-' Whether to build PHP with Velocis support.\n
- More information about Velocis can be found at http://www.raima.com/.'
-fi
-
-# Custom ODBC
-if test "$option_value_with_solid" = "no" -a \
- "$option_value_with_empress" = "no" -a \
- "$option_value_with_iodbc" = "no" -a \
- "$option_value_with_openlink" = "no" -a \
- "$option_value_with_adabas" = "no" -a \
- "$option_value_with_velocis" = "no"; then
-define_option with-custom-odbc 'custom ODBC support?' yesnodir \
- 'no /usr/local CODBC install' \
-' Whether to build PHP with CODBC support. This feature was first
- developed for Sybase SQL Anywhere 5.5 on QNX, but may be used for
- any unknown ODBC driver on all flavors of UNIX.'
-fi
diff --git a/ext/odbc/velocis.c b/ext/odbc/velocis.c
deleted file mode 100644
index 0c5b03eab0..0000000000
--- a/ext/odbc/velocis.c
+++ /dev/null
@@ -1,646 +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: Nikolay P. Romanyuk <mag@redcom.ru> |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * TODO:
- * velocis_fetch_into(),
- * Check all on real life apps.
- */
-
-#include "php.h"
-#include "php3_velocis.h"
-
-#if HAVE_VELOCIS && !HAVE_UODBC
-
-function_entry velocis_functions[] = {
- {"velocis_connect", php3_velocis_connect, NULL},
- {"velocis_close", php3_velocis_close, NULL},
- {"velocis_exec", php3_velocis_exec, NULL},
- {"velocis_fetch", php3_velocis_fetch, NULL},
- {"velocis_result", php3_velocis_result, NULL},
- {"velocis_freeresult", php3_velocis_freeresult, NULL},
- {"velocis_autocommit", php3_velocis_autocommit, NULL},
- {"velocis_off_autocommit", php3_velocis_off_autocommit, NULL},
- {"velocis_commit", php3_velocis_commit, NULL},
- {"velocis_rollback", php3_velocis_rollback, NULL},
- {"velocis_fieldnum", php3_velocis_fieldnum, NULL},
- {"velocis_fieldname", php3_velocis_fieldname, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry velocis_module_entry = {
- "Velocis", velocis_functions, php3_minit_velocis, php3_shutdown_velocis,
- php3_rinit_velocis, NULL, php3_info_velocis, STANDARD_MODULE_PROPERTIES
-};
-
-
-#if COMPILE_DL
-php3_module_entry *get_module() { return &velocis_module_entry; }
-#endif
-
-THREAD_LS velocis_module php3_velocis_module;
-THREAD_LS static HENV henv;
-
-static void _close_velocis_link(VConn *conn)
-{
- if ( conn ) {
- efree(conn);
- }
-}
-
-static void _free_velocis_result(Vresult *res)
-{
- if ( res && res->values ) {
- register int i;
- for ( i=0; i < res->numcols; i++ ) {
- if ( res->values[i].value )
- efree(res->values[i].value);
- }
- efree(res->values);
- }
- if ( res ) {
- efree(res);
- }
-}
-
-int php3_minit_velocis(INIT_FUNC_ARGS)
-{
- SQLAllocEnv(&henv);
- if ( cfg_get_long("velocis.max_links",&php3_velocis_module.max_links) == FAILURE ) {
- php3_velocis_module.max_links = -1;
- }
- php3_velocis_module.num_links = 0;
- php3_velocis_module.le_link = register_list_destructors(_close_velocis_link,NULL);
- php3_velocis_module.le_result = register_list_destructors(_free_velocis_result,NULL);
-
- return SUCCESS;
-}
-
-int php3_rinit_velocis(INIT_FUNC_ARGS)
-{
- return SUCCESS;
-}
-
-
-void php3_info_velocis(void)
-{
- php3_printf("RAIMA Velocis Support Active");
-}
-
-int php3_shutdown_velocis(void)
-{
- SQLFreeEnv(henv);
- return SUCCESS;
-}
-
-/* Some internal functions. Connections and result manupulate */
-
-static int
-velocis_add_conn(HashTable *list,VConn *conn,HDBC hdbc)
-{
- int ind;
-
- ind = php3_list_insert(conn,php3_velocis_module.le_link);
- conn->hdbc = hdbc;
- conn->index = ind;
-
- return(ind);
-}
-
-static VConn *
-velocis_find_conn(HashTable *list,int ind)
-{
- VConn *conn;
- int type;
-
- conn = php3_list_find(ind,&type);
- if ( !conn || type != php3_velocis_module.le_link ) {
- return(NULL);
- }
- return(conn);
-}
-
-static void
-velocis_del_conn(HashTable *list,int ind)
-{
- php3_list_delete(ind);
-}
-
-static int
-velocis_add_result(HashTable *list,Vresult *res,VConn *conn)
-{
- int ind;
-
- ind = php3_list_insert(res,php3_velocis_module.le_result);
- res->conn = conn;
- res->index = ind;
-
- return(ind);
-}
-
-static Vresult *
-velocis_find_result(HashTable *list,int ind)
-{
- Vresult *res;
- int type;
-
- res = php3_list_find(ind,&type);
- if ( !res || type != php3_velocis_module.le_result ) {
- return(NULL);
- }
- return(res);
-}
-
-static void
-velocis_del_result(HashTable *list,int ind)
-{
- php3_list_delete(ind);
-}
-
-/* Users functions */
-
-void php3_velocis_connect(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *serv,*user,*pass;
- char *Serv = NULL;
- char *User = NULL;
- char *Pass = NULL;
- RETCODE stat;
- HDBC hdbc;
- VConn *new;
- long ind;
-
- if ( php3_velocis_module.max_links != -1 && php3_velocis_module.num_links == php3_velocis_module.max_links ) {
- php3_error(E_WARNING,"Velocis: Too many open connections (%d)",php3_velocis_module.num_links);
- RETURN_FALSE;
- }
- if ( ARG_COUNT(ht) != 3 ||
- getParameters(ht,3,&serv,&user,&pass) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(serv);
- convert_to_string(user);
- convert_to_string(pass);
- Serv = serv->value.str.val;
- User = user->value.str.val;
- Pass = pass->value.str.val;
- stat = SQLAllocConnect(henv,&hdbc);
- if ( stat != SQL_SUCCESS ) {
- php3_error(E_WARNING,"Velocis: Could not allocate connection handle");
- RETURN_FALSE;
- }
- stat = SQLConnect(hdbc,Serv,SQL_NTS,User,SQL_NTS,Pass,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: Could not connect to server \"%s\" for %s",Serv,User);
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
- new = (VConn *)emalloc(sizeof(VConn));
- if ( new == NULL ) {
- php3_error(E_WARNING,"Velocis: Out of memory for store connection");
- SQLFreeConnect(hdbc);
- RETURN_FALSE;
- }
- ind = velocis_add_conn(list,new,hdbc);
- php3_velocis_module.num_links++;
- RETURN_LONG(ind);
-}
-
-void php3_velocis_close(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id;
- VConn *conn;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- SQLDisconnect(conn->hdbc);
- SQLFreeConnect(conn->hdbc);
- velocis_del_conn(list,id->value.lval);
- php3_velocis_module.num_links--;
- RETURN_TRUE;
-}
-
-void php3_velocis_exec(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind,*exec_str;
- char *query = NULL;
- int indx;
- VConn *conn;
- Vresult *res;
- RETCODE stat;
- SWORD cols,i,colnamelen;
- SDWORD rows,coldesc;
-
- if ( ARG_COUNT(ht) != 2 || getParameters(ht,2,&ind,&exec_str) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- conn = velocis_find_conn(list,ind->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- convert_to_string(exec_str);
- query = exec_str->value.str.val;
-
- res = (Vresult *)emalloc(sizeof(Vresult));
- if ( res == NULL ) {
- php3_error(E_WARNING,"Velocis: Out of memory for result");
- RETURN_FALSE;
- }
- stat = SQLAllocStmt(conn->hdbc,&res->hstmt);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: SQLAllocStmt return %d",stat);
- efree(res);
- RETURN_FALSE;
- }
- stat = SQLExecDirect(res->hstmt,query,SQL_NTS);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: Can not execute \"%s\" query",query);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- /* Success query */
- stat = SQLNumResultCols(res->hstmt,&cols);
- if ( stat != SQL_SUCCESS ) {
- php3_error(E_WARNING,"Velocis: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- if ( !cols ) { /* Was INSERT, UPDATE, DELETE, etc. query */
- stat = SQLRowCount(res->hstmt,&rows);
- if ( stat != SQL_SUCCESS ) {
- php3_error(E_WARNING,"Velocis: SQLNumResultCols return %d",stat);
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_LONG(rows);
- } else { /* Was SELECT query */
- res->values = (VResVal *)emalloc(sizeof(VResVal)*cols);
- if ( res->values == NULL ) {
- php3_error(E_WARNING,"Velocis: Out of memory for result columns");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- efree(res);
- RETURN_FALSE;
- }
- res->numcols = cols;
- for ( i = 0; i < cols; i++ ) {
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_NAME,
- res->values[i].name,sizeof(res->values[i].name),
- &colnamelen,NULL);
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_TYPE,
- NULL,0,NULL,&res->values[i].valtype);
- switch ( res->values[i].valtype ) {
- case SQL_LONGVARBINARY:
- case SQL_LONGVARCHAR:
- res->values[i].value = NULL;
- continue;
- default:
- break;
- }
- SQLColAttributes(res->hstmt,i+1,SQL_COLUMN_DISPLAY_SIZE,
- NULL,0,NULL,&coldesc);
- res->values[i].value = (char *)emalloc(coldesc+1);
- if ( res->values[i].value != NULL ) {
- SQLBindCol(res->hstmt,i+1,SQL_C_CHAR,
- res->values[i].value,coldesc+1,
- &res->values[i].vallen);
- }
- }
- }
- res->fetched = 0;
- indx = velocis_add_result(list,res,conn);
- RETURN_LONG(indx);
-}
-
-void php3_velocis_fetch(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind;
- Vresult *res;
- RETCODE stat;
- UDWORD row;
- UWORD RowStat[1];
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php3_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- res->fetched = 1;
- RETURN_TRUE;
-}
-
-void php3_velocis_result(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind,*col;
- Vresult *res;
- RETCODE stat;
- int i,sql_c_type;
- UDWORD row;
- UWORD RowStat[1];
- SWORD indx = -1;
- char *field = NULL;
-
- if ( ARG_COUNT(ht) != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php3_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- if ( col->type == IS_STRING ) {
- field = col->value.str.val;
- } else {
- convert_to_long(col);
- indx = col->value.lval;
- }
- if ( field ) {
- for ( i = 0; i < res->numcols; i++ ) {
- if ( !strcasecmp(res->values[i].name,field)) {
- indx = i;
- break;
- }
- }
- if ( indx < 0 ) {
- php3_error(E_WARNING, "Field %s not found",field);
- RETURN_FALSE;
- }
- } else {
- if ( indx < 0 || indx >= res->numcols ) {
- php3_error(E_WARNING,"Velocis: Field index not in range");
- RETURN_FALSE;
- }
- }
- if ( !res->fetched ) {
- stat = SQLExtendedFetch(res->hstmt,SQL_FETCH_NEXT,1,&row,RowStat);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: SQLFetch return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- res->fetched = 1;
- }
- switch ( res->values[indx].valtype ) {
- case SQL_LONGVARBINARY:
- sql_c_type = SQL_C_BINARY;
- goto l1;
- case SQL_LONGVARCHAR:
- sql_c_type = SQL_C_CHAR;
-l1:
- if ( !res->values[indx].value ) {
- res->values[indx].value = emalloc(4096);
- if ( !res->values[indx].value ) {
- php3_error(E_WARNING,"Out of memory");
- RETURN_FALSE;
- }
- }
- stat = SQLGetData(res->hstmt,indx+1,sql_c_type,
- res->values[indx].value,4095,&res->values[indx].vallen);
- if ( stat == SQL_NO_DATA_FOUND ) {
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: SQLGetData return error");
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_FALSE;
- }
- if ( res->values[indx].valtype == SQL_LONGVARCHAR ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- } else {
- RETURN_LONG((long)res->values[indx].value);
- }
- default:
- if ( res->values[indx].value != NULL ) {
- RETURN_STRING(res->values[indx].value,TRUE);
- }
- }
-}
-
-void php3_velocis_freeresult(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind;
- Vresult *res;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php3_error(E_WARNING,"Velocis: Not result index (%d)",ind->value.lval);
- RETURN_FALSE;
- }
- SQLFreeStmt(res->hstmt,SQL_DROP);
- velocis_del_result(list,ind->value.lval);
- RETURN_TRUE;
-}
-
-void php3_velocis_autocommit(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_ON);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: Set autocommit_on option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-void php3_velocis_off_autocommit(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLSetConnectOption(conn->hdbc,SQL_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF);
- if ( stat != SQL_SUCCESS && stat != SQL_SUCCESS_WITH_INFO ) {
- php3_error(E_WARNING,"Velocis: Set autocommit_off option failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-void php3_velocis_commit(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLTransact(NULL,conn->hdbc,SQL_COMMIT);
- if ( stat != SQL_SUCCESS ) {
- php3_error(E_WARNING,"Velocis: Commit failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-void php3_velocis_rollback(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id;
- RETCODE stat;
- VConn *conn;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&id) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(id);
- conn = velocis_find_conn(list,id->value.lval);
- if ( !conn ) {
- php3_error(E_WARNING,"Velocis: Not connection index (%d)",id->value.lval);
- RETURN_FALSE;
- }
- stat = SQLTransact(NULL,conn->hdbc,SQL_ROLLBACK);
- if ( stat != SQL_SUCCESS ) {
- php3_error(E_WARNING,"Velocis: Rollback failure");
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-void php3_velocis_fieldname(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind,*col;
- Vresult *res;
- SWORD indx;
-
- if ( ARG_COUNT(ht) != 2 || getParameters(ht,2,&ind,&col) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php3_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- convert_to_long(col);
- indx = col->value.lval;
- if ( indx < 0 || indx >= res->numcols ) {
- php3_error(E_WARNING,"Velocis: Field index not in range");
- RETURN_FALSE;
- }
- RETURN_STRING(res->values[indx].name,TRUE);
-}
-
-void php3_velocis_fieldnum(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ind;
- Vresult *res;
-
- if ( ARG_COUNT(ht) != 1 || getParameters(ht,1,&ind) == FAILURE ) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(ind);
- res = velocis_find_result(list,ind->value.lval);
- if ( !res ) {
- php3_error(E_WARNING,"Velocis: Not result index (%d),ind->value.lval");
- RETURN_FALSE;
- }
- RETURN_LONG(res->numcols);
-}
-
-#endif /* HAVE_VELOCIS */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/snmp/winsnmp.c b/ext/snmp/winsnmp.c
deleted file mode 100644
index 38042f9e6c..0000000000
--- a/ext/snmp/winsnmp.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
-Created from the snmputil sample in the Microsoft SDK for NT
-*/
-
-#include "php.h"
-#if COMPILE_DL
-#include "../phpdl.h"
-#include "functions/dl.h"
-#endif
-#include "php3_snmp.h"
-#include <sys/types.h>
-
-#include <windows.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-
-#if HAVE_SNMP
-
-#include <snmp.h>
-#include <mgmtapi.h>
-
-
-function_entry snmp_functions[] = {
- {"snmpget", php3_snmpget, NULL},
- {"snmpwalk", php3_snmpwalk, NULL},
- {NULL,NULL,NULL}
-};
-
-php3_module_entry snmp_module_entry = {
- "SNMP",snmp_functions,NULL,NULL,NULL,NULL,NULL,0,0,0,NULL
-};
-
-#if COMPILE_DL
-DLEXPORT php3_module_entry *get_module() { return &snmp_module_entry; }
-#endif
-
-#define GET 1
-#define WALK 2
-#define GETNEXT 3
-
-#define TIMEOUT 6000 /* milliseconds */
-#define RETRIES 3
-
-
-void _php3_snmp(INTERNAL_FUNCTION_PARAMETERS, int st) {
- pval *a1, *a2, *a3;
- INT operation;
- LPSTR agent;
- LPSTR community;
- RFC1157VarBindList variableBindings;
- LPSNMP_MGR_SESSION session;
-
- INT timeout = TIMEOUT;
- INT retries = RETRIES;
-
- BYTE requestType;
- AsnInteger errorStatus;
- AsnInteger errorIndex;
- AsnObjectIdentifier oid;
- char *chkPtr = NULL;
-
- if (getParameters(ht, 3, &a1, &a2, &a3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(a1);
- convert_to_string(a2);
- convert_to_string(a3);
-
- agent=a1->value.str.val;
- community=a2->value.str.val;
- operation=st;
- SnmpMgrStrToOid(a3->value.str.val, &oid);
-
-/*
- I've limited this to only one oid, but we can create a
- list of oid's here, and expand the function to take multiple
- oid's
-*/
- variableBindings.list->name = oid;
- variableBindings.list->value.asnType = ASN_NULL;
- variableBindings.len = 1;
-
-/* Establish a SNMP session to communicate with the remote agent. The
- community, communications timeout, and communications retry count
- for the session are also required.
-*/
- if ((session = SnmpMgrOpen(agent, community, timeout, retries)) == NULL){
- php3_error(E_WARNING,"error on SnmpMgrOpen %d\n", GetLastError());
- }
-
- /* Determine and perform the requested operation.*/
- if (operation == GET || operation == GETNEXT){
- /* Get and GetNext are relatively simple operations to perform.
- Simply initiate the request and process the result and/or
- possible error conditions. */
-
- if (operation == GET){
- requestType = ASN_RFC1157_GETREQUEST;
- } else {
- requestType = ASN_RFC1157_GETNEXTREQUEST;
- }
-
- /* Request that the API carry out the desired operation.*/
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error. */
- php3_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
- } else {
- /* The API succeeded, errors may be indicated from the remote
- agent. */
- if (errorStatus > 0){
- php3_error(E_WARNING,"Error: errorStatus=%d, errorIndex=%d\n",
- errorStatus, errorIndex);
- } else {
- /* Display the resulting variable bindings.*/
- UINT i;
- char *string = NULL;
-
- for(i=0; i < variableBindings.len; i++)
- {
- SnmpMgrOidToStr(&variableBindings.list[i].name, &string);
- php3_printf("Variable = %s\n", string);
- if (string) SNMP_free(string);
-
- php3_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[i].value);
-
- php3_printf("\n");
- } /* end for() */
- }
- }
-
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- }
- else if (operation == WALK)
- {
- /* Walk is a common term used to indicate that all MIB variables
- under a given OID are to be traversed and displayed. This is
- a more complex operation requiring tests and looping in addition
- to the steps for get/getnext above. */
- AsnObjectIdentifier root;
- AsnObjectIdentifier tempOid;
-
- SnmpUtilOidCpy(&root, &variableBindings.list[0].name);
- requestType = ASN_RFC1157_GETNEXTREQUEST;
-
- while(1)
- {
- if (!SnmpMgrRequest(session, requestType, &variableBindings,
- &errorStatus, &errorIndex)){
- /* The API is indicating an error.*/
- php3_error(E_WARNING,"error on SnmpMgrRequest %d\n", GetLastError());
- break;
- }
- else
- {
- /* The API succeeded, errors may be indicated from the remote
- agent.
- Test for end of subtree or end of MIB. */
- if (errorStatus == SNMP_ERRORSTATUS_NOSUCHNAME ||
- SnmpUtilOidNCmp(&variableBindings.list[0].name,
- &root, root.idLength))
- {
- PUTS("End of MIB subtree.\n\n");
- break;
- }
-
- /* Test for general error conditions or sucesss. */
- if (errorStatus > 0){
- php3_error(E_ERROR,"Error: errorStatus=%d, errorIndex=%d \n",
- errorStatus, errorIndex);
- break;
- }
- else
- {
- /* Display resulting variable binding for this iteration. */
- char *string = NULL;
-
- SnmpMgrOidToStr(&variableBindings.list[0].name, &string);
- php3_printf("Variable = %s\n", string);
- if (string) SNMP_free(string);
-
- php3_printf("Value = ");
- SnmpUtilPrintAsnAny(&variableBindings.list[0].value);
-
- php3_printf("\n");
- }
- } /* end if () */
- /* Prepare for the next iteration. Make sure returned oid is
- preserved and the returned value is freed.
- */
- SnmpUtilOidCpy(&tempOid, &variableBindings.list[0].name);
- SnmpUtilVarBindFree(&variableBindings.list[0]);
- SnmpUtilOidCpy(&variableBindings.list[0].name, &tempOid);
- variableBindings.list[0].value.asnType = ASN_NULL;
- SnmpUtilOidFree(&tempOid);
- } /* end while() */
- /* Free the variable bindings that have been allocated.*/
- SnmpUtilVarBindListFree(&variableBindings);
- SnmpUtilOidFree(&root);
- } // end if (operation)
-
-
- /* Close SNMP session with the remote agent.*/
- if (!SnmpMgrClose(session)){
- php3_error(E_WARNING,"error on SnmpMgrClose %d\n", GetLastError());
- }
-}
-
-DLEXPORT void php3_snmpget(INTERNAL_FUNCTION_PARAMETERS) {
- _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-
-DLEXPORT void php3_snmpwalk(INTERNAL_FUNCTION_PARAMETERS) {
- _php3_snmp(INTERNAL_FUNCTION_PARAM_PASSTHRU,2);
-}
-
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/Makefile.am b/ext/standard/Makefile.am
deleted file mode 100644
index 0a7617147b..0000000000
--- a/ext/standard/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-## Process this file with automake to produce Makefile.in
-INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend -I@top_srcdir@/functions
-noinst_LIBRARIES=libphpext_standard.a
-libphpext_standard_a_SOURCES=\
- base64.c basic_functions.c browscap.c datetime.c dir.c \
- dns.c exec.c file.c filestat.c formatted_print.c fsock.c \
- html.c image.c info.c link.c mail.c math.c md5.c microtime.c \
- pack.c pageinfo.c rand.c reg.c soundex.c string.c \
- syslog.c type.c uniqid.c url.c iptc.c var.c quot_print.c \
- cyr_convert.c
-
diff --git a/ext/standard/base64.c b/ext/standard/base64.c
deleted file mode 100644
index 392f2451ac..0000000000
--- a/ext/standard/base64.c
+++ /dev/null
@@ -1,197 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <string.h>
-
-#include "php.h"
-#include "base64.h"
-
-static char base64_table[] =
- { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0'
- };
-static char base64_pad = '=';
-
-unsigned char *_php3_base64_encode(const unsigned char *string, int length, int *ret_length) {
- const unsigned char *current = string;
- int i = 0;
- unsigned char *result = (unsigned char *)emalloc(((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char));
-
- while (length > 2) { /* keep going until we have less than 24 bits */
- result[i++] = base64_table[current[0] >> 2];
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)];
- result[i++] = base64_table[current[2] & 0x3f];
-
- current += 3;
- length -= 3; /* we just handle 3 octets of data */
- }
-
- /* now deal with the tail end of things */
- if (length != 0) {
- result[i++] = base64_table[current[0] >> 2];
- if (length > 1) {
- result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)];
- result[i++] = base64_table[(current[1] & 0x0f) << 2];
- result[i++] = base64_pad;
- }
- else {
- result[i++] = base64_table[(current[0] & 0x03) << 4];
- result[i++] = base64_pad;
- result[i++] = base64_pad;
- }
- }
- if(ret_length) {
- *ret_length = i;
- }
- result[i] = '\0';
- return result;
-}
-
-/* as above, but backwards. :) */
-unsigned char *_php3_base64_decode(const unsigned char *string, int length, int *ret_length) {
- const unsigned char *current = string;
- int ch, i = 0, j = 0, k;
-
- unsigned char *result = (unsigned char *)emalloc((length / 4 * 3 + 1) * sizeof(char));
- if (result == NULL) {
- return NULL;
- }
-
- /* run through the whole string, converting as we go */
- while ((ch = *current++) != '\0') {
- if (ch == base64_pad) break;
- ch = (int)strchr(base64_table, ch);
- if (ch == 0) {
- efree(result);
- return NULL;
- }
- ch -= (int)base64_table;
-
- switch(i % 4) {
- case 0:
- result[j] = ch << 2;
- break;
- case 1:
- result[j++] |= ch >> 4;
- result[j] = (ch & 0x0f) << 4;
- break;
- case 2:
- result[j++] |= ch >>2;
- result[j] = (ch & 0x03) << 6;
- break;
- case 3:
- result[j++] |= ch;
- break;
- }
- i++;
- }
-
- k = j;
- /* mop things up if we ended on a boundary */
- if (ch == base64_pad) {
- switch(i % 4) {
- case 0:
- case 1:
- efree(result);
- return NULL;
- case 2:
- k++;
- case 3:
- result[k++] = 0;
- }
- }
- if(ret_length) {
- *ret_length = j;
- }
- result[k] = '\0';
- return result;
-}
-
-/* {{{ proto string base64_encode(string str)
- Encodes string using MIME base64 algorithm */
-void php3_base64_encode(INTERNAL_FUNCTION_PARAMETERS) {
- pval *string;
- unsigned char *result;
- int ret_length;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(string);
- result = _php3_base64_encode(string->value.str.val, string->value.str.len, &ret_length);
- if (result != NULL) {
- return_value->value.str.val = result;
- return_value->value.str.len = ret_length;
- return_value->type = IS_STRING;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/* {{{ proto string base64_decode(string str)
- Decodes string using MIME base64 algorithm */
-void php3_base64_decode(INTERNAL_FUNCTION_PARAMETERS) {
- pval *string;
- unsigned char *result;
- int ret_length;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(string);
- result = _php3_base64_decode(string->value.str.val, string->value.str.len, &ret_length);
- if (result != NULL) {
- return_value->value.str.val = result;
- return_value->value.str.len = ret_length;
- return_value->type = IS_STRING;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/base64.h b/ext/standard/base64.h
deleted file mode 100644
index 9dc2312551..0000000000
--- a/ext/standard/base64.h
+++ /dev/null
@@ -1,47 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _BASE64_h
-#define _BASE64_h
-
-extern void php3_base64_decode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_base64_encode(INTERNAL_FUNCTION_PARAMETERS);
-
-extern unsigned char *_php3_base64_encode(const unsigned char *, int, int *);
-extern unsigned char *_php3_base64_decode(const unsigned char *, int, int *);
-
-#endif /* _BASE64_h */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
deleted file mode 100644
index 2c88181274..0000000000
--- a/ext/standard/basic_functions.c
+++ /dev/null
@@ -1,2158 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#define HASH_OF(p) ((p)->type==IS_ARRAY ? (p)->value.ht : (((p)->type==IS_OBJECT ? (p)->value.obj.properties : NULL)))
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "php_ini.h"
-#include "internal_functions_registry.h"
-#include "php3_standard.h"
-#include "zend_operators.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <math.h>
-#include <time.h>
-#include <stdio.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-#include "safe_mode.h"
-/*
-#include "functions/basic_functions.h"
-#include "functions/phpmath.h"
-#include "functions/php3_string.h"
-#include "functions/dns.h"
-#include "functions/md5.h"
-#include "functions/html.h"
-#include "functions/post.h"
-#include "functions/exec.h"
-#include "functions/info.h"
-#include "functions/url.h"
-#include "functions/datetime.h"
-#include "functions/fsock.h"
-#include "functions/image.h"
-#include "functions/php3_link.h"
-#include "functions/php3_filestat.h"
-#include "functions/microtime.h"
-#include "functions/pageinfo.h"
-#include "functions/uniqid.h"
-#include "functions/base64.h"
-#include "functions/php3_mail.h"
-#include "functions/php3_var.h"
-#include "functions/php3_iptc.h"
-#include "functions/quot_print.h"
-#include "functions/cyr_convert.h"
-*/
-#if WIN32|WINNT
-#include "win32/unistd.h"
-#endif
-#include "zend_globals.h"
-
-#include "php_globals.h"
-
-static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-static pval *user_compare_func_name;
-static HashTable *user_shutdown_function_names;
-
-/* some prototypes for local functions */
-void user_shutdown_function_dtor(pval *user_shutdown_function_name);
-int user_shutdown_function_executor(pval *user_shutdown_function_name);
-void php3_call_shutdown_functions(void);
-
-function_entry basic_functions[] = {
- {"intval", int_value, NULL},
- {"doubleval", double_value, NULL},
- {"strval", string_value, NULL},
- PHP_FE(define, NULL)
- PHP_FE(defined, NULL)
- {"short_tags", php3_toggle_short_open_tag, NULL},
- {"sleep", php3_sleep, NULL},
- {"usleep", php3_usleep, NULL},
- {"ksort", php3_key_sort, first_arg_force_ref},
- {"asort", php3_asort, first_arg_force_ref},
- {"arsort", php3_arsort, first_arg_force_ref},
- {"sort", php3_sort, first_arg_force_ref},
- {"rsort", php3_rsort, first_arg_force_ref},
- {"usort", php3_user_sort, first_arg_force_ref},
- {"uasort", php3_auser_sort, first_arg_force_ref},
- {"uksort", php3_user_key_sort, first_arg_force_ref},
- {"array_walk", php3_array_walk, first_arg_force_ref},
- {"sizeof", php3_count, first_arg_allow_ref},
- {"count", php3_count, first_arg_allow_ref},
- {"time", php3_time, NULL},
- {"mktime", php3_mktime, NULL},
- {"gmmktime", php3_gmmktime, NULL},
-#if HAVE_STRFTIME
- {"strftime", php3_strftime, NULL},
-#endif
- {"date", php3_date, NULL},
- {"gmdate", php3_gmdate, NULL},
- {"getdate", php3_getdate, NULL},
- {"checkdate", php3_checkdate, NULL},
- {"chr", php3_chr, NULL},
- {"ord", php3_ord, NULL},
- {"flush", php3_flush, NULL},
- {"end", array_end, first_arg_force_ref},
- {"prev", array_prev, first_arg_force_ref},
- {"next", array_next, first_arg_force_ref},
- {"reset", array_reset, first_arg_force_ref},
- {"current", array_current, first_arg_force_ref},
- {"key", array_current_key, first_arg_force_ref},
- {"each", array_each, first_arg_force_ref},
- {"gettype", php3_gettype, NULL},
- {"settype", php3_settype, first_arg_force_ref},
- {"min", php3_min, NULL},
- {"max", php3_max, NULL},
-
- {"addslashes", php3_addslashes, NULL},
- {"chop", php3_chop, NULL},
- {"str_replace", php3_str_replace, NULL},
- {"chunk_split", php3_chunk_split, NULL},
- {"trim", php3_trim, NULL},
- {"ltrim", php3_ltrim, NULL},
- {"rtrim", php3_chop, NULL},
- {"pos", array_current, first_arg_force_ref},
-
- {"fsockopen", php3_fsockopen, third_and_fourth_args_force_ref},
- {"getimagesize", php3_getimagesize, NULL},
- {"htmlspecialchars", php3_htmlspecialchars, NULL},
- {"htmlentities", php3_htmlentities, NULL},
- {"md5", php3_md5, NULL},
-
- {"iptcparse", php3_iptcparse, NULL},
- {"parse_url", php3_parse_url, NULL},
-
- {"parse_str", php3_parsestr, NULL},
- {"phpinfo", php3_info, NULL},
- {"phpversion", php3_version, NULL},
- {"strlen", php3_strlen, NULL},
- {"strcmp", php3_strcmp, NULL},
- {"strspn", php3_strspn, NULL},
- {"strcspn", php3_strcspn, NULL},
- {"strcasecmp", php3_strcasecmp, NULL},
- {"strtok", php3_strtok, NULL},
- {"strtoupper", php3_strtoupper, NULL},
- {"strtolower", php3_strtolower, NULL},
- {"strchr", php3_strstr, NULL},
- {"strpos", php3_strpos, NULL},
- {"strrpos", php3_strrpos, NULL},
- {"strrev", php3_strrev, NULL},
- {"hebrev", php3_hebrev, NULL},
- {"hebrevc", php3_hebrev_with_conversion,NULL},
- {"nl2br", php3_newline_to_br, NULL},
- {"basename", php3_basename, NULL},
- {"dirname", php3_dirname, NULL},
- {"stripslashes", php3_stripslashes, NULL},
- {"strstr", php3_strstr, NULL},
- {"stristr", php3_stristr, NULL},
- {"strrchr", php3_strrchr, NULL},
- {"substr", php3_substr, NULL},
- {"quotemeta", php3_quotemeta, NULL},
- {"urlencode", php3_urlencode, NULL},
- {"urldecode", php3_urldecode, NULL},
- {"rawurlencode", php3_rawurlencode, NULL},
- {"rawurldecode", php3_rawurldecode, NULL},
- {"ucfirst", php3_ucfirst, NULL},
- {"ucwords", php3_ucwords, NULL},
- {"strtr", php3_strtr, NULL},
- {"sprintf", php3_user_sprintf, NULL},
- {"printf", php3_user_printf, NULL},
- {"setlocale", php3_setlocale, NULL},
-
- {"exec", php3_exec, second_and_third_args_force_ref},
- {"system", php3_system, second_arg_force_ref},
- {"escapeshellcmd", php3_escapeshellcmd, NULL},
- {"passthru", php3_passthru, second_arg_force_ref},
- PHP_FE(shell_exec, NULL)
-
- {"soundex", soundex, NULL},
-
- {"rand", php3_rand, NULL},
- {"srand", php3_srand, NULL},
- {"getrandmax", php3_getrandmax, NULL},
- {"mt_rand", php3_mt_rand, NULL},
- {"mt_srand", php3_mt_srand, NULL},
- {"mt_getrandmax", php3_mt_getrandmax, NULL},
- {"gethostbyaddr", php3_gethostbyaddr, NULL},
- {"gethostbyname", php3_gethostbyname, NULL},
- {"gethostbynamel", php3_gethostbynamel, NULL},
-#if !(WIN32|WINNT)||HAVE_BINDLIB
- {"checkdnsrr", php3_checkdnsrr, NULL},
- {"getmxrr", php3_getmxrr, second_and_third_args_force_ref},
-#endif
- {"explode", php3_explode, NULL},
- {"implode", php3_implode, NULL},
- {"getenv", php3_getenv, NULL},
- {"error_reporting", php3_error_reporting, NULL},
- {"clearstatcache", php3_clearstatcache, NULL},
-
- {"unlink", php3_unlink, NULL},
-
- {"getmyuid", php3_getmyuid, NULL},
- {"getmypid", php3_getmypid, NULL},
- /*getmyiid is here for forward compatibility with 3.1
- See pageinfo.c in 3.1 for more information*/
- {"getmyiid", php3_getmypid, NULL},
- {"getmyinode", php3_getmyinode, NULL},
- {"getlastmod", php3_getlastmod, NULL},
-
- {"base64_decode", php3_base64_decode, NULL},
- {"base64_encode", php3_base64_encode, NULL},
-
- {"abs", php3_abs, NULL},
- {"ceil", php3_ceil, NULL},
- {"floor", php3_floor, NULL},
- {"round", php3_round, NULL},
- {"sin", php3_sin, NULL},
- {"cos", php3_cos, NULL},
- {"tan", php3_tan, NULL},
- {"asin", php3_asin, NULL},
- {"acos", php3_acos, NULL},
- {"atan", php3_atan, NULL},
- {"atan2", php3_atan2, NULL},
- {"pi", php3_pi, NULL},
- {"pow", php3_pow, NULL},
- {"exp", php3_exp, NULL},
- {"log", php3_log, NULL},
- {"log10", php3_log10, NULL},
- {"sqrt", php3_sqrt, NULL},
- {"deg2rad", php3_deg2rad, NULL},
- {"rad2deg", php3_rad2deg, NULL},
- {"bindec", php3_bindec, NULL},
- {"hexdec", php3_hexdec, NULL},
- {"octdec", php3_octdec, NULL},
- {"decbin", php3_decbin, NULL},
- {"decoct", php3_decoct, NULL},
- {"dechex", php3_dechex, NULL},
- {"base_convert",php3_base_convert, NULL},
- {"number_format", php3_number_format, NULL},
-
-#if HAVE_PUTENV
- {"putenv", php3_putenv, NULL},
-#endif
- {"microtime", php3_microtime, NULL},
- {"uniqid", php3_uniqid, NULL},
- {"linkinfo", php3_linkinfo, NULL},
- {"readlink", php3_readlink, NULL},
- {"symlink", php3_symlink, NULL},
- {"link", php3_link, NULL},
- {"quoted_printable_decode", php3_quoted_printable_decode, NULL},
- {"convert_cyr_string", php3_convert_cyr_string, NULL},
- {"get_current_user", php3_get_current_user, NULL},
- {"set_time_limit", php3_set_time_limit, NULL},
-
- {"get_cfg_var", php3_get_cfg_var, NULL},
- {"magic_quotes_runtime", php3_set_magic_quotes_runtime, NULL},
- {"set_magic_quotes_runtime", php3_set_magic_quotes_runtime, NULL},
- {"get_magic_quotes_gpc", php3_get_magic_quotes_gpc, NULL},
- {"get_magic_quotes_runtime", php3_get_magic_quotes_runtime, NULL},
-
- {"is_long", php3_is_long, first_arg_allow_ref},
- {"is_int", php3_is_long, first_arg_allow_ref},
- {"is_integer", php3_is_long, first_arg_allow_ref},
- {"is_float", php3_is_double, first_arg_allow_ref},
- {"is_double", php3_is_double, first_arg_allow_ref},
- {"is_real", php3_is_double, first_arg_allow_ref},
- {"is_string", php3_is_string, first_arg_allow_ref},
- {"is_array", php3_is_array, first_arg_allow_ref},
- {"is_object", php3_is_object, first_arg_allow_ref},
-
- {"leak", php3_leak, NULL},
- {"error_log", php3_error_log, NULL},
- {"call_user_func", php3_call_user_func, NULL},
- {"call_user_method", php3_call_user_method, NULL},
-
- PHP_FE(var_dump, NULL)
- PHP_FE(serialize, first_arg_allow_ref)
- PHP_FE(unserialize, first_arg_allow_ref)
-
- PHP_FE(register_shutdown_function, NULL)
-
- PHP_FE(highlight_file, NULL)
- PHP_NAMED_FE(show_source, php3_highlight_file, NULL)
- PHP_FE(highlight_string, NULL)
-
- PHP_FE(ob_start, NULL)
- PHP_FE(ob_end_flush, NULL)
- PHP_FE(ob_end_clean, NULL)
- PHP_FE(ob_get_contents, NULL)
-
- PHP_FE(ini_get, NULL)
- PHP_FE(ini_alter, NULL)
- PHP_FE(ini_restore, NULL)
-
- PHP_FE(print_r, NULL)
-
- {NULL, NULL, NULL}
-};
-
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("highlight.string", "#foobar", PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("test2", "testing", PHP_INI_SYSTEM, NULL, NULL)
-PHP_INI_END()
-
-
-php3_module_entry basic_functions_module = {
- "Basic Functions", /* extension name */
- basic_functions, /* function list */
- php3_minit_basic, /* process startup */
- php3_mshutdown_basic, /* process shutdown */
- php3_rinit_basic, /* request startup */
- php3_rshutdown_basic, /* request shutdown */
- NULL, /* extension info */
- STANDARD_MODULE_PROPERTIES
-};
-
-#if HAVE_PUTENV
-static HashTable putenv_ht;
-
-static void _php3_putenv_destructor(putenv_entry *pe)
-{
- if (pe->previous_value) {
- putenv(pe->previous_value);
- } else {
-# if HAVE_UNSETENV
- unsetenv(pe->key);
-# else
- char **env;
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env,pe->key,pe->key_len) && (*env)[pe->key_len]=='=') { /* found it */
- *env = "";
- break;
- }
- }
-# endif
- }
- efree(pe->putenv_string);
- efree(pe->key);
-}
-#endif
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-void test_class_startup();
-
-int php3_minit_basic(INIT_FUNC_ARGS)
-{
- TLS_VARS;
-
- REGISTER_DOUBLE_CONSTANT("M_PI", M_PI, CONST_CS | CONST_PERSISTENT);
- test_class_startup();
- REGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-int php3_mshutdown_basic(SHUTDOWN_FUNC_ARGS)
-{
- UNREGISTER_INI_ENTRIES();
- return SUCCESS;
-}
-
-
-int php3_rinit_basic(INIT_FUNC_ARGS)
-{
- TLS_VARS;
- GLOBAL(strtok_string) = NULL;
-#if HAVE_PUTENV
- if (_php3_hash_init(&putenv_ht, 1, NULL, (void (*)(void *)) _php3_putenv_destructor, 0) == FAILURE) {
- return FAILURE;
- }
-#endif
- user_compare_func_name=NULL;
- user_shutdown_function_names=NULL;
- return SUCCESS;
-}
-
-
-int php3_rshutdown_basic(SHUTDOWN_FUNC_ARGS)
-{
- TLS_VARS;
- STR_FREE(GLOBAL(strtok_string));
-#if HAVE_PUTENV
- _php3_hash_destroy(&putenv_ht);
-#endif
- return SUCCESS;
-}
-
-/********************
- * System Functions *
- ********************/
-
-void php3_getenv(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if FHTTPD
- int i;
-#endif
- pval *str;
- char *ptr;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
-#if FHTTPD
- ptr=NULL;
- if (str->type == IS_STRING && req){
- for(i=0;i<req->nlines;i++){
- if (req->lines[i].paramc>1){
- if (req->lines[i].params[0]){
- if (!strcmp(req->lines[i].params[0],
- str->value.str.val)){
- ptr=req->lines[i].params[1];
- i=req->nlines;
- }
- }
- }
- }
- }
- if (!ptr) ptr = getenv(str->value.str.val);
- if (ptr
-#else
-
- if (str->type == IS_STRING &&
-#if APACHE
- ((ptr = (char *)table_get(GLOBAL(php3_rqst)->subprocess_env, str->value.str.val)) || (ptr = getenv(str->value.str.val)))
-#endif
-#if CGI_BINARY
- (ptr = getenv(str->value.str.val))
-#endif
-
-#if USE_SAPI
- (ptr = GLOBAL(sapi_rqst)->getenv(GLOBAL(sapi_rqst)->scid,str->value.str.val))
-#endif
-#endif
- ) {
- RETURN_STRING(ptr,1);
- }
- RETURN_FALSE;
-}
-
-
-#if HAVE_PUTENV
-void php3_putenv(INTERNAL_FUNCTION_PARAMETERS)
-{
-
- pval *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- if (str->value.str.val && *(str->value.str.val)) {
- int ret;
- char *p,**env;
- putenv_entry pe;
-
- pe.putenv_string = estrndup(str->value.str.val,str->value.str.len);
- pe.key = str->value.str.val;
- if ((p=strchr(pe.key,'='))) { /* nullify the '=' if there is one */
- *p='\0';
- }
- pe.key_len = strlen(pe.key);
- pe.key = estrndup(pe.key,pe.key_len);
-
- _php3_hash_del(&putenv_ht,pe.key,pe.key_len+1);
-
- /* find previous value */
- pe.previous_value = NULL;
- for (env = environ; env != NULL && *env != NULL; env++) {
- if (!strncmp(*env,pe.key,pe.key_len) && (*env)[pe.key_len]=='=') { /* found it */
- pe.previous_value = *env;
- break;
- }
- }
-
- if ((ret=putenv(pe.putenv_string))==0) { /* success */
- _php3_hash_add(&putenv_ht,pe.key,pe.key_len+1,(void **) &pe,sizeof(putenv_entry),NULL);
- RETURN_TRUE;
- } else {
- efree(pe.putenv_string);
- efree(pe.key);
- RETURN_FALSE;
- }
- }
-}
-#endif
-
-
-void php3_error_reporting(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- int old_error_reporting;
- ELS_FETCH();
-
- old_error_reporting = EG(error_reporting);
- switch (ARG_COUNT(ht)) {
- case 0:
- break;
- case 1:
- if (getParameters(ht,1,&arg) == FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(arg);
- EG(error_reporting)=arg->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- RETVAL_LONG(old_error_reporting);
-}
-
-void php3_toggle_short_open_tag(INTERNAL_FUNCTION_PARAMETERS)
-{
- /* has to be implemented within Zend */
-#if 0
- pval *value;
- int ret;
- TLS_VARS;
-
- ret = php3_ini.short_open_tag;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(value);
- php3_ini.short_open_tag = value->value.lval;
- RETURN_LONG(ret);
-#endif
-}
-
-/*******************
- * Basic Functions *
- *******************/
-
-void int_value(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num, *arg_base;
- int base;
-
- switch(ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- base = 10;
- break;
- case 2:
- if (getParameters(ht, 2, &num, &arg_base) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg_base);
- base = arg_base->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long_base(num, base);
- *return_value = *num;
-}
-
-
-void double_value(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- *return_value = *num;
-}
-
-
-void string_value(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(num);
- *return_value = *num;
- pval_copy_constructor(return_value);
-}
-
-static int array_key_compare(const void *a, const void *b)
-{
- Bucket *first;
- Bucket *second;
- int min, r;
-
- first = *((Bucket **) a);
- second = *((Bucket **) b);
-
- if (first->arKey == NULL && second->arKey == NULL) {
- return (first->h - second->h);
- } else if (first->arKey == NULL) {
- return -1;
- } else if (second->arKey == NULL) {
- return 1;
- }
- min = MIN(first->nKeyLength, second->nKeyLength);
- if ((r = memcmp(first->arKey, second->arKey, min)) == 0) {
- return (first->nKeyLength - second->nKeyLength);
- } else {
- return r;
- }
-}
-
-
-void php3_key_sort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in ksort() call");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to ksort()");
- return;
- }
- if (_php3_hash_sort(target_hash, array_key_compare,0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-
-
-/* the current implementation of count() is a definite example of what
- * user functions should NOT look like. It's a hack, until we get
- * unset() to work right in 3.1
- */
-void php3_count(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- if (array->type == IS_STRING && array->value.str.val==undefined_variable_string) {
- RETURN_LONG(0);
- } else {
- RETURN_LONG(1);
- }
- }
-
- RETURN_LONG(_php3_hash_num_elements(target_hash));
-}
-
-
-/* Numbers are always smaller than strings int this function as it
- * anyway doesn't make much sense to compare two different data types.
- * This keeps it consistant and simple.
- */
-static int array_data_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval *first;
- pval *second;
- double dfirst, dsecond;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- first = *((pval **) f->pData);
- second = *((pval **) s->pData);
-
- if ((first->type == IS_LONG || first->type == IS_DOUBLE) &&
- (second->type == IS_LONG || second->type == IS_DOUBLE)) {
- if (first->type == IS_LONG) {
- dfirst = (double) first->value.lval;
- } else {
- dfirst = first->value.dval;
- }
- if (second->type == IS_LONG) {
- dsecond = (double) second->value.lval;
- } else {
- dsecond = second->value.dval;
- }
- if (dfirst < dsecond) {
- return -1;
- } else if (dfirst == dsecond) {
- return 0;
- } else {
- return 1;
- }
- }
- if ((first->type == IS_LONG || first->type == IS_DOUBLE) &&
- second->type == IS_STRING) {
- return -1;
- } else if ((first->type == IS_STRING) &&
- (second->type == IS_LONG || second->type == IS_DOUBLE)) {
- return 1;
- }
- if (first->type == IS_STRING && second->type == IS_STRING) {
- return strcmp(first->value.str.val, second->value.str.val);
- }
- return 0; /* Anything else is equal as it can't be compared */
-}
-
-static int array_reverse_data_compare(const void *a, const void *b)
-{
- return array_data_compare(a,b)*-1;
-}
-
-void php3_asort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in asort() call");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to asort()");
- return;
- }
- if (_php3_hash_sort(target_hash, array_data_compare,0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-
-void php3_arsort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in arsort() call");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to arsort()");
- return;
- }
- if (_php3_hash_sort(target_hash, array_reverse_data_compare,0) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-
-void php3_sort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in sort() call");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to sort()");
- return;
- }
- if (_php3_hash_sort(target_hash, array_data_compare,1) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-
-void php3_rsort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- HashTable *target_hash;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in rsort() call");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to rsort()");
- return;
- }
- if (_php3_hash_sort(target_hash, array_reverse_data_compare,1) == FAILURE) {
- return;
- }
- RETURN_TRUE;
-}
-
-
-static int array_user_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval *args[2];
- pval retval;
- CLS_FETCH();
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- args[0] = (pval *) f->pData;
- args[1] = (pval *) s->pData;
-
- if (call_user_function(CG(function_table), NULL, user_compare_func_name, &retval, 2, args)==SUCCESS) {
- convert_to_long(&retval);
- return retval.value.lval;
- } else {
- return 0;
- }
-}
-
-
-void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- pval *old_compare_func;
- HashTable *target_hash;
- TLS_VARS;
-
- old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
- user_compare_func_name = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in usort() call");
- user_compare_func_name = old_compare_func;
- return;
- }
- convert_to_string(user_compare_func_name);
- if (_php3_hash_sort(target_hash, array_user_compare, 1) == FAILURE) {
- user_compare_func_name = old_compare_func;
- return;
- }
- user_compare_func_name = old_compare_func;
- RETURN_TRUE;
-}
-
-void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- pval *old_compare_func;
- HashTable *target_hash;
- TLS_VARS;
-
- old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
- user_compare_func_name = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in uasort() call");
- user_compare_func_name = old_compare_func;
- return;
- }
- convert_to_string(user_compare_func_name);
- if (_php3_hash_sort(target_hash, array_user_compare, 0) == FAILURE) {
- user_compare_func_name = old_compare_func;
- return;
- }
- user_compare_func_name = old_compare_func;
- RETURN_TRUE;
-}
-
-
-static int array_user_key_compare(const void *a, const void *b)
-{
- Bucket *f;
- Bucket *s;
- pval key1, key2;
- pval *args[2];
- pval retval;
- int status;
- CLS_FETCH();
-
- args[0] = &key1;
- args[1] = &key2;
-
- f = *((Bucket **) a);
- s = *((Bucket **) b);
-
- if (f->arKey) {
- key1.value.str.val = estrndup(f->arKey, f->nKeyLength);
- key1.value.str.len = f->nKeyLength;
- key1.type = IS_STRING;
- } else {
- key1.value.lval = f->h;
- key1.type = IS_LONG;
- }
- if (s->arKey) {
- key2.value.str.val = estrndup(s->arKey, s->nKeyLength);
- key2.value.str.len = s->nKeyLength;
- key2.type = IS_STRING;
- } else {
- key2.value.lval = s->h;
- key2.type = IS_LONG;
- }
-
- status = call_user_function(CG(function_table), NULL, user_compare_func_name, &retval, 2, args);
-
- pval_destructor(&key1);
- pval_destructor(&key2);
-
- if (status==SUCCESS) {
- convert_to_long(&retval);
- return retval.value.lval;
- } else {
- return 0;
- }
-}
-
-
-void php3_user_key_sort(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- pval *old_compare_func;
- HashTable *target_hash;
- TLS_VARS;
-
- old_compare_func = user_compare_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &user_compare_func_name) == FAILURE) {
- user_compare_func_name = old_compare_func;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in uksort() call");
- user_compare_func_name = old_compare_func;
- return;
- }
- convert_to_string(user_compare_func_name);
- if (_php3_hash_sort(target_hash, array_user_key_compare, 0) == FAILURE) {
- user_compare_func_name = old_compare_func;
- return;
- }
- user_compare_func_name = old_compare_func;
- RETURN_TRUE;
-}
-
-
-void array_end(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array, **entry;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to end() is not an array or object");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to end()");
- }
- _php3_hash_internal_pointer_end(target_hash);
- if (_php3_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
- *return_value = **entry;
- pval_copy_constructor(return_value);
-}
-
-
-void array_prev(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array, **entry;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to prev() is not an array or object");
- RETURN_FALSE;
- }
- _php3_hash_move_backwards(target_hash);
- if (_php3_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- pval_copy_constructor(return_value);
-}
-
-
-void array_next(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array, **entry;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to next() is not an array or object");
- RETURN_FALSE;
- }
- _php3_hash_move_forward(target_hash);
- if (_php3_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- RETURN_FALSE;
- }
-
- *return_value = **entry;
- pval_copy_constructor(return_value);
-}
-
-
-void array_each(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array,*entry,**entry_ptr, *tmp;
- char *string_key;
- ulong num_key;
- pval **inserted_pointer;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING,"Variable passed to each() is not an array or object");
- return;
- }
- if (_php3_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 = (pval *)emalloc(sizeof(pval));
- *tmp = *entry;
- pval_copy_constructor(tmp);
- tmp->is_ref=0;
- tmp->refcount=0;
- entry=tmp;
- }
- _php3_hash_index_update(return_value->value.ht, 1, &entry, sizeof(pval *), NULL);
- entry->refcount++;
- _php3_hash_update_ptr(return_value->value.ht, "value", sizeof("value"), entry, sizeof(pval *), NULL);
- entry->refcount++;
-
- /* add the key elements */
- switch (_php3_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;
- }
- _php3_hash_update(return_value->value.ht, "key", sizeof("key"), inserted_pointer, sizeof(pval *), NULL);
- (*inserted_pointer)->refcount++;
- _php3_hash_move_forward(target_hash);
-}
-
-
-void array_reset(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array, **entry;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to reset() is not an array or object");
- return;
- }
- _php3_hash_internal_pointer_reset(target_hash);
- if (_php3_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- return;
- }
-
- *return_value = **entry;
- pval_copy_constructor(return_value);
- return_value->refcount=1;
- return_value->is_ref=0;
-}
-
-void array_current(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array, **entry;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to current() is not an array or object");
- return;
- }
- if (_php3_hash_get_current_data(target_hash, (void **) &entry) == FAILURE) {
- return;
- }
- *return_value = **entry;
- pval_copy_constructor(return_value);
-}
-
-
-void array_current_key(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *array;
- char *string_key;
- ulong num_key;
- HashTable *target_hash;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Variable passed to key() is not an array or object");
- return;
- }
- if (!ParameterPassedByReference(ht,1)) {
- php3_error(E_WARNING, "Array not passed by reference in call to key()");
- }
- switch (_php3_hash_get_current_key(target_hash, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- return_value->value.str.val = string_key;
- return_value->value.str.len = strlen(string_key);
- return_value->type = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- return_value->type = IS_LONG;
- return_value->value.lval = num_key;
- break;
- case HASH_KEY_NON_EXISTANT:
- return;
- }
-}
-
-#ifdef __cplusplus
-void php3_flush(HashTable *)
-#else
-void php3_flush(INTERNAL_FUNCTION_PARAMETERS)
-#endif
-{
-#if APACHE
- TLS_VARS;
-# if MODULE_MAGIC_NUMBER > 19970110
- rflush(GLOBAL(php3_rqst));
-# else
- bflush(GLOBAL(php3_rqst)->connection->client);
-# endif
-#endif
-#if FHTTPD
- /*FIXME -- what does it flush really? the whole response?*/
-#endif
-#if CGI_BINARY
- fflush(stdout);
-#endif
-#if USE_SAPI
- TLS_VARS;
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
-#endif
-}
-
-
-void php3_sleep(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(num);
- sleep(num->value.lval);
-}
-
-void php3_usleep(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if HAVE_USLEEP
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(num);
- usleep(num->value.lval);
-#endif
-}
-
-void php3_gettype(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg->type) {
- case IS_LONG:
- RETVAL_STRING("integer",1);
- break;
- case IS_DOUBLE:
- RETVAL_STRING("double",1);
- break;
- case IS_STRING:
- RETVAL_STRING("string",1);
- break;
- case IS_ARRAY:
- RETVAL_STRING("array",1);
- break;
- case IS_OBJECT:
- RETVAL_STRING("object",1);
- break;
- /*
- {
- char *result;
- int res_len;
-
- res_len = sizeof("object of type ")-1 + arg->value.obj.ce->name_length;
- result = (char *) emalloc(res_len+1);
- sprintf(result, "object of type %s", arg->value.obj.ce->name);
- RETVAL_STRINGL(result, res_len, 0);
- }
- */
- break;
- default:
- RETVAL_STRING("unknown type",1);
- }
-}
-
-
-void php3_settype(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *var, *type;
- char *new_type;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &var, &type) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(type);
- new_type = type->value.str.val;
-
- if (!strcasecmp(new_type, "integer")) {
- convert_to_long(var);
- } else if (!strcasecmp(new_type, "double")) {
- convert_to_double(var);
- } else if (!strcasecmp(new_type, "string")) {
- convert_to_string(var);
- } else if (!strcasecmp(new_type, "array")) {
- convert_to_array(var);
- } else if (!strcasecmp(new_type, "object")) {
- convert_to_object(var);
- } else {
- php3_error(E_WARNING, "settype: invalid type");
- RETURN_FALSE;
- }
- RETVAL_TRUE;
-}
-
-
-void php3_min(INTERNAL_FUNCTION_PARAMETERS)
-{
- int argc=ARG_COUNT(ht);
- pval **result;
-
- if (argc<=0) {
- php3_error(E_WARNING, "min: must be passed at least 1 value");
- var_uninit(return_value);
- return;
- }
- if (argc == 1) {
- pval *arr;
-
- if (getParameters(ht, 1, &arr) == FAILURE ||
- arr->type != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (_php3_hash_minmax(arr->value.ht, array_data_compare, 0, (void **) &result)==SUCCESS) {
- *return_value = **result;
- pval_copy_constructor(return_value);
- } else {
- php3_error(E_WARNING, "min: array must contain at least 1 element");
- var_uninit(return_value);
- }
- } else {
- if (_php3_hash_minmax(ht, array_data_compare, 0, (void **) &result)==SUCCESS) {
- *return_value = **result;
- pval_copy_constructor(return_value);
- }
- }
-}
-
-
-void php3_max(INTERNAL_FUNCTION_PARAMETERS)
-{
- int argc=ARG_COUNT(ht);
- pval **result;
-
- if (argc<=0) {
- php3_error(E_WARNING, "max: must be passed at least 1 value");
- var_uninit(return_value);
- return;
- }
- if (argc == 1) {
- pval *arr;
-
- if (getParameters(ht, 1, &arr) == FAILURE ||
- arr->type != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (_php3_hash_minmax(arr->value.ht, array_data_compare, 1, (void **) &result)==SUCCESS) {
- *return_value = **result;
- pval_copy_constructor(return_value);
- } else {
- php3_error(E_WARNING, "max: array must contain at least 1 element");
- var_uninit(return_value);
- }
- } else {
- if (_php3_hash_minmax(ht, array_data_compare, 1, (void **) &result)==SUCCESS) {
- *return_value = **result;
- pval_copy_constructor(return_value);
- }
- }
-}
-
-static pval *php3_array_walk_func_name;
-
-static int _php3_array_walk(const void *a)
-{
- pval *args[1];
- pval retval;
- CLS_FETCH();
-
- args[0] = (pval *)a;
-
- call_user_function(CG(function_table), NULL, php3_array_walk_func_name, &retval, 1, args);
- return 0;
-}
-
-void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS) {
- pval *array, *old_walk_func_name;
- HashTable *target_hash;
- TLS_VARS;
-
- old_walk_func_name = php3_array_walk_func_name;
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &array, &php3_array_walk_func_name) == FAILURE) {
- php3_array_walk_func_name = old_walk_func_name;
- WRONG_PARAM_COUNT;
- }
- target_hash = HASH_OF(array);
- if (!target_hash) {
- php3_error(E_WARNING, "Wrong datatype in array_walk() call");
- php3_array_walk_func_name = old_walk_func_name;
- return;
- }
- convert_to_string(php3_array_walk_func_name);
- _php3_hash_apply(target_hash, (int (*)(void *))_php3_array_walk);
- php3_array_walk_func_name = old_walk_func_name;
- RETURN_TRUE;
-}
-
-#if 0
-void php3_max(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval **argv;
- int argc, i;
- unsigned short max_type = IS_LONG;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
- /* if there is one parameter and this parameter is an array of
- * 2 or more elements, use that array
- */
- if (argc == 1) {
- argv = (pval **)emalloc(sizeof(pval *) * argc);
- if (getParametersArray(ht, argc, argv) == FAILURE ||
- argv[0]->type != IS_ARRAY) {
- WRONG_PARAM_COUNT;
- }
- if (argv[0]->value.ht->nNumOfElements < 2) {
- php3_error(E_WARNING,
- "min: array must contain at least 2 elements");
- RETURN_FALSE;
- }
- /* replace the function parameters with the array */
- ht = argv[0]->value.ht;
- argc = _php3_hash_num_elements(ht);
- efree(argv);
- } else if (argc < 2) {
- WRONG_PARAM_COUNT;
- }
- argv = (pval **)emalloc(sizeof(pval *) * argc);
- if (getParametersArray(ht, argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
- /* figure out what types to compare
- * if the arguments contain a double, convert all of them to a double
- * else convert all of them to long
- */
- for (i = 0; i < argc; i++) {
- if (argv[i]->type == IS_DOUBLE) {
- max_type = IS_DOUBLE;
- break;
- }
- }
- if (max_type == IS_LONG) {
- convert_to_long(argv[0]);
- return_value->value.lval = argv[0]->value.lval;
- for (i = 1; i < argc; i++) {
- convert_to_long(argv[i]);
- if (argv[i]->value.lval > return_value->value.lval) {
- return_value->value.lval = argv[i]->value.lval;
- }
- }
- } else {
- convert_to_double(argv[0]);
- return_value->value.dval = argv[0]->value.dval;
- for (i = 1; i < argc; i++) {
- convert_to_double(argv[i]);
- if (argv[i]->value.dval > return_value->value.dval) {
- return_value->value.dval = argv[i]->value.dval;
- }
- }
- }
- efree(argv);
- return_value->type = max_type;
-}
-#endif
-
-void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS)
-{
- TLS_VARS;
-
- RETURN_STRING(_php3_get_current_user(),1);
-}
-
-
-void php3_get_cfg_var(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *varname;
- char *value;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(varname);
-
- if (cfg_get_string(varname->value.str.val,&value)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_STRING(value,1);
-}
-
-void php3_set_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *new_setting;
- PLS_FETCH();
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &new_setting)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(new_setting);
-
- PG(magic_quotes_runtime)=new_setting->value.lval;
- RETURN_TRUE;
-}
-
-void php3_get_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(magic_quotes_runtime));
-}
-
-void php3_get_magic_quotes_gpc(INTERNAL_FUNCTION_PARAMETERS)
-{
- PLS_FETCH();
-
- RETURN_LONG(PG(magic_quotes_gpc));
-}
-
-
-void php3_is_type(INTERNAL_FUNCTION_PARAMETERS,int type)
-{
- pval *arg;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &arg)==FAILURE) {
- RETURN_FALSE;
- }
- if (arg->type == type) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-
-
-void php3_is_long(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_LONG); }
-void php3_is_double(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_DOUBLE); }
-void php3_is_string(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_STRING); }
-void php3_is_array(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_ARRAY); }
-void php3_is_object(INTERNAL_FUNCTION_PARAMETERS) { php3_is_type(INTERNAL_FUNCTION_PARAM_PASSTHRU, IS_OBJECT); }
-
-
-void php3_leak(INTERNAL_FUNCTION_PARAMETERS)
-{
- int leakbytes=3;
- pval *leak;
-
- if (ARG_COUNT(ht)>=1) {
- if (getParameters(ht, 1, &leak)==SUCCESS) {
- convert_to_long(leak);
- leakbytes = leak->value.lval;
- }
- }
-
- emalloc(leakbytes);
-}
-
-/*
- 1st arg = error message
- 2nd arg = error option
- 3rd arg = optional parameters (email address or tcp address)
- 4th arg = used for additional headers if email
-
- error options
- 0 = send to php3_error_log (uses syslog or file depending on ini setting)
- 1 = send via email to 3rd parameter 4th option = additional headers
- 2 = send via tcp/ip to 3rd parameter (name or ip:port)
- 3 = save to file in 3rd parameter
-*/
-
-void php3_error_log(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *string, *erropt = NULL, *option = NULL, *emailhead = NULL;
- int opt_err = 0;
- char *message, *opt=NULL, *headers=NULL;
- TLS_VARS;
-
- switch(ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht,1,&string) == FAILURE) {
- php3_error(E_WARNING,"Invalid argument 1 in error_log");
- RETURN_FALSE;
- }
- break;
- case 2:
- if (getParameters(ht,2,&string,&erropt) == FAILURE) {
- php3_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
- break;
- case 3:
- if (getParameters(ht,3,&string,&erropt,&option) == FAILURE){
- php3_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
- convert_to_string(option);
- opt=option->value.str.val;
- break;
- case 4:
- if (getParameters(ht,4,&string,&erropt,&option,&emailhead) == FAILURE){
- php3_error(E_WARNING,"Invalid arguments in error_log");
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(string);
- message=string->value.str.val;
- if (erropt != NULL) {
- convert_to_long(erropt);
- opt_err=erropt->value.lval;
- }
- if (option != NULL) {
- convert_to_string(option);
- opt=option->value.str.val;
- }
- if (emailhead != NULL) {
- convert_to_string(emailhead);
- headers=emailhead->value.str.val;
- }
-
- if (_php3_error_log(opt_err,message,opt,headers)==FAILURE) {
- RETURN_FALSE;
- }
-
- RETURN_TRUE;
-}
-
-PHPAPI int _php3_error_log(int opt_err,char *message,char *opt,char *headers){
- FILE *logfile;
- int issock=0, socketd=0;;
-
- switch(opt_err){
- case 1: /*send an email*/
- {
-#if HAVE_SENDMAIL
- if (!_php3_mail(opt,"PHP3 error_log message",message,headers)){
- return FAILURE;
- }
-#else
- php3_error(E_WARNING,"Mail option not available!");
- return FAILURE;
-#endif
- }
- break;
- case 2: /*send to an address */
- php3_error(E_WARNING,"TCP/IP option not available!");
- return FAILURE;
- break;
- case 3: /*save to a file*/
- logfile=php3_fopen_wrapper(opt,"a", (IGNORE_URL|ENFORCE_SAFE_MODE), &issock, &socketd);
- if(!logfile) {
- php3_error(E_WARNING,"error_log: Unable to write to %s",opt);
- return FAILURE;
- }
- fwrite(message,strlen(message),1,logfile);
- fclose(logfile);
- break;
- default:
- php3_log_err(message);
- break;
- }
- return SUCCESS;
-}
-
-
-void php3_call_user_func(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval **params;
- pval retval;
- int arg_count=ARG_COUNT(ht);
- CLS_FETCH();
-
- if (arg_count<1) {
- WRONG_PARAM_COUNT;
- }
- params = (pval **) emalloc(sizeof(pval)*arg_count);
-
- if (getParametersArray(ht, arg_count, params)==FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
- convert_to_string(params[0]);
- if (call_user_function(CG(function_table), NULL, params[0], &retval, arg_count-1, params+1)==SUCCESS) {
- *return_value = retval;
- } else {
- php3_error(E_WARNING,"Unable to call %s() - function does not exist", params[0]->value.str.val);
- }
- efree(params);
-}
-
-
-void php3_call_user_method(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval **params;
- pval retval;
- int arg_count=ARG_COUNT(ht);
-
- if (arg_count<2) {
- WRONG_PARAM_COUNT;
- }
- params = (pval **) emalloc(sizeof(pval)*arg_count);
-
- if (getParametersArray(ht, arg_count, params)==FAILURE) {
- efree(params);
- RETURN_FALSE;
- }
- if (params[1]->type != IS_OBJECT) {
- php3_error(E_WARNING,"2nd argument is not an object\n");
- efree(params);
- RETURN_FALSE;
- }
- convert_to_string(params[0]);
- if (call_user_function(CG(function_table), params[1], params[0], &retval, arg_count-2, params+2)==SUCCESS) {
- *return_value = retval;
- } else {
- php3_error(E_WARNING,"Unable to call %s() - function does not exist", params[0]->value.str.val);
- }
- efree(params);
-}
-
-
-void user_shutdown_function_dtor(pval *user_shutdown_function_name)
-{
- pval retval;
- CLS_FETCH();
-
- if (call_user_function(CG(function_table), NULL, user_shutdown_function_name, &retval, 0, NULL)==SUCCESS) {
- pval_destructor(&retval);
- }
- pval_destructor(user_shutdown_function_name);
-}
-
-
-void php3_call_shutdown_functions(void)
-{
- if (user_shutdown_function_names) {
- _php3_hash_destroy(user_shutdown_function_names);
- efree(user_shutdown_function_names);
- }
-}
-
-/* {{{ proto void register_shutdown_function(string function_name)
- Register a user-level function to be called on request termination */
-PHP_FUNCTION(register_shutdown_function)
-{
- pval *arg, shutdown_function_name;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &arg)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg);
- if (!user_shutdown_function_names) {
- user_shutdown_function_names = (HashTable *) emalloc(sizeof(HashTable));
- _php3_hash_init(user_shutdown_function_names, 0, NULL, (void (*)(void *))user_shutdown_function_dtor, 0);
- }
-
- shutdown_function_name = *arg;
- pval_copy_constructor(&shutdown_function_name);
-
- _php3_hash_next_index_insert(user_shutdown_function_names, &shutdown_function_name, sizeof(pval), NULL);
-}
-/* }}} */
-
-
-void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- syntax_highlighter_ini->highlight_comment = INI_STR("highlight_comment");
- syntax_highlighter_ini->highlight_default = INI_STR("highlight_default");
- syntax_highlighter_ini->highlight_html = INI_STR("highlight_html");
- syntax_highlighter_ini->highlight_keyword = INI_STR("highlight_keyword");
- syntax_highlighter_ini->highlight_string = INI_STR("highlight_string");
-}
-
-
-/* {{{ proto void highlight_file(string file_name)
- Syntax highlight a source file */
-PHP_FUNCTION(highlight_file)
-{
- pval *filename;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &filename)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- if (highlight_file(filename->value.str.val, &syntax_highlighter_ini)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-/* {{{ proto void highlight_file(string file_name)
- Syntax highlight a source file */
-PHP_FUNCTION(highlight_string)
-{
- pval *expr;
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &expr)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(expr);
-
- php_get_highlight_struct(&syntax_highlighter_ini);
-
- if (highlight_string(expr, &syntax_highlighter_ini)==FAILURE) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-
-pval test_class_get_property(zend_property_reference *property_reference)
-{
- pval result;
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Reading a property from a TestClass object:\n");
-
- for (element=property_reference->elements_list.head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
- case IS_ARRAY:
- printf("Array offset: ");
- break;
- case IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (overloaded_property->element.type) {
- case IS_LONG:
- printf("%d (numeric)\n", overloaded_property->element.value.lval);
- break;
- case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- result.value.str.val = estrndup("testing", 7);
- result.value.str.len = 7;
- result.type = IS_STRING;
- return result;
-}
-
-
-int test_class_set_property(zend_property_reference *property_reference, pval *value)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
- printf("Writing to a property from a TestClass object:\n");
- printf("Writing '");
- zend_print_variable(value);
- printf("'\n");
-
- for (element=property_reference->elements_list.head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
- case IS_ARRAY:
- printf("Array offset: ");
- break;
- case IS_OBJECT:
- printf("Object property: ");
- break;
- }
- switch (overloaded_property->element.type) {
- case IS_LONG:
- printf("%d (numeric)\n", overloaded_property->element.value.lval);
- break;
- case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- return 0;
-}
-
-
-
-void test_class_call_function(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference)
-{
- zend_overloaded_element *overloaded_property;
- zend_llist_element *element;
-
-
- printf("Reading a property from a TestClass object:\n");
-
- for (element=property_reference->elements_list.head; element; element=element->next) {
- overloaded_property = (zend_overloaded_element *) element->data;
- switch (overloaded_property->type) {
- case IS_ARRAY:
- printf("Array offset: ");
- break;
- case IS_OBJECT:
- printf("Object property: ");
- break;
- case IS_METHOD:
- printf("Overloaded method: ");
- }
- switch (overloaded_property->element.type) {
- case IS_LONG:
- printf("%d (numeric)\n", overloaded_property->element.value.lval);
- break;
- case IS_STRING:
- printf("'%s'\n", overloaded_property->element.value.str.val);
- break;
- }
- pval_destructor(&overloaded_property->element);
- }
-
- printf("%d arguments\n", zend_hash_num_elements(ht));
- return_value->value.str.val = estrndup("testing", 7);
- return_value->value.str.len = 7;
- return_value->type = IS_STRING;
-}
-
-
-void test_class_startup()
-{
- zend_class_entry class_entry;
-
- class_entry.name = strdup("TestClass");
- class_entry.name_length = sizeof("TestClass")-1;
-
- class_entry.handle_property_get = test_class_get_property;
- class_entry.handle_property_set = test_class_set_property;
- class_entry.handle_function_call = test_class_call_function;
- register_internal_class(&class_entry);
-}
-
-
-PHP_FUNCTION(ob_start)
-{
- zend_start_ob_buffering();
-}
-
-
-PHP_FUNCTION(ob_end_flush)
-{
- zend_end_ob_buffering(1);
-}
-
-
-PHP_FUNCTION(ob_end_clean)
-{
- zend_end_ob_buffering(0);
-}
-
-
-PHP_FUNCTION(ob_get_contents)
-{
- if (zend_ob_get_buffer(return_value)==FAILURE) {
- RETURN_FALSE;
- }
-}
-
-
-PHP_FUNCTION(ini_get)
-{
- pval *varname;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- return_value->value.str.val = php_ini_string(varname->value.str.val, varname->value.str.len+1, 0);
-
- if (!return_value->value.str.val) {
- RETURN_FALSE;
- }
-
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
- pval_copy_constructor(return_value);
-}
-
-
-PHP_FUNCTION(ini_alter)
-{
- pval *varname, *new_value;
- char *old_value;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &varname, &new_value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- old_value = php_ini_string(varname->value.str.val, varname->value.str.len+1, 0);
-
-
- convert_to_string(new_value);
-
- if (php_alter_ini_entry(varname->value.str.val, varname->value.str.len+1, new_value->value.str.val, new_value->value.str.len, PHP_INI_USER)==FAILURE) {
- RETURN_FALSE;
- }
- if (old_value) {
- RETURN_STRING(old_value, 1);
- } else {
- RETURN_FALSE;
- }
-}
-
-
-
-PHP_FUNCTION(ini_restore)
-{
- pval *varname;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &varname)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(varname);
-
- php_restore_ini_entry(varname->value.str.val, varname->value.str.len);
-}
-
-
-PHP_FUNCTION(print_r)
-{
- pval *expr;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &expr)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- zend_print_pval_r(expr, 0);
- RETURN_TRUE;
-}
-
-
-/* This should go back to PHP */
-PHP_FUNCTION(define)
-{
- pval *var, *val, *non_cs;
- int case_sensitive;
- zend_constant c;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &var, &val)==FAILURE) {
- RETURN_FALSE;
- }
- case_sensitive = CONST_CS;
- break;
- case 3:
- if (getParameters(ht, 3, &var, &val, &non_cs)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(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:
- break;
- default:
- php3_error(E_WARNING,"Constants may only evaluate to scalar values");
- RETURN_FALSE;
- break;
- }
- convert_to_string(var);
-
- c.value = *val;
- pval_copy_constructor(&c.value);
- c.flags = case_sensitive | ~CONST_PERSISTENT; /* non persistent */
- c.name = php3_strndup(var->value.str.val, var->value.str.len);
- c.name_len = var->value.str.len+1;
- zend_register_constant(&c);
- RETURN_TRUE;
-}
-
-
-PHP_FUNCTION(defined)
-{
- pval *var;
- pval c;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &var)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(var);
- if (zend_get_constant(var->value.str.val, var->value.str.len, &c)) {
- pval_destructor(&c);
- RETURN_LONG(1);
- } else {
- RETURN_LONG(0);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/basic_functions.h b/ext/standard/basic_functions.h
deleted file mode 100644
index 4a1e0bcec9..0000000000
--- a/ext/standard/basic_functions.h
+++ /dev/null
@@ -1,130 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _BASIC_FUNCTIONS_H
-#define _BASIC_FUNCTIONS_H
-
-#include "zend_highlight.h"
-
-extern php3_module_entry basic_functions_module;
-#define basic_functions_module_ptr &basic_functions_module
-
-extern int php3_minit_basic(INIT_FUNC_ARGS);
-extern int php3_mshutdown_basic(SHUTDOWN_FUNC_ARGS);
-extern int php3_rinit_basic(INIT_FUNC_ARGS);
-extern int php3_rshutdown_basic(SHUTDOWN_FUNC_ARGS);
-extern void int_value(INTERNAL_FUNCTION_PARAMETERS);
-extern void double_value(INTERNAL_FUNCTION_PARAMETERS);
-extern void string_value(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_toggle_short_open_tag(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_sleep(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_usleep(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_key_sort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_asort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_arsort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_sort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rsort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_user_sort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_auser_sort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_user_key_sort(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_array_walk(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_count(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_flush(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_end(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_prev(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_next(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_each(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_reset(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_current(INTERNAL_FUNCTION_PARAMETERS);
-extern void array_current_key(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_gettype(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_settype(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_min(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_max(INTERNAL_FUNCTION_PARAMETERS);
-
-/* system functions */
-extern void php3_getenv(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_putenv(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_error_reporting(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_get_current_user(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_set_time_limit(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_get_cfg_var(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_set_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_get_magic_quotes_runtime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_get_magic_quotes_gpc(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_is_type(INTERNAL_FUNCTION_PARAMETERS, int type);
-extern void php3_is_long(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_is_double(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_is_string(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_is_array(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_is_object(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_leak(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_error_log(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_call_user_func(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_call_user_method(INTERNAL_FUNCTION_PARAMETERS);
-
-PHP_FUNCTION(register_shutdown_function);
-PHP_FUNCTION(highlight_file);
-PHP_FUNCTION(highlight_string);
-void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
-
-PHP_FUNCTION(ob_start);
-PHP_FUNCTION(ob_end_flush);
-PHP_FUNCTION(ob_end_clean);
-PHP_FUNCTION(ob_get_contents);
-
-PHP_FUNCTION(ini_get);
-PHP_FUNCTION(ini_alter);
-PHP_FUNCTION(ini_restore);
-
-PHP_FUNCTION(print_r);
-
-PHP_FUNCTION(define);
-PHP_FUNCTION(defined);
-
-#if HAVE_PUTENV
-typedef struct {
- char *putenv_string;
- char *previous_value;
- char *key;
- int key_len;
-} putenv_entry;
-#endif
-
-#endif /* _BASIC_FUNCTIONS_H */
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
deleted file mode 100644
index 4045a698a1..0000000000
--- a/ext/standard/browscap.c
+++ /dev/null
@@ -1,137 +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: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "php3_browscap.h"
-#include "php_ini.h"
-
-#include "zend_globals.h"
-
-#ifndef THREAD_SAFE
-HashTable browser_hash;
-static char *lookup_browser_name;
-static pval *found_browser_entry;
-#endif
-
-function_entry browscap_functions[] = {
- {"get_browser", php3_get_browser, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry browscap_module_entry = {
- "browscap", browscap_functions, php3_minit_browscap, php3_mshutdown_browscap, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-
-static int browser_reg_compare(pval *browser)
-{
- pval *browser_name;
- regex_t r;
- TLS_VARS;
-
- if (GLOBAL(found_browser_entry)) { /* already found */
- return 0;
- }
- _php3_hash_find(browser->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void **) &browser_name);
- if (!strchr(browser_name->value.str.val,'*')) {
- return 0;
- }
- if (regcomp(&r,browser_name->value.str.val,REG_NOSUB)!=0) {
- return 0;
- }
- if (regexec(&r,GLOBAL(lookup_browser_name),0,NULL,0)==0) {
- GLOBAL(found_browser_entry) = browser;
- }
- regfree(&r);
- return 0;
-}
-
-void php3_get_browser(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *agent_name,*agent,tmp;
- ELS_FETCH();
-
- if (!INI_STR("browscap")) {
- RETURN_FALSE;
- }
-
- switch(ARG_COUNT(ht)) {
- case 0:
- if (_php3_hash_find(&EG(symbol_table), "HTTP_USER_AGENT", sizeof("HTTP_USER_AGENT"), (void **) &agent_name)==FAILURE) {
- agent_name = &tmp;
- var_reset(agent_name);
- }
- break;
- case 1:
- if (getParameters(ht, 1, &agent_name)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(agent_name);
-
- if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
- GLOBAL(lookup_browser_name) = agent_name->value.str.val;
- GLOBAL(found_browser_entry) = NULL;
- _php3_hash_apply(&GLOBAL(browser_hash),(int (*)(void *)) browser_reg_compare);
-
- if (GLOBAL(found_browser_entry)) {
- agent = GLOBAL(found_browser_entry);
- } else if (_php3_hash_find(&GLOBAL(browser_hash), "Default Browser", sizeof("Default Browser"), (void **) &agent)==FAILURE) {
- RETURN_FALSE;
- }
- }
-
- *return_value = *agent;
- return_value->type = IS_OBJECT;
- pval_copy_constructor(return_value);
- return_value->value.ht->pDestructor = PVAL_DESTRUCTOR;
-
- while (_php3_hash_find(agent->value.ht, "parent", sizeof("parent"), (void **) &agent_name)==SUCCESS) {
- if (_php3_hash_find(&GLOBAL(browser_hash), agent_name->value.str.val, agent_name->value.str.len+1, (void **) &agent)==FAILURE) {
- break;
- }
- _php3_hash_merge(return_value->value.ht,agent->value.ht,(void (*)(void *pData)) pval_copy_constructor, (void *) &tmp, sizeof(pval));
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/config.m4 b/ext/standard/config.m4
deleted file mode 100644
index f44a1df39f..0000000000
--- a/ext/standard/config.m4
+++ /dev/null
@@ -1,3 +0,0 @@
-dnl $Id$ -*- sh -*-
-
-PHP_EXTENSION(standard)
diff --git a/ext/standard/cyr_convert.c b/ext/standard/cyr_convert.c
deleted file mode 100644
index 5f36a479be..0000000000
--- a/ext/standard/cyr_convert.c
+++ /dev/null
@@ -1,301 +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: Kirill Maximov (kir@rus.net |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "cyr_convert.h"
-
-#include <stdio.h>
-
-
-
-
-/*****************************************************************************
-* This is codetables for different Cyrillic charsets (relative to koi8-r).
-* Each table contains data for 128-255 symbols from ASCII table.
-* First 256 symbols are for conversion from koi8-r to corresponding charset,
-* second 256 symbols are for reverse conversion, from charset to koi8-r.
-*
-* Here we have the following tables:
-* _cyr_win1251 - for windows-1251 charset
-* _cyr_iso88595 - for iso8859-5 charset
-* _cyr_cp866 - for x-cp866 charset
-* _cyr_mac - for x-mac-cyrillic charset
-*
-*****************************************************************************/
-
-typedef unsigned char _cyr_charset_table[512];
-
-const static _cyr_charset_table _cyr_win1251 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,
-46,46,46,46,46,46,46,46,179,46,32,46,46,46,46,32,
-46,46,46,46,46,46,46,46,163,46,32,46,46,46,46,32,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,184,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,168,32,32,32,32,32,32,32,32,32,32,32,32,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206,
-207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218,
-},
-_cyr_cp866 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-35,35,35,124,124,124,124,43,43,124,124,43,43,43,43,43,
-43,45,45,124,45,43,124,124,43,43,45,45,124,45,43,45,
-45,45,45,43,43,43,43,43,43,43,43,35,35,124,124,35,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-179,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,240,32,32,32,32,32,32,32,32,32,32,32,32,
-238,160,161,230,164,165,228,163,229,168,169,170,171,172,173,174,
-175,239,224,225,226,227,166,162,236,235,167,232,237,233,231,234,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-},
-_cyr_iso88595 = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,179,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209,
-32,163,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,241,32,32,32,32,32,32,32,32,32,32,32,32,
-32,32,32,161,32,32,32,32,32,32,32,32,32,32,32,32,
-238,208,209,230,212,213,228,211,229,216,217,218,219,220,221,222,
-223,239,224,225,226,227,214,210,236,235,215,232,237,233,231,234,
-206,176,177,198,180,181,196,179,197,184,185,186,187,188,189,190,
-191,207,192,193,194,195,182,178,204,203,183,200,205,201,199,202,
-},
-_cyr_mac = {
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
-128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-144,145,146,147,148,149,150,151,152,153,154,155,156,179,163,209,
-193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,255,
-0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,
-32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,
-48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,
-64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,
-80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
-96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,
-112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
-192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
-208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
-160,161,162,222,164,165,166,167,168,169,170,171,172,173,174,175,
-176,177,178,221,180,181,182,183,184,185,186,187,188,189,190,191,
-254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-239,223,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-158,128,129,150,132,133,148,131,149,136,137,138,139,140,141,142,
-143,159,144,145,146,147,134,130,156,155,135,152,157,153,151,154,
-};
-
-
-/*****************************************************************************
-* This is the function that performs real in-place conversion of the string
-* between charsets.
-* Parameters:
-* str - string to be converted
-* from,to - one-symbol label of source and destination charset
-* The following symbols are used as labels:
-* k - koi8-r
-* w - windows-1251
-* i - iso8859-5
-* a - x-cp866
-* d - x-cp866
-* m - x-mac-cyrillic
-*****************************************************************************/
-static char * _php3_convert_cyr_string(unsigned char *str, char from, char to)
-{
- const unsigned char *from_table, *to_table;
- unsigned char tmp;
- int i;
-
- from_table = NULL;
- to_table = NULL;
-
- switch (toupper(from))
- {
- case 'W':
- from_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- from_table = _cyr_cp866;
- break;
- case 'I':
- from_table = _cyr_iso88595;
- break;
- case 'M':
- from_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php3_error(E_WARNING, "Unknown source charset: %c", from);
- break;
- }
-
- switch (toupper(to))
- {
- case 'W':
- to_table = _cyr_win1251;
- break;
- case 'A':
- case 'D':
- to_table = _cyr_cp866;
- break;
- case 'I':
- to_table = _cyr_iso88595;
- break;
- case 'M':
- to_table = _cyr_mac;
- break;
- case 'K':
- break;
- default:
- php3_error(E_WARNING, "Unknown destination charset: %c", to);
- break;
- }
-
-
- if (!str)
- return (char *)str;
-
- for( i = 0; str[i]; i++)
- {
- tmp = (from_table == NULL)? str[i] : from_table[ str[i] ];
- str[i] = (to_table == NULL) ? tmp : to_table[tmp + 256];
- }
- return (char *)str;
-}
-
-/* {{{ proto string convert_cyr_string(string str, string from, string to)
- Convert from one Cyrillic character set to another */
-void php3_convert_cyr_string(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str_arg, *fr_cs, *to_cs;
- unsigned char *str;
-
- if (ARG_COUNT(ht) != 3 || getParameters(ht,3,&str_arg, &fr_cs, &to_cs)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str_arg);
- convert_to_string(fr_cs);
- convert_to_string(to_cs);
-
- str = (unsigned char*) str_arg->value.str.val;
-
- _php3_convert_cyr_string(str, fr_cs->value.str.val[0], to_cs->value.str.val[0]);
- RETVAL_STRING((char *)str, 1)
-}
-/* }}} */
diff --git a/ext/standard/cyr_convert.h b/ext/standard/cyr_convert.h
deleted file mode 100644
index c7ac46143e..0000000000
--- a/ext/standard/cyr_convert.h
+++ /dev/null
@@ -1,40 +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: Kirill Maximov (kir@rus.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _CYR_CONVERT_H
-#define _CYR_CONVERT_H
-
-extern void php3_convert_cyr_string(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _CYR_CONVERT_H */
-
-
-
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
deleted file mode 100644
index 3c82fe0918..0000000000
--- a/ext/standard/datetime.c
+++ /dev/null
@@ -1,510 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@php.net> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "zend_operators.h"
-#include "datetime.h"
-#include "snprintf.h"
-#include "php_globals.h"
-
-#include <time.h>
-#include <stdio.h>
-
-char *mon_full_names[] =
-{
- "January", "February", "March", "April",
- "May", "June", "July", "August",
- "September", "October", "November", "December"
-};
-char *mon_short_names[] =
-{
- "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-};
-char *day_full_names[] =
-{
- "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
-};
-char *day_short_names[] =
-{
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
-
-#ifndef HAVE_TM_ZONE
-#ifndef _TIMEZONE
-extern time_t timezone;
-#endif
-#endif
-
-static int phpday_tab[2][12] =
-{
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
-};
-
-void php3_time(INTERNAL_FUNCTION_PARAMETERS)
-{
- return_value->value.lval = (long) time(NULL);
- return_value->type = IS_LONG;
-}
-
-void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval *arguments[6];
- struct tm ta, *tn;
- time_t t;
- int i, gmadjust=0,arg_count = ARG_COUNT(ht);
-
- if (arg_count > 6 || getParametersArray(ht, arg_count, arguments) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* convert supplied arguments to longs */
- for (i = 0; i < arg_count; i++) {
- convert_to_long(arguments[i]);
- }
- t=time(NULL);
- if (gm) {
- tn = gmtime(&t);
-#if HAVE_TZSET
- tzset();
-#if HAVE_TM_ZONE
- gmadjust=(tn->tm_gmtoff)/3600;
-#else
- gmadjust=timezone/3600;
-#endif
-#endif
- } else {
- tn = localtime(&t);
- }
- memcpy(&ta,tn,sizeof(struct tm));
- ta.tm_isdst = -1;
-
- switch(arg_count) {
- case 6:
- ta.tm_year = arguments[5]->value.lval - ((arguments[5]->value.lval > 1000) ? 1900 : 0);
- /* fall-through */
- case 5:
- ta.tm_mday = arguments[4]->value.lval;
- /* fall-through */
- case 4:
- ta.tm_mon = arguments[3]->value.lval - 1;
- /* fall-through */
- case 3:
- ta.tm_sec = arguments[2]->value.lval;
- /* fall-through */
- case 2:
- ta.tm_min = arguments[1]->value.lval;
- /* fall-through */
- case 1:
- ta.tm_hour = arguments[0]->value.lval - gmadjust;
- case 0:
- break;
- }
- return_value->value.lval = mktime(&ta);
- return_value->type = IS_LONG;
-}
-
-void php3_mktime(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-void php3_gmmktime(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_mktime(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-static void
-_php3_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
-{
- pval *format, *timestamp;
- time_t the_time;
- struct tm *ta;
- int i, size = 0, length, h;
- char tmp_buff[16];
- TLS_VARS;
-
- switch(ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &format) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- the_time = time(NULL);
- break;
- case 2:
- if (getParameters(ht, 2, &format, &timestamp) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(timestamp);
- the_time = timestamp->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(format);
-
- if (gm) {
- ta = gmtime(&the_time);
- } else {
- ta = localtime(&the_time);
- }
-
- if (!ta) { /* that really shouldn't happen... */
- php3_error(E_WARNING, "unexpected error in date()");
- RETURN_FALSE;
- }
- for (i = 0; i < format->value.str.len; i++) {
- switch (format->value.str.val[i]) {
- case 'U': /* seconds since the epoch */
- size += 10;
- break;
- case 'F': /* month, textual, full */
- case 'l': /* day (of the week), textual */
- size += 9;
- break;
- case 'Y': /* year, numeric, 4 digits */
- size += 4;
- break;
- case 'M': /* month, textual, 3 letters */
- case 'D': /* day, textual, 3 letters */
- case 'z': /* day of the year */
- size += 3;
- break;
- case 'y': /* year, numeric, 2 digits */
- case 'm': /* month, numeric */
- case 'd': /* day of the month, numeric */
- case 'j': /* day of the month, numeric, no leading zeros */
- case 'H': /* hour, numeric, 24 hour format */
- case 'h': /* hour, numeric, 12 hour format */
- case 'i': /* minutes, numeric */
- case 's': /* seconds, numeric */
- case 'A': /* AM/PM */
- case 'a': /* am/pm */
- case 'S': /* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */
- size += 2;
- break;
- case '\\':
- if(i < format->value.str.len-1) {
- i++;
- }
- case 'w': /* day of the week, numeric */
- default:
- size++;
- break;
- }
- }
-
- return_value->value.str.val = (char *) emalloc(size + 1);
- return_value->value.str.val[0] = '\0';
-
- for (i = 0; i < format->value.str.len; i++) {
- switch (format->value.str.val[i]) {
- case '\\':
- if(i < format->value.str.len-1) {
- char ch[2];
- ch[0]=format->value.str.val[i+1];
- ch[1]='\0';
- strcat(return_value->value.str.val, ch);
- i++;
- }
- break;
- case 'U': /* seconds since the epoch */
- sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'F': /* month, textual, full */
- strcat(return_value->value.str.val, mon_full_names[ta->tm_mon]);
- break;
- case 'l': /* day (of the week), textual, full */
- strcat(return_value->value.str.val, day_full_names[ta->tm_wday]);
- break;
- case 'Y': /* year, numeric, 4 digits */
- sprintf(tmp_buff, "%d", ta->tm_year + 1900); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'M': /* month, textual, 3 letters */
- strcat(return_value->value.str.val, mon_short_names[ta->tm_mon]);
- break;
- case 'D': /* day (of the week), textual, 3 letters */
- strcat(return_value->value.str.val, day_short_names[ta->tm_wday]);
- break;
- case 'z': /* day (of the year) */
- sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'y': /* year, numeric, 2 digits */
- sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'm': /* month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'd': /* day of the month, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'j':
- sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'H': /* hour, numeric, 24 hour format */
- sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'h': /* hour, numeric, 12 hour format */
- h = ta->tm_hour % 12; if (h==0) h = 12;
- sprintf(tmp_buff, "%02d", h); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'i': /* minutes, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 's': /* seconds, numeric */
- sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- case 'A': /* AM/PM */
- strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "PM" : "AM"));
- break;
- case 'a': /* am/pm */
- strcat(return_value->value.str.val, (ta->tm_hour >= 12 ? "pm" : "am"));
- break;
- case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */
- if (ta->tm_mday >= 10 && ta->tm_mday <= 19) {
- strcat(return_value->value.str.val, "th");
- } else {
- switch (ta->tm_mday % 10) {
- case 1:
- strcat(return_value->value.str.val, "st");
- break;
- case 2:
- strcat(return_value->value.str.val, "nd");
- break;
- case 3:
- strcat(return_value->value.str.val, "rd");
- break;
- default:
- strcat(return_value->value.str.val, "th");
- break;
- }
- }
- break;
- case 'w': /* day of the week, numeric EXTENSION */
- sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */
- strcat(return_value->value.str.val, tmp_buff);
- break;
- default:
- length = strlen(return_value->value.str.val);
- return_value->value.str.val[length] = format->value.str.val[i];
- return_value->value.str.val[length + 1] = '\0';
- break;
- }
- }
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-
-void php3_date(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-
-void php3_gmdate(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_date(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-
-void php3_getdate(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *timestamp_arg;
- struct tm *ta;
- time_t timestamp;
-
- if (ARG_COUNT(ht) == 0) {
- timestamp = time(NULL);
- } else if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &timestamp_arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- } else {
- convert_to_long(timestamp_arg);
- timestamp = timestamp_arg->value.lval;
- }
-
- ta = localtime(&timestamp);
- if (!ta) {
- php3_error(E_WARNING, "Cannot perform date calculation");
- return;
- }
- if (array_init(return_value) == FAILURE) {
- php3_error(E_ERROR, "Unable to initialize array");
- return;
- }
- add_assoc_long(return_value, "seconds", ta->tm_sec);
- add_assoc_long(return_value, "minutes", ta->tm_min);
- add_assoc_long(return_value, "hours", ta->tm_hour);
- add_assoc_long(return_value, "mday", ta->tm_mday);
- add_assoc_long(return_value, "wday", ta->tm_wday);
- add_assoc_long(return_value, "mon", ta->tm_mon + 1);
- add_assoc_long(return_value, "year", ta->tm_year + 1900);
- add_assoc_long(return_value, "yday", ta->tm_yday);
- add_assoc_string(return_value, "weekday", day_full_names[ta->tm_wday], 1);
- add_assoc_string(return_value, "month", mon_full_names[ta->tm_mon], 1);
- add_index_long(return_value, 0, timestamp);
-}
-
-/* Return date string in standard format for http headers */
-char *php3_std_date(time_t t)
-{
- struct tm *tm1;
- char *str;
- PLS_FETCH();
-
- tm1 = gmtime(&t);
- str = emalloc(81);
- if (PG(y2k_compliance)) {
- snprintf(str, 80, "%s, %02d-%s-%04d %02d:%02d:%02d GMT",
- day_full_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- tm1->tm_year+1900,
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- } else {
- snprintf(str, 80, "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
- day_full_names[tm1->tm_wday],
- tm1->tm_mday,
- mon_short_names[tm1->tm_mon],
- ((tm1->tm_year)%100),
- tm1->tm_hour, tm1->tm_min, tm1->tm_sec);
- }
-
- str[79]=0;
- return (str);
-}
-
-/*
- * CheckDate(month, day, year);
- * returns True(1) if it is valid date
- *
- */
-#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
-void php3_checkdate(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *month, *day, *year;
- int m, d, y;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 3 ||
- getParameters(ht, 3, &month, &day, &year) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(day);
- convert_to_long(month);
- convert_to_long(year);
- y = year->value.lval;
- m = month->value.lval;
- d = day->value.lval;
-
- if (y < 100)
- y += 1900;
-
- if (y < 0 || y > 32767) {
- RETURN_FALSE;
- }
- if (m < 1 || m > 12) {
- RETURN_FALSE;
- }
- if (d < 1 || d > phpday_tab[isleap(y)][m - 1]) {
- RETURN_FALSE;
- }
- RETURN_TRUE; /* True : This month,day,year arguments are valid */
-}
-
-
-#if HAVE_STRFTIME
-
-void php3_strftime(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *format_arg, *timestamp_arg;
- char *format,*buf;
- time_t timestamp;
- struct tm *ta;
- size_t buf_len=64, real_len;
-
- switch (ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &format_arg)==FAILURE) {
- RETURN_FALSE;
- }
- time(&timestamp);
- break;
- case 2:
- if (getParameters(ht, 2, &format_arg, &timestamp_arg)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(timestamp_arg);
- timestamp = timestamp_arg->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(format_arg);
- if (format_arg->value.str.len==0) {
- RETURN_FALSE;
- }
- format = format_arg->value.str.val;
- ta = localtime(&timestamp);
-
- buf = (char *) emalloc(buf_len);
- while ((real_len=strftime(buf,buf_len,format,ta))==buf_len || real_len==0) {
- buf_len *= 2;
- buf = (char *) erealloc(buf, buf_len);
- }
-
- return_value->value.str.val = (char *) erealloc(buf,real_len+1);
- return_value->value.str.len = real_len;
- return_value->type = IS_STRING;
-}
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
deleted file mode 100644
index 1cb6cf6723..0000000000
--- a/ext/standard/datetime.h
+++ /dev/null
@@ -1,51 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _DATETIME_H
-#define _DATETIME_H
-
-extern void php3_time(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_mktime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_gmmktime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_date(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_gmdate(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getdate(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_checkdate(INTERNAL_FUNCTION_PARAMETERS);
-#if HAVE_STRFTIME
-extern void php3_strftime(INTERNAL_FUNCTION_PARAMETERS);
-#endif
-
-extern char *php3_std_date(time_t t);
-void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
-
-#endif /* _DATETIME_H */
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
deleted file mode 100644
index 1edd10d374..0000000000
--- a/ext/standard/dir.c
+++ /dev/null
@@ -1,287 +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: |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "fopen-wrappers.h"
-
-#include "php3_dir.h"
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <errno.h>
-
-#if MSVC5
-#if !(APACHE)
-#define NEEDRDH 1
-#endif
-#include "win32/readdir.h"
-#endif
-
-#ifndef THREAD_SAFE
-static int dirp_id = 0;
-static int le_dirp;
-#endif
-
-function_entry php3_dir_functions[] = {
- {"opendir", php3_opendir, NULL},
- {"closedir", php3_closedir, NULL},
- {"chdir", php3_chdir, NULL},
- {"rewinddir", php3_rewinddir, NULL},
- {"readdir", php3_readdir, NULL},
- {"dir", php3_getdir, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry php3_dir_module_entry = {
- "PHP_dir", php3_dir_functions, php3_minit_dir, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-
-int php3_minit_dir(INIT_FUNC_ARGS)
-{
- TLS_VARS;
-
- GLOBAL(le_dirp) = register_list_destructors(closedir,NULL);
- return SUCCESS;
-}
-
-/* {{{ proto int opendir(string path)
- Open a directory and return a dir_handle */
-void php3_opendir(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- DIR *dirp;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- /* Check open_basedir */
- if (_php3_check_open_basedir(arg->value.str.val)) RETURN_FALSE;
-
- dirp = opendir(arg->value.str.val);
- if (!dirp) {
- php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno),errno);
- RETURN_FALSE;
- }
- ret = php3_list_insert(dirp, GLOBAL(le_dirp));
- GLOBAL(dirp_id) = ret;
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto void closedir([int dir_handle])
-Close directory connection identified by the dir_handle */
-void php3_closedir(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id, *tmp;
- int id_to_find;
- DIR *dirp;
- int dirp_type;
- TLS_VARS;
-
- if (ARG_COUNT(ht) == 0) {
- if (getThis(&id) == SUCCESS) {
- if (_php3_hash_find(id->value.ht, "handle", sizeof("handle"), (void **)&tmp) == FAILURE) {
- php3_error(E_WARNING, "unable to find my handle property");
- RETURN_FALSE;
- }
- id_to_find = tmp->value.lval;
- } else {
- id_to_find = GLOBAL(dirp_id);
- }
- } 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;
- }
-
- dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
- php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
- RETURN_FALSE;
- }
- php3_list_delete(id_to_find);
-}
-/* }}} */
-
-/* {{{ proto int chdir(string directory)
-Change the current directory */
-void php3_chdir(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
- ret = chdir(arg->value.str.val);
-
- if (ret < 0) {
- php3_error(E_WARNING, "ChDir: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto void rewinddir([int dir_handle])
-Rewind dir_handle back to the start */
-void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id, *tmp;
- int id_to_find;
- DIR *dirp;
- int dirp_type;
- TLS_VARS;
-
- if (ARG_COUNT(ht) == 0) {
- if (getThis(&id) == SUCCESS) {
- if (_php3_hash_find(id->value.ht, "handle", sizeof("handle"), (void **)&tmp) == FAILURE) {
- php3_error(E_WARNING, "unable to find my handle property");
- RETURN_FALSE;
- }
- id_to_find = tmp->value.lval;
- } else {
- id_to_find = GLOBAL(dirp_id);
- }
- } 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;
- }
-
- dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
- php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
- RETURN_FALSE;
- }
- rewinddir(dirp);
-}
-/* }}} */
-
-/* {{{ proto string readdir([int dir_handle])
-Read directory entry from dir_handle */
-void php3_readdir(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *id, *tmp;
- int id_to_find;
- DIR *dirp;
- int dirp_type;
- struct dirent *direntp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) == 0) {
- if (getThis(&id) == SUCCESS) {
- if (_php3_hash_find(id->value.ht, "handle", sizeof("handle"), (void **)&tmp) == FAILURE) {
- php3_error(E_WARNING, "unable to find my handle property");
- RETURN_FALSE;
- }
- id_to_find = tmp->value.lval;
- } else {
- id_to_find = GLOBAL(dirp_id);
- }
- } 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;
- }
-
- dirp = (DIR *)php3_list_find(id_to_find, &dirp_type);
- if (!dirp || dirp_type != GLOBAL(le_dirp)) {
- php3_error(E_WARNING, "unable to find identifier (%d)", id_to_find);
- RETURN_FALSE;
- }
- direntp = readdir(dirp);
- if (direntp) {
- RETURN_STRINGL(direntp->d_name, strlen(direntp->d_name), 1);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto class dir(string directory)
-Directory class with properties, handle and class and methods read, rewind and close */
-void php3_getdir(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg;
- DIR *dirp;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- /* Check open_basedir */
- if (_php3_check_open_basedir(arg->value.str.val)) RETURN_FALSE;
-
- dirp = opendir(arg->value.str.val);
- if (!dirp) {
- php3_error(E_WARNING, "OpenDir: %s (errno %d)", strerror(errno), errno);
- RETURN_FALSE;
- }
- ret = php3_list_insert(dirp, GLOBAL(le_dirp));
- GLOBAL(dirp_id) = ret;
-
- /* construct an object with some methods */
- object_init(return_value);
- add_property_long(return_value, "handle", ret);
- add_property_stringl(return_value, "path", arg->value.str.val, arg->value.str.len, 1);
- add_method(return_value, "read", php3_readdir);
- add_method(return_value, "rewind", php3_rewinddir);
- add_method(return_value, "close", php3_closedir);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
deleted file mode 100644
index 5a338856d0..0000000000
--- a/ext/standard/dns.c
+++ /dev/null
@@ -1,343 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if WIN32|WINNT
-#if HAVE_BINDLIB
-#ifndef WINNT
-#define WINNT 1
-#endif
-/* located in www.php.net/extra/bindlib.zip */
-#include "arpa/inet.h"
-#include "netdb.h"
-#include "arpa/nameser.h"
-#include "resolv.h"
-#endif
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#ifdef _OSD_POSIX
-#undef STATUS
-#undef T_UNSPEC
-#endif
-#include <arpa/nameser.h>
-#include <resolv.h>
-#endif
-
-#include "dns.h"
-
-char *_php3_gethostbyaddr(char *ip);
-char *_php3_gethostbyname(char *name);
-
-/* {{{ proto string gethostbyaddr(string ip_address)
- Get the Internet host name corresponding to a given IP address */
-void php3_gethostbyaddr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- return_value->value.str.val = _php3_gethostbyaddr(arg->value.str.val);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-
-char *_php3_gethostbyaddr(char *ip)
-{
- unsigned long addr;
- struct hostent *hp;
-
- if ((int) (addr = inet_addr(ip)) == -1) {
-#if DEBUG
- php3_error(E_WARNING, "address not in a.b.c.d form");
-#endif
- return estrdup(ip);
- }
- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
- if (!hp) {
-#if DEBUG
- php3_error(E_WARNING, "Unable to resolve %s\n", ip);
-#endif
- return estrdup(ip);
- }
- return estrdup(hp->h_name);
-}
-
-/* {{{ proto string gethostbyname(string hostname)
- Get the IP address corresponding to a given Internet host name */
-void php3_gethostbyname(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- return_value->value.str.val = _php3_gethostbyname(arg->value.str.val);
- return_value->value.str.len = strlen(return_value->value.str.val);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto array gethostbynamel(string hostname)
- Return a list of IP addresses that a given hostname resolves to. */
-void php3_gethostbynamel(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- struct hostent *hp;
- struct in_addr in;
- int i;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- hp = gethostbyname(arg->value.str.val);
- if (hp == NULL || hp->h_addr_list == NULL) {
-#if DEBUG
- php3_error(E_WARNING, "Unable to resolve %s\n", arg->value.str.val);
-#endif
- return;
- }
-
- for (i = 0 ; hp->h_addr_list[i] != 0 ; i++) {
- memcpy(&in.s_addr, hp->h_addr_list[i], sizeof(in.s_addr));
- add_next_index_string(return_value, inet_ntoa(in), 1);
- }
-
- return;
-}
-/* }}} */
-
-char *_php3_gethostbyname(char *name)
-{
- struct hostent *hp;
- struct in_addr in;
-
- hp = gethostbyname(name);
- if (!hp || !hp->h_addr_list) {
-#if DEBUG
- php3_error(E_WARNING, "Unable to resolve %s\n", name);
-#endif
- return estrdup(name);
- }
- memcpy(&in.s_addr, *(hp->h_addr_list), sizeof(in.s_addr));
- return estrdup(inet_ntoa(in));
-}
-
-#if !(WIN32|WINNT)||HAVE_BINDLIB
-
-/* {{{ proto int checkdnsrr(string host [, string type])
- Check DNS records corresponding to a given Internet host name or IP address */
-void php3_checkdnsrr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1,*arg2;
- int type,i;
-#ifndef MAXPACKET
-#define MAXPACKET 8192 /* max packet size used internally by BIND */
-#endif
- u_char ans[MAXPACKET];
- TLS_VARS;
-
- switch (ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- type = T_MX;
- convert_to_string(arg1);
- break;
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- if ( !strcasecmp("A",arg2->value.str.val) ) type = T_A;
- else if ( !strcasecmp("NS",arg2->value.str.val) ) type = T_NS;
- else if ( !strcasecmp("MX",arg2->value.str.val) ) type = T_MX;
- else if ( !strcasecmp("PTR",arg2->value.str.val) ) type = T_PTR;
- else if ( !strcasecmp("ANY",arg2->value.str.val) ) type = T_ANY;
- else if ( !strcasecmp("SOA",arg2->value.str.val) ) type = T_SOA;
- else if ( !strcasecmp("CNAME",arg2->value.str.val) ) type = T_CNAME;
- else {
- php3_error(E_WARNING,"Type '%s' not supported",arg2->value.str.val);
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- i = res_search(arg1->value.str.val,C_IN,type,ans,sizeof(ans));
- if ( i < 0 ) {
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#ifndef HFIXEDSZ
-#define HFIXEDSZ 12 /* fixed data in header <arpa/nameser.h> */
-#endif /* HFIXEDSZ */
-
-#ifndef QFIXEDSZ
-#define QFIXEDSZ 4 /* fixed data in query <arpa/nameser.h> */
-#endif /* QFIXEDSZ */
-
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 256
-#endif /* MAXHOSTNAMELEN */
-
-/* {{{ proto int getmxrr(string hostname, array mxhosts [, array weight])
- Get MX records corresponding to a given Internet host name */
-void php3_getmxrr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *host, *mx_list, *weight_list;
- pval tmp1,tmp2;
- int need_weight = 0;
- int count,qdc;
- u_short type,weight;
- u_char ans[MAXPACKET];
- char buf[MAXHOSTNAMELEN];
- HEADER *hp;
- u_char *cp,*end;
- int i;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &host, &mx_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2)) {
- php3_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- break;
- case 3:
- if (getParameters(ht, 3, &host, &mx_list, &weight_list) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2) || !ParameterPassedByReference(ht, 3)) {
- php3_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
- need_weight = 1;
- pval_destructor(weight_list _INLINE_TLS); /* start with clean array */
- if ( array_init(weight_list) == FAILURE ) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string( host );
- pval_destructor(mx_list _INLINE_TLS); /* start with clean array */
- if ( array_init(mx_list) == FAILURE ) {
- RETURN_FALSE;
- }
-
- /* Go! */
- i = res_search(host->value.str.val,C_IN,T_MX,(u_char *)&ans,sizeof(ans));
- if ( i < 0 ) {
- RETURN_FALSE;
- }
- if ( i > sizeof(ans) ) i = sizeof(ans);
- hp = (HEADER *)&ans;
- cp = (u_char *)&ans + HFIXEDSZ;
- end = (u_char *)&ans +i;
- for ( qdc = ntohs((unsigned short)hp->qdcount); qdc--; cp += i + QFIXEDSZ) {
- if ( (i = dn_skipname(cp,end)) < 0 ) {
- RETURN_FALSE;
- }
- }
- count = ntohs((unsigned short)hp->ancount);
- while ( --count >= 0 && cp < end ) {
- if ( (i = dn_skipname(cp,end)) < 0 ) {
- RETURN_FALSE;
- }
- cp += i;
- GETSHORT(type,cp);
- cp += INT16SZ + INT32SZ;
- GETSHORT(i,cp);
- if ( type != T_MX ) {
- cp += i;
- continue;
- }
- GETSHORT(weight,cp);
- if ( (i = dn_expand(ans,end,cp,buf,sizeof(buf)-1)) < 0 ) {
- RETURN_FALSE;
- }
- cp += i;
- tmp1.value.str.len = strlen(buf);
- tmp1.value.str.val = estrndup(buf,tmp1.value.str.len);
- tmp1.type = IS_STRING;
- _php3_hash_next_index_insert(mx_list->value.ht, (void *)&tmp1, sizeof(pval), NULL);
- if ( need_weight ) {
- tmp2.value.lval = (long)weight;
- tmp2.type = IS_LONG;
- _php3_hash_next_index_insert(weight_list->value.ht, (void *)&tmp2, sizeof(pval), NULL);
- }
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/dns.h b/ext/standard/dns.h
deleted file mode 100644
index c9f3706848..0000000000
--- a/ext/standard/dns.h
+++ /dev/null
@@ -1,53 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _DNS_H
-#define _DNS_H
-
-extern void php3_gethostbyaddr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_gethostbyname(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_gethostbynamel(INTERNAL_FUNCTION_PARAMETERS);
-#if !(WIN32|WINNT)||(HAVE_BINDLIB)
-extern void php3_checkdnsrr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getmxrr(INTERNAL_FUNCTION_PARAMETERS);
-#endif
-
-#ifndef INT16SZ
-#define INT16SZ 2
-#endif
-
-#ifndef INT32SZ
-#define INT32SZ 4
-#endif
-
-#endif /* _DNS_H */
diff --git a/ext/standard/exec.c b/ext/standard/exec.c
deleted file mode 100644
index 3c1f05b202..0000000000
--- a/ext/standard/exec.c
+++ /dev/null
@@ -1,388 +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. |
- +----------------------------------------------------------------------+
- | Author: Rasmus Lerdorf |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include "php.h"
-#include <ctype.h>
-#include "php3_string.h"
-#include "safe_mode.h"
-#include "functions/head.h"
-#include "exec.h"
-#include "php_globals.h"
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-/*
- * If type==0, only last line of output is returned (exec)
- * If type==1, all lines will be printed and last lined returned (system)
- * If type==2, all lines will be saved to given array (exec with &$array)
- * If type==3, output will be printed binary, no lines will be saved or returned (passthru)
- *
- */
-static int _Exec(int type, char *cmd, pval *array, pval *return_value)
-{
- FILE *fp;
- char buf[EXEC_INPUT_BUF], *tmp=NULL;
- int t, l, ret, output=1;
- int overflow_limit, lcmd, ldir;
- char *b, *c, *d=NULL;
- PLS_FETCH();
-
- if (PG(safe_mode)) {
- lcmd = strlen(cmd);
- ldir = strlen(PG(safe_mode_exec_dir));
- l = lcmd + ldir + 2;
- overflow_limit = l;
- c = strchr(cmd, ' ');
- if (c) *c = '\0';
- if (strstr(cmd, "..")) {
- php3_error(E_WARNING, "No '..' components allowed in path");
- return -1;
- }
- d = emalloc(l);
- strcpy(d, PG(safe_mode_exec_dir));
- overflow_limit -= ldir;
- b = strrchr(cmd, '/');
- if (b) {
- strcat(d, b);
- overflow_limit -= strlen(b);
- } else {
- strcat(d, "/");
- strcat(d, cmd);
- overflow_limit-=(strlen(cmd)+1);
- }
- if (c) {
- *c = ' ';
- strncat(d, c, overflow_limit);
- }
- tmp = _php3_escapeshellcmd(d);
- efree(d);
- d = tmp;
-#if WIN32|WINNT
- fp = popen(d, "rb");
-#else
- fp = popen(d, "r");
-#endif
- if (!fp) {
- php3_error(E_WARNING, "Unable to fork [%s]", d);
- efree(d);
- return -1;
- }
- } else { /* not safe_mode */
-#if WIN32|WINNT
- fp = popen(cmd, "rb");
-#else
- fp = popen(cmd, "r");
-#endif
- if (!fp) {
- php3_error(E_WARNING, "Unable to fork [%s]", cmd);
- return -1;
- }
- }
- buf[0] = '\0';
- if (type==2) {
- if (array->type != IS_ARRAY) {
- pval_destructor(array _INLINE_TLS);
- array_init(array);
- }
- }
- if (type != 3) {
- while (fgets(buf, EXEC_INPUT_BUF - 1, fp)) {
- if (type == 1) {
- if (output) PUTS(buf);
-#if APACHE
-# if MODULE_MAGIC_NUMBER > 19970110
- if (output) rflush(GLOBAL(php3_rqst));
-# else
- if (output) bflush(GLOBAL(php3_rqst)->connection->client);
-# endif
-#endif
-#if CGI_BINARY
- fflush(stdout);
-#endif
-#if FHTTPD
- /* fhttpd doesn't flush */
-#endif
-#if USE_SAPI
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
-#endif
- }
- else if (type == 2) {
- pval tmp;
-
- /* strip trailing whitespaces */
- l = strlen(buf);
- t = l;
- while (l && isspace((int)buf[--l]));
- if (l < t) buf[l + 1] = '\0';
- tmp.value.str.len = strlen(buf);
- tmp.value.str.val = estrndup(buf,tmp.value.str.len);
- tmp.type = IS_STRING;
- _php3_hash_next_index_insert(array->value.ht,(void *) &tmp, sizeof(pval), NULL);
- }
- }
-
- /* strip trailing spaces */
- l = strlen(buf);
- t = l;
- while (l && isspace((int)buf[--l]));
- if (l < t) buf[l + 1] = '\0';
-
- } else {
- int b, i;
-
- while ((b = fread(buf, 1, sizeof(buf), fp)) > 0) {
- for (i = 0; i < b; i++)
- if (output) PUTC(buf[i]);
- }
- }
-
- /* Return last line from the shell command */
- if (PG(magic_quotes_runtime) && type!=3) {
- int len;
-
- tmp = _php3_addslashes(buf, 0, &len, 0);
- RETVAL_STRINGL(tmp,len,0);
- } else {
- RETVAL_STRING(buf,1);
- }
-
- ret = pclose(fp);
-#if HAVE_SYS_WAIT_H
- if (WIFEXITED(ret)) {
- ret = WEXITSTATUS(ret);
- }
-#endif
-
- if (d) efree(d);
- return ret;
-}
-
-/* {{{ proto int exec(string command [, array output [, int return_value]])
- Execute an external program */
-void php3_exec(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2, *arg3;
- int arg_count = ARG_COUNT(ht);
- int ret;
-
- if (arg_count > 3 || getParameters(ht, arg_count, &arg1, &arg2, &arg3) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = _Exec(0, arg1->value.str.val, NULL, return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php3_error(E_WARNING,"Array argument to exec() not passed by reference");
- }
- ret = _Exec(2, arg1->value.str.val, arg2, return_value);
- break;
- case 3:
- if (!ParameterPassedByReference(ht,2)) {
- php3_error(E_WARNING,"Array argument to exec() not passed by reference");
- }
- if (!ParameterPassedByReference(ht,3)) {
- php3_error(E_WARNING,"return_status argument to exec() not passed by reference");
- }
- ret = _Exec(2, arg1->value.str.val, arg2, return_value);
- arg3->type = IS_LONG;
- arg3->value.lval=ret;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int system(string command [, int return_value])
- Execute an external program and display output */
-void php3_system(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2;
- int arg_count = ARG_COUNT(ht);
- int ret;
-
- if (arg_count > 2 || getParameters(ht, arg_count, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = _Exec(1, arg1->value.str.val, NULL, return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php3_error(E_WARNING,"return_status argument to system() not passed by reference");
- }
- ret = _Exec(1, arg1->value.str.val, NULL, return_value);
- arg2->type = IS_LONG;
- arg2->value.lval=ret;
- break;
- }
-}
-/* }}} */
-
-/* {{{ proto int passthru(string command [, int return_value])
- Execute an external program and display raw output */
-void php3_passthru(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2;
- int arg_count = ARG_COUNT(ht);
- int ret;
-
- if (arg_count > 2 || getParameters(ht, arg_count, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- switch (arg_count) {
- case 1:
- ret = _Exec(3, arg1->value.str.val, NULL, return_value);
- break;
- case 2:
- if (!ParameterPassedByReference(ht,2)) {
- php3_error(E_WARNING,"return_status argument to system() not passed by reference");
- }
- ret = _Exec(3, arg1->value.str.val, NULL, return_value);
- arg2->type = IS_LONG;
- arg2->value.lval=ret;
- break;
- }
-}
-/* }}} */
-
-static int php3_ind(char *s, char c)
-{
- register int x;
-
- for (x = 0; s[x]; x++)
- if (s[x] == c)
- return x;
-
- return -1;
-}
-
-/* Escape all chars that could possibly be used to
- break out of a shell command
-
- This function emalloc's a string and returns the pointer.
- Remember to efree it when done with it.
-
- *NOT* safe for binary strings
-*/
-char * _php3_escapeshellcmd(char *str) {
- register int x, y, l;
- char *cmd;
-
- l = strlen(str);
- cmd = emalloc(2 * l + 1);
- strcpy(cmd, str);
- for (x = 0; cmd[x]; x++) {
- if (php3_ind("&;`'\"|*?~<>^()[]{}$\\\x0A\xFF", cmd[x]) != -1) {
- for (y = l + 1; y > x; y--)
- cmd[y] = cmd[y - 1];
- l++; /* length has been increased */
- cmd[x] = '\\';
- x++; /* skip the character */
- }
- }
- return cmd;
-}
-
-/* {{{ proto escapeshellcmd(string command)
- escape shell metacharacters */
-void php3_escapeshellcmd(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1;
- char *cmd;
- TLS_VARS;
-
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- cmd = _php3_escapeshellcmd(arg1->value.str.val);
-
- RETVAL_STRING(cmd,1);
- efree(cmd);
-}
-/* }}} */
-
-
-PHP_FUNCTION(shell_exec)
-{
- FILE *in;
- int readbytes,total_readbytes=0,allocated_space;
- pval *cmd;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &cmd)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (PG(safe_mode)) {
- php3_error(E_WARNING,"Cannot execute using backquotes in safe mode");
- RETURN_FALSE;
- }
-
- convert_to_string(cmd);
-#if WIN32|WINNT
- if ((in=popen(cmd->value.str.val,"rt"))==NULL) {
-#else
- if ((in=popen(cmd->value.str.val,"r"))==NULL) {
-#endif
- php3_error(E_WARNING,"Unable to execute '%s'",cmd->value.str.val);
- }
- allocated_space = EXEC_INPUT_BUF;
- return_value->value.str.val = (char *) emalloc(allocated_space);
- while (1) {
- readbytes = fread(return_value->value.str.val+total_readbytes,1,EXEC_INPUT_BUF,in);
- if (readbytes<=0) {
- break;
- }
- total_readbytes += readbytes;
- allocated_space = total_readbytes+EXEC_INPUT_BUF;
- return_value->value.str.val = (char *) erealloc(return_value->value.str.val,allocated_space);
- }
- fclose(in);
-
- return_value->value.str.val = erealloc(return_value->value.str.val,total_readbytes+1);
- return_value->value.str.val[total_readbytes]=0;
- return_value->value.str.len = total_readbytes;
- return_value->type = IS_STRING;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/exec.h b/ext/standard/exec.h
deleted file mode 100644
index f8062ba828..0000000000
--- a/ext/standard/exec.h
+++ /dev/null
@@ -1,43 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _EXEC_H
-#define _EXEC_H
-
-extern void php3_system(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_exec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_escapeshellcmd(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_passthru(INTERNAL_FUNCTION_PARAMETERS);
-PHP_FUNCTION(shell_exec);
-
-char *_php3_escapeshellcmd(char *);
-#endif /* _EXEC_H */
diff --git a/ext/standard/file.c b/ext/standard/file.c
deleted file mode 100644
index 5fdefec901..0000000000
--- a/ext/standard/file.c
+++ /dev/null
@@ -1,1435 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#if MSVC5
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#include "win32/winutil.h"
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-/* #include <sys/uio.h> */
-#endif
-#include "functions/head.h"
-#include "safe_mode.h"
-#include "php3_string.h"
-#include "file.h"
-#if HAVE_PWD_H
-#if MSVC5
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#include "snprintf.h"
-#include "fsock.h"
-#include "fopen-wrappers.h"
-#include "php_globals.h"
-
-#if MISSING_FCLOSE_DECL
-extern int fclose();
-#endif
-
-static void _php3_closesocket(int *);
-
-#ifndef THREAD_SAFE
-static int fgetss_state = 0;
-int le_fp,le_pp;
-int wsa_fp; /*to handle reading and writing to windows sockets*/
-static int pclose_ret;
-extern int le_uploads;
-#endif
-
-#ifndef HAVE_TEMPNAM
-/*
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <unistd.h>
-
-#ifndef MAXPATHLEN
-# ifdef PATH_MAX
-# define MAXPATHLEN PATH_MAX
-# else
-# define MAXPATHLEN 255
-# endif
-#endif
-
-char *
-tempnam(const char *dir, const char *pfx)
-{
- int save_errno;
- char *f, *name;
- static char path_tmp[] = "/tmp";
-
- if (!(name = emalloc(MAXPATHLEN))) {
- return(NULL);
- }
-
- if (!pfx) {
- pfx = "tmp.";
- }
-
- if (f = getenv("TMPDIR")) {
- (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
- *(f + strlen(f) - 1) == '/'? "": "/", pfx);
- if (f = mktemp(name))
- return(f);
- }
-
- if (f = (char *)dir) {
- (void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
- *(f + strlen(f) - 1) == '/'? "": "/", pfx);
- if (f = mktemp(name))
- return(f);
- }
-
- f = P_tmpdir;
- (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
- if (f = mktemp(name))
- return(f);
-
- f = path_tmp;
- (void)snprintf(name, MAXPATHLEN, "%s%sXXXXXX", f, pfx);
- if (f = mktemp(name))
- return(f);
-
- save_errno = errno;
- efree(name);
- errno = save_errno;
- return(NULL);
-}
-#endif
-
-function_entry php3_file_functions[] = {
- {"pclose", php3_pclose, NULL},
- {"popen", php3_popen, NULL},
- {"readfile", php3_readfile, NULL},
- {"rewind", php3_rewind, NULL},
- {"rmdir", php3_rmdir, NULL},
- {"umask", php3_fileumask, NULL},
- {"fclose", php3_fclose, NULL},
- {"feof", php3_feof, NULL},
- {"fgetc", php3_fgetc, NULL},
- {"fgets", php3_fgets, NULL},
- {"fgetss", php3_fgetss, NULL},
- {"fread", php3_fread, NULL},
- {"fopen", php3_fopen, NULL},
- {"fpassthru", php3_fpassthru, NULL},
- {"fseek", php3_fseek, NULL},
- {"ftell", php3_ftell, NULL},
- {"fwrite", php3_fwrite, NULL},
- {"fputs", php3_fwrite, NULL},
- {"mkdir", php3_mkdir, NULL},
- {"rename", php3_rename, NULL},
- {"copy", php3_file_copy, NULL},
- {"tempnam", php3_tempnam, NULL},
- {"file", php3_file, NULL},
- {"get_meta_tags", php3_get_meta_tags, NULL},
- {"set_socket_blocking", php3_set_socket_blocking, NULL},
-#if (0 && HAVE_SYS_TIME_H && HAVE_SETSOCKOPT && defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO))
- {"set_socket_timeout", php3_set_socket_timeout, NULL},
-#endif
- {NULL, NULL, NULL}
-};
-
-php3_module_entry php3_file_module_entry = {
- "PHP_file", php3_file_functions, php3_minit_file, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-/* {{{ proto array get_meta_tags(string filename [, int use_include_path])
- Extracts all meta tag content attributes from a file and returns an array */
-void php3_get_meta_tags(INTERNAL_FUNCTION_PARAMETERS) {
- pval *filename, *arg2;
- FILE *fp;
- char buf[8192];
- int use_include_path = 0;
- int issock=0, socketd=0;
- int len, var_namelen;
- char var_name[50],*val=NULL,*tmp,*end,*slashed;
- PLS_FETCH();
-
- /* check args */
- switch (ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht,1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (getParameters(ht,2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg2);
- use_include_path = arg2->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- fp = php3_fopen_wrapper(filename->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- php3_strip_url_passwd(filename->value.str.val);
- php3_error(E_WARNING,"File(\"%s\") - %s",filename->value.str.val,strerror(errno));
- }
- RETURN_FALSE;
- }
-
- if (array_init(return_value)==FAILURE) {
- if (issock) {
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- } else {
- fclose(fp);
- }
- RETURN_FALSE;
- }
- /* Now loop through the file and do the magic quotes thing if needed */
- memset(buf,0,8191);
- while((issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp))
- && !php3i_stristr(buf,"</head>")) {
- if(php3i_stristr(buf,"<meta")) {
-
- memset(var_name,0,50);
- /* get the variable name from the name attribute of the meta tag */
- tmp=php3i_stristr(buf,"name=\"");
- if(tmp) {
- tmp+=6;
- end=strstr(tmp,"\"");
- if(end) {
- unsigned char *c;
- *end='\0';
- snprintf(var_name,50,"%s",tmp);
- *end='"';
-
- c = (unsigned char*)var_name;
- while (*c) {
- switch(*c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- case ' ':
- *c++ ='_';
- break;
- default:
- *c++ = tolower((unsigned char)*c);
- }
- }
- var_namelen=strlen(var_name);
- }
-
- /* get the variable value from the content attribute of the meta tag */
- tmp=php3i_stristr(buf,"content=\"");
- if(tmp) {
- tmp+=9;
- end=strstr(tmp,"\"");
- if(end) {
- *end='\0';
- val=estrdup(tmp);
- *end='"';
- }
- }
- }
- if(*var_name && val) {
- if (PG(magic_quotes_runtime)) {
- slashed = _php3_addslashes(val,0,&len,0);
- } else {
- slashed = estrndup(val,strlen(val));
- }
- add_assoc_string(return_value, var_name, slashed, 0);
- efree(val);
- }
- }
- }
- if (issock) {
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- } else {
- fclose(fp);
- }
-}
-/* }}} */
-
-/* {{{ proto array file(string filename)
-Read entire file into an array */
-void php3_file(INTERNAL_FUNCTION_PARAMETERS) {
- pval *filename, *arg2;
- FILE *fp;
- char *slashed, buf[8192];
- register int i=0;
- int use_include_path = 0;
- int issock=0, socketd=0;
- PLS_FETCH();
-
- /* check args */
- switch (ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht,1,&filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 2:
- if (getParameters(ht,2,&filename,&arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg2);
- use_include_path = arg2->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- fp = php3_fopen_wrapper(filename->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- php3_strip_url_passwd(filename->value.str.val);
- php3_error(E_WARNING,"File(\"%s\") - %s",filename->value.str.val,strerror(errno));
- }
- RETURN_FALSE;
- }
-
- /* Initialize return array */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
-
- /* Now loop through the file and do the magic quotes thing if needed */
- memset(buf,0,8191);
- while(issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp)) {
- if (PG(magic_quotes_runtime)) {
- int len;
-
- slashed = _php3_addslashes(buf,0,&len,0); /* 0 = don't free source string */
- add_index_stringl(return_value, i++, slashed, len, 0);
- } else {
- add_index_string(return_value, i++, buf, 1);
- }
- }
- if (issock) {
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- } else {
- fclose(fp);
- }
-}
-/* }}} */
-
-
-static void __pclose(FILE *pipe)
-{
-TLS_VARS;
- GLOBAL(pclose_ret) = pclose(pipe);
-}
-
-static void _php3_closesocket(int *sock) {
- int socketd=*sock;
- if (socketd){
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- efree(sock);
- }
-}
-
-static void _php3_unlink_uploaded_file(char *file) {
- if(file) {
- unlink(file);
- }
-}
-
-int php3_minit_file(INIT_FUNC_ARGS)
-{
- TLS_VARS;
-
- GLOBAL(le_fp) = register_list_destructors(fclose,NULL);
- GLOBAL(le_pp) = register_list_destructors(__pclose,NULL);
- GLOBAL(wsa_fp) = register_list_destructors(_php3_closesocket,NULL);
- GLOBAL(le_uploads) = register_list_destructors(_php3_unlink_uploaded_file,NULL);
- return SUCCESS;
-}
-
-/* {{{ proto string tempnam(string dir, string prefix)
-Create a unique filename in a directory */
-void php3_tempnam(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2;
- char *d;
- char *t;
- char p[64];
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- d = estrndup(arg1->value.str.val,arg1->value.str.len);
- strncpy(p,arg2->value.str.val,sizeof(p));
-
- t = tempnam(d,p);
- efree(d);
- RETURN_STRING(t,1);
-}
-/* }}} */
-
-/* {{{ proto int fopen(string filename, string mode [, int use_include_path])
-Open a file or a URL and return a file pointer */
-void php3_fopen(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2, *arg3;
- FILE *fp;
- char *p;
- int *sock;
- int id;
- int use_include_path = 0;
- int issock=0, socketd=0;
- TLS_VARS;
-
- switch(ARG_COUNT(ht)) {
- 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;
- }
- convert_to_long(arg3);
- use_include_path = arg3->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- p = estrndup(arg2->value.str.val,arg2->value.str.len);
-
- /*
- * We need a better way of returning error messages from
- * php3_fopen__wrapper().
- */
- fp = php3_fopen_wrapper(arg1->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
- if (!fp && !socketd) {
- if (issock != BAD_URL) {
- php3_strip_url_passwd(arg1->value.str.val);
- php3_error(E_WARNING,"fopen(\"%s\",\"%s\") - %s",
- arg1->value.str.val, p, strerror(errno));
- }
- efree(p);
- RETURN_FALSE;
- }
- GLOBAL(fgetss_state)=0;
- if (issock) {
- sock=emalloc(sizeof(int));
- *sock=socketd;
- id = php3_list_insert(sock,GLOBAL(wsa_fp));
- } else {
- id = php3_list_insert(fp,GLOBAL(le_fp));
- }
- efree(p);
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto int fclose(int fp)
-Close an open file pointer */
-void php3_fclose(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int id, type;
- FILE *fp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id=arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- php3_list_delete(id);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int popen(string command, string mode)
-Execute a command and open either a read or a write pipe to it */
-void php3_popen(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2;
- FILE *fp;
- int id;
- char *p;
- char *b, buf[1024];
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_string(arg2);
- p = estrndup(arg2->value.str.val,arg2->value.str.len);
- if (PG(safe_mode)){
- b = strchr(arg1->value.str.val,' ');
- if (!b) {
- b = strrchr(arg1->value.str.val,'/');
- } else {
- char *c;
- c = arg1->value.str.val;
- while((*b!='/')&&(b!=c)) b--;
- if (b==c) b=NULL;
- }
- if (b) {
- snprintf(buf,sizeof(buf),"%s%s",PG(safe_mode_exec_dir),b);
- } else {
- snprintf(buf,sizeof(buf),"%s/%s",PG(safe_mode_exec_dir),arg1->value.str.val);
- }
- fp = popen(buf,p);
- if (!fp) {
- php3_error(E_WARNING,"popen(\"%s\",\"%s\") - %s",buf,p,strerror(errno));
- RETURN_FALSE;
- }
- } else {
- fp = popen(arg1->value.str.val,p);
- if (!fp) {
- php3_error(E_WARNING,"popen(\"%s\",\"%s\") - %s",arg1->value.str.val,p,strerror(errno));
- efree(p);
- RETURN_FALSE;
- }
- }
-/* #endif */
- id = php3_list_insert(fp,GLOBAL(le_pp));
- efree(p);
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto int pclose(int fp)
-Close a file pointer opened by popen() */
-void php3_pclose(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int id,type;
- FILE *fp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
-
- fp = php3_list_find(id,&type);
- if (!fp || type!=GLOBAL(le_pp)) {
- php3_error(E_WARNING,"Unable to find pipe identifier %d",id);
- RETURN_FALSE;
- }
- php3_list_delete(id);
- RETURN_LONG(GLOBAL(pclose_ret));
-}
-/* }}} */
-
-/* {{{ proto int feof(int fp)
-Test for end-of-file on a file pointer */
-void php3_feof(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- FILE *fp;
- int id, type;
- int issock=0;
- int socketd=0, *sock;
- unsigned int temp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- /* we're at the eof if the file doesn't exist */
- RETURN_TRUE;
- }
- if ((issock?!(recv(socketd,(char *)&temp,1,MSG_PEEK)):feof(fp))) {
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int set_socket_blocking(int socket descriptor, int mode)
-Set blocking/non-blocking mode on a socket */
-void php3_set_socket_blocking(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2;
- int id, type, block;
- int flags;
- int socketd=0, *sock;
- 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;
- block = arg2->value.lval;
-
- sock = php3_list_find(id,&type);
- if (type!=GLOBAL(wsa_fp)) {
- php3_error(E_WARNING,"%d is not a socket id",id);
- RETURN_FALSE;
- }
- socketd=*sock;
-#if WIN32|WINNT
- /* with ioctlsocket, a non-zero sets nonblocking, a zero sets blocking */
- flags=block;
- if (ioctlsocket(socketd,FIONBIO,&flags)==SOCKET_ERROR){
- php3_error(E_WARNING,"%s",WSAGetLastError());
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-#else
- flags = fcntl(socketd, F_GETFL);
-# ifdef O_NONBLOCK
- /* POSIX version */
- if (block) {
- if ((flags & O_NONBLOCK)) {
- flags ^= O_NONBLOCK;
- }
- } else {
- if (!(flags & O_NONBLOCK)) {
- flags |= O_NONBLOCK;
- }
- }
-# else
-# ifdef O_NDELAY
- /* old non-POSIX version */
- if (block) {
- flags |= O_NDELAY;
- } else {
- flags ^= O_NDELAY;
- }
-# endif
-# endif
- fcntl(socketd,F_SETFL,flags);
- /* FIXME: Shouldnt we return true on this function? */
-#endif
-}
-/* }}} */
-
-
-#if (0 && HAVE_SYS_TIME_H && HAVE_SETSOCKOPT && defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO))
-/* this doesn't work, as it appears those properties are read-only :( */
-void php3_set_socket_timeout(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *socket,*timeout;
- int type, *sock;
- struct timeval t;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &socket, &timeout)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(socket);
- convert_to_long(timeout);
-
- sock = php3_list_find(socket->value.lval, &type);
- if (type!=GLOBAL(wsa_fp)) {
- php3_error(E_WARNING,"%d is not a socket id",socket->value.lval);
- RETURN_FALSE;
- }
- t.tv_sec = timeout->value.lval;
- t.tv_usec = 0;
- setsockopt(*sock,SOL_SOCKET,SO_SNDTIMEO,(void *) &t,sizeof(struct timeval));
- setsockopt(*sock,SOL_SOCKET,SO_RCVTIMEO,(void *) &t,sizeof(struct timeval));
- RETURN_TRUE;
-}
-#endif
-
-/* {{{ proto string fgets(int fp, int length)
-Get a line from file pointer */
-void php3_fgets(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2;
- FILE *fp;
- int id, len, type;
- char *buf;
- int issock=0;
- int *sock, socketd=0;
- PLS_FETCH();
-
- 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;
- len = arg2->value.lval;
-
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- buf = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
- memset(buf,0,len+1);
- if (!(issock?SOCK_FGETS(buf,len,socketd):(int)fgets(buf,len,fp))) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = _php3_addslashes(buf,0,&return_value->value.str.len,1);
- } else {
- return_value->value.str.val = buf;
- return_value->value.str.len = strlen(return_value->value.str.val);
- }
- return_value->type = IS_STRING;
- }
- return;
-}
-/* }}} */
-
-/* {{{ proto string fgetc(int fp)
-Get a character from file pointer */
-void php3_fgetc(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- FILE *fp;
- int id, type;
- char *buf;
- int issock=0;
- int *sock, socketd=0;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
-
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd = *sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- buf = emalloc(sizeof(char) * 2);
- if (!(issock?(SOCK_FGETC(buf,socketd)):(*buf=fgetc(fp)))) {
- efree(buf);
- RETVAL_FALSE;
- } else {
- buf[1]='\0';
- return_value->value.str.val = buf;
- return_value->value.str.len = 1;
- return_value->type = IS_STRING;
- }
- return;
-}
-/* }}} */
-
-/* Strip any HTML tags while reading */
-/* {{{ proto string fgetss(int fp, int length)
-Get a line from file pointer and strip HTML tags */
-void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *fd, *bytes;
- FILE *fp;
- int id, len, br, type;
- char *buf, *p, *rbuf, *rp, c, lc;
- int issock=0;
- int *sock,socketd=0;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &fd, &bytes) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(fd);
- convert_to_long(bytes);
-
- id = fd->value.lval;
- len = bytes->value.lval;
-
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING, "Unable to find file identifier %d", id);
- RETURN_FALSE;
- }
-
- buf = emalloc(sizeof(char) * (len + 1));
- /*needed because recv doesnt set null char at end*/
- memset(buf,0,len+1);
- if (!(issock?SOCK_FGETS(buf,len,socketd):(int)fgets(buf, len, fp))) {
- efree(buf);
- RETURN_FALSE;
- }
-
- rbuf = estrdup(buf);
- c = *buf;
- lc = '\0';
- p = buf;
- rp = rbuf;
- br = 0;
-
- while (c) {
- switch (c) {
- case '<':
- if (GLOBAL(fgetss_state) == 0) {
- lc = '<';
- GLOBAL(fgetss_state) = 1;
- }
- break;
-
- case '(':
- if (GLOBAL(fgetss_state) == 2) {
- if (lc != '\"') {
- lc = '(';
- br++;
- }
- } else if (GLOBAL(fgetss_state) == 0) {
- *(rp++) = c;
- }
- break;
-
- case ')':
- if (GLOBAL(fgetss_state) == 2) {
- if (lc != '\"') {
- lc = ')';
- br--;
- }
- } else if (GLOBAL(fgetss_state) == 0) {
- *(rp++) = c;
- }
- break;
-
- case '>':
- if (GLOBAL(fgetss_state) == 1) {
- lc = '>';
- GLOBAL(fgetss_state) = 0;
- } else if (GLOBAL(fgetss_state) == 2) {
- if (!br && lc != '\"') {
- GLOBAL(fgetss_state) = 0;
- }
- }
- break;
-
- case '\"':
- if (GLOBAL(fgetss_state) == 2) {
- if (lc == '\"') {
- lc = '\0';
- } else if (lc != '\\') {
- lc = '\"';
- }
- } else if (GLOBAL(fgetss_state) == 0) {
- *(rp++) = c;
- }
- break;
-
- case '?':
- if (GLOBAL(fgetss_state)==1) {
- br=0;
- GLOBAL(fgetss_state)=2;
- break;
- }
- /* fall-through */
-
- default:
- if (GLOBAL(fgetss_state) == 0) {
- *(rp++) = c;
- }
- }
- c = *(++p);
- }
- *rp = '\0';
- efree(buf);
- RETVAL_STRING(rbuf,1);
- efree(rbuf);
-}
-/* }}} */
-
-/* {{{ proto int fwrite(int fp, string str [, int length])
-Binary-safe file write */
-void php3_fwrite(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2, *arg3=NULL;
- FILE *fp;
- int ret,id,type;
- int num_bytes;
- int issock=0;
- int *sock, socketd=0;
- PLS_FETCH();
-
- switch (ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &arg1, &arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(arg2);
- num_bytes = arg2->value.str.len;
- break;
- case 3:
- if (getParameters(ht, 3, &arg1, &arg2, &arg3)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_string(arg2);
- convert_to_long(arg3);
- num_bytes = MIN(arg3->value.lval, arg2->value.str.len);
- break;
- default:
- WRONG_PARAM_COUNT;
- /* NOTREACHED */
- break;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
-
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-
- /* strip slashes only if the length wasn't specified explicitly */
- if (!arg3 && PG(magic_quotes_runtime)) {
- _php3_stripslashes(arg2->value.str.val,&num_bytes);
- }
-
- if (issock){
- ret = SOCK_WRITEL(arg2->value.str.val,num_bytes,socketd);
- } else {
- ret = fwrite(arg2->value.str.val,1,num_bytes,fp);
- }
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int rewind(int fp)
-Rewind the position of a file pointer */
-void php3_rewind(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int id,type;
- FILE *fp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- rewind(fp);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int ftell(int fp)
-Get file pointer's read/write position */
-void php3_ftell(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int id, type;
- long pos;
- FILE *fp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- pos = ftell(fp);
- RETURN_LONG(pos);
-}
-/* }}} */
-
-/* {{{ proto int fseek(int fp, int offset)
-Seek on a file pointer */
-void php3_fseek(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2;
- int ret,id,type;
- long pos;
- FILE *fp;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- convert_to_long(arg2);
- pos = arg2->value.lval;
- id = arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
-/*fseek is flaky on windows, use setfilepointer, but we have to live with
- it until we use win32 api for all the file functions in 3.1 */
-#if 0
- ret = SetFilePointer (fp, pos, NULL, FILE_BEGIN);
- if (ret == 0xFFFFFFFF){
- php3_error(E_WARNING,"Unable to move file postition: %s",php3_win_err());
- RETURN_FALSE;
- }
-#else
- ret = fseek(fp,pos,SEEK_SET);
-#endif
- RETURN_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int mkdir(string pathname, int mode)
-Create a directory */
-void php3_mkdir(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2;
- int ret,mode;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- convert_to_long(arg2);
- mode = arg2->value.lval;
- if (PG(safe_mode) &&(!_php3_checkuid(arg1->value.str.val,3))) {
- RETURN_FALSE;
- }
- ret = mkdir(arg1->value.str.val,mode);
- if (ret < 0) {
- php3_error(E_WARNING,"MkDir failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int rmdir(string dirname)
-Remove a directory */
-void php3_rmdir(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- if (PG(safe_mode) &&(!_php3_checkuid(arg1->value.str.val,1))) {
- RETURN_FALSE;
- }
- ret = rmdir(arg1->value.str.val);
- if (ret < 0) {
- php3_error(E_WARNING,"RmDir failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int readfile(string filename [, int use_include_path])
-Output a file or a URL */
-void php3_readfile(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1, *arg2;
- char buf[8192];
- FILE *fp;
- int b, size;
- int use_include_path = 0;
-
- int issock=0, socketd=0;
- TLS_VARS;
-
- /* check args */
- 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);
- use_include_path = arg2->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
-
- /*
- * We need a better way of returning error messages from
- * php3_fopen_wrapper().
- */
- fp = php3_fopen_wrapper(arg1->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE, &issock, &socketd);
- if (!fp && !socketd){
- if (issock != BAD_URL) {
- php3_strip_url_passwd(arg1->value.str.val);
- php3_error(E_WARNING,"ReadFile(\"%s\") - %s",arg1->value.str.val,strerror(errno));
- }
- RETURN_FALSE;
- }
- size= 0;
- while(issock?(b=SOCK_FGETS(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0) {
- PHPWRITE(buf,b);
- size += b ;
- }
- if (issock) {
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- } else {
- fclose(fp);
- }
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto int umask([int mask])
-Return or change the umask */
-void php3_fileumask(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- int oldumask;
- int arg_count = ARG_COUNT(ht);
- TLS_VARS;
-
- oldumask = umask(077);
-
- if (arg_count == 0) {
- umask(oldumask);
- }
- else {
- if (arg_count > 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- umask(arg1->value.lval);
- }
- RETURN_LONG(oldumask);
-}
-/* }}} */
-
-/*
- * Read to EOF on a file descriptor and write the output to stdout.
- */
-/* {{{ proto int fpassthru(int fp)
-Output all remaining data from a file pointer */
-void php3_fpassthru(INTERNAL_FUNCTION_PARAMETERS) {
- pval *arg1;
- FILE *fp;
- char buf[8192];
- int id, size, b, type;
- int issock=0;
- int socketd=0, *sock;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg1);
- id = arg1->value.lval;
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- size = 0;
- if (php3_header()) { /* force headers if not already sent */
- while(issock?(b=SOCK_FGETS(buf,sizeof(buf),socketd)):(b = fread(buf, 1, sizeof(buf), fp)) > 0) {
- PHPWRITE(buf,b);
- size += b ;
- }
- }
-/*
- if (issock) {
-#if WIN32|WINNT
- closesocket(socketd);
-#else
- close(socketd);
-#endif
- } else {
- fclose(fp);
- }
-*/
- php3_list_delete(id);
- RETURN_LONG(size);
-}
-/* }}} */
-
-/* {{{ proto int rename(string old_name, string new_name)
-Rename a file */
-void php3_rename(INTERNAL_FUNCTION_PARAMETERS) {
- pval *OLD, *NEW;
- char *old, *new;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &OLD, &NEW) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(OLD);
- convert_to_string(NEW);
-
- old = OLD->value.str.val;
- new = NEW->value.str.val;
-
- if (PG(safe_mode) &&(!_php3_checkuid(old,2))) {
- RETURN_FALSE;
- }
- ret = rename(old, new);
-
- if (ret == -1) {
- php3_error(E_WARNING,
- "Rename failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int copy(string source_file, string destination_file)
-Copy a file */
-void php3_file_copy(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *source, *target;
- char buffer[8192];
- int fd_s,fd_t,read_bytes;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &source, &target) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(source);
- convert_to_string(target);
-
- if (PG(safe_mode) &&(!_php3_checkuid(source->value.str.val,2))) {
- RETURN_FALSE;
- }
-
-#if WIN32|WINNT
- if ((fd_s=open(source->value.str.val,O_RDONLY|_O_BINARY))==-1) {
-#else
- if ((fd_s=open(source->value.str.val,O_RDONLY))==-1) {
-#endif
- php3_error(E_WARNING,"Unable to open '%s' for reading: %s",source->value.str.val,strerror(errno));
- RETURN_FALSE;
- }
-#if WIN32|WINNT
- if ((fd_t=open(target->value.str.val,_O_WRONLY|_O_CREAT|_O_TRUNC|_O_BINARY,_S_IREAD|_S_IWRITE))==-1){
-#else
- if ((fd_t=creat(target->value.str.val,0777))==-1) {
-#endif
- php3_error(E_WARNING,"Unable to create '%s': %s", target->value.str.val,strerror(errno));
- close(fd_s);
- RETURN_FALSE;
- }
-
- while ((read_bytes=read(fd_s,buffer,8192))!=-1 && read_bytes!=0) {
- if (write(fd_t,buffer,read_bytes)==-1) {
- php3_error(E_WARNING,"Unable to write to '%s': %s",target->value.str.val,strerror(errno));
- close(fd_s);
- close(fd_t);
- RETURN_FALSE;
- }
- }
-
- close(fd_s);
- close(fd_t);
-
- RETVAL_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int fread(int fp, int length)
-Binary-safe file read */
-void php3_fread(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2;
- FILE *fp;
- int id, len, type;
- int issock=0;
- int *sock, socketd=0;
- PLS_FETCH();
-
- 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;
- len = arg2->value.lval;
-
- fp = php3_list_find(id,&type);
- if (type==GLOBAL(wsa_fp)){
- issock=1;
- sock = php3_list_find(id,&type);
- socketd=*sock;
- }
- if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd || type!=GLOBAL(wsa_fp))) {
- php3_error(E_WARNING,"Unable to find file identifier %d",id);
- RETURN_FALSE;
- }
- return_value->value.str.val = emalloc(sizeof(char) * (len + 1));
- /* needed because recv doesnt put a null at the end*/
-
- if (!issock) {
- return_value->value.str.len = fread(return_value->value.str.val, 1, len, fp);
- return_value->value.str.val[return_value->value.str.len] = 0;
- } else {
- return_value->value.str.len = _php3_sock_fread(return_value->value.str.val, len, socketd);
- }
- if (PG(magic_quotes_runtime)) {
- return_value->value.str.val = _php3_addslashes(return_value->value.str.val,return_value->value.str.len,&return_value->value.str.len,1);
- }
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* aparently needed for pdf to be compiled as a module under windows */
-PHPAPI int php3i_get_le_fp(void){
- TLS_VARS;
- return GLOBAL(le_fp);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * End:
- */
diff --git a/ext/standard/file.h b/ext/standard/file.h
deleted file mode 100644
index 08f1440f13..0000000000
--- a/ext/standard/file.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: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _FILE_H
-#define _FILE_H
-
-extern php3_module_entry php3_file_module_entry;
-#define php3_file_module_ptr &php3_file_module_entry
-
-extern int php3_minit_file(INIT_FUNC_ARGS);
-extern void php3_tempnam(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fopen(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fclose(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_popen(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_pclose(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_feof(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fread(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fgetc(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fgets(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fgetss(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fwrite(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rewind(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ftell(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fseek(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_mkdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rmdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fpassthru(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_readfile(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileumask(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rename(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_file_copy(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_file(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_set_socket_blocking(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_set_socket_timeout(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_get_meta_tags(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _FILE_H */
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
deleted file mode 100644
index 9b4810f1cc..0000000000
--- a/ext/standard/filestat.c
+++ /dev/null
@@ -1,509 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "safe_mode.h"
-#include "fopen-wrappers.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
-#if HAVE_PWD_H
-# if MSVC5
-# include "win32/pwd.h"
-# else
-# include <pwd.h>
-# endif
-#endif
-
-#if HAVE_GRP_H
-# if MSVC5
-# include "win32/grp.h"
-# else
-# include <grp.h>
-# endif
-#endif
-
-#if HAVE_UTIME
-# if MSVC5
-# include <sys/utime.h>
-# else
-# include <utime.h>
-# endif
-#endif
-
-#include "php3_filestat.h"
-
-#ifndef THREAD_SAFE
-static char *CurrentStatFile=NULL;
-# if MSVC5
-static unsigned int CurrentStatLength=0;
-# else
-static int CurrentStatLength=0;
-# endif
-static struct stat sb;
-#if HAVE_SYMLINK
-static struct stat lsb;
-#endif
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
-#endif
-#ifndef S_ISLNK
-#define S_ISLNK(mode) (((mode)&S_IFMT) == S_IFLNK)
-#endif
-
-
-int php3_init_filestat(INIT_FUNC_ARGS)
-{
- TLS_VARS;
-
- GLOBAL(CurrentStatFile)=NULL;
- GLOBAL(CurrentStatLength)=0;
- return SUCCESS;
-}
-
-
-int php3_shutdown_filestat(SHUTDOWN_FUNC_ARGS)
-{
- TLS_VARS;
-
- if (GLOBAL(CurrentStatFile))
- efree (GLOBAL(CurrentStatFile));
- return SUCCESS;
-}
-
-void php3_chgrp(INTERNAL_FUNCTION_PARAMETERS)
-{
-#ifndef WINDOWS
- pval *filename, *group;
- gid_t gid;
- struct group *gr=NULL;
-#endif
- int ret;
- TLS_VARS;
- ret = 0;
-#ifndef WINDOWS
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&group)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
- if (group->type == IS_STRING) {
- gr = getgrnam(group->value.str.val);
- if (!gr) {
- php3_error(E_WARNING, "unable to find gid for %s",
- group->value.str.val);
- RETURN_FALSE;
- }
- gid = gr->gr_gid;
- } else {
- convert_to_long(group);
- gid = group->value.lval;
- }
-
-/* #if PHP_SAFE_MODE */
- if (PG(safe_mode) &&(!_php3_checkuid(filename->value.str.val, 1))) {
- RETURN_FALSE;
- }
-/* #endif */
-
- /* Check the basedir */
- if (_php3_check_open_basedir(filename->value.str.val)) RETURN_FALSE;
-
- ret = chown(filename->value.str.val, -1, gid);
- if (ret == -1) {
- php3_error(E_WARNING, "chgrp failed: %s", strerror(errno));
- RETURN_FALSE;
- }
-#endif
- RETURN_TRUE;
-}
-
-void php3_chown(INTERNAL_FUNCTION_PARAMETERS)
-{
-#ifndef WINDOWS
- pval *filename, *user;
- int ret;
- uid_t uid;
- struct passwd *pw = NULL;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&user)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
- if (user->type == IS_STRING) {
- pw = getpwnam(user->value.str.val);
- if (!pw) {
- php3_error(E_WARNING, "unable to find uid for %s",
- user->value.str.val);
- RETURN_FALSE;
- }
- uid = pw->pw_uid;
- } else {
- convert_to_long(user);
- uid = user->value.lval;
- }
-
- if (PG(safe_mode) &&(!_php3_checkuid(filename->value.str.val, 1))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (_php3_check_open_basedir(filename->value.str.val)) RETURN_FALSE;
-
- ret = chown(filename->value.str.val, uid, -1);
- if (ret == -1) {
- php3_error(E_WARNING, "chown failed: %s", strerror(errno));
- RETURN_FALSE;
- }
-#else
- TLS_VARS;
-#endif
- RETURN_TRUE;
-}
-
-void php3_chmod(INTERNAL_FUNCTION_PARAMETERS) {
- pval *filename, *mode;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&filename,&mode)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
- convert_to_long(mode);
-
- if (PG(safe_mode) &&(!_php3_checkuid(filename->value.str.val, 1))) {
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (_php3_check_open_basedir(filename->value.str.val)) RETURN_FALSE;
-
- ret = chmod(filename->value.str.val, mode->value.lval);
- if (ret == -1) {
- php3_error(E_WARNING, "chmod failed: %s", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-}
-
-void php3_touch(INTERNAL_FUNCTION_PARAMETERS) {
-#if HAVE_UTIME
- pval *filename, *filetime;
- int ret;
- struct stat sb;
- FILE *file;
- struct utimbuf *newtime = NULL;
- int ac = ARG_COUNT(ht);
- TLS_VARS;
-
- if (ac == 1 && getParameters(ht,1,&filename) != FAILURE) {
-#ifndef HAVE_UTIME_NULL
- newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
- if (!newtime) {
- php3_error(E_WARNING, "unable to emalloc memory for changing time");
- return;
- }
- newtime->actime = time(NULL);
- newtime->modtime = newtime->actime;
-#endif
- } else if (ac == 2 && getParameters(ht,2,&filename,&filetime) != FAILURE) {
- newtime = (struct utimbuf *)emalloc(sizeof(struct utimbuf));
- if (!newtime) {
- php3_error(E_WARNING, "unable to emalloc memory for changing time");
- return;
- }
- convert_to_long(filetime);
- newtime->actime = filetime->value.lval;
- newtime->modtime = filetime->value.lval;
- } else {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- if (PG(safe_mode) &&(!_php3_checkuid(filename->value.str.val, 1))) {
- if (newtime) efree(newtime);
- RETURN_FALSE;
- }
-
- /* Check the basedir */
- if (_php3_check_open_basedir(filename->value.str.val)) RETURN_FALSE;
-
- /* create the file if it doesn't exist already */
- ret = stat(filename->value.str.val, &sb);
- if (ret == -1) {
- file = fopen(filename->value.str.val, "w");
- if (file == NULL) {
- php3_error(E_WARNING, "unable to create file %s because %s", filename->value.str.val, strerror(errno));
- if (newtime) efree(newtime);
- RETURN_FALSE;
- }
- fclose(file);
- }
-
- ret = utime(filename->value.str.val, newtime);
- if (newtime) efree(newtime);
- if (ret == -1) {
- php3_error(E_WARNING, "utime failed: %s", strerror(errno));
- RETURN_FALSE;
- } else {
- RETURN_TRUE;
- }
-#endif
-}
-
-void php3_clearstatcache(INTERNAL_FUNCTION_PARAMETERS) {
- TLS_VARS;
-
- if (GLOBAL(CurrentStatFile)) {
- efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatFile) = NULL;
- }
-}
-
-static void _php3_stat(const char *filename, int type, pval *return_value)
-{
- struct stat *stat_sb = &GLOBAL(sb);
- TLS_VARS;
-
- if (!GLOBAL(CurrentStatFile) || strcmp(filename,GLOBAL(CurrentStatFile))) {
- if (!GLOBAL(CurrentStatFile)
- || strlen(filename) > GLOBAL(CurrentStatLength)) {
- if (GLOBAL(CurrentStatFile)) efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatLength) = strlen(filename);
- GLOBAL(CurrentStatFile) = estrndup(filename,GLOBAL(CurrentStatLength));
- } else {
- strcpy(GLOBAL(CurrentStatFile),filename);
- }
-#if HAVE_SYMLINK
- GLOBAL(lsb).st_mode = 0; /* mark lstat buf invalid */
-#endif
- if (stat(GLOBAL(CurrentStatFile),&GLOBAL(sb))==-1) {
- if (type != 15 || errno != ENOENT) { /* fileexists() test must print no error */
- php3_error(E_NOTICE,"stat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno));
- }
- efree(GLOBAL(CurrentStatFile));
- GLOBAL(CurrentStatFile)=NULL;
- RETURN_FALSE;
- }
- }
-
-#if HAVE_SYMLINK
- if (8 == type /* filetype */
- || 14 == type /* is link */
- || 16 == type) { /* lstat */
-
- /* do lstat if the buffer is empty */
-
- if (!GLOBAL(lsb).st_mode) {
- if (lstat(GLOBAL(CurrentStatFile),&GLOBAL(lsb)) == -1) {
- php3_error(E_NOTICE,"lstat failed for %s (errno=%d - %s)",GLOBAL(CurrentStatFile),errno,strerror(errno));
- RETURN_FALSE;
- }
- }
- }
-#endif
-
- switch(type) {
- case 0: /* fileperms */
- RETURN_LONG((long)GLOBAL(sb).st_mode);
- case 1: /* fileinode */
- RETURN_LONG((long)GLOBAL(sb).st_ino);
- case 2: /* filesize */
- RETURN_LONG((long)GLOBAL(sb).st_size);
- case 3: /* fileowner */
- RETURN_LONG((long)GLOBAL(sb).st_uid);
- case 4: /* filegroup */
- RETURN_LONG((long)GLOBAL(sb).st_gid);
- case 5: /* fileatime */
- RETURN_LONG((long)GLOBAL(sb).st_atime);
- case 6: /* filemtime */
- RETURN_LONG((long)GLOBAL(sb).st_mtime);
- case 7: /* filectime */
- RETURN_LONG((long)GLOBAL(sb).st_ctime);
- case 8: /* filetype */
-#if HAVE_SYMLINK
- if (S_ISLNK(GLOBAL(lsb).st_mode)) {
- RETURN_STRING("link",1);
- }
-#endif
- switch(GLOBAL(sb).st_mode&S_IFMT) {
- case S_IFIFO: RETURN_STRING("fifo",1);
- case S_IFCHR: RETURN_STRING("char",1);
- case S_IFDIR: RETURN_STRING("dir",1);
- case S_IFBLK: RETURN_STRING("block",1);
- case S_IFREG: RETURN_STRING("file",1);
- }
- php3_error(E_WARNING,"Unknown file type (%d)",GLOBAL(sb).st_mode&S_IFMT);
- RETURN_STRING("unknown",1);
- case 9: /*is writable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IWRITE)!=0);
- case 10: /*is readable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IREAD)!=0);
- case 11: /*is executable*/
- RETURN_LONG((GLOBAL(sb).st_mode&S_IEXEC)!=0 && !S_ISDIR(GLOBAL(sb).st_mode));
- case 12: /*is file*/
- RETURN_LONG(S_ISREG(GLOBAL(sb).st_mode));
- case 13: /*is dir*/
- RETURN_LONG(S_ISDIR(GLOBAL(sb).st_mode));
- case 14: /*is link*/
-#if HAVE_SYMLINK
- RETURN_LONG(S_ISLNK(GLOBAL(lsb).st_mode));
-#else
- RETURN_FALSE;
-#endif
- case 15: /*file exists*/
- RETURN_TRUE; /* the false case was done earlier */
- case 16: /* lstat */
-#if HAVE_SYMLINK
- stat_sb = &GLOBAL(lsb);
-#endif
- /* FALLTHROUGH */
- case 17: /* stat */
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
- add_next_index_long(return_value, stat_sb->st_dev);
- add_next_index_long(return_value, stat_sb->st_ino);
- add_next_index_long(return_value, stat_sb->st_mode);
- add_next_index_long(return_value, stat_sb->st_nlink);
- add_next_index_long(return_value, stat_sb->st_uid);
- add_next_index_long(return_value, stat_sb->st_gid);
-#ifdef HAVE_ST_BLKSIZE
- add_next_index_long(return_value, stat_sb->st_rdev);
-#else
- add_next_index_long(return_value, -1);
-#endif
- add_next_index_long(return_value, stat_sb->st_size);
- add_next_index_long(return_value, stat_sb->st_atime);
- add_next_index_long(return_value, stat_sb->st_mtime);
- add_next_index_long(return_value, stat_sb->st_ctime);
-#if HAVE_ST_BLKSIZE
- add_next_index_long(return_value, stat_sb->st_blksize);
-#else
- add_next_index_long(return_value, -1);
-#endif
-#if HAVE_ST_BLOCKS
- add_next_index_long(return_value, stat_sb->st_blocks);
-#else
- add_next_index_long(return_value, -1);
-#endif
- return;
- }
- php3_error(E_WARNING, "didn't understand stat call");
- RETURN_FALSE;
-}
-
-/* another quickie macro to make defining similar functions easier */
-#define FileFunction(name, funcnum) \
-void name(INTERNAL_FUNCTION_PARAMETERS) { \
- pval *filename; \
- if (ARG_COUNT(ht)!=1 || getParameters(ht,1,&filename) == FAILURE) { \
- WRONG_PARAM_COUNT; \
- } \
- convert_to_string(filename); \
- _php3_stat(filename->value.str.val, funcnum, return_value); \
-}
-
-FileFunction(php3_fileperms,0)
-FileFunction(php3_fileinode,1)
-FileFunction(php3_filesize, 2)
-FileFunction(php3_fileowner,3)
-FileFunction(php3_filegroup,4)
-FileFunction(php3_fileatime,5)
-FileFunction(php3_filemtime,6)
-FileFunction(php3_filectime,7)
-FileFunction(php3_filetype, 8)
-FileFunction(php3_iswritable, 9)
-FileFunction(php3_isreadable,10)
-FileFunction(php3_isexec,11)
-FileFunction(php3_isfile,12)
-FileFunction(php3_isdir,13)
-FileFunction(php3_islink,14)
-FileFunction(php3_fileexists,15)
-FileFunction(php3_lstat,16)
-FileFunction(php3_stat,17)
-
-function_entry php3_filestat_functions[] = {
- {"fileatime", php3_fileatime, NULL},
- {"filectime", php3_filectime, NULL},
- {"filegroup", php3_filegroup, NULL},
- {"fileinode", php3_fileinode, NULL},
- {"filemtime", php3_filemtime, NULL},
- {"fileowner", php3_fileowner, NULL},
- {"fileperms", php3_fileperms, NULL},
- {"filesize", php3_filesize, NULL},
- {"filetype", php3_filetype, NULL},
- {"file_exists", php3_fileexists, NULL},
- {"is_writeable",php3_iswritable, NULL},
- {"is_readable", php3_isreadable, NULL},
- {"is_executable",php3_isexec, NULL},
- {"is_file", php3_isfile, NULL},
- {"is_dir", php3_isdir, NULL},
- {"is_link", php3_islink, NULL},
- {"stat", php3_stat, NULL},
- {"lstat", php3_lstat, NULL},
- {"chown", php3_chown, NULL},
- {"chgrp", php3_chgrp, NULL},
- {"chmod", php3_chmod, NULL},
- {"touch", php3_touch, NULL},
- {NULL, NULL, NULL}
-};
-
-
-php3_module_entry php3_filestat_module_entry = {
- "PHP_filestat", php3_filestat_functions, NULL, NULL, php3_init_filestat, php3_shutdown_filestat, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
deleted file mode 100644
index 03e23b9526..0000000000
--- a/ext/standard/formatted_print.c
+++ /dev/null
@@ -1,602 +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 <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <math.h> /* modf() */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "functions/head.h"
-#include "php3_string.h"
-#include "zend_execute.h"
-#include <stdio.h>
-
-#define ALIGN_LEFT 0
-#define ALIGN_RIGHT 1
-#define ADJ_WIDTH 1
-#define ADJ_PRECISION 2
-#define NUM_BUF_SIZE 500
-#define NDIG 80
-#define FLOAT_DIGITS 6
-#define FLOAT_PRECISION 6
-#define MAX_FLOAT_DIGITS 38
-#define MAX_FLOAT_PRECISION 40
-
-#if 0
-/* trick to control varargs functions through cpp */
-# define PRINTF_DEBUG(arg) php3_printf arg
-#else
-# define PRINTF_DEBUG(arg)
-#endif
-
-static char hexchars[] = "0123456789abcdef";
-static char HEXCHARS[] = "0123456789ABCDEF";
-
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * _php3_cvt converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-static char *
-_php3_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- /*THREADX*/
-#ifndef THREAD_SAFE
- static char cvt_buf[NDIG];
-#endif
- TLS_VARS;
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &STATIC(cvt_buf)[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &STATIC(cvt_buf)[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &STATIC(cvt_buf)[NDIG];
- while (fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &STATIC(cvt_buf)[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
- arg = fj;
- r2--;
- }
- }
- p1 = &STATIC(cvt_buf)[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &STATIC(cvt_buf)[0]) {
- STATIC(cvt_buf)[0] = '\0';
- return (STATIC(cvt_buf));
- }
- while (p <= p1 && p < &STATIC(cvt_buf)[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &STATIC(cvt_buf)[NDIG]) {
- STATIC(cvt_buf)[NDIG - 1] = '\0';
- return (STATIC(cvt_buf));
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > STATIC(cvt_buf))
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > STATIC(cvt_buf))
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (STATIC(cvt_buf));
-}
-
-
-inline static void
-_php3_sprintf_appendchar(char **buffer, int *pos, int *size, char add)
-{
- if ((*pos + 1) >= *size) {
- *size <<= 1;
- PRINTF_DEBUG(("%s: ereallocing buffer to %d bytes\n", get_active_function_name(), *size));
- *buffer = erealloc(*buffer, *size);
- }
- PRINTF_DEBUG(("sprintf: appending '%c', pos=\n", add, *pos));
- (*buffer)[(*pos)++] = add;
-}
-
-
-inline static void
-_php3_sprintf_appendstring(char **buffer, int *pos, int *size, char *add,
- int min_width, int max_width, char padding,
- int alignment, int len)
-{
- register int npad = min_width - MIN(len,(max_width?max_width:len));
-
- if (npad<0) {
- npad=0;
- }
-
- PRINTF_DEBUG(("sprintf: appendstring(%x, %d, %d, \"%s\", %d, '%c', %d)\n",
- *buffer, *pos, *size, add, min_width, padding, alignment));
- if (max_width == 0) {
- max_width = MAX(min_width,len);
- }
- if ((*pos + max_width) >= *size) {
- while ((*pos + max_width) >= *size) {
- *size <<= 1;
- }
- PRINTF_DEBUG(("sprintf ereallocing buffer to %d bytes\n", *size));
- *buffer = erealloc(*buffer, *size);
- }
- if (alignment == ALIGN_RIGHT) {
- while (npad-- > 0) {
- (*buffer)[(*pos)++] = padding;
- }
- }
- PRINTF_DEBUG(("sprintf: appending \"%s\"\n", add));
- strncpy(&(*buffer)[*pos], add, max_width);
- *pos += MIN(max_width,len);
- if (alignment == ALIGN_LEFT) {
- while (npad--) {
- (*buffer)[(*pos)++] = padding;
- }
- }
-}
-
-
-inline static void
-_php3_sprintf_appendint(char **buffer, int *pos, int *size, int number,
- int width, char padding, int alignment)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned int magn, nmagn, i = NUM_BUF_SIZE - 1, neg = 0;
-
- PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
- *buffer, pos, size, number, width, padding, alignment));
- if (number < 0) {
- neg = 1;
- magn = ((unsigned int) -(number + 1)) + 1;
- } else {
- magn = (unsigned int) number;
- }
-
- numbuf[i] = '\0';
-
- do {
- nmagn = magn / 10;
-
- numbuf[--i] = (magn - (nmagn * 10)) + '0';
- magn = nmagn;
- }
- while (magn > 0 && i > 0);
- if (neg) {
- numbuf[--i] = '-';
- }
- PRINTF_DEBUG(("sprintf: appending %d as \"%s\", i=%d\n",
- number, &numbuf[i], i));
- _php3_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i);
-}
-
-
-inline static void
-_php3_sprintf_appenddouble(char **buffer, int *pos,
- int *size, double number,
- int width, char padding,
- int alignment, int precision,
- int adjust, char fmt)
-{
- char numbuf[NUM_BUF_SIZE];
- char *cvt;
- register int i = 0, j = 0;
- int sign, decpt;
-
- PRINTF_DEBUG(("sprintf: appenddouble(%x, %x, %x, %f, %d, '%c', %d, %c)\n",
- *buffer, pos, size, number, width, padding, alignment, fmt));
- if ((adjust & ADJ_PRECISION) == 0) {
- precision = FLOAT_PRECISION;
- } else if (precision > MAX_FLOAT_PRECISION) {
- precision = MAX_FLOAT_PRECISION;
- }
- cvt = _php3_cvt(number, precision, &decpt, &sign, (fmt == 'e'));
-
- if (sign) {
- numbuf[i++] = '-';
- }
-
- if (fmt == 'f') {
- if (decpt <= 0) {
- numbuf[i++] = '0';
- if (precision > 0) {
- int k = precision;
- numbuf[i++] = '.';
- while ((decpt++ < 0) && k--) {
- numbuf[i++] = '0';
- }
- }
- } else {
- while (decpt-- > 0)
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = '.';
- }
- } else {
- numbuf[i++] = cvt[j++];
- if (precision > 0)
- numbuf[i++] = '.';
- }
-
- while (cvt[j]) {
- numbuf[i++] = cvt[j++];
- }
-
- numbuf[i] = '\0';
-
- if (precision > 0) {
- width += (precision + 1);
- }
- _php3_sprintf_appendstring(buffer, pos, size, numbuf, width, 0, padding,
- alignment, i);
-}
-
-
-inline static void
-_php3_sprintf_append2n(char **buffer, int *pos, int *size, int number,
- int width, char padding, int alignment, int n,
- char *chartable)
-{
- char numbuf[NUM_BUF_SIZE];
- register unsigned int num, i = NUM_BUF_SIZE - 1, neg = 0;
- register int andbits = (1 << n) - 1;
-
- PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
- *buffer, pos, size, number, width, padding, alignment, n,
- chartable));
- PRINTF_DEBUG(("sprintf: append2n 2^%d andbits=%x\n", n, andbits));
-
- if (number < 0) {
- neg = 1;
- num = ((unsigned int) -(number + 1)) + 1;
- } else {
- num = (unsigned int) number;
- }
-
- numbuf[i] = '\0';
-
- do {
- numbuf[--i] = chartable[(num & andbits)];
- num >>= n;
- }
- while (num > 0);
-
- if (neg) {
- numbuf[--i] = '-';
- }
- _php3_sprintf_appendstring(buffer, pos, size, &numbuf[i], width, 0,
- padding, alignment, (NUM_BUF_SIZE - 1) - i);
-}
-
-
-inline static int
-_php3_sprintf_getnumber(char *buffer, int *pos)
-{
- char *endptr;
- register int num = strtol(&buffer[*pos], &endptr, 10);
- register int i = 0;
-
- if (endptr != NULL) {
- i = (endptr - &buffer[*pos]);
- }
- PRINTF_DEBUG(("sprintf_getnumber: number was %d bytes long\n", i));
- *pos += i;
- return num;
-}
-
-
-/*
- * New sprintf implementation for PHP.
- *
- * Modifiers:
- *
- * " " pad integers with spaces
- * "-" left adjusted field
- * n field size
- * "."n precision (floats only)
- *
- * Type specifiers:
- *
- * "%" literal "%", modifiers are ignored.
- * "b" integer argument is printed as binary
- * "c" integer argument is printed as a single character
- * "d" argument is an integer
- * "f" the argument is a float
- * "o" integer argument is printed as octal
- * "s" argument is a string
- * "x" integer argument is printed as lowercase hexadecimal
- * "X" integer argument is printed as uppercase hexadecimal
- *
- */
-static char *
-php3_formatted_print(int ht, int *len)
-{
- pval **args;
- int argc, size = 240, inpos = 0, outpos = 0;
- int alignment, width, precision, currarg, adjusting;
- char *format, *result, padding;
-
- argc = ARG_COUNT(ht);
-
- if (argc < 1) {
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
- args = emalloc(argc * sizeof(pval *));
-
- if (getParametersArray(ht, argc, args) == FAILURE) {
- efree(args);
- WRONG_PARAM_COUNT_WITH_RETVAL(NULL);
- }
- convert_to_string(args[0]);
- format = args[0]->value.str.val;
- result = emalloc(size);
-
- currarg = 1;
-
- while (format[inpos]) {
- PRINTF_DEBUG(("sprintf: format[%d]='%c'\n", inpos, format[inpos]));
- PRINTF_DEBUG(("sprintf: outpos=%d\n", outpos));
- if (format[inpos] != '%') {
- _php3_sprintf_appendchar(&result, &outpos, &size, format[inpos++]);
- } else if (format[inpos + 1] == '%') {
- _php3_sprintf_appendchar(&result, &outpos, &size, '%');
- inpos += 2;
- } else {
- if (currarg >= argc && format[inpos + 1] != '%') {
- efree(result);
- efree(args);
- php3_error(E_WARNING, "%s(): too few arguments",get_active_function_name());
- return NULL;
- }
- /* starting a new format specifier, reset variables */
- alignment = ALIGN_RIGHT;
- adjusting = 0;
- padding = ' ';
- inpos++; /* skip the '%' */
-
- PRINTF_DEBUG(("sprintf: first looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- if (isascii((int)format[inpos]) && !isalpha((int)format[inpos])) {
- /* first look for modifiers */
- PRINTF_DEBUG(("sprintf: looking for modifiers\n"
- "sprintf: now looking at '%c', inpos=%d\n",
- format[inpos], inpos));
- for (;; inpos++) {
- if (format[inpos] == ' ' || format[inpos] == '0') {
- padding = format[inpos];
- } else if (format[inpos] == '-') {
- alignment = ALIGN_LEFT;
- /* space padding, the default */
- } else if (format[inpos] == '\'') {
- padding = format[++inpos];
- } else {
- PRINTF_DEBUG(("sprintf: end of modifiers\n"));
- break;
- }
- }
- PRINTF_DEBUG(("sprintf: padding='%c'\n", padding));
- PRINTF_DEBUG(("sprintf: alignment=%s\n",
- (alignment == ALIGN_LEFT) ? "left" : "right"));
-
-
- /* after modifiers comes width */
- if (isdigit((int)format[inpos])) {
- PRINTF_DEBUG(("sprintf: getting width\n"));
- width = _php3_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_WIDTH;
- } else {
- width = 0;
- }
- PRINTF_DEBUG(("sprintf: width=%d\n", width));
-
- /* after width comes precision */
- if (format[inpos] == '.') {
- inpos++;
- PRINTF_DEBUG(("sprintf: getting precision\n"));
- if (isdigit((int)format[inpos])) {
- precision = _php3_sprintf_getnumber(format, &inpos);
- adjusting |= ADJ_PRECISION;
- } else {
- precision = 0;
- }
- } else {
- precision = 0;
- }
- PRINTF_DEBUG(("sprintf: precision=%d\n", precision));
- } else {
- width = precision = 0;
- }
-
- if (format[inpos] == 'l') {
- inpos++;
- }
- PRINTF_DEBUG(("sprintf: format character='%c'\n", format[inpos]));
- /* now we expect to find a type specifier */
- switch (format[inpos]) {
- case 's':
- convert_to_string(args[currarg]);
- _php3_sprintf_appendstring(&result, &outpos, &size,
- args[currarg]->value.str.val,
- width, precision, padding,
- alignment,
- args[currarg]->value.str.len);
- break;
-
- case 'd':
- convert_to_long(args[currarg]);
- _php3_sprintf_appendint(&result, &outpos, &size,
- args[currarg]->value.lval,
- width, padding, alignment);
- break;
-
- case 'e':
- case 'f':
- /* XXX not done */
- convert_to_double(args[currarg]);
- _php3_sprintf_appenddouble(&result, &outpos, &size,
- args[currarg]->value.dval,
- width, padding, alignment,
- precision, adjusting,
- format[inpos]);
- break;
-
- case 'c':
- convert_to_long(args[currarg]);
- _php3_sprintf_appendchar(&result, &outpos, &size,
- (char) args[currarg]->value.lval);
- break;
-
- case 'o':
- convert_to_long(args[currarg]);
- _php3_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
- width, padding, alignment, 3,
- hexchars);
- break;
-
- case 'x':
- convert_to_long(args[currarg]);
- _php3_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
- width, padding, alignment, 4,
- hexchars);
- break;
-
- case 'X':
- convert_to_long(args[currarg]);
- _php3_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
- width, padding, alignment, 4,
- HEXCHARS);
- break;
-
- case 'b':
- convert_to_long(args[currarg]);
- _php3_sprintf_append2n(&result, &outpos, &size,
- args[currarg]->value.lval,
- width, padding, alignment, 1,
- hexchars);
- break;
-
- case '%':
- _php3_sprintf_appendchar(&result, &outpos, &size, '%');
-
- break;
- default:
- break;
- }
- currarg++;
- inpos++;
- }
- }
-
- efree(args);
-
- /* possibly, we have to make sure we have room for the terminating null? */
- result[outpos]=0;
- *len = outpos;
- return result;
-}
-
-
-PHP_FUNCTION(user_sprintf)
-{
- char *result;
- int len;
- TLS_VARS;
-
- if ((result=php3_formatted_print(ht,&len))==NULL) {
- RETURN_FALSE;
- }
- RETVAL_STRINGL(result,len,1);
- efree(result);
-}
-
-
-PHP_FUNCTION(user_printf)
-{
- char *result;
- int len;
- TLS_VARS;
-
- if ((result=php3_formatted_print(ht,&len))==NULL) {
- RETURN_FALSE;
- }
- PHPWRITE(result,len);
- efree(result);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
deleted file mode 100644
index b664f03afb..0000000000
--- a/ext/standard/fsock.c
+++ /dev/null
@@ -1,478 +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: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
-*/
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef WIN32
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#endif
-#ifdef WIN32
-#undef AF_UNIX
-#endif
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include "base64.h"
-#include "file.h"
-#include "functions/post.h"
-#include "url.h"
-#include "fsock.h"
-
-#ifndef THREAD_SAFE
-extern int le_fp;
-#endif
-
-#define FREE_SOCK if(socketd >= 0) close(socketd); efree(sock); if (key) efree(key)
-
-#if WIN32|WINNT
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#else
-#include "build-defs.h"
-#endif
-
-static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE };
-
-function_entry fsock_functions[] = {
- PHP_FE(fsockopen, third_and_fourth_args_force_ref)
- PHP_FE(pfsockopen, third_and_fourth_args_force_ref)
- {NULL, NULL, NULL}
-};
-
-struct php3i_sockbuf {
- int socket;
- char *readbuf;
- size_t readbuflen;
- size_t readpos;
- size_t writepos;
- struct php3i_sockbuf *next;
-};
-
-static struct php3i_sockbuf *phpsockbuf;
-
-static int php3_minit_fsock(INIT_FUNC_ARGS);
-static int php3_mshutdown_fsock(SHUTDOWN_FUNC_ARGS);
-static int php3_rshutdown_fsock(SHUTDOWN_FUNC_ARGS);
-
-php3_module_entry fsock_module_entry = {
- "Socket functions", fsock_functions, php3_minit_fsock, php3_mshutdown_fsock, NULL, php3_rshutdown_fsock, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-#ifndef THREAD_SAFE
-static HashTable ht_keys;
-static HashTable ht_socks;
-#endif
-
-/* {{{ lookup_hostname */
-
-/*
- * Converts a host name to an IP address.
- */
-int lookup_hostname(const char *addr, struct in_addr *in)
-{
- struct hostent *host_info;
-
- if(!inet_aton(addr, in)) {
- host_info = gethostbyname(addr);
- if (host_info == 0) {
- /* Error: unknown host */
- return -1;
- }
- *in = *((struct in_addr *) host_info->h_addr);
- }
- return 0;
-}
-/* }}} */
-/* {{{ _php3_is_persistent_sock */
-
-int _php3_is_persistent_sock(int sock)
-{
- char *key;
-
- if (_php3_hash_find(&ht_socks, (char *) &sock, sizeof(sock),
- (void **) &key) == SUCCESS) {
- return 1;
- }
- return 0;
-}
-/* }}} */
-/* {{{ _php3_fsockopen() */
-
-/*
- This function takes an optional third argument which should be
- passed by reference. The error code from the connect call is written
- to this variable.
-*/
-static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
- pval *args[4];
- int *sock=emalloc(sizeof(int));
- int *sockp;
- int id, arg_count=ARG_COUNT(ht);
- int socketd = -1;
- unsigned short portno;
- char *key = NULL;
- TLS_VARS;
-
- if (arg_count > 4 || arg_count < 2 || getParametersArray(ht,arg_count,args)==FAILURE) {
- FREE_SOCK;
- WRONG_PARAM_COUNT;
- }
- switch(arg_count) {
- case 4:
- if(!ParameterPassedByReference(ht,4)) {
- php3_error(E_WARNING,"error string argument to fsockopen not passed by reference");
- }
- pval_copy_constructor(args[3]);
- args[3]->value.str.val = empty_string;
- args[3]->value.str.len = 0;
- args[3]->type = IS_STRING;
- /* fall-through */
- case 3:
- if(!ParameterPassedByReference(ht,3)) {
- php3_error(E_WARNING,"error argument to fsockopen not passed by reference");
- }
- args[2]->type = IS_LONG;
- args[2]->value.lval = 0;
- break;
- }
- convert_to_string(args[0]);
- convert_to_long(args[1]);
- portno = (unsigned short) args[1]->value.lval;
-
- key = emalloc(args[0]->value.str.len + 10);
- sprintf(key, "%s:%d", args[0]->value.str.val, portno);
-
- if (persistent && _php3_hash_find(&ht_keys, key, strlen(key) + 1,
- (void *) &sockp) == SUCCESS) {
- efree(key);
- *sock = *sockp;
- RETURN_LONG(php3_list_insert(sock, GLOBAL(wsa_fp)));
- }
-
- if (portno) {
- struct sockaddr_in server;
-
- memset(&server, 0, sizeof(server));
- socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (socketd == SOCK_ERR) {
- FREE_SOCK;
- RETURN_FALSE;
- }
-
- server.sin_family = AF_INET;
-
- if (lookup_hostname(args[0]->value.str.val, &server.sin_addr)) {
- FREE_SOCK;
- RETURN_FALSE;
- }
-
- server.sin_port = htons(portno);
-
- if (connect(socketd, (struct sockaddr *)&server, sizeof(server)) == SOCK_CONN_ERR) {
- FREE_SOCK;
- if(arg_count>2) args[2]->value.lval = errno;
- if(arg_count>3) {
- args[3]->value.str.val = estrdup(strerror(errno));
- args[3]->value.str.len = strlen(args[3]->value.str.val);
- }
- RETURN_FALSE;
- }
-#if defined(AF_UNIX)
- } else {
- /* Unix domain socket. s->strval is socket name. */
- struct sockaddr_un unix_addr;
- socketd = socket(AF_UNIX,SOCK_STREAM,0);
- if (socketd == SOCK_ERR) {
- FREE_SOCK;
- RETURN_FALSE;
- }
-
- memset(&unix_addr,(char)0,sizeof(unix_addr));
- unix_addr.sun_family = AF_UNIX;
- strcpy(unix_addr.sun_path, args[0]->value.str.val);
-
- if (connect(socketd, (struct sockaddr *) &unix_addr, sizeof(unix_addr)) == SOCK_CONN_ERR) {
- FREE_SOCK;
- if(arg_count>2) args[2]->value.lval = errno;
- if(arg_count>3) {
- args[3]->value.str.val = estrdup(strerror(errno));
- args[3]->value.str.len = strlen(args[3]->value.str.val);
- }
- RETURN_FALSE;
- }
-#endif /* AF_UNIX */
- }
-
-#if 0
- if ((fp = fdopen (socketd, "r+")) == NULL){
- RETURN_LONG(-6); /* FIXME */
- }
-
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0){
- RETURN_LONG(-7); /* FIXME */
- }
-#endif
-#endif
-
- *sock=socketd;
- if (persistent) {
- _php3_hash_update(&ht_keys, key, strlen(key) + 1,
- sock, sizeof(*sock), NULL);
- _php3_hash_update(&ht_socks, (char *) sock, sizeof(*sock),
- key, strlen(key) + 1, NULL);
- }
- if(key) efree(key);
- id = php3_list_insert(sock,GLOBAL(wsa_fp));
- RETURN_LONG(id);
-}
-/* }}} */
-
-/* {{{ proto int fsockopen(string hostname, int port [, int errno [, string errstr]])
- Open Internet or Unix domain socket connection */
-PHP_FUNCTION(fsockopen)
-{
- _php3_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-/* {{{ proto int pfsockopen(string hostname, int port [, int errno [, string errstr]])
- Open persistent Internet or Unix domain socket connection */
-PHP_FUNCTION(pfsockopen)
-{
- _php3_fsockopen(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
-}
-/* }}} */
-
-/* Known issues with the socket buffering code:
- * - does not work reliably with persistent sockets yet
- * (buffered data is not persistent)
- * - php3_fopen_url_wrapper() is still doing single-byte lookahead/read
- */
-/* {{{ _php3_sock_fgets() */
-
-int _php3_sock_fgets(char *buf, int maxlen, int socket)
-{
- struct php3i_sockbuf *sockbuf = NULL, *tmpsockbuf;
- int bytesread, toread, len, buflen, count = 0;
- char *nl;
-
- tmpsockbuf = phpsockbuf;
- while (tmpsockbuf) {
- if (tmpsockbuf->socket == socket) {
- sockbuf = tmpsockbuf;
- break;
- }
- tmpsockbuf = tmpsockbuf->next;
- }
-
- if (sockbuf) {
- toread = sockbuf->writepos - sockbuf->readpos;
- if (toread > maxlen) {
- toread = maxlen;
- }
- if ((nl = memchr(sockbuf->readbuf + sockbuf->readpos, '\n', toread)) != NULL) {
- toread = (nl - (sockbuf->readbuf + sockbuf->readpos)) + 1;
- }
- memcpy(buf, sockbuf->readbuf + sockbuf->readpos, toread);
- sockbuf->readpos += toread;
- count += toread;
- buf += toread;
- if (sockbuf->readpos >= sockbuf->writepos) {
- sockbuf->readpos = sockbuf->writepos = 0;
- }
- if (nl != NULL) {
- /* if a newline was found, skip the recv() loop */
- goto sock_fgets_exit;
- }
- }
-
- nl = NULL;
- buflen = 0;
- while (count < maxlen && nl == NULL) {
- toread = maxlen - count;
- bytesread = recv(socket, buf, toread, 0);
- if (bytesread <= 0) {
- break;
- }
- if ((nl = memchr(buf, '\n', bytesread)) != NULL) {
- len = (nl - buf) + 1;
- count += len;
- buf += len;
- if (len < bytesread) {
- buflen = bytesread - len;
- break;
- }
- } else {
- count += bytesread;
- buf += bytesread;
- }
- }
-
- if (buflen > 0) { /* there was data after the "\n" ... */
- if (sockbuf == NULL) {
- sockbuf = emalloc(sizeof(struct php3i_sockbuf));
- sockbuf->socket = socket;
- sockbuf->readbuf = emalloc(maxlen);
- sockbuf->readbuflen = maxlen;
- sockbuf->readpos = sockbuf->writepos = 0;
- sockbuf->next = phpsockbuf;
- phpsockbuf = sockbuf;
- } else {
- uint needlen = sockbuf->writepos + buflen;
-
- if (needlen > sockbuf->readbuflen) {
- sockbuf->readbuflen += maxlen;
- sockbuf->readbuf = erealloc(sockbuf->readbuf, sockbuf->readbuflen);
- }
- }
- memcpy(sockbuf->readbuf + sockbuf->writepos, buf, buflen);
- sockbuf->writepos += buflen;
- }
-
- sock_fgets_exit:
- *buf = '\0';
- return count;
-}
-
-/* }}} */
-/* {{{ _php3_sock_fread() */
-
-int _php3_sock_fread(char *buf, int maxlen, int socket)
-{
- struct php3i_sockbuf *sockbuf = phpsockbuf;
- int bytesread, toread, count = 0;
-
- while (sockbuf) {
- if (sockbuf->socket == socket) {
- toread = sockbuf->writepos - sockbuf->readpos;
- if (toread > maxlen) {
- toread = maxlen;
- }
- memcpy(buf, sockbuf->readbuf + sockbuf->readpos, toread);
- sockbuf->readpos += toread;
- count += toread;
- buf += toread;
- break;
- }
- sockbuf = sockbuf->next;
- }
-
- while (count < maxlen) {
- toread = maxlen - count;
- bytesread = recv(socket, buf, toread, 0);
- if (bytesread <= 0) {
- break;
- }
- count += bytesread;
- buf += bytesread;
- }
-
- *buf = '\0';
- return count;
-}
-
-/* }}} */
-/* {{{ module start/shutdown functions */
-
- /* {{{ _php3_sock_destroy */
-#ifndef THREAD_SAFE
-static void _php3_sock_destroy(void *data)
-{
- int *sock = (int *) data;
- close(*sock);
-}
-#endif
-/* }}} */
- /* {{{ php3_minit_fsock */
-
-static int php3_minit_fsock(INIT_FUNC_ARGS)
-{
-#ifndef THREAD_SAFE
- _php3_hash_init(&ht_keys, 0, NULL, NULL, 1);
- _php3_hash_init(&ht_socks, 0, NULL, _php3_sock_destroy, 1);
-#endif
- return SUCCESS;
-}
-/* }}} */
- /* {{{ php3_mshutdown_fsock */
-
-static int php3_mshutdown_fsock(SHUTDOWN_FUNC_ARGS)
-{
-#ifndef THREAD_SAFE
- _php3_hash_destroy(&ht_socks);
- _php3_hash_destroy(&ht_keys);
-#endif
- return SUCCESS;
-}
-/* }}} */
- /* {{{ php3_rshutdown_fsock() */
-
-static int php3_rshutdown_fsock(SHUTDOWN_FUNC_ARGS)
-{
- struct php3i_sockbuf *sockbuf = phpsockbuf, *this;
-
- while (sockbuf) {
- this = sockbuf;
- sockbuf = this->next;
- efree(this->readbuf);
- efree(this);
- }
- phpsockbuf = NULL;
- return SUCCESS;
-}
-
-/* }}} */
-
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/fsock.h b/ext/standard/fsock.h
deleted file mode 100644
index f58da7fdeb..0000000000
--- a/ext/standard/fsock.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. |
- +----------------------------------------------------------------------+
- | Authors: Paul Panotzki - Bunyip Information Systems |
- | Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
-*/
-/* $Id$ */
-
-#ifndef _FSOCK_H
-#define _FSOCK_H
-
-#if WIN32|WINNT
-# ifndef WINNT
-# define WINNT 1
-# endif
-#undef FD_SETSIZE
-#include "arpa/inet.h"
-#endif
-
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-extern php3_module_entry fsock_module_entry;
-#define fsock_module_ptr &fsock_module_entry
-
-extern PHP_FUNCTION(fsockopen);
-extern PHP_FUNCTION(pfsockopen);
-extern int lookup_hostname(const char *addr, struct in_addr *in);
-extern int _php3_sock_fgets(char *buf, int maxlen, int socket);
-extern int _php3_sock_fread(char *buf, int maxlen, int socket);
-extern int _php3_is_persistent_sock(int);
-
-#endif /* _FSOCK_H */
diff --git a/ext/standard/global.h b/ext/standard/global.h
deleted file mode 100644
index cc528d4b6b..0000000000
--- a/ext/standard/global.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: Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* GLOBAL.H - RSAREF types and constants
- */
-
-/* PROTOTYPES should be set to one if and only if the compiler supports
- function argument prototyping.
- The following makes PROTOTYPES default to 0 if it has not already
- been defined with C compiler flags.
- */
-#ifndef PROTOTYPES
-#define PROTOTYPES 1 /* php3 has prototypes everywhere */
-#endif
-
-/* _POINTER defines a generic pointer type */
-typedef unsigned char *_POINTER;
-
-/* UINT2 defines a two byte word */
-typedef unsigned short int UINT2;
-
-/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
-
-/* PROTO_LIST is defined depending on how PROTOTYPES is defined above.
- If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it
- returns an empty list.
- */
-#if PROTOTYPES
-#define PROTO_LIST(list) list
-#else
-#define PROTO_LIST(list) ()
-#endif
diff --git a/ext/standard/html.c b/ext/standard/html.c
deleted file mode 100644
index f15131523d..0000000000
--- a/ext/standard/html.c
+++ /dev/null
@@ -1,134 +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 <rasmus@lerdorf.on.ca> |
- | Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "reg.h"
-#include "html.h"
-
-/* This must be fixed to handle the input string according to LC_CTYPE.
- Defaults to ISO-8859-1 for now. */
-
-static char EntTable[][7] =
-{
- "nbsp","iexcl","cent","pound","curren","yen","brvbar",
- "sect","uml","copy","ordf","laquo","not","shy","reg",
- "macr","deg","plusmn","sup2","sup3","acute","micro",
- "para","middot","cedil","sup1","ordm","raquo","frac14",
- "frac12","frac34","iquest","Agrave","Aacute","Acirc",
- "Atilde","Auml","Aring","AElig","Ccedil","Egrave",
- "Eacute","Ecirc","Euml","Igrave","Iacute","Icirc",
- "Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde",
- "Ouml","times","Oslash","Ugrave","Uacute","Ucirc","Uuml",
- "Yacute","THORN","szlig","agrave","aacute","acirc",
- "atilde","auml","aring","aelig","ccedil","egrave",
- "eacute","ecirc","euml","igrave","iacute","icirc",
- "iuml","eth","ntilde","ograve","oacute","ocirc","otilde",
- "ouml","divide","oslash","ugrave","uacute","ucirc",
- "uuml","yacute","thorn","yuml"
-};
-
-static void _php3_htmlentities(INTERNAL_FUNCTION_PARAMETERS, int all)
-{
- pval *arg;
- int i, len, maxlen;
- unsigned char *old;
- char *new;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg);
-
- maxlen = 2 * arg->value.str.len;
- if (maxlen < 128)
- maxlen = 128;
- new = emalloc (maxlen);
- len = 0;
-
- old = (unsigned char *)arg->value.str.val;
- i = arg->value.str.len;
- while (i--) {
- if (len + 9 > maxlen)
- new = erealloc (new, maxlen += 128);
- if (38 == *old) {
- memcpy (new + len, "&amp;", 5);
- len += 5;
- } else if (34 == *old) {
- memcpy (new + len, "&quot;", 6);
- len += 6;
- } else if (60 == *old) {
- memcpy (new + len, "&lt;", 4);
- len += 4;
- } else if (62 == *old) {
- memcpy (new + len, "&gt;", 4);
- len += 4;
- } else if (all && 160 <= *old) {
- new [len++] = '&';
- strcpy (new + len, EntTable [*old - 160]);
- len += strlen (EntTable [*old - 160]);
- new [len++] = ';';
- } else {
- new [len++] = *old;
- }
- old++;
- }
- new [len] = '\0';
-
- RETVAL_STRINGL(new,len,1);
- efree(new);
-}
-
-/* {{{ proto string htmlspecialchars(string string)
- Convert special characters to HTML entities */
-void php3_htmlspecialchars(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_htmlentities(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto string htmlentities(string string)
- Convert all applicable characters to HTML entities */
-void php3_htmlentities(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_htmlentities(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/html.h b/ext/standard/html.h
deleted file mode 100644
index 892dfb6bed..0000000000
--- a/ext/standard/html.h
+++ /dev/null
@@ -1,38 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _HTML_H
-#define _HTML_H
-
-extern void php3_htmlspecialchars(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_htmlentities(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _HTML_H */
diff --git a/ext/standard/image.c b/ext/standard/image.c
deleted file mode 100644
index a91607f3e7..0000000000
--- a/ext/standard/image.c
+++ /dev/null
@@ -1,386 +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$ */
-/*
- * Based on Daniel Schmitt's imageinfo.c which carried the following
- * Copyright notice.
- */
-
-/*
- * imageinfo.c
- *
- * Simple routines to extract image width/height data from GIF/JPEG files.
- *
- * Copyright (c) 1997 Daniel Schmitt, opal online publishing, Bonn, Germany.
- *
- * Includes code snippets from rdjpgcom.c,
- * Copyright (c) 1994-1995 Thomas G. Lane
- * from release 6a of the Independent JPEG Group's software.
- *
- * Legal status: see GNU General Public License version 2 or later.
- *
- */
-
-#include "php.h"
-#include <stdio.h>
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include "fopen-wrappers.h"
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include "image.h"
-
-/* file type markers */
-const char php3_sig_gif[3] =
-{'G', 'I', 'F'};
-const char php3_sig_jpg[3] =
-{(char) 0xff, (char) 0xd8, (char) 0xff};
-const char php3_sig_png[8] =
-{(char) 0x89, (char) 0x50, (char) 0x4e,
- (char) 0x47, (char) 0x0d, (char) 0x0a,
- (char) 0x1a, (char) 0x0a};
-
-/* return info as a struct, to make expansion easier */
-
-struct gfxinfo {
- unsigned int width;
- unsigned int height;
-};
-
-/* routine to handle GIF files. If only everything were that easy... ;} */
-static struct gfxinfo *php3_handle_gif (FILE *fp)
-{
- struct gfxinfo *result = NULL;
- unsigned char a[2];
-
- result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo));
- fseek(fp, 6L, SEEK_SET);
- fread(a,sizeof(a),1,fp);
- result->width = (unsigned short)a[0] | (((unsigned short)a[1])<<8);
- fread(a,sizeof(a),1,fp);
- result->height = (unsigned short)a[0] | (((unsigned short)a[1])<<8);
- return result;
-}
-
-static unsigned long php3_read4(FILE *fp)
-{
- unsigned char a[ 4 ];
-
- /* just return 0 if we hit the end-of-file */
- if (fread(a,sizeof(a),1,fp) != 1) return 0;
-
- return (((unsigned long) a[ 0 ]) << 24) + (((unsigned long) a[ 1 ]) << 16) + (((unsigned long) a[ 2 ]) << 8) + ((unsigned long) a[ 3 ]);
-
-}
-
-/* routine to handle PNG files. - even easier */
-static struct gfxinfo *php3_handle_png(FILE *fp)
-{
- struct gfxinfo *result = NULL;
- unsigned long in_width, in_height;
-
- result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo));
- fseek(fp, 16L, SEEK_SET);
- in_width = php3_read4(fp);
- in_height = php3_read4(fp);
- result->width = (unsigned int) in_width;
- result->height = (unsigned int) in_height;
- return result;
-}
-
-/* routines to handle JPEG data */
-
-/* some defines for the different JPEG block types */
-#define M_SOF0 0xC0 /* Start Of Frame N */
-#define M_SOF1 0xC1 /* N indicates which compression process */
-#define M_SOF2 0xC2 /* Only SOF0-SOF2 are now in common use */
-#define M_SOF3 0xC3
-#define M_SOF5 0xC5 /* NB: codes C4 and CC are NOT SOF markers */
-#define M_SOF6 0xC6
-#define M_SOF7 0xC7
-#define M_SOF9 0xC9
-#define M_SOF10 0xCA
-#define M_SOF11 0xCB
-#define M_SOF13 0xCD
-#define M_SOF14 0xCE
-#define M_SOF15 0xCF
-#define M_SOI 0xD8
-#define M_EOI 0xD9 /* End Of Image (end of datastream) */
-#define M_SOS 0xDA /* Start Of Scan (begins compressed data) */
-#define M_APP0 0xe0
-#define M_APP1 0xe1
-#define M_APP2 0xe2
-#define M_APP3 0xe3
-#define M_APP4 0xe4
-#define M_APP5 0xe5
-#define M_APP6 0xe6
-#define M_APP7 0xe7
-#define M_APP8 0xe8
-#define M_APP9 0xe9
-#define M_APP10 0xea
-#define M_APP11 0xeb
-#define M_APP12 0xec
-#define M_APP13 0xed
-#define M_APP14 0xee
-#define M_APP15 0xef
-
-static unsigned short php3_read2(FILE *fp)
-{
- unsigned char a[ 2 ];
-
- /* just return 0 if we hit the end-of-file */
- if (fread(a,sizeof(a),1,fp) != 1) return 0;
-
- return (((unsigned short) a[ 0 ]) << 8) + ((unsigned short) a[ 1 ]);
-}
-
-static unsigned int php3_next_marker(FILE *fp)
- /* get next marker byte from file */
-{
- int c;
-
- /* skip unimportant stuff */
-
- c = getc(fp);
-
- while (c != 0xff) {
- if ((c = getc(fp)) == EOF)
- return M_EOI; /* we hit EOF */
- }
-
- /* get marker byte, swallowing possible padding */
- do {
- if ((c = getc(fp)) == EOF)
- return M_EOI; /* we hit EOF */
- } while (c == 0xff);
-
- return (unsigned int) c;
-}
-
-static void php3_skip_variable(FILE *fp)
- /* skip over a variable-length block; assumes proper length marker */
-{
- unsigned short length;
-
- length = php3_read2(fp);
- length -= 2; /* length includes itself */
- fseek(fp, (long) length, SEEK_CUR); /* skip the header */
-}
-
-static void php3_read_APP(FILE *fp,unsigned int marker,pval *info)
-{
- unsigned short length;
- unsigned char *buffer;
- unsigned char markername[ 16 ];
-
- length = php3_read2(fp);
- length -= 2; /* length includes itself */
-
- buffer = emalloc(length);
-
- if (fread(buffer,length,1,fp) != 1) {
- return;
- }
-
- sprintf(markername,"APP%d",marker - M_APP0);
-
- add_assoc_stringl(info,markername,buffer,length,1);
-
- efree(buffer);
-}
-
-static struct gfxinfo *php3_handle_jpeg(FILE *fp,pval *info)
- /* main loop to parse JPEG structure */
-{
- struct gfxinfo *result = NULL;
- unsigned int marker;
- unsigned short in_width, in_height;
-
- fseek(fp, 0L, SEEK_SET); /* position file pointer on SOF */
-
- if (getc(fp) != 0xFF) /* JPEG header... */
- return NULL;
-
- if (getc(fp) != M_SOI) /* JPEG header... */
- return NULL;
-
- for (;;) {
- marker = php3_next_marker(fp);
- switch (marker) {
- case M_SOF0:
- case M_SOF1:
- case M_SOF2:
- case M_SOF3:
- case M_SOF5:
- case M_SOF6:
- case M_SOF7:
- case M_SOF9:
- case M_SOF10:
- case M_SOF11:
- case M_SOF13:
- case M_SOF14:
- case M_SOF15:
- if (result == NULL) {
- /* handle SOFn block */
- fseek(fp, 3L, SEEK_CUR); /* skip length and precision bytes */
- in_height = php3_read2(fp);
- in_width = php3_read2(fp);
- /* fill a gfxinfo struct to return the data */
- result = (struct gfxinfo *) emalloc(sizeof(struct gfxinfo));
-
- result->width = (unsigned int) in_width;
- result->height = (unsigned int) in_height;
-
- if (! info) /* if we don't want an extanded info -> return */
- return result;
- } else {
- php3_skip_variable(fp);
- }
- break;
-
- case M_APP0:
- case M_APP1:
- case M_APP2:
- case M_APP3:
- case M_APP4:
- case M_APP5:
- case M_APP6:
- case M_APP7:
- case M_APP8:
- case M_APP9:
- case M_APP10:
- case M_APP11:
- case M_APP12:
- case M_APP13:
- case M_APP14:
- case M_APP15:
- if (info) {
- php3_read_APP(fp,marker,info); /* read all the app markes... */
- } else {
- php3_skip_variable(fp);
- }
- break;
-
- case M_SOS:
- case M_EOI:
- return result; /* we're about to hit image data, or are at EOF. stop processing. */
- break;
-
- default:
- php3_skip_variable(fp); /* anything else isn't interesting */
- break;
- }
- }
-
- return NULL;
-}
-
-/* main function */
-void php3_getimagesize(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1,*info = 0;
- FILE *fp;
- int itype = 0;
- char filetype[3];
- char pngtype[8];
- char temp[64];
- struct gfxinfo *result = NULL;
-
- switch(ARG_COUNT(ht)){
- case 1:
- if (getParameters(ht, 1, &arg1) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
- break;
-
- case 2:
- if (getParameters(ht, 2, &arg1, &info) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 2)) {
- php3_error(E_WARNING, "Array to be filled with values must be passed by reference.");
- RETURN_FALSE;
- }
-
- pval_destructor(info _INLINE_TLS);
- if (array_init(info) == FAILURE) {
- return;
- }
-
- convert_to_string(arg1);
- break;
-
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- /* Check open_basedir */
- if (_php3_check_open_basedir(arg1->value.str.val)) return;
-
- if ((fp = fopen(arg1->value.str.val,"rb")) == 0) {
- php3_error(E_WARNING, "Unable to open %s", arg1->value.str.val);
- return;
- }
- fread(filetype,sizeof(filetype),1,fp);
- if (!memcmp(filetype, php3_sig_gif, 3)) {
- result = php3_handle_gif (fp);
- itype = 1;
- } else if (!memcmp(filetype, php3_sig_jpg, 3)) {
- result = php3_handle_jpeg(fp,info);
- itype = 2;
- } else if (!memcmp(filetype, php3_sig_png, 3)) {
- fseek(fp, 0L, SEEK_SET);
- fread(pngtype, sizeof(pngtype), 1, fp);
- if (!memcmp(pngtype, php3_sig_png, 8)) {
- result = php3_handle_png(fp);
- itype = 3;
- } else {
- php3_error(E_WARNING, "PNG file corrupted by ASCII conversion");
- }
- }
- fclose(fp);
- if (result) {
- if (array_init(return_value) == FAILURE) {
- php3_error(E_ERROR, "Unable to initialize array");
- if (result) efree(result);
- return;
- }
- add_index_long(return_value, 0, result->width);
- add_index_long(return_value, 1, result->height);
- add_index_long(return_value, 2, itype);
- sprintf(temp, "width=\"%d\" height=\"%d\"", result->width, result->height); /* safe */
- add_index_string(return_value, 3, temp, 1);
-
- efree(result);
- }
-}
diff --git a/ext/standard/image.h b/ext/standard/image.h
deleted file mode 100644
index f006ceba43..0000000000
--- a/ext/standard/image.h
+++ /dev/null
@@ -1,36 +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 _IMAGE_H
-#define _IMAGE_H
-
-extern void php3_getimagesize(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _IMAGE_H */
diff --git a/ext/standard/info.c b/ext/standard/info.c
deleted file mode 100644
index 8eaf6aa28e..0000000000
--- a/ext/standard/info.c
+++ /dev/null
@@ -1,442 +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 <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "functions/head.h"
-#include "info.h"
-#ifndef MSVC5
-#include "build-defs.h"
-#endif
-#include "zend_globals.h" /* needs ELS */
-
-
-#define PHP3_CONF_STR(directive,value1,value2) \
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">"); \
- PUTS(directive); \
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">&nbsp;"); \
- if (value1) PUTS(value1); \
- else PUTS("<i>none</i>"); \
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">&nbsp;"); \
- if (value2) PUTS(value2); \
- else PUTS("<i>none</i>"); \
- PUTS("</td></tr>\n");
-
-#define PHP3_CONF_LONG(directive,value1,value2) \
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">%s</td><td bgcolor=\"" CONTENTS_COLOR "\">%ld</td><td bgcolor=\"" CONTENTS_COLOR "\">%ld</td></tr>\n",directive,value1,value2);
-
-extern char **environ;
-
-#define SECTION(name) PUTS("<hr><h2>" name "</h2>\n")
-
-#define ENTRY_NAME_COLOR "#999999"
-#define CONTENTS_COLOR "#DDDDDD"
-#define HEADER_COLOR "#00DDDD"
-
-static int _display_module_info(php3_module_entry *module)
-{
- PUTS("<tr><th align=left bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(module->name);
- PUTS("</th><td bgcolor=\"" CONTENTS_COLOR "\">");
- if (module->info_func) {
- module->info_func();
- } else {
- PUTS("No additional information.");
- }
- PUTS("</td></tr>\n");
- return 0;
-}
-
-
-void _php3_info(void)
-{
- char **env,*tmp1,*tmp2;
- char *php3_uname;
-#if WIN32|WINNT
- char php3_windows_uname[256];
- DWORD dwBuild=0;
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-#endif
- ELS_FETCH();
- PLS_FETCH();
-
-
-#if WIN32|WINNT
- // Get build numbers for Windows NT or Win95
- if (dwVersion < 0x80000000){
- dwBuild = (DWORD)(HIWORD(dwVersion));
- snprintf(php3_windows_uname,255,"%s %d.%d build %d","Windows NT",dwWindowsMajorVersion,dwWindowsMinorVersion,dwBuild);
- } else {
- snprintf(php3_windows_uname,255,"%s %d.%d","Windows 95/98",dwWindowsMajorVersion,dwWindowsMinorVersion);
- }
- php3_uname = php3_windows_uname;
-#else
- php3_uname=PHP_UNAME;
-#endif
-
-
- PUTS("<img src=\"");
- /*PUTS(GLOBAL(php3_rqst)->uri);*/
- PUTS("?=PHPE9568F34-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"56\" align=\"right\">\n");
- php3_printf("<center><h1>PHP Version %s</h1></center>\n", PHP_VERSION);
- PUTS("<p>by <a href=\"mailto:rasmus@lerdorf.on.ca\">Rasmus Lerdorf</a>,\n");
- PUTS("<a href=\"mailto:andi@zend.com\">Andi Gutmans</a>,\n");
- PUTS("<a href=\"mailto:zeev@zend.com\">Zeev Suraski</a>,\n");
- PUTS("<a href=\"mailto:ssb@guardian.no\">Stig Bakken</a>,\n");
- PUTS("<a href=\"mailto:shane@caraveo.com\">Shane Caraveo</a>,\n");
- PUTS("<a href=\"mailto:jimw@php.net\">Jim Winstead</a>, and countless others.</P>\n");
-
- PUTS("<P><a href=\"http://www.zend.com/\">Zend</a>:</a> ");
- PUTS("<a href=\"mailto:andi@zend.com\">Andi Gutmans</a> and \n");
- PUTS("<a href=\"mailto:zeev@zend.com\">Zeev Suraski</a></p>\n");
-
- PUTS("<hr>");
- php3_printf("<center>System: %s<br>Build Date: %s</center>\n", php3_uname, __DATE__);
- PUTS("<center>\n");
-
- SECTION("Extensions");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Extensions</th><th bgcolor=\"" HEADER_COLOR "\">Additional Information</th></tr>\n");
-
-#ifndef MSVC5
- PUTS("<tr><th align=left bgcolor=\"" ENTRY_NAME_COLOR "\">PHP core</th>\n");
- PUTS("<td bgcolor=\"" CONTENTS_COLOR "\"><tt>CFLAGS=" PHP_CFLAGS "<br>\n");
- PUTS("HSREGEX=" PHP_HSREGEX "</td></tr>\n");
-#endif
-
- _php3_hash_apply(&GLOBAL(module_registry),(int (*)(void *))_display_module_info);
- PUTS("</table>\n");
-
- SECTION("Configuration");
- PUTS("php3.ini file path is set to: ");
- PUTS(CONFIGURATION_FILE_PATH);
- PUTS("<br>\n");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Directive</th><th bgcolor=\"" HEADER_COLOR "\">Master Value</th><th bgcolor=\"" HEADER_COLOR "\">Local Value</th></tr>\n");
- PHP3_CONF_STR("arg_separator", INI_ORIG_STR("arg_separator"), PG(arg_separator));
- PHP3_CONF_LONG("asp_tags", INI_ORIG_INT("asp_tags"), PG(asp_tags));
- PHP3_CONF_STR("auto_prepend_file", INI_ORIG_STR("auto_prepend_file"), PG(auto_prepend_file));
- PHP3_CONF_STR("auto_append_file", INI_ORIG_STR("auto_append_file"), PG(auto_append_file));
- PHP3_CONF_STR("browscap", INI_ORIG_STR("browscap"), INI_STR("browscap"));
- PHP3_CONF_LONG("define_syslog_variables", INI_ORIG_STR("define_syslog_variables"), INI_STR("define_syslog_variables"));
- PHP3_CONF_LONG("display_errors", INI_ORIG_INT("display_errors"), PG(display_errors));
- PHP3_CONF_STR("doc_root", INI_ORIG_STR("doc_root"), PG(doc_root));
- PHP3_CONF_LONG("enable_dl", INI_ORIG_INT("enable_dl"), PG(enable_dl));
- PHP3_CONF_STR("error_log", INI_ORIG_STR("error_log"), PG(error_log));
- PHP3_CONF_STR("error_prepend_string", INI_ORIG_STR("error_prepend_string"), INI_STR("error_prepend_string"));
- PHP3_CONF_STR("error_append_string", INI_ORIG_STR("error_append_string"), INI_STR("error_append_string"));
- PHP3_CONF_LONG("error_reporting", INI_ORIG_INT("error_reporting"), EG(error_reporting));
- PHP3_CONF_STR("extension_dir", INI_ORIG_STR("extension_dir"), PG(extension_dir));
- PHP3_CONF_STR("gpc_order", INI_ORIG_STR("gpc_order"), PG(gpc_order));
- PHP3_CONF_STR("include_path", INI_ORIG_STR("include_path"), PG(include_path));
- PHP3_CONF_LONG("log_errors", INI_ORIG_INT("log_errors"), PG(log_errors));
- PHP3_CONF_LONG("max_execution_time", INI_ORIG_INT("max_execution_time"), PG(max_execution_time));
- PHP3_CONF_LONG("magic_quotes_gpc", INI_ORIG_INT("magic_quotes_gpc"), PG(magic_quotes_gpc));
- PHP3_CONF_LONG("magic_quotes_runtime", INI_ORIG_INT("magic_quotes_runtime"), PG(magic_quotes_runtime));
- PHP3_CONF_LONG("magic_quotes_sybase", INI_ORIG_INT("magic_quotes_sybase"), PG(magic_quotes_sybase));
- PHP3_CONF_LONG("memory limit", INI_ORIG_INT("memory_limit"), PG(memory_limit));
- PHP3_CONF_STR("open_basedir", INI_ORIG_STR("open_basedir"), PG(open_basedir));
- PHP3_CONF_LONG("precision", INI_ORIG_INT("precision"), EG(precision));
- PHP3_CONF_LONG("safe_mode", INI_ORIG_INT("safe_mode"), PG(safe_mode));
- PHP3_CONF_STR("safe_mode_exec_dir", INI_ORIG_STR("safe_mode_exec_dir"), PG(safe_mode_exec_dir));
- PHP3_CONF_STR("sendmail_from", INI_ORIG_STR("sendmail_from"), INI_STR("sendmail_from"));
- PHP3_CONF_STR("sendmail_path", INI_ORIG_STR("sendmail_path"), INI_STR("sendmail_path"));
- PHP3_CONF_LONG("short_open_tag", INI_ORIG_INT("short_open_tag"), PG(short_tags));
- PHP3_CONF_STR("SMTP", INI_ORIG_STR("SMTP"), INI_STR("SMTP"));
- PHP3_CONF_LONG("sql_safe_mode", INI_ORIG_INT("sql.safe_mode"), PG(sql_safe_mode));
- PHP3_CONF_LONG("track_errors", INI_ORIG_INT("track_errors"), PG(track_errors));
- PHP3_CONF_LONG("track_vars", INI_ORIG_INT("track_vars"), PG(track_vars));
- PHP3_CONF_LONG("upload_max_filesize", INI_ORIG_INT("upload_max_filesize"), PG(upload_max_filesize));
- PHP3_CONF_STR("upload_tmp_dir", INI_ORIG_STR("upload_tmp_dir"), PG(upload_tmp_dir));
- PHP3_CONF_STR("user_dir", INI_ORIG_STR("user_dir"), PG(user_dir));
- PHP3_CONF_LONG("y2k_compliance", INI_ORIG_INT("y2k_compliance"), PG(y2k_compliance));
- /* apache only directives */
- PHP3_CONF_LONG("engine", INI_ORIG_INT("engine"), INI_INT("engine")); /* apache only */
- PHP3_CONF_LONG("xbithack", INI_ORIG_INT("xbithack"), INI_INT("xbithack")); /* apache only */
- PHP3_CONF_LONG("last_modified", INI_ORIG_INT("last_modified"), INI_INT("last_modified")); /* apache only */
- /* end of apache only directives */
-
- /* And now for the highlight colours */
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_comment</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.comment"), INI_ORIG_STR("highlight.comment"), INI_STR("highlight.comment"), INI_STR("highlight.comment"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_default</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.default"), INI_ORIG_STR("highlight.default"), INI_STR("highlight.default"), INI_STR("highlight.default"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_html</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.html"), INI_ORIG_STR("highlight.html"), INI_STR("highlight.html"), INI_STR("highlight.html"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_string</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.string"), INI_ORIG_STR("highlight.string"), INI_STR("highlight.string"), INI_STR("highlight.string"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_bg</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.bg"), INI_ORIG_STR("highlight.bg"), INI_STR("highlight.bg"), INI_STR("highlight.bg"));
- php3_printf("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">highlight_keyword</td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td><td bgcolor=\"" CONTENTS_COLOR "\"><font color=%s>&nbsp;%s</font></td></tr>\n",INI_ORIG_STR("highlight.keyword"), INI_ORIG_STR("highlight.keyword"), INI_STR("highlight.keyword"), INI_STR("highlight.keyword"));
- PUTS("</table>");
-
-#if USE_SAPI /* call a server module specific info function */
- GLOBAL(sapi_rqst)->info(GLOBAL(sapi_rqst));
-#endif
-
- SECTION("Environment");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n");
- for (env=environ; env!=NULL && *env !=NULL; env++) {
- tmp1 = estrdup(*env);
- if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
- efree(tmp1);
- continue;
- }
- *tmp2 = 0;
- tmp2++;
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(tmp1);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- if (tmp2 && *tmp2) {
- PUTS(tmp2);
- } else {
- PUTS("&nbsp;");
- }
- PUTS("</td></tr>\n");
- efree(tmp1);
- }
- PUTS("</table>\n");
-
- {
- pval **data, **tmp;
- char *string_key;
- ulong num_key;
-
- SECTION("PHP Variables");
-
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n");
- if (_php3_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_SELF");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
- }
- if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_TYPE");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
- }
- if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_USER");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
- }
- if (_php3_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS("PHP_AUTH_PW");
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*data)->value.str.val);
- PUTS("</td></tr>\n");
- }
- if (_php3_hash_find(&EG(symbol_table), "HTTP_GET_VARS", sizeof("HTTP_GET_VARS"), (void **) &data) != FAILURE) {
- _php3_hash_internal_pointer_reset((*data)->value.ht);
- while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(*tmp);
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP_GET_VARS[\"");
- switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- php3_printf("%ld",num_key);
- break;
- }
- PUTS("\"]</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*tmp)->value.str.val); /* This could be "Array" - too ugly to expand that for now */
- PUTS("</td></tr>\n");
- _php3_hash_move_forward((*data)->value.ht);
- }
- }
- if (_php3_hash_find(&EG(symbol_table), "HTTP_POST_VARS", sizeof("HTTP_POST_VARS"), (void **) &data) != FAILURE) {
- _php3_hash_internal_pointer_reset((*data)->value.ht);
- while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(*tmp);
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP_POST_VARS[\"");
- switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- php3_printf("%ld",num_key);
- break;
- }
- PUTS("\"]</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*tmp)->value.str.val);
- PUTS("</td></tr>\n");
- _php3_hash_move_forward((*data)->value.ht);
- }
- }
- if (_php3_hash_find(&EG(symbol_table), "HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS"), (void **) &data) != FAILURE) {
- _php3_hash_internal_pointer_reset((*data)->value.ht);
- while (_php3_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(*tmp);
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP_COOKIE_VARS[\"");
- switch (_php3_hash_get_current_key((*data)->value.ht, &string_key, &num_key)) {
- case HASH_KEY_IS_STRING:
- PUTS(string_key);
- break;
- case HASH_KEY_IS_LONG:
- php3_printf("%ld",num_key);
- break;
- }
- PUTS("\"]</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS((*tmp)->value.str.val);
- PUTS("</td></tr>\n");
- _php3_hash_move_forward((*data)->value.ht);
- }
- }
- PUTS("</table>\n");
- }
-
-#if APACHE
- {
- register int i;
- array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env);
- table_entry *elts = (table_entry *)arr->elts;
-
- SECTION("Apache Environment");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS("<tr><th bgcolor=\"" HEADER_COLOR "\">Variable</th><th bgcolor=\"" HEADER_COLOR "\">Value</th></tr>\n");
- for (i=0; i < arr->nelts; i++) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(elts[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(elts[i].val);
- PUTS("&nbsp;</td></tr>\n");
- }
- PUTS("</table>\n");
- }
-#endif
-
-#if APACHE
- {
- array_header *env_arr;
- table_entry *env;
- int i;
-
- SECTION("HTTP Headers Information");
- PUTS("<table border=5 width=\"600\">\n");
- PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Request Headers</th></tr>\n");
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">HTTP Request</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(GLOBAL(php3_rqst)->the_request);
- PUTS("&nbsp;</td></tr>\n");
- env_arr = table_elts(GLOBAL(php3_rqst)->headers_in);
- env = (table_entry *)env_arr->elts;
- for (i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(env[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(env[i].val);
- PUTS("&nbsp;</td></tr>\n");
- }
- }
- PUTS(" <tr><th colspan=2 bgcolor=\"" HEADER_COLOR "\">HTTP Response Headers</th></tr>\n");
- env_arr = table_elts(GLOBAL(php3_rqst)->headers_out);
- env = (table_entry *)env_arr->elts;
- for(i = 0; i < env_arr->nelts; ++i) {
- if (env[i].key) {
- PUTS("<tr><td bgcolor=\"" ENTRY_NAME_COLOR "\">");
- PUTS(env[i].key);
- PUTS("</td><td bgcolor=\"" CONTENTS_COLOR "\">");
- PUTS(env[i].val);
- PUTS("&nbsp;</td></tr>\n");
- }
- }
- PUTS("</table>\n\n");
- }
-#endif
-
- PUTS("</center>");
-
- PUTS("<hr>\n");
- PUTS("<table width=\"100%%\"><tr>\n");
- php3_printf("<td><h2>Zend</h2>This program makes use of the Zend scripting language engine:<br><pre>%s</pre></td>", get_zend_version());
- PUTS("<td width=\"100\"><a href=\"http://www.zend.com/\"><img src=\"");
- /*PUTS(GLOBAL(php3_rqst)->uri);*/
- PUTS("?=PHPE9568F35-D428-11d2-A769-00AA001ACF42\" border=\"0\" width=\"100\" height=\"89\"></a></td>\n");
- PUTS("</tr></table>\n");
-
- SECTION("PHP License");
- PUTS("<PRE>This program is free software; you can redistribute it and/or modify\n");
- PUTS("it under the terms of:\n");
- PUTS("\n");
- PUTS("A) the GNU General Public License as published by the Free Software\n");
- PUTS(" Foundation; either version 2 of the License, or (at your option)\n");
- PUTS(" any later version.\n");
- PUTS("\n");
- PUTS("B) the PHP License as published by the PHP Development Team and\n");
- PUTS(" included in the distribution in the file: LICENSE\n");
- PUTS("\n");
- PUTS("This program is distributed in the hope that it will be useful,\n");
- PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
- PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
- PUTS("GNU General Public License for more details.\n");
- PUTS("\n");
- PUTS("You should have received a copy of both licenses referred to here.\n");
- PUTS("If you did not, or have any questions about PHP licensing, please\n");
- PUTS("contact core@php.net.</PRE>\n");
-
-}
-
-/* {{{ proto void phpinfo(void)
- Output a page of useful information about PHP and the current request */
-void php3_info(INTERNAL_FUNCTION_PARAMETERS)
-{
- TLS_VARS;
-
- _php3_info();
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto string phpversion(void)
- Return the current PHP version */
-void php3_version(INTERNAL_FUNCTION_PARAMETERS)
-{
- TLS_VARS;
-
- RETURN_STRING(PHP_VERSION,1);
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/info.h b/ext/standard/info.h
deleted file mode 100644
index 41e5483145..0000000000
--- a/ext/standard/info.h
+++ /dev/null
@@ -1,40 +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 <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _INFO_H
-#define _INFO_H
-
-extern void php3_version(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_info(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void _php3_info(void);
-
-#endif /* _INFO_H */
diff --git a/ext/standard/iptc.c b/ext/standard/iptc.c
deleted file mode 100644
index c0711d66be..0000000000
--- a/ext/standard/iptc.c
+++ /dev/null
@@ -1,132 +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: Thies C. Arntzen (thies@digicol.de) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/*
- * Functions to parse & compse IPTC data.
- * PhotoShop >= 3.0 can read and write textual data to JPEG files.
- * ... more to come .....
- */
-
-/*
- * TODO:
- * - add IPTC translation table
- * - implement a call to embed iptc into a JPEG file
- */
-
-#include "php.h"
-#include "php3_iptc.h"
-
-void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS)
-{
- unsigned int length, inx, len, inheader, tagsfound;
- unsigned char *buffer;
- unsigned char recnum, dataset;
- unsigned char key[ 16 ];
- pval values, *str, *element;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
-
- inx = 0;
- length = str->value.str.len;
- buffer = str->value.str.val;
-
- inheader = 0; /* have we already found the IPTC-Header??? */
- tagsfound = 0; /* number of tags already found */
-
- while (inx < length) {
- if (buffer[ inx++ ] != 0x1c) { /* skip all junk */
- if (inheader) {
- break; /* we ran against some data which does not conform to IPTC - stop parsing! */
- } else {
- continue;
- }
- } else {
- inheader = 1;
- }
-
- if ((inx + 4) >= length)
- break;
-
- dataset = buffer[ inx++ ];
- recnum = buffer[ inx++ ];
-
- if (buffer[ inx ] & (unsigned char) 0x80) {
- len = (((long) buffer[ inx + 2 ]) << 24) + (((long) buffer[ inx + 3 ]) << 16) +
- (((long) buffer[ inx + 4 ]) << 8) + (((long) buffer[ inx + 5 ]));
- inx += 6;
- } else {
- len = (((unsigned short) buffer[ inx ])<<8) | (unsigned short)buffer[ inx+1 ];
- inx += 2;
- }
-
- sprintf(key,"%d#%03d",(unsigned int) dataset,(unsigned int) recnum);
-
- if ((inx + len) > length)
- break;
-
- if (tagsfound == 0) { /* found the 1st tag - initialize the return array */
- if (array_init(return_value) == FAILURE) {
- php3_error(E_ERROR, "Unable to initialize array");
- RETURN_FALSE;
- }
- }
-
- if (_php3_hash_find(return_value->value.ht,key,strlen(key) + 1,(void **) &element) == FAILURE) {
- if (array_init(&values) == FAILURE) {
- php3_error(E_ERROR, "Unable to initialize array");
- RETURN_FALSE;
- }
-
- _php3_hash_update(return_value->value.ht, key, strlen(key)+1, (void *) &values, sizeof(pval), (void **) &element);
- }
-
- add_next_index_stringl(element,buffer+inx,len,1);
-
- inx += len;
-
- tagsfound++;
- }
-
- if (! tagsfound) {
- RETURN_FALSE;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/link.c b/ext/standard/link.c
deleted file mode 100644
index e148858a3c..0000000000
--- a/ext/standard/link.c
+++ /dev/null
@@ -1,214 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "php3_filestat.h"
-#include "php_globals.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include <string.h>
-#if HAVE_PWD_H
-#if MSVC5
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_GRP_H
-#if MSVC5
-#include "win32/grp.h"
-#else
-#include <grp.h>
-#endif
-#endif
-#include <errno.h>
-#include <ctype.h>
-
-#include "safe_mode.h"
-#include "php3_link.h"
-
-/* {{{ proto string readlink(string filename)
- Return the target of a symbolic link */
-void php3_readlink(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if HAVE_SYMLINK
- pval *filename;
- char buff[256];
- int ret;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- ret = readlink(filename->value.str.val, buff, 255);
- if (ret == -1) {
- php3_error(E_WARNING, "readlink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- /* Append NULL to the end of the string */
- buff[ret] = '\0';
- RETURN_STRING(buff,1);
-#endif
-}
-/* }}} */
-
-/* {{{ proto int linkinfo(string filename)
- Returns the st_dev field of the UNIX C stat structure describing the link */
-void php3_linkinfo(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if HAVE_SYMLINK
- pval *filename;
- struct stat sb;
- int ret;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- ret = lstat(filename->value.str.val, &sb);
- if (ret == -1) {
- php3_error(E_WARNING, "LinkInfo failed (%s)", strerror(errno));
- RETURN_LONG(-1L);
- }
- RETURN_LONG((long) sb.st_dev);
-#endif
-}
-/* }}} */
-
-/* {{{ proto int symlink(string target, string link)
- Create a symbolic link */
-void php3_symlink(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if HAVE_SYMLINK
- pval *topath, *frompath;
- int ret;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(topath);
- convert_to_string(frompath);
-
- if (PG(safe_mode) && !_php3_checkuid(topath->value.str.val, 2)) {
- RETURN_FALSE;
- }
-
- ret = symlink(topath->value.str.val, frompath->value.str.val);
- if (ret == -1) {
- php3_error(E_WARNING, "SymLink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int link(string target, string link)
- Create a hard link */
-void php3_link(INTERNAL_FUNCTION_PARAMETERS)
-{
-#if HAVE_LINK
- pval *topath, *frompath;
- int ret;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &topath, &frompath) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(topath);
- convert_to_string(frompath);
-
- if (PG(safe_mode) && !_php3_checkuid(topath->value.str.val, 2)) {
- RETURN_FALSE;
- }
-
- ret = link(topath->value.str.val, frompath->value.str.val);
- if (ret == -1) {
- php3_error(E_WARNING, "Link failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- RETURN_TRUE;
-#endif
-}
-/* }}} */
-
-/* {{{ proto int unlink(string filename)
- Delete a file */
-void php3_unlink(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *filename;
- int ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &filename) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(filename);
-
- if (PG(safe_mode) && !_php3_checkuid(filename->value.str.val, 2)) {
- RETURN_FALSE;
- }
-
- ret = unlink(filename->value.str.val);
- if (ret == -1) {
- php3_error(E_WARNING, "Unlink failed (%s)", strerror(errno));
- RETURN_FALSE;
- }
- /* Clear stat cache */
- php3_clearstatcache(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- RETURN_TRUE;
-}
-/* }}} */
-
-function_entry link_functions[] = {
- {"readlink", php3_readlink, NULL},
- {"linkinfo", php3_linkinfo, NULL},
- {"symlink", php3_symlink, NULL},
- {"link", php3_link, NULL},
- {"unlink", php3_unlink, NULL},
- {NULL, NULL, NULL}
-};
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
deleted file mode 100644
index 685e8d9cf9..0000000000
--- a/ext/standard/mail.c
+++ /dev/null
@@ -1,188 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#ifndef MSVC5
-#include "build-defs.h"
-#endif
-#include "php3_mail.h"
-#include "php_ini.h"
-
-#if APACHE
-# ifndef DEBUG
-# undef palloc
-# endif
-#endif
-
-#if HAVE_SENDMAIL
-#if MSVC5
-#include "win32/sendmail.h"
-#endif
-
-function_entry mail_functions[] = {
- {"mail", php3_mail, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry mail_module_entry = {
- "Sendmail", mail_functions, NULL, NULL, NULL, NULL, php3_info_mail, STANDARD_MODULE_PROPERTIES
-};
-
-
-#if COMPILE_DL
-DLEXPORT php3_module_entry *get_module(void) { return &odbc_module_entry; }
-#endif
-
-/* {{{ proto int mail(string to, string subject, string message [, string additional_headers])
- Send an email message */
-void php3_mail(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *argv[4];
- char *to=NULL, *message=NULL, *headers=NULL, *subject=NULL;
- int argc;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
- if (argc < 3 || argc > 4 || getParametersArray(ht, argc, argv) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* To: */
- convert_to_string(argv[0]);
- if (argv[0]->value.str.val) {
- to = argv[0]->value.str.val;
- } else {
- php3_error(E_WARNING, "No to field in mail command");
- RETURN_FALSE;
- }
-
- /* Subject: */
- convert_to_string(argv[1]);
- if (argv[1]->value.str.val) {
- subject = argv[1]->value.str.val;
- } else {
- php3_error(E_WARNING, "No subject field in mail command");
- RETURN_FALSE;
- }
-
- /* message body */
- convert_to_string(argv[2]);
- if (argv[2]->value.str.val) {
- message = argv[2]->value.str.val;
- } else {
- /* this is not really an error, so it is allowed. */
- php3_error(E_WARNING, "No message string in mail command");
- message = NULL;
- }
-
- if (argc == 4) { /* other headers */
- convert_to_string(argv[3]);
- headers = argv[3]->value.str.val;
- }
-
- if (_php3_mail(to, subject, message, headers)){
- RETURN_TRUE;
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-int _php3_mail(char *to, char *subject, char *message, char *headers)
-{
-#if MSVC5
- int tsm_err;
-#else
- FILE *sendmail;
- int ret;
- char *sendmail_path = INI_STR("sendmail_path");
-#endif
-
-#if MSVC5
- if (TSendMail(INI_STR("SMTP"), &tsm_err, headers, subject, to, message) != SUCCESS){
- php3_error(E_WARNING, GetSMErrorText(tsm_err));
- return 0;
- }
-#else
- if (!sendmail_path) {
- return 0;
- }
- sendmail = popen(sendmail_path, "w");
-
- if (sendmail) {
- fprintf(sendmail, "To: %s\n", to);
- fprintf(sendmail, "Subject: %s\n", subject);
- if (headers != NULL) {
- fprintf(sendmail, "%s\n", headers);
- }
- fprintf(sendmail, "\n%s\n", message);
- ret = pclose(sendmail);
- if (ret == -1) {
- return 0;
- } else {
- return 1;
- }
- } else {
- php3_error(E_WARNING, "Could not execute mail delivery program");
- return 0;
- }
-#endif
- return 1;
-}
-
-void php3_info_mail(void)
-{
-#if MSVC5
- PUTS("Internal Sendmail support for Windows 4");
-#else
- php3_printf("Path to sendmail: <tt>%s</tt>", INI_STR("sendmail_path"));
-#endif
-}
-
-#else
-
-void php3_mail(INTERNAL_FUNCTION_PARAMETERS) {}
-void php3_info_mail() {}
-
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * End:
- */
diff --git a/ext/standard/math.c b/ext/standard/math.c
deleted file mode 100644
index e13fb82119..0000000000
--- a/ext/standard/math.c
+++ /dev/null
@@ -1,708 +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) |
- | Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "phpmath.h"
-#include "snprintf.h"
-
-#include <math.h>
-
-#ifndef M_PI
-#define M_PI 3.14159265358979323846
-#endif
-
-char *_php3_number_format(double, int, char ,char);
-
-/* {{{ proto int abs(int number)
- Return the absolute value of the number */
-void php3_abs(INTERNAL_FUNCTION_PARAMETERS) {
- pval *value;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (value->type == IS_STRING) {
- convert_scalar_to_number(value);
- }
-
- if (value->type == IS_DOUBLE) {
- RETURN_DOUBLE(fabs(value->value.dval));
- }
- else if (value->type == IS_LONG) {
- RETURN_LONG(labs(value->value.lval));
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int ceil(double number)
- Returns the next highest integer value of the number */
-void php3_ceil(INTERNAL_FUNCTION_PARAMETERS) {
- pval *value;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (value->type == IS_STRING) {
- convert_scalar_to_number(value);
- }
-
- if (value->type == IS_DOUBLE) {
- RETURN_LONG((long)ceil(value->value.dval));
- }
- else if (value->type == IS_LONG) {
- RETURN_LONG(value->value.lval);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto int floor(double number)
- Returns the next lowest integer value from the number */
-void php3_floor(INTERNAL_FUNCTION_PARAMETERS) {
- pval *value;
- TLS_VARS;
-
- if (ARG_COUNT(ht)!=1||getParameters(ht,1,&value)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (value->type == IS_STRING) {
- convert_scalar_to_number(value);
- }
-
- if (value->type == IS_DOUBLE) {
- RETURN_LONG((long)floor(value->value.dval));
- }
- else if (value->type == IS_LONG) {
- RETURN_LONG(value->value.lval);
- }
-
- RETURN_FALSE;
-}
-/* }}} */
-
-#ifndef HAVE_RINT
-/* emulate rint */
-inline double rint(double n)
-{
- double i, f;
- f = modf(n, &i);
- if (f > .5)
- i++;
- else if (f < -.5)
- i--;
- return i;
-}
-#endif
-
-/* {{{ proto int round(double number)
- Returns the rounded value of the number */
-void php3_round(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *value;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (value->type == IS_STRING) {
- convert_scalar_to_number(value);
- }
- if (value->type == IS_DOUBLE) {
- RETURN_DOUBLE(rint(value->value.dval));
- }
- if (value->type == IS_LONG) {
- RETURN_DOUBLE((double)value->value.lval);
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto double sin(double number)
- Returns the sine of the number in radians */
-void php3_sin(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = sin(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double cos(double number)
- Returns the cosine of the number in radians */
-void php3_cos(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = cos(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double tan(double number)
- Returns the tangent of the number in radians */
-void php3_tan(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = tan(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double asin(double number)
- Returns the arc sine of the number in radians */
-void php3_asin(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = asin(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double acos(double number)
- Return the arc cosine of the number in radians */
-void php3_acos(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = acos(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double atan(double number)
- Returns the arc tangent of the number in radians */
-void php3_atan(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = atan(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double atan2(double y, double x)
- Returns the arc tangent of y/x, with the resulting quadrant determined by the signs of y and x */
-void php3_atan2(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num1, *num2;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &num1, &num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num1);
- convert_to_double(num2);
- return_value->value.dval = atan2(num1->value.dval,num2->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double pi(void)
- Returns an approximation of pi */
-void php3_pi(INTERNAL_FUNCTION_PARAMETERS)
-{
- return_value->value.dval = M_PI;
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double pow(double base, double exponent)
- Returns base raised to the power of expopent */
-void php3_pow(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num1, *num2;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht,2,&num1,&num2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num1);
- convert_to_double(num2);
- RETURN_DOUBLE(pow(num1->value.dval, num2->value.dval));
-}
-/* }}} */
-
-/* {{{ proto double exp(double number)
- Returns e raised to the power of the number */
-void php3_exp(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = exp(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double log(double number)
- Returns the natural logarithm of the number */
-void php3_log(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = log(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double log10(double number)
- Returns the base-10 logarithm of the number */
-void php3_log10(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = log10(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double sqrt(double number)
- Returns the square root of the number */
-void php3_sqrt(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(num);
- return_value->value.dval = sqrt(num->value.dval);
- return_value->type = IS_DOUBLE;
-}
-/* }}} */
-
-/* {{{ proto double deg2rad(double number)
- Converts the number in degrees to the radian equivalent */
-void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *deg;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &deg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(deg);
- RETVAL_DOUBLE((deg->value.dval / 180.0) * M_PI);
-}
-/* }}} */
-
-/* {{{ proto double rad2deg(double number)
- Converts the radian number to the equivalent number in degrees */
-void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *rad;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &rad) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double(rad);
- RETVAL_DOUBLE((rad->value.dval / M_PI) * 180);
-}
-/* }}} */
-
-
-/*
- * Convert a string representation of a base(2-36) number to a long.
- */
-static long
-_php3_basetolong(pval *arg, int base) {
- long mult = 1, num = 0, digit;
- int i;
- char c, *s;
-
- if (arg->type != IS_STRING || base < 2 || base > 36) {
- return 0;
- }
-
- s = arg->value.str.val;
-
- for (i = arg->value.str.len - 1; i >= 0; i--, mult *= base) {
- c = toupper(s[i]);
- if (c >= '0' && c <= '9') {
- digit = (c - '0');
- } else if (c >= 'A' && c <= 'Z') {
- digit = (c - 'A' + 10);
- } else {
- continue;
- }
- if (digit >= base) {
- continue;
- }
- num += mult * digit;
- }
-
- return num;
-}
-
-
-/*
- * Convert a long to a string containing a base(2-36) representation of
- * the number.
- */
-static char *
-_php3_longtobase(pval *arg, int base)
-{
- static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
- char *result, *ptr, *ret;
- int len, digit;
- long value;
-
- if (arg->type != IS_LONG || base < 2 || base > 36) {
- return empty_string;
- }
-
- value = arg->value.lval;
-
- /* allocates space for the longest possible result with the lowest base */
- len = (sizeof(arg->value.lval) * 8) + 1;
- result = emalloc((sizeof(arg->value.lval) * 8) + 1);
-
- ptr = result + len - 1;
- *ptr-- = '\0';
-
- do {
- digit = value % base;
- *ptr = digits[digit];
- value /= base;
- }
- while (ptr-- > result && value);
- ptr++;
- ret = estrdup(ptr);
- efree(result);
-
- return ret;
-}
-
-/* {{{ proto int bindec(string binary_number)
- Returns the decimal equivalent of the binary number */
-void php3_bindec(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- long ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg);
- ret = _php3_basetolong(arg, 2);
-
- RETVAL_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int hexdec(string hexadimal_number)
- Returns the decimal equivalent of the hexadecimal number */
-void php3_hexdec(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- long ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg);
-
- ret = _php3_basetolong(arg, 16);
- RETVAL_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto int octdec(string octal_number)
- Returns the decimal equivalent of an octal string */
-void php3_octdec(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- long ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(arg);
-
- ret = _php3_basetolong(arg, 8);
- RETVAL_LONG(ret);
-}
-/* }}} */
-
-/* {{{ proto string decbin(int decimal_number)
- Returns a string containing a binary representation of the number */
-void php3_decbin(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *result;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg);
-
- result = _php3_longtobase(arg, 2);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-/* }}} */
-
-/* {{{ proto string decoct(int decimal_number)
- Returns a string containing an octal representation of the given number */
-void php3_decoct(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *result;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg);
-
- result = _php3_longtobase(arg, 8);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-/* }}} */
-
-/* {{{ proto string dechex(int decimal_number)
- Returns a string containing a hexadecimal representation of the given number */
-void php3_dechex(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *result;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_long(arg);
-
- result = _php3_longtobase(arg, 16);
- return_value->type = IS_STRING;
- return_value->value.str.len = strlen(result);
- return_value->value.str.val = result;
-}
-/* }}} */
-
-
-/* {{{ proto string base_convert(string number, int frombase, int tobase)
- Converts a number in a string from any base <= 36 to any base <= 36.
-*/
-void php3_base_convert(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *number, *frombase, *tobase, temp;
- char *result;
-
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &number, &frombase, &tobase)
- == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(number);
- convert_to_long(frombase);
- convert_to_long(tobase);
- if (frombase->value.lval < 2 || frombase->value.lval > 36) {
- php3_error(E_WARNING, "base_convert: invalid `from base' (%d)",
- frombase->value.lval);
- RETURN_FALSE;
- }
- if (tobase->value.lval < 2 || tobase->value.lval > 36) {
- php3_error(E_WARNING, "base_convert: invalid `to base' (%d)",
- tobase->value.lval);
- RETURN_FALSE;
- }
- temp.type = IS_LONG;
- temp.value.lval = _php3_basetolong(number, frombase->value.lval);
- result = _php3_longtobase(&temp, tobase->value.lval);
- RETVAL_STRING(result, 0);
-} /* }}} */
-
-
-char *_php3_number_format(double d,int dec,char dec_point,char thousand_sep)
-{
- char *tmpbuf,*resbuf;
- char *s,*t; /* source, target */
- int tmplen,reslen=0;
- int count=0;
- int is_negative=0;
-
- if (d<0) {
- is_negative=1;
- d = -d;
- }
- dec = MAX(0,dec);
- tmpbuf = (char *) emalloc(32+dec);
-
- tmplen=_php3_sprintf(tmpbuf,"%.*f",dec,d);
-
- for (t=tmpbuf; *t; t++) {
- if (*t=='.') {
- *t = dec_point;
- }
- }
- if (dec) {
- reslen = dec+1 + (tmplen-dec-1) + (tmplen-1-dec-1)/3;
- } else {
- reslen = tmplen+(tmplen-1)/3;
- }
- if (is_negative) {
- reslen++;
- }
- resbuf = (char *) emalloc(reslen+1);
-
- s = tmpbuf+tmplen-1;
- t = resbuf+reslen;
- *t-- = 0;
-
- if (dec) {
- while (*s!=dec_point) {
- *t-- = *s--;
- }
- *t-- = *s--; /* copy that dot */
- }
-
- while(s>=tmpbuf) {
- *t-- = *s--;
- if ((++count%3)==0 && s>=tmpbuf) {
- *t-- = thousand_sep;
- }
- }
- if (is_negative) {
- *t-- = '-';
- }
- efree(tmpbuf);
- return resbuf;
-}
-
-/* {{{ proto string number_format(double number, [,int num_decimal_places [, string dec_seperator, string thousands_seperator)]])
- Formats a number with grouped thousands */
-void php3_number_format(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num,*dec,*t_s,*d_p;
- char thousand_sep=',', dec_point='.';
-
- switch(ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &num)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double(num);
- RETURN_STRING(_php3_number_format(num->value.dval,0,dec_point,thousand_sep),0);
- break;
- case 2:
- if (getParameters(ht, 2, &num, &dec)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double(num);
- convert_to_long(dec);
- RETURN_STRING(_php3_number_format(num->value.dval,dec->value.lval,dec_point,thousand_sep),0);
- break;
- case 4:
- if (getParameters(ht, 4, &num, &dec, &d_p, &t_s)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_double(num);
- convert_to_long(dec);
- convert_to_string(d_p);
- convert_to_string(t_s);
- if (d_p->value.str.len==1) {
- dec_point=d_p->value.str.val[0];
- }
- if (t_s->value.str.len==1) {
- thousand_sep=t_s->value.str.val[0];
- }
- RETURN_STRING(_php3_number_format(num->value.dval,dec->value.lval,dec_point,thousand_sep),0);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-}
-/* }}} */
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/md5.c b/ext/standard/md5.c
deleted file mode 100644
index 23e2d54c4b..0000000000
--- a/ext/standard/md5.c
+++ /dev/null
@@ -1,407 +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: Lachlan Roche |
- +----------------------------------------------------------------------+
- */
-
-/*
- * md5.c - Copyright 1997 Lachlan Roche
- */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-
-#include <stdio.h>
-#include "php.h"
-
-#include "md5.h"
-
-/* {{{ proto string md5(string str)
- Calculate the md5 hash of a string */
-void php3_md5(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char md5str[33];
- PHP3_MD5_CTX context;
- unsigned char digest[16];
- int i;
- char *r;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- md5str[0] = '\0';
- PHP3_MD5Init(&context);
- PHP3_MD5Update(&context, arg->value.str.val, arg->value.str.len);
- PHP3_MD5Final(digest, &context);
- for (i = 0, r = md5str; i < 16; i++, r += 2) {
- sprintf(r, "%02x", digest[i]);
- }
- *r = '\0';
- RETVAL_STRING(md5str,1);
-}
-/* }}} */
-
-/*
- * The remaining code is the reference MD5 code (md5c.c) from rfc1321
- */
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-/* Constants for MD5Transform routine.
- */
-
-
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-static void MD5Transform PROTO_LIST((UINT4[4], const unsigned char[64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, const unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST((_POINTER, _POINTER, unsigned int));
-static void MD5_memset PROTO_LIST((_POINTER, int, unsigned int));
-
-static unsigned char PADDING[64] =
-{
- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
-
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
- }
-
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void PHP3_MD5Init(PHP3_MD5_CTX * context)
-{
- context->count[0] = context->count[1] = 0;
- /* Load magic initialization constants.
- */
- context->state[0] = 0x67452301;
- context->state[1] = 0xefcdab89;
- context->state[2] = 0x98badcfe;
- context->state[3] = 0x10325476;
-}
-
-/* MD5 block update operation. Continues an MD5 message-digest
- operation, processing another message block, and updating the
- context.
- */
-void PHP3_MD5Update(PHP3_MD5_CTX * context, const unsigned char *input,
- unsigned int inputLen)
-{
- unsigned int i, index, partLen;
-
- /* Compute number of bytes mod 64 */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
-
- /* Update number of bits */
- if ((context->count[0] += ((UINT4) inputLen << 3))
- < ((UINT4) inputLen << 3))
- context->count[1]++;
- context->count[1] += ((UINT4) inputLen >> 29);
-
- partLen = 64 - index;
-
- /* Transform as many times as possible.
- */
- if (inputLen >= partLen) {
- MD5_memcpy
- ((_POINTER) & context->buffer[index], (_POINTER) input, partLen);
- MD5Transform(context->state, context->buffer);
-
- for (i = partLen; i + 63 < inputLen; i += 64)
- MD5Transform(context->state, &input[i]);
-
- index = 0;
- } else
- i = 0;
-
- /* Buffer remaining input */
- MD5_memcpy
- ((_POINTER) & context->buffer[index], (_POINTER) & input[i],
- inputLen - i);
-}
-
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
- the message digest and zeroizing the context.
- */
-void PHP3_MD5Final(unsigned char digest[16], PHP3_MD5_CTX * context)
-{
- unsigned char bits[8];
- unsigned int index, padLen;
-
- /* Save number of bits */
- Encode(bits, context->count, 8);
-
- /* Pad out to 56 mod 64.
- */
- index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
- padLen = (index < 56) ? (56 - index) : (120 - index);
- PHP3_MD5Update(context, PADDING, padLen);
-
- /* Append length (before padding) */
- PHP3_MD5Update(context, bits, 8);
-
- /* Store state in digest */
- Encode(digest, context->state, 16);
-
- /* Zeroize sensitive information.
- */
- MD5_memset((_POINTER) context, 0, sizeof(*context));
-}
-
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void MD5Transform(state, block)
-UINT4 state[4];
-const unsigned char block[64];
-{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
- Decode(x, block, 64);
-
- /* Round 1 */
- FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
- FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
- FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
- FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
- FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
- FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
- FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
- FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
- FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
- FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
- /* Round 2 */
- GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
- GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
- GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
- GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
- GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
- GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
- GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
- GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
- GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
- GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
- /* Round 3 */
- HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
- HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
- HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
- HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
- HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
- HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
- HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
- HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
- HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
- HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
-
- /* Round 4 */
- II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
- II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
- II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
- II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
- II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
- II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
- II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
- II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
- II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
- II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
-
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
-
- /* Zeroize sensitive information. */
- MD5_memset((_POINTER) x, 0, sizeof(x));
-}
-
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
- a multiple of 4.
- */
-static void Encode(output, input, len)
-unsigned char *output;
-UINT4 *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4) {
- output[j] = (unsigned char) (input[i] & 0xff);
- output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
- output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
- output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
- }
-}
-
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
- a multiple of 4.
- */
-static void Decode(output, input, len)
-UINT4 *output;
-const unsigned char *input;
-unsigned int len;
-{
- unsigned int i, j;
-
- for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) |
- (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy(output, input, len)
-_POINTER output;
-_POINTER input;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset(output, value, len)
-_POINTER output;
-int value;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *) output)[i] = (char) value;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/md5.h b/ext/standard/md5.h
deleted file mode 100644
index 1c71321c2e..0000000000
--- a/ext/standard/md5.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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-#ifndef _md5_h
-#define _md5_h
-/* MD5.H - header file for MD5C.C
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- rights reserved.
-
- License to copy and use this software is granted provided that it
- is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- Algorithm" in all material mentioning or referencing this software
- or this function.
-
- License is also granted to make and use derivative works provided
- that such works are identified as "derived from the RSA Data
- Security, Inc. MD5 Message-Digest Algorithm" in all material
- mentioning or referencing the derived work.
-
- RSA Data Security, Inc. makes no representations concerning either
- the merchantability of this software or the suitability of this
- software for any particular purpose. It is provided "as is"
- without express or implied warranty of any kind.
-
- These notices must be retained in any copies of any part of this
- documentation and/or software.
- */
-
-#include "global.h"
-
-/* MD5 context. */
-typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
- unsigned char buffer[64]; /* input buffer */
-} PHP3_MD5_CTX;
-
-void PHP3_MD5Init PROTO_LIST((PHP3_MD5_CTX *));
-void PHP3_MD5Update PROTO_LIST((PHP3_MD5_CTX *, const unsigned char *, unsigned int));
-void PHP3_MD5Final PROTO_LIST((unsigned char[16], PHP3_MD5_CTX *));
-
-extern void php3_md5(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif
diff --git a/ext/standard/microtime.c b/ext/standard/microtime.c
deleted file mode 100644
index 3ccf2a28a9..0000000000
--- a/ext/standard/microtime.c
+++ /dev/null
@@ -1,88 +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: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "microtime.h"
-#include "snprintf.h"
-
-#include <stdio.h>
-#if HAVE_GETTIMEOFDAY
-#if MSVC5
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-#endif
-
-#define NUL '\0'
-#define MICRO_IN_SEC 1000000.00
-
-/* {{{ proto string microtime(void)
- Returns a string containing the current time in seconds and microseconds */
-#ifdef __cplusplus
-void php3_microtime(HashTable *)
-#else
-void php3_microtime(INTERNAL_FUNCTION_PARAMETERS)
-#endif
-{
-#if HAVE_GETTIMEOFDAY
- struct timeval tp;
- long sec = 0L;
- double msec = 0.0;
- char ret[100];
- TLS_VARS;
-
- if (gettimeofday((struct timeval *) &tp, (NUL)) == 0) {
- msec = (double) (tp.tv_usec / MICRO_IN_SEC);
- sec = tp.tv_sec;
- }
- snprintf(ret, 100, "%.8f %ld", msec, sec);
- RETVAL_STRING(ret,1);
-#endif
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/microtime.h b/ext/standard/microtime.h
deleted file mode 100644
index b827272779..0000000000
--- a/ext/standard/microtime.h
+++ /dev/null
@@ -1,37 +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: Paul Panotzki - Bunyip Information Systems |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _MICROTIME_H
-#define _MICROTIME_H
-
-extern void php3_microtime(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _MICROTIME_H */
diff --git a/ext/standard/pack.c b/ext/standard/pack.c
deleted file mode 100644
index c1be66847c..0000000000
--- a/ext/standard/pack.c
+++ /dev/null
@@ -1,890 +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: Chris Schneider <cschneid@relog.ch> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#if MSVC5
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-#include "functions/head.h"
-#include "safe_mode.h"
-#include "php3_string.h"
-#include "pack.h"
-#if HAVE_PWD_H
-#if MSVC5
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#include "snprintf.h"
-#include "fsock.h"
-#if HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-
-function_entry pack_functions[] = {
- {"pack", php3_pack, NULL},
- {"unpack", php3_unpack, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry pack_module_entry = {
- "PHP_pack", pack_functions, php3_minit_pack, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-/* Whether machine is little endian */
-char machine_little_endian;
-
-/* Mapping of byte from char (8bit) to long for machine endian */
-static int byte_map[1];
-
-/* Mappings of bytes from int (machine dependant) to int for machine endian */
-static int int_map[sizeof(int)];
-
-/* Mappings of bytes from shorts (16bit) for all endian environments */
-static int machine_endian_short_map[2];
-static int big_endian_short_map[2];
-static int little_endian_short_map[2];
-
-/* Mappings of bytes from longs (32bit) for all endian environments */
-static int machine_endian_long_map[4];
-static int big_endian_long_map[4];
-static int little_endian_long_map[4];
-
-
-static void _php3_pack(pval *val, int size, int *map, char *output)
-{
- int i;
- char *v;
-
- convert_to_long(val);
- v = (char *)&val->value.lval;
-
- for (i = 0; i < size; i++) {
- *(output++) = v[map[i]];
- }
-}
-
-
-/* pack() idea stolen from Perl (implemented formats behave the same as there)
- * Implemented formats are A,a,h,H,c,C,s,S,i,I,l,L,n,N,f,d,x,X,@.
- */
-/* {{{ proto string pack(string format, mixed arg1, mixed arg2, ...)
- Takes 1 or more arguments and packs them into a binary string according to the format argument */
-PHP_FUNCTION(pack)
-{
- pval **argv;
- int argc, i;
- int currentarg;
- char *format;
- int formatlen;
- char *formatcodes;
- int *formatargs;
- int formatcount = 0;
- int outputpos = 0, outputsize = 0;
- char *output;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
-
- if (argc < 1) {
- WRONG_PARAM_COUNT;
- }
-
- argv = emalloc(argc * sizeof(pval *));
-
- if (getParametersArray(ht, argc, argv) == FAILURE) {
- efree(argv);
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(argv[0]);
- format = argv[0]->value.str.val;
- formatlen = argv[0]->value.str.len;
-
- /* We have a maximum of <formatlen> format codes to deal with */
- formatcodes = emalloc(formatlen * sizeof(*formatcodes));
- formatargs = emalloc(formatlen * sizeof(*formatargs));
- currentarg = 1;
-
- /* Preprocess format into formatcodes and formatargs */
- for (i = 0; i < formatlen; formatcount++) {
- char code = format[i++];
- int arg = 1;
-
- /* Handle format arguments if any */
- if (i < formatlen) {
- char c = format[i];
-
- if (c == '*') {
- arg = -1;
- i++;
- }
- else if ((c >= '0') && (c <= '9')) {
- arg = atoi(&format[i]);
-
- while (format[i] >= '0' && format[i] <= '9' && i < formatlen) {
- i++;
- }
- }
- }
-
- /* Handle special arg '*' for all codes and check argv overflows */
- switch ((int)code) {
- /* Never uses any args */
- case 'x': case 'X': case '@': {
- if (arg < 0) {
- php3_error(E_WARNING, "pack type %c: '*' ignored", code);
- arg = 1;
- }
- break;
- }
-
- /* Always uses one arg */
- case 'a': case 'A': case 'h': case 'H': {
- if (currentarg >= argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php3_error(E_ERROR, "pack type %c: not enough arguments", code);
- RETURN_FALSE;
- }
-
- if (arg < 0) {
- arg = argv[currentarg]->value.str.len;
- }
-
- currentarg++;
- break;
- }
-
- /* Use as many args as specified */
- case 'c': case 'C': case 's': case 'S': case 'i': case 'I':
- case 'l': case 'L': case 'n': case 'N': case 'v': case 'V':
- case 'f': case 'd': {
- if (arg < 0) {
- arg = argc - currentarg;
- }
-
- currentarg += arg;
-
- if (currentarg > argc) {
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- php3_error(E_ERROR, "pack type %c: too few arguments", code);
- RETURN_FALSE;
- }
- break;
- }
-
- default: {
- php3_error(E_ERROR, "pack type %c: unknown format code", code);
- RETURN_FALSE;
- }
- }
-
- formatcodes[formatcount] = code;
- formatargs[formatcount] = arg;
- }
-
- if (currentarg < argc) {
- php3_error(E_WARNING, "pack %d arguments unused", (argc - currentarg));
- }
-
- /* Calculate output length and upper bound while processing*/
- for (i = 0; i < formatcount; i++) {
- int code = (int)formatcodes[i];
- int arg = formatargs[i];
-
- switch ((int)code) {
- case 'h': case 'H': {
- outputpos += (arg + 1) / 2; /* 4 bit per arg */
- break;
- }
-
- case 'a': case 'A':
- case 'c': case 'C':
- case 'x': {
- outputpos += arg; /* 8 bit per arg */
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- outputpos += arg * 2; /* 16 bit per arg */
- break;
- }
-
- case 'i': case 'I': {
- outputpos += arg * sizeof(int);
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- outputpos += arg * 4; /* 32 bit per arg */
- break;
- }
-
- case 'f': {
- outputpos += arg * sizeof(float);
- break;
- }
-
- case 'd': {
- outputpos += arg * sizeof(double);
- break;
- }
-
- case 'X': {
- outputpos -= arg;
-
- if (outputpos < 0) {
- php3_error(E_WARNING, "pack type %c: outside of string", code);
- outputpos = 0;
- }
- break;
- }
-
- case '@': {
- outputpos = arg;
- break;
- }
- }
-
- if (outputsize < outputpos) {
- outputsize = outputpos;
- }
- }
-
- output = emalloc(outputsize + 1);
- outputpos = 0;
- currentarg = 1;
-
- /* Do actual packing */
- for (i = 0; i < formatcount; i++) {
- int code = (int)formatcodes[i];
- int arg = formatargs[i];
- pval *val;
-
- switch ((int)code) {
- case 'a': case 'A': {
- memset(&output[outputpos], (code == 'a') ? '\0' : ' ', arg);
- val = argv[currentarg++];
- convert_to_string(val);
- memcpy(&output[outputpos], val->value.str.val,
- (val->value.str.len < arg) ? val->value.str.len : arg);
- outputpos += arg;
- break;
- }
-
- case 'h': case 'H': {
- int nibbleshift = (code == 'h') ? 0 : 4;
- int first = 1;
- char *v;
-
- val = argv[currentarg++];
- convert_to_string(val);
- v = val->value.str.val;
- outputpos--;
-
- while (arg-- > 0) {
- char n = *(v++);
-
- if ((n >= '0') && (n <= '9')) {
- n -= '0';
- } else if ((n >= 'A') && (n <= 'F')) {
- n -= ('A' - 10);
- } else if ((n >= 'a') && (n <= 'f')) {
- n -= ('a' - 10);
- } else {
- php3_error(E_WARNING, "pack type %c: illegal hex digit %c", code, n);
- n = 0;
- }
-
- if (first--) {
- output[++outputpos] = 0;
- } else {
- first = 1;
- }
-
- output[outputpos] |= (n << nibbleshift);
- nibbleshift = (nibbleshift + 4) & 7;
- }
-
- outputpos++;
- break;
- }
-
- case 'c': case 'C': {
- while (arg-- > 0) {
- _php3_pack(argv[currentarg++], 1, byte_map, &output[outputpos]);
- outputpos++;
- }
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- int *map = machine_endian_short_map;
-
- if (code == 'n') {
- map = big_endian_short_map;
- } else if (code == 'v') {
- map = little_endian_short_map;
- }
-
- while (arg-- > 0) {
- _php3_pack(argv[currentarg++], 2, map, &output[outputpos]);
- outputpos += 2;
- }
- break;
- }
-
- case 'i': case 'I': {
- while (arg-- > 0) {
- _php3_pack(argv[currentarg++], sizeof(int), int_map, &output[outputpos]);
- outputpos += sizeof(int);
- }
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- int *map = machine_endian_long_map;
-
- if (code == 'N') {
- map = big_endian_long_map;
- } else if (code == 'V') {
- map = little_endian_long_map;
- }
-
- while (arg-- > 0) {
- _php3_pack(argv[currentarg++], 4, map, &output[outputpos]);
- outputpos += 4;
- }
- break;
- }
-
- case 'f': {
- float v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double(val);
- v = (float)val->value.dval;
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'd': {
- double v;
-
- while (arg-- > 0) {
- val = argv[currentarg++];
- convert_to_double(val);
- v = (double)val->value.dval;
- memcpy(&output[outputpos], &v, sizeof(v));
- outputpos += sizeof(v);
- }
- break;
- }
-
- case 'x': {
- memset(&output[outputpos], '\0', arg);
- outputpos += arg;
- break;
- }
-
- case 'X': {
- outputpos -= arg;
-
- if (outputpos < 0) {
- outputpos = 0;
- }
- break;
- }
-
- case '@': {
- if (arg > outputpos) {
- memset(&output[outputpos], '\0', arg - outputpos);
- }
- outputpos = arg;
- break;
- }
- }
- }
-
- efree(argv);
- efree(formatcodes);
- efree(formatargs);
- output[outputpos] = '\0';
- RETVAL_STRINGL(output, outputpos, 1);
- efree(output);
-}
-/* }}} */
-
-
-static long _php3_unpack(char *data, int size, int issigned, int *map)
-{
- long result;
- char *cresult = (char *)&result;
- int i;
-
- result = issigned ? -1 : 0;
-
- for (i = 0; i < size; i++) {
- cresult[map[i]] = *(data++);
- }
-
- return result;
-}
-
-
-/* unpack() is based on Perl's unpack(), but is modified a bit from there.
- * Rather than depending on error-prone ordered lists or syntactically
- * unpleasant pass-by-reference, we return an object with named paramters
- * (like *_fetch_object()). Syntax is "f[repeat]name/...", where "f" is the
- * formatter char (like pack()), "[repeatt]" is the optional repeater argument,
- * and "name" is the name of the variable to use.
- * Example: "c2chars/nints" will return an object with fields
- * chars1, chars2, and ints.
- * Numeric pack types will return numbers, a and A will return strings,
- * f and d will return doubles.
- * Implemented formats are A,a,h,H,c,C,s,S,i,I,l,L,n,N,f,d,x,X,@.
- */
-/* {{{ proto array unpack(string format, string input)
- Unpack binary string into named array elements according to format argument */
-PHP_FUNCTION(unpack)
-{
- pval *formatarg;
- pval *inputarg;
- char *format;
- char *input;
- int formatlen;
- int inputpos, inputlen;
- int i;
- TLS_VARS;
-
- if ((ARG_COUNT(ht) != 2) || getParameters(ht, 2, &formatarg, &inputarg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(formatarg);
- convert_to_string(inputarg);
-
- format = formatarg->value.str.val;
- formatlen = formatarg->value.str.len;
- input = inputarg->value.str.val;
- inputlen = inputarg->value.str.len;
- inputpos = 0;
-
- if (array_init(return_value) == FAILURE)
- return;
-
- while (formatlen-- > 0) {
- char type = *(format++);
- char c;
- int arg = 1;
- char *name;
- int namelen;
- int size=0;
-
- /* Handle format arguments if any */
- if (formatlen > 0) {
- c = *format;
-
- if ((c >= '0') && (c <= '9')) {
- arg = atoi(format);
-
- while ((formatlen > 0) && (*format >= '0') && (*format <= '9')) {
- format++;
- formatlen--;
- }
- } else if (c == '*') {
- arg = -1;
- format++;
- formatlen--;
- }
- }
-
- /* Get of new value in array */
- name = format;
-
- while ((formatlen > 0) && (*format != '/')) {
- formatlen--;
- format++;
- }
-
- namelen = format - name;
-
- if (namelen > 200)
- namelen = 200;
-
- switch ((int)type) {
- /* Never use any input */
- case 'X': {
- size = -1;
- break;
- }
-
- case '@': {
- size = 0;
- break;
- }
-
- case 'a': case 'A': case 'h': case 'H': {
- size = arg;
- arg = 1;
- break;
- }
-
- /* Use 1 byte of input */
- case 'c': case 'C': case 'x': {
- size = 1;
- break;
- }
-
- /* Use 2 bytes of input */
- case 's': case 'S': case 'n': case 'v': {
- size = 2;
- break;
- }
-
- /* Use sizeof(int) bytes of input */
- case 'i': case 'I': {
- size = sizeof(int);
- break;
- }
-
- /* Use 4 bytes of input */
- case 'l': case 'L': case 'N': case 'V': {
- size = 4;
- break;
- }
-
- /* Use sizeof(float) bytes of input */
- case 'f': {
- size = sizeof(float);
- break;
- }
-
- /* Use sizeof(double) bytes of input */
- case 'd': {
- size = sizeof(double);
- break;
- }
- }
-
- /* Do actual unpacking */
- for (i = 0; (i != arg); i++ ) {
- /* Space for name + number, safe as namelen is ensured <= 200 */
- char n[256];
-
- if (arg != 1) {
- /* Need to add element number to name */
- sprintf(n, "%.*s%d", namelen, name, i + 1);
- } else {
- /* Truncate name to next format code or end of string */
- sprintf(n, "%.*s", namelen, name);
- }
-
- if ((inputpos + size) <= inputlen) {
- switch ((int)type) {
- case 'a': case 'A': {
- char pad = (type == 'a') ? '\0' : ' ';
- int len = inputlen - inputpos; /* Remaining string */
-
- /* If size was given take minimum of len and size */
- if ((size >= 0) && (len > size)) {
- len = size;
- }
-
- size = len;
-
- /* Remove padding chars from unpacked data */
- while (--len >= 0) {
- if (input[inputpos + len] != pad)
- break;
- }
-
- add_assoc_stringl(return_value, n, &input[inputpos], len + 1, 1);
- break;
- }
-
- case 'h': case 'H': {
- int len = (inputlen - inputpos) * 2; /* Remaining */
- int nibbleshift = (type == 'h') ? 0 : 4;
- int first = 1;
- char *buf;
- int ipos, opos;
-
- /* If size was given take minimum of len and size */
- if ((size >= 0) && (len > size)) {
- len = size;
- }
-
- size = (len + 1) / 2;
- buf = emalloc(len + 1);
-
- for (ipos = opos = 0; opos < len; opos++) {
- char c = (input[inputpos + ipos] >> nibbleshift) & 0xf;
-
- if (c < 10) {
- c += '0';
- } else {
- c += 'a' - 10;
- }
-
- buf[opos] = c;
- nibbleshift = (nibbleshift + 4) & 7;
-
- if (first-- == 0) {
- ipos++;
- first = 1;
- }
- }
-
- buf[len] = '\0';
- add_assoc_stringl(return_value, n, buf, len, 1);
- efree(buf);
- break;
- }
-
- case 'c': case 'C': {
- int issigned = (type == 'c') ? (input[inputpos] & 0x80) : 0;
- long v = _php3_unpack(&input[inputpos], 1, issigned, byte_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 's': case 'S': case 'n': case 'v': {
- long v;
- int issigned = 0;
- int *map = machine_endian_short_map;
-
- if (type == 's') {
- issigned = input[inputpos + (machine_little_endian ? 1 : 0)] & 0x80;
- } else if (type == 'n') {
- map = big_endian_short_map;
- } else if (type == 'v') {
- map = little_endian_short_map;
- }
-
- v = _php3_unpack(&input[inputpos], 2, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'i': case 'I': {
- long v;
- int issigned = 0;
-
- if (type == 'i') {
- issigned = input[inputpos + (machine_little_endian ? (sizeof(int) - 1) : 0)] & 0x80;
- }
-
- v = _php3_unpack(&input[inputpos], sizeof(int), issigned, int_map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'l': case 'L': case 'N': case 'V': {
- int issigned = 0;
- int *map = machine_endian_long_map;
- long v;
-
- if (type == 'l') {
- issigned = input[inputpos + (machine_little_endian ? 3 : 0)] & 0x80;
- } else if (type == 'N') {
- map = big_endian_long_map;
- } else if (type == 'V') {
- map = little_endian_long_map;
- }
-
- v = _php3_unpack(&input[inputpos], 4, issigned, map);
- add_assoc_long(return_value, n, v);
- break;
- }
-
- case 'f': {
- float v;
-
- memcpy(&v, &input[inputpos], sizeof(float));
- add_assoc_double(return_value, n, (double)v);
- break;
- }
-
- case 'd': {
- double v;
-
- memcpy(&v, &input[inputpos], sizeof(float));
- add_assoc_double(return_value, n, v);
- break;
- }
-
- case 'x': {
- /* Do nothing with input, just skip it */
- break;
- }
-
- case 'X': {
- if (inputpos < size) {
- inputpos = -size;
- i = arg - 1; /* Break out of for loop */
-
- if (arg >= 0) {
- php3_error(E_WARNING, "pack type %c: outside of string", type);
- }
- }
- break;
- }
-
- case '@': {
- if (arg <= inputlen) {
- inputpos = arg;
- } else {
- php3_error(E_WARNING, "pack type %c: outside of string", type);
- }
-
- i = arg - 1; /* Done, break out of for loop */
- break;
- }
- }
-
- inputpos += size;
- } else if (arg < 0) {
- /* Reached end of input for '*' repeater */
- break;
- } else {
- php3_error(E_ERROR, "pack type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
- RETURN_FALSE;
- }
- }
-
- formatlen--; /* Skip '/' separator, does no harm if inputlen == 0 */
- format++;
- }
-}
-/* }}} */
-
-
-int php3_minit_pack(INIT_FUNC_ARGS)
-{
- int machine_endian_check = 1;
- int i;
- TLS_VARS;
-
- machine_little_endian = ((char *)&machine_endian_check)[0];
-
- if (machine_little_endian) {
- /* Where to get lo to hi bytes from */
- byte_map[0] = 0;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = i;
- }
-
- machine_endian_short_map[0] = 0;
- machine_endian_short_map[1] = 1;
- big_endian_short_map[0] = 1;
- big_endian_short_map[1] = 0;
- little_endian_short_map[0] = 0;
- little_endian_short_map[1] = 1;
-
- machine_endian_long_map[0] = 0;
- machine_endian_long_map[1] = 1;
- machine_endian_long_map[2] = 2;
- machine_endian_long_map[3] = 3;
- big_endian_long_map[0] = 3;
- big_endian_long_map[1] = 2;
- big_endian_long_map[2] = 1;
- big_endian_long_map[3] = 0;
- little_endian_long_map[0] = 0;
- little_endian_long_map[1] = 1;
- little_endian_long_map[2] = 2;
- little_endian_long_map[3] = 3;
- }
- else {
- pval val;
- int size = sizeof(val.value.lval);
- val.value.lval=0; /*silence a warning*/
-
- /* Where to get hi to lo bytes from */
- byte_map[0] = size - 1;
-
- for (i = 0; i < sizeof(int); i++) {
- int_map[i] = size - (sizeof(int) - i);
- }
-
- machine_endian_short_map[0] = size - 2;
- machine_endian_short_map[1] = size - 1;
- big_endian_short_map[0] = size - 2;
- big_endian_short_map[1] = size - 1;
- little_endian_short_map[0] = size - 1;
- little_endian_short_map[1] = size - 2;
-
- machine_endian_long_map[0] = size - 4;
- machine_endian_long_map[1] = size - 3;
- machine_endian_long_map[2] = size - 2;
- machine_endian_long_map[3] = size - 1;
- big_endian_long_map[0] = size - 4;
- big_endian_long_map[1] = size - 3;
- big_endian_long_map[2] = size - 2;
- big_endian_long_map[3] = size - 1;
- little_endian_long_map[0] = size - 1;
- little_endian_long_map[1] = size - 2;
- little_endian_long_map[2] = size - 3;
- little_endian_long_map[3] = size - 4;
- }
-
- return SUCCESS;
-}
-
-
-
-/*
- * Local variables:
- * tab-width: 4
- * End:
- */
diff --git a/ext/standard/pack.h b/ext/standard/pack.h
deleted file mode 100644
index 36a55091a3..0000000000
--- a/ext/standard/pack.h
+++ /dev/null
@@ -1,42 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PACK_H
-#define _PACK_H
-
-extern php3_module_entry pack_module_entry;
-#define pack_module_ptr &pack_module_entry
-
-extern int php3_minit_pack(INIT_FUNC_ARGS);
-extern void php3_pack(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_unpack(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PACK_H */
diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c
deleted file mode 100644
index 2c072c7b35..0000000000
--- a/ext/standard/pageinfo.c
+++ /dev/null
@@ -1,159 +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$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "pageinfo.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_PWD_H
-#if MSVC5
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#if MSVC5
-#include <process.h>
-#endif
-
-#ifndef THREAD_SAFE
-static long page_uid = -1;
-static long page_inode = -1;
-static long page_mtime = -1;
-#endif
-
-static void _php3_statpage(void)
-{
-#if !APACHE
- char *path;
- struct stat sb;
-#endif
- TLS_VARS;
-
-#if APACHE
- /* Apache has already gone through the trouble of doing
- the stat(), so the only real overhead is copying three
- values. We can afford it, and it means we don't have to
- worry about resetting the static variables after every
- hit. */
- GLOBAL(page_uid) = GLOBAL(php3_rqst)->finfo.st_uid;
- GLOBAL(page_inode) = GLOBAL(php3_rqst)->finfo.st_ino;
- GLOBAL(page_mtime) = GLOBAL(php3_rqst)->finfo.st_mtime;
-#else
- if (GLOBAL(page_uid) == -1) {
- path = GLOBAL(request_info).filename;
- if (path != NULL) {
- if (stat(path, &sb) == -1) {
- php3_error(E_WARNING, "Unable to find file: '%s'", path);
- return;
- }
- GLOBAL(page_uid) = sb.st_uid;
- GLOBAL(page_inode) = sb.st_ino;
- GLOBAL(page_mtime) = sb.st_mtime;
- }
- }
-#endif
-}
-
-long _php3_getuid(void)
-{
- TLS_VARS;
- _php3_statpage();
- return (GLOBAL(page_uid));
-}
-
-/* {{{ proto int getmyuid(void)
- Get PHP script owner's UID */
-void php3_getmyuid(INTERNAL_FUNCTION_PARAMETERS)
-{
- long uid;
- TLS_VARS;
-
- uid = _php3_getuid();
- if (uid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(uid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmypid(void)
- Get current process ID */
-void php3_getmypid(INTERNAL_FUNCTION_PARAMETERS)
-{
- int pid;
- TLS_VARS;
-
- pid = getpid();
- if (pid < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG((long) pid);
- }
-}
-/* }}} */
-
-/* {{{ proto int getmyinode(void)
- Get the inode of the current script being parsed */
-void php3_getmyinode(INTERNAL_FUNCTION_PARAMETERS)
-{
- TLS_VARS;
-
- _php3_statpage();
- if (GLOBAL(page_inode) < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(GLOBAL(page_inode));
- }
-}
-/* }}} */
-
-/* {{{ proto int getlastmod(void)
- Get time of last page modification */
-void php3_getlastmod(INTERNAL_FUNCTION_PARAMETERS)
-{
- TLS_VARS;
-
- _php3_statpage();
- if (GLOBAL(page_mtime) < 0) {
- RETURN_FALSE;
- } else {
- RETURN_LONG(GLOBAL(page_mtime));
- }
-}
-/* }}} */
diff --git a/ext/standard/pageinfo.h b/ext/standard/pageinfo.h
deleted file mode 100644
index 963fe1c1c7..0000000000
--- a/ext/standard/pageinfo.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _PROCESS_H
-#define _PROCESS_H
-
-extern void php3_getmyuid(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getmypid(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getmyinode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getlastmod(INTERNAL_FUNCTION_PARAMETERS);
-
-extern long _php3_getuid(void);
-
-#endif
diff --git a/ext/standard/php3_browscap.h b/ext/standard/php3_browscap.h
deleted file mode 100644
index 0b5e8cafd4..0000000000
--- a/ext/standard/php3_browscap.h
+++ /dev/null
@@ -1,43 +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: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef _PHP3_BROWSCAP_H
-#define _PHP3_BROWSCAP_H
-
-extern php3_module_entry browscap_module_entry;
-#define browscap_module_ptr &browscap_module_entry
-
-extern int php3_minit_browscap(INIT_FUNC_ARGS);
-extern int php3_mshutdown_browscap(SHUTDOWN_FUNC_ARGS);
-
-extern void php3_get_browser(INTERNAL_FUNCTION_PARAMETERS);
-
-
-#endif /* _PHP3_BROWSCAP_H */
diff --git a/ext/standard/php3_dir.h b/ext/standard/php3_dir.h
deleted file mode 100644
index ee0e719dd7..0000000000
--- a/ext/standard/php3_dir.h
+++ /dev/null
@@ -1,48 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHP3_DIR_H
-#define _PHP3_DIR_H
-extern php3_module_entry php3_dir_module_entry;
-#define php3_dir_module_ptr &php3_dir_module_entry
-
-/* directory functions */
-extern int php3_minit_dir(INIT_FUNC_ARGS);
-extern void php3_opendir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_closedir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_readdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getdir(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PHP3_DIR_H */
diff --git a/ext/standard/php3_filestat.h b/ext/standard/php3_filestat.h
deleted file mode 100644
index 6c82124b36..0000000000
--- a/ext/standard/php3_filestat.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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _FILESTAT_H
-#define _FILESTAT_H
-
-extern int php3_init_filestat(INIT_FUNC_ARGS);
-extern int php3_shutdown_filestat(SHUTDOWN_FUNC_ARGS);
-extern void php3_clearstatcache(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileatime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_filectime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_filegroup(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileinode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_filemtime(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileowner(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileperms(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_filesize(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_filetype(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_iswritable(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_isreadable(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_isexec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_isfile(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_isdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_islink(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_fileexists(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_stat(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_lstat(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chown(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chgrp(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chmod(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_touch(INTERNAL_FUNCTION_PARAMETERS);
-
-extern php3_module_entry php3_filestat_module_entry;
-#define php3_filestat_module_ptr &php3_filestat_module_entry
-
-#endif /* _FILESTAT_H */
diff --git a/ext/standard/php3_iptc.h b/ext/standard/php3_iptc.h
deleted file mode 100644
index 4166fbd4ff..0000000000
--- a/ext/standard/php3_iptc.h
+++ /dev/null
@@ -1,38 +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: Thies C. Arntzen <thies@digicol.de> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHPIPTC_H
-#define _PHPIPTC_H
-
-extern void php3_iptcparse(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PHPIPTC_H */
diff --git a/ext/standard/php3_link.h b/ext/standard/php3_link.h
deleted file mode 100644
index 80718a893b..0000000000
--- a/ext/standard/php3_link.h
+++ /dev/null
@@ -1,41 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifndef _PHP3_LINK_H
-#define _PHP3_LINK_H
-
-extern void php3_link(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_unlink(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_readlink(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_linkinfo(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_symlink(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PHP3_LINK_H */
diff --git a/ext/standard/php3_mail.h b/ext/standard/php3_mail.h
deleted file mode 100644
index 3fb763ecb0..0000000000
--- a/ext/standard/php3_mail.h
+++ /dev/null
@@ -1,46 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _MAIL_H
-#define _MAIL_H
-#if HAVE_SENDMAIL
-extern php3_module_entry mail_module_entry;
-#define mail_module_ptr &mail_module_entry
-
-extern void php3_mail(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_info_mail(void);
-extern int _php3_mail(char *to, char *subject, char *message, char *headers);
-
-#else
-#define mail_module_ptr NULL
-#endif
-#endif /* _MAIL_H */
diff --git a/ext/standard/php3_standard.h b/ext/standard/php3_standard.h
deleted file mode 100644
index 828b3c4de6..0000000000
--- a/ext/standard/php3_standard.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: |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "basic_functions.h"
-#include "phpmath.h"
-#include "php3_string.h"
-#include "base64.h"
-#include "php3_dir.h"
-#include "dns.h"
-#include "reg.h"
-#include "php3_mail.h"
-#include "md5.h"
-#include "html.h"
-#include "exec.h"
-#include "file.h"
-#include "php3_syslog.h"
-#include "php3_filestat.h"
-#include "php3_browscap.h"
-#include "pack.h"
-#include "datetime.h"
-#include "microtime.h"
-#include "url.h"
-#include "pageinfo.h"
-#include "cyr_convert.h"
-#include "php3_link.h"
-#include "fsock.h"
-#include "image.h"
-#include "php3_iptc.h"
-#include "info.h"
-#include "uniqid.h"
-#include "php3_var.h"
-#include "quot_print.h"
-#include "type.h"
-
-#define standard_module_ptr basic_functions_module_ptr
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/php3_string.h b/ext/standard/php3_string.h
deleted file mode 100644
index eea721f5dd..0000000000
--- a/ext/standard/php3_string.h
+++ /dev/null
@@ -1,99 +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 <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHPSTRING_H
-#define _PHPSTRING_H
-
-#ifndef THREAD_SAFE
-extern char *strtok_string;
-#endif
-
-extern void php3_strlen(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strcmp(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strspn(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strcspn(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strcasecmp(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_str_replace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chop(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_trim(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ltrim(INTERNAL_FUNCTION_PARAMETERS);
-extern void soundex(INTERNAL_FUNCTION_PARAMETERS);
-
-extern void php3_explode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_implode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strtok(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strtoupper(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strtolower(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_basename(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dirname(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strstr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strpos(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strrpos(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strrchr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_substr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ucfirst(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ucwords(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strtr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_strrev(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_hebrev(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_hebrev_with_conversion(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_user_sprintf(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_user_printf(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_addslashes(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ord(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_newline_to_br(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_stristr(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chunk_split(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_parsestr(INTERNAL_FUNCTION_PARAMETERS);
-
-#if HAVE_CRYPT
-extern php3_module_entry crypt_module_entry;
-#define crypt_module_ptr &crypt_module_entry
-extern void php3_crypt(INTERNAL_FUNCTION_PARAMETERS);
-#else
-#define crypt_module_ptr NULL
-#endif
-
-extern PHPAPI char *_php3_strtoupper(char *s);
-extern PHPAPI char *_php3_strtolower(char *s);
-extern char *_StrTr(char *string, char *str_from, char *str_to);
-extern PHPAPI char *_php3_addslashes(char *string, int length, int *new_length, int freeit);
-extern PHPAPI void _php3_stripslashes(char *string, int *len);
-extern PHPAPI void _php3_dirname(char *str, int len);
-extern PHPAPI char *php3i_stristr(unsigned char *s, unsigned char *t);
-
-#endif /* _PHPSTRING_H */
diff --git a/ext/standard/php3_syslog.h b/ext/standard/php3_syslog.h
deleted file mode 100644
index 028a5aa018..0000000000
--- a/ext/standard/php3_syslog.h
+++ /dev/null
@@ -1,44 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-#if HAVE_SYSLOG_H
-extern php3_module_entry syslog_module_entry;
-#define syslog_module_ptr &syslog_module_entry
-
-extern int php3_minit_syslog(INIT_FUNC_ARGS);
-extern int php3_rinit_syslog(INIT_FUNC_ARGS);
-extern int php3_rshutdown_syslog(SHUTDOWN_FUNC_ARGS);
-extern void php3_openlog(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_syslog(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_closelog(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_define_syslog_variables(INTERNAL_FUNCTION_PARAMETERS);
-
-#else
-#define syslog_module_ptr NULL
-#endif
diff --git a/ext/standard/php3_var.h b/ext/standard/php3_var.h
deleted file mode 100644
index 238a0a3cb3..0000000000
--- a/ext/standard/php3_var.h
+++ /dev/null
@@ -1,42 +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: Jani Lehtimäki <jkl@njet.net> |
- +----------------------------------------------------------------------+
- */
-
-
-#ifndef _PHPVAR_H
-#define _PHPVAR_H
-
-PHP_FUNCTION(var_dump);
-PHP_FUNCTION(serialize);
-PHP_FUNCTION(unserialize);
-
-void php3api_var_dump(pval *struc, int level);
-void php3api_var_serialize(pval *buf, pval *struc);
-int php3api_var_unserialize(pval *rval, char **p, char *max);
-
-#endif /* _PHPVAR_H */
diff --git a/ext/standard/phpdir.h b/ext/standard/phpdir.h
deleted file mode 100644
index 5813f79c36..0000000000
--- a/ext/standard/phpdir.h
+++ /dev/null
@@ -1,44 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHPDIR_H
-#define _PHPDIR_H
-
-/* directory functions */
-extern void php3_opendir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_closedir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_chdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rewinddir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_readdir(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getdir(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PHPDIR_H */
diff --git a/ext/standard/phpmath.h b/ext/standard/phpmath.h
deleted file mode 100644
index ed3759018b..0000000000
--- a/ext/standard/phpmath.h
+++ /dev/null
@@ -1,70 +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) |
- | Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _PHPMATH_H
-#define _PHPMATH_H
-extern void php3_sin(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_cos(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_tan(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_asin(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_acos(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_atan(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_atan2(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_pi(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_exp(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_log(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_log10(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_pow(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_sqrt(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_srand(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rand(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_getrandmax(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_mt_srand(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_mt_rand(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_mt_getrandmax(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_abs(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_ceil(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_floor(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_round(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_decbin(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_dechex(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_decoct(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_bindec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_hexdec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_octdec(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_base_convert(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_number_format(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_deg2rad(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rad2deg(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _PHPMATH_H */
diff --git a/ext/standard/quot_print.c b/ext/standard/quot_print.c
deleted file mode 100644
index 55937d3b86..0000000000
--- a/ext/standard/quot_print.c
+++ /dev/null
@@ -1,109 +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: Kirill Maximov (kir@rus.net |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include <stdlib.h>
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include <errno.h>
-
-#include "php.h"
-#include "quot_print.h"
-
-#include <stdio.h>
-
-/*
-* Converting HEX char to INT value
-*/
-static char _php3_hex2int(int c)
-{
- if ( isdigit(c) )
- {
- return c - '0';
- }
- else if ( c >= 'A' && c <= 'F' )
- {
- return c - 'A' + 10;
- }
- else
- {
- return -1;
- }
-}
-
-/*
-*
-* Decoding Quoted-printable string.
-*
-*/
-/* {{{ proto string quoted_printable_decode(string str)
- Convert a quoted-printable string to an 8 bit string */
-void php3_quoted_printable_decode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1;
- char *str;
- int i = 0, j = 0;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&arg1)==FAILURE)
- {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg1);
-
- str = arg1->value.str.val;
- while ( str[i] )
- {
- if ( (str[i] == '=') && str[i+1] && str[i+2] &&
- ( isdigit((int)str[i+1]) || (str[i+1]<='F' && str[i+1]>='A'))
- &&
- ( isdigit((int)str[i+2]) || (str[i+2]<='F' && str[i+2]>='A'))
- )
- {
- str[j++] = (_php3_hex2int((int)str[i+1]) << 4 )
- + _php3_hex2int((int)str[i+2]);
- i += 3;
- }
- else if ( str[i] == 13 )
- {
- i++;
- }
- else
- {
- str[j++] = str[i++];
- }
- }
- str[j] = '\0';
-
- RETVAL_STRINGL(str, j, 1)
-}
-/* }}} */
diff --git a/ext/standard/quot_print.h b/ext/standard/quot_print.h
deleted file mode 100644
index abd959545f..0000000000
--- a/ext/standard/quot_print.h
+++ /dev/null
@@ -1,37 +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: Kirill Maximov (kir@rus.net) |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _QUOT_PRINT_H
-#define _QUOT_PRINT_H
-
-extern void php3_quoted_printable_decode(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _QUOT_PRINT_H */
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
deleted file mode 100644
index e117833296..0000000000
--- a/ext/standard/rand.c
+++ /dev/null
@@ -1,343 +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 <rasmus@lerdorf.on.ca> |
- | Zeev Suraski <zeev@zend.com |
- | Pedro Melo <melo@ip.pt> |
- | |
- | Based on code from: Shawn Cokus <Cokus@math.washington.edu> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-
-#include "php.h"
-#include "phpmath.h"
-
-#ifndef RAND_MAX
-#define RAND_MAX (1<<15)
-
-#endif
-
-/*
- This is the ``Mersenne Twister'' random number generator MT19937, which
- generates pseudorandom integers uniformly distributed in 0..(2^32 - 1)
- starting from any odd seed in 0..(2^32 - 1). This version is a recode
- by Shawn Cokus (Cokus@math.washington.edu) on March 8, 1998 of a version by
- Takuji Nishimura (who had suggestions from Topher Cooper and Marc Rieffel in
- July-August 1997).
-
- Effectiveness of the recoding (on Goedel2.math.washington.edu, a DEC Alpha
- running OSF/1) using GCC -O3 as a compiler: before recoding: 51.6 sec. to
- generate 300 million random numbers; after recoding: 24.0 sec. for the same
- (i.e., 46.5% of original time), so speed is now about 12.5 million random
- number generations per second on this machine.
-
- According to the URL <http://www.math.keio.ac.jp/~matumoto/emt.html>
- (and paraphrasing a bit in places), the Mersenne Twister is ``designed
- with consideration of the flaws of various existing generators,'' has
- a period of 2^19937 - 1, gives a sequence that is 623-dimensionally
- equidistributed, and ``has passed many stringent tests, including the
- die-hard test of G. Marsaglia and the load test of P. Hellekalek and
- S. Wegenkittl.'' It is efficient in memory usage (typically using 2506
- to 5012 bytes of static data, depending on data type sizes, and the code
- is quite short as well). It generates random numbers in batches of 624
- at a time, so the caching and pipelining of modern systems is exploited.
- It is also divide- and mod-free.
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public License as published by
- the Free Software Foundation (either version 2 of the License or, at your
- option, any later version). This library is distributed in the hope that
- it will be useful, but WITHOUT ANY WARRANTY, without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
- the GNU Library General Public License for more details. You should have
- received a copy of the GNU Library General Public License along with this
- library; if not, write to the Free Software Foundation, Inc., 59 Temple
- Place, Suite 330, Boston, MA 02111-1307, USA.
-
- The code as Shawn received it included the following notice:
-
- Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura. When
- you use this, send an e-mail to <matumoto@math.keio.ac.jp> with
- an appropriate reference to your work.
-
- It would be nice to CC: <Cokus@math.washington.edu> when you write.
-
-
-
- uint32 must be an unsigned integer type capable of holding at least 32
- bits; exactly 32 should be fastest, but 64 is better on an Alpha with
- GCC at -O3 optimization so try your options and see what's best for you
-
- Melo: we should put some ifdefs here to catch those alphas...
-*/
-
-typedef unsigned int uint32;
-
-#define N (624) /* length of state vector */
-#define M (397) /* a period parameter */
-#define K (0x9908B0DFU) /* a magic constant */
-#define hiBit(u) ((u) & 0x80000000U) /* mask all but highest bit of u */
-#define loBit(u) ((u) & 0x00000001U) /* mask all but lowest bit of u */
-#define loBits(u) ((u) & 0x7FFFFFFFU) /* mask the highest bit of u */
-#define mixBits(u, v) (hiBit(u)|loBits(v)) /* move hi bit of u to hi bit of v */
-
-static uint32 state[N+1]; /* state vector + 1 extra to not violate ANSI C */
-static uint32 *next; /* next random value is computed from here */
-static int left = -1; /* can *next++ this many times before reloading */
-
-
-static void seedMT(uint32 seed)
-{
- /*
- We initialize state[0..(N-1)] via the generator
-
- x_new = (69069 * x_old) mod 2^32
-
- from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
- _The Art of Computer Programming_, Volume 2, 3rd ed.
-
- Notes (SJC): I do not know what the initial state requirements
- of the Mersenne Twister are, but it seems this seeding generator
- could be better. It achieves the maximum period for its modulus
- (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
- x_initial can be even, you have sequences like 0, 0, 0, ...;
- 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
- 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
-
- Even if x_initial is odd, if x_initial is 1 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 0,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 1 1 0 0 1 1 0 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
- ...
-
- and if x_initial is 3 mod 4 then
-
- the lowest bit of x is always 1,
- the next-to-lowest bit of x is always 1,
- the 2nd-from-lowest bit of x alternates ... 0 1 0 1 0 1 0 1 ... ,
- the 3rd-from-lowest bit of x 4-cycles ... 0 0 1 1 0 0 1 1 ... ,
- the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
- ...
-
- The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
- 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth. It
- also does well in the dimension 2..5 spectral tests, but it could be
- better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
-
- Note that the random number user does not see the values generated
- here directly since reloadMT() will always munge them first, so maybe
- none of all of this matters. In fact, the seed values made here could
- even be extra-special desirable if the Mersenne Twister theory says
- so-- that's why the only change I made is to restrict to odd seeds.
- */
-
- register uint32 x = (seed | 1U) & 0xFFFFFFFFU, *s = state;
- register int j;
-
- for(left=0, *s++=x, j=N; --j;
- *s++ = (x*=69069U) & 0xFFFFFFFFU);
-}
-
-
-static uint32 reloadMT(void)
-{
- register uint32 *p0=state, *p2=state+2, *pM=state+M, s0, s1;
- register int j;
-
- if(left < -1)
- seedMT(4357U);
-
- left=N-1, next=state+1;
-
- for(s0=state[0], s1=state[1], j=N-M+1; --j; s0=s1, s1=*p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- for(pM=state, j=M; --j; s0=s1, s1=*p2++)
- *p0++ = *pM++ ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
-
- s1=state[0], *p0 = *pM ^ (mixBits(s0, s1) >> 1) ^ (loBit(s1) ? K : 0U);
- s1 ^= (s1 >> 11);
- s1 ^= (s1 << 7) & 0x9D2C5680U;
- s1 ^= (s1 << 15) & 0xEFC60000U;
- return(s1 ^ (s1 >> 18));
-}
-
-
-static inline uint32 randomMT(void)
-{
- uint32 y;
-
- if(--left < 0)
- return(reloadMT());
-
- y = *next++;
- y ^= (y >> 11);
- y ^= (y << 7) & 0x9D2C5680U;
- y ^= (y << 15) & 0xEFC60000U;
- return(y ^ (y >> 18));
-}
-
-
-#if HAVE_LRAND48
-#define PHP_RAND_MAX 2147483647
-#else
-#define PHP_RAND_MAX RAND_MAX
-#endif
-
-void php3_srand(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg);
-#ifdef HAVE_SRAND48
- srand48((unsigned int) arg->value.lval);
-#else
-#ifdef HAVE_SRANDOM
- srandom((unsigned int) arg->value.lval);
-#else
- srand((unsigned int) arg->value.lval);
-#endif
-#endif
-}
-
-void php3_mt_srand(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(arg);
- seedMT(arg->value.lval);
-}
-
-void php3_rand(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *p_min=NULL, *p_max=NULL;
-
- switch (ARG_COUNT(ht)) {
- case 0:
- break;
- case 2:
- if (getParameters(ht, 2, &p_min, &p_max)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(p_min);
- convert_to_long(p_max);
- if (p_max->value.lval-p_min->value.lval <= 0) {
- php3_error(E_WARNING,"rand(): Invalid range: %ld..%ld", p_min->value.lval, p_max->value.lval);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
-#ifdef HAVE_LRAND48
- return_value->value.lval = lrand48();
-#else
-#ifdef HAVE_RANDOM
- return_value->value.lval = random();
-#else
- return_value->value.lval = rand();
-#endif
-#endif
-
- if (p_min && p_max) { /* implement range */
- return_value->value.lval = p_min->value.lval +
- (int)((double)p_max->value.lval * return_value->value.lval/(PHP_RAND_MAX+(double)p_min->value.lval));
- }
-}
-
-void php3_mt_rand(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *p_min=NULL, *p_max=NULL;
-
- switch (ARG_COUNT(ht)) {
- case 0:
- break;
- case 2:
- if (getParameters(ht, 2, &p_min, &p_max)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(p_min);
- convert_to_long(p_max);
- if (p_max->value.lval-p_min->value.lval <= 0) {
- php3_error(E_WARNING,"mtrand(): Invalid range: %ld..%ld", p_min->value.lval, p_max->value.lval);
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- return_value->type = IS_LONG;
- /*
- * Melo: hmms.. randomMT() returns 32 random bits...
- * Yet, the previous php3_rand only returns 31 at most.
- * So I put a right shift to loose the lsb. It *seems*
- * better than clearing the msb.
- * Update:
- * I talked with Cokus via email and it won't ruin the algorithm
- */
- return_value->value.lval = (long)(randomMT() >> 1);
-
- if (p_min && p_max) { /* implement range */
- return_value->value.lval = p_min->value.lval +
- (int)((double)p_max->value.lval * return_value->value.lval/(PHP_RAND_MAX+(double)p_min->value.lval));
- }
-}
-
-void php3_getrandmax(INTERNAL_FUNCTION_PARAMETERS)
-{
- return_value->type = IS_LONG;
- return_value->value.lval = PHP_RAND_MAX;
-}
-
-void php3_mt_getrandmax(INTERNAL_FUNCTION_PARAMETERS)
-{
- return_value->type = IS_LONG;
- /*
- * Melo: it could be 2^^32 but we only use 2^^31 to maintain
- * compatibility with the previous php3_rand
- */
- return_value->value.lval = 2147483647; /* 2^^31 */
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/reg.c b/ext/standard/reg.c
deleted file mode 100644
index 42d36493d6..0000000000
--- a/ext/standard/reg.c
+++ /dev/null
@@ -1,569 +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 <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- | Jaakko Hyvätti <jaakko@hyvatti.iki.fi> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include "php.h"
-#include "php3_string.h"
-#include "reg.h"
-
-unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
-
-function_entry reg_functions[] = {
- {"ereg", php3_ereg, third_argument_force_ref },
- {"ereg_replace", php3_eregreplace, NULL },
- {"eregi", php3_eregi, third_argument_force_ref },
- {"eregi_replace", php3_eregireplace, NULL },
- {"split", php3_split, NULL},
- {"join", php3_implode, NULL},
- {"sql_regcase", php3_sql_regcase, NULL},
- {NULL, NULL, NULL}
-};
-
-php3_module_entry regexp_module_entry = {
- "Regular Expressions", reg_functions, NULL, NULL, NULL, NULL, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-/* 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);
-
- php3_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;
- TLS_VARS;
-
- if (icase)
- copts |= REG_ICASE;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &regex, &findin) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- /* don't bother doing substring matching if we're not going
- to make use of the information */
- copts |= REG_NOSUB;
- break;
- case 3:
- if (getParameters(ht, 3, &regex, &findin, &array) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (!ParameterPassedByReference(ht, 3)) {
- php3_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) {
- php3_error(E_WARNING, "Unable to allocate memory in _php3_ereg");
- RETURN_FALSE;
- }
-
- pval_destructor(array _INLINE_TLS); /* 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);
- }
- }
- 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 */
-void php3_ereg(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_ereg(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto int eregi(string pattern, string string [, array registers])
- Case-insensitive regular expression match */
-void php3_eregi(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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 (!string_len)
- return (char *)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) {
- php3_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 <Jaakko.Hyvatti@iki.fi>
- */
-
- new_l = strlen(buf) + subs[0].rm_so; /* part before the match */
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- new_l += subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- walk += 2;
- } else {
- new_l++;
- walk++;
- }
-
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len);
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- tmp = strlen(buf);
- /* copy the part of the string before the match */
- strncat(buf, &string[pos], subs[0].rm_so);
-
- /* copy replacement and backrefs */
- walkbuf = &buf[tmp + subs[0].rm_so];
- walk = replace;
- while (*walk)
- if ('\\' == *walk
- && '0' <= walk[1] && '9' >= walk[1]
- && subs[walk[1] - '0'].rm_so > -1
- && subs[walk[1] - '0'].rm_eo > -1) {
- tmp = subs[walk[1] - '0'].rm_eo
- - subs[walk[1] - '0'].rm_so;
- memcpy (walkbuf,
- &string[pos + subs[walk[1] - '0'].rm_so],
- tmp);
- walkbuf += tmp;
- walk += 2;
- } else
- *walkbuf++ = *walk++;
- *walkbuf = '\0';
-
- /* and get ready to keep looking for replacements */
- if (subs[0].rm_so == subs[0].rm_eo) {
- if (subs[0].rm_so + pos >= string_len)
- break;
- new_l = strlen (buf) + 1;
- if (new_l + 1 > buf_len) {
- buf_len = 1 + buf_len + 2 * new_l;
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- pos += subs[0].rm_eo + 1;
- buf [new_l-1] = string [pos-1];
- buf [new_l] = '\0';
- } else {
- pos += subs[0].rm_eo;
- }
- } else { /* REG_NOMATCH */
- new_l = strlen(buf) + strlen(&string[pos]);
- if (new_l + 1 > buf_len) {
- buf_len = new_l + 1; /* now we know exactly how long it is */
- nbuf = emalloc(buf_len * sizeof(char));
- strcpy(nbuf, buf);
- efree(buf);
- buf = nbuf;
- }
- /* stick that last bit of string on our output */
- strcat(buf, &string[pos]);
- }
- }
-
- /* don't want to leak memory .. */
- regfree(&re);
-
- /* whew. */
- return (buf);
-}
-
-static void _php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS, int icase)
-{
- pval *arg_pattern,
- *arg_replace,
- *arg_string;
- char *pattern;
- char *string;
- char *replace;
- char *ret;
- TLS_VARS;
-
- 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 */
-void php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_eregreplace(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
-}
-/* }}} */
-
-/* {{{ proto string eregi_replace(string pattern, string string [, array registers])
- Case insensitive replace regular expression */
-void php3_eregireplace(INTERNAL_FUNCTION_PARAMETERS)
-{
- _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 */
-void php3_split(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *spliton, *str, *arg_count = NULL;
- regex_t re;
- regmatch_t subs[1];
- char *strp, *endp;
- int err, size, count;
- TLS_VARS;
-
- 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) {
- php3_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);
- php3_error(E_WARNING, "bad regular expression for split()");
- _php3_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) {
- php3_error(E_WARNING, "unexpected regex error (%d)", err);
- regfree(&re);
- _php3_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 void php3_sql_regcase(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *string;
- char *tmp;
- register int i;
-
- 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=0; i<string->value.str.len; i++) {
- tmp[i*4] = '[';
- tmp[i*4+1]=toupper((unsigned char)string->value.str.val[i]);
- tmp[i*4+2]=tolower((unsigned char)string->value.str.val[i]);
- tmp[i*4+3]=']';
- }
- tmp[string->value.str.len*4]=0;
-
- return_value->value.str.val = tmp;
- return_value->value.str.len = string->value.str.len*4;
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/reg.h b/ext/standard/reg.h
deleted file mode 100644
index bb33aa768f..0000000000
--- a/ext/standard/reg.h
+++ /dev/null
@@ -1,48 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _REG_H
-#define _REG_H
-
-extern php3_module_entry regexp_module_entry;
-#define regexp_module_ptr &regexp_module_entry
-
-extern char *_php3_regreplace(const char *pattern, const char *replace, const char *string, int icase, int extended);
-
-extern void php3_ereg(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregi(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregireplace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_eregreplace(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_split(INTERNAL_FUNCTION_PARAMETERS);
-extern PHPAPI void php3_sql_regcase(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _REG_H */
diff --git a/ext/standard/soundex.c b/ext/standard/soundex.c
deleted file mode 100644
index 24eef3fcc9..0000000000
--- a/ext/standard/soundex.c
+++ /dev/null
@@ -1,136 +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. |
- +----------------------------------------------------------------------+
- | Author: Bjørn Borud - Guardian Networks AS <borud@guardian.no> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include "php.h"
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include "php3_string.h"
-
-/* Simple soundex algorithm as described by Knuth in TAOCP, vol 3 */
-/* {{{ proto string soundex(string str)
- Calculate the soundex key of a string */
-void soundex(INTERNAL_FUNCTION_PARAMETERS)
-{
- char l, u;
- char *somestring;
- int i, j, n;
- pval *arg;
-
- /* pad with '0' and terminate with 0 ;-) */
- char soundex[5] =
- {'0', '0', '0', '0', 0};
-
- static char soundex_table[26] =
- {0, /* A */
- '1', /* B */
- '2', /* C */
- '3', /* D */
- 0, /* E */
- '1', /* F */
- '2', /* G */
- 0, /* H */
- 0, /* I */
- '2', /* J */
- '2', /* K */
- '4', /* L */
- '5', /* M */
- '5', /* N */
- 0, /* O */
- '1', /* P */
- '2', /* Q */
- '6', /* R */
- '2', /* S */
- '3', /* T */
- 0, /* U */
- '1', /* V */
- 0, /* W */
- '2', /* X */
- 0, /* Y */
- '2'}; /* Z */
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
- if (arg->value.str.len==0) {
- RETURN_FALSE;
- }
-
- somestring = arg->value.str.val;
-
- n = arg->value.str.len;
-
- /* convert chars to upper case and strip non-letter chars */
- j = 0;
- for (i = 0; i < n; i++) {
- u = toupper(somestring[i]);
- if ((u > 64) && (u < 91)) {
- somestring[j] = u;
- j++;
- }
- }
-
- /* null-terminate string */
- somestring[j] = 0;
-
- n = strlen(somestring);
-
- /* prefix soundex string with first valid char */
- soundex[0] = somestring[0];
-
- /* remember first char */
- l = soundex_table[((somestring[0]) - 65)];
-
- j = 1;
-
- /* build soundex string */
- for (i = 1; i < n && j < 4; i++) {
- u = soundex_table[((somestring[i]) - 65)];
-
- if (u != l) {
- if (u != 0) {
- soundex[(int) j++] = u;
- }
- l = u;
- }
- }
-
- return_value->value.str.val = estrndup(soundex, 4);
- return_value->value.str.len = strlen(soundex);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/string.c b/ext/standard/string.c
deleted file mode 100644
index 7f56d03a22..0000000000
--- a/ext/standard/string.c
+++ /dev/null
@@ -1,1590 +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 <rasmus@lerdorf.on.ca> |
- | Stig Sæther Bakken <ssb@guardian.no> |
- | Zeev Suraski <bourbon@nevision.net.il> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include "php.h"
-#include "reg.h"
-#include "functions/post.h"
-#include "php3_string.h"
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend_execute.h"
-#include "php_globals.h"
-
-
-/* {{{ proto int strlen(string str)
- Get string length */
-void php3_strlen(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- RETVAL_LONG(str->value.str.len);
-}
-/* }}} */
-
-/* {{{ proto int strcmp(string str1, string str2)
- Binary safe string comparison */
-void php3_strcmp(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(php3_binary_strcmp(s1,s2));
-}
-/* }}} */
-
-/* {{{ proto int strcasecmp(string str1, string str2)
- Binary safe case-insensitive string comparison */
-void php3_strcasecmp(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(strcasecmp(s1->value.str.val,s2->value.str.val));
-}
-/* }}} */
-
-/* {{{ proto int strspn(string str, string mask)
- Find length of initial segment consisting entirely of characters found in mask */
-void php3_strspn(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(strspn(s1->value.str.val,s2->value.str.val));
-}
-/* }}} */
-
-/* {{{ proto int strcspn(string str, string mask)
- Find length of initial segment consisting entirely of characters not found in mask */
-void php3_strcspn(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *s1,*s2;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &s1, &s2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(s1);
- convert_to_string(s2);
- RETURN_LONG(strcspn(s1->value.str.val,s2->value.str.val));
-}
-/* }}} */
-
-/* {{{ proto string chop(string str)
- Remove trailing whitespace */
-void php3_chop(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- register int i;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- if (str->type == IS_STRING) {
- int len = str->value.str.len;
- char *c = str->value.str.val;
- for (i = len - 1; i >= 0; i--) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v') {
- len--;
- } else {
- break;
- }
- }
- RETVAL_STRINGL(c, len, 1);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string trim(string str)
- Strip whitespace from the beginning and end of a string */
-void php3_trim(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- register int i;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- if (str->type == IS_STRING) {
- int len = str->value.str.len;
- int trimmed = 0;
- char *c = str->value.str.val;
- for (i = 0; i < len; i++) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v') {
- trimmed++;
- } else {
- break;
- }
- }
- len-=trimmed;
- c+=trimmed;
- for (i = len - 1; i >= 0; i--) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v') {
- len--;
- } else {
- break;
- }
- }
- RETVAL_STRINGL(c, len, 1);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto string ltrim(string str)
- Strip whitespace from the beginning of a string */
-void php3_ltrim(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- register int i;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- if (str->type == IS_STRING) {
- int len = str->value.str.len;
- int trimmed = 0;
- char *c = str->value.str.val;
- for (i = 0; i < len; i++) {
- if (c[i] == ' ' || c[i] == '\n' || c[i] == '\r' ||
- c[i] == '\t' || c[i] == '\v') {
- trimmed++;
- } else {
- break;
- }
- }
- RETVAL_STRINGL(c+trimmed, len-trimmed, 1);
- return;
- }
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto array(string separator, string str)
- Split a string on string separator and return array of components */
-void php3_explode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str, *delim;
- char *work_str, *p1, *p2;
- int i = 0;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &delim, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- convert_to_string(delim);
-
- if (strlen(delim->value.str.val)==0) {
- /* the delimiter must be a valid C string that's at least 1 character long */
- php3_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- if (array_init(return_value) == FAILURE) {
- return;
- }
- work_str = p1 = estrndup(str->value.str.val,str->value.str.len);
- p2 = strstr(p1, delim->value.str.val);
- if (p2 == NULL) {
- add_index_string(return_value, i++, p1, 1);
- } else do {
- p2[0] = 0;
- add_index_string(return_value, i++, p1, 1);
- p1 = p2 + delim->value.str.len;
- } while ((p2 = strstr(p1, delim->value.str.val)) && p2 != work_str);
- if (p1 != work_str) {
- add_index_string(return_value, i++, p1, 1);
- }
- efree(work_str);
-}
-/* }}} */
-
-/* {{{ proto string implode(array src, string glue)
- Join array elements placing glue string between items and return one string */
-void php3_implode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg1, *arg2, *delim, *tmp, *arr;
- int len = 0, count = 0;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- if (arg1->type == IS_ARRAY && arg2->type == IS_STRING) {
- arr = arg1;
- delim = arg2;
- } else if (arg2->type == IS_ARRAY) {
- convert_to_string(arg1);
- arr = arg2;
- delim = arg1;
- } else {
- php3_error(E_WARNING, "Bad arguments to %s()",
- get_active_function_name());
- return;
- }
-
- /* convert everything to strings, and calculate length */
- _php3_hash_internal_pointer_reset(arr->value.ht);
- while (_php3_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
- convert_to_string(tmp);
- if (tmp->type == IS_STRING) {
- len += tmp->value.str.len;
- if (count>0) {
- len += delim->value.str.len;
- }
- count++;
- }
- _php3_hash_move_forward(arr->value.ht);
- }
-
- /* do it */
- return_value->value.str.val = (char *) emalloc(len + 1);
- return_value->value.str.val[0] = '\0';
- return_value->value.str.val[len] = '\0';
- _php3_hash_internal_pointer_reset(arr->value.ht);
- while (_php3_hash_get_current_data(arr->value.ht, (void **) &tmp) == SUCCESS) {
- if (tmp->type == IS_STRING) {
- count--;
- strcat(return_value->value.str.val, tmp->value.str.val);
- if (count > 0) {
- strcat(return_value->value.str.val, delim->value.str.val);
- }
- }
- _php3_hash_move_forward(arr->value.ht);
- }
- return_value->type = IS_STRING;
- return_value->value.str.len = len;
-}
-/* }}} */
-
-#ifndef THREAD_SAFE
-char *strtok_string;
-#endif
-
-/* {{{ proto string strtok([string str,] string token)
- Tokenize a string */
-void php3_strtok(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str, *tok;
-#ifndef THREAD_SAFE
- static char *strtok_pos1 = NULL;
- static char *strtok_pos2 = NULL;
-#endif
- char *token = NULL, *tokp=NULL;
- char *first = NULL;
- int argc;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
-
- if ((argc == 1 && getParameters(ht, 1, &tok) == FAILURE) ||
- (argc == 2 && getParameters(ht, 2, &str, &tok) == FAILURE) ||
- argc < 1 || argc > 2) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(tok);
- tokp = token = tok->value.str.val;
-
- if (argc == 2) {
- convert_to_string(str);
-
- STR_FREE(GLOBAL(strtok_string));
- GLOBAL(strtok_string) = estrndup(str->value.str.val,str->value.str.len);
- STATIC(strtok_pos1) = GLOBAL(strtok_string);
- STATIC(strtok_pos2) = NULL;
- }
- if (STATIC(strtok_pos1) && *STATIC(strtok_pos1)) {
- for ( /* NOP */ ; token && *token; token++) {
- STATIC(strtok_pos2) = strchr(STATIC(strtok_pos1), (int) *token);
- if (!first || (STATIC(strtok_pos2) && STATIC(strtok_pos2) < first)) {
- first = STATIC(strtok_pos2);
- }
- } /* NB: token is unusable now */
-
- STATIC(strtok_pos2) = first;
- if (STATIC(strtok_pos2)) {
- *STATIC(strtok_pos2) = '\0';
- }
- RETVAL_STRING(STATIC(strtok_pos1),1);
-#if 0
- /* skip 'token' white space for next call to strtok */
- while (STATIC(strtok_pos2) &&
- strchr(tokp, *(STATIC(strtok_pos2)+1))) {
- STATIC(strtok_pos2)++;
- }
-#endif
- if (STATIC(strtok_pos2))
- STATIC(strtok_pos1) = STATIC(strtok_pos2) + 1;
- else
- STATIC(strtok_pos1) = NULL;
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-PHPAPI char *_php3_strtoupper(char *s)
-{
- char *c;
- int ch;
-
- c = s;
- while (*c) {
- ch = toupper((unsigned char)*c);
- *c++ = ch;
- }
- return (s);
-}
-
-/* {{{ proto string strtoupper(string str)
- Make a string uppercase */
-void php3_strtoupper(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- ret = _php3_strtoupper(arg->value.str.val);
- RETVAL_STRING(ret,1);
-}
-/* }}} */
-
-
-PHPAPI char *_php3_strtolower(char *s)
-{
- register int ch;
- char *c;
-
- c = s;
- while (*c) {
- ch = tolower((unsigned char)*c);
- *c++ = ch;
- }
- return (s);
-}
-
-/* {{{ proto string strtolower(string str)
- Make a string lowercase */
-void php3_strtolower(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- char *ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- ret = _php3_strtolower(str->value.str.val);
- RETVAL_STRING(ret,1);
-}
-/* }}} */
-
-/* {{{ proto string basename(string path)
- Return the filename component of the path */
-void php3_basename(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- char *ret, *c;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- ret = estrdup(str->value.str.val);
- c = ret + str->value.str.len -1;
- while (*c == '/'
-#ifdef MSVC5
- || *c == '\\'
-#endif
- )
- c--;
- *(c + 1) = '\0';
- if ((c = strrchr(ret, '/'))
-#ifdef MSVC5
- || (c = strrchr(ret, '\\'))
-#endif
- ) {
- RETVAL_STRING(c + 1,1);
- } else {
- RETVAL_STRING(str->value.str.val,1);
- }
- efree(ret);
-}
-/* }}} */
-
-PHPAPI void _php3_dirname(char *str, int len) {
- register char *c;
-
- c = str + len - 1;
- while (*c == '/'
-#ifdef MSVC5
- || *c == '\\'
-#endif
- )
- c--; /* strip trailing slashes */
- *(c + 1) = '\0';
- if ((c = strrchr(str, '/'))
-#ifdef MSVC5
- || (c = strrchr(str, '\\'))
-#endif
- )
- *c='\0';
-}
-
-/* {{{ proto string dirname(string path)
- Return the directory name component of the path */
-void php3_dirname(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- char *ret;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str)) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- ret = estrdup(str->value.str.val);
- _php3_dirname(ret,str->value.str.len);
- RETVAL_STRING(ret,1);
- efree(ret);
-}
-/* }}} */
-
-
-/* case-insensitve strstr */
-PHPAPI char *php3i_stristr(unsigned char *s, unsigned char *t)
-{
- int i, j, k, l;
-
- for (i = 0; s[i]; i++) {
- for (j = 0, l = k = i; s[k] && t[j] &&
- tolower(s[k]) == tolower(t[j]); j++, k++)
- ;
- if (t[j] == '\0')
- return s + l;
- }
- return NULL;
-}
-
-/* {{{ proto string strstr(string haystack, string needle)
- Find first occurrence of a string within another, case insensitive */
-void php3_stristr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle;
- char *found = NULL;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(haystack);
- convert_to_string(needle);
-
- if (strlen(needle->value.str.val)==0) {
- php3_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- found = php3i_stristr(haystack->value.str.val, needle->value.str.val);
-
- if (found) {
- RETVAL_STRING(found,1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string strstr(string haystack, string needle)
- Find first occurrence of a string within another */
-void php3_strstr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle;
- char *found = NULL;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(haystack);
-
- if (needle->type == IS_STRING) {
- if (strlen(needle->value.str.val)==0) {
- php3_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- found = strstr(haystack->value.str.val, needle->value.str.val);
- } else {
- convert_to_long(needle);
- found = strchr(haystack->value.str.val, (char) needle->value.lval);
- }
-
-
- if (found) {
- RETVAL_STRING(found,1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int strpos(string haystack, string needle)
- Find position of first occurrence of a string within another */
-void php3_strpos(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle, *OFFSET;
- int offset = 0;
- char *found = NULL;
- TLS_VARS;
-
- switch(ARG_COUNT(ht)) {
- case 2:
- if (getParameters(ht, 2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- break;
- case 3:
- if (getParameters(ht, 3, &haystack, &needle, &OFFSET) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(OFFSET);
- offset = OFFSET->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- }
- convert_to_string(haystack);
- if (offset > haystack->value.str.len) {
- php3_error(E_WARNING,"offset not contained in string");
- RETURN_FALSE;
- }
-
- if (needle->type == IS_STRING) {
- if (needle->value.str.len==0) {
- php3_error(E_WARNING,"Empty delimiter");
- RETURN_FALSE;
- }
- found = strstr(haystack->value.str.val+offset, needle->value.str.val);
- } else {
- convert_to_long(needle);
- found = strchr(haystack->value.str.val+offset, (char) needle->value.lval);
- }
-
- if (found) {
- RETVAL_LONG(found - haystack->value.str.val);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto int strrpos(string haystack, string needle)
- Find the last occurrence of a character in a string within another */
-void php3_strrpos(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle;
- char *found = NULL;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(haystack);
-
- if (needle->type == IS_STRING) {
- found = strrchr(haystack->value.str.val, *needle->value.str.val);
- } else {
- convert_to_long(needle);
- found = strrchr(haystack->value.str.val, (char) needle->value.lval);
- }
-
- if (found) {
- RETVAL_LONG(haystack->value.str.len - strlen(found));
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string strrchr(string haystack, string needle)
- Find the last occurrence of a character in a string within another */
-void php3_strrchr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle;
- char *found = NULL;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &haystack, &needle) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(haystack);
-
- if (needle->type == IS_STRING) {
- found = strrchr(haystack->value.str.val, *needle->value.str.val);
- } else {
-
- convert_to_long(needle);
- found = strrchr(haystack->value.str.val, needle->value.lval);
- }
-
-
- if (found) {
- RETVAL_STRING(found,1);
- } else {
- RETVAL_FALSE;
- }
-}
-/* }}} */
-
-static char *
-_php3_chunk_split(char *src, int srclen, char *end, int endlen, int chunklen)
-{
- char *dest;
- char *p, *q;
- int chunks; /* complete chunks! */
- int restlen;
-
- chunks = srclen / chunklen;
- restlen = srclen - chunks * chunklen; /* srclen % chunklen */
-
- dest = emalloc((srclen + (chunks + 1) * endlen + 1) * sizeof(char));
-
- for(p = src, q = dest; p < (src + srclen - chunklen + 1); ) {
- memcpy(q, p, chunklen);
- q += chunklen;
- memcpy(q, end, endlen);
- q += endlen;
- p += chunklen;
- }
-
- if(restlen) {
- memcpy(q, p, restlen);
- q += restlen;
- memcpy(q, end, endlen);
- q += endlen;
- }
-
- *q = '\0';
-
- return(dest);
-}
-
-/* {{{ proto string chunk_split(string str [, int chunklen [, string ending]])
- Return split line */
-void php3_chunk_split(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *p_str, *p_chunklen, *p_ending;
- int argc;
- char *result;
- char *end = "\r\n";
- int endlen = 2;
- int chunklen = 76;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
-
- if(!((argc == 1 && getParameters(ht, 1, &p_str) != FAILURE) ||
- (argc == 2 && getParameters(ht, 2, &p_str, &p_chunklen) != FAILURE) ||
- (argc == 3 && getParameters(ht, 3, &p_str, &p_chunklen,
- &p_ending) != FAILURE))) {
- WRONG_PARAM_COUNT;
- }
-
- switch(argc) {
- case 3:
- convert_to_string(p_ending);
- end = p_ending->value.str.val;
- endlen = p_ending->value.str.len;
- case 2:
- convert_to_long(p_chunklen);
- chunklen = p_chunklen->value.lval;
- case 1:
- convert_to_string(p_str);
- }
-
- if(chunklen == 0) {
- php3_error(E_WARNING, "chunk length is 0");
- RETURN_FALSE;
- }
-
- result = _php3_chunk_split(p_str->value.str.val, p_str->value.str.len,
- end, endlen, chunklen);
-
- if(result) {
- RETVAL_STRING(result, 0);
- } else {
- RETURN_FALSE;
- }
-}
-/* }}} */
-
-/* {{{ proto string substr(string str, int start [, int length])
- Return part of a string */
-void php3_substr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *string, *from, *len;
- int argc, l;
- int f;
- TLS_VARS;
-
- argc = ARG_COUNT(ht);
-
- if ((argc == 2 && getParameters(ht, 2, &string, &from) == FAILURE) ||
- (argc == 3 && getParameters(ht, 3, &string, &from, &len) == FAILURE) ||
- argc < 2 || argc > 3) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(string);
- convert_to_long(from);
- f = from->value.lval;
-
- if (argc == 2) {
- l = string->value.str.len;
- } else {
- convert_to_long(len);
- l = len->value.lval;
- }
-
- /* if "from" position is negative, count start position from the end
- * of the string
- */
- if (f < 0) {
- f = string->value.str.len + f;
- if (f < 0) {
- f = 0;
- }
- }
-
- /* if "length" position is negative, set it to the length
- * needed to stop that many chars from the end of the string
- */
- if (l < 0) {
- l = (string->value.str.len - f) + l;
- if (l < 0) {
- l = 0;
- }
- }
-
- if (f >= (int)string->value.str.len) {
- RETURN_FALSE;
- }
-
- if ((f + l) < (int)string->value.str.len) {
- string->value.str.val[f + l] = '\0';
- }
- RETVAL_STRING(string->value.str.val + f,1);
-}
-/* }}} */
-
-/* {{{ proto string quotemeta(string str)
- Quote meta characters */
-void php3_quotemeta(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *str, *old;
- char *p, *q;
- char c;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- old = arg->value.str.val;
-
- if (!*old) {
- RETURN_FALSE;
- }
-
- str = emalloc(2 * arg->value.str.len + 1);
-
- for(p = old, q = str; (c = *p); p++) {
- switch(c) {
- case '.':
- case '\\':
- case '+':
- case '*':
- case '?':
- case '[':
- case '^':
- case ']':
- case '$':
- case '(':
- case ')':
- *q++ = '\\';
- /* break is missing _intentionally_ */
- default:
- *q++ = c;
- }
- }
- *q = 0;
- RETVAL_STRING(erealloc(str, q - str + 1), 0);
-}
-/* }}} */
-
-/* {{{ proto int ord(string character)
- Return ASCII value of character */
-void php3_ord(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- RETVAL_LONG((unsigned char)str->value.str.val[0]);
-}
-/* }}} */
-
-/* {{{ proto string chr(int ascii)
- Convert ASCII code to a character */
-void php3_chr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *num;
- char temp[2];
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(num);
- temp[0] = (char) num->value.lval;
- temp[1] = '\0';
- RETVAL_STRINGL(temp, 1,1);
-}
-/* }}} */
-
-/* {{{ proto string(string str)
- Make a string's first character uppercase */
-void php3_ucfirst(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!*arg->value.str.val) {
- RETURN_FALSE;
- }
- *arg->value.str.val = toupper((unsigned char)*arg->value.str.val);
- RETVAL_STRING(arg->value.str.val,1);
-}
-/* }}} */
-
-/* {{{ proto string ucwords(string str)
- Uppercase the first character of every word in a string */
-void php3_ucwords(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *r;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!*arg->value.str.val) {
- RETURN_FALSE;
- }
- *arg->value.str.val = toupper((unsigned char)*arg->value.str.val);
- r=arg->value.str.val;
- while((r=strstr(r," "))){
- if(*(r+1)){
- r++;
- *r=toupper((unsigned char)*r);
- }
- }
- RETVAL_STRING(arg->value.str.val,1);
-}
-/* }}} */
-
-/* {{{ proto string strtr(string str, string from, string to)
- Translate characters in str using given translation tables */
-void php3_strtr(INTERNAL_FUNCTION_PARAMETERS)
-{ /* strtr(STRING,FROM,TO) */
- pval *str, *from, *to;
- unsigned char xlat[256];
- unsigned char *str_from, *str_to, *string;
- int i, len1, len2;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &str, &from, &to) ==
- FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- convert_to_string(from);
- convert_to_string(to);
-
- string = (unsigned char*) str->value.str.val;
- str_from = (unsigned char*) from->value.str.val;
- str_to = (unsigned char*) to->value.str.val;
-
- len1 = from->value.str.len;
- len2 = to->value.str.len;
-
- if (len1 > len2) {
- str_from[len2] = '\0';
- len1 = len2;
- }
- for (i = 0; i < 256; xlat[i] = i, i++);
-
- for (i = 0; i < len1; i++) {
- xlat[(unsigned char) str_from[i]] = str_to[i];
- }
-
- for (i = 0; i < str->value.str.len; i++) {
- string[i] = xlat[(unsigned char) string[i]];
- }
-
- RETVAL_STRING((char *)string,1);
-}
-/* }}} */
-
-
-/* {{{ proto string strrev(string str)
- Reverse a string */
-void php3_strrev(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- int i,len;
- char c;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &str)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(str);
-
- len = str->value.str.len;
-
- for (i=0; i<len-1-i; i++) {
- c=str->value.str.val[i];
- str->value.str.val[i] = str->value.str.val[len-1-i];
- str->value.str.val[len-1-i]=c;
- }
-
- *return_value = *str;
- pval_copy_constructor(return_value);
-}
-/* }}} */
-
-
-/* be careful, this edits the string in-place */
-PHPAPI void _php3_stripslashes(char *string, int *len)
-{
- char *s, *t;
- int l;
- char escape_char='\\';
- PLS_FETCH();
-
- if (PG(magic_quotes_sybase)) {
- escape_char='\'';
- }
-
- if (len != NULL) {
- l = *len;
- } else {
- l = strlen(string);
- }
- s = string;
- t = string;
- while (l > 0) {
- if (*t == escape_char) {
- t++; /* skip the slash */
- if (len != NULL)
- (*len)--;
- l--;
- if (l > 0) {
- if(*t=='0') {
- *s++='\0';
- t++;
- } else {
- *s++ = *t++; /* preserve the next character */
- }
- l--;
- }
- } else {
- if (s != t)
- *s++ = *t++;
- else {
- s++;
- t++;
- }
- l--;
- }
- }
- if (s != t) {
- *s = '\0';
- }
-}
-
-/* {{{ proto string addslashes(string str)
- Escape single quote, double quotes and backslash characters in a string with backslashes */
-void php3_addslashes(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
- return_value->value.str.val = _php3_addslashes(str->value.str.val,str->value.str.len,&return_value->value.str.len,0);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* {{{ proto string stripslashes(string str)
- Strip backslashes from a string */
-void php3_stripslashes(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &str) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(str);
-
- /* let RETVAL do the estrdup() */
- RETVAL_STRING(str->value.str.val,1);
- _php3_stripslashes(return_value->value.str.val,&return_value->value.str.len);
-}
-/* }}} */
-
-#ifndef HAVE_STRERROR
-#if !APACHE
-char *strerror(int errnum)
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
-#ifndef THREAD_SAFE
- static char str_ebuf[40];
-#endif
-
- if ((unsigned int)errnum < sys_nerr) return(sys_errlist[errnum]);
- (void)sprintf(STATIC(str_ebuf), "Unknown error: %d", errnum);
- return(STATIC(str_ebuf));
-}
-#endif
-#endif
-
-
-PHPAPI char *_php3_addslashes(char *str, int length, int *new_length, int should_free)
-{
- /* maximum string length, worst case situation */
- char *new_str = (char *) emalloc((length?length:strlen(str))*2+1);
- char *source,*target;
- char *end;
- char c;
- PLS_FETCH();
-
- for (source=str,end=source+length,target=new_str; (c = *source) || source<end; source++) {
- switch(c) {
- case '\0':
- *target++ = '\\';
- *target++ = '0';
- break;
- case '\'':
- if (PG(magic_quotes_sybase)) {
- *target++ = '\'';
- *target++ = '\'';
- break;
- }
- /* break is missing *intentionally* */
- case '\"':
- case '\\':
- if (!PG(magic_quotes_sybase)) {
- *target++ = '\\';
- }
- /* break is missing *intentionally* */
- default:
- *target++ = c;
- break;
- }
- }
- *target = 0;
- if(new_length) *new_length = target - new_str;
- if (should_free) {
- STR_FREE(str);
- }
- return new_str;
-}
-
-
-#define _HEB_BLOCK_TYPE_ENG 1
-#define _HEB_BLOCK_TYPE_HEB 2
-#define isheb(c) (((((unsigned char) c)>=224) && (((unsigned char) c)<=250)) ? 1 : 0)
-#define _isblank(c) (((((unsigned char) c)==' ' || ((unsigned char) c)=='\t')) ? 1 : 0)
-#define _isnewline(c) (((((unsigned char) c)=='\n' || ((unsigned char) c)=='\r')) ? 1 : 0)
-
-static void _php3_char_to_str(char *str,uint len,char from,char *to,int to_len,pval *result)
-{
- int char_count=0;
- char *source,*target,*tmp,*source_end=str+len, *tmp_end=NULL;
-
- for (source=str; source<source_end; source++) {
- if (*source==from) {
- char_count++;
- }
- }
-
- result->type = IS_STRING;
-
- if (char_count==0) {
- result->value.str.val = estrndup(str,len);
- result->value.str.len = len;
- return;
- }
-
- result->value.str.len = len+char_count*(to_len-1);
- result->value.str.val = target = (char *) emalloc(result->value.str.len+1);
-
- for (source=str; source<source_end; source++) {
- if (*source==from) {
- for (tmp=to,tmp_end=tmp+to_len; tmp<tmp_end; tmp++) {
- *target = *tmp;
- target++;
- }
- } else {
- *target = *source;
- target++;
- }
- }
- *target = 0;
-}
-
-/*
- * this is a binary safe equivalent to strnstr
- * note that we don't check for the end in str_to_str but here
- */
-
-static inline char *
-_php3_memnstr(char *haystack, char *needle, int needle_len, char *end)
-{
- char *p = haystack;
- char *s = NULL;
-
- for(; p < end - needle_len + 1&&
- (s = memchr(p, *needle, end - haystack)); p = s + 1) {
- if(memcmp(s, needle, needle_len) == 0)
- return s;
- }
- return NULL;
-}
-
-/*
- * because of efficiency we use malloc/realloc/free here
- * erealloc _will_ move your data around - it took me some time
- * to find out ... Sascha Schumann <sas@schell.de> 981220
- */
-
-static char *_php3_str_to_str(char *haystack, int length,
- char *needle, int needle_len, char *str, int str_len, int *_new_length)
-{
- char *p, *q;
- char *r, *s;
- char *end = haystack + length;
- char *new;
-
- new = malloc(length);
- /* we jump through haystack searching for the needle. hurray! */
- for(p = haystack, q = new;
- (r = _php3_memnstr(p, needle, needle_len, end));) {
- /* this ain't optimal. you could call it `efficient memory usage' */
- realloc(new, (q - new) + (r - p) + (str_len) + 1);
- memcpy(q, p, r - p);
- q += r - p;
- memcpy(q, str, str_len);
- q += str_len;
- p = r + needle_len;
- }
- /* if there is a rest, copy it */
- if((end - p)) {
- s = (q) + (end - p);
- new = realloc(new, s - new + 1);
- memcpy(q, p, end - p);
- q = s;
- }
- *q = '\0';
- if(_new_length) *_new_length = q - new;
- return new;
-}
-
-/* {{{ proto string str_replace(string needle, string str, string haystack)
- Replace all occurrences of needle in haystack with str */
-void php3_str_replace(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *haystack, *needle, *str;
- char *new;
-
- if(ARG_COUNT(ht) != 3 ||
- getParameters(ht, 3, &needle, &str, &haystack) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(haystack);
- convert_to_string(needle);
- convert_to_string(str);
-
- if(needle->value.str.len == 1) {
- _php3_char_to_str(haystack->value.str.val,haystack->value.str.len,needle->value.str.val[0],str->value.str.val, str->value.str.len ,return_value);
- return;
- }
-
- new = _php3_str_to_str(haystack->value.str.val, haystack->value.str.len,
- needle->value.str.val, needle->value.str.len,
- str->value.str.val, str->value.str.len,
- &return_value->value.str.len);
- return_value->value.str.val = emalloc(return_value->value.str.len + 1);
- memcpy(return_value->value.str.val, new, return_value->value.str.len + 1);
- free(new);
- return_value->type = IS_STRING;
-}
-/* }}} */
-
-/* Converts Logical Hebrew text (Hebrew Windows style) to Visual text
- * Cheers/complaints/flames - Zeev Suraski <zeev@php.net>
- */
-static void _php3_hebrev(INTERNAL_FUNCTION_PARAMETERS,int convert_newlines)
-{
- pval *str,*max_chars_per_line;
- char *heb_str,*tmp,*target,*opposite_target,*broken_str;
- int block_start, block_end, block_type, block_length, i;
- int block_ended;
- long max_chars=0;
- int begin,end,char_count,orig_begin;
-
-
- switch(ARG_COUNT(ht)) {
- case 1:
- if (getParameters(ht, 1, &str)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (getParameters(ht, 2, &str, &max_chars_per_line)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long(max_chars_per_line);
- max_chars = max_chars_per_line->value.lval;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
- }
-
- convert_to_string(str);
-
- if (str->value.str.len==0) {
- RETURN_FALSE;
- }
-
- tmp = str->value.str.val;
- block_start=block_end=0;
- block_ended=0;
-
- heb_str = (char *) emalloc(str->value.str.len+1);
- target = heb_str+str->value.str.len;
- opposite_target = heb_str;
- *target = 0;
- target--;
-
- block_length=0;
-
- if (isheb(*tmp)) {
- block_type = _HEB_BLOCK_TYPE_HEB;
- } else {
- block_type = _HEB_BLOCK_TYPE_ENG;
- }
-
- do {
- if (block_type==_HEB_BLOCK_TYPE_HEB) {
- while((isheb((int)*(tmp+1)) || _isblank((int)*(tmp+1)) || ispunct((int)*(tmp+1)) || (int)*(tmp+1)=='\n' ) && block_end<str->value.str.len-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- for (i=block_start; i<=block_end; i++) {
- *target = str->value.str.val[i];
- switch (*target) {
- case '(':
- *target = ')';
- break;
- case ')':
- *target = '(';
- break;
- default:
- break;
- }
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_ENG;
- } else {
- while(!isheb(*(tmp+1)) && (int)*(tmp+1)!='\n' && block_end<str->value.str.len-1) {
- tmp++;
- block_end++;
- block_length++;
- }
- while ((_isblank((int)*tmp) || ispunct((int)*tmp)) && *tmp!='/' && *tmp!='-' && block_end>block_start) {
- tmp--;
- block_end--;
- }
- for (i=block_end; i>=block_start; i--) {
- *target = str->value.str.val[i];
- target--;
- }
- block_type = _HEB_BLOCK_TYPE_HEB;
- }
- block_start=block_end+1;
- } while(block_end<str->value.str.len-1);
-
-
- broken_str = (char *) emalloc(str->value.str.len+1);
- begin=end=str->value.str.len-1;
- target = broken_str;
-
- while (1) {
- char_count=0;
- while ((!max_chars || char_count<max_chars) && begin>0) {
- char_count++;
- begin--;
- if (begin<=0 || _isnewline(heb_str[begin])) {
- while(begin>0 && _isnewline(heb_str[begin-1])) {
- begin--;
- char_count++;
- }
- break;
- }
- }
- if (char_count==max_chars) { /* try to avoid breaking words */
- int new_char_count=char_count, new_begin=begin;
-
- while (new_char_count>0) {
- if (_isblank(heb_str[new_begin]) || _isnewline(heb_str[new_begin])) {
- break;
- }
- new_begin++;
- new_char_count--;
- }
- if (new_char_count>0) {
- char_count=new_char_count;
- begin=new_begin;
- }
- }
- orig_begin=begin;
-
- if (_isblank(heb_str[begin])) {
- heb_str[begin]='\n';
- }
- while (begin<=end && _isnewline(heb_str[begin])) { /* skip leading newlines */
- begin++;
- }
- for (i=begin; i<=end; i++) { /* copy content */
- *target = heb_str[i];
- target++;
- }
- for (i=orig_begin; i<=end && _isnewline(heb_str[i]); i++) {
- *target = heb_str[i];
- target++;
- }
- begin=orig_begin;
-
- if (begin<=0) {
- *target = 0;
- break;
- }
- begin--;
- end=begin;
- }
- efree(heb_str);
-
- if (convert_newlines) {
- _php3_char_to_str(broken_str,str->value.str.len,'\n',"<br>\n",5,return_value);
- efree(broken_str);
- } else {
- return_value->value.str.val = broken_str;
- return_value->value.str.len = str->value.str.len;
- return_value->type = IS_STRING;
- }
-}
-
-
-/* {{{ proto string hebrev(string str [, int max_chars_per_line])
- Convert logical Hebrew text to visual text */
-void php3_hebrev(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
-}
-/* }}} */
-
-/* {{{ proto string hebrev(string str [, int max_chars_per_line])
- Convert logical Hebrew text to visual text with newline conversion */
-void php3_hebrev_with_conversion(INTERNAL_FUNCTION_PARAMETERS)
-{
- _php3_hebrev(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
-}
-/* }}} */
-
-/* {{{ proto string nl2br(string str)
- Converts newlines to HTML line breaks */
-void php3_newline_to_br(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *str;
-
- if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &str)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string(str);
-
- _php3_char_to_str(str->value.str.val,str->value.str.len,'\n',"<br>\n",5,return_value);
-}
-/* }}} */
-
-/* {{{ proto string setlocale(string category, string locale)
- Set locale information */
-void php3_setlocale(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *category, *locale;
- int cat;
- char *loc, *retval;
-
- if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &category, &locale)==FAILURE)
- WRONG_PARAM_COUNT;
-#if HAVE_SETLOCALE
- convert_to_string(category);
- convert_to_string(locale);
- if (!strcasecmp ("LC_ALL", category->value.str.val))
- cat = LC_ALL;
- else if (!strcasecmp ("LC_COLLATE", category->value.str.val))
- cat = LC_COLLATE;
- else if (!strcasecmp ("LC_CTYPE", category->value.str.val))
- cat = LC_CTYPE;
- else if (!strcasecmp ("LC_MONETARY", category->value.str.val))
- cat = LC_MONETARY;
- else if (!strcasecmp ("LC_NUMERIC", category->value.str.val))
- cat = LC_NUMERIC;
- else if (!strcasecmp ("LC_TIME", category->value.str.val))
- cat = LC_TIME;
- else {
- php3_error(E_WARNING,"Invalid locale category name %s, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC or LC_TIME", category->value.str.val);
- RETURN_FALSE;
- }
- if (!strcmp ("0", locale->value.str.val))
- loc = NULL;
- else
- loc = locale->value.str.val;
- retval = setlocale (cat, loc);
- if (retval) {
- RETVAL_STRING(retval,1);
- return;
- }
-#endif
- RETURN_FALSE;
-}
-/* }}} */
-
-/* {{{ proto void parsestr(string encoded_string)
- Parses GET/POST/COOKIE data and sets global variables. */
-void php3_parsestr(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *res = NULL;
-
- if (getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
- if (arg->value.str.val && *arg->value.str.val) {
- res = estrndup(arg->value.str.val,arg->value.str.len);
- }
- php3_treat_data(PARSE_STRING, res);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c
deleted file mode 100644
index 4581ed58dc..0000000000
--- a/ext/standard/syslog.c
+++ /dev/null
@@ -1,296 +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 <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-#include "php_ini.h"
-#include "zend_globals.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if MSVC5
-#include "win32/syslog.h"
-#else
-#include <syslog.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#include "php3_syslog.h"
-
-static int syslog_started;
-static char *syslog_device;
-static void start_syslog(void);
-
-int php3_minit_syslog(INIT_FUNC_ARGS)
-{
- TLS_VARS;
-
- /* error levels */
- REGISTER_LONG_CONSTANT("LOG_EMERG", LOG_EMERG, CONST_CS | CONST_PERSISTENT); /* system unusable */
- REGISTER_LONG_CONSTANT("LOG_ALERT", LOG_ALERT, CONST_CS | CONST_PERSISTENT); /* immediate action required */
- REGISTER_LONG_CONSTANT("LOG_CRIT", LOG_CRIT, CONST_CS | CONST_PERSISTENT); /* critical conditions */
- REGISTER_LONG_CONSTANT("LOG_ERR", LOG_ERR, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_WARNING", LOG_WARNING, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NOTICE", LOG_NOTICE, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_INFO", LOG_INFO, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_DEBUG", LOG_DEBUG, CONST_CS | CONST_PERSISTENT);
- /* facility: type of program logging the message */
- REGISTER_LONG_CONSTANT("LOG_KERN", LOG_KERN, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_USER", LOG_USER, CONST_CS | CONST_PERSISTENT); /* generic user level */
- REGISTER_LONG_CONSTANT("LOG_MAIL", LOG_MAIL, CONST_CS | CONST_PERSISTENT); /* log to email */
- REGISTER_LONG_CONSTANT("LOG_DAEMON", LOG_DAEMON, CONST_CS | CONST_PERSISTENT); /* other system daemons */
- REGISTER_LONG_CONSTANT("LOG_AUTH", LOG_AUTH, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_SYSLOG", LOG_SYSLOG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LPR", LOG_LPR, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_NEWS", LOG_NEWS, CONST_CS | CONST_PERSISTENT); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- REGISTER_LONG_CONSTANT("LOG_UUCP", LOG_UUCP, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- REGISTER_LONG_CONSTANT("LOG_CRON", LOG_CRON, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- REGISTER_LONG_CONSTANT("LOG_AUTHPRIV", LOG_AUTHPRIV, CONST_CS | CONST_PERSISTENT);
-#endif
-#ifndef MSVC5
- REGISTER_LONG_CONSTANT("LOG_LOCAL0", LOG_LOCAL0, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL1", LOG_LOCAL1, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL2", LOG_LOCAL2, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL3", LOG_LOCAL3, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL4", LOG_LOCAL4, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL5", LOG_LOCAL5, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL6", LOG_LOCAL6, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_LOCAL7", LOG_LOCAL7, CONST_CS | CONST_PERSISTENT);
-#endif
- /* options */
- REGISTER_LONG_CONSTANT("LOG_PID", LOG_PID, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_CONS", LOG_CONS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_ODELAY", LOG_ODELAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NDELAY", LOG_NDELAY, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("LOG_NOWAIT", LOG_NOWAIT, CONST_CS | CONST_PERSISTENT);
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- REGISTER_LONG_CONSTANT("LOG_PERROR", LOG_PERROR, CONST_CS | CONST_PERSISTENT); /*log to stderr*/
-#endif
-
- return SUCCESS;
-}
-
-
-int php3_rinit_syslog(INIT_FUNC_ARGS)
-{
- if (INI_INT("define_syslog_variables")) {
- start_syslog();
- } else {
- syslog_started=0;
- }
- syslog_device=NULL;
- return SUCCESS;
-}
-
-
-int php3_rshutdown_syslog(SHUTDOWN_FUNC_ARGS)
-{
- if (syslog_device) {
- efree(syslog_device);
- }
- return SUCCESS;
-}
-
-
-static void start_syslog(void)
-{
- ELS_FETCH();
-
- /* error levels */
- SET_VAR_LONG("LOG_EMERG", LOG_EMERG); /* system unusable */
- SET_VAR_LONG("LOG_ALERT", LOG_ALERT); /* immediate action required */
- SET_VAR_LONG("LOG_CRIT", LOG_CRIT); /* critical conditions */
- SET_VAR_LONG("LOG_ERR", LOG_ERR);
- SET_VAR_LONG("LOG_WARNING", LOG_WARNING);
- SET_VAR_LONG("LOG_NOTICE", LOG_NOTICE);
- SET_VAR_LONG("LOG_INFO", LOG_INFO);
- SET_VAR_LONG("LOG_DEBUG", LOG_DEBUG);
- /* facility: type of program logging the message */
- SET_VAR_LONG("LOG_KERN", LOG_KERN);
- SET_VAR_LONG("LOG_USER", LOG_USER); /* generic user level */
- SET_VAR_LONG("LOG_MAIL", LOG_MAIL); /* log to email */
- SET_VAR_LONG("LOG_DAEMON", LOG_DAEMON); /* other system daemons */
- SET_VAR_LONG("LOG_AUTH", LOG_AUTH);
- SET_VAR_LONG("LOG_SYSLOG", LOG_SYSLOG);
- SET_VAR_LONG("LOG_LPR", LOG_LPR);
-#ifdef LOG_NEWS
- /* No LOG_NEWS on HP-UX */
- SET_VAR_LONG("LOG_NEWS", LOG_NEWS); /* usenet new */
-#endif
-#ifdef LOG_UUCP
- /* No LOG_UUCP on HP-UX */
- SET_VAR_LONG("LOG_UUCP", LOG_UUCP);
-#endif
-#ifdef LOG_CRON
- /* apparently some systems don't have this one */
- SET_VAR_LONG("LOG_CRON", LOG_CRON);
-#endif
-#ifdef LOG_AUTHPRIV
- /* AIX doesn't have LOG_AUTHPRIV */
- SET_VAR_LONG("LOG_AUTHPRIV", LOG_AUTHPRIV);
-#endif
-#ifndef MSVC5
- SET_VAR_LONG("LOG_LOCAL0", LOG_LOCAL0);
- SET_VAR_LONG("LOG_LOCAL1", LOG_LOCAL1);
- SET_VAR_LONG("LOG_LOCAL2", LOG_LOCAL2);
- SET_VAR_LONG("LOG_LOCAL3", LOG_LOCAL3);
- SET_VAR_LONG("LOG_LOCAL4", LOG_LOCAL4);
- SET_VAR_LONG("LOG_LOCAL5", LOG_LOCAL5);
- SET_VAR_LONG("LOG_LOCAL6", LOG_LOCAL6);
- SET_VAR_LONG("LOG_LOCAL7", LOG_LOCAL7);
-#endif
- /* options */
- SET_VAR_LONG("LOG_PID", LOG_PID);
- SET_VAR_LONG("LOG_CONS", LOG_CONS);
- SET_VAR_LONG("LOG_ODELAY", LOG_ODELAY);
- SET_VAR_LONG("LOG_NDELAY", LOG_NDELAY);
- SET_VAR_LONG("LOG_NOWAIT", LOG_NOWAIT);
-#ifdef LOG_PERROR
- /* AIX doesn't have LOG_PERROR */
- SET_VAR_LONG("LOG_PERROR", LOG_PERROR); /*log to stderr*/
-#endif
-
- syslog_started=1;
-}
-
-/* {{{ proto void define_syslog_variables(void)
- Initializes all syslog-related variables */
-void php3_define_syslog_variables(INTERNAL_FUNCTION_PARAMETERS)
-{
- if (!syslog_started) {
- start_syslog();
- }
-}
-
-/* {{{ proto int openlog(string ident, int option, int facility)
- Open connection to system logger */
-/*
- ** OpenLog("nettopp", $LOG_PID, $LOG_LOCAL1);
- ** Syslog($LOG_EMERG, "help me!")
- ** CloseLog();
- */
-void php3_openlog(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *ident, *option, *facility;
- if (ARG_COUNT(ht) != 3 || getParameters(ht, 3, &ident, &option, &facility) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(ident);
- convert_to_long(option);
- convert_to_long(facility);
- if (syslog_device) {
- efree(syslog_device);
- }
- syslog_device = estrndup(ident->value.str.val,ident->value.str.len);
- openlog(syslog_device, option->value.lval, facility->value.lval);
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int closelog(void)
- Close connection to system logger */
-void php3_closelog(INTERNAL_FUNCTION_PARAMETERS)
-{
- closelog();
- if (syslog_device) {
- efree(syslog_device);
- syslog_device=NULL;
- }
- RETURN_TRUE;
-}
-/* }}} */
-
-/* {{{ proto int syslog(int priority, string message)
- Generate a system log message */
-void php3_syslog(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *priority, *message;
-
- if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &priority, &message) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(priority);
- convert_to_string(message);
-
- /*
- * CAVEAT: if the message contains patterns such as "%s",
- * this will cause problems.
- */
-
- syslog(priority->value.lval, message->value.str.val);
- RETURN_TRUE;
-}
-/* }}} */
-
-
-function_entry syslog_functions[] = {
- {"openlog", php3_openlog, NULL},
- {"syslog", php3_syslog, NULL},
- {"closelog", php3_closelog, NULL},
- {"define_syslog_variables", php3_define_syslog_variables, NULL},
- {NULL, NULL, NULL}
-};
-
-
-php3_module_entry syslog_module_entry = {
- "Syslog", syslog_functions, php3_minit_syslog, NULL, php3_rinit_syslog, php3_rshutdown_syslog, NULL, STANDARD_MODULE_PROPERTIES
-};
-
-
-#if COMPILE_DL
-DLEXPORT php3_module_entry *get_module(void) { return &syslog_module_entry; }
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/type.c b/ext/standard/type.c
deleted file mode 100644
index f263ee8185..0000000000
--- a/ext/standard/type.c
+++ /dev/null
@@ -1,108 +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$ */
-#include "php.h"
-#include "type.h"
-
-/*
- * Determines if 'str' is an integer (long), real number or a string
- *
- * Note that leading zeroes automatically force a STRING type
- */
-int php3_check_type(char *str)
-{
- char *s;
- int type = IS_LONG;
-
- s = str;
- if (*s == '0' && *(s + 1) && *(s + 1) != '.')
- return (IS_STRING);
- if (*s == '+' || *s == '-' || (*s >= '0' && *s <= '9') || *s == '.') {
- if (*s == '.')
- type = IS_DOUBLE;
- s++;
- while (*s) {
- if (*s >= '0' && *s <= '9') {
- s++;
- continue;
- } else if (*s == '.' && type == IS_LONG) {
- type = IS_DOUBLE;
- s++;
- continue;
- } else
- return (IS_STRING);
- }
- } else
- return (IS_STRING);
-
- return (type);
-} /* php3_check_type */
-
-/*
- * 0 - simple variable
- * 1 - non-index array
- * 2 - index array
- */
-int php3_check_ident_type(char *str)
-{
- char *s;
-
- if (!(s = (char *) strchr(str, '[')))
- return (GPC_REGULAR);
- s++;
- while (*s == ' ' || *s == '\t' || *s == '\n') {
- s++;
- }
- if (*s == ']') {
- return (GPC_NON_INDEXED_ARRAY);
- }
- return (GPC_INDEXED_ARRAY);
-}
-
-char *php3_get_ident_index(char *str)
-{
- char *temp;
- char *s, *t;
- char o;
-
- temp = emalloc(strlen(str));
- temp[0] = '\0';
- s = (char *) strchr(str, '[');
- if (s) {
- t = (char *) strrchr(str, ']');
- if (t) {
- o = *t;
- *t = '\0';
- strcpy(temp, s + 1);
- *t = o;
- }
- }
- return (temp);
-}
diff --git a/ext/standard/type.h b/ext/standard/type.h
deleted file mode 100644
index 62f98bea7a..0000000000
--- a/ext/standard/type.h
+++ /dev/null
@@ -1,41 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-#ifndef _TYPE_H
-#define _TYPE_H
-
-extern int php3_check_type(char *str);
-extern int php3_check_ident_type(char *str);
-extern char *php3_get_ident_index(char *str);
-
-#define GPC_REGULAR 0x1
-#define GPC_INDEXED_ARRAY 0x2
-#define GPC_NON_INDEXED_ARRAY 0x4
-#define GPC_ARRAY (GPC_INDEXED_ARRAY | GPC_NON_INDEXED_ARRAY)
-
-#endif
diff --git a/ext/standard/uniqid.c b/ext/standard/uniqid.c
deleted file mode 100644
index 89988b3eca..0000000000
--- a/ext/standard/uniqid.c
+++ /dev/null
@@ -1,103 +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. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <string.h>
-#include <errno.h>
-
-#include <stdio.h>
-#if MSVC5
-#include "win32/time.h"
-#else
-#include <sys/time.h>
-#endif
-
-#include "uniqid.h"
-
-/* {{{ proto string uniqid(string prefix)
- Generate a unique id */
-void php3_uniqid(INTERNAL_FUNCTION_PARAMETERS)
-{
-#ifdef HAVE_GETTIMEOFDAY
- pval *prefix;
-
- char uniqid[128];
- int sec, usec;
- struct timeval tv;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht,1,&prefix)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(prefix);
-
- /* Do some bounds checking since we are using a char array. */
- if (strlen(prefix->value.str.val) > 114) {
- php3_error(E_WARNING, "The prefix to uniqid should not be more than 114 characters.");
- return;
- }
- /* dont need this on windows so lets not do it*/
-#if HAVE_USLEEP && !(WIN32|WINNT)
- usleep(1);
-#endif
- gettimeofday((struct timeval *) &tv, (struct timezone *) NULL);
- sec = (int) tv.tv_sec;
- usec = (int) (tv.tv_usec % 1000000);
-
- /* The max value usec can have is 0xF423F, so we use only five hex
- * digits for usecs:
- */
- sprintf(uniqid, "%s%08x%05x", prefix->value.str.val, sec, usec);
-
- RETURN_STRING(uniqid,1);
-#endif
-}
-/* }}} */
-
-function_entry uniqid_functions[] = {
- {"uniqid", php3_uniqid, NULL},
- {NULL, NULL, NULL}
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/uniqid.h b/ext/standard/uniqid.h
deleted file mode 100644
index b241c35514..0000000000
--- a/ext/standard/uniqid.h
+++ /dev/null
@@ -1,37 +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. |
- +----------------------------------------------------------------------+
- | Author: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _UNIQID_H
-#define _UNIQID_H
-
-extern void php3_uniqid(INTERNAL_FUNCTION_PARAMETERS);
-
-#endif /* _UNIQID_H */
diff --git a/ext/standard/url.c b/ext/standard/url.c
deleted file mode 100644
index df6e6171f6..0000000000
--- a/ext/standard/url.c
+++ /dev/null
@@ -1,439 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-
-/* php.h includes the correct regex.h */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#include "url.h"
-#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*/
-
-
-void free_url(url * theurl)
-{
- if (theurl->scheme)
- efree(theurl->scheme);
- if (theurl->user)
- efree(theurl->user);
- if (theurl->pass)
- efree(theurl->pass);
- if (theurl->host)
- efree(theurl->host);
- if (theurl->path)
- efree(theurl->path);
- if (theurl->query)
- efree(theurl->query);
- if (theurl->fragment)
- efree(theurl->fragment);
- efree(theurl);
-}
-
-url *url_parse(char *string)
-{
- regex_t re;
- regmatch_t subs[10];
- int err;
- int length = strlen(string);
- char *result;
-
- url *ret = (url *) emalloc(sizeof(url));
- if (!ret) {
- /*php3_error(E_WARNING,"Unable to allocate memory\n");*/
- return NULL;
- }
- memset(ret, 0, sizeof(url));
-
- /* from Appendix B of draft-fielding-url-syntax-09,
- http://www.ics.uci.edu/~fielding/url/url.txt */
- err = regcomp(&re, "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", REG_EXTENDED);
- if (err) {
- /*php3_error(E_WARNING,"Unable to compile regex: %d\n", err);*/
- efree(ret);
- return NULL;
- }
- err = regexec(&re, string, 10, subs, 0);
- if (err) {
- /*php3_error(E_WARNING,"Error with regex\n");*/
- efree(ret);
- return NULL;
- }
- /* no processing necessary on the scheme */
- if (subs[2].rm_so != -1 && subs[2].rm_so < length) {
- ret->scheme = estrndup(string + subs[2].rm_so, subs[2].rm_eo - subs[2].rm_so);
- }
-
- /* the path to the resource */
- if (subs[5].rm_so != -1 && subs[5].rm_so < length) {
- ret->path = estrndup(string + subs[5].rm_so, subs[5].rm_eo - subs[5].rm_so);
- }
-
- /* the query part */
- if (subs[7].rm_so != -1 && subs[7].rm_so < length) {
- ret->query = estrndup(string + subs[7].rm_so, subs[7].rm_eo - subs[7].rm_so);
- }
-
- /* the fragment */
- if (subs[9].rm_so != -1 && subs[9].rm_so < length) {
- ret->fragment = estrndup(string + subs[9].rm_so, subs[9].rm_eo - subs[9].rm_so);
- }
-
- /* extract the username, pass, and port from the hostname */
- if (subs[4].rm_so != -1 && subs[4].rm_so < length) {
- /* extract username:pass@host:port from regex results */
- result = estrndup(string + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so);
- length = strlen(result);
-
- regfree(&re); /* free the old regex */
-
- if ((err=regcomp(&re, "^(([^@:]+)(:([^@:]+))?@)?([^:@]+)(:([^:@]+))?", REG_EXTENDED))
- || (err=regexec(&re, result, 10, subs, 0))) {
- STR_FREE(ret->scheme);
- STR_FREE(ret->path);
- STR_FREE(ret->query);
- STR_FREE(ret->fragment);
- efree(ret);
- efree(result);
- /*php3_error(E_WARNING,"Unable to compile regex: %d\n", err);*/
- return NULL;
- }
- /* now deal with all of the results */
- if (subs[2].rm_so != -1 && subs[2].rm_so < length) {
- ret->user = estrndup(result + subs[2].rm_so, subs[2].rm_eo - subs[2].rm_so);
- }
- if (subs[4].rm_so != -1 && subs[4].rm_so < length) {
- ret->pass = estrndup(result + subs[4].rm_so, subs[4].rm_eo - subs[4].rm_so);
- }
- if (subs[5].rm_so != -1 && subs[5].rm_so < length) {
- ret->host = estrndup(result + subs[5].rm_so, subs[5].rm_eo - subs[5].rm_so);
- }
- if (subs[7].rm_so != -1 && subs[7].rm_so < length) {
- ret->port = (unsigned short) strtol(result + subs[7].rm_so, NULL, 10);
- }
- efree(result);
- }
- regfree(&re);
- return ret;
-}
-
-/* {{{ proto array parse_url(string url)
- Parse a URL and return its components */
-void php3_parse_url(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *string;
- url *resource;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &string) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(string);
-
- resource = url_parse(string->value.str.val);
-
- if (resource == NULL) {
- php3_error(E_WARNING, "unable to parse url (%s)", string->value.str.val);
- RETURN_FALSE;
- }
- /* allocate an array for return */
- if (array_init(return_value) == FAILURE) {
- free_url(resource);
- RETURN_FALSE;
- }
- /* add the various elements to the array */
- if (resource->scheme != NULL)
- add_assoc_string(return_value, "scheme", resource->scheme, 1);
- if (resource->host != NULL)
- add_assoc_string(return_value, "host", resource->host, 1);
- if (resource->port != 0)
- add_assoc_long(return_value, "port", resource->port);
- if (resource->user != NULL)
- add_assoc_string(return_value, "user", resource->user, 1);
- if (resource->pass != NULL)
- add_assoc_string(return_value, "pass", resource->pass, 1);
- if (resource->path != NULL)
- add_assoc_string(return_value, "path", resource->path, 1);
- if (resource->query != NULL)
- add_assoc_string(return_value, "query", resource->query, 1);
- if (resource->fragment != NULL)
- add_assoc_string(return_value, "fragment", resource->fragment, 1);
- free_url(resource);
-}
-/* }}} */
-
-static int php3_htoi(char *s)
-{
- int value;
- int c;
-
- c = s[0];
- if (isupper(c))
- c = tolower(c);
- value = (c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10) * 16;
-
- c = s[1];
- if (isupper(c))
- c = tolower(c);
- value += c >= '0' && c <= '9' ? c - '0' : c - 'a' + 10;
-
- return (value);
-}
-
-/* rfc1738:
-
- ...The characters ";",
- "/", "?", ":", "@", "=" and "&" are the characters which may be
- reserved for special meaning within a scheme...
-
- ...Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
- reserved characters used for their reserved purposes may be used
- unencoded within a URL...
-
- For added safety, we only leave -_. unencoded.
- */
-
-static unsigned char hexchars[] = "0123456789ABCDEF";
-
-char *_php3_urlencode(char *s, int len)
-{
- register int x, y;
- unsigned char *str;
-
- str = (unsigned char *) emalloc(3 * strlen(s) + 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
- if (str[y] == ' ') {
- str[y] = '+';
-#ifndef CHARSET_EBCDIC
- } else if ((str[y] < '0' && str[y] != '-' && str[y] != '.') ||
- (str[y] < 'A' && str[y] > '9') ||
- (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') ||
- (str[y] > 'z')) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
- }
-#else /*CHARSET_EBCDIC*/
- } else if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
- str[y++] = '%';
- str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 0x0F];
- }
-#endif /*CHARSET_EBCDIC*/
- }
- str[y] = '\0';
- return ((char *) str);
-}
-
-/* {{{ proto string urlencode(string str)
- URL-encodes string */
-void php3_urlencode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!arg->value.str.len) {
- RETURN_FALSE;
- }
- str = _php3_urlencode(arg->value.str.val, arg->value.str.len);
- RETVAL_STRING(str, 1);
- efree(str);
-}
-/* }}} */
-
-/* {{{ proto string urldecode(string str)
- Decodes URL-encoded string */
-void php3_urldecode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- int len;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!arg->value.str.len) {
- RETURN_FALSE;
- }
- len = _php3_urldecode(arg->value.str.val, arg->value.str.len);
-
- RETVAL_STRINGL(arg->value.str.val, len, 1);
-}
-/* }}} */
-
-int _php3_urldecode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '+')
- *dest = ' ';
- else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php3_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php3_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-
-char *_php3_rawurlencode(char *s, int len)
-{
- register int x, y;
- unsigned char *str;
-
- str = (unsigned char *) emalloc(3 * len + 1);
- for (x = 0, y = 0; len--; x++, y++) {
- str[y] = (unsigned char) s[x];
-#ifndef CHARSET_EBCDIC
- if ((str[y] < '0' && str[y] != '-' && str[y] != '.') ||
- (str[y] < 'A' && str[y] > '9') ||
- (str[y] > 'Z' && str[y] < 'a' && str[y] != '_') ||
- (str[y] > 'z')) {
- str[y++] = '%';
- str[y++] = hexchars[(unsigned char) s[x] >> 4];
- str[y] = hexchars[(unsigned char) s[x] & 15];
-#else /*CHARSET_EBCDIC*/
- if (!isalnum(str[y]) && strchr("_-.", str[y]) != NULL) {
- str[y++] = '%';
- str[y++] = hexchars[os_toascii[(unsigned char) s[x]] >> 4];
- str[y] = hexchars[os_toascii[(unsigned char) s[x]] & 15];
-#endif /*CHARSET_EBCDIC*/
- }
- }
- str[y] = '\0';
- return ((char *) str);
-}
-
-/* {{{ proto string rawurlencode(string str)
- URL-encodes string */
-void php3_rawurlencode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- char *str;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!arg->value.str.len) {
- RETURN_FALSE;
- }
- str = _php3_rawurlencode(arg->value.str.val, arg->value.str.len);
- RETVAL_STRING(str, 1);
- efree(str);
-}
-/* }}} */
-
-/* {{{ proto string rawurldecode(string str)
- Decodes URL-encodes string */
-void php3_rawurldecode(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *arg;
- int len;
- TLS_VARS;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string(arg);
-
- if (!arg->value.str.len) {
- RETURN_FALSE;
- }
- len = _php3_rawurldecode(arg->value.str.val, arg->value.str.len);
-
- RETVAL_STRINGL(arg->value.str.val, len, 1);
-}
-/* }}} */
-
-int _php3_rawurldecode(char *str, int len)
-{
- char *dest = str;
- char *data = str;
-
- while (len--) {
- if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1)) && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
- *dest = (char) php3_htoi(data + 1);
-#else
- *dest = os_toebcdic[(char) php3_htoi(data + 1)];
-#endif
- data += 2;
- len -= 2;
- } else
- *dest = *data;
- data++;
- dest++;
- }
- *dest = '\0';
- return dest - str;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/url.h b/ext/standard/url.h
deleted file mode 100644
index 22d6e4a984..0000000000
--- a/ext/standard/url.h
+++ /dev/null
@@ -1,60 +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$ */
-
-typedef struct url {
- char *scheme;
- char *user;
- char *pass;
- char *host;
- unsigned short port;
- char *path;
- char *query;
- char *fragment;
-} url;
-
-extern void free_url(url *);
-extern url *url_parse(char *);
-extern int _php3_urldecode(char *, int); /* return value: length of decoded string */
-extern char *_php3_urlencode(char *, int);
-extern int _php3_rawurldecode(char *, int); /* return value: length of decoded string */
-extern char *_php3_rawurlencode(char *, int);
-
-extern void php3_parse_url(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_urlencode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_urldecode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rawurlencode(INTERNAL_FUNCTION_PARAMETERS);
-extern void php3_rawurldecode(INTERNAL_FUNCTION_PARAMETERS);
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ext/standard/var.c b/ext/standard/var.c
deleted file mode 100644
index a602ee0eb7..0000000000
--- a/ext/standard/var.c
+++ /dev/null
@@ -1,391 +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: Jani Lehtimäki <jkl@njet.net> |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "php.h"
-#include "fopen-wrappers.h"
-#include "reg.h"
-#include "functions/post.h"
-#include "php3_string.h"
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-
-#include "php3_var.h"
-
-void php3api_var_dump(pval *struc, int level)
-{
- ulong index;
- char *key;
- int i, c = 0;
- pval *data;
- char buf[512];
-
- switch (struc->type) {
- case IS_LONG:
- i = sprintf(buf, "%*cint(%ld)\n", level, ' ', struc->value.lval);
- PHPWRITE(&buf[1], i - 1);
- break;
-
- case IS_DOUBLE:
- i = sprintf(buf, "%*cfloat(%g)\n", level, ' ', struc->value.dval);
- PHPWRITE(&buf[1], i - 1);
- break;
-
- case IS_STRING:
- i = sprintf(buf, "%*cstring(%d) \"", level, ' ', struc->value.str.len);
- PHPWRITE(&buf[1], i - 1);
- PHPWRITE(struc->value.str.val, struc->value.str.len);
- strcpy(buf, "\"\n");
- PHPWRITE(buf, strlen(buf));
- break;
-
- case IS_ARRAY:
- i = sprintf(buf, "%*carray(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
- PHPWRITE(&buf[1], i - 1);
- goto head_done;
-
- case IS_OBJECT:
- i = sprintf(buf, "%*cobject(%d) {\n", level, ' ', _php3_hash_num_elements(struc->value.ht));
- PHPWRITE(&buf[1], i - 1);
- head_done:
-
- _php3_hash_internal_pointer_reset(struc->value.ht);
- for (;; _php3_hash_move_forward(struc->value.ht)) {
- if ((i = _php3_hash_get_current_key(struc->value.ht, &key, &index)) == HASH_KEY_NON_EXISTANT)
- break;
- if (c > 0) {
- strcpy(buf, "\n");
- PHPWRITE(buf, strlen(buf));
- }
- c++;
- if (_php3_hash_get_current_data(struc->value.ht, (void **) (&data)) != SUCCESS || !data || (data == struc))
- continue;
- switch (i) {
- case HASH_KEY_IS_LONG:{
- pval d;
-
- d.type = IS_LONG;
- d.value.lval = index;
- php3api_var_dump(&d, level + 2);
- }
- break;
-
- case HASH_KEY_IS_STRING:{
- pval d;
-
- d.type = IS_STRING;
- d.value.str.val = key;
- d.value.str.len = strlen(key);
- php3api_var_dump(&d, level + 2);
- efree(key);
- }
- break;
- }
- php3api_var_dump(data, level + 2);
- }
- i = sprintf(buf, "%*c}\n", level, ' ');
- PHPWRITE(&buf[1], i - 1);
- break;
-
- default:
- i = sprintf(buf, "%*ci:0\n", level, ' ');
- PHPWRITE(&buf[1], i - 1);
- }
-}
-
-
-PHP_FUNCTION(var_dump)
-{
- pval *struc;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &struc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- php3api_var_dump(struc, 1);
-}
-
-
-
-#define STR_CAT(P,S,I) {\
- pval *__p = (P);\
- ulong __i = __p->value.str.len;\
- __p->value.str.len += (I);\
- if (__p->value.str.val) {\
- __p->value.str.val = (char *)erealloc(__p->value.str.val, __p->value.str.len + 1);\
- } else {\
- __p->value.str.val = emalloc(__p->value.str.len + 1);\
- *__p->value.str.val = 0;\
- }\
- strcat(__p->value.str.val + __i, (S));\
-}
-
-
-void php3api_var_serialize(pval *buf, pval *struc)
-{
- char s[256];
- ulong slen;
- int i, ch;
-
- switch (struc->type) {
- case IS_LONG:
- slen = sprintf(s, "i:%ld;", struc->value.lval);
- STR_CAT(buf, s, slen);
- return;
-
- case IS_DOUBLE:
- slen = sprintf(s, "d:%g;", struc->value.dval);
- STR_CAT(buf, s, slen);
- return;
-
- case IS_STRING:{
- char *p;
-
- i = buf->value.str.len;
- slen = sprintf(s, "s:%d:\"", struc->value.str.len);
- STR_CAT(buf, s, slen + struc->value.str.len + 2);
- p = buf->value.str.val + i + slen;
- if (struc->value.str.len > 0) {
- memcpy(p, struc->value.str.val, struc->value.str.len);
- p += struc->value.str.len;
- }
- *p++ = '\"';
- *p++ = ';';
- *p = 0;
- }
- return;
-
- case IS_ARRAY:
- ch = 'a';
- goto got_array;
-
- case IS_OBJECT:
- ch = 'o';
-
- got_array:
- i = _php3_hash_num_elements(struc->value.ht);
- slen = sprintf(s, "%c:%d:{", ch, i);
- STR_CAT(buf, s, slen);
- if (i > 0) {
- char *key;
- pval *data;
- pval d;
- ulong index;
-
- _php3_hash_internal_pointer_reset(struc->value.ht);
- for (;; _php3_hash_move_forward(struc->value.ht)) {
- if ((i = _php3_hash_get_current_key(struc->value.ht, &key, &index)) == HASH_KEY_NON_EXISTANT) {
- break;
- }
- if (_php3_hash_get_current_data(struc->value.ht, (void **) (&data)) != SUCCESS || !data || (data == struc)) {
- continue;
- }
- switch (i) {
- case HASH_KEY_IS_LONG:
- d.type = IS_LONG;
- d.value.lval = index;
- php3api_var_serialize(buf, &d);
- break;
- case HASH_KEY_IS_STRING:
- d.type = IS_STRING;
- d.value.str.val = key;
- d.value.str.len = strlen(key);
- php3api_var_serialize(buf, &d);
- efree(key);
- break;
- }
- php3api_var_serialize(buf, data);
- }
- }
- STR_CAT(buf, "}", 1);
- return;
-
- default:
- STR_CAT(buf, "i:0;", 4);
- return;
- }
-}
-
-
-int php3api_var_unserialize(pval *rval, char **p, char *max)
-{
- char *q;
- char *str;
- int i;
-
- switch (**p) {
- case 'i':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- q = *p;
- while (**p && **p != ';') {
- (*p)++;
- }
- if (**p != ';') {
- return 0;
- }
- (*p)++;
- rval->type = IS_LONG;
- rval->value.lval = atol(q + 2);
- return 1;
-
- case 'd':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- q = *p;
- while (**p && **p != ';') {
- (*p)++;
- }
- if (**p != ';') {
- return 0;
- }
- (*p)++;
- rval->type = IS_DOUBLE;
- rval->value.dval = atof(q + 2);
- return 1;
-
- case 's':
- if (*((*p) + 1) != ':') {
- return 0;
- }
- (*p) += 2;
- q = *p;
- while (**p && **p != ':') {
- (*p)++;
- }
- if (**p != ':') {
- return 0;
- }
- i = atoi(q);
- if (i < 0 || (*p + 3 + i) > max || *((*p) + 1) != '\"' ||
- *((*p) + 2 + i) != '\"' || *((*p) + 3 + i) != ';') {
- return 0;
- }
- (*p) += 2;
- str = emalloc(i + 1);
- if (i > 0) {
- memcpy(str, *p, i);
- }
- str[i] = 0;
- (*p) += i + 2;
- rval->type = IS_STRING;
- rval->value.str.val = str;
- rval->value.str.len = i;
- return 1;
-
- case 'a':
- rval->type = IS_ARRAY;
- goto got_array;
-
- case 'o':
- rval->type = IS_OBJECT;
-
- got_array:
- (*p) += 2;
- i = atoi(*p);
- rval->value.ht = (HashTable *) emalloc(sizeof(HashTable));
- _php3_hash_init(rval->value.ht, i + 1, NULL, PVAL_DESTRUCTOR, 0);
- while (**p && **p != ':') {
- (*p)++;
- }
- if (**p != ':' || *((*p) + 1) != '{') {
- return 0;
- }
- for ((*p) += 2; **p && **p != '}' && i > 0; i--) {
- pval key;
- pval data;
-
- if (!php3api_var_unserialize(&key, p, max)) {
- return 0;
- }
- if (!php3api_var_unserialize(&data, p, max)) {
- return 0;
- }
- switch (key.type) {
- case IS_LONG:
- _php3_hash_index_update(rval->value.ht, key.value.lval, &data, sizeof(data), NULL);
- break;
- case IS_STRING:
- _php3_hash_add(rval->value.ht, key.value.str.val, key.value.str.len + 1, &data, sizeof(data), NULL);
- break;
- }
- pval_destructor(&key);
- }
- return *((*p)++) == '}';
-
- default:
- return 0;
- }
-}
-
-
-PHP_FUNCTION(serialize)
-{
- pval *struc;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &struc) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- return_value->type = IS_STRING;
- return_value->value.str.val = NULL;
- return_value->value.str.len = 0;
- php3api_var_serialize(return_value, struc);
-}
-
-
-PHP_FUNCTION(unserialize)
-{
- pval *buf;
-
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &buf) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- if (buf->type == IS_STRING) {
- char *p = buf->value.str.val;
- if (!php3api_var_unserialize(return_value, &p, p + buf->value.str.len)) {
- RETURN_FALSE;
- }
- } else {
- RETURN_FALSE;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/filepro.mak b/filepro.mak
deleted file mode 100644
index a45c42d807..0000000000
--- a/filepro.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on filepro.dsp
-!IF "$(CFG)" == ""
-CFG=filepro - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to filepro - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "filepro - Win32 Release" && "$(CFG)" != "filepro - 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 "filepro.mak" CFG="filepro - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "filepro - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "filepro - 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)" == "filepro - Win32 Release"
-
-OUTDIR=.\module_release
-INTDIR=.\module_release
-# Begin Custom Macros
-OutDir=.\module_release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_filepro.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\filepro.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_filepro.dll"
- -@erase "$(OUTDIR)\php3_filepro.exp"
- -@erase "$(OUTDIR)\php3_filepro.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_FILEPRO=1 /D "NDEBUG" /D "THREAD_SAFE" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\filepro.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)\filepro.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.0 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_filepro.pdb" /machine:I386 /out:"$(OUTDIR)\php3_filepro.dll" /implib:"$(OUTDIR)\php3_filepro.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\filepro.obj"
-
-"$(OUTDIR)\php3_filepro.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "filepro - Win32 Debug"
-
-OUTDIR=.\module_debug
-INTDIR=.\module_debug
-# Begin Custom Macros
-OutDir=.\module_debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_filepro.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\filepro.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_filepro.dll"
- -@erase "$(OUTDIR)\php3_filepro.exp"
- -@erase "$(OUTDIR)\php3_filepro.ilk"
- -@erase "$(OUTDIR)\php3_filepro.lib"
- -@erase "$(OUTDIR)\php3_filepro.pdb"
-
-"$(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 HAVE_FILEPRO=1 /D "DEBUG" /D "_DEBUG" /D "THREAD_SAFE" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\filepro.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)\filepro.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.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_filepro.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_filepro.dll" /implib:"$(OUTDIR)\php3_filepro.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\filepro.obj"
-
-"$(OUTDIR)\php3_filepro.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("filepro.dep")
-!INCLUDE "filepro.dep"
-!ELSE
-!MESSAGE Warning: cannot find "filepro.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "filepro - Win32 Release" || "$(CFG)" == "filepro - Win32 Debug"
-SOURCE=.\functions\filepro.c
-
-"$(INTDIR)\filepro.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/foo b/foo
deleted file mode 100644
index 46111e204b..0000000000
--- a/foo
+++ /dev/null
@@ -1,9 +0,0 @@
-*** Testing assignments and variable aliasing: ***<br>
-<?php
- /* This test tests assignments to variables using other variables as variable-names */
- $a = "b";
- print "hey";
- $$a = "test";
- $$$a = "blah";
- print "hey";
-?>
diff --git a/foo2 b/foo2
deleted file mode 100644
index 4cdd41e3dc..0000000000
--- a/foo2
+++ /dev/null
@@ -1,3 +0,0 @@
-<?
-
-print $a->b(12,13)."\n";
diff --git a/foo3 b/foo3
deleted file mode 100644
index 08681b98c2..0000000000
--- a/foo3
+++ /dev/null
@@ -1,43 +0,0 @@
-<?
-
-class foo {
- function foo() {
- print "foo()\n";
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test...";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = $b;
-print $a->print_string($a->hello_world())."\n";
-print $b->print_string($b->hello_world())."\n";
-$a->foo = 5;
-print $a->foo;
-print $a->foo();
diff --git a/foo4 b/foo4
deleted file mode 100644
index c242debf97..0000000000
--- a/foo4
+++ /dev/null
@@ -1,41 +0,0 @@
-<?
-
-class foo {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- function hello_world() {
- return "Hello, World!";
- }
-
- function print_string($str) {
- print "$str\n";
- return 666;
- }
- var $foo;
- var $bar="this is a test...";
-};
-
-class bar {
- function foo($a,$b) {
- $a *= 3;
- return $a+$b;
- }
- function bar(&$blah, $foobar=7) {
- $foobar += 19;
- }
-
- var $foo;
- var $bar="this is a test...";
-};
-
-
-$b = new foo;
-$a = &$b;
-$b->asd = 5;
-print $b->asd;
diff --git a/footer b/footer
deleted file mode 100644
index c217e2be43..0000000000
--- a/footer
+++ /dev/null
@@ -1,7 +0,0 @@
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/gd.mak b/gd.mak
deleted file mode 100644
index 6bd0db1376..0000000000
--- a/gd.mak
+++ /dev/null
@@ -1,214 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on gd.dsp
-!IF "$(CFG)" == ""
-CFG=gd - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to gd - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "gd - Win32 Release" && "$(CFG)" != "gd - 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 "gd.mak" CFG="gd - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "gd - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "gd - 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)" == "gd - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_gd.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\gd.obj"
- -@erase "$(INTDIR)\gdcache.obj"
- -@erase "$(INTDIR)\gdttf.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_gd.dll"
- -@erase "$(OUTDIR)\php3_gd.exp"
- -@erase "$(OUTDIR)\php3_gd.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBTTF=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\gd.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)\gd.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=freetype.lib php.lib libgd.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_gd.pdb" /machine:I386 /out:"$(OUTDIR)\php3_gd.dll" /implib:"$(OUTDIR)\php3_gd.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\gd.obj" \
- "$(INTDIR)\gdcache.obj" \
- "$(INTDIR)\gdttf.obj"
-
-"$(OUTDIR)\php3_gd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "gd - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_gd.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\gd.obj"
- -@erase "$(INTDIR)\gdcache.obj"
- -@erase "$(INTDIR)\gdttf.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_gd.dll"
- -@erase "$(OUTDIR)\php3_gd.exp"
- -@erase "$(OUTDIR)\php3_gd.ilk"
- -@erase "$(OUTDIR)\php3_gd.lib"
- -@erase "$(OUTDIR)\php3_gd.pdb"
-
-"$(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 HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBTTF=1 /D "DEBUG" /D "_DEBUG" /D "HAVE_GDTTF" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\gd.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)\gd.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=freetype.lib php.lib libgd.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_gd.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_gd.dll" /implib:"$(OUTDIR)\php3_gd.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\gd.obj" \
- "$(INTDIR)\gdcache.obj" \
- "$(INTDIR)\gdttf.obj"
-
-"$(OUTDIR)\php3_gd.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("gd.dep")
-!INCLUDE "gd.dep"
-!ELSE
-!MESSAGE Warning: cannot find "gd.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "gd - Win32 Release" || "$(CFG)" == "gd - Win32 Debug"
-SOURCE=.\functions\gd.c
-
-"$(INTDIR)\gd.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\functions\gdcache.c
-
-"$(INTDIR)\gdcache.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\functions\gdttf.c
-
-"$(INTDIR)\gdttf.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/getopt.c b/getopt.c
deleted file mode 100644
index 09ccdc7901..0000000000
--- a/getopt.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Borrowed from Apache NT Port */
-
-#if !APACHE
-
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-#include "getopt.h"
-#define OPTERRCOLON (1)
-#define OPTERRNF (2)
-#define OPTERRARG (3)
-
-
-char *optarg;
-int optind = 1;
-int opterr = 1;
-int optopt;
-
-static int
-optiserr(int argc, char * const *argv, int oint, const char *optstr,
- int optchr, int err)
-{
- if (opterr)
- {
- fprintf(stderr, "Error in argument %d, char %d: ", oint, optchr+1);
- switch(err)
- {
- case OPTERRCOLON:
- fprintf(stderr, ": in flags\n");
- break;
- case OPTERRNF:
- fprintf(stderr, "option not found %c\n", argv[oint][optchr]);
- break;
- case OPTERRARG:
- fprintf(stderr, "no argument for option %c\n", argv[oint][optchr]);
- break;
- default:
- fprintf(stderr, "unknown\n");
- break;
- }
- }
- optopt = argv[oint][optchr];
- return('?');
-}
-
-int
-getopt(int argc, char* const *argv, const char *optstr)
-{
- static int optchr = 0;
- static int dash = 0; /* have already seen the - */
-
- char *cp;
-
- if (optind >= argc)
- return(EOF);
- if (!dash && (argv[optind][0] != '-'))
- return(EOF);
- if (!dash && (argv[optind][0] == '-') && !argv[optind][1])
- {
- /*
- * use to specify stdin. Need to let pgm process this and
- * the following args
- */
- return(EOF);
- }
- if ((argv[optind][0] == '-') && (argv[optind][1] == '-'))
- {
- /* -- indicates end of args */
- optind++;
- return(EOF);
- }
- if (!dash)
- {
- assert((argv[optind][0] == '-') && argv[optind][1]);
- dash = 1;
- optchr = 1;
- }
-
- /* Check if the guy tries to do a -: kind of flag */
- assert(dash);
- if (argv[optind][optchr] == ':')
- {
- dash = 0;
- optind++;
- return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRCOLON));
- }
- if (!(cp = strchr(optstr, argv[optind][optchr])))
- {
- int errind = optind;
- int errchr = optchr;
-
- if (!argv[optind][optchr+1])
- {
- dash = 0;
- optind++;
- }
- else
- optchr++;
- return(optiserr(argc, argv, errind, optstr, errchr, OPTERRNF));
- }
- if (cp[1] == ':')
- {
- dash = 0;
- optind++;
- if (optind == argc)
- return(optiserr(argc, argv, optind-1, optstr, optchr, OPTERRARG));
- optarg = argv[optind++];
- return(*cp);
- }
- else
- {
- if (!argv[optind][optchr+1])
- {
- dash = 0;
- optind++;
- }
- else
- optchr++;
- return(*cp);
- }
- assert(0);
- return(0);
-}
-
-#endif /* !APACHE */
-
-#ifdef TESTGETOPT
-int
- main (int argc, char **argv)
- {
- int c;
- extern char *optarg;
- extern int optind;
- int aflg = 0;
- int bflg = 0;
- int errflg = 0;
- char *ofile = NULL;
-
- while ((c = getopt(argc, argv, "abo:")) != EOF)
- switch (c) {
- case 'a':
- if (bflg)
- errflg++;
- else
- aflg++;
- break;
- case 'b':
- if (aflg)
- errflg++;
- else
- bflg++;
- break;
- case 'o':
- ofile = optarg;
- (void)printf("ofile = %s\n", ofile);
- break;
- case '?':
- errflg++;
- }
- if (errflg) {
- (void)fprintf(stderr,
- "usage: cmd [-a|-b] [-o <filename>] files...\n");
- exit (2);
- }
- for ( ; optind < argc; optind++)
- (void)printf("%s\n", argv[optind]);
- return 0;
- }
-
-#endif /* TESTGETOPT */
diff --git a/getopt.h b/getopt.h
deleted file mode 100644
index 6f197aabd5..0000000000
--- a/getopt.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Borrowed from Apache NT Port */
-#include "php.h"
-
-extern char *optarg;
-extern int optind;
-extern int opterr;
-extern int optopt;
-
-extern int getopt(int argc, char* const *argv, const char *optstr);
diff --git a/header b/header
deleted file mode 100644
index 707e5f2593..0000000000
--- a/header
+++ /dev/null
@@ -1,29 +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: |
- | |
- +----------------------------------------------------------------------+
- */
diff --git a/hyperwave.mak b/hyperwave.mak
deleted file mode 100644
index fc01b8d973..0000000000
--- a/hyperwave.mak
+++ /dev/null
@@ -1,214 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on hyperwave.dsp
-!IF "$(CFG)" == ""
-CFG=hyperwave - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to hyperwave - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "hyperwave - Win32 Release" && "$(CFG)" != "hyperwave - 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 "hyperwave.mak" CFG="hyperwave - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "hyperwave - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "hyperwave - 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)" == "hyperwave - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_hyperwave.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\dlist.obj"
- -@erase "$(INTDIR)\hg_comm.obj"
- -@erase "$(INTDIR)\hw.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_hyperwave.dll"
- -@erase "$(OUTDIR)\php3_hyperwave.exp"
- -@erase "$(OUTDIR)\php3_hyperwave.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D "HYPERWAVE" /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\hyperwave.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)\hyperwave.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_hyperwave.pdb" /machine:I386 /out:"$(OUTDIR)\php3_hyperwave.dll" /implib:"$(OUTDIR)\php3_hyperwave.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\dlist.obj" \
- "$(INTDIR)\hg_comm.obj" \
- "$(INTDIR)\hw.obj"
-
-"$(OUTDIR)\php3_hyperwave.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "hyperwave - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_hyperwave.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\dlist.obj"
- -@erase "$(INTDIR)\hg_comm.obj"
- -@erase "$(INTDIR)\hw.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_hyperwave.dll"
- -@erase "$(OUTDIR)\php3_hyperwave.exp"
- -@erase "$(OUTDIR)\php3_hyperwave.ilk"
- -@erase "$(OUTDIR)\php3_hyperwave.lib"
- -@erase "$(OUTDIR)\php3_hyperwave.pdb"
-
-"$(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 "HYPERWAVE" /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\hyperwave.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)\hyperwave.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_hyperwave.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_hyperwave.dll" /implib:"$(OUTDIR)\php3_hyperwave.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\dlist.obj" \
- "$(INTDIR)\hg_comm.obj" \
- "$(INTDIR)\hw.obj"
-
-"$(OUTDIR)\php3_hyperwave.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("hyperwave.dep")
-!INCLUDE "hyperwave.dep"
-!ELSE
-!MESSAGE Warning: cannot find "hyperwave.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "hyperwave - Win32 Release" || "$(CFG)" == "hyperwave - Win32 Debug"
-SOURCE=.\functions\dlist.c
-
-"$(INTDIR)\dlist.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\functions\hg_comm.c
-
-"$(INTDIR)\hg_comm.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=.\functions\hw.c
-
-"$(INTDIR)\hw.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/imap4.mak b/imap4.mak
deleted file mode 100644
index f7df9624ae..0000000000
--- a/imap4.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on imap4.dsp
-!IF "$(CFG)" == ""
-CFG=imap4 - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to imap4 - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "imap4 - Win32 Release" && "$(CFG)" != "imap4 - 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 "imap4.mak" CFG="imap4 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "imap4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "imap4 - 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)" == "imap4 - Win32 Release"
-
-OUTDIR=.\module_release
-INTDIR=.\module_release
-# Begin Custom Macros
-OutDir=.\module_release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_imap4r2.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\imap.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_imap4r2.dll"
- -@erase "$(OUTDIR)\php3_imap4r2.exp"
- -@erase "$(OUTDIR)\php3_imap4r2.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_IMAP=1 /D "NDEBUG" /D "MSVC5" /D "THREAD_SAFE" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\imap4.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)\imap4.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=cclient.lib php.lib wsock32.lib winmm.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_imap4r2.pdb" /machine:I386 /out:"$(OUTDIR)\php3_imap4r2.dll" /implib:"$(OUTDIR)\php3_imap4r2.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\imap.obj"
-
-"$(OUTDIR)\php3_imap4r2.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "imap4 - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_imap4r1.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\imap.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_imap4r1.dll"
- -@erase "$(OUTDIR)\php3_imap4r1.exp"
- -@erase "$(OUTDIR)\php3_imap4r1.ilk"
- -@erase "$(OUTDIR)\php3_imap4r1.lib"
- -@erase "$(OUTDIR)\php3_imap4r1.pdb"
-
-"$(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 HAVE_IMAP=1 /D "DEBUG" /D "_DEBUG" /D "MSVC5" /D "THREAD_SAFE" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\imap4.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)\imap4.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=cclient.lib php.lib wsock32.lib winmm.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_imap4r1.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_imap4r1.dll" /implib:"$(OUTDIR)\php3_imap4r1.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\imap.obj"
-
-"$(OUTDIR)\php3_imap4r1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("imap4.dep")
-!INCLUDE "imap4.dep"
-!ELSE
-!MESSAGE Warning: cannot find "imap4.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "imap4 - Win32 Release" || "$(CFG)" == "imap4 - Win32 Debug"
-SOURCE=.\functions\imap.c
-
-"$(INTDIR)\imap.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/install-sh b/install-sh
deleted file mode 100644
index 89fc9b098b..0000000000
--- a/install-sh
+++ /dev/null
@@ -1,238 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-tranformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/internal_functions.c b/internal_functions.c
deleted file mode 100644
index 215dd0341b..0000000000
--- a/internal_functions.c
+++ /dev/null
@@ -1,146 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#include "php.h"
-#include "modules.h"
-#include "internal_functions_registry.h"
-#include "zend_compile.h"
-#include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "ext/standard/php3_standard.h"
-#include "ext/gd/php3_gd.h"
-#include "ext/dbase/dbase.h"
-#include "ext/odbc/php3_odbc.h"
-
-#include "functions/php3_ifx.h"
-#include "functions/php3_ldap.h"
-#include "functions/php3_mysql.h"
-#include "functions/php3_bcmath.h"
-#include "functions/php3_msql.h"
-#include "functions/php3_oci8.h"
-#include "functions/oracle.h"
-#include "functions/php3_pgsql.h"
-#include "functions/php3_sybase.h"
-#include "functions/php3_sybase-ct.h"
-#include "functions/imap.h"
-#include "functions/dl.h"
-#include "functions/head.h"
-#include "functions/post.h"
-#include "functions/hw.h"
-#include "functions/filepro.h"
-#include "functions/db.h"
-#include "dl/snmp/php3_snmp.h"
-#include "functions/php3_zlib.h"
-#include "functions/php3_COM.h"
-#include "functions/php3_interbase.h"
-#include "functions/php3_xml.h"
-#include "functions/php3_pdf.h"
-#include "functions/php3_fdf.h"
-#include "functions/php3_sysvsem.h"
-#include "functions/php3_sysvshm.h"
-#include "functions/php3_dav.h"
-
-unsigned char first_arg_force_ref[] = { 1, BYREF_FORCE };
-unsigned char first_arg_allow_ref[] = { 1, BYREF_ALLOW };
-unsigned char second_arg_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE };
-unsigned char second_arg_allow_ref[] = { 2, BYREF_NONE, BYREF_ALLOW };
-
-zend_module_entry *php3_builtin_modules[] =
-{
- basic_functions_module_ptr,
- dl_module_ptr,
- php3_dir_module_ptr,
- php3_filestat_module_ptr,
- php3_file_module_ptr,
- php3_header_module_ptr,
- mail_module_ptr,
- syslog_module_ptr,
- mysql_module_ptr,
- msql_module_ptr,
- pgsql_module_ptr,
- ifx_module_ptr,
- ldap_module_ptr,
- filepro_module_ptr,
- sybase_module_ptr,
- sybct_module_ptr,
- odbc_module_ptr,
- dbase_module_ptr,
- hw_module_ptr,
- regexp_module_ptr,
- gd_module_ptr,
- oci8_module_ptr,
- oracle_module_ptr,
- apache_module_ptr,
- crypt_module_ptr,
- dbm_module_ptr,
- bcmath_module_ptr,
- snmp_module_ptr,
- pack_module_ptr,
- php3_zlib_module_ptr,
- COM_module_ptr,
- php3_imap_module_ptr,
- php3_ibase_module_ptr,
- xml_module_ptr,
- pdf_module_ptr,
- fdf_module_ptr,
- sysvsem_module_ptr,
- sysvshm_module_ptr,
- phpdav_module_ptr,
-};
-
-
-int module_startup_modules(void)
-{
- zend_module_entry **ptr = php3_builtin_modules, **end = ptr+(sizeof(php3_builtin_modules)/sizeof(zend_module_entry *));
-
- while (ptr < end) {
- if (*ptr) {
- if (zend_startup_module(*ptr)==FAILURE) {
- return FAILURE;
- }
- }
- ptr++;
- }
- return SUCCESS;
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/ldap.mak b/ldap.mak
deleted file mode 100644
index 5fd1e85e17..0000000000
--- a/ldap.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on ldap.dsp
-!IF "$(CFG)" == ""
-CFG=ldap - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to ldap - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "ldap - Win32 Release" && "$(CFG)" != "ldap - 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 "ldap.mak" CFG="ldap - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "ldap - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "ldap - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "ldap - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_ldap.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\ldap.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_ldap.dll"
- -@erase "$(OUTDIR)\php3_ldap.exp"
- -@erase "$(OUTDIR)\php3_ldap.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_LDAP=1 /D HAVE_NSLDAP=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\ldap.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)\ldap.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib nsldap32v30.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_ldap.pdb" /machine:I386 /out:"$(OUTDIR)\php3_ldap.dll" /implib:"$(OUTDIR)\php3_ldap.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\ldap.obj"
-
-"$(OUTDIR)\php3_ldap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "ldap - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_ldap.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\ldap.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_ldap.dll"
- -@erase "$(OUTDIR)\php3_ldap.exp"
- -@erase "$(OUTDIR)\php3_ldap.ilk"
- -@erase "$(OUTDIR)\php3_ldap.lib"
- -@erase "$(OUTDIR)\php3_ldap.pdb"
-
-"$(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 HAVE_LDAP=1 /D HAVE_NSLDAP=1 /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\ldap.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)\ldap.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib nsldap32v30.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_ldap.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_ldap.dll" /implib:"$(OUTDIR)\php3_ldap.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\ldap.obj"
-
-"$(OUTDIR)\php3_ldap.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("ldap.dep")
-!INCLUDE "ldap.dep"
-!ELSE
-!MESSAGE Warning: cannot find "ldap.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "ldap - Win32 Release" || "$(CFG)" == "ldap - Win32 Debug"
-SOURCE=.\functions\ldap.c
-
-"$(INTDIR)\ldap.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/libphp3.module.in b/libphp3.module.in
deleted file mode 100644
index 0e9028c81a..0000000000
--- a/libphp3.module.in
+++ /dev/null
@@ -1,7 +0,0 @@
-Name: php3_module
-ConfigStart
- RULE_WANTHSREGEX=@HSREGEX@
- LIBS="@PHP_LIBS@ @EXTRA_LIBS@ @DBM_LIB@ @ORACLE_LFLAGS@ @ORACLE_LIBS@ @IODBC_LFLAGS@ @IODBC_LIBS@ @SYBASE_LFLAGS@ @SYBASE_LIBS@ @SYBASE_CT_LFLAGS@ @SYBASE_CT_LIBS@ @MYSQL_LFLAGS@ @MYSQL_LIBS@ @MSQL_LFLAGS@ @MSQL_LIBS@ @ADA_LFLAGS@ @ADA_LIBS@ @SOLID_LIBS@ @PGSQL_LFLAGS@ @PGSQL_LIBS@ @LDAP_LFLAGS@ @LDAP_LIBS@ @VELOCIS_LIBS@ @ZLIB_LIBS@ @CODBC_LFLAGS@ @CODBC_LIBS@ @IMAP_LIBS@ @IFX_LFLAGS@ @IFX_LIBS@ @SNMP_LFLAGS@ @SNMP_LIBS@ @IBASE_LFLAGS@ @IBASE_LIBS@ @PDFLIB_LIBS@ @XML_LIBS@ @LIBS@ @RDYNAMIC_LFLAGS@ $LIBS"
- RULE_HIDE=yes
-ConfigEnd
-
diff --git a/ltconfig b/ltconfig
deleted file mode 100644
index 7bba4e6b37..0000000000
--- a/ltconfig
+++ /dev/null
@@ -1,1064 +0,0 @@
-#! /bin/sh
-
-# ltconfig - Create a system-specific libtool.
-# When updating this script, search for LINENUM and fix line number refs.
-# Generated automatically from ltconfig.in by configure.
-# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# 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.
-
-# A lot of this script is taken from autoconf-2.10.
-
-# The name of this program.
-progname=`echo "$0" | sed 's%^.*/%%'`
-
-# Constants:
-PROGRAM=ltconfig
-PACKAGE=libtool
-VERSION=1.0
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
-rm="rm -f"
-
-help="Try \`$progname --help' for more information."
-
-# Global variables:
-can_build_shared=yes
-enable_shared=yes
-# All known linkers require a `.a' archive for static linking.
-enable_static=yes
-ltmain=
-silent=
-srcdir=
-ac_config_guess=
-ac_config_sub=
-host=
-nonopt=
-verify_host=yes
-with_gcc=no
-with_gnu_ld=no
-
-old_AR="$AR"
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-old_CPPFLAGS="$CPPFLAGS"
-old_LD="$LD"
-old_LN_S="$LN_S"
-old_RANLIB="$RANLIB"
-
-test -z "$AR" && AR=ar
-
-# Parse the command line options.
-args=
-prev=
-for option
-do
- case "$option" in
- -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- eval "$prev=\$option"
- prev=
- continue
- fi
-
- case "$option" in
- --help) cat <<EOM
-Usage: $progname [OPTION]... LTMAIN [HOST]
-
-Generate a system-specific libtool script.
-
- --disable-shared do not build shared libraries
- --disable-static do not build static libraries
- --help display this help and exit
- --no-verify do not verify that HOST is a valid host type
- --quiet same as \`--silent'
- --silent don't print informational messages
- --srcdir=DIR find \`config.guess' in DIR
- --version output version information and exit
- --with-gcc assume that the GNU C compiler will be used
- --with-gnu-ld assume that the C compiler uses the GNU linker
-
-LTMAIN is the \`ltmain.sh' shell script fragment that provides basic libtool
-functionality.
-
-HOST is the canonical host system name [default=guessed].
-EOM
- exit 0
- ;;
-
- --disable-shared) enable_shared=no ;;
-
- --disable-static) enable_static=no ;;
-
- --quiet | --silent) silent=yes ;;
-
- --srcdir) prev=srcdir ;;
- --srcdir=*) srcdir="$optarg" ;;
-
- --no-verify) verify_host=no ;;
-
- --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;;
-
- --with-gcc) with_gcc=yes ;;
- --with-gnu-ld) with_gnu_ld=yes ;;
-
- -*)
- echo "$progname: unrecognized option \`$option'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- if test -z "$ltmain"; then
- ltmain="$option"
- elif test -z "$host"; then
-# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
-# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
-# echo "$progname: warning \`$option' is not a valid host type" 1>&2
-# fi
- host="$option"
- else
- echo "$progname: too many arguments" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
-done
-
-if test -z "$ltmain"; then
- echo "$progname: you must specify a LTMAIN file" 1>&2
- echo "$help" 1>&2
- exit 1
-fi
-
-if test -f "$ltmain"; then :
-else
- echo "$progname: warning: \`$ltmain' does not exist" 1>&2
-fi
-
-# Quote any args containing shell metacharacters.
-ltconfig_args=
-for arg
-do
- case "$arg" in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ltconfig_args="$ltconfig_args '$arg'" ;;
- *) ltconfig_args="$ltconfig_args $arg" ;;
- esac
-done
-
-# A relevant subset of AC_INIT.
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 5 compiler messages saved in config.log
-# 6 checking for... messages and results
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>>./config.log
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-if test -z "$srcdir"; then
- # Assume the source directory is the same one as the path to ltmain.sh.
- srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'`
- test "$srcdir" = "$ltmain" && srcdir=.
-fi
-
-if test "$verify_host" = yes; then
- # Check for config.guess and config.sub.
- ac_aux_dir=
- for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/config.guess; then
- ac_aux_dir=$ac_dir
- break
- fi
- done
- if test -z "$ac_aux_dir"; then
- echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2
- echo "$help" 1>&2
- exit 1
- fi
- ac_config_guess=$ac_aux_dir/config.guess
- ac_config_sub=$ac_aux_dir/config.sub
-
- # Make sure we can run config.sub.
- if $ac_config_sub sun4 >/dev/null 2>&1; then :
- else
- echo "$progname: cannot run $ac_config_sub" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- echo $ac_n "checking host system type""... $ac_c" 1>&6
-
- host_alias=$host
- case "$host_alias" in
- "")
- if host_alias=`$ac_config_guess`; then :
- else
- echo "$progname: cannot guess host type; you must specify one" 1>&2
- echo "$help" 1>&2
- exit 1
- fi ;;
- esac
- host=`$ac_config_sub $host_alias`
- echo "$ac_t""$host" 1>&6
-
-elif test -z "$host"; then
- echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2
- echo "$help" 1>&2
- exit 1
-else
- host_alias=$host
-fi
-
-# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
-case "$host" in
-*-*-linux-gnu*) ;;
-*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
-esac
-
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR cru $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-
-# If RANLIB is not set, then run the test.
-if test "${RANLIB+set}" != "set"; then
- result=no
-
- echo $ac_n "checking for ranlib... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/ranlib; then
- RANLIB="ranlib"
- result="ranlib"
- break
- fi
- done
- IFS="$save_ifs"
-
- echo $ac_t "$result" 1>&6
-fi
-
-if test -n "$RANLIB"; then
- old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
- old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib"
-fi
-
-# Check to see if we are using GCC.
-if test "$with_gcc" != yes || test -z "$CC"; then
- # If CC is not set, then try to find GCC or a usable CC.
- if test -z "$CC"; then
- echo $ac_n "checking for gcc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- for dir in $PATH; do
- IFS="$save_ifs"
- test -z "$dir" && dir=.
- if test -f $dir/gcc; then
- CC="gcc"
- break
- fi
- done
- IFS="$save_ifs"
-
- if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
- else
- echo "$ac_t""no" 1>&6
- fi
- fi
-
- # Not "gcc", so try "cc", rejecting "/usr/ucb/cc".
- if test -z "$CC"; then
- echo $ac_n "checking for cc... $ac_c" 1>&6
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
- cc_rejected=no
- for dir in $PATH; do
- test -z "$dir" && dir=.
- if test -f $dir/cc; then
- if test "$dir/cc" = "/usr/ucb/cc"; then
- cc_rejected=yes
- continue
- fi
- CC="cc"
- break
- fi
- done
- IFS="$save_ifs"
- if test $cc_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same name, so the bogon will be chosen
- # first if we set CC to just the name; use the full file name.
- shift
- set dummy "$dir/cc" "$@"
- shift
- CC="$@"
- fi
- fi
-
- if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
- else
- echo "$ac_t""no" 1>&6
- fi
-
- if test -z "$CC"; then
- echo "$progname: error: no acceptable cc found in \$PATH" 1>&2
- exit 1
- fi
- fi
-
- # Now see if the compiler is really GCC.
- with_gcc=no
- echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
-
- trap "$rm conftest.c; exit 1" 1 2 15
- $rm conftest.c
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
- # LINENUM
- if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- with_gcc=yes
- fi
- $rm conftest.c
- echo $ac_t "$with_gcc" 1>&6
-fi
-
-# Allow CC to be a program name with arguments.
-set dummy $CC
-compiler="$2"
-
-echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
-pic_flag=
-profile_flag_pattern=
-special_shlib_compile_flags=
-wl=
-link_static_flag=
-
-if test "$with_gcc" = yes; then
- pic_flag='-fPIC'
- profile_flag_pattern='-pg?'
- wl='-Wl,'
- link_static_flag='-static'
-else
- # PORTME Check for PIC flags for the system compiler.
- case "$host_os" in
- aix3* | aix4*)
- # FIXME All rs/6000 code is PIC, but is there any non-rs/6000 AIX platform?
- pic_flag=
- link_static_flag='-bnso -bI:/lib/syscalls.exp'
- ;;
-
- hpux9* | hpux10*)
- # FIXME is there a better link_static_flag that works with the bundled CC?
- wl='-Wl,'
- link_static_flag='${wl}-a ${wl}archive'
- pic_flag='+Z'
- ;;
-
- irix5* | irix6*)
- wl='-Wl,'
- link_static_flag='-non_shared'
- # PIC (with -KPIC) is the default.
- pic_flag=
- ;;
-
- osf3* | osf4*)
- # FIXME - pic_flag is probably required for hppa*-osf* and i860-osf*
- wl='-Wl,'
- link_static_flag='-non_shared'
- ;;
-
- sco3.2v5*)
- pic_flag='-Kpic'
- link_static_flag='-dn'
- special_shlib_compile_flags='-belf'
- ;;
-
- solaris2*)
- pic_flag='-KPIC'
- link_static_flag='-Bstatic'
- wl='-Wl,'
- ;;
-
- sunos4*)
- pic_flag='-PIC'
- link_static_flag='-Bstatic'
- wl='-Qoption ld '
- ;;
-
- *)
- can_build_shared=no
- ;;
- esac
-fi
-
-case "$host_cpu" in
-rs6000 | powerpc | powerpcle)
- # Yippee! All RS/6000 and PowerPC code is position-independent.
- pic_flag=
- ;;
-esac
-
-if test -n "$pic_flag"; then
- echo $ac_t "$pic_flag" 1>&6
- pic_flag=" $pic_flag"
-else
- echo $ac_t none 1>&6
-fi
-
-# Check for any special shared library compilation flags.
-if test -n "$special_shlib_compile_flags"; then
- echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
- if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then :
- else
- echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2
- can_build_shared=no
- fi
-fi
-
-# See if we are using a broken GCC collect2 program.
-if test "$with_gcc" = yes; then
- echo $ac_n "checking for broken GCC collect2... $ac_c" 1>&6
-
- # FIXME: Run a test here, instead of relying on the canonical system name.
- case "$host_os" in
- aix3*)
- can_build_shared=no
- echo $ac_t yes 1>&6
- echo "$progname: to build shared libraries, set the CC env variable to \`xlc' and reconfigure" 1>&2
- ;;
- *)
- echo $ac_t no 1>&6
- ;;
- esac
-fi
-
-echo $ac_n "checking for $compiler option to statically link programs... $ac_c" 1>&6
-if test -n "$link_static_flag"; then
- echo $ac_t "$link_static_flag" 1>&6
-else
- echo $ac_t none 1>&6
-fi
-
-if test -z "$LN_S"; then
- # Check to see if we can use ln -s, or we need hard links.
- echo $ac_n "checking whether ln -s works... $ac_c" 1>&6
- rm -f conftestdata
- if ln -s X conftestdata 2>/dev/null; then
- rm -f conftestdata
- LN_S="ln -s"
- else
- LN_S=ln
- fi
- if test "$LN_S" = "ln -s"; then
- echo "$ac_t"yes 1>&6
- else
- echo "$ac_t"no 1>&6
- fi
-fi
-
-if test "$with_gnu_ld" != yes || test -z "$LD"; then
- if test -z "$LD"; then
- if test "$with_gnu_ld" = yes; then
- echo $ac_n "checking for GNU ld... $ac_c" 1>&6
- else
- echo $ac_n "checking for non-GNU ld... $ac_c" 1>&6
- fi
-
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/ld"; then
- LD="$ac_dir/ld"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- if "$LD" -v 2>&1 < /dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
- test "$with_gnu_ld" = yes && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
-
- if test -n "$LD"; then
- echo "$ac_t""$LD" 1>&6
- else
- echo "$ac_t""no" 1>&6
- fi
-
- if test -z "$LD"; then
- echo "$progname: error: no acceptable ld found in \$PATH" 1>&2
- exit 1
- fi
- fi
-
- echo $ac_n "checking whether we are using GNU ld... $ac_c" 1>&6
- # I'd rather use --version here, but apparently some GNU ld's only accept -v.
- if $LD -v 2>&1 </dev/null | egrep '(GNU ld|with BFD)' > /dev/null; then
- with_gnu_ld=yes
- fi
- echo $ac_t "$with_gnu_ld" 1>&6
-fi
-
-# See if the linker supports building shared libraries.
-echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
-
-allow_undefined_flag=
-archive_cmds=
-export_dynamic_flag=
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-hardcode_runpath_var=no
-hardcode_shlibpath_var=unsupported
-runpath_var=
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # See if GNU ld supports shared libraries.
-
- case "$host_os" in
- sunos4*)
- ld_shlibs=yes
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- *)
- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
- runpath_var=LD_RUN_PATH
- hardcode_runpath_var=yes
- ld_shlibs=yes
- else
- ld_shlibs=no
- fi
- ;;
- esac
-
- if test "$ld_shlibs" = yes; then
- archive_cmds='$cc -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
- export_dynamic_flag='${wl}-export-dynamic'
- fi
-else
- # PORTME fill in a description of your system's linker (not GNU ld)
- case "$host_os" in
- aix3*)
- allow_undefined_flag=unsupported
- archive_cmds='/usr/ucb/nm$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE -lc$deplibs;$AR cru $lib $objdir/$soname'
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- ;;
-
- aix4*)
- allow_undefined_flag=unsupported
- archive_cmds='/bin/nm -B$libobjs | egrep \" [BD] \" | sed \"s/^.* //\" > $lib.exp;$cc -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
- # support. Future versions do this automatically, but an explicit c++rt0.o
- # doesn't break anything, and helps significantly (at the cost of a little
- # extra space).
- freebsd2.2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # Unfortunately, older versions of FreeBSD 2 don't have this feature.
- freebsd2*)
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
- freebsd3*)
- archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- hardcode_minusL=yes
- hardcode_shlibpath_var=no
- ;;
-
- hpux9*)
- archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- hpux10*)
- archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
-
- irix5* | irix6*)
- archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- ;;
-
- netbsd* | openbsd*)
- # Tested with NetBSD 1.2 ld
- archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- osf3* | osf4*)
- allow_undefined_flag=' -expect_unresolved'
- archive_cmds='$LD -shared${allow_undefined_flag} -o $lib -soname $soname -set_version $verstring$libobjs -lc$deplibs'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
-
- sco3.2v5*)
- archive_cmds='$LD -G -o $lib$libobjs$deplibs'
- hardcode_direct=yes
- ;;
-
- solaris2*)
- archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_shlibpath_var=no
- ;;
-
- sunos4*)
- archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- *)
- ld_shlibs=no
- can_build_shared=no
- ;;
- esac
-fi
-echo $ac_t "$ld_shlibs" 1>&6
-
-# Check hardcoding attributes.
-echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" || \
- test "$hardcode_runpath_var" = yes; then
-
- # We can hardcode non-existant directories.
- if test "$hardcode_direct" != no && \
- test "$hardcode_minus_L" != no && \
- test "$hardcode_shlibpath_var" != no; then
-
- # Linking always hardcodes the temporary library directory.
- hardcode_action=relink
- else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- hardcode_action=immediate
- fi
-elif test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" != yes; then
- # We can't hardcode anything.
- hardcode_action=unsupported
-else
- # We can only hardcode existing directories.
- hardcode_action=relink
-fi
-echo $ac_t "$hardcode_action" 1>&6
-test "$hardcode_action" = unsupported && can_build_shared=no
-
-
-reload_flag=
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6
-# PORTME Some linker may need a different reload flag.
-reload_flag='-r'
-echo $ac_t "$reload_flag"
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-# PORTME Fill in your ld.so characteristics
-library_names_spec=
-soname_spec=
-postinstall_cmds=
-finish_cmds=
-shlibpath_var=
-version_type=none
-dynamic_linker="$host_os ld.so"
-
-echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
-case "$host_os" in
-aix3* | aix4*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.a'
- shlibpath_var=LIBPATH
-
- # AIX has no versioning support, so we append a major version to the name.
- soname_spec='$libname.so.$major'
- ;;
-
-freebsd2* | freebsd3*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix $libname.so'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-gnu*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-hpux9* | hpux10*)
- # Give a soname corresponding to the major version so that dld.sl refuses to
- # link against other versions.
- dynamic_linker="$host_os dld.sl"
- version_type=sunos
- shlibpath_var=SHLIB_PATH
- library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
- soname_spec='$libname.sl.$major'
- # HP-UX runs *really* slowly unless shared libraries are mode 555.
- postinstall_cmds='chmod 555 $lib'
- ;;
-
-irix5* | irix6*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
- dynamic_linker=no
- ;;
-
-# This must be Linux ELF.
-linux-gnu*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
- shlibpath_var=LD_LIBRARY_PATH
-
- if test -f /lib/ld.so.1; then
- dynamic_linker='GNU ld.so'
- else
- # Only the GNU ld.so supports shared libraries on MkLinux.
- case "$host_cpu" in
- powerpc*) dynamic_linker=no ;;
- *) dynamic_linker='Linux ld.so' ;;
- esac
- fi
- ;;
-
-netbsd* | openbsd*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-osf3* | osf4*)
- version_type=osf
- soname_spec='$libname.so'
- library_names_spec='$libname.so.$versuffix $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sco3.2v5*)
- version_type=osf
- soname_spec='$libname.so.$major'
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-solaris2*)
- version_type=linux
- library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
- soname_spec='$libname.so.$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-sunos4*)
- version_type=sunos
- library_names_spec='$libname.so.$versuffix'
- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-*)
- dynamic_linker=no
- ;;
-esac
-echo "$ac_t""$dynamic_linker"
-test "$dynamic_linker" = no && can_build_shared=no
-
-# FIXME need to add library stripping features
-# strip -x works for most platforms, though not for static libraries on NetBSD
-# HP-UX requires "-r" for library stripping
-striplib=
-old_striplib=
-
-#echo $ac_n "checking for static library strip program... $ac_c" 1>&6
-#if test -n "$old_striplib"; then
-# echo $ac_t "$old_striplib" 1>&6
-#else
-# echo $ac_t none 1>&6
-#fi
-
-#if test "$can_build_shared" = yes; then
-# echo $ac_n "checking for shared library strip program... $ac_c" 1>&6
-#
-# if test -n "$striplib"; then
-# echo $ac_t "$striplib" 1>&6
-# else
-# echo $ac_t none 1>&6
-# fi
-#fi
-
-# Report the consequences.
-echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
-
-echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace.
-case "$host_os" in
-aix*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds;\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-esac
-
-echo "$ac_t""$enable_shared" 1>&6
-
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-
-echo "checking whether to build static libraries... $enable_static" 1>&6
-
-ofile=libtool
-trap "$rm $ofile; exit 1" 1 2 15
-echo creating $ofile
-rm -fr $ofile
-cat <<EOF > $ofile
-#! /bin/sh
-
-# libtool - Provide generalized library-building support services.
-#
-# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
-# This program was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# CC="$old_CC" CFLAGS="$old_CFLAGS" CPPFLAGS="$old_CPPFLAGS" \\
-# LD="$old_LD" RANLIB="$old_RANLIB" LN_S="$old_LN_S" \\
-# $0$ltconfig_args
-#
-# Compiler and other test output produced by $progname, useful for
-# debugging $progname, is in ./config.log if it exists.
-
-# The version of $progname that generated this script.
-LTCONFIG_VERSION="$VERSION"
-
-# Whether or not to build libtool libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build old-style libraries.
-build_old_libs=$enable_static
-
-# The host system.
-host_alias="$host_alias"
-host="$host"
-
-# The archiver.
-AR='$AR'
-
-# The linker used to build libraries.
-LD='$LD'
-
-# Whether we need hard or soft links.
-LN_S='$LN_S'
-
-# How to create reloadable object files.
-reload_flag='$reload_flag'
-reload_cmds='$reload_cmds'
-
-# How to pass a linker flag through the compiler.
-wl='$wl'
-
-# Additional compiler flags for building library objects.
-pic_flag='$pic_flag'
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag='$link_static_flag'
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag='$export_dynamic_flag'
-
-# Pattern to match compiler flags for creating libNAME_p libraries:
-profile_flag_pattern='$profile_flag_pattern'
-
-# Library versioning type.
-version_type=$version_type
-
-# List of archive names. First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec='$library_names_spec'
-
-# The coded name of the library, if different from the real name.
-soname_spec='$soname_spec'
-
-# Commands used to build and install an old-style archive.
-RANLIB='$RANLIB'
-old_archive_cmds='$old_archive_cmds'
-old_postinstall_cmds='$old_postinstall_cmds'
-
-# Commands used to build and install a shared archive.
-archive_cmds='$archive_cmds'
-postinstall_cmds='$postinstall_cmds'
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag='$allow_undefined_flag'
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds='$finish_cmds'
-
-# How to strip a library file.
-striplib='$striplib'
-old_striplib='$old_striplib'
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec='$hardcode_libdir_flag_spec'
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator='$hardcode_libdir_separator'
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L
-
-# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
-# resulting binary.
-hardcode_runpath_var=$hardcode_runpath_var
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-EOF
-
-# Detect if we are using a relative or absolute path to ltmain.sh.
-case "$ltmain" in
-/*) cat <<EOF2 >> $ofile
-# Execute the libtool backend.
-. $ltmain
-EOF2
- ;;
-*) cat <<EOF3 >> $ofile
-# Find the path to this script.
-thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\`
-test "X\$0" = "X\$thisdir" && thisdir=.
-
-# Execute the libtool backend.
-. \$thisdir/$ltmain
-EOF3
- ;;
-esac
-
-echo 'exit 1' >> $ofile
-
-chmod +x $ofile
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index cf2ef91555..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,1813 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# Generated automatically from ltmain.sh.in by configure.
-# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
-# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# The name of this program.
-progname=`echo "$0" | sed 's%^.*/%%'`
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.0
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-objdir=.libs
-rm="rm -f"
-
-if test "$LTCONFIG_VERSION" != "$VERSION"; then
- echo "$progname: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-#
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- echo "$progname: not configured to build any kind of library" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show=echo
-show_help=
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case "$arg" in
- -*=*) optarg=`echo "$arg" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- eval "$prev=\$arg"
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case "$arg" in
- --help)
- show_help=yes
- ;;
-
- --version)
- echo "$PROGRAM (GNU $PACKAGE) $VERSION"
- exit 0
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
- else
- echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- echo "enable static libraries"
- else
- echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- -*)
- echo "$progname: unrecognized option \`$arg'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-
-if test -n "$prevopt"; then
- echo "$progname: option \`$prevopt' requires an argument" 1>&2
- echo "$help" 1>&2
- exit 1
-fi
-
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case "$nonopt" in
- *cc)
- mode=link
- for arg
- do
- case "$arg" in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *install*|cp)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *.la)
- mode=dlname
- ;;
- *)
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- echo "$progname: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- echo "$progname: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case "$mode" in
- # libtool compile mode
- compile)
- progname="$progname: compile"
- # Get the compilation command and the source file.
- base_compile="$nonopt"
- lastarg=
- srcfile=
-
- for arg
- do
- # Quote any args containing shell metacharacters.
- case "$arg" in
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*|*\"*)
- quote_arg="'$arg'" ;;
- *) quote_arg="$arg" ;;
- esac
-
- base_compile="$base_compile$lastarg"
- srcfile="$quote_arg"
- lastarg=" $srcfile"
- done
-
- # Get the name of the library object.
- libobj=`echo "$srcfile" | sed -e 's%^.*/%%'`
-
- # Recognize several different file suffixes.
- xform='[cCFSf]'
- case "$libobj" in
- *.c++) xform='c++' ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform='for' ;;
- esac
-
- libobj=`echo "$libobj" | sed -e "s/\.$xform$/.lo/"`
-
- case "$libobj" in
- *.lo) obj=`echo "$libobj" | sed -e 's/\.lo$/.o/'` ;;
- *)
- echo "$progname: cannot determine name of library object from \`$srcfile'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- echo "$progname: you must specify a compilation command" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- $run $rm $obj $libobj
- trap "$run $rm $obj $libobj; exit 1" 1 2 15
- else
- $run $rm $libobj
- trap "$run $rm $libobj; exit 1" 1 2 15
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # All platforms use -DPIC, to notify preprocessed assembler code.
- $show "$base_compile$pic_flag -DPIC $srcfile"
- if $run eval "$base_compile$pic_flag -DPIC $srcfile"; then :
- else
- test -n "$obj" && $run $rm $obj
- exit 1
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if test -z "$pic_flag"; then
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj
- exit $?
- fi
-
- # Just move the object, then go on to compile the next one
- $show "$mv $obj $libobj"
- $run $mv $obj $libobj || exit 1
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- $show "$base_compile $srcfile"
- if $run eval "$base_compile $srcfile"; then :
- else
- $run $rm $obj $libobj
- exit 1
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't accidentally
- # link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > $libobj" || exit $?
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link)
- progname="$progname: link"
- # Go through the arguments, transforming them on the way.
- cc="$nonopt"
- args="$cc"
- allow_undefined=no
- compile_command="$cc"
- finalize_command="$cc"
- compile_shlibpath=
- finalize_shlibpath=
- deplibs=
- export_dynamic=no
- hardcode_libdirs=
- install_libdir=
- libobjs=
- link_against_libtool_libs=
- link_static=
- ltlibs=
- objs=
- prev=
- prevarg=
- perm_rpath=
- temp_rpath=
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case "$arg" in
- -static)
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- for arg
- do
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- args="$args $arg"
- ;;
- esac
-
- eval "$prev=\$arg"
- prev=
-
- continue
- fi
-
- args="$args $arg"
- prevarg="$arg"
-
- case "$arg" in
- -allow-undefined) allow_undefined=yes ;;
-
- -export-dynamic)
- export_dynamic=yes
- compile_command="$compile_command $export_dynamic_flag"
- finalize_command="$finalize_command $export_dynamic_flag"
- continue
- ;;
-
- -L*)
- dir=`echo "$arg" | sed 's%^-L\(.*\)$%\1%'`
- case "$dir" in
- /*)
- ;;
- *)
- echo "$progname: \`-L$dir' cannot specify a relative directory" 1>&2
- exit 1
- ;;
- esac
- deplibs="$deplibs $arg"
- ;;
-
- -l*) deplibs="$deplibs $arg" ;;
-
- -o) prev=output ;;
-
- -rpath)
- prev=install_libdir
- continue
- ;;
-
- -static)
- link_static="`eval echo \"$link_static_flag\"`"
- compile_command="$compile_command $link_static"
- continue
- ;;
-
- -version-file)
- echo "$progname: \`-version-file' has been replaced by \`-version-info'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- -*) cc="$cc $arg" ;; # Some other compiler flag.
-
- *.o)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.a)
- # Find the relevant object directory and library name.
- file=`echo "$arg" | sed 's%^.*/%%'`
- dir=`echo "$arg" | sed 's%/[^/]*$%/%'`
- test "$dir" = "$arg" && dir=
-
- # Standard archive.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A library object.
- libobjs="$libobjs $arg"
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- libdir=
- library_names=
- old_library=
-
- # Check to see that this really is a libtool archive.
- if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
- else
- echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- # If there is no directory component, then add one.
- case "$arg" in
- */*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$libdir"; then
- echo "$progname: \`$arg' contains no -rpath information" 1>&2
- exit 1
- fi
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
-
- if test -z "$linklib"; then
- echo "$progname: cannot find name of link library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Find the relevant object directory and library name.
- name=`echo "$arg" | sed 's%^.*/%%; s/\.la$//; s/^lib//'`
- dir=`echo "$arg" | sed 's%/[^/]*$%%'`
- if test "$dir" = "$arg"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
-
- if test "$build_libtool_libs" = yes && test -n "$library_names"; then
- link_against_libtool_libs="$link_against_libtool_libs $arg"
- if test -n "$shlibpath_var"; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- "* $dir *") ;;
- *) temp_rpath="$temp_rpath $dir" ;;
- esac
- fi
-
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- # Put the magic libdir with the hardcode flag.
- hardcode_libdirs="$libdir"
- libdir="@HARDCODE_LIBDIRS@"
- else
- # Just accumulate the libdirs.
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- libdir=
- fi
- fi
-
- if test -n "$libdir"; then
- hardcode_libdir_flag=`eval echo \"$hardcode_libdir_flag_spec\"`
- compile_command="$compile_command $hardcode_libdir_flag"
- finalize_command="$finalize_command $hardcode_libdir_flag"
- fi
- elif test "$hardcode_runpath_var" = yes; then
- # Do the same for the permanent run path.
- case "$perm_rpath " in
- "* $libdir *") ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
-
-
- case "$hardcode_action" in
- immediate)
- if test "$hardcode_direct" = no; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = no; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- relink)
- # We need an absolute path.
- case "$dir" in
- /*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- echo "$progname: cannot determine absolute directory name of \`$dir'" 1>&2
- exit 1
- fi
- dir="$absdir"
- ;;
- esac
-
- if test "$hardcode_direct" = yes; then
- compile_command="$compile_command $dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- compile_command="$compile_command -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- compile_shlibpath="$compile_shlibpath$dir:"
- compile_command="$compile_command -l$name"
- fi
- ;;
-
- *)
- echo "$progname: \`$hardcode_action' is an unknown hardcode action" 1>&2
- exit 1
- ;;
- esac
-
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- finalize_command="$finalize_command $libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- finalize_command="$finalize_command -L$libdir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- finalize_shlibpath="$finalize_shlibpath$libdir:"
- finalize_command="$finalize_command -l$name"
- else
- # We can't seem to hardcode it, guess we'll fake it.
- finalize_command="$finalize_command -L$libdir -l$name"
- fi
- else
- # Transform directly to old archives if we don't build new libraries.
- if test -n "$pic_flag" && test -z "$old_library"; then
- echo "$progname: cannot find static library for \`$arg'" 1>&2
- exit 1
- fi
- test -n "$old_library" && linklib="$old_library"
- compile_command="$compile_command $dir/$linklib"
- finalize_command="$finalize_command $dir/$linklib"
- fi
- continue
- ;;
-
- *)
- echo "$progname: unknown file suffix for \`$arg'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- done
-
- if test -n "$prev"; then
- echo "$progname: the \`$prevarg' option requires an argument" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- # Substitute the hardcoded libdirs into the compile commands.
- if test "$hardcode_libdir_colon_separated" = yes; then
- compile_command=`echo "$compile_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- finalize_command=`echo "$finalize_command" | sed "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
- fi
-
- oldlib=
- oldobjs=
- case "$output" in
- "")
- echo "$progname: you must specify an output file" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-
- */*)
- echo "$progname: output file \`$output' must have no directory components" 1>&2
- exit 1
- ;;
-
- *.la)
- libname=`echo "$output" | sed 's/\.la$//'`
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
- current=0
- revision=0
- age=0
-
- if test -n "$objs"; then
- echo "$progname: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
- exit 1
- fi
-
- # How the heck are we supposed to write a wrapper for a shared library?
- if test -n "$link_against_libtool_libs"; then
- echo "$progname: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
- exit 1
- fi
-
- if test -z "$install_libdir"; then
- echo "$progname: you must specify an installation directory with \`-rpath'" 1>&2
- exit 1
- fi
-
- # Parse the version information argument.
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- set dummy $vinfo
- IFS="$save_ifs"
-
- if test -n "$5"; then
- echo "$progname: too many parameters to \`-version-info'" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- test -n "$2" && current="$2"
- test -n "$3" && revision="$3"
- test -n "$4" && age="$4"
-
- # Check that each of the things are valid numbers.
- case "$current" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- echo "$progname: CURRENT \`$current' is not a nonnegative integer" 1>&2
- echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$revision" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- echo "$progname: REVISION \`$revision' is not a nonnegative integer" 1>&2
- echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$age" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- echo "$progname: AGE \`$age' is not a nonnegative integer" 1>&2
- echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- echo "$progname: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- echo "$progname: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- version_vars="version_type current age revision"
- case "$version_type" in
- none) ;;
-
- linux)
- version_vars="$version_vars major versuffix"
- major=`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- version_vars="$version_vars versuffix verstring"
- major=`expr $current - $age`
- versuffix="$current.$age.$revision"
- verstring="$versuffix"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- version_vars="$version_vars major versuffix"
- major="$current"
- versuffix="$current.$revision"
- ;;
-
- *)
- echo "$progname: unknown library version type \`$version_type'" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Create the output directory, or remove our outputs if we need to.
- if test -d $objdir; then
- $show "$rm $objdir/$libname.*"
- $run $rm $objdir/$libname.*
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir || exit $?
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- echo "$progname: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- fi
- else
- # Clear the flag.
- allow_undefined_flag=
- fi
-
- if test "$build_libtool_libs" = yes; then
- # Get the real and link names of the library.
- library_names=`eval echo \"$library_names_spec\"`
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- soname=`eval echo \"$soname_spec\"`
- else
- soname="$realname"
- fi
-
- lib="$objdir/$realname"
- linknames=
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are PIC.
- test -z "$pic_flag" && libobjs=`echo "$libobjs " | sed 's/\.lo /.o /g; s/ $//g'`
-
- # Do each of the archive commands.
- cmds=`eval echo \"$archive_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Create links to the real library.
- for link in $linknames; do
- $show "(cd $objdir && $LN_S $realname $link)"
- $run eval "(cd $objdir && $LN_S $realname $link)" || exit $?
- done
-
- # If -export-dynamic was specified, set the dlname.
- if test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- *.lo | *.o)
- if test -n "$link_against_libtool_libs"; then
- echo "$progname: error: cannot link libtool libraries into reloadable objects" 1>&2
- exit 1
- fi
-
- if test -n "$deplibs"; then
- echo "$progname: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
- fi
-
- if test -n "$install_libdir"; then
- echo "$progname: warning: \`-rpath' is ignored while creating objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- echo "$progname: warning: \`-version-info' is ignored while creating objects" 1>&2
- fi
-
- case "$output" in
- *.lo)
- if test -n "$objs"; then
- echo "$progname: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`echo "$output" | sed 's/\.lo$/.o/'`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Create the old-style object.
- reload_objs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
-
- output="$obj"
- cmds=`eval echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- test -z "$libobj" && exit 0
-
- if test "$build_libtool_libs" != yes; then
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > $libobj" || exit $?
- exit 0
- fi
-
- if test -n "$pic_flag"; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs"
- output="$libobj"
- cmds=`eval echo \"$reload_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj || exit 1
- fi
-
- exit 0
- ;;
-
- *)
- if test -n "$install_libdir"; then
- echo "$progname: warning: \`-rpath' is ignored while linking programs" 1>&2
- fi
-
- if test -n "$vinfo"; then
- echo "$progname: warning: \`-version-info' is ignored while linking programs" 1>&2
- fi
-
- if test -n "$libobjs"; then
- # Transform all the library objects into standard objects.
- compile_command=`echo "$compile_command " | sed 's/\.lo /.o /g; s/ $//'`
- finalize_command=`echo "$finalize_command " | sed 's/\.lo /.o /g; s/ $//'`
- fi
-
- if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$output"'%g'`
- finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$output"'%g'`
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$compile_command"
- $run $compile_command
- status=$?
-
- # If we failed to link statically, then try again.
- if test $status -ne 0 && test -n "$link_static"; then
- echo "$progname: cannot link \`$output' statically; retrying semi-dynamically" 1>&2
- compile_command=`echo "$compile_command " | sed "s% $link_static % %;s/ $//"`
- $show "$finalize_command"
- $run $finalize_command
- status=$?
- fi
- exit $status
- fi
-
- # Replace the output file specification.
- compile_command=`echo "$compile_command" | sed 's%@OUTPUT@%'"$objdir/$output"'%g'`
- finalize_command=`echo "$finalize_command" | sed 's%@OUTPUT@%'"$objdir/$output"'T%g'`
-
- # Create the binary in the object directory, then wrap it.
- if test -d $objdir; then :
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir || exit $?
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case "$dir" in
- /*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- # Delete the old output file.
- $run $rm $output
-
- if test -n "$compile_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
- finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
- fi
-
- case "$hardcode_action" in
- relink)
- # AGH! Flame the AIX and HP-UX people for me, will ya?
- echo "$progname: warning: using a buggy system linker" 1>&2
- echo "$progname: relinking will be required before \`$output' can be installed" 1>&2
- ;;
- esac
-
- $show "$compile_command"
- $run eval "$compile_command" || exit $?
-
- # Now create the wrapper script.
- echo "creating $output"
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- cat > $output <<EOF
-#! /bin/sh
-
-# $output - temporary wrapper script for $objdir/$output
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of \``pwd`'.
-# If it is, it will not operate correctly.
-
-# This environment variable determines our operation mode.
-if test "\$libtool_install_magic" = "$magic"; then
- # install mode needs the following variables:
- link_against_libtool_libs='$link_against_libtool_libs'
- finalize_command='$finalize_command'
-else
- # Find the directory that this script lives in.
- thisdir=\`echo \$0 | sed 's%/[^/]*$%%'\`
- test "x\$thisdir" = "x\$0" && thisdir=.
-
- # Try to get the absolute directory name.
- absdir=\`cd "\$thisdir" && pwd\`
- test -n "\$absdir" && thisdir="\$absdir"
-
- progdir="\$thisdir/$objdir"
- program="$output"
-
- if test -f "\$progdir/\$program"; then
- # Run the actual program with our arguments.
- args=
- for arg
- do
- # Quote arguments (to preserve shell metacharacters).
- args="\$args '\$arg'"
- done
-
- # Export the path to the program.
- PATH="\$progdir:\$PATH"
- export PATH
-EOF
-
- # Export our shlibpath_var if we have one.
- if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- cat >> $output <<EOF
-
- # Add our own library path to $shlibpath_var
- $shlibpath_var="$temp_rpath\$$shlibpath_var"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- $shlibpath_var=\`echo \$$shlibpath_var | sed -e 's/:*\$//'\`
-
- export $shlibpath_var
-EOF
- fi
-
- cat >> $output <<EOF
-
- eval "exec \$program \$args"
-
- echo "\$0: cannot exec \$program \$args"
- exit 1
- else
- # The program doesn't exist.
- echo "\$0: error: \$progdir/\$program does not exist" 1>&2
- echo "This script is just a wrapper for \$program." 1>&2
- echo "See the $PACKAGE documentation for more information." 1>&2
- exit 1
- fi
-fi
-EOF
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
-
- # See if we need to build an old-fashioned archive.
- if test "$build_old_libs" = "yes"; then
- # Now set the variables for building old libraries.
- oldlib="$objdir/$libname.a"
-
- # Transform .lo files to .o files.
- oldobjs="$objs"`echo "$libobjs " | sed 's/[^ ]*\.a //g; s/\.lo /.o /g; s/ $//g'`
-
- if test -d "$objdir"; then
- $show "$rm $oldlib"
- $run $rm $oldlib
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- fi
-
- # Do each command in the archive commands.
- cmds=`eval echo \"$old_archive_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Now create the libtool archive.
- case "$output" in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.a"
-
- echo "creating $output"
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- cat > $output <<EOF
-# $output - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION
-
-# The name that we can dlopen(3).
-dlname='$dlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'
-EOF
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $objdir && $LN_S ../$output $output)"
- $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- progname="$progname: install"
-
- # The first argument is the name of the installation program.
- install_prog="$nonopt"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case "$arg" in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- echo "$progname: you must specify an install program" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- echo "$progname: the \`$prev' option requires an argument" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- echo "$progname: no file or destination specified" 1>&2
- else
- echo "$progname: you must specify a destination" 1>&2
- fi
- echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`echo "$dest" | sed 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test -n "$isdir"; then
- destdir="$dest"
- destname=
- else
- destdir=`echo "$dest" | sed 's%/[^/]*$%%'`
- test "$destdir" = "$dest" && destdir=.
- destname=`echo "$dest" | sed 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- echo "$progname: \`$dest' is not a directory" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
- fi
- case "$destdir" in
- /*) ;;
- *)
- for file in $files; do
- case "$file" in
- *.lo) ;;
- *)
- echo "$progname: \`$destdir' must be an absolute directory name" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case "$file" in
- *.a)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then :
- else
- echo "$progname: \`$file' is not a valid libtool archive" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "$destdir" = "$libdir"; then
- case "$current_libdirs " in
- "* $libdir *") ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- "* $libdir *") ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir="`echo "$file" | sed 's%/[^/]*$%%'`/"
- test "$dir" = "$file/" && dir=
- dir="$dir$objdir"
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$realname $destdir/$realname"
- $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
- test "X$dlname" = "X$realname" && dlname=
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run $striplib $destdir/$realname || exit $?
- else
- echo "$progname: warning: no library stripping program" 1>&2
- fi
- fi
-
- if test $# -gt 0; then
- # Delete the old symlinks.
- rmcmd="$rm"
- for linkname
- do
- rmcmd="$rmcmd $destdir/$linkname"
- done
- $show "$rmcmd"
- $run $rmcmd
-
- # ... and create new ones.
- for linkname
- do
- test "X$dlname" = "X$linkname" && dlname=
- $show "(cd $destdir && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $LN_S $realname $linkname)"
- done
- fi
-
- if test -n "$dlname"; then
- # Install the dynamically-loadable library.
- $show "$install_prog $dir/$dlname $destdir/$dlname"
- $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=`eval echo \"$postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`echo "$file" | sed 's%^.*/%%'`
- $show "$install_prog $file $destdir/$name"
- $run $install_prog $file $destdir/$name || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`echo "$file" | sed 's%^.*/%%;'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case "$destfile" in
- *.lo)
- staticdest=`echo "$destfile" | sed 's/\.lo$/\.o/;'`
- ;;
- *.o)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- echo "$progname: cannot copy a libtool object to \`$destfile'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run $install_prog $file $destfile || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`echo "$file" | sed 's/\.lo$/\.o/;'`
-
- $show "$install_prog $staticobj $staticdest"
- $run $install_prog $staticobj $staticdest || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Do a test to see if this is really a libtool program.
- if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
- link_against_libtool_libs=
- finalize_command=
-
- # If there is no directory component, then add one.
- case "$file" in
- */*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
- echo "$progname: invalid libtool wrapper script \`$file'" 1>&2
- exit 1
- fi
-
- finalize=yes
- for lib in $link_against_libtool_libs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case "$lib" in
- */*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/`echo "$lib" | sed 's%^.*/%%g'`"
- if test -z "$libdir"; then
- echo "$progname: warning: \`$lib' contains no -rpath information" 1>&2
- elif test -f "$libfile"; then :
- else
- echo "$progname: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- if test "$hardcode_action" = relink; then
- if test "$finalize" = yes; then
- echo "$progname: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
- $show "$finalize_command"
- if $run $finalize_command; then :
- else
- echo "$progname: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- file="$objdir/$file"T
- else
- echo "$progname: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- dir=`echo "$file" | sed 's%/[^/]*$%%'`
- if test "$file" = "$dir"; then
- file="$objdir/$file"
- else
- file="$dir/$objdir/`echo "$file" | sed 's%^.*/%%'`"
- fi
- fi
- fi
-
- $show "$install_prog$stripme $file $dest"
- $run $install_prog$stripme $file $dest || exit $?
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`echo "$file" | sed 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run $install_prog $file $oldlib || exit $?
-
- # Support stripping libraries.
- if test -n "$stripme"; then
- if test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run $old_striplib $oldlib || exit $?
- else
- echo "$progname: warning: no static library stripping program" 1>&2
- fi
- fi
-
- # Do each command in the postinstall commands.
- cmds=`eval echo \"$old_postinstall_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- echo "$progname: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec $0 --finish$current_libdirs
- exit 1
- fi
-
- exit 0
- ;;
-
- # libtool dlname mode
- dlname)
- progname="$progname: dlname"
- ltlibs="$nonopt"
- for lib
- do
- ltlibs="$ltlibs $lib"
- done
-
- if test -z "$ltlibs"; then
- echo "$progname: you must specify at least one LTLIBRARY" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- # Now check to make sure each one is a valid libtool library.
- status=0
- for lib in $ltlibs; do
- dlname=
- libdir=
- library_names=
-
- # Check to see that this really is a libtool archive.
- if egrep "^# Generated by $PROGRAM" $arg >/dev/null 2>&1; then :
- else
- echo "$progname: \`$arg' is not a valid libtool archive" 1>&2
- status=1
- continue
- fi
-
- # If there is no directory component, then add one.
- case "$arg" in
- */*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$libdir"; then
- echo "$progname: \`$arg' contains no -rpath information" 1>&2
- status=1
- elif test -n "$dlname"; then
- echo "$libdir/$dlname"
- elif test -z "$library_names"; then
- echo "$progname: \`$arg' is not a shared library" 1>&2
- status=1
- else
- echo "$progname: \`$arg' was not linked with \`-export-dynamic'" 1>&2
- status=1
- fi
- done
- exit $status
- ;;
-
- # libtool finish mode
- finish)
- progname="$progname: finish"
- libdirs="$nonopt"
-
- if test -n "$finish_cmds" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- # Do each command in the postinstall commands.
- cmds=`eval echo \"$finish_cmds\"`
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=';'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- done
- fi
-
- echo "To link against installed libraries in LIBDIR, users may have to:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to their \`$shlibpath_var' environment variable"
- fi
- echo " - use the \`-LLIBDIR' linker flag"
- exit 0
- ;;
-
- # libtool uninstall mode
- uninstall)
- progname="$progname: uninstall"
- rm="$nonopt"
- files=
-
- for arg
- do
- case "$arg" in
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- echo "$progname: you must specify an RM program" 1>&2
- echo "$help" 1>&2
- exit 1
- fi
-
- for file in $files; do
- dir=`echo "$file" | sed -e 's%/[^/]*$%%'`
- test "$dir" = "$file" && dir=.
- name=`echo "$file" | sed -e 's%^.*/%%'`
-
- rmfiles="$file"
-
- case "$name" in
- *.la)
- # Possibly a libtool archive, so verify it.
- if egrep "^# Generated by $PROGRAM" $file >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $dir/$n"
- test "X$n" = "X$dlname" && dlname=
- done
- test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
- test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
-
- # FIXME: should reinstall the best remaining shared library.
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`echo "$name" | sed 's/\.lo$/\.o/'`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- ;;
- esac
-
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- done
- exit 0
- ;;
-
- NONE)
- echo "$progname: you must specify a MODE" 1>&2
- echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- echo "$progname: invalid operation mode \`$mode'" 1>&2
- echo "$generic_help" 1>&2
- exit 1
-fi # test -z "$show_help"
-
-# We need to display help for each of the modes.
-case "$mode" in
-NONE) cat <<EOF
-Usage: $progname [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
--n, --dry-run display commands without modifying any files
- --features display configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --version print version information
-
-MODE must be one of the following:
-
- compile compile a source file into a libtool object
- dlname print filenames to use to \`dlopen' libtool libraries
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$progname --help --mode=MODE' for
-a more detailed description of MODE.
-EOF
- ;;
-
-compile)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'.
-EOF
- ;;
-
-dlname)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=dlname LTLIBRARY...
-
-Print filenames to use to \`dlopen' libtool libraries.
-
-Each LTLIBRARY is the name of a dynamically loadable libtool library (one that
-was linked using the \`-export-dynamic' option).
-
-The names to use are printed to standard output, one per line.
-EOF
- ;;
-
-finish)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed.
-EOF
- ;;
-
-install)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized).
-EOF
- ;;
-
-link)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -allow-undefined allow a libtool library to reference undefined symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -static do not do any dynamic linking or shared library creation
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
-library objects (\`.lo' files) may be specified, and \`-rpath' is required.
-
-If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
-and \`ranlib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
-created, otherwise an executable program is created.
-EOF
- ;;
-
-uninstall)
- cat <<EOF
-Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM.
-EOF
- ;;
-
-*)
- echo "$progname: invalid operation mode \`$mode'" 1>&2
- echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-case "$mode" in
-archive|compile)
- echo
- echo "Try \`$progname --help' for more information about other modes."
- ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/main.h b/main.h
deleted file mode 100644
index 4106f68cc5..0000000000
--- a/main.h
+++ /dev/null
@@ -1,72 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-
-#ifndef _MAIN_H
-#define _MAIN_H
-
-#include "zend_globals.h"
-
-#define INIT_ENVIRONMENT 0x80
-#define INIT_REQUEST_INFO 0x400
-#define INIT_FUNCTIONS 0x800
-#define INIT_SCANNER 0x1000
-#define INIT_CONFIG 0x10000
-#define INIT_VARIABLE_UNASSIGN_STACK 0x20000
-#define INIT_WINSOCK 0x100000
-#define INIT_CLASS_TABLE 0x400000
-
-int php3_request_startup(CLS_D ELS_DC);
-extern void php3_request_shutdown(void *dummy INLINE_TLS);
-extern void php3_request_shutdown_for_exec(void *dummy);
-extern int php3_module_startup(CLS_D ELS_DC);
-extern void php3_module_shutdown(INLINE_TLS_VOID);
-extern void php3_module_shutdown_for_exec(void);
-
-#ifndef THREAD_SAFE
-extern unsigned char header_is_being_sent;
-extern int initialized;
-#endif
-
-extern void php3_call_shutdown_functions(void);
-
-
-/* configuration module */
-extern int php3_init_config(void);
-extern int php3_shutdown_config(void);
-
-/* environment module */
-extern int php3_init_environ(void);
-extern int php3_shutdown_environ(void);
-
-#endif
diff --git a/main/alloca.c b/main/alloca.c
deleted file mode 100644
index aa512d9a1c..0000000000
--- a/main/alloca.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* alloca.c -- allocate automatically reclaimed memory
- (Mostly) portable public-domain implementation -- D A Gwyn
-
- This implementation of the PWB library alloca function,
- which is used to allocate space off the run-time stack so
- that it is automatically reclaimed upon procedure exit,
- was inspired by discussions with J. Q. Johnson of Cornell.
- J.Otto Tennant <jot@cray.com> contributed the Cray support.
-
- There are some preprocessor constants that can
- be defined when compiling for your specific system, for
- improved efficiency; however, the defaults should be okay.
-
- The general concept of this implementation is to keep
- track of all alloca-allocated blocks, and reclaim any
- that are found to be deeper in the stack than the current
- invocation. This heuristic does not reclaim storage as
- soon as it becomes invalid, but it will do so eventually.
-
- As a special case, alloca(0) reclaims storage without
- allocating any. It is a good idea to use alloca(0) in
- your main control loop, etc. to force garbage collection. */
-
-#include <config.h>
-
-#if !HAVE_ALLOCA
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef emacs
-#include "blockinput.h"
-#endif
-
-/* If compiling with GCC 2, this file's not needed. */
-#if !defined (__GNUC__) || __GNUC__ < 2
-
-/* If someone has defined alloca as a macro,
- there must be some other way alloca is supposed to work. */
-#ifndef alloca
-
-#ifdef emacs
-#ifdef static
-/* actually, only want this if static is defined as ""
- -- this is for usg, in which emacs must undefine static
- in order to make unexec workable
- */
-#ifndef STACK_DIRECTION
-you
-lose
--- must know STACK_DIRECTION at compile-time
-#endif /* STACK_DIRECTION undefined */
-#endif /* static */
-#endif /* emacs */
-
-/* If your stack is a linked list of frames, you have to
- provide an "address metric" ADDRESS_FUNCTION macro. */
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-long i00afunc ();
-#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
-#else
-#define ADDRESS_FUNCTION(arg) &(arg)
-#endif
-
-#if __STDC__
-typedef void *pointer;
-#else
-typedef char *pointer;
-#endif
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-/* Different portions of Emacs need to call different versions of
- malloc. The Emacs executable needs alloca to call xmalloc, because
- ordinary malloc isn't protected from input signals. On the other
- hand, the utilities in lib-src need alloca to call malloc; some of
- them are very simple, and don't have an xmalloc routine.
-
- Non-Emacs programs expect this to call use xmalloc.
-
- Callers below should use malloc. */
-
-#ifndef emacs
-#define malloc xmalloc
-#endif
-extern pointer malloc ();
-
-/* Define STACK_DIRECTION if you know the direction of stack
- growth for your system; otherwise it will be automatically
- deduced at run-time.
-
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown */
-
-#ifndef STACK_DIRECTION
-#define STACK_DIRECTION 0 /* Direction unknown. */
-#endif
-
-#if STACK_DIRECTION != 0
-
-#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
-
-#else /* STACK_DIRECTION == 0; need run-time code. */
-
-static int stack_dir; /* 1 or -1 once known. */
-#define STACK_DIR stack_dir
-
-static void
-find_stack_direction ()
-{
- static char *addr = NULL; /* Address of first `dummy', once known. */
- auto char dummy; /* To get stack address. */
-
- if (addr == NULL)
- { /* Initial entry. */
- addr = ADDRESS_FUNCTION (dummy);
-
- find_stack_direction (); /* Recurse once. */
- }
- else
- {
- /* Second entry. */
- if (ADDRESS_FUNCTION (dummy) > addr)
- stack_dir = 1; /* Stack grew upward. */
- else
- stack_dir = -1; /* Stack grew downward. */
- }
-}
-
-#endif /* STACK_DIRECTION == 0 */
-
-/* An "alloca header" is used to:
- (a) chain together all alloca'ed blocks;
- (b) keep track of stack depth.
-
- It is very important that sizeof(header) agree with malloc
- alignment chunk size. The following default should work okay. */
-
-#ifndef ALIGN_SIZE
-#define ALIGN_SIZE sizeof(double)
-#endif
-
-typedef union hdr
-{
- char align[ALIGN_SIZE]; /* To force sizeof(header). */
- struct
- {
- union hdr *next; /* For chaining headers. */
- char *deep; /* For stack depth measure. */
- } h;
-} header;
-
-static header *last_alloca_header = NULL; /* -> last alloca header. */
-
-/* Return a pointer to at least SIZE bytes of storage,
- which will be automatically reclaimed upon exit from
- the procedure that called alloca. Originally, this space
- was supposed to be taken from the current stack frame of the
- caller, but that method cannot be made to work for some
- implementations of C, for example under Gould's UTX/32. */
-
-pointer
-alloca (size)
- unsigned size;
-{
- auto char probe; /* Probes stack depth: */
- register char *depth = ADDRESS_FUNCTION (probe);
-
-#if STACK_DIRECTION == 0
- if (STACK_DIR == 0) /* Unknown growth direction. */
- find_stack_direction ();
-#endif
-
- /* Reclaim garbage, defined as all alloca'd storage that
- was allocated from deeper in the stack than currently. */
-
- {
- register header *hp; /* Traverses linked list. */
-
-#ifdef emacs
- BLOCK_INPUT;
-#endif
-
- for (hp = last_alloca_header; hp != NULL;)
- if ((STACK_DIR > 0 && hp->h.deep > depth)
- || (STACK_DIR < 0 && hp->h.deep < depth))
- {
- register header *np = hp->h.next;
-
- free ((pointer) hp); /* Collect garbage. */
-
- hp = np; /* -> next header. */
- }
- else
- break; /* Rest are not deeper. */
-
- last_alloca_header = hp; /* -> last valid storage. */
-
-#ifdef emacs
- UNBLOCK_INPUT;
-#endif
- }
-
- if (size == 0)
- return NULL; /* No allocation required. */
-
- /* Allocate combined header + user data storage. */
-
- {
- register pointer new = malloc (sizeof (header) + size);
- /* Address of header. */
-
- if (new == 0)
- abort();
-
- ((header *) new)->h.next = last_alloca_header;
- ((header *) new)->h.deep = depth;
-
- last_alloca_header = (header *) new;
-
- /* User storage begins just after header. */
-
- return (pointer) ((char *) new + sizeof (header));
- }
-}
-
-#if defined (CRAY) && defined (CRAY_STACKSEG_END)
-
-#ifdef DEBUG_I00AFUNC
-#include <stdio.h>
-#endif
-
-#ifndef CRAY_STACK
-#define CRAY_STACK
-#ifndef CRAY2
-/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
-struct stack_control_header
- {
- long shgrow:32; /* Number of times stack has grown. */
- long shaseg:32; /* Size of increments to stack. */
- long shhwm:32; /* High water mark of stack. */
- long shsize:32; /* Current size of stack (all segments). */
- };
-
-/* The stack segment linkage control information occurs at
- the high-address end of a stack segment. (The stack
- grows from low addresses to high addresses.) The initial
- part of the stack segment linkage control information is
- 0200 (octal) words. This provides for register storage
- for the routine which overflows the stack. */
-
-struct stack_segment_linkage
- {
- long ss[0200]; /* 0200 overflow words. */
- long sssize:32; /* Number of words in this segment. */
- long ssbase:32; /* Offset to stack base. */
- long:32;
- long sspseg:32; /* Offset to linkage control of previous
- segment of stack. */
- long:32;
- long sstcpt:32; /* Pointer to task common address block. */
- long sscsnm; /* Private control structure number for
- microtasking. */
- long ssusr1; /* Reserved for user. */
- long ssusr2; /* Reserved for user. */
- long sstpid; /* Process ID for pid based multi-tasking. */
- long ssgvup; /* Pointer to multitasking thread giveup. */
- long sscray[7]; /* Reserved for Cray Research. */
- long ssa0;
- long ssa1;
- long ssa2;
- long ssa3;
- long ssa4;
- long ssa5;
- long ssa6;
- long ssa7;
- long sss0;
- long sss1;
- long sss2;
- long sss3;
- long sss4;
- long sss5;
- long sss6;
- long sss7;
- };
-
-#else /* CRAY2 */
-/* The following structure defines the vector of words
- returned by the STKSTAT library routine. */
-struct stk_stat
- {
- long now; /* Current total stack size. */
- long maxc; /* Amount of contiguous space which would
- be required to satisfy the maximum
- stack demand to date. */
- long high_water; /* Stack high-water mark. */
- long overflows; /* Number of stack overflow ($STKOFEN) calls. */
- long hits; /* Number of internal buffer hits. */
- long extends; /* Number of block extensions. */
- long stko_mallocs; /* Block allocations by $STKOFEN. */
- long underflows; /* Number of stack underflow calls ($STKRETN). */
- long stko_free; /* Number of deallocations by $STKRETN. */
- long stkm_free; /* Number of deallocations by $STKMRET. */
- long segments; /* Current number of stack segments. */
- long maxs; /* Maximum number of stack segments so far. */
- long pad_size; /* Stack pad size. */
- long current_address; /* Current stack segment address. */
- long current_size; /* Current stack segment size. This
- number is actually corrupted by STKSTAT to
- include the fifteen word trailer area. */
- long initial_address; /* Address of initial segment. */
- long initial_size; /* Size of initial segment. */
- };
-
-/* The following structure describes the data structure which trails
- any stack segment. I think that the description in 'asdef' is
- out of date. I only describe the parts that I am sure about. */
-
-struct stk_trailer
- {
- long this_address; /* Address of this block. */
- long this_size; /* Size of this block (does not include
- this trailer). */
- long unknown2;
- long unknown3;
- long link; /* Address of trailer block of previous
- segment. */
- long unknown5;
- long unknown6;
- long unknown7;
- long unknown8;
- long unknown9;
- long unknown10;
- long unknown11;
- long unknown12;
- long unknown13;
- long unknown14;
- };
-
-#endif /* CRAY2 */
-#endif /* not CRAY_STACK */
-
-#ifdef CRAY2
-/* Determine a "stack measure" for an arbitrary ADDRESS.
- I doubt that "lint" will like this much. */
-
-static long
-i00afunc (long *address)
-{
- struct stk_stat status;
- struct stk_trailer *trailer;
- long *block, size;
- long result = 0;
-
- /* We want to iterate through all of the segments. The first
- step is to get the stack status structure. We could do this
- more quickly and more directly, perhaps, by referencing the
- $LM00 common block, but I know that this works. */
-
- STKSTAT (&status);
-
- /* Set up the iteration. */
-
- trailer = (struct stk_trailer *) (status.current_address
- + status.current_size
- - 15);
-
- /* There must be at least one stack segment. Therefore it is
- a fatal error if "trailer" is null. */
-
- if (trailer == 0)
- abort ();
-
- /* Discard segments that do not contain our argument address. */
-
- while (trailer != 0)
- {
- block = (long *) trailer->this_address;
- size = trailer->this_size;
- if (block == 0 || size == 0)
- abort ();
- trailer = (struct stk_trailer *) trailer->link;
- if ((block <= address) && (address < (block + size)))
- break;
- }
-
- /* Set the result to the offset in this segment and add the sizes
- of all predecessor segments. */
-
- result = address - block;
-
- if (trailer == 0)
- {
- return result;
- }
-
- do
- {
- if (trailer->this_size <= 0)
- abort ();
- result += trailer->this_size;
- trailer = (struct stk_trailer *) trailer->link;
- }
- while (trailer != 0);
-
- /* We are done. Note that if you present a bogus address (one
- not in any segment), you will get a different number back, formed
- from subtracting the address of the first block. This is probably
- not what you want. */
-
- return (result);
-}
-
-#else /* not CRAY2 */
-/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
- Determine the number of the cell within the stack,
- given the address of the cell. The purpose of this
- routine is to linearize, in some sense, stack addresses
- for alloca. */
-
-static long
-i00afunc (long address)
-{
- long stkl = 0;
-
- long size, pseg, this_segment, stack;
- long result = 0;
-
- struct stack_segment_linkage *ssptr;
-
- /* Register B67 contains the address of the end of the
- current stack segment. If you (as a subprogram) store
- your registers on the stack and find that you are past
- the contents of B67, you have overflowed the segment.
-
- B67 also points to the stack segment linkage control
- area, which is what we are really interested in. */
-
- stkl = CRAY_STACKSEG_END ();
- ssptr = (struct stack_segment_linkage *) stkl;
-
- /* If one subtracts 'size' from the end of the segment,
- one has the address of the first word of the segment.
-
- If this is not the first segment, 'pseg' will be
- nonzero. */
-
- pseg = ssptr->sspseg;
- size = ssptr->sssize;
-
- this_segment = stkl - size;
-
- /* It is possible that calling this routine itself caused
- a stack overflow. Discard stack segments which do not
- contain the target address. */
-
- while (!(this_segment <= address && address <= stkl))
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
-#endif
- if (pseg == 0)
- break;
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- this_segment = stkl - size;
- }
-
- result = address - this_segment;
-
- /* If you subtract pseg from the current end of the stack,
- you get the address of the previous stack segment's end.
- This seems a little convoluted to me, but I'll bet you save
- a cycle somewhere. */
-
- while (pseg != 0)
- {
-#ifdef DEBUG_I00AFUNC
- fprintf (stderr, "%011o %011o\n", pseg, size);
-#endif
- stkl = stkl - pseg;
- ssptr = (struct stack_segment_linkage *) stkl;
- size = ssptr->sssize;
- pseg = ssptr->sspseg;
- result += size;
- }
- return (result);
-}
-
-#endif /* not CRAY2 */
-#endif /* CRAY */
-
-#endif /* no alloca */
-#endif /* not GCC version 2 */
-#endif /* HAVE_ALLOCA */
diff --git a/main/config.w32.h b/main/config.w32.h
deleted file mode 100644
index 141287ae55..0000000000
--- a/main/config.w32.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* config.w32.h. Configure file for win32 platforms */
-/* tested only with MS Visual C++ V5 */
-
-
-/* if you have resolv.lib and lib44bsd95.lib you can compile the extra
- dns functions located in dns.c. Set this to 1. add resolv.lib and
- lib33bsd95.lib to the project settings, and add the path to the
- bind include directory to the preprocessor settings. These libs
- are availabe in the ntbind distribution */
-#define HAVE_BINDLIB 1
-
-/* set to enable bcmath */
-#define WITH_BCMATH 1
-/* should be added to runtime config*/
-#define PHP3_URL_FOPEN 1
-
-/* ----------------------------------------------------------------
- The following are defaults for run-time configuration
- ---------------------------------------------------------------*/
-
-#define PHP_SAFE_MODE 0
-#define MAGIC_QUOTES 0
-/* This is the default configuration file to read */
-#define CONFIGURATION_FILE_PATH "php3.ini"
-#define USE_CONFIG_FILE 1
-
-/* Undefine if you want stricter XML/SGML compliance by default */
-/* this disables "<?expression?>" and "<?=expression?>" */
-#define DEFAULT_SHORT_OPEN_TAG 1
-
-#define PHP_TRACK_VARS 1
-
-/* ----------------------------------------------------------------
- The following defines are for those modules which require
- external libraries to compile. These will be removed from
- here in a future beta, as these modules will be moved out to dll's
- ---------------------------------------------------------------*/
-#if !defined(COMPILE_DL)
-#define HAVE_SNMP 0
-#define HAVE_MYSQL 0
-# define HAVE_ERRMSG_H 0 /*needed for mysql 3.21.17 and up*/
-#define HAVE_LDAP 0
-#define DBASE 0
-#define NDBM 0
-#define GDBM 0
-#define BSD2 0
-#define HAVE_CRYPT 0
-#define HAVE_ORACLE 0
-#define HAVE_ADABAS 0
-#define HAVE_SOLID 0
-#define HAVE_MSQL 0
-#define HAVE_PGSQL 0
-#define HAVE_SYBASE 0
-#define HAVE_LIBGD 0
-#define HAVE_FILEPRO 0
-#define HAVE_ZLIB 0
-#endif
-/* ----------------------------------------------------------------
- The following may or may not be (or need to be) ported to the
- windows environment.
- ---------------------------------------------------------------*/
-
-/* Define if you have the link function. */
-#define HAVE_LINK 0
-
-/* Define if you have the lockf function. */
-/* #undef HAVE_LOCKF */
-
-/* Define if you have the lrand48 function. */
-/* #undef HAVE_LRAND48 */
-
-/* Define if you have the srand48 function. */
-/* #undef HAVE_SRAND48 */
-
-/* Define if you have the symlink function. */
-#define HAVE_SYMLINK 0
-
-/* Define if you have the usleep function. */
-#define HAVE_USLEEP 1
-
-#define NEED_ISBLANK 1
-/* ----------------------------------------------------------------
- The following may be changed and played with right now, but
- will move to the "don't touch" list below eventualy.
- ---------------------------------------------------------------*/
-
-/*#define APACHE 0 defined in preprocessor section*/
-
-
-/* ----------------------------------------------------------------
- The following should never need to be played with
- Functions defined to 0 or remarked out are either already
- handled by the standard VC libraries, or are no longer needed, or
- simply will/can not be ported.
-
- DONT TOUCH!!!!! Unless you realy know what your messing with!
- ---------------------------------------------------------------*/
-
-#define DISCARD_PATH 1
-#define HAVE_SETITIMER 0
-#define HAVE_IODBC 0 /*getting rid of old odbc*/
-#define HAVE_UODBC 0
-#define HAVE_LIBDL 1
-#define HAVE_SENDMAIL 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_PUTENV 1
-#define HAVE_LIMITS_H 1
-
-#define HAVE_TZSET 1
-/* Define if you have the flock function. */
-#define HAVE_FLOCK 1
-
-/* Define if using alloca.c. */
-/* #undef C_ALLOCA */
-
-/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
- This function is required for alloca.c support on those systems. */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef gid_t */
-
-/* Define if you have alloca, as a function or macro. */
-#define HAVE_ALLOCA 1
-
-/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define if you have <sys/time.h> */
-#define HAVE_SYS_TIME_H 0
-
-/* Define if you have <signal.h> */
-#define HAVE_SIGNAL_H 1
-
-/* Define if you don't have vprintf but do have _doprnt. */
-/* #undef HAVE_DOPRNT */
-
-/* Define if your struct stat has st_blksize. */
-#define HAVE_ST_BLKSIZE 0
-
-/* Define if your struct stat has st_blocks. */
-#define HAVE_ST_BLOCKS 0
-
-/* Define if your struct stat has st_rdev. */
-#define HAVE_ST_RDEV 1
-
-/* Define if utime(file, NULL) sets file's timestamp to the present. */
-#define HAVE_UTIME_NULL 1
-
-/* Define if you have the vprintf function. */
-#define HAVE_VPRINTF 1
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* If using the C implementation of alloca, define if you know the
- direction of stack growth for your system; otherwise it will be
- automatically deduced at run-time.
- STACK_DIRECTION > 0 => grows toward higher addresses
- STACK_DIRECTION < 0 => grows toward lower addresses
- STACK_DIRECTION = 0 => direction of growth unknown
- */
-/* #undef STACK_DIRECTION */
-
-/* Define if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if your <sys/time.h> declares struct tm. */
-/* #undef TM_IN_SYS_TIME */
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-/* #undef uid_t */
-
-/* Define both of these if you want the bundled REGEX library */
-#define REGEX 1
-#define HSREGEX 1
-
-/* Define if you have the gcvt function. */
-#define HAVE_GCVT 1
-
-/* Define if you have the getlogin function. */
-#define HAVE_GETLOGIN 1
-
-/* Define if you have the gettimeofday function. */
-#define HAVE_GETTIMEOFDAY 1
-
-/* Define if you have the memcpy function. */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the memmove function. */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the putenv function. */
-#define HAVE_PUTENV 1
-
-/* Define if you have the regcomp function. */
-#define HAVE_REGCOMP 1
-
-/* Define if you have the setlocale function. */
-#define HAVE_SETLOCALE 1
-
-/* Define if you have the setvbuf function. */
-#ifndef HAVE_BINDLIB
-#define HAVE_SETVBUF 1
-#endif
-
-/* Define if you have the snprintf function. */
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-/* Define if you have the strcasecmp function. */
-#define HAVE_STRCASECMP 1
-
-/* Define if you have the strdup function. */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function. */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strstr function. */
-#define HAVE_STRSTR 1
-
-/* Define if you have the tempnam function. */
-#define HAVE_TEMPNAM 1
-
-/* Define if you have the utime function. */
-#define HAVE_UTIME 1
-
-/* Define if you have the <crypt.h> header file. */
-/* #undef HAVE_CRYPT_H */
-
-/* Define if you have the <dirent.h> header file. */
-#define HAVE_DIRENT_H 0
-
-/* Define if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define if you have the <grp.h> header file. */
-#define HAVE_GRP_H 0
-
-/* Define if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define if you have the <ndir.h> header file. */
-/* #undef HAVE_NDIR_H */
-
-/* Define if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
-
-/* Define if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
-/* Define if you have the <sys/dir.h> header file. */
-/* #undef HAVE_SYS_DIR_H */
-
-/* Define if you have the <sys/file.h> header file. */
-#define HAVE_SYS_FILE_H 1
-
-/* Define if you have the <sys/ndir.h> header file. */
-/* #undef HAVE_SYS_NDIR_H */
-
-/* Define if you have the <sys/socket.h> header file. */
-#define HAVE_SYS_SOCKET_H 0
-
-/* Define if you have the <sys/wait.h> header file. */
-#define HAVE_SYS_WAIT_H 0
-
-/* Define if you have the <syslog.h> header file. */
-#define HAVE_SYSLOG_H 1
-
-/* Define if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 0
-
-/* Define if you have the crypt library (-lcrypt). */
-/* #undef HAVE_LIBCRYPT 0 */
-
-/* Define if you have the dl library (-ldl). */
-#define HAVE_LIBDL 1
-
-/* Define if you have the m library (-lm). */
-#define HAVE_LIBM 1
-
-/* Define if you have the nsl library (-lnsl). */
-/* #undef HAVE_LIBNSL */
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
-
-/* Define if you have the cuserid function. */
-#define HAVE_CUSERID 0
-
-/* Define if you have the rint function. */
-#undef HAVE_RINT
-
-#define HAVE_STRFTIME 1
diff --git a/main/configuration-parser.y b/main/configuration-parser.y
deleted file mode 100644
index 20af47b4db..0000000000
--- a/main/configuration-parser.y
+++ /dev/null
@@ -1,415 +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: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-
-/* $Id$ */
-
-#define DEBUG_CFG_PARSER 1
-#include "php.h"
-#include "php_globals.h"
-#include "php_ini.h"
-#include "functions/dl.h"
-#include "ext/standard/file.h"
-#include "ext/standard/php3_browscap.h"
-#include "zend_extensions.h"
-
-#if WIN32
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <winbase.h>
-#include "win32/wfile.h"
-#endif
-
-#undef YYSTYPE
-#define YYSTYPE pval
-
-#define PARSING_MODE_CFG 0
-#define PARSING_MODE_BROWSCAP 1
-
-static HashTable configuration_hash;
-#ifndef THREAD_SAFE
-extern HashTable browser_hash;
-extern char *php3_ini_path;
-#endif
-static HashTable *active__php3_hash_table;
-static pval *current_section;
-static char *currently_parsed_filename;
-
-static int parsing_mode;
-
-pval yylval;
-
-extern int cfglex(pval *cfglval);
-extern FILE *cfgin;
-extern int cfglineno;
-extern void init_cfg_scanner(void);
-
-pval *cfg_get_entry(char *name, uint name_length)
-{
- pval *tmp;
-
- if (_php3_hash_find(&configuration_hash, name, name_length, (void **) &tmp)==SUCCESS) {
- return tmp;
- } else {
- return NULL;
- }
-}
-
-
-PHPAPI int cfg_get_long(char *varname,long *result)
-{
- pval *tmp,var;
-
- if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(long)NULL;
- return FAILURE;
- }
- var = *tmp;
- pval_copy_constructor(&var);
- convert_to_long(&var);
- *result = var.value.lval;
- return SUCCESS;
-}
-
-
-PHPAPI int cfg_get_double(char *varname,double *result)
-{
- pval *tmp,var;
-
- if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=(double)0;
- return FAILURE;
- }
- var = *tmp;
- pval_copy_constructor(&var);
- convert_to_double(&var);
- *result = var.value.dval;
- return SUCCESS;
-}
-
-
-PHPAPI int cfg_get_string(char *varname, char **result)
-{
- pval *tmp;
-
- if (_php3_hash_find(&configuration_hash,varname,strlen(varname)+1,(void **) &tmp)==FAILURE) {
- *result=NULL;
- return FAILURE;
- }
- *result = tmp->value.str.val;
- return SUCCESS;
-}
-
-
-static void yyerror(char *str)
-{
- fprintf(stderr,"PHP: Error parsing %s on line %d\n",currently_parsed_filename,cfglineno);
-}
-
-
-static void pvalue_config_destructor(pval *pvalue)
-{
- if (pvalue->type == IS_STRING && pvalue->value.str.val != empty_string) {
- free(pvalue->value.str.val);
- }
-}
-
-
-static void pvalue_browscap_destructor(pval *pvalue)
-{
- if (pvalue->type == IS_OBJECT || pvalue->type == IS_ARRAY) {
- _php3_hash_destroy(pvalue->value.ht);
- free(pvalue->value.ht);
- }
-}
-
-
-int php3_init_config(void)
-{
- TLS_VARS;
-
- if (_php3_hash_init(&configuration_hash, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1)==FAILURE) {
- return FAILURE;
- }
-
-#if USE_CONFIG_FILE
- {
- char *env_location,*default_location,*php_ini_path;
- int safe_mode_state = PG(safe_mode);
- char *opened_path;
- int free_default_location=0;
-
- env_location = getenv("PHPRC");
- if (!env_location) {
- env_location="";
- }
-#if WIN32|WINNT
- {
- if (GLOBAL(php3_ini_path)) {
- default_location = GLOBAL(php3_ini_path);
- } else {
- default_location = (char *) malloc(512);
-
- if (!GetWindowsDirectory(default_location,255)) {
- default_location[0]=0;
- }
- free_default_location=1;
- }
- }
-#else
- if (!GLOBAL(php3_ini_path)) {
- default_location = CONFIGURATION_FILE_PATH;
- } else {
- default_location = GLOBAL(php3_ini_path);
- }
-#endif
-
-/* build a path */
- php_ini_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
-
- if (!GLOBAL(php3_ini_path)) {
-#if WIN32|WINNT
- sprintf(php_ini_path,".;%s;%s",env_location,default_location);
-#else
- sprintf(php_ini_path,".:%s:%s",env_location,default_location);
-#endif
- } else {
- /* if path was set via -c flag, only look there */
- strcpy(php_ini_path,default_location);
- }
- PG(safe_mode) = 0;
- cfgin = php3_fopen_with_path("php3.ini","r",php_ini_path,&opened_path);
- free(php_ini_path);
- if (free_default_location) {
- free(default_location);
- }
- PG(safe_mode) = safe_mode_state;
-
- if (!cfgin) {
-# if WIN32|WINNT
- return FAILURE;
-# else
- return SUCCESS; /* having no configuration file is ok */
-# endif
- }
-
- if (opened_path) {
- pval tmp;
-
- tmp.value.str.val = opened_path;
- tmp.value.str.len = strlen(opened_path);
- tmp.type = IS_STRING;
- _php3_hash_update(&configuration_hash,"cfg_file_path",sizeof("cfg_file_path"),(void *) &tmp,sizeof(pval),NULL);
-#if 0
- php3_printf("INI file opened at '%s'\n",opened_path);
-#endif
- }
-
- init_cfg_scanner();
- active__php3_hash_table = &configuration_hash;
- parsing_mode = PARSING_MODE_CFG;
- currently_parsed_filename = "php3.ini";
- yyparse();
- fclose(cfgin);
- }
-
-#endif
-
- return SUCCESS;
-}
-
-
-int php3_minit_browscap(INIT_FUNC_ARGS)
-{
- char *browscap = INI_STR("browscap");
-
- if (browscap) {
- if (_php3_hash_init(&GLOBAL(browser_hash), 0, NULL, (void (*)(void *))pvalue_browscap_destructor, 1)==FAILURE) {
- return FAILURE;
- }
-
- cfgin = fopen(browscap, "r");
- if (!cfgin) {
- php3_error(E_WARNING,"Cannot open '%s' for reading", browscap);
- return FAILURE;
- }
- init_cfg_scanner();
- active__php3_hash_table = &GLOBAL(browser_hash);
- parsing_mode = PARSING_MODE_BROWSCAP;
- currently_parsed_filename = browscap;
- yyparse();
- fclose(cfgin);
- }
-
- return SUCCESS;
-}
-
-
-int php3_shutdown_config(void)
-{
- _php3_hash_destroy(&configuration_hash);
- return SUCCESS;
-}
-
-
-int php3_mshutdown_browscap(SHUTDOWN_FUNC_ARGS)
-{
- if (INI_STR("browscap")) {
- _php3_hash_destroy(&GLOBAL(browser_hash));
- }
- return SUCCESS;
-}
-
-
-static void convert_browscap_pattern(pval *pattern)
-{
- register int i,j;
- char *t;
-
- for (i=0; i<pattern->value.str.len; i++) {
- if (pattern->value.str.val[i]=='*' || pattern->value.str.val[i]=='?') {
- break;
- }
- }
-
- if (i==pattern->value.str.len) { /* no wildcards */
- return;
- }
-
- t = (char *) malloc(pattern->value.str.len*2);
-
- for (i=0,j=0; i<pattern->value.str.len; i++,j++) {
- switch (pattern->value.str.val[i]) {
- case '?':
- t[j] = '.';
- break;
- case '*':
- t[j++] = '.';
- t[j] = '*';
- break;
- case '.':
- t[j++] = '\\';
- t[j] = '.';
- break;
- default:
- t[j] = pattern->value.str.val[i];
- break;
- }
- }
- t[j]=0;
- free(pattern->value.str.val);
- pattern->value.str.val = t;
- pattern->value.str.len = j;
- return;
-}
-
-%}
-
-%pure_parser
-%token TC_STRING
-%token TC_ENCAPSULATED_STRING
-%token SECTION
-%token CFG_TRUE
-%token CFG_FALSE
-%token EXTENSION
-%token T_ZEND_EXTENSION
-
-%%
-
-statement_list:
- statement_list statement
- | /* empty */
-;
-
-statement:
- string '=' string_or_value {
-#if 0
- printf("'%s' = '%s'\n",$1.value.str.val,$3.value.str.val);
-#endif
- $3.type = IS_STRING;
- if (parsing_mode==PARSING_MODE_CFG) {
- _php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
- } else if (parsing_mode==PARSING_MODE_BROWSCAP) {
- php3_str_tolower($1.value.str.val,$1.value.str.len);
- _php3_hash_update(current_section->value.ht, $1.value.str.val, $1.value.str.len+1, &$3, sizeof(pval), NULL);
- }
- free($1.value.str.val);
- }
- | string { free($1.value.str.val); }
- | EXTENSION '=' string {
- pval dummy;
-#if 0
- printf("Loading '%s'\n",$3.value.str.val);
-#endif
-
- php3_dl(&$3,MODULE_PERSISTENT,&dummy);
- }
- | T_ZEND_EXTENSION '=' string { zend_load_extension($3.value.str.val); free($3.value.str.val); }
- | SECTION {
- if (parsing_mode==PARSING_MODE_BROWSCAP) {
- pval tmp;
-
- /*printf("'%s' (%d)\n",$1.value.str.val,$1.value.str.len+1);*/
- tmp.value.ht = (HashTable *) malloc(sizeof(HashTable));
- _php3_hash_init(tmp.value.ht, 0, NULL, (void (*)(void *))pvalue_config_destructor, 1);
- tmp.type = IS_OBJECT;
- _php3_hash_update(active__php3_hash_table, $1.value.str.val, $1.value.str.len+1, (void *) &tmp, sizeof(pval), (void **) &current_section);
- tmp.value.str.val = php3_strndup($1.value.str.val,$1.value.str.len);
- tmp.value.str.len = $1.value.str.len;
- tmp.type = IS_STRING;
- convert_browscap_pattern(&tmp);
- _php3_hash_update(current_section->value.ht,"browser_name_pattern",sizeof("browser_name_pattern"),(void *) &tmp, sizeof(pval), NULL);
- }
- free($1.value.str.val);
- }
- | '\n'
-;
-
-
-string:
- TC_STRING { $$ = $1; }
- | TC_ENCAPSULATED_STRING { $$ = $1; }
-;
-
-string_or_value:
- string { $$ = $1; }
- | CFG_TRUE { $$ = $1; }
- | CFG_FALSE { $$ = $1; }
- | '\n' { $$.value.str.val = strdup(""); $$.value.str.len=0; $$.type = IS_STRING; }
-;
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/configuration-scanner.l b/main/configuration-scanner.l
deleted file mode 100644
index 096a4a8248..0000000000
--- a/main/configuration-scanner.l
+++ /dev/null
@@ -1,170 +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 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: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "configuration-parser.h"
-
-#undef YYSTYPE
-#define YYSTYPE pval
-
-#define YY_DECL cfglex(pval *cfglval)
-
-
-void init_cfg_scanner()
-{
- cfglineno=1;
-}
-
-
-%}
-
-%option noyywrap
-%option yylineno
-
-%%
-
-<INITIAL>"extension" {
-#if 0
- printf("found extension\n");
-#endif
- return EXTENSION;
-}
-
-
-<INITIAL>"zend_extension" {
- return T_ZEND_EXTENSION;
-}
-
-<INITIAL>[ ]*("true"|"on"|"yes")[ ]* {
- cfglval->value.str.val = php3_strndup("1",1);
- cfglval->value.str.len = 1;
- cfglval->type = IS_STRING;
- return CFG_TRUE;
-}
-
-
-<INITIAL>[ ]*("false"|"off"|"no")[ ]* {
- cfglval->value.str.val = php3_strndup("",0);
- cfglval->value.str.len = 0;
- cfglval->type = IS_STRING;
- return CFG_FALSE;
-}
-
-
-<INITIAL>[[][^[]+[\]]([\n]?|"\r\n"?) {
- /* SECTION */
-
- /* eat trailng ] */
- while (yyleng>0 && (yytext[yyleng-1]=='\n' || yytext[yyleng-1]=='\r' || yytext[yyleng-1]==']')) {
- yyleng--;
- yytext[yyleng]=0;
- }
-
- /* eat leading [ */
- yytext++;
- yyleng--;
-
- cfglval->value.str.val = php3_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return SECTION;
-}
-
-
-<INITIAL>["][^\n\r"]*["] {
- /* ENCAPSULATED TC_STRING */
- register int i;
-
- /* eat trailing " */
- yytext[yyleng-1]=0;
-
- /* eat leading " */
- yytext++;
-
- cfglval->value.str.val = php3_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return TC_ENCAPSULATED_STRING;
-}
-
-
-<INITIAL>[^=\n\r\t;"]+ {
- /* STRING */
- register int i;
-
- /* eat trailing whitespace */
- for (i=yyleng-1; i>=0; i--) {
- if (yytext[i]==' ' || yytext[i]=='\t') {
- yytext[i]=0;
- yyleng--;
- } else {
- break;
- }
- }
- /* eat leading whitespace */
- while (yytext[0]) {
- if (yytext[0]==' ' || yytext[0]=='\t') {
- yytext++;
- yyleng--;
- } else {
- break;
- }
- }
- if (yyleng!=0) {
- cfglval->value.str.val = php3_strndup(yytext,yyleng);
- cfglval->value.str.len = yyleng;
- cfglval->type = IS_STRING;
- return TC_STRING;
- } else {
- /* whitespace */
- }
-}
-
-
-
-<INITIAL>[=\n] {
- return yytext[0];
-}
-
-<INITIAL>"\r\n" {
- return '\n';
-}
-
-<INITIAL>[;][^\r\n]*[\r\n]? {
- /* comment */
- return '\n';
-}
-
-<INITIAL>[ \t] {
- /* eat whitespace */
-}
-
-<INITIAL>. {
-#if DEBUG
- php3_error(E_NOTICE,"Unexpected character on line %d: '%s' (ASCII %d)\n",yylineno,yytext,yytext[0]);
-#endif
-}
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
deleted file mode 100644
index 367114bbc9..0000000000
--- a/main/fopen_wrappers.c
+++ /dev/null
@@ -1,995 +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 <rasmus@lerdorf.on.ca> |
- | Jim Winstead <jimw@php.net> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-
-#include "php.h"
-#include "php_globals.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#if MSVC5
-#include <windows.h>
-#include <winsock.h>
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
-#else
-#include <sys/param.h>
-#endif
-
-#include "safe_mode.h"
-#include "php3_realpath.h"
-#include "functions/head.h"
-#include "ext/standard/php3_standard.h"
-#include "zend_compile.h"
-
-#if HAVE_PWD_H
-#if MSVC5
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
-#endif
-
-#include <sys/types.h>
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(mode) (((mode)&S_IFMT) == S_IFREG)
-#endif
-
-#if MSVC5
-#include <winsock.h>
-#else
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#endif
-
-#if MSVC5
-#undef AF_UNIX
-#endif
-
-#if defined(AF_UNIX)
-#include <sys/un.h>
-#endif
-
-static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd);
-
-int _php3_getftpresult(int socketd);
-
-/*
- When open_basedir is not NULL, check if the given filename is located in
- open_basedir. Returns -1 if error or not in the open_basedir, else 0
-
- When open_basedir is NULL, always return 0
-*/
-PHPAPI int _php3_check_open_basedir(char *path)
-{
- char resolved_name[MAXPATHLEN];
- char local_open_basedir[MAXPATHLEN];
- int local_open_basedir_pos;
-
- /* Only check when open_basedir is available */
- if (PG(open_basedir) && *PG(open_basedir)) {
-
- /* Special case basedir==".": Use script-directory */
- if ((strcmp(PG(open_basedir), ".") == 0) &&
- GLOBAL(request_info).filename &&
- *GLOBAL(request_info).filename
- ) {
- strcpy(local_open_basedir, GLOBAL(request_info).filename);
- local_open_basedir_pos = strlen(local_open_basedir) - 1;
-
- /* Strip filename */
- while ((
-#if WIN32|WINNT
- (local_open_basedir[local_open_basedir_pos] != '\\') ||
-#endif
- (local_open_basedir[local_open_basedir_pos] != '/')
- ) &&
- (local_open_basedir_pos >= 0)
- ) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
-
- /* Strip double (back)slashes */
- if (local_open_basedir_pos > 0) {
- while ((
-#if WIN32|WINNT
- (local_open_basedir[local_open_basedir_pos-1] == '\\') ||
-#endif
- (local_open_basedir[local_open_basedir_pos-1] == '/')
- ) &&
- (local_open_basedir_pos > 0)
- ) {
- local_open_basedir[local_open_basedir_pos--] = 0;
- }
- }
-
- } else {
- /* Else use the unmodified path */
- strcpy(local_open_basedir, PG(open_basedir));
- }
-
- /* Resolve the real path into resolved_name */
- if (_php3_realpath(path, resolved_name) != NULL) {
- /* Check the path */
-#if WIN32|WINNT
- if (strncasecmp(local_open_basedir, resolved_name, strlen(local_open_basedir)) == 0) {
-#else
- if (strncmp(local_open_basedir, resolved_name, strlen(local_open_basedir)) == 0) {
-#endif
- /* File is in the right directory */
- return 0;
- } else {
- php3_error(E_WARNING, "open_basedir restriction in effect. File is in wrong directory.");
- return -1;
- }
- } else {
- /* Unable to resolve the real path, return -1 */
- php3_error(E_WARNING, "open_basedir restriction in effect. Unable to verify location of file.");
- return -1;
- }
- } else {
- /* open_basedir is not available, return 0 */
- return 0;
- }
-}
-
-PHPAPI FILE *php3_fopen_wrapper(char *path, char *mode, int options, int *issock, int *socketd)
-{
- int cm=2; /* checkuid mode: 2 = if file does not exist, check directory */
-#if PHP3_URL_FOPEN
- if (!(options & IGNORE_URL)) {
- return php3_fopen_url_wrapper(path, mode, options, issock, socketd);
- }
-#endif
-
- if (options & USE_PATH && PG(include_path) != NULL) {
- return php3_fopen_with_path(path, mode, PG(include_path), NULL);
- } else {
- if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path, cm))) {
- return NULL;
- }
- if (_php3_check_open_basedir(path)) return NULL;
- return fopen(path, mode);
- }
-}
-
-#if CGI_BINARY || FHTTPD || USE_SAPI
-
-FILE *php3_fopen_for_parser(void)
-{
- FILE *fp;
- struct stat st;
- char *temp, *path_info, *fn;
- int l;
- TLS_VARS;
-
-
- fn = GLOBAL(request_info).filename;
- path_info = GLOBAL(request_info).path_info;
-#if HAVE_PWD_H
- if (PG(user_dir) && *PG(user_dir)
- && path_info && '/' == path_info[0] && '~' == path_info[1]) {
-
- char user[32];
- struct passwd *pw;
- char *s = strchr(path_info + 2, '/');
-
- fn = NULL; /* discard the original filename, it must not be used */
- if (s) { /* if there is no path name after the file, do not bother
- to try open the directory */
- l = s - (path_info + 2);
- if (l > sizeof(user) - 1)
- l = sizeof(user) - 1;
- memcpy(user, path_info + 2, l);
- user[l] = '\0';
-
- pw = getpwnam(user);
- if (pw && pw->pw_dir) {
- fn = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
- if (fn) {
- strcpy(fn, pw->pw_dir); /* safe */
- strcat(fn, "/"); /* safe */
- strcat(fn, PG(user_dir)); /* safe */
- strcat(fn, "/"); /* safe */
- strcat(fn, s + 1); /* safe (shorter than path_info) */
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = fn;
- }
- }
- }
- } else
-#endif
-#if WIN32
- if (PG(doc_root) && path_info && ('/' == *PG(doc_root) ||
- '\\' == *PG(doc_root) || strstr(PG(doc_root),":\\") ||
- strstr(PG(doc_root),":/"))) {
-#else
- if (PG(doc_root) && '/' == *PG(doc_root) && path_info) {
-#endif
- l = strlen(PG(doc_root));
- fn = emalloc(l + strlen(path_info) + 2);
- if (fn) {
- memcpy(fn, PG(doc_root), l);
- if ('/' != fn[l - 1] || '\\' != fn[l - 1]) /* l is never 0 */
- fn[l++] = '/';
- if ('/' == path_info[0])
- l--;
- strcpy(fn + l, path_info);
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = fn;
- }
- } /* if doc_root && path_info */
- if (!fn) {
- /* we have to free request_info.filename here because
- php3_destroy_request_info assumes that it will get
- freed when the include_names hash is emptied, but
- we're not adding it in this case */
- STR_FREE(GLOBAL(request_info).filename);
- GLOBAL(request_info).filename = NULL;
- return NULL;
- }
- fp = fopen(fn, "r");
-
- /* refuse to open anything that is not a regular file */
- if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
- fclose(fp);
- fp = NULL;
- }
- if (!fp) {
- php3_error(E_CORE_ERROR, "Unable to open %s", fn);
- STR_FREE(GLOBAL(request_info).filename); /* for same reason as above */
- return NULL;
- }
-
- temp = estrdup(fn);
- _php3_dirname(temp, strlen(temp));
- if (*temp) {
- chdir(temp);
- }
- efree(temp);
-
- return fp;
-}
-
-#endif /* CGI_BINARY || USE_SAPI */
-
-/*
- * Tries to open a file with a PATH-style list of directories.
- * If the filename starts with "." or "/", the path is ignored.
- */
-PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path)
-{
- char *pathbuf, *ptr, *end;
- char trypath[MAXPATHLEN + 1];
- struct stat sb;
- FILE *fp;
- int cm=2;
- TLS_VARS;
-
- if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
- if (opened_path) {
- *opened_path = NULL;
- }
- /* Relative path open */
- if (*filename == '.') {
- if (PG(safe_mode) && (!_php3_checkuid(filename, cm))) {
- return NULL;
- }
- if (_php3_check_open_basedir(filename)) return NULL;
- fp = fopen(filename, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(filename);
- }
- return fp;
- }
- /* Absolute path open - prepend document_root in safe mode */
-#if WIN32|WINNT
- if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) {
-#else
- if (*filename == '/') {
-#endif
- if (PG(safe_mode)) {
- if(PG(doc_root)) {
- snprintf(trypath, MAXPATHLEN, "%s%s", PG(doc_root), filename);
- } else {
- strncpy(trypath,filename,MAXPATHLEN);
- }
- if (!_php3_checkuid(trypath, cm)) {
- return NULL;
- }
- if (_php3_check_open_basedir(trypath)) return NULL;
- fp = fopen(trypath, mode);
- if (fp && opened_path) {
- *opened_path = expand_filepath(trypath);
- }
- return fp;
- } else {
- if (_php3_check_open_basedir(filename)) return NULL;
- return fopen(filename, mode);
- }
- }
- if (!path || (path && !*path)) {
- if (PG(safe_mode) && (!_php3_checkuid(filename, cm))) {
- return NULL;
- }
- if (_php3_check_open_basedir(filename)) return NULL;
- fp = fopen(filename, mode);
- if (fp && opened_path) {
- *opened_path = strdup(filename);
- }
- return fp;
- }
- pathbuf = estrdup(path);
-
- ptr = pathbuf;
-
- while (ptr && *ptr) {
-#if WIN32|WINNT
- end = strchr(ptr, ';');
-#else
- end = strchr(ptr, ':');
-#endif
- if (end != NULL) {
- *end = '\0';
- end++;
- }
- snprintf(trypath, MAXPATHLEN, "%s/%s", ptr, filename);
- if (PG(safe_mode)) {
- if (stat(trypath, &sb) == 0 && (!_php3_checkuid(trypath, cm))) {
- efree(pathbuf);
- return NULL;
- }
- }
- if ((fp = fopen(trypath, mode)) != NULL) {
- if (_php3_check_open_basedir(trypath)) {
- fclose(fp);
- efree(pathbuf);
- return NULL;
- }
- if (opened_path) {
- *opened_path = expand_filepath(trypath);
- }
- efree(pathbuf);
- return fp;
- }
- ptr = end;
- }
- efree(pathbuf);
- return NULL;
-}
-
-/*
- * If the specified path starts with "http://" (insensitive to case),
- * a socket is opened to the specified web server and a file pointer is
- * position at the start of the body of the response (past any headers).
- * This makes a HTTP/1.0 request, and knows how to pass on the username
- * and password for basic authentication.
- *
- * If the specified path starts with "ftp://" (insensitive to case),
- * a pair of sockets are used to request the specified file and a file
- * pointer to the requested file is returned. Passive mode ftp is used,
- * so if the server doesn't suppor this, it will fail!
- *
- * Otherwise, fopen is called as usual and the file pointer is returned.
- */
-
-static FILE *php3_fopen_url_wrapper(const char *path, char *mode, int options, int *issock, int *socketd)
-{
- url *resource;
- int result;
- char *scratch;
- unsigned char *tmp;
-
- char tmp_line[256];
- char location[256];
- int chptr = 0;
- char *tpath, *ttpath;
- int body = 0;
- int reqok = 0;
- int lineone = 1;
- int i;
- char buf[2];
-
- char oldch1 = 0;
- char oldch2 = 0;
- char oldch3 = 0;
- char oldch4 = 0;
- char oldch5 = 0;
-
- FILE *fp = NULL;
- struct sockaddr_in server;
- unsigned short portno;
- char winfeof;
-
- if (!strncasecmp(path, "http://", 7)) {
- resource = url_parse((char *) path);
- if (resource == NULL) {
- php3_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 80 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 80;
-
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- lookup_hostname(resource->host, &server.sin_addr);
-
- if (server.sin_addr.s_addr == -1) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_port = htons(resource->port);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
-#if 0
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- return NULL;
- }
-#endif
-#endif /*win32 */
-
- /* tell remote http which file to get */
- SOCK_WRITE("GET ", *socketd);
- if (resource->path != NULL) {
- SOCK_WRITE(resource->path, *socketd);
- } else {
- SOCK_WRITE("/", *socketd);
- }
-
- /* append the query string, if any */
- if (resource->query != NULL) {
- SOCK_WRITE("?", *socketd);
- SOCK_WRITE(resource->query, *socketd);
- }
- SOCK_WRITE(" HTTP/1.0\n", *socketd);
-
- /* send authorization header if we have user/pass */
- if (resource->user != NULL && resource->pass != NULL) {
- scratch = (char *) emalloc(strlen(resource->user) + strlen(resource->pass) + 2);
- if (!scratch) {
- free_url(resource);
- return NULL;
- }
- strcpy(scratch, resource->user);
- strcat(scratch, ":");
- strcat(scratch, resource->pass);
- tmp = _php3_base64_encode((unsigned char *)scratch, strlen(scratch), NULL);
-
- SOCK_WRITE("Authorization: Basic ", *socketd);
- /* output "user:pass" as base64-encoded string */
- SOCK_WRITE((char *)tmp, *socketd);
- SOCK_WRITE("\n", *socketd);
- efree(scratch);
- efree(tmp);
- }
- /* if the user has configured who they are, send a From: line */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- SOCK_WRITE("From: ", *socketd);
- SOCK_WRITE(scratch, *socketd);
- SOCK_WRITE("\n", *socketd);
- }
- /* send a Host: header so name-based virtual hosts work */
- SOCK_WRITE("Host: ", *socketd);
- SOCK_WRITE(resource->host, *socketd);
- if(resource->port!=80) {
- sprintf(tmp_line,"%i",resource->port);
- SOCK_WRITE(":", *socketd);
- SOCK_WRITE(tmp_line, *socketd);
- }
- SOCK_WRITE("\n", *socketd);
-
- /* identify ourselves */
- SOCK_WRITE("User-Agent: PHP/", *socketd);
- SOCK_WRITE(PHP_VERSION, *socketd);
- SOCK_WRITE("\n", *socketd);
-
- /* end the headers */
- SOCK_WRITE("\n", *socketd);
-
- /* Read past http header */
- body = 0;
- location[0] = '\0';
- while (!body && recv(*socketd, (char *) &winfeof, 1, MSG_PEEK)) {
- if (SOCK_FGETC(buf, *socketd) == SOCK_RECV_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- oldch5 = oldch4;
- oldch4 = oldch3;
- oldch3 = oldch2;
- oldch2 = oldch1;
- oldch1 = *buf;
-
- tmp_line[chptr++] = *buf;
- if (*buf == 10 || *buf == 13) {
- tmp_line[chptr] = '\0';
- chptr = 0;
- if (!strncasecmp(tmp_line, "Location: ", 10)) {
- tpath = tmp_line + 10;
- strcpy(location, tpath);
- }
- }
- if (lineone && (*buf == 10 || *buf == 13)) {
- lineone = 0;
- }
- if (lineone && oldch5 == ' ' && oldch4 == '2' && oldch3 == '0' &&
- oldch2 == '0' && oldch1 == ' ') {
- reqok = 1;
- }
- if (oldch4 == 13 && oldch3 == 10 && oldch2 == 13 && oldch1 == 10) {
- body = 1;
- }
- if (oldch2 == 10 && oldch1 == 10) {
- body = 1;
- }
- if (oldch2 == 13 && oldch1 == 13) {
- body = 1;
- }
- }
- if (!reqok) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- if (location[0] != '\0') {
- return php3_fopen_url_wrapper(location, mode, options, issock, socketd);
- } else {
- return NULL;
- }
- }
- free_url(resource);
- *issock = 1;
- return (fp);
- } else if (!strncasecmp(path, "ftp://", 6)) {
- resource = url_parse((char *) path);
- if (resource == NULL) {
- php3_error(E_WARNING, "Invalid URL specified, %s", path);
- *issock = BAD_URL;
- return NULL;
- } else if (resource->path == NULL) {
- php3_error(E_WARNING, "No file-path specified");
- free_url(resource);
- *issock = BAD_URL;
- return NULL;
- }
- /* use port 21 if one wasn't specified */
- if (resource->port == 0)
- resource->port = 21;
-
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- lookup_hostname(resource->host, &server.sin_addr);
-
- if (server.sin_addr.s_addr == -1) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- server.sin_port = htons(resource->port);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
-#if 0
- if ((fpc = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fpc, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- fclose(fpc);
- return NULL;
- }
-#endif
-#endif
-
- /* Start talking to ftp server */
- result = _php3_getftpresult(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* send the user name */
- SOCK_WRITE("USER ", *socketd);
- if (resource->user != NULL) {
- _php3_rawurldecode(resource->user, strlen(resource->user));
- SOCK_WRITE(resource->user, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- SOCK_WRITE("\n", *socketd);
-
- /* get the response */
- result = _php3_getftpresult(*socketd);
-
- /* if a password is required, send it */
- if (result >= 300 && result <= 399) {
- SOCK_WRITE("PASS ", *socketd);
- if (resource->pass != NULL) {
- _php3_rawurldecode(resource->pass, strlen(resource->pass));
- SOCK_WRITE(resource->pass, *socketd);
- } else {
- /* if the user has configured who they are,
- send that as the password */
- if (cfg_get_string("from", &scratch) == SUCCESS) {
- SOCK_WRITE(scratch, *socketd);
- } else {
- SOCK_WRITE("anonymous", *socketd);
- }
- }
- SOCK_WRITE("\n", *socketd);
-
- /* read the response */
- result = _php3_getftpresult(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- } else if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- /* find out the size of the file (verifying it exists) */
- SOCK_WRITE("SIZE ", *socketd);
- SOCK_WRITE(resource->path, *socketd);
- SOCK_WRITE("\n", *socketd);
-
- /* read the response */
- result = _php3_getftpresult(*socketd);
- if (mode[0] == 'r') {
- /* when reading file, it must exist */
- if (result > 299 || result < 200) {
- php3_error(E_WARNING, "File not found");
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = ENOENT;
- return NULL;
- }
- } else {
- /* when writing file, it must NOT exist */
- if (result <= 299 && result >= 200) {
- php3_error(E_WARNING, "File already exists");
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- errno = EEXIST;
- return NULL;
- }
- }
-
- /* set the connection to be binary */
- SOCK_WRITE("TYPE I\n", *socketd);
- result = _php3_getftpresult(*socketd);
- if (result > 299 || result < 200) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* set up the passive connection */
- SOCK_WRITE("PASV\n", *socketd);
- while (SOCK_FGETS(tmp_line, 256, *socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- /* make sure we got a 227 response */
- if (strncmp(tmp_line, "227", 3)) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* parse pasv command (129,80,95,25,13,221) */
- tpath = tmp_line;
-
- /* skip over the "227 Some message " part */
- for (tpath += 4; *tpath && !isdigit((int) *tpath); tpath++);
- if (!*tpath) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- /* skip over the host ip, we just assume it's the same */
- for (i = 0; i < 4; i++) {
- for (; isdigit((int) *tpath); tpath++);
- if (*tpath == ',') {
- tpath++;
- } else {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- }
-
- /* pull out the MSB of the port */
- portno = (unsigned short) strtol(tpath, &ttpath, 10) * 256;
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- tpath = ttpath;
- if (*tpath == ',') {
- tpath++;
- } else {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- /* pull out the LSB of the port */
- portno += (unsigned short) strtol(tpath, &ttpath, 10);
-
- if (ttpath == NULL) {
- /* didn't get correct response from PASV */
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-
- if (mode[0] == 'r') {
- /* retrieve file */
- SOCK_WRITE("RETR ", *socketd);
- } else {
- /* store file */
- SOCK_WRITE("STOR ", *socketd);
- }
- if (resource->path != NULL) {
- SOCK_WRITE(resource->path, *socketd);
- } else {
- SOCK_WRITE("/", *socketd);
- }
-
- /* close control connection */
- SOCK_WRITE("\nQUIT\n", *socketd);
- SOCK_FCLOSE(*socketd);
-
- /* open the data channel */
- *socketd = socket(AF_INET, SOCK_STREAM, 0);
- if (*socketd == SOCK_ERR) {
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- free_url(resource);
- return NULL;
- }
- lookup_hostname(resource->host, &server.sin_addr);
-
- if (server.sin_addr.s_addr == -1) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
- server.sin_port = htons(portno);
-
- if (connect(*socketd, (struct sockaddr *) &server, sizeof(server)) == SOCK_CONN_ERR) {
- free_url(resource);
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
- }
-#if 0
- if (mode[0] == 'r') {
- if ((fp = fdopen(*socketd, "r+")) == NULL) {
- free_url(resource);
- return NULL;
- }
- } else {
- if ((fp = fdopen(*socketd, "w+")) == NULL) {
- free_url(resource);
- return NULL;
- }
- }
-#ifdef HAVE_SETVBUF
- if ((setvbuf(fp, NULL, _IONBF, 0)) != 0) {
- free_url(resource);
- fclose(fp);
- return NULL;
- }
-#endif
-#endif
- free_url(resource);
- *issock = 1;
- return (fp);
-
- } else {
- if (options & USE_PATH) {
- fp = php3_fopen_with_path((char *) path, mode, PG(include_path), NULL);
- } else {
- int cm=2;
- if(!strcmp(mode,"r") || !strcmp(mode,"r+")) cm=0;
- if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!_php3_checkuid(path, cm))) {
- fp = NULL;
- } else {
- if (_php3_check_open_basedir((char *) path)) {
- fp = NULL;
- } else {
- fp = fopen(path, mode);
- }
- }
- }
-
- *issock = 0;
-
- return (fp);
- }
-
- /* NOTREACHED */
- SOCK_FCLOSE(*socketd);
- *socketd = 0;
- return NULL;
-}
-
-int _php3_getftpresult(int socketd)
-{
- char tmp_line[256];
-
- while (SOCK_FGETS(tmp_line, 256, socketd) &&
- !(isdigit((int) tmp_line[0]) && isdigit((int) tmp_line[1]) &&
- isdigit((int) tmp_line[2]) && tmp_line[3] == ' '));
-
- return strtol(tmp_line, NULL, 10);
-}
-
-PHPAPI int php3_isurl(char *path)
-{
- return (!strncasecmp(path, "http://", 7) || !strncasecmp(path, "ftp://", 6));
-}
-
-
-PHPAPI char *php3_strip_url_passwd(char *url)
-{
- register char *p = url, *url_start;
-
- while (*p) {
- if (*p==':' && *(p+1)=='/' && *(p+2)=='/') {
- /* found protocol */
- url_start = p = p+3;
-
- while (*p) {
- if (*p=='@') {
- int i;
-
- for (i=0; i<3 && url_start<p; i++, url_start++) {
- *url_start = '.';
- }
- for (; *p; p++) {
- *url_start++ = *p;
- }
- *url_start=0;
- break;
- }
- p++;
- }
- return url;
- }
- p++;
- }
- return url;
-}
-
-
-PHPAPI char *expand_filepath(char *filepath)
-{
- char *retval = NULL;
-
- if (filepath[0] == '.') {
- char *cwd = malloc(MAXPATHLEN + 1);
-
- if (getcwd(cwd, MAXPATHLEN)) {
- char *cwd_end = cwd + strlen(cwd);
-
- if (filepath[1] == '.') { /* parent directory - .. */
- /* erase the last directory name from the path */
- while (*cwd_end != '/') {
- *cwd_end-- = 0;
- }
- filepath++; /* make filepath appear as a current directory path */
- }
- if (cwd_end > cwd && *cwd_end == '/') { /* remove trailing slashes */
- *cwd_end-- = 0;
- }
- retval = (char *) malloc(strlen(cwd) + strlen(filepath) - 1 + 1);
- strcpy(retval, cwd);
- strcat(retval, filepath + 1);
- free(cwd);
- }
- }
- if (!retval) {
- retval = strdup(filepath);
- }
- return retval;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/fopen_wrappers.h b/main/fopen_wrappers.h
deleted file mode 100644
index 0b3834a1e3..0000000000
--- a/main/fopen_wrappers.h
+++ /dev/null
@@ -1,90 +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 _FOPEN_WRAPPERS_H
-#define _FOPEN_WRAPPERS_H
-
-#define IGNORE_PATH 0
-#define USE_PATH 1
-#define IGNORE_URL 2
-/* There's no USE_URL. */
-#if WIN32|WINNT
-# define IGNORE_URL_WIN 2
-#else
-# define IGNORE_URL_WIN 0
-#endif
-#define ENFORCE_SAFE_MODE 4
-
-#if WIN32|WINNT
-# define SOCK_ERR INVALID_SOCKET
-# define SOCK_CONN_ERR SOCKET_ERROR
-# define SOCK_RECV_ERR SOCKET_ERROR
-# define SOCK_FCLOSE(s) closesocket(s)
-#else
-# define SOCK_ERR -1
-# define SOCK_CONN_ERR -1
-# define SOCK_RECV_ERR -1
-# define SOCK_FCLOSE(s) close(s)
-#endif
-#define SOCK_WRITE(d,s) send(s,d,strlen(d),0)
-#define SOCK_WRITEL(d,l,s) send(s,d,l,0)
-#define SOCK_FGETC(c,s) recv(s,c,1,0)
-#define SOCK_FGETS(b,l,s) _php3_sock_fgets((b),(l),(s))
-
-/* values for issock */
-#define IS_NOT_SOCKET 0
-#define IS_SOCKET 1
-#define BAD_URL 2
-
-#ifndef THREAD_SAFE
-extern int wsa_fp; /* a list for open sockets */
-#endif
-
-extern PHPAPI FILE *php3_fopen_wrapper(char *filename, char *mode, int options, int *issock, int *socketd);
-
-extern FILE *php3_fopen_for_parser(void);
-
-extern PHPAPI int _php3_check_open_basedir(char *path);
-
-extern PHPAPI FILE *php3_fopen_with_path(char *filename, char *mode, char *path, char **opened_path);
-
-extern PHPAPI int php3_isurl(char *path);
-extern PHPAPI char *php3_strip_url_passwd(char *path);
-extern PHPAPI int php3_write(void *buf, int size);
-
-extern PHPAPI char *expand_filepath(char *filepath);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/internal_functions_registry.h b/main/internal_functions_registry.h
deleted file mode 100644
index 6e58de6ef1..0000000000
--- a/main/internal_functions_registry.h
+++ /dev/null
@@ -1,57 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-/* $Id$ */
-
-#ifndef _INTERNAL_FUNCTIONS_REGISTRY_H
-#define _INTERNAL_FUNCTIONS_REGISTRY_H
-
-extern int php3_init_mime(INIT_FUNC_ARGS);
-
-#if APACHE
-extern php3_module_entry apache_module_entry;
-#define apache_module_ptr &apache_module_entry
-extern void php3_virtual(INTERNAL_FUNCTION_PARAMETERS);
-#else
-#define apache_module_ptr NULL
-#endif
-
-/* environment functions */
-extern int php3_init_environment(void);
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/logos.h b/main/logos.h
deleted file mode 100644
index 6c91b0ae56..0000000000
--- a/main/logos.h
+++ /dev/null
@@ -1,805 +0,0 @@
-unsigned char zendtech_logo[] = {
- 71, 73, 70, 56, 57, 97, 100, 0, 89, 0,
- 247, 255, 0, 255, 255, 255, 8, 8, 8, 16,
- 16, 16, 33, 33, 33, 49, 49, 49, 57, 57,
- 57, 66, 66, 66, 74, 74, 74, 82, 82, 82,
- 90, 90, 90, 99, 99, 99, 115, 115, 115, 123,
- 123, 123, 140, 140, 140, 148, 148, 148, 156, 156,
- 156, 165, 165, 165, 173, 173, 173, 181, 181, 181,
- 189, 189, 189, 206, 206, 206, 222, 222, 222, 239,
- 239, 239, 148, 156, 156, 239, 247, 255, 0, 8,
- 16, 189, 198, 214, 123, 132, 148, 231, 239, 255,
- 99, 107, 123, 16, 33, 66, 0, 8, 24, 181,
- 189, 206, 140, 148, 165, 115, 123, 140, 222, 231,
- 255, 24, 41, 90, 181, 189, 214, 165, 173, 198,
- 140, 148, 173, 82, 99, 156, 24, 41, 99, 0,
- 8, 33, 189, 198, 231, 156, 165, 198, 123, 132,
- 165, 165, 181, 239, 90, 107, 173, 74, 90, 148,
- 24, 33, 66, 49, 74, 165, 214, 222, 255, 189,
- 198, 239, 140, 148, 181, 123, 132, 173, 99, 107,
- 140, 90, 99, 140, 49, 57, 90, 57, 74, 148,
- 49, 66, 140, 16, 24, 57, 8, 16, 49, 206,
- 214, 255, 165, 173, 214, 140, 156, 231, 140, 156,
- 239, 107, 123, 198, 115, 132, 214, 123, 140, 231,
- 99, 115, 198, 90, 107, 189, 41, 49, 90, 82,
- 99, 189, 66, 82, 156, 33, 41, 82, 90, 115,
- 239, 82, 107, 231, 57, 74, 165, 74, 99, 214,
- 49, 66, 148, 49, 66, 156, 57, 82, 206, 33,
- 49, 123, 57, 82, 214, 16, 24, 66, 24, 41,
- 123, 189, 198, 247, 181, 189, 239, 189, 198, 255,
- 132, 140, 189, 107, 115, 165, 140, 156, 247, 74,
- 82, 132, 132, 148, 239, 123, 140, 239, 115, 132,
- 231, 57, 66, 115, 99, 115, 206, 107, 123, 222,
- 57, 66, 123, 49, 57, 107, 90, 107, 206, 90,
- 107, 214, 82, 99, 198, 66, 82, 181, 57, 74,
- 181, 49, 66, 165, 24, 33, 82, 66, 90, 231,
- 49, 66, 173, 41, 57, 148, 24, 33, 90, 41,
- 57, 156, 33, 49, 140, 33, 49, 148, 8, 16,
- 66, 181, 189, 247, 173, 181, 239, 156, 165, 231,
- 132, 140, 198, 107, 115, 173, 74, 82, 140, 66,
- 74, 132, 107, 123, 231, 99, 115, 231, 82, 99,
- 214, 74, 90, 198, 82, 99, 222, 74, 90, 206,
- 66, 82, 189, 33, 41, 99, 66, 82, 198, 57,
- 74, 189, 57, 74, 198, 49, 66, 181, 49, 66,
- 189, 41, 57, 165, 24, 33, 99, 16, 24, 82,
- 8, 16, 74, 173, 181, 247, 165, 173, 239, 165,
- 173, 247, 140, 148, 214, 156, 165, 239, 148, 156,
- 239, 132, 140, 214, 156, 165, 255, 115, 123, 189,
- 123, 132, 206, 132, 140, 222, 115, 123, 198, 123,
- 132, 214, 99, 107, 173, 123, 132, 222, 99, 107,
- 189, 90, 99, 173, 74, 82, 148, 82, 90, 165,
- 90, 99, 181, 74, 82, 156, 82, 90, 173, 90,
- 99, 189, 41, 49, 115, 74, 90, 231, 41, 49,
- 132, 33, 41, 107, 66, 82, 222, 33, 41, 123,
- 24, 33, 107, 24, 33, 123, 16, 24, 90, 148,
- 156, 255, 140, 148, 255, 115, 123, 222, 123, 132,
- 239, 107, 115, 214, 123, 132, 247, 99, 107, 206,
- 107, 115, 222, 115, 123, 239, 99, 107, 222, 82,
- 90, 189, 74, 82, 173, 49, 57, 148, 247, 247,
- 255, 198, 198, 206, 214, 214, 222, 222, 222, 231,
- 165, 165, 173, 156, 156, 165, 115, 115, 123, 239,
- 239, 255, 107, 107, 115, 214, 214, 231, 198, 198,
- 214, 231, 231, 255, 222, 222, 247, 140, 140, 156,
- 66, 66, 74, 123, 123, 140, 222, 222, 255, 206,
- 206, 239, 132, 132, 156, 41, 41, 49, 165, 165,
- 198, 123, 123, 148, 156, 156, 189, 74, 74, 90,
- 198, 198, 255, 132, 132, 173, 24, 24, 33, 156,
- 156, 214, 41, 41, 57, 148, 148, 206, 165, 165,
- 231, 99, 99, 140, 156, 156, 222, 173, 173, 247,
- 74, 74, 107, 165, 165, 239, 165, 165, 247, 82,
- 82, 123, 132, 132, 198, 140, 140, 214, 123, 123,
- 189, 74, 74, 115, 90, 90, 140, 99, 99, 156,
- 66, 66, 107, 90, 90, 148, 74, 74, 123, 99,
- 99, 165, 49, 49, 82, 123, 123, 206, 66, 66,
- 115, 82, 82, 148, 8, 8, 16, 41, 41, 82,
- 24, 24, 49, 41, 41, 90, 33, 33, 74, 24,
- 24, 57, 41, 41, 99, 24, 24, 66, 8, 8,
- 24, 16, 16, 49, 24, 24, 74, 8, 8, 41,
- 16, 16, 90, 8, 8, 49, 8, 8, 57, 0,
- 0, 8, 0, 0, 16, 0, 0, 24, 0, 0,
- 0, 44, 0, 0, 0, 0, 100, 0, 89, 0,
- 0, 8, 255, 0, 255, 9, 28, 72, 176, 160,
- 193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
- 135, 16, 35, 74, 156, 72, 177, 162, 197, 139,
- 24, 51, 106, 220, 200, 177, 34, 0, 3, 14,
- 1, 76, 96, 104, 0, 64, 199, 147, 9, 63,
- 58, 124, 48, 114, 97, 73, 148, 48, 11, 126,
- 36, 32, 0, 193, 2, 5, 2, 6, 10, 88,
- 176, 0, 228, 130, 145, 11, 6, 8, 28, 176,
- 64, 160, 0, 5, 11, 26, 152, 28, 202, 51,
- 231, 63, 162, 65, 99, 90, 252, 56, 193, 130,
- 72, 11, 20, 4, 18, 176, 80, 97, 2, 0,
- 164, 35, 85, 254, 123, 57, 160, 66, 87, 0,
- 75, 21, 0, 160, 96, 246, 159, 90, 182, 22,
- 64, 74, 157, 248, 81, 0, 0, 4, 79, 239,
- 254, 155, 16, 97, 232, 191, 159, 255, 196, 190,
- 140, 48, 33, 192, 63, 4, 38, 5, 88, 40,
- 250, 116, 175, 5, 2, 135, 231, 82, 84, 41,
- 118, 66, 81, 177, 2, 1, 11, 54, 185, 249,
- 31, 5, 145, 19, 20, 12, 124, 240, 85, 242,
- 100, 144, 149, 139, 90, 16, 61, 16, 112, 5,
- 198, 47, 87, 11, 124, 73, 186, 65, 79, 130,
- 106, 27, 152, 150, 72, 89, 174, 229, 191, 185,
- 20, 24, 104, 64, 0, 240, 130, 224, 6, 34,
- 124, 93, 96, 33, 88, 114, 11, 2, 41, 80,
- 64, 128, 64, 183, 205, 228, 0, 32, 239, 126,
- 216, 91, 224, 239, 191, 86, 39, 48, 255, 99,
- 208, 146, 185, 72, 158, 224, 69, 50, 51, 170,
- 60, 23, 131, 127, 4, 118, 1, 168, 128, 119,
- 187, 253, 251, 248, 243, 235, 223, 207, 191, 191,
- 255, 255, 0, 6, 40, 96, 63, 213, 240, 115,
- 145, 129, 4, 241, 51, 13, 74, 253, 32, 216,
- 16, 63, 14, 58, 84, 141, 10, 7, 22, 100,
- 79, 63, 21, 69, 88, 80, 63, 24, 62, 216,
- 96, 68, 238, 188, 115, 160, 131, 246, 188, 163,
- 33, 68, 39, 14, 244, 193, 7, 13, 113, 152,
- 226, 66, 241, 196, 112, 224, 135, 242, 20, 104,
- 17, 132, 8, 181, 163, 194, 139, 3, 245, 179,
- 227, 68, 42, 120, 211, 97, 69, 25, 244, 67,
- 79, 14, 25, 189, 200, 143, 10, 63, 34, 228,
- 227, 144, 17, 241, 35, 14, 61, 23, 113, 88,
- 142, 61, 73, 190, 216, 142, 62, 248, 188, 168,
- 66, 151, 21, 197, 67, 78, 61, 22, 249, 232,
- 13, 150, 25, 65, 89, 144, 10, 115, 52, 57,
- 16, 132, 248, 184, 41, 81, 61, 230, 228, 161,
- 130, 139, 16, 230, 169, 231, 158, 255, 24, 200,
- 79, 61, 243, 96, 67, 97, 150, 8, 169, 176,
- 200, 62, 245, 248, 217, 103, 63, 248, 240, 32,
- 103, 65, 245, 212, 163, 102, 130, 60, 88, 99,
- 14, 15, 246, 168, 16, 233, 166, 156, 110, 218,
- 78, 6, 1, 64, 216, 143, 34, 90, 80, 169,
- 17, 63, 44, 26, 196, 15, 62, 139, 220, 131,
- 79, 61, 160, 102, 255, 144, 1, 62, 84, 232,
- 51, 41, 65, 211, 84, 147, 78, 58, 242, 216,
- 67, 38, 65, 25, 168, 192, 5, 29, 225, 128,
- 113, 15, 166, 61, 216, 147, 236, 178, 246, 224,
- 51, 205, 171, 155, 226, 147, 137, 20, 237, 112,
- 228, 207, 137, 25, 244, 240, 198, 42, 84, 196,
- 217, 78, 61, 172, 46, 242, 168, 170, 237, 216,
- 147, 206, 54, 56, 228, 208, 32, 132, 58, 210,
- 195, 137, 15, 118, 36, 49, 138, 32, 130, 144,
- 64, 175, 189, 248, 174, 225, 65, 175, 248, 220,
- 67, 73, 39, 84, 140, 91, 145, 63, 80, 178,
- 107, 79, 34, 169, 188, 113, 143, 61, 211, 240,
- 176, 198, 27, 60, 180, 195, 163, 65, 253, 196,
- 131, 205, 58, 93, 214, 35, 128, 61, 246, 72,
- 193, 13, 49, 218, 184, 114, 6, 18, 162, 216,
- 34, 10, 18, 36, 219, 114, 139, 14, 163, 144,
- 176, 134, 30, 146, 100, 98, 143, 62, 60, 224,
- 115, 235, 68, 58, 38, 24, 128, 10, 84, 164,
- 18, 71, 41, 166, 172, 17, 195, 27, 166, 40,
- 130, 79, 181, 40, 226, 115, 14, 30, 74, 240,
- 192, 131, 7, 247, 140, 226, 202, 12, 192, 248,
- 64, 135, 54, 142, 96, 157, 181, 35, 142, 108,
- 65, 11, 26, 59, 20, 65, 71, 38, 84, 76,
- 243, 229, 28, 54, 107, 216, 79, 6, 56, 254,
- 179, 46, 63, 161, 30, 196, 104, 135, 16, 214,
- 51, 205, 61, 166, 184, 1, 135, 27, 82, 228,
- 255, 109, 10, 15, 245, 72, 156, 96, 159, 252,
- 220, 156, 193, 59, 225, 100, 131, 199, 14, 163,
- 204, 147, 135, 24, 88, 0, 3, 0, 48, 148,
- 87, 78, 57, 49, 201, 48, 242, 5, 16, 51,
- 8, 1, 113, 15, 84, 220, 163, 200, 34, 84,
- 208, 83, 243, 59, 242, 184, 83, 141, 175, 211,
- 212, 195, 240, 7, 223, 178, 77, 120, 130, 92,
- 54, 216, 78, 59, 141, 146, 32, 5, 20, 129,
- 220, 2, 67, 18, 80, 36, 210, 171, 10, 237,
- 96, 168, 103, 63, 245, 124, 224, 207, 65, 133,
- 199, 144, 137, 21, 117, 200, 114, 11, 51, 211,
- 76, 51, 192, 245, 214, 91, 63, 128, 246, 218,
- 19, 160, 65, 39, 166, 140, 162, 199, 38, 234,
- 108, 130, 71, 39, 122, 144, 81, 78, 57, 188,
- 178, 93, 252, 7, 76, 70, 250, 237, 237, 112,
- 227, 200, 79, 6, 251, 116, 27, 105, 163, 107,
- 228, 205, 137, 6, 219, 35, 128, 39, 76, 145,
- 130, 53, 232, 239, 3, 28, 202, 192, 7, 234,
- 161, 169, 91, 213, 141, 30, 66, 176, 66, 52,
- 28, 177, 160, 135, 48, 160, 24, 67, 176, 4,
- 35, 184, 81, 9, 81, 220, 34, 14, 138, 192,
- 84, 156, 52, 181, 41, 38, 113, 172, 7, 248,
- 200, 20, 9, 111, 23, 170, 12, 180, 163, 7,
- 171, 184, 7, 21, 158, 182, 134, 81, 72, 1,
- 23, 66, 168, 128, 97, 4, 240, 2, 55, 196,
- 1, 21, 137, 184, 135, 62, 255, 152, 244, 165,
- 34, 126, 136, 121, 224, 122, 195, 45, 26, 49,
- 2, 161, 56, 100, 0, 22, 72, 134, 15, 28,
- 1, 10, 83, 164, 34, 21, 170, 72, 196, 27,
- 132, 230, 180, 119, 96, 138, 99, 60, 160, 7,
- 21, 160, 118, 15, 15, 196, 32, 6, 12, 51,
- 155, 252, 84, 192, 131, 85, 92, 49, 17, 225,
- 43, 197, 19, 160, 160, 142, 93, 24, 102, 0,
- 70, 104, 3, 28, 80, 145, 138, 85, 204, 129,
- 7, 251, 168, 25, 62, 94, 197, 163, 251, 169,
- 64, 30, 130, 104, 2, 17, 156, 152, 0, 158,
- 56, 210, 145, 134, 17, 136, 114, 124, 0, 139,
- 29, 188, 129, 4, 166, 64, 197, 207, 80, 97,
- 10, 83, 144, 192, 101, 107, 88, 195, 61, 214,
- 96, 175, 78, 154, 178, 94, 36, 40, 35, 166,
- 158, 101, 143, 123, 164, 2, 21, 168, 40, 133,
- 27, 220, 0, 5, 25, 164, 161, 18, 118, 252,
- 199, 52, 96, 97, 8, 55, 88, 113, 21, 171,
- 56, 84, 156, 234, 225, 143, 15, 76, 44, 0,
- 2, 112, 152, 20, 96, 81, 65, 249, 228, 34,
- 23, 0, 120, 38, 0, 32, 48, 144, 3, 0,
- 192, 7, 102, 40, 5, 189, 4, 33, 133, 56,
- 192, 1, 17, 106, 128, 3, 20, 112, 81, 138,
- 82, 72, 225, 156, 82, 144, 165, 222, 160, 32,
- 78, 55, 236, 64, 10, 100, 32, 129, 18, 202,
- 24, 3, 87, 74, 65, 111, 112, 128, 131, 26,
- 154, 144, 255, 6, 66, 12, 33, 151, 187, 236,
- 165, 41, 182, 149, 143, 90, 217, 172, 31, 197,
- 155, 88, 6, 236, 38, 136, 80, 68, 131, 0,
- 200, 164, 192, 12, 176, 48, 131, 103, 206, 128,
- 23, 21, 12, 0, 5, 136, 177, 7, 40, 140,
- 162, 147, 233, 196, 133, 26, 12, 17, 8, 63,
- 248, 1, 9, 104, 104, 67, 19, 100, 208, 4,
- 53, 168, 161, 13, 134, 32, 68, 26, 10, 225,
- 135, 51, 248, 225, 22, 79, 120, 167, 32, 142,
- 64, 47, 41, 124, 243, 165, 105, 176, 197, 25,
- 206, 0, 8, 87, 240, 226, 142, 102, 104, 67,
- 223, 222, 160, 8, 69, 204, 97, 136, 176, 114,
- 81, 66, 234, 198, 131, 29, 208, 129, 24, 194,
- 40, 6, 47, 136, 65, 135, 73, 208, 33, 23,
- 85, 11, 198, 64, 130, 145, 139, 45, 4, 130,
- 113, 113, 116, 131, 26, 208, 48, 132, 103, 44,
- 67, 4, 200, 56, 193, 35, 202, 80, 136, 186,
- 150, 33, 27, 102, 136, 130, 24, 168, 113, 2,
- 100, 48, 96, 3, 53, 160, 68, 18, 204, 41,
- 75, 40, 192, 52, 13, 97, 248, 65, 13, 54,
- 32, 130, 13, 60, 3, 160, 97, 104, 67, 41,
- 18, 182, 138, 16, 14, 115, 109, 71, 204, 81,
- 61, 214, 0, 142, 25, 116, 161, 12, 70, 128,
- 133, 23, 104, 209, 10, 170, 97, 65, 2, 8,
- 98, 134, 5, 162, 209, 135, 39, 124, 212, 134,
- 180, 52, 66, 13, 228, 50, 16, 102, 255, 108,
- 0, 8, 78, 168, 197, 51, 8, 96, 130, 107,
- 44, 160, 130, 2, 9, 192, 49, 178, 112, 11,
- 195, 246, 147, 166, 118, 240, 133, 118, 106, 123,
- 71, 88, 168, 65, 155, 149, 117, 234, 16, 139,
- 23, 128, 204, 82, 236, 3, 246, 24, 131, 21,
- 232, 96, 139, 29, 236, 0, 10, 126, 136, 133,
- 15, 146, 225, 8, 31, 28, 99, 32, 19, 224,
- 64, 23, 208, 80, 10, 50, 152, 98, 12, 223,
- 45, 66, 8, 34, 105, 144, 4, 92, 225, 7,
- 66, 97, 198, 1, 16, 34, 128, 26, 32, 161,
- 16, 81, 136, 2, 32, 174, 160, 155, 132, 76,
- 35, 169, 165, 40, 96, 101, 247, 49, 68, 14,
- 73, 21, 137, 248, 136, 7, 58, 172, 160, 13,
- 89, 128, 2, 13, 178, 216, 194, 12, 24, 209,
- 10, 31, 80, 83, 32, 9, 0, 64, 52, 190,
- 182, 131, 82, 236, 64, 13, 103, 0, 66, 4,
- 232, 27, 128, 237, 13, 68, 1, 86, 208, 5,
- 125, 7, 114, 61, 130, 12, 32, 27, 83, 152,
- 130, 19, 234, 240, 0, 130, 8, 96, 0, 78,
- 25, 74, 100, 129, 198, 212, 16, 78, 23, 161,
- 214, 77, 208, 172, 238, 145, 135, 107, 88, 193,
- 10, 140, 136, 70, 52, 236, 0, 139, 87, 204,
- 192, 2, 78, 20, 64, 5, 114, 129, 133, 86,
- 236, 193, 21, 234, 232, 130, 38, 92, 113, 141,
- 245, 252, 67, 0, 200, 208, 0, 13, 86, 208,
- 11, 2, 32, 192, 255, 10, 123, 8, 194, 138,
- 171, 105, 2, 26, 208, 64, 23, 9, 24, 8,
- 50, 152, 112, 10, 34, 236, 194, 41, 211, 184,
- 64, 9, 104, 32, 140, 7, 84, 112, 0, 102,
- 144, 65, 41, 180, 152, 15, 69, 48, 88, 5,
- 4, 91, 23, 66, 234, 198, 198, 121, 116, 226,
- 18, 151, 224, 196, 14, 112, 49, 11, 14, 228,
- 130, 49, 255, 96, 64, 52, 71, 48, 131, 25,
- 112, 195, 15, 104, 72, 67, 25, 140, 49, 144,
- 94, 52, 130, 207, 164, 32, 194, 10, 174, 192,
- 7, 54, 176, 1, 18, 239, 129, 15, 13, 246,
- 64, 10, 82, 236, 193, 7, 251, 253, 71, 1,
- 136, 240, 7, 43, 176, 70, 0, 205, 224, 245,
- 31, 246, 96, 133, 150, 76, 35, 12, 207, 21,
- 68, 83, 29, 125, 100, 23, 78, 12, 110, 200,
- 115, 157, 195, 74, 129, 137, 17, 0, 3, 4,
- 145, 100, 6, 90, 38, 23, 141, 47, 4, 162,
- 13, 104, 8, 131, 11, 130, 205, 0, 31, 16,
- 97, 15, 180, 248, 2, 19, 230, 125, 138, 83,
- 176, 129, 15, 33, 16, 200, 1, 188, 80, 239,
- 63, 244, 89, 23, 193, 125, 4, 31, 114, 249,
- 143, 101, 212, 186, 222, 125, 62, 234, 83, 204,
- 240, 220, 129, 86, 182, 91, 196, 115, 240, 131,
- 248, 81, 46, 18, 132, 194, 10, 82, 180, 194,
- 114, 35, 240, 76, 98, 56, 162, 15, 132, 32,
- 68, 33, 196, 224, 139, 6, 56, 37, 24, 13,
- 255, 72, 121, 3, 30, 96, 7, 132, 179, 225,
- 20, 124, 96, 245, 63, 246, 253, 114, 54, 144,
- 130, 9, 62, 112, 98, 22, 188, 208, 139, 161,
- 16, 161, 222, 53, 255, 130, 14, 117, 57, 228,
- 84, 172, 161, 169, 12, 198, 71, 145, 18, 202,
- 16, 138, 83, 161, 201, 62, 176, 194, 22, 88,
- 177, 129, 106, 230, 34, 25, 93, 254, 131, 31,
- 106, 177, 7, 38, 124, 161, 0, 9, 17, 192,
- 53, 236, 253, 242, 83, 44, 161, 192, 7, 248,
- 249, 41, 122, 77, 10, 26, 200, 197, 6, 65,
- 64, 59, 31, 236, 141, 112, 90, 228, 18, 209,
- 138, 30, 104, 163, 121, 112, 100, 73, 43, 36,
- 3, 96, 72, 28, 29, 24, 17, 4, 90, 208,
- 226, 26, 78, 9, 64, 5, 50, 199, 10, 86,
- 48, 130, 106, 30, 247, 194, 121, 17, 50, 13,
- 23, 184, 252, 222, 50, 167, 57, 41, 16, 78,
- 135, 96, 219, 32, 18, 185, 70, 192, 18, 232,
- 254, 114, 63, 27, 230, 217, 106, 144, 130, 180,
- 145, 222, 119, 217, 49, 143, 31, 246, 96, 199,
- 35, 40, 65, 137, 34, 200, 162, 12, 181, 216,
- 66, 158, 5, 34, 106, 96, 204, 96, 4, 28,
- 240, 1, 22, 124, 112, 245, 45, 32, 0, 184,
- 2, 168, 222, 52, 4, 64, 128, 107, 216, 156,
- 15, 243, 166, 5, 218, 189, 176, 249, 178, 51,
- 162, 62, 54, 232, 130, 3, 4, 82, 0, 126,
- 147, 254, 11, 194, 64, 106, 255, 234, 11, 56,
- 58, 20, 74, 74, 84, 147, 238, 71, 14, 178,
- 16, 142, 28, 204, 99, 12, 158, 16, 133, 25,
- 104, 209, 140, 72, 66, 17, 154, 0, 24, 1,
- 29, 176, 48, 140, 8, 72, 128, 23, 91, 160,
- 9, 117, 160, 29, 15, 160, 12, 64, 0, 4,
- 144, 208, 8, 163, 69, 11, 124, 134, 121, 250,
- 166, 118, 64, 119, 5, 193, 214, 2, 180, 32,
- 1, 193, 245, 3, 76, 80, 115, 167, 32, 116,
- 167, 87, 4, 174, 165, 48, 164, 19, 39, 198,
- 164, 39, 228, 162, 2, 227, 64, 13, 57, 224,
- 14, 122, 240, 9, 178, 80, 11, 75, 160, 13,
- 96, 39, 73, 248, 71, 12, 62, 64, 12, 0,
- 176, 123, 190, 208, 5, 164, 64, 11, 98, 5,
- 31, 197, 96, 5, 221, 208, 5, 65, 208, 13,
- 219, 149, 129, 48, 151, 121, 94, 80, 115, 47,
- 199, 8, 158, 199, 4, 202, 96, 102, 9, 0,
- 9, 181, 240, 114, 76, 224, 2, 10, 55, 0,
- 159, 224, 6, 130, 32, 67, 250, 131, 80, 215,
- 230, 35, 226, 112, 13, 223, 64, 9, 224, 0,
- 9, 221, 208, 13, 88, 208, 99, 32, 54, 110,
- 104, 129, 127, 187, 7, 1, 142, 208, 10, 93,
- 0, 2, 3, 129, 0, 188, 0, 101, 116, 80,
- 12, 14, 0, 1, 87, 192, 103, 124, 80, 117,
- 51, 7, 129, 246, 38, 129, 2, 33, 13, 167,
- 16, 4, 106, 24, 106, 202, 224, 2, 117, 80,
- 12, 205, 255, 33, 16, 211, 240, 2, 163, 32,
- 52, 205, 130, 64, 109, 163, 16, 112, 35, 44,
- 223, 112, 5, 86, 48, 3, 201, 144, 12, 24,
- 53, 16, 5, 128, 0, 7, 80, 138, 166, 120,
- 0, 21, 4, 1, 192, 144, 12, 51, 224, 3,
- 61, 168, 75, 10, 208, 0, 12, 0, 118, 1,
- 32, 1, 117, 112, 132, 15, 120, 10, 83, 192,
- 121, 193, 102, 136, 127, 224, 118, 3, 65, 0,
- 191, 208, 0, 193, 224, 68, 240, 129, 6, 163,
- 128, 70, 71, 115, 137, 77, 23, 0, 174, 163,
- 4, 59, 0, 10, 162, 0, 4, 160, 214, 16,
- 16, 128, 5, 93, 80, 11, 78, 96, 9, 49,
- 120, 16, 211, 80, 2, 167, 80, 11, 50, 119,
- 12, 152, 16, 114, 128, 144, 99, 117, 208, 139,
- 186, 200, 7, 37, 96, 140, 6, 49, 0, 153,
- 224, 81, 30, 208, 58, 72, 131, 34, 127, 162,
- 2, 246, 176, 6, 58, 208, 23, 16, 225, 11,
- 145, 208, 4, 80, 160, 3, 183, 20, 108, 5,
- 193, 12, 210, 96, 6, 83, 96, 6, 128, 104,
- 0, 151, 32, 3, 50, 32, 114, 81, 112, 5,
- 114, 209, 2, 128, 16, 96, 179, 96, 2, 203,
- 69, 16, 4, 240, 2, 134, 128, 8, 166, 32,
- 15, 42, 224, 122, 81, 162, 35, 242, 16, 10,
- 117, 176, 12, 8, 0, 13, 9, 176, 146, 10,
- 208, 146, 46, 249, 146, 9, 128, 0, 32, 48,
- 3, 101, 80, 78, 181, 84, 6, 90, 255, 128,
- 0, 4, 112, 61, 7, 112, 3, 151, 16, 8,
- 33, 231, 7, 210, 144, 146, 29, 128, 2, 38,
- 6, 5, 49, 37, 9, 34, 0, 13, 208, 128,
- 7, 105, 208, 6, 253, 4, 8, 143, 224, 12,
- 7, 192, 12, 3, 192, 12, 208, 128, 3, 73,
- 128, 11, 179, 148, 2, 173, 19, 55, 18, 65,
- 113, 242, 224, 9, 116, 16, 6, 58, 112, 11,
- 180, 64, 7, 35, 128, 1, 207, 212, 150, 109,
- 137, 22, 209, 96, 6, 182, 208, 8, 209, 240,
- 9, 166, 112, 67, 109, 112, 8, 128, 112, 6,
- 160, 181, 50, 79, 240, 151, 80, 16, 144, 58,
- 224, 93, 238, 53, 10, 178, 244, 82, 252, 164,
- 3, 57, 245, 4, 180, 4, 83, 131, 192, 151,
- 70, 240, 9, 80, 80, 78, 157, 196, 71, 136,
- 194, 140, 14, 241, 39, 107, 144, 9, 87, 208,
- 9, 107, 32, 8, 183, 176, 5, 62, 0, 12,
- 207, 132, 1, 164, 201, 150, 164, 201, 1, 51,
- 48, 9, 77, 96, 10, 165, 32, 4, 117, 224,
- 9, 130, 48, 10, 110, 128, 8, 109, 0, 5,
- 238, 116, 78, 163, 176, 155, 232, 52, 47, 245,
- 114, 4, 152, 148, 78, 178, 100, 78, 157, 180,
- 155, 178, 36, 78, 112, 176, 3, 124, 67, 6,
- 59, 245, 73, 169, 16, 68, 74, 23, 37, 244,
- 48, 6, 90, 240, 8, 157, 64, 15, 201, 66,
- 2, 103, 112, 85, 190, 231, 3, 222, 249, 157,
- 222, 25, 13, 218, 255, 48, 4, 82, 112, 15,
- 245, 228, 9, 215, 224, 9, 120, 243, 51, 125,
- 243, 73, 74, 16, 74, 164, 244, 73, 162, 116,
- 70, 80, 243, 48, 86, 84, 47, 243, 116, 15,
- 247, 240, 6, 41, 144, 73, 196, 233, 50, 49,
- 32, 15, 78, 195, 3, 247, 208, 42, 109, 114,
- 51, 7, 81, 15, 229, 128, 13, 227, 48, 14,
- 244, 16, 42, 118, 243, 6, 155, 16, 13, 196,
- 32, 158, 221, 192, 13, 23, 154, 161, 24, 74,
- 4, 160, 160, 4, 12, 195, 70, 99, 112, 7,
- 107, 192, 3, 175, 148, 8, 66, 99, 58, 60,
- 32, 15, 30, 64, 15, 244, 96, 158, 95, 100,
- 15, 60, 64, 5, 15, 179, 69, 50, 52, 160,
- 30, 176, 6, 8, 243, 156, 66, 211, 43, 207,
- 162, 2, 211, 224, 15, 95, 178, 15, 251, 112,
- 39, 13, 161, 2, 41, 8, 43, 130, 115, 63,
- 248, 64, 2, 234, 160, 12, 86, 192, 13, 143,
- 96, 9, 146, 32, 9, 82, 90, 165, 149, 224,
- 9, 243, 224, 40, 129, 243, 45, 100, 128, 7,
- 84, 64, 5, 90, 68, 5, 28, 211, 44, 201,
- 18, 163, 51, 212, 3, 40, 4, 163, 60, 176,
- 8, 138, 16, 67, 98, 170, 44, 49, 170, 8,
- 111, 144, 8, 90, 116, 15, 40, 52, 13, 176,
- 35, 49, 16, 178, 80, 201,
- 98, 76, 11, 161, 2, 213, 240, 43, 5, 177,
- 51, 243, 144, 13, 86, 144, 13, 148, 128, 2,
- 232, 128, 14, 228, 255, 192, 168, 139, 74, 14,
- 230, 64, 6, 32, 217, 14, 161, 82, 56, 246,
- 128, 7, 236, 64, 5, 139, 192, 45, 40, 244,
- 37, 104, 186, 15, 115, 64, 5, 251, 128, 166,
- 248, 208, 3, 250, 160, 169, 77, 181, 8, 115,
- 128, 66, 61, 144, 63, 138, 144, 15, 192, 20,
- 67, 153, 98, 109, 151, 200, 40, 251, 144, 54,
- 9, 81, 15, 38, 50, 105, 245, 64, 14, 87,
- 32, 13, 99, 176, 14, 240, 224, 14, 238, 48,
- 172, 71, 0, 15, 71, 112, 4, 238, 16, 3,
- 132, 228, 32, 171, 98, 14, 163, 208, 84, 1,
- 211, 41, 131, 52, 66, 33, 25, 41, 95, 130,
- 15, 250, 208, 169, 216, 170, 173, 249, 179, 8,
- 170, 186, 140, 39, 66, 113, 217, 234, 167, 20,
- 179, 171, 147, 22, 15, 89, 224, 13, 241, 144,
- 41, 190, 66, 68, 154, 2, 175, 231, 183, 33,
- 107, 192, 14, 111, 208, 64, 123, 82, 56, 46,
- 84, 169, 121, 130, 80, 46, 244, 54, 9, 148,
- 173, 154, 130, 153, 9, 18, 176, 137, 82, 16,
- 237, 48, 13, 19, 211, 171, 229, 176, 35, 148,
- 154, 39, 161, 18, 177, 1, 80, 169, 114, 163,
- 15, 100, 48, 6, 96, 130, 34, 125, 162, 42,
- 133, 163, 167, 153, 201, 15, 4, 179, 33, 12,
- 225, 14, 216, 160, 176, 151, 168, 40, 19, 35,
- 16, 252, 160, 15, 251, 32, 15, 233, 128, 38,
- 73, 50, 59, 40, 34, 146, 15, 34, 14, 234,
- 255, 146, 178, 11, 177, 36, 105, 243, 14, 130,
- 58, 34, 56, 203, 60, 8, 42, 55, 222, 144,
- 3, 130, 179, 177, 19, 193, 40, 137, 162, 32,
- 63, 155, 179, 36, 24, 150, 75, 219, 39, 233,
- 64, 0, 73, 123, 35, 11, 132, 32, 7, 251,
- 32, 70, 155, 32, 77, 235, 180, 26, 43, 32,
- 94, 251, 181, 96, 27, 182, 98, 59, 182, 100,
- 11, 182, 108, 56, 110, 180, 133, 16, 34, 49,
- 25, 45, 193, 16, 128, 97, 31, 0, 208, 19,
- 113, 91, 18, 105, 123, 16, 44, 65, 17, 119,
- 219, 16, 3, 144, 145, 166, 97, 0, 57, 161,
- 18, 126, 251, 20, 77, 113, 102, 60, 225, 19,
- 20, 192, 19, 218, 65, 19, 54, 129, 19, 58,
- 81, 184, 153, 49, 18, 59, 113, 27, 141, 187,
- 0, 144, 113, 19, 52, 54, 184, 130, 27, 21,
- 39, 129, 25, 111, 97, 22, 91, 113, 22, 72,
- 49, 31, 94, 81, 20, 85, 113, 21, 89, 1,
- 31, 92, 225, 21, 61, 246, 19, 159, 171, 186,
- 90, 193, 21, 159, 161, 0, 93, 33, 16, 157,
- 91, 1, 110, 177, 22, 21, 16, 23, 155, 43,
- 23, 1, 240, 105, 67, 193, 23, 126, 177, 0,
- 167, 139, 24, 52, 161, 23, 3, 160, 23, 192,
- 11, 31, 31, 177, 0, 18, 144, 188, 4, 160,
- 18, 201, 219, 0, 150, 49, 18, 189, 203, 24,
- 66, 81, 21, 144, 81, 31, 29, 33, 22, 242,
- 49, 1, 161, 17, 24, 105, 182, 251, 182, 123,
- 113, 25, 190, 65, 190, 232, 197, 19, 94, 65,
- 91, 191, 33, 22, 63, 1, 24, 159, 225, 189,
- 172, 241, 15, 164, 17, 191, 219, 43, 23, 14,
- 0, 0, 12, 112, 27, 178, 209, 26, 109, 187,
- 190, 229, 251, 15, 251, 251, 15, 175, 241, 19,
- 1, 252, 26, 0, 204, 26, 237, 59, 18, 181,
- 33, 185, 180, 11, 0, 5, 86, 191, 3, 65,
- 1, 187, 64, 29, 182, 129, 28, 196, 33, 190,
- 254, 235, 29, 69, 113, 28, 194, 17, 1, 22,
- 176, 19, 150, 129, 28, 30, 156, 19, 28, 140,
- 0, 20, 48, 189, 209, 49, 29, 213, 113, 24,
- 61, 161, 28, 124, 155, 17, 152, 33, 0, 202,
- 97, 1, 186, 97, 30, 19, 80, 28, 253, 107,
- 190, 227, 155, 25, 225, 81, 185, 64, 209, 195,
- 173, 97, 21, 93, 241, 182, 50, 12, 0, 52,
- 12, 31, 242, 65, 31, 101, 123, 17, 15, 144,
- 136, 75, 28, 19, 118, 81, 183, 79, 140, 18,
- 238, 56, 197, 86, 124, 197, 49, 17, 16, 0,
- 59 };
-
-unsigned char php4_logo[] = {
- 71, 73, 70, 56, 57, 97, 100, 0, 56, 0,
- 247, 255, 0, 255, 255, 255, 8, 8, 8, 16,
- 16, 16, 24, 24, 24, 33, 33, 33, 41, 41,
- 41, 49, 49, 49, 57, 57, 57, 66, 66, 66,
- 74, 74, 74, 82, 82, 82, 90, 90, 90, 99,
- 99, 99, 115, 115, 115, 123, 123, 123, 132, 132,
- 132, 140, 140, 140, 148, 148, 148, 156, 156, 156,
- 165, 165, 165, 173, 173, 173, 181, 181, 181, 189,
- 189, 189, 198, 198, 198, 206, 206, 206, 214, 214,
- 214, 222, 222, 222, 231, 231, 231, 239, 239, 239,
- 247, 247, 247, 115, 115, 90, 156, 156, 115, 140,
- 140, 99, 132, 132, 90, 165, 165, 107, 214, 214,
- 115, 156, 156, 82, 181, 181, 90, 189, 189, 90,
- 198, 198, 90, 222, 222, 99, 214, 214, 90, 222,
- 222, 90, 206, 206, 82, 41, 41, 16, 231, 231,
- 90, 107, 107, 41, 214, 214, 82, 173, 173, 66,
- 239, 239, 90, 222, 222, 82, 66, 66, 24, 156,
- 156, 57, 231, 231, 82, 239, 239, 82, 99, 99,
- 33, 198, 198, 66, 148, 148, 49, 132, 132, 41,
- 82, 82, 24, 16, 16, 0, 214, 222, 107, 181,
- 189, 82, 206, 214, 90, 189, 198, 107, 173, 181,
- 90, 165, 173, 99, 148, 156, 82, 148, 156, 99,
- 173, 181, 132, 140, 148, 99, 148, 156, 115, 156,
- 165, 115, 99, 107, 90, 148, 156, 140, 132, 140,
- 132, 115, 123, 115, 247, 255, 255, 198, 206, 206,
- 140, 148, 148, 156, 165, 165, 115, 123, 123, 239,
- 255, 255, 123, 132, 132, 66, 74, 74, 231, 247,
- 255, 189, 198, 206, 222, 239, 255, 90, 99, 107,
- 231, 239, 247, 239, 247, 255, 198, 206, 214, 165,
- 173, 181, 99, 107, 115, 214, 222, 231, 148, 156,
- 165, 115, 123, 132, 82, 90, 99, 132, 148, 173,
- 222, 231, 247, 189, 198, 214, 156, 165, 181, 57,
- 66, 82, 24, 33, 49, 198, 206, 222, 165, 173,
- 189, 206, 222, 255, 181, 198, 231, 148, 165, 198,
- 66, 74, 90, 90, 107, 140, 74, 90, 123, 33,
- 41, 57, 49, 66, 99, 214, 222, 239, 206, 214,
- 231, 181, 189, 206, 140, 148, 165, 115, 123, 140,
- 107, 115, 132, 82, 90, 107, 74, 82, 99, 49,
- 57, 74, 181, 198, 239, 156, 173, 214, 107, 123,
- 165, 99, 115, 156, 90, 107, 148, 82, 99, 140,
- 66, 82, 123, 57, 74, 115, 222, 231, 255, 189,
- 198, 222, 156, 165, 189, 123, 132, 156, 156, 173,
- 222, 148, 165, 214, 123, 140, 189, 115, 132, 181,
- 90, 107, 156, 24, 33, 57, 214, 222, 247, 198,
- 206, 231, 181, 189, 214, 173, 181, 206, 148, 156,
- 181, 132, 140, 165, 107, 115, 140, 82, 90, 115,
- 66, 74, 99, 148, 165, 222, 107, 123, 173, 41,
- 49, 74, 90, 107, 165, 82, 99, 156, 66, 82,
- 132, 156, 165, 198, 123, 132, 165, 90, 99, 132,
- 107, 123, 181, 57, 66, 99, 99, 115, 173, 82,
- 99, 165, 206, 214, 247, 181, 189, 222, 173, 181,
- 214, 165, 173, 206, 148, 156, 189, 132, 140, 173,
- 156, 165, 206, 123, 132, 173, 74, 82, 115, 66,
- 74, 107, 49, 57, 90, 57, 66, 107, 41, 49,
- 82, 148, 156, 198, 140, 148, 189, 132, 140, 181,
- 115, 123, 165, 107, 115, 156, 99, 107, 148, 82,
- 90, 132, 74, 82, 123, 66, 74, 115, 49, 57,
- 99, 189, 198, 255, 156, 165, 214, 148, 156, 206,
- 140, 148, 198, 132, 140, 189, 123, 132, 181, 123,
- 132, 189, 99, 107, 156, 90, 99, 148, 82, 90,
- 140, 90, 99, 156, 66, 74, 123, 57, 66, 115,
- 165, 173, 231, 140, 148, 206, 107, 115, 173, 99,
- 107, 165, 82, 90, 148, 74, 82, 140, 99, 107,
- 173, 82, 90, 156, 231, 231, 239, 239, 239, 247,
- 247, 247, 255, 198, 198, 206, 206, 206, 214, 181,
- 181, 189, 165, 165, 173, 173, 173, 181, 189, 189,
- 198, 140, 140, 148, 115, 115, 123, 231, 231, 247,
- 239, 239, 255, 107, 107, 115, 123, 123, 132, 206,
- 206, 222, 214, 214, 231, 222, 222, 239, 99, 99,
- 107, 198, 198, 214, 90, 90, 99, 74, 74, 82,
- 156, 156, 173, 140, 140, 156, 148, 148, 165, 132,
- 132, 148, 198, 198, 222, 206, 206, 231, 165, 165,
- 189, 173, 173, 198, 107, 107, 123, 148, 148, 173,
- 181, 181, 214, 90, 90, 107, 41, 41, 49, 82,
- 82, 99, 123, 123, 148, 74, 74, 90, 99, 99,
- 123, 90, 90, 115, 57, 57, 74, 74, 74, 99,
- 66, 66, 90, 24, 24, 33, 57, 57, 82, 49,
- 49, 74, 41, 41, 66, 41, 41, 74, 0, 0,
- 0, 44, 0, 0, 0, 0, 100, 0, 56, 0,
- 0, 8, 255, 0, 1, 8, 28, 72, 176, 160,
- 193, 131, 8, 19, 42, 92, 200, 176, 161, 195,
- 135, 16, 35, 74, 156, 72, 177, 162, 197, 139,
- 24, 51, 58, 108, 210, 1, 218, 51, 112, 224,
- 188, 120, 1, 247, 12, 90, 135, 104, 26, 7,
- 62, 131, 36, 171, 15, 177, 63, 179, 78, 101,
- 72, 249, 16, 218, 55, 50, 144, 78, 201, 154,
- 21, 76, 216, 178, 101, 128, 134, 13, 3, 42,
- 116, 217, 31, 90, 157, 98, 173, 163, 227, 13,
- 26, 69, 104, 166, 50, 45, 219, 132, 139, 213,
- 170, 77, 203, 152, 117, 242, 66, 243, 96, 7,
- 47, 143, 78, 93, 10, 246, 243, 103, 209, 160,
- 203, 134, 50, 27, 198, 172, 237, 48, 91, 204,
- 54, 109, 178, 37, 215, 86, 45, 84, 236, 154,
- 58, 212, 230, 107, 217, 170, 16, 62, 84, 180,
- 80, 97, 194, 200, 155, 183, 105, 58, 116, 237,
- 48, 199, 84, 172, 100, 139, 22, 17, 243, 169,
- 73, 152, 166, 203, 139, 52, 101, 218, 204, 185,
- 51, 49, 81, 146, 53, 153, 141, 43, 119, 19,
- 32, 90, 145, 200, 56, 69, 8, 46, 81, 160,
- 16, 47, 108, 196, 176, 225, 226, 159, 11, 27,
- 45, 140, 12, 219, 116, 78, 113, 198, 111, 166,
- 126, 133, 82, 22, 76, 50, 49, 77, 196, 58,
- 111, 110, 166, 188, 57, 103, 230, 202, 125, 238,
- 222, 20, 40, 144, 173, 78, 86, 124, 15, 132,
- 246, 107, 19, 137, 217, 49, 98, 232, 255, 248,
- 247, 111, 134, 108, 27, 66, 134, 221, 130, 194,
- 193, 34, 52, 66, 189, 20, 125, 234, 19, 57,
- 185, 243, 251, 248, 243, 111, 246, 25, 247, 86,
- 177, 97, 238, 112, 37, 80, 41, 203, 120, 32,
- 219, 108, 48, 144, 87, 94, 120, 179, 17, 177,
- 12, 37, 21, 104, 7, 209, 24, 164, 240, 146,
- 136, 34, 202, 216, 167, 95, 38, 208, 233, 215,
- 33, 135, 249, 17, 179, 12, 93, 129, 220, 98,
- 136, 55, 207, 92, 130, 135, 12, 224, 213, 16,
- 192, 63, 44, 148, 103, 195, 129, 49, 120, 178,
- 9, 24, 51, 65, 164, 205, 26, 136, 32, 131,
- 161, 134, 27, 118, 6, 139, 2, 3, 232, 67,
- 64, 60, 236, 4, 249, 161, 114, 196, 236, 86,
- 76, 49, 181, 108, 50, 196, 129, 54, 204, 0,
- 35, 13, 11, 130, 135, 222, 50, 120, 80, 32,
- 161, 66, 209, 140, 178, 199, 49, 192, 40, 163,
- 89, 144, 206, 65, 34, 128, 130, 5, 160, 129,
- 230, 114, 207, 61, 183, 200, 84, 184, 188, 242,
- 3, 120, 227, 253, 131, 67, 130, 51, 104, 25,
- 67, 10, 203, 220, 2, 65, 142, 11, 105, 163,
- 134, 46, 136, 132, 114, 230, 155, 205, 89, 163,
- 224, 63, 12, 148, 194, 104, 126, 205, 16, 211,
- 202, 61, 224, 97, 249, 207, 13, 48, 140, 199,
- 2, 12, 224, 197, 208, 130, 27, 183, 60, 96,
- 193, 66, 77, 12, 114, 197, 26, 159, 44, 58,
- 105, 103, 205, 68, 255, 240, 40, 4, 176, 188,
- 154, 95, 43, 84, 156, 199, 195, 163, 143, 234,
- 48, 155, 108, 119, 148, 234, 101, 66, 219, 104,
- 161, 69, 42, 153, 184, 106, 235, 102, 192, 52,
- 240, 104, 5, 138, 44, 219, 92, 165, 185, 80,
- 193, 96, 14, 51, 100, 59, 67, 140, 60, 204,
- 128, 67, 120, 178, 77, 114, 139, 3, 19, 124,
- 57, 80, 52, 77, 104, 17, 139, 51, 210, 54,
- 7, 75, 2, 10, 6, 240, 77, 187, 206, 185,
- 178, 15, 139, 52, 202, 198, 39, 131, 178, 181,
- 224, 215, 20, 229, 30, 180, 77, 19, 224, 40,
- 162, 44, 103, 176, 160, 51, 14, 60, 11, 55,
- 204, 112, 56, 237, 204, 115, 137, 114, 116, 16,
- 16, 47, 55, 14, 135, 115, 135, 33, 191, 116,
- 166, 10, 195, 32, 59, 60, 78, 23, 118, 160,
- 2, 204, 102, 197, 188, 18, 4, 149, 224, 242,
- 121, 94, 120, 64, 104, 130, 135, 3, 195, 22,
- 52, 176, 54, 201, 28, 204, 217, 55, 6, 240,
- 234, 243, 63, 5, 116, 243, 9, 103, 236, 252,
- 236, 179, 1, 230, 68, 155, 137, 57, 70, 63,
- 26, 128, 2, 235, 92, 178, 76, 43, 73, 132,
- 122, 30, 14, 255, 236, 224, 167, 18, 204, 96,
- 97, 234, 151, 77, 100, 161, 69, 34, 236, 222,
- 215, 140, 23, 3, 52, 205, 43, 3, 209, 54,
- 51, 129, 218, 188, 158, 211, 76, 51, 15, 192,
- 173, 224, 0, 212, 92, 130, 75, 43, 37, 188,
- 255, 124, 32, 14, 44, 130, 215, 131, 50, 172,
- 56, 48, 168, 65, 114, 84, 1, 75, 217, 247,
- 41, 114, 1, 175, 1, 68, 254, 162, 207, 216,
- 100, 162, 136, 3, 118, 43, 152, 0, 27, 153,
- 112, 227, 180, 228, 63, 19, 176, 197, 50, 160,
- 176, 114, 39, 203, 252, 138, 42, 198, 38, 225,
- 144, 219, 30, 65, 218, 32, 202, 248, 125, 177,
- 200, 170, 32, 3, 27, 104, 160, 251, 5, 14,
- 172, 169, 32, 1, 191, 244, 2, 175, 130, 17,
- 96, 96, 60, 6, 20, 244, 204, 38, 33, 191,
- 32, 16, 47, 6, 186, 107, 144, 1, 5, 10,
- 240, 250, 64, 42, 182, 184, 130, 199, 9, 86,
- 255, 26, 195, 8, 178, 12, 19, 134, 225, 24,
- 24, 68, 202, 33, 202, 108, 152, 138, 231, 10,
- 98, 99, 138, 41, 169, 64, 66, 72, 52, 22,
- 240, 234, 14, 36, 22, 147, 23, 192, 52, 165,
- 244, 95, 202, 55, 212, 120, 84, 1, 8, 1,
- 139, 180, 145, 167, 0, 80, 121, 159, 41, 210,
- 1, 141, 225, 145, 71, 1, 233, 200, 196, 38,
- 92, 129, 11, 35, 164, 192, 79, 40, 40, 66,
- 31, 54, 145, 7, 7, 60, 128, 2, 175, 27,
- 72, 22, 144, 1, 12, 157, 41, 231, 17, 206,
- 83, 80, 57, 148, 163, 8, 104, 40, 143, 60,
- 231, 32, 195, 228, 254, 65, 0, 72, 40, 135,
- 11, 143, 66, 0, 33, 202, 240, 168, 5, 68,
- 176, 51, 138, 192, 198, 163, 255, 14, 32, 135,
- 205, 12, 227, 73, 111, 136, 194, 17, 144, 240,
- 129, 37, 252, 97, 25, 184, 24, 135, 3, 200,
- 181, 1, 131, 60, 2, 50, 65, 242, 134, 1,
- 255, 33, 128, 66, 52, 39, 29, 41, 36, 79,
- 53, 174, 241, 40, 5, 68, 165, 51, 66, 84,
- 208, 2, 222, 145, 70, 242, 60, 64, 82, 202,
- 65, 199, 16, 193, 193, 25, 209, 200, 165, 45,
- 204, 192, 69, 37, 194, 145, 13, 195, 81, 160,
- 138, 6, 137, 5, 49, 128, 100, 54, 105, 204,
- 208, 0, 181, 82, 78, 58, 10, 240, 168, 107,
- 80, 224, 81, 14, 136, 69, 103, 146, 225, 44,
- 5, 61, 192, 20, 236, 35, 15, 5, 122, 209,
- 28, 48, 60, 42, 1, 116, 132, 83, 38, 6,
- 41, 154, 86, 180, 225, 1, 75, 152, 0, 6,
- 66, 88, 144, 62, 44, 195, 132, 157, 249, 69,
- 5, 122, 216, 49, 88, 25, 50, 94, 207, 168,
- 155, 130, 38, 160, 180, 205, 248, 98, 1, 143,
- 154, 64, 42, 28, 24, 128, 12, 244, 114, 57,
- 12, 120, 20, 3, 230, 128, 159, 69, 180, 162,
- 21, 52, 3, 36, 66, 254, 48, 140, 32, 193,
- 66, 2, 143, 234, 70, 40, 88, 8, 133, 28,
- 70, 3, 152, 10, 186, 192, 135, 56, 113, 128,
- 71, 89, 193, 20, 249, 251, 199, 0, 188, 144,
- 190, 88, 190, 240, 31, 17, 32, 4, 136, 148,
- 195, 28, 80, 240, 195, 1, 21, 88, 136, 48,
- 152, 65, 255, 72, 231, 148, 162, 146, 228, 137,
- 64, 115, 30, 241, 206, 39, 64, 131, 145, 228,
- 25, 128, 55, 148, 3, 137, 45, 234, 195, 27,
- 133, 152, 33, 2, 212, 209, 28, 73, 60, 74,
- 0, 27, 72, 100, 156, 56, 147, 11, 76, 144,
- 203, 92, 4, 9, 134, 45, 52, 177, 164, 230,
- 168, 131, 152, 133, 248, 16, 44, 0, 170, 78,
- 47, 100, 64, 162, 242, 236, 76, 0, 53, 247,
- 8, 166, 41, 40, 9, 112, 220, 140, 50, 58,
- 145, 206, 127, 52, 0, 26, 219, 188, 15, 49,
- 246, 177, 143, 143, 42, 164, 19, 88, 241, 144,
- 23, 210, 73, 128, 50, 92, 66, 21, 168, 168,
- 3, 54, 170, 247, 168, 8, 188, 195, 81, 10,
- 106, 128, 70, 57, 212, 205, 172, 150, 34, 10,
- 143, 226, 70, 212, 84, 209, 9, 67, 180, 99,
- 139, 255, 48, 0, 7, 182, 58, 79, 14, 45,
- 3, 19, 249, 160, 25, 72, 7, 194, 142, 91,
- 48, 67, 63, 138, 200, 0, 228, 64, 231, 51,
- 7, 160, 33, 17, 186, 36, 143, 4, 124, 209,
- 153, 68, 176, 116, 2, 165, 160, 170, 254, 36,
- 55, 195, 187, 101, 192, 77, 249, 41, 6, 28,
- 224, 129, 207, 185, 10, 228, 25, 212, 209, 15,
- 44, 222, 150, 185, 127, 60, 0, 28, 161, 128,
- 5, 56, 201, 115, 141, 100, 116, 134, 19, 14,
- 252, 135, 52, 74, 129, 80, 187, 25, 0, 3,
- 114, 40, 169, 114, 90, 1, 135, 108, 255, 60,
- 224, 2, 12, 145, 196, 127, 242, 83, 10, 204,
- 217, 13, 1, 21, 248, 198, 54, 209, 25, 175,
- 133, 118, 70, 77, 10, 18, 128, 23, 216, 209,
- 88, 163, 9, 192, 1, 28, 240, 130, 105, 241,
- 211, 12, 201, 154, 225, 1, 17, 208, 0, 67,
- 192, 225, 31, 98, 64, 231, 187, 155, 73, 135,
- 98, 255, 161, 128, 5, 152, 119, 1, 12, 104,
- 128, 4, 50, 208, 129, 82, 64, 71, 28, 220,
- 56, 111, 3, 126, 200, 25, 113, 48, 224, 188,
- 15, 248, 70, 57, 30, 53, 128, 243, 154, 151,
- 27, 15, 168, 0, 7, 160, 1, 9, 217, 62,
- 103, 25, 175, 128, 67, 23, 228, 218, 144, 117,
- 8, 162, 24, 248, 1, 71, 107, 7, 0, 142,
- 111, 88, 248, 27, 115, 112, 196, 35, 96, 49,
- 221, 205, 152, 226, 194, 22, 230, 100, 103, 254,
- 119, 225, 57, 112, 194, 166, 228, 113, 64, 22,
- 64, 60, 7, 52, 108, 184, 195, 249, 113, 197,
- 25, 232, 65, 62, 135, 116, 192, 19, 174, 216,
- 132, 115, 20, 161, 129, 25, 30, 64, 146, 244,
- 114, 78, 40, 124, 75, 158, 9, 176, 245, 77,
- 213, 133, 195, 61, 31, 16, 48, 135, 124, 227,
- 13, 172, 168, 166, 114, 98, 49, 75, 53, 30,
- 19, 86, 237, 250, 197, 104, 85, 123, 101, 52,
- 85, 183, 31, 112, 104, 64, 55, 178, 27, 17,
- 47, 172, 34, 199, 162, 228, 3, 4, 30, 213,
- 0, 24, 7, 25, 255, 97, 47, 92, 167, 129,
- 241, 147, 62, 92, 192, 1, 14, 220, 48, 28,
- 110, 37, 226, 13, 86, 128, 162, 24, 26, 74,
- 199, 150, 43, 247, 230, 230, 68, 84, 65, 7,
- 152, 23, 163, 154, 161, 9, 87, 192, 161, 31,
- 220, 232, 198, 215, 40, 146, 129, 55, 128, 194,
- 24, 203, 216, 204, 51, 20, 64, 128, 78, 23,
- 160, 12, 115, 110, 23, 23, 10, 208, 105, 2,
- 56, 128, 12, 139, 102, 6, 109, 249, 145, 231,
- 0, 179, 82, 34, 29, 176, 67, 43, 114, 81,
- 12, 77, 168, 35, 11, 208, 200, 117, 22, 52,
- 10, 222, 121, 246, 250, 215, 162, 100, 14, 33,
- 160, 129, 107, 104, 104, 67, 146, 192, 246, 117,
- 51, 156, 225, 138, 126, 48, 130, 30, 81, 48,
- 156, 5, 44, 11, 17, 40, 176, 162, 21, 160,
- 216, 68, 63, 11, 29, 100, 70, 7, 98, 31,
- 140, 232, 71, 235, 176, 123, 1, 106, 71, 100,
- 26, 245, 120, 102, 142, 53, 19, 106, 110, 123,
- 136, 67, 196, 216, 4, 109, 225, 208, 134, 62,
- 50, 153, 80, 41, 225, 64, 53, 236, 241, 204,
- 63, 223, 181, 173, 238, 86, 146, 84, 4, 241,
- 10, 48, 183, 161, 213, 16, 168, 128, 52, 23,
- 163, 1, 9, 240, 251, 21, 173, 200, 113, 166,
- 231, 230, 235, 96, 91, 188, 226, 24, 7, 239,
- 220, 152, 227, 140, 98, 180, 2, 204, 244, 110,
- 192, 3, 252, 200, 222, 174, 24, 164, 3, 26,
- 255, 152, 64, 61, 42, 241, 10, 136, 187, 162,
- 24, 153, 6, 81, 187, 23, 13, 34, 209, 20,
- 3, 20, 152, 184, 51, 38, 228, 97, 219, 110,
- 64, 128, 2, 37, 55, 57, 66, 58, 48, 189,
- 110, 192, 3, 20, 251, 120, 197, 62, 114, 97,
- 140, 77, 48, 195, 25, 246, 217, 184, 204, 51,
- 46, 115, 138, 39, 75, 19, 204, 40, 134, 43,
- 90, 129, 137, 126, 244, 131, 31, 248, 88, 176,
- 7, 35, 0, 116, 115, 11, 29, 0, 40, 183,
- 128, 4, 186, 97, 143, 74, 236, 3, 19, 152,
- 80, 122, 196, 113, 81, 12, 167, 47, 195, 25,
- 151, 113, 206, 101, 68, 19, 151, 98, 24, 3,
- 20, 92, 247, 186, 215, 205, 16, 134, 86, 27,
- 78, 2, 22, 208, 128, 217, 207, 78, 16, 14,
- 100, 192, 2, 19, 128, 64, 54, 236, 145, 135,
- 124, 188, 2, 19, 254, 128, 187, 210, 33, 142,
- 109, 80, 120, 222, 243, 185, 120, 102, 203, 187,
- 46, 248, 126, 232, 161, 13, 120, 88, 240, 3,
- 86, 255, 4, 196, 103, 128, 3, 139, 103, 252,
- 65, 56, 176, 1, 12, 84, 96, 2, 79, 120,
- 64, 59, 186, 128, 7, 121, 84, 62, 31, 68,
- 125, 5, 63, 50, 159, 121, 126, 232, 97, 31,
- 102, 48, 3, 61, 242, 16, 6, 44, 112, 35,
- 27, 146, 94, 125, 4, 36, 80, 1, 232, 117,
- 32, 246, 178, 95, 72, 7, 56, 160, 1, 12,
- 88, 128, 2, 19, 136, 0, 83, 4, 32, 176,
- 132, 213, 143, 252, 252, 30, 76, 255, 3, 166,
- 176, 250, 241, 71, 96, 2, 20, 176, 0, 244,
- 96, 159, 125, 198, 111, 63, 119, 211, 184, 128,
- 5, 42, 64, 129, 254, 79, 224, 255, 0, 72,
- 1, 21, 80, 1, 22, 112, 1, 208, 179, 1,
- 244, 87, 127, 10, 232, 21, 215, 7, 123, 28,
- 0, 123, 215, 119, 125, 11, 56, 129, 20, 88,
- 129, 22, 120, 129, 24, 152, 129, 14, 17, 16,
- 0, 59 };
diff --git a/main/main.c b/main/main.c
deleted file mode 100644
index 5c5ed82453..0000000000
--- a/main/main.c
+++ /dev/null
@@ -1,2147 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- | Rasmus Lerdorf <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-/* #define CRASH_DETECTION */
-
-#define SHUTDOWN_DEBUG(resource) fprintf(stderr, "*** Shutting down " resource "\n" )
-#undef SHUTDOWN_DEBUG
-#define SHUTDOWN_DEBUG(resource)
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include <stdio.h>
-#include "php.h"
-#ifdef MSVC5
-#include "win32/time.h"
-#include "win32/signal.h"
-#include <process.h>
-#else
-#include "build-defs.h"
-#endif
-#if HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_SETLOCALE
-#include <locale.h>
-#endif
-#include "zend.h"
-#include "php_ini.h"
-#include "php_globals.h"
-#include "main.h"
-#include "control_structures.h"
-#include "fopen-wrappers.h"
-#include "ext/standard/php3_standard.h"
-#include "functions/post.h"
-#include "functions/head.h"
-#include "snprintf.h"
-#if WIN32|WINNT
-#include <io.h>
-#include <fcntl.h>
-#include "win32/syslog.h"
-#include "win32/php_registry.h"
-#else
-#include <syslog.h>
-#endif
-
-#include "zend_compile.h"
-#include "zend_execute.h"
-#include "zend_highlight.h"
-#include "zend_indent.h"
-
-#if USE_SAPI
-#include "serverapi/sapi.h"
-void *gLock;
-#ifndef THREAD_SAFE
-struct sapi_request_info *sapi_rqst;
-#endif
-#endif
-
-#if MSVC5 || !defined(HAVE_GETOPT)
-#include "getopt.h"
-#endif
-
-#ifdef ZTS
-int compiler_globals_id;
-int executor_globals_id;
-#endif
-
-#ifndef ZTS
-php_core_globals core_globals;
-#endif
-
-void _php3_build_argv(char * ELS_DC);
-static void php3_timeout(int dummy);
-static void php3_set_timeout(long seconds INLINE_TLS);
-
-void *gLock; /*mutex variable */
-
-
-#define PHP_MODE_STANDARD 1
-#define PHP_MODE_HIGHLIGHT 2
-#define PHP_MODE_INDENT 3
-
-/* True globals (no need for thread safety) */
-HashTable configuration_hash;
-char *php3_ini_path = NULL;
-
-
-static PHP_INI_MH(OnSetPrecision)
-{
- ELS_FETCH();
-
- EG(precision) = atoi(new_value);
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnChangeMaxExecutionTime)
-{
- int new_timeout;
-
- if (new_value) {
- new_timeout = atoi(new_value);
- } else {
- new_timeout = 0;
- }
- php3_set_timeout(new_timeout);
- return SUCCESS;
-}
-
-
-static PHP_INI_MH(OnChangeMemoryLimit)
-{
- int new_limit;
-
- if (new_value) {
- new_limit = atoi(new_value);
- } else {
- new_limit = 2<<30; /* effectively, no limit */
- }
- return zend_set_memory_limit(new_limit);
-}
-
-
-static PHP_INI_MH(OnUpdateErrorReporting)
-{
- ELS_FETCH();
-
- if (!new_value) {
- EG(error_reporting) = E_ALL & ~E_NOTICE;
- } else {
- EG(error_reporting) = atoi(new_value);
- }
- return SUCCESS;
-}
-
-
-/* Need to convert to strings and make use of:
- * DEFAULT_SHORT_OPEN_TAG
- * PHP_SAFE_MODE
- *
- * Need to be read from the environment (?):
- * PHP_AUTO_PREPEND_FILE
- * PHP_AUTO_APPEND_FILE
- * PHP_DOCUMENT_ROOT
- * PHP_USER_DIR
- * PHP_INCLUDE_PATH
- */
-
-#ifndef SAFE_MODE_EXEC_DIR
-# define SAFE_MODE_EXEC_DIR "/"
-#endif
-
-#ifdef PHP_PROG_SENDMAIL
-# define DEFAULT_SENDMAIL_PATH PHP_PROG_SENDMAIL " -t"
-#else
-# define DEFAULT_SENDMAIL_PATH NULL
-#endif
-
-PHP_INI_BEGIN()
- PHP_INI_ENTRY("short_open_tag", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, short_tags))
- PHP_INI_ENTRY("asp_tags", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, asp_tags))
- PHP_INI_ENTRY("precision", "14", PHP_INI_ALL, OnSetPrecision, NULL)
-
- PHP_INI_ENTRY("highlight.comment", HL_COMMENT_COLOR, PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("highlight.default", HL_DEFAULT_COLOR, PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("highlight.html", HL_HTML_COLOR, PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("highlight.bg", HL_BG_COLOR, PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, NULL)
-
- PHP_INI_ENTRY("magic_quotes_gpc", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_gpc))
- PHP_INI_ENTRY("magic_quotes_runtime", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_runtime))
- PHP_INI_ENTRY("magic_quotes_sybase", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, magic_quotes_sybase))
-
- PHP_INI_ENTRY("safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, safe_mode))
- PHP_INI_ENTRY("sql.safe_mode", "0", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, sql_safe_mode))
- PHP_INI_ENTRY("safe_mode_exec_dir", SAFE_MODE_EXEC_DIR, PHP_INI_SYSTEM, OnUpdateString, (void *) XtOffsetOf(php_core_globals, safe_mode_exec_dir))
- PHP_INI_ENTRY("enable_dl", "1", PHP_INI_SYSTEM, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, enable_dl))
-
- PHP_INI_ENTRY("SMTP", "localhost", PHP_INI_ALL, NULL, NULL)
- PHP_INI_ENTRY("sendmail_path", DEFAULT_SENDMAIL_PATH, PHP_INI_SYSTEM, NULL, NULL)
- PHP_INI_ENTRY("sendmail_from", NULL, PHP_INI_ALL, NULL, NULL)
-
- PHP_INI_ENTRY("error_reporting", NULL, PHP_INI_ALL, OnUpdateErrorReporting, NULL)
- PHP_INI_ENTRY("display_errors", "1", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, display_errors))
- PHP_INI_ENTRY("track_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_errors))
- PHP_INI_ENTRY("log_errors", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, log_errors))
- PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, error_log))
-
- PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_prepend_file))
- PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_ALL, OnUpdateString, (void *) XtOffsetOf(php_core_globals, auto_append_file))
-
- PHP_INI_ENTRY("y2k_compliance", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, y2k_compliance))
-
- PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, doc_root))
- PHP_INI_ENTRY("user_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, user_dir))
- PHP_INI_ENTRY("include_path", NULL, PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, include_path))
- PHP_INI_ENTRY("open_basedir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, open_basedir))
- PHP_INI_ENTRY("extension_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, extension_dir))
-
- PHP_INI_ENTRY("upload_tmp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, upload_tmp_dir))
- PHP_INI_ENTRY("upload_max_filesize", "2097152", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, upload_max_filesize))
-
- PHP_INI_ENTRY("browscap", NULL, PHP_INI_SYSTEM, NULL, NULL)
-
- PHP_INI_ENTRY("define_syslog_variables", "0", PHP_INI_ALL, NULL, NULL)
-
- PHP_INI_ENTRY("max_execution_time", "30", PHP_INI_ALL, OnChangeMaxExecutionTime, NULL)
- PHP_INI_ENTRY("memory_limit", "8388608", PHP_INI_ALL, OnChangeMemoryLimit, NULL)
-
- PHP_INI_ENTRY("track_vars", "0", PHP_INI_ALL, OnUpdateInt, (void *) XtOffsetOf(php_core_globals, track_vars))
- PHP_INI_ENTRY("gpc_order", "GPC", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, gpc_order))
- PHP_INI_ENTRY("arg_separator", "&", PHP_INI_ALL, OnUpdateStringUnempty, (void *) XtOffsetOf(php_core_globals, arg_separator))
-PHP_INI_END()
-
-
-
-#ifndef THREAD_SAFE
-/*
- * Globals yet to be protected
- */
-int initialized; /* keep track of which resources were successfully initialized */
-static int module_initialized = 0;
-unsigned char header_is_being_sent;
-
-#if WIN32|WINNT
-unsigned int wintimer;
-unsigned int timerstart;
-unsigned int wintimer_counter = 0;
-#endif
-
-#if APACHE
-request_rec *php3_rqst = NULL; /* request record pointer for apache module version */
-#endif
-
-/*
- * End of globals to be protected
- */
-
-#endif
-
-#if APACHE
-void php3_apache_puts(const char *s)
-{
- TLS_VARS;
-
- if (GLOBAL(php3_rqst)) {
- rputs(s, GLOBAL(php3_rqst));
- } else {
- fputs(s, stdout);
- }
-}
-
-void php3_apache_putc(char c)
-{
- TLS_VARS;
-
- if (GLOBAL(php3_rqst)) {
- rputc(c, GLOBAL(php3_rqst));
- } else {
- fputc(c, stdout);
- }
-}
-#endif
-
-void php3_log_err(char *log_message)
-{
- FILE *log_file;
- PLS_FETCH();
-
- /* Try to use the specified logging location. */
- if (PG(error_log) != NULL) {
-#if HAVE_SYSLOG_H
- if (strcmp(PG(error_log), "syslog")) {
- syslog(LOG_NOTICE, log_message);
- return;
- } else {
-#endif
- log_file = fopen(PG(error_log), "a");
- if (log_file != NULL) {
- fprintf(log_file, log_message);
- fprintf(log_file, "\n");
- fclose(log_file);
- return;
- }
-#if HAVE_SYSLOG_H
- }
-#endif
- }
- /* Otherwise fall back to the default logging location. */
-#if APACHE
- if (GLOBAL(php3_rqst)) {
-#if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, php3_rqst->server, log_message);
-#else
- log_error(log_message, php3_rqst->server);
-#endif
- } else {
- fprintf(stderr, log_message);
- fprintf(stderr, "\n");
- }
-#endif /*APACHE */
-
-#if CGI_BINARY
- if (php3_header()) {
- fprintf(stderr, log_message);
- fprintf(stderr, "\n");
- }
-#endif
-}
-
-
-/* is 4K big enough? */
-#define PRINTF_BUFFER_SIZE 1024*4
-
-/* wrapper for modules to use PHPWRITE */
-PHPAPI int php3_write(void *buf, int size)
-{
- return PHPWRITE(buf, size);
-}
-
-PHPAPI int php3_printf(const char *format,...)
-{
- va_list args;
- int ret;
- char buffer[PRINTF_BUFFER_SIZE];
- int size;
-
- va_start(args, format);
- size = vsprintf(buffer, format, args);
- ret = PHPWRITE(buffer, size);
- va_end(args);
-
- return ret;
-}
-
-
-/* extended error handling function */
-PHPAPI void php3_error(int type, const char *format,...)
-{
- va_list args;
- char *error_filename = NULL;
- uint error_lineno;
- char buffer[1024];
- int size = 0;
- ELS_FETCH();
-
- if (!(type & E_CORE)) {
- if (!GLOBAL(initialized)) { /* don't display further errors after php3_request_shutdown() */
- return;
- }
- }
- switch (type) {
- case E_CORE_ERROR:
- case E_CORE_WARNING:
- error_filename = NULL;
- error_lineno = 0;
- break;
- case E_PARSE:
- case E_COMPILE_ERROR:
- case E_COMPILE_WARNING: {
- CLS_FETCH();
-
- error_filename = zend_get_compiled_filename();
- error_lineno = CG(zend_lineno);
- }
- break;
- case E_ERROR:
- case E_NOTICE:
- case E_WARNING:
- error_filename = zend_get_executed_filename(ELS_C);
- error_lineno = zend_get_executed_lineno(ELS_C);
- break;
- default:
- error_filename = NULL;
- error_lineno = 0;
- break;
- }
-
- if (EG(error_reporting) & type || (type & E_CORE)) {
- char *error_type_str;
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- case E_COMPILE_ERROR:
- error_type_str = "Fatal error";
- break;
- case E_WARNING:
- case E_CORE_WARNING:
- case E_COMPILE_WARNING:
- error_type_str = "Warning";
- break;
- case E_PARSE:
- error_type_str = "Parse error";
- break;
- case E_NOTICE:
- error_type_str = "Warning";
- break;
- default:
- error_type_str = "Unknown error";
- break;
- }
-
- /* get include file name */
- if (PG(log_errors) || PG(display_errors)) {
- va_start(args, format);
- size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
- va_end(args);
- buffer[sizeof(buffer) - 1] = 0;
-
- if (PG(log_errors)) {
- char log_buffer[1024];
-
- snprintf(log_buffer, 1024, "PHP 3 %s: %s in %s on line %d", error_type_str, buffer, error_filename, error_lineno);
- php3_log_err(log_buffer);
- }
- if (PG(display_errors)) {
- char *prepend_string = INI_STR("error_prepend_string");
- char *append_string = INI_STR("error_append_string");
-
- if (prepend_string) {
- PUTS(prepend_string);
- }
- php3_printf("<br>\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br>\n", error_type_str, buffer, error_filename, error_lineno);
- if (append_string) {
- PUTS(append_string);
- }
- }
- }
- }
- if (PG(track_errors)) {
- pval tmp;
-
- va_start(args, format);
- size = vsnprintf(buffer, sizeof(buffer) - 1, format, args);
- va_end(args);
- buffer[sizeof(buffer) - 1] = 0;
-
- tmp.value.str.val = (char *) estrndup(buffer, size);
- tmp.value.str.len = size;
- tmp.type = IS_STRING;
-
- _php3_hash_update(EG(active_symbol_table), "php_errormsg", sizeof("php_errormsg"), (void *) & tmp, sizeof(pval), NULL);
- }
-
- switch (type) {
- case E_ERROR:
- case E_CORE_ERROR:
- /*case E_PARSE: the parser would return 1 (failure), we can bail out nicely */
- case E_COMPILE_ERROR:
- zend_bailout();
- break;
- }
-}
-
-
-
-
-#if HAVE_SETITIMER
-static void php3_timeout(int dummy)
-{
- PLS_FETCH();
-
- php3_error(E_ERROR, "Maximum execution time of %d seconds exceeded", PG(max_execution_time));
-}
-#endif
-
-/* This one doesn't exists on QNX */
-#ifndef SIGPROF
-#define SIGPROF 27
-#endif
-
-static void php3_set_timeout(long seconds INLINE_TLS)
-{
-#if WIN32|WINNT
- if (seconds > 0) {
- GLOBAL(timerstart) = (unsigned int) clock();
- GLOBAL(wintimer) = GLOBAL(timerstart) + (CLOCKS_PER_SEC * seconds);
- } else {
- GLOBAL(wintimer) = 0;
- }
-#else
-#if HAVE_SETITIMER
- struct itimerval t_r; /* timeout requested */
-
- t_r.it_value.tv_sec = seconds;
- t_r.it_value.tv_usec = t_r.it_interval.tv_sec = t_r.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &t_r, NULL);
- signal(SIGPROF, php3_timeout);
-#endif
-#endif
-}
-
-
-static void php3_unset_timeout(INLINE_TLS_VOID)
-{
-#if WIN32|WINNT
- GLOBAL(wintimer) = 0;
-#else
-#if HAVE_SETITIMER
- struct itimerval no_timeout;
-
- no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0;
-
- setitimer(ITIMER_PROF, &no_timeout, NULL);
-#endif
-#endif
-}
-
-
-void php3_set_time_limit(INTERNAL_FUNCTION_PARAMETERS)
-{
- pval *new_timeout;
-
- if (PG(safe_mode)) {
- php3_error(E_WARNING, "Cannot set time limit in safe mode");
- RETURN_FALSE;
- }
- if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &new_timeout) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long(new_timeout);
- /* FIXME ** This is BAD...in a threaded situation, any user
- can set the timeout for php on a server wide basis.
- INI variables should not be reset via a user script
-
- Fix what? At least on Unix, timers like these are
- per-thread timers. Well, with a little work they will
- be. If we use a bound thread and proper masking it
- should work fine. Is this FIXME a WIN32 problem? Is
- there no way to do per-thread timers on WIN32?
- */
- php3_unset_timeout(_INLINE_TLS_VOID);
- php3_set_timeout(new_timeout->value.lval _INLINE_TLS);
-}
-
-
-static FILE *php_fopen_wrapper_for_zend(const char *filename)
-{
- int issock=0, socketd=0;
-
- FILE *retval=php3_fopen_wrapper((char *) filename, "r", USE_PATH|IGNORE_URL_WIN, &issock, &socketd);
- if (issock) {
- retval = fdopen(socketd, "r");
- }
- return retval;
-}
-
-
-static void php_message_handler_for_zend(long message, void *data)
-{
- switch (message) {
- case ZMSG_ENABLE_TRACK_VARS:
- PG(track_vars) = 1;
- break;
- case ZMSG_FAILED_INCLUDE_FOPEN:
- php3_error(E_WARNING, "Failed opening '%s' for inclusion", php3_strip_url_passwd((char *) data));
- break;
- case ZMSG_FAILED_REQUIRE_FOPEN:
- php3_error(E_ERROR, "Failed opening required '%s'", php3_strip_url_passwd((char *) data));
- break;
- case ZMSG_FAILED_HIGHLIGHT_FOPEN:
- php3_error(E_WARNING, "Failed opening '%s' for highlighting", php3_strip_url_passwd((char *) data));
- break;
- case ZMSG_MEMORY_LEAK_DETECTED: {
- ELS_FETCH();
-
- if (EG(error_reporting)&E_WARNING) {
-#if ZEND_DEBUG
- mem_header *t = (mem_header *) data;
-# if APACHE /* log into the errorlog, since at this time we can't send messages to the browser */
- char memory_leak_buf[512];
-
- snprintf(memory_leak_buf,512,"Possible PHP4 memory leak detected (harmless): 0x%0.8lX, %d bytes from %s:%d", (long) t, t->size, t->filename, t->lineno);
-# if MODULE_MAGIC_NUMBER >= 19970831
- aplog_error(NULL, 0, APLOG_ERR | APLOG_NOERRNO, GLOBAL(php3_rqst)->server, memory_leak_buf);
-# else
- log_error(memory_leak_buf,GLOBAL(php3_rqst)->server);
-# endif
-# else
- php3_printf("Freeing 0x%0.8X (%d bytes), allocated in %s on line %d<br>\n",(void *)((char *)t+sizeof(mem_header)+PLATFORM_PADDING),t->size,t->filename,t->lineno);
-# endif
-#endif
- }
- }
- break;
- }
-}
-
-
-int php3_request_startup(CLS_D ELS_DC)
-{
- zend_output_startup();
-#if APACHE && defined(CRASH_DETECTION)
- {
- char log_message[256];
-
- snprintf(log_message,256,"php3_request_startup(): script='%s', pid=%d",php3_rqst->filename,getpid());
- log_error(log_message, php3_rqst->server);
- }
-#endif
-
- php3_set_timeout(PG(max_execution_time) _INLINE_TLS);
-
- GLOBAL(initialized) = 0;
-
-#if APACHE
- /*
- * For the Apache module version, this bit of code registers a cleanup
- * function that gets triggered when our request pool is destroyed.
- * We need this because at any point in our code we can be interrupted
- * and that may happen before we have had time to free our memory.
- * The php3_shutdown function needs to free all outstanding allocated
- * memory.
- */
- block_alarms();
- register_cleanup(GLOBAL(php3_rqst)->pool, NULL, php3_request_shutdown, php3_request_shutdown_for_exec);
- unblock_alarms();
-#endif
-
- /* initialize global variables */
- {
- GLOBAL(header_is_being_sent) = 0;
- }
-
- if (php3_init_request_info(NULL)) {
- php3_printf("Unable to initialize request info.\n");
- return FAILURE;
- }
- GLOBAL(initialized) |= INIT_REQUEST_INFO;
-
- init_compiler(CLS_C ELS_CC);
- init_executor(CLS_C ELS_CC);
-
- startup_scanner(CLS_C);
-
-
- return SUCCESS;
-}
-
-
-void php3_request_shutdown_for_exec(void *dummy)
-{
- TLS_VARS;
-
- /* used to close fd's in the 3..255 range here, but it's problematic
- */
- shutdown_memory_manager(1, 1);
-}
-
-
-int return_one(void *p)
-{
- return 1;
-}
-
-
-void php3_request_shutdown(void *dummy INLINE_TLS)
-{
-#if FHTTPD
- char tmpline[128];
- int i, serverdefined;
-#endif
-#if APACHE && defined(CRASH_DETECTION)
- {
- char log_message[256];
-
- snprintf(log_message,256,"php3_request_shutdown(): script='%s', pid=%d",php3_rqst->filename,getpid());
- log_error(log_message, php3_rqst->server);
- }
-#endif
- CLS_FETCH();
- ELS_FETCH();
-
- php3_header();
- zend_end_ob_buffering(1);
-
-
- php3_call_shutdown_functions();
-
- GLOBAL(initialized) &= ~INIT_ENVIRONMENT; /* does not require any special shutdown */
-
- php_ini_rshutdown();
-
- shutdown_scanner(CLS_C);
-
- shutdown_compiler(CLS_C);
- shutdown_executor(ELS_C);
-
- if (GLOBAL(initialized) & INIT_REQUEST_INFO) {
- SHUTDOWN_DEBUG("Request info");
- php3_destroy_request_info(NULL);
- GLOBAL(initialized) &= ~INIT_REQUEST_INFO;
- }
- if (GLOBAL(initialized) & INIT_SCANNER) {
- SHUTDOWN_DEBUG("Scanner");
- reset_scanner(CLS_C);
- GLOBAL(initialized) &= ~INIT_SCANNER;
- }
- SHUTDOWN_DEBUG("Memory manager");
- shutdown_memory_manager(0, 0);
- if (GLOBAL(initialized)) {
- php3_error(E_WARNING, "Unknown resources in request shutdown function");
- }
- php3_unset_timeout(_INLINE_TLS_VOID);
-
-
-#if CGI_BINARY
- fflush(stdout);
- if(GLOBAL(request_info).php_argv0) {
- free(GLOBAL(request_info).php_argv0);
- GLOBAL(request_info).php_argv0 = NULL;
- }
-#endif
-#if FHTTPD
- if (response) {
- if (!headermade) {
- makestandardheader(response, 200, "text/html", "fhttpd", req && req->keepalive);
- } else {
- if (headerfirstline)
- putlinetoheader(response, headerfirstline);
- else
- putlinetoheader(response, "HTTP/1.0 200 OK\r\n");
- serverdefined = 0;
- for (i = 0; i < headerlines; i++) {
- if (!strncmp(currentheader[i], "Server:", 7))
- serverdefined = 1;
- putlinetoheader(response, currentheader[i]);
- }
- if (!serverdefined)
- putlinetoheader(response, "Server: fhttpd\r\n");
- if (response->datasize) {
- sprintf(tmpline, "Content-Length: %ld\r\n", response->datasize);
- putlinetoheader(response, tmpline);
- if (req && req->keepalive)
- putlinetoheader(response,
- "Connection: Keep-Alive\r\nKeep-Alive: max=0, timeout=30\r\n");
- }
- php3_fhttpd_free_header();
- }
- sendresponse(server, response);
- if (response->datasize)
- finishresponse(server, response);
- else
- finishdropresponse(server, response);
- deleteresponse(response);
- }
- response = NULL;
- if (req)
- deleterequest(req);
- req = NULL;
-#endif
-#if USE_SAPI
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
-#endif
-}
-
-
-static int php3_config_ini_startup(ELS_D)
-{
- if (php3_init_config() == FAILURE) {
- php3_printf("PHP: Unable to parse configuration file.\n");
- return FAILURE;
- }
- return SUCCESS;
-}
-
-static void php3_config_ini_shutdown(INLINE_TLS_VOID)
-{
-#if USE_SAPI
- php3_shutdown_config();
-#else
- if (GLOBAL(module_initialized) & INIT_CONFIG) {
- php3_shutdown_config();
- GLOBAL(module_initialized) &= ~INIT_CONFIG;
- }
-#endif
-}
-
-int php3_module_startup(CLS_D ELS_DC)
-{
- zend_utility_functions zuf;
- zend_utility_values zuv;
- int module_number=0; /* for REGISTER_INI_ENTRIES() */
-
-#if (WIN32|WINNT) && !(USE_SAPI)
- WORD wVersionRequested;
- WSADATA wsaData;
-
- wVersionRequested = MAKEWORD(2, 0);
-#else
- if (GLOBAL(module_initialized)) {
- return SUCCESS;
- }
-#endif
-
- zend_output_startup();
-
- zuf.error_function = php3_error;
- zuf.printf_function = php3_printf;
- zuf.write_function = zend_body_write;
- zuf.fopen_function = php_fopen_wrapper_for_zend;
- zuf.message_handler = php_message_handler_for_zend;
- zuf.block_interruptions = BLOCK_INTERRUPTIONS;
- zuf.unblock_interruptions = UNBLOCK_INTERRUPTIONS;
-
- zend_startup(&zuf, NULL);
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
- EG(error_reporting) = E_ALL;
-
-#if (WIN32|WINNT) && !(USE_SAPI)
- /* start up winsock services */
- if (WSAStartup(wVersionRequested, &wsaData) != 0) {
- php3_printf("\nwinsock.dll unusable. %d\n", WSAGetLastError());
- return FAILURE;
- }
- GLOBAL(module_initialized) |= INIT_WINSOCK;
-#endif
-
- SET_MUTEX(gLock);
- le_index_ptr = _register_list_destructors(NULL, NULL, 0);
- FREE_MUTEX(gLock);
-
- if (php3_config_ini_startup(ELS_C) == FAILURE) {
- return FAILURE;
- }
-
- php_ini_mstartup();
- REGISTER_INI_ENTRIES();
-
- zuv.short_tags = (unsigned char) PG(short_tags);
- zuv.asp_tags = (unsigned char) PG(asp_tags);
- zend_set_utility_values(&zuv);
-
- if (module_startup_modules() == FAILURE) {
- php3_printf("Unable to start modules\n");
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-
-void php3_module_shutdown_for_exec(void)
-{
- /* used to close fd's in the range 3.255 here, but it's problematic */
-}
-
-void php3_module_shutdown()
-{
- int module_number=0; /* for UNREGISTER_INI_ENTRIES() */
- CLS_FETCH();
- ELS_FETCH();
-
-#if !USE_SAPI
- /* close down the ini config */
- php3_config_ini_shutdown(_INLINE_TLS_VOID);
-#endif
-
-#if (WIN32|WINNT) && !(USE_SAPI)
- /*close winsock */
- if (GLOBAL(module_initialized) & INIT_WINSOCK) {
- WSACleanup();
- GLOBAL(module_initialized) &= ~INIT_WINSOCK;
- }
-#endif
-
- if (GLOBAL(module_initialized)) {
- php3_error(E_WARNING, "Unknown resource in module shutdown");
- }
-#if CGI_BINARY
- fflush(stdout);
-#endif
-#if 0 /* SAPI */
- GLOBAL(sapi_rqst)->flush(GLOBAL(sapi_rqst)->scid);
-#endif
-
- zend_shutdown();
- UNREGISTER_INI_ENTRIES();
- php_ini_mshutdown();
- shutdown_memory_manager(0, 1);
-}
-
-
-/* in 3.1 some of this should move into sapi */
-int _php3_hash_environment(void)
-{
- char **env, *p, *t;
- unsigned char _gpc_flags[3] = {0,0,0};
- pval *tmp;
- ELS_FETCH();
-
- p = PG(gpc_order);
- while(*p) {
- switch(*p++) {
- case 'p':
- case 'P':
- if (!_gpc_flags[0] && php3_headers_unsent() && GLOBAL(request_info).request_method && !strcasecmp(GLOBAL(request_info).request_method, "post")) {
- php3_treat_data(PARSE_POST, NULL); /* POST Data */
- _gpc_flags[0]=1;
- }
- break;
- case 'c':
- case 'C':
- if (!_gpc_flags[1]) {
- php3_treat_data(PARSE_COOKIE, NULL); /* Cookie Data */
- _gpc_flags[1]=1;
- }
- break;
- case 'g':
- case 'G':
- if (!_gpc_flags[2]) {
- php3_treat_data(PARSE_GET, NULL); /* GET Data */
- _gpc_flags[2]=1;
- }
- break;
- }
- }
-
-
- for (env = environ; env != NULL && *env != NULL; env++) {
- p = strchr(*env, '=');
- if (!p) { /* malformed entry? */
- continue;
- }
- t = estrndup(*env, p - *env);
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = strlen(p + 1);
- tmp->value.str.val = estrndup(p + 1, tmp->value.str.len);
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
- /* environmental variables never take precedence over get/post/cookie variables */
- _php3_hash_add(&EG(symbol_table), t, p - *env + 1, &tmp, sizeof(pval *), NULL);
- efree(t);
- }
-
-#if APACHE
- {
- pval **tmp_ptr;
- register int i;
- array_header *arr = table_elts(GLOBAL(php3_rqst)->subprocess_env);
- table_entry *elts = (table_entry *) arr->elts;
- int len;
-
- for (i = 0; i < arr->nelts; i++) {
- len = strlen(elts[i].key);
- t = elts[i].key;
- tmp = (pval *) emalloc(sizeof(pval));
- if (elts[i].val) {
- tmp->value.str.len = strlen(elts[i].val);
- tmp->value.str.val = estrndup(elts[i].val, tmp->value.str.len);
- } else {
- tmp->value.str.len = 0;
- tmp->value.str.val = empty_string;
- }
- tmp->refcount=1;
- tmp->is_ref=0;
- tmp->type = IS_STRING;
- _php3_hash_update(&EG(symbol_table), t, strlen(t)+1, &tmp, sizeof(pval *), NULL);
- }
- /* insert special variables */
- if (_php3_hash_find(&EG(symbol_table), "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &tmp_ptr) == SUCCESS) {
- (*tmp_ptr)->refcount++;
- _php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), tmp_ptr, sizeof(pval *), NULL);
- }
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = strlen(GLOBAL(php3_rqst)->uri);
- tmp->value.str.val = estrndup(GLOBAL(php3_rqst)->uri, tmp->value.str.len);
- tmp->refcount=1;
- tmp->is_ref=0;
- tmp->type = IS_STRING;
- _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) &tmp, sizeof(pval *), NULL);
- }
-#else
-#if FHTTPD
- {
- int i, j;
- if (req) {
- for (i = 0; i < req->nlines; i++) {
- if (req->lines[i].paramc > 1 && req->lines[i].params[0] && req->lines[i].params[1]) {
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = strlen(req->lines[i].params[1]);
- tmp->value.str.val = estrndup(req->lines[i].params[1], tmp->value.str.len);
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
- _php3_hash_update(&EG(symbol_table), req->lines[i].params[0],
- strlen(req->lines[i].params[0]) + 1, &tmp,
- sizeof(pval *), NULL);
- }
- }
- if (req->script_name_resolved) {
- i = strlen(req->script_name_resolved);
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = i;
- tmp->value.str.val = estrndup(req->script_name_resolved, i);
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
- _php3_hash_update(&EG(symbol_table), "PATH_TRANSLATED",
- sizeof("PATH_TRANSLATED"),
- &tmp, sizeof(pval *), NULL);
- if (req->script_name) {
- j = i - strlen(req->script_name);
- if (j > 0
- && !strcmp(req->script_name_resolved + j,
- req->script_name)) {
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.len = j;
- tmp->value.str.val = estrndup(req->script_name_resolved, j);
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
- _php3_hash_update(&EG(symbol_table), "DOCUMENT_ROOT",
- sizeof("DOCUMENT_ROOT"),
- &tmp, sizeof(pval *), NULL);
- }
- }
- }
- }
- }
-#endif
- {
- /* Build the special-case PHP_SELF variable for the CGI version */
- char *pi;
-#if FORCE_CGI_REDIRECT
- pi = GLOBAL(request_info).path_info;
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.val = emalloc(((pi)?strlen(pi):0) + 1);
- tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s", (pi ? pi : "")); /* SAFE */
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
-#else
- int l = 0;
- char *sn;
- sn = GLOBAL(request_info).script_name;
- pi = GLOBAL(request_info).path_info;
- if (sn)
- l += strlen(sn);
- if (pi)
- l += strlen(pi);
- if (pi && sn && !strcmp(pi, sn)) {
- l -= strlen(pi);
- pi = NULL;
- }
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.str.val = emalloc(l + 1);
- tmp->value.str.len = _php3_sprintf(tmp->value.str.val, "%s%s", (sn ? sn : ""), (pi ? pi : "")); /* SAFE */
- tmp->type = IS_STRING;
- tmp->refcount=1;
- tmp->is_ref=0;
-#endif
- _php3_hash_update(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void *) & tmp, sizeof(pval *), NULL);
- }
-#endif
-
-
- /* need argc/argv support as well */
- _php3_build_argv(GLOBAL(request_info).query_string ELS_CC);
-
- GLOBAL(initialized) |= INIT_ENVIRONMENT;
-
- return SUCCESS;
-}
-
-void _php3_build_argv(char *s ELS_DC)
-{
- pval *arr, *tmp;
- int count = 0;
- char *ss, *space;
-
- arr = (pval *) emalloc(sizeof(pval));
- arr->value.ht = (HashTable *) emalloc(sizeof(HashTable));
- if (_php3_hash_init(arr->value.ht, 0, NULL, PVAL_PTR_DTOR, 0) == FAILURE) {
- php3_error(E_WARNING, "Unable to create argv array");
- } else {
- arr->type = IS_ARRAY;
- arr->refcount=1;
- arr->is_ref=0;
- _php3_hash_update(&EG(symbol_table), "argv", sizeof("argv"), &arr, sizeof(pval *), NULL);
- }
- /* now pick out individual entries */
- ss = s;
- while (ss) {
- space = strchr(ss, '+');
- if (space) {
- *space = '\0';
- }
- /* auto-type */
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(ss);
- tmp->value.str.val = estrndup(ss, tmp->value.str.len);
- tmp->refcount=1;
- tmp->is_ref=0;
- count++;
- if (_php3_hash_next_index_insert(arr->value.ht, &tmp, sizeof(pval *), NULL)==FAILURE) {
- if (tmp->type == IS_STRING) {
- efree(tmp->value.str.val);
- }
- }
- if (space) {
- *space = '+';
- ss = space + 1;
- } else {
- ss = space;
- }
- }
- tmp = (pval *) emalloc(sizeof(pval));
- tmp->value.lval = count;
- tmp->type = IS_LONG;
- tmp->refcount=1;
- tmp->is_ref=0;
- _php3_hash_add(&EG(symbol_table), "argc", sizeof("argc"), &tmp, sizeof(pval *), NULL);
-}
-
-
-#include "logos.h"
-
-static void php3_parse(zend_file_handle *primary_file CLS_DC ELS_DC)
-{
- zend_file_handle *prepend_file_p, *append_file_p;
- zend_file_handle prepend_file, append_file;
-
- if (request_info.query_string && request_info.query_string[0]=='=') {
- if (!strcmp(request_info.query_string+1, "PHPE9568F34-D428-11d2-A769-00AA001ACF42")) {
- char *header_line = estrndup("Content-type: image/gif", sizeof("Content-type: image/gif")-1);
-
- php4i_add_header_information(header_line);
- PHPWRITE(php4_logo, sizeof(php4_logo));
- efree(header_line);
- return;
- } else if (!strcmp(request_info.query_string+1, "PHPE9568F35-D428-11d2-A769-00AA001ACF42")) {
- char *header_line = estrndup("Content-type: image/gif", sizeof("Content-type: image/gif")-1);
-
- php4i_add_header_information(header_line);
- PHPWRITE(zendtech_logo, sizeof(zendtech_logo));
- efree(header_line);
- return;
- }
- }
-
- if (setjmp(EG(bailout))!=0) {
- return;
- }
- _php3_hash_environment();
-
-#if WIN32||WINNT
- UpdateIniFromRegistry(primary_file->filename);
-#endif
-
- if (PG(auto_prepend_file) && PG(auto_prepend_file)[0]) {
- prepend_file.filename = PG(auto_prepend_file);
- prepend_file.type = ZEND_HANDLE_FILENAME;
- prepend_file_p = &prepend_file;
- } else {
- prepend_file_p = NULL;
- }
- if (PG(auto_append_file) && PG(auto_append_file)[0]) {
- append_file.filename = PG(auto_append_file);
- append_file.type = ZEND_HANDLE_FILENAME;
- append_file_p = &append_file;
- } else {
- append_file_p = NULL;
- }
- EG(main_op_array) = zend_compile_files(0 CLS_CC, 3, prepend_file_p, primary_file, append_file_p);
- if (EG(main_op_array)) {
- EG(active_op_array) = EG(main_op_array);
- zend_execute(EG(main_op_array) ELS_CC);
- }
-}
-
-
-
-#if CGI_BINARY
-
-static void _php3_usage(char *argv0)
-{
- char *prog;
-
- prog = strrchr(argv0, '/');
- if (prog) {
- prog++;
- } else {
- prog = "php";
- }
-
- php3_printf("Usage: %s [-q] [-h]"
- " [-s]"
- " [-v] [-i] [-f <file>] | "
- "{<file> [args...]}\n"
- " -q Quiet-mode. Suppress HTTP Header output.\n"
- " -s Display colour syntax highlighted source.\n"
- " -f<file> Parse <file>. Implies `-q'\n"
- " -v Version number\n"
- " -c<path> Look for php3.ini file in this directory\n"
-#if SUPPORT_INTERACTIVE
- " -a Run interactively\n"
-#endif
- " -e Generate extended information for debugger/profiler\n"
- " -i PHP information\n"
- " -h This help\n", prog);
-}
-
-/* some systems are missing these from their header files */
-extern char *optarg;
-extern int optind;
-
-#if THREAD_SAFE
-extern flex_globals *yy_init_tls(void);
-extern void yy_destroy_tls(void);
-#endif
-
-int main(int argc, char *argv[])
-{
- int cgi = 0, c, i, len;
- zend_file_handle file_handle;
- char *s;
-/* temporary locals */
- char *_cgi_filename=NULL;
- int _cgi_started=0;
- int behavior=PHP_MODE_STANDARD;
-#if SUPPORT_INTERACTIVE
- int interactive=0;
-#endif
-/* end of temporary locals */
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
-#endif
-
-
- if (setjmp(EG(bailout))!=0) {
- return -1;
- }
-
-#ifdef ZTS
- sapi_startup(1,1,0);
- compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals));
- executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals));
-
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
-#endif
-
-
-#if WIN32|WINNT
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */
- setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
-#endif
-
-
- /* Make sure we detect we are a cgi - a bit redundancy here,
- but the default case is that we have to check only the first one. */
- if (getenv("SERVER_SOFTWARE")
- || getenv("SERVER_NAME")
- || getenv("GATEWAY_INTERFACE")
- || getenv("REQUEST_METHOD")) {
- cgi = 1;
- if (argc > 1)
- GLOBAL(request_info).php_argv0 = strdup(argv[1]);
- else GLOBAL(request_info).php_argv0 = NULL;
-#if FORCE_CGI_REDIRECT
- if (!getenv("REDIRECT_STATUS")) {
- PUTS("<b>Security Alert!</b> PHP CGI cannot be accessed directly.\n\
-\n\
-<P>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\
-means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\
-set. This variable is set, for example, by Apache's Action directive redirect.\n\
-<P>You may disable this restriction by recompiling the PHP binary with the\n\
---disable-force-cgi-redirect switch. If you do this and you have your PHP CGI\n\
-binary accessible somewhere in your web tree, people will be able to circumvent\n\
-.htaccess security by loading files through the PHP parser. A good way around\n\
-this is to define doc_root in your php3.ini file to something other than your\n\
-top-level DOCUMENT_ROOT. This way you can separate the part of your web space\n\n\
-which uses PHP from the normal part using .htaccess security. If you do not have\n\
-any .htaccess restrictions anywhere on your site you can leave doc_root undefined.\n\
-\n");
-
- /* remove that detailed explanation some time */
-
- return FAILURE;
- }
-#endif /* FORCE_CGI_REDIRECT */
- }
-
-
- CG(extended_info) = 0;
-
- if (!cgi) { /* never execute the arguments if you are a CGI */
- GLOBAL(request_info).php_argv0 = NULL;
- while ((c = getopt(argc, argv, "c:qvisnaeh?vf:")) != -1) {
- switch (c) {
- case 'f':
- if (!_cgi_started){
- if (php3_module_startup(CLS_C ELS_CC) == FAILURE || php3_request_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- }
- _cgi_started=1;
- _cgi_filename = estrdup(optarg);
- /* break missing intentionally */
- case 'q':
- php3_noheader();
- break;
- case 'v':
- if (!_cgi_started) {
- if (php3_module_startup(CLS_C ELS_CC) == FAILURE || php3_request_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- }
- php3_printf("%s\n", PHP_VERSION);
- exit(1);
- break;
- case 'i':
- if (!_cgi_started) {
- if (php3_module_startup(CLS_C ELS_CC) == FAILURE || php3_request_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- }
- _cgi_started=1;
- php3_TreatHeaders();
- _php3_info();
- exit(1);
- break;
- case 's':
- behavior=PHP_MODE_HIGHLIGHT;
- break;
- case 'n':
- behavior=PHP_MODE_INDENT;
- break;
- case 'c':
- GLOBAL(php3_ini_path) = strdup(optarg); /* intentional leak */
- break;
- case 'a':
-#if SUPPORT_INTERACTIVE
- printf("Interactive mode enabled\n\n");
- interactive=1;
-#else
- printf("Interactive mode not supported!\n\n");
-#endif
- break;
- case 'e':
- CG(extended_info) = 1;
- break;
- case 'h':
- case '?':
- php3_noheader();
- zend_output_startup();
- _php3_usage(argv[0]);
- exit(1);
- break;
- default:
- break;
- }
- }
- } /* not cgi */
-
-#if SUPPORT_INTERACTIVE
- EG(interactive) = interactive;
-#endif
-
- if (!_cgi_started) {
- if (php3_module_startup(CLS_C ELS_CC) == FAILURE || php3_request_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- }
- file_handle.filename = "-";
- file_handle.type = ZEND_HANDLE_FP;
- file_handle.handle.fp = stdin;
- if (_cgi_filename) {
- GLOBAL(request_info).filename = _cgi_filename;
- }
-
- php3_TreatHeaders();
-
- if (!cgi) {
- if (!GLOBAL(request_info).query_string) {
- for (i = optind, len = 0; i < argc; i++)
- len += strlen(argv[i]) + 1;
-
- s = malloc(len + 1); /* leak - but only for command line version, so ok */
- *s = '\0'; /* we are pretending it came from the environment */
- for (i = optind, len = 0; i < argc; i++) {
- strcat(s, argv[i]);
- if (i < (argc - 1))
- strcat(s, "+");
- }
- GLOBAL(request_info).query_string = s;
- }
- if (!GLOBAL(request_info).filename && argc > optind)
- GLOBAL(request_info).filename = argv[optind];
- }
- /* If for some reason the CGI interface is not setting the
- PATH_TRANSLATED correctly, request_info.filename is NULL.
- We still call php3_fopen_for_parser, because if you set doc_root
- or user_dir configuration directives, PATH_INFO is used to construct
- the filename as a side effect of php3_fopen_for_parser.
- */
- if (cgi || GLOBAL(request_info).filename) {
- file_handle.filename = GLOBAL(request_info).filename;
- file_handle.handle.fp = php3_fopen_for_parser();
- }
-
- if (cgi && !file_handle.handle.fp) {
- PUTS("No input file specified.\n");
-#if 0 /* this is here for debuging under windows */
- if (argc) {
- i = 0;
- php3_printf("\nargc %d\n",argc);
- while (i <= argc) {
- php3_printf("%s\n",argv[i]);
- i++;
- }
- }
-#endif
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- php3_module_shutdown(_INLINE_TLS_VOID);
- return FAILURE;
- } else if (file_handle.handle.fp && file_handle.handle.fp!=stdin) {
- /* #!php support */
- c = fgetc(file_handle.handle.fp);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(file_handle.handle.fp); /* skip to end of line */
- }
- CG(zend_lineno)++;
- } else {
- rewind(file_handle.handle.fp);
- }
- GLOBAL(initialized) |= INIT_SCANNER;
- /* This shouldn't be necessary - if it is - it should move to Zend
- * phprestart(GLOBAL(phpin));
- */
- }
-
- switch (behavior) {
- case PHP_MODE_STANDARD:
- php3_parse(&file_handle CLS_CC ELS_CC);
- break;
- case PHP_MODE_HIGHLIGHT: {
- zend_syntax_highlighter_ini syntax_highlighter_ini;
-
- if (open_file_for_scanning(&file_handle CLS_CC)==SUCCESS) {
- php_get_highlight_struct(&syntax_highlighter_ini);
- zend_highlight(&syntax_highlighter_ini);
- fclose(file_handle.handle.fp);
- }
- return 0;
- }
- break;
- case PHP_MODE_INDENT:
- open_file_for_scanning(&file_handle CLS_CC);
- zend_indent();
- fclose(file_handle.handle.fp);
- return 0;
- break;
- }
-
- if (GLOBAL(initialized)) {
- php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- php3_module_shutdown(_INLINE_TLS_VOID);
-#ifdef THREAD_SAFE
- yy_destroy_tls();
- tls_shutdown();
- tls_destroy();
-#endif
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-#endif /* CGI_BINARY */
-
-
-#if APACHE
-PHPAPI int apache_php3_module_main(request_rec * r, int fd, int display_source_mode)
-{
- zend_file_handle file_handle;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=&eg;
-#endif
-
- GLOBAL(php3_rqst) = r;
-
- if (php3_request_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- php3_TreatHeaders();
- file_handle.type = ZEND_HANDLE_FD;
- file_handle.handle.fd = fd;
- file_handle.filename = request_info.filename;
- GLOBAL(initialized) |= INIT_SCANNER;
- (void) php3_parse(&file_handle CLS_CC ELS_CC);
-
- if (GLOBAL(initialized)) {
- php3_header(); /* Make sure headers have been sent */
- zend_end_ob_buffering(1);
- }
- return (OK);
-}
-#endif /* APACHE */
-
-#if FHTTPD
-
-char *get_pretokenized_name(void)
-{
- char *pretokenized_name = NULL;
-
- if (GLOBAL(request_info).filename) {
- int length = strlen(GLOBAL(request_info).filename);
-
- if (length > (sizeof(".php3") - 1) && !strcmp(GLOBAL(request_info).filename + length - sizeof(".php3") + 1, ".php3")) {
- pretokenized_name = (char *) emalloc(length + 2);
- strcpy(pretokenized_name, GLOBAL(request_info).filename);
- strcat(pretokenized_name, "p");
- } else {
- length += sizeof(".php3p");
- pretokenized_name = (char *) emalloc(length + 1);
- strcpy(pretokenized_name, GLOBAL(request_info).filename);
- strcat(pretokenized_name, ".php3p");
- }
- } else {
- pretokenized_name = estrdup("stdin.php3p");
- }
- return pretokenized_name;
-}
-
-
-void _php3_usage(char *progname)
-{
- fprintf(stderr,
- "Usage: %s [options] [appname] [username] [hostname] [portname]\n"
- "Options:\n"
- " -d Daemon mode -- never attempt terminal I/O\n"
- " -s Socket mode, fhttpd internal use only\n"
- " -p Pipe mode, fhttpd internal use only\n"
- " -u<mask> Set umask\n"
- " -t<time> Idle timeout in seconds, 0 - disable\n"
- " -S Display colour syntax highlighted source\n"
- " -P Make and execute a pretokenized script\n"
- " (.php3p file) or, if pretokenized script, newer\n"
- " than original file exists, execute it instead\n"
- " -E Execute a pretokenized (.php3p) script\n"
- " -c<path> Look for php3.ini file in this directory\n"
- " (must appear before any other options)\n"
- " -v Version number\n"
- " -h This help\n",
- progname);
-}
-
-int main(int argc, char **argv)
-{
- int c, i, processing_error;
- FILE *in = NULL;
- FILE *in2;
- int preprocess_mode = PREPROCESS_NONE;
- int argc1;
- char **argv1;
- int human = 1, fd2;
- int i0 = 0, i1 = 0;
- char *pn;
- struct stat statbuf, pstatbuf;
-#ifdef ZTS
- zend_compiler_globals cg;
- zend_executor_globals eg;
- zend_compiler_globals *compiler_globals=&cg;
- zend_executor_globals *executor_globals=&eg;
-#endif
-
-#ifdef THREAD_SAFE
- php3_globals_struct *php3_globals;
- flex_globals *php_flex_gbl;
- tls_startup();
- tls_create();
- php_flex_gbl = yy_init_tls();
- php3_globals = TlsGetValue(TlsIndex);
-
- if ((php3_globals == 0) && (GetLastError() != 0)) {
- PUTS("TlsGetValue error\n");
- return FAILURE;
- }
-#endif
-
-#if HAVE_SETLOCALE
- setlocale(LC_CTYPE, "");
-#endif
-
- if (php3_module_startup(CLS_C ELS_CC) == FAILURE) {
- return FAILURE;
- }
- signal(SIGPIPE, SIG_IGN);
- umask(077);
-
- while ((c = getopt(argc, argv, "spdu:t:c:PESvh")) != -1) {
- switch (c) {
- case 'd':
- human = 0;
- break;
- case 's':
- i0 = 1;
- break;
- case 'p':
- i1 = 1;
- break;
- case 'u':
- if (*optarg == '0')
- umask(strtoul(optarg, NULL, 8));
- else
- umask(strtoul(optarg, NULL, 10));
- break;
- case 't':
- idle_timeout = atoi(optarg);
- break;
- case 'c':
- GLOBAL(php3_ini_path) = strdup(optarg); /* intentional leak */
- break;
- case 'P': /* preprocess */
- preprocess_mode = PREPROCESS_PREPROCESS;
- break;
- case 'E': /* execute preprocessed script */
- preprocess_mode = PREPROCESS_EXECUTE;
- break;
- case 'S':
- printf ("Not implemented yet\n");
- break;
- case 'v':
- printf("%s\n", PHP_VERSION);
- exit(1);
- break;
- case 'h':
- case ':':
- case '?':
- _php3_usage(argv[0]);
- return -1;
- }
- }
-
- argc1 = argc - optind;
- argv1 = (char **) malloc(sizeof(char *) * (argc1 + 2));
- if (!argv1)
- return -1;
- argv1 += 2;
- for (i = optind; i < argc; i++)
- argv1[i - optind] = argv[i];
-
- if (i0) {
- argv1--;
- *argv1 = "-s";
- argc1++;
- } else {
- if (i1) {
- argv1--;
- *argv1 = "-p";
- argc1++;
- }
- }
- argv1--;
- argc1++;
- *argv1 = *argv;
-
- server = createserver();
- if (!server)
- return -1;
-
- switch (servproc_init(server, human, argc1, argv1)) {
- case 0:
- break;
- case APP_ERR_HUMAN:
- _php3_usage(argv[0]);
- exit(1);
- break;
- case APP_ERR_CONFIG:
- fprintf(stderr, "%s: configuration error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_READ:
- fprintf(stderr, "%s: read error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_HOSTNAME:
- fprintf(stderr, "%s: can't resolve server hostname\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_SOCKET:
- fprintf(stderr, "%s: can't create socket\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_CONNECT:
- fprintf(stderr, "%s: can't connect\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_APPCONNECT:
- fprintf(stderr, "%s: connect error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_USER:
- fprintf(stderr, "%s: login error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_PASSWORD:
- fprintf(stderr, "%s: login error\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_APPLICATION:
- fprintf(stderr, "%s: application rejected by server\n", server->app_progname);
- exit(1);
- break;
- case APP_ERR_INSANE:
- case APP_ERR_DAEMON:
- case APP_ERR_AUTH:
- default:
- if (server->infd < 0)
- exit(1);
- }
-
- if (server->infd == 0 && server->outfd == 1) {
- close(2);
- fd2 = open("/dev/null", O_WRONLY);
- if (fd2 != 2) {
- dup2(fd2, 2);
- close(fd2);
- }
- }
- setcapabilities(server, APP_CAP_KEEPALIVE);
-
- exit_status = 0;
- while (!exit_status) {
- processing_error = 0;
- if (php3_request_startup(_INLINE_TLS_VOID) == FAILURE) {
- processing_error = 1;
- }
- if (!processing_error) {
- GLOBAL(phpin) = NULL;
- GLOBAL(current_lineno) = 0;
-
- php3_TreatHeaders();
-
- in = php3_fopen_for_parser();
-
- GLOBAL(php3_preprocess) = preprocess_mode;
-
- if (!in) {
- PUTS("No input file specified.\n");
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- processing_error = 1;
- } else {
- if (GLOBAL(php3_preprocess) == PREPROCESS_PREPROCESS) {
- pn = get_pretokenized_name();
- if (pn) {
- if (!stat(pn, &pstatbuf)
- && !fstat(fileno(in), &statbuf)
- && S_ISREG(pstatbuf.st_mode)
- && statbuf.st_mtime < pstatbuf.st_mtime) {
- in2 = fopen(pn, "r");
- if (in2) {
- fclose(in);
- in = in2;
- GLOBAL(php3_preprocess) = PREPROCESS_EXECUTE;
- }
- }
- efree(pn);
- }
- }
- if (GLOBAL(php3_preprocess) != PREPROCESS_EXECUTE) {
- /* #!php support */
- c = fgetc(in);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(in); /* skip to end of line */
- }
- CG(phplineno)++;
- } else {
- rewind(in);
- }
- }
- GLOBAL(phpin) = in;
- GLOBAL(initialized) |= INIT_SCANNER;
- phprestart(GLOBAL(phpin));
-
- if (!processing_error) {
- if (GLOBAL(php3_preprocess) == PREPROCESS_EXECUTE) {
- if (tcm_load(&GLOBAL(token_cache_manager), GLOBAL(phpin))==FAILURE) {
- /* should bail out on an error, don't know how to do it in fhttpd */
- }
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- if (GLOBAL(php3_preprocess)!=PREPROCESS_NONE) {
- pval yylval;
-
- while (phplex(&yylval)); /* create the token cache */
- tcm_save(&GLOBAL(token_cache_manager));
- seek_token(&GLOBAL(token_cache_manager), 0, NULL);
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- php3_parse(GLOBAL(phpin) CLS_CC ELS_CC);
-
- }
- }
- }
- if (GLOBAL(initialized)) {
- php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) 0 _INLINE_TLS);
- }
- }
- php3_module_shutdown(_INLINE_TLS_VOID);
-#ifdef THREAD_SAFE
- if (GLOBAL(initialized)) {
- yy_destroy_tls();
- tls_shutdown();
- tls_destroy();
- }
-#endif
- return 0;
-}
-#endif /* FHTTPD */
-
-#if USE_SAPI
-
-PHPAPI int php3_sapi_main(struct sapi_request_info *sapi_info)
-{
-#if DEBUG
- char logmessage[1024];
-#endif
- FILE *in = NULL;
- int c;
- YY_TLS_VARS;
- TLS_VARS;
-
- GLOBAL(php3_preprocess) = sapi_info->preprocess;
- GLOBAL(php3_display_source) = sapi_info->display_source_mode;
- GLOBAL(sapi_rqst) = sapi_info;
-
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: entry\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
-
-/* if (php3_module_startup(php3_globals) == FAILURE) {
- return FAILURE;
- }*/
-
- if (php3_request_startup(CLS_C ELS_CC) == FAILURE) {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: request starup failed\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- if (sapi_info->preprocess == PREPROCESS_PREPROCESS || sapi_info->quiet_mode) {
- php3_noheader();
- }
- if (sapi_info->info_only) {
- _php3_info();
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: info_only\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return (1);
- }
- /* if its not cgi, require that we have a filename now */
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: File: %s\n",GLOBAL(sapi_rqst)->scid,GLOBAL(sapi_rqst)->filename);
- OutputDebugString(logmessage);
-#endif
- if (!sapi_info->cgi && !sapi_info->filename) {
- php3_printf("No input file specified.\n");
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: No input file specified\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- /*
- if request_info.filename is null and cgi, fopen_for_parser is responsible
- request_info.filename will only be estrduped in fopen_for parser
- if it is null at this point
- */
- in = php3_fopen_for_parser();
-
- if (sapi_info->cgi && !in) {
- php3_printf("No input file specified for cgi.\n");
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: No input file specified for cgi.\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
- if (sapi_info->cgi && in) {
- /* #!php support */
- c = fgetc(in);
- if (c == '#') {
- while (c != 10 && c != 13) {
- c = fgetc(in); /* skip to end of line */
- }
- } else {
- rewind(in);
- }
- }
- if (in) {
- GLOBAL(phpin) = in;
- phprestart(GLOBAL(phpin));
- GLOBAL(initialized) |= INIT_SCANNER;
- }
- if (sapi_info->display_source_mode) {
- GLOBAL(php3_display_source) = 1;
- PUTS("<html><head><title>Source for ");
- PUTS(sapi_info->filename);
- PUTS("</title></head><body bgcolor=\"");
- PUTS(php3_ini.highlight_bg);
- PUTS("\" text=\"");
- PUTS(php3_ini.highlight_html);
- PUTS("\">\n"); /* color: seashell */
- }
- if (sapi_info->display_source_mode && sapi_info->preprocess == PREPROCESS_PREPROCESS) {
- php3_printf("Can't preprocess while displaying source.<br>\n");
- return FAILURE;
- }
- if (sapi_info->preprocess == PREPROCESS_EXECUTE) {
- tcm_load(&GLOBAL(token_cache_manager));
- GLOBAL(php3_preprocess) = PREPROCESS_NONE;
- }
- if (sapi_info->preprocess==PREPROCESS_NONE) {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: start php3_parse() file:%s\n",GLOBAL(sapi_rqst)->scid,GLOBAL(sapi_rqst)->filename);
- OutputDebugString(logmessage);
-#endif
- php3_parse(GLOBAL(phpin) _INLINE_TLS);
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: done php3_parse()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- } else {
- pval yylval;
-
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: entering phplex()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
-#ifdef THREAD_SAFE
- while (phplex(&yylval, php3_globals, php_gbl)); /* create the token cache */
-#else
- while (phplex(&yylval)); /* create the token cache */
-#endif
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: done phplex()\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- tcm_save(&GLOBAL(token_cache_manager));
- }
-
- if (sapi_info->display_source_mode) {
- php3_printf("\n</html>\n");
- }
- if (GLOBAL(initialized)) {
- php3_header(); /* Make sure headers have been sent */
- php3_request_shutdown((void *) GLOBAL(sapi_rqst), php3_globals);
- /*php3_module_shutdown(php3_globals);*/
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: success!\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return SUCCESS;
- } else {
-#if DEBUG
- snprintf(logmessage,1024,"%d:php3_sapi_main: request not initialized!\n",GLOBAL(sapi_rqst)->scid);
- OutputDebugString(logmessage);
-#endif
- return FAILURE;
- }
-}
-#if WIN32|WINNT
-extern int tls_create(void);
-extern int tls_destroy(void);
-extern int tls_startup(void);
-extern int tls_shutdown(void);
-extern flex_globals *yy_init_tls(void);
-extern void yy_destroy_tls(void);
-extern VOID ErrorExit(LPTSTR lpszMessage);
-
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- php3_globals_struct *php3_globals;
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Entry\n");
-#endif
- switch (ul_reason_for_call) {
- case DLL_PROCESS_ATTACH:
- /*
- I should be loading ini vars here
- and doing whatever true global inits
- need to be done
- */
- _fmode = _O_BINARY; /*sets default for file streams to binary */
- /* make the stdio mode be binary */
- setmode(_fileno(stdin), O_BINARY);
- setmode(_fileno(stdout), O_BINARY);
- setmode(_fileno(stderr), O_BINARY);
- setlocale(LC_CTYPE, "");
-
- CREATE_MUTEX(gLock, "GENERAL");
-
- if (!tls_startup())
- return 0;
- if (!tls_create())
- return 0;
- php3_globals = TlsGetValue(TlsIndex);
- yy_init_tls();
- if (php3_config_ini_startup(_INLINE_TLS_VOID) == FAILURE) {
- return 0;
- }
- if (php3_module_startup(php3_globals) == FAILURE) {
- ErrorExit("module startup failed");
- return 0;
- }
-
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Process Attached\n");
-#endif
- break;
- case DLL_THREAD_ATTACH:
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Thread Attach\n");
-#endif
- if (!tls_create())
- return 0;
- php3_globals = TlsGetValue(TlsIndex);
- yy_init_tls();
- if (php3_module_startup(php3_globals) == FAILURE) {
- ErrorExit("module startup failed");
-#if DEBUG
- OutputDebugString("PHP_Core DllMain module startup failed\n");
-#endif
- return 0;
- }
- break;
- case DLL_THREAD_DETACH:
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Detache\n");
-#endif
- php3_globals = TlsGetValue(TlsIndex);
- php3_module_shutdown(php3_globals);
- if (!tls_destroy())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Detache Error tls_destroy\n");
-#endif
- return 0;
- yy_destroy_tls();
- break;
- case DLL_PROCESS_DETACH:
- /*
- close down anything down in process_attach
- */
- php3_globals = TlsGetValue(TlsIndex);
- php3_module_shutdown(php3_globals);
-
- php3_config_ini_shutdown(_INLINE_TLS_VOID);
-
- if (!tls_destroy())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain tls_destroy failed\n");
-#endif
- return 0;
- if (!tls_shutdown())
-#if DEBUG
- OutputDebugString("PHP_Core DllMain tls_shutdown failed\n");
-#endif
- return 0;
- yy_destroy_tls();
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Process Detatched\n");
-#endif
- break;
- }
-#if DEBUG
- OutputDebugString("PHP_Core DllMain Successful Exit\n");
-#endif
- return 1;
-}
-
-#endif
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php.h b/main/php.h
deleted file mode 100644
index b087058d15..0000000000
--- a/main/php.h
+++ /dev/null
@@ -1,521 +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 <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#ifndef _PHP_H
-#define _PHP_H
-
-#define YYDEBUG 0
-
-#define CGI_BINARY (!APACHE && !USE_SAPI && !FHTTPD)
-
-#include "php_version.h"
-#include "zend.h"
-#ifdef PACKAGE
-# undef PACKAGE
-#endif
-#ifdef VERSION
-# undef VERSION
-#endif
-#include "zend_API.h"
-
-
-extern unsigned char first_arg_force_ref[];
-extern unsigned char first_arg_allow_ref[];
-extern unsigned char second_arg_force_ref[];
-extern unsigned char second_arg_allow_ref[];
-
-
-/* somebody stealing BOOL from windows. pick something else!
-#ifndef BOOL
-#define BOOL MYBOOL
-#endif
-*/
-
-
-#if MSVC5
-#include "config.w32.h"
-#include "win95nt.h"
-# if defined(COMPILE_DL)
-# define PHPAPI __declspec(dllimport)
-# else
-# define PHPAPI __declspec(dllexport)
-# endif
-#else
-# include "config.h"
-# define PHPAPI
-# define THREAD_LS
-#endif
-
-
-/* PHP's DEBUG value must match Zend's ZEND_DEBUG value */
-#undef DEBUG
-#define DEBUG ZEND_DEBUG
-
-
-#if DEBUG || !(defined(__GNUC__)||defined(WIN32))
-#ifdef inline
-#undef inline
-#endif
-#define inline
-#endif
-
-
-#if HAVE_UNIX_H
-#include <unix.h>
-#endif
-
-#if HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#include "request_info.h"
-
-#if HAVE_LIBDL
-# if MSVC5
-# include <windows.h>
-# define dlclose FreeLibrary
-# define dlopen(a,b) LoadLibrary(a)
-# define dlsym GetProcAddress
-# else
-#if HAVE_DLFCN_H && !(defined(_AIX) && APACHE)
-# include <dlfcn.h>
-#endif
-# endif
-#endif
-
-/*Thread Safety*/
-#if THREAD_SAFE
-#define GLOBAL(a) php3_globals->a
-#define STATIC GLOBAL
-#define TLS_VARS \
- php3_globals_struct *php3_globals; \
- php3_globals = TlsGetValue(TlsIndex);
-#define CREATE_MUTEX(a,b) a = CreateMutex (NULL, FALSE, b);
-#define SET_MUTEX(a) WaitForSingleObject( a, INFINITE );
-#define FREE_MUTEX(a) ReleaseMutex(a);
-
-/*redirect variables to the flex structure*/
-#if !defined(YY_BUFFER_NEW) && !defined(COMPILE_DL)
-#include "FlexSafe.h"
-#endif
-
-#define INLINE_TLS ,struct php3_global_struct *php3_globals
-#define INLINE_TLS_VOID struct php3_global_struct *php3_globals
-#define _INLINE_TLS ,php3_globals
-#define _INLINE_TLS_VOID php3_globals
-
-#else
-#define GLOBAL(a) a
-#define STATIC GLOBAL
-#define TLS_VARS
-#define CREATE_MUTEX(a,b)
-#define SET_MUTEX(a)
-#define FREE_MUTEX(a)
-
-/* needed in control structures */
-#define INLINE_TLS
-#define INLINE_TLS_VOID void
-#define _INLINE_TLS
-#define _INLINE_TLS_VOID
-
-#endif
-
-/*
- * Then the ODBC support can use both iodbc and Solid,
- * uncomment this.
- * #define HAVE_ODBC (HAVE_IODBC|HAVE_SOLID)
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#else
-# if HAVE_SYS_VARARGS_H
-# include <sys/varargs.h>
-# endif
-#endif
-
-
-#include "zend_hash.h"
-#include "php3_compat.h"
-#include "zend_alloc.h"
-#include "zend_stack.h"
-
-typedef zval pval;
-
-#define pval_copy_constructor zval_copy_ctor
-#define pval_destructor zval_dtor
-
-#if REGEX
-#include "regex/regex.h"
-#define _REGEX_H 1 /* this should stop Apache from loading the system version of regex.h */
-#define _RX_H 1 /* Try defining these for Linux to */
-#define __REGEXP_LIBRARY_H__ 1 /* avoid Apache including regex.h */
-#define _H_REGEX 1 /* This one is for AIX */
-#else
-#include <regex.h>
-#endif
-
-#if STDC_HEADERS
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy((s), (d), (n))
-# define memmove(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
-#include "safe_mode.h"
-
-#ifndef HAVE_STRERROR
-extern char *strerror(int);
-#endif
-
-#include "fopen-wrappers.h"
-
-#if APACHE /* apache httpd */
-# if HAVE_AP_CONFIG_H
-#include "ap_config.h"
-# endif
-# if HAVE_OLD_COMPAT_H
-#include "compat.h"
-# endif
-# if HAVE_AP_COMPAT_H
-#include "ap_compat.h"
-# endif
-#include "httpd.h"
-#include "http_main.h"
-#include "http_core.h"
-#include "http_request.h"
-#include "http_protocol.h"
-#include "http_config.h"
-#include "http_log.h"
-#define BLOCK_INTERRUPTIONS block_alarms
-#define UNBLOCK_INTERRUPTIONS unblock_alarms
-# ifndef THREAD_SAFE
-extern request_rec *php3_rqst;
-# endif
-#endif
-
-#if HAVE_PWD_H
-# if MSVC5
-#include "win32/pwd.h"
-#include "win32/param.h"
-# else
-#include <pwd.h>
-#include <sys/param.h>
-# endif
-#endif
-#if CGI_BINARY /* CGI version */
-#define BLOCK_INTERRUPTIONS NULL
-#define UNBLOCK_INTERRUPTIONS NULL
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#ifndef LONG_MAX
-#define LONG_MAX 2147483647L
-#endif
-
-#ifndef LONG_MIN
-#define LONG_MIN (- LONG_MAX - 1)
-#endif
-
-#if FHTTPD /* fhttpd */
-#define BLOCK_INTERRUPTIONS NULL
-#define UNBLOCK_INTERRUPTIONS NULL
-#endif
-
-#if (!HAVE_SNPRINTF)
-#define snprintf ap_snprintf
-#define vsnprintf ap_vsnprintf
-extern int ap_snprintf(char *, size_t, const char *, ...);
-extern int ap_vsnprintf(char *, size_t, const char *, va_list);
-#endif
-
-#define EXEC_INPUT_BUF 4096
-
-
-#if FHTTPD
-
-#include <servproc.h>
-
-#ifndef IDLE_TIMEOUT
-#define IDLE_TIMEOUT 120
-#endif
-#ifndef SIGACTARGS
-#define SIGACTARGS int n
-#endif
-
-extern struct http_server *server;
-extern struct request *req;
-extern struct httpresponse *response;
-extern int global_alarmflag;
-extern int idle_timeout;
-extern int exit_status;
-extern int headermade;
-extern char **currentheader;
-extern char *headerfirstline;
-extern int headerlines;
-
-void alarmhandler(SIGACTARGS);
-void setalarm(int t);
-int checkinput(int h);
-
-extern PHPAPI void php3_fhttpd_free_header(void);
-extern PHPAPI void php3_fhttpd_puts_header(char *s);
-extern PHPAPI void php3_fhttpd_puts(char *s);
-extern PHPAPI void php3_fhttpd_putc(char c);
-extern PHPAPI int php3_fhttpd_write(char *a,int n);
-# if !defined(COMPILE_DL)
-# define PUTS(s) php3_fhttpd_puts(s)
-# define PUTC(c) php3_fhttpd_putc(c)
-# define PHPWRITE(a,n) php3_fhttpd_write((a),(n))
-# endif
-#endif
-
-
-
-#define DONT_FREE 0
-#define DO_FREE 1
-
-#define PHP3_MIME_TYPE "application/x-httpd-php3"
-
-/* macros */
-#undef MIN
-#undef MAX
-#undef COPY_STRING
-#define DO_OR_DIE(retvalue) if (retvalue==FAILURE) { return FAILURE; }
-#define MAX(a,b) (((a)>(b))?(a):(b))
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); }
-#define COPY_STRING(yy) (yy).value.str.val = (char *) estrndup((yy).value.str.val,(yy).value.str.len)
-
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 256 /* Should be safe for any weird systems that do not define it */
-#endif
-
-#define PHP_NAMED_FUNCTION(name) void name(INTERNAL_FUNCTION_PARAMETERS)
-#define PHP_FUNCTION(name) PHP_NAMED_FUNCTION(php3_##name)
-
-#define PHP_NAMED_FE(php_name, name, arg_types) { #php_name, name, arg_types },
-#define PHP_FE(name, arg_types) PHP_NAMED_FE(name, php3_##name, arg_types)
-#define PHP_FALIAS(name, alias, arg_types) PHP_NAMED_FE(name, php3_##alias, arg_types)
-
-
-
-
-
-/* global variables */
-#ifndef THREAD_SAFE
-extern pval *data;
-#if (!PHP_ISAPI)
-extern char **environ;
-#endif
-#endif
-extern PHPAPI int le_index_ptr; /* list entry type for index pointers */
-
-extern void phperror(char *error);
-extern PHPAPI void php3_error(int type, const char *format,...);
-extern PHPAPI int php3_printf(const char *format,...);
-extern void php3_log_err(char *log_message);
-extern int Debug(char *format,...);
-extern int cfgparse(void);
-
-extern void html_putc(char c);
-
-#define zenderror phperror
-#define zendlex phplex
-
-#define phpparse zendparse
-#define phprestart zendrestart
-#define phpin zendin
-
-/* functions */
-#ifndef THREAD_SAFE
-extern int end_current_file_execution(int *retval);
-#endif
-extern int _php3_hash_environment(void);
-extern int module_startup_modules(void);
-
-/* needed for modules only */
-extern PHPAPI int php3i_get_le_fp(void);
-
-/*from basic functions*/
-extern PHPAPI int _php3_error_log(int opt_err,char *message,char *opt,char *headers);
-
-PHPAPI int cfg_get_long(char *varname, long *result);
-PHPAPI int cfg_get_double(char *varname, double *result);
-PHPAPI int cfg_get_string(char *varname, char **result);
-
-
-/* Output support */
-#include "output.h"
-#define PHPWRITE(str, str_len) zend_body_write((str), (str_len))
-#define PUTS(str) zend_body_write((str), strlen((str)))
-#define PUTC(c) zend_body_write(&(c), 1), (c)
-#define PHPWRITE_H(str, str_len) zend_header_write((str), (str_len))
-#define PUTS_H(str) zend_header_write((str), strlen((str)))
-#define PUTC_H(c) zend_header_write(&(c), 1), (c)
-
-
-#include "zend_operators.h"
-#include "zend_variables.h"
-#include "zend_constants.h"
-
-#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 {var_reset(return_value);}
-#define RETVAL_TRUE RETVAL_LONG(1L)
-
-#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_NEG RETURN_LONG(-1L) */
-#define RETURN_ZERO RETURN_LONG(0L)
-#define RETURN_FALSE {var_reset(return_value); return;}
-#define RETURN_TRUE RETURN_LONG(1L)
-
-#define SET_VAR_STRING(n,v) { \
- { \
- pval var; \
- 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; \
- _php3_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
- } \
- }
-#define SET_VAR_STRINGL(n,v,l) { \
- { \
- pval var; \
- char *name=(n); \
- var.value.str.val = (v); \
- var.value.str.len = (l); \
- var.type = IS_STRING; \
- _php3_hash_update(&EG(symbol_table), name, strlen(name)+1, &var, sizeof(pval),NULL); \
- } \
- }
-#define SET_VAR_LONG(n,v) { \
- { \
- pval var; \
- var.value.lval = (v); \
- var.type = IS_LONG; \
- _php3_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
- } \
- }
-#define SET_VAR_DOUBLE(n,v) { \
- { \
- pval var; \
- var.value.dval = (v); \
- var.type = IS_DOUBLE; \
- _php3_hash_update(&EG(symbol_table)), (n), strlen((n))+1, &var, sizeof(pval),NULL); \
- } \
- }
-
-#ifndef THREAD_SAFE
-extern int yylineno;
-#endif
-extern void phprestart(FILE *input_file);
-
-
-/* Finding offsets of elements within structures.
- * Taken from the Apache code, which in turn, was taken from X code...
- */
-
-#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
-#ifdef __STDC__
-#define XtOffset(p_type,field) _Offsetof(p_type,field)
-#else
-#ifdef CRAY2
-#define XtOffset(p_type,field) \
- (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
-
-#else /* !CRAY2 */
-
-#define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
-
-#endif /* !CRAY2 */
-#endif /* __STDC__ */
-#else /* ! (CRAY || __arm) */
-
-#define XtOffset(p_type,field) \
- ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
-
-#endif /* !CRAY */
-
-#ifdef offsetof
-#define XtOffsetOf(s_type,field) offsetof(s_type,field)
-#else
-#define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
-#endif
-
-
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/php3_compat.h b/main/php3_compat.h
deleted file mode 100644
index 0fb9097330..0000000000
--- a/main/php3_compat.h
+++ /dev/null
@@ -1,83 +0,0 @@
-#ifndef _PHP3_COMPAT_H
-#define _PHP3_COMPAT_H
-
-#define _php3_hash_init zend_hash_init
-#define _php3_hash_destroy zend_hash_destroy
-
-#define _php3_hash_clean zend_hash_clean
-
-#define _php3_hash_add_or_update zend_hash_add_or_update
-#define _php3_hash_add zend_hash_add
-#define _php3_hash_update zend_hash_update
-#define _php3_hash_update_ptr zend_hash_update_ptr
-
-#define _php3_hash_quick_add_or_update zend_hash_quick_add_or_update
-#define _php3_hash_quick_add zend_hash_quick_add
-#define _php3_hash_quick_update zend_hash_quick_update
-
-#define _php3_hash_index_update_or_next_insert zend_hash_index_update_or_next_insert
-#define _php3_hash_index_update zend_hash_index_update
-#define _php3_hash_next_index_insert zend_hash_next_index_insert
-
-#define _php3_hash_pointer_update zend_hash_pointer_update
-
-#define _php3_hash_pointer_index_update_or_next_insert zend_hash_pointer_index_update_or_next_insert
-#define _php3_hash_pointer_index_update zend_hash_pointer_index_update
-#define _php3_hash_next_index_pointer_update zend_hash_next_index_pointer_update
-
-#define _php3_hash_del_key_or_index zend_hash_del_key_or_index
-#define _php3_hash_del zend_hash_del
-#define _php3_hash_index_del zend_hash_index_del
-
-#define _php3_hash_find zend_hash_find
-#define _php3_hash_quick_find zend_hash_quick_find
-#define _php3_hash_index_find zend_hash_index_find
-
-#define _php3_hash_exists zend_hash_exists
-#define _php3_hash_index_exists zend_hash_index_exists
-#define _php3_hash_is_pointer zend_hash_is_pointer
-#define _php3_hash_index_is_pointer zend_hash_index_is_pointer
-#define _php3_hash_next_free_element zend_hash_next_free_element
-
-#define _php3_hash_move_forward zend_hash_move_forward
-#define _php3_hash_move_backwards zend_hash_move_backwards
-#define _php3_hash_get_current_key zend_hash_get_current_key
-#define _php3_hash_get_current_data zend_hash_get_current_data
-#define _php3_hash_internal_pointer_reset zend_hash_internal_pointer_reset
-#define _php3_hash_internal_pointer_end zend_hash_internal_pointer_end
-
-#define _php3_hash_copy zend_hash_copy
-#define _php3_hash_merge zend_hash_merge
-#define _php3_hash_sort zend_hash_sort
-#define _php3_hash_minmax zend_hash_minmax
-
-#define _php3_hash_num_elements zend_hash_num_elements
-
-#define _php3_hash_apply zend_hash_apply
-#define _php3_hash_apply_with_argument zend_hash_apply_with_argument
-
-
-
-
-#define php3_module_entry zend_module_entry
-
-#define php3_strndup zend_strndup
-#define php3_str_tolower zend_str_tolower
-#define php3_binary_strcmp zend_binary_strcmp
-
-
-#define php3_list_insert zend_list_insert
-#define php3_list_find zend_list_find
-#define php3_list_delete zend_list_delete
-
-#define php3_plist_insert zend_plist_insert
-#define php3_plist_find zend_plist_find
-#define php3_plist_delete zend_plist_delete
-
-#define zend_print_pval zend_print_zval
-#define zend_print_pval_r zend_print_zval_r
-
-
-#define function_entry zend_function_entry
-
-#endif /* _PHP3_COMPAT_H */
diff --git a/main/php_globals.h b/main/php_globals.h
deleted file mode 100644
index edde446e66..0000000000
--- a/main/php_globals.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef _PHP_GLOBALS_H
-#define _PHP_GLOBALS_H
-
-typedef struct _php_core_globals php_core_globals;
-
-#ifdef ZTS
-# define PLS_D php_core_globals *core_globals
-# define PLS_DC , PLS_D
-# define PLS_C core_globals
-# define PLS_CC , PLS_C
-# define PG(v) (core_globals->v)
-# define PLS_FETCH() php_core_globals *core_globals = ts_resource(core_globals_id)
-#else
-# define PLS_D
-# define PLS_DC
-# define PLS_C
-# define PLS_CC
-# define PG(v) (core_globals.v)
-# define PLS_FETCH()
-extern ZEND_API php_core_globals core_globals;
-#endif
-
-
-struct _php_core_globals {
- long magic_quotes_gpc;
- long magic_quotes_runtime;
- long magic_quotes_sybase;
-
- long asp_tags;
- long short_tags;
-
- long safe_mode;
- long sql_safe_mode;
- char *safe_mode_exec_dir;
- long enable_dl;
-
- long max_execution_time;
- long memory_limit;
-
- long track_errors;
- long display_errors;
- long log_errors;
- char *error_log;
-
- char *doc_root;
- char *user_dir;
- char *include_path;
- char *open_basedir;
- char *extension_dir;
-
- char *upload_tmp_dir;
- long upload_max_filesize;
-
- char *auto_prepend_file;
- char *auto_append_file;
-
- char *arg_separator;
- char *gpc_order;
-
- long track_vars;
-
- long y2k_compliance;
-};
-
-
-#endif /* _PHP_GLOBALS_H */ \ No newline at end of file
diff --git a/main/php_ini.c b/main/php_ini.c
deleted file mode 100644
index 406f5ac79b..0000000000
--- a/main/php_ini.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | PHP HTML Embedded Scripting Language Version 4.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. |
- +----------------------------------------------------------------------+
- | Author: Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-
-
-#include <stdlib.h>
-
-#include "php.h"
-#include "php_ini.h"
-#include "zend_alloc.h"
-#include "php_globals.h"
-
-static HashTable known_directives;
-
-
-/*
- * hash_apply functions
- */
-static int php_remove_ini_entries(php_ini_entry *ini_entry, int *module_number)
-{
- if (ini_entry->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-static int php_restore_ini_entry_cb(php_ini_entry *ini_entry)
-{
- if (ini_entry->modified) {
- efree(ini_entry->value);
- ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
- ini_entry->modified = 0;
- ini_entry->orig_value = NULL;
- ini_entry->orig_value_length = 0;
- }
- return 0;
-}
-
-/*
- * Startup / shutdown
- */
-int php_ini_mstartup()
-{
- if (_php3_hash_init(&known_directives, 100, NULL, NULL, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-int php_ini_mshutdown()
-{
- _php3_hash_destroy(&known_directives);
- return SUCCESS;
-}
-
-
-int php_ini_rshutdown()
-{
- _php3_hash_apply(&known_directives, (int (*)(void *)) php_restore_ini_entry_cb);
- return SUCCESS;
-}
-
-/*
- * Registration / unregistration
- */
-
-int php_register_ini_entries(php_ini_entry *ini_entry, int module_number)
-{
- php_ini_entry *p = ini_entry;
- php_ini_entry *hashed_ini_entry;
- pval *default_value;
-
- while (p->name) {
- p->module_number = module_number;
- if (_php3_hash_add(&known_directives, p->name, p->name_length, p, sizeof(php_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
- php_unregister_ini_entries(module_number);
- return FAILURE;
- }
- if ((default_value=cfg_get_entry(p->name, p->name_length))) {
- if (!hashed_ini_entry->on_modify
- || hashed_ini_entry->on_modify(hashed_ini_entry, default_value->value.str.val, default_value->value.str.len, hashed_ini_entry->mh_arg)==SUCCESS) {
- hashed_ini_entry->value = default_value->value.str.val;
- hashed_ini_entry->value_length = default_value->value.str.len;
- }
- } else {
- if (hashed_ini_entry->on_modify) {
- hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg);
- }
- }
- hashed_ini_entry->modified = 0;
- p++;
- }
- return SUCCESS;
-}
-
-
-void php_unregister_ini_entries(int module_number)
-{
- _php3_hash_apply_with_argument(&known_directives, (int (*)(void *, void *)) php_remove_ini_entries, (void *) &module_number);
-}
-
-
-int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type)
-{
- php_ini_entry *ini_entry;
- char *duplicate;
-
- if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- if (!(ini_entry->modifyable & modify_type)) {
- return FAILURE;
- }
-
- duplicate = estrndup(new_value, new_value_length);
-
- if (!ini_entry->on_modify
- || ini_entry->on_modify(ini_entry, duplicate, new_value_length, ini_entry->mh_arg)==SUCCESS) {
- if (!ini_entry->orig_value) {
- ini_entry->orig_value = ini_entry->value;
- ini_entry->orig_value_length = ini_entry->value_length;
- } else { /* we already changed the value, free the changed value */
- efree(ini_entry->value);
- }
- ini_entry->value = duplicate;
- ini_entry->value_length = new_value_length;
- ini_entry->modified = 1;
- } else {
- efree(duplicate);
- }
-
- return SUCCESS;
-}
-
-
-int php_restore_ini_entry(char *name, uint name_length)
-{
- php_ini_entry *ini_entry;
-
- if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==FAILURE) {
- return FAILURE;
- }
-
- if (ini_entry->orig_value) {
- ini_entry->value = ini_entry->orig_value;
- ini_entry->value_length = ini_entry->orig_value_length;
- }
- return SUCCESS;
-}
-
-
-/*
- * Data retrieval
- */
-
-long php_ini_long(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->orig_value) {
- return strtol(ini_entry->orig_value, NULL, 0);
- } else if (ini_entry->value) {
- return strtol(ini_entry->value, NULL, 0);
- }
- }
-
- return 0;
-}
-
-
-double php_ini_double(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->orig_value) {
- return (double) strtod(ini_entry->orig_value, NULL);
- } else if (ini_entry->value) {
- return (double) strtod(ini_entry->value, NULL);
- }
- }
-
- return 0.0;
-}
-
-
-char *php_ini_string(char *name, uint name_length, int orig)
-{
- php_ini_entry *ini_entry;
-
- if (_php3_hash_find(&known_directives, name, name_length, (void **) &ini_entry)==SUCCESS) {
- if (orig && ini_entry->orig_value) {
- return ini_entry->orig_value;
- } else {
- return ini_entry->value;
- }
- }
-
- return "";
-}
-
-
-
-/* Standard message handlers for core_globals */
-
-PHP_INI_MH(OnUpdateInt)
-{
- long *p;
-#ifndef ZTS
- char *base = (char *) &core_globals;
-#else
- char *base;
- PLS_FETCH();
-
- base = (char *) core_globals;
-#endif
-
- p = (long *) (base+(size_t) mh_arg);
-
- *p = atoi(new_value);
- return SUCCESS;
-}
-
-
-PHP_INI_MH(OnUpdateReal)
-{
- double *p;
-#ifndef ZTS
- char *base = (char *) &core_globals;
-#else
- char *base;
- PLS_FETCH();
-
- base = (char *) core_globals;
-#endif
-
- p = (double *) (base+(size_t) mh_arg);
-
- *p = strtod(new_value, NULL);
- return SUCCESS;
-}
-
-
-PHP_INI_MH(OnUpdateString)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) &core_globals;
-#else
- char *base;
- PLS_FETCH();
-
- base = (char *) core_globals;
-#endif
-
- p = (char **) (base+(size_t) mh_arg);
-
- *p = new_value;
- return SUCCESS;
-}
-
-
-PHP_INI_MH(OnUpdateStringUnempty)
-{
- char **p;
-#ifndef ZTS
- char *base = (char *) &core_globals;
-#else
- char *base;
- PLS_FETCH();
-
- base = (char *) core_globals;
-#endif
-
- if (new_value && !new_value[0]) {
- return FAILURE;
- }
-
- p = (char **) (base+(size_t) mh_arg);
-
- *p = new_value;
- return SUCCESS;
-}
diff --git a/main/php_ini.h b/main/php_ini.h
deleted file mode 100644
index eaedca5aaa..0000000000
--- a/main/php_ini.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _PHP_INI_H
-#define _PHP_INI_H
-
-
-#define PHP_INI_USER (1<<0)
-#define PHP_INI_PERDIR (1<<1)
-#define PHP_INI_SYSTEM (1<<2)
-
-#define PHP_INI_ALL (PHP_INI_USER|PHP_INI_PERDIR|PHP_INI_SYSTEM)
-
-typedef struct _php_ini_entry php_ini_entry;
-
-#define PHP_INI_MH(name) int name(php_ini_entry *entry, char *new_value, uint new_value_length, void *mh_arg)
-
-struct _php_ini_entry {
- int module_number;
- int modifyable;
- char *name;
- uint name_length;
- PHP_INI_MH((*on_modify));
- void *mh_arg;
-
- char *value;
- uint value_length;
-
- char *orig_value;
- uint orig_value_length;
- int modified;
-};
-
-
-int php_ini_mstartup();
-int php_ini_mshutdown();
-int php_ini_rshutdown();
-
-int php_register_ini_entries(php_ini_entry *ini_entry, int module_number);
-void php_unregister_ini_entries(int module_number);
-int php_alter_ini_entry(char *name, uint name_length, char *new_value, uint new_value_length, int modify_type);
-int php_restore_ini_entry(char *name, uint name_length);
-
-long php_ini_long(char *name, uint name_length, int orig);
-double php_ini_double(char *name, uint name_length, int orig);
-char *php_ini_string(char *name, uint name_length, int orig);
-
-#define PHP_INI_BEGIN() static php_ini_entry ini_entries[] = {
-
-#define PHP_INI_ENTRY(name, default_value, modifyable, on_modify, ptr) \
- { 0, modifyable, name, sizeof(name), on_modify, ptr, default_value, sizeof(default_value)-1, NULL, 0, 0 },
-
-#define PHP_INI_END() \
- { 0, 0, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, 0 } };
-
-#define INI_INT(name) php_ini_long((name), sizeof(name), 0)
-#define INI_FLT(name) php_ini_double((name), sizeof(name), 0)
-#define INI_STR(name) php_ini_string((name), sizeof(name), 0)
-
-
-#define INI_ORIG_INT(name) php_ini_long((name), sizeof(name), 1)
-#define INI_ORIG_FLT(name) php_ini_double((name), sizeof(name), 1)
-#define INI_ORIG_STR(name) php_ini_string((name), sizeof(name), 1)
-
-
-#define REGISTER_INI_ENTRIES() php_register_ini_entries(ini_entries, module_number)
-#define UNREGISTER_INI_ENTRIES() php_unregister_ini_entries(module_number)
-
-pval *cfg_get_entry(char *name, uint name_length);
-
-
-/* Standard message handlers */
-PHP_INI_MH(OnUpdateInt);
-PHP_INI_MH(OnUpdateReal);
-PHP_INI_MH(OnUpdateString);
-PHP_INI_MH(OnUpdateStringUnempty);
-
-#endif /* _PHP_INI_H */
diff --git a/main/php_version.h b/main/php_version.h
deleted file mode 100644
index 498e3686a4..0000000000
--- a/main/php_version.h
+++ /dev/null
@@ -1 +0,0 @@
-#define PHP_VERSION "4.0pa1"
diff --git a/main/safe_mode.c b/main/safe_mode.c
deleted file mode 100644
index 1b96bdf7dd..0000000000
--- a/main/safe_mode.c
+++ /dev/null
@@ -1,156 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-#include "ext/standard/pageinfo.h"
-#include "safe_mode.h"
-
-/*
- * _php3_checkuid
- *
- * This function has four modes:
- *
- * 0 - return invalid (0) if file does not exist
- * 1 - return valid (1) if file does not exist
- * 2 - if file does not exist, check directory
- * 3 - only check directory (needed for mkdir)
- */
-PHPAPI int _php3_checkuid(const char *fn, int mode) {
- struct stat sb;
- int ret;
- long uid=0L, duid=0L;
- char *s;
-
- if (!fn) return(0); /* path must be provided */
-
- /*
- * If given filepath is a URL, allow - safe mode stuff
- * related to URL's is checked in individual functions
- */
- if (!strncasecmp(fn,"http://",7) || !strncasecmp(fn,"ftp://",6)) {
- return(1);
- }
-
- if (mode<3) {
- ret = stat(fn,&sb);
- if (ret<0 && mode < 2) {
- php3_error(E_WARNING,"Unable to access %s",fn);
- return(mode);
- }
- if (ret>-1) {
- uid=sb.st_uid;
- if (uid==_php3_getuid()) return(1);
- }
- }
- s = strrchr(fn,'/');
-
- /* This loop gets rid of trailing slashes which could otherwise be
- * used to confuse the function.
- */
- while(s && *(s+1)=='\0' && s>fn) {
- s='\0';
- s = strrchr(fn,'/');
- }
-
- if (s) {
- *s='\0';
- ret = stat(fn,&sb);
- *s='/';
- if (ret<0) {
- php3_error(E_WARNING, "Unable to access %s",fn);
- return(0);
- }
- duid = sb.st_uid;
- } else {
- s = emalloc(MAXPATHLEN+1);
- if (!getcwd(s,MAXPATHLEN)) {
- php3_error(E_WARNING, "Unable to access current working directory");
- return(0);
- }
- ret = stat(s,&sb);
- efree(s);
- if (ret<0) {
- php3_error(E_WARNING, "Unable to access %s",s);
- return(0);
- }
- duid = sb.st_uid;
- }
- if (duid == (uid=_php3_getuid())) return(1);
- else {
- php3_error(E_WARNING, "SAFE MODE Restriction in effect. The script whose uid is %ld is not allowed to access %s owned by uid %ld",uid,fn,duid);
- return(0);
- }
-}
-
-
-PHPAPI char *_php3_get_current_user()
-{
-#if CGI_BINARY || USE_SAPI || FHTTPD
- struct stat statbuf;
-#endif
- struct passwd *pwd;
- int uid;
- TLS_VARS;
-
- if (GLOBAL(request_info).current_user) {
- return GLOBAL(request_info).current_user;
- }
-
- /* FIXME: I need to have this somehow handled if
- USE_SAPI is defined, because cgi will also be
- interfaced in USE_SAPI */
-#if CGI_BINARY || USE_SAPI || FHTTPD
- if (!GLOBAL(request_info).filename || (stat(GLOBAL(request_info).filename,&statbuf)==-1)) {
- return empty_string;
- }
- uid = statbuf.st_uid;
-#endif
-#if APACHE
- uid = GLOBAL(php3_rqst)->finfo.st_uid;
-#endif
-
- if ((pwd=getpwuid(uid))==NULL) {
- return empty_string;
- }
- GLOBAL(request_info).current_user_length = strlen(pwd->pw_name);
- GLOBAL(request_info).current_user = estrndup(pwd->pw_name,GLOBAL(request_info).current_user_length);
-
- return GLOBAL(request_info).current_user;
-}
diff --git a/main/safe_mode.h b/main/safe_mode.h
deleted file mode 100644
index 3ae320b46d..0000000000
--- a/main/safe_mode.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _SAFE_MODE_H_
-#define _SAFE_MODE_H_
-
-extern PHPAPI int _php3_checkuid(const char *filename, int mode);
-extern PHPAPI char *_php3_get_current_user(void);
-
-#endif
diff --git a/main/snprintf.c b/main/snprintf.c
deleted file mode 100644
index 32bff374e2..0000000000
--- a/main/snprintf.c
+++ /dev/null
@@ -1,935 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1995-1998 The Apache Group. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission.
- *
- * 5. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Group and was originally based
- * on public domain software written at the National Center for
- * Supercomputing Applications, University of Illinois, Urbana-Champaign.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- * This code is based on, and used with the permission of, the
- * SIO stdio-replacement strx_* functions by Panos Tsirigotis
- * <panos@alumni.cs.colorado.edu> for xinetd.
- */
-
-#include "config.h"
-
-#if !defined(APACHE) || (!APACHE)
-#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
-
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include "php.h"
-
-#ifdef HAVE_GCVT
-
-#define ap_ecvt ecvt
-#define ap_fcvt fcvt
-#define ap_gcvt gcvt
-
-#else
-
-/*
- * cvt.c - IEEE floating point formatting routines for FreeBSD
- * from GNU libc-4.6.27
- */
-
-/*
- * ap_ecvt converts to decimal
- * the number of digits is specified by ndigit
- * decpt is set to the position of the decimal point
- * sign is set to 0 for positive, 1 for negative
- */
-
-#define NDIG 80
-
-static char *
- ap_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag)
-{
- register int r2;
- double fi, fj;
- register char *p, *p1;
- static char buf[NDIG];
-
- if (ndigits >= NDIG - 1)
- ndigits = NDIG - 2;
- r2 = 0;
- *sign = 0;
- p = &buf[0];
- if (arg < 0) {
- *sign = 1;
- arg = -arg;
- }
- arg = modf(arg, &fi);
- p1 = &buf[NDIG];
- /*
- * Do integer part
- */
- if (fi != 0) {
- p1 = &buf[NDIG];
- while (fi != 0) {
- fj = modf(fi / 10, &fi);
- *--p1 = (int) ((fj + .03) * 10) + '0';
- r2++;
- }
- while (p1 < &buf[NDIG])
- *p++ = *p1++;
- } else if (arg > 0) {
- while ((fj = arg * 10) < 1) {
- arg = fj;
- r2--;
- }
- }
- p1 = &buf[ndigits];
- if (eflag == 0)
- p1 += r2;
- *decpt = r2;
- if (p1 < &buf[0]) {
- buf[0] = '\0';
- return (buf);
- }
- while (p <= p1 && p < &buf[NDIG]) {
- arg *= 10;
- arg = modf(arg, &fj);
- *p++ = (int) fj + '0';
- }
- if (p1 >= &buf[NDIG]) {
- buf[NDIG - 1] = '\0';
- return (buf);
- }
- p = p1;
- *p1 += 5;
- while (*p1 > '9') {
- *p1 = '0';
- if (p1 > buf)
- ++ * --p1;
- else {
- *p1 = '1';
- (*decpt)++;
- if (eflag == 0) {
- if (p > buf)
- *p = '0';
- p++;
- }
- }
- }
- *p = '\0';
- return (buf);
-}
-
-static char *
- ap_ecvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_cvt(arg, ndigits, decpt, sign, 1));
-}
-
-static char *
- ap_fcvt(double arg, int ndigits, int *decpt, int *sign)
-{
- return (ap_cvt(arg, ndigits, decpt, sign, 0));
-}
-
-/*
- * ap_gcvt - Floating output conversion to
- * minimal length string
- */
-
-static char *
- ap_gcvt(double number, int ndigit, char *buf)
-{
- int sign, decpt;
- register char *p1, *p2;
- register i;
-
- p1 = ap_ecvt(number, ndigit, &decpt, &sign);
- p2 = buf;
- if (sign)
- *p2++ = '-';
- for (i = ndigit - 1; i > 0 && p1[i] == '0'; i--)
- ndigit--;
- if ((decpt >= 0 && decpt - ndigit > 4)
- || (decpt < 0 && decpt < -3)) { /* use E-style */
- decpt--;
- *p2++ = *p1++;
- *p2++ = '.';
- for (i = 1; i < ndigit; i++)
- *p2++ = *p1++;
- *p2++ = 'e';
- if (decpt < 0) {
- decpt = -decpt;
- *p2++ = '-';
- } else
- *p2++ = '+';
- if (decpt / 100 > 0)
- *p2++ = decpt / 100 + '0';
- if (decpt / 10 > 0)
- *p2++ = (decpt % 100) / 10 + '0';
- *p2++ = decpt % 10 + '0';
- } else {
- if (decpt <= 0) {
- if (*p1 != '0')
- *p2++ = '.';
- while (decpt < 0) {
- decpt++;
- *p2++ = '0';
- }
- }
- for (i = 1; i <= ndigit; i++) {
- *p2++ = *p1++;
- if (i == decpt)
- *p2++ = '.';
- }
- if (ndigit < decpt) {
- while (ndigit++ < decpt)
- *p2++ = '0';
- *p2++ = '.';
- }
- }
- if (p2[-1] == '.')
- p2--;
- *p2 = '\0';
- return (buf);
-}
-
-#endif /* HAVE_CVT */
-
-typedef enum {
- NO = 0, YES = 1
-} boolean_e;
-
-#define FALSE 0
-#define TRUE 1
-#define NUL '\0'
-#define INT_NULL ((int *)0)
-#define WIDE_INT long
-
-typedef WIDE_INT wide_int;
-typedef unsigned WIDE_INT u_wide_int;
-typedef int bool_int;
-
-#define S_NULL "(null)"
-#define S_NULL_LEN 6
-
-#define FLOAT_DIGITS 6
-#define EXPONENT_LENGTH 10
-
-/*
- * NUM_BUF_SIZE is the size of the buffer used for arithmetic conversions
- *
- * XXX: this is a magic number; do not decrease it
- */
-#define NUM_BUF_SIZE 512
-
-
-/*
- * Descriptor for buffer area
- */
-struct buf_area {
- char *buf_end;
- char *nextb; /* pointer to next byte to read/write */
-};
-
-typedef struct buf_area buffy;
-
-/*
- * The INS_CHAR macro inserts a character in the buffer and writes
- * the buffer back to disk if necessary
- * It uses the char pointers sp and bep:
- * sp points to the next available character in the buffer
- * bep points to the end-of-buffer+1
- * While using this macro, note that the nextb pointer is NOT updated.
- *
- * NOTE: Evaluation of the c argument should not have any side-effects
- */
-#define INS_CHAR( c, sp, bep, cc ) \
- { \
- if ( sp < bep ) \
- { \
- *sp++ = c ; \
- cc++ ; \
- } \
- }
-
-#define NUM( c ) ( c - '0' )
-
-#define STR_TO_DEC( str, num ) \
- num = NUM( *str++ ) ; \
- while ( isdigit((int)*str ) ) \
- { \
- num *= 10 ; \
- num += NUM( *str++ ) ; \
- }
-
-/*
- * This macro does zero padding so that the precision
- * requirement is satisfied. The padding is done by
- * adding '0's to the left of the string that is going
- * to be printed.
- */
-#define FIX_PRECISION( adjust, precision, s, s_len ) \
- if ( adjust ) \
- while ( s_len < precision ) \
- { \
- *--s = '0' ; \
- s_len++ ; \
- }
-
-/*
- * Macro that does padding. The padding is done by printing
- * the character ch.
- */
-#define PAD( width, len, ch ) do \
- { \
- INS_CHAR( ch, sp, bep, cc ) ; \
- width-- ; \
- } \
- while ( width > len )
-
-/*
- * Prefix the character ch to the string str
- * Increase length
- * Set the has_prefix flag
- */
-#define PREFIX( str, length, ch ) *--str = ch ; length++ ; has_prefix = YES
-
-
-/*
- * Convert num to its decimal format.
- * Return value:
- * - a pointer to a string containing the number (no sign)
- * - len contains the length of the string
- * - is_negative is set to TRUE or FALSE depending on the sign
- * of the number (always set to FALSE if is_unsigned is TRUE)
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_10(register wide_int num, register bool_int is_unsigned,
- register bool_int * is_negative, char *buf_end, register int *len)
-{
- register char *p = buf_end;
- register u_wide_int magnitude;
-
- if (is_unsigned) {
- magnitude = (u_wide_int) num;
- *is_negative = FALSE;
- } else {
- *is_negative = (num < 0);
-
- /*
- * On a 2's complement machine, negating the most negative integer
- * results in a number that cannot be represented as a signed integer.
- * Here is what we do to obtain the number's magnitude:
- * a. add 1 to the number
- * b. negate it (becomes positive)
- * c. convert it to unsigned
- * d. add 1
- */
- if (*is_negative) {
- wide_int t = num + 1;
-
- magnitude = ((u_wide_int) - t) + 1;
- } else
- magnitude = (u_wide_int) num;
- }
-
- /*
- * We use a do-while loop so that we write at least 1 digit
- */
- do {
- register u_wide_int new_magnitude = magnitude / 10;
-
- *--p = magnitude - new_magnitude * 10 + '0';
- magnitude = new_magnitude;
- }
- while (magnitude);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-
-/*
- * Convert a floating point number to a string formats 'f', 'e' or 'E'.
- * The result is placed in buf, and len denotes the length of the string
- * The sign is returned in the is_negative argument (and is not placed
- * in buf).
- */
-static char *
- conv_fp(register char format, register double num,
- boolean_e add_dp, int precision, bool_int * is_negative, char *buf, int *len)
-{
- register char *s = buf;
- register char *p;
- int decimal_point;
-
- if (format == 'f')
- p = ap_fcvt(num, precision, &decimal_point, is_negative);
- else /* either e or E format */
- p = ap_ecvt(num, precision + 1, &decimal_point, is_negative);
-
- /*
- * Check for Infinity and NaN
- */
- if (isalpha((int)*p)) {
- *len = strlen(strcpy(buf, p));
- *is_negative = FALSE;
- return (buf);
- }
- if (format == 'f') {
- if (decimal_point <= 0) {
- *s++ = '0';
- if (precision > 0) {
- *s++ = '.';
- while (decimal_point++ < 0)
- *s++ = '0';
- } else if (add_dp) {
- *s++ = '.';
- }
- } else {
- while (decimal_point-- > 0) {
- *s++ = *p++;
- }
- if (precision > 0 || add_dp) {
- *s++ = '.';
- }
- }
- } else {
- *s++ = *p++;
- if (precision > 0 || add_dp)
- *s++ = '.';
- }
-
- /*
- * copy the rest of p, the NUL is NOT copied
- */
- while (*p)
- *s++ = *p++;
-
- if (format != 'f') {
- char temp[EXPONENT_LENGTH]; /* for exponent conversion */
- int t_len;
- bool_int exponent_is_negative;
-
- *s++ = format; /* either e or E */
- decimal_point--;
- if (decimal_point != 0) {
- p = conv_10((wide_int) decimal_point, FALSE, &exponent_is_negative,
- &temp[EXPONENT_LENGTH], &t_len);
- *s++ = exponent_is_negative ? '-' : '+';
-
- /*
- * Make sure the exponent has at least 2 digits
- */
- if (t_len == 1)
- *s++ = '0';
- while (t_len--)
- *s++ = *p++;
- } else {
- *s++ = '+';
- *s++ = '0';
- *s++ = '0';
- }
- }
- *len = s - buf;
- return (buf);
-}
-
-
-/*
- * Convert num to a base X number where X is a power of 2. nbits determines X.
- * For example, if nbits is 3, we do base 8 conversion
- * Return value:
- * a pointer to a string containing the number
- *
- * The caller provides a buffer for the string: that is the buf_end argument
- * which is a pointer to the END of the buffer + 1 (i.e. if the buffer
- * is declared as buf[ 100 ], buf_end should be &buf[ 100 ])
- */
-static char *
- conv_p2(register u_wide_int num, register int nbits,
- char format, char *buf_end, register int *len)
-{
- register int mask = (1 << nbits) - 1;
- register char *p = buf_end;
- static char low_digits[] = "0123456789abcdef";
- static char upper_digits[] = "0123456789ABCDEF";
- register char *digits = (format == 'X') ? upper_digits : low_digits;
-
- do {
- *--p = digits[num & mask];
- num >>= nbits;
- }
- while (num);
-
- *len = buf_end - p;
- return (p);
-}
-
-
-/*
- * Do format conversion placing the output in buffer
- */
-static int format_converter(register buffy * odp, const char *fmt,
- va_list ap)
-{
- register char *sp;
- register char *bep;
- register int cc = 0;
- register int i;
-
- register char *s = NULL;
- char *q;
- int s_len;
-
- register int min_width = 0;
- int precision = 0;
- enum {
- LEFT, RIGHT
- } adjust;
- char pad_char;
- char prefix_char;
-
- double fp_num;
- wide_int i_num = (wide_int) 0;
- u_wide_int ui_num;
-
- char num_buf[NUM_BUF_SIZE];
- char char_buf[2]; /* for printing %% and %<unknown> */
-
- /*
- * Flag variables
- */
- boolean_e is_long;
- boolean_e alternate_form;
- boolean_e print_sign;
- boolean_e print_blank;
- boolean_e adjust_precision;
- boolean_e adjust_width;
- bool_int is_negative;
-
- sp = odp->nextb;
- bep = odp->buf_end;
-
- while (*fmt) {
- if (*fmt != '%') {
- INS_CHAR(*fmt, sp, bep, cc);
- } else {
- /*
- * Default variable settings
- */
- adjust = RIGHT;
- alternate_form = print_sign = print_blank = NO;
- pad_char = ' ';
- prefix_char = NUL;
-
- fmt++;
-
- /*
- * Try to avoid checking for flags, width or precision
- */
- if (isascii((int)*fmt) && !islower((int)*fmt)) {
- /*
- * Recognize flags: -, #, BLANK, +
- */
- for (;; fmt++) {
- if (*fmt == '-')
- adjust = LEFT;
- else if (*fmt == '+')
- print_sign = YES;
- else if (*fmt == '#')
- alternate_form = YES;
- else if (*fmt == ' ')
- print_blank = YES;
- else if (*fmt == '0')
- pad_char = '0';
- else
- break;
- }
-
- /*
- * Check if a width was specified
- */
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, min_width);
- adjust_width = YES;
- } else if (*fmt == '*') {
- min_width = va_arg(ap, int);
- fmt++;
- adjust_width = YES;
- if (min_width < 0) {
- adjust = LEFT;
- min_width = -min_width;
- }
- } else
- adjust_width = NO;
-
- /*
- * Check if a precision was specified
- *
- * XXX: an unreasonable amount of precision may be specified
- * resulting in overflow of num_buf. Currently we
- * ignore this possibility.
- */
- if (*fmt == '.') {
- adjust_precision = YES;
- fmt++;
- if (isdigit((int)*fmt)) {
- STR_TO_DEC(fmt, precision);
- } else if (*fmt == '*') {
- precision = va_arg(ap, int);
- fmt++;
- if (precision < 0)
- precision = 0;
- } else
- precision = 0;
- } else
- adjust_precision = NO;
- } else
- adjust_precision = adjust_width = NO;
-
- /*
- * Modifier check
- */
- if (*fmt == 'l') {
- is_long = YES;
- fmt++;
- } else
- is_long = NO;
-
- /*
- * Argument extraction and printing.
- * First we determine the argument type.
- * Then, we convert the argument to a string.
- * On exit from the switch, s points to the string that
- * must be printed, s_len has the length of the string
- * The precision requirements, if any, are reflected in s_len.
- *
- * NOTE: pad_char may be set to '0' because of the 0 flag.
- * It is reset to ' ' by non-numeric formats
- */
- switch (*fmt) {
- case 'u':
- if (is_long)
- i_num = va_arg(ap, u_wide_int);
- else
- i_num = (wide_int) va_arg(ap, unsigned int);
- /*
- * The rest also applies to other integer formats, so fall
- * into that case.
- */
- case 'd':
- case 'i':
- /*
- * Get the arg if we haven't already.
- */
- if ((*fmt) != 'u') {
- if (is_long)
- i_num = va_arg(ap, wide_int);
- else
- i_num = (wide_int) va_arg(ap, int);
- };
- s = conv_10(i_num, (*fmt) == 'u', &is_negative,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
-
- if (*fmt != 'u') {
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- }
- break;
-
-
- case 'o':
- if (is_long)
- ui_num = va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 3, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && *s != '0') {
- *--s = '0';
- s_len++;
- }
- break;
-
-
- case 'x':
- case 'X':
- if (is_long)
- ui_num = (u_wide_int) va_arg(ap, u_wide_int);
- else
- ui_num = (u_wide_int) va_arg(ap, unsigned int);
- s = conv_p2(ui_num, 4, *fmt,
- &num_buf[NUM_BUF_SIZE], &s_len);
- FIX_PRECISION(adjust_precision, precision, s, s_len);
- if (alternate_form && i_num != 0) {
- *--s = *fmt; /* 'x' or 'X' */
- *--s = '0';
- s_len += 2;
- }
- break;
-
-
- case 's':
- s = va_arg(ap, char *);
- if (s != NULL) {
- s_len = strlen(s);
- if (adjust_precision && precision < s_len)
- s_len = precision;
- } else {
- s = S_NULL;
- s_len = S_NULL_LEN;
- }
- pad_char = ' ';
- break;
-
-
- case 'f':
- case 'e':
- case 'E':
- fp_num = va_arg(ap, double);
-
- s = conv_fp(*fmt, fp_num, alternate_form,
- (adjust_precision == NO) ? FLOAT_DIGITS : precision,
- &is_negative, &num_buf[1], &s_len);
- if (is_negative)
- prefix_char = '-';
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
- break;
-
-
- case 'g':
- case 'G':
- if (adjust_precision == NO)
- precision = FLOAT_DIGITS;
- else if (precision == 0)
- precision = 1;
- /*
- * * We use &num_buf[ 1 ], so that we have room for the sign
- */
- s = ap_gcvt(va_arg(ap, double), precision, &num_buf[1]);
- if (*s == '-')
- prefix_char = *s++;
- else if (print_sign)
- prefix_char = '+';
- else if (print_blank)
- prefix_char = ' ';
-
- s_len = strlen(s);
-
- if (alternate_form && (q = strchr(s, '.')) == NULL)
- s[s_len++] = '.';
- if (*fmt == 'G' && (q = strchr(s, 'e')) != NULL)
- *q = 'E';
- break;
-
-
- case 'c':
- char_buf[0] = (char) (va_arg(ap, int));
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case '%':
- char_buf[0] = '%';
- s = &char_buf[0];
- s_len = 1;
- pad_char = ' ';
- break;
-
-
- case 'n':
- *(va_arg(ap, int *)) = cc;
- break;
-
- /*
- * Always extract the argument as a "char *" pointer. We
- * should be using "void *" but there are still machines
- * that don't understand it.
- * If the pointer size is equal to the size of an unsigned
- * integer we convert the pointer to a hex number, otherwise
- * we print "%p" to indicate that we don't handle "%p".
- */
- case 'p':
- ui_num = (u_wide_int) va_arg(ap, char *);
-
- if (sizeof(char *) <= sizeof(u_wide_int))
- s = conv_p2(ui_num, 4, 'x',
- &num_buf[NUM_BUF_SIZE], &s_len);
- else {
- s = "%p";
- s_len = 2;
- }
- pad_char = ' ';
- break;
-
-
- case NUL:
- /*
- * The last character of the format string was %.
- * We ignore it.
- */
- continue;
-
-
- /*
- * The default case is for unrecognized %'s.
- * We print %<char> to help the user identify what
- * option is not understood.
- * This is also useful in case the user wants to pass
- * the output of format_converter to another function
- * that understands some other %<char> (like syslog).
- * Note that we can't point s inside fmt because the
- * unknown <char> could be preceded by width etc.
- */
- default:
- char_buf[0] = '%';
- char_buf[1] = *fmt;
- s = char_buf;
- s_len = 2;
- pad_char = ' ';
- break;
- }
-
- if (prefix_char != NUL) {
- *--s = prefix_char;
- s_len++;
- }
- if (adjust_width && adjust == RIGHT && min_width > s_len) {
- if (pad_char == '0' && prefix_char != NUL) {
- INS_CHAR(*s, sp, bep, cc)
- s++;
- s_len--;
- min_width--;
- }
- PAD(min_width, s_len, pad_char);
- }
- /*
- * Print the string s.
- */
- for (i = s_len; i != 0; i--) {
- INS_CHAR(*s, sp, bep, cc);
- s++;
- }
-
- if (adjust_width && adjust == LEFT && min_width > s_len)
- PAD(min_width, s_len, pad_char);
- }
- fmt++;
- }
- odp->nextb = sp;
- return (cc);
-}
-
-
-/*
- * This is the general purpose conversion function.
- */
-static void strx_printv(int *ccp, char *buf, size_t len, const char *format,
- va_list ap)
-{
- buffy od;
- int cc;
-
- /*
- * First initialize the descriptor
- * Notice that if no length is given, we initialize buf_end to the
- * highest possible address.
- */
- od.buf_end = len ? &buf[len] : (char *) ~0;
- od.nextb = buf;
-
- /*
- * Do the conversion
- */
- cc = format_converter(&od, format, ap);
- if (len == 0 || od.nextb <= od.buf_end)
- *(od.nextb) = '\0';
- if (ccp)
- *ccp = cc;
-}
-
-
-int ap_snprintf(char *buf, size_t len, const char *format,...)
-{
- int cc;
- va_list ap;
-
- va_start(ap, format);
- strx_printv(&cc, buf, (len - 1), format, ap);
- va_end(ap);
- return (cc);
-}
-
-
-int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap)
-{
- int cc;
-
- strx_printv(&cc, buf, (len - 1), format, ap);
- return (cc);
-}
-
-#endif /* HAVE_SNPRINTF */
-#endif /* APACHE */
diff --git a/main/snprintf.h b/main/snprintf.h
deleted file mode 100644
index 95d133213a..0000000000
--- a/main/snprintf.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: Stig Sæther Bakken <ssb@guardian.no> |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP3_SNPRINTF_H
-#define _PHP3_SNPRINTF_H
-
-#ifndef HAVE_SNPRINTF
-extern int ap_snprintf(char *, size_t, const char *, ...);
-#define snprintf ap_snprintf
-#endif
-
-#ifndef HAVE_VSNPRINTF
-extern int ap_vsnprintf(char *, size_t, const char *, va_list ap);
-#define vsnprintf ap_vsnprintf
-#endif
-
-#if BROKEN_SPRINTF
-int _php3_sprintf (char* s, const char* format, ...);
-#else
-#define _php3_sprintf sprintf
-#endif
-
-#endif /* _PHP3_SNPRINTF_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/main/win95nt.h b/main/win95nt.h
deleted file mode 100644
index 0808a84638..0000000000
--- a/main/win95nt.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Defines and types for Windows 95/NT */
-#define WIN32_LEAN_AND_MEAN
-#include <io.h>
-#include <malloc.h>
-#include <direct.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <sys/types.h>
-typedef int uid_t;
-typedef int gid_t;
-typedef int mode_t;
-typedef char * caddr_t;
-#define lstat(x, y) stat(x, y)
-#define _IFIFO 0010000 /* fifo */
-#define _IFBLK 0060000 /* block special */
-#define _IFLNK 0120000 /* symbolic link */
-#define S_IFIFO _IFIFO
-#define S_IFBLK _IFBLK
-#define S_IFLNK _IFLNK
-#define pclose _pclose
-#define popen _popen
-#define chdir(path) SetCurrentDirectory(path)
-#define mkdir(a,b) _mkdir(a)
-#define rmdir _rmdir
-#define getpid _getpid
-#if !(APACHE)
-#define sleep(t) Sleep(t*1000)
-#endif
-#define getcwd _getcwd
-#define snprintf _snprintf
-#define off_t _off_t
-#define vsnprintf _vsnprintf
-typedef unsigned int uint;
-typedef unsigned long ulong;
-#if !NSAPI
-#define strcasecmp(s1, s2) stricmp(s1, s2)
-#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
-typedef long pid_t;
-#endif
-
-/* missing in vc5 math.h */
-#define M_PI 3.14159265358979323846
-#define M_TWOPI (M_PI * 2.0)
-#define M_PI_2 1.57079632679489661923
-#define M_PI_4 0.78539816339744830962
-
-#if !DEBUG
-#ifdef inline
-#undef inline
-#endif
-#define inline __inline
-#endif
-
-/* General Windows stuff */
-#define WINDOWS 1
-
-/* Prevent use of VC5 OpenFile function */
-#define NOOPENFILE
-
-/* sendmail is built-in */
-#ifdef PHP_PROG_SENDMAIL
-#undef PHP_PROG_SENDMAIL
-#define PHP_PROG_SENDMAIL "Built in mailer"
-#endif
-
-#define CONVERT_TO_WIN_FS(Filename) \
-{ \
- char *stemp; \
- if (Filename) \
- for (stemp = Filename; *stemp; stemp++) \
- if ( *stemp == '/') \
- *stemp = '\\'; \
-}
diff --git a/makeall.bat b/makeall.bat
deleted file mode 100755
index 5f9b61d238..0000000000
--- a/makeall.bat
+++ /dev/null
@@ -1,13 +0,0 @@
-NMAKE /f "php3.mak" CFG="php3 - Win32 %1"
-NMAKE /f "calendar.mak" CFG="calendar - Win32 %1"
-NMAKE /f "dbase.mak" CFG="dbase - Win32 %1"
-NMAKE /f "dbm.mak" CFG="dbm - Win32 %1"
-NMAKE /f "filepro.mak" CFG="filepro - Win32 %1"
-NMAKE /f "gd.mak" CFG="gd - Win32 %1"
-NMAKE /f "imap4.mak" CFG="imap4 - Win32 %1"
-NMAKE /f "hyperwave.mak" CFG="hyperwave - Win32 %1"
-NMAKE /f "ldap.mak" CFG="ldap - Win32 %1"
-NMAKE /f "msql.mak" CFG="msql - Win32 %1"
-NMAKE /f "mysql.mak" CFG="mysql - Win32 %1"
-NMAKE /f "zlib.mak" CFG="zlib - Win32 %1"
-NMAKE /f "snmp.mak" CFG="snmp - Win32 %1"
diff --git a/makedist b/makedist
deleted file mode 100755
index 889cad6553..0000000000
--- a/makedist
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/sh
-#
-# Distribution generator for CVS based packages.
-# To work, this script needs a consistent tagging of all releases.
-# Each release of a package should have a tag of the form
-#
-# <package>_<version>
-#
-# where <package> is the package name and the CVS module
-# and <version> s the version number with underscores instead of dots.
-#
-# For example: cvs tag php_3_0a1
-#
-# The distribution ends up in a .tar.gz file that contains the distribution
-# in a directory called <package>-<version>. The distribution contains all
-# directories from the CVS module except the one called "nodist", but only
-# the files INSTALL, README and config* are included.
-#
-# Since you can no longer set the CVS password via an env variable, you
-# need to have previously done a cvs login for the server and user id
-# this script uses so it will have an entry in your ~/.cvspasswd file.
-#
-# Usage: makedist <package> <version>
-#
-# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
-#
-# $Id$
-#
-
-CVSROOT=:pserver:cvsread@cvs.php.net:/repository
-export CVSROOT
-
-if echo '\c' | grep -s c >/dev/null 2>&1
-then
- ECHO_N="echo -n"
- ECHO_C=""
-else
- ECHO_N="echo"
- ECHO_C='\c'
-fi
-
-if test "$#" != "2"; then
- echo "Usage: makedist <package> <version>" >&2
- exit 1
-fi
-
-PKG=$1 ; shift
-VER=$1 ; shift
-
-OLDPWD=`pwd`
-
-# the destination .tar.gz file
-ARCHIVE=$OLDPWD/$PKG-$VER.tar.gz
-
-# temporary directory used to check out files from CVS
-TMPDIR=$OLDPWD/cvstmp-$PKG-$VER
-
-# version part of the CVS release tag
-CVSVER=`echo $VER | sed -e 's/\./_/g'`
-
-# CVS release tag
-CVSTAG=${PKG}_$CVSVER
-
-# should become "php3"
-CVSMOD=`cat CVS/Repository | sed -e 's!^/[^/]*/!!'`
-
-if test ! -d $TMPDIR; then
- mkdir -p $TMPDIR || exit 2
-fi
-
-cd $TMPDIR || exit 3
-
-$ECHO_N "makedist: exporting tag '$CVSTAG' from '$CVSMOD'...$ECHO_C"
-cvs -Q export -r $CVSTAG $CVSMOD || exit 4
-echo ""
-
-cd $CVSMOD || exit 5
-
-INC=""
-
-# remove CVS stuff...
-find . \( \( -name CVS -type d \) -o -name .cvsignore \) -exec rm -rf {} \;
-
-for file in *; do
- case $file in
- $PKG-$VER|web_update);; # ignore these
- *) INC="$INC $file";; # include the rest
- esac
-done
-
-# generate some files so people don't need bison, flex and autoconf
-# to install
-set -x
-autoconf
-bison -p php -v -d language-parser.y
-flex -Pphp -olanguage-scanner.c -i language-scanner.lex
-bison -p cfg -v -d configuration-parser.y
-flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
-cd convertor
-flex -i -Pphp -olanguage-scanner.c language-scanner.lex
-bison -p php -v -d language-parser.y
-cd ..
-
-#perl -i -p -e 's/\r\n/\n/' *.dsw *.dsp
-set +x
-
-INC="$INC \
-configuration-scanner.c \
-configuration-parser.tab.c configuration-parser.tab.h \
-language-scanner.c \
-language-parser.tab.c language-parser.tab.h \
-configure"
-
-mkdir $PKG-$VER || exit 6
-mv $INC $PKG-$VER || exit 7
-
-$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
-tar czf $ARCHIVE $PKG-$VER || exit 8
-echo ""
-
-$ECHO_N "makedist: cleaning up...$ECHO_C"
-cd $OLDPWD
-rm -rf $TMPDIR || exit 9
-echo ""
-
-exit 0
diff --git a/makeparser.bat b/makeparser.bat
deleted file mode 100755
index 8c36f958ab..0000000000
--- a/makeparser.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-d:\mingw32\bin\bison -p php -v -d language-parser.y
-flex -Pphp -olanguage-scanner.c -i language-scanner.lex
-d:\mingw32\bin\bison -p cfg -v -d configuration-parser.y
-flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
diff --git a/mod_php3.c b/mod_php3.c
deleted file mode 100644
index 4fb46433d5..0000000000
--- a/mod_php3.c
+++ /dev/null
@@ -1,429 +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 <rasmus@lerdorf.on.ca> |
- | (with helpful hints from Dean Gaudet <dgaudet@arctic.org> |
- | PHP4 patches by Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#include "php.h"
-#else
-#include "httpd.h"
-#include "http_config.h"
-#if MODULE_MAGIC_NUMBER > 19980712
-#include "ap_compat.h"
-#else
-#if MODULE_MAGIC_NUMBER > 19980324
-#include "compat.h"
-#endif
-#endif
-#include "http_core.h"
-#include "http_main.h"
-#include "http_protocol.h"
-#include "http_request.h"
-#include "http_log.h"
-#endif
-
-
-/* These are taken out of php_ini.h
- * they must be updated if php_ini.h changes!
- */
-#define PHP_INI_USER (1<<0)
-#define PHP_INI_PERDIR (1<<1)
-#define PHP_INI_SYSTEM (1<<2)
-
-#include "util_script.h"
-
-#include "php_version.h"
-#include "mod_php3.h"
-#if HAVE_MOD_DAV
-# include "mod_dav.h"
-#endif
-
-/* ### these should be defined in mod_php3.h or somewhere else */
-#define USE_PATH 1
-#define IGNORE_URL 2
-
-module MODULE_VAR_EXPORT php3_module;
-
-#ifndef THREAD_SAFE
-int saved_umask;
-#else
-#define GLOBAL(a) php3_globals->a
-#define STATIC GLOBAL
-#define TLS_VARS \
- php3_globals_struct *php3_globals; \
- php3_globals = TlsGetValue(TlsIndex);
-#endif
-
-#ifndef TLS_VARS
-#define TLS_VARS
-#endif
-
-#ifndef GLOBAL
-#define GLOBAL(x) x
-#endif
-
-#if WIN32|WINNT
-/* popenf isn't working on Windows, use open instead*/
-# ifdef popenf
-# undef popenf
-# endif
-# define popenf(p,n,f,m) open((n),(f),(m))
-# ifdef pclosef
-# undef pclosef
-# endif
-# define pclosef(p,f) close(f)
-#else
-# define php3i_popenf(p,n,f,m) popenf((p),(n),(f),(m))
-#endif
-
-php_apache_info_struct php_apache_info; /* active config */
-
-int apache_php3_module_main(request_rec * r, int fd, int display_source_mode);
-extern int php3_module_startup();
-extern void php3_module_shutdown();
-extern void php3_module_shutdown_for_exec();
-
-extern int tls_create(void);
-extern int tls_destroy(void);
-extern int tls_startup(void);
-extern int tls_shutdown(void);
-
-#if WIN32|WINNT
-
-/*
- we will want to change this to the apache api
- process and thread entry and exit functions
-*/
-BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
-{
- switch( ul_reason_for_call ) {
- case DLL_PROCESS_ATTACH:
- /*
- I should be loading ini vars here
- and doing whatever true global inits
- need to be done
- */
- if (!tls_startup())
- return 0;
- if (!tls_create())
- return 0;
-
- break;
- case DLL_THREAD_ATTACH:
- if (!tls_create())
- return 0;
- /* if (php3_module_startup()==FAILURE) {
- return FAILURE;
- }
-*/ break;
- case DLL_THREAD_DETACH:
- if (!tls_destroy())
- return 0;
-/* if (initialized) {
- php3_module_shutdown();
- return SUCCESS;
- } else {
- return FAILURE;
- }
-*/ break;
- case DLL_PROCESS_DETACH:
- /*
- close down anything down in process_attach
- */
- if (!tls_destroy())
- return 0;
- if (!tls_shutdown())
- return 0;
- break;
- }
- return 1;
-}
-#endif
-
-void php3_save_umask()
-{
- TLS_VARS;
- GLOBAL(saved_umask) = umask(077);
- umask(GLOBAL(saved_umask));
-}
-
-void php3_restore_umask()
-{
- TLS_VARS;
- umask(GLOBAL(saved_umask));
-}
-
-int send_php3(request_rec *r, int display_source_mode, char *filename)
-{
- int fd, retval;
-
- /* We don't accept OPTIONS requests, but take everything else */
- if (r->method_number == M_OPTIONS) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
-
- /* Make sure file exists */
- if (filename == NULL && r->finfo.st_mode == 0) {
- return NOT_FOUND;
- }
-
- /* If PHP parser engine has been turned off with a "php3_engine off"
- * directive, then decline to handle this request
- */
- if (!php_apache_info.engine) {
- r->content_type = "text/html";
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- if (filename == NULL) {
- filename = r->filename;
- }
- /* Open the file */
- if ((fd = popenf(r->pool, filename, O_RDONLY, 0)) == -1) {
- log_reason("file permissions deny server access", filename, r);
- return FORBIDDEN;
- }
-
- /* Apache 1.2 has a more complex mechanism for reading POST data */
-#if MODULE_MAGIC_NUMBER > 19961007
- if ((retval = setup_client_block(r, REQUEST_CHUNKED_ERROR)))
- return retval;
-#endif
-
- if (php_apache_info.last_modified) {
-#if MODULE_MAGIC_NUMBER < 19970912
- if ((retval = set_last_modified(r, r->finfo.st_mtime))) {
- return retval;
- }
-#else
- update_mtime (r, r->finfo.st_mtime);
- set_last_modified(r);
- set_etag(r);
-#endif
- }
- /* Assume output will be HTML. Individual scripts may change this
- further down the line */
- r->content_type = "text/html";
-
- /* Init timeout */
- hard_timeout("send", r);
-
- php3_save_umask();
- chdir_file(filename);
- add_common_vars(r);
- add_cgi_vars(r);
- apache_php3_module_main(r, fd, display_source_mode);
-
- /* Done, restore umask, turn off timeout, close file and return */
- php3_restore_umask();
- kill_timeout(r);
- pclosef(r->pool, fd);
- return OK;
-}
-
-int send_parsed_php3(request_rec * r)
-{
- return send_php3(r, 0, NULL);
-}
-
-int send_parsed_php3_source(request_rec * r)
-{
- return send_php3(r, 0, NULL);
-}
-
-/*
- * Create the per-directory config structure with defaults
- */
-static void *php3_create_dir(pool * p, char *dummy)
-{
- php_apache_info_struct *new;
-
- new = (php_apache_info_struct *) palloc(p, sizeof(php_apache_info_struct));
- memcpy(new, &php_apache_info, sizeof(php_apache_info_struct));
-
- return new;
-}
-
-
-#if MODULE_MAGIC_NUMBER > 19961007
-#define CONST_PREFIX const
-#else
-#define CONST_PREFIX
-#endif
-
-CONST_PREFIX char *php_apache_value_handler(cmd_parms *cmd, php_apache_info_struct *conf, char *arg1, char *arg2)
-{
- php_alter_ini_entry(arg1, strlen(arg1)+1, arg2, strlen(arg2)+1, PHP_INI_PERDIR);
- return NULL;
-}
-
-
-CONST_PREFIX char *php_apache_flag_handler(cmd_parms *cmd, php_apache_info_struct *conf, char *arg1, char *arg2)
-{
- char bool_val[2];
-
- if (!strcmp(arg2, "On")) {
- bool_val[0] = '1';
- } else {
- bool_val[0] = '0';
- }
- bool_val[1] = 0;
-
- php_alter_ini_entry(arg1, strlen(arg1)+1, bool_val, 2, PHP_INI_PERDIR);
- return NULL;
-}
-
-
-int php3_xbithack_handler(request_rec * r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *) get_module_config(r->per_dir_config, &php3_module);
- if (!(r->finfo.st_mode & S_IXUSR)) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- if (conf->xbithack == 0) {
- r->allowed |= (1 << METHODS) - 1;
- return DECLINED;
- }
- return send_parsed_php3(r);
-}
-
-void php3_init_handler(server_rec *s, pool *p)
-{
- register_cleanup(p, NULL, php3_module_shutdown, php3_module_shutdown_for_exec);
- php3_module_startup();
-#if MODULE_MAGIC_NUMBER >= 19980527
- ap_add_version_component("PHP/" PHP_VERSION);
-#endif
-}
-
-
-#if HAVE_MOD_DAV
-
-extern int phpdav_mkcol_test_handler(request_rec *r);
-extern int phpdav_mkcol_create_handler(request_rec *r);
-
-/* conf is being read twice (both here and in send_php3()) */
-int send_parsed_php3_dav_script(request_rec *r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *) get_module_config(r->per_dir_config,
- &php3_module);
- return send_php3(r, 0, 0, conf->dav_script);
-}
-
-static int php3_type_checker(request_rec *r)
-{
- php_apache_info_struct *conf;
-
- conf = (php_apache_info_struct *)get_module_config(r->per_dir_config,
- &php3_module);
-
- /* If DAV support is enabled, use mod_dav's type checker. */
- if (conf->dav_script) {
- dav_api_set_request_handler(r, send_parsed_php3_dav_script);
- dav_api_set_mkcol_handlers(r, phpdav_mkcol_test_handler,
- phpdav_mkcol_create_handler);
- /* leave the rest of the request to mod_dav */
- return dav_api_type_checker(r);
- }
-
- return DECLINED;
-}
-
-#else /* HAVE_MOD_DAV */
-
-# define php3_type_checker NULL
-
-#endif /* HAVE_MOD_DAV */
-
-
-handler_rec php3_handlers[] =
-{
- {"application/x-httpd-php3", send_parsed_php3},
- {"application/x-httpd-php3-source", send_parsed_php3_source},
- {"text/html", php3_xbithack_handler},
- {NULL}
-};
-
-
-command_rec php3_commands[] =
-{
- {"php4_value", php_apache_value_handler, NULL, OR_OPTIONS, TAKE2, "PHP Value Modifier"},
- {"php4_flag", php_apache_flag_handler, NULL, OR_OPTIONS, TAKE2, "PHP Flag Modifier"},
- {NULL}
-};
-
-
-
-module MODULE_VAR_EXPORT php3_module =
-{
- STANDARD_MODULE_STUFF,
- php3_init_handler, /* initializer */
- php3_create_dir, /* per-directory config creator */
- NULL, /* dir merger */
- NULL, /* per-server config creator */
- NULL, /* merge server config */
- php3_commands, /* command table */
- php3_handlers, /* handlers */
- NULL, /* filename translation */
- NULL, /* check_user_id */
- NULL, /* check auth */
- NULL, /* check access */
- php3_type_checker, /* type_checker */
- NULL, /* fixups */
- NULL /* logger */
-#if MODULE_MAGIC_NUMBER >= 19970103
- ,NULL /* header parser */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970719
- ,NULL /* child_init */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970728
- ,NULL /* child_exit */
-#endif
-#if MODULE_MAGIC_NUMBER >= 19970902
- ,NULL /* post read-request */
-#endif
-};
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/mod_php3.h b/mod_php3.h
deleted file mode 100644
index 35eeb50e7d..0000000000
--- a/mod_php3.h
+++ /dev/null
@@ -1,60 +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 <rasmus@lerdorf.on.ca> |
- +----------------------------------------------------------------------+
- */
-/* $Id$ */
-
-#ifndef _MOD_PHP3_H
-#define _MOD_PHP3_H
-
-#if !defined(WIN32) && !defined(WINNT)
-#ifndef MODULE_VAR_EXPORT
-#define MODULE_VAR_EXPORT
-#endif
-#endif
-
-typedef struct {
- long engine;
- long last_modified;
- char *dav_script;
- long xbithack;
-} php_apache_info_struct;
-
-extern php_apache_info_struct php_apache_info;
-
-#if MSVC5
-#define S_IXUSR _S_IEXEC
-#endif
-
-#endif /* _MOD_PHP3_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/msql.mak b/msql.mak
deleted file mode 100644
index 6d07dd4c0d..0000000000
--- a/msql.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on msql.dsp
-!IF "$(CFG)" == ""
-CFG=msql - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to msql - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "msql - Win32 Release" && "$(CFG)" != "msql - 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 "msql.mak" CFG="msql - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "msql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "msql - 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)" == "msql - Win32 Release"
-
-OUTDIR=.\module_release
-INTDIR=.\module_release
-# Begin Custom Macros
-OutDir=.\module_release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_msql2.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\msql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_msql2.dll"
- -@erase "$(OUTDIR)\php3_msql2.exp"
- -@erase "$(OUTDIR)\php3_msql2.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_MSQL=1 /D "NDEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\msql.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)\msql.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib mSQL_dll.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.1 /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_msql2.pdb" /machine:I386 /out:"$(OUTDIR)\php3_msql2.dll" /implib:"$(OUTDIR)\php3_msql2.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\msql.obj"
-
-"$(OUTDIR)\php3_msql2.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "msql - Win32 Debug"
-
-OUTDIR=.\module_debug
-INTDIR=.\module_debug
-# Begin Custom Macros
-OutDir=.\module_debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_msql.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\msql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_msql.dll"
- -@erase "$(OUTDIR)\php3_msql.exp"
- -@erase "$(OUTDIR)\php3_msql.ilk"
- -@erase "$(OUTDIR)\php3_msql.lib"
- -@erase "$(OUTDIR)\php3_msql.pdb"
-
-"$(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 HAVE_MSQL=1 /D "DEBUG" /D "_DEBUG" /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\msql.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)\msql.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib mSQL_dll.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.1 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_msql.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_msql.dll" /implib:"$(OUTDIR)\php3_msql.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\msql.obj"
-
-"$(OUTDIR)\php3_msql.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("msql.dep")
-!INCLUDE "msql.dep"
-!ELSE
-!MESSAGE Warning: cannot find "msql.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "msql - Win32 Release" || "$(CFG)" == "msql - Win32 Debug"
-SOURCE=.\functions\msql.c
-
-"$(INTDIR)\msql.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/msql1.mak b/msql1.mak
deleted file mode 100644
index d1c5ad3915..0000000000
--- a/msql1.mak
+++ /dev/null
@@ -1,212 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on msql1.dsp
-!IF "$(CFG)" == ""
-CFG=msql1 - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to msql1 - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "msql1 - Win32 Release" && "$(CFG)" != "msql1 - 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 "msql1.mak" CFG="msql1 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "msql1 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "msql1 - 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)" == "msql1 - Win32 Release"
-
-OUTDIR=.\module_release
-INTDIR=.\module_release
-# Begin Custom Macros
-OutDir=.\module_release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_msql1.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\msql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_msql1.dll"
- -@erase "$(OUTDIR)\php3_msql1.exp"
- -@erase "$(OUTDIR)\php3_msql1.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_MSQL=1 /D MSQL1=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\msql1.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)\msql1.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib libmsql1.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_msql1.pdb" /machine:I386 /out:"$(OUTDIR)\php3_msql1.dll" /implib:"$(OUTDIR)\php3_msql1.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\msql.obj"
-
-"$(OUTDIR)\php3_msql1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "msql1 - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_msql1.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\msql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_msql1.dll"
- -@erase "$(OUTDIR)\php3_msql1.exp"
- -@erase "$(OUTDIR)\php3_msql1.ilk"
- -@erase "$(OUTDIR)\php3_msql1.lib"
- -@erase "$(OUTDIR)\php3_msql1.pdb"
-
-"$(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 HAVE_MSQL=1 /D MSQL1=1 /D "COMPILE_DL" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "MSVC5" /Fp"$(INTDIR)\msql1.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)\msql1.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib libmsql1.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_msql1.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_msql1.dll" /implib:"$(OUTDIR)\php3_msql1.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\msql.obj"
-
-"$(OUTDIR)\php3_msql1.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("msql1.dep")
-!INCLUDE "msql1.dep"
-!ELSE
-!MESSAGE Warning: cannot find "msql1.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "msql1 - Win32 Release" || "$(CFG)" == "msql1 - Win32 Debug"
-SOURCE=.\functions\msql.c
-
-!IF "$(CFG)" == "msql1 - Win32 Release"
-
-CPP_SWITCHES=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_MSQL=1 /D MSQL1=1 /D "COMPILE_DL" /D "MSVC5" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\msql1.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\msql.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ELSEIF "$(CFG)" == "msql1 - Win32 Debug"
-
-CPP_SWITCHES=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D HAVE_MSQL=1 /D MSQL1=1 /D "COMPILE_DL" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "MSVC5" /Fp"$(INTDIR)\msql1.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-
-"$(INTDIR)\msql.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) @<<
- $(CPP_SWITCHES) $(SOURCE)
-<<
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/mtparser.bat b/mtparser.bat
deleted file mode 100755
index 715d3b5935..0000000000
--- a/mtparser.bat
+++ /dev/null
@@ -1,4 +0,0 @@
-bison -p php -v -d language-parser.y
-plex -x -m %3 -Pphp -olanguage-scanner.c -i language-scanner.lex
-bison -p cfg -v -d configuration-parser.y
-flex -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
diff --git a/mysql.mak b/mysql.mak
deleted file mode 100644
index edb178a90f..0000000000
--- a/mysql.mak
+++ /dev/null
@@ -1,197 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on mysql.dsp
-!IF "$(CFG)" == ""
-CFG=mysql - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to mysql - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "mysql - Win32 Release" && "$(CFG)" != "mysql - 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 "mysql.mak" CFG="mysql - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "mysql - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "mysql - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-!IF "$(CFG)" == "mysql - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_mysql.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\mysql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(OUTDIR)\php3_mysql.dll"
- -@erase "$(OUTDIR)\php3_mysql.exp"
- -@erase "$(OUTDIR)\php3_mysql.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_MYSQL=1 /D HAVE_ERRMSG_H=1 /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\mysql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /I /usr/src/phpcvs/php3" /I /usr/src/mysql/include" " " /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)\mysql.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib libmysql.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\php3_mysql.pdb" /machine:I386 /out:"$(OUTDIR)\php3_mysql.dll" /implib:"$(OUTDIR)\php3_mysql.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\mysql.obj"
-
-"$(OUTDIR)\php3_mysql.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "mysql - Win32 Debug"
-
-OUTDIR=c:\php3
-INTDIR=.\module_debug
-# Begin Custom Macros
-OutDir=c:\php3
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_mysql.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\mysql.obj"
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(OUTDIR)\php3_mysql.dll"
- -@erase "$(OUTDIR)\php3_mysql.exp"
- -@erase "$(OUTDIR)\php3_mysql.ilk"
- -@erase "$(OUTDIR)\php3_mysql.lib"
- -@erase "$(OUTDIR)\php3_mysql.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-"$(INTDIR)" :
- if not exist "$(INTDIR)/$(NULL)" mkdir "$(INTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../include" /D HAVE_MYSQL=1 /D HAVE_ERRMSG_H=1 /D "DEBUG" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\mysql.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /I /usr/src/phpcvs/php3" /I /usr/src/mysql/include" " " /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)\mysql.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib libmysql.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\php3_mysql.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_mysql.dll" /implib:"$(OUTDIR)\php3_mysql.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\mysql.obj"
-
-"$(OUTDIR)\php3_mysql.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("mysql.dep")
-!INCLUDE "mysql.dep"
-!ELSE
-!MESSAGE Warning: cannot find "mysql.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "mysql - Win32 Release" || "$(CFG)" == "mysql - Win32 Debug"
-SOURCE=.\functions\mysql.c
-
-"$(INTDIR)\mysql.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/objects b/objects
deleted file mode 100644
index 0f03da1fe0..0000000000
--- a/objects
+++ /dev/null
@@ -1,7 +0,0 @@
-<?
-
-$a->foo[4][32]["bar"] = 9;
-
-print "------------------------------\n";
-
-$a->foo[4][32]["bar"];
diff --git a/output.c b/output.c
deleted file mode 100644
index 61abce7dc5..0000000000
--- a/output.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | The contents of this source file is the sole property of Andi |
- | Gutmans and Zeev Suraski, and may not be distributed without prior |
- | written permission from both of them. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "php.h"
-#include "functions/head.h"
-
-/* output functions */
-int (*zend_body_write)(const char *str, uint str_length); /* string output */
-int (*zend_header_write)(const char *str, uint str_length); /* unbuffer string output */
-static int zend_ub_body_write(const char *str, uint str_length);
-static int zend_b_body_write(const char *str, uint str_length);
-
-/* output buffering */
-static char *ob_buffer;
-static uint ob_buffer_size;
-static uint ob_block_size;
-static uint ob_text_length;
-void zend_ob_init(uint initial_size, uint block_size);
-void zend_ob_destroy();
-void zend_ob_append(const char *text, uint text_length);
-void zend_ob_prepend(const char *text, uint text_length);
-static inline void zend_ob_send();
-
-/* HEAD support */
-static int header_request;
-
-/* wrappers */
-#if APACHE
-static int zend_apache_ub_write(const char *str, uint str_length);
-#elif CGI_BINARY
-static int zend_cgibin_ub_write(const char *str, uint str_length);
-#endif
-
-
-/*
- * Main
- */
-
-void zend_output_startup()
-{
- ob_buffer = NULL;
- zend_body_write = zend_ub_body_write;
- header_request=0;
-#if APACHE
- zend_header_write = zend_apache_ub_write;
-#elif CGI_BINARY
- zend_header_write = zend_cgibin_ub_write;
-#endif
-}
-
-
-void zend_start_ob_buffering()
-{
- zend_ob_init(4096, 1024);
- zend_body_write = zend_b_body_write;
-}
-
-
-void zend_end_ob_buffering(int send_buffer)
-{
- if (!ob_buffer) {
- return;
- }
- zend_body_write = zend_ub_body_write;
- if (send_buffer) {
- zend_ob_send();
- }
- zend_ob_destroy();
-}
-
-
-/*
- * Output buffering - implementation
- */
-
-static inline void zend_ob_allocate()
-{
- if (ob_buffer_size<ob_text_length) {
- while ((ob_buffer_size+=ob_block_size) < ob_text_length);
- ob_buffer = (char *) erealloc(ob_buffer, ob_buffer_size+1);
- }
-}
-
-
-void zend_ob_init(uint initial_size, uint block_size)
-{
- if (ob_buffer) {
- return;
- }
- ob_block_size = block_size;
- ob_buffer_size = initial_size;
- ob_buffer = (char *) emalloc(initial_size+1);
- ob_text_length = 0;
-}
-
-
-void zend_ob_destroy()
-{
- if (ob_buffer) {
- efree(ob_buffer);
- ob_buffer = NULL;
- }
-}
-
-
-void zend_ob_append(const char *text, uint text_length)
-{
- char *target;
- int original_ob_text_length=ob_text_length;
-
- ob_text_length += text_length;
- zend_ob_allocate();
- target = ob_buffer+original_ob_text_length;
- memcpy(target, text, text_length);
- target[text_length]=0;
-}
-
-
-void zend_ob_prepend(const char *text, uint text_length)
-{
- char *p, *start;
-
- ob_text_length += text_length;
- zend_ob_allocate();
-
- /* zend_ob_allocate() may change ob_buffer, so we can't initialize p&start earlier */
- p = ob_buffer+ob_text_length;
- start = ob_buffer;
-
- while (--p>=start) {
- p[text_length] = *p;
- }
- memcpy(ob_buffer, text, text_length);
- ob_buffer[ob_text_length]=0;
-}
-
-
-static inline void zend_ob_send()
-{
- /* header_write is a simple, unbuffered output function */
- zend_body_write(ob_buffer, ob_text_length);
-}
-
-
-int zend_ob_get_buffer(pval *p)
-{
- if (!ob_buffer) {
- return FAILURE;
- }
- p->type = IS_STRING;
- p->value.str.val = estrndup(ob_buffer, ob_text_length);
- p->value.str.len = ob_text_length;
- return SUCCESS;
-}
-
-
-/*
- * Wrapper functions - implementation
- */
-
-
-/* buffered output function */
-static int zend_b_body_write(const char *str, uint str_length)
-{
- zend_ob_append(str, str_length);
- return str_length;
-}
-
-
-static int zend_ub_body_write(const char *str, uint str_length)
-{
- if (header_request) {
- zend_bailout();
- }
- if (php3_header()) {
- return zend_header_write(str, str_length);
- } else {
- return 0;
- }
-}
-
-
-#if APACHE
-
-static int zend_apache_ub_write(const char *str, uint str_length)
-{
- if (GLOBAL(php3_rqst)) {
- return rwrite(str, str_length, GLOBAL(php3_rqst));
- } else {
- return fwrite(str, 1, str_length, stdout);
- }
-}
-
-#elif CGI_BINARY
-
-static int zend_cgibin_ub_write(const char *str, uint str_length)
-{
- return fwrite(str, 1, str_length, stdout);
-}
-
-
-
-#endif
-
-
-/*
- * HEAD support
- */
-
-void set_header_request(int value)
-{
- header_request = value;
-}
diff --git a/output.h b/output.h
deleted file mode 100644
index dabb9425c5..0000000000
--- a/output.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _OUTPUT_BUFFER
-#define _OUTPUT_BUFFER
-
-#include "php.h"
-
-void zend_output_startup();
-
-/* exported output functions */
-int (*zend_body_write)(const char *str, uint str_length); /* string output */
-int (*zend_header_write)(const char *str, uint str_length); /* unbuffer string output */
-void zend_start_ob_buffering();
-void zend_end_ob_buffering(int send_buffer);
-int zend_ob_get_buffer(pval *p);
-
-/* HEAD support */
-void set_header_request(int value);
-
-#endif /* _OUTPUT_BUFFER */ \ No newline at end of file
diff --git a/php3.ini-dist b/php3.ini-dist
deleted file mode 100644
index 22542a0ebe..0000000000
--- a/php3.ini-dist
+++ /dev/null
@@ -1,243 +0,0 @@
-[PHP_3]
-
-;;;;;;;;;;;;;;;;;;;
-; About this file ;
-;;;;;;;;;;;;;;;;;;;
-; This file controls many aspects of PHP's behavior. In order for PHP to
-; read it, it must be named 'php3.ini'. PHP looks for it in the current
-; working directory, in the path designated by the environment variable
-; PHPRC, and in the path that was defined in compile time (in that order).
-; Under Windows, the compile-time path is the Windows directory. The
-; path in which the php3.ini file is looked for can be overriden using
-; the -c argument in command line mode.
-;
-; The syntax of the file is extremely simple. Whitespace and Lines
-; beginning with a semicolon are silently ignored (as you probably guessed).
-; Section headers (e.g. [Foo]) are also silently ignored, even though
-; they might mean something in the future (they probably won't).
-;
-; Options are specified using the syntax key = value or key = "complex value".
-; Key names are *case sensitive*. foo = bar is different from FOO = bar.
-; 'value' can be any number, word or keyword (keywords are On, Off, True,
-; False, Yes and No, and are case insensitive).
-; 'complex value' can be just about anything, expcept for " and a newline
-; Boolean flags can be turned on using the values 1, On, True or Yes.
-; They can be turned off using the values 0, Off, False or No.
-;
-; All the values in the php3.ini-dist file correspond to the builtin
-; defaults (that is, if no php3.ini is used, or if you delete these lines,
-; the builtin defaults will be identical).
-
-
-;;;;;;;;;;;;;;;;;;;;
-; Language Options ;
-;;;;;;;;;;;;;;;;;;;;
-
-engine = On ; enable PHP 3.0 parser
-short_open_tag = On ; allow the <? tag. otherwise, only <?php and <script> tags are recognized.
-asp_tags = Off ; allow ASP-style <% %> tags
-precision = 14 ; number of significant digits displayed in floating point numbers
-y2k_compliance = Off ; whether to be year 2000 compliant (will cause problems with non y2k compliant browsers)
-; Safe Mode
-safe_mode = Off
-safe_mode_exec_dir =
-; Colors for Syntax Highlighting mode. Anything that's acceptable in <font color=???> would work.
-highlight.string = #DD0000
-highlight.comment = #FF8000
-highlight.keyword = #007700
-highlight.bg = #FFFFFF
-highlight.default = #0000BB
-highlight.html = #000000
-
-
-;;;;;;;;;;;;;;;;;;;
-; Resource Limits ;
-;;;;;;;;;;;;;;;;;;;
-
-max_execution_time = 30 ; Maximum execution time of each script, in seconds
-memory_limit = 8388608 ; Maximum amount of memory a script may consume (8MB)
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; Error handling and logging ;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-; error_reporting is a bit-field. Add each number up to get desired error reporting level
-; 1 = Normal errors
-; 2 = Normal warnings
-; 4 = Parser errors
-; 8 = Notices - warnings you can ignore, but sometimes imply a bug (e.g., using an uninitialized variable)
-error_reporting = 7
-display_errors = On ; Print out errors (as a part of the HTML script)
-log_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below))
-track_errors = Off ; Store the last error/warning message in $php_errormsg (boolean)
-;error_prepend_string = "<font color=ff0000>" ; string to output before an error message
-;error_append_string = "</font>" ; string to output after an error message
-;error_log = filename ; log errors to specified file
-;error_log = syslog ; log errors to syslog (Event Log on NT, not valid in Windows 95)
-warn_plus_overloading = Off ; warn if the + operator is used with strings
-
-
-;;;;;;;;;;;;;;;;;
-; Data Handling ;
-;;;;;;;;;;;;;;;;;
-magic_quotes_gpc = On ; magic quotes for incoming GET/POST/Cookie data
-magic_quotes_runtime= Off ; magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
-magic_quotes_sybase = Off ; Use Sybase-style magic quotes (escape ' with '' instead of \')
-track_vars = On ; enable $HTTP_GET_VARS[], $HTTP_POST_VARS[] and $HTTP_COOKIE_VARS[] arrays
-; automatically add files before or after any PHP 3.0 document
-auto_prepend_file =
-auto_append_file =
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;
-; Paths and Directories ;
-;;;;;;;;;;;;;;;;;;;;;;;;;
-include_path = ; UNIX: "/path1:/path2" Windows: "\path1;\path2"
-doc_root = ; the root of the php pages, used only if nonempty
-user_dir = ; the directory under which php opens the script using /~username, used only if nonempty
-;upload_tmp_dir = ; temporary directory for HTTP uploaded files (will use system default if not specified)
-upload_max_filesize = 2097152 ; 2 Meg default limit on file uploads
-extension_dir = ./ ; directory in which the loadable extensions (modules) reside
-
-
-;;;;;;;;;;;;;;;;;;;;;;
-; Dynamic Extensions ;
-;;;;;;;;;;;;;;;;;;;;;;
-; if you wish to have an extension loaded automaticly, use the
-; following syntax: extension=modulename.extension
-; for example, on windows,
-; extension=msql.dll
-; or under UNIX,
-; extension=msql.so
-; Note that it should be the name of the module only, no directory information
-; needs to go here. Specify the location of the extension with the extension_dir directive above.
-
-
-;Windows Extensions
-;extension=php3_mysql.dll
-;extension=php3_nsmail.dll
-;extension=php3_calendar.dll
-;extension=php3_dbase.dll
-;extension=php3_filepro.dll
-;extension=php3_gd.dll
-;extension=php3_dbm.dll
-;extension=php3_mssql.dll
-;extension=php3_zlib.dll
-;extension=php3_filepro.dll
-;extension=php3_imap4r2.dll
-;extension=php3_ldap.dll
-;extension=php3_crypt.dll
-;extension=php3_msql2.dll
-;extension=php3_odbc.dll
-
-;;;;;;;;;;;;;;;;;;;
-; Module Settings ;
-;;;;;;;;;;;;;;;;;;;
-
-[Syslog]
-define_syslog_variables = Off ; Whether or not to define the various syslog variables,
- ; e.g. $LOG_PID, $LOG_CRON, etc. Turning it off is a
- ; good idea performance-wise. In runtime, you can define
- ; these variables by calling define_syslog_variables()
-
-
-[mail function]
-SMTP = localhost ;for win32 only
-sendmail_from = me@localhost.com ;for win32 only
-sendmail_path = ;for unix only, may supply arguments as well (default is sendmail -t)
-
-[Debugger]
-debugger.host = localhost
-debugger.port = 7869
-debugger.enabled = False
-
-[Logging]
-; These configuration directives are used by the example logging mechanism.
-; See examples/README.logging for more explanation.
-;logging.method = db
-;logging.directory = /path/to/log/directory
-
-[SQL]
-sql.safe_mode = Off
-
-[ODBC]
-;uodbc.default_db = Not yet implemented
-;uodbc.default_user = Not yet implemented
-;uodbc.default_pw = Not yet implemented
-uodbc.allow_persistent = On ; allow or prevent persistent links
-uodbc.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-uodbc.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-uodbc.defaultlrl = 4096 ; Handling of LONG fields. Returns number of bytes to variables, 0 means passthru
-uodbc.defaultbinmode = 1 ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char
-; See the documentation on odbc_binmode and odbc_longreadlen for an explanation of uodbc.defaultlrl
-; and uodbc.defaultbinmode
-
-[MySQL]
-mysql.allow_persistent = On ; allow or prevent persistent link
-mysql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-mysql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-mysql.default_port = ; default port number for mysql_connect(). If unset,
- ; mysql_connect() will use the $MYSQL_TCP_PORT, or the mysql-tcp
- ; entry in /etc/services, or the compile-time defined MYSQL_PORT
- ; (in that order). Win32 will only look at MYSQL_PORT.
-mysql.default_host = ; default host for mysql_connect() (doesn't apply in safe mode)
-mysql.default_user = ; default user for mysql_connect() (doesn't apply in safe mode)
-mysql.default_password = ; default password for mysql_connect() (doesn't apply in safe mode)
- ; Note that this is generally a *bad* idea to store passwords
- ; in this file. *Any* user with PHP access can run
- ; 'echo cfg_get_var("mysql.default_password")' and reveal that
- ; password! And of course, any users with read access to this
- ; file will be able to reveal the password as well.
-
-[mSQL]
-msql.allow_persistent = On ; allow or prevent persistent link
-msql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-msql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[PostgresSQL]
-pgsql.allow_persistent = On ; allow or prevent persistent link
-pgsql.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-pgsql.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-
-[Sybase]
-sybase.allow_persistent = On ; allow or prevent persistent link
-sybase.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybase.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-;sybase.interface_file = "/usr/sybase/interfaces"
-sybase.min_error_severity = 10 ; minimum error severity to display
-sybase.min_message_severity = 10 ; minimum message severity to display
-sybase.compatability_mode = Off ; compatability mode with earlier versions of PHP 3.0.
- ; If on, this will cause PHP to automatically assign types to results
- ; according to their Sybase type, instead of treating them all as
- ; strings. This compatability mode will probably not stay around
- ; forever, so try applying whatever necessary changes to your code,
- ; and turn it off.
-
-[Sybase-CT]
-sybct.allow_persistent = On ; allow or prevent persistent link
-sybct.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-sybct.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-sybct.min_server_severity = 10 ; minimum server message severity to display
-sybct.min_client_severity = 10 ; minimum client message severity to display
-
-[bcmath]
-bcmath.scale = 0 ; number of decimal digits for all bcmath functions
-
-[browscap]
-;browscap = extra/browscap.ini
-
-[Informix]
-ifx.default_host = ; default host for ifx_connect() (doesn't apply in safe mode)
-ifx.default_user = ; default user for ifx_connect() (doesn't apply in safe mode)
-ifx.default_password = ; default password for ifx_connect() (doesn't apply in safe mode)
-ifx.allow_persistent = On ; allow or prevent persistent link
-ifx.max_persistent = -1 ; maximum number of persistent links. -1 means no limit
-ifx.max_links = -1 ; maximum number of links (persistent+non persistent). -1 means no limit
-ifx.textasvarchar = 0 ; if set on, select statements return the contents of a text blob instead of it's id
-ifx.byteasvarchar = 0 ; if set on, select statements return the contents of a byte blob instead of it's id
-ifx.charasvarchar = 0 ; trailing blanks are stripped from fixed-length char columns. May help the life
- ; of Informix SE users.
-ifx.blobinfile = 0 ; if set on, the contents of text&byte blobs are dumped to a file instead of
- ; keeping them in memory
-ifx.nullformat = 0 ; NULL's are returned as empty strings, unless this is set to 1. In that case,
- ; NULL's are returned as string 'NULL'.
diff --git a/php3_realpath.c b/php3_realpath.c
deleted file mode 100644
index 44ef3f9a23..0000000000
--- a/php3_realpath.c
+++ /dev/null
@@ -1,290 +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. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-
-#include "php.h"
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <sys/stat.h>
-
-#ifndef MAXSYMLINKS
-#define MAXSYMLINKS 32
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
-#endif
-
-char *_php3_realpath(char *path, char resolved_path[]);
-
-char *_php3_realpath(char *path, char resolved_path []) {
- char path_construction[MAXPATHLEN]; /* We build the result in here */
- char *writepos; /* Position to write next char */
-
- char path_copy[MAXPATHLEN]; /* A work-copy of the path */
- char *workpos; /* working position in *path */
-
-#if !(WIN32|WINNT)
- char buf[MAXPATHLEN]; /* Buffer for readlink */
- int linklength; /* The result from readlink */
-#endif
- int linkcount = 0; /* Count symlinks to avoid loops */
-
- struct stat filestat; /* result from stat */
-
-#if WIN32|WINNT
- char *temppos; /* position while counting '.' */
- int dotcount; /* number of '.' */
- int t; /* counter */
-#endif
-
- /* Set the work-position to the beginning of the given path */
- strcpy(path_copy, path);
- workpos = path_copy;
-
-#if WIN32|WINNT
- /* Find out where we start - Windows version */
- if ((*workpos == '\\') || (*workpos == '/')) {
- /* We start at the root of the current drive */
- /* Get the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- /* We only need the first three chars (for example "C:\") */
- path_construction[3] = 0;
- workpos++;
- } else if (workpos[1] == ':') {
- /* A drive-letter is specified, copy it */
- strncpy(path_construction, path, 2);
- strcat(path_construction, "\\");
- workpos++;
- workpos++;
- } else {
- /* Use the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "\\");
- }
-#else
- /* Find out where we start - Unix version */
- if (*workpos == '/') {
- /* We start at the root */
- strcpy(path_construction, "/");
- workpos++;
- } else {
- /* Use the current directory */
- if (getcwd(path_construction, MAXPATHLEN-1) == NULL) {
- /* Unable to get cwd */
- resolved_path[0] = 0;
- return NULL;
- }
- strcat(path_construction, "/");
- }
-#endif
-
- /* Set the next-char-position */
- writepos = &path_construction[strlen(path_construction)];
-
- /* Go to the end, then stop */
- while(*workpos != 0) {
- /* Strip (back)slashes */
-#if WIN32|WINNT
- while(*workpos == '\\') workpos++;
-#else
- while(*workpos == '/') workpos++;
-#endif
-
-#if WIN32|WINNT
- /* reset dotcount */
- dotcount = 0;
-
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- /* Windows accepts \...\ as \..\..\, \....\ as \..\..\..\, etc */
- /* At least Win98 does */
-
- temppos = workpos;
- while(*temppos++ == '.') {
- dotcount++;
- if ((*temppos != '\\') && (*temppos != 0) && (*temppos != '.')) {
- /* This is not a /../ component, but a filename that starts with '.' */
- dotcount = 0;
- }
- }
-
- /* Go back dotcount-1 times */
- for (t=0 ; t<(dotcount-1) ; t++) {
- workpos++; /* move to next '.' */
-
- /* Can we still go back? */
- if ((writepos-3) <= path_construction) return NULL;
-
- /* Go back */
- writepos--; /* move to '\' */
- while(*--writepos != '\\') ; /* skip until previous '\\' */
- }
- }
-
- /* No special case */
- if (dotcount == 0) {
- /* Append */
- while((*workpos != '\\') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
- /* Just one '.', go to next element */
- if (dotcount == 1) {
- while((*workpos != '\\') && (*workpos != 0)) {
- *workpos++;
- }
-
- /* Avoid double \ in the result */
- writepos--;
- }
-
- /* If it was a directory, append a slash */
- if (*workpos == '\\') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#else /* WIN32|WINNT */
- /* Look for .. */
- if ((workpos[0] == '.') && (workpos[1] != 0)) {
- if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
- /* One directory back */
- /* Set pointers to right position */
- workpos++; /* move to second '.' */
- workpos++; /* move to '/' */
-
- /* Only apply .. if not in root */
- if ((writepos-1) > path_construction) {
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- }
- } else {
- if (workpos[1] == '/') {
- /* Found a /./ skip it */
- workpos++; /* move to '/' */
-
- /* Avoid double / in the result */
- writepos--;
- } else {
- /* No special case, the name just started with a . */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
- }
- } else {
- /* No special case */
- /* Append */
- while((*workpos != '/') && (*workpos != 0)) {
- *writepos++ = *workpos++;
- }
- }
-
-#if HAVE_SYMLINK
- /* We are going to use path_construction, so close it */
- *writepos = 0;
-
- /* Check the current location to see if it is a symlink */
- if((linklength = readlink(path_construction, buf, MAXPATHLEN)) != -1) {
- /* Check linkcount */
- if (linkcount > MAXSYMLINKS) return NULL;
-
- /* Count this symlink */
- linkcount++;
-
- /* Set end of buf */
- buf[linklength] = 0;
-
- /* Check for overflow */
- if ((strlen(workpos) + strlen(buf) + 1) >= MAXPATHLEN) return NULL;
-
- /* Remove the symlink-component wrom path_construction */
- writepos--; /* move to '/' */
- while(*--writepos != '/') ; /* skip until previous '/' */
- *++writepos = 0; /* end of string after '/' */
-
- /* If the symlink starts with a '/', empty path_construction */
- if (*buf == '/') {
- *path_construction = 0;
- writepos = path_construction;
- }
-
- /* Insert symlink into path_copy */
- strcat(buf, workpos);
- strcpy(path_copy, buf);
- workpos = path_copy;
- }
-#endif /* HAVE_SYMLINK */
-
- /* If it was a directory, append a slash */
- if (*workpos == '/') {
- *writepos++ = *workpos++;
- }
- *writepos = 0;
-#endif /* WIN32|WINNT */
- }
-
- /* Check if the resolved path is a directory */
- if (stat(path_construction, &filestat) != 0) return NULL;
- if (S_ISDIR(filestat.st_mode)) {
- /* It's a directory, append a / if needed */
- if (*(writepos-1) != '/') {
- /* Check for overflow */
- if ((strlen(workpos) + 2) >= MAXPATHLEN) return NULL;
-
- *writepos++ = '/';
- *writepos = 0;
- }
- }
-
- strcpy(resolved_path, path_construction);
- return resolved_path;
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/php3_realpath.h b/php3_realpath.h
deleted file mode 100644
index 3695447eb4..0000000000
--- a/php3_realpath.h
+++ /dev/null
@@ -1,41 +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. |
- +----------------------------------------------------------------------+
- | Author: Sander Steffann (sander@steffann.nl) |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _PHP3_REALPATH_H_
-#define _PHP3_REALPATH_H_
-
-extern char *_php3_realpath(const char *path, char resolved_path []);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/php3_sprintf.c b/php3_sprintf.c
deleted file mode 100644
index f90a46b356..0000000000
--- a/php3_sprintf.c
+++ /dev/null
@@ -1,54 +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: Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
- | |
- +----------------------------------------------------------------------+
- */
-
-/* $Id$ */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdarg.h>
-
-#if BROKEN_SPRINTF
-
-int
-_php3_sprintf (char*s, const char* format, ...)
-{
- va_list args;
- char *ret;
-
- va_start (args, format);
- s[0] = '\0';
- ret = vsprintf (s, format, args);
- va_end (args);
- if (!ret)
- return -1;
- return strlen (s);
-}
-
-#endif /* BROKEN_SPRINTF */
diff --git a/php3_threads.c b/php3_threads.c
deleted file mode 100644
index 6218f8fe67..0000000000
--- a/php3_threads.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <stdio.h>
-#include "alloc.h"
-#include <errno.h>
-#if (WIN32|WINNT)
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-#include "php3_threads.h"
-
-/* Function for allocating memory for mutexes */
-static void *php3_mutex_alloc( void )
-{
- MUTEX_T *mutexp;
- /* Allocate memory for the mutex and initialize it */
- if ( (mutexp = emalloc( sizeof(MUTEX_T) )) != NULL ) {
- MUTEX_INIT( mutexp, NULL );
- }
- return( mutexp );
-}
-
-/* Function for freeing mutexes */
-static void php3_mutex_free( void *mutexp )
-{
- MUTEX_DESTROY( (MUTEX_T *) mutexp );
-}
-
-static void php3_mutex_lock( void *mutexp )
-{
- return MUTEX_LOCK(mutexp);
-}
-
-static void php3_mutex_unlock( void *mutexp )
-{
- return MUTEX_UNLOCK(mutexp);
-}
-
-/* Function for setting up thread-specific data */
-/* should be called at thread start */
-int php3_tls_init(void *key,void *tsd,int size)
-{
- /* Check if thread-specific data already exists */
- tsd = TLS_GET_DATA( key );
- if ( tsd != NULL ) {
- /*FIXME what kind of output here? */
- fprintf( stderr, "php3_tls_setup tls var non-null!\n" );
- THREAD_EXIT( NULL );
- }
- /* Allocate memory for the LDAP error values */
- tsd = (void *) ecalloc( 1, size );
- /* Make the data specific to the calling thread */
- TLS_SET_DATA( key, tsd );
-}
-
-/*should be called before thread exit*/
-int php3_tls_free(void *key, void *tsd)
-{
- if (tsd)efree(tsd);
-}
-
-/*should be called at dl or process startup*/
-int php3_tls_startup(void *key)
-{
- if (key == NULL){
- if (TLS_ALLOC(key)==TLS_NOT_ALLOCED)
- return 0;
- }
- return 1;
-}
-
-/*should be called before dl or process exit*/
-int php3_tls_shutdown(void *key)
-{
- if (key != NULL){
- if (!TLS_FREE(key))
- return 0;
- }
- return 1;
-} \ No newline at end of file
diff --git a/php3_threads.h b/php3_threads.h
deleted file mode 100644
index 62fb4f8c08..0000000000
--- a/php3_threads.h
+++ /dev/null
@@ -1,33 +0,0 @@
-
-#if WIN32|WINNT
-#define MUTEX_T void
-#define MUTEX_INIT(a,b) (a=CreateMutex(b,FALSE,NULL))
-#define MUTEX_DESTROY(a) CloseHandle(a)
-#define MUTEX_LOCK(a) WaitForSingleObject(a,INFINITE)
-#define MUTEX_UNLOCK(a) ReleaseMutex(a)
-#define TLS_ALLOC(a) (a=TlsAlloc())
-#define TLS_NOT_ALLOCED 0xFFFFFFFF
-#define TLS_GET_DATA(a) TlsGetValue(a)
-#define TLS_SET_DATA(a,b) TlsSetValue(a,b)
-#define TLS_FREE(a) TlsFree(a)
-#else /*PTHREADS*/
-#define MUTEX_T pthread_mutex_t
-#define MUTEX_INIT(a,b) pthread_mutex_init(a,b)
-#define MUTEX_DESTROY(a) pthread_mutex_destroy(a)
-#define MUTEX_LOCK(a) pthread_mutex_lock(a)
-#define MUTEX_UNLOCK(a) pthread_mutex_unlock(a)
-#define TLS_ALLOC(a)
-#define TLS_NOT_ALLOCED NULL
-#define TLS_GET_DATA(a) pthread_getspecific(a)
-#define TLS_SET_DATA(a,b) pthread_setspecific(a,b)
-#define TLS_FREE(a)
-#endif
-
-extern static void *php3_mutex_alloc( void );
-extern static void php3_mutex_free( void *mutexp );
-extern static void php3_mutex_lock( void *mutexp );
-extern static void php3_mutex_unlock( void *mutexp );
-extern int php3_tls_init(void *key,void *tsd,int size);
-extern int php3_tls_free(void *key, void *tsd);
-extern int php3_tls_startup(void *key);
-extern int php3_tls_shutdown(void *key);
diff --git a/php3extra.dsw b/php3extra.dsw
deleted file mode 100644
index 3918b27762..0000000000
--- a/php3extra.dsw
+++ /dev/null
@@ -1,41 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "convertor"=.\convertor\convertor.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpwatch"=.\extra\phpwatch\phpwatch.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/php3sapi.dsw b/php3sapi.dsw
deleted file mode 100644
index b27b00a29b..0000000000
--- a/php3sapi.dsw
+++ /dev/null
@@ -1,89 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "apache"=.\apache.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpsapi_cgi"=.\phpsapi_cgi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpsapi_core"=.\phpsapi_core.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpsapi_core_lib"=.\phpsapi_core_lib.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpsapi_isapi"=.\phpsapi_isapi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "phpsapi_nsapi"=.\phpsapi_nsapi.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/php4.dsp b/php4.dsp
deleted file mode 100644
index e66b5ed96f..0000000000
--- a/php4.dsp
+++ /dev/null
@@ -1,685 +0,0 @@
-# Microsoft Developer Studio Project File - Name="php4" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=php4 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "php4.mak" CFG="php4 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php4 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "php4 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "php4 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "cgi_release"
-# PROP Intermediate_Dir "cgi_release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "c:\projects\php4\include" /I "c:\projects\libzend" /I "." /I "regex\\" /I "d:\src\bind\include" /I "c:\projects\sapi" /D "NDEBUG" /D "MSVC5" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "COMPILE_LIBZEND" /Fr /FD /c
-# SUBTRACT CPP /YX /Yc /Yu
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 lib44bsd95.lib resolv.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /version:3.0 /subsystem:console /machine:I386 /out:"cgi_release\php.exe" /libpath:"c:\Projects\php4\lib" /libpath:"\src\lib" /libpath:"d:\src\bind\lib" /libpath:"c:\projects\sapi\release" /libpath:"c:\projects\libzend\release"
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "c:\projects\zend\cgi_debug"
-# PROP Intermediate_Dir "cgi_debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "c:\projects\php4\include" /I "c:\projects\libzend" /I "." /I "regex\\" /I "d:\src\bind\include" /I "c:\projects\sapi" /D "DEBUG" /D "_DEBUG" /D "MSVC5" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "COMPILE_LIBZEND" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /i "c:\include" /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 lib44bsd95.lib resolv.lib winmm.lib wsock32.lib netapi32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SAPI.lib libzend.lib /nologo /version:3.0 /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /nodefaultlib:"libcd" /out:"cgi_debug\php.exe" /pdbtype:sept /libpath:"c:\Projects\php4\lib" /libpath:"\src\lib" /libpath:"d:\src\bind\lib" /libpath:"c:\projects\sapi\debug" /libpath:"c:\projects\libzend\debug"
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "php4 - Win32 Release"
-# Name "php4 - Win32 Debug"
-# Begin Group "Core"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=".\configuration-parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\configuration-scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\cyr_convert.c
-# End Source File
-# Begin Source File
-
-SOURCE=".\fopen-wrappers.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\getopt.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\internal_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\output.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php3_realpath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ini.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\quot_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\request_info.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\safe_mode.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\config.w32.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\configuration-parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\configuration-parser.tab.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\control_structures.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\cyr_convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\getopt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\internal_functions_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\logos.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\main.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\output.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php3_compat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php3_realpath.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_globals.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\php_ini.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\quot_print.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\request_info.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\safe_mode.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win95nt.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Function Modules"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\functions\apache.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\basic_functions.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\bcmath.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\browscap.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\dir.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\dl.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\dns.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\exec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\filestat.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\formatted_print.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\fsock.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\head.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\html.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\image.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\info.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\iptc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\link.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\mail.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\math.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\md5.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\microtime.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\mime.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\number.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\odbc\odbc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\pack.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\pageinfo.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\post.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\rand.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\reg.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\soundex.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\string.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\syslog.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\type.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\uniqid.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\url.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\var.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 1"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ext\standard\base64.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\basic_functions.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\datetime.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\dl.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\dns.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\exec.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\file.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\fsock.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\global.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\head.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\html.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\md5.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\mime.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\number.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\pageinfo.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_bcmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_dir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_filestat.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_ldap.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\php3_mail.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\odbc\php3_odbc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\php3_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_string.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\php3_syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\phpdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\phpmath.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\functions\post.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\reg.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\type.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\uniqid.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\ext\standard\url.h
-# End Source File
-# End Group
-# Begin Group "Regular Expressions"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\regex\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regex\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regex\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regex\regfree.c
-# End Source File
-# End Group
-# End Group
-# Begin Group "Win32"
-
-# PROP Default_Filter ""
-# Begin Group "Source Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\functions\COM.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\pwd.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\readdir.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\sendmail.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\time.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\wfile.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\dl\snmp\winsnmp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\winutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\wsyslog.c
-# End Source File
-# End Group
-# Begin Group "Header Files No. 2"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\win32\grp.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\param.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\php_registry.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\pwd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\readdir.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\sendmail.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\syslog.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\time.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\unistd.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\win32\wfile.h
-# End Source File
-# End Group
-# End Group
-# Begin Group "Parsers"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=".\configuration-parser.y"
-
-!IF "$(CFG)" == "php4 - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Debug"
-
-# Begin Custom Build
-InputDir=.
-InputPath=".\configuration-parser.y"
-
-BuildCmds= \
- bison --output=configuration-parser.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" -p cfg configuration-parser.y
-
-"$(InputDir)\configuration-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-
-"$(InputDir)\configuration-parser.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- $(BuildCmds)
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Scanners"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=".\configuration-scanner.l"
-
-!IF "$(CFG)" == "php4 - Win32 Release"
-
-!ELSEIF "$(CFG)" == "php4 - Win32 Debug"
-
-# Begin Custom Build
-InputPath=".\configuration-scanner.l"
-
-"configuration-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pcfg -oconfiguration-scanner.c configuration-scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/php4.dsw b/php4.dsw
deleted file mode 100644
index f423e89b4b..0000000000
--- a/php4.dsw
+++ /dev/null
@@ -1,44 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "libzend"=..\libzend\libzend.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "php4"=.\php4.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name libzend
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/php_custom_build.mak b/php_custom_build.mak
deleted file mode 100644
index 5f83769018..0000000000
--- a/php_custom_build.mak
+++ /dev/null
@@ -1,269 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on php_custom_build.dsp
-!IF "$(CFG)" == ""
-CFG=php_custom_build - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to php_custom_build - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "php_custom_build - Win32 Release" && "$(CFG)" != "php_custom_build - 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 "php_custom_build.mak" CFG="php_custom_build - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "php_custom_build - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "php_custom_build - 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
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-
-ALL : ".\language-scanner.c" ".\language-parser.c" ".\configuration-scanner.c" ".\configuration-parser.tab.c"
-
-
-CLEAN :
- -@erase
- -@erase "configuration-parser.tab.c"
- -@erase "configuration-scanner.c"
- -@erase "language-parser.c"
- -@erase "language-scanner.c"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\php_custom_build.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) $<
-<<
-
-RSC=rc.exe
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\php_custom_build.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\php_custom_build.lib"
-LIB32_OBJS= \
-
-
-!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-
-ALL : ".\language-scanner.c" ".\language-parser.tab.c" ".\configuration-scanner.c" ".\configuration-parser.tab.c"
-
-
-CLEAN :
- -@erase
- -@erase "configuration-parser.tab.c"
- -@erase "configuration-scanner.c"
- -@erase "language-parser.tab.c"
- -@erase "language-scanner.c"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MLd /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fp"$(INTDIR)\php_custom_build.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) $<
-<<
-
-RSC=rc.exe
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\php_custom_build.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\php_custom_build.lib"
-LIB32_OBJS= \
-
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("php_custom_build.dep")
-!INCLUDE "php_custom_build.dep"
-!ELSE
-!MESSAGE Warning: cannot find "php_custom_build.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release" || "$(CFG)" == "php_custom_build - Win32 Debug"
-SOURCE=".\configuration-parser.y"
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release"
-
-InputPath=".\configuration-parser.y"
-
-".\configuration-parser.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- bison.exe -p cfg -v -d configuration-parser.y
-<<
-
-
-!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
-
-InputPath=".\configuration-parser.y"
-
-".\configuration-parser.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- bison.exe -p cfg -v -d configuration-parser.y
-<<
-
-
-!ENDIF
-
-SOURCE=".\configuration-scanner.lex"
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release"
-
-InputPath=".\configuration-scanner.lex"
-
-".\configuration-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- flex.exe -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
-<<
-
-
-!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
-
-InputPath=".\configuration-scanner.lex"
-
-".\configuration-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- flex.exe -Pcfg -oconfiguration-scanner.c -i configuration-scanner.lex
-<<
-
-
-!ENDIF
-
-SOURCE=".\language-parser.y"
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release"
-
-InputPath=".\language-parser.y"
-
-".\language-parser.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- bison -p php -v -d language-parser.y
-<<
-
-
-!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
-
-InputPath=".\language-parser.y"
-
-".\language-parser.tab.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- bison.exe -p php -v -d language-parser.y
-<<
-
-
-!ENDIF
-
-SOURCE=".\language-scanner.lex"
-
-!IF "$(CFG)" == "php_custom_build - Win32 Release"
-
-InputPath=".\language-scanner.lex"
-
-".\language-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- flex -Pphp -olanguage-scanner.c -i language-scanner.lex
-<<
-
-
-!ELSEIF "$(CFG)" == "php_custom_build - Win32 Debug"
-
-InputPath=".\language-scanner.lex"
-
-".\language-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- flex -Pphp -olanguage-scanner.c -i language-scanner.lex
-<<
-
-
-!ENDIF
-
-
-!ENDIF
-
diff --git a/press-release-3.0.txt b/press-release-3.0.txt
deleted file mode 100644
index afef4b0cb4..0000000000
--- a/press-release-3.0.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-
- FOR IMMEDIATE RELEASE
-
- PHP 3.0 RELEASED
-
-June 6, 1998 -- The PHP Development Team announced the release of
-PHP 3.0, the latest release of the server-side scripting solution already
-in use on over 70,000 World Wide Web sites.
-
-This all-new version of the popular scripting language includes support
-for all major operating systems (Windows 95/NT, most versions of Unix,
-and Macintosh) and web servers (including Apache, Netscape servers,
-WebSite Pro, and Microsoft Internet Information Server).
-
-PHP 3.0 also supports a wide range of databases, including Oracle, Sybase,
-Solid, MySQ, mSQL, and PostgreSQL, as well as ODBC data sources.
-
-New features include persistent database connections, support for the
-SNMP and IMAP protocols, and a revamped C API for extending the language
-with new features.
-
-"PHP is a very programmer-friendly scripting language suitable for
-people with little or no programming experience as well as the
-seasoned web developer who needs to get things done quickly. The
-best thing about PHP is that you get results quickly," said
-Rasmus Lerdorf, one of the developers of the language.
-
-"Version 3 provides a much more powerful, reliable and efficient
-implementation of the language, while maintaining the ease of use and
-rapid development that were the key to PHP's success in the past",
-added Andi Gutmans, one of the implementors of the new language core.
-
-"At Circle Net we have found PHP to be the most robust platform for
-rapid web-based application development available today," said Troy
-Cobb, Chief Technology Officer at Circle Net, Inc. "Our use of PHP
-has cut our development time in half, and more than doubled our client
-satisfaction. PHP has enabled us to provide database-driven dynamic
-solutions which perform at phenomenal speeds."
-
-PHP 3.0 is available for free download in source form and binaries for
-several platforms at http://www.php.net/.
-
-The PHP Development Team is an international group of programmers who
-lead the open development of PHP and related projects.
-
-For more information, the PHP Development Team can be contacted at
-core@php.net.
diff --git a/recurse b/recurse
deleted file mode 100644
index 026394a9f4..0000000000
--- a/recurse
+++ /dev/null
@@ -1,21 +0,0 @@
-<?
-
-function factorial($n)
-{
- if ($n==0 || $n==1) {
- return 1;
- } else {
- return $n*factorial($n-1);
- }
-}
-
-
-for ($k=0; $k<10; $k++):
-for ($i=0,$sum=0; $i<150; $i++) {
- $sum = $sum+factorial($i);
-}
-endfor;
-
-print "\$sum=$sum\n";
-
-
diff --git a/regex/COPYRIGHT b/regex/COPYRIGHT
deleted file mode 100644
index d43362fbfc..0000000000
--- a/regex/COPYRIGHT
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
- software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
- explicit claim or by omission. Since few users ever read sources,
- credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
- misrepresented as being the original software. Since few users
- ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
diff --git a/regex/Makefile.in b/regex/Makefile.in
deleted file mode 100644
index 2ef89f767f..0000000000
--- a/regex/Makefile.in
+++ /dev/null
@@ -1,141 +0,0 @@
-SHELL = /bin/sh
-
-srcdir=@srcdir@
-VPATH=@srcdir@
-
-CC=@CC@
-RANLIB=@RANLIB@
-
-# You probably want to take -DREDEBUG out of CFLAGS, and put something like
-# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
-# internal assertion checking and some debugging facilities).
-# Put -Dconst= in for a pre-ANSI compiler.
-# Do not take -DPOSIX_MISTAKE out.
-# REGCFLAGS isn't important to you (it's for my use in some special contexts).
-CFLAGS=-I$(srcdir) -DPOSIX_MISTAKE @CFLAGS@
-
-# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
-# the Berkeley __P macro, put -b in.
-MKHFLAGS=
-
-# Flags for linking but not compiling, if any.
-LDFLAGS=@LDFLAGS@
-
-# Extra libraries for linking, if any.
-LIBS=
-
-# Internal stuff, should not need changing.
-OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
-OBJS=$(OBJPRODN) split.o debug.o main.o
-H=cclass.h cname.h regex2.h utils.h
-REGSRC=regcomp.c regerror.c regexec.c regfree.c
-ALLSRC=$(REGSRC) engine.c debug.c main.c split.c
-
-# Stuff that matters only if you're trying to lint the package.
-LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
-LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
-JUNKLINT=possible pointer alignment|null effect
-
-# arrangements to build forward-reference header files
-.SUFFIXES: .ih .h
-.c.ih:
- sh $(srcdir)/mkh $(MKHFLAGS) -p $< >$(srcdir)/$@
-
-all lib: libregex.a
-
-libregex.a: $(OBJPRODN)
- rm -f libregex.a
- ar cr libregex.a $(OBJPRODN)
- $(RANLIB) libregex.a
-
-default: r
-
-purge:
- rm -f *.o
-
-# stuff to build regex.h
-REGEXH=regex.h
-REGEXHSRC=regex2.h $(REGSRC)
-$(REGEXH): $(REGEXHSRC) mkh
- sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.h
- #cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
- #rm -f regex.tmp
-
-# dependencies
-$(OBJPRODN) debug.o: utils.h regex.h regex2.h
-regcomp.o: cclass.h cname.h regcomp.ih
-regexec.o: engine.c engine.ih
-regerror.o: regerror.ih
-debug.o: debug.ih
-main.o: main.ih
-
-# tester
-re: $(OBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
-
-# regression test
-r: re tests
- ./re <tests
- ./re -el <tests
- ./re -er <tests
-
-# 57 variants, and other stuff, for development use -- not useful to you
-ra: ./re tests
- -./re <tests
- -./re -el <tests
- -./re -er <tests
-
-rx: ./re tests
- ./re -x <tests
- ./re -x -el <tests
- ./re -x -er <tests
-
-t: ./re tests
- -time ./re <tests
- -time ./re -cs <tests
- -time ./re -el <tests
- -time ./re -cs -el <tests
-
-l: $(LINTC)
- lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint
-
-fullprint:
- ti README WHATSNEW notes todo | list
- ti *.h | list
- list *.c
- list regex.3 regex.7
-
-print:
- ti README WHATSNEW notes todo | list
- ti *.h | list
- list reg*.c engine.c
-
-
-mf.tmp: Makefile
- sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@
-
-DTRH=cclass.h cname.h regex2.h utils.h
-PRE=COPYRIGHT README WHATSNEW
-POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
-FILES=$(PRE) Makefile $(POST)
-DTR=$(PRE) Makefile=mf.tmp $(POST)
-dtr: $(FILES) mf.tmp
- makedtr $(DTR) >$@
- rm mf.tmp
-
-cio: $(FILES)
- cio $(FILES)
-
-rdf: $(FILES)
- rcsdiff -c $(FILES) 2>&1 | p
-
-# various forms of cleanup
-tidy:
- rm -f junk* core core.* *.core dtr *.tmp lint
-
-clean: tidy
- rm -f *.o *.s re libregex.a
-
-# don't do this one unless you know what you're doing
-spotless: clean
- rm -f mkh regex.h
diff --git a/regex/README b/regex/README
deleted file mode 100644
index cea9b67b66..0000000000
--- a/regex/README
+++ /dev/null
@@ -1,32 +0,0 @@
-alpha3.4 release.
-Thu Mar 17 23:17:18 EST 1994
-henry@zoo.toronto.edu
-
-See WHATSNEW for change listing.
-
-installation notes:
---------
-Read the comments at the beginning of Makefile before running.
-
-Utils.h contains some things that just might have to be modified on
-some systems, as well as a nested include (ugh) of <assert.h>.
-
-The "fake" directory contains quick-and-dirty fakes for some header
-files and routines that old systems may not have. Note also that
--DUSEBCOPY will make utils.h substitute bcopy() for memmove().
-
-After that, "make r" will build regcomp.o, regexec.o, regfree.o,
-and regerror.o (the actual routines), bundle them together into a test
-program, and run regression tests on them. No output is good output.
-
-"make lib" builds just the .o files for the actual routines (when
-you're happy with testing and have adjusted CFLAGS for production),
-and puts them together into libregex.a. You can pick up either the
-library or *.o ("make lib" makes sure there are no other .o files left
-around to confuse things).
-
-Main.c, debug.c, split.c are used for regression testing but are not part
-of the RE routines themselves.
-
-Regex.h goes in /usr/include. All other .h files are internal only.
---------
diff --git a/regex/WHATSNEW b/regex/WHATSNEW
deleted file mode 100644
index 6e82e1dae0..0000000000
--- a/regex/WHATSNEW
+++ /dev/null
@@ -1,92 +0,0 @@
-New in alpha3.4: The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release). The tests at the end of
-the tests file have accordingly been uncommented. The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3: The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways. The
-makefile has generally been cleaned up some. Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking. A workaround for a bug in some folks'
-<assert.h> has been added. And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2: Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches). Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns. The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts. The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully. "uchar" is no longer used as an internal type
-name (too many people have the same idea). Still the same old lousy
-performance, alas.
-
-New in alpha3.1: Basically nothing, this release is just a bookkeeping
-convenience. Stay tuned.
-
-New in alpha3.0: Performance is no better, alas, but some fixes have been
-made and some functionality has been added. (This is basically the "get
-it out the door in time for 4.4" release.) One bug fix: regfree() didn't
-free the main internal structure (how embarrassing). It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation. The REG_ATOI
-debugging interface has changed a bit. And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3: Split change list out of README, and moved flags notes
-into Makefile. Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD. Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG. The
-BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters. Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h". The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2: Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage. The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat. Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas. Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3: full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2: minor bits of cleanup. Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1: improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/regex/cclass.h b/regex/cclass.h
deleted file mode 100644
index 727cbb9255..0000000000
--- a/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/regex/cname.h b/regex/cname.h
deleted file mode 100644
index ff116e55e2..0000000000
--- a/regex/cname.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* character-name table */
-static struct cname {
- char *name;
- char code;
-} cnames[] = {
- { "NUL", '\0' },
- { "SOH", '\001' },
- { "STX", '\002' },
- { "ETX", '\003' },
- { "EOT", '\004' },
- { "ENQ", '\005' },
- { "ACK", '\006' },
- { "BEL", '\007' },
- { "alert", '\007' },
- { "BS", '\010' },
- { "backspace", '\b' },
- { "HT", '\011' },
- { "tab", '\t' },
- { "LF", '\012' },
- { "newline", '\n' },
- { "VT", '\013' },
- { "vertical-tab", '\v' },
- { "FF", '\014' },
- { "form-feed", '\f' },
- { "CR", '\015' },
- { "carriage-return", '\r' },
- { "SO", '\016' },
- { "SI", '\017' },
- { "DLE", '\020' },
- { "DC1", '\021' },
- { "DC2", '\022' },
- { "DC3", '\023' },
- { "DC4", '\024' },
- { "NAK", '\025' },
- { "SYN", '\026' },
- { "ETB", '\027' },
- { "CAN", '\030' },
- { "EM", '\031' },
- { "SUB", '\032' },
- { "ESC", '\033' },
- { "IS4", '\034' },
- { "FS", '\034' },
- { "IS3", '\035' },
- { "GS", '\035' },
- { "IS2", '\036' },
- { "RS", '\036' },
- { "IS1", '\037' },
- { "US", '\037' },
- { "space", ' ' },
- { "exclamation-mark", '!' },
- { "quotation-mark", '"' },
- { "number-sign", '#' },
- { "dollar-sign", '$' },
- { "percent-sign", '%' },
- { "ampersand", '&' },
- { "apostrophe", '\'' },
- { "left-parenthesis", '(' },
- { "right-parenthesis", ')' },
- { "asterisk", '*' },
- { "plus-sign", '+' },
- { "comma", ',' },
- { "hyphen", '-' },
- { "hyphen-minus", '-' },
- { "period", '.' },
- { "full-stop", '.' },
- { "slash", '/' },
- { "solidus", '/' },
- { "zero", '0' },
- { "one", '1' },
- { "two", '2' },
- { "three", '3' },
- { "four", '4' },
- { "five", '5' },
- { "six", '6' },
- { "seven", '7' },
- { "eight", '8' },
- { "nine", '9' },
- { "colon", ':' },
- { "semicolon", ';' },
- { "less-than-sign", '<' },
- { "equals-sign", '=' },
- { "greater-than-sign", '>' },
- { "question-mark", '?' },
- { "commercial-at", '@' },
- { "left-square-bracket", '[' },
- { "backslash", '\\' },
- { "reverse-solidus", '\\' },
- { "right-square-bracket", ']' },
- { "circumflex", '^' },
- { "circumflex-accent", '^' },
- { "underscore", '_' },
- { "low-line", '_' },
- { "grave-accent", '`' },
- { "left-brace", '{' },
- { "left-curly-bracket", '{' },
- { "vertical-line", '|' },
- { "right-brace", '}' },
- { "right-curly-bracket", '}' },
- { "tilde", '~' },
- { "DEL", '\177' },
- { NULL, 0 }
-};
diff --git a/regex/debug.c b/regex/debug.c
deleted file mode 100644
index c0feaeb169..0000000000
--- a/regex/debug.c
+++ /dev/null
@@ -1,242 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-#include "debug.ih"
-
-/*
- - regprint - print a regexp for debugging
- == void regprint(regex_t *r, FILE *d);
- */
-void
-regprint(r, d)
-regex_t *r;
-FILE *d;
-{
- register struct re_guts *g = r->re_g;
- register int i;
- register int c;
- register int last;
- int nincat[NC];
-
- fprintf(d, "%ld states, %d categories", (long)g->nstates,
- g->ncategories);
- fprintf(d, ", first %ld last %ld", (long)g->firststate,
- (long)g->laststate);
- if (g->iflags&USEBOL)
- fprintf(d, ", USEBOL");
- if (g->iflags&USEEOL)
- fprintf(d, ", USEEOL");
- if (g->iflags&BAD)
- fprintf(d, ", BAD");
- if (g->nsub > 0)
- fprintf(d, ", nsub=%ld", (long)g->nsub);
- if (g->must != NULL)
- fprintf(d, ", must(%ld) `%*s'", (long)g->mlen, (int)g->mlen,
- g->must);
- if (g->backrefs)
- fprintf(d, ", backrefs");
- if (g->nplus > 0)
- fprintf(d, ", nplus %ld", (long)g->nplus);
- fprintf(d, "\n");
- s_print(g, d);
- for (i = 0; i < g->ncategories; i++) {
- nincat[i] = 0;
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- nincat[i]++;
- }
- fprintf(d, "cc0#%d", nincat[0]);
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] == 1) {
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (g->categories[c] == i)
- break;
- fprintf(d, ", %d=%s", i, regchar(c));
- }
- fprintf(d, "\n");
- for (i = 1; i < g->ncategories; i++)
- if (nincat[i] != 1) {
- fprintf(d, "cc%d\t", i);
- last = -1;
- for (c = CHAR_MIN; c <= CHAR_MAX+1; c++) /* +1 does flush */
- if (c <= CHAR_MAX && g->categories[c] == i) {
- if (last < 0) {
- fprintf(d, "%s", regchar(c));
- last = c;
- }
- } else {
- if (last >= 0) {
- if (last != c-1)
- fprintf(d, "-%s",
- regchar(c-1));
- last = -1;
- }
- }
- fprintf(d, "\n");
- }
-}
-
-/*
- - s_print - print the strip for debugging
- == static void s_print(register struct re_guts *g, FILE *d);
- */
-static void
-s_print(g, d)
-register struct re_guts *g;
-FILE *d;
-{
- register sop *s;
- register cset *cs;
- register int i;
- register int done = 0;
- register sop opnd;
- register int col = 0;
- register int last;
- register sopno offset = 2;
-# define GAP() { if (offset % 5 == 0) { \
- if (col > 40) { \
- fprintf(d, "\n\t"); \
- col = 0; \
- } else { \
- fprintf(d, " "); \
- col++; \
- } \
- } else \
- col++; \
- offset++; \
- }
-
- if (OP(g->strip[0]) != OEND)
- fprintf(d, "missing initial OEND!\n");
- for (s = &g->strip[1]; !done; s++) {
- opnd = OPND(*s);
- switch (OP(*s)) {
- case OEND:
- fprintf(d, "\n");
- done = 1;
- break;
- case OCHAR:
- if (strchr("\\|()^$.[+*?{}!<> ", (char)opnd) != NULL)
- fprintf(d, "\\%c", (char)opnd);
- else
- fprintf(d, "%s", regchar((char)opnd));
- break;
- case OBOL:
- fprintf(d, "^");
- break;
- case OEOL:
- fprintf(d, "$");
- break;
- case OBOW:
- fprintf(d, "\\{");
- break;
- case OEOW:
- fprintf(d, "\\}");
- break;
- case OANY:
- fprintf(d, ".");
- break;
- case OANYOF:
- fprintf(d, "[(%ld)", (long)opnd);
- cs = &g->sets[opnd];
- last = -1;
- for (i = 0; i < g->csetsize+1; i++) /* +1 flushes */
- if (CHIN(cs, i) && i < g->csetsize) {
- if (last < 0) {
- fprintf(d, "%s", regchar(i));
- last = i;
- }
- } else {
- if (last >= 0) {
- if (last != i-1)
- fprintf(d, "-%s",
- regchar(i-1));
- last = -1;
- }
- }
- fprintf(d, "]");
- break;
- case OBACK_:
- fprintf(d, "(\\<%ld>", (long)opnd);
- break;
- case O_BACK:
- fprintf(d, "<%ld>\\)", (long)opnd);
- break;
- case OPLUS_:
- fprintf(d, "(+");
- if (OP(*(s+opnd)) != O_PLUS)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_PLUS:
- if (OP(*(s-opnd)) != OPLUS_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "+)");
- break;
- case OQUEST_:
- fprintf(d, "(?");
- if (OP(*(s+opnd)) != O_QUEST)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_QUEST:
- if (OP(*(s-opnd)) != OQUEST_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "?)");
- break;
- case OLPAREN:
- fprintf(d, "((<%ld>", (long)opnd);
- break;
- case ORPAREN:
- fprintf(d, "<%ld>))", (long)opnd);
- break;
- case OCH_:
- fprintf(d, "<");
- if (OP(*(s+opnd)) != OOR2)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case OOR1:
- if (OP(*(s-opnd)) != OOR1 && OP(*(s-opnd)) != OCH_)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, "|");
- break;
- case OOR2:
- fprintf(d, "|");
- if (OP(*(s+opnd)) != OOR2 && OP(*(s+opnd)) != O_CH)
- fprintf(d, "<%ld>", (long)opnd);
- break;
- case O_CH:
- if (OP(*(s-opnd)) != OOR1)
- fprintf(d, "<%ld>", (long)opnd);
- fprintf(d, ">");
- break;
- default:
- fprintf(d, "!%ld(%ld)!", OP(*s), opnd);
- break;
- }
- if (!done)
- GAP();
- }
-}
-
-/*
- - regchar - make a character printable
- == static char *regchar(int ch);
- */
-static char * /* -> representation */
-regchar(ch)
-int ch;
-{
- static char buf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(buf, "%c", ch);
- else
- sprintf(buf, "\\%o", ch);
- return(buf);
-}
diff --git a/regex/debug.ih b/regex/debug.ih
deleted file mode 100644
index 5f40ff7917..0000000000
--- a/regex/debug.ih
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === debug.c === */
-void regprint(regex_t *r, FILE *d);
-static void s_print(register struct re_guts *g, FILE *d);
-static char *regchar(int ch);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/engine.c b/regex/engine.c
deleted file mode 100644
index 696774e1b3..0000000000
--- a/regex/engine.c
+++ /dev/null
@@ -1,1019 +0,0 @@
-/*
- * The matching engine and friends. This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define matcher smatcher
-#define fast sfast
-#define slow sslow
-#define dissect sdissect
-#define backref sbackref
-#define step sstep
-#define print sprint
-#define at sat
-#define match smat
-#endif
-#ifdef LNAMES
-#define matcher lmatcher
-#define fast lfast
-#define slow lslow
-#define dissect ldissect
-#define backref lbackref
-#define step lstep
-#define print lprint
-#define at lat
-#define match lmat
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
- struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
-};
-
-#include "engine.ih"
-
-#ifdef REDEBUG
-#define SP(t, s, c) print(m, t, s, c, stdout)
-#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
-#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-#else
-#define SP(t, s, c) /* nothing */
-#define AT(t, p1, p2, s1, s2) /* nothing */
-#define NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
- == size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register char *endp;
- register unsigned int i;
- struct match mv;
- register struct match *m = &mv;
- register char *dp;
- register const sopno gf = g->firststate+1; /* +1 for OEND */
- register const sopno gl = g->laststate;
- char *start;
- char *stop;
-
- /* simplify the situation where possible */
- if (g->cflags&REG_NOSUB)
- nmatch = 0;
- if (eflags&REG_STARTEND) {
- start = string + pmatch[0].rm_so;
- stop = string + pmatch[0].rm_eo;
- } else {
- start = string;
- stop = start + strlen(start);
- }
- if (stop < start)
- return(REG_INVARG);
-
- /* prescreening; this does wonders for this rather slow code */
- if (g->must != NULL) {
- for (dp = start; dp < stop; dp++)
- if (*dp == g->must[0] && stop - dp >= g->mlen &&
- memcmp(dp, g->must, (size_t)g->mlen) == 0)
- break;
- if (dp == stop) /* we didn't find g->must */
- return(REG_NOMATCH);
- }
-
- /* match struct setup */
- m->g = g;
- m->eflags = eflags;
- m->pmatch = NULL;
- m->lastpos = NULL;
- m->offp = string;
- m->beginp = start;
- m->endp = stop;
- STATESETUP(m, 4);
- SETUP(m->st);
- SETUP(m->fresh);
- SETUP(m->tmp);
- SETUP(m->empty);
- CLEAR(m->empty);
-
- /* this loop does only one repetition except for backrefs */
- for (;;) {
- endp = fast(m, start, stop, gf, gl);
- if (endp == NULL) { /* a miss */
- STATETEARDOWN(m);
- return(REG_NOMATCH);
- }
- if (nmatch == 0 && !g->backrefs)
- break; /* no further info needed */
-
- /* where? */
- assert(m->coldp != NULL);
- for (;;) {
- NOTE("finding start");
- endp = slow(m, m->coldp, stop, gf, gl);
- if (endp != NULL)
- break;
- assert(m->coldp < m->endp);
- m->coldp++;
- }
- if (nmatch == 1 && !g->backrefs)
- break; /* no further info needed */
-
- /* oh my, he wants the subexpressions... */
- if (m->pmatch == NULL)
- m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
- sizeof(regmatch_t));
- if (m->pmatch == NULL) {
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- for (i = 1; i <= m->g->nsub; i++)
- m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
- if (!g->backrefs && !(m->eflags&REG_BACKR)) {
- NOTE("dissecting");
- dp = dissect(m, m->coldp, endp, gf, gl);
- } else {
- if (g->nplus > 0 && m->lastpos == NULL)
- m->lastpos = (char **)malloc((g->nplus+1) *
- sizeof(char *));
- if (g->nplus > 0 && m->lastpos == NULL) {
- free(m->pmatch);
- STATETEARDOWN(m);
- return(REG_ESPACE);
- }
- NOTE("backref dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- if (dp != NULL)
- break;
-
- /* uh-oh... we couldn't find a subexpression-level match */
- assert(g->backrefs); /* must be back references doing it */
- assert(g->nplus == 0 || m->lastpos != NULL);
- for (;;) {
- if (dp != NULL || endp <= m->coldp)
- break; /* defeat */
- NOTE("backoff");
- endp = slow(m, m->coldp, endp-1, gf, gl);
- if (endp == NULL)
- break; /* defeat */
- /* try it on a shorter possibility */
-#ifndef NDEBUG
- for (i = 1; i <= m->g->nsub; i++) {
- assert(m->pmatch[i].rm_so == -1);
- assert(m->pmatch[i].rm_eo == -1);
- }
-#endif
- NOTE("backoff dissect");
- dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
- }
- assert(dp == NULL || dp == endp);
- if (dp != NULL) /* found a shorter one */
- break;
-
- /* despite initial appearances, there is no match here */
- NOTE("false alarm");
- start = m->coldp + 1; /* recycle starting later */
- assert(start <= stop);
- }
-
- /* fill in the details if requested */
- if (nmatch > 0) {
- pmatch[0].rm_so = m->coldp - m->offp;
- pmatch[0].rm_eo = endp - m->offp;
- }
- if (nmatch > 1) {
- assert(m->pmatch != NULL);
- for (i = 1; i < nmatch; i++)
- if (i <= m->g->nsub)
- pmatch[i] = m->pmatch[i];
- else {
- pmatch[i].rm_so = -1;
- pmatch[i].rm_eo = -1;
- }
- }
-
- if (m->pmatch != NULL)
- free((char *)m->pmatch);
- if (m->lastpos != NULL)
- free((char *)m->lastpos);
- STATETEARDOWN(m);
- return(0);
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
-
- AT("diss", start, stop, startst, stopst);
- sp = start;
- for (ss = startst; ss < stopst; ss = es) {
- /* identify end of subRE */
- es = ss;
- switch (OP(m->g->strip[es])) {
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
- es += OPND(m->g->strip[es]);
- break;
- }
- es++;
-
- /* figure out what it matched */
- switch (OP(m->g->strip[ss])) {
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL) {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- } else /* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;) { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL) {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest); /* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;) {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
- assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
- }
-
- assert(sp == stop);
- return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static char * /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
-{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
- register size_t len;
- register int hard;
- register sop s;
- register regoff_t offsave;
- register cset *cs;
-
- AT("back", start, stop, startst, stopst);
- sp = start;
-
- /* get as far as we can with easy stuff */
- hard = 0;
- for (ss = startst; !hard && ss < stopst; ss++)
- switch (OP(s = m->g->strip[ss])) {
- case OCHAR:
- if (sp == stop || *sp++ != (char)OPND(s))
- return(NULL);
- break;
- case OANY:
- if (sp == stop)
- return(NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return(NULL);
- break;
- case OBOL:
- if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOL:
- if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OBOW:
- if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
- (sp < m->endp && *(sp-1) == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp-1))) ) &&
- (sp < m->endp && ISWORD(*sp)) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case OEOW:
- if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags&REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp)) ) &&
- (sp > m->beginp && ISWORD(*(sp-1))) )
- { /* yes */ }
- else
- return(NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
- }
- if (!hard) { /* that was it! */
- if (sp != stop)
- return(NULL);
- return(sp);
- }
- ss--; /* adjust for the for's final increment */
-
- /* the hard stuff */
- AT("hard", sp, stop, ss, stopst);
- s = m->g->strip[ss];
- switch (OP(s)) {
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return(NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return(NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
- return(NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return(backref(m, sp+len, stop, ss+1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp); /* not */
- return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev+1 <= m->g->nplus);
- m->lastpos[lev+1] = sp;
- return(backref(m, sp, stop, ss+1, stopst, lev+1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
- if (dp == NULL)
- return(backref(m, sp, stop, ss+1, stopst, lev-1));
- else
- return(dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;) { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
- if (dp != NULL)
- return(dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return(NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_so = offsave;
- return(NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss+1, stopst, lev);
- if (dp != NULL)
- return(dp);
- m->pmatch[i].rm_eo = offsave;
- return(NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
- }
-
- /* "can't happen" */
- assert(nope);
- /* NOTREACHED */
- return( NULL );
-}
-
-/*
- - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states fresh = m->fresh;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was underway */
-
- CLEAR(st);
- SET1(st, startst);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- ASSIGN(fresh, st);
- SP("start", st, *p);
- coldp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
- if (EQ(st, fresh))
- coldp = p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("boweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, fresh);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("aft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- assert(coldp != NULL);
- m->coldp = coldp;
- if (ISSET(st, stopst))
- return(p+1);
- else
- return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- == char *stop, sopno startst, sopno stopst);
- */
-static char * /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- register states st = m->st;
- register states empty = m->empty;
- register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start-1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
-
- AT("slow", start, stop, startst, stopst);
- CLEAR(st);
- SET1(st, startst);
- SP("sstart", st, *p);
- st = step(m->g, startst, stopst, st, NOTHING, st);
- matchp = NULL;
- for (;;) {
- /* next character */
- lastc = c;
- c = (p == m->endp) ? OUT : *p;
-
- /* is there an EOL and/or BOL between lastc and c? */
- flagch = '\0';
- i = 0;
- if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
- (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
- flagch = BOL;
- i = m->g->nbol;
- }
- if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
- (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
- flagch = (flagch == BOL) ? BOLEOL : EOL;
- i += m->g->neol;
- }
- if (i != 0) {
- for (; i > 0; i--)
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboleol", st, c);
- }
-
- /* how about a word boundary? */
- if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
- (c != OUT && ISWORD(c)) ) {
- flagch = BOW;
- }
- if ( (lastc != OUT && ISWORD(lastc)) &&
- (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
- flagch = EOW;
- }
- if (flagch == BOW || flagch == EOW) {
- st = step(m->g, startst, stopst, st, flagch, st);
- SP("sboweow", st, c);
- }
-
- /* are we done? */
- if (ISSET(st, stopst))
- matchp = p;
- if (EQ(st, empty) || p == stop)
- break; /* NOTE BREAK OUT */
-
- /* no, we must deal with this character */
- ASSIGN(tmp, st);
- ASSIGN(st, empty);
- assert(c != OUT);
- st = step(m->g, startst, stopst, tmp, c, st);
- SP("saft", st, c);
- assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
- p++;
- }
-
- return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- == register states bef, int ch, register states aft);
- == #define BOL (OUT+1)
- == #define EOL (BOL+1)
- == #define BOLEOL (BOL+2)
- == #define NOTHING (BOL+3)
- == #define BOW (BOL+4)
- == #define EOW (BOL+5)
- == #define CODEMAX (BOL+5) // highest code used
- == #define NONCHAR(c) ((c) > CHAR_MAX)
- == #define NNONCHAR (CODEMAX-CHAR_MAX)
- */
-static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
-register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
-register states aft; /* states already known reachable after */
-{
- register cset *cs;
- register sop s;
- register sopno pc;
- register onestate here; /* note, macros know this name */
- register sopno look;
- register int i;
-
- for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
- s = g->strip[pc];
- switch (OP(s)) {
- case OEND:
- assert(pc == stop-1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char)OPND(s));
- if (ch == (char)OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s))) {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here)) {
- for (look = 1;
- OP(s = g->strip[pc+look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc+OPND(s)]) != O_CH) {
- assert(OP(g->strip[pc+OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
- }
- }
-
- return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- == int ch, FILE *d);
- == #endif
- */
-static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
-{
- register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
-
- if (!(m->eflags&REG_TRACE))
- return;
-
- fprintf(d, "%s", caption);
- if (ch != '\0')
- fprintf(d, " %s", pchar(ch));
- for (i = 0; i < g->nstates; i++)
- if (ISSET(st, i)) {
- fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
- first = 0;
- }
- fprintf(d, "\n");
-}
-
-/*
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- == sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-{
- if (!(m->eflags&REG_TRACE))
- return;
-
- printf("%s %s-", title, pchar(*start));
- printf("%s ", pchar(*stop));
- printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define PCHARDONE /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c? Well, yes. But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient. It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char * /* -> representation */
-pchar(ch)
-int ch;
-{
- static char pbuf[10];
-
- if (isprint(ch) || ch == ' ')
- sprintf(pbuf, "%c", ch);
- else
- sprintf(pbuf, "\\%o", ch);
- return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
diff --git a/regex/engine.ih b/regex/engine.ih
deleted file mode 100644
index 1564a2f11f..0000000000
--- a/regex/engine.ih
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/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 ../../regex/mkh ========= */
diff --git a/regex/main.c b/regex/main.c
deleted file mode 100644
index 657338a2c1..0000000000
--- a/regex/main.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <assert.h>
-#include <stdlib.h>
-
-#include "main.ih"
-
-char *progname;
-int debug = 0;
-int line = 0;
-int status = 0;
-
-int copts = REG_EXTENDED;
-int eopts = 0;
-regoff_t startoff = 0;
-regoff_t endoff = 0;
-
-
-extern int split();
-extern void regprint();
-
-/*
- - main - do the simple case, hand off to regress() for regression
- */
-int main(argc, argv)
-int argc;
-char *argv[];
-{
- regex_t re;
-# define NS 10
- regmatch_t subs[NS];
- char erbuf[100];
- int err;
- size_t len;
- int c;
- int errflg = 0;
- register int i;
- extern int optind;
- extern char *optarg;
-
- progname = argv[0];
-
- while ((c = getopt(argc, argv, "c:e:S:E:x")) != EOF)
- switch (c) {
- case 'c': /* compile options */
- copts = options('c', optarg);
- break;
- case 'e': /* execute options */
- eopts = options('e', optarg);
- break;
- case 'S': /* start offset */
- startoff = (regoff_t)atoi(optarg);
- break;
- case 'E': /* end offset */
- endoff = (regoff_t)atoi(optarg);
- break;
- case 'x': /* Debugging. */
- debug++;
- break;
- case '?':
- default:
- errflg++;
- break;
- }
- if (errflg) {
- fprintf(stderr, "usage: %s ", progname);
- fprintf(stderr, "[-c copt][-C][-d] [re]\n");
- exit(2);
- }
-
- if (optind >= argc) {
- regress(stdin);
- exit(status);
- }
-
- err = regcomp(&re, argv[optind++], copts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- regprint(&re, stdout);
-
- if (optind >= argc) {
- regfree(&re);
- exit(status);
- }
-
- if (eopts&REG_STARTEND) {
- subs[0].rm_so = startoff;
- subs[0].rm_eo = strlen(argv[optind]) - endoff;
- }
- err = regexec(&re, argv[optind], (size_t)NS, subs, eopts);
- if (err) {
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "error %s, %d/%d `%s'\n",
- eprint(err), len, sizeof(erbuf), erbuf);
- exit(status);
- }
- if (!(copts&REG_NOSUB)) {
- len = (int)(subs[0].rm_eo - subs[0].rm_so);
- if (subs[0].rm_so != -1) {
- if (len != 0)
- printf("match `%.*s'\n", (int)len,
- argv[optind] + subs[0].rm_so);
- else
- printf("match `'@%.1s\n",
- argv[optind] + subs[0].rm_so);
- }
- for (i = 1; i < NS; i++)
- if (subs[i].rm_so != -1)
- printf("(%d) `%.*s'\n", i,
- (int)(subs[i].rm_eo - subs[i].rm_so),
- argv[optind] + subs[i].rm_so);
- }
- exit(status);
-}
-
-/*
- - regress - main loop of regression test
- == void regress(FILE *in);
- */
-void
-regress(in)
-FILE *in;
-{
- char inbuf[1000];
-# define MAXF 10
- char *f[MAXF];
- int nf;
- int i;
- char erbuf[100];
- size_t ne;
- char *badpat = "invalid regular expression";
-# define SHORT 10
- char *bpname = "REG_BADPAT";
- regex_t re;
-
- while (fgets(inbuf, sizeof(inbuf), in) != NULL) {
- line++;
- if (inbuf[0] == '#' || inbuf[0] == '\n')
- continue; /* NOTE CONTINUE */
- inbuf[strlen(inbuf)-1] = '\0'; /* get rid of stupid \n */
- if (debug)
- fprintf(stdout, "%d:\n", line);
- nf = split(inbuf, f, MAXF, "\t\t");
- if (nf < 3) {
- fprintf(stderr, "bad input, line %d\n", line);
- exit(1);
- }
- for (i = 0; i < nf; i++)
- if (strcmp(f[i], "\"\"") == 0)
- f[i] = "";
- if (nf <= 3)
- f[3] = NULL;
- if (nf <= 4)
- f[4] = NULL;
- try(f[0], f[1], f[2], f[3], f[4], options('c', f[1]));
- if (opt('&', f[1])) /* try with either type of RE */
- try(f[0], f[1], f[2], f[3], f[4],
- options('c', f[1]) &~ REG_EXTENDED);
- }
-
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, badpat) != 0 || ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() test gave `%s' not `%s'\n",
- erbuf, badpat);
- status = 1;
- }
- ne = regerror(REG_BADPAT, (regex_t *)NULL, erbuf, (size_t)SHORT);
- if (strncmp(erbuf, badpat, SHORT-1) != 0 || erbuf[SHORT-1] != '\0' ||
- ne != strlen(badpat)+1) {
- fprintf(stderr, "end: regerror() short test gave `%s' not `%.*s'\n",
- erbuf, SHORT-1, badpat);
- status = 1;
- }
- ne = regerror(REG_ITOA|REG_BADPAT, (regex_t *)NULL, erbuf, sizeof(erbuf));
- if (strcmp(erbuf, bpname) != 0 || ne != strlen(bpname)+1) {
- fprintf(stderr, "end: regerror() ITOA test gave `%s' not `%s'\n",
- erbuf, bpname);
- status = 1;
- }
- re.re_endp = bpname;
- ne = regerror(REG_ATOI, &re, erbuf, sizeof(erbuf));
- if (atoi(erbuf) != (int)REG_BADPAT) {
- fprintf(stderr, "end: regerror() ATOI test gave `%s' not `%ld'\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- } else if (ne != strlen(erbuf)+1) {
- fprintf(stderr, "end: regerror() ATOI test len(`%s') = %ld\n",
- erbuf, (long)REG_BADPAT);
- status = 1;
- }
-}
-
-/*
- - try - try it, and report on problems
- == void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
- */
-void
-try(f0, f1, f2, f3, f4, opts)
-char *f0;
-char *f1;
-char *f2;
-char *f3;
-char *f4;
-int opts; /* may not match f1 */
-{
- regex_t re;
-# define NSUBS 10
- regmatch_t subs[NSUBS];
-# define NSHOULD 15
- char *should[NSHOULD];
- int nshould;
- char erbuf[100];
- int err;
- int len;
- char *type = (opts & REG_EXTENDED) ? "ERE" : "BRE";
- register int i;
- char *grump;
- char f0copy[1000];
- char f2copy[1000];
-
- strcpy(f0copy, f0);
- re.re_endp = (opts&REG_PEND) ? f0copy + strlen(f0copy) : NULL;
- fixstr(f0copy);
- err = regcomp(&re, f0copy, opts);
- if (err != 0 && (!opt('C', f1) || err != efind(f2))) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err == 0 && opt('C', f1)) {
- /* unexpected success */
- fprintf(stderr, "%d: %s should have given REG_%s\n",
- line, type, f2);
- status = 1;
- err = 1; /* so we won't try regexec */
- }
-
- if (err != 0) {
- regfree(&re);
- return;
- }
-
- strcpy(f2copy, f2);
- fixstr(f2copy);
-
- if (options('e', f1)&REG_STARTEND) {
- if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
- fprintf(stderr, "%d: bad STARTEND syntax\n", line);
- subs[0].rm_so = strchr(f2, '(') - f2 + 1;
- subs[0].rm_eo = strchr(f2, ')') - f2;
- }
- err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));
-
- if (err != 0 && (f3 != NULL || err != REG_NOMATCH)) {
- /* unexpected error or wrong error */
- len = regerror(err, &re, erbuf, sizeof(erbuf));
- fprintf(stderr, "%d: %s exec error %s, %d/%d `%s'\n",
- line, type, eprint(err), len,
- sizeof(erbuf), erbuf);
- status = 1;
- } else if (err != 0) {
- /* nothing more to check */
- } else if (f3 == NULL) {
- /* unexpected success */
- fprintf(stderr, "%d: %s exec should have failed\n",
- line, type);
- status = 1;
- err = 1; /* just on principle */
- } else if (opts&REG_NOSUB) {
- /* nothing more to check */
- } else if ((grump = check(f2, subs[0], f3)) != NULL) {
- fprintf(stderr, "%d: %s %s\n", line, type, grump);
- status = 1;
- err = 1;
- }
-
- if (err != 0 || f4 == NULL) {
- regfree(&re);
- return;
- }
-
- for (i = 1; i < NSHOULD; i++)
- should[i] = NULL;
- nshould = split(f4, should+1, NSHOULD-1, ",");
- if (nshould == 0) {
- nshould = 1;
- should[1] = "";
- }
- for (i = 1; i < NSUBS; i++) {
- grump = check(f2, subs[i], should[i]);
- if (grump != NULL) {
- fprintf(stderr, "%d: %s $%d %s\n", line,
- type, i, grump);
- status = 1;
- err = 1;
- }
- }
-
- regfree(&re);
-}
-
-/*
- - options - pick options out of a regression-test string
- == int options(int type, char *s);
- */
-int
-options(type, s)
-int type; /* 'c' compile, 'e' exec */
-char *s;
-{
- register char *p;
- register int o = (type == 'c') ? copts : eopts;
- register char *legal = (type == 'c') ? "bisnmp" : "^$#tl";
-
- for (p = s; *p != '\0'; p++)
- if (strchr(legal, *p) != NULL)
- switch (*p) {
- case 'b':
- o &= ~REG_EXTENDED;
- break;
- case 'i':
- o |= REG_ICASE;
- break;
- case 's':
- o |= REG_NOSUB;
- break;
- case 'n':
- o |= REG_NEWLINE;
- break;
- case 'm':
- o &= ~REG_EXTENDED;
- o |= REG_NOSPEC;
- break;
- case 'p':
- o |= REG_PEND;
- break;
- case '^':
- o |= REG_NOTBOL;
- break;
- case '$':
- o |= REG_NOTEOL;
- break;
- case '#':
- o |= REG_STARTEND;
- break;
- case 't': /* trace */
- o |= REG_TRACE;
- break;
- case 'l': /* force long representation */
- o |= REG_LARGE;
- break;
- case 'r': /* force backref use */
- o |= REG_BACKR;
- break;
- }
- return(o);
-}
-
-/*
- - opt - is a particular option in a regression string?
- == int opt(int c, char *s);
- */
-int /* predicate */
-opt(c, s)
-int c;
-char *s;
-{
- return(strchr(s, c) != NULL);
-}
-
-/*
- - fixstr - transform magic characters in strings
- == void fixstr(register char *p);
- */
-void
-fixstr(p)
-register char *p;
-{
- if (p == NULL)
- return;
-
- for (; *p != '\0'; p++)
- if (*p == 'N')
- *p = '\n';
- else if (*p == 'T')
- *p = '\t';
- else if (*p == 'S')
- *p = ' ';
- else if (*p == 'Z')
- *p = '\0';
-}
-
-/*
- - check - check a substring match
- == char *check(char *str, regmatch_t sub, char *should);
- */
-char * /* NULL or complaint */
-check(str, sub, should)
-char *str;
-regmatch_t sub;
-char *should;
-{
- register int len;
- register int shlen;
- register char *p;
- static char grump[500];
- register char *at = NULL;
-
- if (should != NULL && strcmp(should, "-") == 0)
- should = NULL;
- if (should != NULL && should[0] == '@') {
- at = should + 1;
- should = "";
- }
-
- /* check rm_so and rm_eo for consistency */
- if (sub.rm_so > sub.rm_eo || (sub.rm_so == -1 && sub.rm_eo != -1) ||
- (sub.rm_so != -1 && sub.rm_eo == -1) ||
- (sub.rm_so != -1 && sub.rm_so < 0) ||
- (sub.rm_eo != -1 && sub.rm_eo < 0) ) {
- sprintf(grump, "start %ld end %ld", (long)sub.rm_so,
- (long)sub.rm_eo);
- return(grump);
- }
-
- /* check for no match */
- if (sub.rm_so == -1 && should == NULL)
- return(NULL);
- if (sub.rm_so == -1)
- return("did not match");
-
- /* check for in range */
- if (sub.rm_eo > strlen(str)) {
- sprintf(grump, "start %ld end %ld, past end of string",
- (long)sub.rm_so, (long)sub.rm_eo);
- return(grump);
- }
-
- len = (int)(sub.rm_eo - sub.rm_so);
- shlen = (int)strlen(should);
- p = str + sub.rm_so;
-
- /* check for not supposed to match */
- if (should == NULL) {
- sprintf(grump, "matched `%.*s'", len, p);
- return(grump);
- }
-
- /* check for wrong match */
- if (len != shlen || strncmp(p, should, (size_t)shlen) != 0) {
- sprintf(grump, "matched `%.*s' instead", len, p);
- return(grump);
- }
- if (shlen > 0)
- return(NULL);
-
- /* check null match in right place */
- if (at == NULL)
- return(NULL);
- shlen = strlen(at);
- if (shlen == 0)
- shlen = 1; /* force check for end-of-string */
- if (strncmp(p, at, shlen) != 0) {
- sprintf(grump, "matched null at `%.20s'", p);
- return(grump);
- }
- return(NULL);
-}
-
-/*
- - eprint - convert error number to name
- == static char *eprint(int err);
- */
-static char *
-eprint(err)
-int err;
-{
- static char epbuf[100];
- size_t len;
-
- len = regerror(REG_ITOA|err, (regex_t *)NULL, epbuf, sizeof(epbuf));
- assert(len <= sizeof(epbuf));
- return(epbuf);
-}
-
-/*
- - efind - convert error name to number
- == static int efind(char *name);
- */
-static int
-efind(name)
-char *name;
-{
- static char efbuf[100];
- regex_t re;
-
- sprintf(efbuf, "REG_%s", name);
- assert(strlen(efbuf) < sizeof(efbuf));
- re.re_endp = efbuf;
- (void) regerror(REG_ATOI, &re, efbuf, sizeof(efbuf));
- return(atoi(efbuf));
-}
diff --git a/regex/main.ih b/regex/main.ih
deleted file mode 100644
index 5a0118ac44..0000000000
--- a/regex/main.ih
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === main.c === */
-void regress(FILE *in);
-void try(char *f0, char *f1, char *f2, char *f3, char *f4, int opts);
-int options(int type, char *s);
-int opt(int c, char *s);
-void fixstr(register char *p);
-char *check(char *str, regmatch_t sub, char *should);
-static char *eprint(int err);
-static int efind(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
diff --git a/regex/mkh b/regex/mkh
deleted file mode 100644
index 252b246c7b..0000000000
--- a/regex/mkh
+++ /dev/null
@@ -1,76 +0,0 @@
-#! /bin/sh
-# mkh - pull headers out of C source
-PATH=/bin:/usr/bin ; export PATH
-
-# egrep pattern to pick out marked lines
-egrep='^ =([ ]|$)'
-
-# Sed program to process marked lines into lines for the header file.
-# The markers have already been removed. Two things are done here: removal
-# of backslashed newlines, and some fudging of comments. The first is done
-# because -o needs to have prototypes on one line to strip them down.
-# Getting comments into the output is tricky; we turn C++-style // comments
-# into /* */ comments, after altering any existing */'s to avoid trouble.
-peel=' /\\$/N
- /\\\n[ ]*/s///g
- /\/\//s;\*/;* /;g
- /\/\//s;//\(.*\);/*\1 */;'
-
-for a
-do
- case "$a" in
- -o) # old (pre-function-prototype) compiler
- # add code to comment out argument lists
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
- shift
- ;;
- -b) # funny Berkeley __P macro
- peel="$peel
- "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
- shift
- ;;
- -s) # compiler doesn't like `static foo();'
- # add code to get rid of the `static'
- peel="$peel
- "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
- shift
- ;;
- -p) # private declarations
- egrep='^ ==([ ]|$)'
- shift
- ;;
- -i) # wrap in #ifndef, argument is name
- ifndef="$2"
- shift ; shift
- ;;
- *) break
- ;;
- esac
-done
-
-if test " $ifndef" != " "
-then
- echo "#ifndef $ifndef"
- echo "#define $ifndef /* never again */"
-fi
-echo "/* ========= begin header generated by $0 ========= */"
-echo '#ifdef __cplusplus'
-echo 'extern "C" {'
-echo '#endif'
-for f
-do
- echo
- echo "/* === $f === */"
- egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
- echo
-done
-echo '#ifdef __cplusplus'
-echo '}'
-echo '#endif'
-echo "/* ========= end header generated by $0 ========= */"
-if test " $ifndef" != " "
-then
- echo "#endif"
-fi
-exit 0
diff --git a/regex/regcomp.c b/regex/regcomp.c
deleted file mode 100644
index 7f651bf845..0000000000
--- a/regex/regcomp.c
+++ /dev/null
@@ -1,1546 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "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)) ? (NEXT1(), 1) : 0)
-#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define NEXT1() (p->next++)
-#define NEXT2() (p->next += 2)
-#define NEXTn(n) (p->next += (n))
-#define GETNEXT() (*p->next++)
-#define SETERROR(e) seterr(p, (e))
-#define REQUIRE(co, e) ((void)((co) || SETERROR(e)))
-#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
-#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
-#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
-#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
-#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
-#define HERE() (p->slen)
-#define THERE() (p->slen - 1)
-#define THERETHERE() (p->slen - 2)
-#define DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
-#else
-#define never 0 /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = API_EXPORT(int) regcomp(regex_t *, const char *, int);
- = #define REG_BASIC 0000
- = #define REG_EXTENDED 0001
- = #define REG_ICASE 0002
- = #define REG_NOSUB 0004
- = #define REG_NEWLINE 0010
- = #define REG_NOSPEC 0020
- = #define REG_PEND 0040
- = #define REG_DUMP 0200
- */
-API_EXPORT(int) /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
-{
- struct parse pa;
- register struct re_guts *g;
- register struct parse *p = &pa;
- register int i;
- register size_t len;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&~REG_DUMP)
-#endif
-
- cflags = GOODFLAGS(cflags);
- if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
- return(REG_INVARG);
-
- if (cflags&REG_PEND) {
- if (preg->re_endp < pattern)
- return(REG_INVARG);
- len = preg->re_endp - pattern;
- } else
- len = strlen((char *)pattern);
-
- /* do the mallocs early so failure handling is easy */
- g = (struct re_guts *)malloc(sizeof(struct re_guts) +
- (NC-1)*sizeof(cat_t));
- if (g == NULL)
- return(REG_ESPACE);
- p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
- p->strip = (sop *)malloc(p->ssize * sizeof(sop));
- p->slen = 0;
- if (p->strip == NULL) {
- free((char *)g);
- return(REG_ESPACE);
- }
-
- /* set things up */
- p->g = g;
- p->next = (char *)pattern; /* convenience; we do not modify it */
- p->end = p->next + len;
- p->error = 0;
- p->ncsalloc = 0;
- for (i = 0; i < NPAREN; i++) {
- p->pbegin[i] = 0;
- p->pend[i] = 0;
- }
- g->csetsize = NC;
- g->sets = NULL;
- g->setbits = NULL;
- g->ncsets = 0;
- g->cflags = cflags;
- g->iflags = 0;
- g->nbol = 0;
- g->neol = 0;
- g->must = NULL;
- g->mlen = 0;
- g->nsub = 0;
- g->ncategories = 1; /* category 0 is "everything else" */
- g->categories = &g->catspace[-(CHAR_MIN)];
- (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
- g->backrefs = 0;
-
- /* do it */
- EMIT(OEND, 0);
- g->firststate = THERE();
- if (cflags&REG_EXTENDED)
- p_ere(p, OUT);
- else if (cflags&REG_NOSPEC)
- p_str(p);
- else
- p_bre(p, OUT, OUT);
- EMIT(OEND, 0);
- g->laststate = THERE();
-
- /* tidy up loose ends and fill things in */
- categorize(p, g);
- stripsnug(p, g);
- findmust(p, g);
- g->nplus = pluscount(p, g);
- g->magic = MAGIC2;
- preg->re_nsub = g->nsub;
- preg->re_g = g;
- preg->re_magic = MAGIC1;
-#ifndef REDEBUG
- /* not debugging, so can't rely on the assert() in regexec() */
- if (g->iflags&BAD)
- SETERROR(REG_ASSERT);
-#endif
-
- /* win or lose, we're done */
- if (p->error != 0) /* lose */
- regfree(preg);
- return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
- */
-static void
-p_ere(p, stop)
-register struct parse *p;
-int stop; /* character this ERE should end at */
-{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
-
- for (;;) {
- /* do a bunch of concatenated expressions */
- conc = HERE();
- while (MORE() && (c = PEEK()) != '|' && c != stop)
- p_ere_exp(p);
- REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
-
- if (!EAT('|'))
- break; /* NOTE BREAK OUT */
-
- if (first) {
- INSERT(OCH_, conc); /* offset is wrong */
- prevfwd = conc;
- prevback = conc;
- first = 0;
- }
- ASTERN(OOR1, prevback);
- prevback = THERE();
- AHEAD(prevfwd); /* fix previous offset */
- prevfwd = HERE();
- EMIT(OOR2, 0); /* offset is very wrong */
- }
-
- if (!first) { /* tail-end fixups */
- AHEAD(prevfwd);
- ASTERN(O_CH, prevback);
- }
-
- assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
- */
-static void
-p_ere_exp(p)
-register struct parse *p;
-{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
-
- pos = HERE();
- switch (c) {
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
-#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
- /*
- * You may ask, why the ifndef? Because I didn't notice
- * this until slightly too late for 1003.2, and none of the
- * other 1003.2 regular-expression reviewers noticed it at
- * all. So an unmatched ) is legal POSIX, at least until
- * we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
-#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- /* we call { a repetition if followed by a digit */
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ))
- return; /* no repetition, we're done */
- NEXT1();
-
- 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() != '}')
- NEXT1();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
- }
-
- if (!MORE())
- return;
- c = PEEK();
- if (!( c == '*' || c == '+' || c == '?' ||
- (c == '{' && MORE2() && isdigit(PEEK2())) ) )
- return;
- SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
- */
-static void
-p_str(p)
-register struct parse *p;
-{
- REQUIRE(MORE(), REG_EMPTY);
- while (MORE())
- ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- == register int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor. The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases. This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
-{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
-
- if (EAT('^')) {
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- }
- while (MORE() && !SEETWO(end1, end2)) {
- wasdollar = p_simp_re(p, first);
- first = 0;
- }
- if (wasdollar) { /* oops, that was a trailing anchor */
- DROP(1);
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- }
-
- REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
- */
-static int /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
-{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
-# define BACKSL (1<<CHAR_BIT)
-
- pos = HERE(); /* repetion op, if any, covers from here */
-
- assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
- if (c == '\\') {
- REQUIRE(MORE(), REG_EESCAPE);
- c = BACKSL | (unsigned char)GETNEXT();
- }
- switch (c) {
- case '.':
- if (p->g->cflags&REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL|'{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL|'(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN) {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL|')': /* should not get here -- must be user */
- case BACKSL|'}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL|'1':
- case BACKSL|'2':
- case BACKSL|'3':
- case BACKSL|'4':
- case BACKSL|'5':
- case BACKSL|'6':
- case BACKSL|'7':
- case BACKSL|'8':
- case BACKSL|'9':
- i = (c&~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0) {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
- EMIT(O_BACK, i);
- } else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c &~ BACKSL);
- 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('\\', '}'))
- NEXT1();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- } else if (c == (unsigned char)'$') /* $ (but not \$) ends it */
- return(1);
-
- return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
- */
-static int /* the value */
-p_count(p)
-register struct parse *p;
-{
- register int count = 0;
- register int ndigits = 0;
-
- while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
- ndigits++;
- }
-
- REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
- return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
- *
- * Note a significant property of this code: if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(p)
-register struct parse *p;
-{
- register cset *cs = allocset(p);
- register int invert = 0;
-
- /* Dept of Truly Sickening Special-Case Kludges */
- if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
- EMIT(OBOW, 0);
- NEXTn(6);
- return;
- }
- if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
- EMIT(OEOW, 0);
- NEXTn(6);
- return;
- }
-
- if (EAT('^'))
- invert++; /* make note to invert set at end */
- if (EAT(']'))
- CHadd(cs, ']');
- else if (EAT('-'))
- CHadd(cs, '-');
- while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
- p_b_term(p, cs);
- if (EAT('-'))
- CHadd(cs, '-');
- MUSTEAT(']', REG_EBRACK);
-
- if (p->error != 0) /* don't mess things up further */
- return;
-
- if (p->g->cflags&REG_ICASE) {
- register int i;
- register int ci;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i) && isalpha(i)) {
- ci = othercase(i);
- if (ci != i)
- CHadd(cs, ci);
- }
- if (cs->multis != NULL)
- mccase(p, cs);
- }
- if (invert) {
- register int i;
-
- for (i = p->g->csetsize - 1; i >= 0; i--)
- if (CHIN(cs, i))
- CHsub(cs, i);
- else
- CHadd(cs, i);
- if (p->g->cflags&REG_NEWLINE)
- CHsub(cs, '\n');
- if (cs->multis != NULL)
- mcinvert(p, cs);
- }
-
- assert(cs->multis == NULL); /* xxx */
-
- if (nch(p, cs) == 1) { /* optimize singleton sets */
- ordinary(p, firstch(p, cs));
- freeset(p, cs);
- } else
- EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
- */
-static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register char c;
- register char start, finish;
- register int i;
-
- /* classify what we've got */
- switch ((MORE()) ? PEEK() : '\0') {
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
- }
-
- switch (c) {
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']') {
- /* range */
- NEXT1();
- 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()))
- NEXT1();
- 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, ']'))
- NEXT1();
- if (!MORE()) {
- SETERROR(REG_EBRACK);
- return(0);
- }
- len = p->next - sp;
- for (cp = cnames; cp->name != NULL; cp++)
- if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
- return(cp->code); /* known name */
- if (len == 1)
- return(*sp); /* single character */
- SETERROR(REG_ECOLLATE); /* neither */
- return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
- */
-static char /* if no counterpart, return ch */
-othercase(ch)
-int ch;
-{
- assert(isalpha(ch));
- if (isupper(ch))
- return(tolower(ch));
- else if (islower(ch))
- return(toupper(ch));
- else /* peculiar, but could happen */
- return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
-
- assert(othercase(ch) != ch); /* p_bracket() would recurse */
- p->next = bracket;
- p->end = bracket+2;
- bracket[0] = ch;
- bracket[1] = ']';
- bracket[2] = '\0';
- p_bracket(p);
- assert(p->next == bracket+2);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
- */
-static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
-{
- register cat_t *cap = p->g->categories;
-
- if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
- bothcases(p, ch);
- else {
- EMIT(OCHAR, (unsigned char)ch);
- if (cap[ch] == 0)
- cap[ch] = p->g->ncategories++;
- }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(p)
-register struct parse *p;
-{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
-
- p->next = bracket;
- p->end = bracket+3;
- bracket[0] = '^';
- bracket[1] = '\n';
- bracket[2] = ']';
- bracket[3] = '\0';
- p_bracket(p);
- assert(p->next == bracket+3);
- p->next = oldnext;
- p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe INFINITY) */
-{
- register sopno finish = HERE();
-# define N 2
-# define INF 3
-# define REP(f, t) ((f)*8 + (t))
-# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
-
- if (p->error != 0) /* head off possible runaway recursion */
- return;
-
- assert(from <= to);
-
- switch (REP(MAP(from), MAP(to))) {
- case REP(0, 0): /* must be user doing this */
- DROP(finish-start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start+1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start+1, finish+1);
- assert(copy == finish+4);
- repeat(p, copy, 1, to-1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to-1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from-1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
- }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
- */
-static int /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
-{
- if (p->error == 0) /* keep earliest error condition */
- p->error = e;
- p->next = nuls; /* try to bring things to a halt */
- p->end = nuls;
- return(0); /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
- */
-static cset *
-allocset(p)
-register struct parse *p;
-{
- register int no = p->g->ncsets++;
- register size_t nc;
- register size_t nbytes;
- register cset *cs;
- register size_t css = (size_t)p->g->csetsize;
- register int i;
-
- if (no >= p->ncsalloc) { /* need another column of space */
- p->ncsalloc += CHAR_BIT;
- nc = p->ncsalloc;
- assert(nc % CHAR_BIT == 0);
- nbytes = nc / CHAR_BIT * css;
- if (p->g->sets == NULL)
- p->g->sets = (cset *)malloc(nc * sizeof(cset));
- else
- p->g->sets = (cset *)realloc((char *)p->g->sets,
- nc * sizeof(cset));
- if (p->g->setbits == NULL)
- p->g->setbits = (uch *)malloc(nbytes);
- else {
- p->g->setbits = (uch *)realloc((char *)p->g->setbits,
- nbytes);
- /* xxx this isn't right if setbits is now NULL */
- for (i = 0; i < no; i++)
- p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
- }
- if (p->g->sets != NULL && p->g->setbits != NULL)
- (void) memset((char *)p->g->setbits + (nbytes - css),
- 0, css);
- else {
- no = 0;
- SETERROR(REG_ESPACE);
- /* caller's responsibility not to do set ops */
- }
- }
-
- assert(p->g->sets != NULL); /* xxx */
- cs = &p->g->sets[no];
- cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
- cs->mask = 1 << ((no) % CHAR_BIT);
- cs->hash = 0;
- cs->smultis = 0;
- cs->multis = NULL;
-
- return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
- */
-static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- register unsigned int 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 unsigned int 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 unsigned int 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 unsigned int 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';
-}
-
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
- *
- * This would have to know the set of possibilities. Implementation
- * is deferred.
- */
-static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
-{
- assert(cs->multis == NULL); /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
- */
-static int /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc = (unsigned char)c;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc] != 0)
- return(1);
- return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
- */
-static int /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
-{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
- register unsigned uc1 = (unsigned char)c1;
- register unsigned uc2 = (unsigned char)c2;
-
- for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
- if (col[uc1] != col[uc2])
- return(0);
- return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
- */
-static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- for (c = CHAR_MIN; c <= CHAR_MAX; c++)
- if (cats[c] == 0 && isinsets(g, c)) {
- cat = g->ncategories++;
- cats[c] = cat;
- for (c2 = c+1; c2 <= CHAR_MAX; c2++)
- if (cats[c2] == 0 && samesets(g, c, c2))
- cats[c2] = cat;
- }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
- */
-static sopno /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
-{
- register sopno ret = HERE();
- register sopno len = finish - start;
-
- assert(finish >= start);
- if (len == 0)
- return(ret);
- enlarge(p, p->ssize + len); /* this many unexpected additions */
- assert(p->ssize >= p->slen + len);
- (void) memcpy((char *)(p->strip + p->slen),
- (char *)(p->strip + start), (size_t)len*sizeof(sop));
- p->slen += len;
- return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures. Maybe later.
- */
-static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* deal with oversize operands ("can't happen", more or less) */
- assert(opnd < 1<<OPSHIFT);
-
- /* deal with undersized strip */
- if (p->slen >= p->ssize)
- enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
- assert(p->slen < p->ssize);
-
- /* finally, it's all reduced to the easy case */
- p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
-{
- register sopno sn;
- register sop s;
- register int i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- sn = HERE();
- EMIT(op, opnd); /* do checks, ensure space */
- assert(HERE() == sn+1);
- s = p->strip[sn];
-
- /* adjust paren pointers */
- assert(pos > 0);
- for (i = 1; i < NPAREN; i++) {
- if (p->pbegin[i] >= pos) {
- p->pbegin[i]++;
- }
- if (p->pend[i] >= pos) {
- p->pend[i]++;
- }
- }
-
- memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
- (HERE()-pos-1)*sizeof(sop));
- p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
-{
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- assert(value < 1<<OPSHIFT);
- p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
- */
-static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
-{
- register sop *sp;
-
- if (p->ssize >= size)
- return;
-
- sp = (sop *)realloc(p->strip, size*sizeof(sop));
- if (sp == NULL) {
- SETERROR(REG_ESPACE);
- return;
- }
- p->strip = sp;
- p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
- */
-static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
-{
- g->nstates = p->slen;
- g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
- if (g->strip == NULL) {
- SETERROR(REG_ESPACE);
- g->strip = p->strip;
- }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences. Someday. This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- sop *start = NULL;
- register sop *newstart = NULL;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
-
- /* avoid making error situations worse */
- if (p->error != 0)
- return;
-
- /* find the longest OCHAR sequence in strip */
- newlen = 0;
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2) {
- g->iflags |= BAD;
- return;
- }
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen) { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
- }
- } while (OP(s) != OEND);
-
- if (g->mlen == 0) /* there isn't one */
- return;
-
- /* turn it into a character string */
- g->must = malloc((size_t)g->mlen + 1);
- if (g->must == NULL) { /* argh; just forget it */
- g->mlen = 0;
- return;
- }
- cp = g->must;
- scan = start;
- for (i = g->mlen; i > 0; i--) {
- while (OP(s = *scan++) != OCHAR)
- continue;
- assert(cp < g->must + g->mlen);
- *cp++ = (char)OPND(s);
- }
- assert(cp == g->must + g->mlen);
- *cp++ = '\0'; /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
- */
-static sopno /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
-{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
-
- if (p->error != 0)
- return(0); /* there may not be an OEND */
-
- scan = g->strip + 1;
- do {
- s = *scan++;
- switch (OP(s)) {
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
- }
- } while (OP(s) != OEND);
- if (plusnest != 0)
- g->iflags |= BAD;
- return(maxnest);
-}
diff --git a/regex/regcomp.ih b/regex/regcomp.ih
deleted file mode 100644
index ece1722f18..0000000000
--- a/regex/regcomp.ih
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/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 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 ../../regex/mkh ========= */
diff --git a/regex/regerror.c b/regex/regerror.c
deleted file mode 100644
index 12edd4e164..0000000000
--- a/regex/regerror.c
+++ /dev/null
@@ -1,124 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regerror.ih"
-
-/*
- = #define REG_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_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" },
- { 0, "", "*** unknown regexp error code ***" }
-};
-
-/*
- - regerror - the interface to error numbers
- = API_EXPORT(size_t) regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-API_EXPORT(size_t)
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
-{
- register struct rerr *r;
- register size_t len;
- register int target = errcode &~ REG_ITOA;
- register char *s;
- char convbuf[50];
-
- if (errcode == REG_ATOI)
- s = regatoi(preg, convbuf);
- else {
- for (r = rerrs; r->code != 0; r++)
- if (r->code == target)
- break;
-
- if (errcode&REG_ITOA) {
- if (r->code != 0)
- (void) strcpy(convbuf, r->name);
- else
- sprintf(convbuf, "REG_0x%x", target);
- assert(strlen(convbuf) < sizeof(convbuf));
- s = convbuf;
- } else
- s = r->explain;
- }
-
- len = strlen(s) + 1;
- if (errbuf_size > 0) {
- if (errbuf_size > len)
- (void) strcpy(errbuf, s);
- else {
- (void) strncpy(errbuf, s, errbuf_size-1);
- errbuf[errbuf_size-1] = '\0';
- }
- }
-
- return(len);
-}
-
-/*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
- */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
-{
- register struct rerr *r;
-
- for (r = rerrs; r->code != 0; r++)
- if (strcmp(r->name, preg->re_endp) == 0)
- break;
- if (r->code == 0)
- return("0");
-
- sprintf(localbuf, "%d", r->code);
- return(localbuf);
-}
diff --git a/regex/regerror.ih b/regex/regerror.ih
deleted file mode 100644
index 498a324f4b..0000000000
--- a/regex/regerror.ih
+++ /dev/null
@@ -1,12 +0,0 @@
-/* ========= begin header generated by ../../regex/mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === ../../regex/regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ../../regex/mkh ========= */
diff --git a/regex/regex.3 b/regex/regex.3
deleted file mode 100644
index 100c8a7f71..0000000000
--- a/regex/regex.3
+++ /dev/null
@@ -1,502 +0,0 @@
-.TH REGEX 3 "17 May 1993"
-.BY "Henry Spencer"
-.de ZR
-.\" one other place knows this name: the SEE ALSO section
-.IR regex (7) \\$1
-..
-.SH NAME
-regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.HP 10
-int regcomp(regex_t\ *preg, const\ char\ *pattern, int\ cflags);
-.HP
-int\ regexec(const\ regex_t\ *preg, const\ char\ *string,
-size_t\ nmatch, regmatch_t\ pmatch[], int\ eflags);
-.HP
-size_t\ regerror(int\ errcode, const\ regex_t\ *preg,
-char\ *errbuf, size_t\ errbuf_size);
-.HP
-void\ regfree(regex_t\ *preg);
-.\".ad
-.ft
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
-see
-.ZR .
-.I Regcomp
-compiles an RE written as a string into an internal form,
-.I regexec
-matches that internal form against a string and reports results,
-.I regerror
-transforms error codes from either into human-readable messages,
-and
-.I regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.PP
-The header
-.I <regex.h>
-declares two structure types,
-.I regex_t
-and
-.IR regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.IR regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.PP
-.I Regcomp
-compiles the regular expression contained in the
-.I pattern
-string,
-subject to the flags in
-.IR cflags ,
-and places the results in the
-.I regex_t
-structure pointed to by
-.IR preg .
-.I Cflags
-is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.I re_endp
-member of the structure pointed to by
-.IR preg .
-The
-.I re_endp
-member is of type
-.IR const\ char\ * .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-When successful,
-.I regcomp
-returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.IR re_endp )
-is publicized:
-.IR re_nsub ,
-of type
-.IR size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-REG_NOSUB flag was used).
-If
-.I regcomp
-fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.I Regexec
-matches the compiled RE pointed to by
-.I preg
-against the
-.IR string ,
-subject to the flags in
-.IR eflags ,
-and reports results using
-.IR nmatch ,
-.IR pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.IR regcomp .
-The compiled form is not altered during execution of
-.IR regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.PP
-By default,
-the NUL-terminated string pointed to by
-.I string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.I eflags
-argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
-The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_so\fR
-and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fIrm_eo\fR
-(there need not actually be a NUL at that location),
-regardless of the value of
-.IR nmatch .
-See below for the definition of
-.IR pmatch
-and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fIrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
-See
-.ZR
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.IR string .
-.PP
-Normally,
-.I regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
-is 0,
-.I regexec
-ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
-Otherwise,
-.I pmatch
-points to an array of
-.I nmatch
-structures of type
-.IR regmatch_t .
-Such a structure has at least the members
-.I rm_so
-and
-.IR rm_eo ,
-both of type
-.I regoff_t
-(a signed arithmetic type at least as large as an
-.I off_t
-and a
-.IR ssize_t ),
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.I string
-argument given to
-.IR regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.PP
-The 0th member of the
-.I pmatch
-array is filled in to indicate what substring of
-.I string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.I i
-reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fIre_nsub\fR)\(emhave both
-.I rm_so
-and
-.I rm_eo
-set to \-1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
-must point to at least one
-.I regmatch_t
-(even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
-Use for output is still entirely controlled by
-.IR nmatch ;
-if
-.I nmatch
-is 0 or REG_NOSUB was specified,
-the value of
-.IR pmatch [0]
-will not be changed by a successful
-.IR regexec .
-.PP
-.I Regerror
-maps a non-zero
-.I errcode
-from either
-.I regcomp
-or
-.I regexec
-to a human-readable, printable message.
-If
-.I preg
-is non-NULL,
-the error code should have arisen from use of
-the
-.I regex_t
-pointed to by
-.IR preg ,
-and if the error code came from
-.IR regcomp ,
-it should have been the result from the most recent
-.I regcomp
-using that
-.IR regex_t .
-.RI ( Regerror
-may be able to supply a more detailed message using information
-from the
-.IR regex_t .)
-.I Regerror
-places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
-limiting the length (including the NUL) to at most
-.I errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.I errbuf_size
-is 0,
-.I errbuf
-is ignored but the return value is still correct.
-.PP
-If the
-.I errcode
-given to
-.I regerror
-is first ORed with REG_ITOA,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.I errcode
-is REG_ATOI,
-then
-.I preg
-shall be non-NULL and the
-.I re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.I errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Be warned also that they are considered experimental and changes are possible.
-.PP
-.I Regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.IR preg .
-The remaining
-.I regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.I regexec
-or
-.I regerror
-is undefined.
-.PP
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.PP
-See
-.ZR
-for a discussion of the definition of case-independent matching.
-.PP
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.PP
-A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.PP
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.PP
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.SH SEE ALSO
-grep(1), regex(7)
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
-Non-zero error codes from
-.I regcomp
-and
-.I regexec
-include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH regexec() failed to match
-REG_BADPAT invalid regular expression
-REG_ECOLLATE invalid collating element
-REG_ECTYPE invalid character class
-REG_EESCAPE \e applied to unescapable character
-REG_ESUBREG invalid backreference number
-REG_EBRACK brackets [ ] not balanced
-REG_EPAREN parentheses ( ) not balanced
-REG_EBRACE braces { } not balanced
-REG_BADBR invalid repetition count(s) in { }
-REG_ERANGE invalid character range in [ ]
-REG_ESPACE ran out of memory
-REG_BADRPT ?, *, or + operand invalid
-REG_EMPTY empty (sub)expression
-REG_ASSERT ``can't happen''\(emyou found a bug
-REG_INVARG invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
-Written by Henry Spencer at University of Toronto,
-henry@zoo.toronto.edu.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
-and only the collating elements etc. of that locale are available.
-.PP
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.PP
-.I Regexec
-performance is poor.
-This will improve with later releases.
-.I Nmatch
-exceeding 0 is expensive;
-.I nmatch
-exceeding 1 is worse.
-.I Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.PP
-.I Regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.PP
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.PP
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/regex/regex.7 b/regex/regex.7
deleted file mode 100644
index d89012bda1..0000000000
--- a/regex/regex.7
+++ /dev/null
@@ -1,233 +0,0 @@
-.TH REGEX 7 "7 Feb 1994"
-.BY "Henry Spencer"
-.SH NAME
-regex \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.IR egrep ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.IR ed ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
-separated by `|'.
-It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.PP
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.PP
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.PP
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
-Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum digit punct
-alpha graph space
-blank lower upper
-cntrl print xdigit
-.fi
-.RE
-.PP
-These stand for the character classes defined in
-.IR ctype (3).
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.PP
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
-A word character is an
-.I alnum
-character (as defined by
-.IR ctype (3))
-or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
-In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.PP
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.PP
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.PP
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
-matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
-Having two kinds of REs is a botch.
-.PP
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
-Avoid relying on it.
-.PP
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.PP
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.PP
-The syntax for word boundaries is incredibly ugly.
diff --git a/regex/regex.dsp b/regex/regex.dsp
deleted file mode 100644
index e8f1ad4299..0000000000
--- a/regex/regex.dsp
+++ /dev/null
@@ -1,106 +0,0 @@
-# Microsoft Developer Studio Project File - Name="regex" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 5.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=regex - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "regex - Win32 Release"
-# Name "regex - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\regcomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regerror.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regexec.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\regfree.c
-# End Source File
-# End Target
-# End Project
diff --git a/regex/regex.dsw b/regex/regex.dsw
deleted file mode 100644
index 7b7df8126c..0000000000
--- a/regex/regex.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 5.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "regex"=.\regex.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/regex/regex.h b/regex/regex.h
deleted file mode 100644
index 162b2b0a34..0000000000
--- a/regex/regex.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef _REGEX_H_
-#define _REGEX_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_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
diff --git a/regex/regex.mak b/regex/regex.mak
deleted file mode 100644
index b87ded340b..0000000000
--- a/regex/regex.mak
+++ /dev/null
@@ -1,304 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on regex.dsp
-!IF "$(CFG)" == ""
-CFG=regex - Win32 Release
-!MESSAGE No configuration specified. Defaulting to regex - Win32 Release.
-!ENDIF
-
-!IF "$(CFG)" != "regex - Win32 Release" && "$(CFG)" != "regex - Win32 Debug"
-!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "regex.mak" CFG="regex - Win32 Release"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "regex - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "regex - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-!ERROR An invalid configuration is specified.
-!ENDIF
-
-!IF "$(OS)" == "Windows_NT"
-NULL=
-!ELSE
-NULL=nul
-!ENDIF
-
-CPP=cl.exe
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-OUTDIR=.\Release
-INTDIR=.\Release
-# Begin Custom Macros
-OutDir=.\.\Release
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
- /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Release/
-CPP_SBRS=.
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-OUTDIR=.\Debug
-INTDIR=.\Debug
-# Begin Custom Macros
-OutDir=.\.\Debug
-# End Custom Macros
-
-!IF "$(RECURSE)" == "0"
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ELSE
-
-ALL : "$(OUTDIR)\regex.lib" "$(OUTDIR)\regex.bsc"
-
-!ENDIF
-
-CLEAN :
- -@erase "$(INTDIR)\regcomp.obj"
- -@erase "$(INTDIR)\regcomp.sbr"
- -@erase "$(INTDIR)\regerror.obj"
- -@erase "$(INTDIR)\regerror.sbr"
- -@erase "$(INTDIR)\regexec.obj"
- -@erase "$(INTDIR)\regexec.sbr"
- -@erase "$(INTDIR)\regfree.obj"
- -@erase "$(INTDIR)\regfree.sbr"
- -@erase "$(INTDIR)\vc50.idb"
- -@erase "$(OUTDIR)\regex.bsc"
- -@erase "$(OUTDIR)\regex.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP_PROJ=/nologo /MDd /W3 /GX /Z7 /Od /I "." /D "WIN32" /D "_DEBUG" /D\
- "_WINDOWS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\regex.pch" /YX /Fo"$(INTDIR)\\"\
- /Fd"$(INTDIR)\\" /FD /c
-CPP_OBJS=.\Debug/
-CPP_SBRS=.\Debug/
-BSC32=bscmake.exe
-BSC32_FLAGS=/nologo /o"$(OUTDIR)\regex.bsc"
-BSC32_SBRS= \
- "$(INTDIR)\regcomp.sbr" \
- "$(INTDIR)\regerror.sbr" \
- "$(INTDIR)\regexec.sbr" \
- "$(INTDIR)\regfree.sbr"
-
-"$(OUTDIR)\regex.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
- $(BSC32) @<<
- $(BSC32_FLAGS) $(BSC32_SBRS)
-<<
-
-LIB32=link.exe -lib
-LIB32_FLAGS=/nologo /out:"$(OUTDIR)\regex.lib"
-LIB32_OBJS= \
- "$(INTDIR)\regcomp.obj" \
- "$(INTDIR)\regerror.obj" \
- "$(INTDIR)\regexec.obj" \
- "$(INTDIR)\regfree.obj"
-
-"$(OUTDIR)\regex.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
- $(LIB32) @<<
- $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
-<<
-
-!ENDIF
-
-.c{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_OBJS)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(CPP_SBRS)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-
-!IF "$(CFG)" == "regex - Win32 Release" || "$(CFG)" == "regex - Win32 Debug"
-SOURCE=.\regcomp.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regcomp.obj" : $(SOURCE) $(DEP_CPP_REGCO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGCO=\
- ".\cclass.h"\
- ".\cname.h"\
- ".\regcomp.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regcomp.obj" "$(INTDIR)\regcomp.sbr" : $(SOURCE) $(DEP_CPP_REGCO)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regerror.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regerror.obj" : $(SOURCE) $(DEP_CPP_REGER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGER=\
- ".\regerror.ih"\
- ".\regex.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regerror.obj" "$(INTDIR)\regerror.sbr" : $(SOURCE) $(DEP_CPP_REGER)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regexec.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regexec.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGEX=\
- ".\engine.c"\
- ".\engine.ih"\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regexec.obj" "$(INTDIR)\regexec.sbr" : $(SOURCE) $(DEP_CPP_REGEX)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\regfree.c
-
-!IF "$(CFG)" == "regex - Win32 Release"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
-
-
-"$(INTDIR)\regfree.obj" : $(SOURCE) $(DEP_CPP_REGFR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "regex - Win32 Debug"
-
-DEP_CPP_REGFR=\
- ".\regex.h"\
- ".\regex2.h"\
- ".\utils.h"\
- {$(INCLUDE)}"sys\types.h"\
-
-
-"$(INTDIR)\regfree.obj" "$(INTDIR)\regfree.sbr" : $(SOURCE) $(DEP_CPP_REGFR)\
- "$(INTDIR)"
-
-
-!ENDIF
-
-SOURCE=.\engine.c
-
-!ENDIF
-
diff --git a/regex/regex2.h b/regex/regex2.h
deleted file mode 100644
index 3e8c0d65c4..0000000000
--- a/regex/regex2.h
+++ /dev/null
@@ -1,138 +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 unsigned long sop; /* strip operator */
-typedef long sopno;
-#define OPRMASK 0xf8000000
-#define OPDMASK 0x07ffffff
-#define OPSHIFT ((unsigned)27)
-#define OP(n) ((n)&OPRMASK)
-#define OPND(n) ((n)&OPDMASK)
-#define SOP(op, opnd) ((op)|(opnd))
-/* operators meaning operand */
-/* (back, fwd are offsets) */
-#define OEND (1<<OPSHIFT) /* endmarker - */
-#define OCHAR (2<<OPSHIFT) /* character unsigned char */
-#define OBOL (3<<OPSHIFT) /* left anchor - */
-#define OEOL (4<<OPSHIFT) /* right anchor - */
-#define OANY (5<<OPSHIFT) /* . - */
-#define OANYOF (6<<OPSHIFT) /* [...] set number */
-#define OBACK_ (7<<OPSHIFT) /* begin \d paren number */
-#define O_BACK (8<<OPSHIFT) /* end \d paren number */
-#define OPLUS_ (9<<OPSHIFT) /* + prefix fwd to suffix */
-#define O_PLUS (10<<OPSHIFT) /* + suffix back to prefix */
-#define OQUEST_ (11<<OPSHIFT) /* ? prefix fwd to suffix */
-#define O_QUEST (12<<OPSHIFT) /* ? suffix back to prefix */
-#define OLPAREN (13<<OPSHIFT) /* ( fwd to ) */
-#define ORPAREN (14<<OPSHIFT) /* ) back to ( */
-#define OCH_ (15<<OPSHIFT) /* begin choice fwd to OOR2 */
-#define OOR1 (16u<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
-#define OOR2 (17u<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
-#define O_CH (18u<<OPSHIFT) /* end choice back to OOR1 */
-#define OBOW (19u<<OPSHIFT) /* begin word - */
-#define OEOW (20u<<OPSHIFT) /* end word - */
-
-/*
- * Structure for [] character-set representation. Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte. A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements. As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
- uch *ptr; /* -> uch [csetsize] */
- uch mask; /* bit within array */
- uch hash; /* hash code */
- size_t smultis;
- char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
- int magic;
-# define MAGIC2 ((('R'^0200)<<8)|'E')
- sop *strip; /* malloced area for strip */
- int csetsize; /* number of bits in a cset vector */
- int ncsets; /* number of csets in use */
- cset *sets; /* -> cset [ncsets] */
- uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
- int cflags; /* copy of regcomp() cflags argument */
- sopno nstates; /* = number of sops */
- sopno firststate; /* the initial OEND (normally 0) */
- sopno laststate; /* the final OEND */
- int iflags; /* internal flags */
-# define USEBOL 01 /* used ^ */
-# define USEEOL 02 /* used $ */
-# define BAD 04 /* something wrong */
- int nbol; /* number of ^ used */
- int neol; /* number of $ used */
- int ncategories; /* how many character categories */
- cat_t *categories; /* ->catspace[-CHAR_MIN] */
- char *must; /* match must contain this string */
- int mlen; /* length of must */
- size_t nsub; /* copy of re_nsub */
- int backrefs; /* does it use back references? */
- sopno nplus; /* how deep does it nest +s? */
- /* catspace must be last */
- cat_t catspace[1]; /* actually [NC] */
-};
-
-/* misc utilities */
-#define OUT (CHAR_MAX+1) /* a non-character value */
-#define ISWORD(c) (isalnum(c) || (c) == '_')
diff --git a/regex/regexec.c b/regex/regexec.c
deleted file mode 100644
index a552f5a394..0000000000
--- a/regex/regexec.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses. This lets the same code operate on two different
- * representations for state sets.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-#ifndef NDEBUG
-static int nope = 0; /* for use in asserts; shuts lint up */
-#endif
-
-/* macros for manipulating states, small version */
-#define states long
-#define states1 states /* for later use in regexec() decision */
-#define CLEAR(v) ((v) = 0)
-#define SET0(v, n) ((v) &= ~(1 << (n)))
-#define SET1(v, n) ((v) |= 1 << (n))
-#define ISSET(v, n) ((v) & (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 int
-#define INIT(o, n) ((o) = (unsigned)1 << (n))
-#define INC(o) ((o) <<= 1)
-#define ISSTATEIN(v, o) ((v) & (o))
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define BACK(dst, src, n) ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
-/* function names */
-#define SNAMES /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define states char *
-#define CLEAR(v) memset(v, 0, m->g->nstates)
-#define SET0(v, n) ((v)[n] = 0)
-#define SET1(v, n) ((v)[n] = 1)
-#define ISSET(v, n) ((v)[n])
-#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
-#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
-#define STATEVARS int vn; char *space
-#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
- if ((m)->space == NULL) return(REG_ESPACE); \
- (m)->vn = 0; }
-#define STATETEARDOWN(m) { free((m)->space); }
-#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
-#define onestate int
-#define INIT(o, n) ((o) = (n))
-#define INC(o) ((o)++)
-#define ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
-#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
-#define ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define LNAMES /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = API_EXPORT(int) regexec(const regex_t *, const char *, size_t, \
- = regmatch_t [], int);
- = #define REG_NOTBOL 00001
- = #define REG_NOTEOL 00002
- = #define REG_STARTEND 00004
- = #define REG_TRACE 00400 // tracing of execution
- = #define REG_LARGE 01000 // force large representation
- = #define REG_BACKR 02000 // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call. Also, by this point the matchers
- * have been prototyped.
- */
-API_EXPORT(int) /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
-{
- register struct re_guts *g = preg->re_g;
-#ifdef REDEBUG
-# define GOODFLAGS(f) (f)
-#else
-# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
- if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
- return(REG_BADPAT);
- assert(!(g->iflags&BAD));
- if (g->iflags&BAD) /* backstop for no-debug case */
- return(REG_BADPAT);
- eflags = GOODFLAGS(eflags);
-
- if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
- return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
- else
- return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
-}
diff --git a/regex/regfree.c b/regex/regfree.c
deleted file mode 100644
index 9fd618a13b..0000000000
--- a/regex/regfree.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = API_EXPORT(void) regfree(regex_t *);
- */
-API_EXPORT(void)
-regfree(preg)
-regex_t *preg;
-{
- register struct re_guts *g;
-
- if (preg->re_magic != MAGIC1) /* oops */
- return; /* nice to complain, but hard */
-
- g = preg->re_g;
- if (g == NULL || g->magic != MAGIC2) /* oops again */
- return;
- preg->re_magic = 0; /* mark it invalid */
- g->magic = 0; /* mark it invalid */
-
- if (g->strip != NULL)
- free((char *)g->strip);
- if (g->sets != NULL)
- free((char *)g->sets);
- if (g->setbits != NULL)
- free((char *)g->setbits);
- if (g->must != NULL)
- free(g->must);
- free((char *)g);
-}
diff --git a/regex/split.c b/regex/split.c
deleted file mode 100644
index 188bdb775b..0000000000
--- a/regex/split.c
+++ /dev/null
@@ -1,316 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-/*
- - split - divide a string into fields, like awk split()
- = int split(char *string, char *fields[], int nfields, char *sep);
- */
-int /* number of fields, including overflow */
-split(string, fields, nfields, sep)
-char *string;
-char *fields[]; /* list is not NULL-terminated */
-int nfields; /* number of entries available in fields[] */
-char *sep; /* "" white, "c" single char, "ab" [ab]+ */
-{
- register char *p = string;
- register char c; /* latest character */
- register char sepc = sep[0];
- register char sepc2;
- register int fn;
- register char **fp = fields;
- register char *sepp;
- register int trimtrail;
-
- /* white space */
- if (sepc == '\0') {
- while ((c = *p++) == ' ' || c == '\t')
- continue;
- p--;
- trimtrail = 1;
- sep = " \t"; /* note, code below knows this is 2 long */
- sepc = ' ';
- } else
- trimtrail = 0;
- sepc2 = sep[1]; /* now we can safely pick this up */
-
- /* catch empties */
- if (*p == '\0')
- return(0);
-
- /* single separator */
- if (sepc2 == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- if (fn == 0)
- break;
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(nfields - fn);
- *(p-1) = '\0';
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- for (;;) {
- while ((c = *p++) != sepc)
- if (c == '\0')
- return(fn);
- fn++;
- }
- /* not reached */
- }
-
- /* two separators */
- if (sep[2] == '\0') {
- fn = nfields;
- for (;;) {
- *fp++ = p;
- fn--;
- while ((c = *p++) != sepc && c != sepc2)
- if (c == '\0') {
- if (trimtrail && **(fp-1) == '\0')
- fn++;
- return(nfields - fn);
- }
- if (fn == 0)
- break;
- *(p-1) = '\0';
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- }
- /* we have overflowed the fields vector -- just count them */
- fn = nfields;
- while (c != '\0') {
- while ((c = *p++) == sepc || c == sepc2)
- continue;
- p--;
- fn++;
- while ((c = *p++) != '\0' && c != sepc && c != sepc2)
- continue;
- }
- /* might have to trim trailing white space */
- if (trimtrail) {
- p--;
- while ((c = *--p) == sepc || c == sepc2)
- continue;
- p++;
- if (*p != '\0') {
- if (fn == nfields+1)
- *p = '\0';
- fn--;
- }
- }
- return(fn);
- }
-
- /* n separators */
- fn = 0;
- for (;;) {
- if (fn < nfields)
- *fp++ = p;
- fn++;
- for (;;) {
- c = *p++;
- if (c == '\0')
- return(fn);
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc != '\0') /* it was a separator */
- break;
- }
- if (fn < nfields)
- *(p-1) = '\0';
- for (;;) {
- c = *p++;
- sepp = sep;
- while ((sepc = *sepp++) != '\0' && sepc != c)
- continue;
- if (sepc == '\0') /* it wasn't a separator */
- break;
- }
- p--;
- }
-
- /* not reached */
-}
-
-#ifdef TEST_SPLIT
-
-
-/*
- * test program
- * pgm runs regression
- * pgm sep splits stdin lines by sep
- * pgm str sep splits str by sep
- * pgm str sep n splits str by sep n times
- */
-int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- char buf[512];
- register int n;
-# define MNF 10
- char *fields[MNF];
-
- if (argc > 4)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- }
- else if (argc > 3)
- for (n = atoi(argv[3]); n > 0; n--) {
- (void) strcpy(buf, argv[1]);
- (void) split(buf, fields, MNF, argv[2]);
- }
- else if (argc > 2)
- dosplit(argv[1], argv[2]);
- else if (argc > 1)
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- buf[strlen(buf)-1] = '\0'; /* stomp newline */
- dosplit(buf, argv[1]);
- }
- else
- regress();
-
- exit(0);
-}
-
-dosplit(string, seps)
-char *string;
-char *seps;
-{
-# define NF 5
- char *fields[NF];
- register int nf;
-
- nf = split(string, fields, NF, seps);
- print(nf, NF, fields);
-}
-
-print(nf, nfp, fields)
-int nf;
-int nfp;
-char *fields[];
-{
- register int fn;
- register int bound;
-
- bound = (nf > nfp) ? nfp : nf;
- printf("%d:\t", nf);
- for (fn = 0; fn < bound; fn++)
- printf("\"%s\"%s", fields[fn], (fn+1 < nf) ? ", " : "\n");
-}
-
-#define RNF 5 /* some table entries know this */
-struct {
- char *str;
- char *seps;
- int nf;
- char *fi[RNF];
-} tests[] = {
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 5, { "abc", "def", "", "g", "" },
- " a bcd", " ", 4, { "", "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", " _", 0, { "" },
- " ", " _", 2, { "", "" },
- "x", " _", 1, { "x" },
- "x y", " _", 2, { "x", "y" },
- "ab _ cd", " _", 2, { "ab", "cd" },
- " a_b c ", " _", 5, { "", "a", "b", "c", "" },
- "a b c_d e f", " _", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " _", 6, { "", "a", "b", "c", "d " },
-
- "", " _~", 0, { "" },
- " ", " _~", 2, { "", "" },
- "x", " _~", 1, { "x" },
- "x y", " _~", 2, { "x", "y" },
- "ab _~ cd", " _~", 2, { "ab", "cd" },
- " a_b c~", " _~", 5, { "", "a", "b", "c", "" },
- "a b_c d~e f", " _~", 6, { "a", "b", "c", "d", "e f" },
- "~a b c d ", " _~", 6, { "", "a", "b", "c", "d " },
-
- "", " _~-", 0, { "" },
- " ", " _~-", 2, { "", "" },
- "x", " _~-", 1, { "x" },
- "x y", " _~-", 2, { "x", "y" },
- "ab _~- cd", " _~-", 2, { "ab", "cd" },
- " a_b c~", " _~-", 5, { "", "a", "b", "c", "" },
- "a b_c-d~e f", " _~-", 6, { "a", "b", "c", "d", "e f" },
- "~a-b c d ", " _~-", 6, { "", "a", "b", "c", "d " },
-
- "", " ", 0, { "" },
- " ", " ", 2, { "", "" },
- "x", " ", 1, { "x" },
- "xy", " ", 1, { "xy" },
- "x y", " ", 2, { "x", "y" },
- "abc def g ", " ", 4, { "abc", "def", "g", "" },
- " a bcd", " ", 3, { "", "a", "bcd" },
- "a b c d e f", " ", 6, { "a", "b", "c", "d", "e f" },
- " a b c d ", " ", 6, { "", "a", "b", "c", "d " },
-
- "", "", 0, { "" },
- " ", "", 0, { "" },
- "x", "", 1, { "x" },
- "xy", "", 1, { "xy" },
- "x y", "", 2, { "x", "y" },
- "abc def g ", "", 3, { "abc", "def", "g" },
- "\t a bcd", "", 2, { "a", "bcd" },
- " a \tb\t c ", "", 3, { "a", "b", "c" },
- "a b c d e ", "", 5, { "a", "b", "c", "d", "e" },
- "a b\tc d e f", "", 6, { "a", "b", "c", "d", "e f" },
- " a b c d e f ", "", 6, { "a", "b", "c", "d", "e f " },
-
- NULL, NULL, 0, { NULL },
-};
-
-regress()
-{
- char buf[512];
- register int n;
- char *fields[RNF+1];
- register int nf;
- register int i;
- register int printit;
- register char *f;
-
- for (n = 0; tests[n].str != NULL; n++) {
- (void) strcpy(buf, tests[n].str);
- fields[RNF] = NULL;
- nf = split(buf, fields, RNF, tests[n].seps);
- printit = 0;
- if (nf != tests[n].nf) {
- printf("split `%s' by `%s' gave %d fields, not %d\n",
- tests[n].str, tests[n].seps, nf, tests[n].nf);
- printit = 1;
- } else if (fields[RNF] != NULL) {
- printf("split() went beyond array end\n");
- printit = 1;
- } else {
- for (i = 0; i < nf && i < RNF; i++) {
- f = fields[i];
- if (f == NULL)
- f = "(NULL)";
- if (strcmp(f, tests[n].fi[i]) != 0) {
- printf("split `%s' by `%s', field %d is `%s', not `%s'\n",
- tests[n].str, tests[n].seps,
- i, fields[i], tests[n].fi[i]);
- printit = 1;
- }
- }
- }
- if (printit)
- print(nf, RNF, fields);
- }
-}
-#endif
diff --git a/regex/tests b/regex/tests
deleted file mode 100644
index c05846177f..0000000000
--- a/regex/tests
+++ /dev/null
@@ -1,475 +0,0 @@
-# regular expression test set
-# Lines are at least three fields, separated by one or more tabs. "" stands
-# for an empty field. First field is an RE. Second field is flags. If
-# C flag given, regcomp() is expected to fail, and the third field is the
-# error name (minus the leading REG_).
-#
-# Otherwise it is expected to succeed, and the third field is the string to
-# try matching it against. If there is no fourth field, the match is
-# expected to fail. If there is a fourth field, it is the substring that
-# the RE is expected to match. If there is a fifth field, it is a comma-
-# separated list of what the subexpressions should match, with - indicating
-# no match for that one. In both the fourth and fifth fields, a (sub)field
-# starting with @ indicates that the (sub)expression is expected to match
-# a null string followed by the stuff after the @; this provides a way to
-# test where null strings match. The character `N' in REs and strings
-# is newline, `S' is space, `T' is tab, `Z' is NUL.
-#
-# The full list of flags:
-# - placeholder, does nothing
-# b RE is a BRE, not an ERE
-# & try it as both an ERE and a BRE
-# C regcomp() error expected, third field is error name
-# i REG_ICASE
-# m ("mundane") REG_NOSPEC
-# s REG_NOSUB (not really testable)
-# n REG_NEWLINE
-# ^ REG_NOTBOL
-# $ REG_NOTEOL
-# # REG_STARTEND (see below)
-# p REG_PEND
-#
-# For REG_STARTEND, the start/end offsets are those of the substring
-# enclosed in ().
-
-# basics
-a & a a
-abc & abc abc
-abc|de - abc abc
-a|b|c - abc a
-
-# parentheses and perversions thereof
-a(b)c - abc abc
-a\(b\)c b abc abc
-a( C EPAREN
-a( b a( a(
-a\( - a( a(
-a\( bC EPAREN
-a\(b bC EPAREN
-a(b C EPAREN
-a(b b a(b a(b
-# gag me with a right parenthesis -- 1003.2 goofed here (my fault, partly)
-a) - a) a)
-) - ) )
-# end gagging (in a just world, those *should* give EPAREN)
-a) b a) a)
-a\) bC EPAREN
-\) bC EPAREN
-a()b - ab ab
-a\(\)b b ab ab
-
-# anchoring and REG_NEWLINE
-^abc$ & abc abc
-a^b - a^b
-a^b b a^b a^b
-a$b - a$b
-a$b b a$b a$b
-^ & abc @abc
-$ & abc @
-^$ & "" @
-$^ - "" @
-\($\)\(^\) b "" @
-# stop retching, those are legitimate (although disgusting)
-^^ - "" @
-$$ - "" @
-b$ & abNc
-b$ &n abNc b
-^b$ & aNbNc
-^b$ &n aNbNc b
-^$ &n aNNb @Nb
-^$ n abc
-^$ n abcN @
-$^ n aNNb @Nb
-\($\)\(^\) bn aNNb @Nb
-^^ n^ aNNb @Nb
-$$ n aNNb @NN
-^a ^ a
-a$ $ a
-^a ^n aNb
-^b ^n aNb b
-a$ $n bNa
-b$ $n bNa b
-a*(^b$)c* - b b
-a*\(^b$\)c* b b b
-
-# certain syntax errors and non-errors
-| C EMPTY
-| b | |
-* C BADRPT
-* b * *
-+ C BADRPT
-? C BADRPT
-"" &C EMPTY
-() - abc @abc
-\(\) b abc @abc
-a||b C EMPTY
-|ab C EMPTY
-ab| C EMPTY
-(|a)b C EMPTY
-(a|)b C EMPTY
-(*a) C BADRPT
-(+a) C BADRPT
-(?a) C BADRPT
-({1}a) C BADRPT
-\(\{1\}a\) bC BADRPT
-(a|*b) C BADRPT
-(a|+b) C BADRPT
-(a|?b) C BADRPT
-(a|{1}b) C BADRPT
-^* C BADRPT
-^* b * *
-^+ C BADRPT
-^? C BADRPT
-^{1} C BADRPT
-^\{1\} bC BADRPT
-
-# metacharacters, backslashes
-a.c & abc abc
-a[bc]d & abd abd
-a\*c & a*c a*c
-a\\b & a\b a\b
-a\\\*b & a\*b a\*b
-a\bc & abc abc
-a\ &C EESCAPE
-a\\bc & a\bc a\bc
-\{ bC BADRPT
-a\[b & a[b a[b
-a[b &C EBRACK
-# trailing $ is a peculiar special case for the BRE code
-a$ & a a
-a$ & a$
-a\$ & a
-a\$ & a$ a$
-a\\$ & a
-a\\$ & a$
-a\\$ & a\$
-a\\$ & a\ a\
-
-# back references, ugh
-a\(b\)\2c bC ESUBREG
-a\(b\1\)c bC ESUBREG
-a\(b*\)c\1d b abbcbbd abbcbbd bb
-a\(b*\)c\1d b abbcbd
-a\(b*\)c\1d b abbcbbbd
-^\(.\)\1 b abc
-a\([bc]\)\1d b abcdabbd abbd b
-a\(\([bc]\)\2\)*d b abbccd abbccd
-a\(\([bc]\)\2\)*d b abbcbd
-# actually, this next one probably ought to fail, but the spec is unclear
-a\(\(b\)*\2\)*d b abbbd abbbd
-# here is a case that no NFA implementation does right
-\(ab*\)[ab]*\1 b ababaaa ababaaa a
-# check out normal matching in the presence of back refs
-\(a\)\1bcd b aabcd aabcd
-\(a\)\1bc*d b aabcd aabcd
-\(a\)\1bc*d b aabd aabd
-\(a\)\1bc*d b aabcccd aabcccd
-\(a\)\1bc*[ce]d b aabcccd aabcccd
-^\(a\)\1b\(c\)*cd$ b aabcccd aabcccd
-
-# ordinary repetitions
-ab*c & abc abc
-ab+c - abc abc
-ab?c - abc abc
-a\(*\)b b a*b a*b
-a\(**\)b b ab ab
-a\(***\)b bC BADRPT
-*a b *a *a
-**a b a a
-***a bC BADRPT
-
-# the dreaded bounded repetitions
-{ & { {
-{abc & {abc {abc
-{1 C BADRPT
-{1} C BADRPT
-a{b & a{b a{b
-a{1}b - ab ab
-a\{1\}b b ab ab
-a{1,}b - ab ab
-a\{1,\}b b ab ab
-a{1,2}b - aab aab
-a\{1,2\}b b aab aab
-a{1 C EBRACE
-a\{1 bC EBRACE
-a{1a C EBRACE
-a\{1a bC EBRACE
-a{1a} C BADBR
-a\{1a\} bC BADBR
-a{,2} - a{,2} a{,2}
-a\{,2\} bC BADBR
-a{,} - a{,} a{,}
-a\{,\} bC BADBR
-a{1,x} C BADBR
-a\{1,x\} bC BADBR
-a{1,x C EBRACE
-a\{1,x bC EBRACE
-a{300} C BADBR
-a\{300\} bC BADBR
-a{1,0} C BADBR
-a\{1,0\} bC BADBR
-ab{0,0}c - abcac ac
-ab\{0,0\}c b abcac ac
-ab{0,1}c - abcac abc
-ab\{0,1\}c b abcac abc
-ab{0,3}c - abbcac abbc
-ab\{0,3\}c b abbcac abbc
-ab{1,1}c - acabc abc
-ab\{1,1\}c b acabc abc
-ab{1,3}c - acabc abc
-ab\{1,3\}c b acabc abc
-ab{2,2}c - abcabbc abbc
-ab\{2,2\}c b abcabbc abbc
-ab{2,4}c - abcabbc abbc
-ab\{2,4\}c b abcabbc abbc
-((a{1,10}){1,10}){1,10} - a a a,a
-
-# multiple repetitions
-a** &C BADRPT
-a++ C BADRPT
-a?? C BADRPT
-a*+ C BADRPT
-a*? C BADRPT
-a+* C BADRPT
-a+? C BADRPT
-a?* C BADRPT
-a?+ C BADRPT
-a{1}{1} C BADRPT
-a*{1} C BADRPT
-a+{1} C BADRPT
-a?{1} C BADRPT
-a{1}* C BADRPT
-a{1}+ C BADRPT
-a{1}? C BADRPT
-a*{b} - a{b} a{b}
-a\{1\}\{1\} bC BADRPT
-a*\{1\} bC BADRPT
-a\{1\}* bC BADRPT
-
-# brackets, and numerous perversions thereof
-a[b]c & abc abc
-a[ab]c & abc abc
-a[^ab]c & adc adc
-a[]b]c & a]c a]c
-a[[b]c & a[c a[c
-a[-b]c & a-c a-c
-a[^]b]c & adc adc
-a[^-b]c & adc adc
-a[b-]c & a-c a-c
-a[b &C EBRACK
-a[] &C EBRACK
-a[1-3]c & a2c a2c
-a[3-1]c &C ERANGE
-a[1-3-5]c &C ERANGE
-a[[.-.]--]c & a-c a-c
-a[1- &C ERANGE
-a[[. &C EBRACK
-a[[.x &C EBRACK
-a[[.x. &C EBRACK
-a[[.x.] &C EBRACK
-a[[.x.]] & ax ax
-a[[.x,.]] &C ECOLLATE
-a[[.one.]]b & a1b a1b
-a[[.notdef.]]b &C ECOLLATE
-a[[.].]]b & a]b a]b
-a[[:alpha:]]c & abc abc
-a[[:notdef:]]c &C ECTYPE
-a[[: &C EBRACK
-a[[:alpha &C EBRACK
-a[[:alpha:] &C EBRACK
-a[[:alpha,:] &C ECTYPE
-a[[:]:]]b &C ECTYPE
-a[[:-:]]b &C ECTYPE
-a[[:alph:]] &C ECTYPE
-a[[:alphabet:]] &C ECTYPE
-[[:alnum:]]+ - -%@a0X- a0X
-[[:alpha:]]+ - -%@aX0- aX
-[[:blank:]]+ - aSSTb SST
-[[:cntrl:]]+ - aNTb NT
-[[:digit:]]+ - a019b 019
-[[:graph:]]+ - Sa%bS a%b
-[[:lower:]]+ - AabC ab
-[[:print:]]+ - NaSbN aSb
-[[:punct:]]+ - S%-&T %-&
-[[:space:]]+ - aSNTb SNT
-[[:upper:]]+ - aBCd BC
-[[:xdigit:]]+ - p0f3Cq 0f3C
-a[[=b=]]c & abc abc
-a[[= &C EBRACK
-a[[=b &C EBRACK
-a[[=b= &C EBRACK
-a[[=b=] &C EBRACK
-a[[=b,=]] &C ECOLLATE
-a[[=one=]]b & a1b a1b
-
-# complexities
-a(((b)))c - abc abc
-a(b|(c))d - abd abd
-a(b*|c)d - abbd abbd
-# just gotta have one DFA-buster, of course
-a[ab]{20} - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and an inline expansion in case somebody gets tricky
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab] - aaaaabaaaabaaaabaaaab aaaaabaaaabaaaabaaaab
-# and in case somebody just slips in an NFA...
-a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night) - aaaaabaaaabaaaabaaaabweeknights aaaaabaaaabaaaabaaaabweeknights
-# fish for anomalies as the number of states passes 32
-12345678901234567890123456789 - a12345678901234567890123456789b 12345678901234567890123456789
-123456789012345678901234567890 - a123456789012345678901234567890b 123456789012345678901234567890
-1234567890123456789012345678901 - a1234567890123456789012345678901b 1234567890123456789012345678901
-12345678901234567890123456789012 - a12345678901234567890123456789012b 12345678901234567890123456789012
-123456789012345678901234567890123 - a123456789012345678901234567890123b 123456789012345678901234567890123
-# and one really big one, beyond any plausible word width
-1234567890123456789012345678901234567890123456789012345678901234567890 - a1234567890123456789012345678901234567890123456789012345678901234567890b 1234567890123456789012345678901234567890123456789012345678901234567890
-# fish for problems as brackets go past 8
-[ab][cd][ef][gh][ij][kl][mn] - xacegikmoq acegikm
-[ab][cd][ef][gh][ij][kl][mn][op] - xacegikmoq acegikmo
-[ab][cd][ef][gh][ij][kl][mn][op][qr] - xacegikmoqy acegikmoq
-[ab][cd][ef][gh][ij][kl][mn][op][q] - xacegikmoqy acegikmoq
-
-# subtleties of matching
-abc & xabcy abc
-a\(b\)?c\1d b acd
-aBc i Abc Abc
-a[Bc]*d i abBCcd abBCcd
-0[[:upper:]]1 &i 0a1 0a1
-0[[:lower:]]1 &i 0A1 0A1
-a[^b]c &i abc
-a[^b]c &i aBc
-a[^b]c &i adc adc
-[a]b[c] - abc abc
-[a]b[a] - aba aba
-[abc]b[abc] - abc abc
-[abc]b[abd] - abd abd
-a(b?c)+d - accd accd
-(wee|week)(knights|night) - weeknights weeknights
-(we|wee|week|frob)(knights|night|day) - weeknights weeknights
-a[bc]d - xyzaaabcaababdacd abd
-a[ab]c - aaabc abc
-abc s abc abc
-a* & b @b
-
-# Let's have some fun -- try to match a C comment.
-# first the obvious, which looks okay at first glance...
-/\*.*\*/ - /*x*/ /*x*/
-# but...
-/\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/
-# okay, we must not match */ inside; try to do that...
-/\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/
-/\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/
-# but...
-/\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/
-# and a still fancier version, which does it right (I think)...
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/
-/\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/
-/\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/
-/\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/
-
-# subexpressions
-a(b)(c)d - abcd abcd b,c
-a(((b)))c - abc abc b,b,b
-a(b|(c))d - abd abd b,-
-a(b*|c|e)d - abbd abbd bb
-a(b*|c|e)d - acd acd c
-a(b*|c|e)d - ad ad @d
-a(b?)c - abc abc b
-a(b?)c - ac ac @c
-a(b+)c - abc abc b
-a(b+)c - abbbc abbbc bbb
-a(b*)c - ac ac @c
-(a|ab)(bc([de]+)f|cde) - abcdef abcdef a,bcdef,de
-# the regression tester only asks for 9 subexpressions
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)k - abcdefghijk abcdefghijk b,c,d,e,f,g,h,i,j
-a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l - abcdefghijkl abcdefghijkl b,c,d,e,f,g,h,i,j,k
-a([bc]?)c - abc abc b
-a([bc]?)c - ac ac @c
-a([bc]+)c - abc abc b
-a([bc]+)c - abcc abcc bc
-a([bc]+)bc - abcbc abcbc bc
-a(bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abb abb b
-a(bbb+|bb+|b)b - abbb abbb bb
-a(bbb+|bb+|b)bb - abbb abbb b
-(.*).* - abcdef abcdef abcdef
-(a*)* - bc @b @b
-
-# do we get the right subexpression when it is used more than once?
-a(b|c)*d - ad ad -
-a(b|c)*d - abcd abcd c
-a(b|c)+d - abd abd b
-a(b|c)+d - abcd abcd c
-a(b|c?)+d - ad ad @d
-a(b|c?)+d - abcd abcd @d
-a(b|c){0,0}d - ad ad -
-a(b|c){0,1}d - ad ad -
-a(b|c){0,1}d - abd abd b
-a(b|c){0,2}d - ad ad -
-a(b|c){0,2}d - abcd abcd c
-a(b|c){0,}d - ad ad -
-a(b|c){0,}d - abcd abcd c
-a(b|c){1,1}d - abd abd b
-a(b|c){1,1}d - acd acd c
-a(b|c){1,2}d - abd abd b
-a(b|c){1,2}d - abcd abcd c
-a(b|c){1,}d - abd abd b
-a(b|c){1,}d - abcd abcd c
-a(b|c){2,2}d - acbd acbd b
-a(b|c){2,2}d - abcd abcd c
-a(b|c){2,4}d - abcd abcd c
-a(b|c){2,4}d - abcbd abcbd b
-a(b|c){2,4}d - abcbcd abcbcd c
-a(b|c){2,}d - abcd abcd c
-a(b|c){2,}d - abcbd abcbd b
-a(b+|((c)*))+d - abd abd @d,@d,-
-a(b+|((c)*))+d - abcd abcd @d,@d,-
-
-# check out the STARTEND option
-[abc] &# a(b)c b
-[abc] &# a(d)c
-[abc] &# a(bc)d b
-[abc] &# a(dc)d c
-. &# a()c
-b.*c &# b(bc)c bc
-b.* &# b(bc)c bc
-.*c &# b(bc)c bc
-
-# plain strings, with the NOSPEC flag
-abc m abc abc
-abc m xabcy abc
-abc m xyz
-a*b m aba*b a*b
-a*b m ab
-"" mC EMPTY
-
-# cases involving NULs
-aZb & a a
-aZb &p a
-aZb &p# (aZb) aZb
-aZ*b &p# (ab) ab
-a.b &# (aZb) aZb
-a.* &# (aZb)c aZb
-
-# word boundaries (ick)
-[[:<:]]a & a a
-[[:<:]]a & ba
-[[:<:]]a & -a a
-a[[:>:]] & a a
-a[[:>:]] & ab
-a[[:>:]] & a- a
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc abc
-[[:<:]]a.c[[:>:]] & axcd-dayc-dazce-abc-q abc
-[[:<:]]a.c[[:>:]] & axc-dayc-dazce-abc axc
-[[:<:]]b.c[[:>:]] & a_bxc-byc_d-bzc-q bzc
-[[:<:]].x..[[:>:]] & y_xa_-_xb_y-_xc_-axdc _xc_
-[[:<:]]a_b[[:>:]] & x_a_b
-
-# past problems, and suspected problems
-(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A]) - A1 A1
-abcdefghijklmnop i abcdefghijklmnop abcdefghijklmnop
-abcdefghijklmnopqrstuv i abcdefghijklmnopqrstuv abcdefghijklmnopqrstuv
-(ALAK)|(ALT[AB])|(CC[123]1)|(CM[123]1)|(GAMC)|(LC[23][EO ])|(SEM[1234])|(SL[ES][12])|(SLWW)|(SLF )|(SLDT)|(VWH[12])|(WH[34][EW])|(WP1[ESN]) - CC11 CC11
-CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a - CC11 CC11
-Char \([a-z0-9_]*\)\[.* b Char xyz[k Char xyz[k xyz
-a?b - ab ab
--\{0,1\}[0-9]*$ b -5 -5
diff --git a/regex/utils.h b/regex/utils.h
deleted file mode 100644
index f271f759b1..0000000000
--- a/regex/utils.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* utility definitions */
-#ifndef _POSIX2_RE_DUP_MAX
-#define _POSIX2_RE_DUP_MAX 255
-#endif
-
-#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */
-#define INFINITY (DUPMAX + 1)
-#define NC (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define NDEBUG /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define memmove(d, s, c) bcopy(s, d, c)
-#endif
diff --git a/request_info.c b/request_info.c
deleted file mode 100644
index d760284a73..0000000000
--- a/request_info.c
+++ /dev/null
@@ -1,258 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h"
-
-#ifndef THREAD_SAFE
-php3_request_info request_info;
-#endif
-
-#if CGI_BINARY
-int php3_init_request_info(void *conf)
-{
- char *buf; /* temporary buffers */
- TLS_VARS;
-
- GLOBAL(request_info).path_info = getenv("PATH_INFO");
- GLOBAL(request_info).path_translated = getenv("PATH_TRANSLATED");
- GLOBAL(request_info).query_string = getenv("QUERY_STRING");
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
- GLOBAL(request_info).request_method = getenv("REQUEST_METHOD");
- GLOBAL(request_info).script_name = getenv("SCRIPT_NAME");
- buf = getenv("CONTENT_LENGTH");
- GLOBAL(request_info).content_length = (buf ? atoi(buf) : 0);
- GLOBAL(request_info).content_type = getenv("CONTENT_TYPE");
- GLOBAL(request_info).cookies = getenv("HTTP_COOKIE");
- GLOBAL(request_info).script_filename = getenv("SCRIPT_FILENAME");
- /* Hack for annoying servers that do not set SCRIPT_FILENAME for us */
- if (!GLOBAL(request_info).script_filename) {
- GLOBAL(request_info).script_filename = GLOBAL(request_info).php_argv0;
- }
-#if WIN32|WINNT
- /* FIXME WHEN APACHE NT IS FIXED */
- /* a hack for apache nt because it does not appear to set argv[1] and sets
- script filename to php.exe thus makes us parse php.exe instead of file.php
- requires we get the info from path translated. This can be removed at
- such a time taht apache nt is fixed */
- else if (GLOBAL(request_info).path_translated) {
- GLOBAL(request_info).script_filename = GLOBAL(request_info).path_translated;
- } else {
- GLOBAL(request_info).script_filename = NULL;
- }
-#endif
-
- /* doc_root configuration variable is currently ignored,
- as it is with every other access method currently also. */
-
- /* We always need to emalloc() filename, since it gets placed into
- the include file hash table, and gets freed with that table.
- Notice that this means that we don't need to efree() it in
- php3_destroy_request_info()! */
-#if DISCARD_PATH
- if (GLOBAL(request_info).script_filename) {
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).script_filename);
- } else {
- GLOBAL(request_info).filename = NULL;
- }
-#else
- if (GLOBAL(request_info).path_translated) {
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).path_translated);
- } else {
- GLOBAL(request_info).filename = NULL;
- }
-#endif
- return SUCCESS;
-}
-
-int php3_destroy_request_info(void *conf)
-{
- STR_FREE(GLOBAL(request_info).current_user);
- return SUCCESS;
-}
-#endif
-
-#if FHTTPD
-char script_name_resolved_buffer[2048];
-const char *method_names[] =
-{"Unknown", "GET", "HEAD", "POST", "PUT"};
-
-int php3_init_request_info(void *conf)
-{
- static int exit_requested = 0;
- int i, len;
- TLS_VARS;
- req = NULL;
-
- setalarm(idle_timeout);
- while (checkinput(server->infd) && (req = readrequest(server))) {
- alarm(0);
- if (req->reqtype == FHTTPD_REQUEST) {
- if (headermade)
- php3_fhttpd_free_header();
- response = createresponse(1024, req->id, req->fd, req->ver_major > 0);
- if (response) {
- if (req->script_name && req->script_name_resolved) {
- len = strlen(req->script_name);
- strncpy(script_name_resolved_buffer, req->script_name_resolved, 2047);
- script_name_resolved_buffer[2047] = 0;
-
- GLOBAL(request_info).path_info = NULL; /* Not supported */
- GLOBAL(request_info).path_translated = script_name_resolved_buffer;
- GLOBAL(request_info).query_string = req->query_string;
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
- GLOBAL(request_info).request_method = method_names[req->method];
- GLOBAL(request_info).script_name = req->script_name;
- GLOBAL(request_info).content_length = req->databuffsize;
- GLOBAL(request_info).content_type = req->content_type;
- GLOBAL(request_info).cookies = NULL;
- for (i = 0; i < req->nlines; i++) {
- if (req->lines[i].paramc > 1) {
- if (req->lines[i].params[0]) {
- if (!strcasecmp(req->lines[i].params[0], "HTTP_COOKIE")) {
- if (req->lines[i].params[1]) {
- GLOBAL(request_info).cookies = req->lines[i].params[1];
- }
- }
- }
- }
- }
- /* doc_root configuration variable is currently ignored,
- as it is with every other access method currently also. */
-
- /* We always need to emalloc() filename, since it gets placed into
- the include file hash table, and gets freed with that table.
- Notice that this means that we don't need to efree() it in
- php3_destroy_request_info()! */
- if (GLOBAL(request_info).path_translated)
- GLOBAL(request_info).filename = estrdup(GLOBAL(request_info).path_translated);
- else
- GLOBAL(request_info).filename = NULL;
-
- return SUCCESS;
- } else {
- deleterequest(req);
- req = NULL;
- setalarm(idle_timeout);
- }
- } else {
- deleterequest(req);
- req = NULL;
- setalarm(idle_timeout);
- }
- } else {
- if (req->reqtype == FHTTPD_EXITOK) {
- exit_status = 1;
- deleterequest(req);
- req = NULL;
- setalarm(idle_timeout);
- return FAILURE;
- }
- deleterequest(req);
- req = NULL;
- setalarm(idle_timeout);
- }
- }
- if (global_alarmflag) {
- if (!exit_requested) {
- requestexit(server, 1);
- exit_requested = 1;
- }
- } else {
- exit_status = 1;
- }
- return FAILURE;
-}
-#endif /* FHTTPD */
-
-#if APACHE
-int php3_init_request_info(void *conf)
-{
- const char *buf;
- TLS_VARS;
-
- GLOBAL(request_info).current_user = NULL;
- GLOBAL(request_info).current_user_length = 0;
-
- GLOBAL(request_info).filename = GLOBAL(php3_rqst)->filename;
- GLOBAL(request_info).request_method = GLOBAL(php3_rqst)->method;
- GLOBAL(request_info).query_string = GLOBAL(php3_rqst)->args;
- GLOBAL(request_info).content_type = table_get(GLOBAL(php3_rqst)->subprocess_env, "CONTENT_TYPE");
-
- buf = table_get(GLOBAL(php3_rqst)->subprocess_env, "CONTENT_LENGTH");
- GLOBAL(request_info).content_length = (buf ? atoi(buf) : 0);
-
- GLOBAL(request_info).cookies = table_get(GLOBAL(php3_rqst)->subprocess_env, "HTTP_COOKIE");
-
- return SUCCESS;
-}
-
-#endif
-
-#if USE_SAPI
-/* temporary until I figure a beter way to do it */
-int php3_init_request_info(void *conf)
-{
- TLS_VARS;
- if (GLOBAL(sapi_rqst)->filename)
- GLOBAL(request_info).filename = estrdup(GLOBAL(sapi_rqst)->filename);
- else
- GLOBAL(request_info).filename = NULL;
- GLOBAL(request_info).path_info = GLOBAL(sapi_rqst)->path_info;
- GLOBAL(request_info).path_translated = GLOBAL(sapi_rqst)->path_translated;
- GLOBAL(request_info).query_string = GLOBAL(sapi_rqst)->query_string;
- GLOBAL(request_info).current_user = GLOBAL(sapi_rqst)->current_user;
- GLOBAL(request_info).current_user_length = GLOBAL(sapi_rqst)->current_user_length;
- GLOBAL(request_info).request_method = GLOBAL(sapi_rqst)->request_method;
- GLOBAL(request_info).script_name = GLOBAL(sapi_rqst)->script_name;
- GLOBAL(request_info).content_length = GLOBAL(sapi_rqst)->content_length;
- GLOBAL(request_info).content_type = GLOBAL(sapi_rqst)->content_type;
- GLOBAL(request_info).cookies = GLOBAL(sapi_rqst)->cookies;
-
- return SUCCESS;
-}
-#endif
-
-#if !CGI_BINARY
-int php3_destroy_request_info(void *conf)
-{
- /* see above for why we don't want to efree() request_info.filename */
- return SUCCESS;
-}
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/request_info.h b/request_info.h
deleted file mode 100644
index 8600e28f68..0000000000
--- a/request_info.h
+++ /dev/null
@@ -1,62 +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. |
- +----------------------------------------------------------------------+
- | Author: Jim Winstead (jimw@php.net) |
- +----------------------------------------------------------------------+
- */
-
-#ifndef _REQUEST_INFO_H_
-#define _REQUEST_INFO_H_
-
-typedef struct {
- char *filename;
- char *path_info;
- const char *path_translated;
- char *query_string;
- const char *request_method;
- char *script_name;
- char *current_user;
- int current_user_length;
- unsigned int content_length;
- const char *content_type;
- const char *cookies;
- const char *script_filename;
- char *php_argv0;
-} php3_request_info;
-
-#ifndef THREAD_SAFE
-extern php3_request_info request_info;
-#endif
-
-extern int php3_init_request_info(void *conf);
-extern int php3_destroy_request_info(void *conf);
-
-#endif
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/scripts/armerge b/scripts/armerge
deleted file mode 100755
index 2c4df55e83..0000000000
--- a/scripts/armerge
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# +----------------------------------------------------------------------+
-# | PHP HTML Embedded Scripting Language Version 4.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: Stig Sæther Bakken <ssb@fast.no> |
-# +----------------------------------------------------------------------+
-#
-# Archive merger. Usage: armerge libout.a dir1/libin1.a dir2/libin2.a ...
-# Creates the archive libout.a from the files in the rest of the
-# parameter list. If the input archives are in separate directories,
-# the names of the files inside them are prefixed before they are
-# merged into the output archive. The prefix used is the same as the
-# directory name with "/" replaced by "_" and a "_" at the end.
-#
-# $Id$
-#
-
-if test "$#" -lt "2"; then
- echo "Usage: "`basename $0`" <out-archive> <in-archives...>"
- exit 1
-fi
-
-out_archive=$1; shift
-in_archives=$@
-
-rm -f $out_archive
-
-for archive in $in_archives; do
- files=`ar t $archive`
- ar x $archive
- dir=`dirname $archive`
- if test "$dir" = "."; then
- ext_files=$files
- else
- prefix=`echo $dir | sed -e 's#/#_#g'`_
- prefix=`echo $prefix | sed -e 's#^\.\._##g'`
- ext_files=""
- for file in $files; do
- mv "$file" "$prefix$file"
- ext_files="$ext_files $prefix$file"
- done
- fi
- ar r $out_archive $ext_files
- rm -f $ext_files
-done
diff --git a/scripts/config-stubs b/scripts/config-stubs
deleted file mode 100755
index 9985066648..0000000000
--- a/scripts/config-stubs
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-
-for stubfile in ext/*/config.m4; do
- echo "sinclude($stubfile)"
-done
diff --git a/scripts/mkextlib.in b/scripts/mkextlib.in
deleted file mode 100755
index 7acb214e18..0000000000
--- a/scripts/mkextlib.in
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-outfile=$1; shift
-extensions=$@
-
-ext_libs=""
-for dir in $extensions; do
- archive="$dir/libphpext_$dir.a"
- if test ! -r "$archive"; then
- echo `basename $0`": could not open $archive" >&2
- exit 1
- fi
- ext_libs="$ext_libs $archive"
-done
-
-(set -x; $top_srcdir/scripts/armerge $outfile $ext_libs)
diff --git a/scripts/preconfig b/scripts/preconfig
deleted file mode 100755
index 40d182d8f0..0000000000
--- a/scripts/preconfig
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-#
-# $Id$
-
-makefiles=`echo ext/*/Makefile.am | sed -e 's/\.am//g'`
-sed -e "s#@@EXT_MAKEFILES@@#$makefiles#" configure.in.in > configure.in.new
-if ! cmp configure.in configure.in.new > /dev/null 2>&1; then
- mv configure.in.new configure.in
-else
- rm -f configure.in.new
-fi
-
-cat acconfig.h.in > acconfig.h.new
-confighfiles=`echo ext/*/config.h.stub`
-if test "$confighfiles" != "ext/*/config.h.stub"; then
- for file in $confighfiles; do
- cat $file >> acconfig.h.new
- done
-fi
-if ! cmp acconfig.h acconfig.h.new > /dev/null 2>&1; then
- mv acconfig.h.new acconfig.h
- autoheader
-else
- rm -f acconfig.h.new
-fi
diff --git a/setup b/setup
deleted file mode 100644
index ae87062165..0000000000
--- a/setup
+++ /dev/null
@@ -1,461 +0,0 @@
-#!/bin/sh
-#
-# +----------------------------------------------------------------------+
-# | 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 <ssb@guardian.no> |
-# | Updated By: Jim Winstead <jimw@php.net> |
-# | Ariel Shkedi <ars@ziplink.net> or <as@altavista.net> |
-# +----------------------------------------------------------------------+
-#
-# $Id$
-
-if [ "$1" = "-q" ]; then
- quiet_mode=on
- shift
-fi
-
-if [ `echo -e "\n" | wc -l` = 2 ]; then
-# bash supports echo -e for handling escape sequences
- ECHO_CMD="echo -e"
-elif test -f /bin/echo; then
- ECHO_CMD="/bin/echo"
-elif test -f /usr/bin/echo; then
- ECHO_CMD="/usr/bin/echo"
-else
-# fall back to the default echo - \n would most probably be displayed as-is
- ECHO_CMD="echo"
-fi
-
-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 '
- ***************************************************************************
- * *
- * Welcome to the PHP 3.0 setup script. Use this script if you do not *
- * want or know how to use the configure program. See the INSTALL file *
- * for further installation instructions. *
- * *
- * You will now be asked a series of questions for your installation. *
- * For each question, your options will be shown in parantheses, and *
- * for some a default value is listed shown in brackets. *
- * *
- ***************************************************************************
-'
-
-display_prompt()
-{
- prm=$1
- shift
- typ=$1
- shift
- def=$1
- shift
- $ECHO_N "$prm $ECHO_C"
- case $typ in
- yesno) $ECHO_N "(yes/no) $ECHO_C";;
- yesnodir) $ECHO_N "(\`yes', \`no' or dir) $ECHO_C";;
- dir) $ECHO_N "(dir) $ECHO_C";;
- esac
- if test "$typ" = "yesnodir"; then
- set $def
- def=$1
- fi
- $ECHO_N "[$def] : $ECHO_C"
-}
-
-define_option()
-{
- if test "$#" != "5"; then
- echo "wrong number of arguments to define_option" >&2
- return
- fi
- name=$1
- shift
- prompt=$1
- shift
- type=$1
- shift
- default=$1
- shift
- docstring=$1
- optname=`echo $name | sed -e 's/[^a-zA-Z0-9_]/_/g'`
- options="$options $optname"
- eval "option_name_$optname='$name'"
- eval "option_prompt_$optname='$prompt'"
- eval "option_type_$optname='$type'"
- eval "option_default_$optname='$default'"
- eval "option_docstring_$optname='$docstring'"
- answer=""
- if [ "$quiet_mode" != "on" ]; then
- show_help "$optname" "$type" "$default"
- fi
- while test "$answer" = ""; do
- display_prompt "$prompt" "$type" "$default"
- read answer
- test -t || echo $answer # Echo the answer if it did not come
- # from a terminal.
- if test "$type" = "yesnodir"; then
- set $default
- if test "$1" = "yes"; then
- if test "$answer" = ""; then
- answer=yes
- fi
- fi
- case "$answer" in
- */*) ;;
- [Yy]*) dir=$2
- shift
- shift
- $ECHO_N "Enter $@ directory [$dir] : $ECHO_C"
- read answer
- test -t || echo $answer
- if test "$answer" = ""; then
- answer=$dir
- fi
- ;;
- esac
- fi
- if test "$answer" = ""; then
- if test "$type" = "yesnodir"; then
- set $default
- answer=$1
- else
- answer=$default
- fi
- elif test "$answer" = "?"; then
- show_help "$optname" "$type" "$default"
- answer=""
- fi
- done
- if test "$type" = "yesnodir"; then
- set $default
- if test $1 = "yes"; then
- case "$answer" in
- "$2") answer=yes;;
- [Yy]*) answer=yes;;
- [Nn]*) answer=no;;
- esac
- else
- case "$answer" in
- [Yy]*) answer=$2;;
- [Nn]*) answer=no;;
- esac
- fi
- elif test "$type" = "yesno"; then
- case "$answer" in
- [Yy]*) answer=yes;;
- [Nn]*) answer=no;;
- esac
- fi
- eval "option_value_$optname='$answer'"
-}
-
-show_help()
-{
- echo ''
- ( eval "$ECHO_CMD \$option_docstring_$1" ;
- if test "$2" = "yesnodir"; then
- set $3
- echo "If you answer \`yes', the default directory is \`$2'."
- fi )
- echo ''
-}
-
-generate_config_command()
-{
- configure_options=""
- for optname in $options; do
- eval "name=\$option_name_$optname"
- eval "value=\$option_value_$optname"
- eval "default=\$option_default_$optname"
- set $default
- if test "$value" != "$1"; then
- if test "$value" != "$2"; then
- configure_options="$configure_options --$name=$value"
- else
- configure_options="$configure_options --$name"
- fi
- fi
- done
- echo "./configure$configure_options"
-}
-
-# now define all the options
-
-define_option with-apache 'Build as an Apache module?' yesnodir \
- 'no /usr/local/etc/httpd Apache base install' \
-' Whether to build PHP as an Apache module. If you are running\n
- Apache, building PHP as a module will give better performance and\n
- security. If you answer no PHP will be built as a CGI program.\n
- The CGI version also enables Apache users to run different PHP3-enabled\n
- pages under different user-ids.'
-
-if test "$option_value_with_apache" != "no"; then
- define_option with-mod_charset 'Enable transfer tables used by mod_charset?' yesno no \
-' Whether to respect transfer tables used by mod_charset when PHP compiled\n
- as Apache module. It is required to allow mod_charset (aka Russian Apache)\n
- to work properly.'
-fi
-
-if test "$option_value_with_apache" = "no"; then
- define_option with-fhttpd 'Build as an fhttpd module?' yesnodir \
- 'no /usr/local/src/fhttpd fhttpd sources' \
-' Whether to build PHP as fhttpd module. If you are running\n
- fhttpd, building PHP as a module will give better performance,\n
- more control and remote execution capability. More info about fhttpd \n
- can be found at http://phobos.illtel.denver.co.us/pub/fhttpd/.'
-fi
-
-for stub in ext/*/setup.stub; do
- test -f $stub && . $stub
-done
-
-define_option with-oracle 'Oracle support?' yesnodir \
- "no $oradir Oracle home" \
-' Whether to build PHP with Oracle support. Has been confirmed to\n
- work with Oracle versions 7.0 to 7.3. If you have not set up your\n
- Oracle environment, enter what $ORACLE_HOME is usually set to here.\n
- More info about Oracle can be found at http://www.oracle.com/.'
-
-define_option with-sybase 'Sybase support?' yesnodir \
- 'no /home/sybase Sybase install' \
-' Whether to build PHP with Sybase support (DBLib only).\n
- More info about Sybase can be found at http://www.sybase.com/.'
-
-define_option with-sybase-ct 'Sybase-CT support?' yesnodir \
- 'no /home/sybase Sybase-CT install' \
-' Whether to build PHP with Sybase-CT support.'
-
-define_option with-mysql 'MySQL support?' yesnodir \
- 'no /usr/local MySQL install' \
-' Whether to build PHP with MySQL support.\n
- More info about MySQL can be found at http://www.tcx.se/.'
-
-define_option with-msql 'mSQL support?' yesnodir \
- 'no /usr/local/Hughes mSQL install' \
-' Whether to build PHP with mSQL support. PHP supports both mSQL 1.0 and\n
- mSQL 2.0. However, if you build PHP with mSQL 1.0 libraries, you will\n
- only be able to access mSQL 1.0 databases, ditto for mSQL 2.0.\n
- More info about mSQL can be found at http://www.hughes.com.au/.'
-
-define_option with-pgsql 'PostgreSQL support?' yesnodir \
- 'no /usr/local/pgsql PostgreSQL base install' \
-' Whether to build PHP with PostgreSQL support.\n
- More info about PostgreSQL can be found at\n
- http://www.postgreSQL.org/.'
-
-define_option with-informix 'Informix support?' yesnodir \
- "no $INFORMIXDIR Informix home" \
-' Whether to build PHP with Informix support. If you have not set up your\n
- Informix environment, enter what $INFORMIXDIR is usually set to here.\n
- You MUST set $INFORMIXDIR before trying to compile!\n
- More info about Informix can be found at http://www.informix.com/.'
-
-define_option with-interbase 'InterBase support?' yesnodir \
- 'no /usr/interbase InterBase base install' \
-' Whether to build PHP with InterBase support. More\n
- information about InterBase can be found at http://www.interbase.com/.'
-
-define_option with-hyperwave 'Hyperwave support?' yesno no \
-' Whether to build with Hyperwave support. More\n
- information about Hyperwave can be found at http://www.hyperwave.com.'
-
-define_option with-ldap 'LDAP support?' yesnodir \
- 'no /usr/local/ldap LDAP base install' \
-' Whether to build with LDAP (Lightweight Directory Access Protocol)\n
- support.\n
- More information about LDAP can be found in RFC1777 and RFC1778.'
-
-define_option with-imap 'IMAP support?' yesnodir \
- 'no /usr/local/imap IMAP base install' \
-' Whether to build with IMAP (Internet Message Access Protocol)\n
- support.\n
- More information about LDAP can be found in RFC1777 and RFC1778.'
-
-define_option with-filepro 'filePro support? ' yesno no \
-' Whether to use the bundled filePro library. Read-access only.'
-
-define_option with-pdflib 'pdflib 0.6 support? ' yesnodir \
- 'no /usr/local pdflib install' \
-' Whether to use the pdflib support to write .pdf-files.\n
- Tested for version 0.6!'
-
-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!'
-
-define_option with-zlib 'zlib (>= 1.0.9) support? ' yesnodir \
- 'no /usr zlib install' \
-' Whether to use the zlib support to read/write .gz-files.\n
- Requires zlib version >= 1.0.9!'
-
-define_option enable-sysvshm 'System V shared memory support? ' yesno no \
-' Whether to use the System V shared memory (currently only solaris and linux).'
-
-define_option enable-sysvsem 'System V semaphores support? ' yesno no \
-' Whether to use the System V semaphores (currently only solaris and linux).'
-
-
-define_option with-config-file-path 'Default config directory?' yesnodir \
- 'no /usr/local/lib Configuration file' \
-' Directory where the PHP3 configuration file (php3.ini) is\n
- located.'
-
-# systems should be system's
-define_option with-system-regex 'Use the system regex library?' yesno no \
-" Whether to use the systems regular expression library rather than\n
- the bundled one. If you are building PHP3 as a server module, you must\n
- use the same library when building PHP3 as when linking the server.\n
- Enable this if the systems library provides special features you need.\n
- It is recommended that you use the bundled library if possible."
-
-define_option enable-debug 'Compile with debug information?' yesno yes \
-' Whether to enable debug information. Answering "no" here will make\n
- PHP run faster, but it will be harder to trace bugs. You are \n
- encouraged to leave debugging on while PHP 3.0 is in alpha and \n
- beta state.'
-
-define_option enable-safe-mode 'Enable safe mode by default?' yesno no \
-" Whether to enable PHP safe mode. This imposes several\n
- restrictions on what PHP can do, such as opening only files within\n
- the document root. Read the Security chapter of the documentation\n
- for more information. CGI users should always enable secure mode.\n
- This only sets the default, it may be enabled or disabled in the\n
- configuration file later. "
-
-# broken configure.in doesn't check apache (bug?)
-#if test "$option_value_with_apache" != "no"; then
-# defexecdir="$option_value_with_apache/php-bin"
-#else
- defexecdir=/usr/local/bin
-#fi
-
-define_option with-exec-dir 'Default safe mode exec dir?' dir "$defexecdir" \
-" The directory where executables that may be run from safe mode\n
- are located."
-
-define_option enable-track-vars 'Enable variable tracking by default?' yesno \
- no \
-' Enable the HTTP_GET_VARS, HTTP_POST_VARS and HTTP_COOKIE_VARS arrays by\n
- default (can be turned on or off in the configuration file).'
-
-define_option enable-magic-quotes 'Enable magic quotes by default?' yesno no \
-' Whether to magic quotes by default. This can be changed in the\n
- configuration file.'
-
-define_option enable-debugger 'Enable PHP remote debugger?' yesno no \
-" Whether to enable PHP remote debugging support. This feature\n
- is still under development."
-
-define_option enable-bcmath 'Enable bc style precision math functions' yesno \
- no \
-' Enables bc style arbitrary precision math functions.'
-
-# configure.in only checks these if it's a cgi so setup does the same
-if test "$option_value_with_apache" = "no"; then
-# outputing the bank line isn't really possible, but it would be nice
-define_option enable-force-cgi-redirect 'Enable redirect checking?' yesno no \
-' When using PHP as a CGI binary, this will make PHP always first check\n
- that it is used by redirection (for example under Apache, by using\n
- Action directives). This makes sure that the PHP binary cannot be used\n
- to bypass standard web server authentication procedures by calling it\n
- directly, like http://my.host/cgi-bin/php/secret/doc.html. This\n
- example accesses http://my.host/secret/doc.html but does not honour\n
- any security settings enforced by httpd for directory /secret.\n
- \n
- Not enabling this option disables the check and enables bypassing\n
- httpd security and authentication settings. Do this only if your server\n
- software is unable to indicate that a safe redirection was done and\n
- all your files under your document root and user directories may be\n
- accessed by anyone. (See the doc_root and user_dir options in the\n
- configuartion file).'
-
-define_option enable-discard-path 'Enable discard path?' yesno no \
-' If this is enabled, the PHP CGI binary can safely be placed outside\n
- of the web tree and people will not be able to circumvent .htaccess\n
- security.'
-fi
-
-define_option enable-memory-limit 'Enable memory limit?' yesno no \
-' Compile with memory limit support.'
-
-define_option enable-short-tags 'Allow short tag by default?' yesno yes \
-" Whether to enable the short form of the PHP HTML embed tags.\n
- The short form is \"<? code; ?>\", while the long form is\n
- \"<?php code; ?>\". If you plan on using XML on your site, you\n
- should disable the short form. This is the default and can be overridden\n
- in the configuration file."
-
-define_option enable-url-fopen-wrapper 'Enable URL fopen wrappers?' yesno yes \
-" Enable the URL-aware fopen wrapper that allows accessing files via http\n
- or ftp."
-
-# only the cgi version of PHP is installed to bindir
-if test "$option_value_with_apache" = "no"; then
-define_option bindir 'Install php in:' dir "/usr/local/bin" \
-" Directory where PHP should be installed."
-fi
-
-echo '
-
- ***************************************************************************
- * *
- * Running configure... *
- * *
- ***************************************************************************
-'
-if test ! -f configure; then
- autoconf
-fi
-
-command=`generate_config_command`
-mv do-conf do-conf.bak > /dev/null 2>&1
-echo $command > do-conf
-chmod +x do-conf
-echo $command
-eval $command
-
-echo '
- ***************************************************************************
- * *
- * Configuration options were saved in do-conf, if desired you can *
- * edit this file and then run it. Run ./configure --help for a list *
- * of options. *
- * *
- * Read the INSTALL file for more information and for help in *
- * configuring apache. See the web site at: http://www.php.net/ for *
- * documentation and more. If desired copy the php3.ini-dist file to *
- * your config directory/php3.ini and edit it. *
- * *
- ***************************************************************************
-'
diff --git a/snmp.mak b/snmp.mak
deleted file mode 100644
index 8bddefe49a..0000000000
--- a/snmp.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on snmp.dsp
-!IF "$(CFG)" == ""
-CFG=snmp - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to snmp - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "snmp - Win32 Release" && "$(CFG)" != "snmp - 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 "snmp.mak" CFG="snmp - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "snmp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "snmp - 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)" == "snmp - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_snmp.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\winsnmp.obj"
- -@erase "$(OUTDIR)\php3_snmp.dll"
- -@erase "$(OUTDIR)\php3_snmp.exp"
- -@erase "$(OUTDIR)\php3_snmp.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_SNMP=1 /D "THREAD_SAFE" /D "NDEBUG" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\snmp.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)\snmp.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib mgmtapi.lib snmpapi.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_snmp.pdb" /machine:I386 /out:"$(OUTDIR)\php3_snmp.dll" /implib:"$(OUTDIR)\php3_snmp.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\winsnmp.obj"
-
-"$(OUTDIR)\php3_snmp.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "snmp - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_snmp.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(INTDIR)\winsnmp.obj"
- -@erase "$(OUTDIR)\php3_snmp.dll"
- -@erase "$(OUTDIR)\php3_snmp.exp"
- -@erase "$(OUTDIR)\php3_snmp.ilk"
- -@erase "$(OUTDIR)\php3_snmp.lib"
- -@erase "$(OUTDIR)\php3_snmp.pdb"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /ZI /Od /I "./" /I "../" /I "../../" /I "../../../" /I "../../include" /D HAVE_SNMP=1 /D "THREAD_SAFE" /D "DEBUG" /D "_DEBUG" /D "MSVC5" /D COMPILE_DL=1 /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\snmp.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)\snmp.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib mgmtapi.lib snmpapi.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_snmp.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_snmp.dll" /implib:"$(OUTDIR)\php3_snmp.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\winsnmp.obj"
-
-"$(OUTDIR)\php3_snmp.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("snmp.dep")
-!INCLUDE "snmp.dep"
-!ELSE
-!MESSAGE Warning: cannot find "snmp.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "snmp - Win32 Release" || "$(CFG)" == "snmp - Win32 Debug"
-SOURCE=.\dl\snmp\winsnmp.c
-
-"$(INTDIR)\winsnmp.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-
diff --git a/stamp-h.in b/stamp-h.in
deleted file mode 100644
index e69de29bb2..0000000000
--- a/stamp-h.in
+++ /dev/null
diff --git a/test.php4 b/test.php4
deleted file mode 100644
index fdcd51bdbd..0000000000
--- a/test.php4
+++ /dev/null
@@ -1,16 +0,0 @@
-<?
-function blah($a)
-{
-
- return $a;
-}
-
-return "cool";
-
-
-for ($for=0; $for<=100000;$for++)
-{
-if ("andi" != blah("andi"))
-{
-print "error";}
-}
diff --git a/test.pl b/test.pl
deleted file mode 100644
index 2502cb1298..0000000000
--- a/test.pl
+++ /dev/null
@@ -1,34 +0,0 @@
-<?
-
-$i = 0;
-$j = 1;
-
-for ($k=0; $k<1000000; $k = $k+1) {
- while ($i<10000000) {
- if (($i%"4")<1) {
- $i = $i+"1";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<2) {
- $i = $i+"2";
- if ($j%"2") {
- $i = $i * "2";
- }
- } elseif (($i%"4")<3) {
- $i = $i+3;
- if ($j%"2") {
- $i = $i * "2";
- }
- } else {
- $i = $i+"4";
- if ($j%"2") {
- $i = $i * "2";
- }
- }
- $j = $j+1;
- }
-}
-print $i;
-print "\n";
-
diff --git a/test_class_inheritance b/test_class_inheritance
deleted file mode 100644
index 3f903e62d1..0000000000
--- a/test_class_inheritance
+++ /dev/null
@@ -1,29 +0,0 @@
-<?
-
-class BaseClass {
- var $class_name = "BaseClass";
-
- function BaseClass($value) {
- print "value is '$value'\n";
- }
- function MyClassName() {
- return $this->class_name;
- }
-};
-
-
-class ChildClass {
- var $class_name = "ChildClass";
-
- function ChildClass($value, $new_value) {
- BaseClass::BaseClass($value);
- print "new value is '$new_value'\n";
- }
- function MyClassName($a_value) {
- return BaseClass::MyClassName()." and the value is '$a_value'";
- }
-};
-
-
-$obj = new ChildClass("Test", "Another test");
-print $obj->MyClassName("not interesting"); \ No newline at end of file
diff --git a/testarray b/testarray
deleted file mode 100644
index 27a2f9bc4d..0000000000
--- a/testarray
+++ /dev/null
@@ -1,21 +0,0 @@
-
-This is a small test...
-
-<?
-/*
- * this is a multiline comment...
- */
-
-//for ($j=0; $j<=200; $j++) {
- for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
- $i[1] += $i[0][0]; // this is a single line comment
- }
-//}
-
-/* this is another multi
-line
- comment...******
-/
-*/
-
-print $i[1]."\n";
diff --git a/testarray.pl b/testarray.pl
deleted file mode 100644
index 9ec83e184c..0000000000
--- a/testarray.pl
+++ /dev/null
@@ -1,5 +0,0 @@
-for ($i[0][0]=0; $i[0][0]<1000000; $i[0][0]++) {
- $i[1] += $i[0][0];
-}
-
-print $i[1];
diff --git a/testarray2 b/testarray2
deleted file mode 100644
index 4272eedf2e..0000000000
--- a/testarray2
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-
-for ($i="aaa"; $i<"bbb\nbbb"; $i++) {
- print $i;
-} \ No newline at end of file
diff --git a/testarray2.pl b/testarray2.pl
deleted file mode 100644
index e72c526d4f..0000000000
--- a/testarray2.pl
+++ /dev/null
@@ -1,3 +0,0 @@
-for ($i="aaa"; $i lt "bbb"; $i++) {
- print "$i\n";
-}
diff --git a/testclassfunc b/testclassfunc
deleted file mode 100644
index 6ad5a5091c..0000000000
--- a/testclassfunc
+++ /dev/null
@@ -1,10 +0,0 @@
-<?
-
-class foo {
- function bar() {
- print "Hey there!\n";
- }
-};
-
-foo::bar();
-
diff --git a/testcom b/testcom
deleted file mode 100644
index 3668424a29..0000000000
--- a/testcom
+++ /dev/null
@@ -1,9 +0,0 @@
-<?
-$word = new COM("word.application") or die("Unable to instanciate Word");
-print "Loaded Word, version {$word->Version}\n";
-$word->Visible = 1;
-$word->Documents->Add();
-$word->Selection->TypeText("This is a test...");
-$word->Documents[1]->SaveAs("Useless test.doc");
-$word->Quit();
-?> \ No newline at end of file
diff --git a/testfe b/testfe
deleted file mode 100644
index 5ae85511b5..0000000000
--- a/testfe
+++ /dev/null
@@ -1,21 +0,0 @@
-<?
-
-$foo = array(7,"foo",3,array(1,2),4);
-
-//print $foo[1];
-
-for ($i=0; $i<3; $i++):
-
-foreach($a, $foo ) {
- if (gettype($a)=="array") {
- print "Array:\n";
- foreach($b, $a) {
- print "\t$b\n";
- }
- print "End of array.\n";
- } else {
- print "$a\n";
- }
-// print "$a\n";
-}
-endfor;
diff --git a/testfunc b/testfunc
deleted file mode 100644
index cb55a66a6f..0000000000
--- a/testfunc
+++ /dev/null
@@ -1,36 +0,0 @@
-<?
-function foo()
-{
- $i=0;
-
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-
-function bar()
-{
- foo();
-}
-
-for ($i=0; $i<100000; $i++) {
- bar();
-}
-
-
-for ($i=0; $i<10; $i++) {
- bar();
-}
-
-print "Got here...
-
-";
-
-$a = 7;
-
-$a = 5;
-
-print "Got here...\n\n"; \ No newline at end of file
diff --git a/testfunc.pl b/testfunc.pl
deleted file mode 100644
index 87864866ff..0000000000
--- a/testfunc.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-sub foo()
-{
- my $i=0;
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar()
-{
- foo();
-}
-
-for ($i=0; $i<1000000; $i++) {
- bar();
-}
diff --git a/testfunc2 b/testfunc2
deleted file mode 100644
index 9bcae0f183..0000000000
--- a/testfunc2
+++ /dev/null
@@ -1,19 +0,0 @@
-<?
-function foo($i)
-{
- if ($i) {
- $a = "zeev";
- } else {
- $b = "andi";
- }
-}
-
-
-function bar($a)
-{
- foo($a);
-}
-
-for ($i=0; $i<1000000; $i=$i+1) {
- bar($i);
-}
diff --git a/testfunc2.pl b/testfunc2.pl
deleted file mode 100644
index 7eeaf92ffb..0000000000
--- a/testfunc2.pl
+++ /dev/null
@@ -1,22 +0,0 @@
-sub foo
-{
- my $i = shift(@_);
-
- if ($i) {
- my $a = "zeev";
- } else {
- my $b = "andi";
- }
-}
-
-
-sub bar
-{
- my $i = shift(@_);
-
- foo($i);
-}
-
-for ($i=0; $i<1000000; $i=$i+1) {
- bar($i);
-}
diff --git a/testfuncref b/testfuncref
deleted file mode 100644
index 675c70de81..0000000000
--- a/testfuncref
+++ /dev/null
@@ -1,8 +0,0 @@
-<?
-
-function foobar()
-{
- print "foobar\n";
-}
-
-$a = ${"foo"."bar"}();
diff --git a/testinclude b/testinclude
deleted file mode 100644
index 7539985aa7..0000000000
--- a/testinclude
+++ /dev/null
@@ -1,5 +0,0 @@
-<?
-print "Before include...\n";
-$retval = include("testarray");
-print "After include, include returned $retval\n";
-?> \ No newline at end of file
diff --git a/testobj b/testobj
deleted file mode 100644
index 93ea5e0f99..0000000000
--- a/testobj
+++ /dev/null
@@ -1,9 +0,0 @@
-<?
-
-//$a = new TestClass;
-$a->foo = 5;
-$foo = 456;
-
-print $a->foobar[2]["testing 123".$foo]->barbara."\n";
-print "---\n";
-$a->foobar[2]["testing 123".$foo]->barbara=5; \ No newline at end of file
diff --git a/tls.c b/tls.c
deleted file mode 100644
index 9b6155392a..0000000000
--- a/tls.c
+++ /dev/null
@@ -1,113 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-#include "tls.h"
-
-#if THREAD_SAFE
-/*This is indeed a global!*/
-DWORD TlsIndex;
-#else
-php3_globals_struct *php3_globals;
-#endif
-
-/* just copying from some samples, can replace this with
-standard php error messaging */
-VOID ErrorExit (LPTSTR lpszMessage)
-{
- fprintf(stderr, "%s\n", lpszMessage);
- ExitProcess(0);
-}
-
-/*all these functions are called from DllMain()
- in a NON thread safe version, tls_startup and
- tls_shutdown should be initiated before anything
- else. This will allocate memory for globals.
-
- called at dll load*/
-int tls_startup(void){
-#if THREAD_SAFE
- if ((TlsIndex=TlsAlloc())==0xFFFFFFFF){
- return 0;
- }
-#else
- php3_globals=malloc(sizeof(php3_globals));
-#endif
- return 1;
-}
-/*called at dll unload*/
-int tls_shutdown(void){
-#if THREAD_SAFE
- if (!TlsFree(TlsIndex)){
- return 0;
- }
-#else
- free(php3_globals);
-#endif
- return 1;
-}
-
-#if THREAD_SAFE
-/*called at start of thread*/
-int tls_create(void){
- php3_globals_struct *php3_globals;
- php3_globals = (php3_globals_struct *) LocalAlloc(LPTR, sizeof(php3_globals_struct));
- if (! TlsSetValue(TlsIndex, (void *) php3_globals))
- ErrorExit("TlsSetValue error");
-
- return 1;
-}
-
-/*called at end of thread*/
-int tls_destroy(void){
- php3_globals_struct *php3_globals;
- php3_globals = TlsGetValue(TlsIndex);
- if (php3_globals != 0)
- LocalFree((HLOCAL) php3_globals);
- return 1;
-}
-
-#endif
-
-
-/*
-accessing data inside a thread
-This short function shows how the global struct
-is accessed in a function. THREAD_SAFE should
-only need to be defined on windows server modules
-
-void thread_safe_access_of_globals(VOID)
-{
- TLS_VARS;
-
- if ((php3_globals == 0) && (GetLastError() != 0)) {
- ErrorExit("TlsGetValue error");
- }
-}
-
-*/
diff --git a/tls.h b/tls.h
deleted file mode 100644
index e0bf272be8..0000000000
--- a/tls.h
+++ /dev/null
@@ -1,207 +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: |
- | |
- +----------------------------------------------------------------------+
- */
-#ifndef _TLS_H_
-#define _TLS_H_
-#if WIN32|WINNT
-#include "win32/pwd.h"
-#include "win32/sendmail.h"
-#include <winsock.h>
-#endif
-
-#include "alloc.h"
-#include "functions/head.h"
-#include "functions/number.h"
-#include "constants.h"
-#include <sys/stat.h>
-#if USE_SAPI
-#include "serverapi/sapi.h"
-#endif
-
-typedef struct php3_global_struct{
- /*all globals must be here*/
- /*alloc.c*/
- void *cache[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
- unsigned char cache_count[MAX_CACHED_MEMORY];
- int saved_umask;
- mem_header *head;
- unsigned int allocated_memory;
-
- /*getopt.c*/
- char *optarg;
- int optind;
- int opterr;
- int optopt;
- /*file.c*/
- int pclose_ret;
- int wsa_fp;
- /*zend-parser.tab.c*/
- HashTable function_table;
- HashTable include_names;
- int current_lineno;
- int include_count;
- FunctionState function_state;
- FunctionState php3g_function_state_for_require;
- char *class_name;
- HashTable *class_symbol_table;
- pval return_value,globals;
- unsigned int param_index;
- pval *array_ptr;
- /*list.c*/
- int module_count;
- int current_module_being_cleaned;
- /*main.c*/
- int initialized;
- int module_initialized;
- char *php3_ini_path;
- unsigned char header_is_being_sent;
-#if APACHE
- request_rec *php3_rqst;
-#endif
-#if USE_SAPI
- struct sapi_request_info *sapi_rqst;
-#endif
-#if WIN32|WINNT
- unsigned int wintimer_counter;
- unsigned int wintimer;
- unsigned int timerstart;
-#endif
- FILE *phpin;
- /*request_info.c*/
- php3_request_info request_info;
- /*token_cache.c*/
- pval phplval;
- /*constants.c*/
- HashTable php3_constants;
-
- /*Functions*/
- /*bc math*/
- long bc_precision;
- bc_num _zero_;
- bc_num _one_;
- bc_num _two_;
- /*browscap.c*/
- HashTable browser_hash;
- char *lookup_browser_name;
- pval *found_browser_entry;
- /*dir.c*/
- int dirp_id;
- int le_dirp;
- /*file.c*/
- int fgetss_state;
- int le_fp;
- int le_pp;
- /*filestat.c*/
- char *CurrentStatFile;
-#if MSVC5
- unsigned int CurrentStatLength;
-#else
- int CurrentStatLength;
-#endif
- struct stat sb;
-#if HAVE_SYMLINK
- struct stat lsb;
-#endif
- /*formated_print.c*/
- char cvt_buf[80]; /*STATIC VAR*/
- /*head.c*/
- int php3_PrintHeader;
- CookieList *top;
- char *cont_type;
- int header_called;
- /*info.c*/
-#if APACHE
- module *top_module;
-#endif
- /*pageinfo.c*/
- long page_uid;
- long page_inode;
- long page_mtime;
- /*post.c*/
- int le_uploads;
- /*strings.h*/
- char *strtok_string;
- char *strtok_pos1; /*STATIC VAR*/
- char *strtok_pos2; /*STATIC VAR*/
-#ifndef HAVE_STRERROR
- char str_ebuf[40]; /*STATIC VAR*/
-#endif
-#if WIN32|WINNT
- /*pwd.c*/
- struct passwd pw; /* should we return a malloc()'d structure */
- /*sendmail.c*/
- char Buffer[MAIL_BUFFER_SIZE];
- SOCKET sc;
- WSADATA Data;
- struct hostent *adr;
- SOCKADDR_IN sock_in;
- int WinsockStarted;
- char *AppName;
- char MailHost[HOST_NAME_LEN];
- char LocalHost[HOST_NAME_LEN];
- /*winsyslog.c*/
- char *loghdr; /* log file header string */
- HANDLE loghdl; /* handle of event source */
- /*time.c*/
- unsigned int proftimer,virttimer,realtimer;
- LPMSG phpmsg;
- /*winutil*/
- char Win_Error_msg[256];
-#endif
- /*check for each module if it is compiled staticly
- we should include their globals here.*/
-} php3_globals_struct;
-
-#ifdef THREAD_SAFE
-extern DWORD TlsIndex;
-
-extern int tls_create(void);
-extern int tls_destroy(void);
-
-/* these are from the flex scanner */
-#ifndef YY_TLS_VARS
-#define phptext php_gbl->text
-#define phpleng php_gbl->leng
-extern DWORD phpLexTlsIndex;
-#define YY_TLS_VARS flex_globals *php_gbl = TlsGetValue(phpLexTlsIndex)
-#endif
-
-/* Other needed defines */
-#if !defined(COMPILE_DL)
-extern int phplex(pval *phplval, struct php3_global_struct *php3_globals, flex_globals *php_gbl);
-#endif
-#else
-extern php3_globals_struct *php3_globals;
-
-#endif
-
-extern int tls_startup(void);
-extern int tls_shutdown(void);
-
-#endif
diff --git a/win32/flock.c b/win32/flock.c
deleted file mode 100644
index cc9d409784..0000000000
--- a/win32/flock.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 14 August 1997
- *
- * Copyright 1997 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#include <windows.h>
-#include <io.h>
-#include <errno.h>
-#include "flock.h"
-
-int flock(int fd, int op)
-{
- HANDLE hdl = (HANDLE) _get_osfhandle(fd);
- DWORD low = 1, high = 0;
- OVERLAPPED offset =
- {0, 0, 0, 0, NULL};
- if (hdl < 0)
- return -1; /* error in file descriptor */
- /* bug for bug compatible with Unix */
- UnlockFileEx(hdl, 0, low, high, &offset);
- switch (op & ~LOCK_NB) { /* translate to LockFileEx() op */
- case LOCK_EX: /* exclusive */
- if (LockFileEx(hdl, LOCKFILE_EXCLUSIVE_LOCK +
- ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_SH: /* shared */
- if (LockFileEx(hdl, ((op & LOCK_NB) ? LOCKFILE_FAIL_IMMEDIATELY : 0),
- 0, low, high, &offset))
- return 0;
- break;
- case LOCK_UN: /* unlock */
- return 0; /* always succeeds */
- default: /* default */
- break;
- }
- errno = EINVAL; /* bad call */
- return -1;
-}
diff --git a/win32/flock.h b/win32/flock.h
deleted file mode 100644
index fe07adf954..0000000000
--- a/win32/flock.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define fsync _commit
-#define ftruncate chsize
-
-/* For flock() emulation */
-
-#define LOCK_SH 1
-#define LOCK_EX 2
-#define LOCK_NB 4
-#define LOCK_UN 8
-
-extern int flock(int fd, int op);
diff --git a/win32/grp.h b/win32/grp.h
deleted file mode 100644
index e7a99327e2..0000000000
--- a/win32/grp.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-struct group {
- char *gr_name; /* group name */
- char *gr_passwd; /* group password */
- int gr_gid; /* group id */
- char **gr_mem; /* group members */
-};
diff --git a/win32/param.h b/win32/param.h
deleted file mode 100644
index 3d0da1e8d3..0000000000
--- a/win32/param.h
+++ /dev/null
@@ -1,16 +0,0 @@
-
-/*****************************************************************************
- * *
- * sys/param.c *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- * *
- *****************************************************************************/
-#ifndef MAXPATHLEN
-#define MAXPATHLEN _MAX_PATH
-#endif
-#define MAXHOSTNAMELEN 64
-#define howmany(x,y) (((x)+((y)-1))/(y))
-#define roundup(x,y) ((((x)+((y)-1))/(y))*(y))
diff --git a/win32/php_registry.h b/win32/php_registry.h
deleted file mode 100644
index ad722a5607..0000000000
--- a/win32/php_registry.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _PHP_REGISTRY_H
-#define _PHP_REGISTRY_H
-
-
-void UpdateIniFromRegistry(char *path);
-
-#endif /* _PHP_REGISTRY_H */ \ No newline at end of file
diff --git a/win32/pwd.c b/win32/pwd.c
deleted file mode 100644
index e6d709d750..0000000000
--- a/win32/pwd.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* pwd.c - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h" /*php specific */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <lmaccess.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <lmapibuf.h>
-#include "pwd.h"
-#include "grp.h"
-
-#ifndef THREAD_SAFE
-static struct passwd pw; /* should we return a malloc()'d structure */
-#endif
-static char *home_dir = "."; /* we feel (no|every)where at home */
-static char *login_shell = "not command.com!";
-
-struct passwd *getpwnam(char *name)
-{
- return (struct passwd *) 0;
-}
-
-
-char *getlogin()
-{
- static char name[256];
- DWORD dw = 256;
- GetUserName(name, &dw);
- return name;
-}
-
-struct passwd *
- getpwuid(int uid)
-{
- TLS_VARS;
-
- GLOBAL(pw).pw_name = getlogin();
- GLOBAL(pw).pw_dir = home_dir;
- GLOBAL(pw).pw_shell = login_shell;
- GLOBAL(pw).pw_uid = 0;
-
- return &GLOBAL(pw);
-}
-
-/*
- * Local Variables:
- * mode:C
- * ChangeLog:ChangeLog
- * compile-command:make
- * End:
- */
diff --git a/win32/pwd.h b/win32/pwd.h
deleted file mode 100644
index d0ae7ac35b..0000000000
--- a/win32/pwd.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* pwd.h - Try to approximate UN*X's getuser...() functions under MS-DOS.
- Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 1, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Header$
- */
-
-/* This 'implementation' is conjectured from the use of this functions in
- the RCS and BASH distributions. Of course these functions don't do too
- much useful things under MS-DOS, but using them avoids many "#ifdef
- MSDOS" in ported UN*X code ... */
-/*
- #define WIN32_LEAN_AND_MEAN
- #include <windows.h>
- */
-#ifndef _PWD_H_
-#define _PWD_H_
-#if 0
-/* This is taken care of in Windows-NT/config.h. */
-typedef int uid_t;
-#endif
-
-struct passwd {
- char *pw_name; /* user name */
- char *pw_passwd; /* encrypted password */
- int pw_uid; /* user uid */
- int pw_gid; /* user gid */
- char *pw_comment; /* comment */
- char *pw_gecos; /* Honeywell login info */
- char *pw_dir; /* home directory */
- char *pw_shell; /* default shell */
-};
-
-extern struct passwd *getpwuid(int);
-extern struct passwd *getpwnam(char *name);
-extern char *getlogin(void);
-#endif
-/*
- * Local Variables:
- * mode:C
- * ChangeLog:ChangeLog
- * compile-command:make
- * End:
- */
diff --git a/win32/readdir.c b/win32/readdir.c
deleted file mode 100644
index 2ebec905e3..0000000000
--- a/win32/readdir.c
+++ /dev/null
@@ -1,111 +0,0 @@
-#include <malloc.h>
-#include <string.h>
-#include <errno.h>
-
-#define NEEDRDH 1
-#include "readdir.h"
-
-/**********************************************************************
- * Implement dirent-style opendir/readdir/closedir on Window 95/NT
- *
- * Functions defined are opendir(), readdir() and closedir() with the
- * same prototypes as the normal dirent.h implementation.
- *
- * Does not implement telldir(), seekdir(), rewinddir() or scandir().
- * The dirent struct is compatible with Unix, except that d_ino is
- * always 1 and d_off is made up as we go along.
- *
- * The DIR typedef is not compatible with Unix.
- **********************************************************************/
-
-DIR *opendir(const char *dir)
-{
- DIR *dp;
- char *filespec;
- long handle;
- int index;
-
- filespec = malloc(strlen(dir) + 2 + 1);
- strcpy(filespec, dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- dp = (DIR *) malloc(sizeof(DIR));
- dp->offset = 0;
- dp->finished = 0;
- dp->dir = strdup(dir);
-
- if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
- if (errno == ENOENT)
- dp->finished = 1;
- else
- return NULL;
- }
- dp->handle = handle;
- free(filespec);
-
- return dp;
-}
-
-struct dirent *readdir(DIR * dp)
-{
- if (!dp || dp->finished)
- return NULL;
-
- if (dp->offset != 0) {
- if (_findnext(dp->handle, &(dp->fileinfo)) < 0) {
- dp->finished = 1;
- return NULL;
- }
- }
- dp->offset++;
-
- strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME);
- dp->dent.d_ino = 1;
- dp->dent.d_reclen = strlen(dp->dent.d_name);
- dp->dent.d_off = dp->offset;
-
- return &(dp->dent);
-}
-
-int closedir(DIR * dp)
-{
- if (!dp)
- return 0;
- _findclose(dp->handle);
- if (dp->dir)
- free(dp->dir);
- if (dp)
- free(dp);
-
- return 0;
-}
-
-void rewinddir(DIR *dir_Info)
-{
- /* Re-set to the beginning */
- char *filespec;
- long handle;
- int index;
-
- dir_Info->handle = 0;
- dir_Info->offset = 0;
- dir_Info->finished = 0;
-
- filespec = malloc(strlen(dir_Info->dir) + 2 + 1);
- strcpy(filespec, dir_Info->dir);
- index = strlen(filespec) - 1;
- if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
- filespec[index] = '\0';
- strcat(filespec, "/*");
-
- if ((handle = _findfirst(filespec, &(dir_Info->fileinfo))) < 0) {
- if (errno == ENOENT) {
- dir_Info->finished = 1;
- }
- }
- dir_Info->handle = handle;
- free(filespec);
-}
diff --git a/win32/readdir.h b/win32/readdir.h
deleted file mode 100644
index febaff2798..0000000000
--- a/win32/readdir.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Structures and types used to implement opendir/readdir/closedir
- * on Windows 95/NT.
- */
-
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-
-
-/* struct dirent - same as Unix */
-#if NEEDRDH
-
-struct dirent {
- long d_ino; /* inode (always 1 in WIN32) */
- off_t d_off; /* offset to this dirent */
- unsigned short d_reclen; /* length of d_name */
- char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */
-};
-
-/* typedef DIR - not the same as Unix */
-typedef struct {
- long handle; /* _findfirst/_findnext handle */
- short offset; /* offset into directory */
- short finished; /* 1 if there are not more files */
- struct _finddata_t fileinfo; /* from _findfirst/_findnext */
- char *dir; /* the dir we are reading */
- struct dirent dent; /* the dirent to return */
-} DIR;
-
-/* Function prototypes */
-extern DIR *opendir(const char *);
-extern struct dirent *readdir(DIR *);
-extern int closedir(DIR *);
-#endif
-extern void rewinddir(DIR *);
diff --git a/win32/registry.c b/win32/registry.c
deleted file mode 100644
index ec43b30596..0000000000
--- a/win32/registry.c
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "php.h"
-#include "php_ini.h"
-#include "php_registry.h"
-
-void UpdateIniFromRegistry(char *path)
-{
- char *p, *orig_path;
- HKEY MainKey;
-
-
- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\PHP\\Per Directory Values", 0, KEY_READ, &MainKey)!=ERROR_SUCCESS) {
- return;
- }
-
-
- orig_path = path = estrdup(path);
-
- /* Get rid of C:, if exists */
- p = strchr(path, ':');
- if (p) {
- path = p+1;
- } else {
- if (path[0] != '\\' && path[0] != '/') {
- char tmp_buf[MAXPATHLEN], *cwd;
-
- /* get current working directory and prepend it to the path */
- if (!getcwd(tmp_buf, MAXPATHLEN)) {
- efree(orig_path);
- return;
- }
- cwd = strchr(tmp_buf, ':');
- if (!cwd) {
- cwd = tmp_buf;
- } else {
- cwd++;
- }
- path = (char *) emalloc(strlen(cwd)+1+strlen(orig_path)+1);
- sprintf(path, "%s\\%s", cwd, orig_path);
- efree(orig_path);
- orig_path = path;
- }
- }
-
-
- path++; /* step over the first / */
- path = p = strtok(path, "\\/");
-
- while (p) {
- HKEY hKey;
- char namebuf[256], valuebuf[256];
- DWORD lType;
- DWORD namebuf_length=256, valuebuf_length=256;
- DWORD i=0;
-
- if (p>path) {
- *(p-1) = '\\';
- }
- if (RegOpenKeyEx(MainKey, path, 0, KEY_READ, &hKey)!=ERROR_SUCCESS) {
- break;
- }
- while (RegEnumValue(hKey, i++, namebuf, &namebuf_length, NULL, &lType, valuebuf, &valuebuf_length)==ERROR_SUCCESS) {
- if (lType != REG_SZ) {
- continue;
- }
- printf("%s -> %s\n", namebuf, valuebuf);
- php_alter_ini_entry(namebuf, namebuf_length+1, valuebuf, valuebuf_length+1, PHP_INI_PERDIR);
- }
-
- RegCloseKey(hKey);
- p = strtok(NULL, "\\/");
- }
- RegCloseKey(MainKey);
- efree(orig_path);
-}
diff --git a/win32/sendmail.c b/win32/sendmail.c
deleted file mode 100644
index b598a03b9c..0000000000
--- a/win32/sendmail.c
+++ /dev/null
@@ -1,511 +0,0 @@
-
-/*
- * PHP Sendmail for Windows.
- *
- * This file is rewriten specificly for PHPFI. Some functionality
- * has been removed (MIME and file attachments). This code was
- * modified from code based on code writen by Jarle Aase.
- *
- * This class is based on the original code by Jarle Aase, see bellow:
- * wSendmail.cpp It has been striped of some functionality to match
- * the requirements of phpfi.
- *
- * Very simple SMTP Send-mail program for sending command-line level
- * emails and CGI-BIN form response for the Windows platform.
- *
- * The complete wSendmail package with source code can be downloaded
- * from http://virtual.icr.com.au:80/jgaa/cgi-bin.htm
- *
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h" /*php specific */
-#include <stdio.h>
-#include <stdlib.h>
-#include <winsock.h>
-#include "time.h"
-#include <string.h>
-#include <malloc.h>
-#include <memory.h>
-#include <winbase.h>
-#include "sendmail.h"
-#include "php_ini.h"
-
-/*
- extern int _daylight;
- extern long _timezone;
- */
-/*enum
- {
- DO_CONNECT = WM_USER +1
- };
- */
-
-static char *days[] =
-{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
-static char *months[] =
-{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
-
-#ifndef THREAD_SAFE
-char Buffer[MAIL_BUFFER_SIZE];
-
-// socket related data
-SOCKET sc;
-WSADATA Data;
-struct hostent *adr;
-SOCKADDR_IN sock_in;
-int WinsockStarted;
-// values set by the constructor
-char *AppName;
-char MailHost[HOST_NAME_LEN];
-char LocalHost[HOST_NAME_LEN];
-#endif
-char seps[] = " ,\t\n";
-char *php_mailer = "PHP 3.0 WIN32";
-
-char *get_header(char *h, char *headers);
-
-// Error messages
-static char *ErrorMessages[] =
-{
- {"Success"},
- {"Bad arguments from form"},
- {"Unable to open temporary mailfile for read"},
- {"Failed to Start Sockets"},
- {"Failed to Resolve Host"},
- {"Failed to obtain socket handle"},
- {"Failed to Connect"},
- {"Failed to Send"},
- {"Failed to Receive"},
- {"Server Error"},
- {"Failed to resolve the host IP name"},
- {"Out of memory"},
- {"Unknown error"},
- {"Bad Message Contents"},
- {"Bad Message Subject"},
- {"Bad Message destination"},
- {"Bad Message Return Path"},
- {"Bad Mail Host"},
- {"Bad Message File"},
- {"PHP Internal error: php3.ini sendmail from variable not set!"}
-};
-
-
-
-//********************************************************************
-// Name: TSendMail
-// Input: 1) host: Name of the mail host where the SMTP server resides
-// max accepted length of name = 256
-// 2) appname: Name of the application to use in the X-mailer
-// field of the message. if NULL is given the application
-// name is used as given by the GetCommandLine() function
-// max accespted length of name = 100
-// Output: 1) error: Returns the error code if something went wrong or
-// SUCCESS otherwise.
-//
-// See SendText() for additional args!
-//********************************************************************
-int TSendMail(char *host, int *error,
- char *headers, char *Subject, char *mailTo, char *data)
-{
- int ret;
- char *RPath = NULL;
- TLS_VARS;
-
- GLOBAL(WinsockStarted) = FALSE;
-
- if (host == NULL) {
- *error = BAD_MAIL_HOST;
- return BAD_MAIL_HOST;
- } else if (strlen(host) >= HOST_NAME_LEN) {
- *error = BAD_MAIL_HOST;
- return BAD_MAIL_HOST;
- } else {
- strcpy(GLOBAL(MailHost), host);
- }
-
- if (INI_STR("sendmail_from")){
- RPath = estrdup(INI_STR("sendmail_from"));
- } else {
- return 19;
- }
-
- // attempt to connect with mail host
- *error = MailConnect();
- if (*error != 0) {
- if(RPath)efree(RPath);
- return *error;
- } else {
- ret = SendText(RPath, Subject, mailTo, data, headers);
- TSMClose();
- if (ret != SUCCESS) {
- *error = ret;
- }
- if(RPath)efree(RPath);
- return ret;
- }
-}
-
-//********************************************************************
-// Name: TSendMail::~TSendMail
-// Input:
-// Output:
-// Description: DESTRUCTOR
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-void TSMClose()
-{
- TLS_VARS;
-
- Post("QUIT\n");
- Ack();
- // to guarantee that the cleanup is not made twice and
- // compomise the rest of the application if sockets are used
- // elesewhere
-}
-
-
-//********************************************************************
-// Name: char *GetSMErrorText
-// Input: Error index returned by the menber functions
-// Output: pointer to a string containing the error description
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-char *GetSMErrorText(int index)
-{
-
- if ((index > MAX_ERROR_INDEX) || (index < MIN_ERROR_INDEX))
- return (ErrorMessages[UNKNOWN_ERROR]);
- else
- return (ErrorMessages[index]);
-}
-
-
-//********************************************************************
-// Name: TSendText
-// Input: 1) RPath: return path of the message
-// Is used to fill the "Return-Path" and the
-// "X-Sender" fields of the message.
-// 2) Subject: Subject field of the message. If NULL is given
-// the subject is set to "No Subject"
-// 3) mailTo: Destination address
-// 4) data: Null terminated string containing the data to be send.
-// Output: Error code or SUCCESS
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers)
-{
-
- int res, i;
- char *p;
- TLS_VARS;
-
- // check for NULL parameters
- if (data == NULL)
- return (BAD_MSG_CONTENTS);
- if (mailTo == NULL)
- return (BAD_MSG_DESTINATION);
- if (RPath == NULL)
- return (BAD_MSG_RPATH);
-
- // simple checks for the mailto address
- // have ampersand ?
- if (strchr(mailTo, '@') == NULL)
- return (BAD_MSG_DESTINATION);
-
- sprintf(GLOBAL(Buffer), "HELO %s\n", GLOBAL(LocalHost));
-
- // in the beggining of the dialog
- // attempt reconnect if the first Post fail
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS) {
- MailConnect();
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
- return (res);
- }
- if ((res = Ack()) != SUCCESS)
- return (res);
-
- sprintf(GLOBAL(Buffer), "MAIL FROM:<%s>\n", RPath);
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
-
- sprintf(GLOBAL(Buffer), "RCPT TO:<%s>\n", mailTo);
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
- if ((res = Post("DATA\n")) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
-
- // send message header
- if (Subject == NULL)
- res = PostHeader(RPath, "No Subject", mailTo, headers);
- else
- res = PostHeader(RPath, Subject, mailTo, headers);
- if (res != SUCCESS)
- return (res);
-
-
- // send message contents in 1024 chunks
- if (strlen(data) <= 1024) {
- if ((res = Post(data)) != SUCCESS)
- return (res);
- } else {
- p = data;
- while (1) {
- if (*p == '\0')
- break;
- if (strlen(p) >= 1024)
- i = 1024;
- else
- i = strlen(p);
-
- // put next chunk in buffer
- strncpy(GLOBAL(Buffer), p, i);
- GLOBAL(Buffer)[i] = '\0';
- p += i;
-
- // send chunk
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
- return (res);
- }
- }
-
- //send termination dot
- if ((res = Post("\r\n.\r\n")) != SUCCESS)
- return (res);
- if ((res = Ack()) != SUCCESS)
- return (res);
-
- return (SUCCESS);
-}
-
-
-
-//********************************************************************
-// Name: PostHeader
-// Input: 1) return path
-// 2) Subject
-// 3) destination address
-// 4) DoMime flag
-// Output: Error code or Success
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
-{
-
- // Print message header according to RFC 822
- // Return-path, Received, Date, From, Subject, Sender, To, cc
-
- time_t tNow = time(NULL);
- struct tm *tm = localtime(&tNow);
- int zoneh = abs(_timezone);
- int zonem, res;
- char *p;
- TLS_VARS;
-
- p = GLOBAL(Buffer);
- zoneh /= (60 * 60);
- zonem = (abs(_timezone) / 60) - (zoneh * 60);
-
- p += sprintf(p, "Date: %s, %02d %s %04d %02d:%02d:%02d %s%02d%02d\r\n",
- days[tm->tm_wday],
- tm->tm_mday,
- months[tm->tm_mon],
- tm->tm_year + 1900,
- tm->tm_hour,
- tm->tm_min,
- tm->tm_sec,
- (_timezone > 0) ? "+" : (_timezone < 0) ? "-" : "",
- zoneh,
- zonem);
-
- if(xheaders && strnicmp("From:",xheaders,5)){
- p += sprintf(p, "From: %s\r\n", RPath);
- }
- p += sprintf(p, "Subject: %s\r\n", Subject);
- p += sprintf(p, "To: %s\r\n", mailTo);
- if(xheaders){
- p += sprintf(p, "%s\r\n", xheaders);
- }
-
- if ((res = Post(GLOBAL(Buffer))) != SUCCESS)
- return (res);
-
- if ((res = Post("\r\n")) != SUCCESS)
- return (res);
-
- return (SUCCESS);
-}
-
-
-
-//********************************************************************
-// Name: MailConnect
-// Input: None
-// Output: None
-// Description: Connect to the mail host and receive the welcome message.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-int MailConnect()
-{
-
- int res;
- TLS_VARS;
-
-
- // Create Socket
- if ((GLOBAL(sc) = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
- return (FAILED_TO_OBTAIN_SOCKET_HANDLE);
-
- // Get our own host name
- if (gethostname(GLOBAL(LocalHost), HOST_NAME_LEN))
- return (FAILED_TO_GET_HOSTNAME);
-
- // Resolve the servers IP
- //if (!isdigit(GLOBAL(MailHost)[0])||!gethostbyname(GLOBAL(MailHost)))
- //{
- // return (FAILED_TO_RESOLVE_HOST);
- //}
-
- // Connect to server
- GLOBAL(sock_in).sin_family = AF_INET;
- GLOBAL(sock_in).sin_port = htons(25);
- GLOBAL(sock_in).sin_addr.S_un.S_addr = GetAddr(GLOBAL(MailHost));
-
- if (connect(GLOBAL(sc), (LPSOCKADDR) & GLOBAL(sock_in), sizeof(GLOBAL(sock_in))))
- return (FAILED_TO_CONNECT);
-
- // receive Server welcome message
- res = Ack();
- return (res);
-}
-
-
-
-
-
-
-//********************************************************************
-// Name: Post
-// Input:
-// Output:
-// Description:
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-int Post(LPCSTR msg)
-{
- int len = strlen(msg);
- int slen;
- int index = 0;
- TLS_VARS;
-
- while (len > 0) {
- if ((slen = send(GLOBAL(sc), msg + index, len, 0)) < 1)
- return (FAILED_TO_SEND);
- len -= slen;
- index += slen;
- }
- return (SUCCESS);
-}
-
-
-
-//********************************************************************
-// Name: Ack
-// Input:
-// Output:
-// Description:
-// Get the response from the server. We only want to know if the
-// last command was successful.
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-int Ack()
-{
- static char *buf;
- int rlen;
- int Index = 0;
- int Received = 0;
- TLS_VARS;
-
- if (!buf)
- if ((buf = (char *) malloc(1024 * 4)) == NULL)
- return (OUT_OF_MEMORY);
-
- again:
-
- if ((rlen = recv(GLOBAL(sc), buf + Index, ((1024 * 4) - 1) - Received, 0)) < 1)
- return (FAILED_TO_RECEIVE);
-
- Received += rlen;
- buf[Received] = 0;
- //err_msg fprintf(stderr,"Received: (%d bytes) %s", rlen, buf + Index);
-
- // Check for newline
- Index += rlen;
- if ((buf[Received - 2] != '\r') || (buf[Received - 1] != '\n'))
- // err_msg fprintf(stderr,"Incomplete server message. Awaiting CRLF\n");
- goto again; // Incomplete data. Line must be terminated by CRLF
-
- if (buf[0] > '3')
- return (SMTP_SERVER_ERROR);
-
- return (SUCCESS);
-}
-
-
-//********************************************************************
-// Name: unsigned long GetAddr (LPSTR szHost)
-// Input:
-// Output:
-// Description: Given a string, it will return an IP address.
-// - first it tries to convert the string directly
-// - if that fails, it tries o resolve it as a hostname
-//
-// WARNING: gethostbyname() is a blocking function
-// Author/Date: jcar 20/9/96
-// History:
-//********************************************************************
-unsigned long GetAddr(LPSTR szHost)
-{
- LPHOSTENT lpstHost;
- u_long lAddr = INADDR_ANY;
-
- /* check that we have a string */
- if (*szHost) {
-
- /* check for a dotted-IP address string */
- lAddr = inet_addr(szHost);
-
- /* If not an address, then try to resolve it as a hostname */
- if ((lAddr == INADDR_NONE) && (strcmp(szHost, "255.255.255.255"))) {
-
- lpstHost = gethostbyname(szHost);
- if (lpstHost) { /* success */
- lAddr = *((u_long FAR *) (lpstHost->h_addr));
- } else {
- lAddr = INADDR_ANY; /* failure */
- }
- }
- }
- return (lAddr);
-} /* end GetAddr() */
diff --git a/win32/sendmail.h b/win32/sendmail.h
deleted file mode 100644
index 3c426fb219..0000000000
--- a/win32/sendmail.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#if !defined(sendmail_h) // Sentry, use file only if it's not already included.
-#define sendmail_h
-#include <windows.h>
-
-#define HOST_NAME_LEN 256
-#define MAX_APPNAME_LENGHT 100
-#define MAX_ERROR_INDEX 17
-#define MIN_ERROR_INDEX 0
-#define MAIL_BUFFER_SIZE (1024*4) // 4k buffer
-// Return values
-#define SUCCESS 0
-#define FAILED_TO_PARSE_ARGUMENTS 1
-#define FAILED_TO_OPEN_MAILFILE 2
-#define FAILED_TO_START_SOCKETS 3
-#define FAILED_TO_RESOLVE_HOST 4
-#define FAILED_TO_OBTAIN_SOCKET_HANDLE 5
-#define FAILED_TO_CONNECT 6
-#define FAILED_TO_SEND 7
-#define FAILED_TO_RECEIVE 8
-#define SMTP_SERVER_ERROR 9
-#define FAILED_TO_GET_HOSTNAME 10
-#define OUT_OF_MEMORY 11
-#define UNKNOWN_ERROR 12
-#define BAD_MSG_CONTENTS 13
-#define BAD_MSG_SUBJECT 14
-#define BAD_MSG_DESTINATION 15
-#define BAD_MSG_RPATH 16
-#define BAD_MAIL_HOST 17
-#define BAD_MSG_FILE 18
-
-
-int TSendMail(char *smtpaddr, int *returnerror,
- char *RPath, char *Subject, char *mailTo, char *data);
-void TSMClose(void);
-int SendText(char *RPath, char *Subject, char *mailTo, char *data, char *headers);
-char *GetSMErrorText(int index);
-
-int MailConnect();
-int PostHeader(char *, char *, char *, char *);
-int Post(LPCSTR);
-int Ack();
-unsigned long GetAddr(LPSTR szHost);
-
-
-
-#endif // sendmail_h
diff --git a/win32/signal.h b/win32/signal.h
deleted file mode 100644
index 58941d4793..0000000000
--- a/win32/signal.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <signal.h>
-#define SIGALRM 13
-#define SIGVTALRM 26 /* virtual time alarm */
-#define SIGPROF 27 /* profiling time alarm */
diff --git a/win32/syslog.h b/win32/syslog.h
deleted file mode 100644
index 22239fb4e5..0000000000
--- a/win32/syslog.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This header borrowed from Cygnus GNUwin32 project
- *
- * Modified for use with functions to map syslog
- * calls to EventLog calls on the windows platform
- *
- * much of this is not used, but here for the sake of
- * error free compilation. EventLogs will most likely
- * not behave as syslog does, but may be useful anyway.
- * much of what syslog does can be emulated here, but
- * that will have to be done later.
- */
-
-#ifndef _SYS_LOG_H
-#define _SYS_LOG_H
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
-#define LOG_EMERG 1
-#define LOG_ALERT 1
-#define LOG_CRIT 1
-#define LOG_ERR 4
-#define LOG_WARNING 5
-#define LOG_NOTICE 6
-#define LOG_INFO 6
-#define LOG_DEBUG 6
-
-#define LOG_PRIMASK 0x07
-
-#define LOG_PRI(p) ((p) & LOG_PRIMASK)
-#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
-
-#define LOG_KERN (0<<3)
-#define LOG_USER (1<<3)
-#define LOG_MAIL (2<<3)
-#define LOG_DAEMON (3<<3)
-#define LOG_AUTH (4<<3)
-#define LOG_SYSLOG (5<<3)
-#define LOG_LPR (6<<3)
-#define LOG_NEWS (7<<3)
-#define LOG_UUCP (8<<3)
-#define LOG_CRON (9<<3)
-#define LOG_AUTHPRIV (10<<3)
-
-#define LOG_NFACILITIES 10
-#define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-
-#define LOG_MASK(pri) (1 << (pri))
-#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1)
-
-/*
- * Option flags for openlog.
- *
- * LOG_ODELAY no longer does anything.
- * LOG_NDELAY is the inverse of what it used to be.
- */
-#define LOG_PID 0x01 /* log the pid with each message */
-#define LOG_CONS 0x02 /* log on the console if errors in sending */
-#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
-#define LOG_NDELAY 0x08 /* don't delay open */
-#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
-#define LOG_PERROR 0x20 /* log to stderr as well */
-
-
-extern void closelog(void);
-extern void openlog(const char *, int, int);
-// setlogmask not implemented
-//extern int setlogmask (int);
-extern void syslog(int, const char *,...);
-
-
-#endif /* _SYS_LOG_H */
diff --git a/win32/time.c b/win32/time.c
deleted file mode 100644
index 1a50f87547..0000000000
--- a/win32/time.c
+++ /dev/null
@@ -1,156 +0,0 @@
-
-/*****************************************************************************
- * *
- * DH_TIME.C *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for use with PHP
- *
- *****************************************************************************/
-
-
-/* Include stuff ************************************************************ */
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "time.h"
-#include "unistd.h"
-#include "signal.h"
-#include <winbase.h>
-#include <mmsystem.h>
-#include <errno.h>
-
-int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info)
-{
- _int64 mstimer, freq;
- /* Get the time, if they want it */
- if (time_Info != NULL) {
- time_Info->tv_sec = time(NULL);
- /* get ticks-per-second of the performance counter
- Note the necessary typecast to a LARGE_INTEGER structure
- */
- if (!QueryPerformanceFrequency((LARGE_INTEGER *) & freq)) {
- time_Info->tv_usec = 0;
- } else {
- QueryPerformanceCounter((LARGE_INTEGER *) & mstimer);
- mstimer = (__int64) (mstimer * .8);
- time_Info->tv_usec = (long) (mstimer % 0x0FFFFFFF);
- }
- }
- /* Get the timezone, if they want it */
- if (timezone_Info != NULL) {
- _tzset();
- timezone_Info->tz_minuteswest = _timezone;
- timezone_Info->tz_dsttime = _daylight;
- }
- /* And return */
- return 0;
-}
-
-
-/* this usleep isnt exactly accurate but should do ok */
-void usleep(unsigned int useconds)
-{
- __int64 mstimer, freq;
- long now, then;
- if (QueryPerformanceFrequency((LARGE_INTEGER *) & freq)) {
- QueryPerformanceCounter((LARGE_INTEGER *) & mstimer);
- now = (long) (((__int64) (mstimer * .8)) % 0x0FFFFFFF);
- then = now + useconds;
- while (now < then) {
- QueryPerformanceCounter((LARGE_INTEGER *) & mstimer);
- now = (long) (((__int64) (mstimer * .8)) % 0x0FFFFFFF);
- }
- } else {
- /*workaround for systems without performance counter
- this is actualy a millisecond sleep */
- Sleep((int) (useconds / 1000));
- }
-}
-
-
-#if HAVE_SETITIMER
-
-
-#ifndef THREAD_SAFE
-unsigned int proftimer, virttimer, realtimer;
-extern LPMSG phpmsg;
-#endif
-
-struct timer_msg {
- int signal;
- unsigned int threadid;
-};
-
-
-LPTIMECALLBACK setitimer_timeout(UINT uTimerID, UINT info, DWORD dwUser, DWORD dw1, DWORD dw2)
-{
- struct timer_msg *msg = (struct timer_msg *) info;
-
- if (msg) {
- raise((int) msg->signal);
- PostThreadMessage(msg->threadid,
- WM_NOTIFY, msg->signal, 0);
- free(msg);
- }
- return 0;
-}
-
-int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
-{
- int timeout = value->it_value.tv_sec * 1000 + value->it_value.tv_usec;
- int repeat = TIME_ONESHOT;
- TLS_VARS;
-
- /*make sure the message queue is initialized */
- PeekMessage(GLOBAL(phpmsg), NULL, WM_USER, WM_USER, PM_NOREMOVE);
- if (timeout > 0) {
- struct timer_msg *msg = malloc(sizeof(struct timer_msg));
- msg->threadid = GetCurrentThreadId();
- if (!ovalue) {
- repeat = TIME_PERIODIC;
- }
- switch (which) {
- case ITIMER_REAL:
- msg->signal = SIGALRM;
- GLOBAL(realtimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_VIRT:
- msg->signal = SIGVTALRM;
- GLOBAL(virttimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- case ITIMER_PROF:
- msg->signal = SIGPROF;
- GLOBAL(proftimer) = timeSetEvent(timeout, 100, (LPTIMECALLBACK) setitimer_timeout, (UINT) msg, repeat);
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- } else {
- switch (which) {
- case ITIMER_REAL:
- timeKillEvent(GLOBAL(realtimer));
- break;
- case ITIMER_VIRT:
- timeKillEvent(GLOBAL(virttimer));
- break;
- case ITIMER_PROF:
- timeKillEvent(GLOBAL(proftimer));
- break;
- default:
- errno = EINVAL;
- return -1;
- break;
- }
- }
-
-
- return 0;
-}
-
-#endif
diff --git a/win32/time.h b/win32/time.h
deleted file mode 100644
index e5abd293c3..0000000000
--- a/win32/time.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * *
- * sys/time.h *
- * *
- * Freely redistributable and modifiable. Use at your own risk. *
- * *
- * Copyright 1994 The Downhill Project *
- *
- * Modified by Shane Caraveo for PHP
- *
- *****************************************************************************/
-
-
-/* Include stuff ************************************************************ */
-#include <winsock.h>
-#include <time.h>
-
-/* Struct stuff ************************************************************* */
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-
-
-struct itimerval {
- struct timeval it_interval; /* next value */
- struct timeval it_value; /* current value */
-};
-
-#define ITIMER_REAL 0 /*generates sigalrm */
-#define ITIMER_VIRTUAL 1 /*generates sigvtalrm */
-#define ITIMER_VIRT 1 /*generates sigvtalrm */
-#define ITIMER_PROF 2 /*generates sigprof */
-
-/* Prototype stuff ********************************************************** */
-extern int gettimeofday(struct timeval *time_Info, struct timezone *timezone_Info);
-
-/* setitimer operates at 100 millisecond resolution */
-extern int setitimer(int which, const struct itimerval *value,
- struct itimerval *ovalue);
diff --git a/win32/unistd.h b/win32/unistd.h
deleted file mode 100644
index 5604103ec9..0000000000
--- a/win32/unistd.h
+++ /dev/null
@@ -1 +0,0 @@
-extern void usleep(unsigned int useconds);
diff --git a/win32/wfile.c b/win32/wfile.c
deleted file mode 100644
index 1407d6a32b..0000000000
--- a/win32/wfile.c
+++ /dev/null
@@ -1,17 +0,0 @@
-
-/* Function borrowed from the Downhill Project */
-#include "wfile.h"
-#include "direct.h"
-
-int readlink(char *file_Name, char *buf_Mem, int buf_Size)
-{
- /* See if the file exists */
- if (access(file_Name, X_OK) == -1) {
- errno = ENOENT;
- } else {
- errno = EINVAL;
- }
-
- /* Either way, it's not a link */
- return -1;
-}
diff --git a/win32/wfile.h b/win32/wfile.h
deleted file mode 100644
index 2e79406478..0000000000
--- a/win32/wfile.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#define access _access
-#define X_OK 0
-#ifndef ENOENT
-#define ENOENT 136
-#endif
-#ifndef EINVAL
-#define EINVAL 131
-#endif
-
-int readlink(char *, char *, int);
-int checkroot(char *path);
diff --git a/win32/winutil.c b/win32/winutil.c
deleted file mode 100644
index 0ac7e54703..0000000000
--- a/win32/winutil.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifdef THREAD_SAFE
-#include "tls.h"
-#else
-#define TLS_VARS
-#define GLOBAL(a) a
-#endif
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include "winutil.h"
-
-#ifndef THREAD_SAFE
-static char Win_Error_msg[256];
-#endif
-
-char *php3_win_err(void)
-{
- TLS_VARS;
-
- FormatMessage(
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR) GLOBAL(Win_Error_msg),
- 256,
- NULL);
-
- return GLOBAL(Win_Error_msg);
-}
diff --git a/win32/winutil.h b/win32/winutil.h
deleted file mode 100644
index ca6c63a245..0000000000
--- a/win32/winutil.h
+++ /dev/null
@@ -1 +0,0 @@
-extern char *php3_win_err(void);
diff --git a/win32/wsyslog.c b/win32/wsyslog.c
deleted file mode 100644
index 4207370dbf..0000000000
--- a/win32/wsyslog.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * This file modified from sources for imap4 for use
- * in PHP 3
- */
-/*
- * Program: Unix compatibility routines
- *
- * Author: Mark Crispin
- * Networks and Distributed Computing
- * Computing & Communications
- * University of Washington
- * Administration Building, AG-44
- * Seattle, WA 98195
- * Internet: MRC@CAC.Washington.EDU
- *
- * Date: 14 September 1996
- * Last Edited: 22 October 1996
- *
- * Copyright 1996 by the University of Washington
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appears in all copies and that both the
- * above copyright notice and this permission notice appear in supporting
- * documentation, and that the name of the University of Washington not be
- * used in advertising or publicity pertaining to distribution of the software
- * without specific, written prior permission. This software is made available
- * "as is", and
- * THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
- * WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND IN
- * NO EVENT SHALL THE UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY SPECIAL,
- * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT
- * (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-
-
-/* DEDICATION
-
- * This file is dedicated to my dog, Unix, also known as Yun-chan and
- * Unix J. Terwilliker Jehosophat Aloysius Monstrosity Animal Beast. Unix
- * passed away at the age of 11 1/2 on September 14, 1996, 12:18 PM PDT, after
- * a two-month bout with cirrhosis of the liver.
- *
- * He was a dear friend, and I miss him terribly.
- *
- * Lift a leg, Yunie. Luv ya forever!!!!
- */
-
-#ifdef THREAD_SAFE
-#include "tls.h"
-#endif
-#include "php.h" /*php specific */
-#include "syslog.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <process.h>
-
-#ifndef THREAD_SAFE
-static char *loghdr; /* log file header string */
-static HANDLE loghdl = NULL; /* handle of event source */
-#endif
-
-void closelog(void)
-{
- TLS_VARS;
- DeregisterEventSource(GLOBAL(loghdl));
- efree(GLOBAL(loghdr));
-}
-
-/* Emulator for BSD syslog() routine
- * Accepts: priority
- * message
- * parameters
- */
-
-void syslog(int priority, const char *message,...)
-{
- va_list args;
- LPTSTR strs[2];
- char tmp[1024]; /* callers must be careful not to pop this */
- unsigned short etype;
- TLS_VARS;
-
- /* default event source */
- if (!GLOBAL(loghdl))
- openlog("c-client", LOG_PID, LOG_MAIL);
- switch (priority) { /* translate UNIX type into NT type */
- case LOG_ALERT:
- etype = EVENTLOG_ERROR_TYPE;
- break;
- case LOG_INFO:
- etype = EVENTLOG_INFORMATION_TYPE;
- break;
- default:
- etype = EVENTLOG_WARNING_TYPE;
- }
- va_start(args, message); /* initialize vararg mechanism */
- vsprintf(tmp, message, args); /* build message */
- strs[0] = GLOBAL(loghdr); /* write header */
- strs[1] = tmp; /* then the message */
- /* report the event */
- ReportEvent(GLOBAL(loghdl), etype, (unsigned short) priority, 2000, NULL, 2, 0, strs, NULL);
- va_end(args);
-}
-
-
-/* Emulator for BSD openlog() routine
- * Accepts: identity
- * options
- * facility
- */
-
-void openlog(const char *ident, int logopt, int facility)
-{
- char tmp[1024];
- TLS_VARS;
-
- if (GLOBAL(loghdl)) {
- closelog();
- }
- GLOBAL(loghdl) = RegisterEventSource(NULL, ident);
- sprintf(tmp, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
- GLOBAL(loghdr) = estrdup(tmp); /* save header for later */
-}
diff --git a/zlib.mak b/zlib.mak
deleted file mode 100644
index f8523cb85a..0000000000
--- a/zlib.mak
+++ /dev/null
@@ -1,194 +0,0 @@
-# Microsoft Developer Studio Generated NMAKE File, Based on zlib.dsp
-!IF "$(CFG)" == ""
-CFG=zlib - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to zlib - Win32 Debug.
-!ENDIF
-
-!IF "$(CFG)" != "zlib - Win32 Release" && "$(CFG)" != "zlib - 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 "zlib.mak" CFG="zlib - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "zlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "zlib - 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)" == "zlib - Win32 Release"
-
-OUTDIR=.\module_Release
-INTDIR=.\module_Release
-# Begin Custom Macros
-OutDir=.\module_Release
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_zlib.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\zlib.obj"
- -@erase "$(OUTDIR)\php3_zlib.dll"
- -@erase "$(OUTDIR)\php3_zlib.exp"
- -@erase "$(OUTDIR)\php3_zlib.lib"
-
-"$(OUTDIR)" :
- if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-
-CPP=cl.exe
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "./" /I "../" /I "../../include" /D HAVE_ZLIB=1 /D "NDEBUG" /D "MSVC5" /D "COMPILE_DL" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\zlib.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)\zlib.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=zlibstat.lib 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_zlib.pdb" /machine:I386 /out:"$(OUTDIR)\php3_zlib.dll" /implib:"$(OUTDIR)\php3_zlib.lib" /libpath:"..\..\lib" /libpath:"cgi_release"
-LINK32_OBJS= \
- "$(INTDIR)\zlib.obj"
-
-"$(OUTDIR)\php3_zlib.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ELSEIF "$(CFG)" == "zlib - Win32 Debug"
-
-OUTDIR=.\module_Debug
-INTDIR=.\module_Debug
-# Begin Custom Macros
-OutDir=.\module_Debug
-# End Custom Macros
-
-ALL : "$(OUTDIR)\php3_zlib.dll"
-
-
-CLEAN :
- -@erase "$(INTDIR)\vc60.idb"
- -@erase "$(INTDIR)\vc60.pdb"
- -@erase "$(INTDIR)\zlib.obj"
- -@erase "$(OUTDIR)\php3_zlib.dll"
- -@erase "$(OUTDIR)\php3_zlib.exp"
- -@erase "$(OUTDIR)\php3_zlib.ilk"
- -@erase "$(OUTDIR)\php3_zlib.lib"
- -@erase "$(OUTDIR)\php3_zlib.pdb"
-
-"$(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 HAVE_ZLIB=1 /D "DEBUG" /D "_DEBUG" /D "MSVC5" /D "COMPILE_DL" /D "THREAD_SAFE" /D "WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\zlib.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)\zlib.bsc"
-BSC32_SBRS= \
-
-LINK32=link.exe
-LINK32_FLAGS=php.lib zlibstat.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_zlib.pdb" /debug /machine:I386 /out:"$(OUTDIR)\php3_zlib.dll" /implib:"$(OUTDIR)\php3_zlib.lib" /pdbtype:sept /libpath:"..\..\lib" /libpath:"cgi_debug"
-LINK32_OBJS= \
- "$(INTDIR)\zlib.obj"
-
-"$(OUTDIR)\php3_zlib.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
- $(LINK32) @<<
- $(LINK32_FLAGS) $(LINK32_OBJS)
-<<
-
-!ENDIF
-
-
-!IF "$(NO_EXTERNAL_DEPS)" != "1"
-!IF EXISTS("zlib.dep")
-!INCLUDE "zlib.dep"
-!ELSE
-!MESSAGE Warning: cannot find "zlib.dep"
-!ENDIF
-!ENDIF
-
-
-!IF "$(CFG)" == "zlib - Win32 Release" || "$(CFG)" == "zlib - Win32 Debug"
-SOURCE=.\functions\zlib.c
-
-"$(INTDIR)\zlib.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-
-!ENDIF
-