1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-20 00:06:45 -05:00

uemacs: evar.h: Add enum function_type.

Replace four macros used to define integer constants with a enum.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Thiago Farina 2010-08-04 01:05:25 -03:00 committed by Linus Torvalds
parent 54966da9f0
commit c206895b9e

29
evar.h
View File

@ -5,14 +5,13 @@
* written 1986 by Daniel Lawrence * written 1986 by Daniel Lawrence
* modified by Petri Kutvonen * modified by Petri Kutvonen
*/ */
#ifndef EVAR_H_ #ifndef EVAR_H_
#define EVAR_H_ #define EVAR_H_
/* Max #chars in a var name */ /* Max #chars in a var name. */
#define NVSIZE 10 #define NVSIZE 10
/* Structure to hold user variables and their definitions */ /* Structure to hold user variables and their definitions. */
struct user_variable { struct user_variable {
char u_name[NVSIZE + 1]; /* name of user variable */ char u_name[NVSIZE + 1]; /* name of user variable */
char *u_value; /* value (string) */ char *u_value; /* value (string) */
@ -23,7 +22,7 @@ struct user_variable {
/* User variables */ /* User variables */
static struct user_variable uv[MAXVARS + 1]; static struct user_variable uv[MAXVARS + 1];
/* List of recognized environment variables */ /* List of recognized environment variables. */
static char *envars[] = { static char *envars[] = {
"fillcol", /* current fill column */ "fillcol", /* current fill column */
@ -71,7 +70,7 @@ static char *envars[] = {
#endif #endif
}; };
/* and its preprocesor definitions */ /* And its preprocesor definitions. */
#define EVFILLCOL 0 #define EVFILLCOL 0
#define EVPAGELEN 1 #define EVPAGELEN 1
@ -115,16 +114,18 @@ static char *envars[] = {
#define EVSCROLLCOUNT 39 #define EVSCROLLCOUNT 39
#define EVSCROLL 40 #define EVSCROLL 40
/* List of recognized user functions */ enum function_type {
struct user_function { NILNAMIC = 0,
char *f_name; /* name of function */ MONAMIC,
int f_type; /* 1 = monamic, 2 = dynamic */ DYNAMIC,
TRINAMIC,
}; };
#define NILNAMIC 0 /* List of recognized user functions. */
#define MONAMIC 1 struct user_function {
#define DYNAMIC 2 char *f_name;
#define TRINAMIC 3 enum function_type f_type;
};
static struct user_function funcs[] = { static struct user_function funcs[] = {
{ "add", DYNAMIC }, /* add two numbers together */ { "add", DYNAMIC }, /* add two numbers together */
@ -168,7 +169,7 @@ static struct user_function funcs[] = {
{ "xla", TRINAMIC }, /* XLATE character string translation */ { "xla", TRINAMIC }, /* XLATE character string translation */
}; };
/* and its preprocesor definitions */ /* And its preprocesor definitions. */
#define UFADD 0 #define UFADD 0
#define UFSUB 1 #define UFSUB 1