00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "config.h"
00026
00027 #include "business-options.h"
00028 #include "swig-runtime.h"
00029
00030 #define FUNC_NAME G_STRFUNC
00031
00032 #define LOOKUP_OPTION(fcn) \
00033 GNCOption *option; \
00034 SCM getter; \
00035 SCM value; \
00036 \
00037 option = gnc_option_db_get_option_by_name (odb, section, name); \
00038 \
00039 if (option == NULL) \
00040 return default_value; \
00041 \
00042 getter = gnc_option_getter (option); \
00043 if (getter == SCM_UNDEFINED) \
00044 return default_value; \
00045 \
00046 value = scm_call_0 (getter); \
00047 if (value == SCM_BOOL_F) \
00048 return NULL; \
00049 SWIG_GetModule(NULL); \
00050 if (!SWIG_IsPointer(value)) \
00051 scm_misc_error(fcn, "SCM is not a wrapped pointer.", value)
00052
00053 GncTaxTable*
00054 gnc_option_db_lookup_taxtable_option(GNCOptionDB *odb,
00055 const char *section,
00056 const char *name,
00057 GncTaxTable * default_value)
00058 {
00059 LOOKUP_OPTION("gnc_option_db_lookup_taxtable_option");
00060 return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncTaxTable"), 1, 0);
00061 }
00062
00063 GncInvoice*
00064 gnc_option_db_lookup_invoice_option(GNCOptionDB *odb,
00065 const char *section,
00066 const char *name,
00067 GncInvoice * default_value)
00068 {
00069 LOOKUP_OPTION("gnc_option_db_lookup_invoice_option");
00070 return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncInvoice"), 1, 0);
00071 }
00072
00073 GncCustomer*
00074 gnc_option_db_lookup_customer_option(GNCOptionDB *odb,
00075 const char *section,
00076 const char *name,
00077 GncCustomer * default_value)
00078 {
00079 LOOKUP_OPTION("gnc_option_db_lookup_customer_option");
00080 return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncCustomer"), 1, 0);
00081 }
00082
00083 GncVendor*
00084 gnc_option_db_lookup_vendor_option(GNCOptionDB *odb,
00085 const char *section,
00086 const char *name,
00087 GncVendor * default_value)
00088 {
00089 LOOKUP_OPTION("gnc_option_db_lookup_vendor_option");
00090 return SWIG_MustGetPtr(value, SWIG_TypeQuery("_p__gncVendor"), 1, 0);
00091 }