PHP_METHOD(Test_Statements, testElseIf) { zval *num_param = NULL; int num; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; zephir_fetch_params(0, 1, 0, &num_param); num = zephir_get_intval(num_param); if (num > 0) { RETURN_STRING("more"); } else if (num == 0) { RETURN_STRING("equal"); } else if (num == -1) { RETURN_STRING("-1"); } else { RETURN_STRING("less"); } }
/* {{{ proto string basedir_calculate() */ static PHP_FUNCTION(basedir_calculate) { char *new_basedir; char *path, *uri, *path_info, *component; #if PHP_MAJOR_VERSION < 7 int path_len, uri_len, path_info_len, component_len; #else size_t path_len, uri_len, path_info_len, component_len; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssss", &path, &path_len, &uri, &uri_len, &path_info, &path_info_len, &component, &component_len) == FAILURE) { return; } new_basedir = emalloc(path_len + PATH_MAX + 1); new_basedir[0] = '\0'; calculate_basedir(path, uri, path_info, component, new_basedir); #if PHP_MAJOR_VERSION < 7 RETURN_STRING(new_basedir, 0); #else RETURN_STRING(new_basedir); #endif }
/* {{{ proto int hashtable.get(string key) Get a value from item by its key. Returns empty string if not found. */ PHP_METHOD(hashtableObj, get) { char *key; long key_len = 0; zval *zobj = getThis(); const char *value = NULL; php_hashtable_object *php_hashtable; PHP_MAPSCRIPT_ERROR_HANDLING(TRUE); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) { PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); return; } PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); php_hashtable = (php_hashtable_object *) zend_object_store_get_object(zobj TSRMLS_CC); value = hashTableObj_get(php_hashtable->hashtable, key); if (value == NULL) { RETURN_STRING("",1); } RETURN_STRING((char *)value, 1); }
/** * Returns the string meaning of a logger constant */ PHP_METHOD(Phalcon_Logger_Formatter_Firephp, getTypeString) { zval *type_param = NULL; int type; zephir_fetch_params(0, 1, 0, &type_param); type = zephir_get_intval(type_param); do { if (type == 0 || type == 1 || type == 3) { RETURN_STRING("ERROR", 1); } if (type == 2 || type == 4) { RETURN_STRING("WARN", 1); } if (type == 6 || type == 5 || type == 8) { RETURN_STRING("INFO", 1); } if (type == 7 || type == 9) { RETURN_STRING("LOG", 1); } } while(0); RETURN_STRING("CUSTOM", 1); }
/** * Check if a string is encoded with ASCII or ISO-8859-1 */ void zephir_is_basic_charset(zval *return_value, const zval *param) { unsigned int i; unsigned int ch; int iso88591 = 0; for (i = 0; i < Z_STRLEN_P(param); i++) { ch = Z_STRVAL_P(param)[i]; if (ch != '\0') { if (ch == 172 || (ch >= 128 && ch <= 159)) { continue; } if (ch >= 160 && ch <= 255) { iso88591 = 1; continue; } } RETURN_FALSE; } if (!iso88591) { RETURN_STRING("ASCII"); } RETURN_STRING("ISO-8859-1"); }
/** * Check if a string is encoded with ASCII or ISO-8859-1 */ void phalcon_is_basic_charset(zval *return_value, const zval *param){ int i; unsigned char ch; int iso88591 = 0; for (i = 0; i < Z_STRLEN_P(param); i++) { ch = (unsigned char)(Z_STRVAL_P(param)[i]); if (ch != '\0') { if (ch == 172 || (ch >= 128 && ch <= 159)) { continue; } if (ch >= 160) { iso88591 = 1; continue; } } RETURN_FALSE; } if (!iso88591) { RETURN_STRING("ASCII", 1); } RETURN_STRING("ISO-8859-1", 1); }
PHP_METHOD(Test_Statements, testElseIf2) { zval *num_param = NULL, *total, total_sub; int num; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&total_sub); zephir_fetch_params(0, 2, 0, &num_param, &total); num = zephir_get_intval(num_param); if (ZEPHIR_GT_LONG(total, num)) { RETURN_STRING("less"); } else if (ZEPHIR_IS_LONG(total, num)) { RETURN_STRING("equal"); } else { RETURN_STRING("else"); } }
/* {{{ proto string shape.getValue(layerObj layer, string fieldName) Returns value for specified field name. */ PHP_METHOD(shapeObj, getValue) { zval *zobj = getThis(); zval *zlayer; char *fieldName; long fieldName_len; int i; php_layer_object *php_layer; php_shape_object *php_shape; PHP_MAPSCRIPT_ERROR_HANDLING(TRUE); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Os", &zlayer, mapscript_ce_layer, &fieldName, &fieldName_len) == FAILURE) { PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); return; } PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); php_shape = (php_shape_object *) zend_object_store_get_object(zobj TSRMLS_CC); php_layer = (php_layer_object *) zend_object_store_get_object(zlayer TSRMLS_CC); if (php_shape->shape->numvalues != php_layer->layer->numitems) RETURN_STRING("", 1); for(i=0; i<php_layer->layer->numitems; i++) { if (strcasecmp(php_layer->layer->items[i], fieldName)==0) { RETURN_STRING(php_shape->shape->values[i], 1); } } }
static PHP_FUNCTION(debug) { #if PHP_MAJOR_VERSION < 7 RETURN_STRING("Hello Dave",0); #else RETURN_STRING("Hello Dave"); #endif }
wxString SjTrackInfo::GetValue(long ti) const { #define RETURN_STRING(n) \ return (n); #define RETURN_LONG(n) \ return wxString::Format("%i", (int)(n)); switch( ti ) { case SJ_TI_URL: RETURN_STRING (m_url); case SJ_TI_TRACKNAME: RETURN_STRING (m_trackName); case SJ_TI_TRACKNR: RETURN_LONG (m_trackNr); case SJ_TI_TRACKCOUNT: RETURN_LONG (m_trackCount); case SJ_TI_DISKNR: RETURN_LONG (m_diskNr); case SJ_TI_DISKCOUNT: RETURN_LONG (m_diskCount); case SJ_TI_LEADARTISTNAME: RETURN_STRING (m_leadArtistName); case SJ_TI_ORGARTISTNAME: RETURN_STRING (m_orgArtistName); case SJ_TI_COMPOSERNAME: RETURN_STRING (m_composerName); case SJ_TI_ALBUMNAME: RETURN_STRING (m_albumName); case SJ_TI_GENRENAME: RETURN_STRING (m_genreName); case SJ_TI_GROUPNAME: RETURN_STRING (m_groupName); case SJ_TI_COMMENT: RETURN_STRING (m_comment); case SJ_TI_BEATSPERMINUTE: RETURN_LONG (m_beatsPerMinute); case SJ_TI_RATING: RETURN_LONG (m_rating); case SJ_TI_YEAR: RETURN_LONG (m_year); case SJ_TI_PLAYTIMEMS: RETURN_LONG (m_playtimeMs); case SJ_TI_X_TIMESPLAYED: RETURN_LONG (m_timesPlayed); case SJ_TI_X_CHANNELS: RETURN_LONG (m_channels); } wxASSERT( 0 ); return "***"; }
Handle<Value> MSMap::PropertyGetter (Local<String> property, const AccessorInfo& info) { MSMap *map = ObjectWrap::Unwrap<MSMap>(info.This()); v8::String::AsciiValue n(property); if (strcmp(*n, "width") == 0) { RETURN_NUMBER(map->this_->width); } else if (strcmp(*n, "height") == 0) { RETURN_NUMBER(map->this_->height); } else if (strcmp(*n, "status") == 0) { RETURN_NUMBER(map->this_->status); } else if (strcmp(*n, "maxsize") == 0) { RETURN_NUMBER(map->this_->maxsize); } else if (strcmp(*n, "cellsize") == 0) { RETURN_NUMBER(map->this_->cellsize); } else if (strcmp(*n, "units") == 0) { RETURN_NUMBER(map->this_->units); } else if (strcmp(*n, "scaledenom") == 0) { RETURN_NUMBER(map->this_->scaledenom); } else if (strcmp(*n, "resolution") == 0) { RETURN_NUMBER(map->this_->resolution); } else if (strcmp(*n, "defresolution") == 0) { RETURN_NUMBER(map->this_->defresolution); } else if (strcmp(*n, "imagetype") == 0) { RETURN_STRING(map->this_->imagetype); } else if (strcmp(*n, "mimetype") == 0) { RETURN_STRING(map->this_->outputformat->mimetype); } else if (strcmp(*n, "shapepath") == 0) { RETURN_STRING(map->this_->shapepath); } else if (strcmp(*n, "mappath") == 0) { RETURN_STRING(map->this_->mappath); } else if (strcmp(*n, "name") == 0) { RETURN_STRING(map->this_->name); } else if (strcmp(*n, "outputformat") == 0) { HandleScope scope; return scope.Close(MSOutputFormat::New(map->this_->outputformat)); } else if (strcmp(*n, "projection") == 0) { HandleScope scope; return scope.Close(MSProjection::New(&map->this_->projection)); } else if (strcmp(*n, "layers") == 0) { HandleScope scope; return scope.Close(MSLayers::New(map->this_)); } else if (strcmp(*n, "metadata") == 0) { HandleScope scope; #if MS_VERSION_NUM < 60400 Handle<ObjectTemplate> objTempl = ObjectTemplate::New(); Local<Object> result = objTempl->NewInstance(); return scope.Close(result); #else return scope.Close(MSHashTable::New(&(map->this_->web.metadata))); #endif } else if (strcmp(*n, "extent") == 0) { HandleScope scope; return scope.Close(MSRect::New(&map->this_->extent)); } return Undefined(); }
/* {{{ * Gets the value from ICU , called when PHP userspace function is called * common code shared by get_primary_language,get_script or get_region or get_variant */ static void get_icu_value_src_php( char* tag_name, INTERNAL_FUNCTION_PARAMETERS) { char* loc_name = NULL; int loc_name_len = 0; char* tag_value = NULL; char* empty_result = ""; int result = 0; char* msg = NULL; UErrorCode status = U_ZERO_ERROR; intl_error_reset( NULL TSRMLS_CC ); if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &loc_name ,&loc_name_len ) == FAILURE) { spprintf(&msg , 0, "locale_get_%s : unable to parse input params", tag_name ); intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, msg , 1 TSRMLS_CC ); efree(msg); RETURN_FALSE; } if(loc_name_len == 0) { loc_name = INTL_G(default_locale); } /* Call ICU get */ tag_value = get_icu_value_internal( loc_name , tag_name , &result ,0); /* No value found */ if( result == -1 ) { if( tag_value){ efree( tag_value); } RETURN_STRING( empty_result , TRUE); } /* value found */ if( tag_value){ RETURN_STRING( tag_value , FALSE); } /* Error encountered while fetching the value */ if( result ==0) { spprintf(&msg , 0, "locale_get_%s : unable to get locale %s", tag_name , tag_name ); intl_error_set( NULL, status, msg , 1 TSRMLS_CC ); efree(msg); RETURN_NULL(); } }
PHP_METHOD(Phalcon_Internal_TestParent, smp1){ PHALCON_MM_GROW(); PHALCON_MM_RESTORE(); RETURN_STRING("parent-protected", 1); }
PHP_METHOD(Phalcon_Internal_TestParent, mp1){ PHALCON_MM_GROW(); PHALCON_MM_RESTORE(); RETURN_STRING("mp1", 1); }
/* {{{ MongoCode::__toString() */ PHP_METHOD(MongoCode, __toString) { zval *zode = zend_read_property(mongo_ce_Code, getThis(), "code", strlen("code"), NOISY TSRMLS_CC); convert_to_string_ex(&zode); RETURN_STRING(Z_STRVAL_P(zode), 1); }
static PHP_METHOD(php_midgard_reflection_method, getDocComment) { reflection_object *intern; zend_function *fptr; RETVAL_FALSE; if (zend_parse_parameters_none() == FAILURE) return; GET_REFLECTION_OBJECT_PTR(fptr); if (fptr->type == ZEND_USER_FUNCTION) { #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3 RETURN_FALSE; #endif if (fptr->op_array.doc_comment) { RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1); } else { RETURN_FALSE; } } else { zval *ref_class = zend_read_property(php_midgard_reflection_class_class, getThis(), "class", sizeof("class")-1, 0 TSRMLS_CC); \ zval *ref_method = zend_read_property(php_midgard_reflection_class_class, getThis(), "name", sizeof("name")-1, 0 TSRMLS_CC); \ if (!ref_class || !ref_method) RETURN_FALSE; const char *comment = php_midgard_docs_get_method_comment((const gchar *) Z_STRVAL_P(ref_class), (const gchar *) Z_STRVAL_P(ref_method)); RETURN_STRING ((char *)comment, 1); } }
/* {{{ MongoCursor->key */ PHP_METHOD(MongoCursor, key) { zval **id; mongo_cursor *cursor = (mongo_cursor*)zend_object_store_get_object(getThis() TSRMLS_CC); MONGO_CHECK_INITIALIZED(cursor->link, MongoCursor); if (cursor->current && Z_TYPE_P(cursor->current) == IS_ARRAY && zend_hash_find(HASH_P(cursor->current), "_id", 4, (void**)&id) == SUCCESS) { if (Z_TYPE_PP(id) == IS_OBJECT) { #if ZEND_MODULE_API_NO >= 20060613 zend_std_cast_object_tostring(*id, return_value, IS_STRING TSRMLS_CC); #else zend_std_cast_object_tostring(*id, return_value, IS_STRING, 0 TSRMLS_CC); #endif /* ZEND_MODULE_API_NO >= 20060613 */ } else { RETVAL_ZVAL(*id, 1, 0); convert_to_string(return_value); } } else { RETURN_STRING("", 1); } }
PHP_METHOD(ArrayList, get){ long index; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &index) == FAILURE) { RETURN_NULL(); } list_object* obj = (list_object*) zend_object_store_get_object(getThis() TSRMLS_CC); if (obj->object != NULL) { try { if(obj->type == TYPE_LONG) { RETURN_LONG(((List<long>*) obj->object)->get(index)); } else if (obj->type == TYPE_DOUBLE) { RETURN_DOUBLE(((List<double>*) obj->object)->get(index)); } else if (obj->type == TYPE_BOOLEAN) { RETURN_BOOL(((List<char>*) obj->object)->get(index)); } else if (obj->type == TYPE_STRING) { RETURN_STRING(((List<char*>*) obj->object)->get(index),1); } else { RETURN_ZVAL(((List<zval*>*) obj->object)->get(index),1,0); } } catch (const std::out_of_range& e) { zend_throw_exception(NULL, e.what(), 0 TSRMLS_CC); RETURN_NULL(); } } }
U_CFUNC PHP_FUNCTION(intlcal_get_locale) { zend_long locale_type; CALENDAR_METHOD_INIT_VARS; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, Calendar_ce_ptr, &locale_type) == FAILURE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_locale: bad arguments", 0 TSRMLS_CC); RETURN_FALSE; } if (locale_type != ULOC_ACTUAL_LOCALE && locale_type != ULOC_VALID_LOCALE) { intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR, "intlcal_get_locale: invalid locale type", 0 TSRMLS_CC); RETURN_FALSE; } CALENDAR_METHOD_FETCH_OBJECT; Locale locale = co->ucal->getLocale((ULocDataLocaleType)locale_type, CALENDAR_ERROR_CODE(co)); INTL_METHOD_CHECK_STATUS(co, "intlcal_get_locale: Call to ICU method has failed"); RETURN_STRING(locale.getName()); }
PHP_METHOD(SpotifyPlaylist, getName) { zval *object = getThis(); spotifyplaylist_object *p = (spotifyplaylist_object*)zend_object_store_get_object(object TSRMLS_CC); RETURN_STRING(sp_playlist_name(p->playlist), 1); }
PHP_METHOD(Test_Oo_ConstantsInterface, testReadInterfaceConstant6) { RETURN_STRING("test", 1); }
/** * Gets HTTP header from request data * * @param string $header * @return string */ PHP_METHOD(Phalcon_Http_Request, getHeader){ zval *header = NULL, *server_value = NULL, *key = NULL; zval *g0 = NULL; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &header) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } phalcon_get_global(&g0, SL("_SERVER")+1 TSRMLS_CC); eval_int = phalcon_array_isset(g0, header); if (eval_int) { PHALCON_INIT_VAR(server_value); phalcon_array_fetch(&server_value, g0, header, PH_NOISY_CC); RETURN_CCTOR(server_value); } else { PHALCON_INIT_VAR(key); PHALCON_CONCAT_SV(key, "HTTP_", header); eval_int = phalcon_array_isset(g0, key); if (eval_int) { PHALCON_INIT_VAR(server_value); phalcon_array_fetch(&server_value, g0, key, PH_NOISY_CC); RETURN_CCTOR(server_value); } } PHALCON_MM_RESTORE(); RETURN_STRING("", 1); }
/** * Returns an option * * @param string $option * @return mixed */ PHP_METHOD(Phalcon_Mvc_Model_Validator, getOption){ zval *option = NULL, *options = NULL, *value = NULL; int eval_int; PHALCON_MM_GROW(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &option) == FAILURE) { PHALCON_MM_RESTORE(); RETURN_NULL(); } PHALCON_INIT_VAR(options); phalcon_read_property(&options, this_ptr, SL("_options"), PH_NOISY_CC); eval_int = phalcon_array_isset(options, option); if (eval_int) { PHALCON_INIT_VAR(value); phalcon_array_fetch(&value, options, option, PH_NOISY_CC); RETURN_CCTOR(value); } PHALCON_MM_RESTORE(); RETURN_STRING("", 1); }
/* {{{ proto string Glib::userSpecialDir(int user_dir_type) Returns the full path of a special directory using its logical id. One of Glib::USER_DIRECTORY_* constants is supposed to be used as parameter */ PHP_METHOD(Glib, userSpecialDir) { long dir_type; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &dir_type) == FAILURE) { return; } if (dir_type < 0 || dir_type >= G_USER_N_DIRECTORIES) { zval *exception; MAKE_STD_ZVAL(exception); object_init_ex(exception, glib_ce_exception); zend_update_property_string(glib_ce_exception, exception, "message", sizeof("message")-1, "invalid user-directory type" TSRMLS_CC); zend_throw_exception_object(exception TSRMLS_CC); return; } const char *retval = g_get_user_special_dir(dir_type); if (NULL == retval) { RETURN_NULL(); } RETURN_STRING(retval, 1); }
PHP_METHOD(Test_TryTest, testTry11) { zval ex; zval this_zv; zval *this_ptr = getThis(); if (EXPECTED(this_ptr)) { ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr)); this_ptr = &this_zv; } else this_ptr = NULL; ZVAL_UNDEF(&ex); /* try_start_1: */ RETURN_STRING("test"); try_end_1: if (EG(exception)) { ZVAL_OBJ(&ex, EG(exception)); Z_ADDREF_P(&ex); if (zephir_instance_of_ev(&ex, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) { zend_clear_exception(TSRMLS_C); } } }
static PHP_METHOD(php_midgard_reflection_class, getDocComment) { if (zend_parse_parameters_none() == FAILURE) { return; } _GET_RC_CE; if (ce == NULL) RETURN_NULL(); #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 3 RETURN_STRING(ce->info.user.doc_comment ? ce->info.user.doc_comment : "", 1); #else RETURN_STRING(ce->doc_comment ? ce->doc_comment : "", 1); #endif }
/* {{{ proto string tidy_get_opt_doc(tidy resource, string optname) Returns the documentation for the given option name */ static PHP_FUNCTION(tidy_get_opt_doc) { PHPTidyObj *obj; char *optval, *optname; size_t optname_len; TidyOption opt; TIDY_SET_CONTEXT; if (object) { if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &optname, &optname_len) == FAILURE) { RETURN_FALSE; } } else { if (zend_parse_method_parameters(ZEND_NUM_ARGS(), NULL, "Os", &object, tidy_ce_doc, &optname, &optname_len) == FAILURE) { RETURN_FALSE; } } obj = Z_TIDY_P(object); opt = tidyGetOptionByName(obj->ptdoc->doc, optname); if (!opt) { php_error_docref(NULL, E_WARNING, "Unknown Tidy Configuration Option '%s'", optname); RETURN_FALSE; } if ( (optval = (char *) tidyOptGetDoc(obj->ptdoc->doc, opt)) ) { RETURN_STRING(optval); } RETURN_FALSE; }
/** {{{ 获取错误消息 */ PHP_METHOD(HyperMobile, getErrorMsg) { zval *self,*ErrorMsg; self = getThis(); ErrorMsg=zend_read_property(Z_OBJCE_P(self),self,ZEND_STRL("err_msg"),0 TSRMLS_CC); RETURN_STRING(Z_STRVAL_P(ErrorMsg),1); // RETURN_FALSE; }
PHP_METHOD(ExecutionOptions, __get) { char *name; int name_len; cassandra_execution_options* self = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) { return; } self = (cassandra_execution_options*) zend_object_store_get_object(getThis() TSRMLS_CC); if (name_len == 11 && strncmp("consistency", name, name_len) == 0) { RETURN_LONG(self->consistency); } else if (name_len == 17 && strncmp("serialConsistency", name, name_len) == 0) { RETURN_LONG(self->serial_consistency); } else if (name_len == 8 && strncmp("pageSize", name, name_len) == 0) { RETURN_LONG(self->page_size); } else if (name_len == 16 && strncmp("pagingStateToken", name, name_len) == 0) { RETURN_STRING(self->paging_state_token, self->paging_state_token_size); } else if (name_len == 7 && strncmp("timeout", name, name_len) == 0) { RETURN_ZVAL(self->timeout, 1, 0); } else if (name_len == 9 && strncmp("arguments", name, name_len) == 0) { RETURN_ZVAL(self->arguments, 1, 0); } }
/* * {{{ public gene_controller::getMethod() */ PHP_METHOD(gene_controller, getMethod) { if (GENE_G(method)) { RETURN_STRING(GENE_G(method), 1); } RETURN_NULL() ; }