summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@samsung.com>2015-08-17 13:35:57 +0300
committerDaniel Zaoui <daniel.zaoui@samsung.com>2015-08-17 13:35:57 +0300
commita83bcf3c3592fc77a4f01f15bb2c694f44426622 (patch)
tree306af17ec6ff6a96bbf87712cc568f5a82e2105b
parent0233ee38662228e0ef97c189c369137755791d55 (diff)
Support property set invocation
-rw-r--r--src/bin/cli.c33
-rw-r--r--src/lib/debug_eolian.c2
2 files changed, 19 insertions, 16 deletions
diff --git a/src/bin/cli.c b/src/bin/cli.c
index ef3956f..12a91de 100644
--- a/src/bin/cli.c
+++ b/src/bin/cli.c
@@ -150,9 +150,18 @@ _function_invoke(unsigned long long obj, Lexer *l, Eina_Bool is_get)
150 void *param; 150 void *param;
151 151
152 const Eolian_Function *foo = debug_eolian_function_find_by_name(func_str, type); 152 const Eolian_Function *foo = debug_eolian_function_find_by_name(func_str, type);
153 if (!foo) return EINA_FALSE; 153 if (!foo)
154 {
155 printf("Unknown function %s\n", func_str);
156 return EINA_FALSE;
157 }
154 Eina_Iterator *keys_itr = eolian_property_keys_get(foo, type), *values_itr = eolian_property_values_get(foo, type); 158 Eina_Iterator *keys_itr = eolian_property_keys_get(foo, type), *values_itr = eolian_property_values_get(foo, type);
155 159
160 if (!is_get && !_next_token(l, "="))
161 {
162 printf("Assignment needs '='\n");
163 return EINA_FALSE;
164 }
156 /* If no param is given, we have to check no param is required */ 165 /* If no param is given, we have to check no param is required */
157 if ((!_next_token(l, "(") && !keys_itr && (is_get || values_itr)) || 166 if ((!_next_token(l, "(") && !keys_itr && (is_get || values_itr)) ||
158 (_params_parse(l, keys_itr, &params) && 167 (_params_parse(l, keys_itr, &params) &&
@@ -177,12 +186,6 @@ _function_invoke(unsigned long long obj, Lexer *l, Eina_Bool is_get)
177 eina_iterator_free(keys_itr); 186 eina_iterator_free(keys_itr);
178 eina_iterator_free(values_itr); 187 eina_iterator_free(values_itr);
179 EINA_LIST_FREE(params, param) debug_eolian_parameter_free(param); 188 EINA_LIST_FREE(params, param) debug_eolian_parameter_free(param);
180 /*
181 * Packet preparation
182 * Sending
183 * Receiving
184 * Parsing response
185 */
186 return ret; 189 return ret;
187} 190}
188 191
@@ -226,6 +229,7 @@ _char_consume(Lexer *l, char c)
226 } 229 }
227 else 230 else
228 printf("Unknown variable: %s\n", var); 231 printf("Unknown variable: %s\n", var);
232 free(var);
229 233
230 break; 234 break;
231 } 235 }
@@ -258,17 +262,16 @@ _char_consume(Lexer *l, char c)
258 /* variable->func = value */ 262 /* variable->func = value */
259 else if (_next_token(l, "->")) 263 else if (_next_token(l, "->"))
260 { 264 {
261 char *func = _next_word(l, "."); 265 unsigned long long *var_value = (unsigned long long *) eina_hash_find(vars_hash, variable);
262 if (func) 266 if (var_value)
263 { 267 {
264 if (_next_token(l, "=")) 268 _function_invoke(*var_value, l, EINA_FALSE);
265 { 269 match = EINA_TRUE;
266 char *value = _next_word(l, NULL);
267 printf("Set %s on object %s via %s\n", value, variable, func);
268 match = EINA_TRUE;
269 }
270 } 270 }
271 else
272 printf("Unknown variable: %s\n", variable);
271 } 273 }
274 free(variable);
272 } 275 }
273 if (!match) 276 if (!match)
274 printf("Wrong command: %s\n", l->buffer); 277 printf("Wrong command: %s\n", l->buffer);
diff --git a/src/lib/debug_eolian.c b/src/lib/debug_eolian.c
index 174b3f0..48a45d7 100644
--- a/src/lib/debug_eolian.c
+++ b/src/lib/debug_eolian.c
@@ -131,7 +131,7 @@ _eolian_req_handle(const void *buf, int size, void **buf_ret, int *size_ret)
131 EINA_LIST_FOREACH(req->params, pitr, param) 131 EINA_LIST_FOREACH(req->params, pitr, param)
132 { 132 {
133 if (param->type == EOLIAN_EXPR_INT) types[argnum] = &ffi_type_sint; 133 if (param->type == EOLIAN_EXPR_INT) types[argnum] = &ffi_type_sint;
134 values[argnum++] = param->value.value; 134 values[argnum++] = &(param->value.value);
135 } 135 }
136 if (req->function_type == EOLIAN_PROP_GET) 136 if (req->function_type == EOLIAN_PROP_GET)
137 { 137 {