Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 23991) +++ trunk/scconfig/plugins.h (revision 23992) @@ -14,6 +14,7 @@ plugin_def("lib_legacy_func", "legacy functions", sbuildin, 1) plugin_def("lib_netmap", "map nets and objects", sdisable, 0) plugin_def("lib_polyhelp", "polygon helpers", sbuildin, 1) +plugin_def("lib_vfs", "fetch data for VFS export", sdisable, 0) plugin_header("\nFeature plugins:\n") plugin_def("acompnet", "net auto-completion", sdisable, 1) @@ -90,7 +91,7 @@ plugin_def("export_gerber", "Gerber pcb_exporter", sbuildin, 1) plugin_def("export_ipcd356", "IPC-D-356 Netlist pcb_exporter", sbuildin, 1) plugin_def("export_lpr", "lpr pcb_exporter (printer)", sbuildin, 1) -plugin_def("export_oldconn", "export connection data in an old format",sbuildin, 1) +plugin_def("export_oldconn", "old connection data format", sbuildin, 1) plugin_def("export_openems", "openems exporter", sdisable, 1) plugin_def("export_openscad", "openscad pcb_exporter", sbuildin, 1) plugin_def("export_png", "png/gif/jpg pcb_exporter", sbuildin, 1) @@ -98,6 +99,8 @@ plugin_def("export_stat", "export board statistics", sbuildin, 1) plugin_def("export_svg", "SVG pcb_exporter", sbuildin, 1) plugin_def("export_test", "dummy test pcb_exporter", sdisable, 1) +plugin_def("export_vfs_fuse", "FUSE VFS server", sdisable, 1) +plugin_def("export_vfs_mc", "GNU mc VFS server", sdisable, 1) plugin_def("export_xy", "xy (centroid) pcb_exporter", sbuildin, 1) plugin_header("\nIO plugins (file formats):\n") @@ -132,6 +135,8 @@ plugin_dep("export_lpr", "export_ps") plugin_dep("export_openems", "lib_polyhelp") plugin_dep("export_openscad", "lib_polyhelp") +plugin_dep("export_vfs_fuse", "lib_vfs") +plugin_dep("export_vfs_mc", "lib_vfs") plugin_dep("export_xy", "export_bom") plugin_dep("extedit", "io_lihata") plugin_dep("fp_wget", "fp_fs") Index: trunk/src_plugins/export_vfs_fuse/Makefile =================================================================== --- trunk/src_plugins/export_vfs_fuse/Makefile (nonexistent) +++ trunk/src_plugins/export_vfs_fuse/Makefile (revision 23992) @@ -0,0 +1,6 @@ +all: + cd ../../src && $(MAKE) mod_export_vfs_fuse + + +clean: + rm *.o *.so 2>/dev/null ; true Index: trunk/src_plugins/export_vfs_fuse/Plug.tmpasm =================================================================== --- trunk/src_plugins/export_vfs_fuse/Plug.tmpasm (nonexistent) +++ trunk/src_plugins/export_vfs_fuse/Plug.tmpasm (revision 23992) @@ -0,0 +1,8 @@ +put /local/pcb/mod {export_vfs_fuse} +put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_vfs_fuse/export_vfs_fuse.o @] + +switch /local/pcb/export_vfs_fuse/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.c =================================================================== --- trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.c (nonexistent) +++ trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.c (revision 23992) @@ -0,0 +1,103 @@ +#include "config.h" +#include "conf_core.h" + +#include +#include +#include +#include + +#include "build_run.h" +#include "board.h" +#include "data.h" +#include "error.h" +#include "pcb-printf.h" +#include "plugins.h" + +#include "hid.h" +#include "hid_attrib.h" +#include "hid_init.h" +#include "hid_nogui.h" + +#include "../src_plugins/lib_vfs/lib_vfs.h" + +const char *export_vfs_fuse_cookie = "export_vfs_fuse HID"; + +static pcb_hid_attribute_t export_vfs_fuse_options[] = { + {"cmd", "mc command", + PCB_HATT_STRING, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_export_vfs_fuse_cmd 0 +}; + +#define NUM_OPTIONS (sizeof(export_vfs_fuse_options)/sizeof(export_vfs_fuse_options[0])) + +static pcb_hid_attr_val_t export_vfs_fuse_values[NUM_OPTIONS]; + +static pcb_hid_attribute_t *export_vfs_fuse_get_export_options(int *n) +{ + if (n) + *n = NUM_OPTIONS; + return export_vfs_fuse_options; +} + +static void export_vfs_fuse_do_export(pcb_hid_attr_val_t * options) +{ + const char *cmd; + int i; + + if (!options) { + export_vfs_fuse_get_export_options(0); + for (i = 0; i < NUM_OPTIONS; i++) + export_vfs_fuse_values[i] = export_vfs_fuse_options[i].default_val; + options = export_vfs_fuse_values; + } + + cmd = options[HA_export_vfs_fuse_cmd].str_value; + TODO("Process cmd here"); +} + +static int export_vfs_fuse_usage(const char *topic) +{ + fprintf(stderr, "\nexport_vfs_fuse exporter command line arguments:\n\n"); + pcb_hid_usage(export_vfs_fuse_options, sizeof(export_vfs_fuse_options) / sizeof(export_vfs_fuse_options[0])); + fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x export_vfs_fuse [export_vfs_fuse_options] foo.pcb\n\n"); + return 0; +} + + +static int export_vfs_fuse_parse_arguments(int *argc, char ***argv) +{ + pcb_hid_register_attributes(export_vfs_fuse_options, sizeof(export_vfs_fuse_options) / sizeof(export_vfs_fuse_options[0]), export_vfs_fuse_cookie, 0); + return pcb_hid_parse_command_line(argc, argv); +} + +pcb_hid_t export_vfs_fuse_hid; + +int pplg_check_ver_export_vfs_fuse(int ver_needed) { return 0; } + +void pplg_uninit_export_vfs_fuse(void) +{ +} + +int pplg_init_export_vfs_fuse(void) +{ + PCB_API_CHK_VER; + + memset(&export_vfs_fuse_hid, 0, sizeof(pcb_hid_t)); + + pcb_hid_nogui_init(&export_vfs_fuse_hid); + + export_vfs_fuse_hid.struct_size = sizeof(pcb_hid_t); + export_vfs_fuse_hid.name = "export_vfs_fuse"; + export_vfs_fuse_hid.description = "Handler of FUSE calls, serving board data"; + export_vfs_fuse_hid.exporter = 1; + export_vfs_fuse_hid.hide_from_gui = 1; + + export_vfs_fuse_hid.get_export_options = export_vfs_fuse_get_export_options; + export_vfs_fuse_hid.do_export = export_vfs_fuse_do_export; + export_vfs_fuse_hid.parse_arguments = export_vfs_fuse_parse_arguments; + + export_vfs_fuse_hid.usage = export_vfs_fuse_usage; + + pcb_hid_register_hid(&export_vfs_fuse_hid); + return 0; +} Index: trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.pup =================================================================== --- trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.pup (nonexistent) +++ trunk/src_plugins/export_vfs_fuse/export_vfs_fuse.pup (revision 23992) @@ -0,0 +1,7 @@ +$class export +$short FUSE VFS server +$long Export all data and config of a board to a FUSE mountable filesystem +$state WIP +dep lib_vfs +default disable +autoload 1 Index: trunk/src_plugins/export_vfs_mc/Makefile =================================================================== --- trunk/src_plugins/export_vfs_mc/Makefile (nonexistent) +++ trunk/src_plugins/export_vfs_mc/Makefile (revision 23992) @@ -0,0 +1,6 @@ +all: + cd ../../src && $(MAKE) mod_export_vfs_mc + + +clean: + rm *.o *.so 2>/dev/null ; true Index: trunk/src_plugins/export_vfs_mc/Plug.tmpasm =================================================================== --- trunk/src_plugins/export_vfs_mc/Plug.tmpasm (nonexistent) +++ trunk/src_plugins/export_vfs_mc/Plug.tmpasm (revision 23992) @@ -0,0 +1,8 @@ +put /local/pcb/mod {export_vfs_mc} +put /local/pcb/mod/OBJS [@ $(PLUGDIR)/export_vfs_mc/export_vfs_mc.o @] + +switch /local/pcb/export_vfs_mc/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: trunk/src_plugins/export_vfs_mc/export_vfs_mc.c =================================================================== --- trunk/src_plugins/export_vfs_mc/export_vfs_mc.c (nonexistent) +++ trunk/src_plugins/export_vfs_mc/export_vfs_mc.c (revision 23992) @@ -0,0 +1,103 @@ +#include "config.h" +#include "conf_core.h" + +#include +#include +#include +#include + +#include "build_run.h" +#include "board.h" +#include "data.h" +#include "error.h" +#include "pcb-printf.h" +#include "plugins.h" + +#include "hid.h" +#include "hid_attrib.h" +#include "hid_init.h" +#include "hid_nogui.h" + +#include "../src_plugins/lib_vfs/lib_vfs.h" + +const char *export_vfs_mc_cookie = "export_vfs_mc HID"; + +static pcb_hid_attribute_t export_vfs_mc_options[] = { + {"cmd", "mc command", + PCB_HATT_STRING, 0, 0, {0, 0, 0}, 0, 0}, +#define HA_export_vfs_mc_cmd 0 +}; + +#define NUM_OPTIONS (sizeof(export_vfs_mc_options)/sizeof(export_vfs_mc_options[0])) + +static pcb_hid_attr_val_t export_vfs_mc_values[NUM_OPTIONS]; + +static pcb_hid_attribute_t *export_vfs_mc_get_export_options(int *n) +{ + if (n) + *n = NUM_OPTIONS; + return export_vfs_mc_options; +} + +static void export_vfs_mc_do_export(pcb_hid_attr_val_t * options) +{ + const char *cmd; + int i; + + if (!options) { + export_vfs_mc_get_export_options(0); + for (i = 0; i < NUM_OPTIONS; i++) + export_vfs_mc_values[i] = export_vfs_mc_options[i].default_val; + options = export_vfs_mc_values; + } + + cmd = options[HA_export_vfs_mc_cmd].str_value; + TODO("Process cmd here"); +} + +static int export_vfs_mc_usage(const char *topic) +{ + fprintf(stderr, "\nexport_vfs_mc exporter command line arguments:\n\n"); + pcb_hid_usage(export_vfs_mc_options, sizeof(export_vfs_mc_options) / sizeof(export_vfs_mc_options[0])); + fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x export_vfs_mc [export_vfs_mc_options] foo.pcb\n\n"); + return 0; +} + + +static int export_vfs_mc_parse_arguments(int *argc, char ***argv) +{ + pcb_hid_register_attributes(export_vfs_mc_options, sizeof(export_vfs_mc_options) / sizeof(export_vfs_mc_options[0]), export_vfs_mc_cookie, 0); + return pcb_hid_parse_command_line(argc, argv); +} + +pcb_hid_t export_vfs_mc_hid; + +int pplg_check_ver_export_vfs_mc(int ver_needed) { return 0; } + +void pplg_uninit_export_vfs_mc(void) +{ +} + +int pplg_init_export_vfs_mc(void) +{ + PCB_API_CHK_VER; + + memset(&export_vfs_mc_hid, 0, sizeof(pcb_hid_t)); + + pcb_hid_nogui_init(&export_vfs_mc_hid); + + export_vfs_mc_hid.struct_size = sizeof(pcb_hid_t); + export_vfs_mc_hid.name = "export_vfs_mc"; + export_vfs_mc_hid.description = "Handler of mc VFS calls, serving board data"; + export_vfs_mc_hid.exporter = 1; + export_vfs_mc_hid.hide_from_gui = 1; + + export_vfs_mc_hid.get_export_options = export_vfs_mc_get_export_options; + export_vfs_mc_hid.do_export = export_vfs_mc_do_export; + export_vfs_mc_hid.parse_arguments = export_vfs_mc_parse_arguments; + + export_vfs_mc_hid.usage = export_vfs_mc_usage; + + pcb_hid_register_hid(&export_vfs_mc_hid); + return 0; +} Index: trunk/src_plugins/export_vfs_mc/export_vfs_mc.pup =================================================================== --- trunk/src_plugins/export_vfs_mc/export_vfs_mc.pup (nonexistent) +++ trunk/src_plugins/export_vfs_mc/export_vfs_mc.pup (revision 23992) @@ -0,0 +1,7 @@ +$class export +$short GNU mc VFS server +$long Export all data and config of a board to GNU mc +$state WIP +dep lib_vfs +default disable +autoload 1 Index: trunk/src_plugins/lib_vfs/Makefile =================================================================== --- trunk/src_plugins/lib_vfs/Makefile (nonexistent) +++ trunk/src_plugins/lib_vfs/Makefile (revision 23992) @@ -0,0 +1,6 @@ +all: + cd ../../src && $(MAKE) mod_lib_vfs + +clean: + rm *.o *.so 2>/dev/null ; true + Index: trunk/src_plugins/lib_vfs/Plug.tmpasm =================================================================== --- trunk/src_plugins/lib_vfs/Plug.tmpasm (nonexistent) +++ trunk/src_plugins/lib_vfs/Plug.tmpasm (revision 23992) @@ -0,0 +1,10 @@ +put /local/pcb/mod {lib_vfs} +put /local/pcb/mod/OBJS [@ + $(PLUGDIR)/lib_vfs/lib_vfs.o +@] + +switch /local/pcb/lib_vfs/controls + case {buildin} include /local/pcb/tmpasm/buildin; end; + case {plugin} include /local/pcb/tmpasm/plugin; end; + case {disable} include /local/pcb/tmpasm/disable; end; +end Index: trunk/src_plugins/lib_vfs/lib_vfs.c =================================================================== --- trunk/src_plugins/lib_vfs/lib_vfs.c (nonexistent) +++ trunk/src_plugins/lib_vfs/lib_vfs.c (revision 23992) @@ -0,0 +1,44 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" + +#include "board.h" +#include "data.h" +#include "plugins.h" + + +int pplg_check_ver_lib_vfs(int ver_needed) { return 0; } + +void pplg_uninit_lib_vfs(void) +{ +} + +int pplg_init_lib_vfs(void) +{ + PCB_API_CHK_VER; + return 0; +} Index: trunk/src_plugins/lib_vfs/lib_vfs.h =================================================================== --- trunk/src_plugins/lib_vfs/lib_vfs.h (nonexistent) +++ trunk/src_plugins/lib_vfs/lib_vfs.h (revision 23992) @@ -0,0 +1,26 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + Index: trunk/src_plugins/lib_vfs/lib_vfs.pup =================================================================== --- trunk/src_plugins/lib_vfs/lib_vfs.pup (nonexistent) +++ trunk/src_plugins/lib_vfs/lib_vfs.pup (revision 23992) @@ -0,0 +1,5 @@ +$class lib +$short fetch data for VFS export +$long Retrieve, sort and query data under VFS export plugins +$state works +default disable-all Index: trunk/src_plugins/plugins_ALL.tmpasm =================================================================== --- trunk/src_plugins/plugins_ALL.tmpasm (revision 23991) +++ trunk/src_plugins/plugins_ALL.tmpasm (revision 23992) @@ -35,6 +35,8 @@ include {../src_plugins/export_stat/Plug.tmpasm} include {../src_plugins/export_svg/Plug.tmpasm} include {../src_plugins/export_test/Plug.tmpasm} +include {../src_plugins/export_vfs_fuse/Plug.tmpasm} +include {../src_plugins/export_vfs_mc/Plug.tmpasm} include {../src_plugins/export_xy/Plug.tmpasm} include {../src_plugins/extedit/Plug.tmpasm} include {../src_plugins/fontmode/Plug.tmpasm} @@ -80,6 +82,7 @@ include {../src_plugins/lib_legacy_func/Plug.tmpasm} include {../src_plugins/lib_netmap/Plug.tmpasm} include {../src_plugins/lib_polyhelp/Plug.tmpasm} +include {../src_plugins/lib_vfs/Plug.tmpasm} include {../src_plugins/loghid/Plug.tmpasm} include {../src_plugins/millpath/Plug.tmpasm} include {../src_plugins/mincut/Plug.tmpasm}