home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / emacs / 3800 < prev    next >
Encoding:
Text File  |  1992-12-16  |  3.7 KB  |  172 lines

  1. Newsgroups: comp.emacs
  2. Path: sparky!uunet!spool.mu.edu!sdd.hp.com!swrinde!cs.utexas.edu!hermes.chpc.utexas.edu!rshouman
  3. From: rshouman@chpc.utexas.edu (Radey Shouman)
  4. Subject: Re: [Q] How do I get EMACS to generate TAGS for fortran code ENTRY points?
  5. Message-ID: <1992Dec16.212441.26891@chpc.utexas.edu>
  6. Keywords: TAGS, EMACS
  7. Organization: The University of Texas System - CHPC
  8. References: <1992Dec16.164332.21910@jet.uk>
  9. Date: Wed, 16 Dec 92 21:24:41 GMT
  10. Lines: 160
  11.  
  12. In article <1992Dec16.164332.21910@jet.uk> tp@jet.uk (Tarang K Patel) writes:
  13. >
  14. >  I know that GNUemacs picks up functions and subroutines in fortran code as
  15. >  tags, but how does one get ENTRY point names tagged as well?
  16. >
  17. >  
  18. >  Tarang
  19.  
  20. I've modified etags.c, from GNU emacs 18.58, to find tags for fortran
  21. "entry" and "common" statements.  A context diff giving the
  22. necessary modifications follows.
  23.  
  24.  
  25. Enjoy,
  26.  
  27. --Radey Shouman
  28.  
  29. -----------------cut-here-------------------------cut-here--------
  30. *** etags.c    Wed Sep  2 15:02:54 1992
  31. --- dist/etags.c    Wed Dec 16 14:36:44 1992
  32. ***************
  33. *** 1,6 ****
  34. - /* Modified 2 September, 1990 to recognize fortran "entry" statement and
  35. -    "common" statement --ars */
  36.   /* Tags file maker to go with GNUmacs
  37.      Copyright (C) 1984, 1987, 1988 Free Software Foundation, Inc. and Ken Arnold
  38.   
  39. --- 1,3 ----
  40. ***************
  41. *** 93,98 ****
  42. --- 90,97 ----
  43.   
  44.   TYST tydef = none;
  45.   
  46. + logical next_token_is_func;
  47.   char    searchar = '/';            /* use /.../ searches         */
  48.   
  49.   int    lineno;            /* line number of current line */
  50. ***************
  51. *** 186,202 ****
  52.   #ifdef ETAGS
  53.     eflag = 1;
  54.   #else
  55. - #ifdef CTAGS
  56.     eflag = 0;
  57. - #else
  58. -   {
  59. -     char *subname = rindex (progname, '/');
  60. -     if (subname++ == NULL)
  61. -       subname = progname;
  62. -     eflag = ! strcmp(subname, "ctags");
  63. -   }
  64.   #endif
  65. - #endif
  66.   
  67.     while (ac > 1 && av[1][0] == '-')
  68.       {
  69. --- 185,192 ----
  70. ***************
  71. *** 744,749 ****
  72. --- 734,741 ----
  73.     number = 0;
  74.     gotone = midtoken = inquote = inchar = incomm = FALSE;
  75.     level = 0;
  76. +   tydef = none;
  77. +   next_token_is_func = 0;
  78.   
  79.     while (!feof (inf))
  80.       {
  81. ***************
  82. *** 893,899 ****
  83.   {
  84.     reg char *lp = *lpp;
  85.     reg char c;
  86. -   static logical next_token_is_func;
  87.     logical firsttok;    /* T if have seen first token in ()'s */
  88.     int bad, win;
  89.   
  90. --- 885,890 ----
  91. ***************
  92. *** 1077,1090 ****
  93.       continue;
  94.         switch (*dbp|' ')
  95.       {
  96. -     case 'c':
  97. -       if (tail("common"))
  98. -         getit();
  99. -       continue;
  100. -     case 'e':
  101. -       if (tail("entry"))
  102. -         getit();
  103. -       continue;
  104.       case 'f':
  105.         if (tail("function"))
  106.           getit();
  107. --- 1068,1073 ----
  108. ***************
  109. *** 1147,1153 ****
  110.     char c;
  111.     char nambuf[BUFSIZ];
  112.   
  113. !   while (isspace(*dbp) || *dbp == '/')
  114.       dbp++;
  115.     if (*dbp == 0 || !isalpha(*dbp))
  116.       return;
  117. --- 1130,1136 ----
  118.     char c;
  119.     char nambuf[BUFSIZ];
  120.   
  121. !   while (isspace(*dbp))
  122.       dbp++;
  123.     if (*dbp == 0 || !isalpha(*dbp))
  124.       return;
  125. ***************
  126. *** 1359,1364 ****
  127. --- 1342,1348 ----
  128.   
  129.   #define TEX_LESC '\\'
  130.   #define TEX_SESC '!'
  131. + #define TEX_CMT  '%'
  132.   
  133.   /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping */
  134.   /* chars accordingly. */
  135. ***************
  136. *** 1366,1376 ****
  137.   TEX_mode (f)
  138.        FILE *f;
  139.   {
  140. !   int c;
  141.   
  142.     while ((c = getc (f)) != EOF)
  143. !     if (c == TEX_LESC || c == TEX_SESC)
  144. !       break;
  145.   
  146.     if (c == TEX_LESC)
  147.       {
  148. --- 1350,1368 ----
  149.   TEX_mode (f)
  150.        FILE *f;
  151.   {
  152. !   int c, skip_line = 0;
  153.   
  154.     while ((c = getc (f)) != EOF)
  155. !     {
  156. !       /* Skip to next line if we hit the TeX comment char. */
  157. !       if (c == TEX_CMT)
  158. !     skip_line = 1;
  159. !       else if (c == '\n')
  160. !     skip_line = 0;
  161. !       else if (! skip_line)
  162. !     if (c == TEX_LESC || c == TEX_SESC)
  163. !       break;
  164. !     }
  165.   
  166.     if (c == TEX_LESC)
  167.       {
  168. -- 
  169. Radey Shouman                    rshouman@chpc.utexas.edu
  170.