string.h is ANSI C include file
[unix-history] / usr / src / usr.bin / ctags / lisp.c
CommitLineData
86e31eca 1/*
ffa8a268
KB
2 * Copyright (c) 1987 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
86e31eca
KB
16 */
17
18#ifndef lint
ffa8a268
KB
19static char sccsid[] = "@(#)lisp.c 5.2 (Berkeley) %G%";
20#endif /* not lint */
86e31eca
KB
21
22#include <ctags.h>
23#include <strings.h>
24
25extern char *lbp; /* pointer shared with fortran */
26
27/*
28 * lisp tag functions
29 * just look for (def or (DEF
30 */
31l_entries()
32{
33 register int special;
34 register char *cp,
35 savedc;
36 char tok[MAXTOKEN];
37
38 for (;;) {
39 lineftell = ftell(inf);
40 if (!fgets(lbuf,sizeof(lbuf),inf))
41 return;
42 ++lineno;
43 lbp = lbuf;
44 if (!cicmp("(def"))
45 continue;
46 special = NO;
47 switch(*lbp | ' ') {
48 case 'm':
49 if (cicmp("method"))
50 special = YES;
51 break;
52 case 'w':
53 if (cicmp("wrapper") || cicmp("whopper"))
54 special = YES;
55 }
56 for (;!isspace(*lbp);++lbp);
57 for (;isspace(*lbp);++lbp);
58 for (cp = lbp;*cp && *cp != '\n';++cp);
59 *cp = EOS;
60 if (special) {
61 if (!(cp = index(lbp,')')))
62 continue;
63 for (;cp >= lbp && *cp != ':';--cp);
64 if (cp < lbp)
65 continue;
66 lbp = cp;
67 for (;*cp && *cp != ')' && *cp != ' ';++cp);
68 }
69 else
70 for (cp = lbp + 1;
71 *cp && *cp != '(' && *cp != ' ';++cp);
72 savedc = *cp;
73 *cp = EOS;
74 (void)strcpy(tok,lbp);
75 *cp = savedc;
76 getline();
77 pfnote(tok,lineno);
78 }
79 /*NOTREACHED*/
80}