summaryrefslogtreecommitdiff
path: root/other/burneye/src/conf/tmp/functions.c
blob: 96af53c3a269a53392e5abc7bf4ee3744ff6b48e (plain)
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
/* fornax - distributed network
 *
 * by team teso
 *
 * function routines
 */

#include <stdio.h>
#include <string.h>
#include "functions.h"
#include "functionlist.h"
#include "symbol.h"


int	fnc_debug (sym_elem **stab);

function 	gl_fnc[] = {
	/* primitives */
	{ "nop",		NULL },
	{ "debug",		fnc_debug },

	/* network */
	{ "net.listen",		f_listen },

	/* fornax system */
	{ "sys.self",		node_self },

	/* time management */
	{ "time.schedule",	tt_schedule },
	{ "time.erase",		tt_erase },

	/* end of list */
	{ NULL,		NULL },
};


fnc_handler
fnc_find (function ftab[], char *name)
{
	int	stp_p;	/* step pointer */

	for (stp_p = 0 ; ftab[stp_p].name != NULL ; ++stp_p) {
		if (strcasecmp (ftab[stp_p].name, name) == 0)
			return (ftab[stp_p].f_handler);
	}

	return (NULL);
}


int
fnc_debug (sym_elem **stab)
{
	int	n;

	if (stab == NULL)
		return (0);

	for (n = 0 ; stab[n] != NULL ; ++n) {
		printf ("%s . %s\n", (stab[n]->key == NULL) ? "NULL" : stab[n]->key,
			(stab[n]->value == NULL) ? "NULL" : stab[n]->value);
	}

	return (0);
}