Quelltext /~heha/hs/gputils64-210929.zip/libgputils/stdhdr.h

/* standard defines and includes
   Copyright 1998-2005	James Bowman, Craig Franklin
   Copyright 2016	Molnár Károly
   Copyleft 2021	Henrik Haftmann
*/

#pragma once

#ifdef __cplusplus
# define EXTERN_C extern "C"
#else
# error "Must be in C++ mode"
#endif

// For the heading of listing
#define VERSION "1.6.0"
#define REVISION "2108"
// For global #defines
#define GPUTILS_SVN_VERSION 1
#define GPUTILS_VERSION_MAJOR 1
#define GPUTILS_VERSION_MINOR 6
#define GPUTILS_VERSION_MICRO 0
// For the footer of help page
#define PACKAGE_BUGREPORT "heha@hrz.tu-chemnitz.de"

#include <string.h>
#include <stdlib.h>
#include <stdarg.h>

#ifdef _MSC_VER	// Microsoft compiler specific (Non-C99)
# ifdef GPUTILS_EXPORTS
#  define EXTERN _declspec(dllexport)
# else
#  define EXTERN _declspec(dllimport)
# endif
# define EXDATA EXTERN_C EXTERN			// exported data
# define FUNC(ret) EXTERN_C EXTERN ret _stdcall	// normal exported function
# define CFUNC(ret) EXTERN_C EXTERN ret _cdecl	// exported function with ... argument
# define MFUNC(ret) EXTERN ret _fastcall	// exported member function (C++ linkage)
# define __attribute__(x)
# include <io.h>		// isatty
# define isatty _isatty
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
# define snprintf _snprintf	// use msvcrt.dll implementation and avoid NULL pointer for target
# define vsnprintf _vsnprintf
typedef signed char	int8_t;
typedef unsigned char	uint8_t;
typedef short		int16_t;
typedef unsigned short	uint16_t;
typedef int		int32_t;
typedef unsigned	uint32_t;
typedef __int64		int64_t;
typedef unsigned __int64 uint64_t;
#define UINT32_MAX	4294967295U
#ifndef _DEBUG
# define NDEBUG	// let wipe-out assert calls inside <assert.h>
#endif

#else

# include <inttypes.h>		// gcc C99 has this include file
# define EXTERN
# define EXDATA extern		// don't extra-decorate shared-library-exported/imported data
# define FUNC(ret) EXTERN_C ret	// don't extra-decorate shared-library-exported/imported functions
# define CFUNC(ret) EXTERN_C ret
# define MFUNC(ret) ret

#endif

#define OFF_FMTu	"lu"
#define SIZE_FMTu	"u"

#include <stdio.h>
#include <assert.h>
#include <sys/stat.h>

//#include "getopt.h"
FUNC(void) gp_checkarg(const char*, const char*);
FUNC(void) gp_getopt(const char*const*,const char*,void(_stdcall*)(void*,char,const char*),void* =0);
CFUNC(void) gp_usage(const char*argv0,const char*opts,const char*desc,
	int left=26,int width=79,const char*footer=0,...);

// No system strndup: Use the one implemented in libiberty.
FUNC(char*) strndup(const char *s, size_t n);
// No system strverscmp: Use and export the one implemented in libiberty.
FUNC(int) strverscmp(const char *s1, const char *s2);

#include <time.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>

#ifdef _WIN32
  #define UNIX_PATH_CHAR        '/'
  #define PATH_SEPARATOR_CHAR   '\\'
  #define PATH_SEPARATOR_STR    "\\"
#else
  #define PATH_SEPARATOR_CHAR   '/'
  #define PATH_SEPARATOR_STR    "/"
#endif

#define GPUTILS_COPYRIGHT_STRING        "Copyright 1998-2021 gputils project h#s"

#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402
  #define GPUTILS_GCC_STR(s)            #s
  #define GPUTILS_GCC_JOINSTR(x,y)      GPUTILS_GCC_STR(x ## y)
  #define GPUTILS_GCC_DO_PRAGMA(x)      _Pragma(#x)
  #define GPUTILS_GCC_PRAGMA(x)         GPUTILS_GCC_DO_PRAGMA(GCC diagnostic x)

  #if ((__GNUC__ * 100) + __GNUC_MINOR__) < 406
    /* needed for older GCCs that accept only top of the file diagnostic pragmas */
    #define GPUTILS_GCC_DIAG_TOP(x)     GPUTILS_GCC_PRAGMA(ignored GPUTILS_GCC_JOINSTR(-W,x))
    #define GPUTILS_GCC_DIAG_OFF(x)
    #define GPUTILS_GCC_DIAG_ON(x)
  #else
    #define GPUTILS_GCC_DIAG_TOP(x)

    #define GPUTILS_GCC_DIAG_OFF(x) \
                GPUTILS_GCC_PRAGMA(push) \
                GPUTILS_GCC_PRAGMA(ignored GPUTILS_GCC_JOINSTR(-W,x))

    #define GPUTILS_GCC_DIAG_ON(x)      GPUTILS_GCC_PRAGMA(pop)
  #endif
#else
  #define GPUTILS_GCC_DIAG_TOP(x)
  #define GPUTILS_GCC_DIAG_OFF(x)
  #define GPUTILS_GCC_DIAG_ON(x)
#endif
Vorgefundene Kodierung: UTF-80