/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */


#ifndef SWIGGUILE
#define SWIGGUILE
#endif

#define SWIG_GUILE_INIT_STATIC static
SWIG_GUILE_INIT_STATIC void
SWIG_init (void);

/* -----------------------------------------------------------------------------
 *  This section contains generic SWIG labels for method/variable
 *  declarations/attributes, and other compiler dependent labels.
 * ----------------------------------------------------------------------------- */

/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
#  define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
#  define SWIGTEMPLATEDISAMBIGUATOR template
# else
#  define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif

/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
#   define SWIGINLINE inline
# else
#   define SWIGINLINE
# endif
#endif

/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define SWIGUNUSED __attribute__ ((__unused__))
#   else
#     define SWIGUNUSED
#   endif
# elif defined(__ICC)
#   define SWIGUNUSED __attribute__ ((__unused__))
# else
#   define SWIGUNUSED
# endif
#endif

#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif

#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
#   define SWIGUNUSEDPARM(p)
# else
#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif

/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif

/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif

/* exporting methods */
#if defined(__GNUC__)
#  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#    ifndef GCC_HASCLASSVISIBILITY
#      define GCC_HASCLASSVISIBILITY
#    endif
#  endif
#endif

#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__)
#   if defined(STATIC_LINKED)
#     define SWIGEXPORT
#   else
#     define SWIGEXPORT __declspec(dllexport)
#   endif
# else
#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
#     define SWIGEXPORT __attribute__ ((visibility("default")))
#   else
#     define SWIGEXPORT
#   endif
# endif
#endif

/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__)
#   define SWIGSTDCALL __stdcall
# else
#   define SWIGSTDCALL
# endif
#endif

/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif

/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif

/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif

/* Intel's compiler complains if a variable which was never initialised is
 * cast to void, which is a common idiom which we use to indicate that we
 * are aware a variable isn't used.  So we just silence that warning.
 * See: https://github.com/swig/swig/issues/192 for more discussion.
 */
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif

/* -----------------------------------------------------------------------------
 * swigrun.swg
 *
 * This file contains generic C API SWIG runtime support for pointer
 * type checking.
 * ----------------------------------------------------------------------------- */

/* This should only be incremented when either the layout of swig_type_info changes,
   or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"

/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif

/*
  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
  creating a static or dynamic library from the SWIG runtime code.
  In 99.9% of the cases, SWIG just needs to declare them as 'static'.

  But only do this if strictly necessary, ie, if you have problems
  with your compiler or suchlike.
*/

#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif

#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif

/*  Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif

/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN        0x1
#define SWIG_CAST_NEW_MEMORY       0x2

/* Flags for new pointer objects */
#define SWIG_POINTER_OWN           0x1


/*
   Flags/methods for returning states.

   The SWIG conversion methods, as ConvertPtr, return an integer
   that tells if the conversion was successful or not. And if not,
   an error code can be returned (see swigerrors.swg for the codes).

   Use the following macros/flags to set or process the returning
   states.

   In old versions of SWIG, code such as the following was usually written:

     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
       // success code
     } else {
       //fail code
     }

   Now you can be more explicit:

    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
    } else {
      // fail code
    }

   which is the same really, but now you can also do

    Type *ptr;
    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
    if (SWIG_IsOK(res)) {
      // success code
      if (SWIG_IsNewObj(res) {
        ...
	delete *ptr;
      } else {
        ...
      }
    } else {
      // fail code
    }

   I.e., now SWIG_ConvertPtr can return new objects and you can
   identify the case and take care of the deallocation. Of course that
   also requires SWIG_ConvertPtr to return new result values, such as

      int SWIG_ConvertPtr(obj, ptr,...) {
        if (<obj is ok>) {
          if (<need new object>) {
            *ptr = <ptr to new allocated object>;
            return SWIG_NEWOBJ;
          } else {
            *ptr = <ptr to old object>;
            return SWIG_OLDOBJ;
          }
        } else {
          return SWIG_BADOBJ;
        }
      }

   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
   SWIG errors code.

   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
   allows to return the 'cast rank', for example, if you have this

       int food(double)
       int fooi(int);

   and you call

      food(1)   // cast rank '1'  (1 -> 1.0)
      fooi(1)   // cast rank '0'

   just use the SWIG_AddCast()/SWIG_CheckState()
*/

#define SWIG_OK                    (0)
#define SWIG_ERROR                 (-1)
#define SWIG_IsOK(r)               (r >= 0)
#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)

/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT         (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ                (SWIG_ERROR)
#define SWIG_OLDOBJ                (SWIG_OK)
#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))

/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
#  ifndef SWIG_TypeRank
#    define SWIG_TypeRank             unsigned long
#  endif
#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
#    define SWIG_MAXCASTRANK          (2)
#  endif
#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
#  define SWIG_AddCast(r) (r)
#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif


#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);

/* Structure to store information on one type */
typedef struct swig_type_info {
  const char             *name;			/* mangled name of this type */
  const char             *str;			/* human readable name of this type */
  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
  void                   *clientdata;		/* language specific type data */
  int                    owndata;		/* flag if the structure owns the clientdata */
} swig_type_info;

/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
  swig_converter_func     converter;		/* function to cast the void pointers */
  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
  struct swig_cast_info  *prev;			/* pointer to the previous cast */
} swig_cast_info;

/* Structure used to store module information
 * Each module generates one structure like this, and the runtime collects
 * all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
  size_t                 size;		        /* Number of types in this module */
  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
  swig_type_info         **type_initial;	/* Array of initially generated type structures */
  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
  void                    *clientdata;		/* Language specific module data */
} swig_module_info;

/*
  Compare two type names skipping the space characters, therefore
  "char*" == "char *" and "Class<int>" == "Class<int >", etc.

  Return 0 when the two name types are equivalent, as in
  strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
		  const char *f2, const char *l2) {
  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
    while ((*f1 == ' ') && (f1 != l1)) ++f1;
    while ((*f2 == ' ') && (f2 != l2)) ++f2;
    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
  }
  return (int)((l1 - f1) - (l2 - f2));
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCmp(const char *nb, const char *tb) {
  int equiv = 1;
  const char* te = tb + strlen(tb);
  const char* ne = nb;
  while (equiv != 0 && *ne) {
    for (nb = ne; *ne; ++ne) {
      if (*ne == '|') break;
    }
    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
    if (*ne) ++ne;
  }
  return equiv;
}

/*
  Check type equivalence in a name list like <name1>|<name2>|...
  Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}

/*
  Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (strcmp(iter->type->name, c) == 0) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
  if (ty) {
    swig_cast_info *iter = ty->cast;
    while (iter) {
      if (iter->type == from) {
        if (iter == ty->cast)
          return iter;
        /* Move iter to the top of the linked list */
        iter->prev->next = iter->next;
        if (iter->next)
          iter->next->prev = iter->prev;
        iter->next = ty->cast;
        iter->prev = 0;
        if (ty->cast) ty->cast->prev = iter;
        ty->cast = iter;
        return iter;
      }
      iter = iter->next;
    }
  }
  return 0;
}

/*
  Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}

/*
   Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
  swig_type_info *lastty = ty;
  if (!ty || !ty->dcast) return ty;
  while (ty && (ty->dcast)) {
    ty = (*ty->dcast)(ptr);
    if (ty) lastty = ty;
  }
  return lastty;
}

/*
  Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
  return ty->name;
}

/*
  Return the pretty name associated with this type,
  that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
  /* The "str" field contains the equivalent pretty names of the
     type, separated by vertical-bar characters.  We choose
     to print the last name, as it is often (?) the most
     specific. */
  if (!type) return NULL;
  if (type->str != NULL) {
    const char *last_name = type->str;
    const char *s;
    for (s = type->str; *s; s++)
      if (*s == '|') last_name = s+1;
    return last_name;
  }
  else
    return type->name;
}

