Mercurial > hg > xemacs-beta
comparison lib-src/make-docfile.c @ 3368:959746c534f6
[xemacs-hg @ 2006-04-29 16:15:21 by aidan]
Support builtin functions in find-function.
author | aidan |
---|---|
date | Sat, 29 Apr 2006 16:15:31 +0000 |
parents | 43ba9e13ee82 |
children | c785f98c6737 |
comparison
equal
deleted
inserted
replaced
3367:84ee3ca77e7f | 3368:959746c534f6 |
---|---|
42 */ | 42 */ |
43 | 43 |
44 #include <config.h> | 44 #include <config.h> |
45 #include <sysfile.h> | 45 #include <sysfile.h> |
46 | 46 |
47 #include <assert.h> | |
47 #include <stdio.h> | 48 #include <stdio.h> |
48 #include <stdlib.h> | 49 #include <stdlib.h> |
49 #include <string.h> | 50 #include <string.h> |
50 #include <ctype.h> | 51 #include <ctype.h> |
51 | 52 |
56 (('A' <= c && c <= 'Z') || \ | 57 (('A' <= c && c <= 'Z') || \ |
57 ('a' <= c && c <= 'z') || \ | 58 ('a' <= c && c <= 'z') || \ |
58 ('0' <= c && c <= '9') || \ | 59 ('0' <= c && c <= '9') || \ |
59 (c == '_')) | 60 (c == '_')) |
60 | 61 |
62 static void put_filename (const char *filename); | |
61 static int scan_file (const char *filename); | 63 static int scan_file (const char *filename); |
62 static int read_c_string (FILE *, int, int); | 64 static int read_c_string (FILE *, int, int); |
63 static void write_c_args (FILE *out, const char *func, char *buf, int minargs, | 65 static void write_c_args (FILE *out, const char *func, char *buf, int minargs, |
64 int maxargs); | 66 int maxargs); |
65 static int scan_c_file (const char *filename, const char *mode); | 67 static int scan_c_file (const char *filename, const char *mode); |
259 | 261 |
260 #ifndef VMS | 262 #ifndef VMS |
261 exit (err_count > 0); | 263 exit (err_count > 0); |
262 #endif /* VMS */ | 264 #endif /* VMS */ |
263 return err_count > 0; | 265 return err_count > 0; |
266 } | |
267 | |
268 /* Add a source file name boundary in the output file. */ | |
269 static void | |
270 put_filename (const char *filename) | |
271 { | |
272 const char *tmp; | |
273 | |
274 /* Why are we cutting this off? */ | |
275 for (tmp = filename; *tmp; tmp++) | |
276 { | |
277 if (IS_DIRECTORY_SEP(*tmp)) | |
278 filename = tmp + 1; | |
279 } | |
280 | |
281 /* <= because sizeof includes the nul byte at the end. Not quite right, | |
282 because it should include the length of the symbol + "\037[VF]" instead | |
283 of simply 10. */ | |
284 assert(sizeof("\037S\n") + strlen(filename) + 10 | |
285 <= DOC_MAX_FILENAME_LENGTH); | |
286 | |
287 putc (037, outfile); | |
288 putc ('S', outfile); | |
289 fprintf (outfile, "%s\n", filename); | |
264 } | 290 } |
265 | 291 |
266 /* Read file FILENAME and output its doc strings to outfile. */ | 292 /* Read file FILENAME and output its doc strings to outfile. */ |
267 /* Return 1 if file is not found, 0 if it is found. */ | 293 /* Return 1 if file is not found, 0 if it is found. */ |
268 | 294 |
862 /* End XEmacs addition */ | 888 /* End XEmacs addition */ |
863 | 889 |
864 if (defunflag || defvarflag || c == '"') | 890 if (defunflag || defvarflag || c == '"') |
865 { | 891 { |
866 /* XEmacs change: the original code is in the "else" clause */ | 892 /* XEmacs change: the original code is in the "else" clause */ |
893 /* XXX Must modify the documentation file name code to handle | |
894 ELLCCs */ | |
867 if (ellcc) | 895 if (ellcc) |
868 fprintf (outfile, " CDOC%s(\"%s\", \"\\\n", | 896 fprintf (outfile, " CDOC%s(\"%s\", \"\\\n", |
869 defvarflag ? "SYM" : "SUBR", globalbuf); | 897 defvarflag ? "SYM" : "SUBR", globalbuf); |
870 else | 898 else |
871 { | 899 { |
900 put_filename (filename); /* XEmacs addition */ | |
872 putc (037, outfile); | 901 putc (037, outfile); |
873 putc (defvarflag ? 'V' : 'F', outfile); | 902 putc (defvarflag ? 'V' : 'F', outfile); |
874 fprintf (outfile, "%s\n", globalbuf); | 903 fprintf (outfile, "%s\n", globalbuf); |
875 } | 904 } |
876 c = read_c_string (infile, 1, defunflag || defvarflag); | 905 c = read_c_string (infile, 1, defunflag || defvarflag); |
961 from that, it is always the .elc file that we look at, and they are no | 990 from that, it is always the .elc file that we look at, and they are no |
962 problem because byte-compiler output follows this convention. | 991 problem because byte-compiler output follows this convention. |
963 The NAME and DOCSTRING are output. | 992 The NAME and DOCSTRING are output. |
964 NAME is preceded by `F' for a function or `V' for a variable. | 993 NAME is preceded by `F' for a function or `V' for a variable. |
965 An entry is output only if DOCSTRING has \ newline just after the opening " | 994 An entry is output only if DOCSTRING has \ newline just after the opening " |
995 | |
996 Adds the filename a symbol or function was found in before its docstring; | |
997 there's no need for this with the load-history available, but we do it for | |
998 consistency with the C parsing code. | |
966 */ | 999 */ |
967 | 1000 |
968 static void | 1001 static void |
969 skip_white (FILE *infile) | 1002 skip_white (FILE *infile) |
970 { | 1003 { |
1354 or gobble a doc string from the input file. | 1387 or gobble a doc string from the input file. |
1355 | 1388 |
1356 In the latter case, the opening quote (and leading | 1389 In the latter case, the opening quote (and leading |
1357 backslash-newline) have already been read. */ | 1390 backslash-newline) have already been read. */ |
1358 | 1391 |
1392 put_filename (filename); /* XEmacs addition */ | |
1359 putc ('\n', outfile); /* XEmacs addition */ | 1393 putc ('\n', outfile); /* XEmacs addition */ |
1360 putc (037, outfile); | 1394 putc (037, outfile); |
1361 putc (type, outfile); | 1395 putc (type, outfile); |
1362 fprintf (outfile, "%s\n", buffer); | 1396 fprintf (outfile, "%s\n", buffer); |
1363 if (saved_string) | 1397 if (saved_string) |