Index: trunk/src/plug_footprint.c =================================================================== --- trunk/src/plug_footprint.c (revision 3181) +++ trunk/src/plug_footprint.c (revision 3182) @@ -106,7 +106,7 @@ FILE *fp_fopen(const char *path, const char *name, fp_fopen_ctx_t *fctx) { FILE *res = NULL; - HOOK_CALL(plug_fp_t, plug_fp_chain, fopen, res, != NULL, path, name, fctx); + HOOK_CALL(plug_fp_t, plug_fp_chain, fopen, res, != NULL, (self, path, name, fctx)); return res; } @@ -353,7 +353,7 @@ /* Next read in any footprints in the top level dir */ res = -1; - HOOK_CALL(plug_fp_t, plug_fp_chain, load_dir, res, >= 0, toppath); + HOOK_CALL(plug_fp_t, plug_fp_chain, load_dir, res, >= 0, (self, toppath)); if (res >= 0) n_footprints += res; else Index: trunk/src/plug_import.c =================================================================== --- trunk/src/plug_import.c (revision 3181) +++ trunk/src/plug_import.c (revision 3182) @@ -68,7 +68,7 @@ } \ } while(0) - HOOK_CALL_ALL(plug_import_t, plug_import_chain, fmt_support_prio, cb_append, aspects, f, filename); + HOOK_CALL_ALL(plug_import_t, plug_import_chain, fmt_support_prio, cb_append, (self, aspects, f, filename)); if (len == 0) return NULL; Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 3181) +++ trunk/src/plug_io.c (revision 3182) @@ -125,7 +125,7 @@ res = available[0].plug->parse_pcb(available[0].plug, Ptr, Filename, load_settings); } else /* try all parsers until we find one that works */ - HOOK_CALL(plug_io_t, plug_io_chain, parse_pcb, res, == 0, Ptr, Filename, load_settings); + HOOK_CALL(plug_io_t, plug_io_chain, parse_pcb, res, == 0, (self, Ptr, Filename, load_settings)); if ((res == 0) && (load_settings)) conf_load_project(NULL, Filename); @@ -140,7 +140,7 @@ int ParseElement(DataTypePtr Ptr, const char *name) { int res = -1; - HOOK_CALL(plug_io_t, plug_io_chain, parse_element, res, == 0, Ptr, name); + HOOK_CALL(plug_io_t, plug_io_chain, parse_element, res, == 0, (self, Ptr, name)); plug_io_err(res, "load element", name); return res; @@ -149,7 +149,7 @@ int ParseFont(FontTypePtr Ptr, char *Filename) { int res = -1; - HOOK_CALL(plug_io_t, plug_io_chain, parse_font, res, == 0, Ptr, Filename); + HOOK_CALL(plug_io_t, plug_io_chain, parse_font, res, == 0, (self, Ptr, Filename)); plug_io_err(res, "load font", Filename); return res; @@ -181,7 +181,7 @@ } \ } while(0) - HOOK_CALL_ALL(plug_io_t, plug_io_chain, fmt_support_prio, cb_append, typ, is_wr, (fmt == NULL ? __ch__->default_fmt : fmt)); + HOOK_CALL_ALL(plug_io_t, plug_io_chain, fmt_support_prio, cb_append, (self, typ, is_wr, (fmt == NULL ? self->default_fmt : fmt))); if (len > 0) qsort(available, len, sizeof(available[0]), find_prio_cmp); Index: trunk/src/plugins.h =================================================================== --- trunk/src/plugins.h (revision 3181) +++ trunk/src/plugins.h (revision 3182) @@ -55,25 +55,25 @@ HOOK_REGISTER with an api struct. The core should run the plugins using HOOK_CALL */ -#define HOOK_CALL(chain_type, chain, func, res, accept, ...) \ +#define HOOK_CALL(chain_type, chain, func, res, accept, funcargs) \ do { \ - chain_type *__ch__; \ - for(__ch__ = (chain); __ch__ != NULL; __ch__ = __ch__->next) { \ - if (__ch__->func == NULL) \ + chain_type *self; \ + for(self = (chain); self != NULL; self = self->next) { \ + if (self->func == NULL) \ continue; \ - res = __ch__->func(__ch__, __VA_ARGS__); \ + res = self->func funcargs; \ if (res accept) \ break; \ } \ } while(0) -#define HOOK_CALL_ALL(chain_type, chain, func, cb, ...) \ +#define HOOK_CALL_ALL(chain_type, chain, func, cb, funcargs) \ do { \ - chain_type *__ch__; \ - for(__ch__ = (chain); __ch__ != NULL; __ch__ = __ch__->next) { \ - if (__ch__->func == NULL) \ + chain_type *self; \ + for(self = (chain); self != NULL; self = self->next) { \ + if (self->func == NULL) \ continue; \ - cb(__ch__, __ch__->func(__ch__, __VA_ARGS__)); \ + cb(self, self->func funcargs); \ } \ } while(0)