ARB
|
#include <unistd.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arb_file.h>
#include <arb_diff.h>
#include <arb_zfile.h>
#include <arb_defs.h>
#include <arb_strbuf.h>
#include "gb_key.h"
#include "gb_map.h"
#include "gb_load.h"
#include "ad_io_inline.h"
#include <arb_misc.h>
#include <SigHandler.h>
Go to the source code of this file.
Classes | |
class | ArbDBWriter |
Macros | |
#define | GB_PUT(c, out) do { if (c>=10) c+='A'-10; else c += '0'; *(out++) = (char)c; } while (0) |
#define | GB_PUT_OUT(c, out) do { if (c>=10) c+='A'-10; else c += '0'; putc(c, out); } while (0) |
#define | SUPPORTED_COMPRESSION_FLAGS "zBx" |
Variables | |
GB_MAIN_TYPE * | gb_main_array [GB_MAIN_ARRAY_SIZE] |
static bool | seen_corrupt_data = false |
Definition at line 358 of file ad_save_load.cxx.
Referenced by gb_bin_2_ascii().
Definition at line 419 of file ad_save_load.cxx.
Referenced by gb_write_one_child().
#define SUPPORTED_COMPRESSION_FLAGS "zBx" |
Definition at line 953 of file ad_save_load.cxx.
Referenced by GB_get_supported_compression_flags(), and ArbDBWriter::startSaveAs().
Definition at line 30 of file ad_save_load.cxx.
References NULp.
Referenced by GB_login(), gb_mapfile_name(), gb_oldQuicksaveName(), gb_quicksaveName(), and gb_reffile_name().
Definition at line 49 of file ad_save_load.cxx.
References gb_assert.
Referenced by gb_mapfile_name(), gb_oldQuicksaveName(), gb_overwriteName(), gb_quicksaveName(), and gb_reffile_name().
Definition at line 57 of file ad_save_load.cxx.
References gb_findExtension(), and STATIC_BUFFER().
Referenced by GB_login(), and gb_remove_quick_saved().
Definition at line 73 of file ad_save_load.cxx.
References gb_findExtension(), and STATIC_BUFFER().
Referenced by deleteSuperfluousQuicksaves(), GB_login(), gb_remove_quick_saved(), renameQuicksaves(), and GB_MAIN_TYPE::save_quick().
Definition at line 88 of file ad_save_load.cxx.
References gb_findExtension(), and STATIC_BUFFER().
Referenced by ArbDBWriter::finishSave(), GB_mapfile(), gb_read_bin(), and gb_remove_all_but_main().
Definition at line 102 of file ad_save_load.cxx.
References GB_MAIN(), gb_mapfile_name(), and GB_MAIN_TYPE::path.
Referenced by run_command().
Definition at line 107 of file ad_save_load.cxx.
References oname, and STATIC_BUFFER().
Referenced by ArbDBWriter::finishSave(), GB_MAIN_TYPE::save_quick(), and ArbDBWriter::startSaveAs().
Definition at line 119 of file ad_save_load.cxx.
References gb_findExtension(), and STATIC_BUFFER().
Referenced by gb_add_reference(), gb_create_reference(), and gb_delete_reference().
Definition at line 134 of file ad_save_load.cxx.
References ARB_strdup(), GB_getcwd(), GBS_global_string_copy(), and NULp.
Referenced by gb_add_reference(), gb_create_reference(), gb_delete_reference(), and GB_MAIN_TYPE::save_quick_as().
Definition at line 147 of file ad_save_load.cxx.
References error(), gb_full_path(), gb_reffile_name(), GB_unlink_or_warn(), and NULp.
Referenced by ArbDBWriter::finishSave().
Definition at line 158 of file ad_save_load.cxx.
References error(), GB_failedTo_error(), gb_full_path(), gb_reffile_name(), GB_set_mode_of_file(), GBS_global_string(), and NULp.
Referenced by ArbDBWriter::finishSave().
Definition at line 179 of file ad_save_load.cxx.
References error(), GB_failedTo_error(), gb_full_path(), gb_reffile_name(), GB_set_mode_of_file(), GBS_global_string(), and NULp.
Referenced by GB_MAIN_TYPE::save_quick_as().
|
static |
Definition at line 205 of file ad_save_load.cxx.
References error(), GB_MAX_QUICK_SAVE_INDEX, gb_oldQuicksaveName(), gb_quicksaveName(), GB_unlink_or_warn(), gb_quick_save::last_index, NULp, GB_MAIN_TYPE::qs, and RETURN_ERROR.
Referenced by ArbDBWriter::finishSave(), and gb_remove_all_but_main().
|
static |
Definition at line 216 of file ad_save_load.cxx.
References error(), gb_mapfile_name(), gb_remove_quick_saved(), GB_unlink_or_warn(), and RETURN_ERROR.
Referenced by ArbDBWriter::finishSave(), GB_delete_database(), and GB_MAIN_TYPE::save_quick_as().
|
static |
Definition at line 223 of file ad_save_load.cxx.
References error(), GB_await_error(), GB_is_regularfile(), GB_MAX_QUICK_SAVE_INDEX, GB_MAX_QUICK_SAVES, gb_quicksaveName(), GB_unlink(), NULp, and GB_MAIN_TYPE::path.
Referenced by renameQuicksaves(), and GB_MAIN_TYPE::save_quick().
|
static |
Definition at line 245 of file ad_save_load.cxx.
References ARB_strdup(), deleteSuperfluousQuicksaves(), error(), gb_assert, GB_is_regularfile(), GB_MAX_QUICK_SAVE_INDEX, GB_MAX_QUICK_SAVES, GB_move_file(), gb_quicksaveName(), GB_warning(), gb_quick_save::last_index, GB_MAIN_TYPE::path, and GB_MAIN_TYPE::qs.
Referenced by GB_MAIN_TYPE::save_quick().
Definition at line 284 of file ad_save_load.cxx.
References A_TO_I, gb_flag_types::compressed_data, GBDATA::flags, and s.
Referenced by gb_parse_ascii_rek().
Definition at line 360 of file ad_save_load.cxx.
References buffer, gb_flag_types::compressed_data, GBENTRY::data(), GBDATA::flags, GB_give_buffer(), GB_PUT, GBENTRY::memsize(), s, and GBENTRY::size().
Referenced by gb_write_one_child().
|
static |
write database entries to stream (used by ASCII database save)
out | output stream |
gbc | container to write (including all subentries if gb_writeFrom and gb_writeTill are NULp). |
gb_writeFrom | if specified -> assume opening tag of container gb_writeFrom and all its subentries have already been written. Save closing tag and all following containers. |
gb_writeTill | if specified -> write till opening tag of container gb_writeTill |
indent | indentation for container gbc |
Definition at line 541 of file ad_save_load.cxx.
References gb_assert, GB_child(), GB_nextChild(), and gb_write_one_child().
Referenced by gb_write_one_child().
|
static |
parameters same as for gb_write_childs() The differences between both functions are:
Definition at line 423 of file ad_save_load.cxx.
References ARB_float_2_ascii(), GBDATA::as_container(), GBDATA::as_entry(), GBDATA::flags, GBDATA::flags2, gb_assert, gb_bin_2_ascii(), GB_BITS, GB_BYTE, GB_BYTES, GB_DB, GB_FLOAT, GB_FLOATS, GB_get_db_path(), GB_INT, GB_INTS, GB_KEY(), GB_OBSOLETE, GB_PUT_OUT, GB_read_bits_pntr(), GB_read_byte(), GB_read_char_pntr(), GB_read_flag(), GB_read_float(), GB_read_int(), GB_STRING, GB_SYSTEM_FOLDER, GB_warningf(), gb_write_childs(), GBS_fwrite_string(), GBDATA::is_container(), gb_flag_types2::last_updated, NULp, s, gb_flag_types::security_delete, gb_flag_types::security_read, gb_flag_types::security_write, and GBDATA::type().
Referenced by gb_write_childs().
Definition at line 567 of file ad_save_load.cxx.
References GB_export_errorf(), GB_KEY(), GB_print_error(), and long.
Referenced by gb_read_bin(), gb_read_bin_rek_V2(), and read_keyword().
|
static |
Definition at line 578 of file ad_save_load.cxx.
References gb_header_flags::changed, gb_db_extended::creation_date, gb_header_flags::ever_changed, GBDATA::ext, gb_header_list::flags, GBDATA::flags, GB_DELETED, gb_flag_types::temporary, and gb_db_extended::update_date.
Referenced by gb_write_bin_sub_containers().
|
static |
Definition at line 704 of file ad_save_load.cxx.
References gb_header_flags::changed, GBCONTAINER::d, gb_header_list::flags, flags, gb_assert, GB_DATA_LIST_HEADER(), GB_DELETED, GB_DELETED_IN_MASTER, GB_HEADER_LIST_GBD(), gb_is_writeable(), gb_put_number(), gb_write_bin_rek(), gb_write_out_uint32(), and gb_data_list::nheader.
Referenced by gb_write_bin(), and gb_write_bin_rek().
|
static |
Definition at line 601 of file ad_save_load.cxx.
References GBDATA::as_container(), GBDATA::as_entry(), buffer, gb_flag_types::compressed_data, GBENTRY::data(), gb_header_flags::flags, GBDATA::flags, GBDATA::flags2, GB_ARRAY_FLAGS(), gb_assert, GB_BITS, GB_BYTE, GB_BYTES, GB_DB, GB_FLOAT, GB_FLOATS, GB_get_db_path(), GB_INT, GB_INTS, gb_put_number(), GB_STRING, GB_STRING_SHRT, GB_warningf(), gb_write_bin_sub_containers(), GBTUM_SHORT_STRING_SIZE, gb_data_base_type_union::i, GBENTRY::info, gb_flag_types2::last_updated, GBENTRY::memsize(), NULp, gb_flag_types::security_delete, gb_flag_types::security_read, gb_flag_types::security_write, seen_corrupt_data, GBENTRY::size(), type, GBDATA::type(), and gb_flag_types::unused.
Referenced by gb_write_bin_sub_containers().
|
static |
Definition at line 754 of file ad_save_load.cxx.
References GB_MAIN_TYPE::dates, fputs(), gb_assert, gb_put_number(), gb_write_bin_sub_containers(), gb_write_out_uint32(), GBCONTAINER_MAIN(), GBTUM_MAGIC_NUMBER, gb_Key::key, GB_MAIN_TYPE::keycnt, GB_MAIN_TYPE::keys, GB_MAIN_TYPE::last_main_saved_transaction, GB_MAIN_TYPE::last_updated, gb_Key::nref, and seen_corrupt_data.
Referenced by ArbDBWriter::finishSave(), and GB_MAIN_TYPE::save_quick().
save database
gb | database root |
path | filename (if NULp -> use name stored in DB; otherwise store name in DB) |
savetype |
Definition at line 804 of file ad_save_load.cxx.
References GB_MAIN(), and GB_save_as().
Referenced by ARB_main(), MG_save_cb(), NT_save_as_cb(), react_to_command(), and saveArb().
Definition at line 816 of file ad_save_load.cxx.
References error(), GB_create_directory(), GB_is_directory(), GB_split_full_path(), and NULp.
Referenced by GB_create_directory(), GB_fopen_tempfile(), and GB_save_in_arbprop().
Definition at line 827 of file ad_save_load.cxx.
References error(), GB_create_parent_directory(), GB_failedTo_error(), GB_IO_error(), GB_is_directory(), and NULp.
Referenced by AW_create_fileselection_awars(), create_new_mask_cb(), GB_create_parent_directory(), getenv_autodirectory(), LoadMenus(), and scan_existing_input_masks().
save database inside arb-properties-directory. Automatically creates subdirectories as needed.
gb | database root |
path | filename (if NULp -> use name stored in DB) |
savetype |
Definition at line 840 of file ad_save_load.cxx.
References ARB_strdup(), error(), GB_create_parent_directory(), GB_MAIN(), GB_path_in_arbprop(), and GB_save_as().
Referenced by AW_root::save_properties().
Definition at line 923 of file ad_save_load.cxx.
References error(), gb_assert, GB_warning(), NULp, and seen_corrupt_data.
Referenced by ArbDBWriter::finishSave(), and GB_MAIN_TYPE::save_quick().
const char* GB_get_supported_compression_flags | ( | bool | verboose | ) |
Definition at line 955 of file ad_save_load.cxx.
References GBS_strstruct::cat(), gb_assert, GBS_static_string(), GBS_strstruct::get_data(), and SUPPORTED_COMPRESSION_FLAGS.
Referenced by ARB_main(), and AWT_insert_DBcompression_selector().
GB_ERROR GB_start_streamed_save_as | ( | GBDATA * | gbd, |
const char * | path, | ||
const char * | savetype, | ||
ArbDBWriter *& | writer | ||
) |
special save implementation for use in pipelines (e.g. silva) 'savetype' has contain 'a' (ascii) 'writer' has to be NULp (object will be constructed and assigned to)
Actual saving of data is triggered by GB_stream_save_part(). When done with saving part, call GB_finish_stream_save() - even in case of error!
Definition at line 1320 of file ad_save_load.cxx.
References gb_assert, GB_MAIN(), and ArbDBWriter::startSaveAs().
GB_ERROR GB_stream_save_part | ( | ArbDBWriter * | writer, |
GBDATA * | from, | ||
GBDATA * | till | ||
) |
saves a part of the database.
save complete database: GB_stream_save_part(w, gb_main, gb_main);
save database in parts: GB_stream_save_part(w, gb_main, gb_some_container); forall (gb_some_sub_container) { // you may create/modify gb_some_sub_container here GB_stream_save_part(w, gb_some_sub_container, gb_some_sub_container); // you may delete/modify gb_some_sub_container here } GB_stream_save_part(w, gb_some_container, gb_main);
Note: gb_some_sub_container has to be a child of gb_some_container
Definition at line 1332 of file ad_save_load.cxx.
References GBDATA::as_container(), error(), GBDATA::is_container(), and ArbDBWriter::saveFromTill().
GB_ERROR GB_finish_stream_save | ( | ArbDBWriter *& | writer | ) |
complete save-process started with GB_start_streamed_save_as() Has to be called (even if GB_start_streamed_save_as or GB_stream_save_part has returned an error!)
Definition at line 1358 of file ad_save_load.cxx.
References error(), ArbDBWriter::finishSave(), and NULp.
Save whole database
gbd | database root |
path | filename (if NULp -> use name stored in DB) |
savetype | 'a' ascii 'b' binary 'm' save mapfile (only together with binary) |
'f' force saving even in disabled path to a different directory (out of order save) 'S' save to stdout (used in arb_2_ascii when saving to stdout; also useful for debugging)
Extra compression flags: 'z' stream through gzip/pigz 'B' stream through bzip2 'x' stream through xz
Definition at line 1371 of file ad_save_load.cxx.
References gb_assert, GB_MAIN(), NULp, RETURN_ERROR, and GB_MAIN_TYPE::save_as().
Referenced by ARB_main(), FINAL_TYPE< SEQTYPE >::ArbWriter(), calc_pvp(), FINAL_TYPE< SEQTYPE >::finish(), GB_save(), GB_save_in_arbprop(), main(), pd_export_pt_server(), and run_command().
Definition at line 1418 of file ad_save_load.cxx.
References error(), GB_await_error(), gb_remove_all_but_main(), GB_unlink(), and NULp.
Referenced by nt_delete_database().
Definition at line 1511 of file ad_save_load.cxx.
References GB_MAIN(), and GB_MAIN_TYPE::save_quick_as().
Referenced by MG_save_quick_result_cb(), and NT_save_quick_as_cb().
Definition at line 1593 of file ad_save_load.cxx.
References GB_MAIN(), and GB_MAIN_TYPE::save_quick().
Referenced by NT_save_quick_cb().
Definition at line 1598 of file ad_save_load.cxx.
References GB_MAIN(), GBS_eval_env(), and NULp.
Referenced by GBT_open().
Definition at line 1603 of file ad_save_load.cxx.
References GB_MAIN(), and GB_MAIN_TYPE::last_saved_transaction.
Referenced by nt_disconnect_from_db().
Definition at line 1607 of file ad_save_load.cxx.
References GB_MAIN(), and GB_MAIN_TYPE::last_saved_time.
Referenced by nt_disconnect_from_db().
GB_MAIN_TYPE* gb_main_array[GB_MAIN_ARRAY_SIZE] |
Definition at line 28 of file ad_save_load.cxx.
Referenced by gb_make_main_idx(), gb_read_bin(), and GB_MAIN_TYPE::release_main_idx().
|
static |
Definition at line 599 of file ad_save_load.cxx.
Referenced by ArbDBWriter::finishSave(), gb_write_bin(), gb_write_bin_rek(), protect_corruption_error(), GB_MAIN_TYPE::save_quick(), and ArbDBWriter::startSaveAs().