diff options
Diffstat (limited to 'src/misc/util')
-rw-r--r-- | src/misc/util/abc_global.h | 133 | ||||
-rw-r--r-- | src/misc/util/module.make | 2 | ||||
-rw-r--r-- | src/misc/util/utilFile.c | 170 | ||||
-rw-r--r-- | src/misc/util/utilMem.c | 341 | ||||
-rw-r--r-- | src/misc/util/utilMem.h | 73 | ||||
-rw-r--r-- | src/misc/util/util_hack.h | 24 |
6 files changed, 722 insertions, 21 deletions
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h index 3c6ca9aa..aca9a509 100644 --- a/src/misc/util/abc_global.h +++ b/src/misc/util/abc_global.h @@ -24,10 +24,11 @@ //////////////////////////////////////////////////////////////////////// /// INCLUDES /// //////////////////////////////////////////////////////////////////////// - + #ifdef _WIN32 #define inline __inline // compatible with MS VS 6.0 #pragma warning(disable : 4152) // warning C4152: nonstandard extension, function/data pointer conversion in expression +#pragma warning(disable : 4200) // warning C4200: nonstandard extension used : zero-sized array in struct/union #pragma warning(disable : 4244) // warning C4244: '+=' : conversion from 'int ' to 'unsigned short ', possible loss of data #pragma warning(disable : 4514) // warning C4514: 'Vec_StrPop' : unreferenced inline function has been removed #pragma warning(disable : 4710) // warning C4710: function 'Vec_PtrGrow' not inlined @@ -51,13 +52,62 @@ #include <crtdbg.h> #endif +#if !defined(___unused) +#if defined(__GNUC__) +#define ___unused __attribute__ ((__unused__)) +#else +#define ___unused +#endif +#endif + +/* +#ifdef __cplusplus +#error "C++ code" +#else +#error "C code" +#endif +*/ + +#include <time.h> +#include <stdarg.h> + +#ifndef __cplusplus +typedef int bool; +#endif + //////////////////////////////////////////////////////////////////////// -/// PARAMETERS /// +/// NAMESPACES /// //////////////////////////////////////////////////////////////////////// +//#define ABC_NAMESPACE xxx + #ifdef __cplusplus -extern "C" { -#endif +# ifdef ABC_NAMESPACE +# define ABC_NAMESPACE_HEADER_START namespace ABC_NAMESPACE { +# define ABC_NAMESPACE_HEADER_END } +# define ABC_NAMESPACE_IMPL_START namespace ABC_NAMESPACE { +# define ABC_NAMESPACE_IMPL_END } +# define ABC_NAMESPACE_PREFIX ABC_NAMESPACE:: +# else +# define ABC_NAMESPACE_HEADER_START extern "C" { +# define ABC_NAMESPACE_HEADER_END } +# define ABC_NAMESPACE_IMPL_START +# define ABC_NAMESPACE_IMPL_END +# define ABC_NAMESPACE_PREFIX +# endif // #ifdef ABC_NAMESPACE +#else +# define ABC_NAMESPACE_HEADER_START +# define ABC_NAMESPACE_HEADER_END +# define ABC_NAMESPACE_IMPL_START +# define ABC_NAMESPACE_IMPL_END +# define ABC_NAMESPACE_PREFIX +#endif // #ifdef __cplusplus + +//////////////////////////////////////////////////////////////////////// +/// PARAMETERS /// +//////////////////////////////////////////////////////////////////////// + +ABC_NAMESPACE_HEADER_START //////////////////////////////////////////////////////////////////////// /// BASIC TYPES /// @@ -144,10 +194,13 @@ typedef unsigned __int64 ABC_UINT64_T; #error unknown platform #endif /* defined(PLATFORM) */ +typedef ABC_UINT64_T word; + //////////////////////////////////////////////////////////////////////// /// MACRO DEFINITIONS /// //////////////////////////////////////////////////////////////////////// + #define ABC_ABS(a) ((a) < 0 ? -(a) : (a)) #define ABC_MAX(a,b) ((a) > (b) ? (a) : (b)) #define ABC_MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -157,8 +210,8 @@ typedef unsigned __int64 ABC_UINT64_T; #define ABC_PRTr(a,t) (printf("%s = ", (a)), printf("%7.2f sec\r", (float)(t)/(float)(CLOCKS_PER_SEC))) #define ABC_PRTn(a,t) (printf("%s = ", (a)), printf("%6.2f sec ", (float)(t)/(float)(CLOCKS_PER_SEC))) #define ABC_PRTP(a,t,T) (printf("%s = ", (a)), printf("%7.2f sec (%6.2f %%)\n", (float)(t)/(float)(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0)) -#define ABC_PRM(a,f) (printf("%s = ", (a)), printf("%7.2f Mb ", 1.0*(f)/(1<<20))) - +#define ABC_PRM(a,f) (printf("%s = ", (a)), printf("%7.3f Mb ", 1.0*(f)/(1<<20))) +#define ABC_PRMP(a,f,F) (printf("%s = ", (a)), printf("%7.3f Mb (%6.2f %%) ", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) ) //#define ABC_USE_MEM_REC 1 @@ -171,7 +224,9 @@ typedef unsigned __int64 ABC_UINT64_T; ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \ ((type *) malloc(sizeof(type) * (num)))) #else +ABC_NAMESPACE_HEADER_END #include "utilMem.h" +ABC_NAMESPACE_HEADER_START #define ABC_ALLOC(type, num) ((type *) Util_MemRecAlloc(malloc(sizeof(type) * (num)))) #define ABC_CALLOC(type, num) ((type *) Util_MemRecAlloc(calloc((num), sizeof(type)))) #define ABC_FALLOC(type, num) ((type *) memset(Util_MemRecAlloc(malloc(sizeof(type) * (num))), 0xff, sizeof(type) * (num))) @@ -181,9 +236,71 @@ typedef unsigned __int64 ABC_UINT64_T; ((type *) Util_MemRecAlloc(malloc(sizeof(type) * (num))))) #endif -#ifdef __cplusplus + +enum Abc_VerbLevel +{ + ABC_PROMPT = -2, + ABC_ERROR = -1, + ABC_WARNING = 0, + ABC_STANDARD = 1, + ABC_VERBOSE = 2 +}; + +static inline void Abc_Print( int level, const char * format, ... ) +{ + va_list args; +// if ( level > -2 ) +// return; + if ( level == ABC_ERROR ) + printf( "Error: " ); + else if ( level == ABC_WARNING ) + printf( "Warning: " ); + va_start( args, format ); + vprintf( format, args ); + va_end( args ); +} + +static inline void Abc_PrintTime( int level, const char * pStr, int time ) +{ + if ( level == ABC_ERROR ) + printf( "Error: " ); + else if ( level == ABC_WARNING ) + printf( "Warning: " ); + ABC_PRT( pStr, time ); } -#endif + +static inline void Abc_PrintTimeP( int level, const char * pStr, int time, int Time ) +{ + if ( level == ABC_ERROR ) + printf( "Error: " ); + else if ( level == ABC_WARNING ) + printf( "Warning: " ); + ABC_PRTP( pStr, time, Time ); +} + +static inline void Abc_PrintMemoryP( int level, const char * pStr, int time, int Time ) +{ + if ( level == ABC_ERROR ) + printf( "Error: " ); + else if ( level == ABC_WARNING ) + printf( "Warning: " ); + ABC_PRMP( pStr, time, Time ); +} + + +// sequential counter-example +typedef struct Abc_Cex_t_ Abc_Cex_t; +struct Abc_Cex_t_ +{ + int iPo; // the zero-based number of PO, for which verification failed + int iFrame; // the zero-based number of the time-frame, for which verificaiton failed + int nRegs; // the number of registers in the miter + int nPis; // the number of primary inputs in the miter + int nBits; // the number of words of bit data used + unsigned pData[0]; // the cex bit data (the number of bits: nRegs + (iFrame+1) * nPis) +}; + +ABC_NAMESPACE_HEADER_END #endif diff --git a/src/misc/util/module.make b/src/misc/util/module.make index d6d908e7..11d59f51 100644 --- a/src/misc/util/module.make +++ b/src/misc/util/module.make @@ -1 +1 @@ -SRC += +SRC += utilFile.c diff --git a/src/misc/util/utilFile.c b/src/misc/util/utilFile.c new file mode 100644 index 00000000..abdcd635 --- /dev/null +++ b/src/misc/util/utilFile.c @@ -0,0 +1,170 @@ +/**CFile**************************************************************** + + FileName [utilFile.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Temporary file utilities.] + + Synopsis [Temporary file utilities.] + + Author [Niklas Een] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - September 29, 2010.] + + Revision [$Id: utilFile.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <sys/stat.h> + +#include "abc_global.h" + +ABC_NAMESPACE_IMPL_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +#if defined(_MSC_VER) + +#include <Windows.h> +#include <process.h> +#include <io.h> + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static ABC_UINT64_T realTimeAbs() // -- absolute time in nano-seconds +{ + LARGE_INTEGER f, t; + double realTime_freq; + int ok; + + ok = QueryPerformanceFrequency(&f); assert(ok); + realTime_freq = 1.0 / (__int64)(((ABC_UINT64_T)f.LowPart) | ((ABC_UINT64_T)f.HighPart << 32)); + + ok = QueryPerformanceCounter(&t); assert(ok); + return (ABC_UINT64_T)(__int64)(((__int64)(((ABC_UINT64_T)t.LowPart | ((ABC_UINT64_T)t.HighPart << 32))) * realTime_freq * 1000000000)); +} + +#endif + + + +// Opens a temporary file with given prefix and returns file descriptor (-1 on failure) +// and a string containing the name of the file (to be freed by caller). + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int tmpFile(const char* prefix, const char* suffix, char** out_name) +{ +#if !defined(_MSC_VER) + int fd; + + *out_name = (char*)malloc(strlen(prefix) + strlen(suffix) + 7); + assert(*out_name != NULL); + sprintf(*out_name, "%sXXXXXX", prefix); + fd = mkstemp(*out_name); + if (fd == -1){ + free(*out_name); + *out_name = NULL; + }else{ + // Kludge: + close(fd); + unlink(*out_name); + strcat(*out_name, suffix); + fd = open(fd); + if (fd == -1){ + free(*out_name); + *out_name = NULL; + } + } + return fd; + +#else + int i, fd; + *out_name = (char*)malloc(strlen(prefix) + strlen(suffix) + 27); + for (i = 0; i < 10; i++){ + sprintf(*out_name, "%s%I64X%d%s", prefix, realTimeAbs(), _getpid(), suffix); + fd = _open(*out_name, O_CREAT | O_EXCL | O_BINARY | O_RDWR, _S_IREAD | _S_IWRITE); + if (fd == -1){ + free(*out_name); + *out_name = NULL; + } + return fd; + } + assert(0); // -- could not open temporary file + return 0; +#endif +} + + +//mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm + + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +/* +int main(int argc, char** argv) +{ + char* tmp_filename; + int fd = tmpFile("__abctmp_", &tmp_filename); + FILE* out = fdopen(fd, "wb"); + + fprintf(out, "This file contains important information.\n"); + fclose(out); + + printf("Created: %s\n", tmp_filename); + free(tmp_filename); + + return 0; +} +*/ + + + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + diff --git a/src/misc/util/utilMem.c b/src/misc/util/utilMem.c new file mode 100644 index 00000000..0bce119b --- /dev/null +++ b/src/misc/util/utilMem.c @@ -0,0 +1,341 @@ +/**CFile**************************************************************** + + FileName [utilMem.c] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Memory recycling utilities.] + + Synopsis [Memory recycling utilities.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: utilMem.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <assert.h> + +#include "abc_global.h" + +ABC_NAMESPACE_IMPL_START + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + + +typedef struct Vec_Mem_t_ Vec_Mem_t; +struct Vec_Mem_t_ +{ + int nCap; + int nSize; + void ** pArray; +}; + +void * s_vAllocs = NULL; +void * s_vFrees = NULL; +int s_fInterrupt = 0; + +#define ABC_MEM_ALLOC(type, num) ((type *) malloc(sizeof(type) * (num))) +#define ABC_MEM_CALLOC(type, num) ((type *) calloc((num), sizeof(type))) +#define ABC_MEM_FALLOC(type, num) ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num))) +#define ABC_MEM_FREE(obj) ((obj) ? (free((char *) (obj)), (obj) = 0) : 0) +#define ABC_MEM_REALLOC(type, obj, num) \ + ((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \ + ((type *) malloc(sizeof(type) * (num)))) + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Allocates a vector with the given capacity.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline Vec_Mem_t * Vec_MemAlloc( int nCap ) +{ + Vec_Mem_t * p; + p = ABC_MEM_ALLOC( Vec_Mem_t, 1 ); + if ( nCap > 0 && nCap < 8 ) + nCap = 8; + p->nSize = 0; + p->nCap = nCap; + p->pArray = p->nCap? ABC_MEM_ALLOC( void *, p->nCap ) : NULL; + return p; +} + +/**Function************************************************************* + + Synopsis [Frees the vector.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_MemFree( Vec_Mem_t * p ) +{ + ABC_MEM_FREE( p->pArray ); + ABC_MEM_FREE( p ); +} + +/**Function************************************************************* + + Synopsis [Resizes the vector to the given capacity.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_MemGrow( Vec_Mem_t * p, int nCapMin ) +{ + if ( p->nCap >= nCapMin ) + return; + p->pArray = ABC_MEM_REALLOC( void *, p->pArray, nCapMin ); + p->nCap = nCapMin; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_MemPush( Vec_Mem_t * p, void * Entry ) +{ + if ( p->nSize == p->nCap ) + { + if ( p->nCap < 16 ) + Vec_MemGrow( p, 16 ); + else + Vec_MemGrow( p, 2 * p->nCap ); + } + p->pArray[p->nSize++] = Entry; +} + +/**Function************************************************************* + + Synopsis [Sorting the entries by their integer value.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static void Vec_MemSort( Vec_Mem_t * p, int (*Vec_MemSortCompare)() ) +{ + if ( p->nSize < 2 ) + return; + qsort( (void *)p->pArray, p->nSize, sizeof(void *), + (int (*)(const void *, const void *)) Vec_MemSortCompare ); +} + + +/**Function************************************************************* + + Synopsis [Remembers an allocated pointer.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void * Util_MemRecAlloc( void * pMem ) +{ + if ( s_vAllocs ) + Vec_MemPush( (Vec_Mem_t *)s_vAllocs, pMem ); + return pMem; +} + +/**Function************************************************************* + + Synopsis [Remembers a deallocated pointer.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void * Util_MemRecFree( void * pMem ) +{ + if ( s_vFrees ) + Vec_MemPush( (Vec_Mem_t *)s_vFrees, pMem ); + return pMem; +} + +/**Function************************************************************* + + Synopsis [Procedure used for sorting the nodes in decreasing order of levels.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Util_ComparePointers( void ** pp1, void ** pp2 ) +{ + if ( *pp1 < *pp2 ) + return -1; + if ( *pp1 > *pp2 ) + return 1; + return 0; +} + +/**Function************************************************************* + + Synopsis [Finds entries that do not appear in both lists.] + + Description [Assumes that the vectors are sorted in the increasing order.] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline Vec_Mem_t * Vec_MemTwoMerge( Vec_Mem_t * vArr1, Vec_Mem_t * vArr2 ) +{ + Vec_Mem_t * vArr = Vec_MemAlloc( vArr1->nSize + vArr2->nSize ); + void ** pBeg = vArr->pArray; + void ** pBeg1 = vArr1->pArray; + void ** pBeg2 = vArr2->pArray; + void ** pEnd1 = vArr1->pArray + vArr1->nSize; + void ** pEnd2 = vArr2->pArray + vArr2->nSize; + while ( pBeg1 < pEnd1 && pBeg2 < pEnd2 ) + { + if ( *pBeg1 == *pBeg2 ) + pBeg1++, pBeg2++; + else if ( *pBeg1 < *pBeg2 ) + { + free( *pBeg1 ); + *pBeg++ = *pBeg1++; + } + else + assert( 0 ); +// *pBeg++ = *pBeg2++; + } + while ( pBeg1 < pEnd1 ) + *pBeg++ = *pBeg1++; +// while ( pBeg2 < pEnd2 ) +// *pBeg++ = *pBeg2++; + assert( pBeg2 >= pEnd2 ); + vArr->nSize = pBeg - vArr->pArray; + assert( vArr->nSize <= vArr->nCap ); + assert( vArr->nSize >= vArr1->nSize ); + assert( vArr->nSize >= vArr2->nSize ); + return vArr; +} + +/**Function************************************************************* + + Synopsis [Recycles the accumulated memory.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Util_MemRecRecycle() +{ + Vec_Mem_t * vMerge; + assert( s_vAllocs == NULL ); + assert( s_vFrees == NULL ); + Vec_MemSort( (Vec_Mem_t *)s_vAllocs, (int (*)())Util_ComparePointers ); + Vec_MemSort( (Vec_Mem_t *)s_vFrees, (int (*)())Util_ComparePointers ); + vMerge = (Vec_Mem_t *)Vec_MemTwoMerge( (Vec_Mem_t *)s_vAllocs, (Vec_Mem_t *)s_vFrees ); + Vec_MemFree( vMerge ); +} + +/**Function************************************************************* + + Synopsis [Starts memory structures.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Util_MemRecStart() +{ + assert( s_vAllocs == NULL && s_vFrees == NULL ); + s_vAllocs = Vec_MemAlloc( 1000 ); + s_vFrees = Vec_MemAlloc( 1000 ); +} + +/**Function************************************************************* + + Synopsis [Quits memory structures.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Util_MemRecQuit() +{ + assert( s_vAllocs != NULL && s_vFrees != NULL ); + Vec_MemFree( (Vec_Mem_t *)s_vAllocs ); + Vec_MemFree( (Vec_Mem_t *)s_vFrees ); +} + +/**Function************************************************************* + + Synopsis [Starts memory structures.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Util_MemRecIsSet() +{ + return s_vAllocs != NULL && s_vFrees != NULL; +} + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + +ABC_NAMESPACE_IMPL_END + diff --git a/src/misc/util/utilMem.h b/src/misc/util/utilMem.h new file mode 100644 index 00000000..1f8432c1 --- /dev/null +++ b/src/misc/util/utilMem.h @@ -0,0 +1,73 @@ +/**CFile**************************************************************** + + FileName [utilInt.h] + + SystemName [ABC: Logic synthesis and verification system.] + + PackageName [Memory recycling utilities.] + + Synopsis [Internal declarations.] + + Author [Alan Mishchenko] + + Affiliation [UC Berkeley] + + Date [Ver. 1.0. Started - June 20, 2005.] + + Revision [$Id: utilInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $] + +***********************************************************************/ + +#ifndef __UTIL_INT_H__ +#define __UTIL_INT_H__ + + +//////////////////////////////////////////////////////////////////////// +/// INCLUDES /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// PARAMETERS /// +//////////////////////////////////////////////////////////////////////// + + + +ABC_NAMESPACE_HEADER_START + + +extern void * s_vAllocs; // storage of allocated pointers +extern void * s_vFrees; // storage of deallocated pointers +extern int s_fInterrupt; // set to 1 when it is time to backout + +//////////////////////////////////////////////////////////////////////// +/// BASIC TYPES /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// MACRO DEFINITIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +/*=== utilMem.c ==========================================================*/ +extern void * Util_MemRecAlloc( void * pMem ); +extern void * Util_MemRecFree( void * pMem ); +extern void Util_MemStart(); +extern void Util_MemQuit(); +extern void Util_MemRecycle(); +extern int Util_MemRecIsSet(); + + + +ABC_NAMESPACE_HEADER_END + + + +#endif + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + diff --git a/src/misc/util/util_hack.h b/src/misc/util/util_hack.h index 33fb6c6b..f7ad89f9 100644 --- a/src/misc/util/util_hack.h +++ b/src/misc/util/util_hack.h @@ -21,17 +21,19 @@ #ifndef __UTIL_HACK_H__ #define __UTIL_HACK_H__ + #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <time.h> #include <math.h> + #include "abc_global.h" -#ifdef __cplusplus -extern "C" { -#endif + +ABC_NAMESPACE_HEADER_START + #ifndef EXTERN #define EXTERN extern @@ -54,17 +56,13 @@ extern "C" { #define util_optind globalUtilOptind #ifndef ARGS -# ifdef __STDC__ -# define ARGS(args) args -# else -# define ARGS(args) () -# endif +#define ARGS(protos) protos #endif extern long Extra_CpuTime(); extern int Extra_GetSoftDataLimit(); extern void Extra_UtilGetoptReset(); -extern int Extra_UtilGetopt( int argc, char *argv[], char *optstring ); +extern int Extra_UtilGetopt( int argc, char *argv[], const char *optstring ); extern char * Extra_UtilPrintTime( long t ); extern char * Extra_UtilStrsav( char *s ); extern char * Extra_UtilTildeExpand( char *fname ); @@ -73,8 +71,10 @@ extern char * Extra_UtilFileSearch( char *file, char *path, char *mode ); extern char * globalUtilOptarg; extern int globalUtilOptind; -#ifdef __cplusplus -} -#endif + + +ABC_NAMESPACE_HEADER_END + + #endif |