+/* Scanning the DOC files and placing docstring offsets into functions. */
+
+static void
+store_function_docstring (fun, offset)
+ Lisp_Object fun;
+ int offset;
+{
+ fun = indirect_function (fun);
+
+ /* The type determines where the docstring is stored. */
+
+ /* Lisp_Subrs have a slot for it. */
+ if (XTYPE (fun) == Lisp_Subr)
+ XSUBR (fun)->doc = (char *) - offset;
+
+ /* If it's a lisp form, stick it in the form. */
+ else if (CONSP (fun))
+ {
+ Lisp_Object tem;
+
+ tem = XCONS (fun)->car;
+ if (EQ (tem, Qlambda) || EQ (tem, Qautoload))
+ {
+ tem = Fcdr (Fcdr (fun));
+ if (CONSP (tem) &&
+ XTYPE (XCONS (tem)->car) == Lisp_Int)
+ XFASTINT (XCONS (tem)->car) = offset;
+ }
+ else if (EQ (tem, Qmacro))
+ store_function_docstring (XCONS (fun)->cdr, offset);
+ }
+
+ /* Bytecode objects sometimes have slots for it. */
+ else if (XTYPE (fun) == Lisp_Compiled)
+ {
+ /* This bytecode object must have a slot for the
+ docstring, since we've found a docstring for it. */
+ if (XVECTOR (fun)->size <= COMPILED_DOC_STRING)
+ abort ();
+
+ XFASTINT (XVECTOR (fun)->contents[COMPILED_DOC_STRING]) = offset;
+ }
+}
+
+