Skip to content

Commit c2da007

Browse files
initial commitvvaltman
initial commit
authored and
vvaltman
committed
initial commit
0 parents  commit c2da007

File tree

1,610 files changed

+398047
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,610 files changed

+398047
-0
lines changed

.clang-format

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: None # All
15+
AllowShortIfStatementsOnASingleLine: false # true
16+
AllowShortLoopsOnASingleLine: false # true
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: true
20+
AlwaysBreakTemplateDeclarations: true
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
BeforeCatch: false
33+
BeforeElse: false
34+
IndentBraces: false
35+
BreakBeforeBinaryOperators: None
36+
BreakBeforeBraces: Attach
37+
BreakBeforeTernaryOperators: true
38+
BreakConstructorInitializersBeforeComma: true # false
39+
# BreakAfterJavaFieldAnnotations: false
40+
BreakStringLiterals: true
41+
ColumnLimit: 120 # 80
42+
CommentPragmas: '^ IWYU pragma:'
43+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
44+
ConstructorInitializerIndentWidth: 4
45+
ContinuationIndentWidth: 4
46+
Cpp11BracedListStyle: true
47+
DerivePointerAlignment: true
48+
DisableFormat: false
49+
ExperimentalAutoDetectBinPacking: false
50+
FixNamespaceComments: true
51+
# ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
52+
IndentCaseLabels: true
53+
IndentWidth: 2
54+
IndentWrappedFunctionNames: false
55+
# JavaScriptQuotes: Leave
56+
# JavaScriptWrapImports: true
57+
KeepEmptyLinesAtTheStartOfBlocks: false
58+
MacroBlockBegin: ''
59+
MacroBlockEnd: ''
60+
MaxEmptyLinesToKeep: 1
61+
NamespaceIndentation: None
62+
# ObjCBlockIndentWidth: 2
63+
# ObjCSpaceAfterProperty: false
64+
# ObjCSpaceBeforeProtocolList: false
65+
PenaltyBreakBeforeFirstCallParameter: 1
66+
PenaltyBreakComment: 300
67+
PenaltyBreakFirstLessLess: 120
68+
PenaltyBreakString: 1000
69+
PenaltyExcessCharacter: 1000000
70+
PenaltyReturnTypeOnItsOwnLine: 200
71+
PointerAlignment: Left
72+
ReflowComments: false # true
73+
SortIncludes: false # disabled, because we need case insensitive sort
74+
SpaceAfterCStyleCast: false
75+
SpaceAfterTemplateKeyword: true
76+
SpaceBeforeAssignmentOperators: true
77+
SpaceBeforeParens: ControlStatements
78+
SpaceInEmptyParentheses: false
79+
SpacesBeforeTrailingComments: 2
80+
SpacesInAngles: false
81+
SpacesInContainerLiterals: true
82+
SpacesInCStyleCastParentheses: false
83+
SpacesInParentheses: false
84+
SpacesInSquareBrackets: false
85+
Standard: Auto
86+
TabWidth: 100 # 8
87+
UseTab: Never
88+
...

.clang_complete

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-xc++
2+
-std=c++14
3+
-iquote .
4+
-iquote tdtl/
5+
-iquote tl/
6+
-iquote tl/generate/
7+
-iquote tdactor/
8+
-iquote tdnet/
9+
-iquote tdutils/
10+
-iquote ../ton-build/tdutils/
11+
-iquote crypto/
12+
-I/opt/local/include/

.gitattributes

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
* text=auto
2+
3+
*.cpp text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
4+
*.hpp text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
5+
*.h text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
6+
*.c text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
7+
*.fc text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
8+
*.fif text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
9+
*.tl text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
10+
*.tlb text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
11+
*.txt text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
12+
*.sh text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=lf
13+
*.cmake text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
14+
*.in text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
15+
*.tex text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
16+
*.py text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
17+
18+
*.ans text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
19+
*.bat text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf
20+
*.fp text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
21+
*.gradle text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
22+
*.java text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
23+
*.kt text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
24+
*.md text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
25+
*.php text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
26+
*.pro text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
27+
*.properties text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
28+
*.ps1 text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf
29+
*.xml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
30+
*.yml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
31+
32+
third_party/** linguist-vendored
33+
34+
*.a binary
35+
*.jar binary
36+
*.tlo binary

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
__pycache__
2+
parser.out
3+
parsetab.py
4+
parsetab.pyc
5+
tdutils/generate/auto/
6+
tl/generate/auto/
7+
compile_commands.json
8+
crypto/block/block-auto.cpp
9+
crypto/block/block-auto.h
10+
crypto/smartcont/*-code.fif
11+
test/regression-tests.cache/
12+
*.swp
13+
**/*build*/

