Esempio n. 1
0
static Lisp_Object
default_error_handler (Lisp_Object data)
{
  int speccount = specpdl_depth ();

  /* None of this is invoked, normally.  This code is almost identical
     to the `command-error' function, except `command-error' does cool
     tricks with sounds.  This function is a fallback, invoked if
     command-error is unavailable.  */

  Fding (Qnil, Qnil, Qnil);

  if (!NILP (Fboundp (Qerrors_deactivate_region))
      && !NILP (Fsymbol_value (Qerrors_deactivate_region)))
    zmacs_deactivate_region ();
  Fdiscard_input ();
  specbind (Qinhibit_quit, Qt);
  Vstandard_output = Qt;
  Vstandard_input = Qt;
  Vexecuting_macro = Qnil;
  Fset (intern ("last-error"), data);
  clear_echo_area (selected_frame (), Qnil, 0);
  Fdisplay_error (data, Qt);
  check_quit (); /* make Vquit_flag accurate */
  Vquit_flag = Qnil;
  return (unbind_to (speccount, Qt));
}
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;
}
Esempio n. 3
0
    invoked_continuation = c;
    invoked_continuation_ret = ret;
    invoked_continuation_ancestor = anc;

    DB (("invoke: calling continuation %p\n", c));
    grow_stack_and_invoke (c, &water_mark);
}

/* The continuations passed in from Fcall_cc () are actually closures
   around this subr. They have Qcontinuation bound to the primitive
   continuation object in their lexical environment */
DEFUN("primitive-invoke-continuation", Fprimitive_invoke_continuation,
      Sprimitive_invoke_continuation, (repv ret), rep_Subr1)
{
    repv cont = Fsymbol_value (Qcontinuation, Qnil);

    if (cont == rep_NULL || !rep_CONTINP(cont)
	|| (rep_CONTIN(cont)->car & CF_INVALID))
    {
	DEFSTRING (invalid, "invalid continuation");
	return Fsignal (Qerror, rep_LIST_1 (rep_VAL (&invalid)));
    }

    primitive_invoke_continuation (rep_CONTIN (cont), ret);
    return rep_NULL;
}

static repv
get_cont (repv arg)
{
Esempio n. 4
0
/* Called from main(). */
bool
sys_init(char *program_name)
{
    int argc;
    char **argv;
    repv head, *last;

    gtk_set_locale ();

    if (!batch_mode_p ())
	setpgid (0, 0);

    make_argv (Fcons (Fsymbol_value (Qprogram_name, Qt),
		      Fsymbol_value (Qcommand_line_args, Qt)), &argc, &argv);

    /* We need to initialise GTK now. The rep-gtk library will
       not reinitialise it.. */
    gtk_init (&argc, &argv);

    argc--; argv++;
    head = Qnil;
    last = &head;
    while(argc > 0)
    {
	*last = Fcons(rep_string_copy(*argv), Qnil);
	last = &rep_CDR(*last);
	argc--;
	argv++;
    }
    Fset (Qcommand_line_args, head);

    def_font_str = rep_VAL (&def_font_str_data);
#ifdef HAVE_X11
    get_resources (program_name);
#endif
    get_options ();
    use_options ();

    color_map = gdk_colormap_get_system ();
    gtk_meta_mod = gtk_find_meta ();

    /* Loading the gtk rep library will replace the usual
       event loop with one that works with GTK. */
    rep_INTERN(gtk_feature);
#if rep_INTERFACE >= 9
    Frequire (Qgtk_feature);
#else
    Fload (rep_string_copy ("gtk"), Qnil, Qnil, Qnil, Qnil);
#endif
    if (!rep_throw_value)
    {
	/* Find the gtkobj<->lispobj converters */
	gtk_jade_wrap_gtkobj = rep_find_dl_symbol (Qgtk_feature, "sgtk_wrap_gtkobj");
	gtk_jade_get_gtkobj = rep_find_dl_symbol (Qgtk_feature, "sgtk_get_gtkobj");
	gtk_jade_callback_postfix = rep_find_dl_symbol (Qgtk_feature, "sgtk_callback_postfix");
	assert (gtk_jade_wrap_gtkobj != 0
		&& gtk_jade_get_gtkobj != 0
		&& gtk_jade_callback_postfix != 0);
	return true;
    }
    else
	return false;
}