comparison src/fns.c @ 10:49a24b4fd526 r19-15b6

Import from CVS: tag r19-15b6
author cvs
date Mon, 13 Aug 2007 08:47:52 +0200
parents ac2d302a0011
children 9ee227acff29
comparison
equal deleted inserted replaced
9:6f2bbbbbe05a 10:49a24b4fd526
2837 */ ) 2837 */ )
2838 (array, item) 2838 (array, item)
2839 Lisp_Object array, item; 2839 Lisp_Object array, item;
2840 { 2840 {
2841 retry: 2841 retry:
2842 if (VECTORP (array)) 2842 if (STRINGP (array))
2843 {
2844 Charcount size;
2845 Charcount i;
2846 Emchar charval;
2847 struct Lisp_String *s;
2848 CHECK_CHAR_COERCE_INT (item);
2849 CHECK_IMPURE (array);
2850 charval = XCHAR (item);
2851 s = XSTRING (array);
2852 size = string_char_length (s);
2853 for (i = 0; i < size; i++)
2854 set_string_char (s, i, charval);
2855 bump_string_modiff (array);
2856 }
2857 else if (VECTORP (array))
2843 { 2858 {
2844 Lisp_Object *p; 2859 Lisp_Object *p;
2845 int size; 2860 int size;
2846 int indecks; 2861 int i;
2847 CHECK_IMPURE (array); 2862 CHECK_IMPURE (array);
2848 size = vector_length (XVECTOR (array)); 2863 size = vector_length (XVECTOR (array));
2849 p = vector_data (XVECTOR (array)); 2864 p = vector_data (XVECTOR (array));
2850 for (indecks = 0; indecks < size; indecks++) 2865 for (i = 0; i < size; i++)
2851 p[indecks] = item; 2866 p[i] = item;
2852 } 2867 }
2853 else if (VECTORP (array)) 2868 else if (BIT_VECTORP (array))
2854 { 2869 {
2855 struct Lisp_Bit_Vector *v; 2870 struct Lisp_Bit_Vector *v;
2856 int size; 2871 int size;
2857 int indecks; 2872 int i;
2858
2859 CHECK_BIT (item); 2873 CHECK_BIT (item);
2860 CHECK_IMPURE (array); 2874 CHECK_IMPURE (array);
2861 v = XBIT_VECTOR (array); 2875 v = XBIT_VECTOR (array);
2862 size = bit_vector_length (v); 2876 size = bit_vector_length (v);
2863 for (indecks = 0; indecks < size; indecks++) 2877 for (i = 0; i < size; i++)
2864 set_bit_vector_bit (v, indecks, XINT (item)); 2878 set_bit_vector_bit (v, i, XINT (item));
2865 }
2866 else if (STRINGP (array))
2867 {
2868 Charcount size;
2869 Charcount indecks;
2870 Emchar charval;
2871 CHECK_CHAR_COERCE_INT (item);
2872 CHECK_IMPURE (array);
2873 charval = XCHAR (item);
2874 size = string_char_length (XSTRING (array));
2875 for (indecks = 0; indecks < size; indecks++)
2876 set_string_char (XSTRING (array), indecks, charval);
2877 bump_string_modiff (array);
2878 } 2879 }
2879 else 2880 else
2880 { 2881 {
2881 array = wrong_type_argument (Qarrayp, array); 2882 array = wrong_type_argument (Qarrayp, array);
2882 goto retry; 2883 goto retry;