/*
   Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
  swig_cast_info *cast = ti->cast;
  /* if (ti->clientdata == clientdata) return; */
  ti->clientdata = clientdata;

  while (cast) {
    if (!cast->converter) {
      swig_type_info *tc = cast->type;
      if (!tc->clientdata) {
	SWIG_TypeClientData(tc, clientdata);
      }
    }
    cast = cast->next;
  }
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
  SWIG_TypeClientData(ti, clientdata);
  ti->owndata = 1;
}

/*
  Search for a swig_type_info structure only by mangled name
  Search is a O(log #types)

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
                            swig_module_info *end,
		            const char *name) {
  swig_module_info *iter = start;
  do {
    if (iter->size) {
      size_t l = 0;
      size_t r = iter->size - 1;
      do {
	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
	size_t i = (l + r) >> 1;
	const char *iname = iter->types[i]->name;
	if (iname) {
	  int compare = strcmp(name, iname);
	  if (compare == 0) {
	    return iter->types[i];
	  } else if (compare < 0) {
	    if (i) {
	      r = i - 1;
	    } else {
	      break;
	    }
	  } else if (compare > 0) {
	    l = i + 1;
	  }
	} else {
	  break; /* should never happen */
	}
      } while (l <= r);
    }
    iter = iter->next;
  } while (iter != end);
  return 0;
}

/*
  Search for a swig_type_info structure for either a mangled name or a human readable name.
  It first searches the mangled names of the types, which is a O(log #types)
  If a type is not found it then searches the human readable names, which is O(#types).

  We start searching at module start, and finish searching when start == end.
  Note: if start == end at the beginning of the function, we go all the way around
  the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
                     swig_module_info *end,
		     const char *name) {
  /* STEP 1: Search the name field using binary search */
  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
  if (ret) {
    return ret;
  } else {
    /* STEP 2: If the type hasn't been found, do a complete search
       of the str field (the human readable name) */
    swig_module_info *iter = start;
    do {
      size_t i = 0;
      for (; i < iter->size; ++i) {
	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
	  return iter->types[i];
      }
      iter = iter->next;
    } while (iter != end);
  }

  /* neither found a match */
  return 0;
}

/*
   Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
  static const char hex[17] = "0123456789abcdef";
  const unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu =  u + sz;
  for (; u != eu; ++u) {
    unsigned char uu = *u;
    *(c++) = hex[(uu & 0xf0) >> 4];
    *(c++) = hex[uu & 0xf];
  }
  return c;
}

/*
   Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
  unsigned char *u = (unsigned char *) ptr;
  const unsigned char *eu = u + sz;
  for (; u != eu; ++u) {
    char d = *(c++);
    unsigned char uu;
    if ((d >= '0') && (d <= '9'))
      uu = (unsigned char)((d - '0') << 4);
    else if ((d >= 'a') && (d <= 'f'))
      uu = (unsigned char)((d - ('a'-10)) << 4);
    else
      return (char *) 0;
    d = *(c++);
    if ((d >= '0') && (d <= '9'))
      uu |= (unsigned char)(d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      uu |= (unsigned char)(d - ('a'-10));
    else
      return (char *) 0;
    *u = uu;
  }
  return c;
}

/*
   Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
  char *r = buff;
  if ((2*sizeof(void *) + 2) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,&ptr,sizeof(void *));
  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
  strcpy(r,name);
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      *ptr = (void *) 0;
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sizeof(void *));
}

SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
  char *r = buff;
  size_t lname = (name ? strlen(name) : 0);
  if ((2*sz + 2 + lname) > bsz) return 0;
  *(r++) = '_';
  r = SWIG_PackData(r,ptr,sz);
  if (lname) {
    strncpy(r,name,lname+1);
  } else {
    *r = 0;
  }
  return buff;
}

SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
  if (*c != '_') {
    if (strcmp(c,"NULL") == 0) {
      memset(ptr,0,sz);
      return name;
    } else {
      return 0;
    }
  }
  return SWIG_UnpackData(++c,ptr,sz);
}

#ifdef __cplusplus
}
#endif

/* -----------------------------------------------------------------------------
 * guile_scm_run.swg
 * ----------------------------------------------------------------------------- */

#include <libguile.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#ifdef __cplusplus
extern "C" {
#endif


/* In the code below, use guile 2.0 compatible functions where possible.
   Functions that don't exist in older versions will be mapped to
   a deprecated equivalent for those versions only */
#if defined (SCM_MAJOR_VERSION) && (SCM_MAJOR_VERSION < 2)

static SCM
scm_module_variable (SCM module, SCM sym)
{
  return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
}

#endif

#if SCM_MAJOR_VERSION >= 2
/* scm_c_define_gsubr takes a different parameter type depending on the guile version */

typedef scm_t_subr swig_guile_proc;
#else
typedef SCM (*swig_guile_proc)();
#endif
typedef SCM (*guile_destructor)(SCM);

typedef struct swig_guile_clientdata {
  guile_destructor destroy;
  SCM goops_class;
} swig_guile_clientdata;

#if SCM_MAJOR_VERSION <= 2
#define scm_to_utf8_string scm_to_locale_string
#define scm_from_utf8_string scm_from_locale_string
#endif
#define SWIG_scm2str(s) \
  SWIG_Guile_scm2newstr(s, NULL)
#define SWIG_str02scm(str) \
  str ? scm_from_utf8_string(str) : SCM_BOOL_F 
# define SWIG_malloc(size) \
  scm_malloc(size)
# define SWIG_free(mem) \
  free(mem)
#define SWIG_ConvertPtr(s, result, type, flags) \
  SWIG_Guile_ConvertPtr(s, result, type, flags)
#define SWIG_MustGetPtr(s, type, argnum, flags) \
  SWIG_Guile_MustGetPtr(s, type, argnum, flags, FUNC_NAME)
#define SWIG_NewPointerObj(ptr, type, owner) \
  SWIG_Guile_NewPointerObj((void*)ptr, type, owner)
#define SWIG_PointerAddress(object) \
  SWIG_Guile_PointerAddress(object)
#define SWIG_PointerType(object) \
  SWIG_Guile_PointerType(object)
#define SWIG_IsPointerOfType(object, type) \
  SWIG_Guile_IsPointerOfType(object, type)
#define SWIG_IsPointer(object) \
  SWIG_Guile_IsPointer(object)
#define SWIG_contract_assert(expr, msg)				\
  if (!(expr))							\
    scm_error(scm_from_locale_symbol("swig-contract-assertion-failed"),	\
	      (char *) FUNC_NAME, (char *) msg,			\
	      SCM_EOL, SCM_BOOL_F); else

/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty) \
  SWIG_Guile_ConvertMember(obj, ptr, sz, ty, FUNC_NAME)
#define SWIG_NewMemberObj(ptr, sz, type) \
  SWIG_Guile_NewMemberObj(ptr, sz, type, FUNC_NAME)
  
/* Runtime API */
static swig_module_info *SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata));
#define SWIG_GetModule(clientdata) SWIG_Guile_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Guile_SetModule(pointer)
  
SWIGINTERN char *
SWIG_Guile_scm2newstr(SCM str, size_t *len) {
#define FUNC_NAME "SWIG_Guile_scm2newstr"
  char *ret;

  SCM_ASSERT (scm_is_string(str), str, 1, FUNC_NAME);

  ret = scm_to_utf8_string(str);
  if (!ret) return NULL;

  if (len) *len = strlen(ret) - 1;
  return ret;
#undef FUNC_NAME
}

static int swig_initialized = 0;
static scm_t_bits swig_tag = 0;
static scm_t_bits swig_collectable_tag = 0;
static scm_t_bits swig_destroyed_tag = 0;
static scm_t_bits swig_member_function_tag = 0;
static SCM swig_make_func = SCM_EOL;
static SCM swig_keyword = SCM_EOL;
static SCM swig_symbol = SCM_EOL;

#define SWIG_Guile_GetSmob(x) \
  ( !scm_is_null(x) && SCM_INSTANCEP(x) && scm_is_true(scm_slot_exists_p(x, swig_symbol)) \
      ? scm_slot_ref(x, swig_symbol) : (x) )

