From e090f7343634d5f68acf961367ee256d0bf831d7 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 21 Jan 2007 19:51:33 +0100 Subject: [PATCH] move header include info from Makefile.in to *.cmd --- Makefile.in | 32 -------------------- audiod.cmd | 7 +++++ command_util.sh | 68 +++++++++++++++++++++++++++++++++++++++++-- mysql_selector.cmd | 7 +++++ playlist_selector.cmd | 7 +++++ random_selector.cmd | 7 +++++ server.cmd | 7 +++++ 7 files changed, 101 insertions(+), 34 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2a803f3b..bb048808 100644 --- a/Makefile.in +++ b/Makefile.in @@ -149,60 +149,28 @@ grab_client.cmdline.h grab_client.cmdline.c: grab_client.ggo --set-version="$V" < $< server_command_list.c: server.cmd server_command_list.h - echo '#include "server.h"' > $@ - echo '#include "user_list.h"' >> $@ - echo '#include "server_command_list.h"' >> $@ - echo 'struct server_command cmd_struct[] = {' >>$@ ./command_util.sh array < $< >>$@ - echo '{.name = NULL}};' >> $@ server_command_list.h: server.cmd - echo 'extern struct server_command cmd_struct[];' > $@ ./command_util.sh proto < $< >> $@ mysql_selector_command_list.c: mysql_selector.cmd mysql_selector_command_list.h - echo '#include "server.h"' > $@ - echo '#include "user_list.h"' >> $@ - echo '#include "mysql_selector_command_list.h"' >> $@ - echo 'struct server_command cmds[] = {' >>$@ ./command_util.sh array < $< >>$@ - echo '{.name = NULL}};' >> $@ mysql_selector_command_list.h: mysql_selector.cmd - echo 'extern struct server_command cmds[];' > $@ ./command_util.sh proto < $< >> $@ random_selector_command_list.c: random_selector.cmd random_selector_command_list.h - echo '#include "server.h"' > $@ - echo '#include "user_list.h"' >> $@ - echo '#include "random_selector_command_list.h"' >> $@ - echo 'struct server_command random_selector_cmds[] = {' >>$@ ./command_util.sh array < $< >>$@ - echo '{.name = NULL}};' >> $@ random_selector_command_list.h: random_selector.cmd - echo 'extern struct server_command random_selector_cmds[];' > $@ ./command_util.sh proto < $< >> $@ playlist_selector_command_list.c: playlist_selector.cmd playlist_selector_command_list.h - echo '#include "server.h"' > $@ - echo '#include "user_list.h"' >> $@ - echo '#include "playlist_selector_command_list.h"' >> $@ - echo 'struct server_command playlist_selector_cmds[] = {' >>$@ ./command_util.sh array < $< >>$@ - echo '{.name = NULL}};' >> $@ playlist_selector_command_list.h: playlist_selector.cmd - echo 'extern struct server_command playlist_selector_cmds[];' > $@ ./command_util.sh proto < $< >> $@ audiod_command_list.c: audiod.cmd audiod_command_list.h - echo '#include "list.h"' > $@ - echo '#include "para.h"' >> $@ - echo '#include "sched.h"' >> $@ - echo '#include "audiod.h"' >> $@ - echo '#include "audiod_command_list.h"' >> $@ - echo 'struct audiod_command cmds[] = {' >>$@ ./command_util.sh array < $< >>$@ - echo '{.name = NULL}};' >> $@ audiod_command_list.h: audiod.cmd - echo 'extern struct audiod_command cmds[];' > $@ ./command_util.sh proto < $< >> $@ ortp_recv.o: ortp_recv.c diff --git a/audiod.cmd b/audiod.cmd index a5f9efdb..4b03b91c 100644 --- a/audiod.cmd +++ b/audiod.cmd @@ -1,3 +1,10 @@ +FN: audiod_command_list +HC: prototypes for the audiod command handlers +CC: array of audiod commands +AT: audiod_command +AN: cmds +IN: list para sched audiod +--- N: cycle D: switch to next mode S: cycle diff --git a/command_util.sh b/command_util.sh index ea952e5b..b757b2e0 100755 --- a/command_util.sh +++ b/command_util.sh @@ -20,6 +20,46 @@ dump_array_member() echo '},' } +read_header() +{ + local key value i + + while read key value; do + case "$key" in + ---) + break + ;; + HC:) + header_comment="$value" + ;; + CC:) + c_file_comment="$value" + ;; + FN:) + file_name="$value" + ;; + AT:) + array_type="$value" + ;; + AN:) + array_name="$value" + ;; + IN:) + for i in $value; do + includes="$includes +#include \"$i.h\"" + done + includes="$includes +#include \"$file_name.h\"" + ;; + esac + done + if test -z "$header_comment" -o -z "$c_file_comment" \ + -o -z "$file_name"; then + echo "header error" 1&>2 + exit 1 + fi +} read_one_command() { @@ -140,6 +180,9 @@ com_man() com_array() { + echo "/** \file $file_name.c $c_file_comment */" + echo "$includes" + echo "struct $array_type $array_name[] = {" while : ; do read_one_command if test $ret -lt 0; then @@ -150,19 +193,39 @@ com_array() fi dump_array_member done + echo '{.name = NULL}};' } dump_proto() { + echo '/**' + echo " * $desc_txt" + echo ' *' + echo ' * \param fd the file descriptor to send output to' + if test $line_handler -eq 0; then + echo ' * \param argc the number of arguments' + echo ' * \param argv the argument vector' + else + echo ' * \param cmdline the full command line' + fi + echo ' * ' + echo " * synopsis: $syn_txt" + echo ' * ' + echo "$help_txt" | sed -e 's/^/ * /g' + echo ' */' if test $line_handler -eq 0; then - echo "int com_$name_txt(int, int, char **);" + echo "int com_$name_txt(int fd, int argc, char **argv);" else - echo "int com_$name_txt(int, char *);" + echo "int com_$name_txt(int fd, char *cmdline);" fi + echo } com_proto() { + echo "/** \file $file_name.h $header_comment */" + echo + echo "extern struct $array_type $array_name[];" while : ; do read_one_command if test $ret -lt 0; then @@ -175,6 +238,7 @@ com_proto() done } +read_header arg="$1" shift case "$arg" in diff --git a/mysql_selector.cmd b/mysql_selector.cmd index 84297d54..9cee6b5d 100644 --- a/mysql_selector.cmd +++ b/mysql_selector.cmd @@ -1,3 +1,10 @@ +FN: mysql_selector_command_list +HC: prototypes for the commands of the mysql audio file selector +CC: array of commands for the mysql audio file selector +AT: server_command +AN: cmds +IN: server user_list +--- N: cam P: DB_READ | DB_WRITE D: copy all metadata diff --git a/playlist_selector.cmd b/playlist_selector.cmd index 9f073a51..f7253810 100644 --- a/playlist_selector.cmd +++ b/playlist_selector.cmd @@ -1,3 +1,10 @@ +FN: playlist_selector_command_list +HC: prototypes for the commands of the playlist audio file selector +CC: array of commands for the playlist audio file selector +AT: server_command +AN: playlist_selector_cmds +IN: server user_list +--- N: ppl P: DB_READ D: print playlist diff --git a/random_selector.cmd b/random_selector.cmd index 929c7eea..21dc1438 100644 --- a/random_selector.cmd +++ b/random_selector.cmd @@ -1,3 +1,10 @@ +FN: random_selector_command_list +HC: prototypes for the commands of the random audio file selector +CC: array of commands for the random audio file selector +AT: server_command +AN: random_selector_cmds +IN: server user_list +--- N: random_info P: 0 D: about the random audio file selector diff --git a/server.cmd b/server.cmd index a7a1fb59..3812088e 100644 --- a/server.cmd +++ b/server.cmd @@ -1,3 +1,10 @@ +FN: server_command_list +HC: prototypes for the server command handlers +CC: array of server commands +AT: server_command +AN: cmd_struct +IN: server user_list +--- N: chs P: DB_READ | DB_WRITE D: change the current audio file selector -- 2.39.5