ext->warn_task_p = NULL;
}
+#if 0//def __MMI_ZHSX_SUPPORT__
+char * mmi_strtok(char ** str1, uint8_t len1, char * str2, uint8_t len2)
+{
+ char * t_str = NULL;
+ uint8_t t_index = 0;
+ uint8_t i = 0;
+
+ t_str = *str1;
+ for(i = 0; i < len1; i++)
+ {
+ if(strncmp(* str1 + i, str2, len2) == 0)
+ {
+ * str1 += (i + len2);
+
+ t_str[i] = '\0';
+ return t_str;
+ }
+ }
+
+ return NULL;
+}
+#endif
+
static void calc_add_oper(char * ptr)
{
lv_calculator_obj_ext_t * ext = calc_get_ext();
else
{
printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
- #ifdef __MMI_ZHSX_SUPPORT__
+ #if 0//def __MMI_ZHSX_SUPPORT__
char * fac1 = NULL;
char * fac2 = NULL;
char * temp = NULL;
if(sn) {
temp = &sn[2];
}
+
+ printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+ #if 1
strtok(temp, ext->oper);
+ printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
fac2 = strtok(NULL, ptr);
+ printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
#if CALC_LATIN_SYMBOL_MUL_AND_DIV_SUP != 0
if(strcmp(ext->oper, CALC_MUL) == 0 || strcmp(ext->oper, CALC_DIV) == 0) {
fac2 = &fac2[1];
}
#endif
fac1 = (char *)text;
+
+ #else
+
+ fac1 = mmi_strtok(&temp, strlen(temp), ext->oper, strlen(ext->oper));
+ printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+ fac2 = mmi_strtok(&temp, strlen(temp), ptr, strlen(ptr));
+ printf("[@CHENG_DEBUG][%s][%d]: temp=%s\n", __FUNCTION__, __LINE__, temp);
+ #endif
+
printf("[@CHENG_DEBUG][%s][%d]: fac1=%s,fac2=%s\n", __FUNCTION__, __LINE__, fac1, fac2);
calc_get_result(fac1, fac2);
+
ext->oper = ptr;
calc_label_add_text(ext, ptr);
ext->finish_flag = false;
- ext->input_len = 0;
- ext->point = false;
+ text = lv_label_get_text(ext->label);
+ char * point = strchr(text, '.');
+ if(point)
+ {
+ ext->point = true;
+ ext->input_len = strlen(point) - 1;
+
+ printf("[@CHENG_DEBUG][%s][%d]: input_len=%d\n", __FUNCTION__, __LINE__, ext->input_len);
+ }
+ else
+ {
+ ext->point = false;
+ ext->input_len = strlen(text);
+ if(text[0] == '-') {
+ ext->input_len--;
+ }
+ printf("[@CHENG_DEBUG][%s][%d]: input_len=%d\n", __FUNCTION__, __LINE__, ext->input_len);
+ }
}
#endif
fval1 = atof(fac1);
fval2 = atof(fac2);
+ printf("[@CHENG_DEBUG][%s][%d]: fval1=%f,fval2=%f\n", __FUNCTION__, __LINE__, fval1, fval2);
+
+
if(strcmp(ext->oper, CALC_PLUS) == 0) {
resval = fval1 + fval2;
} else if(strcmp(ext->oper, CALC_MINUS) == 0) {