php-src/ext/spl/spl_engine.c

76 lines
2.1 KiB
C
Raw Normal View History

2003-05-01 23:28:28 +00:00
/*
+----------------------------------------------------------------------+
2014-09-19 16:33:14 +00:00
| PHP Version 7 |
2003-05-01 23:28:28 +00:00
+----------------------------------------------------------------------+
2015-01-15 15:27:30 +00:00
| Copyright (c) 1997-2015 The PHP Group |
2003-05-01 23:28:28 +00:00
+----------------------------------------------------------------------+
2006-01-01 12:51:34 +00:00
| This source file is subject to version 3.01 of the PHP license, |
2003-05-01 23:28:28 +00:00
| that is bundled with this package in the file LICENSE, and is |
2003-06-12 19:30:54 +00:00
| available through the world-wide-web at the following url: |
2006-01-01 12:51:34 +00:00
| http://www.php.net/license/3_01.txt |
2003-05-01 23:28:28 +00:00
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "zend_interfaces.h"
2003-05-01 23:28:28 +00:00
#include "php_spl.h"
#include "spl_functions.h"
#include "spl_engine.h"
#include "spl_array.h"
/* {{{ spl_instantiate */
2014-12-13 22:06:14 +00:00
PHPAPI void spl_instantiate(zend_class_entry *pce, zval *object)
2003-05-01 23:28:28 +00:00
{
object_init_ex(object, pce);
Z_SET_REFCOUNT_P(object, 1);
// !!!PZ_SET_ISREF_P(object); /* check if this can be hold always */
2003-05-01 23:28:28 +00:00
}
/* }}} */
2014-12-13 22:06:14 +00:00
PHPAPI zend_long spl_offset_convert_to_long(zval *offset) /* {{{ */
2008-06-06 23:53:43 +00:00
{
2014-08-25 17:24:55 +00:00
zend_ulong idx;
switch (Z_TYPE_P(offset)) {
2008-06-06 23:53:43 +00:00
case IS_STRING:
if (ZEND_HANDLE_NUMERIC(Z_STR_P(offset), idx)) {
return idx;
}
2008-06-06 23:53:43 +00:00
break;
case IS_DOUBLE:
2014-08-25 17:24:55 +00:00
return (zend_long)Z_DVAL_P(offset);
case IS_LONG:
return Z_LVAL_P(offset);
case IS_FALSE:
return 0;
case IS_TRUE:
return 1;
case IS_RESOURCE:
return Z_RES_HANDLE_P(offset);
2008-06-06 23:53:43 +00:00
}
return -1;
2015-01-03 09:22:58 +00:00
}
2008-06-06 23:53:43 +00:00
/* }}} */
2003-05-01 23:28:28 +00:00
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: fdm=marker
* vim: noet sw=4 ts=4
*/