Blame include/types.h

Packit Service 5e8d2a
/* types.h - some common typedefs
Packit Service 5e8d2a
 *	Copyright (C) 1998 Free Software Foundation, Inc.
Packit Service 5e8d2a
 *
Packit Service 5e8d2a
 * This file was part of GNUPG.
Packit Service 5e8d2a
 * $Header$
Packit Service 5e8d2a
 *
Packit Service 5e8d2a
 * GNUPG is free software; you can redistribute it and/or modify
Packit Service 5e8d2a
 * it under the terms of the GNU General Public License as published by
Packit Service 5e8d2a
 * the Free Software Foundation; either version 2 of the License, or
Packit Service 5e8d2a
 * (at your option) any later version.
Packit Service 5e8d2a
 *
Packit Service 5e8d2a
 * GNUPG is distributed in the hope that it will be useful,
Packit Service 5e8d2a
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 5e8d2a
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 5e8d2a
 * GNU General Public License for more details.
Packit Service 5e8d2a
 *
Packit Service 5e8d2a
 * You should have received a copy of the GNU General Public License
Packit Service 5e8d2a
 * along with this program; if not, write to the Free Software
Packit Service 5e8d2a
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Packit Service 5e8d2a
 */
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef _TYPES_H_INCLUDED
Packit Service 5e8d2a
#define _TYPES_H_INCLUDED
Packit Service 5e8d2a
Packit Service 5e8d2a
/* The AC_CHECK_SIZEOF() in configure fails for some machines.
Packit Service 5e8d2a
 * we provide some fallback values here */
Packit Service 5e8d2a
#if !SIZEOF_UNSIGNED_SHORT
Packit Service 5e8d2a
#  undef SIZEOF_UNSIGNED_SHORT
Packit Service 5e8d2a
#  define SIZEOF_UNSIGNED_SHORT 2
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
#if !SIZEOF_UNSIGNED_INT
Packit Service 5e8d2a
#  undef SIZEOF_UNSIGNED_INT
Packit Service 5e8d2a
#  define SIZEOF_UNSIGNED_INT 4
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
#if !SIZEOF_UNSIGNED_LONG
Packit Service 5e8d2a
#  undef SIZEOF_UNSIGNED_LONG
Packit Service 5e8d2a
#  define SIZEOF_UNSIGNED_LONG 4
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#include <sys/types.h>
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_BYTE
Packit Service 5e8d2a
#  undef byte	    /* maybe there is a macro with this name */
Packit Service 5e8d2a
  typedef unsigned char byte;
Packit Service 5e8d2a
#  define HAVE_BYTE
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_USHORT
Packit Service 5e8d2a
#  undef ushort     /* maybe there is a macro with this name */
Packit Service 5e8d2a
  typedef unsigned short ushort;
Packit Service 5e8d2a
#  define HAVE_USHORT
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_ULONG
Packit Service 5e8d2a
#  undef ulong	    /* maybe there is a macro with this name */
Packit Service 5e8d2a
  typedef unsigned long ulong;
Packit Service 5e8d2a
#  define HAVE_ULONG
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_U16
Packit Service 5e8d2a
#  undef u16	    /* maybe there is a macro with this name */
Packit Service 5e8d2a
#  if SIZEOF_UNSIGNED_INT == 2
Packit Service 5e8d2a
    typedef unsigned int   u16;
Packit Service 5e8d2a
#  elif SIZEOF_UNSIGNED_SHORT == 2
Packit Service 5e8d2a
    typedef unsigned short u16;
Packit Service 5e8d2a
#  else
Packit Service 5e8d2a
#    error no typedef for u16
Packit Service 5e8d2a
#  endif
Packit Service 5e8d2a
#  define HAVE_U16
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_U32
Packit Service 5e8d2a
#  undef u32	    /* maybe there is a macro with this name */
Packit Service 5e8d2a
#  if SIZEOF_UNSIGNED_INT == 4
Packit Service 5e8d2a
    typedef unsigned int u32;
Packit Service 5e8d2a
#  elif SIZEOF_UNSIGNED_LONG == 4
Packit Service 5e8d2a
    typedef unsigned long u32;
Packit Service 5e8d2a
#  else
Packit Service 5e8d2a
#    error no typedef for u32
Packit Service 5e8d2a
#  endif
Packit Service 5e8d2a
#  define HAVE_U32
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
#ifndef HAVE_U64
Packit Service 5e8d2a
#  undef u64	    /* maybe there is a macro with this name */
Packit Service 5e8d2a
#  if SIZEOF_UNSIGNED_INT == 8
Packit Service 5e8d2a
    typedef unsigned int u64;
Packit Service 5e8d2a
#    define HAVE_U64
Packit Service 5e8d2a
#  elif SIZEOF_UNSIGNED_LONG == 8
Packit Service 5e8d2a
    typedef unsigned long u64;
Packit Service 5e8d2a
#    define HAVE_U64
Packit Service 5e8d2a
#  elif __GNUC__ >= 2 || defined(__SUNPRO_C) || defined(_AIX) && defined(_LONGLONG)
Packit Service 5e8d2a
    typedef unsigned long long u64;
Packit Service 5e8d2a
#    define HAVE_U64
Packit Service 5e8d2a
#  endif
Packit Service 5e8d2a
#endif
Packit Service 5e8d2a
Packit Service 5e8d2a
typedef union {
Packit Service 5e8d2a
    int a;
Packit Service 5e8d2a
    short b;
Packit Service 5e8d2a
    char c[1];
Packit Service 5e8d2a
    long d;
Packit Service 5e8d2a
#  ifdef HAVE_U64
Packit Service 5e8d2a
    u64 e;
Packit Service 5e8d2a
#  endif
Packit Service 5e8d2a
    float f;
Packit Service 5e8d2a
    double g;
Packit Service 5e8d2a
} PROPERLY_ALIGNED_TYPE;
Packit Service 5e8d2a
Packit Service 5e8d2a
typedef struct string_list {
Packit Service 5e8d2a
    struct string_list *next;
Packit Service 5e8d2a
    unsigned int flags;
Packit Service 5e8d2a
    char d[1];
Packit Service 5e8d2a
} *STRLIST;
Packit Service 5e8d2a
Packit Service 5e8d2a
Packit Service 5e8d2a
#endif /*_INCLUDED_TYPES_H*/