xref: /original-bsd/usr.bin/ctags/lisp.c (revision 5735763c)
1a630c2e9Sbostic /*
2*5735763cSpendry  * Copyright (c) 1987, 1993, 1994
392e3de6bSbostic  *	The Regents of the University of California.  All rights reserved.
4810bd126Sbostic  *
508c0cd70Sbostic  * %sccs.include.redist.c%
6a630c2e9Sbostic  */
7a630c2e9Sbostic 
8a630c2e9Sbostic #ifndef lint
9*5735763cSpendry static char sccsid[] = "@(#)lisp.c	8.3 (Berkeley) 04/02/94";
10810bd126Sbostic #endif /* not lint */
11a630c2e9Sbostic 
12356bb532Spendry #include <ctype.h>
13356bb532Spendry #include <limits.h>
148d00f1f7Sbostic #include <stdio.h>
15454348daSbostic #include <string.h>
16a630c2e9Sbostic 
17356bb532Spendry #include "ctags.h"
18a630c2e9Sbostic 
19a630c2e9Sbostic /*
20a630c2e9Sbostic  * lisp tag functions
21a630c2e9Sbostic  * just look for (def or (DEF
22a630c2e9Sbostic  */
23356bb532Spendry void
l_entries()24a630c2e9Sbostic l_entries()
25a630c2e9Sbostic {
26356bb532Spendry 	int	special;
27356bb532Spendry 	char	*cp;
28356bb532Spendry 	char	savedc;
29a630c2e9Sbostic 	char	tok[MAXTOKEN];
30a630c2e9Sbostic 
31a630c2e9Sbostic 	for (;;) {
32a630c2e9Sbostic 		lineftell = ftell(inf);
33a630c2e9Sbostic 		if (!fgets(lbuf, sizeof(lbuf), inf))
34a630c2e9Sbostic 			return;
35a630c2e9Sbostic 		++lineno;
36a630c2e9Sbostic 		lbp = lbuf;
37a630c2e9Sbostic 		if (!cicmp("(def"))
38a630c2e9Sbostic 			continue;
39a630c2e9Sbostic 		special = NO;
40a630c2e9Sbostic 		switch(*lbp | ' ') {
41a630c2e9Sbostic 		case 'm':
42a630c2e9Sbostic 			if (cicmp("method"))
43a630c2e9Sbostic 				special = YES;
44a630c2e9Sbostic 			break;
45a630c2e9Sbostic 		case 'w':
46a630c2e9Sbostic 			if (cicmp("wrapper") || cicmp("whopper"))
47a630c2e9Sbostic 				special = YES;
48a630c2e9Sbostic 		}
49356bb532Spendry 		for (; !isspace(*lbp); ++lbp)
50356bb532Spendry 			continue;
51356bb532Spendry 		for (; isspace(*lbp); ++lbp)
52356bb532Spendry 			continue;
53356bb532Spendry 		for (cp = lbp; *cp && *cp != '\n'; ++cp)
54356bb532Spendry 			continue;
55a630c2e9Sbostic 		*cp = EOS;
56a630c2e9Sbostic 		if (special) {
57356bb532Spendry 			if (!(cp = strchr(lbp, ')')))
58a630c2e9Sbostic 				continue;
59356bb532Spendry 			for (; cp >= lbp && *cp != ':'; --cp)
60356bb532Spendry 				continue;
61a630c2e9Sbostic 			if (cp < lbp)
62a630c2e9Sbostic 				continue;
63a630c2e9Sbostic 			lbp = cp;
64356bb532Spendry 			for (; *cp && *cp != ')' && *cp != ' '; ++cp)
65356bb532Spendry 				continue;
66a630c2e9Sbostic 		}
67a630c2e9Sbostic 		else
68a630c2e9Sbostic 			for (cp = lbp + 1;
69356bb532Spendry 			    *cp && *cp != '(' && *cp != ' '; ++cp)
70356bb532Spendry 				continue;
71a630c2e9Sbostic 		savedc = *cp;
72a630c2e9Sbostic 		*cp = EOS;
73a630c2e9Sbostic 		(void)strcpy(tok, lbp);
74a630c2e9Sbostic 		*cp = savedc;
75a630c2e9Sbostic 		getline();
76a630c2e9Sbostic 		pfnote(tok, lineno);
77a630c2e9Sbostic 	}
78a630c2e9Sbostic 	/*NOTREACHED*/
79a630c2e9Sbostic }
80