mud updated. Now official under LGPL

This commit is contained in:
nemu 2010-08-26 07:13:48 +00:00
parent dd2263b6a0
commit 9da9aa0651
8 changed files with 125 additions and 20 deletions

View File

@ -1,6 +1,6 @@
#---------------------------------------------------------------------
# ChangeLog
# AS, 2010/08/19
# AS, 2010/08/26
# $Id$
#---------------------------------------------------------------------
@ -52,6 +52,7 @@ CHANGED stricter handling of ADDRUN (MUSR-106)
CHANGED ASCII export from musrview
CHANGED check for subsequent numbered parameters (MUSR-103)
CHANGED WKMFULLDATAPATH to MUSRFULLDATAPATH
UPDATED triumf mud file support. Now the mud source from triumf is officially published under LGPL
UPDATED source code documentation
UPDATED PSIBIN/MDU class from AA/AR

View File

@ -2,12 +2,27 @@
* mud.c -- most of the utilities for reading/writing MUD format files
* procedures for MUD_FMT_ALL sections
*
* Copyright (C) 1994-2009 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.
*
* Revision history:
* v1.0 26-Jan-1994 [T. Whidden] Initial version
* v1.1 17-Feb-1994 [T. Whidden] Groups with member index
* v1.1a 14-Apr-1994 [T. Whidden] Fixes to MUD_read, MUD_search
* 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
*/
@ -428,7 +443,7 @@ MUD_read( fin, io_opt )
MUD_SEC* pMUD_new;
MUD_SEC* pMUD_next;
int i;
int size;
UINT32 size;
int pos;
#ifdef DEBUG
@ -450,8 +465,8 @@ MUD_read( fin, io_opt )
#endif /* DEBUG */
bzero( &buf, sizeof( BUF ) );
buf.buf = (char*)zalloc( size );
if( fread( buf.buf, size, 1, fin ) == 0 )
buf.buf = (char*)zalloc( (size_t)size );
if( fread( buf.buf, (size_t)size, 1, fin ) == 0 )
{
_free( buf.buf );
return( NULL );

View File

@ -1,10 +1,25 @@
/*
* mud_all.c -- procedures for MUD_FMT_ALL sections
*
* Copyright (C) 1994-2010 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.
*
* Revision history:
* v1.00 15-Feb-1994 [T. Whidden] Initial version
* v1.10 17-Feb-1994 [T. Whidden] Groups with member index
* v1.2a 01-Mar-2000 DA Proc for unknown sections
* 25-Nov-2009 DA Handle 8-byte time_t
*/
#include <time.h>
@ -169,8 +184,8 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD )
MUD_SEC_CMT* pMUD;
{
int size;
time_t bintime;
char tempStr1[32];
time_t bintime;
switch( op )
{
@ -209,7 +224,7 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD )
printf( " number:[%ld], prevReply:[%ld], nextReply:[%ld]\n",
pMUD->ID, pMUD->prevReplyID, pMUD->nextReplyID );
bintime = pMUD->time;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
printf( " time:[%s]\n", tempStr1 );
if( pMUD->author ) printf( " author:\"%s\"\n", pMUD->author );
@ -224,7 +239,7 @@ MUD_SEC_CMT_proc( op, pBuf, pMUD )
printf(" Next: #%ld.", pMUD->nextReplyID );
printf( "\n" );
bintime = pMUD->time;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
if( pMUD->author ) printf( " author: %s, time: %s\n", pMUD->author, tempStr1 );
if( pMUD->title ) printf( " title: %s\n", pMUD->title );

View File

@ -1,7 +1,24 @@
/*
* mud_encode.c -- encode/decode
* mud_encode.c -- encode/decode,
* Routines for converting encoding and byte order between the MUD standard and the
* local machine standard.
*
* Copyright (C) 1994 TRIUMF (Vancouver, Canada)
*
* Float stuff adapted from Sun RPC xdr_float.c
* 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.
*
* Float conversions adapted from Sun RPC xdr_float.c, which is covered by a separate
* license (unrestricted use).
*/
#include <stdio.h>

View File

@ -3,12 +3,24 @@
*
* A friendly programming interface to the MUD library
*
* Copyright (c) 1996-2000 TRIUMF Cyclotron Facility
* Copyright (c) 1996-2010 TRIUMF Cyclotron Facility
*
* Author:
* Ted Whidden, TRIUMF Data Acquisition Group (whidden@triumf.ca)
* 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
* 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.
*
* Modification history:
* 26-Feb-1996 v1.0 TW Created
* 08-Oct-2000 v1.2 DJA Use MUD_setSizes()
@ -18,6 +30,7 @@
* 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
*
* Description:
*

View File

@ -1,6 +1,20 @@
/*
* mud_gen.c -- procedures for MUD_FMT_GEN sections
*
* Copyright (C) 1994-2010 TRIUMF (Vancouver, Canada)
*
* Authors: T. Whidden, D. Arseneau
*
* 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.
*
* Revision history:
* v1.0 26-Jan-1994 [T. Whidden] Initial version
* v1.0a 15-Feb-1994 [T. Whidden] Split ...GEN_HIST to ...GEN_HIST_HDR
@ -9,6 +23,7 @@
* v1.0c 17-Apr-1994 [T. Whidden] added temperature and field to RUN_DESC
* v1.0d 11-Jul-1994 [TW] Fixed "unaligned data access" messages in
* MUD_SEC_GEN_HIST_pack()
* 25-Nov-2009 DA Handle 8-byte time_t
*/
#include <time.h>
@ -33,10 +48,10 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD )
MUD_SEC_GEN_RUN_DESC* pMUD;
{
int size;
time_t bintime;
char tempStr1[32];
char tempStr2[32];
int imin,isec;
time_t bintime;
switch( op )
{
@ -114,7 +129,7 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD )
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
bintime = pMUD->timeEnd;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
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 );
@ -143,10 +158,10 @@ MUD_SEC_GEN_RUN_DESC_proc( op, pBuf, pMUD )
printf( " operator: %s\n", pMUD->experimenter );
if( pMUD->method ) printf( " method: %s\n", pMUD->method );
bintime = pMUD->timeBegin;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
bintime = pMUD->timeEnd;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr2, ctime( &bintime ), sizeof(tempStr2) );
tempStr2[strlen(tempStr2)-1] = '\0';
printf( " began: %s\n ended: %s\n",
tempStr1, tempStr2 );

