Archdep: Difference between revisions

From vice-emu
Jump to navigation Jump to search
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 14: Line 14:
This results in the following directory structure:
This results in the following directory structure:
<pre>
<pre>
     src/arch/android   -- seems to contain non-working stubs (can we remove this crap?)
     src/arch/android       -- seems to contain non-working stubs (can we remove this crap?)
     src/arch/gtk3     -- Gtk3 UI code
     src/arch/gtk3         -- Gtk3 UI code
     src/arch/headless -- Headless UI code
     src/arch/headless     -- Headless UI code
     src/arch/sdl       -- SDL UI code
     src/arch/sdl           -- SDL UI code
     src/arch/shared   -- Architecture-dependent code, shared between Gtk3, SDL and Headless
     src/arch/shared       -- UI-independent code, shared between Gtk3, SDL and Headless
    src/arch/mingw32-pcap  -- Windows-specific code for pcap
</pre>
</pre>
[[Category:Developer]]

Latest revision as of 18:22, 23 March 2023

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        -- UI-independent code, shared between Gtk3, SDL and Headless
    src/arch/mingw32-pcap  -- Windows-specific code for pcap