cvs: ZendEngine2 / zend.c zend_execute_API.c zend_globals.h zend_operators.c zend_operators.h
| From: | Ilia Alshanetsky | Date: | Sat, 12 Oct 2002 21:15:35 +0000 |
| Subject: | cvs: ZendEngine2 / zend.c zend_execute_API.c zend_globals.h zend_operators.c zend_operators.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-506@lists.php.net to get a copy of this message | ||
iliaa Sat Oct 12 17:15:35 2002 EDT
Modified files:
/ZendEngine2 zend.c zend_execute_API.c zend_globals.h
zend_operators.c zend_operators.h
Log:
MFZE1 (floats & locale issue)
Index: ZendEngine2/zend.c
diff -u ZendEngine2/zend.c:1.185 ZendEngine2/zend.c:1.186
--- ZendEngine2/zend.c:1.185 Mon Oct 7 17:20:23 2002
+++ ZendEngine2/zend.c Sat Oct 12 17:15:34 2002
@@ -156,6 +156,11 @@
expr_copy->value.str.val = estrndup("Object", expr_copy->value.str.len);
#endif
break;
+ case IS_DOUBLE:
+ *expr_copy = *expr;
+ zval_copy_ctor(expr_copy);
+ zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);
+ break;
default:
*expr_copy = *expr;
zval_copy_ctor(expr_copy);
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.180 ZendEngine2/zend_execute_API.c:1.181
--- ZendEngine2/zend_execute_API.c:1.180 Wed Oct 9 10:21:40 2002
+++ ZendEngine2/zend_execute_API.c Sat Oct 12 17:15:34 2002
@@ -180,6 +180,8 @@
EG(current_execute_data) = NULL;
EG(This) = NULL;
+
+ EG(float_separator)[0] = '.';
}
Index: ZendEngine2/zend_globals.h
diff -u ZendEngine2/zend_globals.h:1.107 ZendEngine2/zend_globals.h:1.108
--- ZendEngine2/zend_globals.h:1.107 Mon Oct 7 17:20:23 2002
+++ ZendEngine2/zend_globals.h Sat Oct 12 17:15:34 2002
@@ -209,6 +209,9 @@
struct _zend_execute_data *current_execute_data;
+ /* locale stuff */
+ char float_separator[1];
+
void *reserved[ZEND_MAX_RESERVED_RESOURCES];
};
Index: ZendEngine2/zend_operators.c
diff -u ZendEngine2/zend_operators.c:1.136 ZendEngine2/zend_operators.c:1.137
--- ZendEngine2/zend_operators.c:1.136 Wed Oct 9 10:21:40 2002
+++ ZendEngine2/zend_operators.c Sat Oct 12 17:15:35 2002
@@ -1764,3 +1764,21 @@
result->value.lval = Z_OBJ_HT_P(o1)->compare_objects(o1, o2 TSRMLS_CC);
}
}
+
+ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC)
+{
+ double dval = op->value.dval;
+
+ TSRMLS_FETCH();
+
+ op->value.str.val = (char *) emalloc_rel(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1);
+ sprintf(op->value.str.val, "%.*G", (int) EG(precision), dval);
+ op->value.str.len = strlen(op->value.str.val);
+
+ if (EG(float_separator)[0] != '.') {
+ char *p = op->value.str.val;
+ if ((p = strchr(p, '.'))) {
+ *p = EG(float_separator)[0];
+ }
+ }
+}
\ No newline at end of file
Index: ZendEngine2/zend_operators.h
diff -u ZendEngine2/zend_operators.h:1.60 ZendEngine2/zend_operators.h:1.61
--- ZendEngine2/zend_operators.h:1.60 Wed Oct 9 10:21:40 2002
+++ ZendEngine2/zend_operators.h Sat Oct 12 17:15:35 2002
@@ -187,6 +187,8 @@
ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
+
#define convert_to_ex_master(ppzv, lower_type, upper_type) \
if ((*ppzv)->type!=IS_##upper_type) { \
if (!(*ppzv)->is_ref) { \