Commit 58b63c23 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

sig-parser working as before 2014 reorganization. Still WiP

parent 68cb6c1f
...@@ -54,6 +54,8 @@ ifeq ($(LABCOMM_EXPERIMENTAL),true) ...@@ -54,6 +54,8 @@ ifeq ($(LABCOMM_EXPERIMENTAL),true)
experimental/labcomm_sig_parser.o \ experimental/labcomm_sig_parser.o \
experimental/test_sig_parser.o experimental/test_sig_parser.o
experimental/test_sig_parser : experimental/labcomm_sig_parser.o experimental/test_sig_parser.c
endif endif
## Targets ## Targets
......
/* labcomm_sig_parser.c: /* labcomm_sig_parser.c:
* an example parser for labcomm signatures, illustrating how to skip samples * an example parser for labcomm signatures, illustrating how to skip samples
* based on their signature. Intended as an embryo for introducing this * based on their signature. Intended as an embryo for introducing this
* functionality into the lib to allow a channel to survive types with no * functionality into the lib to allow a channel to survive types with no
* registered handler. * registered handler.
*/ */
...@@ -9,20 +9,20 @@ ...@@ -9,20 +9,20 @@
/* TODO, and notes about strange quirks /* TODO, and notes about strange quirks
* *
* - the return values for the accept_ functions are not really used anymore * - the return values for the accept_ functions are not really used anymore
* as the parser "peeks" and calls the correct accept function instead. * as the parser "peeks" and calls the correct accept function instead.
* This should be refactored * This should be refactored
* *
* - The RETURN_STRINGS and where/if to allocate strings is to be decided, it * - The RETURN_STRINGS and where/if to allocate strings is to be decided, it
* is currently not used * is currently not used
* *
* - TYPE_DECL is not tested (is it ever sent?) * - TYPE_DECL is not tested (is it ever sent?)
* *
* - The dynamic allocation of the parser is not quite dynamic, the sizes are * - The dynamic allocation of the parser is not quite dynamic, the sizes are
* set through the init function, and are then static. * set through the init function, and are then static.
* This should be adapted when allocation is parameterized/user-definable * This should be adapted when allocation is parameterized/user-definable
* for the entire lib. * for the entire lib.
*/ */
#include <stdlib.h> #include <stdlib.h>
...@@ -38,49 +38,49 @@ static void error(char *s) { ...@@ -38,49 +38,49 @@ static void error(char *s) {
} }
/* aux method for reading a big endian uint32 from a char* (i.e. ntohl but for explicit char*) */ /* aux method for reading a big endian uint32 from a char* (i.e. ntohl but for explicit char*) */
static unsigned int unpack32(unsigned char *c, unsigned int idx) { static int unpack32(unsigned char *c, int idx) {
unsigned int b0=(c[idx]) << 3 ; int b0=(c[idx]) << 3 ;
unsigned int b1=(c[idx+1]) << 2 ; int b1=(c[idx+1]) << 2 ;
unsigned int b2=(c[idx+2]) << 1 ; int b2=(c[idx+2]) << 1 ;
unsigned int b3=c[idx+3]; int b3=c[idx+3];
return b0 | b1 | b2 | b3; return b0 | b1 | b2 | b3;
} }
static inline unsigned int get32(labcomm_sig_parser_t *b) { static inline int get32(labcomm_sig_parser_t *b) {
unsigned int res = unpack32(b->c, b->idx); int res = unpack32(b->c, b->idx);
b->idx+=4; b->idx+=4;
return res; return res;
} }
/* aux method for reading labcomm varint from a char* /* aux method for reading labcomm varint from a char*
size is an out parameter: if not NULL the number of bytes read will be written here size is an out parameter: if not NULL the number of bytes read will be written here
*/ */
static unsigned int unpack_varint(unsigned char *buf, static int unpack_varint(unsigned char *buf,
unsigned int idx, int idx,
unsigned char *size) size_t *size)
{ {
unsigned int res = 0; int res = 0;
unsigned int i=0; unsigned int i=0;
unsigned char cont = TRUE; unsigned char cont = TRUE;
do { do {
unsigned char c = buf[idx+i]; char c = buf[idx+i];
res = (res << 7) | (c & 0x7f); res = (res << 7) | (c & 0x7f);
cont = c & 0x80; cont = c & 0x80;
i++; i++;
} while(cont); } while(cont);
if(size != NULL) if(size != NULL)
*size = i; *size = i;
return res; return res;
} }
void dumpValStack(labcomm_sig_parser_t *b) { void dumpValStack(labcomm_sig_parser_t *b) {
int i;
printf("=== value stack: "); printf("=== value stack: ");
#ifdef DEBUG_STACK_VERBOSE #ifdef DEBUG_STACK_VERBOSE
int i;
for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS
printf("%2.2x ", b->val_stack[i]); printf("%2.2x ", b->val_stack[i]);
} }
...@@ -88,9 +88,9 @@ void dumpValStack(labcomm_sig_parser_t *b) { ...@@ -88,9 +88,9 @@ void dumpValStack(labcomm_sig_parser_t *b) {
printf(" top==%d\n", b->val_top); printf(" top==%d\n", b->val_top);
} }
void dumpPtrStack(labcomm_sig_parser_t *b) { void dumpPtrStack(labcomm_sig_parser_t *b) {
int i;
printf("=== pointer stack: "); printf("=== pointer stack: ");
#ifdef DEBUG_STACK_VERBOSE #ifdef DEBUG_STACK_VERBOSE
int i;
for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS for(i=0; i<STACK_SIZE; i++) { //HERE BE DRAGONS
printf("%2.2x ", b->ptr_stack[i]); printf("%2.2x ", b->ptr_stack[i]);
} }
...@@ -130,10 +130,10 @@ void* pop_ptr(labcomm_sig_parser_t *b) { ...@@ -130,10 +130,10 @@ void* pop_ptr(labcomm_sig_parser_t *b) {
#endif #endif
return b->ptr_stack[b->ptr_top]; return b->ptr_stack[b->ptr_top];
} }
int labcomm_sig_parser_init(labcomm_sig_parser_t *b, size_t buffer_size, int labcomm_sig_parser_init(labcomm_sig_parser_t *b, size_t buffer_size,
size_t stacksize, size_t num_signatures, size_t stacksize, size_t num_signatures,
size_t max_name_len, size_t max_sig_len) size_t max_name_len, size_t max_sig_len)
{ {
b->c = malloc(buffer_size); b->c = malloc(buffer_size);
b->capacity = buffer_size; b->capacity = buffer_size;
...@@ -176,7 +176,7 @@ int labcomm_sig_parser_read_file(labcomm_sig_parser_t *b, FILE *f) { ...@@ -176,7 +176,7 @@ int labcomm_sig_parser_read_file(labcomm_sig_parser_t *b, FILE *f) {
return s; return s;
} }
int more(labcomm_sig_parser_t *b) int more(labcomm_sig_parser_t *b)
{ {
return b->idx < b->size; return b->idx < b->size;
} }
...@@ -197,31 +197,31 @@ void advancen(labcomm_sig_parser_t *b, size_t n) { ...@@ -197,31 +197,31 @@ void advancen(labcomm_sig_parser_t *b, size_t n) {
b->idx+=n; b->idx+=n;
} }
unsigned int peek_varint(labcomm_sig_parser_t *b, unsigned char *size) { int peek_varint(labcomm_sig_parser_t *b, size_t *size) {
return unpack_varint(b->c, b->idx, size); return unpack_varint(b->c, b->idx, size);
} }
unsigned int get_varint(labcomm_sig_parser_t *b) { int get_varint(labcomm_sig_parser_t *b) {
unsigned char size; size_t size;
unsigned int res = peek_varint(b, &size); int res = peek_varint(b, &size);
advancen(b, size); advancen(b, size);
return res; return res;
} }
unsigned int get_varint_size(labcomm_sig_parser_t *b, unsigned char *size) { int get_varint_size(labcomm_sig_parser_t *b, size_t *size) {
unsigned int res = peek_varint(b, size); unsigned int res = peek_varint(b, size);
advancen(b, *size); advancen(b, *size);
return res; return res;
} }
void getStr(labcomm_sig_parser_t *b, char *dest, size_t size) { void getStr(labcomm_sig_parser_t *b, unsigned char *dest, size_t size) {
int rem = b->size - b->idx; int rem = b->size - b->idx;
if( size > rem ) if( size > rem )
size = rem; size = rem;
strncpy(dest, &b->c[b->idx], size); strncpy((char *)dest, (char *)&b->c[b->idx], size);
b->idx += size; b->idx += size;
} }
struct labcomm_signature *get_sig_t(labcomm_sig_parser_t *p, unsigned int uid) struct labcomm_signature *get_sig_t(labcomm_sig_parser_t *p, unsigned int uid)
{ {
return &(p->sig_ts[uid-LABCOMM_USER]); return &(p->sig_ts[uid-LABCOMM_USER]);
} }
...@@ -240,7 +240,7 @@ unsigned char* get_signature(labcomm_sig_parser_t *p, unsigned int uid){ ...@@ -240,7 +240,7 @@ unsigned char* get_signature(labcomm_sig_parser_t *p, unsigned int uid){
// return signatures_name_length[uid-LABCOMM_USER]; // return signatures_name_length[uid-LABCOMM_USER];
//} //}
unsigned char* get_signature_name(labcomm_sig_parser_t *p, unsigned int uid){ char* get_signature_name(labcomm_sig_parser_t *p, unsigned int uid){
//return signatures_name[uid-LABCOMM_USER]; //return signatures_name[uid-LABCOMM_USER];
return p->sig_ts[uid-LABCOMM_USER].name; return p->sig_ts[uid-LABCOMM_USER].name;
} }
...@@ -265,19 +265,20 @@ static size_t labcomm_sizeof_primitive(unsigned int type) ...@@ -265,19 +265,20 @@ static size_t labcomm_sizeof_primitive(unsigned int type)
{ {
switch(type) { switch(type) {
case TYPE_BOOLEAN : case TYPE_BOOLEAN :
case TYPE_BYTE : case TYPE_BYTE :
return 1; return 1;
case TYPE_SHORT : case TYPE_SHORT :
return 2; return 2;
case TYPE_INTEGER : case TYPE_INTEGER :
case TYPE_FLOAT : case TYPE_FLOAT :
return 4; return 4;
case TYPE_LONG : case TYPE_LONG :
case TYPE_DOUBLE : case TYPE_DOUBLE :
return 8; return 8;
default: default:
printf("labcomm_sizeof_primitive(%x)\n", type); printf("labcomm_sizeof_primitive(%x)\n", type);
error("labcomm_sizeof_primitive should only be called for primitive types"); error("labcomm_sizeof_primitive should only be called for primitive types");
return 0;
} }
} }
...@@ -286,16 +287,19 @@ static size_t labcomm_sizeof_primitive(unsigned int type) ...@@ -286,16 +287,19 @@ static size_t labcomm_sizeof_primitive(unsigned int type)
//static int accept_sample_decl(labcomm_sig_parser_t *d); //static int accept_sample_decl(labcomm_sig_parser_t *d);
static int accept_user_id(labcomm_sig_parser_t *d); static int accept_user_id(labcomm_sig_parser_t *d);
static int accept_string(labcomm_sig_parser_t *d); static int accept_string(labcomm_sig_parser_t *d);
static int accept_string_length(labcomm_sig_parser_t *d);
static int accept_char(labcomm_sig_parser_t *d);
static int accept_type(labcomm_sig_parser_t *d); static int accept_type(labcomm_sig_parser_t *d);
static int accept_array_decl(labcomm_sig_parser_t *d); static int accept_array_decl(labcomm_sig_parser_t *d);
#if 0
// UNUSED declarations
static int accept_string_length(labcomm_sig_parser_t *d);
static int accept_char(labcomm_sig_parser_t *d);
static int accept_number_of_indices(labcomm_sig_parser_t *d); static int accept_number_of_indices(labcomm_sig_parser_t *d);
static int accept_indices(labcomm_sig_parser_t *d); static int accept_indices(labcomm_sig_parser_t *d);
static int accept_variable_index(labcomm_sig_parser_t *d); static int accept_variable_index(labcomm_sig_parser_t *d);
static int accept_fixed_index(labcomm_sig_parser_t *d); static int accept_fixed_index(labcomm_sig_parser_t *d);
static int accept_struct_decl(labcomm_sig_parser_t *d);
static int accept_number_of_fields(labcomm_sig_parser_t *d); static int accept_number_of_fields(labcomm_sig_parser_t *d);
#endif
static int accept_struct_decl(labcomm_sig_parser_t *d);
static int accept_field(labcomm_sig_parser_t *d); static int accept_field(labcomm_sig_parser_t *d);
static int accept_sample_data(labcomm_sig_parser_t *d); static int accept_sample_data(labcomm_sig_parser_t *d);
...@@ -323,13 +327,13 @@ int encoded_size_static(struct labcomm_signature *sig, void *unused) ...@@ -323,13 +327,13 @@ int encoded_size_static(struct labcomm_signature *sig, void *unused)
#endif #endif
} }
/* This function probably never will be implemented, as it would be /* This function probably never will be implemented, as it would be
similar to skip_packed_sample_data. And if unregistered variable size similar to skip_packed_sample_data. And if unregistered variable size
samples is to be handled, the proper way is to generate and register samples is to be handled, the proper way is to generate and register
a handler. Thus, the most probable use of the encoded_size function a handler. Thus, the most probable use of the encoded_size function
on the receiver side, is to skip unhandled samples. on the receiver side, is to skip unhandled samples.
*/ */
int encoded_size_parse_sig(struct labcomm_signature *sig, void *sample) int encoded_size_parse_sig(struct labcomm_signature *sig, void *sample)
{ {
printf("Warning: encoded_size_parse_sig not implemented\n"); printf("Warning: encoded_size_parse_sig not implemented\n");
...@@ -350,12 +354,18 @@ static int accept_signature(labcomm_sig_parser_t *d) ...@@ -350,12 +354,18 @@ static int accept_signature(labcomm_sig_parser_t *d)
free(str); free(str);
#endif #endif
unsigned char lenlen = labcomm_varint_sizeof(nlen); unsigned char lenlen = labcomm_varint_sizeof(nlen);
get_varint(d); // ignore sig len
VERBOSE_PRINTF("\ntype = "); VERBOSE_PRINTF("\ntype = ");
accept_type(d); accept_type(d);
//printf(" : "); //printf(" : ");
//unsigned int dt = pop(d); //unsigned int dt = pop(d);
#ifdef USE_TYPE_AND_SIZE
unsigned int type = pop_val(d); unsigned int type = pop_val(d);
unsigned int enc_size = pop_val(d); unsigned int enc_size = pop_val(d);
#else
pop_val(d); // unsigned int type
pop_val(d); // unsigned int enc_size
#endif
unsigned int end = d->idx; unsigned int end = d->idx;
unsigned int len = end-start; unsigned int len = end-start;
...@@ -379,7 +389,7 @@ static int accept_signature(labcomm_sig_parser_t *d) ...@@ -379,7 +389,7 @@ static int accept_signature(labcomm_sig_parser_t *d)
error("sig name longer than max length (this ought to be dynamic..."); error("sig name longer than max length (this ought to be dynamic...");
} }
VERBOSE_PRINTF("signature for uid %x: %s (start=%x,end=%x, nlen=%d,len=%d)\n", uid, get_signature_name(d, uid), start,end, nlen, len); VERBOSE_PRINTF("signature for uid %x: %s (start=%x,end=%x, nlen=%d,len=%d)\n", uid, get_signature_name(d, uid), start,end, nlen, len);
INFO_PRINTF("SIG: %s\n", newsig->name); INFO_PRINTF("SIG: %s\n", newsig->name);
#ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE #ifdef LABCOMM_EXPERIMENTAL_CACHED_ENCODED_SIZE
if(! d->current_decl_is_varsize) { if(! d->current_decl_is_varsize) {
newsig->cached_encoded_size = enc_size; newsig->cached_encoded_size = enc_size;
...@@ -393,21 +403,25 @@ static int accept_signature(labcomm_sig_parser_t *d) ...@@ -393,21 +403,25 @@ static int accept_signature(labcomm_sig_parser_t *d)
#endif #endif
return TRUE; return TRUE;
} else { } else {
error("sample_decl with uid < LABCOMM_USER"); error("sample_decl with uid < LABCOMM_USER");
return FALSE; return FALSE;
} }
} }
// HERE BE DRAGONS! what does the return value mean? // HERE BE DRAGONS! what does the return value mean?
int accept_packet(labcomm_sig_parser_t *d) { int accept_packet(labcomm_sig_parser_t *d) {
unsigned char nbytes; size_t nbytes;
unsigned int type = peek_varint(d, &nbytes) ; unsigned int type = peek_varint(d, &nbytes) ;
if(type == VERSION ) { if(type == VERSION ) {
//XXX is this used? If so, is it correct? advancen(d, nbytes);//consume type field
advancen(d, nbytes); get_varint(d); //ignore length field
VERBOSE_PRINTF("ignoring version "); VERBOSE_PRINTF("got version.\n");
int len = get_varint(d); //ignore length field accept_string(d);
advancen(d, len); pop_val(d); // ignore length, for now
#ifdef RETURN_STRINGS
char *str = (char *) pop_ptr(d);
free(str);
#endif
}else if(type == TYPE_DECL ) { }else if(type == TYPE_DECL ) {
//XXX is this used? If so, is it correct? //XXX is this used? If so, is it correct?
advancen(d, nbytes); advancen(d, nbytes);
...@@ -429,17 +443,24 @@ int accept_packet(labcomm_sig_parser_t *d) { ...@@ -429,17 +443,24 @@ int accept_packet(labcomm_sig_parser_t *d) {
accept_sample_data(d); accept_sample_data(d);
#endif #endif
} else { } else {
error("got unknown type (<LABCOMM_USER)"); #ifdef EXIT_ON_UNKNOWN_TAG
error("got unknown type (<LABCOMM_USER)");
exit(1); exit(1);
#else
int len = get_varint(d); //ignore length field
printf("got unknown tag: 0x%x, skipping %d bytes\n",type, len);
advancen(d, len);
#endif
} }
return TRUE;
} }
static int accept_user_id(labcomm_sig_parser_t *d){ static int accept_user_id(labcomm_sig_parser_t *d){
unsigned char nbytes; size_t nbytes;
unsigned int uid = peek_varint(d, &nbytes); int uid = peek_varint(d, &nbytes);
if(uid >= LABCOMM_USER) { if(uid >= LABCOMM_USER) {
advancen(d, nbytes); advancen(d, nbytes);
VERBOSE_PRINTF("uid = %x ", uid); VERBOSE_PRINTF("uid = 0x%x ", uid);
push_val(d, uid); push_val(d, uid);
return TRUE; return TRUE;
} else { } else {
...@@ -449,8 +470,8 @@ static int accept_user_id(labcomm_sig_parser_t *d){ ...@@ -449,8 +470,8 @@ static int accept_user_id(labcomm_sig_parser_t *d){
static int accept_string(labcomm_sig_parser_t *d){ static int accept_string(labcomm_sig_parser_t *d){
unsigned int len = get_varint(d); unsigned int len = get_varint(d);
char *str=malloc(len); unsigned char *str=malloc(len);
getStr(d, str, len); getStr(d, str, len);
VERBOSE_PRINTF("%s", str); VERBOSE_PRINTF("%s", str);
#ifdef RETURN_STRINGS #ifdef RETURN_STRINGS
push_ptr(d, str); push_ptr(d, str);
...@@ -462,7 +483,7 @@ static int accept_string(labcomm_sig_parser_t *d){ ...@@ -462,7 +483,7 @@ static int accept_string(labcomm_sig_parser_t *d){
} }
/* pushes size and type id */ /* pushes size and type id */
static int accept_type(labcomm_sig_parser_t *d){ static int accept_type(labcomm_sig_parser_t *d){
unsigned char nbytes; size_t nbytes;
unsigned int type = peek_varint(d, &nbytes) ; unsigned int type = peek_varint(d, &nbytes) ;
switch(type) { switch(type) {
case TYPE_BOOLEAN : case TYPE_BOOLEAN :
...@@ -527,8 +548,8 @@ static int accept_type(labcomm_sig_parser_t *d){ ...@@ -527,8 +548,8 @@ static int accept_type(labcomm_sig_parser_t *d){
/* pushes size and element type */ /* pushes size and element type */
static int accept_array_decl(labcomm_sig_parser_t *d){ static int accept_array_decl(labcomm_sig_parser_t *d){
unsigned char nbytes; size_t nbytes;
unsigned int tid = peek_varint(d, &nbytes) ; int tid = peek_varint(d, &nbytes) ;
if(tid == ARRAY_DECL) { if(tid == ARRAY_DECL) {
advancen(d, nbytes); advancen(d, nbytes);
unsigned int nidx = get_varint(d); unsigned int nidx = get_varint(d);
...@@ -575,15 +596,17 @@ static int accept_array_decl(labcomm_sig_parser_t *d){ ...@@ -575,15 +596,17 @@ static int accept_array_decl(labcomm_sig_parser_t *d){
/* pushes size */ /* pushes size */
static int accept_struct_decl(labcomm_sig_parser_t *d){ static int accept_struct_decl(labcomm_sig_parser_t *d){
unsigned char nbytes; size_t nbytes;
unsigned int tid = peek_varint(d, &nbytes) ; int tid = peek_varint(d, &nbytes) ;
if(tid == STRUCT_DECL) { if(tid == STRUCT_DECL) {
advancen(d, nbytes); advancen(d, nbytes);
unsigned int nf = get_varint(d); unsigned int nf = get_varint(d);
VERBOSE_PRINTF("%d field struct:\n", nf); VERBOSE_PRINTF("%d field struct:\n", nf);
int i; int i;
#ifdef USE_UNUSED_VARS
int numVar=0; int numVar=0;
int size=0; int size=0;
#endif
unsigned int fieldsizes=0; unsigned int fieldsizes=0;
for(i=0; i<nf; i++) { for(i=0; i<nf; i++) {
accept_field(d); accept_field(d);
...@@ -612,10 +635,11 @@ static int accept_field(labcomm_sig_parser_t *d){ ...@@ -612,10 +635,11 @@ static int accept_field(labcomm_sig_parser_t *d){
pop_val(d); // ignore type, for now pop_val(d); // ignore type, for now
// push(pop() is really a NOP , leave size on the stack when debugging done // push(pop() is really a NOP , leave size on the stack when debugging done
VERBOSE_PRINTF("\n"); VERBOSE_PRINTF("\n");
return TRUE;
} }
static int accept_sample_data(labcomm_sig_parser_t *d){ static int accept_sample_data(labcomm_sig_parser_t *d){
accept_user_id(d); accept_user_id(d);
unsigned int uid = pop_val(d); unsigned int uid = pop_val(d);
printf("sample data... uid=0x%x\n", uid); printf("sample data... uid=0x%x\n", uid);
int len = get_varint(d); //length field int len = get_varint(d); //length field
#ifdef DEBUG #ifdef DEBUG
...@@ -633,12 +657,12 @@ static int accept_sample_data(labcomm_sig_parser_t *d){ ...@@ -633,12 +657,12 @@ static int accept_sample_data(labcomm_sig_parser_t *d){
return TRUE; return TRUE;
} }
static int skip_type(unsigned int,labcomm_sig_parser_t*,unsigned char*,unsigned int,unsigned int*) ; static int skip_type(unsigned int,labcomm_sig_parser_t*,unsigned char*,unsigned int,int*) ;
static int skip_array(labcomm_sig_parser_t *d, unsigned char *sig, unsigned int len, unsigned int *pos) { static int skip_array(labcomm_sig_parser_t *d, unsigned char *sig, int len, int *pos) {
unsigned int skip = 0; unsigned int skip = 0;
unsigned int tot_nbr_elem_tmp = 1; unsigned int tot_nbr_elem_tmp = 1;
unsigned char nbytes; size_t nbytes;
unsigned int nIdx = unpack_varint(sig, *pos, &nbytes); unsigned int nIdx = unpack_varint(sig, *pos, &nbytes);
VERBOSE_PRINTF("skip_array: nIdx = %d (from sig)\n", nIdx); VERBOSE_PRINTF("skip_array: nIdx = %d (from sig)\n", nIdx);
*pos +=nbytes; *pos +=nbytes;
...@@ -657,17 +681,17 @@ static int skip_array(labcomm_sig_parser_t *d, unsigned char *sig, unsigned int ...@@ -657,17 +681,17 @@ static int skip_array(labcomm_sig_parser_t *d, unsigned char *sig, unsigned int
tot_nbr_elem_tmp *= idx[i]; tot_nbr_elem_tmp *= idx[i];
} }
} }
unsigned int var[nVar]; int var[nVar];