xref: /original-bsd/usr.bin/ctags/lisp.c (revision 72b8f354)
1 /*
2  * Copyright (c) 1987 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)lisp.c	5.4 (Berkeley) 06/01/90";
10 #endif /* not lint */
11 
12 #include <ctags.h>
13 #include <string.h>
14 
15 extern char	*lbp;			/* pointer shared with fortran */
16 
17 /*
18  * lisp tag functions
19  * just look for (def or (DEF
20  */
21 l_entries()
22 {
23 	register int	special;
24 	register char	*cp,
25 			savedc;
26 	char	tok[MAXTOKEN];
27 
28 	for (;;) {
29 		lineftell = ftell(inf);
30 		if (!fgets(lbuf,sizeof(lbuf),inf))
31 			return;
32 		++lineno;
33 		lbp = lbuf;
34 		if (!cicmp("(def"))
35 			continue;
36 		special = NO;
37 		switch(*lbp | ' ') {
38 		case 'm':
39 			if (cicmp("method"))
40 				special = YES;
41 			break;
42 		case 'w':
43 			if (cicmp("wrapper") || cicmp("whopper"))
44 				special = YES;
45 		}
46 		for (;!isspace(*lbp);++lbp);
47 		for (;isspace(*lbp);++lbp);
48 		for (cp = lbp;*cp && *cp != '\n';++cp);
49 		*cp = EOS;
50 		if (special) {
51 			if (!(cp = index(lbp,')')))
52 				continue;
53 			for (;cp >= lbp && *cp != ':';--cp);
54 			if (cp < lbp)
55 				continue;
56 			lbp = cp;
57 			for (;*cp && *cp != ')' && *cp != ' ';++cp);
58 		}
59 		else
60 			for (cp = lbp + 1;
61 			    *cp && *cp != '(' && *cp != ' ';++cp);
62 		savedc = *cp;
63 		*cp = EOS;
64 		(void)strcpy(tok,lbp);
65 		*cp = savedc;
66 		getline();
67 		pfnote(tok,lineno);
68 	}
69 	/*NOTREACHED*/
70 }
71