SWIGINTERN SCM
SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner)
{
  if (ptr == NULL)
    return SCM_EOL;
  else {
    SCM smob;
    swig_guile_clientdata *cdata = (swig_guile_clientdata *) type->clientdata;
    if (owner)
      SCM_NEWSMOB2(smob, swig_collectable_tag, ptr, (void *) type);
    else
      SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type);

    if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) {
      return smob;
    } else {
      /* the scm_make() C function only handles the creation of gf,
	 methods and classes (no instances) the (make ...) function is
	 later redefined in goops.scm.  So we need to call that
	 Scheme function. */
      return scm_apply(swig_make_func,
		       scm_list_3(cdata->goops_class,
				  swig_keyword,
				  smob),
		       SCM_EOL);
    }
  }
}

SWIGINTERN unsigned long
SWIG_Guile_PointerAddress(SCM object)
{
  SCM smob = SWIG_Guile_GetSmob(object);
  if (SCM_NULLP(smob)) return 0;
  else if (SCM_SMOB_PREDICATE(swig_tag, smob)
	   || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
	   || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
    return (unsigned long) (void *) SCM_CELL_WORD_1(smob);
  }
  else scm_wrong_type_arg("SWIG-Guile-PointerAddress", 1, object);
}

SWIGINTERN swig_type_info *
SWIG_Guile_PointerType(SCM object)
{
  SCM smob = SWIG_Guile_GetSmob(object);
  if (SCM_NULLP(smob)) return NULL;
  else if (SCM_SMOB_PREDICATE(swig_tag, smob)
	   || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)
	   || SCM_SMOB_PREDICATE(swig_destroyed_tag, smob)) {
    return (swig_type_info *) SCM_CELL_WORD_2(smob);
  }
  else scm_wrong_type_arg("SWIG-Guile-PointerType", 1, object);
}
  
SWIGINTERN int
SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags)
{
  swig_cast_info *cast;
  swig_type_info *from;
  SCM smob = SWIG_Guile_GetSmob(s);

  if (SCM_NULLP(smob)) {
    *result = NULL;
    return SWIG_OK;
  } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
    /* we do not accept smobs representing destroyed pointers */
    from = (swig_type_info *) SCM_CELL_WORD_2(smob);
    if (!from) return SWIG_ERROR;
    if (type) {
      cast = SWIG_TypeCheckStruct(from, type);
      if (cast) {
        int newmemory = 0;
        *result = SWIG_TypeCast(cast, (void *) SCM_CELL_WORD_1(smob), &newmemory);
        assert(!newmemory); /* newmemory handling not yet implemented */
        return SWIG_OK;
      } else {
        return SWIG_ERROR;
      }
    } else {
      *result = (void *) SCM_CELL_WORD_1(smob);
      return SWIG_OK;
    }
  }
  return SWIG_ERROR;
}

SWIGINTERNINLINE void *
SWIG_Guile_MustGetPtr (SCM s, swig_type_info *type,
		       int argnum, int flags, const char *func_name)
{
  void *result;
  int res = SWIG_Guile_ConvertPtr(s, &result, type, flags);
  if (!SWIG_IsOK(res)) {
    /* type mismatch */
    scm_wrong_type_arg((char *) func_name, argnum, s);
  }
  return result;
}

SWIGINTERNINLINE int
SWIG_Guile_IsPointerOfType (SCM s, swig_type_info *type)
{
  void *result;
  if (SWIG_Guile_ConvertPtr(s, &result, type, 0)) {
    /* type mismatch */
    return 0;
  }
  else return 1;
}

SWIGINTERNINLINE int
SWIG_Guile_IsPointer (SCM s)
{
  /* module might not be initialized yet, so initialize it */
  SWIG_GetModule(0);
  return SWIG_Guile_IsPointerOfType (s, NULL);
}

/* Mark a pointer object non-collectable */
SWIGINTERN void
SWIG_Guile_MarkPointerNoncollectable(SCM s)
{
  SCM smob = SWIG_Guile_GetSmob(s);
  if (!SCM_NULLP(smob)) {
    if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
      SCM_SET_CELL_TYPE(smob, swig_tag);
    }
    else scm_wrong_type_arg(NULL, 0, s);
  }
}

/* Mark a pointer object destroyed */
SWIGINTERN void
SWIG_Guile_MarkPointerDestroyed(SCM s)
{
  SCM smob = SWIG_Guile_GetSmob(s);
  if (!SCM_NULLP(smob)) {
    if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) {
      SCM_SET_CELL_TYPE(smob, swig_destroyed_tag);
    }
    else scm_wrong_type_arg(NULL, 0, s);
  }
}

/* Member functions */

SWIGINTERN SCM
SWIG_Guile_NewMemberObj(void *ptr, size_t sz, swig_type_info *type,
			const char *func_name)
{
  SCM smob;
  void *copy = malloc(sz);
  memcpy(copy, ptr, sz);
  SCM_NEWSMOB2(smob, swig_member_function_tag, copy, (void *) type);
  return smob;
}

SWIGINTERN int
SWIG_Guile_ConvertMember(SCM smob, void *ptr, size_t sz, swig_type_info *type,
			 const char *func_name)
{
  swig_cast_info *cast;
  swig_type_info *from;

  if (SCM_SMOB_PREDICATE(swig_member_function_tag, smob)) {
    from = (swig_type_info *) SCM_CELL_WORD_2(smob);
    if (!from) return SWIG_ERROR;
    if (type) {
      cast = SWIG_TypeCheckStruct(from, type);
      if (!cast) return SWIG_ERROR;
    }
    memcpy(ptr, (void *) SCM_CELL_WORD_1(smob), sz);
    return SWIG_OK;
  }
  return SWIG_ERROR;
}
     

/* Init */

SWIGINTERN int
print_swig_aux (SCM swig_smob, SCM port, scm_print_state *pstate, 
                const char *attribute)
{
  swig_type_info *type;
  
  type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
  if (type) {
    scm_puts((char *) "#<", port);
    scm_puts((char *) attribute, port);
    scm_puts((char *) "swig-pointer ", port);
    scm_puts((char *) SWIG_TypePrettyName(type), port);
    scm_puts((char *) " ", port);
    scm_intprint((long) SCM_CELL_WORD_1(swig_smob), 16, port);
    scm_puts((char *) ">", port);
    /* non-zero means success */
    return 1;
  } else {
    return 0;
  }
}

  
SWIGINTERN int
print_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
{
  return print_swig_aux(swig_smob, port, pstate, "");
}

SWIGINTERN int
print_collectable_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
{
  return print_swig_aux(swig_smob, port, pstate, "collectable-");
}

SWIGINTERN int
print_destroyed_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
{
  return print_swig_aux(swig_smob, port, pstate, "destroyed-");
}

SWIGINTERN int
print_member_function_swig (SCM swig_smob, SCM port, scm_print_state *pstate)
{
  swig_type_info *type;
  type = (swig_type_info *) SCM_CELL_WORD_2(swig_smob);
  if (type) {
    scm_puts((char *) "#<", port);
    scm_puts((char *) "swig-member-function-pointer ", port);
    scm_puts((char *) SWIG_TypePrettyName(type), port);
    scm_puts((char *) " >", port);
    /* non-zero means success */
    return 1;
  } else {
    return 0;
  }
}

SWIGINTERN SCM
equalp_swig (SCM A, SCM B)
{
  if (SCM_CELL_WORD_0(A) == SCM_CELL_WORD_0(B) && SCM_CELL_WORD_1(A) == SCM_CELL_WORD_1(B) 
      && SCM_CELL_WORD_2(A) == SCM_CELL_WORD_2(B))
    return SCM_BOOL_T;
  else return SCM_BOOL_F;
}

SWIGINTERN size_t
free_swig(SCM A)
{
  swig_type_info *type = (swig_type_info *) SCM_CELL_WORD_2(A);
  if (type) {
    if (type->clientdata && ((swig_guile_clientdata *)type->clientdata)->destroy)
      ((swig_guile_clientdata *)type->clientdata)->destroy(A);
  } 
  return 0;
}

SWIGINTERN size_t
free_swig_member_function(SCM A)
{
  free((swig_type_info *) SCM_CELL_WORD_1(A));
  return 0;
}

