Ejemplo 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));
}
Ejemplo n.º 2
0
void play_sound_file(char *sound_file, int volume)
{
	int count = specpdl_depth();
	int input_fd;
	unsigned char buffer[CHUNKSIZE];
	int bytes_read;
	AudioContext ac = (AudioContext) 0;

	input_fd = open(sound_file, O_RDONLY);
	if (input_fd == -1)
		/* no error message -- this can't happen
		   because Fplay_sound_file has checked the
		   file for us. */
		return;

	record_unwind_protect(close_sound_file, make_int(input_fd));

	while ((bytes_read = read(input_fd, buffer, CHUNKSIZE)) > 0) {
		if (ac == (AudioContext) 0) {
			ac = audio_initialize(buffer, bytes_read, volume);
			if (ac == 0)
				return;
		} else {
			ac->ac_data = buffer;
			ac->ac_size = bytes_read;
		}
		play_internal(buffer, bytes_read, ac);
	}
	drain_audio_port(ac);
	unbind_to(count, Qnil);
}
Ejemplo n.º 3
0
void play_sound_data(unsigned char *data, int length, int volume)
{
	int count = specpdl_depth();
	AudioContext ac;

	ac = audio_initialize(data, length, volume);
	if (ac == (AudioContext) 0)
		return;
	play_internal(data, length, ac);
	drain_audio_port(ac);
	unbind_to(count, Qnil);
}
Ejemplo n.º 4
0
 NOSORT is useful if you plan to sort the result yourself.
If FILES-ONLY is the symbol t, then only the "files" in the directory
 will be returned; subdirectories will be excluded.  If FILES-ONLY is not
 nil and not t, then only the subdirectories will be returned.  Otherwise,
 if FILES-ONLY is nil (the default) then both files and subdirectories will
 be returned.
*/
       (directory, full, match, nosort, files_only))
{
  /* This function can GC */
  DIR *d;
  Lisp_Object list = Qnil;
  Bytecount directorylen;
  Lisp_Object handler;
  struct re_pattern_buffer *bufp = NULL;
  int speccount = specpdl_depth ();
  Ibyte *statbuf, *statbuf_tail;

  struct gcpro gcpro1, gcpro2;
  GCPRO2 (directory, list);

  /* If the file name has special constructs in it,
     call the corresponding file handler.  */
  handler = Ffind_file_name_handler (directory, Qdirectory_files);
  if (!NILP (handler))
    {
      UNGCPRO;
      if (!NILP (files_only))
	return call6 (handler, Qdirectory_files, directory, full, match,
		      nosort, files_only);
      else