comparison src/dired.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 2b6fa2618f76
children a8d8f419b459
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
76 Lisp_Object list = Qnil; 76 Lisp_Object list = Qnil;
77 Bytecount directorylen; 77 Bytecount directorylen;
78 Lisp_Object handler; 78 Lisp_Object handler;
79 struct re_pattern_buffer *bufp = NULL; 79 struct re_pattern_buffer *bufp = NULL;
80 int speccount = specpdl_depth (); 80 int speccount = specpdl_depth ();
81 Intbyte *statbuf, *statbuf_tail; 81 Ibyte *statbuf, *statbuf_tail;
82 82
83 struct gcpro gcpro1, gcpro2; 83 struct gcpro gcpro1, gcpro2;
84 GCPRO2 (directory, list); 84 GCPRO2 (directory, list);
85 85
86 /* If the file name has special constructs in it, 86 /* If the file name has special constructs in it,
101 but earlier everywhere else? */ 101 but earlier everywhere else? */
102 directory = Fexpand_file_name (directory, Qnil); 102 directory = Fexpand_file_name (directory, Qnil);
103 directory = Ffile_name_as_directory (directory); 103 directory = Ffile_name_as_directory (directory);
104 directorylen = XSTRING_LENGTH (directory); 104 directorylen = XSTRING_LENGTH (directory);
105 105
106 statbuf = (Intbyte *) ALLOCA (directorylen + MAXNAMLEN + 1); 106 statbuf = (Ibyte *) ALLOCA (directorylen + MAXNAMLEN + 1);
107 memcpy (statbuf, XSTRING_DATA (directory), directorylen); 107 memcpy (statbuf, XSTRING_DATA (directory), directorylen);
108 statbuf_tail = statbuf + directorylen; 108 statbuf_tail = statbuf + directorylen;
109 109
110 /* XEmacs: this should come after Ffile_name_as_directory() to avoid 110 /* XEmacs: this should come after Ffile_name_as_directory() to avoid
111 potential regexp cache smashage. It comes before the opendir() 111 potential regexp cache smashage. It comes before the opendir()
166 continue; 166 continue;
167 } 167 }
168 168
169 { 169 {
170 Lisp_Object name = 170 Lisp_Object name =
171 make_string ((Intbyte *)dp->d_name, len); 171 make_string ((Ibyte *)dp->d_name, len);
172 if (!NILP (full)) 172 if (!NILP (full))
173 name = concat2 (directory, name); 173 name = concat2 (directory, name);
174 174
175 list = Fcons (name, list); 175 list = Fcons (name, list);
176 } 176 }
248 struct stat *st_addr) 248 struct stat *st_addr)
249 { 249 {
250 Bytecount len = NAMLEN (dp); 250 Bytecount len = NAMLEN (dp);
251 Bytecount pos = XSTRING_LENGTH (directory); 251 Bytecount pos = XSTRING_LENGTH (directory);
252 int value; 252 int value;
253 Intbyte *fullname = (Intbyte *) ALLOCA (len + pos + 2); 253 Ibyte *fullname = (Ibyte *) ALLOCA (len + pos + 2);
254 254
255 memcpy (fullname, XSTRING_DATA (directory), pos); 255 memcpy (fullname, XSTRING_DATA (directory), pos);
256 if (!IS_DIRECTORY_SEP (fullname[pos - 1])) 256 if (!IS_DIRECTORY_SEP (fullname[pos - 1]))
257 fullname[pos++] = DIRECTORY_SEP; 257 fullname[pos++] = DIRECTORY_SEP;
258 258
351 /* scmp() works in characters, not bytes, so we have to compute 351 /* scmp() works in characters, not bytes, so we have to compute
352 this value: */ 352 this value: */
353 Charcount cclen; 353 Charcount cclen;
354 int directoryp; 354 int directoryp;
355 int ignored_extension_p = 0; 355 int ignored_extension_p = 0;
356 Intbyte *d_name; 356 Ibyte *d_name;
357 357
358 dp = qxe_readdir (d); 358 dp = qxe_readdir (d);
359 if (!dp) break; 359 if (!dp) break;
360 360
361 /* Cast to Intbyte* is OK, as qxe_readdir() Mule-encapsulates. */ 361 /* Cast to Ibyte* is OK, as qxe_readdir() Mule-encapsulates. */
362 d_name = (Intbyte *) dp->d_name; 362 d_name = (Ibyte *) dp->d_name;
363 len = NAMLEN (dp); 363 len = NAMLEN (dp);
364 cclen = bytecount_to_charcount (d_name, len); 364 cclen = bytecount_to_charcount (d_name, len);
365 365
366 QUIT; 366 QUIT;
367 367
400 CHECK_STRING (elt); 400 CHECK_STRING (elt);
401 401
402 skip = cclen - string_char_length (elt); 402 skip = cclen - string_char_length (elt);
403 if (skip < 0) continue; 403 if (skip < 0) continue;
404 404
405 if (0 > scmp (charptr_n_addr (d_name, skip), 405 if (0 > scmp (itext_n_addr (d_name, skip),
406 XSTRING_DATA (elt), 406 XSTRING_DATA (elt),
407 string_char_length (elt))) 407 string_char_length (elt)))
408 { 408 {
409 ignored_extension_p = 1; 409 ignored_extension_p = 1;
410 break; 410 break;
445 NUNGCPRO; 445 NUNGCPRO;
446 } 446 }
447 else 447 else
448 { 448 {
449 Charcount compare = min (bestmatchsize, cclen); 449 Charcount compare = min (bestmatchsize, cclen);
450 Intbyte *p1 = XSTRING_DATA (bestmatch); 450 Ibyte *p1 = XSTRING_DATA (bestmatch);
451 Intbyte *p2 = d_name; 451 Ibyte *p2 = d_name;
452 Charcount matchsize = scmp (p1, p2, compare); 452 Charcount matchsize = scmp (p1, p2, compare);
453 453
454 if (matchsize < 0) 454 if (matchsize < 0)
455 matchsize = compare; 455 matchsize = compare;
456 if (completion_ignore_case) 456 if (completion_ignore_case)
487 /* If this directory all matches, 487 /* If this directory all matches,
488 see if implicit following slash does too. */ 488 see if implicit following slash does too. */
489 if (directoryp 489 if (directoryp
490 && compare == matchsize 490 && compare == matchsize
491 && bestmatchsize > matchsize 491 && bestmatchsize > matchsize
492 && IS_ANY_SEP (charptr_emchar_n (p1, matchsize))) 492 && IS_ANY_SEP (itext_ichar_n (p1, matchsize)))
493 matchsize++; 493 matchsize++;
494 bestmatchsize = matchsize; 494 bestmatchsize = matchsize;
495 } 495 }
496 } 496 }
497 qxe_closedir (d); 497 qxe_closedir (d);
557 return user_name_completion (partial_username, 1, NULL); 557 return user_name_completion (partial_username, 1, NULL);
558 } 558 }
559 559
560 struct user_name 560 struct user_name
561 { 561 {
562 Intbyte *ptr; 562 Ibyte *ptr;
563 Bytecount len; 563 Bytecount len;
564 }; 564 };
565 565
566 struct user_cache 566 struct user_cache
567 { 567 {
647 { 647 {
648 QUIT; 648 QUIT;
649 DO_REALLOC (user_cache.user_names, user_cache.size, 649 DO_REALLOC (user_cache.user_names, user_cache.size,
650 user_cache.length + 1, struct user_name); 650 user_cache.length + 1, struct user_name);
651 user_cache.user_names[user_cache.length].ptr = 651 user_cache.user_names[user_cache.length].ptr =
652 (Intbyte *) xstrdup (pwd->pw_name); 652 (Ibyte *) xstrdup (pwd->pw_name);
653 user_cache.user_names[user_cache.length].len = strlen (pwd->pw_name); 653 user_cache.user_names[user_cache.length].len = strlen (pwd->pw_name);
654 user_cache.length++; 654 user_cache.length++;
655 } 655 }
656 #else 656 #else
657 if (xNetUserEnum) 657 if (xNetUserEnum)
715 EMACS_GET_TIME (user_cache.last_rebuild_time); 715 EMACS_GET_TIME (user_cache.last_rebuild_time);
716 } 716 }
717 717
718 for (i = 0; i < user_cache.length; i++) 718 for (i = 0; i < user_cache.length; i++)
719 { 719 {
720 Intbyte *u_name = user_cache.user_names[i].ptr; 720 Ibyte *u_name = user_cache.user_names[i].ptr;
721 Bytecount len = user_cache.user_names[i].len; 721 Bytecount len = user_cache.user_names[i].len;
722 /* scmp() works in chars, not bytes, so we have to compute this: */ 722 /* scmp() works in chars, not bytes, so we have to compute this: */
723 Charcount cclen = bytecount_to_charcount (u_name, len); 723 Charcount cclen = bytecount_to_charcount (u_name, len);
724 724
725 QUIT; 725 QUIT;
749 NUNGCPRO; 749 NUNGCPRO;
750 } 750 }
751 else 751 else
752 { 752 {
753 Charcount compare = min (bestmatchsize, cclen); 753 Charcount compare = min (bestmatchsize, cclen);
754 Intbyte *p1 = XSTRING_DATA (bestmatch); 754 Ibyte *p1 = XSTRING_DATA (bestmatch);
755 Intbyte *p2 = u_name; 755 Ibyte *p2 = u_name;
756 Charcount matchsize = scmp_1 (p1, p2, compare, 0); 756 Charcount matchsize = scmp_1 (p1, p2, compare, 0);
757 757
758 if (matchsize < 0) 758 if (matchsize < 0)
759 matchsize = compare; 759 matchsize = compare;
760 760
774 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); 774 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
775 } 775 }
776 776
777 777
778 Lisp_Object 778 Lisp_Object
779 make_directory_hash_table (const Intbyte *path) 779 make_directory_hash_table (const Ibyte *path)
780 { 780 {
781 DIR *d; 781 DIR *d;
782 if ((d = qxe_opendir (path))) 782 if ((d = qxe_opendir (path)))
783 { 783 {
784 DIRENTRY *dp; 784 DIRENTRY *dp;
787 787
788 while ((dp = qxe_readdir (d))) 788 while ((dp = qxe_readdir (d)))
789 { 789 {
790 Bytecount len = NAMLEN (dp); 790 Bytecount len = NAMLEN (dp);
791 if (DIRENTRY_NONEMPTY (dp)) 791 if (DIRENTRY_NONEMPTY (dp))
792 /* Cast to Intbyte* is OK, as qxe_readdir() Mule-encapsulates. */ 792 /* Cast to Ibyte* is OK, as qxe_readdir() Mule-encapsulates. */
793 Fputhash (make_string ((Intbyte *) dp->d_name, len), Qt, hash); 793 Fputhash (make_string ((Ibyte *) dp->d_name, len), Qt, hash);
794 } 794 }
795 qxe_closedir (d); 795 qxe_closedir (d);
796 return hash; 796 return hash;
797 } 797 }
798 else 798 else
865 directory = Ffile_name_directory (filename); 865 directory = Ffile_name_directory (filename);
866 #endif 866 #endif
867 867
868 #if 0 /* #### shouldn't this apply to WIN32_NATIVE and maybe CYGWIN? */ 868 #if 0 /* #### shouldn't this apply to WIN32_NATIVE and maybe CYGWIN? */
869 { 869 {
870 Intbyte *tmpnam = XSTRING_DATA (Ffile_name_nondirectory (filename)); 870 Ibyte *tmpnam = XSTRING_DATA (Ffile_name_nondirectory (filename));
871 Bytecount l = qxestrlen (tmpnam); 871 Bytecount l = qxestrlen (tmpnam);
872 872
873 if (l >= 5 873 if (l >= 5
874 && S_ISREG (s.st_mode) 874 && S_ISREG (s.st_mode)
875 && (qxestrcasecmp (&tmpnam[l - 4], ".com") == 0 || 875 && (qxestrcasecmp (&tmpnam[l - 4], ".com") == 0 ||
905 /* If the size is out of range, give back -1. */ 905 /* If the size is out of range, give back -1. */
906 /* #### Fix when Emacs gets bignums! */ 906 /* #### Fix when Emacs gets bignums! */
907 if (XINT (values[7]) != s.st_size) 907 if (XINT (values[7]) != s.st_size)
908 values[7] = make_int (-1); 908 values[7] = make_int (-1);
909 filemodestring (&s, modes); 909 filemodestring (&s, modes);
910 values[8] = make_string ((Intbyte *) modes, 10); 910 values[8] = make_string ((Ibyte *) modes, 10);
911 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */ 911 #if defined (BSD4_2) || defined (BSD4_3) /* file gid will be dir gid */
912 { 912 {
913 struct stat sdir; 913 struct stat sdir;
914 914
915 if (!NILP (directory) && qxe_stat (XSTRING_DATA (directory), &sdir) == 0) 915 if (!NILP (directory) && qxe_stat (XSTRING_DATA (directory), &sdir) == 0)