| Line |
Branch |
Exec |
Source |
| 1 |
|
|
//API for assocarr<mytype> myarr: |
| 2 |
|
|
//myarr.exists("index") |
| 3 |
|
|
// Returns a boolean telling whether the entry exists. |
| 4 |
|
|
// Complexity: O(log n). |
| 5 |
|
|
//myarr.find("index") |
| 6 |
|
|
// Returns a mytype& corresponding to the relevant entry. If it doesn't exist, behaviour is undefined. |
| 7 |
|
|
// Complexity: O(log n). |
| 8 |
|
|
//myarr.create("index") |
| 9 |
|
|
// Returns a mytype& corresponding to the relevant entry. If it doesn't exist, it's created. |
| 10 |
|
|
// Complexity: Worst case O(n), reduced to amortized O(log n) if the element should be at the end (strict weak ordering), or O(log n) if the element |
| 11 |
|
|
// exists. |
| 12 |
|
|
//myarr.remove("index") |
| 13 |
|
|
// Removes the element corresponding to the relevant entry. If it doesn't exist, this structure is left untouched. |
| 14 |
|
|
// Complexity: Worst case O(n), reduced to amortized O(log n) if the element is at the end. |
| 15 |
|
|
//myarr.reset() |
| 16 |
|
|
// Clears the data structure, calling all destructors. It is safe to call this function on an empty structure. |
| 17 |
|
|
// Complexity: O(n). |
| 18 |
|
|
//myarr.move("from", "to") |
| 19 |
|
|
// Moves an element from index "from" to "to". If the source doesn't exist, behaviour is undefined. If the target exists, no action is performed. |
| 20 |
|
|
// Complexity: O(n). |
| 21 |
|
|
//myarr["index"] |
| 22 |
|
|
// Similar to myarr.create("index"), but if the returned entry isn't changed by the next call to any function in the same structure, it's removed. |
| 23 |
|
|
// if (myarr["index"]) is safe if type can cast to a bool, and myarr["index"]=4 is also valid if the assignment is valid for a type&. However, it is |
| 24 |
|
|
// not safe to use assocarr<assocarr<int> > myarr; if (myarr["3"]["4"]), since the inner assocarr won't know that it's supposed to be garbage collected, |
| 25 |
|
|
// and the outer one sees that the inner one changed, so you get pollution and memory waste. However, if (myarr["3"].exists("4")) is safe. |
| 26 |
|
|
// Complexity: Same as myarr.create(). |
| 27 |
|
|
//myarr.each(func) |
| 28 |
|
|
// Calls func() for each entry in the structure. func must match the prototype void func(const char * index, mytype& val), but can be a lambda. No |
| 29 |
|
|
// non-const function may be called on this structure from inside func(), but it is safe to call const functions of the structure. The function |
| 30 |
|
|
// calls are in the same order as the indexes, in a strict weak ordering. |
| 31 |
|
|
// Complexity: O(n). |
| 32 |
|
|
//Space usage: O(n). |
| 33 |
|
|
//C++ version: C++98 or C++03, not sure which. |
| 34 |
|
|
//Serializer support: Yes, if mytype is serializable. |
| 35 |
|
|
//"Undefined behaviour" means "segfault" in most cases. |
| 36 |
|
|
|
| 37 |
|
|
#pragma once |
| 38 |
|
|
|
| 39 |
|
|
#include <initializer_list> |
| 40 |
|
|
#include "std-includes.h" |
| 41 |
|
|
#include "libmisc.h"//bitround |
| 42 |
|
|
|
| 43 |
|
|
//just a helper for initializer list |
| 44 |
|
|
template<typename T1, typename T2> struct pair{ |
| 45 |
|
|
T1 first; |
| 46 |
|
|
T2 second; |
| 47 |
|
|
}; |
| 48 |
|
|
|
| 49 |
|
|
template<typename right> class assocarr { |
| 50 |
|
|
public: |
| 51 |
|
|
int num; |
| 52 |
|
|
|
| 53 |
|
|
private: |
| 54 |
|
|
|
| 55 |
|
|
const char ** indexes; |
| 56 |
|
|
right ** ptr; |
| 57 |
|
|
int bufferlen; |
| 58 |
|
|
|
| 59 |
|
|
char lastone[sizeof(right)]; |
| 60 |
|
|
int lastid; |
| 61 |
|
|
|
| 62 |
|
314992 |
void collectgarbage(const char * ifnotmatch=nullptr) |
| 63 |
|
|
{ |
| 64 |
9/16
assocarr<snes_label>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 752 times.
✗ Branch 2 → 4 not taken.
assocarr<sourcefile>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 430 times.
✗ Branch 2 → 4 not taken.
assocarr<snes_struct>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 114 times.
✗ Branch 2 → 4 not taken.
assocarr<memory_buffer>::collectgarbage(char const*):
✗ Branch 2 → 3 not taken.
✗ Branch 2 → 4 not taken.
assocarr<string>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 223232 times.
✗ Branch 2 → 4 not taken.
assocarr<funcdat>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 30 times.
✓ Branch 2 → 4 taken 30 times.
assocarr<macrodata*>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 252 times.
✗ Branch 2 → 4 not taken.
assocarr<double (*)()>::collectgarbage(char const*):
✓ Branch 2 → 3 taken 2030 times.
✓ Branch 2 → 4 taken 88122 times.
|
314992 |
if (lastid==-1) return; |
| 65 |
6/32
assocarr<snes_label>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<sourcefile>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<snes_struct>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<memory_buffer>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<string>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<funcdat>::collectgarbage(char const*):
✓ Branch 4 → 5 taken 30 times.
✗ Branch 4 → 7 not taken.
✓ Branch 5 → 6 taken 30 times.
✗ Branch 5 → 7 not taken.
assocarr<macrodata*>::collectgarbage(char const*):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 7 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<double (*)()>::collectgarbage(char const*):
✓ Branch 4 → 5 taken 87922 times.
✓ Branch 4 → 7 taken 200 times.
✓ Branch 5 → 6 taken 24 times.
✓ Branch 5 → 7 taken 87898 times.
|
88152 |
if (ifnotmatch && !strcmp(indexes[lastid], ifnotmatch)) return; |
| 66 |
1/16
assocarr<snes_label>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<sourcefile>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<snes_struct>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<memory_buffer>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<string>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<funcdat>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<macrodata*>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<double (*)()>::collectgarbage(char const*):
✗ Branch 7 → 8 not taken.
✓ Branch 7 → 9 taken 88098 times.
|
88098 |
if (!memcmp(ptr[lastid], lastone, sizeof(right))) |
| 67 |
|
|
{ |
| 68 |
|
✗ |
int tmpid=lastid; |
| 69 |
|
✗ |
lastid=-1; |
| 70 |
|
✗ |
remove(indexes[tmpid]); |
| 71 |
|
|
} |
| 72 |
|
88098 |
lastid=-1; |
| 73 |
|
|
} |
| 74 |
|
|
|
| 75 |
|
312336 |
right& rawadd(const char * index, bool collect) |
| 76 |
|
|
{ |
| 77 |
|
312336 |
collectgarbage(index); |
| 78 |
|
312336 |
int loc=0; |
| 79 |
|
312336 |
int skip= (int)bitround((unsigned int)num); |
| 80 |
14/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 1970 times.
✓ Branch 15 → 16 taken 346 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 56 times.
✓ Branch 15 → 16 taken 230 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 218 times.
✓ Branch 15 → 16 taken 24 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 15 → 5 not taken.
✗ Branch 15 → 16 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 1056530 times.
✓ Branch 15 → 16 taken 10124 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 30 times.
✓ Branch 15 → 16 taken 30 times.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 72 times.
✓ Branch 15 → 16 taken 50 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 15 → 5 taken 607934 times.
✓ Branch 15 → 16 taken 88006 times.
|
1765620 |
while (skip) |
| 81 |
|
|
{ |
| 82 |
|
|
int dir; |
| 83 |
13/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 52 times.
✓ Branch 5 → 7 taken 1918 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 1 time.
✓ Branch 5 → 7 taken 55 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 2 times.
✓ Branch 5 → 7 taken 216 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 7462 times.
✓ Branch 5 → 7 taken 1049068 times.
assocarr<funcdat>::rawadd(char const*, bool):
✗ Branch 5 → 6 not taken.
✓ Branch 5 → 7 taken 30 times.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 2 times.
✓ Branch 5 → 7 taken 70 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 5 → 6 taken 78968 times.
✓ Branch 5 → 7 taken 528966 times.
|
1666810 |
if (loc>=num) dir=1; |
| 84 |
|
1580323 |
else dir=strcmp(indexes[loc], index); |
| 85 |
11/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 8 → 9 taken 366 times.
✓ Branch 8 → 10 taken 1604 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 10 taken 56 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 8 → 9 taken 86 times.
✓ Branch 8 → 10 taken 132 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 10 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 8 → 9 taken 211416 times.
✓ Branch 8 → 10 taken 845114 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 8 → 9 taken 30 times.
✗ Branch 8 → 10 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✗ Branch 8 → 9 not taken.
✓ Branch 8 → 10 taken 72 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 8 → 9 taken 954 times.
✓ Branch 8 → 10 taken 606980 times.
|
1666810 |
if (!dir) return ptr[loc][0]; |
| 86 |
|
1453958 |
skip/=2; |
| 87 |
12/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 676 times.
✓ Branch 10 → 12 taken 928 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 20 times.
✓ Branch 10 → 12 taken 36 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 44 times.
✓ Branch 10 → 12 taken 88 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 12 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 400378 times.
✓ Branch 10 → 12 taken 444736 times.
assocarr<funcdat>::rawadd(char const*, bool):
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 12 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 26 times.
✓ Branch 10 → 12 taken 46 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 10 → 11 taken 230528 times.
✓ Branch 10 → 12 taken 376452 times.
|
1453958 |
if (dir>0) loc-=skip; |
| 88 |
|
822286 |
else loc+=skip; |
| 89 |
11/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 13 → 14 taken 20 times.
✓ Branch 13 → 15 taken 1584 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✗ Branch 13 → 14 not taken.
✓ Branch 13 → 15 taken 56 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 13 → 14 taken 4 times.
✓ Branch 13 → 15 taken 128 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 13 → 14 taken 48 times.
✓ Branch 13 → 15 taken 845066 times.
assocarr<funcdat>::rawadd(char const*, bool):
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 13 → 14 taken 2 times.
✓ Branch 13 → 15 taken 70 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 13 → 14 taken 600 times.
✓ Branch 13 → 15 taken 606380 times.
|
1453958 |
if (loc<0) |
| 90 |
|
|
{ |
| 91 |
|
674 |
loc=0; |
| 92 |
|
674 |
break; |
| 93 |
|
|
} |
| 94 |
|
|
} |
| 95 |
25/32
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 250 times.
✓ Branch 16 → 19 taken 116 times.
✓ Branch 17 → 18 taken 150 times.
✓ Branch 17 → 19 taken 100 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 29 times.
✓ Branch 16 → 19 taken 201 times.
✓ Branch 17 → 18 taken 15 times.
✓ Branch 17 → 19 taken 14 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 18 times.
✓ Branch 16 → 19 taken 10 times.
✓ Branch 17 → 18 taken 10 times.
✓ Branch 17 → 19 taken 8 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 19 not taken.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 19 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 5194 times.
✓ Branch 16 → 19 taken 4978 times.
✓ Branch 17 → 18 taken 5086 times.
✓ Branch 17 → 19 taken 108 times.
assocarr<funcdat>::rawadd(char const*, bool):
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 19 taken 30 times.
✗ Branch 17 → 18 not taken.
✗ Branch 17 → 19 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 30 times.
✓ Branch 16 → 19 taken 22 times.
✓ Branch 17 → 18 taken 20 times.
✓ Branch 17 → 19 taken 10 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 16 → 17 taken 87414 times.
✓ Branch 16 → 19 taken 1192 times.
✓ Branch 17 → 18 taken 60654 times.
✓ Branch 17 → 19 taken 26760 times.
|
99484 |
if (loc<num && strcmp(indexes[loc], index)<0) loc++; |
| 96 |
13/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 224 times.
✓ Branch 19 → 24 taken 142 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 224 times.
✓ Branch 19 → 24 taken 6 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 22 times.
✓ Branch 19 → 24 taken 6 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 19 → 20 not taken.
✗ Branch 19 → 24 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 5172 times.
✓ Branch 19 → 24 taken 5000 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 30 times.
✗ Branch 19 → 24 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 42 times.
✓ Branch 19 → 24 taken 10 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 19 → 20 taken 6166 times.
✓ Branch 19 → 24 taken 82440 times.
|
99484 |
if (num==bufferlen) |
| 97 |
|
|
{ |
| 98 |
13/16
assocarr<snes_label>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 94 times.
✓ Branch 20 → 22 taken 130 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 200 times.
✓ Branch 20 → 22 taken 24 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 8 times.
✓ Branch 20 → 22 taken 14 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 20 → 21 not taken.
✗ Branch 20 → 22 not taken.
assocarr<string>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 1192 times.
✓ Branch 20 → 22 taken 3980 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 30 times.
✗ Branch 20 → 22 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 22 times.
✓ Branch 20 → 22 taken 20 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 20 → 21 taken 792 times.
✓ Branch 20 → 22 taken 5374 times.
|
11880 |
if (!num) bufferlen=1; |
| 99 |
|
9542 |
else bufferlen*=2; |
| 100 |
|
11880 |
ptr=(right**)realloc(ptr, sizeof(right*)*(size_t)bufferlen); |
| 101 |
|
11880 |
indexes=(const char**)realloc(indexes, sizeof(const char *)*(size_t)bufferlen); |
| 102 |
|
|
} |
| 103 |
|
99484 |
num++; |
| 104 |
|
99484 |
memmove(indexes+loc+1, indexes+loc, sizeof(const char *)*(size_t)(num-loc-1)); |
| 105 |
|
99484 |
memmove(ptr+loc+1, ptr+loc, sizeof(right*)*(size_t)(num-loc-1)); |
| 106 |
|
99484 |
indexes[loc]= duplicate_string(index); |
| 107 |
|
99484 |
ptr[loc]=(right*)malloc(sizeof(right)); |
| 108 |
|
99484 |
memset(ptr[loc], 0, sizeof(right)); |
| 109 |
5/12
assocarr<snes_label>::rawadd(char const*, bool):
✗ Branch 27 → 28 not taken.
✓ Branch 27 → 29 taken 366 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✗ Branch 27 → 28 not taken.
✓ Branch 27 → 29 taken 28 times.
assocarr<string>::rawadd(char const*, bool):
✗ Branch 27 → 28 not taken.
✓ Branch 27 → 29 taken 10172 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 26 → 27 taken 30 times.
✗ Branch 26 → 33 not taken.
✗ Branch 27 → 28 not taken.
✓ Branch 27 → 29 taken 30 times.
✗ Branch 33 → 34 not taken.
✗ Branch 33 → 35 not taken.
|
99484 |
new(ptr[loc]) right; |
| 110 |
7/16
assocarr<snes_label>::rawadd(char const*, bool):
✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 366 times.
assocarr<sourcefile>::rawadd(char const*, bool):
✗ Branch 26 → 27 not taken.
✓ Branch 26 → 28 taken 230 times.
assocarr<snes_struct>::rawadd(char const*, bool):
✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 28 times.
assocarr<memory_buffer>::rawadd(char const*, bool):
✗ Branch 26 → 27 not taken.
✗ Branch 26 → 28 not taken.
assocarr<string>::rawadd(char const*, bool):
✗ Branch 29 → 30 not taken.
✓ Branch 29 → 31 taken 10172 times.
assocarr<funcdat>::rawadd(char const*, bool):
✓ Branch 29 → 30 taken 30 times.
✗ Branch 29 → 31 not taken.
assocarr<macrodata*>::rawadd(char const*, bool):
✗ Branch 26 → 27 not taken.
✓ Branch 26 → 28 taken 52 times.
assocarr<double (*)()>::rawadd(char const*, bool):
✓ Branch 26 → 27 taken 88606 times.
✗ Branch 26 → 28 not taken.
|
99484 |
if (collect) |
| 111 |
|
|
{ |
| 112 |
|
88636 |
lastid=loc; |
| 113 |
|
88636 |
memcpy(lastone, ptr[loc], sizeof(right)); |
| 114 |
|
|
} |
| 115 |
|
99484 |
return ptr[loc][0]; |
| 116 |
|
|
} |
| 117 |
|
|
|
| 118 |
|
1079802 |
int find_i(const char * index) const |
| 119 |
|
|
{ |
| 120 |
|
1079802 |
int loc=0; |
| 121 |
|
1079802 |
int skip=(int)bitround((unsigned int)num); |
| 122 |
13/14
assocarr<snes_label>::find_i(char const*) const:
✓ Branch 14 → 4 taken 14182 times.
✓ Branch 14 → 15 taken 550 times.
assocarr<sourcefile>::find_i(char const*) const:
✓ Branch 14 → 4 taken 3350 times.
✓ Branch 14 → 15 taken 230 times.
assocarr<snes_struct>::find_i(char const*) const:
✓ Branch 14 → 4 taken 844 times.
✓ Branch 14 → 15 taken 36 times.
assocarr<memory_buffer>::find_i(char const*) const:
✗ Branch 14 → 4 not taken.
✓ Branch 14 → 15 taken 1366 times.
assocarr<string>::find_i(char const*) const:
✓ Branch 14 → 4 taken 4572096 times.
✓ Branch 14 → 15 taken 220686 times.
assocarr<macrodata*>::find_i(char const*) const:
✓ Branch 14 → 4 taken 1052 times.
✓ Branch 14 → 15 taken 50 times.
assocarr<double (*)()>::find_i(char const*) const:
✓ Branch 14 → 4 taken 7246 times.
✓ Branch 14 → 15 taken 30 times.
|
4821718 |
while (skip) |
| 123 |
|
|
{ |
| 124 |
|
|
int dir; |
| 125 |
11/14
assocarr<snes_label>::find_i(char const*) const:
✓ Branch 4 → 5 taken 144 times.
✓ Branch 4 → 6 taken 14038 times.
assocarr<sourcefile>::find_i(char const*) const:
✓ Branch 4 → 5 taken 9 times.
✓ Branch 4 → 6 taken 3341 times.
assocarr<snes_struct>::find_i(char const*) const:
✓ Branch 4 → 5 taken 14 times.
✓ Branch 4 → 6 taken 830 times.
assocarr<memory_buffer>::find_i(char const*) const:
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 6 not taken.
assocarr<string>::find_i(char const*) const:
✓ Branch 4 → 5 taken 7658 times.
✓ Branch 4 → 6 taken 4564438 times.
assocarr<macrodata*>::find_i(char const*) const:
✓ Branch 4 → 5 taken 2 times.
✓ Branch 4 → 6 taken 1050 times.
assocarr<double (*)()>::find_i(char const*) const:
✗ Branch 4 → 5 not taken.
✓ Branch 4 → 6 taken 7246 times.
|
4598770 |
if (loc>=num) dir=1; |
| 126 |
|
4590943 |
else dir=strcmp(indexes[loc], index); |
| 127 |
12/14
assocarr<snes_label>::find_i(char const*) const:
✓ Branch 7 → 8 taken 4638 times.
✓ Branch 7 → 9 taken 9544 times.
assocarr<sourcefile>::find_i(char const*) const:
✓ Branch 7 → 8 taken 1876 times.
✓ Branch 7 → 9 taken 1474 times.
assocarr<snes_struct>::find_i(char const*) const:
✓ Branch 7 → 8 taken 386 times.
✓ Branch 7 → 9 taken 458 times.
assocarr<memory_buffer>::find_i(char const*) const:
✗ Branch 7 → 8 not taken.
✗ Branch 7 → 9 not taken.
assocarr<string>::find_i(char const*) const:
✓ Branch 7 → 8 taken 848348 times.
✓ Branch 7 → 9 taken 3723748 times.
assocarr<macrodata*>::find_i(char const*) const:
✓ Branch 7 → 8 taken 432 times.
✓ Branch 7 → 9 taken 620 times.
assocarr<double (*)()>::find_i(char const*) const:
✓ Branch 7 → 8 taken 954 times.
✓ Branch 7 → 9 taken 6292 times.
|
4598770 |
if (!dir) return loc; |
| 128 |
|
3742136 |
skip/=2; |
| 129 |
12/14
assocarr<snes_label>::find_i(char const*) const:
✓ Branch 9 → 10 taken 3916 times.
✓ Branch 9 → 11 taken 5628 times.
assocarr<sourcefile>::find_i(char const*) const:
✓ Branch 9 → 10 taken 570 times.
✓ Branch 9 → 11 taken 904 times.
assocarr<snes_struct>::find_i(char const*) const:
✓ Branch 9 → 10 taken 90 times.
✓ Branch 9 → 11 taken 368 times.
assocarr<memory_buffer>::find_i(char const*) const:
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
assocarr<string>::find_i(char const*) const:
✓ Branch 9 → 10 taken 1581488 times.
✓ Branch 9 → 11 taken 2142260 times.
assocarr<macrodata*>::find_i(char const*) const:
✓ Branch 9 → 10 taken 230 times.
✓ Branch 9 → 11 taken 390 times.
assocarr<double (*)()>::find_i(char const*) const:
✓ Branch 9 → 10 taken 1752 times.
✓ Branch 9 → 11 taken 4540 times.
|
3742136 |
if (dir>0) loc-=skip; |
| 130 |
|
2154090 |
else loc+=skip; |
| 131 |
10/14
assocarr<snes_label>::find_i(char const*) const:
✓ Branch 12 → 13 taken 68 times.
✓ Branch 12 → 14 taken 9476 times.
assocarr<sourcefile>::find_i(char const*) const:
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 14 taken 1474 times.
assocarr<snes_struct>::find_i(char const*) const:
✓ Branch 12 → 13 taken 12 times.
✓ Branch 12 → 14 taken 446 times.
assocarr<memory_buffer>::find_i(char const*) const:
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
assocarr<string>::find_i(char const*) const:
✓ Branch 12 → 13 taken 138 times.
✓ Branch 12 → 14 taken 3723610 times.
assocarr<macrodata*>::find_i(char const*) const:
✓ Branch 12 → 13 taken 2 times.
✓ Branch 12 → 14 taken 618 times.
assocarr<double (*)()>::find_i(char const*) const:
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 14 taken 6292 times.
|
3742136 |
if (loc<0) return -1; |
| 132 |
|
|
} |
| 133 |
|
222948 |
return -1; |
| 134 |
|
|
} |
| 135 |
|
|
|
| 136 |
|
|
public: |
| 137 |
|
|
|
| 138 |
|
652068 |
bool exists(const char * index) const |
| 139 |
|
|
{ |
| 140 |
|
652068 |
return find_i(index)>=0; |
| 141 |
|
|
} |
| 142 |
|
|
|
| 143 |
|
427734 |
right& find(const char * index) const |
| 144 |
|
|
{ |
| 145 |
|
427734 |
return ptr[find_i(index)][0]; |
| 146 |
|
|
} |
| 147 |
|
|
|
| 148 |
|
222716 |
right& create(const char * index) |
| 149 |
|
|
{ |
| 150 |
|
222716 |
return rawadd(index, false); |
| 151 |
|
|
} |
| 152 |
|
|
|
| 153 |
|
60 |
void remove(const char * index) |
| 154 |
|
|
{ |
| 155 |
|
60 |
collectgarbage(); |
| 156 |
|
60 |
int loc=0; |
| 157 |
|
60 |
int skip= (int)bitround((unsigned int)num); |
| 158 |
1/16
assocarr<snes_label>::remove(char const*):
✗ Branch 17 → 5 not taken.
✗ Branch 17 → 18 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 17 → 5 not taken.
✗ Branch 17 → 18 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 18 → 5 not taken.
✗ Branch 18 → 19 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 17 → 5 not taken.
✗ Branch 17 → 18 not taken.
assocarr<string>::remove(char const*):
✓ Branch 18 → 5 taken 240 times.
✗ Branch 18 → 19 not taken.
assocarr<funcdat>::remove(char const*):
✗ Branch 18 → 5 not taken.
✗ Branch 18 → 19 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 17 → 5 not taken.
✗ Branch 17 → 18 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 17 → 5 not taken.
✗ Branch 17 → 18 not taken.
|
240 |
while (skip) |
| 159 |
|
|
{ |
| 160 |
|
|
int dir; |
| 161 |
2/16
assocarr<snes_label>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<string>::remove(char const*):
✓ Branch 5 → 6 taken 6 times.
✓ Branch 5 → 7 taken 234 times.
assocarr<funcdat>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 7 not taken.
|
240 |
if (loc>=num) dir=1; |
| 162 |
|
234 |
else dir=strcmp(indexes[loc], index); |
| 163 |
2/16
assocarr<snes_label>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 13 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
assocarr<string>::remove(char const*):
✓ Branch 8 → 9 taken 60 times.
✓ Branch 8 → 13 taken 180 times.
assocarr<funcdat>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 13 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 8 → 9 not taken.
✗ Branch 8 → 12 not taken.
|
240 |
if (!dir) |
| 164 |
|
|
{ |
| 165 |
|
60 |
free((void*)indexes[loc]); |
| 166 |
|
60 |
ptr[loc]->~right(); |
| 167 |
|
60 |
free(ptr[loc]); |
| 168 |
|
60 |
memmove(indexes+loc, indexes+loc+1, sizeof(const char *)*(size_t)(num-loc-1)); |
| 169 |
|
60 |
memmove(ptr+loc, ptr+loc+1, sizeof(right*)*(size_t)(num-loc-1)); |
| 170 |
|
60 |
num--; |
| 171 |
1/16
assocarr<snes_label>::remove(char const*):
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 12 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
assocarr<string>::remove(char const*):
✗ Branch 10 → 11 not taken.
✓ Branch 10 → 12 taken 60 times.
assocarr<funcdat>::remove(char const*):
✗ Branch 10 → 11 not taken.
✗ Branch 10 → 12 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 9 → 10 not taken.
✗ Branch 9 → 11 not taken.
|
60 |
if (num==bufferlen/2) |
| 172 |
|
|
{ |
| 173 |
|
✗ |
bufferlen/=2; |
| 174 |
|
✗ |
ptr=(right**)realloc(ptr, sizeof(right*)*(size_t)bufferlen); |
| 175 |
|
✗ |
indexes=(const char**)realloc(indexes, sizeof(const char *)*(size_t)bufferlen); |
| 176 |
|
|
} |
| 177 |
|
60 |
return; |
| 178 |
|
|
} |
| 179 |
|
180 |
skip/=2; |
| 180 |
2/16
assocarr<snes_label>::remove(char const*):
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
assocarr<string>::remove(char const*):
✓ Branch 13 → 14 taken 60 times.
✓ Branch 13 → 15 taken 120 times.
assocarr<funcdat>::remove(char const*):
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 15 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 12 → 13 not taken.
✗ Branch 12 → 14 not taken.
|
180 |
if (dir>0) loc-=skip; |
| 181 |
|
120 |
else loc+=skip; |
| 182 |
1/16
assocarr<snes_label>::remove(char const*):
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
assocarr<sourcefile>::remove(char const*):
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
assocarr<snes_struct>::remove(char const*):
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 18 not taken.
assocarr<memory_buffer>::remove(char const*):
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
assocarr<string>::remove(char const*):
✗ Branch 16 → 17 not taken.
✓ Branch 16 → 18 taken 180 times.
assocarr<funcdat>::remove(char const*):
✗ Branch 16 → 17 not taken.
✗ Branch 16 → 18 not taken.
assocarr<macrodata*>::remove(char const*):
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
assocarr<double (*)()>::remove(char const*):
✗ Branch 15 → 16 not taken.
✗ Branch 15 → 17 not taken.
|
180 |
if (loc<0) return; |
| 183 |
|
|
} |
| 184 |
|
|
} |
| 185 |
|
|
|
| 186 |
|
|
void move(const char * from, const char * to) |
| 187 |
|
|
{ |
| 188 |
|
|
collectgarbage(); |
| 189 |
|
|
int frompos=find_i(from); |
| 190 |
|
|
int topos=0; |
| 191 |
|
|
int skip=bitround(num); |
| 192 |
|
|
while (skip) |
| 193 |
|
|
{ |
| 194 |
|
|
int dir; |
| 195 |
|
|
if (topos>=num) dir=1; |
| 196 |
|
|
else dir=strcmp(indexes[topos], to); |
| 197 |
|
|
if (!dir) return; |
| 198 |
|
|
skip/=2; |
| 199 |
|
|
if (dir>0) topos-=skip; |
| 200 |
|
|
else topos+=skip; |
| 201 |
|
|
if (topos<0) |
| 202 |
|
|
{ |
| 203 |
|
|
topos=0; |
| 204 |
|
|
break; |
| 205 |
|
|
} |
| 206 |
|
|
} |
| 207 |
|
|
if (topos<num && strcmp(indexes[topos], to)<0) topos++; |
| 208 |
|
|
right * tmp=ptr[frompos]; |
| 209 |
|
|
if (topos==frompos || topos==frompos+1) |
| 210 |
|
|
{ |
| 211 |
|
|
free((void*)indexes[frompos]); |
| 212 |
|
|
indexes[frompos]= duplicate_string(to); |
| 213 |
|
|
} |
| 214 |
|
|
else if (topos>frompos) |
| 215 |
|
|
{ |
| 216 |
|
|
free((void*)indexes[frompos]); |
| 217 |
|
|
memmove(indexes+frompos, indexes+frompos+1, sizeof(const char *)*(topos-frompos-1)); |
| 218 |
|
|
memmove(ptr+frompos, ptr+frompos+1, sizeof(right*)*(topos-frompos-1)); |
| 219 |
|
|
ptr[topos-1]=tmp; |
| 220 |
|
|
indexes[topos-1]= duplicate_string(to);//I wonder what the fuck I'm doing. |
| 221 |
|
|
} |
| 222 |
|
|
else |
| 223 |
|
|
{ |
| 224 |
|
|
free((void*)indexes[frompos]); |
| 225 |
|
|
memmove(indexes+topos+1, indexes+topos, sizeof(const char *)*(frompos-topos)); |
| 226 |
|
|
memmove(ptr+topos+1, ptr+topos, sizeof(right*)*(frompos-topos)); |
| 227 |
|
|
ptr[topos]=tmp; |
| 228 |
|
|
indexes[topos]= duplicate_string(to); |
| 229 |
|
|
} |
| 230 |
|
|
} |
| 231 |
|
|
|
| 232 |
|
4176 |
void reset() |
| 233 |
|
|
{ |
| 234 |
15/16
assocarr<snes_label>::reset():
✓ Branch 4 → 3 taken 366 times.
✓ Branch 4 → 5 taken 300 times.
assocarr<sourcefile>::reset():
✓ Branch 4 → 3 taken 230 times.
✓ Branch 4 → 5 taken 300 times.
assocarr<snes_struct>::reset():
✓ Branch 5 → 3 taken 28 times.
✓ Branch 5 → 6 taken 300 times.
assocarr<memory_buffer>::reset():
✗ Branch 4 → 3 not taken.
✓ Branch 4 → 5 taken 400 times.
assocarr<string>::reset():
✓ Branch 5 → 3 taken 8112 times.
✓ Branch 5 → 6 taken 1092 times.
assocarr<funcdat>::reset():
✓ Branch 5 → 3 taken 25 times.
✓ Branch 5 → 6 taken 692 times.
assocarr<macrodata*>::reset():
✓ Branch 4 → 3 taken 52 times.
✓ Branch 4 → 5 taken 300 times.
assocarr<double (*)()>::reset():
✓ Branch 4 → 3 taken 69401 times.
✓ Branch 4 → 5 taken 792 times.
|
82390 |
for (int i=0;i<num;i++) |
| 235 |
|
|
{ |
| 236 |
|
78214 |
free((void*)indexes[i]); |
| 237 |
|
78214 |
ptr[i]->~right(); |
| 238 |
|
78214 |
free(ptr[i]); |
| 239 |
|
|
} |
| 240 |
|
4176 |
free(indexes); |
| 241 |
|
4176 |
free(ptr); |
| 242 |
|
4176 |
indexes=nullptr; |
| 243 |
|
4176 |
ptr= nullptr; |
| 244 |
|
4176 |
num=0; |
| 245 |
|
4176 |
bufferlen=0; |
| 246 |
|
4176 |
lastid=-1; |
| 247 |
|
4176 |
} |
| 248 |
|
|
|
| 249 |
|
2000 |
assocarr() |
| 250 |
|
|
{ |
| 251 |
|
2000 |
indexes= nullptr; |
| 252 |
|
2000 |
ptr= nullptr; |
| 253 |
|
2000 |
num=0; |
| 254 |
|
2000 |
bufferlen=0; |
| 255 |
|
2000 |
lastid=-1; |
| 256 |
|
2000 |
} |
| 257 |
|
|
|
| 258 |
|
200 |
assocarr(std::initializer_list<pair<const char *, right>> list) |
| 259 |
|
|
{ |
| 260 |
|
200 |
indexes= nullptr; |
| 261 |
|
200 |
ptr= nullptr; |
| 262 |
|
200 |
num=0; |
| 263 |
|
200 |
bufferlen=0; |
| 264 |
|
200 |
lastid=-1; |
| 265 |
|
|
|
| 266 |
4/4
assocarr<double (*)()>::assocarr(std::initializer_list<pair<char const*, double (*)()> >):
✓ Branch 6 → 4 taken 6400 times.
✓ Branch 6 → 7 taken 100 times.
assocarr<double (*)()>::assocarr(std::initializer_list<pair<char const*, double (*)()> >):
✓ Branch 6 → 4 taken 6400 times.
✓ Branch 6 → 7 taken 100 times.
|
13000 |
for(auto &item : list){ |
| 267 |
|
12800 |
rawadd(item.first, true) = item.second; |
| 268 |
|
|
} |
| 269 |
|
200 |
} |
| 270 |
|
|
|
| 271 |
|
1200 |
~assocarr() |
| 272 |
|
|
{ |
| 273 |
|
1200 |
reset(); |
| 274 |
|
1200 |
} |
| 275 |
|
|
|
| 276 |
|
76820 |
right& operator[](const char * index) |
| 277 |
|
|
{ |
| 278 |
|
76820 |
return rawadd(index, true); |
| 279 |
|
|
} |
| 280 |
|
|
|
| 281 |
|
|
//void(*func)(const char * key, right& value) |
| 282 |
|
2596 |
template<typename t> void each(t func) |
| 283 |
|
|
{ |
| 284 |
|
2596 |
collectgarbage(); |
| 285 |
16/20
void assocarr<snes_label>::each<void (*)(string const&, snes_label&)>(void (*)(string const&, snes_label&)):
✗ Branch 8 → 4 not taken.
✗ Branch 8 → 9 not taken.
✗ Branch 10 → 4 not taken.
✗ Branch 10 → 11 not taken.
void assocarr<snes_label>::each<data_size(char const*)::{lambda(char const*, snes_label)#1}>(data_size(char const*)::{lambda(char const*, snes_label)#1}):
✓ Branch 6 → 4 taken 60 times.
✓ Branch 6 → 7 taken 20 times.
void assocarr<sourcefile>::each<void (*)(string const&, sourcefile&)>(void (*)(string const&, sourcefile&)):
✓ Branch 8 → 4 taken 115 times.
✓ Branch 8 → 9 taken 100 times.
✓ Branch 10 → 4 taken 115 times.
✓ Branch 10 → 11 taken 100 times.
void assocarr<string>::each<void (*)(string const&, string&)>(void (*)(string const&, string&)):
✓ Branch 8 → 4 taken 3960 times.
✓ Branch 8 → 9 taken 792 times.
✓ Branch 10 → 4 taken 3960 times.
✓ Branch 10 → 11 taken 792 times.
void assocarr<macrodata*>::each<void (*)(string const&, macrodata*&)>(void (*)(string const&, macrodata*&)):
✓ Branch 8 → 4 taken 26 times.
✓ Branch 8 → 9 taken 100 times.
✓ Branch 10 → 4 taken 26 times.
✓ Branch 10 → 11 taken 100 times.
void assocarr<double (*)()>::each<initmathcore()::{lambda(char const*, double (*)())#1}>(initmathcore()::{lambda(char const*, double (*)())#1}):
✓ Branch 6 → 4 taken 37888 times.
✓ Branch 6 → 7 taken 592 times.
|
48746 |
for (int i=0;i<num;i++) |
| 286 |
|
|
{ |
| 287 |
9/28
void assocarr<snes_label>::each<void (*)(string const&, snes_label&)>(void (*)(string const&, snes_label&)):
✗ Branch 4 → 5 not taken.
✗ Branch 4 → 12 not taken.
✗ Branch 5 → 6 not taken.
✗ Branch 5 → 10 not taken.
✗ Branch 5 → 14 not taken.
✗ Branch 6 → 7 not taken.
✗ Branch 6 → 12 not taken.
void assocarr<sourcefile>::each<void (*)(string const&, sourcefile&)>(void (*)(string const&, sourcefile&)):
✓ Branch 4 → 5 taken 115 times.
✗ Branch 4 → 12 not taken.
✓ Branch 5 → 6 taken 230 times.
✗ Branch 5 → 10 not taken.
✗ Branch 5 → 14 not taken.
✓ Branch 6 → 7 taken 115 times.
✗ Branch 6 → 12 not taken.
void assocarr<string>::each<void (*)(string const&, string&)>(void (*)(string const&, string&)):
✓ Branch 4 → 5 taken 3960 times.
✗ Branch 4 → 12 not taken.
✓ Branch 5 → 6 taken 7920 times.
✗ Branch 5 → 10 not taken.
✗ Branch 5 → 14 not taken.
✓ Branch 6 → 7 taken 3960 times.
✗ Branch 6 → 12 not taken.
void assocarr<macrodata*>::each<void (*)(string const&, macrodata*&)>(void (*)(string const&, macrodata*&)):
✓ Branch 4 → 5 taken 26 times.
✗ Branch 4 → 12 not taken.
✓ Branch 5 → 6 taken 52 times.
✗ Branch 5 → 10 not taken.
✗ Branch 5 → 14 not taken.
✓ Branch 6 → 7 taken 26 times.
✗ Branch 6 → 12 not taken.
|
46150 |
func(indexes[i], ptr[i][0]); |
| 288 |
|
|
} |
| 289 |
|
2596 |
} |
| 290 |
|
|
|
| 291 |
|
|
//void debug(){puts("");for(int i=0;i<num;i++)puts(indexes[i]);} |
| 292 |
|
|
|
| 293 |
|
|
#ifdef SERIALIZER |
| 294 |
|
|
void serialize(serializer & s) |
| 295 |
|
|
{ |
| 296 |
|
|
collectgarbage(); |
| 297 |
|
|
if (s.serializing) |
| 298 |
|
|
{ |
| 299 |
|
|
s(num); |
| 300 |
|
|
s(bufferlen); |
| 301 |
|
|
for (int i=0;i<num;i++) |
| 302 |
|
|
{ |
| 303 |
|
|
s(ptr[i][0]); |
| 304 |
|
|
s(indexes[i]); |
| 305 |
|
|
} |
| 306 |
|
|
} |
| 307 |
|
|
else |
| 308 |
|
|
{ |
| 309 |
|
|
reset(); |
| 310 |
|
|
s(num); |
| 311 |
|
|
s(bufferlen); |
| 312 |
|
|
ptr=(right**)malloc(sizeof(right*)*bufferlen); |
| 313 |
|
|
indexes=(const char**)malloc(sizeof(const char *)*bufferlen); |
| 314 |
|
|
for (int i=0;i<num;i++) |
| 315 |
|
|
{ |
| 316 |
|
|
ptr[i]=(right*)malloc(sizeof(right)); |
| 317 |
|
|
memset(ptr[i], 0, sizeof(right)); |
| 318 |
|
|
new(ptr[i]) right; |
| 319 |
|
|
s(ptr[i][0]); |
| 320 |
|
|
s(indexes[i]); |
| 321 |
|
|
} |
| 322 |
|
|
} |
| 323 |
|
|
} |
| 324 |
|
|
#endif |
| 325 |
|
|
#define SERIALIZER_BANNED |
| 326 |
|
|
}; |
| 327 |
|
|
|