SWIGINTERN int
ensure_smob_tag(SCM swig_module,
		scm_t_bits *tag_variable,
		const char *smob_name,
		const char *scheme_variable_name)
{
  SCM variable = scm_module_variable(swig_module,
                             scm_from_locale_symbol(scheme_variable_name));
  if (scm_is_false(variable)) {
    *tag_variable = scm_make_smob_type((char*)scheme_variable_name, 0);
    scm_c_module_define(swig_module, scheme_variable_name, 
                        scm_from_ulong(*tag_variable));
    return 1;
  }
  else {
    *tag_variable = scm_to_ulong(SCM_VARIABLE_REF(variable));
    return 0;
  }
}

SWIGINTERN SCM
SWIG_Guile_Init ()
{
  static SCM swig_module;
  
  if (swig_initialized) return swig_module;
  swig_initialized = 1;

  swig_module = scm_c_resolve_module("Swig swigrun");
  if (ensure_smob_tag(swig_module, &swig_tag,
		      "swig-pointer", "swig-pointer-tag")) {
    scm_set_smob_print(swig_tag, print_swig);
    scm_set_smob_equalp(swig_tag, equalp_swig);
  }
  if (ensure_smob_tag(swig_module, &swig_collectable_tag,
		      "collectable-swig-pointer", "collectable-swig-pointer-tag")) {
    scm_set_smob_print(swig_collectable_tag, print_collectable_swig);
    scm_set_smob_equalp(swig_collectable_tag, equalp_swig);
    scm_set_smob_free(swig_collectable_tag, free_swig);
  }
  if (ensure_smob_tag(swig_module, &swig_destroyed_tag,
		      "destroyed-swig-pointer", "destroyed-swig-pointer-tag")) {
    scm_set_smob_print(swig_destroyed_tag, print_destroyed_swig);
    scm_set_smob_equalp(swig_destroyed_tag, equalp_swig);
  }
  if (ensure_smob_tag(swig_module, &swig_member_function_tag,
		      "swig-member-function-pointer", "swig-member-function-pointer-tag")) {
    scm_set_smob_print(swig_member_function_tag, print_member_function_swig);
    scm_set_smob_free(swig_member_function_tag, free_swig_member_function);
  }
  swig_make_func = scm_permanent_object(
  scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make")));
  swig_keyword = scm_permanent_object(scm_from_locale_keyword((char*) "init-smob"));
  swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob"));
#ifdef SWIG_INIT_RUNTIME_MODULE
  SWIG_INIT_RUNTIME_MODULE
#endif

  return swig_module;
}

SWIGINTERN swig_module_info *
SWIG_Guile_GetModule(void *SWIGUNUSEDPARM(clientdata))
{
  SCM module = SWIG_Guile_Init();
  SCM variable = scm_module_variable(module, scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME));
  if (scm_is_false(variable)) {
    return NULL;
  } else {
    return (swig_module_info *) scm_to_ulong(SCM_VARIABLE_REF(variable));
  }
}

SWIGINTERN void
SWIG_Guile_SetModule(swig_module_info *swig_module)
{
  SCM module = SWIG_Guile_Init();
  scm_module_define(module,
                    scm_from_locale_symbol("swig-type-list-address" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME),
                    scm_from_ulong((unsigned long) swig_module));
}

SWIGINTERN int
SWIG_Guile_GetArgs (SCM *dest, SCM rest,
		    int reqargs, int optargs,
		    const char *procname)
{
  int i;
  int num_args_passed = 0;
  for (i = 0; i<reqargs; i++) {
    if (!SCM_CONSP(rest))
      scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
    *dest++ = SCM_CAR(rest);
    rest = SCM_CDR(rest);
    num_args_passed++;
  }
  for (i = 0; i<optargs && SCM_CONSP(rest); i++) {
    *dest++ = SCM_CAR(rest);
    rest = SCM_CDR(rest);
    num_args_passed++;
  }
  for (; i<optargs; i++)
    *dest++ = SCM_UNDEFINED;
  if (!SCM_NULLP(rest))
      scm_wrong_num_args(scm_from_utf8_string(procname ? (char *) procname : "unknown procedure"));
  return num_args_passed;
}

#ifdef __cplusplus
}
#endif



#define GUILE_MAYBE_VALUES \
      if (gswig_list_p) gswig_result = scm_values(gswig_result);

#define GUILE_MAYBE_VECTOR \
      if (gswig_list_p) gswig_result = scm_vector(gswig_result);

#define SWIG_APPEND_VALUE(object)						\
    if (gswig_result == SCM_UNSPECIFIED)						\
        gswig_result = object;							\
    else {									\
      if (!gswig_list_p) {							\
	      gswig_list_p = 1;							\
	      gswig_result = scm_listify(gswig_result, object, SCM_UNDEFINED);	\
      }									\
      else									\
            gswig_result = scm_append(scm_listify(gswig_result, scm_listify(object, SCM_UNDEFINED), SCM_UNDEFINED));		\
    }



/* -------- TYPES TABLE (BEGIN) -------- */

#define SWIGTYPE_p_Account swig_types[0]
#define SWIGTYPE_p_GDate swig_types[1]
#define SWIGTYPE_p_GList swig_types[2]
#define SWIGTYPE_p_GNCOptionDB swig_types[3]
#define SWIGTYPE_p_GNCPrintAmountInfo swig_types[4]
#define SWIGTYPE_p_Process swig_types[5]
#define SWIGTYPE_p_QofBook swig_types[6]
#define SWIGTYPE_p_QofIdType swig_types[7]
#define SWIGTYPE_p_QofSession swig_types[8]
#define SWIGTYPE_p_char swig_types[9]
#define SWIGTYPE_p_double swig_types[10]
#define SWIGTYPE_p_f_p_void__void swig_types[11]
#define SWIGTYPE_p_float swig_types[12]
#define SWIGTYPE_p_gboolean swig_types[13]
#define SWIGTYPE_p_gint64 swig_types[14]
#define SWIGTYPE_p_gnc_commodity swig_types[15]
#define SWIGTYPE_p_gnc_commodity_table swig_types[16]
#define SWIGTYPE_p_gnc_numeric swig_types[17]
#define SWIGTYPE_p_int swig_types[18]
#define SWIGTYPE_p_unsigned_int swig_types[19]
#define SWIGTYPE_p_unsigned_long swig_types[20]
static swig_type_info *swig_types[22];
static swig_module_info swig_module = {swig_types, 21, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)

/* -------- TYPES TABLE (END) -------- */


/* Includes the header in the wrapper code */
#include <config.h>
#include <option-util.h>
#include <gnc-euro.h>
#include <gnc-exp-parser.h>
#include <gnc-ui-util.h>
#include <gnc-gettext-util.h>
#include <gnc-prefs-utils.h>
#include <gnc-helpers.h>
#include <gnc-accounting-period.h>
#include <gnc-session.h>
#include <gnc-component-manager.h>
#include <guile-util.h>
#include <app-utils/gnc-sx-instance-model.h>

#include "engine-helpers-guile.h"


#include "guile-mappings.h"

SCM scm_init_sw_app_utils_module (void);


typedef GList GncCommodityList;

GncCommodityList *
gnc_commodity_table_get_quotable_commodities(const gnc_commodity_table * table);

