unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* column int->float diff
@ 2002-05-30 20:37 Thien-Thi Nguyen
  0 siblings, 0 replies; only message in thread
From: Thien-Thi Nguyen @ 2002-05-30 20:37 UTC (permalink / raw)


please see below for changelog entry and diff prepared against
yesterday's cvs update for the first step in the "best possible
variable-width fonts support" changes.

i used /* iftc */ to mark casts used to maintain the "iso-functional
type contour", to distinguish them from other casts that may be around.

any suggestions on how to improve this would be greatly appreciated.

thi


______________________________________________________
YYYY-MM-DD  Thien-Thi Nguyen  <ttn@gnu.org>

	indent.c (last_known_column): Now a float.
	(current_column_1, position_indentation, current_column,
	string_display_width): Return float.
	(Fcurrent_column): Cast `current_column' return value to int.
	(Fcurrent_indentation): Cast `position_indentation' retval to int.
	(indented_beyond_p): Third arg now a float.
	(compute_motion, vmotion): Cast `indented_beyond_p' 3rd arg to float.

	lisp.h: Update `current_column' and `indented_beyond_p' signatures.

	bytecode.c, cmds.c, keymap.c, minibuf.c, xdisp.c:
	Cast `current_column' return value to int.

	xdisp.c: Cast `indented_beyond_p' 3rd arg to float.



Index: bytecode.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/bytecode.c,v
retrieving revision 1.68
diff -w -c -r1.68 bytecode.c
*** bytecode.c	20 Mar 2002 07:44:54 -0000	1.68
--- bytecode.c	30 May 2002 20:07:40 -0000
***************
*** 1352,1358 ****
  	  {
  	    Lisp_Object v1;
  	    BEFORE_POTENTIAL_GC ();
! 	    XSETFASTINT (v1, current_column ());
  	    AFTER_POTENTIAL_GC ();
  	    PUSH (v1);
  	    break;
--- 1352,1358 ----
  	  {
  	    Lisp_Object v1;
  	    BEFORE_POTENTIAL_GC ();
! 	    XSETFASTINT (v1, (int) current_column ()); /* iftc */
  	    AFTER_POTENTIAL_GC ();
  	    PUSH (v1);
  	    break;
Index: cmds.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/cmds.c,v
retrieving revision 1.86
diff -w -c -r1.86 cmds.c
*** cmds.c	22 Apr 2002 22:33:36 -0000	1.86
--- cmds.c	30 May 2002 20:07:41 -0000
***************
*** 299,308 ****
        && ! deleted_special
        && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n'))
      {
!       int column = current_column ();

        value = Fdelete_char (make_number (-XINT (n)), killflag);
!       i = column - current_column ();
        Finsert_char (make_number (' '), make_number (i), Qnil);
        /* Whitespace chars are ASCII chars, so we can simply subtract.  */
        SET_PT_BOTH (PT - i, PT_BYTE - i);
--- 299,308 ----
        && ! deleted_special
        && ! (PT == ZV || FETCH_BYTE (PT_BYTE) == '\n'))
      {
!       int column = (int) current_column (); /* iftc */

        value = Fdelete_char (make_number (-XINT (n)), killflag);
!       i = column - (int) current_column (); /* iftc */
        Finsert_char (make_number (' '), make_number (i), Qnil);
        /* Whitespace chars are ASCII chars, so we can simply subtract.  */
        SET_PT_BOTH (PT - i, PT_BYTE - i);
***************
*** 431,437 ****
  	      && ! (c2 == '\t'
  		    && XINT (current_buffer->tab_width) > 0
  		    && XFASTINT (current_buffer->tab_width) < 20
! 		    && (target_clm = (current_column ()
  				      + XINT (Fchar_width (make_number (c)))),
  			target_clm % XFASTINT (current_buffer->tab_width)))))
  	{
--- 431,437 ----
  	      && ! (c2 == '\t'
  		    && XINT (current_buffer->tab_width) > 0
  		    && XFASTINT (current_buffer->tab_width) < 20
! 		    && (target_clm = ((int) current_column () /* iftc */
  				      + XINT (Fchar_width (make_number (c)))),
  			target_clm % XFASTINT (current_buffer->tab_width)))))
  	{
Index: indent.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/indent.c,v
retrieving revision 1.151
diff -w -c -r1.151 indent.c
*** indent.c	25 Apr 2002 12:13:58 -0000	1.151
--- indent.c	30 May 2002 20:07:42 -0000
***************
*** 47,53 ****
     Some things in set last_known_column_point to -1
     to mark the memorized value as invalid.  */

! int last_known_column;

  /* Value of point when current_column was called.  */

--- 47,53 ----
     Some things in set last_known_column_point to -1
     to mark the memorized value as invalid.  */

! float last_known_column;

  /* Value of point when current_column was called.  */

***************
*** 57,64 ****

  int last_known_column_modified;

! static int current_column_1 P_ ((void));
! static int position_indentation P_ ((int));

  /* Cache of beginning of line found by the last call of
     current_column. */
--- 57,64 ----

  int last_known_column_modified;

! static float current_column_1 P_ ((void));
! static float position_indentation P_ ((int));

  /* Cache of beginning of line found by the last call of
     current_column. */
***************
*** 342,348 ****
       ()
  {
    Lisp_Object temp;
!   XSETFASTINT (temp, current_column ());
    return temp;
  }

--- 357,363 ----
       ()
  {
    Lisp_Object temp;
!   XSETFASTINT (temp, (int) current_column ()); /* iftc */
    return temp;
  }

***************
*** 354,360 ****
    last_known_column_point = 0;
  }

