comparison src/symbols.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 6728e641994e
children 79c6ff3eef26
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
172 } 172 }
173 return obarray; 173 return obarray;
174 } 174 }
175 175
176 Lisp_Object 176 Lisp_Object
177 intern_int (const Intbyte *str) 177 intern_int (const Ibyte *str)
178 { 178 {
179 Bytecount len = qxestrlen (str); 179 Bytecount len = qxestrlen (str);
180 Lisp_Object obarray = Vobarray; 180 Lisp_Object obarray = Vobarray;
181 181
182 if (!VECTORP (obarray) || XVECTOR_LENGTH (obarray) == 0) 182 if (!VECTORP (obarray) || XVECTOR_LENGTH (obarray) == 0)
190 190
191 return Fintern (make_string (str, len), obarray); 191 return Fintern (make_string (str, len), obarray);
192 } 192 }
193 193
194 Lisp_Object 194 Lisp_Object
195 intern (const CIntbyte *str) 195 intern (const CIbyte *str)
196 { 196 {
197 return intern_int ((Intbyte *) str); 197 return intern_int ((Ibyte *) str);
198 } 198 }
199 199
200 Lisp_Object 200 Lisp_Object
201 intern_converting_underscores_to_dashes (const CIntbyte *str) 201 intern_converting_underscores_to_dashes (const CIbyte *str)
202 { 202 {
203 Bytecount len = strlen (str); 203 Bytecount len = strlen (str);
204 CIntbyte *tmp = alloca_extbytes (len + 1); 204 CIbyte *tmp = alloca_extbytes (len + 1);
205 Bytecount i; 205 Bytecount i;
206 strcpy (tmp, str); 206 strcpy (tmp, str);
207 for (i = 0; i < len; i++) 207 for (i = 0; i < len; i++)
208 if (tmp[i] == '_') 208 if (tmp[i] == '_')
209 tmp[i] = '-'; 209 tmp[i] = '-';
210 return intern_int ((Intbyte *) tmp); 210 return intern_int ((Ibyte *) tmp);
211 } 211 }
212 212
213 DEFUN ("intern", Fintern, 1, 2, 0, /* 213 DEFUN ("intern", Fintern, 1, 2, 0, /*
214 Return the canonical symbol whose name is STRING. 214 Return the canonical symbol whose name is STRING.
215 If there is none, one is created by this function and returned. 215 If there is none, one is created by this function and returned.
352 return the index into OBARRAY that the string hashes to. 352 return the index into OBARRAY that the string hashes to.
353 353
354 Also store the bucket number in oblookup_last_bucket_number. */ 354 Also store the bucket number in oblookup_last_bucket_number. */
355 355
356 Lisp_Object 356 Lisp_Object
357 oblookup (Lisp_Object obarray, const Intbyte *ptr, Bytecount size) 357 oblookup (Lisp_Object obarray, const Ibyte *ptr, Bytecount size)
358 { 358 {
359 unsigned int hash, obsize; 359 unsigned int hash, obsize;
360 Lisp_Symbol *tail; 360 Lisp_Symbol *tail;
361 Lisp_Object bucket; 361 Lisp_Object bucket;
362 362
391 /* An excellent string hashing function. 391 /* An excellent string hashing function.
392 Adapted from glib's g_str_hash(). 392 Adapted from glib's g_str_hash().
393 Investigation by Karl Nelson <kenelson@ece.ucdavis.edu>. 393 Investigation by Karl Nelson <kenelson@ece.ucdavis.edu>.
394 Do a web search for "g_str_hash X31_HASH" if you want to know more. */ 394 Do a web search for "g_str_hash X31_HASH" if you want to know more. */
395 unsigned int 395 unsigned int
396 hash_string (const Intbyte *ptr, Bytecount len) 396 hash_string (const Ibyte *ptr, Bytecount len)
397 { 397 {
398 unsigned int hash; 398 unsigned int hash;
399 399
400 for (hash = 0; len; len--, ptr++) 400 for (hash = 0; len; len--, ptr++)
401 /* (31 * hash) will probably be optimized to ((hash << 5) - hash). */ 401 /* (31 * hash) will probably be optimized to ((hash << 5) - hash). */
3225 3225
3226 reinit_symbols_once_early (); 3226 reinit_symbols_once_early ();
3227 3227
3228 /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is 3228 /* Bootstrapping problem: Qnil isn't set when make_string_nocopy is
3229 called the first time. */ 3229 called the first time. */
3230 Qnil = Fmake_symbol (make_string_nocopy ((const Intbyte *) "nil", 3)); 3230 Qnil = Fmake_symbol (make_string_nocopy ((const Ibyte *) "nil", 3));
3231 XSTRING_PLIST (XSYMBOL (Qnil)->name) = Qnil; 3231 XSTRING_PLIST (XSYMBOL (Qnil)->name) = Qnil;
3232 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */ 3232 XSYMBOL (Qnil)->value = Qnil; /* Nihil ex nihil */
3233 XSYMBOL (Qnil)->plist = Qnil; 3233 XSYMBOL (Qnil)->plist = Qnil;
3234 3234
3235 Vobarray = make_vector (OBARRAY_SIZE, Qzero); 3235 Vobarray = make_vector (OBARRAY_SIZE, Qzero);
3284 len++; 3284 len++;
3285 } 3285 }
3286 for (i = 0; i < len; i++) 3286 for (i = 0; i < len; i++)
3287 if (temp[i] == '_') 3287 if (temp[i] == '_')
3288 temp[i] = '-'; 3288 temp[i] = '-';
3289 *location = Fintern (make_string ((const Intbyte *) temp, len), Qnil); 3289 *location = Fintern (make_string ((const Ibyte *) temp, len), Qnil);
3290 if (dump_p) 3290 if (dump_p)
3291 staticpro (location); 3291 staticpro (location);
3292 else 3292 else
3293 staticpro_nodump (location); 3293 staticpro_nodump (location);
3294 } 3294 }
3319 } 3319 }
3320 3320
3321 void 3321 void
3322 defsymbol_nodump (Lisp_Object *location, const char *name) 3322 defsymbol_nodump (Lisp_Object *location, const char *name)
3323 { 3323 {
3324 *location = Fintern (make_string_nocopy ((const Intbyte *) name, 3324 *location = Fintern (make_string_nocopy ((const Ibyte *) name,
3325 strlen (name)), 3325 strlen (name)),
3326 Qnil); 3326 Qnil);
3327 staticpro_nodump (location); 3327 staticpro_nodump (location);
3328 } 3328 }
3329 3329
3330 void 3330 void
3331 defsymbol (Lisp_Object *location, const char *name) 3331 defsymbol (Lisp_Object *location, const char *name)
3332 { 3332 {
3333 *location = Fintern (make_string_nocopy ((const Intbyte *) name, 3333 *location = Fintern (make_string_nocopy ((const Ibyte *) name,
3334 strlen (name)), 3334 strlen (name)),
3335 Qnil); 3335 Qnil);
3336 staticpro (location); 3336 staticpro (location);
3337 } 3337 }
3338 3338
3590 */ 3590 */
3591 if (initialized) 3591 if (initialized)
3592 sym = Fintern (build_string (symbol_name), Qnil); 3592 sym = Fintern (build_string (symbol_name), Qnil);
3593 else 3593 else
3594 #endif 3594 #endif
3595 sym = Fintern (make_string_nocopy ((const Intbyte *) symbol_name, 3595 sym = Fintern (make_string_nocopy ((const Ibyte *) symbol_name,
3596 strlen (symbol_name)), Qnil); 3596 strlen (symbol_name)), Qnil);
3597 3597
3598 XSYMBOL (sym)->value = wrap_pointer_1 (magic); 3598 XSYMBOL (sym)->value = wrap_pointer_1 (magic);
3599 } 3599 }
3600 3600