Saucexages v0.2.0 Saucexages.DataType View Source
Functions for working with SAUCE Data Types. Each data type in combination with a file type determines how SAUCE type dependent fields should be interpreted. The data type
and file type
together form named file types such as ANSI, ASCII, RIP Script, HTML, and S3M among many others.
Each data type is represented by a human-readable data_type_id
and has one or more associated file types. The data_type
itself is stored in a field in a SAUCE record as an unsigned integer.
You should work with data_type_id
internally in your system and data_type
only when working externally or dealing directly with SAUCE binary values.
The list of data types itself is fixed and is a part of the SAUCE specification. In the unlikely event you need to work with an unsupported data type, you should use a data_type of :none
or otherwise reconsider.
Data Types Overview
The following data_type_id
values are valid and correspond to those defined by the SAUCE spec:
:none
- Anything not set in a SAUCE record or not covered by the SAUCE spec.:character
- Character-based files such asascii
,ansi graphics
, and other text files.:bitmap
- Bitmap graphic and animation files such asgif
,png
,jpeg
, etc.:vector
- Vector graphics file such asdxf
,dwg
, etc.:audio
- Audio files such as mod, s3m, wav, etc.:binary_text
- Raw memory copy of text mode screen, used for art .BIN files.:xbin
- Extended BIN files:archive
- Archive files such aszip
,arc
,lzh
, etc.executable
- Executable scripts such as.exe
,.bat
,.dll
, etc.
Notes
In the case of :binary_text
, its file type is variable and thus can be any non-negative file type.
Be aware that some media types might intuitively match some of these types such, but you should not assume any typing other than what is defined by the SAUCE spec. For instance, rip
files are vectors, but considered to be characters.
It is critical that any media type not covered by this spec should be assumed to have a data type of :none
unless you are able to update the official SAUCE spec.
Link to this section Summary
Functions
Returns a data type value for a given data type identifier
Returns a data type identifier for a given data type value
Returns a list of data type ids available for SAUCE
Returns a full list of data type info available for SAUCE
Returns the data type meta information for the given data type
Link to this section Types
data_type_id() :: :none | :character | :bitmap | :vector | :audio | :binary_text | :xbin | :archive | :executable
Link to this section Functions
Returns a data type value for a given data type identifier.
Examples
iex> Saucexages.DataType.data_type(:none)
0
iex> Saucexages.DataType.data_type(:character)
1
iex> Saucexages.DataType.data_type(:bitmap)
2
data_type_id(data_type()) :: data_type_id()
Returns a data type identifier for a given data type value.
Examples
iex> Saucexages.DataType.data_type_id(1)
:character
iex> Saucexages.DataType.data_type_id(2)
:bitmap
iex> Saucexages.DataType.data_type_id(44)
:none
Returns a list of data type ids available for SAUCE.
Examples
iex> Saucexages.DataType.data_type_ids()
[:none, :character, :bitmap, :vector, :audio, :binary_text, :xbin, :archive,
:executable]
data_type_meta() :: [Saucexages.DataTypeInfo.t()]
Returns a full list of data type info available for SAUCE.
data_type_meta(data_type() | data_type_id()) :: Saucexages.DataTypeInfo.t()
Returns the data type meta information for the given data type.
Examples
iex> Saucexages.DataType.data_type_meta(:character)
%Saucexages.DataTypeInfo{
data_type: 1,
data_type_id: :character,
name: "Character"
}