#include <config.h>
#include <sys/types.h>
-#include <sys/file.h> /* Must be after sys/types.h for USG*/
-#include <setjmp.h>
+#include <sys/file.h> /* Must be after sys/types.h for USG. */
#include <fcntl.h>
#include <unistd.h>
Lisp_Object Qfunction_documentation;
-extern Lisp_Object Qclosure;
/* Buffer used for reading from documentation file. */
static char *get_doc_string_buffer;
static ptrdiff_t get_doc_string_buffer_size;
static unsigned char *read_bytecode_pointer;
-/* readchar in lread.c calls back here to fetch the next byte.
+/* `readchar' in lread.c calls back here to fetch the next byte.
If UNREADFLAG is 1, we unread a byte. */
int
-read_bytecode_char (int unreadflag)
+read_bytecode_char (bool unreadflag)
{
if (unreadflag)
{
(e.g. because the file has been modified and the location is stale),
return nil.
- If UNIBYTE is nonzero, always make a unibyte string.
+ If UNIBYTE, always make a unibyte string.
- If DEFINITION is nonzero, assume this is for reading
+ If DEFINITION, assume this is for reading
a dynamic function definition; convert the bytestring
and the constants vector with appropriate byte handling,
and return a cons cell. */
Lisp_Object
-get_doc_string (Lisp_Object filepos, int unibyte, int definition)
+get_doc_string (Lisp_Object filepos, bool unibyte, bool definition)
{
- char *from, *to;
- register int fd;
- register char *name;
- register char *p, *p1;
+ char *from, *to, *name, *p, *p1;
+ int fd;
ptrdiff_t minsize;
int offset;
EMACS_INT position;
}
#endif
if (fd < 0)
- error ("Cannot open doc string file \"%s\"", name);
+ return concat3 (build_string ("Cannot open doc string file \""),
+ file, build_string ("\"\n"));
}
/* Seek only to beginning of disk block. */
return get_doc_string (filepos, 0, 1);
}
-static int
+static bool
reread_doc_file (Lisp_Object file)
{
#if 0
Lisp_Object fun;
Lisp_Object funcar;
Lisp_Object doc;
- int try_reload = 1;
+ bool try_reload = 1;
documentation:
doc = Qnil;
- if (SYMBOLP (function))
- {
- Lisp_Object tem = Fget (function, Qfunction_documentation);
- if (!NILP (tem))
- return Fdocumentation_property (function, Qfunction_documentation,
- raw);
- }
-
fun = Findirect_function (function, Qnil);
+ if (CONSP (fun) && EQ (XCAR (fun), Qmacro))
+ fun = XCDR (fun);
if (SUBRP (fun))
{
if (XSUBR (fun)->doc == 0)
else
return Qnil;
}
- else if (EQ (funcar, Qmacro))
- return Fdocumentation (Fcdr (fun), raw);
else
goto oops;
}
xsignal1 (Qinvalid_function, fun);
}
- /* Check for an advised function. Its doc string
- has an `ad-advice-info' text property. */
+ /* Check for a dynamic docstring. These come with
+ a dynamic-docstring-function text property. */
if (STRINGP (doc))
{
- Lisp_Object innerfunc;
- innerfunc = Fget_text_property (make_number (0),
- intern ("ad-advice-info"),
+ Lisp_Object func
+ = Fget_text_property (make_number (0),
+ intern ("dynamic-docstring-function"),
doc);
- if (! NILP (innerfunc))
- doc = call1 (intern ("ad-make-advised-docstring"), innerfunc);
+ if (!NILP (func))
+ /* Pass both `doc' and `function' since `function' can be needed, and
+ finding `doc' can be annoying: calling `documentation' is not an
+ option because it would infloop. */
+ doc = call2 (func, doc, function);
}
/* If DOC is 0, it's typically because of a dumped file missing
aren't strings. */)
(Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw)
{
- int try_reload = 1;
+ bool try_reload = 1;
Lisp_Object tem;
documentation_property:
{
tem = Fcdr (Fcdr (fun));
if (CONSP (tem) && INTEGERP (XCAR (tem)))
+ /* FIXME: This modifies typically pure hash-cons'd data, so its
+ correctness is quite delicate. */
XSETCAR (tem, make_number (offset));
}
else if (EQ (tem, Qmacro))
{
int fd;
char buf[1024 + 1];
- register int filled;
- register EMACS_INT pos;
- register char *p;
+ int filled;
+ EMACS_INT pos;
Lisp_Object sym;
- char *name;
- int skip_file = 0;
+ char *p, *name;
+ bool skip_file = 0;
CHECK_STRING (filename);
(Lisp_Object string)
{
char *buf;
- int changed = 0;
- register unsigned char *strp;
- register char *bufp;
+ bool changed = 0;
+ unsigned char *strp;
+ char *bufp;
ptrdiff_t idx;
ptrdiff_t bsize;
Lisp_Object tem;
ptrdiff_t length, length_byte;
Lisp_Object name;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
- int multibyte;
+ bool multibyte;
ptrdiff_t nchars;
if (NILP (string))
else if (strp[0] == '\\' && strp[1] == '[')
{
ptrdiff_t start_idx;
- int follow_remap = 1;
+ bool follow_remap = 1;
changed = 1;
strp += 2; /* skip \[ */