2019-12-20 11:31:34 +01:00
|
|
|
#ifndef __USER_BUILTIN_H__
|
|
|
|
# define __USER_BUILTIN_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2020-03-18 17:48:53 +01:00
|
|
|
// CMDBLOCK()
|
|
|
|
// Generate a "command block" stored in ".cmd.cahce" section.
|
|
|
|
// We need to "hide" the block, so we generate anonyme name using
|
|
|
|
// __COUNTER__ macros.
|
2020-03-30 00:40:59 +02:00
|
|
|
/*#define gen_name(n) _##n
|
2020-03-18 17:48:53 +01:00
|
|
|
#define anonym_name(n) gen_name(n)
|
|
|
|
#define VHEX_BUILTIN(builtin) \
|
|
|
|
static int builtin(int argc, char **argv); \
|
|
|
|
__attribute__((section(".builtin.cache"))) \
|
|
|
|
static const struct builtin_s anonym_name(__COUNTER__) = { \
|
|
|
|
.name = #builtin, \
|
|
|
|
.entry = builtin \
|
|
|
|
}; \
|
|
|
|
static int builtin(int argc, char **argv)
|
2020-03-30 00:40:59 +02:00
|
|
|
*/
|
2019-12-20 11:31:34 +01:00
|
|
|
|
|
|
|
// Define builtin struct.
|
|
|
|
struct builtin_s
|
|
|
|
{
|
|
|
|
char name[10];
|
|
|
|
int (*entry)(int argc, char **argv);
|
|
|
|
};
|
|
|
|
|
2020-02-05 21:09:39 +01:00
|
|
|
// Builtin list
|
2020-03-20 22:47:05 +01:00
|
|
|
extern int builtin_proc(void);
|
|
|
|
extern int builtin_ram(void);
|
2020-03-30 00:40:59 +02:00
|
|
|
extern int builtin_fxdb(int argc, char **argv);
|
2020-02-05 21:09:39 +01:00
|
|
|
|
2019-12-20 11:31:34 +01:00
|
|
|
|
|
|
|
#endif /*__USER_BUILTIN_H__*/
|