|
GnuCash 2.4.99
|
00001 /********************************************************************\ 00002 * guile-util.h -- utility functions for using guile for GnuCash * 00003 * Copyright (C) 1999 Linas Vepstas * 00004 * * 00005 * This program is free software; you can redistribute it and/or * 00006 * modify it under the terms of the GNU General Public License as * 00007 * published by the Free Software Foundation; either version 2 of * 00008 * the License, or (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License* 00016 * along with this program; if not, contact: * 00017 * * 00018 * Free Software Foundation Voice: +1-617-542-5942 * 00019 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 * 00020 * Boston, MA 02110-1301, USA gnu@gnu.org * 00021 * * 00022 \********************************************************************/ 00023 00024 #ifndef GUILE_UTIL_H 00025 #define GUILE_UTIL_H 00026 00027 #include <glib.h> 00028 #include <libguile.h> 00029 00030 #include "qof.h" 00031 #include "Account.h" 00032 00033 00034 /* Helpful functions for calling functions that return 00035 * specific kinds of values. These functions do error 00036 * checking to verify the result is of the correct type. */ 00037 char * gnc_guile_call1_to_string(SCM func, SCM arg); 00038 char * gnc_guile_call1_symbol_to_string(SCM func, SCM arg); 00039 SCM gnc_guile_call1_to_procedure(SCM func, SCM arg); 00040 SCM gnc_guile_call1_to_list(SCM func, SCM arg); 00041 SCM gnc_guile_list_ref(SCM list, int index); 00042 SCM gnc_guile_call1_to_vector(SCM func, SCM arg); 00043 00047 gchar * gnc_scm_to_locale_string(SCM scm_string); 00048 00049 /* Don't use this to get hold of symbols that are considered private 00050 * to a given module unless the C code you're writing is considered 00051 * part of that module. */ 00052 SCM gnc_scm_lookup(const char *module, const char *symbol); 00053 00054 /* The next set of functions is for manipulating scheme 00055 * representations of splits and transactions. */ 00056 gboolean gnc_is_split_scm(SCM scm); 00057 gboolean gnc_is_trans_scm(SCM scm); 00058 00059 SCM gnc_copy_split(Split *split, gboolean use_cut_semantics); 00060 void gnc_copy_split_scm_onto_split(SCM split_scm, Split *split, 00061 QofBook *book); 00062 00063 void gnc_split_scm_set_account(SCM split_scm, Account *account); 00064 void gnc_split_scm_set_memo(SCM split_scm, const char *memo); 00065 void gnc_split_scm_set_action(SCM split_scm, const char *action); 00066 void gnc_split_scm_set_reconcile_state(SCM split_scm, char reconcile_state); 00067 void gnc_split_scm_set_amount(SCM split_scm, gnc_numeric amount); 00068 void gnc_split_scm_set_value(SCM split_scm, gnc_numeric value); 00069 00070 char * gnc_split_scm_get_memo(SCM split_scm); 00071 char * gnc_split_scm_get_action(SCM split_scm); 00072 gnc_numeric gnc_split_scm_get_amount(SCM split_scm); 00073 gnc_numeric gnc_split_scm_get_value(SCM split_scm); 00074 00075 SCM gnc_copy_trans(Transaction *trans, gboolean use_cut_semantics); 00076 void gnc_copy_trans_scm_onto_trans(SCM trans_scm, Transaction *trans, 00077 gboolean do_commit, QofBook *book); 00078 void gnc_copy_trans_scm_onto_trans_swap_accounts(SCM trans_scm, 00079 Transaction *trans, 00080 const GncGUID *guid_1, 00081 const GncGUID *guid_2, 00082 gboolean do_commit, 00083 QofBook *book); 00084 00085 void gnc_trans_scm_set_date(SCM trans_scm, Timespec *ts); 00086 void gnc_trans_scm_set_num(SCM trans_scm, const char *num); 00087 void gnc_trans_scm_set_description(SCM trans_scm, const char *description); 00088 void gnc_trans_scm_set_notes(SCM trans_scm, const char *notes); 00089 void gnc_trans_scm_append_split_scm(SCM trans_scm, SCM split_scm); 00090 00091 SCM gnc_trans_scm_get_split_scm(SCM trans_scm, int index); 00092 SCM gnc_trans_scm_get_other_split_scm(SCM trans_scm, SCM split_scm); 00093 int gnc_trans_scm_get_num_splits(SCM trans_scm); 00094 00095 /* Two functions that return string synonyms for the terms 'debit' and 00096 * 'credit' as appropriate for the given account type and user preferences. 00097 * They should be g_freed when no longer needed. */ 00098 char * gnc_get_debit_string(GNCAccountType account_type); 00099 char * gnc_get_credit_string(GNCAccountType account_type); 00100 00108 gchar *gnc_guile_strip_comments (const gchar *text); 00109 00111 typedef struct _Process Process; 00112 00125 Process *gnc_spawn_process_async(GList *argl, const gboolean search_path); 00126 00136 gint gnc_process_get_fd(const Process *proc, const gint std_fd); 00137 00144 void gnc_detach_process(Process *proc, const gboolean kill_it); 00145 00146 #endif 00147 00156 time_t gnc_parse_time_to_timet(const gchar *s, const gchar *format);
1.7.4