1/*	$NetBSD: lint.h,v 1.2 1995/07/03 21:24:18 cgd Exp $	*/
2
3/*
4 * Copyright (c) 1994, 1995 Jochen Pohl
5 * All Rights Reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *      This product includes software developed by Jochen Pohl for
18 *	The NetBSD Project.
19 * 4. The name of the author may not be used to endorse or promote products
20 *    derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#include <sys/types.h>
35#include <stdio.h>
36#include <stddef.h>
37
38#include "param.h"
39
40/*
41 * Type specifiers, used in type structures (type_t) and otherwere.
42 */
43typedef enum {
44	NOTSPEC,
45	SIGNED,		/* keyword "signed", only used in the parser */
46	UNSIGN,		/* keyword "unsigned", only used in the parser */
47	CHAR,		/* char */
48	SCHAR,		/* signed char */
49	UCHAR,		/* unsigned char */
50	SHORT,		/* (signed) short */
51	USHORT,		/* unsigned short */
52	INT,		/* (signed) int */
53	UINT,		/* unsigned int */
54	LONG,		/* (signed) long */
55	ULONG,		/* unsigned long */
56	QUAD,		/* (signed) long long */
57	UQUAD,		/* unsigned long long */
58	FLOAT,		/* float */
59	DOUBLE,		/* double or, with tflag, long float */
60	LDOUBLE,	/* long double */
61	VOID,		/* void */
62	STRUCT,		/* structure tag */
63	UNION,		/* union tag */
64	ENUM,		/* enum tag */
65	PTR,		/* pointer */
66	ARRAY,		/* array */
67	FUNC		/* function */
68#define	NTSPEC		((int)FUNC + 1)
69} tspec_t;
70
71/*
72 * size of types, name and classification
73 */
74typedef	struct {
75	int	tt_sz;			/* size in bits */
76	int	tt_psz;			/* size, different from tt_sz
77					   if pflag is set */
78	tspec_t	tt_styp;		/* signed counterpart */
79	tspec_t	tt_utyp;		/* unsigned counterpart */
80	u_int	tt_isityp : 1;		/* 1 if integer type */
81	u_int	tt_isutyp : 1;		/* 1 if unsigned integer type */
82	u_int	tt_isftyp : 1;		/* 1 if floating point type */
83	u_int	tt_isatyp : 1;		/* 1 if arithmetic type */
84	u_int	tt_issclt : 1;		/* 1 if scalar type */
85	char	*tt_name;		/* Bezeichnung des Typs */
86} ttab_t;
87
88#define size(t)		(ttab[t].tt_sz)
89#define psize(t)	(ttab[t].tt_psz)
90#define styp(t)		(ttab[t].tt_styp)
91#define utyp(t)		(ttab[t].tt_utyp)
92#define isityp(t)	(ttab[t].tt_isityp)
93#define isutyp(t)	(ttab[t].tt_isutyp)
94#define isftyp(t)	(ttab[t].tt_isftyp)
95#define isatyp(t)	(ttab[t].tt_isatyp)
96#define issclt(t)	(ttab[t].tt_issclt)
97
98extern	ttab_t	ttab[];
99
100
101typedef	enum {
102	NODECL,			/* until now not declared */
103	DECL,			/* declared */
104	TDEF,			/* tentative defined */
105	DEF			/* defined */
106} def_t;
107
108/*
109 * Following structure contains some data used for the output buffer.
110 */
111typedef	struct	ob {
112	char	*o_buf;		/* buffer */
113	char	*o_end;		/* first byte after buffer */
114	size_t	o_len;		/* length of buffer */
115	char	*o_nxt;		/* next free byte in buffer */
116} ob_t;
117
118#include "externs.h"
119