1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
#include "config.h"
#include "conf_core.h"
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#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_nogui.h"
#include "hid_attrib.h"
#include "hid_cam.h"
#include "hid_init.h"
const char *export_test_cookie = "export_test HID";
static pcb_hid_attribute_t export_test_options[] = {
/* %start-doc options "8 export_test Creation"
@ftable @code
@item --export_testfile <string>
Name of the export_test output file. Use stdout if not specified.
@end ftable
%end-doc
*/
{"export_testfile", "Name of the export_test output file",
PCB_HATT_STRING, 0, 0, {0, 0, 0}, 0, 0},
#define HA_export_testfile 0
};
#define NUM_OPTIONS (sizeof(export_test_options)/sizeof(export_test_options[0]))
static pcb_hid_attr_val_t export_test_values[NUM_OPTIONS];
static const char *export_test_filename;
static pcb_hid_attribute_t *export_test_get_export_options(int *n)
{
if ((PCB != NULL) && (export_test_options[HA_export_testfile].default_val.str_value == NULL))
pcb_derive_default_filename(PCB->Filename, &export_test_options[HA_export_testfile], ".export_test");
if (n)
*n = NUM_OPTIONS;
return export_test_options;
}
/*
* If fp is not NULL then print out the bill of materials contained in
* export_test. Either way, free all memory which has been allocated for export_test.
*/
static void print_and_free(FILE * fp, /*export_testList*/ void * export_test)
{
}
static int Printexport_test(void)
{
return 0;
}
static void export_test_do_export(pcb_hid_attr_val_t * options)
{
int i;
if (!options) {
export_test_get_export_options(0);
for (i = 0; i < NUM_OPTIONS; i++)
export_test_values[i] = export_test_options[i].default_val;
options = export_test_values;
}
export_test_filename = options[HA_export_testfile].str_value;
if (!export_test_filename)
export_test_filename = "pcb-out.export_test";
else {
TODO(": set some FILE *fp to stdout")
}
Printexport_test();
}
static int export_test_usage(const char *topic)
{
fprintf(stderr, "\nexport_test exporter command line arguments:\n\n");
pcb_hid_usage(export_test_options, sizeof(export_test_options) / sizeof(export_test_options[0]));
fprintf(stderr, "\nUsage: pcb-rnd [generic_options] -x export_test [export_test_options] foo.pcb\n\n");
return 0;
}
static int export_test_parse_arguments(int *argc, char ***argv)
{
pcb_hid_register_attributes(export_test_options, sizeof(export_test_options) / sizeof(export_test_options[0]), export_test_cookie, 0);
return pcb_hid_parse_command_line(argc, argv);
}
pcb_hid_t export_test_hid;
int pplg_check_ver_export_test(int ver_needed) { return 0; }
void pplg_uninit_export_test(void)
{
}
int pplg_init_export_test(void)
{
PCB_API_CHK_VER;
memset(&export_test_hid, 0, sizeof(pcb_hid_t));
pcb_hid_nogui_init(&export_test_hid);
export_test_hid.struct_size = sizeof(pcb_hid_t);
export_test_hid.name = "export_test";
export_test_hid.description = "Exports a dump of HID calls";
export_test_hid.exporter = 1;
export_test_hid.get_export_options = export_test_get_export_options;
export_test_hid.do_export = export_test_do_export;
export_test_hid.parse_arguments = export_test_parse_arguments;
export_test_hid.usage = export_test_usage;
pcb_hid_register_hid(&export_test_hid);
return 0;
}
|