pcb

Modular file format support (new feature/enhancement)

Bug #1532611 reported by Milan Prochac on 2016-01-10
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcb
Wishlist
Unassigned

Bug Description

The attached patch implements modular system to support multiple PCB file formats. Attached is also the template of the file-format plugin with instructions.

The patch is not too big, but it touches various parts of PCB, so it is possible that some corner cases are not handled properly. Comments and bug reports are welcome.

The modular systems utlilizes existing plugin system; new type of plugin is added to support various file formats. This approach allows to implement additional file formats as independent shared library with minimal effort. The whole implementation of new file format is reduced to serialization and deserialization of PCBType data structure, no PCB tweaking is necessary. The template with instructions is provided, as mentioned above.

- modular system is available for all layout operations (Load, Save, Save As, Load to buffer, Revert, auto-backup); the element operations will be added later.
- action "SaveTo(LayoutAs..." was extended by 3rd argument, specifying file format; if omitted, current (or default) format is used
- GUI (GTK only at the moment) was adjusted to allow select file format; for "save" operations it specifies desired format, for "open" operations it is used as filter
- file format is detected automatically by modular framework
- the versioning system (based on PCB file version #defines) is available - each plugin should confirm it's capability to save data of required version (like 20110603); if not, the file format cannot be used
- load-only and save-only formats are supported. If save-only format is used, the layout is not marked as "saved".
- the current PCB format is converted to built-in plugin.

Milan Prochac (milan-x) wrote :
Milan Prochac (milan-x) wrote :
Bert Timmerman (bert-timmerman) wrote :

Hi Milan,

Your file formats patch is now pushed to "home/bert/LP1532611" for review.

Thanks and kind regards,

Bert Timmerman.

Bert Timmerman (bert-timmerman) wrote :

Hi,

Leading edge now lives in "home/bkerin/LP1532611_fixes".

Kind regards,

Bert Timmerman.

Milan Prochac (milan-x) wrote :

Leading edge lives on "home/milanp/LP1532611_modular_format_V2"

Added some improvements and checks, based on comments from Britton Kerin. Improved code culture, fixed some bugs.
- added pre-selection of current/default format in save/load dialogs
- enforced the existence of at least on format which supports both load/save operations; the same applies for default format
- added more safety checks to avoid accidental data loss

Milan

Changed in pcb:
status: New → Triaged
importance: Undecided → Wishlist
milestone: none → next-feature-release
Bert Timmerman (bert-timmerman) wrote :

Hi Milan,

Thanks for updating the branch to version 2.

We (PeterC and I) reviewed the branch during the monthly pcb code sprint.

The first commit is very usable for solving bug report 1535183.

However there are some issues we like to have addressed:

About the first commit: 7058b6fc37b1c75da685de53e6bfff0df9e107f3

1) Indentation of curly braces (especially around the "else" statements)

if (...)
  {
    ...
  }
else
  {
    ...
  }

2) The use access() is not a favorable solution.

Please use a fopen () and grab errno and act upon that value.

ENOENT is probably what you'll see if the named file does not exist.

Any other error, and its a hard fault.

ENOENT can fall back to the "OK, silently pretend to load the board" (create a new board) behaviour.

--

About the second commit: 053eb5d4c05c807198ea4ee8655bcd9436ef0698

There are a lot of other things to mention as this is a very large patch.

I will try to do a detailed report in the coming week.

Kind regards,

Bert Timmerman.

Changed in pcb:
milestone: pcb-4.1.0 → pcb-4.2.0
Changed in pcb:
milestone: pcb-4.2.0 → future-feature-release
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments