1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

updated func/fift

- updated func/fift
- updated liteclient/liteserver
- bugfixes
This commit is contained in:
ton 2019-12-29 12:14:12 +03:00
parent d41ce55305
commit acf16718e6
45 changed files with 1360 additions and 185 deletions

View file

@ -18,6 +18,7 @@
*/
#pragma once
#include <iostream>
#include <map>
#include "vm/cellslice.h"
namespace tlb {
@ -268,6 +269,30 @@ struct TLB_Complex : TLB {
}
};
class TlbTypeHolder : public td::CntObject {
const TLB* type{nullptr};
char* data{nullptr};
public:
TlbTypeHolder() = default;
TlbTypeHolder(const TLB* _type) : type(_type), data(nullptr) {
}
TlbTypeHolder(const TLB* _type, char* _data) : type(_type), data(_data) {
}
~TlbTypeHolder() override {
free(data);
}
const TLB* get() const {
return type;
}
const TLB& operator*() const {
return *type;
}
const TLB* operator->() const {
return type;
}
};
static inline bool add_chk(int x, int y, int z) {
return x + y == z && z >= 0;
}
@ -508,6 +533,25 @@ struct PrettyPrinter {
namespace tlb {
class TypenameLookup {
std::map<std::string, const TLB*> types;
public:
typedef std::function<bool(const char*, const TLB*)> simple_register_func_t;
typedef std::function<bool(simple_register_func_t)> register_func_t;
TypenameLookup() = default;
TypenameLookup(register_func_t func) {
register_types(func);
}
bool register_type(const char* name, const TLB* tp);
bool register_types(register_func_t func);
const TLB* lookup(std::string str) const;
};
} // namespace tlb
namespace tlb {
struct False final : TLB {
int get_size(const vm::CellSlice& cs) const override {
return -1;