cvs: pecl /uuid .cvsignore CREDITS EXPERIMENTAL LICENSE README config.m4 package.xml package2.xml php_uuid.h uuid.c uuid.xml /uuid/manual Makefile
file-entities.ent functions.xml manual.xml.in /uuid/manual/en/reference/uuid configure.xml reference.xml /uuid/manual/en/reference/uuid/functions
uuid-compare.xml uuid-create.xml uuid-is-null.xml uuid-is-valid.xml uuid-mac.xml uuid-time.xml uuid-type.xml uuid-variant.xml /uuid/manual/uuid
configure.xml constants.xml ini.xml reference.xml /uuid/manual/uuid/functions uuid-compare.xml uuid-create.xml uuid-is-null.xml uuid-is-valid.xml
uuid-mac.xml uuid-parse.xml uuid-time.xml uuid-type.xml uuid-unparse.xml uuid-variant.xml /uuid/tests uuid_compare.phpt uuid_create.phpt
uuid_is_null.phpt uuid_is_valid.phpt uuid_mac.phpt uuid_parse.phpt uuid_time.phpt uuid_type.phpt uuid_unparse.phpt uuid_variant.phpt
| From: | Hartmut Holzgraefe | Date: | Thu, 27 Mar 2008 22:10:00 +0000 |
| Subject: | cvs: pecl /uuid .cvsignore CREDITS EXPERIMENTAL LICENSE README config.m4 package.xml package2.xml php_uuid.h uuid.c uuid.xml /uuid/manual Makefile file-entities.ent functions.xml manual.xml.in /uuid/manual/en/reference/uuid configure.xml reference.xml /uuid/manual/en/reference/uuid/functions uuid-compare.xml uuid-create.xml uuid-is-null.xml uuid-is-valid.xml uuid-mac.xml uuid-time.xml uuid-type.xml uuid-variant.xml /uuid/manual/uuid configure.xml constants.xml ini.xml reference.xml /uuid/manual/uuid/functions uuid-compare.xml uuid-create.xml uuid-is-null.xml uuid-is-valid.xml uuid-mac.xml uuid-parse.xml uuid-time.xml uuid-type.xml uuid-unparse.xml uuid-variant.xml /uuid/tests uuid_compare.phpt uuid_create.phpt uuid_is_null.phpt uuid_is_valid.phpt uuid_mac.phpt uuid_parse.phpt uuid_time.phpt uuid_type.phpt uuid_unparse.phpt uuid_variant.phpt |
||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-10091@lists.php.net to get a copy of this message | ||
hholzgra Thu Mar 27 22:10:00 2008 UTC
Added files:
/pecl/uuid LICENSE README package2.xml
/pecl/uuid/manual Makefile file-entities.ent functions.xml
manual.xml.in
/pecl/uuid/manual/uuid configure.xml constants.xml ini.xml
reference.xml
/pecl/uuid/manual/uuid/functions uuid-compare.xml uuid-create.xml
uuid-is-null.xml uuid-is-valid.xml
uuid-mac.xml uuid-parse.xml
uuid-time.xml uuid-type.xml
uuid-unparse.xml uuid-variant.xml
/pecl/uuid/tests uuid_parse.phpt uuid_unparse.phpt
Removed files:
/pecl/uuid/manual/en/reference/uuid configure.xml reference.xml
/pecl/uuid/manual/en/reference/uuid/functions uuid-compare.xml
uuid-create.xml
uuid-is-null.xml
uuid-is-valid.xml
uuid-mac.xml
uuid-time.xml
uuid-type.xml
uuid-variant.xml
Modified files:
/pecl/uuid EXPERIMENTAL .cvsignore CREDITS config.m4 package.xml
php_uuid.h uuid.c uuid.xml
/pecl/uuid/tests uuid_compare.phpt uuid_create.phpt
uuid_is_null.phpt uuid_is_valid.phpt uuid_mac.phpt
uuid_time.phpt uuid_type.phpt uuid_variant.phpt
Log:
changed to pecl-gen generated code after BRANCH_UUID_1_0 branchoff
http://cvs.php.net/viewvc.cgi/pecl/uuid/EXPERIMENTAL?r1=1.2&r2=1.3&diff_format=u Index: pecl/uuid/EXPERIMENTAL diff -u /dev/null pecl/uuid/EXPERIMENTAL:1.3 --- /dev/null Thu Mar 27 22:10:00 2008 +++ pecl/uuid/EXPERIMENTAL Thu Mar 27 22:09:59 2008 @@ -0,0 +1,5 @@ +this extension is experimental, +its functions may change their names +or move to extension all together +so do not rely to much on them +you have been warned! http://cvs.php.net/viewvc.cgi/pecl/uuid/.cvsignore?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/.cvsignore diff -u pecl/uuid/.cvsignore:1.1 pecl/uuid/.cvsignore:1.2 --- pecl/uuid/.cvsignore:1.1 Wed Nov 27 12:56:22 2002 +++ pecl/uuid/.cvsignore Thu Mar 27 22:09:59 2008 @@ -1,3 +1,33 @@ -.deps *.lo *.la +.deps +.libs +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +autom4te.cache +build +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +conftest +conftest.c +include +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +modules +scan_makefile_in.awk +uuid*.tgz http://cvs.php.net/viewvc.cgi/pecl/uuid/CREDITS?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/CREDITS diff -u pecl/uuid/CREDITS:1.1 pecl/uuid/CREDITS:1.2 --- pecl/uuid/CREDITS:1.1 Wed Nov 27 12:55:49 2002 +++ pecl/uuid/CREDITS Thu Mar 27 22:09:59 2008 @@ -1,2 +1,2 @@ uuid -Hartmut Holzgraefe \ No newline at end of file +Hartmut Holzgraefe http://cvs.php.net/viewvc.cgi/pecl/uuid/config.m4?r1=1.3&r2=1.4&diff_format=u Index: pecl/uuid/config.m4 diff -u pecl/uuid/config.m4:1.3 pecl/uuid/config.m4:1.4 --- pecl/uuid/config.m4:1.3 Tue Mar 25 22:53:20 2008 +++ pecl/uuid/config.m4 Thu Mar 27 22:09:59 2008 @@ -1,20 +1,44 @@ -dnl $Id: config.m4,v 1.3 2008/03/25 22:53:20 hholzgra Exp $ -dnl config.m4 for extension uuid +dnl +dnl $ Id: $ +dnl -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. +PHP_ARG_WITH(uuid, whether uuid is available,[ --with-uuid[=DIR] With uuid support]) -dnl If your extension references something external, use with: - -PHP_ARG_WITH(uuid, for uuid support, - [ --with-uuid Include uuid support]) if test "$PHP_UUID" != "no"; then - AC_DEFINE(HAVE_UUID, 1, [ ]) - PHP_ADD_LIBRARY(uuid, 1, UUID_SHARED_LIBADD) - PHP_CHECK_FUNC_LIB(uuid_type, uuid) - PHP_CHECK_FUNC_LIB(uuid_variant, uuid) - PHP_NEW_EXTENSION(uuid, uuid.c, $ext_shared) + PHP_CHECK_FUNC_LIB(uuid_type, uuid) + PHP_CHECK_FUNC_LIB(uuid_variant, uuid) + + + PHP_ADD_INCLUDE($PHP_UUID_DIR/include) + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID" + AC_CHECK_HEADER([uuid/uuid.h], [], AC_MSG_ERROR('uuid/uuid.h' header not found)) + PHP_SUBST(UUID_SHARED_LIBADD) + + PHP_ADD_LIBRARY_WITH_PATH(uuid, $PHP_UUID_DIR/lib, UUID_SHARED_LIBADD) + export CPPFLAGS="$OLD_CPPFLAGS" + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID" + + AC_MSG_CHECKING(PHP version) + AC_TRY_COMPILE([#include <php_version.h>], [ +#if PHP_VERSION_ID < 40000 +#error this extension requires at least PHP version 4.0.0 +#endif +], +[AC_MSG_RESULT(ok)], +[AC_MSG_ERROR([need at least PHP 4.0.0])]) + + export CPPFLAGS="$OLD_CPPFLAGS" + + PHP_SUBST(UUID_SHARED_LIBADD) + AC_DEFINE(HAVE_UUID, 1, [ ]) + + PHP_NEW_EXTENSION(uuid, uuid.c , $ext_shared) + fi + http://cvs.php.net/viewvc.cgi/pecl/uuid/package.xml?r1=1.4&r2=1.5&diff_format=u Index: pecl/uuid/package.xml diff -u pecl/uuid/package.xml:1.4 pecl/uuid/package.xml:1.5 --- pecl/uuid/package.xml:1.4 Tue Mar 25 22:53:20 2008 +++ pecl/uuid/package.xml Thu Mar 27 22:09:59 2008 @@ -1,95 +1,62 @@ -<?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 -http://pear.php.net/dtd/tasks-1.0.xsd -http://pear.php.net/dtd/package-2.0 -http://pear.php.net/dtd/package-2.0.xsd"> - <name>uuid</name> - <channel>pecl.php.net</channel> - <summary>UUID support functions</summary> - <description>This extension provides functions to generate and analyse -universally unique identifiers (UUIDs). It depends on the -external libuuid. This library is available on most linux -systems (its source is there bundled with the ext2fs tools) -and on Solaris. - </description> - <lead> - <name>Hartmut Holzgraefe</name> - <user>hholzgra</user> - <email>hholzgra@php.net</email> - <active>yes</active> - </lead> - <date>2008-03-25</date> - <time>23:51:21</time> - <version> - <release>1.0.1</release> - <api>1.0.1</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Now works with Solaris libuuid implementation, too - </notes> - <contents> - <dir name="/"> - <dir name="tests"> - <file name="uuid_compare.phpt" role="test" /> - <file name="uuid_create.phpt" role="test" /> - <file name="uuid_is_null.phpt" role="test" /> - <file name="uuid_is_valid.phpt" role="test" /> - <file name="uuid_mac.phpt" role="test" /> - <file name="uuid_time.phpt" role="test" /> - <file name="uuid_type.phpt" role="test" /> - <file name="uuid_variant.phpt" role="test" /> - </dir> <!-- //tests --> - <file name="config.m4" role="src" /> - <file name="CREDITS" role="doc" /> - <file name="php_uuid.h" role="src" /> - <file name="uuid.c" role="src" /> - <file name="uuid.xml" role="doc" /> - </dir> <!-- / --> - </contents> - <dependencies> - <required> - <php> - <min>4.0.0</min> - </php> - <pearinstaller> - <min>1.4.0b1</min> - </pearinstaller> - </required> - </dependencies> - <providesextension>uuid</providesextension> - <extsrcrelease /> - <changelog> +<?xml version="1.0"?> +<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> +<package> + + <name>uuid</name> + <summary>UUID extension</summary> + <description> + A wrapper around libuuid from the ext2utils project. + </description> + + <license>LGPL</license> + + <configureoptions> + <configureoption name="with-uuid" default="autodetect" prompt="uuid installation directory?" /> + </configureoptions> + + <maintainers> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> + </maintainers> + <release> - <version> - <release>0.9</release> - <api>0.9</api> - </version> - <stability> - <release>beta</release> - <api>beta</api> - </stability> - <date>2003-02-10</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Initial 'official' beta release. - </notes> + <version>0.1</version> + <state>alpha</state> + <notes> first tests +</notes> + <date>2006-06-24</date> </release> - <release> - <version> - <release>1.0</release> - <api>1.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <date>2004-03-27</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Official 1.0 stable release - </notes> - </release> - </changelog> + <changelog> + + </changelog> + <deps> + <dep type="php" rel="ge" version="4.0.0"/> + <dep type='os' rel='has' name='unix'/> + </deps> + + <filelist> + <dir name="/"> + <file role='doc' name='EXPERIMENTAL'/> + <file role='doc' name='CREDITS'/> + <file role='src' name='config.m4'/> + <file role='src' name='uuid.c'/> + <file role='src' name='php_uuid.h'/> + <dir name="tests"> + <file role='test' name='uuid_create.phpt'/> + <file role='test' name='uuid_is_valid.phpt'/> + <file role='test' name='uuid_compare.phpt'/> + <file role='test' name='uuid_is_null.phpt'/> + <file role='test' name='uuid_type.phpt'/> + <file role='test' name='uuid_variant.phpt'/> + <file role='test' name='uuid_time.phpt'/> + <file role='test' name='uuid_mac.phpt'/> + <file role='test' name='uuid_parse.phpt'/> + <file role='test' name='uuid_unparse.phpt'/> + </dir> + </dir> + </filelist> </package> http://cvs.php.net/viewvc.cgi/pecl/uuid/php_uuid.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/uuid/php_uuid.h diff -u pecl/uuid/php_uuid.h:1.5 pecl/uuid/php_uuid.h:1.6 --- pecl/uuid/php_uuid.h:1.5 Tue Mar 25 23:03:24 2008 +++ pecl/uuid/php_uuid.h Thu Mar 27 22:09:59 2008 @@ -1,27 +1,60 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 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. | - +----------------------------------------------------------------------+ - | Author: Hartmut Holzgraefe <hartmut@php.net> | - +----------------------------------------------------------------------+ - - $Id: php_uuid.h,v 1.5 2008/03/25 23:03:24 hholzgra Exp $ + +----------------------------------------------------------------------+ + | This library is free software; you can redistribute it and/or | + | modify it under the terms of the GNU Lesser General Public | + | License as published by the Free Software Foundation; either | + | version 2.1 of the License, or (at your option) any later version. | + | | + | This library 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 | + | Lesser General Public License for more details. | + | | + | You should have received a copy of the GNU Lesser General Public | + | License in the file LICENSE along with this library; | + | if not, write to the | + | | + | Free Software Foundation, Inc., | + | 59 Temple Place, Suite 330, | + | Boston, MA 02111-1307 USA | + +----------------------------------------------------------------------+ + | Authors: Hartmut Holzgraefe <hartmut@php.net> | + +----------------------------------------------------------------------+ */ +/* $ Id: $ */ + #ifndef PHP_UUID_H #define PHP_UUID_H -#define PHP_UUID_VERSION "1.0.1" +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <php.h> + +#ifdef HAVE_UUID +#define PHP_UUID_VERSION "0.1" + + +#include <php_ini.h> +#include <SAPI.h> +#include <ext/standard/info.h> +#include <Zend/zend_extensions.h> +#ifdef __cplusplus +} // extern "C" +#endif +#include <uuid/uuid.h> +#ifdef __cplusplus +extern "C" { +#endif + +extern zend_module_entry uuid_module_entry; +#define phpext_uuid_ptr &uuid_module_entry #ifdef PHP_WIN32 #define PHP_UUID_API __declspec(dllexport) @@ -29,28 +62,148 @@ #define PHP_UUID_API #endif -extern zend_module_entry uuid_module_entry; -#define phpext_uuid_ptr &uuid_module_entry - PHP_MINIT_FUNCTION(uuid); +PHP_MSHUTDOWN_FUNCTION(uuid); +PHP_RINIT_FUNCTION(uuid); +PHP_RSHUTDOWN_FUNCTION(uuid); PHP_MINFO_FUNCTION(uuid); +#ifdef ZTS +#include "TSRM.h" +#endif + +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + + PHP_FUNCTION(uuid_create); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_create_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, uuid_type) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_create_arg_info NULL +#endif + +PHP_FUNCTION(uuid_is_valid); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_is_valid_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_is_valid_arg_info NULL +#endif + PHP_FUNCTION(uuid_compare); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_compare_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, uuid1) + ZEND_ARG_INFO(0, uuid2) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_compare_arg_info NULL +#endif + PHP_FUNCTION(uuid_is_null); -PHP_FUNCTION(uuid_is_valid); -PHP_FUNCTION(uuid_variant); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_is_null_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_is_null_arg_info NULL +#endif + +#if HAVE_UUID_TYPE PHP_FUNCTION(uuid_type); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_type_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_type_arg_info NULL +#endif + +#endif /* HAVE_UUID_TYPE */ +#if HAVE_UUID_VARIANT +PHP_FUNCTION(uuid_variant); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_variant_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_variant_arg_info NULL +#endif + +#endif /* HAVE_UUID_VARIANT */ PHP_FUNCTION(uuid_time); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_time_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_time_arg_info NULL +#endif + PHP_FUNCTION(uuid_mac); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_mac_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_mac_arg_info NULL +#endif + +PHP_FUNCTION(uuid_parse); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_parse_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_parse_arg_info NULL +#endif + +PHP_FUNCTION(uuid_unparse); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_unparse_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_unparse_arg_info NULL +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +/* mirrored PHP Constants */ +#define UUID_TYPE_DEFAULT 0 +#define UUID_TYPE_TIME UUID_TYPE_DCE_TIME +#define UUID_TYPE_DCE UUID_TYPE_DCE_RANDOM +#define UUID_TYPE_NAME UUID_TYPE_DCE_TIME +#define UUID_TYPE_RANDOM UUID_TYPE_DCE_RANDOM +#define UUID_TYPE_NULL -1 +#define UUID_TYPE_INVALID -42 + +#endif /* PHP_HAVE_UUID */ -#endif /* PHP_UUID_H */ +#endif /* PHP_UUID_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 - * indent-tabs-mode: t * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 */ http://cvs.php.net/viewvc.cgi/pecl/uuid/uuid.c?r1=1.7&r2=1.8&diff_format=u Index: pecl/uuid/uuid.c diff -u pecl/uuid/uuid.c:1.7 pecl/uuid/uuid.c:1.8 --- pecl/uuid/uuid.c:1.7 Tue Mar 25 23:03:24 2008 +++ pecl/uuid/uuid.c Thu Mar 27 22:09:59 2008 @@ -1,65 +1,64 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 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. | - +----------------------------------------------------------------------+ - | Author: Hartmut Holzgraefe <hartmut@php.net> | - +----------------------------------------------------------------------+ - - $Id: uuid.c,v 1.7 2008/03/25 23:03:24 hholzgra Exp $ + +----------------------------------------------------------------------+ + | This library is free software; you can redistribute it and/or | + | modify it under the terms of the GNU Lesser General Public | + | License as published by the Free Software Foundation; either | + | version 2.1 of the License, or (at your option) any later version. | + | | + | This library 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 | + | Lesser General Public License for more details. | + | | + | You should have received a copy of the GNU Lesser General Public | + | License in the file LICENSE along with this library; | + | if not, write to the | + | | + | Free Software Foundation, Inc., | + | 59 Temple Place, Suite 330, | + | Boston, MA 02111-1307 USA | + +----------------------------------------------------------------------+ + | Authors: Hartmut Holzgraefe <hartmut@php.net> | + +----------------------------------------------------------------------+ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +/* $ Id: $ */ -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" #include "php_uuid.h" -#include <uuid/uuid.h> - -#define UUID_TYPE_DEFAULT 0 -#define UUID_TYPE_TIME 1 -#define UUID_TYPE_DCE 2 -#define UUID_TYPE_NAME 3 -#define UUID_TYPE_RANDOM 4 -#define UUID_TYPE_NULL -1 +#if HAVE_UUID /* {{{ uuid_functions[] */ function_entry uuid_functions[] = { - PHP_FE(uuid_create, NULL) - PHP_FE(uuid_compare, NULL) - PHP_FE(uuid_is_null, NULL) - PHP_FE(uuid_is_valid, NULL) - PHP_FE(uuid_variant, NULL) - PHP_FE(uuid_type, NULL) - PHP_FE(uuid_time, NULL) - PHP_FE(uuid_mac, NULL) - {NULL, NULL, NULL} + PHP_FE(uuid_create , uuid_create_arg_info) + PHP_FE(uuid_is_valid , uuid_is_valid_arg_info) + PHP_FE(uuid_compare , uuid_compare_arg_info) + PHP_FE(uuid_is_null , uuid_is_null_arg_info) +#if HAVE_UUID_TYPE + PHP_FE(uuid_type , uuid_type_arg_info) +#endif /* HAVE_UUID_TYPE */ +#if HAVE_UUID_VARIANT + PHP_FE(uuid_variant , uuid_variant_arg_info) +#endif /* HAVE_UUID_VARIANT */ + PHP_FE(uuid_time , uuid_time_arg_info) + PHP_FE(uuid_mac , uuid_mac_arg_info) + PHP_FE(uuid_parse , uuid_parse_arg_info) + PHP_FE(uuid_unparse , uuid_unparse_arg_info) + { NULL, NULL, NULL } }; /* }}} */ + /* {{{ uuid_module_entry */ zend_module_entry uuid_module_entry = { STANDARD_MODULE_HEADER, "uuid", uuid_functions, - PHP_MINIT(uuid), - NULL, - NULL, - NULL, + PHP_MINIT(uuid), /* Replace with NULL if there is nothing to do at php startup */ + PHP_MSHUTDOWN(uuid), /* Replace with NULL if there is nothing to do at php shutdown */ + PHP_RINIT(uuid), /* Replace with NULL if there is nothing to do at request start */ + PHP_RSHUTDOWN(uuid), /* Replace with NULL if there is nothing to do at request end */ PHP_MINFO(uuid), PHP_UUID_VERSION, STANDARD_MODULE_PROPERTIES @@ -70,237 +69,382 @@ ZEND_GET_MODULE(uuid) #endif -/* {{{ PHP_MINIT_FUNCTION - */ + +/* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(uuid) { - REGISTER_LONG_CONSTANT("UUID_TYPE_TIME", UUID_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_DCE", UUID_TYPE_DCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_NAME", UUID_TYPE_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_RANDOM", UUID_TYPE_RANDOM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_NULL", UUID_TYPE_NULL, CONST_CS | CONST_PERSISTENT); +#if UUID_VARIANT_NCS + REGISTER_LONG_CONSTANT("UUID_VARIANT_NCS", UUID_VARIANT_NCS, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_NCS */ +#if UUID_VARIANT_DCE + REGISTER_LONG_CONSTANT("UUID_VARIANT_DCE", UUID_VARIANT_DCE, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_DCE */ +#if UUID_VARIANT_MICROSOFT + REGISTER_LONG_CONSTANT("UUID_VARIANT_MICROSOFT", UUID_VARIANT_MICROSOFT, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_MICROSOFT */ +#if UUID_VARIANT_OTHER + REGISTER_LONG_CONSTANT("UUID_VARIANT_OTHER", UUID_VARIANT_OTHER, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_OTHER */ + REGISTER_LONG_CONSTANT("UUID_TYPE_DEFAULT", 0, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_TIME", UUID_TYPE_DCE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_DCE", UUID_TYPE_DCE_RANDOM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_NAME", UUID_TYPE_DCE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_RANDOM", UUID_TYPE_DCE_RANDOM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_NULL", -1, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_INVALID", -42, CONST_PERSISTENT | CONST_CS); -#ifdef UUID_VARIANT_NCS - REGISTER_LONG_CONSTANT("UUID_VARIANT_NCS", UUID_VARIANT_NCS, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_DCE - REGISTER_LONG_CONSTANT("UUID_VARIANT_DCE", UUID_VARIANT_DCE, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_MICROSOFT - REGISTER_LONG_CONSTANT("UUID_VARIANT_MICROSOFT", UUID_VARIANT_MICROSOFT, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_OTHER - REGISTER_LONG_CONSTANT("UUID_VARIANT_OTHER", UUID_VARIANT_OTHER, CONST_CS | CONST_PERSISTENT); -#endif + /* add your stuff here */ return SUCCESS; } /* }}} */ -/* {{{ PHP_MINFO_FUNCTION - */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION */ +PHP_MSHUTDOWN_FUNCTION(uuid) +{ + + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_RINIT_FUNCTION */ +PHP_RINIT_FUNCTION(uuid) +{ + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_RSHUTDOWN_FUNCTION */ +PHP_RSHUTDOWN_FUNCTION(uuid) +{ + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(uuid) { - php_info_print_table_start(); - php_info_print_table_row(2, "uuid support", "enabled"); - php_info_print_table_row(2, "uuid version", PHP_UUID_VERSION); - php_info_print_table_end(); + php_info_print_box_start(0); + php_printf("<p>UUID extension</p>\n"); + php_printf("<p>Version %s alpha (2006-06-24) $Id: uuid.c,v 1.8 2008/03/27 22:09:59 hholzgra Exp $</p>\n", PHP_UUID_VERSION); + php_printf("<p><b>Authors:</b></p>\n"); + php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); + php_info_print_box_end(); + /* add your stuff here */ + } /* }}} */ -/* {{{ proto string uuid_create([int type]) - Create a UUID */ +/* {{{ proto string uuid_create([int uuid_type]) + Generate a new UUID */ PHP_FUNCTION(uuid_create) { - int argc = ZEND_NUM_ARGS(); - long type = UUID_TYPE_DEFAULT; - uuid_t uuid; - char uuid_str[37]; - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &type) == FAILURE) + long uuid_type = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uuid_type) == FAILURE) { return; + } - switch (type) { - case UUID_TYPE_TIME: - case UUID_TYPE_NAME: - /* Generate Time/System Name based UUID */ - uuid_generate_time(uuid); - break; - case UUID_TYPE_DCE: - case UUID_TYPE_RANDOM: - /* Generate Random based UUID, much better */ - uuid_generate_random(uuid); - break; - case UUID_TYPE_NULL: - /* null UUID */ - uuid_clear(uuid); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "Unknown/invalid UUID type '%d' requested, using default type instead", - type); - /* fallthru */ - case UUID_TYPE_DEFAULT: - /* Fall back and use the system default. In most cases this - is the Random Based one. */ - uuid_generate(uuid); - } + do { + uuid_t uuid; + char uuid_str[37]; + + switch(uuid_type) { + case UUID_TYPE_DCE_TIME: + uuid_generate_time(uuid); + break; + case UUID_TYPE_DCE_RANDOM: + uuid_generate_random(uuid); + break; + case UUID_TYPE_DEFAULT: + uuid_generate(uuid); + break; + default: + php_error_docref(NULL TSRMLS_CC, + E_WARNING, + "Unknown/invalid UUID type '%d' requested, using default type instead", + uuid_type); + uuid_generate(uuid); + break; + } - uuid_unparse(uuid, uuid_str); + uuid_unparse(uuid, uuid_str); - RETURN_STRING(uuid_str, 1); + RETURN_STRING(uuid_str, 1); + } while (0); } -/* }}} */ +/* }}} uuid_create */ + + +/* {{{ proto bool uuid_is_valid(string uuid) + Check whether a given UUID string is a valid UUID */ +PHP_FUNCTION(uuid_is_valid) +{ + + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + uuid_t u; + RETURN_BOOL(0 == uuid_parse(uuid, u)); + } while (0); +} +/* }}} uuid_is_valid */ + /* {{{ proto int uuid_compare(string uuid1, string uuid2) - Compare two UUIDs */ + Compare two UUIDs */ PHP_FUNCTION(uuid_compare) { - int argc = ZEND_NUM_ARGS(); - char *uuid1 = NULL, *uuid2 = NULL; - int uuid1_len, uuid2_len; - uuid_t u1, u2; - if (zend_parse_parameters(argc TSRMLS_CC, "ss", &uuid1, &uuid1_len, &uuid2, &uuid2_len) == FAILURE) + const char * uuid1 = NULL; + int uuid1_len = 0; + const char * uuid2 = NULL; + int uuid2_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uuid1, &uuid1_len, &uuid2, &uuid2_len) == FAILURE) { return; + } + + do { + uuid_t u1, u2; - if(uuid_parse(uuid1, u1)) RETURN_FALSE; - if(uuid_parse(uuid2, u2)) RETURN_FALSE; + if(uuid_parse(uuid1, u1)) RETURN_FALSE; + if(uuid_parse(uuid2, u2)) RETURN_FALSE; - RETURN_LONG(uuid_compare(u1, u2)); + RETURN_LONG(uuid_compare(u1, u2)); + } while (0); } -/* }}} */ +/* }}} uuid_compare */ + /* {{{ proto bool uuid_is_null(string uuid) - Check for NULL UUID */ + Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000 */ PHP_FUNCTION(uuid_is_null) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; - - if(uuid_parse(uuid, u)) RETURN_FALSE; - - if(uuid_is_null(u)) RETURN_TRUE; + } + + do { + uuid_t u; - RETURN_FALSE; + if(uuid_parse(uuid, u)) RETURN_FALSE; + + RETURN_BOOL(uuid_is_null(u)); + } while (0); } -/* }}} */ +/* }}} uuid_is_null */ -/* {{{ proto bool uuid_is_valid(string uuid) - Validate UUID */ -PHP_FUNCTION(uuid_is_valid) + +#if HAVE_UUID_TYPE +/* {{{ proto int uuid_type(string uuid) + Return the UUIDs type */ +PHP_FUNCTION(uuid_type) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; - - if(uuid_parse(uuid, u)) RETURN_FALSE; - - RETURN_TRUE; + } + + do { + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_type(u)); + } while (0); } -/* }}} */ +/* }}} uuid_type */ + +#endif /* HAVE_UUID_TYPE */ #if HAVE_UUID_VARIANT /* {{{ proto int uuid_variant(string uuid) - Get UUID variant */ + Return the UUIDs variant */ PHP_FUNCTION(uuid_variant) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) - return; - if(uuid_parse(uuid, u)) RETURN_FALSE; + const char * uuid = NULL; + int uuid_len = 0; - RETURN_LONG(uuid_variant(u)); -} -/* }}} */ -#endif -#if HAVE_UUID_TYPE -/* {{{ proto int uuid_type(string uuid) - Get UUID type */ -PHP_FUNCTION(uuid_type) -{ - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } - if(uuid_parse(uuid, u)) RETURN_FALSE; + do { + uuid_t u; - if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + if(uuid_parse(uuid, u)) RETURN_FALSE; - RETURN_LONG(uuid_type(u)); + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_variant(u)); + } while (0); } -/* }}} */ -#endif +/* }}} uuid_variant */ + +#endif /* HAVE_UUID_VARIANT */ /* {{{ proto int uuid_time(string uuid) - Get UUID creation time as UNIX timestamp */ + Extract creation time from a time based UUID as UNIX timestamp */ PHP_FUNCTION(uuid_time) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } + + do { + uuid_t u; - if(uuid_parse(uuid, u)) RETURN_FALSE; + if(uuid_parse(uuid, u)) RETURN_FALSE; #if HAVE_UUID_VARIANT - if(uuid_variant(u) != 1) RETURN_FALSE; + if(uuid_variant(u) != 1) RETURN_FALSE; #endif #if HAVE_UUID_TYPE - if(uuid_type(u) != 1) RETURN_FALSE; -#endif - RETURN_LONG(uuid_time(u, NULL)); + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + RETURN_LONG(uuid_time(u, NULL)); + } while (0); } -/* }}} */ +/* }}} uuid_time */ + /* {{{ proto string uuid_mac(string uuid) - Get UUID creator network MAC address */ + Get UUID creator network MAC address */ PHP_FUNCTION(uuid_mac) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - char uuid_str[37]; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } - if(uuid_parse(uuid, u)) RETURN_FALSE; + do { + uuid_t u; + char uuid_str[37]; + + if(uuid_parse(uuid, u)) RETURN_FALSE; #if HAVE_UUID_VARIANT - if(uuid_variant(u) != 1) RETURN_FALSE; + if(uuid_variant(u) != 1) RETURN_FALSE; #endif #if HAVE_UUID_TYPE - if(uuid_type(u) != 1) RETURN_FALSE; -#endif - if(uuid[10]&0x80) RETURN_FALSE; + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + if(uuid[10] & 0x80) RETURN_FALSE; // invalid MAC + + uuid_unparse(u, uuid_str); + RETURN_STRING((char *)(uuid_str + 24), 1); + } while (0); +} +/* }}} uuid_mac */ + + +/* {{{ proto string uuid_parse(string uuid) + */ +PHP_FUNCTION(uuid_parse) +{ + + const char * uuid = NULL; + int uuid_len = 0; + - uuid_unparse(u, uuid_str); - RETURN_STRING(uuid_str+24, 1); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + uuid_t uuid_bin; + + if (uuid_parse(uuid, uuid_bin)) { + RETURN_FALSE; + } + + RETURN_STRINGL((char *)uuid_bin, sizeof(uuid_t), 1); + } while (0); } -/* }}} */ +/* }}} uuid_parse */ + + +/* {{{ proto string uuid_unparse(string uuid) + */ +PHP_FUNCTION(uuid_unparse) +{ + + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + char uuid_txt[37]; + + if (uuid_len != sizeof(uuid_t)) { + RETURN_FALSE; + } + + uuid_unparse((unsigned char *)uuid, uuid_txt); + + RETURN_STRINGL(uuid_txt, 36, 1); + } while (0); +} +/* }}} uuid_unparse */ + +#endif /* HAVE_UUID */ /* http://cvs.php.net/viewvc.cgi/pecl/uuid/uuid.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/uuid.xml diff -u pecl/uuid/uuid.xml:1.1 pecl/uuid/uuid.xml:1.2 --- pecl/uuid/uuid.xml:1.1 Wed Nov 27 12:55:49 2002 +++ pecl/uuid/uuid.xml Thu Mar 27 22:09:59 2008 @@ -1,179 +1,427 @@ -<?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.1 $ --> - <reference id="ref.uuid"> - <title> functions</title> - <titleabbrev></titleabbrev> - - <partintro> - &warn.experimental; - <para> - </para> - </partintro> - - - <refentry id="function.uuid-create"> - <refnamediv> - <refname>uuid_create</refname> - <refpurpose>Create a UUID</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>uuid_create</function></funcdef> - <paramdef>int - <parameter><optional>flags</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-cmp"> - <refnamediv> - <refname>uuid_cmp</refname> - <refpurpose>Compare two UUIDs</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_cmp</function></funcdef> - <paramdef>string <parameter>uuid1</parameter></paramdef> - <paramdef>string <parameter>uuid2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-is-null"> - <refnamediv> - <refname>uuid_is_null</refname> - <refpurpose>Check for NULL UUID</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>bool <function>uuid_is_null</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-variant"> - <refnamediv> - <refname>uuid_variant</refname> - <refpurpose>Get UUID variant</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_variant</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-type"> - <refnamediv> - <refname>uuid_type</refname> - <refpurpose>Get UUID type</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_type</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-time"> - <refnamediv> - <refname>uuid_time</refname> - <refpurpose>Get UUID creation time as UNIX timestamp</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_time</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-mac"> - <refnamediv> - <refname>uuid_mac</refname> - <refpurpose>Get UUID creator network MAC address</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>uuid_mac</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - </reference> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" ?> +<extension name="uuid" version="1.0.0"> + + <summary>UUID extension</summary> + + <description> + A wrapper around libuuid from the ext2utils project. + </description> + + <license>LGPL</license> + + <maintainers> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> + </maintainers> + + <release> + <version>0.1</version> + <date>2006-06-24</date> + <state>alpha</state> + <notes> + first tests + </notes> + </release> + + <deps language="c" platform="unix"> + <with> + <header name="uuid/uuid.h"/> + <lib name="uuid"/> + </with> + <configm4> + PHP_CHECK_FUNC_LIB(uuid_type, uuid) + PHP_CHECK_FUNC_LIB(uuid_variant, uuid) + </configm4> + </deps> + + + <constant name="UUID_VARIANT_NCS" if="UUID_VARIANT_NCS"/> + <constant name="UUID_VARIANT_DCE" if="UUID_VARIANT_DCE"/> + <constant name="UUID_VARIANT_MICROSOFT" if="UUID_VARIANT_MICROSOFT"/> + <constant name="UUID_VARIANT_OTHER" if="UUID_VARIANT_OTHER"/> + + <constant name="UUID_TYPE_DEFAULT" define="yes" type="int" value="0"/> + <constant name="UUID_TYPE_TIME" define="yes" type="int" value="UUID_TYPE_DCE_TIME"/> + <constant name="UUID_TYPE_DCE" define="yes" type="int" value="UUID_TYPE_DCE_RANDOM"/> + <constant name="UUID_TYPE_NAME" define="yes" type="int" value="UUID_TYPE_DCE_TIME"/> + <constant name="UUID_TYPE_RANDOM" define="yes" type="int" value="UUID_TYPE_DCE_RANDOM"/> + <constant name="UUID_TYPE_NULL" define="yes" type="int" value="-1"/> + <constant name="UUID_TYPE_INVALID" define="yes" type="int" value="-42"/> + + <function name="uuid_create"> + <proto>string uuid_create([int uuid_type])</proto> + + <summary>Generate a new UUID</summary> + + <description> + ... + </description> + + <code> + uuid_t uuid; + char uuid_str[37]; + + switch(uuid_type) { + case UUID_TYPE_DCE_TIME: + uuid_generate_time(uuid); + break; + case UUID_TYPE_DCE_RANDOM: + uuid_generate_random(uuid); + break; + case UUID_TYPE_DEFAULT: + uuid_generate(uuid); + break; + default: + php_error_docref(NULL TSRMLS_CC, + E_WARNING, + "Unknown/invalid UUID type '%d' requested, using default type instead", + uuid_type); + uuid_generate(uuid); + break; + } + + uuid_unparse(uuid, uuid_str); + + RETURN_STRING(uuid_str, 1); + </code> + + <test> + <code> +<![CDATA[ + // check basic format of generated UUIDs + $uuid = uuid_create(); + if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { + echo "basic format ok\n"; + } else { + echo "basic UUID format check failed, generated UUID was $uuid\n"; + } +]]> + </code> + <result> +basic format ok + </result> + </test> + + </function> + + <function name="uuid_is_valid"> + <proto>bool uuid_is_valid(string uuid)</proto> + + <summary>Check whether a given UUID string is a valid UUID</summary> + + <description> + add some text here + </description> + + <code> + uuid_t u; + RETURN_BOOL(0 == uuid_parse(uuid, u)); + </code> + + <test> + <code> +var_dump(uuid_is_valid("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb")); +var_dump(uuid_is_valid("ffffffff-ffff-ffff-ffff-ffffffffffff")); +var_dump(uuid_is_valid("61616161-6161-6161-6161-616161616161")); +var_dump(uuid_is_valid("foobar")); + </code> + <result> +bool(true) +bool(true) +bool(true) +bool(false) + </result> + </test> + + </function> + + <function name="uuid_compare"> + <proto>int uuid_compare(string uuid1, string uuid2)</proto> + + <summary>Compare two UUIDs</summary> + + <code> + uuid_t u1, u2; + + if(uuid_parse(uuid1, u1)) RETURN_FALSE; + if(uuid_parse(uuid2, u2)) RETURN_FALSE; + + RETURN_LONG(uuid_compare(u1, u2)); + </code> + + <test> + <code> +<?data + $uuids = array(); + $uuids[0] = "00000000-0000-0000-0000-000000000000"; + $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; + $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; + + foreach ($uuids as $key1 => $uuid1) { + foreach ($uuids as $key2 => $uuid2) { + echo "uuid$key1"; + + switch (uuid_compare($uuid1, $uuid2)) { + case -1: echo " < "; break; + case 0: echo " = "; break; + case 1: echo " > "; break; + } + + echo "uuid$key2\n"; + } + echo "\n"; + } +?> + </code> + <result> +<?data +uuid0 = uuid0 +uuid0 < uuid1 +uuid0 < uuid2 + +uuid1 > uuid0 +uuid1 = uuid1 +uuid1 < uuid2 + +uuid2 > uuid0 +uuid2 > uuid1 +uuid2 = uuid2 +?> + </result> + </test> + + </function> + + <function name="uuid_is_null"> + <proto>bool uuid_is_null(string uuid)</proto> + + <summary>Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + RETURN_BOOL(uuid_is_null(u)); + </code> + + <test> + <code> +var_dump(uuid_is_null("00000000-0000-0000-0000-000000000000")); +var_dump(uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_is_null("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")); + </code> + <result> +bool(true) +bool(false) +bool(false) + </result> + </test> + </function> + + + <function name="uuid_type" if="HAVE_UUID_TYPE"> + <proto>int uuid_type(string uuid)</proto> + + <summary>Return the UUIDs type</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_type(u)); + </code> + + <test> + <code> +echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488") == UUID_TYPE_TIME ? "OK\n" : "Failure\n"; +echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b") == UUID_TYPE_RANDOM ? "OK\n" : "Failure\n"; +echo uuid_type("00000000-0000-0000-0000-000000000000") == UUID_TYPE_NULL ? "OK\n" : "Failure\n"; + </code> + <result> +OK +OK +OK + </result> + </test> + + </function> + + <function name="uuid_variant" if="HAVE_UUID_VARIANT"> + <proto>int uuid_variant(string uuid)</proto> + + <summary>Return the UUIDs variant</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_variant(u)); + </code> + + <test> + <code> +echo uuid_variant("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; +echo uuid_variant("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +echo uuid_variant("00000000-0000-0000-0000-000000000000")."\n"; + </code> + <result> +1 +1 +-1 + </result> + </test> + + </function> + + <function name="uuid_time"> + <proto>int uuid_time(string uuid)</proto> + + <summary>Extract creation time from a time based UUID as UNIX timestamp</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + +#if HAVE_UUID_VARIANT + if(uuid_variant(u) != 1) RETURN_FALSE; +#endif +#if HAVE_UUID_TYPE + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + RETURN_LONG(uuid_time(u, NULL)); + </code> + + <test> + <code> +var_dump(uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + </code> + <result> +int(1080374815) +bool(false) + </result> + </test> + </function> + + <function name="uuid_mac"> + <proto>string uuid_mac(string uuid)</proto> + + <summary>Get UUID creator network MAC address</summary> + + <description> + ... + </description> + + <code> +<?data + uuid_t u; + char uuid_str[37]; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + +#if HAVE_UUID_VARIANT + if(uuid_variant(u) != 1) RETURN_FALSE; +#endif +#if HAVE_UUID_TYPE + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + if(uuid[10] & 0x80) RETURN_FALSE; // invalid MAC + + uuid_unparse(u, uuid_str); + RETURN_STRING((char *)(uuid_str + 24), 1); +?> + </code> + + <test> + <code> +var_dump(uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + </code> + <result> +string(12) "00065b896488" +bool(false) + </result> + </test> + + </function> + + <function name="uuid_parse"> + <proto>string uuid_parse(string uuid)</proto> + <code> +<?data + uuid_t uuid_bin; + + if (uuid_parse(uuid, uuid_bin)) { + RETURN_FALSE; + } + + RETURN_STRINGL((char *)uuid_bin, sizeof(uuid_t), 1); +?> + </code> + <test> + <code> +var_dump(uuid_parse("61616161-6161-6161-6161-616161616161")); + </code> + <result> +string(16) "aaaaaaaaaaaaaaaa" + </result> + </test> + </function> + + <function name="uuid_unparse"> + <proto>string uuid_unparse(string uuid)</proto> + <code> +<?data + char uuid_txt[37]; + + if (uuid_len != sizeof(uuid_t)) { + RETURN_FALSE; + } + + uuid_unparse((unsigned char *)uuid, uuid_txt); + + RETURN_STRINGL(uuid_txt, 36, 1); +?> + </code> + <test> + <code> +var_dump(uuid_unparse("aaaaaaaaaaaaaaaa")); + </code> + <result> +string(36) "61616161-6161-6161-6161-616161616161" + </result> + </test> + </function> + +</extension> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_compare.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_compare.phpt diff -u pecl/uuid/tests/uuid_compare.phpt:1.1 pecl/uuid/tests/uuid_compare.phpt:1.2 --- pecl/uuid/tests/uuid_compare.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_compare.phpt Thu Mar 27 22:10:00 2008 @@ -1,31 +1,33 @@ --TEST-- -UUID comparison +uuid_compare() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- -<?php - $uuids = array(); - $uuids[0] = "00000000-0000-0000-0000-000000000000"; - $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; - $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; - - foreach ($uuids as $key1 => $uuid1) { - foreach ($uuids as $key2 => $uuid2) { - echo "uuid$key1"; - - switch (uuid_compare($uuid1, $uuid2)) { - case -1: echo " < "; break; - case 0: echo " = "; break; - case 1: echo " > "; break; - } - - echo "uuid$key2\n"; - } - echo "\n"; - } +<?php +$uuids = array(); + $uuids[0] = "00000000-0000-0000-0000-000000000000"; + $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; + $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; + + foreach ($uuids as $key1 => $uuid1) { + foreach ($uuids as $key2 => $uuid2) { + echo "uuid$key1"; + + switch (uuid_compare($uuid1, $uuid2)) { + case -1: echo " < "; break; + case 0: echo " = "; break; + case 1: echo " > "; break; + } + + echo "uuid$key2\n"; + } + echo "\n"; + } + ?> --EXPECT-- uuid0 = uuid0 @@ -39,4 +41,3 @@ uuid2 > uuid0 uuid2 > uuid1 uuid2 = uuid2 - http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_create.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_create.phpt diff -u pecl/uuid/tests/uuid_create.phpt:1.1 pecl/uuid/tests/uuid_create.phpt:1.2 --- pecl/uuid/tests/uuid_create.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_create.phpt Thu Mar 27 22:10:00 2008 @@ -1,37 +1,21 @@ --TEST-- -UUID creation +uuid_create() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- ---FILE-- -<?php - // check basic format of generated UUIDs - $uuid = uuid_create(); - if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { - echo "basic format ok\n"; +<?php - echo "NULL UUID "; - $uuid = uuid_create(UUID_TYPE_NULL); - echo uuid_is_null($uuid) ? "ok\n" : "failed: $uuid\n"; +if(!extension_loaded('uuid')) die('skip '); - echo "Time based UUID "; - $uuid = uuid_create(UUID_TYPE_TIME); - echo uuid_type($uuid) == UUID_TYPE_TIME ? "ok\n" : "failed: $uuid (".uuid_type($uuid).",".UUID_TYPE_TIME.")\n"; - - echo "Random UUID "; - $uuid = uuid_create(UUID_TYPE_RANDOM); - echo uuid_type($uuid) == UUID_TYPE_RANDOM ? "ok\n" : "failed: $uuid\n"; + ?> +--FILE-- +<?php + // check basic format of generated UUIDs + $uuid = uuid_create(); + if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { + echo "basic format ok\n"; + } else { + echo "basic UUID format check failed, generated UUID was $uuid\n"; + } - } else { - echo "basic UUID format check failed, generated UUID was $uuid\n"; - } ?> --EXPECT-- basic format ok -NULL UUID ok -Time based UUID ok -Random UUID ok - - http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_is_null.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_is_null.phpt diff -u pecl/uuid/tests/uuid_is_null.phpt:1.1 pecl/uuid/tests/uuid_is_null.phpt:1.2 --- pecl/uuid/tests/uuid_is_null.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_is_null.phpt Thu Mar 27 22:10:00 2008 @@ -1,20 +1,19 @@ --TEST-- -UUID NULL check +uuid_is_null() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo (int)uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo (int)uuid_is_null("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo (int)uuid_is_null("00000000-0000-0000-0000-000000000000")."\n"; +var_dump(uuid_is_null("00000000-0000-0000-0000-000000000000")); +var_dump(uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_is_null("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")); + ?> --EXPECT-- -0 -0 -1 - - - +bool(true) +bool(false) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_is_valid.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_is_valid.phpt diff -u pecl/uuid/tests/uuid_is_valid.phpt:1.1 pecl/uuid/tests/uuid_is_valid.phpt:1.2 --- pecl/uuid/tests/uuid_is_valid.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_is_valid.phpt Thu Mar 27 22:10:00 2008 @@ -1,23 +1,21 @@ --TEST-- -UUID validation +uuid_is_valid() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo (int)uuid_is_valid("this is not an UUID string")."\n"; -echo (int)uuid_is_valid("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo (int)uuid_is_valid("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo (int)uuid_is_valid("00000000-0000-0000-0000-000000000000")."\n"; -echo (int)uuid_is_valid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")."\n"; +var_dump(uuid_is_valid("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb")); +var_dump(uuid_is_valid("ffffffff-ffff-ffff-ffff-ffffffffffff")); +var_dump(uuid_is_valid("61616161-6161-6161-6161-616161616161")); +var_dump(uuid_is_valid("foobar")); + ?> --EXPECT-- -0 -1 -1 -1 -1 - - +bool(true) +bool(true) +bool(true) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_mac.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_mac.phpt diff -u pecl/uuid/tests/uuid_mac.phpt:1.1 pecl/uuid/tests/uuid_mac.phpt:1.2 --- pecl/uuid/tests/uuid_mac.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_mac.phpt Thu Mar 27 22:10:00 2008 @@ -1,15 +1,17 @@ --TEST-- -UUID MAC address extraction +uuid_mac() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +var_dump(uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + ?> --EXPECT-- -00065b896488 - +string(12) "00065b896488" +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_time.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_time.phpt diff -u pecl/uuid/tests/uuid_time.phpt:1.1 pecl/uuid/tests/uuid_time.phpt:1.2 --- pecl/uuid/tests/uuid_time.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_time.phpt Thu Mar 27 22:10:00 2008 @@ -1,15 +1,17 @@ --TEST-- -UUID timestamp extraction +uuid_time() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +var_dump(uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + ?> --EXPECT-- -1080374815 - +int(1080374815) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_type.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_type.phpt diff -u pecl/uuid/tests/uuid_type.phpt:1.1 pecl/uuid/tests/uuid_type.phpt:1.2 --- pecl/uuid/tests/uuid_type.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_type.phpt Thu Mar 27 22:10:00 2008 @@ -1,19 +1,21 @@ --TEST-- -UUID type detection +uuid_type() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + +if(!function_exists('uuid_type')) die('skip not compiled in (HAVE_UUID_TYPE)'); + + ?> --FILE-- <?php -echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo uuid_type("00000000-0000-0000-0000-000000000000")."\n"; +echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488") == UUID_TYPE_TIME ? "OK\n" : "Failure\n"; +echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b") == UUID_TYPE_RANDOM ? "OK\n" : "Failure\n"; +echo uuid_type("00000000-0000-0000-0000-000000000000") == UUID_TYPE_NULL ? "OK\n" : "Failure\n"; + ?> --EXPECT-- -1 -4 --1 - - +OK +OK +OK http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_variant.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_variant.phpt diff -u pecl/uuid/tests/uuid_variant.phpt:1.1 pecl/uuid/tests/uuid_variant.phpt:1.2 --- pecl/uuid/tests/uuid_variant.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_variant.phpt Thu Mar 27 22:10:00 2008 @@ -1,19 +1,21 @@ --TEST-- -UUID variant detection +uuid_variant() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + +if(!function_exists('uuid_variant')) die('skip not compiled in (HAVE_UUID_VARIANT)'); + + ?> --FILE-- <?php echo uuid_variant("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; echo uuid_variant("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; echo uuid_variant("00000000-0000-0000-0000-000000000000")."\n"; + ?> --EXPECT-- 1 1 -0 - - +-1 http://cvs.php.net/viewvc.cgi/pecl/uuid/package2.xml?view=markup&rev=1.1 Index: pecl/uuid/package2.xml +++ pecl/uuid/package2.xml <?xml version="1.0"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>uuid</name> <channel>pecl.php.net</channel> <summary>UUID extension</summary> <description> A wrapper around libuuid from the ext2utils project. </description> <lead> <name>Hartmut Holzgraefe</name> <user>hholzgra</user> <email>hartmut@php.net</email> <active>yes</active> </lead> <date>2006-06-24</date> <version> <release>0.1</release> <api>0.1</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <license uri="http://www.gnu.org/licenses/licenses.html#LGPL" filesource="LICENSE">LGPL</license> <notes> first tests </notes> <contents> <dir name="/"> <file role='doc' name='EXPERIMENTAL'/> <file role='doc' name='CREDITS'/> <file role='src' name='config.m4'/> <file role='src' name='uuid.c'/> <file role='src' name='php_uuid.h'/> <dir name="tests"> <file role='test' name='uuid_create.phpt'/> <file role='test' name='uuid_is_valid.phpt'/> <file role='test' name='uuid_compare.phpt'/> <file role='test' name='uuid_is_null.phpt'/> <file role='test' name='uuid_type.phpt'/> <file role='test' name='uuid_variant.phpt'/> <file role='test' name='uuid_time.phpt'/> <file role='test' name='uuid_mac.phpt'/> <file role='test' name='uuid_parse.phpt'/> <file role='test' name='uuid_unparse.phpt'/> </dir> </dir> </contents> <dependencies> <required> <php> <min>4.0.0</min> </php> <pearinstaller> <min>1.4.0a1</min> </pearinstaller> <os><name>unix</name></os> </required> </dependencies> <providesextension>uuid</providesextension> <extsrcrelease> <configureoption name="with-uuid" default="autodetect" prompt="uuid installation directory?" /> </extsrcrelease> </package> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/file-entities.ent?view=markup&rev=1.1 Index: pecl/uuid/manual/file-entities.ent +++ pecl/uuid/manual/file-entities.ent <!ENTITY reference.uuid.reference SYSTEM './uuid/reference.xml'> <!ENTITY reference.uuid.constants SYSTEM './uuid/constants.xml'> <!ENTITY reference.uuid.ini SYSTEM './uuid/ini.xml'> <!ENTITY reference.uuid.configure SYSTEM './uuid/configure.xml'> <!ENTITY reference.uuid.functions.uuid-create SYSTEM './uuid/functions/uuid-create.xml'> <!ENTITY reference.uuid.functions.uuid-is-valid SYSTEM './uuid/functions/uuid-is-valid.xml'> <!ENTITY reference.uuid.functions.uuid-compare SYSTEM './uuid/functions/uuid-compare.xml'> <!ENTITY reference.uuid.functions.uuid-is-null SYSTEM './uuid/functions/uuid-is-null.xml'> <!ENTITY reference.uuid.functions.uuid-type SYSTEM './uuid/functions/uuid-type.xml'> <!ENTITY reference.uuid.functions.uuid-variant SYSTEM './uuid/functions/uuid-variant.xml'> <!ENTITY reference.uuid.functions.uuid-time SYSTEM './uuid/functions/uuid-time.xml'> <!ENTITY reference.uuid.functions.uuid-mac SYSTEM './uuid/functions/uuid-mac.xml'> <!ENTITY reference.uuid.functions.uuid-parse SYSTEM './uuid/functions/uuid-parse.xml'> <!ENTITY reference.uuid.functions.uuid-unparse SYSTEM './uuid/functions/uuid-unparse.xml'> <!ENTITY reference.uuid.functions SYSTEM './functions.xml'> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/functions.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/functions.xml +++ pecl/uuid/manual/functions.xml &reference.uuid.functions.uuid-compare; &reference.uuid.functions.uuid-create; &reference.uuid.functions.uuid-is-null; &reference.uuid.functions.uuid-is-valid; &reference.uuid.functions.uuid-mac; &reference.uuid.functions.uuid-parse; &reference.uuid.functions.uuid-time; &reference.uuid.functions.uuid-type; &reference.uuid.functions.uuid-unparse; &reference.uuid.functions.uuid-variant; http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/manual.xml.in?view=markup&rev=1.1 Index: pecl/uuid/manual/manual.xml.in +++ pecl/uuid/manual/manual.xml.in <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.1.2//EN' '@PHPDOC@/dtds/dbxml-4.1.2/docbookx.dtd' [ <!-- Add translated specific definitions and snippets --> <!ENTITY % language-defs SYSTEM '@PHPDOC@/en/language-defs.ent'> <!ENTITY % language-snippets SYSTEM '@PHPDOC@/en/language-snippets.ent'> %language-defs; %language-snippets; <!-- Fallback to English definitions and snippets (in case of missing translation) --> <!ENTITY % language-defs.default SYSTEM '@PHPDOC@/en/language-defs.ent'> <!ENTITY % language-snippets.default SYSTEM '@PHPDOC@/en/language-snippets.ent'> <!ENTITY % extensions.default SYSTEM '@PHPDOC@/en/extensions.ent'> %language-defs.default; %language-snippets.default; %extensions.default; <!-- All global entities for the XML files --> <!ENTITY % global.entities SYSTEM '@PHPDOC@/entities/global.ent'> <!ENTITY % file.entities SYSTEM './file-entities.ent'> <!-- Include all external DTD parts defined previously --> %global.entities; %file.entities; <!-- Autogenerated missing entites and IDs to make build work --> <!ENTITY % missing-entities SYSTEM '@PHPDOC@/entities/missing-entities.ent'> %missing-entities; ]> <book id='manual' lang='en'> &reference.uuid.reference; </book> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/configure.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/configure.xml +++ pecl/uuid/manual/uuid/configure.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.requirements'> &reftitle.required; &no.requirement; </section> <section id='uuid.install'> &reftitle.install; <para>Requires <literal>uuid</literal></para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/constants.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/constants.xml +++ pecl/uuid/manual/uuid/constants.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.constants' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> &reftitle.constants; &extension.constants; <para> <variablelist> <varlistentry> <term> <constant>UUID_VARIANT_NCS</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_DCE</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_MICROSOFT</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_OTHER</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_DEFAULT</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_TIME</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_DCE</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_NAME</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_RANDOM</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_NULL</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_INVALID</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> </variablelist> </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/ini.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/ini.xml +++ pecl/uuid/manual/uuid/ini.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.configuration' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> &reftitle.runtime; &extension.runtime; <para> &no.config; </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/reference.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/reference.xml +++ pecl/uuid/manual/uuid/reference.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <!-- Purpose: utilspec --> <!-- Membership: pecl, external --> <!-- State: experimental --> <reference xml:id='ref.uuid' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> <title>UUID extension</title> <titleabbrev>uuid</titleabbrev> <partintro> <section id='uuid.intro'> &reftitle.intro; <para> A wrapper around libuuid from the ext2utils project. </para> </section> <section xml:id='uuid.requirements'> &reftitle.required; <para> </para> </section> &reference.uuid.configure; &reference.extname.ini; <section id='uuid.resources'> &reftitle.resources; &no.resource; </section> &reference.extname.constants; </partintro> &reference.uuid.functions; </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-compare.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-compare.xml +++ pecl/uuid/manual/uuid/functions/uuid-compare.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-compare"> <refnamediv> <refname>uuid_compare</refname> <refpurpose>Compare two UUIDs</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_compare</methodname> <methodparam><type>string</type><parameter>uuid1</parameter></methodparam> <methodparam><type>string</type><parameter>uuid2</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-create.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-create.xml +++ pecl/uuid/manual/uuid/functions/uuid-create.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-create"> <refnamediv> <refname>uuid_create</refname> <refpurpose>Generate a new UUID</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_create</methodname> <methodparam choice='opt'><type>int</type><parameter>uuid_type</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-is-null.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-is-null.xml +++ pecl/uuid/manual/uuid/functions/uuid-is-null.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-is-null"> <refnamediv> <refname>uuid_is_null</refname> <refpurpose>Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>uuid_is_null</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-is-valid.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-is-valid.xml +++ pecl/uuid/manual/uuid/functions/uuid-is-valid.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-is-valid"> <refnamediv> <refname>uuid_is_valid</refname> <refpurpose>Check whether a given UUID string is a valid UUID</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>uuid_is_valid</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> add some text here </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-mac.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-mac.xml +++ pecl/uuid/manual/uuid/functions/uuid-mac.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-mac"> <refnamediv> <refname>uuid_mac</refname> <refpurpose>Get UUID creator network MAC address</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_mac</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-parse.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-parse.xml +++ pecl/uuid/manual/uuid/functions/uuid-parse.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-parse"> <refnamediv> <refname>uuid_parse</refname> <refpurpose></refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_parse</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-time.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-time.xml +++ pecl/uuid/manual/uuid/functions/uuid-time.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-time"> <refnamediv> <refname>uuid_time</refname> <refpurpose>Extract creation time from a time based UUID as UNIX timestamp</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_time</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-type.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-type.xml +++ pecl/uuid/manual/uuid/functions/uuid-type.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-type"> <refnamediv> <refname>uuid_type</refname> <refpurpose>Return the UUIDs type</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_type</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-unparse.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-unparse.xml +++ pecl/uuid/manual/uuid/functions/uuid-unparse.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-unparse"> <refnamediv> <refname>uuid_unparse</refname> <refpurpose></refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_unparse</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-variant.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-variant.xml +++ pecl/uuid/manual/uuid/functions/uuid-variant.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-variant"> <refnamediv> <refname>uuid_variant</refname> <refpurpose>Return the UUIDs variant</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_variant</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_parse.phpt?view=markup&rev=1.1 Index: pecl/uuid/tests/uuid_parse.phpt +++ pecl/uuid/tests/uuid_parse.phpt --TEST-- uuid_parse() function --SKIPIF-- <?php if(!extension_loaded('uuid')) die('skip '); ?> --FILE-- <?php var_dump(uuid_parse("61616161-6161-6161-6161-616161616161")); ?> --EXPECT-- string(16) "aaaaaaaaaaaaaaaa" http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_unparse.phpt?view=markup&rev=1.1 Index: pecl/uuid/tests/uuid_unparse.phpt +++ pecl/uuid/tests/uuid_unparse.phpt --TEST-- uuid_unparse() function --SKIPIF-- <?php if(!extension_loaded('uuid')) die('skip '); ?> --FILE-- <?php var_dump(uuid_unparse("aaaaaaaaaaaaaaaa")); ?> --EXPECT-- string(36) "61616161-6161-6161-6161-616161616161"
http://cvs.php.net/viewvc.cgi/pecl/uuid/EXPERIMENTAL?r1=1.2&r2=1.3&diff_format=u Index: pecl/uuid/EXPERIMENTAL diff -u /dev/null pecl/uuid/EXPERIMENTAL:1.3 --- /dev/null Thu Mar 27 22:10:00 2008 +++ pecl/uuid/EXPERIMENTAL Thu Mar 27 22:09:59 2008 @@ -0,0 +1,5 @@ +this extension is experimental, +its functions may change their names +or move to extension all together +so do not rely to much on them +you have been warned! http://cvs.php.net/viewvc.cgi/pecl/uuid/.cvsignore?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/.cvsignore diff -u pecl/uuid/.cvsignore:1.1 pecl/uuid/.cvsignore:1.2 --- pecl/uuid/.cvsignore:1.1 Wed Nov 27 12:56:22 2002 +++ pecl/uuid/.cvsignore Thu Mar 27 22:09:59 2008 @@ -1,3 +1,33 @@ -.deps *.lo *.la +.deps +.libs +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +autom4te.cache +build +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +conftest +conftest.c +include +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +modules +scan_makefile_in.awk +uuid*.tgz http://cvs.php.net/viewvc.cgi/pecl/uuid/CREDITS?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/CREDITS diff -u pecl/uuid/CREDITS:1.1 pecl/uuid/CREDITS:1.2 --- pecl/uuid/CREDITS:1.1 Wed Nov 27 12:55:49 2002 +++ pecl/uuid/CREDITS Thu Mar 27 22:09:59 2008 @@ -1,2 +1,2 @@ uuid -Hartmut Holzgraefe \ No newline at end of file +Hartmut Holzgraefe http://cvs.php.net/viewvc.cgi/pecl/uuid/config.m4?r1=1.3&r2=1.4&diff_format=u Index: pecl/uuid/config.m4 diff -u pecl/uuid/config.m4:1.3 pecl/uuid/config.m4:1.4 --- pecl/uuid/config.m4:1.3 Tue Mar 25 22:53:20 2008 +++ pecl/uuid/config.m4 Thu Mar 27 22:09:59 2008 @@ -1,20 +1,44 @@ -dnl $Id: config.m4,v 1.3 2008/03/25 22:53:20 hholzgra Exp $ -dnl config.m4 for extension uuid +dnl +dnl $ Id: $ +dnl -dnl Comments in this file start with the string 'dnl'. -dnl Remove where necessary. This file will not work -dnl without editing. +PHP_ARG_WITH(uuid, whether uuid is available,[ --with-uuid[=DIR] With uuid support]) -dnl If your extension references something external, use with: - -PHP_ARG_WITH(uuid, for uuid support, - [ --with-uuid Include uuid support]) if test "$PHP_UUID" != "no"; then - AC_DEFINE(HAVE_UUID, 1, [ ]) - PHP_ADD_LIBRARY(uuid, 1, UUID_SHARED_LIBADD) - PHP_CHECK_FUNC_LIB(uuid_type, uuid) - PHP_CHECK_FUNC_LIB(uuid_variant, uuid) - PHP_NEW_EXTENSION(uuid, uuid.c, $ext_shared) + PHP_CHECK_FUNC_LIB(uuid_type, uuid) + PHP_CHECK_FUNC_LIB(uuid_variant, uuid) + + + PHP_ADD_INCLUDE($PHP_UUID_DIR/include) + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID" + AC_CHECK_HEADER([uuid/uuid.h], [], AC_MSG_ERROR('uuid/uuid.h' header not found)) + PHP_SUBST(UUID_SHARED_LIBADD) + + PHP_ADD_LIBRARY_WITH_PATH(uuid, $PHP_UUID_DIR/lib, UUID_SHARED_LIBADD) + export CPPFLAGS="$OLD_CPPFLAGS" + + export OLD_CPPFLAGS="$CPPFLAGS" + export CPPFLAGS="$CPPFLAGS $INCLUDES -DHAVE_UUID" + + AC_MSG_CHECKING(PHP version) + AC_TRY_COMPILE([#include <php_version.h>], [ +#if PHP_VERSION_ID < 40000 +#error this extension requires at least PHP version 4.0.0 +#endif +], +[AC_MSG_RESULT(ok)], +[AC_MSG_ERROR([need at least PHP 4.0.0])]) + + export CPPFLAGS="$OLD_CPPFLAGS" + + PHP_SUBST(UUID_SHARED_LIBADD) + AC_DEFINE(HAVE_UUID, 1, [ ]) + + PHP_NEW_EXTENSION(uuid, uuid.c , $ext_shared) + fi + http://cvs.php.net/viewvc.cgi/pecl/uuid/package.xml?r1=1.4&r2=1.5&diff_format=u Index: pecl/uuid/package.xml diff -u pecl/uuid/package.xml:1.4 pecl/uuid/package.xml:1.5 --- pecl/uuid/package.xml:1.4 Tue Mar 25 22:53:20 2008 +++ pecl/uuid/package.xml Thu Mar 27 22:09:59 2008 @@ -1,95 +1,62 @@ -<?xml version="1.0" encoding="UTF-8"?> -<package packagerversion="1.7.1" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 -http://pear.php.net/dtd/tasks-1.0.xsd -http://pear.php.net/dtd/package-2.0 -http://pear.php.net/dtd/package-2.0.xsd"> - <name>uuid</name> - <channel>pecl.php.net</channel> - <summary>UUID support functions</summary> - <description>This extension provides functions to generate and analyse -universally unique identifiers (UUIDs). It depends on the -external libuuid. This library is available on most linux -systems (its source is there bundled with the ext2fs tools) -and on Solaris. - </description> - <lead> - <name>Hartmut Holzgraefe</name> - <user>hholzgra</user> - <email>hholzgra@php.net</email> - <active>yes</active> - </lead> - <date>2008-03-25</date> - <time>23:51:21</time> - <version> - <release>1.0.1</release> - <api>1.0.1</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Now works with Solaris libuuid implementation, too - </notes> - <contents> - <dir name="/"> - <dir name="tests"> - <file name="uuid_compare.phpt" role="test" /> - <file name="uuid_create.phpt" role="test" /> - <file name="uuid_is_null.phpt" role="test" /> - <file name="uuid_is_valid.phpt" role="test" /> - <file name="uuid_mac.phpt" role="test" /> - <file name="uuid_time.phpt" role="test" /> - <file name="uuid_type.phpt" role="test" /> - <file name="uuid_variant.phpt" role="test" /> - </dir> <!-- //tests --> - <file name="config.m4" role="src" /> - <file name="CREDITS" role="doc" /> - <file name="php_uuid.h" role="src" /> - <file name="uuid.c" role="src" /> - <file name="uuid.xml" role="doc" /> - </dir> <!-- / --> - </contents> - <dependencies> - <required> - <php> - <min>4.0.0</min> - </php> - <pearinstaller> - <min>1.4.0b1</min> - </pearinstaller> - </required> - </dependencies> - <providesextension>uuid</providesextension> - <extsrcrelease /> - <changelog> +<?xml version="1.0"?> +<!DOCTYPE package SYSTEM "http://pear.php.net/dtd/package-1.0"> +<package> + + <name>uuid</name> + <summary>UUID extension</summary> + <description> + A wrapper around libuuid from the ext2utils project. + </description> + + <license>LGPL</license> + + <configureoptions> + <configureoption name="with-uuid" default="autodetect" prompt="uuid installation directory?" /> + </configureoptions> + + <maintainers> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> + </maintainers> + <release> - <version> - <release>0.9</release> - <api>0.9</api> - </version> - <stability> - <release>beta</release> - <api>beta</api> - </stability> - <date>2003-02-10</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Initial 'official' beta release. - </notes> + <version>0.1</version> + <state>alpha</state> + <notes> first tests +</notes> + <date>2006-06-24</date> </release> - <release> - <version> - <release>1.0</release> - <api>1.0</api> - </version> - <stability> - <release>stable</release> - <api>stable</api> - </stability> - <date>2004-03-27</date> - <license uri="http://www.php.net/license">PHP License</license> - <notes>Official 1.0 stable release - </notes> - </release> - </changelog> + <changelog> + + </changelog> + <deps> + <dep type="php" rel="ge" version="4.0.0"/> + <dep type='os' rel='has' name='unix'/> + </deps> + + <filelist> + <dir name="/"> + <file role='doc' name='EXPERIMENTAL'/> + <file role='doc' name='CREDITS'/> + <file role='src' name='config.m4'/> + <file role='src' name='uuid.c'/> + <file role='src' name='php_uuid.h'/> + <dir name="tests"> + <file role='test' name='uuid_create.phpt'/> + <file role='test' name='uuid_is_valid.phpt'/> + <file role='test' name='uuid_compare.phpt'/> + <file role='test' name='uuid_is_null.phpt'/> + <file role='test' name='uuid_type.phpt'/> + <file role='test' name='uuid_variant.phpt'/> + <file role='test' name='uuid_time.phpt'/> + <file role='test' name='uuid_mac.phpt'/> + <file role='test' name='uuid_parse.phpt'/> + <file role='test' name='uuid_unparse.phpt'/> + </dir> + </dir> + </filelist> </package> http://cvs.php.net/viewvc.cgi/pecl/uuid/php_uuid.h?r1=1.5&r2=1.6&diff_format=u Index: pecl/uuid/php_uuid.h diff -u pecl/uuid/php_uuid.h:1.5 pecl/uuid/php_uuid.h:1.6 --- pecl/uuid/php_uuid.h:1.5 Tue Mar 25 23:03:24 2008 +++ pecl/uuid/php_uuid.h Thu Mar 27 22:09:59 2008 @@ -1,27 +1,60 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 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. | - +----------------------------------------------------------------------+ - | Author: Hartmut Holzgraefe <hartmut@php.net> | - +----------------------------------------------------------------------+ - - $Id: php_uuid.h,v 1.5 2008/03/25 23:03:24 hholzgra Exp $ + +----------------------------------------------------------------------+ + | This library is free software; you can redistribute it and/or | + | modify it under the terms of the GNU Lesser General Public | + | License as published by the Free Software Foundation; either | + | version 2.1 of the License, or (at your option) any later version. | + | | + | This library 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 | + | Lesser General Public License for more details. | + | | + | You should have received a copy of the GNU Lesser General Public | + | License in the file LICENSE along with this library; | + | if not, write to the | + | | + | Free Software Foundation, Inc., | + | 59 Temple Place, Suite 330, | + | Boston, MA 02111-1307 USA | + +----------------------------------------------------------------------+ + | Authors: Hartmut Holzgraefe <hartmut@php.net> | + +----------------------------------------------------------------------+ */ +/* $ Id: $ */ + #ifndef PHP_UUID_H #define PHP_UUID_H -#define PHP_UUID_VERSION "1.0.1" +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <php.h> + +#ifdef HAVE_UUID +#define PHP_UUID_VERSION "0.1" + + +#include <php_ini.h> +#include <SAPI.h> +#include <ext/standard/info.h> +#include <Zend/zend_extensions.h> +#ifdef __cplusplus +} // extern "C" +#endif +#include <uuid/uuid.h> +#ifdef __cplusplus +extern "C" { +#endif + +extern zend_module_entry uuid_module_entry; +#define phpext_uuid_ptr &uuid_module_entry #ifdef PHP_WIN32 #define PHP_UUID_API __declspec(dllexport) @@ -29,28 +62,148 @@ #define PHP_UUID_API #endif -extern zend_module_entry uuid_module_entry; -#define phpext_uuid_ptr &uuid_module_entry - PHP_MINIT_FUNCTION(uuid); +PHP_MSHUTDOWN_FUNCTION(uuid); +PHP_RINIT_FUNCTION(uuid); +PHP_RSHUTDOWN_FUNCTION(uuid); PHP_MINFO_FUNCTION(uuid); +#ifdef ZTS +#include "TSRM.h" +#endif + +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + + PHP_FUNCTION(uuid_create); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_create_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, uuid_type) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_create_arg_info NULL +#endif + +PHP_FUNCTION(uuid_is_valid); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_is_valid_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_is_valid_arg_info NULL +#endif + PHP_FUNCTION(uuid_compare); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_compare_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, uuid1) + ZEND_ARG_INFO(0, uuid2) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_compare_arg_info NULL +#endif + PHP_FUNCTION(uuid_is_null); -PHP_FUNCTION(uuid_is_valid); -PHP_FUNCTION(uuid_variant); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_is_null_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_is_null_arg_info NULL +#endif + +#if HAVE_UUID_TYPE PHP_FUNCTION(uuid_type); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_type_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_type_arg_info NULL +#endif + +#endif /* HAVE_UUID_TYPE */ +#if HAVE_UUID_VARIANT +PHP_FUNCTION(uuid_variant); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_variant_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_variant_arg_info NULL +#endif + +#endif /* HAVE_UUID_VARIANT */ PHP_FUNCTION(uuid_time); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_time_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_time_arg_info NULL +#endif + PHP_FUNCTION(uuid_mac); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_mac_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_mac_arg_info NULL +#endif + +PHP_FUNCTION(uuid_parse); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_parse_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_parse_arg_info NULL +#endif + +PHP_FUNCTION(uuid_unparse); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(uuid_unparse_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, uuid) +ZEND_END_ARG_INFO() +#else /* PHP 4.x */ +#define uuid_unparse_arg_info NULL +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +/* mirrored PHP Constants */ +#define UUID_TYPE_DEFAULT 0 +#define UUID_TYPE_TIME UUID_TYPE_DCE_TIME +#define UUID_TYPE_DCE UUID_TYPE_DCE_RANDOM +#define UUID_TYPE_NAME UUID_TYPE_DCE_TIME +#define UUID_TYPE_RANDOM UUID_TYPE_DCE_RANDOM +#define UUID_TYPE_NULL -1 +#define UUID_TYPE_INVALID -42 + +#endif /* PHP_HAVE_UUID */ -#endif /* PHP_UUID_H */ +#endif /* PHP_UUID_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 - * indent-tabs-mode: t * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 */ http://cvs.php.net/viewvc.cgi/pecl/uuid/uuid.c?r1=1.7&r2=1.8&diff_format=u Index: pecl/uuid/uuid.c diff -u pecl/uuid/uuid.c:1.7 pecl/uuid/uuid.c:1.8 --- pecl/uuid/uuid.c:1.7 Tue Mar 25 23:03:24 2008 +++ pecl/uuid/uuid.c Thu Mar 27 22:09:59 2008 @@ -1,65 +1,64 @@ /* - +----------------------------------------------------------------------+ - | PHP Version 4 | - +----------------------------------------------------------------------+ - | Copyright (c) 1997-2003 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. | - +----------------------------------------------------------------------+ - | Author: Hartmut Holzgraefe <hartmut@php.net> | - +----------------------------------------------------------------------+ - - $Id: uuid.c,v 1.7 2008/03/25 23:03:24 hholzgra Exp $ + +----------------------------------------------------------------------+ + | This library is free software; you can redistribute it and/or | + | modify it under the terms of the GNU Lesser General Public | + | License as published by the Free Software Foundation; either | + | version 2.1 of the License, or (at your option) any later version. | + | | + | This library 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 | + | Lesser General Public License for more details. | + | | + | You should have received a copy of the GNU Lesser General Public | + | License in the file LICENSE along with this library; | + | if not, write to the | + | | + | Free Software Foundation, Inc., | + | 59 Temple Place, Suite 330, | + | Boston, MA 02111-1307 USA | + +----------------------------------------------------------------------+ + | Authors: Hartmut Holzgraefe <hartmut@php.net> | + +----------------------------------------------------------------------+ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +/* $ Id: $ */ -#include "php.h" -#include "php_ini.h" -#include "ext/standard/info.h" #include "php_uuid.h" -#include <uuid/uuid.h> - -#define UUID_TYPE_DEFAULT 0 -#define UUID_TYPE_TIME 1 -#define UUID_TYPE_DCE 2 -#define UUID_TYPE_NAME 3 -#define UUID_TYPE_RANDOM 4 -#define UUID_TYPE_NULL -1 +#if HAVE_UUID /* {{{ uuid_functions[] */ function_entry uuid_functions[] = { - PHP_FE(uuid_create, NULL) - PHP_FE(uuid_compare, NULL) - PHP_FE(uuid_is_null, NULL) - PHP_FE(uuid_is_valid, NULL) - PHP_FE(uuid_variant, NULL) - PHP_FE(uuid_type, NULL) - PHP_FE(uuid_time, NULL) - PHP_FE(uuid_mac, NULL) - {NULL, NULL, NULL} + PHP_FE(uuid_create , uuid_create_arg_info) + PHP_FE(uuid_is_valid , uuid_is_valid_arg_info) + PHP_FE(uuid_compare , uuid_compare_arg_info) + PHP_FE(uuid_is_null , uuid_is_null_arg_info) +#if HAVE_UUID_TYPE + PHP_FE(uuid_type , uuid_type_arg_info) +#endif /* HAVE_UUID_TYPE */ +#if HAVE_UUID_VARIANT + PHP_FE(uuid_variant , uuid_variant_arg_info) +#endif /* HAVE_UUID_VARIANT */ + PHP_FE(uuid_time , uuid_time_arg_info) + PHP_FE(uuid_mac , uuid_mac_arg_info) + PHP_FE(uuid_parse , uuid_parse_arg_info) + PHP_FE(uuid_unparse , uuid_unparse_arg_info) + { NULL, NULL, NULL } }; /* }}} */ + /* {{{ uuid_module_entry */ zend_module_entry uuid_module_entry = { STANDARD_MODULE_HEADER, "uuid", uuid_functions, - PHP_MINIT(uuid), - NULL, - NULL, - NULL, + PHP_MINIT(uuid), /* Replace with NULL if there is nothing to do at php startup */ + PHP_MSHUTDOWN(uuid), /* Replace with NULL if there is nothing to do at php shutdown */ + PHP_RINIT(uuid), /* Replace with NULL if there is nothing to do at request start */ + PHP_RSHUTDOWN(uuid), /* Replace with NULL if there is nothing to do at request end */ PHP_MINFO(uuid), PHP_UUID_VERSION, STANDARD_MODULE_PROPERTIES @@ -70,237 +69,382 @@ ZEND_GET_MODULE(uuid) #endif -/* {{{ PHP_MINIT_FUNCTION - */ + +/* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(uuid) { - REGISTER_LONG_CONSTANT("UUID_TYPE_TIME", UUID_TYPE_TIME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_DCE", UUID_TYPE_DCE, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_NAME", UUID_TYPE_NAME, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_RANDOM", UUID_TYPE_RANDOM, CONST_CS | CONST_PERSISTENT); - REGISTER_LONG_CONSTANT("UUID_TYPE_NULL", UUID_TYPE_NULL, CONST_CS | CONST_PERSISTENT); +#if UUID_VARIANT_NCS + REGISTER_LONG_CONSTANT("UUID_VARIANT_NCS", UUID_VARIANT_NCS, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_NCS */ +#if UUID_VARIANT_DCE + REGISTER_LONG_CONSTANT("UUID_VARIANT_DCE", UUID_VARIANT_DCE, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_DCE */ +#if UUID_VARIANT_MICROSOFT + REGISTER_LONG_CONSTANT("UUID_VARIANT_MICROSOFT", UUID_VARIANT_MICROSOFT, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_MICROSOFT */ +#if UUID_VARIANT_OTHER + REGISTER_LONG_CONSTANT("UUID_VARIANT_OTHER", UUID_VARIANT_OTHER, CONST_PERSISTENT | CONST_CS); +#endif /* UUID_VARIANT_OTHER */ + REGISTER_LONG_CONSTANT("UUID_TYPE_DEFAULT", 0, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_TIME", UUID_TYPE_DCE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_DCE", UUID_TYPE_DCE_RANDOM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_NAME", UUID_TYPE_DCE_TIME, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_RANDOM", UUID_TYPE_DCE_RANDOM, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_NULL", -1, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("UUID_TYPE_INVALID", -42, CONST_PERSISTENT | CONST_CS); -#ifdef UUID_VARIANT_NCS - REGISTER_LONG_CONSTANT("UUID_VARIANT_NCS", UUID_VARIANT_NCS, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_DCE - REGISTER_LONG_CONSTANT("UUID_VARIANT_DCE", UUID_VARIANT_DCE, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_MICROSOFT - REGISTER_LONG_CONSTANT("UUID_VARIANT_MICROSOFT", UUID_VARIANT_MICROSOFT, CONST_CS | CONST_PERSISTENT); -#endif -#ifdef UUID_VARIANT_OTHER - REGISTER_LONG_CONSTANT("UUID_VARIANT_OTHER", UUID_VARIANT_OTHER, CONST_CS | CONST_PERSISTENT); -#endif + /* add your stuff here */ return SUCCESS; } /* }}} */ -/* {{{ PHP_MINFO_FUNCTION - */ + +/* {{{ PHP_MSHUTDOWN_FUNCTION */ +PHP_MSHUTDOWN_FUNCTION(uuid) +{ + + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_RINIT_FUNCTION */ +PHP_RINIT_FUNCTION(uuid) +{ + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_RSHUTDOWN_FUNCTION */ +PHP_RSHUTDOWN_FUNCTION(uuid) +{ + /* add your stuff here */ + + return SUCCESS; +} +/* }}} */ + + +/* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(uuid) { - php_info_print_table_start(); - php_info_print_table_row(2, "uuid support", "enabled"); - php_info_print_table_row(2, "uuid version", PHP_UUID_VERSION); - php_info_print_table_end(); + php_info_print_box_start(0); + php_printf("<p>UUID extension</p>\n"); + php_printf("<p>Version %s alpha (2006-06-24) $Id: uuid.c,v 1.8 2008/03/27 22:09:59 hholzgra Exp $</p>\n", PHP_UUID_VERSION); + php_printf("<p><b>Authors:</b></p>\n"); + php_printf("<p>Hartmut Holzgraefe <hartmut@php.net> (lead)</p>\n"); + php_info_print_box_end(); + /* add your stuff here */ + } /* }}} */ -/* {{{ proto string uuid_create([int type]) - Create a UUID */ +/* {{{ proto string uuid_create([int uuid_type]) + Generate a new UUID */ PHP_FUNCTION(uuid_create) { - int argc = ZEND_NUM_ARGS(); - long type = UUID_TYPE_DEFAULT; - uuid_t uuid; - char uuid_str[37]; - if (zend_parse_parameters(argc TSRMLS_CC, "|l", &type) == FAILURE) + long uuid_type = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &uuid_type) == FAILURE) { return; + } - switch (type) { - case UUID_TYPE_TIME: - case UUID_TYPE_NAME: - /* Generate Time/System Name based UUID */ - uuid_generate_time(uuid); - break; - case UUID_TYPE_DCE: - case UUID_TYPE_RANDOM: - /* Generate Random based UUID, much better */ - uuid_generate_random(uuid); - break; - case UUID_TYPE_NULL: - /* null UUID */ - uuid_clear(uuid); - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, - "Unknown/invalid UUID type '%d' requested, using default type instead", - type); - /* fallthru */ - case UUID_TYPE_DEFAULT: - /* Fall back and use the system default. In most cases this - is the Random Based one. */ - uuid_generate(uuid); - } + do { + uuid_t uuid; + char uuid_str[37]; + + switch(uuid_type) { + case UUID_TYPE_DCE_TIME: + uuid_generate_time(uuid); + break; + case UUID_TYPE_DCE_RANDOM: + uuid_generate_random(uuid); + break; + case UUID_TYPE_DEFAULT: + uuid_generate(uuid); + break; + default: + php_error_docref(NULL TSRMLS_CC, + E_WARNING, + "Unknown/invalid UUID type '%d' requested, using default type instead", + uuid_type); + uuid_generate(uuid); + break; + } - uuid_unparse(uuid, uuid_str); + uuid_unparse(uuid, uuid_str); - RETURN_STRING(uuid_str, 1); + RETURN_STRING(uuid_str, 1); + } while (0); } -/* }}} */ +/* }}} uuid_create */ + + +/* {{{ proto bool uuid_is_valid(string uuid) + Check whether a given UUID string is a valid UUID */ +PHP_FUNCTION(uuid_is_valid) +{ + + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + uuid_t u; + RETURN_BOOL(0 == uuid_parse(uuid, u)); + } while (0); +} +/* }}} uuid_is_valid */ + /* {{{ proto int uuid_compare(string uuid1, string uuid2) - Compare two UUIDs */ + Compare two UUIDs */ PHP_FUNCTION(uuid_compare) { - int argc = ZEND_NUM_ARGS(); - char *uuid1 = NULL, *uuid2 = NULL; - int uuid1_len, uuid2_len; - uuid_t u1, u2; - if (zend_parse_parameters(argc TSRMLS_CC, "ss", &uuid1, &uuid1_len, &uuid2, &uuid2_len) == FAILURE) + const char * uuid1 = NULL; + int uuid1_len = 0; + const char * uuid2 = NULL; + int uuid2_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &uuid1, &uuid1_len, &uuid2, &uuid2_len) == FAILURE) { return; + } + + do { + uuid_t u1, u2; - if(uuid_parse(uuid1, u1)) RETURN_FALSE; - if(uuid_parse(uuid2, u2)) RETURN_FALSE; + if(uuid_parse(uuid1, u1)) RETURN_FALSE; + if(uuid_parse(uuid2, u2)) RETURN_FALSE; - RETURN_LONG(uuid_compare(u1, u2)); + RETURN_LONG(uuid_compare(u1, u2)); + } while (0); } -/* }}} */ +/* }}} uuid_compare */ + /* {{{ proto bool uuid_is_null(string uuid) - Check for NULL UUID */ + Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000 */ PHP_FUNCTION(uuid_is_null) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; - - if(uuid_parse(uuid, u)) RETURN_FALSE; - - if(uuid_is_null(u)) RETURN_TRUE; + } + + do { + uuid_t u; - RETURN_FALSE; + if(uuid_parse(uuid, u)) RETURN_FALSE; + + RETURN_BOOL(uuid_is_null(u)); + } while (0); } -/* }}} */ +/* }}} uuid_is_null */ -/* {{{ proto bool uuid_is_valid(string uuid) - Validate UUID */ -PHP_FUNCTION(uuid_is_valid) + +#if HAVE_UUID_TYPE +/* {{{ proto int uuid_type(string uuid) + Return the UUIDs type */ +PHP_FUNCTION(uuid_type) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; - - if(uuid_parse(uuid, u)) RETURN_FALSE; - - RETURN_TRUE; + } + + do { + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_type(u)); + } while (0); } -/* }}} */ +/* }}} uuid_type */ + +#endif /* HAVE_UUID_TYPE */ #if HAVE_UUID_VARIANT /* {{{ proto int uuid_variant(string uuid) - Get UUID variant */ + Return the UUIDs variant */ PHP_FUNCTION(uuid_variant) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) - return; - if(uuid_parse(uuid, u)) RETURN_FALSE; + const char * uuid = NULL; + int uuid_len = 0; - RETURN_LONG(uuid_variant(u)); -} -/* }}} */ -#endif -#if HAVE_UUID_TYPE -/* {{{ proto int uuid_type(string uuid) - Get UUID type */ -PHP_FUNCTION(uuid_type) -{ - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } - if(uuid_parse(uuid, u)) RETURN_FALSE; + do { + uuid_t u; - if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + if(uuid_parse(uuid, u)) RETURN_FALSE; - RETURN_LONG(uuid_type(u)); + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_variant(u)); + } while (0); } -/* }}} */ -#endif +/* }}} uuid_variant */ + +#endif /* HAVE_UUID_VARIANT */ /* {{{ proto int uuid_time(string uuid) - Get UUID creation time as UNIX timestamp */ + Extract creation time from a time based UUID as UNIX timestamp */ PHP_FUNCTION(uuid_time) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } + + do { + uuid_t u; - if(uuid_parse(uuid, u)) RETURN_FALSE; + if(uuid_parse(uuid, u)) RETURN_FALSE; #if HAVE_UUID_VARIANT - if(uuid_variant(u) != 1) RETURN_FALSE; + if(uuid_variant(u) != 1) RETURN_FALSE; #endif #if HAVE_UUID_TYPE - if(uuid_type(u) != 1) RETURN_FALSE; -#endif - RETURN_LONG(uuid_time(u, NULL)); + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + RETURN_LONG(uuid_time(u, NULL)); + } while (0); } -/* }}} */ +/* }}} uuid_time */ + /* {{{ proto string uuid_mac(string uuid) - Get UUID creator network MAC address */ + Get UUID creator network MAC address */ PHP_FUNCTION(uuid_mac) { - int argc = ZEND_NUM_ARGS(); - char *uuid = NULL; - int uuid_len; - uuid_t u; - char uuid_str[37]; - if (zend_parse_parameters(argc TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { return; + } - if(uuid_parse(uuid, u)) RETURN_FALSE; + do { + uuid_t u; + char uuid_str[37]; + + if(uuid_parse(uuid, u)) RETURN_FALSE; #if HAVE_UUID_VARIANT - if(uuid_variant(u) != 1) RETURN_FALSE; + if(uuid_variant(u) != 1) RETURN_FALSE; #endif #if HAVE_UUID_TYPE - if(uuid_type(u) != 1) RETURN_FALSE; -#endif - if(uuid[10]&0x80) RETURN_FALSE; + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + if(uuid[10] & 0x80) RETURN_FALSE; // invalid MAC + + uuid_unparse(u, uuid_str); + RETURN_STRING((char *)(uuid_str + 24), 1); + } while (0); +} +/* }}} uuid_mac */ + + +/* {{{ proto string uuid_parse(string uuid) + */ +PHP_FUNCTION(uuid_parse) +{ + + const char * uuid = NULL; + int uuid_len = 0; + - uuid_unparse(u, uuid_str); - RETURN_STRING(uuid_str+24, 1); + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + uuid_t uuid_bin; + + if (uuid_parse(uuid, uuid_bin)) { + RETURN_FALSE; + } + + RETURN_STRINGL((char *)uuid_bin, sizeof(uuid_t), 1); + } while (0); } -/* }}} */ +/* }}} uuid_parse */ + + +/* {{{ proto string uuid_unparse(string uuid) + */ +PHP_FUNCTION(uuid_unparse) +{ + + const char * uuid = NULL; + int uuid_len = 0; + + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uuid, &uuid_len) == FAILURE) { + return; + } + + do { + char uuid_txt[37]; + + if (uuid_len != sizeof(uuid_t)) { + RETURN_FALSE; + } + + uuid_unparse((unsigned char *)uuid, uuid_txt); + + RETURN_STRINGL(uuid_txt, 36, 1); + } while (0); +} +/* }}} uuid_unparse */ + +#endif /* HAVE_UUID */ /* http://cvs.php.net/viewvc.cgi/pecl/uuid/uuid.xml?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/uuid.xml diff -u pecl/uuid/uuid.xml:1.1 pecl/uuid/uuid.xml:1.2 --- pecl/uuid/uuid.xml:1.1 Wed Nov 27 12:55:49 2002 +++ pecl/uuid/uuid.xml Thu Mar 27 22:09:59 2008 @@ -1,179 +1,427 @@ -<?xml version='1.0' encoding='iso-8859-1'?> -<!-- $Revision: 1.1 $ --> - <reference id="ref.uuid"> - <title> functions</title> - <titleabbrev></titleabbrev> - - <partintro> - &warn.experimental; - <para> - </para> - </partintro> - - - <refentry id="function.uuid-create"> - <refnamediv> - <refname>uuid_create</refname> - <refpurpose>Create a UUID</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>uuid_create</function></funcdef> - <paramdef>int - <parameter><optional>flags</optional></parameter> - </paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-cmp"> - <refnamediv> - <refname>uuid_cmp</refname> - <refpurpose>Compare two UUIDs</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_cmp</function></funcdef> - <paramdef>string <parameter>uuid1</parameter></paramdef> - <paramdef>string <parameter>uuid2</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-is-null"> - <refnamediv> - <refname>uuid_is_null</refname> - <refpurpose>Check for NULL UUID</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>bool <function>uuid_is_null</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-variant"> - <refnamediv> - <refname>uuid_variant</refname> - <refpurpose>Get UUID variant</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_variant</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-type"> - <refnamediv> - <refname>uuid_type</refname> - <refpurpose>Get UUID type</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_type</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-time"> - <refnamediv> - <refname>uuid_time</refname> - <refpurpose>Get UUID creation time as UNIX timestamp</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>int <function>uuid_time</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - <refentry id="function.uuid-mac"> - <refnamediv> - <refname>uuid_mac</refname> - <refpurpose>Get UUID creator network MAC address</refpurpose> - </refnamediv> - <refsect1> - <title>Description</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>uuid_mac</function></funcdef> - <paramdef>string <parameter>uuid</parameter></paramdef> - </funcprototype> - </funcsynopsis> - &warn.experimental.func; - <para> - &warn.undocumented.func; - </para> - </refsect1> - </refentry> - - </reference> - -<!-- Keep this comment at the end of the file -Local variables: -mode: sgml -sgml-omittag:t -sgml-shorttag:t -sgml-minimize-attributes:nil -sgml-always-quote-attributes:t -sgml-indent-step:1 -sgml-indent-data:t -indent-tabs-mode:nil -sgml-parent-document:nil -sgml-default-dtd-file:"../../manual.ced" -sgml-exposed-tags:nil -sgml-local-catalogs:nil -sgml-local-ecat-files:nil -End: -vim600: syn=xml fen fdm=syntax fdl=2 si -vim: et tw=78 syn=sgml -vi: ts=1 sw=1 ---> +<?xml version="1.0" ?> +<extension name="uuid" version="1.0.0"> + + <summary>UUID extension</summary> + + <description> + A wrapper around libuuid from the ext2utils project. + </description> + + <license>LGPL</license> + + <maintainers> + <maintainer> + <user>hholzgra</user> + <name>Hartmut Holzgraefe</name> + <email>hartmut@php.net</email> + <role>lead</role> + </maintainer> + </maintainers> + + <release> + <version>0.1</version> + <date>2006-06-24</date> + <state>alpha</state> + <notes> + first tests + </notes> + </release> + + <deps language="c" platform="unix"> + <with> + <header name="uuid/uuid.h"/> + <lib name="uuid"/> + </with> + <configm4> + PHP_CHECK_FUNC_LIB(uuid_type, uuid) + PHP_CHECK_FUNC_LIB(uuid_variant, uuid) + </configm4> + </deps> + + + <constant name="UUID_VARIANT_NCS" if="UUID_VARIANT_NCS"/> + <constant name="UUID_VARIANT_DCE" if="UUID_VARIANT_DCE"/> + <constant name="UUID_VARIANT_MICROSOFT" if="UUID_VARIANT_MICROSOFT"/> + <constant name="UUID_VARIANT_OTHER" if="UUID_VARIANT_OTHER"/> + + <constant name="UUID_TYPE_DEFAULT" define="yes" type="int" value="0"/> + <constant name="UUID_TYPE_TIME" define="yes" type="int" value="UUID_TYPE_DCE_TIME"/> + <constant name="UUID_TYPE_DCE" define="yes" type="int" value="UUID_TYPE_DCE_RANDOM"/> + <constant name="UUID_TYPE_NAME" define="yes" type="int" value="UUID_TYPE_DCE_TIME"/> + <constant name="UUID_TYPE_RANDOM" define="yes" type="int" value="UUID_TYPE_DCE_RANDOM"/> + <constant name="UUID_TYPE_NULL" define="yes" type="int" value="-1"/> + <constant name="UUID_TYPE_INVALID" define="yes" type="int" value="-42"/> + + <function name="uuid_create"> + <proto>string uuid_create([int uuid_type])</proto> + + <summary>Generate a new UUID</summary> + + <description> + ... + </description> + + <code> + uuid_t uuid; + char uuid_str[37]; + + switch(uuid_type) { + case UUID_TYPE_DCE_TIME: + uuid_generate_time(uuid); + break; + case UUID_TYPE_DCE_RANDOM: + uuid_generate_random(uuid); + break; + case UUID_TYPE_DEFAULT: + uuid_generate(uuid); + break; + default: + php_error_docref(NULL TSRMLS_CC, + E_WARNING, + "Unknown/invalid UUID type '%d' requested, using default type instead", + uuid_type); + uuid_generate(uuid); + break; + } + + uuid_unparse(uuid, uuid_str); + + RETURN_STRING(uuid_str, 1); + </code> + + <test> + <code> +<![CDATA[ + // check basic format of generated UUIDs + $uuid = uuid_create(); + if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { + echo "basic format ok\n"; + } else { + echo "basic UUID format check failed, generated UUID was $uuid\n"; + } +]]> + </code> + <result> +basic format ok + </result> + </test> + + </function> + + <function name="uuid_is_valid"> + <proto>bool uuid_is_valid(string uuid)</proto> + + <summary>Check whether a given UUID string is a valid UUID</summary> + + <description> + add some text here + </description> + + <code> + uuid_t u; + RETURN_BOOL(0 == uuid_parse(uuid, u)); + </code> + + <test> + <code> +var_dump(uuid_is_valid("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb")); +var_dump(uuid_is_valid("ffffffff-ffff-ffff-ffff-ffffffffffff")); +var_dump(uuid_is_valid("61616161-6161-6161-6161-616161616161")); +var_dump(uuid_is_valid("foobar")); + </code> + <result> +bool(true) +bool(true) +bool(true) +bool(false) + </result> + </test> + + </function> + + <function name="uuid_compare"> + <proto>int uuid_compare(string uuid1, string uuid2)</proto> + + <summary>Compare two UUIDs</summary> + + <code> + uuid_t u1, u2; + + if(uuid_parse(uuid1, u1)) RETURN_FALSE; + if(uuid_parse(uuid2, u2)) RETURN_FALSE; + + RETURN_LONG(uuid_compare(u1, u2)); + </code> + + <test> + <code> +<?data + $uuids = array(); + $uuids[0] = "00000000-0000-0000-0000-000000000000"; + $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; + $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; + + foreach ($uuids as $key1 => $uuid1) { + foreach ($uuids as $key2 => $uuid2) { + echo "uuid$key1"; + + switch (uuid_compare($uuid1, $uuid2)) { + case -1: echo " < "; break; + case 0: echo " = "; break; + case 1: echo " > "; break; + } + + echo "uuid$key2\n"; + } + echo "\n"; + } +?> + </code> + <result> +<?data +uuid0 = uuid0 +uuid0 < uuid1 +uuid0 < uuid2 + +uuid1 > uuid0 +uuid1 = uuid1 +uuid1 < uuid2 + +uuid2 > uuid0 +uuid2 > uuid1 +uuid2 = uuid2 +?> + </result> + </test> + + </function> + + <function name="uuid_is_null"> + <proto>bool uuid_is_null(string uuid)</proto> + + <summary>Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + RETURN_BOOL(uuid_is_null(u)); + </code> + + <test> + <code> +var_dump(uuid_is_null("00000000-0000-0000-0000-000000000000")); +var_dump(uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_is_null("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")); + </code> + <result> +bool(true) +bool(false) +bool(false) + </result> + </test> + </function> + + + <function name="uuid_type" if="HAVE_UUID_TYPE"> + <proto>int uuid_type(string uuid)</proto> + + <summary>Return the UUIDs type</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_type(u)); + </code> + + <test> + <code> +echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488") == UUID_TYPE_TIME ? "OK\n" : "Failure\n"; +echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b") == UUID_TYPE_RANDOM ? "OK\n" : "Failure\n"; +echo uuid_type("00000000-0000-0000-0000-000000000000") == UUID_TYPE_NULL ? "OK\n" : "Failure\n"; + </code> + <result> +OK +OK +OK + </result> + </test> + + </function> + + <function name="uuid_variant" if="HAVE_UUID_VARIANT"> + <proto>int uuid_variant(string uuid)</proto> + + <summary>Return the UUIDs variant</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + + if (uuid_is_null(u)) RETURN_LONG(UUID_TYPE_NULL); + + RETURN_LONG(uuid_variant(u)); + </code> + + <test> + <code> +echo uuid_variant("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; +echo uuid_variant("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +echo uuid_variant("00000000-0000-0000-0000-000000000000")."\n"; + </code> + <result> +1 +1 +-1 + </result> + </test> + + </function> + + <function name="uuid_time"> + <proto>int uuid_time(string uuid)</proto> + + <summary>Extract creation time from a time based UUID as UNIX timestamp</summary> + + <description> + ... + </description> + + <code> + uuid_t u; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + +#if HAVE_UUID_VARIANT + if(uuid_variant(u) != 1) RETURN_FALSE; +#endif +#if HAVE_UUID_TYPE + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + RETURN_LONG(uuid_time(u, NULL)); + </code> + + <test> + <code> +var_dump(uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + </code> + <result> +int(1080374815) +bool(false) + </result> + </test> + </function> + + <function name="uuid_mac"> + <proto>string uuid_mac(string uuid)</proto> + + <summary>Get UUID creator network MAC address</summary> + + <description> + ... + </description> + + <code> +<?data + uuid_t u; + char uuid_str[37]; + + if(uuid_parse(uuid, u)) RETURN_FALSE; + +#if HAVE_UUID_VARIANT + if(uuid_variant(u) != 1) RETURN_FALSE; +#endif +#if HAVE_UUID_TYPE + if(uuid_type(u) != 1) RETURN_FALSE; +#endif + + if(uuid[10] & 0x80) RETURN_FALSE; // invalid MAC + + uuid_unparse(u, uuid_str); + RETURN_STRING((char *)(uuid_str + 24), 1); +?> + </code> + + <test> + <code> +var_dump(uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + </code> + <result> +string(12) "00065b896488" +bool(false) + </result> + </test> + + </function> + + <function name="uuid_parse"> + <proto>string uuid_parse(string uuid)</proto> + <code> +<?data + uuid_t uuid_bin; + + if (uuid_parse(uuid, uuid_bin)) { + RETURN_FALSE; + } + + RETURN_STRINGL((char *)uuid_bin, sizeof(uuid_t), 1); +?> + </code> + <test> + <code> +var_dump(uuid_parse("61616161-6161-6161-6161-616161616161")); + </code> + <result> +string(16) "aaaaaaaaaaaaaaaa" + </result> + </test> + </function> + + <function name="uuid_unparse"> + <proto>string uuid_unparse(string uuid)</proto> + <code> +<?data + char uuid_txt[37]; + + if (uuid_len != sizeof(uuid_t)) { + RETURN_FALSE; + } + + uuid_unparse((unsigned char *)uuid, uuid_txt); + + RETURN_STRINGL(uuid_txt, 36, 1); +?> + </code> + <test> + <code> +var_dump(uuid_unparse("aaaaaaaaaaaaaaaa")); + </code> + <result> +string(36) "61616161-6161-6161-6161-616161616161" + </result> + </test> + </function> + +</extension> \ No newline at end of file http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_compare.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_compare.phpt diff -u pecl/uuid/tests/uuid_compare.phpt:1.1 pecl/uuid/tests/uuid_compare.phpt:1.2 --- pecl/uuid/tests/uuid_compare.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_compare.phpt Thu Mar 27 22:10:00 2008 @@ -1,31 +1,33 @@ --TEST-- -UUID comparison +uuid_compare() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- -<?php - $uuids = array(); - $uuids[0] = "00000000-0000-0000-0000-000000000000"; - $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; - $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; - - foreach ($uuids as $key1 => $uuid1) { - foreach ($uuids as $key2 => $uuid2) { - echo "uuid$key1"; - - switch (uuid_compare($uuid1, $uuid2)) { - case -1: echo " < "; break; - case 0: echo " = "; break; - case 1: echo " > "; break; - } - - echo "uuid$key2\n"; - } - echo "\n"; - } +<?php +$uuids = array(); + $uuids[0] = "00000000-0000-0000-0000-000000000000"; + $uuids[1] = "878b258c-a9f1-467c-8e1d-47d79ca2c01b"; + $uuids[2] = "b691c99c-7fc5-11d8-9fa8-00065b896488"; + + foreach ($uuids as $key1 => $uuid1) { + foreach ($uuids as $key2 => $uuid2) { + echo "uuid$key1"; + + switch (uuid_compare($uuid1, $uuid2)) { + case -1: echo " < "; break; + case 0: echo " = "; break; + case 1: echo " > "; break; + } + + echo "uuid$key2\n"; + } + echo "\n"; + } + ?> --EXPECT-- uuid0 = uuid0 @@ -39,4 +41,3 @@ uuid2 > uuid0 uuid2 > uuid1 uuid2 = uuid2 - http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_create.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_create.phpt diff -u pecl/uuid/tests/uuid_create.phpt:1.1 pecl/uuid/tests/uuid_create.phpt:1.2 --- pecl/uuid/tests/uuid_create.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_create.phpt Thu Mar 27 22:10:00 2008 @@ -1,37 +1,21 @@ --TEST-- -UUID creation +uuid_create() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- ---FILE-- -<?php - // check basic format of generated UUIDs - $uuid = uuid_create(); - if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { - echo "basic format ok\n"; +<?php - echo "NULL UUID "; - $uuid = uuid_create(UUID_TYPE_NULL); - echo uuid_is_null($uuid) ? "ok\n" : "failed: $uuid\n"; +if(!extension_loaded('uuid')) die('skip '); - echo "Time based UUID "; - $uuid = uuid_create(UUID_TYPE_TIME); - echo uuid_type($uuid) == UUID_TYPE_TIME ? "ok\n" : "failed: $uuid (".uuid_type($uuid).",".UUID_TYPE_TIME.")\n"; - - echo "Random UUID "; - $uuid = uuid_create(UUID_TYPE_RANDOM); - echo uuid_type($uuid) == UUID_TYPE_RANDOM ? "ok\n" : "failed: $uuid\n"; + ?> +--FILE-- +<?php + // check basic format of generated UUIDs + $uuid = uuid_create(); + if (ereg("[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}", $uuid)) { + echo "basic format ok\n"; + } else { + echo "basic UUID format check failed, generated UUID was $uuid\n"; + } - } else { - echo "basic UUID format check failed, generated UUID was $uuid\n"; - } ?> --EXPECT-- basic format ok -NULL UUID ok -Time based UUID ok -Random UUID ok - - http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_is_null.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_is_null.phpt diff -u pecl/uuid/tests/uuid_is_null.phpt:1.1 pecl/uuid/tests/uuid_is_null.phpt:1.2 --- pecl/uuid/tests/uuid_is_null.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_is_null.phpt Thu Mar 27 22:10:00 2008 @@ -1,20 +1,19 @@ --TEST-- -UUID NULL check +uuid_is_null() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo (int)uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo (int)uuid_is_null("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo (int)uuid_is_null("00000000-0000-0000-0000-000000000000")."\n"; +var_dump(uuid_is_null("00000000-0000-0000-0000-000000000000")); +var_dump(uuid_is_null("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_is_null("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")); + ?> --EXPECT-- -0 -0 -1 - - - +bool(true) +bool(false) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_is_valid.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_is_valid.phpt diff -u pecl/uuid/tests/uuid_is_valid.phpt:1.1 pecl/uuid/tests/uuid_is_valid.phpt:1.2 --- pecl/uuid/tests/uuid_is_valid.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_is_valid.phpt Thu Mar 27 22:10:00 2008 @@ -1,23 +1,21 @@ --TEST-- -UUID validation +uuid_is_valid() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo (int)uuid_is_valid("this is not an UUID string")."\n"; -echo (int)uuid_is_valid("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo (int)uuid_is_valid("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo (int)uuid_is_valid("00000000-0000-0000-0000-000000000000")."\n"; -echo (int)uuid_is_valid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")."\n"; +var_dump(uuid_is_valid("1b4e28ba-2fa1-11d2-883f-b9a761bde3fb")); +var_dump(uuid_is_valid("ffffffff-ffff-ffff-ffff-ffffffffffff")); +var_dump(uuid_is_valid("61616161-6161-6161-6161-616161616161")); +var_dump(uuid_is_valid("foobar")); + ?> --EXPECT-- -0 -1 -1 -1 -1 - - +bool(true) +bool(true) +bool(true) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_mac.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_mac.phpt diff -u pecl/uuid/tests/uuid_mac.phpt:1.1 pecl/uuid/tests/uuid_mac.phpt:1.2 --- pecl/uuid/tests/uuid_mac.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_mac.phpt Thu Mar 27 22:10:00 2008 @@ -1,15 +1,17 @@ --TEST-- -UUID MAC address extraction +uuid_mac() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +var_dump(uuid_mac("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_mac("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + ?> --EXPECT-- -00065b896488 - +string(12) "00065b896488" +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_time.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_time.phpt diff -u pecl/uuid/tests/uuid_time.phpt:1.1 pecl/uuid/tests/uuid_time.phpt:1.2 --- pecl/uuid/tests/uuid_time.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_time.phpt Thu Mar 27 22:10:00 2008 @@ -1,15 +1,17 @@ --TEST-- -UUID timestamp extraction +uuid_time() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + + ?> --FILE-- <?php -echo uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; +var_dump(uuid_time("b691c99c-7fc5-11d8-9fa8-00065b896488")); +var_dump(uuid_time("878b258c-a9f1-467c-8e1d-47d79ca2c01b")); + ?> --EXPECT-- -1080374815 - +int(1080374815) +bool(false) http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_type.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_type.phpt diff -u pecl/uuid/tests/uuid_type.phpt:1.1 pecl/uuid/tests/uuid_type.phpt:1.2 --- pecl/uuid/tests/uuid_type.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_type.phpt Thu Mar 27 22:10:00 2008 @@ -1,19 +1,21 @@ --TEST-- -UUID type detection +uuid_type() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + +if(!function_exists('uuid_type')) die('skip not compiled in (HAVE_UUID_TYPE)'); + + ?> --FILE-- <?php -echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; -echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; -echo uuid_type("00000000-0000-0000-0000-000000000000")."\n"; +echo uuid_type("b691c99c-7fc5-11d8-9fa8-00065b896488") == UUID_TYPE_TIME ? "OK\n" : "Failure\n"; +echo uuid_type("878b258c-a9f1-467c-8e1d-47d79ca2c01b") == UUID_TYPE_RANDOM ? "OK\n" : "Failure\n"; +echo uuid_type("00000000-0000-0000-0000-000000000000") == UUID_TYPE_NULL ? "OK\n" : "Failure\n"; + ?> --EXPECT-- -1 -4 --1 - - +OK +OK +OK http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_variant.phpt?r1=1.1&r2=1.2&diff_format=u Index: pecl/uuid/tests/uuid_variant.phpt diff -u pecl/uuid/tests/uuid_variant.phpt:1.1 pecl/uuid/tests/uuid_variant.phpt:1.2 --- pecl/uuid/tests/uuid_variant.phpt:1.1 Sat Mar 27 13:09:45 2004 +++ pecl/uuid/tests/uuid_variant.phpt Thu Mar 27 22:10:00 2008 @@ -1,19 +1,21 @@ --TEST-- -UUID variant detection +uuid_variant() function --SKIPIF-- -<?php if (!extension_loaded("uuid")) print "skip"; ?> ---POST-- ---GET-- ---INI-- +<?php + +if(!extension_loaded('uuid')) die('skip '); + +if(!function_exists('uuid_variant')) die('skip not compiled in (HAVE_UUID_VARIANT)'); + + ?> --FILE-- <?php echo uuid_variant("b691c99c-7fc5-11d8-9fa8-00065b896488")."\n"; echo uuid_variant("878b258c-a9f1-467c-8e1d-47d79ca2c01b")."\n"; echo uuid_variant("00000000-0000-0000-0000-000000000000")."\n"; + ?> --EXPECT-- 1 1 -0 - - +-1 http://cvs.php.net/viewvc.cgi/pecl/uuid/package2.xml?view=markup&rev=1.1 Index: pecl/uuid/package2.xml +++ pecl/uuid/package2.xml <?xml version="1.0"?> <package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> <name>uuid</name> <channel>pecl.php.net</channel> <summary>UUID extension</summary> <description> A wrapper around libuuid from the ext2utils project. </description> <lead> <name>Hartmut Holzgraefe</name> <user>hholzgra</user> <email>hartmut@php.net</email> <active>yes</active> </lead> <date>2006-06-24</date> <version> <release>0.1</release> <api>0.1</api> </version> <stability> <release>alpha</release> <api>alpha</api> </stability> <license uri="http://www.gnu.org/licenses/licenses.html#LGPL" filesource="LICENSE">LGPL</license> <notes> first tests </notes> <contents> <dir name="/"> <file role='doc' name='EXPERIMENTAL'/> <file role='doc' name='CREDITS'/> <file role='src' name='config.m4'/> <file role='src' name='uuid.c'/> <file role='src' name='php_uuid.h'/> <dir name="tests"> <file role='test' name='uuid_create.phpt'/> <file role='test' name='uuid_is_valid.phpt'/> <file role='test' name='uuid_compare.phpt'/> <file role='test' name='uuid_is_null.phpt'/> <file role='test' name='uuid_type.phpt'/> <file role='test' name='uuid_variant.phpt'/> <file role='test' name='uuid_time.phpt'/> <file role='test' name='uuid_mac.phpt'/> <file role='test' name='uuid_parse.phpt'/> <file role='test' name='uuid_unparse.phpt'/> </dir> </dir> </contents> <dependencies> <required> <php> <min>4.0.0</min> </php> <pearinstaller> <min>1.4.0a1</min> </pearinstaller> <os><name>unix</name></os> </required> </dependencies> <providesextension>uuid</providesextension> <extsrcrelease> <configureoption name="with-uuid" default="autodetect" prompt="uuid installation directory?" /> </extsrcrelease> </package> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/file-entities.ent?view=markup&rev=1.1 Index: pecl/uuid/manual/file-entities.ent +++ pecl/uuid/manual/file-entities.ent <!ENTITY reference.uuid.reference SYSTEM './uuid/reference.xml'> <!ENTITY reference.uuid.constants SYSTEM './uuid/constants.xml'> <!ENTITY reference.uuid.ini SYSTEM './uuid/ini.xml'> <!ENTITY reference.uuid.configure SYSTEM './uuid/configure.xml'> <!ENTITY reference.uuid.functions.uuid-create SYSTEM './uuid/functions/uuid-create.xml'> <!ENTITY reference.uuid.functions.uuid-is-valid SYSTEM './uuid/functions/uuid-is-valid.xml'> <!ENTITY reference.uuid.functions.uuid-compare SYSTEM './uuid/functions/uuid-compare.xml'> <!ENTITY reference.uuid.functions.uuid-is-null SYSTEM './uuid/functions/uuid-is-null.xml'> <!ENTITY reference.uuid.functions.uuid-type SYSTEM './uuid/functions/uuid-type.xml'> <!ENTITY reference.uuid.functions.uuid-variant SYSTEM './uuid/functions/uuid-variant.xml'> <!ENTITY reference.uuid.functions.uuid-time SYSTEM './uuid/functions/uuid-time.xml'> <!ENTITY reference.uuid.functions.uuid-mac SYSTEM './uuid/functions/uuid-mac.xml'> <!ENTITY reference.uuid.functions.uuid-parse SYSTEM './uuid/functions/uuid-parse.xml'> <!ENTITY reference.uuid.functions.uuid-unparse SYSTEM './uuid/functions/uuid-unparse.xml'> <!ENTITY reference.uuid.functions SYSTEM './functions.xml'> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/functions.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/functions.xml +++ pecl/uuid/manual/functions.xml &reference.uuid.functions.uuid-compare; &reference.uuid.functions.uuid-create; &reference.uuid.functions.uuid-is-null; &reference.uuid.functions.uuid-is-valid; &reference.uuid.functions.uuid-mac; &reference.uuid.functions.uuid-parse; &reference.uuid.functions.uuid-time; &reference.uuid.functions.uuid-type; &reference.uuid.functions.uuid-unparse; &reference.uuid.functions.uuid-variant; http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/manual.xml.in?view=markup&rev=1.1 Index: pecl/uuid/manual/manual.xml.in +++ pecl/uuid/manual/manual.xml.in <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE book PUBLIC '-//OASIS//DTD DocBook XML V4.1.2//EN' '@PHPDOC@/dtds/dbxml-4.1.2/docbookx.dtd' [ <!-- Add translated specific definitions and snippets --> <!ENTITY % language-defs SYSTEM '@PHPDOC@/en/language-defs.ent'> <!ENTITY % language-snippets SYSTEM '@PHPDOC@/en/language-snippets.ent'> %language-defs; %language-snippets; <!-- Fallback to English definitions and snippets (in case of missing translation) --> <!ENTITY % language-defs.default SYSTEM '@PHPDOC@/en/language-defs.ent'> <!ENTITY % language-snippets.default SYSTEM '@PHPDOC@/en/language-snippets.ent'> <!ENTITY % extensions.default SYSTEM '@PHPDOC@/en/extensions.ent'> %language-defs.default; %language-snippets.default; %extensions.default; <!-- All global entities for the XML files --> <!ENTITY % global.entities SYSTEM '@PHPDOC@/entities/global.ent'> <!ENTITY % file.entities SYSTEM './file-entities.ent'> <!-- Include all external DTD parts defined previously --> %global.entities; %file.entities; <!-- Autogenerated missing entites and IDs to make build work --> <!ENTITY % missing-entities SYSTEM '@PHPDOC@/entities/missing-entities.ent'> %missing-entities; ]> <book id='manual' lang='en'> &reference.uuid.reference; </book> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/configure.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/configure.xml +++ pecl/uuid/manual/uuid/configure.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.requirements'> &reftitle.required; &no.requirement; </section> <section id='uuid.install'> &reftitle.install; <para>Requires <literal>uuid</literal></para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/constants.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/constants.xml +++ pecl/uuid/manual/uuid/constants.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.constants' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> &reftitle.constants; &extension.constants; <para> <variablelist> <varlistentry> <term> <constant>UUID_VARIANT_NCS</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_DCE</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_MICROSOFT</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_VARIANT_OTHER</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_DEFAULT</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_TIME</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_DCE</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_NAME</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_RANDOM</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_NULL</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> <varlistentry> <term> <constant>UUID_TYPE_INVALID</constant> (<type>int</type>) </term> <listitem> <simpara> </simpara> </listitem> </varlistentry> </variablelist> </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/ini.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/ini.xml +++ pecl/uuid/manual/uuid/ini.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <section id='uuid.configuration' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> &reftitle.runtime; &extension.runtime; <para> &no.config; </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/reference.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/reference.xml +++ pecl/uuid/manual/uuid/reference.xml <?xml version='1.0' encoding='iso-8859-1'?> <!-- $Revision: 1.1 $ --> <!-- Purpose: utilspec --> <!-- Membership: pecl, external --> <!-- State: experimental --> <reference xml:id='ref.uuid' xmlns='http://docbook.org/ns/docbook' xmlns:xlink='http://www.w3.org/1999/xlink'> <title>UUID extension</title> <titleabbrev>uuid</titleabbrev> <partintro> <section id='uuid.intro'> &reftitle.intro; <para> A wrapper around libuuid from the ext2utils project. </para> </section> <section xml:id='uuid.requirements'> &reftitle.required; <para> </para> </section> &reference.uuid.configure; &reference.extname.ini; <section id='uuid.resources'> &reftitle.resources; &no.resource; </section> &reference.extname.constants; </partintro> &reference.uuid.functions; </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-compare.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-compare.xml +++ pecl/uuid/manual/uuid/functions/uuid-compare.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-compare"> <refnamediv> <refname>uuid_compare</refname> <refpurpose>Compare two UUIDs</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_compare</methodname> <methodparam><type>string</type><parameter>uuid1</parameter></methodparam> <methodparam><type>string</type><parameter>uuid2</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-create.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-create.xml +++ pecl/uuid/manual/uuid/functions/uuid-create.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-create"> <refnamediv> <refname>uuid_create</refname> <refpurpose>Generate a new UUID</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_create</methodname> <methodparam choice='opt'><type>int</type><parameter>uuid_type</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-is-null.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-is-null.xml +++ pecl/uuid/manual/uuid/functions/uuid-is-null.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-is-null"> <refnamediv> <refname>uuid_is_null</refname> <refpurpose>Check wheter an UUID is the NULL UUID 00000000-0000-0000-0000-000000000000</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>uuid_is_null</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-is-valid.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-is-valid.xml +++ pecl/uuid/manual/uuid/functions/uuid-is-valid.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-is-valid"> <refnamediv> <refname>uuid_is_valid</refname> <refpurpose>Check whether a given UUID string is a valid UUID</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>uuid_is_valid</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> add some text here </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-mac.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-mac.xml +++ pecl/uuid/manual/uuid/functions/uuid-mac.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-mac"> <refnamediv> <refname>uuid_mac</refname> <refpurpose>Get UUID creator network MAC address</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_mac</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-parse.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-parse.xml +++ pecl/uuid/manual/uuid/functions/uuid-parse.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-parse"> <refnamediv> <refname>uuid_parse</refname> <refpurpose></refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_parse</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-time.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-time.xml +++ pecl/uuid/manual/uuid/functions/uuid-time.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-time"> <refnamediv> <refname>uuid_time</refname> <refpurpose>Extract creation time from a time based UUID as UNIX timestamp</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_time</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-type.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-type.xml +++ pecl/uuid/manual/uuid/functions/uuid-type.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-type"> <refnamediv> <refname>uuid_type</refname> <refpurpose>Return the UUIDs type</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_type</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-unparse.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-unparse.xml +++ pecl/uuid/manual/uuid/functions/uuid-unparse.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-unparse"> <refnamediv> <refname>uuid_unparse</refname> <refpurpose></refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>string</type><methodname>uuid_unparse</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/manual/uuid/functions/uuid-variant.xml?view=markup&rev=1.1 Index: pecl/uuid/manual/uuid/functions/uuid-variant.xml +++ pecl/uuid/manual/uuid/functions/uuid-variant.xml <?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.1 $ --> <refentry id="function.uuid-variant"> <refnamediv> <refname>uuid_variant</refname> <refpurpose>Return the UUIDs variant</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>int</type><methodname>uuid_variant</methodname> <methodparam><type>string</type><parameter>uuid</parameter></methodparam> </methodsynopsis> <para> ... </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_parse.phpt?view=markup&rev=1.1 Index: pecl/uuid/tests/uuid_parse.phpt +++ pecl/uuid/tests/uuid_parse.phpt --TEST-- uuid_parse() function --SKIPIF-- <?php if(!extension_loaded('uuid')) die('skip '); ?> --FILE-- <?php var_dump(uuid_parse("61616161-6161-6161-6161-616161616161")); ?> --EXPECT-- string(16) "aaaaaaaaaaaaaaaa" http://cvs.php.net/viewvc.cgi/pecl/uuid/tests/uuid_unparse.phpt?view=markup&rev=1.1 Index: pecl/uuid/tests/uuid_unparse.phpt +++ pecl/uuid/tests/uuid_unparse.phpt --TEST-- uuid_unparse() function --SKIPIF-- <?php if(!extension_loaded('uuid')) die('skip '); ?> --FILE-- <?php var_dump(uuid_unparse("aaaaaaaaaaaaaaaa")); ?> --EXPECT-- string(36) "61616161-6161-6161-6161-616161616161"