From: rshouman@chpc.utexas.edu (Radey Shouman)
Subject: Re: [Q] How do I get EMACS to generate TAGS for fortran code ENTRY points?
Keywords: TAGS, EMACS
Organization: The University of Texas System - CHPC
Date: Wed, 16 Dec 92 21:24:41 GMT

In article <1992Dec16.164332.21910@jet.uk> tp@jet.uk (Tarang K Patel) writes:
>
>  I know that GNUemacs picks up functions and subroutines in fortran code as
>  tags, but how does one get ENTRY point names tagged as well?
>
>  
>  Tarang

I've modified etags.c, from GNU emacs 18.58, to find tags for fortran
"entry" and "common" statements.  A context diff giving the
necessary modifications follows.


Enjoy,

--Radey Shouman

-----------------cut-here-------------------------cut-here--------
*** etags.c	Wed Sep  2 15:02:54 1992
--- dist/etags.c	Wed Dec 16 14:36:44 1992
***************
*** 1,6 ****
- /* Modified 2 September, 1990 to recognize fortran "entry" statement and
-    "common" statement --ars */
- 
  /* Tags file maker to go with GNUmacs
     Copyright (C) 1984, 1987, 1988 Free Software Foundation, Inc. and Ken Arnold
  
--- 1,3 ----
***************
*** 93,98 ****
--- 90,97 ----
  
  TYST tydef = none;
  
+ logical next_token_is_func;
+ 
  char	searchar = '/';			/* use /.../ searches 		*/
  
  int	lineno;			/* line number of current line */
***************
*** 186,202 ****
  #ifdef ETAGS
    eflag = 1;
  #else
- #ifdef CTAGS
    eflag = 0;
- #else
-   {
-     char *subname = rindex (progname, '/');
-     if (subname++ == NULL)
-       subname = progname;
-     eflag = ! strcmp(subname, "ctags");
-   }
  #endif
- #endif
  
    while (ac > 1 && av[1][0] == '-')
      {
--- 185,192 ----
***************
*** 744,749 ****
--- 734,741 ----
    number = 0;
    gotone = midtoken = inquote = inchar = incomm = FALSE;
    level = 0;
+   tydef = none;
+   next_token_is_func = 0;
  
    while (!feof (inf))
      {
***************
*** 893,899 ****
  {
    reg char *lp = *lpp;
    reg char c;
-   static logical next_token_is_func;
    logical firsttok;	/* T if have seen first token in ()'s */
    int bad, win;
  
--- 885,890 ----
***************
*** 1077,1090 ****
  	continue;
        switch (*dbp|' ')
  	{
- 	case 'c':
- 	  if (tail("common"))
- 	    getit();
- 	  continue;
- 	case 'e':
- 	  if (tail("entry"))
- 	    getit();
- 	  continue;
  	case 'f':
  	  if (tail("function"))
  	    getit();
--- 1068,1073 ----
***************
*** 1147,1153 ****
    char c;
    char nambuf[BUFSIZ];
  
!   while (isspace(*dbp) || *dbp == '/')
      dbp++;
    if (*dbp == 0 || !isalpha(*dbp))
      return;
--- 1130,1136 ----
    char c;
    char nambuf[BUFSIZ];
  
!   while (isspace(*dbp))
      dbp++;
    if (*dbp == 0 || !isalpha(*dbp))
      return;
***************
*** 1359,1364 ****
--- 1342,1348 ----
  
  #define TEX_LESC '\\'
  #define TEX_SESC '!'
+ #define TEX_CMT  '%'
  
  /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping */
  /* chars accordingly. */
***************
*** 1366,1376 ****
  TEX_mode (f)
       FILE *f;
  {
!   int c;
  
    while ((c = getc (f)) != EOF)
!     if (c == TEX_LESC || c == TEX_SESC)
!       break;
  
    if (c == TEX_LESC)
      {
--- 1350,1368 ----
  TEX_mode (f)
       FILE *f;
  {
!   int c, skip_line = 0;
  
    while ((c = getc (f)) != EOF)
!     {
!       /* Skip to next line if we hit the TeX comment char. */
!       if (c == TEX_CMT)
! 	skip_line = 1;
!       else if (c == '\n')
! 	skip_line = 0;
!       else if (! skip_line)
! 	if (c == TEX_LESC || c == TEX_SESC)
! 	  break;
!     }
  
    if (c == TEX_LESC)
      {
-- 
Radey Shouman					rshouman@chpc.utexas.edu
Newsgroups: comp.emacs