edje - added print_int print_float print_str funcs for debugging in embryo script
authorhermet <hermet>
Wed, 7 Sep 2011 20:43:40 +0000 (20:43 +0000)
committerhermet <hermet@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 7 Sep 2011 20:43:40 +0000 (20:43 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@63275 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_embryo.c

index 7575cca..8d3cacc 100644 (file)
  *
  * part_swallow(part_id, group_name)
  *
+ * ** here print functions are for the debugging 
+ * print_int(val)
+ * print_float(Float:val)
+ * print_str(val)
+ *
  * external_param_get_int(id, param_name[])
  * external_param_set_int(id, param_name[], value)
  * Float:external_param_get_float(id, param_name[])
@@ -2936,6 +2941,34 @@ _edje_embryo_fn_external_param_set_bool(Embryo_Program *ep, Embryo_Cell *params)
    return _edje_external_param_set(NULL, rp, &eep);
 }
 
+static Embryo_Cell
+_edje_embryo_fn_print_int(Embryo_Program *ep, Embryo_Cell *params)
+{
+   printf("%d", (int) params[1]);
+   fflush(NULL);
+   return 0;
+}
+
+static Embryo_Cell
+_edje_embryo_fn_print_float(Embryo_Program *ep, Embryo_Cell *params)
+{
+   float v = EMBRYO_CELL_TO_FLOAT(params[1]);
+   printf("%f", v);
+   fflush(NULL);
+   return 0;
+}
+
+static Embryo_Cell
+_edje_embryo_fn_print_str(Embryo_Program *ep, Embryo_Cell *params)
+{
+   char *msg = NULL;
+   GETSTR(msg, params[1]);
+   if (!msg) return 0;
+   printf("%s", msg);
+   fflush(NULL);
+   return 0;
+}
+
 void
 _edje_embryo_script_init(Edje_Part_Collection *edc)
 {
@@ -3015,6 +3048,9 @@ _edje_embryo_script_init(Edje_Part_Collection *edc)
 
    embryo_program_native_call_add(ep, "part_swallow", _edje_embryo_fn_part_swallow);
 
+   embryo_program_native_call_add(ep, "print_int", _edje_embryo_fn_print_int);
+   embryo_program_native_call_add(ep, "print_float", _edje_embryo_fn_print_float);
+   embryo_program_native_call_add(ep, "print_str", _edje_embryo_fn_print_str);
    embryo_program_native_call_add(ep, "external_param_get_int", _edje_embryo_fn_external_param_get_int);
    embryo_program_native_call_add(ep, "external_param_set_int", _edje_embryo_fn_external_param_set_int);
    embryo_program_native_call_add(ep, "external_param_get_float", _edje_embryo_fn_external_param_get_float);