EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EDD/DM: Passing multiple arguments for color rule definition ?
From: [email protected] (Deb Kerstiens)
To: [email protected]
Cc: [email protected], [email protected]
Date: Tue, 3 Jun 97 14:44:33 MDT
----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Content-Lines: 59

> 
> Thanks for your reply.
> 
> I put the rule as below:
> 
>          $(A).SEVR    equals          MAJOR   or
>          $(B).SEVR    equals          MAJROR  use     <A>B color>
>          $(A).SEVR    equals          MINOR   or 
>          $(B).SEVR    equals          MINOR   use     <A>B color>
>          $(B).SEVR    equals          NO_ALARM   and
>          $(A).SEVR    equals          NO_ALARM use     <B>A color>
>          
> and passed arguments to them: 
> 	A=XXX:YYY:Z:chan1Alarm,B=XXX:YYY:Z:chan2Alarm
> 
> But then when I activate the display dm "dies" (not possible to perform
> any action on the display, besides killing it from WM)
> Is there any limit concerning the total length of the arguments in the
> line ?
> 
> Thanks for any comments.
> 
> Regards,
> Marian
> --
> Marian Zurek
> CERN/ECP-CO
> 

Hello All,

The bug in color rules is fixed.  It was a problem with the "or"
comparator.  Since Version 2.3 was never an official release, the
easiest thing to do is to just replace the execute_color_rules
function in 
	rti/display_mgr.c 
with the fixed one. There was an earlier bug fix to color rules that
changed execute_color_rules drastically.  For those of you who need
a 2.3 fix, please send me your copy of display_mgr.c or the 
execute_color_rules function and I'll send you the apppropriate fix.
(...or you can do a quick check yourself: if the file h/dynamic_def.h
has the field clrrule_has_changed declared as type "int" rather than
"int *" in struct rti)color_rules and just the opposite in struct 
rti_dynamic_graphics, you can use the version included with this 
message.)

If you have a prerelease copy of 2.4, you'll need this replacement 
also (included with this message) or you can get a new copy of 2.4.  
I have one more change to implement and test before 2.4 becomes an 
official release.  At that point, I'll put it on the ANL EPICS extensions 
distribution site.

Please note that "or" is currently only valid in combination with other 
"or" lines and ends with the "use" line.  There isn't a clear-cut way 
to determine the meaning of and/or combinations with the current 
method of defining color rules.  If you mix "and" with "or", the color 
will be white indicating that the color rule wasn't resolved. 

deb
----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: ecr
X-Sun-Content-Lines: 113

execute_color_rule(pdm_llist_el, pRti_cr)
struct dm_llist_el	*pdm_llist_el;
struct rti_color_rules	*pRti_cr;
{
	struct	{
		int	true;
		int	loper;
	} 			results[MAX_RULE_LINES];
	int			line;
	struct dl_color_rule	*prule	= pRti_cr->prule;
	int			last_fg	= *pRti_cr->prulecolorfg;
	int			last_bg = *pRti_cr->prulecolorbg;

	/*
	 * pass one: collect data, watching for bad data which invalidates the rule
	 */
#ifdef DEBUG
printf("\n");
#endif
	for(line = 0; line < MAX_RULE_LINES; line++){
		struct gsdl_com_record	*pComel	= pRti_cr->line[line].pComel;

		if(!pdm_llist_el->pdl_strings[(int)(prule->info[line].chan)][0]){
			/* line is empty, treat it like a TRUE AND */
			results[line].true  = TRUE;
			results[line].loper = dl_clrrule_and;

		} else if(dmChkPvStat(pComel, 0, 0) != dmConnection_okay){
			/* any bad piece of data invalidates the rule execution */
			*pRti_cr->prulecolorfg		= BAD_COLOR_DATA;
			*pRti_cr->prulecolorbg		= BAD_COLOR_DATA;
			pRti_cr->clrrule_has_changed	=
			    (*pRti_cr->prulecolorfg != last_fg) || (*pRti_cr->prulecolorbg != last_bg);
#ifdef DEBUG_CRULES
printf("changed:%d fg:%d bg:%d\n",pRti_cr->clrrule_has_changed,*pRti_cr->prulecolorfg,*pRti_cr->prulecolorbg);
#endif
			return;
		} else {
			/* compare the field value (have) to what we want for the TRUE condition */
#ifdef DEBUG_CRULES
printf("line: %d\n",line);
#endif

			results[line].true = evalColoRule(
					pdm_llist_el->pdl_strings[(int)(prule->info[line].value)],
					pComel,
					prule->info[line].comparator);
			results[line].loper = prule->info[line].connector;
		}
	}

