11590Srgrimes/*
21590Srgrimes * Copyright (c) 1987, 1993, 1994
31590Srgrimes *	The Regents of the University of California.  All rights reserved.
41590Srgrimes *
51590Srgrimes * Redistribution and use in source and binary forms, with or without
61590Srgrimes * modification, are permitted provided that the following conditions
71590Srgrimes * are met:
81590Srgrimes * 1. Redistributions of source code must retain the above copyright
91590Srgrimes *    notice, this list of conditions and the following disclaimer.
101590Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111590Srgrimes *    notice, this list of conditions and the following disclaimer in the
121590Srgrimes *    documentation and/or other materials provided with the distribution.
131590Srgrimes * 4. Neither the name of the University nor the names of its contributors
141590Srgrimes *    may be used to endorse or promote products derived from this software
151590Srgrimes *    without specific prior written permission.
161590Srgrimes *
171590Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181590Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191590Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201590Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211590Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221590Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231590Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241590Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251590Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261590Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271590Srgrimes * SUCH DAMAGE.
281590Srgrimes */
291590Srgrimes
3087628Sdwmalone#if 0
3187628Sdwmalone#ifndef lint
3287628Sdwmalonestatic char sccsid[] = "@(#)lisp.c	8.3 (Berkeley) 4/2/94";
3387628Sdwmalone#endif
3487628Sdwmalone#endif
3587628Sdwmalone
3687249Smarkm#include <sys/cdefs.h>
3787249Smarkm__FBSDID("$FreeBSD$");
3887249Smarkm
391590Srgrimes#include <ctype.h>
401590Srgrimes#include <limits.h>
411590Srgrimes#include <stdio.h>
421590Srgrimes#include <string.h>
431590Srgrimes
441590Srgrimes#include "ctags.h"
451590Srgrimes
461590Srgrimes/*
471590Srgrimes * lisp tag functions
481590Srgrimes * just look for (def or (DEF
491590Srgrimes */
501590Srgrimesvoid
51100822Sdwmalonel_entries(void)
521590Srgrimes{
531590Srgrimes	int	special;
541590Srgrimes	char	*cp;
551590Srgrimes	char	savedc;
561590Srgrimes	char	tok[MAXTOKEN];
571590Srgrimes
581590Srgrimes	for (;;) {
591590Srgrimes		lineftell = ftell(inf);
601590Srgrimes		if (!fgets(lbuf, sizeof(lbuf), inf))
611590Srgrimes			return;
621590Srgrimes		++lineno;
631590Srgrimes		lbp = lbuf;
641590Srgrimes		if (!cicmp("(def"))
651590Srgrimes			continue;
661590Srgrimes		special = NO;
671590Srgrimes		switch(*lbp | ' ') {
681590Srgrimes		case 'm':
691590Srgrimes			if (cicmp("method"))
701590Srgrimes				special = YES;
711590Srgrimes			break;
721590Srgrimes		case 'w':
731590Srgrimes			if (cicmp("wrapper") || cicmp("whopper"))
741590Srgrimes				special = YES;
751590Srgrimes		}
761590Srgrimes		for (; !isspace(*lbp); ++lbp)
771590Srgrimes			continue;
781590Srgrimes		for (; isspace(*lbp); ++lbp)
791590Srgrimes			continue;
801590Srgrimes		for (cp = lbp; *cp && *cp != '\n'; ++cp)
811590Srgrimes			continue;
821590Srgrimes		*cp = EOS;
831590Srgrimes		if (special) {
841590Srgrimes			if (!(cp = strchr(lbp, ')')))
851590Srgrimes				continue;
861590Srgrimes			for (; cp >= lbp && *cp != ':'; --cp)
871590Srgrimes				continue;
881590Srgrimes			if (cp < lbp)
891590Srgrimes				continue;
901590Srgrimes			lbp = cp;
911590Srgrimes			for (; *cp && *cp != ')' && *cp != ' '; ++cp)
921590Srgrimes				continue;
931590Srgrimes		}
941590Srgrimes		else
951590Srgrimes			for (cp = lbp + 1;
961590Srgrimes			    *cp && *cp != '(' && *cp != ' '; ++cp)
971590Srgrimes				continue;
981590Srgrimes		savedc = *cp;
991590Srgrimes		*cp = EOS;
10097574Stjr		(void)strlcpy(tok, lbp, sizeof(tok));	/* possible trunc */
1011590Srgrimes		*cp = savedc;
1021590Srgrimes		getline();
1031590Srgrimes		pfnote(tok, lineno);
1041590Srgrimes	}
1051590Srgrimes	/*NOTREACHED*/
1061590Srgrimes}
107