.gitmodules

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[submodule "third-party/rocksdb"]
2+
path = third-party/rocksdb
3+
url = https://github.com/facebook/rocksdb.git
4+
[submodule "third-party/crc32c"]
5+
path = third-party/crc32c
6+
url = https://github.com/google/crc32c
7+
[submodule "third-party/abseil-cpp"]
8+
path = third-party/abseil-cpp
9+
url = https://github.com/abseil/abseil-cpp.git
10+
[submodule "third-party/libraptorq"]
11+
path = third-party/libraptorq
12+
url = https://github.com/ton-blockchain/libRaptorQ

CMake/AddCXXCompilerFlag.cmake

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# - Adds a compiler flag if it is supported by the compiler
2+
#
3+
# This function checks that the supplied compiler flag is supported and then
4+
# adds it to the corresponding compiler flags
5+
#
6+
# add_cxx_compiler_flag(<FLAG> [<VARIANT>])
7+
#
8+
# - Example
9+
#
10+
# include(AddCXXCompilerFlag)
11+
# add_cxx_compiler_flag(-Wall)
12+
# add_cxx_compiler_flag(-no-strict-aliasing RELEASE)
13+
# Requires CMake 2.6+
14+
15+
if (__add_cxx_compiler_flag)
16+
return()
17+
endif()
18+
set(__add_cxx_compiler_flag INCLUDED)
19+
20+
include(CheckCXXCompilerFlag)
21+
22+
function(mangle_compiler_flag FLAG OUTPUT)
23+
string(TOUPPER "HAVE_CXX_FLAG_${FLAG}" SANITIZED_FLAG)
24+
string(REPLACE "+" "X" SANITIZED_FLAG ${SANITIZED_FLAG})
25+
string(REGEX REPLACE "[^A-Za-z_0-9]" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
26+
string(REGEX REPLACE "_+" "_" SANITIZED_FLAG ${SANITIZED_FLAG})
27+
set(${OUTPUT} "${SANITIZED_FLAG}" PARENT_SCOPE)
28+
endfunction(mangle_compiler_flag)
29+
30+
function(add_cxx_compiler_flag FLAG)
31+
string(REPLACE "-Wno-" "-W" MAIN_FLAG ${FLAG})
32+
mangle_compiler_flag("${MAIN_FLAG}" MANGLED_FLAG_NAME)
33+
if (DEFINED CMAKE_REQUIRED_FLAGS)
34+
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
35+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}")
36+
else()
37+
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
38+
endif()
39+
check_cxx_compiler_flag("${MAIN_FLAG}" ${MANGLED_FLAG_NAME})
40+
if (DEFINED OLD_CMAKE_REQUIRED_FLAGS)
41+
set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}")
42+
else()
43+
unset(CMAKE_REQUIRED_FLAGS)
44+
endif()
45+
if (${MANGLED_FLAG_NAME})
46+
set(VARIANT ${ARGV1})
47+
if (ARGV1)
48+
string(TOUPPER "_${VARIANT}" VARIANT)
49+
endif()
50+
set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE)
51+
endif()
52+
endfunction()
53+
54+
function(add_required_cxx_compiler_flag FLAG)
55+
string(REPLACE "-Wno-" "-W" MAIN_FLAG ${FLAG})
56+
mangle_compiler_flag("${MAIN_FLAG}" MANGLED_FLAG_NAME)
57+
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
58+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}")
59+
check_cxx_compiler_flag("${MAIN_FLAG}" ${MANGLED_FLAG_NAME})
60+
set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}")
61+
if (${MANGLED_FLAG_NAME})
62+
set(VARIANT ${ARGV1})
63+
if (ARGV1)
64+
string(TOUPPER "_${VARIANT}" VARIANT)
65+
endif()
66+
set(CMAKE_CXX_FLAGS${VARIANT} "${CMAKE_CXX_FLAGS${VARIANT}} ${FLAG}" PARENT_SCOPE)
67+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE)
68+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE)
69+
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FLAG}" PARENT_SCOPE)
70+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}" PARENT_SCOPE)
71+
else()
72+
message(FATAL_ERROR "Required flag '${FLAG}' is not supported by the compiler")
73+
endif()
74+
endfunction()