! int
  current_column ()
  {
    register int col;
--- 369,375 ----
    last_known_column_point = 0;
  }

! float
  current_column ()
  {
    register int col;
***************
*** 501,507 ****
     This function handles characters that are invisible
     due to text properties or overlays.  */

! static int
  current_column_1 ()
  {
    register int tab_width = XINT (current_buffer->tab_width);
--- 516,522 ----
     This function handles characters that are invisible
     due to text properties or overlays.  */

! static float
  current_column_1 ()
  {
    register int tab_width = XINT (current_buffer->tab_width);
***************
*** 651,657 ****
     If BEG is nil, that stands for the beginning of STRING.
     If END is nil, that stands for the end of STRING.  */

! static int
  string_display_width (string, beg, end)
       Lisp_Object string, beg, end;
  {
--- 666,672 ----
     If BEG is nil, that stands for the beginning of STRING.
     If END is nil, that stands for the end of STRING.  */

! static float
  string_display_width (string, beg, end)
       Lisp_Object string, beg, end;
  {
***************
*** 777,783 ****
  }

  \f
! static int position_indentation P_ ((int));

  DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
         0, 0, 0,
--- 792,798 ----
  }

  \f
! static float position_indentation P_ ((int));

  DEFUN ("current-indentation", Fcurrent_indentation, Scurrent_indentation,
         0, 0, 0,
***************
*** 791,802 ****

    scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);

!   XSETFASTINT (val, position_indentation (PT_BYTE));
    SET_PT_BOTH (opoint, opoint_byte);
    return val;
  }

! static int
  position_indentation (pos_byte)
       register int pos_byte;
  {
--- 806,817 ----

    scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);

!   XSETFASTINT (val, (int) position_indentation (PT_BYTE)); /* iftc */
    SET_PT_BOTH (opoint, opoint_byte);
    return val;
  }

! static float
  position_indentation (pos_byte)
       register int pos_byte;
  {
***************
*** 888,896 ****

  int
  indented_beyond_p (pos, pos_byte, column)
!      int pos, pos_byte, column;
  {
!   int val;
    int opoint = PT, opoint_byte = PT_BYTE;

    SET_PT_BOTH (pos, pos_byte);
--- 903,912 ----

  int
  indented_beyond_p (pos, pos_byte, column)
!      int pos, pos_byte;
!      float column;
  {
!   float val;
    int opoint = PT, opoint_byte = PT_BYTE;

    SET_PT_BOTH (pos, pos_byte);
***************
*** 899,905 ****

    val = position_indentation (PT_BYTE);
    SET_PT_BOTH (opoint, opoint_byte);
!   return val >= column;
  }
  \f
  DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
--- 915,921 ----

    val = position_indentation (PT_BYTE);
    SET_PT_BOTH (opoint, opoint_byte);
!   return val >= column;                 /* hmm, float comparison */
  }
  \f
  DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
***************
*** 1609,1615 ****
  	      else if (c == '\n')
  		{
  		  if (selective > 0
! 		      && indented_beyond_p (pos, pos_byte, selective))
  		    {
  		      /* If (pos == to), we don't have to take care of
  			 selective display.  */
--- 1625,1632 ----
  	      else if (c == '\n')
  		{
  		  if (selective > 0
! 		      && indented_beyond_p (pos, pos_byte,
!                                             (float) selective)) /* iftc */
  		    {
  		      /* If (pos == to), we don't have to take care of
  			 selective display.  */
***************
*** 1624,1630 ****
  			      pos_byte = CHAR_TO_BYTE (pos);
  			    }
  			  while (pos < to
! 				 && indented_beyond_p (pos, pos_byte, selective));
  			  /* Allow for the " ..." that is displayed for them. */
  			  if (selective_rlen)
  			    {
--- 1641,1648 ----
  			      pos_byte = CHAR_TO_BYTE (pos);
  			    }
  			  while (pos < to
! 				 && indented_beyond_p (pos, pos_byte,
!                                                        (float) selective)); /* iftc */
  			  /* Allow for the " ..." that is displayed for them. */
  			  if (selective_rlen)
  			    {
***************
*** 1874,1880 ****
  		 && ((selective > 0
  		      && indented_beyond_p (XFASTINT (prevline),
  					    CHAR_TO_BYTE (XFASTINT (prevline)),
! 					    selective))
  		     /* watch out for newlines with `invisible' property */
  		     || (propval = Fget_char_property (prevline,
  						       Qinvisible,
--- 1892,1898 ----
  		 && ((selective > 0
  		      && indented_beyond_p (XFASTINT (prevline),
  					    CHAR_TO_BYTE (XFASTINT (prevline)),
! 					    (float) selective)) /* iftc */
  		     /* watch out for newlines with `invisible' property */
  		     || (propval = Fget_char_property (prevline,
  						       Qinvisible,
***************
*** 1934,1940 ****
  	     && ((selective > 0
  		  && indented_beyond_p (XFASTINT (prevline),
  					CHAR_TO_BYTE (XFASTINT (prevline)),
! 					selective))
  		 /* watch out for newlines with `invisible' property */
  		 || (propval = Fget_char_property (prevline, Qinvisible,
  						   text_prop_object),
--- 1952,1958 ----
  	     && ((selective > 0
  		  && indented_beyond_p (XFASTINT (prevline),
  					CHAR_TO_BYTE (XFASTINT (prevline)),
! 					(float) selective)) /* iftc */
  		 /* watch out for newlines with `invisible' property */
  		 || (propval = Fget_char_property (prevline, Qinvisible,
  						   text_prop_object),
Index: keymap.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/keymap.c,v
retrieving revision 1.262
diff -w -c -r1.262 keymap.c
*** keymap.c	20 May 2002 08:06:00 -0000	1.262
--- keymap.c	30 May 2002 20:07:44 -0000
***************
*** 2925,2931 ****
       Lisp_Object definition, args;
  {
    register Lisp_Object tem1;
!   int column = current_column ();
    int description_column;

    /* If column 16 is no good, go to col 32;
--- 2925,2931 ----
       Lisp_Object definition, args;
  {
    register Lisp_Object tem1;
!   int column = (int) current_column (); /* iftc */
    int description_column;

    /* If column 16 is no good, go to col 32;
Index: lisp.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lisp.h,v
retrieving revision 1.422
diff -w -c -r1.422 lisp.h
*** lisp.h	27 May 2002 22:05:51 -0000	1.422
--- lisp.h	30 May 2002 20:07:46 -0000
***************
*** 2807,2815 ****
  EXFUN (Findent_to, 2);
  EXFUN (Fcurrent_column, 0);
  EXFUN (Fmove_to_column, 2);
! extern int current_column P_ ((void));
  extern void invalidate_current_column P_ ((void));
! extern int indented_beyond_p P_ ((int, int, int));
  extern void syms_of_indent P_ ((void));

  /* defined in window.c */
--- 2807,2815 ----
  EXFUN (Findent_to, 2);
  EXFUN (Fcurrent_column, 0);
  EXFUN (Fmove_to_column, 2);
! extern float current_column P_ ((void));
  extern void invalidate_current_column P_ ((void));
! extern int indented_beyond_p P_ ((int, int, float));
  extern void syms_of_indent P_ ((void));

  /* defined in window.c */
Index: minibuf.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/minibuf.c,v
retrieving revision 1.239
diff -w -c -r1.239 minibuf.c
*** minibuf.c	20 May 2002 08:06:21 -0000	1.239
--- minibuf.c	30 May 2002 20:07:47 -0000
***************
*** 582,588 ****
  			    Vminibuffer_prompt_properties, Qnil);
      }

!   minibuf_prompt_width = current_column ();

    /* If appropriate, copy enable-multibyte-characters into the minibuffer.  */
    if (inherit_input_method)
--- 582,588 ----
  			    Vminibuffer_prompt_properties, Qnil);
      }

!   minibuf_prompt_width = (int) current_column (); /* iftc */

    /* If appropriate, copy enable-multibyte-characters into the minibuffer.  */
    if (inherit_input_method)
Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.750
diff -w -c -r1.750 xdisp.c
*** xdisp.c	26 Apr 2002 23:39:05 -0000	1.750
--- xdisp.c	30 May 2002 20:07:55 -0000
***************
*** 3918,3924 ****
  	 are invisible.  */
        if (it->selective > 0
  	  && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
! 				it->selective))
  	visible_p = 0;
        else
  	{
--- 3918,3924 ----
  	 are invisible.  */
        if (it->selective > 0
  	  && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
! 				(float) it->selective)) /* iftc */
  	visible_p = 0;
        else
  	{
***************
*** 3978,3984 ****
    if (it->selective > 0)
      while (IT_CHARPOS (*it) < ZV
  	   && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
! 				 it->selective))
        {
  	xassert (FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
  	newline_found_p = forward_to_next_line_start (it, &skipped_p);
--- 3978,3984 ----
    if (it->selective > 0)
      while (IT_CHARPOS (*it) < ZV
  	   && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
! 				 (float) it->selective)) /* iftc */
        {
  	xassert (FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
  	newline_found_p = forward_to_next_line_start (it, &skipped_p);
***************
*** 4871,4877 ****
  		  && IT_CHARPOS (*it) + 1 < ZV
  		  && indented_beyond_p (IT_CHARPOS (*it) + 1,
  					IT_BYTEPOS (*it) + 1,
! 					it->selective))
  		{
  		  success_p = next_element_from_ellipsis (it);
  		  it->dpvec_char_len = -1;
--- 4871,4877 ----
  		  && IT_CHARPOS (*it) + 1 < ZV
  		  && indented_beyond_p (IT_CHARPOS (*it) + 1,
  					IT_BYTEPOS (*it) + 1,
! 					(float) it->selective)) /* iftc */
  		{
  		  success_p = next_element_from_ellipsis (it);
  		  it->dpvec_char_len = -1;
***************
*** 8586,8592 ****
        && !(PT == XFASTINT (w->last_point)
  	   && XFASTINT (w->last_modified) >= MODIFF
  	   && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
!       && XFASTINT (w->column_number_displayed) != current_column ())
      w->update_mode_line = Qt;

    FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1;
--- 8586,8593 ----
        && !(PT == XFASTINT (w->last_point)
  	   && XFASTINT (w->last_modified) >= MODIFF
  	   && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
!       && (XFASTINT (w->column_number_displayed)
!           != (int) current_column ()))  /* iftc */
      w->update_mode_line = Qt;

    FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1;
***************
*** 10170,10176 ****
        && !(PT == XFASTINT (w->last_point)
  	   && XFASTINT (w->last_modified) >= MODIFF
  	   && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
!       && XFASTINT (w->column_number_displayed) != current_column ())
      update_mode_line = 1;

    /* Count number of windows showing the selected buffer.  An indirect
--- 10171,10178 ----
        && !(PT == XFASTINT (w->last_point)
  	   && XFASTINT (w->last_modified) >= MODIFF
  	   && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
!       && (XFASTINT (w->column_number_displayed)
!           != (int) current_column ()))  /* iftc */
      update_mode_line = 1;

    /* Count number of windows showing the selected buffer.  An indirect
***************
*** 10599,10605 ****
         || INTEGERP (w->base_line_pos)
         /* Column number is displayed and different from the one displayed.  */
         || (!NILP (w->column_number_displayed)
! 	   && XFASTINT (w->column_number_displayed) != current_column ()))
         /* This means that the window has a mode line.  */
         && (WINDOW_WANTS_MODELINE_P (w)
  	   || WINDOW_WANTS_HEADER_LINE_P (w)))
--- 10601,10608 ----
         || INTEGERP (w->base_line_pos)
         /* Column number is displayed and different from the one displayed.  */
         || (!NILP (w->column_number_displayed)
! 	   && (XFASTINT (w->column_number_displayed)
!                != (int) current_column ()))) /* iftc */
         /* This means that the window has a mode line.  */
         && (WINDOW_WANTS_MODELINE_P (w)
  	   || WINDOW_WANTS_HEADER_LINE_P (w)))
***************
*** 14227,14233 ****

      case 'c':
        {
! 	int col = current_column ();
  	w->column_number_displayed = make_number (col);
  	pint2str (decode_mode_spec_buf, field_width, col);
  	return decode_mode_spec_buf;
--- 14230,14236 ----

      case 'c':
        {
! 	int col = (int) current_column (); /* iftc */
  	w->column_number_displayed = make_number (col);
  	pint2str (decode_mode_spec_buf, field_width, col);
  	return decode_mode_spec_buf;

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-30 20:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-30 20:37 column int->float diff Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).