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