summaryrefslogtreecommitdiff
path: root/README.PARAMETER_PARSING_API
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2006-07-11 23:05:47 +0000
committerAndrei Zmievski <andrei@php.net>2006-07-11 23:05:47 +0000
commit19b551388125114f9e92cef9b691e9ca28f0dea0 (patch)
tree94a5da3e3656b0a8b475f8995b4acc81558d2872 /README.PARAMETER_PARSING_API
parent85766e787c5b1b11c2b6077047030b5ab07345d0 (diff)
downloadphp-git-19b551388125114f9e92cef9b691e9ca28f0dea0.tar.gz
Explain new specifiers
Diffstat (limited to 'README.PARAMETER_PARSING_API')
-rw-r--r--README.PARAMETER_PARSING_API51
1 files changed, 47 insertions, 4 deletions
diff --git a/README.PARAMETER_PARSING_API b/README.PARAMETER_PARSING_API
index 47d240583d..f8e334d363 100644
--- a/README.PARAMETER_PARSING_API
+++ b/README.PARAMETER_PARSING_API
@@ -41,11 +41,13 @@ Type specifiers
l - long (long)
d - double (double)
s - string (with possible null bytes) and its length (char*, int)
- u - unicode (UChar*, int)
+ u - Unicode (UChar*, int)
t - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..))
- actual type is controled by ini unicode setting
+ accepts either Unicode or binary string
T - text (void * (char*/Uchar*), int (length), zend_uchar (IS_STRING/..))
- actual type controlled by first s or u
+ coalesces all T parameters to common type (Unicode or binary)
+ U - Unicode string, does not allow conversion from binary strings
+ S - binary string, does not allow conversion from Unicode strings
b - boolean (zend_bool)
r - resource (zval*)
a - array (zval*)
@@ -107,7 +109,47 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!",
}
-/* Get only the first three parameters (useful for varargs functions). */
+/* Gets a Unicode string */
+UChar *str;
+int len;
+
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "u", &str, &len) == FAILURE) {
+ return;
+}
+
+
+/* Gets a Unicode or binary string */
+void *str;
+int len;
+zend_uchar type;
+
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &str, &len, &type) == FAILURE) {
+ return;
+}
+if (type == IS_UNICODE) {
+ /* process Unicode string */
+} else {
+ /* process binary string */
+}
+
+
+/* Gets two string parameters, both of which will be guaranteed to be of the same type */
+void *str1, *str2;
+int len1, len2;
+zend_uchar type1, type2;
+
+if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "TT", &str1, &len1,
+ &type1, &str2, &len2, &type2) == FAILURE) {
+ return;
+}
+if (type1 == IS_UNICODE) {
+ /* process as Unicode, str2 is guaranteed to be Unicode as well */
+} else {
+ /* process as binary string, str2 is guaranteed to be the same */
+}
+
+
+/* Gets only the first three parameters (useful for varargs functions). */
zval *z;
zend_bool b;
zval *r;
@@ -140,3 +182,4 @@ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC,
return;
}
+