U_CFUNC PHP_FUNCTION(intlcal_is_set)
{
	zend_long field;
	CALENDAR_METHOD_INIT_VARS;

	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(),
			"Ol", &object, Calendar_ce_ptr, &field) == FAILURE) {
		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
			"intlcal_is_set: bad arguments", 0 TSRMLS_CC);
		RETURN_FALSE;
	}

	if (field < 0 || field >= UCAL_FIELD_COUNT) {
		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
			"intlcal_is_set: invalid field", 0 TSRMLS_CC);
		RETURN_FALSE;
	}

	CALENDAR_METHOD_FETCH_OBJECT;

	RETURN_BOOL((int)co->ucal->isSet((UCalendarDateFields)field));
}
/* {{{ proto bool Runkit_Sandbox_Parent::print(mixed var)
	Echo through the sandbox
	Avoid the sandbox's output_handler */
PHP_METHOD(Runkit_Sandbox_Parent,print)
{
	php_runkit_sandbox_parent_object *objval;
	char *str;
	int len;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str, &len) == FAILURE) {
		RETURN_FALSE;
	}

	PHP_RUNKIT_SANDBOX_PARENT_FETCHBOX_VERIFY_ACCESS(objval, this_ptr);
	if (!objval->self->parent_echo) {
		php_error_docref(NULL, E_WARNING, "Access to echo data in the parent context is not enabled");
		RETURN_FALSE;
	}

	PHP_RUNKIT_SANDBOX_PARENT_BEGIN(objval)
		PHPWRITE(str,len);
	PHP_RUNKIT_SANDBOX_PARENT_END(objval)

	RETURN_BOOL(len > 1 || (len == 1 && str[0] != '0'));
}
Exemple #3
0
PHP_METHOD(Test_Mcall, optionalParameterBoolean) {

	zval *start_param = NULL;
	zend_bool start;

	zephir_fetch_params(0, 0, 1, &start_param);

	if (!start_param) {
		start = 1;
	} else {
		if (Z_TYPE_P(start_param) != IS_BOOL) {
			zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'start' must be a bool") TSRMLS_CC);
			RETURN_NULL();
		}

		start = Z_BVAL_P(start_param);
	}


	RETURN_BOOL(start);

}
Exemple #4
0
PHP_METHOD(Test_Mcall, optionalParameterBooleanNull) {

	zval *value_param = NULL;
	zend_bool value;

	zephir_fetch_params(0, 0, 1, &value_param);

	if (!value_param) {
		value = 0;
	} else {
		if (Z_TYPE_P(value_param) != IS_BOOL) {
			zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'value' must be a bool") TSRMLS_CC);
			RETURN_NULL();
		}

		value = Z_BVAL_P(value_param);
	}


	RETURN_BOOL(value);

}
U_CFUNC PHP_FUNCTION(intlgregcal_is_leap_year)
{
	zend_long year;
	CALENDAR_METHOD_INIT_VARS;

	if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
			"Ol", &object, GregorianCalendar_ce_ptr, &year) == FAILURE) {
		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
			"intlgregcal_is_leap_year: bad arguments", 0);
		RETURN_FALSE;
	}

	if (year < INT32_MIN || year > INT32_MAX) {
		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
			"intlgregcal_is_leap_year: year out of bounds", 0);
		RETURN_FALSE;
	}

	CALENDAR_METHOD_FETCH_OBJECT;

	RETURN_BOOL((int)fetch_greg(co)->isLeapYear((int32_t)year));
}
Exemple #6
0
PHP_METHOD(WinGdiPath, frameRectangle)
{
    wingdi_devicecontext_object *dc_obj;
    wingdi_brush_object *br_obj;
    wingdi_path_object *path_obj;
    zval *coords_zval,
         *br_zval,
         **tmp;
    RECT rect_coords;

    WINGDI_ERROR_HANDLING();
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &br_zval, &coords_zval) == FAILURE)
        return;
    WINGDI_RESTORE_ERRORS();

    path_obj = zend_object_store_get_object(getThis() TSRMLS_CC);
    dc_obj = zend_object_store_get_object(path_obj->device_context TSRMLS_CC);

    if (Z_TYPE_P(br_zval) == IS_OBJECT)
        br_obj = zend_object_store_get_object(br_zval TSRMLS_CC);
    else 
    {
        php_error_docref(NULL TSRMLS_CC, E_ERROR, "expected an object for parameter 2, got %s",
            zend_zval_type_name(br_zval));
        return;
    }

    // Is this the best way to do this?
    zend_hash_index_find(Z_ARRVAL_P(coords_zval), 0, (void **)&tmp);
    rect_coords.top = Z_LVAL_PP(tmp);
    zend_hash_index_find(Z_ARRVAL_P(coords_zval), 1, (void **)&tmp);
    rect_coords.left = Z_LVAL_PP(tmp);
    zend_hash_index_find(Z_ARRVAL_P(coords_zval), 2, (void **)&tmp);
    rect_coords.bottom = Z_LVAL_PP(tmp);
    zend_hash_index_find(Z_ARRVAL_P(coords_zval), 3, (void **)&tmp);
    rect_coords.right = Z_LVAL_PP(tmp);   

    RETURN_BOOL(FrameRect(dc_obj->hdc, &rect_coords, br_obj->brush_handle));
}
Exemple #7
0
/**
 * Gets an attribute a message using the array syntax
 *
 *<code>
 * print_r($messages[0]);
 *</code>
 *
 * @param int index
 * @return Phalcon\Validation\Message
 */
