#include <string.h>
#include <stdio.h>
#include <math.h>
#include <ncarg/hlu/App.h>
#include <ncarg/hlu/NcgmWorkstation.h>
#include <ncarg/hlu/PSWorkstation.h>
#include <ncarg/hlu/XWorkstation.h>
#include "wrapper.h"

NhlErrorTypes print_string(void)
{

  char  *arg1;
  int   numpi, numpf, numpc, i, j;

/*
 * Input array variables
 */
  string *pname;
  int ndims_pname, dsizes_pname[NCL_MAX_DIMENSIONS];
  NclBasicDataTypes type_pname;

/*
 * Retrieve argument #1
 */
  pname = (string *) NclGetArgValue(
          0,
          1,
          &ndims_pname,
          dsizes_pname,
          NULL,
          NULL,
          &type_pname,
          2);

/*
 * Check number of dimensions for argument #1.
 */
  if(ndims_pname != 1) {
    NhlPError(NhlFATAL, NhlEUNKNOWN,
              "print_string: Argument #1 has the wrong number of dimensions.");
    return(NhlFATAL);
  }
  arg1 = NrmQuarkToString(*pname);

  printf ("From print_string: %s\n",arg1);
}

void Init(void){
  void *args;
  int dimsizes[NCL_MAX_DIMENSIONS];
  int nargs=0;

  /*
   * Register procedure.
   */
  nargs = 0;
  args = NewArgs(1);

  dimsizes[0] = -1;      /* -1 ===> Dimension can be any size. */

  SetArgTemplate(args,0,"string",1,dimsizes);nargs++;

  NclRegisterProc(print_string,args,"print_string",nargs);

}


