/[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.41 by gerd, Mon Jun 19 15:58:23 2000 UTC revision 1.41.16.1 by handa, Tue Aug 20 07:12:50 2002 UTC
# Line 222  Returns the abbrev symbol, if expansion Line 222  Returns the abbrev symbol, if expansion
222  {  {
223    register char *buffer, *p;    register char *buffer, *p;
224    int wordstart, wordend;    int wordstart, wordend;
225    register int wordstart_byte, wordend_byte, idx;    register int wordstart_byte, wordend_byte, idx, idx_byte;
226    int whitecnt;    int whitecnt;
227    int uccount = 0, lccount = 0;    int uccount = 0, lccount = 0;
228    register Lisp_Object sym;    register Lisp_Object sym;
229    Lisp_Object expansion, hook, tem;    Lisp_Object expansion, hook, tem;
230    Lisp_Object value;    Lisp_Object value;
231      int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
232    
233    value = Qnil;    value = Qnil;
234    
# Line 274  Returns the abbrev symbol, if expansion Line 275  Returns the abbrev symbol, if expansion
275    
276    p = buffer = (char *) alloca (wordend_byte - wordstart_byte);    p = buffer = (char *) alloca (wordend_byte - wordstart_byte);
277    
278    for (idx = wordstart_byte; idx < wordend_byte; idx++)    for (idx = wordstart, idx_byte = wordstart_byte; idx < wordend;)
279      {      {
280        /* ??? This loop needs to go by characters!  */        register int c;
281        register int c = FETCH_BYTE (idx);  
282          if (multibyte)
283            {
284              FETCH_CHAR_ADVANCE (c, idx, idx_byte);
285            }
286          else
287            {
288              c = FETCH_BYTE (idx_byte);
289              idx++, idx_byte++;
290            }
291    
292        if (UPPERCASEP (c))        if (UPPERCASEP (c))
293          c = DOWNCASE (c), uccount++;          c = DOWNCASE (c), uccount++;
294        else if (! NOCASEP (c))        else if (! NOCASEP (c))
295          lccount++;          lccount++;
296        *p++ = c;        if (multibyte)
297            p += CHAR_STRING (c, p);
298          else
299            *p++ = c;
300      }      }
301    
302    if (VECTORP (current_buffer->abbrev_table))    if (VECTORP (current_buffer->abbrev_table))
303      sym = oblookup (current_buffer->abbrev_table, buffer,      sym = oblookup (current_buffer->abbrev_table, buffer,
304                      wordend - wordstart, wordend_byte - wordstart_byte);                      wordend - wordstart, p - buffer);
305    else    else
306      XSETFASTINT (sym, 0);      XSETFASTINT (sym, 0);
307    if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))    if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
308      sym = oblookup (Vglobal_abbrev_table, buffer,      sym = oblookup (Vglobal_abbrev_table, buffer,
309                      wordend - wordstart, wordend_byte - wordstart_byte);                      wordend - wordstart, p - buffer);
310    if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))    if (INTEGERP (sym) || NILP (XSYMBOL (sym)->value))
311      return value;      return value;
312    

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.41.16.1

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