PHP_METHOD(Phalcon_Validation_Message_Group, offsetGet) {

	zval *index_param = NULL, *message, *_0;
	int index;

	zephir_fetch_params(0, 1, 0, &index_param);

	if (unlikely(Z_TYPE_P(index_param) != IS_LONG)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'index' must be a long/integer") TSRMLS_CC);
		RETURN_NULL();
	}

	index = Z_LVAL_P(index_param);


	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_messages"), PH_NOISY_CC);
	if (zephir_array_isset_long_fetch(&message, _0, index, 1 TSRMLS_CC)) {
		RETURN_CTORW(message);
	}
	RETURN_BOOL(0);

}
Exemple #8
0
/* {{{ proto boolean XMLReader::next([string localname])
Moves the position of the current instance to the next node in the stream. */
PHP_METHOD(xmlreader, next)
{
	zval *id;
	int retval;
	size_t name_len=0;
	xmlreader_object *intern;
	char *name = NULL;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &name, &name_len) == FAILURE) {
		return;
	}

	id = getThis();
	intern = Z_XMLREADER_P(id);
	if (intern != NULL && intern->ptr != NULL) {
#if LIBXML_VERSION <= 20617
		/* Bug in libxml prevents a next in certain cases when positioned on end of element */
		if (xmlTextReaderNodeType(intern->ptr) == XML_READER_TYPE_END_ELEMENT) {
			retval = xmlTextReaderRead(intern->ptr);
		} else
#endif
		retval = xmlTextReaderNext(intern->ptr);
		while (name != NULL && retval == 1) {
			if (xmlStrEqual(xmlTextReaderConstLocalName(intern->ptr), (xmlChar *)name)) {
				RETURN_TRUE;
			}
			retval = xmlTextReaderNext(intern->ptr);
		}
		if (retval == -1) {
			RETURN_FALSE;
		} else {
			RETURN_BOOL(retval);
		}
	}

	php_error_docref(NULL, E_WARNING, "Load Data before trying to read");
	RETURN_FALSE;
}
Exemple #9
0
PHP_METHOD(Label, equal) {
	php_jit_label_t *plabels[2];
	php_jit_function_t *pfuncs[2];
	
	zval *zlabel;
	
	if (php_jit_parameters("O", &zlabel, jit_label_ce) != SUCCESS) {
		php_jit_exception("unexpected parameters, expected (Label label)");
		return;
	}
	
	plabels[0] = PHP_JIT_FETCH_LABEL(getThis());
	plabels[1] = PHP_JIT_FETCH_LABEL(zlabel);
	
	pfuncs[0]  = PHP_JIT_FETCH_FUNCTION(&plabels[0]->zfunc);
	pfuncs[1]  = PHP_JIT_FETCH_FUNCTION(&plabels[1]->zfunc);
	
	if (pfuncs[0]->func != pfuncs[1]->func) {
		RETURN_FALSE;
	}
	
	RETURN_BOOL(jit_function_labels_equal(pfuncs[0]->func, plabels[0]->label, plabels[1]->label));
}
static PHP_METHOD(midgard_workspace_manager, purge_content)
{
	char *type;
	int type_length;
	zval *z_workspace;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO", &type, &type_length, &z_workspace, php_midgard_workspace_class) == FAILURE) {
		return;
	}

	MidgardWorkspaceManager *self = MIDGARD_WORKSPACE_MANAGER(__php_gobject_ptr(getThis()));
	MidgardWorkspace *workspace = MIDGARD_WORKSPACE(__php_gobject_ptr(z_workspace));

	GError *error = NULL;
	zend_bool result = midgard_workspace_manager_purge_content(self, type, workspace, &error);

	if (error) {
		zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to purge %s content from workspace. %s", type, error->message);
		g_error_free(error);
	}

	RETURN_BOOL(result);
}
static PHP_METHOD(midgard_workspace_manager, create_workspace)
{
	char *path;
	int path_length;
	zval *z_workspace;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &z_workspace, php_midgard_workspace_storage_class, &path, &path_length) == FAILURE) {
		return;
	}

	MidgardWorkspaceManager *self = MIDGARD_WORKSPACE_MANAGER(__php_gobject_ptr(getThis()));
	MidgardWorkspaceStorage *workspace = MIDGARD_WORKSPACE_STORAGE(__php_gobject_ptr(z_workspace));

	GError *error = NULL;
	zend_bool result = midgard_workspace_manager_create_workspace(self, workspace, path, &error);

	if (error) {
		zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed to create workspace. %s", error->message);
		g_error_free(error);
	}

	RETURN_BOOL(result);
}
static PHP_METHOD(midgard_connection, set_loglevel)
{
	RETVAL_NULL();
	MidgardConnection *mgd =__midgard_connection_get_ptr(getThis());
	CHECK_MGD(mgd);

	char *level;
	int level_length;
	zval *callback;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &level, &level_length, &callback) == FAILURE)
		return;

	/* no support for callback atm */
	gboolean rv = midgard_connection_set_loglevel(mgd, (gchar *)level, php_midgard_log_errors);
	global_loghandler = midgard_connection_get_loghandler(mgd);

	if (MGDG(midgard_memory_debug)) {
		php_printf("---> global_loghandler = %d\n", global_loghandler);
	}

	RETURN_BOOL(rv);
}
U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
{
	zval			*other_object;
	TimeZone_object	*other_to;
	TIMEZONE_METHOD_INIT_VARS;

	if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
			"OO", &object, TimeZone_ce_ptr, &other_object, TimeZone_ce_ptr)
			== FAILURE) {
		intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
			"intltz_has_same_rules: bad arguments", 0);
		RETURN_FALSE;
	}
	TIMEZONE_METHOD_FETCH_OBJECT;
	other_to = Z_INTL_TIMEZONE_P(other_object);
	if (other_to->utimezone == NULL) {
		intl_errors_set(&to->err, U_ILLEGAL_ARGUMENT_ERROR,
			"intltz_has_same_rules: The second IntlTimeZone is unconstructed", 0);
		RETURN_FALSE;
	}

	RETURN_BOOL(to->utimezone->hasSameRules(*other_to->utimezone));
}
Exemple #14
0
/* {{{ proto bool SimpleXMLIterator::hasChildren()
 Check whether element has children (elements) */