View File

@ -3,6 +3,20 @@
* This routine is used for _all_ section types, and so a
* CASE entry must be added for each unique type.
*
* Copyright (C) 1994-2010 TRIUMF (Vancouver, Canada)
*
* Authors: T. Whidden, D. Arseneau
*
* 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.
*
* Revision history:
* v1.0 26-Jan-1994 [TW] Initial version
* v1.0a 08-Feb-1994 [TW] Added sizeOf to core

View File

@ -1,10 +1,25 @@
/*
* mud_tri_ti.c -- procedures for MUD_FMT_TRI_TI sections
*
* Copyright (C) 1994-2010 TRIUMF (Vancouver, Canada)
*
* Authors: T. Whidden, D. Arseneau
*
* 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.
*
* Revision history:
* v1.0 26-Jan-1994 [T. Whidden] Initial version
* v1.0a 14-Apr-1994 [T. Whidden] operator -> experimenter
* v1.0b 22-Apr-1994 [T. Whidden] rename TI to TRI_TI
* 25-Nov-2009 DA Handle 8-byte time_t
*/
#include <time.h>
@ -18,9 +33,9 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD )
MUD_SEC_TRI_TI_RUN_DESC* pMUD;
{
int size;
time_t bintime;
char tempStr1[32];
char tempStr2[32];
time_t bintime;
switch( op )
{
@ -103,10 +118,10 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD )
printf( " MUD_SEC_TRI_TI_RUN_DESC: expt:[%ld], run:[%ld]\n",
pMUD->exptNumber, pMUD->runNumber );
bintime = pMUD->timeBegin;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
bintime = pMUD->timeEnd;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr2, ctime( &bintime ), sizeof(tempStr2) );
tempStr2[strlen(tempStr2)-1] = '\0';
printf( " timeBegin:[%s]\n", tempStr1 );
printf( " timeEnd:[%s]\n", tempStr2 );
@ -140,10 +155,10 @@ MUD_SEC_TRI_TI_RUN_DESC_proc( op, pBuf, pMUD )
if( pMUD->method )
printf( " method: %s\n", pMUD->method );
bintime = pMUD->timeBegin;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
tempStr1[strlen(tempStr1)-1] = '\0';
bintime = pMUD->timeEnd;
strncpy( tempStr1, ctime( &bintime ), sizeof(tempStr1) );
strncpy( tempStr2, ctime( &bintime ), sizeof(tempStr2) );
tempStr2[strlen(tempStr2)-1] = '\0';
printf( " began: %s\n ended: %s\n",
tempStr1, tempStr2 );