chiark / gitweb /
can send pic things
[trains.git] / hostside / skelproto-pic.c
1 /* @skeleton@ @1@ @L@ */
2 /*
3  * arranges for the declarations of
4  *  enco_pic_WHATEVER
5  *  onrecv_pic_WHATEVER
6  * and the tables
7  */
8
9 #include "hostside.h"
10 #include "auproto-pic.h"
11
12 extern void enco_pic_anyinsn(PicInsn *out, const PicInsnInfo *pii,
13                              int objnum) {
14   unsigned long as= objnum;
15   int i;
16
17   out->l= 1 + pii->argbits/7;
18   for (i= out->l - 1;
19        i >= 0;
20        i--, as >>= 7)
21     out->d[i]= (as & 0x07fUL) | 0x080UL;
22   out->d[out->l - 1] &= ~0x080UL;
23   out->d[0] |= pii->opcode;
24 }
25
26 const PicInsnInfo pic_command_infos[]= {
27   { "@cnameyn@", @opcodeyn@, @arglen@ }, @h2p@
28   { 0 }
29 };
30
31 const PicInsnInfo pic_reply_infos[]= {
32   { "@cnameyn@", @opcodeyn@, @arglen@ }, @p2h@
33   { 0 }
34 };