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

int ptfun4_1(float f, int j) {
  printf("f in ptfun4_1() in ptfun4.ch  = %f\n", f);
  printf("j in ptfun4_1() in ptfun4.ch  = %d\n", j);
  printf("ptfun4_1() in ptfun4.ch is called \n");
  return 10;
}

int ptfun4_2(float f, int j) {
  printf("f in ptfun4_2() in ptfun4.ch  = %f\n", f);
  printf("j in ptfun4_2() in ptfun4.ch  = %d\n", j);
  printf("ptfun4_2() in ptfun4.ch is called \n");
  return 20;
}

int main() {
  int id;
  funcHandle handle;

  /* set function handle */
  ptfun4_setHandle(1, ptfun4_1);
  ptfun4_setHandle(2, ptfun4_2);

  /* get function handle */
  handle = ptfun4_getHandle(1); 
  printf("retval of id1 = %d\n", handle(1.1, 1));
  handle = ptfun4_getHandle(2); 
  printf("retval of id2 = %d\n", handle(2.2, 2));

  ptfun4_setHandle(2, ptfun4_1);
  printf("retval of id2 = %d\n", ptfun4_getHandle(2)(1.1, 1));

  return 0;
}
