Index: trunk/src_plugins/cam/cam.c =================================================================== --- trunk/src_plugins/cam/cam.c (revision 24117) +++ trunk/src_plugins/cam/cam.c (revision 24118) @@ -39,30 +39,17 @@ #include "plugins.h" #include "actions.h" #include "cam_conf.h" -#include "cam_compile.h" #include "compat_misc.h" #include "safe_fs.h" #include "../src_plugins/cam/conf_internal.c" - static const char *cam_cookie = "cam exporter"; const conf_cam_t conf_cam; #define CAM_CONF_FN "cam.conf" -typedef struct { - char *prefix; /* strdup'd file name prefix from the last prefix command */ - pcb_hid_t *exporter; +#include "cam_compile.c" - char *args; /* strdup'd argument string from the last plugin command - already split up */ - char *argv[128]; /* [0] and [1] are for --cam; the rest point into args */ - int argc; - - void *vars; - - gds_t tmp; -} cam_ctx_t; - static void cam_init_inst(cam_ctx_t *ctx) { memset(ctx, 0, sizeof(cam_ctx_t)); @@ -87,40 +74,6 @@ gds_uninit(&ctx->tmp); } -/* mkdir -p on arg - changes the string in arg */ -static int prefix_mkdir(char *arg, char **filename) -{ - char *curr, *next, *end; - int res; - - /* mkdir -p if there's a path sep in the prefix */ - end = strrchr(arg, PCB_DIR_SEPARATOR_C); - if (end == NULL) { - if (filename != NULL) - *filename = arg; - return 0; - } - - *end = '\0'; - res = end - arg; - if (filename != NULL) - *filename = end+1; - - for(curr = arg; curr != NULL; curr = next) { - next = strrchr(curr, PCB_DIR_SEPARATOR_C); - if (next != NULL) - *next = '\0'; - pcb_mkdir(arg, 0755); - if (next != NULL) { - *next = PCB_DIR_SEPARATOR_C; - next++; - } - } - return res; -} - -#include "cam_compile.c" - /* look up a job by name in the config */ static const char *cam_find_job(const char *job) { Index: trunk/src_plugins/cam/cam_compile.c =================================================================== --- trunk/src_plugins/cam/cam_compile.c (revision 24117) +++ trunk/src_plugins/cam/cam_compile.c (revision 24118) @@ -26,8 +26,43 @@ * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") */ + +#define GVT_DONT_UNDEF #include "cam_compile.h" +#include +/* mkdir -p on arg - changes the string in arg */ +static int prefix_mkdir(char *arg, char **filename) +{ + char *curr, *next, *end; + int res; + + /* mkdir -p if there's a path sep in the prefix */ + end = strrchr(arg, PCB_DIR_SEPARATOR_C); + if (end == NULL) { + if (filename != NULL) + *filename = arg; + return 0; + } + + *end = '\0'; + res = end - arg; + if (filename != NULL) + *filename = end+1; + + for(curr = arg; curr != NULL; curr = next) { + next = strrchr(curr, PCB_DIR_SEPARATOR_C); + if (next != NULL) + *next = '\0'; + pcb_mkdir(arg, 0755); + if (next != NULL) { + *next = PCB_DIR_SEPARATOR_C; + next++; + } + } + return res; +} + static int cam_exec_inst(cam_ctx_t *ctx, char *cmd, char *arg) { char *curr, *next; @@ -241,3 +276,4 @@ return res; } + Index: trunk/src_plugins/cam/cam_compile.h =================================================================== --- trunk/src_plugins/cam/cam_compile.h (revision 24117) +++ trunk/src_plugins/cam/cam_compile.h (revision 24118) @@ -56,4 +56,33 @@ } op; } pcb_cam_code_t; + +#define GVT(x) vtcc_ ## x +#define GVT_ELEM_TYPE pcb_cam_code_t +#define GVT_SIZE_TYPE size_t +#define GVT_DOUBLING_THRS 4096 +#define GVT_START_SIZE 32 +#define GVT_FUNC +#define GVT_SET_NEW_BYTES_TO 0 + +#include +#define GVT_REALLOC(vect, ptr, size) realloc(ptr, size) +#define GVT_FREE(vect, ptr) free(ptr) +#include + +typedef struct { + char *prefix; /* strdup'd file name prefix from the last prefix command */ + pcb_hid_t *exporter; + + char *args; /* strdup'd argument string from the last plugin command - already split up */ + char *argv[128]; /* [0] and [1] are for --cam; the rest point into args */ + int argc; + + vtcc_t code; + void *vars; + + gds_t tmp; +} cam_ctx_t; + + #endif