5 #include "engine-helpers-guile.h"
8 #include "guile-mappings.h"
9 #include "gnc-guile-utils.h"
10 #include "swig-runtime.h"
20 gnc_scm_to_kvp_value_ptr(SCM val)
22 if (scm_is_number(val))
25 if (scm_is_exact (val) && gnc_gh_gint64_p(val))
27 return kvp_value_new_gint64(scm_to_int64(val));
31 return kvp_value_new_double(scm_to_double(val));
34 else if (gnc_numeric_p(val))
38 else if (gnc_guid_p(val))
40 GncGUID tmpguid = gnc_scm2guid(val);
41 return kvp_value_new_guid(&tmpguid);
43 else if (gnc_timepair_p(val))
45 Timespec ts = gnc_timepair2timespec(val);
46 return kvp_value_new_timespec(ts);
48 else if (scm_is_string(val))
52 newstr = gnc_scm_to_utf8_string (val);
53 ret = kvp_value_new_string(newstr);
57 else if (SWIG_IsPointerOfType(val, SWIG_TypeQuery(
"_p_KvpFrame")))
59 #define FUNC_NAME G_STRFUNC
60 KvpFrame *frame = SWIG_MustGetPtr(val, SWIG_TypeQuery(
"_p_KvpFrame"),
63 return kvp_value_new_frame (frame);
70 gnc_kvp_value_ptr_to_scm(
KvpValue* val)
73 switch (kvp_value_get_type(val))
79 return scm_from_double (kvp_value_get_double(val));
82 return gnc_numeric_to_scm(kvp_value_get_numeric(val));
86 return string ? scm_from_utf8_string(
string) : SCM_BOOL_F;
91 return gnc_guid2scm(*tempguid);
95 return gnc_timespec2timepair(kvp_value_get_timespec(val));
102 return SWIG_NewPointerObj(frame, SWIG_TypeQuery(
"_p_KvpFrame"), 0);
117 gnc_kvp_frame_delete_at_path (
KvpFrame *frame, GSList *key_path)
void kvp_frame_set_slot_path_gslist(KvpFrame *frame, KvpValue *value, GSList *key_path)
Use a 64-bit unsigned int timespec.
gint64 kvp_value_get_gint64(const KvpValue *value)
char * kvp_value_get_string(const KvpValue *value)
#define kvp_value_new_gnc_numeric
GncGUID * kvp_value_get_guid(const KvpValue *value)
struct KvpFrameImpl KvpFrame
GDate kvp_value_get_gdate(const KvpValue *value)
KvpFrame * kvp_value_get_frame(const KvpValue *value)
Timespec gdate_to_timespec(GDate d)
struct KvpValueImpl KvpValue