Mercurial > emacs
comparison src/alloc.c @ 2013:e2a164ac4088
(Fmake_rope, Frope_elt): Fns deleted.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Fri, 05 Mar 1993 23:52:49 +0000 |
| parents | 73ce9dd21093 |
| children | 6775c932a51b |
comparison
equal
deleted
inserted
replaced
| 2012:a6d7c2f161cf | 2013:e2a164ac4088 |
|---|---|
| 863 | 863 |
| 864 return val; | 864 return val; |
| 865 } | 865 } |
| 866 | 866 |
| 867 /* Return a newly created vector or string with specified arguments as | 867 /* Return a newly created vector or string with specified arguments as |
| 868 elements. If all the arguments are characters, make a string; | 868 elements. If all the arguments are characters that can fit |
| 869 otherwise, make a vector. Any number of arguments, even zero | 869 in a string of events, make a string; otherwise, make a vector. |
| 870 arguments, are allowed. */ | 870 |
| 871 Any number of arguments, even zero arguments, are allowed. */ | |
| 871 | 872 |
| 872 Lisp_Object | 873 Lisp_Object |
| 873 make_array (nargs, args) | 874 make_event_array (nargs, args) |
| 874 register int nargs; | 875 register int nargs; |
| 875 Lisp_Object *args; | 876 Lisp_Object *args; |
| 876 { | 877 { |
| 877 int i; | 878 int i; |
| 878 | 879 |
| 879 for (i = 0; i < nargs; i++) | 880 for (i = 0; i < nargs; i++) |
| 881 /* The things that fit in a string | |
| 882 are characters that are in 0...127 after discarding the meta bit. */ | |
| 880 if (XTYPE (args[i]) != Lisp_Int | 883 if (XTYPE (args[i]) != Lisp_Int |
| 881 || (unsigned) XINT (args[i]) >= 0400) | 884 || (XUINT (args[i]) & ~CHAR_META) >= 0200) |
| 882 return Fvector (nargs, args); | 885 return Fvector (nargs, args); |
| 883 | 886 |
| 884 /* Since the loop exited, we know that all the things in it are | 887 /* Since the loop exited, we know that all the things in it are |
| 885 characters, so we can make a string. */ | 888 characters, so we can make a string. */ |
| 886 { | 889 { |
| 887 Lisp_Object result = Fmake_string (nargs, make_number (0)); | 890 Lisp_Object result = Fmake_string (nargs, make_number (0)); |
| 888 | 891 |
| 889 for (i = 0; i < nargs; i++) | 892 for (i = 0; i < nargs; i++) |
| 890 XSTRING (result)->data[i] = XINT (args[i]); | 893 { |
| 894 XSTRING (result)->data[i] = XINT (args[i]); | |
| 895 /* Move the meta bit to the right place for a string char. */ | |
| 896 if (XINT (args[i]) & CHAR_META) | |
| 897 XSTRING (result)->data[i] |= 0x80; | |
| 898 } | |
| 891 | 899 |
| 892 return result; | 900 return result; |
| 893 } | 901 } |
| 894 } | |
| 895 | |
| 896 /* Allocation of ropes. */ | |
| 897 | |
| 898 /* Note: the user cannot manipulate ropes portably by referring | |
| 899 to the chars of the string, because combining two chars to make a GLYPH | |
| 900 depends on endianness. */ | |
| 901 | |
| 902 DEFUN ("make-rope", Fmake_rope, Smake_rope, 0, MANY, 0, | |
| 903 "Return a newly created rope containing the arguments of this function.\n\ | |
| 904 A rope is a string, except that its contents will be treated as an\n\ | |
| 905 array of glyphs, where a glyph is an integer type that may be larger\n\ | |
| 906 than a character. Emacs is normally configured to use 8-bit glyphs,\n\ | |
| 907 so ropes are normally no different from strings. But Emacs may be\n\ | |
| 908 configured to use 16-bit glyphs, to allow the use of larger fonts.\n\ | |
| 909 \n\ | |
| 910 Each argument (which must be an integer) specifies one glyph, whatever\n\ | |
| 911 size glyphs may be.\n\ | |
| 912 \n\ | |
| 913 See variable `buffer-display-table' for the uses of ropes.") | |
| 914 (nargs, args) | |
| 915 register int nargs; | |
| 916 Lisp_Object *args; | |
| 917 { | |
| 918 register int i; | |
| 919 register Lisp_Object val; | |
| 920 register GLYPH *p; | |
| 921 | |
| 922 val = make_uninit_string (nargs * sizeof (GLYPH)); | |
| 923 | |
| 924 p = (GLYPH *) XSTRING (val)->data; | |
| 925 for (i = 0; i < nargs; i++) | |
| 926 { | |
| 927 CHECK_NUMBER (args[i], i); | |
| 928 p[i] = XFASTINT (args[i]); | |
| 929 } | |
| 930 return val; | |
| 931 } | |
| 932 | |
| 933 DEFUN ("rope-elt", Frope_elt, Srope_elt, 2, 2, 0, | |
| 934 "Return an element of rope R at index N.\n\ | |
| 935 A rope is a string in which each pair of bytes is considered an element.\n\ | |
| 936 See variable `buffer-display-table' for the uses of ropes.") | |
| 937 (r, n) | |
| 938 Lisp_Object r, n; | |
| 939 { | |
| 940 CHECK_STRING (r, 0); | |
| 941 CHECK_NUMBER (n, 1); | |
| 942 if ((XSTRING (r)->size / sizeof (GLYPH)) <= XINT (n) || XINT (n) < 0) | |
| 943 args_out_of_range (r, n); | |
| 944 return ((GLYPH *) XSTRING (r)->data)[XFASTINT (n)]; | |
| 945 } | 902 } |
| 946 | 903 |
| 947 /* Pure storage management. */ | 904 /* Pure storage management. */ |
| 948 | 905 |
| 949 /* Must get an error if pure storage is full, | 906 /* Must get an error if pure storage is full, |
| 2144 defsubr (&Svector); | 2101 defsubr (&Svector); |
| 2145 defsubr (&Smake_byte_code); | 2102 defsubr (&Smake_byte_code); |
| 2146 defsubr (&Smake_list); | 2103 defsubr (&Smake_list); |
| 2147 defsubr (&Smake_vector); | 2104 defsubr (&Smake_vector); |
| 2148 defsubr (&Smake_string); | 2105 defsubr (&Smake_string); |
| 2149 defsubr (&Smake_rope); | |
| 2150 defsubr (&Srope_elt); | |
| 2151 defsubr (&Smake_symbol); | 2106 defsubr (&Smake_symbol); |
| 2152 defsubr (&Smake_marker); | 2107 defsubr (&Smake_marker); |
| 2153 defsubr (&Spurecopy); | 2108 defsubr (&Spurecopy); |
| 2154 defsubr (&Sgarbage_collect); | 2109 defsubr (&Sgarbage_collect); |
| 2155 defsubr (&Smemory_limit); | 2110 defsubr (&Smemory_limit); |
