/[emacs]/emacs/src/abbrev.c
ViewVC logotype

Diff of /emacs/src/abbrev.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.55 by raeburn, Mon Jul 15 00:00:35 2002 UTC revision 1.56 by handa, Tue Aug 20 07:07:19 2002 UTC
# Line 238  Returns the abbrev symbol, if expansion Line 238  Returns the abbrev symbol, if expansion
238  {  {
239    register char *buffer, *p;    register char *buffer, *p;
240    int wordstart, wordend;    int wordstart, wordend;
241    register int wordstart_byte, wordend_byte, idx;    register int wordstart_byte, wordend_byte, idx, idx_byte;
242    int whitecnt;    int whitecnt;
243    int uccount = 0, lccount = 0;    int uccount = 0, lccount = 0;
244    register Lisp_Object sym;    register Lisp_Object sym;
245    Lisp_Object expansion, hook, tem;    Lisp_Object expansion, hook, tem;
246    Lisp_Object value;    Lisp_Object value;
247      int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
248    
249    value = Qnil;    value = Qnil;
250    
# Line 289  Returns the abbrev symbol, if expansion Line 290  Returns the abbrev symbol, if expansion
290    
291    p = buffer = (char *) alloca (wordend_byte - wordstart_byte);    p = buffer = (char *) alloca (wordend_byte - wordstart_byte);
292    
293    for (idx = wordstart_byte; idx < wordend_byte; idx++)    for (idx = wordstart, idx_byte = wordstart_byte; idx < wordend; )
294      {      {
295        /* ??? This loop needs to go by characters!  */        register int c;
296        register int c = FETCH_BYTE (idx);  
297          if (multibyte)
298            {
299              FETCH_CHAR_ADVANCE (c, idx, idx_byte);
300            }
301          else
302            {
303              c = FETCH_BYTE (idx_byte);
304              idx++, idx_byte++;
305            }
306              
307        if (UPPERCASEP (c))        if (UPPERCASEP (c))
308          c = DOWNCASE (c), uccount++;          c = DOWNCASE (c), uccount++;
309        else if (! NOCASEP (c))        else if (! NOCASEP (c))
310          lccount++;          lccount++;
311        *p++ = c;        if (multibyte)
312            p += CHAR_STRING (c, p);
313          else
314            *p++ = c;
315      }      }
316    
317    if (VECTORP (current_buffer->abbrev_table))    if (VECTORP (current_buffer->abbrev_table))
318      sym = oblookup (current_buffer->abbrev_table, buffer,      sym = oblookup (current_buffer->abbrev_table, buffer,
319                      wordend - wordstart, wordend_byte - wordstart_byte);                      wordend - wordstart, p - buffer);
320    else    else
321      XSETFASTINT (sym, 0);      XSETFASTINT (sym, 0);
322    
323    if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym)))    if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym)))
324      sym = oblookup (Vglobal_abbrev_table, buffer,      sym = oblookup (Vglobal_abbrev_table, buffer,
325                      wordend - wordstart, wordend_byte - wordstart_byte);                      wordend - wordstart, p - buffer);
326    if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym)))    if (INTEGERP (sym) || NILP (SYMBOL_VALUE (sym)))
327      return value;      return value;
328    

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26