This is an automated email from the git hooks/post-receive script. hmmr-guest pushed a commit to branch WIP in repository cnrun.
commit e0d710ea10c22021f28d0ed24ba3d596d2d55d5e Author: andrei zavada <andrei.zav...@massivesolutions.eu> Date: Wed Oct 8 20:06:45 2014 +0300 WIP --- upstream/src/cnrun/cnrun.hh | 88 +++++++++++++++++++---------------- upstream/src/cnrun/commands.cc | 62 ++++++++++++------------ upstream/src/cnrun/interpreter.cc | 51 ++++++++++---------- upstream/src/cnrun/main.cc | 5 ++ upstream/src/libcn/model.hh | 5 ++ upstream/src/libstilton/libstilton.cc | 4 +- 6 files changed, 117 insertions(+), 98 deletions(-) diff --git a/upstream/src/cnrun/cnrun.hh b/upstream/src/cnrun/cnrun.hh index 86c4c0e..2bf3aaf 100644 --- a/upstream/src/cnrun/cnrun.hh +++ b/upstream/src/cnrun/cnrun.hh @@ -39,6 +39,12 @@ struct SInterpOptions : list_units (false), working_dir (".") {} + SInterpOptions (const SInterpOptions& rv) + : cnrun::SModelOptions (rv), + list_units (rv.list_units), + working_dir (rv.working_dir), + scripts (rv.scripts) + {} }; @@ -48,7 +54,7 @@ class CInterpreterShell DELETE_DEFAULT_METHODS (CInterpreterShell) public: - CInterpreterShell (const SInterpOptions& options_); + CInterpreterShell (const SInterpOptions&); ~CInterpreterShell (); SInterpOptions @@ -85,46 +91,46 @@ class CInterpreterShell values (move(rv.values)) {} }; - using TArgs = const vector<SArg>; - SCmdResult cmd_new_model( TArgs&); - SCmdResult cmd_delete_model( TArgs&); - SCmdResult cmd_import_nml( TArgs&); - SCmdResult cmd_export_nml( TArgs&); - SCmdResult cmd_reset_model( TArgs&); - SCmdResult cmd_cull_deaf_synapses( TArgs&); - SCmdResult cmd_describe_model( TArgs&); - SCmdResult cmd_get_model_parameter( TArgs&); - SCmdResult cmd_set_model_parameter( TArgs&); - SCmdResult cmd_advance( TArgs&); - SCmdResult cmd_advance_until( TArgs&); - - SCmdResult cmd_new_neuron( TArgs&); - SCmdResult cmd_new_synapse( TArgs&); - SCmdResult cmd_get_unit_properties( TArgs&); - SCmdResult cmd_get_unit_parameter( TArgs&); - SCmdResult cmd_set_unit_parameter( TArgs&); - SCmdResult cmd_get_unit_vars( TArgs&); - SCmdResult cmd_reset_unit( TArgs&); - - SCmdResult cmd_get_units_matching( TArgs&); - SCmdResult cmd_get_units_of_type( TArgs&); - SCmdResult cmd_set_matching_neuron_parameter( TArgs&); - SCmdResult cmd_set_matching_synapse_parameter( TArgs&); - SCmdResult cmd_revert_matching_unit_parameters( TArgs&); - SCmdResult cmd_decimate( TArgs&); - SCmdResult cmd_putout( TArgs&); - - SCmdResult cmd_new_tape_source( TArgs&); - SCmdResult cmd_new_periodic_source( TArgs&); - SCmdResult cmd_new_noise_source( TArgs&); - SCmdResult cmd_get_sources( TArgs&); - SCmdResult cmd_connect_source( TArgs&); - SCmdResult cmd_disconnect_source( TArgs&); - - SCmdResult cmd_start_listen( TArgs&); - SCmdResult cmd_stop_listen( TArgs&); - SCmdResult cmd_start_log_spikes( TArgs&); - SCmdResult cmd_stop_log_spikes( TArgs&); + using TArgs = vector<SArg>; + SCmdResult cmd_new_model( const TArgs&); + SCmdResult cmd_delete_model( const TArgs&); + SCmdResult cmd_import_nml( const TArgs&); + SCmdResult cmd_export_nml( const TArgs&); + SCmdResult cmd_reset_model( const TArgs&); + SCmdResult cmd_cull_deaf_synapses( const TArgs&); + SCmdResult cmd_describe_model( const TArgs&); + SCmdResult cmd_get_model_parameter( const TArgs&); + SCmdResult cmd_set_model_parameter( const TArgs&); + SCmdResult cmd_advance( const TArgs&); + SCmdResult cmd_advance_until( const TArgs&); + + SCmdResult cmd_new_neuron( const TArgs&); + SCmdResult cmd_new_synapse( const TArgs&); + SCmdResult cmd_get_unit_properties( const TArgs&); + SCmdResult cmd_get_unit_parameter( const TArgs&); + SCmdResult cmd_set_unit_parameter( const TArgs&); + SCmdResult cmd_get_unit_vars( const TArgs&); + SCmdResult cmd_reset_unit( const TArgs&); + + SCmdResult cmd_get_units_matching( const TArgs&); + SCmdResult cmd_get_units_of_type( const TArgs&); + SCmdResult cmd_set_matching_neuron_parameter( const TArgs&); + SCmdResult cmd_set_matching_synapse_parameter( const TArgs&); + SCmdResult cmd_revert_matching_unit_parameters( const TArgs&); + SCmdResult cmd_decimate( const TArgs&); + SCmdResult cmd_putout( const TArgs&); + + SCmdResult cmd_new_tape_source( const TArgs&); + SCmdResult cmd_new_periodic_source( const TArgs&); + SCmdResult cmd_new_noise_source( const TArgs&); + SCmdResult cmd_get_sources( const TArgs&); + SCmdResult cmd_connect_source( const TArgs&); + SCmdResult cmd_disconnect_source( const TArgs&); + + SCmdResult cmd_start_listen( const TArgs&); + SCmdResult cmd_stop_listen( const TArgs&); + SCmdResult cmd_start_log_spikes( const TArgs&); + SCmdResult cmd_stop_log_spikes( const TArgs&); // vp int verbose_threshold() const diff --git a/upstream/src/cnrun/commands.cc b/upstream/src/cnrun/commands.cc index c67c032..2da9c5a 100644 --- a/upstream/src/cnrun/commands.cc +++ b/upstream/src/cnrun/commands.cc @@ -35,12 +35,12 @@ inline const char* es(int x) { return (x == 1) ? "" : "s"; } #define CMD_PROLOG(N, F) \ CInterpreterShell::SCmdResult R; \ if ( aa.size() != N ) { \ - vp( 0, F"() takes %d arg%s, called with %zu", N, es(N), aa.size()); \ + vp( 0, F"() takes %d arg%s, called with %zu\n", N, es(N), aa.size()); \ return R.result = TCmdResult::bad_arity, move(R); \ } \ const string& model = aa[0].vs; \ if ( models.find(model) == models.end() ) { \ - vp( 0, F"(): no such model: \"%s\"", model.c_str()); \ + vp( 0, F"(): no such model: \"%s\"\n", model.c_str()); \ return R.result = TCmdResult::logic_error, move(R); \ } \ auto& M = *models.at(model); @@ -52,7 +52,7 @@ cmd_new_model( const TArgs& aa) { CInterpreterShell::SCmdResult R; if ( aa.size() != 1) { - vp( 0, stderr, "new_model() takes 1 parameter, got %zu", aa.size()); + vp( 0, stderr, "new_model() takes 1 parameter, called with %zu\n", aa.size()); return R.result = TCmdResult::bad_arity, move(R); } const string& model_name = aa[0].vs; @@ -65,7 +65,7 @@ cmd_new_model( const TArgs& aa) options.integration_dt_cap), options); if ( !M ) { - vp( 0, stderr, "Failed to create model"); + vp( 0, stderr, "Failed to create model\n"); return R.result = TCmdResult::system_error, move(R); } models[model_name] = M; @@ -183,7 +183,7 @@ cmd_get_model_parameter( const TArgs& aa) { CInterpreterShell::SCmdResult R; if ( aa.size() != 2 ) { - vp( 0, "get_model_parameter() takes 2 args, called with %zu", aa.size()); + vp( 0, "get_model_parameter() takes 2 args, called with %zu\n", aa.size()); return R.result = TCmdResult::bad_arity, move(R); } const string& model_name = aa[0].vs; @@ -191,7 +191,7 @@ cmd_get_model_parameter( const TArgs& aa) if ( model_name.size() != 0 ) { auto Mi = models.find(model_name); if ( Mi == models.end() ) { - vp( 0, "get_model_parameter(): no such model: \"%s\"", model_name.c_str()); + vp( 0, "get_model_parameter(): no such model: \"%s\"\n", model_name.c_str()); return R.result = TCmdResult::logic_error, move(R); } else M = Mi->second; @@ -252,7 +252,7 @@ cmd_set_model_parameter( const TArgs& aa) { CInterpreterShell::SCmdResult R; if ( aa.size() != 3 ) { - vp( 0, "set_model_parameter() takes 3 args, called with %zu", aa.size()); + vp( 0, "set_model_parameter() takes 3 args, called with %zu\n", aa.size()); return R.result = TCmdResult::bad_arity, move(R); } const string& model = aa[0].vs; @@ -260,7 +260,7 @@ cmd_set_model_parameter( const TArgs& aa) if ( model.size() != 0 ) { auto Mi = models.find(model); if ( Mi == models.end() ) { - vp( 0, "set_model_parameter(): no such model: \"%s\"", model.c_str()); + vp( 0, "set_model_parameter(): no such model: \"%s\"\n", model.c_str()); return R.result = TCmdResult::logic_error, move(R); } else M = Mi->second; @@ -273,7 +273,7 @@ cmd_set_model_parameter( const TArgs& aa) if ( parameter == "verbosely") { int v; if ( 1 != sscanf( value_s.c_str(), "%d", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `verbosely'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `verbosely'\n"); return R.result = TCmdResult::bad_value, move(R); } options.verbosely = v; @@ -283,7 +283,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "integration_dt_min" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_min'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_min'\n"); return R.result = TCmdResult::bad_value, move(R); } options.integration_dt_min = v; @@ -293,7 +293,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "integration_dt_max" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_max'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_max'\n"); return R.result = TCmdResult::bad_value, move(R); } options.integration_dt_max = v; @@ -303,7 +303,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "integration_dt_cap" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_cap'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `integration_dt_cap'\n"); return R.result = TCmdResult::bad_value, move(R); } options.integration_dt_cap = v; @@ -313,7 +313,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "listen_dt" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `listen_dt'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `listen_dt'\n"); return R.result = TCmdResult::bad_value, move(R); } options.listen_dt = v; @@ -335,7 +335,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "sxf_start_delay" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `sxf_start_delay'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `sxf_start_delay'\n"); return R.result = TCmdResult::bad_value, move(R); } options.sxf_start_delay = v; @@ -345,7 +345,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "sxf_period" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `sxf_period'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `sxf_period'\n"); return R.result = TCmdResult::bad_value, move(R); } options.sxf_period = v; @@ -355,7 +355,7 @@ cmd_set_model_parameter( const TArgs& aa) } else if ( parameter == "sdf_sigma" ) { double v; if ( 1 != sscanf( value_s.c_str(), "%lg", &v) ) { - vp( 0, stderr, "set_model_parameter(): bad value for parameter `sdf_sigma'"); + vp( 0, stderr, "set_model_parameter(): bad value for parameter `sdf_sigma'\n"); return R.result = TCmdResult::bad_value, move(R); } options.sdf_sigma = v; @@ -378,7 +378,7 @@ cmd_advance( const TArgs& aa) const double& time_to_go = aa[1].vg; const double end_time = M.model_time() + time_to_go; if ( M.model_time() > end_time ) { - vp( 0, stderr, "advance(%g): Cannot go back in time (model is now at %g sec)", end_time, M.model_time()); + vp( 0, stderr, "advance(%g): Cannot go back in time (model is now at %g sec)\n", end_time, M.model_time()); return R.result = TCmdResult::bad_value, move(R); } if ( !M.advance( end_time) ) { @@ -398,7 +398,7 @@ cmd_advance_until( const TArgs& aa) const double end_time = aa[1].vg; if ( M.model_time() > end_time ) { - vp( 0, stderr, "advance_until(%g): Cannot go back in time (model is now at %g sec)", end_time, M.model_time()); + vp( 0, stderr, "advance_until(%g): Cannot go back in time (model is now at %g sec)\n", end_time, M.model_time()); return R.result = TCmdResult::bad_value, move(R); } if ( !M.advance( end_time) ) { @@ -700,7 +700,7 @@ cmd_decimate( const TArgs& aa) const string &pattern = aa[1].vs; const double& frac = aa[2].vg; if ( frac < 0. || frac > 1. ) { - vp( 0, stderr, "decimate(%g): Decimation fraction outside [0..1]", frac); + vp( 0, stderr, "decimate(%g): Decimation fraction outside [0..1]\n", frac); return R.result = TCmdResult::bad_value, move(R); } @@ -746,7 +746,7 @@ cmd_new_tape_source( const TArgs& aa) &looping = aa[3].vd; if ( M.source_by_id( name) ) { - vp( 0, stderr, "new_tape_source(): A source named \"%s\" already exists", name.c_str()); + vp( 0, stderr, "new_tape_source(): A source named \"%s\" already exists\n", name.c_str()); return R.result = TCmdResult::logic_error, move(R); } @@ -757,12 +757,12 @@ cmd_new_tape_source( const TArgs& aa) if ( source ) M.add_source( source); else { - vp( 0, stderr, "new_tape_source(\"%s\", \"%s\"): Failed impossibly", + vp( 0, stderr, "new_tape_source(\"%s\", \"%s\"): Failed impossibly\n", name.c_str(), fname.c_str()); return R.result = TCmdResult::system_error, move(R); } } catch (exception& ex) { - vp( 0, stderr, "new_tape_source(\"%s\", \"%s\"): %s", + vp( 0, stderr, "new_tape_source(\"%s\", \"%s\"): %s\n", name.c_str(), fname.c_str(), ex.what()); return R.result = TCmdResult::system_error, move(R); } @@ -786,7 +786,7 @@ cmd_new_periodic_source( const TArgs& aa) &period = aa[4].vg; if ( M.source_by_id( name) ) { - vp( 0, stderr, "new_periodic_source(): A source named \"%s\" already exists", name.c_str()); + vp( 0, stderr, "new_periodic_source(): A source named \"%s\" already exists\n", name.c_str()); return R.result = TCmdResult::logic_error, move(R); } @@ -798,12 +798,12 @@ cmd_new_periodic_source( const TArgs& aa) if ( source ) M.add_source( source); else { - vp( 0, stderr, "new_periodic_source(\"%s\", \"%s\"): Failed impossibly", + vp( 0, stderr, "new_periodic_source(\"%s\", \"%s\"): Failed impossibly\n", name.c_str(), fname.c_str()); return R.result = TCmdResult::system_error, move(R); } } catch (exception& ex) { - vp( 0, stderr, "new_periodic_source(\"%s\", \"%s\"): %s", + vp( 0, stderr, "new_periodic_source(\"%s\", \"%s\"): %s\n", name.c_str(), fname.c_str(), ex.what()); return R.result = TCmdResult::system_error, move(R); } @@ -828,7 +828,7 @@ cmd_new_noise_source( const TArgs& aa) &distribution = aa[5].vs; if ( M.source_by_id( name) ) { - vp( 0, stderr, "new_noise_source(): A source named \"%s\" already exists", name.c_str()); + vp( 0, stderr, "new_noise_source(): A source named \"%s\" already exists\n", name.c_str()); return R.result = TCmdResult::logic_error, move(R); } @@ -838,12 +838,12 @@ cmd_new_noise_source( const TArgs& aa) if ( source ) M.add_source( source); else { - vp( 0, stderr, "new_noise_source(\"%s\"): Failed impossibly", + vp( 0, stderr, "new_noise_source(\"%s\"): Failed impossibly\n", name.c_str()); return R.result = TCmdResult::system_error, move(R); } } catch (exception& ex) { - vp( 0, stderr, "new_noise_source(\"%s\"): %s", + vp( 0, stderr, "new_noise_source(\"%s\"): %s\n", name.c_str(), ex.what()); return R.result = TCmdResult::system_error, move(R); } @@ -878,7 +878,7 @@ cmd_connect_source( const TArgs& aa) &source = aa[3].vs; C_BaseSource *S = M.source_by_id( source); if ( !S ) { - vp( 0, stderr, "connect_source(): Unknown source: \"%s\"", source.c_str()); + vp( 0, stderr, "connect_source(): Unknown source: %s\n", source.c_str()); return R.result = TCmdResult::bad_id, move(R); } // cannot check whether units matching label indeed have a parameter so named @@ -904,7 +904,7 @@ cmd_disconnect_source( const TArgs& aa) &source = aa[3].vs; C_BaseSource *S = M.source_by_id( source); if ( !S ) { - vp( 0, stderr, "disconnect_source(): Unknown source: \"%s\"", source.c_str()); + vp( 0, stderr, "disconnect_source(): Unknown source: %s\n", source.c_str()); return R.result = TCmdResult::bad_id, move(R); } list<CModel::STagGroupSource> tags {{label, parm, S, CModel::STagGroup::TInvertOption::yes}}; @@ -969,7 +969,7 @@ cmd_start_log_spikes( const TArgs& aa) CMD_PROLOG (2, "start_log_spikes") if ( M.options.sxf_period <= 0. || M.options.sdf_sigma <= 0. ) - vp( 1, "SDF parameters not set up, will only log spike times"); + vp( 1, "SDF parameters not set up, will only log spike times\n"); const string &pattern = aa[1].vs; diff --git a/upstream/src/cnrun/interpreter.cc b/upstream/src/cnrun/interpreter.cc index 2f43fd0..9d8a5cf 100644 --- a/upstream/src/cnrun/interpreter.cc +++ b/upstream/src/cnrun/interpreter.cc @@ -26,6 +26,7 @@ extern "C" { using namespace std; using namespace cnrun; +using stilton::str::sasprintf; cnrun::CInterpreterShell:: CInterpreterShell (const SInterpOptions& options_) @@ -115,15 +116,16 @@ extern "C" int host_fun( lua_State* L) // -> nargsout { - auto reperr = [&L] (const char* str) + size_t nargsin = lua_gettop(L) - 2; // the first two being, a CScoreAssistant* and opcode + + auto this_p = (CInterpreterShell*)lua_touserdata( L, 1); + + auto reperr = [&] (const char* str) { lua_pushboolean( L, false); lua_pushfstring( L, str); }; - size_t nargsin = lua_gettop(L) - 2; // the first two being, a CScoreAssistant* and opcode - - auto this_p = (CInterpreterShell*)lua_touserdata( L, 1); if ( !this_p ) { reperr( "Opaque shell blob object is NULL"); return 2; @@ -131,34 +133,34 @@ host_fun( lua_State* L) // -> nargsout const char* opcode = lua_tostring( L, 2); - size_t argth = 2; - for ( auto& C : Commands ) if ( strcmp( opcode, C.id) == 0 ) { - if ( nargsin - 2 != strlen(C.arg_sig) ) { - reperr( stilton::str::sasprintf( - "Bad arity in call to %s (expecting %zu arg(s), got %zu", - opcode, strlen(C.arg_sig), nargsin - 2).c_str()); + if ( nargsin != strlen(C.arg_sig) ) { + reperr( sasprintf( "Bad arity in call to %s (expecting %zu arg(s), got %zu", + opcode, strlen(C.arg_sig), nargsin).c_str()); return 2; } // we don't accept arrays from lua yet CInterpreterShell::TArgs args; - while ( ++argth < nargsin ) { + size_t argth = 0; + while ( ++argth <= nargsin ) { CInterpreterShell::SArg A (0); - A.type = C.arg_sig[argth-2]; + A.type = C.arg_sig[argth-1]; switch ( A.type ) { - case 's': A.vs = lua_tostring( L, argth); break; - case 'd': A.vd = lua_tointeger( L, argth); break; - case 'b': A.vd = lua_tointeger( L, argth); break; - case 'g': A.vg = lua_tonumber( L, argth); break; + case 's': A.vs = lua_tostring( L, 2 + argth); break; + case 'd': A.vd = lua_tointeger( L, 2 + argth); break; + case 'b': A.vd = lua_tointeger( L, 2 + argth); break; + case 'g': A.vg = lua_tonumber( L, 2 + argth); break; default: throw "Fix type literals in SCmdDesc?"; } + args.push_back(A); } // return: ok result code, # of values pushed, value0, value1, ...; o // non-ok result code, error string + this_p->vp( 5, "fun %s/%zu\n", C.id, args.size()); auto R = (this_p ->* C.fun)( args); lua_settop( L, 0); lua_pushboolean( L, true); @@ -179,9 +181,8 @@ host_fun( lua_State* L) // -> nargsout return 1 + 1 + 1; } } - reperr( stilton::str::sasprintf( - "Unrecognized function \"%s\"/%zu", - opcode, nargsin - 2).c_str()); + reperr( sasprintf( "Unrecognized function \"%s\"/%zu", + opcode, nargsin - 2).c_str()); return 2; } } @@ -203,7 +204,7 @@ exec_script( const string& script_fname) script_contents += b; } if ( script_contents.size() == 0 ) { - vp( 0, "%s: empty file", script_fname.c_str()); + vp( 0, "%s: empty file\n", script_fname.c_str()); return TScriptExecResult::file_error; } } @@ -219,13 +220,13 @@ exec_script( const string& script_fname) script_fname.c_str()); if ( ret1 ) { const char* errmsg = lua_tostring( lua_state, -1); - vp( 0, "%s: compilation failed: %s (%d)", script_fname.c_str(), errmsg, ret1); + vp( 0, "%s: compilation failed: %s (%d)\n", script_fname.c_str(), errmsg, ret1); return TScriptExecResult::compile_error; } // 1c. put host_fun on stack if ( !lua_checkstack( lua_state, 2) ) { - vp( 0, "failed to grow stack for 2 elements"); + vp( 0, "failed to grow stack for 2 elements\n"); return TScriptExecResult::stack_error; } @@ -239,7 +240,7 @@ exec_script( const string& script_fname) 1, // nargsout 0); if ( call_result ) { - vp( 0, "%s: script call failed (%d)", script_fname.c_str(), call_result); + vp( 0, "%s: script call failed (%d): %s\n", script_fname.c_str(), call_result, lua_tostring( lua_state, 1)); return TScriptExecResult::call_error; } @@ -252,9 +253,11 @@ int cnrun::CInterpreterShell:: run() { - for ( const auto& S : options.scripts ) + for ( const auto& S : options.scripts ) { + vp( 1, "Exec %s:\n", S.c_str()); if ( exec_script(S) != TScriptExecResult::ok ) return 1; + } return 0; } diff --git a/upstream/src/cnrun/main.cc b/upstream/src/cnrun/main.cc index a30c506..502c810 100644 --- a/upstream/src/cnrun/main.cc +++ b/upstream/src/cnrun/main.cc @@ -99,6 +99,11 @@ parse_opt( int key, char *arg, struct argp_state *state) Q.scripts.emplace_back(arg); break; + case ARGP_KEY_END: + if ( Q.scripts.empty() && !Q.list_units ) + argp_usage (state); + break; + default: return (error_t)ARGP_ERR_UNKNOWN; } diff --git a/upstream/src/libcn/model.hh b/upstream/src/libcn/model.hh index 9f59be3..44ef9d1 100644 --- a/upstream/src/libcn/model.hh +++ b/upstream/src/libcn/model.hh @@ -89,6 +89,11 @@ struct SModelOptions { sxf_start_delay (0.), sxf_period (0.), sdf_sigma (0.), verbosely (1) {} + + SModelOptions (const SModelOptions& rv) + { + memmove(this, &rv, sizeof(SModelOptions)); + } }; diff --git a/upstream/src/libstilton/libstilton.cc b/upstream/src/libstilton/libstilton.cc index a7f7073..6dba1ef 100644 --- a/upstream/src/libstilton/libstilton.cc +++ b/upstream/src/libstilton/libstilton.cc @@ -35,7 +35,7 @@ void C_verprintf:: vp( int level, const char* fmt, ...) const { - if ( level > verbose_threshold() ) { + if ( level < verbose_threshold() ) { va_list ap; va_start (ap, fmt); vprintf( fmt, ap); @@ -47,7 +47,7 @@ void C_verprintf:: vp( int level, FILE* f, const char* fmt, ...) const { - if ( level > verbose_threshold() ) { + if ( level < verbose_threshold() ) { va_list ap; va_start (ap, fmt); vfprintf( f, fmt, ap); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/cnrun.git _______________________________________________ debian-med-commit mailing list debian-med-commit@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit