40 if (c==
' ' || c ==
'_') {
43 else if (isalnum(c) || strchr(additional, c)) {
57 char *dest = ARB_alloc<char>(len);
58 memcpy(dest, source, len);
75 for (
int i = 0; i<len; ++i) {
77 bool validChar = isalnum(c) || c ==
'_';
79 return GBS_global_string(
"Invalid character '%c' in '%s'; allowed: a-z A-Z 0-9 '_' ", c, key);
89 return check_key(key, key ? strlen(key) : 0);
98 if (key && key[0] ==
'/') ++key;
101 while (!err && key[0]) {
102 int nonSlashPart = strcspn(key,
"/");
143 int len = strlen(str);
144 char *
buffer = ARB_alloc<char>(2*len+1);
148 gb_assert(strlen(chars_to_escape) <= 26);
149 gb_assert(!strchr(chars_to_escape, escape_char));
151 for (i = 0; str[i]; ++i) {
152 if (str[i] == escape_char) {
153 buffer[j++] = escape_char;
154 buffer[j++] = escape_char;
157 const char *found = strchr(chars_to_escape, str[i]);
159 buffer[j++] = escape_char;
160 buffer[j++] = (found-chars_to_escape+
'A');
166 buffer[j++] = str[i];
178 int len = strlen(str);
179 char *
buffer = ARB_alloc<char>(len+1);
183 #if defined(ASSERTION_USED)
184 int escaped_chars_len = strlen(escaped_chars);
185 #endif // ASSERTION_USED
188 gb_assert(!strchr(escaped_chars, escape_char));
190 for (i = 0; str[i]; ++i) {
191 if (str[i] == escape_char) {
192 if (str[i+1] == escape_char) {
193 buffer[j++] = escape_char;
196 int idx = str[i+1]-
'A';
198 gb_assert(idx >= 0 && idx<escaped_chars_len);
199 buffer[j++] = escaped_chars[idx];
204 buffer[j++] = str[i];
252 long seqlen = strlen(seq);
254 for (i = 0; i < seqlen; i++) {
256 check += count * toupper(seq[i]);
257 if (count == 57) count = 0;
266 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
267 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
268 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
269 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
270 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
271 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
272 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
273 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
274 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
275 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
276 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
277 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
278 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
279 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
280 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
281 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
282 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
283 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
284 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
285 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
286 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
287 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
288 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
289 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
290 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
291 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
292 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
293 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
294 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
295 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
296 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
297 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
298 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
299 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
300 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
301 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
302 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
303 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
304 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
305 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
306 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
307 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
308 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
309 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
310 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
311 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
312 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
313 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
314 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
315 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
316 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
325 unsigned long c = 0xffffffffL;
330 for (i=0; i<256; i++) {
331 tab[i] = ignore_case ? toupper(i) : i;
336 int k = *(
unsigned char *)exclude++;
339 if (ignore_case) tab[toupper(k)] = tab[tolower(k)] = 0;
344 i = tab[*(
const unsigned char *)seq++];
346 c =
crctab[((
int) c ^ i) & 0xff] ^ (c >> 8);
355 return GB_checksum(seq, strlen(seq), ignore_case, exclude);
365 size_t orgLen = strlen(data);
367 char *dataStart = data;
379 dest += sprintf(dest,
"%c{%zu}", last, repeat);
383 for (r = 0; r<repeat; r++) *dest++ = last;
396 return dest-dataStart;
409 TextRef(
const char *data_,
int length_) : data(data_), length(length_) {}
410 explicit TextRef(
const char *zeroTerminated) : data(zeroTerminated), length(strlen(data)) {}
412 bool defined()
const {
return data && length>0; }
445 for (
int s = 0;
s<length; ++
s) {
446 if (!isspace(data[
s])) {
447 return TextRef(data+s, length-s);
455 for (
int s = length-1;
s>=0; --
s) {
456 if (!isspace(data[
s])) {
483 if (behind_d1 && d2 && behind_d1<d2) {
484 return TextRef(behind_d1, d2-behind_d1);
504 void findBrackets(
const char *in) {
506 const char *tag_start = strchr(in,
'[');
508 const char *tag_end = strchr(tag_start,
']');
510 if (tag_end == tag_start+1) {
511 findBrackets(tag_end+1);
514 const char *unwanted_bracket =
reinterpret_cast<const char*
>(memchr(tag_start+1,
'[', tag_end-tag_start-1));
515 if (unwanted_bracket) {
516 findBrackets(unwanted_bracket);
521 nextBrackets =
TextRef(tag_start, tag_end-tag_start+1);
524 findBrackets(tag_end+1);
532 void parse_next_multi_tag() {
535 if (comma.defined()) {
546 parse_next_multi_tag();
548 else if (nextBrackets.
defined()) {
549 TextRef brackets = nextBrackets;
560 parse_next_multi_tag();
569 findBrackets(wholeInput.
get_data());
570 content = (nextBrackets.
defined() ? wholeInput.
partBefore(nextBrackets) : wholeInput).trimmed();
571 if (!content.defined()) parse_next();
592 if (!value[0])
return;
596 p = value;
while ((p = strchr(p,
'['))) *p =
'{';
597 p = value;
while ((p = strchr(p,
']'))) *p =
'}';
670 GB_HASH *g_bs_collect_tags_hash = (
GB_HASH*)cd_g_bs_collect_tags_hash;
679 char *lk =
const_cast<char*
>(strrchr(tag,
','));
683 if (!merge_result->
empty()) merge_result->
put(
' ');
684 merge_result->
put(
'[');
685 merge_result->
cat(tag);
686 merge_result->
put(
']');
687 merge_result->
put(
' ');
689 merge_result->
cat((
char*)value);
713 char *
GBS_merge_tagged_strings(
const char *s1,
const char *tag1,
const char *replace1,
const char *s2,
const char *tag2,
const char *replace2) {
729 if (!s1[0]) replace2 =
NULp;
730 if (!s2[0]) replace1 =
NULp;
732 if (replace1 && !replace1[0]) replace1 =
NULp;
733 if (replace2 && !replace2[0]) replace2 =
NULp;
781 if (buf && tagi && tagi[0]) {
785 char *contentFound =
NULp;
787 while (parser.
has_part() && !contentFound) {
811 unsigned char *strng = (
unsigned char *)strngi;
816 while ((c = *strng++)) {
827 putc(c+(
'0'-25), out);
834 else if (c ==
'\\') {
856 while ((x = getc(in)) !=
'"')
if (x == EOF)
break;
859 while ((x = getc(in)) !=
'"') {
862 x = getc(in);
if (x==EOF)
break;
871 if (x>=
'@' && x <=
'@' + 25) {
875 if (x>=
'0' && x <=
'9') {
902 while ((x = *f++) !=
'"') {
917 if (x>=
'@' && x <=
'@' + 25) {
921 if (x>=
'0' && x <=
'9') {
938 int tlen = strlen(text);
943 while ((c=*(text++))) {
945 int ntab = (tabpos + 8) & 0xfffff8;
946 while (tabpos < ntab) {
963 const char *whitespace =
" \t\n";
964 while (str[0] && strchr(whitespace, str[0])) str++;
966 const char *end = strchr(str, 0)-1;
967 while (end >= str && strchr(whitespace, end[0])) end--;
976 if (time(&date) != -1) {
977 char *dstr = ctime(&date);
978 char *
nl = strchr(dstr,
'\n');
998 size_t clen = comment ? strlen(comment) : 0;
999 size_t alen = strlen(action);
1005 if (clen == 0 || comment[clen-1] !=
'\n')
GBS_chrcat(new_comment,
'\n');
1016 if (alen == 0 || action[alen-1] !=
'\n')
GBS_chrcat(new_comment,
'\n');
1023 char **funNames = backtrace_symbols(&funptr, 1);
1024 const char *readable_fun = funNames[0];
1029 readable_fun += strlen(ARBHOME)+1;
1032 return readable_fun;
1043 #ifdef ENABLE_CRASH_TESTS
1044 static void provokesegv() {
raise(SIGSEGV); }
1045 static void dont_provokesegv() {}
1046 # if defined(ASSERTION_USED)
1047 static void failassertion() {
gb_assert(0); }
1048 # if defined(TEST_TEST_MACROS)
1049 static void dont_failassertion() {}
1051 static void provokesegv_does_not_fail_assertion() {
1059 void TEST_signal_tests__crashtest() {
1077 #if defined(TEST_TEST_MACROS)
1082 #if defined(ASSERTION_USED)
1092 #define TEST_SHORTENED_EQUALS(Long,Short) do { \
1093 char *buf = ARB_strdup(Long); \
1094 GBS_shorten_repeated_data(buf); \
1095 TEST_EXPECT_EQUAL(buf, Short); \
1099 void TEST_GBS_shorten_repeated_data() {
1100 TEST_SHORTENED_EQUALS(
"12345",
"12345");
1101 TEST_SHORTENED_EQUALS(
"aaaaaaaaaaaabc",
"a{12}bc");
1102 TEST_SHORTENED_EQUALS(
"aaaaaaaaaaabc",
"a{11}bc");
1103 TEST_SHORTENED_EQUALS(
"aaaaaaaaaabc",
"a{10}bc");
1104 TEST_SHORTENED_EQUALS(
"aaaaaaaaabc",
"a{9}bc");
1105 TEST_SHORTENED_EQUALS(
"aaaaaaaabc",
"a{8}bc");
1106 TEST_SHORTENED_EQUALS(
"aaaaaaabc",
"a{7}bc");
1107 TEST_SHORTENED_EQUALS(
"aaaaaabc",
"a{6}bc");
1108 TEST_SHORTENED_EQUALS(
"aaaaabc",
"a{5}bc");
1109 TEST_SHORTENED_EQUALS(
"aaaabc",
"aaaabc");
1110 TEST_SHORTENED_EQUALS(
"aaabc",
"aaabc");
1111 TEST_SHORTENED_EQUALS(
"aabc",
"aabc");
1112 TEST_SHORTENED_EQUALS(
"",
"");
1115 static const char *hkey_format[] = {
1121 inline const char *useInHkey(
const char *
fragment,
size_t pos) {
1125 #define TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(use) do { \
1126 for (size_t i = 0; i<ARRAY_ELEMS(hkey_format); ++i) { \
1127 const char *hkey = useInHkey(use, i); \
1128 TEST_ANNOTATE(hkey); \
1129 TEST_EXPECT_NO_ERROR(GB_check_hkey(hkey)); \
1131 TEST_ANNOTATE(NULp); \
1134 #define TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(use,contains) do { \
1135 for (size_t i = 0; i<ARRAY_ELEMS(hkey_format); ++i) { \
1136 const char *hkey = useInHkey(use, i); \
1137 TEST_ANNOTATE(hkey); \
1138 TEST_EXPECT_ERROR_CONTAINS(GB_check_hkey(hkey), contains); \
1140 TEST_ANNOTATE(NULp); \
1144 void TEST_DB_key_checks() {
1146 const char *shortest =
"ab";
1147 const char *too_long =
"ab345678901234567890123456789012345678901234567890123456789012345";
1148 const char *too_short = shortest+1;
1149 const char *longest = too_long+1;
1151 const char *empty =
"";
1152 const char *slash =
"sub/key";
1153 const char *dslash =
"sub//key";
1154 const char *comma =
"no,key";
1155 const char *minus =
"no-key";
1158 const char *
link =
"link->syntax";
1159 const char *nowhere =
"link->";
1160 const char *fromNw =
"->syntax";
1178 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(shortest);
1179 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(longest);
1181 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(too_short,
"too short");
1182 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(too_long,
"too long");
1183 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(empty,
"not allowed");
1185 TEST_IN_HKEYS_USING_EXPECT_NO_ERROR(slash);
1186 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(dslash,
"Empty key is not allowed");
1187 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(comma,
"Invalid character ','");
1188 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(minus,
"Invalid character '-'");
1189 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(link,
"Invalid character '-'");
1190 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(nowhere,
"Invalid character '-'");
1191 TEST_IN_HKEYS_USING_EXPECT_ERROR_CONTAINS(fromNw,
"Invalid character '-'");
1207 #define TEST_STRING2KEY(str,expected) do { \
1208 char *as_key = GBS_string_2_key(str); \
1209 TEST_EXPECT_EQUAL(as_key, expected); \
1210 TEST_EXPECT_NO_ERROR(GB_check_key(as_key)); \
1214 void TEST_DB_key_generation() {
1215 TEST_STRING2KEY(
"abc",
"abc");
1216 TEST_STRING2KEY(
"a b c",
"a_b_c");
1219 TEST_STRING2KEY(
"string containing \"double-quotes\", 'quotes' and other:shit!*&^@!%@(",
1220 "string_containing_doublequotes_quotes_and_othershit");
1223 TEST_STRING2KEY(
"a",
"a_");
1224 TEST_STRING2KEY(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
1225 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
1228 void TEST_TaggedContentParser() {
1246 const char *text =
" untagged [tag] tagged [empty] ";
1248 TextRef cr_untagged(strstr(text,
"untagged"), 8);
1249 TextRef cr_tagged (strstr(text,
"tagged"), 6);
1250 TextRef tr_tag (strstr(text,
"tag"), 3);
1251 TextRef tr_empty (strstr(text,
"empty"), 5);
1259 TEST_EXPECT(parser.get_content().compare(
"untagged") == 0);
1264 TEST_EXPECT(parser.get_tag ().compare(
"tag") == 0);
1265 TEST_EXPECT(parser.get_content().compare(
"tagged") == 0);
1270 TEST_EXPECT(parser.get_tag().compare(
"empty") == 0);
1281 TEST_EXPECT(parser.get_content().compare(
"hi") == 0);
1292 TEST_EXPECT(parser.get_tag().compare(
"hello") == 0);
1301 TEST_EXPECT(parser.get_content().compare(
"t") == 0);
1305 TEST_EXPECT(parser.get_content().compare(
"t") == 0);
1311 #define TEST_MERGE_TAGGED(t1,t2,r1,r2,s1,s2,expected) do { \
1312 char *result = GBS_merge_tagged_strings(s1, t1, r1, s2, t2, r2); \
1313 TEST_EXPECT_EQUAL(result, expected); \
1317 #define TEST_MERGE_TAGGED__BROKEN(t1,t2,r1,r2,s1,s2,expected,got) do { \
1318 char *result = GBS_merge_tagged_strings(s1, t1, r1, s2, t2, r2); \
1319 TEST_EXPECT_EQUAL__BROKEN(result, expected, got); \
1323 void TEST_merge_tagged_strings() {
1325 const char *_0 =
NULp;
1327 TEST_MERGE_TAGGED(
"S",
"D",
"",
"",
"source",
"dest",
"[D_] dest [S_] source");
1328 TEST_MERGE_TAGGED(
"SRC",
"DST",
"", _0,
"source",
"dest",
"[DST] dest [SRC] source");
1329 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"",
"source",
"dest",
"[DST] dest [SRC] source");
1330 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"sth",
"sth",
"[DST,SRC] sth");
1332 TEST_MERGE_TAGGED(
"SRC",
"DST",
"SRC",
"DST",
"sth",
"sth",
"[DST,SRC] sth");
1333 TEST_MERGE_TAGGED(
"SRC",
"DST",
"SRC",
"DST",
"sth [SRC] del",
"sth [DST] del",
"[DST,SRC] sth");
1336 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST] dest [SRC] source",
"[DST] dest [SRC] newsource");
1337 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST,SRC] sth",
"[DST] sth [SRC] newsource");
1338 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"newsource",
" [DST,src] sth",
"[DST] sth [SRC] newsource");
1339 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"src",
"newsource",
" [DST,SRC] sth",
"[DST] sth [SRC] newsource");
1340 TEST_MERGE_TAGGED(
"SRC",
"DST", _0,
"SRC",
"sth",
" [DST] sth [SRC] source",
"[DST,SRC] sth");
1343 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"newsource",
"[DST] dest [SRC] source",
"[DST] dest [SRC] newsource [SRC] source");
1344 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"newsource",
"[DST,SRC] sth",
"[DST,SRC] sth [SRC] newsource");
1345 TEST_MERGE_TAGGED(
"SRC",
"DST", _0, _0,
"sth",
"[DST] sth [SRC] source",
"[DST,SRC] sth [SRC] source");
1348 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"oth",
" [DST] dest [SRC] source",
"[DST] dest [OTH] oth [SRC] source");
1349 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"oth",
" [DST,SRC] sth",
"[DST,SRC] sth [OTH] oth");
1350 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"sth",
" [DST,SRC] sth",
"[DST,OTH,SRC] sth");
1351 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"dest",
" [DST] dest [SRC] source",
"[DST,OTH] dest [SRC] source");
1352 TEST_MERGE_TAGGED(
"OTH",
"DST", _0, _0,
"source",
" [DST] dest [SRC] source",
"[DST] dest [OTH,SRC] source");
1355 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"oth",
"[DST] dest [OTH] oth [SRC] source");
1356 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST,SRC] sth",
"oth",
"[DST,SRC] sth [OTH] oth");
1357 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST,SRC] sth",
"sth",
"[DST,OTH,SRC] sth");
1358 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"dest",
"[DST,OTH] dest [SRC] source");
1359 TEST_MERGE_TAGGED(
"DST",
"OTH", _0, _0,
" [DST] dest [SRC] source",
"source",
"[DST] dest [OTH,SRC] source");
1362 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre1 [C1] c1 [C2] c2",
"pre2[C2]c2[C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1] pre1 [P2] pre2");
1363 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2",
"pre [C2]c2 [C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1,P2] pre");
1364 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2",
"pre [c2]c2 [C3]c3",
"[C1] c1 [C2] c2 [C3] c3 [P1,P2] pre");
1365 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2a",
"pre [C2]c2b [C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3 [P1,P2] pre");
1366 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" [C1] c1 [C2] c2a [C2] c2b [C3] c3",
"[C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3");
1367 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" [C1] c1 [C2] c2a [C2] c2b [C3] c3",
"[C2] c2b [C3]c3 [C2] c2a",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3");
1368 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1] c1 [C2] c2a",
"pre [c2]c2b [C3]c3",
"[C1] c1 [C2] c2a [C2] c2b [C3] c3 [P1,P2] pre");
1369 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [C1,C4] c1 [C2] c2a ",
"pre [c2] c2b [C4,C3]c3",
"[C1,C4] c1 [C2] c2a [C2] c2b [C3,C4] c3 [P1,P2] pre");
1370 TEST_MERGE_TAGGED(
"P1",
"P2", _0, _0,
" pre [ C1, C4] c1 [C2 ] c2a ",
"pre [ c2] c2b [C4, C3 ]c3",
"[C1,C4] c1 [C2] c2a [C2] c2b [C3,C4] c3 [P1,P2] pre");
1373 #define DSTSRC1 "[DST] dest1 [SRC] src1"
1374 #define DSTSRC2 "[DST] dest2 [SRC] src2"
1375 #define DSTSRC2LOW "[dst] dest2 [src] src2"
1377 TEST_MERGE_TAGGED(
"O1",
"O2", _0, _0, DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src1 [SRC] src2");
1378 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC", _0, DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src2");
1379 TEST_MERGE_TAGGED(
"O1",
"O2", _0,
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src1 [SRC] src2");
1380 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1381 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"DST", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1382 TEST_MERGE_TAGGED(
"O1",
"O2",
"src",
"DST", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1383 TEST_MERGE_TAGGED(
"O1",
"O2",
"src",
"DST", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1384 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"dst", DSTSRC1, DSTSRC2,
"[DST] dest1 [SRC] src2");
1385 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC",
"dst", DSTSRC1, DSTSRC2LOW,
"[DST] dest1 [SRC] src2");
1386 TEST_MERGE_TAGGED(
"O1",
"O2",
"DST",
"SRC", DSTSRC1, DSTSRC2,
"[DST] dest2 [SRC] src1");
1387 TEST_MERGE_TAGGED(
"O1",
"O2",
"DST",
"SRC", DSTSRC1, DSTSRC2LOW,
"[DST] dest2 [SRC] src1");
1388 TEST_MERGE_TAGGED(
"O1",
"O2",
"dst",
"src", DSTSRC1, DSTSRC2,
"[DST] dest2 [SRC] src1");
1389 TEST_MERGE_TAGGED(
"O1",
"O2",
"dst",
"src", DSTSRC1, DSTSRC2LOW,
"[DST] dest2 [SRC] src1");
1390 TEST_MERGE_TAGGED(
"O1",
"O2",
"SRC,DST",
"DST,SRC", DSTSRC1, DSTSRC2,
"[DST] dest1 [DST] dest2 [SRC] src1 [SRC] src2");
1410 #define TEST_EXPECT_TAG_CONTENT(tag,expected) TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED(GB_read_as_tagged_string(gb_entry, tag), expected)
1411 #define TEST_REJECT_TAG_CONTENT(tag) TEST_EXPECT_NORESULT__NOERROREXPORTED(GB_read_as_tagged_string(gb_entry, tag))
1412 #define TEST_EXPECT_FULL_CONTENT(tag) TEST_EXPECT_TAG_CONTENT(tag,tagged_string)
1415 const char *tagged_string =
"[T1,T2] t12 [T3] t3[T4]t4[][]xxx[AA]aa[WW]w1 [WW]w2 [BB]bb [XX]x1 [XX]x2 [yy] yy [Y] y [EMPTY][FAKE,EMPTY]fake[ SP1ST, SPACED, PADDED ,UNSPACED,_SCORED_,FOLLOWED ,FOLLAST ] spaced [LAST] last ";
1418 TEST_EXPECT_FULL_CONTENT(
NULp);
1419 TEST_EXPECT_FULL_CONTENT(
"");
1420 TEST_REJECT_TAG_CONTENT(
" ");
1422 TEST_EXPECT_TAG_CONTENT(
"T1",
"t12");
1423 TEST_EXPECT_TAG_CONTENT(
"T2",
"t12");
1424 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1425 TEST_EXPECT_TAG_CONTENT(
"T4",
"t4[][]xxx");
1427 TEST_EXPECT_TAG_CONTENT(
"AA",
"aa");
1428 TEST_EXPECT_TAG_CONTENT(
"BB",
"bb");
1429 TEST_EXPECT_TAG_CONTENT(
"WW",
"w1");
1430 TEST_EXPECT_TAG_CONTENT(
"XX",
"x1");
1431 TEST_EXPECT_TAG_CONTENT(
"YY",
"yy");
1432 TEST_EXPECT_TAG_CONTENT(
"yy",
"yy");
1434 TEST_REJECT_TAG_CONTENT(
"Y");
1437 TEST_EXPECT_TAG_CONTENT(
"EMPTY",
"fake");
1438 TEST_EXPECT_TAG_CONTENT(
"FAKE",
"fake");
1439 TEST_EXPECT_TAG_CONTENT(
"fake",
"fake");
1441 TEST_REJECT_TAG_CONTENT(
"NOSUCHTAG");
1442 TEST_EXPECT_TAG_CONTENT(
"SPACED",
"spaced");
1443 TEST_EXPECT_TAG_CONTENT(
"SP1ST",
"spaced");
1444 TEST_REJECT_TAG_CONTENT(
" SPACED");
1445 TEST_REJECT_TAG_CONTENT(
"_SPACED");
1446 TEST_EXPECT_TAG_CONTENT(
"PADDED",
"spaced");
1447 TEST_EXPECT_TAG_CONTENT(
"FOLLOWED",
"spaced");
1448 TEST_EXPECT_TAG_CONTENT(
"FOLLAST",
"spaced");
1450 TEST_EXPECT_TAG_CONTENT(
"_SCORED_",
"spaced");
1451 TEST_EXPECT_TAG_CONTENT(
" SCORED ",
"spaced");
1452 TEST_EXPECT_TAG_CONTENT(
"UNSPACED",
"spaced");
1453 TEST_EXPECT_TAG_CONTENT(
"LAST",
"last");
1456 tagged_string =
"bla [WHATEVER hello";
1458 TEST_REJECT_TAG_CONTENT(
"WHATEVER");
1460 tagged_string =
"bla [T1] t1 [T2 t2 [T3] t3";
1462 TEST_EXPECT_TAG_CONTENT(
"T1",
"t1 [T2 t2");
1463 TEST_REJECT_TAG_CONTENT(
"T2");
1464 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1467 tagged_string =
"bla [T1] t1 [ ] sp1 [ ] sp2 [___] us [T3] t3 [_a] a";
1469 TEST_EXPECT_TAG_CONTENT(
"T1",
"t1 [ ] sp1 [ ] sp2");
1470 TEST_EXPECT_FULL_CONTENT(
"");
1471 TEST_REJECT_TAG_CONTENT(
" ");
1472 TEST_REJECT_TAG_CONTENT(
" ");
1473 TEST_REJECT_TAG_CONTENT(
",");
1474 TEST_EXPECT_TAG_CONTENT(
", a",
"a");
1475 TEST_EXPECT_TAG_CONTENT(
", a,",
"a");
1476 TEST_EXPECT_TAG_CONTENT(
", ,a,",
"a");
1477 TEST_EXPECT_TAG_CONTENT(
" ",
"us");
1478 TEST_EXPECT_TAG_CONTENT(
"T3",
"t3");
1483 #define TEST_EXPECT_EVAL_TAGGED(in,dtag,tag,aci,expected) do{ \
1484 TEST_EXPECT_EQUAL_STRINGCOPY__NOERROREXPORTED( \
1485 GBS_modify_tagged_string_with_ACI(in, dtag, tag, aci, callEnv), \
1489 #define TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(in,dtag,tag,aci,expectedErrorPart) do{ \
1490 TEST_EXPECT_NORESULT__ERROREXPORTED_CONTAINS( \
1491 GBS_modify_tagged_string_with_ACI(in, dtag, tag, aci, callEnv), \
1492 expectedErrorPart); \
1500 GBL_env env(gb_main,
"tree_missing");
1507 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
"",
"[DEF] bla");
1508 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
NULp,
"[DEF] bla");
1509 TEST_EXPECT_EVAL_TAGGED(
"bla",
"def",
"tag",
":bla=blub",
"[DEF] bla");
1510 TEST_EXPECT_EVAL_TAGGED(
"bla",
"tag",
"tag",
":bla=blub",
"[TAG] blub");
1511 TEST_EXPECT_EVAL_TAGGED(
"bla",
"tag",
"tag",
"len",
"[TAG] 3");
1514 TEST_EXPECT_EVAL_TAGGED(
"[empty] ",
"def",
"empty",
NULp,
"");
1515 TEST_EXPECT_EVAL_TAGGED(
"[empty] [filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1516 TEST_EXPECT_EVAL_TAGGED(
"[empty] [filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1517 TEST_EXPECT_EVAL_TAGGED(
"[empty][filled] xxx",
"def",
"empty",
NULp,
"[FILLED] xxx");
1518 TEST_EXPECT_EVAL_TAGGED(
"[filled] xxx [empty]",
"def",
"empty",
NULp,
"[FILLED] xxx");
1520 #define THREE_TAGS "[TAG] tag [tip] tip [top] top"
1521 #define THREE_TAGS_UPCASE "[TAG] tag [TIP] tip [TOP] top"
1524 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TAG",
NULp, THREE_TAGS_UPCASE);
1526 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TAG",
":*=<*>",
"[TAG] <tag> [TIP] tip [TOP] top");
1527 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tag",
":*=<*>",
"[TAG] <tag> [TIP] tip [TOP] top");
1528 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":*=(*)",
"[TAG] tag [TIP] (tip) [TOP] top");
1529 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"TIP",
":*=(*)",
"[TAG] tag [TIP] (tip) [TOP] top");
1530 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":*=",
"[TAG] tag [TOP] top");
1531 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"top",
":*=*-*1",
"[TAG] tag [TIP] tip [TOP] top-top");
1532 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
":i=o",
"[TAG] tag [TIP,TOP] top");
1534 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"tip",
"len",
"[TAG] tag [TIP] 3 [TOP] top");
1535 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"top",
"len",
"[TAG] tag [TIP] tip [TOP] 3");
1538 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(THREE_TAGS,
"def",
"top",
":*",
"no '=' found");
1539 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"untagged",
"def",
"def",
":*",
"no '=' found");
1540 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(THREE_TAGS,
"def",
"top",
"illcmd",
"Unknown command 'illcmd'");
1541 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"un [tagged",
"def",
"def",
"illcmd",
"Unknown command 'illcmd'");
1544 TEST_EXPECT_EVAL_TAGGED(THREE_TAGS,
"def",
"no",
"illcmd", THREE_TAGS_UPCASE);
1547 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":*=<*>",
"[DEF] <{no tag>");
1548 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <tag,{no>");
1549 TEST_EXPECT_EVAL_TAGGED(
"[no [tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag,{no>");
1550 TEST_EXPECT_EVAL_TAGGED(
"[no [tag] xx",
"def",
"def",
":* *=<*2,*1>",
"[DEF] {no [TAG] xx");
1551 TEST_EXPECT_EVAL_TAGGED(
"[no [tag[]",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag{},{no>");
1552 TEST_EXPECT_EVAL_TAGGED(
"[no [tag[] xx",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <{tag{} xx,{no>");
1553 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"def",
":* *=<*2,*1>",
"[DEF] <tag,no>");
1554 TEST_EXPECT_EVAL_TAGGED(
"[no tag",
"def",
"def",
":no=yes",
"[DEF] {yes tag");
1555 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"def",
":no=yes",
"[DEF] yes tag");
1556 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"def",
"DEF",
":no=yes",
"[DEF] yes tag");
1557 TEST_EXPECT_EVAL_TAGGED(
"no tag",
"DEF",
"def",
":no=yes",
"[DEF] yes tag");
1558 TEST_EXPECT_EVAL_TAGGED(
"kept [trunk",
"def",
"def",
":*=<*>",
"[DEF] <kept {trunk>");
1559 TEST_EXPECT_EVAL_TAGGED(
"kept",
"def",
"def",
":*=<*>",
"[DEF] <kept>");
1568 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] name='$n'",
"def",
"T1",
":$n=*(name)",
"[T1] name='MetMazei' [T2] name='$n'");
1569 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] seqlen=$l",
"def",
"T2",
":$l=*(|sequence|len)",
"[T1] seqlen=$l [T2] seqlen=165");
1570 TEST_EXPECT_EVAL_TAGGED(
"[T1,T2] nuc",
"def",
"T1",
"dd;\"=\";command(sequence|count(ACGTUN))",
"[T1] nuc=66 [T2] nuc");
1572 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"tax='$t'",
"def",
"def",
":$t=*(|taxonomy(2))",
"Failed to read tree 'tree_missing' (Reason: tree not found)");
1573 TEST_EXPECT_EVAL_TAGGED_ERROR_EXPORTED(
"tax",
"def",
"def",
"dd;\"=\";taxonomy(2)",
"Failed to read tree 'tree_missing' (Reason: tree not found)");
1576 TEST_EXPECT_EVAL_TAGGED(
"untagged [tag] tagged",
"def",
"tag",
":g=G",
"[DEF] untagged [TAG] taGGed");
1577 TEST_EXPECT_EVAL_TAGGED(
" [tag] tagged",
"def",
"tag",
":g=G",
"[TAG] taGGed");
1580 TEST_EXPECT_EVAL_TAGGED(
" untagged ",
"def",
"def",
":g=G",
"[DEF] untaGGed");
1581 TEST_EXPECT_EVAL_TAGGED(
"[tag] tagged ",
"def",
"tag",
":g=G",
"[TAG] taGGed");
1582 TEST_EXPECT_EVAL_TAGGED(
" [trail] trail [tag] tagged ",
"def",
"tag",
":g=G",
"[TAG] taGGed [TRAIL] trail");
1584 #define MIXED_TAGS "[tag] tag [tip,top] tiptop [xx,yy,zz] zzz"
1586 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"tip",
":tip=top",
"[TAG] tag [TIP] toptop [TOP] tiptop [XX,YY,ZZ] zzz");
1587 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"yy",
":zzz=tiptop",
"[TAG] tag [TIP,TOP,YY] tiptop [XX,ZZ] zzz");
1588 TEST_EXPECT_EVAL_TAGGED(MIXED_TAGS,
"def",
"top",
":tiptop=zzz",
"[TAG] tag [TIP] tiptop [TOP,XX,YY,ZZ] zzz");
1594 void TEST_log_action() {
1595 for (
int stamped = 0; stamped<=1; ++stamped) {
1645 #endif // UNIT_TESTS
static void g_bs_read_tagged_hash(const char *value, long subhash, void *cd_g_bs_collect_tags_hash)
static void g_bs_read_final_hash(const char *tag, long value, void *cd_merge_result)
void GBS_hash_do_const_sorted_loop(const GB_HASH *hs, gb_hash_const_loop_type func, gbs_hash_compare_function sorter, void *client_data)
TextRef partBehind(const TextRef &subref) const
GBDATA * GB_open(const char *path, const char *opent)
TextRef(const char *data_, int length_)
static GB_ERROR tab(GBL_command_arguments *args, bool pretab)
static TextRef textBetween(const TextRef &t1, const TextRef &t2)
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
static void g_bs_convert_string_to_tagged_hash_with_delete(GB_HASH *hash, char *s, char *default_tag, const char *del)
size_t GBS_shorten_repeated_data(char *data)
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
static const char * EMPTY_KEY_NOT_ALLOWED
static void g_bs_merge_tags(const char *tag, long, void *cd_sub_result)
int ARB_stricmp(const char *s1, const char *s2)
const char * get_data() const
void GBS_intcat(GBS_strstruct *strstr, long val)
static char * g_bs_get_string_of_tag_hash(GB_HASH *tag_hash)
char * ARB_strdup(const char *str)
char * GB_read_as_string(GBDATA *gbd)
#define TEST_EXPECT_CODE_ASSERTION_FAILS__WANTED(cb)
const char * GBS_global_string(const char *templat,...)
GB_ERROR GB_check_key(const char *key)
GB_HASH * GBS_create_dynaval_hash(long estimated_elements, GB_CASE case_sens, void(*freefun)(long))
void GBS_strncat(GBS_strstruct *strstr, const char *ptr, size_t len)
void GBS_free_hash(GB_HASH *hs)
TextRef headTrimmed() const
void cat(const char *from)
char * ARB_strpartdup(const char *start, const char *end)
bool is_part_of(const TextRef &other) const
void GBS_fwrite_string(const char *strngi, FILE *out)
char buffer[MESSAGE_BUFFERSIZE]
GB_CSTR GB_getenvARBHOME(void)
GB_CSTR GBS_find_string(GB_CSTR cont, GB_CSTR substr, int match_mode)
TaggedContentParser(const char *input_)
#define TEST_EXPECT_SEGFAULT__UNWANTED(cb)
#define TEST_PUBLISH(testfunction)
#define TEST_EXPECT_CODE_ASSERTION_FAILS__UNWANTED(cb)
int compare(const char *str) const
#define TEST_EXPECT_CONTAINS(str, part)
GB_ERROR GB_export_error(const char *error)
GBS_strstruct * GBS_stropen(long init_size)
GB_ERROR GB_await_error()
#define TEST_EXPECT(cond)
TextRef tailTrimmed() const
__ATTR__USERESULT GB_ERROR check_key(const char *key, int len)
GBDATA * GB_create(GBDATA *father, const char *key, GB_TYPES type)
const char * find(char c) const
char * GBS_replace_tabs_by_spaces(const char *text)
const char * get_following() const
static long g_bs_free_hash_of_hashes_elem(const char *, long val, void *)
char * GBS_unescape_string(const char *str, const char *escaped_chars, char escape_char)
uint32_t GB_checksum(const char *seq, long length, int ignore_case, const char *exclude)
#define TEST_REJECT(cond)
#define TEST_REJECT_NULL(n)
void GBS_strcat(GBS_strstruct *strstr, const char *ptr)
static void error(const char *msg)
char * GB_memdup(const char *source, size_t len)
const TextRef & get_tag() const
const TextRef & get_content() const
TextRef partBefore(const TextRef &subref) const
void GBS_dynaval_free(long val)
static char * GBS_string_2_key_with_exclusions(const char *str, const char *additional)
char * GBS_string_2_key(const char *str)
char * GBS_fconvert_string(char *buffer)
void GBS_strforget(GBS_strstruct *strstr)
const char * GBS_funptr2readable(void *funptr, bool stripARBHOME)
char * ARB_strupper(char *s)
GB_ERROR GB_write_int(GBDATA *gbd, long i)
void GBS_hash_do_loop(GB_HASH *hs, gb_hash_loop_type func, void *client_data)
#define __ATTR__REDUCED_OPTIMIZE
GB_CSTR GB_getenv(const char *env)
void GBS_chrcat(GBS_strstruct *strstr, char ch)
void spaced(const char *word)
static void g_bs_free_hash_of_hashes(GB_HASH *hash)
char * GB_read_as_tagged_string(GBDATA *gbd, const char *tagi)
#define TEST_EXPECT_NO_SEGFAULT__WANTED(cb)
static char * dated_info(const char *info)
long GBS_gcgchecksum(const char *seq)
char * ARB_strndup(const char *start, int len)
#define TEST_EXPECT_CODE_ASSERTION_FAILS(cb)
int icompare(const char *str) const
static char * GBS_fread_string(FILE *in)
char * GBS_trim(const char *str)
GB_ERROR GB_write_ints(GBDATA *gbd, const GB_UINT4 *i, long size)
#define TEST_EXPECT_NO_SEGFAULT(cb)
#define __ATTR__USERESULT
char * GBS_strclose(GBS_strstruct *strstr)
#define TEST_EXPECT_NO_ERROR(call)
TextRef(const char *zeroTerminated)
#define TEST_EXPECT_SEGFAULT__WANTED(cb)
#define TEST_EXPECT_SEGFAULT(cb)
int GBS_HCF_sortedByKey(const char *k0, long dummy_1x, const char *k1, long dummy_2x)
uint32_t GBS_checksum(const char *seq, int ignore_case, const char *exclude)
static void g_bs_add_value_tag_to_hash(GB_HASH *hash, const char *tag, char *value)
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
#define TEST_EXPECT_ERROR_CONTAINS(call, part)
#define TEST_EXPECT_DIFFERENT(expr, want)
bool ARB_strBeginsWith(const char *str, const char *with)
char * GBS_merge_tagged_strings(const char *s1, const char *tag1, const char *replace1, const char *s2, const char *tag2, const char *replace2)
NOT4PERL char * GB_command_interpreter_in_env(const char *str, const char *commands, const GBL_call_env &callEnv)
static GB_ERROR g_bs_convert_string_to_tagged_hash_with_rewrite(GB_HASH *hash, char *s, char *default_tag, const char *rtag, const char *aci, GBL_call_env &env)
char * GBS_escape_string(const char *str, const char *chars_to_escape, char escape_char)
GB_transaction ta(gb_var)
char * GBS_log_action_to(const char *comment, const char *action, bool stamp)
char * GBS_eval_env(GB_CSTR p)
char * GBS_modify_tagged_string_with_ACI(const char *s, const char *dt, const char *tag, const char *aci, GBL_call_env &env)
static int info[maxsites+1]
GB_ERROR GB_check_hkey(const char *key)
#define TEST_EXPECT_EQUAL(expr, want)
long GBS_read_hash(const GB_HASH *hs, const char *key)
char * GBS_global_string_copy(const char *templat,...)
void GB_close(GBDATA *gbd)
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)
GB_write_int const char s