void QIO_encode_record_info(QIO_String *record_string, QIO_RecordInfo *record_info){ char *buf; int remainder,n; char recordinfo_tags[QIO_MAXVALUESTRING]; QIO_RecordInfoWrapper wrapper = QIO_RECORD_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = recordinfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string(buf,&record_info->version, &remainder); buf = QIO_encode_as_string(buf,&record_info->date, &remainder); buf = QIO_encode_as_int (buf,&record_info->recordtype, &remainder); if(QIO_get_recordtype(record_info) == QIO_HYPER){ buf = QIO_encode_as_int (buf,&record_info->spacetime, &remainder); n = record_info->spacetime.value; buf = QIO_encode_as_intlist(buf,&record_info->hyperlower, n, &remainder); buf = QIO_encode_as_intlist(buf,&record_info->hyperupper, n, &remainder); } buf = QIO_encode_as_string(buf,&record_info->datatype, &remainder); buf = QIO_encode_as_string(buf,&record_info->precision, &remainder); buf = QIO_encode_as_int (buf,&record_info->colors, &remainder); buf = QIO_encode_as_int (buf,&record_info->spins, &remainder); buf = QIO_encode_as_int (buf,&record_info->typesize, &remainder); buf = QIO_encode_as_int (buf,&record_info->datacount, &remainder); /* Insert inner tag string into file wrapper structure */ QIO_insert_record_tag_string(&wrapper, recordinfo_tags); /* Now build final XML string */ QIO_string_realloc(record_string, QIO_STRINGALLOC); buf = QIO_string_ptr(record_string); remainder = QIO_string_length(record_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("QIO_encode_record_info: record_string overflow\n"); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.recordinfo_tags, &remainder); } }
void QIO_encode_usqcd_lattice_info(QIO_String *record_string, QIO_USQCDLatticeInfo *record_info) { // taken from QIO_encode_record_info char *buf; int remainder,n; char recordinfo_tags[QIO_MAXVALUESTRING]; QIO_USQCDLatticeInfoWrapper wrapper = QIO_USQCD_LATTICE_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = recordinfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string(buf,&record_info->version, &remainder); buf = QIO_encode_as_string(buf,&record_info->plaq, &remainder); buf = QIO_encode_as_string(buf,&record_info->linktr, &remainder); buf = QIO_encode_as_string(buf,&record_info->info, &remainder); /* Insert inner tag string into file wrapper structure */ QIO_insert_usqcdlattice_tag_string(&wrapper, recordinfo_tags); /* Now build final XML string */ QIO_string_realloc(record_string, QIO_STRINGALLOC); buf = QIO_string_ptr(record_string); remainder = QIO_string_length(record_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("QIO_encode_usqcd_lattice_info: record_string overflow\n"); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.usqcdlatticeinfo_tags, &remainder); } }
void QIO_encode_usqcd_proprecord_info(QIO_String *record_string, QIO_USQCDPropRecordInfo *record_info) { char *buf; int remainder,n; char recordinfo_tags[QIO_MAXVALUESTRING]; QIO_USQCDPropRecordInfoWrapper wrapper = QIO_USQCD_PROPRECORD_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = recordinfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string(buf,&record_info->version, &remainder); buf = QIO_encode_as_int (buf,&record_info->spin, &remainder); buf = QIO_encode_as_int (buf,&record_info->color, &remainder); buf = QIO_encode_as_string(buf,&record_info->info, &remainder); /* Insert inner tag string into record wrapper structure */ QIO_insert_usqcd_proprecord_tag_string(&wrapper, recordinfo_tags); /* Now build final XML string */ QIO_string_realloc(record_string, QIO_STRINGALLOC); buf = QIO_string_ptr(record_string); remainder = QIO_string_length(record_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("QIO_encode_usqcd_proprecord_info: record_string overflow\n"); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.usqcdproprecordinfo_tags, &remainder); } }
void QIO_encode_usqcd_propfile_info(QIO_String *file_string, QIO_USQCDPropFileInfo *file_info) { char myname[] = "QIO_encode_usqcd_propfile_info"; char *buf; int remainder,n; char fileinfo_tags[QIO_MAXVALUESTRING]; QIO_USQCDPropFileInfoWrapper wrapper = QIO_USQCD_PROPFILE_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = fileinfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string(buf,&file_info->version, &remainder); buf = QIO_encode_as_string(buf,&file_info->type, &remainder); buf = QIO_encode_as_string(buf,&file_info->info, &remainder); /* Insert inner tag string into file wrapper structure */ QIO_insert_usqcd_propfile_tag_string(&wrapper, fileinfo_tags); /* Now build final XML string */ QIO_string_realloc(file_string, QIO_STRINGALLOC); buf = QIO_string_ptr(file_string); remainder = QIO_string_length(file_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("%s: file_string overflow\n",myname); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.usqcdpropfileinfo_tags, &remainder); } }
void QIO_encode_file_info(QIO_String *file_string, QIO_FileInfo *file_info){ char *buf; int remainder,n; char fileinfo_tags[QIO_MAXVALUESTRING]; QIO_FileInfoWrapper wrapper = QIO_FILE_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = fileinfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string (buf,&file_info->version, &remainder); buf = QIO_encode_as_int (buf,&file_info->spacetime, &remainder); buf = QIO_encode_as_intlist(buf,&file_info->dims, file_info->spacetime.value, &remainder); buf = QIO_encode_as_int (buf,&file_info->volfmt, &remainder); /* Insert inner tag string into file wrapper structure */ QIO_insert_file_tag_string(&wrapper, fileinfo_tags); /* Now build final XML string */ QIO_string_realloc(file_string, QIO_STRINGALLOC); buf = QIO_string_ptr(file_string); remainder = QIO_string_length(file_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("QIO_encode_file_info: file_string overflow\n"); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.fileinfo_tags, &remainder); } }
void QIO_encode_checksum_info(QIO_String *checksum_string, QIO_ChecksumInfo *checksum){ char *buf; int remainder,n; char checksuminfo_tags[QIO_MAXVALUESTRING]; QIO_ChecksumInfoWrapper wrapper = QIO_CHECKSUM_INFO_WRAPPER; /* Start by creating string of inner tags */ buf = checksuminfo_tags; remainder = QIO_MAXVALUESTRING; /* Build inner tag string by appending tags */ *buf = '\0'; buf = QIO_encode_as_string (buf,&checksum->version, &remainder); buf = QIO_encode_as_hex32 (buf,&checksum->suma, &remainder); buf = QIO_encode_as_hex32 (buf,&checksum->sumb, &remainder); /* Insert inner tag string into checksum wrapper structure */ QIO_insert_checksum_tag_string(&wrapper, checksuminfo_tags); /* Now build final XML string */ QIO_string_realloc(checksum_string, QIO_STRINGALLOC); buf = QIO_string_ptr(checksum_string); remainder = QIO_string_length(checksum_string); /* Begin with xml info stuff */ strncpy(buf,QIO_XMLINFO,remainder); buf[remainder-1] = '\0'; n = strlen(buf); remainder -= n; buf += n; if(remainder < 0){ printf("QIO_encode_checksum_info: checksum_string overflow\n"); } else{ /* Conclude by appending the wrapped tag string */ buf = QIO_encode_as_string (buf,&wrapper.checksuminfo_tags, &remainder); } }