/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
#include <ch.h>
#include <stdio.h>
#include "expvar_c.h"

EXPORTCH void expvar_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;
  int *ii1;
  int **ii2;
  int **aptr;

  printf("The variables in the C space are %d and %d\n", i1, i2);

  Ch_VaStart(interp, ap, varg);
  ii1 = Ch_VaArg(interp, ap, int*);
  *ii1 = i1; /* pass the value to the Ch space */
  ii2 = Ch_VaArg(interp, ap, int**);
  *ii2 = &i2; /* pass the address to the Ch space */
  aptr = Ch_VaArg(interp, ap, int**);
  *aptr = a;    /* pass the address to the Ch space */

  Ch_VaEnd(interp, ap);
  return;
}

EXPORTCH void changeCVar_chdl() {
  i2 = 400; /* change value of C variable */
  printf("The variables in the C space are %d and %d\n", i1, i2);
  a[3] = 300; /* change value of an element of C array*/

  return;
}
