├── LICENSE ├── README.md ├── adatac ├── CMakeLists.txt ├── License.txt ├── aarg.hpp ├── adt_gen.cpp ├── alexer.hpp ├── cpp2lua_gen.cpp ├── cpp_gen.cpp ├── csharp_gen.cpp ├── descrip.cpp ├── descrip.h ├── java_gen.cpp ├── kt_gen.cpp ├── main.cpp ├── parser.cpp ├── parser.h ├── program.cpp ├── program.h ├── string_view.h ├── util.cpp └── util.h ├── cpp ├── adata.hpp ├── adata_corec.hpp ├── adata_cpp2lua.hpp ├── adata_int64.hpp └── stdint.hpp ├── cppox └── adata.hpp ├── csharp └── adata.cs ├── dist └── win64 │ └── adatac.exe ├── example ├── adl │ ├── my │ │ └── game │ │ │ ├── player.adl │ │ │ └── quest.adl │ └── util │ │ └── vec3.adl ├── cpp │ ├── CMakeLists.txt │ ├── generated │ │ ├── my │ │ │ └── game │ │ │ │ ├── player.adl.h │ │ │ │ └── quest.adl.h │ │ └── util │ │ │ └── vec3.adl.h │ └── main.cpp ├── csharp │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── adata.cs │ ├── example.csproj │ ├── player.adl.cs │ ├── quest.adl.cs │ └── vec3.adl.cs └── lua │ ├── CMakeLists.txt │ ├── generated │ ├── game.adt │ ├── my │ │ └── game │ │ │ ├── player.adl.c2l.h │ │ │ ├── player.adl.h │ │ │ ├── quest.adl.c2l.h │ │ │ └── quest.adl.h │ └── util │ │ ├── vec3.adl.c2l.h │ │ └── vec3.adl.h │ ├── main.cpp │ └── main.lua ├── java └── src │ └── adata │ ├── Base.java │ └── Stream.java ├── js └── src │ └── adata │ ├── adata.js │ ├── bower.json │ ├── index.js │ └── package.json ├── kotlin └── adata.kt ├── lua └── adata.lua ├── luajit ├── adata.lua └── adata_core.lua └── netcore └── adata.cs /LICENSE: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /adatac/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is part of the CMake build system for adatac 3 | # 4 | # CMake auto-generated configuration options. 5 | # Do not check in modified versions of this file. 6 | # 7 | # Copyright (c) 2014-2015 lordoffox (QQ:99643412 lordoffox@gmail.com) 8 | # Copyright (c) 2015 Nous Xiong (QQ:348944179 348944179@qq.com) 9 | # 10 | # Distributed under the Boost Software License, Version 1.0. (See accompanying 11 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 12 | # 13 | 14 | cmake_minimum_required (VERSION 2.8.6 FATAL_ERROR) 15 | project (adatac) 16 | 17 | # The version number. 18 | set (ADATAC_VERSION_MAJOR 1) 19 | set (ADATAC_VERSION_MINOR 2) 20 | 21 | if (WIN32) 22 | set (WINVER "0x0501" CACHE STRING "Windows version maro. Default is 0x0501 - winxp, user can reset") 23 | add_definitions (-D_WIN32_WINNT=${WINVER}) 24 | endif () 25 | 26 | if (MSVC) 27 | add_definitions (-D_CRT_SECURE_NO_WARNINGS) 28 | endif() 29 | 30 | # Add the source and build tree to the search path for include gce header files. 31 | include_directories (${PROJECT_SOURCE_DIR}) 32 | include_directories (${PROJECT_BINARY_DIR}) 33 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../cpp/) 34 | 35 | set (CMAKE_VERBOSE_MAKEFILE true) 36 | 37 | if (NOT WIN32) 38 | set (ADATAC_COMPILE_PROP "-std=c++11") 39 | if (APPLE) 40 | set (ADATAC_COMPILE_PROP "${ADATAC_COMPILE_PROP} -stdlib=libc++") 41 | endif () 42 | endif () 43 | 44 | if (WIN32) 45 | if (${CMAKE_GENERATOR} MATCHES "Visual Studio 11 *" OR ${CMAKE_GENERATOR} MATCHES "Visual Studio 12 *") 46 | set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") 47 | endif () 48 | endif () 49 | 50 | file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") 51 | add_executable(adatac ${SOURCE_FILES}) 52 | 53 | if (ADATAC_COMPILE_PROP) 54 | set_target_properties (adatac PROPERTIES COMPILE_FLAGS "${ADATAC_COMPILE_PROP}") 55 | endif () 56 | target_link_libraries (adatac) 57 | 58 | install (TARGETS adatac RUNTIME DESTINATION bin) 59 | 60 | # Build a CPack driven installer package. 61 | include (InstallRequiredSystemLibraries) 62 | set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt") 63 | set (CPACK_PACKAGE_VERSION_MAJOR "${ADATAC_VERSION_MAJOR}") 64 | set (CPACK_PACKAGE_VERSION_MINOR "${ADATAC_VERSION_MINOR}") 65 | set (CPACK_PACKAGE_CONTACT "QQ:99643412 lordoffox: lordoffox@gmail.com") 66 | include (CPack) 67 | -------------------------------------------------------------------------------- /adatac/License.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /adatac/aarg.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | namespace aarg 12 | { 13 | struct option 14 | { 15 | bool set = false; 16 | std::string short_opt; 17 | std::string long_opt; 18 | std::vector args; 19 | std::function cb; 20 | std::string help; 21 | 22 | std::string opt_name() const 23 | { 24 | std::string name; 25 | if (!this->short_opt.empty()) 26 | { 27 | name += this->short_opt; 28 | name += '|'; 29 | } 30 | name += this->long_opt; 31 | return name; 32 | } 33 | 34 | inline void parse(bool& v) 35 | { 36 | if (this->args.size() > 1) 37 | { 38 | throw std::invalid_argument("option:" + opt_name() + " wrong arguments!"); 39 | } 40 | if (this->args.size() == 1) 41 | { 42 | auto& arg = this->args[0]; 43 | if(arg.length() == 2) 44 | { 45 | if( (arg[0] == 'O' || arg[0] == 'o') && 46 | (arg[1] == 'N' || arg[1] == 'n')) 47 | { 48 | v = true; 49 | return; 50 | } 51 | } 52 | if (arg.length() == 3) 53 | { 54 | if ((arg[0] == 'Y' || arg[0] == 'y') && 55 | (arg[1] == 'E' || arg[1] == 'e')&& 56 | (arg[2] == 'S' || arg[2] == 's')) 57 | { 58 | v = true; 59 | return; 60 | } 61 | } 62 | if (arg.length() == 4) 63 | { 64 | if ((arg[0] == 'T' || arg[0] == 't') && 65 | (arg[1] == 'R' || arg[1] == 'r') && 66 | (arg[2] == 'U' || arg[2] == 'u') && 67 | (arg[3] == 'E' || arg[3] == 'e')) 68 | { 69 | v = true; 70 | return; 71 | } 72 | } 73 | v = false; 74 | return; 75 | } 76 | else 77 | { 78 | v = set; 79 | } 80 | return; 81 | } 82 | 83 | inline bool check_single_arg() 84 | { 85 | return this->args.size() == 1; 86 | } 87 | 88 | template 89 | inline typename ::std::enable_if<::std::is_signed::value && ::std::is_integral::value, void>::type 90 | convert(std::string const& str , value_type& v) 91 | { 92 | v = (value_type)std::strtoll(str.c_str(), nullptr, 10); 93 | } 94 | 95 | template 96 | inline typename ::std::enable_if<::std::is_unsigned::value && ::std::is_integral::value, void>::type 97 | convert(std::string const& str, value_type& v) 98 | { 99 | v = (value_type)std::strtoull(str.c_str(), nullptr, 10); 100 | } 101 | 102 | template 103 | inline typename ::std::enable_if<::std::is_floating_point::value, void>::type 104 | convert(std::string const& str, value_type& v) 105 | { 106 | v = (value_type)std::strtod(str.c_str(), nullptr); 107 | } 108 | 109 | void convert(std::string const& str, std::string& v) 110 | { 111 | v = str; 112 | } 113 | 114 | template 115 | void parse(value_type& v) 116 | { 117 | if(check_single_arg()) 118 | { 119 | convert(this->args[0], v); 120 | } 121 | } 122 | 123 | template 124 | void parse(std::vector& v) 125 | { 126 | v.clear(); 127 | for (auto& arg : this->args) 128 | { 129 | v.emplace_back(); 130 | convert(arg, v.back()); 131 | } 132 | } 133 | }; 134 | 135 | class argopt 136 | { 137 | private: 138 | std::vector