示例#1
0
文件: zle_main.c 项目: Jaharmi/zsh
int
setup_(UNUSED(Module m))
{
    /* Set up editor entry points */
    zle_entry_ptr = zle_main_entry;
    zle_load_state = 1;

    /* initialise the thingies */
    init_thingies();
    lbindk = NULL;

    /* miscellaneous initialisations */
    stackhist = stackcs = -1;
    kungetbuf = (char *) zalloc(kungetsz = 32);
    comprecursive = 0;
    rdstrs = NULL;

    /* initialise the keymap system */
    init_keymaps();

    varedarg = NULL;

    incompfunc = incompctlfunc = hascompmod = 0;
    hascompwidgets = 0;

    clwords = (char **) zshcalloc((clwsize = 16) * sizeof(char *));

    return 0;
}
示例#2
0
struct _keymap* keymap_init(struct _xneur_handle *handle, Display *display)
{
	struct _keymap *p = (struct _keymap *) malloc(sizeof(struct _keymap));
	bzero(p, sizeof(struct _keymap));

	p->handle = handle;
	p->display = display;
	
	if (!locale_create() || !init_keymaps(p))
	{
		free(p);
		return NULL;
	}

	p->keycode_to_symbol_cache = (struct keycode_to_symbol_pair *)calloc(keycode_to_symbol_cache_size, sizeof(struct keycode_to_symbol_pair));
	p->symbol_to_keycode_cache = (struct symbol_to_keycode_pair *)calloc(symbol_to_keycode_cache_size, sizeof(struct symbol_to_keycode_pair));
	p->keycode_to_symbol_cache_pos = 0;
	p->symbol_to_keycode_cache_pos = 0;

	get_offending_modifiers(p);
	for (int i = 0; i < p->handle->total_languages; i++)
	{
		// FIXME Replace hardcode "us" to setting
		if (p->handle->languages[i].dir != NULL)
		{
			if (strcmp(p->handle->languages[i].dir, "us") == 0)
			{
				p->latin_group = i;
				//log_message(LOG, _("language dir %s"), p->handle->languages[i].dir);
			}
		}
	}
	
	p->purge_caches			= keymap_purge_caches;
	p->get_keysyms_by_string	= keymap_get_keysyms_by_string;
	p->keycode_to_symbol		= keymap_keycode_to_symbol;
	p->get_ascii			= keymap_get_ascii;
	p->get_cur_ascii_char		= keymap_get_cur_ascii_char;
	p->convert_text_to_ascii	= keymap_convert_text_to_ascii;
	p->lower_by_keymaps		= keymap_lower_by_keymaps;
	p->uninit			= keymap_uninit;

	return p;
}
示例#3
0
int
setup_(UNUSED(Module m))
{
    char **bpaste;

    /* Set up editor entry points */
    zle_entry_ptr = zle_main_entry;
    zle_load_state = 1;

    /* initialise the thingies */
    init_thingies();
    lbindk = NULL;

    /* miscellaneous initialisations */
    stackhist = stackcs = -1;
    kungetbuf = (char *) zalloc(kungetsz = 32);
    comprecursive = 0;
    rdstrs = NULL;

    /* initialise the keymap system */
    init_keymaps();

    varedarg = NULL;

    incompfunc = incompctlfunc = hascompmod = 0;
    hascompwidgets = 0;

    clwords = (char **) zshcalloc((clwsize = 16) * sizeof(char *));

    bpaste = zshcalloc(3*sizeof(char *));
    bpaste[0] = ztrdup("\033[?2004h");
    bpaste[1] = ztrdup("\033[?2004l");
    /* Intended to be global, no WARNCREATEGLOBAL check. */
    assignaparam("zle_bracketed_paste", bpaste, 0);

    return 0;
}