tpl

A binary data interchange format and C API.
Download

tpl Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Troy Hanson
  • Publisher web site:

tpl Tags


tpl Description

A binary data interchange format and C API. Tpl is a binary data interchange format and C API.C programs can use tpl to store or load serialized images of structured C data. The data is stored in its native binary format. The data can consist of the basic C types, binary buffers and strings, and aggregations and arrays. The serialized image is a discrete, strictly-formatted data buffer that can be stored in a file, memory buffer or transmitted via sockets or pipes. It is suited for IPC or data storage.Example: Storing an array of integers to file. #include "tpl.h"int main() { tpl_node *tn; int i; tn = tpl_map( "A(i)", &i ); for( i=0; i file.xml% tplxml file.xml > file.tplTyped, structured dataEvery tpl has a data type, expressed as a format string. A few examples: A(i) is an integer array. A(is) is an array of integer/string pairs. Deeper structure is the same-- an array of integers which each have an array of strings is A(iA(s)).Binary data portabilityTpl addresses binary data portability by transparently applying endian-conversion when necessary. It also prescribes sizes for the supported types. This permits binary data to be shared effectively between machines that use different CPU types. A tpl generated on an 32-bit x86 can be read on a 64-bit Sparc Ultra for example. This is especially useful for socket IPC. Full native binary efficiencyThe data within a tpl is never converted unless necessary, so you get the full efficiency of using your data types in their native binary representation. This makes it feasible to deal with very large tpl images (up to 4GB) efficiently. It also uses memory-mapped I/O when reading and writing files to avoid the overhead of copying data through the kernel. What's New in This Release: · fixed-length arrays can now be multi-dimensional like `i##` · fixed-length string arrays like `s#` are now supported · nested structures can now be expressed, using the dollar symbol, e.g. `S(ci$(cc))` · `tpl_dump` can use a caller-allocated output buffer (`TPL_MEM|TPL_PREALLOCD`) · `tpl_load` can tolerate excess space in input buffer (`TPL_MEM|TPL_EXCESS_OK`) · implement `TPL_FXLENS` flag for `tpl_peek` to get lengths of fixed-length arrays · implement `TPL_GETSIZE` flag for `tpl_dump` to get dump size without dumping · fix success return code from `tpl_dump(TPL_FD,...)` (thanks, Max Lapan!) · deprecated the wildcard unpacking `S(*)` feature


tpl Related Software