From b6d455a02bd338e9dc0faa09d4d8177ecd8d569a Mon Sep 17 00:00:00 2001 From: Petr Mrázek Date: Sun, 10 Apr 2016 15:53:05 +0200 Subject: NOISSUE reorganize and document libraries --- depends/LogicalGui/CMakeLists.txt | 4 - depends/LogicalGui/LogicalGui.h | 254 -- depends/classparser/CMakeLists.txt | 41 - depends/classparser/include/classparser_config.h | 22 - depends/classparser/include/javautils.h | 29 - depends/classparser/src/annotations.cpp | 85 - depends/classparser/src/annotations.h | 277 -- depends/classparser/src/classfile.h | 156 - depends/classparser/src/constants.h | 220 - depends/classparser/src/errors.h | 8 - depends/classparser/src/javaendian.h | 76 - depends/classparser/src/javautils.cpp | 83 - depends/classparser/src/membuffer.h | 63 - depends/hoedown/CMakeLists.txt | 26 - depends/hoedown/LICENSE | 15 - depends/hoedown/README.md | 9 - depends/hoedown/include/hoedown/autolink.h | 46 - depends/hoedown/include/hoedown/buffer.h | 134 - depends/hoedown/include/hoedown/document.h | 172 - depends/hoedown/include/hoedown/escape.h | 28 - depends/hoedown/include/hoedown/html.h | 84 - depends/hoedown/include/hoedown/stack.h | 52 - depends/hoedown/include/hoedown/version.h | 33 - depends/hoedown/src/autolink.c | 281 -- depends/hoedown/src/buffer.c | 308 -- depends/hoedown/src/document.c | 2958 ------------ depends/hoedown/src/escape.c | 188 - depends/hoedown/src/html.c | 754 --- depends/hoedown/src/html_blocks.c | 240 - depends/hoedown/src/html_smartypants.c | 435 -- depends/hoedown/src/stack.c | 79 - depends/hoedown/src/version.c | 9 - depends/iconfix/CMakeLists.txt | 18 - depends/iconfix/internal/qhexstring_p.h | 100 - depends/iconfix/internal/qiconloader.cpp | 688 --- depends/iconfix/internal/qiconloader_p.h | 219 - depends/iconfix/xdgicon.cpp | 152 - depends/iconfix/xdgicon.h | 46 - depends/javacheck/.gitignore | 6 - depends/javacheck/CMakeLists.txt | 13 - depends/javacheck/JavaCheck.java | 24 - depends/launcher/.gitignore | 6 - depends/launcher/CMakeLists.txt | 34 - depends/launcher/net/minecraft/Launcher.java | 165 - depends/launcher/org/multimc/EntryPoint.java | 178 - depends/launcher/org/multimc/IconLoader.java | 132 - depends/launcher/org/multimc/Launcher.java | 22 - depends/launcher/org/multimc/LegacyFrame.java | 112 - .../launcher/org/multimc/NotFoundException.java | 21 - depends/launcher/org/multimc/ParamBucket.java | 86 - depends/launcher/org/multimc/ParseException.java | 22 - depends/launcher/org/multimc/Utils.java | 280 -- .../org/multimc/legacy/LegacyLauncher.java | 175 - .../org/multimc/onesix/OneSixLauncher.java | 367 -- .../org/simplericity/macify/eawt/Application.java | 176 - .../macify/eawt/ApplicationAdapter.java | 48 - .../simplericity/macify/eawt/ApplicationEvent.java | 25 - .../macify/eawt/ApplicationListener.java | 27 - .../macify/eawt/DefaultApplication.java | 418 -- depends/libnbtplusplus | 1 - depends/pack200/CMakeLists.txt | 39 - depends/pack200/LICENSE | 347 -- depends/pack200/anti200.cpp | 43 - depends/pack200/include/unpack200.h | 36 - depends/pack200/src/bands.cpp | 423 -- depends/pack200/src/bands.h | 489 -- depends/pack200/src/bytes.cpp | 217 - depends/pack200/src/bytes.h | 286 -- depends/pack200/src/coding.cpp | 1044 ----- depends/pack200/src/coding.h | 247 - depends/pack200/src/constants.h | 442 -- depends/pack200/src/defines.h | 65 - depends/pack200/src/unpack.cpp | 4793 -------------------- depends/pack200/src/unpack.h | 547 --- depends/pack200/src/unpack200.cpp | 162 - depends/pack200/src/utils.cpp | 71 - depends/pack200/src/utils.h | 53 - depends/pack200/src/zip.cpp | 589 --- depends/pack200/src/zip.h | 110 - depends/rainbow/CMakeLists.txt | 15 - depends/rainbow/COPYING.LIB | 0 depends/rainbow/include/rainbow.h | 160 - depends/rainbow/include/rainbow_config.h | 26 - depends/rainbow/src/rainbow.cpp | 365 -- depends/xz-embedded/CMakeLists.txt | 26 - depends/xz-embedded/include/xz.h | 321 -- depends/xz-embedded/src/xz_config.h | 119 - depends/xz-embedded/src/xz_crc32.c | 61 - depends/xz-embedded/src/xz_crc64.c | 52 - depends/xz-embedded/src/xz_dec_bcj.c | 588 --- depends/xz-embedded/src/xz_dec_lzma2.c | 1231 ----- depends/xz-embedded/src/xz_dec_stream.c | 860 ---- depends/xz-embedded/src/xz_lzma2.h | 204 - depends/xz-embedded/src/xz_private.h | 150 - depends/xz-embedded/src/xz_stream.h | 62 - depends/xz-embedded/xzminidec.c | 144 - 96 files changed, 25117 deletions(-) delete mode 100644 depends/LogicalGui/CMakeLists.txt delete mode 100644 depends/LogicalGui/LogicalGui.h delete mode 100644 depends/classparser/CMakeLists.txt delete mode 100644 depends/classparser/include/classparser_config.h delete mode 100644 depends/classparser/include/javautils.h delete mode 100644 depends/classparser/src/annotations.cpp delete mode 100644 depends/classparser/src/annotations.h delete mode 100644 depends/classparser/src/classfile.h delete mode 100644 depends/classparser/src/constants.h delete mode 100644 depends/classparser/src/errors.h delete mode 100644 depends/classparser/src/javaendian.h delete mode 100644 depends/classparser/src/javautils.cpp delete mode 100644 depends/classparser/src/membuffer.h delete mode 100644 depends/hoedown/CMakeLists.txt delete mode 100644 depends/hoedown/LICENSE delete mode 100644 depends/hoedown/README.md delete mode 100644 depends/hoedown/include/hoedown/autolink.h delete mode 100644 depends/hoedown/include/hoedown/buffer.h delete mode 100644 depends/hoedown/include/hoedown/document.h delete mode 100644 depends/hoedown/include/hoedown/escape.h delete mode 100644 depends/hoedown/include/hoedown/html.h delete mode 100644 depends/hoedown/include/hoedown/stack.h delete mode 100644 depends/hoedown/include/hoedown/version.h delete mode 100644 depends/hoedown/src/autolink.c delete mode 100644 depends/hoedown/src/buffer.c delete mode 100644 depends/hoedown/src/document.c delete mode 100644 depends/hoedown/src/escape.c delete mode 100644 depends/hoedown/src/html.c delete mode 100644 depends/hoedown/src/html_blocks.c delete mode 100644 depends/hoedown/src/html_smartypants.c delete mode 100644 depends/hoedown/src/stack.c delete mode 100644 depends/hoedown/src/version.c delete mode 100644 depends/iconfix/CMakeLists.txt delete mode 100644 depends/iconfix/internal/qhexstring_p.h delete mode 100644 depends/iconfix/internal/qiconloader.cpp delete mode 100644 depends/iconfix/internal/qiconloader_p.h delete mode 100644 depends/iconfix/xdgicon.cpp delete mode 100644 depends/iconfix/xdgicon.h delete mode 100644 depends/javacheck/.gitignore delete mode 100644 depends/javacheck/CMakeLists.txt delete mode 100644 depends/javacheck/JavaCheck.java delete mode 100644 depends/launcher/.gitignore delete mode 100644 depends/launcher/CMakeLists.txt delete mode 100644 depends/launcher/net/minecraft/Launcher.java delete mode 100644 depends/launcher/org/multimc/EntryPoint.java delete mode 100644 depends/launcher/org/multimc/IconLoader.java delete mode 100644 depends/launcher/org/multimc/Launcher.java delete mode 100644 depends/launcher/org/multimc/LegacyFrame.java delete mode 100644 depends/launcher/org/multimc/NotFoundException.java delete mode 100644 depends/launcher/org/multimc/ParamBucket.java delete mode 100644 depends/launcher/org/multimc/ParseException.java delete mode 100644 depends/launcher/org/multimc/Utils.java delete mode 100644 depends/launcher/org/multimc/legacy/LegacyLauncher.java delete mode 100644 depends/launcher/org/multimc/onesix/OneSixLauncher.java delete mode 100644 depends/launcher/org/simplericity/macify/eawt/Application.java delete mode 100644 depends/launcher/org/simplericity/macify/eawt/ApplicationAdapter.java delete mode 100644 depends/launcher/org/simplericity/macify/eawt/ApplicationEvent.java delete mode 100644 depends/launcher/org/simplericity/macify/eawt/ApplicationListener.java delete mode 100644 depends/launcher/org/simplericity/macify/eawt/DefaultApplication.java delete mode 160000 depends/libnbtplusplus delete mode 100644 depends/pack200/CMakeLists.txt delete mode 100644 depends/pack200/LICENSE delete mode 100644 depends/pack200/anti200.cpp delete mode 100644 depends/pack200/include/unpack200.h delete mode 100644 depends/pack200/src/bands.cpp delete mode 100644 depends/pack200/src/bands.h delete mode 100644 depends/pack200/src/bytes.cpp delete mode 100644 depends/pack200/src/bytes.h delete mode 100644 depends/pack200/src/coding.cpp delete mode 100644 depends/pack200/src/coding.h delete mode 100644 depends/pack200/src/constants.h delete mode 100644 depends/pack200/src/defines.h delete mode 100644 depends/pack200/src/unpack.cpp delete mode 100644 depends/pack200/src/unpack.h delete mode 100644 depends/pack200/src/unpack200.cpp delete mode 100644 depends/pack200/src/utils.cpp delete mode 100644 depends/pack200/src/utils.h delete mode 100644 depends/pack200/src/zip.cpp delete mode 100644 depends/pack200/src/zip.h delete mode 100644 depends/rainbow/CMakeLists.txt delete mode 100644 depends/rainbow/COPYING.LIB delete mode 100644 depends/rainbow/include/rainbow.h delete mode 100644 depends/rainbow/include/rainbow_config.h delete mode 100644 depends/rainbow/src/rainbow.cpp delete mode 100644 depends/xz-embedded/CMakeLists.txt delete mode 100644 depends/xz-embedded/include/xz.h delete mode 100644 depends/xz-embedded/src/xz_config.h delete mode 100644 depends/xz-embedded/src/xz_crc32.c delete mode 100644 depends/xz-embedded/src/xz_crc64.c delete mode 100644 depends/xz-embedded/src/xz_dec_bcj.c delete mode 100644 depends/xz-embedded/src/xz_dec_lzma2.c delete mode 100644 depends/xz-embedded/src/xz_dec_stream.c delete mode 100644 depends/xz-embedded/src/xz_lzma2.h delete mode 100644 depends/xz-embedded/src/xz_private.h delete mode 100644 depends/xz-embedded/src/xz_stream.h delete mode 100644 depends/xz-embedded/xzminidec.c (limited to 'depends') diff --git a/depends/LogicalGui/CMakeLists.txt b/depends/LogicalGui/CMakeLists.txt deleted file mode 100644 index 12665738..00000000 --- a/depends/LogicalGui/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -project(LogicalGui) -add_library(LogicalGui STATIC LogicalGui.h) -target_include_directories(LogicalGui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -qt5_use_modules(LogicalGui Core) diff --git a/depends/LogicalGui/LogicalGui.h b/depends/LogicalGui/LogicalGui.h deleted file mode 100644 index 729f0353..00000000 --- a/depends/LogicalGui/LogicalGui.h +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright 2013-2015 Jan Dalheimer - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -#if QT_VERSION == QT_VERSION_CHECK(5, 1, 1) -#include <5.1.1/QtCore/private/qobject_p.h> -#elif QT_VERSION == QT_VERSION_CHECK(5, 2, 0) -#include <5.2.0/QtCore/private/qobject_p.h> -#elif QT_VERSION == QT_VERSION_CHECK(5, 2, 1) -#include <5.2.1/QtCore/private/qobject_p.h> -#elif QT_VERSION == QT_VERSION_CHECK(5, 3, 0) -#include <5.3.0/QtCore/private/qobject_p.h> -#elif QT_VERSION == QT_VERSION_CHECK(5, 3, 1) -#include <5.3.1/QtCore/private/qobject_p.h> -#else -#error Please add support for this version of Qt -#endif - -class Bindable -{ - friend class tst_LogicalGui; - -public: - Bindable(Bindable *parent = 0) : m_parent(parent) - { - } - virtual ~Bindable() - { - } - - void setBindableParent(Bindable *parent) - { - m_parent = parent; - } - - void bind(const QString &id, const QObject *receiver, const char *methodSignature) - { - auto mo = receiver->metaObject(); - Q_ASSERT_X(mo, "Bindable::bind", - "Invalid metaobject. Did you forget the QObject macro?"); - const QMetaMethod method = mo->method(mo->indexOfMethod( - QMetaObject::normalizedSignature(methodSignature + 1).constData())); - Q_ASSERT_X(method.isValid(), "Bindable::bind", "Invalid method signature"); - m_bindings.insert(id, Binding(receiver, method)); - } - template - void bind(const QString &id, - const typename QtPrivate::FunctionPointer::Object *receiver, Func slot) - { - typedef QtPrivate::FunctionPointer SlotType; - m_bindings.insert( - id, - Binding(receiver, new QtPrivate::QSlotObject(slot))); - } - template void bind(const QString &id, Func slot) - { - typedef QtPrivate::FunctionPointer SlotType; - m_bindings.insert( - id, - Binding(nullptr, new QtPrivate::QSlotObject(slot))); - } - void unbind(const QString &id) - { - m_bindings.remove(id); - } - -private: - struct Binding - { - Binding(const QObject *receiver, const QMetaMethod &method) - : receiver(receiver), method(method) - { - } - Binding(const QObject *receiver, QtPrivate::QSlotObjectBase *object) - : receiver(receiver), object(object) - { - } - Binding() - { - } - const QObject *receiver; - QMetaMethod method; - QtPrivate::QSlotObjectBase *object = nullptr; - }; - QMap m_bindings; - - Bindable *m_parent; - -private: - inline Qt::ConnectionType connectionType(const QObject *receiver) - { - return receiver == nullptr ? Qt::DirectConnection - : (QThread::currentThread() == receiver->thread() - ? Qt::DirectConnection - : Qt::BlockingQueuedConnection); - } - -protected: - template Ret wait(const QString &id, Params... params) - { - static_assert(!std::is_same::value, "You need to use Bindable::waitVoid"); - - if (!m_bindings.contains(id) && m_parent) - { - return m_parent->wait(id, params...); - } - Q_ASSERT(m_bindings.contains(id)); - const auto binding = m_bindings[id]; - const Qt::ConnectionType type = connectionType(binding.receiver); - Ret ret; - if (binding.object) - { - void *args[] = {&ret, - const_cast(reinterpret_cast(¶ms))...}; - if (type == Qt::BlockingQueuedConnection) - { - QSemaphore semaphore; - QMetaCallEvent *ev = - new QMetaCallEvent(binding.object, nullptr, -1, 0, 0, args, &semaphore); - QCoreApplication::postEvent(const_cast(binding.receiver), ev); - semaphore.acquire(); - } - else - { - binding.object->call(const_cast(binding.receiver), args); - } - } - else - { - const QMetaMethod method = binding.method; - Q_ASSERT_X(method.parameterCount() == sizeof...(params), "Bindable::wait", - qPrintable(QString("Incompatible argument count (expected %1, got %2)") - .arg(method.parameterCount(), sizeof...(params)))); - Q_ASSERT_X( - qMetaTypeId() != QMetaType::UnknownType, "Bindable::wait", - "Requested return type is not registered, please use the Q_DECLARE_METATYPE " - "macro to make it known to Qt's meta-object system"); - Q_ASSERT_X( - method.returnType() == qMetaTypeId() || - QMetaType::hasRegisteredConverterFunction(method.returnType(), - qMetaTypeId()), - "Bindable::wait", - qPrintable( - QString( - "Requested return type (%1) is incompatible method return type (%2)") - .arg(QMetaType::typeName(qMetaTypeId()), - QMetaType::typeName(method.returnType())))); - const auto retArg = QReturnArgument( - QMetaType::typeName(qMetaTypeId()), - ret); // because Q_RETURN_ARG doesn't work with templates... - method.invoke(const_cast(binding.receiver), type, retArg, - Q_ARG(Params, params)...); - } - return ret; - } - template - typename std::enable_if::type waitVoid(const QString &id, - Params... params) - { - if (!m_bindings.contains(id) && m_parent) - { - m_parent->waitVoid(id, params...); - return; - } - Q_ASSERT(m_bindings.contains(id)); - const auto binding = m_bindings[id]; - const Qt::ConnectionType type = connectionType(binding.receiver); - if (binding.object) - { - void *args[] = {0, const_cast(reinterpret_cast(¶ms))...}; - if (type == Qt::BlockingQueuedConnection) - { - QSemaphore semaphore; - QMetaCallEvent *ev = - new QMetaCallEvent(binding.object, nullptr, -1, 0, 0, args, &semaphore); - QCoreApplication::postEvent(const_cast(binding.receiver), ev); - semaphore.acquire(); - } - else - { - binding.object->call(const_cast(binding.receiver), args); - } - } - else - { - const QMetaMethod method = binding.method; - Q_ASSERT_X(method.parameterCount() == sizeof...(params), "Bindable::wait", - qPrintable(QString("Incompatible argument count (expected %1, got %2)") - .arg(method.parameterCount(), sizeof...(params)))); - method.invoke(const_cast(binding.receiver), type, - Q_ARG(Params, params)...); - } - } - void waitVoid(const QString &id) - { - if (!m_bindings.contains(id) && m_parent) - { - m_parent->waitVoid(id); - return; - } - Q_ASSERT(m_bindings.contains(id)); - const auto binding = m_bindings[id]; - const Qt::ConnectionType type = connectionType(binding.receiver); - if (binding.object) - { - void *args[] = {0}; - if (type == Qt::BlockingQueuedConnection) - { - QSemaphore semaphore; - QMetaCallEvent *ev = - new QMetaCallEvent(binding.object, nullptr, -1, 0, 0, args, &semaphore); - QCoreApplication::postEvent(const_cast(binding.receiver), ev); - semaphore.acquire(); - } - else - { - binding.object->call(const_cast(binding.receiver), args); - } - } - else - { - const QMetaMethod method = binding.method; - Q_ASSERT_X(method.parameterCount() == 0, "Bindable::wait", - qPrintable(QString("Incompatible argument count (expected %1, got %2)") - .arg(method.parameterCount(), 0))); - method.invoke(const_cast(binding.receiver), type); - } - } -}; - -// used frequently -Q_DECLARE_METATYPE(bool *) diff --git a/depends/classparser/CMakeLists.txt b/depends/classparser/CMakeLists.txt deleted file mode 100644 index a6c3fa14..00000000 --- a/depends/classparser/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -project(classparser) - -set(CMAKE_AUTOMOC ON) - -######## Check endianness ######## -include(TestBigEndian) -test_big_endian(BIGENDIAN) -if(${BIGENDIAN}) - add_definitions(-DMULTIMC_BIG_ENDIAN) -endif(${BIGENDIAN}) - -# Find Qt -find_package(Qt5Core REQUIRED) - -# Include Qt headers. -include_directories(${Qt5Base_INCLUDE_DIRS}) - -set(CLASSPARSER_HEADERS -# Public headers -include/classparser_config.h -include/javautils.h - -# Private headers -src/annotations.h -src/classfile.h -src/constants.h -src/errors.h -src/javaendian.h -src/membuffer.h -) - -set(CLASSPARSER_SOURCES -src/javautils.cpp -src/annotations.cpp -) - -add_definitions(-DCLASSPARSER_LIBRARY) - -add_library(classparser SHARED ${CLASSPARSER_SOURCES} ${CLASSPARSER_HEADERS}) -target_include_directories(classparser PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -qt5_use_modules(classparser Core) diff --git a/depends/classparser/include/classparser_config.h b/depends/classparser/include/classparser_config.h deleted file mode 100644 index bfd4dcb4..00000000 --- a/depends/classparser/include/classparser_config.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -#ifdef CLASSPARSER_LIBRARY -#define CLASSPARSER_EXPORT Q_DECL_EXPORT -#else -#define CLASSPARSER_EXPORT Q_DECL_IMPORT -#endif diff --git a/depends/classparser/include/javautils.h b/depends/classparser/include/javautils.h deleted file mode 100644 index 43cca4bc..00000000 --- a/depends/classparser/include/javautils.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Authors: Orochimarufan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#pragma once -#include -#include "classparser_config.h" - -#define MCVer_Unknown "Unknown" - -namespace javautils -{ -/** - * @brief Get the version from a minecraft.jar by parsing its class files. Expensive! - */ -QString GetMinecraftJarVersion(QString jar); -} diff --git a/depends/classparser/src/annotations.cpp b/depends/classparser/src/annotations.cpp deleted file mode 100644 index d1a7c046..00000000 --- a/depends/classparser/src/annotations.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "classfile.h" -#include "annotations.h" -#include - -namespace java -{ -std::string annotation::toString() -{ - std::ostringstream ss; - ss << "Annotation type : " << type_index << " - " << pool[type_index].str_data << std::endl; - ss << "Contains " << name_val_pairs.size() << " pairs:" << std::endl; - for (unsigned i = 0; i < name_val_pairs.size(); i++) - { - std::pair &val = name_val_pairs[i]; - auto name_idx = val.first; - ss << pool[name_idx].str_data << "(" << name_idx << ")" - << " = " << val.second->toString() << std::endl; - } - return ss.str(); -} - -annotation *annotation::read(util::membuffer &input, constant_pool &pool) -{ - uint16_t type_index = 0; - input.read_be(type_index); - annotation *ann = new annotation(type_index, pool); - - uint16_t num_pairs = 0; - input.read_be(num_pairs); - while (num_pairs) - { - uint16_t name_idx = 0; - // read name index - input.read_be(name_idx); - auto elem = element_value::readElementValue(input, pool); - // read value - ann->add_pair(name_idx, elem); - num_pairs--; - } - return ann; -} - -element_value *element_value::readElementValue(util::membuffer &input, - java::constant_pool &pool) -{ - element_value_type type = INVALID; - input.read(type); - uint16_t index = 0; - uint16_t index2 = 0; - std::vector vals; - switch (type) - { - case PRIMITIVE_BYTE: - case PRIMITIVE_CHAR: - case PRIMITIVE_DOUBLE: - case PRIMITIVE_FLOAT: - case PRIMITIVE_INT: - case PRIMITIVE_LONG: - case PRIMITIVE_SHORT: - case PRIMITIVE_BOOLEAN: - case STRING: - input.read_be(index); - return new element_value_simple(type, index, pool); - case ENUM_CONSTANT: - input.read_be(index); - input.read_be(index2); - return new element_value_enum(type, index, index2, pool); - case CLASS: // Class - input.read_be(index); - return new element_value_class(type, index, pool); - case ANNOTATION: // Annotation - // FIXME: runtime visibility info needs to be passed from parent - return new element_value_annotation(ANNOTATION, annotation::read(input, pool), pool); - case ARRAY: // Array - input.read_be(index); - for (int i = 0; i < index; i++) - { - vals.push_back(element_value::readElementValue(input, pool)); - } - return new element_value_array(ARRAY, vals, pool); - default: - throw new java::classfile_exception(); - } -} -} \ No newline at end of file diff --git a/depends/classparser/src/annotations.h b/depends/classparser/src/annotations.h deleted file mode 100644 index aa25d241..00000000 --- a/depends/classparser/src/annotations.h +++ /dev/null @@ -1,277 +0,0 @@ -#pragma once -#include "classfile.h" -#include -#include - -namespace java -{ -enum element_value_type : uint8_t -{ - INVALID = 0, - STRING = 's', - ENUM_CONSTANT = 'e', - CLASS = 'c', - ANNOTATION = '@', - ARRAY = '[', // one array dimension - PRIMITIVE_INT = 'I', // integer - PRIMITIVE_BYTE = 'B', // signed byte - PRIMITIVE_CHAR = 'C', // Unicode character code point in the Basic Multilingual Plane, - // encoded with UTF-16 - PRIMITIVE_DOUBLE = 'D', // double-precision floating-point value - PRIMITIVE_FLOAT = 'F', // single-precision floating-point value - PRIMITIVE_LONG = 'J', // long integer - PRIMITIVE_SHORT = 'S', // signed short - PRIMITIVE_BOOLEAN = 'Z' // true or false -}; -/** - * The element_value structure is a discriminated union representing the value of an - *element-value pair. - * It is used to represent element values in all attributes that describe annotations - * - RuntimeVisibleAnnotations - * - RuntimeInvisibleAnnotations - * - RuntimeVisibleParameterAnnotations - * - RuntimeInvisibleParameterAnnotations). - * - * The element_value structure has the following format: - */ -class element_value -{ -protected: - element_value_type type; - constant_pool &pool; - -public: - element_value(element_value_type type, constant_pool &pool) : type(type), pool(pool) {}; - - element_value_type getElementValueType() - { - return type; - } - - virtual std::string toString() = 0; - - static element_value *readElementValue(util::membuffer &input, constant_pool &pool); -}; - -/** - * Each value of the annotations table represents a single runtime-visible annotation on a - * program element. - * The annotation structure has the following format: - */ -class annotation -{ -public: - typedef std::vector> value_list; - -protected: - /** - * The value of the type_index item must be a valid index into the constant_pool table. - * The constant_pool entry at that index must be a CONSTANT_Utf8_info (§4.4.7) structure - * representing a field descriptor representing the annotation type corresponding - * to the annotation represented by this annotation structure. - */ - uint16_t type_index; - /** - * map between element_name_index and value. - * - * The value of the element_name_index item must be a valid index into the constant_pool - *table. - * The constant_pool entry at that index must be a CONSTANT_Utf8_info (§4.4.7) structure - *representing - * a valid field descriptor (§4.3.2) that denotes the name of the annotation type element - *represented - * by this element_value_pairs entry. - */ - value_list name_val_pairs; - /** - * Reference to the parent constant pool - */ - constant_pool &pool; - -public: - annotation(uint16_t type_index, constant_pool &pool) - : type_index(type_index), pool(pool) {}; - ~annotation() - { - for (unsigned i = 0; i < name_val_pairs.size(); i++) - { - delete name_val_pairs[i].second; - } - } - void add_pair(uint16_t key, element_value *value) - { - name_val_pairs.push_back(std::make_pair(key, value)); - } - ; - value_list::const_iterator begin() - { - return name_val_pairs.cbegin(); - } - value_list::const_iterator end() - { - return name_val_pairs.cend(); - } - std::string toString(); - static annotation *read(util::membuffer &input, constant_pool &pool); -}; -typedef std::vector annotation_table; - -/// type for simple value annotation elements -class element_value_simple : public element_value -{ -protected: - /// index of the constant in the constant pool - uint16_t index; - -public: - element_value_simple(element_value_type type, uint16_t index, constant_pool &pool) - : element_value(type, pool), index(index) { - // TODO: verify consistency - }; - uint16_t getIndex() - { - return index; - } - virtual std::string toString() - { - return pool[index].toString(); - } - ; -}; -/// The enum_const_value item is used if the tag item is 'e'. -class element_value_enum : public element_value -{ -protected: - /** - * The value of the type_name_index item must be a valid index into the constant_pool table. - * The constant_pool entry at that index must be a CONSTANT_Utf8_info (§4.4.7) structure - * representing a valid field descriptor (§4.3.2) that denotes the internal form of the - * binary - * name (§4.2.1) of the type of the enum constant represented by this element_value - * structure. - */ - uint16_t typeIndex; - /** - * The value of the const_name_index item must be a valid index into the constant_pool - * table. - * The constant_pool entry at that index must be a CONSTANT_Utf8_info (§4.4.7) structure - * representing the simple name of the enum constant represented by this element_value - * structure. - */ - uint16_t valueIndex; - -public: - element_value_enum(element_value_type type, uint16_t typeIndex, uint16_t valueIndex, - constant_pool &pool) - : element_value(type, pool), typeIndex(typeIndex), valueIndex(valueIndex) - { - // TODO: verify consistency - } - uint16_t getValueIndex() - { - return valueIndex; - } - uint16_t getTypeIndex() - { - return typeIndex; - } - virtual std::string toString() - { - return "enum value"; - } - ; -}; - -class element_value_class : public element_value -{ -protected: - /** - * The class_info_index item must be a valid index into the constant_pool table. - * The constant_pool entry at that index must be a CONSTANT_Utf8_info (§4.4.7) structure - * representing the return descriptor (§4.3.3) of the type that is reified by the class - * represented by this element_value structure. - * - * For example, 'V' for Void.class, 'Ljava/lang/Object;' for Object, etc. - * - * Or in plain english, you can store type information in annotations. Yay. - */ - uint16_t classIndex; - -public: - element_value_class(element_value_type type, uint16_t classIndex, constant_pool &pool) - : element_value(type, pool), classIndex(classIndex) - { - // TODO: verify consistency - } - uint16_t getIndex() - { - return classIndex; - } - virtual std::string toString() - { - return "class"; - } - ; -}; - -/// nested annotations... yay -class element_value_annotation : public element_value -{ -private: - annotation *nestedAnnotation; - -public: - element_value_annotation(element_value_type type, annotation *nestedAnnotation, - constant_pool &pool) - : element_value(type, pool), nestedAnnotation(nestedAnnotation) {}; - ~element_value_annotation() - { - if (nestedAnnotation) - { - delete nestedAnnotation; - nestedAnnotation = nullptr; - } - } - virtual std::string toString() - { - return "nested annotation"; - } - ; -}; - -/// and arrays! -class element_value_array : public element_value -{ -public: - typedef std::vector elem_vec; - -protected: - elem_vec values; - -public: - element_value_array(element_value_type type, std::vector &values, - constant_pool &pool) - : element_value(type, pool), values(values) {}; - ~element_value_array() - { - for (unsigned i = 0; i < values.size(); i++) - { - delete values[i]; - } - } - ; - elem_vec::const_iterator begin() - { - return values.cbegin(); - } - elem_vec::const_iterator end() - { - return values.cend(); - } - virtual std::string toString() - { - return "array"; - } - ; -}; -} \ No newline at end of file diff --git a/depends/classparser/src/classfile.h b/depends/classparser/src/classfile.h deleted file mode 100644 index a5e7ee50..00000000 --- a/depends/classparser/src/classfile.h +++ /dev/null @@ -1,156 +0,0 @@ -#pragma once -#include "membuffer.h" -#include "constants.h" -#include "annotations.h" -#include -namespace java -{ -/** - * Class representing a Java .class file - */ -class classfile : public util::membuffer -{ -public: - classfile(char *data, std::size_t size) : membuffer(data, size) - { - valid = false; - is_synthetic = false; - read_be(magic); - if (magic != 0xCAFEBABE) - throw new classfile_exception(); - read_be(minor_version); - read_be(major_version); - constants.load(*this); - read_be(access_flags); - read_be(this_class); - read_be(super_class); - - // Interfaces - uint16_t iface_count = 0; - read_be(iface_count); - while (iface_count) - { - uint16_t iface; - read_be(iface); - interfaces.push_back(iface); - iface_count--; - } - - // Fields - // read fields (and attributes from inside fields) (and possible inner classes. yay for - // recursion!) - // for now though, we will ignore all attributes - /* - * field_info - * { - * u2 access_flags; - * u2 name_index; - * u2 descriptor_index; - * u2 attributes_count; - * attribute_info attributes[attributes_count]; - * } - */ - uint16_t field_count = 0; - read_be(field_count); - while (field_count) - { - // skip field stuff - skip(6); - // and skip field attributes - uint16_t attr_count = 0; - read_be(attr_count); - while (attr_count) - { - skip(2); - uint32_t attr_length = 0; - read_be(attr_length); - skip(attr_length); - attr_count--; - } - field_count--; - } - - // class methods - /* - * method_info - * { - * u2 access_flags; - * u2 name_index; - * u2 descriptor_index; - * u2 attributes_count; - * attribute_info attributes[attributes_count]; - * } - */ - uint16_t method_count = 0; - read_be(method_count); - while (method_count) - { - skip(6); - // and skip method attributes - uint16_t attr_count = 0; - read_be(attr_count); - while (attr_count) - { - skip(2); - uint32_t attr_length = 0; - read_be(attr_length); - skip(attr_length); - attr_count--; - } - method_count--; - } - - // class attributes - // there are many kinds of attributes. this is just the generic wrapper structure. - // type is decided by attribute name. extensions to the standard are *possible* - // class annotations are one kind of a attribute (one per class) - /* - * attribute_info - * { - * u2 attribute_name_index; - * u4 attribute_length; - * u1 info[attribute_length]; - * } - */ - uint16_t class_attr_count = 0; - read_be(class_attr_count); - while (class_attr_count) - { - uint16_t name_idx = 0; - read_be(name_idx); - uint32_t attr_length = 0; - read_be(attr_length); - - auto name = constants[name_idx]; - if (name.str_data == "RuntimeVisibleAnnotations") - { - uint16_t num_annotations = 0; - read_be(num_annotations); - while (num_annotations) - { - visible_class_annotations.push_back(annotation::read(*this, constants)); - num_annotations--; - } - } - else - skip(attr_length); - class_attr_count--; - } - valid = true; - } - ; - bool valid; - bool is_synthetic; - uint32_t magic; - uint16_t minor_version; - uint16_t major_version; - constant_pool constants; - uint16_t access_flags; - uint16_t this_class; - uint16_t super_class; - // interfaces this class implements ? must be. investigate. - std::vector interfaces; - // FIXME: doesn't free up memory on delete - java::annotation_table visible_class_annotations; -}; -} \ No newline at end of file diff --git a/depends/classparser/src/constants.h b/depends/classparser/src/constants.h deleted file mode 100644 index 242b943e..00000000 --- a/depends/classparser/src/constants.h +++ /dev/null @@ -1,220 +0,0 @@ -#pragma once -#include "errors.h" -#include - -namespace java -{ -class constant -{ -public: - enum type_t : uint8_t - { - j_hole = 0, // HACK: this is a hole in the array, because java is crazy - j_string_data = 1, - j_int = 3, - j_float = 4, - j_long = 5, - j_double = 6, - j_class = 7, - j_string = 8, - j_fieldref = 9, - j_methodref = 10, - j_interface_methodref = 11, - j_nameandtype = 12 - } type; - - constant(util::membuffer &buf) - { - buf.read(type); - // invalid constant type! - if (type > j_nameandtype || type == (type_t)0 || type == (type_t)2) - throw new classfile_exception(); - - // load data depending on type - switch (type) - { - case j_float: - case j_int: - buf.read_be(int_data); // same as float data really - break; - case j_double: - case j_long: - buf.read_be(long_data); // same as double - break; - case j_class: - buf.read_be(ref_type.class_idx); - break; - case j_fieldref: - case j_methodref: - case j_interface_methodref: - buf.read_be(ref_type.class_idx); - buf.read_be(ref_type.name_and_type_idx); - break; - case j_string: - buf.read_be(index); - break; - case j_string_data: - // HACK HACK: for now, we call these UTF-8 and do no further processing. - // Later, we should do some decoding. It's really modified UTF-8 - // * U+0000 is represented as 0xC0,0x80 invalid character - // * any single zero byte ends the string - // * characters above U+10000 are encoded like in CESU-8 - buf.read_jstr(str_data); - break; - case j_nameandtype: - buf.read_be(name_and_type.name_index); - buf.read_be(name_and_type.descriptor_index); - break; - } - } - - constant(int fake) - { - type = j_hole; - } - - std::string toString() - { - std::ostringstream ss; - switch (type) - { - case j_hole: - ss << "Fake legacy entry"; - break; - case j_float: - ss << "Float: " << float_data; - break; - case j_double: - ss << "Double: " << double_data; - break; - case j_int: - ss << "Int: " << int_data; - break; - case j_long: - ss << "Long: " << long_data; - break; - case j_string_data: - ss << "StrData: " << str_data; - break; - case j_string: - ss << "Str: " << index; - break; - case j_fieldref: - ss << "FieldRef: " << ref_type.class_idx << " " << ref_type.name_and_type_idx; - break; - case j_methodref: - ss << "MethodRef: " << ref_type.class_idx << " " << ref_type.name_and_type_idx; - break; - case j_interface_methodref: - ss << "IfMethodRef: " << ref_type.class_idx << " " << ref_type.name_and_type_idx; - break; - case j_class: - ss << "Class: " << ref_type.class_idx; - break; - case j_nameandtype: - ss << "NameAndType: " << name_and_type.name_index << " " - << name_and_type.descriptor_index; - break; - } - return ss.str(); - } - - std::string str_data; /** String data in 'modified utf-8'.*/ - // store everything here. - union - { - int32_t int_data; - int64_t long_data; - float float_data; - double double_data; - uint16_t index; - struct - { - /** - * Class reference: - * an index within the constant pool to a UTF-8 string containing - * the fully qualified class name (in internal format) - * Used for j_class, j_fieldref, j_methodref and j_interface_methodref - */ - uint16_t class_idx; - // used for j_fieldref, j_methodref and j_interface_methodref - uint16_t name_and_type_idx; - } ref_type; - struct - { - uint16_t name_index; - uint16_t descriptor_index; - } name_and_type; - }; -}; - -/** - * A helper class that represents the custom container used in Java class file for storage of - * constants - */ -class constant_pool -{ -public: - /** - * Create a pool of constants - */ - constant_pool() - { - } - /** - * Load a java constant pool - */ - void load(util::membuffer &buf) - { - uint16_t length = 0; - buf.read_be(length); - length--; - uint16_t index = 1; - const constant *last_constant = nullptr; - while (length) - { - const constant &cnst = constant(buf); - constants.push_back(cnst); - last_constant = &constants[constants.size() - 1]; - if (last_constant->type == constant::j_double || - last_constant->type == constant::j_long) - { - // push in a fake constant to preserve indexing - constants.push_back(constant(0)); - length -= 2; - index += 2; - } - else - { - length--; - index++; - } - } - } - typedef std::vector container_type; - /** - * Access constants based on jar file index numbers (index of the first element is 1) - */ - java::constant &operator[](std::size_t constant_index) - { - if (constant_index == 0 || constant_index > constants.size()) - { - throw new classfile_exception(); - } - return constants[constant_index - 1]; - } - ; - container_type::const_iterator begin() const - { - return constants.begin(); - } - ; - container_type::const_iterator end() const - { - return constants.end(); - } - -private: - container_type constants; -}; -} diff --git a/depends/classparser/src/errors.h b/depends/classparser/src/errors.h deleted file mode 100644 index ddbbd828..00000000 --- a/depends/classparser/src/errors.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include -namespace java -{ -class classfile_exception : public std::exception -{ -}; -} diff --git a/depends/classparser/src/javaendian.h b/depends/classparser/src/javaendian.h deleted file mode 100644 index d488b382..00000000 --- a/depends/classparser/src/javaendian.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include - -/** - * Swap bytes between big endian and local number representation - */ -namespace util -{ -#ifdef MULTIMC_BIG_ENDIAN -inline uint64_t bigswap(uint64_t x) -{ - return x; -} -; -inline uint32_t bigswap(uint32_t x) -{ - return x; -} -; -inline uint16_t bigswap(uint16_t x) -{ - return x; -} -; -inline int64_t bigswap(int64_t x) -{ - return x; -} -; -inline int32_t bigswap(int32_t x) -{ - return x; -} -; -inline int16_t bigswap(int16_t x) -{ - return x; -} -; -#else -inline uint64_t bigswap(uint64_t x) -{ - return (x >> 56) | ((x << 40) & 0x00FF000000000000) | ((x << 24) & 0x0000FF0000000000) | - ((x << 8) & 0x000000FF00000000) | ((x >> 8) & 0x00000000FF000000) | - ((x >> 24) & 0x0000000000FF0000) | ((x >> 40) & 0x000000000000FF00) | (x << 56); -} -; -inline uint32_t bigswap(uint32_t x) -{ - return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24); -} -; -inline uint16_t bigswap(uint16_t x) -{ - return (x >> 8) | (x << 8); -} -; -inline int64_t bigswap(int64_t x) -{ - return (x >> 56) | ((x << 40) & 0x00FF000000000000) | ((x << 24) & 0x0000FF0000000000) | - ((x << 8) & 0x000000FF00000000) | ((x >> 8) & 0x00000000FF000000) | - ((x >> 24) & 0x0000000000FF0000) | ((x >> 40) & 0x000000000000FF00) | (x << 56); -} -; -inline int32_t bigswap(int32_t x) -{ - return (x >> 24) | ((x << 8) & 0x00FF0000) | ((x >> 8) & 0x0000FF00) | (x << 24); -} -; -inline int16_t bigswap(int16_t x) -{ - return (x >> 8) | (x << 8); -} -; -#endif -} diff --git a/depends/classparser/src/javautils.cpp b/depends/classparser/src/javautils.cpp deleted file mode 100644 index f9310e5f..00000000 --- a/depends/classparser/src/javautils.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2013-2015 MultiMC Contributors - * - * Authors: Orochimarufan - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "classfile.h" -#include "javautils.h" - -#include -#include - -namespace javautils -{ - -QString GetMinecraftJarVersion(QString jarName) -{ - QString version = MCVer_Unknown; - - // check if minecraft.jar exists - QFile jar(jarName); - if (!jar.exists()) - return version; - - // open minecraft.jar - QuaZip zip(&jar); - if (!zip.open(QuaZip::mdUnzip)) - return version; - - // open Minecraft.class - zip.setCurrentFile("net/minecraft/client/Minecraft.class", QuaZip::csSensitive); - QuaZipFile Minecraft(&zip); - if (!Minecraft.open(QuaZipFile::ReadOnly)) - return version; - - // read Minecraft.class - qint64 size = Minecraft.size(); - char *classfile = new char[size]; - Minecraft.read(classfile, size); - - // parse Minecraft.class - try - { - char *temp = classfile; - java::classfile MinecraftClass(temp, size); - java::constant_pool constants = MinecraftClass.constants; - for (java::constant_pool::container_type::const_iterator iter = constants.begin(); - iter != constants.end(); iter++) - { - const java::constant &constant = *iter; - if (constant.type != java::constant::j_string_data) - continue; - const std::string &str = constant.str_data; - if (str.compare(0, 20, "Minecraft Minecraft ") == 0) - { - version = str.substr(20).data(); - break; - } - } - } - catch (java::classfile_exception &) - { - } - - // clean up - delete[] classfile; - Minecraft.close(); - zip.close(); - jar.close(); - - return version; -} -} diff --git a/depends/classparser/src/membuffer.h b/depends/classparser/src/membuffer.h deleted file mode 100644 index ab83412a..00000000 --- a/depends/classparser/src/membuffer.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include "javaendian.h" - -namespace util -{ -class membuffer -{ -public: - membuffer(char *buffer, std::size_t size) - { - current = start = buffer; - end = start + size; - } - ~membuffer() - { - // maybe? possibly? left out to avoid confusion. for now. - // delete start; - } - /** - * Read some value. That's all ;) - */ - template void read(T &val) - { - val = *(T *)current; - current += sizeof(T); - } - /** - * Read a big-endian number - * valid for 2-byte, 4-byte and 8-byte variables - */ - template void read_be(T &val) - { - val = util::bigswap(*(T *)current); - current += sizeof(T); - } - /** - * Read a string in the format: - * 2B length (big endian, unsigned) - * length bytes data - */ - void read_jstr(std::string &str) - { - uint16_t length = 0; - read_be(length); - str.append(current, length); - current += length; - } - /** - * Skip N bytes - */ - void skip(std::size_t N) - { - current += N; - } - -private: - char *start, *end, *current; -}; -} diff --git a/depends/hoedown/CMakeLists.txt b/depends/hoedown/CMakeLists.txt deleted file mode 100644 index 7902e734..00000000 --- a/depends/hoedown/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# hoedown 3.0.2 - https://github.com/hoedown/hoedown/archive/3.0.2.tar.gz -project(hoedown LANGUAGES C VERSION 3.0.2) - -set(HOEDOWN_SOURCES -include/hoedown/autolink.h -include/hoedown/buffer.h -include/hoedown/document.h -include/hoedown/escape.h -include/hoedown/html.h -include/hoedown/stack.h -include/hoedown/version.h -src/autolink.c -src/buffer.c -src/document.c -src/escape.c -src/html.c -src/html_blocks.c -src/html_smartypants.c -src/stack.c -src/version.c -) - -# Include self. -add_library(hoedown STATIC ${HOEDOWN_SOURCES}) - -target_include_directories(hoedown PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/depends/hoedown/LICENSE b/depends/hoedown/LICENSE deleted file mode 100644 index 4e75de4d..00000000 --- a/depends/hoedown/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -Copyright (c) 2008, Natacha Porté -Copyright (c) 2011, Vicent Martí -Copyright (c) 2014, Xavier Mendez, Devin Torres and the Hoedown authors - -Permission to use, copy, modify, and distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/depends/hoedown/README.md b/depends/hoedown/README.md deleted file mode 100644 index abe2b6ca..00000000 --- a/depends/hoedown/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Hoedown -======= - -This is Hoedown 3.0.2, taken from [the hoedown github repo](https://github.com/hoedown/hoedown). - -`Hoedown` is a revived fork of [Sundown](https://github.com/vmg/sundown), -the Markdown parser based on the original code of the -[Upskirt library](http://fossil.instinctive.eu/libupskirt/index) -by Natacha Porté. diff --git a/depends/hoedown/include/hoedown/autolink.h b/depends/hoedown/include/hoedown/autolink.h deleted file mode 100644 index 528885c9..00000000 --- a/depends/hoedown/include/hoedown/autolink.h +++ /dev/null @@ -1,46 +0,0 @@ -/* autolink.h - versatile autolinker */ - -#ifndef HOEDOWN_AUTOLINK_H -#define HOEDOWN_AUTOLINK_H - -#include "buffer.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/************* - * CONSTANTS * - *************/ - -typedef enum hoedown_autolink_flags { - HOEDOWN_AUTOLINK_SHORT_DOMAINS = (1 << 0) -} hoedown_autolink_flags; - - -/************* - * FUNCTIONS * - *************/ - -/* hoedown_autolink_is_safe: verify that a URL has a safe protocol */ -int hoedown_autolink_is_safe(const uint8_t *data, size_t size); - -/* hoedown_autolink__www: search for the next www link in data */ -size_t hoedown_autolink__www(size_t *rewind_p, hoedown_buffer *link, - uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); - -/* hoedown_autolink__email: search for the next email in data */ -size_t hoedown_autolink__email(size_t *rewind_p, hoedown_buffer *link, - uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); - -/* hoedown_autolink__url: search for the next URL in data */ -size_t hoedown_autolink__url(size_t *rewind_p, hoedown_buffer *link, - uint8_t *data, size_t offset, size_t size, hoedown_autolink_flags flags); - - -#ifdef __cplusplus -} -#endif - -#endif /** HOEDOWN_AUTOLINK_H **/ diff --git a/depends/hoedown/include/hoedown/buffer.h b/depends/hoedown/include/hoedown/buffer.h deleted file mode 100644 index d7703f8d..00000000 --- a/depends/hoedown/include/hoedown/buffer.h +++ /dev/null @@ -1,134 +0,0 @@ -/* buffer.h - simple, fast buffers */ - -#ifndef HOEDOWN_BUFFER_H -#define HOEDOWN_BUFFER_H - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_MSC_VER) -#define __attribute__(x) -#define inline __inline -#define __builtin_expect(x,n) x -#endif - - -/********* - * TYPES * - *********/ - -typedef void *(*hoedown_realloc_callback)(void *, size_t); -typedef void (*hoedown_free_callback)(void *); - -struct hoedown_buffer { - uint8_t *data; /* actual character data */ - size_t size; /* size of the string */ - size_t asize; /* allocated size (0 = volatile buffer) */ - size_t unit; /* reallocation unit size (0 = read-only buffer) */ - - hoedown_realloc_callback data_realloc; - hoedown_free_callback data_free; - hoedown_free_callback buffer_free; -}; - -typedef struct hoedown_buffer hoedown_buffer; - - -/************* - * FUNCTIONS * - *************/ - -/* allocation wrappers */ -void *hoedown_malloc(size_t size) __attribute__ ((malloc)); -void *hoedown_calloc(size_t nmemb, size_t size) __attribute__ ((malloc)); -void *hoedown_realloc(void *ptr, size_t size) __attribute__ ((malloc)); - -/* hoedown_buffer_init: initialize a buffer with custom allocators */ -void hoedown_buffer_init( - hoedown_buffer *buffer, - size_t unit, - hoedown_realloc_callback data_realloc, - hoedown_free_callback data_free, - hoedown_free_callback buffer_free -); - -/* hoedown_buffer_uninit: uninitialize an existing buffer */ -void hoedown_buffer_uninit(hoedown_buffer *buf); - -/* hoedown_buffer_new: allocate a new buffer */ -hoedown_buffer *hoedown_buffer_new(size_t unit) __attribute__ ((malloc)); - -/* hoedown_buffer_reset: free internal data of the buffer */ -void hoedown_buffer_reset(hoedown_buffer *buf); - -/* hoedown_buffer_grow: increase the allocated size to the given value */ -void hoedown_buffer_grow(hoedown_buffer *buf, size_t neosz); - -/* hoedown_buffer_put: append raw data to a buffer */ -void hoedown_buffer_put(hoedown_buffer *buf, const uint8_t *data, size_t size); - -/* hoedown_buffer_puts: append a NUL-terminated string to a buffer */ -void hoedown_buffer_puts(hoedown_buffer *buf, const char *str); - -/* hoedown_buffer_putc: append a single char to a buffer */ -void hoedown_buffer_putc(hoedown_buffer *buf, uint8_t c); - -/* hoedown_buffer_putf: read from a file and append to a buffer, until EOF or error */ -int hoedown_buffer_putf(hoedown_buffer *buf, FILE* file); - -/* hoedown_buffer_set: replace the buffer's contents with raw data */ -void hoedown_buffer_set(hoedown_buffer *buf, const uint8_t *data, size_t size); - -/* hoedown_buffer_sets: replace the buffer's contents with a NUL-terminated string */ -void hoedown_buffer_sets(hoedown_buffer *buf, const char *str); - -/* hoedown_buffer_eq: compare a buffer's data with other data for equality */ -int hoedown_buffer_eq(const hoedown_buffer *buf, const uint8_t *data, size_t size); - -/* hoedown_buffer_eq: compare a buffer's data with NUL-terminated string for equality */ -int hoedown_buffer_eqs(const hoedown_buffer *buf, const char *str); - -/* hoedown_buffer_prefix: compare the beginning of a buffer with a string */ -int hoedown_buffer_prefix(const hoedown_buffer *buf, const char *prefix); - -/* hoedown_buffer_slurp: remove a given number of bytes from the head of the buffer */ -void hoedown_buffer_slurp(hoedown_buffer *buf, size_t size); - -/* hoedown_buffer_cstr: NUL-termination of the string array (making a C-string) */ -const char *hoedown_buffer_cstr(hoedown_buffer *buf); - -/* hoedown_buffer_printf: formatted printing to a buffer */ -void hoedown_buffer_printf(hoedown_buffer *buf, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); - -/* hoedown_buffer_put_utf8: put a Unicode character encoded as UTF-8 */ -void hoedown_buffer_put_utf8(hoedown_buffer *buf, unsigned int codepoint); - -/* hoedown_buffer_free: free the buffer */ -void hoedown_buffer_free(hoedown_buffer *buf); - - -/* HOEDOWN_BUFPUTSL: optimized hoedown_buffer_puts of a string literal */ -#define HOEDOWN_BUFPUTSL(output, literal) \ - hoedown_buffer_put(output, (const uint8_t *)literal, sizeof(literal) - 1) - -/* HOEDOWN_BUFSETSL: optimized hoedown_buffer_sets of a string literal */ -#define HOEDOWN_BUFSETSL(output, literal) \ - hoedown_buffer_set(output, (const uint8_t *)literal, sizeof(literal) - 1) - -/* HOEDOWN_BUFEQSL: optimized hoedown_buffer_eqs of a string literal */ -#define HOEDOWN_BUFEQSL(output, literal) \ - hoedown_buffer_eq(output, (const uint8_t *)literal, sizeof(literal) - 1) - - -#ifdef __cplusplus -} -#endif - -#endif /** HOEDOWN_BUFFER_H **/ diff --git a/depends/hoedown/include/hoedown/document.h b/depends/hoedown/include/hoedown/document.h deleted file mode 100644 index a8178fec..00000000 --- a/depends/hoedown/include/hoedown/document.h +++ /dev/null @@ -1,172 +0,0 @@ -/* document.h - generic markdown parser */ - -#ifndef HOEDOWN_DOCUMENT_H -#define HOEDOWN_DOCUMENT_H - -#include "buffer.h" -#include "autolink.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/************* - * CONSTANTS * - *************/ - -typedef enum hoedown_extensions { - /* block-level extensions */ - HOEDOWN_EXT_TABLES = (1 << 0), - HOEDOWN_EXT_FENCED_CODE = (1 << 1), - HOEDOWN_EXT_FOOTNOTES = (1 << 2), - - /* span-level extensions */ - HOEDOWN_EXT_AUTOLINK = (1 << 3), - HOEDOWN_EXT_STRIKETHROUGH = (1 << 4), - HOEDOWN_EXT_UNDERLINE = (1 << 5), - HOEDOWN_EXT_HIGHLIGHT = (1 << 6), - HOEDOWN_EXT_QUOTE = (1 << 7), - HOEDOWN_EXT_SUPERSCRIPT = (1 << 8), - HOEDOWN_EXT_MATH = (1 << 9), - - /* other flags */ - HOEDOWN_EXT_NO_INTRA_EMPHASIS = (1 << 11), - HOEDOWN_EXT_SPACE_HEADERS = (1 << 12), - HOEDOWN_EXT_MATH_EXPLICIT = (1 << 13), - - /* negative flags */ - HOEDOWN_EXT_DISABLE_INDENTED_CODE = (1 << 14) -} hoedown_extensions; - -#define HOEDOWN_EXT_BLOCK (\ - HOEDOWN_EXT_TABLES |\ - HOEDOWN_EXT_FENCED_CODE |\ - HOEDOWN_EXT_FOOTNOTES ) - -#define HOEDOWN_EXT_SPAN (\ - HOEDOWN_EXT_AUTOLINK |\ - HOEDOWN_EXT_STRIKETHROUGH |\ - HOEDOWN_EXT_UNDERLINE |\ - HOEDOWN_EXT_HIGHLIGHT |\ - HOEDOWN_EXT_QUOTE |\ - HOEDOWN_EXT_SUPERSCRIPT |\ - HOEDOWN_EXT_MATH ) - -#define HOEDOWN_EXT_FLAGS (\ - HOEDOWN_EXT_NO_INTRA_EMPHASIS |\ - HOEDOWN_EXT_SPACE_HEADERS |\ - HOEDOWN_EXT_MATH_EXPLICIT ) - -#define HOEDOWN_EXT_NEGATIVE (\ - HOEDOWN_EXT_DISABLE_INDENTED_CODE ) - -typedef enum hoedown_list_flags { - HOEDOWN_LIST_ORDERED = (1 << 0), - HOEDOWN_LI_BLOCK = (1 << 1) /*
  • containing block data */ -} hoedown_list_flags; - -typedef enum hoedown_table_flags { - HOEDOWN_TABLE_ALIGN_LEFT = 1, - HOEDOWN_TABLE_ALIGN_RIGHT = 2, - HOEDOWN_TABLE_ALIGN_CENTER = 3, - HOEDOWN_TABLE_ALIGNMASK = 3, - HOEDOWN_TABLE_HEADER = 4 -} hoedown_table_flags; - -typedef enum hoedown_autolink_type { - HOEDOWN_AUTOLINK_NONE, /* used internally when it is not an autolink*/ - HOEDOWN_AUTOLINK_NORMAL, /* normal http/http/ftp/mailto/etc link */ - HOEDOWN_AUTOLINK_EMAIL /* e-mail link without explit mailto: */ -} hoedown_autolink_type; - - -/********* - * TYPES * - *********/ - -struct hoedown_document; -typedef struct hoedown_document hoedown_document; - -struct hoedown_renderer_data { - void *opaque; -}; -typedef struct hoedown_renderer_data hoedown_renderer_data; - -/* hoedown_renderer - functions for rendering parsed data */ -struct hoedown_renderer { - /* state object */ - void *opaque; - - /* block level callbacks - NULL skips the block */ - void (*blockcode)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_buffer *lang, const hoedown_renderer_data *data); - void (*blockquote)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*header)(hoedown_buffer *ob, const hoedown_buffer *content, int level, const hoedown_renderer_data *data); - void (*hrule)(hoedown_buffer *ob, const hoedown_renderer_data *data); - void (*list)(hoedown_buffer *ob, const hoedown_buffer *content, hoedown_list_flags flags, const hoedown_renderer_data *data); - void (*listitem)(hoedown_buffer *ob, const hoedown_buffer *content, hoedown_list_flags flags, const hoedown_renderer_data *data); - void (*paragraph)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*table)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*table_header)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*table_body)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*table_row)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*table_cell)(hoedown_buffer *ob, const hoedown_buffer *content, hoedown_table_flags flags, const hoedown_renderer_data *data); - void (*footnotes)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - void (*footnote_def)(hoedown_buffer *ob, const hoedown_buffer *content, unsigned int num, const hoedown_renderer_data *data); - void (*blockhtml)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_renderer_data *data); - - /* span level callbacks - NULL or return 0 prints the span verbatim */ - int (*autolink)(hoedown_buffer *ob, const hoedown_buffer *link, hoedown_autolink_type type, const hoedown_renderer_data *data); - int (*codespan)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_renderer_data *data); - int (*double_emphasis)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*emphasis)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*underline)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*highlight)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*quote)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*image)(hoedown_buffer *ob, const hoedown_buffer *link, const hoedown_buffer *title, const hoedown_buffer *alt, const hoedown_renderer_data *data); - int (*linebreak)(hoedown_buffer *ob, const hoedown_renderer_data *data); - int (*link)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_buffer *link, const hoedown_buffer *title, const hoedown_renderer_data *data); - int (*triple_emphasis)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*strikethrough)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*superscript)(hoedown_buffer *ob, const hoedown_buffer *content, const hoedown_renderer_data *data); - int (*footnote_ref)(hoedown_buffer *ob, unsigned int num, const hoedown_renderer_data *data); - int (*math)(hoedown_buffer *ob, const hoedown_buffer *text, int displaymode, const hoedown_renderer_data *data); - int (*raw_html)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_renderer_data *data); - - /* low level callbacks - NULL copies input directly into the output */ - void (*entity)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_renderer_data *data); - void (*normal_text)(hoedown_buffer *ob, const hoedown_buffer *text, const hoedown_renderer_data *data); - - /* miscellaneous callbacks */ - void (*doc_header)(hoedown_buffer *ob, int inline_render, const hoedown_renderer_data *data); - void (*doc_footer)(hoedown_buffer *ob, int inline_render, const hoedown_renderer_data *data); -}; -typedef struct hoedown_renderer hoedown_renderer; - - -/************* - * FUNCTIONS * - *************/ - -/* hoedown_document_new: allocate a new document processor instance */ -hoedown_document *hoedown_document_new( - const hoedown_renderer *renderer, - hoedown_extensions extensions, - size_t max_nesting -) __attribute__ ((malloc)); - -/* hoedown_document_render: render regular Markdown using the document processor */ -void hoedown_document_render(hoedown_document *doc, hoedown_buffer *ob, const uint8_t *data, size_t size); - -/* hoedown_document_render_inline: render inline Markdown using the document processor */ -void hoedown_document_render_inline(hoedown_document *doc, hoedown_buffer *ob, const uint8_t *data, size_t size); - -/* hoedown_document_free: deallocate a document processor instance */ -void hoedown_document_free(hoedown_document *doc); - - -#ifdef __cplusplus -} -#endif - -#endif /** HOEDOWN_DOCUMENT_H **/ diff --git a/depends/hoedown/include/hoedown/escape.h b/depends/hoedown/include/hoedow