OSSP CVS Repository

ossp - Check-in [5151]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5151
Date: 2005-Sep-02 00:24:01 (local)
2005-Sep-01 22:24:01 (UTC)
User:rse
Branch:
Comment: Add an experimental PHP 4/5 language API binding which can be enabled under build-time with opption --with-php.
Tickets:
Inspections:
Files:
ossp-pkg/uuid/ChangeLog      1.85 -> 1.86     7 inserted, 0 deleted
ossp-pkg/uuid/Makefile.in      1.32 -> 1.33     26 inserted, 1 deleted
ossp-pkg/uuid/devtool.conf      1.18 -> 1.19     1 inserted, 0 deleted
ossp-pkg/uuid/php/.cvsignore      added-> 1.1
ossp-pkg/uuid/php/Makefile.local      added-> 1.1
ossp-pkg/uuid/php/config.m4      added-> 1.1
ossp-pkg/uuid/php/uuid.c      added-> 1.1
ossp-pkg/uuid/php/uuid.php4      added-> 1.1
ossp-pkg/uuid/php/uuid.php5      added-> 1.1
ossp-pkg/uuid/php/uuid.ts      added-> 1.1
ossp-pkg/uuid/uuid.ac      1.16 -> 1.17     23 inserted, 0 deleted

ossp-pkg/uuid/ChangeLog 1.85 -> 1.86

--- ChangeLog    2005/08/31 19:22:48     1.85
+++ ChangeLog    2005/09/01 22:24:01     1.86
@@ -13,6 +13,13 @@
 
   Changes between 1.2.1 and 1.3.0 (30-Aug-2005 to xx-XXX-2005)
 
+   o Add an experimental PHP 4/5 language API binding which
+     can be enabled under build-time with opption --with-php.
+     [Ralf S. Engelschall]
+   
+   o Upgrade to GNU libtool 1.5.20
+     [Ralf S. Engelschall]
+
    o Add missing "const" in manual page.
      [Ralf S. Engelschall]
 


ossp-pkg/uuid/Makefile.in 1.32 -> 1.33

--- Makefile.in  2005/08/31 20:07:29     1.32
+++ Makefile.in  2005/09/01 22:24:01     1.33
@@ -56,6 +56,7 @@
 TRUE        = true
 POD2MAN     = pod2man
 PERL        = @PERL@
+PHP         = @PHP@
 
 LIB_NAME    = libuuid.la
 LIB_OBJS    = uuid.lo uuid_md5.lo uuid_sha1.lo uuid_prng.lo uuid_mac.lo uuid_ui64.lo uuid_str.lo
@@ -74,12 +75,16 @@
 PERL_NAME   = perl/blib/lib/OSSP/uuid.pm
 PERL_OBJS   = perl/uuid.pm
 
-TARGETS     = $(LIB_NAME) @DCE_NAME@ @CXX_NAME@ $(PRG_NAME) @PERL_NAME@
+PHP_NAME    = php/modules/uuid.so
+PHP_OBJS    = php/uuid.c
+
+TARGETS     = $(LIB_NAME) @DCE_NAME@ @CXX_NAME@ $(PRG_NAME) @PERL_NAME@ @PHP_NAME@
 
 WITH_DCE         = @WITH_DCE@
 WITH_CXX         = @WITH_CXX@
 WITH_PERL        = @WITH_PERL@
 WITH_PERL_COMPAT = @WITH_PERL_COMPAT@
+WITH_PHP         = @WITH_PHP@
 
 .SUFFIXES:
 .SUFFIXES: .c .cc .o .lo
@@ -117,6 +122,10 @@
         @cd perl && $(PERL) Makefile.PL PREFIX=$(prefix) COMPAT=$(WITH_PERL_COMPAT) && $(MAKE) $(MFLAGS) all
         @touch $(PERL_NAME)
 
+$(PHP_NAME): $(PHP_OBJS) $(LIB_NAME)
+        @cd php && $(MAKE) $(MFLAGS) -f Makefile.local PHP=$(PHP)
+        @touch $(PERL_NAME)
+
 uuid.lo: uuid.c config.h uuid.h uuid_md5.h uuid_sha1.h uuid_prng.h uuid_mac.h uuid_ui64.h uuid_str.h uuid_bm.h uuid_ac.h
 uuid_mac.lo: uuid_mac.c config.h uuid_mac.h
 uuid_md5.lo: uuid_md5.c uuid_md5.h
