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

void comp_array(double *pa, int n) {
  int i;
  double  *pa_tmp;

  /* take the address of Ch computational array */
  pa_tmp = pa;

  for(i=0; i<n; i++) {
    *pa_tmp = i+1;
     pa_tmp++;
  }
}

EXPORTCH void comp_array_chdl(void *varg) {
  ChInterp_t interp;
  ChVaList_t ap;

  int nn;
  double *pa;

  Ch_VaStart(interp, ap, varg);
  pa  = Ch_VaArg(interp, ap, double *); /* get address of array in Ch space */
  nn = Ch_VaArg(interp, ap, int); /* get 1st arg  */

  comp_array(pa, nn);

  Ch_VaEnd(interp, ap);
}
