Index: src/plug_io.h =================================================================== --- src/plug_io.h (revision 2222) +++ src/plug_io.h (revision 2223) @@ -36,6 +36,12 @@ plug_io_t *next; void *plugin_data; + /* Check if the plugin supports format fmt, for writing (if wr != 0) or for + reading (if wr == 0). Return 0 if not supported or an integer priority + if supported. The higher the prio is the more likely the plugin gets + the next operation on the file. Base prio should be 100 for native formats. */ + int (*fmt_support_prio)(int wr, const char *fmt); + /* Attempt to load a pcb design from Filename to Ptr. Conf subtree at settings_dest is replaced by settings loaded from the file unless it's CFR_invalid. Index: src_plugins/io_kicad_legacy/io_kicad_legacy.c =================================================================== --- src_plugins/io_kicad_legacy/io_kicad_legacy.c (revision 2222) +++ src_plugins/io_kicad_legacy/io_kicad_legacy.c (revision 2223) @@ -31,6 +31,15 @@ static plug_io_t io_kicad_legacy; +int io_kicad_legacy_fmt(int wr, const char *fmt) +{ + if (strcmp(fmt, "kicadl") != 0) + return 0; + if (wr) + return 100; + return 0; /* no read support yet */ +} + static void hid_io_kicad_legacy_uninit(void) { /* Runs once when the plugin is unloaded. TODO: free plugin-globals here. */ @@ -41,6 +50,7 @@ /* register the IO hook */ io_kicad_legacy.plugin_data = NULL; + io_kicad_legacy.fmt_support_prio = io_kicad_legacy_fmt; io_kicad_legacy.parse_pcb = NULL; io_kicad_legacy.parse_element = NULL; io_kicad_legacy.parse_font = NULL; Index: src_plugins/io_pcb/io_pcb.c =================================================================== --- src_plugins/io_pcb/io_pcb.c (revision 2222) +++ src_plugins/io_pcb/io_pcb.c (revision 2223) @@ -31,6 +31,13 @@ static plug_io_t io_pcb; +int io_pcb_fmt(int wr, const char *fmt) +{ + if (strcmp(fmt, "pcb") != 0) + return 0; + return 100; /* read-write */ +} + extern void yylex_destroy(void); static void hid_io_pcb_uninit(void) { @@ -43,6 +50,7 @@ /* register the IO hook */ io_pcb.plugin_data = NULL; + io_pcb.fmt_support_prio = io_pcb_fmt; io_pcb.parse_pcb = io_pcb_ParsePCB; io_pcb.parse_element = io_pcb_ParseElement; io_pcb.parse_font = io_pcb_ParseFont;