4#include "../dumper/dumper.h"
5#include "../linker/format.h"
34 using Timestamp = ::Timestamp<clock>;
37 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
44 format_type type = DOUBLE;
58 hfs_type home_file_system;
60 hfs_type GetHomeFileSystem()
const;
61 void SetHomeFileSystem(hfs_type type);
63 char home_file_system_string[16] =
"";
69 offset_t file_offset = 0;
70 offset_t image_size = 0;
78 static std::shared_ptr<Entry> ReadEntry(
const std::shared_ptr<Linker::Reader>& rd, hfs_type home_file_system);
79 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override = 0;
81 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& out)
const override = 0;
90 std::shared_ptr<Linker::Contents> image;
97 GenericEntry(uint32_t
id, std::shared_ptr<Linker::Contents> image)
98 :
Entry(
id), image(image)
104 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
107 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& out)
const override;
112 static const char TXT_undefined[16];
113 static const char TXT_Macintosh[16];
114 static const char TXT_ProDOS[16];
115 static const char TXT_MS_DOS[16];
116 static const char TXT_UNIX[16];
117 static const char TXT_VAX_VMS[16];
119 std::vector<std::shared_ptr<Entry>> entries;
120 offset_t image_size = offset_t(-1);
133 ID_MacintoshFileInfo,
143 SetHomeFileSystem(HFS_UNDEFINED);
146 AppleSingleDouble(format_type type,
unsigned version, hfs_type home_file_system)
147 : type(type), version(version)
149 assert(type == SINGLE || type == DOUBLE);
150 SetHomeFileSystem(version == 1 ? home_file_system : HFS_UNDEFINED);
153 AppleSingleDouble(format_type type, hfs_type home_file_system)
154 : type(type), version(1), home_file_system(home_file_system)
156 assert(type == SINGLE || type == DOUBLE);
157 SetHomeFileSystem(home_file_system);
160 AppleSingleDouble(format_type type,
unsigned version = 2)
161 : type(type), version(version), home_file_system(HFS_UNDEFINED)
163 assert(type == SINGLE || type == DOUBLE);
164 SetHomeFileSystem(HFS_UNDEFINED);
168 explicit AppleSingleDouble(AppleSingleDouble& other, format_type type)
169 : type(type), version(other.version), home_file_system(other.home_file_system)
171 SetHomeFileSystem(other.GetHomeFileSystem());
172 if(type == SINGLE && other.type == DOUBLE)
176 for(
auto entry : other.entries)
178 if(type == DOUBLE && entry->id == ID_DataFork)
180 entries.push_back(entry);
184 explicit AppleSingleDouble(AppleSingleDouble& other)
185 : type(other.type), version(other.version), home_file_system(other.home_file_system)
187 for(
auto entry : other.entries)
189 entries.push_back(entry);
193 std::shared_ptr<const Entry> FindEntry(uint32_t
id)
const;
194 std::shared_ptr<Entry> FindEntry(uint32_t
id);
195 void AppendEntry(std::shared_ptr<Entry> entry);
197 std::shared_ptr<Entry> GetFileDatesInfo();
198 std::shared_ptr<Entry> GetMacintoshFileInfo();
199 std::shared_ptr<Entry> GetAUXFileInfo();
200 std::shared_ptr<Entry> GetProDOSFileInfo();
201 std::shared_ptr<Entry> GetMSDOSFileInfo();
203 std::shared_ptr<Entry> GetDataFork();
204 std::shared_ptr<Entry> GetResourceFork();
205 std::shared_ptr<Entry> GetFinderInfo();
206 std::shared_ptr<Entry> GetRealName();
208 void SetCreationDate(Timestamp CreationDate);
209 void SetModificationDate(Timestamp ModificationDate);
210 void SetBackupDate(Timestamp BackupDate);
211 void SetAccessDate(Timestamp AccessDate);
212 void SetMacintoshAttributes(uint32_t Attributes);
213 void SetProDOSAccess(uint16_t Access);
214 void SetProDOSFileType(uint16_t FileType);
215 void SetProDOSAuxiliaryType(uint32_t AuxiliaryType);
216 void SetMSDOSAttributes(uint16_t Attributes);
232 void CalculateOffsets();
234 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
237 std::string PrefixFilename(std::string prefix, std::string filename);
238 std::string PrefixFilename(std::string prefix, std::string filename,
size_t limit);
239 std::string ReplaceExtension(std::string filename, std::string extension,
size_t limit);
241 std::string GetUNIXDoubleFilename(std::string filename);
242 std::string GetMacOSXDoubleFilename(std::string filename);
243 std::string GetProDOSDoubleFilename(std::string filename);
244 std::string GetMSDOSDoubleFilename(std::string filename);
260 : Entry(AppleSingleDouble::ID_RealName), name(name)
266 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
269 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
278 : Entry(AppleSingleDouble::ID_IconBW)
285 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
288 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& out)
const override;
297 : Entry(AppleSingleDouble::ID_IconColor)
304 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
307 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& out)
const override;
317 : Entry(AppleSingleDouble::ID_FileInfo)
331 AppleSingleDouble::Timestamp CreationDate;
332 AppleSingleDouble::Timestamp ModificationDate;
333 AppleSingleDouble::Timestamp LastBackupDate;
336 Macintosh(AppleSingleDouble::Timestamp CreationDate = { },
337 AppleSingleDouble::Timestamp ModificationDate = { },
338 AppleSingleDouble::Timestamp LastBackupDate = { },
339 uint32_t Attributes = 0)
340 : CreationDate(CreationDate), ModificationDate(ModificationDate), LastBackupDate(LastBackupDate), Attributes(Attributes)
346 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
349 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
357 AppleSingleDouble::Timestamp CreationDate;
358 AppleSingleDouble::Timestamp ModificationDate;
361 uint32_t AuxiliaryType;
363 ProDOS(AppleSingleDouble::Timestamp CreationDate = { },
364 AppleSingleDouble::Timestamp ModificationDate = { },
366 uint16_t FileType = 0,
367 uint32_t AuxiliaryType = 0)
368 : CreationDate(CreationDate), ModificationDate(ModificationDate), Access(Access), FileType(FileType), AuxiliaryType(AuxiliaryType)
374 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
377 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
385 AppleSingleDouble::Timestamp ModificationDate;
388 MSDOS(AppleSingleDouble::Timestamp ModificationDate = { },
389 uint16_t Attributes = 0)
390 : ModificationDate(ModificationDate), Attributes(Attributes)
396 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
399 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
407 AppleSingleDouble::Timestamp CreationDate;
408 AppleSingleDouble::Timestamp AccessDate;
409 AppleSingleDouble::Timestamp ModificationDate;
411 AUX(AppleSingleDouble::Timestamp CreationDate = { },
412 AppleSingleDouble::Timestamp AccessDate = { },
413 AppleSingleDouble::Timestamp ModificationDate = { })
414 : CreationDate(CreationDate), AccessDate(AccessDate), ModificationDate(ModificationDate)
420 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
423 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
432 AppleSingleDouble::Timestamp CreationDate;
433 AppleSingleDouble::Timestamp ModificationDate;
434 AppleSingleDouble::Timestamp BackupDate;
435 AppleSingleDouble::Timestamp AccessDate;
438 AppleSingleDouble::Timestamp CreationDate = { },
439 AppleSingleDouble::Timestamp ModificationDate = { },
440 AppleSingleDouble::Timestamp BackupDate = { },
441 AppleSingleDouble::Timestamp AccessDate = { })
442 : Entry(AppleSingleDouble::ID_FileDatesInfo),
443 CreationDate(CreationDate), ModificationDate(ModificationDate), BackupDate(BackupDate), AccessDate(AccessDate)
449 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
452 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
455 static void DumpFields(
Dumper::Region& region, std::optional<AppleSingleDouble::Timestamp> CreationDate, std::optional<AppleSingleDouble::Timestamp> ModificationDate, std::optional<AppleSingleDouble::Timestamp> BackupDate, std::optional<AppleSingleDouble::Timestamp> AccessDate);
467 char Type[4] = {
'?',
'?',
'?',
'?' };
468 char Creator[4] = {
'?',
'?',
'?',
'?' };
470 Point Location = { 0, 0 };
475 int16_t CommentID = 0;
476 int32_t HomeDirectoryID = 0;
479 : Entry(AppleSingleDouble::ID_FinderInfo)
485 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
488 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
492 void SetTypeAndCreator(std::string type, std::string creator);
501 : Entry(AppleSingleDouble::ID_MacintoshFileInfo), Attributes(Attributes)
507 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
510 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
513 static void DumpFields(
Dumper::Region& region, uint32_t Attributes);
522 uint32_t AuxiliaryType;
525 uint16_t FileType = 0,
526 uint32_t AuxiliaryType = 0)
527 : Entry(AppleSingleDouble::ID_ProDOSFileInfo), Access(Access), FileType(FileType), AuxiliaryType(AuxiliaryType)
533 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
536 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
539 static void DumpFields(
Dumper::Region& region, uint16_t Access, uint16_t FileType, uint32_t AuxiliaryType);
549 : Entry(AppleSingleDouble::ID_MSDOSFileInfo), Attributes(Attributes)
555 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
558 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
561 static void DumpFields(
Dumper::Region& region, uint16_t Attributes);
569 : Entry(AppleSingleDouble::ID_AFPShortName)
576 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
579 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
589 : Entry(AppleSingleDouble::ID_AFPFileInfo)
596 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
599 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
609 : Entry(AppleSingleDouble::ID_AFPDirectoryID)
616 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
619 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
630 std::shared_ptr<AppleSingleDouble> apple_single;
640 version_t version, minimum_version;
642 uint16_t secondary_header_size = 0;
643 mutable uint16_t crc = 0;
645 uint8_t attributes = 0;
646 ::Timestamp<Macintosh_clock> creation = { };
647 ::Timestamp<Macintosh_clock> modification = { };
650 uint32_t data_fork_length = 0;
651 uint32_t resource_fork_length = 0;
652 uint16_t comment_length = 0;
654 std::string generated_file_name;
657 : apple_single(std::make_shared<AppleSingleDouble>(AppleSingleDouble::DOUBLE)), version(version), minimum_version(version <= MACBIN2 ? version : MACBIN2)
661 MacBinary(version_t version, version_t minimum_version)
662 : apple_single(std::make_shared<AppleSingleDouble>(AppleSingleDouble::DOUBLE)), version(version), minimum_version(version < minimum_version ? version : minimum_version)
666 explicit MacBinary(std::shared_ptr<AppleSingleDouble> apple, version_t version, version_t minimum_version)
667 : apple_single(apple), version(version), minimum_version(version < minimum_version ? version : minimum_version)
672 static uint16_t crc_step[256];
674 void CRC_Initialize()
const;
676 void CRC_Step(uint8_t
byte = 0)
const;
678 void Skip(
const std::shared_ptr<Linker::Writer>& wr,
size_t count)
const;
680 void WriteData(
const std::shared_ptr<Linker::Writer>& wr,
size_t count,
const void * data)
const;
682 void WriteData(
const std::shared_ptr<Linker::Writer>& wr,
size_t count, std::string text)
const;
684 void WriteWord(
const std::shared_ptr<Linker::Writer>& wr,
size_t bytes, uint64_t value)
const;
686 template <
typename Clock>
687 void WriteTimestamp(
const std::shared_ptr<Linker::Writer>& wr, Timestamp<Clock> timestamp)
const
689 WriteWord(wr,
sizeof(
typename Clock::rep), Clock::to_ticks(timestamp));
692 void ReadHeader(
const std::shared_ptr<Linker::Reader>& rd);
693 void WriteHeader(
const std::shared_ptr<Linker::Writer>& wr)
const;
695 void CalculateOffsets();
697 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
700 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
753 enum file_type_t : uint8_t
755 FILE_TYPE_BIN = 0x06,
756 FILE_TYPE_SOS = 0x0C,
757 FILE_TYPE_S16 = 0xB3,
758 FILE_TYPE_EXE = 0xB5,
759 FILE_TYPE_SYS = 0xFF,
762 unsigned apple_single_double_version = 2;
764 Apple::AppleSingleDouble::hfs_type home_file_system = Apple::AppleSingleDouble::HFS_UNDEFINED;
766 MacBinary::version_t macbinary_version = MacBinary::MACBIN3, macbinary_minimum_version = MacBinary::MACBIN2;
768 void SetAppleSingleDoubleVersion(offset_t version);
804 virtual void OnReadFile(
const std::shared_ptr<Linker::Reader>& rd);
806 virtual offset_t
OnWriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const;
812 void GenerateFiles(std::string filename, std::shared_ptr<Contents> data_fork, std::shared_ptr<Contents> resource_fork, uint8_t file_type, uint16_t auxiliary_file_type);
815 void ReadFile(
const std::shared_ptr<Linker::Reader>& rd)
override;
818 offset_t
WriteFile(
const std::shared_ptr<Linker::Writer>& wr)
const override;
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1842
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1847
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1853
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1837
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1824
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1819
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1830
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1814
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1791
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1807
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1796
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1801
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &out) const override=0
Stores data in memory to file.
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override=0
Loads file into memory.
offset_t ImageSize() const override=0
Retrieves the offset of the byte after the last one belonging to this format from the first one.
void Dump(Dumper::Dumper &dump) const override=0
Display file contents in a nice manner.
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &out) const override
Stores data in memory to file.
Definition apple.cc:253
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:215
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:266
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:220
AppleSingle & AppleDouble.
Definition apple.h:30
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:54
Timestamp GetCreationDate()
Retrieves creation date field and creates it if it does not exist.
Definition apple.cc:547
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:951
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:17
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:919
Timestamp GetModificationDate()
Retrieves modification date field and creates it if it does not exist.
Definition apple.cc:651
uint32_t ReadMacintoshAttributes()
Retrieves Macintosh attributes field if it exists.
Definition apple.cc:796
uint32_t GetMacintoshAttributes()
Retrieves Macintosh attributes field and creates it if it does not exist.
Definition apple.cc:780
std::optional< Timestamp > ReadCreationDate()
Retrieves creation date field if it exists.
Definition apple.cc:582
std::optional< Timestamp > ReadModificationDate()
Retrieves modification date field if it exists.
Definition apple.cc:692
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1239
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1234
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1229
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1250
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1209
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1200
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1219
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1205
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1168
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1180
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1173
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1189
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1108
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1099
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1119
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1094
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1135
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1145
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1157
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1130
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1305
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1287
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1282
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1325
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1048
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1064
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &out) const override
Stores data in memory to file.
Definition apple.cc:1058
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1053
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1071
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1076
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1087
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &out) const override
Stores data in memory to file.
Definition apple.cc:1081
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1769
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1763
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1758
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1777
MacBinary is an alternative format to AppleSingle for representing a Macintosh file on a non-Macintos...
Definition apple.h:628
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:2103
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:2162
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:2132
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1359
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1370
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1378
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1364
This is not actually a file format, but an interface to permit generating multiple binary outputs for...
Definition apple.h:709
std::shared_ptr< MacBinary > mac_binary
Container for MacBinary (Macintosh only)
Definition apple.h:797
void GenerateFiles(std::string filename, std::shared_ptr< Contents > data_fork, std::shared_ptr< Contents > resource_fork, uint8_t file_type, uint16_t auxiliary_file_type)
Tasked to create all the requested files.
Definition apple.cc:2316
virtual offset_t OnWriteFile(const std::shared_ptr< Linker::Writer > &wr) const
Called if there is no container allocated.
Definition apple.cc:2305
produce_format_t
Represents what additional files should be generated.
Definition apple.h:731
@ PRODUCE_NAPS_SUFFIX
NuLib2 attribute preservation string suffix, such as #06xxxx (Apple II, III, IIgs only)
Definition apple.h:741
@ PRODUCE_FINDER_INFO
Places a Finder Information file under the directory .finf (Macintosh only)
Definition apple.h:735
@ PRODUCE_MAC_BINARY
Creates a MacBinary with the .mbin extension (Macintosh only)
Definition apple.h:739
@ PRODUCE_RESOURCE_FORK
Places a GS/OS format resource file under the directory .rsrc.
Definition apple.h:733
@ PRODUCE_APPLE_DOUBLE
Creates an AppleDouble binary with the '' prefix.
Definition apple.h:737
target_format_t target
Format of "filename".
Definition apple.h:746
container_format_t
Format of container stored in memory.
Definition apple.h:783
@ CONTAINER_APPLE_SINGLE
Use an AppleSingle container.
Definition apple.h:787
@ CONTAINER_MAC_BINARY
Use a MacBinary container as well as an AppleSingle container (Macintosh only)
Definition apple.h:789
@ CONTAINER_NONE
No container is stored.
Definition apple.h:785
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:2556
container_format_t container
The container type used to store metainformation while processing.
Definition apple.h:792
target_format_t
Represents the file type of the main file.
Definition apple.h:713
@ TARGET_DATA_FORK
Main file is a data fork, typically empty.
Definition apple.h:717
@ TARGET_RESOURCE_FORK
Main file is a resource fork.
Definition apple.h:719
@ TARGET_APPLE_SINGLE
Main file is an AppleSingle.
Definition apple.h:721
@ TARGET_NONE
Do not generate main file.
Definition apple.h:715
@ TARGET_APPLE_DOUBLE
Main file is an AppleDouble.
Definition apple.h:723
@ TARGET_MAC_BINARY
Main file as a MacBinary (Macintosh only)
Definition apple.h:725
produce_format_t produce
Bitset of other files to produce.
Definition apple.h:749
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:2492
bool AddSupplementaryOutputFormat(std::string subformat) override
If the output format actually drives multiple output formats (resource file, apple double,...
Definition apple.cc:2223
virtual void OnDump(Dumper::Dumper &dump) const
Called if there is no container allocated.
Definition apple.cc:2311
std::shared_ptr< Apple::AppleSingleDouble > apple_single
Container for all the necessary additional information.
Definition apple.h:795
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:2541
virtual void OnReadFile(const std::shared_ptr< Linker::Reader > &rd)
Called if there is no container allocated.
Definition apple.cc:2300
virtual void OnContainerCreated()
Called after the container is created.
Definition apple.cc:2294
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition apple.cc:2296
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1396
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1419
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1401
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1409
offset_t WriteFile(const std::shared_ptr< Linker::Writer > &wr) const override
Stores data in memory to file.
Definition apple.cc:1033
offset_t ImageSize() const override
Retrieves the offset of the byte after the last one belonging to this format from the first one.
Definition apple.cc:1023
void ReadFile(const std::shared_ptr< Linker::Reader > &rd) override
Loads file into memory.
Definition apple.cc:1028
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition apple.cc:1041
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:1009
A record that represents a region within the file.
Definition dumper.h:902
A static class that encodes a specific timestamp format.
Definition common.h:210