/** Gère les options qui sont passées en ligne de commande */ int handle_options(int argc, char **argv) { int i=1; int res=1; while (i<argc) { if (!strcmp(argv[i], "--help")) { usage(); res=0; break; } else if (!strcmp(argv[i], "--mac")) { ++i; if (i>=argc) { usage(); return 0; } PropSet("MAC", argv[i]); } else if (!strcmp(argv[i], "--boot")) { PropSet("BOOT", "firmware"); } else if (!strcmp(argv[i], "--source")) { ++i; if (i>=argc) { usage(); return 0; } PropSet("SOURCE", argv[i]); } else if (!strcmp(argv[i], "--logs")) { ++i; if (i>=argc) { usage(); return 0; } my_printf_set_options(argv[i]); } else if (!strcmp(argv[i], "--logfile")) { ++i; if (i>=argc) { usage(); return 0; } if (my_printf_set_logfile(argv[i])) { res=0; break; } } else if (!strcmp(argv[i], "--maxlogsize")) { ++i; if (i>=argc || !my_is_number(argv[i])) { usage(); return 0; } my_printf_set_max_log_size(atoi(argv[i])); } else if (!strcmp(argv[i], "--maxlogtime")) { ++i; if (i>=argc || !my_is_number(argv[i])) { usage(); return 0; } my_printf_set_max_log_time(atoi(argv[i])); } else if (!strcmp(argv[i], "--dologtime")) { my_printf_set_do_log_time(1); } else { usage(); res=0; break; } ++i; } return res; }
//--------------------------------------------------------------------------- void tTJSNativeClass::RegisterNCM(const tjs_char *name, iTJSDispatch2 *dsp, const tjs_char *classname, tTJSNativeInstanceType type, tjs_uint32 flags) { // map name via Global String Map ttstr tname = TJSMapGlobalStringMap(ttstr(name)); // set object type for debugging if(TJSObjectHashMapEnabled()) { switch(type) { case nitMethod: TJSObjectHashSetType(dsp, ttstr(TJS_W("(native function) ")) + classname + TJS_W(".") + name); break; case nitProperty: TJSObjectHashSetType(dsp, ttstr(TJS_W("(native property) ")) + classname + TJS_W(".") + name); break; /* case nitClass: The information is not set here (is to be set in tTJSNativeClass::tTJSNativeClass) */ } } // add to this tTJSVariant val; val = dsp; if(PropSetByVS((TJS_MEMBERENSURE | TJS_IGNOREPROP) | flags, tname.AsVariantStringNoAddRef(), &val, this) == TJS_E_NOTIMPL) PropSet((TJS_MEMBERENSURE | TJS_IGNOREPROP) | flags, tname.c_str(), NULL, &val, this); // release dsp dsp->Release(); }