/* Copyright (C) 2001-2009, Parrot Foundation.
 * $Id: config_h.in 48412 2010-08-11 05:38:18Z plobsing $
 */

/* config.h
 *
 * Platform-specific config file
 *
 */

#ifndef PARROT_CONFIG_H_GUARD
#define PARROT_CONFIG_H_GUARD

/*
** ONLY PUT EMBEDDER-ACCESSIBLE SYMBOLS UP HERE!!!
** Other symbols may go below.
*/

#define PARROT_VERSION          "@VERSION@@DEVEL@"
#define PARROT_CONFIG_DATE      "@configdate@"
#define PARROT_MAJOR_VERSION    @MAJOR@
#define PARROT_MINOR_VERSION    @MINOR@
#define PARROT_PATCH_VERSION    @PATCH@
#define PARROT_ARCHNAME         "@cpuarch@-@osname@"
#define PARROT_JIT_CAPABLE      @jitcapable@
#define PARROT_EXEC_CAPABLE     @execcapable@
#define PARROT_SHARE_EXT        "@share_ext@"
#define PARROT_LOAD_EXT         "@load_ext@"
#define PARROT_OBJ_EXT          "@o@"

typedef @iv@                    Parrot_Int;
typedef unsigned @iv@           Parrot_UInt;
typedef @nv@                    Parrot_Float;
typedef @opcode_t@              Parrot_Opcode;
typedef void *                  Parrot_Pointer;

typedef char                    Parrot_Int1;
typedef unsigned char           Parrot_UInt1;
typedef @int2_t@                Parrot_Int2;
typedef unsigned @int2_t@       Parrot_UInt2;
typedef @int4_t@                Parrot_Int4;
typedef unsigned @int4_t@       Parrot_UInt4;

typedef @float4_t@              Parrot_Float4;
typedef @float8_t@              Parrot_Float8;

#include "parrot/platform_limits.h"
#ifndef PARROT_INTVAL_MIN
#  define PARROT_INTVAL_MIN              @intvalmin@
#endif
#ifndef PARROT_INTVAL_MAX
#  define PARROT_INTVAL_MAX              @intvalmax@
#endif

#ifndef PARROT_FLOATVAL_MIN
#  define PARROT_FLOATVAL_MIN            @floatvalmin@
#endif
#ifndef PARROT_FLOATVAL_MAX
#  define PARROT_FLOATVAL_MAX            @floatvalmax@
#endif

/* Temporary until we find a way to make it work in the right place. */
struct PackFile;      typedef struct PackFile * Parrot_PackFile;

/* Symbol export and import decoration. At the time of writing, note that
 * PARROT_IN_CORE won't always imply !PARROT_IN_EXTENSION. */
#if defined(PARROT_IN_EXTENSION)
#if defined(__cplusplus)
#  define PARROT_EXPORT extern "C" @sym_import@
#  define PARROT_DATA extern "C" @sym_import@
#  define PARROT_DYNEXT_EXPORT extern "C" @sym_export@
#else
#  define PARROT_EXPORT @sym_import@
#  define PARROT_DATA extern @sym_import@
#  define PARROT_DYNEXT_EXPORT @sym_export@
#endif
#else
#if defined(__cplusplus)
#  define PARROT_EXPORT extern "C" @sym_export@
#  define PARROT_DATA extern "C" @sym_export@
#else
#  define PARROT_EXPORT @sym_export@
#  define PARROT_DATA extern @sym_export@
#endif
#endif

#if defined(PARROT_IN_CORE)

/* Put any other symbols here. */

#include <stddef.h>

#define PARROT_CPU_ARCH         "@cpuarch@"
#define PARROT_OS_NAME          "@jitosname@"
#define PARROT_BYTEORDER        0x@byteorder@
#define PARROT_BIGENDIAN        @bigendian@

#define PARROT_LITTLEENDIAN	!(PARROT_BIGENDIAN)

typedef Parrot_Int INTVAL;
typedef Parrot_UInt UINTVAL;
typedef Parrot_Float FLOATVAL;

typedef @hugeintval@ HUGEINTVAL;
typedef unsigned @hugeintval@ UHUGEINTVAL;
typedef @hugefloatval@ HUGEFLOATVAL;

#define INTVAL_SIZE @intvalsize@
#define NUMVAL_SIZE @nvsize@
#define OPCODE_T_SIZE @opcode_t_size@
#define PTR_SIZE @ptrsize@
#define SHORT_SIZE @shortsize@
#define INT_SIZE @intsize@
#define LONG_SIZE @longsize@
#define HUGEINTVAL_SIZE @hugeintvalsize@
#define DOUBLE_SIZE @doublesize@

/* We don't have a portable config for 64-bit
 * registers yet. */
#if 0
#  if INTVAL_SIZE >= 8
typedef Parrot_Int   INTVAL64;
typedef Parrot_Int   Parrot_Int64;
#  else
#    if HUGEINTVAL_SIZE >= 8
typedef HUGEINTVAL   INTVAL64;
typedef HUGEINTVAL   Parrot_Int64;
#    else
/* No 64-bit type available? */
typedef union { unsigned char b[8]; } INTVAL64;
typedef INTVAL64   Parrot_Int64;
#    endif
#  endif
#endif


typedef Parrot_Opcode opcode_t;
typedef size_t ptrcast_t;

typedef struct _vtable VTABLE;
typedef void DPOINTER;

/* JIT and exec cores. */
#define JIT_CPUARCH  "@jitcpuarch@"
#define JIT_OSNAME   "@jitosname@"
#define JIT_ARCHNAME "@jitarchname@"
#define JIT_CAPABLE  @jitcapable@
#define EXEC_CAPABLE @execcapable@
#define PARROT_EXEC_OS_@jitosname@ 1
#define PARROT_@jitcpu@ 1

/* Oplib and dynamic ops related. */
#define PARROT_CORE_OPLIB_NAME "core_ops"
#define PARROT_CORE_OPLIB_INIT Parrot_DynOp_core_@MAJOR@_@MINOR@_@PATCH@

/* ICU. */
#define PARROT_HAS_ICU @has_icu@

/* Int and float formats. */
#define INTVAL_FMT "@intvalfmt@"
#define FLOATVAL_FMT "@floatvalfmt@"

#include "parrot/has_header.h"
#include "parrot/feature.h"

#endif

#endif /* PARROT_CONFIG_H_GUARD */

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */

