[gnu.gcc.bug] Problem while compiling emacs

barry@ADS.COM (Barry Lustig) (06/05/89)

Script started on Sun Jun  4 21:59:20 1989
deimos(43)-> gcc -O -Demacs    -fstrength-reduce -fcombine-regs -finline-functions -c window.c -v
gcc version 1.35.9
 /usr/local/gnu/lib/gcc-cpp -v -Demacs -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 window.c /tmp/cca27069.cpp
GNU CPP version 1.35.9
 /usr/local/gnu/lib/gcc-cc1 /tmp/cca27069.cpp -quiet -dumpbase window.c -fstrength-reduce -fcombine-regs -finline-functions -O -version -o /tmp/cca27069.s
GNU C version 1.35.9 (68k, MIT syntax) compiled by GNU C version 1.35.9.
window.c: In function replace_window:
window.c:418: warning: `replace_window' was declared implicitly `extern' and later `static'
window.c: In function unshow_buffer:
window.c:869: warning: `unshow_buffer' was declared implicitly `extern' and later `static'
window.c: In function save_window_save:
window.c:1801: warning: `save_window_save' was declared implicitly `extern' and later `static'
gcc: Program cc1 got fatal signal 11.
21.2u 1.3s 0:24 93% 208+224k 48+126io 2pf+0w



window.c
=======================================

# 1 "window.c"
 

# 1 "config.h" 1
 

 

 

# 1 "s-bsd4-2.h" 1
 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# 31 "config.h" 2

 

# 1 "m-sun3.h" 1
 

# 1 "m-sun2.h" 1
 

 

 

 

 

 

 

 

 

 

 

 

 

 

# 4 "m-sun3.h" 2

 

# 38 "config.h" 2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

# 23 "window.c" 2

# 1 "lisp.h" 1
 

 

 

enum Lisp_Type
  {
     
    Lisp_Int,

     
    Lisp_Symbol,

     
    Lisp_Marker,

     

    Lisp_String,

     

    Lisp_Vector,

     
    Lisp_Cons,

     
    Lisp_Object_Unused_1,

     

    Lisp_Buffer,

     

    Lisp_Subr,

     

    Lisp_Internal,

     

    Lisp_Intfwd,

     

    Lisp_Boolfwd,

     

    Lisp_Process,

     

    Lisp_Objfwd,

       
    Lisp_Object_Unused_2,

     

    Lisp_Internal_Stream,

     

    Lisp_Buffer_Local_Value,

     

    Lisp_Some_Buffer_Local_Value,

     

    Lisp_Buffer_Objfwd,

     

    Lisp_Void,

     

    Lisp_Window,

     
    Lisp_Window_Configuration
  };

# 223 "lisp.h"

 

 


 

 

 

 

 

 

 

# 384 "lisp.h"


 

struct Lisp_Cons
  {
    int  car, cdr;
  };

 

struct Lisp_Buffer_Cons
  {
    int  car, cdr;
    struct buffer *buffer;
    int bufpos;
  };

 

struct Lisp_String
  {
    int size;
    unsigned char data[1];
  };

struct Lisp_Vector
  {
    int size;
    struct Lisp_Vector *next;
    int  contents[1];
  };

 

struct Lisp_Symbol
  {
    struct Lisp_String *name;
    int  value;
    int  function;
    int  plist;
    struct Lisp_Symbol *next;	 
  };

struct Lisp_Subr
  {
    int  (*function) ();
    short min_args, max_args;
    char *symbol_name;
    char *prompt;
    char *doc;
  };

 

struct Lisp_Marker
  {
    struct buffer *buffer;
    int  chain;
    int bufpos;
    int modified;
  };

 

 

# 526 "lisp.h"

# 535 "lisp.h"

 


 

 

extern void defsubr ();

 


 

struct specbinding
  {
    int  symbol, old_value;
    int  (*func) ();
    int  unused;		 
  };

extern struct specbinding *specpdl;
extern struct specbinding *specpdl_ptr;
extern int specpdl_size;

struct handler
  {
    int  handler;
    int  var;
    struct catchtag *tag;
    struct handler *next;
  };

extern struct handler *handlerlist;

 

 


 

 

 

 

 

 


 

extern int consing_since_gc;

 

extern int gc_cons_threshold;

 

 

extern struct gcpro *gcprolist;

struct gcpro
  {
    struct gcpro *next;
    int  *var;		 
    int nvars;			 
  };

 

void staticpro();
  


 
extern int  Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
extern int  Qerror_conditions, Qerror_message, Qtop_level;
extern int  Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
extern int  Qvoid_variable, Qvoid_function;
extern int  Qsetting_constant, Qinvalid_read_syntax;
extern int  Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
extern int  Qend_of_file, Qarith_error;
extern int  Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;

extern int  Qintegerp, Qnatnump, Qsymbolp, Qlistp, Qconsp;
extern int  Qstringp, Qarrayp, Qsequencep, Qbufferp;
extern int  Qchar_or_string_p, Qmarkerp, Qvectorp;
extern int  Qinteger_or_marker_p, Qboundp, Qfboundp;
extern int  Qcdr;

extern int  Feq (), Fnull (), Flistp (), Fconsp (), Fatom (), Fnlistp ();
extern int  Fintegerp (), Fnatnump (), Fsymbolp ();
extern int  Fvectorp (), Fstringp (), Farrayp (), Fsequencep ();
extern int  Fbufferp (), Fmarkerp (), Fsubrp (), Fchar_or_string_p ();
extern int  Finteger_or_marker_p ();

extern int  Fcar (), Fcar_safe(), Fcdr (), Fcdr_safe();
extern int  Fsetcar (), Fsetcdr ();
extern int  Fboundp (), Ffboundp (), Fmakunbound (), Ffmakunbound ();
extern int  Fsymbol_function (), Fsymbol_plist (), Fsymbol_name ();
extern int  Ffset (), Fsetplist ();
extern int  Fsymbol_value (), Fset ();
extern int  Fdefault_value (), Fset_default ();

extern int  Faref (), Faset (), Farray_length ();

extern int  Fstring_to_int (), Fint_to_string ();
extern int  Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq (), Fneq (), Fzerop ();
extern int  Fplus (), Fminus (), Ftimes (), Fquo (), Frem (), Fmax (), Fmin ();
extern int  Flogand (), Flogior (), Flogxor (), Flognot (), Flsh (), Fash ();
extern int  Fadd1 (), Fsub1 ();

extern int  make_number ();
extern void args_out_of_range ();
extern void args_out_of_range_3 ();
extern int  wrong_type_argument ();

 
extern int  Qstring_lessp;
extern int  Vfeatures;
extern int  Fidentity (), Frandom ();
extern int  Flength ();
extern int  Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence ();
extern int  Fsubstring ();
extern int  Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
extern int  Frassq (), Fdelq (), Fsort ();
extern int  Freverse (), Fnreverse (), Fget (), Fput (), Fequal ();
extern int  Ffillarray (), Fnconc (), Fmapcar (), Fmapconcat ();
extern int  Fy_or_n_p (), Fyes_or_no_p ();
extern int  Ffeaturep (), Frequire () , Fprovide ();
extern int  concat2 (), nconc2 ();
extern int  assq_no_quit ();

 
extern int  Vpurify_flag;
extern int  Fcons (), Flist(), Fmake_list ();
extern int  Fmake_vector (), Fvector (), Fmake_symbol (), Fmake_marker ();
extern int  Fmake_string (), build_string (), make_string();
extern int  Fpurecopy (), make_pure_string ();
extern int  pure_cons (), make_pure_vector ();
extern int  Fgarbage_collect ();

 
extern int  Vprin1_to_string_buffer;
extern int  Fprin1 (), Fprin1_to_string (), Fprinc ();
extern int  Fterpri (), Fprint ();
extern int  Vstandard_output, Qstandard_output;
extern temp_output_buffer_setup (), temp_output_buffer_show ();

 
extern int  Qvariable_documentation, Qstandard_input;
extern int  Vobarray, Vstandard_input;
extern int  Fread (), Fread_from_string ();
extern int  Fintern (), Fintern_soft (), Fload ();
extern int  Fget_file_char (), Fread_char ();
extern int  Feval_current_buffer (), Feval_region ();
extern int  intern (), oblookup ();

 
extern int  Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
extern int  Vinhibit_quit, Vquit_flag;
extern int  Vmocklisp_arguments, Qmocklisp, Qmocklisp_arguments;
extern int  Vautoload_queue;
extern int  Fand (), For (), Fif (), Fprogn (), Fprog1 (), Fprog2 ();
extern int  Fsetq (), Fquote ();
extern int  Fuser_variable_p (), Finteractive_p ();
extern int  Fdefun (), Flet (), FletX (), Fwhile ();
extern int  Fcatch (), Fthrow (), Funwind_protect ();
extern int  Fcondition_case (), Fsignal ();
extern int  Ffunction_type (), Fautoload (), Fcommandp ();
extern int  Feval (), Fapply (), Ffuncall ();
extern int  Fglobal_set (), Fglobal_value (), Fbacktrace ();
extern int  apply1 (), call0 (), call1 (), call2 (), call3 ();
extern int  apply_lambda ();
extern int  internal_catch ();
extern int  internal_condition_case ();
extern void unbind_to ();
extern void error ();

 
extern int  Vprefix_arg, Qminus, Vcurrent_prefix_arg;
extern int  Fgoto_char ();
extern int  Fpoint_min_marker (), Fpoint_max_marker ();
extern int  Fpoint_min (), Fpoint_max ();
extern int  Fpoint (), Fpoint_marker (), Fmark_marker ();
extern int  Ffollchar (), Fprevchar (), Fchar_after (), Finsert ();
extern int  Feolp (), Feobp (), Fbolp (), Fbobp ();
extern int  Fformat (), format1 ();
extern int  Fbuffer_substring (), Fbuffer_string ();
extern int  Fstring_equal (), Fstring_lessp (), Fbuffer_substring_lessp ();
extern int  save_excursion_save (), save_restriction_save ();
extern int  save_excursion_restore (), save_restriction_restore ();
extern int  Fchar_to_string ();

 
extern int  Vbuffer_alist;
extern int  Fget_buffer (), Fget_buffer_create (), Fset_buffer ();
extern int  Fbarf_if_buffer_read_only ();
extern int  Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
extern int  Fother_buffer ();
extern struct buffer *all_buffers;

 

