Archdep: Difference between revisions

From vice-emu
Jump to navigation Jump to search
(Archdep Refactoring)
 
Line 14: Line 14:
This results in the following directory structure:
This results in the following directory structure:
<pre>
<pre>
     src/arch/gtk3   -- Gtk3 UI code  
    src/arch/android  -- seems to contain non-working stubs (can we remove this crap?)
     src/arch/sdl     -- SDL UI code
     src/arch/gtk3     -- Gtk3 UI code
     src/arch/shared -- Architecture-dependent code, shared between Gtk3 and SDL
    src/arch/headless  -- Headless UI code
     src/arch/sdl       -- SDL UI code
     src/arch/shared   -- Architecture-dependent code, shared between Gtk3, SDL and Headless
</pre>
</pre>

Revision as of 18:26, 10 November 2020

Archdep Refactoring

Rationale

The current archdep code contains a lot of duplicate code that is spread over various directories and files. We currently have two directories inside src/arch/: src/arch/sdl for the SDL UI and src/arch/gtk3 for the Gt3k UI. These directories in turn contain files called archdep.c, archdep_amiga.c, archdep_unix.c, archdep_win32.c, etcetera. A lot of these files containing (near) duplicate code, some of these even #include'ing other .c files.

This is all far from ideal so the idea was formed to refactor the various archdep files: avoiding duplication as much as possible and moving the archdep code from the src/arch/gtk3 and src/arch/sdl directories into a separate directory.

New setup

The new setup is to have a directory src/arch/shared where archdep code is stored, creating a separate static library, currently called libarchdep.a. The public functions are now split into one .c file per function, hopefully resulting in easier to maintain and properly documented code.

This results in the following directory structure:

    src/arch/android   -- seems to contain non-working stubs (can we remove this crap?)
    src/arch/gtk3      -- Gtk3 UI code
    src/arch/headless  -- Headless UI code
    src/arch/sdl       -- SDL UI code
    src/arch/shared    -- Architecture-dependent code, shared between Gtk3, SDL and Headless