home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
be.zip
/
be.ini
< prev
next >
Wrap
Text File
|
1999-11-16
|
52KB
|
2,053 lines
//
// Binary Editor configuration file
//
// This default initialisation file has definitions to aid in the decoding and
// display of a variety of file formats. This file may be extended to allow
// decoding of other file formats too.
//
// It is admitted that the field names used to describe the various fields
// may or may not match up that given in the official documentation.
// In fact, some of the below might be downright wrong.
// Trademarks owned by their respective companies.
//
/*...ssources:0:*/
// All of the information in this file derived from non-confidential sources
// usually source code, books, magazine articles, specs., WWW, etc..
// References to source material are given, in case I've made mistakes.
// "EoGFF" is short for Encyclopedia of Graphics File Formats, by James D
// Murray and William vanRyper, published by O'Reilly & Associates.
// "GBM source" is short for the source for the Generalised Bitmap Module,
// written by myself. This source is included on the CD-ROM with EoGFF.
// http://www.interalpha.net/customer/nyangau/ gives a link to this.
/*...e*/
/*...sutils:0:*/
map bool { "TRUE" 1 "FALSE" 0 }
def BYTE { n8 hex "byte" } def BYTES { 2048 n8 hex "bytes" }
def WORD { n16 hex "word" } def WORDS { 2048 n16 hex "words" }
def DWORD { n32 hex "dword" } def DWORDS { 2048 n32 hex "dwords" }
def DBLINE union { 8 n8 hex "bytes" buf 8 asc "chars" }
def DWLINE union { 4 n16 hex "words" buf 8 asc "chars" }
def DDLINE union { 4 n32 hex "dwords" buf 16 asc "chars " }
def DB { 4096 DBLINE open open open "lines" }
def DW { 4096 DWLINE open open open "lines" }
def DD { 4096 DDLINE open open open "lines" }
unsigned dec // be explicit about defaults
/*...e*/
/*...sendianness:0:*/
// Some file formats, such as TIFF and XWD can have data stored within them
// in either endianness. By default BE will decode them assuming they have the
// same endianness as the environment where BE is running. This can be
// overridden by forcing BE to decode one way or the other using the BE_FORCE
// or LE_FORCE preprocessor symbols. Invoke BE as 'be -DBE_FORCE ...' etc..
$ifdef BE
$define BE_DECODE
$endif
$ifdef BE_FORCE
$undef BE_DECODE
$define BE_DECODE
$endif
$ifdef LE_FORCE
$undef BE_DECODE
$endif
/*...e*/
/*...sBITMAP_FILES:0:*/
// Mainly headers and palettes only
/*...sBMP_FILE \45\ OS\47\2 and Windows bitmap:0:*/
// Decode the headers and palettes, but not the bitmap bits
// Ref: OS/2 Toolkit pmbitmap.h and related files.
// Ref: GBM source.
le
map BFT_ // bitmap file type
{
"BFT_ICON" 'CI'
"BFT_BMAP" 'MB'
"BFT_POINTER" 'TP'
"BFT_COLORICON" 'IC'
"BFT_COLORPOINTER" 'PC'
"BFT_BITMAPARRAY" 'AB'
}
map BCA_ // ulCompression
{
"BCA_UNCOMP" 0
"BCA_RLE8" 1
"BCA_RLE4" 2
"BCA_HUFFMAN1D" 3
"BCA_RLE24" 4
}
map BRU_ // units
{
"BRU_METRIC" 0
}
map BRA_ // algorithm
{
"BRA_BOTTOMUP" 0
}
map BRH_ // halftoning alg
{
"BRH_NOTHALFTONED" 0
"BRH_ERRORDIFFUSION" 1
"BRH_PANDA" 2
"BRH_SUPERCIRCLE" 3
}
def RGB
{
n8 hex "bBlue"
n8 hex "bGreen"
n8 hex "bRed"
}
def RGB2
{
n8 hex "bBlue"
n8 hex "bGreen"
n8 hex "bRed"
n8 hex "fcOptions"
}
def BMP_PALETTE_11
{
0x100 RGB "argbColor"
}
def BMP_INFO_HEADER_11
{
n32 ptr BMP_PALETTE_11 "cbFix"
n16 "cx"
n16 "cy"
n16 "cPlanes"
n16 "cBitCount"
}
def BMP_PALETTE_20
{
0x100 RGB2 "argbColor"
}
def BMP_INFO_HEADER_20
{
n32 ptr BMP_PALETTE_20 rel "cbFix"
n32 "cx"
n32 "cy"
n16 "cPlanes"
n16 "cBitCount"
n32 map BCA_ "ulCompression"
n32 "cbImage"
n32 "cxResolution"
n32 "cyResolution"
n32 "cclrUsed"
n32 "cclrImportant"
n16 map BRU_ "usUnits"
n16 "usReserved"
n16 map BRA_ "usRecording"
n16 map BRH_ "usRendering"
n32 "cSize1"
n32 "cSize2"
n32 "ulColorEncoding"
n32 hex "ulIdentifier"
}
def BMP_INFO_HEADER
{
n32 "cbFix"
at 0 BMP_INFO_HEADER_11 valid "cbFix==12" "1.1 header"
at 0 BMP_INFO_HEADER_20 valid "cbFix>12" "2.0 header"
}
def BMP_FILE_HEADER
{
n16 map BFT_ valid "usType==BFT_BMAP" "usType"
n32 "cbSize"
n16 signed "xHotspot"
n16 signed "yHotspot"
n32 hex "offBits"
BMP_INFO_HEADER "bmp"
}
def BMP_ARRAY_FILE_HEADER
{
n16 map BFT_ valid "usType==BFT_BITMAPARRAY" "usType"
n32 "cbSize"
n32 hex ptr BMP_ARRAY_FILE_HEADER "offNext"
n16 "cxDisplay"
n16 "cyDisplay"
BMP_FILE_HEADER "bfh"
}
def BMP_FILE union
{
n16 map BFT_ "usType"
BMP_FILE_HEADER valid "usType==BFT_BMAP" "bitmap"
BMP_ARRAY_FILE_HEADER valid "usType==BFT_BITMAPARRAY" "bitmaparray"
}
/*...e*/
/*...sCUT_FILE \45\ Media Cybernetics\44\ HALO Image File Format:0:*/
// Ref: EoGFF
le
def CUT_FILE
{
n16 "Width"
n16 "Height"
n16 hex valid "Reserved==0" "Reserved"
buf 100 hex "Data starts here ..."
}
/*...e*/
/*...sGIF_FILE \45\ Compu\36\erve GIF bitmap:0:*/
// Decode headers and block structures
// Ref: ftp://ftp.ncsa.uiuc.edu/misc/file.formats/graphics.formats/gif87a.doc
// Ref: ftp://ftp.ncsa.uiuc.edu/misc/file.formats/graphics.formats/gif89a.doc
// Ref: GBM source.
le
def GIF_RGB
{
n8 hex "red"
n8 hex "green"
n8 hex "blue"
}
def GIF_CHUNK
{
union
{
n8 ptr GIF_CHUNK add 1 rel valid "size!=0" "size"
n8 ptr GIF_BLOCK add 1 rel null valid "size==0" "block"
}
16 buf 16 hex "data"
}
// A number of LCT palette entries, followed by a GIF_CHUNK
def GIF_LCT1 { 2 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT2 { 4 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT3 { 8 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT4 { 16 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT5 { 32 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT6 { 64 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT7 { 128 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_LCT8 { 256 GIF_RGB "palette" GIF_CHUNK "chunk" }
def GIF_EXTENSION
{
n8 hex valid "introducer==0x21" "introducer"
n8 hex "graphic_control_label"
GIF_CHUNK "first_chunk"
}
def GIF_IMAGE_DESC
{
n8 hex valid "introducer==0x2c" "introducer"
n16 "xpos"
n16 "ypos"
n16 "width"
n16 "height"
union
{
n8 bits 7:7 map bool "got_lct"
n8 bits 6:6 map bool "ilace"
n8 bits 2:0 dec "bpp_minus_one"
}
n8 "min_LZW_code_size_minus_one"
union
{
GIF_CHUNK valid "!got_lct" "if no lct"
GIF_LCT1 valid "got_lct&&bpp_minus_one==0" "if 1bpp lct"
GIF_LCT2 valid "got_lct&&bpp_minus_one==1" "if 2bpp lct"
GIF_LCT3 valid "got_lct&&bpp_minus_one==2" "if 3bpp lct"
GIF_LCT4 valid "got_lct&&bpp_minus_one==3" "if 4bpp lct"
GIF_LCT5 valid "got_lct&&bpp_minus_one==4" "if 5bpp lct"
GIF_LCT6 valid "got_lct&&bpp_minus_one==5" "if 6bpp lct"
GIF_LCT7 valid "got_lct&&bpp_minus_one==6" "if 7bpp lct"
GIF_LCT8 valid "got_lct&&bpp_minus_one==7" "if 8bpp lct"
}
}
def GIF_TERM
{
n8 hex valid "introducer==0x3b" "introducer"
}
def GIF_BLOCK union
{
n8 hex "introducer"
GIF_EXTENSION valid "introducer==0x21" "extension"
GIF_IMAGE_DESC valid "introducer==0x2c" "image_desc"
GIF_TERM valid "introducer==0x3b" "term"
}
// A number of GCT palette entries, followed by a GIF_BLOCK
def GIF_GCT1 { 2 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT2 { 4 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT3 { 8 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT4 { 16 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT5 { 32 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT6 { 64 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT7 { 128 GIF_RGB "palette" GIF_BLOCK "block" }
def GIF_GCT8 { 256 GIF_RGB "palette" GIF_BLOCK "block" }
// signature and screen descriptor
def GIF_FILE
{
buf 6 asc "signiture (GIFxxx)"
n16 "xscreen"
n16 "yscreen"
union
{
n8 bits 7:7 map bool "got_gct"
n8 bits 2:0 dec "bpp_minus_one"
}
n8 "bg_index"
n8 hex "?"
union
{
GIF_BLOCK valid "!got_gct" "if no gct"
GIF_GCT1 valid "got_gct&&bpp_minus_one==0" "if 1bpp gct"
GIF_GCT2 valid "got_gct&&bpp_minus_one==1" "if 2bpp gct"
GIF_GCT3 valid "got_gct&&bpp_minus_one==2" "if 3bpp gct"
GIF_GCT4 valid "got_gct&&bpp_minus_one==3" "if 4bpp gct"
GIF_GCT5 valid "got_gct&&bpp_minus_one==4" "if 5bpp gct"
GIF_GCT6 valid "got_gct&&bpp_minus_one==5" "if 6bpp gct"
GIF_GCT7 valid "got_gct&&bpp_minus_one==6" "if 7bpp gct"
GIF_GCT8 valid "got_gct&&bpp_minus_one==7" "if 8bpp gct"
}
}
/*...e*/
/*...sILBM_FILE \45\ IFF Interleaved bitmap:0:*/
// Decode chunk structure
// Ref: http://www.ea.com/
// Ref: EA IFF 85 spec.
// Ref: GBM source.
be
map ILBM_COMP_TYPE
{
"none" 0
"rle" 1
}
map ILBM_MASKING
{
"none" 0
"mask" 1
"transparent" 2
}
def ILBM_BMHD_DATA
{
n16 "width"
n16 "height"
n16 "xpos"
n16 "ypos"
n8 "bitsperpixel"
n8 map ILBM_MASKING "masking"
n8 map ILBM_COMP_TYPE "compression"
n8 hex "unused"
n16 "transcol"
n8 "xaspect"
n8 "yaspect"
n16 "xscreen"
n16 "yscreen"
}
map ILBM_CAMG_VALUE
{
"lace" 0x00000004 : .
"ehb" 0x00000080 : .
"ham" 0x00000800 : .
"hires" 0x00008000 : .
}
def ILBM_RGB
{
n8 hex "red"
n8 hex "green"
n8 hex "blue"
}
def ILBM_SHAM_PAL
{
16 ILBM_RGB "0rgb's"
}
def ILBM_SHAM_DATA
{
n16 valid "sham_version==0" "sham_version"
200 ILBM_SHAM_PAL "sham_palettes"
}
// note that chunk next pointer may require size rounding up by one
def ILBM_CHUNK
{
n32 asc "name"
n32 ptr ILBM_CHUNK add 4 rel align 2 "size"
union
{
ILBM_BMHD_DATA valid "name=='BMHD'" "bmhd"
n32 map ILBM_CAMG_VALUE valid "name=='CAMG'" "camg"
0x100 ILBM_RGB valid "name=='CMAP'" "cmap"
ILBM_SHAM_DATA valid "name=='SHAM'" "sham"
buf 100 hex suppress "raw data"
}
}
def ILBM_FILE
{
buf 4 asc "form"
n32 "length"
buf 4 asc "ilbm"
ILBM_CHUNK "first_chunk"
}
/*...e*/
/*...sJFIF_FILE \45\ JFIF JPEG bitmap:0:*/
// Ref: ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz
be
map JFIF_EXTCODE
{
"JPEG_THUMBNAIL" 0x10
"1_BYTE_PIXELS_PLUS_PALETTE_THUMBNAIL" 0x11
"3_BYTE_RGB_PIXELS_THUMBNAIL" 0x13
}
def JFIF_EXT
{
n16 hex valid "APP0==0xffe0" "APP0"
n16 hex ptr JFIF_MARKER rel "Length"
buf 5 asc "Identifier (=JFXX)"
n8 map JFIF_EXTCODE "ExtensionCode"
buf 100 hex "Data ..."
}
def JFIF_COPYRIGHT
{
n16 hex valid "APP0==0xfffe" "APP0"
n16 hex ptr JFIF_MARKER rel "Length"
buf 100 asc "Copyright ..."
}
def JFIF_MARKER
{
buf 2 hex "APP0"
n16 hex ptr JFIF_MARKER rel "Length"
buf 100 hex "Data ..."
at 0 JFIF_EXT valid "APP0==0xffe0" "ext"
at 0 JFIF_COPYRIGHT valid "APP0==0xfffe" "copyright"
}
def JFIF_FILE
{
n16 hex valid "SOI==0xffd8" "SOI"
n16 hex valid "APP0==0xffe0" "APP0"
n16 ptr JFIF_MARKER rel "Length"
buf 5 asc "Identifier (=JFIF)"
buf 2 hex "Version"
n8 "Units"
n16 "Xdensity"
n16 "Ydensity"
n8 dec "XThumbnail"
n8 dec "YThumbnail"
buf 100 hex "Thumbnail ..." // discouraged
}
/*...e*/
/*...sKPS_FILE \45\ IBM KIPS bitmap:0:*/
// Just decode the header
// Ref: GBM source.
def KPS_FILE
{
buf 8 asc "signiture (=DFIMAG00)"
n16 "height"
n16 "width"
buf 20 hex "unknown"
}
/*...e*/
/*...sMSP_FILE \45\ Microsoft Paint:0:*/
// Ref: EoGFF
le
def MSP_FILE
{
n16 hex "Key1"
n16 hex "Key2"
n16 "Width"
n16 "Height"
n16 "XARBitmap"
n16 "YARBitmap"
n16 "XARPrinter"
n16 "YARPrinter"
n16 "PrinterWidth "
n16 "PrinterHeight"
n16 "XAspectCorr"
n16 "YAspectCorr"
n16 "Checksum"
buf 6 hex "Padding"
}
/*...e*/
/*...sNEO_FILE \45\ Atari ST\44\ NEOchrome:0:*/
// Ref: EoGFF
be
map NEO_RES
{
"LOW" 0
"MEDIUM" 1
"HIGH" 2
}
def NEO_FILE
{
n16 valid "Flag==0" "Flag"
n16 map NEO_RES "Resolution"
16 n16 hex "Palette"
buf 12 asc "FileName"
n16 hex "Limits"
n16 "Speed"
n16 "NumberOfSteps"
n16 valid "XOffset==0" "XOffset"
n16 valid "YOffset==0" "YOffset"
n16 valid "Width==320" "Width"
n16 valid "Height==200" "Height"
buf 33 hex "Reserved (always 0)"
200 buf 320/2 hex "Data" // 16000 bytes ???
}
/*...e*/
/*...sPAL_FILE \45\ Media Cybernetics\44\ HALO Image Palette Format:0:*/
// Ref: EoGFF
le
map PAL_SUBTYPE
{
"GENERIC" 0
"HARDWARE_SPECIFIC" 1
}
def PAL_FILE
{
n16 asc valid "FileId=='AH'" "FileId"
n16 "Version"
n16 "Size (not including header)"
n8 hex valid "FileType==0x0a" "FileType"
n8 map PAL_SUBTYPE "SubType"
n16 "BoardId"
n16 "MaxIndex"
n16 "MaxRed"
n16 "MaxGreen"
n16 "MaxBlue"
buf 20 asc "PaletteId (=Dr. Halo)"
buf 100 hex "Palette data starts here..."
}
/*...e*/
/*...sPCX_FILE \45\ ZSoft PCX bitmap file:0:*/
// Decode header with small inline 4bpp palette
// Don't decode compressed bitmap bits or trailer with 8bpp palette
// Ref: GBM source.
le
map PCXENC_
{
"PCXENC_RLE" 1
}
def PCX_RGB
{
n8 hex "red"
n8 hex "green"
n8 hex "blue"
}
def PCX_FILE
{
n8 hex valid "magic==0x0a" "magic"
n8 valid "version<5&&version!=4" "version"
n8 map PCXENC_ "compression"
n8 "bpppp"
n16 "x1"
n16 "y1"
n16 "x2"
n16 "y2"
at 16
16 PCX_RGB "4bpp_palette"
at 65
n8 "planes"
n16 "bytes_per_line"
n8 "colour_or_bw"
at 0
8 buf 16 hex "header as hex"
}
/*...e*/
/*...sPNG_FILE \45\ Portable Network Graphics bitmap:0:*/
// preliminary - untested on any file
// Ref: http://www.boutell.com/boutell/png/
be
map PNG_COLOR_TYPE
{
"GRAYSCALE" 0
"RGB" 2
"PALETTE_INDEX" 3
"GRAYSCALE_AND_ALPHA" 4
"RGB_AND_ALPHA" 6
}
map PNG_COMP_METHOD
{
"DEFLATED_32K" 0
}
map PNG_FILT_METHOD
{
"ADAPTIVE_FILTERING_WITH_5_BASIC_FILTER_TYPES" 0
}
map PNG_ILACE_METHOD
{
"NONE" 0
"ADAM7" 1
}
def PNG_CHUNK_DATA_IHDR
{
n32 "Width"
n32 "Height"
n8 "BitDepth"
n8 map PNG_COLOR_TYPE "ColorType"
n8 map PNG_COMP_METHOD "CompressionMethod"
n8 map PNG_FILT_METHOD "FilterMethod"
n8 map PNG_ILACE_METHOD "InterlaceMethod"
}
def PNG_RGB
{
n8 hex "Red"
n8 hex "Green"
n8 hex "Blue "
}
def PNG_CHUNK_DATA_PLTE
{
0x100 PNG_RGB "Palette"
}
def PNG_CHUNK_DATA_IDAT
{
buf 100 hex "ImageData ..."
}
def PNG_CHUNK_DATA_IEND
{
// empty
}
def PNG_CHUNK_DATA_bKGD
{
union
{
n8 "PaletteIndex (if PALETTE_INDEX)"
n16 "Gray (if GRAYSCALE or GRAYSCALE_AND_ALPHA)"
struct
{
n16 "Red (if RGB or RGB_AND_ALPHA)"
n16 "Green (if RGB or RGB_AND_ALPHA)"
n16 "Blue (if RGB or RGB_AND_ALPHA)"
}
}
}
def PNG_CHUNK_DATA_cHRM
{
n32 "WhitePointX"
n32 "WhitePointY"
n32 "RedX"
n32 "RedY"
n32 "GreenX"
n32 "GreenY"
n32 "BlueX"
n32 "BlueY"
}
def PNG_CHUNK_DATA_gAMA
{
n32 "ImageGamma"
}
def PNG_CHUNK_DATA_hIST
{
0x100 n16 "Frequencys"
}
map PNG_UNIT
{
"UNKNOWN" 0
"METRE" 1
}
def PNG_CHUNK_DATA_pHYs
{
n32 "PixelsPerUnitX"
n32 "PixelsPerUnitY"
n8 map PNG_UNIT "UnitSpecifier"
}
def PNG_CHUNK_DATA_sBIT
{
union
{
n8 "Significant (if GRAYSCALE)"
3 n8 "Significant (if RGB or PALETTE_INDEX)"
struct
{
n8 "SignificantGrey (if GRAYSCALE_AND_ALPHA)"
n8 "SignificantAlpha (if GRAYSCALE_AND_ALPHA)"
}
struct
{
n8 "SignificantRed (if RGB_AND_ALPHA)"
n8 "SignificantGreen (if RGB_AND_ALPHA)"
n8 "SignificantBlue (if RGB_AND_ALPHA)"
n8 "SignificantAlpha (if RGB_AND_ALPHA)"
}
}
}
def PNG_CHUNK_DATA_tEXt
{
buf 100 asc "KeywordThenNullThenText"
}
def PNG_CHUNK_DATA_tIME
{
n16 "Year"
n8 "Month (1-12)"
n8 "Day (1-31)"
n8 "Hour (0-23)"
n8 "Minute (0-59)"
n8 "Second (0-60)" // 60 for leap second
}
def PNG_CHUNK_DATA_tRNS
{
union
{
n16 "Transparency (if GRAYSCALE)"
struct
{
n16 "TransparencyRed (if RGB)"
n16 "TransparencyGreen (if RGB)"
n16 "TransparencyBlue (if RGB)"
}
0x100 n8 "Transparencies (if PALETTE_INDEX)"
}
}
def PNG_CHUNK_DATA_zTXt
{
buf 80 asc zterm "KeywordThenNull"
// compresion method and compressed data follow
}
def PNG_CHUNK
{
union
{
n32 ptr PNG_CHUNK_END add 8 rel null suppress "Length"
n32 ptr PNG_CHUNK add 12 rel null suppress "Length"
// display length field twice, so it can be followed to find
// the CRC at the end of the chunk, or the next chunk
}
n32 asc "ChunkType"
union
{
buf 100 hex suppress "raw_data"
PNG_CHUNK_DATA_IHDR valid "ChunkType=='IHDR'" "IHDR"
PNG_CHUNK_DATA_PLTE valid "ChunkType=='PLTR'" "PLTE"
PNG_CHUNK_DATA_IDAT valid "ChunkType=='IDAT'" "IDAT"
PNG_CHUNK_DATA_IEND valid "ChunkType=='IEND'" "IEND"
PNG_CHUNK_DATA_bKGD valid "ChunkType=='bKGD'" "bKGD"
PNG_CHUNK_DATA_cHRM valid "ChunkType=='cHRM'" "cHRM"
PNG_CHUNK_DATA_gAMA valid "ChunkType=='gAMA'" "gAMA"
PNG_CHUNK_DATA_hIST valid "ChunkType=='hIST'" "hIST"
PNG_CHUNK_DATA_pHYs valid "ChunkType=='pHYs'" "pHYs"
PNG_CHUNK_DATA_sBIT valid "ChunkType=='sBIT'" "sBIT"
PNG_CHUNK_DATA_tEXt valid "ChunkType=='tEXt'" "tEXt"
PNG_CHUNK_DATA_tIME valid "ChunkType=='tIME'" "tIME"
PNG_CHUNK_DATA_tRNS valid "ChunkType=='tRNS'" "tRNS"
PNG_CHUNK_DATA_zTXt valid "ChunkType=='zTXt'" "zTXt"
}
}
def PNG_CHUNK_END
{
n32 hex "CRC"
}
def PNG_FILE
{
buf 8 hex "Signature (=@89504e470d0a1a0a)"
PNG_CHUNK "FirstChunk"
}
/*...e*/
/*...sPSEG_FILE \45\ IBM Page Segment:0:*/
// I don't know very much about the internal structure of these.
// Here is enough to allow loading and saving of 1bpp PSEG files.
// Ref: GBM source.
be
def PSEG_COMMENT
{
buf 100 ebc "text"
}
def PSEG_BEGIN_PAGE
{
buf 100 ebc "segment (often is filename)"
}
def PSEG_BEGIN_IMG_BLOCK
{
buf 100 ebc "image (often is filename)"
}
map PSEG_ORIENTATION
{
"90degrees" 0x2d
}
def PSEG_IMG_OUTPUT_CTL
{
buf 6 hex "?"
buf 2 hex "?"
n8 map PSEG_ORIENTATION "orientation"
buf 1 hex "?"
buf 8 hex "?"
n16 "x_scale"
n16 "y_scale"
buf 2 hex "reserved"
}
def PSEG_INPUT_IMG_DESC
{
buf 2 "?"
n16 hex "0 or 0x0960"
n16 hex "0 or 0x0960"
buf 8 hex "?"
n16 hex "0 or 0x0960"
n16 hex "0 or 0x0960"
n16 "bytes_per_line"
n16 "lines"
buf 4 hex "?"
n8 map PSEG_ORIENTATION "orientation"
buf 1 hex "?"
n16 "x_cell"
n16 "y_cell"
buf 4 hex "? (=0001ffff)"
}
def PSEG_RASTER_DATA
{
buf 100 hex "data"
}
def PSEG_IMG_CELL_POSN
{
n16 "x_cell_pos"
n16 "y_cell_pos"
n16 "x_cell_size"
n16 "y_cell_size"
n16 "x_fill_size"
n16 "y_fill_size"
}
def PSEG_END_IMG_BLOCK
{
buf 100 ebc "image (often is filename)"
}
def PSEG_END_PAGE
{
buf 100 ebc "segment (often is filename)"
}
def PSEG_RECORD
{
n8 hex valid "start==0x5a" "start"
n16 ptr PSEG_RECORD rel "data_size"
n24 hex "type"
buf 3 hex "?"
union
{
PSEG_COMMENT valid "type==0xdeeeee" "comment"
PSEG_BEGIN_PAGE valid "type==0xd3a85f" "begin_page"
PSEG_BEGIN_IMG_BLOCK valid "type==0xd3a87b" "begin_image_block"
PSEG_IMG_OUTPUT_CTL valid "type==0xd3a77b" "image_output_ctl"
PSEG_INPUT_IMG_DESC valid "type==0xd3a67b" "input_img_desc"
PSEG_RASTER_DATA valid "type==0xd3ee7b" "raster_data"
PSEG_IMG_CELL_POSN valid "type==0xd3ac7b" "img_cell_posn"
PSEG_END_IMG_BLOCK valid "type==0xd3a97b" "img_block"
PSEG_END_PAGE valid "type==0xd3a95f" "end_page"
buf 100 hex "as raw data"
}
}
def PSEG_FILE
{
PSEG_RECORD "first_record"
}
/*...e*/
/*...sRAS_FILE \45\ Sun Raster file:0:*/
// Ref: EoGFF
// Ref: /usr/include/rasterfile.h on SunOS etc.
be
map RAS_TYPE
{
"OLD" 0x0000 // uncompressed
"STANDARD" 0x0001 // uncompressed
"BYTE_ENCODED" 0x0002 // a form of RLE
"RGB" 0x0003
"TIFF" 0x0004 // file originally converted from TIFF
"IFF" 0x0005 // file originally converted from IFF
"EXPERIMENTAL" 0xffff // does not comply with Sun Raster format
}
map RAS_CTYPE
{
"NO_COLOR_MAP" 0x0000
"RGB_COLOR_MAP" 0x0001
"RAW_COLOR_MAP" 0x0002
}
def RAS_FILE
{
n32 hex valid "MagicNumber==0x59a66a95" "MagicNumber"
n32 "Width"
n32 "Height"
n32 "Depth"
n32 "Length (in bytes)"
// if 0 use Width*Height*Depth
n32 map RAS_TYPE "Type"
n32 map RAS_CTYPE "ColorMapType"
n32 "ColorMapLength (in bytes)"
}
/*...e*/
/*...sRLE_FILE \45\ Utah Raster Toolkit bitmap:0:*/
// Ref: EoGFF
// Ref: ftp://cs.uath.edu
// Ref: ftp://weedeater.math.yale.edu
// Ref: ftp://freebie.engin.umich.edu
le
def RLE_FILE
{
n16 "Magic"
n16 "Xpos"
n16 "Ypos"
n16 "Xsize"
n16 "Ysize"
n8 hex "Flags"
n8 "Ncolors"
n8 "Pixelbits"
n8 "Ncmap"
n8 "Cmaplen"
n8 "Redbg"
n8 "Greenbg"
n8 "Bluebg"
// palette, comment area and bitmap follow
}
/*...e*/
/*...sSGI_FILE \45\ Silicon Graphics bitmap:0:*/
// Ref: EoGFF
// Ref: http://ftp.sgi.com/graphics/SGIIMAGESPEC
// Ref: http://reality.sgi.com/grafica/sgiimage.html
be
map SGI_STORAGE
{
"VERBATIM" 0 // uncompressed
"RLE" 1
}
map SGI_DIMENSION
{
"SINGLE_CHANNEL_1_SCAN" 1
"SINGLE_CHANNEL_DIM_XY" 2
"MULTI_CHANNEL" 3
}
map SGI_COLORMAP
{
"NORMAL" 0 // most common
"DITHERED" 1 // obsolete, pixels bytes are BBGGGRRR
"SCREEN" 2 // index into color map
"COLORMAP" 3 // colour map
}
def SGI_FILE
{
n16 valid "Magic==474" "Magic"
n8 map SGI_STORAGE "Storage"
n8 dec valid "Bpc==1||Bpc==2" "Bpc"
n16 map SGI_DIMENSION valid "Dimension==1||Dimension==2||Dimension==3"
"Dimension"
n16 "XSize"
n16 "YSize"
n16 valid "ZSize==1||ZSize==3||ZSize==4"
"ZSize"
n32 "PixMin"
n32 "PixMax"
buf 4 hex "Unused (all zeroes)"
buf 80 asc zterm "ImageName"
n32 map SGI_COLORMAP "ColorMap"
buf 404 hex "Unused (all zeroes)"
union
{
buf 100 hex "Data begins ..."
100 n32 "ScanOffsets YSize*ZSize"
}
}
/*...e*/
/*...sSPRITE_FILE \45\ RiscOS Sprite bitmap:0:*/
// Display headers and data (rather crudely).
// Ref: RiscOS / Archimedes owners book.
// Ref: http://www.pcug.org.au/~markwart/canbug/files/sprite.html
le
map SPRITE_MODE
{
"640x256x1bpp" 0
"320x256x2bpp" 1
"160x256x4bpp" 2
"Text only" 3
"320x256x1bpp" 4
"160x256x2bpp" 5
"160x256x2bpp" 6
"Teletext" 7
"640x256x2bpp" 8
"320x256x4bpp" 9
"160x256x8bpp" 10
"640x250x2bpp" 11
"640x256x4bpp" 12
"320x256x8bpp" 13
"640x250x4bpp" 14
"640x256x8bpp" 15
"1056x250x4bpp" 16
"1056x256x4bpp" 17
"640x512x1bpp multisync-monitor" 18
"640x512x2bpp multisync-monitor" 19
"640x512x4bpp multisync-monitor" 20
"640x512x8bpp multisync-monitor" 21
"1152x896x1bpp 61.2Hz-hires-monitor" 23
"1056x256x8bpp" 24
"640x480x1bpp multisync-or-60Hz-VGA-monitor" 25
"640x480x2bpp multisync-or-60Hz-VGA-monitor" 26
"640x480x4bpp multisync-or-60Hz-VGA-monitor" 27
"640x480x8bpp multisync-or-60Hz-VGA-monitor" 28
}
// 2 RGB values match if not flashing
def SPRITE_PAL
{
n8 hex "?"
n8 hex "red"
n8 hex "green"
n8 hex "blue"
n8 hex "?"
n8 hex "red"
n8 hex "green"
n8 hex "blue "
}
// List the first few bytes of data
// Give it laid out at several widths
// Remember, nibbles can be swapped
def SPRITE_DATA
{
at 0 50 buf 4 hex "data (1 dword per line)"
at 0 50 buf 8 hex "data (2 dwords per line)"
at 0 50 buf 12 hex "data (3 dwords per line)"
at 0 50 buf 16 hex "data (4 dwords per line)"
at 0 50 buf 20 hex "data (5 dwords per line)"
at 0 50 buf 24 hex "data (6 dwords per line)"
at 0 50 buf 28 hex "data (7 dwords per line)"
at 0 50 buf 32 hex "data (8 dwords per line)"
}
def SPRITE_HDR
{
n32 hex ptr SPRITE_HDR rel "next_sprite"
buf 12 asc "name"
n32 "width_in_dwords-1"
n32 "scan_lines-1"
n32 "first_bit"
n32 "last_bit"
n32 hex ptr SPRITE_DATA add -. rel "offset_image"
n32 hex ptr SPRITE_DATA add -. rel "offset_mask"
n32 map SPRITE_MODE "mode"
0x40 SPRITE_PAL "palette"
}
def SPRITE_FILE
{
n32 "num_sprites "
n32 hex ptr SPRITE_HDR add -. "first_sprite"
}
/*...e*/
/*...sTGA_FILE \45\ Targa\47\Vista bitmap:0:*/
// Just decode the header.
// Ref: EoGFF
// Ref: GBM source.
// Ref: http://www.truevision.com/
le
map TGA_
{
"TGA_NO_IMAGE" 0
"TGA_UNCOMP_CM" 1
"TGA_UNCOMP_RGB" 2
"TGA_UNCOMP_BW" 3
"TGA_RL_CM" 9
"TGA_RL_RGB" 10
"TGA_RL_BW" 11
"TGA_COMP_CM" 32
"TGA_COMP_CM_4" 33
}
map IDB_
{
"IDB_ORIGIN" 0x20 : .
"IDB_NON_INT" 0x00 : 0xc0
"IDB_2_WAY" 0x40 : 0xc0
"IDB_4_WAY" 0x80 : 0xc0
}
def TGA_HEADER
{
n8 "n_chars_in_id"
n8 "color_map_present"
n8 map TGA_ "image_type"
n16 "color_map_start"
n16 "color_map_length"
n8 "color_map_entry_bits"
n16 "x_origin"
n16 "y_origin"
n16 "width"
n16 "height"
n8 "bpp"
n8 map IDB_ "image_descriptor"
}
def TGA_FILE
{
n8 ptr TGA_HEADER null "n_chars_in_id"
buf 255 asc "id"
}
/*...e*/
/*...sTIFF_FILE \45\ Aldus\47\Microsoft TIFF:0:*/
// Ref: ftp://sgi.com/graphics/tiff/TIFF6.ps.Z
// Ref: GBM source.
// This section makes heavy use of the BE 'valid' keyword to ensure that the
// correct data decode of tags (tag D_ type and inline/non-inline) takes place.
$ifdef BE_DECODE
be
$else
le
$endif
map TIFF_T
{
"T_NEWSUBFILETYPE" 254
"T_SUBFILETYPE" 255
"T_IMAGEWIDTH" 256
"T_IMAGELENGTH" 257
"T_BITSPERSAMPLE" 258
"T_COMPRESSION" 259
"T_PHOTOMETRIC" 262
"T_THRESHOLDING" 263
"T_CELLWIDTH" 264
"T_CELLLENGTH" 265
"T_FILLORDER" 266
"T_DOCNAME" 269
"T_DESCRIPTION" 270
"T_MAKE" 271
"T_MODEL" 272
"T_STRIPOFFSETS" 273
"T_ORIENTATION" 274
"T_SAMPLESPERPIXEL" 277
"T_ROWSPERSTRIP" 278
"T_STRIPBYTECOUNTS" 279
"T_MINSAMPLEVALUE" 280
"T_MAXSAMPLEVALUE" 281
"T_XRESOLUTION" 282
"T_YRESOLUTION" 283
"T_PLANARCONFIG" 284
"T_PAGENAME" 285
"T_XPOSITION" 286
"T_YPOSITION" 287
"T_FREEOFFSETS" 288
"T_FREEBYTECOUNTS" 289
"T_GRAYRESPONSEUNIT" 290
"T_GRAYRESPONSECURVE" 291
"T_GROUP3OPTIONS" 292
"T_GROUP4OPTIONS" 293
"T_RESOLUTIONUNIT" 296
"T_PAGENUMBER" 297
"T_COLORRESPONSECURVES" 301
"T_SOFTWARE" 305
"T_DATETIME" 306
"T_ARTIST" 315
"T_HOSTCOMPUTER" 316
"T_PREDICTOR" 317
"T_WHITEPOINT" 318
"T_PRIMARYCHROMA" 319
"T_COLORMAP" 320
"T_HALFTONEHINTS" 321
"T_TILEWIDTH" 322
"T_TILELENGTH" 323
"T_TILEOFFSETS" 324
"T_TILEBYTECOUNTS" 325
"T_INKSET" 332
"T_INKNAMES" 333
"T_NUMBEROFINKS" 334
"T_DOTRANGE" 336
"T_TARGETPRINTER" 337
"T_EXTRASAMPLES" 338
"T_SAMPLEFORMAT" 339
"T_SMINSAMPLEVALUE" 340
"T_SMAXSAMPLEVALUE" 341
"T_TRANSFERRANGE" 342
"T_JPEGPROC" 512
"T_JPEGINTERCHANGEFMT" 513
"T_JPEGINTERCHANGEFMTLEN" 514
"T_JPEGRESTARTINTERVAL" 515
"T_JPEGLOSSLESSPRED" 517
"T_JPEGPOINTTRANSFORMS" 518
"T_JPEGOTABLES" 519
"T_JPEGDCTABLES" 520
"T_JPEGACTABLES" 521
"T_COEFFICIENTS" 529
"T_SUBSAMPLING" 530
"T_REFERENCEBLACKWHITE" 532
}
map TIFF_D
{
"D_BYTE" 1
"D_ASCII" 2
"D_SHORT" 3
"D_LONG" 4
"D_RATIONAL" 5
"D_SBYTE" 6
"D_UNDEFINED" 7
"D_SSHORT" 8
"D_SLONG" 9
"D_SRATIONAL" 10
"D_FLOAT" 11
"D_DOUBLE" 12
}
def TIFF_RATIONAL
{
n32 unsigned "numerator"
n32 unsigned "denominator"
}
def TIFF_SRATIONAL
{
n32 signed "numerator"
n32 signed "denominator"
}
def TIFF_TAG_ASCII_NI { buf 100 asc "ascii" }
def TIFF_TAG_ASCII
{
n32 dec width 3 "length"
union
{
buf 4 asc valid "length<=4" "inline"
n32 hex ptr TIFF_TAG_ASCII_NI valid "length>4" "non-inline"
}
}
def TIFF_TAG_BYTE_NI { 100 n8 unsigned open "bytes" }
def TIFF_TAG_BYTE
{
n32 dec width 3 "length"
union
{
4 n8 unsigned open valid "length<=4" "inline"
n32 hex ptr TIFF_TAG_BYTE_NI valid "length>4" "non_inline"
}
}
def TIFF_TAG_SBYTE_NI { 100 n8 signed open "bytes" }
def TIFF_TAG_SBYTE
{
n32 dec width 3 "length"
union
{
4 n8 signed open valid "length<=4" "inline"
n32 hex ptr TIFF_TAG_SBYTE_NI valid "length>4" "non_inline"
}
}
def TIFF_TAG_SHORT_NI { 100 n16 unsigned open "shorts" }
def TIFF_TAG_SHORT
{
n32 dec width 3 "length"
union
{
2 n16 unsigned open valid "length<=2" "inline"
n32 hex ptr TIFF_TAG_SHORT_NI valid "length>2" "non_inline"
}
}
def TIFF_TAG_SSHORT_NI { 100 n16 signed open "sshorts" }
def TIFF_TAG_SSHORT
{
n32 dec width 3 "length"
union
{
2 n16 signed open valid "length<=2" "inline"
n32 hex ptr TIFF_TAG_SSHORT_NI valid "length>2" "non_inline"
}
}
def TIFF_TAG_LONG_NI { 100 n32 unsigned open "longs" }
def TIFF_TAG_LONG
{
n32 dec width 3 "length"
union
{
n32 unsigned valid "length<=1" "inline"
n32 hex ptr TIFF_TAG_LONG_NI valid "length>1" "non_inline"
}
}
def TIFF_TAG_SLONG_NI { 100 n32 signed open "slongs" }
def TIFF_TAG_SLONG
{
n32 dec width 3 "length"
union
{
n32 signed valid "length<=1" "inline"
n32 hex ptr TIFF_TAG_SLONG_NI valid "length>1" "non_inline"
}
}
def TIFF_TAG_FLOAT_NI { 100 buf 4 hex open "floats" }
def TIFF_TAG_FLOAT
{
n32 dec width 3 "length"
union
{
buf 4 hex valid "length<=1" "inline"
n32 hex ptr TIFF_TAG_FLOAT_NI valid "length>1" "non_inline"
}
}
def TIFF_TAG_RATIONAL_NI { 100 TIFF_RATIONAL open open "rationals" }
def TIFF_TAG_RATIONAL
{
n32 dec width 3 "length"
n32 hex ptr TIFF_TAG_RATIONAL "non_inline"
}
def TIFF_TAG_SRATIONAL_NI { 100 TIFF_SRATIONAL open open "srationals" }
def TIFF_TAG_SRATIONAL
{
n32 dec width 3 "length"
n32 hex ptr TIFF_TAG_SRATIONAL "non_inline"
}
def TIFF_TAG_DOUBLE_NI { 100 buf 8 hex open "doubles" }
def TIFF_TAG_DOUBLE
{
n32 dec width 3 "length"
n32 hex ptr TIFF_TAG_DOUBLE "non_inline"
}
def TIFF_TAG
{
n16 map TIFF_T width 23 "type"
n16 map TIFF_D width 11 "dtype"
union
{
TIFF_TAG_ASCII valid "dtype==map TIFF_D \"D_ASCII\"" "ascii"
TIFF_TAG_BYTE valid "dtype==map TIFF_D \"D_BYTE\"" "bytes"
TIFF_TAG_SBYTE valid "dtype==map TIFF_D \"D_SBYTE\"" "sbytes"
TIFF_TAG_SHORT valid "dtype==map TIFF_D \"D_SHORT\"" "shorts"
TIFF_TAG_SSHORT valid "dtype==map TIFF_D \"D_SSHORT\"" "sshorts"
TIFF_TAG_LONG valid "dtype==map TIFF_D \"D_LONG\"" "longs"
TIFF_TAG_SLONG valid "dtype==map TIFF_D \"D_SLONG\"" "slongs"
TIFF_TAG_FLOAT valid "dtype==map TIFF_D \"D_FLOAT\"" "floats"
TIFF_TAG_RATIONAL valid "dtype==map TIFF_D \"D_RATIONAL\"" "rationals"
TIFF_TAG_SRATIONAL valid "dtype==map TIFF_D \"D_SRATIONAL\"" "srationals"
TIFF_TAG_DOUBLE valid "dtype==map TIFF_D \"D_DOUBLE\"" "doubles"
n32 ptr TIFF_TAG_ASCII_NI valid "dtype<1||dtype>12" "other"
// Note: saying map TIFF_D "D_xyz" is equivelent to, but much
// faster than saying D_xyz on its own, as BE only has to scan
// the TIFF_D map for a match, not all possible identifiers.
}
}
def TIFF_NEXT_IFD
{
n32 ptr TIFF_IFD "offset_ifd"
at 12
}
def TIFF_IFD
{
n16 ptr TIFF_NEXT_IFD mul add 2 rel "n_tags"
100 TIFF_TAG "tags"
}
def TIFF_FILE
{
n16 asc valid "byte_order=='II'||byte_order=='MM'" "byte_order"
n16 dec valid "version_number==42" "version_number"
n32 ptr TIFF_IFD "offset_ifd"
}
/*...e*/
/*...sVID_FILE \45\ IBM M\45\Motion bitmap:0:*/
// Ref: GBM source.
le
def VID_FILE
{
buf 6 asc "signiture (=YUV12C)"
buf 2 hex "padding"
n16 "xpos"
n16 "ypos"
n16 "xsize"
n16 "ysize"
}
/*...e*/
/*...sYCC_FILE \45\ Kodak YCC printer bitmap:0:*/
// as used by XL7700 printer
// Ref: EoGFF
be
def YCC_FILE
{
n32 valid "Magic==5965600" "Magic"
n32 ptr YCC_FILE2 add -. rel "HSize"
}
def YCC_FILE2
{
n32 "HSize"
n32 "FSize"
buf 16 asc "FName"
n32 valid "FType==7" "FType"
buf 8 hex "Unused"
n32 "XSize"
n32 "YSize"
buf 12 hex "Unused"
n32 valid "Planes==1||Planes==3" "Planes"
buf 8 hex "Unused"
buf 100 hex "Data ..."
}
/*...e*/
/*...sXWD10_FILE \45\ X10 Window Dump:0:*/
be
map XWD10_FORMAT
{
"XY_FORMAT" 0 // single plane
"Z_FORMAT" 1 // multiple planes
}
def XWD10_CMAP
{
n16 hex "EntryNumber"
n16 hex "Red"
n16 hex "Green"
n16 hex "Blue"
}
def XWD10_CMAPS
{
256 XWD10_CMAP "ColorMap"
}
def XWD10_FILE
{
n32 ptr XWD_CMAPS valid "WindowNumColors!=0"
"HeaderSize"
n32 valid "FileVersion==6" "FileVersion"
n32 "DisplayType"
n32 valid "DisplayPlanes==1||DisplayPlanes==3"
"DisplayPlanes"
n32 map XWD10_FORMAT "PixmapFormat"
n32 "PixmapWidth"
n32 "PixmapHeight"
n16 "WindowWidth"
n16 "WindowHeight"
n16 signed "WindowX"
n16 signed "WindowY"
n16 "WindowBorderWidth"
n16 "WindowNumColors"
buf 500 asc zterm "WindowName ..."
// This field is not known to exist in an X10 XWD.
// I've put it in here as the HeaderSize field above gives
// provision for its existance.
}
/*...e*/
/*...sXWD11_FILE \45\ X11 Window Dump:0:*/
// Ref: EoGFF
// Ref: ftp://ftp.x.org/
// Ref: X11 headers, see file below
/*...v\47\usr\47\X11\47\include\47\X11\47\XWDFile\46\h:0:*/
be
map XWD11_FORMAT
{
"XY_BITMAP" 0
"XY_PIXMAP" 1
"Z_PIXMAP" 2
}
map XWD11_BYTEORD
{
"LS_BYTE_FIRST" 0
"MS_BYTE_FIRST" 1
}
map XWD11_BITORD
{
"LS_BIT_FIRST" 0
"MS_BIT_FIRST" 1
}
map XWD11_VISUAL
{
"FIXED" 0 : 1
"DYNAMIC" 1 : 1
"GRAY_SCALE" 0 : ~1
"COLOR" 2 : ~1
"TRUE_COLOR" 4 : ~1
}
def XWD11_CMAP
{
n32 hex "EntryNumber"
n16 hex "Red"
n16 hex "Green"
n16 hex "Blue"
n8 hex "Flags"
n8 hex "Padding"
}
def XWD11_CMAPS
{
256 XWD11_CMAP "ColorMap"
}
def XWD11_FILE
{
n32 ptr XWD11_CMAPS valid "ColorMapEntries!=0"
"HeaderSize"
n32 valid "FileVersion==7" "FileVersion"
n32 map XWD11_FORMAT "PixmapFormat"
n32 "PixmapDepth"
n32 "PixmapWidth"
n32 "PixmapHeight"
n32 "XOffset"
n32 map XWD11_BYTEORD "ByteOrder"
n32 valid "BitmapUnit==8||BitmapUnit==16||BitmapUnit==32"
"BitmapUnit"
n32 map XWD11_BITORD "BitmapBitOrder"
n32 valid "BitmapPad==8||BitmapPad==16||BitmapPad==32"
"BitmapPad"
n32 "BitsPerPixel"
n32 "BytesPerLine"
n32 map XWD11_VISUAL "VisualClass"
n32 hex "RedMask"
n32 hex "GreenMask"
n32 hex "BlueMask"
n32 "BitsPerRgb"
n32 "NumberOfColors"
n32 "ColorMapEntries"
n32 "WindowWidth"
n32 "WindowHeight"
n32 signed "WindowX"
n32 signed "WindowY"
n32 "WindowBorderWidth"
buf 500 asc zterm "WindowName ..."
}
// Just temporary stuff for some investigation I'm doing...
def XWD11_PIXEL32
{
n24 le hex suppress "pixel"
expr "pixel!=0" dec "nz"
}
def XWD11_PIXELS32
{
200 XWD11_PIXEL32 "pixels"
at 3216
}
/*...e*/
def BITMAP_FILES union
{
BMP_FILE "Windows or OS/2 bitmap .bmp .dib"
CUT_FILE "Dr.Halo bitmap .cut"
GIF_FILE "Compu$erve GIF bitmap .gif"
ILBM_FILE "Amiga ILBM bitmap .lbm .iff"
JFIF_FILE "JFIF JPEG bitmap .jpg .jpeg .jpg"
KPS_FILE "IBM KIPS bitmap .kps .kpl"
MSP_FILE "Microsoft Paint bitmap .msp"
NEO_FILE "Atari ST, NEOchrome bitmap .neo"
PAL_FILE "Dr.Halo palette .pal"
PCX_FILE "ZSoft PCX bitmap .pcx .pcc"
PNG_FILE "Portable Network Graphics bitmap .png"
PSEG_FILE "IBM Page Segment .pse .pseg .pseg3820"
RAS_FILE "Sun Raster file .ras"
RLE_FILE "Utah Raster Toolkit bitmap .rle"
SGI_FILE "Silicon Graphics bitmap .sgi .bw .rgb .rgba"
SPRITE_FILE "RiscOS Sprite bitmap .spr .sprite"
TGA_FILE "Targa/Vista bitmap .tga .vst"
$ifdef BE_DECODE
TIFF_FILE "Aldus/Microsoft TIFF (BE) .tiff .tif"
$else
TIFF_FILE "Aldus/Microsoft TIFF (LE) .tiff .tif"
$endif
VID_FILE "IBM M-Motion bitmap .vid"
YCC_FILE "Kodak YCC printer bitmap .ycc"
XWD10_FILE "X Windows 10 window dump .xwd"
XWD11_FILE "X Windows 11 window dump .xwd"
}
/*...e*/
/*...sANIMATION_FILES:0:*/
// Mainly headers and palettes only
/*...sANI_FILE \45\ Atari ST\44\ NEOchrome Animation Format:0:*/
// Ref: EoGFF
// Ref: http://www.wotsit.demon.co.uk/graphics.htm#atari
be
def ANI_FILE
{
n32 hex valid "MagicNumber==0xbabeebea" "MagicNumber"
n16 "Width (in bytes)"
n16 "Height (in scan lines)"
n16 "Size (in bytes + 10)"
n16 "XCoord-1"
n16 "YCoord-1"
n16 "NumberOfFrames"
n16 "Speed"
n32 hex valid "Reserved==0" "Reserved"
}
/*...e*/
/*...sFLM_FILE \45\ Atari ST\44\ Animatic Film Format:0:*/
// A sequence of low resolution 16 colour images
// Ref: EoGFF
// Ref: http://www.wotsit.demon.co.uk/graphics.htm#atari
be
map FLM_PLAYDIR
{
"FORWARDS" 0
"BACKWARDS" 1
}
map FLM_ENDACTION
{
"PAUSE_AND_REPEAT" 0
"REPEAT" 1
"REPEAT_BACKWARDS" 3
}
def FLM_FILE
{
n16 "NumberOfFrames"
16 n16 hex "Palette"
n16 valid "FilmSpeed<=99" "FilmSpeed"
n16 map FLM_PLAYDIR "PlayDirection"
n16 map FLM_ENDACTION "EndAction"
n16 "FrameWidth"
n16 "FrameHeight"
n16 "MajorVersionNumber"
n16 "MinorVersionNumber"
n32 hex valid "MagicNumber==0x27182818" "MagicNumber"
buf 12 hex "Unused (all zeros)"
buf 100 hex "Data starts here ..."
}
/*...e*/
/*...sSEQ_FILE \45\ Atari ST\44\ Cyber Paint Sequence Format:0:*/
// Ref: EoGFF
be
def SEQ_FILE
{
n16 hex "MagicNumber"
n16 "VersionNumber"
n32 "NumberOfFrames"
n16 "DisplayRate"
buf 118 hex "Reserved (all zeroes)"
100 n32 ptr SEQ_FRAME "FrameOffsets"
}
map SEQ_OP
{
"COPY" 0
"XOR" 1
}
map SEQ_COMP
{
"UNCOMPRESSED" 0
"COMPRESSED" 1
}
def SEQ_FRAME
{
n16 "Type"
n16 "Resolution"
16 n16 hex "Palette"
buf 16 asc "FileName"
n16 "Limits"
n16 "Speed"
n16 "NumberOfSteps"
n16 valid "XOffset<320" "XOffset"
n16 valid "YOffset<200" "YOffset"
n16 "FrameWidth"
n16 "FrameHeight"
n8 map SEQ_OP "Operation"
n8 map SEQ_COMP "Compression"
n32 "DataSize"
buf 60 hex "Unused (all zeroes)"
}
/*...e*/
def ANIMATION_FILES union
{
ANI_FILE "Atari ST, NEOchrome Animation Format .ani"
FLM_FILE "Atari ST, Animatic File Format .flm"
SEQ_FILE "Atari ST, Cyber Paint Sequence Format .seq"
}
/*...e*/
/*...sMISC_FILES:0:*/
/*...sRES_FILE \45\ IBM OS\47\2 Resource file:0:*/
// Assumes types and names are not ASCII strings.
// Ref: OS/2 programmers manual.
le
map RES_TYPE
{
"RT_POINTER" 1
"RT_BITMAP" 2
"RT_MENU" 3
"RT_DIALOG" 4
"RT_STRING" 5
"RT_FONTDIR" 6
"RT_FONT" 7
"RT_ACCELTABLE" 8
"RT_RCDATA" 9
"RT_DLGINCLUDE" 11
"RT_FKALONG" 17
"RT_HELPTABLE" 18
"RT_HELPSUBTABLE" 19
}
map RES_MEM_FLAGS
{
"NSCODE" 0x0000 : 0x0007
"NSDATA" 0x0001 : 0x0007
"NSITER" 0x0008 : .
"NSMOVE" 0x0010 : .
"NSPURE" 0x0020 : .
"NSPRELOAD" 0x0040 : .
"NSEXRD" 0x0080 : .
"NSRELOC" 0x0100 : .
"NSCONFORM" 0x0200 : .
"NSDPL0" 0x0400 : .
"NSDPL1" 0x0800 : .
"NSDISCARD" 0x1000 : .
"NS32BIT" 0x2000 : .
"NSHUGE" 0x4000 : .
}
def RES_FILE
{
n8 hex "(=0xff)"
n16 map RES_TYPE "resource_type"
n8 hex "(=0xff)"
n16 "name"
n16 map RES_MEM_FLAGS "memory_flags"
n32 ptr RES_FILE add 4 rel "data_size"
union
{
buf 100 hex "data..."
BMP_FILE valid "resource_type==RT_BITMAP" "data..."
}
}
/*...e*/
/*...sRIFF_FILE \45\ Microsoft RIFF chunked file:0:*/
// Ref: EoGFF
le
def RIFF_SUBCHUNK
{
buf 4 asc "SubChunkId"
n32 hex ptr RIFF_SUBCHUNK add 4 rel align 2 "SubChunkSize"
buf 100 hex "SubChunk Data ... "
// certain sub chunks have a fixed layout
// eg: WAVE, which is followed by 2 subchunks
// However, I can't embed a subchunk in a subchunk
// so the following BE initialisation file hack is needed!
at 4 n8 ptr RIFF_SUBCHUNK mult 0 rel suppress "??? first nested"
}
def RIFF_CHUNK
{
buf 4 asc "ChunkId"
n32 hex ptr RIFF_CHUNK add 4 rel align 2 "ChunkSize"
union
{
buf 100 hex "ChunkData ..."
RIFF_SUBCHUNK "ChunkData (first subchunk)"
}
}
def RIFF_FILE
{
RIFF_CHUNK "WholeFileChunk"
}
/*...e*/
/*...sTEX_FILE \45\ Andys Raytracer and Modular Rendeder 3D texture format:0:*/
// 3D Texture block file, as understood by Andys CSG Raytracer,
// and the Modular Renderer C++ class library, written by the BE author.
// Ref: http://www.interalpha.net/nyangau/
le
def TEX_FILE
{
n32 hex valid "magic==0x1a584554" "magic"
n32 dec "w"
n32 dec "h"
n32 dec "d"
n32 dec "bpv"
buf 100 hex "data..."
}
/*...e*/
/*...sZIP_FILE \45\ ZIP compressed archive format:0:*/
// Ref: Documentation that comes with Info-ZIP Zip etc..
// zero or more zipped-files
// where each zipped-file is a ZIP_LOCAL_FILE_HEADER followed by its data
// followed by zero or more ZIP_FILE_HEADERs
// followed by ZIP_CENTRAL
le
// Operating system
map ZIP_OS
{
"MS-DOS and OS/2 (FAT FS)" 0
"Amiga" 1
"VMS" 2
"*nix" 3
"VM/CMS" 4
"Atari ST" 5
"OS/2 (HPFS FS)" 6
"Macintosh" 7
"Z-System" 8
"CP/M" 9
}
// Compression method
map ZIP_COMP
{
"Stored" 0
"Shrunk (dynamic LZW)" 1
"Reduced with compression factor 1" 2
"Reduced with compression factor 2" 3
"Reduced with compression factor 3" 4
"Reduced with compression factor 4" 5
"Imploded (sliding dict.+shannon fano)" 6
"Tokenized" 7
"Imploded (sliding dict.+dyn huff+shannon fano)" 8
}
// header to each zipped-file in the zip-archive
def ZIP_LOCAL_FILE_HEADER
{
// Will be followed by more ZIP_LOCAL_FILE_HEADERs,
// or after all of these, there will be ZIP_FILE_HEADERs.
expr "30+compressed_size+filename_length+extra_field_length"
hex ptr ZIP_LOCAL_FILE_HEADER rel suppress "next"
expr "30+compressed_size+filename_length+extra_field_length"
hex ptr ZIP_FILE_HEADER rel suppress "next"
n32 hex valid "signature==0x04034b50"
"signature"
n8 dec suppress "version_needed_to_extract_level"
n8 map ZIP_OS suppress "version_needed_to_extract_OS"
n16 hex suppress "general_purpose_bit_flag"
n16 map ZIP_COMP suppress "compression_method"
n16 dec suppress "last_mod_file_time"
n16 dec suppress "last_mod_file_date"
n32 hex suppress "crc_32"
n32 dec width 8 "compressed_size"
n32 dec width 8 "uncompressed_size"
n16 dec width 2 "filename_length"
n16 dec width 3 "extra_field_length"
// 30 bytes upto here ...
buf 100 asc "filename_and_extra_field ..."
}
// header to each entry in the central directory
def ZIP_FILE_HEADER
{
// Will be followed by more ZIP_FILE_HEADERs,
// or after all of these, there will be a ZIP_CENTRAL.
expr "46+filename_length+extra_field_length"
hex ptr ZIP_FILE_HEADER rel suppress "next"
expr "46+filename_length+extra_field_length"
hex ptr ZIP_CENTRAL rel suppress "next"
n32 hex valid "signature==0x02014b50"
"signature"
n8 dec suppress "version_made_by_level"
n8 map ZIP_OS suppress "version_made_by_OS"
n8 dec suppress "version_needed_to_extract_level"
n8 map ZIP_OS suppress "version_needed_to_extract_OS"
n16 hex suppress "general_purpose_bit_flag"
n16 dec suppress "compression_method"
n16 dec suppress "last_mod_file_time"
n16 dec suppress "last_mod_file_date"
n32 hex suppress "crc_32"
n32 dec width 8 "compressed_size"
n32 dec width 8 "uncompressed_size"
n16 dec width 2 "filename_length"
n16 dec width 3 "extra_field_length"
n16 dec width 3 "file_comment_length"
n16 dec "disk_number_start"
n16 hex suppress "internal_file_attributes"
n32 hex suppress "external_file_attributes"
n32 dec suppress "relative_offset_of_local_header"
// 46 bytes upto here ...
buf 100 asc "filename_and_extra_field_and_comment ..."
}
// central directory
def ZIP_CENTRAL
{
n32 hex valid "signature==0x06054b50"
"signature"
n16 dec "number_of_this_disk"
n16 dec "number_of_disk_with_start_of_central_directory"
n16 dec "total_number_of_entries_in_the_central_dir_on_this_disk"
n16 dec "total_number_of_entries_in_the_central_dir"
n32 dec "size_of_the_central_directory"
n32 dec "offset_of_start_of_central_directory_wrt_start_disk_num"
n16 dec "zipfile_comment_length"
buf 100 asc "zipfile_comment ..."
}
// In theory, the above structures could occur in various orders.
// The signature can be used to see what you've got.
// So the following definition helps a little.
def ZIP_BLOCK union
{
n32 hex "signature"
ZIP_LOCAL_FILE_HEADER valid "signature==0x04034b50" "local_file_header"
ZIP_FILE_HEADER valid "signature==0x02014b50" "file_header"
ZIP_CENTRAL valid "signature==0x06054b50" "central_directory"
}
def ZIP_FILE
{
ZIP_BLOCK "first_zip_block"
}
/*...e*/
def MISC_FILES union
{
RES_FILE "IBM OS/2 Resource file .res"
RIFF_FILE "Microsoft RIFF chunked file .avi .wav"
TEX_FILE "RT and MR 3D texture format .tex"
ZIP_FILE "ZIP compressed archive file .zip"
}
/*...e*/
def main union
{
BITMAP_FILES "Bitmap file formats"
ANIMATION_FILES "Animation file formats"
MISC_FILES "Files in other categories"
}