	/*
	 * pass two: convert andnot operators to and
	 *	NOTE: edd insures that last line is dl_clrrule_use
	 */
	for(line = 0; line < MAX_RULE_LINES; line++){
		if(results[line].loper == dl_clrrule_andnot){
			results[line+1].true = !results[line+1].true;
			results[line].loper = dl_clrrule_and;
		}
	}

	/*
	 * pass three: select the rules color
	 */
	line = 0;
	while(line < MAX_RULE_LINES){
		int gotOr = FALSE;
		if (results[line].loper == dl_clrrule_use && (results[line].true || gotOr)){
			*pRti_cr->prulecolorfg		= prule->info[line].clr;
			*pRti_cr->prulecolorbg		= prule->bg_enable ? prule->default_bg : USE_DEFAULT_COLOR;
			pRti_cr->clrrule_has_changed	=
			    (*pRti_cr->prulecolorfg != last_fg) || (*pRti_cr->prulecolorbg != last_bg);
#ifdef DEBUG_CRULES
printf("line %d is TRUE\n", line);
printf("changed %d fg:%d bg:%d\n",pRti_cr->clrrule_has_changed,*pRti_cr->prulecolorfg,*pRti_cr->prulecolorbg);
#endif
			return;

		} else if(results[line].loper == dl_clrrule_use && !results[line].true){
			line++;

		} else if(results[line].loper == dl_clrrule_and && results[line].true){
			line++;

		} else if(results[line].loper == dl_clrrule_and && !results[line].true){
			while(results[line].loper == dl_clrrule_and && line < MAX_RULE_LINES){
				line++;
			}
			line++;
		} else if (results[line].loper == dl_clrrule_or){
			while(results[line].loper == dl_clrrule_or && line < MAX_RULE_LINES){
				if(results[line].true){
					gotOr = TRUE;
				}
				line++;
			}
			if(results[line].loper != dl_clrrule_use){
				printf("in execute_crules, can't mix ands,ors\n");
				*pRti_cr->prulecolorfg = USE_DEFAULT_COLOR;
				pRti_cr->clrrule_has_changed	= (*pRti_cr->prulecolorfg != last_fg) || (*pRti_cr->prulecolorbg != last_bg);
				return;
			}
		}
	}
	*pRti_cr->prulecolorfg		= prule->fg_enable ? prule->default_fg : USE_DEFAULT_COLOR;
	*pRti_cr->prulecolorbg		= prule->bg_enable ? prule->default_bg : USE_DEFAULT_COLOR;
	pRti_cr->clrrule_has_changed	= (*pRti_cr->prulecolorfg != last_fg) || (*pRti_cr->prulecolorbg != last_bg);
#ifdef DEBUG_CRULES
printf("taking defaults\n");
printf("changed:%d fg:%d bg:%d\n",pRti_cr->clrrule_has_changed,*pRti_cr->prulecolorfg,*pRti_cr->prulecolorbg);
#endif
}

Navigate by Date:
Prev: Re: EDD/DM: Passing multiple arguments for color rule definition ? Deb Kerstiens
Next: EPICS Channel Access in Python. Noboru Yamamoto
Index: 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EDD/DM: Passing multiple arguments for color rule definition ? Deb Kerstiens
Next: please ignore my last email Anna M. Estes
Index: 1994  1995  1996  <19971998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·