Permalink
Browse files

This commit was generated by cvs2svn to compensate for changes in r2,

which included commits to RCS files with non-trunk default branches.

SVN Rev: 3
  • Loading branch information...
derickr committed Apr 24, 2002
1 parent cd942a0 commit 78749ee4113003cc3391f7d468d1a9ddb320f963
Showing with 1,080 additions and 0 deletions.
  1. +25 −0 .cvsignore
  2. +2 −0 CREDITS
  3. 0 EXPERIMENTAL
  4. +10 −0 config.m4
  5. +78 −0 php_xdebug.h
  6. +181 −0 srm_llist.c
  7. +71 −0 srm_llist.h
  8. BIN tests/.test1.php.swp
  9. +23 −0 tests/001.phpt
  10. +14 −0 tests/test1.php
  11. +14 −0 tests/test_class.php
  12. +662 −0 xdebug.c
@@ -0,0 +1,25 @@
.deps
Makefile
*.lo
*.la
.libs
libs.mk
ac*.m4
build
config.h
config.h.in
config.nice
config.sub
configure
configure.in
core
dynlib.m4
install-sh
ltmain.sh
include
Makefile.global
missing
mkinstalldirs
modules
scan_makefile_in.awk

@@ -0,0 +1,2 @@
xdebug
Derick Rethans
No changes.
@@ -0,0 +1,10 @@
dnl $Id: config.m4,v 1.1.1.1 2002-04-24 14:26:19 derick Exp $
dnl config.m4 for extension xdebug

PHP_ARG_ENABLE(xdebug, whether to enable eXtended debugging support,
[ --enable-xdebug Enable xdebug support])

if test "$PHP_XDEBUG" != "no"; then
PHP_NEW_EXTENSION(xdebug, xdebug.c srm_llist.c, $ext_shared)
AC_DEFINE(HAVE_XDEBUG,1,[ ])
fi
@@ -0,0 +1,78 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@vl-srm.net> |
+----------------------------------------------------------------------+
*/

#ifndef PHP_XDEBUG_H
#define PHP_XDEBUG_H

#include "php.h"
#include "srm_llist.h"

extern zend_module_entry xdebug_module_entry;
#define phpext_xdebug_ptr &xdebug_module_entry

#ifdef PHP_WIN32
#define PHP_XDEBUG_API __declspec(dllexport)
#else
#define PHP_XDEBUG_API
#endif

#ifdef ZTS
#include "TSRM.h"
#endif

PHP_MINIT_FUNCTION(xdebug);
PHP_MSHUTDOWN_FUNCTION(xdebug);
PHP_RINIT_FUNCTION(xdebug);
PHP_RSHUTDOWN_FUNCTION(xdebug);
PHP_MINFO_FUNCTION(xdebug);


PHP_FUNCTION(xdebug_get_function_stack);

typedef struct function_stack_entry {
char *function_name;
char *filename;
int lineno;
int varc;
char *vars[20];
} function_stack_entry;


ZEND_BEGIN_MODULE_GLOBALS(xdebug)
int level;
srm_llist *stack;
int max_nesting_level;
ZEND_END_MODULE_GLOBALS(xdebug)


#ifdef ZTS
#define XG(v) TSRMG(xdebug_globals_id, zend_xdebug_globals *, v)
#else
#define XG(v) (xdebug_globals.v)
#endif

#endif


/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/
@@ -0,0 +1,181 @@
/* $Id: srm_llist.c,v 1.1.1.1 2002-04-24 14:26:19 derick Exp $ */

/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.vl-srm.net/vlpl/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is vl-srm.net code.
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
* 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
*
* Author(s): Sterling Hughes <sterling@php.net>
*/

#include <stdlib.h>
#include <string.h>

#include "srm_llist.h"

srm_llist *srm_llist_alloc(srm_llist_dtor dtor)
{
srm_llist *l;

l = malloc(sizeof(srm_llist));
l->size = 0;
l->dtor = dtor;
l->head = NULL;
l->tail = NULL;

return l;
}

int srm_llist_insert_next(srm_llist *l, srm_llist_element *e, const void *p)
{
srm_llist_element *ne;

if (!e) {
e = SRM_LLIST_TAIL(l);
}

ne = (srm_llist_element *) malloc(sizeof(srm_llist_element));
ne->ptr = (void *) p;
if (l->size == 0) {
l->head = ne;
l->head->prev = NULL;
l->head->next = NULL;
l->tail = ne;
} else {
ne->next = e->next;
ne->prev = e;
if (e->next) {
e->next->prev = ne;
} else {
l->tail = ne;
}
e->next = ne;
}

++l->size;

return 1;
}

int srm_llist_insert_prev(srm_llist *l, srm_llist_element *e, const void *p)
{
srm_llist_element *ne;

if (!e) {
e = SRM_LLIST_HEAD(l);
}

ne = (srm_llist_element *) malloc(sizeof(srm_llist_element));
ne->ptr = (void *) p;
if (l->size == 0) {
l->head = ne;
l->head->prev = NULL;
l->head->next = NULL;
l->tail = ne;
} else {
ne->next = e;
ne->prev = e->prev;
if (e->prev)
e->prev->next = ne;
else
l->head = ne;
e->prev = ne;
}

++l->size;

return 0;
}

