Mercurial > hg > Game > Cerium
comparison example/regex_mas/main.cc @ 1746:f2f69b73afe9 draft
remove global variable in regex_mas
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 18 Nov 2013 18:15:04 +0900 |
parents | ef246e421c8c |
children | efbb42f8077a |
comparison
equal
deleted
inserted
replaced
1745:ef246e421c8c | 1746:f2f69b73afe9 |
---|---|
27 int use_task_array = 1; | 27 int use_task_array = 1; |
28 int use_task_creater = 0; | 28 int use_task_creater = 0; |
29 int use_compat = 0; | 29 int use_compat = 0; |
30 int array_task_num = 8; | 30 int array_task_num = 8; |
31 int spe_num = 1; | 31 int spe_num = 1; |
32 unsigned char *search_word; | |
33 CPU_TYPE spe_cpu = SPE_ANY; | 32 CPU_TYPE spe_cpu = SPE_ANY; |
34 const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n"; | 33 const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n"; |
35 | 34 |
36 static double | 35 static double |
37 getTime() { | 36 getTime() { |
245 static int blocks = 48; | 244 static int blocks = 48; |
246 //static int blocks = 31 * 6 * 24; | 245 //static int blocks = 31 * 6 * 24; |
247 static int division = 16; // in Kbyte | 246 static int division = 16; // in Kbyte |
248 | 247 |
249 static void | 248 static void |
250 run_start(TaskManager *manager, char *filename) | 249 run_start(TaskManager *manager, char *filename,unsigned char *search_word) |
251 { | 250 { |
252 HTaskPtr t_print; | 251 HTaskPtr t_print; |
253 | 252 |
254 st_mmap_t st_mmap; | 253 st_mmap_t st_mmap; |
255 //st_mmap = my_mmap(filename); | 254 //st_mmap = my_mmap(filename); |
318 static char* | 317 static char* |
319 init(int argc, char **argv) | 318 init(int argc, char **argv) |
320 { | 319 { |
321 | 320 |
322 char *filename = 0; | 321 char *filename = 0; |
322 unsigned char *search_word = 0; | |
323 | 323 |
324 for (int i = 1; argv[i]; ++i) { | 324 for (int i = 1; argv[i]; ++i) { |
325 if (strcmp(argv[i], "-file") == 0) { | 325 if (strcmp(argv[i], "-file") == 0) { |
326 filename = argv[i+1]; | 326 filename = argv[i+1]; |
327 } else if (strcmp(argv[i], "-division") == 0) { | 327 } else if (strcmp(argv[i], "-division") == 0) { |
364 int | 364 int |
365 TMmain(TaskManager *manager, int argc, char *argv[]) | 365 TMmain(TaskManager *manager, int argc, char *argv[]) |
366 { | 366 { |
367 | 367 |
368 char *filename = 0; | 368 char *filename = 0; |
369 unsigned char *search_word = 0; | |
369 filename = init(argc, argv); | 370 filename = init(argc, argv); |
371 | |
372 for (int i = 1; argv[i]; ++i) { | |
373 if (strcmp(argv[i], "-sw") == 0) { | |
374 search_word = (unsigned char*)argv[i+1]; | |
375 } | |
376 } | |
370 | 377 |
371 if (filename < 0) { | 378 if (filename < 0) { |
372 return -1; | 379 return -1; |
373 } | 380 } |
374 | 381 |
382 if (search_word < 0) { | |
383 return -1; | |
384 } | |
385 | |
375 task_init(); | 386 task_init(); |
376 st_time = getTime(); | 387 st_time = getTime(); |
377 run_start(manager, filename); | 388 run_start(manager, filename,search_word); |
378 manager->set_TMend(TMend); | 389 manager->set_TMend(TMend); |
379 return 0; | 390 return 0; |
380 } | 391 } |
381 | 392 |
382 void | 393 void |