extern int  Fmarker_position (), Fmarker_buffer ();
extern int  Fcopy_marker ();

 

extern int  Qfile_error;
extern int  Ffile_name_as_directory ();
extern int  Fexpand_file_name (), Ffile_name_nondirectory ();
extern int  Fsubstitute_in_file_name ();
extern int  Ffile_symlink_p ();

 

extern int  Vfundamental_mode_abbrev_table;

 
extern unsigned char downcase_table[];
extern int  Fstring_match ();
extern int  Fscan_buffer ();

 

extern int  last_minibuf_string;
extern int  read_minibuf (), Fcompleting_read ();
extern int  Fread_from_minibuffer ();
extern int  Fread_variable ();
extern int  Fread_minibuffer (), Feval_minibuffer ();
extern int  Fread_string (), Fread_file_name ();
extern int  Fread_no_blanks_input ();

 

extern int  Vcommand_history;
extern int  Qcall_interactively;
extern int  Fcall_interactively ();
extern int  Fprefix_numeric_value ();

 

extern int  Fdowncase (), Fupcase (), Fcapitalize ();

 

extern int  Vhelp_form, Vtop_level;
extern int  Fdiscard_input (), Frecursive_edit ();
extern int  Fcommand_execute (), Finput_pending_p ();

 

extern int  Qkeymap;
extern int  Fkey_description (), Fsingle_key_description ();
extern int  Fwhere_is_internal ();
extern int  access_keymap (), store_in_keymap ();
extern int  get_keyelt (), get_keymap();

 
extern int  Fvertical_motion (), Findent_to (), Fcurrent_column ();

 
extern int  Qwindowp;
extern int  Fget_buffer_window ();
extern int  Fsave_window_excursion ();
extern int  Fset_window_configuration (), Fcurrent_window_configuration ();

 
extern int  decode_env_path ();
 
extern int noninteractive;
 
extern int inhibit_window_system;

 
extern int  Fget_process (), Fget_buffer_process (), Fprocessp ();
extern int  Fprocess_status (), Fkill_process ();

 
extern int  Vexec_path, Vexec_directory;

 
extern int  Vdoc_file_name;
extern int  Fsubstitute_command_keys ();
extern int  Fdocumentation (), Fdocumentation_property ();

 
extern int  Qbytecode;

 
extern int  Fexecute_kbd_macro ();

 

extern int initialized;

extern int immediate_quit;	     

extern void debugger ();

extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
extern long *xmalloc (), *xrealloc ();

# 24 "window.c" 2

# 1 "buffer.h" 1
 


struct buffer_text
  {
    unsigned char *p1;		 
    unsigned char *p2;		 
    int size1;			 
    int size2;			 
    int gap;			 
    int modified;		 
    int head_clip;		 
    int tail_clip;		 
    int pointloc;		 
  };

 
struct buffer
  {
     

     
    struct buffer_text text;
     
    struct buffer *next;
     

    int local_var_flags;
     
    int save_modified;
     

    int modtime;
     
    int auto_save_modified;
     

    int last_window_start;
     
    struct UndoData *undodata;
     
    struct Lisp_Vector *syntax_table_v;

     

     

    int  markers;

     

     
    int  name;
     
    int  filename;
     
    int  directory;
     

    int  backed_up;
     
    int  save_length;
     
    int  auto_save_file_name;
     
    int  read_only;
     
    int  mark;

     

    int  local_var_alist;

     
    int  major_mode;
     
    int  mode_name;
     
    int  mode_line_format;

     
    int  keymap;
     
    int  abbrev_table;

     

    int  case_fold_search;
    int  tab_width;
    int  fill_column;
    int  left_margin;
     
    int  auto_fill_hook;

     
    int  truncate_lines;
     
    int  ctl_arrow;
     

    int  selective_display;
     
    int  selective_display_ellipses;
     
    int  minor_modes;
     
    int  overwrite_mode;
     
    int  abbrev_mode;
};

extern struct buffer *bf_cur;		 

 

extern struct buffer_text bf_text;

 

extern struct buffer buffer_defaults;

 

extern struct buffer buffer_local_flags;

 

extern struct buffer buffer_local_symbols;

 

 

 

 

  
 

extern void reset_buffer ();
# 25 "window.c" 2

# 1 "window.h" 1
 

 

struct window
  {
     
    int size;
    struct Lisp_Vector *vec_next;
     
    int  next;
     
    int  prev;
     

    int  hchild, vchild;
     
    int  parent;
     

    int  left;
    int  top;
     
    int  height;
    int  width;
     
    int  buffer;
     
    int  start;
     

    int  pointm;
     

    int  force_start;
     

    int  hscroll;
     
    int  use_time;
     
    int  sequence_number;
     
    int  temslot;
     
    int  last_modified;
     
    int  last_point;
 
     
    int  last_point_x;
    int  last_point_y;
     
    int  last_mark_x;
    int  last_mark_y;
     

    int  window_end_pos;
     

    int  window_end_valid;
     

    int  window_end_vpos;
     
    int  redo_mode_line;
     

    int  start_at_line_beg;
  };

 

extern int  minibuf_window;

 

extern int  selected_window;

 

extern int  Vminibuf_scroll_window;

extern int  Fnext_window ();
extern int  Fselect_window ();
extern int  Fdisplay_buffer ();
extern int  Fset_window_buffer ();

extern char *minibuf_prompt;	 

extern char *minibuf_message;	 
				 

extern int RecurseDepth;	 

extern int MinibufDepth;	 

extern int RedoModes;		 

 

extern int beg_unchanged;

 

extern int end_unchanged;

 

extern int unchanged_modified;

 

extern int clip_changed;

 

extern int windows_or_buffers_changed;

 

extern int buffer_shared;
# 26 "window.c" 2

# 1 "commands.h" 1
 

 

extern struct Lisp_Vector *GlobalMap;
				 

extern struct Lisp_Vector *ESCmap;
				 

extern struct Lisp_Vector *CtlXmap;
				 

extern int  Vminibuffer_local_map;
				 

extern int  Vminibuffer_local_ns_map;
				 

 
extern int  Vminibuffer_local_completion_map;

 
extern int  Vminibuffer_local_must_match_map;

extern int last_command_char;	     

extern int unread_command_char;	 

 
extern int  last_command;

extern int immediate_quit;	     

extern int  Vexecuting_macro;

 

 

extern int RedoModes;

 

extern int cursor_in_echo_area;
# 27 "window.c" 2

# 1 "indent.h" 1
 

struct position
  {
    int bufpos;
    int hpos;
    int vpos;
    int prevhpos;
    int contin;
  };

struct position *compute_motion ();
struct position *vmotion ();
# 28 "window.c" 2

# 1 "termchar.h" 1
 

extern int baud_rate;		 
extern int screen_width;	 
extern int screen_height;	 
extern int must_write_spaces;	 

extern int min_padding_speed;	 
extern int fast_clear_end_of_line;  

extern int line_ins_del_ok;	 
extern int char_ins_del_ok;	 
extern int scroll_region_ok;	 
extern int memory_below_screen;	 
extern int fast_clear_end_of_line;  

extern int dont_calculate_costs;  
				 

 

extern int no_redraw_on_reenter;

 

extern int DC_ICcost[1 + 2 * 300 ];
# 29 "window.c" 2

int  Qwindowp;

int  Fnext_window (), Fdelete_window (), Fselect_window ();
int  Fset_window_buffer (), Fsplit_window (), Frecenter ();

 

int  minibuf_window;

 

int  selected_window;

 

int  Vminibuf_scroll_window;

 

int  Vtemp_buffer_show_hook;

 

int window_min_height;
int window_min_width;

 

int pop_up_windows;

 

int split_height_threshold;

 

int next_screen_context_lines;

 

static int sequence_number;

int   Fwindowp (); struct Lisp_Subr  Swindowp = { Fwindowp,  1,  1, "windowp",  0, 0}; int   Fwindowp 

  (obj)
     int  obj;
{
  return ((enum Lisp_Type) ((obj) >> 24 ))  == Lisp_Window ? Qt : Qnil;
}

static int 
make_window ()
{
  register int  val;
  register struct window *p;

   

  val = Fmake_vector (
    make_number ((sizeof (struct window) - sizeof (struct Lisp_Vector)
		  + sizeof (int ))
		 / sizeof (int )),
    Qnil);
  ((val)  =  ((val) & ((1<<24 ) - 1) )  | ((int)( Lisp_Window) << 24 )) ;
  p = ((struct window *) ((val) & ((1<<24 ) - 1) )  ) ;
  (p->sequence_number)  = ++sequence_number;
  (p->left)  = (p->top) 
    = (p->height)  = (p->width) 
      = (p->hscroll)  = 0;
  (p->last_point_x)  = (p->last_point_y)  = 0;
  p->start = Fmake_marker ();
  p->pointm = Fmake_marker ();
  (p->use_time)  = 0;
  return val;
}

int   Fselected_window (); struct Lisp_Subr  Sselected_window = { Fselected_window,  0,  0, "selected-window",  0, 0}; int   Fselected_window 

  ()
{
  return selected_window;
}

int   Fminibuffer_window (); struct Lisp_Subr  Sminibuffer_window = { Fminibuffer_window,  0,  0, "minibuffer-window",  0, 0}; int   Fminibuffer_window 

  ()
{
  return minibuf_window;
}

