164562Sgshapiro/* 2125820Sgshapiro * Copyright (c) 1987, 1993, 1994 364562Sgshapiro * The Regents of the University of California. All rights reserved. 464562Sgshapiro * 564562Sgshapiro * Redistribution and use in source and binary forms, with or without 664562Sgshapiro * modification, are permitted provided that the following conditions 764562Sgshapiro * are met: 864562Sgshapiro * 1. Redistributions of source code must retain the above copyright 964562Sgshapiro * notice, this list of conditions and the following disclaimer. 1064562Sgshapiro * 2. Redistributions in binary form must reproduce the above copyright 1190792Sgshapiro * notice, this list of conditions and the following disclaimer in the 12141858Sgshapiro * documentation and/or other materials provided with the distribution. 1364562Sgshapiro * 4. Neither the name of the University nor the names of its contributors 1464562Sgshapiro * may be used to endorse or promote products derived from this software 1564562Sgshapiro * without specific prior written permission. 1664562Sgshapiro * 1764562Sgshapiro * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1864562Sgshapiro * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1964562Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2064562Sgshapiro * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2164562Sgshapiro * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2264562Sgshapiro * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2364562Sgshapiro * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2464562Sgshapiro * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2564562Sgshapiro * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2664562Sgshapiro * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2764562Sgshapiro * SUCH DAMAGE. 2864562Sgshapiro */ 2964562Sgshapiro 3064562Sgshapiro#if 0 3164562Sgshapiro#ifndef lint 3264562Sgshapirostatic char sccsid[] = "@(#)lisp.c 8.3 (Berkeley) 4/2/94"; 3364562Sgshapiro#endif 3464562Sgshapiro#endif 3564562Sgshapiro 3664562Sgshapiro#include <sys/cdefs.h> 3764562Sgshapiro__FBSDID("$FreeBSD$"); 3864562Sgshapiro 3964562Sgshapiro#include <ctype.h> 4064562Sgshapiro#include <limits.h> 4164562Sgshapiro#include <stdio.h> 4264562Sgshapiro#include <string.h> 4364562Sgshapiro 4464562Sgshapiro#include "ctags.h" 4564562Sgshapiro 4664562Sgshapiro/* 4764562Sgshapiro * lisp tag functions 4864562Sgshapiro * just look for (def or (DEF 4964562Sgshapiro */ 5064562Sgshapirovoid 5164562Sgshapirol_entries(void) 5264562Sgshapiro{ 5364562Sgshapiro int special; 5464562Sgshapiro char *cp; 5564562Sgshapiro char savedc; 5664562Sgshapiro char tok[MAXTOKEN]; 5764562Sgshapiro 5864562Sgshapiro for (;;) { 5964562Sgshapiro lineftell = ftell(inf); 6064562Sgshapiro if (!fgets(lbuf, sizeof(lbuf), inf)) 6164562Sgshapiro return; 62125820Sgshapiro ++lineno; 63125820Sgshapiro lbp = lbuf; 64125820Sgshapiro if (!cicmp("(def")) 65125820Sgshapiro continue; 66125820Sgshapiro special = NO; 67132943Sgshapiro switch(*lbp | ' ') { 68132943Sgshapiro case 'm': 69125820Sgshapiro if (cicmp("method")) 70132943Sgshapiro special = YES; 7164562Sgshapiro break; 7264562Sgshapiro case 'w': 7364562Sgshapiro if (cicmp("wrapper") || cicmp("whopper")) 7464562Sgshapiro special = YES; 7564562Sgshapiro } 7664562Sgshapiro for (; !isspace(*lbp); ++lbp) 7764562Sgshapiro continue; 7864562Sgshapiro for (; isspace(*lbp); ++lbp) 7964562Sgshapiro continue; 8064562Sgshapiro for (cp = lbp; *cp && *cp != '\n'; ++cp) 8164562Sgshapiro continue; 8264562Sgshapiro *cp = EOS; 83132943Sgshapiro if (special) { 84132943Sgshapiro if (!(cp = strchr(lbp, ')'))) 85132943Sgshapiro continue; 86132943Sgshapiro for (; cp >= lbp && *cp != ':'; --cp) 87132943Sgshapiro continue; 88132943Sgshapiro if (cp < lbp) 8964562Sgshapiro continue; 9064562Sgshapiro lbp = cp; 9164562Sgshapiro for (; *cp && *cp != ')' && *cp != ' '; ++cp) 9264562Sgshapiro continue; 9364562Sgshapiro } 9464562Sgshapiro else 9564562Sgshapiro for (cp = lbp + 1; 9664562Sgshapiro *cp && *cp != '(' && *cp != ' '; ++cp) 9764562Sgshapiro continue; 9864562Sgshapiro savedc = *cp; 9964562Sgshapiro *cp = EOS; 10064562Sgshapiro (void)strlcpy(tok, lbp, sizeof(tok)); /* possible trunc */ 10164562Sgshapiro *cp = savedc; 10264562Sgshapiro getline(); 10364562Sgshapiro pfnote(tok, lineno); 10464562Sgshapiro } 105132943Sgshapiro /*NOTREACHED*/ 106132943Sgshapiro} 107132943Sgshapiro