/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
#include "ptfun6.h"

int setHandle(int i, funcHandle funptr, void *usrMsg);
void callFun(int i);

int fun1(void *usrMsg) {
  printf("in function1() usrMsg is \"%s\"\n", usrMsg);
  return 0;
}

int fun2(void *usrMsg) {
  printf("in function2() usrMsg is \"%s\"\n", usrMsg);
  return 0;
}


int main() {
  int id;
  int retval;

  /* set function handle */
  setHandle(1, fun1, "This is event 1");
  setHandle(2, fun2, "This is event 2");

  /* id1 -> fun: 1, msg: "This is event 1") */ 
  /* id2 -> fun: 2, msg: "This is event 2") */ 
  callFun(1);
  callFun(2);

  printf("\n\n");

  setHandle(1, fun1, "This is event 2");
  setHandle(2, fun1, "This is event 2");

  /* id1 -> fun: 1, msg: "This is event 1") */ 
  /* id2 -> fun: 1, msg: "This is event 2") */ 
  callFun(1);
  callFun(2);

  return 0;
}