CMake/FindJeMalloc.cmake

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# - Find JeMalloc library
2+
# Find the native JeMalloc includes and library
3+
#
4+
# JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc.
5+
# JEMALLOC_LIBRARIES - List of libraries when using jemalloc.
6+
# JEMALLOC_FOUND - True if jemalloc found.
7+
8+
find_path(JEMALLOC_INCLUDE_DIR
9+
NAMES jemalloc/jemalloc.h
10+
HINTS ${JEMALLOC_ROOT_DIR}/include)
11+
12+
find_library(JEMALLOC_LIBRARIES
13+
NAMES jemalloc
14+
HINTS ${JEMALLOC_ROOT_DIR}/lib)
15+
16+
include(FindPackageHandleStandardArgs)
17+
find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
18+
19+
mark_as_advanced(
20+
JEMALLOC_LIBRARIES
21+
JEMALLOC_INCLUDE_DIR)

CMake/FindMHD.cmake

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# - Try to find MHD
2+
# Once done this will define
3+
#
4+
# MHD_FOUND - system has MHD
5+
# MHD_INCLUDE_DIRS - the MHD include directory
6+
# MHD_LIBRARY - Link these to use MHD
7+
8+
find_path(
9+
MHD_INCLUDE_DIR
10+
NAMES microhttpd.h
11+
DOC "microhttpd include dir"
12+
)
13+
14+
find_library(
15+
MHD_LIBRARY
16+
NAMES microhttpd microhttpd-10 libmicrohttpd libmicrohttpd-dll
17+
DOC "microhttpd library"
18+
)
19+
20+
set(MHD_INCLUDE_DIRS ${MHD_INCLUDE_DIR})
21+
set(MHD_LIBRARIES ${MHD_LIBRARY})
22+
23+
# debug library on windows
24+
# same naming convention as in qt (appending debug library with d)
25+
# boost is using the same "hack" as us with "optimized" and "debug"
26+
# official MHD project actually uses _d suffix
27+
if (MSVC)
28+
find_library(
29+
MHD_LIBRARY_DEBUG
30+
NAMES microhttpd_d microhttpd-10_d libmicrohttpd_d libmicrohttpd-dll_d
31+
DOC "mhd debug library"
32+
)
33+
set(MHD_LIBRARIES optimized ${MHD_LIBRARIES} debug ${MHD_LIBRARY_DEBUG})
34+
endif()
35+
36+
include(FindPackageHandleStandardArgs)
37+
find_package_handle_standard_args(mhd DEFAULT_MSG MHD_INCLUDE_DIR MHD_LIBRARY)
38+
mark_as_advanced(MHD_INCLUDE_DIR MHD_LIBRARY)

CMake/FindReadline.cmake

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
if (APPLE)
2+
find_path(READLINE_INCLUDE_DIR readline/readline.h /usr/local/opt/readline/include /opt/local/include /opt/include /usr/local/include /usr/include NO_DEFAULT_PATH)
3+
endif()
4+
find_path(READLINE_INCLUDE_DIR readline/readline.h)
5+
6+
if (APPLE)
7+
find_library(READLINE_LIBRARY readline /usr/local/opt/readline/lib /opt/local/lib /opt/lib /usr/local/lib /usr/lib NO_DEFAULT_PATH)
8+
endif()
9+
find_library(READLINE_LIBRARY readline)
10+
11+
if (READLINE_INCLUDE_DIR AND READLINE_LIBRARY AND NOT GNU_READLINE_FOUND)
12+
set(CMAKE_REQUIRED_INCLUDES "${READLINE_INCLUDE_DIR}")
13+
set(CMAKE_REQUIRED_LIBRARIES "${READLINE_LIBRARY}")
14+
include(CheckCXXSourceCompiles)
15+
unset(GNU_READLINE_FOUND CACHE)
16+
check_cxx_source_compiles("#include <stdio.h>\n#include <readline/readline.h>\nint main() { rl_replace_line(\"\", 0); }" GNU_READLINE_FOUND)
17+
if (NOT GNU_READLINE_FOUND)
18+
unset(READLINE_INCLUDE_DIR CACHE)
19+
unset(READLINE_LIBRARY CACHE)
20+
endif()
21+
endif()
22+
23+
include(FindPackageHandleStandardArgs)
24+
find_package_handle_standard_args(Readline DEFAULT_MSG READLINE_INCLUDE_DIR READLINE_LIBRARY)
25+
mark_as_advanced(READLINE_INCLUDE_DIR READLINE_LIBRARY)

0 commit comments

Comments
 (0)