Changeset 5836:81ccac5ddc61 in roaraudio for roarclients/roarpluginrunner.c
- Timestamp:
- 01/06/13 20:38:43 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarpluginrunner.c
r5823 r5836 35 35 }; 36 36 37 #define OPTION_NONE 0x0000 38 #define OPTION_TOUCH 0x0001 39 #define OPTION_ABOUT 0x0100 40 #define OPTION_HELP 0x0200 41 #define OPTION_PREFERENCES 0x0400 42 37 43 static struct roar_dl_librarypara * g_para = NULL; 38 44 static struct roar_scheduler * g_sched = NULL; … … 56 62 ); 57 63 64 fprintf(stderr, "\nRunner Options:\n\n"); 65 fprintf(stderr, " --option-touch - Do not keep the plugin running:" 66 " Do a single UPDATE cycle.\n" 67 " --option-no-touch - Disable touch option.\n" 68 " --option-about - Show an about dialog after startup.\n" 69 " --option-no-about - Disable about option.\n" 70 " --option-help - Show onlion help after startup.\n" 71 " --option-no-help - Disable help option.\n" 72 " --option-preferences - Show preferences dialog after startup.\n" 73 " --option-no-preferences\n" 74 " - Disable preferences option.\n" 75 ); 76 58 77 fprintf(stderr, "\nCPI Options:\n\n"); 59 78 fprintf(stderr, " -t --tcp - Use TCP listen socket\n" … … 69 88 } 70 89 71 static int do_run(const char * name ) {90 static int do_run(const char * name, int options) { 72 91 struct roar_scheduler_source s_container; 73 92 struct roar_plugincontainer * cont = roar_plugincontainer_new(g_para); … … 92 111 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_INIT); 93 112 94 roar_scheduler_run(g_sched); 113 if ( options & OPTION_ABOUT ) { 114 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_ABOUT) == -1 ) { 115 ROAR_WARN("Can not call ABOUT trigger: %s", roar_errorstring); 116 } 117 } 118 119 if ( options & OPTION_HELP ) { 120 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_HELP) == -1 ) { 121 ROAR_WARN("Can not call HELP trigger: %s", roar_errorstring); 122 } 123 } 124 125 if ( options & OPTION_PREFERENCES ) { 126 if ( roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_PREFERENCES) == -1 ) { 127 ROAR_WARN("Can not call PREFERENCES trigger: %s", roar_errorstring); 128 } 129 } 130 131 132 if ( !(options & OPTION_TOUCH) ) 133 roar_scheduler_run(g_sched); 95 134 96 135 roar_plugincontainer_appsched_trigger(cont, ROAR_DL_APPSCHED_UPDATE); … … 303 342 } 304 343 305 static int do_plugin(enum action action, const char * name ) {344 static int do_plugin(enum action action, const char * name, int options) { 306 345 switch (action) { 307 346 case EXPLAIN: … … 310 349 case RUN: 311 350 case RUN_AS_APPLICATION: 312 return do_run(name );351 return do_run(name, options); 313 352 break; 314 353 default: … … 558 597 int cpi_touched = 0; 559 598 const char * cpi_host = NULL; 599 int options = OPTION_NONE; 560 600 561 601 g_sched = roar_scheduler_new(ROAR_SCHEDULER_FLAG_NONE, ROAR_SCHEDULER_STRATEGY_DEFAULT); … … 618 658 } 619 659 660 #define _option(name) \ 661 } else if ( !strcasecmp(k, "--option-" #name) ) { \ 662 options |= OPTION_ ## name; \ 663 } else if ( !strcasecmp(k, "--option-no-" #name) ) { \ 664 options |= OPTION_ ## name; \ 665 options -= OPTION_ ## name; 666 #define __fix_vim_syntax_highlight } 667 _option(TOUCH) 668 _option(ABOUT) 669 _option(HELP) 670 _option(PREFERENCES) 671 620 672 } else if ( !strcmp(k, "--appname") ) { 621 673 appname = argv[++i]; … … 640 692 } else { 641 693 roar_err_set(ROAR_ERROR_NONE); 642 if ( do_plugin(action, k ) == -1 ) {694 if ( do_plugin(action, k, options) == -1 ) { 643 695 fprintf(stderr, "Error loading plugin: %s\n", 644 696 roar_error != ROAR_ERROR_NONE ? roar_error2str(roar_error) : roar_dl_errstr(NULL));
Note: See TracChangeset
for help on using the changeset viewer.