comparison src/mule-charset.c @ 3681:3131094eed8c

[xemacs-hg @ 2006-11-15 21:39:51 by aidan] Move charsets-in-region to C.
author aidan
date Wed, 15 Nov 2006 21:40:02 +0000
parents 3ef0aaf3dc34
children 761385dfa575
comparison
equal deleted inserted replaced
3680:efca49973324 3681:3131094eed8c
935 set_charset_registries(charset, registries); 935 set_charset_registries(charset, registries);
936 936
937 return Qnil; 937 return Qnil;
938 } 938 }
939 939
940 DEFUN ("charsets-in-region", Fcharsets_in_region, 2, 3, 0, /*
941 Return a list of the charsets in the region between START and END.
942 BUFFER defaults to the current buffer if omitted.
943 */
944 (start, end, buffer))
945 {
946 /* This function can GC */
947 struct buffer *buf = decode_buffer (buffer, 1);
948 Charbpos pos, stop; /* Limits of the region. */
949 Lisp_Object res = Qnil;
950 int charsets[NUM_LEADING_BYTES];
951 Ibyte lb;
952 struct gcpro gcpro1;
953
954 memset(charsets, 0, sizeof(charsets));
955 get_buffer_range_char (buf, start, end, &pos, &stop, 0);
956
957 GCPRO1 (res);
958 while (pos < stop)
959 {
960 lb = ichar_leading_byte(BUF_FETCH_CHAR (buf, pos));
961 if (0 == charsets[lb - MIN_LEADING_BYTE])
962 {
963 charsets[lb - MIN_LEADING_BYTE] = 1;
964 res = Fcons (XCHARSET_NAME(charset_by_leading_byte(lb)), res);
965 }
966 ++pos;
967 }
968 UNGCPRO;
969
970 return res;
971 }
972
940 973
941 /************************************************************************/ 974 /************************************************************************/
942 /* memory usage */ 975 /* memory usage */
943 /************************************************************************/ 976 /************************************************************************/
944 977
1027 DEFSUBR (Fcharset_dimension); 1060 DEFSUBR (Fcharset_dimension);
1028 DEFSUBR (Fcharset_property); 1061 DEFSUBR (Fcharset_property);
1029 DEFSUBR (Fcharset_id); 1062 DEFSUBR (Fcharset_id);
1030 DEFSUBR (Fset_charset_ccl_program); 1063 DEFSUBR (Fset_charset_ccl_program);
1031 DEFSUBR (Fset_charset_registries); 1064 DEFSUBR (Fset_charset_registries);
1065 DEFSUBR (Fcharsets_in_region);
1032 1066
1033 #ifdef MEMORY_USAGE_STATS 1067 #ifdef MEMORY_USAGE_STATS
1034 DEFSUBR (Fcharset_memory_usage); 1068 DEFSUBR (Fcharset_memory_usage);
1035 #endif 1069 #endif
1036 1070