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

AppleSingle & AppleDouble. More...

#include <macos.h>

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

Classes

class  Entry
 

Public Types

enum  format_type { SINGLE , DOUBLE }
 
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

void ReadFile (Linker::Reader &rd) override
 Loads file into memory.
 
bool FormatSupportsResources () const override
 Whether the format supports resources.
 
 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.
 
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< 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.
 
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 WriteFile (Linker::Writer &wr) override
 Stores data in memory to file.
 
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)
 
void GenerateFile (std::string filename, Linker::Module &module) override
 The main function that handles processing, calculating and generating the final image.
 
std::string GetDefaultExtension (Linker::Module &module) 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.
 
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 (Linker::Module &module, std::string filename)
 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 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.
 
virtual void Dump (Dumper::Dumper &dump)
 Display file contents in a nice manner.
 

Public Attributes

format_type type
 
unsigned version
 
hfs_type home_file_system
 
std::vector< std::shared_ptr< Entry > > entries
 
- Public Attributes inherited from Linker::Format
offset_t file_offset
 

Protected Member Functions

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 ()
 

Detailed Description

AppleSingle & AppleDouble.

On classic Macintosh systems, each file has two associated parts called forks: the data fork and the resource fork. Classic 68000 applications store all the executable data in the resource fork, which is usually not transferred to non-Macintosh platforms. The AppleSingle and AppleDouble formats provide a way to store both the data and resource fork, or the resource fork, as a separate file, alongside other metadata, which is essential when storing it on a non-Macintosh system.

This container format was first invented for the A/UX Apple UNIX system. It has two versions, and version 2 is used most commonly. See also Apple::AppleSingleDouble::ResourceFork.

Member Function Documentation

◆ CalculateValues()

void AppleSingleDouble::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 Linker::OutputFormat.

◆ FormatSupportsResources()

bool AppleSingleDouble::FormatSupportsResources ( ) const
overridevirtual

Whether the format supports resources.

Formats such as NE, LE/LX, PE and the Macintosh classic support including resources in the final binary. To simplify writing resources, the ELF parser permits incorporating them directly in the binary image as $$RSRC$_<type>$<id>.

Reimplemented from Linker::OutputFormat.

◆ GenerateFile()

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

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

Reimplemented from Linker::OutputFormat.

Reimplemented in Apple::MacBinary.

◆ GetDefaultExtension()

std::string AppleSingleDouble::GetDefaultExtension ( Linker::Module & module)
overridevirtual

Provides a default filename for the output file.

Typically a.out or some other extension, such as a.exe.

Reimplemented from Linker::OutputFormat.

◆ ProcessModule()

void AppleSingleDouble::ProcessModule ( Linker::Module & object)
overridevirtual

Processes the module object and initializes format fields.

Reimplemented from Linker::OutputFormat.

◆ ReadFile()

void AppleSingleDouble::ReadFile ( Linker::Reader & in)
overridevirtual

Loads file into memory.

Implements Linker::Format.

◆ SetLinkScript()

void AppleSingleDouble::SetLinkScript ( std::string script_file,
std::map< std::string, std::string > & options )
overridevirtual

Selects a script file to use for linking.

Reimplemented from Linker::OutputFormat.

◆ SetModel()

void AppleSingleDouble::SetModel ( std::string model)
overridevirtual

Sets the way memory is organized, typically modifying a built-in script.

Reimplemented from Linker::OutputFormat.

◆ SetOptions()

void AppleSingleDouble::SetOptions ( std::map< std::string, std::string > & options)
overridevirtual

Passes command line parameters as settings over to format object.

Reimplemented from Linker::OutputFormat.

◆ WriteFile()

void AppleSingleDouble::WriteFile ( Linker::Writer & out)
overridevirtual

Stores data in memory to file.

Implements Linker::Format.

Reimplemented in Apple::MacBinary.


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