PHP_METHOD(ce_SimpleXMLIterator, hasChildren)
{
	php_sxe_object *sxe = Z_SXEOBJ_P(getThis());
	php_sxe_object *child;
	xmlNodePtr      node;

	if (zend_parse_parameters_none() == FAILURE) {
		return;
	}

	if (Z_ISUNDEF(sxe->iter.data) || sxe->iter.type == SXE_ITER_ATTRLIST) {
		RETURN_FALSE;
	}
	child = Z_SXEOBJ_P(&sxe->iter.data);

	GET_NODE(child, node);
	if (node) {
		node = node->children;
	}
	while (node && node->type != XML_ELEMENT_NODE) {
		node = node->next;
	}
	RETURN_BOOL(node ? 1 : 0);
}
Exemple #15
0
/* {{{ proto boolean XMLReader::getParserProperty(int property)
Indicates whether given property (one of the parser option constants) is set or not on parser */
PHP_METHOD(xmlreader, getParserProperty)
{
	zval *id;
	zend_long property;
	int retval = -1;
	xmlreader_object *intern;

	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &property) == FAILURE) {
		return;
	}

	id = getThis();

	intern = Z_XMLREADER_P(id);
	if (intern && intern->ptr) {
		retval = xmlTextReaderGetParserProp(intern->ptr,property);
	}
	if (retval == -1) {
		php_error_docref(NULL, E_WARNING, "Invalid parser property");
		RETURN_FALSE;
	}

	RETURN_BOOL(retval);
}
/**
 * {@inheritdoc}
 */
