当前位置: 首页>>代码示例>>C++>>正文


C++ rl_callback_handler_remove函数代码示例

本文整理汇总了C++中rl_callback_handler_remove函数的典型用法代码示例。如果您正苦于以下问题:C++ rl_callback_handler_remove函数的具体用法?C++ rl_callback_handler_remove怎么用?C++ rl_callback_handler_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rl_callback_handler_remove函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rl_callback_handler_install

void *
ConsoleUI::threadMain(void *arg) {
	rl_callback_handler_install("", ConsoleUICallbacks::lineRead);
	while (!quit) {
		while (canRead()) {
			lineProcessed = false;
			rl_callback_read_char();
			if (lineProcessed && rl_prompt != NULL && rl_prompt[0] != '\0') {
				// If a line has been processed, reset the prompt
				// so we don't see it again after an Enter.
				rl_set_prompt("");
				rl_display_prompt = NULL;
				rl_redisplay();
			}
		}

		pthread_mutex_lock(&outputLock);
		if (!output.empty()) {
			processOutput();
			pthread_cond_broadcast(&outputCond);
		}
		pthread_mutex_unlock(&outputLock);

		usleep(10000);
	}
	rl_callback_handler_remove();
	return NULL;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:28,代码来源:consoleui.cpp

示例2: jl_input_line_callback

void jl_input_line_callback(char *input)
{
    int end=0, doprint=1;
    if (!input || ios_eof(ios_stdin)) {
        end = 1;
        rl_ast = NULL;
    }
    else if (!rl_ast) {
        // In vi mode, it's possible for this function to be called w/o a
        // previous call to return_callback.
        rl_ast = jl_parse_input_line(rl_line_buffer);
    }

    if (rl_ast != NULL) {
        doprint = !ends_with_semicolon(input);
        add_history_permanent(input);
        jl_putc('\n', jl_uv_stdout);
        free(input);
    }

    callback_en = 0;
    rl_callback_handler_remove();
    handle_input(rl_ast, end, doprint);
    rl_ast = NULL;
}
开发者ID:HarlanH,项目名称:julia,代码行数:25,代码来源:repl-readline.c

示例3: rl_docmd

/* readline hook to process the entered command */
static void
rl_docmd(char *line)
{
	char buf[NPH_BUF_SIZE];	/* space for an input line */

	/* EOF */
	if (line == NULL)
	{
		rl_callback_handler_remove();
		sighandler_state = HANDLER_DEFAULT;
		ph_close(ph, 0);
		exit(0);
	}

	/* blank line */
	if (*line == '\0')
	{
		free(line);
		return;
	}

	add_history(line);
	strlcpy(buf, line, sizeof(buf));
	free(line);

	/* do command */
	nph_command(buf);
	putchar('\n');
}
开发者ID:chaos,项目名称:nph,代码行数:30,代码来源:interactive.c

示例4: exitCLI

int_fast8_t exitCLI()
{
    char command[500];
    int r;

    if(data.fifoON == 1)
    {
        sprintf(command, "rm %s", data.fifoname);
        r = system(command);
    }

    main_free();


    if(Listimfile==1) {
        if(system("rm imlist.txt")==-1)
        {
            printERROR(__FILE__,__func__,__LINE__,"system() error");
            exit(0);
        }
    }

    rl_callback_handler_remove();


    printf("Closing PID %ld (prompt process)\n", (long) getpid());
    exit(0);
    return 0;
}
开发者ID:oguyon,项目名称:PIAACMCdesign,代码行数:29,代码来源:CLIcore.c

示例5: edit_deinit

void edit_deinit(const char *history_file,
		 int (*filter_cb)(void *ctx, const char *cmd))
{
	rl_set_prompt("");
	rl_replace_line("", 0);
	rl_redisplay();
	rl_callback_handler_remove();
	readline_free_completions();

	eloop_unregister_read_sock(STDIN_FILENO);

	if (history_file) {
		/* Save command history, excluding lines that may contain
		 * passwords. */
		HIST_ENTRY *h;
		history_set_pos(0);
		while ((h = current_history())) {
			char *p = h->line;
			while (*p == ' ' || *p == '\t')
				p++;
			if (filter_cb && filter_cb(edit_cb_ctx, p)) {
				h = remove_history(where_history());
				if (h) {
					free(h->line);
					free(h->data);
					free(h);
				} else
					next_history();
			} else
				next_history();
		}
		write_history(history_file);
	}
}
开发者ID:0x000000FF,项目名称:wpa_supplicant_for_edison,代码行数:34,代码来源:edit_readline.c

示例6: change_line_handler

/* Change the function to be invoked every time there is a character
   ready on stdin.  This is used when the user sets the editing off,
   therefore bypassing readline, and letting gdb handle the input
   itself, via gdb_readline2.  Also it is used in the opposite case in
   which the user sets editing on again, by restoring readline
   handling of the input.  */
static void
change_line_handler (void)
{
  /* NOTE: this operates on input_fd, not instream.  If we are reading
     commands from a file, instream will point to the file.  However in
     async mode, we always read commands from a file with editing
     off.  This means that the 'set editing on/off' will have effect
     only on the interactive session.  */

  if (async_command_editing_p)
    {
      /* Turn on editing by using readline.  */
      call_readline = rl_callback_read_char_wrapper;
      input_handler = command_line_handler;
    }
  else
    {
      /* Turn off editing by using gdb_readline2.  */
      rl_callback_handler_remove ();
      call_readline = gdb_readline2;

      /* Set up the command handler as well, in case we are called as
         first thing from .gdbinit.  */
      input_handler = command_line_handler;
    }
}
开发者ID:T-J-Teru,项目名称:gdb,代码行数:32,代码来源:event-top.c

示例7: shutdown_app

void shutdown_app(void)
{
	if(g_context.sock >= 0)
	{
		close(g_context.sock);
		g_context.sock = -1;
	}
	if(g_context.outsock >= 0)
	{
		close(g_context.outsock);
		g_context.outsock = -1;
	}
	if(g_context.errsock >= 0)
	{
		close(g_context.errsock);
		g_context.errsock = -1;
	}
	if(g_context.fssock >= 0)
	{
		close(g_context.fssock);
		g_context.fssock = -1;
	}

	if(!g_context.args.script)
	{
		rl_callback_handler_remove();
	}
}
开发者ID:FTPiano,项目名称:psplinkusb,代码行数:28,代码来源:pspsh.C

示例8: assert

void readline_constructor_impl::impl::stop()
{
  if (current_readline == NULL) {
    // We're already stopped
    return;
  }

  assert(detail::current_readline == this);
  stdin_reader_.cancel();
  redisplay_timer_.cancel();
  rl_callback_handler_remove();
  detail::current_readline = NULL;
  std::cout << std::endl;

  if (!history_file_.empty()) {
    boost::filesystem::create_directories(history_file_.parent_path());
    if (0 == write_history(history_file_.c_str())) {
      if (0 != history_truncate_file(
            history_file_.c_str(), history_length
          )) {
        throw relasio_error("error truncating history\n");
      }
    } else {
      throw relasio_error("error writing history\n");
    }
  }
}
开发者ID:jbytheway,项目名称:relasio,代码行数:27,代码来源:readline.cpp

示例9: displayCmdLine

char* displayCmdLine(WINDOW *win){
	curs_set(2);
	winCommandMode = win;
	wmove (win, 1, 1);
	//wprintw(winCommandMode, prompt);
	wrefresh(win);

	//rl_bind_key(RETURN, io_handle_enter);
	rl_redisplay_function = (rl_voidfunc_t*)rl_redisplay_mod;

	wprintw(winCommandMode, prompt);
	char* line = readline(prompt);
	add_history(line);
	// for testing history
	//line = readline(prompt);
	wmove (win, 1, 11);
	wprintw(winCommandMode, line);
	wrefresh(win);
	return line;


	rl_callback_handler_install(prompt, handle_line);

	while (prog_running) {
		usleep(10);
		rl_callback_read_char();
	}
	rl_callback_handler_remove();
	//handle_command(rl_line_buffer);
	return rl_line_buffer;
} 
开发者ID:prosbloom225,项目名称:mmpc,代码行数:31,代码来源:io.c

示例10: rl_callback_handler_remove

char *ssc_input_read_string(char *str, int size)
{
#if USE_READLINE
    char *input;

    /* disable readline callbacks */
    if (ssc_input_handler_f)
        rl_callback_handler_remove();

    rl_reset_line_state();

    /* read a string a feed to 'str' */
    input = readline(ssc_input_prompt);
    strncpy(str, input, size - 1);
    str[size - 1] = 0;

    /* free the copy malloc()'ed by readline */
    free(input);

    /* reinstall the func */
    if (ssc_input_handler_f)
        rl_callback_handler_install(ssc_input_prompt, ssc_input_handler_f);

    rl_redisplay();

    return str;
#else
    return fgets(str, size, stdin);
#endif
}
开发者ID:knoja4,项目名称:restcomm-ios-sdk,代码行数:30,代码来源:ssc_input.cpp

示例11: readline_until_enter_or_signal

static char *
readline_until_enter_or_signal(const char *prompt, int *signal)
{
    char * not_done_reading = "";
    fd_set selectset;

    *signal = 0;
#ifdef HAVE_RL_CATCH_SIGNAL
    rl_catch_signals = 0;
#endif

    rl_callback_handler_install (prompt, rlhandler);
    FD_ZERO(&selectset);

    completed_input_string = not_done_reading;

    while (completed_input_string == not_done_reading) {
        int has_input = 0, err = 0;

        while (!has_input)
        {               struct timeval timeout = {0, 100000}; /* 0.1 seconds */

            /* [Bug #1552726] Only limit the pause if an input hook has been
               defined.  */
            struct timeval *timeoutp = NULL;
            if (PyOS_InputHook)
                timeoutp = &timeout;
            FD_SET(fileno(rl_instream), &selectset);
            /* select resets selectset if no input was available */
            has_input = select(fileno(rl_instream) + 1, &selectset,
                               NULL, NULL, timeoutp);
            err = errno;
            if(PyOS_InputHook) PyOS_InputHook();
        }

        if (has_input > 0) {
            rl_callback_read_char();
        }
        else if (err == EINTR) {
            int s;
#ifdef WITH_THREAD
            PyEval_RestoreThread(_PyOS_ReadlineTState);
#endif
            s = PyErr_CheckSignals();
#ifdef WITH_THREAD
            PyEval_SaveThread();
#endif
            if (s < 0) {
                rl_free_line_state();
                rl_cleanup_after_signal();
                rl_callback_handler_remove();
                *signal = 1;
                completed_input_string = NULL;
            }
        }
    }

    return completed_input_string;
}
开发者ID:1564143452,项目名称:kbengine,代码行数:59,代码来源:readline.c

示例12: rl_callback_handler_remove

void ReadLineAgent::make_sane()
{
#if WITH_READLINE
    // No need to read any longer
    rl_callback_handler_remove();
#endif
    current_prompter = 0;
}
开发者ID:KrisChaplin,项目名称:octeon_toolchain-4.1,代码行数:8,代码来源:ReadLineA.C

示例13: tty_cmd

int tty_cmd(int argc, char **argv)
{
	g_context.ttymode = 1;
	rl_callback_handler_remove();
	rl_callback_handler_install("", cli_handler);

	return 0;
}
开发者ID:FTPiano,项目名称:psplinkusb,代码行数:8,代码来源:pspsh.C

示例14: gdb_rl_callback_handler_remove

void
gdb_rl_callback_handler_remove (void)
{
  gdb_assert (current_ui == main_ui);

  rl_callback_handler_remove ();
  callback_handler_installed = 0;
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:8,代码来源:event-top.c

示例15: ssc_input_remove_handler

void ssc_input_remove_handler(void)
{
#if USE_READLINE
  rl_callback_handler_remove();
#else
  /* nop */
#endif
  ssc_input_handler_f = NULL;
}
开发者ID:KerwinMa,项目名称:restcomm-ios-sdk,代码行数:9,代码来源:ssc_input.c


注:本文中的rl_callback_handler_remove函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。