text:
#if defined(MUPARSER_DLL)

#if defined(_WIN32)
	#define WIN32_LEAN_AND_MEAN
	#define _CRT_SECURE_NO_WARNINGS
	#define _CRT_SECURE_NO_DEPRECATE

	#include <windows.h>
#endif

#include <cassert>

#include "muParserDLL.h"
#include "muParser.h"
#include "muParserInt.h"
#include "muParserError.h"

#if _UNICODE
	#include <wchar.h>
#endif

#if defined(_MSC_VER)
	#pragma warning(push)
	#pragma warning(disable : 26812)
#endif

#define MU_TRY  \
		try		\
        {

#define MU_CATCH							                       \
        }								                           \
        catch (muError_t &e)		                               \
        {						                                   \
	        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
			pTag->exc = e;                                         \
			pTag->bError = true;                                   \
			if (pTag->errHandler)                                  \
				(pTag->errHandler)(a_hParser);                     \
        }					                                       \
        catch (...)		                                           \
        {		                                                   \
	        ParserTag *pTag = static_cast<ParserTag*>(a_hParser);  \
	        pTag->exc = muError_t(mu::ecINTERNAL_ERROR);           \
	        pTag->bError = true;                                   \
			if (pTag->errHandler)                                  \
				(pTag->errHandler)(a_hParser);                     \
        }

/** \file
	\brief This file contains the implementation of the DLL interface of muparser.
*/

typedef mu::ParserBase::exception_type muError_t;
typedef mu::ParserBase muParser_t;
int g_nBulkSize;

class ParserTag
{
public:
	ParserTag(int nType)
		: pParser((nType == muBASETYPE_FLOAT)
			? (mu::ParserBase*)new mu::Parser()
			: (nType == muBASETYPE_INT) ? (mu::ParserBase*)new mu::ParserInt() : nullptr)
		, exc()
		, errHandler(nullptr)
		, bError(false)
		, m_nParserType(nType)
	{}

	~ParserTag()
	{
		delete pParser;
	}

	mu::ParserBase* pParser;
	mu::ParserBase::exception_type exc;
	muErrorHandler_t errHandler;
	bool bError;

private:
	ParserTag(const ParserTag& ref);
	ParserTag& operator=(const ParserTag& ref);

	int m_nParserType;
};

static muChar_t s_tmpOutBuf[2048];

template <typename T>
constexpr std::size_t count_of(const T& array)
{
	return (sizeof(array) / sizeof(array[0]));
}

//---------------------------------------------------------------------------
//
//
//  unexported functions
//
//
//---------------------------------------------------------------------------

inline muParser_t* AsParser(muParserHandle_t a_hParser)
{
	return static_cast<ParserTag*>(a_hParser)->pParser;
}

inline ParserTag* AsParserTag(muParserHandle_t a_hParser)
{
	return static_cast<ParserTag*>(a_hParser);
}

#if defined(_WIN32)

BOOL APIENTRY DllMain(HANDLE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
{
	switch (ul_reason_for_call)
	{
	case  DLL_PROCESS_ATTACH:
		break;

	case  DLL_THREAD_ATTACH:
	case  DLL_THREAD_DETACH:
	case  DLL_PROCESS_DETACH:
		break;
	}

	return TRUE;
}

#endif

//---------------------------------------------------------------------------
//
//
//  exported functions
//
//
//---------------------------------------------------------------------------

API_EXPORT(void) mupSetVarFactory(muParserHandle_t a_hParser, muFacFun_t a_pFactory, void* pUserData)
{
	MU_TRY
		muParser_t* p(AsParser(a_hParser));
		p->SetVarFactory(a_pFactory, pUserData);
	MU_CATCH
}

/** \brief Create a new Parser instance and return its handle. */
API_EXPORT(muParserHandle_t) mupCreate(int nBaseType)
{
	switch (nBaseType)
	{
	case  muBASETYPE_FLOAT:   return (void*)(new ParserTag(muBASETYPE_FLOAT));
	case  muBASETYPE_INT:     return (void*)(new ParserTag(muBASETYPE_INT));
	default:                  return nullptr;
	}
}

/** \brief Release the parser instance related with a parser handle. */
API_EXPORT(void) mupRelease(muParserHandle_t a_hParser)
{
	MU_TRY
		ParserTag* p = static_cast<ParserTag*>(a_hParser);
		delete p;
	MU_CATCH
}

API_EXPORT(const muChar_t*) mupGetVersion(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));

#ifndef _UNICODE
		snprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), "%s", p->GetVersion().c_str());
#else
		swprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), _T("%s"), p->GetVersion().c_str());
#endif

		return s_tmpOutBuf;
	MU_CATCH
	return _T("");
}

/** \brief Evaluate the expression. */
API_EXPORT(muFloat_t) mupEval(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		return p->Eval();
	MU_CATCH
	return 0;
}

API_EXPORT(muFloat_t*) mupEvalMulti(muParserHandle_t a_hParser, int* nNum)
{
	MU_TRY
		if (nNum == nullptr)
			throw std::runtime_error("Argument is null!");

		muParser_t* const p(AsParser(a_hParser));
		return p->Eval(*nNum);
	MU_CATCH
	return 0;
}

API_EXPORT(void) mupEvalBulk(muParserHandle_t a_hParser, muFloat_t* a_res, int nSize)
{
	MU_TRY
		muParser_t* p(AsParser(a_hParser));
		p->Eval(a_res, nSize);
	MU_CATCH
}

API_EXPORT(void) mupSetExpr(muParserHandle_t a_hParser, const muChar_t* a_szExpr)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->SetExpr(a_szExpr);
	MU_CATCH
}

API_EXPORT(void) mupRemoveVar(muParserHandle_t a_hParser, const muChar_t* a_szName)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->RemoveVar(a_szName);
	MU_CATCH
}

/** \brief Release all parser variables.
	\param a_hParser Handle to the parser instance.
*/
API_EXPORT(void) mupClearVar(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->ClearVar();
	MU_CATCH
}

/** \brief Release all parser variables.
	\param a_hParser Handle to the parser instance.
*/
API_EXPORT(void) mupClearConst(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->ClearConst();
	MU_CATCH
}

/** \brief Clear all user defined operators.
	\param a_hParser Handle to the parser instance.
*/
API_EXPORT(void) mupClearOprt(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->ClearOprt();
	MU_CATCH
}

API_EXPORT(void) mupClearFun(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->ClearFun();
	MU_CATCH
}

