aboutsummaryrefslogtreecommitdiffstats
path: root/src/doc.c
diff options
context:
space:
mode:
authorKarl Heuer1994-09-27 03:06:52 +0000
committerKarl Heuer1994-09-27 03:06:52 +0000
commite6d12642a88e379005891fbd3725eaddcff59e83 (patch)
tree8d09138a7108eff42bc8f9f378364300e972f1f8 /src/doc.c
parent55ccc0b37b03eaf0a7ab99716e1b6f019da47724 (diff)
downloademacs-e6d12642a88e379005891fbd3725eaddcff59e83.tar.gz
emacs-e6d12642a88e379005891fbd3725eaddcff59e83.zip
(get_doc_string, Fdocumentation, Fdocumentation_property,
store_function_docstring, Fsnarf_documentation): Use type test macros.
Diffstat (limited to 'src/doc.c')
-rw-r--r--src/doc.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/doc.c b/src/doc.c
index 27179680b78..937181e8edf 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -79,8 +79,7 @@ get_doc_string (filepos)
79 int minsize; 79 int minsize;
80 extern char *index (); 80 extern char *index ();
81 81
82 if (XTYPE (Vdoc_directory) != Lisp_String 82 if (!STRINGP (Vdoc_directory) || !STRINGP (Vdoc_file_name))
83 || XTYPE (Vdoc_file_name) != Lisp_String)
84 return Qnil; 83 return Qnil;
85 84
86 minsize = XSTRING (Vdoc_directory)->size; 85 minsize = XSTRING (Vdoc_directory)->size;
@@ -165,9 +164,9 @@ string is passed through `substitute-command-keys'.")
165 if (XVECTOR (fun)->size <= COMPILED_DOC_STRING) 164 if (XVECTOR (fun)->size <= COMPILED_DOC_STRING)
166 return Qnil; 165 return Qnil;
167 tem = XVECTOR (fun)->contents[COMPILED_DOC_STRING]; 166 tem = XVECTOR (fun)->contents[COMPILED_DOC_STRING];
168 if (XTYPE (tem) == Lisp_String) 167 if (STRINGP (tem))
169 doc = tem; 168 doc = tem;
170 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0) 169 else if (INTEGERP (tem) && XINT (tem) >= 0)
171 doc = get_doc_string (XFASTINT (tem)); 170 doc = get_doc_string (XFASTINT (tem));
172 else 171 else
173 return Qnil; 172 return Qnil;
@@ -179,7 +178,7 @@ string is passed through `substitute-command-keys'.")
179 178
180 case Lisp_Cons: 179 case Lisp_Cons:
181 funcar = Fcar (fun); 180 funcar = Fcar (fun);
182 if (XTYPE (funcar) != Lisp_Symbol) 181 if (!SYMBOLP (funcar))
183 return Fsignal (Qinvalid_function, Fcons (fun, Qnil)); 182 return Fsignal (Qinvalid_function, Fcons (fun, Qnil));
184 else if (EQ (funcar, Qkeymap)) 183 else if (EQ (funcar, Qkeymap))
185 return build_string ("Prefix command (definition is a keymap associating keystrokes with\n\ 184 return build_string ("Prefix command (definition is a keymap associating keystrokes with\n\
@@ -188,9 +187,9 @@ subcommands.)");
188 || EQ (funcar, Qautoload)) 187 || EQ (funcar, Qautoload))
189 { 188 {
190 tem = Fcar (Fcdr (Fcdr (fun))); 189 tem = Fcar (Fcdr (Fcdr (fun)));
191 if (XTYPE (tem) == Lisp_String) 190 if (STRINGP (tem))
192 doc = tem; 191 doc = tem;
193 else if (XTYPE (tem) == Lisp_Int && XINT (tem) >= 0) 192 else if (INTEGERP (tem) && XINT (tem) >= 0)
194 doc = get_doc_string (XFASTINT (tem)); 193 doc = get_doc_string (XFASTINT (tem));
195 else 194 else
196 return Qnil; 195 return Qnil;
@@ -231,9 +230,9 @@ translation.")
231 register Lisp_Object tem; 230 register Lisp_Object tem;
232 231
233 tem = Fget (sym, prop); 232 tem = Fget (sym, prop);
234 if (XTYPE (tem) == Lisp_Int) 233 if (INTEGERP (tem))
235 tem = get_doc_string (XINT (tem) > 0 ? XINT (tem) : - XINT (tem)); 234 tem = get_doc_string (XINT (tem) > 0 ? XINT (tem) : - XINT (tem));
236 if (NILP (raw) && XTYPE (tem) == Lisp_String) 235 if (NILP (raw) && STRINGP (tem))
237 return Fsubstitute_command_keys (tem); 236 return Fsubstitute_command_keys (tem);
238 return tem; 237 return tem;
239} 238}
@@ -250,7 +249,7 @@ store_function_docstring (fun, offset)
250 /* The type determines where the docstring is stored. */ 249 /* The type determines where the docstring is stored. */
251 250
252 /* Lisp_Subrs have a slot for it. */ 251 /* Lisp_Subrs have a slot for it. */
253 if (XTYPE (fun) == Lisp_Subr) 252 if (SUBRP (fun))
254 XSUBR (fun)->doc = (char *) - offset; 253 XSUBR (fun)->doc = (char *) - offset;
255 254
256 /* If it's a lisp form, stick it in the form. */ 255 /* If it's a lisp form, stick it in the form. */
@@ -262,8 +261,7 @@ store_function_docstring (fun, offset)
262 if (EQ (tem, Qlambda) || EQ (tem, Qautoload)) 261 if (EQ (tem, Qlambda) || EQ (tem, Qautoload))
263 { 262 {
264 tem = Fcdr (Fcdr (fun)); 263 tem = Fcdr (Fcdr (fun));
265 if (CONSP (tem) && 264 if (CONSP (tem) && INTEGERP (XCONS (tem)->car))
266 XTYPE (XCONS (tem)->car) == Lisp_Int)
267 XFASTINT (XCONS (tem)->car) = offset; 265 XFASTINT (XCONS (tem)->car) = offset;
268 } 266 }
269 else if (EQ (tem, Qmacro)) 267 else if (EQ (tem, Qmacro))
@@ -271,7 +269,7 @@ store_function_docstring (fun, offset)
271 } 269 }
272 270
273 /* Bytecode objects sometimes have slots for it. */ 271 /* Bytecode objects sometimes have slots for it. */
274 else if (XTYPE (fun) == Lisp_Compiled) 272 else if (COMPILEDP (fun))
275 { 273 {
276 /* This bytecode object must have a slot for the 274 /* This bytecode object must have a slot for the
277 docstring, since we've found a docstring for it. */ 275 docstring, since we've found a docstring for it. */
@@ -358,7 +356,7 @@ when doc strings are referred to later in the dumped Emacs.")
358 { 356 {
359 end = index (p, '\n'); 357 end = index (p, '\n');
360 sym = oblookup (Vobarray, p + 2, end - p - 2); 358 sym = oblookup (Vobarray, p + 2, end - p - 2);
361 if (XTYPE (sym) == Lisp_Symbol) 359 if (SYMBOLP (sym))
362 { 360 {
363 /* Attach a docstring to a variable? */ 361 /* Attach a docstring to a variable? */
364 if (p[1] == 'V') 362 if (p[1] == 'V')