Mercurial > hg > xemacs-beta
comparison src/minibuf.c @ 398:74fd4e045ea6 r21-2-29
Import from CVS: tag r21-2-29
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:13:30 +0200 |
parents | 8626e4521993 |
children | 2f8bb876ab1d |
comparison
equal
deleted
inserted
replaced
397:f4aeb21a5bad | 398:74fd4e045ea6 |
---|---|
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 struct Lisp_Symbol *next; | 390 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 struct Lisp_Symbol *next = symbol_next (XSYMBOL (bucket)); | 593 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 FORMAT_TERMINAL); | 685 Qterminal); |
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 | |
713 | 719 |
714 /* some callers pass in a null string as a way of clearing the echo area. | 720 /* some callers pass in a null string as a way of clearing the echo area. |
715 check for length == 0 now; if this case, neither nonreloc nor reloc | 721 check for length == 0 now; if this case, neither nonreloc nor reloc |
716 may be valid. */ | 722 may be valid. */ |
717 if (length == 0) | 723 if (length == 0) |
743 else | 749 else |
744 { | 750 { |
745 if (STRINGP (reloc)) | 751 if (STRINGP (reloc)) |
746 nonreloc = XSTRING_DATA (reloc); | 752 nonreloc = XSTRING_DATA (reloc); |
747 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length, | 753 write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length, |
748 FORMAT_TERMINAL); | 754 Qterminal); |
749 } | 755 } |
750 } | 756 } |
751 | 757 |
752 void | 758 void |
753 echo_area_message (struct frame *f, CONST Bufbyte *nonreloc, | 759 echo_area_message (struct frame *f, const Bufbyte *nonreloc, |
754 Lisp_Object reloc, Bytecount offset, Bytecount length, | 760 Lisp_Object reloc, Bytecount offset, Bytecount length, |
755 Lisp_Object label) | 761 Lisp_Object label) |
756 { | 762 { |
757 /* This function can call lisp */ | 763 /* This function can call lisp */ |
758 clear_echo_area (f, label, 1); | 764 clear_echo_area (f, label, 1); |
793 } | 799 } |
794 | 800 |
795 /* Dump an informative message to the echo area. This function takes a | 801 /* Dump an informative message to the echo area. This function takes a |
796 string in internal format. */ | 802 string in internal format. */ |
797 void | 803 void |
798 message_internal (CONST Bufbyte *nonreloc, Lisp_Object reloc, | 804 message_internal (const Bufbyte *nonreloc, Lisp_Object reloc, |
799 Bytecount offset, Bytecount length) | 805 Bytecount offset, Bytecount length) |
800 { | 806 { |
801 /* This function can call lisp */ | 807 /* This function can call lisp */ |
802 if (NILP (Vexecuting_macro)) | 808 if (NILP (Vexecuting_macro)) |
803 echo_area_message (selected_frame (), nonreloc, reloc, offset, length, | 809 echo_area_message (selected_frame (), nonreloc, reloc, offset, length, |
804 Qmessage); | 810 Qmessage); |
805 } | 811 } |
806 | 812 |
807 void | 813 void |
808 message_append_internal (CONST Bufbyte *nonreloc, Lisp_Object reloc, | 814 message_append_internal (const Bufbyte *nonreloc, Lisp_Object reloc, |
809 Bytecount offset, Bytecount length) | 815 Bytecount offset, Bytecount length) |
810 { | 816 { |
811 /* This function can call lisp */ | 817 /* This function can call lisp */ |
812 if (NILP (Vexecuting_macro)) | 818 if (NILP (Vexecuting_macro)) |
813 echo_area_append (selected_frame (), nonreloc, reloc, offset, length, | 819 echo_area_append (selected_frame (), nonreloc, reloc, offset, length, |
817 /* The next three functions are interfaces to message_internal() that | 823 /* The next three functions are interfaces to message_internal() that |
818 take strings in external format. message() does I18N3 translating | 824 take strings in external format. message() does I18N3 translating |
819 on the format string; message_no_translate() does not. */ | 825 on the format string; message_no_translate() does not. */ |
820 | 826 |
821 static void | 827 static void |
822 message_1 (CONST char *fmt, va_list args) | 828 message_1 (const char *fmt, va_list args) |
823 { | 829 { |
824 /* This function can call lisp */ | 830 /* This function can call lisp */ |
825 if (fmt) | 831 if (fmt) |
826 { | 832 { |
827 struct gcpro gcpro1; | 833 struct gcpro gcpro1; |
828 /* message_internal() might GC, e.g. if there are after-change-hooks | 834 /* message_internal() might GC, e.g. if there are after-change-hooks |
829 on the echo area buffer */ | 835 on the echo area buffer */ |
830 Lisp_Object obj = emacs_doprnt_string_va ((CONST Bufbyte *) fmt, Qnil, | 836 Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil, |
831 -1, args); | 837 -1, args); |
832 GCPRO1 (obj); | 838 GCPRO1 (obj); |
833 message_internal (0, obj, 0, -1); | 839 message_internal (0, obj, 0, -1); |
834 UNGCPRO; | 840 UNGCPRO; |
835 } | 841 } |
836 else | 842 else |
837 message_internal (0, Qnil, 0, 0); | 843 message_internal (0, Qnil, 0, 0); |
838 } | 844 } |
839 | 845 |
840 static void | 846 static void |
841 message_append_1 (CONST char *fmt, va_list args) | 847 message_append_1 (const char *fmt, va_list args) |
842 { | 848 { |
843 /* This function can call lisp */ | 849 /* This function can call lisp */ |
844 if (fmt) | 850 if (fmt) |
845 { | 851 { |
846 struct gcpro gcpro1; | 852 struct gcpro gcpro1; |
847 /* message_internal() might GC, e.g. if there are after-change-hooks | 853 /* message_internal() might GC, e.g. if there are after-change-hooks |
848 on the echo area buffer */ | 854 on the echo area buffer */ |
849 Lisp_Object obj = emacs_doprnt_string_va ((CONST Bufbyte *) fmt, Qnil, | 855 Lisp_Object obj = emacs_doprnt_string_va ((const Bufbyte *) fmt, Qnil, |
850 -1, args); | 856 -1, args); |
851 GCPRO1 (obj); | 857 GCPRO1 (obj); |
852 message_append_internal (0, obj, 0, -1); | 858 message_append_internal (0, obj, 0, -1); |
853 UNGCPRO; | 859 UNGCPRO; |
854 } | 860 } |
862 /* This function can call lisp */ | 868 /* This function can call lisp */ |
863 message_internal (0, Qnil, 0, 0); | 869 message_internal (0, Qnil, 0, 0); |
864 } | 870 } |
865 | 871 |
866 void | 872 void |
867 message (CONST char *fmt, ...) | 873 message (const char *fmt, ...) |
868 { | 874 { |
869 /* This function can call lisp */ | 875 /* This function can call lisp */ |
870 /* I think it's OK to pass the data of Lisp strings as arguments to | 876 /* I think it's OK to pass the data of Lisp strings as arguments to |
871 this function. No GC'ing will occur until the data has already | 877 this function. No GC'ing will occur until the data has already |
872 been copied. */ | 878 been copied. */ |
878 message_1 (fmt, args); | 884 message_1 (fmt, args); |
879 va_end (args); | 885 va_end (args); |
880 } | 886 } |
881 | 887 |
882 void | 888 void |
883 message_append (CONST char *fmt, ...) | 889 message_append (const char *fmt, ...) |
884 { | 890 { |
885 /* This function can call lisp */ | 891 /* This function can call lisp */ |
886 va_list args; | 892 va_list args; |
887 | 893 |
888 va_start (args, fmt); | 894 va_start (args, fmt); |
891 message_append_1 (fmt, args); | 897 message_append_1 (fmt, args); |
892 va_end (args); | 898 va_end (args); |
893 } | 899 } |
894 | 900 |
895 void | 901 void |
896 message_no_translate (CONST char *fmt, ...) | 902 message_no_translate (const char *fmt, ...) |
897 { | 903 { |
898 /* This function can call lisp */ | 904 /* This function can call lisp */ |
899 /* I think it's OK to pass the data of Lisp strings as arguments to | 905 /* I think it's OK to pass the data of Lisp strings as arguments to |
900 this function. No GC'ing will occur until the data has already | 906 this function. No GC'ing will occur until the data has already |
901 been copied. */ | 907 been copied. */ |
934 defsymbol (&Qdisplay_message, "display-message"); | 940 defsymbol (&Qdisplay_message, "display-message"); |
935 defsymbol (&Qcurrent_message_label, "current-message-label"); | 941 defsymbol (&Qcurrent_message_label, "current-message-label"); |
936 } | 942 } |
937 | 943 |
938 void | 944 void |
945 reinit_vars_of_minibuf (void) | |
946 { | |
947 minibuf_level = 0; | |
948 } | |
949 | |
950 void | |
939 vars_of_minibuf (void) | 951 vars_of_minibuf (void) |
940 { | 952 { |
941 minibuf_level = 0; | 953 reinit_vars_of_minibuf (); |
942 | 954 |
943 staticpro (&Vminibuf_prompt); | 955 staticpro (&Vminibuf_prompt); |
944 Vminibuf_prompt = Qnil; | 956 Vminibuf_prompt = Qnil; |
945 | 957 |
946 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */ | 958 /* Added by Jareth Hein (jhod@po.iijnet.or.jp) for input system support */ |
963 */ ); | 975 */ ); |
964 Vcompletion_regexp_list = Qnil; | 976 Vcompletion_regexp_list = Qnil; |
965 } | 977 } |
966 | 978 |
967 void | 979 void |
968 complex_vars_of_minibuf (void) | 980 reinit_complex_vars_of_minibuf (void) |
969 { | 981 { |
970 /* This function can GC */ | 982 /* This function can GC */ |
971 #ifdef I18N3 | 983 #ifdef I18N3 |
972 /* #### This needs to be fixed up so that the gettext() gets called | 984 /* #### This needs to be fixed up so that the gettext() gets called |
973 at runtime instead of at load time. */ | 985 at runtime instead of at load time. */ |
974 #endif | 986 #endif |
975 Vminibuffer_zero | 987 Vminibuffer_zero |
976 = Fget_buffer_create | 988 = Fget_buffer_create |
977 (Fpurecopy (build_string (DEFER_GETTEXT (" *Minibuf-0*")))); | 989 (build_string (DEFER_GETTEXT (" *Minibuf-0*"))); |
978 Vecho_area_buffer | 990 Vecho_area_buffer |
979 = Fget_buffer_create | 991 = Fget_buffer_create |
980 (Fpurecopy (build_string (DEFER_GETTEXT (" *Echo Area*")))); | 992 (build_string (DEFER_GETTEXT (" *Echo Area*"))); |
981 } | 993 } |
994 | |
995 void | |
996 complex_vars_of_minibuf (void) | |
997 { | |
998 reinit_complex_vars_of_minibuf (); | |
999 } |