From 756216b21c2317e8ec8d0dfbb2cd2736a845893a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kn=C3=BCttel?= Date: Wed, 26 Sep 2018 17:47:22 +0200 Subject: [PATCH] moved method_dispatcher to subdirectory --- .../method_dispatcher.c | 0 .../method_dispatcher.h | 0 .../{ => method_dispatcher}/test/Makefile | 0 .../test/test_method_dispatcher.c | 51 ++++++++++++++++++ interpreter/test/method_dispatcher | Bin 13296 -> 0 bytes interpreter/test/test_method_dispatcher.c | 51 ------------------ 6 files changed, 51 insertions(+), 51 deletions(-) rename interpreter/{ => method_dispatcher}/method_dispatcher.c (100%) rename interpreter/{ => method_dispatcher}/method_dispatcher.h (100%) rename interpreter/{ => method_dispatcher}/test/Makefile (100%) create mode 100644 interpreter/method_dispatcher/test/test_method_dispatcher.c delete mode 100755 interpreter/test/method_dispatcher delete mode 100644 interpreter/test/test_method_dispatcher.c diff --git a/interpreter/method_dispatcher.c b/interpreter/method_dispatcher/method_dispatcher.c similarity index 100% rename from interpreter/method_dispatcher.c rename to interpreter/method_dispatcher/method_dispatcher.c diff --git a/interpreter/method_dispatcher.h b/interpreter/method_dispatcher/method_dispatcher.h similarity index 100% rename from interpreter/method_dispatcher.h rename to interpreter/method_dispatcher/method_dispatcher.h diff --git a/interpreter/test/Makefile b/interpreter/method_dispatcher/test/Makefile similarity index 100% rename from interpreter/test/Makefile rename to interpreter/method_dispatcher/test/Makefile diff --git a/interpreter/method_dispatcher/test/test_method_dispatcher.c b/interpreter/method_dispatcher/test/test_method_dispatcher.c new file mode 100644 index 0000000..ae1fff0 --- /dev/null +++ b/interpreter/method_dispatcher/test/test_method_dispatcher.c @@ -0,0 +1,51 @@ +#include +#include "../method_dispatcher.h" + +char m1(uint8_t small_arg, void * state); +char m2(uint8_t small_arg, void * state); +char m3(uint8_t small_arg, void * state); +char m4(uint8_t small_arg, void * state); +char m5(uint8_t small_arg, void * state); + +int main(void) +{ + printf("sizeof struct dispatch_tree_node_s: %zd\n", sizeof(struct dispatch_tree_node_s)); + dispatch_tree_t tree = dispatch_tree_t_new(); + + dispatch_tree_t_insert(tree, 3 << 6, m3); + dispatch_tree_t_insert(tree, 2 << 6, m2); + dispatch_tree_t_insert(tree, 1 << 6, m1); + dispatch_tree_t_insert(tree, 4 << 6, m4); + dispatch_tree_t_insert(tree, 5 << 6, m5); + + int i; + for(i = 1; i < 6; i++) + { + dispatch_tree_t_dispatch(tree, i << 6)(i, NULL); + } + dispatch_tree_t_del(tree); + return 0; +} + + + +char m1(uint8_t small_arg, void * state) +{ + printf("m1: %d\n", small_arg); +} +char m2(uint8_t small_arg, void * state) +{ + printf("m2: %d\n", small_arg); +} +char m3(uint8_t small_arg, void * state) +{ + printf("m3: %d\n", small_arg); +} +char m4(uint8_t small_arg, void * state) +{ + printf("m4: %d\n", small_arg); +} +char m5(uint8_t small_arg, void * state) +{ + printf("m5: %d\n", small_arg); +} diff --git a/interpreter/test/method_dispatcher b/interpreter/test/method_dispatcher deleted file mode 100755 index 722927d6859dc0ce1721b8f7d972da01e209cc89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13296 zcmeHOdvH|M89$pP5MG-FMFT##gD^%hYr@NbBD+ZzZfJlAMB7ogY_c1&HoKeIy$gYg z%}k2A##o$jrcTE)IBFmM(Xsv^(6Ky92ei}9#QGRIwQX9FSw!1ZEsYh~{=Re1x4C<> zQR+XP>Etjs-}!#u<9z2k=bpXi-ov+pO{+^>F2Thu?i9p%Ct8SK394^V6%fCu6_fFI zuDD*1TB*b=x!)p?T4h+dW?H6jH|PXhwIvqdq}M7vrW_$rYHzIaNx3CqDugBhvZGi} zUnf~mO;(t8s5rV5WjkWYZb;b;DLbZvDln$pKk6G@o0UH&ZGemlQ_`i<{GJ)6`p`7V zj-pRmuwcq|cfn2#nbP=T;#J~}s=cxDQmNu+s=6y~?TofATXJh>xT-T6Pj^>!*DkAC zw#1i8_!h~2lYi1(v%W>P#Cg=fQOsB3qB%hFPal4G*~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yj!*Tn(&tS^&^W!`3C)w?KRA|X(`$MY2bVw=EV?Ro!sH!#{e zvOVuxm_7%Yy^s%k*$RgCsBF*s8>YNp=J;8U={I3ddtTpF)vcG2?_Pjr2svZ|uU5-_r zLFFgPK0kiyxs0FZVs>TJo$>$7VbA+brj#FhapwOhgp@ySpZBFqJ6WKdINN^>IG%>( zJwz(}UhDLA#Ep)Z?U}v>9oqWv`y1Zp4qm4HUtmk|vpw%8vtMEl6IssUFAXu<^S+t? zf5IR+N8xF}ar69p3Nm~9yuTipE6qf;Me={yp6TBm_W6CdW|@4M{jkHH_Zij7p5wH< zjUJCn5Kt`Ke|}E(D|?QU?NvIM6>b28Ipbves=TIEVS77uOfjk0rCItfs(l0vC$+)x o&{{-=?k|pA0_u-eX;n%bLT;CJXQ1Lxk)nAEEsbdo0|zVq14&VJwEzGB diff --git a/interpreter/test/test_method_dispatcher.c b/interpreter/test/test_method_dispatcher.c deleted file mode 100644 index 563d888..0000000 --- a/interpreter/test/test_method_dispatcher.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include "../method_dispatcher.h" - -char m1(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_reg, uint16_t * reg[10], bci_stack_t * stack); -char m2(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_reg, uint16_t * reg[10], bci_stack_t * stack); -char m3(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_reg, uint16_t * reg[10], bci_stack_t * stack); -char m4(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_reg, uint16_t * reg[10], bci_stack_t * stack); -char m5(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_reg, uint16_t * reg[10], bci_stack_t * stack); - -int main(void) -{ - printf("sizeof struct dispatch_tree_node_s: %zd\n", sizeof(struct dispatch_tree_node_s)); - dispatch_tree_t tree = dispatch_tree_t_new(); - - dispatch_tree_t_insert(tree, 3 << 6, m3); - dispatch_tree_t_insert(tree, 2 << 6, m2); - dispatch_tree_t_insert(tree, 1 << 6, m1); - dispatch_tree_t_insert(tree, 4 << 6, m4); - dispatch_tree_t_insert(tree, 5 << 6, m5); - - int i; - for(i = 1; i < 6; i++) - { - dispatch_tree_t_dispatch(tree, i << 6)(i, i << 6, NULL, NULL, NULL, NULL); - } - dispatch_tree_t_del(tree); - return 0; -} - - - -char m1(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_register, uint16_t * reg[10], bci_stack_t * stack) -{ - printf("m1: %d, %d\n", small_arg, arg); -} -char m2(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_register, uint16_t * reg[10], bci_stack_t * stack) -{ - printf("m2: %d, %d\n", small_arg, arg); -} -char m3(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_register, uint16_t * reg[10], bci_stack_t * stack) -{ - printf("m3: %d, %d\n", small_arg, arg); -} -char m4(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_register, uint16_t * reg[10], bci_stack_t * stack) -{ - printf("m4: %d, %d\n", small_arg, arg); -} -char m5(uint8_t small_arg, uint16_t arg, uint16_t * s_reg, uint16_t * shutdown_register, uint16_t * reg[10], bci_stack_t * stack) -{ - printf("m5: %d, %d\n", small_arg, arg); -}