move header include info from Makefile.in to *.cmd
authorAndre <maan@meins.(none)>
Sun, 21 Jan 2007 18:51:33 +0000 (19:51 +0100)
committerAndre <maan@meins.(none)>
Sun, 21 Jan 2007 18:51:33 +0000 (19:51 +0100)
Makefile.in
audiod.cmd
command_util.sh
mysql_selector.cmd
playlist_selector.cmd
random_selector.cmd
server.cmd

index 2a803f3..bb04880 100644 (file)
@@ -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
index a5f9efd..4b03b91 100644 (file)
@@ -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
index ea952e5..b757b2e 100755 (executable)
@@ -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
index 84297d5..9cee6b5 100644 (file)
@@ -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
index 9f073a5..f725381 100644 (file)
@@ -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
index 929c7ee..21dc143 100644 (file)
@@ -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
index a7a1fb5..3812088 100644 (file)
@@ -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