CVS update: php3/functions

From: Date: Tue, 09 Mar 1999 17:49:56 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-4548@lists.php.net to get a copy of this message
Date: Tuesday March 9, 1999 @ 12:49 Author: rasmus Update of /repository/php3/functions In directory asf:/home/rasmus/php3/functions Modified Files: DList.h dlist.c hg_comm.c wddx_a.c Log Message: Eliminate symbol conflicts here Index: php3/functions/DList.h diff -c php3/functions/DList.h:1.2 php3/functions/DList.h:1.3 *** php3/functions/DList.h:1.2 Fri Aug 14 11:51:12 1998 --- php3/functions/DList.h Tue Mar 9 12:49:55 1999 *************** *** 4,22 **** * All rights reserved. * * Filename: $RCSfile: DList.h,v $ ! * Version: $Revision: 1.2 $ * * Language: ANSI C * Environment: any * * Description: Header file for doubly linked list routines. * ! * $Id: DList.h,v 1.2 1998/08/14 15:51:12 shane Exp $ * * Revision History: * ----------------- * * $Log: DList.h,v $ * Revision 1.2 1998/08/14 15:51:12 shane * Some work on getting hyperwave to work on windows. hg_comm needs a lot of work. * --- 4,25 ---- * All rights reserved. * * Filename: $RCSfile: DList.h,v $ ! * Version: $Revision: 1.3 $ * * Language: ANSI C * Environment: any * * Description: Header file for doubly linked list routines. * ! * $Id: DList.h,v 1.3 1999/03/09 17:49:55 rasmus Exp $ * * Revision History: * ----------------- * * $Log: DList.h,v $ + * Revision 1.3 1999/03/09 17:49:55 rasmus + * Eliminate symbol conflicts here + * * Revision 1.2 1998/08/14 15:51:12 shane * Some work on getting hyperwave to work on windows. hg_comm needs a lot of work. * *************** *** 37,43 **** * Took out extern references * * Revision 1.2 91/09/01 19:37:20 ROOT_DOS ! * Changed DLST_TAIL macro so that it returns a pointer to the REAL last * node of the list, not the dummy last node (l->z). * * Revision 1.1 91/09/01 18:38:23 ROOT_DOS --- 40,46 ---- * Took out extern references * * Revision 1.2 91/09/01 19:37:20 ROOT_DOS ! * Changed PHP_DLST_TAIL macro so that it returns a pointer to the REAL last * node of the list, not the dummy last node (l->z). * * Revision 1.1 91/09/01 18:38:23 ROOT_DOS *************** *** 54,98 **** /*---------------------- Macros and type definitions ----------------------*/ ! typedef struct DLST_BUCKET { ! struct DLST_BUCKET *next; ! struct DLST_BUCKET *prev; ! } DLST_BUCKET; typedef struct { int count; /* Number of elements currently in list */ ! DLST_BUCKET *head; /* Pointer to head element of list */ ! DLST_BUCKET *z; /* Pointer to last node of list */ ! DLST_BUCKET hz[2]; /* Space for head and z nodes */ } DLIST; /* Return a pointer to the user space given the address of the header of * a node. */ ! #define DLST_USERSPACE(h) ((void*)((DLST_BUCKET*)(h) + 1)) /* Return a pointer to the header of a node, given the address of the * user space. */ ! #define DLST_HEADER(n) ((DLST_BUCKET*)(n) - 1) /* Return a pointer to the user space of the list's head node. This user * space does not actually exist, but it is useful to be able to address * it to enable insertion at the start of the list. */ ! #define DLST_HEAD(l) DLST_USERSPACE((l)->head) /* Return a pointer to the user space of the last node in list. */ ! #define DLST_TAIL(l) DLST_USERSPACE((l)->z->prev) /* Determine if a list is empty */ ! #define DLST_EMPTY(l) ((l)->count == 0) /*-------------------------- Function Prototypes --------------------------*/ --- 57,101 ---- /*---------------------- Macros and type definitions ----------------------*/ ! typedef struct PHP_DLST_BUCKET { ! struct PHP_DLST_BUCKET *next; ! struct PHP_DLST_BUCKET *prev; ! } PHP_DLST_BUCKET; typedef struct { int count; /* Number of elements currently in list */ ! PHP_DLST_BUCKET *head; /* Pointer to head element of list */ ! PHP_DLST_BUCKET *z; /* Pointer to last node of list */ ! PHP_DLST_BUCKET hz[2]; /* Space for head and z nodes */ } DLIST; /* Return a pointer to the user space given the address of the header of * a node. */ ! #define PHP_DLST_USERSPACE(h) ((void*)((PHP_DLST_BUCKET*)(h) + 1)) /* Return a pointer to the header of a node, given the address of the * user space. */ ! #define PHP_DLST_HEADER(n) ((PHP_DLST_BUCKET*)(n) - 1) /* Return a pointer to the user space of the list's head node. This user * space does not actually exist, but it is useful to be able to address * it to enable insertion at the start of the list. */ ! #define PHP_DLST_HEAD(l) PHP_DLST_USERSPACE((l)->head) /* Return a pointer to the user space of the last node in list. */ ! #define PHP_DLST_TAIL(l) PHP_DLST_USERSPACE((l)->z->prev) /* Determine if a list is empty */ ! #define PHP_DLST_EMPTY(l) ((l)->count == 0) /*-------------------------- Function Prototypes --------------------------*/ Index: php3/functions/dlist.c diff -c php3/functions/dlist.c:1.2 php3/functions/dlist.c:1.3 *** php3/functions/dlist.c:1.2 Tue Feb 2 00:44:12 1999 --- php3/functions/dlist.c Tue Mar 9 12:49:55 1999 *************** *** 4,10 **** * All rights reserved. * * Filename: $RCSfile: dlist.c,v $ ! * Version: $Revision: 1.2 $ * * Language: ANSI C * Environment: any --- 4,10 ---- * All rights reserved. * * Filename: $RCSfile: dlist.c,v $ ! * Version: $Revision: 1.3 $ * * Language: ANSI C * Environment: any *************** *** 12,23 **** * Description: Module to implement doubly linked lists. Includes a routine * to peform a mergesort on the doubly linked list. * ! * $Id: dlist.c,v 1.2 1999/02/02 05:44:12 andrey Exp $ * * Revision History: * ----------------- * * $Log: dlist.c,v $ * Revision 1.2 1999/02/02 05:44:12 andrey * Initial check-in of my WDDX module and the documentation for it. * --- 12,26 ---- * Description: Module to implement doubly linked lists. Includes a routine * to peform a mergesort on the doubly linked list. * ! * $Id: dlist.c,v 1.3 1999/03/09 17:49:55 rasmus Exp $ * * Revision History: * ----------------- * * $Log: dlist.c,v $ + * Revision 1.3 1999/03/09 17:49:55 rasmus + * Eliminate symbol conflicts here + * * Revision 1.2 1999/02/02 05:44:12 andrey * Initial check-in of my WDDX module and the documentation for it. * *************** *** 67,81 **** * ****************************************************************************/ { ! DLST_BUCKET *node; ! if ( !(node = (DLST_BUCKET*)malloc(size + sizeof(DLST_BUCKET))) ) { fprintf(stderr,"Not enough memory to allocate list node.\n"); /* raise(SIGABRT);*/ return NULL; } ! return DLST_USERSPACE(node); /* Return pointer to user space */ } PUBLIC void dlst_freenode(void *node) --- 70,84 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *node; ! if ( !(node = (PHP_DLST_BUCKET*)malloc(size + sizeof(PHP_DLST_BUCKET))) ) { fprintf(stderr,"Not enough memory to allocate list node.\n"); /* raise(SIGABRT);*/ return NULL; } ! return PHP_DLST_USERSPACE(node); /* Return pointer to user space */ } PUBLIC void dlst_freenode(void *node) *************** *** 88,94 **** * ****************************************************************************/ { ! free(DLST_HEADER(node)); } PUBLIC DLIST *dlst_init(void) --- 91,97 ---- * ****************************************************************************/ { ! free(PHP_DLST_HEADER(node)); } PUBLIC DLIST *dlst_init(void) *************** *** 139,151 **** * ****************************************************************************/ { ! DLST_BUCKET *n,*p; n = l->head->next; while (n != l->z) { /* Free all nodes in list */ p = n; n = n->next; ! (*freeNode)(DLST_USERSPACE(p)); } free(l); /* Free the list itself */ } --- 142,154 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n,*p; n = l->head->next; while (n != l->z) { /* Free all nodes in list */ p = n; n = n->next; ! (*freeNode)(PHP_DLST_USERSPACE(p)); } free(l); /* Free the list itself */ } *************** *** 160,172 **** * * Description: Inserts a new node into the list after the node 'after'. To * insert a new node at the beginning of the list, user the ! * macro DLST_HEAD in place of 'after'. ie: * ! * dlst_insertafter(mylist,node,DLST_HEAD(mylist)); * ****************************************************************************/ { ! DLST_BUCKET *n = DLST_HEADER(node),*a = DLST_HEADER(after); n->next = a->next; a->next = n; --- 163,175 ---- * * Description: Inserts a new node into the list after the node 'after'. To * insert a new node at the beginning of the list, user the ! * macro PHP_DLST_HEAD in place of 'after'. ie: * ! * dlst_insertafter(mylist,node,PHP_DLST_HEAD(mylist)); * ****************************************************************************/ { ! PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node),*a = PHP_DLST_HEADER(after); n->next = a->next; a->next = n; *************** *** 187,195 **** * ****************************************************************************/ { ! DLST_BUCKET *n = DLST_HEADER(node); ! node = DLST_USERSPACE(n->next); n->next->next->prev = n; n->next = n->next->next; l->count--; --- 190,198 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n = PHP_DLST_HEADER(node); ! node = PHP_DLST_USERSPACE(n->next); n->next->next->prev = n; n->next = n->next->next; l->count--; *************** *** 208,217 **** * ****************************************************************************/ { ! DLST_BUCKET *n; n = l->head->next; ! return (n == l->z ? NULL : DLST_USERSPACE(n)); } PUBLIC void *dlst_last(DLIST *l) --- 211,220 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n; n = l->head->next; ! return (n == l->z ? NULL : PHP_DLST_USERSPACE(n)); } PUBLIC void *dlst_last(DLIST *l) *************** *** 226,235 **** * ****************************************************************************/ { ! DLST_BUCKET *n; n = l->z->prev; ! return (n == l->head ? NULL : DLST_USERSPACE(n)); } PUBLIC void *dlst_next(void *prev) --- 229,238 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n; n = l->z->prev; ! return (n == l->head ? NULL : PHP_DLST_USERSPACE(n)); } PUBLIC void *dlst_next(void *prev) *************** *** 252,261 **** * ****************************************************************************/ { ! DLST_BUCKET *n = DLST_HEADER(prev); n = n->next; ! return (n == n->next ? NULL : DLST_USERSPACE(n)); } PUBLIC void *dlst_prev(void *next) --- 255,264 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n = PHP_DLST_HEADER(prev); n = n->next; ! return (n == n->next ? NULL : PHP_DLST_USERSPACE(n)); } PUBLIC void *dlst_prev(void *next) *************** *** 278,295 **** * ****************************************************************************/ { ! DLST_BUCKET *n = DLST_HEADER(next); n = n->prev; ! return (n == n->prev ? NULL : DLST_USERSPACE(n)); } /* Static globals required by merge() */ ! static DLST_BUCKET *z; static int (*cmp)(void*,void*); ! PRIVATE DLST_BUCKET *merge(DLST_BUCKET *a,DLST_BUCKET *b,DLST_BUCKET **end) /**************************************************************************** * * Function: merge --- 281,298 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *n = PHP_DLST_HEADER(next); n = n->prev; ! return (n == n->prev ? NULL : PHP_DLST_USERSPACE(n)); } /* Static globals required by merge() */ ! static PHP_DLST_BUCKET *z; static int (*cmp)(void*,void*); ! PRIVATE PHP_DLST_BUCKET *merge(PHP_DLST_BUCKET *a,PHP_DLST_BUCKET *b,PHP_DLST_BUCKET **end) /**************************************************************************** * * Function: merge *************** *** 301,313 **** * ****************************************************************************/ { ! DLST_BUCKET *c; /* Go through the lists, merging them together in sorted order */ c = z; while (a != z && b != z) { ! if ((*cmp)(DLST_USERSPACE(a),DLST_USERSPACE(b)) <= 0) { c->next = a; c = a; a = a->next; } else { --- 304,316 ---- * ****************************************************************************/ { ! PHP_DLST_BUCKET *c; /* Go through the lists, merging them together in sorted order */ c = z; while (a != z && b != z) { ! if ((*cmp)(PHP_DLST_USERSPACE(a),PHP_DLST_USERSPACE(b)) <= 0) { c->next = a; c = a; a = a->next; } else { *************** *** 353,363 **** ****************************************************************************/ { int i,N; ! DLST_BUCKET *a,*b; /* Pointers to sublists to merge */ ! DLST_BUCKET *c; /* Pointer to end of sorted sublists */ ! DLST_BUCKET *head; /* Pointer to dummy head node for list */ ! DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */ ! DLST_BUCKET *t; /* Temporary */ /* Set up globals required by merge() and pointer to head */ --- 356,366 ---- ****************************************************************************/ { int i,N; ! PHP_DLST_BUCKET *a,*b; /* Pointers to sublists to merge */ ! PHP_DLST_BUCKET *c; /* Pointer to end of sorted sublists */ ! PHP_DLST_BUCKET *head; /* Pointer to dummy head node for list */ ! PHP_DLST_BUCKET *todo; /* Pointer to sublists yet to be sorted */ ! PHP_DLST_BUCKET *t; /* Temporary */ /* Set up globals required by merge() and pointer to head */ Index: php3/functions/hg_comm.c diff -c php3/functions/hg_comm.c:1.13 php3/functions/hg_comm.c:1.14 *** php3/functions/hg_comm.c:1.13 Thu Jan 14 12:47:50 1999 --- php3/functions/hg_comm.c Tue Mar 9 12:49:55 1999 *************** *** 23,29 **** +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.13 1999/01/14 17:47:50 steinm Exp $ */ /* #define HW_DEBUG */ --- 23,29 ---- +----------------------------------------------------------------------+ */ ! /* $Id: hg_comm.c,v 1.14 1999/03/09 17:49:55 rasmus Exp $ */ /* #define HW_DEBUG */ *************** *** 164,170 **** cur_ptr->keyword = NULL; cur_ptr->fragment = NULL; ! dlst_insertafter(pAnchorList, cur_ptr, DLST_HEAD(pAnchorList)); return(cur_ptr); } --- 164,170 ---- cur_ptr->keyword = NULL; cur_ptr->fragment = NULL; ! dlst_insertafter(pAnchorList, cur_ptr, PHP_DLST_HEAD(pAnchorList)); return(cur_ptr); } Index: php3/functions/wddx_a.c diff -c php3/functions/wddx_a.c:1.3 php3/functions/wddx_a.c:1.4 *** php3/functions/wddx_a.c:1.3 Sun Feb 7 11:37:42 1999 --- php3/functions/wddx_a.c Tue Mar 9 12:49:56 1999 *************** *** 27,42 **** +----------------------------------------------------------------------+ */ ! /* $Id: wddx_a.c,v 1.3 1999/02/07 16:37:42 rasmus Exp $ */ #include "php.h" #include "internal_functions.h" #include "php3_string.h" #include "php3_list.h" #include "php3_wddx_a.h" - #include "DList.h" #if HAVE_LIBEXPAT #define WDDX_PACKET_S "<wddxPacket version='0.9'>" #define WDDX_PACKET_E "</wddxPacket>" --- 27,42 ---- +----------------------------------------------------------------------+ */ ! /* $Id: wddx_a.c,v 1.4 1999/03/09 17:49:56 rasmus Exp $ */ #include "php.h" #include "internal_functions.h" #include "php3_string.h" #include "php3_list.h" #include "php3_wddx_a.h" #if HAVE_LIBEXPAT + #include "DList.h" #define WDDX_PACKET_S "<wddxPacket version='0.9'>" #define WDDX_PACKET_E "</wddxPacket>" *************** *** 234,240 **** chunk_ptr = (char**)dlst_newnode(sizeof(char *)); (*chunk_ptr) = estrdup(str); ! dlst_insertafter(packet->packet_head, chunk_ptr, DLST_TAIL(packet->packet_head)); packet->packet_length += strlen(str); } /* }}} */ --- 234,240 ---- chunk_ptr = (char**)dlst_newnode(sizeof(char *)); (*chunk_ptr) = estrdup(str); ! dlst_insertafter(packet->packet_head, chunk_ptr, PHP_DLST_TAIL(packet->packet_head)); packet->packet_length += strlen(str); } /* }}} */ -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4548) next »