int srm_llist_remove(srm_llist *l, srm_llist_element *e, void *user)
{
if (e == NULL || l->size == 0)
return 0;

if (e == l->head) {
l->head = e->next;

if (l->head == NULL)
l->tail = NULL;
else
e->next->prev = NULL;
} else {
e->prev->next = e->next;
if (!e->next)
l->tail = e->prev;
else
e->next->prev = e->prev;
}

l->dtor(user, e->ptr);
free(e);
--l->size;

return 0;
}

int srm_llist_remove_next(srm_llist *l, srm_llist_element *e, void *user)
{
return srm_llist_remove(l, e->next, user);
}

int srm_llist_remove_prev(srm_llist *l, srm_llist_element *e, void *user)
{
return srm_llist_remove(l, e->prev, user);
}

srm_llist_element *srm_llist_jump(srm_llist *l, int where, int pos)
{
srm_llist_element *e=NULL;
int i;

if (where == LIST_HEAD) {
e = SRM_LLIST_HEAD(l);
for (i = 0; i < pos; ++i) {
e = SRM_LLIST_NEXT(e);
}
}
else if (where == LIST_TAIL) {
e = SRM_LLIST_TAIL(l);
for (i = 0; i < pos; ++i) {
e = SRM_LLIST_PREV(e);
}
}

return e;
}

size_t srm_llist_count(srm_llist *l)
{
return l->size;
}

void srm_llist_destroy(srm_llist *l, void *user)
{
while (srm_llist_count(l) > 0) {
srm_llist_remove(l, SRM_LLIST_TAIL(l), user);
}

free (l);
l = NULL;
}

/*
* Local Variables:
* c-basic-offset: 4
* tab-width: 4
* End:
* vim600: fdm=marker
* vim: noet sw=4 ts=4
*/
@@ -0,0 +1,71 @@
/* $Id: srm_llist.h,v 1.1.1.1 2002-04-24 14:26:19 derick Exp $ */

/* The contents of this file are subject to the Vulcan Logic Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.vl-srm.net/vlpl/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is vl-srm.net code.
*
* The Initial Developer of the Original Code is the Vulcan Logic
* Group. Portions created by Vulcan Logic Group are Copyright (C)
* 2000, 2001, 2002 Vulcan Logic Group. All Rights Reserved.
*
* Contributor(s): Sterling Hughes <sterling@php.net>
* Daniel R. Kalowsky <dank@deadmime.org>
*/

#ifndef __SRM_LLIST_H__
#define __SRM_LLIST_H__

#include <stddef.h>

typedef void (*srm_llist_dtor)(void *, void *);

typedef struct _srm_llist_element {
void *ptr;

struct _srm_llist_element *prev;
struct _srm_llist_element *next;
} srm_llist_element;

typedef struct _srm_llist {
srm_llist_element *head;
srm_llist_element *tail;

srm_llist_dtor dtor;

size_t size;
} srm_llist;

srm_llist *srm_llist_alloc(srm_llist_dtor dtor);
int srm_llist_insert_next(srm_llist *l, srm_llist_element *e, const void *p);
int srm_llist_insert_prev(srm_llist *l, srm_llist_element *e, const void *p);
int srm_llist_remove(srm_llist *l, srm_llist_element *e, void *user);
int srm_llist_remove_next(srm_llist *l, srm_llist_element *e, void *user);
srm_llist_element *srm_llist_jump(srm_llist *l, int where, int pos);
size_t srm_llist_count(srm_llist *l);
void srm_llist_destroy(srm_llist *l, void *user);

#if !defined(LIST_HEAD)
#define LIST_HEAD 0
#endif

#if !defined(LIST_TAIL)
#define LIST_TAIL 1
#endif

#define SRM_LLIST_HEAD(__l) ((__l)->head)
#define SRM_LLIST_TAIL(__l) ((__l)->tail)
#define SRM_LLIST_NEXT(__e) ((__e)->next)
#define SRM_LLIST_PREV(__e) ((__e)->prev)
#define SRM_LLIST_VALP(__e) ((__e)->ptr)
#define SRM_LLIST_IS_TAIL(__e) ((__e)->next ? 0 : 1)
#define SRM_LLIST_IS_HEAD(__e) ((__e)->prev ? 0 : 1)

#endif /* __SRM_LLIST_H__ */
Binary file not shown.
@@ -0,0 +1,23 @@
--TEST--
Check for vle presence
--SKIPIF--
<?php if (!extension_loaded("vle")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
echo "vle extension is available";
/*
you can add regression tests for your extension here
the output of your test code has to be equal to the
text in the --EXPECT-- section below for the tests
to pass, differences between the output and the
expected text are interpreted as failure
see php4/tests/README for further information on
writing regression tests
*/
?>
--EXPECT--
vle extension is available
Oops, something went wrong.

0 comments on commit 78749ee

Please sign in to comment.