RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
macos.h
1#ifndef MACOS_H
2#define MACOS_H
3
4#include <filesystem>
5#include <optional>
6#include <set>
7#include <vector>
8#include "../linker/linker.h"
9#include "../linker/module.h"
10#include "../linker/segment.h"
11#include "../linker/writer.h"
12
13/* Classic 68000 Mac OS file formats */
14
15namespace Apple
16{
17 typedef char OSType[4];
18
19 /* TODO: rework with Linker::Format */
20
33 {
34 public:
35 void ReadFile(Linker::Reader& rd) override;
36
37 bool FormatSupportsResources() const override;
38
39 enum format_type
40 {
41 SINGLE,
42 DOUBLE,
43 };
44 format_type type;
45 unsigned version;
46 /* Only relevant for version 1 */
47 enum hfs_type
48 {
49 HFS_UNDEFINED,
50 HFS_Macintosh,
51 HFS_ProDOS,
52 HFS_MSDOS,
53 HFS_UNIX,
54 HFS_VAX_VMS,
55 };
56 hfs_type home_file_system;
57
58 class Entry : public virtual Linker::Format
59 {
60 public:
61 const uint32_t id;
62 protected:
63 Entry(uint32_t id)
64 : id(id)
65 {
66 }
67 public:
68 virtual offset_t GetLength();
69 void ReadFile(Linker::Reader& rd) override;
70 void WriteFile(Linker::Writer& out) override;
71
72 virtual void ProcessModule(Linker::Module& module);
73 virtual void CalculateValues();
74 };
75
76 private:
77 static const char TXT_undefined[16];
78 static const char TXT_Macintosh[16];
79 static const char TXT_ProDOS[16];
80 static const char TXT_MS_DOS[16];
81 static const char TXT_UNIX[16];
82 static const char TXT_VAX_VMS[16];
83
84 public:
85 std::vector<std::shared_ptr<Entry>> entries;
86
87 enum
88 {
89 ID_DataFork = 1,
90 ID_ResourceFork,
91 ID_RealName,
92 ID_Comment,
93 ID_IconBW,
94 ID_IconColor,
95 ID_FileInfo, /* v1 only */
96 ID_FileDatesInfo, /* v2 only */
97 ID_FinderInfo,
98 ID_MacintoshFileInfo, /* v2 only */
99 ID_ProDOSFileInfo, /* v2 only */
100 ID_MSDOSFileInfo, /* v2 only */
101 ID_AFPShortName, /* v2 only */
102 ID_AFPFileInfo, /* v2 only */
103 ID_AFPDirectoryID, /* v2 only */
104 };
105
106 AppleSingleDouble(format_type type, unsigned version, hfs_type home_file_system)
107 : type(type), version(version), home_file_system(version == 1 ? home_file_system : HFS_UNDEFINED)
108 {
109 assert(type == SINGLE || type == DOUBLE);
110 }
111
112 AppleSingleDouble(format_type type, hfs_type home_file_system)
113 : type(type), version(1), home_file_system(home_file_system)
114 {
115 assert(type == SINGLE || type == DOUBLE);
116 }
117
118 AppleSingleDouble(format_type type, unsigned version = 2)
119 : type(type), version(version), home_file_system(HFS_UNDEFINED)
120 {
121 assert(type == SINGLE || type == DOUBLE);
122 }
123
124 /* TODO: a destructor might remove the entries of the other object as well */
125 explicit AppleSingleDouble(AppleSingleDouble& other, format_type type)
126 : type(type), version(other.version), home_file_system(other.home_file_system)
127 {
128 if(type == SINGLE && other.type == DOUBLE)
129 {
130 GetDataFork();
131 }
132 for(auto entry : other.entries)
133 {
134 if(type == DOUBLE && entry->id == ID_DataFork)
135 continue;
136 entries.push_back(entry);
137 }
138 }
139
140 explicit AppleSingleDouble(AppleSingleDouble& other)
141 : type(other.type), version(other.version), home_file_system(other.home_file_system)
142 {
143 for(auto entry : other.entries)
144 {
145 entries.push_back(entry);
146 }
147 }
148
149 void SetOptions(std::map<std::string, std::string>& options) override;
150 void SetModel(std::string model) override;
151 void SetLinkScript(std::string script_file, std::map<std::string, std::string>& options) override;
152
153 std::shared_ptr<Entry> FindEntry(uint32_t id);
154
155 protected:
156 std::shared_ptr<Entry> GetFileDatesInfo();
157 std::shared_ptr<Entry> GetMacintoshFileInfo();
158 std::shared_ptr<Entry> GetAUXFileInfo();
159 std::shared_ptr<Entry> GetProDOSFileInfo();
160 std::shared_ptr<Entry> GetMSDOSFileInfo();
161
162 std::shared_ptr<Entry> GetDataFork();
163 std::shared_ptr<Entry> GetResourceFork();
164 std::shared_ptr<Entry> GetFinderInfo();
165
166 public:
167 void SetCreationDate(uint32_t CreationDate);
168 void SetModificationDate(uint32_t ModificationDate);
169 void SetBackupDate(uint32_t BackupDate);
170 void SetAccessDate(uint32_t AccessDate);
171 void SetMacintoshAttributes(uint32_t Attributes);
172 void SetProDOSAccess(uint16_t Access);
173 void SetProDOSFileType(uint16_t FileType);
174 void SetProDOSAUXType(uint32_t AUXType);
175 void SetMSDOSAttributes(uint16_t Attributes);
176
177 uint32_t GetCreationDate();
178 uint32_t GetModificationDate();
179 uint32_t GetMacintoshAttributes();
180
181 void ProcessModule(Linker::Module& module) override;
182 void CalculateValues() override;
183 void WriteFile(Linker::Writer& wr) override;
184
185 std::string PrefixFilename(std::string prefix, std::string filename);
186 std::string PrefixFilename(std::string prefix, std::string filename, size_t limit);
187 std::string ReplaceExtension(std::string filename, std::string extension, size_t limit);
188
189 std::string GetUNIXDoubleFilename(std::string filename);
190 std::string GetMacOSXDoubleFilename(std::string filename);
191 std::string GetProDOSDoubleFilename(std::string filename);
192 std::string GetMSDOSDoubleFilename(std::string filename);
193
194 void GenerateFile(std::string filename, Linker::Module& module) override;
195
196 std::string GetDefaultExtension(Linker::Module& module) override;
197 };
198
200 {
201 public:
202 DataFork()
203 : Entry(AppleSingleDouble::ID_DataFork)
204 {
205 }
206 /* TODO - this is a stub */
207 };
208
218 {
219 public:
220 bool FormatSupportsResources() const override
221 {
222 return true;
223 }
224
225 using LinkerManager::SetLinkScript;
226
227 enum memory_model_t
228 {
229 MODEL_DEFAULT,
230 MODEL_TINY,
231 };
232 memory_model_t memory_model;
233
234
235 void SetOptions(std::map<std::string, std::string>& options) override;
236
237 void SetModel(std::string model) override;
238
240 {
241 public:
242 void ReadFile(Linker::Reader& rd) override;
243 void WriteFile(Linker::Writer& wr) override;
244
245 protected:
246 Resource(const char type[4], uint16_t id, uint8_t attributes = 0)
247 : id(id), attributes(attributes)
248 {
249 memcpy(this->type, type, 4);
250 }
251
252 Resource(const char type[4], uint16_t id, std::string name, uint8_t attributes = 0)
253 : id(id), name(name), attributes(attributes)
254 {
255 memcpy(this->type, type, 4);
256 }
257
258 public:
259 char type[4];
260 uint16_t id;
261
262 std::optional<std::string> name;
263 uint8_t attributes;
264
265 /* calculated later */
266 uint16_t name_offset = 0;
267 uint32_t data_offset = 0;
268
269 virtual offset_t GetLength() = 0;
270 };
271
273 {
274 public:
275 GenericResource(const char type[4], uint16_t id)
276 : Resource(type, id)
277 {
278 }
279
280 std::shared_ptr<Linker::Segment> resource;
281
282 void ProcessModule(Linker::Module& module) override;
283
284 void CalculateValues() override;
285
286 offset_t GetLength() override;
287
288 void WriteFile(Linker::Writer& wr) override;
289 };
290
292 {
293 public:
295 : Resource("CODE", 0)
296 {
297 }
298
299 struct Entry
300 {
301 uint16_t segment;
302 uint32_t offset;
303 };
304
305 uint32_t above_a5 = 0;
306 uint32_t below_a5 = 0;
307 std::vector<Entry> near_entries;
308 std::vector<Entry> far_entries;
309
310 void ProcessModule(Linker::Module& module) override;
311
312 void CalculateValues() override;
313
314 offset_t GetLength() override;
315
316 enum
317 {
318 MOVE_DATA_SP = 0x3F3C,
319 LOADSEG = 0xA9F0,
320 };
321
322 void WriteFile(Linker::Writer& wr) override;
323 };
324
325 class CodeResource : public Resource
326 {
327 public:
328 std::shared_ptr<JumpTableCodeResource> jump_table;
329 std::shared_ptr<Linker::Segment> image;
330
331 CodeResource(uint16_t id, std::shared_ptr<JumpTableCodeResource> jump_table)
332 : Resource("CODE", id), jump_table(jump_table)/*, image("code")*/
333 {
334 }
335
336 bool is_far = false; /* TODO: test far segments thoroughly */
337 uint32_t a5_address = 0; /* TODO: meaning */
338 uint32_t base_address = 0; /* TODO: meaning */
339
340// std::vector<JumpTableCodeResource::Entry> near_entries;
341// std::vector<JumpTableCodeResource::Entry> far_entries;
342 std::set<uint16_t> near_entries;
343 std::set<uint32_t> far_entries;
344 std::set<uint32_t> a5_relocations;
345 std::set<uint32_t> segment_relocations;
346
347 /* filled in after calculation */
348 uint32_t first_near_entry_offset;
349 uint32_t first_far_entry_offset;
350 uint32_t a5_relocation_offset;
351 uint32_t segment_relocation_offset;
352 uint32_t resource_size;
353
354 void ProcessModule(Linker::Module& module) override;
355
356 void CalculateValues() override;
357
358 offset_t GetLength() override;
359
360 uint32_t MeasureRelocations(std::set<uint32_t>& relocations);
361
362 void WriteRelocations(Linker::Writer& wr, std::set<uint32_t>& relocations);
363
364 void WriteFile(Linker::Writer& wr) override;
365 };
366
368 : Entry(AppleSingleDouble::ID_ResourceFork)/*, a5world(".bss")*/
369 {
370 }
371
373 {
374 }
375
376 uint16_t attributes = 0; /* TODO: parametrize */
377 std::map<uint32_t, std::map<uint16_t, std::shared_ptr<Resource>>> resources;
378
379 /* these will be calculated */
380 uint32_t data_offset = 0, data_length = 0, map_offset = 0, map_length = 0;
381 uint16_t name_list_offset = 0;
382 std::map<uint32_t, uint16_t> reference_list_offsets;
383
384 /* filled in during generation */
385 std::shared_ptr<JumpTableCodeResource> jump_table;
386 std::vector<std::shared_ptr<CodeResource>> codes;
387 std::map<std::shared_ptr<Linker::Segment>, std::shared_ptr<CodeResource>> segments;
388 std::shared_ptr<Linker::Segment> a5world;
389
390 void AddResource(std::shared_ptr<Resource> resource);
391
392 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
393
394 std::unique_ptr<Script::List> GetScript(Linker::Module& module);
395
396 void Link(Linker::Module& module);
397
398 void ProcessModule(Linker::Module& module) override;
399
400 void CalculateValues() override;
401
402 offset_t GetLength() override;
403
404 void WriteFile(Linker::Writer& wr) override;
405
406 void GenerateFile(std::string filename, Linker::Module& module) override;
407
408 std::string GetDefaultExtension(Linker::Module& module) override;
409 };
410
412 {
413 public:
414 std::string name;
415
416 RealName(std::string name)
417 : Entry(AppleSingleDouble::ID_RealName), name(name)
418 {
419 }
420
421 offset_t GetLength() override;
422
423 void WriteFile(Linker::Writer& wr) override;
424 };
425
427 {
428 public:
429 Comment()
430 : Entry(AppleSingleDouble::ID_Comment)
431 {
432 }
433 /* TODO - this is a stub */
434 };
435
437 {
438 public:
439 IconBW()
440 : Entry(AppleSingleDouble::ID_IconBW)
441 {
442 }
443 /* TODO - this is a stub */
444 };
445
447 {
448 public:
449 IconColor()
450 : Entry(AppleSingleDouble::ID_IconColor)
451 {
452 }
453 /* TODO - this is a stub */
454 };
455
456 /* Version 1 only */
458 {
459 protected:
460 FileInfo()
461 : Entry(AppleSingleDouble::ID_FileInfo)
462 {
463 }
464
465 public:
466 class Macintosh;
467 class ProDOS;
468 class MSDOS;
469 class AUX;
470 };
471
473 {
474 public:
475 uint32_t CreationDate;
476 uint32_t ModificationDate;
477 uint32_t LastBackupDate;
478 uint32_t Attributes;
479
480 Macintosh(uint32_t CreationDate = 0,
481 uint32_t ModificationDate = 0,
482 uint32_t LastBackupDate = 0,
483 uint32_t Attributes = 0)
484 : CreationDate(CreationDate), ModificationDate(ModificationDate), LastBackupDate(LastBackupDate), Attributes(Attributes)
485 {
486 }
487
488 offset_t GetLength() override;
489
490 void WriteFile(Linker::Writer& wr) override;
491 };
492
494 {
495 public:
496 uint32_t CreationDate;
497 uint32_t ModificationDate;
498 uint16_t Access;
499 uint16_t FileType;
500 uint32_t AUXType;
501
502 ProDOS(uint32_t CreationDate = 0,
503 uint32_t ModificationDate = 0,
504 uint16_t Access = 0,
505 uint16_t FileType = 0,
506 uint32_t AUXType = 0)
507 : CreationDate(CreationDate), ModificationDate(ModificationDate), Access(Access), FileType(FileType), AUXType(AUXType)
508 {
509 }
510
511 offset_t GetLength() override;
512
513 void WriteFile(Linker::Writer& wr) override;
514 };
515
517 {
518 public:
519 uint32_t ModificationDate;
520 uint16_t Attributes;
521
522 MSDOS(uint32_t ModificationDate = 0,
523 uint16_t Attributes = 0)
524 : ModificationDate(ModificationDate), Attributes(Attributes)
525 {
526 }
527
528 offset_t GetLength() override;
529
530 void WriteFile(Linker::Writer& wr) override;
531 };
532
533 class FileInfo::AUX : public FileInfo
534 {
535 public:
536 uint32_t CreationDate;
537 uint32_t AccessDate;
538 uint32_t ModificationDate;
539
540 AUX(uint32_t CreationDate = 0,
541 uint32_t AccessDate = 0,
542 uint32_t ModificationDate = 0)
543 : CreationDate(CreationDate), AccessDate(AccessDate), ModificationDate(ModificationDate)
544 {
545 }
546
547 offset_t GetLength() override;
548
549 void WriteFile(Linker::Writer& wr) override;
550 };
551
552 /* Version 2 only */
554 {
555 public:
556 uint32_t CreationDate;
557 uint32_t ModificationDate;
558 uint32_t BackupDate;
559 uint32_t AccessDate;
560
562 uint32_t CreationDate = 0,
563 uint32_t ModificationDate = 0,
564 uint32_t BackupDate = 0,
565 uint32_t AccessDate = 0)
566 : Entry(AppleSingleDouble::ID_FileDatesInfo),
567 CreationDate(CreationDate), ModificationDate(ModificationDate), BackupDate(BackupDate), AccessDate(AccessDate)
568 {
569 }
570
571 offset_t GetLength() override;
572
573 void WriteFile(Linker::Writer& wr) override;
574 };
575
577 {
578 public:
579 struct Point
580 {
581 uint16_t x, y;
582 };
583
584 char Type[4] = { '?', '?', '?', '?' };
585 char Creator[4] = { '?', '?', '?', '?' };
586 uint16_t Flags = 0;
587 Point Location = { 0, 0 };
588
589 FinderInfo()
590 : Entry(AppleSingleDouble::ID_FinderInfo)
591 {
592 }
593
594 offset_t GetLength() override;
595
596 void WriteFile(Linker::Writer& wr) override;
597
598 void ProcessModule(Linker::Module& module) override;
599 };
600
601 /* Version 2 only */
603 {
604 public:
605 uint32_t Attributes;
606 MacintoshFileInfo(uint32_t Attributes = 0)
607 : Entry(AppleSingleDouble::ID_MacintoshFileInfo), Attributes(Attributes)
608 {
609 }
610
611 offset_t GetLength() override;
612
613 void WriteFile(Linker::Writer& wr) override;
614 };
615
616 /* Version 2 only */
618 {
619 public:
620 uint16_t Access;
621 uint16_t FileType;
622 uint32_t AUXType;
623
624 ProDOSFileInfo(uint16_t Access = 0,
625 uint16_t FileType = 0,
626 uint32_t AUXType = 0)
627 : Entry(AppleSingleDouble::ID_ProDOSFileInfo), Access(Access), FileType(FileType), AUXType(AUXType)
628 {
629 }
630
631 offset_t GetLength() override;
632
633 void WriteFile(Linker::Writer& wr) override;
634 };
635
636 /* Version 2 only */
638 {
639 public:
640 uint16_t Attributes;
641
642 MSDOSFileInfo(uint16_t Attributes = 0)
643 : Entry(AppleSingleDouble::ID_MSDOSFileInfo), Attributes(Attributes)
644 {
645 }
646
647 offset_t GetLength() override;
648
649 void WriteFile(Linker::Writer& wr) override;
650 };
651
652 /* Version 2 only */
654 {
655 public:
657 : Entry(AppleSingleDouble::ID_AFPShortName)
658 {
659 }
660 /* TODO - this is a stub */
661 };
662
663 /* Version 2 only */
665 {
666 public:
668 : Entry(AppleSingleDouble::ID_AFPFileInfo)
669 {
670 }
671 /* TODO - this is a stub */
672 };
673
674 /* Version 2 only */
676 {
677 public:
679 : Entry(AppleSingleDouble::ID_AFPDirectoryID)
680 {
681 }
682 /* TODO - this is a stub */
683 };
684
689 {
690 public:
691 enum version_t
692 {
693 /* assigning values to the first two does not matter, because we don't generate the fields that hold them */
694 MACBIN1,
695 MACBIN1_GETINFO, /* extension */
696 MACBIN2 = 0x11,
697 MACBIN3 = 0x12,
698 };
699 version_t version, minimum_version;
700
701 uint16_t secondary_header_size = 0; /* TODO */
702 uint16_t crc = 0;
703
704 std::string generated_file_name;
705
706 MacBinary(version_t version = MACBIN3)
707 : AppleSingleDouble(AppleSingleDouble::DOUBLE), version(version), minimum_version(version <= MACBIN2 ? version : MACBIN2)
708 {
709 }
710
711 MacBinary(version_t version, version_t minimum_version)
712 : AppleSingleDouble(AppleSingleDouble::DOUBLE), version(version), minimum_version(version < minimum_version ? version : minimum_version)
713 {
714 }
715
716 explicit MacBinary(AppleSingleDouble& apple, version_t version, version_t minimum_version)
717 : AppleSingleDouble(apple, AppleSingleDouble::DOUBLE), version(version), minimum_version(version < minimum_version ? version : minimum_version)
718 {
719 }
720
721 /* CRC16-CCITT */
722 static uint16_t crc_step[256];
723
724 void CRC_Initialize();
725
726 void CRC_Step(uint8_t byte = 0);
727
728 void Skip(Linker::Writer& wr, size_t count);
729
730 void WriteData(Linker::Writer& wr, size_t count, const void * data);
731
732 void WriteData(Linker::Writer& wr, size_t count, std::string text);
733
734 void WriteWord(Linker::Writer& wr, size_t bytes, uint64_t value);
735
736 void WriteHeader(Linker::Writer& wr);
737
738 void WriteFile(Linker::Writer& wr) override;
739
740 void GenerateFile(std::string filename, Linker::Module& module) override;
741 };
742
751 {
752 public:
753 /* format of "filename" */
754 enum target_format_t
755 {
756 TARGET_NONE, /* do not generate main file */
757 TARGET_DATA_FORK, /* main file is a data fork, typically empty */
758 TARGET_RESOURCE_FORK, /* main file is a resource fork */
759 TARGET_APPLE_SINGLE, /* main file is an AppleSingle */
760 };
761 target_format_t target;
762
763 /* other files to produce */
764 enum produce_format_t
765 {
766 PRODUCE_RESOURCE_FORK = 1 << 0, /* under .rsrc */
767 PRODUCE_FINDER_INFO = 1 << 1, /* under .finf */
768 PRODUCE_APPLE_DOUBLE = 1 << 2, /* with % prefix */
769 PRODUCE_MAC_BINARY = 1 << 3, /* with .mbin extension */
770 };
771 produce_format_t produce;
772
773 /* Typical combinations:
774 * - Executor: Generate a data fork and an AppleDouble with % prefix
775 * - Basilisk: Generate a data fork, a resource fork (under .rsrc) and a Finder Info file (under .finf)
776 * - Generate a MacBinary with .mbin extension
777 * - Generate an AppleSingle
778 */
779
780 unsigned apple_single_double_version = 2;
781 /* Only relevant for version 1 */
782 AppleSingleDouble::hfs_type home_file_system = AppleSingleDouble::HFS_UNDEFINED;
783
784 MacBinary::version_t macbinary_version = MacBinary::MACBIN3, macbinary_minimum_version = MacBinary::MACBIN2;
785
786 MacDriver(target_format_t target = TARGET_DATA_FORK)
787 : target(target),
788 produce(target == TARGET_NONE ? PRODUCE_MAC_BINARY
789 : target == TARGET_DATA_FORK ? PRODUCE_APPLE_DOUBLE
790 : produce_format_t(0))
791 {
792 }
793
794 MacDriver(target_format_t target, int produce)
795 : target(target), produce((produce_format_t)produce)
796 {
797 }
798
799 bool FormatSupportsResources() const override;
800
801 bool AddSupplementaryOutputFormat(std::string subformat) override;
802
803 private:
804 std::shared_ptr<AppleSingleDouble> container;
805
806 public:
807 void SetOptions(std::map<std::string, std::string>& options) override;
808
809 void SetModel(std::string model) override;
810
811 void SetLinkScript(std::string script_file, std::map<std::string, std::string>& options) override;
812
813 void GenerateFile(std::string filename, Linker::Module& module) override;
814
815 void ReadFile(Linker::Reader& rd) override;
816
817 void WriteFile(Linker::Writer& wr) override;
818 };
819}
820
821#endif /* MACOS_H */
Definition macos.h:676
Definition macos.h:665
Definition macos.h:654
Definition macos.h:59
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition macos.cc:18
void WriteFile(Linker::Writer &out) override
Stores data in memory to file.
Definition macos.cc:28
AppleSingle & AppleDouble.
Definition macos.h:33
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition macos.cc:48
bool FormatSupportsResources() const override
Whether the format supports resources.
Definition macos.cc:13
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition macos.cc:8
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition macos.cc:526
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition macos.cc:660
std::string GetDefaultExtension(Linker::Module &module) override
Provides a default filename for the output file.
Definition macos.cc:696
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:560
void SetModel(std::string model) override
Sets the way memory is organized, typically modifying a built-in script.
Definition macos.cc:55
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition macos.cc:552
void SetLinkScript(std::string script_file, std::map< std::string, std::string > &options) override
Selects a script file to use for linking.
Definition macos.cc:60
Definition macos.h:427
Definition macos.h:200
Definition macos.h:554
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1302
Definition macos.h:534
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1289
Definition macos.h:517
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1277
Definition macos.h:473
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1248
Definition macos.h:494
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1262
Definition macos.h:458
Definition macos.h:577
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1316
Definition macos.h:437
Definition macos.h:447
Definition macos.h:638
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1363
MacBinary is an alternative format to AppleSingle for representing a Macintosh file on a non-Macintos...
Definition macos.h:689
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition macos.cc:1549
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1524
This is not actually a file format, but an interface to permit generating multiple binary outputs for...
Definition macos.h:751
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition macos.cc:1729
bool FormatSupportsResources() const override
Whether the format supports resources.
Definition macos.cc:1557
void SetLinkScript(std::string script_file, std::map< std::string, std::string > &options) override
Selects a script file to use for linking.
Definition macos.cc:1603
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1734
bool AddSupplementaryOutputFormat(std::string subformat) override
If the output format actually drives multiple output formats (resource file, apple double,...
Definition macos.cc:1562
void SetModel(std::string model) override
Sets the way memory is organized, typically modifying a built-in script.
Definition macos.cc:1598
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition macos.cc:1608
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition macos.cc:1593
Definition macos.h:603
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1339
Definition macos.h:618
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1350
Definition macos.h:412
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1237
Definition macos.h:326
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition macos.cc:811
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition macos.cc:815
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:887
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition macos.cc:737
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition macos.cc:733
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:746
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition macos.cc:751
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition macos.cc:755
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:779
Definition macos.h:240
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:728
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition macos.cc:723
A Macintosh resource fork.
Definition macos.h:218
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition macos.cc:1160
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition macos.cc:1217
void OnNewSegment(std::shared_ptr< Linker::Segment > segment) override
Callback function when allocating a new segment When the linker script runs, it creates segments cons...
Definition macos.cc:924
void SetModel(std::string model) override
Sets the way memory is organized, typically modifying a built-in script.
Definition macos.cc:706
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition macos.cc:701
bool FormatSupportsResources() const override
Whether the format supports resources.
Definition macos.h:220
std::string GetDefaultExtension(Linker::Module &module) override
Provides a default filename for the output file.
Definition macos.cc:1227
A class to encode a general file format.
Definition format.h:24
A helper class to collect sections into segments.
Definition linker.h:19
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:20
A class that provides a general interface to setting up generation for a format.
Definition format.h:56
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Definition macos.h:580