PHP_METHOD(Phalcon_Session_Adapter_Memcache, gc) {


	RETURN_BOOL(1);

}
Exemple #17
0
/* {{{ php_stat
 */
static void phar_fancy_stat(zend_stat_t *stat_sb, int type, zval *return_value)
{
	zval stat_dev, stat_ino, stat_mode, stat_nlink, stat_uid, stat_gid, stat_rdev,
		 stat_size, stat_atime, stat_mtime, stat_ctime, stat_blksize, stat_blocks;
	int rmask=S_IROTH, wmask=S_IWOTH, xmask=S_IXOTH; /* access rights defaults to other */
	char *stat_sb_names[13] = {
		"dev", "ino", "mode", "nlink", "uid", "gid", "rdev",
		"size", "atime", "mtime", "ctime", "blksize", "blocks"
	};

#ifndef NETWARE
	if (type >= FS_IS_W && type <= FS_IS_X) {
		if(stat_sb->st_uid==getuid()) {
			rmask=S_IRUSR;
			wmask=S_IWUSR;
			xmask=S_IXUSR;
		} else if(stat_sb->st_gid==getgid()) {
			rmask=S_IRGRP;
			wmask=S_IWGRP;
			xmask=S_IXGRP;
		} else {
			int   groups, n, i;
			gid_t *gids;

			groups = getgroups(0, NULL);
			if(groups > 0) {
				gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
				n=getgroups(groups, gids);
				for(i=0;i<n;++i){
					if(stat_sb->st_gid==gids[i]) {
						rmask=S_IRGRP;
						wmask=S_IWGRP;
						xmask=S_IXGRP;
						break;
					}
				}
				efree(gids);
			}
		}
	}
#endif

	switch (type) {
	case FS_PERMS:
		RETURN_LONG((zend_long)stat_sb->st_mode);
	case FS_INODE:
		RETURN_LONG((zend_long)stat_sb->st_ino);
	case FS_SIZE:
		RETURN_LONG((zend_long)stat_sb->st_size);
	case FS_OWNER:
		RETURN_LONG((zend_long)stat_sb->st_uid);
	case FS_GROUP:
		RETURN_LONG((zend_long)stat_sb->st_gid);
	case FS_ATIME:
#ifdef NETWARE
		RETURN_LONG((zend_long)stat_sb->st_atime.tv_sec);
#else
		RETURN_LONG((zend_long)stat_sb->st_atime);
#endif
	case FS_MTIME:
#ifdef NETWARE
		RETURN_LONG((zend_long)stat_sb->st_mtime.tv_sec);
#else
		RETURN_LONG((zend_long)stat_sb->st_mtime);
#endif
	case FS_CTIME:
#ifdef NETWARE
		RETURN_LONG((zend_long)stat_sb->st_ctime.tv_sec);
#else
		RETURN_LONG((zend_long)stat_sb->st_ctime);
#endif
	case FS_TYPE:
		if (S_ISLNK(stat_sb->st_mode)) {
			RETURN_STRING("link");
		}
		switch(stat_sb->st_mode & S_IFMT) {
		case S_IFDIR: RETURN_STRING("dir");
		case S_IFREG: RETURN_STRING("file");
		}
		php_error_docref(NULL, E_NOTICE, "Unknown file type (%u)", stat_sb->st_mode & S_IFMT);
		RETURN_STRING("unknown");
	case FS_IS_W:
		RETURN_BOOL((stat_sb->st_mode & wmask) != 0);
	case FS_IS_R:
		RETURN_BOOL((stat_sb->st_mode&rmask)!=0);
	case FS_IS_X:
		RETURN_BOOL((stat_sb->st_mode&xmask)!=0 && !S_ISDIR(stat_sb->st_mode));
	case FS_IS_FILE:
		RETURN_BOOL(S_ISREG(stat_sb->st_mode));
	case FS_IS_DIR:
		RETURN_BOOL(S_ISDIR(stat_sb->st_mode));
	case FS_IS_LINK:
		RETURN_BOOL(S_ISLNK(stat_sb->st_mode));
	case FS_EXISTS:
		RETURN_TRUE; /* the false case was done earlier */
	case FS_LSTAT:
		/* FALLTHROUGH */
	case FS_STAT:
		array_init(return_value);

		ZVAL_LONG(&stat_dev, stat_sb->st_dev);
		ZVAL_LONG(&stat_ino, stat_sb->st_ino);
		ZVAL_LONG(&stat_mode, stat_sb->st_mode);
		ZVAL_LONG(&stat_nlink, stat_sb->st_nlink);
		ZVAL_LONG(&stat_uid, stat_sb->st_uid);
		ZVAL_LONG(&stat_gid, stat_sb->st_gid);
#ifdef HAVE_ST_RDEV
		ZVAL_LONG(&stat_rdev, stat_sb->st_rdev);
#else
		ZVAL_LONG(&stat_rdev, -1);
#endif
		ZVAL_LONG(&stat_size, stat_sb->st_size);
#ifdef NETWARE
		ZVAL_LONG(&stat_atime, (stat_sb->st_atime).tv_sec);
		ZVAL_LONG(&stat_mtime, (stat_sb->st_mtime).tv_sec);
		ZVAL_LONG(&stat_ctime, (stat_sb->st_ctime).tv_sec);
#else
		ZVAL_LONG(&stat_atime, stat_sb->st_atime);
		ZVAL_LONG(&stat_mtime, stat_sb->st_mtime);
		ZVAL_LONG(&stat_ctime, stat_sb->st_ctime);
#endif
#ifdef HAVE_ST_BLKSIZE
		ZVAL_LONG(&stat_blksize, stat_sb->st_blksize);
#else
		ZVAL_LONG(&stat_blksize,-1);
#endif
#ifdef HAVE_ST_BLOCKS
		ZVAL_LONG(&stat_blocks, stat_sb->st_blocks);
#else
		ZVAL_LONG(&stat_blocks,-1);
#endif
		/* Store numeric indexes in proper order */
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_dev);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_ino);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_mode);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_nlink);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_uid);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_gid);

		zend_hash_next_index_insert(HASH_OF(return_value), &stat_rdev);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_size);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_atime);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_mtime);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_ctime);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_blksize);
		zend_hash_next_index_insert(HASH_OF(return_value), &stat_blocks);

		/* Store string indexes referencing the same zval*/
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[0], strlen(stat_sb_names[0]), &stat_dev);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[1], strlen(stat_sb_names[1]), &stat_ino);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[2], strlen(stat_sb_names[2]), &stat_mode);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[3], strlen(stat_sb_names[3]), &stat_nlink);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[4], strlen(stat_sb_names[4]), &stat_uid);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[5], strlen(stat_sb_names[5]), &stat_gid);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[6], strlen(stat_sb_names[6]), &stat_rdev);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[7], strlen(stat_sb_names[7]), &stat_size);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[8], strlen(stat_sb_names[8]), &stat_atime);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[9], strlen(stat_sb_names[9]), &stat_mtime);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[10], strlen(stat_sb_names[10]), &stat_ctime);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[11], strlen(stat_sb_names[11]), &stat_blksize);
		zend_hash_str_update(HASH_OF(return_value), stat_sb_names[12], strlen(stat_sb_names[12]), &stat_blocks);

		return;
	}
	php_error_docref(NULL, E_WARNING, "Didn't understand stat call");
	RETURN_FALSE;
}
Exemple #18
0
/**
 * Returns true if the event watcher is pending (ie. it has outstanding events but
 * the callback has not been called yet).
 * 
 * @return boolean
 * @return null  If object has not been initialized
 */
