From 135c4182759b53587fc415dc037deffc285655f6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 15 Jan 2008 16:52:30 +0100 Subject: [PATCH] auto generate uicb list --- Makefile.am | 7 +++++++ structs.h | 2 +- uicb.c | 51 +-------------------------------------------------- uicbgen.sh | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 51 deletions(-) create mode 100755 uicbgen.sh diff --git a/Makefile.am b/Makefile.am index 0e4f05cf..bd569ec5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,6 +61,13 @@ defconfig.h: awesomerc @$(SED) 's,\\,\\\\,g;s/$$/ \\/;s/"/\\"/g' "awesomerc" >> defconfig.h @echo "\"" >> defconfig.h +CLEANFILES += uicbgen.h +BUILT_SOURCES += uicbgen.h +EXTRA_DIST += uicbgen.sh +uicbgen.h: $(awesome_SOURCES) + @echo "generating uicbgen.h from headers file" + @$(top_srcdir)/uicbgen.sh > $(top_srcdir)/uicbgen.h + if USING_GCC # If you are using gcc, and want to deactivate this default set of # compile flags, run make with AWESOME_CFLAGS="". diff --git a/structs.h b/structs.h index 0bea4f80..2dbf0287 100644 --- a/structs.h +++ b/structs.h @@ -277,7 +277,7 @@ typedef struct /** Status bar */ Statusbar *statusbar; /** Padding */ - Padding padding; + Padding padding; /** Font */ XftFont *font; } VirtScreen; diff --git a/uicb.c b/uicb.c index b544aeac..46650b7a 100644 --- a/uicb.c +++ b/uicb.c @@ -33,56 +33,7 @@ extern AwesomeConf globalconf; -const name_func_link_t UicbList[] = -{ - /* xutil.c */ - {"spawn", uicb_spawn}, - {"exec", uicb_exec}, - /* client.c */ - {"client_kill", uicb_client_kill}, - {"client_moveresize", uicb_client_moveresize}, - {"client_settrans", uicb_client_settrans}, - {"client_swapnext", uicb_client_swapnext}, - {"client_swapprev", uicb_client_swapprev}, - /* tag.c */ - {"client_tag", uicb_client_tag}, - {"client_togglefloating", uicb_client_togglefloating}, - {"tag_toggleview", uicb_tag_toggleview}, - {"client_toggletag", uicb_client_toggletag}, - {"tag_view", uicb_tag_view}, - {"tag_viewprev_selected", uicb_tag_prev_selected}, - {"tag_viewprev", uicb_tag_viewprev}, - {"tag_viewnext", uicb_tag_viewnext}, - {"tag_create", uicb_tag_create}, - /* layout.c */ - {"tag_setlayout", uicb_tag_setlayout}, - {"client_focusnext", uicb_client_focusnext}, - {"client_focusprev", uicb_client_focusprev}, - {"client_togglemax", uicb_client_togglemax}, - {"client_toggleverticalmax", uicb_client_toggleverticalmax}, - {"client_togglehorizontalmax", uicb_client_togglehorizontalmax}, - {"client_zoom", uicb_client_zoom}, - /* layouts/tile.c */ - {"tag_setmwfact", uicb_tag_setmwfact}, - {"tag_setnmaster", uicb_tag_setnmaster}, - {"tag_setncol", uicb_tag_setncol}, - /* screen.c */ - {"screen_focus", uicb_screen_focus}, - {"client_movetoscreen", uicb_client_movetoscreen}, - /* awesome.c */ - {"quit", uicb_quit}, - /* statusbar.c */ - {"statusbar_toggle", uicb_statusbar_toggle}, - /* mouse.c */ - {"client_movemouse", uicb_client_movemouse}, - {"client_resizemouse", uicb_client_resizemouse}, - /* focus.c */ - {"focus_history", uicb_focus_history}, - {"focus_client_byname", uicb_focus_client_byname}, - /* widgets.c */ - {"widget_tell", uicb_widget_tell}, - {NULL, NULL} -}; +#include "uicbgen.h" static int run_uicb(char *cmd) diff --git a/uicbgen.sh b/uicbgen.sh new file mode 100755 index 00000000..e731e2c3 --- /dev/null +++ b/uicbgen.sh @@ -0,0 +1,17 @@ +#!/bin/sh +echo "/* This file is autogenerated by" $(basename $0) "*/" +echo +echo "const name_func_link_t UicbList[] =" +echo "{" +for file in *.h layouts/*.h +do + echo " /* $file */" + grep '^Uicb uicb_' $file | cut -d' ' -f2 | cut -d\; -f1 | while read uicb + do + shortname=$(echo $uicb | cut -d _ -f2-) + echo " {\"$shortname\", $uicb}," + done +done + +echo " {NULL, NULL}" +echo "};"