From ed18b6903e153e47777be4f9198f9f9d50a7e969 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 21 Jan 2012 15:31:39 -0600 Subject: [PATCH] Special processing events When generating a DBE_PROPERTY event because of a modified enum string, also post DBE_VALUE and DBE_LOG events if the record is currently in that particular state. --- src/std/rec/mbbiRecord.c | 33 +++++++++++++++++++-------------- src/std/rec/mbboRecord.c | 29 +++++++++++++++++------------ 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/std/rec/mbbiRecord.c b/src/std/rec/mbbiRecord.c index 6a1ef943d..eddc188eb 100644 --- a/src/std/rec/mbbiRecord.c +++ b/src/std/rec/mbbiRecord.c @@ -1,6 +1,6 @@ /*************************************************************************\ * Copyright (c) 2009 Helmholtz-Zentrum Berlin fuer Materialien und Energie. -* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. @@ -197,22 +197,27 @@ static long process(mbbiRecord *prec) } -static long special(DBADDR *paddr,int after) +static long special(DBADDR *paddr, int after) { - mbbiRecord *prec = (mbbiRecord *)(paddr->precord); - int special_type = paddr->special; - int fieldIndex = dbGetFieldIndex(paddr); + mbbiRecord *prec = (mbbiRecord *)(paddr->precord); + int special_type = paddr->special; + int fieldIndex = dbGetFieldIndex(paddr); - if(!after) return(0); - switch(special_type) { - case(SPC_MOD): - init_common(prec); - if (fieldIndex >= mbbiRecordZRST && fieldIndex <= mbbiRecordFFST) - db_post_events(prec,&prec->val,DBE_PROPERTY); - return(0); + if (!after) return 0; + switch (special_type) { + case SPC_MOD: + init_common(prec); + if (fieldIndex >= mbbiRecordZRST && fieldIndex <= mbbiRecordFFST) { + int event = DBE_PROPERTY; + + if (prec->val == fieldIndex - mbbiRecordZRST) + event |= DBE_VALUE | DBE_LOG; + db_post_events(prec, &prec->val, event); + } + return 0; default: - recGblDbaddrError(S_db_badChoice,paddr,"mbbi: special"); - return(S_db_badChoice); + recGblDbaddrError(S_db_badChoice, paddr, "mbbi: special"); + return S_db_badChoice; } } diff --git a/src/std/rec/mbboRecord.c b/src/std/rec/mbboRecord.c index 5df97ff07..60ffaa34c 100644 --- a/src/std/rec/mbboRecord.c +++ b/src/std/rec/mbboRecord.c @@ -1,6 +1,6 @@ /*************************************************************************\ * Copyright (c) 2009 Helmholtz-Zentrum Berlin fuer Materialien und Energie. -* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* Copyright (c) 2012 UChicago Argonne LLC, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. @@ -267,20 +267,25 @@ CONTINUE: static long special(DBADDR *paddr, int after) { - mbboRecord *prec = (mbboRecord *)(paddr->precord); - int special_type = paddr->special; - int fieldIndex = dbGetFieldIndex(paddr); + mbboRecord *prec = (mbboRecord *)(paddr->precord); + int special_type = paddr->special; + int fieldIndex = dbGetFieldIndex(paddr); - if(!after) return(0); - switch(special_type) { - case(SPC_MOD): + if (!after) return 0; + switch (special_type) { + case SPC_MOD: init_common(prec); - if (fieldIndex >= mbboRecordZRST && fieldIndex <= mbboRecordFFST) - db_post_events(prec,&prec->val,DBE_PROPERTY); - return(0); + if (fieldIndex >= mbboRecordZRST && fieldIndex <= mbboRecordFFST) { + int event = DBE_PROPERTY; + + if (prec->val == fieldIndex - mbboRecordZRST) + event |= DBE_VALUE | DBE_LOG; + db_post_events(prec, &prec->val, event); + } + return 0; default: - recGblDbaddrError(S_db_badChoice,paddr,"mbbo: special"); - return(S_db_badChoice); + recGblDbaddrError(S_db_badChoice, paddr, "mbbo: special"); + return S_db_badChoice; } }