summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-12-14 17:28:50 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-12-14 18:23:16 +0100
commitc813e94606929449b93c780af0f9764e333b8218 (patch)
tree2e2dd43670e8bb238a6a3d21b7508d2c45a46306
parentb4740389f950f502c0173d376d06e228b9c7067e (diff)
eolian: unary expr eval for floats and add a signed number mask
This adds a new mask for all signed numbers (sint + float) and fixes unary expr evaluation for floats, as well as fixes eval error messages.
-rw-r--r--src/bindings/luajit/eolian.lua2
-rw-r--r--src/lib/ecore/efl_loop_timer.eo2
-rw-r--r--src/lib/eolian/Eolian.h1
-rw-r--r--src/lib/eolian/database_expr.c26
-rw-r--r--src/lib/evas/canvas/evas_text.eo2
5 files changed, 19 insertions, 14 deletions
diff --git a/src/bindings/luajit/eolian.lua b/src/bindings/luajit/eolian.lua
index 66727fa..2b2df9f 100644
--- a/src/bindings/luajit/eolian.lua
+++ b/src/bindings/luajit/eolian.lua
@@ -109,6 +109,7 @@ ffi.cdef [[
109 EOLIAN_MASK_STRING = 1 << 4, 109 EOLIAN_MASK_STRING = 1 << 4,
110 EOLIAN_MASK_CHAR = 1 << 5, 110 EOLIAN_MASK_CHAR = 1 << 5,
111 EOLIAN_MASK_NULL = 1 << 6, 111 EOLIAN_MASK_NULL = 1 << 6,
112 EOLIAN_MASK_SIGNED = EOLIAN_MASK_SINT | EOLIAN_MASK_FLOAT,
112 EOLIAN_MASK_NUMBER = EOLIAN_MASK_INT | EOLIAN_MASK_FLOAT, 113 EOLIAN_MASK_NUMBER = EOLIAN_MASK_INT | EOLIAN_MASK_FLOAT,
113 EOLIAN_MASK_ALL = EOLIAN_MASK_NUMBER | EOLIAN_MASK_BOOL 114 EOLIAN_MASK_ALL = EOLIAN_MASK_NUMBER | EOLIAN_MASK_BOOL
114 | EOLIAN_MASK_STRING | EOLIAN_MASK_CHAR 115 | EOLIAN_MASK_STRING | EOLIAN_MASK_CHAR
@@ -1222,6 +1223,7 @@ M.expression_mask = {
1222local emask = M.expression_mask 1223local emask = M.expression_mask
1223 1224
1224emask.INT = bit.bor(emask.SINT , emask.UINT ) 1225emask.INT = bit.bor(emask.SINT , emask.UINT )
1226emask.SIGNED = bit.bor(emask.SINT , emask.FLOAT)
1225emask.NUMBER = bit.bor(emask.INT , emask.FLOAT) 1227emask.NUMBER = bit.bor(emask.INT , emask.FLOAT)
1226emask.ALL = bit.bor(emask.NUMBER, emask.BOOL, 1228emask.ALL = bit.bor(emask.NUMBER, emask.BOOL,
1227 emask.STRING, emask.CHAR, emask.NULL) 1229 emask.STRING, emask.CHAR, emask.NULL)
diff --git a/src/lib/ecore/efl_loop_timer.eo b/src/lib/ecore/efl_loop_timer.eo
index baf661a..1271511 100644
--- a/src/lib/ecore/efl_loop_timer.eo
+++ b/src/lib/ecore/efl_loop_timer.eo
@@ -19,7 +19,7 @@ class Efl.Loop.Timer (Efl.Loop_User)
19 get { 19 get {
20 } 20 }
21 values { 21 values {
22 in: double(-1); [[The new interval in seconds]] 22 in: double(-1.0); [[The new interval in seconds]]
23 } 23 }
24 } 24 }
25 @property pending { 25 @property pending {
diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h
index 3613482..0c853dd 100644
--- a/src/lib/eolian/Eolian.h
+++ b/src/lib/eolian/Eolian.h
@@ -254,6 +254,7 @@ typedef enum
254 EOLIAN_MASK_STRING = 1 << 4, 254 EOLIAN_MASK_STRING = 1 << 4,
255 EOLIAN_MASK_CHAR = 1 << 5, 255 EOLIAN_MASK_CHAR = 1 << 5,
256 EOLIAN_MASK_NULL = 1 << 6, 256 EOLIAN_MASK_NULL = 1 << 6,
257 EOLIAN_MASK_SIGNED = EOLIAN_MASK_SINT | EOLIAN_MASK_FLOAT,
257 EOLIAN_MASK_NUMBER = EOLIAN_MASK_INT | EOLIAN_MASK_FLOAT, 258 EOLIAN_MASK_NUMBER = EOLIAN_MASK_INT | EOLIAN_MASK_FLOAT,
258 EOLIAN_MASK_ALL = EOLIAN_MASK_NUMBER | EOLIAN_MASK_BOOL 259 EOLIAN_MASK_ALL = EOLIAN_MASK_NUMBER | EOLIAN_MASK_BOOL
259 | EOLIAN_MASK_STRING | EOLIAN_MASK_CHAR 260 | EOLIAN_MASK_STRING | EOLIAN_MASK_CHAR
diff --git a/src/lib/eolian/database_expr.c b/src/lib/eolian/database_expr.c
index 862c30b..21dfe65 100644
--- a/src/lib/eolian/database_expr.c
+++ b/src/lib/eolian/database_expr.c
@@ -50,7 +50,7 @@ mask_to_str(int mask, char *buf)
50} 50}
51 51
52static Eina_Bool 52static Eina_Bool
53expr_type_error(const Eolian_Expression *expr, int type, int mask) 53expr_type_error(const Eolian_Expression *expr, int mask, int type)
54{ 54{
55 char buf[512]; 55 char buf[512];
56 char ebuf[256]; 56 char ebuf[256];
@@ -153,9 +153,9 @@ promote(Eolian_Expression *a, Eolian_Expression *b)
153 assert(a->type && b->type); 153 assert(a->type && b->type);
154 /* not a number */ 154 /* not a number */
155 if (a->type >= EOLIAN_EXPR_STRING) 155 if (a->type >= EOLIAN_EXPR_STRING)
156 return expr_type_error(a, expr_type_to_mask(a), EOLIAN_MASK_NUMBER); 156 return expr_type_error(a, EOLIAN_MASK_NUMBER, expr_type_to_mask(a));
157 if (b->type >= EOLIAN_EXPR_STRING) 157 if (b->type >= EOLIAN_EXPR_STRING)
158 return expr_type_error(b, expr_type_to_mask(b), EOLIAN_MASK_NUMBER); 158 return expr_type_error(b, EOLIAN_MASK_NUMBER, expr_type_to_mask(b));
159 /* no need for promotion */ 159 /* no need for promotion */
160 if (a->type == b->type) return EINA_TRUE; 160 if (a->type == b->type) return EINA_TRUE;
161 /* if either operand is floating point, everything has to be */ 161 /* if either operand is floating point, everything has to be */
@@ -191,26 +191,28 @@ eval_unary(const Eolian_Expression *expr, Eolian_Expression_Mask mask,
191 case EOLIAN_UNOP_UNP: 191 case EOLIAN_UNOP_UNP:
192 { 192 {
193 /* no-op, but still typecheck */ 193 /* no-op, but still typecheck */
194 if (!(mask & EOLIAN_MASK_SINT)) 194 if (!(mask & EOLIAN_MASK_SIGNED))
195 return expr_type_error(expr, EOLIAN_MASK_SINT, mask); 195 return expr_type_error(expr, EOLIAN_MASK_SIGNED, mask);
196 196
197 return eval_exp(expr->expr, EOLIAN_MASK_SINT, out); 197 return eval_exp(expr->expr, EOLIAN_MASK_SIGNED, out);
198 } 198 }
199 case EOLIAN_UNOP_UNM: 199 case EOLIAN_UNOP_UNM:
200 { 200 {
201 Eolian_Expression exp; 201 Eolian_Expression exp;
202 202
203 if (!(mask & EOLIAN_MASK_SINT)) 203 if (!(mask & EOLIAN_MASK_SIGNED))
204 return expr_type_error(expr, EOLIAN_MASK_SINT, mask); 204 return expr_type_error(expr, EOLIAN_MASK_SIGNED, mask);
205 205
206 if (!eval_exp(expr->expr, EOLIAN_MASK_SINT, &exp)) 206 if (!eval_exp(expr->expr, EOLIAN_MASK_SIGNED, &exp))
207 return EINA_FALSE; 207 return EINA_FALSE;
208 208
209 switch (exp.type) 209 switch (exp.type)
210 { 210 {
211 case EOLIAN_EXPR_LLONG: exp.value.ll = -(exp.value.ll); break; 211 case EOLIAN_EXPR_LLONG : exp.value.ll = -(exp.value.ll); break;
212 case EOLIAN_EXPR_LONG : exp.value.l = -(exp.value.l ); break; 212 case EOLIAN_EXPR_LONG : exp.value.l = -(exp.value.l ); break;
213 case EOLIAN_EXPR_INT : exp.value.i = -(exp.value.i ); break; 213 case EOLIAN_EXPR_INT : exp.value.i = -(exp.value.i ); break;
214 case EOLIAN_EXPR_FLOAT : exp.value.f = -(exp.value.f ); break;
215 case EOLIAN_EXPR_DOUBLE: exp.value.d = -(exp.value.d ); break;
214 default: return EINA_FALSE; 216 default: return EINA_FALSE;
215 } 217 }
216 218
diff --git a/src/lib/evas/canvas/evas_text.eo b/src/lib/evas/canvas/evas_text.eo
index 039f3c0..6cc477d 100644
--- a/src/lib/evas/canvas/evas_text.eo
+++ b/src/lib/evas/canvas/evas_text.eo
@@ -51,7 +51,7 @@ class Evas.Text (Efl.Canvas.Object, Efl.Text, Efl.Text.Properties, Efl.Canvas.Fi
51 get { 51 get {
52 } 52 }
53 values { 53 values {
54 ellipsis: double(-1); [[The ellipsis. Allowed values: -1.0 or 0.0-1.0]] 54 ellipsis: double(-1.0); [[The ellipsis. Allowed values: -1.0 or 0.0-1.0]]
55 } 55 }
56 } 56 }
57 @property bidi_delimiters { 57 @property bidi_delimiters {