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 ...@@ -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. interruption when the buffer i written to file.
<h2>Conditional logging <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. 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 <h2>Store
The logging configuration is stored with the 'Store' button, and can be restored later The logging configuration is stored with the 'Store' button, and can be restored later
with the 'Restore' button. with the 'Restore' button.
......
...@@ -1129,9 +1129,19 @@ snabba tidskritiska f ...@@ -1129,9 +1129,19 @@ snabba tidskritiska f
att störningar som kan uppstå när bufferten skrivs på fil. att störningar som kan uppstå när bufferten skrivs på fil.
<h2>Villkorlig loggning <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. 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 <h2>Lagra
Logg konfigureringen kan sparas med 'Store' knappen, för att återskapas vid ett senare Logg konfigureringen kan sparas med 'Store' knappen, för att återskapas vid ett senare
tillfälle med 'Restore' knappen. tillfälle med 'Restore' knappen.
......
...@@ -1831,91 +1831,101 @@ int ccm_operate_exec( ...@@ -1831,91 +1831,101 @@ int ccm_operate_exec(
ccm_sOperand *op, ccm_sOperand *op,
ccm_sOperand *next) ccm_sOperand *next)
{ {
int next_decl; int next_decl;
ccm_tInt next_int; ccm_tInt next_int;
ccm_tFloat next_float; ccm_tFloat next_float;
ccm_tString next_string; ccm_tString next_string;
ccm_tString tmp_str; ccm_tString tmp_str;
int sts; int sts;
ccm_sOperand *op_arg; ccm_sOperand *op_arg;
ccm_sArg *arg_list; ccm_sArg *arg_list;
ccm_sArg *arg_p, *a_p, *next_arg; ccm_sArg *arg_p, *a_p, *next_arg;
int arg_count; int arg_count;
int exit_function_found; int exit_function_found;
exit_function_found = 0; exit_function_found = 0;
if ( next == NULL) if ( next == NULL) {
{
if ( !op->result_done) if ( !op->result_done) {
{ switch ( op->value_decl) {
if ( op->value_decl == K_DECL_FLOAT) case K_DECL_FLOAT:
op->result_float = op->value_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; op->result_int = op->value_int;
else break;
default:
strcpy( op->result_string, op->value_string); strcpy( op->result_string, op->value_string);
}
op->result_decl = op->value_decl; op->result_decl = op->value_decl;
} }
} }
else else {
{
if ( op->type == K_OPERAND_NO) if ( op->type == K_OPERAND_NO) {
{
if ( !next->result_done) if ( !next->result_done) {
{
if ( next->type == K_OPERAND_NAME ) if ( next->type == K_OPERAND_NAME ) {
{
sts = ccm_getvar( funcctx, next->name, &next->value_decl, sts = ccm_getvar( funcctx, next->name, &next->value_decl,
&next->value_float, &next->value_int, &next->value_float, &next->value_int,
next->value_string); next->value_string);
if ( EVEN(sts)) return sts; 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; 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; next->result_int = next->value_int;
else break;
default:
strcpy( next->result_string, next->value_string); strcpy( next->result_string, next->value_string);
}
next->result_decl = next->value_decl; 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, sts = ccm_getvar( funcctx, op->name, &op->value_decl, &op->value_float,
&op->value_int, op->value_string); &op->value_int, op->value_string);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
else if ( op->type == K_OPERAND_FUNCTION) else if ( op->type == K_OPERAND_FUNCTION) {
{
/* Create an argument list */ /* Create an argument list */
arg_list = 0; arg_list = 0;
arg_count = 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 && if ( op_arg->type == K_OPERAND_NO &&
op_arg->parlevel == op->parlevel - 1) op_arg->parlevel == op->parlevel - 1)
break; 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, sts = ccm_getvar( funcctx, op_arg->name, &op_arg->value_decl,
&op_arg->value_float, &op_arg->value_int, op_arg->value_string); &op_arg->value_float, &op_arg->value_int, op_arg->value_string);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
arg_p = calloc( 1, sizeof( ccm_sArg)); 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; 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; 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); strcpy( arg_p->value_string, op_arg->value_string);
break;
default: ;
}
arg_p->value_decl = op_arg->value_decl; arg_p->value_decl = op_arg->value_decl;
arg_p->value_type = op_arg->type; arg_p->value_type = op_arg->type;
strcpy( arg_p->value_name, op_arg->name); strcpy( arg_p->value_name, op_arg->name);
if ( arg_list == 0) if ( arg_list == 0)
arg_list = arg_p; arg_list = arg_p;
else else {
{
for ( a_p = arg_list; a_p->next; a_p = a_p->next) ; for ( a_p = arg_list; a_p->next; a_p = a_p->next) ;
a_p->next = arg_p; a_p->next = arg_p;
} }
...@@ -1930,11 +1940,10 @@ int ccm_operate_exec( ...@@ -1930,11 +1940,10 @@ int ccm_operate_exec(
op->result_string, 0); op->result_string, 0);
/* Set returned argument values and free argumentlist */ /* 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 && 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, sts = ccm_setvar( funcctx, arg_p->value_name, arg_p->value_decl,
arg_p->value_float, arg_p->value_int, arg_p->value_string); arg_p->value_float, arg_p->value_int, arg_p->value_string);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -1948,22 +1957,22 @@ int ccm_operate_exec( ...@@ -1948,22 +1957,22 @@ int ccm_operate_exec(
} }
if ( next->type == K_OPERAND_NAME && !next->result_done && 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, sts = ccm_getvar( funcctx, next->name, &next->value_decl, &next->value_float,
&next->value_int, next->value_string); &next->value_int, next->value_string);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
} }
if ( next->result_done) if ( next->result_done) {
{
/* Use result, not value for next-operand */ /* Use result, not value for next-operand */
next_decl = next->result_decl; next_decl = next->result_decl;
next_int = next->result_int; next_int = next->result_int;
next_float = next->result_float; next_float = next->result_float;
strcpy( next_string, next->result_string); strcpy( next_string, next->result_string);
} }
else else {
{
/* Use value for next-operand */ /* Use value for next-operand */
next_decl = next->value_decl; next_decl = next->value_decl;
next_int = next->value_int; next_int = next->value_int;
...@@ -1971,533 +1980,639 @@ int ccm_operate_exec( ...@@ -1971,533 +1980,639 @@ int ccm_operate_exec(
strcpy( next_string, next->value_string); 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_float = op->result_float;
next->result_int = op->result_int; next->result_int = op->result_int;
strcpy( next->result_string, op->result_string); strcpy( next->result_string, op->result_string);
next->result_decl = op->result_decl; 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; next_decl = op->value_decl;
} }
switch ( op->o_operator) switch ( op->o_operator) {
{ case K_ACTION_EQL:
case K_ACTION_EQL: sts = ccm_setvar( funcctx, op->name, next_decl, next_float, next_int,
sts = ccm_setvar( funcctx, op->name, next_decl, next_float, next_int, next_string);
next_string); if ( EVEN(sts)) return sts;
if ( EVEN(sts)) return sts; break;
break; case K_ACTION_RETURN:
case K_ACTION_RETURN: if ( !next->result_done) {
if ( !next->result_done)
{ next->result_decl = next_decl;
next->result_decl = next_decl; switch ( next_decl) {
if ( next_decl == K_DECL_INT) case K_DECL_INT:
next->result_int = next_int; next->result_int = next_int;
else if ( next_decl == K_DECL_FLOAT) break;
next->result_float = next_float; case K_DECL_FLOAT:
else if ( next_decl == K_DECL_STRING) next->result_float = next_float;
strcpy( next->result_string, next_string); break;
break; case K_DECL_STRING:
} strcpy( next->result_string, next_string);
case K_ACTION_MUL: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ }
break;
case K_ACTION_MUL:
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_int = op->result_int * next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int * next_float; next->result_float = op->result_int * next_float;
next->result_decl = K_DECL_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_float = op->result_float * next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
break; }
case K_ACTION_DIV: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_DIV:
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_int = op->result_int / next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int / next_float; next->result_float = op->result_int / next_float;
next->result_decl = K_DECL_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_float = op->result_float / next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
break; }
case K_ACTION_ADD: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_ADD:
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_int = op->result_int + next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int + next_float; next->result_float = op->result_int + next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT) case K_DECL_STRING:
{
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)
{
sprintf( next->result_string + strlen(next->result_string), sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, op->result_int); ccm_cIntFormat, op->result_int);
strncat( next->result_string, next_string, K_STRING_SIZE); strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0; next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING; next->result_decl = K_DECL_STRING;
} break;
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_INT) }
{ break;
strcpy( next->result_string, op->result_string); case K_DECL_FLOAT:
sprintf( next->result_string + strlen(next->result_string), switch ( next_decl) {
ccm_cIntFormat, next_int); case K_DECL_INT:
next->result_decl = K_DECL_STRING; next->result_float = op->result_float + next_int;
} next->result_decl = K_DECL_FLOAT;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_STRING) 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); ccm_float_to_string( tmp_str, op->result_float);
strcpy( next->result_string, tmp_str); strcpy( next->result_string, tmp_str);
strncat( next->result_string, next_string, K_STRING_SIZE); strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0; next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING; 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); strcpy( next->result_string, op->result_string);
ccm_float_to_string( tmp_str, next_float); ccm_float_to_string( tmp_str, next_float);
strncat( next->result_string, tmp_str, K_STRING_SIZE); strncat( next->result_string, tmp_str, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0; next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING; next->result_decl = K_DECL_STRING;
} break;
break; case K_DECL_STRING:
case K_ACTION_EQLADD: strcpy( next->result_string, op->result_string);
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_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;
}
break;
}
break;
case K_ACTION_EQLADD:
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_int = op->result_int + next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int + next_float; next->result_float = op->result_int + next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT) 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;
}
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_float = op->result_float + next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING) case K_DECL_STRING:
{ ccm_float_to_string( tmp_str, op->result_float);
strcpy( next->result_string, op->result_string); 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;
}
else if ( op->result_decl == K_DECL_INT && next_decl == 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); strncat( next->result_string, next_string, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0; next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING; next->result_decl = K_DECL_STRING;
} break;
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_INT) }
{ break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_INT:
strcpy( next->result_string, op->result_string); strcpy( next->result_string, op->result_string);
sprintf( next->result_string + strlen(next->result_string), sprintf( next->result_string + strlen(next->result_string),
ccm_cIntFormat, next_int); ccm_cIntFormat, next_int);
next->result_decl = K_DECL_STRING; next->result_decl = K_DECL_STRING;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_STRING) case K_DECL_FLOAT:
{
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;
}
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_FLOAT)
{
strcpy( next->result_string, op->result_string); strcpy( next->result_string, op->result_string);
ccm_float_to_string( tmp_str, next_float); ccm_float_to_string( tmp_str, next_float);
strncat( next->result_string, tmp_str, K_STRING_SIZE); strncat( next->result_string, tmp_str, K_STRING_SIZE);
next->result_string[K_STRING_SIZE-1] = 0; next->result_string[K_STRING_SIZE-1] = 0;
next->result_decl = K_DECL_STRING; next->result_decl = K_DECL_STRING;
} break;
sts = ccm_setvar( funcctx, op->name, next->result_decl, case K_DECL_STRING:
next->result_float, next->result_int, next->result_string); strcpy( next->result_string, op->result_string);
if ( EVEN(sts)) return sts; strncat( next->result_string, next_string, K_STRING_SIZE);
break; next->result_string[K_STRING_SIZE-1] = 0;
case K_ACTION_EQLSUB: next->result_decl = K_DECL_STRING;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) 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:
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_int = op->result_int - next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int - next_float; next->result_float = op->result_int - next_float;
next->result_decl = K_DECL_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_float = op->result_float - next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
sts = ccm_setvar( funcctx, op->name, next->result_decl, }
next->result_float, next->result_int, next->result_string); break;
if ( EVEN(sts)) return sts; }
break;
case K_ACTION_SUB: sts = ccm_setvar( funcctx, op->name, next->result_decl,
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) next->result_float, next->result_int, next->result_string);
{ if ( EVEN(sts)) return sts;
break;
case K_ACTION_SUB:
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_int = op->result_int - next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int - next_float; next->result_float = op->result_int - next_float;
next->result_decl = K_DECL_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_float = op->result_float - next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
break; }
case K_ACTION_AND: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_AND:
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_int = op->result_int && next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int && next_float; next->result_float = op->result_int && next_float;
next->result_decl = K_DECL_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_float = op->result_float && next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
break; }
case K_ACTION_OR: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_OR:
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_int = op->result_int || next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_float = op->result_int || next_float; next->result_float = op->result_int || next_float;
next->result_decl = K_DECL_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_float = op->result_float || next_float;
next->result_decl = K_DECL_FLOAT; next->result_decl = K_DECL_FLOAT;
} break;
break; }
case K_ACTION_EQ: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_EQ:
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_int = ( op->result_int == next_int);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_int = ( fabs( op->result_int - next_float) < FLT_EPSILON); next->result_int = ( fabs( op->result_int - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT) default:
{ next->result_int = 0;
next->result_decl = K_DECL_INT;
}
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_int = ( fabs( op->result_float - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING) default:
{ next->result_int = 0;
next->result_decl = K_DECL_INT;
}
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_STRING:
next->result_int = ( strcmp( op->result_string, next_string) == 0); next->result_int = ( strcmp( op->result_string, next_string) == 0);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; default:
next->result_int = 0;
next->result_decl = K_DECL_INT;
}
break;
}
break;
case K_ACTION_NE: 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_int = ( op->result_int != next_int);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_int = !( fabs( op->result_int - next_float) < FLT_EPSILON); next->result_int = !( fabs( op->result_int - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT) default:
{ next->result_int = 1;
next->result_decl = K_DECL_INT;
}
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_int = !( fabs( op->result_float - next_float) < FLT_EPSILON);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_STRING && next_decl == K_DECL_STRING) default:
{ next->result_int = 1;
next->result_decl = K_DECL_INT;
}
break;
case K_DECL_STRING:
switch ( next_decl) {
case K_DECL_STRING:
next->result_int = !( strcmp( op->result_string, next_string) == 0); next->result_int = !( strcmp( op->result_string, next_string) == 0);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; default:
case K_ACTION_LT: next->result_int = 1;
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; next->result_decl = K_DECL_INT;
} }
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) break;
{ }
next->result_int = ( op->result_float < next_int); break;
case K_ACTION_LT:
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; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_FLOAT) case K_DECL_FLOAT:
{
next->result_int = ( op->result_int < next_float); next->result_int = ( op->result_int < next_float);
next->result_decl = K_DECL_INT; 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_int = ( op->result_float < next_float);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; }
case K_ACTION_GT: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_GT:
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_int = ( op->result_int > next_int);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_int = ( op->result_int > next_float); next->result_int = ( op->result_int > next_float);
next->result_decl = K_DECL_INT; 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_int = ( op->result_float > next_float);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; }
case K_ACTION_LE: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_LE:
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_int = ( op->result_int <= next_int);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_int = ( op->result_int <= next_float); next->result_int = ( op->result_int <= next_float);
next->result_decl = K_DECL_INT; 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_int = ( op->result_float <= next_float);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; }
case K_ACTION_GE: break;
if ( op->result_decl == K_DECL_INT && next_decl == K_DECL_INT) }
{ break;
case K_ACTION_GE:
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_int = ( op->result_int >= next_int);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_INT) case K_DECL_FLOAT:
{
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)
{
next->result_int = ( op->result_int >= next_float); next->result_int = ( op->result_int >= next_float);
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
else if ( op->result_decl == K_DECL_FLOAT && next_decl == K_DECL_FLOAT) }
{ break;
next->result_int = ( op->result_float >= next_float); case K_DECL_FLOAT:
next->result_decl = K_DECL_INT; switch ( next_decl) {
} case K_DECL_INT:
break; next->result_int = ( op->result_float >= next_int);
case K_ACTION_INV:
if ( next_decl == K_DECL_INT)
{
next->result_int = ! next_int;
next->result_decl = K_DECL_INT;
}
else
{
next->result_float = next_float;
next->result_decl = K_DECL_FLOAT;
}
break;
case K_ACTION_BITAND:
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)
{
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)
{
next->result_int = op->result_int << next_int;
next->result_decl = K_DECL_INT; next->result_decl = K_DECL_INT;
} break;
break; case K_DECL_FLOAT:
case K_ACTION_RSHIFT: next->result_int = ( op->result_float >= next_float);
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; next->result_decl = K_DECL_INT;
} break;
break; }
case K_ACTION_CREALOCINT: break;
sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL, }
break;
case K_ACTION_INV:
switch ( next_decl) {
case K_DECL_INT:
next->result_int = ! next_int;
next->result_decl = K_DECL_INT;
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) {
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) {
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) {
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) {
next->result_int = op->result_int >> next_int;
next->result_decl = K_DECL_INT;
}
break;
case K_ACTION_CREALOCINT:
sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL,
&funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list); &funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREALOCFLOAT: case K_ACTION_CREALOCFLOAT:
sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL, sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL,
&funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list); &funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREALOCSTRING: case K_ACTION_CREALOCSTRING:
sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "", sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "",
&funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list); &funcctx->locint_list, &funcctx->locfloat_list, &funcctx->locstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAGBLINT: case K_ACTION_CREAGBLINT:
sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL, sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL,
&funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list); &funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAGBLFLOAT: case K_ACTION_CREAGBLFLOAT:
sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL, sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL,
&funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list); &funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAGBLSTRING: case K_ACTION_CREAGBLSTRING:
sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "", sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "",
&funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list); &funcctx->filectx->gblint_list, &funcctx->filectx->gblfloat_list, &funcctx->filectx->gblstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAEXTINT: case K_ACTION_CREAEXTINT:
sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL, sts = ccm_createvar( next->name, K_DECL_INT, 0, 0, NULL,
&extint_list, &extfloat_list, &extstring_list); &extint_list, &extfloat_list, &extstring_list);
if ( sts == CCM__VARALREXIST) if ( sts == CCM__VARALREXIST)
sts = CCM__SUCCESS; sts = CCM__SUCCESS;
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAEXTFLOAT: case K_ACTION_CREAEXTFLOAT:
sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL, sts = ccm_createvar( next->name, K_DECL_FLOAT, 0, 0, NULL,
&extint_list, &extfloat_list, &extstring_list); &extint_list, &extfloat_list, &extstring_list);
if ( sts == CCM__VARALREXIST) if ( sts == CCM__VARALREXIST)
sts = CCM__SUCCESS; sts = CCM__SUCCESS;
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_CREAEXTSTRING: case K_ACTION_CREAEXTSTRING:
sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "", sts = ccm_createvar( next->name, K_DECL_STRING, 0, 0, "",
&extint_list, &extfloat_list, &extstring_list); &extint_list, &extfloat_list, &extstring_list);
if ( sts == CCM__VARALREXIST) if ( sts == CCM__VARALREXIST)
sts = CCM__SUCCESS; sts = CCM__SUCCESS;
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
case K_ACTION_DELETE: case K_ACTION_DELETE:
sts = ccm_deletevar( next->name, sts = ccm_deletevar( next->name,
&extint_list, &extfloat_list, &extstring_list); &extint_list, &extfloat_list, &extstring_list);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
break; break;
} }
next->result_done = 1; next->result_done = 1;
if ( ccm_testmode) if ( ccm_testmode)
...@@ -2510,30 +2625,27 @@ int ccm_operate_exec( ...@@ -2510,30 +2625,27 @@ int ccm_operate_exec(
} }
op->done = 1; op->done = 1;
if ( op->local_type == K_LOCTYPE_AFTER) if ( op->local_type == K_LOCTYPE_AFTER) {
{
switch ( op->local_operator) switch ( op->local_operator) {
{ case K_ACTION_INCR:
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++;
op->value_int++; sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float,
op->value_float++; op->value_int, "");
sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float, if ( EVEN(sts)) return sts;
op->value_int, ""); }
if ( EVEN(sts)) return sts; break;
} case K_ACTION_DECR:
break; if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT) {
case K_ACTION_DECR: op->value_int--;
if ( op->value_decl == K_DECL_INT || op->value_decl == K_DECL_FLOAT) op->value_float--;
{ sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float,
op->value_int--; op->value_int, "");
op->value_float--; if ( EVEN(sts)) return sts;
sts = ccm_setvar( funcctx, op->name, op->value_decl, op->value_float, }
op->value_int, ""); break;
if ( EVEN(sts)) return sts;
}
break;
} }
} }
if ( exit_function_found) if ( exit_function_found)
...@@ -2560,67 +2672,72 @@ int ccm_execute_list( ...@@ -2560,67 +2672,72 @@ int ccm_execute_list(
op->orig_type = op->type; op->orig_type = op->type;
exit_func_found = 0; exit_func_found = 0;
for ( op = funcctx->list; op; op = op->next) for ( op = funcctx->list; op; op = op->next) {
{
if ( !op->prev) if ( !op->prev) {
{
/* First in list */ /* First in list */
if ( op->type == K_OPERAND_NAME) if ( op->type == K_OPERAND_NAME) {
{
sts = ccm_getvar( funcctx, op->name, &op->value_decl, sts = ccm_getvar( funcctx, op->name, &op->value_decl,
&op->value_float, &op->value_int, op->value_string); &op->value_float, &op->value_int, op->value_string);
if ( EVEN(sts)) return sts; 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; 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; op->result_int = op->value_int;
else break;
default:
strcpy( op->result_string, op->value_string); strcpy( op->result_string, op->value_string);
}
op->result_decl = op->value_decl; op->result_decl = op->value_decl;
op->result_done = 1; op->result_done = 1;
if ( !op->next)
{ if ( !op->next) {
sts = ccm_operate_exec( funcctx, op, NULL); sts = ccm_operate_exec( funcctx, op, NULL);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; if ( sts == CCM__EXITFUNC) exit_func_found = 1;
} }
} }
if ( !op->next) if ( !op->next) {
{
/* Last in list */ /* Last in list */
for ( bp = op->prev; bp; bp = bp->prev) for ( bp = op->prev; bp; bp = bp->prev) {
{ if ( !bp->done) {
if ( !bp->done)
{
sts = ccm_operate_exec( funcctx, bp, op); sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; if ( sts == CCM__EXITFUNC) exit_func_found = 1;
} }
} }
*result_decl = op->result_decl; *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; *result_float = op->result_float;
else if ( op->result_decl == K_DECL_INT) break;
case K_DECL_INT:
*result_int = op->result_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); strcpy( result_string, op->result_string);
break;
default: ;
}
} }
else else {
{
if ( op->next->parlevel > op->parlevel) if ( op->next->parlevel > op->parlevel) {
{
/* Left parenthesis */ /* Left parenthesis */
if ( op->next->prio < op->prio) if ( op->next->prio < op->prio) {
{
for ( bp = op->prev; bp; bp = bp->prev) for ( bp = op->prev; bp; bp = bp->prev) {
{
if ( bp->parlevel < op->parlevel) if ( bp->parlevel < op->parlevel)
break; break;
if ( bp->parlevel > op->parlevel) if ( bp->parlevel > op->parlevel)
continue; continue;
if ( bp->prio <= op->prio && !bp->done)
{ if ( bp->prio <= op->prio && !bp->done) {
sts = ccm_operate_exec( funcctx, bp, op); sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; if ( sts == CCM__EXITFUNC) exit_func_found = 1;
...@@ -2629,18 +2746,16 @@ int ccm_execute_list( ...@@ -2629,18 +2746,16 @@ int ccm_execute_list(
} }
continue; continue;
} }
else if ( op->next->parlevel < op->parlevel) else if ( op->next->parlevel < op->parlevel) {
{
/* Right parentheseis, sum sinc last right parenthes */ /* 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) if ( bp->parlevel < op->parlevel)
break; break;
if ( bp->parlevel > op->parlevel) if ( bp->parlevel > op->parlevel)
continue; continue;
if ( !bp->done) if ( !bp->done) {
{
sts = ccm_operate_exec( funcctx, bp, op->next); sts = ccm_operate_exec( funcctx, bp, op->next);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; if ( sts == CCM__EXITFUNC) exit_func_found = 1;
...@@ -2648,42 +2763,45 @@ int ccm_execute_list( ...@@ -2648,42 +2763,45 @@ int ccm_execute_list(
} }
} }
else else {
{
if ( op->next->prio < op->prio) if ( op->next->prio < op->prio) {
{
for ( bp = op->prev; bp; bp = bp->prev) for ( bp = op->prev; bp; bp = bp->prev) {
{
if ( bp->parlevel < op->parlevel) if ( bp->parlevel < op->parlevel)
break; break;
if ( bp->parlevel > op->parlevel) if ( bp->parlevel > op->parlevel)
continue; continue;
if ( bp->prio <= op->prio && !bp->done) if ( bp->prio <= op->prio && !bp->done) {
{
sts = ccm_operate_exec( funcctx, bp, op); sts = ccm_operate_exec( funcctx, bp, op);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; 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, sts = ccm_getvar( funcctx, op->next->name, &op->next->value_decl,
&op->next->value_float, &op->next->value_int, &op->next->value_float, &op->next->value_int,
op->next->value_string); op->next->value_string);
if ( EVEN(sts)) return sts; 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; 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; 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); strcpy( op->next->result_string, op->next->value_string);
break;
default: ;
}
op->next->result_decl = op->next->value_decl; op->next->result_decl = op->next->value_decl;
op->next->result_done = 1; op->next->result_done = 1;
continue; continue;
} }
else else {
{
sts = ccm_operate_exec( funcctx, op, op->next); sts = ccm_operate_exec( funcctx, op, op->next);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
if ( sts == CCM__EXITFUNC) exit_func_found = 1; if ( sts == CCM__EXITFUNC) exit_func_found = 1;
...@@ -2723,8 +2841,8 @@ int ccm_line_exec( ...@@ -2723,8 +2841,8 @@ int ccm_line_exec(
funcctx->list = list; funcctx->list = list;
for ( op = list; op; op = op->next) for ( op = list; op; op = op->next) {
{
if ( ccm_testmode) if ( ccm_testmode)
printf( "operator %d prio %d parlevel %d Name %s\n", printf( "operator %d prio %d parlevel %d Name %s\n",
op->o_operator, op->prio, op->parlevel, op->o_operator, op->prio, op->parlevel,
...@@ -2742,7 +2860,8 @@ int ccm_line_exec( ...@@ -2742,7 +2860,8 @@ int ccm_line_exec(
int ccm_singleline_init( int ccm_singleline_init(
ccm_tSingleLineCtx *ctx, ccm_tSingleLineCtx *ctx,
char *line, char *line,
int (* errormessage_func) ( char *, int, void *) int (* errormessage_func) ( char *, int, void *),
void *client_data
) )
{ {
int sts; int sts;
...@@ -2757,7 +2876,7 @@ int ccm_singleline_init( ...@@ -2757,7 +2876,7 @@ int ccm_singleline_init(
filectx->verify = 1; filectx->verify = 1;
filectx->main_arg_list = 0; filectx->main_arg_list = 0;
filectx->main_arg_count = 0; filectx->main_arg_count = 0;
filectx->client_data = 0; filectx->client_data = client_data;
(*ctx)->funcctx->filectx = filectx; (*ctx)->funcctx->filectx = filectx;
...@@ -2785,6 +2904,52 @@ int ccm_singleline_exec( ...@@ -2785,6 +2904,52 @@ int ccm_singleline_exec(
return sts; 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( void ccm_singleline_free(
ccm_tSingleLineCtx ctx ccm_tSingleLineCtx ctx
) )
......
...@@ -251,13 +251,24 @@ int ccm_ref_external_var( ...@@ -251,13 +251,24 @@ int ccm_ref_external_var(
int ccm_singleline_init( int ccm_singleline_init(
ccm_tSingleLineCtx *ctx, ccm_tSingleLineCtx *ctx,
char *line, char *line,
int (* errormessage_func) ( char *, int, void *) int (* errormessage_func) ( char *, int, void *),
void *client_data
); );
int ccm_singleline_exec( int ccm_singleline_exec(
ccm_tSingleLineCtx ctx 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( void ccm_singleline_free(
ccm_tSingleLineCtx ctx ccm_tSingleLineCtx ctx
); );
......
...@@ -509,6 +509,7 @@ void Lng::set( char *language) ...@@ -509,6 +509,7 @@ void Lng::set( char *language)
if ( EVEN(sts)) return; if ( EVEN(sts)) return;
} }
setlocale( LC_ALL, lang_to_locale( l)); setlocale( LC_ALL, lang_to_locale( l));
setlocale( LC_NUMERIC, "POSIX");
} }
pwr_tStatus Lng::set( lng_eLanguage language) pwr_tStatus Lng::set( lng_eLanguage language)
...@@ -528,6 +529,7 @@ 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_ALL, lang_to_locale( lang));
setlocale( LC_NUMERIC, "POSIX");
return 1; return 1;
} }
......
...@@ -557,8 +557,6 @@ int main( int argc, char *argv[]) ...@@ -557,8 +557,6 @@ int main( int argc, char *argv[])
{ {
int sts; int sts;
setlocale( LC_TIME, "en_US");
new XttGtk( argc, argv, &sts); new XttGtk( argc, argv, &sts);
exit(sts); exit(sts);
} }
...@@ -596,6 +594,9 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) : ...@@ -596,6 +594,9 @@ XttGtk::XttGtk( int argc, char *argv[], int *return_sts) :
gtk_init( &argc, &argv); gtk_init( &argc, &argv);
setlocale( LC_TIME, "en_US");
setlocale( LC_NUMERIC, "POSIX");
syi_NodeName( &sts, nodename, sizeof(nodename)); syi_NodeName( &sts, nodename, sizeof(nodename));
if ( ODD(sts)) if ( ODD(sts))
strcat( title, nodename); strcat( title, nodename);
......
...@@ -1138,8 +1138,8 @@ int GeCurve::read_file( char *filename) ...@@ -1138,8 +1138,8 @@ int GeCurve::read_file( char *filename)
cd->x_reverse = 0; cd->x_reverse = 0;
cd->cols = nr - 1; cd->cols = nr - 1;
cd->rows[0] = rows;
for ( i = 0; i < nr; i++) { for ( i = 0; i < nr; i++) {
cd->rows[i] = rows;
if ( i == 0) { if ( i == 0) {
strcpy( cd->x_name, item_str[i]); strcpy( cd->x_name, item_str[i]);
cd->x_data[i] = (double *) malloc( rows * sizeof( double)); cd->x_data[i] = (double *) malloc( rows * sizeof( double));
......
...@@ -66,7 +66,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx, ...@@ -66,7 +66,7 @@ XttSevHistGtk::XttSevHistGtk( void *parent_ctx,
*sts = XNAV__SUCCESS; *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->close_cb = sevhist_close_cb;
curve->help_cb = sevhist_help_cb; curve->help_cb = sevhist_help_cb;
curve->higher_res_cb = sevhist_higher_res_cb; curve->higher_res_cb = sevhist_higher_res_cb;
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
#include "pwr_baseclasses.h" #include "pwr_baseclasses.h"
#include "co_cdh.h" #include "co_cdh.h"
#include "co_time.h" #include "co_time.h"
#include "co_ccm_msg.h"
#include "rt_gdh.h" #include "rt_gdh.h"
#include "rt_gdh_msg.h" #include "rt_gdh_msg.h"
#include "co_dcli.h" #include "co_dcli.h"
...@@ -73,15 +74,63 @@ ...@@ -73,15 +74,63 @@
#endif #endif
static void *xtt_logproc( void *arg); 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() : XttLogging::XttLogging() :
xnav(0), index(0), active(0), intern(0), stop_logg(0), xnav(0), index(0), active(0), intern(0), stop_logg(0),
logg_type(xtt_LoggType_Cont), logg_priority(0), condition_ptr(0), logg_type(xtt_LoggType_Cont), logg_priority(0), condition_ptr(0),
logg_time(200), logg_file(0), line_size(10000), parameter_count(0), logg_time(200), logg_file(0), line_size(10000), parameter_count(0),
print_shortname(0), buffer_size(100), wanted_buffer_size(100), 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++) { for ( int i = 0; i < RTT_LOGG_MAXPAR; i++) {
parameterstr[i][0] = 0; parameterstr[i][0] = 0;
...@@ -215,16 +264,18 @@ int XttLogging::logging_set( ...@@ -215,16 +264,18 @@ int XttLogging::logging_set(
parameter_size[ par_index] = asize/aelem; parameter_size[ par_index] = asize/aelem;
} }
if ( condition != NULL) if ( condition != NULL) {
{ if ( cdh_NoCaseStrncmp( condition, "EXPR(", 5) == 0)
/* Check that parameter exists */ strcpy ( conditionstr, condition);
sts = gdh_GetObjectInfo ( condition, &buffer, sizeof(buffer)); else {
if (EVEN(sts)) /* Attribute, Check that parameter exists */
{ sts = gdh_GetObjectInfo ( condition, &buffer, sizeof(buffer));
message('E',"Condition doesn't exist"); if (EVEN(sts)) {
return XNAV__HOLDCOMMAND; message('E',"Condition doesn't exist");
return XNAV__HOLDCOMMAND;
}
strcpy ( conditionstr, condition);
} }
strcpy ( conditionstr, condition);
} }
if ( a_logg_time != 0) if ( a_logg_time != 0)
logg_time = a_logg_time; logg_time = a_logg_time;
...@@ -499,10 +550,24 @@ int XttLogging::store( ...@@ -499,10 +550,24 @@ int XttLogging::store(
fprintf( outfile, "logging set/entry=current/parameter=\"%s\"\n", fprintf( outfile, "logging set/entry=current/parameter=\"%s\"\n",
parameterstr[i]); parameterstr[i]);
} }
if ( conditionstr[0] != 0) 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", fprintf( outfile, "logging set/entry=current/condition=\"%s\"\n",
conditionstr); cond);
}
if ( intern ) if ( intern )
fprintf( outfile, "logging set/entry=current/stop\n"); fprintf( outfile, "logging set/entry=current/stop\n");
else else
...@@ -579,21 +644,50 @@ int XttLogging::start() ...@@ -579,21 +644,50 @@ int XttLogging::start()
} }
/* Get the condition */ /* Get the condition */
if ( conditionstr[0] != 0) if ( conditionstr[0] != 0) {
{ if ( cdh_NoCaseStrncmp( conditionstr, "EXPR(", 5) == 0) {
sts = gdh_RefObjectInfo( pwr_tCmd expr;
conditionstr,
(pwr_tAddress *) &condition_ptr, strncpy( expr, &conditionstr[5], sizeof(expr));
&(condition_subid), 1); char *s = strrchr( expr, ')');
if ( EVEN(sts)) if ( !s) {
{ message('E', "Condition expression syntax error");
message('E', "Condition parameter not found"); return XNAV__HOLDCOMMAND;
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)) {
condition_ptr = 0;
message('E', "Condition parameter not found");
return XNAV__HOLDCOMMAND;
}
cond_ccm_ctx = 0;
} }
} }
else else {
{
condition_ptr = 0; condition_ptr = 0;
cond_ccm_ctx = 0;
} }
/* Open the file */ /* Open the file */
...@@ -706,8 +800,14 @@ int XttLogging::entry_stop() ...@@ -706,8 +800,14 @@ int XttLogging::entry_stop()
sts = gdh_UnrefObjectInfo ( parameter_subid[i]); sts = gdh_UnrefObjectInfo ( parameter_subid[i]);
} }
} }
if ( condition_ptr != 0) if ( condition_ptr != 0) {
sts = gdh_UnrefObjectInfo ( condition_subid); 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; return XNAV__SUCCESS;
} }
...@@ -777,12 +877,13 @@ static void *xtt_logproc( void *arg) ...@@ -777,12 +877,13 @@ static void *xtt_logproc( void *arg)
char *value_ptr; char *value_ptr;
char *old_value_ptr; char *old_value_ptr;
int first_scan; int first_scan;
pwr_tObjid objid; pwr_tObjid objid;
pwr_sAttrRef *attrref; pwr_sAttrRef *attrref;
pwr_tAName hiername; pwr_tAName hiername;
char timstr[64]; char timstr[64];
char parname[40]; char parname[40];
char *s; char *s;
ccm_tInt cond;
pwr_tTime nextime; pwr_tTime nextime;
pwr_tTime restime; pwr_tTime restime;
pwr_tDeltaTime deltatime; pwr_tDeltaTime deltatime;
...@@ -908,12 +1009,20 @@ static void *xtt_logproc( void *arg) ...@@ -908,12 +1009,20 @@ static void *xtt_logproc( void *arg)
time_Aadd( &restime, &nextime, &deltatime); time_Aadd( &restime, &nextime, &deltatime);
nextime = restime; nextime = restime;
if ( logg->condition_ptr != 0) if ( logg->condition_ptr || logg->cond_ccm_ctx) {
{
if ( logg->active && !logg->stop_logg) if ( logg->active && !logg->stop_logg) {
{ if ( logg->condition_ptr)
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 */ /* Don't log, wait until next scan */
#ifdef OS_VMS #ifdef OS_VMS
time_PwrToVms( &nextime, &vmstime); time_PwrToVms( &nextime, &vmstime);
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
/* xtt_logging.h -- Logging in xtt */ /* xtt_logging.h -- Logging in xtt */
#ifndef co_ccm_h
#include "co_ccm.h"
#endif
#ifndef rt_gdh_h #ifndef rt_gdh_h
#include "rt_gdh.h" #include "rt_gdh.h"
#endif #endif
...@@ -80,6 +84,7 @@ class XttLogging { ...@@ -80,6 +84,7 @@ class XttLogging {
int wanted_buffer_size; int wanted_buffer_size;
int buffer_count; int buffer_count;
char *buffer_ptr; char *buffer_ptr;
ccm_tSingleLineCtx cond_ccm_ctx;
void init( int logg_index, void *logg_xnav); void init( int logg_index, void *logg_xnav);
int logging_set( int logging_set(
......
...@@ -2890,15 +2890,15 @@ int XNav::show_logging( int index) ...@@ -2890,15 +2890,15 @@ int XNav::show_logging( int index)
new ItemLocal( brow, Lng::translate("ShortName"), "logg_ShortName", new ItemLocal( brow, Lng::translate("ShortName"), "logg_ShortName",
pwr_eType_Boolean, sizeof( logg[0].print_shortname), 0, 0, 0, pwr_eType_Boolean, sizeof( logg[0].print_shortname), 0, 0, 0,
(void *) &logg[index].print_shortname, NULL, flow_eDest_IntoLast); (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++) { for ( int i = 0; i < RTT_LOGG_MAXPAR; i++) {
sprintf( text, "%s%d", Lng::translate("Parameter"), i); sprintf( text, "%s%d", Lng::translate("Parameter"), i);
new ItemLocal( brow, text, text, new ItemLocal( brow, text, text,
pwr_eType_String, sizeof( logg[0].parameterstr[0]), 0, 0, 0, pwr_eType_String, sizeof( logg[0].parameterstr[0]), 0, 0, 0,
(void *) logg[index].parameterstr[i], NULL, flow_eDest_IntoLast); (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_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, 0); 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