/* Record indices of function doc strings stored in a file.
- Copyright (C) 1985, 1986, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 1985-1986, 1993-1995, 1997-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
Lisp_Object Qfunction_documentation;
+extern Lisp_Object Qclosure;
/* Buffer used for reading from documentation file. */
static char *get_doc_string_buffer;
static int get_doc_string_buffer_size;
if (minsize < 8)
minsize = 8;
name = (char *) alloca (minsize + SCHARS (file) + 8);
- strcpy (name, SDATA (Vdoc_directory));
- strcat (name, SDATA (file));
+ strcpy (name, SSDATA (Vdoc_directory));
+ strcat (name, SSDATA (file));
}
else
{
- name = (char *) SDATA (file);
+ name = SSDATA (file);
}
fd = emacs_open (name, O_RDONLY, 0);
/* Preparing to dump; DOC file is probably not installed.
So check in ../etc. */
strcpy (name, "../etc/");
- strcat (name, SDATA (file));
+ strcat (name, SSDATA (file));
fd = emacs_open (name, O_RDONLY, 0);
}
the same way we would read bytes from a file. */
if (definition)
{
- read_bytecode_pointer = get_doc_string_buffer + offset;
+ read_bytecode_pointer = (unsigned char *) get_doc_string_buffer + offset;
return Fread (Qlambda);
}
else
{
/* The data determines whether the string is multibyte. */
- EMACS_INT nchars = multibyte_chars_in_text (get_doc_string_buffer + offset,
- to - (get_doc_string_buffer + offset));
+ EMACS_INT nchars =
+ multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer
+ + offset),
+ to - (get_doc_string_buffer + offset));
return make_string_from_bytes (get_doc_string_buffer + offset,
nchars,
to - (get_doc_string_buffer + offset));
else
return Qnil;
}
+ else if (FUNVECP (fun))
+ {
+ /* Unless otherwise handled, funvecs have no documentation. */
+ return Qnil;
+ }
else if (STRINGP (fun) || VECTORP (fun))
{
return build_string ("Keyboard macro.");
else
return Qnil;
}
+ else if (EQ (funcar, Qclosure))
+ return Fdocumentation (Fcdr (XCDR (fun)), raw);
else if (EQ (funcar, Qmacro))
return Fdocumentation (Fcdr (fun), raw);
else
}
else if (!STRINGP (tem))
/* Feval protects its argument. */
- tem = Feval (tem);
+ tem = Feval (tem, Qnil);
if (NILP (raw) && STRINGP (tem))
tem = Fsubstitute_command_keys (tem);
}
else if (EQ (tem, Qmacro))
store_function_docstring (XCDR (fun), offset);
+ else if (EQ (tem, Qclosure))
+ store_function_docstring (Fcdr (XCDR (fun)), offset);
}
/* Bytecode objects sometimes have slots for it. */
CHECK_STRING (Vdoc_directory);
name = (char *) alloca (SCHARS (filename)
+ SCHARS (Vdoc_directory) + 1);
- strcpy (name, SDATA (Vdoc_directory));
+ strcpy (name, SSDATA (Vdoc_directory));
}
- strcat (name, SDATA (filename)); /*** Add this line ***/
+ strcat (name, SSDATA (filename)); /*** Add this line ***/
/* Vbuild_files is nil when temacs is run, and non-nil after that. */
if (NILP (Vbuild_files))
}
sym = oblookup (Vobarray, p + 2,
- multibyte_chars_in_text (p + 2, end - p - 2),
+ multibyte_chars_in_text ((unsigned char *) p + 2,
+ end - p - 2),
end - p - 2);
/* Check skip_file so that when a function is defined several
times in different files (typically, once in xterm, once in
a new string, without any text properties, is returned. */)
(Lisp_Object string)
{
- unsigned char *buf;
+ char *buf;
int changed = 0;
register unsigned char *strp;
- register unsigned char *bufp;
+ register char *bufp;
EMACS_INT idx;
EMACS_INT bsize;
Lisp_Object tem;
keymap = Voverriding_local_map;
bsize = SBYTES (string);
- bufp = buf = (unsigned char *) xmalloc (bsize);
+ bufp = buf = (char *) xmalloc (bsize);
strp = SDATA (string);
while (strp < SDATA (string) + SBYTES (string))
/* Save STRP in IDX. */
idx = strp - SDATA (string);
- name = Fintern (make_string (start, length_byte), Qnil);
+ name = Fintern (make_string ((char *) start, length_byte), Qnil);
do_remap:
tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil);
if (NILP (tem)) /* but not on any keys */
{
EMACS_INT offset = bufp - buf;
- buf = (unsigned char *) xrealloc (buf, bsize += 4);
+ buf = (char *) xrealloc (buf, bsize += 4);
bufp = buf + offset;
memcpy (bufp, "M-x ", 4);
bufp += 4;
/* Get the value of the keymap in TEM, or nil if undefined.
Do this while still in the user's current buffer
in case it is a local variable. */
- name = Fintern (make_string (start, length_byte), Qnil);
+ name = Fintern (make_string ((char *) start, length_byte), Qnil);
tem = Fboundp (name);
if (! NILP (tem))
{
subst:
{
EMACS_INT offset = bufp - buf;
- buf = (unsigned char *) xrealloc (buf, bsize += length_byte);
+ buf = (char *) xrealloc (buf, bsize += length_byte);
bufp = buf + offset;
memcpy (bufp, start, length_byte);
bufp += length_byte;
nchars += length;
/* Check STRING again in case gc relocated it. */
- strp = (unsigned char *) SDATA (string) + idx;
+ strp = SDATA (string) + idx;
}
}
else if (! multibyte) /* just copy other chars */
defsubr (&Ssnarf_documentation);
defsubr (&Ssubstitute_command_keys);
}
-