From: <ro...@us...> - 2013-04-18 14:25:10
|
Revision: 2074 http://sourceforge.net/p/nsclspectcl/code/2074 Author: ron-fox Date: 2013-04-18 14:25:05 +0000 (Thu, 18 Apr 2013) Log Message: ----------- Provide support code for NSCLDAQ-11/10 ring item decoding Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h branches/SpecTcl-3.4/DecoderRing/Makefile.am branches/SpecTcl-3.4/Events/Analyzer.cpp branches/SpecTcl-3.4/Events/Analyzer.h branches/SpecTcl-3.4/Events/BufferDecoder.cpp branches/SpecTcl-3.4/Events/BufferDecoder.h branches/SpecTcl-3.4/Events/BufferTranslator.cpp branches/SpecTcl-3.4/Events/BufferTranslator.h branches/SpecTcl-3.4/Events/Makefile.am branches/SpecTcl-3.4/Events/RunControl.cpp Added Paths: ----------- branches/SpecTcl-3.4/DecoderRing/DataFormat.h branches/SpecTcl-3.4/DecoderRing/DataFormatPre11.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11Creator.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11Creator.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelperCreator.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelperCreator.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.h Removed Paths: ------------- branches/SpecTcl-3.4/DecoderRing/DataFormat.h Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-04-17 13:49:57 UTC (rev 2073) +++ branches/SpecTcl-3.4/CHANGELOG 2013-04-18 14:25:05 UTC (rev 2074) @@ -1009,4 +1009,7 @@ * Fix error in griprint.cc - buffer overflow for printing spectra with numbers above 99. Thanks to Dave Caussyn at FSU for finding this one. * Fix redef errors in NSCLAsciiFormatter.. - + +3.4 + * Provide support code for NSCLDAQ-11/10 ring item decoding. + Modified: branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-04-17 13:49:57 UTC (rev 2073) +++ branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-04-18 14:25:05 UTC (rev 2074) @@ -16,7 +16,15 @@ #include <config.h> #include "CRingBufferDecoder.h" +#include "RingFormatHelper.h" +#include "RingFormatHelper10.h" // Last chance helper. + +#include "RingFormatHelper10Creator.h" +#include "RingFormatHelper11Creator.h" + +#include "RingFormatHelperFactory.h" #include "DataFormat.h" +#include "DataFormatPre11.h" #include <Analyzer.h> #include <BufferTranslator.h> @@ -96,9 +104,21 @@ m_pPartialEvent(0), m_pTranslator(0), m_runNumber((UInt_t)-1), - m_pGluedBuffer(0) + m_pGluedBuffer(0), + m_pCurrentHelper(0), + m_pDefaultHelper(0), + m_pCurrentRingItem(0), + m_pFallbackHelper(new CRingFormatHelper10), + m_pFactory(new CRingFormatHelperFactory) { - + // Register the creators we know about: + // Adding a creator does a copy so this automatic creation is fine. + + CRingFormatHelper10Creator create10; + CRingFormatHelper11Creator create11; + + m_pFactory->addCreator(10, 0, create10); + m_pFactory->addCreator(11, 0, create11); } /*! Destructor IF ther's a buffer assembly in process, its storage should @@ -107,6 +127,12 @@ CRingBufferDecoder::~CRingBufferDecoder() { delete m_pPartialEvent; + delete m_pCurrentHelper; + delete m_pDefaultHelper; + delete m_pFallbackHelper; + + delete m_pFactory; + } ////////////////////////////////////////////////////////////////////////////////// @@ -321,7 +347,151 @@ return false; } +/** + * hasBodyHeader + * + * Determine if the current item has a body header. + * + * @return bool + * @retval true - a current item is defined and has a body header. + * @retval false - A current item is not defined or is defined but has no + * body header. + */ +bool +CRingBufferDecoder::hasBodyHeader() +{ + if (m_pCurrentRingItem) { + CRingFormatHelper* pHelper = getFormatHelper(); + return pHelper->hasBodyHeader(m_pCurrentRingItem); + } else { + return false; + } +} +/** + * getBodyHeaderPointer + * + * Returns a pointer to the current ring items' body header. See below however. + * + * @return void* - Pointer to the item's body pointer. + * @retval null - If hasBodyHeader() returns false. + */ +void* +CRingBufferDecoder::getBodyHeaderPointer() +{ + if (!hasBodyHeader()) return reinterpret_cast<void*>(0); + + CRingFormatHelper* pHelper = getFormatHelper(); + return pHelper->getBodyHeaderPointer(m_pCurrentRingItem); +} +/** + * getItemPointer() + * This returns a pointer to the currently dispatched ring item. + * If there is no currently dispatched ring item, a null is returned. + */ +void* +CRingBufferDecoder::getItemPointer() +{ + return m_pCurrentRingItem; +} +/** + * setFormatHelper + * + * Sets the currently used format helper. it is required that the helper have + * been dynamically allocated. Note that use of this method is not recommended + * unless your data is not really coming from NSCL ring buffers...but something + * close to it. Better is to use setDefaultFormatHelper This is because when + * the decoder encounters a RING_FORMAT item, it will replace the format helper + * with one created from the information in the ring format item. + * + * @param pHelper - Pointer to the ring format helper to use. This must have + * been constructed via new as this will delete it + */ +void +CRingBufferDecoder::setFormatHelper(CRingFormatHelper* pHelper) +{ + m_pCurrentHelper = pHelper; +} +/** + * setDefaultFormatHelper + * + * Sets the format header to use while we don't know the format of data + * from the ring (have not seen a RING_FORMAT item since the last time + * we reset the current format helper). + * + * @param pHelper - Pointer to a ring format helper. This must have been + * constructed with new. + */ +void +CRingBufferDecoder::setDefaultFormatHelper(CRingFormatHelper* pHelper) +{ + m_pDefaultHelper = pHelper; +} +/** + * getCurrentFormatHelper + * + * Returns a pointer to the current format helper. Note that if there is not + * one yet, this returns a null. Receiving a null does not imply that + * a ring item will cause the decoder to fail as there is also a default helper + * potentially defined iwth setDefaultFormatHelper and a hardwired fallback + * helper. The fallback helper is guaranteed to exist. + * + * @return CRingFormatHelper* + */ +CRingFormatHelper* +CRingBufferDecoder::getCurrentFormatHelper() +{ + return m_pCurrentHelper; +} +/** + * getDefaultHelper + * + * Returns a pointer to the default format helper. + * + * @return CRingFormatHelper* + */ +CRingFormatHelper* +CRingBufferDecoder::getDefaultFormatHelper() +{ + return m_pDefaultHelper; +} + +/*---------------------------------------------------------------------------- + * Callbacks during data analysis: + */ + +/** + * OnSourceAttach + * Called when a new data source is being attached. + */ +void +CRingBufferDecoder::OnSourceAttach() +{ + // A new data source invalidates the current helper: + + invalidateCurrentHelper(); +} +/** + * OnSourceDetach + * + * Called when this is being detached from the analyzer. + */ +void +CRingBufferDecoder::OnSourceDetach() +{ + invalidateCurrentHelper(); +} +/** + * OnEndFile + * + * Called when we reached the end of an input data source. + */ +void +CRingBufferDecoder::OnEndFile() +{ + invalidateCurrentHelper(); +} + /////////////////////////////////////////////////////////////////// // // Non-public utility functions: @@ -516,11 +686,26 @@ uint32_t size = m_pTranslator->TranslateLong(pItem->s_header.s_size); uint32_t type = m_pTranslator->TranslateLong(pItem->s_header.s_type); m_pTranslator->newBuffer(pItem); - m_pBody = (pItem->s_body); + m_nBodySize = size - sizeof(RingItemHeader); m_nCurrentItemType = mapType(type); - + // If we have a ring format item that gives us the current helper: + + if (type == RING_FORMAT) { + invalidateCurrentHelper(); + CRingFormatHelperFactory fact; + m_pCurrentHelper = fact.create(pItem); + } + // Now get the correct helper to use: + + CRingFormatHelper* pHelper = getFormatHelper(); + + // From here on in we use pHelper's methods to fish stuff out of the item. + + m_pCurrentRingItem = pItem; // So that callbacks can do stuff. + m_pBody = pHelper->getBodyPointer(pItem); + // The remainder of this is item type dependent: @@ -530,9 +715,9 @@ case PAUSE_RUN: case RESUME_RUN: { - pStateChangeItem pState = reinterpret_cast<pStateChangeItem>(pItem); - m_title = pState->s_title; - m_runNumber = m_pTranslator->TranslateLong(pState->s_runNumber); + + m_title = pHelper->getTitle(pItem); + m_runNumber = pHelper->getRunNumber(pItem, m_pTranslator); m_nEntityCount = 0; m_pAnalyzer->OnStateChange(m_nCurrentItemType, *this); } @@ -541,15 +726,14 @@ case PACKET_TYPES: case MONITORED_VARIABLES: { - pTextItem pText = reinterpret_cast<pTextItem>(pItem); - m_nEntityCount = m_pTranslator->TranslateLong(pText->s_stringCount); + m_nEntityCount = pHelper->getStringCount(pItem, m_pTranslator); m_pAnalyzer->OnOther(m_nCurrentItemType, *this); } break; - case INCREMENTAL_SCALERS: + case PERIODIC_SCALERS: { - pScalerItem pScalers = reinterpret_cast<pScalerItem>(pItem); - m_nEntityCount = m_pTranslator->TranslateLong(pScalers->s_scalerCount); + + m_nEntityCount = pHelper->getScalerCount(pItem, m_pTranslator); m_pAnalyzer->OnScaler(*this); } break; @@ -563,8 +747,8 @@ case PHYSICS_EVENT_COUNT: { - pPhysicsEventCountItem pTriggers = reinterpret_cast<pPhysicsEventCountItem>(pItem); - m_nTriggerCount = m_pTranslator->TranslateLong(pTriggers->s_eventCount); + + m_nTriggerCount = pHelper->getTriggerCount(pItem, m_pTranslator); m_pAnalyzer->OnOther(m_nCurrentItemType, *this); } break; @@ -574,7 +758,7 @@ m_pAnalyzer->OnOther(m_nCurrentItemType, *this); break; } - + m_pCurrentRingItem = 0; // NO longer have a current item. } @@ -597,7 +781,8 @@ typeMapping[RESUME_RUN] = RESUMEBF; typeMapping[PACKET_TYPES] = PKTDOCBF; typeMapping[MONITORED_VARIABLES] = RUNVARBF; - typeMapping[INCREMENTAL_SCALERS] = SCALERBF; + typeMapping[PERIODIC_SCALERS] = SCALERBF; + typeMapping[NSCLDAQ10::INCREMENTAL_SCALERS] = SCALERBF; typeMapping[PHYSICS_EVENT] = DATABF; mapSetup = true; @@ -635,3 +820,35 @@ } +/** + * getFormatHelper + * + * Figure out which format helper to use + * * If m_pCurrentHelper is defined use that. + * * If not and m_pDefaultHelper is defined use that. + * * If all else fails, use m_pFallbackHelper. + * + * @return CRingFormatHelper* + */ +CRingFormatHelper* +CRingBufferDecoder::getFormatHelper() +{ + CRingFormatHelper* pHelper = m_pCurrentHelper; + if (!pHelper) pHelper = m_pDefaultHelper; + if (!pHelper) pHelper = m_pFallbackHelper; + + return pHelper; +} + +/** + * invalidateCurrentHelper + * + * Called when an event has occured that casts doubt on the validity of + * the current helper. + */ +void +CRingBufferDecoder::invalidateCurrentHelper() +{ + delete m_pCurrentHelper; + m_pCurrentHelper = reinterpret_cast<CRingFormatHelper*>(0); +} \ No newline at end of file Modified: branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h 2013-04-17 13:49:57 UTC (rev 2073) +++ branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -37,7 +37,8 @@ #endif class BufferTranslator; - +class CRingFormatHelper; +class CRingFormatHelperFactory; /*! This class defines a buffer decoder that knows how to take data from the NSCL DAQ Ring buffer distribution system. This includes event @@ -76,8 +77,13 @@ uint32_t* m_pGluedBuffer; // Buffer glued together from last and current buffer. uint32_t m_nGlueSize; // # bytes in the glued buffer when first made. - CAnalyzer* m_pAnalyzer; + CAnalyzer* m_pAnalyzer; // Pointer to the associated analyzer. + CRingFormatHelper* m_pCurrentHelper; // Pointer to the current format helper. + CRingFormatHelper* m_pDefaultHelper; // Pointer to a default format helper. + CRingFormatHelper* m_pFallbackHelper; // 'hard coded' format helper. + void* m_pCurrentRingItem; // Item the access methods work on. + CRingFormatHelperFactory* m_pFactory; // Canonical operations: @@ -109,9 +115,27 @@ virtual BufferTranslator* getBufferTranslator(); virtual bool blockMode(); // True if data source must deliver fixed sized blocks. + + // Format helpers and stuff that gets you at what they know. + + bool hasBodyHeader(); + void* getBodyHeaderPointer(); + void* getItemPointer(); + void setFormatHelper(CRingFormatHelper* pHelper); + void setDefaultFormatHelper(CRingFormatHelper* pHelper); + CRingFormatHelper* getCurrentFormatHelper(); + CRingFormatHelper* getDefaultFormatHelper(); + + // Members called that can invalidate the format helper: + + virtual void OnSourceAttach(); + virtual void OnSourceDetach(); + virtual void OnEndFile(); + + private: void createTranslator(); void processBuffer(); @@ -119,6 +143,8 @@ void dispatchEvent(void* pEvent); UInt_t mapType(UInt_t type); void createPartialEvent(); + CRingFormatHelper* getFormatHelper(); + void invalidateCurrentHelper(); }; Deleted: branches/SpecTcl-3.4/DecoderRing/DataFormat.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/DataFormat.h 2013-04-17 13:49:57 UTC (rev 2073) +++ branches/SpecTcl-3.4/DecoderRing/DataFormat.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -1,177 +0,0 @@ -#ifndef __DATAFORMAT_H -#define __DATAFORMAT_H - -/* - This software is Copyright by the Board of Trustees of Michigan - State University (c) Copyright 2005. - - You may use this software under the terms of the GNU public license - (GPL). The terms of this license are described at: - - http://www.gnu.org/licenses/gpl.txt - - Author: - Ron Fox - NSCL - Michigan State University - East Lansing, MI 48824-1321 -*/ - -/*! - \file DataFormat.h - This file contains typedefs for the structures that will be put into - ring buffers for event data. Event data Ring buffers are filled with items. - An item has the structure: - -\verbatim - +----------------------------------+ - | Size of item in bytes (32 bits) | - +----------------------------------+ - | 32 bit type code of item | - +----------------------------------+ - | body (size - 8 bytes of data | - +----------------------------------+ -\endverbatim - - Where the 32 bit type code is really a 16 bit type code stored in the lower 16 bits of the -32 bit word in the native byte ordering of the originating system. This allows it to serve as -a byte order indicator, as data type 0 is not legal, and the top bits of the type code must -be zero. - -*/ - -/* - Define the type codes for the items. - Applications can add user specific types if they use values that are at least - FIRST_USER_TYPE -*/ - - -#ifndef __CRT_STDINT_H -#include <stdint.h> -#ifndef __CRT_STDINT_H -#define __CRT_STDINT_H -#endif -#endif - -#ifndef __CRT_TIME_H -#include <time.h> -#ifndef __CRT_TIME_H -#define __CRT_TIME_H -#endif -#endif - -// state change item type codes: - -static const uint32_t BEGIN_RUN(1); -static const uint32_t END_RUN(2); -static const uint32_t PAUSE_RUN(3); -static const uint32_t RESUME_RUN(4); - -// Documentation item type codes: - -static const uint32_t PACKET_TYPES(10); -static const uint32_t MONITORED_VARIABLES(11); - -// Scaler data: - -static const uint32_t INCREMENTAL_SCALERS(20); - -// Physics events: - -static const uint32_t PHYSICS_EVENT(30); -static const uint32_t PHYSICS_EVENT_COUNT(31); - -// User defined item codes - -static const uint32_t FIRST_USER_ITEM_CODE(32768); /* 0x8000 */ - - -// Longest allowed title: - -#ifndef TITLE_MAXSIZE -#define TITLE_MAXSIZE 80 -#endif - - - -/*! All ring items have common header structures: */ - -typedef struct _RingItemHeader { - uint32_t s_size; - uint32_t s_type; -} RingItemHeader, *pRingItemHeader; - -/*! - This is the most basic item.. a generic item. It consists only of the - header and a generic body -*/ - -typedef struct _RingItem { - RingItemHeader s_header; - uint8_t s_body[1]; -} RingItem, *pRingItem; - - -/*! - Run state changes are documented by inserting state change items that have the - structure shown below: - -*/ -typedef struct _StateChangeItem { - RingItemHeader s_header; - uint32_t s_runNumber; - uint32_t s_timeOffset; - uint32_t s_Timestamp; - char s_title[TITLE_MAXSIZE+1]; -} StateChangeItem, *pStateChangeItem; - -/*! - Scaler items contain run time counters. -*/ - -typedef struct _ScalerItem { - RingItemHeader s_header; - uint32_t s_intervalStartOffset; - uint32_t s_intervalEndOffset; - uint32_t s_timestamp; - uint32_t s_scalerCount; - uint32_t s_scalers[1]; -} ScalerItem, *pScalerItem; - -/*! - The various documentation Events are just a bunch of null terminated strings that - are back to back in the body of the ring buffer. item. -*/ - -typedef struct _TextItem { - RingItemHeader s_header; - uint32_t s_timeOffset; - uint32_t s_timestamp; - uint32_t s_stringCount; - char s_strings[1]; -} TextItem, *pTextItem; - -/*! - For now a physics event is just a header and a body of uint16_t's. -*/ - -typedef struct _PhysicsEventItem { - RingItemHeader s_header; - uint16_t s_body[1]; -} PhysicsEventItem, *pPhysicsEventItem; - -/*! - Clients that sample physics events will often - need to know how many physics events have been produced - so that they can figure out the sampling fraction. -*/ -typedef struct __PhysicsEventCountItem { - RingItemHeader s_header; - uint32_t s_timeOffset; - uint32_t s_timestamp; - uint64_t s_eventCount; /* Maybe 4Gevents is too small ;-) */ -} PhysicsEventCountItem, *pPhysicsEventCountItem; - - -#endif Added: branches/SpecTcl-3.4/DecoderRing/DataFormat.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/DataFormat.h (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/DataFormat.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,369 @@ +#ifndef __DATAFORMAT_H +#define __DATAFORMAT_H + +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2005. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +/*! + \file DataFormat.h + This file contains typedefs for the structures that will be put into + ring buffers for event data. Event data Ring buffers are filled with items. + An item has the structure: + +\verbatim + +----------------------------------+ + | Size of item in bytes (32 bits) | + +----------------------------------+ + | 32 bit type code of item | + +----------------------------------+ + | body (size - 8 bytes of data | + +----------------------------------+ +\endverbatim + + Where the 32 bit type code is really a 16 bit type code stored in the lower 16 bits of the +32 bit word in the native byte ordering of the originating system. This allows it to serve as +a byte order indicator, as data type 0 is not legal, and the top bits of the type code must +be zero. + + Further as of nscldaq-11.0, each body has a minimal form of: + +\verbatim + +typedef struct _DataSourceHeader { + uint32_t s_size; // sizeof(DataSourceHeader) + uint64_t s_timestamp; + uint32_t s_sourceId; + int32_t s_barrier; +} DataSourceHeader, *pDataSourceHeader; + +typedef union _BodyHeader { + uint32_t s_mbz; // Contains zero. + DataSourceHeader s_header; // Has full header. +} BodyHeader; + +struct Body { + BodyHeader s_bodyhdr; + uint8_t s_body[1] +}; + + +\endverbatim + +Due to the way in which C/C++ compute structure sizes, however the definition +cannot be expressed this way or else all items will appear to have a body header +in them even if they don't Therefore the actual union must have the actual +body in both branches of the union thus: + +\verbatim + +typdef union Body { + struct { + uint32_t s_mbz; + uint8_t s_body[1]; + } u_noHader; + struct { + BodyHeader s_bodyHeader; + uint8_t s_body[1]; + } u_hasHeader; +} Body; + +\endverbatim + +*/ + +/* + Define the type codes for the items. + Applications can add user specific types if they use values that are at least + FIRST_USER_TYPE +*/ + + +#ifndef __CRT_STDINT_H +#include <stdint.h> +#ifndef __CRT_STDINT_H +#define __CRT_STDINT_H +#endif +#endif + +#ifndef __CRT_TIME_H +#include <time.h> +#ifndef __CRT_TIME_H +#define __CRT_TIME_H +#endif +#endif + +// 11.0 and later define a format item that starts the run. +// so that decoders know what format the ring is in. + +static const uint16_t FORMAT_MAJOR = 11; /* nscldaq-11. */ +static const uint16_t FORMAT_MINOR = 0; /* nscldaq-x.0 */ + +// state change item type codes: + +static const uint32_t BEGIN_RUN = 1; +static const uint32_t END_RUN = 2; +static const uint32_t PAUSE_RUN = 3; +static const uint32_t RESUME_RUN = 4; + +// Documentation item type codes: + +static const uint32_t PACKET_TYPES = 10; +static const uint32_t MONITORED_VARIABLES = 11; +static const uint32_t RING_FORMAT = 12; /* Has format major/minor in it. */ + +// Scaler data: + +static const uint32_t PERIODIC_SCALERS = 20; + + +// Note timestamped nonincremental scalers absorbed into incremental scalers. + +// Physics events: + +static const uint32_t PHYSICS_EVENT = 30; +static const uint32_t PHYSICS_EVENT_COUNT = 31; + + +// Event builder related items: + +static const uint32_t EVB_FRAGMENT = 40; /* Event builder fragment. */ +static const uint32_t EVB_UNKNOWN_PAYLOAD = 41; /* Evb fragment whose payload isn't a ring item */ +static const uint32_t EVB_GLOM_INFO = 42; /* GLOM Parameters. */ + +// User defined item codes + +static const uint32_t FIRST_USER_ITEM_CODE = 32768; /* 0x8000 */ + + +// Longest allowed title: + +#ifndef TITLE_MAXSIZE +#define TITLE_MAXSIZE 80 +#endif + + + +/*! All ring items have common header structures: */ + +typedef struct _RingItemHeader { + uint32_t s_size; + uint32_t s_type; +} RingItemHeader, *pRingItemHeader; + +/*! + Bodies either have a body item or a longword zero for the body item header + size field (11.0 and later) +*/ + +typedef struct _BodyHeader { + uint32_t s_size; /* 0 or sizeof(DataSourceHeader) */ + uint64_t s_timestamp; + uint32_t s_sourceId; + uint32_t s_barrier; +} BodyHeader, *pBodyHeader; + + + +/*! + This is the most basic item.. a generic item. It consists only of the + header and a generic body +*/ + +typedef struct _RingItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; + uint8_t s_body[1]; + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + uint8_t s_body[1]; + } u_hasBodyHeader; + } s_body; +} RingItem, *pRingItem; + + +/*! + Run state changes are documented by inserting state change items that have the + structure shown below. After 11.0, they may or mey not have abody header + as reflected by the fact that they contain a union as shown below: + +*/ +typedef struct _StateChangeItemBody { + uint32_t s_runNumber; + uint32_t s_timeOffset; + uint32_t s_Timestamp; + uint32_t s_offsetDivisor; + char s_title[TITLE_MAXSIZE+1]; +} StateChangeItemBody, *pStateChangeItemBody; + +typedef struct _StateChangeItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; /* Must be zero - no body header*/ + StateChangeItemBody s_body; + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + StateChangeItemBody s_body; + } u_hasBodyHeader; + } s_body; + +} StateChangeItem, *pStateChangeItem; + +/*! + Scaler items contain run time counters. As of 11.0 they may or may not have + a body header too: +*/ + +typedef struct _ScalerItemBody { + uint32_t s_intervalStartOffset; + uint32_t s_intervalEndOffset; + uint32_t s_timestamp; + uint32_t s_intervalDivisor; /* 11.0 sub second time intervals */ + uint32_t s_scalerCount; + uint32_t s_isIncremental; /* 11.0 non-incremental scaler flag */ + uint32_t s_scalers[1]; +} ScalerItemBody, *pScalerItemBody; + +typedef struct _ScalerItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; /* Must be zero .. no header */ + ScalerItemBody s_body; + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + ScalerItemBody s_body; + } u_hasBodyHeader; + } s_body; +} ScalerItem, *pScalerItem; + + +/*! + The various documentation Events are just a bunch of null terminated strings that + are back to back in the body of the ring buffer. item. +*/ + +typedef struct _TextItemBody { + uint32_t s_timeOffset; + uint32_t s_timestamp; + uint32_t s_stringCount; + uint32_t s_offsetDivisor; + char s_strings[1]; +} TextItemBody, *pTextItemBody; + +typedef struct _TextItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; /* Must be zero (no body header) */ + TextItemBody s_body; + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + TextItemBody s_body; + } u_hasBodyHeader; + } s_body; +} TextItem, *pTextItem; + + +/*! + For now a physics event is just a header and a body of uint16_t's. +*/ + +typedef struct _PhysicsEventItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; + uint16_t s_body[1]; /* Aribrtary length body */ + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + uint16_t s_body[1]; + } u_hasBodyHeader; + } s_body; +} PhysicsEventItem, *pPhysicsEventItem; + +/*! + Clients that sample physics events will often + need to know how many physics events have been produced + so that they can figure out the sampling fraction. +*/ +typedef struct __PhysicsEventCountItemBody { + uint32_t s_timeOffset; + uint32_t s_offsetDivisor; + uint32_t s_timestamp; + uint64_t s_eventCount; /* Maybe 4Gevents is too small ;-) */ +} PhysicsEventCountItemBody, *pPhysicsEventCountItemBody; + +typedef struct _PhysicsEventCountItem { + RingItemHeader s_header; + union { + struct { + uint32_t s_mbz; /* Must be zero - no body header*/ + PhysicsEventCountItemBody s_body; + } u_noBodyHeader; + struct { + BodyHeader s_bodyHeader; + PhysicsEventCountItemBody s_body; + } u_hasBodyHeader; + } s_body; +} PhysicsEventCountItem, *pPhysicsEventCountItem; + +/** + * Event builder stages can put event fragments into the + * ring buffer for monitoring software: + * (EVB_FRAGMENT): + */ +typedef struct _EventBuilderFragment { + RingItemHeader s_header; + BodyHeader s_bodyHeader; + uint8_t s_body[1]; /* Really s_payload bytes of data.. */ +} EventBuilderFragment, *pEventBuilderFragment; + +/** + * The ring item format never has an event header. Just major and minor + * version numbers: + */ + +typedef struct _DataFormat { + RingItemHeader s_header; + uint32_t s_mbz; /* No body header */ + uint16_t s_majorVersion; /* FORMAT_MAJOR */ + uint16_t s_minorVersion; /* FORMAT_MINOR */ +} DataFormat, *pDataFormat; + +/** + * Information about glom parameters: + */ +typedef struct _GlomParameters { + RingItemHeader s_header; + uint32_t s_mbz; + uint64_t s_coincidenceTicks; + uint16_t s_isBuilding; + +} GlomParameters, *pGlomParameters; +/** + Below are functions that are available to format ring types. + Note that all of these return a pointer that must be free(3)'d. +*/ + +#endif Copied: branches/SpecTcl-3.4/DecoderRing/DataFormatPre11.h (from rev 2072, branches/SpecTcl-3.4/DecoderRing/DataFormat.h) =================================================================== --- branches/SpecTcl-3.4/DecoderRing/DataFormatPre11.h (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/DataFormatPre11.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,177 @@ +#ifndef __DATAFORMATPRE10_H +#define __DATAFORMATPRE10_H + +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2005. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +/*! + \file DataFormat.h + This file contains typedefs for the structures that will be put into + ring buffers for event data. Event data Ring buffers are filled with items. + An item has the structure: + +\verbatim + +----------------------------------+ + | Size of item in bytes (32 bits) | + +----------------------------------+ + | 32 bit type code of item | + +----------------------------------+ + | body (size - 8 bytes of data | + +----------------------------------+ +\endverbatim + + Where the 32 bit type code is really a 16 bit type code stored in the lower 16 bits of the +32 bit word in the native byte ordering of the originating system. This allows it to serve as +a byte order indicator, as data type 0 is not legal, and the top bits of the type code must +be zero. + +*/ +namespace NSCLDAQ10 { +/* + Define the type codes for the items. + Applications can add user specific types if they use values that are at least + FIRST_USER_TYPE +*/ + + +#ifndef __CRT_STDINT_H +#include <stdint.h> +#ifndef __CRT_STDINT_H +#define __CRT_STDINT_H +#endif +#endif + +#ifndef __CRT_TIME_H +#include <time.h> +#ifndef __CRT_TIME_H +#define __CRT_TIME_H +#endif +#endif + +// state change item type codes: + +static const uint32_t BEGIN_RUN(1); +static const uint32_t END_RUN(2); +static const uint32_t PAUSE_RUN(3); +static const uint32_t RESUME_RUN(4); + +// Documentation item type codes: + +static const uint32_t PACKET_TYPES(10); +static const uint32_t MONITORED_VARIABLES(11); + +// Scaler data: + +static const uint32_t INCREMENTAL_SCALERS(20); + +// Physics events: + +static const uint32_t PHYSICS_EVENT(30); +static const uint32_t PHYSICS_EVENT_COUNT(31); + +// User defined item codes + +static const uint32_t FIRST_USER_ITEM_CODE(32768); /* 0x8000 */ + + +// Longest allowed title: + +#ifndef TITLE_MAXSIZE +#define TITLE_MAXSIZE 80 +#endif + + + +/*! All ring items have common header structures: */ + +typedef struct _RingItemHeader { + uint32_t s_size; + uint32_t s_type; +} RingItemHeader, *pRingItemHeader; + +/*! + This is the most basic item.. a generic item. It consists only of the + header and a generic body +*/ + +typedef struct _RingItem { + RingItemHeader s_header; + uint8_t s_body[1]; +} RingItem, *pRingItem; + + +/*! + Run state changes are documented by inserting state change items that have the + structure shown below: + +*/ +typedef struct _StateChangeItem { + RingItemHeader s_header; + uint32_t s_runNumber; + uint32_t s_timeOffset; + uint32_t s_Timestamp; + char s_title[TITLE_MAXSIZE+1]; +} StateChangeItem, *pStateChangeItem; + +/*! + Scaler items contain run time counters. +*/ + +typedef struct _ScalerItem { + RingItemHeader s_header; + uint32_t s_intervalStartOffset; + uint32_t s_intervalEndOffset; + uint32_t s_timestamp; + uint32_t s_scalerCount; + uint32_t s_scalers[1]; +} ScalerItem, *pScalerItem; + +/*! + The various documentation Events are just a bunch of null terminated strings that + are back to back in the body of the ring buffer. item. +*/ + +typedef struct _TextItem { + RingItemHeader s_header; + uint32_t s_timeOffset; + uint32_t s_timestamp; + uint32_t s_stringCount; + char s_strings[1]; +} TextItem, *pTextItem; + +/*! + For now a physics event is just a header and a body of uint16_t's. +*/ + +typedef struct _PhysicsEventItem { + RingItemHeader s_header; + uint16_t s_body[1]; +} PhysicsEventItem, *pPhysicsEventItem; + +/*! + Clients that sample physics events will often + need to know how many physics events have been produced + so that they can figure out the sampling fraction. +*/ +typedef struct __PhysicsEventCountItem { + RingItemHeader s_header; + uint32_t s_timeOffset; + uint32_t s_timestamp; + uint64_t s_eventCount; /* Maybe 4Gevents is too small ;-) */ +} PhysicsEventCountItem, *pPhysicsEventCountItem; + +} +#endif Modified: branches/SpecTcl-3.4/DecoderRing/Makefile.am =================================================================== --- branches/SpecTcl-3.4/DecoderRing/Makefile.am 2013-04-17 13:49:57 UTC (rev 2073) +++ branches/SpecTcl-3.4/DecoderRing/Makefile.am 2013-04-18 14:25:05 UTC (rev 2074) @@ -1,12 +1,19 @@ lib_LTLIBRARIES = libDecoderRing.la -libDecoderRing_la_SOURCES = CRingBufferDecoder.cpp +libDecoderRing_la_SOURCES = CRingBufferDecoder.cpp RingFormatHelper.cpp RingFormatHelper10.cpp + RingFormatHelper11.cpp RingFormatHelperFactory.cpp \ + RingFormatHelperCreator.cpp RingFormatHelper10Creator.cpp \ + RingFormatHelper11Creator.cpp -noinst_HEADERS = DataFormat.h -include_HEADERS = CRingBufferDecoder.h +noinst_HEADERS = DataFormatPre11.h DataFormat.h +include_HEADERS = CRingBufferDecoder.h RingFormatHelper.h RingFormatHelper10.h \ + RingFormatHelper11.h RingFormatHelperFactory.h \ + RingFormatHelperCreator.h RingFormatHelper10Creator.h \ + RingFormatHelper11Creator.h + INCLUDES = -I@top_srcdir@/Utility \ -I@top_srcdir@/Events \ -I@top_srcdir@/NSCLException \ Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.cpp (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.cpp 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,98 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +/** + * @file RingFormatHelper.cpp + * @brief Empty implementations of the supported canonicals. + * @note The comparison ops are pathalogical and should not be chained to for + * obvious reasons. + */ + +#include "RingFormatHelper.h" +#include "DataFormatPre11.h" + +/** + * constructor - default + * NO-OP. + */ +CRingFormatHelper::CRingFormatHelper() {} + +/** + * destructor + */ +CRingFormatHelper::~CRingFormatHelper() {} + +/** + * Copy constructor + */ +CRingFormatHelper::CRingFormatHelper(const CRingFormatHelper& rhs) +{} + +/** + * assignment + */ +CRingFormatHelper& +CRingFormatHelper::operator=(const CRingFormatHelper& rhs) +{ + return *this; +} +/** + * Comparison for == + * + * Pathalogical - all empty objects are equal to all others. + */ +int +CRingFormatHelper::operator==(const CRingFormatHelper& rhs) const +{ + return 1; +} +/** + * Comparison for != + * Pathalogical - All empty objects are unequal too. + */ +int +CRingFormatHelper::operator!=(const CRingFormatHelper& rhs) const +{ + return 1; +} + +/*----------------------------------------------------------------------------- + * Private utilities: + */ +/** + * itemType + * Returns the type of a ring item. + * + * @param pItem - pointer to a ring item. + * + * @return uint16_t the item type + */ +uint16_t +CRingFormatHelper::itemType(void* pItem) +{ + NSCLDAQ10::pRingItemHeader p = + reinterpret_cast<NSCLDAQ10::pRingItemHeader>(pItem); + + // Note that since the most significant word of this is zero, + // the type is loworder | swab(highorder). + + uint16_t type = p->s_type; + uint16_t top = p->s_type >> 16; + uint16_t tops; + swab(&top, &tops, 2); + + return type | tops; +} \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.h (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,96 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +#ifndef _RINGFORMATHELPER_H +#define _RINGFORMATHELPER_H + +#ifndef _STL_STRING +#include <string> +#ifndef _STL_STRING +#define _STL_STRING +#endif +#endif + +#ifndef __STDINT_H +#include <stdint.h> +#ifndef __STDINT_H +#define __STDINT_H +#endif +#endif +/** + * @file RingFormatHelper.h + * @brief Definition of the abstract base class for Ring Format helpers + */ + +class BufferTranslator; + +/** + * @class CRingFormatHelper + * + * This is the abstract base class of a class hierarchy that is intended + * to help CRingDecoder determine where bits and pieces of a ring item + * are. This can vary between ring buffer format levels. The idea therefore + * is that a CRingDecoder has the 'right' one of these to help it out and does + * not need any internal code that is version aware. That, of course, begs the + * question of how it gets that helper. + */ +class CRingFormatHelper +{ + // Canonicals - All are defined as public, but subclasses can certainly + // turn somoe off themselves. + +public: + CRingFormatHelper(); + virtual ~CRingFormatHelper(); + CRingFormatHelper(const CRingFormatHelper&); + CRingFormatHelper& operator=(const CRingFormatHelper&); + int operator==(const CRingFormatHelper&) const; + int operator!=(const CRingFormatHelper&) const; + + // These methods are what the subclasses need to implement: + +public: + // Generic methods: + + virtual bool hasBodyHeader(void* pItem) const = 0; + virtual void* getBodyPointer(void* pItem) = 0; + virtual void* getBodyHeaderPointer(void* pItem) = 0; + + // Methods specific to state transitions: + + virtual std::string getTitle(void* pItem) = 0; + virtual unsigned getRunNumber( + void* pItem, BufferTranslator* pTranslator) = 0; + + // Methods specific to string lists: + + virtual unsigned getStringCount( + void* pItem, BufferTranslator* pTranslator) = 0; + + // Methods specific to scaler items: + + virtual unsigned getScalerCount( + void* pItem, BufferTranslator* pTranslator) = 0; + + // Methods specific to trigger count items + + virtual uint64_t getTriggerCount( + void* pItem, BufferTranslator* pTranslator) = 0; + + uint16_t itemType(void* pItem); + +}; +#endif \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.cpp (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.cpp 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,259 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ +#include "RingFormatHelper10.h" +#include "DataFormatPre11.h" // Version 10.x ring formats. +#include <BufferTranslator.h> +#include <unistd.h> + +/** + * hasBodyHeader + * + * No version 10.x ring items have body headers: + * + * @param pItem - Actually an NSCLDAQ10::pRingItem + * + * @return bool -false. + */ +bool +CRingFormatHelper10::hasBodyHeader(void* pItem) const +{ + return false; +} +/** + * getBodyPointer + * + * Returns a pointer to the body of the ring item. This is unconditionally + * the storage unit that just follows the ring item header. + * + * @param pItem - Actually an NSCLDAQ10::pRingItem. + * + * @return void* - Pointer to the ring item body... regardless of what it + * looks like. + */ +void* +CRingFormatHelper10::getBodyPointer(void* pItem) +{ + NSCLDAQ10::pRingItem p = reinterpret_cast<NSCLDAQ10::pRingItem>(pItem); + return reinterpret_cast<void*>((p->s_body)); +} +/** + * getBodyHeaderPointer + * + * Since no items in NSCLDAQ-10.0 have a body header, a null pointer is + * returned. + * + * @param pItem - actually an NSCLDAQ10::pRingItem + * + * @return void* null. + */ +void* +CRingFormatHelper10::getBodyHeaderPointer(void* pItem) +{ + return reinterpret_cast<void*>(0); +} + +// State change specific methods: + +/** + * getTitle + * Return the title string from a state transition item. + * + * @param pItem - Pointer to what should be a state transition item. + * + * @return std::string - the title. + * + * @throw std::string - if the item is not a state transition item. + */ +std::string +CRingFormatHelper10::getTitle(void* pItem) +{ + if (isStateTransition(pItem)) { + NSCLDAQ10::pStateChangeItem p = + reinterpret_cast<NSCLDAQ10::pStateChangeItem>(pItem); + return std::string(p->s_title); + } else { + throw std::string("CRingFormatHelper10::getTitle - not state change item"); + } +} +/** + * getRunNumber + * + * Return the run number from a state transition item. + * + * @param pItem - pointer to the state change item. + * @param pTranslator - The translator that understands byte order conversions. + * + * @return unsigned - Run nunmber. + * + * @throw std::string - if the item is nto a state transition item. + */ +unsigned +CRingFormatHelper10::getRunNumber(void* pItem, BufferTranslator* pTranslator) +{ + if (isStateTransition(pItem)) { + NSCLDAQ10::pStateChangeItem p = + reinterpret_cast<NSCLDAQ10::pStateChangeItem>(pItem); + return pTranslator->TranslateLong(p->s_runNumber); + } else { + throw std::string("CRingFormatHelper10::getRunNumber - not state transition item"); + } +} + +// String item specific methods. + +/** + * getStringCount + * + * Returns the number of strings in a string item. + * + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to a translator that knows how to convert byte + * order diffefrences between the source and the host. + * @return unsigned + * + * @throw std::string - The item is not a string item type. + */ +unsigned +CRingFormatHelper10::getStringCount(void* pItem, BufferTranslator* pTranslator) +{ + if (isTextItem(pItem)) { + NSCLDAQ10::pTextItem p = reinterpret_cast<NSCLDAQ10::pTextItem>(pItem); + return pTranslator->TranslateLong(p->s_stringCount); + } else { + throw std::string("CRingFormatHelper10::getStringCount - not text item"); + } +} + +// Scaler item specific methods. + +/** + * getScalerCount + * + * Returns the number of scalers in a scaler item. + * + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to the byte order translator object. + * + * @return unsigned - Number of scalers. + * + * @throw std::string - If the item is not a scaler item. + */ +unsigned +CRingFormatHelper10::getScalerCount(void* pItem, BufferTranslator* pTranslator) +{ + if (isScalerItem(pItem)) { + NSCLDAQ10::pScalerItem p = reinterpret_cast<NSCLDAQ10::pScalerItem>(pItem); + return pTranslator->TranslateLong(p->s_scalerCount); + } else { + throw std::string("CRingFormatHelper10::getScalerCount - Not scaler item"); + } +} +// Trigger count specific methods: + +/** + * getTriggerCount + * + * Return the number of triggers seen so far from a trigger count item. + * + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to the appropriate byte order translator object. + * + * @return uint64_t trigger count. + * + * @throw std::string - if the item is not a trigger count item. + */ +uint64_t +CRingFormatHelper10::getTriggerCount(void* pItem, BufferTranslator* pTranslator) +{ + if (isTriggerItem(pItem)) { + NSCLDAQ10::pPhysicsEventCountItem p = + reinterpret_cast<NSCLDAQ10::pPhysicsEventCountItem>(pItem); + return pTranslator->getQuad(p->s_eventCount); + } else { + throw std::string( + "CRingFormatHelper10::getTriggerCount - not trigger count item" + ); + } +} +/*----------------------------------------------------------------------------- + * Private utilites: + */ + + +/** + * isStateTransition + * + * Returns true if the item is a state transition item. + * + * @param pItem - pointer to the item. + * + * @return bool - true for state transitions false if not. + */ +bool +CRingFormatHelper10::isStateTransition(void* pItem) +{ + uint16_t type = itemType(pItem); + + return ( + (type == NSCLDAQ10::BEGIN_RUN) + || (type == NSCLDAQ10::END_RUN) + || (type == NSCLDAQ10::PAUSE_RUN) + || (type == NSCLDAQ10::RESUME_RUN) + ); +} +/** + * isTextItem + * + * @param pItem - Pointer to a ring item. + * @return bool - true if the item is a text item, false otherwise. + */ +bool +CRingFormatHelper10::isTextItem(void* pItem) +{ + uint16_t type = itemType(pItem); + + return ( + (type == NSCLDAQ10::PACKET_TYPES) + || (type == NSCLDAQ10::MONITORED_VARIABLES) + ); +} +/** + * isScalerItem + * + * @param pItem - Pointer to a ring item. + * @return bool - true if the item is a scaler item false otherwise. + * + * @note Only the INCREMENTAL_SCALER type satisfies this because + * the shape of the S800 scaler events are so much diferent. + */ +bool +CRingFormatHelper10::isScalerItem(void* pItem) +{ + uint16_t type = itemType(pItem); + + return type == NSCLDAQ10::INCREMENTAL_SCALERS; +} +/** + * isTriggerItem + * + * @param pItem - Pointer to a ring item. + * @return bool - True if the item type is PHYSICS_EVENT_COUNT. + * false otherwise. + */ +bool CRingFormatHelper10::isTriggerItem(void* pItem) +{ + return itemType(pItem) == NSCLDAQ10::PHYSICS_EVENT_COUNT; +} \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.h (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,79 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +#ifndef _RINGFORMATHELPER10_H +#define _RINGFORMATHELPER10_H + +/** + * @file RingFormatHelper10.h + * @brief Defines class CRingFormatHelper10 which understands NSCLDAQ-10.0 ring items. + */ + +#ifndef _RINGFORMATHELPER_H +#include "RingFormatHelper.h" +#endif + + +/** + * @class CRingFormatHelper10 + * + * This class is a ring format helper that understands the shape of ring items + * in NSCLDAQ-10.x + */ +class CRingFormatHelper10 : public CRingFormatHelper +{ + // No member data so non need for the canonicals: + +public: + // Generic ring item access methods: + + virtual bool hasBodyHeader(void* pItem) const; + virtual void* getBodyPointer(void* pItem); + virtual void* getBodyHeaderPointer(void* pItem); + + // Specific access methods: + + // Methods specific to state transitions: + + virtual std::string getTitle(void* pItem); + virtual unsigned getRunNumber( + void* pItem, BufferTranslator* pTranslator); + + // Methods specific to string lists: + + virtual unsigned getStringCount( + void* pItem, BufferTranslator* pTranslator); + + // Methods specific to scaler items: + + virtual unsigned getScalerCount( + void* pItem, BufferTranslator* pTranslator); + + // Methods specific to trigger count items + + virtual uint64_t getTriggerCount( + void* pItem, BufferTranslator* pTranslator); +private: + bool isStateTransition(void* pItem); + bool isTextItem(void* pItem); + bool isScalerItem(void* pItem); + bool isTriggerItem(void* pItem); + +}; + + + +#endif \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.cpp (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.cpp 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,54 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +/** + * @file RingFormatHelper10Creator.cpp + * @brief implemenet CRingFormatHelepr10Creator, creator of CRingFormatHelper10's. + */ + +#include "RingFormatHelper10Creator.h" +#include "RingFormatHelper10.h" + +/** + * Copy constructor -- placeholder for now + */ +CRingFormatHelper10Creator::CRingFormatHelper10Creator(constructorCRingFormatHelper10Creator& rhs) +{} + +/** + * clone + * + * Virtual copy constructor. + * + * @return CRingFormatHelperCreator - pointer to a new'd instance of *this. + */ +CRingFormatHelperCreator* +CRingFormatHelper10Creator::clone() const +{ + return new CRingFormatHelper10Creator(*this); +} +/** + * create + * + * Create a RingFormatHelper(10) and return it. + * + * @return CRingFormatHelper - (version 10.) + */ +CRingFormatHelper* +CRingFormatHelper10Creator::create() +{ + return new CRingFormatHelper10; +} \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.h (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper10Creator.h 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,50 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +#ifndef _RINGFORMATHELPER10CREATOR_H +#define _RINGFORMATHELPER10CREATOR_H + +#ifndef _RINGFORMATHELPERCREATOR_h +#include "RingFormatHelperCreator.h" +#endif + +/** + * @file RingFormatHelper10Creator + * @brief Defines CRingFormatHelper10Creator which makes CRingFormatHelper10's. + */ + +class CRingFormatHelper; + +/** + * @class CRingFormatHelper10Creator + * + * Creator class for helpers that understand the ring format for Version 10.x + */ +class CRingFormatHelper10Creator : public CRingFormatHelperCreator +{ + // Copy constructor: + +public: + CRingFormatHelper10Creator() {} + CRingFormatHelper10Creator(const CRingFormatHelper10Creator & rhs); + + // Virtual methods: + + virtual CRingFormatHelperCreator* clone() const; + virtual CRingFormatHelper* create(); +}; + +#endif \ No newline at end of file Added: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp (rev 0) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp 2013-04-18 14:25:05 UTC (rev 2074) @@ -0,0 +1,263 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ +/** + * @file RingFormatHelper11.cpp + * @brief Implement ring format helper for nscldaq-11.x+ + */ +#include "RingFormatHelper11.h" +#include "DataFormat.h" + + +/** + * hasBodyHeader + * + * Determines if a ring item has a body header. A body header is present + * if its size is nonzero. See DataFormat.h for more information about + * BodyHeader and the structure of data used here. + * + * @param pItem - Actually a pRingItem pointing to the item to decode. + * + * @return bool + * @retval true - the item has a nonempty body header. + * @retval false - the item has no body header data. + */ + bool + CRingFormatHelper11::hasBodyHeader(void* pItem) + { + pRingItem p = reinterpret_cast<pRingItem>(pItem); + + return (p->u_noBodyHeader.s_mbz != 0); + } + /** + * getBodyPointer + * + * Returns a pointer to the payload of the ring item. The payload + * does not include any body header. + * + * @param pItem - Pointer to the item, really a pRingItem. + * + * @return void* Pointer to the body. + */ + void* + CRingFormatHelper11::getBodyPointer(void* pItem) + { + pRingItem p = reinterpret_cast<pRingItem>(pItem); + + + if (hasBodyHeader(pItem)) { + return reinterpret_cast<void*>(p->u_hasBodyHeader.s_body); + } else { + return reinterpret_cast<void*>(p->u_noBodyHeader.s_body); + } + } + /** + * getBodyHeaderPointer + * + * Return a pointer to the body header. Note that if hasBodyHeader would + * return false, a null pointer is returned. + * + * @param pItem - Pointer to the item (actually a pRingitem) + * + * @return void* Pointer to the body header. + * @return null - No body header. + */ + void* + CRingFormatHelper11::getBodyHeaderPointer(void* pItem) + { + pRingItem p = reinterpret_cast<pRingItem>(pItem); + + if (hasBodyHeader(pItem)) { + return reinterpret_cast<void*>(&(p->u_hasBodyHeader.s_bodyHeader)); + } else { + return reinterpret_cast<void*>(0); + } + } + /*------------------------------------------------------------------------ + * Private utility methods. + */ + +// methods specific to state transition items. + +/** + * getTitle + * Return the title of a state transition item. + * + * @param pItem - Pointer to the ring item. + * + * @return std::string - run title. + * @throw std::string if the item is not a run state transition. + */ +std::string +CRingFormatHelper11::getTitle(void* pItem) +{ + if (isStateTransition(pItem)) { + pStateChangeItemBody p = + reinterpret_cast<pStateChangeItemBody>(getBodyPointer()); + return std::string(p->s_title); + } else { + throw std::string("CRingFormatHelper11::getTitle - not state transition"); + } +} +/** + * getRunNumber + * + * Return the run number from a state transition item. + * + * @param pItem - pointer to the item. + * @param pTranslator - pointer to the byte order converter appropriate to the sourc. + * + * @return unsigned - Run number. + * @throw std::string if the item is not a state transition item. + */ +unsigned +CRingFormatHelper11::getRunNumber(void* pItem, BufferTranslator* pTranslator) +{ + if (isStateTransition(pItem)) { + pStateChangeItemBody p = reinterpret_cast<pStateChangeItemBody>(pItem); + return pTranslator->TranslateLong(p->s_runNumber); + } else { + throw std::string("CRingFormatHelper11::getRunNumber - not state Transition"); + } +} + +// Methods specific to string lists: + +/** + * getStringCount + * Get the number of string items in a TextItem. + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to the byte order converter. + * + * @return unsigned - Number of scalers. + * @throw std::string - If the item is not a text item. + */ +unsigned +CRingFormatHelper11::getStringCount(void* pItem, BufferTranslator* pTranslator) +{ + if (isTextItem(pItem)) { + pTextItemBody p = reinterpret_cast<pTextitemBody>(pItem); + return pTranslator->TranslateLong(p->s_stringCount); + } else { + throw std::string("CRingFormatHelper11::getStringCount - not a text item."); + } +} +// Methods specific to scaler items. +/** + * getScalerCount + * + * Returns the number of scalers in a scaler item. + * + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to the appropriate byte order translator. + * + * @return unsigned - number of scalers. + * @throw std::string not a scaler item. + */ +unsigned +CRingFormatHelper11::getScalerCount(void* pItem, BufferTranslator* pTranslator) +{ + if (isScalerItem(pItem)) { + + } else { + throw std::string( + "CRingFormatHelper11::getScalerCount - not a scaler item." + ); + } +} +// Methods specific to trigger count items. + +/** + * getTriggerCount + * + * Return the number of triggers seen so far. + * + * @param pItem - Pointer to the item. + * @param pTranslator - Pointer to the appropriate translator. + * + * @return uint64_t + * @throw std::string if this is not a trigger item. + */ +... [truncated message content] |
From: <ro...@us...> - 2013-04-24 14:35:21
|
Revision: 2076 http://sourceforge.net/p/nsclspectcl/code/2076 Author: ron-fox Date: 2013-04-24 14:35:16 +0000 (Wed, 24 Apr 2013) Log Message: ----------- * Provide support code for NSCLDAQ-11/10 ring item decoding. * Issue # 1713, Issue# 1712 Support ringformat specification in all data source dialogs. In addtion add the format selection to the bottom of data source prompters that did not originally have them. * Issue #1659 Provide mechanisms for ring buffer analyzers to fish data out of the event body header if it exists. * Issue #1658 Add ability for CRingBufferDecoder to autoselect the format helper if a ring format item is seen in the input data. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.cpp branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.h branches/SpecTcl-3.4/Gui/datasource.tcl branches/SpecTcl-3.4/Gui/folderGui.tcl branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.cpp branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.h branches/SpecTcl-3.4/SpecTcl/Makefile.am Added Paths: ----------- branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.cpp branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.h Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/CHANGELOG 2013-04-24 14:35:16 UTC (rev 2076) @@ -1012,4 +1012,11 @@ 3.4 * Provide support code for NSCLDAQ-11/10 ring item decoding. - + * Issue # 1713, Issue# 1712 Support ringformat specification in + all data source dialogs. In addtion add the format selection + to the bottom of data source prompters that did not originally + have them. + * Issue #1659 Provide mechanisms for ring buffer analyzers + to fish data out of the event body header if it exists. + * Issue #1658 Add ability for CRingBufferDecoder to autoselect + the format helper if a ring format item is seen in the input data. Modified: branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-04-24 14:35:16 UTC (rev 2076) @@ -455,6 +455,17 @@ return m_pDefaultHelper; } +/** + * getFormatFactory + * + * @return CRingFormatHelperFactory* - pointer to the factory we used and + * in which all our creators are intalled. + */ +CRingFormatHelperFactory* +CRingBufferDecoder::getFormatFactory() +{ + return m_pFactory; +} /*---------------------------------------------------------------------------- * Callbacks during data analysis: @@ -687,15 +698,13 @@ uint32_t type = m_pTranslator->TranslateLong(pItem->s_header.s_type); m_pTranslator->newBuffer(pItem); - m_nBodySize = size - sizeof(RingItemHeader); - m_nCurrentItemType = mapType(type); + // If we have a ring format item that gives us the current helper: if (type == RING_FORMAT) { invalidateCurrentHelper(); - CRingFormatHelperFactory fact; - m_pCurrentHelper = fact.create(pItem); + m_pCurrentHelper = m_pFactory->create(pItem); } // Now get the correct helper to use: @@ -706,9 +715,13 @@ m_pCurrentRingItem = pItem; // So that callbacks can do stuff. m_pBody = pHelper->getBodyPointer(pItem); + m_nBodySize = + size + - (reinterpret_cast<uint8_t*>(m_pBody) - reinterpret_cast<uint8_t*>(pItem)); + // The remainder of this is item type dependent: - + m_nCurrentItemType = mapType(type); switch (type) { case BEGIN_RUN: case END_RUN: Modified: branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.h 2013-04-24 14:35:16 UTC (rev 2076) @@ -128,6 +128,8 @@ CRingFormatHelper* getCurrentFormatHelper(); CRingFormatHelper* getDefaultFormatHelper(); + CRingFormatHelperFactory* getFormatFactory(); + // Members called that can invalidate the format helper: virtual void OnSourceAttach(); Modified: branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.cpp 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.cpp 2013-04-24 14:35:16 UTC (rev 2076) @@ -84,6 +84,7 @@ CRingFormatHelper* CRingFormatHelperFactory::create(uint32_t major, uint32_t minor) { + CreatorMap::iterator p = m_Creators.find(MajorMinorVersion(major, minor)); if (p == m_Creators.end()) { return reinterpret_cast<CRingFormatHelper*>(0); Modified: branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.h 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelperFactory.h 2013-04-24 14:35:16 UTC (rev 2076) @@ -57,7 +57,7 @@ * */ class CRingFormatHelperFactory { -private: +public: // Inner classes: class MajorMinorVersion { // Encapsulates a major/minor version level. @@ -76,8 +76,8 @@ return (m_major == rhs.m_major) && (m_minor == rhs.m_minor); } }; + // Internal types: - private: typedef std::map<MajorMinorVersion, CRingFormatHelperCreator*> CreatorMap; Modified: branches/SpecTcl-3.4/Gui/datasource.tcl =================================================================== --- branches/SpecTcl-3.4/Gui/datasource.tcl 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/Gui/datasource.tcl 2013-04-24 14:35:16 UTC (rev 2076) @@ -23,7 +23,7 @@ namespace eval datasource { variable daqroot [list /usr/opt/daq/current /usr/opt/daq/8.1 /usr/opt/daq/8.0 /usr/opt/daq]; # Where the DAQ software is installed. variable lasthost localhost; # Most recent online host. - variable lastformat nscl + variable lastformat ring10 variable lasteventfile {} variable lastpipecommand {} variable lastpipeargs {} @@ -33,8 +33,29 @@ variable lastFilterFile {} variable actualSpecTclDaq {} variable lastring $::tcl_platform(user) + variable clustersize 8192 } + +## +# defaultFormat +# +# Determines the default format to use for a data source. +# In most cases, this is just ::datasource::lastformat, however +# since this can come from the preferences file and that may just have an +# an unqualified 'ring' 'ring' gets mapped to 'ring10'....which is stored +# back into ::datasource::lastformat +# +# @return string - default data format. +# +proc defaultFormat {} { + + if {$::datasource::lastformat eq "ring"} { + set ::datasource::lastformat ring10 + } + return $::datasource::lastformat +} + # datasource::findSpecTclDaq # Locate the atual spectcldaq file. We try for it in the # nscldaq roots described by daqroot, and if we can't find @@ -75,7 +96,58 @@ } +## +# attachDataSource +# Perform the actual attach. This factors out the following actions: +# * Shutting down the previous data source (if active) +# * Providing the value to the -format switch from a parameter. +# * Performing the actual attach command. +# * If necessary/possible performing a ringformat command to hint at what +# format data might be in for ring buffer data sources. +# * starts analysis. # +# @param format - Data format e.g. spectrodaq, ring10, ring11... +# @param size - -size parameter. +# @param sourcetype - An attach source type switch (e.g. -pipe or -file.) +# @param sourcespec - Source specification. Note that this parameter +# will be {*}'d when passed to attach so it can be a multiword +# command for -pipe data sources. +# +proc attachDataSource {format size sourcetype sourcespec} { + catch stop + + # Collapse the format for ring* -> ring + + if {[string match ring* $format]} { + set dataFormat ring + } else { + set dataFormat $format + } + + # Attach the data source. + + set command [list \ + attach -size $size -format $dataFormat $sourcetype {*}$sourcespec + ] + {*}$command + + # Figure out if ringformat must be used: + + if {[string match ring* $format]} { + if {$format eq "ring10"} { + ringformat 10.0 + } elseif {$format eq "ring11"} { + ringformat 11.0 + } + # Any other format CRingBufferDecoder will have to do its best to + # sort things out. + } + # start analysis: + + start +} + +# # attachOnline # Attach to an online data source. # datasource::daqroot is assumed to hold the installation @@ -85,32 +157,30 @@ # proc attachOnline {} { hostprompt .hostprompt -host $::datasource::lasthost \ - -format ::datasource::lastformat \ + -format [defaultFormat] \ -buffersize $::GuiPrefs::preferences(defaultBuffersize) \ -ringname $::datasource::lastring .hostprompt modal if {[winfo exists .hostprompt]} { set host [.hostprompt cget -host] - if {$host != ""} { + if {$host != ""} { set format [.hostprompt cget -format] set additionalInfo {} - if {$format eq "ring"} { + + if {[string match ring* $format]} { set additionalInfo [.hostprompt cget -ringname] - set ::datasource::lastring $additionalInfo - } - + set ::datasource::lastring $additionalInfo + } + set size [.hostprompt cget -buffersize] + set ::datasource::lasthost $host - set ::datasource::lastformat $format - - set size [.hostprompt cget -buffersize] - + set ::datasource::lastformat $format + set ::GuiPrefs::preferences(defaultBuffersize) $size + set helper [.hostprompt onlinehelper $host $additionalInfo] - catch stop - attach -format $format -size $size -pipe $helper - set ::GuiPrefs::preferences(defaultBuffersize) $size - start + attachDataSource $format $size -pipe $helper } destroy .hostprompt } @@ -119,17 +189,13 @@ # Prompts for an event file to attach to and does the deed. # proc attachFile {} { -# set file [tk_getOpenFile -defaultextension .evt \ -# -initialfile [file tail $::datasource::lasteventfile] \ -# -initialdir [file dirname $::datasource::lasteventfile] \ -# -filetypes [list [list "Event files" .evt]]] attachfile .prompt \ -defaultextension .evt \ -initialfile $::datasource::lasteventfile \ -initialdir [file dirname $::datasource::lasteventfile] \ -buffersize $::GuiPrefs::preferences(defaultBuffersize) \ - -format $::datasource::lastformat + -format [defaultFormat] .prompt modal set file [.prompt cget -initialfile] set size [.prompt cget -buffersize] @@ -138,15 +204,15 @@ if {$file != ""} { if {[file readable $file]} { - catch stop - attach -size $size -format $format -file $file + set isRing 0 set ::GuiPrefs::preferences(defaultBuffersize) $size - start set ::datasource::lasteventfile $file set ::datasource::lastformat $format + + attachDataSource $format $size -file $file } else { tk_messageBox -icon error -title {Can't read file} \ - -message "Could not read the file $file permission problem or file does not exist" + -message "Could not read the file $file permission problem or file does not exist" } } } @@ -166,22 +232,19 @@ if {[winfo exists .attachpipe]} { set command [.attachpipe cget -command] set arguments [.attachpipe cget -arguments] + if {$command != "" } { if {[file executable $command]} { - catch stop + set size [.attachpipe cget -buffersize] - if {![catch {eval attach -size $size -pipe $command $arguments} msg] } { - set ::GuiPrefs::preferences(defaultBuffersize) $size - start - set ::datasource::lastpipecommand $command - set ::datasource::lastpipeargs $arguments - } else { - tk_messageBox -icon error -title "Can't attach" \ - -message "The `attach -pipe $command $arguments' failed because: $msg" - } + set format [.attachpipe cget -format] + set ::GuiPrefs::preferences(defaultBuffersize) $size + set ::datasource::lastpipecommand $command + set ::datasource::lastpipeargs $arguments + attachDataSource $format $size -pipe "$command $arguments" } else { tk_messageBox -icon error -title "Can't execute file" \ - -message {You do not have execute access to $command} + -message {You do not have execute access to the pipe source program file: $command } } } destroy .attachpipe @@ -194,10 +257,26 @@ # from active -> inactive on analysis (this is determined # by tracing RunState. proc attachRunList {} { - set runlist [tk_getOpenFile -defaultextension .clu \ - -initialfile [file tail $::datasource::lastrunlist] \ - -initialdir [file dirname $::datasource::lastrunlist] \ - -filetypes [list [list "Cluster files" .clu]]] + + # Prompt for the filename, buffering and the format of the input files + # At this time, all cluster files must have the same format! + + attachfile .clusterchooser \ + -defaultextension .clu -initialfile $::datasource::lastrunlist \ + -initialdir [file dirname $::datasource::lastrunlist] \ + -buffersize $::GuiPrefs::preferences(defaultBuffersize) \ + -format [defaultFormat] + + .clusterchooser modal + + # Fish the stuff out of the dialog: + + set runlist [.clusterchooser cget -initialfile] + set size [.clusterchooser cget -buffersize] + set format [.clusterchooser cget -format] + + destroy .clusterchooser + if {$runlist != ""} { if {$datasource::runlistFiles != ""} { set answer [tk_messageBox -icon question -title {stop current runlist} \ @@ -216,9 +295,13 @@ } set files [read $msg] set datasource::runlistFiles [split $files "\n"] - catch stop + set datasource::lastrunlist $runlist + set datasource::lastformat $format + set datasource::clustersize $size + trace add variable ::RunState write nextFileInRunlist set ::RunState 0; # Start the next file... + } } @@ -289,11 +372,11 @@ set file [lindex $::datasource::runlistFiles 0] set ::datasource::runlistFiles [lrange $::datasource::runlistFiles 1 end] if {$file != ""} { - catch stop - set size $::GuiPrefs::preferences(defaultBuffersize) - if {![catch {attach -size $size -file $file} msg]} { - catch start - } else { + set status [catch \ + {attachDataSource $::datasource::lastformat $::datasource::clustersize \ + -file $file} msg] + + if {$status} { set answer [tk_messageBox -icon error -title {attach failed} \ -type okcancel \ -message "Failed to attach file $file because: $msg Ok to continue processing or cancel?"] @@ -323,7 +406,8 @@ # choices: # nscl - NSCL standard buffers with event sizes < 32K and buffersize < 32K # jumbo - NSCL standard buffers with events/buffers sizes potentially > 32k -# ring - Data from NSCLDAQ 10.0 and later (ringbuffer data). +# ring10 - Data from NSCLDAQ 10.x +# ring - Data from NSCLDAQ 11.x # # @@ -340,8 +424,8 @@ # snit::widget formatChooser { - variable formats {nscl jumbo ring}; # Valid options - option -format nscl; # Default option. + variable formats {nscl jumbo ring10 ring11}; # Valid options + option -format ring10; # Default option. option -command [list]; # Command to call if format changes. constructor args { @@ -369,7 +453,8 @@ append result "Format Meaning\n" append result "nscl nscl buffers/events < 32K words (< 10.0)\n" append result "jumbo nscl buffers/events >= 32KWords (< 10.0)\n" - append result "ring Ring buffer data from nscldaq 10.0 and later\n" + append result "ring10 Ring buffer data from nscldaq 10.x\n" + append result "ring11 Ring buffer data from nscldaq 11.x+\n" return $result } @@ -442,7 +527,7 @@ foreach dir $dirs { lappend dirtails [file tail $dir] } - set dirtail [lsort -decreasing -real $dirtails]; # sorted by decreasing version... + set dirtail [lsort -decreasing $dirtails]; # sorted by decreasing version... foreach dir $dirtail { set ringselector [file join /usr/opt/daq $dir bin ringselector] if {[file executable $ringselector]} { @@ -459,6 +544,15 @@ return "$ringselector --source=$url $selection" } } + ## + # ring10, ring11 - are all ring sources + # + method ring10 {host {ringname ""}} { + return [$self ring $host $ringname] + } + method ring11 {host {ringname ""}} { + return [$self ring $host $ringname] + } } @@ -491,7 +585,7 @@ $win.buffersize set $options(-buffersize) label $win.fmtlabel -text {Data format} - install format using formatChooser $win.fmt -command [mymethod formatChanged] -format ring + install format using formatChooser $win.fmt -command [mymethod formatChanged] -format ring10 button $win.ok -text Ok -command [mymethod onOk] button $win.cancel -text Cancel -command [mymethod onCancel] button $win.help -text Help -command [list spectclGuiDisplayHelpTopic hostPrompt] @@ -595,7 +689,7 @@ # enable the ring label/entry...otherwise disable them # method formatChanged newFormat { - if {$newFormat eq "ring"} { + if {[string match ring* $newFormat]} { $win.ringlabel configure -state normal $win.ring configure -state normal } else { @@ -621,6 +715,8 @@ option -okcommand {} option -cancelcommand {} option -buffersize 8192 + + delegate option -format to format variable hidden {} @@ -629,7 +725,7 @@ ::iwidgets::fileselectionbox $win.fsb -directory $options(-initialdir) \ -filesearchcommand [mymethod filterFiles] \ - -selectioncommand [mymethod onOk] + -selectioncommand [mymethod onOk] setEntry $win.fsb.selection $options(-initialfile) label $win.argslabel -text {Parameters: } @@ -644,10 +740,13 @@ button $win.ok -text Ok -command [mymethod onOk] button $win.cancel -text Cancel -command [mymethod onCancel] button $win.help -text Help -command [list spectclGuiDisplayHelpTopic attachPipe] + + install format using formatChooser $win.format -format ring10 grid $win.fsb - grid $win.argslabel $win.args grid $win.sizelbl $win.size + grid $win.format -columnspan 2 grid $win.ok $win.cancel $win.help } @@ -681,7 +780,7 @@ lappend result [file tail $file] } } - return $result + return [lsort -increasing $result] } # onOk # Accepts the dialog results; Calls -okcommand if defined. Modified: branches/SpecTcl-3.4/Gui/folderGui.tcl =================================================================== --- branches/SpecTcl-3.4/Gui/folderGui.tcl 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/Gui/folderGui.tcl 2013-04-24 14:35:16 UTC (rev 2076) @@ -1067,7 +1067,7 @@ .topmenu.help add command -label About.. -command aboutMeDialog menu .topmenu.source -tearoff 0 - .topmenu.source add command -label {Online (spectrodaq)...} -command attachOnline + .topmenu.source add command -label {Online...} -command attachOnline .topmenu.source add command -label {File...} -command attachFile .topmenu.source add command -label {Pipe...} -command attachPipe .topmenu.source add separator Modified: branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.cpp 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.cpp 2013-04-24 14:35:16 UTC (rev 2076) @@ -41,6 +41,7 @@ #include "DataSourcePackage.h" #include "AttachCommand.h" #include "TapeCommand.h" +#include "RingFormatCommand.h" #include "TCLInterpreter.h" #include "TCLResult.h" #include "TKRunControl.h" @@ -51,6 +52,7 @@ #include "Globals.h" #include "Exception.h" + #include <SpecTcl.h> #include <NSCLBufferDecoder.h> @@ -136,10 +138,14 @@ CTCLCommandPackage(pInterp, Copyright), m_eSourceType(CDataSourcePackage::kTestSource), m_pTape(new CTapeCommand(pInterp, *this)), - m_pAttach(new CAttachCommand(pInterp, *this)) + m_pAttach(new CAttachCommand(pInterp, *this)), + m_pRingFormat(new CRingFormatCommand(pInterp, *this)) + { AddProcessor(m_pTape); AddProcessor(m_pAttach); + AddProcessor(m_pRingFormat); + // install the buffer decoder creators for the default set // of buffer format types: Modified: branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.h =================================================================== --- branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.h 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/SpecTcl/DataSourcePackage.h 2013-04-24 14:35:16 UTC (rev 2076) @@ -312,6 +312,7 @@ // Forward Class reference: class CTapeCommand; class CAttachCommand; +class CRingFormatCommand; class CTCLInterpreter; class CTCLResult; @@ -328,9 +329,11 @@ }; private: // Attributes: - SourceType_t m_eSourceType; // Type of data source connected - CTapeCommand* m_pTape; - CAttachCommand* m_pAttach; + SourceType_t m_eSourceType; // Type of data source connected + CTapeCommand* m_pTape; + CAttachCommand* m_pAttach; + CRingFormatCommand* m_pRingFormat; + public: // Default constructor CDataSourcePackage(CTCLInterpreter* pInterp); Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-04-18 18:14:58 UTC (rev 2075) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-04-24 14:35:16 UTC (rev 2076) @@ -43,7 +43,7 @@ ScalerProcessor.cpp ScalerProcessorCallbacks.cpp \ DocumentationException.cpp DocumentationCallback.cpp \ SpecTcl.cpp CFoldCommand.cpp CProjectionCommand.cpp CFitCommand.cpp \ - IntegrateCommand.cpp + IntegrateCommand.cpp RingFormatCommand.cpp include_HEADERS = AppInit.h ApplyCommand.h AttachCommand.h BindCommand.h \ @@ -60,8 +60,11 @@ SpecTcl.h CFoldCommand.h CProjectionCommand.h CFitCommand.h \ IntegrateCommand.h + + + bin_PROGRAMS = SpecTcl SpecTcl_DEPENDENCIES = libTclGrammerCommands.la Globals.o @@ -112,8 +115,13 @@ noinst_PROGRAMS = scalertests docbuftests -noinst_HEADERS = Asserts.h +# TODO: Could probably add quite a few more headers above to this. +# maybe *Command.h and *Package.h(?) + + +noinst_HEADERS = Asserts.h RingFormatCommand.h + scalertests_SOURCES = TestRunner.cpp \ scalercallbacktests.cpp \ controlcallbacktests.cpp Added: branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.cpp (rev 0) +++ branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.cpp 2013-04-24 14:35:16 UTC (rev 2076) @@ -0,0 +1,217 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +/** + * @file RingFormatCommand.cpp + * @brief Code that implements the ringformat command processor. + */ + +#include <config.h> +#include "RingFormatCommand.h" +#include <TCLInterpreter.h> +#include <TCLCommandPackage.h> +#include <TCLResult.h> +#include <RingFormatHelper.h> +#include <RingFormatHelperFactory.h> +#include <CRingBufferDecoder.h> +#include <SpecTcl.h> +#include "TCLAnalyzer.h" +#include <BufferDecoder.h> + +#include <stdio.h> + +/** + * constructor + * Create the command processor object. + * @param pInterp - Pointer to the Tcl interpreter on which the command + * processor will be registered. + * @param rPackage- Package that contains the command processor. + */ +CRingFormatCommand::CRingFormatCommand( + CTCLInterpreter* pInterp, CTCLCommandPackage& rPackage +) : CTCLPackagedCommand("ringformat", pInterp, rPackage) +{ + +} +/** + * destructor + * - A no-op. + */ +CRingFormatCommand::~CRingFormatCommand() +{ + +} + +/** + * operator() + * + * Called to execute the 'ringformat' command: + * - The current buffer decoder must be a CRingBufferDecoder. + * - There must be exactly one command parameter; the version string. + * - The version string must parse into a version. + * - The resulting major.minor versions must be able to construct a CRingFormatHelper + * object via the CRingFormatHelperFactory. + * + * @param rInterp - Reference to the interpretr that is executing this command. + * @param rResult - Reference to the result object. + * @param argc - Number of command words. + * @param argv - Array of pointers to the command words. + * + * @return int + * @retval TCL_OK - Normal, correct completion. + * @retval TCL_ERROR - And error occured that prevented normal + * completion. + * + * @note - The successful result is the selected version. The failure + * result is an error message that describes the failure. + */ +int +CRingFormatCommand::operator()( + CTCLInterpreter& rInterp, CTCLResult& rResult, int argc, char* argv[]) +{ + + try { + // Get the decoder so we can set its helper when the time comes: + + CRingBufferDecoder* pDecoder = getDecoder(); + if (!pDecoder) { + throw std::string( + "You can only use this command when connected to ring formatted data sources" + ); + } + // Check the argument count and argument type: + if (argc != 2) { + throw Usage(); + } + RingVersion version = parseVersion(argv[1]); + unsigned maj = version.s_major; + unsigned min = version.s_minor; + + // Now build the ring format helper from the factory if we can. + + CRingFormatHelperFactory* helperFact(pDecoder->getFormatFactory()); + CRingFormatHelper* pHelper = helperFact->create(maj, min); + if (!pHelper) { + std::string message = "Ring format: "; + message += argv[1]; + message += " cannot be decoded by this version of SpecTcl"; + throw message; + } + /* + Nothing left but to set the helper... we're going to set the + default and current helper both...The default so that we'll fall + back to this type, the current in case there's a different one in + effect. + Note that since CRingBufferDecoder may eventually do a delete + on one of the helpers, it is important to make two distinct + helpers rather than pass the same pointer to both!!!! + */ + pDecoder->setFormatHelper(pHelper); + pDecoder->setDefaultFormatHelper(helperFact->create(maj, min));; + + // Falling through the catch block will return normal + + rResult = argv[1]; + } + catch(std::string msg) { + rResult = msg; + return TCL_ERROR; + } + + return TCL_OK; +} +/*----------------------------------------------------------------------------- +* Private methods +*/ + +/** + * getDecoder + * + * Returns a pointer to the current buffer decoder. + * + * @return CRingBufferDecoder* + * @retval 0 - Implies the current decoder is not a CRingBufferDecoder. + */ +CRingBufferDecoder* +CRingFormatCommand::getDecoder() +{ + SpecTcl* pApi = SpecTcl::getInstance(); + CTclAnalyzer* pAnalyzer = pApi->GetAnalyzer(); + + CBufferDecoder* pDecoder = pAnalyzer->getDecoder(); + if (!pDecoder) { + return reinterpret_cast<CRingBufferDecoder*>(0); + } + + return dynamic_cast<CRingBufferDecoder*>(pDecoder); // 0 if cast fails. + +} +/** + * Usage + * + * Returns a command usage string. + * + * @return std::string + */ +std::string +CRingFormatCommand::Usage() const +{ + std::string msg = "Usage:\n"; + msg += " ringformat major.minor\n"; + msg += "Where:\n"; + msg += " major - The ring buffer format major version\n"; + msg += " minor - The ring buffer format minor version\n"; + + + return msg; +} +/** + * parseVersion + * Decode a string as version. The string is of the form major.minor + * - Locate the period.. if there is no . the minor is 0. + * - Decode major as an integer. + * - If there is a minor, decode that as an integer as well. + * - Any integer decode fails, throw an invalid format string + * - along with the usage text. + * + * @param pVersionString Pointer to the version string. + * + * @return RingVersion - struct with the major/minor version included. + * @throw std::string error message as described above. + */ +CRingFormatCommand::RingVersion +CRingFormatCommand::parseVersion(const char* pVersionString) const throw(std::string) +{ + /* + Simplest way to deal with this is just good ole sscanf..though that's a + bit syntactically loose as 16, is perfectly good for version 16.0 in + that usage. + */ + + RingVersion result = {0,0}; + int nconverted = sscanf( + pVersionString, "%u.%u", &result.s_major, &result.s_minor + ); + if (nconverted < 1) { + std::string msg = "Invalid version string: "; + msg += pVersionString; + msg += "\n"; + msg += Usage(); + + throw msg; + } + return result; +} \ No newline at end of file Added: branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.h =================================================================== --- branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.h (rev 0) +++ branches/SpecTcl-3.4/SpecTcl/RingFormatCommand.h 2013-04-24 14:35:16 UTC (rev 2076) @@ -0,0 +1,103 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2008 + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ +#ifndef _RINGFORMATCOMMAND_H +#define _RINGFORMATCOMMAND_H + + +/** + * @file RingFormatCommand.h + * @brief Define command processor that specifies a ring item format. + */ + +#include "TCLPackagedCommand.h" + +#ifndef __STL_STRING +#include <string> +#ifndef __STL_STRING +#define __STL_STRING +#endif +#endif + +#ifndef __STL_UTILITY +#include <utility> +#ifndef __STL_UTILITY +#define __STL_UTILITY +#endif +#endif + +class CTCLInterpreter; +class CTCLCommandPackage; +class CTCLResult; +class CRingBufferDecoder; + + +/** + * @class CRingFormatCommand + * + * This class provides a command that allows the current format of a ring item + * data source to be set. It is an error to invoke this command if the + * current buffer decoder is not a CRingBufferDecoder object. + * + * Format of the command is: + * \verbatim + * ringformat version + * \endverbatim + * + * Where version is the ring item version to select. version is a string that + * must be of the form major.minor or just major If the minor part is omitted + * it is assumed to be 0. Thus the versioon strings 10.0 and 10 are identical + * and specify a version of major=10 and minor of 0. + * + * We only can support versions that the CRingFormatHelperFactory can + * instantiate. + */ +class CRingFormatCommand : public CTCLPackagedCommand +{ + // Local data types +private: + typedef struct _RingVersion { + unsigned s_major; + unsigned s_minor; + } RingVersion, *pRingVersion; + + // Allowed Canonical methods: +public: + CRingFormatCommand(CTCLInterpreter* pInterp, CTCLCommandPackage& rPackage); + virtual ~CRingFormatCommand(); + + // Forbidden canonical methods: + +private: + CRingFormatCommand(const CRingFormatCommand&); + CRingFormatCommand& operator=(const CRingFormatCommand&); + int operator==(const CRingFormatCommand&) const; + int operator!=(const CRingFormatCommand&) const; + + // Operations on the class. + +public: + virtual int operator()( + CTCLInterpreter& rInterp, CTCLResult& rResult, int argc, char* argv[] + ); + + // Private utilities +private: + CRingBufferDecoder* getDecoder(); + std::string Usage() const; + RingVersion parseVersion(const char* pVersionString) const throw(std::string); +}; + +#endif \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-04-24 18:48:38
|
Revision: 2077 http://sourceforge.net/p/nsclspectcl/code/2077 Author: ron-fox Date: 2013-04-24 18:48:34 +0000 (Wed, 24 Apr 2013) Log Message: ----------- * Issue #1633 Provide event processors with a post SpecTclRC.tcl initialization hook. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/Events/Analyzer.cpp branches/SpecTcl-3.4/Events/Analyzer.h branches/SpecTcl-3.4/SpecTcl/EventProcessor.cpp branches/SpecTcl-3.4/SpecTcl/EventProcessor.h branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.cpp branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.h branches/SpecTcl-3.4/SpecTcl/TclGrammerApp.cpp Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/CHANGELOG 2013-04-24 18:48:34 UTC (rev 2077) @@ -1020,3 +1020,6 @@ to fish data out of the event body header if it exists. * Issue #1658 Add ability for CRingBufferDecoder to autoselect the format helper if a ring format item is seen in the input data. + * Issue #1633 Provide event processors with a post SpecTclRC.tcl + initialization hook. + Modified: branches/SpecTcl-3.4/Events/Analyzer.cpp =================================================================== --- branches/SpecTcl-3.4/Events/Analyzer.cpp 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/Events/Analyzer.cpp 2013-04-24 18:48:34 UTC (rev 2077) @@ -291,6 +291,14 @@ m_pDecoder->OnEndFile(); } +/** + * OnInitialize + * + * This is called after all SpecTcl initialization is completed. + * No_op for us. + */ +void +CAnalyzer::OnInitialize() {} ////////////////////////////////////////////////////////////////////////// // Modified: branches/SpecTcl-3.4/Events/Analyzer.h =================================================================== --- branches/SpecTcl-3.4/Events/Analyzer.h 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/Events/Analyzer.h 2013-04-24 18:48:34 UTC (rev 2077) @@ -215,6 +215,8 @@ virtual void OnScaler(CBufferDecoder& rDecoder); virtual void OnOther(UInt_t nType, CBufferDecoder& rDecoder); virtual void OnEndFile(); + virtual void OnInitialize(); + CBufferDecoder* AttachDecoder(CBufferDecoder& rDecoder); CBufferDecoder* DetachDecoder(); CEventSink* AttachSink(CEventSink& rSink); Modified: branches/SpecTcl-3.4/SpecTcl/EventProcessor.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/EventProcessor.cpp 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/SpecTcl/EventProcessor.cpp 2013-04-24 18:48:34 UTC (rev 2077) @@ -224,3 +224,21 @@ { return kfTRUE; } +/** + * OnInitialize + * + * Called when SpecTcl initialization is complete. This allows event + * processors to access stuff that may have been set up in OnAttach of other + * event processors (e.g. tree parameters/variables) or in the SpecTclInit.tcvl + * and SpecTclRC.tcl scripts. + * @return Bool_t + * @retval kfTRUE - continue processing. + * @retval kfFALSE - abort event processing pipeline. + * + * The default action, implemented by this member is a successful no-op. + */ +Bool_t +CEventProcessor::OnInitialize() +{ + return kfTRUE; +} Modified: branches/SpecTcl-3.4/SpecTcl/EventProcessor.h =================================================================== --- branches/SpecTcl-3.4/SpecTcl/EventProcessor.h 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/SpecTcl/EventProcessor.h 2013-04-24 18:48:34 UTC (rev 2077) @@ -93,6 +93,7 @@ virtual Bool_t OnEventSourceOpen(STD(string) name); virtual Bool_t OnEventSourceEOF(); + virtual Bool_t OnInitialize(); }; #endif Modified: branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.cpp 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.cpp 2013-04-24 18:48:34 UTC (rev 2077) @@ -72,7 +72,8 @@ m_pRunNumber(0), m_pRunTitle(0), m_pRunState(0), - m_nSequence(0) + m_nSequence(0), + m_initialized(false) { m_pBuffersAnalyzed = new CTCLVariable(&rInterp, string("BuffersAnalyzed"), @@ -358,7 +359,6 @@ InsertEventProcessor(rProcessor, end(), name); - } /*! Return an iterator (or end()) corresponding to the event processor requested by @@ -417,6 +417,10 @@ m_lAnalysisPipeline.insert(here, element); processor.OnAttach(*this); // Notify the processor it was attached. + + // If we're already initialized, init the event processor too: + + if (m_initialized) processor.OnInitialize(); } /*! @@ -545,6 +549,27 @@ { OnOther(rDecoder.getBufferType(), rDecoder); } +/** + * OnInitialize + * + * Called after all SpecTcl initialization is done. + * Iterates through the event processors invoking OnInitialize in each. + */ +void +CTclAnalyzer::OnInitialize() +{ + SpecTcl* api = SpecTcl::getInstance(); + + CTclAnalyzer::EventProcessorIterator p = api->ProcessingPipelineBegin(); + m_initialized = true; + + while (p != api->ProcessingPipelineEnd()) { + CEventProcessor* pProcessor = p->second; + if (!pProcessor->OnInitialize()) break; + + p++; + } +} /*! Called when the event source hit an end file. Modified: branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.h =================================================================== --- branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.h 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/SpecTcl/TCLAnalyzer.h 2013-04-24 18:48:34 UTC (rev 2077) @@ -123,6 +123,7 @@ STD(vector)<Int_t*> m_vStatisticsInts; UInt_t m_nSequence; //!< Anonymous naming sequence #. + bool m_initialized; public: CTclAnalyzer(CTCLInterpreter& rInterp, UInt_t nP, UInt_t nBunch); @@ -152,6 +153,7 @@ virtual void OnEnd(CBufferDecoder* rDecoder); virtual void OnPause(CBufferDecoder* rDecoder); virtual void OnResume(CBufferDecoder* rDecoder); + virtual void OnInitialize(); Modified: branches/SpecTcl-3.4/SpecTcl/TclGrammerApp.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/TclGrammerApp.cpp 2013-04-24 14:35:16 UTC (rev 2076) +++ branches/SpecTcl-3.4/SpecTcl/TclGrammerApp.cpp 2013-04-24 18:48:34 UTC (rev 2077) @@ -667,6 +667,12 @@ // to run. By the time these are run, SpecTcl is essentially completely // set up. SourceFunctionalScripts(*gpInterpreter); + + // Now that SpecTcl is essentially set up, we can initialize the analyzer + + SpecTcl* pApi = SpecTcl::getInstance(); + CTclAnalyzer* pAnalyzer = pApi->GetAnalyzer(); + pAnalyzer->OnInitialize(); // Additional credits. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-05-02 18:22:40
|
Revision: 2081 http://sourceforge.net/p/nsclspectcl/code/2081 Author: ron-fox Date: 2013-05-02 18:22:37 +0000 (Thu, 02 May 2013) Log Message: ----------- * Better documentation for how to write event processors. * Document the ringformat command. * In CRingBufferDecoder also register factory creation methods for the minor versions of nscldaq-10.x Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp branches/SpecTcl-3.4/doc/Commands/categories.htm branches/SpecTcl-3.4/doc/Makefile.am branches/SpecTcl-3.4/doc/index.htm branches/SpecTcl-3.4/doc/tailoring/modifyin.htm branches/SpecTcl-3.4/doc/tailoring/tailoring.htm Added Paths: ----------- branches/SpecTcl-3.4/doc/Commands/ringformat.htm branches/SpecTcl-3.4/doc/tailoring/decoder.htm branches/SpecTcl-3.4/doc/tailoring/eventprocessor.htm branches/SpecTcl-3.4/doc/tailoring/make.htm branches/SpecTcl-3.4/doc/tailoring/pipeline.htm branches/SpecTcl-3.4/doc/tailoring/tree.htm branches/SpecTcl-3.4/doc/whatsnew3.4.htm Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/CHANGELOG 2013-05-02 18:22:37 UTC (rev 2081) @@ -1022,4 +1022,5 @@ the format helper if a ring format item is seen in the input data. * Issue #1633 Provide event processors with a post SpecTclRC.tcl initialization hook. + * Much more documentation on how to build event processors etc. Modified: branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/DecoderRing/CRingBufferDecoder.cpp 2013-05-02 18:22:37 UTC (rev 2081) @@ -118,7 +118,10 @@ CRingFormatHelper11Creator create11; m_pFactory->addCreator(10, 0, create10); - m_pFactory->addCreator(11, 0, create11); + m_pFactory->addCreator(10, 1, create10); // 10.x are all the same. + m_pFactory->addCreator(10, 2, create10); + + m_pFactory->addCreator(11, 0, create11); // 11.x has body headers. } /*! Destructor IF ther's a buffer assembly in process, its storage should Modified: branches/SpecTcl-3.4/doc/Commands/categories.htm =================================================================== --- branches/SpecTcl-3.4/doc/Commands/categories.htm 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/doc/Commands/categories.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -131,8 +131,11 @@ detaching any current event source</td> </tr> <tr> - <td width="14%"><a href="tape.htm">tape</a></td> - <td width="86%">Select specific files from tape</td> + <td width="14%"><a href="ringformat.htm">ringformat</a></td> + <td width="86%"> + Specify the format of data from a ring data source + (<tt>-format ring</tt>). + </td> </tr> </table> Added: branches/SpecTcl-3.4/doc/Commands/ringformat.htm =================================================================== --- branches/SpecTcl-3.4/doc/Commands/ringformat.htm (rev 0) +++ branches/SpecTcl-3.4/doc/Commands/ringformat.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" +content="text/html; charset=iso-8859-1"> +<meta name="GENERATOR" content="Microsoft FrontPage 2.0"> +<title>ringformat command</title> +</head> + +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <th width="9%" nowrap><a href="http://www.nscl.msu.edu"><img + src="../images/nscl_logo_small.gif" + alt="nscl_logo_small.gif (2463 bytes)" width="63" + height="52"></a></th> + <td width="79%"><h1>ringformat command</h1> + </td> + <td width="12%"><a href="../index.htm"><img + src="../images/hh00706_.jpg" + alt="HH00706_.wmf (6530 bytes)" width="192" height="84"></a></td> + </tr> +</table> + +<p><a href="../index.htm" name="Top">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> +</p> +<p> + <a href='#syntax'>Syntax</a> + <a href='#synopsis'>Synopsis</a> + <a href='#description'>Description</a> + <a href='#examples'>Examples</a> +</p> + +<!-- Content goes here --> +<h2 id='syntax'>Syntax</h2> + +<pre> + ringformat major?.minor? + + Where: + major is the major version of the data format. + minor is the mionr version of the data format. + +</pre> +<h2 id='synopsis'>Synopsis</h2> +<p> + Specifies the format in which the NSCLDAQ data are in when using a ring + data source. +</p> +<h2 id='description'>Detailed Description</h2> +<p> + Ring data sources (<tt>-format ring</tt>) cover a variety of formats. + From nscldaq-11.0 and on, each run begins with a ring format item + that describes the format of datas in the ring. If, however SpecTcl + joins an online run in progress, it won't see this item until the + next run begins. Furthermore, nscldaq-10.x runs have no ring format items. +</p> +<p> + The <tt>ringformat</tt> command specifies for SpecTcl how to treat data + from ring formatted data sources. If SpecTcl encounters a ring format data + item, the format specification in that item will override that specified + in the <tt>ringformat</tt> command. +</p> +<p> + The format is specified as a decimal number with a major and minor version field. + If the minor version is omitted, a value of <tt>0</tt> is used by default. + See the <a href='#examples'>Examples</a> section below for some examples + of ring format version specifications. +</p> + + +<h3 id='examples'>Examples </h2> +<pre> + + ringformat 11.0; # [1] + ringformat 10.1; # [2] + ringformat 10; # [3] +</pre> +<ol> + <li> + Sets the format of ring items to that of NSCLDAQ-11.0 + </li> + <li> + Sets the format of ring items to that of NSCLDAQ-10.1 note that + all NSCLDAQ-10.x versions use the same format of ring item. + </li> + <li> + Sets the format of ring items to that of NSCLDAQ-10.0. This form + illustrates that if the minor version is not supplied, it defaults + to <tt>0</tt> + </li> +</ol> +<!-- Content ends --> + +<p><a href="#Top">Top</a></p> + +<p><a href="../index.htm">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + +<hr> + +<p>Last Modified: <!--webbot bot="Timestamp" s-type="EDITED" +s-format="%B %d, %Y" startspan -->October 28, 2003<!--webbot +bot="Timestamp" endspan i-checksum="30351" --> by: <a +href="mailto:fo...@ns...">fo...@ns...</a><br> +<font size="2">\xA9 Copyright NSCL 1999, All rights reserved</font></p> +</body> +</html> Modified: branches/SpecTcl-3.4/doc/Makefile.am =================================================================== --- branches/SpecTcl-3.4/doc/Makefile.am 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/doc/Makefile.am 2013-05-02 18:22:37 UTC (rev 2081) @@ -116,6 +116,7 @@ tailoring/_vti_cnf/obtainin.htm tailoring/_vti_cnf/supporti.htm \ tailoring/_vti_cnf/building.htm tailoring/_vti_cnf/modifyin.htm \ tailoring/_vti_cnf/spectcl.htm tailoring/_vti_cnf/tailoring.htm \ + tailoring/eventprocessor.htm tailoring/pipeline.htm tailoring/make.htm \ tailoring/images/spectc1.jpg tailoring/images/spectc2.jpg \ tailoring/images/_vti_cnf/spectc1.jpg tailoring/images/_vti_cnf/spectc2.jpg \ Programming/BufferAnalysis.htm Programming/CBufferCallback.htm \ Modified: branches/SpecTcl-3.4/doc/index.htm =================================================================== --- branches/SpecTcl-3.4/doc/index.htm 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/doc/index.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -63,7 +63,8 @@ Installing SpecTcl</a></li> <li><a href="whatsnew.htm">What's new for version 3.0</a></li> <li><a href="whatsnew3.1.htm">What's new for version 3.1</a></li> - <lit><a href="whatsnew3.2.htm">What's new for version 3.2</a></li> + <li><a href="whatsnew3.2.htm">What's new for version 3.2</a></li> + <li><a href="whatsnew3.4.htm">What's new in versions 3.3 and 3.4</a></li> </ul> <p> </p> Added: branches/SpecTcl-3.4/doc/tailoring/decoder.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/decoder.htm (rev 0) +++ branches/SpecTcl-3.4/doc/tailoring/decoder.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,330 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" +content="text/html; charset=iso-8859-1"> +<meta name="GENERATOR" content="Microsoft FrontPage 2.0"> +<title>Buffer Decoder Services</title> +</head> + +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <th width="9%" nowrap><a href="http://www.nscl.msu.edu"><img + src="../images/nscl_logo_small.gif" + alt="nscl_logo_small.gif (2463 bytes)" width="63" + height="52"></a></th> + <td width="79%"><h1>Buffer Decoder Services</h1> + </td> + <td width="12%"><a href="../index.htm"><img + src="../images/hh00706_.jpg" + alt="HH00706_.wmf (6530 bytes)" width="192" height="84"></a></td> + </tr> +</table> + +<p><a href="../index.htm" name="Top">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + +<!-- Content starts --> +<p> + Buffer Decoders are objects SpecTcl uses to understand the outer layers of + data from a data source. Typically the outer layers of the way a data + acquisition system packages data are experiment independent. The Buffer + Decoder for a data source knows how to look at this and farm out chunks of + data to the Analyzer which in turn knows how to parcel out data to the + elements of the event processing pipeline. +</p> +<p> + All buffer decoders supply a base set of services that are defined by the + <tt>CBufferDecoder</tt> base class (see <tt>BufferDecoder.h</tt>). Specific + buffer decoders may provide additional services if appropriate. You can (and should) use + the C++ <tt>dynamic_cast</tt> operator to determine if the buffer decoder + passsed in to your event processor is a specify buffer decoder type before + making use of these additional services. +</p> +<p> + This page documents: +</p> +<ul> + <li><a href='#basedecoder'>The base class services supported by all buffer decoders.</a></li> + <li><a href='#nscldecoder'>The additional services suported by the buffer decoder for NSCLDAQ versions before 10.0</a></li> + <li><a href='#ringdecoder'>The additional services supported by the buffer decoder for NSCLDAQ-10.0 and later</a></li> +</ul> +<p> + Writing and installing your own buffer decoders is beyond the scope of this + documentation, however it is possible. Ask for help if you want to do this + (for data taken outside the NSCL for example). +</p> + +<h2 id="basedecoder">Services all buffer decoders must offer</h2> +<p> + The following pure virtual methods in <tt>CBufferDecoder</tt> define the + services all buffer decoders must supply: +</p> +<pre> + virtual const Address_t getBody() = 0; + virtual UInt_t getBodySize() = 0; + virtual UInt_t getRun() = 0; + virtual UInt_t getEntityCount() = 0; + virtual UInt_t getSequenceNo() = 0; + virtual UInt_t getLamCount() = 0; + virtual UInt_t getPatternCount() = 0; + virtual UInt_t getBufferType() = 0; + virtual void getByteOrder(Short_t& Signature16, + Int_t& Signature32) = 0; + virtual BufferTranslator* getBufferTranslator(); + virtual std::string getTitle() = 0; +</pre> + +<p> + The buffer decoder can be thought of as breaking its input up into chunks + data. These chunks can have format specific headers. The + <tt>getBody</tt> method will return a pointer to the first byte after the + header. <tt>getBodySize</tt> returns the number of bytes in the body of + a chunk. Chunks may be further sub-divided into entities. For example + a bufferd data acquisition system may fit several events into a buffer. + <tt>getEntityCount</tt> returns the number of distinct entities in a + chunk. +</p> +<p> + Most data acquisition systems have the ability to divide data taking up + into segments. These segments are normally called runs. Data acquisition + systems may also associated meta-data with each run. SpecTcl assumes that + this meta-datam may include a run number and a title. The run number is + a unique number normally assigned by the data acquisition system while the + title is free form descriptive text that the users type in to help them + associate run numbers with the purpose of the run. + <tt>getRun</tt> returns the run number while <tt>getTitle</tt> returns + the run title string + +</p> +<p> + The <tt>getByteOrder</tt> method returns two byte order signatures that help + you understand the differences between the byte order of the system that + produced the data and the system SpecTcl is running on. <tt>Signature16</tt> + is an output parameter that will contain the pattern <tt>0x0102</tt> in the + native byte order of the data source while <tt>Signature32</tt> will + contain <tt>0x01020304</tt> in the native byte order of the system that + created the data. Normally you won't need to call this. Instead, + for each buffer, buffer decoders make use of the base class functionality + to ensure that <tt>getBufferTranslator</tt> returns the correct translator + object pointer and you can then use that to construct a + <tt>TranslatorPointer</tt> object to transparently perform byte order + adjustments for you. +</p> +<p> + The other item getters are fairly specific to older experiments in NSCLDAQ. + Most buffer decoders can just return 0 for them. <tt>getLamCount</tt> + dates back to CAMAC days and provides the number of lam masks that may be + at the front of a physics trigger event body. Similarly <tt>getPatternCount</tt> + will provide the number of pattern (hit) registers that might be at the beginning + of the body of a physics event. +</p> +<p> + Lastly most data sources have the concept of a data type. <tt>getBufferType</tt> + returns the type of the chunk. <tt>buftypes.h</tt> defines the types you should + return for 'normal' items. Other buffer types will be sent to the + <tt>OnOther</tt> processing path and event processors that care need to know + how to either recognize and deal with them or ignore them. +</p> + +<h2 id='nscldecoder'>NSCL Buffer decoder data prior to NSCLDAQ 10.0</h2> +<p> + The <tt>CNSCLBufferDecoder</tt> only implements existing interfaces in + <tt>CBufferDecoder</tt> it does not add anything new. In most cases + the methods return values from the buffer header. In the case of + e.g. <tt>getTitle</tt> the title from the last state transition is saved + and returned on demand. +</p> + +<h2 id='ringdecoder'>Ring buffer decoder - data more recent than NSCLDAQ-10.0</h2> + +<p> + The <tt>CRingBufferDecoder</tt> class is associated with data sources + that have <tt>-format=ring</tt>. At the time this is being written it is + capable of being a decoder for data from NSCLDAQ 10.x and 11.x. While the + decoder attempts to use the contents of the data source itself to determine + whether to do a 10.x or 11.x decode, the + <a href='../Commands/ringformat.htm'><tt>ringformat</tt> command</a> can also + be used to provide a hint. +</p> +<p> + The Ring buffer decoder provides a few additional methods that allow access + to the ring item header and the ring body header if present. To use these, + however you must be sure you are actually using a ring buffer decoder. This + can be done via the <tt>dynamic_cast</tt> operator as shown below. + <tt>dynamic_cast</tt> uses the RTTI subsystem of the compiler to determine + if casts of pointers or references are really legitimate. +</p> +<pre> + // Cast with pointers: dynamic_cast returns null if not valid: + + CRingBufferDecoder* pRingDecoder = dynamic_cast<CRingBufferDecoder*>(&rDecoder); + if (!pRingBufferDecoder) { + std::cerr << "Decoder is not a CRingBufferDecoder\n; + } + + // Cast with references: dynamic_cast will throw std::bad_cast if not valid. + + try { + CRingBufferDecoder& dynamic_cast<CRingBufferDecoder&>(rDecoder); + ... + } + ... + catch(std::bad_cast& e) { + std::cerr << "Decoder is not a CRingBufferDecodder\n"; + } + ... +</pre> + +<p> + Here are the prototypes for ring buffer decoder methods thataccess + items outside the body of the ring item. +</p> +<pre> + bool hasBodyHeader(); + void* getBodyHeaderPointer(); + void* getItemPointer(); + +</pre> +<p> + <tt>hasBodyHeader</tt> allows you to test to see if the ring item has a body + header. <tt>getBodyHeaderPointer</tt> returns a pointer to a body header + or a null pointer if the event has no body header. Finally <tt>getItemPointer</tt> + returns a pointer to the entire ring item. +</p> + +<p> + Since ring buffer data for 10.x differs quite a bit from 11.x the ring + buffer decoder uses a helper class called a <tt>CRingFormatHelper</tt> + to help it decodee the two types of data. The ring buffer decoder uses + several bits of information to try to choose the correct helper if it can: +</p> +<ul> + <li>If a <tt>RING_FORMAT</tt> item is see that is used to select the right + helper. + </li> + <li>If a <tt>ringformat</tt> command has been issued that sets the current + helper. Normally this should be done prior to <tt>start</tt>. + The GUI <tt>Data Source</tt> menu entries do that. + </li> + <li> + Ring format helpers can also be programmatically set (e.g. by + <tt>OnEventSourceOpen</tt> or <tt>OnBegin</tt> methods in event processors). + </li> + +</ul> + +<p> + The following are methods in the Ring buffer decoder that allow you to + influence the process of selecting the ring buffer helper: +</p> +<pre> + void setFormatHelper(CRingFormatHelper* pHelper); + void setDefaultFormatHelper(CRingFormatHelper* pHelper); + CRingFormatHelper* getCurrentFormatHelper(); + CRingFormatHelper* getDefaultFormatHelper(); +</pre> + +<p> + In all of these methods, <tt>pHelper</tt> must be a pointer to a dynamically + allocated format helper object. See + <a href='#formathelperfactory'>below</a> about how to create those. + <tt>setFormatHelper</tt> sets the current helper. This takes effect with the + next item decoded from the data source, unless the next item is a + <tt>RING_FORMAT</tt> item in which case that overrides whatever you do. +</p> +<p> + <tt>setDefaultHelper</tt> sets the helper to use if the decoder is not able + to figure out what type of ring items to decode. If this is not set, the + assumption for SpecTcl-3.4 is that the format is 10.x. Later versions of + SpecTcl may change this. +</p> +<p> + <tt>getCurrentFormatHelper</tt> and <tt>getDefaultFormatHelper</tt> + return pointers to the format helpers that <tt>setFormatHelper</tt> + and <tt>setDefaultFormatHelper</tt> set respectively. Note that + if a <tt>RING_FORMAT</tt> item is seen, <tt>getCurrentFormatHelper</tt> + will return a pointer to the format helper appropriate to that + item. +</p> + +<p id='formathelperfactory'> + You should not directly create format helpers. This is because SpecTcl + knows for the set of data formats that are supported which format helper + to use. A format helper factory exists that can create the proper format + helper for you. You can get a pointer to that factory by using the method + below: +<pre> + CRingFormatHelperFactory* getFormatFactory(); +</pre> + +<p> + The <tt>CRingFormatHelperFactory</tt> has the following methods: +</p> +<pre> + CRingFormatHelper* create(uint32_t major, uint32_t minor); + CRingFormatHelper* create(void* pFormatItem); + + void addCreator( + uint32_t major, uint32_t minor, const CRingFormatHelperCreator& creator + ); + void removeCreator(uint32_t major, uint32_t minor); +</pre> + +<p> + Create a format helper using one of the two <tt>create</tt> methods. + <tt>major</tt> and <tt>minor</tt> are the major and minor versions of the + version of NSCLDAQ you want to decode data for. Note that <tt>major</tt> + must be greater than or equal to <tt>10</tt>. <tt>pFormatItem</tt> + is the pointer to a full ring format item (<tt>pFormatitem</tt> should point + to that items header). This overload will extract the major and minor + versions from the item and create the appropriate helper. +</p> +<p> + You can also extend the set of versions that are supported, though normally + you do not need to do that. To do this you need to write a new + helper (that is beyond the scope of these documents) and register + the set of versions supported by that helper along with a helper creator + that knows how to build that kind of helper: +</p> +<pre> + void addCreator( + uint32_t major, uint32_t minor, const CRingFormatHelperCreator& creator + ); +</pre> + +<p> + You can also remove support for a version (not clear why you'd want to) by + via <tt>removeCreator</tt>: +</p> +<pre> + void removeCreator(uint32_t major, uint32_t minor); +</pre> + + +<!-- Content ends --> + +<p><a href="#Top">Top</a></p> + +<p><a href="../index.htm">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + +<hr> + +<p>Last Modified: <!--webbot bot="Timestamp" s-type="EDITED" +s-format="%B %d, %Y" startspan -->October 28, 2003<!--webbot +bot="Timestamp" endspan i-checksum="30351" --> by: <a +href="mailto:fo...@ns...">fo...@ns...</a><br> +<font size="2">\xA9 Copyright NSCL 1999, All rights reserved</font></p> +</body> +</html> Added: branches/SpecTcl-3.4/doc/tailoring/eventprocessor.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/eventprocessor.htm (rev 0) +++ branches/SpecTcl-3.4/doc/tailoring/eventprocessor.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,378 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<title>Event processors.</title> +</head> + +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <th width="9%" nowrap><a href="http://www.nscl.msu.edu"><img + src="../images/nscl_logo_small.gif" + alt="nscl_logo_small.gif (2463 bytes)" width="63" + height="52"></a></th> + <td width="79%"><h1>Event processors.</h1> + </td> + <td width="12%"><a href="../index.htm"><img + src="../images/hh00706_.jpg" + alt="HH00706_.wmf (6530 bytes)" width="192" height="84"></a></td> + </tr> +</table> + +<p> + SpecTcl does not know anything about the format of your data. It relies + on your code to unpack raw events into <i>parameters</i>. Gates are checked + on and histograms incremented from parameter values. + This page describes + <ul> + <li><a href='#pipe'>The SpecTcl event processing pipeline</a></li> + <li><a href='#processors'>How to write event processors which are the elements of the event + processing pipeline.</a> + </li> + </ul> + <a href='pipeline.htm'>This page</a> describes how to setup the event + processing pipeline once you've written all your event processors. +</p> + +<h2 id='pipe'>The Event processing pipeline</h2> +<p> + Experiments are often built from several detetor systems. Furthermore, + analysis of experiments often proceeds by successive refinement. + The SpecTcl event processing pipeline recognizes this fact. The + event processing pipeline allows you to perform the creation of parameters + from raw events in an ordered list of stages called <i>Event Processors</i>. +</p> +<p> + Each event processor has available to it the raw event as well as all + parameters that have been created by event processors that ran prior to it. + A recommended best practice is to have initial analysis done by a set of + event processors that minimally transform the raw event into raw parameters. + Subsequent stages can reference these parameters to perform more complex + physically meaningful computed parameters. This first set of stages + effectively insulates the second set of stages from the structure of the + raw event. +</p> +<p> + Let's look at an example. Suppose you have an experiment that consists + of two detector systems; SeGA and the Beta endstation. Rather than making + a raw event processor understand everthing it needs to know about both + detector systems, you can structure your data using NSCL Packets. A SeGA + event processor can search the event for a SeGA packet and unpack its raw + parameters into an agreed upon set of parameter while a Beta End station + event processor does the same for the Beta Endstation packet. + (See <a href='tree.htm'> programming with tree parameters</a> for a system + that makes agreeing on parameters easy). +</p> +<p> + Having unpacked the raw parametesr you could then add stages to the + event processing pipline to produce calibrated parameters (see the + <a href='http://docs.nscl.msu.edu/daq/specplugins/calibparams.pdf'>calibrated + parameter plugin however</a>). Another event processor could produce parameters + that require data from both detector systems and so on. +</p> + + + +<h2 id='processors'>Writing event processors</h2> +<p> + An event processor is a stage in the event processing pipeline. Each + event processor is an object from a class derived from + <tt>CEventProcessor</tt>. The header for that class is in + <tt>EventProcessor.h</tt>. The base class specification for an event + processor provides an interface made up of virtual functions and default + implementations of each of those virtual functions. +</p> +<p> + In general, each virtual function returns a <tt>Bool_t</tt> value which + must be <tt>kfTRUE</tt> to allow processing to continue with the next + stage of the event processing pipeline and <tt>kfFALSE</tt> to abort the + pipeline. When event decoding is aborted, the partially decoded data + are not histogrammed. +</p> + +<p> + Let's look at the virtual functions in the interfce. Note that you only need + to implement the methods you need for your event processor. +</p> +<h3>OnAttach</h3> + +<p> + Event processors don't do anything until they are attached to the + <i>Analyzer</i>. When they are, this method is called. A reference to + the analyzer (<tt>CAnalyzer&</tt>) is the sole parameter of this method. + See <tt>Analyzer.h</tt> for the facilities provided by the analyzer. +</p> +<p> + As with all event processor processing methods, this method must return + <tt>kfTRUE</tt>. At present, this value is ignored however in the future + it is possible that a <tt>kfFALSE</tt> will result in the event processor + being removed from the event processing pipeline. +</p> + +<h3>OnInitialize</h3> +<p> + <tt>MySpecTclApp.cpp</tt> supports adding event processors very early in the + SpecTcl startup. The event processors added in + <tt>CMySpecTclApp::CreateAnalysisPipeline</tt> are added to the pipeline + before any SpecTcl initialization scripts have been run. +</p> +<p> + Therefore, <tt>OnInitialize</tt> is invoked for all event processors in the + event processing pipeline once SpecTcl is fully initialized. This method + therefore has access to all interpreter variables that may have been set up + by the initialization scripts as well as SpecTcl object definitions + that may have been created by these scripts. The method pakes no parameters + and should return <tt>kfTRUE</tt> so that the remainder of the event + processing pipeline elements will be processed. +</p> +<p> + Event processors that are added dynamically after initialization is complete + will have both their <tt>OnAttach</tt> and their <tt>OnInitialize</tt> + methods called at that time in that order. Therefore it is <b>not</b> necessary + for an event processor to know if it is dynamically or statically added. +</p> + +<h3 id='functor'>operator()</h3> +<p> + This method (the function call operator) is invoked for each physics trigger + related event. The + method has the following set of responsibilities (spread out over all event + processors in the pipeline): + <ul> + <li>Elements of the parameter array must be filled in given the + values in the raw event (see however <a href='tree.htm'> programming with tree parameters</a>). + </li> + <li>One of the event processor <tt>operator()</tt> methods must + indicate the size of the event in bytes so that SpecTcl knows + where to find the next event in whatever buffer it is using. + </li> + <li> + If nothing terrible happened that requires event processing to be + aborted, the method must return <tt>kfTRUE</tt> to enable processing + to continue and histogramming of the resulting event array to be + performed. + </li> + </ul> +</p> +<p> + The following parameters are passed to <tt>operator()</tt> + <ol> + <li><tt>const Address_t pEvent</tt> This is a pointer to the start of + the raw event that is being analyzed. + </li> + <li><tt>CEvent& rEvent</tt> + This is a reference to the parameter array that needs to be filled + in for this event. <tt>rEvent</tt> is actually an array like + object that automatically expands to fit the required number + of parameters. The SpecTcl <tt>parameter</tt> command defines + a correspondence between an array index and a SpecTcl named + parameter. It is this correspondence that allows SpecTcl + to drive its histogramming. + </li> + <li><tt>CAnalyzer& rAnalyzer</tt> + This is a reference to the object that directs the main flow + of event processing. The services provided by this object + are defined in <tt>Analyzer.h</tt> (base class). When SpecTcl is + constructed to use the event processing pipeline, the + actual type of this analyzer is a <tt>CTclAnalyzer</tt>. + See <a href='#setting_event_size'>Setting the Event Size</a> + below for more information about why you will need to know this. + </li> + <li><tt><a href="decoder.htm">CBufferDecoder</a>& rDecoder</tt> + Is a reference to the object that has been associated with the data + source and knows enough about the overall structure of the data + to be able to tell the analyzer what types of data to process next. + <tt>BufferDecodeer.h</tt> provides the base class functionality. + See <a href='#byte_ordering'>Byte Ordering and the Raw Event</a> for + at least one point in which you will want to interact with this object. + Specific types of buffer decoders may provide other services. + Since the buffer decoder is a property of the data source, you should + never assume you know the actual buffer decoder type but use + the <b>dynamic_cast</b> operator and catch/test failures in converting + the buffer decoder reference to a reference/pointer to a specific + decoder type. + If you don't know what <b>dynamic_cast</b> does, consult a + C++ reference. + </li> + </ol> + +</p> + + +<h4 id='filling_revent'>Decoding the event</h4> +<p> + Of necessity how you decode an event an how you fill the <tt>rEvent</tt> + paramter is very application specific. The <tt>rEvent</tt> object can + be treated as an array of double precision floats. + Elements can be assigned to and fetched using normal + indexing. Each element also has a method <tt>isValid</tt> that only + returns true if the element has been assigned a value for this event. +</p> +<p> + You may always assign an element of <tt>rEvent</tt> a value but if you + attempt to read a value for which <tt>isValid</tt> would return false, + a <tt>std::string</tt> exception will be thrown. The value of this + exception will be: <tt>Attempted getValue of unset ValidValue object</tt> +</p> + +<p> + The <a href='tree.htm'>tree parameter</a> package allows you impose structure + on the <tt>rEvent</tt> array. Most event processors at the NSCL use + the tree parameter pacakge. +</p> + +<h4 id='byte_ordering'>Handling byte order differences</h4> + +<p> + SpecTcl is written to be byte order independent. Specifically SpecTcl users + outside the NSCL have ported and run SpecTcl on big-endian systems. + If this talk of endianess does not mean anything to you see + <a href='http://en.wikipedia.org/wiki/Endianness'>this wikipedia article</a>. +</p> +<p> + Data taken from some data source will have a specific endian-ness that + my not match the endian-ness of the system SpecTcl is running on. The + <tt>TranslatorPointer</tt> templated class provides an object that behaves + like a pointer but transparently swaps bytes for the family of integer types + if necessary. This is possible because NSCLDAQ data contains information + that allows software to determine if the endian-ness of the data and + the running system are different. +</p> +<p> + The buffer decoder object <tt>rDecoder</tt> is expected to be able to determine + and manufacture an appropriate TranslatorPointer for you. The TranslatorPointer + class (described in <tt>TranslatorPointer.h</tt>) can also convert between + pointers for different types. The translator poniter can only create + translator pointer for addresses that live within the event currently being + analyzed. +</p> +<p> + Here's a code snippet that shows how to create a translator pointer: + +</p> +<pre> + TranslatorPointer<UShort_t> p(*(rDecoder.getBufferTranslator()), pEvent); +</pre> + + +<h4 id='setting_event_size'>Setting the Event Size</h4> +<p> + At least one element of the event processing pipeline must report the + event size in bytes. This is done by converting the analyzer to + refer to a <tt>CTclAnalyzer</tt> and invoking its + <tt>SetEventSize</tt> method. +</p> +<p> + The example in <tt>MySpecTclApp.cpp</tt> is a bit old and a better + way to perform this operation is shown below. The method shown assumes + an event whose first word (16 bits) contains a self inclusive word count. +</p> +<pre> + TranslatorPointer<UShort_t> p(*(rDecoder.getBufferTranslator()), pEvent); + + try { + CTclAnalyzer& rAna(dynamic_cast<CTclAnalyzer&>(rAnalyzer)); + UShort_t nWords = *p++; + rAna.SetEventSize(nWords*sizeof(UShort_t)); // Set event size. + } + catch (bad_cast& error) { + // Control lands here if the analyzer is not CTCLAnalyzer. + // That's probably a severe enough error to report and exit: + + std::cerr << "rAnalyzer is not a CTclAnalyzer!!!<< error.what() + << std::endl; + exit(EXIT_FAILURE); + + } +</pre> + +<p> + The services offered both by the base class and a specific buffer decoder + may be useful to you. See <a href='decoder.htm'>here</a> for more + information about those services both for the base class and derived + classes that are packaged with SpecTcl. +</p> + +<h3 id='begin'>OnBegin</h3> +<p> + This method is called for an event that signals the beginning of a run. + The method is supposed to return <tt>kfTRUE</tt> on success and is passed + the following parameters: +</p> +<ol> + <li><tt>CAnalyzer& rAnalyzer</tt></li> + <li><tt><a href="decoder.htm">CBufferDecoder</a>& rDecoder</tt></li> +</ol> +<p> + These parameters are described in the section above that describes the + <a href='#functor'><tt>operator()</tt></a> methods. +</p> + + +<h3>OnEnd</h3> +<p> + This method is called for an event that signals the end of a run. + The parameters are the same as for <a href='#begin'><tt>OnBegin</tt></a>. +</p> + +<h3>OnPause</h3> +<p> + This method is called for an event that signals a pause run. Note that not + all data sources can signal this event type. The parameters for this method + are the same as for <a href='#begin'><tt>OnBegin</tt></a>. +</p> + +<h3>OnResume</h3> +<p> + This method is called for an event that signals a resume run. Note that + not all data sources can signal this event type. + The parameters for this method + are the same as for <a href='#begin'><tt>OnBegin</tt></a>. +</p> + +<h3>OnOther</h3> +<p> + This method is called when an event type other than the ones handled by + the methods previously described. The parameters passed to this method are: + +<ol> + <li><tt>UInt_t type</tt></li> + <li><tt>CAnalyzer& rAnalyzer</tt></li> + <li><tt><a href="decoder.htm">CBufferDecoder</a>& rDecoder</tt></li> +</ol> + +The <tt>rAnalyzer</tt> and <tt>rDecoder</tt> parameters have been described +previously. The <tt>type</tt> parameter is the type of the event. The type of +event may depend on the event source. + +<h3>OnEventSourceOpen</h3> +<p> + Called when a new event source is opened. +</p> +<h3>OnEventSourceEOF</h3> +<p> + Called when an event source hits the end of file. +</p> + + +<p><a href="#Top">Top</a></p> + +<p><a href="../index.htm">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + +<hr> + +<p>Last Modified: <!--webbot bot="Timestamp" s-type="EDITED" +s-format="%B %d, %Y" startspan -->October 28, 2003<!--webbot +bot="Timestamp" endspan i-checksum="30351" --> by: <a +href="mailto:fo...@ns...">fo...@ns...</a><br> +<font size="2">\xA9 Copyright NSCL 1999, All rights reserved</font></p> +</body> +</html> Added: branches/SpecTcl-3.4/doc/tailoring/make.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/make.htm (rev 0) +++ branches/SpecTcl-3.4/doc/tailoring/make.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,87 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" +content="text/html; charset=iso-8859-1"> +<meta name="GENERATOR" content="Microsoft FrontPage 2.0"> +<title>Building a tailored SpecTcl.</title> +</head> + +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <th width="9%" nowrap><a href="http://www.nscl.msu.edu"><img + src="../images/nscl_logo_small.gif" + alt="nscl_logo_small.gif (2463 bytes)" width="63" + height="52"></a></th> + <td width="79%"><h1>Building a tailored SpecTcl.</h1> + </td> + <td width="12%"><a href="../index.htm"><img + src="../images/hh00706_.jpg" + alt="HH00706_.wmf (6530 bytes)" width="192" height="84"></a></td> + </tr> +</table> + +<p><a href="../index.htm" name="Top">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + + +<!-- Content goes here --> +<p> + The SpecTcl skeleton comes with a template Makefile. There are only two + things you'll usually need to know and adjust. +</p> +<ol> + <li> + The <tt>INSTDIR</tt> Makefile variable at the top of the Makefile + points to the installation directory of SpecTcl. In many cases this can + just be modified when upgrading SpecTcl to get the build to work on a newer + verson of the software. If you are moving SpecTcl to some other institution + where SpecTcl is installed differently this is the only variable you'll + need to change to get allow the Makefile to build for the same version + in this new environment. + </li> + <li> + The OBJECTS variable is the set of .o's that you want to build. If you + have added any sourc files to the build (likely) you need to add them + to this. + </li> +</ol> +<p> + Once you have made the appropriate changes you can: +<pre> + make +</pre> +<p> +To build SpecTcl. +</p> + + + + + +<!-- Content ends --> + +<p><a href="#Top">Top</a></p> + +<p><a href="../index.htm">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + +<hr> + +<p>Last Modified: <!--webbot bot="Timestamp" s-type="EDITED" +s-format="%B %d, %Y" startspan -->October 28, 2003<!--webbot +bot="Timestamp" endspan i-checksum="30351" --> by: <a +href="mailto:fo...@ns...">fo...@ns...</a><br> +<font size="2">\xA9 Copyright NSCL 1999, All rights reserved</font></p> +</body> +</html> Modified: branches/SpecTcl-3.4/doc/tailoring/modifyin.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/modifyin.htm 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/doc/tailoring/modifyin.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -37,19 +37,25 @@ have added files (in addition to UserCode.cpp), or changed names, modify this Makefile to reflect these changes.</p> -<p>To create your version of SpecTcl simply type:</p> +<p> + In most cases, tailoring SpecTcl for a data set means: + <ol> + <li> + <a href='eventprocessor.htm'>Writing one or more event processors + that convert raw events into + parameters.</a> + </li> + <li> + <a HREF='pipeline.htm'>Setting up the event analysis pipeline so that + the event processors + are run in the appropriate order.</a> + </li> + <li> + <a HREF='make.htm'>Building the tailored SpecTcl.</a> + </li> + </ol> +</p> -<pre>$ make</pre> - -<h4>NOTE:</h4> - -<p>The SpecTcl makefile includes a macro which defines the -location of the SpecTcl installation. Therefore, while you may -move your sources from system to system unmodified, you should -either re-copy the Makefile from Skel on the target system when -you do so or, alternatively, edit the Makefile to reflect the -correct installation directory for SpecTcl.</p> - <p><a href="#Top">Top</a></p> <p><a href="../index.htm">SpecTcl Home</a> <a Added: branches/SpecTcl-3.4/doc/tailoring/pipeline.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/pipeline.htm (rev 0) +++ branches/SpecTcl-3.4/doc/tailoring/pipeline.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,402 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<title>Setting up the event processing pipeline</title> +</head> + +<body> + +<table border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <th width="9%" nowrap><a href="http://www.nscl.msu.edu"><img + src="../images/nscl_logo_small.gif" + alt="nscl_logo_small.gif (2463 bytes)" width="63" + height="52"></a></th> + <td width="79%"><h1>Creating the event processing pipeline</h1> + </td> + <td width="12%"><a href="../index.htm"><img + src="../images/hh00706_.jpg" + alt="HH00706_.wmf (6530 bytes)" width="192" height="84"></a></td> + </tr> +</table> + + + +<p><a href="#Top">Top</a></p> + + +<p> + The event processing pipeline provides an ordered set of event processors + to the SpecTcl analyzer. The main duty of the event processing pipeline + is to convert a raw event into a set of event parameters from which + histogramming then proceeds. + Event processors are described in detail <a href='eventprocessor.htm'>here</a> +</p> +<p> + This page describes: + <ol> + <li><a href='#create_analysis_pipeline'>How to set up an initial set of + event processors</a></li> + <li><a href='#api'>The API that allows you to dynamically create event + processors</a></li> + <li><a href='#delayload'>A trick you can use to ensure event processors + get added in the right order</a></li> + </ol> +<p> + +<h2 id='create_analysis_pipline'>Creating the initial analysis pipeline</h2> + +<p> + SpecTcl provides a file <tt>MySpecTclApp.cpp</tt> as part of the + <a href='obtainin.htm'>skeleton code you obtain</a> when you start the + tailoring process. This file defines and instantiates an object + <tt>CMySpecTclApp</tt> that has methods that are called at specific + points in the initialization process. +</p> +<p> + One of these methods is <tt>CreateAnalysisPipeline</tt>. This is called + early in SpecTcl's initialization. This method can be used to set up an + initial analysis pipeline. The base class of + <tt>CMySpecTclApp</tt> provides a method, <tt>RegisterEventProcessor</tt>, + for this purpose. +</p> +<p> + <tt>RegisterEventProcessor</tt> adds an event processor to the end of the + analysis pipeline. Its argument signature is: +</p> +<pre> +void RegisterEventProcessor(CEventProcessor& rEventProcessor, + const char* name = 0); +</pre> + +<ul> + <li><tt>rEventProcessor</tt> is a reference to an event processor object + you want added to the pipeline. + </li> + <li><tt>name</tt> is an optional name to assign to this event processor. + If omitted or a null pointer a n ame will be chosen by SpecTcl. + The name can be used in <a href='#api'>API</a> calls to loate the + event processor in the future, provided all event processors + are given unique names. + </li> +</ul> +<p> + For example, suppose you have an event procesosr class EP and want + to register an instance of it in the event processing pipelien. + You could: +</p> +<pre> + RegisterEventProcessor(*(new EP), "anEP"); +</pre> + + +<h2 id='api'>Dynamically manipulating the event processor pipeline</h2> + +<p> + The SpecTcl API allows you to dynamically manipulate the event processing + pipeline. SpecTcl plugins such as the calibrated parameter plugin use this + API to register event processors as they load. +</p> +<p> + In <a href='#delayload'>the next section</a> of this page we'll see how + to use the API and a little trick to get event processors loaded that might + depend on the existence of calibrated parameters. +</p> +<p> + This section provides an overview of the SpecTcl API's methods for + manipulating the event processor pipeline. +</p> +<p> + To use the SpecTcl API you will need to get a pointer or reference to the + API object. The code snipped below shows how to get a pointer and a reference + to the API. Whether you use a pointer or a reference depends on whether you + prefer to use <tt>.</tt> or <tt>-></tt> oeprations to access methods in + the API. +</p> +<pre> + + #include <SpecTcl.h> + ... + + SpecTcl* pApi = SpecTcl::getInstance(); // pointer + SpecTcl& rApi = *(SpecTcl::getInstance()); // reference + ... +</pre> +<p> + Once you have a reference or pointer you can dereference it to invoke any + of the following event processor pipeline manipulation methods: +</p> + +<h3 id='add'>AddEventProcessor</h3> +<p> + This method adds a new event processor at the end of the event processing + pipeline. The signature of this method is: +</p> +<pre> +void SpecTcl::AddEventProcessor(CEventProcessor& eventProcessor, const char* name = 0); +</pre> + +<p> +The <tt>eventProcessor</tt> parameter is a reference to a new event processor +object to add and <tt>name</tt> is an optional name to give the event processor. +</p> +<p> + To add an event processor at a position other than the beginning of the + pipeline see <a href='#insert'>InsertEventProcessor</a> below. +</p> + +<h3>FindEventProcessor</h3> +<p> + Locates an event processor in the event processing pipeline. This is + an overloaded method with two signatures as shown below: +</p> +<pre> +CTclAnalyzer::EventProcessorIterator FindEventProcessor(std::string name); +CTclAnalyzer::EventProcessorIterator FindEventProcessor(CEventProcessor& processor); +</pre> +<p> + The first signature locates an event processor in the pipeline given its name. + If there are several event processors with the same name, the one most + towards the front of the pipeline is located. +</p> +<p> + The second signature locates an event processor in the pipline by a reference + to the object itself. For example: +</p> +<pre> +MyEventProcessor* pEp(0); +... +{ + .... + SpecTcl* pApi = SpecTcl::getInstance(); + pEp = new MyEventProcessor; + pApi->AddEventProcessor(*pEp, "My Event Processor); + + ... +} +.... +{ + ... + + SpecTcl* pApi = SpecTcl::getInstance(); + + // Find by name: + + CTclAnalyzer::EventProcessorIterator pNamed = pApi->FindEventProcessor("My Event Processor"); + + // Find by object: + + CTclAnalyzer::EventProcessorIterator p = pApi->FindEventProcessor(*pEp); +} +</pre> +<p> + The returned value is a <i>iterator</i> to the event processing pipeline. + The <tt>CTclAnalyzer::EventProcessorIterator</tt> class is defined in + <tt>TCLAnalyzer.h</tt> as a <tt>std::pair</tt> whose first element is the + name of the event processor an whose second element is a pointer to the + event processor object. +</p> +<p> + If the event processor cannot be found in the pipeline, the same value + returned from <a href='#end'>ProcessingPipelineEnd()</a> is returned. + So for example: +</p> +<pre> + ... + SpecTcl* pApi = SpecTcl::getInstance(); + + TclAnalyzer::EventProcessorIterator p = pApi=>FindEventProcessor("My Processor"); + if (p == pApi->ProcessingPipelineEnd()) { + std::cerr << "'My Processor' is not in the event processing pipeline\n; + } else { + std::cerr << "Found '" << p->first << "'\n"; + } +</pre> + +<p> + If you are not familiar with the concept of iterators have a look at the + <a href='http://en.wikipedia.org/wiki/Iterator'>Wikipedia article</a> + on iterators. Another good source is sections 2.3 and chapter 4 of + Mussser, Derge and Saini's <u>STL Tutorial and Reference Guide</u> + (Addison-Wesley Professional Computing Series 2001 ISBN 0-201-37923-6). +</p> + +<h3 id='insert'>InsertEventProcessor</h3> +<p> + This method allows you to insert an event processor before any element in + the pipeline. The signature of this method is: +</p> +<pre> +void InsertEventProcessor( + CEventProcessor& processor, CTclAnalyzer::EventProcessorIterator where, const char* name = 0 +); +</pre> +<p> + <tt>processor</tt> is a reference to the event processor to add. + <tt>where</tt> is an iterator that 'points' to an element of the pipeline + after which to add the event processor. <tt>name</tt> is the name to + assign to the new pipeline element. +</p> + +<p> + The example below adds an element before the element named <tt>after</tt>. + If there is no such element, nothing is done. +</p> +<pre> + ... + SpecTcl* pApi = SpecTcl::getInstance(); + TclAnalyzer::EventProcessorIterator p = pApi->FindEventProcessor("after"; + if (p != pApi->ProcessingPipelineEnd()) { + pApi->InsertEventProcessor(*(new MyEventProcessor), p, "prior"); + } +</pre> + +<p> + Note that you can insert an element at the beginning of the event procsssing + pipeline by using the iterator returned by <a href='#begin'>ProcessingPipelineBegin</a> + as well. Using the <a href='#end'>ProcessingPipelineEnd</a> iterator allows + you to insert items at the end (as does + <a href='#add'>AddEventProcessor</a>). + ) +</p> + +<h3>RemoveEventProcessor</h3> +<p> + Removes an event processor fromt he processing pipeline. This has two + forms: +</p> +<pre> +void RemoveEventProcessor(CTclAnalyzer::EventProcessorIterator here); +void RemoveEventProcessor(std::string name); +</pre> +<p> + The first of these removes an event processor given an interator to it. + The second is a convenience method that finds the event processor + named <tt>name</tt> and removes it. The second method is a no-op if + handed a <tt>name</tt> that does not correspond to an event processor. +</p> + +<p> + The example below shows a use case for using the first method: +</p> +<pre> +CMyEventProcessor* pEp(0); +{ + ... + SpecTcl* pApi = SpecTcl::getInstance(); + pEp = new CMyEventProcessor(); + pApi->AddEventProcessor(*pEp); // We don't know the name of this. + + .... + + + // But now we want to delete it and we don't know it's name: + + CTclAnalyzer::EventProcessorIterator p = pApi->FindEventProcessor(*pEp); + pApi->RemoveEventProcessor(p); + delete pEp; +} +</pre> + +<h3>ProcessingPipelineSize</h3> +<p> + Returns the number of elements in the event processing pipeline. The + signature of this method is: +</p> +<pre> +UInt_t ProcessingPipelineSize() +</pre> +<h3 id='begin'>ProcessingPipelineBegin</h3> +<p> + Returns an iterator that 'points' to the first element of the event + processing pipeline. The signature of this method is: +</p> +<pre> +CTclAnalyzer::EventProcessorIterator ProcessingPipelineBegin() +</pre> +<h3 id='end'>ProcessingPipelineEnd()</h3> + +<p> + Returns an iterator that is beyond the last element of the pipeline. + If an iterator is equal to the value returned by this method it is not + in the pipeline. Doing an insert using this iterator is the same as appending + to the pipeline. +</p> +<p> + The signature for this method is: +</p> +<pre> +CTclAnalyzer::EventProcessorIterator ProcessingPipelineEnd() +</pre> + +<h2 id='delayload'>Loading event processors after initialization</h2> + +<p> + Sometimes you need to load an event processor at a time that's not convenient + to what is directly supported in the preceding discussion. Suppose, for + example, you SpecTcl registers some event processors that produce raw parameters + and you the, in <tt>SpecTclRC.tcl</tt> load the calibrated parameter + plug-in and use it produce parameters that have physically meaningful value. +</p> +<p> + Suppose further you want to add an event processor that uses those calibrated + parameters (e.g. to compute an energy sum). It can be a bit hard to see how to + do this. +</p> +<p> + One simple trick is to have an event processor whose purpose on life is to + register another event processor. The key to this working is that calibparam + registers a single event processor at load time which computes all calibrated + parameters that are defined. This means that once the <tt>SpecTclRC.tcl</tt> + has done the <tt>load</tt> command to load the plugin, the event processor + is registered and another one can be registered that can make use of parameters + computed by the plugin. +</p> +<p> + Another key is to use the <a href='tree.htm'>tree parameter package</a> to + bind variables to named parameters so you don't need to know which parameter + the calibrated parameters are bound to. +</p> +<p> + You can provide and register + an event processor that only implements <tt>OnInitialize</tt>. + In <tt>OnInitialize</tt> you will create and register an instance + of the event processor that depends on the calibrated parameters. + The <a href='#api'>API functions</a> described in the previous section + describe how to do this. +</p> + +<p> + Another alternative is to write a plugin that is loaded later. + Writing plugins is beyond the scope of this page. Plugins, however + are just shared object libraries that can be loaded via the Tcl + <tt>load</tt> commmand. As part of their load process, Tcl + invokes an initialization function which can get access to the + <a href='#api'>SpecTcl API</a> and register additional event processors. +</p> +<p> + For more information about this approach see the Tcl manpage on the + load command (e.g at this time at <a href='http://www.tcl.tk/man/tcl8.6/TclCmd/load.htm'> + The Tcl website</a> + +</p> + +<p><a href="../index.htm">SpecTcl Home</a> <a +href="../general_information.htm">General Information</a> <a +href="../users_guide.htm">User Guide</a> <a +href="../programmers_guide.htm">Programmer's Guide</a> <a +href="../obtaining_and_installing.htm">Obtaining and Installing</a></p> + + +<hr> + +<p>Last Modified: <!--webbot bot="Timestamp" s-type="EDITED" +s-format="%B %d, %Y" startspan -->October 28, 2003<!--webbot +bot="Timestamp" endspan i-checksum="30351" --> by: <a +href="mailto:fo...@ns...">fo...@ns...</a><br> +<font size="2">\xA9 Copyright NSCL 1999, All rights reserved</font></p> +</body> +</html> Modified: branches/SpecTcl-3.4/doc/tailoring/tailoring.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/tailoring.htm 2013-04-29 18:49:16 UTC (rev 2080) +++ branches/SpecTcl-3.4/doc/tailoring/tailoring.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -48,7 +48,7 @@ software you have copied.</a></li> <li><a href="../treeparam/TreeParameter.html"> Describes how to use the TreeParameter subsystem to structure your unpacked data.</a> - <li><a href="building.htm">Describes how to build a version + <li><a href="make.htm">Describes how to build a version of SpecTcl tailored to your needs</a></li> <li><a href="supporti.htm">Describes how to make advanced modifications to SpecTcl's skeleton to support analysis Added: branches/SpecTcl-3.4/doc/tailoring/tree.htm =================================================================== --- branches/SpecTcl-3.4/doc/tailoring/tree.htm (rev 0) +++ branches/SpecTcl-3.4/doc/tailoring/tree.htm 2013-05-02 18:22:37 UTC (rev 2081) @@ -0,0 +1,643 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> + +<html> + +<head> +<meta http-equiv="Content-Type" +content="text/html charset=iso-8859-1"> +<meta name="GENERATOR" content="Microsoft FrontPage 2.0"> +<title>The Tree Parameter Package.</title> +</head> + +<b... [truncated message content] |
From: <ro...@us...> - 2013-05-10 10:53:05
|
Revision: 2084 http://sourceforge.net/p/nsclspectcl/code/2084 Author: ron-fox Date: 2013-05-10 10:53:00 +0000 (Fri, 10 May 2013) Log Message: ----------- Factor tcl/tk tests into m4/tcl.m4 and modify Makefiles accordintly Modified Paths: -------------- branches/SpecTcl-3.4/Display/Makefile.am branches/SpecTcl-3.4/EventSource/Makefile.am branches/SpecTcl-3.4/Events/Makefile.am branches/SpecTcl-3.4/Filter/Makefile.am branches/SpecTcl-3.4/Fits/Makefile.am branches/SpecTcl-3.4/Gates/Makefile.am branches/SpecTcl-3.4/Makefile.am branches/SpecTcl-3.4/Sorter/Makefile.am branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/SpectrumIO/Makefile.am branches/SpecTcl-3.4/TCL/Makefile.am branches/SpecTcl-3.4/TestFiles/Makefile.am branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/calibratedparams/Makefile.am branches/SpecTcl-3.4/ccusb/Makefile.am branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am branches/SpecTcl-3.4/contrib/scriptable/Makefile.am branches/SpecTcl-3.4/radware/Makefile.am branches/SpecTcl-3.4/vmusb/Makefile.am Modified: branches/SpecTcl-3.4/Display/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Display/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Display/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -12,7 +12,7 @@ Xamine_LDFLAGS= -g Xamine_LDADD= $(PARSEOBJECTS) @XLIBSW@ @MOTIF_LIBSW@ @XTLIBSW@ @GDLDSW@ \ - $(TCL_LDFLAGS) \ + @TK_LIBS@ @TCL_LIBS@ \ -lXm -lXt -lX11 -lm -lfl $(X11EXTRA_LDFLAGS) # Xamine_LDADD = $(PARSEOBJECTS) -lXm -lXt -lX11 -lm -lfl $(X11EXTRA_LDFLAGS) @@ -20,8 +20,8 @@ XCCFLAGS = -g -c -w -I. -I.. $(INCLUDES) -DXTFUNCPROTO -DXAMINE -AM_CXXFLAGS = -g -pedantic $(TCL_FLAGS) -AM_CFLAGS = -g -pedantic $(TCL_FLAGS) +AM_CXXFLAGS = -g -pedantic @TCL_CPPFLAGS@ +AM_CFLAGS = -g -pedantic @TCL_CPPFLAGS@ install-exec-local: $(mkinstalldirs) $(prefix)/etc @@ -165,7 +165,7 @@ colorset_LDADD = @XLIBSW@ @MOTIF_LIBSW@ @XTLIBSW@ -lXm -lXt -lX11 -lfl $(X11EXTRA_LDFLAGS) -Xaminetest_LDADD = -lXamine -lm $(TCL_LDFLAGS) +Xaminetest_LDADD = -lXamine -lm @TK_LIBS@ @TCL_LIBS@ Xaminetest_LDFLAGS = -L. Modified: branches/SpecTcl-3.4/EventSource/Makefile.am =================================================================== --- branches/SpecTcl-3.4/EventSource/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/EventSource/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,8 +1,7 @@ INCLUDES = -I. -I../Utility -I../NSCLException -I../Tape -I../SpecTcl \ - -I../Events -I../TCL -I../Filter @TCL_FLAGS@ + -I../Events -I../TCL -I../Filter @TCL_CPPFLAGS@ -LDADD=-L. @TCL_LDFLAGS@ -# AM_LDFLAGS=-L. @TCL_LDFLAGS@ +LDADD=-L. @TCL_LIBS@ @TK_LIBS@ lib_LTLIBRARIES = libEventSource.la Modified: branches/SpecTcl-3.4/Events/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Events/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Events/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -8,10 +8,10 @@ -I@top_srcdir@/factories \ -I@top_srcdir@/Display \ -I@top_srcdir@/Gates \ - @TCL_FLAGS@ @XINCLUDES@ -LDADD = @TCL_LDFLAGS@ -# AM_LDFLAGS = @TCL_LDFLAGS@ + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ @XINCLUDES@ +LDADD = @TK_LIBS@ @TCL_LIBS@ + lib_LTLIBRARIES = libAnalysis.la libAnalysis_la_LDFLAGS = -version-info $(SOVERSION):0 \ -Wl,"-rpath-link=$(libdir)" Modified: branches/SpecTcl-3.4/Filter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Filter/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Filter/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -3,7 +3,7 @@ -I@top_srcdir@/SpecTcl -I@top_srcdir@/Xamine \ -I@top_srcdir@/NSCLException -I@top_srcdir@/TCL \ -I@top_srcdir@/EventSource -I@top_srcdir@/Display \ - @TCL_FLAGS@ + @TCL_CPPFLAGS@ LDADD = -L. # AM_LDFLAGS = -L. Modified: branches/SpecTcl-3.4/Fits/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Fits/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Fits/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -27,12 +27,12 @@ -I@top_srcdir@/Filter \ -I@top_srcdir@/TCL \ -I@top_srcdir@/factories \ - $(TCL_FLAGS) + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ lib_LTLIBRARIES=libFits.la libFits_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" $(TCL_LDFLAGS) \ + -Wl,"-rpath-link=$(libdir)" @TK_LIBS@ @TCL_LIBS@ \ -lgsl -lgslcblas -lm libFits_la_SOURCES = CFit.cpp \ Modified: branches/SpecTcl-3.4/Gates/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Gates/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Gates/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,9 +1,9 @@ INCLUDES = -I. -I../Utility -I../Events -I../Xamine -I@top_srcdir@/Sorter \ -I@top_srcdir@/NSCLException + LDADD = -lTclGrammerCommands -lSorting -lXplus -lAnalysis -lEventSource \ -ltclPlus -lNSCLException -lXamine -ltape -ltk -ltcl -lXt -lX11 -lm \ - -L. @TCL_LDFLAGS@ -# AM_LDFLAGS = -L. @TCL_LDFLAGS@ + -L. @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libGates.la Modified: branches/SpecTcl-3.4/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -49,8 +49,8 @@ ln -s $(prefix)/include $(prefix)/Include ln -s $(prefix)/etc $(prefix)/Etc tar czf - doc |(cd $(prefix); tar xzf -) - echo TCLINCLUDES=$(TCL_FLAGS) > Directories.temp - echo TCLLIBS =$(TCL_LDFLAGS) -lm -ldl >> Directories.temp + echo TCLINCLUDES=$(TCL_CPPFLAGS) > Directories.temp + echo TCLLIBS =@TK_LIBS@ @TCL_LIBS@ -lm -ldl >> Directories.temp echo X11INCLUDES=$(X11INCLUDES) >> Directories.temp echo X11LIBS =$(XLIBSW) $(MOTIF_LIBSW) -lXm -lXt -lX11 >> Directories.temp cat Directories.include >> Directories.temp Modified: branches/SpecTcl-3.4/Sorter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,5 +1,5 @@ INCLUDES = -I. -I../Utility -I../NSCLException -I../Xamine -I../Gates \ - -I../Events -I../Display @TCL_FLAGS@ -I.. -I@top_srcdir@/Fits + -I../Events -I../Display @TCL_CPPFLAGS@ -I.. -I@top_srcdir@/Fits libSorting_la_LIBADD = @top_srcdir@/Xamine/libXplus.la \ @top_srcdir@/Gates/libGates.la \ @@ -9,8 +9,8 @@ @top_srcdir@/NSCLException/libException.la \ @top_srcdir@/Display/libXamine.la -# AM_LDFLAGS = -L. @TCL_LDFLAGS@ @XTLIBSW@ @XLIBSW@ + lib_LTLIBRARIES = libSorting.la libSorting_la_LDFLAGS = -version-info $(SOVERSION):0 \ -Wl,"-rpath=$(libdir)" Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -9,7 +9,7 @@ -I@top_srcdir@/Fits \ -I@top_srcdir@/factories \ -I@top_srcdir@/DecoderRing \ - @TCL_FLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ + @TCL_CPPFLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ install-exec-local: $(mkinstalldirs) $(prefix)/etc @@ -60,7 +60,6 @@ SpecTcl.h CFoldCommand.h CProjectionCommand.h CFitCommand.h \ IntegrateCommand.h - @@ -95,7 +94,7 @@ -L../Xamine -L../Display -L../Gates -L../EventSource -L../Events \ -L../TCL -L../NSCLException -L../Filter -L../Analysis -L../TreeParam \ -L../Fits -L@top_srcdir@/DecoderRing \ - -g -Wl,"-rpath=$(libdir)" -lgsl -lgslcblas @TCL_LDFLAGS@ @XLIBSW@ + -g -Wl,"-rpath=$(libdir)" -lgsl -lgslcblas @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ man_MANS = spectclapi.3 Modified: branches/SpecTcl-3.4/SpectrumIO/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,9 +1,9 @@ DEFS = @WCHAR_T_DEF@ INCLUDES = -I.. -I. \ -I../SpecTcl -I../Sorter -I../Utility -I../TCL -I../NSCLException \ - -I../Xamine -I../Events -I../Gates -I../Display @TCL_FLAGS@ -LDADD = -ltclPlus -lException -lXt -lX11 -L. @TCL_LDFLAGS@ -# AM_LDFLAGS = -L. @TCL_LDFLAGS@ + -I../Xamine -I../Events -I../Gates -I../Display @TCL_CPPFLAGS@ +LDADD = -ltclPlus -lException -lXt -lX11 -L. @TK_LIBS@ @TCL_LIBS@ +# AM_LDFLAGS = -L. @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libSpecio.la Modified: branches/SpecTcl-3.4/TCL/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TCL/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/TCL/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -13,14 +13,14 @@ touch $@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I.. -I. @TCL_FLAGS@ -I../Utility -I../NSCLException @XINCLUDES@ -LDADD = -ltclPlus -lException -lXt -lX11 $(X11EXTRA_LDFLAGS) -L. @TCL_LDFLAGS@ +INCLUDES = -I.. -I. @TCL_CPPFLAGS@ @TK_CPPFLAGS@ -I../Utility -I../NSCLException @XINCLUDES@ +LDADD = -ltclPlus -lException -lXt -lX11 $(X11EXTRA_LDFLAGS) -L. @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libtclPlus.la libtclPlus_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" @TCL_LDFLAGS@ + -Wl,"-rpath-link=$(libdir)" @TK_LIBS@ @TCL_LIBS@ testableSources = TCLInterpreter.cpp TCLProcessor.cpp \ TCLVariable.cpp TCLString.cpp \ @@ -108,7 +108,7 @@ tracetests_DEPENDENCIES = $(testableObjects) TestLdflags = $(testableObjects) $(CPPUNIT_LDFLAGS) $(X11EXTRA_LDFLAGS) \ - -L@top_srcdir@/NSCLException -lException @TCL_LDFLAGS@ + -L@top_srcdir@/NSCLException -lException @TK_LIBS@ @TCL_LIBS@ tracetests_LDADD = $(TestLdflags) Modified: branches/SpecTcl-3.4/TestFiles/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TestFiles/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/TestFiles/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,5 +1,5 @@ INCLUDES= -I. -I../EventSource -I../TCL -I../NSCLException \ - -I../Utility @TCL_FLAGS@ -I../Tape + -I../Utility @TCL_CPPFLAGS@ -I../Tape LDADD = -lEventSource -lException -ltape \ -L. -L../Events -L../EventSource -L../TCL -L../NSCLException \ Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -82,7 +82,7 @@ -I@top_srcdir@/Gates \ -I@top_srcdir@/Filter \ -I@top_srcdir@/factories \ - $(TCL_FLAGS) + @TCL_CPPFLAGS@ libTreeParam_la_LDFLAGS = -version-info $(SOVERSION):0 @@ -109,7 +109,7 @@ TestRunner_LDFLAGS = $(LibraryObjects) -L@top_srcdir@/TCL -ltclPlus \ -L@top_srcdir@/NSCLException -lException \ -L@top_srcdir@/Events -lAnalysis \ - $(TCL_LDFLAGS) $(CPPUNIT_LDFLAGS) + @TK_LIBS@ @TCL_LIBS@ $(CPPUNIT_LDFLAGS) noinst_HEADERS = Asserts.h Modified: branches/SpecTcl-3.4/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/calibratedparams/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/calibratedparams/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,4 +1,4 @@ -initLDFLAGS=@TCL_LDFLAGS@ +initLDFLAGS=@TK_LIBS@ @TCL_LIBS@ INCLUDES = -I. -I@top_srcdir@/Utility -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Xamine -I@top_srcdir@/TCL \ @@ -7,7 +7,7 @@ -I@top_srcdir@/Filter -I@top_srcdir@/Gates \ -I@top_srcdir@/Xamine -I@top_srcdir@/Display \ -I@top_srcdir@/factories \ - @TCL_FLAGS@ \ + @TCL_CPPFLAGS@ \ -D_DEBUG -DCHECK_ALL -DDESIGN_BY_CONTRACT @@ -51,6 +51,6 @@ $(mkinstalldirs) $(prefix)/TclLibs/calibration $(INSTALL_SCRIPT) *.tcl $(prefix)/TclLibs/calibration $(INSTALL_PROGRAM) .libs/libCalibrations.* $(prefix)/TclLibs/calibration - $(TCLSH_CMD) packages.tcl $(prefix)/TclLibs/calibration + @TCLSH@ packages.tcl $(prefix)/TclLibs/calibration echo "package ifneeded Calibrations 1.0 [list load [file join \$$dir libCalibrations.so]]" >> \ $(prefix)/TclLibs/calibration/pkgIndex.tcl Modified: branches/SpecTcl-3.4/ccusb/Makefile.am =================================================================== --- branches/SpecTcl-3.4/ccusb/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/ccusb/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -25,7 +25,7 @@ -I@top_srcdir@/Analysis \ -I@top_srcdir@/Display -I@top_srcdir@/Tape -I@top_srcdir@/Filter \ -I@top_srcdir@/TreeParam \ - @TCL_FLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ + @TCL_CPPFLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ CCUSBSpecTcl_LDFLAGS = ../SpecTcl/libTclGrammerCommands.la \ ../Events/libAnalysis.la \ @@ -47,7 +47,7 @@ ../Display/libXamine.la \ -lXt -lX11 @X11EXTRA_LDFLAGS@ @LD_EXTRA_FLAGS@ \ -lgsl -lgslcblas \ - @TCL_LDFLAGS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ + @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ -g -Wl,"-rpath=@libdir@" @@ -65,7 +65,7 @@ $(INSTALL_DATA) MakefileSkel @prefix@/CCUSBSkel/Makefile $(mkinstalldirs) @prefix@/TclLibs/ccusb $(INSTALL_DATA) spectclconfig.tcl @prefix@/TclLibs/ccusb - echo pkg_mkIndex @prefix@/TclLibs/ccusb *.tcl | $(TCLSH_CMD) + echo pkg_mkIndex @prefix@/TclLibs/ccusb *.tcl | @TCLSH@ $(mkinstalldirs) @prefix@/share/ccusb $(INSTALL_DATA) *.html @prefix@/share/ccusb $(INSTALL_DATA) *.pdf @prefix@/share/ccusb Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/configure.ac 2013-05-10 10:53:00 UTC (rev 2084) @@ -4,7 +4,7 @@ AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.3-015) +AM_INIT_AUTOMAKE(SpecTcl, 3.4) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT @@ -510,179 +510,8 @@ # Locate Tcl/Tk and setup compile/link switches for them too: -# TCL headers: -# We know of a few places the headers can live: -# /usr/include redhat linux. -# /usr/include/tcl debian dude that made link to default tcl. -# /usr/include/tcl<version> debian linux -# /usr/local/include default for source based install. -# Whatever the user specifies. -# For now, the versions we look for are determined by the -# variable tcl_versions that variable is a list of version -# number specifiers. -# +AX_TCL -tcl_versions="8.5 8.4 8.3 8.2 8.1 8.0" # First match; so order new -> old. - - -# The TCL Shell - used to run tests... must be in path. -# First check for a version qualified command: -# - -AC_MSG_CHECKING([for tcl shell command...]) -for version in $tcl_versions -do - name=tclsh${version} - AC_CHECK_PROG(TCLSH_CMD, $name, $name) -done - - -tcl_header_dir="" -AC_MSG_CHECKING([for tcl header directory]) - -AC_ARG_WITH(tcl-header-dir, - [ --with-tcl-header-dir=path Path to tcl headers], - [tcl_header_dir=$withval ; - tcl_headers_found="yes"],[tcl_headers_found="no"]) - - -# -# Look for tcl.h in the following places: -# Note that the order is important for Darwin and OSF1. - # - # /sw/include (Best for darwin). - # /usr/local/tcl/include (Best for NSCL Cygwin). - # /usr/local/include (Best for NSCL OSF1) - # /usr/include (Best for e.g. Linux). - # - # For all of these directories, - # look for tcl.h in: - # - the directory itself. - # - a tcl subdirectory to the directory. - # - subdirectories of the form tcl${version} where - # version is chosein from tcl_versions. - # - -tcl_h_testdirs="/sw/include /usr/local/tcl/include /usr/local/include \ - /usr/include" - -if test $tcl_headers_found = "no" -then - for d in $tcl_h_testdirs - do - for v in ${tcl_versions}; - do - if test $tcl_headers_found = "no" - then - AC_CHECK_FILE([${d}/tcl${v}/tcl.h], - [tcl_header_dir=${d}/tcl${v} - tcl_headers_found="yes"]) - fi - done - if test $tcl_headers_found = "no" - then - AC_CHECK_FILE([${d}/tcl.h], - [tcl_header_dir=$d - tcl_headers_found="yes"]) - fi - if test $tcl_headers_found = "no" - then - AC_CHECK_FILE([${d}/tcl/tcl.h], - [tcl_header_dir=${d}/tcl - tcl_headers_found="yes"]) - fi - done -fi - -if test $tcl_headers_found = "yes"; then - TCL_FLAGS=-I${tcl_header_dir} - AC_MSG_RESULT(Using path $tcl_header_dir) -else - AC_MSG_ERROR([can't find tcl.h try using --with-tcl-header-dir to help me]) -fi - -# Tcl libraries: -# We look for the following -# /sw/lib -# /usr/lib/libtcl.{so,dylib,a} - link to a default lib. -# /usr/lib/libtcl<version>.{so,dylib,a} - link to a specific lib. -# If --with-tcl-libdir=dir is supplied, that directory is -# searched first. -# ASSUMPTIONS: libtcl and libtk will have the same naming conventions. -# -# If the extension ofthe library is .so, always put in an -rpath directive. - -tcl_libsearchpath="" -tcl_libfound="no" -AC_MSG_CHECKING([Tcl/Tk library to use]) - - # Does the user want us to look somewhere in particular: - -AC_ARG_WITH(tcl-libdir, - [ --with-tcl-libdir=dir Specify where the tcl libraries live.], - [tcl_libsearchpath=$withval]) - -tcl_libsearchpath="$tcl_libsearchpath /sw/lib /usr/lib /usr/local/lib" - -tcl_libfiles="" -for v in ${tcl_versions} -do - tcl_libfiles="$tcl_libfiles libtcl${v}.so libtcl${v}.dylib libtcl${v}.a" -done -tcl_libfiles="$tcl_libfiles libtcl.so libtcl.dylib libtcl.a" - - -for dir in ${tcl_libsearchpath} -do - for file in ${tcl_libfiles} - do - fname=$dir/$file - AC_CHECK_FILE($fname, - [tcl_libdir=$dir - tcl_libname=$file - tcl_libfound="yes" - ]) - if test $tcl_libfound = "yes" - then - break - fi - done -done - -if test $tcl_libfound = "yes" ; then - # - # We need an -rpath if the library is a .so: - - base=$(basename "$tcl_libname") - ext="${base##*.}" - Tcl_Rpath="" - - if test $ext = "so" - then - Tcl_Rpath="-Wl,\"-rpath=${tcl_libdir}\"" - fi - - # Find the lib basename - - tcl_libname=$(echo $tcl_libname|cut -c 4- ) # trim off lib - - # The suffix now is either .so, .dylib or .a; basename can get rid of that: - - tcl_libname=$(basename $(basename $(basename $tcl_libname .a) .so) .dylib) - - # Rather than repeat this mess for tk, we require the same version and - # just replace the tcl with tk. - - tk_libname=tk$(echo $tcl_libname|cut -c 4-) # trim off tc...and use tk - - - TCL_LDFLAGS="-L${tcl_libdir} -l${tk_libname} -l${tcl_libname} ${Tcl_Rpath}" - AC_MSG_RESULT([Using directory $tcl_libdir]) - -else - AC_MSG_ERROR([Unable to find the tcl library, help me out with --with-tcl-libdir]) -fi - # Look for image magick convert # Try to find ImageMagick's convert program, used for converting postscript @@ -891,11 +720,6 @@ AC_SUBST(MANDB) -# tcl/tk -AC_SUBST(TCL_FLAGS) -AC_SUBST(TCL_LDFLAGS) -AC_SUBST(TCLSH_CMD) - # X flags AC_SUBST(X11EXTRA_LDFLAGS) Modified: branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -1,4 +1,4 @@ -initLDFLAGS=@TCL_LDFLAGS@ +initLDFLAGS=@TK_LIBS@ @TCL_LIBS@ INCLUDES = -I. -I@top_srcdir@/Utility -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Xamine -I@top_srcdir@/TCL \ @@ -6,7 +6,7 @@ -I@top_srcdir@/Sorter -I@top_srcdir@/EventSource \ -I@top_srcdir@/Filter -I@top_srcdir@/Gates \ -I@top_srcdir@/Xamine -I@top_srcdir@/Display \ - @TCL_FLAGS@ \ + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ \ -D_DEBUG -DCHECK_ALL -DDESIGN_BY_CONTRACT Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -6,7 +6,7 @@ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ -I@top_srcdir@/Analysis \ -I@top_srcdir@/Display -I@top_srcdir@/Tape -I@top_srcdir@/Filter \ - @TCL_FLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ bin_PROGRAMS=ScriptedSpecTcl lib_LTLIBRARIES=libScripted.la @@ -97,7 +97,7 @@ -L@top_srcdir@/Events -L@top_srcdir@/TCL -L@top_srcdir@/NSCLException \ -L@top_srcdir@/Filter -L@top_srcdir@/SpecTcl -L@top_srcdir@/Analysis \ -L@top_srcdir@/TreeParam -L@top_srcdir@/Fits \ - @TCL_LDFLAGS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ + @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ -g -Wl,"-rpath=($prefix)/lib" # Modified: branches/SpecTcl-3.4/radware/Makefile.am =================================================================== --- branches/SpecTcl-3.4/radware/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/radware/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -17,7 +17,7 @@ INCLUDES = -I. -I@top_builddir@ \ - $(TCL_FLAGS) -I@top_builddir@/TCL \ + $(TCL_CPPFLAGS) -I@top_builddir@/TCL \ -I@top_builddir@/Utility \ -I@top_builddir@/SpecTcl \ -I@top_builddir@/Events \ Modified: branches/SpecTcl-3.4/vmusb/Makefile.am =================================================================== --- branches/SpecTcl-3.4/vmusb/Makefile.am 2013-05-09 20:38:23 UTC (rev 2083) +++ branches/SpecTcl-3.4/vmusb/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) @@ -55,7 +55,7 @@ -I@top_srcdir@/Display -I@top_srcdir@/Tape -I@top_srcdir@/Filter \ -I@top_srcdir@/TreeParam \ -I@top_srcdir@/Fits -I@top_srcdir@/factories \ - @TCL_FLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ + @TCL_CPPFLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ VMUSBSpecTcl_LDFLAGS = ../SpecTcl/libTclGrammerCommands.la \ ../Events/libAnalysis.la \ @@ -77,7 +77,7 @@ ../Display/libXamine.la \ -lXt -lX11 @X11EXTRA_LDFLAGS@ @LD_EXTRA_FLAGS@ \ -lgsl -lgslcblas \ - @TCL_LDFLAGS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ + @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ -g -Wl,"-rpath=@libdir@" @@ -87,7 +87,7 @@ $(INSTALL_DATA) MakefileSkel @prefix@/VMUSBSkel/Makefile $(mkinstalldirs) @prefix@/TclLibs/vmusb $(INSTALL_DATA) spectclSetup.tcl configFile.tcl constants.tcl @prefix@/TclLibs/vmusb - echo pkg_mkIndex -verbose @prefix@/TclLibs/vmusb "*.tcl" | @TCLSH_CMD@ + echo pkg_mkIndex -verbose @prefix@/TclLibs/vmusb "*.tcl" | @TCLSH@ $(mkinstalldirs) @prefix@/share/vmusb $(INSTALL_DATA) *.html @prefix@/share/vmusb $(INSTALL_DATA) *.pdf @prefix@/share/vmusb This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-05-10 13:08:33
|
Revision: 2085 http://sourceforge.net/p/nsclspectcl/code/2085 Author: ron-fox Date: 2013-05-10 13:08:27 +0000 (Fri, 10 May 2013) Log Message: ----------- * Get CPPUNIT tests in configure.ac to use the m4/cppunit.m4 test * Modify the Makefile.am's to deal with the different defs. * Remove TreeParam tests until I can figure out how to resolve the circular link dependencies they result in between dirs. * ensure that mak clean install check-TESTS works. Modified Paths: -------------- branches/SpecTcl-3.4/Makefile.am branches/SpecTcl-3.4/Sorter/Makefile.am branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp branches/SpecTcl-3.4/TCL/Makefile.am branches/SpecTcl-3.4/TCL/tracevartest.cpp branches/SpecTcl-3.4/TreeParam/ListTest.cpp branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/TreeParam/SetAllVTest.cpp branches/SpecTcl-3.4/TreeParam/SetChansTest.cpp branches/SpecTcl-3.4/TreeParam/SetLimitsTest.cpp branches/SpecTcl-3.4/TreeParam/SetUnitsTest.cpp branches/SpecTcl-3.4/TreeParam/SetWidthTest.cpp branches/SpecTcl-3.4/TreeParam/UncheckTest.cpp branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/contrib/Makefile.am branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am branches/SpecTcl-3.4/contrib/scriptable/Makefile.am branches/SpecTcl-3.4/m4/tcl.m4 Modified: branches/SpecTcl-3.4/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -65,4 +65,7 @@ echo "Version: " SpecTcl-$(VERSION) build on `hostname` `date` >VERSION $(INSTALL_DATA) VERSION $(prefix)/VERSION $(INSTALL_DATA) CHANGELOG $(prefix) - $(MANDB) $(prefix)/man \ No newline at end of file + $(MANDB) $(prefix)/man + +check-TESTS: + - for d in $(SUBDIRS); do (cd $$d; make check-TESTS); done Modified: branches/SpecTcl-3.4/Sorter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -49,9 +49,9 @@ TestRunner_SOURCES=TestRunner.cpp TestDictObservers.cpp -TestRunner_CXXFLAGS=$(CPPUNIT_INCLUDES) +TestRunner_CXXFLAGS=@CPPUNIT_CFLAGS@ -TestRunner_LDADD = $(CPPUNIT_LDFLAGS) +TestRunner_LDADD = @CPPUNIT_LIBS@ noinst_HEADERS = Asserts.h Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -114,6 +114,8 @@ noinst_PROGRAMS = scalertests docbuftests +scalertests_CXXFLAGS=@CPPUNIT_CFLAGS@ +docbuftests_CXXFLAGS=@CPPUNIT_CFLAGS@ # TODO: Could probably add quite a few more headers above to this. # maybe *Command.h and *Package.h(?) @@ -135,11 +137,19 @@ DocumentationCallback.o -commonTestLdFlags= -L@top_srcdir@/Events -lAnalysis \ - -L@top_srcdir@/TCL -ltclPlus \ - -L@top_srcdir@/NSCLException -lException \ - -L@top_srcdir@/Analysis -lBufferAnalysis \ - $(CPPUNIT_LDFLAGS) $(TCL_LDFLAGS) +commonTestLdFlags= @top_builddir@/Events/libAnalysis.la \ + @top_builddir@/TCL/libtclPlus.la \ + @top_builddir@/NSCLException/libException.la \ + @top_builddir@/Analysis/libBufferAnalysis.la \ + @top_builddir@/SpecTcl/libTclGrammerCommands.la \ + @top_builddir@/Filter/libFilter.la \ + @top_builddir@/Sorter/libSorting.la \ + @top_builddir@/TreeParam/libTreeParam.la \ + @top_builddir@/Fits/libFits.la \ + @top_builddir@/DecoderRing/libDecoderRing.la \ + @top_builddir@/Tape/libtape.la \ + @top_builddir@/SpectrumIO/libSpecio.la \ + @CPPUNIT_LIBS@ @TK_LIBS@ @TCL_LIBS@ scalertests_LDFLAGS= ScalerProcessorCallbacks.o $(commonTestLdFlags) Modified: branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -65,7 +65,7 @@ string m_element; int m_flags; - virtual char* operator()(CTCLInterpreter* pInterp, + virtual const char* operator()(CTCLInterpreter* pInterp, char* pVariable, char* pElement, int flags) { Modified: branches/SpecTcl-3.4/TCL/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TCL/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TCL/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -13,7 +13,7 @@ touch $@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I.. -I. @TCL_CPPFLAGS@ @TK_CPPFLAGS@ -I../Utility -I../NSCLException @XINCLUDES@ +INCLUDES = -I.. -I. @TCL_CPPFLAGS@ @TK_CPPFLAGS@ -I../Utility -I../NSCLException @XINCLUDES@ LDADD = -ltclPlus -lException -lXt -lX11 $(X11EXTRA_LDFLAGS) -L. @TK_LIBS@ @TCL_LIBS@ @@ -99,15 +99,16 @@ noinst_HEADERS = Asserts.h +tracetests_CXXFLAGS= @CPPUNIT_CFLAGS@ +interptests_CXXFLAGS= @CPPUNIT_CFLAGS@ - tracetests_SOURCES = TestRunner.cpp \ ccallbacktest.cpp \ tracevartest.cpp tracetests_DEPENDENCIES = $(testableObjects) -TestLdflags = $(testableObjects) $(CPPUNIT_LDFLAGS) $(X11EXTRA_LDFLAGS) \ +TestLdflags = $(testableObjects) @CPPUNIT_LIBS@ $(X11EXTRA_LDFLAGS) \ -L@top_srcdir@/NSCLException -lException @TK_LIBS@ @TCL_LIBS@ Modified: branches/SpecTcl-3.4/TCL/tracevartest.cpp =================================================================== --- branches/SpecTcl-3.4/TCL/tracevartest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TCL/tracevartest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -31,7 +31,7 @@ m_flags(0), m_pInterp(0) {} - virtual char* operator()(CTCLInterpreter* pInterp, + virtual const char* operator()(CTCLInterpreter* pInterp, char* pVariable, char* pElement, int flags) { Modified: branches/SpecTcl-3.4/TreeParam/ListTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/ListTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/ListTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -19,6 +19,7 @@ #include <TCLList.h> #include <vector> #include <string> +#include <algorithm> #include "TreeTestSupport.h" @@ -64,7 +65,7 @@ CTreeParameter::BindParameters(); ListVisitor listAll("*", *m_pResult); - for_each(CTreeParameter::begin(), CTreeParameter::end(), listAll); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), listAll); CTCLList List(m_pInterp, string((*m_pResult))); StringArray list; @@ -80,7 +81,7 @@ CTreeParameter::BindParameters(); ListVisitor listAll("*.00", *m_pResult); - for_each(CTreeParameter::begin(), CTreeParameter::end(), listAll); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), listAll); CTCLList List(m_pInterp, string((*m_pResult))); StringArray list; Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -93,10 +93,20 @@ $(INSTALL_PROGRAM) *.tcl $(SCRIPTDEST) +## +# For now circular dependencies prevent this from being done until I get smarter +# and figure out how to build this in the check-TESTS target.. or until I separate this +# out into a separate test dir...because this depends on libTclGrammerCommands but +# other folks depend on us first ...including libTclGrammerCommands. +# + +if THIS_IS_NOT_DEFINED if CPPUNIT noinst_PROGRAMS=TestRunner +TestRunner_CXXFLAGS=@CPPUNIT_CFLAGS@ + TestRunner_SOURCES = ListTest.cpp SetWidthTest.cpp TreeParameterTest.cpp \ MatchTest.cpp TestRunner.cpp TreeVariableArrayTests.cpp \ SetAllVTest.cpp TestSuite.cpp TreeVariableCommandTests.cpp \ @@ -106,13 +116,23 @@ TestRunner_DEPENDENCIES = $(LibraryObjects) +TestRunner_LDADD = @top_builddir@/SpecTcl/libTclGrammerCommands.la \ + @top_builddir@/Sorter/libSorting.la \ + @top_builddir@/Fits/libFits.la \ + @top_builddir@/Filter/libFilter.la \ + @top_builddir@/DecoderRing/libDecoderRing.la \ + @top_builddir@/Events/libAnalysis.la \ + @top_builddir@/SpectrumIO/libSpecio.la \ + @top_builddir@/Tape/libtape.la \ + @top_builddir@/Analysis/libBufferAnalysis.la + TestRunner_LDFLAGS = $(LibraryObjects) -L@top_srcdir@/TCL -ltclPlus \ -L@top_srcdir@/NSCLException -lException \ - -L@top_srcdir@/Events -lAnalysis \ - @TK_LIBS@ @TCL_LIBS@ $(CPPUNIT_LDFLAGS) + @TK_LIBS@ @TCL_LIBS@ @CPPUNIT_LIBS@ noinst_HEADERS = Asserts.h TESTS=./TestRunner endif +endif \ No newline at end of file Modified: branches/SpecTcl-3.4/TreeParam/SetAllVTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/SetAllVTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/SetAllVTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -14,6 +14,7 @@ #include "CTreeParameterArray.h" #include "SetAllVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> #ifdef HAVE_STD_NAMESPACE using namespace std; @@ -49,7 +50,7 @@ CTreeParameterArray array("george", 10, 0); // Defaults... SetAllVisitor visitor("*", 200, 0, 200, "cm"); - for_each(CTreeParameter::begin(), CTreeParameter::end(), visitor); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), visitor); for (int i = 0; i < 10; i++) { string name = MakeElementName("george", 0, 10, i); Modified: branches/SpecTcl-3.4/TreeParam/SetChansTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/SetChansTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/SetChansTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -16,6 +16,8 @@ #include "SetChannelsVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> + #ifdef HAVE_STD_NAMESPACE using namespace std; #endif @@ -46,7 +48,7 @@ SetChannelsVisitor v("*", 200); double inc = g[0].getInc(); - for_each(CTreeParameter::begin(), CTreeParameter::end(), v); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), v); inc = inc /2.0; for(int i =0; i < 10; i++) { Modified: branches/SpecTcl-3.4/TreeParam/SetLimitsTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/SetLimitsTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/SetLimitsTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -17,6 +17,7 @@ #include "CTreeParameterArray.h" #include "SetLimitsVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> #ifdef HAVE_STD_NAMESPACE using namespace std; @@ -46,7 +47,7 @@ CTreeParameterArray g("george", 10, 0); SetLimitsVisitor v("*", 1.0, 200.0); double inc = g[0].getInc(); - for_each(CTreeParameter::begin(), CTreeParameter::end(), v); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), v); for(int i=0; i< 10; i++) { Modified: branches/SpecTcl-3.4/TreeParam/SetUnitsTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/SetUnitsTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/SetUnitsTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -15,6 +15,7 @@ #include "CTreeParameterArray.h" #include "SetUnitsVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> #ifdef HAVE_STD_NAMESPACE using namespace std; @@ -44,7 +45,7 @@ void SetUnitsTest::Units() { CTreeParameterArray g("george", 10, 0); SetUnitsVisitor v("*", "cm"); - for_each(CTreeParameter::begin(), CTreeParameter::end(), v); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), v); for(int i =0; i < 10; i++) { string name = MakeElementName("george", 0, 10, i); Modified: branches/SpecTcl-3.4/TreeParam/SetWidthTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/SetWidthTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/SetWidthTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -16,6 +16,8 @@ #include "SetWidthVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> + #ifdef HAVE_STD_NAMESPACE using namespace std; #endif @@ -47,7 +49,7 @@ CTreeParameterArray g("george", 10, 0); SetWidthVisitor v("g*", 0.2); - for_each(CTreeParameter::begin(), CTreeParameter::end(), v); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), v); for(int i =0 ; i < 10; i++) { string name= MakeElementName("george", 0, 10, i); Modified: branches/SpecTcl-3.4/TreeParam/UncheckTest.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/UncheckTest.cpp 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/TreeParam/UncheckTest.cpp 2013-05-10 13:08:27 UTC (rev 2085) @@ -14,6 +14,7 @@ #include "UncheckVisitor.h" #include "SetUnitsVisitor.h" #include "TreeTestSupport.h" +#include <algorithm> #ifdef HAVE_STD_NAMESPACE using namespace std; @@ -50,11 +51,11 @@ // First get them all changed: - for_each(CTreeParameter::begin(), CTreeParameter::end(), vu); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), vu); // Now reset the change flags: - for_each(CTreeParameter::begin(), CTreeParameter::end(), v); + std::for_each(CTreeParameter::begin(), CTreeParameter::end(), v); for(int i=0; i < 10; i++) { ASSERT(!(g[i].hasChanged())); Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/configure.ac 2013-05-10 13:08:27 UTC (rev 2085) @@ -657,42 +657,11 @@ +AM_PATH_CPPUNIT +AM_CONDITIONAL([CPPUNIT], [test -n "${CPPUNIT_LIBS}"] ) +AM_CONDITIONAL([THIS_IS_NOT_DEFINED], [test -n ""]) -# If cppunit is available we can try to bundle some tests. -# CPPUNIT will be defined to makefiles and CPPUNIT_INCLUDES -# CPPUNIT_LDFLAGS will be about what you'd expect them to be. - -AC_ARG_ENABLE(cppunit, - AS_HELP_STRING([--enable-cppunit],[build cppunit based tests]), - [havecppunit="check"], [havecppunit="no"]) - -if test "$havecppunit" != "no" -then - AC_LANG_PUSH(C++) - AC_MSG_CHECKING([for cppunit unit testing framework]) - - AC_CHECK_HEADERS([cppunit/Test.h], [havecppunit="yes"], [havecppunit="no"]) - AC_MSG_RESULT([$havecppunit]) - if test "$havecppunit" == "yes" - then - CPPUNIT_INCLUDES="" - CPPUNIT_LDFLAGS="-lcppunit" - AC_SUBST(CPPUNIT_INCLUDES) - AC_SUBST(CPPUNIT_LDFLAGS) - fi - -AC_LANG_POP(C++) - -# We also want the 'check' package for C language unit tests. - -# AM_PATH_CHECK() - -fi - -AM_CONDITIONAL(CPPUNIT, test $havecppunit == "yes") - - # We use mandb to index the man pages if it exists... not sure what the # alternatives are on other systems so transform mandb -> echo if # we can't find it: Modified: branches/SpecTcl-3.4/contrib/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/contrib/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -17,3 +17,5 @@ SUBDIRS=scriptable +check-TESTS: + - for d in $(SUBDIRS); do (cd $$d; make check-TESTS); done \ No newline at end of file Modified: branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -77,11 +77,13 @@ unittests_SOURCES = CommandTest.cpp FitTest.cpp CreatorTest.cpp FactoryTest.cpp \ CalibParamTest.cpp CalibManagerTest.cpp TestRunner.cpp +unittests_CXXFLAGS=@CPPUNIT_CFLAGS@ + unittests_DEPENDENCIES = $(MainObjects) TestObjects=@top_srcdir@/Events/Event.lo @top_srcdir@/SpecTcl/EventProcessor.lo -unittests_LDFLAGS = $(TestObjects) $(unittests_DEPENDENCIES) $(CPPUNIT_LDFLAGS) -L@top_srcdir@/TCL -ltclPlus \ +unittests_LDFLAGS = $(TestObjects) $(unittests_DEPENDENCIES) @CPPUNIT_LIBS@ -L@top_srcdir@/TCL -ltclPlus \ -L@top_srcdir@/NSCLException -lException \ -lgsl -lgslcblas -lm $(TCL_LDFLAGS) Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-10 13:08:27 UTC (rev 2085) @@ -146,24 +146,27 @@ unittest_SOURCES = SegUnpackerTest.cpp ModuleTest.cpp PacketTest.cpp CreatorTest.cpp \ UnpackerTest.cpp TestRunner.cpp +uinttest_CXXFLAGS=@CPPUNIT_CFLAGS@ + unittest_DEPENDENCIES = $(Main_Objects) -unittest_LDFLAGS = $(Main_Objects) $(CPPUNIT_LDFLAGS) \ - -L@top_srcdir@/SpecTcl -lTclGrammerCommands \ - -L@top_srcdir@/Sorter -lSorting \ - -L@top_srcdir@/Xamine -lXplus \ - -L@top_srcdir@/Gates -lGates \ - -L@top_srcdir@/Events -lAnalysis \ - -L@top_srcdir@/EventSource -lEventSource \ - -L@top_srcdir@/SpectrumIO -lSpecio \ - -L@top_srcdir@/TCL -ltclPlus \ - -L@top_srcdir@/NSCLException -lException \ - -L@top_srcdir@/Display -lXamine \ - -L@top_srcdir@/Tape -ltape \ - -L@top_srcdir@/Filter -lFilter \ - -L@top_srcdir@/TreeParam -lTreeParam \ - -L@top_srcdir@/Analysis -lBufferAnalysis \ - -L@top_srcdir@/Fits -lFits \ +unittest_LDFLAGS = $(Main_Objects) @CPPUNIT_LIBS@ \ + @top_builddir@/SpecTcl/libTclGrammerCommands.la \ + @top_builddir@/Sorter/libSorting.la \ + @top_builddir@/Xamine/libXplus.la \ + @top_builddir@/Gates/libGates.la \ + @top_builddir@/Events/libAnalysis.la \ + @top_builddir@/EventSource/libEventSource.la \ + @top_builddir@/SpectrumIO/libSpecio.la \ + @top_builddir@/TCL/libtclPlus.la \ + @top_builddir@/NSCLException/libException.la \ + @top_builddir@/Display/libXamine.la \ + @top_builddir@/Filter/libFilter.la \ + @top_builddir@/TreeParam/libTreeParam.la \ + @top_builddir@/Analysis/libBufferAnalysis.la \ + @top_builddir@/Fits/libFits.la \ + @top_builddir@/DecoderRing/libDecoderRing.la \ + @top_builddir@/Tape/libtape.la \ $(TCL_LDFLAGS) $(MOTIF_LIBSW) $(XLIBSW) -lXt -lX11 -lm Modified: branches/SpecTcl-3.4/m4/tcl.m4 =================================================================== --- branches/SpecTcl-3.4/m4/tcl.m4 2013-05-10 10:53:00 UTC (rev 2084) +++ branches/SpecTcl-3.4/m4/tcl.m4 2013-05-10 13:08:27 UTC (rev 2085) @@ -41,7 +41,7 @@ (configure gets Tk configuration from here)], TkLibBase=`echo ${withval} | sed s/tkConfig.sh\$//`) -AC_ARG_WITH(tk [ --with-tk=PATH USe Tk from PATH], +AC_ARG_WITH(tk, [ --with-tk=PATH Use Tk from PATH], TkLibBase="${withval}/lib") AC_ARG_WITH(wish, [--with-wish=WISH use WISH as the wish program This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-05-14 15:05:22
|
Revision: 2087 http://sourceforge.net/p/nsclspectcl/code/2087 Author: ron-fox Date: 2013-05-14 15:05:19 +0000 (Tue, 14 May 2013) Log Message: ----------- Extract libTcl/libException from the main tarball: - Use tcl++incorp.sh to pull out a tagged version of that into the source tree. - configure determines if a centrally installed version can be used or alternatively builds/installs and uses the version tcl++incorp.sh incorporated into the build tree. Modified Paths: -------------- branches/SpecTcl-3.4/Analysis/Makefile.am branches/SpecTcl-3.4/CompilationRules.include branches/SpecTcl-3.4/DecoderRing/Makefile.am branches/SpecTcl-3.4/Display/colorset.cc branches/SpecTcl-3.4/Display/shared.cc branches/SpecTcl-3.4/EventSource/Makefile.am branches/SpecTcl-3.4/Events/Makefile.am branches/SpecTcl-3.4/Filter/Makefile.am branches/SpecTcl-3.4/Fits/Makefile.am branches/SpecTcl-3.4/Gates/Makefile.am branches/SpecTcl-3.4/Makefile.am branches/SpecTcl-3.4/Sorter/Makefile.am branches/SpecTcl-3.4/SpecTcl/GateCommand.cpp branches/SpecTcl-3.4/SpecTcl/GatePackage.cpp branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/SpecTcl/SpecTcl_Makefile.include branches/SpecTcl-3.4/SpectrumIO/Makefile.am branches/SpecTcl-3.4/TestFiles/Makefile.am branches/SpecTcl-3.4/TestFiles/ltwrite.cpp branches/SpecTcl-3.4/TestFiles/testfile.cpp branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/Utility/histotypes.h branches/SpecTcl-3.4/Xamine/Makefile.am branches/SpecTcl-3.4/Xamine/XamineButtonPrompt.cpp branches/SpecTcl-3.4/calibratedparams/Makefile.am branches/SpecTcl-3.4/ccusb/Makefile.am branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am branches/SpecTcl-3.4/contrib/scriptable/Makefile.am branches/SpecTcl-3.4/tcl++incorp.sh branches/SpecTcl-3.4/vmusb/Makefile.am Removed Paths: ------------- branches/SpecTcl-3.4/NSCLException/ branches/SpecTcl-3.4/TCL/ Modified: branches/SpecTcl-3.4/Analysis/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Analysis/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Analysis/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -19,9 +19,9 @@ INCLUDES = -I@top_srcdir@/Events \ -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Utility \ - -I. + -I. @LIBTCLPLUS_CFLAGS@ -libBufferAnalysis_la_LDFLAGS = -version-info $(SOVERSION):0 +libBufferAnalysis_la_LDFLAGS = -version-info $(SOVERSION):0 @LIBTCLPLUS_LDFLAGS@ man_MANS = BufferAnalysis.3 CBufferProcessor.3 CBufferCallback.3 Modified: branches/SpecTcl-3.4/CompilationRules.include =================================================================== --- branches/SpecTcl-3.4/CompilationRules.include 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/CompilationRules.include 2013-05-14 15:05:19 UTC (rev 2087) @@ -29,17 +29,17 @@ # .cpp.o: - $(CXX) -g -c $(CXXFLAGS) $(USERCXXFLAGS) $< + $(CXX) -g -c $(CXXFLAGS) $(LIBTCLPLUS_CFLAGS) $(USERCXXFLAGS) $< .cxx.o: - $(CXX) -g -c $(CXXFLAGS) $(USERCXXFLAGS) $< + $(CXX) -g -c $(CXXFLAGS) $(LIBTCLPLUS_CFLAGS) $(USERCXXFLAGS) $< .cc.o: - $(CXX) -g -c $(CXXFLAGS) $(USERCXXFLAGS) $< + $(CXX) -g -c $(CXXFLAGS) $(LIBTCLPLUS_CFLAGS) $(USERCXXFLAGS) $< # # C compilation(s) if more are aded the build rules should be identical. .c.o: - $(CC) -g -c $(CCFLAGS) $(USERCCFLAGS) $< + $(CC) -g -c $(CCFLAGS) $(LIBTCLPLUS_CFLAGS) $(USERCCFLAGS) $< Modified: branches/SpecTcl-3.4/DecoderRing/Makefile.am =================================================================== --- branches/SpecTcl-3.4/DecoderRing/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/DecoderRing/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -18,4 +18,6 @@ -I@top_srcdir@/Events \ -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Filter \ - -I@top_srcdir@/SpecTcl \ No newline at end of file + -I@top_srcdir@/SpecTcl @LIBTCLPLUS_CFLAGS@ + +libDecoderRing_la_LDFLAGS = @LIBTCLPLUS_LDFLAGS@ \ No newline at end of file Modified: branches/SpecTcl-3.4/Display/colorset.cc =================================================================== --- branches/SpecTcl-3.4/Display/colorset.cc 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Display/colorset.cc 2013-05-14 15:05:19 UTC (rev 2087) @@ -1229,7 +1229,7 @@ button_table[i].pixel = pixels[i]; /* Select a pixel. */ - sprintf(name, "Button-%d", i); /* Widget name. */ + sprintf(name, "Button-%lld", i); /* Widget name. */ sprintf(txt, "%d\n\n%d", button_table[i].hi, button_table[i].low); /* Button label */ Modified: branches/SpecTcl-3.4/Display/shared.cc =================================================================== --- branches/SpecTcl-3.4/Display/shared.cc 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Display/shared.cc 2013-05-14 15:05:19 UTC (rev 2087) @@ -472,11 +472,11 @@ { spec_shared *pShape(0); // dirty way to get offests. printf("(Xamine) offsets into shared mem: \n"); - printf(" dsp_xy = %x\n", pShape->dsp_xy); - printf(" dsp_titles = %x\n", pShape->dsp_titles); - printf(" dsp_types = %x\n", pShape->dsp_types); - printf(" dsp_map = %x\n", pShape->dsp_map); - printf(" dsp_spectra = %x\n", &(pShape->dsp_spectra)); + printf(" dsp_xy = %p\n", (void*)pShape->dsp_xy); + printf(" dsp_titles = %p\n", (void*)pShape->dsp_titles); + printf(" dsp_types = %p\n", (void*)pShape->dsp_types); + printf(" dsp_map = %p\n", (void*)pShape->dsp_map); + printf(" dsp_spectra = %p\n", (void*)&(pShape->dsp_spectra)); printf(" Total size = %d\n", sizeof(spec_shared)); } Modified: branches/SpecTcl-3.4/EventSource/Makefile.am =================================================================== --- branches/SpecTcl-3.4/EventSource/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/EventSource/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,7 +1,7 @@ INCLUDES = -I. -I../Utility -I../NSCLException -I../Tape -I../SpecTcl \ - -I../Events -I../TCL -I../Filter @TCL_CPPFLAGS@ + -I../Events -I../TCL -I../Filter @TCL_CPPFLAGS@ @LIBTCLPLUS_CFLAGS@ -LDADD=-L. @TCL_LIBS@ @TK_LIBS@ +LDADD=-L. @LIBTCLPLUS_LDFLAGS@ @TCL_LIBS@ @TK_LIBS@ lib_LTLIBRARIES = libEventSource.la Modified: branches/SpecTcl-3.4/Events/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Events/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Events/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -8,8 +8,8 @@ -I@top_srcdir@/factories \ -I@top_srcdir@/Display \ -I@top_srcdir@/Gates \ - @TCL_CPPFLAGS@ @TK_CPPFLAGS@ @XINCLUDES@ -LDADD = @TK_LIBS@ @TCL_LIBS@ + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ @XINCLUDES@ @LIBTCLPLUS_CFLAGS@ +LDADD = @LIBTCLPLUS+LDFLAGS@ @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libAnalysis.la Modified: branches/SpecTcl-3.4/Filter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Filter/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Filter/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -3,13 +3,13 @@ -I@top_srcdir@/SpecTcl -I@top_srcdir@/Xamine \ -I@top_srcdir@/NSCLException -I@top_srcdir@/TCL \ -I@top_srcdir@/EventSource -I@top_srcdir@/Display \ - @TCL_CPPFLAGS@ + @TCL_CPPFLAGS@ @LIBTCLPLUS_CFLAGS@ LDADD = -L. # AM_LDFLAGS = -L. lib_LTLIBRARIES = libFilter.la libFilter_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" + -Wl,"-rpath-link=$(libdir)" @LIBTCLPLUS_LDFLAGS@ libFilter_la_SOURCES = EventFilter.cpp \ FilterDictionary.cpp \ Modified: branches/SpecTcl-3.4/Fits/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Fits/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Fits/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -27,12 +27,12 @@ -I@top_srcdir@/Filter \ -I@top_srcdir@/TCL \ -I@top_srcdir@/factories \ - @TCL_CPPFLAGS@ @TK_CPPFLAGS@ + @LIBTCLPLUS_CFLAGS@ @TCL_CPPFLAGS@ @TK_CPPFLAGS@ lib_LTLIBRARIES=libFits.la libFits_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" @TK_LIBS@ @TCL_LIBS@ \ + -Wl,"-rpath-link=$(libdir)" @LIBTCLPLUS_LDFLAGS@ @TK_LIBS@ @TCL_LIBS@ \ -lgsl -lgslcblas -lm libFits_la_SOURCES = CFit.cpp \ Modified: branches/SpecTcl-3.4/Gates/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Gates/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Gates/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,8 +1,8 @@ INCLUDES = -I. -I../Utility -I../Events -I../Xamine -I@top_srcdir@/Sorter \ - -I@top_srcdir@/NSCLException + -I@top_srcdir@/NSCLException @LIBTCLPLUS_CFLAGS@ LDADD = -lTclGrammerCommands -lSorting -lXplus -lAnalysis -lEventSource \ - -ltclPlus -lNSCLException -lXamine -ltape -ltk -ltcl -lXt -lX11 -lm \ + -ltclPlus -lNSCLException -lXamine @LIBTCLPLUS_LDFLAGS@ -ltape -ltk -ltcl -lXt -lX11 -lm \ -L. @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libGates.la Modified: branches/SpecTcl-3.4/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,6 +1,6 @@ SUBDIRS = Replace Scripts Utility factories Display \ - NSCLException Xamine Tape EventSource \ - TCL Events Gates Sorter SpectrumIO Filter Analysis\ + Xamine Tape EventSource \ + Events Gates Sorter SpectrumIO Filter Analysis\ DecoderRing TreeParam \ Fits SpecTcl \ contrib TestFiles Gui splash filtsplit calibratedparams treegui ccusb vmusb @@ -21,6 +21,7 @@ EXTRA_DIST = fixdos ReleaseNotesNSCL4.0.txt SpecTclRC.tcl \ bootstrap $(MYGRIDIR) LICENSE \ doc build.cygwin Directories.include CompilationRules.include \ + libtcl \ CHANGELOG dist-hook: @@ -60,6 +61,8 @@ echo CC=$(CC) >> CompilationRules.temp echo CXXLD=$(CXX) >> CompilationRules.temp echo CCLD=$(CC) >> CompilationRules.temp + echo LIBTCLPLUS_CLFLAGS=@LIBTCLPLUS_CFLAGS@ >> CompilationRules.temp + echo LIBTCLPLUS_LDFLAGS=@LIBTCLPLUS_LDFLAGS@ >> CompilationRules.temp cat CompilationRules.include >> CompilationRules.temp $(INSTALL_DATA) CompilationRules.temp $(sysconfdir)/CompilationRules.include echo "Version: " SpecTcl-$(VERSION) build on `hostname` `date` >VERSION Modified: branches/SpecTcl-3.4/Sorter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Sorter/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,12 +1,11 @@ -INCLUDES = -I. -I../Utility -I../NSCLException -I../Xamine -I../Gates \ +INCLUDES = -I. -I../Utility @LIBTCLPLUS_CFLAGS@ -I../Xamine -I../Gates \ -I../Events -I../Display @TCL_CPPFLAGS@ -I.. -I@top_srcdir@/Fits libSorting_la_LIBADD = @top_srcdir@/Xamine/libXplus.la \ @top_srcdir@/Gates/libGates.la \ @top_srcdir@/Events/libAnalysis.la \ @top_srcdir@/EventSource/libEventSource.la \ - @top_srcdir@/TCL/libtclPlus.la \ - @top_srcdir@/NSCLException/libException.la \ + @LIBTCLPLUS_LDFLAGS@ \ @top_srcdir@/Display/libXamine.la Modified: branches/SpecTcl-3.4/SpecTcl/GateCommand.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/GateCommand.cpp 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/SpecTcl/GateCommand.cpp 2013-05-14 15:05:19 UTC (rev 2087) @@ -424,7 +424,7 @@ (string(pType) == string("nm"))) { long Compare ; - sscanf(PointString[0].c_str(), "%x", &Compare); + sscanf(PointString[0].c_str(), "%lx", &Compare); pGate = api.CreateGate(Item.eGateType, Parameters, Compare); if(rPackage.AddGate(rResult, string(pName), pGate)) { return TCL_OK; Modified: branches/SpecTcl-3.4/SpecTcl/GatePackage.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/GatePackage.cpp 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/SpecTcl/GatePackage.cpp 2013-05-14 15:05:19 UTC (rev 2087) @@ -640,7 +640,7 @@ UInt_t id; Float_t low, hi; // because constituents have 'too much data'. char param[100]; - sscanf(GateInfo.c_str(), "%d %f %f", &id, &low, &hi); + sscanf(GateInfo.c_str(), "%u %f %f", &id, &low, &hi); sprintf(param,"%f %f", low, hi); Result.AppendElement(param); Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,7 +1,6 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I@top_srcdir@ -I. -I@top_srcdir@/TCL -I@top_srcdir@/Events \ +INCLUDES = -I@top_srcdir@ -I. -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ - -I@top_srcdir@/NSCLException \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates -I@top_srcdir@/SpectrumIO \ -I@top_srcdir@/Xamine \ -I@top_srcdir@/Display -I@top_srcdir@/Tape -I@top_srcdir@/Filter \ @@ -9,7 +8,8 @@ -I@top_srcdir@/Fits \ -I@top_srcdir@/factories \ -I@top_srcdir@/DecoderRing \ - @TCL_CPPFLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ + @TCL_CPPFLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ \ + @LIBTCLPLUS_CFLAGS@ install-exec-local: $(mkinstalldirs) $(prefix)/etc @@ -84,16 +84,17 @@ AM_CXXFLAGS = -g SpecTcl_LDFLAGS = -lTclGrammerCommands -lXplus -lGates -lAnalysis \ - -lFilter -lBufferAnalysis -lEventSource -lSpecio -ltclPlus \ - -lException -lTreeParam -lXamine -ltape -lFits \ + -lFilter -lBufferAnalysis -lEventSource -lSpecio \ + -lTreeParam -lXamine -ltape -lFits \ @top_srcdir@/Sorter/libSorting.la \ @top_srcdir@/DecoderRing/libDecoderRing.la \ -lXt -lX11 $(X11EXTRA_LDFLAGS) $(LD_EXTRA_FLAGS) \ -L. -L../SpectrumIO \ -L../Tape -L../Sorter \ -L../Xamine -L../Display -L../Gates -L../EventSource -L../Events \ - -L../TCL -L../NSCLException -L../Filter -L../Analysis -L../TreeParam \ + -L../Filter -L../Analysis -L../TreeParam \ -L../Fits -L@top_srcdir@/DecoderRing \ + @LIBTCLPLUS_LDFLAGS@ \ -g -Wl,"-rpath=$(libdir)" -lgsl -lgslcblas @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ @@ -138,8 +139,6 @@ commonTestLdFlags= @top_builddir@/Events/libAnalysis.la \ - @top_builddir@/TCL/libtclPlus.la \ - @top_builddir@/NSCLException/libException.la \ @top_builddir@/Analysis/libBufferAnalysis.la \ @top_builddir@/SpecTcl/libTclGrammerCommands.la \ @top_builddir@/Filter/libFilter.la \ @@ -149,6 +148,7 @@ @top_builddir@/DecoderRing/libDecoderRing.la \ @top_builddir@/Tape/libtape.la \ @top_builddir@/SpectrumIO/libSpecio.la \ + @LIBTCLPLUS_LDFLAGS@ \ @CPPUNIT_LIBS@ @TK_LIBS@ @TCL_LIBS@ scalertests_LDFLAGS= ScalerProcessorCallbacks.o $(commonTestLdFlags) Modified: branches/SpecTcl-3.4/SpecTcl/SpecTcl_Makefile.include =================================================================== --- branches/SpecTcl-3.4/SpecTcl/SpecTcl_Makefile.include 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/SpecTcl/SpecTcl_Makefile.include 2013-05-14 15:05:19 UTC (rev 2087) @@ -16,7 +16,7 @@ # Build up the compilation flags: -CXXFLAGS=-g -I. -I$(SPECINCS) $(TCLINCLUDES) +CXXFLAGS=-g -I. -I$(SPECINCS) $(TCLINCLUDES) $(LIBTCLPLUS_CFLAGS) # The c compilation flags for now are just the same as the c++ flags: @@ -31,8 +31,7 @@ -lAnalysis \ -lEventSource \ -lSpecio \ - -ltclPlus \ - -lException \ + $(LIBTCLPLUS_LDFLAGS) \ -lXamine \ -ltape \ -lFilter \ @@ -41,11 +40,14 @@ -lFits \ -lDecoderRing \ -lgsl -lgslcblas \ - $(TCLLIBS) \ + $(LIBTCLPLUS_LDFLAGS) \ $(X11LIBS) \ -Wl,"-rpath=$(SPECLIBS)" +# Removed: $(TCLLIBS) +# included in libtclplus and caused double defs in -lieee :-( + include $(SPECETC)/CompilationRules.include Modified: branches/SpecTcl-3.4/SpectrumIO/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,8 +1,9 @@ DEFS = @WCHAR_T_DEF@ INCLUDES = -I.. -I. \ - -I../SpecTcl -I../Sorter -I../Utility -I../TCL -I../NSCLException \ - -I../Xamine -I../Events -I../Gates -I../Display @TCL_CPPFLAGS@ -LDADD = -ltclPlus -lException -lXt -lX11 -L. @TK_LIBS@ @TCL_LIBS@ + -I../SpecTcl -I../Sorter -I../Utility \ + -I../Xamine -I../Events -I../Gates -I../Display @TCL_CPPFLAGS@ \ + @LIBTCLPLUS_CFLAGS@ +LDADD = @LIBTCLPLUS_LDFLAGS@ -lXt -lX11 -L. @TK_LIBS@ @TCL_LIBS@ # AM_LDFLAGS = -L. @TK_LIBS@ @TCL_LIBS@ lib_LTLIBRARIES = libSpecio.la Modified: branches/SpecTcl-3.4/TestFiles/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TestFiles/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/TestFiles/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,10 +1,12 @@ -INCLUDES= -I. -I../EventSource -I../TCL -I../NSCLException \ +INCLUDES= -I. -I../EventSource \ + @LIBTCLPLUS_CFLAGS@ \ -I../Utility @TCL_CPPFLAGS@ -I../Tape -LDADD = -lEventSource -lException -ltape \ - -L. -L../Events -L../EventSource -L../TCL -L../NSCLException \ +LDADD = -lEventSource -ltape \ + -L. -L../Events -L../EventSource \ -L../Tape \ - -L../Filter -L../SpecTcl + -L../Filter -L../SpecTcl \ + @LIBTCLPLUS_LDFLAGS@ @TCL_LIBS@ Modified: branches/SpecTcl-3.4/TestFiles/ltwrite.cpp =================================================================== --- branches/SpecTcl-3.4/TestFiles/ltwrite.cpp 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/TestFiles/ltwrite.cpp 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,280 +1,19 @@ /* - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2009. - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: - Preamble + http://www.gnu.org/licenses/gpl.txt - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of this License, - you may choose any version ever published by the Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author to -ask for permission. For software which is copyrighted by the Free Software -Foundation, write to the Free Software Foundation; we sometimes make -exceptions for this. Our decision will be guided by the two goals of -preserving the free status of all derivatives of our free software and of -promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE -THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO -LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR -THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS ' -*/ static const char* Copyright = "(C) Copyright Michigan State University 2010, All rights reserved"; #include <config.h> #include "TapeFile.h" @@ -349,3 +88,4 @@ } } void *gpEventSource; +void *gpTCLApplication(0); Modified: branches/SpecTcl-3.4/TestFiles/testfile.cpp =================================================================== --- branches/SpecTcl-3.4/TestFiles/testfile.cpp 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/TestFiles/testfile.cpp 2013-05-14 15:05:19 UTC (rev 2087) @@ -371,3 +371,4 @@ close(fd); } void* gpEventSource; +void* gpTCLApplication(0); Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -71,12 +71,11 @@ server.tcl \ tabnbook.tcl -INCLUDES = -I@top_srcdir@/TCL \ +INCLUDES = @LIBTCLPLUS_CFLAGS@ \ -I@top_srcdir@/Sorter \ -I@top_srcdir@/Events \ -I@top_srcdir@/SpecTcl \ -I@top_srcdir@/Utility \ - -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Xamine \ -I@top_srcdir@/Display \ -I@top_srcdir@/Gates \ @@ -126,8 +125,8 @@ @top_builddir@/Tape/libtape.la \ @top_builddir@/Analysis/libBufferAnalysis.la -TestRunner_LDFLAGS = $(LibraryObjects) -L@top_srcdir@/TCL -ltclPlus \ - -L@top_srcdir@/NSCLException -lException \ +TestRunner_LDFLAGS = $(LibraryObjects) \ + @LIBTCLPLUS_LDFLAGS@ \ @TK_LIBS@ @TCL_LIBS@ @CPPUNIT_LIBS@ noinst_HEADERS = Asserts.h Modified: branches/SpecTcl-3.4/Utility/histotypes.h =================================================================== --- branches/SpecTcl-3.4/Utility/histotypes.h 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Utility/histotypes.h 2013-05-14 15:05:19 UTC (rev 2087) @@ -90,58 +90,19 @@ #define __STL_STRING #endif - +#ifndef __CRT_MATH_H #include <math.h> +#define __CRT_MATH_H +#endif -typedef int Int_t; -typedef unsigned int UInt_t; +#ifndef _DAQTYPES_H +#include <daqdatatypes.h> +#endif -typedef short Short_t; -typedef unsigned short UShort_t; -typedef long Long_t; -typedef unsigned long ULong_t; -typedef float Float_t; -typedef double DFloat_t; - -typedef char Char_t; -typedef unsigned char UChar_t; - -typedef char (*Textsz_t); // Null terminated string. -typedef UInt_t Size_t; - -typedef void (*Address_t); // Typical pointer. - -static const Address_t kpNULL = (Address_t)0; // Null pointer. - -typedef enum { // State of a file. - kfsOpen, - kfsClosed -} FileState_t; - -typedef enum { - kacRead = 1, // Read access - kacWrite = 2, // Write access - kacCreate = 4, // Create if needed. - kacAppend = 8 // Append before writes. - -} Access_t; - -#define kACTIONSIZE 1024 // Size of action message. - - -typedef UChar_t Bool_t; -static const Bool_t kfTRUE = 0xff; // TRUE boolean. -static const Bool_t kfFALSE= 0; // FALSE boolean. - -typedef struct { - UShort_t month,day, year; // date. - UShort_t hours, min, sec; // time in day. -} Time_t, *pTime_t; - typedef enum _Datatype_t { keByte, // Data type is byte. keWord, // Data type is word. @@ -338,8 +299,6 @@ return in; } -static const UInt_t kn1K = 1024; -static const UInt_t kn1M = kn1K*kn1K; // Default buffer size: Modified: branches/SpecTcl-3.4/Xamine/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Xamine/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Xamine/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,5 +1,5 @@ -INCLUDES = -g -I. -I../Utility -I../Display -I../NSCLException -LDADD = -lXplus -lException -lXamine -L. +INCLUDES = -g -I. -I../Utility -I../Display @LIBTCLPLUS_CFLAGS@ +LDADD = -lXplus -lXamine @LIBTCLPLUS_LDFLAGS@ -L. # AM_LDFLAGS = -L. lib_LTLIBRARIES = libXplus.la Modified: branches/SpecTcl-3.4/Xamine/XamineButtonPrompt.cpp =================================================================== --- branches/SpecTcl-3.4/Xamine/XamineButtonPrompt.cpp 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/Xamine/XamineButtonPrompt.cpp 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,280 +1,19 @@ /* - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2009. - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: - Preamble + http://www.gnu.org/licenses/gpl.txt - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of this License, - you may choose any version ever published by the Free Software Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author to -ask for permission. For software which is copyrighted by the Free Software -Foundation, write to the Free Software Foundation; we sometimes make -exceptions for this. Our decision will be guided by the two goals of -preserving the free status of all derivatives of our free software and of -promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE -THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO -LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR -THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS ' -*/ static const char* Copyright = "(C) Copyright Michigan State University 2011, All rights reserved"; // // XamineButtonPrompt.cpp @@ -291,6 +30,7 @@ #include <config.h> #include "XamineButtonPrompt.h" #include "RangeError.h" +#include <string.h> #ifdef HAVE_STD_NAMESPACE using namespace std; #endif Modified: branches/SpecTcl-3.4/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/calibratedparams/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/calibratedparams/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -7,14 +7,14 @@ -I@top_srcdir@/Filter -I@top_srcdir@/Gates \ -I@top_srcdir@/Xamine -I@top_srcdir@/Display \ -I@top_srcdir@/factories \ - @TCL_CPPFLAGS@ \ + @LIBTCLPLUS_CFLAGS@ @TCL_CPPFLAGS@ \ -D_DEBUG -DCHECK_ALL -DDESIGN_BY_CONTRACT lib_LTLIBRARIES=libCalibrations.la libCalibrations_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" + @LIBTCLPLUS_LDFLAGS@ -Wl,"-rpath-link=$(libdir)" libCalibrations_la_SOURCES = CalibrationPackage.cpp \ CCalibratedParameterCommand.cpp \ Modified: branches/SpecTcl-3.4/ccusb/Makefile.am =================================================================== --- branches/SpecTcl-3.4/ccusb/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/ccusb/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -17,20 +17,19 @@ ParamMapCommand.h -INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/TCL -I@top_srcdir@/Events \ +INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ - -I@top_srcdir@/NSCLException \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates \ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ -I@top_srcdir@/Analysis \ -I@top_srcdir@/Display -I@top_srcdir@/Tape -I@top_srcdir@/Filter \ -I@top_srcdir@/TreeParam \ - @TCL_CPPFLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ + @TCL_CPPFLAGS@ -DINSTALLED_IN='"@prefix@"' @XINCLUDES@ \ + @LIBTCLPLUS_CFLAGS@ CCUSBSpecTcl_LDFLAGS = ../SpecTcl/libTclGrammerCommands.la \ ../Events/libAnalysis.la \ ../Fits/libFits.la \ - ../TCL/libtclPlus.la \ ../Analysis/libBufferAnalysis.la \ ../EventSource/libEventSource.la \ ../Tape/libtape.la \ @@ -43,8 +42,8 @@ ../SpectrumIO/libSpecio.la \ ../TreeParam/libTreeParam.la \ ../DecoderRing/libDecoderRing.la \ - ../NSCLException/libException.la \ ../Display/libXamine.la \ + @LIBTCLPLUS_LDFLAGS@ \ -lXt -lX11 @X11EXTRA_LDFLAGS@ @LD_EXTRA_FLAGS@ \ -lgsl -lgslcblas \ @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/configure.ac 2013-05-14 15:05:19 UTC (rev 2087) @@ -78,6 +78,8 @@ AC_CHECK_FUNCS([strdup strstr strtol tzset mktime strtod timezone]) + + # The following are needed for strict ANSI c++ compilers The major features # are whether or not there are .h -less headers and if there's an std # namespace we'll need to import. @@ -685,6 +687,44 @@ AC_MSG_RESULT(no) fi +# +# libTclPlus and libException could have been installed from +# Ryan's Deb or I might need to install my own versions which +# get exported into the build tree from a tag of the repository +# into the libtcl subdirectory of this tree. +# +# Produce: +# LIBTCLPLUS_CFLAGS - Compilation flags required to build against the +# appropriate one. +# LIBTCLPLUS_LDFLAGS - Appropriate linker flags. +# +# + +AC_CHECK_LIB(Tcl_AppInit, tclPlus, [systemtcl="yes"], [systemtcl="no"]) + + +# +# IF systemtcl is yes we're pretty much done.. otherwise +# we need to configure/build/install libtcl into prefix and then set +# the flags: + +AC_MSG_CHECKING([Checking for libtclPlus]) +if test $systemtcl = "yes" +then + LIBTCLPLUS_CFLAGS= + LIBTCLPLUS_LDFLAGS=-ltclPlus -lException + AC_MSG_RESULT([Found in system libraries]) +else + AC_MSG_RESULT([Need to build local tagged copy]) + (cd libtcl; ./configure --prefix=${prefix}; make install) + LIBTCLPLUS_CFLAGS="-I${prefix}/include" + LIBTCLPLUS_LDFLAGS=-"L${prefix}/lib -ltclPlus -lException -Wl,\"-rpath=${prefix}/lib\"" + +fi + +AC_SUBST(LIBTCLPLUS_CFLAGS) +AC_SUBST(LIBTCLPLUS_LDFLAGS) + # mandb: AC_SUBST(MANDB) Modified: branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/contrib/calibratedparams/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,12 +1,12 @@ initLDFLAGS=@TK_LIBS@ @TCL_LIBS@ -INCLUDES = -I. -I@top_srcdir@/Utility -I@top_srcdir@/NSCLException \ - -I@top_srcdir@/Xamine -I@top_srcdir@/TCL \ +INCLUDES = -I. -I@top_srcdir@/Utility + -I@top_srcdir@/Xamine \ -I@top_srcdir@/Events -I@top_srcdir@/SpecTcl \ -I@top_srcdir@/Sorter -I@top_srcdir@/EventSource \ -I@top_srcdir@/Filter -I@top_srcdir@/Gates \ -I@top_srcdir@/Xamine -I@top_srcdir@/Display \ - @TCL_CPPFLAGS@ @TK_CPPFLAGS@ \ + @TCL_CPPFLAGS@ @TK_CPPFLAGS@ @LIBTCLPLUS_CFLAGS @\ -D_DEBUG -DCHECK_ALL -DDESIGN_BY_CONTRACT @@ -84,7 +84,7 @@ TestObjects=@top_srcdir@/Events/Event.lo @top_srcdir@/SpecTcl/EventProcessor.lo unittests_LDFLAGS = $(TestObjects) $(unittests_DEPENDENCIES) @CPPUNIT_LIBS@ -L@top_srcdir@/TCL -ltclPlus \ - -L@top_srcdir@/NSCLException -lException \ + @LIBTCLPLUS_LDFLAGS@ \ -lgsl -lgslcblas -lm $(TCL_LDFLAGS) Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-10 20:02:29 UTC (rev 2086) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-14 15:05:19 UTC (rev 2087) @@ -1,12 +1,12 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/TCL -I@top_srcdir@/Events \ +INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ - -I@top_srcdir@/NSCLException \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates \ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ -I@... [truncated message content] |
From: <ro...@us...> - 2013-05-14 15:06:33
|
Revision: 2088 http://sourceforge.net/p/nsclspectcl/code/2088 Author: ron-fox Date: 2013-05-14 15:06:30 +0000 (Tue, 14 May 2013) Log Message: ----------- * Ensure libtcl is make clean install * Note what we've done in CHANGELOG. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/configure.ac Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-05-14 15:05:19 UTC (rev 2087) +++ branches/SpecTcl-3.4/CHANGELOG 2013-05-14 15:06:30 UTC (rev 2088) @@ -1023,4 +1023,5 @@ * Issue #1633 Provide event processors with a post SpecTclRC.tcl initialization hook. * Much more documentation on how to build event processors etc. - + * Extract the tcl++ and exception libs so they can be centrally + maintained. Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-05-14 15:05:19 UTC (rev 2087) +++ branches/SpecTcl-3.4/configure.ac 2013-05-14 15:06:30 UTC (rev 2088) @@ -716,7 +716,7 @@ AC_MSG_RESULT([Found in system libraries]) else AC_MSG_RESULT([Need to build local tagged copy]) - (cd libtcl; ./configure --prefix=${prefix}; make install) + (cd libtcl; ./configure --prefix=${prefix}; make clean install) LIBTCLPLUS_CFLAGS="-I${prefix}/include" LIBTCLPLUS_LDFLAGS=-"L${prefix}/lib -ltclPlus -lException -Wl,\"-rpath=${prefix}/lib\"" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-05-14 18:57:42
|
Revision: 2089 http://sourceforge.net/p/nsclspectcl/code/2089 Author: ron-fox Date: 2013-05-14 18:57:38 +0000 (Tue, 14 May 2013) Log Message: ----------- Get this to build from tarball distro Modified Paths: -------------- branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/contrib/scriptable/Makefile.am Modified: branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp 2013-05-14 15:06:30 UTC (rev 2088) +++ branches/SpecTcl-3.4/SpecTcl/callbacktests.cpp 2013-05-14 18:57:38 UTC (rev 2089) @@ -65,7 +65,7 @@ string m_element; int m_flags; - virtual const char* operator()(CTCLInterpreter* pInterp, + virtual char* operator()(CTCLInterpreter* pInterp, char* pVariable, char* pElement, int flags) { Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-05-14 15:06:30 UTC (rev 2088) +++ branches/SpecTcl-3.4/configure.ac 2013-05-14 18:57:38 UTC (rev 2089) @@ -781,9 +781,9 @@ AC_OUTPUT(Makefile Replace/Makefile Scripts/Makefile Utility/Makefile \ factories/Makefile \ - Display/Makefile NSCLException/Makefile \ + Display/Makefile Xamine/Makefile Tape/Makefile \ - EventSource/Makefile TCL/Makefile Events/Makefile Gates/Makefile \ + EventSource/Makefile Events/Makefile Gates/Makefile \ Sorter/Makefile SpectrumIO/Makefile Filter/Makefile \ Analysis/Makefile \ DecoderRing/Makefile \ Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-14 15:06:30 UTC (rev 2088) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2013-05-14 18:57:38 UTC (rev 2089) @@ -94,7 +94,7 @@ @top_srcdir@/DecoderRing/libDecoderRing.la \ -L@top_srcdir@/Tape -L@top_srcdir@/Sorter -L@top_srcdir@/Xamine \ -L@top_srcdir@/Display -L@top_srcdir@/Gates -L@top_srcdir@/EventSource \ - -L@top_srcdir@/Events -L@top_srcdir@/TCL -L@top_srcdir@/NSCLException \ + -L@top_srcdir@/Events \ -L@top_srcdir@/Filter -L@top_srcdir@/SpecTcl -L@top_srcdir@/Analysis \ -L@top_srcdir@/TreeParam -L@top_srcdir@/Fits \ @LIBTCLPLUS_LDFLAGS@ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-09-12 19:42:17
|
Revision: 2137 http://sourceforge.net/p/nsclspectcl/code/2137 Author: ron-fox Date: 2013-09-12 19:42:15 +0000 (Thu, 12 Sep 2013) Log Message: ----------- Get a clean good compile on e.g. pangolin Modified Paths: -------------- branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/configure.ac Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-09-09 11:38:47 UTC (rev 2136) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-09-12 19:42:15 UTC (rev 2137) @@ -109,10 +109,11 @@ # Unit tests. +# +# Need to figure out why these don't link right +if CPPUNITDONOTBUILD -if CPPUNIT - noinst_PROGRAMS = scalertests docbuftests scalertests_CXXFLAGS=@CPPUNIT_CFLAGS@ Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-09-09 11:38:47 UTC (rev 2136) +++ branches/SpecTcl-3.4/configure.ac 2013-09-12 19:42:15 UTC (rev 2137) @@ -661,6 +661,7 @@ AM_PATH_CPPUNIT AM_CONDITIONAL([CPPUNIT], [test -n "${CPPUNIT_LIBS}"] ) +AM_CONDITIONAL([CPPUNITDONOTBUILD], [test -n ""]) AM_CONDITIONAL([THIS_IS_NOT_DEFINED], [test -n ""]) @@ -700,7 +701,7 @@ # # -AC_CHECK_LIB(Tcl_AppInit, tclPlus, [systemtcl="yes"], [systemtcl="no"]) +AC_CHECK_LIB( tclPlus, Tcl_AppInit, [systemtcl="yes"], [systemtcl="no"]) # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-10-03 19:50:34
|
Revision: 2151 http://sourceforge.net/p/nsclspectcl/code/2151 Author: ron-fox Date: 2013-10-03 19:50:31 +0000 (Thu, 03 Oct 2013) Log Message: ----------- Misc fixusp for tests prep for using Jekins Continous integration builds. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/Display/Makefile.am branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/TreeParam/TreeVariableCommandTests.cpp branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/filtsplit/Makefile.am Added Paths: ----------- branches/SpecTcl-3.4/m4/gengetopt.m4 Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/CHANGELOG 2013-10-03 19:50:31 UTC (rev 2151) @@ -1025,3 +1025,9 @@ * Much more documentation on how to build event processors etc. * Extract the tcl++ and exception libs so they can be centrally maintained. +3.4-001 + * Update AC_INIT to provide version number. + * Add some tests to m4 and use them there instead of in + configure.ac + * Set up to use Jenkins CI server. + * Only let the cppunit tests that don't need a display survive. Modified: branches/SpecTcl-3.4/Display/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Display/Makefile.am 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/Display/Makefile.am 2013-10-03 19:50:31 UTC (rev 2151) @@ -94,7 +94,7 @@ check_PROGRAMS = Xaminetest -TESTS = $(check_PROGRAMS) +# TESTS = $(check_PROGRAMS) # needs to start Xamine include_HEADERS = Tab.h allocator.h dispshare.h helpmenu.h refreshctl.h\ TabP.h axes.h dispwind.h info.h scaling.h\ Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-03 19:50:31 UTC (rev 2151) @@ -99,7 +99,6 @@ # other folks depend on us first ...including libTclGrammerCommands. # -if THIS_IS_NOT_DEFINED if CPPUNIT noinst_PROGRAMS=TestRunner @@ -134,4 +133,3 @@ TESTS=./TestRunner endif -endif \ No newline at end of file Modified: branches/SpecTcl-3.4/TreeParam/TreeVariableCommandTests.cpp =================================================================== --- branches/SpecTcl-3.4/TreeParam/TreeVariableCommandTests.cpp 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/TreeParam/TreeVariableCommandTests.cpp 2013-10-03 19:50:31 UTC (rev 2151) @@ -106,7 +106,7 @@ { // Desc has three elements. - EQMSG(pComment, 3U, desc.size()); + EQMSG(pComment, (size_t)3, desc.size()); // name must be present: @@ -155,7 +155,7 @@ TreeVarCommandTest::ListAllCheck(const char* comment) { vector<string> result = ResultToList(); - EQMSG(comment, 11U, result.size()); + EQMSG(comment, (size_t)11, result.size()); for (int i =0; i < result.size(); i++) { vector<string> item = StringToList(result[i]); ConsistentDescription(item[0].c_str(), item); @@ -169,7 +169,7 @@ TreeVarCommandTest::ListIndivCheck(const char* comment) { vector<string> result = ResultToList(); - EQMSG(comment, 1U, result.size()); // Exactly one element I think. + EQMSG(comment, (size_t)1, result.size()); // Exactly one element I think. vector<string> item = StringToList(result[0]); ConsistentDescription(comment, item); // Check consistency. } @@ -180,7 +180,7 @@ TreeVarCommandTest::ListArrayCheck(const char* comment) { vector<string> result = ResultToList(); - EQMSG(comment, 10U, result.size()); + EQMSG(comment, (size_t)10U, result.size()); for (int i = 0; i < result.size(); i++) { vector<string> item = StringToList(result[i]); ConsistentDescription(item[0].c_str(), item); @@ -201,10 +201,10 @@ { // Ensure proper handling of parameter count problems. - char* argv[2] = {"*", "extra"}; + char const* argv[2] = {"*", "extra"}; int status = m_pCommand->List(*m_pInterp, *m_pResult, - 2, argv); + 2, const_cast<char**>(argv)); EQMSG("2 parameters", TCL_ERROR, status); m_pResult->Clear(); @@ -217,7 +217,7 @@ ListAllCheck("Listing all implicitly via direct list call"); m_pResult->Clear(); - status = m_pCommand->List(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->List(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("1 parameter '*' ok", TCL_OK, status); ListAllCheck("Listing all explicitly via direct list call"); m_pResult->Clear(); @@ -226,7 +226,7 @@ // Now look for "indiv" and list it: argv[0] = "indiv"; - status = m_pCommand->List(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->List(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("1 parameter 'indiv' ok", TCL_OK, status); ListIndivCheck("Listing 'indiv' via direct list call"); m_pResult->Clear(); @@ -234,7 +234,7 @@ // Look for all elements of the array: argv[0] = "multi*"; - status = m_pCommand->List(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->List(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("1 parameter 'multi*'", TCL_OK, status); ListArrayCheck("Listing 'multi.*' via direct list call"); m_pResult->Clear(); @@ -246,17 +246,17 @@ void TreeVarCommandTest::ListDispat() { - char* argv[4] = {"treevariable", "-list", "[]", "extra"}; + char const* argv[4] = {"treevariable", "-list", "[]", "extra"}; // Bad parameter count: - int status = (*m_pCommand)(*m_pInterp, *m_pResult, 4, argv); + int status = (*m_pCommand)(*m_pInterp, *m_pResult, 4, const_cast<char**>(argv)); EQMSG("bad parameters dispatch", TCL_ERROR, status); m_pResult->Clear(); // Implicit "*": - status = (*m_pCommand)(*m_pInterp, *m_pResult, 2, argv); + status = (*m_pCommand)(*m_pInterp, *m_pResult, 2, const_cast<char**>(argv)); EQMSG("Implicit *", TCL_OK, status); ListAllCheck("Implicit * via dispatch"); m_pResult->Clear(); @@ -264,7 +264,7 @@ // explicit *: argv[2] = "*"; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, argv); + status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("explicit *", TCL_OK, status); ListAllCheck("Explicit* via dispatch"); m_pResult->Clear(); @@ -272,7 +272,7 @@ // Single element: argv[2] = "indiv"; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, argv); + status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("individ", TCL_OK, status); ListIndivCheck("individ via dispatch"); m_pResult->Clear(); @@ -280,7 +280,7 @@ // All array elements. argv[2] = "multi*"; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, argv); + status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("Multi", TCL_OK, status); ListArrayCheck("multi via dispatch"); m_pResult->Clear(); @@ -297,22 +297,22 @@ void TreeVarCommandTest::SetChanged() { - char* argv[2] = {"indiv", "extra"}; - char *cmdargv[3] = {"treevariable", "-setchanged", "indiv", }; + char const* argv[2] = {"indiv", "extra"}; + char const *cmdargv[3] = {"treevariable", "-setchanged", "indiv", }; // Too few parameters: - int status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 0, argv); + int status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 0, const_cast<char**>(argv)); EQMSG("Too few params", TCL_ERROR, status); // Too many params. - status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 2, argv); + status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 2, const_cast<char**>(argv)); EQMSG("Too many parameters", TCL_ERROR, status); // Correct functionality. - status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("Just right parameter count", TCL_OK, status); ASSERT(m_pIndividual->hasChanged()); m_pIndividual->resetChanged(); @@ -322,12 +322,12 @@ // Fails correctly when nonexistent parameter. argv[0] = "nonexist"; - status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->SetChanged(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("nonexistent parameter", TCL_ERROR, status); // Works correctly via command dispatch. - status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, cmdargv); + status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, const_cast<char**>(cmdargv)); EQMSG("Dispatch", TCL_OK, status); ASSERT(m_pIndividual->hasChanged()); @@ -347,32 +347,32 @@ void TreeVarCommandTest::SetProperties() { - char* argv[4] = {"nosuch", "aaaa", "mm", "extra"}; + char const* argv[4] = {"nosuch", "aaaa", "mm", "extra"}; int status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, - 1, argv); + 1, const_cast<char**>(argv)); EQMSG("too few params", TCL_ERROR, status); m_pResult->Clear(); - status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 4, argv); + status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 4, const_cast<char**>(argv)); EQMSG("too many parameters", TCL_ERROR, status); m_pResult->Clear(); argv[0] = "indiv"; - status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, argv); + status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("Invalid fp value", TCL_ERROR , status); m_pResult->Clear(); argv[0] = "nosuch"; argv[1] = "55.55"; - status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, argv); + status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("Invalid variable name", TCL_ERROR, status); m_pResult->Clear(); argv[0] = "indiv"; - status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, argv); + status = m_pCommand->SetProperties(*m_pInterp, *m_pResult, 3, const_cast<char**>(argv)); EQMSG("indiv good set via function", TCL_OK, status); EQMSG("indiv value", 55.55, m_pIndividual->getValue()); EQMSG("indiv units", string("mm"), m_pIndividual->getUnit()); @@ -381,8 +381,8 @@ // Set via command dispatch: - char* cmdargv[5] = {"treevariable", "-set", "indiv", "2.22", "in"}; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 5, cmdargv); + char const* cmdargv[5] = {"treevariable", "-set", "indiv", "2.22", "in"}; + status = (*m_pCommand)(*m_pInterp, *m_pResult, 5, const_cast<char**>(cmdargv)); EQMSG("indiv good set via dispatch", TCL_OK, status); EQMSG("Indiv value", 2.22, m_pIndividual->getValue()); EQMSG("Indiv units", string("in"), m_pIndividual->getUnit()); @@ -399,9 +399,9 @@ void TreeVarCommandTest::SetNoUnits() { - char* argv[4] = {"treevariable", "-set", "indiv", "2.22"}; + char const* argv[4] = {"treevariable", "-set", "indiv", "2.22"}; - int status = (*m_pCommand)(*m_pInterp, *m_pResult, 4, argv); + int status = (*m_pCommand)(*m_pInterp, *m_pResult, 4, const_cast<char**>(argv)); EQMSG("Nounits set status", TCL_OK, status); EQMSG("Nounits set value", 2.22, m_pIndividual->getValue()); EQMSG("Nounits set units", string(""), m_pIndividual->getUnit()); @@ -418,29 +418,29 @@ void TreeVarCommandTest::CheckChanged() { - char* argv[2] = {"nosuch", "extra"}; + char const* argv[2] = {"nosuch", "extra"}; int status; // parameter count errors. - status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 0, argv); + status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 0, const_cast<char**>(argv)); EQMSG("too few params", TCL_ERROR, status); m_pResult->Clear(); - status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 2, argv); + status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 2, const_cast<char**>(argv)); EQMSG("Too many params", TCL_ERROR, status); m_pResult->Clear(); // No such variable: - status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("bad name", TCL_ERROR, status); m_pResult->Clear(); // unmodified: argv[0]= "indiv"; - status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("good", TCL_OK, status); string result((string)(*m_pResult)); EQMSG("good -unchanged", string("0"), result); @@ -450,7 +450,7 @@ // Modify "inidiv" and check that CheckChanged reflects this: (*m_pIndividual) = 3.1416; - status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, argv); + status = m_pCommand->CheckChanged(*m_pInterp, *m_pResult, 1, const_cast<char**>(argv)); EQMSG("good[mod]", TCL_OK, status); result = (string)(*m_pResult); EQMSG("good[modified]", string("1"), result); @@ -459,8 +459,8 @@ // Check that command dispatch also gives us the same thing: - char*cmdargv[3] = {"treevariable", "-check", "indiv"}; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, cmdargv); + char const* cmdargv[3] = {"treevariable", "-check", "indiv"}; + status = (*m_pCommand)(*m_pInterp, *m_pResult, 3, const_cast<char**>(cmdargv)); EQMSG("good[mod]dispatch", TCL_OK, status); result = (string)(*m_pResult); EQMSG("good[modified]dispatch", string("1"), result); @@ -506,15 +506,15 @@ // Just modifying the values now fires traces. - char* setargv[5] = {"treevariable", "-set", "indiv", "2.22", "in", }; - int status = (*m_pCommand)(*m_pInterp, *m_pResult, 5, setargv); + char const* setargv[5] = {"treevariable", "-set", "indiv", "2.22", "in", }; + int status = (*m_pCommand)(*m_pInterp, *m_pResult, 5, const_cast<char**>(setargv)); EQMSG("set status", TCL_OK, status); EQMSG("set trace count", 1, traces); // Now fire the traces: - char* traceargv[2] = {"treevariable", "-firetraces"}; - status = (*m_pCommand)(*m_pInterp, *m_pResult, 2, traceargv); + char const* traceargv[2] = {"treevariable", "-firetraces"}; + status = (*m_pCommand)(*m_pInterp, *m_pResult, 2, const_cast<char**>(traceargv)); EQMSG("trace status", TCL_OK, status); EQMSG("trace trace count", 1, traces); } Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/configure.ac 2013-10-03 19:50:31 UTC (rev 2151) @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(SpecTcl/MySpecTclApp.cpp) +AC_INIT(SpecTcl/MySpecTclApp.cpp, 3.4-001, fo...@ns...) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST @@ -18,7 +18,7 @@ # define the version information in shared # images. -SOVERSION="3:3" +SOVERSION="3:4" # # Checks for programs. @@ -688,6 +688,11 @@ AC_MSG_RESULT(no) fi +## +# There's a utility that uses gengetopt: + +AX_GENGETOPT + # # libTclPlus and libException could have been installed from # Ryan's Deb or I might need to install my own versions which @@ -701,28 +706,28 @@ # # -AC_CHECK_LIB( tclPlus, Tcl_AppInit, [systemtcl="yes"], [systemtcl="no"]) +AC_MSG_CHECKING([libtcl++ installed as package (e.g. .deb)]) +AC_CHECK_FILE([/usr/include/TCLInterpreterObject.h], [systemtcl="yes"], [systemtcl="no"]) -# -# IF systemtcl is yes we're pretty much done.. otherwise -# we need to configure/build/install libtcl into prefix and then set -# the flags: - -AC_MSG_CHECKING([Checking for libtclPlus]) if test $systemtcl = "yes" then - LIBTCLPLUS_CFLAGS= - LIBTCLPLUS_LDFLAGS=-ltclPlus -lException + LIBTCLPLUS_CFLAGS="" + LIBTCLPLUS_LDFLAGS="-ltclPlus -lException" AC_MSG_RESULT([Found in system libraries]) else AC_MSG_RESULT([Need to build local tagged copy]) - (cd libtcl; ./configure --prefix=${prefix}; make clean install) - LIBTCLPLUS_CFLAGS="-I${prefix}/include" - LIBTCLPLUS_LDFLAGS=-"L${prefix}/lib -ltclPlus -lException -Wl,\"-rpath=${prefix}/lib\"" + AC_CHECK_FILE([./libtcl/configure], [havelibtcldir="yes"], [havelibtcldir="no"]) + if test $havelibtcldir = "yes" + then + (cd libtcl; ./configure --prefix=${prefix}; make clean install) + LIBTCLPLUS_CFLAGS="-I${prefix}/include" + LIBTCLPLUS_LDFLAGS=-"L${prefix}/lib -ltclPlus -lException -Wl,\"-rpath=${prefix}/lib\"" + else + AC_MSG_ERROR([I seem to be missing libtcl, please use tcl++incorp.sh to fill it with a tagged release of libtclplus]) + fi fi - AC_SUBST(LIBTCLPLUS_CFLAGS) AC_SUBST(LIBTCLPLUS_LDFLAGS) Modified: branches/SpecTcl-3.4/filtsplit/Makefile.am =================================================================== --- branches/SpecTcl-3.4/filtsplit/Makefile.am 2013-10-03 19:49:52 UTC (rev 2150) +++ branches/SpecTcl-3.4/filtsplit/Makefile.am 2013-10-03 19:50:31 UTC (rev 2151) @@ -14,7 +14,7 @@ cmdline.c cmdline.h: filtsplit.ggo - gengetopt --unamed-opts <filtsplit.ggo + @GENGETOPT@ --unamed-opts <filtsplit.ggo EXTRA_DIST=filtsplit.ggo filtsplit.xml Added: branches/SpecTcl-3.4/m4/gengetopt.m4 =================================================================== --- branches/SpecTcl-3.4/m4/gengetopt.m4 (rev 0) +++ branches/SpecTcl-3.4/m4/gengetopt.m4 2013-10-03 19:50:31 UTC (rev 2151) @@ -0,0 +1,28 @@ +dnl +dnl - Autoconf macro to check for the existence of GNU gengetopt. +dnl --with-gengetopt-path can be provided which is used as the path +dnl instead of any existing or nonexistent gengetopt. +dnl +dnl If this all exists, GENGETOPT is AC_SUSBST-ed into the Makefile. + + +AC_DEFUN([AX_GENGETOPT],[ + + # Withval overrides: + + AC_ARG_WITH(gengetopt-path, + [ --with-gengetopt-path=path-to-gengetopt-executable], + [GENGETOPT=$withval], + GENGETOPT="") + + if test -z "$GENGETOPT" + then + AC_PATH_PROGS([GENGETOPT], gengetopt) + if test -z "$GENGETOPT" + then + AC_MSG_ERROR([ gnu gengetopt tested for but not found]) + fi + fi + AC_MSG_RESULT([Using $GENGETOPT for gnu gengetoptcommand]) + AC_SUBST(GENGETOPT) +]) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-10-03 20:19:29
|
Revision: 2152 http://sourceforge.net/p/nsclspectcl/code/2152 Author: ron-fox Date: 2013-10-03 20:19:16 +0000 (Thu, 03 Oct 2013) Log Message: ----------- Prep for first jenkins build. Modified Paths: -------------- branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/configure.ac Added Paths: ----------- branches/SpecTcl-3.4/testBuildTarball Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-03 19:50:31 UTC (rev 2151) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-03 20:19:16 UTC (rev 2152) @@ -103,6 +103,8 @@ noinst_PROGRAMS=TestRunner + + TestRunner_CXXFLAGS=@CPPUNIT_CFLAGS@ TestRunner_SOURCES = ListTest.cpp SetWidthTest.cpp TreeParameterTest.cpp \ @@ -128,7 +130,7 @@ @LIBTCLPLUS_LDFLAGS@ \ @TK_LIBS@ @TCL_LIBS@ @CPPUNIT_LIBS@ -noinst_HEADERS = Asserts.h +noinst_HEADERS = Asserts.h TreeTestSupport.h TESTS=./TestRunner Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2013-10-03 19:50:31 UTC (rev 2151) +++ branches/SpecTcl-3.4/configure.ac 2013-10-03 20:19:16 UTC (rev 2152) @@ -1,10 +1,10 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(SpecTcl/MySpecTclApp.cpp, 3.4-001, fo...@ns...) +AC_INIT(SpecTcl/MySpecTclApp.cpp) AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.4) +AM_INIT_AUTOMAKE(SpecTcl, 3.4, fo...@ns...) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT Added: branches/SpecTcl-3.4/testBuildTarball =================================================================== --- branches/SpecTcl-3.4/testBuildTarball (rev 0) +++ branches/SpecTcl-3.4/testBuildTarball 2013-10-03 20:19:16 UTC (rev 2152) @@ -0,0 +1,20 @@ +#!/bin/bash -xe + + +rm -rf /tmp/3.4 + +version=`grep AM_INIT_AUTOMAKE configure.ac | cut -f2 -d" " | sed s/,//` + +rm -rf SpecTcl-${version} + +tar xzf SpecTcl-${version}.tar.gz +cd SpecTcl-${version} + +./configure --prefix=/tmp/3.4 +make clean all +make install +make check +make installcheck + +rm -rf SpecTcl-${version} +rm -rf /tmp/3.4 Property changes on: branches/SpecTcl-3.4/testBuildTarball ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-10-08 13:42:25
|
Revision: 2154 http://sourceforge.net/p/nsclspectcl/code/2154 Author: ron-fox Date: 2013-10-08 13:42:23 +0000 (Tue, 08 Oct 2013) Log Message: ----------- fully integrate v1729 fadc with vmusbSpecTcl. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/vmusb/spectclSetup.tcl Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2013-10-05 20:39:17 UTC (rev 2153) +++ branches/SpecTcl-3.4/CHANGELOG 2013-10-08 13:42:23 UTC (rev 2154) @@ -1031,3 +1031,6 @@ configure.ac * Set up to use Jenkins CI server. * Only let the cppunit tests that don't need a display survive. + * Properly integrate the V1729 FADC in VMUSB's spectclSetup.tcl + file. + Modified: branches/SpecTcl-3.4/vmusb/spectclSetup.tcl =================================================================== --- branches/SpecTcl-3.4/vmusb/spectclSetup.tcl 2013-10-05 20:39:17 UTC (rev 2153) +++ branches/SpecTcl-3.4/vmusb/spectclSetup.tcl 2013-10-08 13:42:23 UTC (rev 2154) @@ -76,6 +76,21 @@ spectrum $paramname 1 $paramname [list [list $low $high $channels]] treeparameter -create $paramname $low $high $channels ""; # we don't know the units. } +## +# createFreezeButton +# +# When the first v1729 is seen in the stack, the freeze button is created: +# +proc createFreezeButton {} { + if {![winfo exists .freeze]} { + set freezeFadcSpectra 0 + checkbutton .freeze -text "Freeze fadc spectra"\ + -variable freezeFadcSpectra \ + -onvalue 1 -offvalue 0 + pack .freeze + + } +} #---------------------------------------------------------------------------- @@ -235,7 +250,36 @@ } return $param } +#--------------------------------------------------------------------------- # +# Build channel maps for the V1729 +# In this case, the channels are really place holders for +# spectra. +# parameters: +# param - Number of first available parametr. +# name - Name of the module we are managing. +# Returns: +# next available parameter number. +# +proc buildV1729Map {param name} { + global v1729postTriggers; # Post trigger value for time reorder. + global adcChannels; # Has parameter names. + + # Make a parameter and 2048 2K spectra for each parameter. + + foreach paramName $adcChannels($name) { + parameter $paramName $param + for {set i 0} {$i < 2048} {incr i} { + set spectrumName [format %04d.%s $i $paramName] + spectrum $spectrumName 1 $paramName {{0 2047 2048}} + } + incr param + } + paramMap $name $::typeV1729 $v1729postTriggers($name) $adcChannels($name) + return $param +} + +# # Hinp's unpacker takes a base name from # adcChannels and takes the chip mapping from # HINPChips @@ -425,6 +469,9 @@ set param [buildPSDMap $param $module] } elseif {$::readoutDeviceType($module) eq $::typeMADC32} { set param [buildMADC32Map $param $module] + } elseif {$::readoutDeviceType($module) eq $::typeV1729} { + set param [buildV1729Map $param $module] + createFreezeButton } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2013-10-08 16:57:20
|
Revision: 2156 http://sourceforge.net/p/nsclspectcl/code/2156 Author: ron-fox Date: 2013-10-08 16:57:17 +0000 (Tue, 08 Oct 2013) Log Message: ----------- * Ensure Globals.cpp has access to the program version. * For now avoid the issue of circular build dependencies in treeparams tests. y Modified Paths: -------------- branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/TreeParam/Makefile.am Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-10-08 14:40:14 UTC (rev 2155) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2013-10-08 16:57:17 UTC (rev 2156) @@ -9,7 +9,7 @@ -I@top_srcdir@/factories \ -I@top_srcdir@/DecoderRing \ @TCL_CPPFLAGS@ -DINSTALLED_IN='"$(prefix)"' @XINCLUDES@ \ - @LIBTCLPLUS_CFLAGS@ + @LIBTCLPLUS_CFLAGS@ -DVERSION='"@VERSION@"' install-exec-local: $(mkinstalldirs) $(prefix)/etc Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-08 14:40:14 UTC (rev 2155) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2013-10-08 16:57:17 UTC (rev 2156) @@ -99,6 +99,7 @@ # other folks depend on us first ...including libTclGrammerCommands. # +if THIS_IS_NOT_DEFINED if CPPUNIT noinst_PROGRAMS=TestRunner @@ -135,3 +136,4 @@ TESTS=./TestRunner endif +endif \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-03-26 13:08:27
|
Revision: 2166 http://sourceforge.net/p/nsclspectcl/code/2166 Author: ron-fox Date: 2014-03-26 13:08:24 +0000 (Wed, 26 Mar 2014) Log Message: ----------- Fix up build errors in callbacks. Modified Paths: -------------- branches/SpecTcl-3.4/SpecTcl/controlcallbacktests.cpp branches/SpecTcl-3.4/contrib/scriptable/Makefile.am Modified: branches/SpecTcl-3.4/SpecTcl/controlcallbacktests.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/controlcallbacktests.cpp 2014-03-26 13:07:17 UTC (rev 2165) +++ branches/SpecTcl-3.4/SpecTcl/controlcallbacktests.cpp 2014-03-26 13:08:24 UTC (rev 2166) @@ -14,6 +14,7 @@ #include <unistd.h> #include <string> +#include <unistd.h> #ifdef HAVE_STD_NAMESPACE using namespace std; Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2014-03-26 13:07:17 UTC (rev 2165) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2014-03-26 13:08:24 UTC (rev 2166) @@ -84,21 +84,23 @@ ScriptedSpecTcl_DEPENDENCIES = libScripted.la -ScriptedSpecTcl_LDFLAGS = -L. -lScripted -lTclGrammerCommands \ - -lSorting -lXplus \ - -lGates -lAnalysis \ - -lFilter -lEventSource -lSpecio -lBufferAnalysis \ - -lXamine -lTreeParam -lFits \ - -ltape -lXt -lX11 $(X11EXTRA_LDFLAGS) $(LD_EXTRA_FLAGS) \ +ScriptedSpecTcl_LDFLAGS = @top_builddir@/contrib/scriptable/libScripted.la \ + @top_builddir@/SpecTcl/libTclGrammerCommands.la \ + @top_builddir@/Sorter/libSorting.la @top_builddir@/Xamine/libXplus.la \ + @top_builddir@/Gates/libGates.la \ + @top_builddir@/Events/libAnalysis.la \ + @top_builddir@/Filter/libFilter.la @top_builddir@/EventSource/libEventSource.la \ + @top_builddir@/SpectrumIO/libSpecio.la \ + @top_builddir@/Analysis/libBufferAnalysis.la \ + @top_builddir@/Display/libXamine.la \ + @top_builddir@/TreeParam/libTreeParam.la \ + @top_builddir@/Fits/libFits.la \ + @top_builddir@/Tape/libtape.la \ + -lXt -lX11 $(X11EXTRA_LDFLAGS) $(LD_EXTRA_FLAGS) \ -lgsl -lgslcblas \ - @top_srcdir@/DecoderRing/libDecoderRing.la \ - -L@top_srcdir@/Tape -L@top_srcdir@/Sorter -L@top_srcdir@/Xamine \ - -L@top_srcdir@/Display -L@top_srcdir@/Gates -L@top_srcdir@/EventSource \ - -L@top_srcdir@/Events \ - -L@top_srcdir@/Filter -L@top_srcdir@/SpecTcl -L@top_srcdir@/Analysis \ - -L@top_srcdir@/TreeParam -L@top_srcdir@/Fits \ + @top_builddir@/DecoderRing/libDecoderRing.la \ @LIBTCLPLUS_LDFLAGS@ \ - @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ -L@top_srcdir@/SpectrumIO \ + @TK_LIBS@ @TCL_LIBS@ @XLIBSW@ \ -g -Wl,"-rpath=($prefix)/lib" # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-04-28 19:03:41
|
Revision: 2178 http://sourceforge.net/p/nsclspectcl/code/2178 Author: ron-fox Date: 2014-04-28 19:03:38 +0000 (Mon, 28 Apr 2014) Log Message: ----------- Fix dependency error in exceptions. Modified Paths: -------------- branches/SpecTcl-3.4/EventSource/Makefile.am branches/SpecTcl-3.4/TestFiles/Makefile.am Modified: branches/SpecTcl-3.4/EventSource/Makefile.am =================================================================== --- branches/SpecTcl-3.4/EventSource/Makefile.am 2014-04-28 17:45:17 UTC (rev 2177) +++ branches/SpecTcl-3.4/EventSource/Makefile.am 2014-04-28 19:03:38 UTC (rev 2178) @@ -6,7 +6,7 @@ lib_LTLIBRARIES = libEventSource.la libEventSource_la_LDFLAGS = -version-info $(SOVERSION):0 \ - -Wl,"-rpath-link=$(libdir)" + -Wl,"-rpath-link=$(libdir)" -L. @LIBTCLPLUS_LDFLAGS@ @TCL_LIBS@ @TK_LIBS@ libEventSource_la_SOURCES = File.cpp GaussianDistribution.cpp \ TapeException.cpp TapeFile.cpp TestFile.cpp PipeFile.cpp \ Modified: branches/SpecTcl-3.4/TestFiles/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TestFiles/Makefile.am 2014-04-28 17:45:17 UTC (rev 2177) +++ branches/SpecTcl-3.4/TestFiles/Makefile.am 2014-04-28 19:03:38 UTC (rev 2178) @@ -1,4 +1,4 @@ -INCLUDES= -I. -I../EventSource \ +AM_CPPFLAGS= -I. -I../EventSource \ @LIBTCLPLUS_CFLAGS@ \ -I../Utility @TCL_CPPFLAGS@ -I../Tape @@ -23,5 +23,5 @@ ltwrite_SOURCES = ltwrite.cpp -testfile_LDFLAGS=-Wl,"-rpath=$(libdir)" -ltwrite_LDFLAGS=-Wl,"-rpath=$(libdir)" +testfile_LDFLAGS= @LIBTCLPLUS_LDFLAGS@ -Wl,"-rpath=$(libdir)" +ltwrite_LDFLAGS = @LIBTCLPLUS_LDFLAGS@ -Wl,"-rpath=$(libdir)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-05-20 12:20:03
|
Revision: 2179 http://sourceforge.net/p/nsclspectcl/code/2179 Author: ron-fox Date: 2014-05-20 12:19:59 +0000 (Tue, 20 May 2014) Log Message: ----------- Fix error in VMUSBSpecTcl spectclSetup.tcl - V1x90 setup had a typo. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/vmusb/spectclSetup.tcl Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-04-28 19:03:38 UTC (rev 2178) +++ branches/SpecTcl-3.4/CHANGELOG 2014-05-20 12:19:59 UTC (rev 2179) @@ -1033,4 +1033,4 @@ * Only let the cppunit tests that don't need a display survive. * Properly integrate the V1729 FADC in VMUSB's spectclSetup.tcl file. - + * Fix error in vmusb spectclSetup.tcl typo on V1x90 configuration Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2014-04-28 19:03:38 UTC (rev 2178) +++ branches/SpecTcl-3.4/configure.ac 2014-05-20 12:19:59 UTC (rev 2179) @@ -4,7 +4,7 @@ AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.4, fo...@ns...) +AM_INIT_AUTOMAKE(SpecTcl, 3.4-001, fo...@ns...) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT Modified: branches/SpecTcl-3.4/vmusb/spectclSetup.tcl =================================================================== --- branches/SpecTcl-3.4/vmusb/spectclSetup.tcl 2014-04-28 19:03:38 UTC (rev 2178) +++ branches/SpecTcl-3.4/vmusb/spectclSetup.tcl 2014-05-20 12:19:59 UTC (rev 2179) @@ -157,7 +157,7 @@ parameter $pname $baseparam incr baseparam spectrum $pname 1 $pname "{[list $low $hi $chans]}" - treeparameter -create $pname $low $high $chans "" + treeparameter -create $pname $low $hi $chans "" } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-07-09 19:59:18
|
Revision: 2182 http://sourceforge.net/p/nsclspectcl/code/2182 Author: ron-fox Date: 2014-07-09 19:59:13 +0000 (Wed, 09 Jul 2014) Log Message: ----------- Fix Bug #2100 typo Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/SpecTcl/XamineEventHandler.cpp branches/SpecTcl-3.4/configure.ac Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-07-09 19:41:37 UTC (rev 2181) +++ branches/SpecTcl-3.4/CHANGELOG 2014-07-09 19:59:13 UTC (rev 2182) @@ -1034,3 +1034,5 @@ * Properly integrate the V1729 FADC in VMUSB's spectclSetup.tcl file. * Fix error in vmusb spectclSetup.tcl typo on V1x90 configuration +3.4-002 + * Bug #2100 - gates on m2 spectra incorrectly convert their points. Modified: branches/SpecTcl-3.4/SpecTcl/XamineEventHandler.cpp =================================================================== --- branches/SpecTcl-3.4/SpecTcl/XamineEventHandler.cpp 2014-07-09 19:41:37 UTC (rev 2181) +++ branches/SpecTcl-3.4/SpecTcl/XamineEventHandler.cpp 2014-07-09 19:59:13 UTC (rev 2182) @@ -690,8 +690,8 @@ vector<FPoint> result; for (int i =0; i < rawPoints.size(); i++) { - Float_t x = a[i].AxisToParameter(rawPoints[i].X()); - Float_t y = a[i+1].AxisToParameter(rawPoints[i].Y()); + Float_t x = a[firstAxis].AxisToParameter(rawPoints[i].X()); + Float_t y = a[firstAxis+1].AxisToParameter(rawPoints[i].Y()); result.push_back(FPoint(x,y)); } Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2014-07-09 19:41:37 UTC (rev 2181) +++ branches/SpecTcl-3.4/configure.ac 2014-07-09 19:59:13 UTC (rev 2182) @@ -4,7 +4,7 @@ AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.4-001, fo...@ns...) +AM_INIT_AUTOMAKE(SpecTcl, 3.4-002, fo...@ns...) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-07-10 13:15:50
|
Revision: 2186 http://sourceforge.net/p/nsclspectcl/code/2186 Author: ron-fox Date: 2014-07-10 13:15:46 +0000 (Thu, 10 Jul 2014) Log Message: ----------- Feature #2102 - Display appropriate gates on m2 spectra Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/Sorter/GateMediator.cpp branches/SpecTcl-3.4/Sorter/Histogrammer.cpp branches/SpecTcl-3.4/Sorter/Histogrammer.h Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-07-10 11:53:48 UTC (rev 2185) +++ branches/SpecTcl-3.4/CHANGELOG 2014-07-10 13:15:46 UTC (rev 2186) @@ -1036,3 +1036,5 @@ * Fix error in vmusb spectclSetup.tcl typo on V1x90 configuration 3.4-002 * Bug #2100 - gates on m2 spectra incorrectly convert their points. + * Issue #2101 - Axis definitions for m2 and gd spectra are not clear. + * Feature #2102 Want to display gates on m2 spectra. Modified: branches/SpecTcl-3.4/Sorter/GateMediator.cpp =================================================================== --- branches/SpecTcl-3.4/Sorter/GateMediator.cpp 2014-07-10 11:53:48 UTC (rev 2185) +++ branches/SpecTcl-3.4/Sorter/GateMediator.cpp 2014-07-10 13:15:46 UTC (rev 2186) @@ -116,10 +116,44 @@ return kfFALSE; } } +/** + * mediate2dMultiple + * + * Gates display on a 2d sum spectra iff they are a contour + * or a band and the X/Y parameters of those gates are an X/Y + * parameter that is used by the spectrum. + * + * @note it's not enough for the parameters to be in use, they must + * be on the appropriate axism, or their flips in a matching pair. + */ Bool_t CGateMediator::mediate2dMultiple() { - return false; // for now it is false.. tough tofigure out. + // Gate characteristics: + + string gType = m_rGate->Type(); + UInt_t xParameter; + UInt_t yParameter; + if ((gType == "b") || (gType == "c")) { + CPointListGate& rPLGate = (CPointListGate&)(*m_rGate); + xParameter = rPLGate.getxId(); + yParameter = rPLGate.getyId(); + + std::vector<UInt_t> spectrumParams; + m_pSpec->GetParameterIds(spectrumParams); + for (int i = 0; i < spectrumParams.size(); i+= 2) { + if ((xParameter == spectrumParams[i]) && (yParameter == spectrumParams[i+1])) { + return true; // there's a matching x/y pair. + } + if ((yParameter == spectrumParams[i]) && (xParameter == spectrumParams[i+1])) { + return true; + } + } + return false; // No x/y match. + + } else { + return false; + } } /** * Determine if a gate is displayable on 1-d gamma spectrum. Modified: branches/SpecTcl-3.4/Sorter/Histogrammer.cpp =================================================================== --- branches/SpecTcl-3.4/Sorter/Histogrammer.cpp 2014-07-10 11:53:48 UTC (rev 2185) +++ branches/SpecTcl-3.4/Sorter/Histogrammer.cpp 2014-07-10 13:15:46 UTC (rev 2186) @@ -1377,6 +1377,7 @@ // Contour (type = 'c') // Band (type = 'b') // Cut (type = 's') + // Sum2d {type = 'm2'} // GammaContour (type = 'gc') // GammaBand (type = 'gb') // GammaCut (type = 'gs') @@ -1697,17 +1698,24 @@ if((pSpectrum->getSpectrumType() == ke2D) || (pSpectrum->getSpectrumType() == keG2D) || + (pSpectrum->getSpectrumType() == ke2Dm) || (pSpectrum->getSpectrumType() == keG2DD)) { CPointListGate& rSpecTclGate = (CPointListGate&)rGate.operator*(); vector<FPoint> pts = rSpecTclGate.getPoints(); - vector<UInt_t> Params; - pSpectrum->GetParameterIds(Params); + // vector<UInt_t> Params; + // pSpectrum->GetParameterIds(Params); + + // If necessary flip the x/y coordinates of the gate. + // note that gamma gates never need flipping. + // - - if((rSpecTclGate.getxId() != Params[0]) && - ((rSpecTclGate.Type())[0] != 'g')) { + // if((rSpecTclGate.getxId() != Params[0]) && + // ((rSpecTclGate.Type())[0] != 'g')) { + + if ((rSpecTclGate.Type()[0] != 'g') && + flip2dGatePoints(pSpectrum, rSpecTclGate.getxId())) { for(UInt_t i = 0; i < pts.size(); i++) { // Flip pts to match spectrum. Float_t x = pts[i].X(); Float_t y = pts[i].Y(); @@ -1717,9 +1725,11 @@ // The index of the X axis transform is easy.. it's 0, but the // y axis transform index depends on spectrum type sincd gammas // have all x transforms first then y and so on: + // int nYIndex; - if((pSpectrum->getSpectrumType() == ke2D) || - (pSpectrum->getSpectrumType() == keG2DD)) { + if((pSpectrum->getSpectrumType() == ke2D) || + (pSpectrum->getSpectrumType() == keG2DD) || + (pSpectrum->getSpectrumType() == ke2Dm)) { nYIndex = 1; } else { @@ -2059,3 +2069,32 @@ m_pSpectrumLists = new CSpectrumByParameter; addSpectrumDictionaryObserver(m_pSpectrumLists); } +/** + * flip2dGatePoints + * Determine if the gate point coordinates must be flipped. This happens + * for e.g. a gate on p1, p2 displayed on a spectrum with axes p2, p1 + * + * There's an implicit assumption that the gate is displayable on this spectrum + * because all we do is see if the X parameter is a match for a spectrum x parameter + * and, if not, flip. + * + * @param pSpectrum - pointer to the target spectrum. + * @param gXparam - Id of the x parameter of the spectrum. + * + * @return bool - true if it's necessary to flip axes. + * + */ +bool +CHistogrammer::flip2dGatePoints(CSpectrum* pSpectrum, UInt_t gXparam) +{ + std::vector<UInt_t> params; + pSpectrum->GetParameterIds(params); + if (pSpectrum->getSpectrumType() != ke2Dm) { + for (int i = 0; i < params.size(); i += 2) { + if (gXparam == params[i]) return false; + } + return true; + } else { + return gXparam != params[0]; + } +} Modified: branches/SpecTcl-3.4/Sorter/Histogrammer.h =================================================================== --- branches/SpecTcl-3.4/Sorter/Histogrammer.h 2014-07-10 11:53:48 UTC (rev 2185) +++ branches/SpecTcl-3.4/Sorter/Histogrammer.h 2014-07-10 13:15:46 UTC (rev 2186) @@ -281,6 +281,7 @@ void invokeGateChangedObservers(STD(string) name, CGateContainer& gate); void createListObservers(); + bool flip2dGatePoints(CSpectrum* pSpectrum, UInt_t gXparam); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-08-13 18:37:10
|
Revision: 2187 http://sourceforge.net/p/nsclspectcl/code/2187 Author: ron-fox Date: 2014-08-13 18:36:58 +0000 (Wed, 13 Aug 2014) Log Message: ----------- Add Feature #2103 - Provide a mechanism to not show gates/graph objects. Done by a Spetrum menu toggle button. Note that the toggle button forces a display update. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/Display/menusetup.cc branches/SpecTcl-3.4/Display/refreshctl.cc branches/SpecTcl-3.4/Display/toggles.cc branches/SpecTcl-3.4/Display/toggles.h branches/SpecTcl-3.4/configure.ac Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/CHANGELOG 2014-08-13 18:36:58 UTC (rev 2187) @@ -1038,3 +1038,6 @@ * Bug #2100 - gates on m2 spectra incorrectly convert their points. * Issue #2101 - Axis definitions for m2 and gd spectra are not clear. * Feature #2102 Want to display gates on m2 spectra. +3.4-003 + * Feature #2103 - Allow users to hide the gates on displayed spectra + Spectra->Hide Gates and then refresh the menu is a toggle button. Modified: branches/SpecTcl-3.4/Display/menusetup.cc =================================================================== --- branches/SpecTcl-3.4/Display/menusetup.cc 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/Display/menusetup.cc 2014-08-13 18:36:58 UTC (rev 2187) @@ -73,7 +73,9 @@ #include "Tab.h" #include "wysiwygPrint.h" +extern Boolean Xamine_hideGates; + /* ** External references: */ @@ -311,7 +313,14 @@ Xamine_DisplayAdvance }; + + + pd = bar->AddPulldown("Spectra", 20); + tb = pd->AddMenuToggleButton("Hide Gates"); + tb->AddCallback(Xamine_ToggleAndRefresh, (XtPointer)(&Xamine_hideGates)); + Xamine_AddtoBasePackage(tb); + b = pd->AddMenuButton("SMDisplay"); b->Label("Display Spectrum ..."); b->SetAccelerator("Meta<Key>D","Alt+D"); Modified: branches/SpecTcl-3.4/Display/refreshctl.cc =================================================================== --- branches/SpecTcl-3.4/Display/refreshctl.cc 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/Display/refreshctl.cc 2014-08-13 18:36:58 UTC (rev 2187) @@ -69,12 +69,18 @@ */ struct coords { int row, col; }; + +// Global data: + +Boolean Xamine_hideGates; + /* ** Static data: */ static RefreshCallback refresh_callback = NULL; static XtPointer refresh_user_data = NULL; static Queue<Xamine_RefreshContext> update_list; + /* ** External functions referenced: */ @@ -853,8 +859,10 @@ pdb->refresh_state(ctx->row, ctx->column, rfsh_grobjs); return False; case rfsh_grobjs: /* Graphic objects, advance to grobj names */ - pdb->refresh_state(ctx->row, ctx->column, rfsh_axes); - Xamine_DrawObjects(ctx, pdb->getdef(ctx->column, ctx->row)); + pdb->refresh_state(ctx->row, ctx->column, rfsh_axes); + if (!Xamine_hideGates) { + Xamine_DrawObjects(ctx, pdb->getdef(ctx->column, ctx->row)); + } return False; case rfsh_aborting: /* Clear the window then done. */ ClearWindow(ctx); Modified: branches/SpecTcl-3.4/Display/toggles.cc =================================================================== --- branches/SpecTcl-3.4/Display/toggles.cc 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/Display/toggles.cc 2014-08-13 18:36:58 UTC (rev 2187) @@ -297,6 +297,8 @@ #include <Xm/ToggleB.h> #include "XMWidget.h" #include "toggles.h" +#include "refreshctl.h" + /* ** Functional Description: @@ -322,3 +324,23 @@ *variable = (Boolean)why->set; } + +/** + * Xamine_ToggleAndRefresh + * Do a set toggle and then schedule all visible panes for refresh. + * + * @param w - the menuwidget that fired. + * @param udate - User data, pointer to the global that's toggled. + * @param cd - Pointer to an XmToggleButtonCallbackStruct that tells + * us more about this event + */ +void +Xamine_ToggleAndRefresh(XMWidget* w, XtPointer udata, XtPointer cdata) +{ + // Toggle: + Xamine_SetToggle(w, udata, cdata); + + // Refresh + + Xamine_UpdateAll(w, udata, cdata); +} Modified: branches/SpecTcl-3.4/Display/toggles.h =================================================================== --- branches/SpecTcl-3.4/Display/toggles.h 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/Display/toggles.h 2014-08-13 18:36:58 UTC (rev 2187) @@ -292,5 +292,6 @@ #define _TOGGLES_H void Xamine_SetToggle(XMWidget *w, XtPointer udata, XtPointer cdata); +void Xamine_ToggleAndRefresh(XMWidget* w, XtPointer udata, XtPointer cdata); #endif Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2014-07-10 13:15:46 UTC (rev 2186) +++ branches/SpecTcl-3.4/configure.ac 2014-08-13 18:36:58 UTC (rev 2187) @@ -4,7 +4,7 @@ AC_CONFIG_AUX_DIR(config) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.4-002, fo...@ns...) +AM_INIT_AUTOMAKE(SpecTcl, 3.4-003, fo...@ns...) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-08-14 11:26:41
|
Revision: 2188 http://sourceforge.net/p/nsclspectcl/code/2188 Author: ron-fox Date: 2014-08-14 11:26:38 +0000 (Thu, 14 Aug 2014) Log Message: ----------- Make compilation under g++-4.8.2 work (Ubuntu trusty) Modified Paths: -------------- branches/SpecTcl-3.4/Analysis/Makefile.am branches/SpecTcl-3.4/DecoderRing/Makefile.am branches/SpecTcl-3.4/Display/Makefile.am branches/SpecTcl-3.4/Display/copier.cc branches/SpecTcl-3.4/Display/copier.h branches/SpecTcl-3.4/Display/objcopy.cc branches/SpecTcl-3.4/Display/objcopy.h branches/SpecTcl-3.4/Display/printer.h branches/SpecTcl-3.4/Display/windfile.y branches/SpecTcl-3.4/EventSource/Makefile.am branches/SpecTcl-3.4/EventSource/TapeException.h branches/SpecTcl-3.4/Events/Makefile.am branches/SpecTcl-3.4/Filter/Makefile.am branches/SpecTcl-3.4/Fits/Makefile.am branches/SpecTcl-3.4/Gates/Makefile.am branches/SpecTcl-3.4/Replace/Makefile.am branches/SpecTcl-3.4/Sorter/Makefile.am branches/SpecTcl-3.4/SpecTcl/DocumentationException.h branches/SpecTcl-3.4/SpecTcl/Makefile.am branches/SpecTcl-3.4/SpectrumIO/Makefile.am branches/SpecTcl-3.4/TreeParam/CTreeException.h branches/SpecTcl-3.4/TreeParam/Makefile.am branches/SpecTcl-3.4/Xamine/Makefile.am branches/SpecTcl-3.4/calibratedparams/Makefile.am branches/SpecTcl-3.4/ccusb/Makefile.am branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/contrib/scriptable/Makefile.am branches/SpecTcl-3.4/filtsplit/Makefile.am branches/SpecTcl-3.4/radware/Makefile.am branches/SpecTcl-3.4/tcl++incorp.sh branches/SpecTcl-3.4/vmusb/Makefile.am Modified: branches/SpecTcl-3.4/Analysis/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Analysis/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Analysis/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -16,7 +16,7 @@ SRunContext.h \ BufferAnalysis.h -INCLUDES = -I@top_srcdir@/Events \ +AM_CPPFLAGS = -I@top_srcdir@/Events \ -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Utility \ -I. @LIBTCLPLUS_CFLAGS@ @@ -27,4 +27,4 @@ man_MANS = BufferAnalysis.3 CBufferProcessor.3 CBufferCallback.3 -EXTRA_DIST = $(man_MANS) \ No newline at end of file +EXTRA_DIST = $(man_MANS) Modified: branches/SpecTcl-3.4/DecoderRing/Makefile.am =================================================================== --- branches/SpecTcl-3.4/DecoderRing/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/DecoderRing/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -14,10 +14,10 @@ RingFormatHelper11Creator.h -INCLUDES = -I@top_srcdir@/Utility \ +AM_CPPFLAGS = -I@top_srcdir@/Utility \ -I@top_srcdir@/Events \ -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Filter \ -I@top_srcdir@/SpecTcl @LIBTCLPLUS_CFLAGS@ -libDecoderRing_la_LDFLAGS = @LIBTCLPLUS_LDFLAGS@ \ No newline at end of file +libDecoderRing_la_LDFLAGS = @LIBTCLPLUS_LDFLAGS@ Modified: branches/SpecTcl-3.4/Display/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Display/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -6,7 +6,7 @@ MOTIF_SOURCES = XMCallback.cc XMMenus.cc XMDialogs.cc XMWidget.cc \ XMPushbutton.cc XMManagers.cc XMText.cc -INCLUDES = -I.. @XINCLUDES@ @MOTIF_INCLUDES@ $(HOMEDEF) $(GRIFLAGS) \ +AM_CPPFLAGS = -I.. @XINCLUDES@ @MOTIF_INCLUDES@ $(HOMEDEF) $(GRIFLAGS) \ -I@top_srcdir@/Utility $(GDINCLUDES) # AM_LDFLAGS = -g $(GDLDSW) @XLIBSW@ @MOTIF_LIBSW@ @XTLIBSW@ @@ -201,4 +201,4 @@ MOSTLYCLEANFILES = defaultfile_lex.cc defaultfile_lex.h grobfile_lex.cc \ grobfile_lex.h windfile_lex.cc windfile_lex.h \ - defaultfile_parse.cc grobfile_parse.cc windfile_parse.cc \ No newline at end of file + defaultfile_parse.cc grobfile_parse.cc windfile_parse.cc Modified: branches/SpecTcl-3.4/Display/copier.cc =================================================================== --- branches/SpecTcl-3.4/Display/copier.cc 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/copier.cc 2014-08-14 11:26:38 UTC (rev 2188) @@ -409,7 +409,7 @@ ** NOTE: ** The default is a rightward facing arrow. */ -Copier_Form::Copier_Form(XMForm *parent, char *leftlbl, char *rightlbl) +Copier_Form::Copier_Form(XMForm *parent, const char *leftlbl, const char *rightlbl) { left_label = new XMLabel("Left_Label", *parent, leftlbl); right_label= new XMLabel("Right_Label", *parent, rightlbl); Modified: branches/SpecTcl-3.4/Display/copier.h =================================================================== --- branches/SpecTcl-3.4/Display/copier.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/copier.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -313,7 +313,7 @@ public: /* Constructors and Desctructors: */ - Copier_Form(XMForm *Parent, char *leftlbl = "From", char *rightlbl = "To"); + Copier_Form(XMForm *Parent, const char *leftlbl = "From", const char *rightlbl = "To"); virtual ~Copier_Form() { delete left_l; delete right_l; Modified: branches/SpecTcl-3.4/Display/objcopy.cc =================================================================== --- branches/SpecTcl-3.4/Display/objcopy.cc 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/objcopy.cc 2014-08-14 11:26:38 UTC (rev 2188) @@ -511,7 +511,7 @@ ** Pointers to names for the left and right slection columns. */ Copy_Multiselect::Copy_Multiselect(XMForm *top, XMForm *bottom, - char *left_lbl, char *right_lbl) : + const char *left_lbl, const char *right_lbl) : Copier_Form(top, left_lbl, right_lbl) { Modified: branches/SpecTcl-3.4/Display/objcopy.h =================================================================== --- branches/SpecTcl-3.4/Display/objcopy.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/objcopy.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -311,8 +311,8 @@ /* Instantiators and destructors: */ Copy_Multiselect(XMForm *top, XMForm *bottom, - char *left_lbl = "Left:", - char *right_lbl = "Right:"); + const char *left_lbl = "Left:", + const char *right_lbl = "Right:"); virtual ~Copy_Multiselect() { delete SelectLeft; delete SelectRight; Modified: branches/SpecTcl-3.4/Display/printer.h =================================================================== --- branches/SpecTcl-3.4/Display/printer.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/printer.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -25,7 +25,7 @@ #ifndef _PRINTER_H #define _PRINTER_H -#include <Fstream.h> +#include <fstream> #include <dispgrob.h> #include <string> Modified: branches/SpecTcl-3.4/Display/windfile.y =================================================================== --- branches/SpecTcl-3.4/Display/windfile.y 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Display/windfile.y 2014-08-14 11:26:38 UTC (rev 2188) @@ -71,7 +71,6 @@ %token GEOMETRY %token ZOOMED %token WINDOW -%token ZOOMED %token AXES %token NOAXES %token TICKS Modified: branches/SpecTcl-3.4/EventSource/Makefile.am =================================================================== --- branches/SpecTcl-3.4/EventSource/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/EventSource/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -I. -I../Utility -I../NSCLException -I../Tape -I../SpecTcl \ +AM_CPPFLAGS = -I. -I../Utility -I../NSCLException -I../Tape -I../SpecTcl \ -I../Events -I../TCL -I../Filter @TCL_CPPFLAGS@ @LIBTCLPLUS_CFLAGS@ LDADD=-L. @LIBTCLPLUS_LDFLAGS@ @TCL_LIBS@ @TK_LIBS@ Modified: branches/SpecTcl-3.4/EventSource/TapeException.h =================================================================== --- branches/SpecTcl-3.4/EventSource/TapeException.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/EventSource/TapeException.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -302,7 +302,9 @@ #define __STL_STRING #endif #endif - +#ifndef __HISTOTTYPES_H +#include <histotypes.h> +#endif class CTapeException : public CException { UInt_t m_nTapeError; // Snapshot of the mtaccess error code at the time Modified: branches/SpecTcl-3.4/Events/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Events/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Events/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,5 +1,5 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I@top_srcdir@ -I. -I@top_srcdir@/Utility \ +AM_CPPFLAGS = -I@top_srcdir@ -I. -I@top_srcdir@/Utility \ -I@top_srcdir@/NSCLException -I@top_srcdir@/EventSource \ -I@top_srcdir@/TCL \ -I@top_srcdir@/SpecTcl -I@top_srcdir@/Filter \ Modified: branches/SpecTcl-3.4/Filter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Filter/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Filter/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -g -I. -I@top_srcdir@/Sorter -I@top_srcdir@/Events \ +AM_CPPFLAGS = -g -I. -I@top_srcdir@/Sorter -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Gates \ -I@top_srcdir@/SpecTcl -I@top_srcdir@/Xamine \ -I@top_srcdir@/NSCLException -I@top_srcdir@/TCL \ Modified: branches/SpecTcl-3.4/Fits/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Fits/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Fits/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -16,7 +16,7 @@ # -INCLUDES = -I@top_srcdir@/Utility \ +AM_CPPFLAGS = -I@top_srcdir@/Utility \ -I@top_srcdir@/Xamine \ -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Sorter \ Modified: branches/SpecTcl-3.4/Gates/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Gates/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Gates/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -I. -I../Utility -I../Events -I../Xamine -I@top_srcdir@/Sorter \ +AM_CPPFLAGS = -I. -I../Utility -I../Events -I../Xamine -I@top_srcdir@/Sorter \ -I@top_srcdir@/NSCLException @LIBTCLPLUS_CFLAGS@ LDADD = -lTclGrammerCommands -lSorting -lXplus -lAnalysis -lEventSource \ Modified: branches/SpecTcl-3.4/Replace/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Replace/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Replace/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -I. -I.. +AM_CPPFLAGS = -I. -I.. lib_LTLIBRARIES = libreplace.la libreplace_la_LDFLAGS = -version-info $(SOVERSION):0 \ Modified: branches/SpecTcl-3.4/Sorter/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Sorter/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Sorter/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -I. -I../Utility @LIBTCLPLUS_CFLAGS@ -I../Xamine -I../Gates \ +AM_CPPFLAGS = -I. -I../Utility @LIBTCLPLUS_CFLAGS@ -I../Xamine -I../Gates \ -I../Events -I../Display @TCL_CPPFLAGS@ -I.. -I@top_srcdir@/Fits libSorting_la_LIBADD = @top_srcdir@/Xamine/libXplus.la \ @@ -56,4 +56,4 @@ TESTS=./TestRunner -endif \ No newline at end of file +endif Modified: branches/SpecTcl-3.4/SpecTcl/DocumentationException.h =================================================================== --- branches/SpecTcl-3.4/SpecTcl/DocumentationException.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/SpecTcl/DocumentationException.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -17,6 +17,9 @@ */ #ifndef __DOCUMENTATIONEXCEPTION_H #define __DOCUMENTATIONEXCETPION_H +#ifndef __HISTOTYPES_H +#include <histotypes.h> +#endif #ifndef __CEXCEPTION_H #include <Exception.h> Modified: branches/SpecTcl-3.4/SpecTcl/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpecTcl/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/SpecTcl/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,5 +1,5 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I@top_srcdir@ -I. -I@top_srcdir@/Events \ +AM_CPPFLAGS = -I@top_srcdir@ -I. -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates -I@top_srcdir@/SpectrumIO \ -I@top_srcdir@/Xamine \ Modified: branches/SpecTcl-3.4/SpectrumIO/Makefile.am =================================================================== --- branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/SpectrumIO/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,5 +1,5 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I.. -I. \ +AM_CPPFLAGS = -I.. -I. \ -I../SpecTcl -I../Sorter -I../Utility \ -I../Xamine -I../Events -I../Gates -I../Display @TCL_CPPFLAGS@ \ @LIBTCLPLUS_CFLAGS@ Modified: branches/SpecTcl-3.4/TreeParam/CTreeException.h =================================================================== --- branches/SpecTcl-3.4/TreeParam/CTreeException.h 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/TreeParam/CTreeException.h 2014-08-14 11:26:38 UTC (rev 2188) @@ -63,6 +63,11 @@ * @version 1.0 * @created 30-Mar-2005 11:03:49 AM */ + +#ifndef __HISTOTYPES_H +#include <histotypes.h> +#endif + class CTreeException : public CException { // Data types: Modified: branches/SpecTcl-3.4/TreeParam/Makefile.am =================================================================== --- branches/SpecTcl-3.4/TreeParam/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/TreeParam/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -71,7 +71,7 @@ server.tcl \ tabnbook.tcl -INCLUDES = @LIBTCLPLUS_CFLAGS@ \ +AM_CPPFLAGS = @LIBTCLPLUS_CFLAGS@ \ -I@top_srcdir@/Sorter \ -I@top_srcdir@/Events \ -I@top_srcdir@/SpecTcl \ @@ -136,4 +136,4 @@ TESTS=./TestRunner endif -endif \ No newline at end of file +endif Modified: branches/SpecTcl-3.4/Xamine/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Xamine/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/Xamine/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,4 +1,4 @@ -INCLUDES = -g -I. -I../Utility -I../Display @LIBTCLPLUS_CFLAGS@ +AM_CPPFLAGS = -g -I. -I../Utility -I../Display @LIBTCLPLUS_CFLAGS@ LDADD = -lXplus -lXamine @LIBTCLPLUS_LDFLAGS@ -L. # AM_LDFLAGS = -L. Modified: branches/SpecTcl-3.4/calibratedparams/Makefile.am =================================================================== --- branches/SpecTcl-3.4/calibratedparams/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/calibratedparams/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,6 +1,6 @@ initLDFLAGS=@TK_LIBS@ @TCL_LIBS@ -INCLUDES = -I. -I@top_srcdir@/Utility -I@top_srcdir@/NSCLException \ +AM_CPPFLAGS = -I. -I@top_srcdir@/Utility -I@top_srcdir@/NSCLException \ -I@top_srcdir@/Xamine -I@top_srcdir@/TCL \ -I@top_srcdir@/Events -I@top_srcdir@/SpecTcl \ -I@top_srcdir@/Sorter -I@top_srcdir@/EventSource \ Modified: branches/SpecTcl-3.4/ccusb/Makefile.am =================================================================== --- branches/SpecTcl-3.4/ccusb/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/ccusb/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -17,7 +17,7 @@ ParamMapCommand.h -INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ +AM_CPPFLAGS = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates \ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/configure.ac 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,10 +1,11 @@ # Process this file with autoconf to produce a configure script. +AC_INIT(SpecTcl, 3.4-003) +AC_CONFIG_SRCDIR(SpecTcl/MySpecTclApp.cpp) +AC_CONFIG_AUX_DIR(config) -AC_INIT(SpecTcl/MySpecTclApp.cpp) -AC_CONFIG_AUX_DIR(config) +AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST -AM_INIT_AUTOMAKE(SpecTcl, 3.4-003, fo...@ns...) AC_CONFIG_MACRO_DIR([m4]) AC_EXEEXT Modified: branches/SpecTcl-3.4/contrib/scriptable/Makefile.am =================================================================== --- branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/contrib/scriptable/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -1,5 +1,5 @@ DEFS = @WCHAR_T_DEF@ -INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ +AM_CPPFLAGS = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates \ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ Modified: branches/SpecTcl-3.4/filtsplit/Makefile.am =================================================================== --- branches/SpecTcl-3.4/filtsplit/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/filtsplit/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -10,7 +10,7 @@ noinst_HEADERS=cmdline.h -INCLUDES=-I@top_srcdir@/Filter +AM_CPPFLAGS =-I@top_srcdir@/Filter cmdline.c cmdline.h: filtsplit.ggo Modified: branches/SpecTcl-3.4/radware/Makefile.am =================================================================== --- branches/SpecTcl-3.4/radware/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/radware/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -16,7 +16,7 @@ libradwareio_la_LIBADD = -INCLUDES = -I. -I@top_builddir@ \ +AM_CPPFLAGS = -I. -I@top_builddir@ \ $(TCL_CPPFLAGS) -I@top_builddir@/TCL \ -I@top_builddir@/Utility \ -I@top_builddir@/SpecTcl \ Modified: branches/SpecTcl-3.4/tcl++incorp.sh =================================================================== --- branches/SpecTcl-3.4/tcl++incorp.sh 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/tcl++incorp.sh 2014-08-14 11:26:38 UTC (rev 2188) @@ -11,7 +11,7 @@ # The idea is that libtcl/libexception could be or not be centrally # installed, but if not, built from the export directory. # -# +# Last used with libtclplus-v2.0-000 baseURL="https://svn.code.sf.net/p/nscldaq/code/tags" Modified: branches/SpecTcl-3.4/vmusb/Makefile.am =================================================================== --- branches/SpecTcl-3.4/vmusb/Makefile.am 2014-08-13 18:36:58 UTC (rev 2187) +++ branches/SpecTcl-3.4/vmusb/Makefile.am 2014-08-14 11:26:38 UTC (rev 2188) @@ -46,7 +46,7 @@ MySpecTclApp.h -INCLUDES = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ +AM_CPPFLAGS = -I. -I@top_srcdir@ -I@top_srcdir@/Events \ -I@top_srcdir@/Utility -I@top_srcdir@/Sorter \ -I@top_srcdir@/EventSource -I@top_srcdir@/Gates \ -I@top_srcdir@/SpectrumIO -I@top_srcdir@/Xamine -I@top_srcdir@/SpecTcl \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-08-14 12:53:49
|
Revision: 2190 http://sourceforge.net/p/nsclspectcl/code/2190 Author: ron-fox Date: 2014-08-14 12:53:34 +0000 (Thu, 14 Aug 2014) Log Message: ----------- * Update to tkcon-2.5 which is needed for Tcl-8.6 * Update testBuildTarball for jenkins to be aware that the tarball version could be in AC_INIT. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/Makefile.am branches/SpecTcl-3.4/Scripts/tkcon.tcl branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/testBuildTarball Added Paths: ----------- branches/SpecTcl-3.4/tkcon/ branches/SpecTcl-3.4/tkcon/Makefile.am branches/SpecTcl-3.4/tkcon/tkcon-2.5.tcl Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-08-14 12:31:58 UTC (rev 2189) +++ branches/SpecTcl-3.4/CHANGELOG 2014-08-14 12:53:34 UTC (rev 2190) @@ -1041,3 +1041,5 @@ 3.4-003 * Feature #2103 - Allow users to hide the gates on displayed spectra Spectra->Hide Gates and then refresh the menu is a toggle button. + * Feature #1484 - Make work with Tcl 8.6. + Modified: branches/SpecTcl-3.4/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Makefile.am 2014-08-14 12:31:58 UTC (rev 2189) +++ branches/SpecTcl-3.4/Makefile.am 2014-08-14 12:53:34 UTC (rev 2190) @@ -3,7 +3,8 @@ Events Gates Sorter SpectrumIO Filter Analysis\ DecoderRing TreeParam \ Fits SpecTcl \ - contrib TestFiles Gui splash filtsplit calibratedparams treegui ccusb vmusb + contrib TestFiles Gui splash filtsplit calibratedparams treegui \ + ccusb vmusb tkcon ACLOCAL_AMFLAGS=-I m4 Modified: branches/SpecTcl-3.4/Scripts/tkcon.tcl =================================================================== --- branches/SpecTcl-3.4/Scripts/tkcon.tcl 2014-08-14 12:31:58 UTC (rev 2189) +++ branches/SpecTcl-3.4/Scripts/tkcon.tcl 2014-08-14 12:53:34 UTC (rev 2190) @@ -1,6164 +1,8 @@ -#!/bin/sh -# \ -exec wish "$0" ${1+"$@"} - -# -## tkcon.tcl -## Enhanced Tk Console, part of the VerTcl system -## -## Originally based off Brent Welch's Tcl Shell Widget -## (from "Practical Programming in Tcl and Tk") -## -## Thanks to the following (among many) for early bug reports & code ideas: -## Steven Wahl, Jan Nijtmans, Mark Crimmins, Wart -## -## Copyright (c) 1995-2004 Jeffrey Hobbs, jeff(a)hobbs(.)org -## Initiated: Thu Aug 17 15:36:47 PDT 1995 -## -## source standard_disclaimer.tcl -## source bourbon_ware.tcl -## - -# Proxy support for retrieving the current version of Tkcon. -# -# Mon Jun 25 12:19:56 2001 - Pat Thoyts -# -# In your tkcon.cfg or .tkconrc file put your proxy details into the -# `proxy' member of the `PRIV' array. e.g.: -# -# set ::tkcon::PRIV(proxy) wwwproxy:8080 -# -# If you want to be prompted for proxy authentication details (eg for -# an NT proxy server) make the second element of this variable non-nil - eg: -# -# set ::tkcon::PRIV(proxy) {wwwproxy:8080 1} -# -# Or you can set the above variable from within tkcon by calling -# -# tkcon master set ::tkcon:PRIV(proxy) wwwproxy:8080 -# - -if {$tcl_version < 8.0} { - return -code error "tkcon requires at least Tcl/Tk8" -} else { - package require Tk -} - -catch {package require bogus-package-name} -foreach pkg [info loaded {}] { - set file [lindex $pkg 0] - set name [lindex $pkg 1] - if {![catch {set version [package require $name]}]} { - if {[string match {} [package ifneeded $name $version]]} { - package ifneeded $name $version [list load $file $name] - } - } -} -catch {unset pkg file name version} - -# Tk 8.4 makes previously exposed stuff private. -# FIX: Update tkcon to not rely on the private Tk code. -# -if {![llength [info globals tkPriv]]} { - ::tk::unsupported::ExposePrivateVariable tkPriv -} -foreach cmd {SetCursor UpDownLine Transpose ScrollPages} { - if {![llength [info commands tkText$cmd]]} { - ::tk::unsupported::ExposePrivateCommand tkText$cmd - } -} - -# Initialize the ::tkcon namespace -# -namespace eval ::tkcon { - # when modifying this line, make sure that the auto-upgrade check - # for version still works. - variable VERSION "2.4" - # The OPT variable is an array containing most of the optional - # info to configure. COLOR has the color data. - variable OPT - variable COLOR - - # PRIV is used for internal data that only tkcon should fiddle with. - variable PRIV - set PRIV(WWW) [info exists embed_args] - - variable EXPECT 0 -} - -## ::tkcon::Init - inits tkcon -# -# Calls: ::tkcon::InitUI -# Outputs: errors found in tkcon's resource file -## -proc ::tkcon::Init {args} { - variable VERSION - variable OPT - variable COLOR - variable PRIV - global tcl_platform env tcl_interactive errorInfo - - set tcl_interactive 1 - set argc [llength $args] - - ## - ## When setting up all the default values, we always check for - ## prior existence. This allows users who embed tkcon to modify - ## the initial state before tkcon initializes itself. - ## - - # bg == {} will get bg color from the main toplevel (in InitUI) - foreach {key default} { - bg {} - blink \#FFFF00 - cursor \#000000 - disabled \#4D4D4D - proc \#008800 - var \#FFC0D0 - prompt \#8F4433 - stdin \#000000 - stdout \#0000FF - stderr \#FF0000 - } { - if {![info exists COLOR($key)]} { set COLOR($key) $default } - } - - foreach {key default} { - autoload {} - blinktime 500 - blinkrange 1 - buffer 512 - calcmode 0 - cols 80 - debugPrompt {(level \#$level) debug [history nextid] > } - dead {} - edit edit - expandorder {Pathname Variable Procname} - font {} - history 48 - hoterrors 1 - library {} - lightbrace 1 - lightcmd 1 - maineval {} - maxmenu 18 - nontcl 0 - prompt1 {ignore this, it's set below} - rows 20 - scrollypos right - showmenu 1 - showmultiple 1 - showstatusbar 1 - slaveeval {} - slaveexit close - subhistory 1 - gc-delay 60000 - gets {congets} - overrideexit 1 - usehistory 1 - - exec slave - } { - if {![info exists OPT($key)]} { set OPT($key) $default } - } - - foreach {key default} { - app {} - appname {} - apptype slave - namesp :: - cmd {} - cmdbuf {} - cmdsave {} - event 1 - deadapp 0 - deadsock 0 - debugging 0 - displayWin . - histid 0 - find {} - find,case 0 - find,reg 0 - errorInfo {} - protocol exit - showOnStartup 1 - slaveprocs { - alias tkconclear dir dump echo idebug lremove - tkcon_puts tkcon_gets observe observe_var unalias which what - } - RCS {RCS: @(#) $Id$} - HEADURL {http://cvs.sourceforge.net/viewcvs.py/*checkout*/tkcon/tkcon/tkcon.tcl?rev=HEAD} - - docs "http://tkcon.sourceforge.net/" - email {jeff(a)hobbs(.)org} - root . - uid 0 - tabs {} - } { - if {![info exists PRIV($key)]} { set PRIV($key) $default } - } - foreach {key default} { - slavealias { $OPT(edit) more less tkcon } - } { - if {![info exists PRIV($key)]} { set PRIV($key) [subst $default] } - } - set PRIV(version) $VERSION - - option add *Menu.tearOff 0 - option add *takeFocus 0 - - if {[info exists PRIV(name)]} { - set title $PRIV(name) - } else { - MainInit - # some main initialization occurs later in this proc, - # to go after the UI init - set MainInit 1 - set title Main - } - - ## NOTES FOR STAYING IN PRIMARY INTERPRETER: - ## - ## If you set ::tkcon::OPT(exec) to {}, then instead of a multiple - ## interp model, you get tkcon operating in the main interp by default. - ## This can be useful when attaching to programs that like to operate - ## in the main interpter (for example, based on special wish'es). - ## You can set this from the command line with -exec "" - ## A side effect is that all tkcon command line args will be used - ## by the first console only. - set OPT(exec) {} - - if {$PRIV(WWW)} { - lappend PRIV(slavealias) history - set OPT(prompt1) {[history nextid] % } - } else { - lappend PRIV(slaveprocs) tcl_unknown unknown - set OPT(prompt1) {([file tail [pwd]]) [history nextid] % } - } - - ## If we are using the default '.' toplevel, and there appear to be - ## children of '.', then make sure we use a disassociated toplevel. - if {$PRIV(root) == "." && [llength [winfo children .]]} { - set PRIV(root) .tkcon - } - - ## Do platform specific configuration here, other than defaults - ### Use tkcon.cfg filename for resource filename on non-unix systems - ### Determine what directory the resource file should be in - switch $tcl_platform(platform) { - macintosh { - if {![interp issafe]} {cd [file dirname [info script]]} - set envHome PREF_FOLDER - set rcfile tkcon.cfg - set histfile tkcon.hst - catch {console hide} - } - windows { - set envHome HOME - set rcfile tkcon.cfg - set histfile tkcon.hst - } - unix { - set envHome HOME - set rcfile .tkconrc - set histfile .tkcon_history - } - } - if {[info exists env($envHome)]} { - set home $env($envHome) - if {[file pathtype $home] == "volumerelative"} { - # Convert 'C:' to 'C:/' if necessary, innocuous otherwise - append home / - } - if {![info exists PRIV(rcfile)]} { - set PRIV(rcfile) [file join $home $rcfile] - } - if {![info exists PRIV(histfile)]} { - set PRIV(histfile) [file join $home $histfile] - } - } - - ## Handle command line arguments before sourcing resource file to - ## find if resource file is being specified (let other args pass). - if {[set i [lsearch -exact $args -rcfile]] != -1} { - set PRIV(rcfile) [lindex $args [incr i]] - } - - if {!$PRIV(WWW) && [file exists $PRIV(rcfile)]} { - set code [catch {uplevel \#0 [list source $PRIV(rcfile)]} err] - } - - if {[info exists env(TK_CON_LIBRARY)]} { - lappend ::auto_path $env(TK_CON_LIBRARY) - } elseif {$OPT(library) != ""} { - lappend ::auto_path $OPT(library) - } - - if {![info exists ::tcl_pkgPath]} { - set dir [file join [file dirname [info nameofexec]] lib] - if {[llength [info commands @scope]]} { - set dir [file join $dir itcl] - } - catch {source [file join $dir pkgIndex.tcl]} - } - catch {tclPkgUnknown dummy-name dummy-version} - - ## Handle rest of command line arguments after sourcing resource file - ## and slave is created, but before initializing UI or setting packages. - set slaveargs {} - set slavefiles {} - set truth {^(1|yes|true|on)$} - for {set i 0} {$i < $argc} {incr i} { - set arg [lindex $args $i] - if {[string match {-*} $arg]} { - set val [lindex $args [incr i]] - ## Handle arg based options - switch -glob -- $arg { - -- - -argv - -args { - set argv [concat -- [lrange $argv $i end]] - set argc [llength $argv] - break - } - -color-* { set COLOR([string range $arg 7 end]) $val } - -exec { set OPT(exec) $val } - -main - -e - -eval { append OPT(maineval) \n$val\n } - -package - -load { lappend OPT(autoload) $val } - -slave { append OPT(slaveeval) \n$val\n } - -nontcl { set OPT(nontcl) [regexp -nocase $truth $val]} - -root { set PRIV(root) $val } - -font { set OPT(font) $val } - -rcfile {} - default { lappend slaveargs $arg; incr i -1 } - } - } elseif {[file isfile $arg]} { - lappend slavefiles $arg - } else { - lappend slaveargs $arg - } - } - - ## Create slave executable - if {"" != $OPT(exec)} { - uplevel \#0 ::tkcon::InitSlave $OPT(exec) $slaveargs - } else { - set argc [llength $slaveargs] - set args $slaveargs - uplevel \#0 $slaveargs - } - - ## Attach to the slave, EvalAttached will then be effective - Attach $PRIV(appname) $PRIV(apptype) - InitUI $title - if {"" != $OPT(exec)} { - # override exit to DeleteTab now that tab has been created - $OPT(exec) alias exit ::tkcon::DeleteTab $PRIV(curtab) $OPT(exec) - } - - ## swap puts and gets with the tkcon versions to make sure all - ## input and output is handled by tkcon - if {![catch {rename ::puts ::tkcon_tcl_puts}]} { - interp alias {} ::puts {} ::tkcon_puts - } - if {($OPT(gets) != "") && ![catch {rename ::gets ::tkcon_tcl_gets}]} { - interp alias {} ::gets {} ::tkcon_gets - } - - EvalSlave history keep $OPT(history) - if {[info exists MainInit]} { - # Source history file only for the main console, as all slave - # consoles will adopt from the main's history, but still - # keep separate histories - if {!$PRIV(WWW) && $OPT(usehistory) && [file exists $PRIV(histfile)]} { - puts -nonewline "loading history file ... " - # The history file is built to be loaded in and - # understood by tkcon - if {[catch {uplevel \#0 [list source $PRIV(histfile)]} herr]} { - puts stderr "error:\n$herr" - append PRIV(errorInfo) $errorInfo\n - } - set PRIV(event) [EvalSlave history nextid] - puts "[expr {$PRIV(event)-1}] events added" - } - } - - ## Autoload specified packages in slave - set pkgs [EvalSlave package names] - foreach pkg $OPT(autoload) { - puts -nonewline "autoloading package \"$pkg\" ... " - if {[lsearch -exact $pkgs $pkg]>-1} { - if {[catch {EvalSlave package require [list $pkg]} pkgerr]} { - puts stderr "error:\n$pkgerr" - append PRIV(errorInfo) $errorInfo\n - } else { puts "OK" } - } else { - puts stderr "error: package does not exist" - } - } - - ## Evaluate maineval in slave - if {[string compare {} $OPT(maineval)] && \ - [catch {uplevel \#0 $OPT(maineval)} merr]} { - puts stderr "error in eval:\n$merr" - append PRIV(errorInfo) $errorInfo\n - } - - ## Source extra command line argument files into slave executable - foreach fn $slavefiles { - puts -nonewline "slave sourcing \"$fn\" ... " - if {[catch {EvalSlave source [list $fn]} fnerr]} { - puts stderr "error:\n$fnerr" - append PRIV(errorInfo) $errorInfo\n - } else { puts "OK" } - } - - ## Evaluate slaveeval in slave - if {[string compare {} $OPT(slaveeval)] && \ - [catch {interp eval $OPT(exec) $OPT(slaveeval)} serr]} { - puts stderr "error in slave eval:\n$serr" - append PRIV(errorInfo) $errorInfo\n - } - ## Output any error/output that may have been returned from rcfile - if {[info exists code] && $code && [string compare {} $err]} { - puts stderr "error in $PRIV(rcfile):\n$err" - append PRIV(errorInfo) $errorInfo - } - if {[string compare {} $OPT(exec)]} { - StateCheckpoint [concat $PRIV(name) $OPT(exec)] slave - } - StateCheckpoint $PRIV(name) slave - - Prompt "$title console display active (Tcl$::tcl_patchLevel / Tk$::tk_patchLevel)\n" -} - -## ::tkcon::InitSlave - inits the slave by placing key procs and aliases in it -## It's arg[cv] are based on passed in options, while argv0 is the same as -## the master. tcl_interactive is the same as the master as well. -# ARGS: slave - name of slave to init. If it does not exist, it is created. -# args - args to pass to a slave as argv/argc -## -proc ::tkcon::InitSlave {slave args} { - variable OPT - variable COLOR - variable PRIV - global argv0 tcl_interactive tcl_library env auto_path tk_library - - if {[string match {} $slave]} { - return -code error "Don't init the master interpreter, goofball" - } - if {![interp exists $slave]} { interp create $slave } - if {[interp eval $slave info command source] == ""} { - $slave alias source SafeSource $slave - $slave alias load SafeLoad $slave - $slave alias open SafeOpen $slave - $slave alias file file - interp eval $slave \ - [list set auto_path [lremove $auto_path $tk_library]] - interp eval $slave [dump var -nocomplain tcl_library env] - interp eval $slave { catch {source [file join $tcl_library init.tcl]} } - interp eval $slave { catch unknown } - } - # This will likely be overridden to call DeleteTab where possible - $slave alias exit exit - interp eval $slave { - # Do package require before changing around puts/gets - catch {package require bogus-package-name} - catch {rename ::puts ::tkcon_tcl_puts} - } - foreach cmd $PRIV(slaveprocs) { $slave eval [dump proc $cmd] } - foreach cmd $PRIV(slavealias) { $slave alias $cmd $cmd } - interp alias $slave ::ls $slave ::dir -full - interp alias $slave ::puts $slave ::tkcon_puts - if {$OPT(gets) != ""} { - interp eval $slave { catch {rename ::gets ::tkcon_tcl_gets} } - interp alias $slave ::gets $slave ::tkcon_gets - } - if {[info exists argv0]} {interp eval $slave [list set argv0 $argv0]} - interp eval $slave set tcl_interactive $tcl_interactive \; \ - set auto_path [list [lremove $auto_path $tk_library]] \; \ - set argc [llength $args] \; \ - set argv [list $args] \; { - if {![llength [info command bgerror]]} { - proc bgerror err { - global errorInfo - set body [info body bgerror] - rename ::bgerror {} - if {[auto_load bgerror]} { return [bgerror $err] } - proc bgerror err $body - tkcon bgerror $err $errorInfo - } - } - } - - foreach pkg [lremove [package names] Tcl] { - foreach v [package versions $pkg] { - interp eval $slave [list package ifneeded $pkg $v \ - [package ifneeded $pkg $v]] - } - } -} - -## ::tkcon::InitInterp - inits an interpreter by placing key -## procs and aliases in it. -# ARGS: name - interp name -# type - interp type (slave|interp) -## -proc ::tkcon::InitInterp {name type} { - variable OPT - variable PRIV - - ## Don't allow messing up a local master interpreter - if {[string match namespace $type] || ([string match slave $type] && \ - [regexp {^([Mm]ain|Slave[0-9]+)$} $name])} return - set old [Attach] - set oldname $PRIV(namesp) - catch { - Attach $name $type - EvalAttached { catch {rename ::puts ::tkcon_tcl_puts} } - foreach cmd $PRIV(slaveprocs) { EvalAttached [dump proc $cmd] } - switch -exact $type { - slave { - foreach cmd $PRIV(slavealias) { - Main interp alias $name ::$cmd $PRIV(name) ::$cmd - } - } - interp { - set thistkcon [::send::appname] - foreach cmd $PRIV(slavealias) { - EvalAttached "proc $cmd args { ::send::send [list $thistkcon] $cmd \$args }" - } - } - } - ## Catch in case it's a 7.4 (no 'interp alias') interp - EvalAttached { - catch {interp alias {} ::ls {} ::dir -full} - if {[catch {interp alias {} ::puts {} ::tkcon_puts}]} { - catch {rename ::tkcon_puts ::puts} - } - } - if {$OPT(gets) != ""} { - EvalAttached { - catch {rename ::gets ::tkcon_tcl_gets} - if {[catch {interp alias {} ::gets {} ::tkcon_gets}]} { - catch {rename ::tkcon_gets ::gets} - } - } - } - return - } {err} - eval Attach $old - AttachNamespace $oldname - if {[string compare {} $err]} { return -code error $err } -} - -## ::tkcon::InitUI - inits UI portion (console) of tkcon -## Creates all elements of the console window and sets up the text tags -# ARGS: root - widget pathname of the tkcon console root -# title - title for the console root and main (.) windows -# Calls: ::tkcon::InitMenus, ::tkcon::Prompt -## -proc ::tkcon::InitUI {title} { - variable OPT - variable PRIV - variable COLOR - - set root $PRIV(root) - if {[string match . $root]} { set w {} } else { set w [toplevel $root] } - if {!$PRIV(WWW)} { - wm withdraw $root - wm protocol $root WM_DELETE_WINDOW $PRIV(protocol) - } - set PRIV(base) $w - - catch {font create tkconfixed -family Courier -size -12} - catch {font create tkconfixedbold -family Courier -size -12 -weight bold} - - set PRIV(statusbar) [set sbar [frame $w.fstatus]] - set PRIV(tabframe) [frame $sbar.tabs] - set PRIV(X) [button $sbar.deltab -text "X" -command ::tkcon::DeleteTab \ - -activeforeground red -fg red -font tkconfixedbold \ - -highlightthickness 0 -padx 2 -pady 0 -bd 1 \ - -state disabled -relief flat] - catch {$PRIV(X) configure -overrelief raised} - label $sbar.cursor -relief sunken -bd 1 -anchor e -width 6 \ - -textvariable ::tkcon::PRIV(StatusCursor) - set padx [expr {![info exists ::tcl_platform(os)] - || ![string match "Windows CE" $::tcl_platform(os)]}] - grid $PRIV(X) $PRIV(tabframe) $sbar.cursor -sticky news -padx $padx - grid configure $PRIV(tabframe) -sticky nsw - grid configure $PRIV(X) -pady 0 -padx 0 - grid columnconfigure $sbar 1 -weight 1 - grid rowconfigure $sbar 0 -weight 1 - grid rowconfigure $PRIV(tabframe) 0 -weight 1 - if {$::tcl_version >= 8.4 && [tk windowingsystem] == "aqua"} { - # give space for the corner resize handle - grid columnconfigure $sbar [lindex [grid size $sbar] 0] -minsize 20 - } - - ## Create console tab - set con [InitTab $w] - set PRIV(curtab) $con - - # Only apply this for the first console - $con configure -setgrid 1 -width $OPT(cols) -height $OPT(rows) - bind $PRIV(root) <Configure> { - if {"%W" == $::tkcon::PRIV(root)} { - scan [wm geometry [winfo toplevel %W]] "%%dx%%d" \ - ::tkcon::OPT(cols) ::tkcon::OPT(rows) - if {[info exists ::tkcon::EXP(spawn_id)]} { - catch {stty rows $::tkcon::OPT(rows) columns \ - $::tkcon::OPT(cols) < $::tkcon::EXP(slave,name)} - } - } - } - - # scrollbar - set sy [scrollbar $w.sy -takefocus 0 -bd 1 -command [list $con yview]] - if {!$PRIV(WWW) && [string match "Windows CE" $::tcl_platform(os)]} { - $w.sy configure -width 10 - } - - $con configure -yscrollcommand [list $sy set] - set PRIV(console) $con - set PRIV(scrolly) $sy - - ## Menus - ## catch against use in plugin - if {[catch {menu $w.mbar} PRIV(menubar)]} { - set PRIV(menubar) [frame $w.mbar -relief raised -bd 1] - } - - InitMenus $PRIV(menubar) $title - Bindings - - if {$OPT(showmenu)} { - $root configure -menu $PRIV(menubar) - } - - grid $con -row 1 -column 1 -sticky news - grid $sy -row 1 -column [expr {$OPT(scrollypos)=="left"?0:2}] -sticky ns - grid $sbar -row 2 -column 0 -columnspan 3 -sticky ew - - grid columnconfigure $root 1 -weight 1 - grid rowconfigure $root 1 -weight 1 - - if {!$OPT(showstatusbar)} { - grid remove $sbar - } - - if {!$PRIV(WWW)} { - wm title $root "tkcon $PRIV(version) $title" - if {$PRIV(showOnStartup)} { wm deiconify $root } - } - if {$PRIV(showOnStartup)} { focus -force $PRIV(console) } - if {$OPT(gc-delay)} { - after $OPT(gc-delay) ::tkcon::GarbageCollect - } -} - -proc ::tkcon::InitTab {w} { - variable OPT - variable PRIV - variable COLOR - variable ATTACH - - # text console - set con $w.tab[incr PRIV(uid)] - text $con -wrap char -foreground $COLOR(stdin) \ - -insertbackground $COLOR(cursor) - $con mark set output 1.0 - $con mark set limit 1.0 - if {[string compare {} $COLOR(bg)]} { - $con configure -background $COLOR(bg) - } - set COLOR(bg) [$con cget -background] - if {[string compare {} $OPT(font)]} { - ## Set user-requested font, if any - $con configure -font $OPT(font) - } elseif {[string compare unix $::tcl_platform(platform)]} { - ## otherwise make sure the font is monospace - set font [$con cget -font] - if {![font metrics $font -fixed]} { - $con configure -font tkconfixed - } - } else { - $con configure -font tkconfixed - } - set OPT(font) [$con cget -font] - bindtags $con [list $con TkConsole TkConsolePost $PRIV(root) all] - - # scrollbar - if {!$PRIV(WWW)} { - if {[string match "Windows CE" $::tcl_platform(os)]} { - font configure tkconfixed -family Tahoma -size 8 - $con configure -font tkconfixed -bd 0 -padx 0 -pady 0 - set cw [font measure tkconfixed "0"] - set ch [font metrics tkconfixed -linespace] - set sw [winfo screenwidth $con] - set sh [winfo screenheight $con] - # We need the magic hard offsets until I find a way to - # correctly assume size - if {$cw*($OPT(cols)+2) > $sw} { - set OPT(cols) [expr {($sw / $cw) - 2}] - } - if {$ch*($OPT(rows)+3) > $sh} { - set OPT(rows) [expr {($sh / $ch) - 3}] - } - # Place it so that the titlebar underlaps the CE titlebar - wm geometry $PRIV(root) +0+0 - } - } - $con configure -height $OPT(rows) -width $OPT(cols) - - foreach col {prompt stdout stderr stdin proc} { - $con tag configure $col -foreground $COLOR($col) - } - $con tag configure var -background $COLOR(var) - $con tag raise sel - $con tag configure blink -background $COLOR(blink) - $con tag configure find -background $COLOR(blink) - - set ATTACH($con) [Attach] - set rb [radiobutton $PRIV(tabframe).cb[winfo name $con] \ - -textvariable ::tkcon::ATTACH($con) \ - -selectcolor white -relief sunken \ - -indicatoron 0 -padx 0 -pady 0 -bd 1 \ - -variable ::tkcon::PRIV(curtab) -value $con \ - -command [list ::tkcon::GotoTab $con]] - if {$::tcl_version >= 8.4} { - $rb configure -offrelief flat -overrelief raised - } - grid $rb -row 0 -column [lindex [grid size $PRIV(tabframe)] 0] -sticky ns - grid $con -row 1 -column 1 -sticky news - - lappend PRIV(tabs) $con - return $con -} - -proc ::tkcon::GotoTab {con} { - variable PRIV - variable ATTACH - - set numtabs [llength $PRIV(tabs)] - #if {$numtabs == 1} { return } - - if {[regexp {^[0-9]+$} $con]} { - set curtab [lsearch -exact $PRIV(tabs) $PRIV(console)] - set nexttab [expr {$curtab + $con}] - if {$nexttab >= $numtabs} { - set nexttab 0 - } elseif {$nexttab < 0} { - set nexttab "end" - } - set con [lindex $PRIV(tabs) $nexttab] - } elseif {$con == $PRIV(console)} { - return - } - - # adjust console - if {[winfo exists $PRIV(console)]} { - lower $PRIV(console) - $PRIV(console) configure -yscrollcommand {} - set ATTACH($PRIV(console)) [Attach] - } - set PRIV(console) $con - $con configure -yscrollcommand [list $PRIV(scrolly) set] - $PRIV(scrolly) configure -command [list $con yview] - - # adjust attach - eval [linsert $ATTACH($con) 0 Attach] - - set PRIV(curtab) $con - - raise $con - - if {[$con compare 1.0 == end-1c]} { - Prompt - } - - # set StatusCursor - set PRIV(StatusCursor) [$con index insert] - - focus -force $con -} - -proc ::tkcon::NewTab {{con {}}} { - variable PRIV - variable ATTACH - - set con [InitTab $PRIV(base)] - set slave [interp create Slave[GetSlaveNum]] - InitSlave $slave - $slave alias exit ::tkcon::DeleteTab $con $slave - set ATTACH($con) [list $slave slave] - $PRIV(X) configure -state normal - MenuConfigure Console "Delete Tab" -state normal - GotoTab $con -} - -proc ::tkcon::DeleteTab {{con {}} {slave {}}} { - variable PRIV - - set numtabs [llength $PRIV(tabs)] - if {$numtabs <= 2} { - $PRIV(X) configure -state disabled - MenuConfigure Console "Delete Tab" -state disabled - } - if {$numtabs == 1} { - # in the master, it should do the right thing - # currently the first master still exists - need rearch to fix - exit - # we might end up here, depending on how exit is rerouted - return - } - - if {$con == ""} { - set con $PRIV(console) - } - catch {unset ATTACH($con)} - set curtab [lsearch -exact $PRIV(tabs) $con] - set PRIV(tabs) [lreplace $PRIV(tabs) $curtab $curtab] - - set numtabs [llength $PRIV(tabs)] - set nexttab $curtab - if {$nexttab >= $numtabs} { - set nexttab end - } - set nexttab [lindex $PRIV(tabs) $nexttab] - - GotoTab $nexttab - - if {$slave != "" && $slave != $::tkcon::OPT(exec)} { - interp delete $slave - } - destroy $PRIV(tabframe).cb[winfo name $con] - destroy $con -} - -## ::tkcon::GarbageCollect - do various cleanup ops periodically to our setup -## -proc ::tkcon::GarbageCollect {} { - variable OPT - variable PRIV - - foreach w $PRIV(tabs) { - if {[winfo exists $w]} { - ## Remove error tags that no longer span anything - ## Make sure the tag pattern matches the unique tag prefix - foreach tag [$w tag names] { - if {[string match _tag* $tag] - && ![llength [$w tag ranges $tag]]} { - $w tag delete $tag - } - } - } - } - if {$OPT(gc-delay)} { - after $OPT(gc-delay) ::tkcon::GarbageCollect - } -} - -## ::tkcon::Eval - evaluates commands input into console window -## This is the first stage of the evaluating commands in the console. -## They need to be broken up into consituent commands (by ::tkcon::CmdSep) in -## case a multiple commands were pasted in, then each is eval'ed (by -## ::tkcon::EvalCmd) in turn. Any uncompleted command will not be eval'ed. -# ARGS: w - console text widget -# Calls: ::tkcon::CmdGet, ::tkcon::CmdSep, ::tkcon::EvalCmd -## -proc ::tkcon::Eval {w} { - set incomplete [CmdSep [CmdGet $w] cmds last] - $w mark set insert end-1c - $w insert end \n - if {[llength $cmds]} { - foreach c $cmds {EvalCmd $w $c} - $w insert insert $last {} - } elseif {!$incomplete} { - EvalCmd $w $last - } - if {[winfo exists $w]} { - $w see insert - } -} - -## ::tkcon::EvalCmd - evaluates a single command, adding it to history -# ARGS: w - console text widget -# cmd - the command to evaluate -# Calls: ::tkcon::Prompt -# Outputs: result of command to stdout (or stderr if error occured) -# Returns: next event number -## -proc ::tkcon::EvalCmd {w cmd} { - variable OPT - variable PRIV - - $w mark set output end - if {[string compare {} $cmd]} { - set code 0 - if {$OPT(subhistory)} { - set ev [EvalSlave history nextid] - incr ev -1 - if {[string match !! $cmd]} { - set code [catch {EvalSlave history event $ev} cmd] - if {!$code} {$w insert output $cmd\n stdin} - } elseif {[regexp {^!(.+)$} $cmd dummy event]} { - ## Check last event because history event is broken - set code [catch {EvalSlave history event $ev} cmd] - if {!$code && ![string match ${event}* $cmd]} { - set code [catch {EvalSlave history event $event} cmd] - } - if {!$code} {$w insert output $cmd\n stdin} - } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $cmd dummy old new]} { - set code [catch {EvalSlave history event $ev} cmd] - if {!$code} { - regsub -all -- $old $cmd $new cmd - $w insert output $cmd\n stdin - } - } elseif {$OPT(calcmode) && ![catch {expr $cmd} err]} { - AddSlaveHistory $cmd - set cmd $err - set code -1 - } - } - if {$code} { - $w insert output $cmd\n stderr - } else { - ## We are about to evaluate the command, so move the limit - ## mark to ensure that further <Return>s don't cause double - ## evaluation of this command - for cases like the command - ## has a vwait or something in it - $w mark set limit end - if {$OPT(nontcl) && [string match interp $PRIV(apptype)]} { - set code [catch {EvalSend $cmd} res] - if {$code == 1} { - set PRIV(errorInfo) "Non-Tcl errorInfo not available" - } - } elseif {[string match socket $PRIV(apptype)]} { - set code [catch {EvalSocket $cmd} res] - if {$code == 1} { - set PRIV(errorInfo) "Socket-based errorInfo not available" - } - } else { - set code [catch {EvalAttached $cmd} res] - if {$code == 1} { - if {[catch {EvalAttached [list set errorInfo]} err]} { - set PRIV(errorInfo) "Error getting errorInfo:\n$err" - } else { - set PRIV(errorInfo) $err - } - } - } - if {![winfo exists $w]} { - # early abort - must be a deleted tab - return - } - AddSlaveHistory $cmd - catch {EvalAttached [list set _ $res]} - if {$code} { - if {$OPT(hoterrors)} { - set tag [UniqueTag $w] - $w insert output $res [list stderr $tag] \n stderr - $w tag bind $tag <Enter> \ - [list $w tag configure $tag -under 1] - $w tag bind $tag <Leave> \ - [list $w tag configure $tag -under 0] - $w tag bind $tag <ButtonRelease-1> \ - "if {!\[info exists tkPriv(mouseMoved)\] || !\$tkPriv(mouseMoved)} \ - {[list $OPT(edit) -attach [Attach] -type error -- $PRIV(errorInfo)]}" - } else { - $w insert output $res\n stderr - } - } elseif {[string compare {} $res]} { - $w insert output $res\n stdout - } - } - } - Prompt - set PRIV(event) [EvalSlave history nextid] -} - -## ::tkcon::EvalSlave - evaluates the args in the associated slave -## args should be passed to this procedure like they would be at -## the command line (not like to 'eval'). -# ARGS: args - the command and args to evaluate -## -proc ::tkcon::EvalSlave args { - interp eval $::tkcon::OPT(exec) $args -} - -## ::tkcon::EvalOther - evaluate a command in a foreign interp or slave -## without attaching to it. No check for existence is made. -# ARGS: app - interp/slave name -# type - (slave|interp) -## -proc ::tkcon::EvalOther { app type args } { - if {[string compare slave $type]==0} { - return [Slave $app $args] - } else { - return [uplevel 1 ::send::send [list $app] $args] - } -} - -## ::tkcon::AddSlaveHistory - -## Command is added to history only if different from previous command. -## This also doesn't cause the history id to be incremented, although the -## command will be evaluated. -# ARGS: cmd - command to add -## -proc ::tkcon::AddSlaveHistory cmd { - set ev [EvalSlave history nextid] - incr ev -1 - set code [catch {EvalSlave history event $ev} lastCmd] - if {$code || [string compare $cmd $lastCmd]} { - EvalSlave history add $cmd - } -} - -## ::tkcon::EvalSend - sends the args to the attached interpreter -## Varies from 'send' by determining whether attachment is dead -## when an error is received -# ARGS: cmd - the command string to send across -# Returns: the result of the command -## -proc ::tkcon::EvalSend cmd { - variable OPT - variable PRIV - - if {$PRIV(deadapp)} { - if {[lsearch -exact [::send::interps] $PRIV(app)]<0} { - return - } else { - set PRIV(appname) [string range $PRIV(appname) 5 end] - set PRIV(deadapp) 0 - Prompt "\n\"$PRIV(app)\" alive\n" [CmdGet $PRIV(console)] - } - } - set code [catch {::send::send -displayof $PRIV(displayWin) $PRIV(app) $cmd} result] - if {$code && [lsearch -exact [::send::interps] $PRIV(app)]<0} { - ## Interpreter disappeared - if {[string compare leave $OPT(dead)] && \ - ([string match ignore $OPT(dead)] || \ - [tk_messageBox -title "Dead Attachment" -type yesno \ - -icon info -message \ - "\"$PRIV(app)\" appears to have died.\ - \nReturn to primary slave interpreter?"]=="no")} { - set PRIV(appname) "DEAD:$PRIV(appname)" - set PRIV(deadapp) 1 - } else { - set err "Attached Tk interpreter \"$PRIV(app)\" died." - Attach {} - set PRIV(deadapp) 0 - EvalSlave set errorInfo $err - } - Prompt \n [CmdGet $PRIV(console)] - } - return -code $code $result -} - -## ::tkcon::EvalSocket - sends the string to an interpreter attached via -## a tcp/ip socket -## -## In the EvalSocket case, ::tkcon::PRIV(app) is the socket id -## -## Must determine whether socket is dead when an error is received -# ARGS: cmd - the data string to send across -# Returns: the result of the command -## -proc ::tkcon::EvalSocket cmd { - variable OPT - variable PRIV - global tcl_version - - if {$PRIV(deadapp)} { - if {![info exists PRIV(app)] || \ - [catch {eof $PRIV(app)} eof] || $eof} { - return - } else { - set PRIV(appname) [string range $PRIV(appname) 5 end] - set PRIV(deadapp) 0 - Prompt "\n\"$PRIV(app)\" alive\n" [CmdGet $PRIV(console)] - } - } - # Sockets get \'s interpreted, so that users can - # send things like \n\r or explicit hex values - set cmd [subst -novariables -nocommands $cmd] - #puts [list $PRIV(app) $cmd] - set code [catch {puts $PRIV(app) $cmd ; flush $PRIV(app)} result] - if {$code && [eof $PRIV(app)]} { - ## Interpreter died or disappeared - puts "$code eof [eof $PRIV(app)]" - EvalSocketClosed - } - return -code $code $result -} - -## ::tkcon::EvalSocketEvent - fileevent command for an interpreter attached -## via a tcp/ip socket -## Must determine whether socket is dead when an error is received -# ARGS: args - the args to send across -# Returns: the result of the command -## -proc ::tkcon::EvalSocketEvent {sock} { - variable PRIV - - if {[gets $sock line] == -1} { - if {[eof $sock]} { - EvalSocketClosed $sock - } - return - } - puts $line -} - -## ::tkcon::EvalSocketClosed - takes care of handling a closed eval socket -## -# ARGS: args - the args to send across -# Returns: the result of the command -## -proc ::tkcon::EvalSocketClosed {sock} { - variable OPT - variable PRIV - - catch {close $sock} - if {![string match $sock $PRIV(app)]} { - # If we are not still attached to that socket, just return. - # Might be nice to tell the user the socket closed ... - return - } - if {[string compare leave $OPT(dead)] && \ - ([string match ignore $OPT(dead)] || \ - [tk_messageBox -title "Dead Attachment" -type yesno \ - -icon question \ - -message "\"$PRIV(app)\" appears to have died.\ - \nReturn to primary slave interpreter?"] == "no")} { - set PRIV(appname) "DEAD:$PRIV(appname)" - set PRIV(deadapp) 1 - } else { - set err "Attached Tk interpreter \"$PRIV(app)\" died." - Attach {} - set PRIV(deadapp) 0 - EvalSlave set errorInfo $err - } - Prompt \n [CmdGet $PRIV(console)] -} - -## ::tkcon::EvalNamespace - evaluates the args in a particular namespace -## This is an override for ::tkcon::EvalAttached for when the user wants -## to attach to a particular namespace of the attached interp -# ARGS: attached -# namespace the namespace to evaluate in -# args the args to evaluate -# RETURNS: the result of the command -## -proc ::tkcon::EvalNamespace { attached namespace args } { - if {[llength $args]} { - uplevel \#0 $attached \ - [list [concat [list namespace eval $namespace] $args]] - } -} - - -## ::tkcon::Namespaces - return all the namespaces descendent from $ns -## -# -## -proc ::tkcon::Namespaces {{ns ::} {l {}}} { - if {[string compare {} $ns]} { lappend l $ns } - foreach i [EvalAttached [list namespace children $ns]] { - set l [Namespaces $i $l] - } - return $l -} - -## ::tkcon::CmdGet - gets the current command from the console widget -# ARGS: w - console text widget -# Returns: text which compromises current command line -## -proc ::tkcon::CmdGet w { - if {![llength [$w tag nextrange prompt limit end]]} { - $w tag add stdin limit end-1c - return [$w get limit end-1c] - } -} - -## ::tkcon::CmdSep - separates multiple commands into a list and remainder -# ARGS: cmd - (possible) multiple command to separate -# list - varname for the list of commands that were separated. -# last - varname of any remainder (like an incomplete final command). -# If there is only one command, it's placed in this var. -# Returns: constituent command info in varnames specified by list & rmd. -## -proc ::tkcon::CmdSep {cmd list last} { - upvar 1 $list cmds $last inc - set inc {} - set cmds {} - foreach c [split [string trimleft $cmd] \n] { - if {[string compare $inc {}]} { - append inc \n$c - } else { - append inc [string trimleft $c] - } - if {[info complete $inc] && ![regexp {[^\\]\\$} $inc]} { - if {[regexp "^\[^#\]" $inc]} {lappend cmds $inc} - set inc {} - } - } - set i [string compare $inc {}] - if {!$i && [string compare $cmds {}] && ![string match *\n $cmd]} { - set inc [lindex $cmds end] - set cmds [lreplace $cmds end end] - } - return $i -} - -## ::tkcon::CmdSplit - splits multiple commands into a list -# ARGS: cmd - (possible) multiple command to separate -# Returns: constituent commands in a list -## -proc ::tkcon::CmdSplit {cmd} { - set inc {} - set cmds {} - foreach cmd [split [string trimleft $cmd] \n] { - if {[string compare {} $inc]} { - append inc \n$cmd - } else { - append inc [string trimleft $cmd] - } - if {[info complete $inc] && ![regexp {[^\\]\\$} $inc]} { - #set inc [string trimright $inc] - if {[regexp "^\[^#\]" $inc]} {lappend cmds $inc} - set inc {} - } - } - if {[regexp "^\[^#\]" $inc]} {lappend cmds $inc} - return $cmds -} - -## ::tkcon::UniqueTag - creates a uniquely named tag, reusing names -## Called by ::tkcon::EvalCmd -# ARGS: w - text widget -# Outputs: tag name guaranteed unique in the widget -## -proc ::tkcon::UniqueTag {w} { - set tags [$w tag names] - set idx 0 - while {[lsearch -exact $tags _tag[incr idx]] != -1} {} - return _tag$idx -} - -## ::tkcon::ConstrainBuffer - This limits the amount of data in the text widget -## Called by ::tkcon::Prompt and in tkcon proc buffer/console switch cases -# ARGS: w - console text widget -# size - # of lines to constrain to -# Outputs: may delete data in console widget -## -proc ::tkcon::ConstrainBuffer {w size} { - if {[$w index end] > $size} { - $w delete 1.0 [expr {int([$w index end])-$size}].0 - } -} - -## ::tkcon::Prompt - displays the prompt in the console widget -# ARGS: w - console text widget -# Outputs: prompt (specified in ::tkcon::OPT(prompt1)) to console -## -proc ::tkcon::Prompt {{pre {}} {post {}} {prompt {}}} { - variable OPT - variable PRIV - - set w $PRIV(console) - if {![winfo exists $w]} { return } - if {[string compare {} $pre]} { $w insert end $pre stdout } - set i [$w index end-1c] - if {!$OPT(showstatusbar)} { - if {[string compare {} $PRIV(appname)]} { - $w insert end ">$PRIV(appname)< " prompt - } - if {[string compare :: $PRIV(namesp)]} { - $w insert end "<$PRIV(namesp)> " prompt - } - } - if {[string compare {} $prompt]} { - $w insert end $prompt prompt - } else { - $w insert end [EvalSlave subst $OPT(prompt1)] prompt - } - $w mark set output $i - $w mark set insert end - $w mark set limit insert - $w mark gravity limit left - if {[string compare {} $post]} { $w insert end $post stdin } - ConstrainBuffer $w $OPT(buffer) - set ::tkcon::PRIV(StatusCursor) [$w index insert] - $w see end -} -proc ::tkcon::RePrompt {{pre {}} {post {}} {prompt {}}} { - # same as prompt, but does nothing for those actions where we - # only wanted to refresh the prompt on attach change when the - # statusbar is showing (which carries that info instead) - variable OPT - if {!$OPT(showstatusbar)} { - Prompt $pre $post $prompt - } -} - -## ::tkcon::About - gives about info for tkcon -## -proc ::tkcon::About {} { - variable OPT - variable PRIV - variable COLOR - - set w $PRIV(base).about - if {![winfo exists $w]} { - global tk_patchLevel tcl_patchLevel tcl_version - toplevel $w - wm withdraw $w - wm transient $w $PRIV(root) - wm group $w $PRIV(root) - wm title $w "About tkcon v$PRIV(version)" - button $w.b -text Dismiss -command [list wm withdraw $w] - text $w.text -height 9 -bd 1 -width 60 \ - -foreground $COLOR(stdin) \ - -background $COLOR(bg) \ - -font $OPT(font) - pack $w.b -fill x -side bottom - pack $w.text -fill both -side left -expand 1 - $w.text tag config center -justify center - $w.text tag config title -justify center -font {Courier -18 bold} - # strip down the RCS info displayed in the about box - regexp {,v ([0-9\./: ]*)} $PRIV(RCS) -> RCS - $w.text insert 1.0 "About tkcon v$PRIV(version)" title \ - "\n\nCopyright 1995-2002 Jeffrey Hobbs, $PRIV(email)\ - \nRelease Info: v$PRIV(version), CVS v$RCS\ - \nDocumentation available at:\n$PRIV(docs)\ - \nUsing: Tcl v$tcl_patchLevel / Tk v$tk_patchLevel" center - $w.text config -state disabled - bind $w <Escape> [list destroy $w] - } - wm deiconify $w -} - -## ::tkcon::InitMenus - inits the menubar and popup for the console -# ARGS: w - console text widget -## -proc ::tkcon::InitMenus {w title} { - variable OPT - variable PRIV - variable COLOR - global tcl_platform - - if {[catch {menu $w.pop}]} { - label $w.label -text "Menus not available in plugin mode" - grid $w.label -sticky ew - return - } - menu $w.context -disabledforeground $COLOR(disabled) - set PRIV(context) $w.context - set PRIV(popup) $w.pop - - proc MenuButton {w m l} { - $w add cascade -label $m -underline 0 -menu $w.$l - return $w.$l - } - proc MenuConfigure {m l args} { - variable PRIV - eval [list $PRIV(menubar).[string tolower $m] entryconfigure $l] $args - eval [list $PRIV(popup).[string tolower $m] entryconfigure $l] $args - } - - foreach m [list File Console Edit Interp Prefs History Help] { - set l [string tolower $m] - MenuButton $w $m $l - $w.pop add cascade -label $m -underline 0 -menu $w.pop.$l - } - - ## File Menu - ## - foreach m [list [menu $w.file -disabledforeground $COLOR(disabled)] \ - [menu $w.pop.file -disabledforeground $COLOR(disabled)]] { - $m add command -label "Load File" -underline 0 -command ::tkcon::Load - $m add cascade -label "Save ..." -underline 0 -menu $m.save - $m add separator - $m add command -label "Quit" -underline 0 -accel Ctrl-q -command exit - - ## Save Menu - ## - set s $m.save - menu $s -disabledforeground $COLOR(disabled) - $s add command -label "All" -underline 0 \ - -command {::tkcon::Save {} all} - $s add command -label "History" -underline 0 \ - -command {::tkcon::Save {} history} - $s add command -label "Stdin" -underline 3 \ - -command {::tkcon::Save {} stdin} - $s add command -label "Stdout" -underline 3 \ - -command {::tkcon::Save {} stdout} - $s add command -label "Stderr" -underline 3 \ - -command {::tkcon::Save {} stderr} - } - - ## Console Menu - ## - foreach m [list [menu $w.console -disabledfore $COLOR(disabled)] \ - [menu $w.pop.console -disabledfore $COLOR(disabled)]] { - $m add command -label "$title Console" -state disabled - $m add command -label "New Console" -underline 0 -accel Ctrl-N \ - -command ::tkcon::New - $m add command -label "New Tab" -underline 4 -accel Ctrl-T \ - -command ::tkcon::NewTab - $m add command -label "Delete Tab" -underline 0 \ - -command ::tkcon::DeleteTab -state disabled - $m add command -label "Close Console" -underline 0 -accel Ctrl-w \ - -command ::tkcon::Destroy - $m add command -label "Clear Console" -underline 1 -accel Ctrl-l \ - -command { tkconclear; ::tkcon::Prompt } - if {[string match unix $tcl_platform(platform)]} { - $m add separator - $m add command -label "Make Xauth Secure" -und 5 \ - -command ::tkcon::XauthSecure - } - $m add separator - $m add cascade -label "Attach To ..." -underline 0 -menu $m.attach - - ## Attach Console Menu - ## - set sub [menu $m.attach -disabledforeground $COLOR(disabled)] - $sub add cascade -label "Interpreter" -underline 0 -menu $sub.apps - $sub add cascade -label "Namespace" -underline 0 -menu $sub.name - - ## Attach Console Menu - ## - menu $sub.apps -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::AttachMenu $sub.apps] - - ## Attach Namespace Menu - ## - menu $sub.name -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::NamespaceMenu $sub.name] - - if {$::tcl_version >= 8.3} { - ## Attach Socket Menu - ## - # This uses [file channels] to create the menu, so we only - # want it for newer versions of Tcl. - $sub add cascade -label "Socket" -underline 0 -menu $sub.sock - menu $sub.sock -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::SocketMenu $sub.sock] - } - - if {![string compare "unix" $tcl_platform(platform)]} { - ## Attach Display Menu - ## - $sub add cascade -label "Display" -underline 0 -menu $sub.disp - menu $sub.disp -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::DisplayMenu $sub.disp] - } - } - - ## Edit Menu - ## - set text $PRIV(console) - foreach m [list [menu $w.edit] [menu $w.pop.edit]] { - $m add command -label "Cut" -underline 2 -accel Ctrl-x \ - -command [list ::tkcon::Cut $text] - $m add command -label "Copy" -underline 0 -accel Ctrl-c \ - -command [list ::tkcon::Copy $text] - $m add command -label "Paste" -underline 0 -accel Ctrl-v \ - -command [list ::tkcon::Paste $text] - $m add separator - $m add command -label "Find" -underline 0 -accel Ctrl-F \ - -command [list ::tkcon::FindBox $text] - } - - ## Interp Menu - ## - foreach m [list $w.interp $w.pop.interp] { - menu $m -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::InterpMenu $m] - } - - ## Prefs Menu - ## - foreach m [list [menu $w.prefs] [menu $w.pop.prefs]] { - $m add check -label "Brace Highlighting" \ - -underline 0 -variable ::tkcon::OPT(lightbrace) - $m add check -label "Command Highlighting" \ - -underline 0 -variable ::tkcon::OPT(lightcmd) - $m add check -label "History Substitution" \ - -underline 0 -variable ::tkcon::OPT(subhistory) - $m add check -label "Hot Errors" \ - -underline 4 -variable ::tkcon::OPT(hoterrors) - $m add check -label "Non-Tcl Attachments" \ - -underline 0 -variable ::tkcon::OPT(nontcl) - $m add check -label "Calculator Mode" \ - -underline 1 -variable ::tkcon::OPT(calcmode) - $m add check -label "Show Multiple Matches" \ - -underline 0 -variable ::tkcon::OPT(showmultiple) - $m add check -label "Show Menubar" \ - -underline 5 -variable ::tkcon::OPT(showmenu) \ - -command {$::tkcon::PRIV(root) configure -menu [expr \ - {$::tkcon::OPT(showmenu) ? $::tkcon::PRIV(menubar) : {}}]} - $m add check -label "Show Statusbar" \ - -underline 5 -variable ::tkcon::OPT(showstatusbar) \ - -command { - if {$::tkcon::OPT(showstatusbar)} { - grid $::tkcon::PRIV(statusbar) - } else { grid remove $::tkcon::PRIV(statusbar) } - } - $m add cascade -label "Scrollbar" -underline 2 -menu $m.scroll - - ## Scrollbar Menu - ## - set m [menu $m.scroll] - $m add radio -label "Left" -value left \ - -variable ::tkcon::OPT(scrollypos) \ - -command { grid configure $::tkcon::PRIV(scrolly) -column 0 } - $m add radio -label "Right" -value right \ - -variable ::tkcon::OPT(scrollypos) \ - -command { grid configure $::tkcon::PRIV(scrolly) -column 2 } - } - - ## History Menu - ## - foreach m [list $w.history $w.pop.history] { - menu $m -disabledforeground $COLOR(disabled) \ - -postcommand [list ::tkcon::HistoryMenu $m] - } - - ## Help Menu - ## - foreach m [list [menu $w.help] [menu $w.pop.help]] { - $m add command -label "About " -underline 0 -accel Ctrl-A \ - -command ::tkcon::About - $m add command -label "Retrieve Latest Version" -underline 0 \ - -command ::tkcon::Retrieve - } -} - -## ::tkcon::HistoryMenu - dynamically build the menu for attached interpreters -## -# ARGS: m - menu widget -## -proc ::tkcon::HistoryMenu m { - variable PRIV - - if {![winfo exists $m]} return - set id [EvalSlave history nextid] - if {$PRIV(histid)==$id} return - set PRIV(histid) $id - $m delete 0 end - while {($id>1) && ($id>$PRIV(histid)-10) && \ - ![catch {EvalSlave history event [incr id -1]} tmp]} { - set lbl $tmp - if {[string len $lbl]>32} { set lbl [string range $tmp 0 28]... } - $m add command -label "$id: $lbl" -command " - $::tkcon::PRIV(console) delete limit end - $::tkcon::PRIV(console) insert limit [list $tmp] - $::tkcon::PRIV(console) see end - ::tkcon::Eval $::tkcon::PRIV(console)" - } -} - -## ::tkcon::InterpMenu - dynamically build the menu for attached interpreters -## -# ARGS: w - menu widget -## -proc ::tkcon::InterpMenu w { - variable OPT - variable PRIV - variable COLOR - - if {![winfo exists $w]} return - $w delete 0 end - foreach {app type} [Attach] break - $w add command -label "[string toupper $type]: $app" -state disabled - if {($OPT(nontcl) && [string match interp $type]) || $PRIV(deadapp)} { - $w add separator - $w add command -state disabled -label "Communication disabled to" - $w add command -state disabled -label "dead or non-Tcl interps" - return - } - - ## Show Last Error - ## - $w add separator - $w add command -label "Show Last Error" \ - -command [list tkcon error $app $type] - - ## Packages Cascaded Menu - ## - $w add separator - $w add command -label "Manage Packages" -underline 0 \ - -command [list ::tkcon::InterpPkgs $app $type] - - ## State Checkpoint/Revert - ## - $w add separator - $w add command -label "Checkpoint State" \ - -command [list ::tkcon::StateCheckpoint $app $type] - $w add command -label "Revert State" \ - -command [list ::tkcon::StateRevert $app $type] - $w add command -label "View State Change" \ - -command [list ::tkcon::StateCompare $app $type] - - ## Init Interp - ## - $w add separator - $w add command -label "Send tkcon Commands" \ - -command [list ::tkcon::InitInterp $app $type] -} - -## ::tkcon::PkgMenu - fill in in the applications sub-menu -## with a list of all the applications that currently exist. -## -proc ::tkcon::InterpPkgs {app type} { - variable PRIV - - set t $PRIV(base).interppkgs - if {![winfo exists $t]} { - toplevel $t - wm withdraw $t - wm title $t "$app Packages" - wm transient $t $PRIV(root) - wm group $t $PRIV(root) - bind $t <Escape> [list destroy $t] - - label $t.ll -text "Loadable:" -anchor w - label $t.lr -text "Loaded:" -anchor w - listbox $t.loadable -bg white -bd 1 -font tkconfixed \ - -yscrollcommand [list $t.llsy set] -selectmode extended - listbox $t.loaded -bg white -bd 1 -font tkconfixed \ - -yscrollcommand [list $t.lrsy set] - scrollbar $t.llsy -bd 1 -command [list $t.loadable yview] - scrollbar $t.lrsy -bd 1 -command [list $t.loaded yview] - button $t.load -bd 1 -text ">>" \ - -command [list ::tkcon::InterpPkgLoad $app $type $t.loadable] - if {$::tcl_version >= 8.4} { - $t.load configure -relief flat -overrelief raised - } - - set f [frame $t.btns] - button $f.refresh -width 8 -text "Refresh" -command [info level 0] - button $f.dismiss -width 8 -text "Dismiss" -command [list destroy $t] - grid $f.refresh $f.dismiss -padx 4 -pady 3 -sticky ew - - grid $t.ll x x $t.lr x -sticky ew - grid $t.loadable $t.llsy $t.load $t.loaded $t.lrsy -sticky news - grid $t.btns -sticky e -columnspan 5 - grid columnconfigure $t {0 3} -weight 1 - grid rowconfigure $t 1 -weight 1 - grid configure $t.load -sticky "" - - bind $t.loadable <Double-1> "[list $t.load invoke]; break" - } - $t.loaded delete 0 end - $t.loadable delete 0 end - - # just in case stuff has been added to the auto_path - # we have to make sure that the errorInfo doesn't get screwed up - EvalAttached { - set __tkcon_error $errorInfo - catch {package require bogus-package-name} - set errorInfo ${__tkcon_error} - unset __tkcon_error - } - # get all packages loaded into current interp - foreach pkg [EvalAttached [list info loaded {}]] { - set pkg [lindex $pkg 1] - set loaded($pkg) [package provide $pkg] - } - # get all package names currently visible - foreach pkg [lremove [EvalAttached {package names}] Tcl] { - set version [EvalAttached [list package provide $pkg]] - if {[string compare {} $version]} { - set loaded($pkg) $version - } elseif {![info exists loaded($pkg)]} { - set loadable($pkg) package - } - } - # get packages that are loaded in any interp - foreach pkg [EvalAttached {info loaded}] { - set pkg [lindex $pkg 1] - if {![info exists loaded($pkg)] && ![info exists loadable($pkg)]} { - set loadable($pkg) load - } - } - foreach pkg [lsort -dictionary [array names loadable]] { - foreach v [EvalAttached [list package version $pkg]] { - $t.loadable insert end [list $pkg $v "($loadable($pkg))"] - } - } - foreach pkg [lsort -dictionary [array names loaded]] { - $t.loaded insert end [list $pkg $loaded($pkg)] - } - - wm deiconify $t - raise $t -} - -proc ::tkcon::InterpPkgLoad {app type lb} { - # load the lb entry items into the interp - foreach sel [$lb curselection] { - foreach {pkg ver method} [$lb get $sel] { break } - if {$method == "(package)"} { - set code [catch {::tkcon::EvalOther $app $type \ - package require $pkg $ver} msg] - } elseif {$method == "(load)"} { - set code [catch {::tkcon::EvalOther $app $type load {} $pkg} msg] - } else { - set code 1 - set msg "Incorrect entry in Loadable selection" - } - if {$code} { - tk_messageBox -icon error -title "Error requiring $pkg" -type ok \ - -message "Error requiring $pkg $ver:\n$msg\n$::errorInfo" - } - } - # refresh package list - InterpPkgs $app $type -} - -## ::tkcon::AttachMenu - fill in in the applications sub-menu -## with a list of all the applications that currently exist. -## -proc ::tkcon::AttachMenu m { - variable OPT - variable PRIV - - array set interps [set tmp [Interps]] - foreach {i j} $tmp { set tknames($j) {} } - - $m delete 0 end - set cmd {::tkcon::RePrompt \n [::tkcon::CmdGet $::tkcon::PRIV(console)]} - $m add radio -label {None (use local slave) } -accel Ctrl-1 \ - -variable ::tkcon::PRIV(app) \ - -value [concat $::tkcon::PRIV(name) $::tkcon::OPT(exec)] \ - -command "::tkcon::Attach {}; $cmd" - $m add separator - $m add command -label "Foreign Tk Interpreters" -state disabled - foreach i [lsort [lremove [::send::interps] [array names tknames]]] { - $m add radio -label $i -variable ::tkcon::PRIV(app) -value $i \ - -command "::tkcon::Attach [list $i] interp; $cmd" - } - $m add separator - - $m add command -label "tkcon Interpreters" -state disabled - foreach i [lsort [array names interps]] { - if {[string match {} $interps($i)]} { set interps($i) "no Tk" } - if {[regexp {^Slave[0-9]+} $i]} { - set opts [list -label "$i ($interps($i))" \ - -variable ::tkcon::PRIV(app) -value $i \ - -command "::tkcon::Attach [list $i] slave; $cmd"] - if {[string match $PRIV(name) $i]} { - append opts " -accel Ctrl-2" - } - eval $m add radio $opts - } else { - set name [concat Main $i] - if {[string match Main $name]} { - $m add radio -label "$name ($interps($i))" -accel Ctrl-3 \ - -variable ::tkcon::PRIV(app) -value Main \ - -command "::tkcon::Attach [list $name] slave; $cmd" - } else { - $m add radio -label "$name ($interps($i))" \ - -variable ::tkcon::PRIV(app) -value $i \ - -command "::tkcon::Attach [list $name] slave; $cmd" - } - } - } -} - -## Displays Cascaded Menu -## -proc ::tkcon::DisplayMenu m { - $m delete 0 end - set cmd {::tkcon::RePrompt \n [::tkcon::CmdGet $::tkcon::PRIV(console)]} - - $m add command -label "New Display" -command ::tkcon::NewDisplay - foreach disp [Display] { - $m add separator - $m add command -label $disp -state disabled - set res [Display $disp] - set win [lindex $res 0] - foreach i [lsort [lindex $res 1]] { - $m add radio -label $i -variable ::tkcon::PRIV(app) -value $i \ - -command "::tkcon::Attach [list $i] [list dpy:$win]; $cmd" - } - } -} - -## Sockets Cascaded Menu -## -proc ::tkcon::SocketMenu m { - $m delete 0 end - set cmd {::tkcon::RePrompt \n [::tkcon::CmdGet $::tkcon::PRIV(console)]} - - $m add command -label "Create Connection" \ - -command "::tkcon::NewSocket; $cmd" - foreach sock [file channels sock*] { - $m add radio -label $sock -variable ::tkcon::PRIV(app) -value $sock \ - -command "::tkcon::Attach $sock socket; $cmd" - } -} - -## Namepaces Cascaded Menu -## -proc ::tkcon::NamespaceMenu m { - variable PRIV - variable OPT - - $m delete 0 end - if {($PRIV(deadapp) || [string match socket $PRIV(apptype)] || \ - ($OPT(nontcl) && [string match interp $PRIV(apptype)]))} { - $m add command -label "No Namespaces" -state disabled - return - } - - ## Same command as for ::tkcon::AttachMenu items - set cmd {::tkcon::RePrompt \n [::tkcon::CmdGet $::tkcon::PRIV(console)]} - - set names [lsort [Namespaces ::]] - if {[llength $names] > $OPT(maxmenu)} { - $m add command -label "Attached to $PRIV(namesp)" -state disabled - $m add command -label "List Namespaces" \ - -command [list ::tkcon::NamespacesList $names] - } else { - foreach i $names { - if {[string match :: $i]} { - $m add radio -label "Main" -value $i \ - -variable ::tkcon::PRIV(namesp) \ - -command "::tkcon::AttachNamespace [list $i]; $cmd" - } else { - $m add radio -label $i -value $i \ - -variable ::tkcon::PRIV(namesp) \ - -command "::tkcon::AttachNamespace [list $i]; $cmd" - } - } - } -} - -## Namepaces List -## -proc ::tkcon::NamespacesList {names} { - variable PRIV - - set f $PRIV(base).namespaces - catch {destroy $f} - toplevel $f - listbox $f.names -width 30 -height 15 -selectmode single \ - -yscrollcommand [list $f.scrollv set] \ - -xscrollcommand [list $f.scrollh set] - scrollbar $f.scrollv -command [list $f.names yview] - scrollbar $f.scrollh -command [list $f.names xview] -orient horizontal - frame $f.buttons - button $f.cancel -text "Cancel" -command [list destroy $f] ... [truncated message content] |
From: <ro...@us...> - 2014-08-14 14:43:43
|
Revision: 2191 http://sourceforge.net/p/nsclspectcl/code/2191 Author: ron-fox Date: 2014-08-14 14:43:35 +0000 (Thu, 14 Aug 2014) Log Message: ----------- * Install the tcl 8.5 history since the 8.6 history uses apply which collides with SpecTcl's apply (a problem for another day). * Fix version determination stuff for testBuildTarball so jenkins can get the make dist and build from tarball to work Modified Paths: -------------- branches/SpecTcl-3.4/Makefile.am branches/SpecTcl-3.4/Scripts/tkcon.tcl branches/SpecTcl-3.4/configure.ac branches/SpecTcl-3.4/testBuildTarball branches/SpecTcl-3.4/tkcon/Makefile.am Added Paths: ----------- branches/SpecTcl-3.4/tkcon/history.tcl Modified: branches/SpecTcl-3.4/Makefile.am =================================================================== --- branches/SpecTcl-3.4/Makefile.am 2014-08-14 12:53:34 UTC (rev 2190) +++ branches/SpecTcl-3.4/Makefile.am 2014-08-14 14:43:35 UTC (rev 2191) @@ -23,7 +23,7 @@ bootstrap $(MYGRIDIR) LICENSE \ doc build.cygwin Directories.include CompilationRules.include \ libtcl \ - CHANGELOG + CHANGELOG m4 dist-hook: mkdir -p $(distdir)/config Modified: branches/SpecTcl-3.4/Scripts/tkcon.tcl =================================================================== --- branches/SpecTcl-3.4/Scripts/tkcon.tcl 2014-08-14 12:53:34 UTC (rev 2190) +++ branches/SpecTcl-3.4/Scripts/tkcon.tcl 2014-08-14 14:43:35 UTC (rev 2191) @@ -1,3 +1,4 @@ +package require history 8.5; # 8.6 history relies on apply command. package require tkcon set tkcon::PRIV(showOnStartup) 0 set tkcon::PRIV(root) .console Modified: branches/SpecTcl-3.4/configure.ac =================================================================== --- branches/SpecTcl-3.4/configure.ac 2014-08-14 12:53:34 UTC (rev 2190) +++ branches/SpecTcl-3.4/configure.ac 2014-08-14 14:43:35 UTC (rev 2191) @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(SpecTcl, 3.4-003 ) +AC_INIT(SpecTcl,3.4-003) AC_CONFIG_SRCDIR(SpecTcl/MySpecTclApp.cpp) AC_CONFIG_AUX_DIR(config) Modified: branches/SpecTcl-3.4/testBuildTarball =================================================================== --- branches/SpecTcl-3.4/testBuildTarball 2014-08-14 12:53:34 UTC (rev 2190) +++ branches/SpecTcl-3.4/testBuildTarball 2014-08-14 14:43:35 UTC (rev 2191) @@ -4,7 +4,7 @@ rm -rf ${WORKSPACE}/3.4 amversion=`grep AM_INIT_AUTOMAKE configure.ac | cut -f2 -d" " | sed s/,//` -acversion=`grep AC_INIT configure.ac | cut -f2 -d" " | sed s/,//` +acversion=`grep AC_INIT configure.ac | cut -f2 -d"," | sed s/,// | sed s/")"//` rm -rf SpecTcl-${amversion} SpecTcl-${acversion} tarball=SpecTcl-${amversion}.tar.gz Modified: branches/SpecTcl-3.4/tkcon/Makefile.am =================================================================== --- branches/SpecTcl-3.4/tkcon/Makefile.am 2014-08-14 12:53:34 UTC (rev 2190) +++ branches/SpecTcl-3.4/tkcon/Makefile.am 2014-08-14 14:43:35 UTC (rev 2191) @@ -2,4 +2,7 @@ $(mkinstalldirs) @prefix@/TclLibs $(mkinstalldirs) @prefix@/TclLibs/tkcon $(INSTALL_SCRIPT) tkcon-2.5.tcl @prefix@/TclLibs/tkcon + $(INSTALL_SCRIPT) history.tcl @prefix@/TclLibs/tkcon echo pkg_mkIndex @prefix@/TclLibs/tkcon "*.tcl" | @TCLSH@ + +EXTRA_DIST=tkcon-2.5.tcl history.tcl Added: branches/SpecTcl-3.4/tkcon/history.tcl =================================================================== --- branches/SpecTcl-3.4/tkcon/history.tcl (rev 0) +++ branches/SpecTcl-3.4/tkcon/history.tcl 2014-08-14 14:43:35 UTC (rev 2191) @@ -0,0 +1,374 @@ +# history.tcl -- +# +# Implementation of the history command. +# +# Copyright (c) 1997 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +# The tcl::history array holds the history list and +# some additional bookkeeping variables. +# +# nextid the index used for the next history list item. +# keep the max size of the history list +# oldest the index of the oldest item in the history. +package provide history 8.5 + +namespace eval tcl { + variable history + if {![info exists history]} { + array set history { + nextid 0 + keep 20 + oldest -20 + } + } +} + +# history -- +# +# This is the main history command. See the man page for its interface. +# This does argument checking and calls helper procedures in the +# history namespace. + +proc history {args} { + set len [llength $args] + if {$len == 0} { + return [tcl::HistInfo] + } + set key [lindex $args 0] + set options "add, change, clear, event, info, keep, nextid, or redo" + switch -glob -- $key { + a* { # history add + + if {$len > 3} { + return -code error "wrong # args: should be \"history add event ?exec?\"" + } + if {![string match $key* add]} { + return -code error "bad option \"$key\": must be $options" + } + if {$len == 3} { + set arg [lindex $args 2] + if {! ([string match e* $arg] && [string match $arg* exec])} { + return -code error "bad argument \"$arg\": should be \"exec\"" + } + } + return [tcl::HistAdd [lindex $args 1] [lindex $args 2]] + } + ch* { # history change + + if {($len > 3) || ($len < 2)} { + return -code error "wrong # args: should be \"history change newValue ?event?\"" + } + if {![string match $key* change]} { + return -code error "bad option \"$key\": must be $options" + } + if {$len == 2} { + set event 0 + } else { + set event [lindex $args 2] + } + + return [tcl::HistChange [lindex $args 1] $event] + } + cl* { # history clear + + if {($len > 1)} { + return -code error "wrong # args: should be \"history clear\"" + } + if {![string match $key* clear]} { + return -code error "bad option \"$key\": must be $options" + } + return [tcl::HistClear] + } + e* { # history event + + if {$len > 2} { + return -code error "wrong # args: should be \"history event ?event?\"" + } + if {![string match $key* event]} { + return -code error "bad option \"$key\": must be $options" + } + if {$len == 1} { + set event -1 + } else { + set event [lindex $args 1] + } + return [tcl::HistEvent $event] + } + i* { # history info + + if {$len > 2} { + return -code error "wrong # args: should be \"history info ?count?\"" + } + if {![string match $key* info]} { + return -code error "bad option \"$key\": must be $options" + } + return [tcl::HistInfo [lindex $args 1]] + } + k* { # history keep + + if {$len > 2} { + return -code error "wrong # args: should be \"history keep ?count?\"" + } + if {$len == 1} { + return [tcl::HistKeep] + } else { + set limit [lindex $args 1] + if {[catch {expr {~$limit}}] || ($limit < 0)} { + return -code error "illegal keep count \"$limit\"" + } + return [tcl::HistKeep $limit] + } + } + n* { # history nextid + + if {$len > 1} { + return -code error "wrong # args: should be \"history nextid\"" + } + if {![string match $key* nextid]} { + return -code error "bad option \"$key\": must be $options" + } + return [expr {$tcl::history(nextid) + 1}] + } + r* { # history redo + + if {$len > 2} { + return -code error "wrong # args: should be \"history redo ?event?\"" + } + if {![string match $key* redo]} { + return -code error "bad option \"$key\": must be $options" + } + return [tcl::HistRedo [lindex $args 1]] + } + default { + return -code error "bad option \"$key\": must be $options" + } + } +} + +# tcl::HistAdd -- +# +# Add an item to the history, and optionally eval it at the global scope +# +# Parameters: +# command the command to add +# exec (optional) a substring of "exec" causes the +# command to be evaled. +# Results: +# If executing, then the results of the command are returned +# +# Side Effects: +# Adds to the history list + + proc tcl::HistAdd {command {exec {}}} { + variable history + + # Do not add empty commands to the history + if {[string trim $command] eq ""} { + return "" + } + + set i [incr history(nextid)] + set history($i) $command + set j [incr history(oldest)] + unset -nocomplain history($j) + if {[string match e* $exec]} { + return [uplevel #0 $command] + } else { + return {} + } +} + +# tcl::HistKeep -- +# +# Set or query the limit on the length of the history list +# +# Parameters: +# limit (optional) the length of the history list +# +# Results: +# If no limit is specified, the current limit is returned +# +# Side Effects: +# Updates history(keep) if a limit is specified + + proc tcl::HistKeep {{limit {}}} { + variable history + if {$limit eq ""} { + return $history(keep) + } else { + set oldold $history(oldest) + set history(oldest) [expr {$history(nextid) - $limit}] + for {} {$oldold <= $history(oldest)} {incr oldold} { + unset -nocomplain history($oldold) + } + set history(keep) $limit + } +} + +# tcl::HistClear -- +# +# Erase the history list +# +# Parameters: +# none +# +# Results: +# none +# +# Side Effects: +# Resets the history array, except for the keep limit + + proc tcl::HistClear {} { + variable history + set keep $history(keep) + unset history + array set history [list \ + nextid 0 \ + keep $keep \ + oldest -$keep \ + ] +} + +# tcl::HistInfo -- +# +# Return a pretty-printed version of the history list +# +# Parameters: +# num (optional) the length of the history list to return +# +# Results: +# A formatted history list + + proc tcl::HistInfo {{num {}}} { + variable history + if {$num eq ""} { + set num [expr {$history(keep) + 1}] + } + set result {} + set newline "" + for {set i [expr {$history(nextid) - $num + 1}]} \ + {$i <= $history(nextid)} {incr i} { + if {![info exists history($i)]} { + continue + } + set cmd [string map [list \n \n\t] [string trimright $history($i) \ \n]] + append result $newline[format "%6d %s" $i $cmd] + set newline \n + } + return $result +} + +# tcl::HistRedo -- +# +# Fetch the previous or specified event, execute it, and then +# replace the current history item with that event. +# +# Parameters: +# event (optional) index of history item to redo. Defaults to -1, +# which means the previous event. +# +# Results: +# Those of the command being redone. +# +# Side Effects: +# Replaces the current history list item with the one being redone. + + proc tcl::HistRedo {{event -1}} { + variable history + if {$event eq ""} { + set event -1 + } + set i [HistIndex $event] + if {$i == $history(nextid)} { + return -code error "cannot redo the current event" + } + set cmd $history($i) + HistChange $cmd 0 + uplevel #0 $cmd +} + +# tcl::HistIndex -- +# +# Map from an event specifier to an index in the history list. +# +# Parameters: +# event index of history item to redo. +# If this is a positive number, it is used directly. +# If it is a negative number, then it counts back to a previous +# event, where -1 is the most recent event. +# A string can be matched, either by being the prefix of +# a command or by matching a command with string match. +# +# Results: +# The index into history, or an error if the index didn't match. + + proc tcl::HistIndex {event} { + variable history + if {[catch {expr {~$event}}]} { + for {set i [expr {$history(nextid)-1}]} {[info exists history($i)]} \ + {incr i -1} { + if {[string match $event* $history($i)]} { + return $i; + } + if {[string match $event $history($i)]} { + return $i; + } + } + return -code error "no event matches \"$event\"" + } elseif {$event <= 0} { + set i [expr {$history(nextid) + $event}] + } else { + set i $event + } + if {$i <= $history(oldest)} { + return -code error "event \"$event\" is too far in the past" + } + if {$i > $history(nextid)} { + return -code error "event \"$event\" hasn't occured yet" + } + return $i +} + +# tcl::HistEvent -- +# +# Map from an event specifier to the value in the history list. +# +# Parameters: +# event index of history item to redo. See index for a +# description of possible event patterns. +# +# Results: +# The value from the history list. + + proc tcl::HistEvent {event} { + variable history + set i [HistIndex $event] + if {[info exists history($i)]} { + return [string trimright $history($i) \ \n] + } else { + return ""; + } +} + +# tcl::HistChange -- +# +# Replace a value in the history list. +# +# Parameters: +# cmd The new value to put into the history list. +# event (optional) index of history item to redo. See index for a +# description of possible event patterns. This defaults +# to 0, which specifies the current event. +# +# Side Effects: +# Changes the history list. + + proc tcl::HistChange {cmd {event 0}} { + variable history + set i [HistIndex $event] + set history($i) $cmd +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-08-14 19:20:33
|
Revision: 2193 http://sourceforge.net/p/nsclspectcl/code/2193 Author: ron-fox Date: 2014-08-14 19:20:28 +0000 (Thu, 14 Aug 2014) Log Message: ----------- Fix error daq11 format helper - was not getting bodies where needed. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/DecoderRing/DataFormat.h branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-08-14 16:54:28 UTC (rev 2192) +++ branches/SpecTcl-3.4/CHANGELOG 2014-08-14 19:20:28 UTC (rev 2193) @@ -1042,4 +1042,4 @@ * Feature #2103 - Allow users to hide the gates on displayed spectra Spectra->Hide Gates and then refresh the menu is a toggle button. * Feature #1484 - Make work with Tcl 8.6. - + * Fix error in 11 ring format helper - was not getting the runnumber properly. \ No newline at end of file Modified: branches/SpecTcl-3.4/DecoderRing/DataFormat.h =================================================================== --- branches/SpecTcl-3.4/DecoderRing/DataFormat.h 2014-08-14 16:54:28 UTC (rev 2192) +++ branches/SpecTcl-3.4/DecoderRing/DataFormat.h 2014-08-14 19:20:28 UTC (rev 2193) @@ -205,7 +205,7 @@ } u_noBodyHeader; struct { BodyHeader s_bodyHeader; - uint8_t s_body[]; + uint8_t s_body[1]; } u_hasBodyHeader; } s_body; } RingItem, *pRingItem; @@ -252,7 +252,7 @@ uint32_t s_intervalDivisor; /* 11.0 sub second time intervals */ uint32_t s_scalerCount; uint32_t s_isIncremental; /* 11.0 non-incremental scaler flag */ - uint32_t s_scalers[]; + uint32_t s_scalers[1]; } ScalerItemBody, *pScalerItemBody; typedef PSTRUCT _ScalerItem { @@ -280,7 +280,7 @@ uint32_t s_timestamp; uint32_t s_stringCount; uint32_t s_offsetDivisor; - char s_strings[]; + char s_strings[1]; } TextItemBody, *pTextItemBody; typedef PSTRUCT _TextItem { @@ -307,11 +307,11 @@ union { struct { uint32_t s_mbz; - uint16_t s_body[]; /* Aribrtary length body */ + uint16_t s_body[1]; /* Aribrtary length body */ } u_noBodyHeader; struct { BodyHeader s_bodyHeader; - uint16_t s_body[]; + uint16_t s_body[1]; } u_hasBodyHeader; } s_body; } PhysicsEventItem, *pPhysicsEventItem; @@ -350,7 +350,7 @@ typedef PSTRUCT _EventBuilderFragment { RingItemHeader s_header; BodyHeader s_bodyHeader; - uint8_t s_body[]; /* Really s_payload bytes of data.. */ + uint8_t s_body[1]; /* Really s_payload bytes of data.. */ } EventBuilderFragment, *pEventBuilderFragment; /** Modified: branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp =================================================================== --- branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp 2014-08-14 16:54:28 UTC (rev 2192) +++ branches/SpecTcl-3.4/DecoderRing/RingFormatHelper11.cpp 2014-08-14 19:20:28 UTC (rev 2193) @@ -127,7 +127,7 @@ CRingFormatHelper11::getRunNumber(void* pItem, BufferTranslator* pTranslator) { if (isStateTransition(pItem)) { - pStateChangeItemBody p = reinterpret_cast<pStateChangeItemBody>(pItem); + pStateChangeItemBody p = reinterpret_cast<pStateChangeItemBody>(getBodyPointer(pItem)); return pTranslator->TranslateLong(p->s_runNumber); } else { throw std::string("CRingFormatHelper11::getRunNumber - not state Transition"); @@ -149,7 +149,7 @@ CRingFormatHelper11::getStringCount(void* pItem, BufferTranslator* pTranslator) { if (isTextItem(pItem)) { - pTextItemBody p = reinterpret_cast<pTextItemBody>(pItem); + pTextItemBody p = reinterpret_cast<pTextItemBody>(getBodyPointer(pItem)); return pTranslator->TranslateLong(p->s_stringCount); } else { throw std::string("CRingFormatHelper11::getStringCount - not a text item."); @@ -171,7 +171,8 @@ CRingFormatHelper11::getScalerCount(void* pItem, BufferTranslator* pTranslator) { if (isScalerItem(pItem)) { - + pScalerItemBody p = reinterpret_cast<pScalerItemBody>(getBodyPointer(pItem)); + return p->s_scalerCount; } else { throw std::string( "CRingFormatHelper11::getScalerCount - not a scaler item." @@ -261,4 +262,4 @@ CRingFormatHelper11::isTriggerCountItem(void* pItem) { return itemType(pItem) == PHYSICS_EVENT_COUNT; -} \ No newline at end of file +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2014-08-21 18:29:40
|
Revision: 2195 http://sourceforge.net/p/nsclspectcl/code/2195 Author: ron-fox Date: 2014-08-21 18:29:38 +0000 (Thu, 21 Aug 2014) Log Message: ----------- Change name of tkcon's clear command to tkcon-clear so it does not interfere with SpecTcl's clear command. Modified Paths: -------------- branches/SpecTcl-3.4/CHANGELOG branches/SpecTcl-3.4/tkcon/tkcon-2.5.tcl Modified: branches/SpecTcl-3.4/CHANGELOG =================================================================== --- branches/SpecTcl-3.4/CHANGELOG 2014-08-14 19:28:07 UTC (rev 2194) +++ branches/SpecTcl-3.4/CHANGELOG 2014-08-21 18:29:38 UTC (rev 2195) @@ -1042,4 +1042,6 @@ * Feature #2103 - Allow users to hide the gates on displayed spectra Spectra->Hide Gates and then refresh the menu is a toggle button. * Feature #1484 - Make work with Tcl 8.6. - * Fix error in 11 ring format helper - was not getting the runnumber properly. \ No newline at end of file + * Fix error in 11 ring format helper - was not getting the runnumber properly. + * Remove clear command from new Tkcon so it does not interfere with + SpecTcl's. \ No newline at end of file Modified: branches/SpecTcl-3.4/tkcon/tkcon-2.5.tcl =================================================================== --- branches/SpecTcl-3.4/tkcon/tkcon-2.5.tcl 2014-08-14 19:28:07 UTC (rev 2194) +++ branches/SpecTcl-3.4/tkcon/tkcon-2.5.tcl 2014-08-21 18:29:38 UTC (rev 2195) @@ -1466,8 +1466,8 @@ -command ::tkcon::DeleteTab -state disabled $m add command -label "Close Console" -underline 0 -accel Ctrl-w \ -command ::tkcon::Destroy - $m add command -label "Clear Console" -underline 1 -accel Ctrl-l \ - -command { clear; ::tkcon::Prompt } +# $m add command -label "Clear Console" -underline 1 -accel Ctrl-l \ +# -command { clear; ::tkcon::Prompt } if {[string match unix $tcl_platform(platform)]} { $m add separator $m add command -label "Make Xauth Secure" -und 5 \ @@ -3914,7 +3914,9 @@ ## clear - clears the buffer of the console (not the history though) ## This is executed in the parent interpreter ## -proc clear {{pcnt 100}} { + + +proc tkcon_clear {{pcnt 100}} { if {![regexp {^[0-9]*$} $pcnt] || $pcnt < 1 || $pcnt > 100} { return -code error \ "invalid percentage to clear: must be 1-100 (100 default)" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |