112099Sjoerg/*	$NetBSD: lint.h,v 1.2 1995/07/03 21:24:18 cgd Exp $	*/
212099Sjoerg
312099Sjoerg/*
412099Sjoerg * Copyright (c) 1994, 1995 Jochen Pohl
512099Sjoerg * All Rights Reserved.
612099Sjoerg *
712099Sjoerg * Redistribution and use in source and binary forms, with or without
812099Sjoerg * modification, are permitted provided that the following conditions
912099Sjoerg * are met:
1012099Sjoerg * 1. Redistributions of source code must retain the above copyright
1112099Sjoerg *    notice, this list of conditions and the following disclaimer.
1212099Sjoerg * 2. Redistributions in binary form must reproduce the above copyright
1312099Sjoerg *    notice, this list of conditions and the following disclaimer in the
1412099Sjoerg *    documentation and/or other materials provided with the distribution.
1512099Sjoerg * 3. All advertising materials mentioning features or use of this software
1612099Sjoerg *    must display the following acknowledgement:
1712099Sjoerg *      This product includes software developed by Jochen Pohl for
1812099Sjoerg *	The NetBSD Project.
1912099Sjoerg * 4. The name of the author may not be used to endorse or promote products
2012099Sjoerg *    derived from this software without specific prior written permission.
2112099Sjoerg *
2212099Sjoerg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2312099Sjoerg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2412099Sjoerg * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2512099Sjoerg * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2612099Sjoerg * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2712099Sjoerg * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2812099Sjoerg * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2912099Sjoerg * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3012099Sjoerg * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3112099Sjoerg * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3212099Sjoerg */
3312099Sjoerg
3412099Sjoerg#include <sys/types.h>
3512099Sjoerg#include <stdio.h>
3612099Sjoerg#include <stddef.h>
3712099Sjoerg
3812099Sjoerg#include "param.h"
3912099Sjoerg
4012099Sjoerg/*
4112099Sjoerg * Type specifiers, used in type structures (type_t) and otherwere.
4212099Sjoerg */
4312099Sjoergtypedef enum {
4412099Sjoerg	NOTSPEC,
4512099Sjoerg	SIGNED,		/* keyword "signed", only used in the parser */
4612099Sjoerg	UNSIGN,		/* keyword "unsigned", only used in the parser */
4712099Sjoerg	CHAR,		/* char */
4812099Sjoerg	SCHAR,		/* signed char */
4912099Sjoerg	UCHAR,		/* unsigned char */
5012099Sjoerg	SHORT,		/* (signed) short */
5112099Sjoerg	USHORT,		/* unsigned short */
5212099Sjoerg	INT,		/* (signed) int */
5312099Sjoerg	UINT,		/* unsigned int */
5412099Sjoerg	LONG,		/* (signed) long */
5512099Sjoerg	ULONG,		/* unsigned long */
5612099Sjoerg	QUAD,		/* (signed) long long */
5712099Sjoerg	UQUAD,		/* unsigned long long */
5812099Sjoerg	FLOAT,		/* float */
5912099Sjoerg	DOUBLE,		/* double or, with tflag, long float */
6012099Sjoerg	LDOUBLE,	/* long double */
6112099Sjoerg	VOID,		/* void */
6212099Sjoerg	STRUCT,		/* structure tag */
6312099Sjoerg	UNION,		/* union tag */
6412099Sjoerg	ENUM,		/* enum tag */
6512099Sjoerg	PTR,		/* pointer */
6612099Sjoerg	ARRAY,		/* array */
6712099Sjoerg	FUNC		/* function */
6812099Sjoerg#define	NTSPEC		((int)FUNC + 1)
6912099Sjoerg} tspec_t;
7012099Sjoerg
7112099Sjoerg/*
7212099Sjoerg * size of types, name and classification
7312099Sjoerg */
7412099Sjoergtypedef	struct {
7512099Sjoerg	int	tt_sz;			/* size in bits */
7612099Sjoerg	int	tt_psz;			/* size, different from tt_sz
7712099Sjoerg					   if pflag is set */
7812099Sjoerg	tspec_t	tt_styp;		/* signed counterpart */
7912099Sjoerg	tspec_t	tt_utyp;		/* unsigned counterpart */
8012099Sjoerg	u_int	tt_isityp : 1;		/* 1 if integer type */
8112099Sjoerg	u_int	tt_isutyp : 1;		/* 1 if unsigned integer type */
8212099Sjoerg	u_int	tt_isftyp : 1;		/* 1 if floating point type */
8312099Sjoerg	u_int	tt_isatyp : 1;		/* 1 if arithmetic type */
8412099Sjoerg	u_int	tt_issclt : 1;		/* 1 if scalar type */
8512099Sjoerg	char	*tt_name;		/* Bezeichnung des Typs */
8612099Sjoerg} ttab_t;
8712099Sjoerg
8812099Sjoerg#define size(t)		(ttab[t].tt_sz)
8912099Sjoerg#define psize(t)	(ttab[t].tt_psz)
9012099Sjoerg#define styp(t)		(ttab[t].tt_styp)
9112099Sjoerg#define utyp(t)		(ttab[t].tt_utyp)
9212099Sjoerg#define isityp(t)	(ttab[t].tt_isityp)
9312099Sjoerg#define isutyp(t)	(ttab[t].tt_isutyp)
9412099Sjoerg#define isftyp(t)	(ttab[t].tt_isftyp)
9512099Sjoerg#define isatyp(t)	(ttab[t].tt_isatyp)
9612099Sjoerg#define issclt(t)	(ttab[t].tt_issclt)
9712099Sjoerg
9812099Sjoergextern	ttab_t	ttab[];
9912099Sjoerg
10012099Sjoerg
10112099Sjoergtypedef	enum {
10212099Sjoerg	NODECL,			/* until now not declared */
10312099Sjoerg	DECL,			/* declared */
10412099Sjoerg	TDEF,			/* tentative defined */
10512099Sjoerg	DEF			/* defined */
10612099Sjoerg} def_t;
10712099Sjoerg
10812099Sjoerg/*
10912099Sjoerg * Following structure contains some data used for the output buffer.
11012099Sjoerg */
11112099Sjoergtypedef	struct	ob {
11212099Sjoerg	char	*o_buf;		/* buffer */
11312099Sjoerg	char	*o_end;		/* first byte after buffer */
11412099Sjoerg	size_t	o_len;		/* length of buffer */
11512099Sjoerg	char	*o_nxt;		/* next free byte in buffer */
11612099Sjoerg} ob_t;
11712099Sjoerg
11812099Sjoerg#include "externs.h"
119