mirror of
https://github.com/rfivet/uemacs.git
synced 2025-02-20 23:17:13 -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:
parent
54966da9f0
commit
c206895b9e
107
evar.h
107
evar.h
@ -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,60 +114,62 @@ 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 */
|
||||||
{ "sub", DYNAMIC }, /* subtraction */
|
{ "sub", DYNAMIC }, /* subtraction */
|
||||||
{ "tim", DYNAMIC }, /* multiplication */
|
{ "tim", DYNAMIC }, /* multiplication */
|
||||||
{ "div", DYNAMIC }, /* division */
|
{ "div", DYNAMIC }, /* division */
|
||||||
{ "mod", DYNAMIC }, /* mod */
|
{ "mod", DYNAMIC }, /* mod */
|
||||||
{ "neg", MONAMIC }, /* negate */
|
{ "neg", MONAMIC }, /* negate */
|
||||||
{ "cat", DYNAMIC }, /* concatinate string */
|
{ "cat", DYNAMIC }, /* concatinate string */
|
||||||
{ "lef", DYNAMIC }, /* left string(string, len) */
|
{ "lef", DYNAMIC }, /* left string(string, len) */
|
||||||
{ "rig", DYNAMIC }, /* right string(string, pos) */
|
{ "rig", DYNAMIC }, /* right string(string, pos) */
|
||||||
{ "mid", TRINAMIC }, /* mid string(string, pos, len) */
|
{ "mid", TRINAMIC }, /* mid string(string, pos, len) */
|
||||||
{ "not", MONAMIC }, /* logical not */
|
{ "not", MONAMIC }, /* logical not */
|
||||||
{ "equ", DYNAMIC }, /* logical equality check */
|
{ "equ", DYNAMIC }, /* logical equality check */
|
||||||
{ "les", DYNAMIC }, /* logical less than */
|
{ "les", DYNAMIC }, /* logical less than */
|
||||||
{ "gre", DYNAMIC }, /* logical greater than */
|
{ "gre", DYNAMIC }, /* logical greater than */
|
||||||
{ "seq", DYNAMIC }, /* string logical equality check */
|
{ "seq", DYNAMIC }, /* string logical equality check */
|
||||||
{ "sle", DYNAMIC }, /* string logical less than */
|
{ "sle", DYNAMIC }, /* string logical less than */
|
||||||
{ "sgr", DYNAMIC }, /* string logical greater than */
|
{ "sgr", DYNAMIC }, /* string logical greater than */
|
||||||
{ "ind", MONAMIC }, /* evaluate indirect value */
|
{ "ind", MONAMIC }, /* evaluate indirect value */
|
||||||
{ "and", DYNAMIC }, /* logical and */
|
{ "and", DYNAMIC }, /* logical and */
|
||||||
{ "or", DYNAMIC }, /* logical or */
|
{ "or", DYNAMIC }, /* logical or */
|
||||||
{ "len", MONAMIC }, /* string length */
|
{ "len", MONAMIC }, /* string length */
|
||||||
{ "upp", MONAMIC }, /* uppercase string */
|
{ "upp", MONAMIC }, /* uppercase string */
|
||||||
{ "low", MONAMIC }, /* lower case string */
|
{ "low", MONAMIC }, /* lower case string */
|
||||||
{ "tru", MONAMIC }, /* Truth of the universe logical test */
|
{ "tru", MONAMIC }, /* Truth of the universe logical test */
|
||||||
{ "asc", MONAMIC }, /* char to integer conversion */
|
{ "asc", MONAMIC }, /* char to integer conversion */
|
||||||
{ "chr", MONAMIC }, /* integer to char conversion */
|
{ "chr", MONAMIC }, /* integer to char conversion */
|
||||||
{ "gtk", NILNAMIC }, /* get 1 charater */
|
{ "gtk", NILNAMIC }, /* get 1 charater */
|
||||||
{ "rnd", MONAMIC }, /* get a random number */
|
{ "rnd", MONAMIC }, /* get a random number */
|
||||||
{ "abs", MONAMIC }, /* absolute value of a number */
|
{ "abs", MONAMIC }, /* absolute value of a number */
|
||||||
{ "sin", DYNAMIC }, /* find the index of one string in another */
|
{ "sin", DYNAMIC }, /* find the index of one string in another */
|
||||||
{ "env", MONAMIC }, /* retrieve a system environment var */
|
{ "env", MONAMIC }, /* retrieve a system environment var */
|
||||||
{ "bin", MONAMIC }, /* loopup what function name is bound to a key */
|
{ "bin", MONAMIC }, /* loopup what function name is bound to a key */
|
||||||
{ "exi", MONAMIC }, /* check if a file exists */
|
{ "exi", MONAMIC }, /* check if a file exists */
|
||||||
{ "fin", MONAMIC }, /* look for a file on the path... */
|
{ "fin", MONAMIC }, /* look for a file on the path... */
|
||||||
{ "ban", DYNAMIC }, /* bitwise and 9-10-87 jwm */
|
{ "ban", DYNAMIC }, /* bitwise and 9-10-87 jwm */
|
||||||
{ "bor", DYNAMIC }, /* bitwise or 9-10-87 jwm */
|
{ "bor", DYNAMIC }, /* bitwise or 9-10-87 jwm */
|
||||||
{ "bxo", DYNAMIC }, /* bitwise xor 9-10-87 jwm */
|
{ "bxo", DYNAMIC }, /* bitwise xor 9-10-87 jwm */
|
||||||
{ "bno", MONAMIC }, /* bitwise not */
|
{ "bno", MONAMIC }, /* bitwise not */
|
||||||
{ "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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user