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