template<class... Ts>void init(Ts... args)
		{
			init_impl(args...);
			if (sizeof...(Ts) <= 1)
				return;
			auto ite = sentence.begin();
			auto before = sentence.begin();
			++ite;
			auto end = sentence.end();
			for (; ite != end; ++ite)
			{
				before = std::prev(ite);
				if ((*before).type_ == parse_helper::data_type::token &&
					(*ite).type_ == parse_helper::data_type::token)
				{
					sentence.emplace(ite, " ");
					sentence.emplace(ite, placeholder::space_holder);
				}
				else if ((*before).type_ == parse_helper::data_type::token &&
					(*ite).type_ == parse_helper::data_type::string&&
					token_string_check(*(*ite).str_.c_str()))
				{
					sentence.emplace(ite, " ");
					sentence.emplace(ite, placeholder::space_holder);
				}
				else if((*ite).type_ == parse_helper::data_type::token &&
					(*before).type_ == parse_helper::data_type::string &&
					token_string_check(*(std::prev((*before).str_.end()))))
				{
					sentence.emplace(ite, " ");
					sentence.emplace(ite, placeholder::space_holder);
				}
			}
		}
CRYSTAX_LOCAL
bool init()
{
    TRACE;
    if (!init_flag)
    {
        TRACE;
        scope_lock_t lock(init_mutex);

        TRACE;
        if (!init_flag)
        {
            TRACE;
            if (!init_impl())
            {
                TRACE;
                return false;
            }
            TRACE;
            init_flag = true;
        }
    }
    TRACE;
    return true;
}
Gobby::EncodingFileChooserDialog::
	EncodingFileChooserDialog(const Glib::ustring& title,
	                          Gtk::FileChooserAction action):
	Gtk::FileChooserDialog(title, action)
{
	init_impl(action);
}
Exemple #4
0
Result<BinlogInfo> ConcurrentBinlog::init(string path, const Callback &callback, DbKey db_key, DbKey old_db_key,
                                          int scheduler_id) {
  auto binlog = std::make_unique<Binlog>();
  TRY_STATUS(binlog->init(std::move(path), callback, std::move(db_key), std::move(old_db_key)));
  auto info = binlog->get_info();
  init_impl(std::move(binlog), scheduler_id);
  return info;
}
Gobby::EncodingFileChooserDialog::
	EncodingFileChooserDialog(Gtk::Window& parent,
	                          const Glib::ustring& title,
	                          Gtk::FileChooserAction action):
	Gtk::FileChooserDialog(parent, title, action)
{
	init_impl(action);
}
bool LLPluginClassBasic::init(std::string const& launcher_filename, std::string const& plugin_filename, bool debug)
{	
	LL_DEBUGS("Plugin") << "launcher: " << launcher_filename << LL_ENDL;
	LL_DEBUGS("Plugin") << "plugin: " << plugin_filename << LL_ENDL;
	
	mPlugin = new LLPluginProcessParent(this);
	mPlugin->setSleepTime(mSleepTime);
	
	mPlugin->init(launcher_filename, plugin_filename, debug);

	return init_impl();
}
Exemple #7
0
int main(int argc, char *argv[])
{
  char *cases[] = {
    /* "(+. 1.1 1.2)", */
    /* "(integer->float 123)", */
    /* "(& 5 7)", */
    /* "'hello", */
    /* "-", */
    /* "(define a (string->in-port \"abc\"))", */
    /* "(read-string-in-port-char a)", */
    /* "(+i 1 2)", */
    /* "(*i 3 4)", */
    /* "(quotient 10 3)", */
    /* "(remainder 10 3)", */
    /* "(= 1 2)", */
    /* "(> 4 5)", */
    /* "(& 5 7)", */
    /* "(| 5 7)", */
    /* "(~ 5)", */
    /* "(eq? 'hello 'hello)", */
    /* "(eq? 1 1)", */
    /* "(eq? (string->symbol \"hello\") 'hello)", */
    /* "(type-of 'hello)", */
    /* "type-of", */
    /* "#\\a", */
    /* "(type-of #\\a)", */
    /* "(define a #(1 2 3))", */
    /* "#\\汉", */
    /* "(set! a 123)", */
    "(string-ref \"汉字\" 0)",
  };
  init_impl();
  /* printf("Address of `-': %p\n", &primitive_procs[1]); */
  for (int i = 0; i < sizeof(cases) / sizeof(char *); i++) {
    FILE *stream = fmemopen(cases[i], strlen(cases[i]), "r");
    sexp in_port = make_file_in_port(stream);
    /* inc_ref_count(in_port); */
    printf(">> %s\n=> ", cases[i]);
    sexp value = read_object(in_port);
    if (is_eof(value))
      break;
    /* inc_ref_count(input); */
    value = eval_object(value, repl_environment);
    /* if (!is_self_eval(input)) */
    /*   inc_ref_count(value); */
    write_object(value, scm_out_port);
    putchar('\n');
  }
  /* write_object(make_wstring("汉"), scm_out_port); */
  /* trigger_gc(); */
  return 0;
}
Exemple #8
0
int main(int argc, char *argv[])
{
  init_impl();
  char *cases[] = {
    /* "1", */
    /* "12.3", */
    /* "123.45", */
    /* "1234.567", */
    /* "12345.6789", */
    /* ";;\n987654.3210", */
    /* "+i", */
    /* "'hello", */
    /* "#\\汉", */
    /* "(if #t 1 2)", */
    /* "(set! a 1)", */
    /* "(begin (set! a 1) a)", */
    /* "(begin \"doc\" (write \"Hello, world\") 2)", */
    /* "(lambda (x) (+i x 1))", */
    /* "(+i 1 1)", */
    /* "(eq? \"abc\" \"abc\")", */
    /* "(eq? #\\a #\\a)", */
    /* "((lambda (x . y) (cons x y)) 1 2 3 4)", */
    /* "(eq? 'hello 'hello)", */
    /* "(cdr '(1 2))", */
    /* "(string-ref \"汉\" 0)", */
    /* "(string-length \"汉字\")", */
    /* "(string-set! \"汉字\" 1 #\\语)", */
    /* "(eval '(cdr '(1 2 3)) (repl-environment))", */
    /* "(cons 1 2)", */
    /* "#(1 2 3)", */
    /* "(+i 1 2)", */
    /* "(-i 1 2)", */
    /* "(*i 1 2)", */
    /* "(/i 1 2)", */
    "not",
  };
  for (int i = 0; i < sizeof(cases) / sizeof(char *); i++) {
    FILE *fp = fmemopen(cases[i], strlen(cases[i]), "r");
    lisp_object_t in_port = make_file_in_port(fp);
    printf(">> %s\n", cases[i]);
    lisp_object_t compiled_code =
        compile_as_fn(read_object(in_port), repl_environment);
    /* port_format(scm_out_port, "-- %*\n", compiled_code); */
    lisp_object_t value =
        run_compiled_code(compiled_code, repl_environment, vm_stack);
    port_format(scm_out_port, "=> %*\n", value);
    fclose(fp);
  }
  port_format(scm_out_port, "%*\n", vm_stack);
  return 0;
}
Exemple #9
0
ConcurrentBinlog::ConcurrentBinlog(std::unique_ptr<Binlog> binlog, int scheduler_id) {
  init_impl(std::move(binlog), scheduler_id);
}
void protocol_base_t::init(client_t * manipulator) {
    manipulator_ = manipulator;
    LOG4CPLUS_TRACE(log_, "init " << manipulator_);
    init_impl();
}
		template<class T, class... Ts>void init_impl(T arg, Ts... args)
		{
			init_impl(args...);
			sentence.emplace_front(arg);
		}
void call_init(T &t)
{
  init_impl(t);
}