/* SccsId = "@(#)define.h 4.2 (TU-Delft) 07/27/92" */
/**********************************************************

Name/Version      : sls_exp/4.2

Language          : C
Operating system  : UNIX SYSTEM V
Host machine      : HP9000

Author(s)         : A.J. van Genderen
Creation date     : 10-Jul-1986
Modified by       : S. de Graaf
Modification date : 10-Jul-1986


        Delft University of Technology
        Department of Electrical Engineering
        Network Theory Section
        Mekelweg 4 - P.O.Box 5031
        2600 GA DELFT
        The Netherlands

        Phone : 015 - 786234

        COPYRIGHT (C) 1986 , All rights reserved
**********************************************************/

#define MC_NETWORK        1   /* model call to a network                */
#define MC_STD_DEVICE     2   /* to a standerd built-in device          */
#define MC_EXT_DEVICE     3   /* to a extra and external defined device */

#define MAX(i,j)	(((i)>(j))?(i):(j))
#define MIN(i,j)	(((i)<(j))?(i):(j))

#define SIZE_PTR_INT       MAX (sizeof (char *), sizeof (int))

#define PALLOC(ptr, nel, type)      {                                          \
    if (nel == 0) ptr = NULL; \
    else \
    if ( (ptr = (type *)calloc ((unsigned)(nel), sizeof (type))) == NULL) {    \
        cannotAlloc (__FILE__, __LINE__, (int)(nel), sizeof (type));           \
    }                                                                          }

#define PPALLOC(ptr, nel, type)     {                                          \
    if (nel == 0) ptr = NULL; \
    else \
    if ( (ptr = (type **)calloc ((unsigned)(nel), sizeof (type *))) == NULL) { \
        cannotAlloc (__FILE__, __LINE__, (int)(nel), sizeof (type *));         \
    }                                                                          }

#define CFREE(ptr)          { cfree ( (char *)ptr ); }
    
#define OPENR(fptr, str)     {                                                 \
    if ( ( fptr = fopen (str, "r") ) == NULL ) {                               \
        fprintf (stderr, "%s: Cannot open %s\n", argv0, str);                  \
	die (1);                                                               \
    }                                                                          }
    
#define OPENW(fptr, str)     {                                                 \
    if ( ( fptr = fopen (str, "w") ) == NULL ) {                               \
        fprintf (stderr, "%s: Cannot open %s\n", argv0, str);                  \
	die (1);                                                               \
    }                                                                          }
    
#define CLOSE(fptr)                { fclose (fptr); }

#define FUNCTIONAL "functional"
