chiark / gitweb /
generate proto-spec.h and .cvsignore it
authorian <ian>
Tue, 31 May 2005 23:34:08 +0000 (23:34 +0000)
committerian <ian>
Tue, 31 May 2005 23:34:08 +0000 (23:34 +0000)
hostside/.cvsignore
hostside/Makefile
hostside/parse-proto-spec

index d8fc9926f99c88d241514379a70740c16ce13efd..753b8168e94b02c101e2918fddb6563834f8eefa 100644 (file)
@@ -4,3 +4,4 @@ safety
 t
 layoutinfo.h
 *.d
+proto-spec.h
index 45f17d73fdb60706e349bdcc8177de1e1e51a333..7fbe9dcad9bd0ff5d6817246aab6d97651eebf60 100644 (file)
@@ -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
 
index 3b1507737da815efd804217b1943d1805828b725..5ee9501a56c5e3909b2e3b214ecaa2dc9c4457fd 100755 (executable)
@@ -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)