comparison src/minibuf.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 2f8bb876ab1d
children 11054d720c21
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
203 This is necessary for many reasons, one of which is that two 203 This is necessary for many reasons, one of which is that two
204 strings may match even if they have different numbers of bytes, 204 strings may match even if they have different numbers of bytes,
205 if IGNORE_CASE is true. */ 205 if IGNORE_CASE is true. */
206 206
207 Charcount 207 Charcount
208 scmp_1 (const Bufbyte *s1, const Bufbyte *s2, Charcount len, 208 scmp_1 (CONST Bufbyte *s1, CONST Bufbyte *s2, Charcount len,
209 int ignore_case) 209 int ignore_case)
210 { 210 {
211 Charcount l = len; 211 Charcount l = len;
212 212
213 if (ignore_case) 213 if (ignore_case)
242 else return len - l; 242 else return len - l;
243 } 243 }
244 244
245 245
246 int 246 int
247 regexp_ignore_completion_p (const Bufbyte *nonreloc, 247 regexp_ignore_completion_p (CONST Bufbyte *nonreloc,
248 Lisp_Object reloc, Bytecount offset, 248 Lisp_Object reloc, Bytecount offset,
249 Bytecount length) 249 Bytecount length)
250 { 250 {
251 /* Ignore this element if it fails to match all the regexps. */ 251 /* Ignore this element if it fails to match all the regexps. */
252 if (!NILP (Vcompletion_regexp_list)) 252 if (!NILP (Vcompletion_regexp_list))
385 } 385 }
386 else 386 else
387 { 387 {
388 if (!ZEROP (bucket)) 388 if (!ZEROP (bucket))
389 { 389 {
390 Lisp_Symbol *next; 390 struct Lisp_Symbol *next;
391 if (!SYMBOLP (bucket)) 391 if (!SYMBOLP (bucket))
392 { 392 {
393 signal_simple_error ("Bad obarray passed to try-completions", 393 signal_simple_error ("Bad obarray passed to try-completions",
394 bucket); 394 bucket);
395 } 395 }
588 } 588 }
589 else 589 else
590 { 590 {
591 if (!ZEROP (bucket)) 591 if (!ZEROP (bucket))
592 { 592 {
593 Lisp_Symbol *next = symbol_next (XSYMBOL (bucket)); 593 struct Lisp_Symbol *next = symbol_next (XSYMBOL (bucket));
594 elt = bucket; 594 elt = bucket;
595 eltstring = Fsymbol_name (elt); 595 eltstring = Fsymbol_name (elt);
596 if (next) 596 if (next)
597 XSETSYMBOL (bucket, next); 597 XSETSYMBOL (bucket, next);
598 else 598 else
679 return call4 (Qclear_message, label, frame, from_print ? Qt : Qnil, 679 return call4 (Qclear_message, label, frame, from_print ? Qt : Qnil,
680 no_restore ? Qt : Qnil); 680 no_restore ? Qt : Qnil);
681 } 681 }
682 else 682 else
683 { 683 {
684 write_string_to_stdio_stream (stderr, 0, (const Bufbyte *) "\n", 0, 1, 684 write_string_to_stdio_stream (stderr, 0, (CONST Bufbyte *) "\n", 0, 1,
685 Qterminal, 0); 685 FORMAT_TERMINAL);
686 return Qnil; 686 return Qnil;
687 } 687 }
688 } 688 }
689 689
690 Lisp_Object 690 Lisp_Object
700 /* This function can call lisp */ 700 /* This function can call lisp */
701 return clear_echo_area_internal (f, label, 1, no_restore); 701 return clear_echo_area_internal (f, label, 1, no_restore);
702 } 702 }
703 703
704 void 704 void
705 echo_area_append (struct frame *f, const Bufbyte *nonreloc, Lisp_Object reloc, 705 echo_area_append (struct frame *f, CONST Bufbyte *nonreloc, Lisp_Object reloc,
706 Bytecount offset, Bytecount length, 706 Bytecount offset, Bytecount length,
707 Lisp_Object label) 707 Lisp_Object label)
708 { 708 {
709 /* This function can call lisp */ 709 /* This function can call lisp */
710 Lisp_Object obj; 710 Lisp_Object obj;
711 struct gcpro gcpro1; 711 struct gcpro gcpro1;
712 Lisp_Object frame; 712 Lisp_Object frame;
713
714 /* There is an inlining bug in egcs-20000131 c++ that can be worked
715 around as follows: */
716 #if defined (__GNUC__) && defined (__cplusplus)
717 alloca (4);
718 #endif
719 713
720 /* some callers pass in a null string as a way of clearing the echo area. 714 /* some callers pass in a null string as a way of clearing the echo area.
721 check for length == 0 now; if this case, neither nonreloc nor reloc 715 check for length == 0 now; if this case, neither nonreloc nor reloc
722 may be valid. */ 716 may be valid. */
723 if (length == 0) 717 if (length == 0)
749 else 743 else
750 { 744 {
751 if (STRINGP (reloc)) 745 if (STRINGP (reloc))
752 nonreloc = XSTRING_DATA (reloc); 746 nonreloc = XSTRING_DATA (reloc);
753 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length, 747 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length,
754 Qterminal, 0); 748 FORMAT_TERMINAL);
755 } 749 }
756 } 750 }
757 751
758 void 752 void
759 echo_area_message (struct frame *f, const Bufbyte *nonreloc, 753 echo_area_message (struct frame *f, CONST Bufbyte *nonreloc,
760 Lisp_Object reloc, Bytecount offset, Bytecount length, 754 Lisp_Object reloc, Bytecount offset, Bytecount length,
761 Lisp_Object label) 755 Lisp_Object label)
762 { 756 {
763 /* This function can call lisp */ 757 /* This function can call lisp */
764 clear_echo_area (f, label, 1); 758 clear_echo_area (f, label, 1);
799 } 793 }
800 794
801 /* Dump an informative message to the echo area. This function takes a 795 /* Dump an informative message to the echo area. This function takes a
802 string in internal format. */ 796 string in internal format. */
803 void 797 void
804 message_internal (const Bufbyte *nonreloc, Lisp_Object reloc, 798 message_internal (CONST Bufbyte *nonreloc, Lisp_Object reloc,
805 Bytecount offset, Bytecount length) 799 Bytecount offset, Bytecount length)
806 { 800 {
807 /* This function can call lisp */ 801 /* This function can call lisp */
808 if (NILP (Vexecuting_macro)) 802 if (NILP (Vexecuting_macro))
809 echo_area_message (selected_frame (), nonreloc, reloc, offset, length, 803 echo_area_message (selected_frame (), nonreloc, reloc, offset, length,
810 Qmessage); 804 Qmessage);
811 } 805 }
812 806
813 void 807 void
814 message_append_internal (const Bufbyte *nonreloc, Lisp_Object reloc, 808 message_append_internal (CONST Bufbyte *nonreloc, Lisp_Object reloc,
815 Bytecount offset, Bytecount length) 809 Bytecount offset, Bytecount length)
816 { 810 {
817 /* This function can call lisp */ 811 /* This function can call lisp */
818 if (NILP (Vexecuting_macro)) 812 if (NILP (Vexecuting_macro))
819 echo_area_append (selected_frame (), nonreloc, reloc, offset, length, 813 echo_area_append (selected_frame (), nonreloc, reloc, offset, length,
823 /* The next three functions are interfaces to message_internal() that 817 /* The next three functions are interfaces to message_internal() that
824 take strings in external format. message() does I18N3 translating 818 take strings in external format. message() does I18N3 translating
825 on the format string; message_no_translate() does not. */ 819 on the format string; message_no_translate() does not. */
826 820
827 static void 821 static void
828 message_1 (const char *fmt, va_list args) 822 message_1 (CONST char *fmt, va_list args)
829 { 823 {
830 /* This function can call lisp */ 824 /* This function can call lisp */
831 if (fmt) 825 if (fmt)
832 { 826 {
833 struct gcpro gcpro1; 827 struct gcpro gcpro1;
834 /* message_internal() might GC, e.g. if there are after-change-hooks 828 /* message_internal() might GC, e.g. if there are after-change-hooks
835 on the echo area buffer */ 829 on the echo area buffer */
836 Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil, 830 Lisp_Object obj = emacs_doprnt_string_va ((CONST Bufbyte *) fmt, Qnil,
837 -1, args); 831 -1, args);
838 GCPRO1 (obj); 832 GCPRO1 (obj);
839 message_internal (0, obj, 0, -1); 833 message_internal (0, obj, 0, -1);
840 UNGCPRO; 834 UNGCPRO;
841 } 835 }
842 else 836 else
843 message_internal (0, Qnil, 0, 0); 837 message_internal (0, Qnil, 0, 0);
844 } 838 }
845 839
846 static void 840 static void
847 message_append_1 (const char *fmt, va_list args) 841 message_append_1 (CONST char *fmt, va_list args)
848 { 842 {
849 /* This function can call lisp */ 843 /* This function can call lisp */
850 if (fmt) 844 if (fmt)
851 { 845 {
852 struct gcpro gcpro1; 846 struct gcpro gcpro1;
853 /* message_internal() might GC, e.g. if there are after-change-hooks 847 /* message_internal() might GC, e.g. if there are after-change-hooks
854 on the echo area buffer */ 848 on the echo area buffer */
855 Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil, 849 Lisp_Object obj = emacs_doprnt_string_va ((CONST Bufbyte *) fmt, Qnil,
856 -1, args); 850 -1, args);
857 GCPRO1 (obj); 851 GCPRO1 (obj);
858 message_append_internal (0, obj, 0, -1); 852 message_append_internal (0, obj, 0, -1);
859 UNGCPRO; 853 UNGCPRO;
860 } 854 }
868 /* This function can call lisp */ 862 /* This function can call lisp */
869 message_internal (0, Qnil, 0, 0); 863 message_internal (0, Qnil, 0, 0);
870 } 864 }
871 865
872 void 866 void
873 message (const char *fmt, ...) 867 message (CONST char *fmt, ...)
874 { 868 {
875 /* This function can call lisp */ 869 /* This function can call lisp */
876 /* I think it's OK to pass the data of Lisp strings as arguments to 870 /* I think it's OK to pass the data of Lisp strings as arguments to
877 this function. No GC'ing will occur until the data has already 871 this function. No GC'ing will occur until the data has already
878 been copied. */ 872 been copied. */
884 message_1 (fmt, args); 878 message_1 (fmt, args);
885 va_end (args); 879 va_end (args);
886 } 880 }
887 881
888 void 882 void
889 message_append (const char *fmt, ...) 883 message_append (CONST char *fmt, ...)
890 { 884 {
891 /* This function can call lisp */ 885 /* This function can call lisp */
892 va_list args; 886 va_list args;
893 887
894 va_start (args, fmt); 888 va_start (args, fmt);
897 message_append_1 (fmt, args); 891 message_append_1 (fmt, args);
898 va_end (args); 892 va_end (args);
899 } 893 }
900 894
901 void 895 void
902 message_no_translate (const char *fmt, ...) 896 message_no_translate (CONST char *fmt, ...)
903 { 897 {
904 /* This function can call lisp */ 898 /* This function can call lisp */
905 /* I think it's OK to pass the data of Lisp strings as arguments to 899 /* I think it's OK to pass the data of Lisp strings as arguments to
906 this function. No GC'ing will occur until the data has already 900 this function. No GC'ing will occur until the data has already
907 been copied. */ 901 been copied. */
940 defsymbol (&Qdisplay_message, "display-message"); 934 defsymbol (&Qdisplay_message, "display-message");
941 defsymbol (&Qcurrent_message_label, "current-message-label"); 935 defsymbol (&Qcurrent_message_label, "current-message-label");
942 } 936 }
943 937
944 void 938 void
945 reinit_vars_of_minibuf (void) 939 vars_of_minibuf (void)
946 { 940 {
947 minibuf_level = 0; 941 minibuf_level = 0;
948 }
949
950 void
951 vars_of_minibuf (void)
952 {
953 reinit_vars_of_minibuf ();
954 942
955 staticpro (&Vminibuf_prompt); 943 staticpro (&Vminibuf_prompt);
956 Vminibuf_prompt = Qnil; 944 Vminibuf_prompt = Qnil;
957 945
958 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */ 946 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */
975 */ ); 963 */ );
976 Vcompletion_regexp_list = Qnil; 964 Vcompletion_regexp_list = Qnil;
977 } 965 }
978 966
979 void 967 void
980 reinit_complex_vars_of_minibuf (void) 968 complex_vars_of_minibuf (void)
981 { 969 {
982 /* This function can GC */ 970 /* This function can GC */
983 #ifdef I18N3 971 #ifdef I18N3
984 /* #### This needs to be fixed up so that the gettext() gets called 972 /* #### This needs to be fixed up so that the gettext() gets called
985 at runtime instead of at load time. */ 973 at runtime instead of at load time. */
986 #endif 974 #endif
987 Vminibuffer_zero 975 Vminibuffer_zero
988 = Fget_buffer_create 976 = Fget_buffer_create
989 (build_string (DEFER_GETTEXT (" *Minibuf-0*"))); 977 (Fpurecopy (build_string (DEFER_GETTEXT (" *Minibuf-0*"))));
990 Vecho_area_buffer 978 Vecho_area_buffer
991 = Fget_buffer_create 979 = Fget_buffer_create
992 (build_string (DEFER_GETTEXT (" *Echo Area*"))); 980 (Fpurecopy (build_string (DEFER_GETTEXT (" *Echo Area*"))));
993 } 981 }
994
995 void
996 complex_vars_of_minibuf (void)
997 {
998 reinit_complex_vars_of_minibuf ();
999 }