From: ian Date: Fri, 3 Jun 2005 23:13:54 +0000 (+0000) Subject: old-style proto-parse thing, checkin before delete X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=ab3ea884a4f14a79e8160e7b6b366cd8454dd1b4;p=trains.git old-style proto-parse thing, checkin before delete --- diff --git a/hostside/pic-proto.c b/hostside/pic-proto.c new file mode 100644 index 0000000..0548662 --- /dev/null +++ b/hostside/pic-proto.c @@ -0,0 +1,61 @@ +/* + * arranges for the declarations of + * enco_pic_WHATEVER + * onrecv_pic_WHATEVER + * and the tables + */ + +#ifndef PROTOCOL_H +#define PROTOCOL_H + +#define HOST2PIC_0(n,o,a) HOST2PIC_1(n,o,a) +#define PIC2HOST_0(n,o,a) PIC2HOST_1(n,o,a) + +#if 0 +static void pe(PicInsn *out, ); +#define EP(objnum) { ep(out,o,a,objnum); } +#define HOST2PIC_0(n,o,a) void enco_pic_##n(PicInsn *out) EP(0) +#define HOST2PIC_1(n,o,a) void enco_pic_##n(PicInsn *out, int oj) EP(oj) +#define PIC2HOST_0(n,o,a) /**/ +#define PIC2HOST_1(n,o,a) /**/ +#include "proto-spec.h" +#undef HOST2PIC_0 +#undef HOST2PIC_1 +#undef PIC2HOST_0 +#undef PIC2HOST_1 +#endif + +extern void enco_pic_polarity_begin(PicInsn *out); +extern void enco_pic_polarity_setbit(PicInsn *out, int objnum); +extern void on_pic_debug(int ch); + +const PicInsnInfo pic_command_infos[]= { +#define HOST2PIC_1(n,o,a) { #n, o, a }, +#define PIC2HOST_1(n,o,a) /**/ +#undef PIC2HOST_1 +#include "proto-spec.h" +#undef HOST2PIC_1 +#undef PIC2HOST_1 +}; + +const PicInsnInfo pic_reply_infos[]= { +#define HOST2PIC_1(n,o,a) /**/ +#define PIC2HOST_1(n,o,a) { #n, o, a }, +#undef PIC2HOST_1 +#include "proto-spec.h" +#undef HOST2PIC_1 +#undef PIC2HOST_1 +}; + + +#undef HOST2PIC_1 +#undef HOST2PIC_0 + +static void pe(PicInsn *out, ); +#define EP(objnum) { ep(out,o,a,objnum); } +#define PIC2HOST_0(n,o,a) /**/ +#define PIC2HOST_1(n,o,a) /**/ +#include "proto-spec.h" +#undef PIC2HOST_0 + +#endif /*NMRA_H*/ diff --git a/hostside/pic-proto.h b/hostside/pic-proto.h index ed9252a..4774257 100644 --- a/hostside/pic-proto.h +++ b/hostside/pic-proto.h @@ -5,8 +5,8 @@ * and the tables */ -#ifndef PROTOCOL_H -#define PROTOCOL_H +#ifndef PIC_PROTO_H +#define PIC_PROTO_H #define HOST2PIC_0(n,o,a) extern void enco_pic_##n(PicInsn *out); #define HOST2PIC_1(n,o,a) extern void enco_pic_##n(PicInsn *out, int objnum); @@ -29,4 +29,6 @@ struct PicInsnInfo { int argbits; }; -#endif /*NMRA_H*/ +extern const PicInsnInfo pic_command_infos[], pic_reply_infos[]; + +#endif /*PIC_PROTO_H*/