/*---------------------------------------------------------------------------*/
/*                                                                           */
/* Wrapper functions for calling routines exported from package 'Runuran'    */
/*                                                                           */
/*---------------------------------------------------------------------------*/
/* File generated by Runuran/src/scripts/update-API.pl: do not edit by hand  */
/*---------------------------------------------------------------------------*/

#ifndef _RUNURAN_API_H
#define _RUNURAN_API_H

#include "Runuran.h"
/* also includes 
 *   <R.h>
 *   <Rinternals.h>
 *   <Rdefines.h>
 *   <R_ext/Rdynload.h> 
 *   <unuran.h>
 */

#ifdef HAVE_VISIBILITY_ATTRIBUTE
  # define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
  # define attribute_hidden
#endif

__BEGIN_DECLS   /* for C++  (defined in <unuran.h> */

/*---------------------------------------------------------------------------*/

UNUR_GEN attribute_hidden * unur_init(UNUR_PAR *parameters) {
	static UNUR_GEN*(*func)(UNUR_PAR *) = NULL;
	if (func == NULL)
		func = (UNUR_GEN*(*)(UNUR_PAR *))
			R_GetCCallable("Runuran", "unur_init");
	return func(parameters);
}

void attribute_hidden  unur_free(UNUR_GEN *generator) {
	static void(*func)(UNUR_GEN *) = NULL;
	if (func == NULL)
		func = (void(*)(UNUR_GEN *))
			R_GetCCallable("Runuran", "unur_free");
	func(generator);
}

double attribute_hidden  unur_sample_cont(UNUR_GEN *generator) {
	static double(*func)(UNUR_GEN *) = NULL;
	if (func == NULL)
		func = (double(*)(UNUR_GEN *))
			R_GetCCallable("Runuran", "unur_sample_cont");
	return func(generator);
}

void attribute_hidden  unur_distr_free(UNUR_DISTR *distribution) {
	static void(*func)(UNUR_DISTR *) = NULL;
	if (func == NULL)
		func = (void(*)(UNUR_DISTR *))
			R_GetCCallable("Runuran", "unur_distr_free");
	func(distribution);
}

UNUR_URNG attribute_hidden * unur_urng_new(double (*sampleunif)(void *state), void *state) {
	static UNUR_URNG*(*func)(double (*)(void *),void *) = NULL;
	if (func == NULL)
		func = (UNUR_URNG*(*)(double (*)(void *),void *))
			R_GetCCallable("Runuran", "unur_urng_new");
	return func(sampleunif,state);
}

void attribute_hidden  unur_urng_free(UNUR_URNG *urng) {
	static void(*func)(UNUR_URNG *) = NULL;
	if (func == NULL)
		func = (void(*)(UNUR_URNG *))
			R_GetCCallable("Runuran", "unur_urng_free");
	func(urng);
}

int attribute_hidden  unur_set_default_debug(unsigned debug) {
	static int(*func)(unsigned ) = NULL;
	if (func == NULL)
		func = (int(*)(unsigned ))
			R_GetCCallable("Runuran", "unur_set_default_debug");
	return func(debug);
}

UNUR_URNG attribute_hidden * unur_set_default_urng(UNUR_URNG *urng_new) {
	static UNUR_URNG*(*func)(UNUR_URNG *) = NULL;
	if (func == NULL)
		func = (UNUR_URNG*(*)(UNUR_URNG *))
			R_GetCCallable("Runuran", "unur_set_default_urng");
	return func(urng_new);
}

UNUR_URNG attribute_hidden * unur_set_default_urng_aux(UNUR_URNG *urng_new) {
	static UNUR_URNG*(*func)(UNUR_URNG *) = NULL;
	if (func == NULL)
		func = (UNUR_URNG*(*)(UNUR_URNG *))
			R_GetCCallable("Runuran", "unur_set_default_urng_aux");
	return func(urng_new);
}

UNUR_URNG attribute_hidden * unur_get_default_urng(void) {
	static UNUR_URNG*(*func)(void) = NULL;
	if (func == NULL)
		func = (UNUR_URNG*(*)(void))
			R_GetCCallable("Runuran", "unur_get_default_urng");
	return func();
}

const char attribute_hidden * unur_get_strerror(const int errnocode) {
	static const char*(*func)(const int ) = NULL;
	if (func == NULL)
		func = (const char*(*)(const int ))
			R_GetCCallable("Runuran", "unur_get_strerror");
	return func(errnocode);
}

UNUR_ERROR_HANDLER attribute_hidden * unur_set_error_handler(UNUR_ERROR_HANDLER *new_handler) {
	static UNUR_ERROR_HANDLER*(*func)(UNUR_ERROR_HANDLER *) = NULL;
	if (func == NULL)
		func = (UNUR_ERROR_HANDLER*(*)(UNUR_ERROR_HANDLER *))
			R_GetCCallable("Runuran", "unur_set_error_handler");
	return func(new_handler);
}

