# pcb-rnd devlog

## The way forward on cleanup

by Igor2

This is a long term plan (these will happen slowly, step-by-step, gradually, in the background, in parallel with the normal schedule of development:

- phase 0: port the rest [almost done]
  - import the remaining plugins and exporters before the big cleanup because it's cheaper to port them now
- phase 1: reorg
  - reorganize the code: from action-oriented (e.g. change.c, remove.c, mirror.c) into object-type-oriented code (e.g. obj_line.c, obj_arc.c)
  - global*.h must be dissolved/removed
  - macro.h should be dissolved/removed
  - const.h should be reduced to 1/3
- phase 2: clean the namespace
  - pcb_ prefixes
  - unify convention: underscores instead of CamelCase, prefer shorter names
  - better connection between file name and function name prefixes (don't invent 3 different names for the same thing)
- phase 3: split & pack
  - move out generic, non-pcb-specific code to "external libs" (e.g. polygon, heap, the conf system)
  - determine layering of the new lib system (e.g. a generic unit, printf, etc. util lib on layer 0, then a lib about the basic object types on layer 1, then footprint libraries and other plugins on layer 2)
  - compile one .a file per layer, link the final executable using those .a files
  - make the libs installable, together with the headers
  - fix gsch2pcb-rnd to use the new lib(s)