From vice-emu
Revision as of 18:29, 10 November 2020 by Compyx (talk | contribs) (→‎New setup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Archdep Refactoring


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