RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Apple::MacBinary Class Reference

MacBinary is an alternative format to AppleSingle for representing a Macintosh file on a non-Macintosh filesystem. More...

#include <macos.h>

Inheritance diagram for Apple::MacBinary:
Apple::AppleSingleDouble Linker::OutputFormat Linker::Format Linker::Image

Public Types

enum  version_t { MACBIN1 , MACBIN1_GETINFO , MACBIN2 = 0x11 , MACBIN3 = 0x12 }
 
- Public Types inherited from Apple::AppleSingleDouble
enum  format_type { SINGLE = 0x00051600 , DOUBLE = 0x00051607 }
 
enum  hfs_type {
  HFS_UNDEFINED , HFS_Macintosh , HFS_ProDOS , HFS_MSDOS ,
  HFS_UNIX , HFS_VAX_VMS
}
 
enum  {
  ID_DataFork = 1 , ID_ResourceFork , ID_RealName , ID_Comment ,
  ID_IconBW , ID_IconColor , ID_FileInfo , ID_FileDatesInfo ,
  ID_FinderInfo , ID_MacintoshFileInfo , ID_ProDOSFileInfo , ID_MSDOSFileInfo ,
  ID_AFPShortName , ID_AFPFileInfo , ID_AFPDirectoryID
}
 

Public Member Functions

 MacBinary (version_t version=MACBIN3)
 
 MacBinary (version_t version, version_t minimum_version)
 
 MacBinary (AppleSingleDouble &apple, version_t version, version_t minimum_version)
 
void CRC_Initialize () const
 
void CRC_Step (uint8_t byte=0) const
 
void Skip (Linker::Writer &wr, size_t count) const
 
void WriteData (Linker::Writer &wr, size_t count, const void *data) const
 
void WriteData (Linker::Writer &wr, size_t count, std::string text) const
 
void WriteWord (Linker::Writer &wr, size_t bytes, uint64_t value) const
 
void WriteHeader (Linker::Writer &wr) const
 
void CalculateValues () override
 Intermediate step between processing module and generating output file to set up headers and management sections It is expected that after a module is processed, additional steps are required to evaluate the final values of the fields.
 
void ReadFile (Linker::Reader &rd) override
 Loads file into memory.
 
offset_t WriteFile (Linker::Writer &wr) const override
 Stores data in memory to file.
 
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
void GenerateFile (std::string filename, Linker::Module &module) override
 The main function that handles processing, calculating and generating the final image.
 
- Public Member Functions inherited from Apple::AppleSingleDouble
offset_t ImageSize () const override
 Retrieves size of stored data.
 
bool FormatSupportsResources () const override
 Whether the format supports resources.
 
hfs_type GetHomeFileSystem () const
 
void SetHomeFileSystem (hfs_type type)
 
 AppleSingleDouble (format_type type, unsigned version, hfs_type home_file_system)
 
 AppleSingleDouble (format_type type, hfs_type home_file_system)
 
 AppleSingleDouble (format_type type, unsigned version=2)
 
 AppleSingleDouble (AppleSingleDouble &other, format_type type)
 
 AppleSingleDouble (AppleSingleDouble &other)
 
void SetOptions (std::map< std::string, std::string > &options) override
 Passes command line parameters as settings over to format object.
 
std::vector< Linker::OptionDescription< void > > GetMemoryModelNames () override
 Returns a list of the supported memory models, used for documentation.
 
void SetModel (std::string model) override
 Sets the way memory is organized, typically modifying a built-in script.
 
void SetLinkScript (std::string script_file, std::map< std::string, std::string > &options) override
 Selects a script file to use for linking.
 
std::shared_ptr< const EntryFindEntry (uint32_t id) const
 
std::shared_ptr< EntryFindEntry (uint32_t id)
 
void SetCreationDate (uint32_t CreationDate)
 
void SetModificationDate (uint32_t ModificationDate)
 
void SetBackupDate (uint32_t BackupDate)
 
void SetAccessDate (uint32_t AccessDate)
 
void SetMacintoshAttributes (uint32_t Attributes)
 
void SetProDOSAccess (uint16_t Access)
 
void SetProDOSFileType (uint16_t FileType)
 
void SetProDOSAUXType (uint32_t AUXType)
 
void SetMSDOSAttributes (uint16_t Attributes)
 
uint32_t GetCreationDate ()
 
uint32_t GetModificationDate ()
 
uint32_t GetMacintoshAttributes ()
 
void ProcessModule (Linker::Module &module) override
 Processes the module object and initializes format fields.
 
std::string PrefixFilename (std::string prefix, std::string filename)
 
std::string PrefixFilename (std::string prefix, std::string filename, size_t limit)
 
std::string ReplaceExtension (std::string filename, std::string extension, size_t limit)
 
std::string GetUNIXDoubleFilename (std::string filename)
 
std::string GetMacOSXDoubleFilename (std::string filename)
 
std::string GetProDOSDoubleFilename (std::string filename)
 
std::string GetMSDOSDoubleFilename (std::string filename)
 
std::string GetDefaultExtension (Linker::Module &module) const override
 Provides a default filename for the output file.
 
