File: ext_foo.c

package info (click to toggle)
pcb-rnd 3.1.7b-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,108 kB
  • sloc: ansic: 213,400; yacc: 6,241; sh: 4,698; awk: 3,016; makefile: 2,254; lex: 1,166; python: 519; xml: 261; lisp: 154; tcl: 67; perl: 34; javascript: 6; ruby: 5
file content (65 lines) | stat: -rw-r--r-- 2,058 bytes parent folder | download | duplicates (4)
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
/*
 *                            COPYRIGHT
 *
 *  foo - an external plugin for pcb-rnd (example/template plugin)
 *  Copyright (C) 2018 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: TODO: FILL THIS IN
 */

/* This is pcb-rnd's config.h from trunk: */
#include "config.h"

#include <stdio.h>

/* These are pcb-rnd's headers from trunk: */
#include "src/actions.h"
#include "src/plugins.h"

static const char *ext_foo_cookie = "ext foo (external plugin example/template)";

static const char pcb_acts_ExtFoo[] = "ExtFoo(arg1, arg2, [arg3]...)";
static const char pcb_acth_ExtFoo[] = "Help text: short description of what the action does.";
static fgw_error_t pcb_act_ExtFoo(fgw_arg_t *res, int argc, fgw_arg_t *argv)
{
	rnd_message(RND_MSG_ERROR, "PLEASE CONSIDER DEVELOPING A CORE PLUGIN INSTEAD!\n");
	RND_ACT_IRES(0);
	return 0;
}

static const rnd_action_t ext_foo_action_list[] = {
	{"ExtFoo", pcb_act_ExtFoo, pcb_acth_ExtFoo, pcb_acts_ExtFoo}
};

int pplg_check_ver_ext_foo(int ver_needed) { return 0; }

void pplg_uninit_ext_foo(void)
{
	fprintf(stderr, "EXT FOO uninit\n");
	rnd_remove_actions_by_cookie(ext_foo_cookie);
}


int pplg_init_ext_foo(void)
{
	RND_API_CHK_VER; /* for external plugins this is CRITICAL */

	RND_REGISTER_ACTIONS(ext_foo_action_list, ext_foo_cookie);

	fprintf(stderr, "EXT FOO init\n");
	return 0;
}