1100360Smarkm/*	$NetBSD: lint.h,v 1.5 2002/03/07 18:29:56 tv Exp $	*/
291586Smarkm
391586Smarkm/*
491586Smarkm * Copyright (c) 1994, 1995 Jochen Pohl
591586Smarkm * All Rights Reserved.
691586Smarkm *
791586Smarkm * Redistribution and use in source and binary forms, with or without
891586Smarkm * modification, are permitted provided that the following conditions
991586Smarkm * are met:
1091586Smarkm * 1. Redistributions of source code must retain the above copyright
1191586Smarkm *    notice, this list of conditions and the following disclaimer.
1291586Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1391586Smarkm *    notice, this list of conditions and the following disclaimer in the
1491586Smarkm *    documentation and/or other materials provided with the distribution.
1591586Smarkm * 3. All advertising materials mentioning features or use of this software
1691586Smarkm *    must display the following acknowledgement:
1791586Smarkm *      This product includes software developed by Jochen Pohl for
1891586Smarkm *	The NetBSD Project.
1991586Smarkm * 4. The name of the author may not be used to endorse or promote products
2091586Smarkm *    derived from this software without specific prior written permission.
2191586Smarkm *
2291586Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2391586Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2491586Smarkm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2591586Smarkm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2691586Smarkm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2791586Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2891586Smarkm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2991586Smarkm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3091586Smarkm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3191586Smarkm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3291586Smarkm */
3391586Smarkm
3491586Smarkm#if HAVE_CONFIG_H
3591586Smarkm#include "config.h"
3691586Smarkm#else
3791586Smarkm#define HAVE_DECL_SYS_SIGNAME 1
3891586Smarkm#endif
3991586Smarkm
4091586Smarkm#include <sys/types.h>
4191586Smarkm#include <stddef.h>
4291586Smarkm#include <err.h>
4391586Smarkm#include <inttypes.h>
4491586Smarkm#include <stdio.h>
4591586Smarkm
4691586Smarkm#include "param.h"
4791586Smarkm
4891586Smarkm/*
4991586Smarkm * Type specifiers, used in type structures (type_t) and otherwere.
5091586Smarkm */
5191586Smarkmtypedef enum {
5291586Smarkm	NOTSPEC = 0,
5391586Smarkm	SIGNED,		/* keyword "signed", only used in the parser */
5491586Smarkm	UNSIGN,		/* keyword "unsigned", only used in the parser */
5591586Smarkm	CHAR,		/* char */
5691586Smarkm	SCHAR,		/* signed char */
5791586Smarkm	UCHAR,		/* unsigned char */
5891586Smarkm	SHORT,		/* (signed) short */
5991586Smarkm	USHORT,		/* unsigned short */
6091586Smarkm	INT,		/* (signed) int */
6191586Smarkm	UINT,		/* unsigned int */
6291586Smarkm	LONG,		/* (signed) long */
6391586Smarkm	ULONG,		/* unsigned long */
6491586Smarkm	QUAD,		/* (signed) long long */
6591586Smarkm	UQUAD,		/* unsigned long long */
6691586Smarkm	FLOAT,		/* float */
6791586Smarkm	DOUBLE,		/* double or, with tflag, long float */
6891586Smarkm	LDOUBLE,	/* long double */
6991586Smarkm	VOID,		/* void */
7091586Smarkm	STRUCT,		/* structure tag */
7191586Smarkm	UNION,		/* union tag */
7291586Smarkm	ENUM,		/* enum tag */
7391586Smarkm	PTR,		/* pointer */
7491586Smarkm	ARRAY,		/* array */
7591586Smarkm	FUNC,		/* function */
7691586Smarkm	NTSPEC
7791586Smarkm} tspec_t;
7891586Smarkm
7991586Smarkm/*
8091586Smarkm * size of types, name and classification
8191586Smarkm */
8291586Smarkmtypedef	struct {
8391586Smarkm	int	tt_sz;			/* size in bits */
8491586Smarkm	int	tt_psz;			/* size, different from tt_sz
8591586Smarkm					   if pflag is set */
8691586Smarkm	tspec_t	tt_styp;		/* signed counterpart */
8791586Smarkm	tspec_t	tt_utyp;		/* unsigned counterpart */
8891586Smarkm	u_int	tt_isityp : 1;		/* 1 if integer type */
8991586Smarkm	u_int	tt_isutyp : 1;		/* 1 if unsigned integer type */
9091586Smarkm	u_int	tt_isftyp : 1;		/* 1 if floating point type */
9191586Smarkm	u_int	tt_isatyp : 1;		/* 1 if arithmetic type */
9291586Smarkm	u_int	tt_issclt : 1;		/* 1 if scalar type */
9391586Smarkm	char	*tt_name;		/* Bezeichnung des Typs */
9491586Smarkm} ttab_t;
9591586Smarkm
9691586Smarkm#define size(t)		(ttab[t].tt_sz)
9791586Smarkm#define psize(t)	(ttab[t].tt_psz)
9891586Smarkm#define styp(t)		(ttab[t].tt_styp)
9991586Smarkm#define utyp(t)		(ttab[t].tt_utyp)
10091586Smarkm#define isityp(t)	(ttab[t].tt_isityp)
10191586Smarkm#define isutyp(t)	(ttab[t].tt_isutyp)
10291586Smarkm#define isftyp(t)	(ttab[t].tt_isftyp)
10391586Smarkm#define isatyp(t)	(ttab[t].tt_isatyp)
10491586Smarkm#define issclt(t)	(ttab[t].tt_issclt)
10591586Smarkm
10691586Smarkmextern	ttab_t	ttab[];
10791586Smarkm
10891586Smarkm
10991586Smarkmtypedef	enum {
11091586Smarkm	NODECL,			/* until now not declared */
11191586Smarkm	DECL,			/* declared */
11291586Smarkm	TDEF,			/* tentative defined */
11391586Smarkm	DEF			/* defined */
11491586Smarkm} def_t;
11591586Smarkm
11691586Smarkm/*
11791586Smarkm * Following structure contains some data used for the output buffer.
11891586Smarkm */
11991586Smarkmtypedef	struct	ob {
12091586Smarkm	char	*o_buf;		/* buffer */
12191586Smarkm	char	*o_end;		/* first byte after buffer */
12291586Smarkm	size_t	o_len;		/* length of buffer */
12391586Smarkm	char	*o_nxt;		/* next free byte in buffer */
12491586Smarkm} ob_t;
12591586Smarkm
12691586Smarkm#include "externs.h"
127