The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
/* -*-c-*- */

#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif

static char rcsid[] = "$Id: 00header,v 36.3 2012/09/26 16:10:01 jettisu Exp $";

/*
  (c) 1999-2012 Morgan Stanley & Co. Incorporated
  See ..../src/LICENSE for terms of distribution.
 */	

/*
  Copied from DevelPPPort-1.0003/ppport.h
 */
#ifndef PERL_PATCHLEVEL
#       ifndef __PATCHLEVEL_H_INCLUDED__
#               include "patchlevel.h"
#       endif
#endif
#ifndef PATCHLEVEL
#   define PATCHLEVEL PERL_VERSION
#endif
#ifndef PERL_PATCHLEVEL
#       define PERL_PATCHLEVEL PATCHLEVEL
#endif
#ifndef PERL_SUBVERSION
#       define PERL_SUBVERSION SUBVERSION
#endif
 
#ifndef ERRSV
#       define ERRSV perl_get_sv("@",FALSE)
#endif
 
#if (PERL_PATCHLEVEL < 4) || ((PERL_PATCHLEVEL == 4) && (PERL_SUBVERSION <= 4))
#       define PL_sv_undef      sv_undef
#       define PL_sv_yes        sv_yes
#       define PL_sv_no         sv_no
#       define PL_na            na
#       define PL_stdingv       stdingv
#       define PL_hints         hints
#       define PL_curcop        curcop
#       define PL_curstash      curstash
#       define PL_copline       copline
#endif
 
#if (PERL_PATCHLEVEL < 5)
#  ifdef WIN32
#       define dTHR extern int Perl___notused
#  else
#       define dTHR extern int errno
#  endif
#endif
 
#ifndef boolSV
#       define boolSV(b) ((b) ? &PL_sv_yes : &PL_sv_no)
#endif

__INCLUDES__

/*#define DEBUGME*/

#ifdef DEBUGME
#define TRACEME(x)	do { PerlIO_stdoutf x; PerlIO_stdoutf("\n"); } while (0)
#else
#define TRACEME(x)
#endif

/*
 * Prototypes for the functions in constants.c.PL
 */
MQULONG constant_hex(char *name);
MQLONG  constant_numeric(char *name);
int     constant_string(char * name, char *value);
int     constant_char(char * name, char *value);

/*
 * We need a strnlen()-like function, but since it's not portable,
 * here's a replacement.
 */
size_t
mqstrnlen(const char *s, size_t maxlen)
{
	size_t len = 0;
	while (len < maxlen && *s++)
		len++;
	return (len);
}

/*
 * PRIdLEAST64 and SCNdLEAST64 are a late additions to C99, but we may
 * have the non-least versions.
 */
#if !defined(PRIdLEAST64)
#if !defined(PRId64)
#define PRIdLEAST64 "lld"
#else /* defined(PRId64) */
#define PRIdLEAST64 PRId64
#endif /* defined(PRId64) */
#endif /* defined(PRIdLEAST64) */
#if !defined(SCNdLEAST64)
#if !defined(SCNd64)
#define SCNdLEAST64 "lld"
#else /* defined(SCNd64) */
#define SCNdLEAST64 SCNd64
#endif /* defined(SCNd64) */
#endif /* defined(SCNdLEAST64) */

/*
 * Some things require a specific level for various structure versions.
 */
#define REQUIREATLEAST(x, y) do { if ((x) < (y)) (x) = (y); } while (0)