├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── img ├── mt5.png ├── redis_bench.png └── socket_bench.png ├── mt5 ├── MQL5 │ ├── Experts │ │ ├── MT5_to_Python_live_v4.1.ex5 │ │ └── MT5_to_Python_live_v4.1.mq5 │ ├── Include │ │ ├── redis.mqh │ │ └── socket-library-mt4-mt5.mqh │ └── Libraries │ │ ├── hiredis.dll │ │ ├── libeay32.dll │ │ └── ssleay32.dll └── source │ └── hiredis │ ├── hiredis.sln │ ├── hiredis │ ├── async.c │ ├── async.h │ ├── dict.c │ ├── dict.h │ ├── fmacros.h │ ├── hiredis.c │ ├── hiredis.def │ ├── hiredis.h │ ├── hiredis.vcxproj │ ├── hiredis.vcxproj.filters │ ├── hiredis.vcxproj.user │ ├── net.c │ ├── net.h │ ├── sds.c │ ├── sds.h │ ├── sdsalloc.h │ ├── src │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── Makefile.dep │ │ ├── Win32_Interop │ │ │ ├── EventLog.h │ │ │ ├── EventLog.mc │ │ │ ├── WS2tcpip.h │ │ │ ├── Win32_ANSI.c │ │ │ ├── Win32_ANSI.h │ │ │ ├── Win32_APIs.c │ │ │ ├── Win32_APIs.h │ │ │ ├── Win32_Assert.h │ │ │ ├── Win32_CommandLine.cpp │ │ │ ├── Win32_CommandLine.h │ │ │ ├── Win32_Common.cpp │ │ │ ├── Win32_Common.h │ │ │ ├── Win32_Error.c │ │ │ ├── Win32_Error.h │ │ │ ├── Win32_EventLog.cpp │ │ │ ├── Win32_EventLog.h │ │ │ ├── Win32_FDAPI.cpp │ │ │ ├── Win32_FDAPI.h │ │ │ ├── Win32_Interop.vcxproj │ │ │ ├── Win32_PThread.c │ │ │ ├── Win32_PThread.h │ │ │ ├── Win32_Portability.h │ │ │ ├── Win32_QFork.cpp │ │ │ ├── Win32_QFork.h │ │ │ ├── Win32_QFork_impl.c │ │ │ ├── Win32_QFork_impl.h │ │ │ ├── Win32_RedisLog.c │ │ │ ├── Win32_RedisLog.h │ │ │ ├── Win32_Service.h │ │ │ ├── Win32_Signal_Process.c │ │ │ ├── Win32_Signal_Process.h │ │ │ ├── Win32_SmartHandle.h │ │ │ ├── Win32_StackTrace.cpp │ │ │ ├── Win32_StackTrace.h │ │ │ ├── Win32_ThreadControl.c │ │ │ ├── Win32_ThreadControl.h │ │ │ ├── Win32_Time.c │ │ │ ├── Win32_Time.h │ │ │ ├── Win32_dlmalloc.c │ │ │ ├── Win32_dlmalloc.h │ │ │ ├── Win32_fdapi_crt.cpp │ │ │ ├── Win32_fdapi_crt.h │ │ │ ├── Win32_service.cpp │ │ │ ├── Win32_variadicFunctor.cpp │ │ │ ├── Win32_variadicFunctor.h │ │ │ ├── resources │ │ │ │ ├── EventLog.rc │ │ │ │ ├── EventLog.res │ │ │ │ └── EventLog_MSG00409.bin │ │ │ ├── win32_rfdmap.cpp │ │ │ ├── win32_rfdmap.h │ │ │ ├── win32_types.h │ │ │ ├── win32_types_hiredis.h │ │ │ ├── win32_winapifamily.h │ │ │ ├── win32_wsiocp.c │ │ │ ├── win32_wsiocp.h │ │ │ ├── win32_wsiocp2.h │ │ │ ├── win32fixes.c │ │ │ └── win32fixes.h │ │ ├── adlist.c │ │ ├── adlist.h │ │ ├── ae.c │ │ ├── ae.h │ │ ├── ae_epoll.c │ │ ├── ae_evport.c │ │ ├── ae_kqueue.c │ │ ├── ae_select.c │ │ ├── ae_wsiocp.c │ │ ├── anet.c │ │ ├── anet.h │ │ ├── aof.c │ │ ├── asciilogo.h │ │ ├── bio.c │ │ ├── bio.h │ │ ├── bitops.c │ │ ├── blocked.c │ │ ├── cluster.c │ │ ├── cluster.h │ │ ├── config.c │ │ ├── config.h │ │ ├── crc16.c │ │ ├── crc64.c │ │ ├── crc64.h │ │ ├── db.c │ │ ├── debug.c │ │ ├── deps │ │ │ └── lua │ │ │ │ ├── COPYRIGHT │ │ │ │ ├── HISTORY │ │ │ │ ├── INSTALL │ │ │ │ ├── Makefile │ │ │ │ ├── README │ │ │ │ ├── etc │ │ │ │ ├── Makefile │ │ │ │ ├── README │ │ │ │ ├── all.c │ │ │ │ ├── lua.hpp │ │ │ │ ├── lua.ico │ │ │ │ ├── lua.pc │ │ │ │ ├── luavs.bat │ │ │ │ ├── min.c │ │ │ │ ├── noparser.c │ │ │ │ └── strict.lua │ │ │ │ ├── src │ │ │ │ ├── Makefile │ │ │ │ ├── fpconv.c │ │ │ │ ├── fpconv.h │ │ │ │ ├── lapi.c │ │ │ │ ├── lapi.h │ │ │ │ ├── lauxlib.c │ │ │ │ ├── lauxlib.h │ │ │ │ ├── lbaselib.c │ │ │ │ ├── lcode.c │ │ │ │ ├── lcode.h │ │ │ │ ├── ldblib.c │ │ │ │ ├── ldebug.c │ │ │ │ ├── ldebug.h │ │ │ │ ├── ldo.c │ │ │ │ ├── ldo.h │ │ │ │ ├── ldump.c │ │ │ │ ├── lfunc.c │ │ │ │ ├── lfunc.h │ │ │ │ ├── lgc.c │ │ │ │ ├── lgc.h │ │ │ │ ├── linit.c │ │ │ │ ├── liolib.c │ │ │ │ ├── llex.c │ │ │ │ ├── llex.h │ │ │ │ ├── llimits.h │ │ │ │ ├── lmathlib.c │ │ │ │ ├── lmem.c │ │ │ │ ├── lmem.h │ │ │ │ ├── loadlib.c │ │ │ │ ├── lobject.c │ │ │ │ ├── lobject.h │ │ │ │ ├── lopcodes.c │ │ │ │ ├── lopcodes.h │ │ │ │ ├── loslib.c │ │ │ │ ├── lparser.c │ │ │ │ ├── lparser.h │ │ │ │ ├── lstate.c │ │ │ │ ├── lstate.h │ │ │ │ ├── lstring.c │ │ │ │ ├── lstring.h │ │ │ │ ├── lstrlib.c │ │ │ │ ├── ltable.c │ │ │ │ ├── ltable.h │ │ │ │ ├── ltablib.c │ │ │ │ ├── ltm.c │ │ │ │ ├── ltm.h │ │ │ │ ├── lua.c │ │ │ │ ├── lua.h │ │ │ │ ├── lua_bit.c │ │ │ │ ├── lua_cjson.c │ │ │ │ ├── lua_cmsgpack.c │ │ │ │ ├── lua_struct.c │ │ │ │ ├── luac.c │ │ │ │ ├── luaconf.h │ │ │ │ ├── lualib.h │ │ │ │ ├── lundump.c │ │ │ │ ├── lundump.h │ │ │ │ ├── lvm.c │ │ │ │ ├── lvm.h │ │ │ │ ├── lzio.c │ │ │ │ ├── lzio.h │ │ │ │ ├── print.c │ │ │ │ ├── strbuf.c │ │ │ │ └── strbuf.h │ │ │ │ └── test │ │ │ │ ├── README │ │ │ │ ├── bisect.lua │ │ │ │ ├── cf.lua │ │ │ │ ├── echo.lua │ │ │ │ ├── env.lua │ │ │ │ ├── factorial.lua │ │ │ │ ├── fib.lua │ │ │ │ ├── fibfor.lua │ │ │ │ ├── globals.lua │ │ │ │ ├── hello.lua │ │ │ │ ├── life.lua │ │ │ │ ├── luac.lua │ │ │ │ ├── printf.lua │ │ │ │ ├── readonly.lua │ │ │ │ ├── sieve.lua │ │ │ │ ├── sort.lua │ │ │ │ ├── table.lua │ │ │ │ ├── trace-calls.lua │ │ │ │ ├── trace-globals.lua │ │ │ │ └── xd.lua │ │ ├── dict.c │ │ ├── dict.h │ │ ├── endianconv.c │ │ ├── endianconv.h │ │ ├── fmacros.h │ │ ├── geo.c │ │ ├── geo.h │ │ ├── help.h │ │ ├── hyperloglog.c │ │ ├── intset.c │ │ ├── intset.h │ │ ├── latency.c │ │ ├── latency.h │ │ ├── lzf.h │ │ ├── lzfP.h │ │ ├── lzf_c.c │ │ ├── lzf_d.c │ │ ├── memtest.c │ │ ├── mkreleasehdr.sh │ │ ├── multi.c │ │ ├── networking.c │ │ ├── notify.c │ │ ├── object.c │ │ ├── pqsort.c │ │ ├── pqsort.h │ │ ├── pubsub.c │ │ ├── quicklist.c │ │ ├── quicklist.h │ │ ├── rand.c │ │ ├── rand.h │ │ ├── rdb.c │ │ ├── rdb.h │ │ ├── redis-benchmark.c │ │ ├── redis-check-aof.c │ │ ├── redis-check-rdb.c │ │ ├── redis-cli.c │ │ ├── redis-trib.rb │ │ ├── redisassert.h │ │ ├── release.c │ │ ├── replication.c │ │ ├── rio.c │ │ ├── rio.h │ │ ├── scripting.c │ │ ├── sds.c │ │ ├── sds.h │ │ ├── sdsalloc.h │ │ ├── sentinel.c │ │ ├── server.c_ │ │ ├── server.h_ │ │ ├── setproctitle.c │ │ ├── sha1.c │ │ ├── sha1.h │ │ ├── slowlog.c │ │ ├── slowlog.h │ │ ├── solarisfixes.h │ │ ├── sort.c │ │ ├── sparkline.c │ │ ├── sparkline.h │ │ ├── syncio.c │ │ ├── t_hash.c │ │ ├── t_list.c │ │ ├── t_set.c │ │ ├── t_string.c │ │ ├── t_zset.c │ │ ├── testhelp.h │ │ ├── util.c │ │ ├── util.h │ │ ├── valgrind.sup │ │ ├── version.h │ │ ├── ziplist.c │ │ ├── ziplist.h │ │ ├── zipmap.c │ │ ├── zipmap.h │ │ ├── zmalloc.c │ │ └── zmalloc.h │ ├── test.c │ ├── win32_hiredis.h │ └── zmalloc.h │ └── x64 │ └── Release │ └── hiredis.dll └── python ├── example_Redis.py ├── example_Redis_benchmark.py ├── example_Socket.py └── example_Socket_benchmark.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MT5_to_Python 2 | 3 | the repository show 2 ways to transfer data from mt5 to python. 4 | description will be in Russian, if necessary, use Google translate 5 | 6 | 7 | ## MT5 8 | в папке /mt5/MQL5/ все необходимое для работы, со всеми исходниками! 9 | 10 | терминал от Alpari MT5 Version 5.00 build 1940 11 | 12 |

13 | 14 |

15 | 16 | * Советник отправляет данные при изменении Close по выбранным инструментам 17 | * Если список инструментов оставить пустым - будет слать по всем парам из обзора рынка 18 | 19 | 20 | ## Python 21 | сделал 2 примера: 22 | 1) непосредственного получения и обработки данных 23 | 2) и тест скорости отправки. у меня по сокетам и по редис время, от отправки из терминала, до получения в питоне быстрее 0,001 sec (те Очень быстро и разницы на таком уровне нету) 24 | 25 |

26 |     27 | 28 |

