[med-svn] [SCM] aghermann branch, master, updated. 99b1d5a023eee9df74b0e0d6f894516fc79435ad
Andrei Zavada
johnhommer at gmail.com
Sun Jul 7 23:03:49 UTC 2013
The following commit has been merged in the master branch:
commit b34966927c5f784dd0fd87e3950fdcd46b484503
Author: Andrei Zavada <johnhommer at gmail.com>
Date: Sun Jun 9 12:44:29 2013 +0300
aghermann -n EXPDIR for headless mode
Only init a CExpDesign in that dir, do nothing else, the idea being to
run it under valgrind.
diff --git a/src/aghermann/main.cc b/src/aghermann/main.cc
index 608f9ea..64cf7b1 100644
--- a/src/aghermann/main.cc
+++ b/src/aghermann/main.cc
@@ -19,6 +19,7 @@
#include <unique/unique.h>
#include "globals.hh"
+#include "expdesign/primaries.hh"
#include "ui/globals.hh"
#include "ui/ui.hh"
#include "ui/sm/sm.hh"
@@ -56,51 +57,76 @@ message_received_cb( UniqueApp *,
void print_version();
+static void print_usage( const char*);
+
int
main( int argc, char **argv)
{
print_version();
+ bool headless = false;
int c;
- while ( (c = getopt( argc, argv, "h")) != -1 )
+ while ( (c = getopt( argc, argv, "hn")) != -1 )
switch ( c ) {
+ case 'n': // headless
+ headless = true;
+ break;
case 'h':
- printf( "Usage: %s [exp_root_dir]\n", argv[0]);
+ print_usage( argv[0]);
return 0;
}
- gtk_init( &argc, &argv);
+ if ( headless ) {
+ char*& explicit_session = argv[optind];
+ if ( (!explicit_session || strlen(explicit_session) == 0) ) {
+ fprintf( stderr, "Headless mode requires explicit session dir\n");
+ print_usage( argv[0]);
+ return -1;
+ }
+
+ agh::CExpDesign ED (explicit_session); // essentially a very thoughtful no-op
- // don't let user get us started twice
- aghui::__unique_app__ =
- unique_app_new_with_commands( "com.johnhommer.Aghermann", NULL,
- "fafa", 1,
- NULL);
- if ( unique_app_is_running( aghui::__unique_app__) ) {
- printf( "There is unique app, switching to it now\n");
- unique_app_send_message( aghui::__unique_app__, UNIQUE_ACTIVATE, NULL);
} else {
- g_signal_connect( aghui::__unique_app__, "message-received",
- (GCallback)message_received_cb,
- NULL);
- agh::global::init();
+ gtk_init( &argc, &argv);
- if ( aghui::prepare_for_expdesign() ) {
- aghui::pop_ok_message( NULL, "UI failed to initialize", "Your install is broken.");
- return 2;
- }
+ // don't let user get us started twice
+ aghui::__unique_app__ =
+ unique_app_new_with_commands( "com.johnhommer.Aghermann", NULL,
+ "fafa", 1,
+ NULL);
+ if ( unique_app_is_running( aghui::__unique_app__) ) {
+ printf( "There is unique app, switching to it now\n");
+ unique_app_send_message( aghui::__unique_app__, UNIQUE_ACTIVATE, NULL);
+ } else {
+ g_signal_connect( aghui::__unique_app__, "message-received",
+ (GCallback)message_received_cb,
+ NULL);
+
+ agh::global::init();
- aghui::SSessionChooser chooser (argv[optind]);
- // implicit read sessionrc, run
+ if ( aghui::prepare_for_expdesign() ) {
+ aghui::pop_ok_message( NULL, "UI failed to initialize", "Your install is broken.");
+ return 2;
+ }
- gtk_main();
+ aghui::SSessionChooser chooser (argv[optind]);
+ // implicit read sessionrc, run
+
+ gtk_main();
+ }
+ // g_object_unref (app); // abandon ship anyway
}
- // g_object_unref (app); // abandon ship anyway
return 0;
}
+void
+print_usage( const char* argv0)
+{
+ printf( "Usage: %s [-n] [exp_root_dir]\n", argv0);
+}
+
// Local Variables:
// Mode: c++
// indent-tabs-mode: 8
--
Sleep experiment manager
More information about the debian-med-commit
mailing list