diff options
| author | Francesco Potortì | 2003-01-09 15:21:57 +0000 |
|---|---|---|
| committer | Francesco Potortì | 2003-01-09 15:21:57 +0000 |
| commit | 4fdb45538890d6016e38f100ac1567409ef27e90 (patch) | |
| tree | 6bd3e71233dab2201a28188c96bb73c1aca91653 /lib-src | |
| parent | 986578989a98ba825a9fd9aa3bd2dc589a2a5624 (diff) | |
| download | emacs-4fdb45538890d6016e38f100ac1567409ef27e90.tar.gz emacs-4fdb45538890d6016e38f100ac1567409ef27e90.zip | |
changes for language-sepcific help by Philippe
Waroquiers <wao@cfmu.eurocontrol.be> applied and largely revised.
(language): Added a `help' member.
(arg_type): Added an at_end constant.
(plain_C_suffixes): Some items removed from here.
(Objc_suffixes): And put here (new constant).
(Ada_help, Asm_help, default_C_help, Cplusplus_help, Cjava_help,
Cobol_help, Erlang_help, Fortran_help, HTML_help, Lisp_help,
Makefile_help, Objc_help, Pascal_help, Perl_help, PHP_help,
PS_help, Prolog_help, Python_help, Scheme_help, TeX_help,
Texinfo_help, Yacc_help, auto_help, none-help, no_lang_help): New
constants.
(PS_functions, PS_suffixes): Renamed from Postscript_functions and
Postscript_suffixes.
(lang_names): Adapted to the new language structure, new language
"objc" added (was previously merged with "proc").
(print_language_names): Some help strings corrected.
(print_help): Now takes an argument and possibly prints lang help.
(print_help): Some help strings corrected. Documents
language-specific help.
(main): Only print help after having parsed all the arguments.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 253 |
1 files changed, 204 insertions, 49 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index c0518af6034..e9f1028d222 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| 37 | 37 | ||
| 38 | char pot_etags_version[] = "@(#) pot revision number is $Revision: 16.55 $"; | 38 | char pot_etags_version[] = "@(#) pot revision number is 16.56"; |
| 39 | 39 | ||
| 40 | #define TRUE 1 | 40 | #define TRUE 1 |
| 41 | #define FALSE 0 | 41 | #define FALSE 0 |
| @@ -239,11 +239,12 @@ typedef struct | |||
| 239 | typedef struct | 239 | typedef struct |
| 240 | { | 240 | { |
| 241 | char *name; /* language name */ | 241 | char *name; /* language name */ |
| 242 | bool metasource; /* source used to generate other sources */ | 242 | char *help; /* detailed help for the language */ |
| 243 | Lang_function *function; /* parse function */ | 243 | Lang_function *function; /* parse function */ |
| 244 | char **filenames; /* names of this language's files */ | ||
| 245 | char **suffixes; /* name suffixes of this language's files */ | 244 | char **suffixes; /* name suffixes of this language's files */ |
| 245 | char **filenames; /* names of this language's files */ | ||
| 246 | char **interpreters; /* interpreters for this language */ | 246 | char **interpreters; /* interpreters for this language */ |
| 247 | bool metasource; /* source used to generate other sources */ | ||
| 247 | } language; | 248 | } language; |
| 248 | 249 | ||
| 249 | typedef struct fdesc | 250 | typedef struct fdesc |
| @@ -293,7 +294,8 @@ typedef struct | |||
| 293 | at_language, /* a language specification */ | 294 | at_language, /* a language specification */ |
| 294 | at_regexp, /* a regular expression */ | 295 | at_regexp, /* a regular expression */ |
| 295 | at_filename, /* a file name */ | 296 | at_filename, /* a file name */ |
| 296 | at_stdin /* read from stdin here */ | 297 | at_stdin, /* read from stdin here */ |
| 298 | at_end /* stop parsing the list */ | ||
| 297 | } arg_type; /* argument type */ | 299 | } arg_type; /* argument type */ |
| 298 | language *lang; /* language associated with the argument */ | 300 | language *lang; /* language associated with the argument */ |
| 299 | char *what; /* the argument itself */ | 301 | char *what; /* the argument itself */ |
| @@ -337,7 +339,7 @@ static void Makefile_targets __P((FILE *)); | |||
| 337 | static void Pascal_functions __P((FILE *)); | 339 | static void Pascal_functions __P((FILE *)); |
| 338 | static void Perl_functions __P((FILE *)); | 340 | static void Perl_functions __P((FILE *)); |
| 339 | static void PHP_functions __P((FILE *)); | 341 | static void PHP_functions __P((FILE *)); |
| 340 | static void Postscript_functions __P((FILE *)); | 342 | static void PS_functions __P((FILE *)); |
| 341 | static void Prolog_functions __P((FILE *)); | 343 | static void Prolog_functions __P((FILE *)); |
| 342 | static void Python_functions __P((FILE *)); | 344 | static void Python_functions __P((FILE *)); |
| 343 | static void Scheme_functions __P((FILE *)); | 345 | static void Scheme_functions __P((FILE *)); |
| @@ -348,7 +350,7 @@ static void just_read_file __P((FILE *)); | |||
| 348 | 350 | ||
| 349 | static void print_language_names __P((void)); | 351 | static void print_language_names __P((void)); |
| 350 | static void print_version __P((void)); | 352 | static void print_version __P((void)); |
| 351 | static void print_help __P((void)); | 353 | static void print_help __P((argument *)); |
| 352 | int main __P((int, char **)); | 354 | int main __P((int, char **)); |
| 353 | 355 | ||
| 354 | static compressor *get_compressor_from_suffix __P((char *, char **)); | 356 | static compressor *get_compressor_from_suffix __P((char *, char **)); |
| @@ -532,6 +534,22 @@ static compressor compressors[] = | |||
| 532 | /* Ada code */ | 534 | /* Ada code */ |
| 533 | static char *Ada_suffixes [] = | 535 | static char *Ada_suffixes [] = |
| 534 | { "ads", "adb", "ada", NULL }; | 536 | { "ads", "adb", "ada", NULL }; |
| 537 | static char Ada_help [] = | ||
| 538 | "In Ada code, functions, procedures, packages, tasks and types are\n\ | ||
| 539 | tags. Use the `--packages-only' option to create tags for\n\ | ||
| 540 | packages only.\n\ | ||
| 541 | Ada tag names have suffixes indicating the type of entity:\n\ | ||
| 542 | Entity type: Qualifier:\n\ | ||
| 543 | ------------ ----------\n\ | ||
| 544 | function /f\n\ | ||
| 545 | procedure /p\n\ | ||
| 546 | package spec /s\n\ | ||
| 547 | package body /b\n\ | ||
| 548 | type /t\n\ | ||
| 549 | task /k\n\ | ||
| 550 | Thus, `M-x find-tag <RET> bidule/b <RET>' will go directly to the\n\ | ||
| 551 | body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\ | ||
| 552 | will just search for any tag `bidule'."; | ||
| 535 | 553 | ||
| 536 | /* Assembly code */ | 554 | /* Assembly code */ |
| 537 | static char *Asm_suffixes [] = | 555 | static char *Asm_suffixes [] = |
| @@ -545,82 +563,187 @@ static char *Asm_suffixes [] = | |||
| 545 | "src", /* BSO/Tasking C compiler output */ | 563 | "src", /* BSO/Tasking C compiler output */ |
| 546 | NULL | 564 | NULL |
| 547 | }; | 565 | }; |
| 566 | static char Asm_help [] = | ||
| 567 | "In assembler code, labels appearing at the beginning of a line,\n\ | ||
| 568 | followed by a colon, are tags."; | ||
| 569 | |||
| 548 | 570 | ||
| 549 | /* Note that .c and .h can be considered C++, if the --c++ flag was | 571 | /* Note that .c and .h can be considered C++, if the --c++ flag was |
| 550 | given, or if the `class' keyowrd is met inside the file. | 572 | given, or if the `class' or `template' keyowrds are met inside the file. |
| 551 | That is why default_C_entries is called for these. */ | 573 | That is why default_C_entries is called for these. */ |
| 552 | static char *default_C_suffixes [] = | 574 | static char *default_C_suffixes [] = |
| 553 | { "c", "h", NULL }; | 575 | { "c", "h", NULL }; |
| 576 | static char default_C_help [] = | ||
| 577 | "In C code, any C function or typedef is a tag, and so are\n\ | ||
| 578 | definitions of `struct', `union' and `enum'. `#define' macro\n\ | ||
| 579 | definitions and `enum' constants are tags unless you specify\n\ | ||
| 580 | `--no-defines'. Global variables are tags unless you specify\n\ | ||
| 581 | `--no-globals'. Use of `--no-globals' and `--no-defines'\n\ | ||
| 582 | can make the tags table file much smaller.\n\ | ||
| 583 | You can tag function declarations and external variables by\n\ | ||
| 584 | using `--declarations', and struct members by using `--members'."; | ||
| 554 | 585 | ||
| 555 | static char *Cplusplus_suffixes [] = | 586 | static char *Cplusplus_suffixes [] = |
| 556 | { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", | 587 | { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", |
| 557 | "M", /* Objective C++ */ | 588 | "M", /* Objective C++ */ |
| 558 | "pdb", /* Postscript with C syntax */ | 589 | "pdb", /* Postscript with C syntax */ |
| 559 | NULL }; | 590 | NULL }; |
| 591 | static char Cplusplus_help [] = | ||
| 592 | "In C++ code, all the tag constructs of C code are tagged\n\ | ||
| 593 | (use --help --lang=c --lang=c++ for full help).\n\ | ||
| 594 | In addition to C tags, member functions are also recognized, and\n\ | ||
| 595 | optionally member variables if you use the `--members' option.\n\ | ||
| 596 | Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\ | ||
| 597 | and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ | ||
| 598 | `operator+'."; | ||
| 560 | 599 | ||
| 561 | static char *Cjava_suffixes [] = | 600 | static char *Cjava_suffixes [] = |
| 562 | { "java", NULL }; | 601 | { "java", NULL }; |
| 602 | static char Cjava_help [] = | ||
| 603 | "In Java code, all the tags constructs of C and C++ code are\n\ | ||
| 604 | tagged (use --help --lang=c --lang=c++ --lang=java for full help)."; | ||
| 605 | |||
| 563 | 606 | ||
| 564 | static char *Cobol_suffixes [] = | 607 | static char *Cobol_suffixes [] = |
| 565 | { "COB", "cob", NULL }; | 608 | { "COB", "cob", NULL }; |
| 609 | static char Cobol_help [] = | ||
| 610 | "In Cobol code, tags are paragraph names; that is, any word\n\ | ||
| 611 | starting in column 8 and followed by a period."; | ||
| 566 | 612 | ||
| 567 | static char *Cstar_suffixes [] = | 613 | static char *Cstar_suffixes [] = |
| 568 | { "cs", "hs", NULL }; | 614 | { "cs", "hs", NULL }; |
| 569 | 615 | ||
| 570 | static char *Erlang_suffixes [] = | 616 | static char *Erlang_suffixes [] = |
| 571 | { "erl", "hrl", NULL }; | 617 | { "erl", "hrl", NULL }; |
| 618 | static char Erlang_help [] = | ||
| 619 | "In Erlang code, the tags are the functions, records and macros\n\ | ||
| 620 | defined in the file."; | ||
| 572 | 621 | ||
| 573 | static char *Fortran_suffixes [] = | 622 | static char *Fortran_suffixes [] = |
| 574 | { "F", "f", "f90", "for", NULL }; | 623 | { "F", "f", "f90", "for", NULL }; |
| 624 | static char Fortran_help [] = | ||
| 625 | "In Fortran code, functions, subroutines and block data are tags."; | ||
| 575 | 626 | ||
| 576 | static char *HTML_suffixes [] = | 627 | static char *HTML_suffixes [] = |
| 577 | { "htm", "html", "shtml", NULL }; | 628 | { "htm", "html", "shtml", NULL }; |
| 629 | static char HTML_help [] = | ||
| 630 | "In HTML input files, the tags are the `title' and the `h1', `h2',\n\ | ||
| 631 | `h3' headers. Also, tags are `name=' in anchors and all\n\ | ||
| 632 | occurrences of `id='."; | ||
| 578 | 633 | ||
| 579 | static char *Lisp_suffixes [] = | 634 | static char *Lisp_suffixes [] = |
| 580 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; | 635 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; |
| 636 | static char Lisp_help [] = | ||
| 637 | "In Lisp code, any function defined with `defun', any variable\n\ | ||
| 638 | defined with `defvar' or `defconst', and in general the first\n\ | ||
| 639 | argument of any expression that starts with `(def' in column zero\n\ | ||
| 640 | is a tag."; | ||
| 581 | 641 | ||
| 582 | static char *Makefile_filenames [] = | 642 | static char *Makefile_filenames [] = |
| 583 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; | 643 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; |
| 644 | static char Makefile_help [] = | ||
| 645 | "In makefiles, targets are tags; additionally, variables are tags\n\ | ||
| 646 | unless you specify `--no-globals'."; | ||
| 647 | |||
| 648 | static char *Objc_suffixes [] = | ||
| 649 | { "lm", /* Objective lex file */ | ||
| 650 | "m", /* Objective C file */ | ||
| 651 | NULL }; | ||
| 652 | static char Objc_help [] = | ||
| 653 | "In Objective C code, tags include Objective C definitions for classes,\n\ | ||
| 654 | class categories, methods and protocols. Tags for variables and\n\ | ||
| 655 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'."; | ||
| 584 | 656 | ||
| 585 | static char *Pascal_suffixes [] = | 657 | static char *Pascal_suffixes [] = |
| 586 | { "p", "pas", NULL }; | 658 | { "p", "pas", NULL }; |
| 659 | static char Pascal_help [] = | ||
| 660 | "In Pascal code, the tags are the functions and procedures defined\n\ | ||
| 661 | in the file."; | ||
| 587 | 662 | ||
| 588 | static char *Perl_suffixes [] = | 663 | static char *Perl_suffixes [] = |
| 589 | { "pl", "pm", NULL }; | 664 | { "pl", "pm", NULL }; |
| 590 | |||
| 591 | static char *Perl_interpreters [] = | 665 | static char *Perl_interpreters [] = |
| 592 | { "perl", "@PERL@", NULL }; | 666 | { "perl", "@PERL@", NULL }; |
| 667 | static char Perl_help [] = | ||
| 668 | "In Perl code, the tags are the packages, subroutines and variables\n\ | ||
| 669 | defined by the `package', `sub', `my' and `local' keywords. Use\n\ | ||
| 670 | `--globals' if you want to tag global variables. Tags for\n\ | ||
| 671 | subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ | ||
| 672 | defined in the default package is `main::SUB'."; | ||
| 593 | 673 | ||
| 594 | static char *PHP_suffixes [] = | 674 | static char *PHP_suffixes [] = |
| 595 | { "php", "php3", "php4", NULL }; | 675 | { "php", "php3", "php4", NULL }; |
| 676 | static char PHP_help [] = | ||
| 677 | "In PHP code, tags are functions, classes and defines. When using\n\ | ||
| 678 | the `--members' option, vars are tags too."; | ||
| 596 | 679 | ||
| 597 | static char *plain_C_suffixes [] = | 680 | static char *plain_C_suffixes [] = |
| 598 | { "lm", /* Objective lex file */ | 681 | { "pc", /* Pro*C file */ |
| 599 | "m", /* Objective C file */ | ||
| 600 | "pc", /* Pro*C file */ | ||
| 601 | NULL }; | 682 | NULL }; |
| 602 | 683 | ||
| 603 | static char *Postscript_suffixes [] = | 684 | static char *PS_suffixes [] = |
| 604 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ | 685 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ |
| 686 | static char PS_help [] = | ||
| 687 | "In PostScript code, the tags are the functions."; | ||
| 605 | 688 | ||
| 606 | static char *Prolog_suffixes [] = | 689 | static char *Prolog_suffixes [] = |
| 607 | { "prolog", NULL }; | 690 | { "prolog", NULL }; |
| 691 | static char Prolog_help [] = | ||
| 692 | "In Prolog code, tags are predicates and rules at the beginning of\n\ | ||
| 693 | line."; | ||
| 608 | 694 | ||
| 609 | static char *Python_suffixes [] = | 695 | static char *Python_suffixes [] = |
| 610 | { "py", NULL }; | 696 | { "py", NULL }; |
| 697 | static char Python_help [] = | ||
| 698 | "In Python code, `def' or `class' at the beginning of a line\n\ | ||
| 699 | generate a tag."; | ||
| 611 | 700 | ||
| 612 | /* Can't do the `SCM' or `scm' prefix with a version number. */ | 701 | /* Can't do the `SCM' or `scm' prefix with a version number. */ |
| 613 | static char *Scheme_suffixes [] = | 702 | static char *Scheme_suffixes [] = |
| 614 | { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; | 703 | { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; |
| 704 | static char Scheme_help [] = | ||
| 705 | "In Scheme code, tags include anything defined with `def' or with a\n\ | ||
| 706 | construct whose name starts with `def'. They also include\n\ | ||
| 707 | variables set with `set!' at top level in the file."; | ||
| 615 | 708 | ||
| 616 | static char *TeX_suffixes [] = | 709 | static char *TeX_suffixes [] = |
| 617 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; | 710 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; |
| 711 | static char TeX_help [] = | ||
| 712 | "In LaTeX text, the argument of any of the commands `\\chapter',\n\ | ||
| 713 | `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\ | ||
| 714 | `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\ | ||
| 715 | `\\index', `\\def', `\\newcommand', `\\renewcommand',\n\ | ||
| 716 | `\\newenvironment' or `\\renewenvironment' is a tag.\n\ | ||
| 717 | \n\ | ||
| 718 | Other commands can be specified by setting the environment variable\n\ | ||
| 719 | `TEXTAGS' to a colon-separated list like, for example,\n\ | ||
| 720 | TEXTAGS=\"mycommand:myothercommand\"."; | ||
| 721 | |||
| 618 | 722 | ||
| 619 | static char *Texinfo_suffixes [] = | 723 | static char *Texinfo_suffixes [] = |
| 620 | { "texi", "texinfo", "txi", NULL }; | 724 | { "texi", "texinfo", "txi", NULL }; |
| 725 | static char Texinfo_help [] = | ||
| 726 | "for texinfo files, lines starting with @node are tagged."; | ||
| 621 | 727 | ||
| 622 | static char *Yacc_suffixes [] = | 728 | static char *Yacc_suffixes [] = |
| 623 | { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ | 729 | { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ |
| 730 | static char Yacc_help [] = | ||
| 731 | "In Bison or Yacc input files, each rule defines as a tag the\n\ | ||
| 732 | nonterminal it constructs. The portions of the file that contain\n\ | ||
| 733 | C code are parsed as C code (use --help --lang=c --lang=yacc\n\ | ||
| 734 | for full help)."; | ||
| 735 | |||
| 736 | static char auto_help [] = | ||
| 737 | "`auto' is not a real language, it indicates to use\n\ | ||
| 738 | a default language for files base on file name suffix and file contents."; | ||
| 739 | |||
| 740 | static char none_help [] = | ||
| 741 | "`none' is not a real language, it indicates to only do\n\ | ||
| 742 | regexp processing on files."; | ||
| 743 | |||
| 744 | static char no_lang_help [] = | ||
| 745 | "No detailed help available for this language."; | ||
| 746 | |||
| 624 | 747 | ||
| 625 | /* | 748 | /* |
| 626 | * Table of languages. | 749 | * Table of languages. |
| @@ -631,32 +754,33 @@ static char *Yacc_suffixes [] = | |||
| 631 | 754 | ||
| 632 | static language lang_names [] = | 755 | static language lang_names [] = |
| 633 | { | 756 | { |
| 634 | { "ada", FALSE, Ada_funcs, NULL, Ada_suffixes, NULL }, | 757 | { "ada", Ada_help, Ada_funcs, Ada_suffixes }, |
| 635 | { "asm", FALSE, Asm_labels, NULL, Asm_suffixes, NULL }, | 758 | { "asm", Asm_help, Asm_labels, Asm_suffixes }, |
| 636 | { "c", FALSE, default_C_entries, NULL, default_C_suffixes, NULL }, | 759 | { "c", default_C_help, default_C_entries, default_C_suffixes }, |
| 637 | { "c++", FALSE, Cplusplus_entries, NULL, Cplusplus_suffixes, NULL }, | 760 | { "c++", Cplusplus_help, Cplusplus_entries, Cplusplus_suffixes }, |
| 638 | { "c*", FALSE, Cstar_entries, NULL, Cstar_suffixes, NULL }, | 761 | { "c*", no_lang_help, Cstar_entries, Cstar_suffixes }, |
| 639 | { "cobol", FALSE, Cobol_paragraphs, NULL, Cobol_suffixes, NULL }, | 762 | { "cobol", Cobol_help, Cobol_paragraphs, Cobol_suffixes }, |
| 640 | { "erlang", FALSE, Erlang_functions, NULL, Erlang_suffixes, NULL }, | 763 | { "erlang", Erlang_help, Erlang_functions, Erlang_suffixes }, |
| 641 | { "fortran", FALSE, Fortran_functions, NULL, Fortran_suffixes, NULL }, | 764 | { "fortran", Fortran_help, Fortran_functions, Fortran_suffixes }, |
| 642 | { "html", FALSE, HTML_labels, NULL, HTML_suffixes, NULL }, | 765 | { "html", HTML_help, HTML_labels, HTML_suffixes }, |
| 643 | { "java", FALSE, Cjava_entries, NULL, Cjava_suffixes, NULL }, | 766 | { "java", Cjava_help, Cjava_entries, Cjava_suffixes }, |
| 644 | { "lisp", FALSE, Lisp_functions, NULL, Lisp_suffixes, NULL }, | 767 | { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes }, |
| 645 | { "makefile", FALSE, Makefile_targets, Makefile_filenames, NULL, NULL }, | 768 | { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames}, |
| 646 | { "pascal", FALSE, Pascal_functions, NULL, Pascal_suffixes, NULL }, | 769 | { "objc", Objc_help, plain_C_entries, Objc_suffixes }, |
| 647 | { "perl", FALSE, Perl_functions,NULL, Perl_suffixes, Perl_interpreters }, | 770 | { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes }, |
| 648 | { "php", FALSE, PHP_functions, NULL, PHP_suffixes, NULL }, | 771 | { "perl",Perl_help,Perl_functions,Perl_suffixes,NULL,Perl_interpreters}, |
| 649 | { "postscript",FALSE, Postscript_functions,NULL, Postscript_suffixes, NULL }, | 772 | { "php", PHP_help, PHP_functions, PHP_suffixes }, |
| 650 | { "proc", FALSE, plain_C_entries, NULL, plain_C_suffixes, NULL }, | 773 | { "postscript",PS_help, PS_functions, PS_suffixes }, |
| 651 | { "prolog", FALSE, Prolog_functions, NULL, Prolog_suffixes, NULL }, | 774 | { "proc", no_lang_help, plain_C_entries, plain_C_suffixes }, |
| 652 | { "python", FALSE, Python_functions, NULL, Python_suffixes, NULL }, | 775 | { "prolog", Prolog_help, Prolog_functions, Prolog_suffixes }, |
| 653 | { "scheme", FALSE, Scheme_functions, NULL, Scheme_suffixes, NULL }, | 776 | { "python", Python_help, Python_functions, Python_suffixes }, |
| 654 | { "tex", FALSE, TeX_commands, NULL, TeX_suffixes, NULL }, | 777 | { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, |
| 655 | { "texinfo", FALSE, Texinfo_nodes, NULL, Texinfo_suffixes, NULL }, | 778 | { "tex", TeX_help, TeX_commands, TeX_suffixes }, |
| 656 | { "yacc", TRUE, Yacc_entries, NULL, Yacc_suffixes, NULL }, | 779 | { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, |
| 657 | { "auto", FALSE, NULL }, /* default guessing scheme */ | 780 | { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,TRUE}, |
| 658 | { "none", FALSE, just_read_file }, /* regexp matching only */ | 781 | { "auto", auto_help }, /* default guessing scheme */ |
| 659 | { NULL, FALSE, NULL } /* end of list */ | 782 | { "none", none_help, just_read_file }, /* regexp matching only */ |
| 783 | { NULL } /* end of list */ | ||
| 660 | }; | 784 | }; |
| 661 | 785 | ||
| 662 | 786 | ||
| @@ -679,14 +803,18 @@ default file names and dot suffixes:"); | |||
| 679 | printf (" .%s", *ext); | 803 | printf (" .%s", *ext); |
| 680 | puts (""); | 804 | puts (""); |
| 681 | } | 805 | } |
| 682 | puts ("Where `auto' means use default language for files based on file\n\ | 806 | puts ("where `auto' means use default language for files based on file\n\ |
| 683 | name suffix, and `none' means only do regexp processing on files.\n\ | 807 | name suffix, and `none' means only do regexp processing on files.\n\ |
| 684 | If no language is specified and no matching suffix is found,\n\ | 808 | If no language is specified and no matching suffix is found,\n\ |
| 685 | the first line of the file is read for a sharp-bang (#!) sequence\n\ | 809 | the first line of the file is read for a sharp-bang (#!) sequence\n\ |
| 686 | followed by the name of an interpreter. If no such sequence is found,\n\ | 810 | followed by the name of an interpreter. If no such sequence is found,\n\ |
| 687 | Fortran is tried first; if no tags are found, C is tried next.\n\ | 811 | Fortran is tried first; if no tags are found, C is tried next.\n\ |
| 688 | When parsing any C file, a \"class\" keyword switches to C++.\n\ | 812 | When parsing any C file, a \"class\" or \"template\" keyword\n\ |
| 689 | Compressed files are supported using gzip and bzip2."); | 813 | switches to C++."); |
| 814 | puts ("Compressed files are supported using gzip and bzip2.\n\ | ||
| 815 | \n\ | ||
| 816 | For detailed help on a given language use, for example,\n\ | ||
| 817 | etags --help --lang=ada."); | ||
| 690 | } | 818 | } |
| 691 | 819 | ||
| 692 | #ifndef EMACS_NAME | 820 | #ifndef EMACS_NAME |
| @@ -706,8 +834,23 @@ print_version () | |||
| 706 | } | 834 | } |
| 707 | 835 | ||
| 708 | static void | 836 | static void |
| 709 | print_help () | 837 | print_help (argbuffer) |
| 838 | argument *argbuffer; | ||
| 710 | { | 839 | { |
| 840 | bool help_for_lang = FALSE; | ||
| 841 | |||
| 842 | for (; argbuffer->arg_type != at_end; argbuffer++) | ||
| 843 | if (argbuffer->arg_type == at_language) | ||
| 844 | { | ||
| 845 | if (help_for_lang) | ||
| 846 | puts (""); | ||
| 847 | puts (argbuffer->lang->help); | ||
| 848 | help_for_lang = TRUE; | ||
| 849 | } | ||
| 850 | |||
| 851 | if (help_for_lang) | ||
| 852 | exit (GOOD); | ||
| 853 | |||
| 711 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ | 854 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ |
| 712 | \n\ | 855 | \n\ |
| 713 | These are the options accepted by %s.\n", progname, progname); | 856 | These are the options accepted by %s.\n", progname, progname); |
| @@ -736,7 +879,7 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 736 | /* This option is mostly obsolete, because etags can now automatically | 879 | /* This option is mostly obsolete, because etags can now automatically |
| 737 | detect C++. Retained for backward compatibility and for debugging and | 880 | detect C++. Retained for backward compatibility and for debugging and |
| 738 | experimentation. In principle, we could want to tag as C++ even | 881 | experimentation. In principle, we could want to tag as C++ even |
| 739 | before any "class" keyword. | 882 | before any "class" or "template" keyword. |
| 740 | puts ("-C, --c++\n\ | 883 | puts ("-C, --c++\n\ |
| 741 | Treat files whose name suffix defaults to C language as C++ files."); | 884 | Treat files whose name suffix defaults to C language as C++ files."); |
| 742 | */ | 885 | */ |
| @@ -775,7 +918,7 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 775 | Do not create tag entries for global variables in some\n\ | 918 | Do not create tag entries for global variables in some\n\ |
| 776 | languages. This makes the tags file smaller."); | 919 | languages. This makes the tags file smaller."); |
| 777 | puts ("--members\n\ | 920 | puts ("--members\n\ |
| 778 | Create tag entries for member variables in some languages."); | 921 | Create tag entries for members of structures in some languages."); |
| 779 | 922 | ||
| 780 | #ifdef ETAGS_REGEXPS | 923 | #ifdef ETAGS_REGEXPS |
| 781 | puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ | 924 | puts ("-r REGEXP, --regex=REGEXP or --regex=@regexfile\n\ |
| @@ -838,7 +981,9 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 838 | puts ("-V, --version\n\ | 981 | puts ("-V, --version\n\ |
| 839 | Print the version of the program.\n\ | 982 | Print the version of the program.\n\ |
| 840 | -h, --help\n\ | 983 | -h, --help\n\ |
| 841 | Print this help message."); | 984 | Print this help message.\n\ |
| 985 | Followed by one or more `--language' options prints detailed\n\ | ||
| 986 | help about tag generation for the specified languages."); | ||
| 842 | 987 | ||
| 843 | print_language_names (); | 988 | print_language_names (); |
| 844 | 989 | ||
| @@ -985,6 +1130,7 @@ main (argc, argv) | |||
| 985 | argument *argbuffer; | 1130 | argument *argbuffer; |
| 986 | int current_arg, file_count; | 1131 | int current_arg, file_count; |
| 987 | linebuffer filename_lb; | 1132 | linebuffer filename_lb; |
| 1133 | bool help_asked = FALSE; | ||
| 988 | #ifdef VMS | 1134 | #ifdef VMS |
| 989 | bool got_err; | 1135 | bool got_err; |
| 990 | #endif | 1136 | #endif |
| @@ -1063,6 +1209,7 @@ main (argc, argv) | |||
| 1063 | { | 1209 | { |
| 1064 | error ("-o option may only be given once.", (char *)NULL); | 1210 | error ("-o option may only be given once.", (char *)NULL); |
| 1065 | suggest_asking_for_help (); | 1211 | suggest_asking_for_help (); |
| 1212 | /* NOTREACHED */ | ||
| 1066 | } | 1213 | } |
| 1067 | tagfile = optarg; | 1214 | tagfile = optarg; |
| 1068 | break; | 1215 | break; |
| @@ -1100,7 +1247,7 @@ main (argc, argv) | |||
| 1100 | break; | 1247 | break; |
| 1101 | case 'h': | 1248 | case 'h': |
| 1102 | case 'H': | 1249 | case 'H': |
| 1103 | print_help (); | 1250 | help_asked = TRUE; |
| 1104 | break; | 1251 | break; |
| 1105 | 1252 | ||
| 1106 | /* Etags options */ | 1253 | /* Etags options */ |
| @@ -1119,9 +1266,10 @@ main (argc, argv) | |||
| 1119 | case 'w': no_warnings = TRUE; break; | 1266 | case 'w': no_warnings = TRUE; break; |
| 1120 | default: | 1267 | default: |
| 1121 | suggest_asking_for_help (); | 1268 | suggest_asking_for_help (); |
| 1269 | /* NOTREACHED */ | ||
| 1122 | } | 1270 | } |
| 1123 | 1271 | ||
| 1124 | for (; optind < argc; ++optind) | 1272 | for (; optind < argc; optind++) |
| 1125 | { | 1273 | { |
| 1126 | argbuffer[current_arg].arg_type = at_filename; | 1274 | argbuffer[current_arg].arg_type = at_filename; |
| 1127 | argbuffer[current_arg].what = argv[optind]; | 1275 | argbuffer[current_arg].what = argv[optind]; |
| @@ -1129,10 +1277,17 @@ main (argc, argv) | |||
| 1129 | ++file_count; | 1277 | ++file_count; |
| 1130 | } | 1278 | } |
| 1131 | 1279 | ||
| 1280 | argbuffer[current_arg].arg_type = at_end; | ||
| 1281 | |||
| 1282 | if (help_asked) | ||
| 1283 | print_help (argbuffer); | ||
| 1284 | /* NOTREACHED */ | ||
| 1285 | |||
| 1132 | if (nincluded_files == 0 && file_count == 0) | 1286 | if (nincluded_files == 0 && file_count == 0) |
| 1133 | { | 1287 | { |
| 1134 | error ("no input files specified.", (char *)NULL); | 1288 | error ("no input files specified.", (char *)NULL); |
| 1135 | suggest_asking_for_help (); | 1289 | suggest_asking_for_help (); |
| 1290 | /* NOTREACHED */ | ||
| 1136 | } | 1291 | } |
| 1137 | 1292 | ||
| 1138 | if (tagfile == NULL) | 1293 | if (tagfile == NULL) |
| @@ -1177,7 +1332,7 @@ main (argc, argv) | |||
| 1177 | /* | 1332 | /* |
| 1178 | * Loop through files finding functions. | 1333 | * Loop through files finding functions. |
| 1179 | */ | 1334 | */ |
| 1180 | for (i = 0; i < current_arg; ++i) | 1335 | for (i = 0; i < current_arg; i++) |
| 1181 | { | 1336 | { |
| 1182 | static language *lang; /* non-NULL if language is forced */ | 1337 | static language *lang; /* non-NULL if language is forced */ |
| 1183 | char *this_file; | 1338 | char *this_file; |
| @@ -4751,7 +4906,7 @@ Lisp_functions (inf) | |||
| 4751 | * Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) | 4906 | * Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) |
| 4752 | */ | 4907 | */ |
| 4753 | static void | 4908 | static void |
| 4754 | Postscript_functions (inf) | 4909 | PS_functions (inf) |
| 4755 | FILE *inf; | 4910 | FILE *inf; |
| 4756 | { | 4911 | { |
| 4757 | register char *bp, *ep; | 4912 | register char *bp, *ep; |