From: ian Date: Tue, 31 May 2005 23:34:08 +0000 (+0000) Subject: generate proto-spec.h and .cvsignore it X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=b171538c955cd26d1f8c2bf069bcc7e4f7e7ed4c;p=trains.git generate proto-spec.h and .cvsignore it --- diff --git a/hostside/.cvsignore b/hostside/.cvsignore index d8fc992..753b816 100644 --- a/hostside/.cvsignore +++ b/hostside/.cvsignore @@ -4,3 +4,4 @@ safety t layoutinfo.h *.d +proto-spec.h diff --git a/hostside/Makefile b/hostside/Makefile index 45f17d7..7fbe9dc 100644 --- a/hostside/Makefile +++ b/hostside/Makefile @@ -14,6 +14,9 @@ hostside: hostside.o serialio.o client.o obc.o commands.o \ nmra.o encode.o retransmit.o output.o -loop $(LINK) +proto-spec.h: ../cebpic/README.protocol ./parse-proto-spec + expand <$< | ./parse-proto-spec $o + layoutinfo.h: ../layout/ours.layout-data.c Makefile sed -e '/^#include/,$$d' $< $o diff --git a/hostside/parse-proto-spec b/hostside/parse-proto-spec index 3b15077..5ee9501 100755 --- a/hostside/parse-proto-spec +++ b/hostside/parse-proto-spec @@ -2,12 +2,16 @@ print("/* autogenerated - do not edit */\n"); +sub begin ($) { + $dname= $_[0]; +} + while (<>) { chomp; if (m/^From host to PIC/) { - $dirn= '>'; $dname= "HOST2PIC"; + $dirn= '>'; begin("HOST2PIC"); } elsif (m/^From PIC to host/) { - $dirn= '<'; $dname= "PIC2HOST"; + $dirn= '<'; begin("PIC2HOST"); } elsif (m/^\S/) { $dirn= undef; } @@ -46,8 +50,8 @@ while (<>) { $ybit= oct("0b$ybit"); } for $yval ($ybit ? (0,1) : '') { - printf("%s( %-12s 0x%02x, %2d )\n", - $dname, + printf("%s_%d( %-12s 0x%02x, %2d )\n", + $dname, !!$arglen, sprintf("%s%s,",$cname, $yval), oct("0b$opcode") | $ybit *$yval, $arglen)