*** StreamDevice-2-1/doc/formats.html.old Mon Jul 17 16:11:33 2006 --- StreamDevice-2-1/doc/formats.html Mon Jul 17 16:11:56 2006 *************** *** 30,37 ****
  • Optionally a field name in ()
  • Optionally flags out of the characters *# +0-
  • Optionally an integer width field
  • !
  • In outputs optionally a period character (.) followed ! by an integer precision field
  • A conversion character
  • Additional information required by some conversion characters
  • --- 30,37 ----
  • Optionally a field name in ()
  • Optionally flags out of the characters *# +0-
  • Optionally an integer width field
  • !
  • Optionally a period character (.) followed ! by an integer precision field (input ony for most formats)
  • A conversion character
  • Additional information required by some conversion characters
  • *************** *** 311,317 **** calculating the checksum. Default is 0, i.e. the first byte of the input or output of the current command. ! The last byte is the byte before the checksum. Normally, multi-byte checksums are in big endian byteorder, i.e. most significant byte first. With the # flag, the byte order is changed to little --- 311,320 ---- calculating the checksum. Default is 0, i.e. the first byte of the input or output of the current command. ! The last byte is prec bytes before the checksum (default 0). ! For example in "abcdefg%<xor>" the checksum is calculated ! from abcdefg, ! but in "abcdefg%2.1<xor>" only from cdef. Normally, multi-byte checksums are in big endian byteorder, i.e. most significant byte first. With the # flag, the byte order is changed to little *** StreamDevice-2-1/src/StreamProtocol.cc.old Mon Jul 17 16:10:45 2006 --- StreamDevice-2-1/src/StreamProtocol.cc Mon Jul 17 16:08:52 2006 *************** *** 1536,1548 **** if (*source == '.') { source++; - if (formatType != PrintFormat) - { - errorMsg(line, - "Use of precision field only allowed " - "in output formats\n"); - return false; - } val = strtoul(source, &p, 10); if (p == source) { --- 1536,1541 ---- *** StreamDevice-2-1/src/ChecksumConverter.cc.old Mon Jul 17 15:57:28 2006 --- StreamDevice-2-1/src/ChecksumConverter.cc Mon Jul 17 16:00:16 2006 *************** *** 497,509 **** { ulong sum; int fnum = format.info[0]; debug("StreamChecksumConverter %s: output to check: \"%s\"\n", ! checksumMap[fnum].name, output.expand(format.width)()); sum = checksumMap[fnum].xorout ^ checksumMap[fnum].func( ! reinterpret_cast(output(format.width)), ! output.length()-format.width, checksumMap[fnum].init); debug("StreamChecksumConverter %s: output checksum is 0x%lX\n", --- 497,511 ---- { ulong sum; int fnum = format.info[0]; + int start = format.width; + int length = output.length()-format.width; + if (format.prec > 0) length -= format.prec; debug("StreamChecksumConverter %s: output to check: \"%s\"\n", ! checksumMap[fnum].name, output.expand(start,length)()); sum = checksumMap[fnum].xorout ^ checksumMap[fnum].func( ! reinterpret_cast(output(start)), length, checksumMap[fnum].init); debug("StreamChecksumConverter %s: output checksum is 0x%lX\n", *************** *** 550,558 **** { int fnum = format.info[0]; ulong sum; debug("StreamChecksumConverter %s: input to check: \"%s\n", ! checksumMap[fnum].name, input.expand(format.width,cursor)()); if (input.length() - cursor < (format.flags & zero_flag ? 2 : 1) * checksumMap[fnum].bytes) --- 552,563 ---- { int fnum = format.info[0]; ulong sum; + int start = format.width; + int length = cursor-format.width; + if (format.prec > 0) length -= format.prec; debug("StreamChecksumConverter %s: input to check: \"%s\n", ! checksumMap[fnum].name, input.expand(start,length)()); if (input.length() - cursor < (format.flags & zero_flag ? 2 : 1) * checksumMap[fnum].bytes) *************** *** 562,569 **** } sum = checksumMap[fnum].xorout ^ checksumMap[fnum].func( ! reinterpret_cast(input(format.width)), ! cursor-format.width, checksumMap[fnum].init); debug("StreamChecksumConverter %s: input checksum is 0x%0*lX\n", checksumMap[fnum].name, 2*checksumMap[fnum].bytes, --- 567,574 ---- } sum = checksumMap[fnum].xorout ^ checksumMap[fnum].func( ! reinterpret_cast(input(start)), length, ! checksumMap[fnum].init); debug("StreamChecksumConverter %s: input checksum is 0x%0*lX\n", checksumMap[fnum].name, 2*checksumMap[fnum].bytes,