smile 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. #------------------------------------------------------------------------------
  2. # $File$
  3. # smile: file(1) magic for Smile serialization
  4. #
  5. # The Smile serialization format uses a 4-byte header:
  6. #
  7. # Constant byte #0: 0x3A (ASCII ':')
  8. # Constant byte #1: 0x29 (ASCII ')')
  9. # Constant byte #2: 0x0A (ASCII linefeed, '\n')
  10. # Variable byte #3, consisting of bits:
  11. # Bits 4-7 (4 MSB): 4-bit version number
  12. # Bits 3: Reserved
  13. # Bit 2 (mask 0x04): Whether raw binary (unescaped 8-bit) values may be present in content
  14. # Bit 1 (mask 0x02): Whether shared String value checking was enabled during encoding, default false
  15. # Bit 0 (mask 0x01): Whether shared property name checking was enabled during encoding, default true
  16. #
  17. # Reference: http://wiki.fasterxml.com/SmileFormatSpec
  18. # Created by: Pierre-Alexandre Meyer <pierre@mouraf.org>
  19. # Detection
  20. 0 string :)\n Smile binary data
  21. # Versioning
  22. >3 byte&0xF0 x version %d:
  23. # Properties
  24. >3 byte&0x04 0x04 binary raw,
  25. >3 byte&0x04 0x00 binary encoded,
  26. >3 byte&0x02 0x02 shared String values enabled,
  27. >3 byte&0x02 0x00 shared String values disabled,
  28. >3 byte&0x01 0x01 shared field names enabled
  29. >3 byte&0x01 0x00 shared field names disabled