Remove user defined function feature

After the previous commit there's no need. The only place
they were of use now has builtins for the same purpose.
This commit is contained in:
Mike Small 2021-04-04 00:06:13 -04:00
parent cbc7afb302
commit 39038bddb6
8 changed files with 15 additions and 60 deletions

View File

@ -1,3 +1,13 @@
2021-04-03 Mike Small <smallm@sdf.org>
* src/parse.c (keytable): remove function keyword form parse table
* src/menus.cc (ExecuteFunction): don't look for custom functions to run
* src/gram.y: remove function token and grammar production
* man/twmruined.man: remove mention of user-defined functions
2021-02-15 Mike Small <smallm@sdf.org> 2021-02-15 Mike Small <smallm@sdf.org>
* man/twmruined.man: replace a reference to move-or-lower, * man/twmruined.man: replace a reference to move-or-lower,

3
README
View File

@ -9,7 +9,8 @@ Features removed...
Zoom, MoveDelta Zoom, MoveDelta
2. builtin functions: DeltaStop 2. builtin functions: DeltaStop
3. default user defined functions: move-or-lower, move-or-raise, 3. default user defined functions: move-or-lower, move-or-raise,
and move-or-iconify (changed to builtins). and move-or-iconify (changed to builtins) and the ability to define
user defined functions.
Changes ... Changes ...

View File

@ -46,7 +46,7 @@ twmruined \- No longer quite the Tab Window Manager
.SH DESCRIPTION .SH DESCRIPTION
\fITwmruined\fP is a window manager for the X Window System based on twm. It provides \fITwmruined\fP is a window manager for the X Window System based on twm. It provides
titlebars, shaped windows, titlebars, shaped windows,
several forms of icon management, user-defined macro functions, several forms of icon management,
click-to-type and pointer-driven keyboard focus, and user-specified click-to-type and pointer-driven keyboard focus, and user-specified
key and pointer button bindings. key and pointer button bindings.
.PP .PP
@ -666,19 +666,9 @@ conveniently stored in a titlebar, menu, or set of key bindings. Although
a small set of defaults are supplied (unless the \fBNoDefaults\fP is a small set of defaults are supplied (unless the \fBNoDefaults\fP is
specified), most users will want to have their most common operations specified), most users will want to have their most common operations
bound to key and button strokes. To do this, \fItwmruined\fP associates names bound to key and button strokes. To do this, \fItwmruined\fP associates names
with each of the primitives and provides \fIuser-defined functions\fP for with each of the builtin functions and \fImenus\fP for interactively selecting
building higher level primitives and \fImenus\fP for interactively selecting
among groups of functions. among groups of functions.
.PP .PP
User-defined functions contain the name by which they are referenced in
calls to \fBf.function\fP and a list of other functions to execute. For
example:
.EX 0
Function "restore-colormap" { f.colormap "default" f.lower }
.EE
The function name must be used in \fBf.function\fP exactly as it appears in
the function specification.
.PP
In the descriptions below, if the function is said to operate on the selected In the descriptions below, if the function is said to operate on the selected
window, but is invoked from a root menu, the cursor will be changed to window, but is invoked from a root menu, the cursor will be changed to
the \fBSelect\fP cursor and the next window to receive a button press will the \fBSelect\fP cursor and the next window to receive a button press will

View File

@ -62,7 +62,6 @@ extern int yydebug;
COLOR = 272, COLOR = 272,
SAVECOLOR = 273, SAVECOLOR = 273,
MONOCHROME = 274, MONOCHROME = 274,
FUNCTION = 275,
WINDOW_FUNCTION = 276, WINDOW_FUNCTION = 276,
MAKE_TITLE = 277, MAKE_TITLE = 277,
GRAYSCALE = 278, GRAYSCALE = 278,
@ -122,7 +121,6 @@ extern int yydebug;
#define COLOR 272 #define COLOR 272
#define SAVECOLOR 273 #define SAVECOLOR 273
#define MONOCHROME 274 #define MONOCHROME 274
#define FUNCTION 275
#define WINDOW_FUNCTION 276 #define WINDOW_FUNCTION 276
#define MAKE_TITLE 277 #define MAKE_TITLE 277
#define GRAYSCALE 278 #define GRAYSCALE 278

View File

