/* Random utility Lisp functions.
- Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 1985-1987, 1993-1995, 1997-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <config.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <time.h>
#include <setjmp.h>
#define NULL ((POINTER_TYPE *)0)
#endif
-/* Nonzero enables use of dialog boxes for questions
- asked by mouse commands. */
-int use_dialog_box;
-
-/* Nonzero enables use of a file dialog for file name
- questions asked by mouse commands. */
-int use_file_dialog;
-
Lisp_Object Qstring_lessp, Qprovide, Qrequire;
Lisp_Object Qyes_or_no_p_history;
Lisp_Object Qcursor_in_echo_area;
copy_text (SDATA (string), buf, SBYTES (string),
0, 1);
- ret = make_multibyte_string (buf, SCHARS (string), nbytes);
+ ret = make_multibyte_string ((char *) buf, SCHARS (string), nbytes);
SAFE_FREE ();
return ret;
/* If all the chars are ASCII, they won't need any more bytes once
converted. */
if (nbytes == SBYTES (string))
- return make_multibyte_string (SDATA (string), nbytes, nbytes);
+ return make_multibyte_string (SSDATA (string), nbytes, nbytes);
SAFE_ALLOCA (buf, unsigned char *, nbytes);
memcpy (buf, SDATA (string), SBYTES (string));
str_to_multibyte (buf, nbytes, SBYTES (string));
- ret = make_multibyte_string (buf, SCHARS (string), nbytes);
+ ret = make_multibyte_string ((char *) buf, SCHARS (string), nbytes);
SAFE_FREE ();
return ret;
copy_text (SDATA (string), buf, SBYTES (string),
1, 0);
- ret = make_unibyte_string (buf, nchars);
+ ret = make_unibyte_string ((char *) buf, nchars);
SAFE_FREE ();
return ret;
memcpy (str, SDATA (string), bytes);
bytes = str_as_unibyte (str, bytes);
- string = make_unibyte_string (str, bytes);
+ string = make_unibyte_string ((char *) str, bytes);
xfree (str);
}
return string;
if (converted < chars)
error ("Can't convert the %dth character to unibyte", converted);
- string = make_unibyte_string (str, chars);
+ string = make_unibyte_string ((char *) str, chars);
xfree (str);
}
return string;
if (STRINGP (string))
{
- res = make_specified_string (SDATA (string) + from_byte,
+ res = make_specified_string (SSDATA (string) + from_byte,
to_char - from_char, to_byte - from_byte,
STRING_MULTIBYTE (string));
copy_text_properties (make_number (from_char), make_number (to_char),
args_out_of_range_3 (string, make_number (from_char),
make_number (to_char));
- return make_specified_string (SDATA (string) + from_byte,
+ return make_specified_string (SSDATA (string) + from_byte,
to_char - from_char, to_byte - from_byte,
STRING_MULTIBYTE (string));
}
if (STRINGP (string))
{
- res = make_specified_string (SDATA (string) + from_byte,
+ res = make_specified_string (SSDATA (string) + from_byte,
to - from, to_byte - from_byte,
STRING_MULTIBYTE (string));
copy_text_properties (make_number (from), make_number (to),
DEFUN ("yes-or-no-p", Fyes_or_no_p, Syes_or_no_p, 1, 1, 0,
doc: /* Ask user a yes-or-no question. Return t if answer is yes.
-Takes one argument, which is the string to display to ask the question.
-It should end in a space; `yes-or-no-p' adds `(yes or no) ' to it.
-The user must confirm the answer with RET,
-and can edit it until it has been confirmed.
+PROMPT is the string to display to ask the question. It should end in
+a space; `yes-or-no-p' adds \"(yes or no) \" to it.
+
+The user must confirm the answer with RET, and can edit it until it
+has been confirmed.
Under a windowing system a dialog box will be used if `last-nonmenu-event'
is nil, and `use-dialog-box' is non-nil. */)
ans = Fdowncase (Fread_from_minibuffer (prompt, Qnil, Qnil, Qnil,
Qyes_or_no_p_history, Qnil,
Qnil));
- if (SCHARS (ans) == 3 && !strcmp (SDATA (ans), "yes"))
+ if (SCHARS (ans) == 3 && !strcmp (SSDATA (ans), "yes"))
{
UNGCPRO;
return Qt;
}
- if (SCHARS (ans) == 2 && !strcmp (SDATA (ans), "no"))
+ if (SCHARS (ans) == 2 && !strcmp (SSDATA (ans), "no"))
{
UNGCPRO;
return Qnil;
return ret;
}
\f
-Lisp_Object Vfeatures, Qsubfeatures;
+Lisp_Object Qsubfeatures;
DEFUN ("featurep", Ffeaturep, Sfeaturep, 1, 2, 0,
doc: /* Return t if FEATURE is present in this Emacs.
allength += allength / MIME_LINE_LENGTH + 1 + 6;
SAFE_ALLOCA (encoded, char *, allength);
- encoded_length = base64_encode_1 (BYTE_POS_ADDR (ibeg), encoded, length,
- NILP (no_line_break),
+ encoded_length = base64_encode_1 ((char *) BYTE_POS_ADDR (ibeg),
+ encoded, length, NILP (no_line_break),
!NILP (current_buffer->enable_multibyte_characters));
if (encoded_length > allength)
abort ();
/* We need to allocate enough room for decoding the text. */
SAFE_ALLOCA (encoded, char *, allength);
- encoded_length = base64_encode_1 (SDATA (string),
+ encoded_length = base64_encode_1 (SSDATA (string),
encoded, length, NILP (no_line_break),
STRING_MULTIBYTE (string));
if (encoded_length > allength)
{
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, bytes);
+ c = STRING_CHAR_AND_LENGTH ((unsigned char *) from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, bytes);
+ c = STRING_CHAR_AND_LENGTH ((unsigned char *) from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
if (multibyte)
{
- c = STRING_CHAR_AND_LENGTH (from + i, bytes);
+ c = STRING_CHAR_AND_LENGTH ((unsigned char *) from + i, bytes);
if (CHAR_BYTE8_P (c))
c = CHAR_TO_BYTE8 (c);
else if (c >= 256)
SAFE_ALLOCA (decoded, char *, allength);
move_gap_both (XFASTINT (beg), ibeg);
- decoded_length = base64_decode_1 (BYTE_POS_ADDR (ibeg), decoded, length,
+ decoded_length = base64_decode_1 ((char *) BYTE_POS_ADDR (ibeg),
+ decoded, length,
multibyte, &inserted_chars);
if (decoded_length > allength)
abort ();
SAFE_ALLOCA (decoded, char *, length);
/* The decoded result should be unibyte. */
- decoded_length = base64_decode_1 (SDATA (string), decoded, length,
+ decoded_length = base64_decode_1 (SSDATA (string), decoded, length,
0, NULL);
if (decoded_length > length)
abort ();
(Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror)
{
unsigned char digest[16];
- unsigned char value[33];
+ char value[33];
int i;
EMACS_INT size;
EMACS_INT size_byte = 0;
object = code_convert_string (object, coding_system, Qnil, 1, 0, 0);
}
- md5_buffer (SDATA (object) + start_byte,
+ md5_buffer (SSDATA (object) + start_byte,
SBYTES (object) - (size_byte - end_byte),
digest);
Fset (Qyes_or_no_p_history, Qnil);
- DEFVAR_LISP ("features", &Vfeatures,
+ DEFVAR_LISP ("features", Vfeatures,
doc: /* A list of symbols which are the features of the executing Emacs.
Used by `featurep' and `require', and altered by `provide'. */);
Vfeatures = Fcons (intern_c_string ("emacs"), Qnil);
staticpro (&Qpaper);
#endif /* HAVE_LANGINFO_CODESET */
- DEFVAR_BOOL ("use-dialog-box", &use_dialog_box,
+ DEFVAR_BOOL ("use-dialog-box", use_dialog_box,
doc: /* *Non-nil means mouse commands use dialog boxes to ask questions.
This applies to `y-or-n-p' and `yes-or-no-p' questions asked by commands
invoked by mouse clicks and mouse menu items.
non-nil. */);
use_dialog_box = 1;
- DEFVAR_BOOL ("use-file-dialog", &use_file_dialog,
+ DEFVAR_BOOL ("use-file-dialog", use_file_dialog,
doc: /* *Non-nil means mouse commands use a file dialog to ask for files.
This applies to commands from menus and tool bar buttons even when
they are initiated from the keyboard. If `use-dialog-box' is nil,
init_fns (void)
{
}
-
-/* arch-tag: 787f8219-5b74-46bd-8469-7e1cc475fa31
- (do not change this comment) */