raster pushed a commit to branch master.

commit a6abe0919a974dd849092e66480378f9d8ca79c7
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Mon Apr 22 01:11:08 2013 +0900

    complete message send-back to term pty.
---
 src/bin/termio.c | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 102 insertions(+), 4 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index aefe9ff..357732b 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -652,8 +652,8 @@ _block_edje_signal_cb(void *data, Evas_Object *obj 
__UNUSED__, const char *sig,
         v1 = (int)(f1 * 1000.0);
         v2 = (int)(f2 * 1000.0);
         buf = alloca(strlen(src) + strlen(blk->chid) + 256);
-        buflen = sprintf(buf, "%c}%s;%s\n%s\n%i\n%i", 0x1b,
-                         sig, blk->chid, src, v1, v2);
+        buflen = sprintf(buf, "%c};%s\n%s\n%s\n%i\n%i", 0x1b,
+                         blk->chid, sig, src, v1, v2);
         termpty_write(sd->pty, buf, buflen + 1);
      }
    else
@@ -670,8 +670,9 @@ _block_edje_message_cb(void *data, Evas_Object *obj 
__UNUSED__, Edje_Message_Typ
 {
    Termblock *blk = data;
    Termio *sd = evas_object_smart_data_get(blk->pty->obj);
-   char *chid = NULL;
+   char *chid = NULL, buf[4096];
    Eina_List *l;
+   int buflen;
    
    if (!sd) return;
    if ((!blk->chid) || (!sd->cur_chids)) return;
@@ -687,51 +688,148 @@ _block_edje_message_cb(void *data, Evas_Object *obj 
__UNUSED__, Edje_Message_Typ
       case EDJE_MESSAGE_STRING:
           {
              Edje_Message_String *m = msg;
+             
+             buflen = sprintf(buf, "%c}message;%s\n%i\nstring\n%s", 0x1b,
+                              blk->chid, id, m->str);
+             termpty_write(sd->pty, buf, buflen + 1);
           }
         break;
       case EDJE_MESSAGE_INT:
           {
              Edje_Message_Int *m = msg;
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nint\n%i", 0x1b,
+                               blk->chid, id, m->val);
+             termpty_write(sd->pty, buf, buflen + 1);
           }
         break;
       case EDJE_MESSAGE_FLOAT:
           {
              Edje_Message_Float *m = msg;
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nfloat\n%i", 0x1b,
+                               blk->chid, id, (int)(m->val * 1000.0));
+             termpty_write(sd->pty, buf, buflen + 1);
           }
         break;
       case EDJE_MESSAGE_STRING_SET:
           {
              Edje_Message_String_Set *m = msg;
-          }
+             int i;
+             char zero[1] = { 0 };
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nstring_set\n%i", 0x1b,
+                               blk->chid, id, m->count);
+             termpty_write(sd->pty, buf, buflen);
+             for (i = 0; i < m->count; i++)
+               {
+                  termpty_write(sd->pty, "\n", 1);
+                  termpty_write(sd->pty, m->str[i], strlen(m->str[i]));
+               }
+             termpty_write(sd->pty, zero, 1);
+         }
         break;
       case EDJE_MESSAGE_INT_SET:
           {
              Edje_Message_Int_Set *m = msg;
+             int i;
+             char zero[1] = { 0 };
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nint_set\n%i", 0x1b,
+                               blk->chid, id, m->count);
+             termpty_write(sd->pty, buf, buflen);
+             for (i = 0; i < m->count; i++)
+               {
+                  termpty_write(sd->pty, "\n", 1);
+                  buflen = snprintf(buf, sizeof(buf), "%i", m->val[i]);
+                  termpty_write(sd->pty, buf, buflen);
+               }
+             termpty_write(sd->pty, zero, 1);
           }
         break;
       case EDJE_MESSAGE_FLOAT_SET:
           {
              Edje_Message_Float_Set *m = msg;
+             int i;
+             char zero[1] = { 0 };
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nfloat_set\n%i", 0x1b,
+                               blk->chid, id, m->count);
+             termpty_write(sd->pty, buf, buflen);
+             for (i = 0; i < m->count; i++)
+               {
+                  termpty_write(sd->pty, "\n", 1);
+                  buflen = snprintf(buf, sizeof(buf), "%i", (int)(m->val[i] * 
1000.0));
+                  termpty_write(sd->pty, buf, buflen);
+               }
+             termpty_write(sd->pty, zero, 1);
           }
         break;
       case EDJE_MESSAGE_STRING_INT:
           {
              Edje_Message_String_Int *m = msg;
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nstring_int\n%s\n%i", 0x1b,
+                               blk->chid, id, m->str, m->val);
+             termpty_write(sd->pty, buf, buflen + 1);
           }
         break;
       case EDJE_MESSAGE_STRING_FLOAT:
           {
              Edje_Message_String_Float *m = msg;
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nstring_float\n%s\n%i", 0x1b,
+                               blk->chid, id, m->str, (int)(m->val * 1000.0));
+             termpty_write(sd->pty, buf, buflen + 1);
           }
         break;
       case EDJE_MESSAGE_STRING_INT_SET:
           {
              Edje_Message_String_Int_Set *m = msg;
+             int i;
+             char zero[1] = { 0 };
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nstring_int_set\n%i", 0x1b,
+                               blk->chid, id, m->count);
+             termpty_write(sd->pty, buf, buflen);
+             termpty_write(sd->pty, "\n", 1);
+             termpty_write(sd->pty, m->str, strlen(m->str));
+             for (i = 0; i < m->count; i++)
+               {
+                  termpty_write(sd->pty, "\n", 1);
+                  buflen = snprintf(buf, sizeof(buf), "%i", m->val[i]);
+                  termpty_write(sd->pty, buf, buflen);
+               }
+             termpty_write(sd->pty, zero, 1);
           }
         break;
       case EDJE_MESSAGE_STRING_FLOAT_SET:
           {
              Edje_Message_String_Float_Set *m = msg;
+             int i;
+             char zero[1] = { 0 };
+             
+             buflen = snprintf(buf, sizeof(buf),
+                               "%c}message;%s\n%i\nstring_float_set\n%i", 0x1b,
+                               blk->chid, id, m->count);
+             termpty_write(sd->pty, buf, buflen);
+             termpty_write(sd->pty, "\n", 1);
+             termpty_write(sd->pty, m->str, strlen(m->str));
+             for (i = 0; i < m->count; i++)
+               {
+                  termpty_write(sd->pty, "\n", 1);
+                  buflen = snprintf(buf, sizeof(buf), "%i", (int)(m->val[i] * 
1000.0));
+                  termpty_write(sd->pty, buf, buflen);
+               }
+             termpty_write(sd->pty, zero, 1);
           }
         break;
       default:

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to