Mercurial > emacs
comparison lib-src/etags.c @ 6530:12e47da67bb5
* etags.c (emacs_tags_format, ETAGS): removed. Use CTAGS instead.
(main): don't allow the use of -t and -T in etags mode.
(print_help): don't show options enabled by default.
(print_version): show the emacs version number if VERSION is #defined.
(find_entries): add "ss" as suffix for Chez Scheme.
author | Francesco Potortì <pot@gnu.org> |
---|---|
date | Fri, 25 Mar 1994 14:31:24 +0000 |
parents | 91112dd5c9f5 |
children | 9a76406c9f98 |
comparison
equal
deleted
inserted
replaced
6529:79c305d1edcb | 6530:12e47da67bb5 |
---|---|
26 * Sam Kendall added C++. | 26 * Sam Kendall added C++. |
27 * | 27 * |
28 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. | 28 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. |
29 */ | 29 */ |
30 | 30 |
31 char etags_version[] = "@(#) pot revision number is 10.15"; | 31 char pot_etags_version[] = "@(#) pot revision number is 10.18"; |
32 | 32 |
33 #ifdef MSDOS | 33 #ifdef MSDOS |
34 #include <fcntl.h> | 34 #include <fcntl.h> |
35 #endif /* MSDOS */ | 35 #endif /* MSDOS */ |
36 | 36 |
51 | 51 |
52 extern char *getenv (); | 52 extern char *getenv (); |
53 extern char *getcwd (); | 53 extern char *getcwd (); |
54 | 54 |
55 | 55 |
56 /* Define the symbol ETAGS to make the program "etags", | 56 /* Define CTAGS to make the program "ctags" compatible with the usual one. |
57 which makes emacs-style tag tables by default. | 57 Let it undefined to make the program "etags", which makes emacs-style |
58 Define CTAGS to make the program "ctags" compatible with the usual one. | 58 tag tables and tags typedefs, #defines and struct/union/enum by default. */ |
59 Define neither one to get behavior that depends | 59 #ifdef CTAGS |
60 on the name with which the program is invoked | 60 # undef CTAGS |
61 (but we don't normally compile it that way). */ | 61 # define CTAGS TRUE |
62 | 62 #else |
63 #if !defined(ETAGS) && !defined(CTAGS) | 63 # define CTAGS FALSE |
64 /* If neither is defined, program can be run as either. */ | |
65 #define ETAGS | |
66 #define CTAGS | |
67 #endif | |
68 | |
69 /* On VMS, CTAGS is not useful, so always do ETAGS. */ | |
70 #ifdef VMS | |
71 #ifndef ETAGS | |
72 #define ETAGS | |
73 #endif | |
74 #endif | 64 #endif |
75 | 65 |
76 /* Exit codes for success and failure. */ | 66 /* Exit codes for success and failure. */ |
77 #ifdef VMS | 67 #ifdef VMS |
78 #define GOOD (1) | 68 #define GOOD 1 |
79 #define BAD (0) | 69 #define BAD 0 |
80 #else | 70 #else |
81 #define GOOD (0) | 71 #define GOOD 0 |
82 #define BAD (1) | 72 #define BAD 1 |
83 #endif | 73 #endif |
84 | 74 |
85 /* | 75 /* |
86 * The FILEPOS abstract type, which represents a position in a file, | 76 * The FILEPOS abstract type, which represents a position in a file, |
87 * plus the following accessor functions: | 77 * plus the following accessor functions: |
245 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~", | 235 *begtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$~", |
246 /* valid in-token chars */ | 236 /* valid in-token chars */ |
247 *intk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; | 237 *intk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; |
248 | 238 |
249 int append_to_tagfile; /* -a: append to tags */ | 239 int append_to_tagfile; /* -a: append to tags */ |
250 int emacs_tags_format; /* emacs style output (no -e option any more) */ | |
251 /* The following three default to 1 for etags, but to 0 for ctags. */ | 240 /* The following three default to 1 for etags, but to 0 for ctags. */ |
252 int typedefs; /* -t: create tags for typedefs */ | 241 int typedefs; /* -t: create tags for typedefs */ |
253 int typedefs_and_cplusplus; /* -T: create tags for typedefs, level */ | 242 int typedefs_and_cplusplus; /* -T: create tags for typedefs, level */ |
254 /* 0 struct/enum/union decls, and C++ */ | 243 /* 0 struct/enum/union decls, and C++ */ |
255 /* member functions */ | 244 /* member functions. */ |
256 int constantypedefs; /* -d: create tags for C #define and enum */ | 245 int constantypedefs; /* -d: create tags for C #define and enum */ |
257 /* constants. Default under etags. Enum */ | 246 /* constants. Enum consts not implemented. */ |
258 /* constants not implemented. */ | |
259 /* -D: opposite of -d. Default under ctags. */ | 247 /* -D: opposite of -d. Default under ctags. */ |
260 int update; /* -u: update tags */ | 248 int update; /* -u: update tags */ |
261 int vgrind_style; /* -v: create vgrind style index output */ | 249 int vgrind_style; /* -v: create vgrind style index output */ |
262 int no_warnings; /* -w: suppress warnings */ | 250 int no_warnings; /* -w: suppress warnings */ |
263 int cxref_style; /* -x: create cxref style output */ | 251 int cxref_style; /* -x: create cxref style output */ |
314 } lbs[2]; | 302 } lbs[2]; |
315 | 303 |
316 void | 304 void |
317 print_version () | 305 print_version () |
318 { | 306 { |
319 #ifdef CTAGS | 307 #ifdef VERSION |
320 printf ("CTAGS "); | 308 printf ("%s for Emacs version %g.\n", (CTAGS) ? "CTAGS" : "ETAGS", VERSION); |
321 #ifdef ETAGS | 309 #else |
322 printf ("and "); | 310 printf ("%s for Emacs version 19.\n", (CTAGS) ? "CTAGS" : "ETAGS"); |
323 #endif | 311 #endif |
324 #endif | |
325 #ifdef ETAGS | |
326 printf ("ETAGS "); | |
327 #endif | |
328 printf ("for Emacs version 19.\n"); | |
329 | 312 |
330 exit (GOOD); | 313 exit (GOOD); |
331 } | 314 } |
332 | 315 |
333 void | 316 void |
338 names from stdin.\n\n", progname); | 321 names from stdin.\n\n", progname); |
339 | 322 |
340 puts ("-a, --append\n\ | 323 puts ("-a, --append\n\ |
341 Append tag entries to existing tags file."); | 324 Append tag entries to existing tags file."); |
342 | 325 |
343 #ifdef CTAGS | 326 if (CTAGS) |
344 puts ("-B, --backward-search\n\ | 327 puts ("-B, --backward-search\n\ |
345 Write the search commands for the tag entries using '?', the\n\ | 328 Write the search commands for the tag entries using '?', the\n\ |
346 backward-search command."); | 329 backward-search command."); |
347 #endif | |
348 | 330 |
349 puts ("-C, --c++\n\ | 331 puts ("-C, --c++\n\ |
350 Treat files with `.c' and `.h' extensions as C++ code, not C\n\ | 332 Treat files with `.c' and `.h' extensions as C++ code, not C\n\ |
351 code. Files with `.C', `.H', `.cxx', `.hxx', or `.cc'\n\ | 333 code. Files with `.C', `.H', `.cxx', `.hxx', or `.cc'\n\ |
352 extensions are always assumed to be C++ code."); | 334 extensions are always assumed to be C++ code."); |
353 | 335 |
354 #ifdef ETAGS | 336 if (CTAGS) |
355 puts ("-d, --defines\n\ | 337 puts ("-d, --defines\n\ |
356 Create tag entries for #defines, too. This is the default\n\ | 338 Create tag entries for C #defines, too."); |
357 behavior."); | 339 else |
358 #else | 340 puts ("-D, --no-defines\n\ |
359 puts ("-d, --defines\n\ | 341 Don't create tag entries for C #defines. This makes the tags\n\ |
360 Create tag entries for #defines, too."); | 342 file smaller."); |
361 #endif | 343 |
362 | 344 if (CTAGS) |
363 #ifdef CTAGS | 345 puts ("-F, --forward-search\n\ |
364 puts ("-D, --no-defines\n\ | |
365 Don't create tag entries for #defines. This is the default\n\ | |
366 behavior."); | |
367 #else | |
368 puts ("-D, --no-defines\n\ | |
369 Don't create tag entries for #defines."); | |
370 #endif | |
371 | |
372 #ifdef CTAGS | |
373 puts ("-F, --forward-search\n\ | |
374 Write the search commands for the tag entries using '/', the\n\ | 346 Write the search commands for the tag entries using '/', the\n\ |
375 forward-search command."); | 347 forward-search command."); |
376 #endif | 348 |
377 | 349 if (!CTAGS) |
378 | 350 puts ("-i FILE, --include=FILE\n\ |
379 #ifdef ETAGS | |
380 puts ("-i FILE, --include=FILE\n\ | |
381 Include a note in tag file indicating that, when searching for\n\ | 351 Include a note in tag file indicating that, when searching for\n\ |
382 a tag, one should also consult the tags file FILE after\n\ | 352 a tag, one should also consult the tags file FILE after\n\ |
383 checking the current file."); | 353 checking the current file."); |
384 #endif | |
385 | 354 |
386 puts ("-o FILE, --output=FILE\n\ | 355 puts ("-o FILE, --output=FILE\n\ |
387 Write the tags to FILE."); | 356 Write the tags to FILE."); |
388 puts ("-S, --ignore-indentation\n\ | 357 puts ("-S, --ignore-indentation\n\ |
389 Don't rely on indentation quite as much as normal. Currently,\n\ | 358 Don't rely on indentation quite as much as normal. Currently,\n\ |
390 this means not to assume that a closing brace in the first\n\ | 359 this means not to assume that a closing brace in the first\n\ |
391 column is the final brace of a function or structure\n\ | 360 column is the final brace of a function or structure\n\ |
392 definition."); | 361 definition in C and C++."); |
393 puts ("-t, --typedefs\n\ | 362 |
394 Generate tag entries for typedefs. This is the default\n\ | 363 if (CTAGS) |
395 behavior."); | 364 { |
396 puts ("-T, --typedefs-and-c++\n\ | 365 puts ("-t, --typedefs\n\ |
397 Generate tag entries for typedefs, struct/enum/union tags, and\n\ | 366 Generate tag entries for C typedefs."); |
398 C++ member functions."); | 367 puts ("-T, --typedefs-and-c++\n\ |
399 | 368 Generate tag entries for C typedefs, C struct/enum/union tags,\n\ |
400 #ifdef CTAGS | 369 and C++ member functions."); |
401 puts ("-u, --update\n\ | 370 } |
371 | |
372 if (CTAGS) | |
373 { | |
374 puts ("-u, --update\n\ | |
402 Update the tag entries for the given files, leaving tag\n\ | 375 Update the tag entries for the given files, leaving tag\n\ |
403 entries for other files in place. Currently, this is\n\ | 376 entries for other files in place. Currently, this is\n\ |
404 implemented by deleting the existing entries for the given\n\ | 377 implemented by deleting the existing entries for the given\n\ |
405 files and then rewriting the new entries at the end of the\n\ | 378 files and then rewriting the new entries at the end of the\n\ |
406 tags file. It is often faster to simply rebuild the entire\n\ | 379 tags file. It is often faster to simply rebuild the entire\n\ |
407 tag file than to use this."); | 380 tag file than to use this."); |
408 puts ("-v, --vgrind\n\ | 381 puts ("-v, --vgrind\n\ |
409 Generates an index of items intended for human consumption,\n\ | 382 Generates an index of items intended for human consumption,\n\ |
410 similar to the output of vgrind. The index is sorted, and\n\ | 383 similar to the output of vgrind. The index is sorted, and\n\ |
411 gives the page number of each item."); | 384 gives the page number of each item."); |
412 puts ("-x, --cxref\n\ | 385 puts ("-x, --cxref\n\ |
413 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ | 386 Like --vgrind, but in the style of cxref, rather than vgrind.\n\ |
414 The output uses line numbers instead of page numbers, but\n\ | 387 The output uses line numbers instead of page numbers, but\n\ |
415 beyond that the differences are cosmetic; try both to see\n\ | 388 beyond that the differences are cosmetic; try both to see\n\ |
416 which you like."); | 389 which you like."); |
417 puts ("-w, --no-warn\n\ | 390 puts ("-w, --no-warn\n\ |
418 Suppress warning messages about entries defined in multiple\n\ | 391 Suppress warning messages about entries defined in multiple\n\ |
419 files."); | 392 files."); |
420 #endif | 393 } |
421 | 394 |
422 puts ("-V, --version\n\ | 395 puts ("-V, --version\n\ |
423 Print the version of the program.\n\ | 396 Print the version of the program.\n\ |
424 -H, --help\n\ | 397 -H, --help\n\ |
425 Print this help message."); | 398 Print this help message."); |
449 _fmode = O_BINARY; /* all of files are treated as binary files */ | 422 _fmode = O_BINARY; /* all of files are treated as binary files */ |
450 #endif /* MSDOS */ | 423 #endif /* MSDOS */ |
451 | 424 |
452 progname = argv[0]; | 425 progname = argv[0]; |
453 | 426 |
454 #ifndef CTAGS | |
455 emacs_tags_format = 1; | |
456 #else | |
457 emacs_tags_format = 0; | |
458 #endif | |
459 | |
460 /* | 427 /* |
461 * If etags, always find typedefs and structure tags. Why not? | 428 * If etags, always find typedefs and structure tags. Why not? |
462 * Also default is to find macro constants. | 429 * Also default is to find macro constants. |
463 */ | 430 */ |
464 if (emacs_tags_format) | 431 if (!CTAGS) |
465 typedefs = typedefs_and_cplusplus = constantypedefs = 1; | 432 typedefs = typedefs_and_cplusplus = constantypedefs = 1; |
466 | 433 |
467 for (;;) | 434 for (;;) |
468 { | 435 { |
469 int opt; | 436 int opt; |
470 opt = getopt_long (argc, argv, "aCdDo:f:StTi:BFuvxwVH", longopts, 0); | 437 opt = getopt_long (argc, argv, "aCdDf:o:StTi:BFuvxwVH", longopts, 0); |
471 | 438 |
472 if (opt == EOF) | 439 if (opt == EOF) |
473 break; | 440 break; |
474 | 441 |
475 switch (opt) | 442 switch (opt) |
490 constantypedefs = 1; | 457 constantypedefs = 1; |
491 break; | 458 break; |
492 case 'D': | 459 case 'D': |
493 constantypedefs = 0; | 460 constantypedefs = 0; |
494 break; | 461 break; |
495 case 'f': | 462 case 'f': /* for compatibility with old makefiles */ |
496 case 'o': | 463 case 'o': |
497 if (outfile) | 464 if (outfile) |
498 { | 465 { |
499 fprintf (stderr, | 466 fprintf (stderr, |
500 "%s: -%c flag may only be given once\n", progname, opt); | 467 "%s: -%c flag may only be given once\n", progname, opt); |
503 outfile = optarg; | 470 outfile = optarg; |
504 break; | 471 break; |
505 case 'S': | 472 case 'S': |
506 noindentypedefs++; | 473 noindentypedefs++; |
507 break; | 474 break; |
475 case 'V': | |
476 print_version (); | |
477 break; | |
478 case 'H': | |
479 print_help (); | |
480 break; | |
481 | |
482 /* Etags options */ | |
483 case 'i': | |
484 if (CTAGS) | |
485 goto usage; | |
486 included_files[nincluded_files++] = optarg; | |
487 break; | |
488 | |
489 /* Ctags options. */ | |
490 case 'B': | |
491 searchar = '?'; | |
492 if (!CTAGS) goto usage; | |
493 break; | |
494 case 'F': | |
495 searchar = '/'; | |
496 if (!CTAGS) goto usage; | |
497 break; | |
508 case 't': | 498 case 't': |
509 typedefs++; | 499 typedefs++; |
500 if (!CTAGS) goto usage; | |
510 break; | 501 break; |
511 case 'T': | 502 case 'T': |
512 typedefs++; | 503 typedefs++; |
513 typedefs_and_cplusplus++; | 504 typedefs_and_cplusplus++; |
514 break; | 505 if (!CTAGS) goto usage; |
515 case 'V': | |
516 print_version (); | |
517 break; | |
518 case 'H': | |
519 print_help (); | |
520 break; | |
521 | |
522 /* Etags options */ | |
523 case 'i': | |
524 if (!emacs_tags_format) | |
525 goto usage; | |
526 included_files[nincluded_files++] = optarg; | |
527 break; | |
528 | |
529 /* Ctags options. */ | |
530 case 'B': | |
531 searchar = '?'; | |
532 if (emacs_tags_format) | |
533 goto usage; | |
534 break; | |
535 case 'F': | |
536 searchar = '/'; | |
537 if (emacs_tags_format) | |
538 goto usage; | |
539 break; | 506 break; |
540 case 'u': | 507 case 'u': |
541 update++; | 508 update++; |
542 if (emacs_tags_format) | 509 if (!CTAGS) goto usage; |
543 goto usage; | |
544 break; | 510 break; |
545 case 'v': | 511 case 'v': |
546 vgrind_style++; | 512 vgrind_style++; |
547 /*FALLTHRU*/ | 513 /*FALLTHRU*/ |
548 case 'x': | 514 case 'x': |
549 cxref_style++; | 515 cxref_style++; |
550 if (emacs_tags_format) | 516 if (!CTAGS) goto usage; |
551 goto usage; | |
552 break; | 517 break; |
553 case 'w': | 518 case 'w': |
554 no_warnings++; | 519 no_warnings++; |
555 if (emacs_tags_format) | 520 if (!CTAGS) goto usage; |
556 goto usage; | |
557 break; | 521 break; |
558 | 522 |
559 default: | 523 default: |
560 goto usage; | 524 goto usage; |
561 } | 525 } |
571 exit (BAD); | 535 exit (BAD); |
572 } | 536 } |
573 | 537 |
574 if (outfile == NULL) | 538 if (outfile == NULL) |
575 { | 539 { |
576 outfile = emacs_tags_format ? "TAGS" : "tags"; | 540 outfile = CTAGS ? "tags" : "TAGS"; |
577 } | 541 } |
578 getcwd (cwd, BUFSIZ); /* the current working directory */ | 542 getcwd (cwd, BUFSIZ); /* the current working directory */ |
579 strcat (cwd, "/"); | 543 strcat (cwd, "/"); |
580 if (streq (outfile, "-")) | 544 if (streq (outfile, "-")) |
581 { | 545 { |
593 initbuffer (&lbs[1].lb); | 557 initbuffer (&lbs[1].lb); |
594 initbuffer (&filename_lb); | 558 initbuffer (&filename_lb); |
595 /* | 559 /* |
596 * loop through files finding functions | 560 * loop through files finding functions |
597 */ | 561 */ |
598 if (emacs_tags_format) | 562 if (!CTAGS) |
599 { | 563 { |
600 if (streq (outfile, "-")) | 564 if (streq (outfile, "-")) |
601 outf = stdout; | 565 outf = stdout; |
602 else | 566 else |
603 outf = fopen (outfile, append_to_tagfile ? "a" : "w"); | 567 outf = fopen (outfile, append_to_tagfile ? "a" : "w"); |
642 } | 606 } |
643 else | 607 else |
644 process_file (this_file); | 608 process_file (this_file); |
645 } | 609 } |
646 | 610 |
647 if (emacs_tags_format) | 611 if (!CTAGS) |
648 { | 612 { |
649 while (nincluded_files-- > 0) | 613 while (nincluded_files-- > 0) |
650 fprintf (outf, "\f\n%s,include\n", *included_files++); | 614 fprintf (outf, "\f\n%s,include\n", *included_files++); |
651 | 615 |
652 (void) fclose (outf); | 616 (void) fclose (outf); |
709 } | 673 } |
710 if (!find_entries (file)) | 674 if (!find_entries (file)) |
711 { | 675 { |
712 return; | 676 return; |
713 } | 677 } |
714 if (emacs_tags_format) | 678 if (!CTAGS) |
715 { | 679 { |
716 char *filename; | 680 char *filename; |
717 | 681 |
718 if (file[0] == '/') | 682 if (file[0] == '/') |
719 { | 683 { |
807 if (cp && (streq (cp + 1, "sm") | 771 if (cp && (streq (cp + 1, "sm") |
808 || streq (cp + 1, "scm") | 772 || streq (cp + 1, "scm") |
809 || streq (cp + 1, "scheme") | 773 || streq (cp + 1, "scheme") |
810 || streq (cp + 1, "t") | 774 || streq (cp + 1, "t") |
811 || streq (cp + 1, "sch") | 775 || streq (cp + 1, "sch") |
776 || streq (cp + 1, "ss") | |
812 || streq (cp + 1, "SM") | 777 || streq (cp + 1, "SM") |
813 || streq (cp + 1, "SCM") | 778 || streq (cp + 1, "SCM") |
814 /* The `SCM' or `scm' prefix with a version number */ | 779 /* The `SCM' or `scm' prefix with a version number */ |
815 || (cp[-1] == 'm' && cp[-2] == 'c' && cp[-3] == 's' | 780 || (cp[-1] == 'm' && cp[-2] == 'c' && cp[-3] == 's' |
816 && string_numeric_p (cp + 1)) | 781 && string_numeric_p (cp + 1)) |
921 char c; | 886 char c; |
922 | 887 |
923 np = xnew (1, NODE); | 888 np = xnew (1, NODE); |
924 if (np == NULL) | 889 if (np == NULL) |
925 { | 890 { |
926 if (!emacs_tags_format) | 891 if (CTAGS) |
927 { | 892 { |
928 /* It's okay to output early in etags -- it only disrupts the | 893 /* It's okay to output early in etags -- it only disrupts the |
929 * character count of the tag entries, which is no longer used | 894 * character count of the tag entries, which is no longer used |
930 * by tags.el anyway. | 895 * by tags.el anyway. |
931 */ | 896 */ |
935 free_tree (head); | 900 free_tree (head); |
936 head = NULL; | 901 head = NULL; |
937 np = xnew (1, NODE); | 902 np = xnew (1, NODE); |
938 } | 903 } |
939 /* If ctags mode, change name "main" to M<thisfilename>. */ | 904 /* If ctags mode, change name "main" to M<thisfilename>. */ |
940 if (!emacs_tags_format && !cxref_style && streq (name, "main")) | 905 if (CTAGS && !cxref_style && streq (name, "main")) |
941 { | 906 { |
942 fp = etags_rindex (curfile, '/'); | 907 fp = etags_rindex (curfile, '/'); |
943 name = concat ("M", fp == 0 ? curfile : fp + 1, ""); | 908 name = concat ("M", fp == 0 ? curfile : fp + 1, ""); |
944 fp = etags_rindex (name, '.'); | 909 fp = etags_rindex (name, '.'); |
945 if (fp && fp[1] != '\0' && fp[2] == '\0') | 910 if (fp && fp[1] != '\0' && fp[2] == '\0') |
952 np->named = named; | 917 np->named = named; |
953 np->lno = lno; | 918 np->lno = lno; |
954 /* UNCOMMENT THE +1 HERE: */ | 919 /* UNCOMMENT THE +1 HERE: */ |
955 np->cno = cno /* + 1 */ ; /* our char numbers are 0-base; emacs's are 1-base */ | 920 np->cno = cno /* + 1 */ ; /* our char numbers are 0-base; emacs's are 1-base */ |
956 np->left = np->right = 0; | 921 np->left = np->right = 0; |
957 if (emacs_tags_format) | 922 if (!CTAGS) |
958 { | 923 { |
959 c = linestart[linelen]; | 924 c = linestart[linelen]; |
960 linestart[linelen] = 0; | 925 linestart[linelen] = 0; |
961 } | 926 } |
962 else if (cxref_style == 0) | 927 else if (cxref_style == 0) |
963 { | 928 { |
964 sprintf (tem, strlen (linestart) < 50 ? "%s$" : "%.50s", linestart); | 929 sprintf (tem, strlen (linestart) < 50 ? "%s$" : "%.50s", linestart); |
965 linestart = tem; | 930 linestart = tem; |
966 } | 931 } |
967 np->pat = savestr (linestart); | 932 np->pat = savestr (linestart); |
968 if (emacs_tags_format) | 933 if (!CTAGS) |
969 { | 934 { |
970 linestart[linelen] = c; | 935 linestart[linelen] = c; |
971 } | 936 } |
972 | 937 |
973 add_node (np, &head); | 938 add_node (np, &head); |
1017 *cur_node_p = node; | 982 *cur_node_p = node; |
1018 last_node = node; | 983 last_node = node; |
1019 return; | 984 return; |
1020 } | 985 } |
1021 | 986 |
1022 if (emacs_tags_format) | 987 if (!CTAGS) |
1023 { | 988 { |
1024 /* Etags Mode */ | 989 /* Etags Mode */ |
1025 if (last_node == NULL) | 990 if (last_node == NULL) |
1026 fatal ("internal error in add_node", 0); | 991 fatal ("internal error in add_node", 0); |
1027 last_node->right = node; | 992 last_node->right = node; |
1083 /* Output subentries that precede this one */ | 1048 /* Output subentries that precede this one */ |
1084 put_entries (node->left); | 1049 put_entries (node->left); |
1085 | 1050 |
1086 /* Output this entry */ | 1051 /* Output this entry */ |
1087 | 1052 |
1088 if (emacs_tags_format) | 1053 if (!CTAGS) |
1089 { | 1054 { |
1090 if (node->named) | 1055 if (node->named) |
1091 { | 1056 { |
1092 fprintf (outf, "%s\177%s\001%d,%d\n", | 1057 fprintf (outf, "%s\177%s\001%d,%d\n", |
1093 node->pat, node->name, | 1058 node->pat, node->name, |
1148 return len; | 1113 return len; |
1149 } | 1114 } |
1150 | 1115 |
1151 /* | 1116 /* |
1152 * Return total number of characters that put_entries will output for | 1117 * Return total number of characters that put_entries will output for |
1153 * the nodes in the subtree of the specified node. Works only if emacs_tags_format | 1118 * the nodes in the subtree of the specified node. Works only if |
1154 * is set, but called only in that case. This count is irrelevant with | 1119 * we are not ctags, but called only in that case. This count |
1155 * the new tags.el, but is still supplied for backward compatibility. | 1120 * is irrelevant with the new tags.el, but is still supplied for |
1121 * backward compatibility. | |
1156 */ | 1122 */ |
1157 int | 1123 int |
1158 total_size_of_entries (node) | 1124 total_size_of_entries (node) |
1159 register NODE *node; | 1125 register NODE *node; |
1160 { | 1126 { |