UNUR_DISTR attribute_hidden * unur_distr_gig(const double *params, int n_params) {
	static UNUR_DISTR*(*func)(const double *,int ) = NULL;
	if (func == NULL)
		func = (UNUR_DISTR*(*)(const double *,int ))
			R_GetCCallable("Runuran", "unur_distr_gig");
	return func(params,n_params);
}

UNUR_PAR attribute_hidden * unur_arou_new(const UNUR_DISTR *distribution) {
	static UNUR_PAR*(*func)(const UNUR_DISTR *) = NULL;
	if (func == NULL)
		func = (UNUR_PAR*(*)(const UNUR_DISTR *))
			R_GetCCallable("Runuran", "unur_arou_new");
	return func(distribution);
}

double attribute_hidden  unur_arou_get_sqhratio(const UNUR_GEN *generator) {
	static double(*func)(const UNUR_GEN *) = NULL;
	if (func == NULL)
		func = (double(*)(const UNUR_GEN *))
			R_GetCCallable("Runuran", "unur_arou_get_sqhratio");
	return func(generator);
}

UNUR_PAR attribute_hidden * unur_ars_new(const UNUR_DISTR* distribution) {
	static UNUR_PAR*(*func)(const UNUR_DISTR* ) = NULL;
	if (func == NULL)
		func = (UNUR_PAR*(*)(const UNUR_DISTR* ))
			R_GetCCallable("Runuran", "unur_ars_new");
	return func(distribution);
}

UNUR_PAR attribute_hidden * unur_tabl_new(const UNUR_DISTR* distribution) {
	static UNUR_PAR*(*func)(const UNUR_DISTR* ) = NULL;
	if (func == NULL)
		func = (UNUR_PAR*(*)(const UNUR_DISTR* ))
			R_GetCCallable("Runuran", "unur_tabl_new");
	return func(distribution);
}

double attribute_hidden  unur_tabl_get_sqhratio(const UNUR_GEN *generator) {
	static double(*func)(const UNUR_GEN *) = NULL;
	if (func == NULL)
		func = (double(*)(const UNUR_GEN *))
			R_GetCCallable("Runuran", "unur_tabl_get_sqhratio");
	return func(generator);
}

int attribute_hidden  unur_tabl_set_max_sqhratio(UNUR_PAR *parameters, double max_ratio) {
	static int(*func)(UNUR_PAR *,double ) = NULL;
	if (func == NULL)
		func = (int(*)(UNUR_PAR *,double ))
			R_GetCCallable("Runuran", "unur_tabl_set_max_sqhratio");
	return func(parameters,max_ratio);
}

int attribute_hidden  unur_tabl_set_max_intervals(UNUR_PAR *parameters, int max_ivs) {
	static int(*func)(UNUR_PAR *,int ) = NULL;
	if (func == NULL)
		func = (int(*)(UNUR_PAR *,int ))
			R_GetCCallable("Runuran", "unur_tabl_set_max_intervals");
	return func(parameters,max_ivs);
}

int attribute_hidden  unur_tabl_set_boundary(UNUR_PAR *parameters, double left, double right) {
	static int(*func)(UNUR_PAR *,double ,double ) = NULL;
	if (func == NULL)
		func = (int(*)(UNUR_PAR *,double ,double ))
			R_GetCCallable("Runuran", "unur_tabl_set_boundary");
	return func(parameters,left,right);
}

UNUR_PAR attribute_hidden * unur_tdr_new(const UNUR_DISTR* distribution) {
	static UNUR_PAR*(*func)(const UNUR_DISTR* ) = NULL;
	if (func == NULL)
		func = (UNUR_PAR*(*)(const UNUR_DISTR* ))
			R_GetCCallable("Runuran", "unur_tdr_new");
	return func(distribution);
}

int attribute_hidden  unur_tdr_set_variant_ia(UNUR_PAR *parameters) {
	static int(*func)(UNUR_PAR *) = NULL;
	if (func == NULL)
		func = (int(*)(UNUR_PAR *))
			R_GetCCallable("Runuran", "unur_tdr_set_variant_ia");
	return func(parameters);
}

double attribute_hidden  unur_tdr_get_sqhratio(const UNUR_GEN *generator) {
	static double(*func)(const UNUR_GEN *) = NULL;
	if (func == NULL)
		func = (double(*)(const UNUR_GEN *))
			R_GetCCallable("Runuran", "unur_tdr_get_sqhratio");
	return func(generator);
}

UNUR_PAR attribute_hidden * unur_pinv_new(const UNUR_DISTR *distribution) {
	static UNUR_PAR*(*func)(const UNUR_DISTR *) = NULL;
	if (func == NULL)
		func = (UNUR_PAR*(*)(const UNUR_DISTR *))
			R_GetCCallable("Runuran", "unur_pinv_new");
	return func(distribution);
}

/*---------------------------------------------------------------------------*/

__END_DECLS

/*---------------------------------------------------------------------------*/
#endif /* end of _RUNURAN_API_H */
/*---------------------------------------------------------------------------*/