29 | 30 | Сам я остановился на варианте с Redis тк: 31 | + достаточно одного терминала на множество скриптов. (работа идет как с единым БД). 32 | + по скорости, для моих нужд, более чем быстро и не уступает socket 33 | 34 | ## Install 35 | ### Redis 36 | Если под винды: https://github.com/MicrosoftArchive/redis/releases 37 | 38 | ## Contacts 39 | Telegram: @Lxbinary 40 | -------------------------------------------------------------------------------- /img/mt5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/mt5.png -------------------------------------------------------------------------------- /img/redis_bench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/redis_bench.png -------------------------------------------------------------------------------- /img/socket_bench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/img/socket_bench.png -------------------------------------------------------------------------------- /mt5/MQL5/Experts/MT5_to_Python_live_v4.1.ex5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.ex5 -------------------------------------------------------------------------------- /mt5/MQL5/Experts/MT5_to_Python_live_v4.1.mq5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Experts/MT5_to_Python_live_v4.1.mq5 -------------------------------------------------------------------------------- /mt5/MQL5/Include/redis.mqh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Include/redis.mqh -------------------------------------------------------------------------------- /mt5/MQL5/Libraries/hiredis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/hiredis.dll -------------------------------------------------------------------------------- /mt5/MQL5/Libraries/libeay32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/libeay32.dll -------------------------------------------------------------------------------- /mt5/MQL5/Libraries/ssleay32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/MQL5/Libraries/ssleay32.dll -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hiredis", "hiredis\hiredis.vcxproj", "{7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x64.ActiveCfg = Debug|x64 17 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x64.Build.0 = Debug|x64 18 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x86.ActiveCfg = Debug|Win32 19 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Debug|x86.Build.0 = Debug|Win32 20 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x64.ActiveCfg = Release|x64 21 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x64.Build.0 = Release|x64 22 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x86.ActiveCfg = Release|Win32 23 | {7BA9DFB0-A50B-4020-B356-AFBCF9E3F312}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/fmacros.h: -------------------------------------------------------------------------------- 1 | #ifndef __HIREDIS_FMACRO_H 2 | #define __HIREDIS_FMACRO_H 3 | 4 | #if !defined(_BSD_SOURCE) 5 | #define _BSD_SOURCE 6 | #endif 7 | 8 | #if defined(_AIX) 9 | #define _ALL_SOURCE 10 | #endif 11 | 12 | #if defined(__sun__) 13 | #define _POSIX_C_SOURCE 200112L 14 | #elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) 15 | #define _XOPEN_SOURCE 600 16 | #else 17 | #define _XOPEN_SOURCE 18 | #endif 19 | 20 | #if __APPLE__ && __MACH__ 21 | #define _OSX 22 | #endif 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/hiredis.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | freeReplyObject 3 | redisConnect 4 | redisConnectWithTimeout 5 | redisConnectNonBlock 6 | redisSetTimeout 7 | redisEnableKeepAlive 8 | redisFree 9 | _redisFree 10 | redisFreeKeepFd 11 | redisBufferRead 12 | redisBufferWrite 13 | redisvAppendCommand 14 | redisAppendCommand 15 | redisAppendCommandArgv 16 | redisvCommand 17 | redisCommand 18 | redisCommandArgv 19 | __redisSetError -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/hiredis.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/net.h: -------------------------------------------------------------------------------- 1 | /* Extracted from anet.c to work properly with Hiredis error reporting. 2 | * 3 | * Copyright (c) 2006-2011, Salvatore Sanfilippo 4 | * Copyright (c) 2010-2011, Pieter Noordhuis 5 | * 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of Redis nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef __NET_H 34 | #define __NET_H 35 | 36 | #include "hiredis.h" 37 | 38 | #if defined(__sun) || defined(_AIX) 39 | #define AF_LOCAL AF_UNIX 40 | #endif 41 | 42 | int redisCheckSocketError(redisContext *c); 43 | int redisContextSetTimeout(redisContext *c, const struct timeval tv); 44 | int redisContextConnectTcp(redisContext *c, const char *addr, int port, const struct timeval *timeout); 45 | int redisContextConnectBindTcp(redisContext *c, const char *addr, int port, 46 | const struct timeval *timeout, 47 | const char *source_addr); 48 | int redisContextConnectUnix(redisContext *c, const char *path, const struct timeval *timeout); 49 | int redisKeepAlive(redisContext *c, int interval); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/sdsalloc.h: -------------------------------------------------------------------------------- 1 | /* SDSLib 2.0 -- A C dynamic strings library 2 | * 3 | * Copyright (c) 2006-2015, Salvatore Sanfilippo 4 | * Copyright (c) 2015, Redis Labs, Inc 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of Redis nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* SDS allocator selection. 33 | * 34 | * This file is used in order to change the SDS allocator at compile time. 35 | * Just define the following defines to what you want to use. Also add 36 | * the include of your alternate allocator if needed (not needed in order 37 | * to use the default libc allocator). */ 38 | 39 | #include "zmalloc.h" 40 | #define s_malloc zmalloc 41 | #define s_realloc zrealloc 42 | #define s_free zfree 43 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/.gitignore: -------------------------------------------------------------------------------- 1 | *.gcda 2 | *.gcno 3 | *.gcov 4 | redis.info 5 | lcov-html 6 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/EventLog.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // 3 | // Values are 32 bit values laid out as follows: 4 | // 5 | // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 6 | // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 7 | // +---+-+-+-----------------------+-------------------------------+ 8 | // |Sev|C|R| Facility | Code | 9 | // +---+-+-+-----------------------+-------------------------------+ 10 | // 11 | // where 12 | // 13 | // Sev - is the severity code 14 | // 15 | // 00 - Success 16 | // 01 - Informational 17 | // 10 - Warning 18 | // 11 - Error 19 | // 20 | // C - is the Customer code flag 21 | // 22 | // R - is a reserved bit 23 | // 24 | // Facility - is the facility code 25 | // 26 | // Code - is the facility's status code 27 | // 28 | // 29 | // Define the facility codes 30 | // 31 | 32 | 33 | // 34 | // Define the severity codes 35 | // 36 | 37 | 38 | // 39 | // MessageId: MSG_INFO_1 40 | // 41 | // MessageText: 42 | // 43 | // %1 44 | // 45 | #define MSG_INFO_1 0x60000000L 46 | 47 | // 48 | // MessageId: MSG_WARNING_1 49 | // 50 | // MessageText: 51 | // 52 | // %1 53 | // 54 | #define MSG_WARNING_1 0xA0000001L 55 | 56 | // 57 | // MessageId: MSG_ERROR_1 58 | // 59 | // MessageText: 60 | // 61 | // %1 62 | // 63 | #define MSG_ERROR_1 0xE0000002L 64 | 65 | // 66 | // MessageId: MSG_SUCCESS_1 67 | // 68 | // MessageText: 69 | // 70 | // %1 71 | // 72 | #define MSG_SUCCESS_1 0x20000003L 73 | 74 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/EventLog.mc: -------------------------------------------------------------------------------- 1 | ;#pragma once 2 | 3 | LanguageNames=(EnglishUS=0x409:MSG00409) 4 | 5 | MessageId=0x0 6 | SymbolicName=MSG_INFO_1 7 | Severity=Informational 8 | Facility=Application 9 | Language=EnglishUS 10 | %1 11 | . 12 | 13 | MessageId=0x1 14 | SymbolicName=MSG_WARNING_1 15 | Severity=Warning 16 | Facility=Application 17 | Language=EnglishUS 18 | %1 19 | . 20 | 21 | MessageId=0x2 22 | SymbolicName=MSG_ERROR_1 23 | Severity=Error 24 | Facility=Application 25 | Language=EnglishUS 26 | %1 27 | . 28 | 29 | MessageId=0x3 30 | SymbolicName=MSG_SUCCESS_1 31 | Severity=Success 32 | Facility=Application 33 | Language=EnglishUS 34 | %1 35 | . 36 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_ANSI.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | 24 | #ifndef WIN32_INTEROPA_ANSI_H 25 | #define WIN32_INTEROPA_ANSI_H 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | BOOL ParseAndPrintANSIString(HANDLE hDev, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten); 34 | void ANSI_printf(char *format, ...); 35 | 36 | // include this file after stdio.h in order to redirect printf to the one that supports ANSI escape sequences 37 | #define printf ANSI_printf 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_APIs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #include "Win32_APIs.h" 24 | #include 25 | 26 | /* Replace MS C rtl rand which is 15bit with 32 bit */ 27 | int replace_random() { 28 | unsigned int x = 0; 29 | if (RtlGenRandom == NULL) { 30 | // Load proc if not loaded 31 | HMODULE lib = LoadLibraryA("advapi32.dll"); 32 | RtlGenRandom = (RtlGenRandomFunc) GetProcAddress(lib, "SystemFunction036"); 33 | if (RtlGenRandom == NULL) return 1; 34 | } 35 | RtlGenRandom(&x, sizeof(unsigned int)); 36 | return (int) (x >> 1); 37 | } 38 | 39 | /* Rename which works on Windows when file exists */ 40 | int replace_rename(const char *src, const char *dst) { 41 | int retries = 50; 42 | while (1) { 43 | if (MoveFileExA(src, dst, MOVEFILE_REPLACE_EXISTING | MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH)) { 44 | return 0; 45 | } else { 46 | errno = GetLastError(); 47 | // Anti-virus may lock file - error code 5. 48 | if (errno != 5) { 49 | break; 50 | } 51 | retries--; 52 | if (retries == 0) { 53 | break; 54 | } 55 | Sleep(10); 56 | } 57 | } 58 | // On error we will return generic error code without GetLastError() 59 | return -1; 60 | } 61 | 62 | int truncate(const char *path, PORT_LONGLONG length) { 63 | LARGE_INTEGER newSize; 64 | HANDLE toTruncate = CreateFileA(path, 65 | GENERIC_READ | GENERIC_WRITE, 66 | FILE_SHARE_WRITE | FILE_SHARE_READ, 67 | NULL, 68 | OPEN_EXISTING, 69 | 0, 70 | NULL); 71 | if (toTruncate != INVALID_HANDLE_VALUE) { 72 | int result = 0; 73 | newSize.QuadPart = length; 74 | if (FALSE == (SetFilePointerEx(toTruncate, newSize, NULL, FILE_BEGIN) 75 | && SetEndOfFile(toTruncate))) { 76 | errno = ENOENT; 77 | result = -1; 78 | } 79 | CloseHandle(toTruncate); 80 | return result; 81 | } else { 82 | errno = ENOENT; 83 | return -1; 84 | } 85 | } -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_APIs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_APIS_H 24 | #define WIN32_INTEROP_APIS_H 25 | 26 | #include "Win32_types.h" 27 | #include 28 | #include // for rename 29 | 30 | // API replacement for non-fd stdio functions 31 | #define fseeko _fseeki64 32 | #define ftello _ftelli64 33 | #define snprintf _snprintf 34 | #define strcasecmp _stricmp 35 | #define strtoll _strtoi64 36 | 37 | #ifdef _WIN64 38 | #define strtol _strtoi64 39 | #define strtoul _strtoui64 40 | #endif 41 | 42 | #define sleep(x) Sleep((x)*1000) 43 | /* Redis calls usleep(1) to give thread some time. 44 | * Sleep(0) should do the same on Windows. 45 | * In other cases, usleep is called with millisec resolution 46 | * which can be directly translated to WinAPI Sleep() */ 47 | #undef usleep 48 | #define usleep(x) (x == 1) ? Sleep(0) : Sleep((int)((x)/1000)) 49 | 50 | 51 | /* following defined to choose little endian byte order */ 52 | #define __i386__ 1 53 | #if !defined(va_copy) 54 | #define va_copy(d,s) d = (s) 55 | #endif 56 | 57 | #ifndef __RTL_GENRANDOM 58 | #define __RTL_GENRANDOM 1 59 | typedef BOOLEAN(_stdcall* RtlGenRandomFunc)(void * RandomBuffer, ULONG RandomBufferLength); 60 | #endif 61 | RtlGenRandomFunc RtlGenRandom; 62 | 63 | #define random() replace_random() 64 | #define rand() replace_random() 65 | #define srandom srand 66 | int replace_random(); 67 | 68 | #define rename(a,b) replace_rename(a,b) 69 | int replace_rename(const char *src, const char *dest); 70 | 71 | int truncate(const char *path, PORT_LONGLONG length); 72 | 73 | #define lseek lseek64 74 | 75 | #endif -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_ASSERT_H 24 | #define WIN32_INTEROP_ASSERT_H 25 | 26 | #ifdef _DEBUG 27 | #define ASSERT(condition) do { if(!(condition)){ fprintf(stderr, "Assertion failed: %s @ %s::%s (%d)\n", #condition , __FILE__, __FUNCTION__, __LINE__); DebugBreak();} } while(0) 28 | #else 29 | #define ASSERT(condition) 30 | #endif 31 | 32 | #endif -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_CommandLine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROPA_COMMANDLINE_H 24 | #define WIN32_INTEROPA_COMMANDLINE_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | using namespace std; 31 | 32 | // A map of arguments encountered to the set of parameters for those arguments, in the order in which they 33 | // were encountered. If 'maxmemory' is encountered 3 times, ArgumentMap["maxmemory"] will return a vector 34 | // of an array of values, with the first being the value od the first 'maxmemory' instance enountered. 35 | // Order of encounter is command line, conf file, nested conf file #1 (via include statement), ... 36 | typedef map>> ArgumentMap; 37 | extern ArgumentMap g_argMap; 38 | 39 | void ParseConfFile(string confFile, string cwd, ArgumentMap& argMap); 40 | void ParseCommandLineArguments(int argc, char** argv); 41 | vector GetAccessPaths(); 42 | 43 | const string cQFork = "qfork"; 44 | const string cServiceRun = "service-run"; 45 | const string cServiceInstall = "service-install"; 46 | const string cServiceUninstall = "service-uninstall"; 47 | const string cServiceStart = "service-start"; 48 | const string cServiceStop = "service-stop"; 49 | const string cServiceName = "service-name"; 50 | const string cSyslogEnabled = "syslog-enabled"; 51 | const string cSyslogIdent= "syslog-ident"; 52 | const string cLogfile = "logfile"; 53 | const string cInclude = "include"; 54 | const string cDir = "dir"; 55 | const string cPersistenceAvailable = "persistence-available"; 56 | const string cMaxMemory = "maxmemory"; 57 | const string cSentinel = "sentinel"; 58 | 59 | const string cYes = "yes"; 60 | const string cNo = "no"; 61 | const string cDefaultSyslogIdent = "redis"; 62 | const string cDefaultLogfile = "stdout"; 63 | 64 | /* List of -- command arguments to be passed to redis::main() unaltered */ 65 | const vector cRedisArgsForMainC = {"help", "version", "test-memory"}; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Common.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | #include "Win32_Common.h" 23 | 24 | namespace Globals 25 | { 26 | size_t pageSize = 0; 27 | } 28 | 29 | /* This function is used to force the VEH on the entire size of the buffer length, 30 | * in the event that the buffer crosses the memory page boundaries */ 31 | void EnsureMemoryIsMapped(const void *buffer, size_t size) { 32 | char* pFirstByte = (char*) buffer; 33 | char* pLastByte = (char*) buffer + size - 1; 34 | char* pFirstPage = pFirstByte - ((size_t) pFirstByte % Globals::pageSize); 35 | char* pLastPage = pLastByte - ((size_t) pLastByte % Globals::pageSize); 36 | // Use 'volatile' to make sure the compiler doesn't remove the memory access 37 | for (volatile char* p = pFirstPage; p <= pLastPage; p += Globals::pageSize) { 38 | volatile char c = *p; 39 | 40 | } 41 | } 42 | 43 | bool IsWindowsVersionAtLeast(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) { 44 | OSVERSIONINFOEXW osvi = {sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0}; 45 | DWORDLONG const dwlConditionMask = VerSetConditionMask( 46 | VerSetConditionMask( 47 | VerSetConditionMask( 48 | 0, VER_MAJORVERSION, VER_GREATER_EQUAL), 49 | VER_MINORVERSION, VER_GREATER_EQUAL), 50 | VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); 51 | 52 | osvi.dwMajorVersion = wMajorVersion; 53 | osvi.dwMinorVersion = wMinorVersion; 54 | osvi.wServicePackMajor = wServicePackMajor; 55 | 56 | return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; 57 | } 58 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_COMMON_H 24 | #define WIN32_INTEROP_COMMON_H 25 | 26 | #include 27 | 28 | namespace Globals { 29 | // forward declarations only 30 | extern size_t pageSize; 31 | } 32 | 33 | void EnsureMemoryIsMapped(const void *buffer, size_t size); 34 | bool IsWindowsVersionAtLeast(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor); 35 | 36 | class WindowsVersion { 37 | private: 38 | bool isAtLeast_6_0; 39 | bool isAtLeast_6_2; 40 | 41 | WindowsVersion() { 42 | isAtLeast_6_0 = IsWindowsVersionAtLeast(6, 0, 0); 43 | isAtLeast_6_2 = IsWindowsVersionAtLeast(6, 2, 0); 44 | } 45 | 46 | WindowsVersion(WindowsVersion const&); // Don't implement to guarantee singleton semantics 47 | void operator=(WindowsVersion const&); // Don't implement to guarantee singleton semantics 48 | 49 | public: 50 | static WindowsVersion& getInstance() { 51 | static WindowsVersion instance; // Instantiated on first use. Guaranteed to be destroyed. 52 | return instance; 53 | } 54 | 55 | bool IsAtLeast_6_0() { 56 | return isAtLeast_6_0; 57 | } 58 | 59 | bool IsAtLeast_6_2() { 60 | return isAtLeast_6_2; 61 | } 62 | }; 63 | #endif -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_ERROR_H 24 | #define WIN32_INTEROP_ERROR_H 25 | 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" 30 | { 31 | #endif 32 | 33 | /* Converts error codes returned by GetLastError/WSAGetLastError to errno codes */ 34 | int translate_sys_error(int sys_error); 35 | void set_errno_from_last_error(); 36 | 37 | //int strerror_r(int err, char* buf, size_t buflen); 38 | char *wsa_strerror(int err); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_EventLog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #ifdef __cplusplus 26 | #include 27 | using namespace std; 28 | 29 | typedef class RedisEventLog { 30 | public: 31 | ~RedisEventLog() {} 32 | 33 | void InstallEventLogSource(string appPath); 34 | void UninstallEventLogSource(); 35 | 36 | void SetEventLogIdentity(const char* identity); 37 | 38 | void LogMessage(LPCSTR msg, const WORD type); 39 | void LogError(string msg); 40 | 41 | string GetEventLogIdentity(); 42 | void EnableEventLog(bool enabled); 43 | bool IsEventLogEnabled(); 44 | 45 | private: 46 | const string eventLogName = "redis"; 47 | const string cEventLogPath = "SYSTEM\\CurrentControlSet\\Services\\EventLog\\"; 48 | const string cEventLogApplicitonPath = cEventLogPath + "Application\\"; 49 | const string cRedis = "redis"; 50 | const string cEventMessageFile = "EventMessageFile"; 51 | const string cRedisServer = "redis-server"; 52 | const string cTypesSupported = "TypesSupported"; 53 | const string cApplication = "Application"; 54 | } RedisEventLog; 55 | 56 | extern "C" { 57 | #endif 58 | 59 | void setSyslogEnabled(int enabled); 60 | void setSyslogIdent(char* identity); 61 | int IsEventLogEnabled(); 62 | void WriteEventLog(const char* msg); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_PThread.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | 6 | #ifndef _SIGSET_T_ 7 | #define _SIGSET_T_ 8 | typedef size_t _sigset_t; 9 | #define sigset_t _sigset_t 10 | #endif /* _SIGSET_T_ */ 11 | 12 | #ifndef SIG_SETMASK 13 | #define SIG_SETMASK (0) 14 | #define SIG_BLOCK (1) 15 | #define SIG_UNBLOCK (2) 16 | #endif /* SIG_SETMASK */ 17 | 18 | /* threads avoiding pthread.h */ 19 | #define pthread_mutex_t CRITICAL_SECTION 20 | #define pthread_attr_t ssize_t 21 | 22 | #define pthread_mutex_init(a,b) (InitializeCriticalSectionAndSpinCount((a), 0x80000400),0) 23 | #define pthread_mutex_destroy(a) DeleteCriticalSection((a)) 24 | #define pthread_mutex_lock EnterCriticalSection 25 | #define pthread_mutex_unlock LeaveCriticalSection 26 | 27 | #define pthread_equal(t1, t2) ((t1) == (t2)) 28 | 29 | #define pthread_attr_init(x) (*(x) = 0) 30 | #define pthread_attr_getstacksize(x, y) (*(y) = *(x)) 31 | #define pthread_attr_setstacksize(x, y) (*(x) = y) 32 | 33 | #define pthread_t unsigned int 34 | 35 | int pthread_create(pthread_t *thread, const void *unused, void *(*start_routine)(void*), void *arg); 36 | 37 | pthread_t pthread_self(void); 38 | 39 | typedef struct { 40 | CRITICAL_SECTION waiters_lock; 41 | LONG waiters; 42 | int was_broadcast; 43 | HANDLE sema; 44 | HANDLE continue_broadcast; 45 | } pthread_cond_t; 46 | 47 | int pthread_cond_init(pthread_cond_t *cond, const void *unused); 48 | int pthread_cond_destroy(pthread_cond_t *cond); 49 | int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); 50 | int pthread_cond_signal(pthread_cond_t *cond); 51 | 52 | int pthread_detach(pthread_t thread); 53 | int pthread_sigmask(int how, const sigset_t *set, sigset_t *oldset); 54 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Portability.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROPA_PORTABILITY_H 24 | #define WIN32_INTEROPA_PORTABILITY_H 25 | 26 | 27 | #ifdef __cplusplus 28 | extern "C" 29 | { 30 | #endif 31 | 32 | /* Sometimes in the Windows port we make changes from: 33 | antirez_redis_statement(); 34 | to: 35 | #ifdef _WIN32 36 | windows_redis_statement(); 37 | #else 38 | antirez_redis_statement(); 39 | #endif 40 | 41 | If subsequently antirez changed that code, we might not detect the change during the next merge. 42 | The INDUCE_MERGE_CONFLICT macro expands to nothing, but it is used to make sure that the original line 43 | is modified with respect to the antirez version, so that any subsequent modifications will trigger a conflict 44 | during the next merge. 45 | 46 | Sample usage: 47 | #ifdef _WIN32 48 | windows_redis_statement(); 49 | #else 50 | antirez_redis_statement(); INDUCE_MERGE_CONFLICT 51 | #endif 52 | 53 | Don't use any parenthesis or semi-colon after INDUCE_MERGE_CONFLICT. 54 | Use it at the end of a line to preserve the original indentation. 55 | */ 56 | #define INDUCE_MERGE_CONFLICT 57 | 58 | /* Use WIN_PORT_FIX at the end of a line to mark places where we make changes to the code 59 | without using #ifdefs. Useful to keep the code more legible. Mainly intended for replacing 60 | the use of long (which is 64-bit on 64-bit Unix and 32-bit on 64-bit Windows) to portable types. 61 | In order to be eligible for an inline fix (without #ifdef), the change should be portable back to the Posix version. 62 | */ 63 | #define WIN_PORT_FIX 64 | 65 | #ifdef _WIN32 66 | #define IF_WIN32(x, y) x 67 | #define WIN32_ONLY(x) x 68 | #define POSIX_ONLY(x) 69 | #define inline __inline 70 | #else 71 | #define IF_WIN32(x, y) y 72 | #define WIN32_ONLY(x) 73 | #define POSIX_ONLY(x) x 74 | #endif 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_QFork_impl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | void SetupRedisGlobals(LPVOID redisData, size_t redisDataSize, uint32_t dictHashKey); 30 | int do_rdbSave(char* filename); 31 | int do_aofSave(char* filename, int aof_pipe_read_ack, int aof_pipe_read_data, int aof_pipe_write_ack); 32 | int do_socketSave(int *fds, int numfds, uint64_t *clientids, int pipe_write_fd); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_RedisLog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | #pragma once 23 | 24 | /* Log levels */ 25 | #define LL_DEBUG 0 26 | #define LL_VERBOSE 1 27 | #define LL_NOTICE 2 28 | #define LL_WARNING 3 29 | #define LL_RAW (1<<10) /* Modifier to log without timestamp */ 30 | #define CONFIG_DEFAULT_VERBOSITY LL_NOTICE 31 | /* 32 | * Default maximum length of syslog messages. 33 | * Empirical results show that 1024 is also the maximum size that WriteFile can 34 | * write atomically. 35 | */ 36 | #define LOG_MAX_LEN 1024 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | void setLogVerbosityLevel(int level); 43 | void setLogFile(const char* filename); 44 | const char* getLogFilename(); 45 | void serverLogRaw(int level, const char *msg); 46 | void serverLog(int level, const char *fmt, ...); 47 | void serverLogFromHandler(int level, const char *msg); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #ifdef __cplusplus 26 | extern "C" 27 | { 28 | #endif 29 | 30 | BOOL RunningAsService(); 31 | const char* GetServiceName(); 32 | BOOL HandleServiceCommands(int argc, char **argv); 33 | BOOL ServiceStopIssued(); 34 | DWORD ServiceWorkerThread(LPVOID lpParam); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_StackTrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include "win32_types.h" 26 | #include 27 | 28 | void StackTraceInit(void); 29 | 30 | extern "C" typedef char *sds; 31 | //extern "C" sds genRedisInfoString(char *section); 32 | //extern "C" void bugReportStart(void); -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_ThreadControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | 30 | void InitThreadControl(); 31 | void IncrementWorkerThreadCount(); 32 | void DecrementWorkerThreadCount(); 33 | void RequestSuspension(); 34 | BOOL SuspensionCompleted(); 35 | void ResumeFromSuspension(); 36 | 37 | void WorkerThread_EnterSafeMode(); 38 | void WorkerThread_ExitSafeMode(); 39 | 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_Time.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | /* Credits Henry Rawas (henryr@schakra.com) */ 24 | 25 | #ifndef WIN32_INTEROP_TIME_H 26 | #define WIN32_INTEROP_TIME_H 27 | 28 | #if (_MSC_VER > 1800) 29 | #include 30 | #endif 31 | #include 32 | 33 | #define gettimeofday gettimeofday_highres 34 | 35 | void InitTimeFunctions(); 36 | uint64_t GetHighResRelativeTime(double scale); 37 | time_t gettimeofdaysecs(unsigned int *usec); 38 | int gettimeofday_highres(struct timeval *tv, struct timezone *tz); 39 | char* ctime_r(const time_t *clock, char *buf); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_fdapi_crt.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #include "Win32_fdapi_crt.h" 24 | #include "Win32_Common.h" 25 | #include 26 | #include 27 | 28 | int crt_pipe(int *pfds, unsigned int psize, int textmode) { 29 | return _pipe(pfds, psize, textmode); 30 | } 31 | 32 | int crt_close(int fd) { 33 | return _close(fd); 34 | } 35 | 36 | int crt_read(int fd, void *buffer, unsigned int count) { 37 | return _read(fd, buffer, count); 38 | } 39 | 40 | int crt_write(int fd, const void *buffer, unsigned int count) { 41 | return _write(fd, buffer, count); 42 | } 43 | 44 | int crt_open(const char *filename, int oflag, int pmode) { 45 | return _open(filename, oflag, pmode); 46 | } 47 | 48 | int crt_open_osfhandle(intptr_t osfhandle, int flags) { 49 | return _open_osfhandle(osfhandle, flags); 50 | } 51 | 52 | intptr_t crt_get_osfhandle(int fd) { 53 | return _get_osfhandle(fd); 54 | } 55 | 56 | int crt_setmode(int fd, int mode) { 57 | return ::_setmode(fd, mode); 58 | } 59 | 60 | size_t crt_fwrite(const void *buffer, size_t size, size_t count, FILE *file) { 61 | // fwrite() somehow locks its view of the buffer. If during a fork operation the buffer has not been loaded into the forkee's process space, 62 | // the VEH will be called to load the missing pages. Although the page gets loaded, fwrite() will not see the loaded page. The result is 63 | // that fwrite will fail with errno set to ERROR_INVALID_USER_BUFFER. The fix is to force the buffer into memory before fwrite(). This only 64 | // impacts writes that straddle page boundaries. 65 | EnsureMemoryIsMapped(buffer, size); 66 | return ::fwrite(buffer, size, count, file); 67 | } 68 | 69 | int crt_fclose(FILE* file) { 70 | return ::fclose(file); 71 | } 72 | 73 | int crt_fileno(FILE* file) { 74 | return ::_fileno(file); 75 | } 76 | 77 | int crt_isatty(int fd) { 78 | return _isatty(fd); 79 | } 80 | 81 | int crt_access(const char *pathname, int mode) { 82 | return _access(pathname, mode); 83 | } 84 | 85 | __int64 crt_lseek64(int fd, __int64 offset, int origin) { 86 | return _lseeki64(fd, offset, origin); 87 | } 88 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_fdapi_crt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | 28 | int crt_pipe(int *pfds, unsigned int psize, int textmode); 29 | int crt_close(int fd); 30 | int crt_read(int fd, void *buffer, unsigned int count); 31 | int crt_write(int fd, const void *buffer, unsigned int count); 32 | int crt_open(const char *filename, int oflag, int pmode); 33 | int crt_open_osfhandle(intptr_t osfhandle, int flags); 34 | intptr_t crt_get_osfhandle(int fd); 35 | int crt_setmode(int fd, int mode); 36 | size_t crt_fwrite(const void *buffer, size_t size, size_t count, FILE *file); 37 | int crt_fclose(FILE* file); 38 | int crt_fileno(FILE* file); 39 | int crt_isatty(int fd); 40 | int crt_access(const char *pathname, int mode); 41 | __int64 crt_lseek64(int fd, __int64 offset, int origin); 42 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_variadicFunctor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #include "win32_types.h" 24 | 25 | #include "Win32_variadicFunctor.h" 26 | 27 | #include 28 | #include 29 | #include 30 | using namespace std; 31 | 32 | DLLMap& DLLMap::getInstance() { 33 | static DLLMap instance; // Instantiated on first use. Guaranteed to be destroyed. 34 | return instance; 35 | } 36 | 37 | DLLMap::DLLMap() { }; 38 | 39 | LPVOID DLLMap::getProcAddress(string dll, string functionName) 40 | { 41 | if (find(dll) == end()) { 42 | HMODULE mod = LoadLibraryA(dll.c_str()); 43 | if (mod == NULL) { 44 | throw system_error(GetLastError(), system_category(), "LoadLibrary failed"); 45 | } 46 | (*this)[dll] = mod; 47 | } 48 | 49 | HMODULE mod = (*this)[dll]; 50 | LPVOID fp = GetProcAddress(mod, functionName.c_str()); 51 | if (fp == nullptr) { 52 | throw system_error(GetLastError(), system_category(), "LoadLibrary failed"); 53 | } 54 | 55 | return fp; 56 | } 57 | 58 | DLLMap::~DLLMap() 59 | { 60 | for each(auto modPair in (*this)) 61 | { 62 | FreeLibrary(modPair.second); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/Win32_variadicFunctor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | using namespace std; 28 | 29 | class DLLMap : map { 30 | public: 31 | static DLLMap& getInstance(); 32 | 33 | private: 34 | DLLMap(); 35 | DLLMap(DLLMap const&); // Don't implement to guarantee singleton semantics 36 | void operator=(DLLMap const&); // Don't implement to guarantee singleton semantics 37 | 38 | public: 39 | LPVOID getProcAddress(string dll, string functionName); 40 | virtual ~DLLMap(); 41 | }; 42 | 43 | 44 | template 45 | class dllfunctor_stdcall { 46 | public: 47 | dllfunctor_stdcall(string dll, string function) 48 | { 49 | _f = (R(__stdcall *)(T...))DLLMap::getInstance().getProcAddress(dll, function.c_str()); 50 | } 51 | R operator()(T... args) { return _f(args...); } 52 | 53 | private: 54 | R(__stdcall *_f)(T...); 55 | }; 56 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/resources/EventLog.rc: -------------------------------------------------------------------------------- 1 | LANGUAGE 0x9,0x1 2 | 1 11 "EventLog_MSG00409.bin" 3 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/resources/EventLog.res: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/source/hiredis/hiredis/src/Win32_Interop/resources/EventLog.res -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/resources/EventLog_MSG00409.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/source/hiredis/hiredis/src/Win32_Interop/resources/EventLog_MSG00409.bin -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_TYPES_H 24 | #define WIN32_INTEROP_TYPES_H 25 | 26 | #include "win32_types_hiredis.h" 27 | 28 | /* The Posix version of Redis defines off_t as 64-bit integers, so we do the same. 29 | * On Windows, these types are defined as 32-bit in sys/types.h under and #ifndef _OFF_T_DEFINED 30 | * So we define _OFF_T_DEFINED at the project level, to make sure that that definition is never included. 31 | * If you get an error about re-definition, make sure to include this file before sys/types.h, or any other 32 | * file that include it (eg wchar.h). 33 | * _off_t is also defined #ifndef _OFF_T_DEFINED, so we need to define it here. 34 | * It is used by the CRT internally (but not by Redis), so we leave it as 32-bit. 35 | */ 36 | 37 | //lstate.htypedef __int64 off_t; 38 | typedef long _off_t; 39 | 40 | #ifndef _OFF_T_DEFINED 41 | #define _OFF_T_DEFINED 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32_types_hiredis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_TYPES_HIREDIS_H 24 | #define WIN32_INTEROP_TYPES_HIREDIS_H 25 | 26 | /* On 64-bit *nix and Windows use different data type models: LP64 and LLP64 respectively. 27 | * The main difference is that 'long' is 64-bit on 64-bit *nix and 32-bit on 64-bit Windows. 28 | * The Posix version of Redis makes many assumptions about long being 64-bit and the same size 29 | * as pointers. 30 | * To deal with this issue, we replace all occurrences of 'long' in antirez code with our own typedefs, 31 | * and make those definitions 64-bit to match antirez' assumptions. 32 | * This enables us to have merge check script to verify that no new instances of 'long' go unnoticed. 33 | */ 34 | 35 | typedef __int64 PORT_LONGLONG; 36 | typedef unsigned __int64 PORT_ULONGLONG; 37 | typedef double PORT_LONGDOUBLE; 38 | 39 | #ifdef _WIN64 40 | typedef __int64 ssize_t; 41 | typedef __int64 PORT_LONG; 42 | typedef unsigned __int64 PORT_ULONG; 43 | #else 44 | typedef long ssize_t; 45 | typedef long PORT_LONG; 46 | typedef unsigned long PORT_ULONG; 47 | #endif 48 | 49 | #ifdef _WIN64 50 | #define PORT_LONG_MAX _I64_MAX 51 | #define PORT_LONG_MIN _I64_MIN 52 | #define PORT_ULONG_MAX _UI64_MAX 53 | #else 54 | #define PORT_LONG_MAX LONG_MAX 55 | #define PORT_LONG_MIN LONG_MIN 56 | #define PORT_ULONG_MAX ULONG_MAX 57 | #endif 58 | 59 | /* The maximum possible size_t value has all bits set */ 60 | #define MAX_SIZE_T (~(size_t)0) 61 | 62 | typedef int pid_t; 63 | 64 | #ifndef mode_t 65 | #define mode_t unsigned __int32 66 | #endif 67 | 68 | /* sha1 */ 69 | #ifndef u_int32_t 70 | typedef unsigned __int32 u_int32_t; 71 | #endif 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32_wsiocp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_WSIOCP_H 24 | #define WIN32_INTEROP_WSIOCP_H 25 | 26 | #include "win32_wsiocp2.h" 27 | 28 | /* structs and functions for using IOCP with windows sockets */ 29 | 30 | /* structure used for async write requests. 31 | * contains overlapped, WSABuf, and callback info 32 | * NOTE: OVERLAPPED must be first member */ 33 | typedef struct asendreq { 34 | OVERLAPPED ov; 35 | WSABUF wbuf; 36 | WSIOCP_Request req; 37 | aeFileProc *proc; 38 | aeEventLoop *eventLoop; 39 | } asendreq; 40 | 41 | /* structure used for async accept requests. 42 | * contains overlapped, accept socket, accept buffer 43 | * NOTE: OVERLAPPED must be first member */ 44 | typedef struct aacceptreq { 45 | OVERLAPPED ov; 46 | SOCKET accept; 47 | void *buf; 48 | struct aacceptreq *next; 49 | } aacceptreq; 50 | 51 | 52 | /* per socket information */ 53 | typedef struct iocpSockState { 54 | int masks; 55 | int fd; 56 | aacceptreq *reqs; 57 | int wreqs; 58 | OVERLAPPED ov_read; 59 | list wreqlist; 60 | int unknownComplete; 61 | } iocpSockState; 62 | 63 | #define READ_QUEUED 0x000100 64 | #define SOCKET_ATTACHED 0x000400 65 | #define ACCEPT_PENDING 0x000800 66 | #define LISTEN_SOCK 0x001000 67 | #define CONNECT_PENDING 0x002000 68 | #define CLOSE_PENDING 0x004000 69 | 70 | void WSIOCP_Init(HANDLE iocp); 71 | void WSIOCP_Cleanup(); 72 | iocpSockState* WSIOCP_GetExistingSocketState(int fd); 73 | iocpSockState* WSIOCP_GetSocketState(int fd); 74 | BOOL WSIOCP_CloseSocketState(iocpSockState* pSocketState); 75 | 76 | void* CallocMemoryNoCOW(size_t size); 77 | void FreeMemoryNoCOW(void * ptr); 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32_wsiocp2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_INTEROP_WSIOCP2_H 24 | #define WIN32_INTEROP_WSIOCP2_H 25 | 26 | #include // For SOCKADDR_STORAGE 27 | #include "WS2tcpip.h" // For socklen_t 28 | 29 | /* need callback on write complete. WSIOCP_Request is used to pass parameters */ 30 | typedef struct WSIOCP_Request { 31 | void *client; 32 | void *data; 33 | char *buf; 34 | int len; 35 | } WSIOCP_Request; 36 | 37 | int WSIOCP_QueueNextRead(int rfd); 38 | int WSIOCP_SocketSend(int rfd, char *buf, int len, void *eventLoop, void *client, void *data, void *proc); 39 | int WSIOCP_Listen(int rfd, int backlog); 40 | int WSIOCP_Accept(int rfd, struct sockaddr *sa, socklen_t *len); 41 | int WSIOCP_SocketConnect(int rfd, const SOCKADDR_STORAGE *ss); 42 | int WSIOCP_SocketConnectBind(int rfd, const SOCKADDR_STORAGE *ss, const char* source_addr); 43 | 44 | #endif -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32fixes.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Modified by Henry Rawas (henryr@schakra.com) 3 | * - make it compatible with Visual Studio builds 4 | * - added wstrtod to handle INF, NAN 5 | * - added gettimeofday routine 6 | * - modified rename to retry after failure 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #if _MSC_VER < 1800 14 | #define isnan _isnan 15 | #define isfinite _finite 16 | #define isinf(x) (!_finite(x)) 17 | #else 18 | #include 19 | #endif 20 | 21 | static _locale_t clocale = NULL; 22 | double wstrtod(const char *nptr, char **eptr) { 23 | double d; 24 | char *leptr; 25 | if (clocale == NULL) { 26 | clocale = _create_locale(LC_ALL, "C"); 27 | } 28 | d = _strtod_l(nptr, &leptr, clocale); 29 | /* if 0, check if input was inf */ 30 | if (d == 0 && nptr == leptr) { 31 | int neg = 0; 32 | while (isspace(*nptr)) { 33 | nptr++; 34 | } 35 | if (*nptr == '+') { 36 | nptr++; 37 | } else if (*nptr == '-') { 38 | nptr++; 39 | neg = 1; 40 | } 41 | 42 | if (_strnicmp("INF", nptr, 3) == 0) { 43 | if (eptr != NULL) { 44 | if ((_strnicmp("INFINITE", nptr, 8) == 0) || (_strnicmp("INFINITY", nptr, 8) == 0)) { 45 | *eptr = (char*) (nptr + 8); 46 | } else { 47 | *eptr = (char*) (nptr + 3); 48 | } 49 | } 50 | if (neg == 1) { 51 | return -HUGE_VAL; 52 | } else { 53 | return HUGE_VAL; 54 | } 55 | } else if (_strnicmp("NAN", nptr, 3) == 0) { 56 | if (eptr != NULL) { 57 | *eptr = (char*) (nptr + 3); 58 | } 59 | /* create a NaN : 0 * infinity*/ 60 | d = HUGE_VAL; 61 | return d * 0; 62 | } 63 | } 64 | if (eptr != NULL) { 65 | *eptr = leptr; 66 | } 67 | return d; 68 | } 69 | 70 | 71 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/Win32_Interop/win32fixes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Modified by Henry Rawas (henryr@schakra.com) 3 | * - make it compatible with Visual Studio builds 4 | * - added wstrtod to handle INF, NAN 5 | * - added support for using IOCP with sockets 6 | */ 7 | 8 | #ifndef WIN32FIXES_H 9 | #define WIN32FIXES_H 10 | 11 | #pragma warning(error: 4005) 12 | #pragma warning(error: 4013) 13 | 14 | #ifdef WIN32 15 | #ifndef _WIN32 16 | #define _WIN32 17 | #endif 18 | #endif 19 | 20 | #define WIN32_LEAN_AND_MEAN 21 | #define NOGDI 22 | #define __USE_W32_SOCKETS 23 | 24 | #include "win32_types.h" 25 | #include 26 | #include 27 | #include // for _O_BINARY 28 | #include // for INT_MAX 29 | 30 | #include "Win32_APIs.h" 31 | #include "Win32_FDAPI.h" 32 | 33 | #define WNOHANG 1 34 | 35 | /* file mapping */ 36 | #define PROT_READ 1 37 | #define PROT_WRITE 2 38 | 39 | #define MAP_FAILED (void *) -1 40 | 41 | #define MAP_SHARED 1 42 | #define MAP_PRIVATE 2 43 | 44 | #if _MSC_VER < 1800 45 | #ifndef ECONNRESET 46 | #define ECONNRESET WSAECONNRESET 47 | #endif 48 | 49 | #ifndef EINPROGRESS 50 | #define EINPROGRESS WSAEINPROGRESS 51 | #endif 52 | 53 | #ifndef ETIMEDOUT 54 | #define ETIMEDOUT WSAETIMEDOUT 55 | #endif 56 | #endif 57 | 58 | #ifdef __cplusplus 59 | extern "C" 60 | { 61 | #endif 62 | 63 | /* strtod does not handle Inf and Nan, we need to do the check before calling strtod */ 64 | #undef strtod 65 | #define strtod(nptr, eptr) wstrtod((nptr), (eptr)) 66 | 67 | double wstrtod(const char *nptr, char **eptr); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | // access check for executable uses X_OK. For Windows use READ access. 74 | #ifndef X_OK 75 | #define X_OK 4 76 | #endif 77 | 78 | #ifndef STDOUT_FILENO 79 | #define STDOUT_FILENO 1 80 | #endif 81 | 82 | #endif /* WIN32FIXES_H */ 83 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/adlist.h: -------------------------------------------------------------------------------- 1 | /* adlist.h - A generic doubly linked list implementation 2 | * 3 | * Copyright (c) 2006-2012, Salvatore Sanfilippo 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | #ifdef _WIN32 31 | #include "Win32_Interop/Win32_Portability.h" 32 | #endif 33 | 34 | #ifndef __ADLIST_H__ 35 | #define __ADLIST_H__ 36 | 37 | /* Node, List, and Iterator are the only data structures used currently. */ 38 | 39 | typedef struct listNode { 40 | struct listNode *prev; 41 | struct listNode *next; 42 | void *value; 43 | } listNode; 44 | 45 | typedef struct listIter { 46 | listNode *next; 47 | int direction; 48 | } listIter; 49 | 50 | typedef struct list { 51 | listNode *head; 52 | listNode *tail; 53 | void *(*dup)(void *ptr); 54 | void (*free)(void *ptr); 55 | int (*match)(void *ptr, void *key); 56 | PORT_ULONG len; 57 | } list; 58 | 59 | /* Functions implemented as macros */ 60 | #define listLength(l) ((l)->len) 61 | #define listFirst(l) ((l)->head) 62 | #define listLast(l) ((l)->tail) 63 | #define listPrevNode(n) ((n)->prev) 64 | #define listNextNode(n) ((n)->next) 65 | #define listNodeValue(n) ((n)->value) 66 | 67 | #define listSetDupMethod(l,m) ((l)->dup = (m)) 68 | #define listSetFreeMethod(l,m) ((l)->free = (m)) 69 | #define listSetMatchMethod(l,m) ((l)->match = (m)) 70 | 71 | #define listGetDupMethod(l) ((l)->dup) 72 | #define listGetFree(l) ((l)->free) 73 | #define listGetMatchMethod(l) ((l)->match) 74 | 75 | /* Prototypes */ 76 | list *listCreate(void); 77 | void listRelease(list *list); 78 | list *listAddNodeHead(list *list, void *value); 79 | list *listAddNodeTail(list *list, void *value); 80 | list *listInsertNode(list *list, listNode *old_node, void *value, int after); 81 | void listDelNode(list *list, listNode *node); 82 | listIter *listGetIterator(list *list, int direction); 83 | listNode *listNext(listIter *iter); 84 | void listReleaseIterator(listIter *iter); 85 | list *listDup(list *orig); 86 | listNode *listSearchKey(list *list, void *key); 87 | listNode *listIndex(list *list, PORT_LONG index); 88 | void listRewind(list *list, listIter *li); 89 | void listRewindTail(list *list, listIter *li); 90 | void listRotate(list *list); 91 | 92 | /* Directions for iterators */ 93 | #define AL_START_HEAD 0 94 | #define AL_START_TAIL 1 95 | 96 | #endif /* __ADLIST_H__ */ 97 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/anet.h: -------------------------------------------------------------------------------- 1 | /* anet.c -- Basic TCP socket stuff made a bit less boring 2 | * 3 | * Copyright (c) 2006-2012, Salvatore Sanfilippo 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef ANET_H 32 | #define ANET_H 33 | 34 | #include 35 | 36 | #define ANET_OK 0 37 | #define ANET_ERR -1 38 | #define ANET_ERR_LEN 256 39 | 40 | /* Flags used with certain functions. */ 41 | #define ANET_NONE 0 42 | #define ANET_IP_ONLY (1<<0) 43 | 44 | #if defined(__sun) || defined(_AIX) 45 | #define AF_LOCAL AF_UNIX 46 | #endif 47 | 48 | #ifdef _AIX 49 | #undef ip_len 50 | #endif 51 | 52 | int anetTcpConnect(char *err, char *addr, int port); 53 | int anetTcpNonBlockConnect(char *err, char *addr, int port); 54 | int anetTcpNonBlockBindConnect(char *err, char *addr, int port, char *source_addr); 55 | int anetTcpNonBlockBestEffortBindConnect(char *err, char *addr, int port, char *source_addr); 56 | int anetUnixConnect(char *err, char *path); 57 | int anetUnixNonBlockConnect(char *err, char *path); 58 | int anetRead(int fd, char *buf, int count); 59 | int anetResolve(char *err, char *host, char *ipbuf, size_t ipbuf_len); 60 | int anetResolveIP(char *err, char *host, char *ipbuf, size_t ipbuf_len); 61 | int anetTcpServer(char *err, int port, char *bindaddr, int backlog); 62 | int anetTcp6Server(char *err, int port, char *bindaddr, int backlog); 63 | int anetUnixServer(char *err, char *path, mode_t perm, int backlog); 64 | int anetTcpAccept(char *err, int serversock, char *ip, size_t ip_len, int *port); 65 | int anetUnixAccept(char *err, int serversock); 66 | int anetWrite(int fd, char *buf, int count); 67 | int anetNonBlock(char *err, int fd); 68 | int anetBlock(char *err, int fd); 69 | int anetEnableTcpNoDelay(char *err, int fd); 70 | int anetDisableTcpNoDelay(char *err, int fd); 71 | int anetTcpKeepAlive(char *err, int fd); 72 | int anetSendTimeout(char *err, int fd, PORT_LONGLONG ms); 73 | int anetPeerToString(int fd, char *ip, size_t ip_len, int *port); 74 | int anetKeepAlive(char *err, int fd, int interval); 75 | int anetSockName(int fd, char *ip, size_t ip_len, int *port); 76 | int anetFormatAddr(char *fmt, size_t fmt_len, char *ip, int port); 77 | int anetFormatPeer(int fd, char *fmt, size_t fmt_len); 78 | int anetFormatSock(int fd, char *fmt, size_t fmt_len); 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/asciilogo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | char *ascii_logo = 31 | " _._ \n" 32 | " _.-``__ ''-._ \n" 33 | " _.-`` `. `_. ''-._ Redis %s (%s/%d) %s bit\n" 34 | " .-`` .-```. ```\\/ _.,_ ''-._ \n" 35 | " ( ' , .-` | `, ) Running in %s mode\n" 36 | " |`-._`-...-` __...-.``-._|'` _.-'| Port: %d\n" 37 | " | `-._ `._ / _.-' | PID: %ld\n" 38 | " `-._ `-._ `-./ _.-' _.-' \n" 39 | " |`-._`-._ `-.__.-' _.-'_.-'| \n" 40 | " | `-._`-._ _.-'_.-' | http://redis.io \n" 41 | " `-._ `-._`-.__.-'_.-' _.-' \n" 42 | " |`-._`-._ `-.__.-' _.-'_.-'| \n" 43 | " | `-._`-._ _.-'_.-' | \n" 44 | " `-._ `-._`-.__.-'_.-' _.-' \n" 45 | " `-._ `-.__.-' _.-' \n" 46 | " `-._ _.-' \n" 47 | " `-.__.-' \n\n"; 48 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/bio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* Exported API */ 31 | void bioInit(void); 32 | void bioCreateBackgroundJob(int type, void *arg1, void *arg2, void *arg3); 33 | PORT_ULONGLONG bioPendingJobsOfType(int type); 34 | void bioWaitPendingJobsLE(int type, PORT_ULONGLONG num); 35 | time_t bioOlderJobOfType(int type); 36 | void bioKillThreads(void); 37 | 38 | /* Background job opcodes */ 39 | #define BIO_CLOSE_FILE 0 /* Deferred close(2) syscall. */ 40 | #define BIO_AOF_FSYNC 1 /* Deferred AOF fsync. */ 41 | #define BIO_NUM_OPS 2 42 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/crc64.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC64_H 2 | #define CRC64_H 3 | 4 | #include 5 | 6 | uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); 7 | 8 | #ifdef REDIS_TEST 9 | int crc64Test(int argc, char *argv[]); 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Lua License 2 | ----------- 3 | 4 | Lua is licensed under the terms of the MIT license reproduced below. 5 | This means that Lua is free software and can be used for both academic 6 | and commercial purposes at absolutely no cost. 7 | 8 | For details and rationale, see http://www.lua.org/license.html . 9 | 10 | =============================================================================== 11 | 12 | Copyright (C) 1994-2012 Lua.org, PUC-Rio. 13 | 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | =============================================================================== 33 | 34 | (end of COPYRIGHT) 35 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/README: -------------------------------------------------------------------------------- 1 | README for Lua 5.1 2 | 3 | See INSTALL for installation instructions. 4 | See HISTORY for a summary of changes since the last released version. 5 | 6 | * What is Lua? 7 | ------------ 8 | Lua is a powerful, light-weight programming language designed for extending 9 | applications. Lua is also frequently used as a general-purpose, stand-alone 10 | language. Lua is free software. 11 | 12 | For complete information, visit Lua's web site at http://www.lua.org/ . 13 | For an executive summary, see http://www.lua.org/about.html . 14 | 15 | Lua has been used in many different projects around the world. 16 | For a short list, see http://www.lua.org/uses.html . 17 | 18 | * Availability 19 | ------------ 20 | Lua is freely available for both academic and commercial purposes. 21 | See COPYRIGHT and http://www.lua.org/license.html for details. 22 | Lua can be downloaded at http://www.lua.org/download.html . 23 | 24 | * Installation 25 | ------------ 26 | Lua is implemented in pure ANSI C, and compiles unmodified in all known 27 | platforms that have an ANSI C compiler. In most Unix-like platforms, simply 28 | do "make" with a suitable target. See INSTALL for detailed instructions. 29 | 30 | * Origin 31 | ------ 32 | Lua is developed at Lua.org, a laboratory of the Department of Computer 33 | Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro 34 | in Brazil). 35 | For more information about the authors, see http://www.lua.org/authors.html . 36 | 37 | (end of README) 38 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for Lua etc 2 | 3 | TOP= .. 4 | LIB= $(TOP)/src 5 | INC= $(TOP)/src 6 | BIN= $(TOP)/src 7 | SRC= $(TOP)/src 8 | TST= $(TOP)/test 9 | 10 | CC= gcc 11 | CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) 12 | MYCFLAGS= 13 | MYLDFLAGS= -Wl,-E 14 | MYLIBS= -lm 15 | #MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses 16 | RM= rm -f 17 | 18 | default: 19 | @echo 'Please choose a target: min noparser one strict clean' 20 | 21 | min: min.c 22 | $(CC) $(CFLAGS) $@.c -L$(LIB) -llua $(MYLIBS) 23 | echo 'print"Hello there!"' | ./a.out 24 | 25 | noparser: noparser.o 26 | $(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua $(MYLIBS) 27 | $(BIN)/luac $(TST)/hello.lua 28 | -./a.out luac.out 29 | -./a.out -e'a=1' 30 | 31 | one: 32 | $(CC) $(CFLAGS) all.c $(MYLIBS) 33 | ./a.out $(TST)/hello.lua 34 | 35 | strict: 36 | -$(BIN)/lua -e 'print(a);b=2' 37 | -$(BIN)/lua -lstrict -e 'print(a)' 38 | -$(BIN)/lua -e 'function f() b=2 end f()' 39 | -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' 40 | 41 | clean: 42 | $(RM) a.out core core.* *.o luac.out 43 | 44 | .PHONY: default min noparser one strict clean 45 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/README: -------------------------------------------------------------------------------- 1 | This directory contains some useful files and code. 2 | Unlike the code in ../src, everything here is in the public domain. 3 | 4 | If any of the makes fail, you're probably not using the same libraries 5 | used to build Lua. Set MYLIBS in Makefile accordingly. 6 | 7 | all.c 8 | Full Lua interpreter in a single file. 9 | Do "make one" for a demo. 10 | 11 | lua.hpp 12 | Lua header files for C++ using 'extern "C"'. 13 | 14 | lua.ico 15 | A Lua icon for Windows (and web sites: save as favicon.ico). 16 | Drawn by hand by Markus Gritsch . 17 | 18 | lua.pc 19 | pkg-config data for Lua 20 | 21 | luavs.bat 22 | Script to build Lua under "Visual Studio .NET Command Prompt". 23 | Run it from the toplevel as etc\luavs.bat. 24 | 25 | min.c 26 | A minimal Lua interpreter. 27 | Good for learning and for starting your own. 28 | Do "make min" for a demo. 29 | 30 | noparser.c 31 | Linking with noparser.o avoids loading the parsing modules in lualib.a. 32 | Do "make noparser" for a demo. 33 | 34 | strict.lua 35 | Traps uses of undeclared global variables. 36 | Do "make strict" for a demo. 37 | 38 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/all.c: -------------------------------------------------------------------------------- 1 | /* 2 | * all.c -- Lua core, libraries and interpreter in a single file 3 | */ 4 | 5 | #define luaall_c 6 | 7 | #include "lapi.c" 8 | #include "lcode.c" 9 | #include "ldebug.c" 10 | #include "ldo.c" 11 | #include "ldump.c" 12 | #include "lfunc.c" 13 | #include "lgc.c" 14 | #include "llex.c" 15 | #include "lmem.c" 16 | #include "lobject.c" 17 | #include "lopcodes.c" 18 | #include "lparser.c" 19 | #include "lstate.c" 20 | #include "lstring.c" 21 | #include "ltable.c" 22 | #include "ltm.c" 23 | #include "lundump.c" 24 | #include "lvm.c" 25 | #include "lzio.c" 26 | 27 | #include "lauxlib.c" 28 | #include "lbaselib.c" 29 | #include "ldblib.c" 30 | #include "liolib.c" 31 | #include "linit.c" 32 | #include "lmathlib.c" 33 | #include "loadlib.c" 34 | #include "loslib.c" 35 | #include "lstrlib.c" 36 | #include "ltablib.c" 37 | 38 | #include "lua.c" 39 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/lua.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/source/hiredis/hiredis/src/deps/lua/etc/lua.ico -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/lua.pc: -------------------------------------------------------------------------------- 1 | # lua.pc -- pkg-config data for Lua 2 | 3 | # vars from install Makefile 4 | 5 | # grep '^V=' ../Makefile 6 | V= 5.1 7 | # grep '^R=' ../Makefile 8 | R= 5.1.5 9 | 10 | # grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/' 11 | prefix= /usr/local 12 | INSTALL_BIN= ${prefix}/bin 13 | INSTALL_INC= ${prefix}/include 14 | INSTALL_LIB= ${prefix}/lib 15 | INSTALL_MAN= ${prefix}/man/man1 16 | INSTALL_LMOD= ${prefix}/share/lua/${V} 17 | INSTALL_CMOD= ${prefix}/lib/lua/${V} 18 | 19 | # canonical vars 20 | exec_prefix=${prefix} 21 | libdir=${exec_prefix}/lib 22 | includedir=${prefix}/include 23 | 24 | Name: Lua 25 | Description: An Extensible Extension Language 26 | Version: ${R} 27 | Requires: 28 | Libs: -L${libdir} -llua -lm 29 | Cflags: -I${includedir} 30 | 31 | # (end of lua.pc) 32 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/luavs.bat: -------------------------------------------------------------------------------- 1 | @rem Script to build Lua under "Visual Studio .NET Command Prompt". 2 | @rem Do not run from this directory; run it from the toplevel: etc\luavs.bat . 3 | @rem It creates lua51.dll, lua51.lib, lua.exe, and luac.exe in src. 4 | @rem (contributed by David Manura and Mike Pall) 5 | 6 | @setlocal 7 | @set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE 8 | @set MYLINK=link /nologo 9 | @set MYMT=mt /nologo 10 | 11 | cd src 12 | %MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c 13 | del lua.obj luac.obj 14 | %MYLINK% /DLL /out:lua51.dll l*.obj 15 | if exist lua51.dll.manifest^ 16 | %MYMT% -manifest lua51.dll.manifest -outputresource:lua51.dll;2 17 | %MYCOMPILE% /DLUA_BUILD_AS_DLL lua.c 18 | %MYLINK% /out:lua.exe lua.obj lua51.lib 19 | if exist lua.exe.manifest^ 20 | %MYMT% -manifest lua.exe.manifest -outputresource:lua.exe 21 | %MYCOMPILE% l*.c print.c 22 | del lua.obj linit.obj lbaselib.obj ldblib.obj liolib.obj lmathlib.obj^ 23 | loslib.obj ltablib.obj lstrlib.obj loadlib.obj 24 | %MYLINK% /out:luac.exe *.obj 25 | if exist luac.exe.manifest^ 26 | %MYMT% -manifest luac.exe.manifest -outputresource:luac.exe 27 | del *.obj *.manifest 28 | cd .. 29 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/min.c: -------------------------------------------------------------------------------- 1 | /* 2 | * min.c -- a minimal Lua interpreter 3 | * loads stdin only with minimal error handling. 4 | * no interaction, and no standard library, only a "print" function. 5 | */ 6 | 7 | #include 8 | 9 | #include "lua.h" 10 | #include "lauxlib.h" 11 | 12 | static int print(lua_State *L) 13 | { 14 | int n=lua_gettop(L); 15 | int i; 16 | for (i=1; i<=n; i++) 17 | { 18 | if (i>1) printf("\t"); 19 | if (lua_isstring(L,i)) 20 | printf("%s",lua_tostring(L,i)); 21 | else if (lua_isnil(L,i)) 22 | printf("%s","nil"); 23 | else if (lua_isboolean(L,i)) 24 | printf("%s",lua_toboolean(L,i) ? "true" : "false"); 25 | else 26 | printf("%s:%p",luaL_typename(L,i),lua_topointer(L,i)); 27 | } 28 | printf("\n"); 29 | return 0; 30 | } 31 | 32 | int main(void) 33 | { 34 | lua_State *L=lua_open(); 35 | lua_register(L,"print",print); 36 | if (luaL_dofile(L,NULL)!=0) fprintf(stderr,"%s\n",lua_tostring(L,-1)); 37 | lua_close(L); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/noparser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The code below can be used to make a Lua core that does not contain the 3 | * parsing modules (lcode, llex, lparser), which represent 35% of the total core. 4 | * You'll only be able to load binary files and strings, precompiled with luac. 5 | * (Of course, you'll have to build luac with the original parsing modules!) 6 | * 7 | * To use this module, simply compile it ("make noparser" does that) and list 8 | * its object file before the Lua libraries. The linker should then not load 9 | * the parsing modules. To try it, do "make luab". 10 | * 11 | * If you also want to avoid the dump module (ldump.o), define NODUMP. 12 | * #define NODUMP 13 | */ 14 | 15 | #define LUA_CORE 16 | 17 | #include "llex.h" 18 | #include "lparser.h" 19 | #include "lzio.h" 20 | 21 | LUAI_FUNC void luaX_init (lua_State *L) { 22 | UNUSED(L); 23 | } 24 | 25 | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { 26 | UNUSED(z); 27 | UNUSED(buff); 28 | UNUSED(name); 29 | lua_pushliteral(L,"parser not loaded"); 30 | lua_error(L); 31 | return NULL; 32 | } 33 | 34 | #ifdef NODUMP 35 | #include "lundump.h" 36 | 37 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) { 38 | UNUSED(f); 39 | UNUSED(w); 40 | UNUSED(data); 41 | UNUSED(strip); 42 | #if 1 43 | UNUSED(L); 44 | return 0; 45 | #else 46 | lua_pushliteral(L,"dumper not loaded"); 47 | lua_error(L); 48 | #endif 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/etc/strict.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- strict.lua 3 | -- checks uses of undeclared global variables 4 | -- All global variables must be 'declared' through a regular assignment 5 | -- (even assigning nil will do) in a main chunk before being used 6 | -- anywhere or assigned to inside a function. 7 | -- 8 | 9 | local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget 10 | 11 | local mt = getmetatable(_G) 12 | if mt == nil then 13 | mt = {} 14 | setmetatable(_G, mt) 15 | end 16 | 17 | mt.__declared = {} 18 | 19 | local function what () 20 | local d = getinfo(3, "S") 21 | return d and d.what or "C" 22 | end 23 | 24 | mt.__newindex = function (t, n, v) 25 | if not mt.__declared[n] then 26 | local w = what() 27 | if w ~= "main" and w ~= "C" then 28 | error("assign to undeclared variable '"..n.."'", 2) 29 | end 30 | mt.__declared[n] = true 31 | end 32 | rawset(t, n, v) 33 | end 34 | 35 | mt.__index = function (t, n) 36 | if not mt.__declared[n] and what() ~= "C" then 37 | error("variable '"..n.."' is not declared", 2) 38 | end 39 | return rawget(t, n) 40 | end 41 | 42 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/fpconv.h: -------------------------------------------------------------------------------- 1 | /* Lua CJSON floating point conversion routines */ 2 | 3 | /* Buffer required to store the largest string representation of a double. 4 | * 5 | * Longest double printed with %.14g is 21 characters long: 6 | * -1.7976931348623e+308 */ 7 | # define FPCONV_G_FMT_BUFSIZE 32 8 | 9 | #ifdef USE_INTERNAL_FPCONV 10 | static inline void fpconv_init() 11 | { 12 | /* Do nothing - not required */ 13 | } 14 | #else 15 | extern void fpconv_init(); 16 | #endif 17 | 18 | extern int fpconv_g_fmt(char*, double, int); 19 | extern double fpconv_strtod(const char*, char**); 20 | 21 | /* vi:ai et sw=4 ts=4: 22 | */ 23 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Code generator for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lcode_h 8 | #define lcode_h 9 | 10 | #include "llex.h" 11 | #include "lobject.h" 12 | #include "lopcodes.h" 13 | #include "lparser.h" 14 | 15 | 16 | /* 17 | ** Marks the end of a patch list. It is an invalid value both as an absolute 18 | ** address, and as a list link (would link an element to itself). 19 | */ 20 | #define NO_JUMP (-1) 21 | 22 | 23 | /* 24 | ** grep "ORDER OPR" if you change these enums 25 | */ 26 | typedef enum BinOpr { 27 | OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, 28 | OPR_CONCAT, 29 | OPR_NE, OPR_EQ, 30 | OPR_LT, OPR_LE, OPR_GT, OPR_GE, 31 | OPR_AND, OPR_OR, 32 | OPR_NOBINOPR 33 | } BinOpr; 34 | 35 | 36 | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; 37 | 38 | 39 | #define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) 40 | 41 | #define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) 42 | 43 | #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) 44 | 45 | LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); 46 | LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); 47 | LUAI_FUNC void luaK_fixline (FuncState *fs, int line); 48 | LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); 49 | LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); 50 | LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); 51 | LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); 52 | LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); 53 | LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); 54 | LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); 55 | LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); 56 | LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); 57 | LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); 58 | LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); 59 | LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); 60 | LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); 61 | LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); 62 | LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); 63 | LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); 64 | LUAI_FUNC int luaK_jump (FuncState *fs); 65 | LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); 66 | LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); 67 | LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); 68 | LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); 69 | LUAI_FUNC int luaK_getlabel (FuncState *fs); 70 | LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); 71 | LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); 72 | LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); 73 | LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ldo.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Stack and Call structure of Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldo_h 8 | #define ldo_h 9 | 10 | 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | #include "lzio.h" 14 | 15 | 16 | #define luaD_checkstack(L,n) \ 17 | if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ 18 | luaD_growstack(L, n); \ 19 | else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); 20 | 21 | 22 | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} 23 | 24 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) 25 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) 26 | 27 | #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) 28 | #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) 29 | 30 | 31 | /* results from luaD_precall */ 32 | #define PCRLUA 0 /* initiated a call to a Lua function */ 33 | #define PCRC 1 /* did a call to a C function */ 34 | #define PCRYIELD 2 /* C funtion yielded */ 35 | 36 | 37 | /* type of protected functions, to be ran by `runprotected' */ 38 | typedef void (*Pfunc) (lua_State *L, void *ud); 39 | 40 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); 41 | LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); 42 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 43 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 44 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 45 | ptrdiff_t oldtop, ptrdiff_t ef); 46 | LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); 47 | LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); 48 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 49 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); 50 | 51 | LUAI_FUNC void luaD_throw (lua_State *L, int errcode); 52 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 53 | 54 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ldump.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** save precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #include 8 | 9 | #define ldump_c 10 | #define LUA_CORE 11 | 12 | #include "lua.h" 13 | 14 | #include "lobject.h" 15 | #include "lstate.h" 16 | #include "lundump.h" 17 | 18 | typedef struct { 19 | lua_State* L; 20 | lua_Writer writer; 21 | void* data; 22 | int strip; 23 | int status; 24 | } DumpState; 25 | 26 | #define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) 27 | #define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) 28 | 29 | static void DumpBlock(const void* b, size_t size, DumpState* D) 30 | { 31 | if (D->status==0) 32 | { 33 | lua_unlock(D->L); 34 | D->status=(*D->writer)(D->L,b,size,D->data); 35 | lua_lock(D->L); 36 | } 37 | } 38 | 39 | static void DumpChar(int y, DumpState* D) 40 | { 41 | char x=(char)y; 42 | DumpVar(x,D); 43 | } 44 | 45 | static void DumpInt(int x, DumpState* D) 46 | { 47 | DumpVar(x,D); 48 | } 49 | 50 | static void DumpNumber(lua_Number x, DumpState* D) 51 | { 52 | DumpVar(x,D); 53 | } 54 | 55 | static void DumpVector(const void* b, int n, size_t size, DumpState* D) 56 | { 57 | DumpInt(n,D); 58 | DumpMem(b,n,size,D); 59 | } 60 | 61 | static void DumpString(const TString* s, DumpState* D) 62 | { 63 | if (s==NULL || getstr(s)==NULL) 64 | { 65 | size_t size=0; 66 | DumpVar(size,D); 67 | } 68 | else 69 | { 70 | size_t size=s->tsv.len+1; /* include trailing '\0' */ 71 | DumpVar(size,D); 72 | DumpBlock(getstr(s),size,D); 73 | } 74 | } 75 | 76 | #define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) 77 | 78 | static void DumpFunction(const Proto* f, const TString* p, DumpState* D); 79 | 80 | static void DumpConstants(const Proto* f, DumpState* D) 81 | { 82 | int i,n=f->sizek; 83 | DumpInt(n,D); 84 | for (i=0; ik[i]; 87 | DumpChar(ttype(o),D); 88 | switch (ttype(o)) 89 | { 90 | case LUA_TNIL: 91 | break; 92 | case LUA_TBOOLEAN: 93 | DumpChar(bvalue(o),D); 94 | break; 95 | case LUA_TNUMBER: 96 | DumpNumber(nvalue(o),D); 97 | break; 98 | case LUA_TSTRING: 99 | DumpString(rawtsvalue(o),D); 100 | break; 101 | default: 102 | lua_assert(0); /* cannot happen */ 103 | break; 104 | } 105 | } 106 | n=f->sizep; 107 | DumpInt(n,D); 108 | for (i=0; ip[i],f->source,D); 109 | } 110 | 111 | static void DumpDebug(const Proto* f, DumpState* D) 112 | { 113 | int i,n; 114 | n= (D->strip) ? 0 : f->sizelineinfo; 115 | DumpVector(f->lineinfo,n,sizeof(int),D); 116 | n= (D->strip) ? 0 : f->sizelocvars; 117 | DumpInt(n,D); 118 | for (i=0; ilocvars[i].varname,D); 121 | DumpInt(f->locvars[i].startpc,D); 122 | DumpInt(f->locvars[i].endpc,D); 123 | } 124 | n= (D->strip) ? 0 : f->sizeupvalues; 125 | DumpInt(n,D); 126 | for (i=0; iupvalues[i],D); 127 | } 128 | 129 | static void DumpFunction(const Proto* f, const TString* p, DumpState* D) 130 | { 131 | DumpString((f->source==p || D->strip) ? NULL : f->source,D); 132 | DumpInt(f->linedefined,D); 133 | DumpInt(f->lastlinedefined,D); 134 | DumpChar(f->nups,D); 135 | DumpChar(f->numparams,D); 136 | DumpChar(f->is_vararg,D); 137 | DumpChar(f->maxstacksize,D); 138 | DumpCode(f,D); 139 | DumpConstants(f,D); 140 | DumpDebug(f,D); 141 | } 142 | 143 | static void DumpHeader(DumpState* D) 144 | { 145 | char h[LUAC_HEADERSIZE]; 146 | luaU_header(h); 147 | DumpBlock(h,LUAC_HEADERSIZE,D); 148 | } 149 | 150 | /* 151 | ** dump Lua function as precompiled chunk 152 | */ 153 | int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) 154 | { 155 | DumpState D; 156 | D.L=L; 157 | D.writer=w; 158 | D.data=data; 159 | D.strip=strip; 160 | D.status=0; 161 | DumpHeader(&D); 162 | DumpFunction(f,NULL,&D); 163 | return D.status; 164 | } 165 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lgc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Garbage Collector 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lgc_h 8 | #define lgc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | ** Possible states of the Garbage Collector 16 | */ 17 | #define GCSpause 0 18 | #define GCSpropagate 1 19 | #define GCSsweepstring 2 20 | #define GCSsweep 3 21 | #define GCSfinalize 4 22 | 23 | 24 | /* 25 | ** some userful bit tricks 26 | */ 27 | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) 28 | #define setbits(x,m) ((x) |= (m)) 29 | #define testbits(x,m) ((x) & (m)) 30 | #define bitmask(b) (1<<(b)) 31 | #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) 32 | #define l_setbit(x,b) setbits(x, bitmask(b)) 33 | #define resetbit(x,b) resetbits(x, bitmask(b)) 34 | #define testbit(x,b) testbits(x, bitmask(b)) 35 | #define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) 36 | #define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) 37 | #define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) 38 | 39 | 40 | 41 | /* 42 | ** Layout for bit use in `marked' field: 43 | ** bit 0 - object is white (type 0) 44 | ** bit 1 - object is white (type 1) 45 | ** bit 2 - object is black 46 | ** bit 3 - for userdata: has been finalized 47 | ** bit 3 - for tables: has weak keys 48 | ** bit 4 - for tables: has weak values 49 | ** bit 5 - object is fixed (should not be collected) 50 | ** bit 6 - object is "super" fixed (only the main thread) 51 | */ 52 | 53 | 54 | #define WHITE0BIT 0 55 | #define WHITE1BIT 1 56 | #define BLACKBIT 2 57 | #define FINALIZEDBIT 3 58 | #define KEYWEAKBIT 3 59 | #define VALUEWEAKBIT 4 60 | #define FIXEDBIT 5 61 | #define SFIXEDBIT 6 62 | #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) 63 | 64 | 65 | #define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) 66 | #define isblack(x) testbit((x)->gch.marked, BLACKBIT) 67 | #define isgray(x) (!isblack(x) && !iswhite(x)) 68 | 69 | #define otherwhite(g) (g->currentwhite ^ WHITEBITS) 70 | #define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) 71 | 72 | #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) 73 | #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) 74 | 75 | #define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) 76 | 77 | #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) 78 | 79 | 80 | #define luaC_checkGC(L) { \ 81 | condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ 82 | if (G(L)->totalbytes >= G(L)->GCthreshold) \ 83 | luaC_step(L); } 84 | 85 | 86 | #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ 87 | luaC_barrierf(L,obj2gco(p),gcvalue(v)); } 88 | 89 | #define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ 90 | luaC_barrierback(L,t); } 91 | 92 | #define luaC_objbarrier(L,p,o) \ 93 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ 94 | luaC_barrierf(L,obj2gco(p),obj2gco(o)); } 95 | 96 | #define luaC_objbarriert(L,t,o) \ 97 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } 98 | 99 | LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); 100 | LUAI_FUNC void luaC_callGCTM (lua_State *L); 101 | LUAI_FUNC void luaC_freeall (lua_State *L); 102 | LUAI_FUNC void luaC_step (lua_State *L); 103 | LUAI_FUNC void luaC_fullgc (lua_State *L); 104 | LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); 105 | LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); 106 | LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); 107 | LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); 108 | 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/linit.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Initialization of libraries for lua.c 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #define linit_c 9 | #define LUA_LIB 10 | 11 | #include "lua.h" 12 | 13 | #include "lualib.h" 14 | #include "lauxlib.h" 15 | 16 | 17 | static const luaL_Reg lualibs[] = { 18 | {"", luaopen_base}, 19 | {LUA_LOADLIBNAME, luaopen_package}, 20 | {LUA_TABLIBNAME, luaopen_table}, 21 | {LUA_IOLIBNAME, luaopen_io}, 22 | {LUA_OSLIBNAME, luaopen_os}, 23 | {LUA_STRLIBNAME, luaopen_string}, 24 | {LUA_MATHLIBNAME, luaopen_math}, 25 | {LUA_DBLIBNAME, luaopen_debug}, 26 | {NULL, NULL} 27 | }; 28 | 29 | 30 | LUALIB_API void luaL_openlibs (lua_State *L) { 31 | const luaL_Reg *lib = lualibs; 32 | for (; lib->func; lib++) { 33 | lua_pushcfunction(L, lib->func); 34 | lua_pushstring(L, lib->name); 35 | lua_call(L, 1, 0); 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/llex.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lexical Analyzer 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llex_h 8 | #define llex_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | 14 | #define FIRST_RESERVED 257 15 | 16 | /* maximum length of a reserved word */ 17 | #define TOKEN_LEN (sizeof("function")/sizeof(char)) 18 | 19 | 20 | /* 21 | * WARNING: if you change the order of this enumeration, 22 | * grep "ORDER RESERVED" 23 | */ 24 | enum RESERVED { 25 | /* terminal symbols denoted by reserved words */ 26 | TK_AND = FIRST_RESERVED, TK_BREAK, 27 | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, 28 | TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, 29 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, 30 | /* other terminal symbols */ 31 | TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, 32 | TK_NAME, TK_STRING, TK_EOS 33 | }; 34 | 35 | /* number of reserved words */ 36 | #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) 37 | 38 | 39 | /* array with token `names' */ 40 | LUAI_DATA const char *const luaX_tokens []; 41 | 42 | 43 | typedef union { 44 | lua_Number r; 45 | TString *ts; 46 | } SemInfo; /* semantics information */ 47 | 48 | 49 | typedef struct Token { 50 | int token; 51 | SemInfo seminfo; 52 | } Token; 53 | 54 | 55 | typedef struct LexState { 56 | int current; /* current character (charint) */ 57 | int linenumber; /* input line counter */ 58 | int lastline; /* line of last token `consumed' */ 59 | Token t; /* current token */ 60 | Token lookahead; /* look ahead token */ 61 | struct FuncState *fs; /* `FuncState' is private to the parser */ 62 | struct lua_State *L; 63 | ZIO *z; /* input stream */ 64 | Mbuffer *buff; /* buffer for tokens */ 65 | TString *source; /* current source name */ 66 | char decpoint; /* locale decimal point */ 67 | } LexState; 68 | 69 | 70 | LUAI_FUNC void luaX_init (lua_State *L); 71 | LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, 72 | TString *source); 73 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); 74 | LUAI_FUNC void luaX_next (LexState *ls); 75 | LUAI_FUNC void luaX_lookahead (LexState *ls); 76 | LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); 77 | LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); 78 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/llimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Limits, basic types, and some other `installation-dependent' definitions 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llimits_h 8 | #define llimits_h 9 | 10 | 11 | #include 12 | #include 13 | 14 | 15 | #include "lua.h" 16 | 17 | 18 | typedef LUAI_UINT32 lu_int32; 19 | 20 | typedef LUAI_UMEM lu_mem; 21 | 22 | typedef LUAI_MEM l_mem; 23 | 24 | 25 | 26 | /* chars used as small naturals (so that `char' is reserved for characters) */ 27 | typedef unsigned char lu_byte; 28 | 29 | 30 | #define MAX_SIZET ((size_t)(~(size_t)0)-2) 31 | 32 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) 33 | 34 | 35 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ 36 | 37 | /* 38 | ** conversion of pointer to integer 39 | ** this is for hashing only; there is no problem if the integer 40 | ** cannot hold the whole pointer value 41 | */ 42 | #define IntPoint(p) ((unsigned int)(lu_mem)(p)) 43 | 44 | 45 | 46 | /* type to ensure maximum alignment */ 47 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; 48 | 49 | 50 | /* result of a `usual argument conversion' over lua_Number */ 51 | typedef LUAI_UACNUMBER l_uacNumber; 52 | 53 | 54 | /* internal assertions for in-house debugging */ 55 | #ifdef lua_assert 56 | 57 | #define check_exp(c,e) (lua_assert(c), (e)) 58 | #define api_check(l,e) lua_assert(e) 59 | 60 | #else 61 | 62 | #define lua_assert(c) ((void)0) 63 | #define check_exp(c,e) (e) 64 | #define api_check luai_apicheck 65 | 66 | #endif 67 | 68 | 69 | #ifndef UNUSED 70 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ 71 | #endif 72 | 73 | 74 | #ifndef cast 75 | #define cast(t, exp) ((t)(exp)) 76 | #endif 77 | 78 | #define cast_byte(i) cast(lu_byte, (i)) 79 | #define cast_num(i) cast(lua_Number, (i)) 80 | #define cast_int(i) cast(int, (i)) 81 | 82 | 83 | 84 | /* 85 | ** type for virtual-machine instructions 86 | ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) 87 | */ 88 | typedef lu_int32 Instruction; 89 | 90 | 91 | 92 | /* maximum stack for a Lua function */ 93 | #define MAXSTACK 250 94 | 95 | 96 | 97 | /* minimum size for the string table (must be power of 2) */ 98 | #ifndef MINSTRTABSIZE 99 | #define MINSTRTABSIZE 32 100 | #endif 101 | 102 | 103 | /* minimum size for string buffer */ 104 | #ifndef LUA_MINBUFFER 105 | #define LUA_MINBUFFER 32 106 | #endif 107 | 108 | 109 | #ifndef lua_lock 110 | #define lua_lock(L) ((void) 0) 111 | #define lua_unlock(L) ((void) 0) 112 | #endif 113 | 114 | #ifndef luai_threadyield 115 | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} 116 | #endif 117 | 118 | 119 | /* 120 | ** macro to control inclusion of some hard tests on stack reallocation 121 | */ 122 | #ifndef HARDSTACKTESTS 123 | #define condhardstacktests(x) ((void)0) 124 | #else 125 | #define condhardstacktests(x) x 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lmem.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #include 9 | 10 | #define lmem_c 11 | #define LUA_CORE 12 | 13 | #include "lua.h" 14 | 15 | #include "ldebug.h" 16 | #include "ldo.h" 17 | #include "lmem.h" 18 | #include "lobject.h" 19 | #include "lstate.h" 20 | 21 | 22 | 23 | /* 24 | ** About the realloc function: 25 | ** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); 26 | ** (`osize' is the old size, `nsize' is the new size) 27 | ** 28 | ** Lua ensures that (ptr == NULL) iff (osize == 0). 29 | ** 30 | ** * frealloc(ud, NULL, 0, x) creates a new block of size `x' 31 | ** 32 | ** * frealloc(ud, p, x, 0) frees the block `p' 33 | ** (in this specific case, frealloc must return NULL). 34 | ** particularly, frealloc(ud, NULL, 0, 0) does nothing 35 | ** (which is equivalent to free(NULL) in ANSI C) 36 | ** 37 | ** frealloc returns NULL if it cannot create or reallocate the area 38 | ** (any reallocation to an equal or smaller size cannot fail!) 39 | */ 40 | 41 | 42 | 43 | #define MINSIZEARRAY 4 44 | 45 | 46 | void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, 47 | int limit, const char *errormsg) { 48 | void *newblock; 49 | int newsize; 50 | if (*size >= limit/2) { /* cannot double it? */ 51 | if (*size >= limit) /* cannot grow even a little? */ 52 | luaG_runerror(L, errormsg); 53 | newsize = limit; /* still have at least one free place */ 54 | } 55 | else { 56 | newsize = (*size)*2; 57 | if (newsize < MINSIZEARRAY) 58 | newsize = MINSIZEARRAY; /* minimum size */ 59 | } 60 | newblock = luaM_reallocv(L, block, *size, newsize, size_elems); 61 | *size = newsize; /* update only when everything else is OK */ 62 | return newblock; 63 | } 64 | 65 | 66 | void *luaM_toobig (lua_State *L) { 67 | luaG_runerror(L, "memory allocation error: block too big"); 68 | return NULL; /* to avoid warnings */ 69 | } 70 | 71 | 72 | 73 | /* 74 | ** generic allocation routine. 75 | */ 76 | void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { 77 | global_State *g = G(L); 78 | lua_assert((osize == 0) == (block == NULL)); 79 | block = (*g->frealloc)(g->ud, block, osize, nsize); 80 | if (block == NULL && nsize > 0) 81 | luaD_throw(L, LUA_ERRMEM); 82 | lua_assert((nsize == 0) == (block == NULL)); 83 | g->totalbytes = (g->totalbytes - osize) + nsize; 84 | return block; 85 | } 86 | 87 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lopcodes.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** See Copyright Notice in lua.h 4 | */ 5 | 6 | 7 | #define lopcodes_c 8 | #define LUA_CORE 9 | 10 | 11 | #include "lopcodes.h" 12 | 13 | 14 | /* ORDER OP */ 15 | 16 | const char *const luaP_opnames[NUM_OPCODES+1] = { 17 | "MOVE", 18 | "LOADK", 19 | "LOADBOOL", 20 | "LOADNIL", 21 | "GETUPVAL", 22 | "GETGLOBAL", 23 | "GETTABLE", 24 | "SETGLOBAL", 25 | "SETUPVAL", 26 | "SETTABLE", 27 | "NEWTABLE", 28 | "SELF", 29 | "ADD", 30 | "SUB", 31 | "MUL", 32 | "DIV", 33 | "MOD", 34 | "POW", 35 | "UNM", 36 | "NOT", 37 | "LEN", 38 | "CONCAT", 39 | "JMP", 40 | "EQ", 41 | "LT", 42 | "LE", 43 | "TEST", 44 | "TESTSET", 45 | "CALL", 46 | "TAILCALL", 47 | "RETURN", 48 | "FORLOOP", 49 | "FORPREP", 50 | "TFORLOOP", 51 | "SETLIST", 52 | "CLOSE", 53 | "CLOSURE", 54 | "VARARG", 55 | NULL 56 | }; 57 | 58 | 59 | #define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) 60 | 61 | const lu_byte luaP_opmodes[NUM_OPCODES] = { 62 | /* T A B C mode opcode */ 63 | opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ 64 | ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ 65 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ 66 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ 67 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ 68 | ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ 69 | ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ 70 | ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ 71 | ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ 72 | ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ 73 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ 74 | ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ 75 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ 76 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ 77 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ 78 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ 79 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ 80 | ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ 81 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ 82 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ 83 | ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ 84 | ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ 85 | ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ 86 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ 87 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ 88 | ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ 89 | ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ 90 | ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ 91 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ 92 | ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ 93 | ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ 94 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ 95 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ 96 | ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ 97 | ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ 98 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ 99 | ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ 100 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ 101 | }; 102 | 103 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua Parser 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lparser_h 8 | #define lparser_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* 16 | ** Expression descriptor 17 | */ 18 | 19 | typedef enum { 20 | VVOID, /* no value */ 21 | VNIL, 22 | VTRUE, 23 | VFALSE, 24 | VK, /* info = index of constant in `k' */ 25 | VKNUM, /* nval = numerical value */ 26 | VLOCAL, /* info = local register */ 27 | VUPVAL, /* info = index of upvalue in `upvalues' */ 28 | VGLOBAL, /* info = index of table; aux = index of global name in `k' */ 29 | VINDEXED, /* info = table register; aux = index register (or `k') */ 30 | VJMP, /* info = instruction pc */ 31 | VRELOCABLE, /* info = instruction pc */ 32 | VNONRELOC, /* info = result register */ 33 | VCALL, /* info = instruction pc */ 34 | VVARARG /* info = instruction pc */ 35 | } expkind; 36 | 37 | typedef struct expdesc { 38 | expkind k; 39 | union { 40 | struct { int info, aux; } s; 41 | lua_Number nval; 42 | } u; 43 | int t; /* patch list of `exit when true' */ 44 | int f; /* patch list of `exit when false' */ 45 | } expdesc; 46 | 47 | 48 | typedef struct upvaldesc { 49 | lu_byte k; 50 | lu_byte info; 51 | } upvaldesc; 52 | 53 | 54 | struct BlockCnt; /* defined in lparser.c */ 55 | 56 | 57 | /* state needed to generate code for a given function */ 58 | typedef struct FuncState { 59 | Proto *f; /* current function header */ 60 | Table *h; /* table to find (and reuse) elements in `k' */ 61 | struct FuncState *prev; /* enclosing function */ 62 | struct LexState *ls; /* lexical state */ 63 | struct lua_State *L; /* copy of the Lua state */ 64 | struct BlockCnt *bl; /* chain of current blocks */ 65 | int pc; /* next position to code (equivalent to `ncode') */ 66 | int lasttarget; /* `pc' of last `jump target' */ 67 | int jpc; /* list of pending jumps to `pc' */ 68 | int freereg; /* first free register */ 69 | int nk; /* number of elements in `k' */ 70 | int np; /* number of elements in `p' */ 71 | short nlocvars; /* number of elements in `locvars' */ 72 | lu_byte nactvar; /* number of active local variables */ 73 | upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ 74 | unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ 75 | } FuncState; 76 | 77 | 78 | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, 79 | const char *name); 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lstring.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keeps all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #include 9 | 10 | #define lstring_c 11 | #define LUA_CORE 12 | 13 | #include "lua.h" 14 | 15 | #include "lmem.h" 16 | #include "lobject.h" 17 | #include "lstate.h" 18 | #include "lstring.h" 19 | 20 | 21 | 22 | void luaS_resize (lua_State *L, int newsize) { 23 | GCObject **newhash; 24 | stringtable *tb; 25 | int i; 26 | if (G(L)->gcstate == GCSsweepstring) 27 | return; /* cannot resize during GC traverse */ 28 | newhash = luaM_newvector(L, newsize, GCObject *); 29 | tb = &G(L)->strt; 30 | for (i=0; isize; i++) { 33 | GCObject *p = tb->hash[i]; 34 | while (p) { /* for each node in the list */ 35 | GCObject *next = p->gch.next; /* save next */ 36 | unsigned int h = gco2ts(p)->hash; 37 | int h1 = lmod(h, newsize); /* new position */ 38 | lua_assert(cast_int(h%newsize) == lmod(h, newsize)); 39 | p->gch.next = newhash[h1]; /* chain it */ 40 | newhash[h1] = p; 41 | p = next; 42 | } 43 | } 44 | luaM_freearray(L, tb->hash, tb->size, TString *); 45 | tb->size = newsize; 46 | tb->hash = newhash; 47 | } 48 | 49 | 50 | static TString *newlstr (lua_State *L, const char *str, size_t l, 51 | unsigned int h) { 52 | TString *ts; 53 | stringtable *tb; 54 | if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) 55 | luaM_toobig(L); 56 | ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); 57 | ts->tsv.len = l; 58 | ts->tsv.hash = h; 59 | ts->tsv.marked = luaC_white(G(L)); 60 | ts->tsv.tt = LUA_TSTRING; 61 | ts->tsv.reserved = 0; 62 | memcpy(ts+1, str, l*sizeof(char)); 63 | ((char *)(ts+1))[l] = '\0'; /* ending 0 */ 64 | tb = &G(L)->strt; 65 | h = lmod(h, tb->size); 66 | ts->tsv.next = tb->hash[h]; /* chain new entry */ 67 | tb->hash[h] = obj2gco(ts); 68 | tb->nuse++; 69 | if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) 70 | luaS_resize(L, tb->size*2); /* too crowded */ 71 | return ts; 72 | } 73 | 74 | 75 | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { 76 | GCObject *o; 77 | unsigned int h = cast(unsigned int, l); /* seed */ 78 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ 79 | size_t l1; 80 | for (l1=l; l1>=step; l1-=step) /* compute hash */ 81 | h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); 82 | for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; 83 | o != NULL; 84 | o = o->gch.next) { 85 | TString *ts = rawgco2ts(o); 86 | if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { 87 | /* string may be dead */ 88 | if (isdead(G(L), o)) changewhite(o); 89 | return ts; 90 | } 91 | } 92 | return newlstr(L, str, l, h); /* not found */ 93 | } 94 | 95 | 96 | Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { 97 | Udata *u; 98 | if (s > MAX_SIZET - sizeof(Udata)) 99 | luaM_toobig(L); 100 | u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); 101 | u->uv.marked = luaC_white(G(L)); /* is not finalized */ 102 | u->uv.tt = LUA_TUSERDATA; 103 | u->uv.len = s; 104 | u->uv.metatable = NULL; 105 | u->uv.env = e; 106 | /* chain it on udata list (after main thread) */ 107 | u->uv.next = G(L)->mainthread->next; 108 | G(L)->mainthread->next = obj2gco(u); 109 | return u; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ltm.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #include 9 | 10 | #define ltm_c 11 | #define LUA_CORE 12 | 13 | #include "lua.h" 14 | 15 | #include "lobject.h" 16 | #include "lstate.h" 17 | #include "lstring.h" 18 | #include "ltable.h" 19 | #include "ltm.h" 20 | 21 | 22 | 23 | const char *const luaT_typenames[] = { 24 | "nil", "boolean", "userdata", "number", 25 | "string", "table", "function", "userdata", "thread", 26 | "proto", "upval" 27 | }; 28 | 29 | 30 | void luaT_init (lua_State *L) { 31 | static const char *const luaT_eventname[] = { /* ORDER TM */ 32 | "__index", "__newindex", 33 | "__gc", "__mode", "__eq", 34 | "__add", "__sub", "__mul", "__div", "__mod", 35 | "__pow", "__unm", "__len", "__lt", "__le", 36 | "__concat", "__call" 37 | }; 38 | int i; 39 | for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); 41 | luaS_fix(G(L)->tmname[i]); /* never collect these names */ 42 | } 43 | } 44 | 45 | 46 | /* 47 | ** function to be used with macro "fasttm": optimized for absence of 48 | ** tag methods 49 | */ 50 | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { 51 | const TValue *tm = luaH_getstr(events, ename); 52 | lua_assert(event <= TM_EQ); 53 | if (ttisnil(tm)) { /* no tag method? */ 54 | events->flags |= cast_byte(1u<metatable; 66 | break; 67 | case LUA_TUSERDATA: 68 | mt = uvalue(o)->metatable; 69 | break; 70 | default: 71 | mt = G(L)->mt[ttype(o)]; 72 | } 73 | return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | 47 | 48 | #ifndef lua_assert 49 | #define lua_assert(x) ((void)0) 50 | #endif 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lzio.c: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** a generic input stream interface 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #include 9 | 10 | #define lzio_c 11 | #define LUA_CORE 12 | 13 | #include "lua.h" 14 | 15 | #include "llimits.h" 16 | #include "lmem.h" 17 | #include "lstate.h" 18 | #include "lzio.h" 19 | 20 | 21 | int luaZ_fill (ZIO *z) { 22 | size_t size; 23 | lua_State *L = z->L; 24 | const char *buff; 25 | lua_unlock(L); 26 | buff = z->reader(L, z->data, &size); 27 | lua_lock(L); 28 | if (buff == NULL || size == 0) return EOZ; 29 | z->n = size - 1; 30 | z->p = buff; 31 | return char2int(*(z->p++)); 32 | } 33 | 34 | 35 | int luaZ_lookahead (ZIO *z) { 36 | if (z->n == 0) { 37 | if (luaZ_fill(z) == EOZ) 38 | return EOZ; 39 | else { 40 | z->n++; /* luaZ_fill removed first byte; put back it */ 41 | z->p--; 42 | } 43 | } 44 | return char2int(*z->p); 45 | } 46 | 47 | 48 | void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { 49 | z->L = L; 50 | z->reader = reader; 51 | z->data = data; 52 | z->n = 0; 53 | z->p = NULL; 54 | } 55 | 56 | 57 | /* --------------------------------------------------------------- read --- */ 58 | size_t luaZ_read (ZIO *z, void *b, size_t n) { 59 | while (n) { 60 | size_t m; 61 | if (luaZ_lookahead(z) == EOZ) 62 | return n; /* return number of missing bytes */ 63 | m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ 64 | memcpy(b, z->p, m); 65 | z->n -= m; 66 | z->p += m; 67 | b = (char *)b + m; 68 | n -= m; 69 | } 70 | return 0; 71 | } 72 | 73 | /* ------------------------------------------------------------------------ */ 74 | char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { 75 | if (n > buff->buffsize) { 76 | if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; 77 | luaZ_resizebuffer(L, buff, n); 78 | } 79 | return buff->buffer; 80 | } 81 | 82 | 83 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/src/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define char2int(c) cast(int, cast(unsigned char, (c))) 21 | 22 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) 23 | 24 | typedef struct Mbuffer { 25 | char *buffer; 26 | size_t n; 27 | size_t buffsize; 28 | } Mbuffer; 29 | 30 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 31 | 32 | #define luaZ_buffer(buff) ((buff)->buffer) 33 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 34 | #define luaZ_bufflen(buff) ((buff)->n) 35 | 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ 41 | (buff)->buffsize = size) 42 | 43 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 44 | 45 | 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; 60 | void* data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | }; 63 | 64 | 65 | LUAI_FUNC int luaZ_fill (ZIO *z); 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/test/README: -------------------------------------------------------------------------------- 1 | These are simple tests for Lua. Some of them contain useful code. 2 | They are meant to be run to make sure Lua is built correctly and also 3 | to be read, to see how Lua programs look. 4 | 5 | Here is a one-line summary of each program: 6 | 7 | bisect.lua bisection method for solving non-linear equations 8 | cf.lua temperature conversion table (celsius to farenheit) 9 | echo.lua echo command line arguments 10 | env.lua environment variables as automatic global variables 11 | factorial.lua factorial without recursion 12 | fib.lua fibonacci function with cache 13 | fibfor.lua fibonacci numbers with coroutines and generators 14 | globals.lua report global variable usage 15 | hello.lua the first program in every language 16 | life.lua Conway's Game of Life 17 | luac.lua bare-bones luac 18 | printf.lua an implementation of printf 19 | readonly.lua make global variables readonly 20 | sieve.lua the sieve of of Eratosthenes programmed with coroutines 21 | sort.lua two implementations of a sort function 22 | table.lua make table, grouping all data for the same item 23 | trace-calls.lua trace calls 24 | trace-globals.lua trace assigments to global variables 25 | xd.lua hex dump 26 | 27 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/test/bisect.lua: -------------------------------------------------------------------------------- 1 | -- bisection method for solving non-linear equations 2 | 3 | delta=1e-6 -- tolerance 4 | 5 | function bisect(f,a,b,fa,fb) 6 | local c=(a+b)/2 7 | io.write(n," c=",c," a=",a," b=",b,"\n") 8 | if c==a or c==b or math.abs(a-b)y end) 58 | show("after reverse selection sort",x) 59 | qsort(x,1,n,function (x,y) return x>> ",string.rep(" ",level)) 9 | if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end 10 | t=debug.getinfo(2) 11 | if event=="call" then 12 | level=level+1 13 | else 14 | level=level-1 if level<0 then level=0 end 15 | end 16 | if t.what=="main" then 17 | if event=="call" then 18 | io.write("begin ",t.short_src) 19 | else 20 | io.write("end ",t.short_src) 21 | end 22 | elseif t.what=="Lua" then 23 | -- table.foreach(t,print) 24 | io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">") 25 | else 26 | io.write(event," ",t.name or "(C)"," [",t.what,"] ") 27 | end 28 | io.write("\n") 29 | end 30 | 31 | debug.sethook(hook,"cr") 32 | level=0 33 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/test/trace-globals.lua: -------------------------------------------------------------------------------- 1 | -- trace assigments to global variables 2 | 3 | do 4 | -- a tostring that quotes strings. note the use of the original tostring. 5 | local _tostring=tostring 6 | local tostring=function(a) 7 | if type(a)=="string" then 8 | return string.format("%q",a) 9 | else 10 | return _tostring(a) 11 | end 12 | end 13 | 14 | local log=function (name,old,new) 15 | local t=debug.getinfo(3,"Sl") 16 | local line=t.currentline 17 | io.write(t.short_src) 18 | if line>=0 then io.write(":",line) end 19 | io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n") 20 | end 21 | 22 | local g={} 23 | local set=function (t,name,value) 24 | log(name,g[name],value) 25 | g[name]=value 26 | end 27 | setmetatable(getfenv(),{__index=g,__newindex=set}) 28 | end 29 | 30 | -- an example 31 | 32 | a=1 33 | b=2 34 | a=10 35 | b=20 36 | b=nil 37 | b=200 38 | print(a,b,c) 39 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/deps/lua/test/xd.lua: -------------------------------------------------------------------------------- 1 | -- hex dump 2 | -- usage: lua xd.lua < file 3 | 4 | local offset=0 5 | while true do 6 | local s=io.read(16) 7 | if s==nil then return end 8 | io.write(string.format("%08X ",offset)) 9 | string.gsub(s,"(.)", 10 | function (c) io.write(string.format("%02X ",string.byte(c))) end) 11 | io.write(string.rep(" ",3*(16-string.len(s)))) 12 | io.write(" ",string.gsub(s,"%c","."),"\n") 13 | offset=offset+16 14 | end 15 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/endianconv.h: -------------------------------------------------------------------------------- 1 | /* See endianconv.c top comments for more information 2 | * 3 | * ---------------------------------------------------------------------------- 4 | * 5 | * Copyright (c) 2011-2012, Salvatore Sanfilippo 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * * Neither the name of Redis nor the names of its contributors may be used 17 | * to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef __ENDIANCONV_H 34 | #define __ENDIANCONV_H 35 | 36 | #include "config.h" 37 | #include 38 | 39 | void memrev16(void *p); 40 | void memrev32(void *p); 41 | void memrev64(void *p); 42 | uint16_t intrev16(uint16_t v); 43 | uint32_t intrev32(uint32_t v); 44 | uint64_t intrev64(uint64_t v); 45 | 46 | /* variants of the function doing the actual convertion only if the target 47 | * host is big endian */ 48 | #if (BYTE_ORDER == LITTLE_ENDIAN) 49 | #define memrev16ifbe(p) 50 | #define memrev32ifbe(p) 51 | #define memrev64ifbe(p) 52 | #define intrev16ifbe(v) (v) 53 | #define intrev32ifbe(v) (v) 54 | #define intrev64ifbe(v) (v) 55 | #else 56 | #define memrev16ifbe(p) memrev16(p) 57 | #define memrev32ifbe(p) memrev32(p) 58 | #define memrev64ifbe(p) memrev64(p) 59 | #define intrev16ifbe(v) intrev16(v) 60 | #define intrev32ifbe(v) intrev32(v) 61 | #define intrev64ifbe(v) intrev64(v) 62 | #endif 63 | 64 | /* The functions htonu64() and ntohu64() convert the specified value to 65 | * network byte ordering and back. In big endian systems they are no-ops. */ 66 | #if (BYTE_ORDER == BIG_ENDIAN) 67 | #define htonu64(v) (v) 68 | #define ntohu64(v) (v) 69 | #else 70 | #define htonu64(v) intrev64(v) 71 | #define ntohu64(v) intrev64(v) 72 | #endif 73 | 74 | #ifdef REDIS_TEST 75 | int endianconvTest(int argc, char *argv[]); 76 | #endif 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/fmacros.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef _REDIS_FMACRO_H 31 | #define _REDIS_FMACRO_H 32 | 33 | #define _BSD_SOURCE 34 | 35 | #if defined(__linux__) 36 | #define _GNU_SOURCE 37 | #define _DEFAULT_SOURCE 38 | #endif 39 | 40 | #if defined(_AIX) 41 | #define _ALL_SOURCE 42 | #endif 43 | 44 | #if defined(__linux__) || defined(__OpenBSD__) 45 | #define _XOPEN_SOURCE 700 46 | /* 47 | * On NetBSD, _XOPEN_SOURCE undefines _NETBSD_SOURCE and 48 | * thus hides inet_aton etc. 49 | */ 50 | #elif !defined(__NetBSD__) 51 | #define _XOPEN_SOURCE 52 | #endif 53 | 54 | #if defined(__sun) 55 | #define _POSIX_C_SOURCE 199506L 56 | #endif 57 | 58 | #define _LARGEFILE_SOURCE 59 | #define _FILE_OFFSET_BITS 64 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/geo.h: -------------------------------------------------------------------------------- 1 | #ifndef __GEO_H__ 2 | #define __GEO_H__ 3 | 4 | #include "server.h" 5 | 6 | /* Structures used inside geo.c in order to represent points and array of 7 | * points on the earth. */ 8 | typedef struct geoPoint { 9 | double longitude; 10 | double latitude; 11 | double dist; 12 | double score; 13 | char *member; 14 | } geoPoint; 15 | 16 | typedef struct geoArray { 17 | struct geoPoint *array; 18 | size_t buckets; 19 | size_t used; 20 | } geoArray; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/intset.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Pieter Noordhuis 3 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef __INTSET_H 32 | #define __INTSET_H 33 | #include 34 | 35 | typedef struct intset { 36 | uint32_t encoding; 37 | uint32_t length; 38 | int8_t contents[]; 39 | } intset; 40 | 41 | intset *intsetNew(void); 42 | intset *intsetAdd(intset *is, int64_t value, uint8_t *success); 43 | intset *intsetRemove(intset *is, int64_t value, int *success); 44 | uint8_t intsetFind(intset *is, int64_t value); 45 | int64_t intsetRandom(intset *is); 46 | uint8_t intsetGet(intset *is, uint32_t pos, int64_t *value); 47 | uint32_t intsetLen(intset *is); 48 | size_t intsetBlobLen(intset *is); 49 | 50 | #ifdef REDIS_TEST 51 | int intsetTest(int argc, char *argv[]); 52 | #endif 53 | 54 | #endif // __INTSET_H 55 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/mkreleasehdr.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | GIT_SHA1=`(git show-ref --head --hash=8 2> /dev/null || echo 00000000) | head -n1` 3 | GIT_DIRTY=`git diff --no-ext-diff 2> /dev/null | wc -l` 4 | BUILD_ID=`uname -n`"-"`date +%s` 5 | test -f release.h || touch release.h 6 | (cat release.h | grep SHA1 | grep $GIT_SHA1) && \ 7 | (cat release.h | grep DIRTY | grep $GIT_DIRTY) && exit 0 # Already up-to-date 8 | echo "#define REDIS_GIT_SHA1 \"$GIT_SHA1\"" > release.h 9 | echo "#define REDIS_GIT_DIRTY \"$GIT_DIRTY\"" >> release.h 10 | echo "#define REDIS_BUILD_ID \"$BUILD_ID\"" >> release.h 11 | touch release.c # Force recompile of release.c 12 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/pqsort.h: -------------------------------------------------------------------------------- 1 | /* The following is the NetBSD libc qsort implementation modified in order to 2 | * support partial sorting of ranges for Redis. 3 | * 4 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of Redis nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * See the pqsort.c file for the original copyright notice. */ 32 | 33 | #ifndef __PQSORT_H 34 | #define __PQSORT_H 35 | 36 | void 37 | pqsort(void *a, size_t n, size_t es, 38 | int (*cmp) (const void *, const void *), size_t lrange, size_t rrange); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/rand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef REDIS_RANDOM_H 31 | #define REDIS_RANDOM_H 32 | 33 | int32_t redisLrand48(); 34 | void redisSrand48(int32_t seedval); 35 | 36 | #define REDIS_LRAND48_MAX INT32_MAX 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/redisassert.h: -------------------------------------------------------------------------------- 1 | /* redisassert.h -- Drop in replacemnet assert.h that prints the stack trace 2 | * in the Redis logs. 3 | * 4 | * This file should be included instead of "assert.h" inside libraries used by 5 | * Redis that are using assertions, so instead of Redis disappearing with 6 | * SIGABORT, we get the details and stack trace inside the log file. 7 | * 8 | * ---------------------------------------------------------------------------- 9 | * 10 | * Copyright (c) 2006-2012, Salvatore Sanfilippo 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions are met: 15 | * 16 | * * Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * * Redistributions in binary form must reproduce the above copyright 19 | * notice, this list of conditions and the following disclaimer in the 20 | * documentation and/or other materials provided with the distribution. 21 | * * Neither the name of Redis nor the names of its contributors may be used 22 | * to endorse or promote products derived from this software without 23 | * specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | */ 37 | 38 | #ifndef __REDIS_ASSERT_H__ 39 | #define __REDIS_ASSERT_H__ 40 | 41 | #ifdef _WIN32 42 | #include "Win32_Interop/Win32_Portability.h" 43 | #endif 44 | 45 | POSIX_ONLY(#include ) /* for _exit() */ 46 | 47 | #define assert(_e) ((_e)?(void)0 : (_serverAssert(#_e,__FILE__,__LINE__),_exit(1))) 48 | 49 | void _serverAssert(char *estr, char *file, int line); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/release.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /* Every time the Redis Git SHA1 or Dirty status changes only this small 31 | * file is recompiled, as we access this information in all the other 32 | * files using this functions. */ 33 | 34 | #ifdef _WIN32 35 | #include "Win32_Interop/Win32_Portability.h" 36 | #define REDIS_GIT_SHA1 "00000000" /* TODO: Modify build to write them to release.h from the environment */ 37 | #define REDIS_GIT_DIRTY "0" 38 | #define REDIS_BUILD_ID "0000" 39 | #endif 40 | 41 | #include 42 | POSIX_ONLY(#include "release.h") 43 | #include "version.h" 44 | #include "crc64.h" 45 | 46 | char *redisGitSHA1(void) { 47 | return REDIS_GIT_SHA1; 48 | } 49 | 50 | char *redisGitDirty(void) { 51 | return REDIS_GIT_DIRTY; 52 | } 53 | 54 | uint64_t redisBuildId(void) { 55 | char *buildid = REDIS_VERSION REDIS_BUILD_ID REDIS_GIT_DIRTY REDIS_GIT_SHA1; 56 | 57 | return crc64(0,(unsigned char*)buildid,strlen(buildid)); 58 | } 59 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/sdsalloc.h: -------------------------------------------------------------------------------- 1 | /* SDSLib 2.0 -- A C dynamic strings library 2 | * 3 | * Copyright (c) 2006-2015, Salvatore Sanfilippo 4 | * Copyright (c) 2015, Redis Labs, Inc 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * 10 | * * Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * * Neither the name of Redis nor the names of its contributors may be used 16 | * to endorse or promote products derived from this software without 17 | * specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | * POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | /* SDS allocator selection. 33 | * 34 | * This file is used in order to change the SDS allocator at compile time. 35 | * Just define the following defines to what you want to use. Also add 36 | * the include of your alternate allocator if needed (not needed in order 37 | * to use the default libc allocator). */ 38 | 39 | #include "zmalloc.h" 40 | #define s_malloc zmalloc 41 | #define s_realloc zrealloc 42 | #define s_free zfree 43 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/sha1.h: -------------------------------------------------------------------------------- 1 | #ifndef SHA1_H 2 | #define SHA1_H 3 | /* ================ sha1.h ================ */ 4 | /* 5 | SHA-1 in C 6 | By Steve Reid 7 | 100% Public Domain 8 | */ 9 | 10 | typedef struct { 11 | uint32_t state[5]; 12 | uint32_t count[2]; 13 | unsigned char buffer[64]; 14 | } SHA1_CTX; 15 | 16 | void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); 17 | void SHA1Init(SHA1_CTX* context); 18 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len); 19 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context); 20 | 21 | #ifdef REDIS_TEST 22 | int sha1Test(int argc, char **argv); 23 | #endif 24 | #endif 25 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/slowlog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #define SLOWLOG_ENTRY_MAX_ARGC 32 31 | #define SLOWLOG_ENTRY_MAX_STRING 128 32 | 33 | /* This structure defines an entry inside the slow log list */ 34 | typedef struct slowlogEntry { 35 | robj **argv; 36 | int argc; 37 | PORT_LONGLONG id; /* Unique entry identifier. */ 38 | PORT_LONGLONG duration; /* Time spent by the query, in nanoseconds. */ 39 | time_t time; /* Unix time at which the query was executed. */ 40 | } slowlogEntry; 41 | 42 | /* Exported API */ 43 | void slowlogInit(void); 44 | void slowlogPushEntryIfNeeded(robj **argv, int argc, PORT_LONGLONG duration); 45 | 46 | /* Exported commands */ 47 | void slowlogCommand(client *c); 48 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/solarisfixes.h: -------------------------------------------------------------------------------- 1 | /* Solaris specific fixes. 2 | * 3 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #if defined(__sun) 32 | 33 | #if defined(__GNUC__) 34 | #include 35 | #undef isnan 36 | #define isnan(x) \ 37 | __extension__({ __typeof (x) __x_a = (x); \ 38 | __builtin_expect(__x_a != __x_a, 0); }) 39 | 40 | #undef isfinite 41 | #define isfinite(x) \ 42 | __extension__ ({ __typeof (x) __x_f = (x); \ 43 | __builtin_expect(!isnan(__x_f - __x_f), 1); }) 44 | 45 | #undef isinf 46 | #define isinf(x) \ 47 | __extension__ ({ __typeof (x) __x_i = (x); \ 48 | __builtin_expect(!isnan(__x_i) && !isfinite(__x_i), 0); }) 49 | 50 | #define u_int uint 51 | #define u_int32_t uint32_t 52 | #endif /* __GNUC__ */ 53 | 54 | #endif /* __sun */ 55 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/sparkline.h: -------------------------------------------------------------------------------- 1 | /* sparkline.h -- ASCII Sparklines header file 2 | * 3 | * --------------------------------------------------------------------------- 4 | * 5 | * Copyright(C) 2011-2014 Salvatore Sanfilippo 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions are met: 10 | * 11 | * * Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef __SPARKLINE_H 31 | #define __SPARKLINE_H 32 | 33 | /* A sequence is represented of many "samples" */ 34 | struct sample { 35 | double value; 36 | char *label; 37 | }; 38 | 39 | struct sequence { 40 | int length; 41 | int labels; 42 | struct sample *samples; 43 | double min, max; 44 | }; 45 | 46 | #define SPARKLINE_NO_FLAGS 0 47 | #define SPARKLINE_FILL 1 /* Fill the area under the curve. */ 48 | #define SPARKLINE_LOG_SCALE 2 /* Use logarithmic scale. */ 49 | 50 | struct sequence *createSparklineSequence(void); 51 | void sparklineSequenceAddSample(struct sequence *seq, double value, char *label); 52 | void freeSparklineSequence(struct sequence *seq); 53 | sds sparklineRenderRange(sds output, struct sequence *seq, int rows, int offset, int len, int flags); 54 | sds sparklineRender(sds output, struct sequence *seq, int columns, int rows, int flags); 55 | 56 | #endif /* __SPARKLINE_H */ 57 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/testhelp.h: -------------------------------------------------------------------------------- 1 | /* This is a really minimal testing framework for C. 2 | * 3 | * Example: 4 | * 5 | * test_cond("Check if 1 == 1", 1==1) 6 | * test_cond("Check if 5 > 10", 5 > 10) 7 | * test_report() 8 | * 9 | * ---------------------------------------------------------------------------- 10 | * 11 | * Copyright (c) 2010-2012, Salvatore Sanfilippo 12 | * All rights reserved. 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions are met: 16 | * 17 | * * Redistributions of source code must retain the above copyright notice, 18 | * this list of conditions and the following disclaimer. 19 | * * Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in the 21 | * documentation and/or other materials provided with the distribution. 22 | * * Neither the name of Redis nor the names of its contributors may be used 23 | * to endorse or promote products derived from this software without 24 | * specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | */ 38 | 39 | #ifndef __TESTHELP_H 40 | #define __TESTHELP_H 41 | 42 | int __failed_tests = 0; 43 | int __test_num = 0; 44 | #define test_cond(descr,_c) do { \ 45 | __test_num++; printf("%d - %s: ", __test_num, descr); \ 46 | if(_c) printf("PASSED\n"); else {printf("FAILED\n"); __failed_tests++;} \ 47 | } while(0); 48 | #define test_report() do { \ 49 | printf("%d tests, %d passed, %d failed\n", __test_num, \ 50 | __test_num-__failed_tests, __failed_tests); \ 51 | if (__failed_tests) { \ 52 | printf("=== WARNING === We have failed tests here...\n"); \ 53 | exit(1); \ 54 | } \ 55 | } while(0); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * * Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * * Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * * Neither the name of Redis nor the names of its contributors may be used 14 | * to endorse or promote products derived from this software without 15 | * specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | * POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef __REDIS_UTIL_H 31 | #define __REDIS_UTIL_H 32 | 33 | #include 34 | #include "sds.h" 35 | 36 | int stringmatchlen(const char *p, int plen, const char *s, int slen, int nocase); 37 | int stringmatch(const char *p, const char *s, int nocase); 38 | PORT_LONGLONG memtoll(const char *p, int *err); 39 | uint32_t digits10(uint64_t v); 40 | uint32_t sdigits10(int64_t v); 41 | int ll2string(char *s, size_t len, PORT_LONGLONG value); 42 | int string2ll(const char *s, size_t slen, PORT_LONGLONG *value); 43 | int string2l(const char *s, size_t slen, PORT_LONG *value); 44 | int d2string(char *buf, size_t len, double value); 45 | sds getAbsolutePath(char *filename); 46 | int pathIsBaseName(char *path); 47 | 48 | #ifdef REDIS_TEST 49 | int utilTest(int argc, char **argv); 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/valgrind.sup: -------------------------------------------------------------------------------- 1 | { 2 | 3 | Memcheck:Cond 4 | fun:lzf_compress 5 | } 6 | 7 | { 8 | 9 | Memcheck:Value4 10 | fun:lzf_compress 11 | } 12 | 13 | { 14 | 15 | Memcheck:Value8 16 | fun:lzf_compress 17 | } 18 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/version.h: -------------------------------------------------------------------------------- 1 | #define REDIS_VERSION "3.2.100" 2 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/ziplist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2012, Pieter Noordhuis 3 | * Copyright (c) 2009-2012, Salvatore Sanfilippo 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of Redis nor the names of its contributors may be used 15 | * to endorse or promote products derived from this software without 16 | * specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | */ 30 | 31 | #ifndef _ZIPLIST_H 32 | #define _ZIPLIST_H 33 | 34 | #define ZIPLIST_HEAD 0 35 | #define ZIPLIST_TAIL 1 36 | 37 | unsigned char *ziplistNew(void); 38 | unsigned char *ziplistMerge(unsigned char **first, unsigned char **second); 39 | unsigned char *ziplistPush(unsigned char *zl, unsigned char *s, unsigned int slen, int where); 40 | unsigned char *ziplistIndex(unsigned char *zl, int index); 41 | unsigned char *ziplistNext(unsigned char *zl, unsigned char *p); 42 | unsigned char *ziplistPrev(unsigned char *zl, unsigned char *p); 43 | unsigned int ziplistGet(unsigned char *p, unsigned char **sval, unsigned int *slen, PORT_LONGLONG *lval); 44 | unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen); 45 | unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p); 46 | unsigned char *ziplistDeleteRange(unsigned char *zl, int index, unsigned int num); 47 | unsigned int ziplistCompare(unsigned char *p, unsigned char *s, unsigned int slen); 48 | unsigned char *ziplistFind(unsigned char *p, unsigned char *vstr, unsigned int vlen, unsigned int skip); 49 | unsigned int ziplistLen(unsigned char *zl); 50 | size_t ziplistBlobLen(unsigned char *zl); 51 | 52 | #ifdef REDIS_TEST 53 | int ziplistTest(int argc, char *argv[]); 54 | #endif 55 | 56 | #endif /* _ZIPLIST_H */ 57 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/src/zipmap.h: -------------------------------------------------------------------------------- 1 | /* String -> String Map data structure optimized for size. 2 | * 3 | * See zipmap.c for more info. 4 | * 5 | * -------------------------------------------------------------------------- 6 | * 7 | * Copyright (c) 2009-2010, Salvatore Sanfilippo 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions are met: 12 | * 13 | * * Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * * Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * * Neither the name of Redis nor the names of its contributors may be used 19 | * to endorse or promote products derived from this software without 20 | * specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | * POSSIBILITY OF SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef _ZIPMAP_H 36 | #define _ZIPMAP_H 37 | 38 | unsigned char *zipmapNew(void); 39 | unsigned char *zipmapSet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned char *val, unsigned int vlen, int *update); 40 | unsigned char *zipmapDel(unsigned char *zm, unsigned char *key, unsigned int klen, int *deleted); 41 | unsigned char *zipmapRewind(unsigned char *zm); 42 | unsigned char *zipmapNext(unsigned char *zm, unsigned char **key, unsigned int *klen, unsigned char **value, unsigned int *vlen); 43 | int zipmapGet(unsigned char *zm, unsigned char *key, unsigned int klen, unsigned char **value, unsigned int *vlen); 44 | int zipmapExists(unsigned char *zm, unsigned char *key, unsigned int klen); 45 | unsigned int zipmapLen(unsigned char *zm); 46 | size_t zipmapBlobLen(unsigned char *zm); 47 | void zipmapRepr(unsigned char *p); 48 | 49 | #ifdef REDIS_TEST 50 | int zipmapTest(int argc, char *argv[]); 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/win32_hiredis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c), Microsoft Open Technologies, Inc. 3 | * All rights reserved. 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * - Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * - Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 12 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 14 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 17 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 18 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 19 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 20 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 | */ 22 | 23 | #ifndef WIN32_HIREDIS_H 24 | #define WIN32_HIREDIS_H 25 | 26 | #include "src/Win32_Interop/Win32_Portability.h" 27 | #include "src/Win32_Interop/Win32_types_hiredis.h" 28 | #include "src/Win32_Interop/Win32_Error.h" 29 | #include "src/Win32_Interop/Win32_FDAPI.h" 30 | #define INCL_WINSOCK_API_PROTOTYPES 0 // Important! Do not include Winsock API definitions to avoid conflicts with API entry points defined below. 31 | #include // For SOCKADDR_STORAGE 32 | 33 | #include "hiredis.h" 34 | 35 | 36 | 37 | #define snprintf _snprintf 38 | #ifndef va_copy 39 | #define va_copy(d,s) d = (s) 40 | #endif 41 | 42 | redisContext *redisPreConnectNonBlock(const char *ip, int port, SOCKADDR_STORAGE *sa); 43 | int redisBufferReadDone(redisContext *c, char *buf, ssize_t nread); 44 | int redisBufferWriteDone(redisContext *c, int nwritten, int *done); 45 | 46 | int redisContextPreConnectTcp(redisContext *c, const char *addr, int port, struct timeval *timeout, SOCKADDR_STORAGE *ss); 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /mt5/source/hiredis/hiredis/zmalloc.h: -------------------------------------------------------------------------------- 1 | /* Drop in replacement for zmalloc.h in order to just use libc malloc without 2 | * any wrappering. */ 3 | 4 | #ifndef ZMALLOC_H 5 | #define ZMALLOC_H 6 | 7 | #define zmalloc malloc 8 | #define zrealloc realloc 9 | #define zcalloc(x) calloc(x,1) 10 | #define zfree free 11 | #define zstrdup strdup 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /mt5/source/hiredis/x64/Release/hiredis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lxbinary/MT5_to_Python/a267c3c108bf7394c527b76fa9ab00b5f3e5987e/mt5/source/hiredis/x64/Release/hiredis.dll -------------------------------------------------------------------------------- /python/example_Redis.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | @authors: [Lxbot] 4 | """ 5 | import ast 6 | import redis 7 | 8 | pair = 'EURUSD_i' 9 | # Setup Redis 10 | redis_db = redis.StrictRedis( 11 | host='localhost', 12 | port=6379, 13 | db=0, 14 | decode_responses=True 15 | ) 16 | 17 | pair_data = redis_db.get(pair) 18 | print("Source data from Redis po ", pair) 19 | print(pair_data) 20 | print("__________________") 21 | 22 | # обработка в словарь 23 | pair_data = ast.literal_eval(pair_data) 24 | 25 | # обращаемся к конкретному значению словаря 26 | print("data RSI_2 : ") 27 | print(pair_data['RSI_2']) 28 | print("__________________") -------------------------------------------------------------------------------- /python/example_Redis_benchmark.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | @authors: [Lxbot] 4 | """ 5 | import ast 6 | import redis 7 | from datetime import datetime 8 | 9 | pair = 'EURUSD_i' 10 | 11 | r = redis.StrictRedis('localhost', 6379, db=0, decode_responses=True) 12 | X = {} 13 | 14 | while True: 15 | X = r.get(pair) 16 | if X is not None: 17 | X = ast.literal_eval(X) 18 | print('Data in:', datetime.now().strftime('%H:%M:%S.%f')[:-3], 'len:', len(X),) 19 | r.flushdb() -------------------------------------------------------------------------------- /python/example_Socket.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | @authors: [Lxbot] 4 | """ 5 | 6 | import socket 7 | from datetime import datetime 8 | 9 | port = 9411 10 | 11 | sock = socket.socket() 12 | sock.bind(("127.0.0.1", port)) 13 | sock.listen(10) 14 | 15 | 16 | X = [] 17 | conn, addr = sock.accept() 18 | data = conn.recv(16384) 19 | if not data: 20 | print("No data") 21 | conn.close() 22 | else: 23 | udata = data.decode("utf-8") 24 | X = udata.replace('\x00', '').split(',') 25 | print('DATA in', datetime.now().strftime('%H:%M:%S.%f')[:-3], 'len:', len(X),) 26 | print(X) -------------------------------------------------------------------------------- /python/example_Socket_benchmark.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | @authors: [Lxbot] 4 | """ 5 | 6 | import socket 7 | from datetime import datetime 8 | 9 | port = 9411 10 | 11 | sock = socket.socket() 12 | sock.bind(("127.0.0.1", port)) 13 | sock.listen(10) 14 | 15 | # в бесконечном цикле ждем и читаем данные 16 | while True: 17 | X = [] 18 | conn, addr = sock.accept() 19 | data = conn.recv(16384) 20 | if not data: 21 | print("No data") 22 | conn.close() 23 | continue 24 | else: 25 | udata = data.decode("utf-8") 26 | X = udata.replace('\x00', '').split(',') 27 | print('DATA in', datetime.now().strftime('%H:%M:%S.%f')[:-3], 'len:', len(X),) 28 | --------------------------------------------------------------------------------