- Public Member Functions inherited from Linker::OutputFormat
virtual bool AddSupplementaryOutputFormat (std::string subformat)
 If the output format actually drives multiple output formats (resource file, apple double, etc.), specify multiple types, return false if unknown.
 
virtual std::vector< OptionDescription< void > * > GetLinkerScriptParameterNames ()
 Returns a list of the parameters used in the linker scripts, used for documentation.
 
virtual std::vector< OptionDescription< void > > GetSpecialSymbolNames ()
 Returns a list of special symbol names recognized by the format, used for documentation.
 
virtual std::shared_ptr< OptionCollectorGetOptions ()
 Returns object containing a sequence of option fields provided with the -S command line flag.
 
std::optional< std::string > FetchOption (std::map< std::string, std::string > &options, std::string name)
 Convenience method to look up option by name.
 
std::string FetchOption (std::map< std::string, std::string > &options, std::string name, std::string default_value)
 Convenience method to look up option by name, returning default value if name is missing.
 
std::optional< offset_t > FetchIntegerOption (std::map< std::string, std::string > &options, std::string name)
 Convenience method to look up option by name and convert it to integer.
 
virtual std::string GetDefaultExtension (Module &module, std::string filename) const
 Appends a default extension to the filename.
 
virtual bool FormatSupportsSegmentation () const
 Whether the format supports multiple segments.
 
virtual bool FormatIs16bit () const
 Whether the format is 16-bit or not.
 
virtual bool FormatIsProtectedMode () const
 Whether the format is in protected mode or not (x86 only)
 
virtual bool FormatIsLinear () const
 Whether the address space is linear or segmented.
 
virtual bool FormatSupportsLibraries () const
 Whether the format supports libraries.
 
virtual unsigned FormatAdditionalSectionFlags (std::string section_name) const
 
- Public Member Functions inherited from Linker::Format
 Format (offset_t file_offset=0)
 
virtual void Clear ()
 Resets all fields to their default values, deallocate memory.
 
offset_t ImageSize () const override
 Retrieves size of stored data.
 
offset_t WriteFile (Writer &wr, offset_t count, offset_t offset=0) const override
 Writes data of non-zero filled sections.
 
- Public Member Functions inherited from Linker::Image
virtual std::shared_ptr< const ActualImageAsImage () const
 Retrieves a randomly accessible image.
 
std::shared_ptr< ActualImageAsImage ()
 Retrieves a randomly accessible image.
 

Public Attributes

version_t version
 
version_t minimum_version
 
uint16_t secondary_header_size = 0
 
uint16_t crc = 0
 
uint8_t attributes = 0
 
uint32_t creation = 0
 
uint32_t modification = 0
 
std::string generated_file_name
 
- Public Attributes inherited from Apple::AppleSingleDouble
format_type type = DOUBLE
 
unsigned version = 2
 
char home_file_system_string [16] = ""
 
std::vector< std::shared_ptr< Entry > > entries
 
offset_t image_size = offset_t(-1)
 
- Public Attributes inherited from Linker::Format
offset_t file_offset
 

Static Public Attributes

static uint16_t crc_step [256]
 

Additional Inherited Members

- Protected Member Functions inherited from Apple::AppleSingleDouble
std::shared_ptr< EntryGetFileDatesInfo ()
 
std::shared_ptr< EntryGetMacintoshFileInfo ()
 
std::shared_ptr< EntryGetAUXFileInfo ()
 
std::shared_ptr< EntryGetProDOSFileInfo ()
 
std::shared_ptr< EntryGetMSDOSFileInfo ()
 
std::shared_ptr< EntryGetDataFork ()
 
std::shared_ptr< EntryGetResourceFork ()
 
std::shared_ptr< EntryGetFinderInfo ()
 
- Protected Attributes inherited from Apple::AppleSingleDouble
hfs_type home_file_system
 

Detailed Description

MacBinary is an alternative format to AppleSingle for representing a Macintosh file on a non-Macintosh filesystem.

Member Function Documentation

◆ CalculateValues()

void MacBinary::CalculateValues ( )
overridevirtual

Intermediate step between processing module and generating output file to set up headers and management sections It is expected that after a module is processed, additional steps are required to evaluate the final values of the fields.

Reimplemented from Apple::AppleSingleDouble.

◆ Dump()

void MacBinary::Dump ( Dumper::Dumper & dump) const
overridevirtual

Display file contents in a nice manner.

Reimplemented from Apple::AppleSingleDouble.

◆ GenerateFile()

void MacBinary::GenerateFile ( std::string filename,
Linker::Module & module )
overridevirtual

The main function that handles processing, calculating and generating the final image.

Reimplemented from Apple::AppleSingleDouble.

◆ ReadFile()

void MacBinary::ReadFile ( Linker::Reader & rd)
overridevirtual

Loads file into memory.

Reimplemented from Apple::AppleSingleDouble.

◆ WriteFile()

offset_t MacBinary::WriteFile ( Linker::Writer & wr) const
overridevirtual

Stores data in memory to file.

Reimplemented from Apple::AppleSingleDouble.


The documentation for this class was generated from the following files: