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