X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fbuffer.h;h=352920098325e8e97de1aa1ce5d25393d055a6ff;hb=4f29597e4f3696a59bb08ffece07183c1568c4a5;hp=6b36d3a069b82904f997a6f755cf615341530f1f;hpb=f52a96980ed9280f8f906a20d4b899dc0b027644;p=chise%2Fxemacs-chise.git- diff --git a/src/buffer.h b/src/buffer.h index 6b36d3a..3529200 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1013,171 +1013,11 @@ typedef union { char c; void *p; } *dfc_aliasing_voidpp; argument to TO_EXTERNAL_FORMAT() and TO_INTERNAL_FORMAT(). */ #define Qnative Qfile_name -#define GET_C_CHARPTR_EXT_DATA_ALLOCA(ptr, fmt, ptr_out) do \ -{ \ - Extcount gcceda_ignored_len; \ - const Bufbyte *gcceda_ptr_in = (const Bufbyte *) (ptr); \ - Extbyte *gcceda_ptr_out; \ - \ - GET_CHARPTR_EXT_DATA_ALLOCA (gcceda_ptr_in, \ - strlen ((char *) gcceda_ptr_in), \ - fmt, \ - gcceda_ptr_out, \ - gcceda_ignored_len); \ - (ptr_out) = (char *) gcceda_ptr_out; \ -} while (0) - -#define GET_C_CHARPTR_EXT_BINARY_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_EXT_DATA_ALLOCA (ptr, FORMAT_BINARY, ptr_out) -#define GET_CHARPTR_EXT_BINARY_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_EXT_DATA_ALLOCA (ptr, len, FORMAT_BINARY, ptr_out, len_out) - -#define GET_C_CHARPTR_EXT_FILENAME_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_EXT_DATA_ALLOCA (ptr, FORMAT_FILENAME, ptr_out) -#define GET_CHARPTR_EXT_FILENAME_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_EXT_DATA_ALLOCA (ptr, len, FORMAT_FILENAME, ptr_out, len_out) - -#define GET_C_CHARPTR_EXT_CTEXT_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_EXT_DATA_ALLOCA (ptr, FORMAT_CTEXT, ptr_out) -#define GET_CHARPTR_EXT_CTEXT_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_EXT_DATA_ALLOCA (ptr, len, FORMAT_CTEXT, ptr_out, len_out) - -/* Maybe convert external charptr's data into internal format and store - the result in alloca()'ed space. - - You may wonder why this is written in this fashion and not as a - function call. With a little trickery it could certainly be - written this way, but it won't work because of those DAMN GCC WANKERS - who couldn't be bothered to handle alloca() properly on the x86 - architecture. (If you put a call to alloca() in the argument to - a function call, the stack space gets allocated right in the - middle of the arguments to the function call and you are unbelievably - hosed.) */ - -#ifdef MULE - -#define GET_CHARPTR_INT_DATA_ALLOCA(ptr, len, fmt, ptr_out, len_out) do \ -{ \ - Extcount gcida_len_in = (Extcount) (len); \ - Bytecount gcida_len_out; \ - const Extbyte *gcida_ptr_in = (ptr); \ - Bufbyte *gcida_ptr_out = \ - convert_from_external_format (gcida_ptr_in, gcida_len_in, \ - &gcida_len_out, fmt); \ - /* If the new string is identical to the old (will be the case most \ - of the time), just return the same string back. This saves \ - on alloca()ing, which can be useful on C alloca() machines and \ - on stack-space-challenged environments. */ \ - \ - if (gcida_len_in == gcida_len_out && \ - !memcmp (gcida_ptr_in, gcida_ptr_out, gcida_len_out)) \ - { \ - (ptr_out) = (Bufbyte *) gcida_ptr_in; \ - } \ - else \ - { \ - (ptr_out) = (Extbyte *) alloca (1 + gcida_len_out); \ - memcpy ((void *) ptr_out, gcida_ptr_out, 1 + gcida_len_out); \ - } \ - (len_out) = gcida_len_out; \ -} while (0) - -#else /* ! MULE */ - -#define GET_CHARPTR_INT_DATA_ALLOCA(ptr, len, fmt, ptr_out, len_out) do \ -{ \ - (ptr_out) = (Bufbyte *) (ptr); \ - (len_out) = (Bytecount) (len); \ -} while (0) - -#endif /* ! MULE */ - -#define GET_C_CHARPTR_INT_DATA_ALLOCA(ptr, fmt, ptr_out) do \ -{ \ - Bytecount gccida_ignored_len; \ - const Extbyte *gccida_ptr_in = (const Extbyte *) (ptr); \ - Bufbyte *gccida_ptr_out; \ - \ - GET_CHARPTR_INT_DATA_ALLOCA (gccida_ptr_in, \ - strlen ((char *) gccida_ptr_in), \ - fmt, \ - gccida_ptr_out, \ - gccida_ignored_len); \ - (ptr_out) = gccida_ptr_out; \ -} while (0) - -#define GET_C_CHARPTR_INT_BINARY_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_INT_DATA_ALLOCA (ptr, FORMAT_BINARY, ptr_out) -#define GET_CHARPTR_INT_BINARY_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_INT_DATA_ALLOCA (ptr, len, FORMAT_BINARY, ptr_out, len_out) - -#define GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_INT_DATA_ALLOCA (ptr, FORMAT_FILENAME, ptr_out) -#define GET_CHARPTR_INT_FILENAME_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_INT_DATA_ALLOCA (ptr, len, FORMAT_FILENAME, ptr_out, len_out) - -#define GET_C_CHARPTR_INT_CTEXT_DATA_ALLOCA(ptr, ptr_out) \ - GET_C_CHARPTR_INT_DATA_ALLOCA (ptr, FORMAT_CTEXT, ptr_out) -#define GET_CHARPTR_INT_CTEXT_DATA_ALLOCA(ptr, len, ptr_out, len_out) \ - GET_CHARPTR_INT_DATA_ALLOCA (ptr, len, FORMAT_CTEXT, ptr_out, len_out) - - -/* Maybe convert Lisp string's data into ext-format and store the result in - alloca()'ed space. - - You may wonder why this is written in this fashion and not as a - function call. With a little trickery it could certainly be - written this way, but it won't work because of those DAMN GCC WANKERS - who couldn't be bothered to handle alloca() properly on the x86 - architecture. (If you put a call to alloca() in the argument to - a function call, the stack space gets allocated right in the - middle of the arguments to the function call and you are unbelievably - hosed.) */ - -#define GET_STRING_EXT_DATA_ALLOCA(s, fmt, ptr_out, len_out) do \ -{ \ - Extcount gseda_len_out; \ - struct Lisp_String *gseda_s = XSTRING (s); \ - Extbyte * gseda_ptr_out = \ - convert_to_external_format (string_data (gseda_s), \ - string_length (gseda_s), \ - &gseda_len_out, fmt); \ - (ptr_out) = (Extbyte *) alloca (1 + gseda_len_out); \ - memcpy ((void *) ptr_out, gseda_ptr_out, 1 + gseda_len_out); \ - (len_out) = gseda_len_out; \ -} while (0) - - -#define GET_C_STRING_EXT_DATA_ALLOCA(s, fmt, ptr_out) do \ -{ \ - Extcount gcseda_ignored_len; \ - Extbyte *gcseda_ptr_out; \ - \ - GET_STRING_EXT_DATA_ALLOCA (s, fmt, gcseda_ptr_out, \ - gcseda_ignored_len); \ - (ptr_out) = (char *) gcseda_ptr_out; \ -} while (0) - -#define GET_STRING_BINARY_DATA_ALLOCA(s, ptr_out, len_out) \ - GET_STRING_EXT_DATA_ALLOCA (s, FORMAT_BINARY, ptr_out, len_out) -#define GET_C_STRING_BINARY_DATA_ALLOCA(s, ptr_out) \ - GET_C_STRING_EXT_DATA_ALLOCA (s, FORMAT_BINARY, ptr_out) - -#define GET_STRING_FILENAME_DATA_ALLOCA(s, ptr_out, len_out) \ - GET_STRING_EXT_DATA_ALLOCA (s, FORMAT_FILENAME, ptr_out, len_out) -#define GET_C_STRING_FILENAME_DATA_ALLOCA(s, ptr_out) \ - GET_C_STRING_EXT_DATA_ALLOCA (s, FORMAT_FILENAME, ptr_out) - -#define GET_STRING_OS_DATA_ALLOCA(s, ptr_out, len_out) \ - GET_STRING_EXT_DATA_ALLOCA (s, FORMAT_OS, ptr_out, len_out) -#define GET_C_STRING_OS_DATA_ALLOCA(s, ptr_out) \ - GET_C_STRING_EXT_DATA_ALLOCA (s, FORMAT_OS, ptr_out) - -#define GET_STRING_CTEXT_DATA_ALLOCA(s, ptr_out, len_out) \ - GET_STRING_EXT_DATA_ALLOCA (s, FORMAT_CTEXT, ptr_out, len_out) -#define GET_C_STRING_CTEXT_DATA_ALLOCA(s, ptr_out) \ - GET_C_STRING_EXT_DATA_ALLOCA (s, FORMAT_CTEXT, ptr_out) - +#ifdef HAVE_MS_WINDOWS +/* #### kludge!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + Remove this as soon as my Mule code is integrated. */ +#define Qmswindows_tstr Qnative +#endif /************************************************************************/ /* */ @@ -1411,20 +1251,20 @@ void set_buffer_point (struct buffer *buf, Bufpos pos, Bytind bipos); void find_charsets_in_bufbyte_string (Charset_ID *charsets, const Bufbyte *str, Bytecount len); -void find_charsets_in_emchar_string (Charset_ID *charsets, - const Emchar *str, - Charcount len); +void find_charsets_in_charc_string (Charset_ID *charsets, + const Charc *str, + Charcount len); int bufbyte_string_displayed_columns (const Bufbyte *str, Bytecount len); -int emchar_string_displayed_columns (const Emchar *str, Charcount len); -void convert_bufbyte_string_into_emchar_dynarr (const Bufbyte *str, - Bytecount len, - Emchar_dynarr *dyn); +int charc_string_displayed_columns (const Charc *str, Charcount len); +void convert_bufbyte_string_into_charc_dynarr (const Bufbyte *str, + Bytecount len, + Charc_dynarr *dyn); Charcount convert_bufbyte_string_into_emchar_string (const Bufbyte *str, Bytecount len, Emchar *arr); -void convert_emchar_string_into_bufbyte_dynarr (Emchar *arr, int nels, - Bufbyte_dynarr *dyn); -Bufbyte *convert_emchar_string_into_malloced_string (Emchar *arr, int nels, +void convert_charc_string_into_bufbyte_dynarr (Charc *arr, int nels, + Bufbyte_dynarr *dyn); +Bufbyte *convert_charc_string_into_malloced_string (Charc *arr, int nels, Bytecount *len_out); /* from marker.c */ void init_buffer_markers (struct buffer *b);