NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
opcodes.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stddef.h>
31#include "opcodes.h"
32
33#define DEFINE_HELP_MESSAGE(opcode, op_string) { #opcode, op_string },
34
35const char *OpStrings[][2] = {
36 OPS(DEFINE_HELP_MESSAGE){ NULL, NULL },
37};
38
39#undef DEFINE_HELP_MESSAGE
40
46const char *opcodes_get_name(int op)
47{
48 if ((op < OP_TIMEOUT) || (op >= OP_MAX))
49 return "[UNKNOWN]";
50
51 if (op == OP_ABORT)
52 return "OP_ABORT";
53 if (op == OP_TIMEOUT)
54 return "OP_TIMEOUT";
55
56 return OpStrings[op][0];
57}
58
64const char *opcodes_get_description(int op)
65{
66 if ((op < OP_TIMEOUT) || (op >= OP_MAX))
67 return "[UNKNOWN]";
68
69 if (op == OP_ABORT)
70 return "abort the current action";
71 if (op == OP_TIMEOUT)
72 return "timeout occurred";
73
74 return OpStrings[op][1];
75}
#define DEFINE_HELP_MESSAGE(opcode, op_string)
Definition: opcodes.c:33
const char * opcodes_get_description(int op)
Get the description of an opcode.
Definition: opcodes.c:64
const char * OpStrings[][2]
Definition: opcodes.c:35
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:46
All user-callable functions.
#define OP_TIMEOUT
Definition: opcodes.h:32
#define OPS(_fmt)
Definition: opcodes.h:356
#define OP_ABORT
Definition: opcodes.h:33
@ OP_MAX
Definition: opcodes.h:378