1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#!/usr/bin/env entity
<object>
<window border = "15"
position = "center"
ondelete = "entity:exit"
title = "Some Cool App"
name="windowone">
<object dragable = "true" expand = "false">
<valign>
<button name = "do100" onclick="c:count_to_100">
<label text="test 100"/>
</button>
<button name = "do50" onclick="c:count_to_50">
<label text="test 50"/>
</button>
<button name = "docount" count="1000" onclick="c:count_to_count">
<label text="test 1000"/>
</button>
<button name = "testargs_b" data="pass me?" onclick="c:test_args">
<label text="test args"/>
</button>
<button name = "dotest" data="pass me?" onclick="c:dotest">
<label text="Do a Test"/>
</button>
</valign>
<c-code name="test1" object="testc" c-libs="-L/usr/lib">
<![CDATA[
EBuf *
dotest(ENode* node, GSList* args)
{
EBuf *path;
fprintf(stderr, "in dotest\n");
node = enode ("valign");
path = enode_path (node);
printf ("path to valign is '%s'\n", path->str);
ebuf_free (path);
return (NULL);
}
void
entity_c_init (void)
{
EBuf *path;
ENode *node;
fprintf(stderr, "in init function\n");
node = enode ("valign");
path = enode_path (node);
printf ("path to valign is '%s'\n", path->str);
ebuf_free (path);
}
]]>
</c-code>
<c-code name="test2" object="count" >
<![CDATA[
EBuf *
count_to_count(ENode* node, GSList* args)
{
int c;
int count;
if (node)
{
count = atoi(enode_attrib_str(node,"count",NULL));
printf("count = %d\n", count);
for(c=1; c <= count; c++)
{
fprintf(stderr, "count = %i\t", c);
}
}
else
{
printf("no node found\n");
}
return (NULL);
}
EBuf *
count_to_50(void* node, GSList* args)
{
int c;
for(c=1; c <= 50; c++)
{
fprintf(stderr, "count = %i\t", c);
}
fprintf(stderr, "\n");
return (NULL);
}
EBuf *
count_to_100(void* node, GSList* args)
{
int c;
for(c=1; c <= 100; c++)
{
fprintf(stderr, "count = %i\t", c);
}
fprintf(stderr, "\n");
return (NULL);
}
EBuf *
test_args(void* node, GSList* args)
{
fprintf(stderr, "How do you tell if the C code actually compiled,\n"
"you need to trap the return of the gcc exec\n");
for(; args; args = args->next)
{
fprintf(stderr, "-- %s --\n", args->data);
//c_call("dotest", NULL, NULL);
}
return (NULL);
}
]]>
</c-code>
</object>
</window>
</object>
|