@@ -190,6 +199,10 @@
             echo "==== Perl bindings to C API"; \
             (cd perl && $(MAKE) $(MFLAGS) test); \
         fi
+        -@if [ ".$(WITH_PHP)" = .yes ]; then \
+            echo "==== PHP bindings to C API"; \
+            (cd php && $(MAKE) $(MFLAGS) -f Makefile.local test PHP=$(PHP)); \
+        fi
 
 install:
         $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)
@@ -227,6 +240,9 @@
         -@if [ ".$(WITH_PERL)" = .yes ]; then \
             (cd perl && $(MAKE) $(MFLAGS) install); \
         fi
+        -@if [ ".$(WITH_PHP)" = .yes ]; then \
+            (cd php && $(MAKE) $(MFLAGS) -f Makefile.local install EXTDIR=$(prefix)/lib/php PHP=$(PHP)); \
+        fi
 
 uninstall:
         -$(RM) $(DESTDIR)$(mandir)/man1/uuid.1
@@ -280,6 +296,9 @@
         -@if [ ".$(WITH_PERL)" = .yes ]; then \
             (cd perl && $(MAKE) $(MFLAGS) clean || true); \
         fi
+        -@if [ ".$(WITH_PHP)" = .yes ]; then \
+            (cd php && $(MAKE) $(MFLAGS) -f Makefile.local clean || true); \
+        fi
 
 distclean: clean
         -$(RM) config.log config.status config.cache
@@ -288,10 +307,16 @@
         -@if [ ".$(WITH_PERL)" = .yes ]; then \
             (cd perl && $(MAKE) $(MFLAGS) distclean || true; rm -f Makefile.old); \
         fi
+        -@if [ ".$(WITH_PHP)" = .yes ]; then \
+            (cd php && $(MAKE) $(MFLAGS) -f Makefile.local distclean || true); \
+        fi
 
 realclean: distclean
         -$(RM) uuid.3 uuid.1
         -$(RM) configure config.h.in
         -$(RM) shtool
         -$(RM) ltmain.sh libtool.m4 config.guess config.sub
+        -@if [ ".$(WITH_PHP)" = .yes ]; then \
+            (cd php && $(MAKE) $(MFLAGS) -f Makefile.local realclean || true); \
+        fi
 


ossp-pkg/uuid/devtool.conf 1.18 -> 1.19

--- devtool.conf 2005/09/01 21:43:03     1.18
+++ devtool.conf 2005/09/01 22:24:01     1.19
@@ -20,6 +20,7 @@
         --with-cxx \
         --with-perl \
         --with-perl-compat \
+        --with-php \
         "$@"
 
 %version


ossp-pkg/uuid/php/.cvsignore -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,22 ----
+ .deps
+ Makefile
+ Makefile.fragments
+ Makefile.global
+ Makefile.objects
+ acinclude.m4
+ aclocal.m4
+ autom4te.cache
+ build
+ config.guess
+ config.h
+ config.h.in
+ config.nice
+ config.sub
+ configure
+ configure.in
+ include
+ install-sh
+ ltmain.sh
+ missing
+ mkinstalldirs
+ modules


