comparison example/word_count/main.cc @ 400:00fe05184a02

Fix examples.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 21 Sep 2009 18:47:06 +0900
parents e08d0aa94367
children 60aa3f241b10
comparison
equal deleted inserted replaced
399:4bea73c83c35 400:00fe05184a02
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include "TaskManager.h" 9 #include "TaskManager.h"
10 #include "Func.h" 10 #include "Func.h"
11 11
12 extern void task_init(void); 12 extern void task_init();
13 13
14 const char *usr_help_str = "Usage: ./word_count [-cpu spe_num] [-file filename]\n"; 14 const char *usr_help_str = "Usage: ./word_count [-cpu spe_num] [-file filename]\n";
15 15
16 typedef struct { 16 typedef struct {
17 caddr_t file_mmap; 17 caddr_t file_mmap;
65 65
66 } 66 }
67 67
68 68
69 void 69 void
70 run_start(char *filename) 70 run_start(TaskManager *manager, char *filename)
71 { 71 {
72 HTaskPtr t_exec; 72 HTaskPtr t_exec;
73 HTaskPtr t_print; 73 HTaskPtr t_print;
74 74
75 st_mmap_t st_mmap; 75 st_mmap_t st_mmap;
162 for (int i = 1; argv[i]; ++i) { 162 for (int i = 1; argv[i]; ++i) {
163 if (strcmp(argv[i], "-file") == 0) { 163 if (strcmp(argv[i], "-file") == 0) {
164 filename = argv[i+1]; 164 filename = argv[i+1];
165 } 165 }
166 } 166 }
167 if (filename==0) {
168 fprintf(stderr, usr_help_str);
169 exit(1);
170 }
167 171
168 return filename; 172 return filename;
169 } 173 }
170 174
171 int 175 int
172 TMmain(int argc, char *argv[]) 176 TMmain(TaskManager *manager, int argc, char *argv[])
173 { 177 {
174 178
175 char *filename = 0; 179 char *filename = 0;
176 filename = init(argc, argv); 180 filename = init(argc, argv);
177 181
178 if (filename < 0) { 182 if (filename < 0) {
179 return -1; 183 return -1;
180 } 184 }
181 185
182 task_init(); 186 task_init();
183 run_start(filename); 187 run_start(manager, filename);
184 188
185 return 0; 189 return 0;
186 } 190 }