Commit 964a98e5 authored by Claes Sjofors's avatar Claes Sjofors

Xtt loggning, conditional logging with expression added

parent ee80c893
......@@ -1142,9 +1142,20 @@ to file. At fast time critical sequences, you can increase the buffer size to av
interruption when the buffer i written to file.
<h2>Conditional logging
In 'ConditionParameter' a digital attribute controlling the logging can be specified. The
In 'Condition' a digital attribute controlling the logging can be specified. The
logging is only performed when the ConditionParameter is true.
It is also possible to insert an expression into 'Condition'. The expression starts with
'expr' followed by the condition enclosed with parenthesis. In the expression, attribute values
can be fetched with the GetA function for analog attributes, GetD function for digital
attributes and GetI function for integer attribute.
<b>Expression example
expr( GetD("H1-H2-Dv1.ActualValue") && GetA("H1-H2-Av2.ActualValue") > 2.5)
The logging is performed when the Dv 'H1-H2-Dv1' is true and the Av 'H1-H2-Av2' is
larger than 2.5.
<h2>Store
The logging configuration is stored with the 'Store' button, and can be restored later
with the 'Restore' button.
......
......@@ -1129,9 +1129,19 @@ snabba tidskritiska f
att störningar som kan uppstå när bufferten skrivs på fil.
<h2>Villkorlig loggning
I 'ConditionParameter' kan man ange ett digitalt attribut som styr loggningen. Loggning
I 'Condition kan man ange ett digitalt attribut som styr loggningen. Loggning
sker enbart om ConditionParameter är sann.
Man kan även ange ett uttryck i 'Condition. Uttrycket startar med 'expr' följt av
villkoret omgivet av parenteser. I villkoret kan man hämta upp attribut-värden med
GetA funktionen för analoga attribut, GetD funktionen för digitala attribut och GetI
funktionen för heltals attribut.
<b>Exempel
expr( GetD("H1-H2-Dv1.ActualValue") && GetA("H1-H2-Av2.ActualValue") > 2.5)
Loggningen utförs när Dv'n 'H1-H2-Dv1' är 1 och Av'n 'H1-H2-Av2' är större en 2.5.
<h2>Lagra
Logg konfigureringen kan sparas med 'Store' knappen, för att återskapas vid ett senare
tillfälle med 'Restore' knappen.
......
......@@ -1845,77 +1845,87 @@ int ccm_operate_exec(
exit_function_found = 0;
if ( next == NULL)
{
if ( !op->result_done)
{
if ( op->value_decl == K_DECL_FLOAT)
if ( next == NULL) {
if ( !op->result_done) {
switch ( op->value_decl) {
case K_DECL_FLOAT:
op->result_float = op->value_float;
else if ( op->value_decl == K_DECL_INT)
break;
case K_DECL_INT:
op->result_int = op->value_int;
else
break;
default:
strcpy( op->result_string, op->value_string);
}
op->result_decl = op->value_decl;
}
}
else
{
if ( op->type == K_OPERAND_NO)
{
if ( !next->result_done)
{
if ( next->type == K_OPERAND_NAME )
{
else {
if ( op->type == K_OPERAND_NO) {
if ( !next->result_done) {
if ( next->type == K_OPERAND_NAME ) {
sts = ccm_getvar( funcctx, next->name, &next->value_decl,
&next->value_float, &next->value_int,
next->value_string);
if ( EVEN(sts)) return sts;
}
if ( next->value_decl == K_DECL_FLOAT)
switch ( next->value_decl) {
case K_DECL_FLOAT:
next->result_float = next->value_float;
else if ( next->value_decl == K_DECL_INT)
break;
case K_DECL_INT:
next->result_int = next->value_int;
else
break;
default:
strcpy( next->result_string, next->value_string);
}
next->result_decl = next->value_decl;
}
}
else if ( op->type == K_OPERAND_NAME && !op->result_done)
{
else if ( op->type == K_OPERAND_NAME && !op->result_done) {
sts = ccm_getvar( funcctx, op->name, &op->value_decl, &op->value_float,
&op->value_int, op->value_string);
if ( EVEN(sts)) return sts;
}
else if ( op->type == K_OPERAND_FUNCTION)
{
else if ( op->type == K_OPERAND_FUNCTION) {
/* Create an argument list */
arg_list = 0;
arg_count = 0;
for ( op_arg = op->next; op_arg; op_arg = op_arg->next)
{
for ( op_arg = op->next; op_arg; op_arg = op_arg->next) {
if ( op_arg->type == K_OPERAND_NO &&
op_arg->parlevel == op->parlevel - 1)
break;
if ( op_arg->type == K_OPERAND_NAME)
{
if ( op_arg->type == K_OPERAND_NAME) {
sts = ccm_getvar( funcctx, op_arg->name, &op_arg->value_decl,
&op_arg->value_float, &op_arg->value_int, op_arg->value_string);
if ( EVEN(sts)) return sts;
}
arg_p = calloc( 1, sizeof( ccm_sArg));
if ( op_arg->value_decl == K_DECL_INT)
switch ( op_arg->value_decl) {
case K_DECL_INT:
arg_p->value_int = op_arg->value_int;
else if ( op_arg->value_decl == K_DECL_FLOAT)
break;
case K_DECL_FLOAT:
arg_p->value_float = op_arg->value_float;
else if ( op_arg->value_decl == K_DECL_STRING)
break;
case K_DECL_STRING:
strcpy( arg_p->value_string, op_arg->value_string);
break;
default: ;
}
arg_p->value_decl = op_arg->value_decl;
arg_p->value_type = op_arg->type;
strcpy( arg_p->value_name, op_arg->name);
if ( arg_list == 0)
arg_list = arg_p;
else
{
else {
for ( a_p = arg_list; a_p->next; a_p = a_p->next) ;
a_p->next = arg_p;
}
......@@ -1930,11 +1940,10 @@ int ccm_operate_exec(
op->result_string, 0);
/* Set returned argument values and free argumentlist */
for ( arg_p = arg_list; arg_p; arg_p = next_arg)
{
for ( arg_p = arg_list; arg_p; arg_p = next_arg) {
if ( arg_p->value_type == K_OPERAND_NAME &&
arg_p->value_returned)
{
arg_p->value_returned) {
sts = ccm_setvar( funcctx, arg_p->value_name, arg_p->value_decl,
arg_p->value_float, arg_p->value_int, arg_p->value_string);
if ( EVEN(sts)) return sts;
......@@ -1948,22 +1957,22 @@ int ccm_operate_exec(
}
if ( next->type == K_OPERAND_NAME && !next->result_done &&
op->type != K_OPERAND_DECL)
{
op->type != K_OPERAND_DECL) {
sts = ccm_getvar( funcctx, next->name, &next->value_decl, &next->value_float,
&next->value_int, next->value_string);
if ( EVEN(sts)) return sts;
}
if ( next->result_done)
{
if ( next->result_done) {
/* Use result, not value for next-operand */
next_decl = next->result_decl;
next_int = next->result_int;
next_float = next->result_float;
strcpy( next_string, next->result_string);
}
else
{
else {
/* Use value for next-operand */
next_decl = next->value_decl;
next_int = next->value_int;
......@@ -1971,473 +1980,579 @@ int ccm_operate_exec(
strcpy( next_string, next->value_string);
}
if ( next->type == K_OPERAND_NO && !next->result_done)
{
if ( next->type == K_OPERAND_NO && !next->result_done) {
next->result_float = op->result_float;
next->result_int = op->result_int;
strcpy( next->result_string, op->result_string);
next->result_decl = op->result_decl;
}
else if ( next_decl == K_DECL_UNKNOWN)
{
else if ( next_decl == K_DECL_UNKNOWN) {
next_decl = op->value_decl;
}
switch ( op->o_operator)
{
switch ( op->o_operator) {
case K_ACTION_EQL:
sts = ccm_setvar( funcctx, op->name, next_decl, next_float, next_int,
next_string);
if ( EVEN(sts)) return sts;
break;
case K_ACTION_RETURN:
if ( !next->result_done)
{
if ( !next->result_done) {
next->result_decl = next_decl;
if ( next_decl == K_DECL_INT)
switch ( next_decl) {
case K_DECL_INT:
next->result_int = next_int;
else if ( next_decl == K_DECL_FLOAT)
break;
case K_DECL_FLOAT:
next->result_float = next_float;
else if ( next_decl == K_DECL_STRING)
break;
case K_DECL_STRING:
strcpy( next->result_string, next_string);
break;
}
}
break;
case K_ACTION_MUL:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int * next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float * next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int * next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float * next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float * next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
break;
case K_ACTION_DIV:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int / next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float / next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int / next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float / next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float / next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
break;
case K_ACTION_ADD:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int + next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float + next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int + next_float;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
next->result_float = op->result_float + next_float;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING)
{
strcpy( next->result_string, op->result_string);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_STRING)
{
break;
case K_DECL_STRING:
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, op->result_int);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_INT)
{
strcpy( next->result_string, op->result_string);
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, next_int);
next->result_decl = K_DECL_STRING;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_STRING)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float + next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float + next_float;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_STRING:
ccm_float_to_string( tmp_str, op->result_float);
strcpy( next->result_string, tmp_str);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_INT:
strcpy( next->result_string, op->result_string);
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, next_int);
next->result_decl = K_DECL_STRING;
break;
case K_DECL_FLOAT:
strcpy( next->result_string, op->result_string);
ccm_float_to_string( tmp_str, next_float);
strncat( next->result_string, tmp_str, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
case K_DECL_STRING:
strcpy( next->result_string, op->result_string);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
break;
}
break;
case K_ACTION_EQLADD:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int + next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float + next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int + next_float;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
next->result_float = op->result_float + next_float;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING)
{
strcpy( next->result_string, op->result_string);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_STRING)
{
break;
case K_DECL_STRING:
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, op->result_int);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_INT)
{
strcpy( next->result_string, op->result_string);
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, next_int);
next->result_decl = K_DECL_STRING;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_STRING)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float + next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float + next_float;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_STRING:
ccm_float_to_string( tmp_str, op->result_float);
strcpy( next->result_string, tmp_str);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_INT:
strcpy( next->result_string, op->result_string);
sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, next_int);
next->result_decl = K_DECL_STRING;
break;
case K_DECL_FLOAT:
strcpy( next->result_string, op->result_string);
ccm_float_to_string( tmp_str, next_float);
strncat( next->result_string, tmp_str, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
case K_DECL_STRING:
strcpy( next->result_string, op->result_string);
strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING;
break;
}
break;
}
sts = ccm_setvar( funcctx, op->name, next->result_decl,
next->result_float, next->result_int, next->result_string);
if ( EVEN(sts)) return sts;
break;
case K_ACTION_EQLSUB:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int - next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float - next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int - next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float - next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float - next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
sts = ccm_setvar( funcctx, op->name, next->result_decl,
next->result_float, next->result_int, next->result_string);
if ( EVEN(sts)) return sts;
break;
case K_ACTION_SUB:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int - next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float - next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int - next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float - next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float - next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
break;
case K_ACTION_AND:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int && next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float && next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int && next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float && next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float && next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
break;
case K_ACTION_OR:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = op->result_int || next_int;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_float = op->result_float || next_int;
next->result_decl = K_DECL_FLOAT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_float = op->result_int || next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_float = op->result_float || next_int;
next->result_decl = K_DECL_FLOAT;
break;
case K_DECL_FLOAT:
next->result_float = op->result_float || next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
}
break;
case K_ACTION_EQ:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int == next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = ( fabs( op->result_float - next_int) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = ( fabs( op->result_int - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 0;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( fabs( op->result_float - next_int) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = ( fabs( op->result_float - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 0;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING)
{
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_STRING:
next->result_int = ( strcmp( op->result_string, next_string) == 0);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 0;
next->result_decl = K_DECL_INT;
}
break;
}
break;
case K_ACTION_NE:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int != next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = !( fabs( op->result_float - next_int) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = !( fabs( op->result_int - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 1;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = !( fabs( op->result_float - next_int) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = !( fabs( op->result_float - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 1;
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING)
{
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_STRING:
next->result_int = !( strcmp( op->result_string, next_string) == 0);
next->result_decl = K_DECL_INT;
break;
default:
next->result_int = 1;
next->result_decl = K_DECL_INT;
}
break;
}
break;
case K_ACTION_LT:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int < next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = ( op->result_float < next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_int < next_float);
next->result_decl = K_DECL_INT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_float < next_int);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_float < next_float);
next->result_decl = K_DECL_INT;
break;
}
break;
}
break;
case K_ACTION_GT:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int > next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = ( op->result_float > next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_int > next_float);
next->result_decl = K_DECL_INT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_float > next_int);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_float > next_float);
next->result_decl = K_DECL_INT;
break;
}
break;
}
break;
case K_ACTION_LE:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int <= next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = ( op->result_float <= next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_int <= next_float);
next->result_decl = K_DECL_INT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_float <= next_int);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_float <= next_float);
next->result_decl = K_DECL_INT;
break;
}
break;
}
break;
case K_ACTION_GE:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
switch ( op->result_decl) {
case K_DECL_INT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_int >= next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT)
{
next->result_int = ( op->result_float >= next_int);
next->result_decl = K_DECL_INT;
}
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_int >= next_float);
next->result_decl = K_DECL_INT;
break;
}
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT)
{
break;
case K_DECL_FLOAT:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ( op->result_float >= next_int);
next->result_decl = K_DECL_INT;
break;
case K_DECL_FLOAT:
next->result_int = ( op->result_float >= next_float);
next->result_decl = K_DECL_INT;
break;
}
break;
}
break;
case K_ACTION_INV:
if ( next_decl == K_DECL_INT)
{
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ! next_int;
next->result_decl = K_DECL_INT;
}
else
{
break;
default:
next->result_float = next_float;
next->result_decl = K_DECL_FLOAT;
break;
}
break;
case K_ACTION_BITAND:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) {
next->result_int = op->result_int & next_int;
next->result_decl = K_DECL_INT;
}
break;
case K_ACTION_BITOR:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) {
next->result_int = op->result_int | next_int;
next->result_decl = K_DECL_INT;
}
break;
case K_ACTION_LSHIFT:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) {
next->result_int = op->result_int << next_int;
next->result_decl = K_DECL_INT;
}
break;
case K_ACTION_RSHIFT:
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT)
{
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) {
next->result_int = op->result_int >> next_int;
next->result_decl = K_DECL_INT;
}
......@@ -2510,13 +2625,11 @@ int ccm_operate_exec(
}
op->done = 1;
if ( op->local_type == K_LOCTYPE_AFTER)
{
switch ( op->local_operator)
{
if ( op->local_type == K_LOCTYPE_AFTER) {
switch ( op->local_operator) {
case K_ACTION_INCR:
if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT)
{
if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT) {
op->value_int++;
op->value_float++;
sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float,
......@@ -2525,8 +2638,7 @@ int ccm_operate_exec(
}
break;
case K_ACTION_DECR:
if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT)
{
if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT) {
op->value_int--;
op->value_float--;
sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float,
......@@ -2560,67 +2672,72 @@ int ccm_execute_list(
op->orig_type = op->type;
exit_func_found = 0;
for ( op = funcctx->list; op; op = op->next)
{
if ( !op->prev)
{
for ( op = funcctx->list; op; op = op->next) {
if ( !op->prev) {
/* First in list */
if ( op->type == K_OPERAND_NAME)
{
if ( op->type == K_OPERAND_NAME) {
sts = ccm_getvar( funcctx, op->name, &op->value_decl,
&op->value_float, &op->value_int, op->value_string);
if ( EVEN(sts)) return sts;
}
if ( op->value_decl == K_DECL_FLOAT)
switch ( op->value_decl) {
case K_DECL_FLOAT:
op->result_float = op->value_float;
else if ( op->value_decl == K_DECL_INT)
break;
case K_DECL_INT:
op->result_int = op->value_int;
else
break;
default:
strcpy( op->result_string, op->value_string);
}
op->result_decl = op->value_decl;
op->result_done = 1;
if ( !op->next)
{
if ( !op->next) {
sts = ccm_operate_exec( funcctx, op, NULL);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
}
}
if ( !op->next)
{
if ( !op->next) {
/* Last in list */
for ( bp = op->prev; bp; bp = bp->prev)
{
if ( !bp->done)
{
for ( bp = op->prev; bp; bp = bp->prev) {
if ( !bp->done) {
sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
}
}
*result_decl = op->result_decl;
if ( op->result_decl == K_DECL_FLOAT)
switch ( op->result_decl) {
case K_DECL_FLOAT:
*result_float = op->result_float;
else if ( op->result_decl == K_DECL_INT)
break;
case K_DECL_INT:
*result_int = op->result_int;
else if ( op->result_decl == K_DECL_STRING)
break;
case K_DECL_STRING:
strcpy( result_string, op->result_string);
break;
default: ;
}
else
{
if ( op->next->parlevel > op->parlevel)
{
}
else {
if ( op->next->parlevel > op->parlevel) {
/* Left parenthesis */
if ( op->next->prio < op->prio)
{
for ( bp = op->prev; bp; bp = bp->prev)
{
if ( op->next->prio < op->prio) {
for ( bp = op->prev; bp; bp = bp->prev) {
if ( bp->parlevel < op->parlevel)
break;
if ( bp->parlevel > op->parlevel)
continue;
if ( bp->prio <= op->prio && !bp->done)
{
if ( bp->prio <= op->prio && !bp->done) {
sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
......@@ -2629,18 +2746,16 @@ int ccm_execute_list(
}
continue;
}
else if ( op->next->parlevel < op->parlevel)
{
else if ( op->next->parlevel < op->parlevel) {
/* Right parentheseis, sum sinc last right parenthes */
for ( bp = op; bp; bp = bp->prev)
{
for ( bp = op; bp; bp = bp->prev) {
if ( bp->parlevel < op->parlevel)
break;
if ( bp->parlevel > op->parlevel)
continue;
if ( !bp->done)
{
if ( !bp->done) {
sts = ccm_operate_exec( funcctx, bp, op->next);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
......@@ -2648,42 +2763,45 @@ int ccm_execute_list(
}
}
else
{
if ( op->next->prio < op->prio)
{
for ( bp = op->prev; bp; bp = bp->prev)
{
else {
if ( op->next->prio < op->prio) {
for ( bp = op->prev; bp; bp = bp->prev) {
if ( bp->parlevel < op->parlevel)
break;
if ( bp->parlevel > op->parlevel)
continue;
if ( bp->prio <= op->prio && !bp->done)
{
if ( bp->prio <= op->prio && !bp->done) {
sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
}
}
if ( op->next->type == K_OPERAND_NAME)
{
if ( op->next->type == K_OPERAND_NAME) {
sts = ccm_getvar( funcctx, op->next->name, &op->next->value_decl,
&op->next->value_float, &op->next->value_int,
op->next->value_string);
if ( EVEN(sts)) return sts;
}
if ( op->next->value_decl == K_DECL_FLOAT)
switch ( op->next->value_decl) {
case K_DECL_FLOAT:
op->next->result_float = op->next->value_float;
else if ( op->next->value_decl == K_DECL_INT)
break;
case K_DECL_INT:
op->next->result_int = op->next->value_int;
else if ( op->next->value_decl == K_DECL_STRING)
break;
case K_DECL_STRING:
strcpy( op->next->result_string, op->next->value_string);
break;
default: ;
}
op->next->result_decl = op->next->value_decl;
op->next->result_done = 1;
continue;
}
else
{
else {
sts = ccm_operate_exec( funcctx, op, op->next);
if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1;
......@@ -2723,8 +2841,8 @@ int ccm_line_exec(
funcctx->list = list;
for ( op = list; op; op = op->next)
{
for ( op = list; op; op = op->next) {
if ( ccm_testmode)
printf( "operator %d prio %d parlevel %d Name %s\n",
op->o_operator, op->prio, op->parlevel,
......@@ -2742,7 +2860,8 @@ int ccm_line_exec(
int ccm_singleline_init(
ccm_tSingleLineCtx *ctx,
char *line,
int (* errormessage_func) ( char *, int, void *)
int (* errormessage_func) ( char *, int, void *),
void *client_data
)
{
int sts;
......@@ -2757,7 +2876,7 @@ int ccm_singleline_init(
filectx->verify = 1;
filectx->main_arg_list = 0;
filectx->main_arg_count = 0;
filectx->client_data = 0;
filectx->client_data = client_data;
(*ctx)->funcctx->filectx = filectx;
......@@ -2785,6 +2904,52 @@ int ccm_singleline_exec(
return sts;
}
int ccm_singleline_exec_float(
ccm_tSingleLineCtx ctx,
ccm_tFloat *result
)
{
int sts;
sts = ccm_singleline_exec( ctx);
if ( ODD(sts)) {
switch ( ctx->result_decl) {
case CCM_DECL_INT:
*result = ctx->result_int;
break;
case CCM_DECL_FLOAT:
*result = ctx->result_float;
break;
default:
return CCM__VARTYPE;
}
}
return sts;
}
int ccm_singleline_exec_int(
ccm_tSingleLineCtx ctx,
ccm_tInt *result
)
{
int sts;
sts = ccm_singleline_exec( ctx);
if ( ODD(sts)) {
switch ( ctx->result_decl) {
case CCM_DECL_INT:
*result = ctx->result_int;
break;
case CCM_DECL_FLOAT:
*result = ctx->result_float;
break;
default:
return CCM__VARTYPE;
}
}
return sts;
}
void ccm_singleline_free(
ccm_tSingleLineCtx ctx
)
......
......@@ -251,13 +251,24 @@ int ccm_ref_external_var(
int ccm_singleline_init(
ccm_tSingleLineCtx *ctx,
char *line,
int (* errormessage_func) ( char *, int, void *)
int (* errormessage_func) ( char *, int, void *),
void *client_data
);
int ccm_singleline_exec(
ccm_tSingleLineCtx ctx
);
int ccm_singleline_exec_int(
ccm_tSingleLineCtx ctx,
ccm_tInt *result
);
int ccm_singleline_exec_float(
ccm_tSingleLineCtx ctx,
ccm_tFloat *result
);
void ccm_singleline_free(
ccm_tSingleLineCtx ctx
);
......
......@@ -509,6 +509,7 @@ void Lng::set( char *language)
if ( EVEN(sts)) return;
}
setlocale( LC_ALL, lang_to_locale( l));
setlocale( LC_NUMERIC, "POSIX");
}
pwr_tStatus Lng::set( lng_eLanguage language)
......@@ -528,6 +529,7 @@ pwr_tStatus Lng::set( lng_eLanguage language)
}
setlocale( LC_ALL, lang_to_locale( lang));
setlocale( LC_NUMERIC, "POSIX");
return 1;
}
......
......@@ -557,8 +557,6 @@ int main( int argc, char *argv[])
{
int sts;
setlocale( LC_TIME, "en_US");
new XttGtk( argc, argv, &sts);
exit(sts);
}
......@@ -596,6 +594,9 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
gtk_init( &argc, &argv);
setlocale( LC_TIME, "en_US");
setlocale( LC_NUMERIC, "POSIX");
syi_NodeName( &sts, nodename, sizeof(nodename));
if ( ODD(sts))
strcat( title, nodename);
......
......@@ -1138,8 +1138,8 @@ int GeCurve::read_file( char *filename)
cd->x_reverse = 0;
cd->cols = nr - 1;
cd->rows[0] = rows;
for ( i = 0; i < nr; i++) {
cd->rows[i] = rows;
if ( i == 0) {
strcpy( cd->x_name, item_str[i]);
cd->x_data[i] = (double *) malloc( rows * sizeof( double));
......
......@@ -66,7 +66,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
*sts = XNAV__SUCCESS;
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 0);
curve = new GeCurveGtk( this, parent_widget, title, NULL, gcd, 1);
curve->close_cb = sevhist_close_cb;
curve->help_cb = sevhist_help_cb;
curve->higher_res_cb = sevhist_higher_res_cb;
......
......@@ -53,6 +53,7 @@
#include "pwr_baseclasses.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_ccm_msg.h"
#include "rt_gdh.h"
#include "rt_gdh_msg.h"
#include "co_dcli.h"
......@@ -73,15 +74,63 @@
#endif
static void *xtt_logproc( void *arg);
static int log_ccm_registred = 0;
static int log_errormessage_func( char *msg, int severity, void *data)
{
((XttLogging *)data)->message( severity, msg);
printf( "Condition error: %s\n", msg);
return 1;
}
static int logccm_geta_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
int sts;
if ( arg_count != 1 || arg_list->value_decl != CCM_DECL_STRING)
return CCM__ARGMISM;
sts = gdh_GetObjectInfo( arg_list->value_string, return_float, sizeof(*return_float));
if ( EVEN(sts)) return sts;
*return_decl = CCM_DECL_FLOAT;
return 1;
}
static int logccm_getd_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
int sts;
if ( arg_count != 1 || arg_list->value_decl != CCM_DECL_STRING)
return CCM__ARGMISM;
sts = gdh_GetObjectInfo( arg_list->value_string, return_int, sizeof(*return_int));
if ( EVEN(sts)) return sts;
*return_decl = CCM_DECL_INT;
return 1;
}
XttLogging::XttLogging() :
xnav(0), index(0), active(0), intern(0), stop_logg(0),
logg_type(xtt_LoggType_Cont), logg_priority(0), condition_ptr(0),
logg_time(200), logg_file(0), line_size(10000), parameter_count(0),
print_shortname(0), buffer_size(100), wanted_buffer_size(100),
buffer_count(0), buffer_ptr(0)
buffer_count(0), buffer_ptr(0), cond_ccm_ctx(0)
{
for ( int i = 0; i < RTT_LOGG_MAXPAR; i++) {
parameterstr[i][0] = 0;
......@@ -215,17 +264,19 @@ int XttLogging::logging_set(
parameter_size[ par_index] = asize/aelem;
}
if ( condition != NULL)
{
/* Check that parameter exists */
if ( condition != NULL) {
if ( cdh_NoCaseStrncmp( condition, "EXPR(", 5) == 0)
strcpy ( conditionstr, condition);
else {
/* Attribute, Check that parameter exists */
sts = gdh_GetObjectInfo ( condition, &buffer, sizeof(buffer));
if (EVEN(sts))
{
if (EVEN(sts)) {
message('E',"Condition doesn't exist");
return XNAV__HOLDCOMMAND;
}
strcpy ( conditionstr, condition);
}
}
if ( a_logg_time != 0)
logg_time = a_logg_time;
......@@ -499,10 +550,24 @@ int XttLogging::store(
fprintf( outfile, "logging set/entry=current/parameter=\"%s\"\n",
parameterstr[i]);
}
if ( conditionstr[0] != 0)
fprintf( outfile, "logging set/entry=current/condition=\"%s\"\n",
conditionstr);
if ( conditionstr[0] != 0) {
pwr_tCmd cond;
char *s, *t;
// Replace " with \"
for ( s = conditionstr, t = cond; *s; s++) {
if ( *s == '"') {
*t = '\\';
t++;
}
*t = *s;
t++;
}
*t = 0;
fprintf( outfile, "logging set/entry=current/condition=\"%s\"\n",
cond);
}
if ( intern )
fprintf( outfile, "logging set/entry=current/stop\n");
else
......@@ -579,21 +644,50 @@ int XttLogging::start()
}
/* Get the condition */
if ( conditionstr[0] != 0)
{
sts = gdh_RefObjectInfo(
conditionstr,
if ( conditionstr[0] != 0) {
if ( cdh_NoCaseStrncmp( conditionstr, "EXPR(", 5) == 0) {
pwr_tCmd expr;
strncpy( expr, &conditionstr[5], sizeof(expr));
char *s = strrchr( expr, ')');
if ( !s) {
message('E', "Condition expression syntax error");
return XNAV__HOLDCOMMAND;
}
*s = 0;
if ( !log_ccm_registred) {
sts = ccm_register_function( "GetA", logccm_geta_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetD", logccm_getd_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetI", logccm_getd_func);
if ( EVEN(sts)) return sts;
log_ccm_registred = 1;
}
sts = ccm_singleline_init( &cond_ccm_ctx, expr, log_errormessage_func, this);
if ( EVEN(sts)) {
message('E', "Condition expression syntax error");
return XNAV__HOLDCOMMAND;
}
condition_ptr = 0;
}
else {
sts = gdh_RefObjectInfo( conditionstr,
(pwr_tAddress *) &condition_ptr,
&(condition_subid), 1);
if ( EVEN(sts))
{
if ( EVEN(sts)) {
condition_ptr = 0;
message('E', "Condition parameter not found");
return XNAV__HOLDCOMMAND;
}
cond_ccm_ctx = 0;
}
else
{
}
else {
condition_ptr = 0;
cond_ccm_ctx = 0;
}
/* Open the file */
......@@ -706,8 +800,14 @@ int XttLogging::entry_stop()
sts = gdh_UnrefObjectInfo ( parameter_subid[i]);
}
}
if ( condition_ptr != 0)
if ( condition_ptr != 0) {
sts = gdh_UnrefObjectInfo ( condition_subid);
condition_ptr = 0;
}
if ( cond_ccm_ctx != 0) {
ccm_singleline_free( cond_ccm_ctx);
cond_ccm_ctx = 0;
}
return XNAV__SUCCESS;
}
......@@ -783,6 +883,7 @@ static void *xtt_logproc( void *arg)
char timstr[64];
char parname[40];
char *s;
ccm_tInt cond;
pwr_tTime nextime;
pwr_tTime restime;
pwr_tDeltaTime deltatime;
......@@ -908,12 +1009,20 @@ static void *xtt_logproc( void *arg)
time_Aadd( &restime, &nextime, &deltatime);
nextime = restime;
if ( logg->condition_ptr != 0)
{
if ( logg->active && !logg->stop_logg)
{
if ( !*(logg->condition_ptr))
{
if ( logg->condition_ptr || logg->cond_ccm_ctx) {
if ( logg->active && !logg->stop_logg) {
if ( logg->condition_ptr)
cond = *logg->condition_ptr;
else {
sts = ccm_singleline_exec_int( logg->cond_ccm_ctx, &cond);
if ( EVEN(sts)) {
logg->message(' ', XNav::get_message(sts));
cond = 0;
}
}
if ( !cond) {
/* Don't log, wait until next scan */
#ifdef OS_VMS
time_PwrToVms( &nextime, &vmstime);
......
......@@ -22,6 +22,10 @@
/* xtt_logging.h -- Logging in xtt */
#ifndef co_ccm_h
#include "co_ccm.h"
#endif
#ifndef rt_gdh_h
#include "rt_gdh.h"
#endif
......@@ -80,6 +84,7 @@ class XttLogging {
int wanted_buffer_size;
int buffer_count;
char *buffer_ptr;
ccm_tSingleLineCtx cond_ccm_ctx;
void init( int logg_index, void *logg_xnav);
int logging_set(
......
......@@ -2890,15 +2890,15 @@ int XNav::show_logging( int index)
new ItemLocal( brow, Lng::translate("ShortName"), "logg_ShortName",
pwr_eType_Boolean, sizeof( logg[0].print_shortname), 0, 0, 0,
(void *) &logg[index].print_shortname, NULL, flow_eDest_IntoLast);
new ItemLocal( brow, Lng::translate("Condition"), "logg_CondPar",
pwr_eType_String, sizeof( logg[0].conditionstr), 0, 0, 0,
(void *) logg[index].conditionstr, NULL, flow_eDest_IntoLast);
for ( int i = 0; i < RTT_LOGG_MAXPAR; i++) {
sprintf( text, "%s%d", Lng::translate("Parameter"), i);
new ItemLocal( brow, text, text,
pwr_eType_String, sizeof( logg[0].parameterstr[0]), 0, 0, 0,
(void *) logg[index].parameterstr[i], NULL, flow_eDest_IntoLast);
}
new ItemLocal( brow, Lng::translate("ConditionParameter"), "logg_CondPar",
pwr_eType_String, sizeof( logg[0].conditionstr), 0, 0, 0,
(void *) logg[index].conditionstr, NULL, flow_eDest_IntoLast);
brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment