Introduction
Introduction Statistics Contact Development Disclaimer Help
Code cleanup. - sam - An updated version of the sam text editor.
git clone git://vernunftzentrum.de/sam.git
Log
Files
Refs
LICENSE
---
commit 6c84ad764cbf7b31275586ffb6bb3f3e2060409c
parent 1cbdf994a91e945059b478cdd85ec5841e52c846
Author: Rob King <[email protected]>
Date: Tue, 13 Sep 2016 13:40:41 -0500
Code cleanup.
Diffstat:
samterm/samrc.c | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/samterm/samrc.c b/samterm/samrc.c
@@ -87,17 +87,8 @@ lookupmapping(const char *n, Namemapping *m)
return -1;
}
-static int
-nametocommand(const char *n)
-{
- return lookupmapping(n, commandmapping);
-}
-
-static int
-nametotarget(const char *n)
-{
- return lookupmapping(n, targetmapping);
-}
+#define nametocommand(n) lookupmapping(n, commandmapping)
+#define nametotarget(n) lookupmapping(n, targetmapping)
typedef struct Defaultbinding Defaultbinding;
struct Defaultbinding{
@@ -220,6 +211,9 @@ statetomask(const char *n, Namemapping *m)
return r;
}
+#define buttontomask(n) statetomask(n, buttonmapping)
+#define modtomask(n) statetomask(n, modmapping)
+
static KeySym
nametokeysym(const char *n)
{
@@ -233,13 +227,13 @@ nametokeysym(const char *n)
static int
dirchord(const char *s1, const char *s2, const char *s3, const char *s4)
{
- return installchord(statetomask(s1, buttonmapping), statetomask(s2, button…
+ return installchord(buttontomask(s1), buttontomask(s2), nametocommand(s3),…
}
static int
dirraw(const char *s1, const char *s2, const char *s3, const char *s4)
{
- return installbinding(statetomask(s1, modmapping), nametokeysym(s2), Kraw,…
+ return installbinding(modtomask(s1), nametokeysym(s2), Kraw, strtol(s3, NU…
}
static int
@@ -247,25 +241,25 @@ dirrawliteral(const char *s1, const char *s2, const char …
{
if (strlen(s3) != 1)
return -1;
- return installbinding(statetomask(s1, modmapping), nametokeysym(s2), Kraw,…
+ return installbinding(modtomask(s1), nametokeysym(s2), Kraw, s3[0]);
}
static int
dirbind(const char *s1, const char *s2, const char *s3, const char *s4)
{
- return installbinding(statetomask(s1, modmapping), nametokeysym(s2), Kcomm…
+ return installbinding(modtomask(s1), nametokeysym(s2), Kcommand, nametocom…
}
static int
dirunbind(const char *s1, const char *s2, const char *s3, const char *s4)
{
- return removebinding(statetomask(s1, modmapping), nametokeysym(s2));
+ return removebinding(modtomask(s1), nametokeysym(s2));
}
static int
dirunchord(const char *s1, const char *s2, const char *s3, const char *s4)
{
- return removechord(statetomask(s1, buttonmapping), statetomask(s2, buttonm…
+ return removechord(buttontomask(s1), buttontomask(s2));
}
static int
You are viewing proxied material from vernunftzentrum.de. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.