/* simcfg.h: System dependent part of headers for generated code.  
 *
 * Defined platform macros (for C level code; same as in OSI):
 *
 *   	OS_SUNOS	Sun OS (not solaris!)
 *   	OS_SOLARIS	Sun Solaris
 *   	OS_IRIX		SGI with Irix
 *	OS_VMS		VMS
 *	OS_ULTRIX	Dec Ultrix
 *	OS_HPUNIX	HP/UX 
 *	OS_AIX		RS/6000 with AIX
 *	OS_NEXT		NextStep
 *	OS_WIN16	Windows (16 bit)
 *	OS_OS2		OS/2 2.0 or greater
 *	OS_NT		Windows NT
 *
 * For all UNIX variants define "OS_UNIX"
 *
 * ???? Later we should use "sysderiv.h" from OSI to detect the system.
 *
 * Also: define calling macros (for WIndows and NT):
 *   SIMCALL	SIMSCRIPT routines
 *   STDCALL	runtime C level routines
 *   FTNCALL	Fortran call
 */


#define simc_SSREL "2.0 "


/************************ MACHINES *******************************/


/*================ SGI  =============================*/
#ifdef __sgi

#define simc_OSNAME "Irix 5.2"
#define OS_IRIX
#define OS_UNIX

/* #define ANSI */
#include <values.h>
#define NO_FOPEN_B_FLAG

#endif



/*================ WINDOWS (16 bit) =================*/
#if defined(_WINDOWS)

#define simc_OSNAME "Windows 3.1"
#define OS_WIN16

#if _MSC_VER == 800
#pragma optimize ("eg", off) 	/* for C 8.0 optimizer bug */
#endif

#define NOCOMM
#include <windows.h>

#ifndef ANSI			/*-- use ANSI prototypes for windows */
#define ANSI
#endif

#define CMR_NOT_IMPLEMENTED	/* no CMR on Windows */

#endif  /*-- Windows --*/


/*================ OS/2 2.0 =================*/
#if defined(__OS2__)

#define simc_OSNAME "OS/2 2.0"
#define OS_OS2

#endif /* OS2 */




/*================ HP700 ============================*/
#ifdef __hp9000s700

#define simc_OSNAME "HP 9000 Series 700"
#define OS_HPUNIX
#define OS_UNIX

/* simjmp.h shouldn't be needed for generated code */
/* #include <values.h>
 * #include "simjmp.h"
*/

#define STACK_GROWS_UPWARD
#define HP800           /*-- also for HP700 */

#endif	/* HP700 */


/*================ VMS (C) ==========================*/
#ifdef vms

#define simc_OSNAME "ALPHA/VAX/VMS_C"
#define OS_VMS

#define VAX_VMS
#ifdef __alpha
#include "setjmp.h"
#endif
#define unlink delete
#define FTIME
#define MAXINT 2147483647
#define MAXFLOAT 1.7014117331926e+38
#define NO_CHECKPOINT
#define ZSYSTEM system

#endif


/*================ SOLARIS  =========================*/
#ifdef solar

#define simc_OSNAME "Solaris"
#define OS_SOLARIS
#define OS_UNIX

#include <values.h>

#endif


/*================ SUNOS 4.x - not SOLARIS ==============*/

#if defined(sparc) && !defined(solar) 


#define simc_OSNAME "Sun-4 SunOS 4.x"
#define OS_SUNOS
#define OS_UNIX

#define SUN
#define SUNOS_4         /*-- SunOS 4.0 or later */

#include <values.h>
#include <signal.h>

#endif



/*================ DEC ??? ==========================*/
#ifdef MIPSEL

#define simc_OSNAME "Dec 3100/Ultrix"
#define OS_ULTRIX
#define OS_UNIX

#include <values.h>
#define NO_FOPEN_B_FLAG


#endif

/*================ OSF/1 (on ALPHA) ============================*/
#ifdef __ALPHA

#endif


/*********************** MISCELLANEOUS ****************************/

#if defined(__sgi) || defined(OS_SUNOS)
#define S_VOID int          /* for SIMSCRIPT routines which return integer */
#else
#define S_VOID VOID
#endif

/********************** MALLOC usage *****************************/

#include <malloc.h>

#if defined(OS_IRIX) || defined(OS_HPUNIX) || defined(OS_VMS) || defined(OS_ULTRIX) || defined(OS_SOLARIS) || defined(OS_SUNOS)

#ifdef __ALPHA 

#else

#define malloc  sim_malloc
#define calloc  sim_calloc
#define realloc sim_realloc
#define free    sim_free
				/* prototypes are in simcom.h */
#endif

#endif



/************************ TYPE macros ****************************/


#if defined(_WINDOWS)

#ifndef FAR
#define FAR _far
#endif

#ifndef PASCAL
#define PASCAL _pascal
#endif

#ifndef CDECL
#define CDECL _cdecl
#endif

#define EXPORT  __export

#define SIMCALL FAR CDECL
#define STDCALL FAR CDECL
#define FTNCALL FAR PASCAL

#else	/*---- machines that can ignore the FAR, PASCAL and CDECL */

#define FAR 
#define PASCAL 
#define CDECL 
#define EXPORT

#define SIMCALL 
#define STDCALL 
#define FTNCALL 

#endif	

#if !defined(VOID)
#define VOID void
#endif

#ifndef PVOID
#define PVOID void *
#endif


#if defined(OS_SOLARIS) || defined(solar)  || defined(OS_SUNOS)
#undef VOID
#define VOID int
#endif

/* only ANSI compilers can handle void arguments */
#if !defined(VOID_ARGS) && defined(ANSI)
#define VOID_ARGS void
#endif



