diff --git a/CMakeLists.txt b/CMakeLists.txt index 48593b88..8dd2f63d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if (CMAKE_VERSION GREATER_EQUAL 3.12) cmake_policy(SET CMP0075 NEW) endif (CMAKE_VERSION GREATER_EQUAL 3.12) -project(musrfit VERSION 1.7.2 LANGUAGES C CXX) +project(musrfit VERSION 1.7.3 LANGUAGES C CXX) #--- musrfit specific options ------------------------------------------------- option(nexus "build optional NeXus support. Needed for ISIS" OFF) diff --git a/ChangeLog b/ChangeLog index e32b9ab4..7eea47d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,12 @@ or https://bitbucket.org/muonspin/musrfit/commits/all +Release of V1.7.3, 2021/06/01 +============================= + +making musrfit Apple Silicon M1 ready. Currently there is still an open issue +with NeXus. + Release of V1.7.2, 2021/04/16 ============================= diff --git a/src/external/mud/src/mud.c b/src/external/mud/src/mud.c index a53c62ef..bb76ee2b 100644 --- a/src/external/mud/src/mud.c +++ b/src/external/mud/src/mud.c @@ -23,10 +23,10 @@ * v1.2 08-Oct-2000 [D. Arseneau] Add MUD_setSizes * v1.3 22-Apr-2003 [D. Arseneau] Add MUD_openInOut * 25-Nov-2009 [D. Arseneau] Handle larger size_t + * 04-May-2016 [D. Arseneau] Edits for C++ use */ -#include #include "mud.h" #ifdef NO_STDARG @@ -35,11 +35,10 @@ #include #endif /* NO_STDARG */ -/* #define DEBUG 1 /* un-comment for debug */ +/* #define DEBUG 1 */ /* un-comment for debug */ FILE* -MUD_openInput( inFile ) - char* inFile; +MUD_openInput( char* inFile ) { FILE* fin; @@ -53,8 +52,7 @@ MUD_openInput( inFile ) /* This is the same as MUD_openInput except for access mode */ FILE* -MUD_openInOut( inFile ) - char* inFile; +MUD_openInOut( char* inFile ) { FILE* fin; @@ -68,8 +66,7 @@ MUD_openInOut( inFile ) FILE* -MUD_openOutput( outFile ) - char* outFile; +MUD_openOutput( char* outFile ) { FILE* fout; @@ -83,8 +80,7 @@ MUD_openOutput( outFile ) void -MUD_free( pMUD ) - void* pMUD; +MUD_free( void* pMUD ) { if( pMUD != NULL ) MUD_free( ((MUD_SEC*)pMUD)->core.pNext ); else return; @@ -101,10 +97,7 @@ MUD_free( pMUD ) BOOL -MUD_encode( pBuf, pMUD, io_opt ) - BUF* pBuf; - void* pMUD; - MUD_IO_OPT io_opt; +MUD_encode( BUF* pBuf, void* pMUD, MUD_IO_OPT io_opt ) { if( pMUD == NULL ) return( TRUE ); @@ -130,7 +123,7 @@ MUD_encode( pBuf, pMUD, io_opt ) printf( "MUD_encode: buf.buf = %08X\n", pBuf->buf ); #endif /* DEBUG */ - MUD_CORE_proc( MUD_ENCODE, pBuf, pMUD ); + MUD_CORE_proc( MUD_ENCODE, pBuf, (MUD_SEC*)pMUD ); (*((MUD_SEC*)pMUD)->core.proc)( MUD_ENCODE, pBuf, (void*)pMUD ); if( ( MUD_secID( pMUD ) == MUD_SEC_GRP_ID ) && @@ -155,8 +148,7 @@ MUD_encode( pBuf, pMUD, io_opt ) void* -MUD_decode( pBuf ) - BUF* pBuf; +MUD_decode( BUF* pBuf ) { MUD_SEC* pMUD; MUD_SEC mud; @@ -199,23 +191,20 @@ MUD_decode( pBuf ) int -MUD_getSize( pMUD ) - void* pMUD; +MUD_getSize( void* pMUD ) { - return( MUD_CORE_proc( MUD_GET_SIZE, NULL, pMUD ) + - (*((MUD_SEC*)pMUD)->core.proc)( MUD_GET_SIZE, NULL, (void*)pMUD ) ); + return( MUD_CORE_proc( MUD_GET_SIZE, NULL, (MUD_SEC*)pMUD ) + + (*((MUD_SEC*)pMUD)->core.proc)( MUD_GET_SIZE, NULL, pMUD ) ); } void -MUD_show( pMUD, io_opt ) - void* pMUD; - MUD_IO_OPT io_opt; +MUD_show( void* pMUD, MUD_IO_OPT io_opt ) { if( pMUD == NULL ) return; - MUD_CORE_proc( MUD_SHOW, NULL, pMUD ); - (*((MUD_SEC*)pMUD)->core.proc)( MUD_SHOW, NULL, (void*)pMUD ); + MUD_CORE_proc( MUD_SHOW, NULL, (MUD_SEC*)pMUD ); + (*((MUD_SEC*)pMUD)->core.proc)( MUD_SHOW, NULL, pMUD ); printf( "\n" ); @@ -233,14 +222,12 @@ MUD_show( pMUD, io_opt ) } void -MUD_heads( pMUD, io_opt ) - void* pMUD; - MUD_IO_OPT io_opt; +MUD_heads( void* pMUD, MUD_IO_OPT io_opt ) { if( pMUD == NULL ) return; - MUD_CORE_proc( MUD_HEADS, NULL, pMUD ); - (*((MUD_SEC*)pMUD)->core.proc)( MUD_HEADS, NULL, (void*)pMUD ); + MUD_CORE_proc( MUD_HEADS, NULL, (MUD_SEC*)pMUD ); + (*((MUD_SEC*)pMUD)->core.proc)( MUD_HEADS, NULL, pMUD ); if( ( MUD_secID( pMUD ) == MUD_SEC_GRP_ID ) && ( io_opt == MUD_ALL ) ) @@ -260,8 +247,7 @@ MUD_heads( pMUD, io_opt ) * MUD_writeEnd() - called after all writes to file */ BOOL -MUD_writeEnd( fout ) - FILE* fout; +MUD_writeEnd( FILE* fout ) { MUD_SEC_EOF* pMUD_eof; @@ -282,9 +268,7 @@ MUD_writeEnd( fout ) * MUD_writeFile() - use for completely assembled groups/sections */ BOOL -MUD_writeFile( fout, pMUD_head ) - FILE* fout; - void* pMUD_head; +MUD_writeFile( FILE* fout, void* pMUD_head ) { rewind( fout ); if( !MUD_write( fout, pMUD_head, MUD_ALL ) ) return( FALSE ); @@ -296,10 +280,7 @@ MUD_writeFile( fout, pMUD_head ) * MUD_write() - use for completely assembled groups/sections */ BOOL -MUD_write( fout, pMUD, io_opt ) - FILE* fout; - void* pMUD; - MUD_IO_OPT io_opt; +MUD_write( FILE* fout, void* pMUD, MUD_IO_OPT io_opt ) { BUF buf; @@ -328,12 +309,8 @@ MUD_write( fout, pMUD, io_opt ) * MUD_writeEnd() */ BOOL -MUD_writeGrpStart( fout, pMUD_parentGrp, - pMUD_grp, numMems ) - FILE* fout; - MUD_SEC_GRP* pMUD_parentGrp; - MUD_SEC_GRP* pMUD_grp; - int numMems; +MUD_writeGrpStart( FILE* fout, MUD_SEC_GRP* pMUD_parentGrp, + MUD_SEC_GRP* pMUD_grp, int numMems ) { pMUD_grp->pParent = pMUD_parentGrp; @@ -352,9 +329,7 @@ MUD_writeGrpStart( fout, pMUD_parentGrp, void -addIndex( pMUD_grp, pMUD ) - MUD_SEC_GRP* pMUD_grp; - void* pMUD; +addIndex( MUD_SEC_GRP* pMUD_grp, void* pMUD ) { MUD_INDEX** ppMUD_index; @@ -373,10 +348,7 @@ addIndex( pMUD_grp, pMUD ) * MUD_writeGrpMem() - use for writes of unassembled groups */ BOOL -MUD_writeGrpMem( fout, pMUD_grp, pMUD ) - FILE* fout; - MUD_SEC_GRP* pMUD_grp; - void* pMUD; +MUD_writeGrpMem( FILE* fout, MUD_SEC_GRP* pMUD_grp, void* pMUD ) { ((MUD_SEC*)pMUD)->core.size = MUD_getSize( pMUD ); @@ -401,9 +373,7 @@ MUD_writeGrpMem( fout, pMUD_grp, pMUD ) * MUD_writeGrpEnd() - use for writes of unassembled groups */ BOOL -MUD_writeGrpEnd( fout, pMUD_grp ) - FILE* fout; - MUD_SEC_GRP* pMUD_grp; +MUD_writeGrpEnd( FILE* fout, MUD_SEC_GRP* pMUD_grp ) { int pos; @@ -425,8 +395,7 @@ MUD_writeGrpEnd( fout, pMUD_grp ) void* -MUD_readFile( fin ) - FILE* fin; +MUD_readFile( FILE* fin ) { rewind( fin ); @@ -435,9 +404,7 @@ MUD_readFile( fin ) void* -MUD_read( fin, io_opt ) - FILE* fin; - MUD_IO_OPT io_opt; +MUD_read( FILE* fin, MUD_IO_OPT io_opt ) { BUF buf; MUD_SEC* pMUD_new; @@ -455,11 +422,13 @@ MUD_read( fin, io_opt ) */ if( ( pos = ftell( fin ) ) == EOF ) return( NULL ); if( fread( &size, 4, 1, fin ) == 0 ) return( NULL ); +#if !defined(__arm64) bdecode_4( &size, &size ); /* byte ordering !!! */ +#endif // !defined(__arm64) if( fseek( fin, pos, 0 ) == EOF ) return( NULL ); #ifdef DEBUG - printf( "MUD_read: got %d\n", size ); + printf( "MUD_read: got %lu\n", (unsigned long)(size) ); printf( " pos = %d\n", pos ); printf( " reading the section ...\n" ); #endif /* DEBUG */ @@ -572,8 +541,7 @@ MUD_read( fin, io_opt ) */ UINT32 -MUD_setSizes( pMUD ) - void* pMUD; +MUD_setSizes( void* pMUD ) { MUD_SEC* pMember; MUD_INDEX* pGrpIndex; @@ -624,8 +592,7 @@ MUD_setSizes( pMUD ) MUD_SEC* -MUD_peekCore( fin ) - FILE* fin; +MUD_peekCore( FILE* fin ) { static MUD_SEC mud; int pos; @@ -847,12 +814,8 @@ MUD_fseek( FILE* fio, ... ) MUD_SEC* -fseekNext( fio, pMUD_parent, - secID, instanceID ) - FILE* fio; - MUD_SEC_GRP* pMUD_parent; - UINT32 secID; - UINT32 instanceID; +fseekNext( FILE* fio, MUD_SEC_GRP* pMUD_parent, + UINT32 secID, UINT32 instanceID ) { MUD_SEC* pMUD; MUD_INDEX* pMUD_index; @@ -920,8 +883,7 @@ fseekNext( fio, pMUD_parent, int -MUD_fseekFirst( fio ) - FILE* fio; +MUD_fseekFirst( FILE* fio ) { int size; @@ -935,9 +897,7 @@ MUD_fseekFirst( fio ) void -MUD_add( ppMUD_head, pMUD_new ) - void** ppMUD_head; - void* pMUD_new; +MUD_add( void** ppMUD_head, void* pMUD_new ) { MUD_SEC** ppMUD; @@ -952,8 +912,7 @@ MUD_add( ppMUD_head, pMUD_new ) int -MUD_totSize( pMUD ) - void* pMUD; +MUD_totSize( void* pMUD ) { return( ( MUD_secID( pMUD ) == MUD_SEC_GRP_ID ) ? MUD_size( pMUD ) + ((MUD_SEC_GRP*)pMUD)->memSize : @@ -962,14 +921,13 @@ MUD_totSize( pMUD ) void -MUD_addToGroup( pMUD_grp, pMUD ) - MUD_SEC_GRP* pMUD_grp; - void* pMUD; +MUD_addToGroup( MUD_SEC_GRP* pMUD_grp, void* pMUD ) { MUD_SEC** ppMUD; if( pMUD == NULL ) return; + /* possible addition: ((MUD_SEC*)pMUD)->core.pNext = NULL; */ ((MUD_SEC*)pMUD)->core.size = MUD_getSize( pMUD ); for( ppMUD = &pMUD_grp->pMem; @@ -985,9 +943,7 @@ MUD_addToGroup( pMUD_grp, pMUD ) void -MUD_assignCore( pMUD1, pMUD2 ) - MUD_SEC* pMUD1; - MUD_SEC* pMUD2; +MUD_assignCore( MUD_SEC* pMUD1, MUD_SEC* pMUD2 ) { bcopy( &pMUD1->core.size, &pMUD2->core.size, MUD_CORE_proc( MUD_GET_SIZE, NULL, NULL ) ); @@ -995,10 +951,7 @@ MUD_assignCore( pMUD1, pMUD2 ) int -MUD_CORE_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC* pMUD; +MUD_CORE_proc( MUD_OPT op, BUF* pBuf, MUD_SEC* pMUD ) { int size; @@ -1019,12 +972,13 @@ MUD_CORE_proc( op, pBuf, pMUD ) case MUD_GET_SIZE: size = 3*sizeof(UINT32); #ifdef DEBUG - printf("MUD_CORE_proc: MUD_GET_SIZE returns size=%d\n",size); + printf("MUD_CORE_proc: MUD_GET_SIZE returns size=%d\n",size); #endif /* DEBUG */ return( size ); case MUD_SHOW: - printf( " CORE: size=[%ld], secID=[0x%08lX], instanceID=[0x%08lX]\n", - pMUD->core.size, pMUD->core.secID, pMUD->core.instanceID ); + printf( " CORE: size=[%lu], secID=[0x%08lX], instanceID=[0x%08lX]\n", + (unsigned long)(pMUD->core.size), (unsigned long)(pMUD->core.secID), + (unsigned long)(pMUD->core.instanceID) ); break; case MUD_HEADS: break; @@ -1034,10 +988,7 @@ MUD_CORE_proc( op, pBuf, pMUD ) int -MUD_INDEX_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_INDEX* pMUD; +MUD_INDEX_proc( MUD_OPT op, BUF* pBuf, MUD_INDEX* pMUD ) { int size; @@ -1065,8 +1016,9 @@ MUD_INDEX_proc( op, pBuf, pMUD ) size = 3*sizeof(UINT32); return( size ); case MUD_SHOW: - printf( " INDEX: offset=[%ld], secID=[0x%08lX], instanceID=[0x%08lX]\n", - pMUD->offset, pMUD->secID, pMUD->instanceID ); + printf( " INDEX: offset=[%lu], secID=[0x%08lX], instanceID=[0x%08lX]\n", + (unsigned long)(pMUD->offset), (unsigned long)(pMUD->secID), + (unsigned long)(pMUD->instanceID) ); break; case MUD_HEADS: break; diff --git a/src/external/mud/src/mud.h b/src/external/mud/src/mud.h index 3351c82d..0b4a355f 100644 --- a/src/external/mud/src/mud.h +++ b/src/external/mud/src/mud.h @@ -1,19 +1,39 @@ #ifndef _MUD_H_ #define _MUD_H_ - -#ifdef __cplusplus -extern "C" { -#endif - /* - * v1.2 + * mud.h Declarations for MUD + * v1.3 + * + * Copyright (C) 1994-2021 TRIUMF (Vancouver, Canada) + * + * Authors: T. Whidden, D. Arseneau, S. Daviel + * + * Released under the GNU LGPL - see http://www.gnu.org/licenses + * + * This program is free software; you can distribute it and/or modify it under + * the terms of the Lesser GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or any later version. + * Accordingly, this program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public License + * for more details. * * revisions: * 01-mar-2000 DJA add UNKNOWN section, with no ID * 11-oct-2000 DJA add MUD_FMT_RAL_ID; MUD_setSizes * 22-Apr-2003 DJA add MUD_openReadWrite, MUD_openInOut + * 25-Nov-2009 DJA 64-bit linux + * 25-Jun-2017 DJA Allow use in C++ (ROOT); shared lib. + * 14-Aug-2019 DJA Use stdint.h, casts in printf */ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __CINT__ +typedef char* caddr_t; +#endif /* __CINT __ */ + /* * FORMAT IDs - Must be unique! * format of ID is: 0xLLFFSSSS @@ -94,31 +114,49 @@ extern "C" { #include #include +#ifndef NOSTDINT +/* If there is no stdint.h, define NOSTDINT, as with "make NOSTDINT=1" */ +#include +#endif + /* * MUD types */ + +#ifdef _STDINT_H +typedef int STATUS; +typedef int8_t INT8; +typedef uint8_t UINT8; +typedef int16_t INT16; +typedef uint16_t UINT16; +typedef int32_t INT32; +typedef uint32_t UINT32; +typedef float REAL32; +typedef double REAL64; +#else /*no stding.h */ typedef int STATUS; typedef char INT8; typedef unsigned char UINT8; typedef short INT16; typedef unsigned short UINT16; -#if defined(__alpha) || defined(__x86_64__) || defined(__amd64) || defined(__ia64) +#if defined(__alpha) || defined(__linux) || defined(__MACH__) || defined(__arm64) typedef int INT32; typedef unsigned int UINT32; #else typedef long INT32; typedef unsigned long UINT32; -#endif /* defined(__alpha) || defined(__x86_64__) || defined(__amd64) || defined(__ia64) */ +#endif /* __alpha || __linux || __MACH__*/ typedef float REAL32; typedef double REAL64; +#if (defined(__alpha)&&defined(vms)) || defined(__BORLANDC__) || defined(__TURBOC__) +typedef char* caddr_t; +#endif +#endif /* _STDINT_HNOSTDINT */ typedef UINT32 TIME; #ifndef BOOL_DEFINED #define BOOL_DEFINED typedef UINT32 BOOL; #endif -#if (defined(__alpha)&&defined(vms)) || defined(__BORLANDC__) || defined(__TURBOC__) -typedef char* caddr_t; -#endif #ifndef FALSE #define FALSE 0 @@ -146,10 +184,10 @@ typedef char* caddr_t; /* * c_utils.h, Defines for C utilities */ -#if defined(vms) || defined(__MSDOS__) || defined(_MSC_VER) +#if defined(vms) || defined(__MSDOS__) #define bcopy( b1, b2, len ) memcpy(b2,b1,len) #define bzero( b, len ) memset(b,(char)0,len) -#endif /* vms || __MSDOS__ || _MSC_VER */ +#endif /* vms || __MSDOS__ */ #ifndef _C_UTILS_H_ /* conflict with c_utils.h */ #define _max( a, b ) ( ( (a) > (b) ) ? (a) : (b) ) #define _min( a, b ) ( ( (a) < (b) ) ? (a) : (b) ) @@ -157,11 +195,12 @@ typedef char* caddr_t; #define _swap32( l ) (((UINT32)l>>16)+((UINT32)l<<16)) #define _swap16( s ) (((UINT16)s>>8)+((UINT16)s<<8)) #endif -#define _free(objp) if(objp!=NULL){free(objp);objp=NULL;} -#define _roundUp( n, r ) ( (r) * (int)( ((n)+(r)-1) / (r) ) ) + +#define _free(objp) if((void*)(objp)!=(void*)NULL){free((void*)(objp));objp=NULL;} +#define _roundUp( n, r ) ( (r) * (int)( ((n)+(r)-1) / (r) ) ) #define zalloc( n ) memset((void*)malloc(n),0,n) -#if defined(vms) || (defined(mips)&&!defined(__sgi)) || ((defined(__MSDOS__) || defined(_MSC_VER))&&defined(__STDC__)) +#if defined(vms) || (defined(mips)&&!defined(__sgi)) || (defined(__MSDOS__)&&defined(__STDC__)) #define strdup( s ) strcpy((char*)malloc(strlen(s)+1),s) #endif /* vms || mips&&!sgi */ /*#endif */ @@ -388,8 +427,7 @@ typedef struct { #define MUD_instanceID( pM ) (((MUD_SEC*)pM)->core.instanceID) -#if defined(__MSDOS__) || defined(__i386__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(__alpha) || defined(__x86_64__) || defined(__amd64) \ - || (defined(__mips)&&!defined(__sgi)) +#if defined(__MSDOS__) || defined(__i386__) || defined(__i586__) || defined(__i686__) || defined(vax) || defined(__alpha) || defined(__amd64) || defined(__arm64) || (defined(__mips)&&!defined(__sgi)) #define MUD_LITTLE_ENDIAN 1 #else #define MUD_BIG_ENDIAN 1 @@ -524,9 +562,9 @@ int MUD_SEC_GEN_HIST_unpack _ANSI_ARGS_(( int num , int inBinSize , void* inHist int MUD_SEC_TRI_TI_RUN_DESC_proc _ANSI_ARGS_(( MUD_OPT op , BUF *pBuf , MUD_SEC_TRI_TI_RUN_DESC *pMUD )); /* gmf_time.c */ -void GMF_MKTIME _ANSI_ARGS_(( time_t* out , INT32* input )); -void GMF_TIME _ANSI_ARGS_(( time_t* out )); -void GMF_LOCALTIME _ANSI_ARGS_(( time_t* in , INT32 *out )); +void GMF_MKTIME _ANSI_ARGS_(( TIME* out , INT32* input )); +void GMF_TIME _ANSI_ARGS_(( TIME* out )); +void GMF_LOCALTIME _ANSI_ARGS_(( TIME* in , INT32 *out )); /* mud_friendly.c */ int MUD_openRead _ANSI_ARGS_(( char* filename, UINT32* pType )); diff --git a/src/external/mud/src/mud_all.c b/src/external/mud/src/mud_all.c index 085a8608..94de922b 100644 --- a/src/external/mud/src/mud_all.c +++ b/src/external/mud/src/mud_all.c @@ -27,13 +27,8 @@ int -MUD_SEC_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC* pMUD; +MUD_SEC_proc( MUD_OPT op, BUF* pBuf, MUD_SEC* pMUD ) { - int size; - switch( op ) { case MUD_FREE: @@ -55,13 +50,8 @@ MUD_SEC_proc( op, pBuf, pMUD ) int -MUD_SEC_EOF_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_EOF* pMUD; +MUD_SEC_EOF_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_EOF* pMUD ) { - int size; - switch( op ) { case MUD_FREE: @@ -83,10 +73,7 @@ MUD_SEC_EOF_proc( op, pBuf, pMUD ) int -MUD_SEC_FIXED_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_FIXED* pMUD; +MUD_SEC_FIXED_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_FIXED* pMUD ) { int size; @@ -106,8 +93,8 @@ MUD_SEC_FIXED_proc( op, pBuf, pMUD ) size = 2*sizeof( UINT32 ); return( size ); case MUD_SHOW: - printf( " MUD_SEC_FIXED: fileSize=[%ld], formatID=[0x%08lX]\n", - pMUD->fileSize, pMUD->formatID ); + printf( " MUD_SEC_FIXED: fileSize=[%lu], formatID=[0x%08lX]\n", + (unsigned long)(pMUD->fileSize), (unsigned long)(pMUD->formatID) ); break; case MUD_HEADS: break; @@ -117,10 +104,7 @@ MUD_SEC_FIXED_proc( op, pBuf, pMUD ) int -MUD_SEC_GRP_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GRP* pMUD; +MUD_SEC_GRP_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GRP* pMUD ) { int size; int i; @@ -160,7 +144,7 @@ MUD_SEC_GRP_proc( op, pBuf, pMUD ) return( size ); case MUD_SHOW: printf( " MUD_SEC_GRP: num=[%ld], memSize=%ld\n", - pMUD->num, pMUD->memSize ); + (long int)(pMUD->num), (long int)(pMUD->memSize) ); for( pMUD_index = pMUD->pMemIndex; pMUD_index != NULL; pMUD_index = pMUD_index->pNext ) @@ -178,10 +162,7 @@ MUD_SEC_GRP_proc( op, pBuf, pMUD ) int -MUD_SEC_CMT_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_CMT* pMUD; +MUD_SEC_CMT_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_CMT* pMUD ) { int size; char tempStr1[32]; @@ -221,8 +202,9 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD ) return( size ); case MUD_SHOW: printf( " MUD_SEC_CMT: \n" ); - printf( " number:[%ld], prevReply:[%ld], nextReply:[%ld]\n", - pMUD->ID, pMUD->prevReplyID, pMUD->nextReplyID ); + printf( " number:[%lu], prevReply:[%lu], nextReply:[%lu]\n", + (unsigned long)(pMUD->ID), (unsigned long)(pMUD->prevReplyID), + (unsigned long)(pMUD->nextReplyID) ); bintime = pMUD->time; strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) ); tempStr1[strlen(tempStr1)-1] = '\0'; @@ -232,11 +214,11 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD ) if( pMUD->comment ) printf( " comment:\"%s\"\n", pMUD->comment ); break; case MUD_HEADS: - printf( "Comment number %ld. ", pMUD->ID ); + printf( "Comment number %lu. ", (unsigned long)(pMUD->ID) ); if( pMUD->prevReplyID > 0 ) - printf(" Re: #%ld. ", pMUD->prevReplyID ); + printf(" Re: #%lu. ", (unsigned long)(pMUD->prevReplyID) ); if( pMUD->nextReplyID > 0 ) - printf(" Next: #%ld.", pMUD->nextReplyID ); + printf(" Next: #%lu.", (unsigned long)(pMUD->nextReplyID) ); printf( "\n" ); bintime = pMUD->time; strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) ); @@ -251,13 +233,8 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD ) int -MUD_SEC_UNKNOWN_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_UNKNOWN* pMUD; +MUD_SEC_UNKNOWN_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_UNKNOWN* pMUD ) { - int size; - switch( op ) { case MUD_FREE: diff --git a/src/external/mud/src/mud_encode.c b/src/external/mud/src/mud_encode.c index 6f7c3c79..320b28aa 100644 --- a/src/external/mud/src/mud_encode.c +++ b/src/external/mud/src/mud_encode.c @@ -21,15 +21,11 @@ * license (unrestricted use). */ -#include - #include "mud.h" void -bdecode_2( b, p ) - void* b; - void* p; +bdecode_2( void* b, void* p ) { #ifdef MUD_BIG_ENDIAN UINT16 i; @@ -42,9 +38,7 @@ bdecode_2( b, p ) } void -bencode_2( b, p ) - void* b; - void* p; +bencode_2( void* b, void* p ) { #ifdef MUD_BIG_ENDIAN UINT16 i; @@ -63,9 +57,7 @@ bencode_2( b, p ) } void -bdecode_4( b, p ) - void* b; - void* p; +bdecode_4( void* b,void* p ) { #ifdef MUD_BIG_ENDIAN UINT32 i; @@ -78,9 +70,7 @@ bdecode_4( b, p ) } void -bencode_4( b, p ) - void* b; - void* p; +bencode_4( void* b, void* p ) { #ifdef MUD_BIG_ENDIAN UINT32 i; @@ -93,9 +83,7 @@ bencode_4( b, p ) } void -bdecode_8( b, p ) - void* b; - void* p; +bdecode_8( void* b, void* p ) { #ifdef MUD_BIG_ENDIAN UINT32 i[2], i2[2]; @@ -109,9 +97,7 @@ bdecode_8( b, p ) } void -bencode_8( b, p ) - void* b; - void* p; +bencode_8( void* b, void* p ) { #ifdef MUD_BIG_ENDIAN UINT32 i[2], i2[2]; @@ -126,9 +112,7 @@ bencode_8( b, p ) void -decode_str( pB, ps ) - BUF* pB; - char** ps; +decode_str( BUF* pB, char** ps ) { MUD_STR_LEN_TYPE len; @@ -153,9 +137,7 @@ decode_str( pB, ps ) void -encode_str( pB, ps ) - BUF* pB; - char** ps; +encode_str( BUF* pB, char** ps ) { MUD_STR_LEN_TYPE len; @@ -223,16 +205,13 @@ static struct sgl_limits { #endif /* !VMS */ void -bencode_float( buf, fp ) - char* buf; - float* fp; +bencode_float( char* buf, float* fp ) { #ifndef VMS struct ieee_single is; struct vax_single vs; struct sgl_limits *lim; int i; - UINT16 sa[2], sb[2]; #endif /* !VMS */ #ifdef VMS @@ -262,9 +241,7 @@ shipit: } void -encode_float( pBuf, fp ) - BUF* pBuf; - float* fp; +encode_float( BUF* pBuf, float* fp ) { bencode_float( &(pBuf->buf[pBuf->pos]), fp ); pBuf->pos += 4; @@ -272,9 +249,7 @@ encode_float( pBuf, fp ) } void -bdecode_float( buf, fp ) - char* buf; - float* fp; +bdecode_float( char* buf, float* fp ) { #ifndef VMS struct ieee_single *isp; @@ -315,9 +290,7 @@ shipit: } void -decode_float( pBuf, fp ) - BUF* pBuf; - float* fp; +decode_float( BUF* pBuf, float* fp ) { bdecode_float( &(pBuf->buf[pBuf->pos]), fp ); pBuf->pos += 4; @@ -392,16 +365,13 @@ static struct dbl_limits { void -bencode_double( buf, dp ) - char* buf; - double* dp; +bencode_double( char* buf, double* dp ) { #ifndef VMS struct ieee_double id; struct vax_double vd; register struct dbl_limits *lim; int i; - UINT16 sa[4], sb[4]; #endif /* !VMS */ #ifdef VMS @@ -434,9 +404,7 @@ shipit: } void -encode_double( pBuf, fp ) - BUF* pBuf; - double* fp; +encode_double( BUF* pBuf, double* fp ) { bencode_double( &(pBuf->buf[pBuf->pos]), fp ); pBuf->pos += 8; @@ -444,16 +412,13 @@ encode_double( pBuf, fp ) } void -bdecode_double( buf, dp ) - char* buf; - double* dp; +bdecode_double( char* buf, double* dp ) { #ifndef VMS - struct ieee_double id, *idp; + struct ieee_double *idp; struct vax_double vd; register struct dbl_limits *lim; int i; - UINT16 sa[4], sb[4]; #endif /* !VMS */ #ifdef VMS @@ -486,9 +451,7 @@ shipit: } void -decode_double( pBuf, fp ) - BUF* pBuf; - double* fp; +decode_double( BUF* pBuf, double* fp ) { bdecode_double( &(pBuf->buf[pBuf->pos]), fp ); pBuf->pos += 8; diff --git a/src/external/mud/src/mud_friendly.c b/src/external/mud/src/mud_friendly.c index a21d36a6..7b785e72 100644 --- a/src/external/mud/src/mud_friendly.c +++ b/src/external/mud/src/mud_friendly.c @@ -3,14 +3,14 @@ * * A friendly programming interface to the MUD library * - * Copyright (c) 1996-2010 TRIUMF Cyclotron Facility + * Copyright (c) 1996-2020 TRIUMF Cyclotron Facility * * Author: * Ted Whidden, TRIUMF Data Acquisition Group * Donald Arseneau, TRIUMF CMMS * 4004 Wesbrook Mall, Vancouver, BC, Canada, V6T 2A3 * -* + * * Released under the GNU LGPL - see http://www.gnu.org/licenses * * This program is free software; you can distribute it and/or modify it under @@ -30,7 +30,8 @@ * string "get" functions, and use strncpy, but * always terminate. * 22-Apr-2003 v1.6 DJA Add mud_openReadWrite - * 22-Aug-2010 v1.7 DJA Add mud_openReadWrite + * 25-May-2011 v1.7 DJA Fix cast in MUD_setHistSecondsPerBin + * 15-Oct-2020 v1.8 DF Fix group/instance numbers in _sea_cmtgrp * * Description: * @@ -226,18 +227,15 @@ #define MUD_FILE_READ 1 #define MUD_FILE_WRITE 2 -static FILE* mud_f[MUD_MAX_FILES] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +static FILE* mud_f[MUD_MAX_FILES] = { 0 }; static MUD_SEC_GRP* pMUD_fileGrp[MUD_MAX_FILES]; #define _strncpy( To, From, Len) strncpy( To, From, Len )[Len-1]='\0' int -MUD_openRead( filename, pType ) - char* filename; - UINT32* pType; +MUD_openRead( char* filename, UINT32* pType ) { int fd; - FILE* fin; for( fd = 0; fd < MUD_MAX_FILES; fd++ ) { @@ -254,8 +252,8 @@ MUD_openRead( filename, pType ) * i.e., only read when needed, keep track of * what's already read. */ - pMUD_fileGrp[fd] = MUD_readFile( mud_f[fd] ); - if( pMUD_fileGrp[fd] == NULL ) + pMUD_fileGrp[fd] = (MUD_SEC_GRP*)MUD_readFile( mud_f[fd] ); + if( pMUD_fileGrp[fd] == NULL ) { fclose( mud_f[fd] ); mud_f[fd] = NULL; @@ -268,12 +266,9 @@ MUD_openRead( filename, pType ) } int -MUD_openReadWrite( filename, pType ) - char* filename; - UINT32* pType; +MUD_openReadWrite( char* filename, UINT32* pType ) { int fd; - FILE* fin; for( fd = 0; fd < MUD_MAX_FILES; fd++ ) { @@ -287,7 +282,7 @@ MUD_openReadWrite( filename, pType ) /* * Just read the whole file. Must do so in ReadWrite version. */ - pMUD_fileGrp[fd] = MUD_readFile( mud_f[fd] ); + pMUD_fileGrp[fd] = (MUD_SEC_GRP*)MUD_readFile( mud_f[fd] ); if( pMUD_fileGrp[fd] == NULL ) { fclose( mud_f[fd] ); @@ -302,12 +297,9 @@ MUD_openReadWrite( filename, pType ) int -MUD_openWrite( filename, type ) - char* filename; - UINT32 type; +MUD_openWrite( char* filename, UINT32 type ) { int fd; - FILE* fin; for( fd = 0; fd < MUD_MAX_FILES; fd++ ) { @@ -331,8 +323,7 @@ MUD_openWrite( filename, type ) int -MUD_closeRead( fd ) - int fd; +MUD_closeRead( int fd ) { if( ( fd < 0 ) || ( fd >= MUD_MAX_FILES ) || ( mud_f[fd] == NULL ) ) { @@ -356,8 +347,7 @@ MUD_closeRead( fd ) int -MUD_closeWrite( fd ) - int fd; +MUD_closeWrite( int fd ) { if( ( fd < 0 ) || ( fd >= MUD_MAX_FILES ) || ( mud_f[fd] == NULL ) ) { @@ -389,9 +379,7 @@ MUD_closeWrite( fd ) } int -MUD_closeWriteFile( fd, outname ) - int fd; - char* outname; +MUD_closeWriteFile( int fd, char* outname ) { if( ( fd < 0 ) || ( fd >= MUD_MAX_FILES ) || ( mud_f[fd] == NULL ) ) { @@ -445,14 +433,14 @@ MUD_closeWriteFile( fd, outname ) switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ { \ case MUD_FMT_TRI_TI_ID: \ - pMUD_idesc = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_idesc = (MUD_SEC_TRI_TI_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_TRI_TI_RUN_DESC_ID, (UINT32)1, \ (UINT32)0 ); \ if( pMUD_idesc == NULL ) return( 0 ); \ break; \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_desc = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_desc = (MUD_SEC_GEN_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GEN_RUN_DESC_ID, (UINT32)1, \ (UINT32)0 ); \ if( pMUD_desc == NULL ) return( 0 ); \ @@ -461,26 +449,24 @@ MUD_closeWriteFile( fd, outname ) #define _sea_gdesc( fd ) \ - pMUD_desc = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_desc = (MUD_SEC_GEN_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GEN_RUN_DESC_ID, (UINT32)1, \ (UINT32)0 ); \ if( pMUD_desc == NULL ) return( 0 ) #define _sea_idesc( fd ) \ - pMUD_idesc = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_idesc = (MUD_SEC_TRI_TI_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_TRI_TI_RUN_DESC_ID, (UINT32)1, \ (UINT32)0 ); \ if( pMUD_idesc == NULL ) return( 0 ) #define _desc_uint_getproc( name, var ) \ -int name( fd, var ) \ - int fd; \ - UINT32* var; \ + int name( int fd, UINT32* var) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_desc( fd ); \ switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ @@ -493,12 +479,10 @@ int name( fd, var ) \ #define _desc_uint_setproc( name, var ) \ -int name( fd, var ) \ - int fd; \ - UINT32 var; \ +int name( int fd, UINT32 var) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_desc( fd ); \ switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ @@ -511,12 +495,10 @@ int name( fd, var ) \ #define _desc_char_getproc( name, var ) \ -int name( fd, var, strdim ) \ - int fd, strdim; \ - char* var; \ +int name( int fd, char* var, int strdim ) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_desc( fd ); \ switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ @@ -529,12 +511,10 @@ int name( fd, var, strdim ) \ #define _desc_char_setproc( name, var ) \ -int name( fd, var ) \ - int fd; \ - char* var; \ +int name( int fd, char* var ) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_desc( fd ); \ switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ @@ -549,11 +529,9 @@ int name( fd, var ) \ #define _gdesc_char_getproc( name, var ) \ -int name( fd, var, strdim ) \ - int fd, strdim; \ - char* var; \ +int name( int fd, char* var, int strdim ) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ _check_fd( fd ); \ _sea_gdesc( fd ); \ _strncpy( var, pMUD_desc->var, strdim ); \ @@ -562,11 +540,9 @@ int name( fd, var, strdim ) \ #define _gdesc_char_setproc( name, var ) \ -int name( fd, var ) \ - int fd; \ - char* var; \ +int name( int fd, char* var ) \ { \ - MUD_SEC_GEN_RUN_DESC* pMUD_desc; \ + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; \ _check_fd( fd ); \ _sea_gdesc( fd ); \ _free( pMUD_desc->var ); \ @@ -576,11 +552,9 @@ int name( fd, var ) \ #define _idesc_char_getproc( name, var ) \ -int name( fd, var, strdim ) \ - int fd, strdim;\ - char* var;\ +int name( int fd, char* var, int strdim ) \ { \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_idesc( fd ); \ _strncpy( var, pMUD_idesc->var, strdim ); \ @@ -589,11 +563,9 @@ int name( fd, var, strdim ) \ #define _idesc_char_setproc( name, var ) \ -int name( fd, var ) \ - int fd;\ - char* var;\ +int name( int fd, char* var ) \ { \ - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; \ + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; \ _check_fd( fd ); \ _sea_idesc( fd ); \ _free( pMUD_idesc->var ); \ @@ -603,19 +575,17 @@ int name( fd, var ) \ int -MUD_getRunDesc( fd, pType ) - int fd; - UINT32* pType; +MUD_getRunDesc( int fd, UINT32* pType ) { - MUD_SEC_GEN_RUN_DESC* pMUD_desc; - MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc; + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; _check_fd( fd ); switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) { case MUD_FMT_TRI_TI_ID: - pMUD_idesc = MUD_search( pMUD_fileGrp[fd]->pMem, + pMUD_idesc = (MUD_SEC_TRI_TI_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, MUD_SEC_TRI_TI_RUN_DESC_ID, (UINT32)1, (UINT32)0 ); if( pMUD_idesc == NULL ) return( 0 ); @@ -623,7 +593,7 @@ MUD_getRunDesc( fd, pType ) break; case MUD_FMT_TRI_TD_ID: default: - pMUD_desc = MUD_search( pMUD_fileGrp[fd]->pMem, + pMUD_desc = (MUD_SEC_GEN_RUN_DESC*)MUD_search( pMUD_fileGrp[fd]->pMem, MUD_SEC_GEN_RUN_DESC_ID, (UINT32)1, (UINT32)0 ); if( pMUD_desc == NULL ) return( 0 ); @@ -635,29 +605,28 @@ MUD_getRunDesc( fd, pType ) } int -MUD_setRunDesc( fd, type ) - int fd; - UINT32 type; +MUD_setRunDesc( int fd, UINT32 type ) { - void* pMUD_desc; + MUD_SEC_GEN_RUN_DESC* pMUD_desc=0; + MUD_SEC_TRI_TI_RUN_DESC* pMUD_idesc=0; _check_fd( fd ); switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) { case MUD_FMT_TRI_TI_ID: - pMUD_desc = (void*)MUD_new( MUD_SEC_TRI_TI_RUN_DESC_ID, 1 ); - if( pMUD_desc == NULL ) return( 0 ); + pMUD_idesc = (MUD_SEC_TRI_TI_RUN_DESC*)MUD_new( MUD_SEC_TRI_TI_RUN_DESC_ID, 1 ); + if( pMUD_idesc == NULL ) return( 0 ); + MUD_addToGroup( pMUD_fileGrp[fd], pMUD_idesc ); break; case MUD_FMT_TRI_TD_ID: default: - pMUD_desc = (void*)MUD_new( MUD_SEC_GEN_RUN_DESC_ID, 1 ); + pMUD_desc = (MUD_SEC_GEN_RUN_DESC*)MUD_new( MUD_SEC_GEN_RUN_DESC_ID, 1 ); if( pMUD_desc == NULL ) return( 0 ); + MUD_addToGroup( pMUD_fileGrp[fd], pMUD_desc ); break; } - MUD_addToGroup( pMUD_fileGrp[fd], pMUD_desc ); - return( 1 ); } @@ -714,14 +683,14 @@ _idesc_char_setproc( MUD_setComment3, comment3 ) * Comments */ #define _sea_cmtgrp( fd ) \ - pMUD_cmtGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ - MUD_GRP_CMT_ID, (UINT32)1, \ + pMUD_cmtGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ + MUD_SEC_GRP_ID, MUD_GRP_CMT_ID, \ (UINT32)0 ); \ if( pMUD_cmtGrp == NULL ) return( 0 ) #define _sea_cmt( fd, n ) \ - pMUD_cmt = MUD_search( pMUD_cmtGrp->pMem, \ + pMUD_cmt = (MUD_SEC_CMT*)MUD_search( pMUD_cmtGrp->pMem, \ MUD_SEC_CMT_ID, (UINT32)n, \ (UINT32)0 ); \ if( pMUD_cmt == NULL ) return( 0 ) @@ -729,13 +698,10 @@ _idesc_char_setproc( MUD_setComment3, comment3 ) #define _cmt_uint_getproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - UINT32* var;\ +name( int fd, int num, UINT32* var ) \ { \ - MUD_SEC_GRP* pMUD_cmtGrp; \ - MUD_SEC_CMT* pMUD_cmt; \ + MUD_SEC_GRP* pMUD_cmtGrp=0; \ + MUD_SEC_CMT* pMUD_cmt=0; \ _check_fd( fd ); \ _sea_cmtgrp( fd ); \ _sea_cmt( fd, num ); \ @@ -746,13 +712,10 @@ name( fd, num, var ) \ #define _cmt_uint_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - UINT32 var;\ +name( int fd, int num, UINT32 var ) \ { \ - MUD_SEC_GRP* pMUD_cmtGrp; \ - MUD_SEC_CMT* pMUD_cmt; \ + MUD_SEC_GRP* pMUD_cmtGrp=0; \ + MUD_SEC_CMT* pMUD_cmt=0; \ _check_fd( fd ); \ _sea_cmtgrp( fd ); \ _sea_cmt( fd, num ); \ @@ -763,13 +726,10 @@ name( fd, num, var ) \ #define _cmt_char_getproc( name, var ) \ int \ -name( fd, num, var, strdim ) \ - int fd, strdim;\ - int num;\ - char* var;\ +name( int fd, int num, char* var, int strdim ) \ { \ - MUD_SEC_GRP* pMUD_cmtGrp; \ - MUD_SEC_CMT* pMUD_cmt; \ + MUD_SEC_GRP* pMUD_cmtGrp=0; \ + MUD_SEC_CMT* pMUD_cmt=0; \ _check_fd( fd ); \ _sea_cmtgrp( fd ); \ _sea_cmt( fd, num ); \ @@ -779,13 +739,10 @@ name( fd, num, var, strdim ) \ #define _cmt_char_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - char* var;\ +name( int fd, int num, char* var ) \ { \ - MUD_SEC_GRP* pMUD_cmtGrp; \ - MUD_SEC_CMT* pMUD_cmt; \ + MUD_SEC_GRP* pMUD_cmtGrp=0; \ + MUD_SEC_CMT* pMUD_cmt=0; \ _check_fd( fd ); \ _sea_cmtgrp( fd ); \ _sea_cmt( fd, num ); \ @@ -795,12 +752,9 @@ name( fd, num, var ) \ } int -MUD_getComments( fd, pType, pNum ) - int fd; - UINT32* pType; - UINT32* pNum; +MUD_getComments( int fd, UINT32* pType, UINT32* pNum ) { - MUD_SEC_GRP* pMUD_cmtGrp; + MUD_SEC_GRP* pMUD_cmtGrp=0; _check_fd( fd ); _sea_cmtgrp( fd ); @@ -811,13 +765,10 @@ MUD_getComments( fd, pType, pNum ) } int -MUD_setComments( fd, type, num ) - int fd; - UINT32 type; - UINT32 num; +MUD_setComments( int fd, UINT32 type, UINT32 num ) { - MUD_SEC_GRP* pMUD_cmtGrp; - MUD_SEC_CMT* pMUD_cmt; + MUD_SEC_GRP* pMUD_cmtGrp=0; + MUD_SEC_CMT* pMUD_cmt=0; int i; _check_fd( fd ); @@ -863,13 +814,13 @@ _cmt_char_setproc( MUD_setCommentBody, comment ) switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ { \ case MUD_FMT_TRI_TI_ID: \ - pMUD_histGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_histGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GRP_ID, MUD_GRP_TRI_TI_HIST_ID, \ (UINT32)0 ); \ break; \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_histGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_histGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GRP_ID, MUD_GRP_TRI_TD_HIST_ID, \ (UINT32)0 ); \ break; \ @@ -883,7 +834,7 @@ _cmt_char_setproc( MUD_setCommentBody, comment ) case MUD_FMT_TRI_TI_ID: \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_histHdr = MUD_search( pMUD_histGrp->pMem, \ + pMUD_histHdr = (MUD_SEC_GEN_HIST_HDR*)MUD_search( pMUD_histGrp->pMem, \ MUD_SEC_GEN_HIST_HDR_ID, (UINT32)n, \ (UINT32)0 ); \ break; \ @@ -893,13 +844,10 @@ _cmt_char_setproc( MUD_setCommentBody, comment ) #define _hist_uint_getproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - UINT32* var;\ +name( int fd, int num, UINT32* var ) \ { \ - MUD_SEC_GRP* pMUD_histGrp; \ - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; \ + MUD_SEC_GRP* pMUD_histGrp=0; \ + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; \ _check_fd( fd ); \ _sea_histgrp( fd ); \ _sea_histhdr( fd, num ); \ @@ -909,13 +857,10 @@ name( fd, num, var ) \ #define _hist_uint_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - UINT32 var;\ +name( int fd, int num, UINT32 var ) \ { \ - MUD_SEC_GRP* pMUD_histGrp; \ - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; \ + MUD_SEC_GRP* pMUD_histGrp=0; \ + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; \ _check_fd( fd ); \ _sea_histgrp( fd ); \ _sea_histhdr( fd, num ); \ @@ -925,10 +870,7 @@ name( fd, num, var ) \ #define _hist_char_getproc( name, var ) \ int \ -name( fd, num, var, strdim ) \ - int fd, strdim;\ - int num;\ - char* var;\ +name( int fd, int num, char* var, int strdim ) \ { \ MUD_SEC_GRP* pMUD_histGrp; \ MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; \ @@ -941,13 +883,10 @@ name( fd, num, var, strdim ) \ #define _hist_char_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - char* var;\ +name( int fd, int num, char* var ) \ { \ - MUD_SEC_GRP* pMUD_histGrp; \ - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; \ + MUD_SEC_GRP* pMUD_histGrp=0; \ + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; \ _check_fd( fd ); \ _sea_histgrp( fd ); \ _sea_histhdr( fd, num ); \ @@ -957,12 +896,9 @@ name( fd, num, var ) \ } int -MUD_getHists( fd, pType, pNum ) - int fd; - UINT32* pType; - UINT32* pNum; +MUD_getHists( int fd, UINT32* pType, UINT32* pNum ) { - MUD_SEC_GRP* pMUD_histGrp; + MUD_SEC_GRP* pMUD_histGrp=0; _check_fd( fd ); _sea_histgrp( fd ); *pType = MUD_instanceID( pMUD_histGrp ); @@ -981,14 +917,11 @@ MUD_getHists( fd, pType, pNum ) } int -MUD_setHists( fd, type, num ) - int fd; - UINT32 type; - UINT32 num; +MUD_setHists( int fd, UINT32 type, UINT32 num ) { MUD_SEC_GRP* pMUD_grp; - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; - MUD_SEC_GEN_HIST_DAT* pMUD_histDat; + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; + MUD_SEC_GEN_HIST_DAT* pMUD_histDat=0; int i; _check_fd( fd ); @@ -1048,17 +981,14 @@ _hist_uint_setproc( MUD_setHistNumEvents, nEvents ) _hist_char_setproc( MUD_setHistTitle, title ) int -MUD_getHistpData( fd, num, ppData ) - int fd; - int num; - void** ppData; +MUD_getHistpData( int fd, int num, void** ppData ) { - MUD_SEC_GRP* pMUD_histGrp; - MUD_SEC_GEN_HIST_DAT* pMUD_histDat; + MUD_SEC_GRP* pMUD_histGrp=0; + MUD_SEC_GEN_HIST_DAT* pMUD_histDat=0; _check_fd( fd ); _sea_histgrp( fd ); - pMUD_histDat = MUD_search( pMUD_histGrp->pMem, + pMUD_histDat = (MUD_SEC_GEN_HIST_DAT*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_DAT_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histDat == NULL ) return( 0 ); @@ -1068,43 +998,37 @@ MUD_getHistpData( fd, num, ppData ) } int -MUD_setHistpData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_setHistpData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_histGrp; - MUD_SEC_GEN_HIST_DAT* pMUD_histDat; + MUD_SEC_GRP* pMUD_histGrp=0; + MUD_SEC_GEN_HIST_DAT* pMUD_histDat=0; _check_fd( fd ); _sea_histgrp( fd ); - pMUD_histDat = MUD_search( pMUD_histGrp->pMem, + pMUD_histDat = (MUD_SEC_GEN_HIST_DAT*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_DAT_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histDat == NULL ) return( 0 ); - pMUD_histDat->pData = pData; + pMUD_histDat->pData = (caddr_t)pData; return( 1 ); } int -MUD_getHistData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_getHistData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_histGrp; - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; - MUD_SEC_GEN_HIST_DAT* pMUD_histDat; + MUD_SEC_GRP* pMUD_histGrp=0; + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; + MUD_SEC_GEN_HIST_DAT* pMUD_histDat=0; _check_fd( fd ); _sea_histgrp( fd ); - pMUD_histHdr = MUD_search( pMUD_histGrp->pMem, + pMUD_histHdr = (MUD_SEC_GEN_HIST_HDR*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_HDR_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histHdr == NULL ) return( 0 ); - pMUD_histDat = MUD_search( pMUD_histGrp->pMem, + pMUD_histDat = (MUD_SEC_GEN_HIST_DAT*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_DAT_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histDat == NULL ) return( 0 ); @@ -1120,23 +1044,20 @@ MUD_getHistData( fd, num, pData ) } int -MUD_setHistData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_setHistData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_histGrp; - MUD_SEC_GEN_HIST_HDR* pMUD_histHdr; - MUD_SEC_GEN_HIST_DAT* pMUD_histDat; + MUD_SEC_GRP* pMUD_histGrp=0; + MUD_SEC_GEN_HIST_HDR* pMUD_histHdr=0; + MUD_SEC_GEN_HIST_DAT* pMUD_histDat=0; _check_fd( fd ); _sea_histgrp( fd ); - pMUD_histHdr = MUD_search( pMUD_histGrp->pMem, + pMUD_histHdr = (MUD_SEC_GEN_HIST_HDR*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_HDR_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histHdr == NULL ) return( 0 ); - pMUD_histDat = MUD_search( pMUD_histGrp->pMem, + pMUD_histDat = (MUD_SEC_GEN_HIST_DAT*)MUD_search( pMUD_histGrp->pMem, MUD_SEC_GEN_HIST_DAT_ID, (UINT32)num, (UINT32)0 ); if( pMUD_histDat == NULL ) return( 0 ); @@ -1166,10 +1087,7 @@ MUD_setHistData( fd, num, pData ) } int -MUD_getHistpTimeData( fd, num, ppTimeData ) - int fd; - int num; - UINT32** ppTimeData; +MUD_getHistpTimeData( int fd, int num, UINT32** ppTimeData ) { /* return pointer to time history data for a histogram */ /* not implemented */ @@ -1177,10 +1095,7 @@ MUD_getHistpTimeData( fd, num, ppTimeData ) } int -MUD_getHistTimeData( fd, num, pTimeData ) - int fd; - int num; - UINT32* pTimeData; +MUD_getHistTimeData( int fd, int num, UINT32* pTimeData ) { /* return pointer to time history data for a histogram */ /* not implemented */ @@ -1188,10 +1103,7 @@ MUD_getHistTimeData( fd, num, pTimeData ) } int -MUD_setHistpTimeData( fd, num, pTimeData ) - int fd; - int num; - UINT32* pTimeData; +MUD_setHistpTimeData( int fd, int num, UINT32* pTimeData ) { /* return pointer to time history data for a histogram */ /* not implemented */ @@ -1199,10 +1111,7 @@ MUD_setHistpTimeData( fd, num, pTimeData ) } int -MUD_setHistTimeData( fd, num, pTimeData ) - int fd; - int num; - UINT32* pTimeData; +MUD_setHistTimeData( int fd, int num, UINT32* pTimeData ) { /* return pointer to time history data for a histogram */ /* not implemented */ @@ -1214,12 +1123,7 @@ MUD_setHistTimeData( fd, num, pTimeData ) * (not success/failure) */ int -MUD_pack( num, inBinSize, inArray, outBinSize, outArray ) - int num; - int inBinSize; - void* inArray; - int outBinSize; - void* outArray; +MUD_pack( int num, int inBinSize, void*inArray, int outBinSize, void* outArray ) { return( MUD_SEC_GEN_HIST_pack( num, inBinSize, inArray, outBinSize, outArray ) ); @@ -1227,12 +1131,7 @@ MUD_pack( num, inBinSize, inArray, outBinSize, outArray ) int -MUD_unpack( num, inBinSize, inArray, outBinSize, outArray ) - int num; - int inBinSize; - void* inArray; - int outBinSize; - void* outArray; +MUD_unpack( int num, int inBinSize, void* inArray, int outBinSize, void* outArray ) { return( MUD_SEC_GEN_HIST_unpack( num, inBinSize, inArray, outBinSize, outArray ) ); @@ -1247,7 +1146,7 @@ MUD_unpack( num, inBinSize, inArray, outBinSize, outArray ) { \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_scalGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_scalGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GRP_ID, MUD_GRP_TRI_TD_SCALER_ID, \ (UINT32)0 ); \ break; \ @@ -1260,7 +1159,7 @@ MUD_unpack( num, inBinSize, inArray, outBinSize, outArray ) { \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_scal = MUD_search( pMUD_scalGrp->pMem, \ + pMUD_scal = (MUD_SEC_GEN_SCALER*)MUD_search( pMUD_scalGrp->pMem, \ MUD_SEC_GEN_SCALER_ID, (UINT32)n, \ (UINT32)0 ); \ break; \ @@ -1269,12 +1168,9 @@ MUD_unpack( num, inBinSize, inArray, outBinSize, outArray ) int -MUD_getScalers( fd, pType, pNum ) - int fd; - UINT32* pType; - UINT32* pNum; +MUD_getScalers( int fd, UINT32* pType, UINT32* pNum ) { - MUD_SEC_GRP* pMUD_scalGrp; + MUD_SEC_GRP* pMUD_scalGrp=0; _check_fd( fd ); _sea_scalgrp( fd ); @@ -1285,13 +1181,10 @@ MUD_getScalers( fd, pType, pNum ) } int -MUD_setScalers( fd, type, num ) - int fd; - UINT32 type; - UINT32 num; +MUD_setScalers( int fd, UINT32 type, UINT32 num ) { - MUD_SEC_GRP* pMUD_grp; - MUD_SEC_GEN_SCALER* pMUD_scal; + MUD_SEC_GRP* pMUD_grp=0; + MUD_SEC_GEN_SCALER* pMUD_scal=0; int i; _check_fd( fd ); @@ -1316,13 +1209,10 @@ MUD_setScalers( fd, type, num ) } int -MUD_getScalerLabel( fd, num, label, strdim ) - int fd, strdim; - int num; - char* label; +MUD_getScalerLabel( int fd, int num, char* label, int strdim ) { - MUD_SEC_GRP* pMUD_scalGrp; - MUD_SEC_GEN_SCALER* pMUD_scal; + MUD_SEC_GRP* pMUD_scalGrp=0; + MUD_SEC_GEN_SCALER* pMUD_scal=0; _check_fd( fd ); _sea_scalgrp( fd ); @@ -1333,13 +1223,10 @@ MUD_getScalerLabel( fd, num, label, strdim ) } int -MUD_setScalerLabel( fd, num, label ) - int fd; - int num; - char* label; +MUD_setScalerLabel( int fd, int num, char* label ) { - MUD_SEC_GRP* pMUD_scalGrp; - MUD_SEC_GEN_SCALER* pMUD_scal; + MUD_SEC_GRP* pMUD_scalGrp=0; + MUD_SEC_GEN_SCALER* pMUD_scal=0; _check_fd( fd ); _sea_scalgrp( fd ); @@ -1351,13 +1238,10 @@ MUD_setScalerLabel( fd, num, label ) } int -MUD_getScalerCounts( fd, num, pCounts ) - int fd; - int num; - UINT32* pCounts; +MUD_getScalerCounts( int fd, int num, UINT32* pCounts ) { - MUD_SEC_GRP* pMUD_scalGrp; - MUD_SEC_GEN_SCALER* pMUD_scal; + MUD_SEC_GRP* pMUD_scalGrp=0; + MUD_SEC_GEN_SCALER* pMUD_scal=0; _check_fd( fd ); _sea_scalgrp( fd ); @@ -1370,13 +1254,10 @@ MUD_getScalerCounts( fd, num, pCounts ) } int -MUD_setScalerCounts( fd, num, pCounts ) - int fd; - int num; - UINT32* pCounts; +MUD_setScalerCounts( int fd, int num, UINT32* pCounts ) { - MUD_SEC_GRP* pMUD_scalGrp; - MUD_SEC_GEN_SCALER* pMUD_scal; + MUD_SEC_GRP* pMUD_scalGrp=0; + MUD_SEC_GEN_SCALER* pMUD_scal=0; _check_fd( fd ); _sea_scalgrp( fd ); @@ -1396,13 +1277,13 @@ MUD_setScalerCounts( fd, num, pCounts ) switch( MUD_instanceID( pMUD_fileGrp[fd] ) ) \ { \ case MUD_FMT_TRI_TI_ID: \ - pMUD_indVarGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_indVarGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GRP_ID, MUD_GRP_GEN_IND_VAR_ARR_ID, \ (UINT32)0 ); \ break; \ case MUD_FMT_TRI_TD_ID: \ default: \ - pMUD_indVarGrp = MUD_search( pMUD_fileGrp[fd]->pMem, \ + pMUD_indVarGrp = (MUD_SEC_GRP*)MUD_search( pMUD_fileGrp[fd]->pMem, \ MUD_SEC_GRP_ID, MUD_GRP_GEN_IND_VAR_ID, \ (UINT32)0 ); \ break; \ @@ -1416,7 +1297,7 @@ MUD_setScalerCounts( fd, num, pCounts ) case MUD_FMT_TRI_TD_ID: \ case MUD_FMT_TRI_TI_ID: \ default: \ - pMUD_indVar = MUD_search( pMUD_indVarGrp->pMem, \ + pMUD_indVar = (MUD_SEC_GEN_IND_VAR*)MUD_search( pMUD_indVarGrp->pMem, \ MUD_SEC_GEN_IND_VAR_ID, (UINT32)n, \ (UINT32)0 ); \ break; \ @@ -1429,7 +1310,7 @@ MUD_setScalerCounts( fd, num, pCounts ) { \ case MUD_FMT_TRI_TI_ID: \ default: \ - pMUD_array = MUD_search( pMUD_indVarGrp->pMem, \ + pMUD_array = (MUD_SEC_GEN_ARRAY*)MUD_search( pMUD_indVarGrp->pMem, \ MUD_SEC_GEN_ARRAY_ID, (UINT32)n, \ (UINT32)0 ); \ break; \ @@ -1439,13 +1320,10 @@ MUD_setScalerCounts( fd, num, pCounts ) #define _indvar_doub_getproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - double* var;\ +name( int fd, int num, double* var ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_IND_VAR* pMUD_indVar; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_IND_VAR* pMUD_indVar=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvar( fd, num ); \ @@ -1455,13 +1333,10 @@ name( fd, num, var ) \ #define _indvar_doub_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - double var;\ +name( int fd, int num, double var ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_IND_VAR* pMUD_indVar; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_IND_VAR* pMUD_indVar=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvar( fd, num ); \ @@ -1472,13 +1347,10 @@ name( fd, num, var ) \ #define _indvar_char_getproc( name, var ) \ int \ -name( fd, num, var, strdim ) \ - int fd, strdim;\ - int num;\ - char* var;\ +name( int fd, int num, char* var, int strdim ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_IND_VAR* pMUD_indVar; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_IND_VAR* pMUD_indVar=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvar( fd, num ); \ @@ -1488,13 +1360,10 @@ name( fd, num, var, strdim ) \ #define _indvar_char_setproc( name, var ) \ int \ -name( fd, num, var ) \ - int fd;\ - int num;\ - char* var;\ +name( int fd, int num, char* var ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_IND_VAR* pMUD_indVar; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_IND_VAR* pMUD_indVar=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvar( fd, num ); \ @@ -1506,13 +1375,10 @@ name( fd, num, var ) \ #define _indvardat_uint_getproc( name, var ) \ int \ -name( fd, n, var ) \ - int fd;\ - int n;\ - UINT32* var;\ +name( int fd, int n, UINT32* var ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_ARRAY* pMUD_array; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_ARRAY* pMUD_array=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvardat( fd, n ); \ @@ -1522,13 +1388,10 @@ name( fd, n, var ) \ #define _indvardat_uint_setproc( name, var ) \ int \ -name( fd, n, var ) \ - int fd;\ - int n;\ - UINT32 var;\ +name( int fd, int n, UINT32 var ) \ { \ - MUD_SEC_GRP* pMUD_indVarGrp; \ - MUD_SEC_GEN_ARRAY* pMUD_array; \ + MUD_SEC_GRP* pMUD_indVarGrp=0; \ + MUD_SEC_GEN_ARRAY* pMUD_array=0; \ _check_fd( fd ); \ _sea_indvargrp( fd ); \ _sea_indvardat( fd, n ); \ @@ -1538,12 +1401,9 @@ name( fd, n, var ) \ int -MUD_getIndVars( fd, pType, pNum ) - int fd; - UINT32* pType; - UINT32* pNum; +MUD_getIndVars( int fd, UINT32* pType, UINT32* pNum ) { - MUD_SEC_GRP* pMUD_indVarGrp; + MUD_SEC_GRP* pMUD_indVarGrp=0; _check_fd( fd ); _sea_indvargrp( fd ); @@ -1566,14 +1426,11 @@ MUD_getIndVars( fd, pType, pNum ) } int -MUD_setIndVars( fd, type, num ) - int fd; - UINT32 type; - UINT32 num; +MUD_setIndVars( int fd, UINT32 type, UINT32 num ) { - MUD_SEC_GRP* pMUD_grp; - MUD_SEC_GEN_IND_VAR* pMUD_indVar; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_grp=0; + MUD_SEC_GEN_IND_VAR* pMUD_indVar=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; int i; _check_fd( fd ); @@ -1636,13 +1493,10 @@ _indvardat_uint_setproc( MUD_setIndVarElemSize, elemSize ) _indvardat_uint_setproc( MUD_setIndVarDataType, type ) int -MUD_getIndVarpData( fd, num, ppData ) - int fd; - int num; - void** ppData; +MUD_getIndVarpData( int fd, int num, void** ppData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1651,13 +1505,10 @@ MUD_getIndVarpData( fd, num, ppData ) } int -MUD_setIndVarpData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_setIndVarpData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1666,13 +1517,10 @@ MUD_setIndVarpData( fd, num, pData ) } int -MUD_getIndVarData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_getIndVarData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1696,13 +1544,10 @@ MUD_getIndVarData( fd, num, pData ) } int -MUD_setIndVarData( fd, num, pData ) - int fd; - int num; - void* pData; +MUD_setIndVarData( int fd, int num, void* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1736,13 +1581,10 @@ MUD_setIndVarData( fd, num, pData ) } int -MUD_getIndVarpTimeData( fd, num, ppData ) - int fd; - int num; - UINT32** ppData; +MUD_getIndVarpTimeData( int fd, int num, UINT32** ppData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1751,13 +1593,10 @@ MUD_getIndVarpTimeData( fd, num, ppData ) } int -MUD_setIndVarpTimeData( fd, num, pData ) - int fd; - int num; - UINT32* pData; +MUD_setIndVarpTimeData( int fd, int num, UINT32* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1766,13 +1605,10 @@ MUD_setIndVarpTimeData( fd, num, pData ) } int -MUD_getIndVarTimeData( fd, num, pData ) - int fd; - int num; - UINT32* pData; +MUD_getIndVarTimeData( int fd, int num, UINT32* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); _sea_indvardat( fd, num ); @@ -1786,13 +1622,10 @@ MUD_getIndVarTimeData( fd, num, pData ) } int -MUD_setIndVarTimeData( fd, num, pData ) - int fd; - int num; - UINT32* pData; +MUD_setIndVarTimeData( int fd, int num, UINT32* pData ) { - MUD_SEC_GRP* pMUD_indVarGrp; - MUD_SEC_GEN_ARRAY* pMUD_array; + MUD_SEC_GRP* pMUD_indVarGrp=0; + MUD_SEC_GEN_ARRAY* pMUD_array=0; _check_fd( fd ); _sea_indvargrp( fd ); @@ -1815,7 +1648,7 @@ MUD_getHistSecondsPerBin( int fd, int num, REAL64* pSecondsPerBin ) int i; UINT32 fsPerBin; - if( i = MUD_getHistFsPerBin( fd, num, &fsPerBin ) ) + if( (i = MUD_getHistFsPerBin( fd, num, &fsPerBin )) ) { if( fsPerBin < 16 ) { diff --git a/src/external/mud/src/mud_gen.c b/src/external/mud/src/mud_gen.c index 969947c9..1c41fcab 100644 --- a/src/external/mud/src/mud_gen.c +++ b/src/external/mud/src/mud_gen.c @@ -30,7 +30,7 @@ #include #include "mud.h" -/* #define DEBUG 1 /* (un)comment for debug */ +/* #define DEBUG 1 */ /* (un)comment for debug */ #define PACK_OP 1 #define UNPACK_OP 2 static int pack_op; @@ -42,15 +42,11 @@ static void next_few_bins _ANSI_ARGS_(( int num_tot, int inBinSize, void* pHistD int -MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_RUN_DESC* pMUD; +MUD_SEC_GEN_RUN_DESC_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_RUN_DESC* pMUD ) { int size; char tempStr1[32]; char tempStr2[32]; - int imin,isec; time_t bintime; switch( op ) @@ -124,16 +120,16 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD ) return( size ); case MUD_SHOW: printf( " MUD_SEC_GEN_RUN_DESC: expt:[%ld], run:[%ld]\n", - pMUD->exptNumber, pMUD->runNumber ); + (long)(pMUD->exptNumber), (long)(pMUD->runNumber) ); bintime = pMUD->timeBegin; strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) ); tempStr1[strlen(tempStr1)-1] = '\0'; bintime = pMUD->timeEnd; strncpy( tempStr2, ctime( &bintime ), sizeof(tempStr2) ); tempStr2[strlen(tempStr2)-1] = '\0'; - printf( " timeBegin:[%s] [%ld]\n", tempStr1, pMUD->timeBegin ); - printf( " timeEnd:[%s] [%ld]\n", tempStr2, pMUD->timeEnd ); - printf( " elapsedSec:[%ld]\n", pMUD->elapsedSec ); + printf( " timeBegin:[%s] [%lu]\n", tempStr1, (unsigned long)(pMUD->timeBegin) ); + printf( " timeEnd:[%s] [%lu]\n", tempStr2, (unsigned long)(pMUD->timeEnd) ); + printf( " elapsedSec:[%ld]\n", (long)(pMUD->elapsedSec) ); if( pMUD->title ) printf( " title:\"%s\"\n", pMUD->title ); if( pMUD->lab ) printf( " lab:\"%s\"\n", pMUD->lab ); if( pMUD->area ) printf( " area:\"%s\"\n", pMUD->area ); @@ -152,8 +148,8 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD ) printf( " field:\"%s\"\n", pMUD->field ); break; case MUD_HEADS: - printf( "Run number: %ld\n", pMUD->runNumber ); - printf( " exper num: %ld\n", pMUD->exptNumber ); + printf( "Run number: %ld\n", (long)(pMUD->runNumber) ); + printf( " exper num: %ld\n", (long)(pMUD->exptNumber) ); if( pMUD->experimenter ) printf( " operator: %s\n", pMUD->experimenter ); if( pMUD->method ) printf( " method: %s\n", pMUD->method ); @@ -165,9 +161,9 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD ) tempStr2[strlen(tempStr2)-1] = '\0'; printf( " began: %s\n ended: %s\n", tempStr1, tempStr2 ); - printf( " elapsed: %ld:%.2d:%.2d (%ld seconds)\n", - (pMUD->elapsedSec/3600), ((pMUD->elapsedSec%3600)/60), (pMUD->elapsedSec%60), - pMUD->elapsedSec ); + printf( " elapsed: %ld:%.2d:%.2d (%lu seconds)\n", + (long)(pMUD->elapsedSec/3600), ((pMUD->elapsedSec%3600)/60), (pMUD->elapsedSec%60), + (unsigned long)(pMUD->elapsedSec) ); if( pMUD->title ) { if( strlen( pMUD->title ) > 63 && strlen( pMUD->title ) < 80 ) @@ -197,10 +193,7 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_HIST_HDR_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_HIST_HDR* pMUD; +MUD_SEC_GEN_HIST_HDR_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_HIST_HDR* pMUD ) { int size; UINT32 fsBin; @@ -246,28 +239,28 @@ MUD_SEC_GEN_HIST_HDR_proc( op, pBuf, pMUD ) size += sizeof( MUD_STR_LEN_TYPE ) + _strlen( pMUD->title ); return( size ); case MUD_SHOW: - printf( " MUD_SEC_GEN_HIST_HDR: histType:[0x%08lX]\n", pMUD->histType ); - printf( " nBytes:[%ld], nBins:[%ld], nEvents:[%ld]\n", - pMUD->nBytes, pMUD->nBins, pMUD->nEvents ); + printf( " MUD_SEC_GEN_HIST_HDR: histType:[0x%08lX]\n", (unsigned long)(pMUD->histType) ); + printf( " nBytes:[%ld], nBins:[%ld], nEvents:[%lu]\n", + (long)(pMUD->nBytes), (long)(pMUD->nBins), (unsigned long)(pMUD->nEvents) ); printf( " bytesPerBin:[%ld], fsPerBin:[%ld], t0_ps:[%ld], t0_bin:[%ld]\n", - pMUD->bytesPerBin, pMUD->fsPerBin, pMUD->t0_ps, pMUD->t0_bin ); + (long)(pMUD->bytesPerBin), (long)(pMUD->fsPerBin), (long)(pMUD->t0_ps), (long)(pMUD->t0_bin) ); printf( " goodBin1:[%ld], goodBin2:[%ld], bkgd1:[%ld], bkgd2:[%ld]\n", - pMUD->goodBin1, pMUD->goodBin2, pMUD->bkgd1, pMUD->bkgd2 ); + (long)(pMUD->goodBin1), (long)(pMUD->goodBin2), (long)(pMUD->bkgd1), (long)(pMUD->bkgd2) ); if( pMUD->title ) printf( " title:\"%s\"\n", pMUD->title ); break; case MUD_HEADS: if( pMUD->title ) printf( "Hist title: %s\n", pMUD->title ); - printf( " nBins: %ld, nEvents: %ld, ", - pMUD->nBins, pMUD->nEvents ); + printf( " nBins: %ld, nEvents: %lu, ", + (long)(pMUD->nBins), (unsigned long)(pMUD->nEvents) ); fsBin = pMUD->fsPerBin; if( fsBin < 16 ) { nsBin = 0.078125 * pow( (double)2.0, (double)fsBin ); - printf( "ns_per_Bin: %.lf\n", nsBin ); + printf( "ns_per_Bin: %.6lf\n", nsBin ); } else if( fsBin < 29 ) { - nsBin = 0.048828125 * pow( (double)2.0, (double)fsBin - 16 ); + nsBin = 0.048828125 * pow( (double)2.0, (double)(fsBin - 16) ); printf( "ns_per_Bin: %.9lf\n", nsBin ); } else @@ -277,9 +270,9 @@ MUD_SEC_GEN_HIST_HDR_proc( op, pBuf, pMUD ) } printf( " t0_ps: %ld, t0_bin: %ld\n", - pMUD->t0_ps, pMUD->t0_bin ); + (long)(pMUD->t0_ps), (long)(pMUD->t0_bin) ); printf( " goodBin1: %ld, goodBin2: %ld, bkgd1: %ld, bkgd2: %ld\n", - pMUD->goodBin1, pMUD->goodBin2, pMUD->bkgd1, pMUD->bkgd2 ); + (long)(pMUD->goodBin1), (long)(pMUD->goodBin2), (long)(pMUD->bkgd1), (long)(pMUD->bkgd2) ); break; } return( 1 ); @@ -287,10 +280,7 @@ MUD_SEC_GEN_HIST_HDR_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_HIST_DAT_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_HIST_DAT* pMUD; +MUD_SEC_GEN_HIST_DAT_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_HIST_DAT* pMUD ) { int size; @@ -313,7 +303,7 @@ MUD_SEC_GEN_HIST_DAT_proc( op, pBuf, pMUD ) size += pMUD->nBytes; return( size ); case MUD_SHOW: - printf( " MUD_SEC_GEN_HIST_DAT: nBytes:[%ld]\n", pMUD->nBytes ); + printf( " MUD_SEC_GEN_HIST_DAT: nBytes:[%ld]\n", (long)(pMUD->nBytes) ); break; case MUD_HEADS: break; @@ -323,10 +313,7 @@ MUD_SEC_GEN_HIST_DAT_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_SCALER_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_SCALER* pMUD; +MUD_SEC_GEN_SCALER_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_SCALER* pMUD ) { int size; @@ -350,15 +337,16 @@ MUD_SEC_GEN_SCALER_proc( op, pBuf, pMUD ) size += sizeof( MUD_STR_LEN_TYPE ) + _strlen( pMUD->label ); return( size ); case MUD_SHOW: - printf( " MUD_SEC_GEN_SCALER: counts[1]:[%ld], counts[0]:[%ld]\n", - pMUD->counts[1], pMUD->counts[0] ); + printf( " MUD_SEC_GEN_SCALER: counts[1]:[%lu], counts[0]:[%lu]\n", + (unsigned long)(pMUD->counts[1]), (unsigned long)(pMUD->counts[0]) ); if( pMUD->label ) printf( " label:\"%s\"\n", pMUD->label ); break; case MUD_HEADS: printf( " Scaler " ); if( pMUD->label ) printf( "%8s", pMUD->label ); else printf( "??? " ); - printf( " total: %11ld, recent: %ld\n", pMUD->counts[0], pMUD->counts[1] ); + printf( " total: %11lu, recent: %lu\n", + (unsigned long)(pMUD->counts[0]), (unsigned long)(pMUD->counts[1]) ); break; } return( 1 ); @@ -366,10 +354,7 @@ MUD_SEC_GEN_SCALER_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_IND_VAR_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_IND_VAR* pMUD; +MUD_SEC_GEN_IND_VAR_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_IND_VAR* pMUD ) { int size; @@ -431,10 +416,7 @@ MUD_SEC_GEN_IND_VAR_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_ARRAY_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_GEN_ARRAY* pMUD; +MUD_SEC_GEN_ARRAY_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_GEN_ARRAY* pMUD ) { int size; int i; @@ -538,8 +520,8 @@ MUD_SEC_GEN_ARRAY_proc( op, pBuf, pMUD ) case MUD_SHOW: printf( " MUD_SEC_GEN_ARRAY: \n" ); printf( " num:[%ld], elemSize:[%ld], type:[%ld], hasTime:[%ld], nBytes:[%ld]\n", - pMUD->num, pMUD->elemSize, pMUD->type, pMUD->hasTime, - pMUD->nBytes ); + (long)(pMUD->num), (long)(pMUD->elemSize), (long)(pMUD->type), (long)(pMUD->hasTime), + (long)(pMUD->nBytes) ); break; case MUD_HEADS: break; @@ -549,42 +531,27 @@ MUD_SEC_GEN_ARRAY_proc( op, pBuf, pMUD ) int -MUD_SEC_GEN_HIST_pack( num, inBinSize, inHist, outBinSize, outHist ) - int num; - int inBinSize; - void* inHist; - int outBinSize; - void* outHist; +MUD_SEC_GEN_HIST_pack( int num, int inBinSize, void* inHist, int outBinSize, void* outHist ) { pack_op = PACK_OP; return( MUD_SEC_GEN_HIST_dopack( num, inBinSize, inHist, outBinSize, outHist ) ); } int -MUD_SEC_GEN_HIST_unpack( num, inBinSize, inHist, outBinSize, outHist ) - int num; - int inBinSize; - void* inHist; - int outBinSize; - void* outHist; +MUD_SEC_GEN_HIST_unpack( int num, int inBinSize, void* inHist, int outBinSize, void* outHist ) { pack_op = UNPACK_OP; return( MUD_SEC_GEN_HIST_dopack( num, inBinSize, inHist, outBinSize, outHist ) ); } static int -MUD_SEC_GEN_HIST_dopack( num, inBinSize, inHist, outBinSize, outHist ) - int num; - int inBinSize; - void* inHist; - int outBinSize; - void* outHist; +MUD_SEC_GEN_HIST_dopack( int num, int inBinSize, void* inHist, int outBinSize, void* outHist ) { int i; int outLen = 0; MUD_VAR_BIN_LEN_TYPE num_temp; int bin, inLoc, outLoc; - int inLen_temp, outLen_temp; + int outLen_temp; MUD_VAR_BIN_SIZ_TYPE outBinSize_now, outBinSize_next; MUD_VAR_BIN_SIZ_TYPE inBinSize_temp; UINT8 c, *pc; @@ -935,8 +902,7 @@ MUD_SEC_GEN_HIST_dopack( num, inBinSize, inHist, outBinSize, outHist ) static int -n_bytes_needed( val ) - UINT32 val; +n_bytes_needed( UINT32 val ) { if( val & 0xFFFF0000 ) return( 4 ); else if( val & 0x0000FF00 ) return( 2 ); @@ -946,10 +912,7 @@ n_bytes_needed( val ) static UINT32 -varBinArray( pHistData, binSize, index ) - void* pHistData; - int binSize; - int index; +varBinArray( void* pHistData, int binSize, int index ) { UINT8 c; UINT16 s; @@ -991,17 +954,8 @@ varBinArray( pHistData, binSize, index ) static void -next_few_bins( num_tot, inBinSize, - pHistData, - outBinSize_now, - pNum_next, - pOutBinSize_next ) - int num_tot; - int inBinSize; - void* pHistData; - int outBinSize_now; - MUD_VAR_BIN_LEN_TYPE* pNum_next; - MUD_VAR_BIN_SIZ_TYPE* pOutBinSize_next; +next_few_bins( int num_tot, int inBinSize, void* pHistData, int outBinSize_now, + MUD_VAR_BIN_LEN_TYPE* pNum_next, MUD_VAR_BIN_SIZ_TYPE* pOutBinSize_next ) { int val; MUD_VAR_BIN_LEN_TYPE num_next; diff --git a/src/external/mud/src/mud_new.c b/src/external/mud/src/mud_new.c index f5741b9a..3e689ab7 100644 --- a/src/external/mud/src/mud_new.c +++ b/src/external/mud/src/mud_new.c @@ -27,13 +27,11 @@ * v1.2a 01-Mar-2000 DA Add handling of unidentified sections (don't quit) */ + #include "mud.h" - MUD_SEC* -MUD_new( secID, instanceID ) - UINT32 secID; - UINT32 instanceID; +MUD_new( UINT32 secID, UINT32 instanceID ) { MUD_SEC* pMUD_new; MUD_PROC proc; @@ -43,78 +41,78 @@ MUD_new( secID, instanceID ) { case MUD_SEC_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC ) ); - proc = MUD_SEC_proc; + proc = (MUD_PROC)MUD_SEC_proc; sizeOf = sizeof( MUD_SEC ); break; case MUD_SEC_FIXED_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_FIXED ) ); - proc = MUD_SEC_FIXED_proc; + proc = (MUD_PROC)MUD_SEC_FIXED_proc; sizeOf = sizeof( MUD_SEC_FIXED ); break; case MUD_SEC_GRP_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GRP ) ); - proc = MUD_SEC_GRP_proc; + proc = (MUD_PROC)MUD_SEC_GRP_proc; sizeOf = sizeof( MUD_SEC_GRP ); break; case MUD_SEC_EOF_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_EOF ) ); - proc = MUD_SEC_EOF_proc; + proc = (MUD_PROC)MUD_SEC_EOF_proc; sizeOf = sizeof( MUD_SEC_EOF ); break; case MUD_SEC_CMT_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_CMT ) ); - proc = MUD_SEC_CMT_proc; + proc = (MUD_PROC)MUD_SEC_CMT_proc; sizeOf = sizeof( MUD_SEC_CMT ); break; case MUD_SEC_GEN_RUN_DESC_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_RUN_DESC ) ); - proc = MUD_SEC_GEN_RUN_DESC_proc; + proc = (MUD_PROC)MUD_SEC_GEN_RUN_DESC_proc; sizeOf = sizeof( MUD_SEC_GEN_RUN_DESC ); break; case MUD_SEC_GEN_HIST_HDR_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_HIST_HDR ) ); - proc = MUD_SEC_GEN_HIST_HDR_proc; + proc = (MUD_PROC)MUD_SEC_GEN_HIST_HDR_proc; sizeOf = sizeof( MUD_SEC_GEN_HIST_HDR ); break; case MUD_SEC_GEN_HIST_DAT_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_HIST_DAT ) ); - proc = MUD_SEC_GEN_HIST_DAT_proc; + proc = (MUD_PROC)MUD_SEC_GEN_HIST_DAT_proc; sizeOf = sizeof( MUD_SEC_GEN_HIST_DAT ); break; case MUD_SEC_GEN_SCALER_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_SCALER ) ); - proc = MUD_SEC_GEN_SCALER_proc; + proc = (MUD_PROC)MUD_SEC_GEN_SCALER_proc; sizeOf = sizeof( MUD_SEC_GEN_SCALER ); break; case MUD_SEC_GEN_IND_VAR_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_IND_VAR ) ); - proc = MUD_SEC_GEN_IND_VAR_proc; + proc = (MUD_PROC)MUD_SEC_GEN_IND_VAR_proc; sizeOf = sizeof( MUD_SEC_GEN_IND_VAR ); break; case MUD_SEC_GEN_ARRAY_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_GEN_ARRAY ) ); - proc = MUD_SEC_GEN_ARRAY_proc; + proc = (MUD_PROC)MUD_SEC_GEN_ARRAY_proc; sizeOf = sizeof( MUD_SEC_GEN_ARRAY ); break; case MUD_SEC_TRI_TI_RUN_DESC_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_TRI_TI_RUN_DESC ) ); - proc = MUD_SEC_TRI_TI_RUN_DESC_proc; + proc = (MUD_PROC)MUD_SEC_TRI_TI_RUN_DESC_proc; sizeOf = sizeof( MUD_SEC_TRI_TI_RUN_DESC ); break; /* case MUD_SEC_CAMP_NUM_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_CAMP_NUM ) ); - proc = MUD_SEC_CAMP_NUM_proc; + proc = (MUD_PROC)MUD_SEC_CAMP_NUM_proc; sizeOf = sizeof( MUD_SEC_CAMP_NUM ); break; case MUD_SEC_CAMP_STR_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_CAMP_STR ) ); - proc = MUD_SEC_CAMP_STR_proc; + proc = (MUD_PROC)MUD_SEC_CAMP_STR_proc; sizeOf = sizeof( MUD_SEC_CAMP_STR ); break; case MUD_SEC_CAMP_SEL_ID: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_CAMP_SEL ) ); - proc = MUD_SEC_CAMP_SEL_proc; + proc = (MUD_PROC)MUD_SEC_CAMP_SEL_proc; sizeOf = sizeof( MUD_SEC_CAMP_SEL ); break; */ @@ -122,7 +120,7 @@ MUD_new( secID, instanceID ) /* add action for unknown */ default: pMUD_new = (MUD_SEC*)zalloc( sizeof( MUD_SEC_UNKNOWN ) ); - proc = MUD_SEC_UNKNOWN_proc; + proc = (MUD_PROC)MUD_SEC_UNKNOWN_proc; sizeOf = sizeof( MUD_SEC_UNKNOWN ); break; @@ -138,4 +136,3 @@ MUD_new( secID, instanceID ) return( pMUD_new ); } - diff --git a/src/external/mud/src/mud_tri_ti.c b/src/external/mud/src/mud_tri_ti.c index ec0915c5..89fc23db 100644 --- a/src/external/mud/src/mud_tri_ti.c +++ b/src/external/mud/src/mud_tri_ti.c @@ -27,10 +27,7 @@ int -MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD ) - MUD_OPT op; - BUF* pBuf; - MUD_SEC_TRI_TI_RUN_DESC* pMUD; +MUD_SEC_TRI_TI_RUN_DESC_proc( MUD_OPT op, BUF* pBuf, MUD_SEC_TRI_TI_RUN_DESC* pMUD ) { int size; char tempStr1[32]; @@ -115,8 +112,8 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD ) size += sizeof( MUD_STR_LEN_TYPE ) + _strlen( pMUD->comment3 ); return( size ); case MUD_SHOW: - printf( " MUD_SEC_TRI_TI_RUN_DESC: expt:[%ld], run:[%ld]\n", - pMUD->exptNumber, pMUD->runNumber ); + printf( " MUD_SEC_TRI_TI_RUN_DESC: expt:[%lu], run:[%lu]\n", + (unsigned long)(pMUD->exptNumber), (unsigned long)(pMUD->runNumber) ); bintime = pMUD->timeBegin; strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) ); tempStr1[strlen(tempStr1)-1] = '\0'; @@ -125,7 +122,7 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD ) tempStr2[strlen(tempStr2)-1] = '\0'; printf( " timeBegin:[%s]\n", tempStr1 ); printf( " timeEnd:[%s]\n", tempStr2 ); - printf( " elapsedSec:[%ld]\n", pMUD->elapsedSec ); + printf( " elapsedSec:[%lu]\n", (unsigned long)(pMUD->elapsedSec) ); if( pMUD->title ) printf( " title:\"%s\"\n", pMUD->title ); if( pMUD->lab ) printf( " lab:\"%s\"\n", pMUD->lab ); if( pMUD->area ) printf( " area:\"%s\"\n", pMUD->area ); @@ -148,8 +145,8 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD ) printf( " comment3:\"%s\"\n", pMUD->comment3 ); break; case MUD_HEADS: - printf( "Run number: %ld\n", pMUD->runNumber ); - printf( " exper num: %ld\n", pMUD->exptNumber ); + printf( "Run number: %lu\n", (unsigned long)(pMUD->runNumber) ); + printf( " exper num: %lu\n", (unsigned long)(pMUD->exptNumber) ); if( pMUD->experimenter ) printf( " operator: %s\n", pMUD->experimenter ); if( pMUD->method ) @@ -162,9 +159,9 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD ) tempStr2[strlen(tempStr2)-1] = '\0'; printf( " began: %s\n ended: %s\n", tempStr1, tempStr2 ); - printf( " elapsed: %ld:%.2d:%.2d (%ld seconds)\n", - (pMUD->elapsedSec/3600), ((pMUD->elapsedSec%3600)/60), (pMUD->elapsedSec%60), - pMUD->elapsedSec ); + printf( " elapsed: %ld:%.2d:%.2d (%lu seconds)\n", + (long)(pMUD->elapsedSec/3600), ((pMUD->elapsedSec%3600)/60), (pMUD->elapsedSec%60), + (unsigned long)(pMUD->elapsedSec) ); if( pMUD->title ) printf( " title: %s\n", pMUD->title ); if( pMUD->sample ) printf( " sample: %s\n", pMUD->sample ); if( pMUD->orient ) printf( " orient: %s\n", pMUD->orient );