goinfre/libs/libevent/tester.c

goinfre/libs/libevent/tester.c

  _____________________________________________________________________________ 
 /   / Index / Goinfre / Resume / Links / Contact / Sitemap /    .: v0.6.1.0 |^|
|\__/-------+         +--------+-------+---------+---------+-----------------+#|
|  1| /goinfre/libs/libevent/tester.c                                        |#|
|  2| ==========================================                             |#|
|  3|                                                                        |#|
|  4|                                                   [ raw ] [ download ] |#|
|  5|                                             ` `` ````````````````````` |#|
|  6|                                                                        |#|
|  7| /**                                                                    |#|
|  8|  * libevent/tester.c                                                   |#|
|  9|  *                                                                     |#|
| 10|  * Copyright (c) Manfred Touron 2008                                   |#|
| 11|  */                                                                    |#|
| 12|                                                                        |#|
| 13| #include <stdarg.h>                                                    |#|
| 14| #include <stdio.h>                                                     |#|
| 15|                                                                        |#|
| 16| #include "libevent.h"                                                  |#|
| 17|                                                                        |#|
| 18| #define TESTER_NEW_CALLBACK(NAME)                        \             |#|
| 19|   CALLBACK(NAME)                                    \                  |#|
| 20|   {                                                \                   |#|
| 21|     printf("[" #NAME "] called (%d)\n", ARGC);                  \      |#|
| 22|     CALLV(printf, 0);                                    \             |#|
| 23|     return (1);                                          \             |#|
| 24|   }                                                \                   |#|
| 25|   int      NAME(void *[])                                              |#|
| 26|                                                                        |#|
| 27| TESTER_NEW_CALLBACK(aaa);                                              |#|
| 28| TESTER_NEW_CALLBACK(bbb);                                              |#|
| 29| TESTER_NEW_CALLBACK(ccc);                                              |#|
| 30| TESTER_NEW_CALLBACK(ddd);                                              |#|
| 31| TESTER_NEW_CALLBACK(eee);                                              |#|
| 32|                                                                        |#|
| 33| CALLBACK(nounours)                                                     |#|
| 34| {                                                                      |#|
| 35|   return (1);                                                          |#|
| 36|   (void)argv;                                                          |#|
| 37| }                                                                      |#|
| 38|                                                                        |#|
| 39| int      main(int ac, char **av)                                       |#|
| 40| {                                                                      |#|
| 41|   printf("[+] init\n");                                                |#|
| 42|   event_add_handler("toto", aaa);                                      |#|
| 43|   event_add_handler("toto2", aaa);                                     |#|
| 44|   event_add_handler("toto", bbb);                                      |#|
| 45|   event_add_handler("toto3", aaa);                                     |#|
| 46|   event_add_handler("toto", ccc);                                      |#|
| 47|   event_add_handler("toto", ddd);                                      | |
| 48|   event_add_handler("toto", aaa);                                      | |
| 49|   event_add_handler("toto", bbb);                                      | |
| 50|   event_add_handler("toto", ccc);                                      | |
| 51|   event_add_handler("toto", ccc);                                      | |
| 52|   event_add_handler("toto", ddd);                                      | |
| 53|   event_del_handler("toto", ccc);                                      | |
| 54|   event_add_handler("toto", ddd);                                      | |
| 55|   event_del_handler("toto2", aaa);                                     | |
| 56|   event_add_handler("toto2", aaa);                                     | |
| 57|   event_add_handler("toto2", aaa);                                     | |
| 58|   event_add_handler("voiture", bbb);                                   | |
| 59|   event_add_handler("voiture", aaa);                                   | |
| 60|   events_debug();                                                      | |
| 61|   EVENT_CALL("toto2", "tata [%s] [%s]\n", "titi", "tutu");             | |
| 62|   EVENT_CALL("toto2", "tata [%s]\n", "titi");                          | |
| 63|   EVENT_CALL("voiture", "blabla : [%s]\n", "bite");                    | |
| 64|   printf("[+] uninit\n");                                              | |
| 65|   return (0);                                                          | |
| 66|   (void)ac;                                                            | |
| 67|   (void)av;                                                            | |
| 68| }                                                                      | |
| 69|                                                                        | |
+---+                                                                        | |
\_   \______ mo5.so - normal - 1337.so - rev.so - video_r.so +---------------+ |
  |__       \_____   plain.so - color.so - comment.so       /  moul 2008 (c) |V|
     \-----\______\________________________________________/-----------------+-+