diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 978 |
1 files changed, 499 insertions, 479 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index b6481bb475b..a9cf56fdc6d 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -20,7 +20,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 20 | /* | 20 | /* |
| 21 | * Authors: | 21 | * Authors: |
| 22 | * Ctags originally by Ken Arnold. | 22 | * Ctags originally by Ken Arnold. |
| 23 | * FORTRAN added by Jim Kleckner. | 23 | * Fortran added by Jim Kleckner. |
| 24 | * Ed Pelegri-Llopart added C typedefs. | 24 | * Ed Pelegri-Llopart added C typedefs. |
| 25 | * Gnu Emacs TAGS format and modifications by RMS? | 25 | * Gnu Emacs TAGS format and modifications by RMS? |
| 26 | * Sam Kendall added C++. | 26 | * Sam Kendall added C++. |
| @@ -28,7 +28,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 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 pot_etags_version[] = "@(#) pot revision number is 10.21"; | 31 | char pot_etags_version[] = "@(#) pot revision number is 10.28"; |
| 32 | 32 | ||
| 33 | #ifdef MSDOS | 33 | #ifdef MSDOS |
| 34 | #include <fcntl.h> | 34 | #include <fcntl.h> |
| @@ -148,7 +148,7 @@ logical header_file; /* TRUE if .h file, FALSE o.w. */ | |||
| 148 | logical _wht[0177], _etk[0177], _itk[0177], _btk[0177]; | 148 | logical _wht[0177], _etk[0177], _itk[0177], _btk[0177]; |
| 149 | 149 | ||
| 150 | char *cwd; /* current working directory */ | 150 | char *cwd; /* current working directory */ |
| 151 | char *outfiledir; /* directory of tagfile */ | 151 | char *tagfiledir; /* directory of tagfile */ |
| 152 | 152 | ||
| 153 | char *concat (); | 153 | char *concat (); |
| 154 | char *savenstr (), *savestr (); | 154 | char *savenstr (), *savestr (); |
| @@ -156,19 +156,17 @@ char *etags_strchr (), *etags_strrchr (); | |||
| 156 | char *etags_getcwd (); | 156 | char *etags_getcwd (); |
| 157 | char *relative_filename (), *absolute_filename (), *absolute_dirname (); | 157 | char *relative_filename (), *absolute_filename (), *absolute_dirname (); |
| 158 | char *xmalloc (), *xrealloc (); | 158 | char *xmalloc (), *xrealloc (); |
| 159 | int L_isdef (), L_isquote (); | ||
| 160 | int PF_funcs (); | ||
| 161 | int total_size_of_entries (); | 159 | int total_size_of_entries (); |
| 162 | logical consider_token (); | ||
| 163 | logical tail (); | ||
| 164 | long readline (); | 160 | long readline (); |
| 165 | void Asm_funcs (); | 161 | |
| 162 | void Asm_labels (); | ||
| 166 | void C_entries (); | 163 | void C_entries (); |
| 167 | void L_funcs (); | 164 | int Fortran_functions (); |
| 168 | void L_getit (); | 165 | void Lisp_functions (); |
| 169 | void PAS_funcs (); | 166 | void Pascal_functions (); |
| 170 | void Scheme_funcs (); | 167 | void Prolog_functions (); |
| 171 | void TEX_funcs (); | 168 | void Scheme_functions (); |
| 169 | void TeX_functions (); | ||
| 172 | void add_node (); | 170 | void add_node (); |
| 173 | void error (); | 171 | void error (); |
| 174 | void fatal (); | 172 | void fatal (); |
| @@ -228,7 +226,7 @@ long linecharno; /* charno of start of line; not used by C, but | |||
| 228 | */ | 226 | */ |
| 229 | 227 | ||
| 230 | char *curfile, /* current input file name */ | 228 | char *curfile, /* current input file name */ |
| 231 | *outfile, /* output file */ | 229 | *tagfile, /* output file */ |
| 232 | *white = " \f\t\n", /* white chars */ | 230 | *white = " \f\t\n", /* white chars */ |
| 233 | *endtk = " \t\n\"'#()[]{}=-+%*/&|^~!<>;,.:?", /* token ending chars */ | 231 | *endtk = " \t\n\"'#()[]{}=-+%*/&|^~!<>;,.:?", /* token ending chars */ |
| 234 | /* token starting chars */ | 232 | /* token starting chars */ |
| @@ -276,12 +274,9 @@ struct option longopts[] = { | |||
| 276 | { 0 } | 274 | { 0 } |
| 277 | }; | 275 | }; |
| 278 | 276 | ||
| 279 | FILE *inf, /* ioptr for current input file */ | 277 | FILE *tagf; /* ioptr for tags file */ |
| 280 | *outf; /* ioptr for tags file */ | 278 | NODE *head; /* the head of the binary tree of tags */ |
| 281 | 279 | logical permit_duplicates = TRUE; /* allow duplicate tags */ | |
| 282 | NODE *head; /* the head of the binary tree of tags */ | ||
| 283 | |||
| 284 | int permit_duplicates = 1; /* Nonzero means allow duplicate tags. */ | ||
| 285 | 280 | ||
| 286 | /* A `struct linebuffer' is a structure which holds a line of text. | 281 | /* A `struct linebuffer' is a structure which holds a line of text. |
| 287 | `readline' reads a line from a stream into a linebuffer | 282 | `readline' reads a line from a stream into a linebuffer |
| @@ -457,13 +452,13 @@ main (argc, argv) | |||
| 457 | break; | 452 | break; |
| 458 | case 'f': /* for compatibility with old makefiles */ | 453 | case 'f': /* for compatibility with old makefiles */ |
| 459 | case 'o': | 454 | case 'o': |
| 460 | if (outfile) | 455 | if (tagfile) |
| 461 | { | 456 | { |
| 462 | fprintf (stderr, | 457 | fprintf (stderr, |
| 463 | "%s: -%c flag may only be given once\n", progname, opt); | 458 | "%s: -%c flag may only be given once\n", progname, opt); |
| 464 | goto usage; | 459 | goto usage; |
| 465 | } | 460 | } |
| 466 | outfile = optarg; | 461 | tagfile = optarg; |
| 467 | break; | 462 | break; |
| 468 | case 'S': | 463 | case 'S': |
| 469 | noindentypedefs++; | 464 | noindentypedefs++; |
| @@ -528,19 +523,19 @@ main (argc, argv) | |||
| 528 | exit (BAD); | 523 | exit (BAD); |
| 529 | } | 524 | } |
| 530 | 525 | ||
| 531 | if (outfile == NULL) | 526 | if (tagfile == NULL) |
| 532 | { | 527 | { |
| 533 | outfile = CTAGS ? "tags" : "TAGS"; | 528 | tagfile = CTAGS ? "tags" : "TAGS"; |
| 534 | } | 529 | } |
| 535 | cwd = etags_getcwd (); /* the current working directory */ | 530 | cwd = etags_getcwd (); /* the current working directory */ |
| 536 | strcat (cwd, "/"); | 531 | strcat (cwd, "/"); |
| 537 | if (streq (outfile, "-")) | 532 | if (streq (tagfile, "-")) |
| 538 | { | 533 | { |
| 539 | outfiledir = cwd; | 534 | tagfiledir = cwd; |
| 540 | } | 535 | } |
| 541 | else | 536 | else |
| 542 | { | 537 | { |
| 543 | outfiledir = absolute_dirname (outfile, cwd); | 538 | tagfiledir = absolute_dirname (tagfile, cwd); |
| 544 | } | 539 | } |
| 545 | 540 | ||
| 546 | init (); /* set up boolean "functions" */ | 541 | init (); /* set up boolean "functions" */ |
| @@ -554,13 +549,13 @@ main (argc, argv) | |||
| 554 | */ | 549 | */ |
| 555 | if (!CTAGS) | 550 | if (!CTAGS) |
| 556 | { | 551 | { |
| 557 | if (streq (outfile, "-")) | 552 | if (streq (tagfile, "-")) |
| 558 | outf = stdout; | 553 | tagf = stdout; |
| 559 | else | 554 | else |
| 560 | outf = fopen (outfile, append_to_tagfile ? "a" : "w"); | 555 | tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); |
| 561 | if (outf == NULL) | 556 | if (tagf == NULL) |
| 562 | { | 557 | { |
| 563 | perror (outfile); | 558 | perror (tagfile); |
| 564 | exit (BAD); | 559 | exit (BAD); |
| 565 | } | 560 | } |
| 566 | } | 561 | } |
| @@ -604,9 +599,9 @@ main (argc, argv) | |||
| 604 | if (!CTAGS) | 599 | if (!CTAGS) |
| 605 | { | 600 | { |
| 606 | while (nincluded_files-- > 0) | 601 | while (nincluded_files-- > 0) |
| 607 | fprintf (outf, "\f\n%s,include\n", *included_files++); | 602 | fprintf (tagf, "\f\n%s,include\n", *included_files++); |
| 608 | 603 | ||
| 609 | (void) fclose (outf); | 604 | (void) fclose (tagf); |
| 610 | exit (GOOD); | 605 | exit (GOOD); |
| 611 | } | 606 | } |
| 612 | 607 | ||
| @@ -623,22 +618,22 @@ main (argc, argv) | |||
| 623 | { | 618 | { |
| 624 | sprintf (cmd, | 619 | sprintf (cmd, |
| 625 | "mv %s OTAGS;fgrep -v '\t%s\t' OTAGS >%s;rm OTAGS", | 620 | "mv %s OTAGS;fgrep -v '\t%s\t' OTAGS >%s;rm OTAGS", |
| 626 | outfile, argv[i], outfile); | 621 | tagfile, argv[i], tagfile); |
| 627 | (void) system (cmd); | 622 | (void) system (cmd); |
| 628 | } | 623 | } |
| 629 | append_to_tagfile++; | 624 | append_to_tagfile++; |
| 630 | } | 625 | } |
| 631 | outf = fopen (outfile, append_to_tagfile ? "a" : "w"); | 626 | tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); |
| 632 | if (outf == NULL) | 627 | if (tagf == NULL) |
| 633 | { | 628 | { |
| 634 | perror (outfile); | 629 | perror (tagfile); |
| 635 | exit (GOOD); | 630 | exit (GOOD); |
| 636 | } | 631 | } |
| 637 | put_entries (head); | 632 | put_entries (head); |
| 638 | (void) fclose (outf); | 633 | (void) fclose (tagf); |
| 639 | if (update) | 634 | if (update) |
| 640 | { | 635 | { |
| 641 | sprintf (cmd, "sort %s -o %s", outfile, outfile); | 636 | sprintf (cmd, "sort %s -o %s", tagfile, tagfile); |
| 642 | (void) system (cmd); | 637 | (void) system (cmd); |
| 643 | } | 638 | } |
| 644 | exit (GOOD); | 639 | exit (GOOD); |
| @@ -659,7 +654,7 @@ process_file (file) | |||
| 659 | fprintf (stderr, "Skipping %s: it is not a regular file.\n", file); | 654 | fprintf (stderr, "Skipping %s: it is not a regular file.\n", file); |
| 660 | return; | 655 | return; |
| 661 | } | 656 | } |
| 662 | if (streq (file, outfile) && !streq (outfile, "-")) | 657 | if (streq (file, tagfile) && !streq (tagfile, "-")) |
| 663 | { | 658 | { |
| 664 | fprintf (stderr, "Skipping inclusion of %s in self.\n", file); | 659 | fprintf (stderr, "Skipping inclusion of %s in self.\n", file); |
| 665 | return; | 660 | return; |
| @@ -681,9 +676,9 @@ process_file (file) | |||
| 681 | { | 676 | { |
| 682 | /* file is a filename relative to cwd. Make it relative | 677 | /* file is a filename relative to cwd. Make it relative |
| 683 | to the directory of the tags file. */ | 678 | to the directory of the tags file. */ |
| 684 | filename = relative_filename (file, outfiledir); | 679 | filename = relative_filename (file, tagfiledir); |
| 685 | } | 680 | } |
| 686 | fprintf (outf, "\f\n%s,%d\n", filename, total_size_of_entries (head)); | 681 | fprintf (tagf, "\f\n%s,%d\n", filename, total_size_of_entries (head)); |
| 687 | put_entries (head); | 682 | put_entries (head); |
| 688 | free_tree (head); | 683 | free_tree (head); |
| 689 | head = NULL; | 684 | head = NULL; |
| @@ -728,8 +723,8 @@ logical | |||
| 728 | find_entries (file) | 723 | find_entries (file) |
| 729 | char *file; | 724 | char *file; |
| 730 | { | 725 | { |
| 731 | char *cp; | 726 | char *cp, *cp1; |
| 732 | void prolog_funcs (); | 727 | FILE *inf; |
| 733 | 728 | ||
| 734 | inf = fopen (file, "r"); | 729 | inf = fopen (file, "r"); |
| 735 | if (inf == NULL) | 730 | if (inf == NULL) |
| @@ -739,95 +734,100 @@ find_entries (file) | |||
| 739 | } | 734 | } |
| 740 | curfile = savestr (file); | 735 | curfile = savestr (file); |
| 741 | cp = etags_strrchr (file, '.'); | 736 | cp = etags_strrchr (file, '.'); |
| 737 | cp1 = cp + 1; | ||
| 742 | 738 | ||
| 743 | header_file = (cp && (streq (cp + 1, "h"))); | 739 | header_file = (cp && (streq (cp1, "h"))); |
| 744 | 740 | ||
| 745 | /* .tex, .aux or .bbl implies LaTeX source code */ | 741 | /* .tex, .aux or .bbl implies LaTeX source code */ |
| 746 | if (cp && (streq (cp + 1, "tex") || streq (cp + 1, "aux") | 742 | if (cp && (streq (cp1, "tex") || streq (cp1, "aux") |
| 747 | || streq (cp + 1, "bbl"))) | 743 | || streq (cp1, "bbl"))) |
| 748 | { | 744 | { |
| 749 | TEX_funcs (inf); | 745 | TeX_functions (inf); |
| 750 | goto close_and_return; | 746 | goto close_and_return; |
| 751 | } | 747 | } |
| 752 | /* .l or .el or .lisp (or .cl or .clisp or ...) implies lisp source code */ | 748 | /* .l or .el or .lisp (or .cl or .clisp or ...) implies lisp source code */ |
| 753 | if (cp && (streq (cp + 1, "l") | 749 | if (cp && (streq (cp1, "l") |
| 754 | || streq (cp + 1, "el") | 750 | || streq (cp1, "el") |
| 755 | || streq (cp + 1, "lsp") | 751 | || streq (cp1, "lsp") |
| 756 | || streq (cp + 1, "lisp") | 752 | || streq (cp1, "lisp") |
| 757 | || streq (cp + 1, "cl") | 753 | || streq (cp1, "cl") |
| 758 | || streq (cp + 1, "clisp"))) | 754 | || streq (cp1, "clisp"))) |
| 759 | { | 755 | { |
| 760 | L_funcs (inf); | 756 | Lisp_functions (inf); |
| 761 | goto close_and_return; | 757 | goto close_and_return; |
| 762 | } | 758 | } |
| 763 | /* .scm or .sm or .scheme or ... implies scheme source code */ | 759 | /* .scm or .sm or .scheme or ... implies scheme source code */ |
| 764 | if (cp && (streq (cp + 1, "sm") | 760 | if (cp && (streq (cp1, "sm") |
| 765 | || streq (cp + 1, "scm") | 761 | || streq (cp1, "scm") |
| 766 | || streq (cp + 1, "scheme") | 762 | || streq (cp1, "scheme") |
| 767 | || streq (cp + 1, "t") | 763 | || streq (cp1, "t") |
| 768 | || streq (cp + 1, "sch") | 764 | || streq (cp1, "sch") |
| 769 | || streq (cp + 1, "ss") | 765 | || streq (cp1, "ss") |
| 770 | || streq (cp + 1, "SM") | 766 | || streq (cp1, "SM") |
| 771 | || streq (cp + 1, "SCM") | 767 | || streq (cp1, "SCM") |
| 772 | /* The `SCM' or `scm' prefix with a version number */ | 768 | /* The `SCM' or `scm' prefix with a version number */ |
| 773 | || (cp[-1] == 'm' && cp[-2] == 'c' && cp[-3] == 's' | 769 | || (cp[-1] == 'm' && cp[-2] == 'c' && cp[-3] == 's' |
| 774 | && string_numeric_p (cp + 1)) | 770 | && string_numeric_p (cp1)) |
| 775 | || (cp[-1] == 'M' && cp[-2] == 'C' && cp[-3] == 'S' | 771 | || (cp[-1] == 'M' && cp[-2] == 'C' && cp[-3] == 'S' |
| 776 | && string_numeric_p (cp + 1)))) | 772 | && string_numeric_p (cp1)))) |
| 777 | { | 773 | { |
| 778 | Scheme_funcs (inf); | 774 | Scheme_functions (inf); |
| 779 | goto close_and_return; | 775 | goto close_and_return; |
| 780 | } | 776 | } |
| 781 | /* Assume that ".s" or ".a" is assembly code. -wolfgang. | 777 | /* Assembly code */ |
| 782 | Or even ".sa". */ | 778 | if (cp && (streq (cp1, "s") |
| 783 | if (cp && (streq (cp + 1, "s") | 779 | || streq (cp1, "a") /* Unix assembler */ |
| 784 | || streq (cp + 1, "a") | 780 | || streq (cp1, "sa") /* Unix assembler */ |
| 785 | || streq (cp + 1, "sa"))) | 781 | || streq (cp1, "asm") /* Microcontroller assembly */ |
| 786 | { | 782 | || streq (cp1, "src") /* BSO/Tasking C compiler output */ |
| 787 | Asm_funcs (inf); | 783 | || streq (cp1, "def") /* BSO/Tasking definition includes */ |
| 784 | || streq (cp1, "ins") /* Microcontroller include files */ | ||
| 785 | || streq (cp1, "inc")))/* Microcontroller include files */ | ||
| 786 | { | ||
| 787 | Asm_labels (inf); | ||
| 788 | goto close_and_return; | 788 | goto close_and_return; |
| 789 | } | 789 | } |
| 790 | /* .C or .H or .cxx or .hxx or .cc: a C++ file */ | 790 | /* .C or .H or .cxx or .hxx or .cc: a C++ file */ |
| 791 | if (cp && (streq (cp + 1, "C") | 791 | if (cp && (streq (cp1, "C") |
| 792 | || streq (cp + 1, "H") | 792 | || streq (cp1, "H") |
| 793 | || streq (cp + 1, "cxx") | 793 | || streq (cp1, "cxx") |
| 794 | || streq (cp + 1, "hxx") | 794 | || streq (cp1, "hxx") |
| 795 | || streq (cp + 1, "cc"))) | 795 | || streq (cp1, "cc"))) |
| 796 | { | 796 | { |
| 797 | C_entries (C_PLPL); /* C++ */ | 797 | C_entries (C_PLPL, inf); /* C++ */ |
| 798 | goto close_and_return; | 798 | goto close_and_return; |
| 799 | } | 799 | } |
| 800 | /* .cs or .hs: a C* file */ | 800 | /* .cs or .hs: a C* file */ |
| 801 | if (cp && (streq (cp + 1, "cs") | 801 | if (cp && (streq (cp1, "cs") |
| 802 | || streq (cp + 1, "hs"))) | 802 | || streq (cp1, "hs"))) |
| 803 | { | 803 | { |
| 804 | C_entries (C_STAR); | 804 | C_entries (C_STAR, inf); |
| 805 | goto close_and_return; | 805 | goto close_and_return; |
| 806 | } | 806 | } |
| 807 | /* .y: a yacc file */ | 807 | /* .y: a yacc file */ |
| 808 | if (cp && (streq (cp + 1, "y"))) | 808 | if (cp && (streq (cp1, "y"))) |
| 809 | { | 809 | { |
| 810 | C_entries (YACC); | 810 | C_entries (YACC, inf); |
| 811 | goto close_and_return; | 811 | goto close_and_return; |
| 812 | } | 812 | } |
| 813 | /* .pl implies prolog source code */ | 813 | /* .pl implies prolog source code */ |
| 814 | if (cp && streq (cp + 1, "pl")) | 814 | if (cp && streq (cp1, "pl")) |
| 815 | { | 815 | { |
| 816 | prolog_funcs (inf); | 816 | Prolog_functions (inf); |
| 817 | goto close_and_return; | 817 | goto close_and_return; |
| 818 | } | 818 | } |
| 819 | /* .p or .pas: a Pascal file */ | 819 | /* .p or .pas: a Pascal file */ |
| 820 | if (cp && (streq (cp + 1, "p") | 820 | if (cp && (streq (cp1, "p") |
| 821 | || streq (cp + 1, "pas"))) | 821 | || streq (cp1, "pas"))) |
| 822 | { | 822 | { |
| 823 | PAS_funcs (inf); | 823 | Pascal_functions (inf); |
| 824 | goto close_and_return; | 824 | goto close_and_return; |
| 825 | } | 825 | } |
| 826 | /* If .f or .for, assume it is fortran or nothing. */ | 826 | /* If .f or .for, assume it is fortran or nothing. */ |
| 827 | if (cp && (streq (cp + 1, "f") | 827 | if (cp && (streq (cp1, "f") |
| 828 | || streq (cp + 1, "for"))) | 828 | || streq (cp1, "for"))) |
| 829 | { | 829 | { |
| 830 | (void) PF_funcs (inf); | 830 | (void) Fortran_functions (inf); |
| 831 | goto close_and_return; | 831 | goto close_and_return; |
| 832 | } | 832 | } |
| 833 | /* if not a .c or .h or .y file, try fortran */ | 833 | /* if not a .c or .h or .y file, try fortran */ |
| @@ -836,11 +836,11 @@ find_entries (file) | |||
| 836 | && cp[1] != 'y') | 836 | && cp[1] != 'y') |
| 837 | || (cp[1] != 0 && cp[2] != 0))) | 837 | || (cp[1] != 0 && cp[2] != 0))) |
| 838 | { | 838 | { |
| 839 | if (PF_funcs (inf) != 0) | 839 | if (Fortran_functions (inf) != 0) |
| 840 | goto close_and_return; | 840 | goto close_and_return; |
| 841 | rewind (inf); /* no fortran tags found, try C */ | 841 | rewind (inf); /* no fortran tags found, try C */ |
| 842 | } | 842 | } |
| 843 | C_entries (cplusplus ? C_PLPL : 0); | 843 | C_entries (cplusplus ? C_PLPL : 0, inf); |
| 844 | 844 | ||
| 845 | close_and_return: | 845 | close_and_return: |
| 846 | (void) fclose (inf); | 846 | (void) fclose (inf); |
| @@ -961,7 +961,7 @@ free_tree (node) | |||
| 961 | */ | 961 | */ |
| 962 | /* Must avoid static vars within functions since some systems | 962 | /* Must avoid static vars within functions since some systems |
| 963 | #define static as nothing. */ | 963 | #define static as nothing. */ |
| 964 | static NODE *last_node = NULL; | 964 | NODE *last_node = NULL; |
| 965 | 965 | ||
| 966 | void | 966 | void |
| 967 | add_node (node, cur_node_p) | 967 | add_node (node, cur_node_p) |
| @@ -1047,40 +1047,40 @@ put_entries (node) | |||
| 1047 | { | 1047 | { |
| 1048 | if (node->named) | 1048 | if (node->named) |
| 1049 | { | 1049 | { |
| 1050 | fprintf (outf, "%s\177%s\001%d,%d\n", | 1050 | fprintf (tagf, "%s\177%s\001%d,%d\n", |
| 1051 | node->pat, node->name, | 1051 | node->pat, node->name, |
| 1052 | node->lno, node->cno); | 1052 | node->lno, node->cno); |
| 1053 | } | 1053 | } |
| 1054 | else | 1054 | else |
| 1055 | { | 1055 | { |
| 1056 | fprintf (outf, "%s\177%d,%d\n", | 1056 | fprintf (tagf, "%s\177%d,%d\n", |
| 1057 | node->pat, | 1057 | node->pat, |
| 1058 | node->lno, node->cno); | 1058 | node->lno, node->cno); |
| 1059 | } | 1059 | } |
| 1060 | } | 1060 | } |
| 1061 | else if (!cxref_style) | 1061 | else if (!cxref_style) |
| 1062 | { | 1062 | { |
| 1063 | fprintf (outf, "%s\t%s\t", | 1063 | fprintf (tagf, "%s\t%s\t", |
| 1064 | node->name, node->file); | 1064 | node->name, node->file); |
| 1065 | 1065 | ||
| 1066 | if (node->is_func) | 1066 | if (node->is_func) |
| 1067 | { /* a function */ | 1067 | { /* a function */ |
| 1068 | putc (searchar, outf); | 1068 | putc (searchar, tagf); |
| 1069 | putc ('^', outf); | 1069 | putc ('^', tagf); |
| 1070 | 1070 | ||
| 1071 | for (sp = node->pat; *sp; sp++) | 1071 | for (sp = node->pat; *sp; sp++) |
| 1072 | { | 1072 | { |
| 1073 | if (*sp == '\\' || *sp == searchar) | 1073 | if (*sp == '\\' || *sp == searchar) |
| 1074 | putc ('\\', outf); | 1074 | putc ('\\', tagf); |
| 1075 | putc (*sp, outf); | 1075 | putc (*sp, tagf); |
| 1076 | } | 1076 | } |
| 1077 | putc (searchar, outf); | 1077 | putc (searchar, tagf); |
| 1078 | } | 1078 | } |
| 1079 | else | 1079 | else |
| 1080 | { /* a typedef; text pattern inadequate */ | 1080 | { /* a typedef; text pattern inadequate */ |
| 1081 | fprintf (outf, "%d", node->lno); | 1081 | fprintf (tagf, "%d", node->lno); |
| 1082 | } | 1082 | } |
| 1083 | putc ('\n', outf); | 1083 | putc ('\n', tagf); |
| 1084 | } | 1084 | } |
| 1085 | else if (vgrind_style) | 1085 | else if (vgrind_style) |
| 1086 | fprintf (stdout, "%s %s %d\n", | 1086 | fprintf (stdout, "%s %s %d\n", |
| @@ -1364,6 +1364,203 @@ logical next_token_is_func; | |||
| 1364 | logical yacc_rules; | 1364 | logical yacc_rules; |
| 1365 | 1365 | ||
| 1366 | /* | 1366 | /* |
| 1367 | * consider_token () | ||
| 1368 | * checks to see if the current token is at the start of a | ||
| 1369 | * function, or corresponds to a typedef, or is a struct/union/enum | ||
| 1370 | * tag. | ||
| 1371 | * | ||
| 1372 | * *IS_FUNC gets TRUE iff the token is a function or macro with args. | ||
| 1373 | * C_EXT is which language we are looking at. | ||
| 1374 | * | ||
| 1375 | * In the future we will need some way to adjust where the end of | ||
| 1376 | * the token is; for instance, implementing the C++ keyword | ||
| 1377 | * `operator' properly will adjust the end of the token to be after | ||
| 1378 | * whatever follows `operator'. | ||
| 1379 | * | ||
| 1380 | * Globals | ||
| 1381 | * funcdef IN OUT | ||
| 1382 | * structdef IN OUT | ||
| 1383 | * definedef IN OUT | ||
| 1384 | * typdef IN OUT | ||
| 1385 | * next_token_is_func IN OUT | ||
| 1386 | */ | ||
| 1387 | |||
| 1388 | logical | ||
| 1389 | consider_token (c, tokp, c_ext, cblev, is_func) | ||
| 1390 | register char c; /* IN: first char after the token */ | ||
| 1391 | register TOKEN *tokp; /* IN: token pointer */ | ||
| 1392 | int c_ext; /* IN: C extensions mask */ | ||
| 1393 | int cblev; /* IN: curly brace level */ | ||
| 1394 | logical *is_func; /* OUT */ | ||
| 1395 | { | ||
| 1396 | enum sym_type toktype = C_symtype(tokp->p, tokp->len, c_ext); | ||
| 1397 | |||
| 1398 | /* | ||
| 1399 | * Advance the definedef state machine. | ||
| 1400 | */ | ||
| 1401 | switch (definedef) | ||
| 1402 | { | ||
| 1403 | case dnone: | ||
| 1404 | /* We're not on a preprocessor line. */ | ||
| 1405 | break; | ||
| 1406 | case dsharpseen: | ||
| 1407 | if (toktype == st_C_define) | ||
| 1408 | { | ||
| 1409 | definedef = ddefineseen; | ||
| 1410 | } | ||
| 1411 | else | ||
| 1412 | { | ||
| 1413 | definedef = dignorerest; | ||
| 1414 | } | ||
| 1415 | return (FALSE); | ||
| 1416 | case ddefineseen: | ||
| 1417 | /* | ||
| 1418 | * Make a tag for any macro. | ||
| 1419 | */ | ||
| 1420 | definedef = dignorerest; | ||
| 1421 | *is_func = (c == '('); | ||
| 1422 | if (!*is_func && !constantypedefs) | ||
| 1423 | return (FALSE); | ||
| 1424 | else | ||
| 1425 | return (TRUE); | ||
| 1426 | case dignorerest: | ||
| 1427 | return (FALSE); | ||
| 1428 | default: | ||
| 1429 | error ("internal error: definedef value.", 0); | ||
| 1430 | } | ||
| 1431 | |||
| 1432 | /* | ||
| 1433 | * Now typedefs | ||
| 1434 | */ | ||
| 1435 | switch (typdef) | ||
| 1436 | { | ||
| 1437 | case tnone: | ||
| 1438 | if (toktype == st_C_typedef) | ||
| 1439 | { | ||
| 1440 | if (typedefs) | ||
| 1441 | typdef = ttypedseen; | ||
| 1442 | funcdef = fnone; | ||
| 1443 | return (FALSE); | ||
| 1444 | } | ||
| 1445 | break; | ||
| 1446 | case ttypedseen: | ||
| 1447 | switch (toktype) | ||
| 1448 | { | ||
| 1449 | case st_none: | ||
| 1450 | case st_C_typespec: | ||
| 1451 | typdef = tend; | ||
| 1452 | break; | ||
| 1453 | case st_C_struct: | ||
| 1454 | case st_C_enum: | ||
| 1455 | break; | ||
| 1456 | } | ||
| 1457 | /* Do not return here, so the structdef stuff has a chance. */ | ||
| 1458 | break; | ||
| 1459 | case tend: | ||
| 1460 | switch (toktype) | ||
| 1461 | { | ||
| 1462 | case st_C_typespec: | ||
| 1463 | case st_C_struct: | ||
| 1464 | case st_C_enum: | ||
| 1465 | return (FALSE); | ||
| 1466 | } | ||
| 1467 | return (TRUE); | ||
| 1468 | } | ||
| 1469 | |||
| 1470 | /* | ||
| 1471 | * This structdef business is currently only invoked when cblev==0. | ||
| 1472 | * It should be recursively invoked whatever the curly brace level, | ||
| 1473 | * and a stack of states kept, to allow for definitions of structs | ||
| 1474 | * within structs. | ||
| 1475 | * | ||
| 1476 | * This structdef business is NOT invoked when we are ctags and the | ||
| 1477 | * file is plain C. This is because a struct tag may have the same | ||
| 1478 | * name as another tag, and this loses with ctags. | ||
| 1479 | * | ||
| 1480 | * This if statement deals with the typdef state machine as | ||
| 1481 | * follows: if typdef==ttypedseen and token is struct/union/class/enum, | ||
| 1482 | * return (FALSE). All the other code here is for the structdef | ||
| 1483 | * state machine. | ||
| 1484 | */ | ||
| 1485 | switch (toktype) | ||
| 1486 | { | ||
| 1487 | case st_C_struct: | ||
| 1488 | case st_C_enum: | ||
| 1489 | if (typdef == ttypedseen | ||
| 1490 | || (typedefs_and_cplusplus && cblev == 0 && structdef == snone)) | ||
| 1491 | { | ||
| 1492 | structdef = skeyseen; | ||
| 1493 | structtype = toktype; | ||
| 1494 | } | ||
| 1495 | return (FALSE); | ||
| 1496 | } | ||
| 1497 | if (structdef == skeyseen) | ||
| 1498 | { | ||
| 1499 | if (structtype == st_C_struct) | ||
| 1500 | { | ||
| 1501 | strncpy (structtag, tokp->p, tokp->len); | ||
| 1502 | structtag[tokp->len] = '\0'; /* for struct/union/class */ | ||
| 1503 | } | ||
| 1504 | else | ||
| 1505 | { | ||
| 1506 | structtag[0] = '\0'; /* for enum (why is it treated differently?) */ | ||
| 1507 | } | ||
| 1508 | structdef = stagseen; | ||
| 1509 | return (TRUE); | ||
| 1510 | } | ||
| 1511 | |||
| 1512 | /* Avoid entering funcdef stuff if typdef is going on. */ | ||
| 1513 | if (typdef != tnone) | ||
| 1514 | { | ||
| 1515 | definedef = dnone; | ||
| 1516 | return (FALSE); | ||
| 1517 | } | ||
| 1518 | |||
| 1519 | /* Detect GNUmacs's function-defining macros. */ | ||
| 1520 | if (definedef == dnone) | ||
| 1521 | { | ||
| 1522 | if (strneq (tokp->p, "DEF", 3) | ||
| 1523 | || strneq (tokp->p, "ENTRY", 5) | ||
| 1524 | || strneq (tokp->p, "SYSCALL", 7) | ||
| 1525 | || strneq (tokp->p, "PSEUDO", 6)) | ||
| 1526 | { | ||
| 1527 | next_token_is_func = TRUE; | ||
| 1528 | return (FALSE); | ||
| 1529 | } | ||
| 1530 | if (strneq (tokp->p, "EXFUN", 5)) | ||
| 1531 | { | ||
| 1532 | next_token_is_func = FALSE; | ||
| 1533 | return (FALSE); | ||
| 1534 | } | ||
| 1535 | } | ||
| 1536 | if (next_token_is_func) | ||
| 1537 | { | ||
| 1538 | next_token_is_func = FALSE; | ||
| 1539 | funcdef = fnone; | ||
| 1540 | *is_func = TRUE; /* to force search string in ctags */ | ||
| 1541 | return (TRUE); | ||
| 1542 | } | ||
| 1543 | |||
| 1544 | /* A function? */ | ||
| 1545 | switch (toktype) | ||
| 1546 | { | ||
| 1547 | case st_C_typespec: | ||
| 1548 | if (funcdef != finlist && funcdef != fignore) | ||
| 1549 | funcdef = fnone; /* should be useless */ | ||
| 1550 | return (FALSE); | ||
| 1551 | default: | ||
| 1552 | if (funcdef == fnone) | ||
| 1553 | { | ||
| 1554 | funcdef = ftagseen; | ||
| 1555 | *is_func = TRUE; | ||
| 1556 | return (TRUE); | ||
| 1557 | } | ||
| 1558 | } | ||
| 1559 | |||
| 1560 | return (FALSE); | ||
| 1561 | } | ||
| 1562 | |||
| 1563 | /* | ||
| 1367 | * C_entries () | 1564 | * C_entries () |
| 1368 | * This routine finds functions, typedefs, #define's and | 1565 | * This routine finds functions, typedefs, #define's and |
| 1369 | * struct/union/enum definitions in C syntax and adds them | 1566 | * struct/union/enum definitions in C syntax and adds them |
| @@ -1410,8 +1607,9 @@ do { \ | |||
| 1410 | othlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (othlinepos)) | 1607 | othlb.buffer, tokoff + toklen + 1, tok.lineno, GET_CHARNO (othlinepos)) |
| 1411 | 1608 | ||
| 1412 | void | 1609 | void |
| 1413 | C_entries (c_ext) | 1610 | C_entries (c_ext, inf) |
| 1414 | int c_ext; /* extension of C? */ | 1611 | int c_ext; /* extension of C? */ |
| 1612 | FILE *inf; | ||
| 1415 | { | 1613 | { |
| 1416 | register char c; /* latest char read; '\0' for end of line */ | 1614 | register char c; /* latest char read; '\0' for end of line */ |
| 1417 | register char *lp; /* pointer one beyond the character `c' */ | 1615 | register char *lp; /* pointer one beyond the character `c' */ |
| @@ -1848,222 +2046,101 @@ C_entries (c_ext) | |||
| 1848 | 2046 | ||
| 1849 | } /* while not eof */ | 2047 | } /* while not eof */ |
| 1850 | } | 2048 | } |
| 2049 | |||
| 2050 | /* Fortran parsing */ | ||
| 1851 | 2051 | ||
| 1852 | /* | 2052 | char *dbp; |
| 1853 | * consider_token () | 2053 | int pfcnt; |
| 1854 | * checks to see if the current token is at the start of a | ||
| 1855 | * function, or corresponds to a typedef, or is a struct/union/enum | ||
| 1856 | * tag. | ||
| 1857 | * | ||
| 1858 | * *IS_FUNC gets TRUE iff the token is a function or macro with args. | ||
| 1859 | * C_EXT is which language we are looking at. | ||
| 1860 | * | ||
| 1861 | * In the future we will need some way to adjust where the end of | ||
| 1862 | * the token is; for instance, implementing the C++ keyword | ||
| 1863 | * `operator' properly will adjust the end of the token to be after | ||
| 1864 | * whatever follows `operator'. | ||
| 1865 | * | ||
| 1866 | * Globals | ||
| 1867 | * funcdef IN OUT | ||
| 1868 | * structdef IN OUT | ||
| 1869 | * definedef IN OUT | ||
| 1870 | * typdef IN OUT | ||
| 1871 | * next_token_is_func IN OUT | ||
| 1872 | */ | ||
| 1873 | 2054 | ||
| 1874 | logical | 2055 | logical |
| 1875 | consider_token (c, tokp, c_ext, cblev, is_func) | 2056 | tail (cp) |
| 1876 | register char c; /* IN: first char after the token */ | 2057 | char *cp; |
| 1877 | register TOKEN *tokp; /* IN: token pointer */ | ||
| 1878 | int c_ext; /* IN: C extensions mask */ | ||
| 1879 | int cblev; /* IN: curly brace level */ | ||
| 1880 | logical *is_func; /* OUT */ | ||
| 1881 | { | 2058 | { |
| 1882 | enum sym_type toktype = C_symtype(tokp->p, tokp->len, c_ext); | 2059 | register int len = 0; |
| 1883 | |||
| 1884 | /* | ||
| 1885 | * Advance the definedef state machine. | ||
| 1886 | */ | ||
| 1887 | switch (definedef) | ||
| 1888 | { | ||
| 1889 | case dnone: | ||
| 1890 | /* We're not on a preprocessor line. */ | ||
| 1891 | break; | ||
| 1892 | case dsharpseen: | ||
| 1893 | if (toktype == st_C_define) | ||
| 1894 | { | ||
| 1895 | definedef = ddefineseen; | ||
| 1896 | } | ||
| 1897 | else | ||
| 1898 | { | ||
| 1899 | definedef = dignorerest; | ||
| 1900 | } | ||
| 1901 | return (FALSE); | ||
| 1902 | case ddefineseen: | ||
| 1903 | /* | ||
| 1904 | * Make a tag for any macro. | ||
| 1905 | */ | ||
| 1906 | definedef = dignorerest; | ||
| 1907 | *is_func = (c == '('); | ||
| 1908 | if (!*is_func && !constantypedefs) | ||
| 1909 | return (FALSE); | ||
| 1910 | else | ||
| 1911 | return (TRUE); | ||
| 1912 | case dignorerest: | ||
| 1913 | return (FALSE); | ||
| 1914 | default: | ||
| 1915 | error ("internal error: definedef value.", 0); | ||
| 1916 | } | ||
| 1917 | |||
| 1918 | /* | ||
| 1919 | * Now typedefs | ||
| 1920 | */ | ||
| 1921 | switch (typdef) | ||
| 1922 | { | ||
| 1923 | case tnone: | ||
| 1924 | if (toktype == st_C_typedef) | ||
| 1925 | { | ||
| 1926 | if (typedefs) | ||
| 1927 | typdef = ttypedseen; | ||
| 1928 | funcdef = fnone; | ||
| 1929 | return (FALSE); | ||
| 1930 | } | ||
| 1931 | break; | ||
| 1932 | case ttypedseen: | ||
| 1933 | switch (toktype) | ||
| 1934 | { | ||
| 1935 | case st_none: | ||
| 1936 | case st_C_typespec: | ||
| 1937 | typdef = tend; | ||
| 1938 | break; | ||
| 1939 | case st_C_struct: | ||
| 1940 | case st_C_enum: | ||
| 1941 | break; | ||
| 1942 | } | ||
| 1943 | /* Do not return here, so the structdef stuff has a chance. */ | ||
| 1944 | break; | ||
| 1945 | case tend: | ||
| 1946 | switch (toktype) | ||
| 1947 | { | ||
| 1948 | case st_C_typespec: | ||
| 1949 | case st_C_struct: | ||
| 1950 | case st_C_enum: | ||
| 1951 | return (FALSE); | ||
| 1952 | } | ||
| 1953 | return (TRUE); | ||
| 1954 | } | ||
| 1955 | 2060 | ||
| 1956 | /* | 2061 | while (*cp && (*cp | ' ') == (dbp[len] | ' ')) |
| 1957 | * This structdef business is currently only invoked when cblev==0. | 2062 | cp++, len++; |
| 1958 | * It should be recursively invoked whatever the curly brace level, | 2063 | if (*cp == 0) |
| 1959 | * and a stack of states kept, to allow for definitions of structs | ||
| 1960 | * within structs. | ||
| 1961 | * | ||
| 1962 | * This structdef business is NOT invoked when we are ctags and the | ||
| 1963 | * file is plain C. This is because a struct tag may have the same | ||
| 1964 | * name as another tag, and this loses with ctags. | ||
| 1965 | * | ||
| 1966 | * This if statement deals with the typdef state machine as | ||
| 1967 | * follows: if typdef==ttypedseen and token is struct/union/class/enum, | ||
| 1968 | * return (FALSE). All the other code here is for the structdef | ||
| 1969 | * state machine. | ||
| 1970 | */ | ||
| 1971 | switch (toktype) | ||
| 1972 | { | ||
| 1973 | case st_C_struct: | ||
| 1974 | case st_C_enum: | ||
| 1975 | if (typdef == ttypedseen | ||
| 1976 | || (typedefs_and_cplusplus && cblev == 0 && structdef == snone)) | ||
| 1977 | { | ||
| 1978 | structdef = skeyseen; | ||
| 1979 | structtype = toktype; | ||
| 1980 | } | ||
| 1981 | return (FALSE); | ||
| 1982 | } | ||
| 1983 | if (structdef == skeyseen) | ||
| 1984 | { | 2064 | { |
| 1985 | if (structtype == st_C_struct) | 2065 | dbp += len; |
| 1986 | { | ||
| 1987 | strncpy (structtag, tokp->p, tokp->len); | ||
| 1988 | structtag[tokp->len] = '\0'; /* for struct/union/class */ | ||
| 1989 | } | ||
| 1990 | else | ||
| 1991 | { | ||
| 1992 | structtag[0] = '\0'; /* for enum (why is it treated differently?) */ | ||
| 1993 | } | ||
| 1994 | structdef = stagseen; | ||
| 1995 | return (TRUE); | 2066 | return (TRUE); |
| 1996 | } | 2067 | } |
| 2068 | return (FALSE); | ||
| 2069 | } | ||
| 1997 | 2070 | ||
| 1998 | /* Avoid entering funcdef stuff if typdef is going on. */ | 2071 | void |
| 1999 | if (typdef != tnone) | 2072 | takeprec () |
| 2073 | { | ||
| 2074 | while (isspace (*dbp)) | ||
| 2075 | dbp++; | ||
| 2076 | if (*dbp != '*') | ||
| 2077 | return; | ||
| 2078 | dbp++; | ||
| 2079 | while (isspace (*dbp)) | ||
| 2080 | dbp++; | ||
| 2081 | if (!isdigit (*dbp)) | ||
| 2000 | { | 2082 | { |
| 2001 | definedef = dnone; | 2083 | --dbp; /* force failure */ |
| 2002 | return (FALSE); | 2084 | return; |
| 2003 | } | 2085 | } |
| 2086 | do | ||
| 2087 | dbp++; | ||
| 2088 | while (isdigit (*dbp)); | ||
| 2089 | } | ||
| 2004 | 2090 | ||
| 2005 | /* Detect GNUmacs's function-defining macros. */ | 2091 | void |
| 2006 | if (definedef == dnone) | 2092 | getit (inf) |
| 2007 | { | 2093 | FILE *inf; |
| 2008 | if (strneq (tokp->p, "DEF", 3) | 2094 | { |
| 2009 | || strneq (tokp->p, "ENTRY", 5) | 2095 | register char *cp; |
| 2010 | || strneq (tokp->p, "SYSCALL", 7) | 2096 | char c; |
| 2011 | || strneq (tokp->p, "PSEUDO", 6)) | 2097 | char nambuf[BUFSIZ]; |
| 2012 | { | ||
| 2013 | next_token_is_func = TRUE; | ||
| 2014 | return (FALSE); | ||
| 2015 | } | ||
| 2016 | if (strneq (tokp->p, "EXFUN", 5)) | ||
| 2017 | { | ||
| 2018 | next_token_is_func = FALSE; | ||
| 2019 | return (FALSE); | ||
| 2020 | } | ||
| 2021 | } | ||
| 2022 | if (next_token_is_func) | ||
| 2023 | { | ||
| 2024 | next_token_is_func = FALSE; | ||
| 2025 | funcdef = fnone; | ||
| 2026 | *is_func = TRUE; /* to force search string in ctags */ | ||
| 2027 | return (TRUE); | ||
| 2028 | } | ||
| 2029 | 2098 | ||
| 2030 | /* A function? */ | 2099 | while (isspace (*dbp)) |
| 2031 | switch (toktype) | 2100 | dbp++; |
| 2101 | if (*dbp == '\0') | ||
| 2032 | { | 2102 | { |
| 2033 | case st_C_typespec: | 2103 | lineno++; |
| 2034 | if (funcdef != finlist && funcdef != fignore) | 2104 | linecharno = charno; |
| 2035 | funcdef = fnone; /* should be useless */ | 2105 | charno += readline (&lb, inf); |
| 2036 | return (FALSE); | 2106 | dbp = lb.buffer; |
| 2037 | default: | 2107 | if (dbp[5] != '&') |
| 2038 | if (funcdef == fnone) | 2108 | return; |
| 2039 | { | 2109 | dbp += 6; |
| 2040 | funcdef = ftagseen; | 2110 | while (isspace (*dbp)) |
| 2041 | *is_func = TRUE; | 2111 | dbp++; |
| 2042 | return (TRUE); | ||
| 2043 | } | ||
| 2044 | } | 2112 | } |
| 2045 | 2113 | if (!isalpha (*dbp) | |
| 2046 | return (FALSE); | 2114 | && *dbp != '_' |
| 2115 | && *dbp != '$') | ||
| 2116 | return; | ||
| 2117 | for (cp = dbp + 1; | ||
| 2118 | (*cp | ||
| 2119 | && (isalpha (*cp) || isdigit (*cp) || (*cp == '_') || (*cp == '$'))); | ||
| 2120 | cp++) | ||
| 2121 | continue; | ||
| 2122 | c = *cp; | ||
| 2123 | *cp = '\0'; | ||
| 2124 | strcpy (nambuf, dbp); | ||
| 2125 | *cp = c; | ||
| 2126 | pfnote (nambuf, TRUE, FALSE, lb.buffer, | ||
| 2127 | cp - lb.buffer + 1, lineno, linecharno); | ||
| 2128 | pfcnt++; | ||
| 2047 | } | 2129 | } |
| 2048 | |||
| 2049 | /* Fortran parsing */ | ||
| 2050 | |||
| 2051 | char *dbp; | ||
| 2052 | int pfcnt; | ||
| 2053 | 2130 | ||
| 2054 | int | 2131 | int |
| 2055 | PF_funcs (fi) | 2132 | Fortran_functions (inf) |
| 2056 | FILE *fi; | 2133 | FILE *inf; |
| 2057 | { | 2134 | { |
| 2058 | lineno = 0; | 2135 | lineno = 0; |
| 2059 | charno = 0; | 2136 | charno = 0; |
| 2060 | pfcnt = 0; | 2137 | pfcnt = 0; |
| 2061 | 2138 | ||
| 2062 | while (!feof (fi)) | 2139 | while (!feof (inf)) |
| 2063 | { | 2140 | { |
| 2064 | lineno++; | 2141 | lineno++; |
| 2065 | linecharno = charno; | 2142 | linecharno = charno; |
| 2066 | charno += readline (&lb, fi); | 2143 | charno += readline (&lb, inf); |
| 2067 | dbp = lb.buffer; | 2144 | dbp = lb.buffer; |
| 2068 | if (*dbp == '%') | 2145 | if (*dbp == '%') |
| 2069 | dbp++; /* Ratfor escape to fortran */ | 2146 | dbp++; /* Ratfor escape to fortran */ |
| @@ -2110,131 +2187,74 @@ PF_funcs (fi) | |||
| 2110 | { | 2187 | { |
| 2111 | case 'f': | 2188 | case 'f': |
| 2112 | if (tail ("function")) | 2189 | if (tail ("function")) |
| 2113 | getit (fi); | 2190 | getit (inf); |
| 2114 | continue; | 2191 | continue; |
| 2115 | case 's': | 2192 | case 's': |
| 2116 | if (tail ("subroutine")) | 2193 | if (tail ("subroutine")) |
| 2117 | getit (fi); | 2194 | getit (inf); |
| 2118 | continue; | 2195 | continue; |
| 2119 | case 'e': | 2196 | case 'e': |
| 2120 | if (tail ("entry")) | 2197 | if (tail ("entry")) |
| 2121 | getit (fi); | 2198 | getit (inf); |
| 2122 | continue; | 2199 | continue; |
| 2123 | case 'p': | 2200 | case 'p': |
| 2124 | if (tail ("program")) | 2201 | if (tail ("program")) |
| 2125 | { | 2202 | { |
| 2126 | getit (fi); | 2203 | getit (inf); |
| 2127 | continue; | 2204 | continue; |
| 2128 | } | 2205 | } |
| 2129 | if (tail ("procedure")) | 2206 | if (tail ("procedure")) |
| 2130 | getit (fi); | 2207 | getit (inf); |
| 2131 | continue; | 2208 | continue; |
| 2132 | } | 2209 | } |
| 2133 | } | 2210 | } |
| 2134 | return (pfcnt); | 2211 | return (pfcnt); |
| 2135 | } | 2212 | } |
| 2136 | 2213 | ||
| 2137 | logical | 2214 | /* |
| 2138 | tail (cp) | 2215 | * Bob Weiner, Motorola Inc., 4/3/94 |
| 2139 | char *cp; | 2216 | * Unix and microcontroller assembly tag handling |
| 2140 | { | 2217 | * look for '^[a-zA-Z_.$][a-zA_Z0-9_.$]*[: ^I^J]' |
| 2141 | register int len = 0; | 2218 | */ |
| 2142 | |||
| 2143 | while (*cp && (*cp | ' ') == (dbp[len] | ' ')) | ||
| 2144 | cp++, len++; | ||
| 2145 | if (*cp == 0) | ||
| 2146 | { | ||
| 2147 | dbp += len; | ||
| 2148 | return (TRUE); | ||
| 2149 | } | ||
| 2150 | return (FALSE); | ||
| 2151 | } | ||
| 2152 | |||
| 2153 | void | ||
| 2154 | takeprec () | ||
| 2155 | { | ||
| 2156 | while (isspace (*dbp)) | ||
| 2157 | dbp++; | ||
| 2158 | if (*dbp != '*') | ||
| 2159 | return; | ||
| 2160 | dbp++; | ||
| 2161 | while (isspace (*dbp)) | ||
| 2162 | dbp++; | ||
| 2163 | if (!isdigit (*dbp)) | ||
| 2164 | { | ||
| 2165 | --dbp; /* force failure */ | ||
| 2166 | return; | ||
| 2167 | } | ||
| 2168 | do | ||
| 2169 | dbp++; | ||
| 2170 | while (isdigit (*dbp)); | ||
| 2171 | } | ||
| 2172 | |||
| 2173 | void | 2219 | void |
| 2174 | getit (fi) | 2220 | Asm_labels (inf) |
| 2175 | FILE *fi; | 2221 | FILE *inf; |
| 2176 | { | 2222 | { |
| 2223 | char nambuf[BUFSIZ]; | ||
| 2177 | register char *cp; | 2224 | register char *cp; |
| 2178 | char c; | 2225 | char c; |
| 2179 | char nambuf[BUFSIZ]; | ||
| 2180 | |||
| 2181 | while (isspace (*dbp)) | ||
| 2182 | dbp++; | ||
| 2183 | if (*dbp == '\0') | ||
| 2184 | { | ||
| 2185 | lineno++; | ||
| 2186 | linecharno = charno; | ||
| 2187 | charno += readline (&lb, fi); | ||
| 2188 | dbp = lb.buffer; | ||
| 2189 | if (dbp[5] != '&') | ||
| 2190 | return; | ||
| 2191 | dbp += 6; | ||
| 2192 | while (isspace (*dbp)) | ||
| 2193 | dbp++; | ||
| 2194 | } | ||
| 2195 | if (!isalpha (*dbp) | ||
| 2196 | && *dbp != '_' | ||
| 2197 | && *dbp != '$') | ||
| 2198 | return; | ||
| 2199 | for (cp = dbp + 1; | ||
| 2200 | (*cp | ||
| 2201 | && (isalpha (*cp) || isdigit (*cp) || (*cp == '_') || (*cp == '$'))); | ||
| 2202 | cp++) | ||
| 2203 | continue; | ||
| 2204 | c = *cp; | ||
| 2205 | *cp = '\0'; | ||
| 2206 | strcpy (nambuf, dbp); | ||
| 2207 | *cp = c; | ||
| 2208 | pfnote (nambuf, TRUE, FALSE, lb.buffer, | ||
| 2209 | cp - lb.buffer + 1, lineno, linecharno); | ||
| 2210 | pfcnt++; | ||
| 2211 | } | ||
| 2212 | |||
| 2213 | /* Handle a file of assembler code. */ | ||
| 2214 | |||
| 2215 | void | ||
| 2216 | Asm_funcs (fi) | ||
| 2217 | FILE *fi; | ||
| 2218 | { | ||
| 2219 | int i; | ||
| 2220 | register char c; | ||
| 2221 | 2226 | ||
| 2222 | lineno = 0; | 2227 | lineno = 0; |
| 2223 | charno = 0; | 2228 | charno = 0; |
| 2224 | pfcnt = 0; | 2229 | pfcnt = 0; |
| 2225 | 2230 | ||
| 2226 | while (!feof (fi)) | 2231 | while (!feof (inf)) |
| 2227 | { | 2232 | { |
| 2228 | lineno++; | 2233 | lineno++; |
| 2229 | linecharno = charno; | 2234 | linecharno = charno; |
| 2230 | charno += readline (&lb, fi); | 2235 | charno += readline (&lb, inf); |
| 2231 | dbp = lb.buffer; | 2236 | cp = lb.buffer; |
| 2232 | 2237 | ||
| 2233 | for (i = 0; ((c = dbp[i]) && !isspace (c)) && (c != ':'); i++) | 2238 | /* If first char is alphabetic or one of [_.$], test for colon |
| 2234 | ; | 2239 | following identifier. */ |
| 2235 | 2240 | if (isalpha (*cp) || *cp == '_' || *cp == '.' || *cp == '$') | |
| 2236 | if ((i > 0) && (c == ':')) | 2241 | { |
| 2237 | getit (fi); | 2242 | /* Read past label. */ |
| 2243 | cp++; | ||
| 2244 | while (isalnum (*cp) || *cp == '_' || *cp == '.' || *cp == '$') | ||
| 2245 | cp++; | ||
| 2246 | if (*cp == ':' || isspace (*cp)) | ||
| 2247 | { | ||
| 2248 | /* Found end of label, so copy it and add it to the table. */ | ||
| 2249 | c = *cp; | ||
| 2250 | *cp = '\0'; | ||
| 2251 | strcpy (nambuf, lb.buffer); | ||
| 2252 | *cp = c; | ||
| 2253 | pfnote (nambuf, TRUE, FALSE, lb.buffer, | ||
| 2254 | cp - lb.buffer + 1, lineno, linecharno); | ||
| 2255 | pfcnt++; | ||
| 2256 | } | ||
| 2257 | } | ||
| 2238 | } | 2258 | } |
| 2239 | } | 2259 | } |
| 2240 | 2260 | ||
| @@ -2256,8 +2276,8 @@ Asm_funcs (fi) | |||
| 2256 | */ | 2276 | */ |
| 2257 | 2277 | ||
| 2258 | void | 2278 | void |
| 2259 | PAS_funcs (fi) | 2279 | Pascal_functions (inf) |
| 2260 | FILE *fi; | 2280 | FILE *inf; |
| 2261 | { | 2281 | { |
| 2262 | struct linebuffer tline; /* mostly copied from C_entries */ | 2282 | struct linebuffer tline; /* mostly copied from C_entries */ |
| 2263 | long save_lcno; | 2283 | long save_lcno; |
| @@ -2291,7 +2311,7 @@ PAS_funcs (fi) | |||
| 2291 | verify_tag = FALSE; /* check if "extern" is ahead */ | 2311 | verify_tag = FALSE; /* check if "extern" is ahead */ |
| 2292 | 2312 | ||
| 2293 | /* long main loop to get next char */ | 2313 | /* long main loop to get next char */ |
| 2294 | while (!feof (fi)) | 2314 | while (!feof (inf)) |
| 2295 | { | 2315 | { |
| 2296 | c = *dbp++; | 2316 | c = *dbp++; |
| 2297 | if (c == 0) /* if end of line */ | 2317 | if (c == 0) /* if end of line */ |
| @@ -2432,7 +2452,7 @@ PAS_funcs (fi) | |||
| 2432 | continue; | 2452 | continue; |
| 2433 | } | 2453 | } |
| 2434 | } | 2454 | } |
| 2435 | } /* while not e-o-f */ | 2455 | } /* while not eof */ |
| 2436 | } | 2456 | } |
| 2437 | 2457 | ||
| 2438 | /* | 2458 | /* |
| @@ -2440,57 +2460,6 @@ PAS_funcs (fi) | |||
| 2440 | * just look for (def or (DEF | 2460 | * just look for (def or (DEF |
| 2441 | */ | 2461 | */ |
| 2442 | 2462 | ||
| 2443 | void | ||
| 2444 | L_funcs (fi) | ||
| 2445 | FILE *fi; | ||
| 2446 | { | ||
| 2447 | lineno = 0; | ||
| 2448 | charno = 0; | ||
| 2449 | pfcnt = 0; | ||
| 2450 | |||
| 2451 | while (!feof (fi)) | ||
| 2452 | { | ||
| 2453 | lineno++; | ||
| 2454 | linecharno = charno; | ||
| 2455 | charno += readline (&lb, fi); | ||
| 2456 | dbp = lb.buffer; | ||
| 2457 | if (dbp[0] == '(') | ||
| 2458 | { | ||
| 2459 | if (L_isdef (dbp)) | ||
| 2460 | { | ||
| 2461 | while (!isspace (*dbp)) | ||
| 2462 | dbp++; | ||
| 2463 | while (isspace (*dbp)) | ||
| 2464 | dbp++; | ||
| 2465 | L_getit (); | ||
| 2466 | } | ||
| 2467 | else | ||
| 2468 | { | ||
| 2469 | /* Check for (foo::defmumble name-defined ... */ | ||
| 2470 | do | ||
| 2471 | dbp++; | ||
| 2472 | while (*dbp && !isspace (*dbp) | ||
| 2473 | && *dbp != ':' && *dbp != '(' && *dbp != ')'); | ||
| 2474 | if (*dbp == ':') | ||
| 2475 | { | ||
| 2476 | do | ||
| 2477 | dbp++; | ||
| 2478 | while (*dbp == ':'); | ||
| 2479 | |||
| 2480 | if (L_isdef (dbp - 1)) | ||
| 2481 | { | ||
| 2482 | while (!isspace (*dbp)) | ||
| 2483 | dbp++; | ||
| 2484 | while (isspace (*dbp)) | ||
| 2485 | dbp++; | ||
| 2486 | L_getit (); | ||
| 2487 | } | ||
| 2488 | } | ||
| 2489 | } | ||
| 2490 | } | ||
| 2491 | } | ||
| 2492 | } | ||
| 2493 | |||
| 2494 | int | 2463 | int |
| 2495 | L_isdef (dbp) | 2464 | L_isdef (dbp) |
| 2496 | register char *dbp; | 2465 | register char *dbp; |
| @@ -2540,6 +2509,57 @@ L_getit () | |||
| 2540 | cp - lb.buffer + 1, lineno, linecharno); | 2509 | cp - lb.buffer + 1, lineno, linecharno); |
| 2541 | pfcnt++; | 2510 | pfcnt++; |
| 2542 | } | 2511 | } |
| 2512 | |||
| 2513 | void | ||
| 2514 | Lisp_functions (inf) | ||
| 2515 | FILE *inf; | ||
| 2516 | { | ||
| 2517 | lineno = 0; | ||
| 2518 | charno = 0; | ||
| 2519 | pfcnt = 0; | ||
| 2520 | |||
| 2521 | while (!feof (inf)) | ||
| 2522 | { | ||
| 2523 | lineno++; | ||
| 2524 | linecharno = charno; | ||
| 2525 | charno += readline (&lb, inf); | ||
| 2526 | dbp = lb.buffer; | ||
| 2527 | if (dbp[0] == '(') | ||
| 2528 | { | ||
| 2529 | if (L_isdef (dbp)) | ||
| 2530 | { | ||
| 2531 | while (!isspace (*dbp)) | ||
| 2532 | dbp++; | ||
| 2533 | while (isspace (*dbp)) | ||
| 2534 | dbp++; | ||
| 2535 | L_getit (); | ||
| 2536 | } | ||
| 2537 | else | ||
| 2538 | { | ||
| 2539 | /* Check for (foo::defmumble name-defined ... */ | ||
| 2540 | do | ||
| 2541 | dbp++; | ||
| 2542 | while (*dbp && !isspace (*dbp) | ||
| 2543 | && *dbp != ':' && *dbp != '(' && *dbp != ')'); | ||
| 2544 | if (*dbp == ':') | ||
| 2545 | { | ||
| 2546 | do | ||
| 2547 | dbp++; | ||
| 2548 | while (*dbp == ':'); | ||
| 2549 | |||
| 2550 | if (L_isdef (dbp - 1)) | ||
| 2551 | { | ||
| 2552 | while (!isspace (*dbp)) | ||
| 2553 | dbp++; | ||
| 2554 | while (isspace (*dbp)) | ||
| 2555 | dbp++; | ||
| 2556 | L_getit (); | ||
| 2557 | } | ||
| 2558 | } | ||
| 2559 | } | ||
| 2560 | } | ||
| 2561 | } | ||
| 2562 | } | ||
| 2543 | 2563 | ||
| 2544 | /* | 2564 | /* |
| 2545 | * Scheme tag functions | 2565 | * Scheme tag functions |
| @@ -2549,21 +2569,21 @@ L_getit () | |||
| 2549 | * look for (set! xyzzy | 2569 | * look for (set! xyzzy |
| 2550 | */ | 2570 | */ |
| 2551 | 2571 | ||
| 2552 | static void get_scheme (); | 2572 | void get_scheme (); |
| 2553 | 2573 | ||
| 2554 | void | 2574 | void |
| 2555 | Scheme_funcs (fi) | 2575 | Scheme_functions (inf) |
| 2556 | FILE *fi; | 2576 | FILE *inf; |
| 2557 | { | 2577 | { |
| 2558 | lineno = 0; | 2578 | lineno = 0; |
| 2559 | charno = 0; | 2579 | charno = 0; |
| 2560 | pfcnt = 0; | 2580 | pfcnt = 0; |
| 2561 | 2581 | ||
| 2562 | while (!feof (fi)) | 2582 | while (!feof (inf)) |
| 2563 | { | 2583 | { |
| 2564 | lineno++; | 2584 | lineno++; |
| 2565 | linecharno = charno; | 2585 | linecharno = charno; |
| 2566 | charno += readline (&lb, fi); | 2586 | charno += readline (&lb, inf); |
| 2567 | dbp = lb.buffer; | 2587 | dbp = lb.buffer; |
| 2568 | if (dbp[0] == '(' && | 2588 | if (dbp[0] == '(' && |
| 2569 | (dbp[1] == 'D' || dbp[1] == 'd') && | 2589 | (dbp[1] == 'D' || dbp[1] == 'd') && |
| @@ -2594,7 +2614,7 @@ Scheme_funcs (fi) | |||
| 2594 | } | 2614 | } |
| 2595 | } | 2615 | } |
| 2596 | 2616 | ||
| 2597 | static void | 2617 | void |
| 2598 | get_scheme () | 2618 | get_scheme () |
| 2599 | { | 2619 | { |
| 2600 | register char *cp; | 2620 | register char *cp; |
| @@ -2635,25 +2655,25 @@ struct TEX_tabent *TEX_toktab = NULL; /* Table with tag tokens */ | |||
| 2635 | /* Default set of control sequences to put into TEX_toktab. | 2655 | /* Default set of control sequences to put into TEX_toktab. |
| 2636 | The value of environment var TEXTAGS is prepended to this. */ | 2656 | The value of environment var TEXTAGS is prepended to this. */ |
| 2637 | 2657 | ||
| 2638 | static char *TEX_defenv = | 2658 | char *TEX_defenv = "\ |
| 2639 | ":chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem:typeout"; | 2659 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem:typeout"; |
| 2640 | 2660 | ||
| 2641 | void TEX_mode (); | 2661 | void TEX_mode (); |
| 2642 | struct TEX_tabent *TEX_decode_env (); | 2662 | struct TEX_tabent *TEX_decode_env (); |
| 2643 | void TEX_getit (); | 2663 | void TEX_getit (); |
| 2644 | int TEX_Token (); | 2664 | int TEX_Token (); |
| 2645 | 2665 | ||
| 2646 | static char TEX_esc = '\\'; | 2666 | char TEX_esc = '\\'; |
| 2647 | static char TEX_opgrp = '{'; | 2667 | char TEX_opgrp = '{'; |
| 2648 | static char TEX_clgrp = '}'; | 2668 | char TEX_clgrp = '}'; |
| 2649 | 2669 | ||
| 2650 | /* | 2670 | /* |
| 2651 | * TeX/LaTeX scanning loop. | 2671 | * TeX/LaTeX scanning loop. |
| 2652 | */ | 2672 | */ |
| 2653 | 2673 | ||
| 2654 | void | 2674 | void |
| 2655 | TEX_funcs (fi) | 2675 | TeX_functions (inf) |
| 2656 | FILE *fi; | 2676 | FILE *inf; |
| 2657 | { | 2677 | { |
| 2658 | char *lasthit; | 2678 | char *lasthit; |
| 2659 | 2679 | ||
| @@ -2662,17 +2682,17 @@ TEX_funcs (fi) | |||
| 2662 | pfcnt = 0; | 2682 | pfcnt = 0; |
| 2663 | 2683 | ||
| 2664 | /* Select either \ or ! as escape character. */ | 2684 | /* Select either \ or ! as escape character. */ |
| 2665 | TEX_mode (fi); | 2685 | TEX_mode (inf); |
| 2666 | 2686 | ||
| 2667 | /* Initialize token table once from environment. */ | 2687 | /* Initialize token table once from environment. */ |
| 2668 | if (!TEX_toktab) | 2688 | if (!TEX_toktab) |
| 2669 | TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv); | 2689 | TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv); |
| 2670 | 2690 | ||
| 2671 | while (!feof (fi)) | 2691 | while (!feof (inf)) |
| 2672 | { /* Scan each line in file */ | 2692 | { /* Scan each line in file */ |
| 2673 | lineno++; | 2693 | lineno++; |
| 2674 | linecharno = charno; | 2694 | linecharno = charno; |
| 2675 | charno += readline (&lb, fi); | 2695 | charno += readline (&lb, inf); |
| 2676 | dbp = lb.buffer; | 2696 | dbp = lb.buffer; |
| 2677 | lasthit = dbp; | 2697 | lasthit = dbp; |
| 2678 | while (dbp = etags_strchr (dbp, TEX_esc)) /* Look at each esc in line */ | 2698 | while (dbp = etags_strchr (dbp, TEX_esc)) /* Look at each esc in line */ |
| @@ -2701,17 +2721,17 @@ TEX_funcs (fi) | |||
| 2701 | /* chars accordingly. */ | 2721 | /* chars accordingly. */ |
| 2702 | 2722 | ||
| 2703 | void | 2723 | void |
| 2704 | TEX_mode (f) | 2724 | TEX_mode (inf) |
| 2705 | FILE *f; | 2725 | FILE *inf; |
| 2706 | { | 2726 | { |
| 2707 | int c; | 2727 | int c; |
| 2708 | 2728 | ||
| 2709 | while ((c = getc (f)) != EOF) | 2729 | while ((c = getc (inf)) != EOF) |
| 2710 | { | 2730 | { |
| 2711 | /* Skip to next line if we hit the TeX comment char. */ | 2731 | /* Skip to next line if we hit the TeX comment char. */ |
| 2712 | if (c == TEX_cmt) | 2732 | if (c == TEX_cmt) |
| 2713 | while (c != '\n') | 2733 | while (c != '\n') |
| 2714 | c = getc (f); | 2734 | c = getc (inf); |
| 2715 | else if (c == TEX_LESC || c == TEX_SESC ) | 2735 | else if (c == TEX_LESC || c == TEX_SESC ) |
| 2716 | break; | 2736 | break; |
| 2717 | } | 2737 | } |
| @@ -2728,7 +2748,7 @@ TEX_mode (f) | |||
| 2728 | TEX_opgrp = '<'; | 2748 | TEX_opgrp = '<'; |
| 2729 | TEX_clgrp = '>'; | 2749 | TEX_clgrp = '>'; |
| 2730 | } | 2750 | } |
| 2731 | rewind (f); | 2751 | rewind (inf); |
| 2732 | } | 2752 | } |
| 2733 | 2753 | ||
| 2734 | /* Read environment and prepend it to the default string. */ | 2754 | /* Read environment and prepend it to the default string. */ |
| @@ -2888,40 +2908,40 @@ prolog_getit (s, lineno, linecharno) | |||
| 2888 | /* It is assumed that prolog predicate starts from column 0. */ | 2908 | /* It is assumed that prolog predicate starts from column 0. */ |
| 2889 | 2909 | ||
| 2890 | void | 2910 | void |
| 2891 | prolog_funcs (fi) | 2911 | Prolog_functions (inf) |
| 2892 | FILE *fi; | 2912 | FILE *inf; |
| 2893 | { | 2913 | { |
| 2894 | void skip_comment (), prolog_getit (); | 2914 | void skip_comment (), prolog_getit (); |
| 2895 | 2915 | ||
| 2896 | lineno = linecharno = charno = 0; | 2916 | lineno = linecharno = charno = 0; |
| 2897 | while (!feof (fi)) | 2917 | while (!feof (inf)) |
| 2898 | { | 2918 | { |
| 2899 | lineno++; | 2919 | lineno++; |
| 2900 | linecharno += charno; | 2920 | linecharno += charno; |
| 2901 | charno = readline (&lb, fi) + 1; /* 1 for newline. */ | 2921 | charno = readline (&lb, inf) + 1; /* 1 for newline. */ |
| 2902 | dbp = lb.buffer; | 2922 | dbp = lb.buffer; |
| 2903 | if (isspace (dbp[0])) /* not predicate header. */ | 2923 | if (isspace (dbp[0])) /* not predicate header. */ |
| 2904 | continue; | 2924 | continue; |
| 2905 | else if (dbp[0] == '%') /* comment. */ | 2925 | else if (dbp[0] == '%') /* comment. */ |
| 2906 | continue; | 2926 | continue; |
| 2907 | else if (dbp[0] == '/' && dbp[1] == '*') /* comment. */ | 2927 | else if (dbp[0] == '/' && dbp[1] == '*') /* comment. */ |
| 2908 | skip_comment (&lb, fi, &lineno, &linecharno); | 2928 | skip_comment (&lb, inf, &lineno, &linecharno); |
| 2909 | else /* found. */ | 2929 | else /* found. */ |
| 2910 | prolog_getit (dbp, lineno, linecharno); | 2930 | prolog_getit (dbp, lineno, linecharno); |
| 2911 | } | 2931 | } |
| 2912 | } | 2932 | } |
| 2913 | 2933 | ||
| 2914 | void | 2934 | void |
| 2915 | skip_comment (plb, fi, plineno, plinecharno) | 2935 | skip_comment (plb, inf, plineno, plinecharno) |
| 2916 | struct linebuffer *plb; | 2936 | struct linebuffer *plb; |
| 2917 | FILE *fi; | 2937 | FILE *inf; |
| 2918 | int *plineno; /* result */ | 2938 | int *plineno; /* result */ |
| 2919 | long *plinecharno; /* result */ | 2939 | long *plinecharno; /* result */ |
| 2920 | { | 2940 | { |
| 2921 | while (!substr ("*/", plb->buffer)) | 2941 | while (!substr ("*/", plb->buffer)) |
| 2922 | { | 2942 | { |
| 2923 | (*plineno)++; | 2943 | (*plineno)++; |
| 2924 | *plinecharno += readline (plb, fi) + 1; | 2944 | *plinecharno += readline (plb, inf) + 1; |
| 2925 | } /* 1 for newline. */ | 2945 | } /* 1 for newline. */ |
| 2926 | } | 2946 | } |
| 2927 | 2947 | ||
| @@ -3108,8 +3128,8 @@ concat (s1, s2, s3) | |||
| 3108 | return result; | 3128 | return result; |
| 3109 | } | 3129 | } |
| 3110 | 3130 | ||
| 3111 | /* Identical to system V getcwd, but does not need to guess | 3131 | /* Does the same work as the system V getcwd, but does not need to |
| 3112 | buffer size in advance. Included mostly for compatibility. */ | 3132 | guess buffer size in advance. Included mostly for compatibility. */ |
| 3113 | char * | 3133 | char * |
| 3114 | etags_getcwd () | 3134 | etags_getcwd () |
| 3115 | { | 3135 | { |