Mailing list archives : pcb-rnd

ID:268
From:ge...@igor2.repo.hu
Date:Thu, 15 Dec 2016 14:06:44 +0100 (CET)
Subject:[pcb-rnd] improved plug_io API, less noise on load
Hi all,
 
I've extended the board load API a bit: io_plugins can donate a function 
that can read the file, looking for some header or pattern and decide if 
the file looks like one they can handle.
 
In practice this means the core can probe files before really trying to 
parse them. This will reduce error messages on load: previously we just 
tried to load all files with all io_ plugins and as each file could be 
loaded only with one of them, the others tended to give error messages.
 
Implementation details:
 
When the core needs to load a file of unknown/unspecified format, it does 
the following steps:
 
1. opens the file (throws an error if the file can't be open for read)
2. acquires a list of all io_ pluginst that can load boards, ordered by 
load-priority (^1)
3. ask each of them to take a look at the file and decide if it looks 
valid to them
4. if none said valid, we can't load the file, return error
5. iterate over all io_ plugins that said the file was valid and call them 
to parse the file; the order of iteration is that of point 2.; the 
process stops after first io_ plugin that manages to parse through the 
file without an error; all error messages are relayed to the message log
6. if none of the io_ plugins could actually parse the file, throw an 
error
 
When the core loads a file with a format explicitly specified by the user 
(using the LoadFrom() action):
 
1. same as above
2. get a list only of those io_plugins whose metadata says they can handle 
the format specified
3. same as above
4. same as above, plus if multiple plugins said the file was valid, inform 
the user because his format specification is probably not exact enough 
(but go on with the process anyway)
5. same as above
6. same as above
 
 
Regards,
 
Igor2
 

Reply subtree:
268 [pcb-rnd] improved plug_io API, less noise on load from ge...@igor2.repo.hu