ossp-pkg/uuid/php/Makefile.local -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,69 ----
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  This file is part of OSSP uuid, a library for the generation
+ ##  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  Makefile.local: PHP/Zend API build procedure (language: make)
+ ##
+ 
+ PHP    = php
+ EXTDIR = `$(PHP)-config --extension-dir`
+ 
+ all: build
+ 
+ config:
+        @if [ ! -f ./configure ]; then $(PHP)ize 2>/dev/null; fi
+        @if [ ! -f ./Makefile ]; then ./configure --with-php-config=$(PHP)-config; fi
+ 
+ build: config
+        @$(MAKE) $(MFLAGS) -f Makefile
+ 
+ test: build
+        @version=`$(PHP)-config --version | sed -e 's;^\([0-9]\).*$$;\1;'`; \
+        $(PHP) -q -d "safe_mode=0" -d "extension_dir=./" uuid.ts $$version
+ 
+ install: build
+        @version=`$(PHP)-config --version | sed -e 's;^\([0-9]\).*$$;\1;'`; extdir="$(EXTDIR)"; \
+        echo "installing PHP$$version API into $$extdir"; \
+        ./build/shtool mkdir -f -p -m 755 $$extdir; \
+        ./build/shtool install -c -m 755 modules/uuid.so $$extdir/uuid.so; \
+        ./build/shtool install -c -m 644 uuid.php$$version $$extdir/uuid.php
+ 
+ clean:
+        @$(MAKE) $(MFLAGS) -f Makefile clean || true
+ 
+ distclean: clean
+        -rm -f Makefile
+        -rm -f config.status configure.lineno
+        -rm -f config.h config.log
+        -rm -f *.core *~
+ 
+ realclean: distclean
+        -rm -rf autom4te.cache build include modules
+        -rm -f Makefile.fragments Makefile.objects Makefile.global
+        -rm -f acinclude.m4 aclocal.m4
+        -rm -f config.guess config.h.in config.nice config.sub
+        -rm -f configure configure.in 
+        -rm -f install-sh libtool ltmain.sh missing mkinstalldirs
+ 


ossp-pkg/uuid/php/config.m4 -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,43 ----
+ dnl
+ dnl  OSSP uuid - Universally Unique Identifier
+ dnl  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ dnl  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ dnl
+ dnl  This file is part of OSSP uuid, a library for the generation
+ dnl  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ dnl
+ dnl  Permission to use, copy, modify, and distribute this software for
+ dnl  any purpose with or without fee is hereby granted, provided that
+ dnl  the above copyright notice and this permission notice appear in all
+ dnl  copies.
+ dnl
+ dnl  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ dnl  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ dnl  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ dnl  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ dnl  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ dnl  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ dnl  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ dnl  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ dnl  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ dnl  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ dnl  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ dnl  SUCH DAMAGE.
+ dnl
+ dnl  config.m4: PHP/Zend API build-time configuration (language: m4)
+ dnl
+ 
+ PHP_ARG_ENABLE(uuid, OSSP uuid module,
+ [  --enable-uuid             Enable OSSP uuid extension module.])
+ 
+ if test "$PHP_UUID" != "no"; then
+     PHP_NEW_EXTENSION(uuid, uuid.c, $ext_shared)
+     AC_DEFINE(HAVE_UUID, 1, [Have OSSP uuid library])
+     PHP_ADD_LIBPATH([..], )
+     PHP_ADD_LIBRARY([uuid],, UUID_SHARED_LIBADD)
+     PHP_ADD_INCLUDE([..])
+     PHP_SUBST(UUID_SHARED_LIBADD)
+     dnl  avoid conflict with libc's uuid_create(3)
+     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-Bsymbolic"
+ fi
+ 


ossp-pkg/uuid/php/uuid.c -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,525 ----
+ /*
+ **  OSSP uuid - Universally Unique Identifier
+ **  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ **
+ **  This file is part of OSSP uuid, a library for the generation
+ **  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  uuid.c: PHP/Zend API (language: C)
+ */
+ 
+ #ifdef HAVE_CONFIG_H
+ #include "config.h"
+ #endif
+ 
+ #include "php.h"
+ #include "uuid.h"
+ #include <stdio.h>
+ 
+ /* context structure */
+ typedef struct {
+     uuid_t *uuid;
+ } ctx_t;
+ 
+ /* context implicit destruction */
+ static void ctx_destructor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+ {
+     ctx_t *ctx = (ctx_t *)rsrc->ptr;
+ 
+     if (ctx != NULL) {
+         if (ctx->uuid != NULL) {
+             uuid_destroy(ctx->uuid);
+             ctx->uuid = NULL;
+         }
+         free(ctx);
+     }
+     return;
+ }
+ 
+ /* context resource identification */
+ static int ctx_id;               /* internal number */
+ #define ctx_name "UUID context"  /* external name   */
+ 
+ /* module initialization */
+ PHP_MINIT_FUNCTION(uuid)
+ {
+     /* register resource identifier */
+     ctx_id = zend_register_list_destructors_ex(
+         ctx_destructor, NULL, ctx_name, module_number);
+ 
+     /* register API constants */
+     REGISTER_LONG_CONSTANT("UUID_VERSION", UUID_VERSION, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_LEN_BIN", UUID_LEN_BIN, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_LEN_STR", UUID_LEN_STR, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_OK",   UUID_RC_OK,   CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_ARG",  UUID_RC_ARG,  CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_MEM",  UUID_RC_MEM,  CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_SYS",  UUID_RC_SYS,  CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_INT",  UUID_RC_INT,  CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_RC_IMP",  UUID_RC_IMP,  CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_MAKE_V1", UUID_MAKE_V1, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_MAKE_V3", UUID_MAKE_V3, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_MAKE_V4", UUID_MAKE_V4, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_MAKE_V5", UUID_MAKE_V5, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_MAKE_MC", UUID_MAKE_MC, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_FMT_BIN", UUID_FMT_BIN, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_FMT_STR", UUID_FMT_STR, CONST_CS|CONST_PERSISTENT);
+     REGISTER_LONG_CONSTANT("UUID_FMT_TXT", UUID_FMT_TXT, CONST_CS|CONST_PERSISTENT);
+ 
+     return SUCCESS;
+ }
+ 
+ /* module shutdown */
+ PHP_MSHUTDOWN_FUNCTION(uuid)
+ {
+     return SUCCESS;
+ }
+ 
+ /* module information */
+ PHP_MINFO_FUNCTION(uuid)
+ {
+     char version[32];
+ 
+     /* provide PHP module information */
+     sprintf(version, "%lx", uuid_version());
+     php_info_print_table_start();
+     php_info_print_table_row(2, "UUID (Universally Unique Identifier) Support", "enabled");
+     php_info_print_table_row(2, "UUID Library Version", version);
+     php_info_print_table_end();
+ 
+     return;
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_create(ctx)
+    $rc = uuid_create(&$uuid);
+    create UUID context */
+ PHP_FUNCTION(uuid_create)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     uuid_rc_t rc;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &z_ctx) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     if (!PZVAL_IS_REF(z_ctx)) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_create: parameter wasn't passed by reference");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((ctx = (ctx_t *)malloc(sizeof(ctx_t))) == NULL)
+         RETURN_LONG((long)UUID_RC_MEM);
+     if ((rc = uuid_create(&ctx->uuid)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_create: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ZEND_REGISTER_RESOURCE(z_ctx, ctx, ctx_id);
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_destroy(ctx)
+    $rc = uuid_destroy($uuid);
+    destroy UUID context */
+ PHP_FUNCTION(uuid_destroy)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     uuid_rc_t rc;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &z_ctx) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_destroy: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((rc = uuid_destroy(ctx->uuid)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_destroy: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ctx->uuid = NULL;
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_clone(ctx, &ctx2)
+    $rc = uuid_clone($uuid, &$uuid);
+    clone UUID context */
+ PHP_FUNCTION(uuid_clone)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     zval *z_clone;
+     ctx_t *clone;
+     uuid_rc_t rc;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &z_ctx, &z_clone) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_clone: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     if (!PZVAL_IS_REF(z_clone)) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_clone: clone parameter wasn't passed by reference");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((clone = (ctx_t *)malloc(sizeof(ctx_t))) == NULL)
+         RETURN_LONG((long)UUID_RC_MEM);
+     if ((rc = uuid_clone(ctx->uuid, &clone->uuid)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_clone: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ZEND_REGISTER_RESOURCE(z_clone, clone, ctx_id);
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_load(ctx, name)
+    $rc = uuid_name($uuid, $name);
+    load an existing UUID */
+ PHP_FUNCTION(uuid_load)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     char *name;
+     size_t name_len;
+     uuid_rc_t rc;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &z_ctx, &name, &name_len) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_load: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((rc = uuid_load(ctx->uuid, name)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_load: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_make(ctx, mode[, ..., ...])
+    $rc = uuid_make($uuid, $mode[, ..., ...]);
+    make a new UUID */
+ PHP_FUNCTION(uuid_make)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     uuid_rc_t rc;
+     long z_mode;
+     unsigned long mode;
+     zval *z_ctx_ns;
+     ctx_t *ctx_ns;
+     char *url;
+     size_t url_len;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|rs", &z_ctx, &z_mode, &z_ctx_ns, &url, &url_len) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     mode = (unsigned long)z_mode;
+ 
+     /* perform operation */
+     if (ZEND_NUM_ARGS() == 2 && ((mode & UUID_MAKE_V1) || (mode & UUID_MAKE_V4))) {
+         if ((rc = uuid_make(ctx->uuid, mode)) != UUID_RC_OK) {
+             php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: %s", uuid_error(rc));
+             RETURN_LONG((long)rc);
+         }
+     }
+     else if (ZEND_NUM_ARGS() == 4 && ((mode & UUID_MAKE_V3) || (mode & UUID_MAKE_V5))) {
+         ZEND_FETCH_RESOURCE(ctx_ns, ctx_t *, &z_ctx_ns, -1, ctx_name, ctx_id);
+         if (ctx_ns == NULL) {
+             php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: invalid namespace context");
+             RETURN_LONG((long)UUID_RC_ARG);
+         }
+         if (url == NULL) {
+             php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: invalid URL");
+             RETURN_LONG((long)UUID_RC_ARG);
+         }
+         if ((rc = uuid_make(ctx->uuid, mode, ctx_ns->uuid, url)) != UUID_RC_OK) {
+             php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: %s", uuid_error(rc));
+             RETURN_LONG((long)rc);
+         }
+     }
+     else {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_make: invalid mode");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_isnil(ctx, result)
+    $rc = uuid_isnil($uuid, &$result);
+    compare UUID for being Nil UUID */
+ PHP_FUNCTION(uuid_isnil)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     uuid_rc_t rc;
+     zval *z_result;
+     int result;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &z_ctx, &z_result) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_isnil: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     if (!PZVAL_IS_REF(z_result)) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_isnil: result parameter wasn't passed by reference");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((rc = uuid_isnil(ctx->uuid, &result)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_isnil: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ZVAL_LONG(z_result, (long)result);
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_compare(ctx, ctx2, result)
+    $rc = uuid_compare($uuid, $uuid2, &$result);
+    compare two UUIDs */
+ PHP_FUNCTION(uuid_compare)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     zval *z_ctx2;
+     ctx_t *ctx2;
+     uuid_rc_t rc;
+     zval *z_result;
+     int result;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrz", &z_ctx, &z_ctx2, &z_result) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_compare: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     ZEND_FETCH_RESOURCE(ctx2, ctx_t *, &z_ctx2, -1, ctx_name, ctx_id);
+     if (ctx2 == NULL || ctx2->uuid) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_compare: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     if (!PZVAL_IS_REF(z_result)) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_compare: result parameter wasn't passed by reference");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     if ((rc = uuid_compare(ctx->uuid, ctx2->uuid, &result)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_compare: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ZVAL_LONG(z_result, (long)result);
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_import(ctx, fmt, data)
+    $rc = uuid_import($ctx, $fmt, $data);
+    import UUID from variable */
+ PHP_FUNCTION(uuid_import)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     long z_fmt;
+     unsigned long fmt;
+     zval *z_data;
+     uuid_rc_t rc;
+     void *data_ptr;
+     size_t data_len;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &z_ctx, &z_fmt, &data_ptr, &data_len) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_import: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     fmt = (unsigned long)z_fmt;
+ 
+     /* perform operation */
+     if ((rc = uuid_import(ctx->uuid, fmt, data_ptr, data_len)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_import: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_export(ctx, fmt, data)
+    $rc = uuid_error($ctx, $fmt, &$data);
+    export UUID into variable */
+ PHP_FUNCTION(uuid_export)
+ {
+     zval *z_ctx;
+     ctx_t *ctx;
+     long z_fmt;
+     unsigned long fmt;
+     zval *z_data;
+     uuid_rc_t rc;
+     void *data_ptr;
+     size_t data_len;
+ 
+     /* parse parameters */
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlz", &z_ctx, &z_fmt, &z_data) == FAILURE)
+         RETURN_LONG((long)UUID_RC_ARG);
+ 
+     /* post-process and sanity check parameters */
+     ZEND_FETCH_RESOURCE(ctx, ctx_t *, &z_ctx, -1, ctx_name, ctx_id);
+     if (ctx == NULL || ctx->uuid == NULL) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_export: invalid context");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+     fmt = (unsigned long)z_fmt;
+     if (!PZVAL_IS_REF(z_data)) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_export: data parameter wasn't passed by reference");
+         RETURN_LONG((long)UUID_RC_ARG);
+     }
+ 
+     /* perform operation */
+     data_ptr = NULL;
+     data_len = 0;
+     if ((rc = uuid_export(ctx->uuid, fmt, &data_ptr, &data_len)) != UUID_RC_OK) {
+         php_error_docref(NULL TSRMLS_CC, E_WARNING, "uuid_export: %s", uuid_error(rc));
+         RETURN_LONG((long)rc);
+     }
+     ZVAL_STRINGL(z_data, data_ptr, data_len, 1);
+     free(data_ptr);
+ 
+     RETURN_LONG((long)rc);
+ }
+ 
+ /* API FUNCTION:
+    proto rc uuid_error(ctx)
+    $error = uuid_error($rc);
+    return error string corresponding to error return code */
+ PHP_FUNCTION(uuid_error)
+ {
+     int z_rc;
+     uuid_rc_t rc;
+     char *error;
+ 
+     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &z_rc) == FAILURE)
+         RETURN_NULL();
+     rc = (uuid_rc_t)z_rc;
+     if ((error = uuid_error(rc)) == NULL)
+         RETURN_NULL();
+     RETURN_STRING(error, 1);
+ }
+ 
+ /* API FUNCTION:
+    proto int uuid_version()
+    $version = uuid_version();
+    return library version number */
+ PHP_FUNCTION(uuid_version)
+ {
+     RETURN_LONG((long)uuid_version());
+ }
+ 
+ /* module function table */
+ static function_entry uuid_functions[] = {
+     PHP_FE(uuid_create,  third_arg_force_ref)
+     PHP_FE(uuid_destroy, NULL)
+     PHP_FE(uuid_clone,   NULL)
+     PHP_FE(uuid_load,    NULL)
+     PHP_FE(uuid_make,    NULL)
+     PHP_FE(uuid_isnil,   NULL)
+     PHP_FE(uuid_compare, NULL)
+     PHP_FE(uuid_import,  NULL)
+     PHP_FE(uuid_export,  NULL)
+     PHP_FE(uuid_error,   NULL)
+     PHP_FE(uuid_version, NULL)
+     { NULL, NULL, NULL }
+ };
+ 
+ /* module entry table */
+ zend_module_entry uuid_module_entry = {
+     STANDARD_MODULE_HEADER,
+     "uuid",
+     uuid_functions,
+     PHP_MINIT(uuid),
+     PHP_MSHUTDOWN(uuid),
+     NULL,
+     NULL,
+     PHP_MINFO(uuid),
+     NO_VERSION_YET,
+     STANDARD_MODULE_PROPERTIES
+ };
+ 
+ #ifdef COMPILE_DL_UUID
+ ZEND_GET_MODULE(uuid)
+ #endif
+ 


ossp-pkg/uuid/php/uuid.php4 -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,78 ----
+ <?php
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  This file is part of OSSP uuid, a library for the generation
+ ##  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  uuid.php: PHP/Zend API (language: php 4.x)
+ ##
+ 
+ class UUID {
+     var $uuid = null;
+     function UUID() {
+         uuid_create(&$this->uuid);
+     }
+     function clone() {
+         $clone = new UUID;
+         uuid_clone($this->uuid, &$clone->uuid);
+         return $clone;
+     }
+     function load($name) {
+         uuid_load($this->uuid, $name);
+     }
+     function make($fmt, $ns = null, $url = null) {
+         if (func_num_args() == 3) {
+             uuid_make($this->uuid, $fmt, $ns->uuid, $url);
+         }
+         else {
+             uuid_make($this->uuid, $fmt);
+         }
+     }
+     function isnil() {
+         $result = 0;
+         uuid_isnil($this->uuid, &$result);
+         return $result;
+     }
+     function compare($other) {
+         $result = 0;
+         uuid_compare($this->uuid, $other->uuid, &$result);
+         return $result;
+     }
+     function import($fmt, $data) {
+         uuid_import($this->uuid, $fmt, $data);
+     }
+     function export($fmt) {
+         $data = "";
+         uuid_export($this->uuid, $fmt, &$data);
+         return $data;
+     }
+     function error($rc) {
+         return uuid_error($this->uuid, $rc);
+     }
+     function version() {
+         return uuid_version();
+     }
+ }
+ 
+ ?>


ossp-pkg/uuid/php/uuid.php5 -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,81 ----
+ <?php
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  This file is part of OSSP uuid, a library for the generation
+ ##  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  uuid.php: PHP/Zend API (language: php 5.x)
+ ##
+ 
+ class UUID {
+     private $uuid = null;
+     public function __construct() {
+         uuid_create(&$this->uuid);
+     }
+     public function __destruct() {
+         uuid_destroy($this->uuid);
+     }
+     public function __clone() {
+         $uuid = null;
+         uuid_clone($this->uuid, &$uuid);
+         $this->uuid = $uuid;
+     }
+     public function load($name) {
+         uuid_load($this->uuid, $name);
+     }
+     public function make($fmt, $ns = null, $url = null) {
+         if (func_num_args() == 3) {
+             uuid_make($this->uuid, $fmt, $ns->uuid, $url);
+         }
+         else {
+             uuid_make($this->uuid, $fmt);
+         }
+     }
+     public function isnil() {
+         $result = 0;
+         uuid_isnil($this->uuid, &$result);
+         return $result;
+     }
+     public function compare($other) {
+         $result = 0;
+         uuid_compare($this->uuid, $other->uuid, &$result);
+         return $result;
+     }
+     public function import($fmt, $data) {
+         uuid_import($this->uuid, $fmt, $data);
+     }
+     public function export($fmt) {
+         $data = "";
+         uuid_export($this->uuid, $fmt, &$data);
+         return $data;
+     }
+     public function error($rc) {
+         return uuid_error($this->uuid, $rc);
+     }
+     public function version() {
+         return uuid_version();
+     }
+ }
+ 
+ ?>


ossp-pkg/uuid/php/uuid.ts -> 1.1

*** /dev/null    Fri Nov 22 15:39:07 2024
--- -    Fri Nov 22 15:39:12 2024
***************
*** 0 ****
--- 1,161 ----
+ <?php
+ ##
+ ##  OSSP uuid - Universally Unique Identifier
+ ##  Copyright (c) 2004-2005 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2004-2005 The OSSP Project <http://www.ossp.org/>
+ ##
+ ##  This file is part of OSSP uuid, a library for the generation
+ ##  of UUIDs which can found at http://www.ossp.org/pkg/lib/uuid/
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  uuid.ts: PHP/Zend API test procedure (language: php)
+ ##
+ 
+ ##
+ ##  INITIALIZATION
+ ##
+ 
+ $php_version = $argv[1];
+ 
+ print "++ loading DSO uuid.so (low-level API)\n";
+ if (!extension_loaded('uuid')) {
+     dl('modules/uuid.so');
+ }
+ 
+ print "++ loading PHP uuid.php${php_version} (high-level API)\n";
+ require "uuid.php${php_version}";
+ 
+ print "++ establishing assertion environment\n";
+ assert_options(ASSERT_ACTIVE, 1);
+ assert_options(ASSERT_WARNING, 0);
+ assert_options(ASSERT_QUIET_EVAL, 1);
+ function my_assert_handler($file, $line, $code)
+ {
+     echo "ASSERTION FAILED: $file: $line: $code\n";
+     exit(1);
+ }
+ assert_options(ASSERT_CALLBACK, 'my_assert_handler');
+ 
+ ##
+ ##  LOW-LEVEL API TESTING
+ ##
+ 
+ print "++ testing low-level C-style API:\n";
+ 
+ $uuid = 42;
+ $rc = uuid_create(&$uuid);
+ assert('$rc == 0');
+ assert('$uuid != 42');
+ 
+ $rc = uuid_make($uuid, UUID_MAKE_V1);
+ assert('$rc == 0');
+ 
+ $str = "foo";
+ $rc = uuid_export($uuid, UUID_FMT_STR, &$str);
+ assert('$rc == 0');
+ assert('$str != "foo"');
+ print "UUID: $str\n";
+ 
+ $uuid_ns = 42;
+ $rc = uuid_create(&$uuid_ns);
+ assert('$rc == 0');
+ 
+ $rc = uuid_load($uuid_ns, "ns:URL");
+ assert('$rc == 0');
+ 
+ $rc = uuid_make($uuid, UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
+ assert('$rc == 0');
+ 
+ $str = "bar";
+ $rc = uuid_export($uuid, UUID_FMT_STR, &$str);
+ assert('$rc == 0');
+ assert('$str != "bar"');
+ #assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
+ print "UUID: $str\n";
+ 
+ $rc = uuid_destroy($uuid);
+ assert('$rc == 0');
+ 
+ $rc = uuid_create(&$uuid);
+ assert('$rc == 0');
+ 
+ $rc = uuid_import($uuid, UUID_FMT_STR, $str);
+ assert('$rc == 0');
+ 
+ $str = "baz";
+ $rc = uuid_export($uuid, UUID_FMT_STR, &$str);
+ assert('$rc == 0');
+ assert('$str != "baz"');
+ #assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
+ print "UUID: $str\n";
+ 
+ $clone = null;
+ $rc = uuid_clone($uuid, &$clone);
+ assert('$rc == 0');
+ assert('$clone != null');
+ 
+ $rc = uuid_destroy($uuid);
+ assert('$rc == 0');
+ 
+ $str = "quux";
+ $rc = uuid_export($clone, UUID_FMT_STR, &$str);
+ assert('$rc == 0');
+ assert('$str != "quux"');
+ #assert('$str == "02d9e6d5-9467-382e-8f9b-9300a64ac3cd"');
+ print "UUID: $str\n";
+ 
+ ##
+ ##  HIGH-LEVEL API TESTING
+ ##
+ 
+ print "++ testing high-level OO-style API:\n";
+ 
+ $uuid = new UUID;
+ $uuid->make(UUID_MAKE_V1);
+ $str = $uuid->export(UUID_FMT_STR);
+ print "UUID: $str\n";
+ 
+ $uuid_ns = new UUID;
+ $uuid_ns->load("ns:URL");
+ $uuid->make(UUID_MAKE_V3, $uuid_ns, "http://www.ossp.org/");
+ $str = $uuid->export(UUID_FMT_STR);
+ print "UUID: $str\n";
+ $uuid = null;
+ $uuid_ns = null;
+ 
+ $uuid = new UUID;
+ $uuid->import(UUID_FMT_STR, $str);
+ $str = $uuid->export(UUID_FMT_STR);
+ print "UUID: $str\n";
+ 
+ if ($php_version == 4) {
+     eval('$clone = $uuid->clone();');
+ }
+ else {
+     eval('$clone = clone $uuid;');
+ }
+ $uuid = null;
+ 
+ $str = $clone->export(UUID_FMT_STR);
+ print "UUID: $str\n";
+ 
+ $clone = null;
+ 
+ ?>


ossp-pkg/uuid/uuid.ac 1.16 -> 1.17

--- uuid.ac      2005/08/31 14:29:56     1.16
+++ uuid.ac      2005/09/01 22:24:01     1.17
@@ -133,5 +133,28 @@
     if test ".$ac_cv_with_perl" = ".yes" -a ".$PERL" = ".NA"; then
         AC_ERROR([required Perl interpreter not found in \$PATH])
     fi
+    
+    dnl #   configure option --with-php
+    AC_ARG_WITH([php],
+        AS_HELP_STRING([--with-php], [build PHP bindings to C API]),
+        [ac_cv_with_php=$withval], [ac_cv_with_php=no])
+    AC_CACHE_CHECK([whether to build PHP bindings to C API], [ac_cv_with_php], [ac_cv_with_php=no])
+    if test ".$ac_cv_with_php" = ".yes"; then
+        AC_DEFINE(WITH_PHP, 1, [whether to build PHP bindings to C API])
+        WITH_PHP='yes'
+        PHP_NAME='$(PHP_NAME)'
+    else
+        WITH_PHP='no'
+        PHP_NAME=''
+    fi
+    AC_SUBST(PHP_NAME)
+    AC_SUBST(WITH_PHP)
+    AC_PATH_PROG(PHP, php5 php, NA)
+    if test ".$ac_cv_with_php" = ".yes" -a ".$PHP" = ".NA"; then
+        AC_ERROR([required PHP interpreter not found in \$PATH])
+    fi
+    if test ".$ac_cv_with_php" = ".yes"; then
+        (cd php && make -f Makefile.local config PHP=$PHP)
+    fi
 ])
 

CVSTrac 2.0.1