summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--Makefile.in2
-rw-r--r--Zend/FlexLexer.h186
-rw-r--r--Zend/LICENSE116
-rw-r--r--Zend/Makefile.am26
-rw-r--r--Zend/ZEND_CHANGES111
-rw-r--r--Zend/ZendCore.dep258
-rw-r--r--Zend/acconfig.h50
-rw-r--r--Zend/acinclude.m420
-rwxr-xr-xZend/buildconf24
-rw-r--r--Zend/config.unix.h59
-rw-r--r--Zend/config.w32.h61
-rw-r--r--Zend/configure.in154
-rw-r--r--Zend/flex.skl1541
-rw-r--r--Zend/libzend.dsp363
-rw-r--r--Zend/libzendts.dsp363
-rw-r--r--Zend/zend-parser.y658
-rw-r--r--Zend/zend-scanner.h52
-rw-r--r--Zend/zend-scanner.l1485
-rw-r--r--Zend/zend.c437
-rw-r--r--Zend/zend.h248
-rw-r--r--Zend/zend.icobin1382 -> 0 bytes
-rw-r--r--Zend/zend_API.c771
-rw-r--r--Zend/zend_API.h238
-rw-r--r--Zend/zend_alloc.c592
-rw-r--r--Zend/zend_alloc.h131
-rw-r--r--Zend/zend_compile.c1977
-rw-r--r--Zend/zend_compile.h559
-rw-r--r--Zend/zend_constants.c268
-rw-r--r--Zend/zend_constants.h63
-rw-r--r--Zend/zend_errors.h37
-rw-r--r--Zend/zend_execute.c1961
-rw-r--r--Zend/zend_execute.h75
-rw-r--r--Zend/zend_execute_API.c506
-rw-r--r--Zend/zend_extensions.c157
-rw-r--r--Zend/zend_extensions.h102
-rw-r--r--Zend/zend_globals.h233
-rw-r--r--Zend/zend_hash.c1193
-rw-r--r--Zend/zend_hash.h160
-rw-r--r--Zend/zend_highlight.c167
-rw-r--r--Zend/zend_highlight.h49
-rw-r--r--Zend/zend_indent.c151
-rw-r--r--Zend/zend_indent.h26
-rw-r--r--Zend/zend_list.c228
-rw-r--r--Zend/zend_list.h68
-rw-r--r--Zend/zend_llist.c217
-rw-r--r--Zend/zend_llist.h61
-rw-r--r--Zend/zend_modules.h60
-rw-r--r--Zend/zend_opcode.c398
-rw-r--r--Zend/zend_operators.c1348
-rw-r--r--Zend/zend_operators.h73
-rw-r--r--Zend/zend_ptr_stack.c78
-rw-r--r--Zend/zend_ptr_stack.h40
-rw-r--r--Zend/zend_sprintf.c40
-rw-r--r--Zend/zend_stack.c118
-rw-r--r--Zend/zend_stack.h43
-rw-r--r--Zend/zend_variables.c161
-rw-r--r--Zend/zend_variables.h42
-rw-r--r--acinclude.m424
-rwxr-xr-xbuildconf31
-rw-r--r--config.guess997
-rw-r--r--config.sub979
-rw-r--r--configure.in.in16
-rw-r--r--ext/gd/config.h.stub3
-rw-r--r--ext/gd/config.m454
-rw-r--r--ext/gd/gd.c91
-rw-r--r--ext/gd/gdcache.c6
-rw-r--r--ext/gd/gdttf.c20
-rw-r--r--ext/gd/php3_gd.h7
-rw-r--r--ext/informix/ifx.ec39
-rw-r--r--ext/standard/Makefile.am3
-rw-r--r--ext/standard/basic_functions.c3
-rw-r--r--ext/standard/datetime.c31
-rw-r--r--ext/standard/datetime.h1
-rw-r--r--ext/standard/fsock.c2
-rw-r--r--ext/standard/parsedate.y919
-rw-r--r--ext/standard/php3_string.h1
-rw-r--r--ext/standard/rand.c50
-rw-r--r--ext/wddx/wddx.c2
-rw-r--r--ext/xml/Makefile.am2
-rw-r--r--ext/xml/config.m417
-rw-r--r--ltconfig2822
-rw-r--r--ltmain.sh3779
-rw-r--r--main/main.c14
-rw-r--r--main/php_version.h4
-rw-r--r--mod_php4.c2
-rw-r--r--php4.gifbin0 -> 2123 bytes
-rw-r--r--php4.spec.in48
-rw-r--r--php4dll.dsp24
-rw-r--r--php4dllts.dsp28
-rwxr-xr-xscripts/mkextlib.in1
91 files changed, 1374 insertions, 27273 deletions
diff --git a/ChangeLog b/ChangeLog
index 96943e49d7..302daada1f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,28 @@ PHP 4.0 CHANGE LOG ChangeLog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
??? ?? 1999, Version 4.0 Beta 2
+- Fixed a problem with the PHP error handler that could result in a crash
+ on certain operating systems (Zeev)
+- Apache php_flag values only recognized 'On' (case sensitive) - changed
+ to case insensitive (Zeev)
+- Fixed a memory leak with switch statement containing return statements
+ (Andi & Zeev, libzend)
+- Fixed a crash problem in switch statements that had a string offset
+ as a conditional (Andi & Zeev, libzend)
+- Imported PHP3 fixes for rand() and mt_rand() (Rasmus)
+- Added function entries for strip_tags() and similar_text() (Andrey)
+- Fixed a bug in WDDX that would cause a crash if a number was passed in
+ instead of a variable name (Andrey)
+- Ported strtotime() function from PHP3 (Andrey)
+- Merged in gdttf stuff from php3 (Sascha)
+- buildconf now checks your installation (Stig)
+- XML module now built dynamically with --with-xml=shared (Stig)
+- Added a check for freetype.h - fixed build on RedHat 6.0 (Zeev)
+- Fixed array_walk() to work in PHP4 (Andrey)
+- Ported all remaining date() format options from PHP3 (Andrey)
+- $php_errormsg now works (Andrey)
+- Added locale support for Perl Compatible Regexp functions (Andrey)
+- Informix module ported (Danny)
- Removed --with-shared-apache (Sascha)
- Added patch for reverse lookup table in base64_decode (Sascha)
Submitted by bfranklin@dct.com
diff --git a/Makefile.in b/Makefile.in
index 79c7711b3b..1fadf472c7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -135,7 +135,7 @@ distclean: clean distclean-recursive
-rm -f *-parser.[ch] *-scanner.c *.output
-rm -f config.status config.cache config.log
-rm -f Makefile Makefile.depend php_config.h build-defs.h
- -rm -f libphp4.module stamp-h
+ -rm -f libphp4.module stamp-h buildconf.stamp
-rm -f regex/*.o regex/*.a regex/*.ih
-rm -f doc/checkdoc doc/funcparse doc/version.ent
-rm -f do-conf test/test.log
diff --git a/Zend/FlexLexer.h b/Zend/FlexLexer.h
deleted file mode 100644
index 549177b8b9..0000000000
--- a/Zend/FlexLexer.h
+++ /dev/null
@@ -1,186 +0,0 @@
-// $Header$
-
-// FlexLexer.h -- define interfaces for lexical analyzer classes generated
-// by flex
-
-// Copyright (c) 1993 The Regents of the University of California.
-// All rights reserved.
-//
-// This code is derived from software contributed to Berkeley by
-// Kent Williams and Tom Epperly.
-//
-// Redistribution and use in source and binary forms with or without
-// modification are permitted provided that: (1) source distributions retain
-// this entire copyright notice and comment, and (2) distributions including
-// binaries display the following acknowledgement: ``This product includes
-// software developed by the University of California, Berkeley and its
-// contributors'' in the documentation or other materials provided with the
-// distribution and in all advertising materials mentioning features or use
-// of this software. Neither the name of the University nor the names of
-// its contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-
-// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-// This file defines FlexLexer, an abstract class which specifies the
-// external interface provided to flex C++ lexer objects, and yyFlexLexer,
-// which defines a particular lexer class.
-//
-// If you want to create multiple lexer classes, you use the -P flag
-// to rename each yyFlexLexer to some other xxFlexLexer. You then
-// include <FlexLexer.h> in your other sources once per lexer class:
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer xxFlexLexer
-// #include <FlexLexer.h>
-//
-// #undef yyFlexLexer
-// #define yyFlexLexer zzFlexLexer
-// #include <FlexLexer.h>
-// ...
-
-#ifndef __FLEX_LEXER_H
-// Never included before - need to define base class.
-#define __FLEX_LEXER_H
-#include <iostream.h>
-
-extern "C++" {
-
-struct yy_buffer_state;
-typedef int yy_state_type;
-
-class FlexLexer {
-public:
- virtual ~FlexLexer() { }
-
- const char* YYText() { return yytext; }
- int YYLeng() { return yyleng; }
-
- virtual void
- yy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;
- virtual struct yy_buffer_state*
- yy_create_buffer( istream* s, int size ) = 0;
- virtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;
- virtual void yyrestart( istream* s ) = 0;
-
- virtual int yylex() = 0;
-
- // Call yylex with new input/output sources.
- int yylex( istream* new_in, ostream* new_out = 0 )
- {
- switch_streams( new_in, new_out );
- return yylex();
- }
-
- // Switch to new input/output streams. A nil stream pointer
- // indicates "keep the current one".
- virtual void switch_streams( istream* new_in = 0,
- ostream* new_out = 0 ) = 0;
-
- int lineno() const { return yylineno; }
-
- int debug() const { return yy_flex_debug; }
- void set_debug( int flag ) { yy_flex_debug = flag; }
-
-protected:
- char* yytext;
- int yyleng;
- int yylineno; // only maintained if you use %option yylineno
- int yy_flex_debug; // only has effect with -d or "%option debug"
-};
-
-}
-#endif
-
-#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
-// Either this is the first time through (yyFlexLexerOnce not defined),
-// or this is a repeated include to define a different flavor of
-// yyFlexLexer, as discussed in the flex man page.
-#define yyFlexLexerOnce
-
-class yyFlexLexer : public FlexLexer {
-public:
- // arg_yyin and arg_yyout default to the cin and cout, but we
- // only make that assignment when initializing in yylex().
- yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 );
-
- virtual ~yyFlexLexer();
-
- void yy_switch_to_buffer( struct yy_buffer_state* new_buffer );
- struct yy_buffer_state* yy_create_buffer( istream* s, int size );
- void yy_delete_buffer( struct yy_buffer_state* b );
- void yyrestart( istream* s );
-
- virtual int yylex();
- virtual void switch_streams( istream* new_in, ostream* new_out );
-
-protected:
- virtual int LexerInput( char* buf, int max_size );
- virtual void LexerOutput( const char* buf, int size );
- virtual void LexerError( const char* msg );
-
- void yyunput( int c, char* buf_ptr );
- int yyinput();
-
- void yy_load_buffer_state();
- void yy_init_buffer( struct yy_buffer_state* b, istream* s );
- void yy_flush_buffer( struct yy_buffer_state* b );
-
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int* yy_start_stack;
-
- void yy_push_state( int new_state );
- void yy_pop_state();
- int yy_top_state();
-
- yy_state_type yy_get_previous_state();
- yy_state_type yy_try_NUL_trans( yy_state_type current_state );
- int yy_get_next_buffer();
-
- istream* yyin; // input source for default LexerInput
- ostream* yyout; // output sink for default LexerOutput
-
- struct yy_buffer_state* yy_current_buffer;
-
- // yy_hold_char holds the character lost when yytext is formed.
- char yy_hold_char;
-
- // Number of characters read into yy_ch_buf.
- int yy_n_chars;
-
- // Points to current character in buffer.
- char* yy_c_buf_p;
-
- int yy_init; // whether we need to initialize
- int yy_start; // start state number
-
- // Flag which is used to allow yywrap()'s to do buffer switches
- // instead of setting up a fresh yyin. A bit of a hack ...
- int yy_did_buffer_switch_on_eof;
-
- // The following are not always needed, but may be depending
- // on use of certain flex features (like REJECT or yymore()).
-
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- yy_state_type* yy_state_buf;
- yy_state_type* yy_state_ptr;
-
- char* yy_full_match;
- int* yy_full_state;
- int yy_full_lp;
-
- int yy_lp;
- int yy_looking_for_trail_begin;
-
- int yy_more_flag;
- int yy_more_len;
- int yy_more_offset;
- int yy_prev_more_offset;
-};
-
-#endif
diff --git a/Zend/LICENSE b/Zend/LICENSE
deleted file mode 100644
index 1dd42f1ff3..0000000000
--- a/Zend/LICENSE
+++ /dev/null
@@ -1,116 +0,0 @@
----------------------------------------------------------------------------
- The Zend License, version 0.91
- Copyright (C) 1999 Andi Gutmans & Zeev Suraski
----------------------------------------------------------------------------
-
-The Zend scripting engine library is a product of Andi Gutmans and
-Zeev Suraski. It may be used and/or distributed under the terms of the
-Q Public License (QPL) version 1.0, enclosed below.
-
-For more information about Zend please visit http://www.zend.com/
-For license related questions please mail license@zend.com
-
-===========================================================================
-
- THE Q PUBLIC LICENSE
- version 1.0
-
- Copyright (C) 1999 Troll Tech AS, Norway.
- Everyone is permitted to copy and
- distribute this license document.
-
-The intent of this license is to establish freedom to share and change the
-software regulated by this license under the open source model.
-
-This license applies to any software containing a notice placed by the
-copyright holder saying that it may be distributed under the terms of
-the Q Public License version 1.0. Such software is herein referred to as
-the Software. This license covers modification and distribution of the
-Software, use of third-party application programs based on the Software,
-and development of free software which uses the Software.
-
- Granted Rights
-
-1. You are granted the non-exclusive rights set forth in this license
- provided you agree to and comply with any and all conditions in this
- license. Whole or partial distribution of the Software, or software
- items that link with the Software, in any form signifies acceptance of
- this license.
-
-2. You may copy and distribute the Software in unmodified form provided
- that the entire package, including - but not restricted to - copyright,
- trademark notices and disclaimers, as released by the initial developer
- of the Software, is distributed.
-
-3. You may make modifications to the Software and distribute your
- modifications, in a form that is separate from the Software, such as
- patches. The following restrictions apply to modifications:
-
- a. Modifications must not alter or remove any copyright notices in
- the Software.
-
- b. When modifications to the Software are released under this
- license, a non-exclusive royalty-free right is granted to the
- initial developer of the Software to distribute your modification
- in future versions of the Software provided such versions remain
- available under these terms in addition to any other license(s) of
- the initial developer.
-
-4. You may distribute machine-executable forms of the Software or
- machine-executable forms of modified versions of the Software, provided
- that you meet these restrictions:
-
- a. You must include this license document in the distribution.
-
- b. You must ensure that all recipients of the machine-executable forms
- are also able to receive the complete machine-readable source code
- to the distributed Software, including all modifications, without
- any charge beyond the costs of data transfer, and place prominent
- notices in the distribution explaining this.
-
- c. You must ensure that all modifications included in the
- machine-executable forms are available under the terms of this
- license.
-
-5. You may use the original or modified versions of the Software to
- compile, link and run application programs legally developed by you
- or by others.
-
-6. You may develop application programs, reusable components and other
- software items that link with the original or modified versions of the
- Software. These items, when distributed, are subject to the following
- requirements:
-
- a. You must ensure that all recipients of machine-executable forms of
- these items are also able to receive and use the complete
- machine-readable source code to the items without any charge
- beyond the costs of data transfer.
-
- b. You must explicitly license all recipients of your items to use
- and re-distribute original and modified versions of the items in
- both machine-executable and source code forms. The recipients must
- be able to do so without any charges whatsoever, and they must be
- able to re-distribute to anyone they choose.
-
-
- c. If the items are not available to the general public, and the
- initial developer of the Software requests a copy of the items,
- then you must supply one.
-
- Limitations of Liability
-
-In no event shall the initial developers or copyright holders be liable
-for any damages whatsoever, including - but not restricted to - lost
-revenue or profits or other direct, indirect, special, incidental or
-consequential damages, even if they have been advised of the possibility
-of such damages, except to the extent invariable law, if any, provides
-otherwise.
-
- No Warranty
-
-The Software and this license document are provided AS IS with NO WARRANTY
-OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE.
-
-
-=========================================================================== \ No newline at end of file
diff --git a/Zend/Makefile.am b/Zend/Makefile.am
deleted file mode 100644
index de43d27348..0000000000
--- a/Zend/Makefile.am
+++ /dev/null
@@ -1,26 +0,0 @@
-## Process this file with automake to produce Makefile.in -*- makefile -*-
-
-#CLEANFILES = zend-parser.c zend-parser.h zend-scanner.c zend-parser.output
-
-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.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 $(srcdir)/zend-scanner.l
-
-zend-scanner.cc: zend-scanner.l
- $(LEX) -+ -S$(srcdir)/flex.skl -Pzend -ozend-scanner.cc -i $(srcdir)/zend-scanner.l
-
-zend-parser.h: zend-parser.c
-zend-parser.c: zend-parser.y
- $(YACC) -p zend -v -d $(srcdir)/zend-parser.y -o zend-parser.c
-
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
deleted file mode 100644
index 0c144e2d5c..0000000000
--- a/Zend/ZEND_CHANGES
+++ /dev/null
@@ -1,111 +0,0 @@
-Improvements
-------------
-
-Zend was designed from the ground up for increased speed,
-reduced memory consumption and more reliable execution. We dare
-say it meets all of these goals and does so pretty well. Beyond
-that, there are several improvements in the language engine
-features:
-
-* References support. $foo = &$a; would make $foo and $a be two
- names to the same variable. This works with arrays as well,
- on either side; e.g., $foo = &$a[7]; would make $foo and $a[7]
- be two names to the same variable. Changing one would change
- the other and vice versa.
-* Object overloading support. This feature allows various OO
- libraries to use the OO notation of PHP to access their
- functionality. Right now, no use is made of that feature,
- but we'd have a COM module ready by the time PHP 4.0 is released.
- A CORBA module would probably follow.
-* include() and eval() are now functions, and not statements.
- That means they return a value. The default return value from
- include() and eval() is 1, so that you can do if (include())
- without further coding. The return value may be changed by
- returning a value from the global scope of the included file
- or the evaluated string. For example, if 'return 7;' is executed
- in the global scope of foo.inc, include("foo.inc") would evaluate
- to 7.
-* Automatic resource deallocation. Several people have been bitten
- by the fact that PHP 3.0 had no concept of reference counting.
- Zend adds full reference counting for every value in the system,
- including resources. As soon as a resource is no longer referenced
- from any variable, it is automatically destroyed to save memory
- and resources. The most obvious example for the advantage in this
- is a loop that has an SQL query inside it, something like
- '$result = sql_query(...);'. In PHP 3.0, every iteration resulted
- in another SQL result-set allocated in the memory, and all of the
- result sets weren't destroyed until the end of the script's execution.
- In Zend, as soon as we overwrite an old result set with a new one,
- the old result set which is no longer referenced, is destroyed.
-* Full support for nesting arrays and objects within each other, in
- as many levels as you want.
-* Boolean type. true and false are now constants of type boolean.
- Comparing any other value to them would convert that value to a
- boolean first, and conduct the comparison later. That means, for
- example, that 5==true would evaluate to true (in PHP 3.0, true
- was nothing but a constant for the integer value of 1, so 5==true
- was identical to 5==1, which was false).
-* Runtime binding of function names. This complex name has a simple
- explanation - you can now call functions before they're declared!
-* Added here-docs support.
-* Added foreach. Two syntaxes supported:
- foreach(array_expr as $val) statement
- foreach(array_expr as $key => $val) statement
-* A true unset() implementation. A variable or element that is unset(), is now
- sent to oblivion in its entirely, no trace remains from it.
-* Output buffering support! Use ob_start() to begin output buffering, ob_end_flush()
- to end buffering and send out the buffered contents, ob_end_clean() to end buffering
- without sending the buffered contents, and ob_get_contents() to retreive the current
- contents of the output buffer.
- Header information (header(), content type, cookies) are not buffered. By turning
- on output buffering, you can effectively send header information all throughout your
- file, regardless of whether you've emitted body output or not.
-* Full variable reference within quoted strings:
- ${expr} - full indirect reference support for scalar variables
- {variable} - full variable support
- For example:
- $foo[5]["bar"] = "foobar";
- print "{$foo[5]["bar"]}"; // would print "foobar"
-* Ability to call member functions of other classes from within member functions or from
- the global scope. You can now, for example, override a parent function with a child function,
- and call the parent function from it.
-* Runtime information for classes (class name, parent, available functions, etc.).
-* Much more efficient syntax highlighter - runs much quicker, performs more reliably, and
- generates much tighter HTML.
-* A full-featured debugger has been integrated with the language (supports breakpoints,
- expression evaluation, step-in/over, function call backtrace, and more).
-
-
-Incompatabilities
------------------
-
-Zend claims 100% compatability with the engine of PHP 3.0, and is
-shamelessly lying about it. Here's why:
-
-* static variable initializers only accept scalar values
- (in PHP 3.0 they accepted any valid expression). The impact
- should be somewhere in between void and non existant, since
- initializing a static variable with anything but a simple
- static value makes no sense at all.
-
-* The scope of break and continue is local to that of an
- include()'d file or an eval()'d string. The impact should
- be somewhat smaller of the one above.
-
-* return statement from a require()'d file no longer works. It
- hardly worked in PHP 3.0, so the impact should be fairly small.
- If you want this functionality - use include() instead.
-
-* unset() is no longer a function, but a statement. It was never
- documented as a function so the impact should be no bigger than
- nada.
-
-* The following letter combination is not supported within encapsulated
- strings: "{$". If you have a string that includes this letter
- combination, for example, print "{$somevar"; (which printed the
- letter { and the contents of the variable $somevar in PHP 3.0),
- it will result in a parse error under Zend. In this case, you
- would have to change the code to print "\{$somevar";
- This incompatability is due to the full variable reference
- within quoted strings feature added in Zend.
-
diff --git a/Zend/ZendCore.dep b/Zend/ZendCore.dep
deleted file mode 100644
index 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 7a80526f55..0000000000
--- a/Zend/acconfig.h
+++ /dev/null
@@ -1,50 +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 T_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
-
-/* Define to compile Zend thread safe */
-#undef ZTS
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 deb6aedb79..0000000000
--- a/Zend/buildconf
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-mv aclocal.m4 aclocal.m4.old 2>/dev/null
-aclocal
-if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}aclocal.m4"
- mv aclocal.m4.old aclocal.m4
-else
- echo "buildconf: created or modified ${1}aclocal.m4"
-fi
-
-autoheader
-
-automake --add-missing --include-deps
-
-mv configure configure.old 2>/dev/null
-autoconf
-if cmp configure.old configure > /dev/null 2>&1; then
- echo "buildconf: keeping ${1}configure"
- mv configure.old configure
-else
- echo "buildconf: created or modified ${1}configure"
-fi
-
diff --git a/Zend/config.unix.h b/Zend/config.unix.h
deleted file mode 100644
index 149d75f018..0000000000
--- a/Zend/config.unix.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-#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 DL_HANDLE void *
-# 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 6fe160e72a..0000000000
--- a/Zend/config.w32.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#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
-
-#define HAVE_KILL 0
-#define HAVE_GETPID 1
-
-#ifdef inline
-#undef inline
-#endif
-
-#define zend_sprintf sprintf
-
-/* Visual C++ doesn't really work with inline for C */
-#define inline
-
-
-#define DL_LOAD(libname) LoadLibrary(libname)
-#define DL_FETCH_SYMBOL GetProcAddress
-#define DL_UNLOAD FreeLibrary
-#define DL_HANDLE HMODULE
-#define ZEND_EXTENSIONS_SUPPORT 1
-
-#ifdef LIBZEND_EXPORTS
-# define ZEND_API __declspec(dllexport)
-#else
-# define ZEND_API __declspec(dllimport)
-#endif
-
-#endif /* _ZEND_CONFIG_W32_H */
diff --git a/Zend/configure.in b/Zend/configure.in
deleted file mode 100644
index dc3739e7b9..0000000000
--- a/Zend/configure.in
+++ /dev/null
@@ -1,154 +0,0 @@
-dnl $Id$
-dnl Process this file with autoconf to produce a configure script.
-
-AC_INIT(zend.c)
-AM_INIT_AUTOMAKE(zend, 0.80A)
-AM_CONFIG_HEADER(zend_config.h)
-AM_SANITY_CHECK
-AM_MAINTAINER_MODE
-ZEND_VERSION=$VERSION
-
-dnl We want this one before the checks, so the checks can modify CFLAGS.
-test -z "$CFLAGS" && auto_cflags=1
-
-dnl Checks for programs.
-AC_PROG_YACC
-if test "$YACC" != "bison -y"; then
- AC_MSG_WARN(You will need bison if you want to regenerate the Zend parser.)
-else
- AC_MSG_CHECKING(bison version)
- set `bison --version| sed -e 's/^GNU Bison version //' -e 's/\./ /'`
- if test "$1" = "1" -a "$2" -lt "25"; then
- AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the Zend parser (found $1.$2).)
- fi
- AC_MSG_RESULT($1.$2 (ok))
-fi
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_PROG_CC_C_O
-AM_PROG_LEX
-
-dnl Hack to work around a Mac OS X cpp problem
-dnl Known versions needing this workaround are 5.3 and 5.4
-if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then
- CPPFLAGS="$CPPFLAGS -traditional-cpp"
-fi
-
-dnl Ugly hack to get around a problem with gcc on AIX.
-if test "$CC" = "gcc" -a "$ac_cv_prog_cc_g" = "yes" -a \
- "`uname -sv`" = "AIX 4"; then
- CFLAGS=`echo $CFLAGS | sed -e 's/-g//'`
-fi
-
-dnl
-dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary
-dnl and source packages. This should be harmless on other OSs.
-dnl
-if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then
- CFLAGS="$CFLAGS -I/usr/pkg/include"
- LDFLAGS="$LDFLAGS -L/usr/pkg/lib"
-fi
-
-AC_CHECK_LIB(c, dlopen, [
- # fake it
- AC_DEFINE(HAVE_LIBDL) ], [
- AC_CHECK_LIB(dl, dlopen, [
- LIBS="-ldl $LIBS"
- AC_DEFINE(HAVE_LIBDL) ], []) ])
-
-dnl 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 )
-
-AC_CHECK_SIZEOF(void *, 4)
-
-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 getpid kill)
-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,
-[ --disable-debug Compile without debugging symbols],
-[
- if test "$enableval" = "yes"; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(ZEND_DEBUG,1)
- DEBUG_CFLAGS="-g"
- test -n "$GCC" && DEBUG_CFLAGS="$DEBUG_CFLAGS -Wall"
- test -n "$GCC" && test "$USE_MAINTAINER_MODE" = "yes" && \
- DEBUG_CFLAGS="$DEBUG_CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations"
- else
- AC_MSG_RESULT(no)
- AC_DEFINE(ZEND_DEBUG,0)
- DEBUG_CFLAGS=""
- fi
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(ZEND_DEBUG,1)
- DEBUG_CFLAGS="-g"
-])
-AC_SUBST(DEBUG_CFLAGS)
-CFLAGS="$CFLAGS $DEBUG_CFLAGS"
-
-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 build Zend thread-safe)
-AC_ARG_ENABLE(thread-safety,
-[ --enable-thread-safety Whether to build Zend thread-safe.],[
- AC_DEFINE(ZTS)
- AC_MSG_RESULT(yes)
-],[
- AC_MSG_RESULT(no)
-])
-AC_SUBST(TSRM_DIR)
-AC_SUBST(TSRM_LIB)
-
-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/flex.skl b/Zend/flex.skl
deleted file mode 100644
index 7c87706948..0000000000
--- a/Zend/flex.skl
+++ /dev/null
@@ -1,1541 +0,0 @@
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header$
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-%-
-#include <stdio.h>
-%*
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-%+
-class istream;
-%*
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-%-
-extern FILE *yyin, *yyout;
-%*
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
-%-
- FILE *yy_input_file;
-%+
- istream* yy_input_file;
-%*
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-%- Standard (non-C++) definition
-static YY_BUFFER_STATE yy_current_buffer = 0;
-%*
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-%- Standard (non-C++) definition
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-%*
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-%% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
-
-%- Standard (non-C++) definition
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-%*
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
-%% code to fiddle yytext and yyleng for yymore() goes here
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
-%% code to copy yytext_ptr to yytext[] goes here, if %array
- yy_c_buf_p = yy_cp;
-
-%% data tables for the DFA and the user's section 1 definitions go here
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-%-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-%*
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-%- Standard (non-C++) definition
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-%*
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-%- Standard (non-C++) definition
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-%+ C++ definition
-#define ECHO LexerOutput( yytext, yyleng )
-%*
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-%% fread()/read() definition of YY_INPUT goes here unless we're doing C++
-%+ C++ definition
- if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-%*
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-%-
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-%+
-#define YY_FATAL_ERROR(msg) LexerError( msg )
-%*
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-%- Standard (non-C++) definition
-#define YY_DECL int yylex YY_PROTO(( void ))
-%+ C++ definition
-#define YY_DECL int yyFlexLexer::yylex()
-%*
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-%% YY_RULE_SETUP definition goes here
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
-
-%% user's declarations go here
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
-%-
- yyin = stdin;
-%+
- yyin = &cin;
-%*
-
- if ( ! yyout )
-%-
- yyout = stdout;
-%+
- yyout = &cout;
-%*
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
-%% yymore()-related code goes here
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
-%% code to set up and find next match goes here
-
-yy_find_action:
-%% code to find the action number goes here
-
- YY_DO_BEFORE_ACTION;
-
-%% code for yylineno update goes here
-
-do_action: /* This label is used only to access EOF actions. */
-
-%% debug code goes here
-
- switch ( yy_act )
- { /* beginning of action switch */
-%% actions go here
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
-%% code to do back-up for compressed tables and set up yy_cp goes here
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-%+
-yyFlexLexer::yyFlexLexer( istream* arg_yyin, ostream* arg_yyout )
- {
- yyin = arg_yyin;
- yyout = arg_yyout;
- yy_c_buf_p = 0;
- yy_init = 1;
- yy_start = 0;
- yy_flex_debug = 0;
- yylineno = 1; // this will only get updated if %option yylineno
-
- yy_did_buffer_switch_on_eof = 0;
-
- yy_looking_for_trail_begin = 0;
- yy_more_flag = 0;
- yy_more_len = 0;
- yy_more_offset = yy_prev_more_offset = 0;
-
- yy_start_stack_ptr = yy_start_stack_depth = 0;
- yy_start_stack = 0;
-
- yy_current_buffer = 0;
-
-#ifdef YY_USES_REJECT
- yy_state_buf = new yy_state_type[YY_BUF_SIZE + 2];
-#else
- yy_state_buf = 0;
-#endif
- }
-
-yyFlexLexer::~yyFlexLexer()
- {
- delete yy_state_buf;
- yy_delete_buffer( yy_current_buffer );
- }
-
-void yyFlexLexer::switch_streams( istream* new_in, ostream* new_out )
- {
- if ( new_in )
- {
- yy_delete_buffer( yy_current_buffer );
- yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
- }
-
- if ( new_out )
- yyout = new_out;
- }
-
-#ifdef YY_INTERACTIVE
-int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
-#else
-int yyFlexLexer::LexerInput( char* buf, int max_size )
-#endif
- {
- if ( yyin->eof() || yyin->fail() )
- return 0;
-
-#ifdef YY_INTERACTIVE
- yyin->get( buf[0] );
-
- if ( yyin->eof() )
- return 0;
-
- if ( yyin->bad() )
- return -1;
-
- return 1;
-
-#else
- (void) yyin->read( buf, max_size );
-
- if ( yyin->bad() )
- return -1;
- else
- return yyin->gcount();
-#endif
- }
-
-void yyFlexLexer::LexerOutput( const char* buf, int size )
- {
- (void) yyout->write( buf, size );
- }
-%*
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-%-
-static int yy_get_next_buffer()
-%+
-int yyFlexLexer::yy_get_next_buffer()
-%*
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-%-
-static yy_state_type yy_get_previous_state()
-%+
-yy_state_type yyFlexLexer::yy_get_previous_state()
-%*
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
-%% code to get the start state into yy_current_state goes here
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
-%% code to find the next state goes here
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-%-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
-%+
-yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
-%*
- {
- register int yy_is_jam;
-%% code to find the next state, and perhaps do backing up, goes here
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-%-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
-%+
-void yyFlexLexer::yyunput( int c, register char* yy_bp )
-%*
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-%% update yylineno here
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-%-
-#endif /* ifndef YY_NO_UNPUT */
-%*
-
-
-%-
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
-%+
-int yyFlexLexer::yyinput()
-%*
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-%% update BOL and yylineno
-
- return c;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
-%+
-void yyFlexLexer::yyrestart( istream* input_file )
-%*
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
-%+
-void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-%*
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
-%+
-void yyFlexLexer::yy_load_buffer_state()
-%*
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
-%+
-YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
-%*
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-%+
-void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
-%*
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-%-
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-%+
-extern "C" int isatty YY_PROTO(( int ));
-void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
-%*
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-%-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
-%+
- b->yy_is_interactive = 0;
-%*
- }
-
-
-%-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
-%+
-void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
-%*
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-%*
-
-
-#ifndef YY_NO_SCAN_BUFFER
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-%*
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-%-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-%*
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-%-
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
-%+
-void yyFlexLexer::yy_push_state( int new_state )
-%*
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-%-
-static void yy_pop_state()
-%+
-void yyFlexLexer::yy_pop_state()
-%*
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-%-
-static int yy_top_state()
-%+
-int yyFlexLexer::yy_top_state()
-%*
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-%-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-%+
-
-void yyFlexLexer::LexerError( yyconst char msg[] )
- {
- cerr << msg << '\n';
- exit( YY_EXIT_FAILURE );
- }
-%*
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
diff --git a/Zend/libzend.dsp b/Zend/libzend.dsp
deleted file mode 100644
index 34157e7a10..0000000000
--- a/Zend/libzend.dsp
+++ /dev/null
@@ -1,363 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libzend" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libzend - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libzend.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libzend.mak" CFG="libzend - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libzend - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "libzend - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libzend - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug"
-# ADD RSC /l 0x40d /d "NDebug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libzend - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug"
-# ADD RSC /l 0x40d /d "_Debug"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "libzend - Win32 Release"
-# Name "libzend - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\zend-parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-scanner.c"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_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=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_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"
-
-# Begin Custom Build
-InputPath=".\zend-scanner.l"
-
-"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend-scanner.c zend-scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "libzend - Win32 Debug"
-
-# Begin Custom Build
-InputPath=".\zend-scanner.l"
-
-"zend-scanner.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -i -Pzend -ozend-scanner.c zend-scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_TODO
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/libzendts.dsp b/Zend/libzendts.dsp
deleted file mode 100644
index c3a0fcf3f3..0000000000
--- a/Zend/libzendts.dsp
+++ /dev/null
@@ -1,363 +0,0 @@
-# Microsoft Developer Studio Project File - Name="libzendts" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=libzendts - Win32 Debug_TS
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "libzendts.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "libzendts.mak" CFG="libzendts - Win32 Debug_TS"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "libzendts - Win32 Release_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE "libzendts - Win32 Debug_TS" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "libzendts - Win32 Release_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Release_TS"
-# PROP BASE Intermediate_Dir "Release_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Release_TS"
-# PROP Intermediate_Dir "Release_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDebug_TS" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /D "NDebug_TS" /D "_LIB" /D "TSRM_EXPORTS" /D "LIBZEND_EXPORTS" /D "ZTS" /D "WIN32" /D "_MBCS" /D ZEND_DEBUG=0 /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x40d /d "NDebug_TS"
-# ADD RSC /l 0x40d /d "NDebug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Output_Dir "Debug_TS"
-# PROP BASE Intermediate_Dir "Debug_TS"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Output_Dir "Debug_TS"
-# PROP Intermediate_Dir "Debug_TS"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_Debug_TS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /D "_Debug_TS" /D "_LIB" /D "LIBZEND_EXPORTS" /D "TSRM_EXPORTS" /D "WIN32" /D "_MBCS" /D "ZTS" /D ZEND_DEBUG=1 /FR /YX /FD /GZ /c
-# ADD BASE RSC /l 0x40d /d "_Debug_TS"
-# ADD RSC /l 0x40d /d "_Debug_TS"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
-
-!ENDIF
-
-# Begin Target
-
-# Name "libzendts - Win32 Release_TS"
-# Name "libzendts - Win32 Debug_TS"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=".\zend-parser.c"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-scanner.cpp"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.c
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_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=.\FlexLexer.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\modules.h
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-parser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=".\zend-scanner.h"
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_alloc.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_API.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\zend_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)" == "libzendts - Win32 Release_TS"
-
-# 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)" == "libzendts - Win32 Debug_TS"
-
-# 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)" == "libzendts - Win32 Release_TS"
-
-# Begin Custom Build
-InputPath=".\zend-scanner.l"
-
-"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -+ -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "libzendts - Win32 Debug_TS"
-
-# Begin Custom Build
-InputPath=".\zend-scanner.l"
-
-"zend-scanner.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- flex -+ -i -Sflex.skl -Pzend -ozend-scanner.cpp zend-scanner.l
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# End Group
-# Begin Group "Text Files"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\LICENSE
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_BUGS
-# End Source File
-# Begin Source File
-
-SOURCE=.\ZEND_CHANGES
-# End Source File
-# End Group
-# Begin Group "Resources"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\zend.ico
-# End Source File
-# End Group
-# End Target
-# End Project
diff --git a/Zend/zend-parser.y b/Zend/zend-parser.y
deleted file mode 100644
index f0c853d2af..0000000000
--- a/Zend/zend-parser.y
+++ /dev/null
@@ -1,658 +0,0 @@
-%{
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 T_INCLUDE T_EVAL
-%left ','
-%left T_LOGICAL_OR
-%left T_LOGICAL_XOR
-%left T_LOGICAL_AND
-%right T_PRINT
-%left '=' T_PLUS_EQUAL T_MINUS_EQUAL T_MUL_EQUAL T_DIV_EQUAL T_CONCAT_EQUAL T_MOD_EQUAL T_AND_EQUAL T_OR_EQUAL XT_OR_EQUAL T_SL_EQUAL T_SR_EQUAL
-%left '?' ':'
-%left T_BOOLEAN_OR
-%left T_BOOLEAN_AND
-%left '|'
-%left '^'
-%left '&'
-%nonassoc T_IS_EQUAL T_IS_NOT_EQUAL
-%nonassoc '<' T_IS_SMALLER_OR_EQUAL '>' T_IS_GREATER_OR_EQUAL
-%left T_SL T_SR
-%left '+' '-' '.'
-%left '*' '/' '%'
-%right '!' '~' T_INC T_DEC T_INT_CAST T_DOUBLE_CAST T_STRING_CAST T_ARRAY_CAST T_OBJECT_CAST T_BOOL_CAST '@'
-%right '['
-%nonassoc T_NEW
-%token T_EXIT
-%token T_IF
-%left T_ELSEIF
-%left T_ELSE
-%left T_ENDIF
-%token T_LNUMBER
-%token T_DNUMBER
-%token T_STRING
-%token T_STRING_VARNAME
-%token T_VARIABLE
-%token T_NUM_STRING
-%token T_INLINE_HTML
-%token T_CHARACTER
-%token T_BAD_CHARACTER
-%token T_ENCAPSED_AND_WHITESPACE
-%token T_CONSTANT_ENCAPSED_STRING
-%token T_ECHO
-%token T_DO
-%token T_WHILE
-%token T_ENDWHILE
-%token T_FOR
-%token T_ENDFOR
-%token T_FOREACH
-%token T_ENDFOREACH
-%token T_AS
-%token T_SWITCH
-%token T_ENDSWITCH
-%token T_CASE
-%token T_DEFAULT
-%token T_BREAK
-%token T_CONTINUE
-%token T_OLD_FUNCTION
-%token T_FUNCTION
-%token T_CONST
-%token T_RETURN
-%token T_REQUIRE
-%token T_GLOBAL
-%token T_STATIC
-%token T_VAR
-%token T_UNSET
-%token T_ISSET
-%token T_EMPTY
-%token T_CLASS
-%token T_EXTENDS
-%token T_OBJECT_OPERATOR
-%token T_DOUBLE_ARROW
-%token T_LIST
-%token T_ARRAY
-%token T_LINE
-%token T_FILE
-%token T_COMMENT
-%token T_ML_COMMENT
-%token T_OPEN_TAG
-%token T_OPEN_TAG_WITH_ECHO
-%token T_CLOSE_TAG
-%token T_WHITESPACE
-%token T_HEREDOC
-%token T_DOLLAR_OPEN_CURLY_BRACES
-%token T_CURLY_OPEN
-%token T_PAAMAYIM_NEKUDOTAYIM
-%token T_PHP_TRACK_VARS
-
-%% /* Rules */
-
-top_statement_list:
- top_statement_list { do_extended_info(CLS_C); } top_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-top_statement:
- statement
- | declaration_statement { do_early_binding(CLS_C); }
-;
-
-
-inner_statement_list:
- inner_statement_list { do_extended_info(CLS_C); } inner_statement { ELS_FETCH(); HANDLE_INTERACTIVE(); }
- | /* empty */
-;
-
-
-inner_statement:
- statement
- | declaration_statement
-;
-
-
-statement:
- '{' inner_statement_list '}'
- | T_IF '(' expr ')' { do_if_cond(&$3, &$4 CLS_CC); } statement { do_if_after_statement(&$4, 1 CLS_CC); } elseif_list else_single { do_if_end(CLS_C); }
- | T_IF '(' expr ')' ':' { do_if_cond(&$3, &$4 CLS_CC); } inner_statement_list { do_if_after_statement(&$4, 1 CLS_CC); } new_elseif_list new_else_single T_ENDIF ';' { do_if_end(CLS_C); }
- | T_WHILE '(' { $1.u.opline_num = get_next_op_number(CG(active_op_array)); } expr ')' { do_while_cond(&$4, &$5 CLS_CC); } while_statement { do_while_end(&$1, &$5 CLS_CC); }
- | T_DO { $1.u.opline_num = get_next_op_number(CG(active_op_array)); do_do_while_begin(CLS_C); } statement T_WHILE '(' expr ')' ';' { do_do_while_end(&$1, &$6 CLS_CC); }
- | T_FOR
- '('
- for_expr
- ';' { do_free(&$3 CLS_CC); $4.u.opline_num = get_next_op_number(CG(active_op_array)); }
- for_expr
- ';' { do_for_cond(&$6, &$7 CLS_CC); }
- for_expr
- ')' { do_free(&$9 CLS_CC); do_for_before_statement(&$4, &$7 CLS_CC); }
- for_statement { do_for_end(&$7 CLS_CC); }
- | T_SWITCH '(' expr ')' { do_switch_cond(&$3 CLS_CC); } switch_case_list { do_switch_end(&$6 CLS_CC); }
- | T_BREAK ';' { do_brk_cont(ZEND_BRK, NULL CLS_CC); }
- | T_BREAK expr ';' { do_brk_cont(ZEND_BRK, &$2 CLS_CC); }
- | T_CONTINUE ';' { do_brk_cont(ZEND_CONT, NULL CLS_CC); }
- | T_CONTINUE expr ';' { do_brk_cont(ZEND_CONT, &$2 CLS_CC); }
- | T_RETURN ';' { do_return(NULL CLS_CC); }
- | T_RETURN expr ';' { do_return(&$2 CLS_CC); }
- | T_GLOBAL global_var_list
- | T_STATIC static_var_list
- | T_ECHO echo_expr_list ';'
- | T_INLINE_HTML { do_echo(&$1 CLS_CC); }
- | expr ';' { do_free(&$1 CLS_CC); }
- | T_REQUIRE expr ';' { if ($2.op_type==IS_CONST && $2.u.constant.type==IS_STRING) { require_filename($2.u.constant.value.str.val CLS_CC); zval_dtor(&$2.u.constant); } else { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); } }
- | T_UNSET '(' r_cvar ')' ';' { do_unset(&$3 CLS_CC); }
- | T_FOREACH '(' expr T_AS { do_foreach_begin(&$1, &$3, &$2, &$4 CLS_CC); } w_cvar foreach_optional_arg ')' { do_foreach_cont(&$6, &$7, &$4 CLS_CC); } foreach_statement { do_foreach_end(&$1, &$2 CLS_CC); }
- | ';' /* empty statement */
-;
-
-
-declaration_statement:
- T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
- '(' parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
- | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 0 CLS_CC); }
- parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
- | T_CLASS T_STRING { do_begin_class_declaration(&$2, NULL CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
- | T_CLASS T_STRING T_EXTENDS T_STRING { do_begin_class_declaration(&$2, &$4 CLS_CC); } '{' class_statement_list '}' { do_end_class_declaration(CLS_C); }
-;
-
-
-foreach_optional_arg:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | T_DOUBLE_ARROW w_cvar { $$ = $2; }
-;
-
-
-for_statement:
- statement
- | ':' inner_statement_list T_ENDFOR ';'
-;
-
-
-foreach_statement:
- statement
- | ':' inner_statement_list T_ENDFOREACH ';'
-;
-
-
-switch_case_list:
- '{' case_list '}' { $$ = $2; }
- | '{' ';' case_list '}' { $$ = $3; }
- | ':' case_list T_ENDSWITCH ';' { $$ = $2; }
- | ':' ';' case_list T_ENDSWITCH ';' { $$ = $3; }
-;
-
-
-case_list:
- /* empty */ { $$.u.opline_num = -1; }
- | case_list T_CASE expr case_separator { do_case_before_statement(&$1, &$2, &$3 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
- | case_list T_DEFAULT case_separator { do_default_before_statement(&$1, &$2 CLS_CC); } inner_statement_list { do_case_after_statement(&$$, &$2 CLS_CC); }
-;
-
-
-case_separator:
- ':'
- | ';'
-;
-
-
-while_statement:
- statement
- | ':' inner_statement_list T_ENDWHILE ';'
-;
-
-
-
-elseif_list:
- /* empty */
- | elseif_list T_ELSEIF '(' expr ')' { do_if_cond(&$4, &$5 CLS_CC); } statement { do_if_after_statement(&$5, 0 CLS_CC); }
-;
-
-
-new_elseif_list:
- /* empty */
- | new_elseif_list T_ELSEIF '(' expr ')' ':' { do_if_cond(&$4, &$5 CLS_CC); } inner_statement_list { do_if_after_statement(&$5, 0 CLS_CC); }
-;
-
-
-else_single:
- /* empty */
- | T_ELSE statement
-;
-
-
-new_else_single:
- /* empty */
- | T_ELSE ':' inner_statement_list
-;
-
-
-
-
-parameter_list:
- non_empty_parameter_list
- | /* empty */
-;
-
-
-non_empty_parameter_list:
- T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
- | T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$2, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$3, BYREF_NONE CLS_CC); }
- | T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$1, 0 CLS_CC); $$.op_type = IS_CONST; $$.u.constant.value.lval=1; $$.u.constant.type=IS_LONG; INIT_PZVAL(&$$.u.constant); do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | non_empty_parameter_list ',' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | non_empty_parameter_list ',' '&' T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_FORCE CLS_CC); }
- | non_empty_parameter_list ',' T_CONST T_VARIABLE { znode tmp; fetch_simple_variable(&tmp, &$4, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
- | non_empty_parameter_list ',' T_VARIABLE '=' static_scalar { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, &$5, BYREF_NONE CLS_CC); }
- | non_empty_parameter_list ',' T_VARIABLE '=' T_UNSET { znode tmp; fetch_simple_variable(&tmp, &$3, 0 CLS_CC); $$=$1; $$.u.constant.value.lval++; do_receive_arg(ZEND_RECV_INIT, &tmp, &$$, NULL, BYREF_NONE CLS_CC); }
-;
-
-
-function_call_parameter_list:
- non_empty_function_call_parameter_list { $$ = $1; }
- | /* empty */ { $$.u.constant.value.lval = 0; }
-;
-
-
-non_empty_function_call_parameter_list:
- expr_without_variable { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); }
- | cvar { $$.u.constant.value.lval = 1; do_pass_param(&$1, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); }
- | '&' w_cvar { $$.u.constant.value.lval = 1; do_pass_param(&$2, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); }
- | non_empty_function_call_parameter_list ',' expr_without_variable { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAL, $$.u.constant.value.lval CLS_CC); }
- | non_empty_function_call_parameter_list ',' cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$3, ZEND_SEND_VAR, $$.u.constant.value.lval CLS_CC); }
- | non_empty_function_call_parameter_list ',' '&' w_cvar { $$.u.constant.value.lval=$1.u.constant.value.lval+1; do_pass_param(&$4, ZEND_SEND_REF, $$.u.constant.value.lval CLS_CC); }
-;
-
-global_var_list:
- global_var_list ',' global_var { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_GLOBAL CLS_CC); }
- | global_var { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_GLOBAL CLS_CC); }
-;
-
-
-global_var:
- T_VARIABLE { $$ = $1; }
- | '$' r_cvar { $$ = $2; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-static_var_list:
- static_var_list ',' T_VARIABLE { do_fetch_global_or_static_variable(&$3, NULL, ZEND_FETCH_STATIC CLS_CC); }
- | static_var_list ',' T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$3, &$5, ZEND_FETCH_STATIC CLS_CC); }
- | T_VARIABLE { do_fetch_global_or_static_variable(&$1, NULL, ZEND_FETCH_STATIC CLS_CC); }
- | T_VARIABLE '=' static_scalar { do_fetch_global_or_static_variable(&$1, &$3, ZEND_FETCH_STATIC CLS_CC); }
-
-;
-
-
-class_statement_list:
- class_statement_list class_statement
- | /* empty */
-;
-
-
-class_statement:
- T_VAR class_variable_decleration ';'
- | T_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); } '('
- parameter_list ')' '{' inner_statement_list '}' { do_end_function_declaration(&$1 CLS_CC); }
- | T_OLD_FUNCTION { $1.u.opline_num = CG(zend_lineno); } T_STRING { do_begin_function_declaration(&$1, &$3, 1 CLS_CC); }
- parameter_list '(' inner_statement_list ')' ';' { do_end_function_declaration(&$1 CLS_CC); }
-
-;
-
-
-class_variable_decleration:
- class_variable_decleration ',' T_VARIABLE { do_declare_property(&$3, NULL CLS_CC); }
- | class_variable_decleration ',' T_VARIABLE '=' static_scalar { do_declare_property(&$3, &$5 CLS_CC); }
- | T_VARIABLE { do_declare_property(&$1, NULL CLS_CC); }
- | T_VARIABLE '=' static_scalar { do_declare_property(&$1, &$3 CLS_CC); }
-;
-
-
-echo_expr_list:
- /* 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 ',' { do_free(&$1 CLS_CC); } expr { $$ = $4; }
- | expr { $$ = $1; }
-;
-
-
-expr_without_variable:
- T_LIST '(' { do_list_init(CLS_C); } assignment_list ')' '=' expr { do_list_end(&$$, &$7 CLS_CC); }
- | w_cvar '=' expr { do_assign(&$$, &$1, &$3 CLS_CC); }
- | w_cvar '=' '&' w_cvar { do_assign_ref(&$$, &$1, &$4 CLS_CC); }
- | w_cvar '=' T_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 T_PLUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_ADD, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_MINUS_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SUB, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_MUL_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MUL, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_DIV_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_DIV, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_CONCAT_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_CONCAT, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_MOD_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_MOD, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_AND_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_AND, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_OR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_OR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar XT_OR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_BW_XOR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_SL_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SL, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_SR_EQUAL expr { do_binary_assign_op(ZEND_ASSIGN_SR, &$$, &$1, &$3 CLS_CC); }
- | rw_cvar T_INC { do_post_incdec(&$$, &$1, ZEND_POST_INC CLS_CC); }
- | T_INC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_INC CLS_CC); }
- | rw_cvar T_DEC { do_post_incdec(&$$, &$1, ZEND_POST_DEC CLS_CC); }
- | T_DEC rw_cvar { do_pre_incdec(&$$, &$2, ZEND_PRE_DEC CLS_CC); }
- | expr T_BOOLEAN_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr T_BOOLEAN_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr T_LOGICAL_OR { do_boolean_or_begin(&$1, &$2 CLS_CC); } expr { do_boolean_or_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr T_LOGICAL_AND { do_boolean_and_begin(&$1, &$2 CLS_CC); } expr { do_boolean_and_end(&$$, &$1, &$4, &$2 CLS_CC); }
- | expr T_LOGICAL_XOR expr { do_binary_op(ZEND_BOOL_XOR, &$$, &$1, &$3 CLS_CC); }
- | expr '|' expr { do_binary_op(ZEND_BW_OR, &$$, &$1, &$3 CLS_CC); }
- | expr '&' expr { do_binary_op(ZEND_BW_AND, &$$, &$1, &$3 CLS_CC); }
- | expr '^' expr { do_binary_op(ZEND_BW_XOR, &$$, &$1, &$3 CLS_CC); }
- | expr '.' expr { do_binary_op(ZEND_CONCAT,&$$,&$1,&$3 CLS_CC); }
- | expr '+' expr { do_binary_op(ZEND_ADD,&$$,&$1,&$3 CLS_CC); }
- | expr '-' expr { do_binary_op(ZEND_SUB,&$$,&$1,&$3 CLS_CC); }
- | expr '*' expr { do_binary_op(ZEND_MUL,&$$,&$1,&$3 CLS_CC); }
- | expr '/' expr { do_binary_op(ZEND_DIV,&$$,&$1,&$3 CLS_CC); }
- | expr '%' expr { do_binary_op(ZEND_MOD,&$$,&$1,&$3 CLS_CC); }
- | expr T_SL expr { do_binary_op(ZEND_SL, &$$, &$1, &$3 CLS_CC); }
- | expr T_SR expr { do_binary_op(ZEND_SR, &$$, &$1, &$3 CLS_CC); }
- | '+' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_ADD, &$$, &$1, &$2 CLS_CC); }
- | '-' expr { $1.u.constant.value.lval=0; $1.u.constant.type=IS_LONG; $1.op_type = IS_CONST; INIT_PZVAL(&$1.u.constant); do_binary_op(ZEND_SUB, &$$, &$1, &$2 CLS_CC); }
- | '!' expr { do_unary_op(ZEND_BOOL_NOT, &$$, &$2 CLS_CC); }
- | '~' expr { do_unary_op(ZEND_BW_NOT, &$$, &$2 CLS_CC); }
- | expr T_IS_EQUAL expr { do_binary_op(ZEND_IS_EQUAL, &$$, &$1, &$3 CLS_CC); }
- | expr T_IS_NOT_EQUAL expr { do_binary_op(ZEND_IS_NOT_EQUAL, &$$, &$1, &$3 CLS_CC); }
- | expr '<' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$1, &$3 CLS_CC); }
- | expr T_IS_SMALLER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$1, &$3 CLS_CC); }
- | expr '>' expr { do_binary_op(ZEND_IS_SMALLER, &$$, &$3, &$1 CLS_CC); }
- | expr T_IS_GREATER_OR_EQUAL expr { do_binary_op(ZEND_IS_SMALLER_OR_EQUAL, &$$, &$3, &$1 CLS_CC); }
- | '(' expr ')' { $$ = $2; }
- | expr '?' { do_begin_qm_op(&$1, &$2 CLS_CC); }
- expr ':' { do_qm_true(&$4, &$2, &$5 CLS_CC); }
- expr { do_qm_false(&$$, &$7, &$2, &$5 CLS_CC); }
- | T_STRING '(' { do_extended_fcall_begin(CLS_C); 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);}
- | T_STRING T_PAAMAYIM_NEKUDOTAYIM T_STRING '(' { do_extended_fcall_begin(CLS_C); do_begin_class_member_function_call(&$1, &$3 CLS_CC); }
- function_call_parameter_list
- ')' { do_end_function_call(&$3, &$$, &$6, 1 CLS_CC); do_extended_fcall_end(CLS_C);}
- | internal_functions_in_yacc { $$ = $1; }
- | T_INT_CAST expr { do_cast(&$$, &$2, IS_LONG CLS_CC); }
- | T_DOUBLE_CAST expr { do_cast(&$$, &$2, IS_DOUBLE CLS_CC); }
- | T_STRING_CAST expr { do_cast(&$$, &$2, IS_STRING CLS_CC); }
- | T_ARRAY_CAST expr { do_cast(&$$, &$2, IS_ARRAY CLS_CC); }
- | T_OBJECT_CAST expr { do_cast(&$$, &$2, IS_OBJECT CLS_CC); }
- | T_BOOL_CAST expr { do_cast(&$$, &$2, IS_BOOL CLS_CC); }
- | T_EXIT exit_expr { do_exit(&$$, &$2 CLS_CC); }
- | '@' { do_begin_silence(&$1 CLS_CC); } expr { do_end_silence(&$1 CLS_CC); $$ = $3; }
- | scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '`' encaps_list '`' { do_shell_exec(&$$, &$2 CLS_CC); }
- | T_PRINT expr { do_print(&$$, &$2 CLS_CC); }
-;
-
-
-exit_expr:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | '(' ')' { $$.op_type = IS_UNUSED; }
- | '(' expr ')' { $$ = $2; }
-;
-
-
-ctor_arguments:
- /* empty */ { $$.u.constant.value.lval=0; }
- | '(' function_call_parameter_list ')' { $$ = $2; }
-;
-
-
-class_name:
- T_STRING { $$ = $1; }
- | r_cvar { $$ = $1; }
-;
-
-
-
-common_scalar:
- T_LNUMBER { $$=$1; }
- | T_DNUMBER { $$=$1; }
- | T_CONSTANT_ENCAPSED_STRING { $$ = $1; }
- | T_LINE { $$ = $1; }
- | T_FILE { $$ = $1; }
-;
-
-
-static_scalar: /* compile-time evaluated scalars */
- common_scalar { $$ = $1; }
- | T_STRING { do_fetch_constant(&$$, &$1, ZEND_CT CLS_CC); }
- | '+' static_scalar { $$ = $1; }
- | '-' static_scalar { zval minus_one; minus_one.type = IS_LONG; minus_one.value.lval = -1; mul_function(&$2.u.constant, &$2.u.constant, &minus_one); $$ = $2; }
- | T_ARRAY '(' static_array_pair_list ')' { $$ = $3; }
-;
-
-
-scalar:
- T_STRING { do_fetch_constant(&$$, &$1, ZEND_RT CLS_CC); }
- | T_STRING_VARNAME { $$ = $1; }
- | common_scalar { $$ = $1; }
- | '"' encaps_list '"' { $$ = $2; }
- | '\'' encaps_list '\'' { $$ = $2; }
- | T_HEREDOC encaps_list T_HEREDOC { $$ = $2; do_end_heredoc(CLS_C); }
-;
-
-
-static_array_pair_list:
- /* empty */ { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); }
- | non_empty_static_array_pair_list { $$ = $1; }
-;
-
-
-non_empty_static_array_pair_list:
- non_empty_static_array_pair_list ',' static_scalar T_DOUBLE_ARROW static_scalar { do_add_static_array_element(&$$, &$3, &$5); }
- | non_empty_static_array_pair_list ',' static_scalar { do_add_static_array_element(&$$, NULL, &$3); }
- | static_scalar T_DOUBLE_ARROW static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, &$1, &$3); }
- | static_scalar { $$.op_type = IS_CONST; INIT_PZVAL(&$$.u.constant); array_init(&$$.u.constant); do_add_static_array_element(&$$, NULL, &$1); }
-;
-
-expr:
- r_cvar { $$ = $1; }
- | expr_without_variable { $$ = $1; }
-;
-
-
-
-r_cvar:
- cvar { do_end_variable_parse(BP_VAR_R 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 T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } ref_list { $$ = $4; }
-;
-
-
-cvar_without_objects:
- reference_variable { $$ = $1; }
- | simple_indirect_reference reference_variable { do_indirect_references(&$$, &$1, &$2 CLS_CC); }
-;
-
-
-reference_variable:
- dim_list ']' { $$ = $1; }
- | compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
-;
-
-
-compound_variable:
- T_VARIABLE { $$ = $1; }
- | '$' '{' expr '}' { $$ = $3; }
-;
-
-
-dim_list:
- dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
- | compound_variable { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); } '[' dim_offset { fetch_array_begin(&$$, &$1, &$4 CLS_CC); }
-;
-
-
-dim_offset:
- /* empty */ { $$.op_type = IS_UNUSED; }
- | expr { $$ = $1; }
-;
-
-
-ref_list:
- object_property { $$ = $1; }
- | ref_list T_OBJECT_OPERATOR { do_push_object(&$1 CLS_CC); } object_property { $$ = $4; }
-;
-
-object_property:
- scalar_object_property { znode tmp_znode; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&$$, &tmp_znode, &$1 CLS_CC); }
- | object_dim_list ']' { $$ = $1; }
-;
-
-scalar_object_property:
- T_STRING { $$ = $1; }
- | '{' expr '}' { $$ = $2; }
- | cvar_without_objects { do_end_variable_parse(BP_VAR_R CLS_CC); $$ = $1; }
-;
-
-
-object_dim_list:
- object_dim_list ']' '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
- | T_STRING { znode tmp_znode, res; do_pop_object(&tmp_znode CLS_CC); do_fetch_property(&res, &tmp_znode, &$1 CLS_CC); $1 = res; } '[' dim_offset { fetch_array_dim(&$$, &$1, &$4 CLS_CC); }
-;
-
-
-simple_indirect_reference:
- '$' { $$.u.constant.value.lval = 1; }
- | simple_indirect_reference '$' { $$.u.constant.value.lval++; }
-;
-
-assignment_list:
- assignment_list ',' assignment_list_element
- | assignment_list_element
-;
-
-
-assignment_list_element:
- w_cvar { do_add_list_element(&$1 CLS_CC); }
- | T_LIST '(' { do_new_list_begin(CLS_C); } assignment_list ')' { do_new_list_end(CLS_C); }
- | /* empty */ { do_add_list_element(NULL CLS_CC); }
-;
-
-
-array_pair_list:
- /* empty */ { do_init_array(&$$, NULL, NULL CLS_CC); }
- | non_empty_array_pair_list { $$ = $1; }
-;
-
-non_empty_array_pair_list:
- non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { do_add_array_element(&$$, &$5, &$3 CLS_CC); }
- | non_empty_array_pair_list ',' expr { do_add_array_element(&$$, &$3, NULL CLS_CC); }
- | expr T_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 T_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list T_NUM_STRING { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list T_ENCAPSED_AND_WHITESPACE { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list T_CHARACTER { do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list T_BAD_CHARACTER { do_add_string(&$$, &$1, &$2 CLS_CC); }
- | encaps_list '[' { $2.u.constant.value.chval = '['; do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list ']' { $2.u.constant.value.chval = ']'; do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list '{' { $2.u.constant.value.chval = '{'; do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list '}' { $2.u.constant.value.chval = '}'; do_add_char(&$$, &$1, &$2 CLS_CC); }
- | encaps_list T_OBJECT_OPERATOR { znode tmp; $2.u.constant.value.chval = '-'; do_add_char(&tmp, &$1, &$2 CLS_CC); $2.u.constant.value.chval = '>'; do_add_char(&$$, &tmp, &$2 CLS_CC); }
- | /* empty */ { do_init_string(&$$ CLS_CC); }
-
-;
-
-
-
-encaps_var:
- T_VARIABLE { do_fetch_globals(&$1 CLS_CC); do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
- | T_VARIABLE '[' { do_begin_variable_parse(CLS_C); } encaps_var_offset ']' { do_fetch_globals(&$1 CLS_CC); fetch_array_begin(&$$, &$1, &$4 CLS_CC); }
- | T_VARIABLE T_OBJECT_OPERATOR T_STRING { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$2, &$1, 1 CLS_CC); do_fetch_property(&$$, &$2, &$3 CLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { do_begin_variable_parse(CLS_C); fetch_simple_variable(&$$, &$2, 1 CLS_CC); }
- | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { do_begin_variable_parse(CLS_C); fetch_array_begin(&$$, &$2, &$4 CLS_CC); }
- | T_CURLY_OPEN cvar '}' { $$ = $2; }
-;
-
-
-encaps_var_offset:
- T_STRING { $$ = $1; }
- | T_NUM_STRING { $$ = $1; }
- | T_VARIABLE { fetch_simple_variable(&$$, &$1, 1 CLS_CC); }
-;
-
-
-internal_functions_in_yacc:
- T_ISSET '(' cvar ')' { do_isset_or_isempty(ZEND_ISSET, &$$, &$3 CLS_CC); }
- | T_EMPTY '(' cvar ')' { do_isset_or_isempty(ZEND_ISEMPTY, &$$, &$3 CLS_CC); }
- | T_INCLUDE expr { do_include_or_eval(ZEND_INCLUDE, &$$, &$2 CLS_CC); }
- | T_EVAL '(' expr ')' { do_include_or_eval(ZEND_EVAL, &$$, &$3 CLS_CC); }
-;
-
-
-%%
-
diff --git a/Zend/zend-scanner.h b/Zend/zend-scanner.h
deleted file mode 100644
index 8b51d5d6ba..0000000000
--- a/Zend/zend-scanner.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _LANGUAGE_SCANNER_H
-#define _LANGUAGE_SCANNER_H
-
-#ifdef ZTS
-class ZendFlexLexer : public yyFlexLexer
-{
-public:
- virtual ~ZendFlexLexer();
- int lex_scan(zval *zendlval CLS_DC);
- void BeginState(int state);
-};
-
-#endif /* ZTS */
-
-
-#ifndef ZTS
-typedef struct _zend_lex_state {
- YY_BUFFER_STATE buffer_state;
- int state;
- uint return_offset;
- uint lineno;
- FILE *in;
- char *filename;
-} zend_lex_state;
-#else
-typedef struct _zend_lex_state {
- ZendFlexLexer *ZFL;
- istream *input_file;
-} zend_lex_state;
-#endif
-
-#endif
diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l
deleted file mode 100644
index 3973f8f4ed..0000000000
--- a/Zend/zend-scanner.l
+++ /dev/null
@@ -1,1485 +0,0 @@
-%{
-
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-%}
-
-%x ST_IN_SCRIPTING
-%x ST_DOUBLE_QUOTES
-%x ST_SINGLE_QUOTE
-%x ST_BACKQUOTE
-%x ST_HEREDOC
-%x ST_LOOKING_FOR_PROPERTY
-%x ST_LOOKING_FOR_VARNAME
-%x ST_COMMENT
-%option stack
-
-%{
-
-#if WIN32|WINNT
-#include <winsock.h>
-#include <io.h>
-#endif
-
-#include <errno.h>
-
-#ifdef ZTS
-#include <fstream.h>
-# if WIN32||WINNT
-# include <strstrea.h>
-# else
-# include <strstream.h>
-# endif
-#endif
-
-#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
-
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifdef ZTS
-#define YY_DECL int ZendFlexLexer::lex_scan(zval *zendlval CLS_DC)
-#else
-#define YY_DECL int lex_scan(zval *zendlval CLS_DC)
-#endif
-#define ECHO { ZEND_WRITE( yytext, yyleng ); }
-
-#ifdef ZTS
-# define MY_INPUT yyinput
-#else
-# define MY_INPUT input
-#endif
-
-#define YY_FATAL_ERROR zend_fatal_scanner_error
-
-#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)++; \
- } \
-}
-
-
-#define ZEND_IS_OCT(c) ((c)>='0' && (c)<'8')
-#define ZEND_IS_HEX(c) (((c)>='0' && (c)<='9') || ((c)>='a' && (c)<='f') || ((c)>='A' && (c)<='F'))
-
-
-void zend_fatal_scanner_error(char *message)
-{
- zend_error(E_COMPILE_ERROR, message);
-}
-
-BEGIN_EXTERN_C()
-void startup_scanner(CLS_D)
-{
- CG(heredoc) = NULL;
- CG(heredoc_len)=0;
-}
-
-
-void shutdown_scanner(CLS_D)
-{
- if (CG(heredoc)) {
- efree(CG(heredoc));
- CG(heredoc_len)=0;
- }
-}
-END_EXTERN_C()
-
-
-static inline void save_lexical_state(zend_lex_state *lex_state CLS_DC)
-{
-#ifndef ZTS
- memcpy(&lex_state->buffer_state,&YY_CURRENT_BUFFER,sizeof(YY_BUFFER_STATE));
- lex_state->in = yyin;
- lex_state->lineno = CG(zend_lineno);
- lex_state->state = YYSTATE;
- lex_state->filename = zend_get_compiled_filename();
-#else
- lex_state->ZFL = CG(ZFL);
-#endif
-}
-
-
-inline void restore_lexical_state(zend_lex_state *lex_state CLS_DC)
-{
-#ifndef ZTS
- YY_BUFFER_STATE original_buffer_state = YY_CURRENT_BUFFER;
-
- if (lex_state->buffer_state) {
- yy_switch_to_buffer(lex_state->buffer_state);
- } else {
- YY_CURRENT_BUFFER = NULL;
- }
-
- yy_delete_buffer(original_buffer_state);
- yyin = lex_state->in;
- CG(zend_lineno) = lex_state->lineno;
- BEGIN(lex_state->state);
- zend_restore_compiled_filename(lex_state->filename);
-#else
- delete((ZendFlexLexer *) CG(ZFL));
- CG(ZFL) = lex_state->ZFL;
-#endif
-}
-
-
-BEGIN_EXTERN_C()
-
-
-ZEND_API void zend_open_file_dtor(void *f)
-{
-#ifdef ZTS
- delete *((ifstream **) f);
-#else
- fclose(*((FILE **) f));
-#endif
-}
-
-
-ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC)
-{
-#ifdef ZTS
- zend_llist_del_element(&CG(open_files), &file_handle->handle.is);
-#else
- zend_llist_del_element(&CG(open_files), &file_handle->handle.fp);
-#endif
-}
-
-
-ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC)
-{
-#ifndef ZTS
- switch (file_handle->type) {
- case ZEND_HANDLE_FILENAME:
- file_handle->handle.fp = zend_fopen(file_handle->filename);
- break;
- case ZEND_HANDLE_FD:
- file_handle->handle.fp = fdopen(file_handle->handle.fd, "r");
- break;
- case ZEND_HANDLE_FP:
- file_handle->handle.fp = file_handle->handle.fp;
- break;
- }
- if (!file_handle->handle.fp) {
- return FAILURE;
- }
- if (file_handle->handle.fp != stdin) {
- zend_llist_add_element(&CG(open_files), &file_handle->handle.fp);
- }
- file_handle->type = ZEND_HANDLE_FP;
- /* Reset the scanner for scanning the new file */
- yyin = file_handle->handle.fp;
- yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- BEGIN(INITIAL);
-#else
- switch (file_handle->type) {
- case ZEND_HANDLE_FD:
- file_handle->handle.is = new ifstream(file_handle->handle.fd);
- break;
- case ZEND_HANDLE_FILENAME:
- file_handle->handle.is = new ifstream(file_handle->filename, ios::nocreate|ios::in|ios::binary);
- break;
- case ZEND_HANDLE_FP:
- if (file_handle->handle.fp==stdin) {
- file_handle->handle.is = (ifstream *) &cin;
- } else {
- fclose(file_handle->handle.fp);
- file_handle->handle.is = new ifstream(file_handle->filename, ios::nocreate|ios::in|ios::binary);
- }
- break;
- }
- if (file_handle->handle.is->fail()) {
- delete file_handle->handle.is;
- return FAILURE;
- }
- if (file_handle->handle.is != &cin) {
- zend_llist_add_element(&CG(open_files), &file_handle->handle.is);
- }
- file_handle->type = ZEND_HANDLE_ISTREAM;
-
- CG(ZFL) = new ZendFlexLexer;
- CG(ZFL)->switch_streams(file_handle->handle.is, &cout);
-#endif
- zend_set_compiled_filename(file_handle->filename);
- CG(zend_lineno) = 1;
- return SUCCESS;
-}
-END_EXTERN_C()
-
-
-ZEND_API zend_op_array *compile_files(int mark_as_ref CLS_DC, int file_count, ...)
-{
- va_list files;
- zend_op_array *op_array;
-
- va_start(files, file_count);
- op_array = v_compile_files(mark_as_ref CLS_CC, file_count, files);
- va_end(files);
- return op_array;
-}
-
-
-ZEND_API zend_op_array *v_compile_files(int mark_as_ref CLS_DC, int file_count, va_list files)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval=NULL;
- zend_file_handle *file_handle;
- int i;
- int compiler_result;
- int compiled_files=0;
-
- init_op_array(op_array, INITIAL_OP_ARRAY_SIZE);
- save_lexical_state(&original_lex_state CLS_CC);
-
- retval = op_array; /* success oriented */
- for (i=0; 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);
- } else {
- CG(active_op_array) = op_array;
- compiler_result = zendparse(CLS_C);
- zend_close_file_handle(file_handle CLS_CC);
- restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
- if (compiler_result==1) { /* parser error */
- CG(unclean_shutdown) = 1;
- retval = NULL;
- break;
- }
- compiled_files++;
- }
- }
-
- if (retval) {
- if (compiled_files>0) {
- pass_two(op_array);
- if (mark_as_ref) {
- pass_include_eval(op_array);
- }
- } else {
- destroy_op_array(op_array);
- efree(op_array);
- retval = NULL;
- }
- }
- return retval;
-}
-
-
-zend_op_array *compile_filename(zval *filename 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(1 CLS_CC, 1, &file_handle);
- if (filename==&tmp) {
- zval_dtor(&tmp);
- }
- return retval;
-}
-
-
-static inline int prepare_string_for_scanning(zval *str CLS_DC)
-{
-#ifndef ZTS
- /* enforce two trailing NULLs for flex... */
- str->value.str.val = (char *) erealloc(str->value.str.val,str->value.str.len+2);
-
- str->value.str.val[str->value.str.len+1]=0;
-
- yyin=NULL;
- yy_scan_buffer(str->value.str.val, str->value.str.len+2);
-#else
- istrstream *input_stream = new istrstream(str->value.str.val, str->value.str.len);
- CG(ZFL) = new ZendFlexLexer;
-
- CG(ZFL)->switch_streams(input_stream, &cout);
-#endif
- return SUCCESS;
-}
-
-
-zend_op_array *compile_string(zval *source_string CLS_DC)
-{
- zend_lex_state original_lex_state;
- zend_op_array *op_array = (zend_op_array *) emalloc(sizeof(zend_op_array));
- zend_op_array *original_active_op_array = CG(active_op_array);
- zend_op_array *retval;
- zval tmp;
- int compiler_result;
-
- if (source_string->value.str.len==0) {
- efree(op_array);
- return NULL;
- }
- tmp = *source_string;
- zval_copy_ctor(&tmp);
- convert_to_string(&tmp);
- source_string = &tmp;
-
- init_op_array(op_array, INITIAL_OP_ARRAY_SIZE);
- op_array->type = ZEND_EVAL_CODE;
- save_lexical_state(&original_lex_state CLS_CC);
- if (prepare_string_for_scanning(source_string CLS_CC)==FAILURE) {
- destroy_op_array(op_array);
- efree(op_array);
- retval = NULL;
- } else {
- CG(active_op_array) = op_array;
-#ifndef ZTS
- BEGIN(ST_IN_SCRIPTING);
-#else
- CG(ZFL)->BeginState(ST_IN_SCRIPTING);
-#endif
- compiler_result = zendparse(CLS_C);
- restore_lexical_state(&original_lex_state CLS_CC);
- CG(active_op_array) = original_active_op_array;
-
- if (compiler_result==1) {
- CG(unclean_shutdown)=1;
- retval = NULL;
- } else {
- pass_two(op_array);
- pass_include_eval(op_array);
- retval = op_array;
- }
- }
- zval_dtor(&tmp);
- return retval;
-}
-
-
-BEGIN_EXTERN_C()
-int require_filename(char *filename CLS_DC)
-{
- zend_file_handle file_handle;
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- if (require_file(&file_handle CLS_CC)==FAILURE) {
- zend_bailout();
- return FAILURE; /* will never get here */
- }
- return SUCCESS;
-}
-
-
-int require_file(zend_file_handle *file_handle CLS_DC)
-{
- zend_lex_state original_lex_state;
- int compiler_result;
-
- save_lexical_state(&original_lex_state CLS_CC);
- if (open_file_for_scanning(file_handle CLS_CC)==FAILURE) {
- zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, file_handle->filename);
- return FAILURE;
- }
- compiler_result = zendparse(CLS_C);
- zend_close_file_handle(file_handle CLS_CC);
- restore_lexical_state(&original_lex_state CLS_CC);
- if (compiler_result==1) {
- zend_bailout();
- }
- return SUCCESS;
-}
-
-
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- zend_lex_state original_lex_state;
- zend_file_handle file_handle;
- CLS_FETCH();
-
- file_handle.type = ZEND_HANDLE_FILENAME;
- file_handle.filename = filename;
- save_lexical_state(&original_lex_state CLS_CC);
- if (open_file_for_scanning(&file_handle CLS_CC)==FAILURE) {
- zend_message_dispatcher(ZMSG_FAILED_HIGHLIGHT_FOPEN, filename);
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini);
- zend_close_file_handle(&file_handle CLS_CC);
- restore_lexical_state(&original_lex_state CLS_CC);
- return SUCCESS;
-}
-
-
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini)
-{
- zend_lex_state original_lex_state;
- zval tmp = *str;
- CLS_FETCH();
-
- str = &tmp;
- zval_copy_ctor(str);
- save_lexical_state(&original_lex_state CLS_CC);
- if (prepare_string_for_scanning(str CLS_CC)==FAILURE) {
- return FAILURE;
- }
- zend_highlight(syntax_highlighter_ini);
- restore_lexical_state(&original_lex_state CLS_CC);
- zval_dtor(str);
- return SUCCESS;
-}
-END_EXTERN_C()
-
-#ifdef ZTS
-BEGIN_EXTERN_C()
-int lex_scan(zval *zendlval CLS_DC)
-{
- return CG(ZFL)->lex_scan(zendlval CLS_CC);
-}
-
-
-const char *zend_get_zendtext(CLS_D)
-{
- return CG(ZFL)->YYText();
-}
-
-
-int zend_get_zendleng(CLS_D)
-{
- return CG(ZFL)->YYLeng();
-}
-END_EXTERN_C()
-
-
-void ZendFlexLexer::BeginState(int state)
-{
- BEGIN(state);
-}
-
-
-ZendFlexLexer::~ZendFlexLexer()
-{
- if (yy_start_stack) {
- yy_flex_free(yy_start_stack);
- }
-}
-
-
-int yyFlexLexer::yylex()
-{
- fprintf(stderr, "Error: yyFlexLexer::yylex() called\n");
- return -1;
-}
-
-#endif
-
-
-/* redefine YY_INPUT to handle urls for win32*/
-#if 0 /*WIN32|WINNT*/
-#define YY_INPUT(buf,result,max_size) \
- if ( yyin->_tmpfname != "url" ){ \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- }else{ /* this is a url */ \
- int recv_char=0,socketd=0; \
- /*memset(buf,0,max_size);*/ \
- socketd=yyin->_file; \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- ( (recv_char=recv( socketd,(char *)&c,1,0 ))) >0 && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( recv_char == SOCKET_ERROR ) \
- YY_FATAL_ERROR( "input from url in flex scanner failed" ); \
- result = n; \
- } \
- else if ((result = recv( socketd, (char *)buf, max_size, 0)) == SOCKET_ERROR) \
- YY_FATAL_ERROR( "input from url read in flex scanner failed" ); \
- }
-#endif
-
-%}
-
-LNUM [0-9]+
-DNUM ([0-9]*[\.][0-9]+)|([0-9]+[\.][0-9]*)
-EXPONENT_DNUM (({LNUM}|{DNUM})[eE][+-]?{LNUM})
-HNUM "0x"[0-9a-fA-F]+
-LABEL [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
-WHITESPACE [ \n\r\t]+
-TABS_AND_SPACES [ \t]*
-TOKENS [;:,.\[\]()|^&+-/*=%!~$<>?@]
-ENCAPSED_TOKENS [\[\]{}$]
-ESCAPED_AND_WHITESPACE [\n\t\r #'.:;,()|^&+-/*=%!~<>?@]+
-
-%option noyylineno
-%option noyywrap
-%%
-
-<ST_IN_SCRIPTING>"exit" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"die" {
- return T_EXIT;
-}
-
-<ST_IN_SCRIPTING>"old_function" {
- return T_OLD_FUNCTION;
-}
-
-<ST_IN_SCRIPTING>"function"|"cfunction" {
- return T_FUNCTION;
-}
-
-<ST_IN_SCRIPTING>"const" {
- return T_CONST;
-}
-
-<ST_IN_SCRIPTING>"return" {
- return T_RETURN;
-}
-
-<ST_IN_SCRIPTING>"if" {
- return T_IF;
-}
-
-<ST_IN_SCRIPTING>"elseif" {
- return T_ELSEIF;
-}
-
-<ST_IN_SCRIPTING>"endif" {
- return T_ENDIF;
-}
-
-<ST_IN_SCRIPTING>"else" {
- return T_ELSE;
-}
-
-<ST_IN_SCRIPTING>"while" {
- return T_WHILE;
-}
-
-<ST_IN_SCRIPTING>"endwhile" {
- return T_ENDWHILE;
-}
-
-<ST_IN_SCRIPTING>"do" {
- return T_DO;
-}
-
-<ST_IN_SCRIPTING>"for" {
- return T_FOR;
-}
-
-<ST_IN_SCRIPTING>"endfor" {
- return T_ENDFOR;
-}
-
-<ST_IN_SCRIPTING>"foreach" {
- return T_FOREACH;
-}
-
-<ST_IN_SCRIPTING>"endforeach" {
- return T_ENDFOREACH;
-}
-
-<ST_IN_SCRIPTING>"as" {
- return T_AS;
-}
-
-<ST_IN_SCRIPTING>"switch" {
- return T_SWITCH;
-}
-
-<ST_IN_SCRIPTING>"endswitch" {
- return T_ENDSWITCH;
-}
-
-<ST_IN_SCRIPTING>"case" {
- return T_CASE;
-}
-
-<ST_IN_SCRIPTING>"default" {
- return T_DEFAULT;
-}
-
-<ST_IN_SCRIPTING>"break" {
- return T_BREAK;
-}
-
-<ST_IN_SCRIPTING>"continue" {
- return T_CONTINUE;
-}
-
-<ST_IN_SCRIPTING>"echo" {
- return T_ECHO;
-}
-
-<ST_IN_SCRIPTING>"print" {
- return T_PRINT;
-}
-
-<ST_IN_SCRIPTING>"class" {
- return T_CLASS;
-}
-
-<ST_IN_SCRIPTING>"extends" {
- return T_EXTENDS;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"->" {
- yy_push_state(ST_LOOKING_FOR_PROPERTY);
- return T_OBJECT_OPERATOR;
-}
-
-<ST_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 T_STRING;
-}
-
-<ST_LOOKING_FOR_PROPERTY>. {
- /*unput(yytext[0]);*/
- yyless(0);
- yy_pop_state();
-}
-
-<ST_IN_SCRIPTING>"::" {
- return T_PAAMAYIM_NEKUDOTAYIM;
-}
-
-<ST_IN_SCRIPTING>"new" {
- return T_NEW;
-}
-
-<ST_IN_SCRIPTING>"var" {
- return T_VAR;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("int"|"integer"){TABS_AND_SPACES}")" {
- return T_INT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("real"|"double"|"float"){TABS_AND_SPACES}")" {
- return T_DOUBLE_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"string"{TABS_AND_SPACES}")" {
- return T_STRING_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"array"{TABS_AND_SPACES}")" {
- return T_ARRAY_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}"object"{TABS_AND_SPACES}")" {
- return T_OBJECT_CAST;
-}
-
-<ST_IN_SCRIPTING>"("{TABS_AND_SPACES}("bool"|"boolean"){TABS_AND_SPACES}")" {
- return T_BOOL_CAST;
-}
-
-<ST_IN_SCRIPTING>"eval" {
- return T_EVAL;
-}
-
-<ST_IN_SCRIPTING>"include" {
- return T_INCLUDE;
-}
-
-<ST_IN_SCRIPTING>"require" {
- return T_REQUIRE;
-}
-
-<ST_IN_SCRIPTING>"global" {
- return T_GLOBAL;
-}
-
-<ST_IN_SCRIPTING>"isset" {
- return T_ISSET;
-}
-
-<ST_IN_SCRIPTING>"empty" {
- return T_EMPTY;
-}
-
-<ST_IN_SCRIPTING>"static" {
- return T_STATIC;
-}
-
-<ST_IN_SCRIPTING>"unset" {
- return T_UNSET;
-}
-
-<ST_IN_SCRIPTING>"=>" {
- return T_DOUBLE_ARROW;
-}
-
-<ST_IN_SCRIPTING>"list" {
- return T_LIST;
-}
-
-<ST_IN_SCRIPTING>"array" {
- return T_ARRAY;
-}
-
-<ST_IN_SCRIPTING>"++" {
- return T_INC;
-}
-
-<ST_IN_SCRIPTING>"--" {
- return T_DEC;
-}
-
-<ST_IN_SCRIPTING>"==" {
- return T_IS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"!="|"<>" {
- return T_IS_NOT_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<=" {
- return T_IS_SMALLER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">=" {
- return T_IS_GREATER_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"+=" {
- return T_PLUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"-=" {
- return T_MINUS_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"*=" {
- return T_MUL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"/=" {
- return T_DIV_EQUAL;
-}
-
-<ST_IN_SCRIPTING>".=" {
- return T_CONCAT_EQUAL;
-}
-
-
-<ST_IN_SCRIPTING>"%=" {
- return T_MOD_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"<<=" {
- return T_SL_EQUAL;
-}
-
-<ST_IN_SCRIPTING>">>=" {
- return T_SR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"&=" {
- return T_AND_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"|=" {
- return T_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"^=" {
- return XT_OR_EQUAL;
-}
-
-<ST_IN_SCRIPTING>"||" {
- return T_BOOLEAN_OR;
-}
-
-<ST_IN_SCRIPTING>"&&" {
- return T_BOOLEAN_AND;
-}
-
-<ST_IN_SCRIPTING>"OR" {
- return T_LOGICAL_OR;
-}
-
-<ST_IN_SCRIPTING>"AND" {
- return T_LOGICAL_AND;
-}
-
-<ST_IN_SCRIPTING>"XOR" {
- return T_LOGICAL_XOR;
-}
-
-<ST_IN_SCRIPTING>"<<" {
- return T_SL;
-}
-
-<ST_IN_SCRIPTING>">>" {
- return T_SR;
-}
-
-<ST_IN_SCRIPTING>{TOKENS} {
- return yytext[0];
-}
-
-
-<ST_IN_SCRIPTING>"{" {
- yy_push_state(ST_IN_SCRIPTING);
- return '{';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"${" {
- yy_push_state(ST_LOOKING_FOR_VARNAME);
- return T_DOLLAR_OPEN_CURLY_BRACES;
-}
-
-
-<ST_IN_SCRIPTING>"}" {
- /* This is a temporary fix which is dependant on flex and it's implementation */
- if (yy_start_stack_ptr) {
- yy_pop_state();
- }
- return '}';
-}
-
-
-<ST_LOOKING_FOR_VARNAME>{LABEL} {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- yy_pop_state();
- yy_push_state(ST_IN_SCRIPTING);
- return T_STRING_VARNAME;
-}
-
-
-<ST_LOOKING_FOR_VARNAME>. {
- /*unput(yytext[0]);*/
- yyless(0);
- yy_pop_state();
- yy_push_state(ST_IN_SCRIPTING);
-}
-
-
-<ST_IN_SCRIPTING>{LNUM}|{HNUM} {
- errno = 0;
- zendlval->value.lval = strtol(yytext, NULL, 0);
- if (errno == ERANGE) { /* overflow */
- zendlval->value.dval = strtod(yytext,NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
- } else {
- zendlval->type = IS_LONG;
- return T_LNUMBER;
- }
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_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 T_NUM_STRING;
-}
-
-<ST_IN_SCRIPTING>{DNUM}|{EXPONENT_DNUM} {
- zendlval->value.dval = strtod(yytext,NULL);
- zendlval->type = IS_DOUBLE;
- return T_DNUMBER;
-}
-
-<ST_IN_SCRIPTING>"__LINE__" {
- zendlval->value.lval = CG(zend_lineno);
- zendlval->type = IS_LONG;
- return T_LINE;
-}
-
-<ST_IN_SCRIPTING>"__FILE__" {
- char *filename = zend_get_compiled_filename();
-
- if (!filename) {
- filename = "";
- }
- zendlval->value.str.len = strlen(filename);
- zendlval->value.str.val = estrndup(filename,zendlval->value.str.len);
- zendlval->type = IS_STRING;
- return T_FILE;
-}
-
-
-<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 T_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(ST_IN_SCRIPTING);
- return T_OPEN_TAG;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%="|"<?=" {
- if ((yytext[1]=='%' && CG(asp_tags))
- || (yytext[1]=='?' && CG(short_tags))) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- return T_OPEN_TAG_WITH_ECHO;
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<INITIAL>"<%" {
- if (CG(asp_tags)) {
- zendlval->value.str.val = yytext; /* no copying - intentional */
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- BEGIN(ST_IN_SCRIPTING);
- } else {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_INLINE_HTML;
- }
-}
-
-
-<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(ST_IN_SCRIPTING);
- return T_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;
-}
-
-<ST_IN_SCRIPTING,ST_DOUBLE_QUOTES,ST_HEREDOC,ST_BACKQUOTE>"$"{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext+1, yyleng-1);
- zendlval->value.str.len = yyleng-1;
- zendlval->type = IS_STRING;
- return T_VARIABLE;
-}
-
-
-<ST_IN_SCRIPTING>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{LABEL} {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
-}
-
-
-<ST_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;
-}
-
-
-<ST_IN_SCRIPTING>([#]|"//")([^\n\r?]|"?"[^>\n\r])*("?\n"|"?\r\n")? { /* eat one line comments */
- HANDLE_NEWLINE(yytext[yyleng-1]);
- return T_COMMENT;
-}
-
-<ST_IN_SCRIPTING>"/*" {
- BEGIN(ST_COMMENT);
- yymore();
-}
-
-
-<ST_COMMENT>[^*]+ {
- yymore();
-}
-
-<ST_COMMENT>"*/" {
- HANDLE_NEWLINES(yytext, yyleng);
- BEGIN(ST_IN_SCRIPTING);
- return T_COMMENT;
-}
-
-<ST_COMMENT>"*" {
- yymore();
-}
-
-<ST_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 T_CLOSE_TAG; /* implicit ';' at php-end tag */
-}
-
-
-<ST_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 T_CLOSE_TAG; /* implicit ';' at php-end tag */
- } else {
- return T_INLINE_HTML;
- }
-}
-
-
-<ST_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 '\\':
- case '$':
- case '"':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- /* check for an octal */
- if (ZEND_IS_OCT(*s)) {
- char octal_buf[4] = { 0, 0, 0, 0 };
-
- octal_buf[0] = *s;
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[1] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_OCT(*(s+1))) {
- octal_buf[2] = *(++s);
- zendlval->value.str.len--;
- }
- }
- *t++ = (char) strtol(octal_buf, NULL, 8);
- } else if (*s=='x' && (s+1)<end && ZEND_IS_HEX(*(s+1))) {
- char hex_buf[3] = { 0, 0, 0};
-
- zendlval->value.str.len--; /* for the 'x' */
-
- hex_buf[0] = *(++s);
- zendlval->value.str.len--;
- if ((s+1)<end && ZEND_IS_HEX(*(s+1))) {
- hex_buf[1] = *(++s);
- zendlval->value.str.len--;
- }
- *t++ = (char) strtol(hex_buf, NULL, 16);
- } else {
- *t++ = '\\';
- *t++ = *s;
- }
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_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 '\\':
- case '\'':
- *t++ = *s;
- zendlval->value.str.len--;
- break;
- default:
- *t++ = '\\';
- *t++ = *s;
- break;
- }
- s++;
- } else {
- *t++ = *s++;
- }
- }
- *t = 0;
-
- return T_CONSTANT_ENCAPSED_STRING;
-}
-
-
-<ST_IN_SCRIPTING>["] {
- BEGIN(ST_DOUBLE_QUOTES);
- return '\"';
-}
-
-
-<ST_IN_SCRIPTING>"<<<"{TABS_AND_SPACES}{LABEL}("\r")?"\n" {
- char *s;
- CG(zend_lineno)++;
- CG(heredoc_len) = yyleng-3-1-(yytext[yyleng-2]=='\r'?1:0);
- s = yytext+3;
- while ((*s == ' ') || (*s == '\t')) {
- s++;
- CG(heredoc_len)--;
- }
- CG(heredoc) = estrndup(s, CG(heredoc_len));
- BEGIN(ST_HEREDOC);
- return T_HEREDOC;
-}
-
-
-<ST_IN_SCRIPTING>[`] {
- BEGIN(ST_BACKQUOTE);
- return '`';
-}
-
-
-<ST_IN_SCRIPTING>['] {
- BEGIN(ST_SINGLE_QUOTE);
- return '\'';
-}
-
-
-<ST_HEREDOC>^{LABEL}(";")?("\r")?"\n" {
- int label_len;
- unsigned char unput_semicolon;
-
- CG(zend_lineno)++;
- if (yytext[yyleng-2]=='\r') {
- label_len = yyleng-2;
- } else {
- label_len = yyleng-1;
- }
-
- if (yytext[label_len-1]==';') {
- label_len--;
- unput_semicolon=1;
- } else{
- unput_semicolon=0;
- }
-
- if (label_len==CG(heredoc_len) && !memcmp(yytext, CG(heredoc), label_len)) {
- if (unput_semicolon) {
- unput(';');
- }
- efree(CG(heredoc));
- CG(heredoc)=NULL;
- CG(heredoc_len)=0;
- BEGIN(ST_IN_SCRIPTING);
- return T_HEREDOC;
- } else {
- zendlval->value.str.val = (char *)estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_STRING;
- }
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_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 T_ENCAPSED_AND_WHITESPACE;
-}
-
-<ST_SINGLE_QUOTE>([^'\\]|\\[^'\\])+ {
- HANDLE_NEWLINES(yytext,yyleng);
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>[`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_BACKQUOTE>["]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$"[^a-zA-Z_\x7f-\xff{] {
- zendlval->value.chval = yytext[0];
- if (yyleng == 2) {
- yyless(1);
- /*unput(yytext[1]);
- yytext[1] = 0;
- yyleng--;*/
- }
- return T_CHARACTER;
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>{ENCAPSED_TOKENS} {
- zendlval->value.chval = yytext[0];
- return yytext[0];
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"{$" {
- zendlval->value.chval = yytext[0];
- yy_push_state(ST_IN_SCRIPTING);
- /*unput('$');*/
- yyless(1);
- return T_CURLY_OPEN;
-}
-
-
-<ST_SINGLE_QUOTE>"\\'" {
- zendlval->value.chval='\'';
- return T_CHARACTER;
-}
-
-<ST_SINGLE_QUOTE>"\\\\" {
- zendlval->value.chval='\\';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES>"\\\"" {
- zendlval->value.chval='"';
- return T_CHARACTER;
-}
-
-<ST_BACKQUOTE>"\\`" {
- zendlval->value.chval='`';
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"[0-7]{1,3} {
- zendlval->value.chval = (char) strtol (yytext+1, NULL, 8);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\x"[0-9A-Fa-f]{1,2} {
- zendlval->value.chval = (char) strtol (yytext+2, NULL, 16);
- return T_CHARACTER;
-}
-
-<ST_DOUBLE_QUOTES,ST_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 T_BAD_CHARACTER;
- break;
- }
- return T_CHARACTER;
-}
-
-
-<ST_HEREDOC>"\\$"|"\\{" {
- zendlval->value.chval = yytext[1];
- return T_CHARACTER;
-}
-
-
-<ST_HEREDOC>["'`]+ {
- zendlval->value.str.val = (char *) estrndup(yytext, yyleng);
- zendlval->value.str.len = yyleng;
- zendlval->type = IS_STRING;
- return T_ENCAPSED_AND_WHITESPACE;
-}
-
-
-<ST_DOUBLE_QUOTES>["] {
- BEGIN(ST_IN_SCRIPTING);
- return '\"';
-}
-
-
-<ST_BACKQUOTE>[`] {
- BEGIN(ST_IN_SCRIPTING);
- return '`';
-}
-
-
-<ST_SINGLE_QUOTE>['] {
- BEGIN(ST_IN_SCRIPTING);
- return '\'';
-}
-
-
-<ST_DOUBLE_QUOTES,ST_BACKQUOTE,INITIAL,ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY><<EOF>> {
- return 0;
-}
-
-
-<ST_IN_SCRIPTING,INITIAL,ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_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 9ee3630f89..0000000000
--- a/Zend/zend.c
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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"
-#include "zend_API.h"
-
-#ifdef ZTS
-# define GLOBAL_FUNCTION_TABLE global_function_table
-# define GLOBAL_CLASS_TABLE global_class_table
-# define GLOBAL_CONSTANTS_TABLE global_constants_table
-#else
-# define GLOBAL_FUNCTION_TABLE CG(function_table)
-# define GLOBAL_CLASS_TABLE CG(class_table)
-# define GLOBAL_CONSTANTS_TABLE CG(zend_constants)
-#endif
-
-/* true multithread-shared globals */
-ZEND_API zend_class_entry zend_standard_class_def;
-ZEND_API int (*zend_printf)(const char *format, ...);
-ZEND_API int (*zend_write)(const char *str, uint str_length);
-ZEND_API void (*zend_error)(int type, const char *format, ...);
-void (*zend_message_dispatcher)(long message, void *data);
-FILE *(*zend_fopen)(const char *filename);
-void (*zend_block_interruptions)();
-void (*zend_unblock_interruptions)();
-ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents);
-
-#ifdef ZTS
-ZEND_API int compiler_globals_id;
-ZEND_API int executor_globals_id;
-int alloc_globals_id;
-HashTable *global_function_table;
-HashTable *global_class_table;
-HashTable *global_constants_table;
-#endif
-
-zend_utility_values zend_uv;
-
-/* version information */
-static char *zend_version_info;
-static uint zend_version_info_length;
-#define ZEND_CORE_VERSION_INFO "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski\n"
-
-
-#define PRINT_PVAL_INDENT 4
-
-static void print_hash(HashTable *ht, int indent)
-{
- zval **tmp;
- char *string_key;
- unsigned long num_key;
- int i;
-
- for (i=0; i<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);
- efree(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 void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy)
-{
- if (expr->type==IS_STRING) {
- *use_copy = 0;
- return;
- }
- switch (expr->type) {
- case IS_BOOL:
-#if 1
- if (expr->value.lval) {
- expr_copy->value.str.len = 1;
- expr_copy->value.str.val = estrndup("1", 1);
- } else {
- expr_copy->value.str.len = 0;
- expr_copy->value.str.val = empty_string;
- }
-#else
- if (expr->value.lval) {
- expr_copy->value.str.len = sizeof("true")-1;
- expr_copy->value.str.val = estrndup("true", expr_copy->value.str.len);
- } else {
- expr_copy->value.str.len = sizeof("false")-1;
- expr_copy->value.str.val = estrndup("false", expr_copy->value.str.len);
- }
-#endif
- break;
- case IS_RESOURCE:
- expr_copy->value.str.val = (char *) emalloc(sizeof("Resource id #")-1 + MAX_LENGTH_OF_LONG);
- expr_copy->value.str.len = sprintf(expr_copy->value.str.val, "Resource id #%ld", expr->value.lval);
- break;
- case IS_ARRAY:
- expr_copy->value.str.len = sizeof("Array")-1;
- expr_copy->value.str.val = estrndup("Array", expr_copy->value.str.len);
- break;
- case IS_OBJECT: {
- zval function_name;
-
- function_name.value.str.len = sizeof("to_string")-1;
- function_name.value.str.val = estrndup("to_string", function_name.value.str.len);
- function_name.type = IS_STRING;
-
- if (call_user_function(NULL, expr, &function_name, expr_copy, 0, NULL)==FAILURE) {
- expr_copy->value.str.len = sizeof("Object")-1;
- expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
- }
- efree(function_name.value.str.val);
- }
- break;
- default:
- *expr_copy = *expr;
- zval_copy_ctor(expr_copy);
- convert_to_string(expr_copy);
- break;
- }
- expr_copy->type = IS_STRING;
- *use_copy = 1;
-}
-
-
-ZEND_API int zend_print_zval(zval *expr, int indent)
-{
- zval expr_copy;
- int use_copy;
-
- zend_make_printable_zval(expr, &expr_copy, &use_copy);
- if (use_copy) {
- expr = &expr_copy;
- }
- if (expr->value.str.len==0) { /* optimize away empty strings */
- if (use_copy) {
- zval_dtor(expr);
- }
- return 0;
- }
- ZEND_WRITE(expr->value.str.val,expr->value.str.len);
- if (use_copy) {
- zval_dtor(expr);
- }
- return expr->value.str.len;
-}
-
-
-ZEND_API void zend_print_zval_r(zval *expr, int indent)
-{
- switch(expr->type) {
- case IS_ARRAY:
- ZEND_PUTS("Array\n");
- print_hash(expr->value.ht,indent);
- break;
- case IS_OBJECT:
- zend_printf("%s Object\n", expr->value.obj.ce->name);
- print_hash(expr->value.obj.properties, indent);
- break;
- default:
- zend_print_variable(expr);
- break;
- }
-}
-
-
-static FILE *zend_fopen_wrapper(const char *filename)
-{
- return fopen(filename, "r");
-}
-
-
-static void register_standard_class()
-{
- zend_standard_class_def.type = ZEND_INTERNAL_CLASS;
- zend_standard_class_def.name_length = sizeof("stdClass") - 1;
- zend_standard_class_def.name = zend_strndup("stdClass", zend_standard_class_def.name_length);
- zend_standard_class_def.parent = NULL;
- zend_hash_init(&zend_standard_class_def.default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
- zend_hash_init(&zend_standard_class_def.function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
- zend_standard_class_def.handle_function_call = NULL;
- zend_standard_class_def.handle_property_get = NULL;
- zend_standard_class_def.handle_property_set = NULL;
- zend_standard_class_def.refcount = (int *) malloc(sizeof(int));
- *zend_standard_class_def.refcount = 1;
- zend_hash_add(GLOBAL_CLASS_TABLE, "stdClass", sizeof("stdClass"), &zend_standard_class_def, sizeof(zend_class_entry), NULL);
-}
-
-
-#ifdef ZTS
-static void compiler_globals_ctor(zend_compiler_globals *compiler_globals)
-{
- zend_function tmp_func;
- zend_class_entry tmp_class;
-
- compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1);
- zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
-
- compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1);
- zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref, &tmp_class, sizeof(zend_class_entry));
-}
-
-
-static void compiler_globals_dtor(zend_compiler_globals *compiler_globals)
-{
- if (compiler_globals->function_table != global_function_table) {
- zend_hash_destroy(compiler_globals->function_table);
- free(compiler_globals->function_table);
- }
- if (compiler_globals->class_table != global_class_table) {
- zend_hash_destroy(compiler_globals->class_table);
- free(compiler_globals->class_table);
- }
-}
-
-
-static void executor_globals_ctor(zend_executor_globals *executor_globals)
-{
- if (global_constants_table) {
- zend_startup_constants(executor_globals->zend_constants ELS_CC);
- zend_copy_constants(executor_globals->zend_constants, global_constants_table);
- }
- init_resource_plist(ELS_C);
-}
-
-
-static void executor_globals_dtor(zend_executor_globals *executor_globals)
-{
- zend_shutdown_constants(ELS_C);
- destroy_resource_plist();
-}
-
-
-static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
-{
- start_memory_manager();
-}
-
-#endif
-
-
-int zend_startup(zend_utility_functions *utility_functions, char **extensions)
-{
-#ifdef ZTS
- zend_compiler_globals *compiler_globals;
- zend_executor_globals *executor_globals;
-
- alloc_globals_id = ts_allocate_id(sizeof(zend_alloc_globals), alloc_globals_ctor, NULL);
-#endif
-
- 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_get_ini_entry = utility_functions->get_ini_entry;
-
- zend_compile_files = compile_files;
- zend_execute = execute;
-
- zend_llist_init(&zend_extensions, sizeof(zend_extension), (void (*)(void *)) zend_extension_dtor, 1);
-
- /* set up version */
- zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
- zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO)-1;
-
- GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
- GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
- zend_hash_init(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1);
- zend_hash_init(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1);
- register_standard_class();
- zend_hash_init(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1);
- zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
-
-#ifdef ZTS
- global_constants_table = NULL;
- compiler_globals_id = ts_allocate_id(sizeof(zend_compiler_globals), (void (*)(void *)) compiler_globals_ctor, (void (*)(void *)) compiler_globals_dtor);
- executor_globals_id = ts_allocate_id(sizeof(zend_executor_globals), (void (*)(void *)) executor_globals_ctor, (void (*)(void *)) executor_globals_dtor);
- compiler_globals = ts_resource(compiler_globals_id);
- executor_globals = ts_resource(executor_globals_id);
- compiler_globals_dtor(compiler_globals);
- compiler_globals->function_table = GLOBAL_FUNCTION_TABLE;
- compiler_globals->class_table = GLOBAL_CLASS_TABLE;
- zend_startup_constants(EG(zend_constants), executor_globals);
- GLOBAL_CONSTANTS_TABLE = EG(zend_constants);
-#else
- zend_startup_constants(EG(zend_constants));
-#endif
- zend_register_standard_constants(ELS_C);
-
-#ifndef ZTS
- init_resource_plist(ELS_C);
-#endif
-
- return SUCCESS;
-}
-
-
-void zend_shutdown()
-{
-#ifndef ZTS
- destroy_resource_plist();
-#endif
- zend_hash_destroy(&list_destructors);
- zend_hash_destroy(&module_registry);
- zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
- free(GLOBAL_FUNCTION_TABLE);
- zend_hash_destroy(GLOBAL_CLASS_TABLE);
- free(GLOBAL_CLASS_TABLE);
- zend_shutdown_extensions();
- free(zend_version_info);
-#ifndef ZTS
- zend_shutdown_constants(ELS_C);
-#endif
-}
-
-
-void zend_set_utility_values(zend_utility_values *utility_values)
-{
- zend_uv = *utility_values;
-}
-
-
-/* this should be compatible with the standard zenderror */
-void zenderror(char *error)
-{
- zend_error(E_PARSE, error);
-}
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_bailout()
-{
- CLS_FETCH();
- ELS_FETCH();
-
- CG(unclean_shutdown) = 1;
- longjmp(EG(bailout), FAILURE);
-}
-END_EXTERN_C()
-
-
-void zend_append_version_info(zend_extension *extension)
-{
- char *new_info;
- uint new_info_length;
-
- new_info_length = sizeof(" with v, by \n")
- + strlen(extension->name)
- + strlen(extension->version)
- + strlen(extension->copyright)
- + strlen(extension->author);
-
- new_info = (char *) malloc(new_info_length+1);
-
- sprintf(new_info, " with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
-
- zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length+1);
- strcat(zend_version_info, new_info);
- zend_version_info_length += new_info_length;
- free(new_info);
-}
-
-
-ZEND_API char *get_zend_version()
-{
- return zend_version_info;
-}
-
-
-void zend_activate(CLS_D ELS_DC)
-{
- init_compiler(CLS_C ELS_CC);
- init_executor(CLS_C ELS_CC);
- startup_scanner(CLS_C);
-}
-
-void zend_deactivate(CLS_D ELS_DC)
-{
- zend_hash_apply(&module_registry, (int (*)(void *)) module_registry_cleanup);
- shutdown_scanner(CLS_C);
- shutdown_executor(ELS_C);
- shutdown_compiler(CLS_C);
-}
diff --git a/Zend/zend.h b/Zend/zend.h
deleted file mode 100644
index 32bf64976c..0000000000
--- a/Zend/zend.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_H
-#define _ZEND_H
-
-#define ZEND_VERSION "0.90"
-
-
-#ifdef __cplusplus
-#define BEGIN_EXTERN_C() extern "C" {
-#define END_EXTERN_C() }
-#else
-#define BEGIN_EXTERN_C()
-#define END_EXTERN_C()
-#endif
-
-
-#include <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"
-
-/* this is a workaround for a bug in gcc */
-#if SIZEOF_VOID_P == 8 || (1)
-typedef unsigned int zend_bool;
-#else
-typedef unsigned char zend_bool;
-#endif
-
-#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, zval *this_ptr
-#define INTERNAL_FUNCTION_PARAM_PASSTHRU ht, return_value, list, plist, this_ptr
-
-/*
- * zval
- */
-typedef struct _zval_struct zval;
-typedef struct _zend_class_entry zend_class_entry;
-
-typedef union _zvalue_value {
- long lval; /* long value */
- double dval; /* double value */
- struct {
- char *val;
- int len;
- } str;
- char chval; /* char value */
- HashTable *ht; /* hash table value */
- struct {
- zend_class_entry *ce;
- HashTable *properties;
- } obj;
-} zvalue_value;
-
-
-struct _zval_struct {
- /* Variable information */
- zvalue_value value; /* value */
- unsigned char type; /* active type */
- struct {
- unsigned int locks:7;
- unsigned int is_ref:1;
- } EA;
- short refcount;
-};
-
-
-
-typedef struct _zend_function_entry {
- char *fname;
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- unsigned char *func_arg_types;
-} zend_function_entry;
-
-
-typedef struct _zend_property_reference {
- int type; /* read, write or r/w */
- zval **object;
- zend_llist elements_list;
-} zend_property_reference;
-
-
-
-typedef struct _zend_overloaded_element {
- int type; /* array offset or object proprety */
- zval element;
-} zend_overloaded_element;
-
-
-struct _zend_class_entry {
- char type;
- char *name;
- uint name_length;
- struct _zend_class_entry *parent;
- int *refcount;
-
- HashTable function_table;
- HashTable default_properties;
- zend_function_entry *builtin_functions;
-
- /* handlers */
- void (*handle_function_call)(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
- zval (*handle_property_get)(zend_property_reference *property_reference);
- int (*handle_property_set)(zend_property_reference *property_reference, zval *value);
-};
-
-
-
-typedef struct _zend_utility_functions {
- void (*error_function)(int type, const char *format, ...);
- int (*printf_function)(const char *format, ...);
- int (*write_function)(const char *str, uint str_length);
- FILE *(*fopen_function)(const char *filename);
- void (*message_handler)(long message, void *data);
- void (*block_interruptions)();
- void (*unblock_interruptions)();
- int (*get_ini_entry)(char *name, uint name_length, zval *contents);
-} zend_utility_functions;
-
-
-typedef struct _zend_utility_values {
- unsigned char short_tags;
- unsigned char asp_tags;
-} 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);
-BEGIN_EXTERN_C()
-ZEND_API void zend_bailout();
-END_EXTERN_C()
-ZEND_API char *get_zend_version();
-
-ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy);
-ZEND_API int zend_print_zval(zval *expr, int indent);
-ZEND_API void zend_print_zval_r(zval *expr, int indent);
-
-ZEND_API extern char *empty_string;
-ZEND_API extern char *undefined_variable_string;
-
-#define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); }
-
-
-/* output support */
-#define ZEND_WRITE(str, str_len) zend_write((str), (str_len))
-#define ZEND_PUTS(str) zend_write((str), strlen((str)))
-#define ZEND_PUTC(c) zend_write(&(c), 1), (c)
-
-BEGIN_EXTERN_C()
-extern ZEND_API int (*zend_printf)(const char *format, ...);
-extern ZEND_API int (*zend_write)(const char *str, uint str_length);
-extern ZEND_API void (*zend_error)(int type, const char *format, ...);
-extern FILE *(*zend_fopen)(const char *filename);
-extern void (*zend_block_interruptions)();
-extern void (*zend_unblock_interruptions)();
-extern void (*zend_message_dispatcher)(long message, void *data);
-extern ZEND_API int (*zend_get_ini_entry)(char *name, uint name_length, zval *contents);
-END_EXTERN_C()
-
-
-void zenderror(char *error);
-
-extern ZEND_API zend_class_entry zend_standard_class_def;
-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
-#define ZMSG_MEMORY_LEAK_REPEATED 6L
-#define ZMSG_LOG_SCRIPT_NAME 7L
-
-#define INIT_PZVAL(z) \
- (z)->refcount = 1; \
- (z)->EA.is_ref = 0; \
- (z)->EA.locks = 0;
-
-#define MAKE_STD_ZVAL(zv) \
- zv = (zval *) emalloc(sizeof(zval)); \
- INIT_PZVAL(zv);
-
-#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 d324d877d8..0000000000
--- a/Zend/zend_API.c
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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;
- int arg_count;
- va_list ptr;
- zval **param, *param_ptr;
- ELS_FETCH();
- ALS_FETCH();
-
- p = EG(argument_stack).top_element-1;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
-
- while (param_count>0) {
- param = va_arg(ptr, zval **);
- param_ptr = *(p-param_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- new_tmp = (zval *) emalloc(sizeof(zval));
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-param_count))->refcount--;
- *(p-param_count) = param_ptr;
- }
- *param = param_ptr;
- param_count--;
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array)
-{
- void **p;
- int arg_count;
- zval *param_ptr;
- ELS_FETCH();
-
- p = EG(argument_stack).top_element-1;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
-
- while (param_count>0) {
- param_ptr = *(p-param_count);
- if (!PZVAL_IS_REF(param_ptr) && param_ptr->refcount>1) {
- zval *new_tmp;
-
- new_tmp = (zval *) emalloc(sizeof(zval));
- *new_tmp = *param_ptr;
- zval_copy_ctor(new_tmp);
- INIT_PZVAL(new_tmp);
- param_ptr = new_tmp;
- ((zval *) *(p-param_count))->refcount--;
- *(p-param_count) = param_ptr;
- }
- *(argument_array++) = param_ptr;
- param_count--;
- }
-
- return SUCCESS;
-}
-
-
-
-
-/* Zend-optimized Extended functions */
-/* this function doesn't check for too many parameters */
-ZEND_API int getParametersEx(int param_count,...)
-{
- void **p;
- int arg_count;
- va_list ptr;
- zval ***param;
- ELS_FETCH();
-
- p = EG(argument_stack).top_element-1;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- va_start(ptr, param_count);
- while (param_count>0) {
- param = va_arg(ptr, zval ***);
- *param = (zval **) p-(param_count--);
- }
- va_end(ptr);
-
- return SUCCESS;
-}
-
-
-ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array)
-{
- void **p;
- int arg_count;
- ELS_FETCH();
-
- p = EG(argument_stack).top_element-1;
- arg_count = (ulong) *p;
-
- if (param_count>arg_count) {
- return FAILURE;
- }
-
- while (param_count>0) {
- *(argument_array++) = (zval **) p-(param_count--);
- }
-
- return SUCCESS;
-}
-
-
-ZEND_API int ParameterPassedByReference(int ht, uint n)
-{
- void **p;
- ulong arg_count;
- zval *arg;
- ELS_FETCH();
-
- p = EG(argument_stack).elements+EG(argument_stack).top-1;
- arg_count = (ulong) *p;
-
- if (n>arg_count) {
- return FAILURE;
- }
- arg = (zval *) *(p-arg_count+n-1);
- return PZVAL_IS_REF(arg);
-}
-
-
-ZEND_API void wrong_param_count()
-{
- zend_error(E_WARNING,"Wrong parameter count for %s()",get_active_function_name());
-}
-
-
-ZEND_API inline int array_init(zval *arg)
-{
- arg->value.ht = (HashTable *) emalloc(sizeof(HashTable));
- if (!arg->value.ht || zend_hash_init(arg->value.ht, 0, NULL, PVAL_PTR_DTOR, 0)) {
- zend_error(E_CORE_ERROR, "Cannot allocate memory for array");
- return FAILURE;
- }
- arg->type = IS_ARRAY;
- return SUCCESS;
-}
-
-
-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, &zend_standard_class_def);
-}
-
-
-ZEND_API inline int add_assoc_long(zval *arg, char *key, long n)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_LONG;
- tmp->value.lval = n;
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_assoc_double(zval *arg, char *key, double d)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_DOUBLE;
- tmp->value.dval = d;
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_assoc_string(zval *arg, char *key, char *str, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_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;
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
-}
-
-
-ZEND_API inline int add_index_double(zval *arg, uint index, double d)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_DOUBLE;
- tmp->value.dval = d;
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
-}
-
-
-ZEND_API inline int add_index_string(zval *arg, uint index, char *str, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL);
-}
-
-
-ZEND_API inline int add_next_index_long(zval *arg, long n)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_LONG;
- tmp->value.lval = n;
- INIT_PZVAL(tmp);
- return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_next_index_double(zval *arg, double d)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_DOUBLE;
- tmp->value.dval = d;
- INIT_PZVAL(tmp);
- return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_next_index_string(zval *arg, char *str, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL);
-}
-
-
-ZEND_API inline int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *),NULL);
-}
-
-
-ZEND_API inline int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API inline int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), dest);
-}
-
-
-ZEND_API inline int add_get_index_long(zval *arg, uint index, long l, void **dest)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_LONG;
- tmp->value.lval = l;
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
-}
-
-
-ZEND_API inline int add_get_index_double(zval *arg, uint index, double d, void **dest)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_DOUBLE;
- tmp->value.dval= d;
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
-}
-
-
-ZEND_API inline int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
-}
-
-
-ZEND_API inline int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),dest);
-}
-
-
-ZEND_API inline int add_property_long(zval *arg, char *key, long n)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_LONG;
- tmp->value.lval = n;
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_property_double(zval *arg, char *key, double d)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_DOUBLE;
- tmp->value.dval = d;
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_property_string(zval *arg, char *key, char *str, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = strlen(str);
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-ZEND_API inline int add_property_stringl(zval *arg, char *key, char *str, uint length, int duplicate)
-{
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- tmp->type = IS_STRING;
- tmp->value.str.len = length;
- if (duplicate) {
- tmp->value.str.val = estrndup(str,tmp->value.str.len);
- } else {
- tmp->value.str.val = str;
- }
- INIT_PZVAL(tmp);
- return zend_hash_update(arg->value.obj.properties, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL);
-}
-
-
-int zend_startup_module(zend_module_entry *module)
-{
- if (module) {
- module->module_number = zend_next_free_module();
- if (module->module_startup_func) {
- if (module->module_startup_func(MODULE_PERSISTENT, module->module_number)==FAILURE) {
- zend_error(E_CORE_ERROR,"Unable to start %s module",module->name);
- return FAILURE;
- }
- }
- module->type = MODULE_PERSISTENT;
- zend_register_module(module);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int _register_list_destructors(void (*list_destructor)(void *), void (*plist_destructor)(void *), int module_number)
-{
- list_destructors_entry ld;
-
-#if 0
- printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
-#endif
-
- ld.list_destructor=(void (*)(void *)) list_destructor;
- ld.plist_destructor=(void (*)(void *)) plist_destructor;
- ld.module_number = module_number;
- ld.resource_id = list_destructors.nNextFreeElement;
-
- if (zend_hash_next_index_insert(&list_destructors,(void *) &ld,sizeof(list_destructors_entry),NULL)==FAILURE) {
- return FAILURE;
- }
- return list_destructors.nNextFreeElement-1;
-}
-
-
-/* registers all functions in *library_functions in the function hash */
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table)
-{
- zend_function_entry *ptr = functions;
- zend_internal_function internal_function;
- int count=0,unload=0;
- HashTable *target_function_table = function_table;
- CLS_FETCH();
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- internal_function.type = ZEND_INTERNAL_FUNCTION;
-
- while (ptr->fname) {
- internal_function.handler = ptr->handler;
- internal_function.arg_types = ptr->func_arg_types;
- internal_function.function_name = ptr->fname;
- if (!internal_function.handler) {
- zend_error(E_CORE_WARNING,"Null function defined as active function");
- zend_unregister_functions(functions, count, target_function_table);
- return FAILURE;
- }
- if (zend_hash_add(target_function_table, ptr->fname, strlen(ptr->fname)+1, &internal_function, sizeof(zend_internal_function), NULL) == FAILURE) {
- unload=1;
- break;
- }
- ptr++;
- count++;
- }
- if (unload) { /* before unloading, display all remaining bad function in the module */
- while (ptr->fname) {
- if (zend_hash_exists(target_function_table, ptr->fname, strlen(ptr->fname)+1)) {
- zend_error(E_CORE_WARNING, "Function registration failed - duplicate name - %s",ptr->fname);
- }
- ptr++;
- }
- zend_unregister_functions(functions, count, target_function_table);
- return FAILURE;
- }
- return SUCCESS;
-}
-
-/* count=-1 means erase all functions, otherwise,
- * erase the first count functions
- */
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table)
-{
- zend_function_entry *ptr = functions;
- int i=0;
- HashTable *target_function_table = function_table;
- CLS_FETCH();
-
- if (!target_function_table) {
- target_function_table = CG(function_table);
- }
- while (ptr->fname) {
- if (count!=-1 && i>=count) {
- break;
- }
-#if 0
- zend_printf("Unregistering %s()\n", ptr->fname);
-#endif
- zend_hash_del(target_function_table, ptr->fname, strlen(ptr->fname)+1);
- ptr++;
- i++;
- }
-}
-
-
-ZEND_API int zend_register_module(zend_module_entry *module)
-{
-#if 0
- zend_printf("%s: Registering module %d\n",module->name, module->module_number);
-#endif
- if (module->functions && zend_register_functions(module->functions, NULL)==FAILURE) {
- zend_error(E_CORE_WARNING,"%s: Unable to register functions, unable to load",module->name);
- return FAILURE;
- }
- module->module_started=1;
- return zend_hash_add(&module_registry, module->name,strlen(module->name)+1,(void *)module,sizeof(zend_module_entry),NULL);
-}
-
-
-void module_destructor(zend_module_entry *module)
-{
- if (module->type == MODULE_TEMPORARY) {
- zend_hash_apply_with_argument(&list_destructors, (int (*)(void *,void *)) clean_module_resource_destructors, (void *) &(module->module_number));
- clean_module_constants(module->module_number);
- }
-
- if (module->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;
- if (module->functions) {
- zend_unregister_functions(module->functions, -1, NULL);
- }
-
-#if HAVE_LIBDL
- if (module->handle) {
- dlclose(module->handle);
- }
-#endif
-}
-
-
-/* call request startup for all modules */
-int module_registry_request_startup(zend_module_entry *module)
-{
- if (!module->request_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_API zend_class_entry *register_internal_class(zend_class_entry *class_entry)
-{
- zend_class_entry *register_class;
- char *lowercase_name = zend_strndup(class_entry->name, class_entry->name_length);
- CLS_FETCH();
-
- zend_str_tolower(lowercase_name, class_entry->name_length);
-
- class_entry->type = ZEND_INTERNAL_CLASS;
- class_entry->parent = NULL;
- class_entry->refcount = (int *) malloc(sizeof(int));
- *class_entry->refcount = 1;
- zend_hash_init(&class_entry->default_properties, 0, NULL, PVAL_PTR_DTOR, 1);
- zend_hash_init(&class_entry->function_table, 0, NULL, ZEND_FUNCTION_DTOR, 1);
-
- zend_hash_update(CG(class_table), lowercase_name, class_entry->name_length+1, class_entry, sizeof(zend_class_entry), (void **) &register_class);
- free(lowercase_name);
-
- if (class_entry->builtin_functions) {
- zend_register_functions(class_entry->builtin_functions, &class_entry->function_table);
- }
- return register_class;
-}
-
-
-ZEND_API zend_module_entry *zend_get_module(int module_number)
-{
- zend_module_entry *module;
-
- if (zend_hash_index_find(&module_registry, module_number, (void **) &module)==SUCCESS) {
- return module;
- } else {
- return NULL;
- }
-}
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
deleted file mode 100644
index 89e6180e76..0000000000
--- a/Zend/zend_API.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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)
-
-
-#define INIT_CLASS_ENTRY(class_container, class_name, functions) \
- { \
- class_container.name = strdup(class_name); \
- class_container.name_length = sizeof(class_name)-1; \
- class_container.builtin_functions = functions; \
- class_container.handle_function_call = NULL; \
- class_container.handle_property_get = NULL; \
- class_container.handle_property_set = NULL; \
- }
-
-#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, handle_fcall, handle_propget, handle_propset) \
- { \
- class_container.name = strdup(class_name); \
- class_container.name_length = sizeof(class_name)-1; \
- class_container.builtin_functions = functions; \
- class_container.handle_function_call = handle_fcall; \
- class_container.handle_property_get = handle_propget; \
- class_container.handle_property_set = handle_propset; \
- }
-
-
-
-int zend_next_free_module(void);
-
-ZEND_API int getParameters(int ht, int param_count,...);
-ZEND_API int getParametersArray(int ht, int param_count, zval **argument_array);
-ZEND_API int getParametersEx(int param_count,...);
-ZEND_API int getParametersArrayEx(int param_count, zval ***argument_array);
-
-ZEND_API int ParameterPassedByReference(int ht, uint n);
-
-int zend_register_functions(zend_function_entry *functions, HashTable *function_table);
-void zend_unregister_functions(zend_function_entry *functions, int count, HashTable *function_table);
-ZEND_API int zend_register_module(zend_module_entry *module_entry);
-ZEND_API zend_class_entry *register_internal_class(zend_class_entry *class_entry);
-ZEND_API zend_module_entry *zend_get_module(int module_number);
-
-ZEND_API void wrong_param_count(void);
-
-#define getThis() (this_ptr)
-
-#define WRONG_PARAM_COUNT { wrong_param_count(); return; }
-#define WRONG_PARAM_COUNT_WITH_RETVAL(ret) { wrong_param_count(); return ret; }
-#define ARG_COUNT(ht) (ht)
-
-#define BYREF_NONE 0
-#define BYREF_FORCE 1
-#define BYREF_ALLOW 2
-
-#if !(WIN32||WINNT)
-#define DLEXPORT
-#endif
-
-int zend_startup_module(zend_module_entry *module);
-
-ZEND_API int array_init(zval *arg);
-ZEND_API int object_init(zval *arg);
-ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce);
-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))
-
-#define RETVAL_RESOURCE(l) { \
- return_value->type = IS_RESOURCE;\
- return_value->value.lval = l; \
- }
-#define RETVAL_LONG(l) { \
- return_value->type = IS_LONG; \
- return_value->value.lval = l; \
- }
-#define RETVAL_DOUBLE(d) { \
- return_value->type = IS_DOUBLE; \
- return_value->value.dval = d; \
- }
-#define RETVAL_STRING(s,duplicate) { \
- char *__s=(s); \
- return_value->value.str.len = strlen(__s); \
- return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
- return_value->type = IS_STRING; \
- }
-#define RETVAL_STRINGL(s,l,duplicate) { \
- char *__s=(s); int __l=l; \
- return_value->value.str.len = __l; \
- return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
- return_value->type = IS_STRING; \
- }
-
-#define RETVAL_FALSE { return_value->value.lval = 0; return_value->type = IS_BOOL; }
-#define RETVAL_TRUE { return_value->value.lval = 1; return_value->type = IS_BOOL; }
-
-#define RETURN_RESOURCE(l) { \
- return_value->type = IS_RESOURCE;\
- return_value->value.lval = l; \
- return; \
- }
-#define RETURN_LONG(l) { \
- return_value->type = IS_LONG; \
- return_value->value.lval = l; \
- return; \
- }
-#define RETURN_DOUBLE(d) { \
- return_value->type = IS_DOUBLE; \
- return_value->value.dval = d; \
- return; \
- }
-#define RETURN_STRING(s,duplicate) { \
- char *__s=(s); \
- return_value->value.str.len = strlen(__s); \
- return_value->value.str.val = (duplicate?estrndup(__s,return_value->value.str.len):__s); \
- return_value->type = IS_STRING; \
- return; \
- }
-#define RETURN_STRINGL(s,l,duplicate) { \
- char *__s=(s); int __l=l; \
- return_value->value.str.len = __l; \
- return_value->value.str.val = (duplicate?estrndup(__s,__l):__s); \
- return_value->type = IS_STRING; \
- return; \
- }
-
-#define RETURN_FALSE { RETVAL_FALSE; return; }
-#define RETURN_TRUE { RETVAL_TRUE; return; }
-
-#define SET_VAR_STRING(n,v) { \
- { \
- zval *var = (zval *) emalloc(sizeof(zval)); \
- \
- char *str=v; /* prevent 'v' from being evaluated more than once */ \
- var->value.str.val = (str); \
- var->value.str.len = strlen((str)); \
- var->type = IS_STRING; \
- INIT_PZVAL(var); \
- zend_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(zval *), NULL); \
- } \
- }
-#define SET_VAR_STRINGL(n,v,l) { \
- { \
- zval *var = (zval *) emalloc(sizeof(zval)); \
- \
- char *name=(n); \
- var->value.str.val = (v); \
- var->value.str.len = (l); \
- var->type = IS_STRING; \
- INIT_PZVAL(var); \
- zend_hash_update(&EG(symbol_table), name, strlen(name)+1, &var, sizeof(zval *), NULL); \
- } \
- }
-#define SET_VAR_LONG(n,v) { \
- { \
- zval *var = (zval *) emalloc(sizeof(zval)); \
- \
- var->value.lval = (v); \
- var->type = IS_LONG; \
- INIT_PZVAL(var); \
- zend_hash_update(&EG(symbol_table), (n), strlen((n))+1, &var, sizeof(zval *), NULL); \
- } \
- }
-#define SET_VAR_DOUBLE(n,v) { \
- { \
- zval *var = (zval *) emalloc(sizeof(zval)); \
- \
- var->value.dval = (v); \
- var->type = IS_DOUBLE; \
- INIT_PZVAL(var); \
- zend_hash_update(&EG(symbol_table)), (n), strlen((n))+1, &var, sizeof(zval *), NULL); \
- } \
- }
-
-
-#endif /* _ZEND_API_H */
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
deleted file mode 100644
index 39390e8dea..0000000000
--- a/Zend/zend_alloc.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdlib.h>
-
-#include "zend.h"
-#include "zend_alloc.h"
-#include "zend_globals.h"
-#if HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#if HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#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;
-
-
-
-#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;
- ALS_FETCH();
-
- 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;
- p->reported = 0;
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- p->persistent = 0;
- p->cached = 0;
- return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING);
- } else {
- p = (mem_header *) malloc(sizeof(mem_header) + size + PLATFORM_PADDING + END_ALIGNMENT(size) + END_MAGIC_SIZE);
- }
-
- if (!p) {
- fprintf(stderr,"FATAL: emalloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)p;
- }
- p->persistent = p->cached = 0;
- ADD_POINTER_TO_LIST(p);
- p->size = size;
-#if ZEND_DEBUG
- p->filename = filename;
- p->lineno = lineno;
- p->magic = MEM_BLOCK_START_MAGIC;
- p->reported = 0;
- *((long *)(((char *) p) + sizeof(mem_header)+size+PLATFORM_PADDING+END_ALIGNMENT(size))) = MEM_BLOCK_END_MAGIC;
-#endif
-#if MEMORY_LIMIT
- CHECK_MEMORY_LIMIT(size);
-#endif
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)((char *)p + sizeof(mem_header) + PLATFORM_PADDING);
-}
-
-
-#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);
- ALS_FETCH();
-
-#if ZEND_DEBUG
- if (!_mem_block_check(ptr, 1, filename, lineno)) {
- return;
- }
- 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, int allow_failure, char *filename, uint lineno)
-#else
-ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure)
-#endif
-{
- mem_header *p = (mem_header *) ((char *)ptr-sizeof(mem_header)-PLATFORM_PADDING);
- mem_header *orig = p;
- ALS_FETCH();
-
- 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) {
- if (!allow_failure) {
- fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
-#if ZEND_DEBUG && HAVE_KILL && HAVE_GETPID
- kill(getpid(), SIGSEGV);
-#else
- exit(1);
-#endif
- }
- ADD_POINTER_TO_LIST(orig);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return (void *)NULL;
- }
- ADD_POINTER_TO_LIST(p);
-#if ZEND_DEBUG
- p->filename = 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)
-{
- ALS_FETCH();
-
- 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;
-#ifdef ZEND_DEBUG
- int had_leaks=0;
-#endif
- ALS_FETCH();
-
- p=AG(head);
- t=AG(head);
- while (t) {
- if (!t->cached || clean_cache) {
-#if ZEND_DEBUG
- if (!t->cached && !t->reported) {
- mem_header *iterator;
- int total_leak=0, total_leak_count=0;
-
- had_leaks=1;
- if (!silent) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
- }
- t->reported = 1;
- for (iterator=t->pNext; iterator; iterator=iterator->pNext) {
- if (!iterator->cached
- && iterator->filename==t->filename
- && iterator->lineno==t->lineno) {
- total_leak += iterator->size;
- total_leak_count++;
- iterator->reported = 1;
- }
- }
- if (!silent && total_leak_count>0) {
- zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *) (long) (total_leak_count));
- }
- }
-#endif
- p = t->pNext;
- REMOVE_POINTER_FROM_LIST(t);
- free(t);
- t = p;
- } else {
- t = t->pNext;
- }
- }
-}
-
-
-#if ZEND_DEBUG
-void zend_debug_alloc_output(char *format, ...)
-{
- char output_buf[256];
- va_list args;
-
- va_start(args, format);
- vsprintf(output_buf, format, args);
- va_end(args);
-
-#if WIN32||WINNT
- OutputDebugString(output_buf);
-#else
- fprintf(stderr, output_buf);
-#endif
-}
-
-
-ZEND_API int _mem_block_check(void *ptr, int silent, 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) {
- zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
- zend_debug_alloc_output("---------------------------------------\n");
- zend_debug_alloc_output("%s(%d) : Block 0x%0.8lX status:\n", filename, lineno, (long) p);
- zend_debug_alloc_output("%10s\t","Beginning: ");
- }
-
- switch (p->magic) {
- case MEM_BLOCK_START_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("OK (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- }
- break; /* ok */
- case MEM_BLOCK_FREED_MAGIC:
- if (!silent) {
- zend_debug_alloc_output("Freed\n");
- had_problems=1;
- } else {
- return _mem_block_check(ptr, 0, filename, lineno);
- }
- break;
- case MEM_BLOCK_CACHED_MAGIC:
- if (!silent) {
- if (!no_cache_notice) {
- zend_debug_alloc_output("Cached (allocated on %s:%d, %d bytes)\n", p->filename, p->lineno, p->size);
- had_problems=1;
- }
- } else {
- if (!no_cache_notice) {
- return _mem_block_check(ptr, 0, filename, lineno);
- }
- }
- break;
- default:
- if (!silent) {
- zend_debug_alloc_output("Overrun (magic=0x%0.8lX, expected=0x%0.8lX)\n", p->magic, MEM_BLOCK_START_MAGIC);
- } else {
- return _mem_block_check(ptr, 0, 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++;
- }
- }
-
- zend_debug_alloc_output("%10s\t", "End:");
- zend_debug_alloc_output("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);
- zend_debug_alloc_output("%10s\t","");
- if (overflows>=sizeof(long)) {
- zend_debug_alloc_output("At least %d bytes overflown\n", sizeof(long));
- } else {
- zend_debug_alloc_output("%d byte(s) overflown\n", overflows);
- }
- } else if (!silent) {
- zend_debug_alloc_output("%10s\t", "End:");
- if (valid_beginning) {
- zend_debug_alloc_output("OK\n");
- } else {
- zend_debug_alloc_output("Unknown\n");
- }
- }
-
- if (had_problems) {
- int foo = 5;
-
- foo+=1;
- }
-
- if (!silent) {
- zend_debug_alloc_output("---------------------------------------\n");
- }
- return ((!had_problems) ? 1 : 0);
-}
-
-
-ZEND_API void _full_mem_check(int silent, char *filename, uint lineno)
-{
- mem_header *p;
- int errors=0;
- ALS_FETCH();
-
- p = AG(head);
-
-
- zend_debug_alloc_output("------------------------------------------------\n");
- zend_debug_alloc_output("Full Memory Check at %s:%d\n", 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;
- }
- zend_debug_alloc_output("End of full memory check %s:%d (%d errors)\n", filename, lineno, errors);
- zend_debug_alloc_output("------------------------------------------------\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);
- ALS_FETCH();
-
-#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 d3f45c48f3..0000000000
--- a/Zend/zend_alloc.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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;
- int reported;
-#endif
- struct _mem_header *pNext;
- struct _mem_header *pLast;
- unsigned int size:30;
- unsigned int persistent:1;
- unsigned int cached:1;
-} mem_header;
-
-typedef union _align_test {
- void *ptr;
- double dbl;
- long lng;
-} align_test;
-
-#define MAX_CACHED_MEMORY 64
-#define MAX_CACHED_ENTRIES 16
-
-#define PLATFORM_ALIGNMENT (sizeof(align_test))
-#define PLATFORM_PADDING (((PLATFORM_ALIGNMENT-sizeof(mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)
-
-ZEND_API char *zend_strndup(const char *s, unsigned int length);
-
-BEGIN_EXTERN_C()
-
-#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, int allow_failure, 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),0,__FILE__,__LINE__)
-#define erealloc_recoverable(ptr,size) _erealloc((ptr),(size),1,__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, int allow_failure);
-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),0)
-#define erealloc_recoverable(ptr,size) _erealloc((ptr),(size),1)
-#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 perealloc_recoverable(ptr,size,persistent) ((persistent)?realloc((ptr),(size)):erealloc_recoverable((ptr),(size)))
-#define pestrdup(s,persistent) ((persistent)?strdup(s):estrdup(s))
-
-#define safe_estrdup(ptr) ((ptr)?(estrdup(ptr)):(empty_string))
-#define safe_estrndup(ptr,len) ((ptr)?(estrndup((ptr),(len))):(empty_string))
-
-ZEND_API int zend_set_memory_limit(unsigned int memory_limit);
-
-ZEND_API void start_memory_manager(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
-
-
-END_EXTERN_C()
-
-#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 5a224a8b7e..0000000000
--- a/Zend/zend_compile.c
+++ /dev/null
@@ -1,1977 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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(ELS_C);
- CG(unclean_shutdown) = 0;
- zend_llist_init(&CG(open_files), sizeof(void *), zend_open_file_dtor, 0);
-}
-
-
-void shutdown_compiler(CLS_D)
-{
- zend_stack_destroy(&CG(bp_stack));
- zend_stack_destroy(&CG(function_call_stack));
- zend_stack_destroy(&CG(switch_cond_stack));
- zend_stack_destroy(&CG(object_stack));
- zend_llist_destroy(&CG(filenames_list));
- zend_hash_apply(CG(function_table), (int (*)(void *)) is_not_internal_function);
- zend_hash_apply(CG(class_table), (int (*)(void *)) is_not_internal_class);
- zend_llist_destroy(&CG(open_files));
-}
-
-
-ZEND_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 CLS_DC)
-{
- if (!CG(active_op_array)->uses_globals
- && varname->op_type == IS_CONST
- && varname->u.constant.type == IS_STRING
- && varname->u.constant.value.str.len == (sizeof("GLOBALS")-1)
- && !memcmp(varname->u.constant.value.str.val, "GLOBALS", sizeof("GLOBALS")-1)) {
- CG(active_op_array)->uses_globals = 1;
- }
-}
-
-
-void fetch_simple_variable(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;
- opline->extended_value = ZEND_FETCH_STANDARD;
- *result = opline->result;
-
- zend_stack_top(&CG(bp_stack), (void **) &fetch_list_ptr);
- zend_llist_add_element(fetch_list_ptr, &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;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-void do_echo(znode *arg CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_ECHO;
- opline->op1 = *arg;
- SET_UNUSED(opline->op2);
-}
-
-
-void do_assign(znode *result, znode *variable, znode *value CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_ASSIGN;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *variable;
- opline->op2 = *value;
- *result = opline->result;
-}
-
-
-void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_ASSIGN_REF;
- if (result) {
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- } else {
- SET_UNUSED(opline->result);
- }
- opline->op1 = *lvar;
- opline->op2 = *rvar;
-}
-
-
-static inline void do_begin_loop(CLS_D)
-{
- zend_brk_cont_element *brk_cont_element;
- int parent;
-
- parent = CG(active_op_array)->current_brk_cont;
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->last_brk_cont;
- brk_cont_element = get_next_brk_cont_element(CG(active_op_array));
- brk_cont_element->parent = parent;
-}
-
-
-static inline void do_end_loop(int cont_addr CLS_DC)
-{
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = cont_addr;
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-}
-
-
-void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC)
-{
- int while_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *expr;
- close_bracket_token->u.opline_num = while_cond_op_number;
- SET_UNUSED(opline->op2);
-
- do_begin_loop(CLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- /* add unconditional jump */
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = while_token->u.opline_num;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- /* update while's conditional jmp */
- CG(active_op_array)->opcodes[close_bracket_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-
- do_end_loop(while_token->u.opline_num CLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC)
-{
- int for_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPZNZ;
- opline->result = *expr; /* the conditional expression */
- second_semicolon_token->u.opline_num = for_cond_op_number;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = cond_start->u.opline_num;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op1.u.opline_num = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_begin_loop(CLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-void do_for_end(znode *second_semicolon_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = second_semicolon_token->u.opline_num+1;
- CG(active_op_array)->opcodes[second_semicolon_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- do_end_loop(second_semicolon_token->u.opline_num+1 CLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void do_pre_incdec(znode *result, znode *op1, int op CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-}
-
-
-void do_post_incdec(znode *result, znode *op1, int op CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = op;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *op1;
- *result = opline->result;
- SET_UNUSED(opline->op2);
-}
-
-
-void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC)
-{
- int if_cond_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPZ;
- opline->op1 = *cond;
- closing_bracket_token->u.opline_num = if_cond_op_number;
- SET_UNUSED(opline->op2);
- INC_BPC(CG(active_op_array));
-}
-
-
-void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC)
-{
- int if_end_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- zend_llist *jmp_list_ptr;
-
- opline->opcode = ZEND_JMP;
- /* save for backpatching */
- if (initialize) {
- zend_llist jmp_list;
-
- zend_llist_init(&jmp_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &jmp_list, sizeof(zend_llist));
- }
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- zend_llist_add_element(jmp_list_ptr, &if_end_op_number);
-
- CG(active_op_array)->opcodes[closing_bracket_token->u.opline_num].op2.u.opline_num = if_end_op_number+1;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void do_if_end(CLS_D)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_llist *jmp_list_ptr;
- zend_llist_element *le;
-
- zend_stack_top(&CG(bp_stack), (void **) &jmp_list_ptr);
- for (le=jmp_list_ptr->head; le; le = le->next) {
- CG(active_op_array)->opcodes[*((int *) le->data)].op1.u.opline_num = next_op_number;
- }
- zend_llist_destroy(jmp_list_ptr);
- zend_stack_del_top(&CG(bp_stack));
- DEC_BPC(CG(active_op_array));
-}
-
-
-void do_begin_variable_parse(CLS_D)
-{
- zend_llist fetch_list;
-
- zend_llist_init(&fetch_list, sizeof(int), NULL, 0);
- zend_stack_push(&CG(bp_stack), (void *) &fetch_list, sizeof(zend_llist));
-}
-
-
-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 CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_ADD_CHAR;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_ADD_STRING;
- opline->op1 = *op1;
- opline->op2 = *op2;
- opline->op2.op_type = IS_CONST;
- opline->result = opline->op1;
- *result = opline->result;
-}
-
-
-void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC)
-{
- zend_op *opline;
-
- if (op1->op_type == IS_CONST) {
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_INIT_STRING;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- *result = opline->result;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-
- if (op1->u.constant.value.str.len>0) {
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_ADD_STRING;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op1;
- opline->result = opline->op1;
- } else {
- zval_dtor(&op1->u.constant);
- }
- } else {
- *result = *op1;
- }
-
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_ADD_VAR;
- opline->result = *result;
- opline->op1 = *result;
- opline->op2 = *op2;
- *result = opline->result;
-}
-
-
-void do_free(znode *op1 CLS_DC)
-{
- if (op1->op_type==IS_TMP_VAR) {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_FREE;
- opline->op1 = *op1;
- SET_UNUSED(opline->op2);
- } else if (op1->op_type==IS_VAR) {
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- if (opline->result.op_type == op1->op_type
- && opline->result.u.var == op1->u.var) {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- } else {
-
- /* This should be an object instanciation
- * Find JMP_NO_CTOR, mark the preceding ASSIGN and the
- * proceeding INIT_FCALL_BY_NAME as unused
- */
- while (opline>CG(active_op_array)->opcodes) {
- if (opline->opcode == ZEND_JMP_NO_CTOR) {
- (opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
- (opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;
- break;
- }
- opline--;
- }
- }
- }
-}
-
-
-void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC)
-{
- zend_op_array op_array;
- char *name = function_name->u.constant.value.str.val;
- int name_len = function_name->u.constant.value.str.len;
- int function_begin_line = function_token->u.opline_num;
-
- function_token->u.op_array = CG(active_op_array);
- zend_str_tolower(name, name_len);
-
- init_op_array(&op_array, INITIAL_OP_ARRAY_SIZE);
- op_array.function_name = name;
- op_array.arg_types = NULL;
-
- if (is_method) {
- zend_hash_update(&CG(active_class_entry)->function_table, name, name_len+1, &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_DECLARE_FUNCTION_OR_CLASS;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_LONG;
- opline->op1.u.constant.value.lval = zend_hash_next_free_element(CG(function_table));
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- opline->op2.u.constant.value.str.val = estrndup(name, name_len);
- opline->op2.u.constant.value.str.len = name_len;
- opline->extended_value = ZEND_DECLARE_FUNCTION;
- zend_hash_next_index_insert(CG(function_table), &op_array, sizeof(zend_op_array), (void **) &CG(active_op_array));
- }
-
- if (CG(extended_info)) {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_EXT_NOP;
- opline->lineno = function_begin_line;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
- }
-}
-
-
-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_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;
- }
-
- switch (function->type) {
- case ZEND_USER_FUNCTION: {
- zend_op_array *op_array = (zend_op_array *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &op_array, sizeof(zend_function *));
- }
- break;
- case ZEND_INTERNAL_FUNCTION: {
- zend_internal_function *internal_function = (zend_internal_function *) function;
-
- zend_stack_push(&CG(function_call_stack), (void *) &internal_function, sizeof(zend_function *));
- }
- break;
- }
-}
-
-
-void do_begin_dynamic_function_call(znode *function_name CLS_DC)
-{
- unsigned char *ptr = NULL;
- int last_op_number = get_next_op_number(CG(active_op_array))-1;
-
- if (last_op_number>=0 && CG(active_op_array)->opcodes[last_op_number].opcode == ZEND_FETCH_OBJ_R) {
- CG(active_op_array)->opcodes[last_op_number].opcode = ZEND_INIT_FCALL_BY_NAME;
- CG(active_op_array)->opcodes[last_op_number].extended_value = ZEND_MEMBER_FUNC_CALL;
- } else {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- opline->op2 = *function_name;
- opline->extended_value = 0;
- SET_UNUSED(opline->op1);
- }
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
-}
-
-
-void do_begin_class_member_function_call(znode *class_name, znode *function_name CLS_DC)
-{
- unsigned char *ptr = NULL;
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_INIT_FCALL_BY_NAME;
- zend_str_tolower(class_name->u.constant.value.str.val, class_name->u.constant.value.str.len);
- opline->op1 = *class_name;
- opline->op2 = *function_name;
- opline->extended_value = ZEND_MEMBER_FUNC_CALL;
- zval_copy_ctor(&opline->op2.u.constant);
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(zend_function *));
-}
-
-
-void do_end_function_call(znode *function_name, znode *result, znode *argument_list, int is_method CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- ELS_FETCH();
-
- if (function_name->op_type==IS_CONST && !is_method) {
- opline->opcode = ZEND_DO_FCALL;
- } else {
- opline->opcode = ZEND_DO_FCALL_BY_NAME;
- }
- opline->op1 = *function_name;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- *result = opline->result;
- SET_UNUSED(opline->op2);
- opline->op2.u.constant.value.lval = is_method;
- zend_stack_del_top(&CG(function_call_stack));
- opline->extended_value = argument_list->u.constant.value.lval;
-}
-
-
-void do_pass_param(znode *param, int op, int offset CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- unsigned char *arg_types;
- int original_op=op;
- zend_function **function_ptr_ptr, *function_ptr;
-
- zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr);
- function_ptr = *function_ptr_ptr;
- if (function_ptr) {
- arg_types = function_ptr->common.arg_types;
- opline->extended_value = ZEND_DO_FCALL;
- } else {
- arg_types = NULL;
- opline->extended_value = ZEND_DO_FCALL_BY_NAME;
- }
-
- 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:
- if (function_ptr) {
- do_end_variable_parse(BP_VAR_R CLS_CC);
- } else {
- do_end_variable_parse(BP_VAR_W 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;
- INIT_PZVAL(&opline->op1.u.constant);
- }
- SET_UNUSED(opline->op2);
-}
-
-
-static void function_add_ref(zend_function *function)
-{
- if (function->type == ZEND_USER_FUNCTION) {
- (*((zend_op_array *) function)->refcount)++;
- }
-}
-
-
-ZEND_API void do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table)
-{
- switch (opline->extended_value) {
- case ZEND_DECLARE_FUNCTION: {
- zend_function *function;
-
- zend_hash_index_find(function_table, opline->op1.u.constant.value.lval, (void **) &function);
- (*function->op_array.refcount)++;
- if (zend_hash_add(function_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, function, sizeof(zend_function), NULL)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare %s()", opline->op2.u.constant.value.str.val);
- }
- }
- break;
- case ZEND_DECLARE_CLASS: {
- zend_class_entry *ce;
-
- zend_hash_index_find(class_table, opline->op1.u.constant.value.lval, (void **) &ce);
- (*ce->refcount)++;
- if (zend_hash_add(class_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, ce, sizeof(zend_class_entry), NULL)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- }
- }
- break;
- case ZEND_DECLARE_INHERITED_CLASS: {
- zend_class_entry *ce, *parent_ce;
- char *class_name, *parent_name;
- zend_function tmp_zend_function;
- zval *tmp;
-
- zend_hash_index_find(class_table, opline->op1.u.constant.value.lval, (void **) &ce);
- (*ce->refcount)++;
-
- /* Restore base class / derived class names */
- parent_name = opline->op2.u.constant.value.str.val;
- class_name = strchr(opline->op2.u.constant.value.str.val, ':');
- if (!class_name) {
- zend_error(E_COMPILE_ERROR, "Invalid runtime class entry");
- }
- *class_name++ = 0;
-
- /* Obtain parent class */
- if (zend_hash_find(class_table, parent_name, strlen(parent_name)+1, (void **) &parent_ce)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Class %s: Cannot inherit from undefined class %s", class_name, parent_name);
- }
-
- /* Perform inheritence */
- zend_hash_copy(&ce->function_table, &parent_ce->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function));
- zend_hash_copy(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- /* Register the derived class */
- if (zend_hash_add(class_table, class_name, strlen(class_name)+1, ce, sizeof(zend_class_entry), NULL)==FAILURE) {
- zend_error(E_COMPILE_ERROR, "Cannot redeclare class %s", opline->op2.u.constant.value.str.val);
- }
- }
- break;
- }
-}
-
-
-void do_early_binding(CLS_D)
-{
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- do_bind_function_or_class(opline, CG(function_table), CG(class_table));
- switch (opline->extended_value) {
- case ZEND_DECLARE_FUNCTION:
- zend_hash_index_del(CG(function_table), opline->op1.u.constant.value.lval);
- break;
- case ZEND_DECLARE_CLASS:
- zend_hash_index_del(CG(class_table), opline->op1.u.constant.value.lval);
- break;
- }
- zval_dtor(&opline->op2.u.constant);
- opline->opcode = ZEND_NOP;
- SET_UNUSED(opline->op1);
- SET_UNUSED(opline->op2);
-}
-
-
-void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPNZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC)
-{
- int next_op_number = get_next_op_number(CG(active_op_array));
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPZ_EX;
- if (expr1->op_type == IS_TMP_VAR) {
- opline->result = *expr1;
- } else {
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- }
- opline->op1 = *expr1;
- SET_UNUSED(opline->op2);
-
- op_token->u.opline_num = next_op_number;
-
- *expr1 = opline->result;
-}
-
-
-void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- *result = *expr1; /* we saved the original result in expr1 */
- opline->opcode = ZEND_BOOL;
- opline->result = *result;
- opline->op1 = *expr2;
- SET_UNUSED(opline->op2);
-
- CG(active_op_array)->opcodes[op_token->u.opline_num].op2.u.opline_num = get_next_op_number(CG(active_op_array));
-}
-
-
-void do_do_while_begin(CLS_D)
-{
- do_begin_loop(CLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void do_do_while_end(znode *do_token, znode *expr CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMPNZ;
- opline->op1 = *expr;
- opline->op2.u.opline_num = do_token->u.opline_num;
- SET_UNUSED(opline->op2);
-
- do_end_loop(do_token->u.opline_num CLS_CC);
-
- DEC_BPC(CG(active_op_array));
-}
-
-
-void do_brk_cont(int op, znode *expr CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = op;
- opline->op1.u.opline_num = CG(active_op_array)->current_brk_cont;
- SET_UNUSED(opline->op1);
- if (expr) {
- opline->op2 = *expr;
- } else {
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- INIT_PZVAL(&opline->op2.u.constant);
- opline->op2.op_type = IS_CONST;
- }
-}
-
-
-void do_switch_cond(znode *cond CLS_DC)
-{
- zend_switch_entry switch_entry;
- zend_op *opline = &CG(active_op_array)->opcodes[CG(active_op_array)->last-1];
-
- switch_entry.cond = *cond;
- switch_entry.default_case = -1;
- switch_entry.control_var = -1;
- zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry));
-
- if (opline->result.op_type == IS_VAR) {
- opline->result.u.EA.type |= EXT_TYPE_UNUSED;
- }
-
- do_begin_loop(CLS_C);
-
- INC_BPC(CG(active_op_array));
-}
-
-
-
-void do_switch_end(znode *case_list CLS_DC)
-{
- zend_op *opline;
- zend_switch_entry *switch_entry_ptr;
-
- zend_stack_top(&CG(switch_cond_stack), (void **) &switch_entry_ptr);
-
- if (case_list->u.opline_num != -1) { /* empty switch */
- int next_op_number = get_next_op_number(CG(active_op_array));
-
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
- }
-
- /* add code to jmp to default case */
- if (switch_entry_ptr->default_case != -1) {
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_JMPZ;
- opline->op1.op_type = IS_TMP_VAR;
- opline->op1.u.var = switch_entry_ptr->control_var;
- opline->op2.u.opline_num = switch_entry_ptr->default_case;
- SET_UNUSED(opline->op2);
- }
-
-
- /* remember break/continue loop information */
- CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].brk = get_next_op_number(CG(active_op_array));
- CG(active_op_array)->current_brk_cont = CG(active_op_array)->brk_cont_array[CG(active_op_array)->current_brk_cont].parent;
-
- /* emit free for the switch condition*/
- 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;
- INIT_PZVAL(&opline->op1.u.constant);
- SET_UNUSED(opline->op2);
- switch_entry_ptr->default_case = next_op_number;
-
- next_op_number = get_next_op_number(CG(active_op_array));
- if (case_list->u.opline_num==-1) {
- return;
- }
- CG(active_op_array)->opcodes[case_list->u.opline_num].op1.u.opline_num = next_op_number;
-}
-
-
-void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- int runtime_inheritence = 0;
-
- if (CG(active_class_entry)) {
- zend_error(E_COMPILE_ERROR, "Class declarations may not be nested");
- return;
- }
- CG(class_entry).type = ZEND_USER_CLASS;
- CG(class_entry).name = class_name->u.constant.value.str.val;
- CG(class_entry).name_length = class_name->u.constant.value.str.len;
- CG(class_entry).refcount = (int *) emalloc(sizeof(int));
- *CG(class_entry).refcount = 1;
-
- zend_str_tolower(CG(class_entry).name, CG(class_entry).name_length);
-
- zend_hash_init(&CG(class_entry).function_table, 10, NULL, ZEND_FUNCTION_DTOR, 0);
- zend_hash_init(&CG(class_entry).default_properties, 10, NULL, PVAL_PTR_DTOR, 0);
-
- /* code for inheritance from parent class */
- if (parent_class_name) {
- zend_class_entry *parent_class;
- zend_function tmp_zend_function;
- zval *tmp;
-
- zend_str_tolower(parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len);
-
- if (zend_hash_find(CG(class_table), parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len+1, (void **) &parent_class)==SUCCESS) {
- /* copy functions */
- zend_hash_copy(&CG(class_entry).function_table, &parent_class->function_table, (void (*)(void *)) function_add_ref, &tmp_zend_function, sizeof(zend_function));
-
- /* copy default properties */
- zend_hash_copy(&CG(class_entry).default_properties, &parent_class->default_properties, (void (*)(void *)) zval_add_ref, (void *) &tmp, sizeof(zval *));
-
- zval_dtor(&parent_class_name->u.constant);
- } else {
- runtime_inheritence = 1;
- }
- } else {
- CG(class_entry).parent = NULL;
- }
-
- CG(class_entry).handle_function_call = NULL;
- CG(class_entry).handle_property_set = NULL;
- CG(class_entry).handle_property_get = NULL;
-
- opline->opcode = ZEND_DECLARE_FUNCTION_OR_CLASS;
- opline->op1.op_type = IS_CONST;
- opline->op1.u.constant.type = IS_LONG;
- opline->op1.u.constant.value.lval = zend_hash_next_free_element(CG(class_table));
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_STRING;
- if (runtime_inheritence) {
- char *full_class_name;
-
- opline->op2.u.constant.value.str.len = parent_class_name->u.constant.value.str.len+1+CG(class_entry).name_length;
- full_class_name = opline->op2.u.constant.value.str.val = (char *) emalloc(opline->op2.u.constant.value.str.len+1);
-
- memcpy(full_class_name, parent_class_name->u.constant.value.str.val, parent_class_name->u.constant.value.str.len);
- full_class_name += parent_class_name->u.constant.value.str.len;
- full_class_name[0] = ':';
- full_class_name++;
- memcpy(full_class_name, CG(class_entry).name, CG(class_entry).name_length);
- full_class_name += CG(class_entry).name_length;
- full_class_name[0] = 0;
- opline->extended_value = ZEND_DECLARE_INHERITED_CLASS;
- } else {
- opline->op2.u.constant.value.str.val = estrndup(CG(class_entry).name, CG(class_entry).name_length);
- opline->op2.u.constant.value.str.len = CG(class_entry).name_length;
- opline->extended_value = ZEND_DECLARE_CLASS;
- }
-
- zend_hash_next_index_insert(CG(class_table), &CG(class_entry), sizeof(zend_class_entry), (void **) &CG(active_class_entry));
-}
-
-
-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;
- opline->extended_value = ZEND_MEMBER_FUNC_CALL | ZEND_CTOR_CALL;
- zend_stack_push(&CG(function_call_stack), (void *) &ptr, sizeof(unsigned char *));
-}
-
-
-void do_end_new_object(znode *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;
- break;
- case ZEND_RT: {
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_FETCH_CONSTANT;
- opline->result.op_type = IS_TMP_VAR;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *constant_name;
- *result = opline->result;
- SET_UNUSED(opline->op2);
- }
- break;
- }
-}
-
-
-void do_shell_exec(znode *result, znode *cmd CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- switch (cmd->op_type) {
- case IS_TMP_VAR:
- opline->opcode = ZEND_SEND_VAL;
- break;
- default:
- opline->opcode = ZEND_SEND_VAR;
- break;
- }
- opline->op1 = *cmd;
- opline->op2.u.opline_num = 0;
- opline->extended_value = ZEND_DO_FCALL;
- SET_UNUSED(opline->op2);
-
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_DO_FCALL;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->result.op_type = IS_TMP_VAR;
- opline->op1.u.constant.value.str.val = estrndup("shell_exec",sizeof("shell_exec")-1);
- opline->op1.u.constant.value.str.len = sizeof("shell_exec")-1;
- INIT_PZVAL(&opline->op1.u.constant);
- opline->op1.u.constant.type = IS_STRING;
- opline->op1.op_type = IS_CONST;
- opline->extended_value = 1;
- SET_UNUSED(opline->op2);
- *result = opline->result;
-}
-
-
-
-void do_init_array(znode *result, znode *expr, znode *offset 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 *offset, znode *expr)
-{
- zval *element = (zval *) emalloc(sizeof(zval));
-
- *element = expr->u.constant;
- if (offset) {
- switch (offset->u.constant.type) {
- case IS_STRING:
- zend_hash_update(result->u.constant.value.ht, offset->u.constant.value.str.val, offset->u.constant.value.str.len+1, &element, sizeof(zval *), NULL);
- zval_dtor(&offset->u.constant);
- break;
- case IS_LONG:
- zend_hash_index_update(result->u.constant.value.ht, offset->u.constant.value.lval, &element, sizeof(zval *), NULL);
- break;
- }
- } else {
- zend_hash_next_index_insert(result->u.constant.value.ht, &element, sizeof(zval *), NULL);
- }
-}
-
-
-void do_add_list_element(znode *element CLS_DC)
-{
- list_llist_element lle;
-
- if (element) {
- lle.var = *element;
- zend_llist_copy(&lle.dimensions, &CG(dimension_llist));
- zend_llist_add_element(&CG(list_llist), &lle);
- }
- (*((int *)CG(dimension_llist).tail->data))++;
-}
-
-
-void do_new_list_begin(CLS_D)
-{
- int current_dimension = 0;
- zend_llist_add_element(&CG(dimension_llist), &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);
- INIT_PZVAL(&opline->op2.u.constant);
- if (le == CG(list_llist).tail) {
- opline->extended_value = ZEND_FETCH_STANDARD;
- } else {
- opline->extended_value = ZEND_FETCH_ADD_LOCK;
- }
- last_container = opline->result;
- dimension = dimension->next;
- }
- ((list_llist_element *) le->data)->value = last_container;
- zend_llist_destroy(&((list_llist_element *) le->data)->dimensions);
- le = le->next;
- }
-
- le = CG(list_llist).head;
- while (le) {
- do_assign(result, &((list_llist_element *) le->data)->var, &((list_llist_element *) le->data)->value CLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- le = le->next;
- }
- zend_llist_destroy(&CG(dimension_llist));
- zend_llist_destroy(&CG(list_llist));
- *result = *expr;
-}
-
-
-void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
- znode lval;
-
- if (fetch_type==ZEND_FETCH_STATIC && static_assignment) {
- zval *tmp = (zval *) emalloc(sizeof(zval));
-
- convert_to_string(&varname->u.constant);
- *tmp = static_assignment->u.constant;
- if (!CG(active_op_array)->static_variables) {
- CG(active_op_array)->static_variables = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(CG(active_op_array)->static_variables, 2, NULL, PVAL_PTR_DTOR, 0);
- }
- zend_hash_update_ptr(CG(active_op_array)->static_variables, varname->u.constant.value.str.val, varname->u.constant.value.str.len+1, tmp, sizeof(zval *), NULL);
- }
-
-
- opline->opcode = ZEND_FETCH_W; /* the default mode must be Write, since fetch_simple_variable() is used to define function arguments */
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.var = get_temporary_variable(CG(active_op_array));
- opline->op1 = *varname;
- SET_UNUSED(opline->op2);
- opline->op2.u.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;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_value = opline->result;
-
- if (key->op_type != IS_UNUSED) {
- opline = get_next_op(CG(active_op_array) CLS_CC);
- opline->opcode = ZEND_FETCH_DIM_TMP_VAR;
- opline->result.op_type = IS_VAR;
- opline->result.u.EA.type = 0;
- opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
- opline->op1 = *as_token;
- opline->op2.op_type = IS_CONST;
- opline->op2.u.constant.type = IS_LONG;
- opline->op2.u.constant.value.lval = 1;
- opline->extended_value = ZEND_FETCH_STANDARD; /* ignored in fetch_dim_tmp_var, but what the hell. */
- result_key = opline->result;
- }
-
- do_assign(&dummy, value, &result_value CLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- if (key->op_type != IS_UNUSED) {
- do_assign(&dummy, key, &result_key CLS_CC);
- CG(active_op_array)->opcodes[CG(active_op_array)->last-1].result.u.EA.type |= EXT_TYPE_UNUSED;
- }
- do_free(as_token CLS_CC);
-
- do_begin_loop(CLS_C);
- INC_BPC(CG(active_op_array));
-}
-
-
-void do_foreach_end(znode *foreach_token, znode *open_brackets_token CLS_DC)
-{
- zend_op *opline = get_next_op(CG(active_op_array) CLS_CC);
-
- opline->opcode = ZEND_JMP;
- opline->op1.u.opline_num = foreach_token->u.opline_num;
- SET_UNUSED(opline->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;
-
- zendlval->u.constant.type = IS_LONG;
- retval = lex_scan(&zendlval->u.constant CLS_CC);
- switch(retval) {
- case T_COMMENT:
- case T_OPEN_TAG:
- case T_WHITESPACE:
- case T_PHP_TRACK_VARS:
- retval = zendlex(zendlval CLS_CC);
- break;
- case T_CLOSE_TAG:
- retval = ';'; /* implicit ; */
- break;
- case T_OPEN_TAG_WITH_ECHO:
- retval = T_ECHO;
- break;
- }
-
- INIT_PZVAL(&zendlval->u.constant);
- zendlval->op_type = IS_CONST;
- return retval;
-}
diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h
deleted file mode 100644
index b1ad05ca1b..0000000000
--- a/Zend/zend_compile.h
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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
-
-#ifndef ZTS
-#define SUPPORT_INTERACTIVE 1
-#else
-#define SUPPORT_INTERACTIVE 0
-#endif
-
-#define FREE_PNODE(znode) zval_dtor(&znode->u.constant);
-#define FREE_OP(op, should_free) if (should_free) zval_dtor(&Ts[(op)->u.var].tmp_var);
-
-
-#if SUPPORT_INTERACTIVE
-#define INC_BPC(op_array) ((op_array)->backpatch_count++)
-#define DEC_BPC(op_array) ((op_array)->backpatch_count--)
-#define HANDLE_INTERACTIVE() if (EG(interactive)) { execute_new_code(CLS_C); }
-#else
-#define INC_BPC(op_array)
-#define DEC_BPC(op_array)
-#define HANDLE_INTERACTIVE()
-#endif
-
-typedef struct _zend_op_array zend_op_array;
-
-typedef struct _znode {
- int op_type;
- union {
- zval constant;
-
- int var;
- int opline_num;
- zend_op_array *op_array;
- struct {
- int var; /* dummy */
- int type;
- } EA;
- } u;
-} znode;
-
-
-typedef struct _zend_op {
- int opcode;
- znode result;
- znode op1;
- znode op2;
- ulong extended_value;
- char *filename;
- uint lineno;
-} zend_op;
-
-
-typedef struct _zend_brk_cont_element {
- int cont;
- int brk;
- int parent;
-} zend_brk_cont_element;
-
-
-struct _zend_op_array {
- int type; /* MUST be the first element of this struct! */
-
- unsigned char *arg_types; /* MUST be the second element of this struct! */
-
- 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 uses_globals;
-
- /* static variables support */
- HashTable *static_variables;
-
-#if SUPPORT_INTERACTIVE
- int start_op_number, end_op_number;
- int last_executed_op_number;
- int backpatch_count;
-#endif
-
- void *reserved[4];
-};
-
-
-typedef struct _zend_internal_function {
- int type; /* MUST be the first element of this struct! */
-
- unsigned char *arg_types; /* MUST be the second element of this struct */
-
- void (*handler)(INTERNAL_FUNCTION_PARAMETERS);
- char *function_name;
-} zend_internal_function;
-
-
-typedef union _zend_function {
- int type; /* MUST be the first element of this struct! */
- struct {
- int type; /* never used */
- unsigned char *arg_types;
- } common;
-
- zend_op_array op_array;
- zend_internal_function internal_function;
-} zend_function;
-
-
-typedef struct _zend_function_state {
- HashTable *function_symbol_table;
- zend_function *function;
- void *reserved[4];
-} zend_function_state;
-
-
-typedef struct _zend_switch_entry {
- znode cond;
- int default_case;
- int control_var;
-} zend_switch_entry;
-
-
-typedef struct _list_llist_element {
- znode var;
- zend_llist dimensions;
- znode value;
-} list_llist_element;
-
-
-typedef struct _zend_file_handle {
- int type;
- char *filename;
- 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);
-
-BEGIN_EXTERN_C()
-extern ZEND_API zend_op_array *(*zend_compile_files)(int mark_as_ref CLS_DC, int file_count, ...);
-
-void zend_activate(CLS_D ELS_DC);
-void zend_deactivate(CLS_D ELS_DC);
-
-int lex_scan(zval *zendlval CLS_DC);
-void startup_scanner(CLS_D);
-void shutdown_scanner(CLS_D);
-
-ZEND_API 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();
-
-#ifdef ZTS
-const char *zend_get_zendtext(CLS_D);
-int zend_get_zendleng(CLS_D);
-#endif
-
-END_EXTERN_C()
-
-/* parser-driven code generators */
-void do_binary_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
-void do_unary_op(int op, znode *result, znode *op1 CLS_DC);
-void do_binary_assign_op(int op, znode *result, znode *op1, znode *op2 CLS_DC);
-void do_assign(znode *result, znode *variable, znode *value CLS_DC);
-void do_assign_ref(znode *result, znode *lvar, znode *rvar CLS_DC);
-void fetch_simple_variable(znode *result, znode *varname, int bp CLS_DC);
-void do_indirect_references(znode *result, znode *num_references, znode *variable CLS_DC);
-void do_fetch_global_or_static_variable(znode *varname, znode *static_assignment, int fetch_type CLS_DC);
-void do_fetch_globals(znode *varname CLS_DC);
-
-void fetch_array_begin(znode *result, znode *varname, znode *first_dim CLS_DC);
-void fetch_array_dim(znode *result, znode *parent, znode *dim CLS_DC);
-void do_print(znode *result, znode *arg CLS_DC);
-void do_echo(znode *arg CLS_DC);
-typedef int (*unary_op_type)(zval *, zval *);
-ZEND_API unary_op_type get_unary_op(int opcode);
-ZEND_API void *get_binary_op(int opcode);
-
-void do_while_cond(znode *expr, znode *close_bracket_token CLS_DC);
-void do_while_end(znode *while_token, znode *close_bracket_token CLS_DC);
-void do_do_while_begin(CLS_D);
-void do_do_while_end(znode *do_token, znode *expr CLS_DC);
-
-
-void do_if_cond(znode *cond, znode *closing_bracket_token CLS_DC);
-void do_if_after_statement(znode *closing_bracket_token, unsigned char initialize CLS_DC);
-void do_if_end(CLS_D);
-
-void do_for_cond(znode *expr, znode *second_semicolon_token CLS_DC);
-void do_for_before_statement(znode *cond_start, znode *second_semicolon_token CLS_DC);
-void do_for_end(znode *second_semicolon_token CLS_DC);
-
-void do_pre_incdec(znode *result, znode *op1, int op CLS_DC);
-void do_post_incdec(znode *result, znode *op1, int op CLS_DC);
-
-void do_begin_variable_parse(CLS_D);
-void do_end_variable_parse(int type CLS_DC);
-
-void do_free(znode *op1 CLS_DC);
-
-void do_init_string(znode *result CLS_DC);
-void do_add_char(znode *result, znode *op1, znode *op2 CLS_DC);
-void do_add_string(znode *result, znode *op1, znode *op2 CLS_DC);
-void do_add_variable(znode *result, znode *op1, znode *op2 CLS_DC);
-
-void do_begin_function_declaration(znode *function_token, znode *function_name, int is_method CLS_DC);
-void do_end_function_declaration(znode *function_token CLS_DC);
-void do_receive_arg(int op, znode *var, znode *offset, znode *initialization, unsigned char pass_type CLS_DC);
-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);
-ZEND_API void do_bind_function_or_class(zend_op *opline, HashTable *function_table, HashTable *class_table);
-void do_early_binding(CLS_D);
-
-void do_pass_param(znode *param, int op, int offset CLS_DC);
-
-
-void do_boolean_or_begin(znode *expr1, znode *op_token CLS_DC);
-void do_boolean_or_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
-void do_boolean_and_begin(znode *expr1, znode *op_token CLS_DC);
-void do_boolean_and_end(znode *result, znode *expr1, znode *expr2, znode *op_token CLS_DC);
-
-void do_brk_cont(int op, znode *expr CLS_DC);
-
-void do_switch_cond(znode *cond CLS_DC);
-void do_switch_end(znode *case_list CLS_DC);
-void do_case_before_statement(znode *case_list, znode *case_token, znode *case_expr CLS_DC);
-void do_case_after_statement(znode *result, znode *case_token CLS_DC);
-void do_default_before_statement(znode *case_list, znode *default_token CLS_DC);
-
-void do_begin_class_declaration(znode *class_name, znode *parent_class_name CLS_DC);
-void do_end_class_declaration(CLS_D);
-void do_declare_property(znode *var_name, znode *value CLS_DC);
-
-void do_fetch_property(znode *result, znode *object, znode *property CLS_DC);
-
-
-void do_push_object(znode *object CLS_DC);
-void do_pop_object(znode *object CLS_DC);
-
-
-void do_begin_new_object(znode *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 *offset, znode *expr);
-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);
-
-#define INITIAL_OP_ARRAY_SIZE 64
-
-
-/* helper functions in zend-scanner.l */
-BEGIN_EXTERN_C()
-ZEND_API int require_file(zend_file_handle *file_handle 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 CLS_DC, int file_count, va_list files);
-ZEND_API zend_op_array *compile_string(zval *source_string CLS_DC);
-ZEND_API zend_op_array *compile_filename(zval *filename CLS_DC);
-ZEND_API inline int open_file_for_scanning(zend_file_handle *file_handle CLS_DC);
-ZEND_API void init_op_array(zend_op_array *op_array, int initial_ops_size);
-ZEND_API void destroy_op_array(zend_op_array *op_array);
-ZEND_API void zend_close_file_handle(zend_file_handle *file_handle CLS_DC);
-ZEND_API void zend_open_file_dtor(void *f);
-END_EXTERN_C()
-
-ZEND_API int destroy_zend_function(zend_function *function);
-ZEND_API int destroy_zend_class(zend_class_entry *ce);
-void zend_class_add_ref(zend_class_entry *ce);
-
-#define ZEND_FUNCTION_DTOR (int (*)(void *)) destroy_zend_function
-#define ZEND_CLASS_DTOR (int (*)(void *)) destroy_zend_class
-
-zend_op *get_next_op(zend_op_array *op_array CLS_DC);
-int get_next_op_number(zend_op_array *op_array);
-int print_class(zend_class_entry *class_entry);
-void print_op_array(zend_op_array *op_array, int optimizations);
-BEGIN_EXTERN_C()
-int pass_two(zend_op_array *op_array);
-void pass_include_eval(zend_op_array *op_array);
-END_EXTERN_C()
-zend_brk_cont_element *get_next_brk_cont_element(zend_op_array *op_array);
-
-
-int zendlex(znode *zendlval CLS_DC);
-
-
-#define ZEND_NOP 0
-
-#define ZEND_ADD 1
-#define ZEND_SUB 2
-#define ZEND_MUL 3
-#define ZEND_DIV 4
-#define ZEND_MOD 5
-#define ZEND_SL 6
-#define ZEND_SR 7
-#define ZEND_CONCAT 8
-#define ZEND_BW_OR 9
-#define ZEND_BW_AND 10
-#define ZEND_BW_XOR 11
-#define ZEND_BW_NOT 12
-#define ZEND_BOOL_NOT 13
-#define ZEND_BOOL_XOR 14
-#define ZEND_IS_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 38
-#define ZEND_PRINT 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_BY_NAME 56
-#define ZEND_DO_FCALL 57
-#define ZEND_DO_FCALL_BY_NAME 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_DECLARE_FUNCTION_OR_CLASS 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_EVAL_CODE 4
-
-#define ZEND_INTERNAL_CLASS 1
-#define ZEND_USER_CLASS 2
-
-#define ZEND_EVAL (1<<0)
-#define ZEND_INCLUDE (1<<1)
-
-#define ZEND_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
-
-#define ZEND_DECLARE_CLASS 1
-#define ZEND_DECLARE_FUNCTION 2
-#define ZEND_DECLARE_INHERITED_CLASS 3
-
-#define ZEND_FETCH_STANDARD 0
-#define ZEND_FETCH_ADD_LOCK 1
-
-#define ZEND_MEMBER_FUNC_CALL 1<<0
-#define ZEND_CTOR_CALL 1<<1
-
-
-#define PZVAL_IS_REF(z) ((z)->EA.is_ref)
-#define PZVAL_IS_LOCKED(z) ((z)->EA.locks>0)
-
-#define PZVAL_LOCK(z) (z)->EA.locks++
-#define PZVAL_UNLOCK(z) (z)->EA.locks--
-
-
-#endif /* _COMPILE_H */
diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c
deleted file mode 100644
index 0dab84dab4..0000000000
--- a/Zend/zend_constants.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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"
-
-
-int free_zend_constant(zend_constant *c)
-{
- if (!(c->flags & CONST_PERSISTENT)) {
- zval_dtor(&c->value);
- }
- free(c->name);
- return 1;
-}
-
-
-void copy_zend_constant(zend_constant *c)
-{
- c->name = zend_strndup(c->name, c->name_len);
- zval_copy_ctor(&c->value);
-}
-
-
-void zend_copy_constants(HashTable *target, HashTable *source)
-{
- zend_constant tmp_constant;
-
- zend_hash_copy(target, source, (void (*)(void *)) copy_zend_constant, &tmp_constant, sizeof(zend_constant));
-}
-
-
-static int clean_non_persistent_constant(zend_constant *c)
-{
- if (c->flags & CONST_PERSISTENT) {
- return 0;
- } else {
- return 1;
- }
-}
-
-
-static int clean_module_constant(zend_constant *c, int *module_number)
-{
- if (c->module_number == *module_number) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-void clean_module_constants(int module_number)
-{
- ELS_FETCH();
-
- zend_hash_apply_with_argument(EG(zend_constants), (int (*)(void *,void *)) clean_module_constant, (void *) &module_number);
-}
-
-
-int zend_startup_constants(HashTable *constants ELS_DC)
-{
-#if WIN32|WINNT
- DWORD dwBuild=0;
- DWORD dwVersion = GetVersion();
- DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
- DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
-#endif
-
- EG(zend_constants) = (HashTable *) malloc(sizeof(HashTable));
-
- if (zend_hash_init(EG(zend_constants), 20, NULL, ZEND_CONSTANT_DTOR, 1)==FAILURE) {
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-
-void zend_register_standard_constants(ELS_D)
-{
- /* ZEND_FIX: Move to PHP */
-#if 0
-#if WIN32|WINNT
- // Get build numbers for Windows NT or Win95
- if (dwVersion < 0x80000000){
- php3_os="WINNT";
- } else {
- php3_os="WIN32";
- }
-#else
- php3_os=PHP_OS;
-#endif
-#endif
-
-
-#if 0
- /* This should go back to PHP */
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_VERSION", PHP_VERSION, sizeof(PHP_VERSION)-1, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_STRINGL_CONSTANT("PHP_OS", php3_os, strlen(php3_os), CONST_PERSISTENT | CONST_CS);
-#endif
- REGISTER_MAIN_LONG_CONSTANT("E_ERROR", E_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_WARNING", E_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_PARSE", E_PARSE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_NOTICE", E_NOTICE, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_ERROR", E_CORE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_CORE_WARNING", E_CORE_WARNING, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_ERROR", E_COMPILE_ERROR, CONST_PERSISTENT | CONST_CS);
- REGISTER_MAIN_LONG_CONSTANT("E_COMPILE_WARNING", E_COMPILE_WARNING, CONST_PERSISTENT | CONST_CS);
-
- REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
-
- /* true/false constants */
- {
- zend_constant c;
-
- c.value.type = IS_BOOL;
- c.flags = CONST_PERSISTENT;
- c.module_number = 0;
-
- c.name = zend_strndup("TRUE",4);
- c.name_len = 5;
- c.value.value.lval = 1;
- c.value.type = IS_BOOL;
- zend_register_constant(&c ELS_CC);
-
- c.name = zend_strndup("FALSE",5);
- c.name_len = 6;
- c.value.value.lval = 0;
- c.value.type = IS_BOOL;
- zend_register_constant(&c ELS_CC);
- }
-}
-
-
-int zend_shutdown_constants(ELS_D)
-{
- zend_hash_destroy(EG(zend_constants));
- free(EG(zend_constants));
- return SUCCESS;
-}
-
-
-void clean_non_persistent_constants(void)
-{
- ELS_FETCH();
-
- zend_hash_apply(EG(zend_constants), (int (*)(void *)) clean_non_persistent_constant);
-}
-
-
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_LONG;
- c.value.value.lval = lval;
- c.flags = flags;
- c.name = zend_strndup(name,name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c ELS_CC);
-}
-
-
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_DOUBLE;
- c.value.value.dval = dval;
- c.flags = flags;
- c.name = zend_strndup(name,name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c ELS_CC);
-}
-
-
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC)
-{
- zend_constant c;
-
- c.value.type = IS_STRING;
- c.value.value.str.val = strval;
- c.value.value.str.len = strlen;
- c.flags = flags;
- c.name = zend_strndup(name,name_len);
- c.name_len = name_len;
- c.module_number = module_number;
- zend_register_constant(&c ELS_CC);
-}
-
-
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC)
-{
- zend_register_stringl_constant(name, name_len, strval, strlen(strval), flags, module_number ELS_CC);
-}
-
-
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result)
-{
- zend_constant *c;
- char *lookup_name = estrndup(name,name_len);
- int retval;
- ELS_FETCH();
-
- zend_str_tolower(lookup_name, name_len);
-
- if (zend_hash_find(EG(zend_constants), lookup_name, name_len+1, (void **) &c)==SUCCESS) {
- if ((c->flags & CONST_CS) && memcmp(c->name, name, name_len)!=0) {
- retval=0;
- } else {
- retval=1;
- *result = c->value;
- zval_copy_ctor(result);
- }
- } else {
- retval=0;
- }
-
- efree(lookup_name);
- return retval;
-}
-
-
-ZEND_API void zend_register_constant(zend_constant *c ELS_DC)
-{
- char *lowercase_name = zend_strndup(c->name, c->name_len);
-
-#if 0
- printf("Registering constant for module %d\n",c->module_number);
-#endif
-
- zend_str_tolower(lowercase_name, c->name_len);
- if (zend_hash_add(EG(zend_constants), lowercase_name, c->name_len, (void *) c, sizeof(zend_constant), NULL)==FAILURE) {
- zval_dtor(&c->value);
- }
- free(lowercase_name);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_constants.h b/Zend/zend_constants.h
deleted file mode 100644
index 39599dba7b..0000000000
--- a/Zend/zend_constants.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _CONSTANTS_H
-#define _CONSTANTS_H
-
-#include "zend_globals.h"
-
-#define CONST_CS 0x1 /* Case Sensitive */
-#define CONST_PERSISTENT 0x2
-
-typedef struct _zend_constant {
- zval value;
- int flags;
- char *name;
- uint name_len;
- int module_number;
-} zend_constant;
-
-#define REGISTER_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),module_number ELS_CC)
-#define REGISTER_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),module_number ELS_CC)
-#define REGISTER_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),module_number ELS_CC)
-#define REGISTER_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),module_number ELS_CC)
-
-#define REGISTER_MAIN_LONG_CONSTANT(name,lval,flags) zend_register_long_constant((name),sizeof(name),(lval),(flags),0 ELS_CC)
-#define REGISTER_MAIN_DOUBLE_CONSTANT(name,dval,flags) zend_register_double_constant((name),sizeof(name),(dval),(flags),0 ELS_CC)
-#define REGISTER_MAIN_STRING_CONSTANT(name,str,flags) zend_register_string_constant((name),sizeof(name),(str),(flags),0 ELS_CC)
-#define REGISTER_MAIN_STRINGL_CONSTANT(name,str,len,flags) zend_register_stringl_constant((name),sizeof(name),(str),(len),(flags),0 ELS_CC)
-
-void clean_module_constants(int module_number);
-int free_zend_constant(zend_constant *c);
-int zend_startup_constants(HashTable *constants ELS_DC);
-int zend_shutdown_constants(ELS_D);
-void zend_register_standard_constants(ELS_D);
-void clean_non_persistent_constants(void);
-ZEND_API int zend_get_constant(char *name, uint name_len, zval *result);
-ZEND_API void zend_register_long_constant(char *name, uint name_len, long lval, int flags, int module_number ELS_DC);
-ZEND_API void zend_register_double_constant(char *name, uint name_len, double dval, int flags, int module_number ELS_DC);
-ZEND_API void zend_register_string_constant(char *name, uint name_len, char *strval, int flags, int module_number ELS_DC);
-ZEND_API void zend_register_stringl_constant(char *name, uint name_len, char *strval, uint strlen, int flags, int module_number ELS_DC);
-ZEND_API void zend_register_constant(zend_constant *c ELS_DC);
-void zend_copy_constants(HashTable *target, HashTable *sourc);
-
-#define ZEND_CONSTANT_DTOR (int (*)(void *)) free_zend_constant
-
-#endif
diff --git a/Zend/zend_errors.h b/Zend/zend_errors.h
deleted file mode 100644
index 36b6123d14..0000000000
--- a/Zend/zend_errors.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_ERRORS_H
-#define _ZEND_ERRORS_H
-
-#define E_ERROR (1<<0L)
-#define E_WARNING (1<<1L)
-#define E_PARSE (1<<2L)
-#define E_NOTICE (1<<3L)
-#define E_CORE_ERROR (1<<4L)
-#define E_CORE_WARNING (1<<5L)
-#define E_COMPILE_ERROR (1<<6L)
-#define E_COMPILE_WARNING (1<<7L)
-
-#define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING)
-#define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
-
-#endif /* _ZEND_ERRORS_H */
-
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
deleted file mode 100644
index ca8a7303bc..0000000000
--- a/Zend/zend_execute.c
+++ /dev/null
@@ -1,1961 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-#include <signal.h>
-
-#if (HAVE_ALLOCA && HAVE_ALLOCA_H)
-#include <alloca.h>
-#endif
-
-#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"
-
-
-#define SELECTIVE_PZVAL_LOCK(pzv, pzn) if (!((pzn)->u.EA.type & EXT_TYPE_UNUSED)) { PZVAL_LOCK(pzv); }
-
-#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) {
- PZVAL_UNLOCK(*Ts[node->u.var].var);
- *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.EA.is_ref=1;
- Ts[node->u.var].tmp_var.EA.locks=0;
- 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.EA.is_ref=1;
- T->tmp_var.EA.locks=0;
- 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) {
- PZVAL_UNLOCK(*Ts[node->u.var].var);
- }
- 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 = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update_ptr(ht, prop_ptr->value.str.val, prop_ptr->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
-
- if (prop_ptr == &tmp) {
- zval_dtor(prop_ptr);
- }
- FREE_OP(op2, free_op2);
- return retval;
-}
-
-
-static inline void zend_assign_to_variable(znode *result, znode *op1, znode *op2, zval *value, int type, temp_variable *Ts ELS_DC)
-{
- zval **variable_ptr_ptr = get_zval_ptr_ptr(op1, Ts, BP_VAR_W);
- zval *variable_ptr;
- int previous_lock_count;
-
- 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 (op2
- && op2->op_type == IS_VAR
- && value==&Ts[op2->u.var].tmp_var) {
- efree(value->value.str.val);
- }
- 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);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var, 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);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var, result);
- }
- return;
- }
-
- if (PZVAL_IS_REF(variable_ptr)) {
- if (variable_ptr!=value) {
- short refcount=variable_ptr->refcount;
-
- previous_lock_count = variable_ptr->EA.locks;
- if (type!=IS_TMP_VAR) {
- value->refcount++;
- }
- zendi_zval_dtor(*variable_ptr);
- *variable_ptr = *value;
- variable_ptr->refcount = refcount;
- variable_ptr->EA.is_ref = 1;
- variable_ptr->EA.locks = previous_lock_count;
- if (type!=IS_TMP_VAR) {
- zendi_zval_copy_ctor(*variable_ptr);
- zval_ptr_dtor(&value);
- }
- }
- } else {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- switch (type) {
- case IS_VAR:
- case IS_CONST:
- if (variable_ptr==value) {
- variable_ptr->refcount++;
- } else if (PZVAL_IS_REF(value)) {
- zval tmp = *value;
-
- previous_lock_count = variable_ptr->EA.locks;
- tmp = *value;
- zval_copy_ctor(&tmp);
- tmp.refcount=1;
- tmp.EA.locks = previous_lock_count;
- zendi_zval_dtor(*variable_ptr);
- *variable_ptr = tmp;
- } else {
- value->refcount++;
- zendi_zval_dtor(*variable_ptr);
- safe_free_zval_ptr(variable_ptr);
- *variable_ptr_ptr = value;
- }
- break;
- case IS_TMP_VAR:
- zendi_zval_dtor(*variable_ptr);
- value->refcount=1;
- previous_lock_count = variable_ptr->EA.locks;
- *variable_ptr = *value;
- variable_ptr->EA.locks = previous_lock_count;
- break;
- }
- } else { /* we need to split */
- switch (type) {
- case IS_VAR:
- case IS_CONST:
- if (PZVAL_IS_REF(value)) {
- variable_ptr = *variable_ptr_ptr = (zval *) emalloc(sizeof(zval));
- *variable_ptr = *value;
- zval_copy_ctor(variable_ptr);
- variable_ptr->refcount=1;
- variable_ptr->EA.locks = 0;
- break;
- }
- *variable_ptr_ptr = value;
- value->refcount++;
- break;
- case IS_TMP_VAR:
- (*variable_ptr_ptr) = (zval *) emalloc(sizeof(zval));
- value->refcount=1;
- value->EA.locks = 0;
- **variable_ptr_ptr = *value;
- break;
- }
- }
- (*variable_ptr_ptr)->EA.is_ref=0;
- }
- if (result) {
- Ts[result->u.var].var = variable_ptr_ptr;
- SELECTIVE_PZVAL_LOCK(*variable_ptr_ptr, 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)
-{
- 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:
- if (op1->op_type == IS_VAR) {
- PZVAL_LOCK(varname);
- }
- target_symbol_table = &EG(symbol_table);
- break;
- case ZEND_FETCH_STATIC:
- if (!EG(active_op_array)->static_variables) {
- EG(active_op_array)->static_variables = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, PVAL_PTR_DTOR, 0);
- }
- target_symbol_table = EG(active_op_array)->static_variables;
- break;
- }
-
- if (varname->type != IS_STRING) {
- tmp_varname = *varname;
- zval_copy_ctor(&tmp_varname);
- convert_to_string(&tmp_varname);
- varname = &tmp_varname;
- }
- if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined variable: %s", varname->value.str.val);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update_ptr(target_symbol_table, varname->value.str.val, varname->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- if (op2->u.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;
- SELECTIVE_PZVAL_LOCK(*retval, result);
-}
-
-
-static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, znode *op2, temp_variable *Ts, int type ELS_DC)
-{
- int free_op2;
- zval *dim = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R);
- zval **retval;
-
- switch (dim->type) {
- case IS_STRING: {
- if (zend_hash_find(ht, dim->value.str.val, dim->value.str.len+1, (void **) &retval) == FAILURE) {
- switch (type) {
- case BP_VAR_R:
- zend_error(E_NOTICE,"Undefined index: %s", dim->value.str.val);
- /* break missing intentionally */
- case BP_VAR_IS:
- retval = &EG(uninitialized_zval_ptr);
- break;
- case BP_VAR_RW:
- zend_error(E_NOTICE,"Undefined index: %s", dim->value.str.val);
- /* break missing intentionally */
- case BP_VAR_W: {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_update_ptr(ht, dim->value.str.val, dim->value.str.len+1, new_zval, sizeof(zval *), (void **) &retval);
- }
- break;
- }
- }
- }
- break;
- case IS_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 = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- 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)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- if (container->type == IS_STRING && container->value.str.len==0) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- container->refcount--;
- if (container->refcount>0) {
- container = *container_ptr = (zval *) emalloc(sizeof(zval));
- container->EA.is_ref=0;
- container->EA.locks = 0;
- }
- container->refcount=1;
- }
- array_init(container);
- break;
- }
- }
-
- switch (container->type) {
- case IS_ARRAY:
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- container->refcount--;
- *container_ptr = (zval *) emalloc(sizeof(zval));
- **container_ptr = *container;
- container = *container_ptr;
- INIT_PZVAL(container);
- zendi_zval_copy_ctor(*container);
- }
- if (op2->op_type == IS_UNUSED) {
- zval *new_zval = &EG(uninitialized_zval);
-
- new_zval->refcount++;
- zend_hash_next_index_insert_ptr(container->value.ht, new_zval, sizeof(zval *), (void **) retval);
- } else {
- *retval = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, type ELS_CC);
- }
- SELECTIVE_PZVAL_LOCK(**retval, result);
- break;
- case IS_STRING: {
- zval *offset;
- offset = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R);
-
- if (container->value.str.val == undefined_variable_string) {
- /* for read-mode only */
- *retval = &EG(uninitialized_zval_ptr);
- 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);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- }
- break;
- }
-}
-
-
-static inline void zend_fetch_dimension_address_from_tmp_var(znode *result, znode *op1, znode *op2, temp_variable *Ts ELS_DC)
-{
- int free_op1;
- zval *container = get_zval_ptr(op1, Ts, &free_op1, BP_VAR_R);
-
- if (container->type != IS_ARRAY) {
- Ts[result->u.var].var = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var, result);
- return;
- }
-
- Ts[result->u.var].var = zend_fetch_dimension_address_inner(container->value.ht, op2, Ts, BP_VAR_R ELS_CC);
- SELECTIVE_PZVAL_LOCK(*Ts[result->u.var].var, result);
-}
-
-
-static inline void zend_fetch_property_address(znode *result, znode *op1, znode *op2, temp_variable *Ts, int type ELS_DC)
-{
- int free_op2;
- zval **container_ptr = get_zval_ptr_ptr(op1, Ts, type);
- zval *container;
- zval ***retval = &Ts[result->u.var].var;
-
-
- 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)) {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
-
- if (container->type == IS_OBJECT
- && container->value.obj.ce->handle_property_get) {
- zend_property_reference property_reference;
- zend_overloaded_element overloaded_element;
-
- property_reference.object = container_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.len==0) {
- switch (type) {
- case BP_VAR_RW:
- case BP_VAR_W:
- if (!PZVAL_IS_REF(container)) {
- container->refcount--;
- if (container->refcount>0) {
- container = *container_ptr = (zval *) emalloc(sizeof(zval));
- container->EA.is_ref=0;
- container->EA.locks = 0;
- }
- container->refcount=1;
- }
- object_init(container);
- break;
- }
- }
-
- if (container->type != IS_OBJECT) {
- zval *offset;
-
- offset = get_zval_ptr(op2, Ts, &free_op2, BP_VAR_R);
- FREE_OP(op2, free_op2);
- if (type==BP_VAR_R || type==BP_VAR_IS) {
- *retval = &EG(uninitialized_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- } else {
- *retval = &EG(error_zval_ptr);
- SELECTIVE_PZVAL_LOCK(**retval, result);
- return;
- }
- }
-
-
- if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
- container->refcount--;
- *container_ptr = (zval *) emalloc(sizeof(zval));
- **container_ptr = *container;
- container = *container_ptr;
- INIT_PZVAL(container);
- zendi_zval_copy_ctor(*container);
- }
- *retval = zend_fetch_property_address_inner(container->value.obj.properties, op2, Ts, type ELS_CC);
- SELECTIVE_PZVAL_LOCK(**retval, result);
-}
-
-
-static zval get_overloaded_property(ELS_D)
-{
- zend_property_reference *property_reference;
- zval result;
-
- zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
- result = (*(property_reference->object))->value.obj.ce->handle_property_get(property_reference);
-
- zend_llist_destroy(&property_reference->elements_list);
-
- zend_stack_del_top(&EG(overloaded_objects_stack));
- return result;
-}
-
-
-static void set_overloaded_property(zval *value ELS_DC)
-{
- zend_property_reference *property_reference;
-
- zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
- (*(property_reference->object))->value.obj.ce->handle_property_set(property_reference, value);
-
- zend_llist_destroy(&property_reference->elements_list);
-
- zend_stack_del_top(&EG(overloaded_objects_stack));
-}
-
-
-static void call_overloaded_function(int arg_count, zval *return_value, HashTable *list, HashTable *plist ELS_DC)
-{
- zend_property_reference *property_reference;
-
- zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
- (*(property_reference->object))->value.obj.ce->handle_function_call(arg_count, return_value, list, plist, *property_reference->object, property_reference);
- zend_llist_destroy(&property_reference->elements_list);
-
- zend_stack_del_top(&EG(overloaded_objects_stack));
-}
-
-
-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && (WINNT|WIN32))
-# define do_alloca(p) alloca(p)
-# define free_alloca(p)
-#else
-# define do_alloca(p) emalloc(p)
-# define free_alloca(p) efree(p)
-#endif
-
-
-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 *) do_alloca(sizeof(temp_variable)*op_array->T);
-#else
- temp_variable Ts[op_array->T];
-#endif
-
-#if SUPPORT_INTERACTIVE
- if (EG(interactive)) {
- opline = op_array->opcodes + op_array->start_op_number;
- end = op_array->opcodes + op_array->end_op_number;
- }
-#endif
-
- EG(opline_ptr) = &opline;
-
- function_state.function = (zend_function *) op_array;
- EG(function_state_ptr) = &function_state;
-#if ZEND_DEBUG
- /* function_state.function_symbol_table is saved as-is to a stack,
- * which is an intentional UMR. Shut it up if we're in DEBUG.
- */
- function_state.function_symbol_table = NULL;
-#endif
-
- if (op_array->uses_globals) {
- zval *globals = (zval *) emalloc(sizeof(zval));
-
- globals->refcount=1;
- globals->EA.is_ref=1;
- globals->EA.locks = 0;
- globals->type = IS_ARRAY;
- globals->value.ht = &EG(symbol_table);
- if (zend_hash_add(EG(active_symbol_table), "GLOBALS", sizeof("GLOBALS"), &globals, sizeof(zval *), NULL)==FAILURE) {
- efree(globals);
- }
- }
-
- while (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);
- int previous_lock_count;
-
- 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);
- SELECTIVE_PZVAL_LOCK(*Ts[opline->result.u.var].var, &opline->result);
- opline++;
- continue;
- }
- if (!PZVAL_IS_REF(*var_ptr)) {
- if ((*var_ptr)->refcount>1) {
- zval *orig_var=*var_ptr;
-
- (*var_ptr)->refcount--;
- *var_ptr = (zval *) emalloc(sizeof(zval));
- **var_ptr = *orig_var;
- zendi_zval_copy_ctor(**var_ptr);
- (*var_ptr)->refcount=1;
- (*var_ptr)->EA.locks = 0;
- }
- }
- previous_lock_count = (*var_ptr)->EA.locks;
- binary_op(*var_ptr, *var_ptr, get_zval_ptr(&opline->op2, Ts, &free_op2, BP_VAR_R));
- (*var_ptr)->EA.locks = previous_lock_count;
- Ts[opline->result.u.var].var = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &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);
- SELECTIVE_PZVAL_LOCK(*Ts[opline->result.u.var].var, &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 (!PZVAL_IS_REF(*var_ptr)) {
- if ((*var_ptr)->refcount>1) {
- zval *orig_var = *var_ptr;
-
- (*var_ptr)->refcount--;
- *var_ptr = (zval *) emalloc(sizeof(zval));
- **var_ptr = *orig_var;
- zendi_zval_copy_ctor(**var_ptr);
- (*var_ptr)->refcount=1;
- (*var_ptr)->EA.locks = 0;
- }
- }
- incdec_op(*var_ptr);
- switch (opline->opcode) {
- case ZEND_PRE_INC:
- case ZEND_PRE_DEC:
- Ts[opline->result.u.var].var = var_ptr;
- SELECTIVE_PZVAL_LOCK(*var_ptr, &opline->result);
- break;
- }
- }
- break;
- case ZEND_PRINT:
- 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:
- 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:
- if (opline->extended_value == ZEND_FETCH_ADD_LOCK) {
- PZVAL_LOCK(*Ts[opline->op1.u.var].var);
- }
- 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, &opline->op2, 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);
- 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 use_copy;
-
- zend_make_printable_zval(var, &var_copy, &use_copy);
- if (use_copy) {
- var = &var_copy;
- }
- add_string_to_string( &Ts[opline->result.u.var].tmp_var,
- get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_NA),
- var);
- if (use_copy) {
- zval_dtor(var);
- }
- /* original comment, possibly problematic:
- * FREE_OP is missing intentionally here - we're always working on the same temporary variable
- * (Zeev): I don't think it's problematic, we only use variables
- * which aren't affected by FREE_OP()'s anyway, unless they're
- * string offsets or overloaded objects
- */
- FREE_OP(&opline->op2, free_op2);
- }
- break;
- case ZEND_INIT_FCALL_BY_NAME: {
- zval *function_name;
- zend_function *function;
- HashTable *active_function_table;
- zval tmp;
-
- zend_ptr_stack_push(&EG(arg_types_stack), function_being_called);
- zend_ptr_stack_push(&EG(arg_types_stack), object_ptr);
-
- if (opline->extended_value & ZEND_CTOR_CALL) {
- /* constructor call */
- PZVAL_LOCK(*Ts[opline->op1.u.var].var);
- if (opline->op2.op_type==IS_VAR) {
- PZVAL_LOCK(*Ts[opline->op2.u.var].var);
- }
- }
- 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)->type==IS_OBJECT && (*object_ptr)->value.obj.ce->handle_function_call)) { /* overloaded function call */
- zend_overloaded_element overloaded_element;
- zend_property_reference *property_reference;
-
- overloaded_element.element = *function_name;
- overloaded_element.type = IS_METHOD;
-
- if (object_ptr) {
- zend_property_reference property_reference;
-
- property_reference.object = object_ptr;
- property_reference.type = BP_VAR_NA;
- zend_llist_init(&property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0);
- zend_stack_push(&EG(overloaded_objects_stack), &property_reference, sizeof(zend_property_reference));
- }
- zend_stack_top(&EG(overloaded_objects_stack), (void **) &property_reference);
- zend_llist_add_element(&property_reference->elements_list, &overloaded_element);
- 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()", function_name->value.str.val);
- }
- zval_dtor(&tmp);
- function_being_called = function;
-overloaded_function_call_cont:
- FREE_OP(&opline->op2, free_op2);
- }
- break;
- case ZEND_DO_FCALL_BY_NAME:
- function_state.function = function_being_called;
- goto do_fcall_common;
- case ZEND_DO_FCALL: {
- 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);
- goto do_fcall_common;
- }
-do_fcall_common:
- {
- zval *original_return_value;
-
- 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), (object_ptr?*object_ptr:NULL));
- } 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 (opline->opcode==ZEND_DO_FCALL_BY_NAME
- && object_ptr
- && function_being_called->type!=ZEND_OVERLOADED_FUNCTION) {
- zval *dummy = (zval *) emalloc(sizeof(zval)), **this_ptr;
-
- var_uninit(dummy);
- INIT_PZVAL(dummy);
- 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) ELS_CC);
- efree(function_being_called);
- }
- if (opline->opcode == ZEND_DO_FCALL_BY_NAME) {
- object_ptr = zend_ptr_stack_pop(&EG(arg_types_stack));
- function_being_called = zend_ptr_stack_pop(&EG(arg_types_stack));
- }
- function_state.function = (zend_function *) op_array;
- EG(function_state_ptr) = &function_state;
- zend_ptr_stack_clear_multiple(ELS_C);
- }
- break;
- case ZEND_RETURN: {
- zval *retval = get_zval_ptr(&opline->op1, Ts, &free_op1, BP_VAR_R);
-
- *EG(return_value) = *retval;
- if (!free_op1) {
- zendi_zval_copy_ctor(*EG(return_value));
- }
-#if SUPPORT_INTERACTIVE
- op_array->last_executed_op_number = opline-op_array->opcodes;
-#endif
- free_alloca(Ts);
- return;
- }
- break;
- case ZEND_SEND_VAL:
- if (opline->extended_value==ZEND_DO_FCALL_BY_NAME
- && 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;
- INIT_PZVAL(valptr);
- zend_ptr_stack_push(&EG(argument_stack), valptr);
- }
- break;
- case ZEND_SEND_VAR:
- if (opline->extended_value==ZEND_DO_FCALL_BY_NAME
- && 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->EA.is_ref=0;
- varptr->EA.locks = 0;
- } else if (PZVAL_IS_REF(varptr)) {
- zval *original_var = varptr;
-
- varptr = (zval *) emalloc(sizeof(zval));
- *varptr = *original_var;
- varptr->EA.is_ref = 0;
- varptr->EA.locks = 0;
- varptr->refcount = 0;
- zval_copy_ctor(varptr);
- }
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- FREE_OP(&opline->op1, free_op1); /* for string offsets */
- }
- break;
-send_by_ref:
- case ZEND_SEND_REF: {
- zval **varptr_ptr = get_zval_ptr_ptr(&opline->op1, Ts, BP_VAR_W);
- zval *varptr = *varptr_ptr;
-
- if (!PZVAL_IS_REF(varptr)) {
- /* code to break away this variable */
- if (varptr->refcount>1) {
- varptr->refcount--;
- *varptr_ptr = (zval *) emalloc(sizeof(zval));
- **varptr_ptr = *varptr;
- varptr = *varptr_ptr;
- varptr->refcount = 1;
- zval_copy_ctor(varptr);
- }
- varptr->EA.is_ref = 1;
- varptr->EA.locks = 0;
- /* at the end of this code refcount is always 1 */
- }
- varptr->refcount++;
- zend_ptr_stack_push(&EG(argument_stack), varptr);
- }
- break;
- case ZEND_RECV: {
- zval **param;
-
- if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param ELS_CC)==FAILURE) {
- zend_error(E_NOTICE, "Missing argument %d for %s()\n", opline->op1.u.constant.value.lval, get_active_function_name());
- if (opline->result.op_type == IS_VAR) {
- PZVAL_UNLOCK(*Ts[opline->result.u.var].var);
- }
- } else if (PZVAL_IS_REF(*param)) {
- zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC);
- } else {
- zend_assign_to_variable(NULL, &opline->result, NULL, *param, IS_VAR, Ts ELS_CC);
- }
- }
- break;
- case ZEND_RECV_INIT: {
- zval **param, *assignment_value;
-
- if (zend_ptr_stack_get_arg(opline->op1.u.constant.value.lval, (void **) &param ELS_CC)==FAILURE) {
- if (opline->op2.op_type == IS_UNUSED) {
- if (opline->result.op_type == IS_VAR) {
- PZVAL_UNLOCK(*Ts[opline->result.u.var].var);
- }
- 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->EA.is_ref=0;
- default_value->EA.locks = 0;
- param = &default_value;
- assignment_value = default_value;
- } else {
- param = NULL;
- assignment_value = &opline->op2.u.constant;
- }
- } else {
- assignment_value = *param;
- }
-
- if (PZVAL_IS_REF(assignment_value)) {
- zend_assign_to_variable_reference(NULL, get_zval_ptr_ptr(&opline->result, Ts, BP_VAR_W), param, NULL ELS_CC);
- } else {
- zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, Ts ELS_CC);
- }
- }
- break;
- case ZEND_BOOL:
- /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
- Ts[opline->result.u.var].tmp_var.value.lval = zend_is_true(get_zval_ptr(&opline->op1, Ts, &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;
- } else {
- opline = op_array->opcodes+jmp_to->cont;
- }
- FREE_OP(&opline->op2, free_op2);
- continue;
- }
- break;
- case ZEND_CASE:
- if (opline->op1.op_type == IS_VAR) {
- PZVAL_LOCK(*Ts[opline->op1.u.var].var);
- }
- 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;
- INIT_PZVAL(expr);
- } else {
- if (PZVAL_IS_REF(expr)) {
- zval *new_expr = (zval *) emalloc(sizeof(zval));
-
- *new_expr = *expr;
- expr = new_expr;
- zendi_zval_copy_ctor(*expr);
- INIT_PZVAL(expr);
- } 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_BOOL:
- convert_to_boolean(result);
- break;
- case IS_LONG:
- convert_to_long(result);
- break;
- case IS_DOUBLE:
- convert_to_double(result);
- break;
- case IS_STRING:
- convert_to_string(result);
- break;
- case IS_ARRAY:
- convert_to_array(result);
- break;
- case IS_OBJECT:
- convert_to_object(result);
- break;
- }
- }
- break;
- case ZEND_INCLUDE_OR_EVAL: {
- zend_op_array *new_op_array=NULL;
- zval *original_return_value = EG(return_value);
- CLS_FETCH();
-
- switch (opline->op2.u.constant.value.lval) {
- case ZEND_INCLUDE:
- new_op_array = compile_filename(get_zval_ptr(&opline->op1, Ts, &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 (array->type != IS_ARRAY) {
- zend_error(E_WARNING, "Non array argument supplied for foreach()");
- opline = op_array->opcodes+opline->op2.u.opline_num;
- continue;
- } else if (zend_hash_get_current_data(array->value.ht, (void **) &value)==FAILURE) {
- opline = op_array->opcodes+opline->op2.u.opline_num;
- continue;
- }
- array_init(result);
-
-
- (*value)->refcount++;
- zend_hash_index_update(result->value.ht, 0, value, sizeof(zval *), NULL);
-
- key = (zval *) emalloc(sizeof(zval));
- INIT_PZVAL(key);
- switch (zend_hash_get_current_key(array->value.ht, &str_key, &int_key)) {
- case HASH_KEY_IS_STRING:
- key->value.str.val = str_key;
- key->value.str.len = strlen(str_key);
- key->type = IS_STRING;
- break;
- case HASH_KEY_IS_LONG:
- key->value.lval = int_key;
- key->type = IS_LONG;
- break;
- }
- zend_hash_index_update(result->value.ht, 1, &key, sizeof(zval *), NULL);
- zend_hash_move_forward(array->value.ht);
- }
- break;
- case ZEND_JMP_NO_CTOR: {
- zval *object;
-
- PZVAL_LOCK(*Ts[opline->op1.u.var].var);
- 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) {
- if (Ts[opline->op1.u.var].EA.type==IS_STRING_OFFSET) {
- if (Ts[opline->op1.u.var].EA.offset>=0
- && Ts[opline->op1.u.var].EA.offset<Ts[opline->op1.u.var].EA.str->value.str.len) {
- isset = 1;
- } else {
- isset = 0;
- }
- } else {
- isset = 1;
- }
- } else if (var==&EG(uninitialized_zval_ptr)
- || ((*var)->type == IS_STRING && (*var)->value.str.val == undefined_variable_string)) {
- isset = 0;
- } else {
- isset = 1;
- }
-
- switch (opline->op2.u.constant.value.lval) {
- case ZEND_ISSET:
- Ts[opline->result.u.var].tmp_var.value.lval = isset;
- break;
- case ZEND_ISEMPTY:
- if (!var) {
- if (!isset
- || Ts[opline->op1.u.var].EA.str->value.str.val[Ts[opline->op1.u.var].EA.offset]=='0') {
- Ts[opline->result.u.var].tmp_var.value.lval = 1;
- } else {
- Ts[opline->result.u.var].tmp_var.value.lval = 0;
- }
- } else if (!isset || !zend_is_true(*var)) {
- Ts[opline->result.u.var].tmp_var.value.lval = 1;
- } else {
- Ts[opline->result.u.var].tmp_var.value.lval = 0;
- }
- break;
- }
- Ts[opline->result.u.var].tmp_var.type = IS_BOOL;
- }
- break;
- case ZEND_EXIT:
- if (opline->op1.op_type != IS_UNUSED) {
- zend_print_variable(get_zval_ptr(&opline->op1, Ts, &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_DECLARE_FUNCTION_OR_CLASS:
- do_bind_function_or_class(opline, EG(function_table), EG(class_table));
- 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 b955b0deae..0000000000
--- a/Zend/zend_execute.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _EXECUTE_H
-#define _EXECUTE_H
-
-#include "zend_compile.h"
-#include "zend_hash.h"
-
-typedef union _temp_variable {
- 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 ELS_DC);
-
-#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 a5b94889c9..0000000000
--- a/Zend/zend_execute_API.c
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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);
-
-
-#if ZEND_DEBUG
-static void (*original_sigsegv_handler)(int);
-static void zend_handle_sigsegv(int dummy)
-{
- fflush(stdout);
- fflush(stderr);
- if (original_sigsegv_handler==zend_handle_sigsegv) {
- signal(SIGSEGV, original_sigsegv_handler);
- } else {
- signal(SIGSEGV, SIG_DFL);
- }
- {
- ELS_FETCH();
-
- fprintf(stderr, "SIGSEGV caught on opcode %d on opline %d of %s() at %s:%d\n\n",
- active_opline->opcode,
- active_opline-EG(active_op_array)->opcodes,
- get_active_function_name(),
- zend_get_executed_filename(ELS_C),
- zend_get_executed_lineno(ELS_C));
- }
- if (original_sigsegv_handler!=zend_handle_sigsegv) {
- original_sigsegv_handler(dummy);
- }
-}
-#endif
-
-
-static void zend_extension_activator(zend_extension *extension)
-{
- if (extension->activate) {
- extension->activate();
- }
-}
-
-
-static void zend_extension_deactivator(zend_extension *extension)
-{
- if (extension->deactivate) {
- extension->deactivate();
- }
-}
-
-
-void init_executor(CLS_D ELS_DC)
-{
- var_uninit(&EG(uninitialized_zval));
- var_uninit(&EG(error_zval));
- EG(uninitialized_zval).refcount = 1;
- EG(uninitialized_zval).EA.is_ref=0;
- EG(uninitialized_zval).EA.locks = 0;
- EG(uninitialized_zval_ptr)=&EG(uninitialized_zval);
- EG(error_zval).refcount = 1;
- EG(error_zval).EA.is_ref=0;
- EG(error_zval).EA.locks = 0;
- EG(error_zval_ptr)=&EG(error_zval);
- zend_ptr_stack_init(&EG(arg_types_stack));
- zend_stack_init(&EG(overloaded_objects_stack));
-/* destroys stack frame, therefore makes core dumps worthless */
-#if 0
-#if ZEND_DEBUG
- original_sigsegv_handler = signal(SIGSEGV, zend_handle_sigsegv);
-#endif
-#endif
- EG(return_value) = &EG(global_return_value);
- var_reset(EG(return_value));
- EG(symtable_cache_ptr) = EG(symtable_cache)-1;
- EG(symtable_cache_limit)=EG(symtable_cache)+SYMTABLE_CACHE_SIZE-1;
- EG(no_extensions)=0;
-
- EG(function_table) = CG(function_table);
- EG(class_table) = CG(class_table);
-
- zend_ptr_stack_init(&EG(argument_stack));
-
- EG(main_op_array) = NULL;
- zend_hash_init(&EG(symbol_table), 50, NULL, PVAL_PTR_DTOR, 0);
- EG(active_symbol_table) = &EG(symbol_table);
-
- zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_activator);
- EG(opline_ptr) = NULL;
-}
-
-
-void shutdown_executor(ELS_D)
-{
- zval_dtor(EG(return_value));
- zend_ptr_stack_destroy(&EG(arg_types_stack));
- zend_stack_destroy(&EG(overloaded_objects_stack));
-
- while (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
- zend_hash_destroy(*EG(symtable_cache_ptr));
- efree(*EG(symtable_cache_ptr));
- EG(symtable_cache_ptr)--;
- }
- zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_deactivator);
-
- zend_hash_destroy(&EG(symbol_table));
-
- destroy_resource_list(); /* must be destroyed after the main symbol table is destroyed */
-
- zend_ptr_stack_destroy(&EG(argument_stack));
- if (EG(main_op_array)) {
- destroy_op_array(EG(main_op_array));
- efree(EG(main_op_array));
- }
- clean_non_persistent_constants();
-#if ZEND_DEBUG
- signal(SIGSEGV, original_sigsegv_handler);
-#endif
-}
-
-
-ZEND_API char *get_active_function_name()
-{
- ELS_FETCH();
-
- switch(EG(function_state_ptr)->function->type) {
- case ZEND_USER_FUNCTION: {
- char *function_name = ((zend_op_array *) EG(function_state_ptr)->function)->function_name;
-
- if (function_name) {
- return function_name;
- } else {
- return "main";
- }
- }
- break;
- case ZEND_INTERNAL_FUNCTION:
- return ((zend_internal_function *) EG(function_state_ptr)->function)->function_name;
- break;
- default:
- return NULL;
- }
-}
-
-
-ZEND_API char *zend_get_executed_filename(ELS_D)
-{
- if (EG(opline_ptr)) {
- return active_opline->filename;
- } else {
- return "[no active file]";
- }
-}
-
-
-ZEND_API uint zend_get_executed_lineno(ELS_D)
-{
- if (EG(opline_ptr)) {
- return active_opline->lineno;
- } else {
- return 0;
- }
-}
-
-
-ZEND_API inline void safe_free_zval_ptr(zval *p)
-{
- ELS_FETCH();
-
- if (p!=EG(uninitialized_zval_ptr)) {
- efree(p);
- }
-}
-
-
-ZEND_API int zval_ptr_dtor(zval **zval_ptr)
-{
- int locked = PZVAL_IS_LOCKED(*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);
- }
- if (locked) {
- return 0; /* don't kill the container bucket */
- } else {
- return 1;
- }
-}
-
-
-ZEND_API inline int i_zend_is_true(zval *op)
-{
- int result;
-
- switch (op->type) {
- case IS_LONG:
- case IS_BOOL:
- case IS_RESOURCE:
- result = (op->value.lval?1:0);
- break;
- case IS_DOUBLE:
- result = (op->value.dval ? 1 : 0);
- break;
- case IS_STRING:
- if (op->value.str.len == 0
- || (op->value.str.len==1 && op->value.str.val[0]=='0')) {
- result = 0;
- } else {
- result = 1;
- }
- break;
- case IS_ARRAY:
- result = (zend_hash_num_elements(op->value.ht)?1:0);
- break;
- case IS_OBJECT:
- result = (zend_hash_num_elements(op->value.obj.properties)?1:0);
- break;
- default:
- result = 0;
- break;
- }
- return result;
-}
-
-
-ZEND_API int zend_is_true(zval *op)
-{
- return i_zend_is_true(op);
-}
-
-
-ZEND_API 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;
- }
- INIT_PZVAL(p);
- }
-}
-
-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;
- }
- original_function_state_ptr = EG(function_state_ptr);
- zend_str_tolower(function_name->value.str.val, function_name->value.str.len);
- if (zend_hash_find(function_table, function_name->value.str.val, function_name->value.str.len+1, (void **) &function_state.function)==FAILURE) {
- return FAILURE;
- }
-
-
- for (i=0; i<param_count; i++) {
- zval *param;
-
- param = (zval *) emalloc(sizeof(zval));
- *param = *(params[i]);
- INIT_PZVAL(param);
- zval_copy_ctor(param);
- zend_ptr_stack_push(&EG(argument_stack), param);
- }
-
- zend_ptr_stack_push(&EG(argument_stack), (void *) (long) param_count);
-
- var_uninit(retval);
- if (function_state.function->type == ZEND_USER_FUNCTION) {
- calling_symbol_table = EG(active_symbol_table);
- EG(active_symbol_table) = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(EG(active_symbol_table), 0, NULL, PVAL_PTR_DTOR, 0);
- if (object) {
- zval *dummy = (zval *) emalloc(sizeof(zval)), **this_ptr;
-
- var_uninit(dummy);
- INIT_PZVAL(dummy);
- zend_hash_update_ptr(EG(active_symbol_table), "this", sizeof("this"), dummy, sizeof(zval *), (void **) &this_ptr);
- zend_assign_to_variable_reference(NULL, this_ptr, &object, NULL ELS_CC);
- }
- original_return_value = EG(return_value);
- original_op_array = EG(active_op_array);
- EG(return_value) = retval;
- EG(active_op_array) = (zend_op_array *) function_state.function;
- original_opline_ptr = EG(opline_ptr);
- zend_execute(EG(active_op_array) ELS_CC);
- zend_hash_destroy(EG(active_symbol_table));
- efree(EG(active_symbol_table));
- EG(active_symbol_table) = calling_symbol_table;
- EG(active_op_array) = original_op_array;
- EG(return_value)=original_return_value;
- EG(opline_ptr) = original_opline_ptr;
- } else {
- ((zend_internal_function *) function_state.function)->handler(param_count, retval, &EG(regular_list), &EG(persistent_list), object);
- }
- zend_ptr_stack_clear_multiple(ELS_C);
- EG(function_state_ptr) = original_function_state_ptr;
-
- return SUCCESS;
-}
-
-
-ZEND_API void zend_eval_string(char *str, zval *retval CLS_DC ELS_DC)
-{
- zval pv;
- zend_op_array *new_op_array;
- zend_op_array *original_active_op_array = EG(active_op_array);
- zend_function_state *original_function_state_ptr = EG(function_state_ptr);
- int original_handle_op_arrays;
-
- if (retval) {
- pv.value.str.len = strlen(str)+sizeof("return ;")-1;
- pv.value.str.val = emalloc(pv.value.str.len+1);
- strcpy(pv.value.str.val, "return ");
- strcat(pv.value.str.val, str);
- strcat(pv.value.str.val, " ;");
- } else {
- pv.value.str.len = strlen(str);
- pv.value.str.val = estrndup(str, pv.value.str.len);
- }
- pv.type = IS_STRING;
-
- /*printf("Evaluating '%s'\n", pv.value.str.val);*/
-
- original_handle_op_arrays = CG(handle_op_arrays);
- CG(handle_op_arrays) = 0;
- new_op_array = compile_string(&pv CLS_CC);
- CG(handle_op_arrays) = original_handle_op_arrays;
-
- if (new_op_array) {
- zval dummy_retval;
- zval *original_return_value = EG(return_value);
- zend_op **original_opline_ptr = EG(opline_ptr);
-
- EG(return_value) = (retval?retval:&dummy_retval);
- var_reset(EG(return_value));
- EG(active_op_array) = new_op_array;
- EG(no_extensions)=1;
- zend_execute(new_op_array ELS_CC);
- EG(no_extensions)=0;
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
- EG(function_state_ptr) = original_function_state_ptr;
- destroy_op_array(new_op_array);
- efree(new_op_array);
- EG(return_value) = original_return_value;
- if (!retval) {
- zval_dtor(&dummy_retval);
- }
- } else {
- printf("Failed executing:\n%s\n", str);
- }
- zval_dtor(&pv);
-}
-
-
-ZEND_API inline void zend_assign_to_variable_reference(znode *result, zval **variable_ptr_ptr, zval **value_ptr_ptr, temp_variable *Ts ELS_DC)
-{
- zval *variable_ptr = *variable_ptr_ptr;
- zval *value_ptr;
-
-
- if (!value_ptr_ptr) {
- zend_error(E_ERROR, "Cannot create references to string offsets nor overloaded objects");
- return;
- }
-
- value_ptr = *value_ptr_ptr;
- if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
- variable_ptr_ptr = &EG(uninitialized_zval_ptr);
- } else if (variable_ptr==&EG(uninitialized_zval) || variable_ptr!=value_ptr) {
- variable_ptr->refcount--;
- if (variable_ptr->refcount==0) {
- zendi_zval_dtor(*variable_ptr);
- efree(variable_ptr);
- }
-
- if (!PZVAL_IS_REF(value_ptr)) {
- /* break it away */
- value_ptr->refcount--;
- if (value_ptr->refcount>0) {
- *value_ptr_ptr = (zval *) emalloc(sizeof(zval));
- **value_ptr_ptr = *value_ptr;
- value_ptr = *value_ptr_ptr;
- zendi_zval_copy_ctor(*value_ptr);
- }
- value_ptr->refcount = 1;
- value_ptr->EA.is_ref = 1;
- value_ptr->EA.locks = 0;
- }
-
- *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;
- PZVAL_LOCK(*variable_ptr_ptr);
- }
-}
-
-
-#if SUPPORT_INTERACTIVE
-void execute_new_code(CLS_D)
-{
- ELS_FETCH();
-
- if (!EG(interactive)
- || CG(active_op_array)->backpatch_count>0
- || CG(active_op_array)->function_name
- || CG(active_op_array)->type!=ZEND_USER_FUNCTION) {
- return;
- }
- CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
- CG(active_op_array)->end_op_number = CG(active_op_array)->last;
- EG(active_op_array) = CG(active_op_array);
- zend_execute(CG(active_op_array) ELS_CC);
- CG(active_op_array)->start_op_number = CG(active_op_array)->last_executed_op_number;
-}
-#endif
-
-
-/* these are a dedicated, optimized, function, and shouldn't be used for any purpose
- * other than by Zend's executor
- */
-ZEND_API inline void zend_ptr_stack_clear_multiple(ELS_D)
-{
- void **p = EG(argument_stack).top_element-1;
- int delete_count = (ulong) *p;
-
- EG(argument_stack).top -= (delete_count+1);
- while (--delete_count>=0) {
- zval_ptr_dtor((zval **) --p);
- }
- EG(argument_stack).top_element = p;
-}
-
-
-
-ZEND_API int zend_ptr_stack_get_arg(int requested_arg, void **data ELS_DC)
-{
- void **p = EG(argument_stack).top_element-1;
- int arg_count = (ulong) *p;
-
- if (requested_arg>arg_count) {
- return FAILURE;
- }
- *data = (p-arg_count+requested_arg-1);
- return SUCCESS;
-}
-
diff --git a/Zend/zend_extensions.c b/Zend/zend_extensions.c
deleted file mode 100644
index a7fd13296b..0000000000
--- a/Zend/zend_extensions.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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) {
-#if !(WIN32||WINNT)
- fprintf(stderr, "Failed loading %s: %s\n", path, dlerror());
-#else
- fprintf(stderr, "Failed loading %s\n", path);
-#endif
- return FAILURE;
- }
-
- extension_version_info = (zend_extension_version_info *) DL_FETCH_SYMBOL(handle, "extension_version_info");
- new_extension = (zend_extension *) DL_FETCH_SYMBOL(handle, "zend_extension_entry");
- if (!extension_version_info || !new_extension) {
- fprintf(stderr, "%s doesn't appear to be a valid Zend extension\n", path);
- return FAILURE;
- }
-
- if (extension_version_info->zend_extension_api_no > ZEND_EXTENSION_API_NO) {
- fprintf(stderr, "%s requires Zend version %s or later\n"
- "Current version %s, API version %d\n",
- new_extension->name,
- extension_version_info->required_zend_version,
- ZEND_VERSION,
- ZEND_EXTENSION_API_NO);
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (extension_version_info->zend_extension_api_no < ZEND_EXTENSION_API_NO) {
- /* we may be able to allow for downwards compatability in some harmless cases. */
- fprintf(stderr, "%s is outdated (API version %d, current version %d)\n"
- "Contact %s at %s for a later version of this module.\n",
- new_extension->name,
- extension_version_info->zend_extension_api_no,
- ZEND_EXTENSION_API_NO,
- new_extension->author,
- new_extension->URL);
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (ZTS_V!=extension_version_info->thread_safe) {
- fprintf(stderr, "Cannot load %s - it %s thread safe, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->thread_safe?"is":"isn't"),
- (ZTS_V?"is":"isn't"));
- DL_UNLOAD(handle);
- return FAILURE;
- } else if (ZEND_DEBUG_V!=extension_version_info->debug) {
- fprintf(stderr, "Cannot load %s - it %s debug information, whereas Zend %s\n",
- new_extension->name,
- (extension_version_info->debug?"contains":"does not contain"),
- (ZEND_DEBUG_V?"does":"does not"));
- DL_UNLOAD(handle);
- return FAILURE;
- }
-
- if (new_extension->startup) {
- if (new_extension->startup(new_extension)!=SUCCESS) {
- DL_UNLOAD(handle);
- return FAILURE;
- }
- }
- extension = *new_extension;
- extension.handle = handle;
-
- zend_llist_add_element(&zend_extensions, &extension);
-
- /*fprintf(stderr, "Loaded %s, version %s\n", extension.name, extension.version);*/
-
- zend_append_version_info(&extension);
- return SUCCESS;
-#else
- fprintf(stderr, "Extensions are not supported on this platform.\n");
- return FAILURE;
-#endif
-}
-
-static void zend_extension_shutdown(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- if (extension->shutdown) {
- extension->shutdown(extension);
- }
-#endif
-}
-
-
-void zend_shutdown_extensions()
-{
- zend_llist_apply(&zend_extensions, (void (*)(void *)) zend_extension_shutdown);
- zend_llist_destroy(&zend_extensions);
-}
-
-
-void zend_extension_dtor(zend_extension *extension)
-{
-#if ZEND_EXTENSIONS_SUPPORT
- DL_UNLOAD(extension->handle);
-#endif
-}
-
-
-ZEND_API int zend_get_resource_handle(zend_extension *extension)
-{
- if (last_resource_number<4) {
- extension->resource_number = last_resource_number;
- return last_resource_number;
- } else {
- return -1;
- }
-}
diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h
deleted file mode 100644
index 8bd0d126d8..0000000000
--- a/Zend/zend_extensions.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 19990619
-
-typedef struct _zend_extension_version_info {
- int zend_extension_api_no;
- char *required_zend_version;
- unsigned char thread_safe;
- unsigned char debug;
-} zend_extension_version_info;
-
-
-typedef struct _zend_extension zend_extension;
-
-struct _zend_extension {
- char *name;
- char *version;
- char *author;
- char *URL;
- char *copyright;
-
- int (*startup)(zend_extension *extension);
- void (*shutdown)(zend_extension *extension);
- void (*activate)();
- void (*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
-
-#ifdef ZEND_DEBUG
-#define ZEND_DEBUG_V 1
-#else
-#define ZEND_DEBUG_V 0
-#endif
-
-
-#define ZEND_EXTENSION() \
- ZEND_EXT_API zend_extension_version_info extension_version_info = { ZEND_EXTENSION_API_NO, "0.90", ZTS_V, ZEND_DEBUG_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 d922ac7f72..0000000000
--- a/Zend/zend_globals.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _T_GLOBALS_H
-#define _T_GLOBALS_H
-
-#include <setjmp.h>
-
-#include "zend_stack.h"
-#include "zend_ptr_stack.h"
-#include "zend_hash.h"
-#include "zend_llist.h"
-
-/* Define ZTS if you want a thread-safe Zend */
-/*#undef ZTS*/
-
-#ifdef ZTS
-#include "../TSRM/TSRM.h"
-
-#ifdef __cplusplus
-class ZendFlexLexer;
-#endif
-
-BEGIN_EXTERN_C()
-ZEND_API extern int compiler_globals_id;
-ZEND_API extern int executor_globals_id;
-extern int alloc_globals_id;
-END_EXTERN_C()
-
-#endif
-
-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 = (zend_compiler_globals *) ts_resource(compiler_globals_id)
-# define YYPARSE_PARAM compiler_globals
-# define YYLEX_PARAM compiler_globals
-BEGIN_EXTERN_C()
-int zendparse(void *compiler_globals);
-END_EXTERN_C()
-#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 = (zend_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 = (zend_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;
-
- zend_bool short_tags;
- zend_bool asp_tags;
-
- /* For extensions support */
- zend_bool extended_info; /* generate extension information for debugger/profiler */
- zend_bool handle_op_arrays; /* run op_arrays through op_array handlers */
-
- zend_bool unclean_shutdown;
-
- zend_llist open_files;
-#ifdef ZTS
-#ifdef __cplusplus
- ZendFlexLexer *ZFL;
-#else
- void *ZFL;
-#endif
-#endif
-};
-
-
-struct _zend_executor_globals {
- zval *return_value;
-
- zval uninitialized_zval;
- zval *uninitialized_zval_ptr;
-
- zval error_zval;
- zval *error_zval_ptr;
-
- zend_function_state *function_state_ptr;
- zend_ptr_stack arg_types_stack;
- zend_stack overloaded_objects_stack;
- zval global_return_value;
-
- /* symbol table cache */
- HashTable *symtable_cache[SYMTABLE_CACHE_SIZE];
- HashTable **symtable_cache_limit;
- HashTable **symtable_cache_ptr;
-
- zend_op **opline_ptr;
-
- HashTable *active_symbol_table;
- HashTable symbol_table; /* main symbol table */
-
- jmp_buf bailout;
-
- int error_reporting;
-
- zend_op_array *active_op_array;
- zend_op_array *main_op_array;
-
- HashTable *function_table; /* function symbol table */
- HashTable *class_table; /* class table */
- HashTable *zend_constants; /* constants table */
-
- long precision;
-
- /* for extended information support */
- 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 /* _T_GLOBALS_H */
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
deleted file mode 100644
index f9322cc3f8..0000000000
--- a/Zend/zend_hash.c
+++ /dev/null
@@ -1,1193 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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), int (*pDestructor) (void *pData),int persistent)
-{
- uint i;
-
- for (i = 0; i < nNumPrimeNumbers; i++) {
- if (nSize <= PrimeNumbers[i]) {
- nSize = PrimeNumbers[i];
- ht->nHashSizeIndex = i;
- break;
- }
- }
- if (i == nNumPrimeNumbers) { /* This shouldn't really happen unless the ask for a ridiculous size */
- nSize = PrimeNumbers[i - 1];
- ht->nHashSizeIndex = i - 1;
- }
-
- /* Uses ecalloc() so that Bucket* == NULL */
- ht->arBuckets = (Bucket **) pecalloc(nSize, sizeof(Bucket *), persistent);
-
- if (!ht->arBuckets) {
- return FAILURE;
- }
- if (pHashFunction == NULL) {
- ht->pHashFunction = hashpjw;
- } else {
- ht->pHashFunction = pHashFunction;
- }
- ht->pDestructor = pDestructor;
- ht->nTableSize = nSize;
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
- ht->persistent = persistent;
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest, int flag)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_index_update_or_next_insert(ht,idx,pData,nDataSize,pDest,flag));
-
- h = ht->pHashFunction(arKey, nKeyLength);
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (flag & HASH_ADD_PTR) {
- if (!p->pDataPtr) {
- efree(p->pData);
- }
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- if (p->pDataPtr) {
- p->pData = (void *) emalloc(nDataSize);
- p->pDataPtr=NULL;
- }
- memcpy(p->pData, pData, nDataSize);
- }
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent);
- if (!p) {
- return FAILURE;
- }
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- if (flag & HASH_ADD_PTR) {
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- p->pData = (void *) pemalloc(nDataSize,ht->persistent);
- if (!p->pData) {
- pefree(p,ht->persistent);
- pefree(p->arKey,ht->persistent);
- return FAILURE;
- }
- memcpy(p->pData, pData, nDataSize);
- p->pDataPtr=NULL;
- }
- p->h = h;
- p->bIsPointer = 0;
- p->pNext = ht->arBuckets[nIndex];
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pInternalPointer == NULL) {
- ht->pInternalPointer = p;
- }
- ht->arBuckets[nIndex] = p;
-
- /* Setup the double linked list */
- p->pListLast = ht->pListTail;
- ht->pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ht->pListHead) {
- ht->pListHead = p;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements++;
- if_full_do_resize(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- if (flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (flag & HASH_ADD_PTR) {
- if (!p->pDataPtr) {
- efree(p->pData);
- }
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- if (p->pDataPtr) {
- p->pData = (void *) emalloc(nDataSize);
- p->pDataPtr=NULL;
- }
- memcpy(p->pData, pData, nDataSize);
- }
- if (pDest) {
- *pDest = p->pData;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
-
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent);
- if (!p) {
- return FAILURE;
- }
-
- memcpy(p->arKey, arKey, nKeyLength);
- p->nKeyLength = nKeyLength;
- if (flag & HASH_ADD_PTR) {
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- p->pData = (void *) pemalloc(nDataSize,ht->persistent);
- if (!p->pData) {
- pefree(p,ht->persistent);
- pefree(p->arKey,ht->persistent);
- return FAILURE;
- }
-
- memcpy(p->pData, pData, nDataSize);
- p->pDataPtr=NULL;
- }
- p->h = h;
- p->bIsPointer = 0;
- p->pNext = ht->arBuckets[nIndex];
- if (pDest) {
- *pDest = p->pData;
- }
-
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pInternalPointer == NULL) {
- ht->pInternalPointer = p;
- }
- ht->arBuckets[nIndex] = p;
-
- /* Setup the double linked list */
- p->pListLast = ht->pListTail;
- ht->pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ht->pListHead) {
- ht->pListHead = p;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- ht->nNumOfElements++;
- if_full_do_resize(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- if (flag & HASH_NEXT_INSERT) {
- h = ht->nNextFreeElement;
- }
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- if (flag & HASH_NEXT_INSERT || flag & HASH_ADD) {
- return FAILURE;
- }
- HANDLE_BLOCK_INTERRUPTIONS();
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_index_update: p->pData == pData\n");
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return FAILURE;
- }
-#endif
- if (ht->pDestructor) {
- ht->pDestructor(p->pData);
- }
- if (flag & HASH_ADD_PTR) {
- if (!p->pDataPtr) {
- efree(p->pData);
- }
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- if (p->pDataPtr) {
- p->pData = (void *) emalloc(nDataSize);
- p->pDataPtr=NULL;
- }
- memcpy(p->pData, pData, nDataSize);
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- if (h >= ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- if (pDest) {
- *pDest = p->pData;
- }
- return SUCCESS;
- }
- p = p->pNext;
- }
- p = (Bucket *) pemalloc(sizeof(Bucket)-1,ht->persistent);
- if (!p) {
- return FAILURE;
- }
- p->nKeyLength = 0; /* Numeric indices are marked by making the nKeyLength == 0 */
- p->h = h;
-
- if (flag & HASH_ADD_PTR) {
- p->pDataPtr = pData;
- p->pData = &p->pDataPtr;
- } else {
- p->pData = (void *) pemalloc(nDataSize,ht->persistent);
- if (!p->pData) {
- pefree(p,ht->persistent);
- return FAILURE;
- }
- memcpy(p->pData, pData, nDataSize);
- p->pDataPtr=NULL;
- }
- p->bIsPointer = 0;
- if (pDest) {
- *pDest = p->pData;
- }
-
- p->pNext = ht->arBuckets[nIndex];
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pInternalPointer == NULL) {
- ht->pInternalPointer = p;
- }
- ht->arBuckets[nIndex] = p;
-
- /* Setup the double linked list */
- p->pListLast = ht->pListTail;
- ht->pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ht->pListHead) {
- ht->pListHead = p;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- if (h >= ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- ht->nNumOfElements++;
- if_full_do_resize(ht);
- return SUCCESS;
-}
-
-ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't put in empty key\n");
-#endif
- return FAILURE;
- }
-
- HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_pointer_index_update_or_next_insert(ht,idx,pData,HASH_UPDATE));
-
- h = ht->pHashFunction(arKey, nKeyLength);
- nIndex = h % ht->nTableSize;
-
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_pointer_update: p->pData == pData\n");
- return FAILURE;
- }
-#endif
- HANDLE_BLOCK_INTERRUPTIONS();
- if (!p->bIsPointer && ht->pDestructor) {
- ht->pDestructor(p->pData);
- pefree(p->pData,ht->persistent);
- }
- p->pData = pData;
- p->bIsPointer = 1;
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- p = (Bucket *) pemalloc(sizeof(Bucket)-1+nKeyLength,ht->persistent);
- if (!p) {
- return FAILURE;
- }
- p->nKeyLength = nKeyLength;
- p->pData = pData;
- p->h = h;
- p->bIsPointer = 1;
- memcpy(p->arKey, arKey, nKeyLength);
-
- p->pNext = ht->arBuckets[nIndex];
-
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pInternalPointer == NULL) {
- ht->pInternalPointer = p;
- }
- ht->arBuckets[nIndex] = p;
-
- /* Setup the double linked list */
- p->pListLast = ht->pListTail;
- ht->pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ht->pListHead) {
- ht->pListHead = p;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- if_full_do_resize(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_pointer_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, int flag)
-{
- uint nIndex;
- Bucket *p;
-
- if (flag & HASH_NEXT_INSERT) {
- h = ht->nNextFreeElement;
- }
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- if (flag & HASH_NEXT_INSERT) {
- return FAILURE;
- }
-#if ZEND_DEBUG
- if (p->pData == pData) {
- ZEND_PUTS("Fatal error in zend_hash_pointer_update: p->pData == pData\n");
- return FAILURE;
- }
-#endif
- HANDLE_BLOCK_INTERRUPTIONS();
- if (!p->bIsPointer && ht->pDestructor) {
- ht->pDestructor(p->pData);
- pefree(p->pData,ht->persistent);
- }
- p->pData = pData;
- p->bIsPointer = 1;
- if (h >= ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- p = p->pNext;
- }
- p = (Bucket *) pemalloc(sizeof(Bucket)-1,ht->persistent);
- if (!p) {
- return FAILURE;
- }
- p->nKeyLength = 0;
- p->pData = pData;
- p->h = h;
- p->bIsPointer = 1;
-
- p->pNext = ht->arBuckets[nIndex];
-
- HANDLE_BLOCK_INTERRUPTIONS();
- if (ht->pInternalPointer == NULL) {
- ht->pInternalPointer = p;
- }
- ht->arBuckets[nIndex] = p;
-
- /* Setup the double linked list */
- p->pListLast = ht->pListTail;
- ht->pListTail = p;
- p->pListNext = NULL;
- if (p->pListLast != NULL) {
- p->pListLast->pListNext = p;
- }
- if (!ht->pListHead) {
- ht->pListHead = p;
- }
- HANDLE_UNBLOCK_INTERRUPTIONS();
-
- ht->nNumOfElements++;
- if (h >= ht->nNextFreeElement) {
- ht->nNextFreeElement = h + 1;
- }
- if_full_do_resize(ht); /* If the Hash table is full, resize it */
- return SUCCESS;
-}
-
-
-ZEND_API int zend_hash_is_pointer(HashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- if (nKeyLength <= 0) {
-#if ZEND_DEBUG
- ZEND_PUTS("zend_hash_update: Can't check for empty key\n");
-#endif
- return FAILURE;
- }
-
- HANDLE_NUMERIC(arKey,nKeyLength,zend_hash_index_is_pointer(ht, idx));
-
- h = ht->pHashFunction(arKey, nKeyLength);
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- return (p->bIsPointer);
- }
- }
- p = p->pNext;
- }
- return 0;
-}
-
-ZEND_API int zend_hash_index_is_pointer(HashTable *ht, ulong h)
-{
- uint nIndex;
- Bucket *p;
-
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->nKeyLength == 0) && (p->h == h)) {
- return (p->bIsPointer);
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-static int if_full_do_resize(HashTable *ht)
-{
- Bucket **t;
-
- if ((ht->nNumOfElements > ht->nTableSize) && (ht->nHashSizeIndex < nNumPrimeNumbers - 1)) { /* Let's double the table
- size */
- t = (Bucket **) perealloc_recoverable(ht->arBuckets, PrimeNumbers[ht->nHashSizeIndex + 1] * sizeof(Bucket *),ht->persistent);
- if (t) {
- HANDLE_BLOCK_INTERRUPTIONS();
- ht->arBuckets = t;
- ht->nTableSize = PrimeNumbers[ht->nHashSizeIndex + 1];
- ht->nHashSizeIndex++;
- zend_hash_rehash(ht);
- HANDLE_UNBLOCK_INTERRUPTIONS();
- return SUCCESS;
- }
- return FAILURE;
- }
- return SUCCESS;
-}
-
-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;
- int delete_bucket;
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (!q->bIsPointer) {
- if (ht->pDestructor) {
- delete_bucket = ht->pDestructor(q->pData);
- } else {
- delete_bucket = 1;
- }
- if (!q->pDataPtr && q->pData && delete_bucket) {
- pefree(q->pData,ht->persistent);
- }
- } else {
- delete_bucket = 1;
- }
- if (delete_bucket) {
- pefree(q,ht->persistent);
- } else {
- int i;
- i=2;
- }
- }
- pefree(ht->arBuckets,ht->persistent);
-}
-
-
-ZEND_API void zend_hash_clean(HashTable *ht)
-{
- Bucket *p, *q;
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (!q->bIsPointer) {
- if (ht->pDestructor) {
- ht->pDestructor(q->pData);
- }
- if (!q->pDataPtr && q->pData) {
- pefree(q->pData,ht->persistent);
- }
- }
- pefree(q,ht->persistent);
- }
- memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *));
- ht->pListHead = NULL;
- ht->pListTail = NULL;
- ht->nNumOfElements = 0;
- ht->nNextFreeElement = 0;
- ht->pInternalPointer = NULL;
-}
-
-
-/* This is used to selectively delete certain entries from a hashtable.
- * destruct() receives the data and decides if the entry should be deleted
- * or not
- */
-ZEND_API void zend_hash_apply(HashTable *ht,int (*destruct) (void *))
-{
- Bucket *p, *q;
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (destruct(q->pData)) {
- if (q->nKeyLength==0) {
- zend_hash_index_del(ht, q->h);
- } else {
- zend_hash_del(ht,q->arKey,q->nKeyLength);
- }
- }
- }
-}
-
-
-ZEND_API void zend_hash_apply_with_argument(HashTable *ht,int (*destruct) (void *, void *), void *argument)
-{
- Bucket *p, *q;
-
- p = ht->pListHead;
- while (p != NULL) {
- q = p;
- p = p->pListNext;
- if (destruct(q->pData, argument)) {
- if (q->nKeyLength == 0) {
- zend_hash_index_del(ht, q->h);
- } else {
- zend_hash_del(ht,q->arKey,q->nKeyLength);
- }
- }
- }
-}
-
-
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size)
-{
- Bucket *p;
-
- p = source->pListHead;
- while (p) {
- memcpy(tmp, p->pData, size);
- if (pCopyConstructor) {
- pCopyConstructor(tmp);
- }
- if (p->nKeyLength) {
- zend_hash_update(target, p->arKey, p->nKeyLength, tmp, size, NULL);
- } else {
- zend_hash_index_update(target, p->h, tmp, size, NULL);
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite)
-{
- Bucket *p;
- void *t;
- int mode = (overwrite?HASH_UPDATE:HASH_ADD);
-
- p = source->pListHead;
- while (p) {
- memcpy(tmp, p->pData, size);
- if (p->nKeyLength>0) {
- if (zend_hash_add_or_update(target, p->arKey, p->nKeyLength, tmp, size, &t, mode)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- } else {
- if ((mode==HASH_UPDATE || !zend_hash_index_exists(target, p->h)) && zend_hash_index_update(target, p->h, tmp, size, &t)==SUCCESS && pCopyConstructor) {
- pCopyConstructor(t);
- }
- }
- p = p->pListNext;
- }
- target->pInternalPointer = target->pListHead;
-}
-
-
-ZEND_API ulong zend_get_hash_value(HashTable *ht, char *arKey, uint nKeyLength)
-{
- return ht->pHashFunction(arKey, nKeyLength);
-}
-
-
-/* Returns SUCCESS if found and FAILURE if not. The pointer to the
- * data is returned in pData. The reason is that there's no reason
- * someone using the hash table might not want to have NULL data
- */
-ZEND_API int zend_hash_find(HashTable *ht, char *arKey, uint nKeyLength, void **pData)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_find(ht,idx,pData));
-
- h = ht->pHashFunction(arKey, nKeyLength);
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_quick_find(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- *pData = p->pData;
- return SUCCESS;
- }
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_exists(HashTable *ht, char *arKey, uint nKeyLength)
-{
- ulong h;
- uint nIndex;
- Bucket *p;
-
- HANDLE_NUMERIC(arKey, nKeyLength, zend_hash_index_exists(ht,idx));
-
- h = ht->pHashFunction(arKey, nKeyLength);
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
- if (!memcmp(p->arKey, arKey, nKeyLength)) {
- return 1;
- }
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_index_find(HashTable *ht, ulong h, void **pData)
-{
- uint nIndex;
- Bucket *p;
-
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- *pData = p->pData;
- return SUCCESS;
- }
- p = p->pNext;
- }
- return FAILURE;
-}
-
-
-ZEND_API int zend_hash_index_exists(HashTable *ht, ulong h)
-{
- uint nIndex;
- Bucket *p;
-
- nIndex = h % ht->nTableSize;
-
- p = ht->arBuckets[nIndex];
- while (p != NULL) {
- if ((p->h == h) && (p->nKeyLength == 0)) {
- return 1;
- }
- p = p->pNext;
- }
- return 0;
-}
-
-
-ZEND_API int zend_hash_num_elements(HashTable *ht)
-{
- return ht->nNumOfElements;
-}
-
-
-ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht)
-{
- ht->pInternalPointer = ht->pListHead;
-}
-
-
-/* This function will be extremely optimized by remembering
- * the end of the list
- */
-ZEND_API void zend_hash_internal_pointer_end(HashTable *ht)
-{
- ht->pInternalPointer = ht->pListTail;
-}
-
-
-ZEND_API void zend_hash_move_forward(HashTable *ht)
-{
- if (ht->pInternalPointer) {
- ht->pInternalPointer = ht->pInternalPointer->pListNext;
- }
-}
-
-ZEND_API void zend_hash_move_backwards(HashTable *ht)
-{
- if (ht->pInternalPointer) {
- ht->pInternalPointer = ht->pInternalPointer->pListLast;
- }
-}
-
-
-/* This function should be made binary safe */
-ZEND_API int zend_hash_get_current_key(HashTable *ht, char **str_index, ulong *num_index)
-{
- Bucket *p = ht->pInternalPointer;
-
- if (p) {
- if (p->nKeyLength) {
- *str_index = (char *) pemalloc(p->nKeyLength,ht->persistent);
- memcpy(*str_index, p->arKey, p->nKeyLength);
- return HASH_KEY_IS_STRING;
- } else {
- *num_index = p->h;
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_key_type(HashTable *ht)
-{
- Bucket *p = ht->pInternalPointer;
-
- if (p) {
- if (p->nKeyLength) {
- return HASH_KEY_IS_STRING;
- } else {
- return HASH_KEY_IS_LONG;
- }
- }
- return HASH_KEY_NON_EXISTANT;
-}
-
-
-ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData)
-{
- Bucket *p = ht->pInternalPointer;
-
- if (p) {
- *pData = p->pData;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_hash_sort(HashTable *ht, 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 cb8369c530..0000000000
--- a/Zend/zend_hash.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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;
- int (*pDestructor) (void *pData);
- unsigned char persistent;
-} HashTable;
-
-
-BEGIN_EXTERN_C()
-
-/* startup/shutdown */
-ZEND_API int zend_hash_init(HashTable *ht, uint nSize, ulong(*pHashFunction) (char *arKey, uint nKeyLength), int (*pDestructor) (void *pData), int persistent);
-ZEND_API void zend_hash_destroy(HashTable *ht);
-
-ZEND_API void zend_hash_clean(HashTable *ht);
-
-/* additions/updates/changes */
-ZEND_API int zend_hash_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData, uint nDataSize, void **pDest,int flag);
-#define zend_hash_update(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
- zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_UPDATE)
-#define zend_hash_add(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
- zend_hash_add_or_update(ht,arKey,nKeyLength,pData,nDataSize,pDest,HASH_ADD)
-#define zend_hash_update_ptr(ht,arKey,nKeyLength,pData,nDataSize,pDest) \
- zend_hash_add_or_update(ht,arKey,nKeyLength,pData,0,pDest,(HASH_UPDATE|HASH_ADD_PTR))
-
-ZEND_API int zend_hash_quick_add_or_update(HashTable *ht, char *arKey, uint nKeyLength, ulong h, void *pData, uint nDataSize, void **pDest,int flag);
-#define zend_hash_quick_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
- zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_UPDATE)
-#define zend_hash_quick_add(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
- zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,nDataSize,pDest,HASH_ADD)
-#define zend_hash_quick_update_ptr(ht,arKey,nKeyLength,h,pData,nDataSize,pDest) \
- zend_hash_quick_add_or_update(ht,arKey,nKeyLength,h,pData,0,pDest,HASH_UPDATE|HASH_ADD_PTR)
-
-ZEND_API int zend_hash_index_update_or_next_insert(HashTable *ht, ulong h, void *pData, uint nDataSize, void **pDest, int flag);
-#define zend_hash_index_update(ht,h,pData,nDataSize,pDest) \
- zend_hash_index_update_or_next_insert(ht,h,pData,nDataSize,pDest,HASH_UPDATE)
-#define zend_hash_next_index_insert(ht,pData,nDataSize,pDest) \
- zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT)
-#define zend_hash_next_index_insert_ptr(ht,pData,nDataSize,pDest) \
- zend_hash_index_update_or_next_insert(ht,0,pData,nDataSize,pDest,HASH_NEXT_INSERT|HASH_ADD_PTR)
-
-ZEND_API int zend_hash_pointer_update(HashTable *ht, char *arKey, uint nKeyLength, void *pData);
-
-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_key_type(HashTable *ht);
-ZEND_API int zend_hash_get_current_data(HashTable *ht, void **pData);
-ZEND_API void zend_hash_internal_pointer_reset(HashTable *ht);
-ZEND_API void zend_hash_internal_pointer_end(HashTable *ht);
-
-/* Copying, merging and sorting */
-ZEND_API void zend_hash_copy(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size);
-ZEND_API void zend_hash_merge(HashTable *target, HashTable *source, void (*pCopyConstructor) (void *pData), void *tmp, uint size, int overwrite);
-ZEND_API int zend_hash_sort(HashTable *ht, 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
-
-END_EXTERN_C()
-
-#endif /* _HASH_ */
diff --git a/Zend/zend_highlight.c b/Zend/zend_highlight.c
deleted file mode 100644
index a2621ae272..0000000000
--- a/Zend/zend_highlight.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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"
-
-#ifndef ZTS
-extern char *zendtext;
-extern int zendleng;
-#else
-#define zendtext ((char *) zend_get_zendtext(CLS_C))
-#define zendleng zend_get_zendleng(CLS_C)
-#endif
-
-static void html_putc(char c)
-{
- switch (c) {
- case '\n':
- ZEND_PUTS("<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++);
- }
-}
-
-
-
-ZEND_API 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 T_INLINE_HTML:
- next_color = syntax_highlighter_ini->highlight_html;
- break;
- case T_COMMENT:
- next_color = syntax_highlighter_ini->highlight_comment;
- break;
- case T_OPEN_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CLOSE_TAG:
- next_color = syntax_highlighter_ini->highlight_default;
- break;
- case T_CONSTANT_ENCAPSED_STRING:
- next_color = syntax_highlighter_ini->highlight_string;
- break;
- case '"':
- next_color = syntax_highlighter_ini->highlight_string;
- in_string = !in_string;
- break;
- case T_WHITESPACE:
- html_puts(zendtext, zendleng); /* no color needed */
- token.type = 0;
- continue;
- break;
- default:
- if (token.type==0) {
- next_color = syntax_highlighter_ini->highlight_keyword;
- } else {
- if (in_string) {
- next_color = syntax_highlighter_ini->highlight_string;
- } else {
- next_color = syntax_highlighter_ini->highlight_default;
- }
- }
- break;
- }
-
- if (last_color != next_color) {
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</font>");
- }
- last_color = next_color;
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("<font color=\"%s\">", last_color);
- }
- }
- switch (token_type) {
- case T_DOLLAR_OPEN_CURLY_BRACES:
- html_puts("{", 1);
- break;
- default:
- html_puts(zendtext, zendleng);
- break;
- }
-
- if (token.type == IS_STRING) {
- switch (token_type) {
- case T_OPEN_TAG:
- case T_CLOSE_TAG:
- case T_WHITESPACE:
- break;
- default:
- efree(token.value.str.val);
- break;
- }
- }
- token.type = 0;
- }
- if (last_color != syntax_highlighter_ini->highlight_html) {
- zend_printf("</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 61b75ebab9..0000000000
--- a/Zend/zend_highlight.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 _zend_syntax_highlighter_ini {
- char *highlight_html;
- char *highlight_comment;
- char *highlight_default;
- char *highlight_string;
- char *highlight_keyword;
-} zend_syntax_highlighter_ini;
-
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_highlight(zend_syntax_highlighter_ini *syntax_highlighter_ini);
-int highlight_file(char *filename, zend_syntax_highlighter_ini *syntax_highlighter_ini);
-int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_ini);
-END_EXTERN_C()
-
-extern zend_syntax_highlighter_ini syntax_highlighter_ini;
-
-#endif
diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c
deleted file mode 100644
index dcb48a9558..0000000000
--- a/Zend/zend_indent.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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"
-
-#ifndef ZTS
-extern char *zendtext;
-extern int zendleng;
-#else
-#define zendtext ((char *) zend_get_zendtext(CLS_C))
-#define zendleng zend_get_zendleng(CLS_C)
-#endif
-
-
-static void handle_whitespace(int *emit_whitespace)
-{
- unsigned char c;
- int i;
-
- for (c=0; c<128; c++) {
- if (emit_whitespace[c]>0) {
- for (i=0; i<emit_whitespace[c]; i++) {
- zend_write((char *) &c, 1);
- }
- }
- }
- memset(emit_whitespace, 0, sizeof(int)*256);
-}
-
-
-ZEND_API 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 T_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 T_OPEN_TAG:
- case T_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 aefc26464b..0000000000
--- a/Zend/zend_indent.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_INDENT_H
-#define _ZEND_INDENT_H
-
-ZEND_API void zend_indent();
-
-#endif /* _ZEND_INDENT_H */
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
deleted file mode 100644
index 44992abd3e..0000000000
--- a/Zend/zend_list.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include "zend.h"
-#include "zend_list.h"
-#include "zend_API.h"
-#include "zend_globals.h"
-
-
-ZEND_API int le_index_ptr;
-
-static inline int zend_list_do_insert(HashTable *list,void *ptr, int type)
-{
- int index;
- list_entry le;
-
- index = zend_hash_next_free_element(list);
-
- if (index==0) index++;
-
- le.ptr=ptr;
- le.type=type;
- le.refcount=1;
- zend_hash_index_update(list, index, (void *) &le, sizeof(list_entry), NULL);
- return index;
-}
-
-static inline int zend_list_do_delete(HashTable *list,int id)
-{
- list_entry *le;
- ELS_FETCH();
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
- if (--le->refcount<=0) {
- return zend_hash_index_del(&EG(regular_list), id);
- } else {
- return SUCCESS;
- }
- } else {
- return FAILURE;
- }
-}
-
-
-static inline void *zend_list_do_find(HashTable *list,int id, int *type)
-{
- list_entry *le;
-
- if (zend_hash_index_find(list, id, (void **) &le)==SUCCESS) {
- *type = le->type;
- return le->ptr;
- } else {
- *type = -1;
- return NULL;
- }
-}
-
-
-ZEND_API int zend_list_insert(void *ptr, int type)
-{
- ELS_FETCH();
-
- return zend_list_do_insert(&EG(regular_list), ptr, type);
-}
-
-
-ZEND_API int zend_plist_insert(void *ptr, int type)
-{
- ELS_FETCH();
-
- return zend_list_do_insert(&EG(persistent_list), ptr, type);
-}
-
-
-ZEND_API int zend_list_addref(int id)
-{
- list_entry *le;
- ELS_FETCH();
-
- if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
-/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
- le->refcount++;
- return SUCCESS;
- } else {
- return FAILURE;
- }
-}
-
-
-ZEND_API int zend_list_delete(int id)
-{
- ELS_FETCH();
-
- return zend_list_do_delete(&EG(regular_list), id);
-}
-
-
-ZEND_API int zend_plist_delete(int id)
-{
- ELS_FETCH();
-
- return zend_list_do_delete(&EG(persistent_list), id);
-}
-
-
-ZEND_API void *zend_list_find(int id, int *type)
-{
- ELS_FETCH();
-
- return zend_list_do_find(&EG(regular_list), id, type);
-}
-
-
-ZEND_API void *zend_plist_find(int id, int *type)
-{
- ELS_FETCH();
-
- return zend_list_do_find(&EG(persistent_list), id, type);
-}
-
-
-int 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);
- }
- return 1;
-}
-
-
-int plist_entry_destructor(void *ptr)
-{
- list_entry *le = (list_entry *) ptr;
- list_destructors_entry *ld;
-
- if (zend_hash_index_find(&list_destructors,le->type,(void **) &ld)==SUCCESS) {
- if (ld->plist_destructor) {
- (ld->plist_destructor)(le->ptr);
- }
- } else {
- zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type);
- }
- return 1;
-}
-
-
-int init_resource_list(ELS_D)
-{
- return zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0);
-}
-
-
-int init_resource_plist(ELS_D)
-{
- return zend_hash_init(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1);
-}
-
-
-void destroy_resource_list(void)
-{
- ELS_FETCH();
-
- zend_hash_destroy(&EG(regular_list));
-}
-
-
-void destroy_resource_plist(void)
-{
- ELS_FETCH();
-
- zend_hash_destroy(&EG(persistent_list));
-}
-
-
-static int clean_module_resource(list_entry *le, int *resource_id)
-{
- if (le->type == *resource_id) {
- return 1;
- } else {
- return 0;
- }
-}
-
-
-int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number)
-{
- if (ld->module_number == *module_number) {
- ELS_FETCH();
-
- zend_hash_apply_with_argument(&EG(persistent_list), (int (*)(void *,void *)) clean_module_resource, (void *) &(ld->resource_id));
- return 1;
- } else {
- return 0;
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- */
diff --git a/Zend/zend_list.h b/Zend/zend_list.h
deleted file mode 100644
index b7bf03f4ed..0000000000
--- a/Zend/zend_list.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _LIST_H
-#define _LIST_H
-
-#include "zend_hash.h"
-#include "zend_globals.h"
-
-extern HashTable list_destructors;
-
-typedef struct _list_entry {
- void *ptr;
- int type;
- int refcount;
-} list_entry;
-
-typedef struct _list_destructors_entry {
- void (*list_destructor)(void *);
- void (*plist_destructor)(void *);
- int module_number;
- int resource_id;
-} list_destructors_entry;
-
-#define register_list_destructors(ld,pld) _register_list_destructors((void (*)(void *))ld, (void (*)(void *))pld, module_number);
-ZEND_API int _register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number);
-
-enum list_entry_type {
- LE_DB=1000
-};
-
-int list_entry_destructor(void *ptr);
-int plist_entry_destructor(void *ptr);
-
-int clean_module_resource_destructors(list_destructors_entry *ld, int *module_number);
-int init_resource_list(ELS_D);
-int init_resource_plist(ELS_D);
-void destroy_resource_list(void);
-void destroy_resource_plist(void);
-
-ZEND_API int zend_list_insert(void *ptr, int type);
-ZEND_API int zend_plist_insert(void *ptr, int type);
-ZEND_API int zend_list_addref(int id);
-ZEND_API int zend_list_delete(int id);
-ZEND_API int zend_plist_delete(int id);
-ZEND_API void *zend_list_find(int id, int *type);
-ZEND_API void *zend_plist_find(int id, int *type);
-
-extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
-
-#endif
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c
deleted file mode 100644
index e7f69c546c..0000000000
--- a/Zend/zend_llist.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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_prepend_element(zend_llist *l, void *element)
-{
- zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent);
-
- tmp->next = l->head;
- tmp->prev = NULL;
- if (l->head) {
- l->head->prev = tmp;
- } else {
- l->tail = tmp;
- }
- l->head = tmp;
- memcpy(tmp->data, element, l->size);
-}
-
-
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element)
-{
- zend_llist_element *current=l->head;
-
- while (current) {
- if (!memcmp(current->data, element, l->size)) {
- if (current->prev) {
- current->prev->next = current->next;
- } else {
- l->head = current->next;
- }
- if (current->next) {
- current->next->prev = current->prev;
- } else {
- l->tail = current->prev;
- }
- if (l->dtor) {
- l->dtor(current->data);
- efree(current);
- }
- break;
- }
- current = current->next;
- }
-}
-
-
-ZEND_API void zend_llist_destroy(zend_llist *l)
-{
- zend_llist_element *current=l->head, *next;
-
- while (current) {
- next = current->next;
- if (l->dtor) {
- l->dtor(current->data);
- }
- pefree(current, l->persistent);
- current = next;
- }
-}
-
-
-ZEND_API void zend_llist_clean(zend_llist *l)
-{
- zend_llist_destroy(l);
- l->head = l->tail = NULL;
-}
-
-
-ZEND_API void zend_llist_remove_tail(zend_llist *l)
-{
- zend_llist_element *old_tail;
-
- if ((old_tail = l->tail)) {
- if (l->tail->prev) {
- l->tail->prev->next = NULL;
- }
- l->tail = l->tail->prev;
- efree(old_tail);
- }
-}
-
-
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src)
-{
- zend_llist_element *ptr;
-
- zend_llist_init(dst, src->size, src->dtor, src->persistent);
- ptr = src->head;
- while (ptr) {
- zend_llist_add_element(dst, ptr->data);
- ptr = ptr->next;
- }
-}
-
-
-ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data))
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data);
- }
-}
-
-
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg)
-{
- zend_llist_element *element;
-
- for (element=l->head; element; element=element->next) {
- func(element->data, arg);
- }
-}
-
-
-ZEND_API int zend_llist_count(zend_llist *l)
-{
- zend_llist_element *element;
- int element_count=0;
-
- for (element=l->head; element; element=element->next) {
- element_count++;
- }
- return element_count;
-}
-
-
-ZEND_API void *zend_llist_get_first(zend_llist *l)
-{
- l->traverse_ptr = l->head;
- if (l->traverse_ptr) {
- return l->traverse_ptr->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_last(zend_llist *l)
-{
- l->traverse_ptr = l->tail;
- if (l->traverse_ptr) {
- return l->traverse_ptr->data;
- } else {
- return NULL;
- }
-}
-
-
-ZEND_API void *zend_llist_get_next(zend_llist *l)
-{
- if (l->traverse_ptr) {
- l->traverse_ptr = l->traverse_ptr->next;
- if (l->traverse_ptr) {
- return l->traverse_ptr->data;
- }
- }
- return NULL;
-}
-
-
-ZEND_API void *zend_llist_get_prev(zend_llist *l)
-{
- if (l->traverse_ptr) {
- l->traverse_ptr = l->traverse_ptr->prev;
- if (l->traverse_ptr) {
- return l->traverse_ptr->data;
- }
- }
- return NULL;
-}
diff --git a/Zend/zend_llist.h b/Zend/zend_llist.h
deleted file mode 100644
index f2767c1d59..0000000000
--- a/Zend/zend_llist.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 {
- zend_llist_element *head;
- zend_llist_element *tail;
- size_t size;
- void (*dtor)(void *data);
- unsigned char persistent;
- zend_llist_element *traverse_ptr;
-} zend_llist;
-
-BEGIN_EXTERN_C()
-ZEND_API void zend_llist_init(zend_llist *l, size_t size, void (*dtor)(void *data), unsigned char persistent);
-ZEND_API void zend_llist_add_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_del_element(zend_llist *l, void *element);
-ZEND_API void zend_llist_destroy(zend_llist *l);
-ZEND_API void zend_llist_clean(zend_llist *l);
-ZEND_API void zend_llist_remove_tail(zend_llist *l);
-ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
-ZEND_API void zend_llist_apply(zend_llist *l, void (*func)(void *data));
-ZEND_API void zend_llist_apply_with_argument(zend_llist *l, void (*func)(void *data, void *arg), void *arg);
-ZEND_API int zend_llist_count(zend_llist *l);
-
-/* traversal */
-ZEND_API void *zend_llist_get_first(zend_llist *l);
-ZEND_API void *zend_llist_get_last(zend_llist *l);
-ZEND_API void *zend_llist_get_next(zend_llist *l);
-ZEND_API void *zend_llist_get_prev(zend_llist *l);
-END_EXTERN_C()
-
-#endif /* _ZEND_LLIST_H */
diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h
deleted file mode 100644
index eb35234a74..0000000000
--- a/Zend/zend_modules.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _MODULES_H
-#define _MODULES_H
-
-#define INIT_FUNC_ARGS int type, int module_number
-#define INIT_FUNC_ARGS_PASSTHRU type, module_number
-#define SHUTDOWN_FUNC_ARGS int type, int module_number
-#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number
-#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module
-
-#define STANDARD_MODULE_PROPERTIES 0, 0, 0, NULL, 0
-
-
-#define MODULE_PERSISTENT 1
-#define MODULE_TEMPORARY 2
-
-typedef struct _zend_module_entry zend_module_entry;
-
-struct _zend_module_entry {
- char *name;
- zend_function_entry *functions;
- int (*module_startup_func)(INIT_FUNC_ARGS);
- int (*module_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- int (*request_startup_func)(INIT_FUNC_ARGS);
- int (*request_shutdown_func)(SHUTDOWN_FUNC_ARGS);
- void (*info_func)(ZEND_MODULE_INFO_FUNC_ARGS);
- int request_started, module_started;
- unsigned char type;
- void *handle;
- int module_number;
-};
-
-
-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);
-
-#define ZEND_MODULE_DTOR (int (*)(void *)) module_destructor
-#endif
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
deleted file mode 100644
index 46199b934b..0000000000
--- a/Zend/zend_opcode.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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
- {
- ELS_FETCH();
-
- op_array->start_op_number = op_array->end_op_number = op_array->last_executed_op_number = 0;
- op_array->backpatch_count = 0;
- if (EG(interactive)) {
- /* We must avoid a realloc() on the op_array in interactive mode, since pointers to constants
- * will become invalid
- */
- initial_ops_size = 8192;
- }
- }
-#endif
-
- op_array->refcount = (int *) emalloc(sizeof(int));
- *op_array->refcount = 1;
- op_array->size = initial_ops_size;
- op_array->last = 0;
- op_array->opcodes = NULL;
- op_array_alloc_ops(op_array);
-
- op_array->T = 0;
-
- op_array->function_name = NULL;
-
- op_array->arg_types = NULL;
-
- op_array->brk_cont_array = NULL;
- op_array->last_brk_cont = 0;
- op_array->current_brk_cont = -1;
-
- op_array->static_variables = NULL;
-
- op_array->uses_globals = 0;
-
- zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_ctor_handler, op_array);
-}
-
-
-ZEND_API int destroy_zend_function(zend_function *function)
-{
- switch (function->type) {
- case ZEND_USER_FUNCTION:
- destroy_op_array((zend_op_array *) function);
- break;
- case ZEND_INTERNAL_FUNCTION:
- /* do nothing */
- break;
- }
- return 1;
-}
-
-
-ZEND_API int destroy_zend_class(zend_class_entry *ce)
-{
- if (--(*ce->refcount)>0) {
- return 1;
- }
- switch (ce->type) {
- case ZEND_USER_CLASS:
- efree(ce->name);
- efree(ce->refcount);
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- break;
- case ZEND_INTERNAL_CLASS:
- free(ce->name);
- free(ce->refcount);
- zend_hash_destroy(&ce->function_table);
- zend_hash_destroy(&ce->default_properties);
- break;
- }
- return 1;
-}
-
-
-void zend_class_add_ref(zend_class_entry *ce)
-{
- (*ce->refcount)++;
-}
-
-
-ZEND_API void destroy_op_array(zend_op_array *op_array)
-{
- zend_op *opline = op_array->opcodes;
- zend_op *end = op_array->opcodes+op_array->last;
-
- if (--(*op_array->refcount)>0) {
- return;
- }
-
- efree(op_array->refcount);
-
- while (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 CLS_DC)
-{
- 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 CLS_CC);
- opline->opcode = ZEND_EXT_STMT;
- opline->op1.op_type = IS_UNUSED;
- opline->op2.op_type = IS_UNUSED;
- if (op_array->last>0) {
- opline->filename = op_array->opcodes[op_array->last-2].filename;
- opline->lineno= op_array->opcodes[op_array->last-2].lineno;
- }
-}
-
-
-
-static void zend_extension_op_array_handler(zend_extension *extension, zend_op_array *op_array)
-{
- if (extension->op_array_handler) {
- extension->op_array_handler(op_array);
- }
-}
-
-
-int pass_two(zend_op_array *op_array)
-{
- CLS_FETCH();
-
- if (op_array->type!=ZEND_USER_FUNCTION && op_array->type!=ZEND_EVAL_CODE) {
- return 0;
- }
- if (CG(extended_info)) {
- zend_update_extended_info(op_array CLS_CC);
- }
- if (CG(handle_op_arrays)) {
- zend_llist_apply_with_argument(&zend_extensions, (void (*)(void *, void *)) zend_extension_op_array_handler, op_array);
- }
- return 0;
-}
-
-
-void pass_include_eval(zend_op_array *op_array)
-{
- zend_op *opline=op_array->opcodes, *end=opline+op_array->last;
-
- while (opline<end) {
- if (opline->op1.op_type==IS_CONST) {
- opline->op1.u.constant.EA.is_ref = 1;
- }
- if (opline->op2.op_type==IS_CONST) {
- opline->op2.u.constant.EA.is_ref = 1;
- }
- opline++;
- }
-}
-
-
-int print_class(zend_class_entry *class_entry)
-{
- printf("Class %s:\n", class_entry->name);
- zend_hash_apply(&class_entry->function_table, (int (*)(void *)) pass_two);
- printf("End of class %s.\n\n", class_entry->name);
- return 0;
-}
-
-ZEND_API unary_op_type get_unary_op(int opcode)
-{
- switch(opcode) {
- case ZEND_BW_NOT:
- return (unary_op_type) bitwise_not_function;
- break;
- case ZEND_BOOL_NOT:
- return (unary_op_type) boolean_not_function;
- break;
- default:
- return (unary_op_type) NULL;
- break;
- }
-}
-
-
-ZEND_API void *get_binary_op(int opcode)
-{
- switch (opcode) {
- case ZEND_ADD:
- case ZEND_ASSIGN_ADD:
- return (void *) add_function;
- break;
- case ZEND_SUB:
- case ZEND_ASSIGN_SUB:
- return (void *) sub_function;
- break;
- case ZEND_MUL:
- case ZEND_ASSIGN_MUL:
- return (void *) mul_function;
- break;
- case ZEND_DIV:
- case ZEND_ASSIGN_DIV:
- return (void *) div_function;
- break;
- case ZEND_MOD:
- case ZEND_ASSIGN_MOD:
- return (void *) mod_function;
- break;
- case ZEND_SL:
- case ZEND_ASSIGN_SL:
- return (void *) shift_left_function;
- break;
- case ZEND_SR:
- case ZEND_ASSIGN_SR:
- return (void *) shift_right_function;
- break;
- case ZEND_CONCAT:
- case ZEND_ASSIGN_CONCAT:
- return (void *) concat_function;
- break;
- case ZEND_IS_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 d73feecd83..0000000000
--- a/Zend/zend_operators.c
+++ /dev/null
@@ -1,1348 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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;
- case IS_BOOL:
- op->type = IS_LONG;
- break;
-#if WITH_BCMATH
- case IS_BC:
- op->type = IS_DOUBLE; /* may have lost significant digits */
- break;
-#endif
- default:
- op->value.lval = strtol(op->value.str.val, NULL, 10);
- op->type = IS_LONG;
- break;
- }
- STR_FREE(strval);
- } else if (op->type == IS_BOOL || op->type==IS_RESOURCE) {
- op->type = IS_LONG;
- }
-}
-
-#define zendi_convert_scalar_to_number(op, holder) \
- if ((op)->type == IS_STRING) { \
- switch (((holder).type=is_numeric_string((op)->value.str.val, (op)->value.str.len, &(holder).value.lval, &(holder).value.dval))) { \
- case IS_DOUBLE: \
- case IS_LONG: \
- break; \
- case IS_BC: \
- (holder).type = IS_DOUBLE; /* may have lost significant digits */ \
- break; \
- default: \
- (holder).value.lval = strtol((op)->value.str.val, NULL, 10); \
- (holder).type = IS_LONG; \
- break; \
- } \
- (op) = &(holder); \
- } else if ((op)->type==IS_BOOL || (op)->type==IS_RESOURCE) { \
- (holder) = *(op); \
- (holder).type = IS_LONG; \
- (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: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.obj.properties)?1:0); \
- break; \
- default: \
- zend_error(E_WARNING, "Cannot convert to ordinal value"); \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_LONG; \
- (op) = &(holder); \
- }
-
-
-#define zendi_convert_to_boolean(op, holder) \
- 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: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.ht)?1:0); \
- break; \
- case IS_OBJECT: \
- (holder).value.lval = (zend_hash_num_elements((op)->value.obj.properties)?1:0); \
- break; \
- default: \
- (holder).value.lval = 0; \
- break; \
- } \
- (holder).type = IS_BOOL; \
- (op) = &(holder); \
- } \
-
-
-ZEND_API void convert_to_long(zval *op)
-{
- convert_to_long_base(op, 10);
-}
-
-
-ZEND_API void convert_to_long_base(zval *op, int base)
-{
- char *strval;
- long tmp;
-
- switch (op->type) {
- case IS_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:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.dval = tmp;
- op->type = IS_DOUBLE;
- break;
- case IS_OBJECT:
- tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0);
- zval_dtor(op);
- op->value.dval = tmp;
- op->type = IS_DOUBLE;
- break;
- default:
- zend_error(E_WARNING, "Cannot convert to real value (type=%d)", op->type);
- zval_dtor(op);
- op->value.dval = 0;
- op->type = IS_DOUBLE;
- break;
- }
-}
-
-
-ZEND_API void convert_to_boolean(zval *op)
-{
- char *strval;
- int tmp;
-
- switch (op->type) {
- case IS_BOOL:
- break;
- case IS_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:
- tmp = (zend_hash_num_elements(op->value.ht)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- case IS_OBJECT:
- tmp = (zend_hash_num_elements(op->value.obj.properties)?1:0);
- zval_dtor(op);
- op->value.lval = tmp;
- break;
- default:
- zval_dtor(op);
- op->value.lval = 0;
- break;
- }
- op->type = IS_BOOL;
-}
-
-
-ZEND_API void convert_to_string(zval *op)
-{
- long lval;
- double dval;
- ELS_FETCH();
-
- switch (op->type) {
- case IS_STRING:
- break;
- case IS_BOOL:
- if (op->value.lval) {
- op->value.str.val = estrndup("1", 1);
- op->value.str.len = 1;
- } else {
- op->value.str.val = empty_string;
- op->value.str.len = 0;
- }
- break;
- case IS_LONG:
- lval = op->value.lval;
-
- op->value.str.val = (char *) emalloc(MAX_LENGTH_OF_LONG + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%ld", lval); /* SAFE */
- break;
- case IS_DOUBLE: {
- dval = op->value.dval;
- op->value.str.val = (char *) emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
- op->value.str.len = zend_sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval); /* SAFE */
- /* %G already handles removing trailing zeros from the fractional part, yay */
- break;
- }
- case IS_ARRAY:
- zval_dtor(op);
- op->value.str.val = estrndup("Array",sizeof("Array")-1);
- op->value.str.len = sizeof("Array")-1;
- break;
- case IS_OBJECT:
- zval_dtor(op);
- op->value.str.val = estrndup("Object",sizeof("Object")-1);
- op->value.str.len = sizeof("Object")-1;
- break;
- default:
- zval_dtor(op);
- var_reset(op);
- break;
- }
- op->type = IS_STRING;
-}
-
-
-static void convert_scalar_to_array(zval *op, int type)
-{
- zval *entry = (zval *) emalloc(sizeof(zval));
-
- *entry = *op;
- INIT_PZVAL(entry);
-
- switch (type) {
- case IS_ARRAY:
- op->value.ht = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(op->value.ht, 0, NULL, PVAL_PTR_DTOR, 0);
- zend_hash_index_update(op->value.ht, 0, (void *) &entry, sizeof(zval *), NULL);
- op->type = IS_ARRAY;
- break;
- case IS_OBJECT:
- op->value.obj.properties = (HashTable *) emalloc(sizeof(HashTable));
- zend_hash_init(op->value.obj.properties, 0, NULL, PVAL_PTR_DTOR, 0);
- zend_hash_update(op->value.obj.properties, "scalar", sizeof("scalar"), (void *) &entry, sizeof(zval *), NULL);
- op->value.obj.ce = &zend_standard_class_def;
- op->type = IS_OBJECT;
- break;
- }
-}
-
-
-ZEND_API void convert_to_array(zval *op)
-{
- switch(op->type) {
- case IS_ARRAY:
- return;
- break;
- case IS_OBJECT:
- op->type = IS_ARRAY;
- op->value.ht = op->value.obj.properties;
- return;
- break;
- default:
- convert_scalar_to_array(op, IS_ARRAY);
- break;
- }
-}
-
-
-ZEND_API void convert_to_object(zval *op)
-{
- switch(op->type) {
- case IS_ARRAY:
- op->type = IS_OBJECT;
- op->value.obj.properties = op->value.ht;
- op->value.obj.ce = &zend_standard_class_def;
- return;
- break;
- case IS_OBJECT:
- return;
- break;
- default:
- convert_scalar_to_array(op, IS_OBJECT);
- break;
- }
-}
-
-
-ZEND_API int add_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_ARRAY && op2->type == IS_ARRAY) {
- zval *tmp;
-
- *result = *op1;
- zval_copy_ctor(result);
- zend_hash_merge(result->value.ht, op2->value.ht, (void (*)(void *pData)) zval_add_ref, (void *) &tmp, sizeof(zval *), 0);
- return SUCCESS;
- }
- zendi_convert_scalar_to_number(op1, op1_copy);
- 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->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) + op2->value.dval) :
- (op1->value.dval + ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval + op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int sub_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy);
- 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->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) - op2->value.dval) :
- (op1->value.dval - ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval - op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mul_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy);
- 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->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) * op2->value.dval) :
- (op1->value.dval * ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval * op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-ZEND_API int div_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_scalar_to_number(op1, op1_copy);
- 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->value.dval = (op1->type == IS_LONG ?
- (((double) op1->value.lval) / op2->value.dval) :
- (op1->value.dval / ((double) op2->value.lval)));
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if (op1->type == IS_DOUBLE && op2->type == IS_DOUBLE) {
- result->type = IS_DOUBLE;
- result->value.dval = op1->value.dval / op2->value.dval;
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE; /* unknown datatype */
-}
-
-
-ZEND_API int mod_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- zendi_convert_to_long(op1, op1_copy);
- 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;
- int use_copy1, use_copy2;
-
-
- zend_make_printable_zval(op1, &op1_copy, &use_copy1);
- zend_make_printable_zval(op2, &op2_copy, &use_copy2);
-
- if (use_copy1) {
- op1 = &op1_copy;
- }
- if (use_copy2) {
- op2 = &op2_copy;
- }
- if (result==op1) { /* special case, perform operations on result */
- uint res_len = op1->value.str.len + op2->value.str.len;
-
- if (result->value.str.len == 0) { /* handle empty_string */
- STR_FREE(result->value.str.val);
- result->value.str.val = emalloc(res_len+1);
- } else {
- result->value.str.val = erealloc(result->value.str.val, res_len+1);
- }
- memcpy(result->value.str.val+result->value.str.len, op2->value.str.val, op2->value.str.len);
- result->value.str.val[res_len]=0;
- result->value.str.len = res_len;
- } else {
- result->value.str.len = op1->value.str.len + op2->value.str.len;
- result->value.str.val = (char *) emalloc(result->value.str.len + 1);
- memcpy(result->value.str.val, op1->value.str.val, op1->value.str.len);
- memcpy(result->value.str.val+op1->value.str.len, op2->value.str.val,op2->value.str.len);
- result->value.str.val[result->value.str.len] = 0;
- result->type = IS_STRING;
- }
- if (use_copy1) {
- zval_dtor(op1);
- }
- if (use_copy2) {
- zval_dtor(op2);
- }
- return SUCCESS;
-}
-
-
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2)
-{
- zval op1_copy, op2_copy;
-
- if (op1->type == IS_STRING && op2->type == IS_STRING) {
- zendi_smart_strcmp(result,op1,op2);
- return SUCCESS;
- }
-
- if (op1->type == IS_BOOL || op2->type == IS_BOOL) {
- zendi_convert_to_boolean(op1, op1_copy);
- zendi_convert_to_boolean(op2, op2_copy);
- 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->value.dval = (op1->type == IS_LONG ? (double) op1->value.lval : op1->value.dval) - (op2->type == IS_LONG ? (double) op2->value.lval : op2->value.dval);
- result->type = IS_DOUBLE;
- return SUCCESS;
- }
- if ((op1->type==IS_ARRAY || op1->type==IS_OBJECT)
- && (op2->type==IS_ARRAY || op2->type==IS_OBJECT)) {
- zend_error(E_WARNING,"Cannot compare arrays or objects");
- }
- var_reset(result);
- return FAILURE;
-}
-
-
-ZEND_API int is_equal_function(zval *result, zval *op1, zval *op2)
-{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval == 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_not_equal_function(zval *result, zval *op1, zval *op2)
-{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- convert_to_boolean(result);
- if (result->value.lval) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int is_smaller_function(zval *result, zval *op1, zval *op2)
-{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- if (result->value.lval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_LONG;
- if (result->value.dval < 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-ZEND_API int is_smaller_or_equal_function(zval *result, zval *op1, zval *op2)
-{
- if (compare_function(result, op1, op2) == FAILURE) {
- return FAILURE;
- }
- if (result->type == IS_LONG) {
- if (result->value.lval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- if (result->type == IS_DOUBLE) {
- result->type = IS_LONG;
- if (result->value.dval <= 0) {
- result->value.lval = 1;
- } else {
- result->value.lval = 0;
- }
- return SUCCESS;
- }
- zend_error(E_ERROR, "Unsupported operand types");
- return FAILURE;
-}
-
-
-#define LOWER_CASE 1
-#define UPPER_CASE 2
-#define NUMERIC 3
-
-
-static void increment_string(zval *str)
-{
- int carry=0;
- int pos=str->value.str.len-1;
- char *s=str->value.str.val;
- char *t;
- int last=0; /* Shut up the compiler warning */
- int ch;
-
- while(pos >= 0) {
- ch = s[pos];
- if (ch >= 'a' && ch <= 'z') {
- if (ch == 'z') {
- s[pos] = 'a';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=LOWER_CASE;
- } else if (ch >= 'A' && ch <= 'Z') {
- if (ch == 'Z') {
- s[pos] = 'A';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last=UPPER_CASE;
- } else if (ch >= '0' && ch <= '9') {
- if (ch == '9') {
- s[pos] = '0';
- carry=1;
- } else {
- s[pos]++;
- carry=0;
- }
- last = NUMERIC;
- } else {
- carry=0;
- break;
- }
- if (carry == 0) {
- break;
- }
- pos--;
- }
-
- if (carry) {
- t = (char *) emalloc(str->value.str.len+1+1);
- memcpy(t+1,str->value.str.val, str->value.str.len);
- str->value.str.len++;
- t[str->value.str.len] = '\0';
- switch (last) {
- case NUMERIC:
- t[0] = '1';
- break;
- case UPPER_CASE:
- t[0] = 'A';
- break;
- case LOWER_CASE:
- t[0] = 'a';
- break;
- }
- STR_FREE(str->value.str.val);
- str->value.str.val = t;
- }
-}
-
-
-ZEND_API int increment_function(zval *op1)
-{
- switch (op1->type) {
- case IS_LONG:
- op1->value.lval++;
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval + 1;
- break;
- case IS_STRING: /* Perl style string increment */
- if (op1->value.str.len==0) { /* consider as 0 */
- STR_FREE(op1->value.str.val);
- op1->value.lval = 1;
- op1->type = IS_LONG;
- } else {
- increment_string(op1);
- }
- break;
- default:
- return FAILURE;
- }
- return SUCCESS;
-}
-
-
-ZEND_API int decrement_function(zval *op1)
-{
- long lval;
-
- switch (op1->type) {
- case IS_LONG:
- op1->value.lval--;
- break;
- case IS_DOUBLE:
- op1->value.dval = op1->value.dval - 1;
- break;
- case IS_STRING: /* Like perl we only support string increment */
- if (op1->value.str.len==0) { /* consider as 0 */
- STR_FREE(op1->value.str.val);
- op1->value.lval = -1;
- op1->type = IS_LONG;
- break;
- } else if (is_numeric_string(op1->value.str.val, op1->value.str.len, &lval, NULL)==IS_LONG) { /* long */
- 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 int zend_binary_strcasecmp(zval *s1, zval *s2)
-{
- const unsigned char *p1 = (const unsigned char *)s1->value.str.val;
- const unsigned char *p2 = (const unsigned char *)s2->value.str.val;
- unsigned char c1 = 0, c2 = 0;
- int len1, len2;
-
- len1 = s1->value.str.len;
- len2 = s2->value.str.len;
- if (len1 != len2 || !len1) {
- return len1 - len2;
- }
-
- while (len1--) {
- c1 = tolower(*p1++);
- c2 = tolower(*p2++);
- if (c1 != c2) {
- break;
- }
- }
-
- return c1 - c2;
-}
-
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2)
-{
- int ret1,ret2;
- long lval1, lval2;
- double dval1, dval2;
-
- if ((ret1=is_numeric_string(s1->value.str.val, s1->value.str.len, &lval1, &dval1)) &&
- (ret2=is_numeric_string(s2->value.str.val, s2->value.str.len, &lval2, &dval2))) {
-#if WITH_BCMATH
- if ((ret1==IS_BC) || (ret2==IS_BC)) {
- bc_num first, second;
-
- /* use the BC math library to compare the numbers */
- init_num(&first);
- init_num(&second);
- str2num(&first,s1->value.str.val,100); /* this scale should do */
- str2num(&second,s2->value.str.val,100); /* ditto */
- result->value.lval = bc_compare(first,second);
- result->type = IS_LONG;
- free_num(&first);
- free_num(&second);
- } else
-#endif
- if ((ret1==IS_DOUBLE) || (ret2==IS_DOUBLE)) {
- if (ret1!=IS_DOUBLE) {
- dval1 = strtod(s1->value.str.val, NULL);
- } else if (ret2!=IS_DOUBLE) {
- dval2 = strtod(s2->value.str.val, NULL);
- }
- result->value.dval = dval1 - dval2;
- result->type = IS_DOUBLE;
- } else { /* they both have to be long's */
- result->value.lval = lval1 - lval2;
- result->type = IS_LONG;
- }
- } else {
- result->value.lval = zend_binary_strcmp(s1,s2);
- result->type = IS_LONG;
- }
- return;
-}
-
-
-/* returns 0 for non-numeric string
- * returns IS_DOUBLE for floating point string, and assigns the value to *dval (if it's not NULL)
- * returns IS_LONG for integer strings, and assigns the value to *lval (if it's not NULL)
- * returns IS_BC if the number might lose accuracy when converted to a double
- */
-
-#if 1
-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 072d60e467..0000000000
--- a/Zend/zend_operators.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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);
-
-BEGIN_EXTERN_C()
-ZEND_API void convert_scalar_to_number(zval *op);
-ZEND_API void convert_to_string(zval *op);
-ZEND_API void convert_to_long(zval *op);
-ZEND_API void convert_to_long_base(zval *op, int base);
-ZEND_API void convert_to_boolean(zval *op);
-ZEND_API void convert_to_array(zval *op);
-ZEND_API void convert_to_object(zval *op);
-ZEND_API int add_char_to_string(zval *result, zval *op1, zval *op2);
-ZEND_API int add_string_to_string(zval *result, zval *op1, zval *op2);
-ZEND_API void convert_to_double(zval *op);
-END_EXTERN_C()
-
-ZEND_API int zval_is_true(zval *op);
-ZEND_API int compare_function(zval *result, zval *op1, zval *op2);
-
-ZEND_API void zend_str_tolower(char *str, unsigned int length);
-ZEND_API int zend_binary_strcmp(zval *s1, zval *s2);
-ZEND_API int zend_binary_strcasecmp(zval *s1, zval *s2);
-ZEND_API void zendi_smart_strcmp(zval *result, zval *s1, zval *s2);
-
-#endif
diff --git a/Zend/zend_ptr_stack.c b/Zend/zend_ptr_stack.c
deleted file mode 100644
index 35e5be2239..0000000000
--- a/Zend/zend_ptr_stack.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 599c4c454a..0000000000
--- a/Zend/zend_ptr_stack.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_PTR_STACK_H
-#define _ZEND_PTR_STACK_H
-
-typedef struct _zend_ptr_stack {
- short top, max;
- void **elements;
- void **top_element;
-} zend_ptr_stack;
-
-
-#define 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 1094451cec..0000000000
--- a/Zend/zend_sprintf.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#include <stdio.h>
-
-#include "zend.h"
-
-#if HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-
-#if BROKEN_SPRINTF
-int zend_sprintf(char *buffer, const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
- vsprintf(buffer, format, args);
- va_end(args);
-
- return strlen(buffer);
-}
-#endif
diff --git a/Zend/zend_stack.c b/Zend/zend_stack.c
deleted file mode 100644
index 1a4b062add..0000000000
--- a/Zend/zend_stack.c
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 520f010924..0000000000
--- a/Zend/zend_stack.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _ZEND_STACK_H
-#define _ZEND_STACK_H
-
-typedef struct _zend_stack {
- int top, max;
- void **elements;
-} zend_stack;
-
-
-#define STACK_BLOCK_SIZE 64
-
-ZEND_API int zend_stack_init(zend_stack *stack);
-ZEND_API int zend_stack_push(zend_stack *stack, void *element, int size);
-ZEND_API int zend_stack_top(zend_stack *stack, void **element);
-ZEND_API int zend_stack_del_top(zend_stack *stack);
-ZEND_API int zend_stack_int_top(zend_stack *stack);
-ZEND_API int zend_stack_is_empty(zend_stack *stack);
-ZEND_API int zend_stack_destroy(zend_stack *stack);
-ZEND_API void **zend_stack_base(zend_stack *stack);
-ZEND_API int zend_stack_count(zend_stack *stack);
-
-
-#endif /* _ZEND_STACK_H */
diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c
deleted file mode 100644
index bb23789848..0000000000
--- a/Zend/zend_variables.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <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 int zval_dtor(zval *zvalue)
-{
- if (zvalue->type==IS_LONG) {
- return 1;
- }
- 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))) {
- zend_hash_destroy(zvalue->value.ht);
- efree(zvalue->value.ht);
- }
- }
- break;
- case IS_OBJECT:
- zend_hash_destroy(zvalue->value.obj.properties);
- efree(zvalue->value.obj.properties);
- break;
- case IS_RESOURCE:
- /* destroy resource */
- zend_list_delete(zvalue->value.lval);
- break;
- case IS_LONG:
- case IS_DOUBLE:
- case IS_BOOL:
- default:
- return 1;
- break;
- }
- return 1;
-}
-
-
-void zval_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 7d3ad6fcc7..0000000000
--- a/Zend/zend_variables.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- +----------------------------------------------------------------------+
- | Zend Engine |
- +----------------------------------------------------------------------+
- | Copyright (c) 1998, 1999 Andi Gutmans, Zeev Suraski |
- +----------------------------------------------------------------------+
- | This source file is subject to version 0.91 of the Zend license, |
- | that is bundled with this package in the file LICENSE, and is |
- | available at through the world-wide-web at |
- | http://www.zend.com/license/0_91.txt. |
- | If you did not receive a copy of the Zend license and are unable to |
- | obtain it through the world-wide-web, please send a note to |
- | license@zend.com so we can mail you a copy immediately. |
- +----------------------------------------------------------------------+
- | Authors: Andi Gutmans <andi@zend.com> |
- | Zeev Suraski <zeev@zend.com> |
- +----------------------------------------------------------------------+
-*/
-
-
-#ifndef _VARIABLES_H
-#define _VARIABLES_H
-
-
-ZEND_API int zend_print_variable(zval *var);
-
-BEGIN_EXTERN_C()
-ZEND_API int zval_copy_ctor(zval *zvalue);
-ZEND_API int zval_dtor(zval *zvalue);
-END_EXTERN_C()
-
-ZEND_API int zval_ptr_dtor(zval **zval_ptr);
-void zval_add_ref(zval **p);
-
-#define PVAL_DESTRUCTOR (int (*)(void *)) zval_dtor
-#define PVAL_PTR_DTOR (int (*)(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/acinclude.m4 b/acinclude.m4
index 544192f97b..c14cddbb39 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -158,3 +158,27 @@ AC_SUBST(EXT_LIBS)
AC_SUBST(EXTINFO_DEPS)
dnl AC_SUBST(EXT_INCLUDE_CODE)
dnl AC_SUBST(EXT_MODULES_PTRS)
+
+dnl
+dnl Solaris requires main code to be position independent in order
+dnl to let shared objects find symbols. Weird. Ugly.
+dnl
+dnl Must be run after all --with-NN options that let the user
+dnl choose dynamic extensions, and after the gcc test.
+dnl
+AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
+ AC_MSG_CHECKING(whether -fPIC is required)
+ if test "$EXT_SHARED" != ""; then
+ os=`uname -sr 2>/dev/null`
+ case "$os" in
+ "SunOS 5.6"|"SunOS 5.7")
+ case "$CC" in
+ gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
+ *) CFLAGS="$CFLAGS -fpic";;
+ esac
+ AC_MSG_RESULT(yes);;
+ *)
+ AC_MSG_RESULT(no);;
+ esac
+ fi
+])
diff --git a/buildconf b/buildconf
index ada319ce09..1fad4f7fea 100755
--- a/buildconf
+++ b/buildconf
@@ -3,6 +3,8 @@
# do some version checking for the tools we use
if test "$1" = "--force"; then
shift
+elif test -r buildconf.stamp ; then
+ :
else
echo "buildconf: checking installation..."
@@ -42,15 +44,34 @@ else
echo "buildconf: automake version $am_version (ok)"
fi
- # The stuff from libtool we need is in CVS right now, so it is
- # not required to run buildconf.
+ # libtool 1.2f or newer
+ lt_pversion=`libtool --version 2>/dev/null|sed -e 's/^[^0-9]*//' -e 's/ .*//'`
+ if test "$lt_pversion" = ""; then
+ echo "buildconf: libtool not found."
+ echo " You need libtool version 1.3 or newer installed"
+ echo " to build PHP from CVS."
+ exit 1
+ fi
+ lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
+ IFS=.; set $lt_version; IFS=' '
+ if test "$1" -gt "1" || test "$2" -ge "3" || test "$2" = "2" -a "$3" = "f"
+ then
+ echo "buildconf: libtool version $lt_pversion (ok)"
+ else
+ echo "buildconf: libtool version $lt_pversion found."
+ echo " You need libtool version 1.2f or newer installed"
+ echo " to build PHP from CVS."
+ exit 1
+ fi
+
+ touch buildconf.stamp
fi
if test "$1" = "--copy"; then
automake_flags=--copy
fi
-if ! test -d libzend; then
+if test ! -d libzend; then
if test -d ../libzend; then
echo "buildconf: linking ../libzend to ./libzend"
ln -s ../libzend .
@@ -60,7 +81,7 @@ if ! test -d libzend; then
exit 1
fi
fi
-if ! test -d TSRM; then
+if test ! -d TSRM; then
if test -d ../TSRM; then
echo "buildconf: linking ../TSRM to ./TSRM"
ln -s ../TSRM .
@@ -73,6 +94,8 @@ fi
./scripts/preconfig
+libtoolize --automake $automake_flags --force
+
mv aclocal.m4 aclocal.m4.old 2>/dev/null
aclocal
if cmp aclocal.m4.old aclocal.m4 > /dev/null 2>&1; then
diff --git a/config.guess b/config.guess
deleted file mode 100644
index 1d27287d5b..0000000000
--- a/config.guess
+++ /dev/null
@@ -1,997 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 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.
-# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit 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
-
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- alpha:OSF1:*:*)
- if test $UNAME_RELEASE = "V4.0"; then
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- fi
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- cat <<EOF >$dummy.s
- .globl main
- .ent main
-main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- ${CC-cc} $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
- exit 0 ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit 0 ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-cbm-sysv4
- exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
- amiga:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit 0 ;;
- arc64:OpenBSD:*:*)
- echo mips64el-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- hkmips:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- pmax:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sgi:OpenBSD:*:*)
- echo mips-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- wgrisc:OpenBSD:*:*)
- echo mipsel-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- SR2?01:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit 0;;
- Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit 0 ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit 0 ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- i86pc:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit 0 ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit 0 ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit 0 ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
- atari*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
- sun3*:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- mac68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme68k:OpenBSD:*:*)
- echo m68k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- mvme88k:OpenBSD:*:*)
- echo m88k-unknown-openbsd${UNAME_RELEASE}
- exit 0 ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit 0 ;;
- macppc:NetBSD:*:*)
- echo powerpc-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit 0 ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit 0 ;;
- 2020:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit 0 ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- ${CC-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)
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
- if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=4.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit 0 ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit 0 ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit 0 ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit 0 ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit 0 ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit 0 ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit 0 ;;
- 9000/[34678]??:HP-UX:*:*)
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 )
- sed 's/^ //' << EOF >$dummy.c
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
- rm -f $dummy.c $dummy
- esac
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit 0 ;;
- 3050*:HI-UX:*:*)
- sed 's/^ //' << EOF >$dummy.c
- #include <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 ;;
- *9??*:MPE*:*:*)
- echo hppa1.0-hp-mpeix
- exit 0 ;;
- *9??*:MPE*:*:*)
- echo hppa1.0-hp-mpeix
- exit 0 ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit 0 ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit 0 ;;
- i?86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit 0 ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit 0 ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit 0 ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit 0 ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit 0 ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit 0 ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit 0 ;;
- CRAY*X-MP:*:*:*)
- echo xmp-cray-unicos
- exit 0 ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
- exit 0 ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
- exit 0 ;;
- CRAY*T3E:*:*:*)
- echo t3e-cray-unicosmk${UNAME_RELEASE}
- exit 0 ;;
- CRAY-2:*:*:*)
- echo cray2-cray-unicos
- exit 0 ;;
- F300:UNIX_System_V:*:*)
- FUJITSU_SYS=`uname -p | tr [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 ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit 0 ;;
- *:FreeBSD:*:*)
- if test -x /usr/bin/objformat; then
- if test "elf" = "`/usr/bin/objformat`"; then
- echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
- exit 0
- fi
- fi
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- *:OpenBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit 0 ;;
- i*:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit 0 ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit 0 ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit 0 ;;
- *:GNU:*:*)
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit 0 ;;
- *:Linux:*:*)
-# # uname on the ARM produces all sorts of strangeness, and we need to
-# # filter it out.
-# case "$UNAME_MACHINE" in
-# armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
-# arm* | sa110*) UNAME_MACHINE="arm" ;;
-# esac
-
- # The BFD linker knows what the default object file format is, so
- # first see if it will tell us.
- ld_help_string=`ld --help 2>&1`
- ld_supported_emulations=`echo $ld_help_string \
- | sed -ne '/supported emulations:/!d
- s/[ ][ ]*/ /g
- s/.*supported emulations: *//
- s/ .*//
- p'`
- case "$ld_supported_emulations" in
- i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
- i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
- sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
- elf32arm) echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 ;;
- elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
- esac
-
- if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >$dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
-EOF
- LIBC=""
- ${CC-cc} $dummy.s -o $dummy 2>/dev/null
- if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
- UNAME_MACHINE="alpha"
- ;;
- 15)
- UNAME_MACHINE="alphaev5"
- ;;
- 14)
- UNAME_MACHINE="alphaev56"
- ;;
- 10)
- UNAME_MACHINE="alphapca56"
- ;;
- 16)
- UNAME_MACHINE="alphaev6"
- ;;
- esac
-
- objdump --private-headers $dummy | \
- grep ld.so.1 > /dev/null
- if test "$?" = 0 ; then
- LIBC="libc1"
- fi
- fi
- rm -f $dummy.s $dummy
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
- elif test "${UNAME_MACHINE}" = "mips" ; then
- cat >$dummy.c <<EOF
-#ifdef __cplusplus
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __MIPSEB__
- printf ("%s-unknown-linux-gnu\n", argv[1]);
-#endif
-#ifdef __MIPSEL__
- printf ("%sel-unknown-linux-gnu\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-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.
- # If ld does not provide *any* "supported emulations:"
- # that means it is gnuoldld.
- echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
- test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
-
- case "${UNAME_MACHINE}" in
- i?86)
- VENDOR=pc;
- ;;
- *)
- VENDOR=unknown;
- ;;
- esac
- # Determine whether the default compiler is a.out or elf
- cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-# if __GLIBC__ >= 2
- printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-# else
- printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
-# endif
-#else
- printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
-#endif
- return 0;
-}
-EOF
- ${CC-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:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit 0 ;;
- i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- i?86:*: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 ;;
- i?86:UnixWare:*:*)
- if /bin/uname -X 2>/dev/null >/dev/null ; then
- (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- fi
- echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
- exit 0 ;;
- pc:*:*:*)
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i386.
- echo i386-pc-msdosdjgpp
- exit 0 ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit 0 ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit 0 ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit 0 ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit 0 ;;
- M68*:*:R3V[567]*:*)
- test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
- 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4.3${OS_REL} && exit 0
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && echo i486-ncr-sysv4 && exit 0 ;;
- m68*:LynxOS:2.*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit 0 ;;
- i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit 0 ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit 0 ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit 0 ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit 0 ;;
- PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit 0 ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit 0 ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit 0 ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit 0 ;;
- news*:NEWS-OS:*:6*)
- echo mips-sony-newsos6
- exit 0 ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit 0 ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit 0 ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit 0 ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit 0 ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit 0 ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit 0 ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-#if !defined (ultrix)
- 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 ecf770cea1..0000000000
--- a/config.sub
+++ /dev/null
@@ -1,979 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92-97, 1998 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 | arc | arm \
- | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
- | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
- | hppa2.0w \
- | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
- | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
- | mips64 | mipsel | mips64el | mips64orion | mips64orionel \
- | mipstx39 | mipstx39el | armv[34][lb] \
- | sparc | sparclet | sparclite | sparc64 | v850)
- 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[34567]86)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
- | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
- | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
- | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
- | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
- | hppa2.0w-* \
- | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
- | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
- | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
- | sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\
- | mips64el-* | mips64orion-* | mips64orionel-* \
- | mipstx39-* | mipstx39el-* \
- | f301-* | armv*-*)
- ;;
- # 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
- ;;
- amigaos | amigados)
- basic_machine=m68k-cbm
- os=-amigaos
- ;;
- 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
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- os=-mpeix
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- os=-mpeix
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- os=-mvs
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i[34567]86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i[34567]86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i[34567]86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i[34567]86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- 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-gnu
- ;;
- mips*-linux*)
- basic_machine=mips-unknown
- os=-linux-gnu
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netwinder)
- basic_machine=armv4l-corel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- 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 | k5 | nexen)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | k6 | 6x86)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | nexen-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | k6-* | 6x86-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=rs6000-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- 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
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- 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-gnu ]; then
- basic_machine=mips-unknown
- else
- basic_machine=mips-mips
- fi
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sparc)
- 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
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \
- | -openstep* | -mpeix* | -oskit*)
- # 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*-corel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-ibm)
- os=-aix
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f301-fujitsu)
- os=-uxpv
- ;;
- *)
- 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
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -vxsim* | -vxworks*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- 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
index c1a9293861..108fac58bb 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -29,10 +29,9 @@ if test "$recurse" = "yes"; then
if test "$threadsafe" = "yes"; then
(set -x; test -d TSRM || mkdir TSRM; cd TSRM; $cwd/$srcdir/TSRM/configure --cache-file=$cachefile $@)
fi
+ (set -x; cd $srcdir; sh ltconfig --disable-static --enable-dlopen --cache-file=$cachefile ltmain.sh)
fi
-(set -x; cd $srcdir; ./ltconfig --disable-static --enable-dlopen --cache-file=$cachefile ltmain.sh)
-
dnl ## Diversion 1 is the initial checking of OS features, programs,
dnl ## libraries and so on.
@@ -53,8 +52,6 @@ divert(1)
dnl ## This is where the version number is changed from now on!
AM_INIT_AUTOMAKE(php, 4.0b2-dev)
-
-
PHP_VERSION=$VERSION
echo "/* automatically generated by configure */" > php_version.h.new
echo "/* edit configure.in.in to change version number */" >> php_version.h.new
@@ -86,9 +83,11 @@ 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/\./ /'`
+ oldIFS=$IFS; IFS=.
+ set `bison -V | sed -e 's/^GNU Bison version //'`
+ IFS=$oldIFS
if test "$1" = "1" -a "$2" -lt "25"; then
- AC_MSG_WARN(You will need bison 1.25 if you want to regenerate the PHP parsers (found $1.$2).)
+ AC_MSG_WARN(Bison 1.25 or newer needed to regenerate parsers (found $1.$2).)
fi
AC_MSG_RESULT($1.$2 (ok))
fi
@@ -871,6 +870,9 @@ 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"
+dnl add -fPIC option on Solaris if we are building dynamic extensions
+PHP_SOLARIS_PIC_WEIRDNESS
+
AC_SUBST(CFLAGS)
AC_SUBST(PROG_SENDMAIL)
AC_SUBST(CFLAGS_SHLIB)
@@ -887,7 +889,7 @@ AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME")
PHP_OS=`uname`
AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS")
-AC_OUTPUT(Makefile libphp4.module
+AC_OUTPUT(Makefile libphp4.module php4.spec
scripts/mkextlib regex/Makefile
@@EXT_MAKEFILES@@ build-defs.h, [
], [
diff --git a/ext/gd/config.h.stub b/ext/gd/config.h.stub
index 4e619595f7..db06b056cd 100644
--- a/ext/gd/config.h.stub
+++ b/ext/gd/config.h.stub
@@ -4,3 +4,6 @@
/* Define if you have the gd version 1.3 library (-lgd). */
#define HAVE_LIBGD13 0
+#undef FREETYPE_4BIT_ANTIALIAS_HACK
+#undef HAVE_LIBFREETYPE
+#undef HAVE_LIBTTF
diff --git a/ext/gd/config.m4 b/ext/gd/config.m4
index 6378535f0a..452c151fd3 100644
--- a/ext/gd/config.m4
+++ b/ext/gd/config.m4
@@ -44,10 +44,62 @@ dnl A whole whack of possible places where this might be
AC_CHECK_LIB(gd, gdImageString16, [ AC_DEFINE(HAVE_LIBGD13) ])
])
if test "$ac_cv_lib_gd_gdImageLine" = "yes"; then
+ CHECK_TTF="yes"
+ AC_ARG_WITH(ttf,
+ [ --with-ttf[=DIR] Include Freetype support],[
+ if test $withval = "no" ; then
+ CHECK_TTF=""
+ else
+ CHECK_TTF="$withval"
+ fi
+ ])
+
+ AC_MSG_CHECKING(whether to include ttf support)
+ if test -n "$CHECK_TTF" ; then
+ for i in /usr /usr/local "$CHECK_TTF" ; do
+ if test -f "$i/include/truetype.h" ; then
+ FREETYPE_DIR="$i"
+ fi
+ if test -f "$i/include/freetype.h" ; then
+ TTF_DIR="$i"
+ fi
+ done
+ if test -n "$FREETYPE_DIR" ; then
+ AC_DEFINE(HAVE_LIBFREETYPE)
+ AC_ADD_LIBRARY_WITH_PATH(freetype, $FREETYPE_DIR/lib)
+ AC_ADD_INCLUDE($FREETYPE_DIR/include)
+ AC_MSG_RESULT(yes)
+ else
+ if test -n "$TTF_DIR" ; then
+ AC_DEFINE(HAVE_LIBTTF)
+ AC_ADD_LIBRARY_WITH_PATH(ttf, $TTF_DIR/lib)
+ AC_ADD_INCLUDE($TTF_DIR/include)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+ else
+ AC_MSG_RESULT(no)
+ fi
+
if test -f /usr/pkg/include/gd/gd.h -a -z "$GD_INCLUDE" ; then
GD_INCLUDE="-I/usr/pkg/include/gd"
fi
- AC_CHECK_LIB(ttf, TT_Open_Face)
+
+ AC_MSG_CHECKING(whether to enable 4bit antialias hack with FreeType2)
+ AC_ARG_ENABLE(freetype-4bit-antialias-hack,
+ [ --enable-freetype-4bit-antialias-hack For the crazy with FreeType2.],[
+ if test "$enableval" = "yes" ; then
+ AC_DEFINE(FREETYPE_4BIT_ANTIALIAS_HACK, 1)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+
PHP_EXTENSION(gd)
EXTRA_LIBS="$EXTRA_LIBS $GD_LIBS"
INCLUDES="$INCLUDES $GD_INCLUDE"
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 511e349586..bd82f1ce70 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -49,7 +49,7 @@
#include <gdfontmb.h> /* 3 Medium bold font */
#include <gdfontl.h> /* 4 Large font */
#include <gdfontg.h> /* 5 Giant font */
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
# include "gdttf.h"
#endif
@@ -57,7 +57,7 @@
#define M_PI 3.14159265358979323846
#endif
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
static void php3_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int);
#endif
@@ -118,7 +118,7 @@ function_entry gd_functions[] = {
{"imagesx", php3_imagesxfn, NULL},
{"imagesy", php3_imagesyfn, NULL},
{"imagedashedline", php3_imagedashedline, NULL},
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
{"imagettfbbox", php3_imagettfbbox, NULL},
{"imagettftext", php3_imagettftext, NULL},
#endif
@@ -175,7 +175,7 @@ void php3_info_gd(ZEND_MODULE_INFO_FUNC_ARGS)
#else
php3_printf("Version 1.2");
#endif
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
php3_printf(" with FreeType support");
#endif
}
@@ -340,7 +340,8 @@ PHP_FUNCTION(imageloadfont) {
/* {{{ proto int imagecreate(int x_size, int y_size)
Create a new image */
-PHP_FUNCTION(imagecreate) {
+PHP_FUNCTION(imagecreate)
+{
pval *x_size, *y_size;
int ind;
gdImagePtr im;
@@ -362,7 +363,8 @@ PHP_FUNCTION(imagecreate) {
/* {{{ proto int imagecreatefromgif(string filename)
Create a new image from file or URL */
-PHP_FUNCTION(imagecreatefromgif ) {
+PHP_FUNCTION(imagecreatefromgif )
+{
pval *file;
int ind;
gdImagePtr im;
@@ -404,7 +406,8 @@ PHP_FUNCTION(imagecreatefromgif ) {
/* {{{ proto int imagedestroy(int im)
Destroy an image */
-PHP_FUNCTION(imagedestroy) {
+PHP_FUNCTION(imagedestroy)
+{
pval *imgind;
if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &imgind) == FAILURE) {
@@ -421,7 +424,8 @@ PHP_FUNCTION(imagedestroy) {
/* {{{ proto int imagecolorallocate(int im, int red, int green, int blue)
Allocate a color for an image */
-PHP_FUNCTION(imagecolorallocate) {
+PHP_FUNCTION(imagecolorallocate)
+{
pval *imgind, *red, *green, *blue;
int ind, ind_type;
int col;
@@ -457,7 +461,8 @@ PHP_FUNCTION(imagecolorallocate) {
/* im, x, y */
/* {{{ proto int imagecolorat(int im, int x, int y)
Get the index of the color of a pixel */
-PHP_FUNCTION(imagecolorat) {
+PHP_FUNCTION(imagecolorat)
+{
pval *imgind, *x, *y;
int ind, ind_type;
gdImagePtr im;
@@ -493,7 +498,8 @@ PHP_FUNCTION(imagecolorat) {
/* {{{ proto int imagecolorclosest(int im, int red, int green, int blue)
Get the index of the closest color to the specified color */
-PHP_FUNCTION(imagecolorclosest) {
+PHP_FUNCTION(imagecolorclosest)
+{
pval *imgind, *red, *green, *blue;
int ind, ind_type;
int col;
@@ -528,7 +534,8 @@ PHP_FUNCTION(imagecolorclosest) {
/* {{{ proto int imagecolordeallocate(int im, int index)
De-allocate a color for an image */
-PHP_FUNCTION(imagecolordeallocate) {
+PHP_FUNCTION(imagecolordeallocate)
+{
pval *imgind, *index;
int ind, ind_type, col;
gdImagePtr im;
@@ -562,7 +569,8 @@ PHP_FUNCTION(imagecolordeallocate) {
/* {{{ proto int imagecolorresolve(int im, int red, int green, int blue)
Get the index of the specified color or its closest possible alternative */
-PHP_FUNCTION(imagecolorresolve) {
+PHP_FUNCTION(imagecolorresolve)
+{
pval *imgind, *red, *green, *blue;
int ind, ind_type;
int col;
@@ -597,7 +605,8 @@ PHP_FUNCTION(imagecolorresolve) {
/* {{{ proto int imagecolorexact(int im, int red, int green, int blue)
Get the index of the specified color */
-PHP_FUNCTION(imagecolorexact) {
+PHP_FUNCTION(imagecolorexact)
+{
pval *imgind, *red, *green, *blue;
int ind, ind_type;
int col;
@@ -632,7 +641,8 @@ PHP_FUNCTION(imagecolorexact) {
/* {{{ proto int imagecolorset(int im, int col, int red, int green, int blue)
Set the color for the specified palette index */
-PHP_FUNCTION(imagecolorset) {
+PHP_FUNCTION(imagecolorset)
+{
pval *imgind, *color, *red, *green, *blue;
int ind, ind_type;
int col;
@@ -674,7 +684,8 @@ PHP_FUNCTION(imagecolorset) {
/* {{{ proto array imagecolorsforindex(int im, int col)
Get the colors for an index */
-PHP_FUNCTION(imagecolorsforindex) {
+PHP_FUNCTION(imagecolorsforindex)
+{
pval *imgind, *index;
int col, ind, ind_type;
gdImagePtr im;
@@ -712,7 +723,8 @@ PHP_FUNCTION(imagecolorsforindex) {
/* {{{ proto int imagegif(int im, string filename)
Output image to browser or file */
-PHP_FUNCTION(imagegif ) {
+PHP_FUNCTION(imagegif )
+{
pval *imgind, *file;
gdImagePtr im;
char *fn=NULL;
@@ -791,7 +803,8 @@ PHP_FUNCTION(imagegif ) {
/* {{{ proto int imagesetpixel(int im, int x, int y, int col)
Set a single pixel */
-PHP_FUNCTION(imagesetpixel) {
+PHP_FUNCTION(imagesetpixel)
+{
pval *imarg, *xarg, *yarg, *colarg;
gdImagePtr im;
int col, y, x;
@@ -828,7 +841,8 @@ PHP_FUNCTION(imagesetpixel) {
/* im, x1, y1, x2, y2, col */
/* {{{ proto int imageline(int im, int x1, int y1, int x2, int y2, int col)
Draw a line */
-PHP_FUNCTION(imageline) {
+PHP_FUNCTION(imageline)
+{
pval *IM, *COL, *X1, *Y1, *X2, *Y2;
gdImagePtr im;
int col, y2, x2, y1, x1;
@@ -867,7 +881,8 @@ PHP_FUNCTION(imageline) {
/* {{{ proto int imagedashedline(int im, int x1, int y1, int x2, int y2, int col)
Draw a dashed line */
-PHP_FUNCTION(imagedashedline) {
+PHP_FUNCTION(imagedashedline)
+{
pval *IM, *COL, *X1, *Y1, *X2, *Y2;
gdImagePtr im;
int col, y2, x2, y1, x1;
@@ -906,7 +921,8 @@ PHP_FUNCTION(imagedashedline) {
/* im, x1, y1, x2, y2, col */
/* {{{ proto int imagerectangle(int im, int x1, int y1, int x2, int y2, int col)
Draw a rectangle */
-PHP_FUNCTION(imagerectangle) {
+PHP_FUNCTION(imagerectangle)
+{
pval *IM, *COL, *X1, *Y1, *X2, *Y2;
gdImagePtr im;
int col, y2, x2, y1, x1;
@@ -946,7 +962,8 @@ PHP_FUNCTION(imagerectangle) {
/* im, x1, y1, x2, y2, col */
/* {{{ proto int imagefilledrectangle(int im, int x1, int y1, int x2, int y2, int col)
Draw a filled rectangle */
-PHP_FUNCTION(imagefilledrectangle) {
+PHP_FUNCTION(imagefilledrectangle)
+{
pval *IM, *COL, *X1, *Y1, *X2, *Y2;
gdImagePtr im;
int col, y2, x2, y1, x1;
@@ -985,7 +1002,8 @@ PHP_FUNCTION(imagefilledrectangle) {
/* {{{ proto int imagearc(int im, int cx, int cy, int w, int h, int s, int e, int col)
Draw a partial ellipse */
-PHP_FUNCTION(imagearc) {
+PHP_FUNCTION(imagearc)
+{
pval *COL, *E, *ST, *H, *W, *CY, *CX, *IM;
gdImagePtr im;
int col, e, st, h, w, cy, cx;
@@ -1036,7 +1054,8 @@ PHP_FUNCTION(imagearc) {
/* im, x, y, border, col */
/* {{{ proto int imagefilltoborder(int im, int x, int y, int border, int col)
Flood fill to specific color */
-PHP_FUNCTION(imagefilltoborder) {
+PHP_FUNCTION(imagefilltoborder)
+{
pval *IM, *X, *Y, *BORDER, *COL;
gdImagePtr im;
int col, border, y, x;
@@ -1074,7 +1093,8 @@ PHP_FUNCTION(imagefilltoborder) {
/* im, x, y, col */
/* {{{ proto int imagefill(int im, int x, int y, int col)
Flood fill */
-PHP_FUNCTION(imagefill) {
+PHP_FUNCTION(imagefill)
+{
pval *IM, *X, *Y, *COL;
gdImagePtr im;
int col, y, x;
@@ -1109,7 +1129,8 @@ PHP_FUNCTION(imagefill) {
/* {{{ proto int imagecolorstotal(int im)
Find out the number of colors in an image's palette */
-PHP_FUNCTION(imagecolorstotal) {
+PHP_FUNCTION(imagecolorstotal)
+{
pval *IM;
gdImagePtr im;
int ind_type;
@@ -1133,7 +1154,8 @@ PHP_FUNCTION(imagecolorstotal) {
/* im, col */
/* {{{ proto int imagecolortransparent(int im [, int col])
Define a color as transparent */
-PHP_FUNCTION(imagecolortransparent) {
+PHP_FUNCTION(imagecolortransparent)
+{
pval *IM, *COL = NULL;
gdImagePtr im;
int col;
@@ -1175,7 +1197,8 @@ PHP_FUNCTION(imagecolortransparent) {
/* im, interlace */
/* {{{ proto int imageinterlace(int im [, int interlace])
Enable or disable interlace */
-PHP_FUNCTION(imageinterlace) {
+PHP_FUNCTION(imageinterlace)
+{
pval *IM, *INT = NULL;
gdImagePtr im;
int interlace;
@@ -1218,7 +1241,7 @@ PHP_FUNCTION(imageinterlace) {
arg = 1 filled polygon */
/* im, points, num_points, col */
static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) {
- pval *IM, *POINTS, *NPOINTS, *COL, *var;
+ pval *IM, *POINTS, *NPOINTS, *COL, **var;
gdImagePtr im;
gdPoint points[PolyMaxPoints];
int npoints, col, nelem, i;
@@ -1279,12 +1302,14 @@ static void _php3_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) {
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;
+ SEPARATE_ZVAL(var);
+ 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;
+ SEPARATE_ZVAL(var);
+ convert_to_long(*var);
+ points[i].y = (*var)->value.lval;
}
}
@@ -1671,7 +1696,7 @@ PHP_FUNCTION(imagesyfn)
}
/* }}} */
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
#define TTFTEXT_DRAW 0
#define TTFTEXT_BBOX 1
diff --git a/ext/gd/gdcache.c b/ext/gd/gdcache.c
index 1662ebb184..e9c628607b 100644
--- a/ext/gd/gdcache.c
+++ b/ext/gd/gdcache.c
@@ -38,11 +38,11 @@
/* This just seems unessacary */
#if (WIN32|WINNT)
-#define HAVE_LIBTTF 1
+#define ENABLE_GD_TTF
#else
#include "php_config.h"
#endif
-#if HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
#include "gdcache.h"
@@ -198,4 +198,4 @@ main(char *argv[], int argc)
#endif
-#endif /* HAVE_LIBTTF */
+#endif /* ENABLE_GD_TTF */
diff --git a/ext/gd/gdttf.c b/ext/gd/gdttf.c
index 93bb3528d1..f2c1a03a9a 100644
--- a/ext/gd/gdttf.c
+++ b/ext/gd/gdttf.c
@@ -9,7 +9,7 @@
#else
#include "php_config.h"
#endif
-#if HAVE_LIBTTF
+#if HAVE_LIBTTF|HAVE_LIBFREETYPE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,7 +17,11 @@
#include <gd.h>
#include "gdttf.h"
#include "gdcache.h"
+#if HAVE_LIBFREETYPE
+#include <truetype.h>
+#else
#include <freetype.h>
+#endif
/* number of fonts cached before least recently used is replaced */
#define FONTCACHESIZE 6
@@ -31,7 +35,11 @@
#define BITMAPCACHESIZE 8
/* number of antialias color lookups cached */
+#if FREETYPE_4BIT_ANTIALIAS_HACK
+#define TWEENCOLORCACHESIZE 128
+#else
#define TWEENCOLORCACHESIZE 32
+#endif
/* ptsize below which anti-aliasing is ineffective */
#define MINANTIALIASPTSIZE 0
@@ -40,7 +48,11 @@
#define RESOLUTION 72
/* Number of colors used for anti-aliasing */
+#if FREETYPE_4BIT_ANTIALIAS_HACK
+#define NUMCOLORS 16
+#else
#define NUMCOLORS 4
+#endif
/* Line separation as a factor of font height.
No space between if LINESPACE = 1.00
@@ -379,7 +391,11 @@ fontFetch ( char **error, void *key )
a->cos_a = cos(a->angle);
a->engine = b->engine;
if ((err = TT_Open_Face(*b->engine, a->fontname, &a->face))) {
+#if HAVE_LIBFREETYPE
+ if (err == 0x008) { /* The FT2 oldapi is missing this code */
+#else
if (err == TT_Err_Could_Not_Open_File) {
+#endif
*error = "Could not find/open font";
}
else {
@@ -852,7 +868,7 @@ gdttf(gdImage *im, int *brect, int fg, char *fontname,
return (char *)NULL;
}
-#endif /* HAVE_LIBTTF */
+#endif /* HAVE_LIBTTF|HAVE_LIBFREETYPE */
/*
* Local variables:
diff --git a/ext/gd/php3_gd.h b/ext/gd/php3_gd.h
index d3f4dfced3..d6ef1d53b1 100644
--- a/ext/gd/php3_gd.h
+++ b/ext/gd/php3_gd.h
@@ -34,6 +34,11 @@
#ifndef _PHP3_GD_H
#define _PHP3_GD_H
+
+#if defined(HAVE_LIBTTF) && defined(HAVE_FREETYPE_H)
+#define ENABLE_GD_TTF
+#endif
+
#if COMPILE_DL
#undef HAVE_LIBGD
#define HAVE_LIBGD 1
@@ -89,7 +94,7 @@ PHP_FUNCTION(imagesyfn);
void php3_free_gd_font(gdFontPtr);
void _php3_gdimagecharup(gdImagePtr, gdFontPtr, int, int, int, int);
PHP_FUNCTION(imagedashedline);
-#ifdef HAVE_LIBTTF
+#ifdef ENABLE_GD_TTF
PHP_FUNCTION(imagettfbbox);
PHP_FUNCTION(imagettftext);
#endif
diff --git a/ext/informix/ifx.ec b/ext/informix/ifx.ec
index df60a38921..f97c4d4a28 100644
--- a/ext/informix/ifx.ec
+++ b/ext/informix/ifx.ec
@@ -1159,7 +1159,7 @@ $ifdef HAVE_IFX_IUS;
$endif;
) {
- int bid;
+ int bid = 0;
if(fieldtype==SQLTEXT) {
bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
@@ -1243,9 +1243,6 @@ EXEC SQL BEGIN DECLARE SECTION;
long sqlerrd[6];
int e;
-$ifdef HAVE_IFX_IUS;
- fixed binary 'blob' ifx_lo_t *slocator;
-$endif;
EXEC SQL END DECLARE SECTION;
@@ -1643,7 +1640,7 @@ $ifdef HAVE_IFX_IUS;
$endif;
) {
- int bid;
+ int bid = 0;
if(fieldtype==SQLTEXT) {
bid=php3_intifx_create_blob(TYPE_BLTEXT,BLMODE_INMEM,"",-1,list);
locator=php3_intifx_get_blobloc(bid,list);
@@ -3143,7 +3140,7 @@ EXEC SQL END DECLARE SECTION;
int type;
- int i, locind;
+ int i;
IFXLS_FETCH();
@@ -3777,7 +3774,7 @@ static char* php3_intifx_create_tmpfile(long bid) {
if ((blobdir = getenv("php3_blobdir")) == NULL)
blobdir=".";
- sprintf(filename,"blb%d",bid);
+ sprintf(filename,"blb%d",(int)bid);
blobfile=tempnam(blobdir,filename);
free(blobdir);
retval=emalloc(strlen(blobfile)+1);
@@ -4257,17 +4254,17 @@ PHP_FUNCTION(ifxus_create_slob) {
mode=pmode->value.lval;
create_mode=0;
- if(mode&1!=0)
+ if((mode&1) !=0)
create_mode|=LO_RDONLY;
- if(mode&2!=0)
+ if((mode&2) !=0)
create_mode|=LO_WRONLY;
- if(mode&4!=0)
+ if((mode&4) !=0)
create_mode|=LO_APPEND;
- if(mode&8!=0)
+ if((mode&8) !=0)
create_mode|=LO_RDWR;
- if(mode&16!=0)
+ if((mode&16) !=0)
create_mode|=LO_BUFFER;
- if(mode&32!=0)
+ if((mode&32) !=0)
create_mode|=LO_NOBUFFER;
@@ -4467,7 +4464,6 @@ static long php3_intifxus_close_slob(long bid, HashTable *list) {
opens an slob-object */
PHP_FUNCTION(ifxus_open_slob) {
pval *pbid,*pmode;
- long id;
long mode,create_mode;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 1, &pbid,&pmode)==FAILURE) {
@@ -4478,17 +4474,17 @@ PHP_FUNCTION(ifxus_open_slob) {
mode=pmode->value.lval;
create_mode=0;
- if(mode&1!=0)
+ if((mode&1) !=0)
create_mode|=LO_RDONLY;
- if(mode&2!=0)
+ if((mode&2) !=0)
create_mode|=LO_WRONLY;
- if(mode&4!=0)
+ if((mode&4) !=0)
create_mode|=LO_APPEND;
- if(mode&8!=0)
+ if((mode&8) !=0)
create_mode|=LO_RDWR;
- if(mode&16!=0)
+ if((mode&16) !=0)
create_mode|=LO_BUFFER;
- if(mode&32!=0)
+ if((mode&32) !=0)
create_mode|=LO_NOBUFFER;
RETURN_LONG(php3_intifxus_open_slob(pbid->value.lval,create_mode,list));
@@ -4550,7 +4546,6 @@ static long php3_intifxus_open_slob(long bid, long create_mode, HashTable *list)
*/
static long php3_intifxus_new_slob(HashTable *list) {
IFX_IDRES *Ifx_slob;
- int errcode;
Ifx_slob=emalloc(sizeof(IFX_IDRES));
@@ -4578,7 +4573,7 @@ static long php3_intifxus_new_slob(HashTable *list) {
*/
static ifx_lo_t *php3_intifxus_get_slobloc(long bid, HashTable *list) {
IFX_IDRES *Ifx_slob;
- int errcode, type;
+ int type;
Ifx_slob = (IFX_IDRES *) php3_list_find(bid,&type);
if (type!=IFXG(le_idresult) || Ifx_slob->type!=TYPE_SLOB) {
diff --git a/ext/standard/Makefile.am b/ext/standard/Makefile.am
index ae0d698617..0f4f063c8a 100644
--- a/ext/standard/Makefile.am
+++ b/ext/standard/Makefile.am
@@ -7,7 +7,8 @@ libphpext_standard_a_SOURCES=\
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 flock_compat.c crypt.c dl.c head.c post.c
+ cyr_convert.c flock_compat.c crypt.c dl.c head.c post.c \
+ parsedate.y
#number.o: number.c
# $(CC) $(CFLAGS) -w@WARNING_LEVEL@ -c $< -o $@
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 3f445804a0..bd9854179b 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -84,6 +84,7 @@ function_entry basic_functions[] = {
#if HAVE_STRFTIME
{"strftime", php3_strftime, NULL},
#endif
+ PHP_FE(strtotime, NULL)
{"date", php3_date, NULL},
{"gmdate", php3_gmdate, NULL},
{"getdate", php3_getdate, NULL},
@@ -110,6 +111,8 @@ function_entry basic_functions[] = {
{"trim", php3_trim, NULL},
{"ltrim", php3_ltrim, NULL},
{"rtrim", php3_chop, NULL},
+ PHP_FE(strip_tags, NULL)
+ PHP_FE(similar_text, NULL)
{"pos", array_current, first_arg_force_ref},
{"getimagesize", php3_getimagesize, NULL},
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 99038e0bd5..11cd604e9b 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -29,6 +29,9 @@
#include "php_globals.h"
#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
#include <stdio.h>
char *mon_full_names[] =
@@ -62,6 +65,8 @@ static int phpday_tab[2][12] =
#define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0)
+extern PHPAPI time_t parsedate(char *p, struct timeval *now);
+
PHP_FUNCTION(time)
{
return_value->value.lval = (long) time(NULL);
@@ -550,6 +555,32 @@ PHP_FUNCTION(strftime)
RETURN_FALSE;
}
#endif
+
+/* {{{ proto int strtotime(string time, int now) */
+PHP_FUNCTION(strtotime)
+{
+ pval *timep, *nowp;
+ int ac;
+ struct timeval tv;
+
+ ac = ARG_COUNT(ht);
+
+ if (ac < 1 || ac > 2 || getParameters(ht, ac, &timep, &nowp)==FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string(timep);
+ if (ac == 2) {
+ convert_to_long(nowp);
+ tv.tv_sec = nowp->value.lval;
+ tv.tv_usec = 0;
+ RETURN_LONG(parsedate(timep->value.str.val, &tv));
+ } else {
+ RETURN_LONG(parsedate(timep->value.str.val, NULL));
+ }
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/ext/standard/datetime.h b/ext/standard/datetime.h
index 0a27f5efa2..bf518fcd7f 100644
--- a/ext/standard/datetime.h
+++ b/ext/standard/datetime.h
@@ -44,6 +44,7 @@ PHP_FUNCTION(checkdate);
#if HAVE_STRFTIME
PHP_FUNCTION(strftime);
#endif
+PHP_FUNCTION(strtotime);
extern char *php3_std_date(time_t t);
void _php3_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm);
diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c
index cc000f42b4..227e606c5d 100644
--- a/ext/standard/fsock.c
+++ b/ext/standard/fsock.c
@@ -248,7 +248,7 @@ static void _php3_fsockopen(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
switch(arg_count) {
case 5:
convert_to_double(args[4]);
- conv = args[4]->value.dval * 1000000.0;
+ conv = (unsigned long) (args[4]->value.dval * 1000000.0);
timeout.tv_sec = conv / 1000000;
timeout.tv_usec = conv % 1000000;
/* fall-through */
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y
new file mode 100644
index 0000000000..6552c517a2
--- /dev/null
+++ b/ext/standard/parsedate.y
@@ -0,0 +1,919 @@
+%{
+/* $Revision$
+**
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@osf.org> and Jim Berets <jberets@bbn.com> in August, 1990.
+** Further revised (removed obsolete constructs and cleaned up timezone
+** names) in August, 1991, by Rich. Paul Eggert <eggert@twinsun.com>
+** helped in September, 1992.
+**
+** This grammar has six shift/reduce conflicts.
+**
+** This code is in the public domain and has no copyright.
+*/
+/* SUPPRESS 530 *//* Empty body for statement */
+/* SUPPRESS 593 on yyerrlab *//* Label was not used */
+/* SUPPRESS 593 on yynewstate *//* Label was not used */
+/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
+
+#ifdef WIN32
+# include "config.w32.h"
+#else
+# include "php_config.h"
+#endif
+
+#if WIN32||WINNT
+#include <malloc.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <time.h>
+
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#ifdef WIN32
+# include "win32/time.h"
+#endif
+
+#include <ctype.h>
+
+#if defined(_HPUX_SOURCE)
+#include <alloca.h>
+#endif
+
+#if WIN32||WINNT
+#include <time.h>
+#else
+# if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE)
+extern time_t timezone;
+# endif
+#endif
+
+#define yylhs date_yylhs
+#define yylen date_yylen
+#define yydefred date_yydefred
+#define yydgoto date_yydgoto
+#define yysindex date_yysindex
+#define yyrindex date_yyrindex
+#define yygindex date_yygindex
+#define yytable date_yytable
+#define yycheck date_yycheck
+#define yyparse date_parse
+#define yylex date_lex
+#define yyerror date_error
+
+static int date_lex(void);
+
+ /* See the LeapYears table in Convert. */
+#define EPOCH 1970
+#define END_OF_TIME 2038
+ /* Constants for general time calculations. */
+#define DST_OFFSET 1
+#define SECSPERDAY (24L * 60L * 60L)
+ /* Readability for TABLE stuff. */
+#define HOUR(x) (x * 60)
+
+#define LPAREN '('
+#define RPAREN ')'
+#define IS7BIT(x) ((unsigned int)(x) < 0200)
+
+/*
+** Get the number of elements in a fixed-size array, or a pointer just
+** past the end of it.
+*/
+#define SIZEOF(array) ((int)(sizeof array / sizeof array[0]))
+#define ENDOF(array) (&array[SIZEOF(array)])
+#define CTYPE(isXXXXX, c) ((isascii((c)) && isXXXXX((c))))
+
+typedef struct _TIMEINFO {
+ time_t time;
+ long usec;
+ long tzone;
+} TIMEINFO;
+
+typedef char const *STRING;
+typedef char * const CSTRING;
+
+/*
+** An entry in the lexical lookup table.
+*/
+typedef struct _TABLE {
+ STRING name;
+ int type;
+ time_t value;
+} TABLE;
+
+/*
+** Daylight-savings mode: on, off, or not yet known.
+*/
+typedef enum _DSTMODE {
+ DSTon, DSToff, DSTmaybe
+} DSTMODE;
+
+/*
+** Meridian: am, pm, or 24-hour style.
+*/
+typedef enum _MERIDIAN {
+ MERam, MERpm, MER24
+} MERIDIAN;
+
+
+/*
+** Global variables. We could get rid of most of them by using a yacc
+** union, but this is more efficient. (This routine predates the
+** yacc %union construct.)
+*/
+static char *yyInput;
+static DSTMODE yyDSTmode;
+static int yyHaveDate;
+static int yyHaveRel;
+static int yyHaveTime;
+static time_t yyTimezone;
+static time_t yyDay;
+static time_t yyHour;
+static time_t yyMinutes;
+static time_t yyMonth;
+static time_t yySeconds;
+static time_t yyYear;
+static MERIDIAN yyMeridian;
+static time_t yyRelMonth;
+static time_t yyRelSeconds;
+
+
+extern struct tm *localtime();
+
+static void date_error();
+%}
+
+%expect 6
+
+%union {
+ time_t Number;
+ enum _MERIDIAN Meridian;
+}
+
+%token tDAY tDAYZONE tMERIDIAN tMONTH tMONTH_UNIT tSEC_UNIT tSNUMBER
+%token tUNUMBER tZONE
+
+%type <Number> tDAYZONE tMONTH tMONTH_UNIT tSEC_UNIT
+%type <Number> tSNUMBER tUNUMBER tZONE numzone zone
+%type <Meridian> tMERIDIAN o_merid
+
+%%
+
+spec : /* NULL */
+ | spec item
+ ;
+
+item : time {
+ yyHaveTime++;
+#if defined(lint)
+ /* I am compulsive about lint natterings... */
+ if (yyHaveTime == -1) {
+ YYERROR;
+ }
+#endif /* defined(lint) */
+ }
+ | time zone {
+ yyHaveTime++;
+ yyTimezone = $2;
+ }
+ | date {
+ yyHaveDate++;
+ }
+ | rel {
+ yyHaveRel = 1;
+ }
+ ;
+
+time : tUNUMBER o_merid {
+ if ($1 < 100) {
+ yyHour = $1;
+ yyMinutes = 0;
+ }
+ else {
+ yyHour = $1 / 100;
+ yyMinutes = $1 % 100;
+ }
+ yySeconds = 0;
+ yyMeridian = $2;
+ }
+ | tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = 0;
+ yyMeridian = $4;
+ }
+ | tUNUMBER ':' tUNUMBER numzone {
+ yyHour = $1;
+ yyMinutes = $3;
+ yyTimezone = $4;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyMeridian = $6;
+ }
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER numzone {
+ yyHour = $1;
+ yyMinutes = $3;
+ yySeconds = $5;
+ yyTimezone = $6;
+ yyMeridian = MER24;
+ yyDSTmode = DSToff;
+ }
+ ;
+
+zone : tZONE {
+ $$ = $1;
+ yyDSTmode = DSToff;
+ }
+ | tDAYZONE {
+ $$ = $1;
+ yyDSTmode = DSTon;
+ }
+ | tZONE numzone {
+ /* Only allow "GMT+300" and "GMT-0800" */
+ if ($1 != 0) {
+ YYABORT;
+ }
+ $$ = $2;
+ yyDSTmode = DSToff;
+ }
+ | numzone {
+ $$ = $1;
+ yyDSTmode = DSToff;
+ }
+ ;
+
+numzone : tSNUMBER {
+ int i;
+
+ /* Unix and GMT and numeric timezones -- a little confusing. */
+ if ($1 < 0) {
+ /* Don't work with negative modulus. */
+ $1 = -$1;
+ if ($1 > 9999 || (i = $1 % 100) >= 60) {
+ YYABORT;
+ }
+ $$ = ($1 / 100) * 60 + i;
+ }
+ else {
+ if ($1 > 9999 || (i = $1 % 100) >= 60) {
+ YYABORT;
+ }
+ $$ = -(($1 / 100) * 60 + i);
+ }
+ }
+ ;
+
+date : tUNUMBER '/' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $3;
+ }
+ | tUNUMBER '/' tUNUMBER '/' tUNUMBER {
+ if ($1 > 100) {
+ /* assume YYYY/MM/DD format, so need not to add 1900 */
+ yyYear = $1;
+ yyMonth = $3;
+ yyDay = $5;
+ }
+ else {
+ /* assume MM/DD/YY* format */
+ yyMonth = $1;
+ yyDay = $3;
+ if ($5 > 100) {
+ /* assume year is YYYY format, so need not to add 1900 */
+ yyYear = $5;
+ } else {
+ /* assume year is YY format, so need to add 1900 */
+ yyYear = $5 + 1900;
+ }
+ }
+ }
+ | tMONTH tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ }
+ | tMONTH tUNUMBER ',' tUNUMBER {
+ yyMonth = $1;
+ yyDay = $2;
+ if ($4 > 100) {
+ /* assume year is YYYY format, so need not to add 1900 */
+ yyYear = $4;
+ } else {
+ /* assume year is YY format, so need to add 1900 */
+ yyYear = $4 + 1900;
+ }
+ }
+ | tUNUMBER tMONTH {
+ yyDay = $1;
+ yyMonth = $2;
+ }
+ | tUNUMBER tMONTH tUNUMBER {
+ yyDay = $1;
+ yyMonth = $2;
+ if ($3 > 100) {
+ /* assume year is YYYY format, so need not to add 1900 */
+ yyYear = $3;
+ } else {
+ /* assume year is YY format, so need to add 1900 */
+ yyYear = $3 + 1900;
+ }
+ }
+ | tDAY ',' tUNUMBER tMONTH tUNUMBER {
+ yyDay = $3;
+ yyMonth = $4;
+ if ($5 > 100) {
+ /* assume year is YYYY format, so need not to add 1900 */
+ yyYear = $5;
+ } else {
+ /* assume year is YY format, so need to add 1900 */
+ yyYear = $5 + 1900;
+ }
+ }
+ ;
+
+rel : tSNUMBER tSEC_UNIT {
+ yyRelSeconds += $1 * $2;
+ }
+ | tUNUMBER tSEC_UNIT {
+ yyRelSeconds += $1 * $2;
+ }
+ | tSNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ | tUNUMBER tMONTH_UNIT {
+ yyRelMonth += $1 * $2;
+ }
+ ;
+
+o_merid : /* NULL */ {
+ $$ = MER24;
+ }
+ | tMERIDIAN {
+ $$ = $1;
+ }
+ ;
+
+%%
+
+/* Month and day table. */
+static TABLE MonthDayTable[] = {
+ { "january", tMONTH, 1 },
+ { "february", tMONTH, 2 },
+ { "march", tMONTH, 3 },
+ { "april", tMONTH, 4 },
+ { "may", tMONTH, 5 },
+ { "june", tMONTH, 6 },
+ { "july", tMONTH, 7 },
+ { "august", tMONTH, 8 },
+ { "september", tMONTH, 9 },
+ { "october", tMONTH, 10 },
+ { "november", tMONTH, 11 },
+ { "december", tMONTH, 12 },
+ /* The value of the day isn't used... */
+ { "sunday", tDAY, 0 },
+ { "monday", tDAY, 0 },
+ { "tuesday", tDAY, 0 },
+ { "wednesday", tDAY, 0 },
+ { "thursday", tDAY, 0 },
+ { "friday", tDAY, 0 },
+ { "saturday", tDAY, 0 },
+};
+
+/* Time units table. */
+static TABLE UnitsTable[] = {
+ { "year", tMONTH_UNIT, 12 },
+ { "month", tMONTH_UNIT, 1 },
+ { "week", tSEC_UNIT, 7 * 24 * 60 * 60 },
+ { "day", tSEC_UNIT, 1 * 24 * 60 * 60 },
+ { "hour", tSEC_UNIT, 60 * 60 },
+ { "minute", tSEC_UNIT, 60 },
+ { "min", tSEC_UNIT, 60 },
+ { "second", tSEC_UNIT, 1 },
+ { "sec", tSEC_UNIT, 1 },
+};
+
+/* Timezone table. */
+static TABLE TimezoneTable[] = {
+ { "gmt", tZONE, HOUR( 0) }, /* Greenwich Mean */
+ { "ut", tZONE, HOUR( 0) }, /* Universal */
+ { "utc", tZONE, HOUR( 0) }, /* Universal Coordinated */
+ { "cut", tZONE, HOUR( 0) }, /* Coordinated Universal */
+ { "z", tZONE, HOUR( 0) }, /* Greenwich Mean */
+ { "wet", tZONE, HOUR( 0) }, /* Western European */
+ { "bst", tDAYZONE, HOUR( 0) }, /* British Summer */
+ { "nst", tZONE, HOUR(3)+30 }, /* Newfoundland Standard */
+ { "ndt", tDAYZONE, HOUR(3)+30 }, /* Newfoundland Daylight */
+ { "ast", tZONE, HOUR( 4) }, /* Atlantic Standard */
+ { "adt", tDAYZONE, HOUR( 4) }, /* Atlantic Daylight */
+ { "est", tZONE, HOUR( 5) }, /* Eastern Standard */
+ { "edt", tDAYZONE, HOUR( 5) }, /* Eastern Daylight */
+ { "cst", tZONE, HOUR( 6) }, /* Central Standard */
+ { "cdt", tDAYZONE, HOUR( 6) }, /* Central Daylight */
+ { "mst", tZONE, HOUR( 7) }, /* Mountain Standard */
+ { "mdt", tDAYZONE, HOUR( 7) }, /* Mountain Daylight */
+ { "pst", tZONE, HOUR( 8) }, /* Pacific Standard */
+ { "pdt", tDAYZONE, HOUR( 8) }, /* Pacific Daylight */
+ { "yst", tZONE, HOUR( 9) }, /* Yukon Standard */
+ { "ydt", tDAYZONE, HOUR( 9) }, /* Yukon Daylight */
+ { "akst", tZONE, HOUR( 9) }, /* Alaska Standard */
+ { "akdt", tDAYZONE, HOUR( 9) }, /* Alaska Daylight */
+ { "hst", tZONE, HOUR(10) }, /* Hawaii Standard */
+ { "hast", tZONE, HOUR(10) }, /* Hawaii-Aleutian Standard */
+ { "hadt", tDAYZONE, HOUR(10) }, /* Hawaii-Aleutian Daylight */
+ { "ces", tDAYZONE, -HOUR(1) }, /* Central European Summer */
+ { "cest", tDAYZONE, -HOUR(1) }, /* Central European Summer */
+ { "mez", tZONE, -HOUR(1) }, /* Middle European */
+ { "mezt", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
+ { "cet", tZONE, -HOUR(1) }, /* Central European */
+ { "met", tZONE, -HOUR(1) }, /* Middle European */
+ { "eet", tZONE, -HOUR(2) }, /* Eastern Europe */
+ { "msk", tZONE, -HOUR(3) }, /* Moscow Winter */
+ { "msd", tDAYZONE, -HOUR(3) }, /* Moscow Summer */
+ { "wast", tZONE, -HOUR(8) }, /* West Australian Standard */
+ { "wadt", tDAYZONE, -HOUR(8) }, /* West Australian Daylight */
+ { "hkt", tZONE, -HOUR(8) }, /* Hong Kong */
+ { "cct", tZONE, -HOUR(8) }, /* China Coast */
+ { "jst", tZONE, -HOUR(9) }, /* Japan Standard */
+ { "kst", tZONE, -HOUR(9) }, /* Korean Standard */
+ { "kdt", tZONE, -HOUR(9) }, /* Korean Daylight */
+ { "cast", tZONE, -(HOUR(9)+30) }, /* Central Australian Standard */
+ { "cadt", tDAYZONE, -(HOUR(9)+30) }, /* Central Australian Daylight */
+ { "east", tZONE, -HOUR(10) }, /* Eastern Australian Standard */
+ { "eadt", tDAYZONE, -HOUR(10) }, /* Eastern Australian Daylight */
+ { "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
+ { "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
+
+ /* For completeness we include the following entries. */
+#if 0
+
+ /* Duplicate names. Either they conflict with a zone listed above
+ * (which is either more likely to be seen or just been in circulation
+ * longer), or they conflict with another zone in this section and
+ * we could not reasonably choose one over the other. */
+ { "fst", tZONE, HOUR( 2) }, /* Fernando De Noronha Standard */
+ { "fdt", tDAYZONE, HOUR( 2) }, /* Fernando De Noronha Daylight */
+ { "bst", tZONE, HOUR( 3) }, /* Brazil Standard */
+ { "est", tZONE, HOUR( 3) }, /* Eastern Standard (Brazil) */
+ { "edt", tDAYZONE, HOUR( 3) }, /* Eastern Daylight (Brazil) */
+ { "wst", tZONE, HOUR( 4) }, /* Western Standard (Brazil) */
+ { "wdt", tDAYZONE, HOUR( 4) }, /* Western Daylight (Brazil) */
+ { "cst", tZONE, HOUR( 5) }, /* Chile Standard */
+ { "cdt", tDAYZONE, HOUR( 5) }, /* Chile Daylight */
+ { "ast", tZONE, HOUR( 5) }, /* Acre Standard */
+ { "adt", tDAYZONE, HOUR( 5) }, /* Acre Daylight */
+ { "cst", tZONE, HOUR( 5) }, /* Cuba Standard */
+ { "cdt", tDAYZONE, HOUR( 5) }, /* Cuba Daylight */
+ { "est", tZONE, HOUR( 6) }, /* Easter Island Standard */
+ { "edt", tDAYZONE, HOUR( 6) }, /* Easter Island Daylight */
+ { "sst", tZONE, HOUR(11) }, /* Samoa Standard */
+ { "ist", tZONE, -HOUR(2) }, /* Israel Standard */
+ { "idt", tDAYZONE, -HOUR(2) }, /* Israel Daylight */
+ { "idt", tDAYZONE, -(HOUR(3)+30) }, /* Iran Daylight */
+ { "ist", tZONE, -(HOUR(3)+30) }, /* Iran Standard */
+ { "cst", tZONE, -HOUR(8) }, /* China Standard */
+ { "cdt", tDAYZONE, -HOUR(8) }, /* China Daylight */
+ { "sst", tZONE, -HOUR(8) }, /* Singapore Standard */
+
+ /* Dubious (e.g., not in Olson's TIMEZONE package) or obsolete. */
+ { "gst", tZONE, HOUR( 3) }, /* Greenland Standard */
+ { "wat", tZONE, -HOUR(1) }, /* West Africa */
+ { "at", tZONE, HOUR( 2) }, /* Azores */
+ { "gst", tZONE, -HOUR(10) }, /* Guam Standard */
+ { "nft", tZONE, HOUR(3)+30 }, /* Newfoundland */
+ { "idlw", tZONE, HOUR(12) }, /* International Date Line West */
+ { "mewt", tZONE, -HOUR(1) }, /* Middle European Winter */
+ { "mest", tDAYZONE, -HOUR(1) }, /* Middle European Summer */
+ { "swt", tZONE, -HOUR(1) }, /* Swedish Winter */
+ { "sst", tDAYZONE, -HOUR(1) }, /* Swedish Summer */
+ { "fwt", tZONE, -HOUR(1) }, /* French Winter */
+ { "fst", tDAYZONE, -HOUR(1) }, /* French Summer */
+ { "bt", tZONE, -HOUR(3) }, /* Baghdad */
+ { "it", tZONE, -(HOUR(3)+30) }, /* Iran */
+ { "zp4", tZONE, -HOUR(4) }, /* USSR Zone 3 */
+ { "zp5", tZONE, -HOUR(5) }, /* USSR Zone 4 */
+ { "ist", tZONE, -(HOUR(5)+30) }, /* Indian Standard */
+ { "zp6", tZONE, -HOUR(6) }, /* USSR Zone 5 */
+ { "nst", tZONE, -HOUR(7) }, /* North Sumatra */
+ { "sst", tZONE, -HOUR(7) }, /* South Sumatra */
+ { "jt", tZONE, -(HOUR(7)+30) }, /* Java (3pm in Cronusland!) */
+ { "nzt", tZONE, -HOUR(12) }, /* New Zealand */
+ { "idle", tZONE, -HOUR(12) }, /* International Date Line East */
+ { "cat", tZONE, HOUR(10) }, /* -- expired 1967 */
+ { "nt", tZONE, HOUR(11) }, /* -- expired 1967 */
+ { "ahst", tZONE, HOUR(10) }, /* -- expired 1983 */
+ { "hdt", tDAYZONE, HOUR(10) }, /* -- expired 1986 */
+#endif /* 0 */
+};
+
+
+
+/* ARGSUSED */
+static void
+date_error(s)
+ char *s;
+{
+ /* NOTREACHED */
+}
+
+int GetTimeInfo(TIMEINFO *Now)
+{
+ static time_t NextHour;
+ static long LastTzone;
+ struct tm *tm;
+ int secondsUntilNextHour;
+#if defined(HAVE_GETTIMEOFDAY)
+ struct timeval tv;
+#endif /* defined(HAVE_GETTIMEOFDAY) */
+#if !defined(HAVE_TM_GMTOFF)
+ struct tm local;
+ struct tm gmt;
+#endif /* !defined(HAVE_TM_GMTOFF) */
+
+ /* Get the basic time. */
+#if defined(HAVE_GETTIMEOFDAY)
+ if (gettimeofday(&tv, (struct timezone *)NULL) == -1)
+ return -1;
+ Now->time = tv.tv_sec;
+ Now->usec = tv.tv_usec;
+#else
+ /* Can't check for -1 since that might be a time, I guess. */
+ (void)time(&Now->time);
+ Now->usec = 0;
+#endif /* defined(HAVE_GETTIMEOFDAY) */
+
+ /* Now get the timezone if the last time < HH:00:00 <= now for some HH. */
+ if (NextHour <= Now->time) {
+ if ((tm = localtime(&Now->time)) == NULL)
+ return -1;
+ secondsUntilNextHour = 60 * (60 - tm->tm_min) - tm->tm_sec;
+#if !defined(HAVE_TM_GMTOFF)
+ /* To get the timezone, compare localtime with GMT. */
+ local = *tm;
+ if ((tm = gmtime(&Now->time)) == NULL)
+ return -1;
+ gmt = *tm;
+
+ /* Assume we are never more than 24 hours away. */
+ LastTzone = gmt.tm_yday - local.tm_yday;
+ if (LastTzone > 1)
+ LastTzone = -24;
+ else if (LastTzone < -1)
+ LastTzone = 24;
+ else
+ LastTzone *= 24;
+
+ /* Scale in the hours and minutes; ignore seconds. */
+ LastTzone += gmt.tm_hour - local.tm_hour;
+ LastTzone *= 60;
+ LastTzone += gmt.tm_min - local.tm_min;
+#else
+ LastTzone = (0 - tm->tm_gmtoff) / 60;
+#endif /* defined(HAVE_TM_GMTOFF) */
+ NextHour = Now->time + secondsUntilNextHour;
+ }
+ Now->tzone = LastTzone;
+ return 0;
+}
+
+
+static time_t
+ToSeconds(Hours, Minutes, Seconds, Meridian)
+ time_t Hours;
+ time_t Minutes;
+ time_t Seconds;
+ MERIDIAN Meridian;
+{
+ if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61)
+ return -1;
+ if (Meridian == MER24) {
+ if (Hours < 0 || Hours > 23)
+ return -1;
+ }
+ else {
+ if (Hours < 1 || Hours > 12)
+ return -1;
+ if (Hours == 12)
+ Hours = 0;
+ if (Meridian == MERpm)
+ Hours += 12;
+ }
+ return (Hours * 60L + Minutes) * 60L + Seconds;
+}
+
+
+static time_t
+Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, dst)
+ time_t Month;
+ time_t Day;
+ time_t Year;
+ time_t Hours;
+ time_t Minutes;
+ time_t Seconds;
+ MERIDIAN Meridian;
+ DSTMODE dst;
+{
+ static int DaysNormal[13] = {
+ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+ };
+ static int DaysLeap[13] = {
+ 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+ };
+ static int LeapYears[] = {
+ 1972, 1976, 1980, 1984, 1988, 1992, 1996,
+ 2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036
+ };
+ int *yp;
+ int *mp;
+ time_t Julian;
+ int i;
+ time_t tod;
+
+ /* Year should not be passed as a relative value, but absolute one.
+ so this should not happen, but just ensure it */
+ if (Year < 0)
+ Year = -Year;
+ if (Year < 100)
+ Year += 1900;
+ if (Year < EPOCH)
+ Year += 100;
+ for (mp = DaysNormal, yp = LeapYears; yp < ENDOF(LeapYears); yp++)
+ if (Year == *yp) {
+ mp = DaysLeap;
+ break;
+ }
+ if (Year < EPOCH || Year > END_OF_TIME
+ || Month < 1 || Month > 12
+ /* NOSTRICT *//* conversion from long may lose accuracy */
+ || Day < 1 || Day > mp[(int)Month])
+ return -1;
+
+ Julian = Day - 1 + (Year - EPOCH) * 365;
+ for (yp = LeapYears; yp < ENDOF(LeapYears); yp++, Julian++)
+ if (Year <= *yp)
+ break;
+ for (i = 1; i < Month; i++)
+ Julian += *++mp;
+ Julian *= SECSPERDAY;
+ Julian += yyTimezone * 60L;
+ if ((tod = ToSeconds(Hours, Minutes, Seconds, Meridian)) < 0)
+ return -1;
+ Julian += tod;
+ tod = Julian;
+ if (dst == DSTon || (dst == DSTmaybe && localtime(&tod)->tm_isdst))
+ Julian -= DST_OFFSET * 60 * 60;
+ return Julian;
+}
+
+
+static time_t
+DSTcorrect(Start, Future)
+ time_t Start;
+ time_t Future;
+{
+ time_t StartDay;
+ time_t FutureDay;
+
+ StartDay = (localtime(&Start)->tm_hour + 1) % 24;
+ FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+ return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60;
+}
+
+
+static time_t
+RelativeMonth(Start, RelMonth)
+ time_t Start;
+ time_t RelMonth;
+{
+ struct tm *tm;
+ time_t Month;
+ time_t Year;
+
+ tm = localtime(&Start);
+ Month = 12 * tm->tm_year + tm->tm_mon + RelMonth;
+ Year = Month / 12;
+ Year += 1900;
+ Month = Month % 12 + 1;
+ return DSTcorrect(Start,
+ Convert(Month, (time_t)tm->tm_mday, Year,
+ (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
+ MER24, DSTmaybe));
+}
+
+
+static int LookupWord(char *buff, int length)
+{
+ char *p;
+ STRING q;
+ TABLE *tp;
+ int c;
+
+ p = buff;
+ c = p[0];
+
+ /* See if we have an abbreviation for a month. */
+ if (length == 3 || (length == 4 && p[3] == '.'))
+ for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++) {
+ q = tp->name;
+ if (c == q[0] && p[1] == q[1] && p[2] == q[2]) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+ else
+ for (tp = MonthDayTable; tp < ENDOF(MonthDayTable); tp++)
+ if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Try for a timezone. */
+ for (tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
+ if (c == tp->name[0] && p[1] == tp->name[1]
+ && strcmp(p, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Try the units table. */
+ for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
+ if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+
+ /* Strip off any plural and try the units table again. */
+ if (--length > 0 && p[length] == 's') {
+ p[length] = '\0';
+ for (tp = UnitsTable; tp < ENDOF(UnitsTable); tp++)
+ if (c == tp->name[0] && strcmp(p, tp->name) == 0) {
+ p[length] = 's';
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ p[length] = 's';
+ }
+ length++;
+
+ /* Drop out any periods. */
+ for (p = buff, q = (STRING)buff; *q; q++)
+ if (*q != '.')
+ *p++ = *q;
+ *p = '\0';
+
+ /* Try the meridians. */
+ if (buff[1] == 'm' && buff[2] == '\0') {
+ if (buff[0] == 'a') {
+ yylval.Meridian = MERam;
+ return tMERIDIAN;
+ }
+ if (buff[0] == 'p') {
+ yylval.Meridian = MERpm;
+ return tMERIDIAN;
+ }
+ }
+
+ /* If we saw any periods, try the timezones again. */
+ if (p - buff != length) {
+ c = buff[0];
+ for (p = buff, tp = TimezoneTable; tp < ENDOF(TimezoneTable); tp++)
+ if (c == tp->name[0] && p[1] == tp->name[1]
+ && strcmp(p, tp->name) == 0) {
+ yylval.Number = tp->value;
+ return tp->type;
+ }
+ }
+
+ /* Unknown word -- assume GMT timezone. */
+ yylval.Number = 0;
+ return tZONE;
+}
+
+
+static int date_lex(void)
+{
+ char c;
+ char *p;
+ char buff[20];
+ int sign;
+ int i;
+ int nesting;
+
+ for ( ; ; ) {
+ /* Get first character after the whitespace. */
+ for ( ; ; ) {
+ while (CTYPE(isspace, (int)*yyInput))
+ yyInput++;
+ c = *yyInput;
+
+ /* Ignore RFC 822 comments, typically time zone names. */
+ if (c != LPAREN)
+ break;
+ for (nesting = 1; (c = *++yyInput) != RPAREN || --nesting; )
+ if (c == LPAREN)
+ nesting++;
+ else if (!IS7BIT(c) || c == '\0' || c == '\r'
+ || (c == '\\' && ((c = *++yyInput) == '\0' || !IS7BIT(c))))
+ /* Lexical error: bad comment. */
+ return '?';
+ yyInput++;
+ }
+
+ /* A number? */
+ if (CTYPE(isdigit, (int)c) || c == '-' || c == '+') {
+ if (c == '-' || c == '+') {
+ sign = c == '-' ? -1 : 1;
+ yyInput++;
+ if (!CTYPE(isdigit, (int)*yyInput))
+ /* Skip the plus or minus sign. */
+ continue;
+ }
+ else
+ sign = 0;
+ for (i = 0; (c = *yyInput++) != '\0' && CTYPE(isdigit, (int)c); )
+ i = 10 * i + c - '0';
+ yyInput--;
+ yylval.Number = sign < 0 ? -i : i;
+ return sign ? tSNUMBER : tUNUMBER;
+ }
+
+ /* A word? */
+ if (CTYPE(isalpha, (int)c)) {
+ for (p = buff; (c = *yyInput++) == '.' || CTYPE(isalpha, (int)c); )
+ if (p < &buff[sizeof buff - 1])
+ *p++ = CTYPE(isupper, (int)c) ? tolower(c) : c;
+ *p = '\0';
+ yyInput--;
+ return LookupWord(buff, p - buff);
+ }
+
+ return *yyInput++;
+ }
+}
+
+
+time_t parsedate(char *p, TIMEINFO *now)
+{
+ extern int date_parse();
+ struct tm *tm;
+ TIMEINFO ti;
+ time_t Start;
+
+ yyInput = p;
+ if (now == NULL) {
+ now = &ti;
+ (void)GetTimeInfo(&ti);
+ }
+
+ tm = localtime(&now->time);
+ yyYear = tm->tm_year + 1900;
+ yyMonth = tm->tm_mon + 1;
+ yyDay = tm->tm_mday;
+#ifdef HAVE_TM_GMTOFF
+ yyTimezone = tm->tm_gmtoff/60;
+#else
+ yyTimezone = timezone/60;
+#endif
+ yyDSTmode = DSTmaybe;
+ yyHour = 0;
+ yyMinutes = 0;
+ yySeconds = 0;
+ yyMeridian = MER24;
+ yyRelSeconds = 0;
+ yyRelMonth = 0;
+ yyHaveDate = 0;
+ yyHaveRel = 0;
+ yyHaveTime = 0;
+
+ if (date_parse() || yyHaveTime > 1 || yyHaveDate > 1)
+ return -1;
+
+ if (yyHaveDate || yyHaveTime) {
+ Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
+ yyMeridian, yyDSTmode);
+ if (Start < 0)
+ return -1;
+ }
+ else {
+ Start = now->time;
+ if (!yyHaveRel)
+ Start -= (tm->tm_hour * 60L + tm->tm_min) * 60L + tm->tm_sec;
+ }
+
+ Start += yyRelSeconds;
+ if (yyRelMonth)
+ Start += RelativeMonth(Start, yyRelMonth);
+
+ /* Have to do *something* with a legitimate -1 so it's distinguishable
+ * from the error return value. (Alternately could set errno on error.) */
+ return Start == -1 ? 0 : Start;
+}
diff --git a/ext/standard/php3_string.h b/ext/standard/php3_string.h
index 0619a58d76..111138ab36 100644
--- a/ext/standard/php3_string.h
+++ b/ext/standard/php3_string.h
@@ -83,6 +83,7 @@ PHP_FUNCTION(chunk_split);
PHP_FUNCTION(parsestr);
PHP_FUNCTION(bin2hex);
PHP_FUNCTION(similar_text);
+PHP_FUNCTION(strip_tags);
extern PHPAPI char *_php3_strtoupper(char *s);
extern PHPAPI char *_php3_strtolower(char *s);
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index 09d28b6d65..051eab8ce6 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -201,6 +201,8 @@ static inline uint32 randomMT(void)
#define PHP_RAND_MAX RAND_MAX
#endif
+/* {{{ proto void srand(int seed)
+ Seeds random number generator */
PHP_FUNCTION(srand)
{
pval *arg;
@@ -219,7 +221,10 @@ PHP_FUNCTION(srand)
#endif
#endif
}
+/* }}} */
+/* {{{ proto void mt_srand(int seed)
+ Seeds Mersenne Twister random number generator */
PHP_FUNCTION(mt_srand)
{
pval *arg;
@@ -229,7 +234,10 @@ PHP_FUNCTION(mt_srand)
convert_to_long(arg);
seedMT(arg->value.lval);
}
+/* }}} */
+/* {{{ proto int rand([int min, int max])
+ Returns a random number */
PHP_FUNCTION(rand)
{
pval *p_min=NULL, *p_max=NULL;
@@ -262,13 +270,40 @@ PHP_FUNCTION(rand)
return_value->value.lval = rand();
#endif
#endif
-
+ /*
+ * A bit of tricky math here. We want to avoid using a modulus because
+ * that simply tosses the high-order bits and might skew the distribution
+ * of random values over the range. Instead we map the range directly.
+ *
+ * We need to map the range from 0...M evenly to the range a...b
+ * Let n = the random number and n' = the mapped random number
+ *
+ * Then we have: n' = a + n(b-a)/M
+ *
+ * We have a problem here in that only n==M will get mapped to b which
+ # means the chances of getting b is much much less than getting any of
+ # the other values in the range. We can fix this by increasing our range
+ # artifically and using:
+ #
+ # n' = a + n(b-a+1)/M
+ *
+ # Now we only have a problem if n==M which would cause us to produce a
+ # number of b+1 which would be bad. So we bump M up by one to make sure
+ # this will never happen, and the final algorithm looks like this:
+ #
+ # n' = a + n(b-a+1)/(M+1)
+ *
+ * -RL
+ */
if (p_min && p_max) { /* implement range */
return_value->value.lval = p_min->value.lval +
- (int)((double)p_max->value.lval * return_value->value.lval/(PHP_RAND_MAX+(double)p_min->value.lval));
+ (int)((double)(p_max->value.lval - p_min->value.lval + 1) * return_value->value.lval/(PHP_RAND_MAX+1.0));
}
}
+/* }}} */
+/* {{{ proto int mt_rand([int min, int max])
+ Returns a random number from Mersenne Twister */
PHP_FUNCTION(mt_rand)
{
pval *p_min=NULL, *p_max=NULL;
@@ -304,16 +339,23 @@ PHP_FUNCTION(mt_rand)
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));
+ (int)((double)(p_max->value.lval - p_min->value.lval + 1) * return_value->value.lval/(PHP_RAND_MAX+1.0));
}
}
+/* }}} */
+/* {{{ proto int getrandmax(void)
+ Returns the maximum value a random number can have */
PHP_FUNCTION(getrandmax)
{
return_value->type = IS_LONG;
return_value->value.lval = PHP_RAND_MAX;
}
+/* }}} */
+
+/* {{{ proto int mt_getrandmax(void)
+ Returns the maximum value a random number from Mersenne Twister can have */
PHP_FUNCTION(mt_getrandmax)
{
return_value->type = IS_LONG;
@@ -323,7 +365,7 @@ PHP_FUNCTION(mt_getrandmax)
*/
return_value->value.lval = 2147483647; /* 2^^31 */
}
-
+/* }}} */
/*
* Local variables:
* tab-width: 4
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 3fbc211bbb..a14f4e3f06 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -696,6 +696,7 @@ PHP_FUNCTION(wddx_serialize_vars)
_php_wddx_add_chunk(packet, WDDX_STRUCT_S);
for (i=0; i<argc; i++) {
+ convert_to_string(args[i]);
_php_wddx_add_var(packet, args[i]);
}
@@ -815,6 +816,7 @@ PHP_FUNCTION(wddx_add_vars)
}
for (i=1; i<argc; i++) {
+ convert_to_string(args[i]);
_php_wddx_add_var(packet, args[i]);
}
diff --git a/ext/xml/Makefile.am b/ext/xml/Makefile.am
index 9b6e9cdec4..9f2ca1b1be 100644
--- a/ext/xml/Makefile.am
+++ b/ext/xml/Makefile.am
@@ -3,7 +3,7 @@
phplibdir=$(libdir)/php
SRC=xml.c
-INCLUDES=@INCLUDES@ @XML_INCLUDE@ -I@top_srcdir@ -I@top_srcdir@/libzend
+INCLUDES=@INCLUDES@ -I@top_srcdir@ -I@top_srcdir@/libzend
noinst_LIBRARIES=libphpext_xml.a
phplib_LTLIBRARIES=libphpext_xml.la
libphpext_xml_a_SOURCES=$(SRC)
diff --git a/ext/xml/config.m4 b/ext/xml/config.m4
index 787ee3465d..df323399dc 100644
--- a/ext/xml/config.m4
+++ b/ext/xml/config.m4
@@ -3,7 +3,10 @@
AC_MSG_CHECKING(for XML support)
AC_ARG_WITH(xml,
-[ --with-xml Include XML support],[
+[ --with-xml[=DIR] Include XML support. Will look for expat
+ in DIR if specified. Set DIR to "shared" to
+ build as a dl, or "shared,DIR" to build as a dl
+ and still specify DIR.],[
case $withval in
shared)
shared=yes
@@ -24,19 +27,20 @@ AC_ARG_WITH(xml,
AC_MSG_RESULT([yes (static)])
fi
if test "$withval" = "yes"; then
- test -d /usr/include/xmltok && XML_INCLUDE="-I/usr/include/xmltok"
- test -d /usr/include/xml && XML_INCLUDE="-I/usr/include/xml"
- test -d /usr/local/include/xml && XML_INCLUDE="-I/usr/local/include/xml"
+ test -d /usr/include/xmltok && XML_INCLUDE="/usr/include/xmltok"
+ test -d /usr/include/xml && XML_INCLUDE="/usr/include/xml"
+ test -d /usr/local/include/xml && XML_INCLUDE="/usr/local/include/xml"
AC_CHECK_LIB(expat, main, XML_LIBS="-lexpat", XML_LIBS="-lxmlparse -lxmltok")
else
XML_LIBS="-L$withval/lib -lexpat"
if test -d $withval/include/xml; then
- XML_INCLUDE="-I$withval/include/xml"
+ XML_INCLUDE="$withval/include/xml"
else
- XML_INCLUDE="-I$withval/include"
+ XML_INCLUDE="$withval/include"
fi
fi
AC_DEFINE(HAVE_LIBEXPAT, 1)
+ AC_ADD_INCLUDE($XML_INCLUDE)
PHP_EXTENSION(xml, $shared)
if test "$shared" != "yes"; then
EXTRA_LIBS="$EXTRA_LIBS $XML_LIBS"
@@ -48,4 +52,3 @@ AC_ARG_WITH(xml,
AC_MSG_RESULT(no)
])
AC_SUBST(XML_LIBS)
-AC_SUBST(XML_INCLUDE)
diff --git a/ltconfig b/ltconfig
deleted file mode 100644
index ab304fd3b7..0000000000
--- a/ltconfig
+++ /dev/null
@@ -1,2822 +0,0 @@
-#! /bin/sh
-
-# ltconfig - Create a system-specific libtool.
-# Copyright (C) 1996-1999 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.
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-echo=echo
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit 0
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell.
- exec "$SHELL" "$0" --no-reexec ${1+"$@"}
-fi
-
-# Find the correct PATH separator. Usually this is `:', but
-# DJGPP uses `;' like DOS.
-if test "X${PATH_SEPARATOR+set}" != "Xset"; then
- UNAME=${UNAME-`uname 2>/dev/null`}
- case X$UNAME in
- *-DOS) PATH_SEPARATOR=';' ;;
- *) PATH_SEPARATOR=':' ;;
- esac
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
-
-if test "X${echo_test_string+set}" != "Xset"; then
- # find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
- if (echo_test_string="`eval $cmd`") 2>/dev/null &&
- echo_test_string="`eval $cmd`" &&
- (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then
- break
- fi
- done
-fi
-
-if test "X`($echo '\t') 2>/dev/null`" != 'X\t' ||
- test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
-
- IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
- for dir in $PATH /usr/ucb; do
- if test -f $dir/echo &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
- echo="$dir/echo"
- break
- fi
- done
- IFS="$save_ifs"
-
- if test "X$echo" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
- if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
- test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
- echo='print -r'
- elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running ltconfig again with it.
- ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}"
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
- else
- # Try using printf.
- echo='printf "%s\n"'
- if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
- test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
- # Cool, printf works
- :
- elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
- test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
- CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL"
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
- echo="$CONFIG_SHELL $0 --fallback-echo"
- elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' &&
- test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then
- echo="$CONFIG_SHELL $0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
-
- for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
- if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then
- break
- fi
- prev="$cmd"
- done
-
- if test "$prev" != 'sed 50q "$0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"}
- else
- # Oops. We lost completely, so just stick with echo.
- echo=echo
- fi
- fi
- fi
- fi
-fi
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e s/^X//'
-sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# The name of this program.
-progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
-
-# Constants:
-PROGRAM=ltconfig
-PACKAGE=libtool
-VERSION=1.2f
-TIMESTAMP=" (1.385 1999/03/15 17:24:54)"
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
-rm="rm -f"
-
-help="Try \`$progname --help' for more information."
-
-# Global variables:
-default_ofile=libtool
-can_build_shared=yes
-enable_shared=yes
-# All known linkers require a `.a' archive for static linking.
-enable_static=yes
-enable_fast_install=yes
-enable_dlopen=unknown
-ltmain=
-silent=
-srcdir=
-ac_config_guess=
-ac_config_sub=
-host=
-nonopt=
-ofile="$default_ofile"
-verify_host=yes
-with_gcc=no
-with_gnu_ld=no
-need_locks=yes
-ac_ext=c
-objext=o
-libext=a
-cache_file=
-
-old_AR="$AR"
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-old_CPPFLAGS="$CPPFLAGS"
-old_LD="$LD"
-old_LN_S="$LN_S"
-old_NM="$NM"
-old_RANLIB="$RANLIB"
-old_DLLTOOL="$DLLTOOL"
-old_AS="$AS"
-
-# 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]... [HOST [LTMAIN]]
-
-Generate a system-specific libtool script.
-
- --debug enable verbose shell tracing
- --disable-shared do not build shared libraries
- --disable-static do not build static libraries
- --disable-fast-install do not optimize for fast installation
- --enable-dlopen enable dlopen support
- --enable-dlopen-self enable support for dlopening programs
- --help display this help and exit
- --no-verify do not verify that HOST is a valid host type
--o, --output=FILE specify the output file [default=$default_ofile]
- --quiet same as \`--silent'
- --silent do not 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
- --disable-lock disable file locking
- --cache-file=FILE configure cache file
-
-LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program
-that provides basic libtool functionality.
-
-HOST is the canonical host system name [default=guessed].
-EOM
- exit 0
- ;;
-
- --debug)
- echo "$progname: enabling shell trace mode"
- set -x
- ;;
-
- --disable-shared) enable_shared=no ;;
-
- --disable-static) enable_static=no ;;
-
- --disable-fast-install) enable_fast_install=no ;;
-
- --enable-dlopen) enable_dlopen=yes ;;
-
- --quiet | --silent) silent=yes ;;
-
- --srcdir) prev=srcdir ;;
- --srcdir=*) srcdir="$optarg" ;;
-
- --no-verify) verify_host=no ;;
-
- --output | -o) prev=ofile ;;
- --output=*) ofile="$optarg" ;;
-
- --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"; exit 0 ;;
-
- --with-gcc) with_gcc=yes ;;
- --with-gnu-ld) with_gnu_ld=yes ;;
-
- --disable-lock) need_locks=no ;;
-
- --cache-file=*) cache_file="$optarg" ;;
-
- -*)
- 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
-# 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
- echo "$progname: \`$ltmain' does not exist" 1>&2
- echo "$help" 1>&2
- exit 1
-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 test -n "$cache_file" && test -r "$cache_file"; then
- echo "loading cache $cache_file within ltconfig"
- . $cache_file
-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.
- srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'`
- test "$srcdir" = "$ltmain" && srcdir=.
-fi
-
-trap "$rm conftest*; exit 1" 1 2 15
-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 $SHELL $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=`$SHELL $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=`$SHELL $ac_config_sub $host_alias`
- echo "$ac_t$host" 1>&6
-
- # Make sure the host verified.
- test -z "$host" && exit 1
-
-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_os" 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/'`
-
-case "$host_os" in
-aix3*)
- # AIX sometimes has problems with the GCC collect2 program. For some
- # reason, if we set the COLLECT_NAMES environment variable, the problems
- # vanish in a puff of smoke.
- if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
- fi
- ;;
-esac
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR cru $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-# Set a sane default for `AR'.
-test -z "$AR" && AR=ar
-
-# 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}${PATH_SEPARATOR}"
- 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="\$RANLIB \$oldlib~$old_postinstall_cmds"
-fi
-
-# Set sane defaults for `DLLTOOL' and `AS', used on cygwin.
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$AS" && AS=as
-
-# 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}${PATH_SEPARATOR}"
- 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}${PATH_SEPARATOR}"
- 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
- echo "$progname:564: checking whether we are using GNU C" >&5
-
- $rm conftest.c
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
- if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:572: \"$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 object suffix... $ac_c" 1>&6
-$rm conftest*
-echo 'int i = 1;' > conftest.c
-echo "$progname:586: checking for object suffix" >& 5
-if { (eval echo $progname:587: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then
- # Append any warnings to the config.log.
- cat conftest.err 1>&5
-
- for ac_file in conftest.*; do
- case $ac_file in
- *.c) ;;
- *) objext=`echo $ac_file | sed -e s/conftest.//` ;;
- esac
- done
-else
- cat conftest.err 1>&5
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
-fi
-$rm conftest*
-echo "$ac_t$objext" 1>&6
-
-echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
-pic_flag=
-special_shlib_compile_flags=
-wl=
-link_static_flag=
-no_builtin_flag=
-
-if test "$with_gcc" = yes; then
- wl='-Wl,'
- link_static_flag='-static'
-
- case "$host_os" in
- beos* | irix5* | irix6* | osf3* | osf4*)
- # PIC is the default for these OSes.
- ;;
- aix*)
- # Below there is a dirty hack to force normal static linking with -ldl
- # The problem is because libdl dynamically linked with both libc and
- # libC (AIX C++ library), which obviously doesn't included in libraries
- # list by gcc. This cause undefined symbols with -static flags.
- # This hack allows C programs to be linked with "-static -ldl", but
- # we not sure about C++ programs.
- link_static_flag="$link_static_flag ${wl}-lC"
- ;;
- cygwin* | mingw* | os2*)
- # We can build DLLs from non-PIC.
- ;;
- amigaos*)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
- pic_flag='-m68020 -resident32 -malways-restore-a4'
- ;;
- *)
- pic_flag='-fPIC'
- ;;
- esac
-else
- # PORTME Check for PIC flags for the system compiler.
- case "$host_os" in
- aix3* | aix4*)
- # All AIX code is PIC.
- link_static_flag='-bnso -bI:/lib/syscalls.exp'
- ;;
-
- hpux9* | hpux10* | hpux11*)
- # 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.
- ;;
-
- cygwin* | mingw* | os2*)
- # We can build DLLs from non-PIC.
- ;;
-
- osf3* | osf4*)
- # All OSF/1 code is PIC.
- wl='-Wl,'
- link_static_flag='-non_shared'
- ;;
-
- sco3.2v5*)
- pic_flag='-Kpic'
- link_static_flag='-dn'
- special_shlib_compile_flags='-belf'
- ;;
-
- solaris*)
- pic_flag='-KPIC'
- link_static_flag='-Bstatic'
- wl='-Wl,'
- ;;
-
- sunos4*)
- pic_flag='-PIC'
- link_static_flag='-Bstatic'
- wl='-Qoption ld '
- ;;
-
- sysv4.2uw2* | sysv4.3* | sysv5*)
- pic_flag='-KPIC'
- link_static_flag='-Bstatic'
- wl='-Wl,'
- ;;
-
- uts4*)
- pic_flag='-pic'
- link_static_flag='-Bstatic'
- ;;
-
- *)
- can_build_shared=no
- ;;
- esac
-fi
-
-if test -n "$pic_flag"; then
- echo "$ac_t$pic_flag" 1>&6
-
- # Check to make sure the pic_flag actually works.
- echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6
- $rm conftest*
- echo "int some_variable = 0;" > conftest.c
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $pic_flag -DPIC"
- echo "$progname:717: checking if $compiler PIC flag $pic_flag works" >&5
- if { (eval echo $progname:718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then
- # Append any warnings to the config.log.
- cat conftest.err 1>&5
-
- case "$host_os" in
- hpux9* | hpux10* | hpux11*)
- # On HP-UX, both CC and GCC only warn that PIC is supported... then they
- # create non-PIC objects. So, if there were any warnings, we assume that
- # PIC is not supported.
- if test -s conftest.err; then
- echo "$ac_t"no 1>&6
- can_build_shared=no
- pic_flag=
- else
- echo "$ac_t"yes 1>&6
- pic_flag=" $pic_flag"
- fi
- ;;
- *)
- echo "$ac_t"yes 1>&6
- pic_flag=" $pic_flag"
- ;;
- esac
- else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- can_build_shared=no
- pic_flag=
- echo "$ac_t"no 1>&6
- fi
- CFLAGS="$save_CFLAGS"
- $rm conftest*
-else
- echo "$ac_t"none 1>&6
-fi
-
-# Check to see if options -o and -c are simultaneously supported by compiler
-echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6
-$rm conftest*
-echo "int some_variable = 0;" > conftest.c
-save_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -c -o conftest2.o"
-echo "$progname:760: checking if $compiler supports -c -o file.o" >&5
-if { (eval echo $progname:761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest2.o; then
-
- # The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings
- if test -s conftest.err; then
- echo "$ac_t"no 1>&6
- compiler_c_o=no
- else
- echo "$ac_t"yes 1>&6
- compiler_c_o=yes
- fi
-else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- compiler_c_o=no
- echo "$ac_t"no 1>&6
-fi
-CFLAGS="$save_CFLAGS"
-$rm conftest*
-
-if test x"$compiler_c_o" = x"yes"; then
- # Check to see if we can write to a .lo
- echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6
- $rm conftest*
- echo "int some_variable = 0;" > conftest.c
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -c -o conftest.lo"
- echo "$progname:788: checking if $compiler supports -c -o file.lo" >&5
-if { (eval echo $progname:789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then
-
- # The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings
- if test -s conftest.err; then
- echo "$ac_t"no 1>&6
- compiler_o_lo=no
- else
- echo "$ac_t"yes 1>&6
- compiler_o_lo=yes
- fi
- else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- compiler_o_lo=no
- echo "$ac_t"no 1>&6
- fi
- CFLAGS="$save_CFLAGS"
- $rm conftest*
-else
- compiler_o_lo=no
-fi
-
-# Check to see if we can do hard links to lock some files if needed
-hard_links="nottested"
-if test "$compiler_c_o" = no && test "$need_locks" != no; then
- # do not overwrite the value of need_locks provided by the user
- echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6
- hard_links=yes
- $rm conftest*
- ln conftest.a conftest.b 2>/dev/null && hard_links=no
- touch conftest.a
- ln conftest.a conftest.b 2>&5 || hard_links=no
- ln conftest.a conftest.b 2>/dev/null && hard_links=no
- echo "$ac_t$hard_links" 1>&6
- $rm conftest*
- if test "$hard_links" = no; then
- echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2
- need_locks=warn
- fi
-else
- need_locks=no
-fi
-
-if test "$with_gcc" = yes; then
- # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
- echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6
- $rm conftest*
- echo "int some_variable = 0;" > conftest.c
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c"
- echo "$progname:840: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
- if { (eval echo $progname:841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
-
- # The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings
- if test -s conftest.err; then
- echo "$ac_t"no 1>&6
- compiler_rtti_exceptions=no
- else
- echo "$ac_t"yes 1>&6
- compiler_rtti_exceptions=yes
- fi
- else
- # Append any errors to the config.log.
- cat conftest.err 1>&5
- compiler_rtti_exceptions=no
- echo "$ac_t"no 1>&6
- fi
- CFLAGS="$save_CFLAGS"
- $rm conftest*
-
- if test "$compiler_rtti_exceptions" = "yes"; then
- no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
- else
- no_builtin_flag=' -fno-builtin'
- fi
-
-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
-
-echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6
-$rm conftest*
-echo 'main(){return(0);}' > conftest.c
-save_LDFLAGS="$LDFLAGS"
-LDFLAGS="$LDFLAGS $link_static_flag"
-echo "$progname:884: checking if $compiler static flag $link_static_flag works" >&5
-if { (eval echo $progname:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- echo "$ac_t$link_static_flag" 1>&6
-else
- echo "$ac_t"none 1>&6
- link_static_flag=
-fi
-LDFLAGS="$save_LDFLAGS"
-$rm conftest*
-
-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 conftestdata
- if ln -s X conftestdata 2>/dev/null; then
- $rm 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
-
-# Make sure LD is an absolute path.
-if test -z "$LD"; then
- ac_prog=ld
- if test "$with_gcc" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
- echo "$progname:917: checking for ld used by GCC" >&5
- ac_prog=`($CC -print-prog-name=ld) 2>&5`
- case "$ac_prog" in
- # Accept absolute paths.
- /* | [A-Za-z]:[\\/]*)
- re_direlt='/[^/][^/]*/\.\./'
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we are not using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
- elif test "$with_gnu_ld" = yes; then
- echo $ac_n "checking for GNU ld... $ac_c" 1>&6
- echo "$progname:941: checking for GNU ld" >&5
- else
- echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
- echo "$progname:944: checking for non-GNU ld" >&5
- fi
-
- if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog"; then
- LD="$ac_dir/$ac_prog"
- # 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|with BFD)' > /dev/null; then
- test "$with_gnu_ld" != no && break
- else
- test "$with_gnu_ld" != yes && break
- fi
- fi
- done
- IFS="$ac_save_ifs"
- fi
-
- 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
-
-# Check to see if it really is or is not GNU ld.
-echo $ac_n "checking if the linker ($LD) is 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|with BFD)' 1>&5; then
- with_gnu_ld=yes
-else
- with_gnu_ld=no
-fi
-echo "$ac_t$with_gnu_ld" 1>&6
-
-# 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=
-no_undefined_flag=
-need_lib_prefix=unknown
-need_version=unknown
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-archive_cmds=
-archive_expsym_cmds=
-old_archive_from_new_cmds=
-export_dynamic_flag_spec=
-whole_archive_flag_spec=
-thread_safe_flag_spec=
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-hardcode_shlibpath_var=unsupported
-runpath_var=
-always_export_symbols=no
-export_symbols_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
-# include_expsyms should be a list of space-separated symbols to be *always*
-# included in the symbol list
-include_expsyms=
-# exclude_expsyms can be an egrep regular expression of symbols to exclude
-# it will be wrapped by ` (' and `)$', so one must not match beginning or
-# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-# as well as any symbol that contains `d'.
-exclude_expsyms=
-
-case "$host_os" in
-cygwin* | mingw*)
- # FIXME: the MSVC++ port hasn't been tested in a loooong time
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- if test "$with_gcc" != yes; then
- with_gnu_ld=no
- fi
- ;;
-
-freebsd2* | sunos4*)
- exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
- ;;
-
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # If archive_cmds runs LD, not CC, wlarc should be empty
- wlarc='${wl}'
-
- # See if GNU ld supports shared libraries.
- case "$host_os" in
- aix3* | aix4*)
- # On AIX, the GNU linker is very broken
- ld_shlibs=no
- cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support. If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
- ;;
-
- amigaos*)
- archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
-
- sunos4*)
- archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
- wlarc=
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- beos*)
- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
- archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
- else
- ld_shlibs=no
- fi
- ;;
-
- cygwin* | mingw*)
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec='-L$libdir'
- allow_undefined_flag=unsupported
- always_export_symbols=yes
-
- # Extract the symbol export list from an `--export-all' def file,
- # then regenerate the def file from the symbol export list, so that
- # the compiled dll only exports the symbol export list.
- export_symbols_cmds='rm -f $objdir/$soname-ltdll.c~
- sed -e "/^# \/\* ltdll.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~
- (cd $objdir && $CC -c $soname-ltdll.c)~
- $DLLTOOL --export-all --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs~
- sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]* ; *//" < $objdir/$soname-def > $export_symbols'
-
- archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~
- _lt_hint=1;
- for symbol in `cat $export_symbols`; do
- echo " \$symbol @ \$_lt_hint ; " >> $objdir/$soname-def;
- _lt_hint=`expr 1 + \$_lt_hint`;
- done~
- $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
- $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~
- $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~
- $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts'
-
- old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a'
- ;;
-
- *)
- if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
- archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- else
- ld_shlibs=no
- fi
- ;;
- esac
-
- if test "$ld_shlibs" = yes; then
- runpath_var=LD_RUN_PATH
- hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
- export_dynamic_flag_spec='${wl}--export-dynamic'
- whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- fi
-else
- # PORTME fill in a description of your system's linker (not GNU ld)
- case "$host_os" in
- aix3*)
- allow_undefined_flag=unsupported
- always_export_symbols=yes
- archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$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
- if test "$with_gcc" = yes && test -z "$link_static_flag"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
-
- aix4*)
- allow_undefined_flag=
- if test "$with_gcc" = yes; then
- if strings `${CC} -print-prog-name=collect2` | \
- grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- hardcode_direct=yes
- else
- # We have old collect2
- hardcode_direct=unsupported
- fi
- archive_cmds='$CC -shared ${wl}-bnoentry -o $objdir/$soname $libobjs $deplibs $linkopts'
- else
- always_export_symbols=yes
- archive_expsym_cmds='$CC -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bM:SRE ${wl}-bnoentry'
- hardcode_direct=yes
- fi
- hardcode_minus_L=yes
- # Though LIBPATH variable hardcodes shlibpath into executable,
- # it doesn't affect searching for -l* libraries; this confuses
- # tests in mdemo.
- hardcode_shlibpath_var=unsupported
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
-
- amigaos*)
- archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
-
- cygwin* | mingw*)
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec=' '
- allow_undefined_flag=unsupported
- # Tell ltmain to make .lib files, not .a files.
- libext=lib
- # FIXME: Setting linknames here is a bad hack.
- archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
- # The linker will automatically build a .lib file if we build a DLL.
- old_archive_from_new_cmds='true'
- # FIXME: Should let the user specify the lib program.
- old_archive_cmds='lib /OUT:$oldlib$oldobjs'
- fix_srcfile_path='`cygpath -w $srcfile`'
- ;;
-
- freebsd1*)
- ld_shlibs=no
- can_build_shared=no
- ;;
-
- # 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
- # does not break anything, and helps significantly (at the cost of a little
- # extra space).
- freebsd2.2*)
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_minus_L=no # verified on 2.2.6
- hardcode_shlibpath_var=no
- ;;
-
- # Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd*)
- archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- ;;
-
- hpux9*)
- archive_cmds='$rm $objdir/$soname~$LD -b +s +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- export_dynamic_flag_spec='${wl}-E'
- ;;
-
- hpux10* | hpux11*)
- archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- export_dynamic_flag_spec='${wl}-E'
- ;;
-
- irix5* | irix6*)
- if test "$with_gcc" = yes; then
- archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
- else
- archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
- fi
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
-
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out
- else
- archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF
- fi
- hardcode_libdir_flag_spec='${wl}-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- openbsd*)
- archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- hardcode_shlibpath_var=no
- ;;
-
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- allow_undefined_flag=unsupported
- archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def'
- old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
- ;;
-
- osf3* | osf4*)
- if test "$with_gcc" = yes; then
- allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
- archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
- else
- allow_undefined_flag=' -expect_unresolved \*'
- archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib'
- fi
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
-
- sco3.2v5*)
- archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts'
- hardcode_direct=yes
- ;;
-
- solaris*)
- no_undefined_flag=' -z text'
- # $CC -shared without GNU ld will not create a library from C++
- # object files and a static libstdc++, better avoid it by now
- archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts'
- archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp'
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_shlibpath_var=no
- ;;
-
- sunos4*)
- # Why do we need -Bstatic? To avoid inter-library dependencies, maybe...
- if test "$with_gcc" = yes; then
- # Use -fPIC here because libgcc is multilibbed
- archive_cmds='$CC -shared ${wl}-Bstatic -fPIC -o $lib $libobjs $deplibs $linkopts'
- else
- archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts'
- fi
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- hardcode_shlibpath_var=no
- ;;
-
- sysv4.3*)
- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
- hardcode_direct=no
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- export_dynamic_flag_spec='-Bexport'
- ;;
-
- uts4*)
- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=no
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- ;;
-
- dgux*)
- archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=no
- hardcode_minus_L=no
- hardcode_shlibpath_var=no
- ;;
-
- *)
- ld_shlibs=no
- can_build_shared=no
- ;;
- esac
-fi
-echo "$ac_t$ld_shlibs" 1>&6
-
-if test -z "$NM"; then
- echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
- case "$NM" in
- /* | [A-Za-z]:[/\\]*) ;; # Let the user override the test with a path.
- *)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
- for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/nm; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- NM="$ac_dir/nm -B"
- break
- elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
- NM="$ac_dir/nm -p"
- break
- else
- NM=${NM="$ac_dir/nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- fi
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$NM" && NM=nm
- ;;
- esac
- echo "$ac_t$NM" 1>&6
-fi
-
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6
-
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
-
-# Transform the above into a raw symbol and a C symbol.
-symxfrm='\1 \2\3 \3'
-
-# Transform an extracted symbol line into a proper C declaration
-global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
-
-# Define system-specific variables.
-case "$host_os" in
-aix*)
- symcode='[BCDT]'
- ;;
-cygwin* | mingw*)
- symcode='[ABCDGISTW]'
- ;;
-hpux*) # Its linker distinguishes data from code symbols
- global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'"
- ;;
-irix*)
- symcode='[BCDEGRST]'
- ;;
-solaris*)
- symcode='[BDT]'
- ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
- symcode='[ABCDGISTW]'
-fi
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
- # Write the raw and C identifiers.
- global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'"
-
- # Check to see that the pipe works correctly.
- pipe_works=no
- $rm conftest*
- cat > conftest.c <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
- echo "$progname:1447: checking if global_symbol_pipe works" >&5
- if { (eval echo $progname:1448: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if { echo "$progname:1451: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
-
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- else
- rm -f "$nlist"T
- fi
-
- # Make sure that we snagged all the symbols we need.
- if egrep ' nm_test_var$' "$nlist" >/dev/null; then
- if egrep ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<EOF > conftest.c
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
- # Now generate the symbol file.
- eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c'
-
- cat <<EOF >> conftest.c
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr_t address;
-}
-lt_preloaded_symbols[] =
-{
-EOF
- sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c
- cat <<\EOF >> conftest.c
- {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- # Now try linking the two files.
- mv conftest.$objext conftestm.$objext
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="conftestm.$objext"
- CFLAGS="$CFLAGS$no_builtin_flag"
- if { (eval echo $progname:1503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- pipe_works=yes
- else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
- fi
- LIBS="$save_LIBS"
- else
- echo "cannot find nm_test_func in $nlist" >&5
- fi
- else
- echo "cannot find nm_test_var in $nlist" >&5
- fi
- else
- echo "cannot run $global_symbol_pipe" >&5
- fi
- else
- echo "$progname: failed program was:" >&5
- cat conftest.c >&5
- fi
- $rm conftest*
-
- # Do not use the global_symbol_pipe unless it works.
- if test "$pipe_works" = yes; then
- break
- else
- global_symbol_pipe=
- fi
-done
-echo "$ac_t$pipe_works" 1>&6
-
-if test -z "$global_symbol_pipe"; then
- global_symbol_to_cdecl=
-fi
-
-# 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 -n "$runpath_var"; 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
-else
- # We cannot hardcode anything, or else we can only hardcode existing
- # directories.
- hardcode_action=unsupported
-fi
-echo "$ac_t$hardcode_action" 1>&6
-
-
-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 linkers may need a different reload flag.
-reload_flag='-r'
-echo "$ac_t$reload_flag" 1>&6
-test -n "$reload_flag" && reload_flag=" $reload_flag"
-
-# PORTME Fill in your ld.so characteristics
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-file_magic_cmd=
-file_magic_test_file=
-deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [regex]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given egrep regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
-case "$host_os" in
-aix3*)
- version_type=linux
- library_names_spec='${libname}${release}.so$versuffix $libname.a'
- shlibpath_var=LIBPATH
-
- # AIX has no versioning support, so we append a major version to the name.
- soname_spec='${libname}${release}.so$major'
- ;;
-
-aix4*)
- version_type=linux
- # AIX has no versioning support, so currently we can not hardcode correct
- # soname into executable. Probably we can add versioning support to
- # collect2, so additional links can be useful in future.
- # We preserve .a as extension for shared libraries though AIX4.2
- # and later linker supports .so
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a'
- shlibpath_var=LIBPATH
- deplibs_check_method=pass_all
- ;;
-
-amigaos*)
- library_names_spec='$libname.ixlibrary $libname.a'
- # Create ${libname}_ixlibrary.a entries in /sys/libs.
- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
- ;;
-
-beos*)
- library_names_spec='${libname}.so'
- dynamic_linker="$host_os ld.so"
- shlibpath_var=LIBRARY_PATH
- ;;
-
-bsdi4*)
- version_type=linux
- library_names_spec='${libname}.so$major ${libname}.so'
- soname_spec='${libname}.so'
- finish_cmds='PATH="$PATH:/sbin" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- deplibs_check_method='file_magic ELF 32-bit LSB shared object'
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=/shlib/libc.so
- sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
- sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
- # the default ld.so.conf also contains /usr/contrib/lib and
- # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
- # libtool to hard-code these into programs
- ;;
-
-cygwin* | mingw*)
- version_type=windows
- if test "$with_gcc" = yes; then
- library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a'
- else
- library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib'
- fi
- dynamic_linker='Win32 ld.exe'
- deplibs_check_method='file_magic file format pei*-i386.*architecture: i386'
- file_magic_cmd='objdump -f'
- need_lib_prefix=no
- # FIXME: first we should search . and the directory the executable is in
- shlibpath_var=PATH
- ;;
-
-freebsd1*)
- dynamic_linker=no
- ;;
-
-freebsd*)
- objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
- version_type=freebsd-$objformat
- case "$version_type" in
- freebsd-elf*)
- deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB shared object'
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=`echo /usr/lib/libc.so*`
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
- need_version=no
- need_lib_prefix=no
- ;;
- freebsd-*)
- deplibs_check_method=unknown
- library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
- need_version=yes
- ;;
- esac
- finish_cmds='PATH="$PATH:/sbin" OBJFORMAT="'"$objformat"'" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-gnu*)
- version_type=linux
- library_names_spec='${libname}${release}.so$versuffix ${libname}.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-hpux9* | hpux10* | hpux11*)
- # 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
- need_lib_prefix=no
- need_version=no
- shlibpath_var=SHLIB_PATH
- library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
- soname_spec='${libname}${release}.sl$major'
- # HP-UX runs *really* slowly unless shared libraries are mode 555.
- postinstall_cmds='chmod 555 $lib'
- ;;
-
-irix5*)
- version_type=irix
- soname_spec='${libname}${release}.so'
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" # or should it be pass_all?
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=`echo /lib/libc.so*`
- shlibpath_overrides_runpath=no
- ;;
-
-irix6*)
- version_type=irix
- need_lib_prefix=no
- need_version=no
- soname_spec='${libname}${release}.so'
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
- case "$LD" in # libtool.m4 will add one of these switches to LD
- *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
- *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
- *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
- *) libsuff= shlibsuff= libmagic=never-match;;
- esac
- shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
- shlibpath_overrides_runpath=no
- # even though /usr/local/lib is always searched, the man-page says
- # shared libraries should not be installed there if they use an ABI
- # different from -32, so we'd better not search for shared libraries
- # there either
- sys_lib_search_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
- sys_lib_dlsearch_path_spec="/lib${libsuff} /usr/lib${libsuff} /usr/local/lib${libsuff}"
- deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[1234] dynamic lib MIPS - version 1" # or should it be pass_all?
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=`echo /lib${libsuff}/libc.so*`
- ;;
-
-# 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
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- soname_spec='${libname}${release}.so$major'
- finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
-
- 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*)
- version_type=sunos
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
- finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
- dynamic_linker='NetBSD (a.out) ld.so'
- else
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
- soname_spec='${libname}${release}.so$major'
- dynamic_linker='NetBSD ld.elf_so'
- fi
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-openbsd*)
- version_type=sunos
- if test "$with_gnu_ld" = yes; then
- need_lib_prefix=no
- need_version=no
- fi
- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-os2*)
- libname_spec='$name'
- need_lib_prefix=no
- library_names_spec='$libname.dll $libname.a'
- dynamic_linker='OS/2 ld.exe'
- shlibpath_var=LIBPATH
- ;;
-
-osf3* | osf4*)
- version_type=osf
- soname_spec='${libname}${release}.so'
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- # deplibs_check_method='pass_all'
- # Although pass_all appears to work, it copies symbols from static libraries
- # into shared ones and exports them. So, when a program is linked with two
- # or more libraries that have got copies of the same symbols, link fails
- # This was only tested on osf4:
- deplibs_check_method='file_magic COFF format alpha shared library'
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=/shlib/libc.so
- sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
- sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
- ;;
-
-sco3.2v5*)
- version_type=osf
- soname_spec='${libname}${release}.so$major'
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-solaris*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- soname_spec='${libname}${release}.so$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- # ldd complains unless libraries are executable
- postinstall_cmds='chmod +x $lib'
- deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib"
- file_magic_cmd=/usr/bin/file
- file_magic_test_file=/lib/libc.so
- ;;
-
-sunos4*)
- version_type=sunos
- library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- if test "$with_gnu_ld" = yes; then
- need_lib_prefix=no
- fi
- need_version=yes
- ;;
-
-sysv4.2uw2* | sysv4.3* | sysv5*)
- version_type=linux
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- soname_spec='${libname}${release}.so$major'
- shlibpath_var=LD_LIBRARY_PATH
- case "$host_vendor" in
- ncr)
- deplibs_check_method='pass_all'
- ;;
- esac
- ;;
-
-uts4*)
- version_type=linux
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- soname_spec='${libname}${release}.so$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-dgux*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
- soname_spec='${libname}${release}.so$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-*)
- dynamic_linker=no
- ;;
-esac
-echo "$ac_t$dynamic_linker" 1>&6
-test "$dynamic_linker" = no && can_build_shared=no
-
-# Report the final consequences.
-echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
-
-if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then
- case "$deplibs_check_method" in
- "file_magic "*)
- file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- egrep "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
-fi
-
-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, and
-# are all built from PIC.
-case "$host_os" in
-aix3*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds~\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-
-aix4*)
- test "$enable_shared" = yes && enable_static=no
- ;;
-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
-
-if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
- test "$enable_shared" = no; then
- # Fast installation is not necessary
- enable_fast_install=needless
-fi
-
-echo $ac_n "checking for objdir... $ac_c" 1>&6
-rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- objdir=.libs
-else
- # MS-DOS does not allow filenames that begin with a dot.
- objdir=_libs
-fi
-rmdir .libs 2>/dev/null
-echo "$ac_t$objdir" 1>&6
-
-if test "x$enable_dlopen" != xyes; then
- enable_dlopen=unknown
- enable_dlopen_self=unknown
- enable_dlopen_self_static=unknown
-else
-if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then
- lt_cv_dlopen=no lt_cv_dlopen_libs=
-echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "$progname:1977: checking for dlopen" >&5
-if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 1982 "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char dlopen(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_dlopen) || defined (__stub___dlopen)
-choke me
-#else
-dlopen();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo $progname:2004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_dlopen=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_dlopen=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="dlopen"
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "$progname:2022: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldl $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2030 "ltconfig"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
-EOF
-if { (eval echo $progname:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
-echo "$progname:2059: checking for dld_link in -ldld" >&5
-ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldld $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2067 "ltconfig"
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char dld_link();
-
-int main() {
-dld_link()
-; return 0; }
-EOF
-if { (eval echo $progname:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for shl_load""... $ac_c" 1>&6
-echo "$progname:2096: checking for shl_load" >&5
-if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2101 "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char shl_load(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shl_load();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_shl_load) || defined (__stub___shl_load)
-choke me
-#else
-shl_load();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo $progname:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_shl_load=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_shl_load=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="shl_load"
-else
- echo "$ac_t""no" 1>&6
-echo $ac_n "checking for LoadLibrary""... $ac_c" 1>&6
-echo "$progname:2141: checking for LoadLibrary" >&5
-if eval "test \"`echo '$''{'ac_cv_func_LoadLibrary'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2146 "ltconfig"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char LoadLibrary(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char LoadLibrary();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_LoadLibrary) || defined (__stub___LoadLibrary)
-choke me
-#else
-LoadLibrary();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo $progname:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_LoadLibrary=yes"
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_LoadLibrary=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'LoadLibrary`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- lt_cv_dlopen="LoadLibrary"
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-fi
-
-
-fi
-
-
-fi
-
-
-fi
-
-fi
-
- if test "x$lt_cv_dlopen" != xno; then
- enable_dlopen=yes
- fi
-
- case "$lt_cv_dlopen" in
- dlopen)
-for ac_hdr in dlfcn.h; do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "$progname:2210: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2215 "ltconfig"
-#include <$ac_hdr>
-int fnord = 0;
-EOF
-ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo $progname:2220: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-else
- echo "$ac_err" >&5
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
- echo "$ac_t""yes" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- if test "x$ac_cv_header_dlfcn_h" = xyes; then
- CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
- fi
- eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
- LIBS="$lt_cv_dlopen_libs $LIBS"
-
- echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6
-echo "$progname:2248: checking whether a program can dlopen itself" >&5
-if test "${lt_cv_dlopen_self+set}" = set; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- lt_cv_dlopen_self=cross
- else
- cat > conftest.c <<EOF
-#line 2256 "ltconfig"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-# define LTDL_GLOBAL RTLD_GLOBAL
-#else
-# ifdef DL_GLOBAL
-# define LTDL_GLOBAL DL_GLOBAL
-# else
-# define LTDL_GLOBAL 0
-# endif
-#endif
-
-/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
- find out it does not work in some platform. */
-#ifndef LTDL_LAZY_OR_NOW
-# ifdef RTLD_LAZY
-# define LTDL_LAZY_OR_NOW RTLD_LAZY
-# else
-# ifdef DL_LAZY
-# define LTDL_LAZY_OR_NOW DL_LAZY
-# else
-# ifdef RTLD_NOW
-# define LTDL_LAZY_OR_NOW RTLD_NOW
-# else
-# ifdef DL_NOW
-# define LTDL_LAZY_OR_NOW DL_NOW
-# else
-# define LTDL_LAZY_OR_NOW 0
-# endif
-# endif
-# endif
-# endif
-#endif
-
-fnord() { int i=42;}
-main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
- if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
- if(ptr1 || ptr2) exit(0); } exit(1); }
-
-EOF
-if { (eval echo $progname:2302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- lt_cv_dlopen_self=yes
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- lt_cv_dlopen_self=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$lt_cv_dlopen_self" 1>&6
-
- if test "$lt_cv_dlopen_self" = yes; then
- LDFLAGS="$LDFLAGS $link_static_flag"
- echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6
-echo "$progname:2321: checking whether a statically linked program can dlopen itself" >&5
-if test "${lt_cv_dlopen_self_static+set}" = set; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$cross_compiling" = yes; then
- lt_cv_dlopen_self_static=cross
- else
- cat > conftest.c <<EOF
-#line 2329 "ltconfig"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-# define LTDL_GLOBAL RTLD_GLOBAL
-#else
-# ifdef DL_GLOBAL
-# define LTDL_GLOBAL DL_GLOBAL
-# else
-# define LTDL_GLOBAL 0
-# endif
-#endif
-
-/* We may have to define LTDL_LAZY_OR_NOW in the command line if we
- find out it does not work in some platform. */
-#ifndef LTDL_LAZY_OR_NOW
-# ifdef RTLD_LAZY
-# define LTDL_LAZY_OR_NOW RTLD_LAZY
-# else
-# ifdef DL_LAZY
-# define LTDL_LAZY_OR_NOW DL_LAZY
-# else
-# ifdef RTLD_NOW
-# define LTDL_LAZY_OR_NOW RTLD_NOW
-# else
-# ifdef DL_NOW
-# define LTDL_LAZY_OR_NOW DL_NOW
-# else
-# define LTDL_LAZY_OR_NOW 0
-# endif
-# endif
-# endif
-# endif
-#endif
-
-fnord() { int i=42;}
-main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW);
- if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
- if(ptr1 || ptr2) exit(0); } exit(1); }
-
-EOF
-if { (eval echo $progname:2375: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- lt_cv_dlopen_self_static=yes
-else
- echo "$progname: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -fr conftest*
- lt_cv_dlopen_self_static=no
-fi
-rm -fr conftest*
-fi
-
-fi
-
-echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6
-fi
- ;;
- esac
-
- case "$lt_cv_dlopen_self" in
- yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
- *) enable_dlopen_self=unknown ;;
- esac
-
- case "$lt_cv_dlopen_self_static" in
- yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
- *) enable_dlopen_self_static=unknown ;;
- esac
-fi
-
-# Copy echo and quote the copy, instead of the original, because it is
-# used later.
-ltecho="$echo"
-if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then
- ltecho="$CONFIG_SHELL \$0 --fallback-echo"
-fi
-LTSHELL="$SHELL"
-
-LTCONFIG_VERSION="$VERSION"
-
-# Only quote variables if we're using ltmain.sh.
-case "$ltmain" in
-*.sh)
- # Now quote all the things that may contain metacharacters.
- for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
- old_LN_S old_DLLTOOL old_AS AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \
- reload_flag reload_cmds wl \
- pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
- thread_safe_flag_spec whole_archive_flag_spec libname_spec \
- library_names_spec soname_spec \
- RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
- old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \
- file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \
- finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
- hardcode_libdir_flag_spec hardcode_libdir_separator \
- sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
- compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
-
- case "$var" in
- reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
- old_postinstall_cmds | old_postuninstall_cmds | \
- export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
- postinstall_cmds | postuninstall_cmds | \
- finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
- # Double-quote double-evaled strings.
- eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
- ;;
- *)
- eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
- ;;
- esac
- done
-
- case "$ltecho" in
- *'\$0 --fallback-echo"')
- ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
- ;;
- esac
-
- trap "$rm \"$ofile\"; exit 1" 1 2 15
- echo "creating $ofile"
- $rm "$ofile"
- cat <<EOF > "$ofile"
-#! $SHELL
-
-# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
-#
-# Copyright (C) 1996-1999 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.
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="sed -e s/^X//"
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
-
-### BEGIN LIBTOOL CONFIG
-EOF
- cfgfile="$ofile"
- ;;
-
-*)
- # Double-quote the variables that need it (for aesthetics).
- for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
- old_LN_S old_DLLTOOL old_AS; do
- eval "$var=\\\"\$var\\\""
- done
-
- # Just create a config file.
- cfgfile="$ofile.cfg"
- trap "$rm \"$cfgfile\"; exit 1" 1 2 15
- echo "creating $cfgfile"
- $rm "$cfgfile"
- cat <<EOF > "$cfgfile"
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-EOF
- ;;
-esac
-
-cat <<EOF >> "$cfgfile"
-# Libtool 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 NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\
-# DLLTOOL="$old_DLLTOOL" AS="$old_AS" \\
-# $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=$LTCONFIG_VERSION
-
-# Shell to use when invoking shell scripts.
-SHELL=$LTSHELL
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-
-# An echo program that does not interpret backslashes.
-echo=$ltecho
-
-# The archiver.
-AR=$AR
-
-# The default C compiler.
-CC=$CC
-
-# The linker used to build libraries.
-LD=$LD
-
-# Whether we need hard or soft links.
-LN_S=$LN_S
-
-# A BSD-compatible nm program.
-NM=$NM
-
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
-
-# Used on cygwin: assembler.
-AS="$AS"
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# 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
-
-# Object file suffix (normally "o").
-objext="$objext"
-
-# Old archive suffix (normally "a").
-libext="$libext"
-
-# Additional compiler flags for building library objects.
-pic_flag=$pic_flag
-
-# Does compiler simultaneously support -c and -o options
-compiler_c_o=$compiler_c_o
-
-# Can we write directly to a .lo ?
-compiler_o_lo=$compiler_o_lo
-
-# Must we lock files when doing compilation ?
-need_locks=$need_locks
-
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Whether dlopen is supported.
-dlopen=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$link_static_flag
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$no_builtin_flag
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$export_dynamic_flag_spec
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$whole_archive_flag_spec
-
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$thread_safe_flag_spec
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec=$libname_spec
-
-# 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
-old_postuninstall_cmds=$old_postuninstall_cmds
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$old_archive_from_new_cmds
-
-# Commands used to build and install a shared archive.
-archive_cmds=$archive_cmds
-archive_expsym_cmds=$archive_expsym_cmds
-postinstall_cmds=$postinstall_cmds
-postuninstall_cmds=$postuninstall_cmds
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$deplibs_check_method
-
-# Command to use when deplibs_check_method == file_magic
-file_magic_cmd=$file_magic_cmd
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$allow_undefined_flag
-
-# Flag that forces no undefined symbols.
-no_undefined_flag=$no_undefined_flag
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$finish_cmds
-
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$finish_eval
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$global_symbol_to_cdecl
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# 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 SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$sys_lib_search_path_spec
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$fix_srcfile_path"
-
-# Set to yes if exported symbols are required
-always_export_symbols=$always_export_symbols
-
-# The command to extract exported symbols
-export_symbols_cmds=$export_symbols_cmds
-
-# Symbols that should not be listed in the preloaded symbols
-exclude_expsyms=$exclude_expsyms
-
-# Symbols that must always be exported
-include_expsyms=$include_expsyms
-
-EOF
-
-case "$ltmain" in
-*.sh)
- echo '### END LIBTOOL CONFIG' >> "$ofile"
- echo >> "$ofile"
- case "$host_os" in
- aix3*)
- cat <<\EOF >> "$ofile"
-
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "${COLLECT_NAMES+set}" != set; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-EOF
- ;;
- esac
-
- # Append the ltmain.sh script.
- cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1)
-
- chmod +x "$ofile"
- ;;
-
-*)
- # Compile the libtool program.
- echo "FIXME: would compile $ltmain"
- ;;
-esac
-
-test -n "$cache_file" || exit 0
-
-# AC_CACHE_SAVE
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index bfc7e9d7ad..0000000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,3779 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun ltconfig.
-#
-# Copyright (C) 1996-1999 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.
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit 0
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-# The name of this program.
-progname=`$echo "$0" | sed 's%^.*/%%'`
-modename="$progname"
-
-# Constants.
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.2f
-TIMESTAMP=" (1.385 1999/03/15 17:24:54)"
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-SP2NL='tr \040 \012'
-NL2SP='tr \012 \040'
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-if test "${LC_ALL+set}" = set; then
- save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
-fi
-if test "${LANG+set}" = set; then
- save_LANG="$LANG"; LANG=C; export LANG
-fi
-
-if test "$LTCONFIG_VERSION" != "$VERSION"; then
- echo "$modename: 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 "$modename: not configured to build any kind of library" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-lo2o="s/\\.lo\$/.${objext}/"
-
-# Parse our command line options once, thoroughly.
-while test $# -gt 0
-do
- arg="$1"
- shift
-
- case "$arg" in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- execute_dlfiles)
- eval "$prev=\"\$$prev \$arg\""
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case "$arg" in
- --help)
- show_help=yes
- ;;
-
- --version)
- echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
- exit 0
- ;;
-
- --config)
- sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
- exit 0
- ;;
-
- --debug)
- echo "$progname: enabling shell trace mode"
- set -x
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
- else
- echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- echo "enable static libraries"
- else
- echo "disable static libraries"
- fi
- exit 0
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --quiet | --silent)
- show=:
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
-fi
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- case "$nonopt" in
- *cc | *++ | gcc* | *-gcc*)
- mode=link
- for arg
- do
- case "$arg" in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case "$mode" in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- lastarg=
- srcfile="$nonopt"
- suppress_output=
-
- user_target=no
- for arg
- do
- # Accept any command-line options.
- case "$arg" in
- -o)
- if test "$user_target" != "no"; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit 1
- fi
- user_target=next
- ;;
-
- -static)
- build_old_libs=yes
- continue
- ;;
- esac
-
- case "$user_target" in
- next)
- # The next one is the -o target name
- user_target=yes
- continue
- ;;
- yes)
- # We got the output file
- user_target=set
- libobj="$arg"
- continue
- ;;
- esac
-
- # Accept the current argument as the source file.
- lastarg="$srcfile"
- srcfile="$arg"
-
- # Aesthetically quote the previous argument.
-
- # Backslashify any backslashes, double quotes, and dollar signs.
- # These are the only characters that are still specially
- # interpreted inside of double-quoted scrings.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly in scan
- # sets, so we specify it separately.
- case "$lastarg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- lastarg="\"$lastarg\""
- ;;
- esac
-
- # Add the previous argument to base_compile.
- if test -z "$base_compile"; then
- base_compile="$lastarg"
- else
- base_compile="$base_compile $lastarg"
- fi
- done
-
- case "$user_target" in
- set)
- ;;
- no)
- # Get the name of the library object.
- libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- *)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit 1
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSfmso]'
- case "$libobj" in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.f90) xform=f90 ;;
- *.for) xform=for ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case "$libobj" in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit 1
- ;;
- esac
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $libobj"
- else
- removelist="$libobj"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit 1" 1 2 15
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit 1" 1 2 15
- else
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until ln "$0" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
- echo $srcfile > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- # All platforms use -DPIC, to notify preprocessed assembler code.
- command="$base_compile $pic_flag -DPIC $srcfile"
- if test "$build_old_libs" = yes; then
- lo_libobj="$libobj"
- dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$libobj"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
- libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
-
- if test -d "$dir"; then
- $show "$rm $libobj"
- $run $rm $libobj
- else
- $show "$mkdir $dir"
- $run $mkdir $dir
- status=$?
- if test $status -ne 0 && test ! -d $dir; then
- exit $status
- fi
- fi
- fi
- if test "$compiler_o_lo" = yes; then
- output_obj="$libobj"
- command="$command -o $output_obj"
- elif test "$compiler_c_o" = yes; then
- output_obj="$obj"
- command="$command -o $output_obj"
- fi
-
- $show "$command"
- if $run eval "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test x"$output_obj" != x"$libobj"; then
- $show "$mv $output_obj $libobj"
- if $run $mv $output_obj $libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # If we have no pic_flag, then copy the object into place and finish.
- if test -z "$pic_flag" && test "$build_old_libs" = yes; then
- # Rename the .lo from within objdir to obj
- if test -f $obj; then
- $show $rm $obj
- $run $rm $obj
- fi
-
- $show "$mv $libobj $obj"
- if $run $mv $libobj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
-
- # Now arrange that obj and lo_libobj become the same file
- $show "$LN_S $obj $lo_libobj"
- if $run $LN_S $obj $lo_libobj; then
- exit 0
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Allow error messages only from the first compilation.
- suppress_output=' >/dev/null 2>&1'
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- command="$base_compile $srcfile"
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- output_obj="$obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $show "$command"
- if $run eval "$command"; then :
- else
- $run $rm $removelist
- exit 1
- fi
-
- if test "$need_locks" = warn &&
- test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
- echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit 1
- fi
-
- # Just move the object if needed
- if test x"$output_obj" != x"$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Create an invalid libtool object if no PIC, so that we do not
- # accidentally link it into a program.
- if test "$build_libtool_libs" != yes; then
- $show "echo timestamp > $libobj"
- $run eval "echo timestamp > \$libobj" || exit $?
- else
- # Move the .lo from within objdir
- $show "$mv $libobj $lo_libobj"
- if $run $mv $libobj $lo_libobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
- fi
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $rm "$lockfile"
- fi
-
- exit 0
- ;;
-
- # libtool link mode
- link)
- modename="$modename: link"
- C_compiler="$CC" # save it, to compile generated C sources
- CC="$nonopt"
- case "$host" in
- *-*-cygwin* | *-*-mingw* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invokation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
-
- # This is a source program that is used to create dlls on Windows
- # Don't remove nor modify the starting and closing comments
-# /* ltdll.c starts here */
-# #define WIN32_LEAN_AND_MEAN
-# #include <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-#
-# #include <cygwin/cygwin_dll.h>
-# DECLARE_CYGWIN_DLL( DllMain );
-# HINSTANCE __hDllInstance_base;
-#
-# BOOL APIENTRY
-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
-# {
-# __hDllInstance_base = hInst;
-# return TRUE;
-# }
-# /* ltdll.c ends here */
- # This is a source program that is used to create import libraries
- # on Windows for dlls which lack them. Don't remove nor modify the
- # starting and closing comments
-# /* impgen.c starts here */
-# /* Copyright (C) 1999 Free Software Foundation, Inc.
-#
-# This file is part of GNU libtool.
-#
-# 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.
-# */
-#
-# #include <stdio.h> /* for printf() */
-# #include <unistd.h> /* for open(), lseek(), read() */
-# #include <fcntl.h> /* for O_RDONLY, O_BINARY */
-# #include <string.h> /* for strdup() */
-#
-# static unsigned int
-# pe_get16 (fd, offset)
-# int fd;
-# int offset;
-# {
-# unsigned char b[2];
-# lseek (fd, offset, SEEK_SET);
-# read (fd, b, 2);
-# return b[0] + (b[1]<<8);
-# }
-#
-# static unsigned int
-# pe_get32 (fd, offset)
-# int fd;
-# int offset;
-# {
-# unsigned char b[4];
-# lseek (fd, offset, SEEK_SET);
-# read (fd, b, 4);
-# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
-# }
-#
-# static unsigned int
-# pe_as32 (ptr)
-# void *ptr;
-# {
-# unsigned char *b = ptr;
-# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
-# }
-#
-# int
-# main (argc, argv)
-# int argc;
-# char *argv[];
-# {
-# int dll;
-# unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
-# unsigned long export_rva, export_size, nsections, secptr, expptr;
-# unsigned long name_rvas, nexp;
-# unsigned char *expdata, *erva;
-# char *filename, *dll_name;
-#
-# filename = argv[1];
-#
-# dll = open(filename, O_RDONLY|O_BINARY);
-# if (!dll)
-# return 1;
-#
-# dll_name = filename;
-#
-# for (i=0; filename[i]; i++)
-# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
-# dll_name = filename + i +1;
-#
-# pe_header_offset = pe_get32 (dll, 0x3c);
-# opthdr_ofs = pe_header_offset + 4 + 20;
-# num_entries = pe_get32 (dll, opthdr_ofs + 92);
-#
-# if (num_entries < 1) /* no exports */
-# return 1;
-#
-# export_rva = pe_get32 (dll, opthdr_ofs + 96);
-# export_size = pe_get32 (dll, opthdr_ofs + 100);
-# nsections = pe_get16 (dll, pe_header_offset + 4 +2);
-# secptr = (pe_header_offset + 4 + 20 +
-# pe_get16 (dll, pe_header_offset + 4 + 16));
-#
-# expptr = 0;
-# for (i = 0; i < nsections; i++)
-# {
-# char sname[8];
-# unsigned long secptr1 = secptr + 40 * i;
-# unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
-# unsigned long vsize = pe_get32 (dll, secptr1 + 16);
-# unsigned long fptr = pe_get32 (dll, secptr1 + 20);
-# lseek(dll, secptr1, SEEK_SET);
-# read(dll, sname, 8);
-# if (vaddr <= export_rva && vaddr+vsize > export_rva)
-# {
-# expptr = fptr + (export_rva - vaddr);
-# if (export_rva + export_size > vaddr + vsize)
-# export_size = vsize - (export_rva - vaddr);
-# break;
-# }
-# }
-#
-# expdata = (unsigned char*)malloc(export_size);
-# lseek (dll, expptr, SEEK_SET);
-# read (dll, expdata, export_size);
-# erva = expdata - export_rva;
-#
-# nexp = pe_as32 (expdata+24);
-# name_rvas = pe_as32 (expdata+32);
-#
-# printf ("EXPORTS\n");
-# for (i = 0; i<nexp; i++)
-# {
-# unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
-# printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
-# }
-#
-# return 0;
-# }
-# /* impgen.c ends here */
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- compile_command="$CC"
- finalize_command="$CC"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- linkopts=
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- lib_search_path=
- fi
- # now prepend the system-specific ones
- eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- link_against_libtool_libs=
- ltlibs=
- module=no
- objs=
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case "$arg" in
- -all-static | -static)
- if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test $# -gt 0; do
- arg="$1"
- shift
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case "$prev" in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case "$prev" in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case "$arg" in
- *.la | *.lo) ;; # We handle these cases below.
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- fi
- prev=
- continue
- ;;
- *)
- dlprefiles="$dlprefiles $arg"
- test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
- prev=
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit 1
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- rpath)
- rpath="$rpath $arg"
- prev=
- continue
- ;;
- xrpath)
- xrpath="$xrpath $arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi
-
- prevarg="$arg"
-
- case "$arg" in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- dlopen_self=$dlopen_self_static
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- if test "$export_dynamic" != yes; then
- export_dynamic=yes
- if test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- else
- arg=
- fi
- fi
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: cannot have more than one -exported-symbols"
- exit 1
- fi
- if test "$arg" = "-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
- case "$dir" in
- /* | [A-Za-z]:[/\\]*)
- # Add the corresponding hardcode_libdir_flag, if it is not identical.
- ;;
- *)
- $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
- exit 1
- ;;
- esac
- case " $deplibs " in
- *" $arg "*) ;;
- *) deplibs="$deplibs $arg";;
- esac
- case " $lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir";;
- esac
- case "$host" in
- *-*-cygwin* | *-*-mingw* | *-*-os2*)
- dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
- case ":$dllsearchpath:" in
- ::) dllsearchpath="$dllsearchdir";;
- *":$dllsearchdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
- esac
- ;;
- esac
- ;;
-
- -l*)
- deplibs="$deplibs $arg"
- ;;
-
- -module)
- if test "$module" != yes; then
- module=yes
- if test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- else
- arg=
- fi
- fi
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -o) prev=output ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'`
- continue
- ;;
-
- -static)
- # If we have no pic_flag, then this is the same as -all-static.
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- dlopen_self=$dlopen_self_static
- fi
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.o | *.obj | *.a | *.lib)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A library object.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
- prev=
- fi
- libobjs="$libobjs $arg"
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- dlname=
- libdir=
- library_names=
- old_library=
-
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
- exit 1
- fi
-
- # If the library was installed with an old release of libtool,
- # it will not redefine variable installed.
- installed=yes
-
- # If there is no directory component, then add one.
- case "$arg" in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
-
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Find the relevant object directory and library name.
- name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
-
- if test "X$installed" = Xyes; then
- dir="$libdir"
- else
- dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$arg"; then
- dir="$objdir"
- else
- dir="$dir/$objdir"
- fi
- fi
-
- if test -n "$dependency_libs"; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for deplib in $dependency_libs; do
- case "$deplib" in
- -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- case " $rpath $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- -L*) case "$compile_command $temp_deplibs " in
- *" $deplib "*) ;;
- *) temp_deplibs="$temp_deplibs $deplib";;
- esac;;
- *) temp_deplibs="$temp_deplibs $deplib";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- if test -z "$libdir"; then
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $dir/$old_library"
- old_convenience="$old_convenience $dir/$old_library"
- deplibs="$deplibs$dependency_libs"
- compile_command="$compile_command $dir/$old_library$dependency_libs"
- finalize_command="$finalize_command $dir/$old_library$dependency_libs"
- continue
- fi
-
- # This library was specified with -dlopen.
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking statically,
- # we need to preload.
- prev=dlprefiles
- else
- # We should not create a dependency on this library, but we
- # may need any libraries it requires.
- compile_command="$compile_command$dependency_libs"
- finalize_command="$finalize_command$dependency_libs"
- prev=
- continue
- fi
- fi
-
- # The library was specified with -dlpreopen.
- if test "$prev" = dlprefiles; then
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- dlprefiles="$dlprefiles $dir/$old_library"
- else
- dlprefiles="$dlprefiles $dir/$linklib"
- fi
- prev=
- 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
-
- # We need an absolute path.
- case "$dir" in
- /* | [A-Za-z]:[/\\]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2
- exit 1
- fi
- ;;
- esac
-
- # This is the magic to use -rpath.
- # Skip directories that are in the system default run-time
- # search path, unless they have been requested with -R.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
-
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
-
- lib_linked=yes
- case "$hardcode_action" in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- compile_command="$compile_command $dir/$linklib"
- deplibs="$deplibs $dir/$linklib"
- case "$host" in
- *-*-cygwin* | *-*-mingw* | *-*-os2*)
- dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
- if test -n "$dllsearchpath"; then
- dllsearchpath="$dllsearchpath:$dllsearchdir"
- else
- dllsearchpath="$dllsearchdir"
- fi
- ;;
- esac
- elif test "$hardcode_minus_L" = no; then
- case "$host" in
- *-*-sunos*)
- compile_shlibpath="$compile_shlibpath$dir:"
- ;;
- esac
- case "$compile_command " in
- *" -L$dir "*) ;;
- *) compile_command="$compile_command -L$dir";;
- esac
- compile_command="$compile_command -l$name"
- deplibs="$deplibs -L$dir -l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- case ":$compile_shlibpath:" in
- *":$dir:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$dir:";;
- esac
- compile_command="$compile_command -l$name"
- deplibs="$deplibs -l$name"
- else
- lib_linked=no
- fi
- ;;
-
- relink)
- if test "$hardcode_direct" = yes; then
- compile_command="$compile_command $absdir/$linklib"
- deplibs="$deplibs $absdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- case "$compile_command " in
- *" -L$absdir "*) ;;
- *) compile_command="$compile_command -L$absdir";;
- esac
- compile_command="$compile_command -l$name"
- deplibs="$deplibs -L$absdir -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case ":$compile_shlibpath:" in
- *":$absdir:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$absdir:";;
- esac
- compile_command="$compile_command -l$name"
- deplibs="$deplibs -l$name"
- else
- lib_linked=no
- fi
- ;;
-
- *)
- lib_linked=no
- ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit 1
- fi
-
- # 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
- case "$finalize_command " in
- *" -L$libdir "*) ;;
- *) finalize_command="$finalize_command -L$libdir";;
- esac
- finalize_command="$finalize_command -l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case ":$finalize_shlibpath:" in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
- esac
- finalize_command="$finalize_command -l$name"
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- case "$finalize_command " in
- *" -L$dir "*) ;;
- *) finalize_command="$finalize_command -L$libdir";;
- esac
- finalize_command="$finalize_command -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 "$modename: cannot find static library for \`$arg'" 1>&2
- exit 1
- fi
-
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_command="$compile_command $dir/$linklib"
- finalize_command="$finalize_command $dir/$linklib"
- else
- case "$compile_command " in
- *" -L$dir "*) ;;
- *) compile_command="$compile_command -L$dir";;
- esac
- compile_command="$compile_command -l$name"
- case "$finalize_command " in
- *" -L$dir "*) ;;
- *) finalize_command="$finalize_command -L$dir";;
- esac
- finalize_command="$finalize_command -l$name"
- fi
- fi
-
- # Add in any libraries that this one depends upon.
- compile_command="$compile_command$dependency_libs"
- finalize_command="$finalize_command$dependency_libs"
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- oldlibs=
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- case "$output" in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
- *.a | *.lib)
- if test -n "$link_against_libtool_libs"; then
- $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
- exit 1
- fi
-
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- ;;
-
- *.la)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case "$outputname" in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- if test -n "$objs"; then
- $echo "$modename: 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 "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
- exit 1
- fi
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test $# -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- libext=al
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
- dependency_libs="$deplibs"
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- current="$2"
- revision="$3"
- age="$4"
-
- # Check that each of the things are valid numbers.
- case "$current" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$revision" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- case "$age" in
- 0 | [1-9] | [1-9][0-9]*) ;;
- *)
- $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- ;;
- esac
-
- if test $age -gt $current; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit 1
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case "$version_type" in
- none) ;;
-
- irix)
- major=`expr $current - $age + 1`
- versuffix="$major.$revision"
- verstring="sgi$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test $loop != 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="sgi$major.$iface:$verstring"
- done
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test $loop != 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- windows)
- # Like Linux, but with '-' rather than '.', since we only
- # want one extension on Windows 95.
- major=`expr $current - $age`
- versuffix="-$major-$age-$revision"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit 1
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- verstring="0.0"
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
-
- dependency_libs="$deplibs"
- case "$host" in
- *-*-cygwin* | *-*-mingw* | *-*-os2*)
- # these systems don't actually have a c library (as such)!
- ;;
- *)
- # Add libc to deplibs on all other systems.
- deplibs="$deplibs -lc"
- ;;
- esac
- fi
-
- # Create the output directory, or remove our outputs if we need to.
- if test -d $output_objdir; then
- $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
- $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
- else
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- status=$?
- if test $status -ne 0 && test ! -d $output_objdir; then
- exit $status
- fi
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- if test "$build_libtool_libs" = yes; then
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case "$deplibs_check_method" in
- pass_all)
- newdeplibs=$deplibs
- ;; # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behaviour.
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- $C_compiler -o conftest conftest.c $deplibs
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occured in the first compile. Let's try to salvage the situation:
- # Compile a seperate program for each library.
- for i in $deplibs; do
- name="`expr $i : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
- $rm conftest
- $C_compiler -o conftest conftest.c $i
- # Did it work?
- if test $? -eq 0 ; then
- ldd_output=`ldd conftest`
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- droppeddeps=yes
- echo
- echo "*** Warning! Library $i is needed by this library but I was not able to"
- echo "*** make it link in! You will probably need to install it or some"
- echo "*** library that it depends on before this library will be fully"
- echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- deplibs=$newdeplibs
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
- for a_deplib in $deplibs; do
- name="`expr $a_deplib : '-l\(.*\)'`"
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potlib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | sed 's/.* -> //'`
- case "$potliblink" in
- /*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" \
- | sed 10q \
- | egrep "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- echo
- echo "*** Warning: This library needs some functionality provided by $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *) newdeplibs=""
- if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
- grep . >/dev/null; then
- echo
- if test "X$deplibs_check_method" = "Xnone"; then
- echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- echo
- echo "*** Warning: libtool could not satisfy all declared inter-library"
- echo "*** dependencies of module $libname. Therefore, libtool will create"
- echo "*** a static module, that should work as long as the dlopening"
- echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- dlname=
- library_names=
- else
- echo "*** The inter-library dependencies that have been dropped here will be"
- echo "*** automatically added whenever a program is linked with this library"
- echo "*** or is declared to -dlopen it."
- fi
- fi
- fi
-
- # test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- deplibs=$newdeplibs
- # Done checking deplibs!
-
- # Get the real and link names of the library.
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- lib="$output_objdir/$realname"
- for link
- do
- linknames="$linknames $link"
- done
-
- # Ensure that we have .o objects for linkers which dislike .lo
- # (e.g. aix) incase we are running --disable-static
- for obj in $libobjs; do
- oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
- test -f $oldobj || ${LN_S} $obj $oldobj
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- if test -n "$whole_archive_flag_spec"; then
- if test -n "$convenience"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- fi
- else
- for xlib in $convenience; do
- # Extract the objects.
- xdir="$xlib"x
- generated="$generated $xdir"
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x ../$xlib)"
- $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
-
- libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
-
- linkopts="$linkopts $flag"
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$objdir/$libname.exp"
- $run $rm $export_symbols
- eval cmds=\"$export_symbols_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- # Do each of the archive commands.
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval cmds=\"$archive_expsym_cmds\"
- else
- eval cmds=\"$archive_cmds\"
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- *.lo | *.o | *.obj)
- if test -n "$link_against_libtool_libs"; then
- $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
- exit 1
- fi
-
- if test -n "$deplibs"; then
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
- fi
-
- if test -n "$dlfiles$dlprefiles"; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case "$output" in
- *.lo)
- if test -n "$objs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit 1
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Create the old-style object.
- reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
-
- output="$obj"
- eval cmds=\"$reload_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- 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"
- eval cmds=\"$reload_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- else
- # Just create a symlink.
- $show $rm $libobj
- $run $rm $libobj
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj || exit $?
- fi
-
- exit 0
- ;;
-
- # Anything else should be a program.
- *)
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- if test "$dlself" = yes && test "$export_dynamic" = no; then
- $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2
- exit 1
- fi
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$compile_rpath " in
- *" $libdir "*) ;;
- *) compile_rpath="$compile_rpath $libdir" ;;
- esac
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case "$dlsyms" in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$objdir/${output}.nm"
-
- if test -d $objdir; then
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
- else
- $show "$mkdir $objdir"
- $run $mkdir $objdir
- status=$?
- if test $status -ne 0 && test ! -d $objdir; then
- exit $status
- fi
- fi
-
- # Parse the name list into a source file.
- $show "creating $objdir/$dlsyms"
-
- $echo > "$objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$objdir/$output.exp"
- $run $rm $export_symbols
- $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- else
- $run $rm $export_symbols
- $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"'
- $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`echo "$arg" | sed -e 's%^.*/%%'`
- $run eval 'echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr_t address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
- -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
- < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr_t) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case "$host" in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Transform the symbol file into the correct name.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit 1
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
- fi
-
- if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- exit $?
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case "$dir" in
- /* | [A-Za-z]:[/\\]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- # AGH! Flame the AIX and HP-UX people for me, will ya?
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Create the binary in the object directory, then wrap it.
- if test ! -d $output_objdir; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- status=$?
- if test $status -ne 0 && test ! -d $objdir; then
- exit $status
- fi
- fi
-
- # Delete the old output file.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
- case "$0" in
- /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";;
- *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
- esac
- $rm $output
- trap "$rm $output; exit 1" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- link_against_libtool_libs='$link_against_libtool_libs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- echo >> $output "\
- program=lt-'$outputname'
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if (cd \"\$thisdir\" && eval \$relink_command); then :
- else
- $rm \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- *-*-cygwin* | *-*-mingw | *-*-os2*)
- # win32 systems need to use the prog path for dll
- # lookup to work
- $echo >> $output "\
- exec \$progdir\\\\\$program \${1+\"\$@\"}
-"
- ;;
- *)
- $echo >> $output "\
- # Export the path to the program.
- PATH=\"\$progdir:\$PATH\"
- export PATH
-
- exec \$program \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
- exit 1
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
- chmod +x $output
- fi
- exit 0
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
- fi
- addlibs="$old_convenience"
- fi
-
- # Add in members from convenience archives.
- for xlib in $addlibs; do
- # Extract the objects.
- xdir="$xlib"x
- generated="$generated $xdir"
- xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
-
- $show "${rm}r $xdir"
- $run ${rm}r "$xdir"
- $show "mkdir $xdir"
- $run mkdir "$xdir"
- status=$?
- if test $status -ne 0 && test ! -d "$xdir"; then
- exit $status
- fi
- $show "(cd $xdir && $AR x ../$xlib)"
- $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $?
-
- oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
- done
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- eval cmds=\"$old_archive_from_new_cmds\"
- else
- eval cmds=\"$old_archive_cmds\"
- fi
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case "$output" in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- if test -n "$xrpath"; then
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- done
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- $echo > $output "\
-# $output - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
-# 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'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=no
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'\
-"
-
- $rm "$output_objdir/$outputname"i
- sed 's/^installed=no$/installed=yes/' \
- < "$output" > "$output_objdir/$outputname"i || exit 1
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
- ;;
- esac
- exit 0
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg="$nonopt"
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest="$arg"
- continue
- fi
-
- case "$arg" in
- -d) isdir=yes ;;
- -f) prev="-f" ;;
- -g) prev="-g" ;;
- -m) prev="-m" ;;
- -o) prev="-o" ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*) ;;
-
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest="$arg"
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case "$arg" in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test $# -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
- fi
- case "$destdir" in
- /* | [A-Za-z]:[/\\]*) ;;
- *)
- for file in $files; do
- case "$file" in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case "$file" in
- *.a | *.lib)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- library_names=
- old_library=
- # If there is no directory component, then add one.
- case "$file" in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- # 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=
-
- if test $# -gt 0; then
- # Delete the old symlinks, and create new ones.
- for linkname
- do
- test "X$dlname" = "X$linkname" && dlname=
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
- fi
- done
- fi
-
- 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"
- eval cmds=\"$postinstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- if test ! -f "$instname"; then
- # Just in case it was removed...
- $show "Creating $instname"
- $rm "$instname"
- sed 's/^installed=no$/installed=yes/' "$file" > "$instname"
- fi
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case "$destfile" in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.o | *.obj)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit 0
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Do a test to see if this is really a libtool program.
- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- link_against_libtool_libs=
- relink_command=
-
- # If there is no directory component, then add one.
- case "$file" in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$link_against_libtool_libs"; then
- $echo "$modename: 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 "X$lib" | $Xsed -e 's%^.*/%%g'`"
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes; then
- outputname="/tmp/$$-$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
-
- $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && $rm $outputname
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- # Do each command in the postinstall commands.
- eval cmds=\"$old_postinstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec $SHELL $0 --finish$current_libdirs
- exit 1
- fi
-
- exit 0
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- eval cmds=\"$finish_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = : && exit 0
-
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- echo " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
- echo "See any operating system documentation about shared libraries for"
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- echo "----------------------------------------------------------------------"
- exit 0
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit 1
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- dir=
- case "$file" in
- *.la)
- # Check to see that this really is a libtool archive.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case "$file" in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit 1
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case "$file" in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case "$file" in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
-
- # Restore saved enviroment variables
- if test "${save_LC_ALL+set}" = set; then
- LC_ALL="$save_LC_ALL"; export LC_ALL
- fi
- if test "${save_LANG+set}" = set; then
- LANG="$save_LANG"; export LANG
- fi
-
- # Now actually exec the command.
- eval "exec \$cmd$args"
-
- $echo "$modename: cannot exec \$cmd$args"
- exit 1
- else
- # Display what would be done.
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- $echo "$cmd$args"
- exit 0
- fi
- ;;
-
- # libtool uninstall mode
- uninstall)
- modename="$modename: uninstall"
- rm="$nonopt"
- files=
-
- for arg
- do
- case "$arg" in
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit 1
- fi
-
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- rmfiles="$file"
-
- case "$name" in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $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"
-
- $show "$rm $rmfiles"
- $run $rm $rmfiles
-
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- eval cmds=\"$postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- eval cmds=\"$old_postuninstall_cmds\"
- IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd"
- done
- IFS="$save_ifs"
- fi
-
- # FIXME: should reinstall the best remaining shared library.
- fi
- ;;
-
- *.lo)
- if test "$build_old_libs" = yes; then
- oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
- rmfiles="$rmfiles $dir/$oldobj"
- fi
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- ;;
-
- *)
- $show "$rm $rmfiles"
- $run $rm $rmfiles
- ;;
- esac
- done
- exit 0
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
- ;;
- esac
-
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit 1
-fi # test -z "$show_help"
-
-# We need to display help for each of the modes.
-case "$mode" in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --version print version information
-
-MODE must be one of the following:
-
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE."
- exit 0
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-esac
-
-echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit 0
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/main/main.c b/main/main.c
index 59d1a54b37..6c0db41cd9 100644
--- a/main/main.c
+++ b/main/main.c
@@ -359,6 +359,9 @@ PHPAPI void php3_error(int type, const char *format,...)
error_filename = zend_get_compiled_filename();
error_lineno = CG(zend_lineno);
+ if (!error_filename) {
+ error_filename = zend_get_executed_filename(ELS_C);
+ }
}
break;
case E_ERROR:
@@ -372,6 +375,10 @@ PHPAPI void php3_error(int type, const char *format,...)
error_lineno = 0;
break;
}
+
+ if (!error_filename) {
+ error_filename = "Unknown";
+ }
if (EG(error_reporting) & type || (type & E_CORE)) {
char *error_type_str;
@@ -768,11 +775,10 @@ int php_module_startup(sapi_module_struct *sf)
sapi_globals_struct *sapi_globals = ts_resource(sapi_globals_id);
#endif
#if (WIN32|WINNT) && !(USE_SAPI)
- WORD wVersionRequested;
+ WORD wVersionRequested = MAKEWORD(2, 0);
WSADATA wsaData;
-
- wVersionRequested = MAKEWORD(2, 0);
#endif
+ ELS_FETCH();
SG(server_context) = NULL;
SG(request_info).request_method = NULL;
@@ -782,6 +788,8 @@ int php_module_startup(sapi_module_struct *sf)
return SUCCESS;
}
+ EG(error_reporting) = E_ALL & ~E_NOTICE;
+
sapi_module = *sf;
zend_output_startup();
diff --git a/main/php_version.h b/main/php_version.h
index ee69a881fc..ab60bf6f9f 100644
--- a/main/php_version.h
+++ b/main/php_version.h
@@ -1 +1,3 @@
-#define PHP_VERSION "4.0B1"
+/* automatically generated by configure */
+/* edit configure.in.in to change version number */
+#define PHP_VERSION "4.0b2-dev"
diff --git a/mod_php4.c b/mod_php4.c
index acfe531f20..30e1bc93df 100644
--- a/mod_php4.c
+++ b/mod_php4.c
@@ -425,7 +425,7 @@ CONST_PREFIX char *php_apache_flag_handler_ex(cmd_parms *cmd, HashTable *conf, c
{
char bool_val[2];
- if (!strcmp(arg2, "On")) {
+ if (!strcasecmp(arg2, "On")) {
bool_val[0] = '1';
} else {
bool_val[0] = '0';
diff --git a/php4.gif b/php4.gif
new file mode 100644
index 0000000000..e5d3c477fd
--- /dev/null
+++ b/php4.gif
Binary files differ
diff --git a/php4.spec.in b/php4.spec.in
new file mode 100644
index 0000000000..cfcd0796c7
--- /dev/null
+++ b/php4.spec.in
@@ -0,0 +1,48 @@
+%define version @VERSION@
+%define so_version 4
+%define release 1
+
+Name: php
+Summary: PHP: Hypertext Preprocessor
+Group: Development/Languages
+Version: %{version}
+Release: %{release}
+Copyright: The PHP license (see "LICENSE" file included in distribution)
+Source: http://www.php.net/version4/downloads/php-%{version}.tar.gz
+Icon: php4.gif
+URL: http://www.php.net/
+Packager: PHP Group <group@php.net>
+
+BuildRoot: /var/tmp/php-%{version}
+
+%description
+PHP is an HTML-embedded scripting language. Much of its syntax is
+borrowed from C, Java and Perl with a couple of unique PHP-specific
+features thrown in. The goal of the language is to allow web
+developers to write dynamically generated pages quickly.
+
+%prep
+
+%setup
+
+%build
+set -x
+./buildconf
+./configure --prefix=/usr --with-apxs \
+ --enable-track-vars --disable-debug \
+ --with-xml=shared \
+
+# figure out configure options options based on what packages are installed
+# to override, use the OVERRIDE_OPTIONS environment variable. To add
+# extra options, use the OPTIONS environment variable.
+
+#test rpm -q MySQL-devel >&/dev/null && OPTIONS="$OPTIONS --with-mysql=shared"
+#test rpm -q solid-devel >&/dev/null && OPTIONS="$OPTIONS --with-solid=shared,/home/solid"
+#test rpm -q postgresql-devel >&/dev/null && OPTIONS="$OPTIONS --with-pgsql=shared"
+test rpm -q expat >&/dev/null && OPTIONS="$OPTIONS --with-xml=shared"
+
+if test "x$OVERRIDE_OPTIONS" = "x"; then
+ ./configure --prefix=/usr --with-apxs=$APXS $OPTIONS
+else
+ ./configure $OVERRIDE_OPTIONS
+fi
diff --git a/php4dll.dsp b/php4dll.dsp
index 88e260aa56..abc95a1fc7 100644
--- a/php4dll.dsp
+++ b/php4dll.dsp
@@ -363,6 +363,10 @@ SOURCE=.\ext\standard\pageinfo.c
# End Source File
# Begin Source File
+SOURCE=.\ext\standard\parsedate.c
+# End Source File
+# Begin Source File
+
SOURCE=.\ext\pcre\php_pcre.c
# End Source File
# Begin Source File
@@ -739,6 +743,26 @@ BuildCmds= \
!ENDIF
# End Source File
+# Begin Source File
+
+SOURCE=.\ext\standard\parsedate.y
+
+!IF "$(CFG)" == "php4dll - Win32 Debug"
+
+# Begin Custom Build
+InputPath=.\ext\standard\parsedate.y
+
+"ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ cd ext\standard
+ bison --output=parsedate.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" parsedate.y
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php4dll - Win32 Release"
+
+!ENDIF
+
+# End Source File
# End Group
# Begin Group "Scanners"
diff --git a/php4dllts.dsp b/php4dllts.dsp
index 4da958a50c..0925f76d9e 100644
--- a/php4dllts.dsp
+++ b/php4dllts.dsp
@@ -371,6 +371,10 @@ SOURCE=.\ext\standard\pageinfo.c
# End Source File
# Begin Source File
+SOURCE=.\ext\standard\parsedate.c
+# End Source File
+# Begin Source File
+
SOURCE=.\ext\pcre\php_pcre.c
# End Source File
# Begin Source File
@@ -755,6 +759,26 @@ BuildCmds= \
!ENDIF
# End Source File
+# Begin Source File
+
+SOURCE=.\ext\standard\parsedate.y
+
+!IF "$(CFG)" == "php4dllts - Win32 Debug_TS"
+
+# Begin Custom Build
+InputPath=.\ext\standard\parsedate.y
+
+"ext\standard\parsedate.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ cd ext\standard
+ bison --output=parsedate.c -v -d -S "C:\Program Files\Cygnus\share\bison.simple" parsedate.y
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "php4dllts - Win32 Release_TS"
+
+!ENDIF
+
+# End Source File
# End Group
# Begin Group "Scanners"
@@ -792,6 +816,10 @@ InputPath=".\configuration-scanner.l"
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\ChangeLog
+# End Source File
+# Begin Source File
+
SOURCE=.\LICENSE
# End Source File
# Begin Source File
diff --git a/scripts/mkextlib.in b/scripts/mkextlib.in
index 7acb214e18..c098ef7b5d 100755
--- a/scripts/mkextlib.in
+++ b/scripts/mkextlib.in
@@ -14,3 +14,4 @@ for dir in $extensions; do
done
(set -x; $top_srcdir/scripts/armerge $outfile $ext_libs)
+exit 0