Skip to content

Commit

Permalink
Zend Library
Browse files Browse the repository at this point in the history
  • Loading branch information
Andi Gutmans committed Apr 7, 1999
1 parent f70a4db commit 573b460
Show file tree
Hide file tree
Showing 56 changed files with 16,187 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Zend/LICENSE
@@ -0,0 +1,37 @@
Zend Temporary License
======================

This is a temporary license, that is in effect until the final Zend license
is available.

* The final license will include the ability to distribute Zend freely,
as a part of PHP (in both compiled and source code formats). It may
(and probably will) allow to redistribute Zend under other circumstances
as well, but at the very least, it'll be freely distributed as a part
of PHP.

* The source code in the Zend engine is the property of Andi Gutmans and
Zeev Suraski. Parts of this code are based on source code taken from
PHP 3.0, which may include several patches and enhancements that weren't
made by us (Andi&Zeev). If you're the author of such a patch and you're
not willing to give up ownership over your patch to us, please contact
us as soon as possible, so we can remove it. We're doing this so that
we'd be eligible to sell the Zend engine for uses other than PHP, most
notably - as an embedded part of possible commercial products that we'd
have.

* Patches submitted to the Zend CVS automatically fall under this license,
and by submitting them you're implicitly giving up your ownership over
this patch to us.

* Until further notice, Zend is in a status of a closed beta test. That means
that only people that were explicitly given the right to access the Zend
CVS repository are allowed to use it. If you're reading this file and you
weren't explicitly given the right to access the Zend CVS repository from
either Andi Gutmans or Zeev Suraski - you're not supposed to have it - please
erase the Zend files from your system. When the closed beta period finishes,
the Zend CVS tree will be open for the public (in read-only mode, of course).


Any questions regarding Zend or this license should be addressed via Email to
zend@zend.com.
145 changes: 145 additions & 0 deletions Zend/Makefile.in
@@ -0,0 +1,145 @@
CC = @CC@
AR = ar rc
LIBNAME = libzend.a
PROF_CFLAGS =
CFLAGS_SHLIB = @CFLAGS_SHLIB@
LDFLAGS_SHLIB = @LDFLAGS_SHLIB@
LDFLAGS_SHLIB_EXPORT = @LDFLAGS_SHLIB_EXPORT@
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@ $(CFLAGS_SHLIB) $(CPPFLAGS) $(INCLUDE) @DEBUG_CFLAGS@ $(PROF_CFLAGS)
LDFLAGS = @LDFLAGS@ $(LDFLAGS_SHLIB) $(LDFLAGS_SHLIB_EXPORT)
RANLIB = @RANLIB@
YACC = @YACC@

SOURCE = zend_alloc.c zend_compile.c zend_constants.c zend_execute.c zend_execute_API.c \
zend_highlight.c zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
zend_stack.c zend_variables.c zend-parser.c zend-scanner.c zend.c zend_API.c zend_extensions.c \
zend_hash.c zend_list.c zend_indent.c

OBJS = zend_alloc.o zend_compile.o zend_constants.o zend_execute.o zend_execute_API.o \
zend_highlight.o zend_llist.o zend_opcode.o zend_operators.o zend_ptr_stack.o \
zend_stack.o zend_variables.o zend-parser.o zend-scanner.o zend.o zend_API.o zend_extensions.o \
zend_hash.o zend_list.o zend_indent.o

LIBS = @LIBS@

all: $(LIBNAME)

libzend.a: $(OBJS)
-rm -f libzend.a
$(AR) libzend.a $(OBJS)
$(RANLIB) libzend.a

zend-parser.h zend-parser.c: zend-parser.y
bison -p zend -v -d zend-parser.y -o zend-parser.c

zend-scanner.o:
$(CC) $(CFLAGS) -w -c zend-scanner.c

zend-scanner.c: zend-scanner.l
flex -Pzend -ozend-scanner.c -i zend-scanner.l

clean:
-rm -f libzend.a *.o

distclean: clean
-rm -f *-scanner.c *-parser.[ch] *.output
-rm -f config.status config.cache config.log
-rm -f Makefile Makefile.depend config.h

