Open SamuraiCrow opened 4 years ago
This is a prerequisite of adding more platforms, IMO, because then all the conditionals are replaced all at once using inheritance of the context abstract class rather than a dozen different places.
This is now identified as a prerequisite of #6 because globals cannot be safely shared across modular networks of shared libraries.
After having looked through the eecmain.e file, there is a great possibility of modularizing the code using OOP. For example there are many places where g_optosid is checked against all the constants: OSID_NONE, OSID_MORPHOS, OSID_AMIGAOS and OSID_AMIGAOS4. These could all be combined using inheritance by making g_optosid into a context class and making all the IF, ELSIF, ELSEIF, ELSE, ENDIF statements into a method in that class. The context class may also keep track of library modes, ELF vs. HUNK executable types, and so on with all of the non-applicable methods of library mode, for example, being returned as no-ops in executable mode.
Using this may allow the contexts to be reimplemented as shared libraries for all the different sets of startup-codes and code generators. Some contexts will require more than one codegen such as MorphOS being able to use mixed binaries containing both 68k and PPC code.