]> code.delx.au - gnu-emacs/blobdiff - src/casefiddle.c
(BITS_PER_CHAR, BITS_PER_INT, BITS_PER_SHORT)
[gnu-emacs] / src / casefiddle.c
index f4f2e2a9b52e29e4de3dfa42c3f32928162b791d..a208809ae2a179fa914ab6cb4b2a099b32d4ea4f 100644 (file)
@@ -5,7 +5,7 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -103,6 +103,8 @@ The argument object is not altered--the value is a copy.")
   return casify_object (CASE_CAPITALIZE, obj);
 }
 
+/* Like Fcapitalize but change only the initials.  */
+
 DEFUN ("upcase-initials", Fupcase_initials, Supcase_initials, 1, 1, 0,
   "Convert the initial of each word in the argument to upper case.\n\
 Do not change the other letters of each word.\n\
@@ -113,15 +115,6 @@ The argument object is not altered--the value is a copy.")
 {
   return casify_object (CASE_CAPITALIZE_UP, obj);
 }
-
-/* Like Fcapitalize but change only the initials.  */
-
-Lisp_Object
-upcase_initials (obj)
-     Lisp_Object obj;
-{
-  return casify_object (CASE_CAPITALIZE_UP, obj);
-}
 \f
 /* flag is CASE_UP, CASE_DOWN or CASE_CAPITALIZE or CASE_CAPITALIZE_UP.
    b and e specify range of buffer to operate on. */
@@ -133,16 +126,19 @@ casify_region (flag, b, e)
   register int i;
   register int c;
   register int inword = flag == CASE_DOWN;
+  int start, end;
 
   if (EQ (b, e))
     /* Not modifying because nothing marked */
     return;
 
   validate_region (&b, &e);
-  modify_region (current_buffer, XFASTINT (b), XFASTINT (e));
-  record_change (XFASTINT (b), XFASTINT (e) - XFASTINT (b));
+  start = XFASTINT (b);
+  end = XFASTINT (e);
+  modify_region (current_buffer, start, end);
+  record_change (start, end - start);
 
-  for (i = XFASTINT (b); i < XFASTINT (e); i++)
+  for (i = start; i < end; i++)
     {
       c = FETCH_CHAR (i);
       if (inword && flag != CASE_CAPITALIZE_UP)
@@ -155,9 +151,7 @@ casify_region (flag, b, e)
        inword = SYNTAX (c) == Sword;
     }
 
-  signal_after_change (XFASTINT (b),
-                      XFASTINT (e) - XFASTINT (b), 
-                      XFASTINT (e) - XFASTINT (b));
+  signal_after_change (start, end - start, end - start);
 }
 
 DEFUN ("upcase-region", Fupcase_region, Supcase_region, 2, 2, "r",
@@ -198,6 +192,8 @@ character positions to operate on.")
   return Qnil;
 }
 
+/* Like Fcapitalize_region but change only the initials.  */
+
 DEFUN ("upcase-initials-region", Fupcase_initials_region,
        Supcase_initials_region, 2, 2, "r",
   "Upcase the initial of each word in the region.\n\
@@ -210,16 +206,6 @@ character positions to operate on.")
   casify_region (CASE_CAPITALIZE_UP, b, e);
   return Qnil;
 }
-
-/* Like Fcapitalize_region but change only the initials.  */
-
-Lisp_Object
-upcase_initials_region (b, e)
-     Lisp_Object b, e;
-{
-  casify_region (CASE_CAPITALIZE_UP, b, e);
-  return Qnil;
-}
 \f
 Lisp_Object
 operate_on_word (arg, newpoint)
@@ -228,11 +214,13 @@ operate_on_word (arg, newpoint)
 {
   Lisp_Object val;
   int farend;
+  int iarg;
 
   CHECK_NUMBER (arg, 0);
-  farend = scan_words (point, XINT (arg));
+  iarg = XINT (arg);
+  farend = scan_words (point, iarg);
   if (!farend)
-    farend = XINT (arg) > 0 ? ZV : BEGV;
+    farend = iarg > 0 ? ZV : BEGV;
 
   *newpoint = point > farend ? point : farend;
   XSETFASTINT (val, farend);