diff options
author | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 14:18:25 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@sun.com> | 2009-08-12 16:44:40 -0700 |
commit | 3199c6fb39f02b36a07ef65bf4b07d6ec340944d (patch) | |
tree | 59613bdf195e6f0490f672badd881372f2de9ac9 /decode_lbx.c | |
parent | fccbbd6f3bdc090d2da9b32fdff2fd13679e2b78 (diff) | |
download | xscope-3199c6fb39f02b36a07ef65bf4b07d6ec340944d.tar.gz |
Convert extension decoding to function pointer tables
Each extension now registers it's own request, reply, event & error decoding
functions as needed in the central table, instead of a cascading block of
if/else statements to modify for each new extension added.
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'decode_lbx.c')
-rw-r--r-- | decode_lbx.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/decode_lbx.c b/decode_lbx.c index dd74657..90b9fd1 100644 --- a/decode_lbx.c +++ b/decode_lbx.c @@ -32,9 +32,10 @@ #include "lbxscope.h" #include "extensions.h" -unsigned char LBXRequest, LBXEvent, LBXError; +static unsigned char LBXRequest, LBXError; +unsigned char LBXEvent; /* exported for DecodeEvent in decode11.c */ -void +static void lbx_decode_req ( FD fd, const unsigned char *buf) @@ -70,7 +71,7 @@ lbx_decode_req ( } } -void +static void lbx_decode_reply ( FD fd, const unsigned char *buf, @@ -85,7 +86,7 @@ lbx_decode_reply ( } } -void +static void lbx_decode_error ( FD fd, const unsigned char *buf) @@ -100,7 +101,7 @@ lbx_decode_error ( } } -void +static void lbx_decode_event ( FD fd, const unsigned char *buf) @@ -149,4 +150,8 @@ InitializeLBX ( p = DefineType(LBXEVENT, ENUMERATED, "LBXEVENT", (PrintProcType) PrintENUMERATED); DefineEValue (p, 0L, "SwitchEvent"); DefineEValue (p, 1L, "CloseEvent"); + + InitializeExtensionDecoder(LBXRequest, lbx_decode_req, lbx_decode_reply); + InitializeExtensionErrorDecoder(LBXError, lbx_decode_error); + InitializeExtensionEventDecoder(LBXEvent, lbx_decode_event); } |