Rename an action to be shorter

Also, fix make dependencies to include the source file for actions.
This commit is contained in:
Přemysl Eric Janouch 2021-11-16 03:33:54 +01:00
parent 32203f8117
commit e66e9f249a
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 6 additions and 5 deletions

View File

@ -91,9 +91,10 @@ configure_file (${PROJECT_SOURCE_DIR}/config.h.in
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR}) include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
# Assuming a Unix-compatible system with a standalone preprocessor # Assuming a Unix-compatible system with a standalone preprocessor
set (actions_list ${PROJECT_SOURCE_DIR}/nncmpp.actions)
set (actions ${PROJECT_BINARY_DIR}/nncmpp-actions.h) set (actions ${PROJECT_BINARY_DIR}/nncmpp-actions.h)
add_custom_command (OUTPUT ${actions} add_custom_command (OUTPUT ${actions}
COMMAND cpp -I${PROJECT_BINARY_DIR} -P ${PROJECT_SOURCE_DIR}/nncmpp.actions COMMAND cpp -I${PROJECT_BINARY_DIR} -P ${actions_list}
| grep . | tr [[\n]] ^ | sed -ne [[h; s/,[^^]*/,/g]] -e [[s/$/COUNT/]] | grep . | tr [[\n]] ^ | sed -ne [[h; s/,[^^]*/,/g]] -e [[s/$/COUNT/]]
-e [[s/[^^]*/\tACTION_&/g]] -e [[s/.*/enum action {\n&\n};\n/p]] -e [[s/[^^]*/\tACTION_&/g]] -e [[s/.*/enum action {\n&\n};\n/p]]
-e [[g; s/,[^^]*//g; y/_/-/]] -e [[s/[^^]\{1,\}/\t"&",/g]] -e [[g; s/,[^^]*//g; y/_/-/]] -e [[s/[^^]\{1,\}/\t"&",/g]]
@ -102,7 +103,7 @@ add_custom_command (OUTPUT ${actions}
-e [[s/.*/static const char *g_action_descriptions[] = {\n&};/p]] -e [[s/.*/static const char *g_action_descriptions[] = {\n&};/p]]
| tr ^ [[\n]] > ${actions} | tr ^ [[\n]] > ${actions}
COMMAND test -s ${actions} COMMAND test -s ${actions}
DEPENDS ${PROJECT_BINARY_DIR}/config.h VERBATIM) DEPENDS ${actions_list} ${PROJECT_BINARY_DIR}/config.h VERBATIM)
# Build the main executable and link it # Build the main executable and link it
add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c ${actions}) add_executable (${PROJECT_NAME} ${PROJECT_NAME}.c ${actions})

View File

@ -15,8 +15,8 @@ MPD_PREVIOUS, Previous song
MPD_NEXT, Next song MPD_NEXT, Next song
MPD_BACKWARD, Seek backwards MPD_BACKWARD, Seek backwards
MPD_FORWARD, Seek forwards MPD_FORWARD, Seek forwards
MPD_VOLUME_UP, Increase volume MPD_VOLUME_UP, Increase MPD volume
MPD_VOLUME_DOWN, Decrease volume MPD_VOLUME_DOWN, Decrease MPD volume
MPD_SEARCH, Global search MPD_SEARCH, Global search
MPD_ADD, Add selection to playlist MPD_ADD, Add selection to playlist
@ -31,7 +31,7 @@ MPD_COMMAND, Send raw command to MPD
#ifdef WITH_PULSE #ifdef WITH_PULSE
PULSE_VOLUME_UP, Increase PulseAudio volume PULSE_VOLUME_UP, Increase PulseAudio volume
PULSE_VOLUME_DOWN, Decrease PulseAudio volume PULSE_VOLUME_DOWN, Decrease PulseAudio volume
PULSE_MUTE, Toggle mute of MPD PulseAudio sink PULSE_MUTE, Toggle PulseAudio sink mute
#endif #endif
CHOOSE, Choose item CHOOSE, Choose item