.c.o:
@rm -f $@
$(CC) $(CFLAGS) -c $< -o $@
@bn=`echo $@ | sed -e 's#functions/##'`; test -f $@ || \
(test "$@" != "$$bn" && test -f "$$bn" && mv $$bn $@)

parser-scanner: zend-parser.c zend-parser.h zend-scanner.c

depend: parser-scanner
$(CC) $(CFLAGS) -MM $(SOURCE) | perl -pe 's|regex/regex.h||;' > Makefile.depend


zend_alloc.o: zend_alloc.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h zend_globals.h zend_stack.h \
zend_ptr_stack.h zend_compile.h zend-parser.h zend_execute.h
zend_compile.o: zend_compile.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
zend_operators.h
zend_constants.o: zend_constants.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_constants.h \
zend_variables.h zend_operators.h zend_globals.h zend_stack.h \
zend_ptr_stack.h zend_compile.h zend-parser.h zend_execute.h
zend_execute.o: zend_execute.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
zend_operators.h zend_constants.h zend_extensions.h
zend_execute_API.o: zend_execute_API.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_API.h modules.h zend_list.h zend_variables.h \
zend_operators.h zend_constants.h zend_extensions.h
zend_highlight.o: zend_highlight.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_highlight.h
zend_llist.o: zend_llist.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h
zend_opcode.o: zend_opcode.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_variables.h zend_operators.h zend_extensions.h \
zend_API.h modules.h zend_list.h
zend_operators.o: zend_operators.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_operators.h \
zend_variables.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_compile.h zend-parser.h zend_execute.h
zend_ptr_stack.o: zend_ptr_stack.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_ptr_stack.h
zend_stack.o: zend_stack.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h zend_stack.h
zend_variables.o: zend_variables.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_API.h \
modules.h zend_list.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_compile.h zend-parser.h zend_execute.h zend_constants.h \
zend_variables.h
zend-parser.o: zend-parser.c zend_compile.h zend.h config.h \
config.unix.h zend_errors.h zend_alloc.h zend_hash.h zend_llist.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_list.h zend_API.h modules.h zend_variables.h \
zend_operators.h
zend-scanner.o: zend-scanner.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend-scanner.h zend_highlight.h zend_constants.h \
zend_variables.h zend_operators.h
zend.o: zend.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h zend_operators.h \
zend_variables.h zend_extensions.h zend_compile.h zend-parser.h \
zend_globals.h zend_stack.h zend_ptr_stack.h zend_execute.h modules.h \
zend_constants.h zend_list.h
zend_API.o: zend_API.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h zend_variables.h zend_execute.h \
zend_compile.h zend-parser.h zend_globals.h zend_stack.h \
zend_ptr_stack.h zend_API.h modules.h zend_list.h zend_constants.h \
zend_operators.h
zend_extensions.o: zend_extensions.c zend_extensions.h zend_compile.h \
zend.h config.h config.unix.h zend_errors.h zend_alloc.h zend_hash.h \
zend_llist.h zend-parser.h zend_globals.h zend_stack.h \
zend_ptr_stack.h zend_execute.h
zend_hash.o: zend_hash.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h
zend_list.o: zend_list.c zend.h config.h config.unix.h zend_errors.h \
zend_alloc.h zend_hash.h zend_llist.h zend_list.h zend_API.h \
modules.h zend_globals.h zend_stack.h zend_ptr_stack.h zend_compile.h \
zend-parser.h zend_execute.h
zend_indent.o: zend_indent.c zend.h config.h config.unix.h \
zend_errors.h zend_alloc.h zend_hash.h zend_llist.h zend_compile.h \
zend-parser.h zend_globals.h zend_stack.h zend_ptr_stack.h \
zend_execute.h zend_indent.h

# Local Variables:
# tab-width: 4
# End:
111 changes: 111 additions & 0 deletions Zend/ZEND_CHANGES
@@ -0,0 +1,111 @@
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($val in array_expr) statement
foreach($key, $val in array_expr) 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.

2 comments on commit 573b460

@hofrob
Copy link

@hofrob hofrob commented on 573b460 May 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's see where this goes.

You guys should give Linux a try. 😉

@Spacha
Copy link

@Spacha Spacha commented on 573b460 May 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this language will become a real killer!

Please sign in to comment.