@ -109,7 +109,7 @@ static void yyerror ( const char *s );
}; };
%token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS %token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS
%token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION %token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME
%token <num> WINDOW_FUNCTION %token <num> WINDOW_FUNCTION
%token <num> MAKE_TITLE GRAYSCALE %token <num> MAKE_TITLE GRAYSCALE
%token <num> NO_TITLE AUTO_RAISE %token <num> NO_TITLE AUTO_RAISE
@ -189,8 +189,6 @@ stmt : error
menu { root->real_menu = TRUE;} menu { root->real_menu = TRUE;}
| MENU string { root = GetRoot($2, NULLSTR, NULLSTR); } | MENU string { root = GetRoot($2, NULLSTR, NULLSTR); }
menu { root->real_menu = TRUE; } menu { root->real_menu = TRUE; }
| FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); }
function
| ICONS { list = &Scr->IconNames; } | ICONS { list = &Scr->IconNames; }
icon_list icon_list
| COLOR { color = COLOR; } | COLOR { color = COLOR; }
@ -453,19 +451,6 @@ icon_entries : /* Empty */
icon_entry : string string { if (Scr->FirstTime) AddToList(list, $1, $2); } icon_entry : string string { if (Scr->FirstTime) AddToList(list, $1, $2); }
; ;
function : LB function_entries RB
;
function_entries: /* Empty */
| function_entries function_entry
;
function_entry : action { AddToMenu(root, "", Action, NULL, $1,
NULLSTR, NULLSTR);
Action = "";
}
;
menu : LB menu_entries RB menu : LB menu_entries RB
; ;

View File

@ -1712,32 +1712,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
break; break;
case F_FUNCTION:
{
MenuRoot *mroot;
MenuItem *mitem;
if ((mroot = FindMenuRoot(action)) == NULL)
{
fprintf (stderr, "%s: couldn't find function \"%s\"\n",
ProgramName, action);
return TRUE;
}
if (NeedToDefer(mroot) && DeferExecution(context, func, Scr->SelectCursor))
return true;
else
{
for (mitem = mroot->first; mitem != NULL; mitem = mitem->next)
{
if (!ExecuteFunction (mitem->func, mitem->action, w,
tmp_win, eventp, context, pulldown))
break;
}
}
}
break;
case F_DEICONIFY: case F_DEICONIFY:
case F_ICONIFY: case F_ICONIFY:
if (DeferExecution(context, func, Scr->SelectCursor)) if (DeferExecution(context, func, Scr->SelectCursor))

View File

@ -405,7 +405,6 @@ static TwmKeyword keytable[] = {
{ "f.focus", FKEYWORD, F_FOCUS }, { "f.focus", FKEYWORD, F_FOCUS },
{ "f.forcemove", FKEYWORD, F_FORCEMOVE }, { "f.forcemove", FKEYWORD, F_FORCEMOVE },
{ "f.fullzoom", FKEYWORD, F_FULLZOOM }, { "f.fullzoom", FKEYWORD, F_FULLZOOM },
{ "f.function", FSKEYWORD, F_FUNCTION },
{ "f.hbzoom", FKEYWORD, F_BOTTOMZOOM }, { "f.hbzoom", FKEYWORD, F_BOTTOMZOOM },
{ "f.horizoom", FKEYWORD, F_HORIZOOM }, { "f.horizoom", FKEYWORD, F_HORIZOOM },
{ "f.htzoom", FKEYWORD, F_TOPZOOM }, { "f.htzoom", FKEYWORD, F_TOPZOOM },
@ -448,7 +447,6 @@ static TwmKeyword keytable[] = {
{ "forceicons", KEYWORD, kw0_ForceIcons }, { "forceicons", KEYWORD, kw0_ForceIcons },
{ "frame", FRAME, 0 }, { "frame", FRAME, 0 },
{ "framepadding", NKEYWORD, kwn_FramePadding }, { "framepadding", NKEYWORD, kwn_FramePadding },
{ "function", FUNCTION, 0 },
{ "grayscale", GRAYSCALE, 0 }, { "grayscale", GRAYSCALE, 0 },
{ "greyscale", GRAYSCALE, 0 }, { "greyscale", GRAYSCALE, 0 },
{ "i", ICON, 0 }, { "i", ICON, 0 },

View File

@ -131,7 +131,6 @@ extern int mods;
#define F_FILE 105 /* string */ #define F_FILE 105 /* string */
#define F_EXEC 106 /* string */ #define F_EXEC 106 /* string */
#define F_CUT 107 /* string */ #define F_CUT 107 /* string */
#define F_FUNCTION 108 /* string */
#define F_WARPTOSCREEN 109 /* string */ #define F_WARPTOSCREEN 109 /* string */
#define F_COLORMAP 110 /* string */ #define F_COLORMAP 110 /* string */
#define F_PRIORITY 111 /* string */ #define F_PRIORITY 111 /* string */