# HG changeset patch # User Shinji KONO # Date 1244790303 -32400 # Node ID 9566ac92fe2ec7c21172a5c307560cfaa67a9304 # Parent 71ca8637fcc1bcdcf9677278e7a127f9eae5fcab cerium script fix diff -r 71ca8637fcc1 -r 9566ac92fe2e bin/cerium --- a/bin/cerium Fri Jun 12 16:01:14 2009 +0900 +++ b/bin/cerium Fri Jun 12 16:05:03 2009 +0900 @@ -100,97 +100,14 @@ } EOFEOF } -} else { - &help; -} -exit 0; - -sub help { - print "$0 init ... initialize cerium application\n"; -} - -sub init { -# setup initial cerium configuration - mkdir "Task"; - if (! -e $main ) &make_main; - if (! -e $task_config ) &make_task_config; -} - -sub make_main { - open(F,">$main") or die("Can't write $main\n"); - print F <<'EOFEOF'; -#include -#include -#include -#include "TaskManager.h" -#include "Func.h" - -extern void task_init(void); - -const char *usr_help_str = "Usage: ./main [-cpu spe_num] [-count N]\n\ - -cpu Number of SPE (default 1) \n\"; - -int -init(int argc, char **argv) -{ - for (int i = 1; argv[i]; ++i) { - if (strcmp(argv[i], "-count") == 0) { - count = atoi(argv[++i]); - } - - } - - return 0; -} -void -hello_init(void) -{ - HTask *hello; - for (int i = 0; i < count; i++) { - /** - * Create Task - * create_task(Task ID); - */ - hello = manager->create_task(HELLO_TASK); - - /** - * Select CPU - * SPE_0, SPE_1, SPE_2, SPE_3, SPE_4, SPE_5, SPE_ANY - * if you do not call this, execute PPE. - */ - hello->set_cpu(SPE_ANY); - - /** - * Set 32bits parameter - * add_param(32bit parameter); - */ - hello->add_param(i); - - hello->spawn(); - } -} - -int -TMmain(int argc, char *argv[]) -{ - if (init(argc, argv) < 0) { - return -1; - } - task_init(); - init(); - - return 0; -} -EOFEOF -} sub make { return if ( ! -e $task_config ); - my $xml = XML::LibXML->new(); + my $parser = XML::LibXML->new(); my $doc = $parser->parse_file("$cerium_path/lib/tasks.xml"); my $root = $doc->documentElement(); for my $e ($root->childNodes) { @@ -198,6 +115,7 @@ } } + __END__ =head1 NAME