00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef QOF_DISABLE_DEPRECATED
00024
00025 #ifndef _DEPRECATED_H
00026 #define _DEPRECATED_H
00027 #include "qof.h"
00028
00034 #define gncLogLevel QofLogLevel
00035
00037 void gnc_log_init (void);
00038
00040 void gnc_set_log_level (QofLogModule module, gncLogLevel level);
00041
00043 void gnc_set_log_level_global (gncLogLevel level);
00044
00057 void qof_log_set_level_global (QofLogLevel level);
00058
00060 void gnc_set_logfile (FILE * outfile);
00061
00063 const char *gnc_log_prettify (const char *name);
00064
00066 gboolean gnc_should_log (QofLogModule log_module, gncLogLevel log_level);
00067
00069 #define GNC_LOG_FATAL QOF_LOG_FATAL
00070
00071 #define GNC_LOG_ERROR QOF_LOG_ERROR
00072
00073 #define GNC_LOG_WARNING QOF_LOG_WARNING
00074
00075 #define GNC_LOG_INFO QOF_LOG_INFO
00076
00077 #define GNC_LOG_DEBUG QOF_LOG_DEBUG
00078
00079 #define GNC_LOG_DETAIL QOF_LOG_DETAIL
00080
00081 #define GNC_LOG_TRACE QOF_LOG_TRACE
00082
00084 void gnc_start_clock (int, QofLogModule, gncLogLevel, const char *,
00085 const char *, ...);
00087 void gnc_report_clock (int, QofLogModule, gncLogLevel, const char *,
00088 const char *, ...);
00090 void gnc_report_clock_total (int, QofLogModule, gncLogLevel, const char *,
00091 const char *, ...);
00092
00094 #define GNC_EVENT_NONE QOF_EVENT_NONE
00095
00096 #define GNC_EVENT_CREATE QOF_EVENT_CREATE
00097
00098 #define GNC_EVENT_MODIFY QOF_EVENT_MODIFY
00099
00100 #define GNC_EVENT_DESTROY QOF_EVENT_DESTROY
00101
00102 #define GNC_EVENT_ADD QOF_EVENT_ADD
00103
00104 #define GNC_EVENT_REMOVE QOF_EVENT_REMOVE
00105
00106 #define GNC_EVENT_ALL QOF_EVENT_ALL
00107
00108 #define GNCEngineEventType QofEventId
00109
00110 typedef void (*GNCEngineEventHandler) (GUID * entity, QofIdType type,
00111 GNCEngineEventType event_type,
00112 gpointer user_data);
00116 gint qof_event_register_old_handler (GNCEngineEventHandler old_handler,
00117 gpointer user_data);
00119 gint gnc_engine_register_event_handler (GNCEngineEventHandler handler,
00120 gpointer user_data);
00122 void gnc_engine_unregister_event_handler (gint handler_id);
00124 void gnc_engine_gen_event (QofEntity * entity, GNCEngineEventType event_type);
00126 void gnc_engine_suspend_events (void);
00128 void gnc_engine_resume_events (void);
00130 void gnc_engine_generate_event (const GUID * guid, QofIdType e_type,
00131 GNCEngineEventType event_type);
00133 #define qof_book_mergeResult QofBookMergeResult
00134
00135 #define qof_book_mergeRule QofBookMergeRule
00136
00137 #define qof_book_mergeData QofBookMergeData
00138
00139 QofBookMergeData *qof_book_mergeInit (QofBook * importBook,
00140 QofBook * targetBook);
00142 typedef void (*qof_book_mergeRuleForeachCB) (QofBookMergeData *,
00143 QofBookMergeRule *, guint);
00145 void qof_book_mergeRuleForeach (QofBookMergeData * mergeData,
00146 QofBookMergeRuleForeachCB callback,
00147 QofBookMergeResult mergeResult);
00149 QofBookMergeData *qof_book_mergeUpdateResult (QofBookMergeData * mergeData,
00150 QofBookMergeResult tag);
00152 gint qof_book_mergeCommit (QofBookMergeData * mergeData);
00155 #define SAFE_STRCMP_REAL(fcn,da,db) { \
00156 if ((da) && (db)) { \
00157 if ((da) != (db)) { \
00158 gint retval = fcn ((da), (db)); \
00159 \
00160 if (retval) return retval; \
00161 } \
00162 } else \
00163 if ((!(da)) && (db)) { \
00164 return -1; \
00165 } else \
00166 if ((da) && (!(db))) { \
00167 return +1; \
00168 } \
00169 }
00170
00171 #define SAFE_STRCMP(da,db) SAFE_STRCMP_REAL(strcmp,(da),(db))
00172
00173 #define SAFE_STRCASECMP(da,db) SAFE_STRCMP_REAL(strcasecmp,(da),(db))
00174
00175 gpointer gnc_string_cache_insert (gconstpointer key);
00177 #define GNC_SCANF_LLD QOF_SCANF_LLD
00178
00179 gchar *gnc_stpcpy (gchar * dest, const gchar * src);
00181 GCache *gnc_engine_get_string_cache (void);
00183 GCache *qof_util_get_string_cache (void);
00185 void gnc_engine_string_cache_destroy (void);
00187 void gnc_string_cache_remove (gconstpointer key);
00189 void qof_book_set_schedxactions (QofBook * book, GList * newList);
00191 typedef enum
00192 {
00194 GNCDATE_MONTH_NUMBER,
00196 GNCDATE_MONTH_ABBREV,
00198 GNCDATE_MONTH_NAME
00199 } GNCDateMonthFormat;
00201 const gchar* gnc_date_dateformat_to_string(QofDateFormat format);
00203 const gchar* gnc_date_monthformat_to_string(GNCDateMonthFormat format);
00212 gboolean gnc_date_string_to_dateformat (const gchar * format_string,
00213 QofDateFormat * format);
00215 gboolean gnc_date_string_to_monthformat (const gchar * format_string,
00216 GNCDateMonthFormat * format);
00218 gboolean timespec_equal (const Timespec * ta, const Timespec * tb);
00220 gint timespec_cmp (const Timespec * ta, const Timespec * tb);
00222 Timespec timespec_diff (const Timespec * ta, const Timespec * tb);
00224 Timespec timespec_abs (const Timespec * t);
00226 Timespec timespecCanonicalDayTime (Timespec t);
00228 time_t timespecToTime_t (Timespec ts);
00230 void timespecFromTime_t (Timespec * ts, time_t t);
00232 Timespec gnc_dmy2timespec (gint day, gint month, gint year);
00234 Timespec gnc_dmy2timespec_end (gint day, gint month, gint year);
00236 Timespec gnc_iso8601_to_timespec_gmt (const gchar *);
00238 gchar *gnc_timespec_to_iso8601_buff (Timespec ts, gchar * buff);
00240 void gnc_timespec2dmy (Timespec ts, gint * day, gint * month, gint * year);
00242 void date_add_months (struct tm *tm, gint months, gboolean track_last_day);
00244 gboolean qof_date_add_days(Timespec *ts, gint days);
00246 gboolean qof_date_add_months(Timespec *ts, gint months, gboolean track_last_day);
00248 const gchar *qof_date_format_get_string(QofDateFormat df);
00250 time_t xaccDMYToSec (gint day, gint month, gint year);
00252 glong gnc_timezone (struct tm *tm);
00254 QofDateFormat qof_date_format_get(void);
00256 void qof_date_format_set(QofDateFormat df);
00258 const gchar *qof_date_text_format_get_string(QofDateFormat df);
00260 char dateSeparator (void);
00263 time_t qof_date_dmy_to_sec (gint day, gint month, gint year);
00265 size_t qof_print_hours_elapsed_buff (char *buff, size_t len, int secs,
00266 gboolean show_secs);
00268 size_t qof_print_minutes_elapsed_buff (char *buff, size_t len, int secs,
00269 gboolean show_secs);
00271 size_t qof_print_time_buff (char *buff, size_t len, time_t secs);
00273 size_t qof_print_date_time_buff (char *buff, size_t len, time_t secs);
00275 gboolean qof_is_same_day (time_t, time_t);
00277 void gnc_tm_get_day_start (struct tm *tm, time_t time_val);
00279 void gnc_tm_set_day_start (struct tm *tm);
00281 void gnc_tm_set_day_middle (struct tm *tm);
00283 void gnc_tm_set_day_end (struct tm *tm);
00285 void gnc_tm_get_day_end (struct tm *tm, time_t time_val);
00287 time_t gnc_timet_get_day_start (time_t time_val);
00289 time_t gnc_timet_get_day_end (time_t time_val);
00291 void gnc_tm_get_today_start (struct tm *tm);
00293 void gnc_tm_get_today_end (struct tm *tm);
00295 time_t gnc_timet_get_today_start (void);
00297 time_t gnc_timet_get_today_end (void);
00298 #ifndef GNUCASH_MAJOR_VERSION
00299
00300 time_t gnc_timet_get_day_start_gdate (GDate * date);
00302 time_t gnc_timet_get_day_end_gdate (GDate * date);
00303 #endif
00304
00305 int date_get_last_mday (struct tm *tm);
00307 gboolean date_is_last_mday (struct tm *tm);
00309 int gnc_date_my_last_mday (int month, int year);
00311 int gnc_timespec_last_mday (Timespec ts);
00313 char * xaccDateUtilGetStampNow (void);
00315 char *xaccDateUtilGetStamp (time_t thyme);
00317 size_t qof_print_date_dmy_buff (gchar * buff, size_t buflen,
00318 gint day, gint month, gint year);
00320 size_t qof_print_date_buff (char *buff, size_t buflen, time_t secs);
00322 size_t qof_print_gdate (char *buf, size_t bufflen, GDate * gd);
00324 char *qof_print_date (time_t secs);
00326 const char *gnc_print_date (Timespec ts);
00328 gboolean qof_scan_date (const char *buff, int *day, int *month, int *year);
00330 gboolean qof_scan_date_secs (const char *buff, time_t * secs);
00333 #define qof_book_set_guid(book,guid) \
00334 qof_entity_set_guid(QOF_ENTITY(book), guid)
00335
00336 #define QOF_TYPE_DATE "date"
00337
00338 Timespec qof_instance_get_last_update (QofInstance * inst);
00339 void qof_instance_set_last_update (QofInstance * inst, Timespec ts);
00341 void kvp_frame_set_timespec (KvpFrame * frame, const gchar * path,
00342 Timespec ts);
00344 void kvp_frame_add_timespec (KvpFrame * frame, const gchar * path,
00345 Timespec ts);
00347 Timespec kvp_value_get_timespec (const KvpValue * value);
00349 Timespec kvp_frame_get_timespec (const KvpFrame * frame, const gchar * path);
00351 KvpValue *kvp_value_new_timespec (Timespec timespec);
00353 #define qof_book_get_guid(X) qof_entity_get_guid (QOF_ENTITY(X))
00354
00355 void qof_start_clock (gint clockno, QofLogModule log_module,
00356 QofLogLevel log_level, const gchar * function_name,
00357 const gchar * format, ...);
00359 void qof_report_clock (gint clockno,
00360 QofLogModule log_module,
00361 QofLogLevel log_level,
00362 const gchar * function_name,
00363 const gchar * format, ...);
00365 void qof_report_clock_total (gint clockno,
00366 QofLogModule log_module,
00367 QofLogLevel log_level,
00368 const gchar * function_name,
00369 const gchar * format, ...);
00371 #define START_CLOCK(clockno,format, args...) do { \
00372 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00373 qof_start_clock (clockno, log_module, QOF_LOG_INFO, \
00374 __FUNCTION__, format , ## args); \
00375 } while (0)
00376
00377 #define REPORT_CLOCK(clockno,format, args...) do { \
00378 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00379 qof_report_clock (clockno, log_module, QOF_LOG_INFO, \
00380 __FUNCTION__, format , ## args); \
00381 } while (0)
00382
00383 #define REPORT_CLOCK_TOTAL(clockno,format, args...) do { \
00384 if (qof_log_check (log_module, QOF_LOG_INFO)) \
00385 qof_report_clock_total (clockno, log_module, QOF_LOG_INFO, \
00386 __FUNCTION__, format , ## args); \
00387 } while (0)
00388
00390 void qof_query_print (QofQuery * query);
00392 typedef struct
00393 {
00394 QofQueryPredData pd;
00395 QofDateMatch options;
00396 Timespec date;
00397 } query_date_def, *query_date_t;
00399 QofQueryPredData *
00400 qof_query_date_predicate (QofQueryCompare how,
00401 QofDateMatch options,
00402 Timespec date);
00404 gboolean
00405 qof_query_date_predicate_get_date (QofQueryPredData * pd,
00406 Timespec * date);
00409 QofSession *qof_session_get_current_session (void);
00412 void qof_session_set_current_session (QofSession * session);
00415 void
00416 qof_session_clear_current_session (void);
00418 gboolean gnc_strisnum (const guchar * s);
00420 KvpFrame *
00421 gnc_kvp_bag_add (KvpFrame * pwd, const char *path,
00422 time_t secs, const char *first_name, ...);
00424 KvpFrame *
00425 gnc_kvp_bag_find_by_guid (KvpFrame * root, const char *path,
00426 const char *guid_name, GUID * desired_guid);
00428 void
00429 gnc_kvp_bag_remove_frame (KvpFrame * root, const char *path,
00430 KvpFrame * fr);
00432 void
00433 gnc_kvp_bag_merge (KvpFrame * kvp_into, const char *intopath,
00434 KvpFrame * kvp_from, const char *frompath);
00437 #define QOF_BEGIN_EDIT(inst) \
00438 if (!(inst)) return; \
00439 \
00440 (inst)->editlevel++; \
00441 if (1 < (inst)->editlevel) return; \
00442 \
00443 if (0 >= (inst)->editlevel) \
00444 { \
00445 PERR ("unbalanced call - resetting (was %d)", (inst)->editlevel); \
00446 (inst)->editlevel = 1; \
00447 } \
00448 ENTER ("(inst=%p)", (inst)); \
00449 \
00450 { \
00451 QofBackend * be; \
00452 be = qof_book_get_backend ((inst)->book); \
00453 if (be && qof_backend_begin_exists(be)) { \
00454 qof_backend_run_begin(be, (inst)); \
00455 } else { \
00456 (inst)->dirty = TRUE; \
00457 } \
00458 } \
00459 LEAVE (" ");
00460
00464 gboolean qof_begin_edit (QofInstance * inst);
00465
00467 #define QOF_COMMIT_EDIT_PART1(inst) { \
00468 if (!(inst)) return; \
00469 \
00470 (inst)->editlevel--; \
00471 if (0 < (inst)->editlevel) return; \
00472 \
00473 if ((-1 == (inst)->editlevel) && (inst)->dirty) \
00474 { \
00475 QofBackend * be; \
00476 be = qof_book_get_backend ((inst)->book); \
00477 if (be && qof_backend_begin_exists(be)) { \
00478 qof_backend_run_begin(be, (inst)); \
00479 } \
00480 (inst)->editlevel = 0; \
00481 } \
00482 if (0 > (inst)->editlevel) \
00483 { \
00484 PERR ("unbalanced call - resetting (was %d)", (inst)->editlevel); \
00485 (inst)->editlevel = 0; \
00486 } \
00487 ENTER ("(inst=%p) dirty=%d do-free=%d", \
00488 (inst), (inst)->dirty, (inst)->do_free); \
00489 }
00490
00492 gboolean qof_commit_edit (QofInstance * inst);
00493
00495 #define QOF_COMMIT_EDIT_PART2(inst,on_error,on_done,on_free) { \
00496 QofBackend * be; \
00497 \
00498 be = qof_book_get_backend ((inst)->book); \
00499 if (be && qof_backend_commit_exists(be)) \
00500 { \
00501 QofBackendError errcode; \
00502 \
00503 do { \
00504 errcode = qof_backend_get_error (be); \
00505 } while (ERR_BACKEND_NO_ERR != errcode); \
00506 \
00507 qof_backend_run_commit(be, (inst)); \
00508 errcode = qof_backend_get_error (be); \
00509 if (ERR_BACKEND_NO_ERR != errcode) \
00510 { \
00511 (inst)->do_free = FALSE; \
00512 qof_backend_set_error (be, errcode); \
00513 (on_error)((inst), errcode); \
00514 } \
00515 (inst)->dirty = FALSE; \
00516 } \
00517 (on_done)(inst); \
00518 \
00519 LEAVE ("inst=%p, dirty=%d do-free=%d", \
00520 (inst), (inst)->dirty, (inst)->do_free); \
00521 if ((inst)->do_free) { \
00522 (on_free)(inst); \
00523 return; \
00524 } \
00525 }
00526
00528 gchar *
00529 qof_util_param_as_string (QofEntity * ent, QofParam * param);
00531 typedef struct _QofNumeric gnc_numeric;
00533 #define GNC_NUMERIC_RND_MASK QOF_NUMERIC_RND_MASK
00534
00535 #define GNC_NUMERIC_DENOM_MASK QOF_NUMERIC_DENOM_MASK
00536
00537 #define GNC_NUMERIC_SIGFIGS_MASK QOF_NUMERIC_SIGFIGS_MASK
00538
00539 #define GNC_HOW_RND_FLOOR QOF_HOW_RND_FLOOR
00540
00541 #define GNC_HOW_RND_CEIL QOF_HOW_RND_CEIL
00542
00543 #define GNC_HOW_RND_TRUNC QOF_HOW_RND_TRUNC
00544
00545 #define GNC_HOW_RND_PROMOTE QOF_HOW_RND_PROMOTE
00546
00547 #define GNC_HOW_RND_ROUND_HALF_DOWN QOF_HOW_RND_ROUND_HALF_DOWN
00548
00549 #define GNC_HOW_RND_ROUND_HALF_UP QOF_HOW_RND_ROUND_HALF_UP
00550
00551 #define GNC_HOW_RND_ROUND QOF_HOW_RND_ROUND
00552
00553 #define GNC_HOW_RND_NEVER QOF_HOW_RND_NEVER
00554
00555 #define GNC_HOW_DENOM_EXACT QOF_HOW_DENOM_EXACT
00556
00557 #define GNC_HOW_DENOM_REDUCE QOF_HOW_DENOM_REDUCE
00558
00559 #define GNC_HOW_DENOM_LCD QOF_HOW_DENOM_LCD
00560
00561 #define GNC_HOW_DENOM_FIXED QOF_HOW_DENOM_FIXED
00562
00563 #define GNC_HOW_DENOM_SIGFIG QOF_HOW_DENOM_SIGFIG
00564
00565 #define GNC_HOW_DENOM_SIGFIGS QOF_HOW_DENOM_SIGFIGS
00566
00567 #define GNC_HOW_GET_SIGFIGS QOF_HOW_GET_SIGFIGS
00568
00569 #define GNC_ERROR_OK QOF_ERROR_OK
00570
00571 #define GNC_ERROR_ARG QOF_ERROR_ARG
00572
00573 #define GNC_ERROR_OVERFLOW QOF_ERROR_OVERFLOW
00574
00575 #define GNC_ERROR_DENOM_DIFF QOF_ERROR_DENOM_DIFF
00576
00577 #define GNC_ERROR_REMAINDER QOF_ERROR_REMAINDER
00578
00579 #define GNCNumericErrorCode QofNumericErrorCode
00580
00581 #define GNC_DENOM_AUTO QOF_DENOM_AUTO
00582
00583 #define GNC_DENOM_RECIPROCAL QOF_DENOM_RECIPROCAL
00584
00585 static inline gnc_numeric
00586 gnc_numeric_create (gint64 num, gint64 denom)
00587 {
00588 QofNumeric out;
00589 out.num = num;
00590 out.denom = denom;
00591 return out;
00592 }
00594 static inline gnc_numeric
00595 gnc_numeric_zero (void)
00596 {
00597 return qof_numeric_create (0, 1);
00598 }
00600 gnc_numeric
00601 double_to_gnc_numeric (double in, gint64 denom, gint how);
00603 gboolean
00604 string_to_gnc_numeric (const gchar * str, gnc_numeric * n);
00606 gnc_numeric
00607 gnc_numeric_error (GNCNumericErrorCode error_code);
00609 static inline gint64
00610 gnc_numeric_num (gnc_numeric a)
00611 {
00612 return a.num;
00613 }
00615 static inline gint64
00616 gnc_numeric_denom (gnc_numeric a)
00617 {
00618 return a.denom;
00619 }
00621 gdouble
00622 gnc_numeric_to_double (gnc_numeric in);
00624 gchar *
00625 gnc_numeric_to_string (gnc_numeric n);
00627 gchar *
00628 gnc_num_dbg_to_string (gnc_numeric n);
00630 GNCNumericErrorCode
00631 gnc_numeric_check (gnc_numeric a);
00633 gint
00634 gnc_numeric_compare (gnc_numeric a, gnc_numeric b);
00636 gboolean
00637 gnc_numeric_zero_p (gnc_numeric a);
00639 gboolean
00640 gnc_numeric_negative_p (gnc_numeric a);
00642 gboolean
00643 gnc_numeric_positive_p (gnc_numeric a);
00645 gboolean
00646 gnc_numeric_eq (gnc_numeric a, gnc_numeric b);
00648 gboolean
00649 gnc_numeric_equal (gnc_numeric a, gnc_numeric b);
00651 gint
00652 gnc_numeric_same (gnc_numeric a, gnc_numeric b,
00653 gint64 denom, gint how);
00655 gnc_numeric
00656 gnc_numeric_add (gnc_numeric a, gnc_numeric b,
00657 gint64 denom, gint how);
00659 gnc_numeric
00660 gnc_numeric_sub (gnc_numeric a, gnc_numeric b,
00661 gint64 denom, gint how);
00663 gnc_numeric
00664 gnc_numeric_mul (gnc_numeric a, gnc_numeric b,
00665 gint64 denom, gint how);
00667 gnc_numeric
00668 gnc_numeric_div (gnc_numeric x, gnc_numeric y,
00669 gint64 denom, gint how);
00671 gnc_numeric gnc_numeric_neg (gnc_numeric a);
00673 gnc_numeric gnc_numeric_abs (gnc_numeric a);
00675 static inline gnc_numeric
00676 gnc_numeric_add_fixed (gnc_numeric a, gnc_numeric b)
00677 {
00678 return qof_numeric_add (a, b, QOF_DENOM_AUTO,
00679 QOF_HOW_DENOM_FIXED | QOF_HOW_RND_NEVER);
00680 }
00682 static inline gnc_numeric
00683 gnc_numeric_sub_fixed (gnc_numeric a, gnc_numeric b)
00684 {
00685 return gnc_numeric_sub (a, b, QOF_DENOM_AUTO,
00686 QOF_HOW_DENOM_FIXED | QOF_HOW_RND_NEVER);
00687 }
00689 gnc_numeric
00690 gnc_numeric_add_with_error (gnc_numeric a, gnc_numeric b,
00691 gint64 denom, gint how,
00692 gnc_numeric * error);
00694 gnc_numeric
00695 gnc_numeric_sub_with_error (gnc_numeric a, gnc_numeric b,
00696 gint64 denom, gint how,
00697 gnc_numeric * error);
00699 gnc_numeric
00700 gnc_numeric_mul_with_error (gnc_numeric a, gnc_numeric b,
00701 gint64 denom, gint how,
00702 gnc_numeric * error);
00704 gnc_numeric
00705 gnc_numeric_div_with_error (gnc_numeric a, gnc_numeric b,
00706 gint64 denom, gint how,
00707 gnc_numeric * error);
00709 gnc_numeric
00710 gnc_numeric_convert (gnc_numeric in, gint64 denom, gint how);
00712 gnc_numeric
00713 gnc_numeric_convert_with_error (gnc_numeric in, gint64 denom,
00714 gint how, gnc_numeric * error);
00716 gnc_numeric gnc_numeric_reduce (gnc_numeric in);
00718 #define GNC_RND_FLOOR QOF_HOW_RND_FLOOR
00719
00720 #define GNC_RND_CEIL QOF_HOW_RND_CEIL
00721
00722 #define GNC_RND_TRUNC QOF_HOW_RND_TRUNC
00723
00724 #define GNC_RND_PROMOTE QOF_HOW_RND_PROMOTE
00725
00726 #define GNC_RND_ROUND_HALF_DOWN QOF_HOW_RND_ROUND_HALF_DOWN
00727
00728 #define GNC_RND_ROUND_HALF_UP QOF_HOW_RND_ROUND_HALF_UP
00729
00730 #define GNC_RND_ROUND QOF_HOW_RND_ROUND
00731
00732 #define GNC_RND_NEVER QOF_HOW_RND_NEVER
00733
00734 #define GNC_DENOM_EXACT QOF_HOW_DENOM_EXACT
00735
00736 #define GNC_DENOM_REDUCE QOF_HOW_DENOM_REDUCE
00737
00738 #define GNC_DENOM_LCD QOF_HOW_DENOM_LCD
00739
00740 #define GNC_DENOM_FIXED QOF_HOW_DENOM_FIXED
00741
00742 #define GNC_DENOM_SIGFIG QOF_HOW_DENOM_SIGFIG
00743
00744 #define GNC_DENOM_SIGFIGS(X) QOF_HOW_DENOM_SIGFIGS(X)
00745
00746 #define GNC_NUMERIC_GET_SIGFIGS(X) QOF_HOW_GET_SIGFIGS(X)
00747
00748 QofBackend *gncBackendInit_file (const char *book_id, void *data);
00749
00754 #define ENUM_LIST_DEP(_) \
00755 _(ERR_BACKEND_NO_ERR, =0) \
00756 _(ERR_BACKEND_NO_HANDLER,) \
00757 _(ERR_BACKEND_NO_BACKEND,) \
00758 _(ERR_BACKEND_BAD_URL,) \
00759 _(ERR_BACKEND_NO_SUCH_DB,) \
00760 _(ERR_BACKEND_CANT_CONNECT,) \
00761 _(ERR_BACKEND_CONN_LOST,) \
00762 _(ERR_BACKEND_LOCKED,) \
00763 _(ERR_BACKEND_READONLY,) \
00764 _(ERR_BACKEND_TOO_NEW,) \
00765 _(ERR_BACKEND_DATA_CORRUPT,) \
00766 _(ERR_BACKEND_SERVER_ERR,) \
00767 _(ERR_BACKEND_ALLOC,) \
00768 _(ERR_BACKEND_PERM,) \
00769 _(ERR_BACKEND_MODIFIED,) \
00770 _(ERR_BACKEND_MOD_DESTROY,) \
00771 _(ERR_BACKEND_MISC,) \
00772 _(ERR_QSF_INVALID_OBJ,) \
00773 _(ERR_QSF_INVALID_MAP,) \
00774 _(ERR_QSF_BAD_OBJ_GUID,) \
00775 _(ERR_QSF_BAD_QOF_VERSION,) \
00776 _(ERR_QSF_BAD_MAP,) \
00777 _(ERR_QSF_NO_MAP,) \
00778 _(ERR_QSF_WRONG_MAP,) \
00779 _(ERR_QSF_MAP_NOT_OBJ,) \
00780 _(ERR_QSF_OVERFLOW,) \
00781 _(ERR_QSF_OPEN_NOT_MERGE,) \
00782 _(ERR_FILEIO_FILE_BAD_READ, =1000) \
00783 _(ERR_FILEIO_FILE_EMPTY,) \
00784 _(ERR_FILEIO_FILE_LOCKERR,) \
00785 _(ERR_FILEIO_FILE_NOT_FOUND,) \
00786 _(ERR_FILEIO_FILE_TOO_OLD,) \
00787 _(ERR_FILEIO_UNKNOWN_FILE_TYPE,) \
00788 _(ERR_FILEIO_PARSE_ERROR,) \
00789 _(ERR_FILEIO_BACKUP_ERROR,) \
00790 _(ERR_FILEIO_WRITE_ERROR,) \
00791 _(ERR_FILEIO_READ_ERROR,) \
00792 _(ERR_FILEIO_NO_ENCODING,) \
00793 _(ERR_NETIO_SHORT_READ, =2000) \
00794 _(ERR_NETIO_WRONG_CONTENT_TYPE,) \
00795 _(ERR_NETIO_NOT_GNCXML,) \
00796 _(ERR_SQL_MISSING_DATA, =3000) \
00797 _(ERR_SQL_DB_TOO_OLD,) \
00798 _(ERR_SQL_DB_BUSY,) \
00799 _(ERR_RPC_HOST_UNK, =4000) \
00800 _(ERR_RPC_CANT_BIND,) \
00801 _(ERR_RPC_CANT_ACCEPT,) \
00802 _(ERR_RPC_NO_CONNECTION,) \
00803 _(ERR_RPC_BAD_VERSION,) \
00804 _(ERR_RPC_FAILED,) \
00805 _(ERR_RPC_NOT_ADDED,)
00806
00807 DEFINE_ENUM(QofBackendError, ENUM_LIST_DEP)
00808
00809 AS_STRING_DEC(QofBackendError, ENUM_LIST_DEP)
00810
00812 gboolean
00813 qof_commit_edit_part2 (QofInstance * inst,
00814 void (*on_error) (QofInstance *, QofBackendError),
00815 void (*on_done) (QofInstance *),
00816 void (*on_free) (QofInstance *));
00817
00819 void
00820 qof_session_push_error (QofSession * session, QofBackendError err,
00821 const gchar *message);
00824 const gchar *
00825 qof_session_get_error_message (QofSession * session);
00828 QofErrorId
00829 qof_session_pop_error (QofSession * session);
00830 QofErrorId
00831 qof_session_get_error (QofSession * session);
00833 void
00834 qof_backend_set_error (QofBackend * be, QofErrorId err);
00836 QofErrorId
00837 qof_backend_get_error (QofBackend * be);
00839 void
00840 qof_backend_set_message (QofBackend * be, const gchar * format, ...);
00848 gchar *
00849 qof_backend_get_message (QofBackend * be);
00851 #define kvp_frame KvpFrame
00852
00853 #define kvp_value KvpValue
00854
00855 #define kvp_value_t KvpValueType
00856
00857 #define kvp_frame_set_gnc_numeric kvp_frame_set_numeric
00858
00859 #define kvp_frame_set_str kvp_frame_set_string
00860
00861 #define kvp_frame_add_gnc_numeric kvp_frame_add_numeric
00862
00863 #define kvp_frame_add_str kvp_frame_add_string
00864
00865 #define kvp_value_new_gnc_numeric kvp_value_new_numeric
00866
00867 gint double_compare (gdouble d1, gdouble d2);
00868
00869 #endif
00870 #endif