uber patch.
Added configuration options. Added workspace grid changing. Added keychain timeouts. Fixed some whitespace.
This commit is contained in:
parent
b1223a2acc
commit
bd05f7ec58
17 changed files with 785 additions and 396 deletions
|
@ -11,7 +11,7 @@ bin_PROGRAMS = epist
|
|||
|
||||
man_MANS = epist.1 epistrc.5
|
||||
|
||||
epist_SOURCES = epist.cc window.cc screen.cc main.cc actions.cc yacc_parser.cc parser.cc keytree.cc lex.yy.c
|
||||
epist_SOURCES = epist.cc window.cc screen.cc main.cc actions.cc yacc_parser.cc parser.cc keytree.cc lex.yy.c config.cc
|
||||
epist_LDADD = ../../src/XAtom.o ../../src/BaseDisplay.o \
|
||||
../../src/Util.o ../../src/i18n.o ../../src/Timer.o \
|
||||
../../src/GCCache.o ../../src/Color.o
|
||||
|
@ -57,6 +57,9 @@ screen.o: screen.cc ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
|||
window.o: window.cc epist.hh actions.hh window.hh ../../src/Util.hh \
|
||||
keytree.hh screen.hh ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
||||
../../src/XAtom.hh
|
||||
config.o: config.cc config.hh ../../src/Util.hh \
|
||||
keytree.hh screen.hh ../../src/BaseDisplay.hh ../../src/Timer.hh \
|
||||
../../src/XAtom.hh
|
||||
yacc_parser.cc: epist.y
|
||||
yacc -d epist.y -o yacc_parser.cc
|
||||
lex.yy.c: epist.l
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// actions.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -32,7 +32,6 @@ extern "C" {
|
|||
|
||||
class Action {
|
||||
public:
|
||||
// xOr: this is crap.
|
||||
enum ActionType {
|
||||
noaction = 0,
|
||||
execute, //done
|
||||
|
@ -68,10 +67,20 @@ public:
|
|||
nextWindowOfClassOnAllWorkspaces, //done for now
|
||||
prevWindowOfClassOnAllWorkspaces, //done for now
|
||||
|
||||
upWindow,
|
||||
downWindow,
|
||||
leftWindow,
|
||||
rightWindow,
|
||||
|
||||
changeWorkspace, //done
|
||||
nextWorkspace, //done
|
||||
prevWorkspace, //done
|
||||
|
||||
upWorkspace, //all done
|
||||
downWorkspace,
|
||||
leftWorkspace,
|
||||
rightWorkspace,
|
||||
|
||||
nextScreen, //done for now
|
||||
prevScreen, //done for now
|
||||
|
||||
|
@ -83,7 +92,7 @@ public:
|
|||
keyChain,
|
||||
numberChain,
|
||||
|
||||
cancel,
|
||||
cancelChain, //done
|
||||
|
||||
NUM_ACTIONS
|
||||
};
|
||||
|
|
86
util/epist/config.cc
Normal file
86
util/epist/config.cc
Normal file
|
@ -0,0 +1,86 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// config.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "config.hh"
|
||||
|
||||
Config::Config() {}
|
||||
|
||||
Config::~Config()
|
||||
{
|
||||
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||
for (; it != end; ++it)
|
||||
delete *it;
|
||||
items.clear();
|
||||
}
|
||||
|
||||
|
||||
const string &Config::getStringValue(Config::ItemType type) const
|
||||
{
|
||||
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||
for (; it != end; ++it) {
|
||||
if ((*it)->getType() == type)
|
||||
return (*it)->getStringValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Config::getNumberValue(Config::ItemType type) const
|
||||
{
|
||||
ItemList::const_iterator it = items.begin(), end = items.end();
|
||||
for (; it != end; ++it) {
|
||||
if ((*it)->getType() == type)
|
||||
return (*it)->getNumberValue();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Config::addOption(ConfigItem *item)
|
||||
{
|
||||
items.push_back(item);
|
||||
}
|
||||
|
||||
|
||||
void Config::addOption(const std::string &name, const std::string &value)
|
||||
{
|
||||
const struct {
|
||||
const char *name;
|
||||
Config::ItemType type;
|
||||
}
|
||||
options[] = {
|
||||
{ "notype", Config::noType },
|
||||
{ "chaintimeout", Config::chainTimeout },
|
||||
{ "workspacecolumns", Config::workspaceColumns },
|
||||
{ "", numTypes }
|
||||
};
|
||||
|
||||
size_t i = 0;
|
||||
while (options[i].type != numTypes) {
|
||||
if (strcasecmp(name.c_str(), options[i].name) == 0) {
|
||||
ConfigItem *item = new ConfigItem(options[i].type, value);
|
||||
items.push_back(item);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
75
util/epist/config.hh
Normal file
75
util/epist/config.hh
Normal file
|
@ -0,0 +1,75 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// config.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef __config_hh
|
||||
#define __config_hh
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
|
||||
class ConfigItem;
|
||||
|
||||
class Config {
|
||||
public:
|
||||
enum ItemType {
|
||||
noType,
|
||||
chainTimeout,
|
||||
workspaceColumns,
|
||||
numTypes
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::list<ConfigItem *> ItemList;
|
||||
ItemList items;
|
||||
|
||||
public:
|
||||
Config();
|
||||
~Config();
|
||||
|
||||
const std::string &getStringValue(Config::ItemType) const;
|
||||
int getNumberValue(Config::ItemType) const;
|
||||
void addOption(ConfigItem *);
|
||||
void addOption(const std::string &, const std::string &);
|
||||
};
|
||||
|
||||
|
||||
class ConfigItem {
|
||||
private:
|
||||
Config::ItemType _type;
|
||||
std::string _value;
|
||||
|
||||
public:
|
||||
ConfigItem(Config::ItemType type, std::string value)
|
||||
: _type(type), _value(value) {}
|
||||
~ConfigItem() {}
|
||||
|
||||
inline const std::string &getStringValue() const
|
||||
{ return _value; }
|
||||
|
||||
inline int getNumberValue() const
|
||||
{ return atoi(_value.c_str()); }
|
||||
|
||||
inline Config::ItemType getType() const
|
||||
{ return _type; }
|
||||
};
|
||||
|
||||
#endif // __config_hh
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// epist.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -84,8 +84,14 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
|
|||
_rc_file = DEFAULTRC;
|
||||
|
||||
_xatom = new XAtom(getXDisplay());
|
||||
|
||||
_active = _clients.end();
|
||||
|
||||
_config = new Config;
|
||||
_ktree = new keytree(getXDisplay(), this);
|
||||
|
||||
// set up the key tree
|
||||
parser p(_ktree, _config);
|
||||
p.parse(_rc_file);
|
||||
|
||||
for (unsigned int i = 0; i < getNumberOfScreens(); ++i) {
|
||||
screen *s = new screen(this, i);
|
||||
|
@ -99,12 +105,6 @@ epist::epist(char **argv, char *dpy_name, char *rc_file)
|
|||
::exit(1);
|
||||
}
|
||||
|
||||
_ktree = new keytree(getXDisplay());
|
||||
|
||||
// set up the key tree
|
||||
parser p(_ktree);
|
||||
p.parse(_rc_file);
|
||||
|
||||
activateGrabs();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// epist.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -33,6 +33,7 @@ extern "C" {
|
|||
#include "actions.hh"
|
||||
#include "window.hh"
|
||||
#include "keytree.hh"
|
||||
#include "config.hh"
|
||||
|
||||
#include "../../src/BaseDisplay.hh"
|
||||
|
||||
|
@ -45,6 +46,7 @@ private:
|
|||
XAtom *_xatom;
|
||||
char **_argv;
|
||||
keytree *_ktree;
|
||||
Config *_config;
|
||||
|
||||
typedef std::vector<screen *> ScreenList;
|
||||
ScreenList _screens;
|
||||
|
@ -82,7 +84,8 @@ public:
|
|||
|
||||
const ActionList &actions(void) { return _actions; }
|
||||
keytree &getKeyTree(void) { return *_ktree; }
|
||||
|
||||
inline const Config *getConfig(void) { return _config; }
|
||||
|
||||
WindowList& clientsList() { return _clients; }
|
||||
WindowList::iterator& activeWindow() { return _active; }
|
||||
};
|
||||
|
|
|
@ -13,6 +13,8 @@ extern YYSTYPE yylval;
|
|||
\} return EBRACE;
|
||||
; return SEMICOLON;
|
||||
- return DASH;
|
||||
Options |
|
||||
options return OPTIONS;
|
||||
Mod1 |
|
||||
Mod2 |
|
||||
Mod3 |
|
||||
|
|
|
@ -20,12 +20,13 @@ void yyerror(const char *c) {
|
|||
|
||||
%}
|
||||
|
||||
%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING
|
||||
%token OBRACE EBRACE SEMICOLON DASH NUMBER QUOTES WORD BINDING OPTIONS
|
||||
|
||||
%%
|
||||
|
||||
commands:
|
||||
| commands command
|
||||
| commands options_block
|
||||
;
|
||||
|
||||
command:
|
||||
|
@ -48,6 +49,10 @@ chain_command:
|
|||
}
|
||||
;
|
||||
|
||||
options_block:
|
||||
options_keyword OBRACE options EBRACE
|
||||
;
|
||||
|
||||
binding:
|
||||
binding_w_modifier bind_key
|
||||
;
|
||||
|
@ -79,5 +84,18 @@ parameter:
|
|||
| QUOTES { ((parser*)parser_obj)->setArgumentStr($1); }
|
||||
;
|
||||
|
||||
options_keyword:
|
||||
OPTIONS
|
||||
;
|
||||
|
||||
options:
|
||||
| options option
|
||||
;
|
||||
|
||||
option:
|
||||
WORD parameter SEMICOLON
|
||||
{ ((parser*)parser_obj)->setOption($1); }
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// keytree.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -21,23 +21,39 @@
|
|||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#include "keytree.hh"
|
||||
#include "epist.hh"
|
||||
#include "config.hh"
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
|
||||
keytree::keytree(Display *display) : _display(display)
|
||||
keytree::keytree(Display *display, epist *ep)
|
||||
: _display(display), _timeout_screen(NULL), _timer(NULL), _epist(ep)
|
||||
{
|
||||
_head = new keynode;
|
||||
_head->parent = NULL;
|
||||
_head->action = NULL; // head's action is always NULL
|
||||
_current = _head;
|
||||
// for complete initialization, initialize() has to be called as well. We
|
||||
// call initialize() when we are certain that the config object (which the
|
||||
// timer uses) has been fully initialized. (see parser::parse())
|
||||
}
|
||||
|
||||
keytree::~keytree()
|
||||
{
|
||||
clearTree(_head);
|
||||
delete _timer;
|
||||
}
|
||||
|
||||
void keytree::unloadBindings()
|
||||
{
|
||||
ChildList::iterator it, end = _head->children.end();
|
||||
for (it = _head->children.begin(); it != end; ++it)
|
||||
clearTree(*it);
|
||||
|
||||
_head->children.clear();
|
||||
reset();
|
||||
}
|
||||
|
||||
void keytree::clearTree(keynode *node)
|
||||
|
@ -49,9 +65,12 @@ void keytree::clearTree(keynode *node)
|
|||
for (it = node->children.begin(); it != end; ++it)
|
||||
clearTree(*it);
|
||||
|
||||
node->children.clear();
|
||||
|
||||
if (node->action)
|
||||
delete node->action;
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
|
||||
void keytree::grabDefaults(screen *scr)
|
||||
|
@ -59,6 +78,14 @@ void keytree::grabDefaults(screen *scr)
|
|||
grabChildren(_head, scr);
|
||||
}
|
||||
|
||||
void keytree::ungrabDefaults(screen *scr)
|
||||
{
|
||||
ChildList::const_iterator it, end = _head->children.end();
|
||||
for (it = _head->children.begin(); it != end; ++it)
|
||||
if ( (*it)->action )
|
||||
scr->ungrabKey( (*it)->action->keycode(), (*it)->action->modifierMask() );
|
||||
}
|
||||
|
||||
void keytree::grabChildren(keynode *node, screen *scr)
|
||||
{
|
||||
ChildList::const_iterator it, end = node->children.end();
|
||||
|
@ -104,26 +131,41 @@ const Action * keytree::getAction(const XEvent &e, unsigned int state,
|
|||
// we're done with the children. ungrab them
|
||||
if (_current != _head)
|
||||
ungrabChildren(_current, scr);
|
||||
|
||||
|
||||
ChildList::const_iterator it, end = _current->children.end();
|
||||
for (it = _current->children.begin(); it != end; ++it) {
|
||||
act = (*it)->action;
|
||||
if (e.xkey.keycode == act->keycode() && state == act->modifierMask()) {
|
||||
if ( isLeaf(*it) ) {
|
||||
if (act->type() == Action::cancelChain) {
|
||||
// user is cancelling the chain explicitly
|
||||
_current = _head;
|
||||
return (const Action *)NULL;
|
||||
}
|
||||
else if ( isLeaf(*it) ) {
|
||||
// node is a leaf, so an action will be executed
|
||||
if (_timer->isTiming()) {
|
||||
_timer->stop();
|
||||
_timeout_screen = NULL;
|
||||
}
|
||||
|
||||
_current = _head;
|
||||
return act;
|
||||
}
|
||||
else {
|
||||
// node is not a leaf, so we advance down the tree, and grab the
|
||||
// children of the new current node. no action is executed
|
||||
if (_timer->isTiming())
|
||||
_timer->stop();
|
||||
_timer->start();
|
||||
_timeout_screen = scr;
|
||||
|
||||
_current = *it;
|
||||
grabChildren(_current, scr);
|
||||
return (const Action *)NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// action not found. back to the head
|
||||
_current = _head;
|
||||
return (const Action *)NULL;
|
||||
|
@ -167,3 +209,25 @@ void keytree::setCurrentNodeProps(Action::ActionType action, unsigned int mask,
|
|||
XStringToKeysym(key.c_str())),
|
||||
mask, arg);
|
||||
}
|
||||
|
||||
void keytree::initialize(void)
|
||||
{
|
||||
int tval = _epist->getConfig()->getNumberValue(Config::chainTimeout);
|
||||
_timer = new BTimer(_epist, this);
|
||||
|
||||
if (tval <= 0)
|
||||
tval = 3000; // set default timeout to 3 seconds
|
||||
|
||||
_timer->setTimeout(tval);
|
||||
}
|
||||
|
||||
void keytree::timeout(void)
|
||||
{
|
||||
assert(_timeout_screen != NULL);
|
||||
|
||||
if (_current != _head) {
|
||||
ungrabChildren(_current, _timeout_screen);
|
||||
_current = _head;
|
||||
}
|
||||
_timeout_screen = NULL;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// keytree.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -24,6 +24,7 @@
|
|||
#define _keytree_hh
|
||||
|
||||
#include <list>
|
||||
#include "../../src/Timer.hh"
|
||||
#include "actions.hh"
|
||||
#include "screen.hh"
|
||||
|
||||
|
@ -31,42 +32,49 @@ struct keynode; // forward declaration
|
|||
typedef std::list<keynode *> ChildList;
|
||||
|
||||
struct keynode {
|
||||
Action *action;
|
||||
keynode *parent;
|
||||
ChildList children;
|
||||
Action *action;
|
||||
keynode *parent;
|
||||
ChildList children;
|
||||
};
|
||||
|
||||
class keytree {
|
||||
class keytree : public TimeoutHandler {
|
||||
public:
|
||||
keytree(Display *);
|
||||
~keytree();
|
||||
keytree(Display *, epist *);
|
||||
~keytree();
|
||||
|
||||
void grabDefaults(screen *);
|
||||
const Action * getAction(const XEvent&, unsigned int, screen *);
|
||||
void grabDefaults(screen *);
|
||||
void ungrabDefaults(screen *);
|
||||
const Action * getAction(const XEvent&, unsigned int, screen *);
|
||||
void unloadBindings();
|
||||
void timeout();
|
||||
|
||||
private:
|
||||
// only mister parser needs to know about our sekrets (BUMMY)
|
||||
friend class parser;
|
||||
// only mister parser needs to know about our sekrets (BUMMY)
|
||||
friend class parser;
|
||||
|
||||
void grabChildren(keynode *, screen *);
|
||||
void ungrabChildren(keynode *, screen *);
|
||||
void grabChildren(keynode *, screen *);
|
||||
void ungrabChildren(keynode *, screen *);
|
||||
|
||||
void addAction(Action::ActionType, unsigned int, std::string, std::string);
|
||||
void advanceOnNewNode();
|
||||
void retract();
|
||||
void setCurrentNodeProps(Action::ActionType, unsigned int, std::string, std::string);
|
||||
void addAction(Action::ActionType, unsigned int, std::string, std::string);
|
||||
void advanceOnNewNode();
|
||||
void retract();
|
||||
void setCurrentNodeProps(Action::ActionType, unsigned int, std::string, std::string);
|
||||
void initialize();
|
||||
|
||||
void reset()
|
||||
{ _current = _head; }
|
||||
void reset()
|
||||
{ _current = _head; }
|
||||
|
||||
bool isLeaf(keynode *node)
|
||||
{ return node->children.empty(); }
|
||||
bool isLeaf(keynode *node)
|
||||
{ return node->children.empty(); }
|
||||
|
||||
void clearTree(keynode *);
|
||||
void clearTree(keynode *);
|
||||
|
||||
keynode *_head;
|
||||
keynode *_current;
|
||||
Display *_display;
|
||||
keynode *_head;
|
||||
keynode *_current;
|
||||
Display *_display;
|
||||
BTimer *_timer;
|
||||
screen *_timeout_screen;
|
||||
epist *_epist;
|
||||
};
|
||||
|
||||
#endif // _keytree_hh
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
||||
#ifdef c_plusplus
|
||||
|
@ -22,15 +22,7 @@
|
|||
#ifdef __cplusplus
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifndef YY_ALWAYS_INTERACTIVE
|
||||
#ifndef YY_NEVER_INTERACTIVE
|
||||
extern int isatty YY_PROTO(( int ));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Use prototypes in function declarations. */
|
||||
#define YY_USE_PROTOS
|
||||
|
@ -290,15 +282,16 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
|
|||
*yy_cp = '\0'; \
|
||||
yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 17
|
||||
#define YY_END_OF_BUFFER 18
|
||||
static yyconst short int yy_accept[42] =
|
||||
#define YY_NUM_RULES 19
|
||||
#define YY_END_OF_BUFFER 20
|
||||
static yyconst short int yy_accept[56] =
|
||||
{ 0,
|
||||
0, 0, 18, 17, 16, 15, 17, 17, 4, 11,
|
||||
3, 13, 13, 13, 13, 1, 2, 16, 0, 0,
|
||||
11, 13, 13, 13, 13, 12, 14, 13, 13, 13,
|
||||
13, 5, 6, 7, 8, 13, 13, 10, 13, 9,
|
||||
0
|
||||
0, 0, 20, 19, 18, 17, 19, 19, 4, 13,
|
||||
3, 15, 15, 15, 15, 15, 15, 1, 2, 18,
|
||||
0, 0, 13, 15, 15, 15, 15, 15, 15, 14,
|
||||
16, 15, 15, 15, 15, 15, 15, 7, 8, 9,
|
||||
10, 15, 15, 15, 15, 15, 12, 15, 15, 15,
|
||||
15, 11, 5, 6, 0
|
||||
} ;
|
||||
|
||||
static yyconst int yy_ec[256] =
|
||||
|
@ -310,13 +303,13 @@ static yyconst int yy_ec[256] =
|
|||
1, 1, 1, 1, 6, 1, 1, 7, 8, 9,
|
||||
10, 11, 7, 7, 7, 7, 7, 1, 12, 1,
|
||||
1, 1, 1, 1, 13, 13, 14, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 15, 13, 13, 13,
|
||||
13, 13, 16, 13, 13, 13, 13, 13, 13, 13,
|
||||
1, 1, 1, 1, 13, 1, 13, 13, 13, 17,
|
||||
13, 13, 13, 13, 13, 13, 15, 13, 16, 13,
|
||||
13, 13, 17, 13, 13, 13, 13, 13, 13, 13,
|
||||
1, 1, 1, 1, 13, 1, 13, 13, 13, 18,
|
||||
|
||||
13, 18, 13, 19, 20, 13, 13, 21, 13, 22,
|
||||
23, 13, 13, 24, 13, 25, 13, 13, 13, 13,
|
||||
13, 13, 26, 1, 27, 1, 1, 1, 1, 1,
|
||||
13, 19, 13, 20, 21, 13, 13, 22, 13, 23,
|
||||
24, 25, 13, 26, 27, 28, 13, 13, 13, 13,
|
||||
13, 13, 29, 1, 30, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
|
@ -333,59 +326,63 @@ static yyconst int yy_ec[256] =
|
|||
1, 1, 1, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst int yy_meta[28] =
|
||||
static yyconst int yy_meta[31] =
|
||||
{ 0,
|
||||
1, 1, 2, 1, 1, 1, 3, 3, 3, 3,
|
||||
3, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 1, 1
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 1, 1
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_base[45] =
|
||||
static yyconst short int yy_base[59] =
|
||||
{ 0,
|
||||
0, 0, 64, 65, 61, 65, 0, 0, 65, 21,
|
||||
65, 0, 39, 38, 41, 65, 65, 57, 54, 54,
|
||||
26, 0, 34, 38, 34, 49, 65, 27, 30, 33,
|
||||
26, 0, 0, 0, 0, 24, 25, 0, 25, 0,
|
||||
65, 41, 44, 40
|
||||
0, 0, 79, 80, 76, 80, 0, 0, 80, 24,
|
||||
80, 0, 53, 52, 50, 54, 48, 80, 80, 70,
|
||||
67, 67, 29, 0, 46, 50, 39, 45, 37, 60,
|
||||
80, 35, 33, 41, 42, 39, 33, 0, 0, 0,
|
||||
0, 34, 29, 32, 31, 31, 0, 30, 30, 24,
|
||||
22, 0, 0, 0, 80, 44, 47, 43
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_def[45] =
|
||||
static yyconst short int yy_def[59] =
|
||||
{ 0,
|
||||
41, 1, 41, 41, 41, 41, 42, 43, 41, 44,
|
||||
41, 44, 44, 44, 44, 41, 41, 41, 42, 43,
|
||||
44, 44, 44, 44, 44, 42, 41, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
0, 41, 41, 41
|
||||
55, 1, 55, 55, 55, 55, 56, 57, 55, 58,
|
||||
55, 58, 58, 58, 58, 58, 58, 55, 55, 55,
|
||||
56, 57, 58, 58, 58, 58, 58, 58, 58, 56,
|
||||
55, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||
58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
|
||||
58, 58, 58, 58, 0, 55, 55, 55
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_nxt[93] =
|
||||
static yyconst short int yy_nxt[111] =
|
||||
{ 0,
|
||||
4, 5, 6, 7, 8, 9, 10, 10, 10, 10,
|
||||
10, 11, 12, 13, 14, 15, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 16, 17, 21, 21, 21,
|
||||
21, 21, 21, 21, 21, 21, 21, 32, 33, 34,
|
||||
35, 19, 22, 19, 20, 40, 20, 39, 38, 37,
|
||||
36, 31, 26, 30, 29, 28, 27, 26, 18, 25,
|
||||
24, 23, 18, 41, 3, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41
|
||||
10, 11, 12, 13, 14, 15, 16, 12, 12, 12,
|
||||
12, 12, 12, 17, 12, 12, 12, 12, 18, 19,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||
38, 39, 40, 41, 21, 24, 21, 22, 54, 22,
|
||||
53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
|
||||
43, 42, 37, 30, 36, 35, 34, 33, 32, 31,
|
||||
30, 20, 29, 28, 27, 26, 25, 20, 55, 3,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
|
||||
} ;
|
||||
|
||||
static yyconst short int yy_chk[93] =
|
||||
static yyconst short int yy_chk[111] =
|
||||
{ 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 10, 10, 10,
|
||||
10, 10, 21, 21, 21, 21, 21, 29, 29, 29,
|
||||
29, 42, 44, 42, 43, 39, 43, 37, 36, 31,
|
||||
30, 28, 26, 25, 24, 23, 20, 19, 18, 15,
|
||||
14, 13, 5, 3, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
|
||||
41, 41
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
10, 10, 10, 10, 10, 23, 23, 23, 23, 23,
|
||||
33, 33, 33, 33, 56, 58, 56, 57, 51, 57,
|
||||
50, 49, 48, 46, 45, 44, 43, 42, 37, 36,
|
||||
35, 34, 32, 30, 29, 28, 27, 26, 25, 22,
|
||||
21, 20, 17, 16, 15, 14, 13, 5, 3, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
|
||||
|
||||
55, 55, 55, 55, 55, 55, 55, 55, 55, 55
|
||||
} ;
|
||||
|
||||
static yy_state_type yy_last_accepting_state;
|
||||
|
@ -408,7 +405,7 @@ char *yytext;
|
|||
|
||||
extern YYSTYPE yylval;
|
||||
|
||||
#line 412 "lex.yy.c"
|
||||
#line 409 "lex.yy.c"
|
||||
|
||||
/* Macros after this point can all be overridden by user definitions in
|
||||
* section 1.
|
||||
|
@ -508,20 +505,9 @@ YY_MALLOC_DECL
|
|||
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
||||
result = n; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
errno=0; \
|
||||
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
|
||||
{ \
|
||||
if( errno != EINTR) \
|
||||
{ \
|
||||
YY_FATAL_ERROR( "input in flex scanner failed" ); \
|
||||
break; \
|
||||
} \
|
||||
errno=0; \
|
||||
clearerr(yyin); \
|
||||
} \
|
||||
}
|
||||
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
|
||||
&& ferror( yyin ) ) \
|
||||
YY_FATAL_ERROR( "input in flex scanner failed" );
|
||||
#endif
|
||||
|
||||
/* No semi-colon after return; correct usage is to write "yyterminate();" -
|
||||
|
@ -573,7 +559,7 @@ YY_DECL
|
|||
#line 10 "epist.l"
|
||||
|
||||
|
||||
#line 577 "lex.yy.c"
|
||||
#line 563 "lex.yy.c"
|
||||
|
||||
if ( yy_init )
|
||||
{
|
||||
|
@ -624,13 +610,13 @@ yy_match:
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 42 )
|
||||
if ( yy_current_state >= 56 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_base[yy_current_state] != 65 );
|
||||
while ( yy_base[yy_current_state] != 80 );
|
||||
|
||||
yy_find_action:
|
||||
yy_act = yy_accept[yy_current_state];
|
||||
|
@ -679,7 +665,10 @@ return DASH;
|
|||
case 5:
|
||||
#line 17 "epist.l"
|
||||
case 6:
|
||||
#line 18 "epist.l"
|
||||
YY_RULE_SETUP
|
||||
#line 17 "epist.l"
|
||||
return OPTIONS;
|
||||
YY_BREAK
|
||||
case 7:
|
||||
#line 19 "epist.l"
|
||||
case 8:
|
||||
|
@ -687,46 +676,50 @@ case 8:
|
|||
case 9:
|
||||
#line 21 "epist.l"
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 21 "epist.l"
|
||||
yylval = (int) strdup(yytext); return BINDING;
|
||||
YY_BREAK
|
||||
case 11:
|
||||
YY_RULE_SETUP
|
||||
#line 22 "epist.l"
|
||||
yylval = (int) strdup(yytext); return NUMBER;
|
||||
YY_BREAK
|
||||
case 11:
|
||||
#line 23 "epist.l"
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 23 "epist.l"
|
||||
yylval = (int) strdup(yytext); return QUOTES;
|
||||
yylval = (int) strdup(yytext); return BINDING;
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 24 "epist.l"
|
||||
yylval = (int) strdup(yytext); return WORD;
|
||||
yylval = (int) strdup(yytext); return NUMBER;
|
||||
YY_BREAK
|
||||
case 14:
|
||||
YY_RULE_SETUP
|
||||
#line 25 "epist.l"
|
||||
/* ignore */
|
||||
yylval = (int) strdup(yytext); return QUOTES;
|
||||
YY_BREAK
|
||||
case 15:
|
||||
YY_RULE_SETUP
|
||||
#line 26 "epist.l"
|
||||
/* ignore */
|
||||
yylval = (int) strdup(yytext); return WORD;
|
||||
YY_BREAK
|
||||
case 16:
|
||||
YY_RULE_SETUP
|
||||
#line 27 "epist.l"
|
||||
/* */
|
||||
/* ignore */
|
||||
YY_BREAK
|
||||
case 17:
|
||||
YY_RULE_SETUP
|
||||
#line 28 "epist.l"
|
||||
/* ignore */
|
||||
YY_BREAK
|
||||
case 18:
|
||||
YY_RULE_SETUP
|
||||
#line 29 "epist.l"
|
||||
/* */
|
||||
YY_BREAK
|
||||
case 19:
|
||||
YY_RULE_SETUP
|
||||
#line 30 "epist.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 730 "lex.yy.c"
|
||||
#line 723 "lex.yy.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
|
@ -1018,7 +1011,7 @@ static yy_state_type yy_get_previous_state()
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 42 )
|
||||
if ( yy_current_state >= 56 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1053,11 +1046,11 @@ yy_state_type yy_current_state;
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 42 )
|
||||
if ( yy_current_state >= 56 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 41);
|
||||
yy_is_jam = (yy_current_state == 55);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -1290,15 +1283,11 @@ YY_BUFFER_STATE b;
|
|||
}
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#ifndef YY_ALWAYS_INTERACTIVE
|
||||
#ifndef YY_NEVER_INTERACTIVE
|
||||
extern int isatty YY_PROTO(( int ));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
|
@ -1616,6 +1605,6 @@ int main()
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
#line 28 "epist.l"
|
||||
#line 30 "epist.l"
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// parser.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -8,144 +30,150 @@ extern "C" {
|
|||
|
||||
using std::string;
|
||||
|
||||
parser::parser(keytree *kt)
|
||||
: _kt(kt), _mask(0), _action(Action::noaction), _key(""), _arg("")
|
||||
parser::parser(keytree *kt, Config *conf)
|
||||
: _kt(kt), _config(conf), _mask(0), _action(Action::noaction),
|
||||
_key(""), _arg("")
|
||||
{
|
||||
}
|
||||
|
||||
parser::~parser()
|
||||
{
|
||||
// nothing to see here. move along.
|
||||
// nothing to see here. move along.
|
||||
}
|
||||
|
||||
void parser::parse(string rc_file)
|
||||
{
|
||||
extern int yyparse(void *);
|
||||
extern FILE *yyin;
|
||||
extern int yyparse(void *);
|
||||
extern FILE *yyin;
|
||||
|
||||
yyin = fopen(rc_file.c_str(), "r");
|
||||
yyin = fopen(rc_file.c_str(), "r");
|
||||
|
||||
yyparse(this);
|
||||
yyparse(this);
|
||||
|
||||
fclose(yyin);
|
||||
_kt->reset();
|
||||
fclose(yyin);
|
||||
_kt->reset();
|
||||
_kt->initialize();
|
||||
}
|
||||
|
||||
void parser::setAction(string act)
|
||||
{
|
||||
struct {
|
||||
const char* str;
|
||||
Action::ActionType act;
|
||||
struct {
|
||||
const char* str;
|
||||
Action::ActionType act;
|
||||
}
|
||||
actions[] = {
|
||||
{ "noaction", Action::noaction },
|
||||
{ "execute", Action::execute },
|
||||
{ "iconify", Action::iconify },
|
||||
{ "raise", Action::raise },
|
||||
{ "lower", Action::lower },
|
||||
{ "close", Action::close },
|
||||
{ "toggleshade", Action::toggleshade },
|
||||
{ "toggleomnipresent", Action::toggleomnipresent },
|
||||
{ "movewindowup", Action::moveWindowUp },
|
||||
{ "movewindowdown", Action::moveWindowDown },
|
||||
{ "movewindowleft", Action::moveWindowLeft },
|
||||
{ "movewindowright", Action::moveWindowRight },
|
||||
{ "resizewindowwidth", Action::resizeWindowWidth },
|
||||
{ "resizewindowheight", Action::resizeWindowHeight },
|
||||
{ "togglemaximizefull", Action::toggleMaximizeFull },
|
||||
{ "togglemaximizevertical", Action::toggleMaximizeVertical },
|
||||
{ "togglemaximizehorizontal", Action::toggleMaximizeHorizontal },
|
||||
{ "sendtoworkspace", Action::sendToWorkspace },
|
||||
{ "nextwindow", Action::nextWindow },
|
||||
{ "prevwindow", Action::prevWindow },
|
||||
{ "nextwindowonallworkspaces", Action::nextWindowOnAllWorkspaces },
|
||||
{ "prevwindowonallworkspaces", Action::prevWindowOnAllWorkspaces },
|
||||
{ "nextwindowonallscreens", Action::nextWindowOnAllScreens },
|
||||
{ "prevwindowonallscreens", Action::prevWindowOnAllScreens },
|
||||
{ "nextwindowofclass", Action::nextWindowOfClass },
|
||||
{ "prevwindowofclass", Action::prevWindowOfClass },
|
||||
{ "nextwindowofclassonallworkspaces", Action::nextWindowOfClassOnAllWorkspaces },
|
||||
{ "prevwindowofclassonallworkspaces", Action::prevWindowOfClassOnAllWorkspaces },
|
||||
{ "changeworkspace", Action::changeWorkspace },
|
||||
{ "nextworkspace", Action::nextWorkspace },
|
||||
{ "prevworkspace", Action::prevWorkspace },
|
||||
{ "nextworkspacerow", Action::upWorkspace },
|
||||
{ "prevworkspacerow", Action::downWorkspace },
|
||||
{ "prevworkspacecolumn", Action::leftWorkspace },
|
||||
{ "nextworkspacecolumn", Action::rightWorkspace },
|
||||
{ "nextscreen", Action::nextScreen },
|
||||
{ "prevscreen", Action::prevScreen },
|
||||
{ "showrootmenu", Action::showRootMenu },
|
||||
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
||||
{ "stringchain", Action::stringChain },
|
||||
{ "keychain", Action::keyChain },
|
||||
{ "numberchain", Action::numberChain },
|
||||
{ "cancelchain", Action::cancelChain },
|
||||
{ "", Action::noaction }
|
||||
};
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; actions[i].str != ""; ++i) {
|
||||
if ( strcasecmp(actions[i].str, act.c_str()) == 0 ) {
|
||||
_action = actions[i].act;
|
||||
found = true;
|
||||
}
|
||||
actions[] = {
|
||||
{ "noaction", Action::noaction },
|
||||
{ "execute", Action::execute },
|
||||
{ "iconify", Action::iconify },
|
||||
{ "raise", Action::raise },
|
||||
{ "lower", Action::lower },
|
||||
{ "close", Action::close },
|
||||
{ "toggleshade", Action::toggleshade },
|
||||
{ "toggleomnipresent", Action::toggleomnipresent },
|
||||
{ "movewindowup", Action::moveWindowUp },
|
||||
{ "movewindowdown", Action::moveWindowDown },
|
||||
{ "movewindowleft", Action::moveWindowLeft },
|
||||
{ "movewindowright", Action::moveWindowRight },
|
||||
{ "resizewindowwidth", Action::resizeWindowWidth },
|
||||
{ "resizewindowheight", Action::resizeWindowHeight },
|
||||
{ "togglemaximizefull", Action::toggleMaximizeFull },
|
||||
{ "togglemaximizevertical", Action::toggleMaximizeVertical },
|
||||
{ "togglemaximizehorizontal", Action::toggleMaximizeHorizontal },
|
||||
{ "sendtoworkspace", Action::sendToWorkspace },
|
||||
{ "nextwindow", Action::nextWindow },
|
||||
{ "prevwindow", Action::prevWindow },
|
||||
{ "nextwindowonallworkspaces", Action::nextWindowOnAllWorkspaces },
|
||||
{ "prevwindowonallworkspaces", Action::prevWindowOnAllWorkspaces },
|
||||
{ "nextwindowonallscreens", Action::nextWindowOnAllScreens },
|
||||
{ "prevwindowonallscreens", Action::prevWindowOnAllScreens },
|
||||
{ "nextwindowofclass", Action::nextWindowOfClass },
|
||||
{ "prevwindowofclass", Action::prevWindowOfClass },
|
||||
{ "nextwindowofclassonallworkspaces", Action::nextWindowOfClassOnAllWorkspaces },
|
||||
{ "prevwindowofclassonallworkspaces", Action::prevWindowOfClassOnAllWorkspaces },
|
||||
{ "changeworkspace", Action::changeWorkspace },
|
||||
{ "nextworkspace", Action::nextWorkspace },
|
||||
{ "prevworkspace", Action::prevWorkspace },
|
||||
{ "nextscreen", Action::nextScreen },
|
||||
{ "prevscreen", Action::prevScreen },
|
||||
{ "showrootmenu", Action::showRootMenu },
|
||||
{ "showworkspacemenu", Action::showWorkspaceMenu },
|
||||
{ "stringchain", Action::stringChain },
|
||||
{ "keychain", Action::keyChain },
|
||||
{ "numberchain", Action::numberChain },
|
||||
{ "cancel", Action::cancel },
|
||||
{ "", Action::noaction }
|
||||
};
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; actions[i].str != ""; ++i) {
|
||||
if ( strcasecmp(actions[i].str, act.c_str()) == 0 ) {
|
||||
_action = actions[i].act;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
_action = Action::noaction;
|
||||
if (!found)
|
||||
_action = Action::noaction;
|
||||
}
|
||||
|
||||
void parser::addModifier(string mod)
|
||||
{
|
||||
struct {
|
||||
string str;
|
||||
unsigned int mask;
|
||||
}
|
||||
modifiers[] = {
|
||||
{ "Mod1", Mod1Mask },
|
||||
{ "Mod2", Mod2Mask },
|
||||
{ "Mod3", Mod3Mask },
|
||||
{ "Mod4", Mod4Mask },
|
||||
{ "Control", ControlMask },
|
||||
{ "Shift", ShiftMask },
|
||||
{ "", 0 }
|
||||
};
|
||||
struct {
|
||||
string str;
|
||||
unsigned int mask;
|
||||
}
|
||||
modifiers[] = {
|
||||
{ "Mod1", Mod1Mask },
|
||||
{ "Mod2", Mod2Mask },
|
||||
{ "Mod3", Mod3Mask },
|
||||
{ "Mod4", Mod4Mask },
|
||||
{ "Control", ControlMask },
|
||||
{ "Shift", ShiftMask },
|
||||
{ "", 0 }
|
||||
};
|
||||
|
||||
for (int i = 0; modifiers[i].str != ""; ++i) {
|
||||
if (modifiers[i].str == mod)
|
||||
_mask |= modifiers[i].mask;
|
||||
}
|
||||
for (int i = 0; modifiers[i].str != ""; ++i) {
|
||||
if (modifiers[i].str == mod)
|
||||
_mask |= modifiers[i].mask;
|
||||
}
|
||||
}
|
||||
|
||||
void parser::endAction()
|
||||
{
|
||||
_kt->addAction(_action, _mask, _key, _arg);
|
||||
reset();
|
||||
_kt->addAction(_action, _mask, _key, _arg);
|
||||
reset();
|
||||
}
|
||||
|
||||
void parser::startChain()
|
||||
{
|
||||
_kt->advanceOnNewNode();
|
||||
setChainBinding();
|
||||
reset();
|
||||
_kt->advanceOnNewNode();
|
||||
setChainBinding();
|
||||
reset();
|
||||
}
|
||||
|
||||
void parser::endChain()
|
||||
{
|
||||
_kt->retract();
|
||||
reset();
|
||||
_kt->retract();
|
||||
reset();
|
||||
}
|
||||
|
||||
void parser::setChainBinding()
|
||||
{
|
||||
if (_mask != 0 && _key != "") {
|
||||
_kt->setCurrentNodeProps(Action::noaction, _mask, _key, "");
|
||||
reset();
|
||||
}
|
||||
if (_mask != 0 && _key != "") {
|
||||
_kt->setCurrentNodeProps(Action::noaction, _mask, _key, "");
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
void parser::reset()
|
||||
{
|
||||
_mask = 0;
|
||||
_action = Action::noaction;
|
||||
_key = "";
|
||||
_arg = "";
|
||||
_mask = 0;
|
||||
_action = Action::noaction;
|
||||
_key = "";
|
||||
_arg = "";
|
||||
}
|
||||
|
|
|
@ -1,40 +1,72 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// parser.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef __parser_hh
|
||||
#define __parser_hh
|
||||
|
||||
#include "actions.hh"
|
||||
#include "keytree.hh"
|
||||
#include "config.hh"
|
||||
|
||||
#include <string>
|
||||
|
||||
class parser {
|
||||
public:
|
||||
parser(keytree *);
|
||||
~parser();
|
||||
parser(keytree *, Config *);
|
||||
~parser();
|
||||
|
||||
void parse(std::string);
|
||||
void parse(std::string);
|
||||
|
||||
void setKey(std::string key)
|
||||
{ _key = key; }
|
||||
void setKey(std::string key)
|
||||
{ _key = key; }
|
||||
|
||||
void setArgumentNum(std::string arg)
|
||||
{ _arg = arg; }
|
||||
void setArgumentNum(std::string arg)
|
||||
{ _arg = arg; }
|
||||
|
||||
void setArgumentNegNum(std::string arg)
|
||||
{ _arg = "-" + arg; }
|
||||
void setArgumentNegNum(std::string arg)
|
||||
{ _arg = "-" + arg; }
|
||||
|
||||
void setArgumentStr(std::string arg)
|
||||
{ _arg = arg.substr(1, arg.size() - 2); }
|
||||
void setArgumentStr(std::string arg)
|
||||
{ _arg = arg.substr(1, arg.size() - 2); }
|
||||
|
||||
void setAction(std::string);
|
||||
void addModifier(std::string);
|
||||
void endAction();
|
||||
void startChain();
|
||||
void setChainBinding();
|
||||
void endChain();
|
||||
void setOption(std::string opt)
|
||||
{ _config->addOption(opt, _arg); }
|
||||
|
||||
void setAction(std::string);
|
||||
void addModifier(std::string);
|
||||
void endAction();
|
||||
void startChain();
|
||||
void setChainBinding();
|
||||
void endChain();
|
||||
|
||||
private:
|
||||
void reset();
|
||||
void reset();
|
||||
|
||||
keytree *_kt;
|
||||
unsigned int _mask;
|
||||
Action::ActionType _action;
|
||||
std::string _key;
|
||||
std::string _arg;
|
||||
keytree *_kt;
|
||||
Config *_config;
|
||||
unsigned int _mask;
|
||||
Action::ActionType _action;
|
||||
std::string _key;
|
||||
std::string _arg;
|
||||
};
|
||||
|
||||
#endif //__parser_hh
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// screen.cc for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -48,7 +48,7 @@ using std::string;
|
|||
#include "../../src/XAtom.hh"
|
||||
#include "screen.hh"
|
||||
#include "epist.hh"
|
||||
|
||||
#include "config.hh"
|
||||
|
||||
screen::screen(epist *epist, int number)
|
||||
: _clients(epist->clientsList()),
|
||||
|
@ -59,7 +59,7 @@ screen::screen(epist *epist, int number)
|
|||
_number = number;
|
||||
_info = _epist->getScreenInfo(_number);
|
||||
_root = _info->getRootWindow();
|
||||
|
||||
|
||||
// find a window manager supporting NETWM, waiting for it to load if we must
|
||||
int count = 20; // try for 20 seconds
|
||||
_managed = false;
|
||||
|
@ -222,6 +222,22 @@ void screen::handleKeypress(const XEvent &e) {
|
|||
changeWorkspace(it->number());
|
||||
return;
|
||||
|
||||
case Action::upWorkspace:
|
||||
changeWorkspaceVert(-1);
|
||||
return;
|
||||
|
||||
case Action::downWorkspace:
|
||||
changeWorkspaceVert(1);
|
||||
return;
|
||||
|
||||
case Action::leftWorkspace:
|
||||
changeWorkspaceHorz(-1);
|
||||
return;
|
||||
|
||||
case Action::rightWorkspace:
|
||||
changeWorkspaceHorz(1);
|
||||
return;
|
||||
|
||||
case Action::execute:
|
||||
execCommand(it->string());
|
||||
return;
|
||||
|
@ -564,6 +580,48 @@ void screen::changeWorkspace(const int num) const {
|
|||
_xatom->sendClientMessage(_root, XAtom::net_current_desktop, _root, num);
|
||||
}
|
||||
|
||||
void screen::changeWorkspaceVert(const int num) const {
|
||||
assert(_managed);
|
||||
const Config *conf = _epist->getConfig();
|
||||
int width = conf->getNumberValue(Config::workspaceColumns);
|
||||
|
||||
if (width > _num_desktops || width <= 0)
|
||||
return;
|
||||
|
||||
if (num < 0) {
|
||||
int wnum = _active_desktop - width;
|
||||
if (wnum >= 0)
|
||||
changeWorkspace(wnum);
|
||||
}
|
||||
else {
|
||||
int wnum = _active_desktop + width;
|
||||
if (wnum < _num_desktops)
|
||||
changeWorkspace(wnum);
|
||||
}
|
||||
}
|
||||
|
||||
void screen::changeWorkspaceHorz(const int num) const {
|
||||
assert(_managed);
|
||||
const Config *conf = _epist->getConfig();
|
||||
int width = conf->getNumberValue(Config::workspaceColumns);
|
||||
|
||||
if (width > _num_desktops || width <= 0)
|
||||
return;
|
||||
|
||||
if (num < 0) {
|
||||
if (_active_desktop % width != 0)
|
||||
changeWorkspace(_active_desktop - 1);
|
||||
else
|
||||
changeWorkspace(_active_desktop + width - 1);
|
||||
}
|
||||
else {
|
||||
if (_active_desktop % width != width - 1)
|
||||
changeWorkspace(_active_desktop + 1);
|
||||
else
|
||||
changeWorkspace(_active_desktop - width + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void screen::grabKey(const KeyCode keyCode, const int modifierMask) const {
|
||||
|
||||
Display *display = _epist->getXDisplay();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// -*- mode: C++; indent-tabs-mode: nil; -*-
|
||||
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
|
||||
// screen.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
|
||||
// Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
|
||||
//
|
||||
|
@ -84,6 +84,9 @@ public:
|
|||
void cycleWorkspace(const bool forward, const int increment,
|
||||
const bool loop = true) const;
|
||||
void changeWorkspace(const int num) const;
|
||||
void changeWorkspaceVert(const int num) const;
|
||||
void changeWorkspaceHorz(const int num) const;
|
||||
|
||||
void toggleShaded(const Window win) const;
|
||||
void execCommand(const std::string &cmd) const;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A Bison parser, made from epist.y
|
||||
by GNU bison 1.35. */
|
||||
by GNU bison 1.34. */
|
||||
|
||||
#define YYBISON 1 /* Identify Bison output. */
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
|||
# define QUOTES 262
|
||||
# define WORD 263
|
||||
# define BINDING 264
|
||||
# define OPTIONS 265
|
||||
|
||||
#line 1 "epist.y"
|
||||
|
||||
|
@ -34,8 +35,7 @@ void yyerror(const char *c) {
|
|||
|
||||
|
||||
#ifndef YYSTYPE
|
||||
# define YYSTYPE int
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
#define YYSTYPE int
|
||||
#endif
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
|
@ -43,12 +43,12 @@ void yyerror(const char *c) {
|
|||
|
||||
|
||||
|
||||
#define YYFINAL 30
|
||||
#define YYFINAL 40
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 11
|
||||
#define YYNTBASE 12
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 264 ? yytranslate[x] : 21)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 265 ? yytranslate[x] : 26)
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
||||
static const char yytranslate[] =
|
||||
|
@ -79,23 +79,25 @@ static const char yytranslate[] =
|
|||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
|
||||
6, 7, 8, 9, 10
|
||||
6, 7, 8, 9, 10, 11
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
static const short yyprhs[] =
|
||||
{
|
||||
0, 0, 1, 4, 6, 8, 13, 18, 21, 23,
|
||||
25, 26, 30, 32, 34, 36, 38, 40, 42, 43,
|
||||
45, 48
|
||||
0, 0, 1, 4, 7, 9, 11, 16, 21, 26,
|
||||
29, 31, 33, 34, 38, 40, 42, 44, 46, 48,
|
||||
50, 51, 53, 56, 58, 60, 61, 64
|
||||
};
|
||||
static const short yyrhs[] =
|
||||
{
|
||||
-1, 11, 12, 0, 13, 0, 14, 0, 15, 9,
|
||||
20, 5, 0, 15, 16, 11, 17, 0, 18, 19,
|
||||
0, 3, 0, 4, 0, 0, 10, 6, 18, 0,
|
||||
3, 0, 4, 0, 6, 0, 5, 0, 7, 0,
|
||||
9, 0, 0, 7, 0, 6, 7, 0, 8, 0
|
||||
-1, 12, 13, 0, 12, 16, 0, 14, 0, 15,
|
||||
0, 17, 9, 22, 5, 0, 17, 18, 12, 19,
|
||||
0, 23, 3, 24, 4, 0, 20, 21, 0, 3,
|
||||
0, 4, 0, 0, 10, 6, 20, 0, 3, 0,
|
||||
4, 0, 6, 0, 5, 0, 7, 0, 9, 0,
|
||||
0, 7, 0, 6, 7, 0, 8, 0, 11, 0,
|
||||
0, 24, 25, 0, 9, 22, 5, 0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -104,9 +106,9 @@ static const short yyrhs[] =
|
|||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
{
|
||||
0, 27, 28, 31, 32, 35, 44, 51, 55, 59,
|
||||
63, 64, 67, 69, 70, 71, 72, 73, 76, 77,
|
||||
78, 79
|
||||
0, 27, 28, 29, 32, 33, 36, 45, 52, 56,
|
||||
60, 64, 68, 69, 72, 74, 75, 76, 77, 78,
|
||||
81, 82, 83, 84, 87, 91, 92, 95
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -117,26 +119,27 @@ static const short yyrline[] =
|
|||
static const char *const yytname[] =
|
||||
{
|
||||
"$", "error", "$undefined.", "OBRACE", "EBRACE", "SEMICOLON", "DASH",
|
||||
"NUMBER", "QUOTES", "WORD", "BINDING", "commands", "command",
|
||||
"action_command", "chain_command", "binding", "obrace", "ebrace",
|
||||
"binding_w_modifier", "bind_key", "parameter", 0
|
||||
"NUMBER", "QUOTES", "WORD", "BINDING", "OPTIONS", "commands", "command",
|
||||
"action_command", "chain_command", "options_block", "binding", "obrace",
|
||||
"ebrace", "binding_w_modifier", "bind_key", "parameter",
|
||||
"options_keyword", "options", "option", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const short yyr1[] =
|
||||
{
|
||||
0, 11, 11, 12, 12, 13, 14, 15, 16, 17,
|
||||
18, 18, 19, 19, 19, 19, 19, 19, 20, 20,
|
||||
20, 20
|
||||
0, 12, 12, 12, 13, 13, 14, 15, 16, 17,
|
||||
18, 19, 20, 20, 21, 21, 21, 21, 21, 21,
|
||||
22, 22, 22, 22, 23, 24, 24, 25
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
static const short yyr2[] =
|
||||
{
|
||||
0, 0, 2, 1, 1, 4, 4, 2, 1, 1,
|
||||
0, 3, 1, 1, 1, 1, 1, 1, 0, 1,
|
||||
2, 1
|
||||
0, 0, 2, 2, 1, 1, 4, 4, 4, 2,
|
||||
1, 1, 0, 3, 1, 1, 1, 1, 1, 1,
|
||||
0, 1, 2, 1, 1, 0, 2, 3
|
||||
};
|
||||
|
||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||
|
@ -144,46 +147,50 @@ static const short yyr2[] =
|
|||
error. */
|
||||
static const short yydefact[] =
|
||||
{
|
||||
1, 10, 0, 2, 3, 4, 0, 0, 10, 8,
|
||||
18, 1, 12, 13, 15, 14, 16, 17, 7, 11,
|
||||
0, 19, 21, 0, 10, 20, 5, 9, 6, 0,
|
||||
1, 12, 0, 24, 2, 4, 5, 3, 0, 0,
|
||||
0, 12, 10, 20, 1, 14, 15, 17, 16, 18,
|
||||
19, 9, 25, 13, 0, 21, 23, 0, 12, 0,
|
||||
22, 6, 11, 7, 8, 20, 26, 0, 27, 0,
|
||||
0
|
||||
};
|
||||
|
||||
static const short yydefgoto[] =
|
||||
{
|
||||
1, 3, 4, 5, 6, 11, 28, 7, 18, 23
|
||||
1, 4, 5, 6, 7, 8, 14, 33, 9, 21,
|
||||
27, 10, 29, 36
|
||||
};
|
||||
|
||||
static const short yypact[] =
|
||||
{
|
||||
-32768, 0, 5,-32768,-32768,-32768, 3, -2, -1,-32768,
|
||||
9,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
|
||||
6,-32768,-32768, 13, 4,-32768,-32768,-32768,-32768, 19,
|
||||
-32768, 0, -1,-32768,-32768,-32768,-32768,-32768, 14, 9,
|
||||
3, 10,-32768, -4,-32768,-32768,-32768,-32768,-32768,-32768,
|
||||
-32768,-32768,-32768,-32768, 2,-32768,-32768, 16, -3, 15,
|
||||
-32768,-32768,-32768,-32768,-32768, -4,-32768, 17,-32768, 25,
|
||||
-32768
|
||||
};
|
||||
|
||||
static const short yypgoto[] =
|
||||
{
|
||||
10,-32768,-32768,-32768,-32768,-32768,-32768, 12,-32768,-32768
|
||||
12,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 18,-32768,
|
||||
-8,-32768,-32768,-32768
|
||||
};
|
||||
|
||||
|
||||
#define YYLAST 21
|
||||
#define YYLAST 29
|
||||
|
||||
|
||||
static const short yytable[] =
|
||||
{
|
||||
29, 12, 13, 14, 15, 16, 9, 17, 27, 2,
|
||||
2, 8, 10, 25, 2, 20, 21, 22, 26, 30,
|
||||
19, 24
|
||||
39, 32, 24, 25, 26, 11, 22, 2, 3, 30,
|
||||
2, 3, 15, 16, 17, 18, 19, 12, 20, 34,
|
||||
2, 31, 38, 13, 35, 40, 28, 37, 0, 23
|
||||
};
|
||||
|
||||
static const short yycheck[] =
|
||||
{
|
||||
0, 3, 4, 5, 6, 7, 3, 9, 4, 10,
|
||||
10, 6, 9, 7, 10, 6, 7, 8, 5, 0,
|
||||
8, 11
|
||||
0, 4, 6, 7, 8, 6, 3, 10, 11, 7,
|
||||
10, 11, 3, 4, 5, 6, 7, 3, 9, 4,
|
||||
10, 5, 5, 9, 9, 0, 14, 35, -1, 11
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/usr/share/bison/bison.simple"
|
||||
|
@ -254,12 +261,6 @@ static const short yycheck[] =
|
|||
# define YYSTACK_ALLOC malloc
|
||||
# define YYSTACK_FREE free
|
||||
# endif
|
||||
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
|
||||
|
||||
|
||||
#if (! defined (yyoverflow) \
|
||||
&& (! defined (__cplusplus) \
|
||||
|| (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
|
||||
|
||||
/* A type that is properly aligned for any stack member. */
|
||||
union yyalloc
|
||||
|
@ -286,41 +287,24 @@ union yyalloc
|
|||
+ YYSTACK_GAP_MAX)
|
||||
# endif
|
||||
|
||||
/* Copy COUNT objects from FROM to TO. The source and destination do
|
||||
not overlap. */
|
||||
# ifndef YYCOPY
|
||||
# if 1 < __GNUC__
|
||||
# define YYCOPY(To, From, Count) \
|
||||
__builtin_memcpy (To, From, (Count) * sizeof (*(From)))
|
||||
# else
|
||||
# define YYCOPY(To, From, Count) \
|
||||
do \
|
||||
{ \
|
||||
register YYSIZE_T yyi; \
|
||||
for (yyi = 0; yyi < (Count); yyi++) \
|
||||
(To)[yyi] = (From)[yyi]; \
|
||||
} \
|
||||
while (0)
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Relocate STACK from its old location to the new one. The
|
||||
/* Relocate the TYPE STACK from its old location to the new one. The
|
||||
local variables YYSIZE and YYSTACKSIZE give the old and new number of
|
||||
elements in the stack, and YYPTR gives the new location of the
|
||||
stack. Advance YYPTR to a properly aligned location for the next
|
||||
stack. */
|
||||
# define YYSTACK_RELOCATE(Stack) \
|
||||
# define YYSTACK_RELOCATE(Type, Stack) \
|
||||
do \
|
||||
{ \
|
||||
YYSIZE_T yynewbytes; \
|
||||
YYCOPY (&yyptr->Stack, Stack, yysize); \
|
||||
yymemcpy ((char *) yyptr, (char *) (Stack), \
|
||||
yysize * (YYSIZE_T) sizeof (Type)); \
|
||||
Stack = &yyptr->Stack; \
|
||||
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
|
||||
yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
|
||||
yyptr += yynewbytes / sizeof (*yyptr); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
|
||||
|
||||
|
||||
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
|
||||
|
@ -447,6 +431,33 @@ int yydebug;
|
|||
# define YYMAXDEPTH 10000
|
||||
#endif
|
||||
|
||||
#if ! defined (yyoverflow) && ! defined (yymemcpy)
|
||||
# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
|
||||
# define yymemcpy __builtin_memcpy
|
||||
# else /* not GNU C or C++ */
|
||||
|
||||
/* This is the most reliable way to avoid incompatibilities
|
||||
in available built-in functions on various systems. */
|
||||
static void
|
||||
# if defined (__STDC__) || defined (__cplusplus)
|
||||
yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
|
||||
# else
|
||||
yymemcpy (yyto, yyfrom, yycount)
|
||||
char *yyto;
|
||||
const char *yyfrom;
|
||||
YYSIZE_T yycount;
|
||||
# endif
|
||||
{
|
||||
register const char *yyf = yyfrom;
|
||||
register char *yyt = yyto;
|
||||
register YYSIZE_T yyi = yycount;
|
||||
|
||||
while (yyi-- != 0)
|
||||
*yyt++ = *yyf++;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef YYERROR_VERBOSE
|
||||
|
||||
# ifndef yystrlen
|
||||
|
@ -499,7 +510,7 @@ yystpcpy (yydest, yysrc)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#line 315 "/usr/share/bison/bison.simple"
|
||||
#line 319 "/usr/share/bison/bison.simple"
|
||||
|
||||
|
||||
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
|
||||
|
@ -689,9 +700,6 @@ yyparse (YYPARSE_PARAM_ARG)
|
|||
yyvs = yyvs1;
|
||||
}
|
||||
#else /* no yyoverflow */
|
||||
# ifndef YYSTACK_RELOCATE
|
||||
goto yyoverflowlab;
|
||||
# else
|
||||
/* Extend the stack our own way. */
|
||||
if (yystacksize >= YYMAXDEPTH)
|
||||
goto yyoverflowlab;
|
||||
|
@ -705,16 +713,15 @@ yyparse (YYPARSE_PARAM_ARG)
|
|||
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
|
||||
if (! yyptr)
|
||||
goto yyoverflowlab;
|
||||
YYSTACK_RELOCATE (yyss);
|
||||
YYSTACK_RELOCATE (yyvs);
|
||||
YYSTACK_RELOCATE (short, yyss);
|
||||
YYSTACK_RELOCATE (YYSTYPE, yyvs);
|
||||
# if YYLSP_NEEDED
|
||||
YYSTACK_RELOCATE (yyls);
|
||||
YYSTACK_RELOCATE (YYLTYPE, yyls);
|
||||
# endif
|
||||
# undef YYSTACK_RELOCATE
|
||||
if (yyss1 != yyssa)
|
||||
YYSTACK_FREE (yyss1);
|
||||
}
|
||||
# endif
|
||||
#endif /* no yyoverflow */
|
||||
|
||||
yyssp = yyss + yysize - 1;
|
||||
|
@ -892,67 +899,71 @@ yyreduce:
|
|||
|
||||
switch (yyn) {
|
||||
|
||||
case 5:
|
||||
#line 37 "epist.y"
|
||||
case 6:
|
||||
#line 38 "epist.y"
|
||||
{
|
||||
((parser*)parser_obj)->setAction(yyvsp[-2]);
|
||||
((parser*)parser_obj)->endAction();
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
#line 46 "epist.y"
|
||||
;
|
||||
break;}
|
||||
case 7:
|
||||
#line 47 "epist.y"
|
||||
{
|
||||
((parser*)parser_obj)->endChain();
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
#line 56 "epist.y"
|
||||
{ ((parser*)parser_obj)->startChain(); }
|
||||
break;
|
||||
case 9:
|
||||
#line 60 "epist.y"
|
||||
{ /* ((parser*)parser_obj)->endChain(); */ }
|
||||
break;
|
||||
;
|
||||
break;}
|
||||
case 10:
|
||||
#line 61 "epist.y"
|
||||
{ ((parser*)parser_obj)->startChain(); ;
|
||||
break;}
|
||||
case 11:
|
||||
#line 64 "epist.y"
|
||||
{ ((parser*)parser_obj)->addModifier(yyvsp[-2]); }
|
||||
break;
|
||||
case 12:
|
||||
#line 68 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
#line 65 "epist.y"
|
||||
{ /* ((parser*)parser_obj)->endChain(); */ ;
|
||||
break;}
|
||||
case 13:
|
||||
#line 69 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
{ ((parser*)parser_obj)->addModifier(yyvsp[-2]); ;
|
||||
break;}
|
||||
case 14:
|
||||
#line 70 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
case 15:
|
||||
#line 71 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
case 16:
|
||||
#line 72 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
case 17:
|
||||
#line 73 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); }
|
||||
break;
|
||||
case 19:
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 15:
|
||||
#line 74 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 16:
|
||||
#line 75 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 17:
|
||||
#line 76 "epist.y"
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 18:
|
||||
#line 77 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentNum(yyvsp[0]); }
|
||||
break;
|
||||
case 20:
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 19:
|
||||
#line 78 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentNegNum(yyvsp[0]); }
|
||||
break;
|
||||
{ ((parser*)parser_obj)->setKey(yyvsp[0]); ;
|
||||
break;}
|
||||
case 21:
|
||||
#line 79 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentStr(yyvsp[0]); }
|
||||
break;
|
||||
#line 82 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentNum(yyvsp[0]); ;
|
||||
break;}
|
||||
case 22:
|
||||
#line 83 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentNegNum(yyvsp[0]); ;
|
||||
break;}
|
||||
case 23:
|
||||
#line 84 "epist.y"
|
||||
{ ((parser*)parser_obj)->setArgumentStr(yyvsp[0]); ;
|
||||
break;}
|
||||
case 27:
|
||||
#line 97 "epist.y"
|
||||
{ ((parser*)parser_obj)->setOption(yyvsp[-2]); ;
|
||||
break;}
|
||||
}
|
||||
|
||||
#line 705 "/usr/share/bison/bison.simple"
|
||||
|
@ -1186,6 +1197,6 @@ yyreturn:
|
|||
#endif
|
||||
return yyresult;
|
||||
}
|
||||
#line 82 "epist.y"
|
||||
#line 100 "epist.y"
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
# ifndef YYSTYPE
|
||||
# define YYSTYPE int
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# endif
|
||||
# define OBRACE 257
|
||||
# define EBRACE 258
|
||||
|
@ -13,6 +12,7 @@
|
|||
# define QUOTES 262
|
||||
# define WORD 263
|
||||
# define BINDING 264
|
||||
# define OPTIONS 265
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
|
Loading…
Reference in a new issue