All pastes #935965 Raw Edit

Stuff

public c v1 · immutable
·published 2008-03-10 01:03 UTC
rendered paste body
#include <stdio.h>#include <lwipc.h>/* cheap interning: typedef const * const intern_t; */LWintern_t Mhello = "hello";LWintern_t Mgoodbye = "goodbye";/* this is converted to a more efficient hash table by LW_main_loop */LWtable_t table[] = {    { Mhello, 1, handle_hello },    { Mgoodbye, 0, handle_goodbye }};void handle_hello(char *msg){    printf("hello: got %s\n", msg);}void handle_goodbye(void){    printf("bye!\n");    LW_exit(0);}int main(void){    LWloop_t *loop = LW_init_loop(table);    LW_init_msg(Mhello, 1, "hello from main()");    LW_final_msg(Mgoodbye, 0);    LW_run_loop(loop);    return 0;}