chiark / gitweb /
Merge and end branch-hostside-wip-2008-01-25 PROPERLY; cvs up -j branch-hostside...
[trains.git] / hostside / skelproto-pic.h
1 /* @skeleton@ @1@ @L@ */
2 /*
3  * arranges for the declarations of
4  *  enco_pic_WHATEVER
5  *  on_pic_WHATEVER
6  * and the tables
7  * and related functions
8  */
9
10 #ifndef AUPROTO_PIC_H
11 #define AUPROTO_PIC_H
12
13 typedef struct PicInsnInfo PicInsnInfo;
14 typedef void PicInputFn(const PicInsnInfo *pii, const PicInsn *pi, int objnum);
15
16 void enco_pic_@cnameyn@(PicInsn *out);            @h2p@ @arglentf=0@
17 void enco_pic_@cnameyn@(PicInsn *out, int objum); @h2p@ @arglentf=1@
18 PicInputFn on_pic_@cnameyn@;                    @p2h@
19 #define PICMSG_@cnameynu@       @opcodeyn@
20 #define PICMSG_@cnameynu@_M     @opcodemaskyn@
21 #define PICMSG_@cnameynu@_P(v)  (((v) & @opcodemaskyn@) == @opcodeyn@)
22
23 extern void enco_pic_polarity_begin(PicInsn *out);
24 extern void enco_pic_polarity_setbit(PicInsn *out, int objnum);
25
26 extern void enco_pic_pii(PicInsn *out, const PicInsnInfo *pii, int objnum);
27 extern void enco_pic_any(PicInsn *out, int opcode, int argbits, int objnum);
28
29 const PicInsnInfo *lookup_byopcode(Byte byte0, const PicInsnInfo *table);
30 void picinsn_decode(const PicInsn *pi, const PicInsnInfo *table,
31                     const PicInsnInfo **pii_r, int *objnum_r);
32 void oopicio(const char *dirn, const PicInsnInfo *pii, int objnum);
33
34 struct PicInsnInfo {
35   const char *name;
36   Byte opcode, mask;
37   int argbits, noiselevel;
38   PicInputFn *input_fn;
39 };
40
41 extern const PicInsnInfo pic_command_infos[], pic_reply_infos[];
42
43 #endif /*AUPROTO_PIC_H*/