Lisp_Object object;
{
if (SYMBOLP (object)
- && XSYMBOL (object)->name->data[0] == ':'
+ && SREF (SYMBOL_NAME (object), 0) == ':'
&& SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (object))
return Qt;
return Qnil;
register Lisp_Object name;
CHECK_SYMBOL (symbol);
- XSETSTRING (name, XSYMBOL (symbol)->name);
+ name = SYMBOL_NAME (symbol);
return name;
}
return definition;
}
-DEFUN ("defalias", Fdefalias, Sdefalias, 2, 2, 0,
+extern Lisp_Object Qfunction_documentation;
+
+DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
-Associates the function with the current load file, if any. */)
- (symbol, definition)
- register Lisp_Object symbol, definition;
+Associates the function with the current load file, if any.
+The optional third argument DOCSTRING specifies the documentation string
+for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string
+determined by DEFINITION. */)
+ (symbol, definition, docstring)
+ register Lisp_Object symbol, definition, docstring;
{
definition = Ffset (symbol, definition);
LOADHIST_ATTACH (symbol);
+ if (!NILP (docstring))
+ Fput (symbol, Qfunction_documentation, docstring);
return definition;
}
*XINTFWD (valcontents)->intvar = XINT (newval);
if (*XINTFWD (valcontents)->intvar != XINT (newval))
error ("Value out of range for variable `%s'",
- XSYMBOL (symbol)->name->data);
+ SDATA (SYMBOL_NAME (symbol)));
break;
case Lisp_Misc_Boolfwd:
type = PER_BUFFER_TYPE (offset);
if (XINT (type) == -1)
- error ("Variable %s is read-only", XSYMBOL (symbol)->name->data);
+ error ("Variable %s is read-only", SDATA (SYMBOL_NAME (symbol)));
if (! NILP (type) && ! NILP (newval)
&& XTYPE (newval) != XINT (type))
and load that binding. */
else
{
- tem1 = Fcons (symbol, Fcdr (current_alist_element));
+ tem1 = Fcons (symbol, XCDR (current_alist_element));
buf->local_var_alist
= Fcons (tem1, buf->local_var_alist);
}
do
{
val = Feval (Fcar (Fcdr (args_left)));
- symbol = Fcar (args_left);
+ symbol = XCAR (args_left);
Fset_default (symbol, val);
- args_left = Fcdr (Fcdr (args_left));
+ args_left = Fcdr (XCDR (args_left));
}
while (!NILP (args_left));
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
- error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data);
+ error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
return variable;
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
- error ("Symbol %s may not be buffer-local", XSYMBOL (variable)->name->data);
+ error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
{
doc: /* Enable VARIABLE to have frame-local bindings.
When a frame-local binding exists in the current frame,
it is in effect whenever the current buffer has no buffer-local binding.
-A frame-local binding is actual a frame parameter value;
+A frame-local binding is actually a frame parameter value;
thus, any given frame has a local binding for VARIABLE
if it has a value for the frame parameter named VARIABLE.
-See `modify-frame-parameters'. */)
+See `modify-frame-parameters' for how to set frame parameters. */)
(variable)
register Lisp_Object variable;
{
valcontents = SYMBOL_VALUE (variable);
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)
|| BUFFER_OBJFWDP (valcontents))
- error ("Symbol %s may not be frame-local", XSYMBOL (variable)->name->data);
+ error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
if (BUFFER_LOCAL_VALUEP (valcontents)
|| SOME_BUFFER_LOCAL_VALUEP (valcontents))
{
int c, idxval_byte;
- if (idxval < 0 || idxval >= XSTRING (array)->size)
+ if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
if (! STRING_MULTIBYTE (array))
- return make_number ((unsigned char) XSTRING (array)->data[idxval]);
+ return make_number ((unsigned char) SREF (array, idxval));
idxval_byte = string_char_to_byte (array, idxval);
- c = STRING_CHAR (&XSTRING (array)->data[idxval_byte],
- STRING_BYTES (XSTRING (array)) - idxval_byte);
+ c = STRING_CHAR (SDATA (array) + idxval_byte,
+ SBYTES (array) - idxval_byte);
return make_number (c);
}
else if (BOOL_VECTOR_P (array))
int idxval_byte, prev_bytes, new_bytes;
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
- if (idxval < 0 || idxval >= XSTRING (array)->size)
+ if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
CHECK_NUMBER (newelt);
idxval_byte = string_char_to_byte (array, idxval);
- p1 = &XSTRING (array)->data[idxval_byte];
+ p1 = SDATA (array) + idxval_byte;
PARSE_MULTIBYTE_SEQ (p1, nbytes - idxval_byte, prev_bytes);
new_bytes = CHAR_STRING (XINT (newelt), p0);
if (prev_bytes != new_bytes)
{
/* We must relocate the string data. */
- int nchars = XSTRING (array)->size;
- int nbytes = STRING_BYTES (XSTRING (array));
+ int nchars = SCHARS (array);
+ int nbytes = SBYTES (array);
unsigned char *str;
str = (nbytes <= MAX_ALLOCA
? (unsigned char *) alloca (nbytes)
: (unsigned char *) xmalloc (nbytes));
- bcopy (XSTRING (array)->data, str, nbytes);
+ bcopy (SDATA (array), str, nbytes);
allocate_string_data (XSTRING (array), nchars,
nbytes + new_bytes - prev_bytes);
- bcopy (str, XSTRING (array)->data, idxval_byte);
- p1 = XSTRING (array)->data + idxval_byte;
+ bcopy (str, SDATA (array), idxval_byte);
+ p1 = SDATA (array) + idxval_byte;
bcopy (str + idxval_byte + prev_bytes, p1 + new_bytes,
nbytes - (idxval_byte + prev_bytes));
if (nbytes > MAX_ALLOCA)
}
else
{
- if (idxval < 0 || idxval >= XSTRING (array)->size)
+ if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
CHECK_NUMBER (newelt);
if (XINT (newelt) < 0 || SINGLE_BYTE_CHAR_P (XINT (newelt)))
- XSTRING (array)->data[idxval] = XINT (newelt);
+ SSET (array, idxval, XINT (newelt));
else
{
/* We must relocate the string data while converting it to
multibyte. */
int idxval_byte, prev_bytes, new_bytes;
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
- unsigned char *origstr = XSTRING (array)->data, *str;
+ unsigned char *origstr = SDATA (array), *str;
int nchars, nbytes;
- nchars = XSTRING (array)->size;
+ nchars = SCHARS (array);
nbytes = idxval_byte = count_size_as_multibyte (origstr, idxval);
nbytes += count_size_as_multibyte (origstr + idxval,
nchars - idxval);
str = (nbytes <= MAX_ALLOCA
? (unsigned char *) alloca (nbytes)
: (unsigned char *) xmalloc (nbytes));
- copy_text (XSTRING (array)->data, str, nchars, 0, 1);
+ copy_text (SDATA (array), str, nchars, 0, 1);
PARSE_MULTIBYTE_SEQ (str + idxval_byte, nbytes - idxval_byte,
prev_bytes);
new_bytes = CHAR_STRING (XINT (newelt), p0);
allocate_string_data (XSTRING (array), nchars,
nbytes + new_bytes - prev_bytes);
- bcopy (str, XSTRING (array)->data, idxval_byte);
- p1 = XSTRING (array)->data + idxval_byte;
+ bcopy (str, SDATA (array), idxval_byte);
+ p1 = SDATA (array) + idxval_byte;
while (new_bytes--)
*p1++ = *p0++;
bcopy (str + idxval_byte + prev_bytes, p1,
/* Skip any whitespace at the front of the number. Some versions of
atoi do this anyway, so we might as well make Emacs lisp consistent. */
- p = XSTRING (string)->data;
+ p = SDATA (string);
while (*p == ' ' || *p == '\t')
p++;