static SCM
_wrap_gnc_prefs_init ()
{
#define FUNC_NAME "gnc-prefs-init"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  gnc_prefs_init();
  gswig_result = SCM_UNSPECIFIED;
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_get_current_book ()
{
#define FUNC_NAME "gnc-get-current-book"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  QofBook *result = 0 ;
  
  result = (QofBook *)gnc_get_current_book();
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_QofBook, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_get_current_session ()
{
#define FUNC_NAME "gnc-get-current-session"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  QofSession *result = 0 ;
  
  result = (QofSession *)gnc_get_current_session();
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_QofSession, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_get_current_book_tax_name ()
{
#define FUNC_NAME "gnc-get-current-book-tax-name"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gchar *result = 0 ;
  
  result = (gchar *)gnc_get_current_book_tax_name();
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_get_current_book_tax_type ()
{
#define FUNC_NAME "gnc-get-current-book-tax-type"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gchar *result = 0 ;
  
  result = (gchar *)gnc_get_current_book_tax_type();
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_get_current_root_account ()
{
#define FUNC_NAME "gnc-get-current-root-account"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  Account *result = 0 ;
  
  result = (Account *)gnc_get_current_root_account();
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_Account, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_gettext_helper (SCM s_0)
{
#define FUNC_NAME "gnc-gettext-helper"
  char *arg1 = (char *) 0 ;
  int must_free1 = 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  char *result = 0 ;
  
  {
    arg1 = (char *)SWIG_scm2str(s_0);
    must_free1 = 1;
  }
  result = (char *)gnc_gettext_helper((char const *)arg1);
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  if (must_free1 && arg1) SWIG_free(arg1);
  free(result);
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_option_db_new (SCM s_0)
{
#define FUNC_NAME "gnc-option-db-new"
  SCM arg1 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GNCOptionDB *result = 0 ;
  
  arg1=s_0;
  result = (GNCOptionDB *)gnc_option_db_new(arg1);
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_GNCOptionDB, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_option_db_destroy (SCM s_0)
{
#define FUNC_NAME "gnc-option-db-destroy"
  GNCOptionDB *arg1 = (GNCOptionDB *) 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  {
    arg1 = (GNCOptionDB *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_GNCOptionDB, 1, 0);
  }
  gnc_option_db_destroy(arg1);
  gswig_result = SCM_UNSPECIFIED;
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_option_db_set_option_selectable_by_name (SCM s_0, SCM s_1, SCM s_2, SCM s_3)
{
#define FUNC_NAME "gnc-option-db-set-option-selectable-by-name"
  SCM arg1 ;
  char *arg2 = (char *) 0 ;
  char *arg3 = (char *) 0 ;
  gboolean arg4 ;
  int must_free2 = 0 ;
  int must_free3 = 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  arg1=s_0;
  {
    arg2 = (char *)SWIG_scm2str(s_1);
    must_free2 = 1;
  }
  {
    arg3 = (char *)SWIG_scm2str(s_2);
    must_free3 = 1;
  }
  arg4 = scm_is_true(s_3) ? TRUE : FALSE;
  gnc_option_db_set_option_selectable_by_name(arg1,(char const *)arg2,(char const *)arg3,arg4);
  gswig_result = SCM_UNSPECIFIED;
  if (must_free2 && arg2) SWIG_free(arg2);
  if (must_free3 && arg3) SWIG_free(arg3);
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_commodity_table_get_quotable_commodities (SCM s_0)
{
#define FUNC_NAME "gnc-commodity-table-get-quotable-commodities"
  gnc_commodity_table *arg1 = (gnc_commodity_table *) 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GncCommodityList *result = 0 ;
  
  {
    arg1 = (gnc_commodity_table *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_gnc_commodity_table, 1, 0);
  }
  result = (GncCommodityList *)gnc_commodity_table_get_quotable_commodities((gnc_commodity_table const *)arg1);
  {
    SCM list = SCM_EOL;
    GList *node;
    
    for (node = result; node; node = node->next)
    list = scm_cons(gnc_quoteinfo2scm(node->data), list);
    
    gswig_result = scm_reverse(list);
  }
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_default_currency ()
{
#define FUNC_NAME "gnc-default-currency"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gnc_commodity *result = 0 ;
  
  result = (gnc_commodity *)gnc_default_currency();
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_gnc_commodity, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_default_report_currency ()
{
#define FUNC_NAME "gnc-default-report-currency"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gnc_commodity *result = 0 ;
  
  result = (gnc_commodity *)gnc_default_report_currency();
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_gnc_commodity, 0);
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gncp_option_invoke_callback (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gncp-option-invoke-callback"
  GNCOptionChangeCallback arg1 = (GNCOptionChangeCallback) 0 ;
  void *arg2 = (void *) 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  {
    arg1 = (GNCOptionChangeCallback)SWIG_MustGetPtr(s_0, SWIGTYPE_p_f_p_void__void, 1, 0);
  }
  {
    arg2 = (void *)SWIG_MustGetPtr(s_1, NULL, 2, 0);
  }
  gncp_option_invoke_callback(arg1,arg2);
  gswig_result = SCM_UNSPECIFIED;
  
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_option_db_register_option (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-option-db-register-option"
  GNCOptionDBHandle arg1 ;
  SCM arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  {
    arg1 = (GNCOptionDBHandle) scm_to_int(s_0);
  }
  arg2=s_1;
  gnc_option_db_register_option(arg1,arg2);
  gswig_result = SCM_UNSPECIFIED;
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_default_print_info (SCM s_0)
{
#define FUNC_NAME "gnc-default-print-info"
  gboolean arg1 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GNCPrintAmountInfo result;
  
  arg1 = scm_is_true(s_0) ? TRUE : FALSE;
  result = gnc_default_print_info(arg1);
  gswig_result = gnc_printinfo2scm(result);
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_account_print_info (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-account-print-info"
  Account *arg1 = (Account *) 0 ;
  gboolean arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GNCPrintAmountInfo result;
  
  {
    arg1 = (Account *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_Account, 1, 0);
  }
  arg2 = scm_is_true(s_1) ? TRUE : FALSE;
  result = gnc_account_print_info((Account const *)arg1,arg2);
  gswig_result = gnc_printinfo2scm(result);
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_commodity_print_info (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-commodity-print-info"
  gnc_commodity *arg1 = (gnc_commodity *) 0 ;
  gboolean arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GNCPrintAmountInfo result;
  
  {
    arg1 = (gnc_commodity *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_gnc_commodity, 1, 0);
  }
  arg2 = scm_is_true(s_1) ? TRUE : FALSE;
  result = gnc_commodity_print_info((gnc_commodity const *)arg1,arg2);
  gswig_result = gnc_printinfo2scm(result);
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_share_print_info_places (SCM s_0)
{
#define FUNC_NAME "gnc-share-print-info-places"
  int arg1 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GNCPrintAmountInfo result;
  
  {
    arg1 = (int) scm_to_int(s_0);
  }
  result = gnc_share_print_info_places(arg1);
  gswig_result = gnc_printinfo2scm(result);
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_xaccPrintAmount (SCM s_0, SCM s_1)
{
#define FUNC_NAME "xaccPrintAmount"
  gnc_numeric arg1 ;
  GNCPrintAmountInfo arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  char *result = 0 ;
  
  arg1 = gnc_scm_to_numeric(s_0);
  arg2 = gnc_scm2printinfo(s_1);
  result = (char *)xaccPrintAmount(arg1,arg2);
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_number_to_words (SCM s_0, SCM s_1)
{
#define FUNC_NAME "number-to-words"
  gdouble arg1 ;
  gint64 arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gchar *result = 0 ;
  
  {
    arg1 = (gdouble) scm_to_double(s_0);
  }
  arg2 = scm_to_int64(s_1); 
  result = (gchar *)number_to_words(arg1,arg2);
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_printable_value (SCM s_0, SCM s_1)
{
#define FUNC_NAME "printable-value"
  gdouble arg1 ;
  gint arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gchar *result = 0 ;
  
  {
    arg1 = (gdouble) scm_to_double(s_0);
  }
  {
    arg2 = (gint) scm_to_int(s_1);
  }
  result = (gchar *)printable_value(arg1,arg2);
  {
    gswig_result = SCM_UNSPECIFIED;
    if (result) {
      gswig_result = scm_from_utf8_string((const char *)result);
    }
    if (!result || !scm_is_true(gswig_result)) {
      gswig_result = scm_c_make_string(0, SCM_UNDEFINED);
    }
  }
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_reverse_balance (SCM s_0)
{
#define FUNC_NAME "gnc-reverse-balance"
  Account *arg1 = (Account *) 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gboolean result;
  
  {
    arg1 = (Account *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_Account, 1, 0);
  }
  result = gnc_reverse_balance((Account const *)arg1);
  gswig_result = result ? SCM_BOOL_T : SCM_BOOL_F;
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_is_euro_currency (SCM s_0)
{
#define FUNC_NAME "gnc-is-euro-currency"
  gnc_commodity *arg1 = (gnc_commodity *) 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gboolean result;
  
  {
    arg1 = (gnc_commodity *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_gnc_commodity, 1, 0);
  }
  result = gnc_is_euro_currency((gnc_commodity const *)arg1);
  gswig_result = result ? SCM_BOOL_T : SCM_BOOL_F;
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_convert_to_euro (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-convert-to-euro"
  gnc_commodity *arg1 = (gnc_commodity *) 0 ;
  gnc_numeric arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gnc_numeric result;
  
  {
    arg1 = (gnc_commodity *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_gnc_commodity, 1, 0);
  }
  arg2 = gnc_scm_to_numeric(s_1);
  result = gnc_convert_to_euro((gnc_commodity const *)arg1,arg2);
  gswig_result = gnc_numeric_to_scm(result);
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_convert_from_euro (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-convert-from-euro"
  gnc_commodity *arg1 = (gnc_commodity *) 0 ;
  gnc_numeric arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gnc_numeric result;
  
  {
    arg1 = (gnc_commodity *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_gnc_commodity, 1, 0);
  }
  arg2 = gnc_scm_to_numeric(s_1);
  result = gnc_convert_from_euro((gnc_commodity const *)arg1,arg2);
  gswig_result = gnc_numeric_to_scm(result);
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_accounting_period_fiscal_start ()
{
#define FUNC_NAME "gnc-accounting-period-fiscal-start"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  time64 result;
  
  result = gnc_accounting_period_fiscal_start();
  gswig_result = scm_from_int64(result); 
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_accounting_period_fiscal_end ()
{
#define FUNC_NAME "gnc-accounting-period-fiscal-end"
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  time64 result;
  
  result = gnc_accounting_period_fiscal_end();
  gswig_result = scm_from_int64(result); 
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_make_kvp_options (SCM s_0)
{
#define FUNC_NAME "gnc-make-kvp-options"
  QofIdType arg1 ;
  QofIdType *argp1 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  SCM result;
  
  {
    argp1 = (QofIdType *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_QofIdType, 1, 0);
    arg1 = *argp1;
  }
  result = (SCM)gnc_make_kvp_options(arg1);
  gswig_result=result;
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_register_kvp_option_generator (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-register-kvp-option-generator"
  QofIdType arg1 ;
  SCM arg2 ;
  QofIdType *argp1 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  {
    argp1 = (QofIdType *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_QofIdType, 1, 0);
    arg1 = *argp1;
  }
  arg2=s_1;
  gnc_register_kvp_option_generator(arg1,arg2);
  gswig_result = SCM_UNSPECIFIED;
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_spawn_process_async (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-spawn-process-async"
  GList *arg1 = (GList *) 0 ;
  gboolean arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  Process *result = 0 ;
  
  {
    SCM path_scm = s_0;
    GList *path = NULL;
    while (!scm_is_null (path_scm))
    {
      SCM key_scm = SCM_CAR (path_scm);
      char *key;
      gchar* gkey;
      if (!scm_is_string (key_scm))
      break;
      key = scm_to_locale_string (key_scm);
      gkey = g_strdup (key);
      free (key);
      path = g_list_prepend (path, gkey);
      path_scm = SCM_CDR (path_scm);
    }
    arg1 = g_list_reverse (path);
  }
  arg2 = scm_is_true(s_1) ? TRUE : FALSE;
  result = (Process *)gnc_spawn_process_async(arg1,arg2);
  {
    gswig_result = SWIG_NewPointerObj (result, SWIGTYPE_p_Process, 0);
  }
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_process_get_fd (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-process-get-fd"
  Process *arg1 = (Process *) 0 ;
  guint arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  gint result;
  
  {
    arg1 = (Process *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_Process, 1, 0);
  }
  {
    arg2 = (guint) scm_to_uint(s_1);
  }
  result = (gint)gnc_process_get_fd((Process const *)arg1,arg2);
  {
    gswig_result = scm_from_long(result);
  }
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_detach_process (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-detach-process"
  Process *arg1 = (Process *) 0 ;
  gboolean arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  
  {
    arg1 = (Process *)SWIG_MustGetPtr(s_0, SWIGTYPE_p_Process, 1, 0);
  }
  arg2 = scm_is_true(s_1) ? TRUE : FALSE;
  gnc_detach_process(arg1,arg2);
  gswig_result = SCM_UNSPECIFIED;
  
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_parse_time_to_time64 (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-parse-time-to-time64"
  gchar *arg1 = (gchar *) 0 ;
  gchar *arg2 = (gchar *) 0 ;
  int must_free1 = 0 ;
  int must_free2 = 0 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  time64 result;
  
  {
    arg1 = (gchar *)SWIG_scm2str(s_0);
    must_free1 = 1;
  }
  {
    arg2 = (gchar *)SWIG_scm2str(s_1);
    must_free2 = 1;
  }
  result = gnc_parse_time_to_time64((char const *)arg1,(char const *)arg2);
  gswig_result = scm_from_int64(result); 
  if (must_free1 && arg1) SWIG_free(arg1);
  if (must_free2 && arg2) SWIG_free(arg2);
  
  return gswig_result;
#undef FUNC_NAME
}


static SCM
_wrap_gnc_sx_all_instantiate_cashflow_all (SCM s_0, SCM s_1)
{
#define FUNC_NAME "gnc-sx-all-instantiate-cashflow-all"
  GDate arg1 ;
  GDate arg2 ;
  SCM gswig_result;
  SWIGUNUSED int gswig_list_p = 0;
  GHashTable *result = 0 ;
  
  arg1 = gnc_timepair_to_GDate(s_0);
  arg2 = gnc_timepair_to_GDate(s_1);
  result = (GHashTable *)gnc_sx_all_instantiate_cashflow_all(arg1,arg2);
  {
    SCM table = scm_c_make_hash_table (g_hash_table_size(result) + 17);
    GHashTableIter iter;
    gpointer key, value;
    
    g_hash_table_iter_init (&iter, result);
    while (g_hash_table_iter_next (&iter, &key, &value)) {
      const GncGUID* c_guid = (const GncGUID*) key;
      const gnc_numeric* c_numeric = (const gnc_numeric*) value;
      SCM scm_guid = gnc_guid2scm(*c_guid);
      SCM scm_numeric = gnc_numeric_to_scm(*c_numeric);
      
      scm_hash_set_x(table, scm_guid, scm_numeric);
    }
    g_hash_table_destroy(result);
    gswig_result = table;
  }
  
  return gswig_result;
#undef FUNC_NAME
}


#ifdef __cplusplus
extern "C" {
#endif

/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */

static swig_type_info _swigt__p_Account = {"_p_Account", "Account *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GDate = {"_p_GDate", "GDate *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GList = {"_p_GList", "GList *|GncCommodityList *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GNCOptionDB = {"_p_GNCOptionDB", "GNCOptionDB *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_GNCPrintAmountInfo = {"_p_GNCPrintAmountInfo", "GNCPrintAmountInfo *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_Process = {"_p_Process", "Process *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_QofBook = {"_p_QofBook", "QofBook *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_QofIdType = {"_p_QofIdType", "QofIdType *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_QofSession = {"_p_QofSession", "QofSession *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_char = {"_p_char", "gchar *|char *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_double = {"_p_double", "double *|gdouble *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_f_p_void__void = {"_p_f_p_void__void", "void (*)(void *)|GNCOptionChangeCallback", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_float = {"_p_float", "float *|gfloat *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_gboolean = {"_p_gboolean", "gboolean *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_gint64 = {"_p_gint64", "gint64 *|time64 *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_gnc_commodity = {"_p_gnc_commodity", "gnc_commodity *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_gnc_commodity_table = {"_p_gnc_commodity_table", "gnc_commodity_table *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_gnc_numeric = {"_p_gnc_numeric", "gnc_numeric *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_int = {"_p_int", "int *|gint *|GNCOptionDBHandle *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "guint *|unsigned int *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "SCM *|unsigned long *", 0, 0, (void*)0, 0};

static swig_type_info *swig_type_initial[] = {
  &_swigt__p_Account,
  &_swigt__p_GDate,
  &_swigt__p_GList,
  &_swigt__p_GNCOptionDB,
  &_swigt__p_GNCPrintAmountInfo,
  &_swigt__p_Process,
  &_swigt__p_QofBook,
  &_swigt__p_QofIdType,
  &_swigt__p_QofSession,
  &_swigt__p_char,
  &_swigt__p_double,
  &_swigt__p_f_p_void__void,
  &_swigt__p_float,
  &_swigt__p_gboolean,
  &_swigt__p_gint64,
  &_swigt__p_gnc_commodity,
  &_swigt__p_gnc_commodity_table,
  &_swigt__p_gnc_numeric,
  &_swigt__p_int,
  &_swigt__p_unsigned_int,
  &_swigt__p_unsigned_long,
};

static swig_cast_info _swigc__p_Account[] = {  {&_swigt__p_Account, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GDate[] = {  {&_swigt__p_GDate, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GList[] = {  {&_swigt__p_GList, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GNCOptionDB[] = {  {&_swigt__p_GNCOptionDB, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_GNCPrintAmountInfo[] = {  {&_swigt__p_GNCPrintAmountInfo, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_Process[] = {  {&_swigt__p_Process, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_QofBook[] = {  {&_swigt__p_QofBook, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_QofIdType[] = {  {&_swigt__p_QofIdType, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_QofSession[] = {  {&_swigt__p_QofSession, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_f_p_void__void[] = {  {&_swigt__p_f_p_void__void, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_gboolean[] = {  {&_swigt__p_gboolean, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_gint64[] = {  {&_swigt__p_gint64, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_gnc_commodity[] = {  {&_swigt__p_gnc_commodity, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_gnc_commodity_table[] = {  {&_swigt__p_gnc_commodity_table, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_gnc_numeric[] = {  {&_swigt__p_gnc_numeric, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_long[] = {  {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};

static swig_cast_info *swig_cast_initial[] = {
  _swigc__p_Account,
  _swigc__p_GDate,
  _swigc__p_GList,
  _swigc__p_GNCOptionDB,
  _swigc__p_GNCPrintAmountInfo,
  _swigc__p_Process,
  _swigc__p_QofBook,
  _swigc__p_QofIdType,
  _swigc__p_QofSession,
  _swigc__p_char,
  _swigc__p_double,
  _swigc__p_f_p_void__void,
  _swigc__p_float,
  _swigc__p_gboolean,
  _swigc__p_gint64,
  _swigc__p_gnc_commodity,
  _swigc__p_gnc_commodity_table,
  _swigc__p_gnc_numeric,
  _swigc__p_int,
  _swigc__p_unsigned_int,
  _swigc__p_unsigned_long,
};


/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */

/* -----------------------------------------------------------------------------
 * Type initialization:
 * This problem is tough by the requirement that no dynamic
 * memory is used. Also, since swig_type_info structures store pointers to
 * swig_cast_info structures and swig_cast_info structures store pointers back
 * to swig_type_info structures, we need some lookup code at initialization.
 * The idea is that swig generates all the structures that are needed.
 * The runtime then collects these partially filled structures.
 * The SWIG_InitializeModule function takes these initial arrays out of
 * swig_module, and does all the lookup, filling in the swig_module.types
 * array with the correct data and linking the correct swig_cast_info
 * structures together.
 *
 * The generated swig_type_info structures are assigned statically to an initial
 * array. We just loop through that array, and handle each type individually.
 * First we lookup if this type has been already loaded, and if so, use the
 * loaded structure instead of the generated one. Then we have to fill in the
 * cast linked list. The cast data is initially stored in something like a
 * two-dimensional array. Each row corresponds to a type (there are the same
 * number of rows as there are in the swig_type_initial array). Each entry in
 * a column is one of the swig_cast_info structures for that type.
 * The cast_initial array is actually an array of arrays, because each row has
 * a variable number of columns. So to actually build the cast linked list,
 * we find the array of casts associated with the type, and loop through it
 * adding the casts to the list. The one last trick we need to do is making
 * sure the type pointer in the swig_cast_info struct is correct.
 *
 * First off, we lookup the cast->type name to see if it is already loaded.
 * There are three cases to handle:
 *  1) If the cast->type has already been loaded AND the type we are adding
 *     casting info to has not been loaded (it is in this module), THEN we
 *     replace the cast->type pointer with the type pointer that has already
 *     been loaded.
 *  2) If BOTH types (the one we are adding casting info to, and the
 *     cast->type) are loaded, THEN the cast info has already been loaded by
 *     the previous module so we just ignore it.
 *  3) Finally, if cast->type has not already been loaded, then we add that
 *     swig_cast_info to the linked list (because the cast->type) pointer will
 *     be correct.
 * ----------------------------------------------------------------------------- */

#ifdef __cplusplus
extern "C" {
#if 0
} /* c-mode */
#endif
#endif

#if 0
#define SWIGRUNTIME_DEBUG
#endif


SWIGRUNTIME void
SWIG_InitializeModule(void *clientdata) {
  size_t i;
  swig_module_info *module_head, *iter;
  int init;
  
  /* check to see if the circular list has been setup, if not, set it up */
  if (swig_module.next==0) {
    /* Initialize the swig_module */
    swig_module.type_initial = swig_type_initial;
    swig_module.cast_initial = swig_cast_initial;
    swig_module.next = &swig_module;
    init = 1;
  } else {
    init = 0;
  }
  
  /* Try and load any already created modules */
  module_head = SWIG_GetModule(clientdata);
  if (!module_head) {
    /* This is the first module loaded for this interpreter */
    /* so set the swig module into the interpreter */
    SWIG_SetModule(clientdata, &swig_module);
  } else {
    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    iter=module_head;
    do {
      if (iter==&swig_module) {
        /* Our module is already in the list, so there's nothing more to do. */
        return;
      }
      iter=iter->next;
    } while (iter!= module_head);
    
    /* otherwise we must add our module into the list */
    swig_module.next = module_head->next;
    module_head->next = &swig_module;
  }
  
  /* When multiple interpreters are used, a module could have already been initialized in
       a different interpreter, but not yet have a pointer in this interpreter.
       In this case, we do not want to continue adding types... everything should be
       set up already */
  if (init == 0) return;
  
  /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
  for (i = 0; i < swig_module.size; ++i) {
    swig_type_info *type = 0;
    swig_type_info *ret;
    swig_cast_info *cast;
    
#ifdef SWIGRUNTIME_DEBUG
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
    
    /* if there is another module already loaded */
    if (swig_module.next != &swig_module) {
      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
    }
    if (type) {
      /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
      if (swig_module.type_initial[i]->clientdata) {
        type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
      }
    } else {
      type = swig_module.type_initial[i];
    }
    
    /* Insert casting types */
    cast = swig_module.cast_initial[i];
    while (cast->type) {
      /* Don't need to add information already in the list */
      ret = 0;
#ifdef SWIGRUNTIME_DEBUG
      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
      if (swig_module.next != &swig_module) {
        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
      }
      if (ret) {
        if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
          cast->type = ret;
          ret = 0;
        } else {
          /* Check for casting already in the list */
          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
          if (!ocast) ret = 0;
        }
      }
      
      if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
        if (type->cast) {
          type->cast->prev = cast;
          cast->next = type->cast;
        }
        type->cast = cast;
      }
      cast++;
    }
    /* Set entry in modules->types array equal to the type */
    swig_module.types[i] = type;
  }
  swig_module.types[i] = 0;
  
#ifdef SWIGRUNTIME_DEBUG
  printf("**** SWIG_InitializeModule: Cast List ******\n");
  for (i = 0; i < swig_module.size; ++i) {
    int j = 0;
    swig_cast_info *cast = swig_module.cast_initial[i];
    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
    while (cast->type) {
      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
      cast++;
      ++j;
    }
    printf("---- Total casts: %d\n",j);
  }
  printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}

/* This function will propagate the clientdata field of type to
* any new swig_type_info structures that have been added into the list
* of equivalent types.  It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
SWIGRUNTIME void
SWIG_PropagateClientData(void) {
  size_t i;
  swig_cast_info *equiv;
  static int init_run = 0;
  
  if (init_run) return;
  init_run = 1;
  
  for (i = 0; i < swig_module.size; i++) {
    if (swig_module.types[i]->clientdata) {
      equiv = swig_module.types[i]->cast;
      while (equiv) {
        if (!equiv->converter) {
          if (equiv->type && !equiv->type->clientdata)
          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
        }
        equiv = equiv->next;
      }
    }
  }
}

#ifdef __cplusplus
#if 0
{
  /* c-mode */
#endif
}
#endif


SWIG_GUILE_INIT_STATIC void
SWIG_init(void)
{
  SWIG_InitializeModule(0);
  SWIG_PropagateClientData();
  
  scm_c_define_gsubr("gnc-prefs-init", 0, 0, 0, (swig_guile_proc) _wrap_gnc_prefs_init);
  scm_c_define_gsubr("gnc-get-current-book", 0, 0, 0, (swig_guile_proc) _wrap_gnc_get_current_book);
  scm_c_define_gsubr("gnc-get-current-session", 0, 0, 0, (swig_guile_proc) _wrap_gnc_get_current_session);
  scm_c_define_gsubr("gnc-get-current-book-tax-name", 0, 0, 0, (swig_guile_proc) _wrap_gnc_get_current_book_tax_name);
  scm_c_define_gsubr("gnc-get-current-book-tax-type", 0, 0, 0, (swig_guile_proc) _wrap_gnc_get_current_book_tax_type);
  scm_c_define_gsubr("gnc-get-current-root-account", 0, 0, 0, (swig_guile_proc) _wrap_gnc_get_current_root_account);
  scm_c_define_gsubr("gnc-gettext-helper", 1, 0, 0, (swig_guile_proc) _wrap_gnc_gettext_helper);
  scm_c_define_gsubr("gnc-option-db-new", 1, 0, 0, (swig_guile_proc) _wrap_gnc_option_db_new);
  scm_c_define_gsubr("gnc-option-db-destroy", 1, 0, 0, (swig_guile_proc) _wrap_gnc_option_db_destroy);
  scm_c_define_gsubr("gnc-option-db-set-option-selectable-by-name", 4, 0, 0, (swig_guile_proc) _wrap_gnc_option_db_set_option_selectable_by_name);
  scm_c_define_gsubr("gnc-commodity-table-get-quotable-commodities", 1, 0, 0, (swig_guile_proc) _wrap_gnc_commodity_table_get_quotable_commodities);
  scm_c_define_gsubr("gnc-default-currency", 0, 0, 0, (swig_guile_proc) _wrap_gnc_default_currency);
  scm_c_define_gsubr("gnc-default-report-currency", 0, 0, 0, (swig_guile_proc) _wrap_gnc_default_report_currency);
  scm_c_define_gsubr("gncp-option-invoke-callback", 2, 0, 0, (swig_guile_proc) _wrap_gncp_option_invoke_callback);
  scm_c_define_gsubr("gnc-option-db-register-option", 2, 0, 0, (swig_guile_proc) _wrap_gnc_option_db_register_option);
  scm_c_define_gsubr("gnc-default-print-info", 1, 0, 0, (swig_guile_proc) _wrap_gnc_default_print_info);
  scm_c_define_gsubr("gnc-account-print-info", 2, 0, 0, (swig_guile_proc) _wrap_gnc_account_print_info);
  scm_c_define_gsubr("gnc-commodity-print-info", 2, 0, 0, (swig_guile_proc) _wrap_gnc_commodity_print_info);
  scm_c_define_gsubr("gnc-share-print-info-places", 1, 0, 0, (swig_guile_proc) _wrap_gnc_share_print_info_places);
  scm_c_define_gsubr("xaccPrintAmount", 2, 0, 0, (swig_guile_proc) _wrap_xaccPrintAmount);
  scm_c_define_gsubr("number-to-words", 2, 0, 0, (swig_guile_proc) _wrap_number_to_words);
  scm_c_define_gsubr("printable-value", 2, 0, 0, (swig_guile_proc) _wrap_printable_value);
  scm_c_define_gsubr("gnc-reverse-balance", 1, 0, 0, (swig_guile_proc) _wrap_gnc_reverse_balance);
  scm_c_define_gsubr("gnc-is-euro-currency", 1, 0, 0, (swig_guile_proc) _wrap_gnc_is_euro_currency);
  scm_c_define_gsubr("gnc-convert-to-euro", 2, 0, 0, (swig_guile_proc) _wrap_gnc_convert_to_euro);
  scm_c_define_gsubr("gnc-convert-from-euro", 2, 0, 0, (swig_guile_proc) _wrap_gnc_convert_from_euro);
  scm_c_define_gsubr("gnc-accounting-period-fiscal-start", 0, 0, 0, (swig_guile_proc) _wrap_gnc_accounting_period_fiscal_start);
  scm_c_define_gsubr("gnc-accounting-period-fiscal-end", 0, 0, 0, (swig_guile_proc) _wrap_gnc_accounting_period_fiscal_end);
  scm_c_define_gsubr("gnc-make-kvp-options", 1, 0, 0, (swig_guile_proc) _wrap_gnc_make_kvp_options);
  scm_c_define_gsubr("gnc-register-kvp-option-generator", 2, 0, 0, (swig_guile_proc) _wrap_gnc_register_kvp_option_generator);
  scm_c_define_gsubr("gnc-spawn-process-async", 2, 0, 0, (swig_guile_proc) _wrap_gnc_spawn_process_async);
  scm_c_define_gsubr("gnc-process-get-fd", 2, 0, 0, (swig_guile_proc) _wrap_gnc_process_get_fd);
  scm_c_define_gsubr("gnc-detach-process", 2, 0, 0, (swig_guile_proc) _wrap_gnc_detach_process);
  scm_c_define_gsubr("gnc-parse-time-to-time64", 2, 0, 0, (swig_guile_proc) _wrap_gnc_parse_time_to_time64);
  scm_c_define_gsubr("gnc-sx-all-instantiate-cashflow-all", 2, 0, 0, (swig_guile_proc) _wrap_gnc_sx_all_instantiate_cashflow_all);
}

#ifdef __cplusplus
}
#endif

/* Linkage: module */
static void SWIG_init_helper(void *data)
{
SWIG_init();
scm_c_export("gnc-prefs-init", "gnc-get-current-book", "gnc-get-current-session", "gnc-get-current-book-tax-name", "gnc-get-current-book-tax-type", "gnc-get-current-root-account", "gnc-gettext-helper", "gnc-option-db-new", "gnc-option-db-destroy", "gnc-option-db-set-option-selectable-by-name", "gnc-commodity-table-get-quotable-commodities", "gnc-default-currency", "gnc-default-report-currency", "gncp-option-invoke-callback", "gnc-option-db-register-option", "gnc-default-print-info", "gnc-account-print-info", "gnc-commodity-print-info", "gnc-share-print-info-places", "xaccPrintAmount", "number-to-words", "printable-value", "gnc-reverse-balance", "gnc-is-euro-currency", "gnc-convert-to-euro", "gnc-convert-from-euro", "gnc-accounting-period-fiscal-start", "gnc-accounting-period-fiscal-end", "gnc-make-kvp-options", "gnc-register-kvp-option-generator", "gnc-spawn-process-async", "gnc-process-get-fd", "gnc-detach-process", "gnc-parse-time-to-time64", "gnc-sx-all-instantiate-cashflow-all", NULL);
}

SCM
scm_init_sw_app_utils_module (void)
{
scm_c_define_module("sw_app_utils",
  SWIG_init_helper, NULL);
return SCM_UNSPECIFIED;
}