API_EXPORT(void) mupDefineFun0(muParserHandle_t a_hParser,
	const muChar_t* a_szName,
	muFun0_t a_pFun,
	muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun1(muParserHandle_t a_hParser,	const muChar_t* a_szName, muFun1_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun2(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun2_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun3(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun3_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun4(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun4_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun5(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun5_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun6(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun6_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun7(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun7_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun8(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun8_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun9(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun9_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFun10(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun10_t a_pFun, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData0(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData0_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData1(muParserHandle_t a_hParser,	const muChar_t* a_szName, muFunUserData1_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData2(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData2_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData3(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData3_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData4(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData4_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData5(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData5_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData6(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData6_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData7(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData7_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData8(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData8_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData9(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData9_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineFunUserData10(muParserHandle_t a_hParser, const muChar_t* a_szName, muFunUserData10_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun0(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun0_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun1(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun1_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun2(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun2_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun3(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun3_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun4(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun4_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun5(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun5_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun6(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun6_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun7(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun7_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun8(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun8_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun9(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun9_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFun10(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFun10_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData0(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData0_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData1(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData1_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData2(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData2_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData3(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData3_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData4(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData4_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData5(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData5_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData6(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData6_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData7(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData7_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData8(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData8_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData9(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData9_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkFunUserData10(muParserHandle_t a_hParser, const muChar_t* a_szName, muBulkFunUserData10_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFun1(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun1_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFun2(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun2_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFun3(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun3_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFun4(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun4_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFun5(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFun5_t a_pFun)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFunUserData1(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFunUserData1_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFunUserData2(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFunUserData2_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFunUserData3(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFunUserData3_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFunUserData4(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFunUserData4_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrFunUserData5(muParserHandle_t a_hParser, const muChar_t* a_szName, muStrFunUserData5_t a_pFun, void* a_pUserData)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, false);
	MU_CATCH
}

API_EXPORT(void) mupDefineMultFun(muParserHandle_t a_hParser, const muChar_t* a_szName, muMultFun_t a_pFun,	muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFun(a_szName, a_pFun, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineMultFunUserData(muParserHandle_t a_hParser, const muChar_t* a_szName, muMultFunUserData_t a_pFun, void* a_pUserData, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineFunUserData(a_szName, a_pFun, a_pUserData, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun2_t a_pFun, muInt_t a_nPrec, muInt_t a_nOprtAsct, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineOprt(a_szName, a_pFun,	a_nPrec, (mu::EOprtAssociativity)a_nOprtAsct, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineVar(muParserHandle_t a_hParser, const muChar_t* a_szName,	muFloat_t* a_pVar)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineVar(a_szName, a_pVar);
	MU_CATCH
}

API_EXPORT(void) mupDefineBulkVar(muParserHandle_t a_hParser, const muChar_t* a_szName,	muFloat_t* a_pVar)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineVar(a_szName, a_pVar);
	MU_CATCH
}

API_EXPORT(void) mupDefineConst(muParserHandle_t a_hParser,	const muChar_t* a_szName, muFloat_t a_fVal)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineConst(a_szName, a_fVal);
	MU_CATCH
}

API_EXPORT(void) mupDefineStrConst(muParserHandle_t a_hParser, const muChar_t* a_szName, const muChar_t* a_szVal)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineStrConst(a_szName, a_szVal);
	MU_CATCH
}

API_EXPORT(const muChar_t*) mupGetExpr(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));

		// C# explodes when pMsg is returned directly. For some reason it can't access
		// the memory where the message lies directly.
#ifndef _UNICODE
		snprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), "%s", p->GetExpr().c_str());
#else
		swprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), _T("%s"), p->GetExpr().c_str());
#endif

		return s_tmpOutBuf;
	MU_CATCH

	return _T("");
}

API_EXPORT(void) mupDefinePostfixOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun1_t a_pOprt, muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefinePostfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
	MU_CATCH
}

API_EXPORT(void) mupDefineInfixOprt(muParserHandle_t a_hParser, const muChar_t* a_szName, muFun1_t a_pOprt,	muBool_t a_bAllowOpt)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->DefineInfixOprt(a_szName, a_pOprt, a_bAllowOpt != 0);
	MU_CATCH
}

// Define character sets for identifiers
API_EXPORT(void) mupDefineNameChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset)
{
	muParser_t* const p(AsParser(a_hParser));
	p->DefineNameChars(a_szCharset);
}

API_EXPORT(void) mupDefineOprtChars(muParserHandle_t a_hParser,	const muChar_t* a_szCharset)
{
	muParser_t* const p(AsParser(a_hParser));
	p->DefineOprtChars(a_szCharset);
}

API_EXPORT(void) mupDefineInfixOprtChars(muParserHandle_t a_hParser, const muChar_t* a_szCharset)
{
	muParser_t* const p(AsParser(a_hParser));
	p->DefineInfixOprtChars(a_szCharset);
}

/** \brief Get the number of variables defined in the parser.
	\param a_hParser [in] Must be a valid parser handle.
	\return The number of used variables.
	\sa mupGetExprVar
*/
API_EXPORT(int) mupGetVarNum(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::varmap_type VarMap = p->GetVar();
		return (int)VarMap.size();
	MU_CATCH

	return 0; // never reached
}

/** \brief Return a variable that is used in an expression.
	\param a_hParser [in] A valid parser handle.
	\param a_iVar [in] The index of the variable to return.
	\param a_szName [out] Pointer to the variable name.
	\param a_pVar [out] Pointer to the variable.
	\throw nothrow

	Prior to calling this function call mupGetExprVarNum in order to get the
	number of variables in the expression. If the parameter a_iVar is greater
	than the number of variables both a_szName and a_pVar will be set to zero.
	As a side effect this function will trigger an internal calculation of the
	expression undefined variables will be set to zero during this calculation.
	During the calculation user defined callback functions present in the expression
	will be called, this is unavoidable.
*/
API_EXPORT(void) mupGetVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_szName, muFloat_t** a_pVar)
{
	// A static buffer is needed for the name since i can't return the
	// pointer from the map.
	static muChar_t  szName[1024];

	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::varmap_type VarMap = p->GetVar();

		if (a_iVar >= VarMap.size())
		{
			*a_szName = 0;
			*a_pVar = 0;
			return;
		}
		mu::varmap_type::const_iterator item;

		item = VarMap.begin();
		for (unsigned i = 0; i < a_iVar; ++i)
			++item;

#ifndef _UNICODE
		strncpy(szName, item->first.c_str(), count_of(szName));
#else
		wcsncpy(szName, item->first.c_str(), count_of(szName));
#endif

		szName[count_of(szName) - 1] = 0;

		*a_szName = &szName[0];
		*a_pVar = item->second;
		return;
	MU_CATCH

	* a_szName = 0;
	*a_pVar = 0;
}

/** \brief Get the number of variables used in the expression currently set in the parser.
	\param a_hParser [in] Must be a valid parser handle.
	\return The number of used variables.
	\sa mupGetExprVar
	*/
API_EXPORT(int) mupGetExprVarNum(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::varmap_type VarMap = p->GetUsedVar();
		return (int)VarMap.size();
	MU_CATCH

	return 0; // never reached
}

/** \brief Return a variable that is used in an expression.

	Prior to calling this function call mupGetExprVarNum in order to get the
	number of variables in the expression. If the parameter a_iVar is greater
	than the number of variables both a_szName and a_pVar will be set to zero.
	As a side effect this function will trigger an internal calculation of the
	expression undefined variables will be set to zero during this calculation.
	During the calculation user defined callback functions present in the expression
	will be called, this is unavoidable.

	\param a_hParser [in] A valid parser handle.
	\param a_iVar [in] The index of the variable to return.
	\param a_szName [out] Pointer to the variable name.
	\param a_pVar [out] Pointer to the variable.
	\throw nothrow
*/
API_EXPORT(void) mupGetExprVar(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_szName, muFloat_t** a_pVar)
{
	// A static buffer is needed for the name since i can't return the
	// pointer from the map.
	static muChar_t  szName[1024];

	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::varmap_type VarMap = p->GetUsedVar();

		if (a_iVar >= VarMap.size())
		{
			*a_szName = 0;
			*a_pVar = 0;
			return;
		}
		mu::varmap_type::const_iterator item;

		item = VarMap.begin();
		for (unsigned i = 0; i < a_iVar; ++i)
			++item;

#ifndef _UNICODE
		strncpy(szName, item->first.c_str(), count_of(szName));
#else
		wcsncpy(szName, item->first.c_str(), count_of(szName));
#endif

		szName[count_of(szName) - 1] = 0;

		*a_szName = &szName[0];
		*a_pVar = item->second;
		return;
	MU_CATCH

	* a_szName = 0;
	*a_pVar = 0;
}

/** \brief Return the number of constants defined in a parser. */
API_EXPORT(int) mupGetConstNum(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::valmap_type ValMap = p->GetConst();
		return (int)ValMap.size();
	MU_CATCH

	return 0; // never reached
}

API_EXPORT(void) mupSetArgSep(muParserHandle_t a_hParser, const muChar_t cArgSep)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->SetArgSep(cArgSep);
	MU_CATCH
}

API_EXPORT(void) mupResetLocale(muParserHandle_t a_hParser)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->ResetLocale();
	MU_CATCH
}

API_EXPORT(void) mupSetDecSep(muParserHandle_t a_hParser, const muChar_t cDecSep)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
	p->SetDecSep(cDecSep);
	MU_CATCH
}

API_EXPORT(void) mupSetThousandsSep(muParserHandle_t a_hParser, const muChar_t cThousandsSep)
{
	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		p->SetThousandsSep(cThousandsSep);
	MU_CATCH
}

//---------------------------------------------------------------------------
/** \brief Retrieve name and value of a single parser constant.
	\param a_hParser [in] a valid parser handle
	\param a_iVar [in] Index of the constant to query
	\param a_pszName [out] pointer to a null terminated string with the constant name
	\param [out] The constant value
	*/
API_EXPORT(void) mupGetConst(muParserHandle_t a_hParser, unsigned a_iVar, const muChar_t** a_pszName, muFloat_t* a_fVal)
{
	// A static buffer is needed for the name since i can't return the
	// pointer from the map.
	static muChar_t szName[1024];

	MU_TRY
		muParser_t* const p(AsParser(a_hParser));
		const mu::valmap_type ValMap = p->GetConst();

		if (a_iVar >= ValMap.size())
		{
			*a_pszName = 0;
			*a_fVal = 0;
			return;
		}

		mu::valmap_type::const_iterator item;
		item = ValMap.begin();
		for (unsigned i = 0; i < a_iVar; ++i)
			++item;

#ifndef _UNICODE
		strncpy(szName, item->first.c_str(), count_of(szName));
#else
		wcsncpy(szName, item->first.c_str(), count_of(szName));
#endif

		szName[count_of(szName) - 1] = 0;

		*a_pszName = &szName[0];
		*a_fVal = item->second;
		return;

	MU_CATCH

	* a_pszName = 0;
	*a_fVal = 0;
}

/** \brief Add a custom value recognition function. */
API_EXPORT(void) mupAddValIdent(muParserHandle_t a_hParser,	muIdentFun_t a_pFun)
{
	MU_TRY
		muParser_t* p(AsParser(a_hParser));
		p->AddValIdent(a_pFun);
	MU_CATCH
}

/** \brief Query if an error occurred.

	After querying the internal error bit will be reset. So a consecutive call
	will return false.
*/
API_EXPORT(muBool_t) mupError(muParserHandle_t a_hParser)
{
	bool bError(AsParserTag(a_hParser)->bError);
	AsParserTag(a_hParser)->bError = false;
	return bError;
}

/** \brief Reset the internal error flag. */
API_EXPORT(void) mupErrorReset(muParserHandle_t a_hParser)
{
	AsParserTag(a_hParser)->bError = false;
}

API_EXPORT(void) mupSetErrorHandler(muParserHandle_t a_hParser, muErrorHandler_t a_pHandler)
{
	AsParserTag(a_hParser)->errHandler = a_pHandler;
}

/** \brief Return the message associated with the last error. */
API_EXPORT(const muChar_t*) mupGetErrorMsg(muParserHandle_t a_hParser)
{
	ParserTag* const p(AsParserTag(a_hParser));
	const muChar_t* pMsg = p->exc.GetMsg().c_str();

	// C# explodes when pMsg is returned directly. For some reason it can't access
	// the memory where the message lies directly.
#ifndef _UNICODE
	snprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), "%s", pMsg);
#else
	swprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), _T("%s"), pMsg);
#endif

	return s_tmpOutBuf;
}

/** \brief Return the message associated with the last error. */
API_EXPORT(const muChar_t*) mupGetErrorToken(muParserHandle_t a_hParser)
{
	ParserTag* const p(AsParserTag(a_hParser));
	const muChar_t* pToken = p->exc.GetToken().c_str();

	// C# explodes when pMsg is returned directly. For some reason it can't access
	// the memory where the message lies directly.
#ifndef _UNICODE
	snprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), "%s", pToken);
#else
	swprintf(s_tmpOutBuf, count_of(s_tmpOutBuf), _T("%s"), pToken);
#endif

	return s_tmpOutBuf;
}

/** \brief Return the code associated with the last error.
*/
API_EXPORT(int) mupGetErrorCode(muParserHandle_t a_hParser)
{
	return AsParserTag(a_hParser)->exc.GetCode();
}

/** \brief Return the position associated with the last error. */
API_EXPORT(int) mupGetErrorPos(muParserHandle_t a_hParser)
{
	return (int)AsParserTag(a_hParser)->exc.GetPos();
}

API_EXPORT(muFloat_t*) mupCreateVar()
{
	return new muFloat_t(0);
}

API_EXPORT(void) mupReleaseVar(muFloat_t* ptr)
{
	delete ptr;
}

#if defined(_MSC_VER)
	#pragma warning(pop)
#endif

#endif      // MUPARSER_DLL


text:
JMSDiExtraBundle
===================

Documentation:
[Resources/doc](http://jmsyst.com/bundles/JMSDiExtraBundle)

Code License:
[Resources/meta/LICENSE](https://github.com/schmittjoh/JMSDiExtraBundle/blob/master/Resources/meta/LICENSE)

Documentation License:
[Resources/doc/LICENSE](https://github.com/schmittjoh/JMSDiExtraBundle/blob/master/Resources/doc/LICENSE)

redpajama_set_name: RedPajamaGithub


text:
ZPerspective::ZPerspective(void) {}
ZPerspective::~ZPerspective(void) {}

void ZPerspective::display(OpenGL &aOpenGL){
  aOpenGL.display(this);
}

void ZPerspective::setEye(Coordinates *aEye)
{
  this->aEye = aEye;
}

Coordinates *ZPerspective::getEye(void)
{
  return aEye;
}

void ZPerspective::setCenter(Coordinates *aCenter)
{
  this->aCenter = aCenter;
}

Coordinates *ZPerspective::getCenter(void)
{
  return aCenter;
}

void ZPerspective::setUp(Coordinates *aUp)
{
  this->aUp = aUp;
}

Coordinates *ZPerspective::getUp(void)
{
  return aUp;
}


text:
import Api from '@/services/Api'

export default {
  register (credentials) {
    console.log('register')
    return Api().post('register', credentials)
  }
}


text:
package org.wallride.support;

import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import org.wallride.domain.Article;
import org.wallride.domain.Page;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class PostUtils {

	private PageUtils pageUtils;

	public PostUtils(PageUtils pageUtils) {
		this.pageUtils = pageUtils;
	}

	public String link(Article article) {
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
		return path(builder, article, true);
	}

	public String link(Article article, boolean encode) {
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
		return path(builder, article, encode);
	}

	public String link(Page page) {
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
		return path(builder, page, true);
	}

	public String link(Page page, boolean encode) {
		UriComponentsBuilder builder = ServletUriComponentsBuilder.fromCurrentContextPath();
		return path(builder, page, encode);
	}

	public String path(Article article) {
		UriComponentsBuilder builder = UriComponentsBuilder.fromPath("");
		return path(builder, article, true);
	}

	public String path(Article article, boolean encode) {
		UriComponentsBuilder builder = UriComponentsBuilder.fromPath("");
		return path(builder, article, encode);
	}

	public String path(Page page) {
		UriComponentsBuilder builder = UriComponentsBuilder.fromPath("");
		return path(builder, page, true);
	}

	public String path(Page page, boolean encode) {
		UriComponentsBuilder builder = UriComponentsBuilder.fromPath("");
		return path(builder, page, encode);
	}

	private String path(UriComponentsBuilder builder, Article article, boolean encode) {
		Map<String, Object> params = new HashMap<>();
		builder.path("/{year}/{month}/{day}/{code}");
		params.put("year", String.format("%04d", article.getDate().getYear()));
		params.put("month", String.format("%02d", article.getDate().getMonth().getValue()));
		params.put("day", String.format("%02d", article.getDate().getDayOfMonth()));
		params.put("code", article.getCode());

		UriComponents components = builder.buildAndExpand(params);
		if (encode) {
			components = components.encode();
		}
		return components.toUriString();
	}

	private String path(UriComponentsBuilder builder, Page page, boolean encode) {
		Map<String, Object> params = new HashMap<>();

		List<String> codes = new LinkedList<>();
		Map<Page, String> paths = pageUtils.getPaths(page);
		paths.keySet().stream().map(p -> p.getCode()).forEach(codes::add);

		for (int i = 0; i < codes.size(); i++) {
			String key = "code" + i;
			builder.path("/{" + key + "}");
			params.put(key, codes.get(i));
		}

		UriComponents components = builder.buildAndExpand(params);
		if (encode) {
			components = components.encode();
		}
		return components.toUriString();
	}
}


text:
package com.s0lder.droplets.command;

import com.s0lder.droplets.Droplet;
import com.s0lder.droplets.util.Stdout;
import java.lang.reflect.Method;

public class CommandHandler {
    private final String command;
    private final String[] aliases;
    private final String[] description;
    private final String[] help;
    private Method handler;
    private Droplet instance;

    public CommandHandler(String command, String[] aliases, String[] description, String[] help) {
        this.command = command;
        this.aliases = aliases;
        this.description = description;
        this.help = help;
        this.handler = null;
        this.instance = null;
    }

    public void setHandler(Droplet instance, Method handler) {
        this.instance = instance;
        this.handler = handler;
    }

    public Method getHandler() {
        return this.handler;
    }

    public Droplet getInstance() {
        return this.instance;
    }

    public String getCommand() {
        return this.command;
    }

    public String[] getAliases() {
        return this.aliases;
    }

    public String[] getDescription() {
        return this.description;
    }

    public String[] getHelp() {
        return this.help;
    }

    public boolean matchCommand(String command) {
        if(command.equalsIgnoreCase(this.command)) {
            return true;
        } else {
            for(String alias : this.aliases) {
                if(alias.equalsIgnoreCase(command)) {
                    return true;
                }
            }
            return false;
        }
    }

}


text:
This course covers a broad range of the most commonly used algorithms. Some examples include: algorithms for sorting, searching, encryption, graph searching, pattern matching, geometric intersection, compression, and local search. The students will implement and test several algorithms. The course is programming-intensive.

## Description

This subfolder contains projects for CS1501, taught by Nicholas Farnan during the Fall semester of 2017-2018 (Term 2181). They are written in the Java programming language.

## Projects

Includes code for the following assignments:
  - Autocompletion Engine
  - LZW Compression
  - Apartment Tracker
  - Network Analysis
  - RSA Encryption

## Project Description

Autocompletion Engine

Autocompletion engine that utilizes a De La Briandais trie symbol table

LZW Compression

Custom LZW compression algorithm that uses variable-width codewords

Apartment Tracker

Apartment Tracker implemented using a 2-way priority queue

Network Analysis

Graph theory algorithms to analyze networks: Prim, Dijkstra, Ford-Fulkerson

RSA Encryption

Custom RSA Encryption algorithm for public/private key pairs

## License

Everything in this repo is distributed under the MIT License.

See LICENSE for more information.


text:
@extends('...layouts.dashboard')

@section('assets')
@stop

@section('content')
    <form class="form-horizontal" method="post" action="{!! route(\Route::currentRouteName().'.save') !!}">
        <input type="hidden" name="id" value="{{ $is_creating ? '' : $model['id']}}"/>

            权限名

                <input type="text" name="display_name" class="form-control" placeholder="权限名" value="{{ $is_creating ? '' : $model['display_name'] }}">

            权限代码

                <input type="text" name="name" class="form-control" placeholder="权限代码" value="{{ $is_creating ? '' : $model['name'] }}">

            权限标识

                <input type="text" name="icon" class="form-control" placeholder="权限标识" value="{{ $is_creating ? '' : $model['icon'] }}">

            权限路由

                <input type="text" name="route" class="form-control" placeholder="权限路由" value="{{ $is_creating ? '' : $model['route'] }}">

            权限分组

                    <input type="radio" name="parent_id" value="0"/> 无分组

            权限分组

                <input type="radio" name="type" value="0" checked/> 普通权限
                <input type="radio" name="type" value="1"/> 菜单权限

                <button type="submit" class="btn btn-primary">{{ $is_creating?'添加权限':'编辑权限' }}</button>

    </form>
@stop

@section('script')

@stop


text:
module.exports = {
  extends: ['eslint:recommended', 'airbnb-base', 'prettier'],
  parserOptions: {
    ecmaVersion: 6,
  },
  plugins: ['prettier'],
  rules: {
    'prettier/prettier': ['error', 'fb'],
    'import/no-extraneous-dependencies': ['error', {devDependencies: true}],
    'linebreak-style': [
      'error',
      require('os').EOL === '\r\n' ? 'windows' : 'unix',
    ],
  },
};


text:
package uk.ac.ebi.eva.pipeline.io;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import uk.ac.ebi.eva.pipeline.model.VariantWrapper;
import uk.ac.ebi.eva.pipeline.parameters.AnnotationParameters;
import uk.ac.ebi.eva.test.rules.PipelineTemporaryFolderRule;

import java.io.File;

import static uk.ac.ebi.eva.utils.FileUtils.getResource;

public class VepProcessTest {

    private AnnotationParameters annotationParameters;

    @Rule
    public PipelineTemporaryFolderRule temporaryFolder = new PipelineTemporaryFolderRule();

    @Rule
    public ExpectedException exception = ExpectedException.none();

    private static final int CHUNK_SIZE = 10;

    private static final long VEP_TIMEOUT = 1;

    private final VariantWrapper VARIANT_WRAPPER = new VariantWrapper("1", 100, 105, "A", "T");

    @Before
    public void setUp() throws Exception {
        annotationParameters = new AnnotationParameters();
        annotationParameters.setFileId("fid");
        annotationParameters.setStudyId("sid");
        annotationParameters.setVepCacheVersion("1");
        annotationParameters.setVepCachePath("cache");
        annotationParameters.setVepPath(getResource("/mockvep_writeToFile.pl").getAbsolutePath());
        annotationParameters.setVepCacheSpecies("hsapiens");
        annotationParameters.setInputFasta("fasta");
        annotationParameters.setVepNumForks(4);

        File annotationFolder = temporaryFolder.newFolder();
        annotationParameters.setOutputDirAnnotation(annotationFolder.getAbsolutePath());
    }

    @Test
    public void testWorkflowWriteWithoutOpening() throws Exception {
        VepProcess vepAnnotationFileWriter = new VepProcess(annotationParameters, CHUNK_SIZE, VEP_TIMEOUT);

        exception.expect(IllegalStateException.class);
        vepAnnotationFileWriter.write(getVariantInVepInputFormat(VARIANT_WRAPPER).getBytes());
    }

    private String getVariantInVepInputFormat(VariantWrapper variantWrapper) {
        return String.join("\t",
                variantWrapper.getChr(),
                Integer.toString(variantWrapper.getStart()),
                Integer.toString(variantWrapper.getEnd()),
                variantWrapper.getRefAlt(),
                variantWrapper.getStrand());
    }

    @Test
    public void testWorkflowFlushWithoutOpening() throws Exception {
        VepProcess vepAnnotationFileWriter = new VepProcess(annotationParameters, CHUNK_SIZE, VEP_TIMEOUT);

        exception.expect(IllegalStateException.class);
        vepAnnotationFileWriter.flush();
    }

    @Test
    public void testWorkflowFlushAfterClosing() throws Exception {
        VepProcess vepAnnotationFileWriter = new VepProcess(annotationParameters, CHUNK_SIZE, VEP_TIMEOUT);

        vepAnnotationFileWriter.open();
        vepAnnotationFileWriter.close();

        exception.expect(IllegalStateException.class);
        vepAnnotationFileWriter.flush();
    }

    @Test
    public void testWorkflowCloseWithoutOpening() throws Exception {
        VepProcess vepAnnotationFileWriter = new VepProcess(annotationParameters, CHUNK_SIZE, VEP_TIMEOUT);
        vepAnnotationFileWriter.close();
    }
}


text:
var test = require('tap').test
var path = require('path')
var common = require('../common-tap.js')
var mr = require('npm-registry-mock')
var server

var packageName = path.basename(__filename,'.js')

test('setup', function (t) {
  mr({port: common.port, throwOnUnmatched: true}, function (err, s) {
    t.ifError(err, 'registry mocked successfully')
    server = s
    t.end()
  })
})

test('package names not mangled on error with non-root registry', function (t) {
  common.npm(
    [
      'cache',
      'add',
      packageName + '@*'
    ],
    {},
    function (er, code, stdout, stderr) {
      t.ifError(er, 'correctly handled 404')
      t.equal(code, 1, 'exited with error')
      t.match(stderr, packageName, 'should have package name in error')
      t.end()
    }
  )
})

test('cleanup', function (t) {
  t.pass('cleaned up')
  server.done()
  server.close()
  t.end()
})


text:
package models.data;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Vector;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Transient;

import play.Logger;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

import models.NamedModel;
import models.PSIMessage;
import models.PSIResource;
import models.attribute.ArrayAttribute;
import models.attribute.Attribute;
import models.data.DataReader;
import models.data.Query;
import models.data.TextFileDataReader;

import controllers.Attributes;

import util.SubattributeRelationMismatchException;

/**
 * Describes an immutable (from an outside user's perspective) relation of
 * instances.
 *
 * @author jmontgomery
 *
 */
@Entity
public class Relation extends NamedModel implements Iterable<JsonElement> {
	private static final long serialVersionUID = 1L;

	/** Supported formats for datasets in this PSI service. */
	protected enum Format { CSV, JSON };

	/** Human-readable description of this relation. */
	protected String description;
	/** Number of instances in this relation. */
	protected int size;
	/** The 'default' attribute that should return an entire instance. */
	@OneToOne(cascade={CascadeType.ALL})
	public Attribute defaultAttribute;
	/** (Top-level) attributes for reading instances from this relation. */
	@OneToMany(cascade={CascadeType.ALL})
	@JoinColumn(name="relation_fk")
	public List<Attribute> attributes;
	/** File format of the data file. */
	protected Format format;
	/**
	 * Relative path to the data file, to be resolved by Play!. Note that this
	 * is highly restrictive, assuming a single data file.
	 */
	protected String path;

	public Relation() { super(""); }

	/**
	 * Used internally to create a new {@code Relation}.
	 * @throws SubattributeRelationMismatchException if any of the attributes
	 * for this relation refer to existing attributes for another relation.
	 */
	private Relation(Create createRequest) throws SubattributeRelationMismatchException {
		super(createRequest.name);
		this.format = Format.valueOf(createRequest.format);
		this.path = createRequest.path;
		this.description = createRequest.description;
		this.size = getDataReader().refreshInstanceCount();

		attributes = new Vector<Attribute>(createRequest.attributes.size());
		for (Attribute.Create createReq : createRequest.attributes) {
			Attribute attr = Attribute.create(name, createReq.name, createReq.description, createReq.attribute, Attribute.Persistence.SYSTEM);
			attributes.add(attr);
			if (createReq.name.equals(createRequest.defaultAttribute))
				defaultAttribute = attr;
		}
		if (defaultAttribute == null && !attributes.isEmpty())
			defaultAttribute = attributes.get(0);
	}

	/**
	 * Creates a new {@code Relation} and its {@link Attribute}s and persists
	 * it to the database.
	 * @throws SubattributeRelationMismatchException if any of the attributes
	 * for this relation refer to existing attributes for another relation.
	 */
	public static Relation create(Create createRequest) throws SubattributeRelationMismatchException {
		Relation r = new Relation( createRequest );
		r.save();
		//Any sub-attributes just created (and hence not appearing in r.attributes, need to be told this is their relation
		for (Attribute attr : r.attributes)
			attr.setRelation(r);
		return r;
	}

	public Attribute getDefaultAttribute() {
		return defaultAttribute;
	}

	/** Returns the 'path' to the file (table, etc.) that holds this Relation's data. */
	public String getPath() { return path; }

	/** Returns the total number of instances in this Relation. */
	public int getSize() { return size; }

	//--Persistence assistance-------------------------------------------------

	/**
	 * Requests that all attribute's prepare to be deleted and unlinks this
	 * relation from them; the potentially complicated object-model that
	 * attributes define cannot be easily cascade deleted by Hibernate.
	 */
	public void prepareForDeletion() {
		defaultAttribute = null;
		for (Attribute attr : attributes)
			attr.prepareForDeletion(null);
		attributes.clear();
		save();
    }

	public boolean containsInstance(final int instance) { return instance >= 1 && instance <= size; }

	public JsonElement readInstance(Query query, final int i) throws NoSuchInstanceException {
		return getDataReader(query).readInstance(i);
	}

	public Iterator<JsonElement> iterator() {
		return iterator(null);
	}

	/** An extension to the standard Iterable interface that supports a query. */
	public Iterator<JsonElement> iterator(Query query) {
		return new DataIterator(this, query);
	}

	public DataReader getDataReader() { return getDataReader(null); }

	public DataReader getDataReader(Query query) {
		switch (format) {
		case CSV : return new TextFileDataReader.CSVReader(this, query);
		case JSON : return new TextFileDataReader.JSONReader(this, query);
		default: return null;
		}
	}

	//--Nested classes---------------------------------------------------------

	/**
	 * Wraps up a concrete {@link DataReader} and the current instance within
	 * the relation induced by a given {@link Query}.
	 */
	protected static class DataIterator implements Iterator<JsonElement> {
		private DataReader dataReader;
		private int virtualPos = 1;
		private int lastVirtualPos;
		private JsonElement nextInstance;

		public DataIterator(Relation relation, Query query) {
			this.dataReader = relation.getDataReader(query);
			lastVirtualPos = query.size(relation);
			loadNext(); //assumes at least one instance is selected by query and relation not empty
		}

		public boolean hasNext() { return nextInstance != null; }

		private void loadNext() {
			try {
				nextInstance = virtualPos > lastVirtualPos ? null : dataReader.readInstance(virtualPos);
			} catch (NoSuchInstanceException nsie) {
				throw new RuntimeException("Avoidable error occurred", nsie);
			}
		}

		public JsonElement next() {
			if (! hasNext())
				throw new NoSuchElementException(String.valueOf(virtualPos)); //report the *apparent* index that doesn't exist
			JsonElement toReturn = nextInstance;
			virtualPos++;
			loadNext();
			return toReturn;
		}

		public void remove() {
			throw new UnsupportedOperationException();
		}
	}

	//--Requests---------------------------------------------------------------

	//Internal requests are supported; ensure no public path can allow a suitably formatted request to be acted on though
	/** Internal relation creation message. */
	public static class Create extends PSIMessage {
		/** Relation name; note that, unlike a real external PUT request, the desired URI (or part of it) is part of this request object. */
		public String name;
		/** Human-readable description of the relation. */
		public String description;
		/** Underlying data format; must be the string representation of an element of {@link Relation.Format}. */
		public String format;
		/** Local path to data file; note that this is not generalisable as it assumes that data is in a single file, rather than a database, etc. */
		public String path;
		/** Name of the default attribute if it isn't the first entry in the {@link #attributes} list. */
		public String defaultAttribute;
		/** List of {@linkplain Attribute.Request.Create attribute create requests }. */
		public List<Attribute.Create> attributes;

		public boolean isValid() { return /* has no psiType, so just */validateAllNonNull(name, format, path, attributes); }

	}

	//--Responses--------------------------------------------------------------

	public static class Description extends PSIResource {
		/** [opt] Human-readable description of the relation. */
		public String description;
		/** The number of instances in the relation. */
		public int size;
		/** URI of the default attribute of this relation. */
		public String defaultAttribute;
		/** [opt] URI of all attributes for this relation. */
		public List<String> attributes;
		/**
		 * Query schema for this relation. Must be a {@link JsonElement}
		 * rather than the more-specific {@link JsonObject} for
		 * {@link com.google.gson.Gson#toJsonTree(Object)} to render it
		 * correctly.
		 */
		public JsonObject querySchema;

		public Description(Relation relation, Query query, String uri) {
			this.uri = uri;
			this.description = relation.description + (query.isEmpty() ? "" : " " + query);
			this.size = query.size(relation);
			if ( ! relation.attributes.isEmpty() ) {
				this.defaultAttribute = Attributes.getReverseRoute(relation.getDefaultAttribute(), null, query);
				this.attributes = new ArrayList<String>(relation.attributes.size());
				for (Attribute attr : Attribute.keepTopLevelAttributes( new ArrayList<>( relation.attributes ) ))
					this.attributes.add( Attributes.getReverseRoute(attr, null, query) );
			}
			this.querySchema = Query.getQuerySchema();
		}
	}

}


text:
/*
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
package org.rlcommunity.btanner.agents;

import org.rlcommunity.btanner.agentLib.learningBoosters.experienceReplay.ExperienceReplayLearningBoosterFactory;
import org.rlcommunity.btanner.agentLib.actionSelectors.epsilonGreedy.EpsilonGreedyActionSelectorFactory;
import java.util.Vector;
import org.rlcommunity.btanner.agentLib.actionSelectors.ActionSelectorFactoryInterface;
import org.rlcommunity.btanner.agentLib.functionApproximators.CMAC.CMACFunctionApproximatorFactory;
import org.rlcommunity.btanner.agentLib.functionApproximators.FunctionApproximatorFactoryInterface;
import org.rlcommunity.btanner.agentLib.learningBoosters.AbstractLearningBoosterFactory;
import org.rlcommunity.btanner.agentLib.learningModules.AbstractLearningModuleFactory;

import org.rlcommunity.btanner.agentLib.learningModules.sarsa0.Sarsa0LearningModuleFactory;
import org.rlcommunity.rlglue.codec.util.AgentLoader;
import rlVizLib.dynamicLoading.Unloadable;
import rlVizLib.general.ParameterHolder;

/**
 *
 * @author Brian Tanner
 */
public class EpsilonGreedyCMACExperienceReplayProving extends AbstractSarsa implements Unloadable {

    public static ParameterHolder getDefaultParameters() {
        FunctionApproximatorFactoryInterface FAF=new CMACFunctionApproximatorFactory();
        ActionSelectorFactoryInterface ASF=new EpsilonGreedyActionSelectorFactory();
        Sarsa0LearningModuleFactory ERLMF=new Sarsa0LearningModuleFactory(FAF, ASF);
        ParameterHolder p = AbstractSarsa.getDefaultParameters(ERLMF);

          ExperienceReplayLearningBoosterFactory eReplayFactory=new ExperienceReplayLearningBoosterFactory();
        eReplayFactory.addToParameterHolder(p);

        p.setDoubleParam("sarsa0-alpha", .075);
        p.setIntegerParam("e-replay-lesson-size", 1);
        p.setIntegerParam("e-replay-replay-count", 64);
        p.setIntegerParam("cmac-gridSize", 8);
        p.setDoubleParam("epsilon-action-selector-epsilon",0.05d);

        return p;
    }
   @Override
    protected AbstractLearningModuleFactory makeLearningModuleFactory() {
        return new Sarsa0LearningModuleFactory(makeFunctionApproximatorFactory(), makeActionSelectorFactory());
    }

    protected FunctionApproximatorFactoryInterface makeFunctionApproximatorFactory() {
        return new CMACFunctionApproximatorFactory();
    }

    protected ActionSelectorFactoryInterface makeActionSelectorFactory() {
        return new EpsilonGreedyActionSelectorFactory();
    }

   public EpsilonGreedyCMACExperienceReplayProving(ParameterHolder p){
        super(p);
    }

    public EpsilonGreedyCMACExperienceReplayProving(){
        this(getDefaultParameters());
    }

    @Override
    protected Vector<AbstractLearningBoosterFactory> makeBoosterFactories() {
       Vector<AbstractLearningBoosterFactory> theLocalBoosters=new Vector<AbstractLearningBoosterFactory>();
       theLocalBoosters.add(new ExperienceReplayLearningBoosterFactory());
       return theLocalBoosters;
    }

        public static void main(String[] args) {
        AgentLoader L = new AgentLoader(new EpsilonGreedyCMACExperienceReplayProving());
        L.run();
    }

}


text:
@interface GPUImageFastBlurFilter : GPUImageTwoPassFilter
{
    GLint verticalPassTexelWidthOffsetUniform, verticalPassTexelHeightOffsetUniform, horizontalPassTexelWidthOffsetUniform, horizontalPassTexelHeightOffsetUniform, firstBlurSizeUniform, secondBlurSizeUniform;
}

/// The number of times to sequentially blur the incoming image. The more passes, the slower the filter.
@property(readwrite, nonatomic) NSUInteger blurPasses;

/// A scaling for the size of the applied blur, default of 1.0
@property(readwrite, nonatomic) CGFloat blurSize;

- (id)initWithFragmentShaderFromString:(NSString *)fragmentShaderString;

@end


text:
namespace ustl {

//----------------------------------------------------------------------
// rotate_fast

/// Exchanges ranges [first, middle) and [middle, last)
void rotate_fast (void* first, void* middle, void* last) noexcept
{
#if __has_include(<alloca.h>)
    const size_t half1 (distance (first, middle)), half2 (distance (middle, last));
    const size_t hmin (min (half1, half2));
    if (!hmin)
	return;
    void* buf = alloca (hmin);
    if (buf) {
	if (half2 < half1) {
	    copy_n_fast (middle, half2, buf);
	    copy_backward_fast (first, middle, last);
	    copy_n_fast (buf, half2, first);
	} else {
	    copy_n_fast (first, half1, buf);
	    copy_n_fast (middle, half2, first);
	    copy_n_fast (buf, half1, advance_ptr(first,half2));
	}
    } else
#else
    if (first == middle || middle == last)
	return;
#endif
    {
	char* f = static_cast<char*>(first);
	char* m = static_cast<char*>(middle);
	char* l = static_cast<char*>(last);
	reverse (f, m);
	reverse (m, l);
	while (f != m && m != l)
	    iter_swap (f++, --l);
	reverse (f, (f == m ? l : m));
    }
}

//----------------------------------------------------------------------
// Miscellaneous instantiated stuff from headers which don't have enough
// to warrant creation of a separate file.cc
//----------------------------------------------------------------------

// Used in uspecial to print printable characters
const char _FmtPrtChr[2][8]={"'%c'","%d"};

} // namespace ustl


text:
package uk.gov.register.filters;

import org.junit.Test;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

import static org.mockito.Mockito.*;

public class StripTrailingSlashRedirectFilterTest {

     private HttpServletResponse makeRequestToPath(String path) throws IOException, ServletException {
      return makeRequestToPath(path, null, 443);
    }

    private HttpServletResponse makeRequestToPath(String path, String queryString) throws IOException, ServletException {
      return makeRequestToPath(path, queryString, 443);
    }

    private HttpServletResponse makeRequestToPath(String path, String queryString, int port) throws IOException, ServletException {
        HttpServletRequest httpServletRequest = mock(HttpServletRequest.class);
        HttpServletResponse httpServletResponse = mock(HttpServletResponse.class);
        FilterChain filterChain = mock(FilterChain.class);
        when(httpServletRequest.getRequestURI()).thenReturn(path);
        when(httpServletRequest.getServerName()).thenReturn("country.register.gov.uk");
        when(httpServletRequest.getScheme()).thenReturn("https");
        when(httpServletRequest.getQueryString()).thenReturn(queryString);
        when(httpServletRequest.getServerPort()).thenReturn(port);
        StripTrailingSlashRedirectFilter stripTrailingSlashRedirectFilter = new StripTrailingSlashRedirectFilter();
        stripTrailingSlashRedirectFilter.doFilter(httpServletRequest, httpServletResponse,
                filterChain);
        return httpServletResponse;
    }

    @Test
    public void redirectsTrailingSlash() throws IOException, ServletException {
        HttpServletResponse response = makeRequestToPath("/records/");
        verify(response).setStatus(301);
        verify(response).setHeader("Location", "https://country.register.gov.uk/records");
    }

    @Test
    public void doesNotRedirectRootPath() throws IOException, ServletException {
        HttpServletResponse response = makeRequestToPath("/");
        verify(response, never()).setStatus(301);
    }

    @Test
    public void doesNotRedirectPathWithoutTrailingSlash() throws IOException, ServletException {
        HttpServletResponse response = makeRequestToPath("/records");
        verify(response, never()).setStatus(301);
    }

    @Test
    public void retainsQueryString() throws IOException, ServletException {
        HttpServletResponse response = makeRequestToPath("/records/", "page-size=5000");
        verify(response).setStatus(301);
        verify(response).setHeader("Location", "https://country.register.gov.uk/records?page-size=5000");
    }

    @Test
    public void retainsCustomPort() throws IOException, ServletException {
        HttpServletResponse response = makeRequestToPath("/records/", "page-size=5000", 8080);
        verify(response).setStatus(301);
        verify(response).setHeader("Location", "https://country.register.gov.uk:8080/records?page-size=5000");
    }
}


text:
require 'fog/core/model'

module Fog
  module Compute
    class SakuraCloud
      class SshKey < Fog::Model

        identity :id, :aliases => 'ID'
        attribute :name, :aliases => 'Name'
        attribute :public_key, :aliases => 'PublicKey'

      end
    end
  end
end


text:
// Copyright 2018 The Bazel Authors. All rights reserved.
//
// 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.
package com.google.devtools.build.lib.remote.http;

import static com.google.common.base.Preconditions.checkState;

import com.google.auth.Credentials;
import com.google.common.collect.ImmutableList;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.handler.codec.http.DefaultFullHttpRequest;
import io.netty.handler.codec.http.HttpContent;
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpObject;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.netty.handler.codec.http.HttpUtil;
import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.handler.timeout.ReadTimeoutException;
import io.netty.util.internal.StringUtil;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Map.Entry;

/** ChannelHandler for downloads. */
final class HttpDownloadHandler extends AbstractHttpHandler<HttpObject> {

  private OutputStream out;
  private boolean keepAlive = HttpVersion.HTTP_1_1.isKeepAliveDefault();
  private boolean downloadSucceeded;
  private HttpResponse response;

  private long bytesReceived;
  private long contentLength = -1;
  /** the path header in the http request */
  private String path;

  public HttpDownloadHandler(
      Credentials credentials, ImmutableList<Entry<String, String>> extraHttpHeaders) {
    super(credentials, extraHttpHeaders);
  }

  @Override
  protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
    if (!msg.decoderResult().isSuccess()) {
      failAndClose(new IOException("Failed to parse the HTTP response."), ctx);
      return;
    }
    if (!(msg instanceof HttpResponse) && !(msg instanceof HttpContent)) {
      failAndClose(
          new IllegalArgumentException(
              "Unsupported message type: " + StringUtil.simpleClassName(msg)),
          ctx);
      return;
    }
    checkState(userPromise != null, "response before request");

    if (msg instanceof HttpResponse) {
      response = (HttpResponse) msg;
      if (!response.protocolVersion().equals(HttpVersion.HTTP_1_1)) {
        HttpException error =
            new HttpException(
                response, "HTTP version 1.1 is required, was: " + response.protocolVersion(), null);
        failAndClose(error, ctx);
        return;
      }
      boolean contentLengthSet = HttpUtil.isContentLengthSet(response);
      if (!contentLengthSet && !HttpUtil.isTransferEncodingChunked(response)) {
        HttpException error =
            new HttpException(
                response, "Missing 'Content-Length' or 'Transfer-Encoding: chunked' header", null);
        failAndClose(error, ctx);
        return;
      }

      if (contentLengthSet) {
        contentLength = HttpUtil.getContentLength(response);
      }
      downloadSucceeded = response.status().equals(HttpResponseStatus.OK);
      if (!downloadSucceeded) {
        out = new ByteArrayOutputStream();
      }
      keepAlive = HttpUtil.isKeepAlive((HttpResponse) msg);
    }

    if (msg instanceof HttpContent) {
      checkState(response != null, "content before headers");

      ByteBuf content = ((HttpContent) msg).content();
      int readableBytes = content.readableBytes();
      content.readBytes(out, readableBytes);
      bytesReceived += readableBytes;
      if (msg instanceof LastHttpContent) {
        if (downloadSucceeded) {
          succeedAndReset(ctx);
        } else {
          String errorMsg = response.status() + "\n";
          errorMsg +=
              new String(
                  ((ByteArrayOutputStream) out).toByteArray(), HttpUtil.getCharset(response));
          out.close();
          HttpException error = new HttpException(response, errorMsg, null);
          failAndReset(error, ctx);
        }
      }
    }
  }

  @Override
  public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
      throws Exception {
    checkState(userPromise == null, "handler can't be shared between pipelines.");
    userPromise = promise;
    if (!(msg instanceof DownloadCommand)) {
      failAndResetUserPromise(
          new IllegalArgumentException(
              "Unsupported message type: " + StringUtil.simpleClassName(msg)));
      return;
    }
    DownloadCommand cmd = (DownloadCommand) msg;
    out = cmd.out();
    path = constructPath(cmd.uri(), cmd.digest().getHash(), cmd.casDownload());
    HttpRequest request = buildRequest(path, constructHost(cmd.uri()));
    addCredentialHeaders(request, cmd.uri());
    addExtraRemoteHeaders(request);
    addUserAgentHeader(request);
    ctx.writeAndFlush(request)
        .addListener(
            (f) -> {
              if (!f.isSuccess()) {
                failAndClose(f.cause(), ctx);
              }
            });
  }

  @Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
    if (t instanceof ReadTimeoutException) {
      super.exceptionCaught(ctx, new DownloadTimeoutException(path, bytesReceived, contentLength));
    } else {
      super.exceptionCaught(ctx, t);
    }
  }

  private HttpRequest buildRequest(String path, String host) {
    HttpRequest httpRequest =
        new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
    httpRequest.headers().set(HttpHeaderNames.HOST, host);
    httpRequest.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
    httpRequest.headers().set(HttpHeaderNames.ACCEPT, "*/*");
    httpRequest.headers().set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP);
    return httpRequest;
  }

  private void succeedAndReset(ChannelHandlerContext ctx) {
    try {
      succeedAndResetUserPromise();
    } finally {
      reset(ctx);
    }
  }

  @SuppressWarnings("FutureReturnValueIgnored")
  private void failAndClose(Throwable t, ChannelHandlerContext ctx) {
    try {
      failAndResetUserPromise(t);
    } finally {
      ctx.close();
    }
  }

  private void failAndReset(Throwable t, ChannelHandlerContext ctx) {
    try {
      failAndResetUserPromise(t);
    } finally {
      reset(ctx);
    }
  }

  @SuppressWarnings("FutureReturnValueIgnored")
  private void reset(ChannelHandlerContext ctx) {
    try {
      if (!keepAlive) {
        ctx.close();
      }
    } finally {
      out = null;
      keepAlive = HttpVersion.HTTP_1_1.isKeepAliveDefault();
      downloadSucceeded = false;
      response = null;
    }
  }
}


text:
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model frontend\models\UserSearch */
/* @var $form yii\widgets\ActiveForm */
?>

    <?php $form = ActiveForm::begin([
        'action' => ['index'],
        'method' => 'get',
    ]); ?>

    <?= $form->field($model, 'uid') ?>

    <?= $form->field($model, 'username') ?>

    <?= $form->field($model, 'name') ?>

    <?= $form->field($model, 'mobile') ?>

    <?= $form->field($model, 'qq') ?>

    <?php // echo $form->field($model, 'email') ?>

    <?php // echo $form->field($model, 'password_hash') ?>

    <?php // echo $form->field($model, 'auth_key') ?>

    <?php // echo $form->field($model, 'status') ?>

    <?php // echo $form->field($model, 'login') ?>

    <?php // echo $form->field($model, 'password_reset_token') ?>

    <?php // echo $form->field($model, 'role') ?>

    <?php // echo $form->field($model, 'created_ip') ?>

    <?php // echo $form->field($model, 'updated_ip') ?>

    <?php // echo $form->field($model, 'created_at') ?>

    <?php // echo $form->field($model, 'updated_at') ?>

        <?= Html::submitButton(Yii::t('tbhome', 'Search'), ['class' => 'btn btn-primary']) ?>
        <?= Html::resetButton(Yii::t('tbhome', 'Reset'), ['class' => 'btn btn-default']) ?>

    <?php ActiveForm::end(); ?>


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='article',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.CharField(max_length=256, verbose_name='作者')),
                ('title', models.CharField(max_length=256, verbose_name='标题')),
                ('content', models.CharField(max_length=8192, verbose_name='内容')),
            ],
            options={
                'verbose_name': '文章表',
                'verbose_name_plural': '文章表',
                'db_table': 'article',
            },
        ),
    ]


text:
This library aims to provide access to various LCD modules without needing kernel support, by directly talking to them over the I2C/SPI bus or via direct GPIO pin access. Root not required.

No dependencies on external libraries are required. All required libraries are available on my Github account, and will compile into your program statically.

## Library dependencies

All of these are available on my Github account.

* rpiio - https://github.com/zipplet/rpiio

## Supported displays and the driver to use for them

* HD44780 character LCD with 8 user defineable characters
  * Driver:  __rpilcdhd44780__
  * Demo video: https://youtu.be/XQv7JDUyKzE
  * Supported connection methods:
    * I2C bus (with the PCF8574(A) IO expander IC)
    * __Raw (directly connected) displays coming soon, 4 and 8 bit mode__
  * Display sub-types supported / tested:
    * __20x4 5x8 dot__: Full support (tested)
    * __16x2 5x8 dot__: Full support (tested)
    * __40x2 5x8 dot__: Full support __(untested)__
    * The other 3 common sizes I know of (__8x1__, __16x1__ and __40x2__) I cannot get hold of so I cannot test or add support. Please contact me if you wish to donate a module, or add support and send me a pull request.

* SSD1306 OLED display (monochrome)
  * Driver: __rpilcdi2cssd1306__
  * Supported connection modes:
    * I2C bus
  * Display sub-types supported / tested:
    * __128x64__: Under test
  * __Strictly alpha/testing only, please do not use this yet!__

## Upcoming displays

## Directory layout example

**Please always use this standardised directory layout when using any of my freepascal or Delphi programs. The compilation scripts assume that the libraries will always be found by looking one directory back, and under libs/<name>**

* /home/youruser/projects/my_awesome_program
* /home/youruser/projects/libs/rpiio


text:
@protocol BrowsingDataRemoverObserver;
@class WKWebView;

namespace web {

class BrowserState;

// Class used to removes the browsing data stored by the WebKit data store.
class BrowsingDataRemover : public base::SupportsUserData::Data {
 public:
  explicit BrowsingDataRemover(web::BrowserState* browser_state);
  ~BrowsingDataRemover() override;

  // Returns the BrowsingDataRemover associated with |browser_state.|
  // Lazily creates one if an BrowsingDataRemover is not already associated with
  // the |browser_state|. |browser_state| cannot be a nullptr.
  static BrowsingDataRemover* FromBrowserState(BrowserState* browser_state);

  // Clears the browsing data. |modified_since| is the data since which all data
  // is removed. |closure| is called when the browsing data have been cleared.
  void ClearBrowsingData(ClearBrowsingDataMask types,
                         base::Time modified_since,
                         base::OnceClosure closure);

  void AddObserver(id<BrowsingDataRemoverObserver> observer);
  void RemoveObserver(id<BrowsingDataRemoverObserver> observer);

 private:
  web::BrowserState* browser_state_;  // weak, owns this object.
  // The list of observers. Holds weak references.
  NSHashTable<id<BrowsingDataRemoverObserver>>* observers_list_;

  // Dummy WKWebView. A WKWebView object is created before deleting cookies. and
  // is deleted after deleting cookies is completed. this is a workaround that
  // makes sure that there is a WKWebView object alive while accessing
  // WKHTTPCookieStore.
  WKWebView* dummy_web_view_ = nil;

  base::WeakPtrFactory<BrowsingDataRemover> weak_ptr_factory_;
};

}  // namespace web

#endif  // IOS_WEB_BROWSING_DATA_BROWSING_DATA_REMOVER_H_


text:
<?php

namespace Symfony\Component\Form\Guess;

/**
 * Contains a guessed value.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class ValueGuess extends Guess
{
    private $value;

    /**
     * Constructor.
     *
     * @param string|int|bool|null $value      The guessed value
     * @param int                  $confidence The confidence that the guessed class name
     *                                         is correct
     */
    public function __construct($value, $confidence)
    {
        parent::__construct($confidence);

        $this->value = $value;
    }

    /**
     * Returns the guessed value.
     *
     * @return string|int|bool|null
     */
    public function getValue()
    {
        return $this->value;
    }
}


text:
from django.db import models

class Device(models.Model):
    # created and updated
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    # device name
    name = models.CharField(max_length=100)

    # manufacturer's id
    # most brands will have some sort of id you'll want to track
    manufacturer_id = models.CharField(max_length=100, unique=True)

    # type, brand name, etc
    # you may want to add choices to this
    device_type = models.CharField(max_length=100)

    # location
    # you may want to add choices to this
    location = models.CharField(max_length=100)

    def __str__(self):
        return self.name


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
De Schimmelgeslachten Monilia, Oidium, Oospora en Torula, Scheveningen 7(3-4): 50 (1927)

#### Original name
Russula amara Kucera, 1927

### Remarks
null


text:
title: PapljMultiplicativeExprImpl.getSlash - aesi-intellij
---

[aesi-intellij](../../index.html) / [org.metaborg.paplj.psi.impl](../index.html) / [PapljMultiplicativeExprImpl](index.html) / [getSlash](.)

# getSlash

`@Nullable open fun getSlash(): @Nullable PsiElement?`

Overrides [PapljMultiplicativeExpr.getSlash](../../org.metaborg.paplj.psi/-paplj-multiplicative-expr/get-slash.html)