/* callable_wraps.c

These wrapper routines are written to be called from FORTRAN programs
that utilize Callable IDL functions.

Two assumptions about the FORTRAN compiler used to compile Callable IDL
FORTRAN programs:

  1) FORTRAN routine names are generated in all lower case letters.
  2) FORTRAN routine names are appended with the underscore (_) character.

Future enhancements planned:
  1) Generalize for all platforms, including FORTRAN underscore
     differences.

Written by Doug Loucks
Research Systems Incorporated, October, 1998
------------------------------------------------------------------------*/

#include <stdio.h>

/* HINT: export.h is in the external directory of the IDL installation
tree. */
#include "export.h"

/*-----------------------------------------------------------------------
Function idl_init_
-----------------------------------------------------------------------*/
int idl_init_(int *options) {
  int argc = 0;
  char *argv[] = {NULL};

  return IDL_Init(*options, &argc, argv);
}
 

/*-----------------------------------------------------------------------
Function idl_executestr_
-----------------------------------------------------------------------*/
void idl_executestr_( char *cmd ) {
  IDL_ExecuteStr( cmd );
}
 

/*-----------------------------------------------------------------------
Function idl_importnamedarray_
-----------------------------------------------------------------------*/
void idl_importnamedarray_(
     char *name,
     int *n_dim,
     IDL_LONG dim[],
     int *type,
     UCHAR *data,
     void *callback,
     void *s ) {

  IDL_VPTR v;

  v = IDL_ImportNamedArray( name, *n_dim, dim, *type, data, callback, s);
}
 

/*-----------------------------------------------------------------------
Function idl_cleanup_
-----------------------------------------------------------------------*/
int idl_cleanup_(int *just_cleanup) {
  printf("IDL is cleaning up...\n");
  return IDL_Cleanup(*just_cleanup);
}