Index: plug_io.h =================================================================== --- plug_io.h (revision 30790) +++ plug_io.h (revision 30791) @@ -31,6 +31,7 @@ #define PCB_PLUG_IO_H #include "global_typedefs.h" +#include "plug_footprint.h" #include typedef enum { /* I/O type bitmask; each bit is one thing to save or load, not all formats support all things */ @@ -73,6 +74,13 @@ /* Attempt to load an element from Filename to Ptr. Return 0 on success. */ int (*parse_footprint)(pcb_plug_io_t *ctx, pcb_data_t *Ptr, const char *name); + /* Scan as little as possible from the file to decide what the file is and extract tags; + For a single file, load head and return it. For a library-type file, load + head with the first footprint then allocate further footprints in a singly + linked list. If need_tags is 0, do not parse for tags */ + pcb_plug_fp_map_t *(*map_footprint)(pcb_plug_io_t *ctx, FILE *f, const char *fn, pcb_plug_fp_map_t *head, int need_tags); + + /* Attempt to load fonts from a file. Return 0 on success. */ int (*parse_font)(pcb_plug_io_t *ctx, pcb_font_t *Ptr, const char *Filename); @@ -130,6 +138,9 @@ int pcb_write_footprint_data(FILE *f, pcb_data_t *e, const char *fmt, long subc_idx); int pcb_write_font(pcb_font_t *Ptr, const char *Filename, const char *fmt); +/* map a footprint file: always returns head with 0 or 1 or more mapping results */ +pcb_plug_fp_map_t *pcb_io_map_footprint_file(pcb_hidlib_t *hl, const char *fn, pcb_plug_fp_map_t *head, int need_tags); + /********** common function used to be part of file.[ch] and friends **********/ int pcb_save_pcb(const char *, const char *fmt); #define PCB_INHIBIT_BOARD_CHANGED 0x20 @@ -204,4 +215,6 @@ void pcb_plug_io_err(pcb_hidlib_t *hidlib, int res, const char *what, const char *filename); + + #endif