PHP_METHOD(Event, isPending)
{
	event_object *obj = (event_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
	
	RETURN_BOOL(event_is_pending(obj));
}
Exemple #19
0
/**
 * Returns true if the event is active, ie. associated with an event loop.
 * 
 * @return boolean
 * @return null  If object has not been initialized
 */
PHP_METHOD(Event, isActive)
{
	event_object *obj = (event_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
	
	RETURN_BOOL(event_is_active(obj));
}
Exemple #20
0
/** {{{ proto bool Win\Gdi\Window::endPaint( paint_data );
		Marks the end of painting in the specified window.
*/
PHP_METHOD( WinGdiWindow, endPaint )
{
	wingdi_devicecontext_object * dc_object;
	wingdi_window_object        * window_object = zend_object_store_get_object( getThis() TSRMLS_CC );
	HashTable                   * paint_data;
	PAINTSTRUCT                   paint_struct;

	WINGDI_ERROR_HANDLING();
	if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "h", &paint_data ) == FAILURE )
		return;
	WINGDI_RESTORE_ERRORS();

	// Error checking
	// Not sure about the error messages
	if ( ! zend_hash_exists( paint_data, "hdc", strlen( "hdc" ) + 1 ) )
	{
		php_error( E_ERROR, "no 'hdc' element found in array" );
		return;
	}
	else if ( ! zend_hash_exists( paint_data, "erase", strlen( "erase" ) + 1 ) )
	{
		php_error( E_ERROR, "no 'erase' element found in array" );
		return;
	}
	else if ( ! zend_hash_exists( paint_data, "paint", strlen( "paint" ) + 1 ) )
	{
		php_error( E_ERROR, "no 'paint' element found in array" );
		return;
	}
	else
	{
		zval ** hdc_element,
			 ** erase_element,
			 ** paint_element,
			 ** left = NULL, ** top = NULL, ** right = NULL, ** bottom = NULL;
		HashTable * paint_rect;

		zend_hash_find( paint_data, "hdc", strlen( "hdc" ) + 1, ( void ** ) &hdc_element );
		dc_object = ( wingdi_devicecontext_object * ) zend_objects_get_address( * hdc_element TSRMLS_CC );
		paint_struct.hdc = dc_object->hdc;

		zend_hash_find( paint_data, "erase", strlen( "erase" ) + 1, ( void ** ) &erase_element );
		paint_struct.fErase = Z_BVAL_PP( erase_element );

		zend_hash_find( paint_data, "paint", strlen( "paint" ) + 1, ( void ** ) &paint_element );
		if ( Z_TYPE_PP( paint_element ) != IS_ARRAY || zend_hash_num_elements( Z_ARRVAL_PP( paint_element ) ) < 4 )
		{
			php_error( E_ERROR, "expected an array of for elements for 'paint' element of array" );
			return;
		}
		paint_rect = Z_ARRVAL_PP( paint_element );
		// TODO: error checking
		zend_hash_index_find( paint_rect, 0, ( void ** ) &left );
		zend_hash_index_find( paint_rect, 1, ( void ** ) &top );
		zend_hash_index_find( paint_rect, 2, ( void ** ) &right );
		zend_hash_index_find( paint_rect, 3, ( void ** ) &bottom );
		paint_struct.rcPaint.left = Z_LVAL_PP( left );
		paint_struct.rcPaint.top = Z_LVAL_PP( top );
		paint_struct.rcPaint.right = Z_LVAL_PP( right );
		paint_struct.rcPaint.bottom = Z_LVAL_PP( bottom );

		RETURN_BOOL( EndPaint( window_object->window_handle, &paint_struct ) );
	}
}
Exemple #21
0
static PHP_METHOD(Operand, isConstant) {
	php_inspector_operand_t *operand = 
		php_inspector_operand_this();

	RETURN_BOOL(operand->type & IS_CONST);
}
Exemple #22
0
PHP_METHOD(Mongo, getSlaveOkay)
{
	mongoclient *link;
	PHP_MONGO_GET_LINK(getThis());
	RETURN_BOOL(link->servers->read_pref.type != MONGO_RP_PRIMARY);
}
Exemple #23
0
static PHP_METHOD(Operand, isUnused) {
	php_inspector_operand_t *operand = 
		php_inspector_operand_this();

	RETURN_BOOL(operand->type & IS_UNUSED);
}
Exemple #24
0
PHP_METHOD(Struct, isPointer) {
	RETURN_BOOL(0);
}
Exemple #25
0
PHP_METHOD(Struct, getIndirection) {
	RETURN_BOOL(0);
}
Exemple #26
0
PHP_METHOD(Money, lessThan)
{
	CHECK_MONEY_PARAMS

	RETURN_BOOL(money_handler_compare_objects(getThis(), other_money) == -1);
}
Exemple #27
0
PHP_METHOD(Money, equals)
{
	CHECK_MONEY_PARAMS

	RETURN_BOOL(money_handler_compare_objects(getThis(), other_money) == 0);
}
Exemple #28
0
/* {{{ proto boolean tidy_is_xml()
   Indicates if the document is a generic (non HTML/XHTML) XML document. */
static PHP_FUNCTION(tidy_is_xml)
{
	TIDY_FETCH_OBJECT;

	RETURN_BOOL(tidyDetectedGenericXml(obj->ptdoc->doc));
}
Exemple #29
0
PHP_METHOD(MongoDB, getSlaveOkay) {
  mongo_db *db;
  PHP_MONGO_GET_DB(getThis());
  RETURN_BOOL(db->slave_okay);
}
Exemple #30
0
static PHP_METHOD(Operand, isVariable) {
	php_inspector_operand_t *operand = 
		php_inspector_operand_this();

	RETURN_BOOL(operand->type & IS_VAR);
}