Ejemplo n.º 1
0
static char *
completion_generator (char *word, int state)
{
    if (state == 0)
    {
	repv fun = completion_fun;
	if (fun == Qnil)
	    /* backwards compatibility, ugh */
	    fun = Fsymbol_value (Qrl_completion_generator, Qt);
	if (Ffunctionp (fun) != Qnil)
	{
	    completions = (rep_call_with_barrier
			   (Ffuncall, rep_list_2 (fun, rep_string_dup (word)),
			    rep_TRUE, 0, 0, 0));
	}
	else
	{
	    repv re = Fquote_regexp (rep_string_dup (word));
	    repv boundp = Fsymbol_value (Qboundp, Qt);
	    completions = Fapropos (rep_concat2("^", rep_STR(re)),
				    boundp, Qnil);
	}
	if (completions == rep_NULL)
	    completions = Qnil;
    }

    if (completions != Qnil && rep_CONSP(completions)
	&& (rep_SYMBOLP(rep_CAR(completions))
	    || rep_STRINGP(rep_CAR(completions))))
    {
	repv string = rep_CAR(completions);
	if (rep_SYMBOLP(string))
	    string = rep_SYM(string)->name;
	completions = rep_CDR(completions);
	return strdup (rep_STR(string));
    }
    else
	return 0;
}
Ejemplo n.º 2
0
int gh_procedure_p(repv val)
{
    val = Ffunctionp (val);
    return val && val != Qnil;
}