Index: work/remote/animator/Makefile =================================================================== --- work/remote/animator/Makefile (revision 4706) +++ work/remote/animator/Makefile (revision 4707) @@ -2,6 +2,13 @@ P=/usr/lib CFLAGS = -Wall -g -I$(TRUNK) LDLIBS = $P/libporty_net_async.a $P/libporty_net.a $(TRUNK)/src_plugins/hid_remote/base64.o +SPHASH = $(TRUNK)/src_3rd/sphash/sphash +OBJS= hid_anim.o cmds_hash.o -hid_anim: hid_anim.o - $(CC) $< $(LDLIBS) -o $@ +hid_anim: $(OBJS) + $(CC) $(OBJS) $(LDLIBS) -o $@ + +cmds_hash.c cmds_hash.h: cmds + $(SPHASH) $(SPH_VERBOSE) --prefix cmds --out cmds_hash < cmds + + Index: work/remote/animator/cmds =================================================================== --- work/remote/animator/cmds (nonexistent) +++ work/remote/animator/cmds (revision 4707) @@ -0,0 +1,16 @@ +ver +unit +ready +inval +setly +makeGC +delGC +clr +cap +linwid +setxor +line +rect +fcirc +poly +umask Index: work/remote/animator/hid_anim.c =================================================================== --- work/remote/animator/hid_anim.c (revision 4706) +++ work/remote/animator/hid_anim.c (revision 4707) @@ -4,11 +4,22 @@ #include #include "src_plugins/hid_remote/proto_lowcommon.h" #include "src_plugins/hid_remote/proto_lowparse.h" +#include "cmds_hash.h" static proto_ctx_t pctx; - P_net_socket s_netin, s_netout; +static void cmd_ver(proto_node_t *args) +{ + if ((args->data.l.first_child != NULL) && (!args->data.l.first_child->is_list)) { + int ver = atoi(args->data.l.first_child->data.s.str); + if (ver != 1) { + fprintf(stderr, "protocol version mismatc: ver=%d (expected 1)\n", ver); + exit(1); + } + } +} + static void read_netin(void) { P_size_t len, n; @@ -23,6 +34,10 @@ break; case PRES_GOT_MSG: printf("cmd\n"); + switch(cmds_sphash(pctx.pcmd)) { + case cmds_ver: cmd_ver(pctx.targ); break; + } + proto_node_free(pctx.targ); break; } }