- fprintf(fp, "\t\tchar *ptr = (char*)buff + _offset + header_length;\n");
-
-
- //declare a char pointer if needed : starts at the end of the structs.
- //if(structCount + hasStrSeq > 1) {
- // fprintf(fp,"\t\tchar * ptr = (char*)buff + header_length");
- // for(pos1=0;pos1<structCount;pos1++){
- // fprintf(fp," + sizeof(struct %s_%s_%d)",ev->name, facName,pos1+1);
- // }
- // if(structCount + hasStrSeq > 1) fprintf(fp,";\n");
- //}
-
- // Declare an alias pointer of the struct type to the beginning
- // of the reserved area, just after the event header.
- if(ev->type != 0) {
- unsigned align = max(alignment, td->alignment);
- if(align > 1) {
- fprintf(fp,"\t\tptr+=(%u - ((unsigned int)ptr&(%u-1)))&(%u-1);\n",
- align, align, align);
- }
-
- fprintf(fp, "\t\t__1 = (struct %s_%s_1 *)(ptr);\n",
- ev->name, facName);
- }
- //allocate memory for new struct and initialize it
- //if(whichTypeFirst == 1){ //struct first
- //for(pos1=0;pos1<structCount;pos1++){
- // if(pos1==0) fprintf(fp,
- // "\tstruct %s_%s_1 * __1 = (struct %s_%s_1 *)buff;\n",
- // ev->name, facName,ev->name, facName);
- //MD disabled else fprintf(fp,
- // "\tstruct %s_%s_%d __%d;\n",
- // ev->name, facName,pos1+1,pos1+1);
- //}
- //}else if(whichTypeFirst == 2){
- // for(pos1=0;pos1<structCount;pos1++)
- // fprintf(fp,"\tstruct %s_%s_%d __%d;\n",
- // ev->name, facName,pos1+1,pos1+1);
- //}
- fprintf(fp,"\n");
-
- if(structCount) fprintf(fp,"\t\t//initialize structs\n");
- //flag = 0;
- //structCount = 0;
- if(ev->type != 0)
- for(pos1 = 0; pos1 < ev->type->fields.position; pos1++){
- fld = (field *)ev->type->fields.array[pos1];
- td = fld->type;
- if(td->type != ARRAY && td->type != SEQUENCE && td->type != STRING){
- //if(flag == 0){
- // flag = 1;
- // structCount++;
- // if(structCount > 1) fprintf(fp,"\n");
- //}
- fprintf(fp, "\t\t__1->%s = %s;\n", fld->name, fld->name );
-
- //if(structCount == 1 && whichTypeFirst == 1)
- // fprintf(fp, "\t__1->%s = %s;\n",fld->name,fld->name );
- //else
- // fprintf(fp, "\t__%d.%s = %s;\n",structCount ,fld->name,fld->name);
- }
- //else flag = 0;
- }
- if(structCount) fprintf(fp,"\n");
- //set ptr to the end of first struct if needed;
- //if(structCount + hasStrSeq > 1){
- // fprintf(fp,"\n\t\t//set ptr to the end of the first struct\n");
- // fprintf(fp,"\t\tptr += sizeof(struct %s_%s_1);\n\n",ev->name, facName);
- //}