+int
+read_bytecode_char (unreadflag)
+ int unreadflag;
+{
+ if (unreadflag)
+ {
+ read_bytecode_pointer--;
+ return 0;
+ }
+ return *read_bytecode_pointer++;
+}
+
+/* Extract a doc string from a file. FILEPOS says where to get it.
+ If it is an integer, use that position in the standard DOC-... file.
+ If it is (FILE . INTEGER), use FILE as the file name
+ and INTEGER as the position in that file.
+ But if INTEGER is negative, make it positive.
+ (A negative integer is used for user variables, so we can distinguish
+ them without actually fetching the doc string.)
+
+ If UNIBYTE is nonzero, always make a unibyte string.
+
+ If DEFINITION is nonzero, 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 (filepos, unibyte, definition)
+ Lisp_Object filepos;
+ int unibyte, definition;
+{
+ char *from, *to;
+ register int fd;
+ register char *name;
+ register char *p, *p1;
+ int minsize;
+ int offset, position;
+ Lisp_Object file, tem;
+
+ if (INTEGERP (filepos))
+ {
+ file = Vdoc_file_name;
+ position = XINT (filepos);
+ }
+ else if (CONSP (filepos))
+ {
+ file = XCAR (filepos);
+ position = XINT (XCDR (filepos));
+ if (position < 0)
+ position = - position;
+ }
+ else
+ return Qnil;
+
+ if (!STRINGP (Vdoc_directory))
+ return Qnil;
+
+ if (!STRINGP (file))
+ return Qnil;
+
+ /* Put the file name in NAME as a C string.
+ If it is relative, combine it with Vdoc_directory. */
+
+ tem = Ffile_name_absolute_p (file);
+ if (NILP (tem))
+ {
+ minsize = XSTRING (Vdoc_directory)->size;
+ /* sizeof ("../etc/") == 8 */
+ if (minsize < 8)
+ minsize = 8;
+ name = (char *) alloca (minsize + XSTRING (file)->size + 8);
+ strcpy (name, XSTRING (Vdoc_directory)->data);
+ strcat (name, XSTRING (file)->data);
+ munge_doc_file_name (name);
+ }
+ else
+ {
+ name = (char *) XSTRING (file)->data;
+ }
+
+ fd = emacs_open (name, O_RDONLY, 0);