19 const char *key =
GB_KEY(gbd);
34 const char *key_name =
NULp;
35 const char *content =
NULp;
36 unsigned long content_len = 0;
39 char *whatto_show_later =
NULp;
40 bool showChildren =
true;
47 key_name =
GBS_global_string(
"<no gb_header_list found for index_pos=%i>", index_pos);
55 gb_show_later = gb_self;
79 if (!father && !key_name) {
80 key_name =
"<unknown quark - element w/o father>";
84 if (
GB_MAIN(gbd)->get_transaction_level() == 0) {
93 printf(
"\nGB_dump of '%s':\n", father ?
GB_get_db_path(gbd) :
"<no DB-path - father missing or not inspected>");
94 if (lines_allowed) (*lines_allowed)--;
99 content =
"<can't examine - entry is deleted>";
102 switch (gbd->
type()) {
111 case GB_DB: { content =
"see below";
break; }
112 default: { content =
"";
break; }
122 content =
"<illegal zero content, but no error - severe bug?!>";
125 if (content_len == 0) content_len = strlen(content);
128 char *prefix =
GBS_global_string_copy(
"%*s %-15s gbd=%p type=%s content=", indent,
"", key_name, gbd, type_name);
129 unsigned wrappos = 500;
132 if (content_len > wrappos) {
138 if (content_len <= wrappos) {
139 printf(
"%s'%s'\n", prefix, content);
140 if (lines_allowed) (*lines_allowed)--;
143 char *
buffer = ARB_alloc<char>(wrappos+1);
144 unsigned long rest = content_len;
145 const char *from = content;
150 memcpy(buffer, from, wrappos);
151 rest = rest>wrappos ? rest-wrappos : 0;
153 if (!prefix || !buffer) {
gb_assert(0);
break; }
154 printf(
"%s'%s'\n", prefix, buffer);
155 if (lines_allowed && --(*lines_allowed) <= 0)
break;
156 if (!cleared) { memset(prefix,
' ', strlen(prefix)); cleared = 1; }
172 if (lines_allowed && (*lines_allowed)<0)
break;
177 if (!lines_allowed || (*lines_allowed)>0) {
178 printf(
"%*s Showing %s:\n", indent,
"", whatto_show_later);
179 freenull(whatto_show_later);
188 int max_lines = 2500;
190 if (max_lines <= 0) {
191 printf(
"Warning: Dump has been aborted (too many lines)\n"
192 "[use GB_dump_no_limit() if you really want to dump all]\n");
211 if (key_quark == 0) {
217 printf(
"new_key_name='%s'\n", new_key_name);
226 printf(
"Fixed zero key_quark of GBDATA at %p\n", gbd);
250 void TEST_DB_path() {
253 #define ACC_PATH "species_data/species/acc"
255 for (
int ascii = 0; ascii<=1; ++ascii) {
GB_ERROR GB_begin_transaction(GBDATA *gbd)
static void dump_internal(GBDATA *gbd, int *lines_allowed)
GBDATA * GB_open(const char *path, const char *opent)
#define GB_GBM_INDEX(gbd)
long GB_read_int(GBDATA *gbd)
GBDATA * GB_child(GBDATA *father)
bool GB_is_server(GBDATA *gbd)
NOT4PERL void GB_dump(GBDATA *gbd)
GB_MAIN_TYPE * GB_MAIN(GBDATA *gbd)
unsigned int folded_container
GB_ERROR GB_end_transaction(GBDATA *gbd, GB_ERROR error)
const char * GB_get_type_name(GBDATA *gbd)
char * ARB_strdup(const char *str)
size_t GBS_shorten_repeated_data(char *data)
const char * GBS_global_string(const char *templat,...)
CONSTEXPR_INLINE gb_header_list * GB_DATA_LIST_HEADER(gb_data_list &dl)
char * GBS_string_2_key(const char *str)
GBQUARK gb_find_or_create_quark(GB_MAIN_TYPE *Main, const char *key)
char buffer[MESSAGE_BUFFERSIZE]
GB_ERROR GB_push_transaction(GBDATA *gbd)
const char * ARB_float_2_ascii(const float f)
#define TEST_PUBLISH(testfunction)
static GB_ERROR gb_fix_recursive(GBDATA *gbd)
GB_ERROR GB_await_error()
GB_ERROR gb_unfold(GBCONTAINER *gbc, long deep, int index_pos)
long GB_read_count(GBDATA *gbd)
bool is_container() const
#define TEST_REJECT_NULL(n)
float GB_read_float(GBDATA *gbd)
#define RETURN_LOCAL_ALLOC(mallocation)
GBCONTAINER * as_container() const
CONSTEXPR_INLINE GBCONTAINER * GB_FATHER(GBDATA *gbd)
GB_ERROR GB_fix_database(GBDATA *gb_main)
GB_ERROR GB_pop_transaction(GBDATA *gbd)
GBQUARK GB_KEY_QUARK(GBDATA *gbd)
#define GBTUM_MAGIC_NUMBER
int GB_read_byte(GBDATA *gbd)
long quark2gbmindex(GB_MAIN_TYPE *Main, GBQUARK key_quark)
const char * GB_get_db_path(GBDATA *gbd)
NOT4PERL void GB_dump_no_limit(GBDATA *gbd)
void GB_dump_db_path(GBDATA *gbd)
GBDATA * GB_nextChild(GBDATA *child)
GB_transaction ta(gb_var)
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
const char * GB_KEY(GBDATA *gbd)
#define TEST_EXPECT_EQUAL(expr, want)
char * GBS_global_string_copy(const char *templat,...)
void GB_close(GBDATA *gbd)