[gnu.emacs] etags.c recognizes packages

moore%cdr.utah.edu@wasatch.utah.edu (Tim Moore) (07/29/89)

Here are some changes to etags.c so that it will recognize package
qualified defining forms i.e., lisp::defmacro, in Lisp files. I've
found this useful in our Utah Common Lisp project. Almost all special
forms and macros in UCL are defined using ucl::defmacro instead of defmacro
to avoid screwing up the cross compiler's definition of the macro or
to avoid using the cross compiler's defmacro.

The "-p" flag enables this new behavior. Diffs follow.

Tim Moore                     moore@cs.utah.edu {ut-sally,hplabs}!utah-cs!moore
"Ah, youth. Ah, statute of limitations."
		-John Waters

*** /n/jaguar/usr/src/gnu/emacs/dist/etc/etags.c	Thu Jun 23 06:45:37 1988
--- etags.c	Fri Jul 28 14:49:35 1989
***************
*** 188,193 ****
--- 188,195 ----
  int	vflag = 0;		/* -v: create vgrind style index output */
  int	xflag = 0;		/* -x: create cxref style output */
  int	eflag = 0;		/* -e: emacs style output */
+ int	pflag = 0;		/* -p: look for package qualified defs */
+ 				/* in lisp files */
  
  /* Name this program was invoked with.  */
  char *progname;
***************
*** 308,313 ****
--- 310,318 ----
  		}
  	      outfile = av[1];
  	      goto end_loop;
+ 	    case 'p':
+ 	      pflag++;
+ 	      break;
  	    case 't':
  	      tflag++;
  	      break;
***************
*** 1209,1215 ****
  
  /*
   * lisp tag functions
!  * just look for (def or (DEF
   */
  
  L_funcs (fi)
--- 1214,1220 ----
  
  /*
   * lisp tag functions
!  * look for (def or (DEF or (foo:def or (foo::def or ...
   */
  
  L_funcs (fi)
***************
*** 1225,1240 ****
        linecharno = charno;
        charno += readline (&lb, fi) + 1;
        dbp = lb.buffer;
!       if (dbp[0] == '(' && 
! 	  (dbp[1] == 'D' || dbp[1] == 'd') &&
! 	    (dbp[2] == 'E' || dbp[2] == 'e') &&
! 	      (dbp[3] == 'F' || dbp[3] == 'f'))
  	{
! 	  while (!isspace(*dbp)) dbp++;
! 	  while (isspace(*dbp)) dbp++;
! 	  L_getit();
  	}
      }
  }
  
  L_getit()
--- 1230,1267 ----
        linecharno = charno;
        charno += readline (&lb, fi) + 1;
        dbp = lb.buffer;
!       if (dbp[0] == '(')
  	{
! 	  if (L_isdef())
! 	    {
! 	      while (!isspace(*dbp)) dbp++;
! 	      while (isspace(*dbp)) dbp++;
! 	      L_getit();
! 	    }
! 	  else if (pflag)
! 	    {
! 	      while (*dbp != ':' && !isspace(*dbp)) dbp++;
! 	      if (*dbp == ':')
! 		{
! 		  if (dbp[1] == ':') dbp++; /* deal with "::" */
! 		  if (L_isdef())
! 		    {
! 		      while (!isspace(*dbp)) dbp++;
! 		      while (isspace(*dbp)) dbp++;
! 		      L_getit();
! 		    }    
! 		}
! 	    }
  	}
+       
      }
+ }
+ 
+ L_isdef()
+ {
+   return ((dbp[1] == 'D' || dbp[1] == 'd') &&
+ 	  (dbp[2] == 'E' || dbp[2] == 'e') && 
+ 	  (dbp[3] == 'F' || dbp[3] == 'f'));
  }
  
  L_getit()
Tim Moore                     moore@cs.utah.edu {ut-sally,hplabs}!utah-cs!moore
"Ah, youth. Ah, statute of limitations."
		-John Waters