]> code.delx.au - gnu-emacs/blobdiff - src/character.c
*** empty log message ***
[gnu-emacs] / src / character.c
index 5501d8eb13a5748629cffae67e291d334b153b26..b25aff8083c020adf8f249769ef51ac46e7970d5 100644 (file)
@@ -1,8 +1,8 @@
 /* Basic character support.
    Copyright (C) 1995, 1997, 1998, 2001 Electrotechnical Laboratory, JAPAN.
-   Licensed to the Free Software Foundation.
+     Licensed to the Free Software Foundation.
    Copyright (C) 2001 Free Software Foundation, Inc.
-   Copyright (C) 2001, 2002
+   Copyright (C) 2003
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
 
@@ -347,7 +347,7 @@ Tab is taken to occupy `tab-width' columns.  */)
 
 int
 c_string_width (str, len, precision, nchars, nbytes)
-     unsigned char *str;
+     const unsigned char *str;
      int precision, *nchars, *nbytes;
 {
   int i = 0, i_byte = 0;
@@ -418,8 +418,8 @@ lisp_string_width (string, precision, nchars, nbytes)
      Lisp_Object string;
      int precision, *nchars, *nbytes;
 {
-  int len = XSTRING (string)->size;
-  unsigned char *str = XSTRING (string)->data;
+  int len = SCHARS (string);
+  unsigned char *str = SDATA (string);
   int i = 0, i_byte = 0;
   int width = 0;
   struct Lisp_Char_Table *dp = buffer_display_table ();
@@ -534,7 +534,7 @@ This is now an obsolete function.  We keep it just for backward compatibility.
 
 int
 chars_in_text (ptr, nbytes)
-     unsigned char *ptr;
+     const unsigned char *ptr;
      int nbytes;
 {
   /* current_buffer is null at early stages of Emacs initialization.  */
@@ -552,10 +552,10 @@ chars_in_text (ptr, nbytes)
 
 int
 multibyte_chars_in_text (ptr, nbytes)
-     unsigned char *ptr;
+     const unsigned char *ptr;
      int nbytes;
 {
-  unsigned char *endp = ptr + nbytes;
+  const unsigned char *endp = ptr + nbytes;
   int chars = 0;
 
   while (ptr < endp)
@@ -579,15 +579,15 @@ multibyte_chars_in_text (ptr, nbytes)
 
 void
 parse_str_as_multibyte (str, len, nchars, nbytes)
-     unsigned char *str;
+     const unsigned char *str;
      int len, *nchars, *nbytes;
 {
-  unsigned char *endp = str + len;
+  const unsigned char *endp = str + len;
   int n, chars = 0, bytes = 0;
 
   if (len >= MAX_MULTIBYTE_LENGTH)
     {
-      unsigned char *adjusted_endp = endp - MAX_MULTIBYTE_LENGTH;
+      const unsigned char *adjusted_endp = endp - MAX_MULTIBYTE_LENGTH;
       while (str < adjusted_endp)
        {
          if ((n = MULTIBYTE_LENGTH_NO_CHECK (str)) > 0)
@@ -674,7 +674,7 @@ str_as_multibyte (str, len, nbytes, nchars)
        {
          while (n--)
            *to++ = *p++;
-       }         
+       }
       else
        {
          int c = *p++;
@@ -728,7 +728,7 @@ str_to_multibyte (str, len, bytes)
   endp = str + len;
   safe_bcopy ((char *) p, (char *) (endp - bytes), bytes);
   p = endp - bytes;
-  while (p < endp)      
+  while (p < endp)
     {
       int c = *p++;
 
@@ -761,7 +761,7 @@ str_as_unibyte (str, bytes)
       p += len;
     }
   to = str + (p - str);
-  while (p < endp)      
+  while (p < endp)
     {
       c = *p;
       len = BYTES_BY_CHAR_HEAD (c);
@@ -783,8 +783,8 @@ string_count_byte8 (string)
      Lisp_Object string;
 {
   int multibyte = STRING_MULTIBYTE (string);
-  int nbytes = STRING_BYTES (XSTRING (string));
-  unsigned char *p = XSTRING (string)->data;
+  int nbytes = SBYTES (string);
+  unsigned char *p = SDATA (string);
   unsigned char *pend = p + nbytes;
   int count = 0;
   int c, len;
@@ -813,8 +813,8 @@ Lisp_Object
 string_escape_byte8 (string)
      Lisp_Object string;
 {
-  int nchars = XSTRING (string)->size;
-  int nbytes = STRING_BYTES (XSTRING (string));
+  int nchars = SCHARS (string);
+  int nbytes = SBYTES (string);
   int multibyte = STRING_MULTIBYTE (string);
   int byte8_count;
   const unsigned char *src, *src_end;
@@ -838,9 +838,9 @@ string_escape_byte8 (string)
     /* Convert 1-byte sequence of byte8 chars to 4-byte octal.  */
     val = make_uninit_string (nbytes + byte8_count * 3);
 
-  src = XSTRING (string)->data;
+  src = SDATA (string);
   src_end = src + nbytes;
-  dst = XSTRING (val)->data;
+  dst = SDATA (val);
   if (multibyte)
     while (src < src_end)
       {
@@ -873,7 +873,7 @@ string_escape_byte8 (string)
 }
 
 \f
-DEFUN ("string", Fstring, Sstring, 1, MANY, 0,
+DEFUN ("string", Fstring, Sstring, 0, MANY, 0,
        doc: /*
 Concatenate all the argument characters and make the result a string.
 usage: (string &rest CHARACTERS)  */)