annotate Renderer/Test/dynamic_create.cc @ 580:ec9dd24c2dc8 draft

add all object in file in dynamic_create
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 24 Oct 2009 16:32:29 +0900
parents d2183b72251f
children c34956de8276
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include <stdlib.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <stdio.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 #include <string.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 #include <fcntl.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 #include <sys/types.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 #include <sys/mman.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 #include <sys/stat.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 #include <unistd.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 #include <arpa/inet.h>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 #include "SceneGraphRoot.h"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 #include "lindaapi.h"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 #include "dynamic_create.h"
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 #define PORT 10000
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 #define SERIAL_REGIST_TUPLE_NO 1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 /*
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 typedef struct {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 caddr_t file_mmap;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 off_t size;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 } st_mmap_t;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 typedef struct client_ {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 int id;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 SceneGraphPtr sgp;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 struct client_ *next;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 } client_t;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 typedef struct {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 int tid;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 int sid;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 int read_id;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 SceneGraphPtr node;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 TaskManager *manager;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 client_t *clist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 } callback_arg;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 client_list_init(TaskManager* manager, client_t *clist)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 clist->id = -1;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 clist->next = clist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 client_list_update(TaskManager *manager, client_t *clist, int id, SceneGraphPtr sgp)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 client_list_delete(TaskManager *manager, client_t *clist, int id)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 client_t *c, *prev;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 for (c = clist->next, prev = clist; c->next != clist; c = c->next) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 if (c->id == id) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 prev->next = c->next;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 return;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 prev = clist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 if (c->id == id) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 prev->next = c->next;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 return;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 earth_collision(SceneGraphPtr node, int screen_w, int screen_h,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 SceneGraphPtr tree)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 moon_collision(SceneGraphPtr node, int screen_w, int screen_h,
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 SceneGraphPtr tree)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 moon_move(SceneGraphPtr node, int screen_w, int screen_h)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 //node->angle[0] += 3.0f;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 node->xyz[1] += 1.0f;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 earth_move(SceneGraphPtr node, int screen_w, int screen_h)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 {
575
341f1f881a9b Linda API worked. (slightly unreliable)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 574
diff changeset
94 // psx_sync_n(); in viewer::MainLoop
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 SceneGraphPtr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 create_sg(TaskManager *manager, SceneGraphPtr node, unsigned char *data, int len, int serial_id)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 {
580
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
100 SceneGraphPtr child = sgroot->createSceneGraph();
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
101 node->addChild(child);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
102 child->set_move_collision(moon_move, moon_collision);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
103 // 読み込んだオブジェクトは、すべて、child の child になる。
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
104 sgroot->createFromXMLmemory(sgroot->tmanager, child, (char *)data, len);
ec9dd24c2dc8 add all object in file in dynamic_create
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 579
diff changeset
105 return node;
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 callback_get_xml(unsigned char *xml_tuple, void *arg) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 int xml_len = psx_get_datalength(xml_tuple);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 callback_arg *carg = (callback_arg *)arg;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 unsigned char *xml_data = xml_tuple+LINDA_HEADER_SIZE;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 SceneGraphPtr sgp;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 // ここで create
574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
116 fwrite(xml_data, 1, 10, stdout);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 sgp = create_sg(carg->manager, carg->node, xml_data, xml_len, carg->sid);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118 client_list_update(carg->manager, carg->clist, carg->sid, sgp);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 free(arg);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 free(xml_tuple);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 static void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 callbacker(unsigned char *tuple, void *arg) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 int serial_id, xml_id;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127 unsigned char *data;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 callback_arg *carg = (callback_arg *)arg;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130 // 最初の4byteデータは使わない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 data = tuple+LINDA_HEADER_SIZE;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 // clientのSerialIDを取得
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133 serial_id = ntohl(*(int *)data);
574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
134
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
135 printf("serial id = %d\n", serial_id);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136 // タプルを解放
574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
137 //psx_del(carg->tid, SERIAL_REGIST_TUPLE_NO);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139 // xml fileを取得する もうすでにxml fileが送信済みである事を期待
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 // つまり、送信者がserial_idを送る前にxml fileを送信していなくてはならない
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 xml_id = serial_id * 10;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142 callback_arg *copy_arg = (callback_arg *)carg->manager->allocate(sizeof(callback_arg));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 *copy_arg = *carg;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 copy_arg->sid = serial_id;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 psx_callback_in(carg->tid, xml_id, callback_get_xml, (void *)copy_arg);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
146
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
147 /* dataは'\0'で終わっている事を期待 (writerで保証する) */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 //printf("get data[%d]: `%s'\n", len, data);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 free(tuple);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
150
574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
151 psx_callback_in(carg->tid, carg->read_id, callbacker, arg);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
152 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
577
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
154 static char *linda = "localhost";
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
155
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
156 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
157 linda_init(TaskManager *manager, client_t *clist, SceneGraphPtr node)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
158 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
159 init_linda();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
160 callback_arg *carg = (callback_arg *)manager->allocate(sizeof(callback_arg));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161
579
root@localhost.localdomain
parents: 577
diff changeset
162 carg->tid = open_linda_java(linda, PORT);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 carg->read_id = SERIAL_REGIST_TUPLE_NO;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 carg->node = node;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 carg->manager = manager;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 carg->clist = clist;
574
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 566
diff changeset
167 psx_callback_in(carg->tid, carg->read_id, callbacker, carg);
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 MainLoopPtr
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 dynamic_create::init(Viewer *sgroot, int screen_w, int screen_h)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 //SceneGraphPtr earth;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 client_t *clist;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 clist = (client_t *)sgroot->manager->allocate(sizeof(client_t));
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
176
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 client_list_init(sgroot->manager, clist);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 SceneGraphPtr parent;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 parent = sgroot->createSceneGraph();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 parent->set_move_collision(earth_move, earth_collision);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 parent->xyz[0] += 300;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
183
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184 linda_init(sgroot->manager, clist, parent);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
185
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 // SceneGraphRoot に、使用する SceneGraph を設定する
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
187 // このとき、ユーザーが記述した SceneGraph の root を渡す。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 sgroot->setSceneData(parent);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 return sgroot;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
191
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 extern Application *
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
193 application() {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
194 return new dynamic_create();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
195 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
196
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
197 const char *usr_help_str = "Usage: ./test_nogl [OPTION]\n";
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
198
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
199 extern int init(TaskManager *manager, int argc, char *argv[]);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
200 extern void task_initialize();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 static void TMend(TaskManager *manager);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
202
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 int
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 TMmain(TaskManager *manager, int argc, char *argv[])
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
205 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
206 task_initialize();
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
207 manager->set_TMend(TMend);
577
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
208
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
209 for(int i=0;i<argc;i++) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
210 if (strcmp(argv[i],"-linda") == 0 && i+1<=argc) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
211 linda = argv[i+1];
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
212 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
213 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
214
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 576
diff changeset
215
566
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
216 return init(manager, argc, argv);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
217
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
218 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
219
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 void
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
221 TMend(TaskManager *manager)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
222 {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
223 printf("test_nogl end\n");
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
224 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
225
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
226 /* end */
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
227