int   Fpos_visible_in_window_p (); struct Lisp_Subr 
  Spos_visible_in_window_p = { Fpos_visible_in_window_p,  0,  2, "pos-visible-in-window-p",  0, 0}; int   Fpos_visible_in_window_p 

  (pos, window)
     int  pos, window;
{
  register struct window *w;
  register int top;
  register int height;
  register int posint;
  register struct buffer_text *text;
  struct position posval;

  if ( ((pos)  == (Qnil) ) )
    posint = bf_text.pointloc ;
  else
    {
      { if (((enum Lisp_Type) (((pos)) >> 24 ))  == Lisp_Marker) (pos)  = marker_position (pos); else if (((enum Lisp_Type) (((pos)) >> 24 ))  != Lisp_Int) pos = wrong_type_argument (Qinteger_or_marker_p, (pos)); } ;
      posint = (((pos) << 32		-24 ) >> 32		-24 ) ;
    }

  if ( ((window)  == (Qnil) ) )
    window = selected_window;
  else
    { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;
  w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  top = marker_position (w->start);

  if (posint < top)
    return Qnil;

  height = (w->height)  - !((window)  == ( minibuf_window) ) ;

  bf_cur->text = bf_text;
  text = &((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) ->text;
  if ((w->last_modified)  >= text->modified)
    {
       

      if (posint < text->size1 + text->size2 + 1 - (w->window_end_pos) 
	  || ((w->window_end_vpos)  < height))
	return Qt;
      return Qnil;
    }
  else
    {
      if (posint > text->size1 + text->size2 + 1)
	return Qnil;
       
      posval = *compute_motion (top, 0, 0,
			       posint, height, 0,
			       (w->width)  - 1
			       - ((w->width)  + (w->left)  != (((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->width) ),

			       (((w->hscroll) << 32		-24 ) >> 32		-24 ) , 0);
      return posval.vpos < height ? Qt : Qnil;
    }
}

static struct window *
decode_window (window)
     register int  window;
{
  if ( ((window)  == (Qnil) ) )
    return ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ;

  { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;
  return ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
}

int   Fwindow_buffer (); struct Lisp_Subr  Swindow_buffer = { Fwindow_buffer,  0,  1, "window-buffer",  0, 0}; int   Fwindow_buffer 

  (window)
     int  window;
{
  return decode_window (window)->buffer;
}

int   Fwindow_height (); struct Lisp_Subr  Swindow_height = { Fwindow_height,  0,  1, "window-height",  0, 0}; int   Fwindow_height 

  (window)
     int  window;
{
  return decode_window (window)->height;
}

int   Fwindow_width (); struct Lisp_Subr  Swindow_width = { Fwindow_width,  0,  1, "window-width",  0, 0}; int   Fwindow_width 

  (window)
     int  window;
{
  register int w = decode_window (window)->width;
   

  if (w + decode_window (window)->left == screen_width)
    return w;
  return w - 1;
}

int   Fwindow_hscroll (); struct Lisp_Subr  Swindow_hscroll = { Fwindow_hscroll,  0,  1, "window-hscroll",  0, 0}; int   Fwindow_hscroll 

  (window)
     int  window;
{
  return decode_window (window)->hscroll;
}

int   Fset_window_hscroll (); struct Lisp_Subr  Sset_window_hscroll = { Fset_window_hscroll,  2,  2, "set-window-hscroll",  0, 0}; int   Fset_window_hscroll 

  (window, ncol)
     register int  window, ncol;
{
  register struct window *w;

  { if (((enum Lisp_Type) (((ncol)) >> 24 ))  != Lisp_Int) ncol = wrong_type_argument (Qintegerp, (ncol)); } ;
  if ((((ncol) << 32		-24 ) >> 32		-24 )  < 0) (ncol)  = 0;
  if ((ncol)  >= (1 << (16		 - 1)))
    args_out_of_range (ncol, Qnil);
  w = decode_window (window);
  if (w->hscroll != ncol)
    clip_changed = 1;		 
  w->hscroll = ncol;
  return ncol;
}

int   Fwindow_edges (); struct Lisp_Subr  Swindow_edges = { Fwindow_edges,  0,  1, "window-edges",  0, 0}; int   Fwindow_edges 

  (window)
     int  window;
{
  register struct window *w = decode_window (window);

  return Fcons (w->left, Fcons (w->top,
           Fcons (make_number ((w->left)  + (w->width) ),
		  Fcons (make_number ((w->top) 
				      + (w->height) ),
			 Qnil))));
}

int   Fwindow_point (); struct Lisp_Subr  Swindow_point = { Fwindow_point,  0,  1, "window-point",  0, 0}; int   Fwindow_point 
# 283 "window.c"
  (window)
     int  window;
{
  register struct window *w = decode_window (window);

  if (w == ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) 
      && bf_cur == ((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) )
    return Fpoint ();
  return Fmarker_position (w->pointm);
}

int   Fwindow_start (); struct Lisp_Subr  Swindow_start = { Fwindow_start,  0,  1, "window-start",  0, 0}; int   Fwindow_start 

  (window)
     int  window;
{
  return Fmarker_position (decode_window (window)->start);
}

int   Fset_window_point (); struct Lisp_Subr  Sset_window_point = { Fset_window_point,  2,  2, "set-window-point",  0, 0}; int   Fset_window_point 

  (window, pos)
     int  window, pos;
{
  register struct window *w = decode_window (window);

  { if (((enum Lisp_Type) (((pos)) >> 24 ))  == Lisp_Marker) (pos)  = marker_position (pos); else if (((enum Lisp_Type) (((pos)) >> 24 ))  != Lisp_Int) pos = wrong_type_argument (Qinteger_or_marker_p, (pos)); } ;
  if (w == ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) )
    Fgoto_char (pos);
  else
    Fset_marker (w->pointm, pos, w->buffer);
  return pos;
}

int   Fset_window_start (); struct Lisp_Subr  Sset_window_start = { Fset_window_start,  2,  3, "set-window-start",  0, 0}; int   Fset_window_start 

  (window, pos, noforce)
     int  window, pos, noforce;
{
  register struct window *w = decode_window (window);

  { if (((enum Lisp_Type) (((pos)) >> 24 ))  == Lisp_Marker) (pos)  = marker_position (pos); else if (((enum Lisp_Type) (((pos)) >> 24 ))  != Lisp_Int) pos = wrong_type_argument (Qinteger_or_marker_p, (pos)); } ;
  Fset_marker (w->start, pos, w->buffer);
   
  w->start_at_line_beg = Qnil;
  if ( ((noforce)  == (Qnil) ) )
    w->force_start = Qt;
  w->redo_mode_line = Qt;
  (w->last_modified)  = 0;
  return pos;
}

int   Fdelete_window (); struct Lisp_Subr  Sdelete_window = { Fdelete_window,  0,  1, "delete-window",  "", 0}; int   Fdelete_window 

  (window)
     register int  window;
{
  int osize;
  register int  tem, parent;
  register struct window *p;
  register struct window *par;

  if ( ((window)  == (Qnil) ) )
    window = selected_window;
  else
    { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;

  p = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  parent = p->parent;
  if ( ((parent)  == (Qnil) ) )
    error ("Attempt to delete minibuffer or sole ordinary window");
  par=((struct window *) ((parent) & ((1<<24 ) - 1) )  ) ;

  windows_or_buffers_changed++;

  if (((window)  == ( selected_window) ) )
    Fselect_window (Fnext_window (window, Qnil));

  tem = p->buffer;
   

  if (! ((tem)  == (Qnil) ) )
    {
      unshow_buffer (p);
      unchain_marker (p->pointm);
      unchain_marker (p->start);
    }

  tem = p->next;
  if (! ((tem)  == (Qnil) ) )
    ((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->prev = p->prev;

  tem = p->prev;
  if (! ((tem)  == (Qnil) ) )
    ((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->next = p->next;

  if (((window)  == ( par->hchild) ) )
    par->hchild = p->next;
  if (((window)  == ( par->vchild) ) )
    par->vchild = p->next;

   
  if (! ((par->vchild)  == (Qnil) ) )
    {
       
      osize = (par->height) ;
      (par->height) 
	-= (p->height) ;
      set_window_height (parent, osize, 1);
    }
  if (! ((par->hchild)  == (Qnil) ) )
    {
       
      osize = (par->width) ;
      (par->width) 
	-= (p->width) ;
      set_window_width (parent, osize, 1);
    }

   

  tem = par->hchild;
  if ( ((tem)  == (Qnil) ) )
    tem = par->vchild;
  if ( ((((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->next)  == (Qnil) ) )
    replace_window (parent, tem);
  return Qnil;
}

 
static
replace_window (old, replacement)
     int  old, replacement;
{
  register int  tem;
  register struct window *o = ((struct window *) ((old) & ((1<<24 ) - 1) )  ) , *p = ((struct window *) ((replacement) & ((1<<24 ) - 1) )  ) ;

  p->left = o->left;
  p->top = o->top;
  p->width = o->width;
  p->height = o->height;

  p->next = tem = o->next;
  if (! ((tem)  == (Qnil) ) )
    ((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->prev = replacement;

  p->prev = tem = o->prev;
  if (! ((tem)  == (Qnil) ) )
    ((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->next = replacement;

  p->parent = tem = o->parent;
  if (! ((tem)  == (Qnil) ) )
    {
      if (((((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->vchild)  == ( old) ) )
	((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->vchild = replacement;
      if (((((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->hchild)  == ( old) ) )
	((struct window *) ((tem) & ((1<<24 ) - 1) )  ) ->hchild = replacement;
    }

 

}

int   Fnext_window (); struct Lisp_Subr  Snext_window = { Fnext_window,  0,  2, "next-window",  0, 0}; int   Fnext_window 

  (window, mini)
     register int  window, mini;
{
  register int  tem;
  if ( ((window)  == (Qnil) ) )
    window = selected_window;
  else
    { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;
  do
    {
      while (tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->next,  ((tem)  == (Qnil) ) )
	if (tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->parent, ! ((tem)  == (Qnil) ) )
	  window = tem;
        else   
	  {
	    tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->prev;
	    break;
	  }
      window = tem;
      while (1)
	{
	  if (! ((((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->hchild)  == (Qnil) ) )
	    window = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->hchild;
	  else if (! ((((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->vchild)  == (Qnil) ) )
	    window = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->vchild;
	  else break;
	}
    }
  while (((window)  == ( minibuf_window) )  && !((mini)  == ( Qt) ) 
	 && (! ((mini)  == (Qnil) )  || !MinibufDepth));
  return window;
}

int   Fprevious_window (); struct Lisp_Subr  Sprevious_window = { Fprevious_window,  0,  1, "previous-window",  0, 0}; int   Fprevious_window 

  (window)
     register int  window;
{
  register int  tem;
  if ( ((window)  == (Qnil) ) )
    window = selected_window;
  else
    { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;
  do   
    {
      while (tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->prev,  ((tem)  == (Qnil) ) )
	if (tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->parent, ! ((tem)  == (Qnil) ) )
	  window = tem;
        else   
	  {
	    tem = minibuf_window;
	    break;
	  }
      window = tem;
      while (1)
	{
	  if (! ((((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->hchild)  == (Qnil) ) )
	    window = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->hchild;
	  else if (! ((((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->vchild)  == (Qnil) ) )
	    window = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->vchild;
	  else break;
	  while (tem = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->next, ! ((tem)  == (Qnil) ) )
	    window = tem;
	}
    }
  while (((window)  == ( minibuf_window) )  && !MinibufDepth);
  return window;
}

int   Fother_window (); struct Lisp_Subr  Sother_window = { Fother_window,  1,  1, "other-window",  "p", 0}; int   Fother_window 

  (n)
     register int  n;
{
  register int i;
  register int  w;

  { if (((enum Lisp_Type) (((n)) >> 24 ))  != Lisp_Int) n = wrong_type_argument (Qintegerp, (n)); } ;
  w = selected_window;
  i = (((n) << 32		-24 ) >> 32		-24 ) ;

  while (i > 0)
    {
      w = Fnext_window (w, Qnil);
      i--;
    }
  while (i < 0)
    {
      w = Fprevious_window (w);
      i++;
    }
  Fselect_window (w);
  return Qnil;
}

static int 
window_loop (type, obj)
     int type;
     register int  obj;
{
  register int  w, tem, ret_w;
  int  w1, start_w;
  register struct window *p, *q;

  w = minibuf_window;
  ret_w = Qnil;
  while (1)
    {
      p = ((struct window *) ((w) & ((1<<24 ) - 1) )  ) ;
      w1 = Fnext_window (w, Qt);
      if (!((w)  == ( minibuf_window) ) )
	switch (type)
	  {
	  case 1:
	    if (((struct buffer *) ((p->buffer) & ((1<<24 ) - 1) )  )  == ((struct buffer *) ((obj) & ((1<<24 ) - 1) )  ) )
	      return w;
	    break;

	  case 2:
	     
	    if (! ((obj)  == (Qnil) )  && (p->width)  != screen_width)
	      break;
	    if ( ((ret_w)  == (Qnil) )  ||
		(((struct window *) ((ret_w) & ((1<<24 ) - 1) )  ) ->use_time)  > (p->use_time) )
	      ret_w = w;
	    break;

	  case 3:
	    if (p != ((struct window *) ((obj) & ((1<<24 ) - 1) )  ) )
	      Fdelete_window (w);
	    break;

	  case 4:
	    if (((p->buffer)  == ( obj) ) )
	      {
		if ( ((p->parent)  == (Qnil) ) )
		  {
		    tem = Fother_buffer (obj);
		    if ( ((tem)  == (Qnil) ) )
		      tem = Fget_buffer_create (build_string ("*scratch*"));
		    Fset_window_buffer (w, tem);
		    Fset_buffer (p->buffer);
		  }
		else
		  Fdelete_window (w);
	      }
	    break;

	  case 5:
	    q = ((struct window *) ((ret_w) & ((1<<24 ) - 1) )  ) ;
	    if ( ((ret_w)  == (Qnil) )  ||
		((p->height)  * (p->width) )
		>
		((q->height)  * (q->width) ))
	      ret_w = w;
	    break;

	  case 6:
	    if (((p->buffer)  == ( obj) ) )
	      {
		tem = Fother_buffer (obj);
		if ( ((tem)  == (Qnil) ) )
		  tem = Fget_buffer_create (build_string ("*scratch*"));
		Fset_window_buffer (w, tem);
		Fset_buffer (p->buffer);
	      }
	    break;
	  }
      w = w1;
      if (((w)  == ( minibuf_window) ) )
	return ret_w;
    }
}     

int   Fget_lru_window (); struct Lisp_Subr  Sget_lru_window = { Fget_lru_window,  0,  0, "get-lru-window",  0, 0}; int   Fget_lru_window 

  ()
{
  register int  w;
   
  w = window_loop (2, Qt);
  if (! ((w)  == (Qnil) )  && !((w)  == ( selected_window) ) )
    return w;
   
  return window_loop (2, Qnil);
}

int   Fget_largest_window (); struct Lisp_Subr  Sget_largest_window = { Fget_largest_window,  0,  0, "get-largest-window",  0, 0}; int   Fget_largest_window 

  ()
{
  return window_loop (5, Qnil);
}

int   Fget_buffer_window (); struct Lisp_Subr  Sget_buffer_window = { Fget_buffer_window,  1,  1, "get-buffer-window",  0, 0}; int   Fget_buffer_window 

  (buffer)
     int  buffer;
{
  buffer = Fget_buffer (buffer);
  if (((enum Lisp_Type) ((buffer) >> 24 ))  == Lisp_Buffer)
    return window_loop (1, buffer);
  else return Qnil;
}

int   Fdelete_other_windows (); struct Lisp_Subr  Sdelete_other_windows = { Fdelete_other_windows, 
  0,  1, "delete-other-windows",  "", 0}; int   Fdelete_other_windows 

  (w)
     int  w;
{
  window_loop (3, ! ((w)  == (Qnil) )  ? w : selected_window);
  return Qnil;
}

int   Fdelete_windows_on (); struct Lisp_Subr  Sdelete_windows_on = { Fdelete_windows_on, 
  1,  1, "delete-windows-on",  "bDelete windows on (buffer): ", 0}; int   Fdelete_windows_on 

  (buffer)
     int  buffer;
{
  if (! ((buffer)  == (Qnil) ) )
    {
      buffer = Fget_buffer (buffer);
      { if (((enum Lisp_Type) (((buffer)) >> 24 ))  != Lisp_Buffer) buffer = wrong_type_argument (Qbufferp, (buffer)); } ;
      window_loop (4, buffer);
    }
  return Qnil;
}

int   Freplace_buffer_in_windows (); struct Lisp_Subr 
  Sreplace_buffer_in_windows = { Freplace_buffer_in_windows, 
  1,  1, "replace-buffer-in-windows",  "bReplace buffer in windows: ", 0}; int   Freplace_buffer_in_windows 

  (buffer)
     int  buffer;
{
  if (! ((buffer)  == (Qnil) ) )
    {
      buffer = Fget_buffer (buffer);
      { if (((enum Lisp_Type) (((buffer)) >> 24 ))  != Lisp_Buffer) buffer = wrong_type_argument (Qbufferp, (buffer)); } ;
      window_loop (6, buffer);
    }
  return Qnil;
}

 

set_window_height (window, height, nodelete)
     int  window;
     int height;
     int nodelete;
{
  register struct window *w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  register struct window *c;
  int oheight = (w->height) ;
  int top, pos, lastbot, opos, lastobot;
  int  child;

  if (window_min_height < 2)
    window_min_height = 2;

  if (!nodelete &&
      height < (((window)  == ( minibuf_window) )  ? 1 : window_min_height))
    {
      Fdelete_window (window);
      return;
    }

  (w->last_modified)  = 0;
  windows_or_buffers_changed++;
  (w->height)  = height;
  if (! ((w->hchild)  == (Qnil) ) )
    {
      for (child = w->hchild; ! ((child)  == (Qnil) ) ; child = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->next)
	{
	  ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->top = w->top;
	  set_window_height (child, height, nodelete);
	}
    }
  else if (! ((w->vchild)  == (Qnil) ) )
    {
      lastbot = top = (w->top) ;
      lastobot = 0;
      for (child = w->vchild; ! ((child)  == (Qnil) ) ; child = c->next)
	{
	  c = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ;

	  opos = lastobot + (c->height) ;

	  (c->top)  = lastbot;

	  pos = (((opos * height) << 1) + oheight) / (oheight << 1);

	   
	  set_window_height (child, pos + top - lastbot, 1);

	   

	  lastbot = pos + top, lastobot = opos;
	}
       
      if (!nodelete)
	for (child = w->vchild; ! ((child)  == (Qnil) ) ; child = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->next)
	  {
	    set_window_height (child, (((((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->height) << 32		-24 ) >> 32		-24 ) , 0);
	  }
    }
}

 

set_window_width (window, width, nodelete)
     int  window;
     int width;
     int nodelete;
{
  register struct window *w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  register struct window *c;
  int owidth = (w->width) ;
  int left, pos, lastright, opos, lastoright;
  int  child;

  if (!nodelete && width < window_min_width)
    {
      Fdelete_window (window);
      return;
    }

  (w->last_modified)  = 0;
  windows_or_buffers_changed++;
  (w->width)  = width;
  if (! ((w->vchild)  == (Qnil) ) )
    {
      for (child = w->vchild; ! ((child)  == (Qnil) ) ; child = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->next)
	{
	  ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->left = w->left;
	  set_window_width (child, width, nodelete);
	}
    }
  else if (! ((w->hchild)  == (Qnil) ) )
    {
      lastright = left = (w->left) ;
      lastoright = 0;
      for (child = w->hchild; ! ((child)  == (Qnil) ) ; child = c->next)
	{
	  c = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ;

	  opos = lastoright + (c->width) ;

	  (c->left)  = lastright;

	  pos = (((opos * width) << 1) + owidth) / (owidth << 1);

	   
	  set_window_width (child, pos + left - lastright, 1);

	   

	  lastright = pos + left, lastoright = opos;
	}
       
      if (!nodelete)
	for (child = w->hchild; ! ((child)  == (Qnil) ) ; child = ((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->next)
	  {
	    set_window_width (child, (((((struct window *) ((child) & ((1<<24 ) - 1) )  ) ->width) << 32		-24 ) >> 32		-24 ) , 0);
	  }
    }
}

static int window_select_count;

int   Fset_window_buffer (); struct Lisp_Subr  Sset_window_buffer = { Fset_window_buffer,  2,  2, "set-window-buffer",  0, 0}; int   Fset_window_buffer 

  (window, buffer)
     register int  window, buffer;
{
  register int  tem;
  register struct window *w = decode_window (window);

  buffer = Fget_buffer (buffer);
  { if (((enum Lisp_Type) (((buffer)) >> 24 ))  != Lisp_Buffer) buffer = wrong_type_argument (Qbufferp, (buffer)); } ;

  if ( ((((struct buffer *) ((buffer) & ((1<<24 ) - 1) )  ) ->name)  == (Qnil) ) )
    error ("Attempt to display deleted buffer");

  tem = w->buffer;
  if (! ((tem)  == (Qnil) ) )
    unshow_buffer (w);

  w->buffer = buffer;
  Fset_marker (w->pointm,
	       make_number (((struct buffer *) ((buffer) & ((1<<24 ) - 1) )  )  == bf_cur
			    ? bf_text.pointloc  : ((struct buffer *) ((buffer) & ((1<<24 ) - 1) )  ) ->text.pointloc),
	       buffer);
  Fset_marker (w->start, make_number (((struct buffer *) ((buffer) & ((1<<24 ) - 1) )  ) ->last_window_start),
	       buffer);
  w->start_at_line_beg = Qnil;
  (w->last_modified)  = 0;
  windows_or_buffers_changed++;
  if (((window)  == ( selected_window) ) )
    Fset_buffer (buffer);

  return Qnil;
}

 

static
unshow_buffer (w)
     register struct window *w;
{
  register int  buf;
  buf = w->buffer;

  if (((struct buffer *) ((buf) & ((1<<24 ) - 1) )  )  != ((struct Lisp_Marker *) ((w->pointm) & ((1<<24 ) - 1) )  ) ->buffer)
    abort ();

  if (w != ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) 
      && ((buf)  == ( ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->buffer) ) )
    return;

  if (((struct buffer *) ((buf) & ((1<<24 ) - 1) )  )  == bf_cur)
    {
      if (w != ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) )
	bf_text.pointloc  = marker_position (w->pointm);
    }
  else
    ((struct buffer *) ((buf) & ((1<<24 ) - 1) )  ) ->text.pointloc = 
      marker_position (w->pointm);
  ((struct buffer *) ((buf) & ((1<<24 ) - 1) )  ) ->last_window_start = 
    marker_position (w->start);
}

int   Fselect_window (); struct Lisp_Subr  Sselect_window = { Fselect_window,  1,  1, "select-window",  0, 0}; int   Fselect_window 

  (window)
     register int  window;
{
  register struct window *w;
  register struct window *ow = ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ;

  { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;

  w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;

  if ( ((w->buffer)  == (Qnil) ) )
    error ("Trying to select window with no buffer");

  (w->use_time)  = ++window_select_count;
  if (((window)  == ( selected_window) ) )
    return window;

  if (bf_cur == ((struct buffer *) ((ow->buffer) & ((1<<24 ) - 1) )  ) )
    Fset_marker (ow->pointm, make_number (bf_text.pointloc ), ow->buffer);

  selected_window = window;

  record_buffer (w->buffer);
  Fset_buffer (w->buffer);
  if (bf_cur == ((struct buffer *) ((ow->buffer) & ((1<<24 ) - 1) )  ) )
    {
       

       bf_text.pointloc  =  (marker_position (w->pointm));
      if (bf_text.pointloc  < bf_text.head_clip )
	bf_text.pointloc  = bf_text.head_clip ;
      if (bf_text.pointloc  > (bf_text.size1+bf_text.size2-bf_text.tail_clip)  + 1)
	bf_text.pointloc  = (bf_text.size1+bf_text.size2-bf_text.tail_clip)  + 1;
    }

  windows_or_buffers_changed++;

  return window;
}

int   Fdisplay_buffer (); struct Lisp_Subr  Sdisplay_buffer = { Fdisplay_buffer,  1,  2, "display-buffer",  0, 0}; int   Fdisplay_buffer 

  (buffer, notthiswindow)
     register int  buffer, notthiswindow;
{
  register int  window;

  buffer = Fget_buffer (buffer);
  { if (((enum Lisp_Type) (((buffer)) >> 24 ))  != Lisp_Buffer) buffer = wrong_type_argument (Qbufferp, (buffer)); } ;

  if ( ((notthiswindow)  == (Qnil) ) 
      && ((struct buffer *) ((((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->buffer) & ((1<<24 ) - 1) )  )  == ((struct buffer *) ((buffer) & ((1<<24 ) - 1) )  ) )
    return selected_window;

  window = Fget_buffer_window (buffer);
  if (! ((window)  == (Qnil) ) 
      && ( ((notthiswindow)  == (Qnil) )  || !((window)  == ( selected_window) ) ))
    return window;

  if (pop_up_windows)
    {
       
      if (window_min_height < 2)
	window_min_height = 2;
      if (split_height_threshold < window_min_height << 1)
	split_height_threshold = window_min_height << 1;

      window = Fget_largest_window ();
      if (window_height (window) >= split_height_threshold
	  &&
	  (((struct window *) ((window) & ((1<<24 ) - 1) )  ) ->width)  == screen_width)
	window = Fsplit_window (window, Qnil, Qnil);
      else
	{
	  window = Fget_lru_window ();
	  if ((((window)  == ( selected_window) ) 
	       || (((selected_window)  == ( minibuf_window) ) 
		   && ((window)  == ( ((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->prev) ) ))
	      && window_height (window) >= window_min_height << 1)
	    window = Fsplit_window (window, Qnil, Qnil);
	}
    }
  else
    window = Fget_lru_window ();

  Fset_window_buffer (window, buffer);
  return window;
}

temp_output_buffer_show (buf)
     register int  buf;
{
  register struct buffer *old = bf_cur;
  register int  window;
  register struct window *w;

  Fset_buffer (buf);
  ((struct buffer *) ((buf) & ((1<<24 ) - 1) )  ) ->save_modified = bf_text.modified ;
   bf_text.pointloc  =  (1);
  bf_text.head_clip  = 1;
  bf_text.tail_clip  = 0;
  clip_changed = 1;
  SetBfp (old);

  if (!((Vtemp_buffer_show_hook)  == ( Qnil) ) )
    call1 (Vtemp_buffer_show_hook, buf);
  else
    {
      window = Fdisplay_buffer (buf, Qnil);
      Vminibuf_scroll_window = window;
      w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
      (w->hscroll)  = 0;
      Fset_marker (w->start, make_number (1), buf);
      Fset_marker (w->pointm, make_number (1), buf);
    }
}

static
make_dummy_parent (window)
     int  window;
{
  register int  old, new;
  register struct window *o, *p;

  old = window;
  ((old)  =  ((old) & ((1<<24 ) - 1) )  | ((int)( Lisp_Vector) << 24 )) ;
  new = Fcopy_sequence (old);
  ((new)  =  ((new) & ((1<<24 ) - 1) )  | ((int)( Lisp_Window) << 24 )) ;

  o = ((struct window *) ((old) & ((1<<24 ) - 1) )  ) ;
  p = ((struct window *) ((new) & ((1<<24 ) - 1) )  ) ;
  (p->sequence_number)  = ++sequence_number;

   
  replace_window (window, new);

  o->next = Qnil;
  o->prev = Qnil;
  o->vchild = Qnil;
  o->hchild = Qnil;
  o->parent = new;

  p->start = Qnil;
  p->pointm = Qnil;
  p->buffer = Qnil;
}

int   Fsplit_window (); struct Lisp_Subr  Ssplit_window = { Fsplit_window,  0,  3, "split-window",  "", 0}; int   Fsplit_window 

  (window, chsize, horflag)
     int  window, chsize, horflag;
{
  register int  new;
  register struct window *o, *p;
  register int size;

  if ( ((window)  == (Qnil) ) )
    window = selected_window;
  else
    { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;

  o = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;

  if ( ((chsize)  == (Qnil) ) )
    {
      if (! ((horflag)  == (Qnil) ) )
	size = (o->width)  >> 1;
      else
	size = (o->height)  >> 1;
    }
  else
    {
      { if (((enum Lisp_Type) (((chsize)) >> 24 ))  != Lisp_Int) chsize = wrong_type_argument (Qintegerp, (chsize)); } ;
      size = (((chsize) << 32		-24 ) >> 32		-24 ) ;
    }

  if (((window)  == ( minibuf_window) ) )
    error ("Attempt to split minibuffer window");

  if ( ((horflag)  == (Qnil) ) )
    {
      if (window_min_height < 2)
	window_min_height = 2;

      if (size < window_min_height ||
	  size + window_min_height > (o->height) )
	args_out_of_range_3 (window, chsize, horflag);
      if ( ((o->parent)  == (Qnil) )  ||
	   ((((struct window *) ((o->parent) & ((1<<24 ) - 1) )  ) ->vchild)  == (Qnil) ) )
	{
	  make_dummy_parent (window);
	  new = o->parent;
	  ((struct window *) ((new) & ((1<<24 ) - 1) )  ) ->vchild = window;
	}
    }
  else
    {
      if (size < window_min_width ||
	  size + window_min_width > (o->width) )
	args_out_of_range_3 (window, chsize, horflag);
      if ( ((o->parent)  == (Qnil) )  ||
	   ((((struct window *) ((o->parent) & ((1<<24 ) - 1) )  ) ->hchild)  == (Qnil) ) )
	{
	  make_dummy_parent (window);
	  new = o->parent;
	  ((struct window *) ((new) & ((1<<24 ) - 1) )  ) ->hchild = window;
	}
    }

   

  windows_or_buffers_changed++;
  new = make_window ();
  p = ((struct window *) ((new) & ((1<<24 ) - 1) )  ) ;

  p->next = o->next;
  if (! ((p->next)  == (Qnil) ) )
    ((struct window *) ((p->next) & ((1<<24 ) - 1) )  ) ->prev = new;
  p->prev = window;
  o->next = new;
  p->parent = o->parent;

  Fset_window_buffer (new, o->buffer);

   

  if (! ((horflag)  == (Qnil) ) )
    {
      p->height = o->height;
      p->top = o->top;
      (p->width)  = (o->width)  - size;
      (o->width)  = size;
      (p->left)  = (o->left)  + size;
    }
  else
    {
      p->left = o->left;
      p->width = o->width;
      (p->height)  = (o->height)  - size;
      (o->height)  = size;
      (p->top)  = (o->top)  + size;
    }

  return new;
}

int   Fenlarge_window (); struct Lisp_Subr  Senlarge_window = { Fenlarge_window,  1,  2, "enlarge-window",  "p", 0}; int   Fenlarge_window 

  (n, side)
     register int  n, side;
{
  { if (((enum Lisp_Type) (((n)) >> 24 ))  != Lisp_Int) n = wrong_type_argument (Qintegerp, (n)); } ;
  change_window_height ((((n) << 32		-24 ) >> 32		-24 ) , ! ((side)  == (Qnil) ) );
  return Qnil;
}

int   Fshrink_window (); struct Lisp_Subr  Sshrink_window = { Fshrink_window,  1,  2, "shrink-window",  "p", 0}; int   Fshrink_window 

  (n, side)
     register int  n, side;
{
  { if (((enum Lisp_Type) (((n)) >> 24 ))  != Lisp_Int) n = wrong_type_argument (Qintegerp, (n)); } ;
  change_window_height (-(((n) << 32		-24 ) >> 32		-24 ) , ! ((side)  == (Qnil) ) );
  return Qnil;
}

int
window_height (window)
     int  window;
{
  register struct window *p = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  return (p->height) ;
}

int
window_width (window)
     int  window;
{
  register struct window *p = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  return (p->width) ;
}

 

change_window_height (delta, widthflag)
     register int delta;
     int widthflag;
{
  register int  parent;
  int  window;
  register struct window *p;
  int *sizep;
  int (*sizefun) () = widthflag ? window_width : window_height;
  register int (*setsizefun) () = widthflag ? set_window_width : set_window_height;

  if (window_min_height < 2)
    window_min_height = 2;

  window = selected_window;
  while (1)
    {
      p = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
      parent = p->parent;
      if ( ((parent)  == (Qnil) ) )
	{
	  if (widthflag)
	    error ("No other window to side of this one");
	  break;
	}
      if (widthflag ? ! ((((struct window *) ((parent) & ((1<<24 ) - 1) )  ) ->hchild)  == (Qnil) ) 
	  : ! ((((struct window *) ((parent) & ((1<<24 ) - 1) )  ) ->vchild)  == (Qnil) ) )
	break;
      window = parent;
    }

  sizep = &*(widthflag ? (int *) &p->width : (int *) &p->height) ;

  if (*sizep + delta < (widthflag ? window_min_width : (((window)  == ( minibuf_window) )  ? 1 : window_min_height)) )
    {
      Fdelete_window (window);
      return;
    }

  {
    register int maxdelta;
    register int  tem;

    maxdelta = (! ((parent)  == (Qnil) )  ? (*sizefun) (parent) - *sizep
		: (tem = (! ((p->next)  == (Qnil) )  ? p->next : p->prev),
		   (*sizefun) (tem) - (widthflag ? window_min_width : (((tem)  == ( minibuf_window) )  ? 1 : window_min_height)) ));

    if (delta > maxdelta)
       

      delta = maxdelta;
  }

  if (! ((p->next)  == (Qnil) )  &&
      (*sizefun) (p->next) - delta >= (widthflag ? window_min_width : (((p->next)  == ( minibuf_window) )  ? 1 : window_min_height)) )
    {
      (*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0);
      (*setsizefun) (window, *sizep + delta, 0);
      *(widthflag ? (int *) &((struct window *) ((p->next) & ((1<<24 ) - 1) )  ) ->left : (int *) &((struct window *) ((p->next) & ((1<<24 ) - 1) )  ) ->top)  += delta;
       

      (*setsizefun) (p->next, (*sizefun) (p->next), 0);
    }
  else if (! ((p->prev)  == (Qnil) )  &&
	   (*sizefun) (p->prev) - delta >= (widthflag ? window_min_width : (((p->prev)  == ( minibuf_window) )  ? 1 : window_min_height)) )
    {
      (*setsizefun) (p->prev, (*sizefun) (p->prev) - delta, 0);
      *(widthflag ? (int *) &p->left : (int *) &p->top)  -= delta;
      (*setsizefun) (window, *sizep + delta, 0);
    }
  else
    {
      register int delta1;
      register int opht = (*sizefun) (parent);

       

      if (opht <= *sizep + delta)
	delta1 = opht * opht * 2;
       

      else
	delta1 = (delta * opht * 100) / ((opht - *sizep - delta) * 100);

       

      *(widthflag ? (int *) &((struct window *) ((parent) & ((1<<24 ) - 1) )  ) ->width : (int *) &((struct window *) ((parent) & ((1<<24 ) - 1) )  ) ->height)  = opht + delta1;
      (*setsizefun) (window, *sizep + delta1, 0);

       

      (*setsizefun) (parent, opht, 0);
    }

  (p->last_modified)  = 0;
}


static
window_scroll (window, n)
     int  window;
     int n;
{
  register struct window *w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  register int opoint = bf_text.pointloc ;
  register int ht, pos;
  register int  tem;
  int lose;
  int  bolp;

  ht = (w->height)  - !((window)  == ( minibuf_window) ) ;

  (tem)  = bf_text.pointloc ;
  tem = Fpos_visible_in_window_p (tem, window);

  if ( ((tem)  == (Qnil) ) )
    {
      Fvertical_motion (make_number (- ht / 2));
      (tem)  = bf_text.pointloc ;
      Fset_marker (w->start, tem, w->buffer);
      w->force_start = Qt;
    }

   bf_text.pointloc  =  (marker_position (w->start));
  lose = n < 0 && bf_text.pointloc  == bf_text.head_clip ;
  Fvertical_motion (make_number (n));
  pos = bf_text.pointloc ;
  bolp = Fbolp ();
   bf_text.pointloc  =  (opoint);

  if (lose)
    Fsignal (Qbeginning_of_buffer, Qnil);

  if (pos < (bf_text.size1+bf_text.size2-bf_text.tail_clip)  + 1)
    {
      Fset_marker (w->start, make_number (pos), w->buffer);
      w->start_at_line_beg = bolp;
      w->redo_mode_line = Qt;
      (w->last_modified)  = 0;
      if (pos > opoint)
	 bf_text.pointloc  =  (pos);
      if (n < 0)
	{
	   bf_text.pointloc  =  (pos);
	  tem = Fvertical_motion (make_number (ht));
	  if (bf_text.pointloc  > opoint || (tem)  < ht)
	     bf_text.pointloc  =  (opoint);
	  else
	    Fvertical_motion (make_number (-1));
	}
    }
  else
    Fsignal (Qend_of_buffer, Qnil);
}

scroll_command (n, direction)
     register int  n;
     int direction;
{
  register int defalt
    = direction * (window_height (selected_window) - 1
		   - next_screen_context_lines);

  if ( ((n)  == (Qnil) ) )
    window_scroll (selected_window, defalt);
  else if (((n)  == ( Qminus) ) )
    window_scroll (selected_window, - defalt);
  else
    {
      n = Fprefix_numeric_value (n);
      window_scroll (selected_window, (((n) << 32		-24 ) >> 32		-24 )  * direction);
    }
}

int   Fscroll_up (); struct Lisp_Subr  Sscroll_up = { Fscroll_up,  0,  1, "scroll-up",  "P", 0}; int   Fscroll_up 

  (n)
     int  n;
{
  scroll_command (n, 1);
  return Qnil;
}

int   Fscroll_down (); struct Lisp_Subr  Sscroll_down = { Fscroll_down,  0,  1, "scroll-down",  "P", 0}; int   Fscroll_down 

  (n)
     int  n;
{
  scroll_command (n, -1);
  return Qnil;
}

int   Fscroll_left (); struct Lisp_Subr  Sscroll_left = { Fscroll_left,  1,  1, "scroll-left",  "P", 0}; int   Fscroll_left 

  (arg)
     register int  arg;
{
  if ( ((arg)  == (Qnil) ) )
    (arg)  = (((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->width)  - 2;
  else
    arg = Fprefix_numeric_value (arg);

  return Fset_window_hscroll (selected_window,
			      make_number ((((((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->hscroll) << 32		-24 ) >> 32		-24 ) 
					   + (((arg) << 32		-24 ) >> 32		-24 ) ));
}

int   Fscroll_right (); struct Lisp_Subr  Sscroll_right = { Fscroll_right,  1,  1, "scroll-right",  "P", 0}; int   Fscroll_right 

  (arg)
     register int  arg;
{
  if ( ((arg)  == (Qnil) ) )
    (arg)  = (((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->width)  - 2;
  else
    arg = Fprefix_numeric_value (arg);

  return Fset_window_hscroll (selected_window,
			      make_number ((((((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->hscroll) << 32		-24 ) >> 32		-24 ) 
					   - (((arg) << 32		-24 ) >> 32		-24 ) ));
}

int   Fscroll_other_window (); struct Lisp_Subr  Sscroll_other_window = { Fscroll_other_window,  0,  1, "scroll-other-window",  "P", 0}; int   Fscroll_other_window 

  (n)
     register int  n;
{
  register int  window;
  struct buffer *old = bf_cur;
  register int ht;
  register int opoint = bf_text.pointloc ;
  register struct window *w;

  if (((selected_window)  == ( minibuf_window) ) 
      && ! ((Vminibuf_scroll_window)  == (Qnil) ) )
    window = Vminibuf_scroll_window;
  else
    window = Fnext_window (selected_window, Qnil);
  { if (((enum Lisp_Type) (((window)) >> 24 ))  != Lisp_Window) window = wrong_type_argument (Qwindowp, (window)); } ;
  ht = window_height (window) - 1;

  if (((window)  == ( selected_window) ) )
    error ("There is no other window");

  w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;
  Fset_buffer (w->buffer);
   bf_text.pointloc  =  (marker_position (w->pointm));

  if ( ((n)  == (Qnil) ) )
    window_scroll (window, ht - next_screen_context_lines);
  else if (((n)  == ( Qminus) ) )
    window_scroll (window, next_screen_context_lines - ht);
  else
    {
      if (((enum Lisp_Type) ((n) >> 24 ))  == Lisp_Cons)
	n = Fcar (n);
      { if (((enum Lisp_Type) (((n)) >> 24 ))  != Lisp_Int) n = wrong_type_argument (Qintegerp, (n)); } ;
      window_scroll (window, (((n) << 32		-24 ) >> 32		-24 ) );
    }

  Fset_marker (w->pointm, make_number (bf_text.pointloc ), Qnil);
  SetBfp (old);
   bf_text.pointloc  =  (opoint);
  return Qnil;
}

int   Frecenter (); struct Lisp_Subr  Srecenter = { Frecenter,  0,  1, "recenter",  "P", 0}; int   Frecenter 

  (n)
     register int  n;
{
  register int ht = window_height (selected_window)
    - !((selected_window)  == ( minibuf_window) ) ;
  register struct window *w = ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ;
  register int opoint = bf_text.pointloc ;

  if ( ((n)  == (Qnil) ) )
    {
      extern int screen_garbaged;
      screen_garbaged++;
      (n)  = ht / 2;
    }
  else if (((enum Lisp_Type) ((n) >> 24 ))  == Lisp_Cons)  
    {
      (n)  = ht / 2;
    }
  else
    {
      n = Fprefix_numeric_value (n);
      { if (((enum Lisp_Type) (((n)) >> 24 ))  != Lisp_Int) n = wrong_type_argument (Qintegerp, (n)); } ;
    }

  if ((((n) << 32		-24 ) >> 32		-24 )  < 0)
     ((n) = ((n) & ~((1<<24 ) - 1) ) |  (( (((n) << 32		-24 ) >> 32		-24 )  + ht) & ((1<<24 ) - 1) )) ;

   ((n) = ((n) & ~((1<<24 ) - 1) ) |  (( - (((n) << 32		-24 ) >> 32		-24 ) ) & ((1<<24 ) - 1) )) ;

  Fvertical_motion (n);
  Fset_marker (w->start, make_number (bf_text.pointloc ), w->buffer);
  w->start_at_line_beg = Fbolp ();

   bf_text.pointloc  =  (opoint);
  w->force_start = Qt;

  return Qnil;
}

int   Fmove_to_window_line (); struct Lisp_Subr  Smove_to_window_line = { Fmove_to_window_line, 
  1,  1, "move-to-window-line",  "P", 0}; int   Fmove_to_window_line 

  (arg)
     register int  arg;
{
  register struct window *w = ((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ;
  register int height = (w->height) ;
  register int start;

  if (!((selected_window)  == ( minibuf_window) ) ) height--;

  if ( ((arg)  == (Qnil) ) )
    (arg)  = height / 2;
  else
    {
      arg = Fprefix_numeric_value (arg);
      if ((((arg) << 32		-24 ) >> 32		-24 )  < 0)
	 ((arg) = ((arg) & ~((1<<24 ) - 1) ) |  (( (((arg) << 32		-24 ) >> 32		-24 )  + height) & ((1<<24 ) - 1) )) ;
    }

  start = marker_position (w->start);
  if (start < bf_text.head_clip  || start > (bf_text.size1+bf_text.size2-bf_text.tail_clip)  + 1)
    {
      Fvertical_motion (make_number (- height / 2));
      Fset_marker (w->start, make_number (bf_text.pointloc ), w->buffer);
      w->start_at_line_beg = Fbolp ();
      w->force_start = Qt;
    }
  else
     bf_text.pointloc  =  (start);

  return Fvertical_motion (arg);
}

struct save_window_data
  {
    int size_from_Lisp_Vector_struct;
    struct Lisp_Vector *next_from_Lisp_Vector_struct;
    int  screen_width, screen_height;
    int  current_window;
    int  current_buffer;
    int  minibuf_scroll_window;
     
    int  saved_windows;
  };

 
struct saved_window
  {
     
    int size_from_Lisp_Vector_struct;
    struct Lisp_Vector *next_from_Lisp_Vector_struct;

    int  window;
    int  buffer, start, pointm, mark;
    int  left, top, width, height, hscroll;
    int  parent, prev;
    int  start_at_line_beg;
  };

int  
       Fset_window_configuration (); struct Lisp_Subr  Sset_window_configuration = {
       Fset_window_configuration, 
       1,  1, "set-window-configuration",  0, 0}; int  
       Fset_window_configuration 

     (arg)
     int  arg;
{
  register struct window *w;
  register struct save_window_data *data;
  struct Lisp_Vector *saved_windows;
  register struct saved_window *p;
  register int  tem;
  int  new_current_buffer;
  int k;

   
  int previous_screen_height = screen_height;
  int previous_screen_width = screen_width;
  int screen_size_change = 0;

  while (((enum Lisp_Type) ((arg) >> 24 ))  != Lisp_Window_Configuration)
    {
       

      arg = wrong_type_argument (intern ("window-configuration-p"), arg);
    }

  data = (struct save_window_data *) ((struct Lisp_Vector *) ((arg) & ((1<<24 ) - 1) )  ) ;
  saved_windows = ((struct Lisp_Vector *) ((data->saved_windows) & ((1<<24 ) - 1) )  ) ;

   
  if ((data->screen_height)  != screen_height
      || (data->screen_width)  != screen_width)
    {
      change_screen_size (data->screen_height, data->screen_width, 0);
      screen_size_change = 1;
    }

  windows_or_buffers_changed++;
  new_current_buffer = data->current_buffer;
  if ( ((((struct buffer *) ((new_current_buffer) & ((1<<24 ) - 1) )  ) ->name)  == (Qnil) ) )
    new_current_buffer = Qnil;

  for (k = 0; k < saved_windows->size; k++)
    {
      p = ((struct saved_window *) (((struct Lisp_Vector *) (((saved_windows)->contents[( k)]) & ((1<<24 ) - 1) )  ) )) ;
      w = ((struct window *) ((p->window) & ((1<<24 ) - 1) )  ) ;
      w->next = Qnil;

      if (! ((p->parent)  == (Qnil) ) )
	w->parent = ((struct saved_window *) (((struct Lisp_Vector *) (((saved_windows)->contents[( (p->parent) )]) & ((1<<24 ) - 1) )  ) )) ->window;
      else
	w->parent = Qnil;

      if (! ((p->prev)  == (Qnil) ) )
	{
	  w->prev = ((struct saved_window *) (((struct Lisp_Vector *) (((saved_windows)->contents[( (p->prev) )]) & ((1<<24 ) - 1) )  ) )) ->window;
	  ((struct window *) ((w->prev) & ((1<<24 ) - 1) )  ) ->next = p->window;
	}
      else
	{
	  w->prev = Qnil;
	  if (! ((w->parent)  == (Qnil) ) )
	    {
	      if (((p->width)  == ( ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->width) ) )
		{
		  ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->vchild = p->window;
		  ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->hchild = Qnil;
		}
	      else
		{
		  ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->hchild = p->window;
		  ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->vchild = Qnil;
		}
	    }
	}
      w->left = p->left;
      w->top = p->top;
      w->width = p->width;
      w->height = p->height;
      w->hscroll = p->hscroll;
      (w->last_modified)  = 0;

       
      if ( ((p->buffer)  == (Qnil) ) )
	w->buffer = p->buffer;
      else
	{
	  if (! ((((struct buffer *) ((p->buffer) & ((1<<24 ) - 1) )  ) ->name)  == (Qnil) ) )
	     
	    {
	      w->buffer = p->buffer;
	      w->start_at_line_beg = p->start_at_line_beg;
	      Fset_marker (w->start, Fmarker_position (p->start), w->buffer);
	      Fset_marker (w->pointm, Fmarker_position (p->pointm), w->buffer);
	      Fset_marker (((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) ->mark,
			   Fmarker_position (p->mark), w->buffer);

	      if (!((p->buffer)  == ( new_current_buffer) )  &&
		  ((struct buffer *) ((p->buffer) & ((1<<24 ) - 1) )  )  == bf_cur)
		Fgoto_char (w->pointm);
	    }
	  else if ( ((((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) ->name)  == (Qnil) ) )
	     
	    {
	      w->buffer = Fcdr (Fcar (Vbuffer_alist));
	       

	      Fset_marker (w->start, make_number (0), w->buffer);
	      Fset_marker (w->pointm, make_number (0), w->buffer);
	      w->start_at_line_beg = Qt;
	    }
	  else
	     
	    {
	       

	      if (((struct Lisp_Marker *) ((w->start) & ((1<<24 ) - 1) )  ) ->buffer == 0)
		Fset_marker (w->start, make_number (0), w->buffer);
	      if (((struct Lisp_Marker *) ((w->pointm) & ((1<<24 ) - 1) )  ) ->buffer == 0)
		Fset_marker (w->pointm,
			     make_number (((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  )  == bf_cur
					  ? bf_text.pointloc 
					  : ((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) ->text.pointloc),
			     w->buffer);
	      w->start_at_line_beg = Qt;
	    }
	}
    }

   
  if (screen_size_change)
    change_screen_size (previous_screen_height, previous_screen_width, 0);

  Fselect_window (data->current_window);
  if (! ((new_current_buffer)  == (Qnil) ) )
    Fset_buffer (new_current_buffer);
  else
    Fset_buffer (((struct window *) ((selected_window) & ((1<<24 ) - 1) )  ) ->buffer);
  Vminibuf_scroll_window = data->minibuf_scroll_window;
  return (Qnil);
}


static int
count_windows (window)
     register struct window *window;
{
  register int count = 1;
  if (! ((window->next)  == (Qnil) ) )
    count += count_windows (((struct window *) ((window->next) & ((1<<24 ) - 1) )  ) );
  if (! ((window->vchild)  == (Qnil) ) )
    count += count_windows (((struct window *) ((window->vchild) & ((1<<24 ) - 1) )  ) );
  if (! ((window->hchild)  == (Qnil) ) )
    count += count_windows (((struct window *) ((window->hchild) & ((1<<24 ) - 1) )  ) );
  return count;
}

int  
	Fcurrent_window_configuration (); struct Lisp_Subr  Scurrent_window_configuration = {
	Fcurrent_window_configuration,  0,  0, "current-window-configuration",  0, 0}; int  
	Fcurrent_window_configuration 

  ()
{
  register int  tem;
  register int n_windows;
  register struct save_window_data *data;
  register int i;

  n_windows = count_windows (((struct window *) ((((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->prev) & ((1<<24 ) - 1) )  ) );
  data = (struct save_window_data *)
           ((struct Lisp_Vector *) ((Fmake_vector (make_number (6 ),
				  Qnil)) & ((1<<24 ) - 1) )  ) ;
  (data->screen_width)  = screen_width;
  (data->screen_height)  = screen_height;
  data->current_window = selected_window;
  ((data->current_buffer) = ((int)( Lisp_Buffer) << 24 ) + ((int) ( bf_cur) & ((1<<24 ) - 1) )) ;
  data->minibuf_scroll_window = Vminibuf_scroll_window;
  tem = Fmake_vector (make_number (n_windows), Qnil);
  data->saved_windows = tem;
  for (i = 0; i < n_windows; i++)
    ((struct Lisp_Vector *) ((tem) & ((1<<24 ) - 1) )  ) ->contents[i]
      = Fmake_vector (make_number (13 ), Qnil);
  save_window_save (((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->prev,
		    ((struct Lisp_Vector *) ((tem) & ((1<<24 ) - 1) )  ) ,
		    0);
  ((tem) = ((int)( Lisp_Window_Configuration) << 24 ) + ((int) ( data) & ((1<<24 ) - 1) )) ;
  return (tem);
}

static int
save_window_save (window, vector, i)
     int  window;
     struct Lisp_Vector *vector;
     int i;
{
  register struct saved_window *p;
  register struct window *w;
  register int  tem;

  for (;! ((window)  == (Qnil) ) ; window = w->next)
    {
      p = ((struct saved_window *) (((struct Lisp_Vector *) (((vector)->contents[( i)]) & ((1<<24 ) - 1) )  ) )) ;
      w = ((struct window *) ((window) & ((1<<24 ) - 1) )  ) ;

      (w->temslot)  = i++;
      p->window = window;
      p->buffer = w->buffer;
      p->left = w->left;
      p->top = w->top;
      p->width = w->width;
      p->height = w->height;
      p->hscroll = w->hscroll;
      if (! ((w->buffer)  == (Qnil) ) )
	{
	  if (((window)  == ( selected_window) ) 
	      && ((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  )  == bf_cur)
	    p->pointm = Fpoint_marker ();
	  else
	    p->pointm = Fcopy_marker (w->pointm);

	  p->start = Fcopy_marker (w->start);
	  p->start_at_line_beg = w->start_at_line_beg;

	  tem = ((struct buffer *) ((w->buffer) & ((1<<24 ) - 1) )  ) ->mark;
	  p->mark = Fcopy_marker (tem);
	}
      else
	{
	  p->pointm = Qnil;
	  p->start = Qnil;
	  p->mark = Qnil;
	  p->start_at_line_beg = Qnil;
	}

      if ( ((w->parent)  == (Qnil) ) )
	p->parent = Qnil;
      else
	p->parent = ((struct window *) ((w->parent) & ((1<<24 ) - 1) )  ) ->temslot;

      if ( ((w->prev)  == (Qnil) ) )
	p->prev = Qnil;
      else
	p->prev = ((struct window *) ((w->prev) & ((1<<24 ) - 1) )  ) ->temslot;

      if (! ((w->vchild)  == (Qnil) ) )
	i = save_window_save (w->vchild, vector, i);
      if (! ((w->hchild)  == (Qnil) ) )
	i = save_window_save (w->hchild, vector, i);
    }

  return i;
}

int   Fsave_window_excursion (); struct Lisp_Subr  Ssave_window_excursion = { Fsave_window_excursion, 
  0,  -1 , "save-window-excursion",  0, 0}; int   Fsave_window_excursion 

  (args)
     int  args;
{
  register int  val;
  register int count = specpdl_ptr - specpdl;

  record_unwind_protect (Fset_window_configuration,
			 Fcurrent_window_configuration ());
  val = Fprogn (args);
  unbind_to (count);
  return val;
}

init_window_once ()
{
  extern int  get_minibuffer ();
  register int  root_window;

  root_window = make_window (0);
  minibuf_window = make_window (0);

  ((struct window *) ((root_window) & ((1<<24 ) - 1) )  ) ->next = minibuf_window;
  ((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->prev = root_window;

   

  (((struct window *) ((root_window) & ((1<<24 ) - 1) )  ) ->width)  = 10;
  (((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->width)  = 10;

  (((struct window *) ((root_window) & ((1<<24 ) - 1) )  ) ->height)  = 9;
  (((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->top)  = 9;
  (((struct window *) ((minibuf_window) & ((1<<24 ) - 1) )  ) ->height)  = 1;

  Fset_window_buffer (root_window, Fcurrent_buffer ());
  Fset_window_buffer (minibuf_window, get_minibuffer (0));

  selected_window = root_window;
}

syms_of_window ()
{
  Qwindowp = intern ("windowp");
  staticpro (&Qwindowp);

   
  staticpro (&minibuf_window);

  defvar_lisp ("temp-buffer-show-hook",  &Vtemp_buffer_show_hook) ;

  Vtemp_buffer_show_hook = Qnil;

  defvar_lisp ("minibuffer-scroll-window",  &Vminibuf_scroll_window) ;

  Vminibuf_scroll_window = Qnil;

  defvar_bool ("pop-up-windows",  &pop_up_windows) ;

  pop_up_windows = 1;

  defvar_int ("next-screen-context-lines",  &next_screen_context_lines) ;

  next_screen_context_lines = 2;

  defvar_int ("split-height-threshold",  &split_height_threshold) ;

  split_height_threshold = 500;

  defvar_int ("window-min-height",  &window_min_height) ;

  window_min_height = 4;

  defvar_int ("window-min-width",  &window_min_width) ;

  window_min_width = 10;

  defsubr (&Sselected_window);
  defsubr (&Sminibuffer_window);
  defsubr (&Swindowp);
  defsubr (&Spos_visible_in_window_p);
  defsubr (&Swindow_buffer);
  defsubr (&Swindow_height);
  defsubr (&Swindow_width);
  defsubr (&Swindow_hscroll);
  defsubr (&Sset_window_hscroll);
  defsubr (&Swindow_edges);
  defsubr (&Swindow_point);
  defsubr (&Swindow_start);
  defsubr (&Sset_window_point);
  defsubr (&Sset_window_start);
  defsubr (&Snext_window);
  defsubr (&Sprevious_window);
  defsubr (&Sother_window);
  defsubr (&Sget_lru_window);
  defsubr (&Sget_largest_window);
  defsubr (&Sget_buffer_window);
  defsubr (&Sdelete_other_windows);
  defsubr (&Sdelete_windows_on);
  defsubr (&Sreplace_buffer_in_windows);
  defsubr (&Sdelete_window);
  defsubr (&Sset_window_buffer);
  defsubr (&Sselect_window);
  defsubr (&Sdisplay_buffer);
  defsubr (&Ssplit_window);
  defsubr (&Senlarge_window);
  defsubr (&Sshrink_window);
  defsubr (&Sscroll_up);
  defsubr (&Sscroll_down);
  defsubr (&Sscroll_left);
  defsubr (&Sscroll_right);
  defsubr (&Sscroll_other_window);
  defsubr (&Srecenter);
  defsubr (&Smove_to_window_line);
  defsubr (&Sset_window_configuration);
  defsubr (&Scurrent_window_configuration);
  defsubr (&Ssave_window_excursion);
}

keys_of_window ()
{
  defkey (CtlXmap, '1', "delete-other-windows");
  defkey (CtlXmap, '2', "split-window");
  defkey (CtlXmap, '0', "delete-window");
  defkey (CtlXmap, 'o', "other-window");
  defkey (CtlXmap, '^', "enlarge-window");
  defkey (CtlXmap, '<', "scroll-left");
  defkey (CtlXmap, '>', "scroll-right");

  defkey (GlobalMap, (('V')&037) , "scroll-up");
  defkey (ESCmap, (('V')&037) , "scroll-other-window");
  defkey (ESCmap, 'v', "scroll-down");

  defkey (GlobalMap, (('L')&037) , "recenter");
  defkey (ESCmap, 'r', "move-to-window-line");
}