repo_name string | path string | copies string | size string | content string | license string |
|---|---|---|---|---|---|
graetzer/arangodb | arangod/RocksDBEngine/RocksDBReplicationManager.cpp | 1 | 14986 | ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#include "RocksDBReplicationManager.h"
#include "Basics/Exceptions.h"
#include "Basics/MutexLocker.h"
#include "Basics/system-functions.h"
#include "Basics/ResultT.h"
#include "Logger/LogMacros.h"
#include "Logger/Logger.h"
#include "Logger/LoggerStream.h"
#include "RocksDBEngine/RocksDBCommon.h"
#include "RocksDBEngine/RocksDBEngine.h"
#include "RocksDBEngine/RocksDBReplicationContext.h"
#include "VocBase/LogicalCollection.h"
#include <velocypack/Builder.h>
#include <velocypack/velocypack-aliases.h>
using namespace arangodb;
using namespace arangodb::rocksutils;
/// @brief maximum number of contexts to garbage-collect in one go
static constexpr size_t maxCollectCount = 32;
////////////////////////////////////////////////////////////////////////////////
/// @brief create a context repository
////////////////////////////////////////////////////////////////////////////////
RocksDBReplicationManager::RocksDBReplicationManager(RocksDBEngine& engine)
: _lock(), _contexts(), _isShuttingDown(false) {
_contexts.reserve(64);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief destroy a context repository
////////////////////////////////////////////////////////////////////////////////
RocksDBReplicationManager::~RocksDBReplicationManager() {
try {
garbageCollect(true);
} catch (...) {
}
// wait until all used contexts have vanished
int tries = 0;
while (true) {
if (!containsUsedContext()) {
break;
}
if (tries == 0) {
LOG_TOPIC("77d11", INFO, arangodb::Logger::ENGINES)
<< "waiting for used contexts to become unused";
} else if (tries == 120) {
LOG_TOPIC("930b3", WARN, arangodb::Logger::ENGINES)
<< "giving up waiting for unused contexts";
}
std::this_thread::sleep_for(std::chrono::milliseconds(500));
++tries;
}
{
MUTEX_LOCKER(mutexLocker, _lock);
for (auto it : _contexts) {
delete it.second;
}
_contexts.clear();
}
}
//////////////////////////////////////////////////////////////////////////////
/// @brief creates a new context which must be later returned using release()
/// or destroy(); guarantees that RocksDB file deletion is disabled while
/// there are active contexts
//////////////////////////////////////////////////////////////////////////////
RocksDBReplicationContext* RocksDBReplicationManager::createContext(
RocksDBEngine& engine, double ttl, SyncerId const syncerId, ServerId const clientId,
std::string const& patchCount) {
// patchCount should only be set on single servers or DB servers
TRI_ASSERT(patchCount.empty() ||
(ServerState::instance()->isSingleServer() || ServerState::instance()->isDBServer()));
auto context =
std::make_unique<RocksDBReplicationContext>(engine, ttl, syncerId, clientId);
TRI_ASSERT(context->isUsed());
RocksDBReplicationId const id = context->id();
{
MUTEX_LOCKER(mutexLocker, _lock);
if (_isShuttingDown) {
// do not accept any further contexts when we are already shutting down
THROW_ARANGO_EXCEPTION(TRI_ERROR_SHUTTING_DOWN);
}
if (!patchCount.empty()) {
// patchCount was set. this is happening only during the getting-in-sync
// protocol. now check if any other context has the same patchCount
// value set. in this case, the other context is responsible for applying
// count patches, and we have to drop ours
// note: it is safe here to access the patchCount() method of any context,
// as the only place that modifies a context's _patchCount instance variable,
// is the call to setPatchcount() a few lines below. there is no concurrency
// here, as this method here is executed under a mutex. in addition, _contexts
// is only modified under this same mutex,
bool foundOther =
_contexts.end() != std::find_if(_contexts.begin(), _contexts.end(), [&patchCount](decltype(_contexts)::value_type const& entry) {
return entry.second->patchCount() == patchCount;
});
if (!foundOther) {
// no other context exists that has "leadership" for patching counts to the
// same collection/shard
context->setPatchCount(patchCount);
}
// if we found a different context here, then the other context is responsible
// for applying count patches.
}
bool inserted =_contexts.try_emplace(id, context.get()).second;
if (!inserted) {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unable to insert replication context");
}
}
LOG_TOPIC("27c43", TRACE, Logger::REPLICATION)
<< "created replication context " << id << ", ttl: " << ttl;
return context.release();
}
////////////////////////////////////////////////////////////////////////////////
/// @brief remove a context by id
////////////////////////////////////////////////////////////////////////////////
bool RocksDBReplicationManager::remove(RocksDBReplicationId id) {
RocksDBReplicationContext* context = nullptr;
{
MUTEX_LOCKER(mutexLocker, _lock);
auto it = _contexts.find(id);
if (it == _contexts.end()) {
// not found
return false;
}
LOG_TOPIC("71233", TRACE, Logger::REPLICATION) << "removing replication context " << id;
context = it->second;
TRI_ASSERT(context != nullptr);
if (context->isDeleted()) {
// already deleted
return false;
}
if (context->isUsed()) {
// context is in use by someone else. now mark as deleted
context->setDeleted();
return true;
}
// context not in use by someone else
_contexts.erase(it);
}
TRI_ASSERT(context != nullptr);
delete context;
return true;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief find an existing context by id
/// if found, the context will be returned with the usage flag set to true.
/// it must be returned later using release()
////////////////////////////////////////////////////////////////////////////////
RocksDBReplicationContext* RocksDBReplicationManager::find(RocksDBReplicationId id, double ttl) {
RocksDBReplicationContext* context = nullptr;
{
MUTEX_LOCKER(mutexLocker, _lock);
auto it = _contexts.find(id);
if (it == _contexts.end()) {
// not found
LOG_TOPIC("629ab", TRACE, Logger::REPLICATION)
<< "trying to find non-existing context " << id;
return nullptr;
}
context = it->second;
TRI_ASSERT(context != nullptr);
if (context->isDeleted()) {
LOG_TOPIC("86214", WARN, Logger::REPLICATION) << "Trying to use deleted "
<< "replication context with id " << id;
// already deleted
return nullptr;
}
context->use(ttl);
}
return context;
}
//////////////////////////////////////////////////////////////////////////////
/// @brief find an existing context by id and extend lifetime
/// may be used concurrently on used contexts
/// populates clientId
//////////////////////////////////////////////////////////////////////////////
ResultT<std::tuple<SyncerId, ServerId, std::string>> RocksDBReplicationManager::extendLifetime(
RocksDBReplicationId id, double ttl) {
MUTEX_LOCKER(mutexLocker, _lock);
auto it = _contexts.find(id);
if (it == _contexts.end()) {
// not found
return {TRI_ERROR_CURSOR_NOT_FOUND};
}
LOG_TOPIC("71234", TRACE, Logger::REPLICATION)
<< "extending lifetime of replication context " << id;
RocksDBReplicationContext* context = it->second;
TRI_ASSERT(context != nullptr);
if (context->isDeleted()) {
// already deleted
return {TRI_ERROR_CURSOR_NOT_FOUND};
}
// populate clientId
SyncerId const syncerId = context->syncerId();
ServerId const clientId = context->replicationClientServerId();
std::string const& clientInfo = context->clientInfo();
context->extendLifetime(ttl);
return {std::make_tuple(syncerId, clientId, clientInfo)};
}
////////////////////////////////////////////////////////////////////////////////
/// @brief return a context for later use
////////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::release(RocksDBReplicationContext* context) {
{
MUTEX_LOCKER(mutexLocker, _lock);
TRI_ASSERT(context->isUsed());
context->release();
if (!context->isDeleted() || context->isUsed()) {
return;
}
// remove from the list
LOG_TOPIC("eb2f6", TRACE, Logger::REPLICATION)
<< "removing deleted replication context " << context->id();
_contexts.erase(context->id());
}
// and free the context
delete context;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief return a context for garbage collection
////////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::destroy(RocksDBReplicationContext* context) {
if (context != nullptr) {
remove(context->id());
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not the repository contains a used context
////////////////////////////////////////////////////////////////////////////////
bool RocksDBReplicationManager::containsUsedContext() {
MUTEX_LOCKER(mutexLocker, _lock);
for (auto it : _contexts) {
if (it.second->isUsed()) {
return true;
}
}
return false;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief drop contexts by database (at least mark them as deleted)
////////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::drop(TRI_vocbase_t* vocbase) {
TRI_ASSERT(vocbase != nullptr);
LOG_TOPIC("ce3b0", TRACE, Logger::REPLICATION)
<< "dropping all replication contexts for database " << vocbase->name();
{
MUTEX_LOCKER(mutexLocker, _lock);
for (auto& context : _contexts) {
context.second->removeVocbase(*vocbase); // will set deleted flag
}
}
garbageCollect(false);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief drop contexts by collection (at least mark them as deleted)
////////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::drop(LogicalCollection* collection) {
TRI_ASSERT(collection != nullptr);
LOG_TOPIC("fe4bb", TRACE, Logger::REPLICATION)
<< "dropping all replication contexts for collection " << collection->name();
bool found = false;
{
MUTEX_LOCKER(mutexLocker, _lock);
for (auto& context : _contexts) {
found |= context.second->removeCollection(*collection);
}
}
if (found) {
garbageCollect(false);
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief drop all contexts (at least mark them as deleted)
////////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::dropAll() {
LOG_TOPIC("bc8a8", TRACE, Logger::REPLICATION) << "deleting all replication contexts";
{
MUTEX_LOCKER(mutexLocker, _lock);
for (auto& context : _contexts) {
context.second->setDeleted();
}
}
garbageCollect(true);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief run a garbage collection on the contexts
////////////////////////////////////////////////////////////////////////////////
bool RocksDBReplicationManager::garbageCollect(bool force) {
LOG_TOPIC("79b22", TRACE, Logger::REPLICATION)
<< "garbage-collecting replication contexts";
auto const now = TRI_microtime();
std::vector<RocksDBReplicationContext*> found;
size_t foundUsed = 0;
size_t foundUsedDeleted = 0;
try {
found.reserve(maxCollectCount);
MUTEX_LOCKER(mutexLocker, _lock);
for (auto it = _contexts.begin(); it != _contexts.end();
/* no hoisting */) {
auto context = it->second;
if (!force && context->isUsed()) {
// must not physically destroy contexts that are currently used
++foundUsed;
if (context->isDeleted()) {
++foundUsedDeleted;
}
++it;
continue;
}
if (force || context->expires() < now) {
if (force) {
LOG_TOPIC("26ab2", TRACE, Logger::REPLICATION)
<< "force-deleting context " << context->id();
} else {
LOG_TOPIC("be214", TRACE, Logger::REPLICATION) << "context " << context->id() << " is expired";
}
context->setDeleted();
}
if (context->isDeleted()) {
try {
found.emplace_back(context);
it = _contexts.erase(it);
} catch (...) {
// stop iteration
break;
}
if (!force && found.size() >= maxCollectCount) {
break;
}
} else {
++it;
}
}
} catch (...) {
// go on and remove whatever we found so far
}
// remove contexts outside the lock
for (auto it : found) {
LOG_TOPIC("44874", TRACE, Logger::REPLICATION)
<< "garbage collecting replication context " << it->id();
delete it;
}
if (foundUsed > 0 || foundUsedDeleted > 0) {
LOG_TOPIC("7b2b0", TRACE, Logger::REPLICATION)
<< "garbage-collection found used contexts: " << foundUsed
<< ", used deleted contexts: " << foundUsedDeleted;
}
return (!found.empty());
}
//////////////////////////////////////////////////////////////////////////////
/// @brief tell the replication manager that a shutdown is in progress
/// effectively this will block the creation of new contexts
//////////////////////////////////////////////////////////////////////////////
void RocksDBReplicationManager::beginShutdown() {
{
MUTEX_LOCKER(mutexLocker, _lock);
_isShuttingDown = true;
}
garbageCollect(false);
}
| apache-2.0 |
PrimeSense/NiTEControls | Source/XnVSessionGenerator.cpp | 1 | 6204 | /*****************************************************************************
* *
* NiTE Controls 1.x Alpha *
* Copyright (C) 2013 PrimeSense Ltd. *
* *
* This file is part of NiTE Controls Lab. *
* *
* 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 "XnVSessionGenerator.h"
#include "XnVSessionListenerList.h"
#include "XnVSessionMessage.h"
#include "XnVNiteLog.h"
class XnVSessionListenerFuncContainer : public XnVSessionListener
{
public:
XnVSessionListenerFuncContainer(void* pUserContext, OnSessionStartCB pCreateCB, OnSessionEndCB pDestroyCB,
OnFocusStartDetectedCB pFocusStartDetectedCB = NULL) :
m_pUserContext(pUserContext),
m_pCreateCB(pCreateCB),
m_pDestroyCB(pDestroyCB),
m_pFocusStartDetectedCB(pFocusStartDetectedCB)
{}
void OnSessionStart(const XnPoint3D& ptPosition)
{
(*m_pCreateCB)(ptPosition, m_pUserContext);
} // OnSessionStart
void OnSessionEnd()
{
(*m_pDestroyCB)(m_pUserContext);
} // OnSessionEnd
void OnFocusStartDetected(const XnChar* strFocus, const XnPoint3D& ptPosition, XnFloat fProgress)
{
if (NULL != m_pFocusStartDetectedCB)
{
(*m_pFocusStartDetectedCB)(strFocus, ptPosition, fProgress, m_pUserContext);
}
}
protected:
OnSessionStartCB m_pCreateCB;
OnSessionEndCB m_pDestroyCB;
OnFocusStartDetectedCB m_pFocusStartDetectedCB;
void* m_pUserContext;
}; // XnVSessionListenerFuncContainer
XnVSessionGenerator::XnVSessionGenerator(const XnChar* strName) :
XnVMessageGenerator(strName), m_bInSession(FALSE)
{
m_pSessionListeners = XN_NEW(XnVSessionListenerList);
} // XnVSessionGenerator::XnVSessionGenerator
XnVSessionGenerator::~XnVSessionGenerator()
{
XN_DELETE(m_pSessionListeners);
} // XnVSessionGenerator::~XnVSessionGenerator
XnVHandle XnVSessionGenerator::RegisterSession(XnVSessionListener* pListener)
{
return m_pSessionListeners->MarkAdd(pListener, false);
} // XnVSessionGenerator::RegisterSession
XnVHandle XnVSessionGenerator::RegisterSession(void* cxt,
XnVSessionListener::OnSessionStartCB StartCB,
XnVSessionListener::OnSessionEndCB EndCB,
XnVSessionListener::OnFocusStartDetectedCB MidCB)
{
XnVSessionListener* pSessionListener = XN_NEW(XnVSessionListenerFuncContainer, cxt, StartCB, EndCB, MidCB);
if (pSessionListener == NULL)
{
return XN_HANDLE_INVALID;
}
return m_pSessionListeners->MarkAdd(pSessionListener, true);
} // XnVSessionGenerator::RegisterSession
void XnVSessionGenerator::UnregisterSession(XnVSessionListener* pSessionListener)
{
XnUInt32 nHandle = m_pSessionListeners->GetID(pSessionListener);
m_pSessionListeners->MarkRemove(nHandle);
} // XnVSessionGenerator::UnregisterSession
void XnVSessionGenerator::UnregisterSession(XnVHandle nHandle)
{
m_pSessionListeners->MarkRemove(nHandle);
} // XnVSessionGenerator::UnregisterSession
void XnVSessionGenerator::SessionStart(const XnPoint3D& ptFocus)
{
xnLogVerbose(XNV_NITE_MASK_SESSION, "Session Created, focus at (%f,%f,%f)",
ptFocus.X, ptFocus.Y, ptFocus.Z);
// Call callbacks
m_ptFocusPoint = ptFocus;
m_bInSession = true;
m_pSessionListeners->UpdateLists();
for (XnVSessionListenerList::Iterator iter = m_pSessionListeners->begin();
iter != m_pSessionListeners->end(); iter++)
{
XnVSessionListener* pListener = iter.Value();
pListener->OnSessionStart(ptFocus);
}
m_pSessionListeners->UpdateLists();
XnVSessionMessage sessionMessage(true, ptFocus);
Generate(&sessionMessage);
} // XnVSessionGenerator::SessionStart
void XnVSessionGenerator::SessionStop()
{
xnLogVerbose(XNV_NITE_MASK_SESSION, "Session Ended");
m_bInSession = false;
XnVSessionMessage sessionMessage(false);
Generate(&sessionMessage);
m_pSessionListeners->UpdateLists();
for (XnVSessionListenerList::Iterator iter = m_pSessionListeners->begin();
iter != m_pSessionListeners->end(); iter++)
{
XnVSessionListener* pListener = iter.Value();
pListener->OnSessionEnd();
}
m_pSessionListeners->UpdateLists();
} // XnVSessionGenerator::SessionStop
void XnVSessionGenerator::SessionMidGesture(const XnChar* strFocus, const XnPoint3D& ptFocus, XnFloat fProgress)
{
xnLogVerbose(XNV_NITE_MASK_SESSION, "Session about to start, at (%f,%f,%f), by gesture '%s'. Progress %f",
ptFocus.X, ptFocus.Y, ptFocus.Z, strFocus, fProgress);
// Call callbacks
m_pSessionListeners->UpdateLists();
for (XnVSessionListenerList::Iterator iter = m_pSessionListeners->begin();
iter != m_pSessionListeners->end(); iter++)
{
XnVSessionListener* pListener = iter.Value();
pListener->OnFocusStartDetected(strFocus, ptFocus, fProgress);
}
m_pSessionListeners->UpdateLists();
} // XnVSessionGenerator::SessionMidGesture
XnBool XnVSessionGenerator::IsInSession() const
{
return m_bInSession;
} // XnVSessionGenerator::IsInSession
XnStatus XnVSessionGenerator::GetFocusPoint(XnPoint3D& ptFocus) const
{
ptFocus = m_ptFocusPoint;
return XN_STATUS_OK;
}
| apache-2.0 |
digsrc/tcl-websh | src/generic/checksum.c | 2 | 6143 | /* ----------------------------------------------------------------------------
* checksum.c --- Checksum generator functions
* nca-073-9
*
* Copyright (c) 1996-2000 by Netcetera AG.
* Copyright (c) 2001 by Apache Software Foundation.
* All rights reserved.
*
* See the file "license.terms" for information on usage and
* redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* @(#) $Id: checksum.c 814683 2009-09-14 15:11:40Z ronnie $
* ------------------------------------------------------------------------- */
#include <tcl.h>
#include "checksum.h"
unsigned short crc_lut[256] = {
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
0x1231, 0x0210, 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6,
0x9339, 0x8318, 0xB37B, 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE,
0x2462, 0x3443, 0x0420, 0x1401, 0x64E6, 0x74C7, 0x44A4, 0x5485,
0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, 0xF5CF, 0xC5AC, 0xD58D,
0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, 0x5695, 0x46B4,
0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, 0xC7BC,
0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823,
0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B,
0x5AF5, 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12,
0xDBFD, 0xCBDC, 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A,
0x6CA6, 0x7C87, 0x4CE4, 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41,
0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, 0xAD2A, 0xBD0B, 0x8D68, 0x9D49,
0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, 0x2E32, 0x1E51, 0x0E70,
0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, 0x9F59, 0x8F78,
0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, 0xE16F,
0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067,
0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E,
0x02B1, 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256,
0xB5EA, 0xA5CB, 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D,
0x34E2, 0x24C3, 0x14A0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,
0xA7DB, 0xB7FA, 0x8799, 0x97B8, 0xE75F, 0xF77E, 0xC71D, 0xD73C,
0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, 0x7676, 0x4615, 0x5634,
0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, 0xB98A, 0xA9AB,
0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, 0x28A3,
0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A,
0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92,
0xFD2E, 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9,
0x7C26, 0x6C07, 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1,
0xEF1F, 0xFF3E, 0xCF5D, 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8,
0x6E17, 0x7E36, 0x4E55, 0x5E74, 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0
};
/* ----------------------------------------------------------------------------
* crcCalc -- from Tcl_Obj, calculate CRC
* ------------------------------------------------------------------------- */
unsigned short crcCalc(Tcl_Obj * in)
{
unsigned char *bytes = NULL;
int bytesLen = -1;
unsigned short word = 0;
int i = 0;
volatile unsigned char idx = 0;
if (in == NULL)
return 0;
bytes = Tcl_GetByteArrayFromObj(in, &bytesLen);
word = (1 | (1 << 8));
for (i = 0; i < bytesLen; i++) {
idx = (unsigned char) (bytes[i] ^ WEB_HIG_BYTE(word));
word = (crc_lut[idx]) ^ (WEB_LOW_BYTE(word) << 8);
}
return word;
}
/* ----------------------------------------------------------------------------
* crcAsciify -- generate ASCII rep of 2 bytes
* ------------------------------------------------------------------------- */
Tcl_Obj *crcAsciify(unsigned short crc)
{
Tcl_Obj *tmp = NULL;
char tmpc1 = 0;
char tmpc2 = 0;
unsigned char byte = 0;
tmp = Tcl_NewObj();
Tcl_IncrRefCount(tmp);
byte = WEB_HIG_BYTE(crc);
tmpc1 = (byte / 16) + 'A';
tmpc2 = (byte % 16) + 'A';
Tcl_AppendToObj(tmp, &tmpc1, 1);
Tcl_AppendToObj(tmp, &tmpc2, 1);
byte = WEB_LOW_BYTE(crc);
tmpc1 = (byte / 16) + 'A';
tmpc2 = (byte % 16) + 'A';
Tcl_AppendToObj(tmp, &tmpc1, 1);
Tcl_AppendToObj(tmp, &tmpc2, 1);
return tmp;
}
/* ----------------------------------------------------------------------------
* crcDeAsciify -- from ASII rep back to 2 bytes
* ------------------------------------------------------------------------- */
unsigned short crcDeAsciify(Tcl_Obj * in)
{
unsigned char lowByte = 0;
unsigned char higByte = 0;
char *str = NULL;
int len = 0;
unsigned short crc = 0;
if (in == NULL)
return 0;
str = Tcl_GetStringFromObj(in, &len);
if (len != 4)
return 0;
higByte = ((str[0] - 'A') << 4) | ((str[1] - 'A'));
lowByte = ((str[2] - 'A') << 4) | ((str[3] - 'A'));
crc = (higByte << 8) | lowByte;
return crc;
}
/* ----------------------------------------------------------------------------
* crcCheck -- check if crc at end of string is valid for string
* ------------------------------------------------------------------------- */
Tcl_Obj *crcCheck(Tcl_Obj * in)
{
Tcl_Obj *crcObj = NULL;
int len;
int crc1;
int crc2;
if (in == NULL)
return NULL;
len = Tcl_GetCharLength(in);
if (len < 4)
return NULL;
crcObj = Tcl_GetRange(in, len - 4, len - 1);
Tcl_IncrRefCount(crcObj);
crc1 = crcDeAsciify(crcObj);
Tcl_DecrRefCount(crcObj);
crcObj = Tcl_GetRange(in, 0, len - 5);
Tcl_IncrRefCount(crcObj);
crc2 = crcCalc(crcObj);
if (crc2 == crc1) {
return crcObj;
}
Tcl_DecrRefCount(crcObj);
return NULL;
}
/* ----------------------------------------------------------------------------
* crcAdd -- append crc to string
* ------------------------------------------------------------------------- */
int crcAdd(Tcl_Obj * in)
{
unsigned short crc = 0;
Tcl_Obj *tmp2 = NULL;
if (in == NULL)
return TCL_ERROR;
crc = crcCalc(in);
tmp2 = crcAsciify(crc);
if (tmp2 == NULL)
return TCL_ERROR;
Tcl_AppendObjToObj(in, tmp2);
Tcl_DecrRefCount(tmp2);
return TCL_OK;
}
| apache-2.0 |
RayRuizhiLiao/ITK_4D | Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/complex16/zunghr.f | 2 | 5023 | SUBROUTINE ZUNGHR( N, ILO, IHI, A, LDA, TAU, WORK, LWORK, INFO )
*
* -- LAPACK routine (version 3.0) --
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
* Courant Institute, Argonne National Lab, and Rice University
* June 30, 1999
*
* .. Scalar Arguments ..
INTEGER IHI, ILO, INFO, LDA, LWORK, N
* ..
* .. Array Arguments ..
COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
* ..
*
* Purpose
* =======
*
* ZUNGHR generates a complex unitary matrix Q which is defined as the
* product of IHI-ILO elementary reflectors of order N, as returned by
* ZGEHRD:
*
* Q = H(ilo) H(ilo+1) . . . H(ihi-1).
*
* Arguments
* =========
*
* N (input) INTEGER
* The order of the matrix Q. N >= 0.
*
* ILO (input) INTEGER
* IHI (input) INTEGER
* ILO and IHI must have the same values as in the previous call
* of ZGEHRD. Q is equal to the unit matrix except in the
* submatrix Q(ilo+1:ihi,ilo+1:ihi).
* 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
*
* A (input/output) COMPLEX*16 array, dimension (LDA,N)
* On entry, the vectors which define the elementary reflectors,
* as returned by ZGEHRD.
* On exit, the N-by-N unitary matrix Q.
*
* LDA (input) INTEGER
* The leading dimension of the array A. LDA >= max(1,N).
*
* TAU (input) COMPLEX*16 array, dimension (N-1)
* TAU(i) must contain the scalar factor of the elementary
* reflector H(i), as returned by ZGEHRD.
*
* WORK (workspace/output) COMPLEX*16 array, dimension (LWORK)
* On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
*
* LWORK (input) INTEGER
* The dimension of the array WORK. LWORK >= IHI-ILO.
* For optimum performance LWORK >= (IHI-ILO)*NB, where NB is
* the optimal blocksize.
*
* If LWORK = -1, then a workspace query is assumed; the routine
* only calculates the optimal size of the WORK array, returns
* this value as the first entry of the WORK array, and no error
* message related to LWORK is issued by XERBLA.
*
* INFO (output) INTEGER
* = 0: successful exit
* < 0: if INFO = -i, the i-th argument had an illegal value
*
* =====================================================================
*
* .. Parameters ..
COMPLEX*16 ZERO, ONE
PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ),
$ ONE = ( 1.0D+0, 0.0D+0 ) )
* ..
* .. Local Scalars ..
LOGICAL LQUERY
INTEGER I, IINFO, J, LWKOPT, NB, NH
* ..
* .. External Subroutines ..
EXTERNAL XERBLA, ZUNGQR
* ..
* .. External Functions ..
INTEGER ILAENV
EXTERNAL ILAENV
* ..
* .. Intrinsic Functions ..
INTRINSIC MAX, MIN
* ..
* .. Executable Statements ..
*
* Test the input arguments
*
INFO = 0
NH = IHI - ILO
LQUERY = ( LWORK.EQ.-1 )
IF( N.LT.0 ) THEN
INFO = -1
ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, N ) ) THEN
INFO = -2
ELSE IF( IHI.LT.MIN( ILO, N ) .OR. IHI.GT.N ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -5
ELSE IF( LWORK.LT.MAX( 1, NH ) .AND. .NOT.LQUERY ) THEN
INFO = -8
END IF
*
IF( INFO.EQ.0 ) THEN
NB = ILAENV( 1, 'ZUNGQR', ' ', NH, NH, NH, -1 )
LWKOPT = MAX( 1, NH )*NB
WORK( 1 ) = LWKOPT
END IF
*
IF( INFO.NE.0 ) THEN
CALL XERBLA( 'ZUNGHR', -INFO )
RETURN
ELSE IF( LQUERY ) THEN
RETURN
END IF
*
* Quick return if possible
*
IF( N.EQ.0 ) THEN
WORK( 1 ) = 1
RETURN
END IF
*
* Shift the vectors which define the elementary reflectors one
* column to the right, and set the first ilo and the last n-ihi
* rows and columns to those of the unit matrix
*
DO 40 J = IHI, ILO + 1, -1
DO 10 I = 1, J - 1
A( I, J ) = ZERO
10 CONTINUE
DO 20 I = J + 1, IHI
A( I, J ) = A( I, J-1 )
20 CONTINUE
DO 30 I = IHI + 1, N
A( I, J ) = ZERO
30 CONTINUE
40 CONTINUE
DO 60 J = 1, ILO
DO 50 I = 1, N
A( I, J ) = ZERO
50 CONTINUE
A( J, J ) = ONE
60 CONTINUE
DO 80 J = IHI + 1, N
DO 70 I = 1, N
A( I, J ) = ZERO
70 CONTINUE
A( J, J ) = ONE
80 CONTINUE
*
IF( NH.GT.0 ) THEN
*
* Generate Q(ilo+1:ihi,ilo+1:ihi)
*
CALL ZUNGQR( NH, NH, NH, A( ILO+1, ILO+1 ), LDA, TAU( ILO ),
$ WORK, LWORK, IINFO )
END IF
WORK( 1 ) = LWKOPT
RETURN
*
* End of ZUNGHR
*
END
| apache-2.0 |
execunix/vinos | usr.bin/iconv/iconv.c | 2 | 5985 | /* $NetBSD: iconv.c,v 1.19 2013/10/07 02:00:46 dholland Exp $ */
/*-
* Copyright (c)2003 Citrus Project,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: iconv.c,v 1.19 2013/10/07 02:00:46 dholland Exp $");
#endif /* LIBC_SCCS and not lint */
#include <err.h>
#include <errno.h>
#include <iconv.h>
#include <langinfo.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
static void usage(void) __dead;
static int scmp(const void *, const void *);
static void show_codesets(void);
static void do_conv(const char *, FILE *, const char *, const char *, int, int);
static void
usage(void)
{
(void)fprintf(stderr,
"Usage:\t%1$s [-cs] -f <from_code> -t <to_code> [file ...]\n"
"\t%1$s -f <from_code> [-cs] [-t <to_code>] [file ...]\n"
"\t%1$s -t <to_code> [-cs] [-f <from_code>] [file ...]\n"
"\t%1$s -l\n", getprogname());
exit(1);
}
/*
* qsort() helper function
*/
static int
scmp(const void *v1, const void *v2)
{
const char * const *s1 = v1;
const char * const *s2 = v2;
return strcasecmp(*s1, *s2);
}
static void
show_codesets(void)
{
char **list;
size_t sz, i;
if (__iconv_get_list(&list, &sz))
err(EXIT_FAILURE, "__iconv_get_list()");
qsort(list, sz, sizeof(char *), scmp);
for (i = 0; i < sz; i++)
(void)printf("%s\n", list[i]);
__iconv_free_list(list, sz);
}
#define INBUFSIZE 1024
#define OUTBUFSIZE (INBUFSIZE * 2)
/*ARGSUSED*/
static void
do_conv(const char *fn, FILE *fp, const char *from, const char *to, int silent,
int hide_invalid)
{
char inbuf[INBUFSIZE], outbuf[OUTBUFSIZE], *out;
const char *in;
size_t inbytes, outbytes, ret, invalids;
iconv_t cd;
uint32_t flags = 0;
int serrno;
if (hide_invalid)
flags |= __ICONV_F_HIDE_INVALID;
cd = iconv_open(to, from);
if (cd == (iconv_t)-1)
err(EXIT_FAILURE, "iconv_open(%s, %s)", to, from);
invalids = 0;
while ((inbytes = fread(inbuf, 1, INBUFSIZE, fp)) > 0) {
in = inbuf;
while (inbytes > 0) {
size_t inval;
out = outbuf;
outbytes = OUTBUFSIZE;
ret = __iconv(cd, &in, &inbytes, &out, &outbytes,
flags, &inval);
serrno = errno;
invalids += inval;
if (outbytes < OUTBUFSIZE)
(void)fwrite(outbuf, 1, OUTBUFSIZE - outbytes,
stdout);
errno = serrno;
if (ret == (size_t)-1 && errno != E2BIG) {
/*
* XXX: iconv(3) is bad interface.
* invalid character count is lost here.
* instead, we just provide __iconv function.
*/
if (errno != EINVAL || in == inbuf)
err(EXIT_FAILURE, "iconv()");
/* incomplete input character */
(void)memmove(inbuf, in, inbytes);
ret = fread(inbuf + inbytes, 1,
INBUFSIZE - inbytes, fp);
if (ret == 0) {
fflush(stdout);
if (feof(fp))
errx(EXIT_FAILURE,
"unexpected end of file; "
"the last character is "
"incomplete.");
else
err(EXIT_FAILURE, "fread()");
}
in = inbuf;
inbytes += ret;
}
}
}
/* reset the shift state of the output buffer */
outbytes = OUTBUFSIZE;
out = outbuf;
ret = iconv(cd, NULL, NULL, &out, &outbytes);
if (ret == (size_t)-1)
err(EXIT_FAILURE, "iconv()");
if (outbytes < OUTBUFSIZE)
(void)fwrite(outbuf, 1, OUTBUFSIZE - outbytes, stdout);
if (invalids > 0 && !silent)
warnx("warning: invalid characters: %lu",
(unsigned long)invalids);
iconv_close(cd);
}
int
main(int argc, char **argv)
{
int ch, i;
int opt_l = 0, opt_s = 0, opt_c = 0;
char *opt_f = NULL, *opt_t = NULL;
FILE *fp;
setlocale(LC_ALL, "");
setprogname(argv[0]);
while ((ch = getopt(argc, argv, "cslf:t:")) != EOF) {
switch (ch) {
case 'c':
opt_c = 1;
break;
case 's':
opt_s = 1;
break;
case 'l':
/* list */
opt_l = 1;
break;
case 'f':
/* from */
opt_f = estrdup(optarg);
break;
case 't':
/* to */
opt_t = estrdup(optarg);
break;
default:
usage();
}
}
argc -= optind;
argv += optind;
if (opt_l) {
if (argc > 0 || opt_s || opt_f != NULL || opt_t != NULL) {
warnx("-l is not allowed with other flags.");
usage();
}
show_codesets();
} else {
if (opt_f == NULL) {
if (opt_t == NULL)
usage();
opt_f = nl_langinfo(CODESET);
} else if (opt_t == NULL)
opt_t = nl_langinfo(CODESET);
if (argc == 0)
do_conv("<stdin>", stdin, opt_f, opt_t, opt_s, opt_c);
else {
for (i = 0; i < argc; i++) {
fp = fopen(argv[i], "r");
if (fp == NULL)
err(EXIT_FAILURE, "Cannot open `%s'",
argv[i]);
do_conv(argv[i], fp, opt_f, opt_t, opt_s,
opt_c);
(void)fclose(fp);
}
}
}
return EXIT_SUCCESS;
}
| apache-2.0 |
nagineni/soletta | src/lib/comms/sol-socket-impl-linux.c | 2 | 14656 | /*
* This file is part of the Soletta Project
*
* Copyright (C) 2015 Intel Corporation. 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.
*/
#include <netinet/in.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include "sol-log.h"
#include "sol-mainloop.h"
#include "sol-network.h"
#include "sol-network-util.h"
#include "sol-util-internal.h"
#include "sol-socket.h"
#include "sol-socket-impl.h"
struct sol_socket_linux {
struct sol_socket base;
int fd;
struct {
bool (*cb)(void *data, struct sol_socket *s);
const void *data;
struct sol_fd *watch;
} read, write;
};
static bool
on_socket_read(void *data, int fd, unsigned int flags)
{
struct sol_socket_linux *s = data;
bool ret;
ret = s->read.cb((void *)s->read.data, &s->base);
if (!ret) {
s->read.cb = NULL;
s->read.data = NULL;
s->read.watch = NULL;
}
return ret;
}
static bool
on_socket_write(void *data, int fd, unsigned int flags)
{
struct sol_socket_linux *s = data;
bool ret;
ret = s->write.cb((void *)s->write.data, &s->base);
if (!ret) {
s->write.cb = NULL;
s->write.data = NULL;
s->write.watch = NULL;
}
return ret;
}
static int
from_sockaddr(const struct sockaddr *sockaddr, socklen_t socklen,
struct sol_network_link_addr *addr)
{
SOL_NULL_CHECK(sockaddr, -EINVAL);
SOL_NULL_CHECK(addr, -EINVAL);
if (sockaddr->sa_family != AF_INET && sockaddr->sa_family != AF_INET6)
return -EINVAL;
addr->family = sol_network_af_to_sol(sockaddr->sa_family);
if (sockaddr->sa_family == AF_INET) {
struct sockaddr_in *sock4 = (struct sockaddr_in *)sockaddr;
if (socklen < sizeof(struct sockaddr_in))
return -EINVAL;
addr->port = ntohs(sock4->sin_port);
memcpy(&addr->addr.in, &sock4->sin_addr, sizeof(sock4->sin_addr));
} else {
struct sockaddr_in6 *sock6 = (struct sockaddr_in6 *)sockaddr;
if (socklen < sizeof(struct sockaddr_in6))
return -EINVAL;
addr->port = ntohs(sock6->sin6_port);
memcpy(&addr->addr.in6, &sock6->sin6_addr, sizeof(sock6->sin6_addr));
}
return 0;
}
static int
to_sockaddr(const struct sol_network_link_addr *addr, struct sockaddr *sockaddr, socklen_t *socklen)
{
SOL_NULL_CHECK(addr, -EINVAL);
SOL_NULL_CHECK(sockaddr, -EINVAL);
SOL_NULL_CHECK(socklen, -EINVAL);
if (addr->family == SOL_NETWORK_FAMILY_INET) {
struct sockaddr_in *sock4 = (struct sockaddr_in *)sockaddr;
if (*socklen < sizeof(struct sockaddr_in))
return -EINVAL;
memcpy(&sock4->sin_addr, addr->addr.in, sizeof(addr->addr.in));
sock4->sin_port = htons(addr->port);
sock4->sin_family = AF_INET;
*socklen = sizeof(*sock4);
} else if (addr->family == SOL_NETWORK_FAMILY_INET6) {
struct sockaddr_in6 *sock6 = (struct sockaddr_in6 *)sockaddr;
if (*socklen < sizeof(struct sockaddr_in6))
return -EINVAL;
memcpy(&sock6->sin6_addr, addr->addr.in6, sizeof(addr->addr.in6));
sock6->sin6_port = htons(addr->port);
sock6->sin6_family = AF_INET6;
*socklen = sizeof(*sock6);
} else {
return -EINVAL;
}
return *socklen;
}
static struct sol_socket *
sol_socket_linux_new(int domain, enum sol_socket_type type, int protocol)
{
struct sol_socket_linux *s;
int fd, socktype = SOCK_CLOEXEC | SOCK_NONBLOCK;
switch (type) {
case SOL_SOCKET_UDP:
socktype |= SOCK_DGRAM;
break;
default:
SOL_WRN("Unsupported socket type: %d", type);
errno = EPROTOTYPE;
return NULL;
}
fd = socket(sol_network_sol_to_af(domain), socktype, protocol);
SOL_INT_CHECK(fd, < 0, NULL);
s = calloc(1, sizeof(*s));
SOL_NULL_CHECK_GOTO(s, calloc_error);
s->fd = fd;
return &s->base;
calloc_error:
close(fd);
return NULL;
}
static void
sol_socket_linux_del(struct sol_socket *socket)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
if (s->read.watch)
sol_fd_del(s->read.watch);
if (s->write.watch)
sol_fd_del(s->write.watch);
close(s->fd);
free(s);
}
static int
sol_socket_linux_set_on_read(struct sol_socket *socket, bool (*cb)(void *data, struct sol_socket *s), const void *data)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
if (cb && !s->read.watch) {
s->read.watch = sol_fd_add(s->fd, SOL_FD_FLAGS_IN, on_socket_read, s);
SOL_NULL_CHECK(s->read.watch, -ENOMEM);
} else if (!cb && s->read.watch) {
sol_fd_del(s->read.watch);
s->read.watch = NULL;
}
s->read.cb = cb;
s->read.data = data;
return 0;
}
static int
sol_socket_linux_set_on_write(struct sol_socket *socket, bool (*cb)(void *data, struct sol_socket *s), const void *data)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
if (cb && !s->write.watch) {
s->write.watch = sol_fd_add(s->fd, SOL_FD_FLAGS_OUT, on_socket_write, s);
SOL_NULL_CHECK(s->write.watch, -ENOMEM);
} else if (!cb && s->write.watch) {
sol_fd_del(s->write.watch);
s->write.watch = NULL;
}
s->write.cb = cb;
s->write.data = data;
return 0;
}
static ssize_t
sol_socket_linux_recvmsg(struct sol_socket *socket, void *buf, size_t len, struct sol_network_link_addr *cliaddr)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
uint8_t sockaddr[sizeof(struct sockaddr_in6)] = { };
struct iovec iov = { .iov_base = buf,
.iov_len = len };
struct msghdr msg = {
.msg_name = &sockaddr,
.msg_namelen = sizeof(sockaddr),
.msg_iov = &iov,
.msg_iovlen = 1
};
ssize_t r;
/* When more types of sockets (not just datagram) are accepted,
* remember to err if !buf && type != DGRAM */
if (!buf) {
msg.msg_iov->iov_len = 0;
return recvmsg(s->fd, &msg, MSG_TRUNC | MSG_PEEK);
} else
r = recvmsg(s->fd, &msg, 0);
if (r < 0)
return -errno;
if (from_sockaddr((struct sockaddr *)sockaddr, sizeof(sockaddr), cliaddr) < 0)
return -EINVAL;
return r;
}
static bool
sendmsg_multicast_addrs(int fd, struct sol_network_link *net_link,
struct msghdr *msg)
{
struct ip_mreqn ip4_mreq = { .imr_ifindex = net_link->index };
struct ipv6_mreq ip6_mreq = { .ipv6mr_interface = net_link->index };
struct ip_mreqn orig_ip4_mreq;
struct ipv6_mreq orig_ip6_mreq;
struct sol_network_link_addr *addr;
uint16_t idx;
bool success = false;
SOL_VECTOR_FOREACH_IDX (&net_link->addrs, addr, idx) {
void *p_orig, *p_new;
int level, option;
socklen_t l, l_orig;
if (addr->family == SOL_NETWORK_FAMILY_INET) {
level = IPPROTO_IP;
option = IP_MULTICAST_IF;
p_orig = &orig_ip4_mreq;
p_new = &ip4_mreq;
l = sizeof(orig_ip4_mreq);
} else if (addr->family == SOL_NETWORK_FAMILY_INET6) {
level = IPPROTO_IPV6;
option = IPV6_MULTICAST_IF;
p_orig = &orig_ip6_mreq;
p_new = &ip6_mreq;
l = sizeof(orig_ip6_mreq);
} else {
SOL_WRN("Unknown address family: %d", addr->family);
continue;
}
l_orig = l;
if (getsockopt(fd, level, option, p_orig, &l_orig) < 0) {
SOL_DBG("Error while getting socket interface: %s",
sol_util_strerrora(errno));
continue;
}
if (setsockopt(fd, level, option, p_new, l) < 0) {
SOL_DBG("Error while setting socket interface: %s",
sol_util_strerrora(errno));
continue;
}
if (sendmsg(fd, msg, 0) < 0) {
SOL_DBG("Error while sending multicast message: %s",
sol_util_strerrora(errno));
continue;
}
if (setsockopt(fd, level, option, p_orig, l_orig) < 0) {
SOL_DBG("Error while restoring socket interface: %s",
sol_util_strerrora(errno));
continue;
}
success = true;
}
return success;
}
static int
sendmsg_multicast(int fd, struct msghdr *msg)
{
const unsigned int running_multicast = SOL_NETWORK_LINK_RUNNING | SOL_NETWORK_LINK_MULTICAST;
const struct sol_vector *net_links = sol_network_get_available_links();
struct sol_network_link *net_link;
uint16_t idx;
bool had_success = false;
if (!net_links || !net_links->len)
return -ENOTCONN;
SOL_VECTOR_FOREACH_IDX (net_links, net_link, idx) {
if ((net_link->flags & running_multicast) == running_multicast) {
if (sendmsg_multicast_addrs(fd, net_link, msg))
had_success = true;
}
}
return had_success ? 0 : -EIO;
}
static bool
is_multicast(enum sol_network_family family, const struct sockaddr *sockaddr)
{
if (family == SOL_NETWORK_FAMILY_INET6) {
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)sockaddr;
return IN6_IS_ADDR_MULTICAST(&addr6->sin6_addr);
}
if (family == SOL_NETWORK_FAMILY_INET) {
const struct sockaddr_in *addr4 = (const struct sockaddr_in *)sockaddr;
return IN_MULTICAST(htonl(addr4->sin_addr.s_addr));
}
SOL_WRN("Unknown address family (%d)", family);
return false;
}
static int
sol_socket_linux_sendmsg(struct sol_socket *socket, const void *buf, size_t len,
const struct sol_network_link_addr *cliaddr)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
uint8_t sockaddr[sizeof(struct sockaddr_in6)] = { };
struct iovec iov = { .iov_base = (void *)buf,
.iov_len = len };
struct msghdr msg = { .msg_iov = &iov,
.msg_iovlen = 1 };
socklen_t l;
l = sizeof(struct sockaddr_in6);
if (to_sockaddr(cliaddr, (struct sockaddr *)sockaddr, &l) < 0)
return -EINVAL;
msg.msg_name = &sockaddr;
msg.msg_namelen = l;
if (is_multicast(cliaddr->family, (struct sockaddr *)sockaddr))
return sendmsg_multicast(s->fd, &msg);
if (sendmsg(s->fd, &msg, 0) < 0)
return -errno;
return 0;
}
static int
sol_socket_linux_join_group(struct sol_socket *socket, int ifindex, const struct sol_network_link_addr *group)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
struct ip_mreqn ip_join = { };
struct ipv6_mreq ip6_join = { };
const void *p;
int level, option;
socklen_t l;
if (group->family != SOL_NETWORK_FAMILY_INET && group->family != SOL_NETWORK_FAMILY_INET6)
return -EINVAL;
if (group->family == SOL_NETWORK_FAMILY_INET) {
memcpy(&ip_join.imr_multiaddr, group->addr.in, sizeof(group->addr.in));
ip_join.imr_ifindex = ifindex;
p = &ip_join;
l = sizeof(ip_join);
level = IPPROTO_IP;
option = IP_ADD_MEMBERSHIP;
} else {
memcpy(&ip6_join.ipv6mr_multiaddr, group->addr.in6, sizeof(group->addr.in6));
ip6_join.ipv6mr_interface = ifindex;
p = &ip6_join;
l = sizeof(ip6_join);
level = IPPROTO_IPV6;
option = IPV6_JOIN_GROUP;
}
if (setsockopt(s->fd, level, option, p, l) < 0)
return -errno;
return 0;
}
static int
sol_socket_linux_bind(struct sol_socket *socket, const struct sol_network_link_addr *addr)
{
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
uint8_t sockaddr[sizeof(struct sockaddr_in6)] = { };
socklen_t l;
l = sizeof(struct sockaddr_in6);
if (to_sockaddr(addr, (void *)sockaddr, &l) < 0)
return -EINVAL;
if (bind(s->fd, (struct sockaddr *)sockaddr, l) < 0) {
return -errno;
}
return 0;
}
static int
sol_socket_option_to_linux(enum sol_socket_option option)
{
switch (option) {
case SOL_SOCKET_OPTION_REUSEADDR:
return SO_REUSEADDR;
case SOL_SOCKET_OPTION_REUSEPORT:
return SO_REUSEPORT;
default:
SOL_WRN("Invalid option %d", option);
break;
}
return -1;
}
static int
sol_socket_level_to_linux(enum sol_socket_level level)
{
switch (level) {
case SOL_SOCKET_LEVEL_SOCKET:
return SOL_SOCKET;
case SOL_SOCKET_LEVEL_IP:
return IPPROTO_IP;
case SOL_SOCKET_LEVEL_IPV6:
return IPPROTO_IPV6;
default:
SOL_WRN("Invalid level %d", level);
break;
}
return -1;
}
static int
sol_socket_linux_setsockopt(struct sol_socket *socket, enum sol_socket_level level,
enum sol_socket_option optname, const void *optval, size_t optlen)
{
int l, option;
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
l = sol_socket_level_to_linux(level);
option = sol_socket_option_to_linux(optname);
return setsockopt(s->fd, l, option, optval, optlen);
}
static int
sol_socket_linux_getsockopt(struct sol_socket *socket, enum sol_socket_level level,
enum sol_socket_option optname, void *optval, size_t *optlen)
{
int ret, l, option;
socklen_t len = 0;
struct sol_socket_linux *s = (struct sol_socket_linux *)socket;
option = sol_socket_option_to_linux(optname);
l = sol_socket_level_to_linux(level);
ret = getsockopt(s->fd, l, option, optval, &len);
SOL_INT_CHECK(ret, < 0, ret);
*optlen = len;
return 0;
}
const struct sol_socket_impl *
sol_socket_get_impl(void)
{
static const struct sol_socket_impl impl = {
.bind = sol_socket_linux_bind,
.join_group = sol_socket_linux_join_group,
.sendmsg = sol_socket_linux_sendmsg,
.recvmsg = sol_socket_linux_recvmsg,
.set_on_write = sol_socket_linux_set_on_write,
.set_on_read = sol_socket_linux_set_on_read,
.del = sol_socket_linux_del,
.new = sol_socket_linux_new,
.setsockopt = sol_socket_linux_setsockopt,
.getsockopt = sol_socket_linux_getsockopt
};
return &impl;
}
| apache-2.0 |
zofuthan/kaa | client/client-multi/client-c/src/kaa/gen/kaa_configuration_gen.c | 2 | 5984 | /*
* Copyright 2014-2015 CyberVision, Inc.
*
* 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 <inttypes.h>
# include <string.h>
# include "../platform/stdio.h"
# include "kaa_configuration_gen.h"
# include "../avro_src/avro/io.h"
# include "../avro_src/encoding.h"
# include "../utilities/kaa_mem.h"
/*
* AUTO-GENERATED CODE
*/
# ifndef KAA_UNION_NULL_OR_FIXED_C_
# define KAA_UNION_NULL_OR_FIXED_C_
static void kaa_union_null_or_fixed_destroy(void *data)
{
if (data) {
kaa_union_t *kaa_union = (kaa_union_t *)data;
switch (kaa_union->type) {
case KAA_UNION_NULL_OR_FIXED_BRANCH_1:
{
if (kaa_union->data) {
kaa_bytes_destroy(kaa_union->data);
}
break;
}
default:
break;
}
kaa_data_destroy(kaa_union);
}
}
static size_t kaa_union_null_or_fixed_get_size(void *data)
{
if (data) {
kaa_union_t *kaa_union = (kaa_union_t *)data;
size_t union_size = avro_long_get_size(kaa_union->type);
switch (kaa_union->type) {
case KAA_UNION_NULL_OR_FIXED_BRANCH_1:
{
if (kaa_union->data) {
union_size += kaa_bytes_get_size(kaa_union->data);
}
break;
}
default:
break;
}
return union_size;
}
return 0;
}
static void kaa_union_null_or_fixed_serialize(avro_writer_t writer, void *data)
{
if (data) {
kaa_union_t *kaa_union = (kaa_union_t *)data;
avro_binary_encoding.write_long(writer, kaa_union->type);
switch (kaa_union->type) {
case KAA_UNION_NULL_OR_FIXED_BRANCH_1:
{
if (kaa_union->data) {
kaa_bytes_serialize(writer, kaa_union->data);
}
break;
}
default:
break;
}
}
}
static kaa_union_t *kaa_union_null_or_fixed_create()
{
kaa_union_t *kaa_union = KAA_CALLOC(1, sizeof(kaa_union_t));
if (kaa_union) {
kaa_union->serialize = kaa_union_null_or_fixed_serialize;
kaa_union->get_size = kaa_union_null_or_fixed_get_size;
kaa_union->destroy = kaa_union_null_or_fixed_destroy;
}
return kaa_union;
}
kaa_union_t *kaa_union_null_or_fixed_branch_0_create()
{
kaa_union_t *kaa_union = kaa_union_null_or_fixed_create();
if (kaa_union) {
kaa_union->type = KAA_UNION_NULL_OR_FIXED_BRANCH_0;
}
return kaa_union;
}
kaa_union_t *kaa_union_null_or_fixed_branch_1_create()
{
kaa_union_t *kaa_union = kaa_union_null_or_fixed_create();
if (kaa_union) {
kaa_union->type = KAA_UNION_NULL_OR_FIXED_BRANCH_1;
}
return kaa_union;
}
kaa_union_t *kaa_union_null_or_fixed_deserialize(avro_reader_t reader)
{
kaa_union_t *kaa_union = kaa_union_null_or_fixed_create();
if (kaa_union) {
int64_t branch;
avro_binary_encoding.read_long(reader, &branch);
kaa_union->type = branch;
switch (kaa_union->type) {
case KAA_UNION_NULL_OR_FIXED_BRANCH_1:
{
kaa_union->data = kaa_bytes_deserialize(reader);
break;
}
default:
break;
}
}
return kaa_union;
}
# endif // KAA_UNION_NULL_OR_FIXED_C_
static void kaa_configuration_root_record_destroy(void *data)
{
if (data) {
kaa_configuration_root_record_t *record = (kaa_configuration_root_record_t *)data;
kaa_string_destroy(record->data);
if (record->__uuid && record->__uuid->destroy) {
record->__uuid->destroy(record->__uuid);
}
kaa_data_destroy(record);
}
}
static void kaa_configuration_root_record_serialize(avro_writer_t writer, void *data)
{
if (data) {
kaa_configuration_root_record_t *record = (kaa_configuration_root_record_t *)data;
kaa_string_serialize(writer, record->data);
record->__uuid->serialize(writer, record->__uuid);
}
}
static size_t kaa_configuration_root_record_get_size(void *data)
{
if (data) {
size_t record_size = 0;
kaa_configuration_root_record_t *record = (kaa_configuration_root_record_t *)data;
record_size += kaa_string_get_size(record->data);
record_size += record->__uuid->get_size(record->__uuid);
return record_size;
}
return 0;
}
kaa_configuration_root_record_t *kaa_configuration_root_record_create()
{
kaa_configuration_root_record_t *record =
(kaa_configuration_root_record_t *)KAA_CALLOC(1, sizeof(kaa_configuration_root_record_t));
if (record) {
record->serialize = kaa_configuration_root_record_serialize;
record->get_size = kaa_configuration_root_record_get_size;
record->destroy = kaa_configuration_root_record_destroy;
}
return record;
}
kaa_configuration_root_record_t *kaa_configuration_root_record_deserialize(avro_reader_t reader)
{
kaa_configuration_root_record_t *record =
(kaa_configuration_root_record_t *)KAA_MALLOC(sizeof(kaa_configuration_root_record_t));
if (record) {
record->serialize = kaa_configuration_root_record_serialize;
record->get_size = kaa_configuration_root_record_get_size;
record->destroy = kaa_configuration_root_record_destroy;
record->data = kaa_string_deserialize(reader);
record->__uuid = kaa_union_null_or_fixed_deserialize(reader);
}
return record;
}
| apache-2.0 |
igou/rt-thread | components/net/sal_socket/src/sal_ipaddr.c | 3 | 6024 | /*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-05-18 ChenYong First version
*/
#include <sal_ipaddr.h>
#include <rtthread.h>
/* Here for now until needed in other places in lwIP */
#ifndef isprint
#define in_range(c, lo, up) ((u8_t)c >= lo && (u8_t)c <= up)
#define isprint(c) in_range(c, 0x20, 0x7f)
#define isdigit(c) in_range(c, '0', '9')
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
#define islower(c) in_range(c, 'a', 'z')
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#endif
/**
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
* This replaces inet_addr, the return value from which
* cannot distinguish between failure and a local broadcast address.
*
* @param cp IP address in ascii representation (e.g. "127.0.0.1")
* @param addr pointer to which to save the ip address in network order
* @return 1 if cp could be converted to addr, 0 on failure
*/
int sal_ip4addr_aton(const char *cp, ip4_addr_t *addr)
{
u32_t val;
u8_t base;
char c;
u32_t parts[4];
u32_t *pp = parts;
c = *cp;
for (;;)
{
/*
* Collect number up to ``.''.
* Values are specified as for C:
* 0x=hex, 0=octal, 1-9=decimal.
*/
if (!isdigit(c))
{
return 0;
}
val = 0;
base = 10;
if (c == '0')
{
c = *++cp;
if (c == 'x' || c == 'X')
{
base = 16;
c = *++cp;
}
else
{
base = 8;
}
}
for (;;)
{
if (isdigit(c))
{
val = (val * base) + (u32_t) (c - '0');
c = *++cp;
}
else if (base == 16 && isxdigit(c))
{
val = (val << 4) | (u32_t) (c + 10 - (islower(c) ? 'a' : 'A'));
c = *++cp;
}
else
{
break;
}
}
if (c == '.')
{
/*
* Internet format:
* a.b.c.d
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3)
{
return 0;
}
*pp++ = val;
c = *++cp;
}
else
{
break;
}
}
/*
* Check for trailing characters.
*/
if (c != '\0' && !isspace(c))
{
return 0;
}
/*
* Concoct the address according to
* the number of parts specified.
*/
switch (pp - parts + 1)
{
case 0:
return 0; /* initial nondigit */
case 1: /* a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffffUL)
{
return 0;
}
if (parts[0] > 0xff)
{
return 0;
}
val |= parts[0] << 24;
break;
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffff)
{
return 0;
}
if ((parts[0] > 0xff) || (parts[1] > 0xff))
{
return 0;
}
val |= (parts[0] << 24) | (parts[1] << 16);
break;
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xff)
{
return 0;
}
if ((parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff))
{
return 0;
}
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
break;
default:
RT_ASSERT(0);
break;
}
if (addr)
{
ip4_addr_set_u32(addr, htonl(val));
}
return 1;
}
/**
* Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used.
*
* @param addr ip address in network order to convert
* @param buf target buffer where the string is stored
* @param buflen length of buf
* @return either pointer to buf which now holds the ASCII
* representation of addr or NULL if buf was too small
*/
char *sal_ip4addr_ntoa_r(const ip4_addr_t *addr, char *buf, int buflen)
{
u32_t s_addr;
char inv[3];
char *rp;
u8_t *ap;
u8_t rem;
u8_t n;
u8_t i;
int len = 0;
s_addr = ip4_addr_get_u32(addr);
rp = buf;
ap = (u8_t *) &s_addr;
for (n = 0; n < 4; n++)
{
i = 0;
do
{
rem = *ap % (u8_t) 10;
*ap /= (u8_t) 10;
inv[i++] = (char) ('0' + rem);
} while (*ap);
while (i--)
{
if (len++ >= buflen)
{
return NULL;
}
*rp++ = inv[i];
}
if (len++ >= buflen)
{
return NULL;
}
*rp++ = '.';
ap++;
}
*--rp = 0;
return buf;
}
/**
* Convert numeric IP address into decimal dotted ASCII representation.
* returns ptr to static buffer; not reentrant!
*
* @param addr ip address in network order to convert
* @return pointer to a global static (!) buffer that holds the ASCII
* representation of addr
*/
char *sal_ip4addr_ntoa(const ip4_addr_t *addr)
{
static char str[IP4ADDR_STRLEN_MAX];
return sal_ip4addr_ntoa_r(addr, str, IP4ADDR_STRLEN_MAX);
}
/**
* Ascii internet address interpretation routine.
* The value returned is in network order.
*
* @param cp IP address in ascii representation (e.g. "127.0.0.1")
* @return ip address in network order
*/
in_addr_t sal_ipaddr_addr(const char *cp)
{
ip4_addr_t val;
if (sal_ip4addr_aton(cp, &val)) {
return ip4_addr_get_u32(&val);
}
return (IPADDR_NONE);
}
| apache-2.0 |
weolar/miniblink49 | third_party/WebKit/Source/web/WebDocumentType.cpp | 4 | 2459 | /*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "public/web/WebDocumentType.h"
#include "core/dom/DocumentType.h"
#include "public/platform/WebString.h"
#include "wtf/PassRefPtr.h"
namespace blink {
WebString WebDocumentType::name() const
{
return WebString(constUnwrap<DocumentType>()->name());
}
WebString WebDocumentType::publicId() const
{
return WebString(constUnwrap<DocumentType>()->publicId());
}
WebString WebDocumentType::systemId() const
{
return WebString(constUnwrap<DocumentType>()->systemId());
}
WebDocumentType::WebDocumentType(const PassRefPtrWillBeRawPtr<DocumentType>& elem)
: WebNode(elem)
{
}
WebDocumentType& WebDocumentType::operator=(const PassRefPtrWillBeRawPtr<DocumentType>& elem)
{
m_private = elem;
return *this;
}
WebDocumentType::operator PassRefPtrWillBeRawPtr<DocumentType>() const
{
return toDocumentType(m_private.get());
}
} // namespace blink
| apache-2.0 |
JeonginKim/TizenRT | external/libcxx-test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/deref.pass.cpp | 4 | 1787 | /****************************************************************************
*
* Copyright 2018 Samsung Electronics 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.
*
****************************************************************************/
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <iterator>
// class ostreambuf_iterator
// ostreambuf_iterator<charT,traits>& operator*();
#include <iterator>
#include <sstream>
#include <cassert>
#include "libcxx_tc_common.h"
int tc_libcxx_iterators_ostreambuf_iter_ops_deref(void)
{
{
std::ostringstream outf;
std::ostreambuf_iterator<char> i(outf);
std::ostreambuf_iterator<char>& iref = *i;
TC_ASSERT_EXPR(&iref == &i);
}
{
std::wostringstream outf;
std::ostreambuf_iterator<wchar_t> i(outf);
std::ostreambuf_iterator<wchar_t>& iref = *i;
TC_ASSERT_EXPR(&iref == &i);
}
TC_SUCCESS_RESULT();
return 0;
}
| apache-2.0 |
cedral/aws-sdk-cpp | aws-cpp-sdk-storagegateway/source/model/UpdateSMBSecurityStrategyRequest.cpp | 4 | 1271 | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/storagegateway/model/UpdateSMBSecurityStrategyRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::StorageGateway::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
UpdateSMBSecurityStrategyRequest::UpdateSMBSecurityStrategyRequest() :
m_gatewayARNHasBeenSet(false),
m_sMBSecurityStrategy(SMBSecurityStrategy::NOT_SET),
m_sMBSecurityStrategyHasBeenSet(false)
{
}
Aws::String UpdateSMBSecurityStrategyRequest::SerializePayload() const
{
JsonValue payload;
if(m_gatewayARNHasBeenSet)
{
payload.WithString("GatewayARN", m_gatewayARN);
}
if(m_sMBSecurityStrategyHasBeenSet)
{
payload.WithString("SMBSecurityStrategy", SMBSecurityStrategyMapper::GetNameForSMBSecurityStrategy(m_sMBSecurityStrategy));
}
return payload.View().WriteReadable();
}
Aws::Http::HeaderValueCollection UpdateSMBSecurityStrategyRequest::GetRequestSpecificHeaders() const
{
Aws::Http::HeaderValueCollection headers;
headers.insert(Aws::Http::HeaderValuePair("X-Amz-Target", "StorageGateway_20130630.UpdateSMBSecurityStrategy"));
return headers;
}
| apache-2.0 |
mbains/nucleo-f746zg | Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_hash.c | 6 | 60995 | /**
******************************************************************************
* @file stm32f7xx_hal_hash.c
* @author MCD Application Team
* @version V1.0.4
* @date 09-December-2015
* @brief HASH HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the HASH peripheral:
* + Initialization and de-initialization functions
* + HASH/HMAC Processing functions by algorithm using polling mode
* + HASH/HMAC functions by algorithm using interrupt mode
* + HASH/HMAC functions by algorithm using DMA mode
* + Peripheral State functions
*
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
The HASH HAL driver can be used as follows:
(#)Initialize the HASH low level resources by implementing the HAL_HASH_MspInit():
(##) Enable the HASH interface clock using __HAL_RCC_HASH_CLK_ENABLE()
(##) In case of using processing APIs based on interrupts (e.g. HAL_HMAC_SHA1_Start_IT())
(+++) Configure the HASH interrupt priority using HAL_NVIC_SetPriority()
(+++) Enable the HASH IRQ handler using HAL_NVIC_EnableIRQ()
(+++) In HASH IRQ handler, call HAL_HASH_IRQHandler()
(##) In case of using DMA to control data transfer (e.g. HAL_HMAC_SHA1_Start_DMA())
(+++) Enable the DMAx interface clock using __DMAx_CLK_ENABLE()
(+++) Configure and enable one DMA stream one for managing data transfer from
memory to peripheral (input stream). Managing data transfer from
peripheral to memory can be performed only using CPU
(+++) Associate the initialized DMA handle to the HASH DMA handle
using __HAL_LINKDMA()
(+++) Configure the priority and enable the NVIC for the transfer complete
interrupt on the DMA Stream using HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ()
(#)Initialize the HASH HAL using HAL_HASH_Init(). This function configures mainly:
(##) The data type: 1-bit, 8-bit, 16-bit and 32-bit.
(##) For HMAC, the encryption key.
(##) For HMAC, the key size used for encryption.
(#)Three processing functions are available:
(##) Polling mode: processing APIs are blocking functions
i.e. they process the data and wait till the digest computation is finished
e.g. HAL_HASH_SHA1_Start()
(##) Interrupt mode: encryption and decryption APIs are not blocking functions
i.e. they process the data under interrupt
e.g. HAL_HASH_SHA1_Start_IT()
(##) DMA mode: processing APIs are not blocking functions and the CPU is
not used for data transfer i.e. the data transfer is ensured by DMA
e.g. HAL_HASH_SHA1_Start_DMA()
(#)When the processing function is called at first time after HAL_HASH_Init()
the HASH peripheral is initialized and processes the buffer in input.
After that, the digest computation is started.
When processing multi-buffer use the accumulate function to write the
data in the peripheral without starting the digest computation. In last
buffer use the start function to input the last buffer ans start the digest
computation.
(##) e.g. HAL_HASH_SHA1_Accumulate() : write 1st data buffer in the peripheral without starting the digest computation
(##) write (n-1)th data buffer in the peripheral without starting the digest computation
(##) HAL_HASH_SHA1_Start() : write (n)th data buffer in the peripheral and start the digest computation
(#)In HMAC mode, there is no Accumulate API. Only Start API is available.
(#)In case of using DMA, call the DMA start processing e.g. HAL_HASH_SHA1_Start_DMA().
After that, call the finish function in order to get the digest value
e.g. HAL_HASH_SHA1_Finish()
(#)Call HAL_HASH_DeInit() to deinitialize the HASH peripheral.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f7xx_hal.h"
/** @addtogroup STM32F7xx_HAL_Driver
* @{
*/
#if defined(STM32F756xx)
/** @defgroup HASH HASH
* @brief HASH HAL module driver.
* @{
*/
#ifdef HAL_HASH_MODULE_ENABLED
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup HASH_Private_Functions HASH Private Functions
* @{
*/
static void HASH_DMAXferCplt(DMA_HandleTypeDef *hdma);
static void HASH_DMAError(DMA_HandleTypeDef *hdma);
static void HASH_GetDigest(uint8_t *pMsgDigest, uint8_t Size);
static void HASH_WriteData(uint8_t *pInBuffer, uint32_t Size);
/**
* @}
*/
/* Private functions ---------------------------------------------------------*/
/** @addtogroup HASH_Private_Functions
* @{
*/
/**
* @brief DMA HASH Input Data complete callback.
* @param hdma: DMA handle
* @retval None
*/
static void HASH_DMAXferCplt(DMA_HandleTypeDef *hdma)
{
HASH_HandleTypeDef* hhash = ( HASH_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
uint32_t inputaddr = 0;
uint32_t buffersize = 0;
if((HASH->CR & HASH_CR_MODE) != HASH_CR_MODE)
{
/* Disable the DMA transfer */
HASH->CR &= (uint32_t)(~HASH_CR_DMAE);
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_READY;
/* Call Input data transfer complete callback */
HAL_HASH_InCpltCallback(hhash);
}
else
{
/* Increment Interrupt counter */
hhash->HashInCount++;
/* Disable the DMA transfer before starting the next transfer */
HASH->CR &= (uint32_t)(~HASH_CR_DMAE);
if(hhash->HashInCount <= 2)
{
/* In case HashInCount = 1, set the DMA to transfer data to HASH DIN register */
if(hhash->HashInCount == 1)
{
inputaddr = (uint32_t)hhash->pHashInBuffPtr;
buffersize = hhash->HashBuffSize;
}
/* In case HashInCount = 2, set the DMA to transfer key to HASH DIN register */
else if(hhash->HashInCount == 2)
{
inputaddr = (uint32_t)hhash->Init.pKey;
buffersize = hhash->Init.KeySize;
}
/* Configure the number of valid bits in last word of the message */
MODIFY_REG(HASH->STR, HASH_STR_NBLW, 8 * (buffersize % 4));
/* Set the HASH DMA transfer complete */
hhash->hdmain->XferCpltCallback = HASH_DMAXferCplt;
/* Enable the DMA In DMA Stream */
HAL_DMA_Start_IT(hhash->hdmain, inputaddr, (uint32_t)&HASH->DIN, (buffersize%4 ? (buffersize+3)/4:buffersize/4));
/* Enable DMA requests */
HASH->CR |= (HASH_CR_DMAE);
}
else
{
/* Disable the DMA transfer */
HASH->CR &= (uint32_t)(~HASH_CR_DMAE);
/* Reset the InCount */
hhash->HashInCount = 0;
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_READY;
/* Call Input data transfer complete callback */
HAL_HASH_InCpltCallback(hhash);
}
}
}
/**
* @brief DMA HASH communication error callback.
* @param hdma: DMA handle
* @retval None
*/
static void HASH_DMAError(DMA_HandleTypeDef *hdma)
{
HASH_HandleTypeDef* hhash = ( HASH_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
hhash->State= HAL_HASH_STATE_READY;
HAL_HASH_ErrorCallback(hhash);
}
/**
* @brief Writes the input buffer in data register.
* @param pInBuffer: Pointer to input buffer
* @param Size: The size of input buffer
* @retval None
*/
static void HASH_WriteData(uint8_t *pInBuffer, uint32_t Size)
{
uint32_t buffercounter;
uint32_t inputaddr = (uint32_t) pInBuffer;
for(buffercounter = 0; buffercounter < Size; buffercounter+=4)
{
HASH->DIN = *(uint32_t*)inputaddr;
inputaddr+=4;
}
}
/**
* @brief Provides the message digest result.
* @param pMsgDigest: Pointer to the message digest
* @param Size: The size of the message digest in bytes
* @retval None
*/
static void HASH_GetDigest(uint8_t *pMsgDigest, uint8_t Size)
{
uint32_t msgdigest = (uint32_t)pMsgDigest;
switch(Size)
{
case 16:
/* Read the message digest */
*(uint32_t*)(msgdigest) = __REV(HASH->HR[0]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[1]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[2]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[3]);
break;
case 20:
/* Read the message digest */
*(uint32_t*)(msgdigest) = __REV(HASH->HR[0]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[1]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[2]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[3]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[4]);
break;
case 28:
/* Read the message digest */
*(uint32_t*)(msgdigest) = __REV(HASH->HR[0]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[1]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[2]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[3]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[4]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH_DIGEST->HR[5]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH_DIGEST->HR[6]);
break;
case 32:
/* Read the message digest */
*(uint32_t*)(msgdigest) = __REV(HASH->HR[0]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[1]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[2]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[3]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH->HR[4]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH_DIGEST->HR[5]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH_DIGEST->HR[6]);
msgdigest+=4;
*(uint32_t*)(msgdigest) = __REV(HASH_DIGEST->HR[7]);
break;
default:
break;
}
}
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @addtogroup HASH_Exported_Functions
* @{
*/
/** @addtogroup HASH_Exported_Functions_Group1 Initialization and de-initialization functions
* @brief Initialization and Configuration functions.
*
@verbatim
===============================================================================
##### Initialization and de-initialization functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Initialize the HASH according to the specified parameters
in the HASH_InitTypeDef and creates the associated handle.
(+) DeInitialize the HASH peripheral.
(+) Initialize the HASH MSP.
(+) DeInitialize HASH MSP.
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH according to the specified parameters in the
HASH_HandleTypeDef and creates the associated handle.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_Init(HASH_HandleTypeDef *hhash)
{
/* Check the hash handle allocation */
if(hhash == NULL)
{
return HAL_ERROR;
}
/* Check the parameters */
assert_param(IS_HASH_DATATYPE(hhash->Init.DataType));
if(hhash->State == HAL_HASH_STATE_RESET)
{
/* Allocate lock resource and initialize it */
hhash->Lock = HAL_UNLOCKED;
/* Init the low level hardware */
HAL_HASH_MspInit(hhash);
}
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Reset HashInCount, HashBuffSize and HashITCounter */
hhash->HashInCount = 0;
hhash->HashBuffSize = 0;
hhash->HashITCounter = 0;
/* Set the data type */
HASH->CR |= (uint32_t) (hhash->Init.DataType);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Set the default HASH phase */
hhash->Phase = HAL_HASH_PHASE_READY;
/* Return function status */
return HAL_OK;
}
/**
* @brief DeInitializes the HASH peripheral.
* @note This API must be called before starting a new processing.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_DeInit(HASH_HandleTypeDef *hhash)
{
/* Check the HASH handle allocation */
if(hhash == NULL)
{
return HAL_ERROR;
}
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Set the default HASH phase */
hhash->Phase = HAL_HASH_PHASE_READY;
/* Reset HashInCount, HashBuffSize and HashITCounter */
hhash->HashInCount = 0;
hhash->HashBuffSize = 0;
hhash->HashITCounter = 0;
/* DeInit the low level hardware */
HAL_HASH_MspDeInit(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_RESET;
/* Release Lock */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH MSP.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
__weak void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hhash);
/* NOTE: This function Should not be modified, when the callback is needed,
the HAL_HASH_MspInit could be implemented in the user file
*/
}
/**
* @brief DeInitializes HASH MSP.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
__weak void HAL_HASH_MspDeInit(HASH_HandleTypeDef *hhash)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hhash);
/* NOTE: This function Should not be modified, when the callback is needed,
the HAL_HASH_MspDeInit could be implemented in the user file
*/
}
/**
* @brief Input data transfer complete callback.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
__weak void HAL_HASH_InCpltCallback(HASH_HandleTypeDef *hhash)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hhash);
/* NOTE: This function Should not be modified, when the callback is needed,
the HAL_HASH_InCpltCallback could be implemented in the user file
*/
}
/**
* @brief Data transfer Error callback.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
__weak void HAL_HASH_ErrorCallback(HASH_HandleTypeDef *hhash)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hhash);
/* NOTE: This function Should not be modified, when the callback is needed,
the HAL_HASH_ErrorCallback could be implemented in the user file
*/
}
/**
* @brief Digest computation complete callback. It is used only with interrupt.
* @note This callback is not relevant with DMA.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
__weak void HAL_HASH_DgstCpltCallback(HASH_HandleTypeDef *hhash)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hhash);
/* NOTE: This function Should not be modified, when the callback is needed,
the HAL_HASH_DgstCpltCallback could be implemented in the user file
*/
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group2 HASH processing functions using polling mode
* @brief processing functions using polling mode
*
@verbatim
===============================================================================
##### HASH processing using polling mode functions#####
===============================================================================
[..] This section provides functions allowing to calculate in polling mode
the hash value using one of the following algorithms:
(+) MD5
(+) SHA1
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH peripheral in MD5 mode then processes pInBuffer.
The digest is available in pOutBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is multiple of 64 bytes, appending the input buffer is possible.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware
* and appending the input buffer is no more possible.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 16 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the MD5 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_MD5 | HASH_CR_INIT;
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 16);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in MD5 mode then writes the pInBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is multiple of 64 bytes, appending the input buffer is possible.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware
* and appending the input buffer is no more possible.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_MD5_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the MD5 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_MD5 | HASH_CR_INIT;
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in SHA1 mode then processes pInBuffer.
The digest is available in pOutBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 20 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the SHA1 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_SHA1 | HASH_CR_INIT;
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 20);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in SHA1 mode then processes pInBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @note Input buffer size in bytes must be a multiple of 4 otherwise the digest computation is corrupted.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_SHA1_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
/* Check the parameters */
assert_param(IS_HASH_SHA1_BUFFER_SIZE(Size));
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the SHA1 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_SHA1 | HASH_CR_INIT;
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group3 HASH processing functions using interrupt mode
* @brief processing functions using interrupt mode.
*
@verbatim
===============================================================================
##### HASH processing using interrupt mode functions #####
===============================================================================
[..] This section provides functions allowing to calculate in interrupt mode
the hash value using one of the following algorithms:
(+) MD5
(+) SHA1
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH peripheral in MD5 mode then processes pInBuffer.
* The digest is available in pOutBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 16 bytes.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_MD5_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
{
uint32_t inputaddr;
uint32_t outputaddr;
uint32_t buffercounter;
uint32_t inputcounter;
/* Process Locked */
__HAL_LOCK(hhash);
if(hhash->State == HAL_HASH_STATE_READY)
{
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
hhash->HashInCount = Size;
hhash->pHashInBuffPtr = pInBuffer;
hhash->pHashOutBuffPtr = pOutBuffer;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the SHA1 mode */
HASH->CR |= HASH_ALGOSELECTION_MD5;
/* Reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_CR_INIT;
}
/* Reset interrupt counter */
hhash->HashITCounter = 0;
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Enable Interrupts */
HASH->IMR = (HASH_IT_DINI | HASH_IT_DCI);
/* Return function status */
return HAL_OK;
}
if(__HAL_HASH_GET_FLAG(HASH_FLAG_DCIS))
{
outputaddr = (uint32_t)hhash->pHashOutBuffPtr;
/* Read the Output block from the Output FIFO */
*(uint32_t*)(outputaddr) = __REV(HASH->HR[0]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[1]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[2]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[3]);
if(hhash->HashInCount == 0)
{
/* Disable Interrupts */
HASH->IMR = 0;
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Call digest computation complete callback */
HAL_HASH_DgstCpltCallback(hhash);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
}
if(__HAL_HASH_GET_FLAG(HASH_FLAG_DINIS))
{
if(hhash->HashInCount >= 68)
{
inputaddr = (uint32_t)hhash->pHashInBuffPtr;
/* Write the Input block in the Data IN register */
for(buffercounter = 0; buffercounter < 64; buffercounter+=4)
{
HASH->DIN = *(uint32_t*)inputaddr;
inputaddr+=4;
}
if(hhash->HashITCounter == 0)
{
HASH->DIN = *(uint32_t*)inputaddr;
if(hhash->HashInCount >= 68)
{
/* Decrement buffer counter */
hhash->HashInCount -= 68;
hhash->pHashInBuffPtr+= 68;
}
else
{
hhash->HashInCount = 0;
hhash->pHashInBuffPtr+= hhash->HashInCount;
}
/* Set Interrupt counter */
hhash->HashITCounter = 1;
}
else
{
/* Decrement buffer counter */
hhash->HashInCount -= 64;
hhash->pHashInBuffPtr+= 64;
}
}
else
{
/* Get the buffer address */
inputaddr = (uint32_t)hhash->pHashInBuffPtr;
/* Get the buffer counter */
inputcounter = hhash->HashInCount;
/* Disable Interrupts */
HASH->IMR &= ~(HASH_IT_DINI);
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(inputcounter);
if((inputcounter > 4) && (inputcounter%4))
{
inputcounter = (inputcounter+4-inputcounter%4);
}
else if ((inputcounter < 4) && (inputcounter != 0))
{
inputcounter = 4;
}
/* Write the Input block in the Data IN register */
for(buffercounter = 0; buffercounter < inputcounter/4; buffercounter++)
{
HASH->DIN = *(uint32_t*)inputaddr;
inputaddr+=4;
}
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Reset buffer counter */
hhash->HashInCount = 0;
/* Call Input data transfer complete callback */
HAL_HASH_InCpltCallback(hhash);
}
}
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in SHA1 mode then processes pInBuffer.
* The digest is available in pOutBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 20 bytes.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_SHA1_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer)
{
uint32_t inputaddr;
uint32_t outputaddr;
uint32_t buffercounter;
uint32_t inputcounter;
/* Process Locked */
__HAL_LOCK(hhash);
if(hhash->State == HAL_HASH_STATE_READY)
{
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
hhash->HashInCount = Size;
hhash->pHashInBuffPtr = pInBuffer;
hhash->pHashOutBuffPtr = pOutBuffer;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the SHA1 mode */
HASH->CR |= HASH_ALGOSELECTION_SHA1;
/* Reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_CR_INIT;
}
/* Reset interrupt counter */
hhash->HashITCounter = 0;
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Enable Interrupts */
HASH->IMR = (HASH_IT_DINI | HASH_IT_DCI);
/* Return function status */
return HAL_OK;
}
if(__HAL_HASH_GET_FLAG(HASH_FLAG_DCIS))
{
outputaddr = (uint32_t)hhash->pHashOutBuffPtr;
/* Read the Output block from the Output FIFO */
*(uint32_t*)(outputaddr) = __REV(HASH->HR[0]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[1]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[2]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[3]);
outputaddr+=4;
*(uint32_t*)(outputaddr) = __REV(HASH->HR[4]);
if(hhash->HashInCount == 0)
{
/* Disable Interrupts */
HASH->IMR = 0;
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Call digest computation complete callback */
HAL_HASH_DgstCpltCallback(hhash);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
}
if(__HAL_HASH_GET_FLAG(HASH_FLAG_DINIS))
{
if(hhash->HashInCount >= 68)
{
inputaddr = (uint32_t)hhash->pHashInBuffPtr;
/* Write the Input block in the Data IN register */
for(buffercounter = 0; buffercounter < 64; buffercounter+=4)
{
HASH->DIN = *(uint32_t*)inputaddr;
inputaddr+=4;
}
if(hhash->HashITCounter == 0)
{
HASH->DIN = *(uint32_t*)inputaddr;
if(hhash->HashInCount >= 68)
{
/* Decrement buffer counter */
hhash->HashInCount -= 68;
hhash->pHashInBuffPtr+= 68;
}
else
{
hhash->HashInCount = 0;
hhash->pHashInBuffPtr+= hhash->HashInCount;
}
/* Set Interrupt counter */
hhash->HashITCounter = 1;
}
else
{
/* Decrement buffer counter */
hhash->HashInCount -= 64;
hhash->pHashInBuffPtr+= 64;
}
}
else
{
/* Get the buffer address */
inputaddr = (uint32_t)hhash->pHashInBuffPtr;
/* Get the buffer counter */
inputcounter = hhash->HashInCount;
/* Disable Interrupts */
HASH->IMR &= ~(HASH_IT_DINI);
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(inputcounter);
if((inputcounter > 4) && (inputcounter%4))
{
inputcounter = (inputcounter+4-inputcounter%4);
}
else if ((inputcounter < 4) && (inputcounter != 0))
{
inputcounter = 4;
}
/* Write the Input block in the Data IN register */
for(buffercounter = 0; buffercounter < inputcounter/4; buffercounter++)
{
HASH->DIN = *(uint32_t*)inputaddr;
inputaddr+=4;
}
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Reset buffer counter */
hhash->HashInCount = 0;
/* Call Input data transfer complete callback */
HAL_HASH_InCpltCallback(hhash);
}
}
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief This function handles HASH interrupt request.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval None
*/
void HAL_HASH_IRQHandler(HASH_HandleTypeDef *hhash)
{
switch(HASH->CR & HASH_CR_ALGO)
{
case HASH_ALGOSELECTION_MD5:
HAL_HASH_MD5_Start_IT(hhash, NULL, 0, NULL);
break;
case HASH_ALGOSELECTION_SHA1:
HAL_HASH_SHA1_Start_IT(hhash, NULL, 0, NULL);
break;
default:
break;
}
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group4 HASH processing functions using DMA mode
* @brief processing functions using DMA mode.
*
@verbatim
===============================================================================
##### HASH processing using DMA mode functions #####
===============================================================================
[..] This section provides functions allowing to calculate in DMA mode
the hash value using one of the following algorithms:
(+) MD5
(+) SHA1
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH peripheral in MD5 mode then enables DMA to
control data transfer. Use HAL_HASH_MD5_Finish() to get the digest.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
uint32_t inputaddr = (uint32_t)pInBuffer;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the MD5 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_MD5 | HASH_CR_INIT;
}
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Set the HASH DMA transfer complete callback */
hhash->hdmain->XferCpltCallback = HASH_DMAXferCplt;
/* Set the DMA error callback */
hhash->hdmain->XferErrorCallback = HASH_DMAError;
/* Enable the DMA In DMA Stream */
HAL_DMA_Start_IT(hhash->hdmain, inputaddr, (uint32_t)&HASH->DIN, (Size%4 ? (Size+3)/4:Size/4));
/* Enable DMA requests */
HASH->CR |= (HASH_CR_DMAE);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Returns the computed digest in MD5 mode
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pOutBuffer: Pointer to the computed digest. Its size must be 16 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_MD5_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_CLR(HASH->SR, HASH_FLAG_DCIS))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 16);
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in SHA1 mode then enables DMA to
control data transfer. Use HAL_HASH_SHA1_Finish() to get the digest.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
uint32_t inputaddr = (uint32_t)pInBuffer;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Select the SHA1 mode and reset the HASH processor core, so that the HASH will be ready to compute
the message digest of a new message */
HASH->CR |= HASH_ALGOSELECTION_SHA1;
HASH->CR |= HASH_CR_INIT;
}
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Set the HASH DMA transfer complete callback */
hhash->hdmain->XferCpltCallback = HASH_DMAXferCplt;
/* Set the DMA error callback */
hhash->hdmain->XferErrorCallback = HASH_DMAError;
/* Enable the DMA In DMA Stream */
HAL_DMA_Start_IT(hhash->hdmain, inputaddr, (uint32_t)&HASH->DIN, (Size%4 ? (Size+3)/4:Size/4));
/* Enable DMA requests */
HASH->CR |= (HASH_CR_DMAE);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Returns the computed digest in SHA1 mode.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pOutBuffer: Pointer to the computed digest. Its size must be 20 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HASH_SHA1_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_CLR(HASH->SR, HASH_FLAG_DCIS))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 20);
/* Change HASH peripheral state */
hhash->State = HAL_HASH_STATE_READY;
/* Process UnLock */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group5 HASH-MAC (HMAC) processing functions using polling mode
* @brief HMAC processing functions using polling mode .
*
@verbatim
===============================================================================
##### HMAC processing using polling mode functions #####
===============================================================================
[..] This section provides functions allowing to calculate in polling mode
the HMAC value using one of the following algorithms:
(+) MD5
(+) SHA1
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH peripheral in HMAC MD5 mode
* then processes pInBuffer. The digest is available in pOutBuffer
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 20 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HMAC_MD5_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Check if key size is greater than 64 bytes */
if(hhash->Init.KeySize > 64)
{
/* Select the HMAC MD5 mode */
HASH->CR |= (HASH_ALGOSELECTION_MD5 | HASH_ALGOMODE_HMAC | HASH_HMAC_KEYTYPE_LONGKEY | HASH_CR_INIT);
}
else
{
/* Select the HMAC MD5 mode */
HASH->CR |= (HASH_ALGOSELECTION_MD5 | HASH_ALGOMODE_HMAC | HASH_CR_INIT);
}
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/************************** STEP 1 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Write input buffer in data register */
HASH_WriteData(hhash->Init.pKey, hhash->Init.KeySize);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/************************** STEP 2 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((HAL_GetTick() - tickstart ) > Timeout)
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/************************** STEP 3 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Write input buffer in data register */
HASH_WriteData(hhash->Init.pKey, hhash->Init.KeySize);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((HAL_GetTick() - tickstart ) > Timeout)
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 16);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in HMAC SHA1 mode
* then processes pInBuffer. The digest is available in pOutBuffer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @param pOutBuffer: Pointer to the computed digest. Its size must be 20 bytes.
* @param Timeout: Timeout value
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HMAC_SHA1_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Check if key size is greater than 64 bytes */
if(hhash->Init.KeySize > 64)
{
/* Select the HMAC SHA1 mode */
HASH->CR |= (HASH_ALGOSELECTION_SHA1 | HASH_ALGOMODE_HMAC | HASH_HMAC_KEYTYPE_LONGKEY | HASH_CR_INIT);
}
else
{
/* Select the HMAC SHA1 mode */
HASH->CR |= (HASH_ALGOSELECTION_SHA1 | HASH_ALGOMODE_HMAC | HASH_CR_INIT);
}
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/************************** STEP 1 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Write input buffer in data register */
HASH_WriteData(hhash->Init.pKey, hhash->Init.KeySize);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/************************** STEP 2 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(Size);
/* Write input buffer in data register */
HASH_WriteData(pInBuffer, Size);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((HAL_GetTick() - tickstart ) > Timeout)
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/************************** STEP 3 ******************************************/
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Write input buffer in data register */
HASH_WriteData(hhash->Init.pKey, hhash->Init.KeySize);
/* Start the digest calculation */
__HAL_HASH_START_DIGEST();
/* Get tick */
tickstart = HAL_GetTick();
while(HAL_IS_BIT_SET(HASH->SR, HASH_FLAG_BUSY))
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((HAL_GetTick() - tickstart ) > Timeout)
{
/* Change state */
hhash->State = HAL_HASH_STATE_TIMEOUT;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
return HAL_TIMEOUT;
}
}
}
/* Read the message digest */
HASH_GetDigest(pOutBuffer, 20);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_READY;
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group6 HASH-MAC (HMAC) processing functions using DMA mode
* @brief HMAC processing functions using DMA mode .
*
@verbatim
===============================================================================
##### HMAC processing using DMA mode functions #####
===============================================================================
[..] This section provides functions allowing to calculate in DMA mode
the HMAC value using one of the following algorithms:
(+) MD5
(+) SHA1
@endverbatim
* @{
*/
/**
* @brief Initializes the HASH peripheral in HMAC MD5 mode
* then enables DMA to control data transfer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HMAC_MD5_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
uint32_t inputaddr = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Save buffer pointer and size in handle */
hhash->pHashInBuffPtr = pInBuffer;
hhash->HashBuffSize = Size;
hhash->HashInCount = 0;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Check if key size is greater than 64 bytes */
if(hhash->Init.KeySize > 64)
{
/* Select the HMAC MD5 mode */
HASH->CR |= (HASH_ALGOSELECTION_MD5 | HASH_ALGOMODE_HMAC | HASH_HMAC_KEYTYPE_LONGKEY | HASH_CR_INIT);
}
else
{
/* Select the HMAC MD5 mode */
HASH->CR |= (HASH_ALGOSELECTION_MD5 | HASH_ALGOMODE_HMAC | HASH_CR_INIT);
}
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Get the key address */
inputaddr = (uint32_t)(hhash->Init.pKey);
/* Set the HASH DMA transfer complete callback */
hhash->hdmain->XferCpltCallback = HASH_DMAXferCplt;
/* Set the DMA error callback */
hhash->hdmain->XferErrorCallback = HASH_DMAError;
/* Enable the DMA In DMA Stream */
HAL_DMA_Start_IT(hhash->hdmain, inputaddr, (uint32_t)&HASH->DIN, (hhash->Init.KeySize%4 ? (hhash->Init.KeySize+3)/4:hhash->Init.KeySize/4));
/* Enable DMA requests */
HASH->CR |= (HASH_CR_DMAE);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @brief Initializes the HASH peripheral in HMAC SHA1 mode
* then enables DMA to control data transfer.
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @param pInBuffer: Pointer to the input buffer (buffer to be hashed).
* @param Size: Length of the input buffer in bytes.
* If the Size is not multiple of 64 bytes, the padding is managed by hardware.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_HMAC_SHA1_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size)
{
uint32_t inputaddr = 0;
/* Process Locked */
__HAL_LOCK(hhash);
/* Change the HASH state */
hhash->State = HAL_HASH_STATE_BUSY;
/* Save buffer pointer and size in handle */
hhash->pHashInBuffPtr = pInBuffer;
hhash->HashBuffSize = Size;
hhash->HashInCount = 0;
/* Check if initialization phase has already been performed */
if(hhash->Phase == HAL_HASH_PHASE_READY)
{
/* Check if key size is greater than 64 bytes */
if(hhash->Init.KeySize > 64)
{
/* Select the HMAC SHA1 mode */
HASH->CR |= (HASH_ALGOSELECTION_SHA1 | HASH_ALGOMODE_HMAC | HASH_HMAC_KEYTYPE_LONGKEY | HASH_CR_INIT);
}
else
{
/* Select the HMAC SHA1 mode */
HASH->CR |= (HASH_ALGOSELECTION_SHA1 | HASH_ALGOMODE_HMAC | HASH_CR_INIT);
}
}
/* Set the phase */
hhash->Phase = HAL_HASH_PHASE_PROCESS;
/* Configure the number of valid bits in last word of the message */
__HAL_HASH_SET_NBVALIDBITS(hhash->Init.KeySize);
/* Get the key address */
inputaddr = (uint32_t)(hhash->Init.pKey);
/* Set the HASH DMA transfer complete callback */
hhash->hdmain->XferCpltCallback = HASH_DMAXferCplt;
/* Set the DMA error callback */
hhash->hdmain->XferErrorCallback = HASH_DMAError;
/* Enable the DMA In DMA Stream */
HAL_DMA_Start_IT(hhash->hdmain, inputaddr, (uint32_t)&HASH->DIN, (hhash->Init.KeySize%4 ? (hhash->Init.KeySize+3)/4:hhash->Init.KeySize/4));
/* Enable DMA requests */
HASH->CR |= (HASH_CR_DMAE);
/* Process Unlocked */
__HAL_UNLOCK(hhash);
/* Return function status */
return HAL_OK;
}
/**
* @}
*/
/** @defgroup HASH_Exported_Functions_Group7 Peripheral State functions
* @brief Peripheral State functions.
*
@verbatim
===============================================================================
##### Peripheral State functions #####
===============================================================================
[..]
This subsection permits to get in run-time the status of the peripheral.
@endverbatim
* @{
*/
/**
* @brief return the HASH state
* @param hhash: pointer to a HASH_HandleTypeDef structure that contains
* the configuration information for HASH module
* @retval HAL state
*/
HAL_HASH_StateTypeDef HAL_HASH_GetState(HASH_HandleTypeDef *hhash)
{
return hhash->State;
}
/**
* @}
*/
/**
* @}
*/
#endif /* HAL_HASH_MODULE_ENABLED */
/**
* @}
*/
#endif /* STM32F756xx */
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| apache-2.0 |
OLIMEX/DIY-LAPTOP | SOFTWARE/A64-TERES/linux-a64/drivers/gpu/drm/nouveau/core/engine/disp/sornv94.c | 2310 | 3837 | /*
* Copyright 2012 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: Ben Skeggs
*/
#include <core/os.h>
#include <core/class.h>
#include <subdev/bios.h>
#include <subdev/bios/dcb.h>
#include <subdev/bios/dp.h>
#include <subdev/bios/init.h>
#include "nv50.h"
static inline u32
nv94_sor_soff(struct dcb_output *outp)
{
return (ffs(outp->or) - 1) * 0x800;
}
static inline u32
nv94_sor_loff(struct dcb_output *outp)
{
return nv94_sor_soff(outp) + !(outp->sorconf.link & 1) * 0x80;
}
static inline u32
nv94_sor_dp_lane_map(struct nv50_disp_priv *priv, u8 lane)
{
static const u8 nvaf[] = { 24, 16, 8, 0 }; /* thanks, apple.. */
static const u8 nv94[] = { 16, 8, 0, 24 };
if (nv_device(priv)->chipset == 0xaf)
return nvaf[lane];
return nv94[lane];
}
static int
nv94_sor_dp_pattern(struct nouveau_disp *disp, struct dcb_output *outp,
int head, int pattern)
{
struct nv50_disp_priv *priv = (void *)disp;
const u32 loff = nv94_sor_loff(outp);
nv_mask(priv, 0x61c10c + loff, 0x0f000000, pattern << 24);
return 0;
}
static int
nv94_sor_dp_lnk_ctl(struct nouveau_disp *disp, struct dcb_output *outp,
int head, int link_nr, int link_bw, bool enh_frame)
{
struct nv50_disp_priv *priv = (void *)disp;
const u32 soff = nv94_sor_soff(outp);
const u32 loff = nv94_sor_loff(outp);
u32 dpctrl = 0x00000000;
u32 clksor = 0x00000000;
u32 lane = 0;
int i;
dpctrl |= ((1 << link_nr) - 1) << 16;
if (enh_frame)
dpctrl |= 0x00004000;
if (link_bw > 0x06)
clksor |= 0x00040000;
for (i = 0; i < link_nr; i++)
lane |= 1 << (nv94_sor_dp_lane_map(priv, i) >> 3);
nv_mask(priv, 0x614300 + soff, 0x000c0000, clksor);
nv_mask(priv, 0x61c10c + loff, 0x001f4000, dpctrl);
nv_mask(priv, 0x61c130 + loff, 0x0000000f, lane);
return 0;
}
static int
nv94_sor_dp_drv_ctl(struct nouveau_disp *disp, struct dcb_output *outp,
int head, int lane, int swing, int preem)
{
struct nouveau_bios *bios = nouveau_bios(disp);
struct nv50_disp_priv *priv = (void *)disp;
const u32 loff = nv94_sor_loff(outp);
u32 addr, shift = nv94_sor_dp_lane_map(priv, lane);
u8 ver, hdr, cnt, len;
struct nvbios_dpout info;
struct nvbios_dpcfg ocfg;
addr = nvbios_dpout_match(bios, outp->hasht, outp->hashm,
&ver, &hdr, &cnt, &len, &info);
if (!addr)
return -ENODEV;
addr = nvbios_dpcfg_match(bios, addr, 0, swing, preem,
&ver, &hdr, &cnt, &len, &ocfg);
if (!addr)
return -EINVAL;
nv_mask(priv, 0x61c118 + loff, 0x000000ff << shift, ocfg.drv << shift);
nv_mask(priv, 0x61c120 + loff, 0x000000ff << shift, ocfg.pre << shift);
nv_mask(priv, 0x61c130 + loff, 0x0000ff00, ocfg.unk << 8);
return 0;
}
const struct nouveau_dp_func
nv94_sor_dp_func = {
.pattern = nv94_sor_dp_pattern,
.lnk_ctl = nv94_sor_dp_lnk_ctl,
.drv_ctl = nv94_sor_dp_drv_ctl,
};
| apache-2.0 |
benlangmuir/swift | lib/SILOptimizer/IPO/GlobalOpt.cpp | 7 | 29751 | //===--- GlobalOpt.cpp - Optimize global initializers ---------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#define DEBUG_TYPE "globalopt"
#include "swift/AST/ASTMangler.h"
#include "swift/Demangling/Demangle.h"
#include "swift/Demangling/Demangler.h"
#include "swift/Demangling/ManglingMacros.h"
#include "swift/SIL/CFG.h"
#include "swift/SIL/DebugUtils.h"
#include "swift/SIL/SILCloner.h"
#include "swift/SIL/SILGlobalVariable.h"
#include "swift/SIL/SILInstruction.h"
#include "swift/SIL/SILInstructionWorklist.h"
#include "swift/SILOptimizer/Analysis/ColdBlockInfo.h"
#include "swift/SILOptimizer/Analysis/DominanceAnalysis.h"
#include "swift/SILOptimizer/PassManager/Passes.h"
#include "swift/SILOptimizer/PassManager/Transforms.h"
#include "swift/SILOptimizer/Utils/BasicBlockOptUtils.h"
#include "swift/SILOptimizer/Utils/InstructionDeleter.h"
#include "swift/SILOptimizer/Utils/SILOptFunctionBuilder.h"
#include "swift/SILOptimizer/Utils/ConstantFolding.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SCCIterator.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
using namespace swift;
namespace {
/// Optimize the placement of global initializers.
///
/// TODO:
///
/// - Analyze the module to move initializers to the module's public
/// entry points.
///
/// - Convert trivial initializers to static initialization. This requires
/// serializing globals.
///
/// - For global "lets", generate addressors that return by value. If we also
/// converted to a static initializer, then remove the load from the addressor.
///
/// - When the addressor is local to the module, be sure it is inlined to allow
/// constant propagation in case of statically initialized "lets".
class SILGlobalOpt {
SILOptFunctionBuilder &FunctionBuilder;
SILModule *Module;
DominanceAnalysis *DA;
SILPassManager *PM;
bool HasChanged = false;
typedef SmallVector<ApplyInst *, 4> GlobalInitCalls;
typedef SmallVector<BeginAccessInst *, 4> GlobalAccesses;
typedef SmallVector<GlobalAddrInst *, 4> GlobalAddrs;
/// A map from each visited global initializer call to a list of call sites.
llvm::MapVector<SILFunction *, GlobalInitCalls> GlobalInitCallMap;
// The following mappings are used if this is a compilation
// in scripting mode and global variables are accessed without
// addressors.
/// A map from each visited global to its set of begin_access instructions.
llvm::MapVector<SILGlobalVariable *, GlobalAccesses> GlobalAccessMap;
/// A map from each visited global to all of its global address instructions.
llvm::MapVector<SILGlobalVariable *, GlobalAddrs> GlobalAddrMap;
/// A map from each visited global let variable to the store instructions
/// which initialize it.
llvm::MapVector<SILGlobalVariable *, StoreInst *> GlobalVarStore;
/// A map for each visited global variable to the alloc instruction that
/// allocated space for it.
llvm::MapVector<SILGlobalVariable *, AllocGlobalInst *> AllocGlobalStore;
/// A set of visited global variables that for some reason we have decided is
/// not able to be optimized safely or for which we do not know how to
/// optimize safely.
///
/// Once a global variable is in this set, we no longer will process it.
llvm::SmallPtrSet<SILGlobalVariable *, 16> GlobalVarSkipProcessing;
/// The set of blocks that this pass has determined to be inside a loop.
///
/// This is used to mark any block that this pass has determined to be inside
/// a loop.
llvm::DenseSet<SILBasicBlock *> LoopBlocks;
/// The set of functions that have had their loops analyzed.
llvm::DenseSet<SILFunction *> LoopCheckedFunctions;
/// Whether we have seen any "once" calls to callees that we currently don't
/// handle.
bool UnhandledOnceCallee = false;
/// A map from a globalinit_func to the number of times "once" has called the
/// function.
llvm::DenseMap<SILFunction *, unsigned> InitializerCount;
llvm::SmallVector<SILInstruction *, 4> InstToRemove;
llvm::SmallVector<SILGlobalVariable *, 4> GlobalsToRemove;
public:
SILGlobalOpt(SILOptFunctionBuilder &FunctionBuilder, SILModule *M,
DominanceAnalysis *DA, SILPassManager *PM)
: FunctionBuilder(FunctionBuilder), Module(M), DA(DA), PM(PM) {}
bool run();
protected:
/// Checks if a given global variable is assigned only once.
bool isAssignedOnlyOnceInInitializer(SILGlobalVariable *SILG,
SILFunction *globalAddrF);
/// Reset all the maps of global variables.
void reset();
/// Collect all global variables.
void collect();
void collectUsesOfInstructionForDeletion(SILInstruction *inst);
/// This is the main entrypoint for collecting global accesses.
void collectGlobalAccess(GlobalAddrInst *GAI);
/// Returns true if we think that \p CurBB is inside a loop.
bool isInLoop(SILBasicBlock *CurBB);
/// Given that we are trying to place initializers in new locations, see if
/// we can hoist the passed in apply \p AI out of any loops that it is
/// currently within.
ApplyInst *getHoistedApplyForInitializer(
ApplyInst *AI, DominanceInfo *DT, SILFunction *InitF,
SILFunction *ParentF,
llvm::DenseMap<SILFunction *, ApplyInst *> &ParentFuncs);
/// Update UnhandledOnceCallee and InitializerCount by going through all
/// "once" calls.
void collectOnceCall(BuiltinInst *AI);
/// Set the static initializer and remove "once" from addressor if a global
/// can be statically initialized.
bool optimizeInitializer(SILFunction *AddrF, GlobalInitCalls &Calls);
/// If possible, remove global address instructions associated with the given
/// global.
bool tryRemoveGlobalAddr(SILGlobalVariable *global);
/// If possible, remove global alloc instructions associated with the given
/// global.
bool tryRemoveGlobalAlloc(SILGlobalVariable *global, AllocGlobalInst *alloc);
/// If a global has no uses, remove it.
bool tryRemoveUnusedGlobal(SILGlobalVariable *global);
/// Optimize access to the global variable, which is known to have a constant
/// value. Replace all loads from the global address by invocations of a
/// getter that returns the value of this variable.
void optimizeGlobalAccess(SILGlobalVariable *SILG, StoreInst *SI);
/// Replace loads from a global variable by the known value.
void replaceLoadsByKnownValue(SILFunction *InitF,
SILGlobalVariable *SILG,
GlobalInitCalls &Calls);
};
/// Helper class to copy only a set of SIL instructions providing in the
/// constructor.
class InstructionsCloner : public SILClonerWithScopes<InstructionsCloner> {
friend class SILInstructionVisitor<InstructionsCloner>;
friend class SILCloner<InstructionsCloner>;
ArrayRef<SILInstruction *> Insns;
protected:
SILBasicBlock *FromBB, *DestBB;
public:
/// A map of old to new available values.
SmallVector<std::pair<ValueBase *, SILValue>, 16> AvailVals;
InstructionsCloner(SILFunction &F,
ArrayRef<SILInstruction *> Insns,
SILBasicBlock *Dest = nullptr)
: SILClonerWithScopes(F), Insns(Insns), FromBB(nullptr), DestBB(Dest) {}
void process(SILInstruction *I) { visit(I); }
SILBasicBlock *remapBasicBlock(SILBasicBlock *BB) { return BB; }
SILValue getMappedValue(SILValue Value) {
return SILCloner<InstructionsCloner>::getMappedValue(Value);
}
void postProcess(SILInstruction *Orig, SILInstruction *Cloned) {
DestBB->push_back(Cloned);
SILClonerWithScopes<InstructionsCloner>::postProcess(Orig, Cloned);
auto origResults = Orig->getResults(), clonedResults = Cloned->getResults();
assert(origResults.size() == clonedResults.size());
for (auto i : indices(origResults))
AvailVals.push_back(std::make_pair(origResults[i], clonedResults[i]));
}
/// Clone all instructions from Insns into DestBB
void clone() {
for (auto I : Insns)
process(I);
}
};
} // end anonymous namespace
/// Remove an unused global token used by once calls.
static void removeToken(SILValue Op) {
if (auto *ATPI = dyn_cast<AddressToPointerInst>(Op)) {
Op = ATPI->getOperand();
if (ATPI->use_empty())
ATPI->eraseFromParent();
}
if (auto *GAI = dyn_cast<GlobalAddrInst>(Op)) {
auto *Global = GAI->getReferencedGlobal();
// If "global_addr token" is used more than one time, bail.
if (!(GAI->use_empty() || GAI->hasOneUse()))
return;
// If it is not a *_token global variable, bail.
if (!Global || !Global->getName().contains("_token"))
return;
GAI->getModule().eraseGlobalVariable(Global);
GAI->replaceAllUsesWithUndef();
GAI->eraseFromParent();
}
}
// Update UnhandledOnceCallee and InitializerCount by going through all "once"
// calls.
void SILGlobalOpt::collectOnceCall(BuiltinInst *BI) {
if (UnhandledOnceCallee)
return;
const BuiltinInfo &Builtin = Module->getBuiltinInfo(BI->getName());
if (Builtin.ID != BuiltinValueKind::Once)
return;
SILFunction *Callee = getCalleeOfOnceCall(BI);
if (!Callee) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: unhandled once callee\n");
UnhandledOnceCallee = true;
return;
}
if (!Callee->isGlobalInitOnceFunction())
return;
// We currently disable optimizing the initializer if a globalinit_func
// is called by "once" from multiple locations.
if (!BI->getFunction()->isGlobalInit())
// If a globalinit_func is called by "once" from a function that is not
// an addressor, we set count to 2 to disable optimizing the initializer.
InitializerCount[Callee] = 2;
else
++InitializerCount[Callee];
}
static bool isPotentialStore(SILInstruction *inst) {
switch (inst->getKind()) {
case SILInstructionKind::LoadInst:
return false;
case SILInstructionKind::PointerToAddressInst:
case SILInstructionKind::StructElementAddrInst:
case SILInstructionKind::TupleElementAddrInst:
for (Operand *op : cast<SingleValueInstruction>(inst)->getUses()) {
if (isPotentialStore(op->getUser()))
return true;
}
return false;
case SILInstructionKind::BeginAccessInst:
return cast<BeginAccessInst>(inst)->getAccessKind() != SILAccessKind::Read;
default:
return true;
}
}
/// return true if this block is inside a loop.
bool SILGlobalOpt::isInLoop(SILBasicBlock *CurBB) {
SILFunction *F = CurBB->getParent();
// Catch the common case in which we've already hoisted the initializer.
if (CurBB == &F->front())
return false;
if (LoopCheckedFunctions.insert(F).second) {
for (auto I = scc_begin(F); !I.isAtEnd(); ++I) {
if (I.hasCycle())
for (SILBasicBlock *BB : *I)
LoopBlocks.insert(BB);
}
}
return LoopBlocks.count(CurBB);
}
bool SILGlobalOpt::isAssignedOnlyOnceInInitializer(SILGlobalVariable *SILG,
SILFunction *globalAddrF) {
if (SILG->isLet())
return true;
// Don't replace loads from `var` globals when compiled with -Onone.
if (Module->getOptions().OptMode == OptimizationMode::NoOptimization)
return false;
// If we should skip this, it is probably because there are multiple stores.
// Return false if there are multiple stores or no stores.
if (GlobalVarSkipProcessing.count(SILG) || !GlobalVarStore.count(SILG))
return false;
if (GlobalInitCallMap.count(globalAddrF)) {
for (ApplyInst *initCall : GlobalInitCallMap[globalAddrF]) {
for (auto *Op : getNonDebugUses(initCall)) {
if (isPotentialStore(Op->getUser()))
return false;
}
}
}
// Otherwise, return true if this can't be used externally (false, otherwise).
return !isPossiblyUsedExternally(SILG->getLinkage(),
SILG->getModule().isWholeModule());
}
/// Replace loads from \a addr by the \p initVal of a global.
///
/// Recuresively walk over all uses of \p addr and look through address
/// projections. The \p initVal is an instruction in the static initializer of
/// a SILGlobalVariable. It is cloned into the current function with \p cloner.
static void replaceLoadsFromGlobal(SILValue addr,
SingleValueInstruction *initVal,
StaticInitCloner &cloner) {
for (Operand *use : addr->getUses()) {
SILInstruction *user = use->getUser();
if (auto *load = dyn_cast<LoadInst>(user)) {
SingleValueInstruction *clonedInitVal = cloner.clone(initVal);
load->replaceAllUsesWith(clonedInitVal);
continue;
}
if (auto *seai = dyn_cast<StructElementAddrInst>(user)) {
auto *si = cast<StructInst>(initVal);
auto *member = cast<SingleValueInstruction>(
si->getOperandForField(seai->getField())->get());
replaceLoadsFromGlobal(seai, member, cloner);
continue;
}
if (auto *teai = dyn_cast<TupleElementAddrInst>(user)) {
auto *ti = cast<TupleInst>(initVal);
auto *member = cast<SingleValueInstruction>(
ti->getElement(teai->getFieldIndex()));
replaceLoadsFromGlobal(teai, member, cloner);
continue;
}
if (isa<BeginAccessInst>(user) || isa<PointerToAddressInst>(user)) {
auto *svi = cast<SingleValueInstruction>(user);
replaceLoadsFromGlobal(svi, initVal, cloner);
continue;
}
}
}
/// Replace loads from a global variable by the known initial value.
void SILGlobalOpt::
replaceLoadsByKnownValue(SILFunction *InitF, SILGlobalVariable *SILG,
GlobalInitCalls &Calls) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: replacing loads with known value for "
<< SILG->getName() << '\n');
for (ApplyInst *initCall : Calls) {
auto *initVal =
dyn_cast<SingleValueInstruction>(SILG->getStaticInitializerValue());
if (!initVal) {
// This should never happen. Just to be on the safe side.
continue;
}
StaticInitCloner cloner(initCall);
SmallVector<SILInstruction *, 8> insertedInsts;
cloner.setTrackingList(&insertedInsts);
if (!cloner.add(initVal))
continue;
// Replace all loads from the addressor with the initial value of the global.
replaceLoadsFromGlobal(initCall, initVal, cloner);
// Remove all instructions which are dead now.
InstructionDeleter deleter;
deleter.recursivelyDeleteUsersIfDead(initCall);
if (initCall->use_empty()) {
// The call to the addressor is dead as well and can be removed.
auto *callee = dyn_cast<FunctionRefInst>(initCall->getCallee());
deleter.forceDelete(initCall);
if (callee)
deleter.deleteIfDead(callee);
}
// Constant folding the global value can enable other initializers to become
// constant, e.g.
// let a = 1
// let b = a + 1
ConstantFolder constFolder(FunctionBuilder, PM->getOptions().AssertConfig);
for (SILInstruction *inst : insertedInsts) {
constFolder.addToWorklist(inst);
}
constFolder.processWorkList();
}
Calls.clear();
}
/// We analyze the body of globalinit_func to see if it can be statically
/// initialized. If yes, we set the initial value of the SILGlobalVariable and
/// remove the "once" call to globalinit_func from the addressor.
bool SILGlobalOpt::optimizeInitializer(SILFunction *AddrF,
GlobalInitCalls &Calls) {
if (UnhandledOnceCallee)
return false;
// Find the initializer and the SILGlobalVariable.
BuiltinInst *CallToOnce;
// If the addressor contains a single "once" call, it calls globalinit_func,
// and the globalinit_func is called by "once" from a single location,
// continue; otherwise bail.
auto *InitF = findInitializer(AddrF, CallToOnce);
if (!InitF || InitializerCount[InitF] > 1)
return false;
// If the globalinit_func is trivial, continue; otherwise bail.
SingleValueInstruction *InitVal;
SILGlobalVariable *SILG = getVariableOfStaticInitializer(InitF, InitVal);
if (!SILG)
return false;
auto expansion = ResilienceExpansion::Maximal;
if (hasPublicVisibility(SILG->getLinkage()))
expansion = ResilienceExpansion::Minimal;
auto &tl = Module->Types.getTypeLowering(
SILG->getLoweredType(),
TypeExpansionContext::noOpaqueTypeArchetypesSubstitution(expansion));
if (!tl.isLoadable())
return false;
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: use static initializer for "
<< SILG->getName() << '\n');
// Remove "once" call from the addressor.
removeToken(CallToOnce->getOperand(0));
InstructionDeleter deleter;
deleter.forceDeleteWithUsers(CallToOnce);
deleter.cleanupDeadInstructions();
// Create the constant initializer of the global variable.
StaticInitCloner::appendToInitializer(SILG, InitVal);
if (isAssignedOnlyOnceInInitializer(SILG, AddrF)) {
replaceLoadsByKnownValue(InitF, SILG, Calls);
}
HasChanged = true;
return true;
}
static bool canBeChangedExternally(SILGlobalVariable *SILG) {
// Don't assume anything about globals which are imported from other modules.
if (isAvailableExternally(SILG->getLinkage()))
return true;
// Use access specifiers from the declarations,
// if possible.
if (auto *Decl = SILG->getDecl()) {
switch (Decl->getEffectiveAccess()) {
case AccessLevel::Private:
case AccessLevel::FilePrivate:
return false;
case AccessLevel::Internal:
return !SILG->getModule().isWholeModule();
case AccessLevel::Public:
case AccessLevel::Open:
return true;
}
}
if (SILG->getLinkage() == SILLinkage::Private)
return false;
if (SILG->getLinkage() == SILLinkage::Hidden
&& SILG->getModule().isWholeModule()) {
return false;
}
return true;
}
static bool canBeUsedOrChangedExternally(SILGlobalVariable *global) {
if (global->isLet())
return isPossiblyUsedExternally(global->getLinkage(),
global->getModule().isWholeModule());
return canBeChangedExternally(global);
}
static bool isSafeToRemove(SILGlobalVariable *global) {
return global->getDecl() && !canBeUsedOrChangedExternally(global);
}
bool SILGlobalOpt::tryRemoveGlobalAlloc(SILGlobalVariable *global,
AllocGlobalInst *alloc) {
if (!isSafeToRemove(global))
return false;
// Make sure the global's address is never taken and we shouldn't skip this
// global.
if (GlobalVarSkipProcessing.count(global) ||
(GlobalAddrMap[global].size() &&
std::any_of(GlobalAddrMap[global].begin(), GlobalAddrMap[global].end(),
[=](GlobalAddrInst *addr) {
return std::find(InstToRemove.begin(), InstToRemove.end(),
addr) == InstToRemove.end();
})))
return false;
InstToRemove.push_back(alloc);
return true;
}
/// If there are no loads or accesses of a given global, then remove its
/// associated global addr and all asssociated instructions.
bool SILGlobalOpt::tryRemoveGlobalAddr(SILGlobalVariable *global) {
if (!isSafeToRemove(global))
return false;
if (GlobalVarSkipProcessing.count(global) || GlobalAccessMap[global].size())
return false;
// Check if the address is used in anything but a store. If any global_addr
// instruction associated with a global is used in anything but a store, we
// can't remove ANY global_addr instruction associated with that global.
for (auto *addr : GlobalAddrMap[global]) {
for (auto *use : addr->getUses()) {
if (!isa<StoreInst>(use->getUser()))
return false;
}
}
// Now that it's safe, remove all global addresses associated with this global
for (auto *addr : GlobalAddrMap[global]) {
InstToRemove.push_back(addr);
}
return true;
}
bool SILGlobalOpt::tryRemoveUnusedGlobal(SILGlobalVariable *global) {
if (!isSafeToRemove(global))
return false;
if (GlobalVarSkipProcessing.count(global))
return false;
// If this global is used, check if the user is going to be removed.
// Make sure none of the removed instructions are the same as this global's
// alloc instruction
if (AllocGlobalStore.count(global) &&
std::none_of(InstToRemove.begin(), InstToRemove.end(),
[=](SILInstruction *inst) {
return AllocGlobalStore[global] == inst;
}))
return false;
if (GlobalVarStore.count(global) &&
std::none_of(
InstToRemove.begin(), InstToRemove.end(),
[=](SILInstruction *inst) { return GlobalVarStore[global] == inst; }))
return false;
// Check if any of the global_addr instructions associated with this global
// aren't going to be removed. In that case, we need to keep the global.
if (GlobalAddrMap[global].size() &&
std::any_of(GlobalAddrMap[global].begin(), GlobalAddrMap[global].end(),
[=](GlobalAddrInst *addr) {
return std::find(InstToRemove.begin(), InstToRemove.end(),
addr) == InstToRemove.end();
}))
return false;
if (GlobalAccessMap[global].size() &&
std::any_of(GlobalAccessMap[global].begin(),
GlobalAccessMap[global].end(), [=](BeginAccessInst *access) {
return std::find(InstToRemove.begin(), InstToRemove.end(),
access) == InstToRemove.end();
}))
return false;
GlobalsToRemove.push_back(global);
return true;
}
/// If this is a read from a global let variable, map it.
void SILGlobalOpt::collectGlobalAccess(GlobalAddrInst *GAI) {
auto *SILG = GAI->getReferencedGlobal();
if (!SILG)
return;
if (!SILG->getDecl())
return;
GlobalAddrMap[SILG].push_back(GAI);
if (!SILG->isLet()) {
// We cannot determine the value for global variables which could be
// changed externally at run-time.
if (canBeChangedExternally(SILG))
return;
}
if (GlobalVarSkipProcessing.count(SILG))
return;
auto *F = GAI->getFunction();
if (!SILG->getLoweredType().isTrivial(*F)) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: type is not trivial: "
<< SILG->getName() << '\n');
GlobalVarSkipProcessing.insert(SILG);
return;
}
// Ignore any accesses inside addressors for SILG
auto GlobalVar = getVariableOfGlobalInit(F);
if (GlobalVar == SILG)
return;
for (auto *Op : getNonDebugUses(GAI)) {
SILInstruction *user = Op->getUser();
auto *SI = dyn_cast<StoreInst>(user);
if (SI && SI->getDest() == GAI && GlobalVarStore.count(SILG) == 0) {
// The one and only store to global.
GlobalVarStore[SILG] = SI;
continue;
}
if (auto *beginAccess = dyn_cast<BeginAccessInst>(user)) {
GlobalAccessMap[SILG].push_back(beginAccess);
}
if (isPotentialStore(user)) {
// An unknown store or the second store we see.
// If there are multiple stores to a global we cannot reason about the
// value.
GlobalVarSkipProcessing.insert(SILG);
}
}
}
// Optimize access to the global variable, which is known to have a constant
// value. Replace all loads from the global address by invocations of a getter
// that returns the value of this variable.
void SILGlobalOpt::optimizeGlobalAccess(SILGlobalVariable *SILG,
StoreInst *SI) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: use static initializer for "
<< SILG->getName() << '\n');
if (GlobalVarSkipProcessing.count(SILG)) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: already decided to skip: "
<< SILG->getName() << '\n');
return;
}
if (GlobalAddrMap[SILG].empty()) {
LLVM_DEBUG(llvm::dbgs() << "GlobalOpt: not in load map: "
<< SILG->getName() << '\n');
return;
}
auto *initVal = dyn_cast<SingleValueInstruction>(SI->getSrc());
if (!initVal)
return;
SmallVector<SILInstruction *, 8> unused;
if (!analyzeStaticInitializer(initVal, unused))
return;
// Iterate over all loads and replace them by values.
for (auto *globalAddr : GlobalAddrMap[SILG]) {
if (globalAddr->getFunction()->isSerialized())
continue;
StaticInitCloner cloner(globalAddr);
if (!cloner.add(initVal))
continue;
// Replace all loads from the addressor with the initial value of the global.
replaceLoadsFromGlobal(globalAddr, initVal, cloner);
HasChanged = true;
}
}
void SILGlobalOpt::reset() {
AllocGlobalStore.clear();
GlobalVarStore.clear();
GlobalAddrMap.clear();
GlobalAccessMap.clear();
GlobalInitCallMap.clear();
}
void SILGlobalOpt::collect() {
for (auto &F : *Module) {
// Make sure to create an entry. This is important in case a global variable
// (e.g. a public one) is not used inside the same module.
if (F.isGlobalInit())
(void)GlobalInitCallMap[&F];
// Cache cold blocks per function.
ColdBlockInfo ColdBlocks(DA);
for (auto &BB : F) {
bool IsCold = ColdBlocks.isCold(&BB);
for (auto &I : BB) {
if (auto *BI = dyn_cast<BuiltinInst>(&I)) {
collectOnceCall(BI);
continue;
}
if (auto *AI = dyn_cast<ApplyInst>(&I)) {
if (!IsCold) {
if (SILFunction *callee = AI->getReferencedFunctionOrNull()) {
if (callee->isGlobalInit() && ApplySite(AI).canOptimize())
GlobalInitCallMap[callee].push_back(AI);
}
}
continue;
}
if (auto *GAI = dyn_cast<GlobalAddrInst>(&I)) {
collectGlobalAccess(GAI);
continue;
}
if (auto *allocGlobal = dyn_cast<AllocGlobalInst>(&I)) {
AllocGlobalStore[allocGlobal->getReferencedGlobal()] = allocGlobal;
continue;
}
}
}
}
}
bool SILGlobalOpt::run() {
// Collect all the global variables and associated instructions.
collect();
// Iterate until a fixed point to be able to optimize globals which depend
// on other globals, e.g.
// let a = 1
// let b = a + 10
// let c = b + 5
// ...
bool changed = false;
do {
changed = false;
for (auto &InitCalls : GlobalInitCallMap) {
// Try to create a static initializer for the global and replace all uses
// of the global by this constant value.
changed |= optimizeInitializer(InitCalls.first, InitCalls.second);
}
} while (changed);
// This is similiar to optimizeInitializer, but it's for globals which are
// initialized in the "main" function and not by an initializer function.
for (auto &Init : GlobalVarStore) {
// Don't optimize functions that are marked with the opt.never attribute.
if (!Init.second->getFunction()->shouldOptimize())
continue;
optimizeGlobalAccess(Init.first, Init.second);
}
/// Don't perform the remaining optimizations when compiled with -Onone.
if (Module->getOptions().OptMode == OptimizationMode::NoOptimization)
return HasChanged;
SmallVector<SILGlobalVariable *, 8> addrGlobals;
for (auto &addrPair : GlobalAddrMap) {
// Don't optimize functions that are marked with the opt.never attribute.
bool shouldOptimize = true;
for (auto *addr : addrPair.second) {
if (!addr->getFunction()->shouldOptimize()) {
shouldOptimize = false;
break;
}
}
if (!shouldOptimize)
continue;
addrGlobals.push_back(addrPair.first);
}
for (auto *global : addrGlobals) {
HasChanged |= tryRemoveGlobalAddr(global);
}
SmallVector<std::pair<SILGlobalVariable *, AllocGlobalInst *>, 12>
globalAllocPairs;
for (auto &alloc : AllocGlobalStore) {
if (!alloc.second->getFunction()->shouldOptimize())
continue;
globalAllocPairs.push_back(std::make_pair(alloc.first, alloc.second));
}
for (auto &allocPair : globalAllocPairs) {
HasChanged |= tryRemoveGlobalAlloc(allocPair.first, allocPair.second);
}
if (HasChanged) {
// Erase the instructions that we have marked for deletion.
InstructionDeleter deleter;
for (auto *inst : InstToRemove) {
deleter.forceDeleteWithUsers(inst);
}
deleter.cleanupDeadInstructions();
} else {
assert(InstToRemove.empty());
}
for (auto &global : Module->getSILGlobals()) {
HasChanged |= tryRemoveUnusedGlobal(&global);
}
for (auto *global : GlobalsToRemove) {
Module->eraseGlobalVariable(global);
}
// Reset in case we re-run this function (when HasChanged is true).
reset();
return HasChanged;
}
//===----------------------------------------------------------------------===//
// Top Level Entry Point
//===----------------------------------------------------------------------===//
namespace {
class SILGlobalOptPass : public SILModuleTransform {
void run() override {
auto *DA = PM->getAnalysis<DominanceAnalysis>();
SILOptFunctionBuilder FunctionBuilder(*this);
if (SILGlobalOpt(FunctionBuilder, getModule(), DA, PM).run()) {
invalidateAll();
}
}
};
} // end anonymous namespace
SILTransform *swift::createGlobalOpt() {
return new SILGlobalOptPass();
}
| apache-2.0 |
xuegang/gpdb | src/backend/executor/nodeDynamicIndexscan.c | 7 | 12219 | /*
* nodeDynamicIndexscan.c
* Support routines for scanning one or more indexes that
* are determined at runtime.
*
* DynamicIndexScan node scans each index one after the other.
* For each index, it opens the index, scans the index, and returns
* relevant tuples.
*
* Copyright (c) 2013 - present, EMC/Greenplum
*/
#include "postgres.h"
#include "executor/executor.h"
#include "executor/instrument.h"
#include "nodes/execnodes.h"
#include "executor/execIndexscan.h"
#include "executor/nodeIndexscan.h"
#include "executor/execDynamicIndexScan.h"
#include "executor/nodeDynamicIndexscan.h"
#include "cdb/cdbpartition.h"
#include "parser/parsetree.h"
#include "access/genam.h"
#include "catalog/catquery.h"
#include "nodes/nodeFuncs.h"
#include "utils/memutils.h"
#include "cdb/cdbvars.h"
/*
* Free resources from a partition.
*/
static inline void
CleanupOnePartition(IndexScanState *indexState);
/*
* Account for the number of tuple slots required for DynamicIndexScan
*
* XXX: We have backported the PostgreSQL patch that made these functions
* obsolete. The returned value isn't used for anything, so just return 0.
*/
int
ExecCountSlotsDynamicIndexScan(DynamicIndexScan *node)
{
return 0;
}
/*
* Initialize ScanState in DynamicIndexScan.
*/
DynamicIndexScanState *
ExecInitDynamicIndexScan(DynamicIndexScan *node, EState *estate, int eflags)
{
/* check for unsupported flags */
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
DynamicIndexScanState *dynamicIndexScanState = makeNode(DynamicIndexScanState);
dynamicIndexScanState->indexScanState.ss.scan_state = SCAN_INIT;
/*
* This context will be reset per-partition to free up per-partition
* copy of LogicalIndexInfo
*/
dynamicIndexScanState->partitionMemoryContext = AllocSetContextCreate(CurrentMemoryContext,
"DynamicIndexScanPerPartition",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
IndexScanState *indexState = &(dynamicIndexScanState->indexScanState);
InitCommonIndexScanState((IndexScanState *)dynamicIndexScanState, (IndexScan *)node, estate, eflags);
/* We don't support eager free in DynamicIndexScan */
indexState->ss.ps.delayEagerFree = true;
InitRuntimeKeysContext(indexState);
initGpmonPktForDynamicIndexScan((Plan *)node, &indexState->ss.ps.gpmon_pkt, estate);
return dynamicIndexScanState;
}
static bool
DynamicIndexScan_ReMapColumns(DynamicIndexScanState *scanState, Oid newOid)
{
Assert(OidIsValid(newOid));
IndexScan *indexScan = (IndexScan *) scanState->indexScanState.ss.ps.plan;
if (!isDynamicScan(&indexScan->scan))
{
return false;
}
Oid oldOid = scanState->columnLayoutOid;
if (!OidIsValid(oldOid))
{
/* Very first partition */
oldOid = rel_partition_get_root(newOid);
}
Assert(OidIsValid(oldOid));
if (oldOid == newOid)
{
/*
* If we have only one partition and we are rescanning
* then we can have this scenario.
*/
return false;
}
AttrNumber *attMap = IndexScan_GetColumnMapping(oldOid, newOid);
scanState->columnLayoutOid = newOid;
if (attMap)
{
IndexScan_MapLogicalIndexInfo(indexScan->logicalIndexInfo, attMap, indexScan->scan.scanrelid);
change_varattnos_of_a_varno((Node*)indexScan->scan.plan.targetlist, attMap, indexScan->scan.scanrelid);
change_varattnos_of_a_varno((Node*)indexScan->indexqual, attMap, indexScan->scan.scanrelid);
pfree(attMap);
return true;
}
else
{
return false;
}
}
/*
* This function initializes a part and returns true if a new index has been prepared for scanning.
*/
static bool
initNextIndexToScan(DynamicIndexScanState *node)
{
IndexScanState *indexState = &(node->indexScanState);
DynamicIndexScan *dynamicIndexScan = (DynamicIndexScan *)node->indexScanState.ss.ps.plan;
EState *estate = indexState->ss.ps.state;
/* Load new index when the scanning of the previous index is done. */
if (indexState->ss.scan_state == SCAN_INIT ||
indexState->ss.scan_state == SCAN_DONE)
{
/* This is the oid of a partition of the table (*not* index) */
Oid *pid = hash_seq_search(&node->pidxStatus);
if (pid == NULL)
{
/* Return if all parts have been scanned. */
node->shouldCallHashSeqTerm = false;
return false;
}
/* Collect number of partitions scanned in EXPLAIN ANALYZE */
if(NULL != indexState->ss.ps.instrument)
{
Instrumentation *instr = indexState->ss.ps.instrument;
instr->numPartScanned ++;
}
DynamicIndexScan_ReMapColumns(node, *pid);
/*
* The is the oid of the partition of an *index*. Note: a partitioned table
* has a root and a set of partitions (may be multi-level). An index
* on a partitioned table also has a root and a set of index partitions.
* We started at table level, and now we are fetching the oid of an index
* partition.
*/
Oid pindex = getPhysicalIndexRelid(dynamicIndexScan->logicalIndexInfo,
*pid);
Assert(OidIsValid(pindex));
Relation currentRelation = OpenScanRelationByOid(*pid);
indexState->ss.ss_currentRelation = currentRelation;
indexState->ss.ss_ScanTupleSlot->tts_tableOid = *pid;
ExecAssignScanType(&indexState->ss, RelationGetDescr(currentRelation));
/*
* Initialize result tuple type and projection info.
*/
ExecAssignResultTypeFromTL(&indexState->ss.ps);
ExecAssignScanProjectionInfo(&indexState->ss);
MemoryContextReset(node->partitionMemoryContext);
MemoryContext oldCxt = MemoryContextSwitchTo(node->partitionMemoryContext);
/* Initialize child expressions */
indexState->ss.ps.qual = (List *) ExecInitExpr((Expr *) indexState->ss.ps.plan->qual, (PlanState *) indexState);
indexState->ss.ps.targetlist = (List *) ExecInitExpr((Expr *) indexState->ss.ps.plan->targetlist, (PlanState *) indexState);
indexState->iss_RelationDesc =
OpenIndexRelation(estate, pindex, *pid);
/*
* build the index scan keys from the index qualification
*/
ExecIndexBuildScanKeys((PlanState *) indexState,
indexState->iss_RelationDesc,
dynamicIndexScan->indexqual,
dynamicIndexScan->indexstrategy,
dynamicIndexScan->indexsubtype,
&indexState->iss_ScanKeys,
&indexState->iss_NumScanKeys,
&indexState->iss_RuntimeKeys,
&indexState->iss_NumRuntimeKeys,
NULL,
NULL);
MemoryContextSwitchTo(oldCxt);
if (indexState->iss_NumRuntimeKeys != 0)
{
ExecIndexEvalRuntimeKeys(indexState->iss_RuntimeContext,
indexState->iss_RuntimeKeys,
indexState->iss_NumRuntimeKeys);
}
indexState->iss_RuntimeKeysReady = true;
indexState->iss_ScanDesc = index_beginscan(currentRelation,
indexState->iss_RelationDesc,
estate->es_snapshot,
indexState->iss_NumScanKeys,
indexState->iss_ScanKeys);
indexState->ss.scan_state = SCAN_SCAN;
}
return true;
}
/*
* setPidIndex
* Set the hash table of Oids to scan.
*/
static void
setPidIndex(DynamicIndexScanState *node)
{
Assert(node->pidxIndex == NULL);
IndexScanState *indexState = (IndexScanState *)node;
EState *estate = indexState->ss.ps.state;
DynamicIndexScan *plan = (DynamicIndexScan *)indexState->ss.ps.plan;
Assert(estate->dynamicTableScanInfo != NULL);
/*
* Ensure that the dynahash exists even if the partition selector
* didn't choose any partition for current scan node [MPP-24169].
*/
InsertPidIntoDynamicTableScanInfo(plan->scan.partIndex, InvalidOid, InvalidPartitionSelectorId);
Assert(NULL != estate->dynamicTableScanInfo->pidIndexes);
Assert(estate->dynamicTableScanInfo->numScans >= plan->scan.partIndex);
node->pidxIndex = estate->dynamicTableScanInfo->pidIndexes[plan->scan.partIndex - 1];
Assert(node->pidxIndex != NULL);
if (optimizer_partition_selection_log)
{
LogSelectedPartitionOids(node->pidxIndex);
}
}
/*
* Execution of DynamicIndexScan
*/
TupleTableSlot *
ExecDynamicIndexScan(DynamicIndexScanState *node)
{
Assert(node);
IndexScanState *indexState = &(node->indexScanState);
TupleTableSlot *slot = NULL;
/*
* If this is called the first time, find the pid index that contains all unique
* partition pids for this node to scan.
*/
if (node->pidxIndex == NULL)
{
setPidIndex(node);
Assert(node->pidxIndex != NULL);
hash_seq_init(&node->pidxStatus, node->pidxIndex);
node->shouldCallHashSeqTerm = true;
}
/*
* Scan index to find next tuple to return. If the current index
* is exhausted, close it and open the next index for scan.
*/
while (TupIsNull(slot) &&
initNextIndexToScan(node))
{
slot = ExecScan(&indexState->ss, (ExecScanAccessMtd) IndexNext);
if (!TupIsNull(slot))
{
/* Report output rows to Gpmon */
Gpmon_M_Incr_Rows_Out(GpmonPktFromDynamicIndexScanState(node));
CheckSendPlanStateGpmonPkt(&indexState->ss.ps);
}
else
{
CleanupOnePartition(indexState);
}
}
return slot;
}
/*
* Release resources for one part (this includes closing the index and
* the relation).
*/
static inline void
CleanupOnePartition(IndexScanState *indexState)
{
Assert(NULL != indexState);
/* Reset index state and release locks. */
ExecClearTuple(indexState->ss.ps.ps_ResultTupleSlot);
ExecClearTuple(indexState->ss.ss_ScanTupleSlot);
if ((indexState->ss.scan_state & SCAN_SCAN) != 0)
{
Assert(indexState->iss_ScanDesc != NULL);
Assert(indexState->iss_RelationDesc != NULL);
Assert(indexState->ss.ss_currentRelation != NULL);
index_endscan(indexState->iss_ScanDesc);
indexState->iss_ScanDesc = NULL;
index_close(indexState->iss_RelationDesc, NoLock);
indexState->iss_RelationDesc = NULL;
ExecCloseScanRelation(indexState->ss.ss_currentRelation);
indexState->ss.ss_currentRelation = NULL;
}
indexState->ss.scan_state = SCAN_INIT;
}
/*
* Ends current scan by closing relations, and ending hash
* iteration
*/
static void
DynamicIndexScanEndCurrentScan(DynamicIndexScanState *node)
{
IndexScanState *indexState = &(node->indexScanState);
CleanupOnePartition(indexState);
if (node->shouldCallHashSeqTerm)
{
hash_seq_term(&node->pidxStatus);
node->shouldCallHashSeqTerm = false;
}
}
/*
* Release resources of DynamicIndexScan
*/
void
ExecEndDynamicIndexScan(DynamicIndexScanState *node)
{
DynamicIndexScanEndCurrentScan(node);
IndexScanState *indexState = &(node->indexScanState);
FreeRuntimeKeysContext((IndexScanState *) node);
EndPlanStateGpmonPkt(&indexState->ss.ps);
MemoryContextDelete(node->partitionMemoryContext);
}
/*
* Allow rescanning an index.
*/
void
ExecDynamicIndexReScan(DynamicIndexScanState *node, ExprContext *exprCtxt)
{
DynamicIndexScanEndCurrentScan(node);
/* Force reloading the hash table */
node->pidxIndex = NULL;
/* Context for runtime keys */
ExprContext *econtext = node->indexScanState.iss_RuntimeContext;
if (econtext)
{
/*
* If we are being passed an outer tuple, save it for runtime key
* calc. We also need to link it into the "regular" per-tuple
* econtext, so it can be used during indexqualorig evaluations.
*/
if (exprCtxt != NULL)
{
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
ExprContext *stdecontext = node->indexScanState.ss.ps.ps_ExprContext;
stdecontext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
}
/*
* Reset the runtime-key context so we don't leak memory as each outer
* tuple is scanned. Note this assumes that we will recalculate *all*
* runtime keys on each call.
*/
ResetExprContext(econtext);
}
Gpmon_M_Incr(GpmonPktFromDynamicIndexScanState(node), GPMON_DYNAMICINDEXSCAN_RESCAN);
CheckSendPlanStateGpmonPkt(&node->indexScanState.ss.ps);
}
/*
* Method for reporting DynamicIndexScan progress to gpperfmon
*/
void
initGpmonPktForDynamicIndexScan(Plan *planNode, gpmon_packet_t *gpmon_pkt, EState *estate)
{
Assert(planNode != NULL && gpmon_pkt != NULL && IsA(planNode, DynamicIndexScan));
{
RangeTblEntry *rte = rt_fetch(((Scan *)planNode)->scanrelid, estate->es_range_table);
char schema_rel_name[SCAN_REL_NAME_BUF_SIZE] = {0};
Assert(GPMON_DYNAMICINDEXSCAN_TOTAL <= (int)GPMON_QEXEC_M_COUNT);
InitPlanNodeGpmonPkt(planNode, gpmon_pkt, estate, PMNT_DynamicIndexScan,
(int64) planNode->plan_rows, GetScanRelNameGpmon(rte->relid, schema_rel_name));
}
}
| apache-2.0 |
amaliujia/CMUDB-peloton | src/postgres/backend/parser/parser.cpp | 9 | 5434 | /*-------------------------------------------------------------------------
*
* parser.c
* Main entry point/driver for PostgreSQL grammar
*
* Note that the grammar is not allowed to perform any table access
* (since we need to be able to do basic parsing even while inside an
* aborted transaction). Therefore, the data structures returned by
* the grammar are "raw" parsetrees that still need to be analyzed by
* analyze.c and related files.
*
*
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* src/backend/parser/parser.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "parser/gramparse.h"
#include "parser/parser.h"
extern int base_yydebug;
/*
* raw_parser
* Given a query in string form, do lexical and grammatical analysis.
*
* Returns a list of raw (un-analyzed) parse trees.
*/
List *
raw_parser(const char *str)
{
core_yyscan_t yyscanner;
base_yy_extra_type yyextra;
int yyresult;
/* initialize the flex scanner */
yyscanner = scanner_init(str, &yyextra.core_yy_extra,
ScanKeywords, NumScanKeywords);
/* base_yylex() only needs this much initialization */
yyextra.have_lookahead = false;
/* initialize the bison parser */
parser_init(&yyextra);
//base_yydebug = 1;
/* Parse! */
yyresult = base_yyparse(yyscanner);
/* Clean up (release memory) */
scanner_finish(yyscanner);
if (yyresult) /* error */
return NIL;
return yyextra.parsetree;
}
/*
* Intermediate filter between parser and core lexer (core_yylex in scan.l).
*
* This filter is needed because in some cases the standard SQL grammar
* requires more than one token lookahead. We reduce these cases to one-token
* lookahead by replacing tokens here, in order to keep the grammar LALR(1).
*
* Using a filter is simpler than trying to recognize multiword tokens
* directly in scan.l, because we'd have to allow for comments between the
* words. Furthermore it's not clear how to do that without re-introducing
* scanner backtrack, which would cost more performance than this filter
* layer does.
*
* The filter also provides a convenient place to translate between
* the core_YYSTYPE and YYSTYPE representations (which are really the
* same thing anyway, but notationally they're different).
*/
int
base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
{
base_yy_extra_type *yyextra = pg_yyget_extra(yyscanner);
int cur_token;
int next_token;
int cur_token_length;
YYLTYPE cur_yylloc;
/* Get next token --- we might already have it */
if (yyextra->have_lookahead)
{
cur_token = yyextra->lookahead_token;
lvalp->core_yystype = yyextra->lookahead_yylval;
*llocp = yyextra->lookahead_yylloc;
*(yyextra->lookahead_end) = yyextra->lookahead_hold_char;
yyextra->have_lookahead = false;
}
else
cur_token = core_yylex(&(lvalp->core_yystype), llocp, yyscanner);
/*
* If this token isn't one that requires lookahead, just return it. If it
* does, determine the token length. (We could get that via strlen(), but
* since we have such a small set of possibilities, hardwiring seems
* feasible and more efficient.)
*/
switch (cur_token)
{
case NOT:
cur_token_length = 3;
break;
case NULLS_P:
cur_token_length = 5;
break;
case WITH:
cur_token_length = 4;
break;
default:
return cur_token;
}
/*
* Identify end+1 of current token. core_yylex() has temporarily stored a
* '\0' here, and will undo that when we call it again. We need to redo
* it to fully revert the lookahead call for error reporting purposes.
*/
yyextra->lookahead_end = yyextra->core_yy_extra.scanbuf +
*llocp + cur_token_length;
Assert(*(yyextra->lookahead_end) == '\0');
/*
* Save and restore *llocp around the call. It might look like we could
* avoid this by just passing &lookahead_yylloc to core_yylex(), but that
* does not work because flex actually holds onto the last-passed pointer
* internally, and will use that for error reporting. We need any error
* reports to point to the current token, not the next one.
*/
cur_yylloc = *llocp;
/* Get next token, saving outputs into lookahead variables */
next_token = core_yylex(&(yyextra->lookahead_yylval), llocp, yyscanner);
yyextra->lookahead_token = next_token;
yyextra->lookahead_yylloc = *llocp;
*llocp = cur_yylloc;
/* Now revert the un-truncation of the current token */
yyextra->lookahead_hold_char = *(yyextra->lookahead_end);
*(yyextra->lookahead_end) = '\0';
yyextra->have_lookahead = true;
/* Replace cur_token if needed, based on lookahead */
switch (cur_token)
{
case NOT:
/* Replace NOT by NOT_LA if it's followed by BETWEEN, IN, etc */
switch (next_token)
{
case BETWEEN:
case IN_P:
case LIKE:
case ILIKE:
case SIMILAR:
cur_token = NOT_LA;
break;
}
break;
case NULLS_P:
/* Replace NULLS_P by NULLS_LA if it's followed by FIRST or LAST */
switch (next_token)
{
case FIRST_P:
case LAST_P:
cur_token = NULLS_LA;
break;
}
break;
case WITH:
/* Replace WITH by WITH_LA if it's followed by TIME or ORDINALITY */
switch (next_token)
{
case TIME:
case ORDINALITY:
cur_token = WITH_LA;
break;
}
break;
}
return cur_token;
}
| apache-2.0 |
kevinshine/BeyondMediaPlayer | ijkplayer-armv7a/src/main/jni/ijkmedia/ijksdl/gles2/common.c | 9 | 2001 | /*
* copyright (c) 2016 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "internal.h"
void IJK_GLES2_checkError(const char* op) {
for (GLint error = glGetError(); error; error = glGetError()) {
ALOGE("[GLES2] after %s() glError (0x%x)\n", op, error);
}
}
void IJK_GLES2_printString(const char *name, GLenum s) {
const char *v = (const char *) glGetString(s);
ALOGI("[GLES2] %s = %s\n", name, v);
}
void IJK_GLES2_loadOrtho(IJK_GLES_Matrix *matrix, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far)
{
GLfloat r_l = right - left;
GLfloat t_b = top - bottom;
GLfloat f_n = far - near;
GLfloat tx = - (right + left) / (right - left);
GLfloat ty = - (top + bottom) / (top - bottom);
GLfloat tz = - (far + near) / (far - near);
matrix->m[0] = 2.0f / r_l;
matrix->m[1] = 0.0f;
matrix->m[2] = 0.0f;
matrix->m[3] = 0.0f;
matrix->m[4] = 0.0f;
matrix->m[5] = 2.0f / t_b;
matrix->m[6] = 0.0f;
matrix->m[7] = 0.0f;
matrix->m[8] = 0.0f;
matrix->m[9] = 0.0f;
matrix->m[10] = -2.0f / f_n;
matrix->m[11] = 0.0f;
matrix->m[12] = tx;
matrix->m[13] = ty;
matrix->m[14] = tz;
matrix->m[15] = 1.0f;
}
| apache-2.0 |
hornn/interviews | src/backend/cdb/cdbmetadatacache_process.c | 9 | 14952 | #include <unistd.h>
#include "postgres.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "utils/palloc.h"
#include "storage/fd.h"
#include "storage/relfilenode.h"
#include "catalog/catalog.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_tablespace.h"
#include "catalog/pg_database.h"
#include "cdb/cdbsharedoidsearch.h"
#include "cdb/cdbdirectopen.h"
#include "cdb/cdbvars.h"
#include "storage/itemptr.h"
#include "utils/hsearch.h"
#include "storage/shmem.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/aomd.h"
#include "access/transam.h"
#include "utils/guc.h"
#include "storage/smgr.h"
#include "storage/ipc.h"
#include "storage/proc.h"
#include "storage/pmsignal.h" /* PostmasterIsAlive */
#include "storage/sinvaladt.h"
#include "utils/builtins.h"
#include "utils/faultinjector.h"
#include "commands/tablespace.h"
#include "commands/dbcommands.h"
#include "cdb/cdbmetadatacache.h"
#include "tcop/tcopprot.h" /* quickdie() */
#include "storage/backendid.h"
#include "postmaster/fork_process.h"
#include "postmaster/postmaster.h"
#include "utils/ps_status.h"
#include "libpq/pqsignal.h"
#include "utils/memutils.h"
#include "funcapi.h"
#include "fmgr.h"
#include "utils/builtins.h"
/*
* Metadata Cache Process Functions
*/
static void
RequestShutdown(SIGNAL_ARGS);
static void
InitMetadataCacheMemoryContext(void);
static void
MetadataCacheServerLoop(void);
static void
GenerateMetadataCacheLRUList(void);
static void
GenerateMetadataCacheRefreshList(void);
static void
ProcessMetadataCacheCheck(void);
static void
ProcessMetadataCacheRefresh(void);
static int
CompareMetadataCacheEntryByLastAccessTime(const void *e1, const void *e2);
extern bool
FindMyDatabase(const char *name, Oid *db_id, Oid *db_tablespace);
static MemoryContext MetadataCacheMemoryContext = NULL;
List *MetadataCacheLRUList = NULL;
List *MetadataCacheRefreshList = NULL;
static volatile bool shutdown_requested = false;
static char *probeDatabase = "template1";
/*
*Main entry point for metadata cache process.
*/
int
metadatacache_start(void)
{
pid_t MetadataCachePID;
switch ((MetadataCachePID = fork_process()))
{
case -1:
ereport(LOG, (errmsg("could not fork metadata cache process")));
return 0;
case 0:
/* in postmaster child ... */
/* Close the postmaster's sockets */
ClosePostmasterPorts(false);
MetadataCacheMain(0, NULL);
return 0;
default:
return (int)MetadataCachePID;
}
}
void
RequestShutdown(SIGNAL_ARGS)
{
shutdown_requested = true;
}
/*
* MetadataCacheMain
*/
void
MetadataCacheMain(int argc, char *argv[])
{
sigjmp_buf local_sigjmp_buf;
char *fullpath;
IsUnderPostmaster = true;
/* reset MyProcPid */
MyProcPid = getpid();
/* Lose the postmaster's on-exit routines */
on_exit_reset();
/* Identify myself via ps */
init_ps_display("DFS Metadata Cache process", "", "", "");
SetProcessingMode(InitProcessing);
/*
* Set up signal handlers. We operate on databases much like a regular
* backend, so we use the same signal handling. See equivalent code in
* tcop/postgres.c.
*
* Currently, we don't pay attention to postgresql.conf changes that
* happen during a single daemon iteration, so we can ignore SIGHUP.
*/
pqsignal(SIGHUP, SIG_IGN);
/*
* Presently, SIGINT will lead to autovacuum shutdown, because that's how
* we handle ereport(ERROR). It could be improved however.
*/
pqsignal(SIGINT, SIG_IGN);
pqsignal(SIGTERM, die);
pqsignal(SIGQUIT, quickdie); /* we don't do any ftsprobe specific cleanup, just use the standard. */
pqsignal(SIGALRM, handle_sig_alarm);
pqsignal(SIGPIPE, SIG_IGN);
pqsignal(SIGUSR1, SIG_IGN);
/* We don't listen for async notifies */
pqsignal(SIGUSR2, RequestShutdown);
pqsignal(SIGFPE, FloatExceptionHandler);
pqsignal(SIGCHLD, SIG_DFL);
/* Early initialization */
BaseInit();
/* See InitPostgres()... */
InitProcess();
InitBufferPoolBackend();
InitXLOGAccess();
SetProcessingMode(NormalProcessing);
/*
* If an exception is encountered, processing resumes here.
*
* See notes in postgres.c about the design of this coding.
*/
if (sigsetjmp(local_sigjmp_buf, 1) != 0)
{
/* Prevents interrupts while cleaning up */
HOLD_INTERRUPTS();
/* Report the error to the server log */
EmitErrorReport();
/*
* We can now go away. Note that because we'll call InitProcess, a
* callback will be registered to do ProcKill, which will clean up
* necessary state.
*/
proc_exit(0);
}
/* We can now handle ereport(ERROR) */
PG_exception_stack = &local_sigjmp_buf;
PG_SETMASK(&UnBlockSig);
MyDatabaseId = TemplateDbOid;
MyDatabaseTableSpace = DEFAULTTABLESPACE_OID;
if (!FindMyDatabase(probeDatabase, &MyDatabaseId, &MyDatabaseTableSpace))
ereport(FATAL, (errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database 'postgres' does not exist")));
fullpath = GetDatabasePath(MyDatabaseId, MyDatabaseTableSpace);
SetDatabasePath(fullpath);
/*
* Finish filling in the PGPROC struct, and add it to the ProcArray. (We
* need to know MyDatabaseId before we can do this, since it's entered
* into the PGPROC struct.)
*
* Once I have done this, I am visible to other backends!
*/
InitProcessPhase2();
/*
* Initialize my entry in the shared-invalidation manager's array of
* per-backend data.
*
* Sets up MyBackendId, a unique backend identifier.
*/
MyBackendId = InvalidBackendId;
SharedInvalBackendInit(false);
if (MyBackendId > MaxBackends || MyBackendId <= 0)
elog(FATAL, "bad backend id: %d", MyBackendId);
/*
* bufmgr needs another initialization call too
*/
InitBufferPoolBackend();
InitMetadataCacheMemoryContext();
MemoryContextSwitchTo(MetadataCacheMemoryContext);
/* main loop */
MetadataCacheServerLoop();
/* One iteration done, go away */
proc_exit(0);
}
void
MetadataCacheServerLoop(void)
{
uint32_t probe_start_time;
int check_times = 0;
while (true)
{
if (shutdown_requested)
break;
/* no need to live on if postmaster has died */
if (!PostmasterIsAlive(true))
exit(1);
probe_start_time = time(NULL);
// check time
elog(DEBUG1, "[MetadataCache] Metadata Cache Process Check Time. time:%u", probe_start_time);
ProcessMetadataCacheCheck();
if (check_times >= metadata_cache_refresh_interval / metadata_cache_check_interval)
{
// refresh
elog(DEBUG1, "Metadata Cache Process Refresh Time. time:%u", probe_start_time);
check_times = 0;
ProcessMetadataCacheRefresh();
}
else
{
/* check if we need to sleep before starting next iteration */
pg_usleep(metadata_cache_check_interval * USECS_PER_SEC);
check_times++;
}
}
}
void
InitMetadataCacheMemoryContext(void)
{
if (MetadataCacheMemoryContext == NULL)
{
MetadataCacheMemoryContext = AllocSetContextCreate(TopMemoryContext,
"MetadataCacheMemoryContext",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
}
else
{
MemoryContextResetAndDeleteChildren(MetadataCacheMemoryContext);
}
return;
}
void
GenerateMetadataCacheLRUList()
{
HASH_SEQ_STATUS hstat;
MetadataCacheEntry *entry;
long cache_entry_num = hash_get_num_entries(MetadataCache);
LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
if (MetadataCacheLRUList)
{
list_free_deep(MetadataCacheLRUList);
MetadataCacheLRUList = NULL;
}
MetadataCacheEntry** entry_vector = (MetadataCacheEntry**)palloc(sizeof(MetadataCacheEntry*) * cache_entry_num);
int i=0;
hash_seq_init(&hstat, MetadataCache);
while ((entry = (MetadataCacheEntry *)hash_seq_search(&hstat)) != NULL)
{
entry_vector[i++] = entry;
}
qsort(entry_vector, cache_entry_num, sizeof(MetadataCacheEntry*), CompareMetadataCacheEntryByLastAccessTime);
for (i=0;i<cache_entry_num;i++)
{
MetadataCacheCheckInfo *check_info = (MetadataCacheCheckInfo *)palloc(sizeof(MetadataCacheCheckInfo));
check_info->key = entry_vector[i]->key;
check_info->file_size = entry_vector[i]->file_size;
check_info->block_num = entry_vector[i]->block_num;
check_info->create_time = entry_vector[i]->create_time;
check_info->last_access_time = entry_vector[i]->last_access_time;
MetadataCacheLRUList = lappend(MetadataCacheLRUList, check_info);
}
pfree(entry_vector);
LWLockRelease(MetadataCacheLock);
}
void
GenerateMetadataCacheRefreshList()
{
HASH_SEQ_STATUS hstat;
MetadataCacheEntry *entry;
uint32_t cur_time = time(NULL);
if (MetadataCacheRefreshList)
{
list_free_deep(MetadataCacheRefreshList);
MetadataCacheRefreshList = NULL;
}
LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
hash_seq_init(&hstat, MetadataCache);
while ((entry = (MetadataCacheEntry *)hash_seq_search(&hstat)) != NULL)
{
if (cur_time - entry->create_time >= metadata_cache_refresh_timeout)
{
MetadataCacheCheckInfo *refresh_info = (MetadataCacheCheckInfo *)palloc(sizeof(MetadataCacheCheckInfo));
refresh_info->key = entry->key;
refresh_info->file_size = entry->file_size;
refresh_info->block_num = entry->block_num;
refresh_info->create_time = entry->create_time;
refresh_info->last_access_time = entry->last_access_time;
MetadataCacheRefreshList = lappend(MetadataCacheRefreshList, refresh_info);
if (list_length(MetadataCacheRefreshList) >= metadata_cache_refresh_max_num)
{
break;
}
}
}
LWLockRelease(MetadataCacheLock);
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheRefresh, get refresh list:%d", list_length(MetadataCacheRefreshList));
}
void
ProcessMetadataCacheCheck()
{
ListCell *lc;
RelFileNode rnode;
HdfsFileInfo *file_info;
double free_block_ratio = (FREE_BLOCK_NUM * 1.0) / metadata_cache_block_capacity;
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheCheck free_block_ratio:%f", free_block_ratio);
if (free_block_ratio < metadata_cache_free_block_max_ratio)
{
if (NULL == MetadataCacheLRUList)
{
GenerateMetadataCacheLRUList();
}
int total_remove_files = 0;
LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
foreach(lc, MetadataCacheLRUList)
{
MetadataCacheCheckInfo *check_info = (MetadataCacheCheckInfo *)lfirst(lc);
rnode.spcNode = check_info->key.tablespace_oid;
rnode.dbNode = check_info->key.database_oid;
rnode.relNode = check_info->key.relation_oid;
file_info = CreateHdfsFileInfo(rnode, check_info->key.segno);
RemoveHdfsFileBlockLocations(file_info);
DestroyHdfsFileInfo(file_info);
total_remove_files++;
if (((FREE_BLOCK_NUM * 1.0) / metadata_cache_block_capacity) >= metadata_cache_free_block_normal_ratio)
{
break;
}
}
list_free_deep(MetadataCacheLRUList);
MetadataCacheLRUList = NULL;
LWLockRelease(MetadataCacheLock);
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheCheck, total remove files:%d", total_remove_files);
}
}
void
ProcessMetadataCacheRefresh()
{
ListCell *lc;
BlockLocation *hdfs_locations;
int block_num;
if (NULL == MetadataCacheRefreshList)
{
GenerateMetadataCacheRefreshList();
}
foreach(lc, MetadataCacheRefreshList)
{
MetadataCacheCheckInfo *refresh_file = (MetadataCacheCheckInfo *)lfirst(lc);
RelFileNode rnode;
rnode.spcNode = refresh_file->key.tablespace_oid;
rnode.dbNode = refresh_file->key.database_oid;
rnode.relNode = refresh_file->key.relation_oid;
HdfsFileInfo *file_info = CreateHdfsFileInfo(rnode, refresh_file->key.segno);
hdfs_locations = HdfsGetFileBlockLocations(file_info->filepath, refresh_file->file_size, &block_num);
LWLockAcquire(MetadataCacheLock, LW_EXCLUSIVE);
if (!hdfs_locations)
{
// error file, delete
RemoveHdfsFileBlockLocations(file_info);
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheRefresh remove filename:%s filesize:"INT64_FORMAT" block_num:%d",
file_info->filepath,
refresh_file->file_size,
block_num);
}
else
{
// fetch ok, update
RemoveHdfsFileBlockLocations(file_info);
if (NULL == MetadataCacheNew(file_info, refresh_file->file_size, hdfs_locations, block_num))
{
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheRefresh update fail, filename:%s filesize:"INT64_FORMAT" block_num:%d",
file_info->filepath,
refresh_file->file_size,
block_num);
}
else
{
elog(DEBUG1, "[MetadataCache] ProcessMetadataCacheRefresh update filename:%s filesize:"INT64_FORMAT" block_num:%d",
file_info->filepath,
refresh_file->file_size,
block_num);
}
HdfsFreeFileBlockLocations(hdfs_locations, block_num);
}
LWLockRelease(MetadataCacheLock);
DestroyHdfsFileInfo(file_info);
}
}
int
CompareMetadataCacheEntryByLastAccessTime(const void *e1, const void *e2)
{
MetadataCacheEntry **ce1 = (MetadataCacheEntry**)e1;
MetadataCacheEntry **ce2 = (MetadataCacheEntry**)e2;
if ((*ce1)->last_access_time < (*ce2)->last_access_time)
{
return -1;
}
if ((*ce1)->last_access_time > (*ce2)->last_access_time)
{
return 1;
}
return 0;
}
| apache-2.0 |
LogInsight/fluent-bit | lib/monkey/plugins/mandril/mandril.c | 10 | 12023 | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Monkey HTTP Server
* ==================
* Copyright 2001-2015 Monkey Software LLC <eduardo@monkey.io>
* Copyright 2012, Sonny Karlsson
*
* 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.
*/
/* Monkey API */
#include <monkey/mk_api.h>
/* system */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include "mandril.h"
static struct mk_rconf *conf;
/* Read database configuration parameters */
static int mk_security_conf(char *confdir)
{
int n;
int ret = 0;
unsigned long len;
char *conf_path = NULL;
char *_net, *_mask;
struct mk_secure_ip_t *new_ip;
struct mk_secure_url_t *new_url;
struct mk_secure_deny_hotlink_t *new_deny_hotlink;
struct mk_rconf_section *section;
struct mk_rconf_entry *entry;
struct mk_list *head;
/* Read configuration */
mk_api->str_build(&conf_path, &len, "%s/mandril.conf", confdir);
conf = mk_api->config_create(conf_path);
if (!conf) {
return -1;
}
section = mk_api->config_section_get(conf, "RULES");
if (!section) {
return -1;
}
mk_list_foreach(head, §ion->entries) {
entry = mk_list_entry(head, struct mk_rconf_entry, _head);
/* Passing to internal struct */
if (strcasecmp(entry->key, "IP") == 0) {
new_ip = mk_api->mem_alloc(sizeof(struct mk_secure_ip_t));
n = mk_api->str_search(entry->val, "/", 1);
/* subnet */
if (n > 0) {
/* split network addr and netmask */
_net = mk_api->str_copy_substr(entry->val, 0, n);
_mask = mk_api->str_copy_substr(entry->val,
n + 1,
strlen(entry->val));
/* validations... */
if (!_net || !_mask) {
mk_warn("Mandril: cannot parse entry '%s' in RULES section",
entry->val);
goto ip_next;
}
/* convert ip string to network address */
if (inet_aton(_net, &new_ip->ip) == 0) {
mk_warn("Mandril: invalid ip address '%s' in RULES section",
entry->val);
goto ip_next;
}
/* parse mask */
new_ip->netmask = strtol(_mask, (char **) NULL, 10);
if (new_ip->netmask <= 0 || new_ip->netmask >= 32) {
mk_warn("Mandril: invalid mask value '%s' in RULES section",
entry->val);
goto ip_next;
}
/* complete struct data */
new_ip->is_subnet = MK_TRUE;
new_ip->network = MK_NET_NETWORK(new_ip->ip.s_addr, new_ip->netmask);
new_ip->hostmin = MK_NET_HOSTMIN(new_ip->ip.s_addr, new_ip->netmask);
new_ip->hostmax = MK_NET_HOSTMAX(new_ip->ip.s_addr, new_ip->netmask);
/* link node with main list */
mk_list_add(&new_ip->_head, &mk_secure_ip);
/*
* I know, you were instructed to hate 'goto' statements!, ok, show this
* code to your teacher and let him blame :P
*/
ip_next:
if (_net) {
mk_api->mem_free(_net);
}
if (_mask) {
mk_api->mem_free(_mask);
}
}
else { /* normal IP address */
/* convert ip string to network address */
if (inet_aton(entry->val, &new_ip->ip) == 0) {
mk_warn("Mandril: invalid ip address '%s' in RULES section",
entry->val);
}
else {
new_ip->is_subnet = MK_FALSE;
mk_list_add(&new_ip->_head, &mk_secure_ip);
}
}
}
else if (strcasecmp(entry->key, "URL") == 0) {
/* simple allcotion and data association */
new_url = mk_api->mem_alloc(sizeof(struct mk_secure_url_t));
new_url->criteria = entry->val;
/* link node with main list */
mk_list_add(&new_url->_head, &mk_secure_url);
}
else if (strcasecmp(entry->key, "deny_hotlink") == 0) {
new_deny_hotlink = mk_api->mem_alloc(sizeof(*new_deny_hotlink));
new_deny_hotlink->criteria = entry->val;
mk_list_add(&new_deny_hotlink->_head, &mk_secure_deny_hotlink);
}
}
mk_api->mem_free(conf_path);
return ret;
}
static int mk_security_check_ip(int socket)
{
int network;
struct mk_secure_ip_t *entry;
struct mk_list *head;
struct in_addr *addr;
struct sockaddr_in addr_t;
socklen_t len = sizeof(addr_t);
if (getpeername(socket, (struct sockaddr *) &addr_t, &len) != 0) {
perror("getpeername");
return -1;
}
addr = &(addr_t).sin_addr;
PLUGIN_TRACE("[FD %i] Mandril validating IP address", socket);
mk_list_foreach(head, &mk_secure_ip) {
entry = mk_list_entry(head, struct mk_secure_ip_t, _head);
if (entry->is_subnet == MK_TRUE) {
/* Validate network */
network = MK_NET_NETWORK(addr->s_addr, entry->netmask);
if (network != entry->network) {
continue;
}
/* Validate host range */
if (addr->s_addr <= entry->hostmax && addr->s_addr >= entry->hostmin) {
PLUGIN_TRACE("[FD %i] Mandril closing by rule in ranges", socket);
return -1;
}
}
else {
if (addr->s_addr == entry->ip.s_addr) {
PLUGIN_TRACE("[FD %i] Mandril closing by rule in IP match", socket);
return -1;
}
}
}
return 0;
}
/* Check if the incoming URL is restricted for some rule */
static int mk_security_check_url(mk_ptr_t url)
{
int n;
struct mk_list *head;
struct mk_secure_url_t *entry;
mk_list_foreach(head, &mk_secure_url) {
entry = mk_list_entry(head, struct mk_secure_url_t, _head);
n = mk_api->str_search_n(url.data, entry->criteria, MK_STR_INSENSITIVE, url.len);
if (n >= 0) {
return -1;
}
}
return 0;
}
mk_ptr_t parse_referer_host(struct mk_http_header *header)
{
unsigned int i, beginHost, endHost;
mk_ptr_t host;
host.data = NULL;
host.len = 0;
// Find end of "protocol://"
for (i = 0; i < header->val.len && !(header->val.data[i] == '/' && header->val.data[i+1] == '/'); i++);
if (i == header->val.len) {
goto error;
}
beginHost = i + 2;
// Find end of any "user:password@"
for (; i < header->val.len && header->val.data[i] != '@'; i++);
if (i < header->val.len) {
beginHost = i + 1;
}
// Find end of "host", (beginning of :port or /path)
for (i = beginHost; i < header->val.len && header->val.data[i] != ':' && header->val.data[i] != '/'; i++);
endHost = i;
host.data = header->val.data + beginHost;
host.len = endHost - beginHost;
return host;
error:
host.data = NULL;
host.len = 0;
return host;
}
static int mk_security_check_hotlink(mk_ptr_t url, mk_ptr_t host,
struct mk_http_header *referer)
{
mk_ptr_t ref_host = parse_referer_host(referer);
unsigned int domains_matched = 0;
int i = 0;
const char *curA, *curB;
struct mk_list *head;
struct mk_secure_deny_hotlink_t *entry;
if (ref_host.data == NULL) {
return 0;
}
else if (host.data == NULL) {
mk_err("No host data.");
return -1;
}
mk_list_foreach(head, &mk_secure_url) {
entry = mk_list_entry(head, struct mk_secure_deny_hotlink_t, _head);
i = mk_api->str_search_n(url.data, entry->criteria, MK_STR_INSENSITIVE, url.len);
if (i >= 0) {
break;
}
}
if (i < 0) {
return 0;
}
curA = host.data + host.len;
curB = ref_host.data + ref_host.len;
// Match backwards from root domain.
while (curA > host.data && curB > ref_host.data) {
i++;
curA--;
curB--;
if ((*curA == '.' && *curB == '.') ||
curA == host.data || curB == ref_host.data) {
if (i < 1) {
break;
}
else if (curA == host.data &&
!(curB == ref_host.data || *(curB - 1) == '.')) {
break;
}
else if (curB == ref_host.data &&
!(curA == host.data || *(curA - 1) == '.')) {
break;
}
else if (strncasecmp(curA, curB, i)) {
break;
}
domains_matched += 1;
i = 0;
}
}
// Block connection if none or only top domain matched.
return domains_matched >= 2 ? 0 : -1;
}
int mk_mandril_plugin_init(struct plugin_api **api, char *confdir)
{
mk_api = *api;
/* Init security lists */
mk_list_init(&mk_secure_ip);
mk_list_init(&mk_secure_url);
mk_list_init(&mk_secure_deny_hotlink);
/* Read configuration */
mk_security_conf(confdir);
return 0;
}
int mk_mandril_plugin_exit()
{
return 0;
}
int mk_mandril_stage10(int socket)
{
/* Validate ip address with Mandril rules */
if (mk_security_check_ip(socket) != 0) {
PLUGIN_TRACE("[FD %i] Mandril close connection", socket);
return MK_PLUGIN_RET_CLOSE_CONX;
}
return MK_PLUGIN_RET_CONTINUE;
}
int mk_mandril_stage30(struct mk_plugin *p,
struct mk_http_session *cs,
struct mk_http_request *sr,
int n_params,
struct mk_list *params)
{
(void) p;
(void) cs;
(void) n_params;
(void) params;
struct mk_http_header *header;
PLUGIN_TRACE("[FD %i] Mandril validating URL", cs->socket);
if (mk_security_check_url(sr->uri_processed) < 0) {
PLUGIN_TRACE("[FD %i] Close connection, blocked URL", cs->socket);
mk_api->header_set_http_status(sr, MK_CLIENT_FORBIDDEN);
return MK_PLUGIN_RET_CLOSE_CONX;
}
PLUGIN_TRACE("[FD %d] Mandril validating hotlinking", cs->socket);
header = mk_api->header_get(MK_HEADER_REFERER, sr, NULL, 0);
if (mk_security_check_hotlink(sr->uri_processed, sr->host, header) < 0) {
PLUGIN_TRACE("[FD %i] Close connection, deny hotlinking.", cs->socket);
mk_api->header_set_http_status(sr, MK_CLIENT_FORBIDDEN);
return MK_PLUGIN_RET_CLOSE_CONX;
}
return MK_PLUGIN_RET_NOT_ME;
}
struct mk_plugin_stage mk_plugin_stage_mandril = {
.stage10 = &mk_mandril_stage10,
.stage30 = &mk_mandril_stage30
};
struct mk_plugin mk_plugin_mandril = {
/* Identification */
.shortname = "mandril",
.name = "Mandril Security",
.version = MK_VERSION_STR,
.hooks = MK_PLUGIN_STAGE,
/* Init / Exit */
.init_plugin = mk_mandril_plugin_init,
.exit_plugin = mk_mandril_plugin_exit,
/* Init Levels */
.master_init = NULL,
.worker_init = NULL,
/* Type */
.stage = &mk_plugin_stage_mandril
};
| apache-2.0 |
Transtech/omim | drape/texture.cpp | 10 | 2159 | #include "drape/texture.hpp"
#include "drape/glfunctions.hpp"
#include "drape/glextensions_list.hpp"
#include "drape/utils/gpu_mem_tracker.hpp"
#include "base/math.hpp"
#define ASSERT_ID ASSERT(GetID() != -1, ())
namespace dp
{
Texture::ResourceInfo::ResourceInfo(m2::RectF const & texRect)
: m_texRect(texRect) {}
m2::RectF const & Texture::ResourceInfo::GetTexRect() const
{
return m_texRect;
}
//////////////////////////////////////////////////////////////////
Texture::Texture()
{
}
Texture::~Texture()
{
Destroy();
}
void Texture::Create(Params const & params)
{
if (AllocateTexture(params.m_allocator))
m_hwTexture->Create(params);
}
void Texture::Create(Params const & params, ref_ptr<void> data)
{
if (AllocateTexture(params.m_allocator))
m_hwTexture->Create(params, data);
}
void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
{
ASSERT(m_hwTexture != nullptr, ());
m_hwTexture->UploadData(x, y, width, height, data);
}
TextureFormat Texture::GetFormat() const
{
ASSERT(m_hwTexture != nullptr, ());
return m_hwTexture->GetFormat();
}
uint32_t Texture::GetWidth() const
{
ASSERT(m_hwTexture != nullptr, ());
return m_hwTexture->GetWidth();
}
uint32_t Texture::GetHeight() const
{
ASSERT(m_hwTexture != nullptr, ());
return m_hwTexture->GetHeight();
}
float Texture::GetS(uint32_t x) const
{
ASSERT(m_hwTexture != nullptr, ());
return m_hwTexture->GetS(x);
}
float Texture::GetT(uint32_t y) const
{
ASSERT(m_hwTexture != nullptr, ());
return m_hwTexture->GetT(y);
}
void Texture::Bind() const
{
ASSERT(m_hwTexture != nullptr, ());
m_hwTexture->Bind();
}
void Texture::SetFilter(glConst filter)
{
ASSERT(m_hwTexture != nullptr, ());
m_hwTexture->SetFilter(filter);
}
uint32_t Texture::GetMaxTextureSize()
{
return GLFunctions::glGetInteger(gl_const::GLMaxTextureSize);
}
void Texture::Destroy()
{
m_hwTexture.reset();
}
bool Texture::AllocateTexture(ref_ptr<HWTextureAllocator> allocator)
{
if (allocator != nullptr)
{
m_hwTexture = allocator->CreateTexture();
return true;
}
return false;
}
} // namespace dp
| apache-2.0 |
lisakowen/gpdb | src/backend/gporca/libnaucrates/src/parser/CParseHandlerDistinctComp.cpp | 10 | 4299 | //---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2011 Greenplum, Inc.
//
// @filename:
// CParseHandlerDistinctComp.cpp
//
// @doc:
// Implementation of the SAX parse handler class for parsing distinct
// comparison operators.
//---------------------------------------------------------------------------
#include "naucrates/dxl/parser/CParseHandlerDistinctComp.h"
#include "naucrates/dxl/operators/CDXLOperatorFactory.h"
#include "naucrates/dxl/parser/CParseHandlerFactory.h"
#include "naucrates/dxl/parser/CParseHandlerScalarOp.h"
using namespace gpdxl;
XERCES_CPP_NAMESPACE_USE
//---------------------------------------------------------------------------
// @function:
// CParseHandlerDistinctComp::CParseHandlerDistinctComp
//
// @doc:
// Constructor
//
//---------------------------------------------------------------------------
CParseHandlerDistinctComp::CParseHandlerDistinctComp(
CMemoryPool *mp, CParseHandlerManager *parse_handler_mgr,
CParseHandlerBase *parse_handler_root)
: CParseHandlerScalarOp(mp, parse_handler_mgr, parse_handler_root),
m_dxl_op(nullptr)
{
}
//---------------------------------------------------------------------------
// @function:
// CParseHandlerDistinctComp::StartElement
//
// @doc:
// Processes a Xerces start element event
//
//---------------------------------------------------------------------------
void
CParseHandlerDistinctComp::StartElement(const XMLCh *const, // element_uri,
const XMLCh *const element_local_name,
const XMLCh *const, // element_qname
const Attributes &attrs)
{
if (0 != XMLString::compareString(
CDXLTokens::XmlstrToken(EdxltokenScalarDistinctComp),
element_local_name))
{
CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(
m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag,
str->GetBuffer());
}
// parse and create distinct operator
m_dxl_op =
(CDXLScalarDistinctComp *) CDXLOperatorFactory::MakeDXLDistinctCmp(
m_parse_handler_mgr->GetDXLMemoryManager(), attrs);
// create and activate the parse handler for the children nodes in reverse
// order of their expected appearance
// parse handler for right scalar node
CParseHandlerBase *right_child_parse_handler =
CParseHandlerFactory::GetParseHandler(
m_mp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_parse_handler_mgr,
this);
m_parse_handler_mgr->ActivateParseHandler(right_child_parse_handler);
// parse handler for left scalar node
CParseHandlerBase *left_child_parse_handler =
CParseHandlerFactory::GetParseHandler(
m_mp, CDXLTokens::XmlstrToken(EdxltokenScalar), m_parse_handler_mgr,
this);
m_parse_handler_mgr->ActivateParseHandler(left_child_parse_handler);
// store parse handlers
this->Append(left_child_parse_handler);
this->Append(right_child_parse_handler);
}
//---------------------------------------------------------------------------
// @function:
// CParseHandlerDistinctComp::EndElement
//
// @doc:
// Processes a Xerces end element event
//
//---------------------------------------------------------------------------
void
CParseHandlerDistinctComp::EndElement(const XMLCh *const, // element_uri,
const XMLCh *const element_local_name,
const XMLCh *const // element_qname
)
{
if (0 != XMLString::compareString(
CDXLTokens::XmlstrToken(EdxltokenScalarDistinctComp),
element_local_name))
{
CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(
m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag,
str->GetBuffer());
}
// construct node from the created child nodes
m_dxl_node = GPOS_NEW(m_mp) CDXLNode(m_mp, m_dxl_op);
CParseHandlerScalarOp *left_child_parse_handler =
dynamic_cast<CParseHandlerScalarOp *>((*this)[0]);
CParseHandlerScalarOp *right_child_parse_handler =
dynamic_cast<CParseHandlerScalarOp *>((*this)[1]);
// add constructed children
AddChildFromParseHandler(left_child_parse_handler);
AddChildFromParseHandler(right_child_parse_handler);
// deactivate handler
m_parse_handler_mgr->DeactivateHandler();
}
// EOF
| apache-2.0 |
Ant-Droid/android_kernel_moto_shamu_OLD | lib/raid6/algos.c | 2314 | 5151 | /* -*- linux-c -*- ------------------------------------------------------- *
*
* Copyright 2002 H. Peter Anvin - All Rights Reserved
*
* 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, Inc., 53 Temple Place Ste 330,
* Boston MA 02111-1307, USA; either version 2 of the License, or
* (at your option) any later version; incorporated herein by reference.
*
* ----------------------------------------------------------------------- */
/*
* raid6/algos.c
*
* Algorithm list and algorithm selection for RAID-6
*/
#include <linux/raid/pq.h>
#ifndef __KERNEL__
#include <sys/mman.h>
#include <stdio.h>
#else
#include <linux/module.h>
#include <linux/gfp.h>
#if !RAID6_USE_EMPTY_ZERO_PAGE
/* In .bss so it's zeroed */
const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
EXPORT_SYMBOL(raid6_empty_zero_page);
#endif
#endif
struct raid6_calls raid6_call;
EXPORT_SYMBOL_GPL(raid6_call);
const struct raid6_calls * const raid6_algos[] = {
#if defined(__ia64__)
&raid6_intx16,
&raid6_intx32,
#endif
#if defined(__i386__) && !defined(__arch_um__)
&raid6_mmxx1,
&raid6_mmxx2,
&raid6_sse1x1,
&raid6_sse1x2,
&raid6_sse2x1,
&raid6_sse2x2,
#ifdef CONFIG_AS_AVX2
&raid6_avx2x1,
&raid6_avx2x2,
#endif
#endif
#if defined(__x86_64__) && !defined(__arch_um__)
&raid6_sse2x1,
&raid6_sse2x2,
&raid6_sse2x4,
#ifdef CONFIG_AS_AVX2
&raid6_avx2x1,
&raid6_avx2x2,
&raid6_avx2x4,
#endif
#endif
#ifdef CONFIG_ALTIVEC
&raid6_altivec1,
&raid6_altivec2,
&raid6_altivec4,
&raid6_altivec8,
#endif
&raid6_intx1,
&raid6_intx2,
&raid6_intx4,
&raid6_intx8,
NULL
};
void (*raid6_2data_recov)(int, size_t, int, int, void **);
EXPORT_SYMBOL_GPL(raid6_2data_recov);
void (*raid6_datap_recov)(int, size_t, int, void **);
EXPORT_SYMBOL_GPL(raid6_datap_recov);
const struct raid6_recov_calls *const raid6_recov_algos[] = {
#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
#ifdef CONFIG_AS_AVX2
&raid6_recov_avx2,
#endif
&raid6_recov_ssse3,
#endif
&raid6_recov_intx1,
NULL
};
#ifdef __KERNEL__
#define RAID6_TIME_JIFFIES_LG2 4
#else
/* Need more time to be stable in userspace */
#define RAID6_TIME_JIFFIES_LG2 9
#define time_before(x, y) ((x) < (y))
#endif
static inline const struct raid6_recov_calls *raid6_choose_recov(void)
{
const struct raid6_recov_calls *const *algo;
const struct raid6_recov_calls *best;
for (best = NULL, algo = raid6_recov_algos; *algo; algo++)
if (!best || (*algo)->priority > best->priority)
if (!(*algo)->valid || (*algo)->valid())
best = *algo;
if (best) {
raid6_2data_recov = best->data2;
raid6_datap_recov = best->datap;
printk("raid6: using %s recovery algorithm\n", best->name);
} else
printk("raid6: Yikes! No recovery algorithm found!\n");
return best;
}
static inline const struct raid6_calls *raid6_choose_gen(
void *(*const dptrs)[(65536/PAGE_SIZE)+2], const int disks)
{
unsigned long perf, bestperf, j0, j1;
const struct raid6_calls *const *algo;
const struct raid6_calls *best;
for (bestperf = 0, best = NULL, algo = raid6_algos; *algo; algo++) {
if (!best || (*algo)->prefer >= best->prefer) {
if ((*algo)->valid && !(*algo)->valid())
continue;
perf = 0;
preempt_disable();
j0 = jiffies;
while ((j1 = jiffies) == j0)
cpu_relax();
while (time_before(jiffies,
j1 + (1<<RAID6_TIME_JIFFIES_LG2))) {
(*algo)->gen_syndrome(disks, PAGE_SIZE, *dptrs);
perf++;
}
preempt_enable();
if (perf > bestperf) {
bestperf = perf;
best = *algo;
}
printk("raid6: %-8s %5ld MB/s\n", (*algo)->name,
(perf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2));
}
}
if (best) {
printk("raid6: using algorithm %s (%ld MB/s)\n",
best->name,
(bestperf*HZ) >> (20-16+RAID6_TIME_JIFFIES_LG2));
raid6_call = *best;
} else
printk("raid6: Yikes! No algorithm found!\n");
return best;
}
/* Try to pick the best algorithm */
/* This code uses the gfmul table as convenient data set to abuse */
int __init raid6_select_algo(void)
{
const int disks = (65536/PAGE_SIZE)+2;
const struct raid6_calls *gen_best;
const struct raid6_recov_calls *rec_best;
char *syndromes;
void *dptrs[(65536/PAGE_SIZE)+2];
int i;
for (i = 0; i < disks-2; i++)
dptrs[i] = ((char *)raid6_gfmul) + PAGE_SIZE*i;
/* Normal code - use a 2-page allocation to avoid D$ conflict */
syndromes = (void *) __get_free_pages(GFP_KERNEL, 1);
if (!syndromes) {
printk("raid6: Yikes! No memory available.\n");
return -ENOMEM;
}
dptrs[disks-2] = syndromes;
dptrs[disks-1] = syndromes + PAGE_SIZE;
/* select raid gen_syndrome function */
gen_best = raid6_choose_gen(&dptrs, disks);
/* select raid recover functions */
rec_best = raid6_choose_recov();
free_pages((unsigned long)syndromes, 1);
return gen_best && rec_best ? 0 : -EINVAL;
}
static void raid6_exit(void)
{
do { } while (0);
}
subsys_initcall(raid6_select_algo);
module_exit(raid6_exit);
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("RAID6 Q-syndrome calculations");
| apache-2.0 |
andschwa/mesos | 3rdparty/libprocess/src/tests/reap_tests.cpp | 12 | 4671 | // 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 <signal.h>
#include <unistd.h>
#include <sys/wait.h>
#include <gtest/gtest.h>
#include <process/clock.hpp>
#include <process/dispatch.hpp>
#include <process/gmock.hpp>
#include <process/gtest.hpp>
#include <process/reap.hpp>
#include <stout/exit.hpp>
#include <stout/gtest.hpp>
#include <stout/os/fork.hpp>
#include <stout/os/pstree.hpp>
#include <stout/try.hpp>
using process::Clock;
using process::Future;
using process::MAX_REAP_INTERVAL;
using os::Exec;
using os::Fork;
using os::ProcessTree;
using testing::_;
using testing::DoDefault;
// This test checks that we can reap a non-child process, in terms
// of receiving the termination notification.
TEST(ReapTest, NonChildProcess)
{
// The child process creates a grandchild and then exits. The
// grandchild sleeps for 10 seconds. The process tree looks like:
// -+- child exit 0
// \-+- grandchild sleep 10
// After the child exits, the grandchild is going to be re-parented
// by 'init', like this:
// -+- child (exit 0)
// -+- grandchild sleep 10
Try<ProcessTree> tree = Fork(None(),
Fork(Exec(SLEEP_COMMAND(10))),
Exec("exit 0"))();
ASSERT_SOME(tree);
ASSERT_EQ(1u, tree->children.size());
pid_t grandchild = tree->children.front();
// Reap the grandchild process.
Future<Option<int>> status = process::reap(grandchild);
EXPECT_TRUE(status.isPending());
// Now kill the grandchild.
// NOTE: We send a SIGKILL here because sometimes the grandchild
// process seems to be in a hung state and not responding to
// SIGTERM/SIGINT.
EXPECT_EQ(0, kill(grandchild, SIGKILL));
Clock::pause();
// Now advance time until the Reaper reaps the grandchild.
while (status.isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
AWAIT_READY(status);
// The status is None because pid is not an immediate child.
ASSERT_NONE(status.get()) << status->get();
// Reap the child as well to clean up after ourselves.
status = process::reap(tree->process.pid);
// Now advance time until the child is reaped.
while (status.isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
// Check if the status is correct.
AWAIT_EXPECT_WEXITSTATUS_EQ(0, status);
Clock::resume();
}
// This test checks that the we can reap a child process and obtain
// the correct exit status.
TEST(ReapTest, ChildProcess)
{
// The child process sleeps and will be killed by the parent.
Try<ProcessTree> tree = Fork(None(),
Exec("sleep 10"))();
ASSERT_SOME(tree);
pid_t child = tree.get();
// Reap the child process.
Future<Option<int>> status = process::reap(child);
// Now kill the child.
EXPECT_EQ(0, kill(child, SIGKILL));
Clock::pause();
// Now advance time until the reaper reaps the child.
while (status.isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
// Check if the status is correct.
AWAIT_EXPECT_WTERMSIG_EQ(SIGKILL, status);
Clock::resume();
}
// Check that we can reap a child process that is already exited.
TEST(ReapTest, TerminatedChildProcess)
{
// The child process immediately exits.
Try<ProcessTree> tree = Fork(None(),
Exec("exit 0"))();
ASSERT_SOME(tree);
pid_t child = tree.get();
ASSERT_SOME(os::process(child));
// Make sure the process is transitioned into the zombie
// state before we reap it.
while (true) {
const Result<os::Process> process = os::process(child);
ASSERT_SOME(process) << "Process " << child << " reaped unexpectedly";
if (process->zombie) {
break;
}
os::sleep(Milliseconds(1));
}
// Now that it's terminated, attempt to reap it.
Future<Option<int>> status = process::reap(child);
// Advance time until the reaper sends the notification.
Clock::pause();
while (status.isPending()) {
Clock::advance(MAX_REAP_INTERVAL());
Clock::settle();
}
// Expect to get the correct status.
AWAIT_EXPECT_WEXITSTATUS_EQ(0, status);
Clock::resume();
}
| apache-2.0 |
nepholi/ScoringTable | third_party/JUCE/modules/juce_core/native/juce_linux_Threads.cpp | 12 | 2844 | /*
==============================================================================
This file is part of the juce_core module of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission to use, copy, modify, and/or 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.
------------------------------------------------------------------------------
NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
All other JUCE modules are covered by a dual GPL/commercial license, so if you are
using any other modules, be sure to check that you also comply with their license.
For more details, visit www.juce.com
==============================================================================
*/
/*
Note that a lot of methods that you'd expect to find in this file actually
live in juce_posix_SharedCode.h!
*/
//==============================================================================
JUCE_API void JUCE_CALLTYPE Process::setPriority (const ProcessPriority prior)
{
const int policy = (prior <= NormalPriority) ? SCHED_OTHER : SCHED_RR;
const int minp = sched_get_priority_min (policy);
const int maxp = sched_get_priority_max (policy);
struct sched_param param;
switch (prior)
{
case LowPriority:
case NormalPriority: param.sched_priority = 0; break;
case HighPriority: param.sched_priority = minp + (maxp - minp) / 4; break;
case RealtimePriority: param.sched_priority = minp + (3 * (maxp - minp) / 4); break;
default: jassertfalse; break;
}
pthread_setschedparam (pthread_self(), policy, ¶m);
}
JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger()
{
return juce_isRunningUnderDebugger();
}
static bool swapUserAndEffectiveUser()
{
int result1 = setreuid (geteuid(), getuid());
int result2 = setregid (getegid(), getgid());
return result1 == 0 && result2 == 0;
}
JUCE_API void JUCE_CALLTYPE Process::raisePrivilege() { if (geteuid() != 0 && getuid() == 0) swapUserAndEffectiveUser(); }
JUCE_API void JUCE_CALLTYPE Process::lowerPrivilege() { if (geteuid() == 0 && getuid() != 0) swapUserAndEffectiveUser(); }
| apache-2.0 |
chrsmithdemos/selenium | cpp/iedriver/IECommandHandler.cpp | 15 | 3584 | // Copyright 2011 Software Freedom Conservancy
// 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 "command_handler.h"
#include "IECommandHandler.h"
#include "IECommandExecutor.h"
#include "logging.h"
namespace webdriver {
IECommandHandler::IECommandHandler() {
}
IECommandHandler::~IECommandHandler() {
}
void IECommandHandler::ExecuteInternal(const IECommandExecutor& executor,
const ParametersMap& command_parameters,
Response* response) {
LOG(TRACE) << "Entering IECommandHandler::ExecuteInternal";
response->SetErrorResponse(501, "Command not implemented");
}
int IECommandHandler::GetElement(const IECommandExecutor& executor,
const std::string& element_id,
ElementHandle* element_wrapper) {
LOG(TRACE) << "Entering IECommandHandler::GetElement";
ElementHandle candidate_wrapper;
int result = executor.GetManagedElement(element_id, &candidate_wrapper);
if (result != WD_SUCCESS) {
// This bears some explanation. Technically, passing an invalid ID in the
// URL for an element command should result in a 404. However, since the
// language bindings don't make up their own element IDs, any call from
// a language binding is more than likely an ID that the IE driver assigned
// it, and it was at one time valid. Therefore, we'll assume that not finding
// the element ID in the cache means it's stale.
LOG(WARN) << "Unable to get managed element, element not found, assuming stale";
return EOBSOLETEELEMENT;
} else {
if (!candidate_wrapper->IsAttachedToDom()) {
LOG(WARN) << "Found managed element is no longer valid";
IECommandExecutor& mutable_executor = const_cast<IECommandExecutor&>(executor);
mutable_executor.RemoveManagedElement(element_id);
return EOBSOLETEELEMENT;
} else {
// If the element is attached to the DOM, validate that its document
// is the currently-focused document (via frames).
BrowserHandle current_browser;
executor.GetCurrentBrowser(¤t_browser);
CComPtr<IHTMLDocument2> focused_doc;
current_browser->GetDocument(&focused_doc);
CComPtr<IDispatch> parent_doc_dispatch;
candidate_wrapper->element()->get_document(&parent_doc_dispatch);
if (focused_doc.IsEqualObject(parent_doc_dispatch)) {
*element_wrapper = candidate_wrapper;
return WD_SUCCESS;
} else {
LOG(WARN) << "Found managed element's document is not currently focused";
}
}
}
return EOBSOLETEELEMENT;
}
Json::Value IECommandHandler::RecreateJsonParameterObject(const ParametersMap& command_parameters) {
Json::Value result;
ParametersMap::const_iterator param_iterator = command_parameters.begin();
for (; param_iterator != command_parameters.end(); ++param_iterator) {
std::string key = param_iterator->first;
Json::Value value = param_iterator->second;
result[key] = value;
}
return result;
}
} // namespace webdriver | apache-2.0 |
Ant-OS/android_kernel_moto_shamu | sound/soc/cirrus/snappercl15.c | 2319 | 3539 | /*
* snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module
*
* Copyright (C) 2008 Bluewater Systems Ltd
* Author: Ryan Mallon
*
* 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.
*
*/
#include <linux/platform_device.h>
#include <linux/module.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <asm/mach-types.h>
#include <mach/hardware.h>
#include "../codecs/tlv320aic23.h"
#define CODEC_CLOCK 5644800
static int snappercl15_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
int err;
err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK,
SND_SOC_CLOCK_IN);
if (err)
return err;
err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK,
SND_SOC_CLOCK_OUT);
if (err)
return err;
return 0;
}
static struct snd_soc_ops snappercl15_ops = {
.hw_params = snappercl15_hw_params,
};
static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_LINE("Line In", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL),
};
static const struct snd_soc_dapm_route audio_map[] = {
{"Headphone Jack", NULL, "LHPOUT"},
{"Headphone Jack", NULL, "RHPOUT"},
{"LLINEIN", NULL, "Line In"},
{"RLINEIN", NULL, "Line In"},
{"MICIN", NULL, "Mic Jack"},
};
static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
ARRAY_SIZE(tlv320aic23_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
return 0;
}
static struct snd_soc_dai_link snappercl15_dai = {
.name = "tlv320aic23",
.stream_name = "AIC23",
.cpu_dai_name = "ep93xx-i2s",
.codec_dai_name = "tlv320aic23-hifi",
.codec_name = "tlv320aic23-codec.0-001a",
.platform_name = "ep93xx-pcm-audio",
.init = snappercl15_tlv320aic23_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
SND_SOC_DAIFMT_CBS_CFS,
.ops = &snappercl15_ops,
};
static struct snd_soc_card snd_soc_snappercl15 = {
.name = "Snapper CL15",
.owner = THIS_MODULE,
.dai_link = &snappercl15_dai,
.num_links = 1,
};
static int snappercl15_probe(struct platform_device *pdev)
{
struct snd_soc_card *card = &snd_soc_snappercl15;
int ret;
ret = ep93xx_i2s_acquire();
if (ret)
return ret;
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
ep93xx_i2s_release();
}
return ret;
}
static int snappercl15_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
snd_soc_unregister_card(card);
ep93xx_i2s_release();
return 0;
}
static struct platform_driver snappercl15_driver = {
.driver = {
.name = "snappercl15-audio",
.owner = THIS_MODULE,
},
.probe = snappercl15_probe,
.remove = snappercl15_remove,
};
module_platform_driver(snappercl15_driver);
MODULE_AUTHOR("Ryan Mallon");
MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:snappercl15-audio");
| apache-2.0 |
SINTEFMedtek/CTK | Libs/PluginFramework/service/application/ctkApplicationHandle.cpp | 16 | 1357 | /*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
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 "ctkApplicationHandle.h"
#include <ctkPluginConstants.h>
const QString ctkApplicationHandle::APPLICATION_PID = ctkPluginConstants::SERVICE_PID;
const QString ctkApplicationHandle::APPLICATION_DESCRIPTOR = "application.descriptor";
const QString ctkApplicationHandle::APPLICATION_STATE = "application.state";
const QString ctkApplicationHandle::APPLICATION_SUPPORTS_EXITVALUE = "application.supports.exitvalue";
const QString ctkApplicationHandle::RUNNING = "RUNNING";
const QString ctkApplicationHandle::STOPPING = "STOPPING";
| apache-2.0 |
tmiranda1962/sagetv-1 | third_party/ffmpeg/tools/pktdumper.c | 18 | 3911 | /*
* Copyright (c) 2005 Francois Revol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <limits.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "libavformat/avformat.h"
#define PKTFILESUFF "_%08"PRId64"_%02d_%010"PRId64"_%06d_%c.bin"
#undef strcat
static int usage(int ret)
{
fprintf(stderr, "dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n");
fprintf(stderr, "each packet is dumped in its own file named like `basename file.ext`_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n");
fprintf(stderr, "pktdumper [-nw] file [maxpkts]\n");
fprintf(stderr, "-n\twrite No file at all, only demux.\n");
fprintf(stderr, "-w\tWait at end of processing instead of quitting.\n");
return ret;
}
int main(int argc, char **argv)
{
char fntemplate[PATH_MAX];
char pktfilename[PATH_MAX];
AVFormatContext *fctx;
AVPacket pkt;
int64_t pktnum = 0;
int64_t maxpkts = 0;
int donotquit = 0;
int nowrite = 0;
int err;
if ((argc > 1) && !strncmp(argv[1], "-", 1)) {
if (strchr(argv[1], 'w'))
donotquit = 1;
if (strchr(argv[1], 'n'))
nowrite = 1;
argv++;
argc--;
}
if (argc < 2)
return usage(1);
if (argc > 2)
maxpkts = atoi(argv[2]);
strncpy(fntemplate, argv[1], PATH_MAX-1);
if (strrchr(argv[1], '/'))
strncpy(fntemplate, strrchr(argv[1], '/')+1, PATH_MAX-1);
if (strrchr(fntemplate, '.'))
*strrchr(fntemplate, '.') = '\0';
if (strchr(fntemplate, '%')) {
fprintf(stderr, "can't use filenames containing '%%'\n");
return usage(1);
}
if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX-1) {
fprintf(stderr, "filename too long\n");
return usage(1);
}
strcat(fntemplate, PKTFILESUFF);
printf("FNTEMPLATE: '%s'\n", fntemplate);
// register all file formats
av_register_all();
err = av_open_input_file(&fctx, argv[1], NULL, 0, NULL);
if (err < 0) {
fprintf(stderr, "av_open_input_file: error %d\n", err);
return 1;
}
err = av_find_stream_info(fctx);
if (err < 0) {
fprintf(stderr, "av_find_stream_info: error %d\n", err);
return 1;
}
av_init_packet(&pkt);
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
int fd;
snprintf(pktfilename, PATH_MAX-1, fntemplate, pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
printf(PKTFILESUFF"\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & AV_PKT_FLAG_KEY)?'K':'_');
//printf("open(\"%s\")\n", pktfilename);
if (!nowrite) {
fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
write(fd, pkt.data, pkt.size);
close(fd);
}
av_free_packet(&pkt);
pktnum++;
if (maxpkts && (pktnum >= maxpkts))
break;
}
av_close_input_file(fctx);
while (donotquit)
sleep(60);
return 0;
}
| apache-2.0 |
bitemyapp/watchman | tests/bser.c | 18 | 3472 | /* Copyright 2013-present Facebook, Inc.
* Licensed under the Apache License, Version 2.0 */
#include "watchman.h"
#include "thirdparty/tap.h"
#include "thirdparty/jansson/jansson_private.h"
#include "thirdparty/jansson/strbuffer.h"
static int dump_to_strbuffer(const char *buffer, size_t size, void *data)
{
return strbuffer_append_bytes((strbuffer_t *)data, buffer, size);
}
static void hexdump(char *start, char *end)
{
int i;
int maxbytes = 24;
while (start < end) {
ptrdiff_t limit = end - start;
if (limit > maxbytes) {
limit = maxbytes;
}
printf("# ");
for (i = 0; i < limit; i++) {
printf("%02x", (int)(uint8_t)start[i]);
}
while (i <= maxbytes) {
printf(" ");
i++;
}
printf(" ");
for (i = 0; i < limit; i++) {
printf("%c", isprint((uint8_t)start[i]) ? start[i] : '.');
}
printf("\n");
start += limit;
}
}
static char *bdumps(json_t *json, char **end)
{
strbuffer_t strbuff;
if (strbuffer_init(&strbuff)) {
return NULL;
}
if (w_bser_dump(json, dump_to_strbuffer, &strbuff) == 0) {
*end = strbuff.value + strbuff.length;
return strbuff.value;
}
strbuffer_close(&strbuff);
return NULL;
}
static const char *json_inputs[] = {
"{\"foo\": 42, \"bar\": true}",
"[1, 2, 3]",
"[null, true, false, 65536]",
"[1.5, 2.0]",
"[{\"lemon\": 2.5}, null, 16000, true, false]",
"[1, 16000, 65536, 90000, 2147483648, 4294967295]",
};
static struct {
const char *json_text;
const char *template_text;
} template_tests[] = {
{
"["
"{\"name\": \"fred\", \"age\": 20}, "
"{\"name\": \"pete\", \"age\": 30}, "
"{\"age\": 25}"
"]",
"[\"name\", \"age\"]"
}
};
static bool check_roundtrip(const char *input, const char *template_text,
json_t **expect_p, json_t **got_p)
{
char *dump_buf, *end;
char *jdump;
json_t *expected, *decoded, *templ = NULL;
json_error_t jerr;
json_int_t needed;
expected = json_loads(input, 0, &jerr);
ok(expected != NULL, "loaded %s: %s", input, jerr.text);
if (!expected) {
return false;
}
if (template_text) {
templ = json_loads(template_text, 0, &jerr);
json_array_set_template(expected, templ);
}
dump_buf = bdumps(expected, &end);
ok(dump_buf != NULL, "dumped something");
if (!dump_buf) {
return false;;
}
hexdump(dump_buf, end);
memset(&jerr, 0, sizeof(jerr));
decoded = bunser(dump_buf, end, &needed, &jerr);
ok(decoded != NULL, "decoded something (err = %s)", jerr.text);
jdump = json_dumps(decoded, 0);
ok(jdump != NULL, "dumped %s", jdump);
ok(json_equal(expected, decoded), "round-tripped json_equal");
ok(!strcmp(jdump, input), "round-tripped strcmp");
*expect_p = expected;
*got_p = decoded;
return true;
}
int main(int argc, char **argv)
{
int i, num_json_inputs, num_templ;
json_t *expected, *decoded;
(void)argc;
(void)argv;
num_json_inputs = sizeof(json_inputs)/sizeof(json_inputs[0]);
num_templ = sizeof(template_tests)/sizeof(template_tests[0]);
plan_tests(
(6 * num_json_inputs) +
(6 * num_templ)
);
for (i = 0; i < num_json_inputs; i++) {
check_roundtrip(json_inputs[i], NULL, &expected, &decoded);
}
for (i = 0; i < num_templ; i++) {
check_roundtrip(template_tests[i].json_text,
template_tests[i].template_text,
&expected, &decoded);
}
return exit_status();
}
/* vim:ts=2:sw=2:et:
*/
| apache-2.0 |
ArdaFu/rt-thread | bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dfsdm.c | 20 | 127695 | /**
******************************************************************************
* @file stm32l4xx_hal_dfsdm.c
* @author MCD Application Team
* @brief This file provides firmware functions to manage the following
* functionalities of the Digital Filter for Sigma-Delta Modulators
* (DFSDM) peripherals:
* + Initialization and configuration of channels and filters
* + Regular channels configuration
* + Injected channels configuration
* + Regular/Injected Channels DMA Configuration
* + Interrupts and flags management
* + Analog watchdog feature
* + Short-circuit detector feature
* + Extremes detector feature
* + Clock absence detector feature
* + Break generation on analog watchdog or short-circuit event
*
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
*** Channel initialization ***
==============================
[..]
(#) User has first to initialize channels (before filters initialization).
(#) As prerequisite, fill in the HAL_DFSDM_ChannelMspInit() :
(++) Enable DFSDMz clock interface with __HAL_RCC_DFSDMz_CLK_ENABLE().
(++) Enable the clocks for the DFSDMz GPIOS with __HAL_RCC_GPIOx_CLK_ENABLE().
(++) Configure these DFSDMz pins in alternate mode using HAL_GPIO_Init().
(++) If interrupt mode is used, enable and configure DFSDMz_FLT0 global
interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
(#) Configure the output clock, input, serial interface, analog watchdog,
offset and data right bit shift parameters for this channel using the
HAL_DFSDM_ChannelInit() function.
*** Channel clock absence detector ***
======================================
[..]
(#) Start clock absence detector using HAL_DFSDM_ChannelCkabStart() or
HAL_DFSDM_ChannelCkabStart_IT().
(#) In polling mode, use HAL_DFSDM_ChannelPollForCkab() to detect the clock
absence.
(#) In interrupt mode, HAL_DFSDM_ChannelCkabCallback() will be called if
clock absence is detected.
(#) Stop clock absence detector using HAL_DFSDM_ChannelCkabStop() or
HAL_DFSDM_ChannelCkabStop_IT().
(#) Please note that the same mode (polling or interrupt) has to be used
for all channels because the channels are sharing the same interrupt.
(#) Please note also that in interrupt mode, if clock absence detector is
stopped for one channel, interrupt will be disabled for all channels.
*** Channel short circuit detector ***
======================================
[..]
(#) Start short circuit detector using HAL_DFSDM_ChannelScdStart() or
or HAL_DFSDM_ChannelScdStart_IT().
(#) In polling mode, use HAL_DFSDM_ChannelPollForScd() to detect short
circuit.
(#) In interrupt mode, HAL_DFSDM_ChannelScdCallback() will be called if
short circuit is detected.
(#) Stop short circuit detector using HAL_DFSDM_ChannelScdStop() or
or HAL_DFSDM_ChannelScdStop_IT().
(#) Please note that the same mode (polling or interrupt) has to be used
for all channels because the channels are sharing the same interrupt.
(#) Please note also that in interrupt mode, if short circuit detector is
stopped for one channel, interrupt will be disabled for all channels.
*** Channel analog watchdog value ***
=====================================
[..]
(#) Get analog watchdog filter value of a channel using
HAL_DFSDM_ChannelGetAwdValue().
*** Channel offset value ***
=====================================
[..]
(#) Modify offset value of a channel using HAL_DFSDM_ChannelModifyOffset().
*** Filter initialization ***
=============================
[..]
(#) After channel initialization, user has to init filters.
(#) As prerequisite, fill in the HAL_DFSDM_FilterMspInit() :
(++) If interrupt mode is used , enable and configure DFSDMz_FLTx global
interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
Please note that DFSDMz_FLT0 global interrupt could be already
enabled if interrupt is used for channel.
(++) If DMA mode is used, configure DMA with HAL_DMA_Init() and link it
with DFSDMz filter handle using __HAL_LINKDMA().
(#) Configure the regular conversion, injected conversion and filter
parameters for this filter using the HAL_DFSDM_FilterInit() function.
*** Filter regular channel conversion ***
=========================================
[..]
(#) Select regular channel and enable/disable continuous mode using
HAL_DFSDM_FilterConfigRegChannel().
(#) Start regular conversion using HAL_DFSDM_FilterRegularStart(),
HAL_DFSDM_FilterRegularStart_IT(), HAL_DFSDM_FilterRegularStart_DMA() or
HAL_DFSDM_FilterRegularMsbStart_DMA().
(#) In polling mode, use HAL_DFSDM_FilterPollForRegConversion() to detect
the end of regular conversion.
(#) In interrupt mode, HAL_DFSDM_FilterRegConvCpltCallback() will be called
at the end of regular conversion.
(#) Get value of regular conversion and corresponding channel using
HAL_DFSDM_FilterGetRegularValue().
(#) In DMA mode, HAL_DFSDM_FilterRegConvHalfCpltCallback() and
HAL_DFSDM_FilterRegConvCpltCallback() will be called respectively at the
half transfer and at the transfer complete. Please note that
HAL_DFSDM_FilterRegConvHalfCpltCallback() will be called only in DMA
circular mode.
(#) Stop regular conversion using HAL_DFSDM_FilterRegularStop(),
HAL_DFSDM_FilterRegularStop_IT() or HAL_DFSDM_FilterRegularStop_DMA().
*** Filter injected channels conversion ***
===========================================
[..]
(#) Select injected channels using HAL_DFSDM_FilterConfigInjChannel().
(#) Start injected conversion using HAL_DFSDM_FilterInjectedStart(),
HAL_DFSDM_FilterInjectedStart_IT(), HAL_DFSDM_FilterInjectedStart_DMA() or
HAL_DFSDM_FilterInjectedMsbStart_DMA().
(#) In polling mode, use HAL_DFSDM_FilterPollForInjConversion() to detect
the end of injected conversion.
(#) In interrupt mode, HAL_DFSDM_FilterInjConvCpltCallback() will be called
at the end of injected conversion.
(#) Get value of injected conversion and corresponding channel using
HAL_DFSDM_FilterGetInjectedValue().
(#) In DMA mode, HAL_DFSDM_FilterInjConvHalfCpltCallback() and
HAL_DFSDM_FilterInjConvCpltCallback() will be called respectively at the
half transfer and at the transfer complete. Please note that
HAL_DFSDM_FilterInjConvCpltCallback() will be called only in DMA
circular mode.
(#) Stop injected conversion using HAL_DFSDM_FilterInjectedStop(),
HAL_DFSDM_FilterInjectedStop_IT() or HAL_DFSDM_FilterInjectedStop_DMA().
*** Filter analog watchdog ***
==============================
[..]
(#) Start filter analog watchdog using HAL_DFSDM_FilterAwdStart_IT().
(#) HAL_DFSDM_FilterAwdCallback() will be called if analog watchdog occurs.
(#) Stop filter analog watchdog using HAL_DFSDM_FilterAwdStop_IT().
*** Filter extreme detector ***
===============================
[..]
(#) Start filter extreme detector using HAL_DFSDM_FilterExdStart().
(#) Get extreme detector maximum value using HAL_DFSDM_FilterGetExdMaxValue().
(#) Get extreme detector minimum value using HAL_DFSDM_FilterGetExdMinValue().
(#) Start filter extreme detector using HAL_DFSDM_FilterExdStop().
*** Filter conversion time ***
==============================
[..]
(#) Get conversion time value using HAL_DFSDM_FilterGetConvTimeValue().
*** Callback registration ***
=============================
[..]
The compilation define USE_HAL_DFSDM_REGISTER_CALLBACKS when set to 1
allows the user to configure dynamically the driver callbacks.
Use functions HAL_DFSDM_Channel_RegisterCallback(),
HAL_DFSDM_Filter_RegisterCallback() or
HAL_DFSDM_Filter_RegisterAwdCallback() to register a user callback.
[..]
Function HAL_DFSDM_Channel_RegisterCallback() allows to register
following callbacks:
(+) CkabCallback : DFSDM channel clock absence detection callback.
(+) ScdCallback : DFSDM channel short circuit detection callback.
(+) MspInitCallback : DFSDM channel MSP init callback.
(+) MspDeInitCallback : DFSDM channel MSP de-init callback.
[..]
This function takes as parameters the HAL peripheral handle, the Callback ID
and a pointer to the user callback function.
[..]
Function HAL_DFSDM_Filter_RegisterCallback() allows to register
following callbacks:
(+) RegConvCpltCallback : DFSDM filter regular conversion complete callback.
(+) RegConvHalfCpltCallback : DFSDM filter half regular conversion complete callback.
(+) InjConvCpltCallback : DFSDM filter injected conversion complete callback.
(+) InjConvHalfCpltCallback : DFSDM filter half injected conversion complete callback.
(+) ErrorCallback : DFSDM filter error callback.
(+) MspInitCallback : DFSDM filter MSP init callback.
(+) MspDeInitCallback : DFSDM filter MSP de-init callback.
[..]
This function takes as parameters the HAL peripheral handle, the Callback ID
and a pointer to the user callback function.
[..]
For specific DFSDM filter analog watchdog callback use dedicated register callback:
HAL_DFSDM_Filter_RegisterAwdCallback().
[..]
Use functions HAL_DFSDM_Channel_UnRegisterCallback() or
HAL_DFSDM_Filter_UnRegisterCallback() to reset a callback to the default
weak function.
[..]
HAL_DFSDM_Channel_UnRegisterCallback() takes as parameters the HAL peripheral handle,
and the Callback ID.
[..]
This function allows to reset following callbacks:
(+) CkabCallback : DFSDM channel clock absence detection callback.
(+) ScdCallback : DFSDM channel short circuit detection callback.
(+) MspInitCallback : DFSDM channel MSP init callback.
(+) MspDeInitCallback : DFSDM channel MSP de-init callback.
[..]
HAL_DFSDM_Filter_UnRegisterCallback() takes as parameters the HAL peripheral handle,
and the Callback ID.
[..]
This function allows to reset following callbacks:
(+) RegConvCpltCallback : DFSDM filter regular conversion complete callback.
(+) RegConvHalfCpltCallback : DFSDM filter half regular conversion complete callback.
(+) InjConvCpltCallback : DFSDM filter injected conversion complete callback.
(+) InjConvHalfCpltCallback : DFSDM filter half injected conversion complete callback.
(+) ErrorCallback : DFSDM filter error callback.
(+) MspInitCallback : DFSDM filter MSP init callback.
(+) MspDeInitCallback : DFSDM filter MSP de-init callback.
[..]
For specific DFSDM filter analog watchdog callback use dedicated unregister callback:
HAL_DFSDM_Filter_UnRegisterAwdCallback().
[..]
By default, after the call of init function and if the state is RESET
all callbacks are reset to the corresponding legacy weak functions:
examples HAL_DFSDM_ChannelScdCallback(), HAL_DFSDM_FilterErrorCallback().
Exception done for MspInit and MspDeInit callbacks that are respectively
reset to the legacy weak functions in the init and de-init only when these
callbacks are null (not registered beforehand).
If not, MspInit or MspDeInit are not null, the init and de-init keep and use
the user MspInit/MspDeInit callbacks (registered beforehand)
[..]
Callbacks can be registered/unregistered in READY state only.
Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
during the init/de-init.
In that case first register the MspInit/MspDeInit user callbacks using
HAL_DFSDM_Channel_RegisterCallback() or
HAL_DFSDM_Filter_RegisterCallback() before calling init or de-init function.
[..]
When The compilation define USE_HAL_DFSDM_REGISTER_CALLBACKS is set to 0 or
not defined, the callback registering feature is not available
and weak callbacks are used.
@endverbatim
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2017 STMicroelectronics.
* All rights reserved.</center></h2>
*
* This software component is licensed by ST under BSD 3-Clause license,
* the "License"; You may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
* opensource.org/licenses/BSD-3-Clause
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32l4xx_hal.h"
/** @addtogroup STM32L4xx_HAL_Driver
* @{
*/
#ifdef HAL_DFSDM_MODULE_ENABLED
#if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) || \
defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \
defined(STM32L496xx) || defined(STM32L4A6xx) || \
defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
/** @defgroup DFSDM DFSDM
* @brief DFSDM HAL driver module
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/** @defgroup DFSDM_Private_Define DFSDM Private Define
* @{
*/
#define DFSDM_FLTCR1_MSB_RCH_OFFSET 8
#define DFSDM_MSB_MASK 0xFFFF0000U
#define DFSDM_LSB_MASK 0x0000FFFFU
#define DFSDM_CKAB_TIMEOUT 5000U
#if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
#define DFSDM1_CHANNEL_NUMBER 4U
#else /* STM32L451xx || STM32L452xx || STM32L462xx */
#define DFSDM1_CHANNEL_NUMBER 8U
#endif /* STM32L451xx || STM32L452xx || STM32L462xx */
/**
* @}
*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/** @defgroup DFSDM_Private_Variables DFSDM Private Variables
* @{
*/
static __IO uint32_t v_dfsdm1ChannelCounter = 0;
static DFSDM_Channel_HandleTypeDef *a_dfsdm1ChannelHandle[DFSDM1_CHANNEL_NUMBER] = {NULL};
/**
* @}
*/
/* Private function prototypes -----------------------------------------------*/
/** @defgroup DFSDM_Private_Functions DFSDM Private Functions
* @{
*/
static uint32_t DFSDM_GetInjChannelsNbr(uint32_t Channels);
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance);
static void DFSDM_RegConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
static void DFSDM_RegConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
static void DFSDM_InjConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
static void DFSDM_InjConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
static void DFSDM_DMARegularHalfConvCplt(DMA_HandleTypeDef *hdma);
static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef *hdma);
static void DFSDM_DMAInjectedHalfConvCplt(DMA_HandleTypeDef *hdma);
static void DFSDM_DMAInjectedConvCplt(DMA_HandleTypeDef *hdma);
static void DFSDM_DMAError(DMA_HandleTypeDef *hdma);
/**
* @}
*/
/* Exported functions --------------------------------------------------------*/
/** @defgroup DFSDM_Exported_Functions DFSDM Exported Functions
* @{
*/
/** @defgroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
* @brief Channel initialization and de-initialization functions
*
@verbatim
==============================================================================
##### Channel initialization and de-initialization functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Initialize the DFSDM channel.
(+) De-initialize the DFSDM channel.
@endverbatim
* @{
*/
/**
* @brief Initialize the DFSDM channel according to the specified parameters
* in the DFSDM_ChannelInitTypeDef structure and initialize the associated handle.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Check DFSDM Channel handle */
if (hdfsdm_channel == NULL)
{
return HAL_ERROR;
}
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
assert_param(IS_FUNCTIONAL_STATE(hdfsdm_channel->Init.OutputClock.Activation));
assert_param(IS_DFSDM_CHANNEL_INPUT(hdfsdm_channel->Init.Input.Multiplexer));
assert_param(IS_DFSDM_CHANNEL_DATA_PACKING(hdfsdm_channel->Init.Input.DataPacking));
assert_param(IS_DFSDM_CHANNEL_INPUT_PINS(hdfsdm_channel->Init.Input.Pins));
assert_param(IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(hdfsdm_channel->Init.SerialInterface.Type));
assert_param(IS_DFSDM_CHANNEL_SPI_CLOCK(hdfsdm_channel->Init.SerialInterface.SpiClock));
assert_param(IS_DFSDM_CHANNEL_FILTER_ORDER(hdfsdm_channel->Init.Awd.FilterOrder));
assert_param(IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(hdfsdm_channel->Init.Awd.Oversampling));
assert_param(IS_DFSDM_CHANNEL_OFFSET(hdfsdm_channel->Init.Offset));
assert_param(IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(hdfsdm_channel->Init.RightBitShift));
/* Check that channel has not been already initialized */
if (a_dfsdm1ChannelHandle[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] != NULL)
{
return HAL_ERROR;
}
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
/* Reset callback pointers to the weak predefined callbacks */
hdfsdm_channel->CkabCallback = HAL_DFSDM_ChannelCkabCallback;
hdfsdm_channel->ScdCallback = HAL_DFSDM_ChannelScdCallback;
/* Call MSP init function */
if (hdfsdm_channel->MspInitCallback == NULL)
{
hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
}
hdfsdm_channel->MspInitCallback(hdfsdm_channel);
#else
/* Call MSP init function */
HAL_DFSDM_ChannelMspInit(hdfsdm_channel);
#endif
/* Update the channel counter */
v_dfsdm1ChannelCounter++;
/* Configure output serial clock and enable global DFSDM interface only for first channel */
if (v_dfsdm1ChannelCounter == 1U)
{
assert_param(IS_DFSDM_CHANNEL_OUTPUT_CLOCK(hdfsdm_channel->Init.OutputClock.Selection));
/* Set the output serial clock source */
DFSDM1_Channel0->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKOUTSRC);
DFSDM1_Channel0->CHCFGR1 |= hdfsdm_channel->Init.OutputClock.Selection;
/* Reset clock divider */
DFSDM1_Channel0->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKOUTDIV);
if (hdfsdm_channel->Init.OutputClock.Activation == ENABLE)
{
assert_param(IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(hdfsdm_channel->Init.OutputClock.Divider));
/* Set the output clock divider */
DFSDM1_Channel0->CHCFGR1 |= (uint32_t)((hdfsdm_channel->Init.OutputClock.Divider - 1U) <<
DFSDM_CHCFGR1_CKOUTDIV_Pos);
}
/* enable the DFSDM global interface */
DFSDM1_Channel0->CHCFGR1 |= DFSDM_CHCFGR1_DFSDMEN;
}
/* Set channel input parameters */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_DATPACK | DFSDM_CHCFGR1_DATMPX |
DFSDM_CHCFGR1_CHINSEL);
hdfsdm_channel->Instance->CHCFGR1 |= (hdfsdm_channel->Init.Input.Multiplexer |
hdfsdm_channel->Init.Input.DataPacking |
hdfsdm_channel->Init.Input.Pins);
/* Set serial interface parameters */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SITP | DFSDM_CHCFGR1_SPICKSEL);
hdfsdm_channel->Instance->CHCFGR1 |= (hdfsdm_channel->Init.SerialInterface.Type |
hdfsdm_channel->Init.SerialInterface.SpiClock);
/* Set analog watchdog parameters */
hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_AWFORD | DFSDM_CHAWSCDR_AWFOSR);
hdfsdm_channel->Instance->CHAWSCDR |= (hdfsdm_channel->Init.Awd.FilterOrder |
((hdfsdm_channel->Init.Awd.Oversampling - 1U) << DFSDM_CHAWSCDR_AWFOSR_Pos));
/* Set channel offset and right bit shift */
hdfsdm_channel->Instance->CHCFGR2 &= ~(DFSDM_CHCFGR2_OFFSET | DFSDM_CHCFGR2_DTRBS);
hdfsdm_channel->Instance->CHCFGR2 |= (((uint32_t) hdfsdm_channel->Init.Offset << DFSDM_CHCFGR2_OFFSET_Pos) |
(hdfsdm_channel->Init.RightBitShift << DFSDM_CHCFGR2_DTRBS_Pos));
/* Enable DFSDM channel */
hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CHEN;
/* Set DFSDM Channel to ready state */
hdfsdm_channel->State = HAL_DFSDM_CHANNEL_STATE_READY;
/* Store channel handle in DFSDM channel handle table */
a_dfsdm1ChannelHandle[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] = hdfsdm_channel;
return HAL_OK;
}
/**
* @brief De-initialize the DFSDM channel.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Check DFSDM Channel handle */
if (hdfsdm_channel == NULL)
{
return HAL_ERROR;
}
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check that channel has not been already deinitialized */
if (a_dfsdm1ChannelHandle[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] == NULL)
{
return HAL_ERROR;
}
/* Disable the DFSDM channel */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CHEN);
/* Update the channel counter */
v_dfsdm1ChannelCounter--;
/* Disable global DFSDM at deinit of last channel */
if (v_dfsdm1ChannelCounter == 0U)
{
DFSDM1_Channel0->CHCFGR1 &= ~(DFSDM_CHCFGR1_DFSDMEN);
}
/* Call MSP deinit function */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
if (hdfsdm_channel->MspDeInitCallback == NULL)
{
hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
}
hdfsdm_channel->MspDeInitCallback(hdfsdm_channel);
#else
HAL_DFSDM_ChannelMspDeInit(hdfsdm_channel);
#endif
/* Set DFSDM Channel in reset state */
hdfsdm_channel->State = HAL_DFSDM_CHANNEL_STATE_RESET;
/* Reset channel handle in DFSDM channel handle table */
a_dfsdm1ChannelHandle[DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance)] = (DFSDM_Channel_HandleTypeDef *) NULL;
return HAL_OK;
}
/**
* @brief Initialize the DFSDM channel MSP.
* @param hdfsdm_channel DFSDM channel handle.
* @retval None
*/
__weak void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_channel);
/* NOTE : This function should not be modified, when the function is needed,
the HAL_DFSDM_ChannelMspInit could be implemented in the user file.
*/
}
/**
* @brief De-initialize the DFSDM channel MSP.
* @param hdfsdm_channel DFSDM channel handle.
* @retval None
*/
__weak void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_channel);
/* NOTE : This function should not be modified, when the function is needed,
the HAL_DFSDM_ChannelMspDeInit could be implemented in the user file.
*/
}
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
/**
* @brief Register a user DFSDM channel callback
* to be used instead of the weak predefined callback.
* @param hdfsdm_channel DFSDM channel handle.
* @param CallbackID ID of the callback to be registered.
* This parameter can be one of the following values:
* @arg @ref HAL_DFSDM_CHANNEL_CKAB_CB_ID clock absence detection callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_SCD_CB_ID short circuit detection callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_MSPINIT_CB_ID MSP init callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID MSP de-init callback ID.
* @param pCallback pointer to the callback function.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
pDFSDM_Channel_CallbackTypeDef pCallback)
{
HAL_StatusTypeDef status = HAL_OK;
if (pCallback == NULL)
{
/* update return status */
status = HAL_ERROR;
}
else
{
if (HAL_DFSDM_CHANNEL_STATE_READY == hdfsdm_channel->State)
{
switch (CallbackID)
{
case HAL_DFSDM_CHANNEL_CKAB_CB_ID :
hdfsdm_channel->CkabCallback = pCallback;
break;
case HAL_DFSDM_CHANNEL_SCD_CB_ID :
hdfsdm_channel->ScdCallback = pCallback;
break;
case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
hdfsdm_channel->MspInitCallback = pCallback;
break;
case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
hdfsdm_channel->MspDeInitCallback = pCallback;
break;
default :
/* update return status */
status = HAL_ERROR;
break;
}
}
else if (HAL_DFSDM_CHANNEL_STATE_RESET == hdfsdm_channel->State)
{
switch (CallbackID)
{
case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
hdfsdm_channel->MspInitCallback = pCallback;
break;
case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
hdfsdm_channel->MspDeInitCallback = pCallback;
break;
default :
/* update return status */
status = HAL_ERROR;
break;
}
}
else
{
/* update return status */
status = HAL_ERROR;
}
}
return status;
}
/**
* @brief Unregister a user DFSDM channel callback.
* DFSDM channel callback is redirected to the weak predefined callback.
* @param hdfsdm_channel DFSDM channel handle.
* @param CallbackID ID of the callback to be unregistered.
* This parameter can be one of the following values:
* @arg @ref HAL_DFSDM_CHANNEL_CKAB_CB_ID clock absence detection callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_SCD_CB_ID short circuit detection callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_MSPINIT_CB_ID MSP init callback ID.
* @arg @ref HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID MSP de-init callback ID.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID)
{
HAL_StatusTypeDef status = HAL_OK;
if (HAL_DFSDM_CHANNEL_STATE_READY == hdfsdm_channel->State)
{
switch (CallbackID)
{
case HAL_DFSDM_CHANNEL_CKAB_CB_ID :
hdfsdm_channel->CkabCallback = HAL_DFSDM_ChannelCkabCallback;
break;
case HAL_DFSDM_CHANNEL_SCD_CB_ID :
hdfsdm_channel->ScdCallback = HAL_DFSDM_ChannelScdCallback;
break;
case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
break;
case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
break;
default :
/* update return status */
status = HAL_ERROR;
break;
}
}
else if (HAL_DFSDM_CHANNEL_STATE_RESET == hdfsdm_channel->State)
{
switch (CallbackID)
{
case HAL_DFSDM_CHANNEL_MSPINIT_CB_ID :
hdfsdm_channel->MspInitCallback = HAL_DFSDM_ChannelMspInit;
break;
case HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID :
hdfsdm_channel->MspDeInitCallback = HAL_DFSDM_ChannelMspDeInit;
break;
default :
/* update return status */
status = HAL_ERROR;
break;
}
}
else
{
/* update return status */
status = HAL_ERROR;
}
return status;
}
#endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
* @brief Channel operation functions
*
@verbatim
==============================================================================
##### Channel operation functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Manage clock absence detector feature.
(+) Manage short circuit detector feature.
(+) Get analog watchdog value.
(+) Modify offset value.
@endverbatim
* @{
*/
/**
* @brief This function allows to start clock absence detection in polling mode.
* @note Same mode has to be used for all channels.
* @note If clock is not available on this channel during 5 seconds,
* clock absence detection will not be activated and function
* will return HAL_TIMEOUT error.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
uint32_t tickstart;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Get channel number from channel instance */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
/* Get timeout */
tickstart = HAL_GetTick();
/* Clear clock absence flag */
while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
{
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
/* Check the Timeout */
if ((HAL_GetTick() - tickstart) > DFSDM_CKAB_TIMEOUT)
{
/* Set timeout status */
status = HAL_TIMEOUT;
break;
}
}
if (status == HAL_OK)
{
/* Start clock absence detection */
hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
}
}
/* Return function status */
return status;
}
/**
* @brief This function allows to poll for the clock absence detection.
* @param hdfsdm_channel DFSDM channel handle.
* @param Timeout Timeout value in milliseconds.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
uint32_t Timeout)
{
uint32_t tickstart;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
return HAL_ERROR;
}
else
{
/* Get channel number from channel instance */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
/* Get timeout */
tickstart = HAL_GetTick();
/* Wait clock absence detection */
while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) == 0U)
{
/* Check the Timeout */
if (Timeout != HAL_MAX_DELAY)
{
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
{
/* Return timeout status */
return HAL_TIMEOUT;
}
}
}
/* Clear clock absence detection flag */
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
/* Return function status */
return HAL_OK;
}
}
/**
* @brief This function allows to stop clock absence detection in polling mode.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop clock absence detection */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
/* Clear clock absence flag */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start clock absence detection in interrupt mode.
* @note Same mode has to be used for all channels.
* @note If clock is not available on this channel during 5 seconds,
* clock absence detection will not be activated and function
* will return HAL_TIMEOUT error.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
uint32_t tickstart;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Get channel number from channel instance */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
/* Get timeout */
tickstart = HAL_GetTick();
/* Clear clock absence flag */
while ((((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_CKABF) >> (DFSDM_FLTISR_CKABF_Pos + channel)) & 1U) != 0U)
{
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
/* Check the Timeout */
if ((HAL_GetTick() - tickstart) > DFSDM_CKAB_TIMEOUT)
{
/* Set timeout status */
status = HAL_TIMEOUT;
break;
}
}
if (status == HAL_OK)
{
/* Activate clock absence detection interrupt */
DFSDM1_Filter0->FLTCR2 |= DFSDM_FLTCR2_CKABIE;
/* Start clock absence detection */
hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_CKABEN;
}
}
/* Return function status */
return status;
}
/**
* @brief Clock absence detection callback.
* @param hdfsdm_channel DFSDM channel handle.
* @retval None
*/
__weak void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_channel);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_ChannelCkabCallback could be implemented in the user file
*/
}
/**
* @brief This function allows to stop clock absence detection in interrupt mode.
* @note Interrupt will be disabled for all channels
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop clock absence detection */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_CKABEN);
/* Clear clock absence flag */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
/* Disable clock absence detection interrupt */
DFSDM1_Filter0->FLTCR2 &= ~(DFSDM_FLTCR2_CKABIE);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start short circuit detection in polling mode.
* @note Same mode has to be used for all channels
* @param hdfsdm_channel DFSDM channel handle.
* @param Threshold Short circuit detector threshold.
* This parameter must be a number between Min_Data = 0 and Max_Data = 255.
* @param BreakSignal Break signals assigned to short circuit event.
* This parameter can be a values combination of @ref DFSDM_BreakSignals.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
uint32_t Threshold,
uint32_t BreakSignal)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
assert_param(IS_DFSDM_CHANNEL_SCD_THRESHOLD(Threshold));
assert_param(IS_DFSDM_BREAK_SIGNALS(BreakSignal));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Configure threshold and break signals */
hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
Threshold);
/* Start short circuit detection */
hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to poll for the short circuit detection.
* @param hdfsdm_channel DFSDM channel handle.
* @param Timeout Timeout value in milliseconds.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
uint32_t Timeout)
{
uint32_t tickstart;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
return HAL_ERROR;
}
else
{
/* Get channel number from channel instance */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
/* Get timeout */
tickstart = HAL_GetTick();
/* Wait short circuit detection */
while (((DFSDM1_Filter0->FLTISR & DFSDM_FLTISR_SCDF) >> (DFSDM_FLTISR_SCDF_Pos + channel)) == 0U)
{
/* Check the Timeout */
if (Timeout != HAL_MAX_DELAY)
{
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
{
/* Return timeout status */
return HAL_TIMEOUT;
}
}
}
/* Clear short circuit detection flag */
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
/* Return function status */
return HAL_OK;
}
}
/**
* @brief This function allows to stop short circuit detection in polling mode.
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop short circuit detection */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
/* Clear short circuit detection flag */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start short circuit detection in interrupt mode.
* @note Same mode has to be used for all channels
* @param hdfsdm_channel DFSDM channel handle.
* @param Threshold Short circuit detector threshold.
* This parameter must be a number between Min_Data = 0 and Max_Data = 255.
* @param BreakSignal Break signals assigned to short circuit event.
* This parameter can be a values combination of @ref DFSDM_BreakSignals.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
uint32_t Threshold,
uint32_t BreakSignal)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
assert_param(IS_DFSDM_CHANNEL_SCD_THRESHOLD(Threshold));
assert_param(IS_DFSDM_BREAK_SIGNALS(BreakSignal));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Activate short circuit detection interrupt */
DFSDM1_Filter0->FLTCR2 |= DFSDM_FLTCR2_SCDIE;
/* Configure threshold and break signals */
hdfsdm_channel->Instance->CHAWSCDR &= ~(DFSDM_CHAWSCDR_BKSCD | DFSDM_CHAWSCDR_SCDT);
hdfsdm_channel->Instance->CHAWSCDR |= ((BreakSignal << DFSDM_CHAWSCDR_BKSCD_Pos) | \
Threshold);
/* Start short circuit detection */
hdfsdm_channel->Instance->CHCFGR1 |= DFSDM_CHCFGR1_SCDEN;
}
/* Return function status */
return status;
}
/**
* @brief Short circuit detection callback.
* @param hdfsdm_channel DFSDM channel handle.
* @retval None
*/
__weak void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_channel);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_ChannelScdCallback could be implemented in the user file
*/
}
/**
* @brief This function allows to stop short circuit detection in interrupt mode.
* @note Interrupt will be disabled for all channels
* @param hdfsdm_channel DFSDM channel handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t channel;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop short circuit detection */
hdfsdm_channel->Instance->CHCFGR1 &= ~(DFSDM_CHCFGR1_SCDEN);
/* Clear short circuit detection flag */
channel = DFSDM_GetChannelFromInstance(hdfsdm_channel->Instance);
DFSDM1_Filter0->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
/* Disable short circuit detection interrupt */
DFSDM1_Filter0->FLTCR2 &= ~(DFSDM_FLTCR2_SCDIE);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to get channel analog watchdog value.
* @param hdfsdm_channel DFSDM channel handle.
* @retval Channel analog watchdog value.
*/
int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
return (int16_t) hdfsdm_channel->Instance->CHWDATAR;
}
/**
* @brief This function allows to modify channel offset value.
* @param hdfsdm_channel DFSDM channel handle.
* @param Offset DFSDM channel offset.
* This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
int32_t Offset)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_CHANNEL_ALL_INSTANCE(hdfsdm_channel->Instance));
assert_param(IS_DFSDM_CHANNEL_OFFSET(Offset));
/* Check DFSDM channel state */
if (hdfsdm_channel->State != HAL_DFSDM_CHANNEL_STATE_READY)
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Modify channel offset */
hdfsdm_channel->Instance->CHCFGR2 &= ~(DFSDM_CHCFGR2_OFFSET);
hdfsdm_channel->Instance->CHCFGR2 |= ((uint32_t) Offset << DFSDM_CHCFGR2_OFFSET_Pos);
}
/* Return function status */
return status;
}
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
* @brief Channel state function
*
@verbatim
==============================================================================
##### Channel state function #####
==============================================================================
[..] This section provides function allowing to:
(+) Get channel handle state.
@endverbatim
* @{
*/
/**
* @brief This function allows to get the current DFSDM channel handle state.
* @param hdfsdm_channel DFSDM channel handle.
* @retval DFSDM channel state.
*/
HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel)
{
/* Return DFSDM channel handle state */
return hdfsdm_channel->State;
}
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
* @brief Filter initialization and de-initialization functions
*
@verbatim
==============================================================================
##### Filter initialization and de-initialization functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Initialize the DFSDM filter.
(+) De-initialize the DFSDM filter.
@endverbatim
* @{
*/
/**
* @brief Initialize the DFSDM filter according to the specified parameters
* in the DFSDM_FilterInitTypeDef structure and initialize the associated handle.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Check DFSDM Channel handle */
if (hdfsdm_filter == NULL)
{
return HAL_ERROR;
}
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(IS_DFSDM_FILTER_REG_TRIGGER(hdfsdm_filter->Init.RegularParam.Trigger));
assert_param(IS_FUNCTIONAL_STATE(hdfsdm_filter->Init.RegularParam.FastMode));
assert_param(IS_FUNCTIONAL_STATE(hdfsdm_filter->Init.RegularParam.DmaMode));
assert_param(IS_DFSDM_FILTER_INJ_TRIGGER(hdfsdm_filter->Init.InjectedParam.Trigger));
assert_param(IS_FUNCTIONAL_STATE(hdfsdm_filter->Init.InjectedParam.ScanMode));
assert_param(IS_FUNCTIONAL_STATE(hdfsdm_filter->Init.InjectedParam.DmaMode));
assert_param(IS_DFSDM_FILTER_SINC_ORDER(hdfsdm_filter->Init.FilterParam.SincOrder));
assert_param(IS_DFSDM_FILTER_OVS_RATIO(hdfsdm_filter->Init.FilterParam.Oversampling));
assert_param(IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(hdfsdm_filter->Init.FilterParam.IntOversampling));
/* Check parameters compatibility */
if ((hdfsdm_filter->Instance == DFSDM1_Filter0) &&
((hdfsdm_filter->Init.RegularParam.Trigger == DFSDM_FILTER_SYNC_TRIGGER) ||
(hdfsdm_filter->Init.InjectedParam.Trigger == DFSDM_FILTER_SYNC_TRIGGER)))
{
return HAL_ERROR;
}
/* Initialize DFSDM filter variables with default values */
hdfsdm_filter->RegularContMode = DFSDM_CONTINUOUS_CONV_OFF;
hdfsdm_filter->InjectedChannelsNbr = 1;
hdfsdm_filter->InjConvRemaining = 1;
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_NONE;
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
/* Reset callback pointers to the weak predefined callbacks */
hdfsdm_filter->AwdCallback = HAL_DFSDM_FilterAwdCallback;
hdfsdm_filter->RegConvCpltCallback = HAL_DFSDM_FilterRegConvCpltCallback;
hdfsdm_filter->RegConvHalfCpltCallback = HAL_DFSDM_FilterRegConvHalfCpltCallback;
hdfsdm_filter->InjConvCpltCallback = HAL_DFSDM_FilterInjConvCpltCallback;
hdfsdm_filter->InjConvHalfCpltCallback = HAL_DFSDM_FilterInjConvHalfCpltCallback;
hdfsdm_filter->ErrorCallback = HAL_DFSDM_FilterErrorCallback;
/* Call MSP init function */
if (hdfsdm_filter->MspInitCallback == NULL)
{
hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
}
hdfsdm_filter->MspInitCallback(hdfsdm_filter);
#else
/* Call MSP init function */
HAL_DFSDM_FilterMspInit(hdfsdm_filter);
#endif
/* Set regular parameters */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RSYNC);
if (hdfsdm_filter->Init.RegularParam.FastMode == ENABLE)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_FAST;
}
else
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_FAST);
}
if (hdfsdm_filter->Init.RegularParam.DmaMode == ENABLE)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RDMAEN;
}
else
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RDMAEN);
}
/* Set injected parameters */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JSYNC | DFSDM_FLTCR1_JEXTEN | DFSDM_FLTCR1_JEXTSEL);
if (hdfsdm_filter->Init.InjectedParam.Trigger == DFSDM_FILTER_EXT_TRIGGER)
{
assert_param(IS_DFSDM_FILTER_EXT_TRIG(hdfsdm_filter->Init.InjectedParam.ExtTrigger));
assert_param(IS_DFSDM_FILTER_EXT_TRIG_EDGE(hdfsdm_filter->Init.InjectedParam.ExtTriggerEdge));
hdfsdm_filter->Instance->FLTCR1 |= (hdfsdm_filter->Init.InjectedParam.ExtTrigger);
}
if (hdfsdm_filter->Init.InjectedParam.ScanMode == ENABLE)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSCAN;
}
else
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JSCAN);
}
if (hdfsdm_filter->Init.InjectedParam.DmaMode == ENABLE)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JDMAEN;
}
else
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JDMAEN);
}
/* Set filter parameters */
hdfsdm_filter->Instance->FLTFCR &= ~(DFSDM_FLTFCR_FORD | DFSDM_FLTFCR_FOSR | DFSDM_FLTFCR_IOSR);
hdfsdm_filter->Instance->FLTFCR |= (hdfsdm_filter->Init.FilterParam.SincOrder |
((hdfsdm_filter->Init.FilterParam.Oversampling - 1U) << DFSDM_FLTFCR_FOSR_Pos) |
(hdfsdm_filter->Init.FilterParam.IntOversampling - 1U));
/* Store regular and injected triggers and injected scan mode*/
hdfsdm_filter->RegularTrigger = hdfsdm_filter->Init.RegularParam.Trigger;
hdfsdm_filter->InjectedTrigger = hdfsdm_filter->Init.InjectedParam.Trigger;
hdfsdm_filter->ExtTriggerEdge = hdfsdm_filter->Init.InjectedParam.ExtTriggerEdge;
hdfsdm_filter->InjectedScanMode = hdfsdm_filter->Init.InjectedParam.ScanMode;
/* Enable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
/* Set DFSDM filter to ready state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_READY;
return HAL_OK;
}
/**
* @brief De-initializes the DFSDM filter.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Check DFSDM filter handle */
if (hdfsdm_filter == NULL)
{
return HAL_ERROR;
}
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Disable the DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
/* Call MSP deinit function */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
if (hdfsdm_filter->MspDeInitCallback == NULL)
{
hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
}
hdfsdm_filter->MspDeInitCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterMspDeInit(hdfsdm_filter);
#endif
/* Set DFSDM filter in reset state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_RESET;
return HAL_OK;
}
/**
* @brief Initializes the DFSDM filter MSP.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the function is needed,
the HAL_DFSDM_FilterMspInit could be implemented in the user file.
*/
}
/**
* @brief De-initializes the DFSDM filter MSP.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the function is needed,
the HAL_DFSDM_FilterMspDeInit could be implemented in the user file.
*/
}
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
/**
* @brief Register a user DFSDM filter callback
* to be used instead of the weak predefined callback.
* @param hdfsdm_filter DFSDM filter handle.
* @param CallbackID ID of the callback to be registered.
* This parameter can be one of the following values:
* @arg @ref HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID regular conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID half regular conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID injected conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID half injected conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_ERROR_CB_ID error callback ID.
* @arg @ref HAL_DFSDM_FILTER_MSPINIT_CB_ID MSP init callback ID.
* @arg @ref HAL_DFSDM_FILTER_MSPDEINIT_CB_ID MSP de-init callback ID.
* @param pCallback pointer to the callback function.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
pDFSDM_Filter_CallbackTypeDef pCallback)
{
HAL_StatusTypeDef status = HAL_OK;
if (pCallback == NULL)
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
else
{
if (HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
{
switch (CallbackID)
{
case HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID :
hdfsdm_filter->RegConvCpltCallback = pCallback;
break;
case HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID :
hdfsdm_filter->RegConvHalfCpltCallback = pCallback;
break;
case HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID :
hdfsdm_filter->InjConvCpltCallback = pCallback;
break;
case HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID :
hdfsdm_filter->InjConvHalfCpltCallback = pCallback;
break;
case HAL_DFSDM_FILTER_ERROR_CB_ID :
hdfsdm_filter->ErrorCallback = pCallback;
break;
case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
hdfsdm_filter->MspInitCallback = pCallback;
break;
case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
hdfsdm_filter->MspDeInitCallback = pCallback;
break;
default :
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
break;
}
}
else if (HAL_DFSDM_FILTER_STATE_RESET == hdfsdm_filter->State)
{
switch (CallbackID)
{
case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
hdfsdm_filter->MspInitCallback = pCallback;
break;
case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
hdfsdm_filter->MspDeInitCallback = pCallback;
break;
default :
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
break;
}
}
else
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
}
return status;
}
/**
* @brief Unregister a user DFSDM filter callback.
* DFSDM filter callback is redirected to the weak predefined callback.
* @param hdfsdm_filter DFSDM filter handle.
* @param CallbackID ID of the callback to be unregistered.
* This parameter can be one of the following values:
* @arg @ref HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID regular conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID half regular conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID injected conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID half injected conversion complete callback ID.
* @arg @ref HAL_DFSDM_FILTER_ERROR_CB_ID error callback ID.
* @arg @ref HAL_DFSDM_FILTER_MSPINIT_CB_ID MSP init callback ID.
* @arg @ref HAL_DFSDM_FILTER_MSPDEINIT_CB_ID MSP de-init callback ID.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID)
{
HAL_StatusTypeDef status = HAL_OK;
if (HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
{
switch (CallbackID)
{
case HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID :
hdfsdm_filter->RegConvCpltCallback = HAL_DFSDM_FilterRegConvCpltCallback;
break;
case HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID :
hdfsdm_filter->RegConvHalfCpltCallback = HAL_DFSDM_FilterRegConvHalfCpltCallback;
break;
case HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID :
hdfsdm_filter->InjConvCpltCallback = HAL_DFSDM_FilterInjConvCpltCallback;
break;
case HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID :
hdfsdm_filter->InjConvHalfCpltCallback = HAL_DFSDM_FilterInjConvHalfCpltCallback;
break;
case HAL_DFSDM_FILTER_ERROR_CB_ID :
hdfsdm_filter->ErrorCallback = HAL_DFSDM_FilterErrorCallback;
break;
case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
break;
case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
break;
default :
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
break;
}
}
else if (HAL_DFSDM_FILTER_STATE_RESET == hdfsdm_filter->State)
{
switch (CallbackID)
{
case HAL_DFSDM_FILTER_MSPINIT_CB_ID :
hdfsdm_filter->MspInitCallback = HAL_DFSDM_FilterMspInit;
break;
case HAL_DFSDM_FILTER_MSPDEINIT_CB_ID :
hdfsdm_filter->MspDeInitCallback = HAL_DFSDM_FilterMspDeInit;
break;
default :
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
break;
}
}
else
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
return status;
}
/**
* @brief Register a user DFSDM filter analog watchdog callback
* to be used instead of the weak predefined callback.
* @param hdfsdm_filter DFSDM filter handle.
* @param pCallback pointer to the DFSDM filter analog watchdog callback function.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
pDFSDM_Filter_AwdCallbackTypeDef pCallback)
{
HAL_StatusTypeDef status = HAL_OK;
if (pCallback == NULL)
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
else
{
if (HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
{
hdfsdm_filter->AwdCallback = pCallback;
}
else
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
}
return status;
}
/**
* @brief Unregister a user DFSDM filter analog watchdog callback.
* DFSDM filter AWD callback is redirected to the weak predefined callback.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status.
*/
HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
if (HAL_DFSDM_FILTER_STATE_READY == hdfsdm_filter->State)
{
hdfsdm_filter->AwdCallback = HAL_DFSDM_FilterAwdCallback;
}
else
{
/* update the error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INVALID_CALLBACK;
/* update return status */
status = HAL_ERROR;
}
return status;
}
#endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
* @brief Filter control functions
*
@verbatim
==============================================================================
##### Filter control functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Select channel and enable/disable continuous mode for regular conversion.
(+) Select channels for injected conversion.
@endverbatim
* @{
*/
/**
* @brief This function allows to select channel and to enable/disable
* continuous mode for regular conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Channel for regular conversion.
* This parameter can be a value of @ref DFSDM_Channel_Selection.
* @param ContinuousMode Enable/disable continuous mode for regular conversion.
* This parameter can be a value of @ref DFSDM_ContinuousMode.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Channel,
uint32_t ContinuousMode)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(IS_DFSDM_REGULAR_CHANNEL(Channel));
assert_param(IS_DFSDM_CONTINUOUS_MODE(ContinuousMode));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_RESET) &&
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Configure channel and continuous mode for regular conversion */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RCH | DFSDM_FLTCR1_RCONT);
if (ContinuousMode == DFSDM_CONTINUOUS_CONV_ON)
{
hdfsdm_filter->Instance->FLTCR1 |= (uint32_t)(((Channel & DFSDM_MSB_MASK) << DFSDM_FLTCR1_MSB_RCH_OFFSET) |
DFSDM_FLTCR1_RCONT);
}
else
{
hdfsdm_filter->Instance->FLTCR1 |= (uint32_t)((Channel & DFSDM_MSB_MASK) << DFSDM_FLTCR1_MSB_RCH_OFFSET);
}
/* Store continuous mode information */
hdfsdm_filter->RegularContMode = ContinuousMode;
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to select channels for injected conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Channels for injected conversion.
* This parameter can be a values combination of @ref DFSDM_Channel_Selection.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Channel)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(IS_DFSDM_INJECTED_CHANNEL(Channel));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_RESET) &&
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Configure channel for injected conversion */
hdfsdm_filter->Instance->FLTJCHGR = (uint32_t)(Channel & DFSDM_LSB_MASK);
/* Store number of injected channels */
hdfsdm_filter->InjectedChannelsNbr = DFSDM_GetInjChannelsNbr(Channel);
/* Update number of injected channels remaining */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
* @brief Filter operation functions
*
@verbatim
==============================================================================
##### Filter operation functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Start conversion of regular/injected channel.
(+) Poll for the end of regular/injected conversion.
(+) Stop conversion of regular/injected channel.
(+) Start conversion of regular/injected channel and enable interrupt.
(+) Call the callback functions at the end of regular/injected conversions.
(+) Stop conversion of regular/injected channel and disable interrupt.
(+) Start conversion of regular/injected channel and enable DMA transfer.
(+) Stop conversion of regular/injected channel and disable DMA transfer.
(+) Start analog watchdog and enable interrupt.
(+) Call the callback function when analog watchdog occurs.
(+) Stop analog watchdog and disable interrupt.
(+) Start extreme detector.
(+) Stop extreme detector.
(+) Get result of regular channel conversion.
(+) Get result of injected channel conversion.
(+) Get extreme detector maximum and minimum values.
(+) Get conversion time.
(+) Handle DFSDM interrupt request.
@endverbatim
* @{
*/
/**
* @brief This function allows to start regular conversion in polling mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
{
/* Start regular conversion */
DFSDM_RegConvStart(hdfsdm_filter);
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to poll for the end of regular conversion.
* @note This function should be called only if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @param Timeout Timeout value in milliseconds.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Timeout)
{
uint32_t tickstart;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
return HAL_ERROR;
}
else
{
/* Get timeout */
tickstart = HAL_GetTick();
/* Wait end of regular conversion */
while ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_REOCF) != DFSDM_FLTISR_REOCF)
{
/* Check the Timeout */
if (Timeout != HAL_MAX_DELAY)
{
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
{
/* Return timeout status */
return HAL_TIMEOUT;
}
}
}
/* Check if overrun occurs */
if ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_ROVRF) == DFSDM_FLTISR_ROVRF)
{
/* Update error code and call error callback */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_REGULAR_OVERRUN;
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->ErrorCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
#endif
/* Clear regular overrun flag */
hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRROVRF;
}
/* Update DFSDM filter state only if not continuous conversion and SW trigger */
if ((hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
{
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_INJ;
}
/* Return function status */
return HAL_OK;
}
}
/**
* @brief This function allows to stop regular conversion in polling mode.
* @note This function should be called only if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop regular conversion */
DFSDM_RegConvStop(hdfsdm_filter);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start regular conversion in interrupt mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
{
/* Enable interrupts for regular conversions */
hdfsdm_filter->Instance->FLTCR2 |= (DFSDM_FLTCR2_REOCIE | DFSDM_FLTCR2_ROVRIE);
/* Start regular conversion */
DFSDM_RegConvStart(hdfsdm_filter);
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop regular conversion in interrupt mode.
* @note This function should be called only if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Disable interrupts for regular conversions */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_REOCIE | DFSDM_FLTCR2_ROVRIE);
/* Stop regular conversion */
DFSDM_RegConvStop(hdfsdm_filter);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start regular conversion in DMA mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if injected conversion is ongoing.
* Please note that data on buffer will contain signed regular conversion
* value on 24 most significant bits and corresponding channel on 3 least
* significant bits.
* @param hdfsdm_filter DFSDM filter handle.
* @param pData The destination buffer address.
* @param Length The length of data to be transferred from DFSDM filter to memory.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
int32_t *pData,
uint32_t Length)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check destination address and length */
if ((pData == NULL) || (Length == 0U))
{
status = HAL_ERROR;
}
/* Check that DMA is enabled for regular conversion */
else if ((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_RDMAEN) != DFSDM_FLTCR1_RDMAEN)
{
status = HAL_ERROR;
}
/* Check parameters compatibility */
else if ((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->hdmaReg->Init.Mode == DMA_NORMAL) && \
(Length != 1U))
{
status = HAL_ERROR;
}
else if ((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR))
{
status = HAL_ERROR;
}
/* Check DFSDM filter state */
else if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
{
/* Set callbacks on DMA handler */
hdfsdm_filter->hdmaReg->XferCpltCallback = DFSDM_DMARegularConvCplt;
hdfsdm_filter->hdmaReg->XferErrorCallback = DFSDM_DMAError;
hdfsdm_filter->hdmaReg->XferHalfCpltCallback = (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR) ? \
DFSDM_DMARegularHalfConvCplt : NULL;
/* Start DMA in interrupt mode */
if (HAL_DMA_Start_IT(hdfsdm_filter->hdmaReg, (uint32_t)&hdfsdm_filter->Instance->FLTRDATAR, \
(uint32_t) pData, Length) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Start regular conversion */
DFSDM_RegConvStart(hdfsdm_filter);
}
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start regular conversion in DMA mode and to get
* only the 16 most significant bits of conversion.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if injected conversion is ongoing.
* Please note that data on buffer will contain signed 16 most significant
* bits of regular conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @param pData The destination buffer address.
* @param Length The length of data to be transferred from DFSDM filter to memory.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
int16_t *pData,
uint32_t Length)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check destination address and length */
if ((pData == NULL) || (Length == 0U))
{
status = HAL_ERROR;
}
/* Check that DMA is enabled for regular conversion */
else if ((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_RDMAEN) != DFSDM_FLTCR1_RDMAEN)
{
status = HAL_ERROR;
}
/* Check parameters compatibility */
else if ((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->hdmaReg->Init.Mode == DMA_NORMAL) && \
(Length != 1U))
{
status = HAL_ERROR;
}
else if ((hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR))
{
status = HAL_ERROR;
}
/* Check DFSDM filter state */
else if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ))
{
/* Set callbacks on DMA handler */
hdfsdm_filter->hdmaReg->XferCpltCallback = DFSDM_DMARegularConvCplt;
hdfsdm_filter->hdmaReg->XferErrorCallback = DFSDM_DMAError;
hdfsdm_filter->hdmaReg->XferHalfCpltCallback = (hdfsdm_filter->hdmaReg->Init.Mode == DMA_CIRCULAR) ? \
DFSDM_DMARegularHalfConvCplt : NULL;
/* Start DMA in interrupt mode */
if (HAL_DMA_Start_IT(hdfsdm_filter->hdmaReg, (uint32_t)(&hdfsdm_filter->Instance->FLTRDATAR) + 2U, \
(uint32_t) pData, Length) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Start regular conversion */
DFSDM_RegConvStart(hdfsdm_filter);
}
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop regular conversion in DMA mode.
* @note This function should be called only if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop current DMA transfer */
if (HAL_DMA_Abort(hdfsdm_filter->hdmaReg) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Stop regular conversion */
DFSDM_RegConvStop(hdfsdm_filter);
}
}
/* Return function status */
return status;
}
/**
* @brief This function allows to get regular conversion value.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Corresponding channel of regular conversion.
* @retval Regular conversion value
*/
int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t *Channel)
{
uint32_t reg;
int32_t value;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(Channel != (void *)0);
/* Get value of data register for regular channel */
reg = hdfsdm_filter->Instance->FLTRDATAR;
/* Extract channel and regular conversion value */
*Channel = (reg & DFSDM_FLTRDATAR_RDATACH);
/* Regular conversion value is a signed value located on 24 MSB of register */
/* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
reg &= DFSDM_FLTRDATAR_RDATA;
value = ((int32_t)reg) / 256;
/* return regular conversion value */
return value;
}
/**
* @brief This function allows to start injected conversion in polling mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
{
/* Start injected conversion */
DFSDM_InjConvStart(hdfsdm_filter);
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to poll for the end of injected conversion.
* @note This function should be called only if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @param Timeout Timeout value in milliseconds.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Timeout)
{
uint32_t tickstart;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
return HAL_ERROR;
}
else
{
/* Get timeout */
tickstart = HAL_GetTick();
/* Wait end of injected conversions */
while ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_JEOCF) != DFSDM_FLTISR_JEOCF)
{
/* Check the Timeout */
if (Timeout != HAL_MAX_DELAY)
{
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
{
/* Return timeout status */
return HAL_TIMEOUT;
}
}
}
/* Check if overrun occurs */
if ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_JOVRF) == DFSDM_FLTISR_JOVRF)
{
/* Update error code and call error callback */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INJECTED_OVERRUN;
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->ErrorCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
#endif
/* Clear injected overrun flag */
hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRJOVRF;
}
/* Update remaining injected conversions */
hdfsdm_filter->InjConvRemaining--;
if (hdfsdm_filter->InjConvRemaining == 0U)
{
/* Update DFSDM filter state only if trigger is software */
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
{
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_REG;
}
/* end of injected sequence, reset the value */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
}
/* Return function status */
return HAL_OK;
}
}
/**
* @brief This function allows to stop injected conversion in polling mode.
* @note This function should be called only if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop injected conversion */
DFSDM_InjConvStop(hdfsdm_filter);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start injected conversion in interrupt mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if regular conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
{
/* Enable interrupts for injected conversions */
hdfsdm_filter->Instance->FLTCR2 |= (DFSDM_FLTCR2_JEOCIE | DFSDM_FLTCR2_JOVRIE);
/* Start injected conversion */
DFSDM_InjConvStart(hdfsdm_filter);
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop injected conversion in interrupt mode.
* @note This function should be called only if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Disable interrupts for injected conversions */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_JEOCIE | DFSDM_FLTCR2_JOVRIE);
/* Stop injected conversion */
DFSDM_InjConvStop(hdfsdm_filter);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start injected conversion in DMA mode.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if regular conversion is ongoing.
* Please note that data on buffer will contain signed injected conversion
* value on 24 most significant bits and corresponding channel on 3 least
* significant bits.
* @param hdfsdm_filter DFSDM filter handle.
* @param pData The destination buffer address.
* @param Length The length of data to be transferred from DFSDM filter to memory.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
int32_t *pData,
uint32_t Length)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check destination address and length */
if ((pData == NULL) || (Length == 0U))
{
status = HAL_ERROR;
}
/* Check that DMA is enabled for injected conversion */
else if ((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_JDMAEN) != DFSDM_FLTCR1_JDMAEN)
{
status = HAL_ERROR;
}
/* Check parameters compatibility */
else if ((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->hdmaInj->Init.Mode == DMA_NORMAL) && \
(Length > hdfsdm_filter->InjConvRemaining))
{
status = HAL_ERROR;
}
else if ((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR))
{
status = HAL_ERROR;
}
/* Check DFSDM filter state */
else if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
{
/* Set callbacks on DMA handler */
hdfsdm_filter->hdmaInj->XferCpltCallback = DFSDM_DMAInjectedConvCplt;
hdfsdm_filter->hdmaInj->XferErrorCallback = DFSDM_DMAError;
hdfsdm_filter->hdmaInj->XferHalfCpltCallback = (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR) ? \
DFSDM_DMAInjectedHalfConvCplt : NULL;
/* Start DMA in interrupt mode */
if (HAL_DMA_Start_IT(hdfsdm_filter->hdmaInj, (uint32_t)&hdfsdm_filter->Instance->FLTJDATAR, \
(uint32_t) pData, Length) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Start injected conversion */
DFSDM_InjConvStart(hdfsdm_filter);
}
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start injected conversion in DMA mode and to get
* only the 16 most significant bits of conversion.
* @note This function should be called only when DFSDM filter instance is
* in idle state or if regular conversion is ongoing.
* Please note that data on buffer will contain signed 16 most significant
* bits of injected conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @param pData The destination buffer address.
* @param Length The length of data to be transferred from DFSDM filter to memory.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
int16_t *pData,
uint32_t Length)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check destination address and length */
if ((pData == NULL) || (Length == 0U))
{
status = HAL_ERROR;
}
/* Check that DMA is enabled for injected conversion */
else if ((hdfsdm_filter->Instance->FLTCR1 & DFSDM_FLTCR1_JDMAEN) != DFSDM_FLTCR1_JDMAEN)
{
status = HAL_ERROR;
}
/* Check parameters compatibility */
else if ((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->hdmaInj->Init.Mode == DMA_NORMAL) && \
(Length > hdfsdm_filter->InjConvRemaining))
{
status = HAL_ERROR;
}
else if ((hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER) && \
(hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR))
{
status = HAL_ERROR;
}
/* Check DFSDM filter state */
else if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG))
{
/* Set callbacks on DMA handler */
hdfsdm_filter->hdmaInj->XferCpltCallback = DFSDM_DMAInjectedConvCplt;
hdfsdm_filter->hdmaInj->XferErrorCallback = DFSDM_DMAError;
hdfsdm_filter->hdmaInj->XferHalfCpltCallback = (hdfsdm_filter->hdmaInj->Init.Mode == DMA_CIRCULAR) ? \
DFSDM_DMAInjectedHalfConvCplt : NULL;
/* Start DMA in interrupt mode */
if (HAL_DMA_Start_IT(hdfsdm_filter->hdmaInj, (uint32_t)(&hdfsdm_filter->Instance->FLTJDATAR) + 2U, \
(uint32_t) pData, Length) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Start injected conversion */
DFSDM_InjConvStart(hdfsdm_filter);
}
}
else
{
status = HAL_ERROR;
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop injected conversion in DMA mode.
* @note This function should be called only if injected conversion is ongoing.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_INJ) && \
(hdfsdm_filter->State != HAL_DFSDM_FILTER_STATE_REG_INJ))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Stop current DMA transfer */
if (HAL_DMA_Abort(hdfsdm_filter->hdmaInj) != HAL_OK)
{
/* Set DFSDM filter in error state */
hdfsdm_filter->State = HAL_DFSDM_FILTER_STATE_ERROR;
status = HAL_ERROR;
}
else
{
/* Stop regular conversion */
DFSDM_InjConvStop(hdfsdm_filter);
}
}
/* Return function status */
return status;
}
/**
* @brief This function allows to get injected conversion value.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Corresponding channel of injected conversion.
* @retval Injected conversion value
*/
int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t *Channel)
{
uint32_t reg;
int32_t value;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(Channel != (void *)0);
/* Get value of data register for injected channel */
reg = hdfsdm_filter->Instance->FLTJDATAR;
/* Extract channel and injected conversion value */
*Channel = (reg & DFSDM_FLTJDATAR_JDATACH);
/* Injected conversion value is a signed value located on 24 MSB of register */
/* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
reg &= DFSDM_FLTJDATAR_JDATA;
value = ((int32_t)reg) / 256;
/* return regular conversion value */
return value;
}
/**
* @brief This function allows to start filter analog watchdog in interrupt mode.
* @param hdfsdm_filter DFSDM filter handle.
* @param awdParam DFSDM filter analog watchdog parameters.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
DFSDM_Filter_AwdParamTypeDef *awdParam)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(IS_DFSDM_FILTER_AWD_DATA_SOURCE(awdParam->DataSource));
assert_param(IS_DFSDM_INJECTED_CHANNEL(awdParam->Channel));
assert_param(IS_DFSDM_FILTER_AWD_THRESHOLD(awdParam->HighThreshold));
assert_param(IS_DFSDM_FILTER_AWD_THRESHOLD(awdParam->LowThreshold));
assert_param(IS_DFSDM_BREAK_SIGNALS(awdParam->HighBreakSignal));
assert_param(IS_DFSDM_BREAK_SIGNALS(awdParam->LowBreakSignal));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Set analog watchdog data source */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_AWFSEL);
hdfsdm_filter->Instance->FLTCR1 |= awdParam->DataSource;
/* Set thresholds and break signals */
hdfsdm_filter->Instance->FLTAWHTR &= ~(DFSDM_FLTAWHTR_AWHT | DFSDM_FLTAWHTR_BKAWH);
hdfsdm_filter->Instance->FLTAWHTR |= (((uint32_t) awdParam->HighThreshold << DFSDM_FLTAWHTR_AWHT_Pos) | \
awdParam->HighBreakSignal);
hdfsdm_filter->Instance->FLTAWLTR &= ~(DFSDM_FLTAWLTR_AWLT | DFSDM_FLTAWLTR_BKAWL);
hdfsdm_filter->Instance->FLTAWLTR |= (((uint32_t) awdParam->LowThreshold << DFSDM_FLTAWLTR_AWLT_Pos) | \
awdParam->LowBreakSignal);
/* Set channels and interrupt for analog watchdog */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_AWDCH);
hdfsdm_filter->Instance->FLTCR2 |= (((awdParam->Channel & DFSDM_LSB_MASK) << DFSDM_FLTCR2_AWDCH_Pos) | \
DFSDM_FLTCR2_AWDIE);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop filter analog watchdog in interrupt mode.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Reset channels for analog watchdog and deactivate interrupt */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_AWDCH | DFSDM_FLTCR2_AWDIE);
/* Clear all analog watchdog flags */
hdfsdm_filter->Instance->FLTAWCFR = (DFSDM_FLTAWCFR_CLRAWHTF | DFSDM_FLTAWCFR_CLRAWLTF);
/* Reset thresholds and break signals */
hdfsdm_filter->Instance->FLTAWHTR &= ~(DFSDM_FLTAWHTR_AWHT | DFSDM_FLTAWHTR_BKAWH);
hdfsdm_filter->Instance->FLTAWLTR &= ~(DFSDM_FLTAWLTR_AWLT | DFSDM_FLTAWLTR_BKAWL);
/* Reset analog watchdog data source */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_AWFSEL);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to start extreme detector feature.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Channels where extreme detector is enabled.
* This parameter can be a values combination of @ref DFSDM_Channel_Selection.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Channel)
{
HAL_StatusTypeDef status = HAL_OK;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(IS_DFSDM_INJECTED_CHANNEL(Channel));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Set channels for extreme detector */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_EXCH);
hdfsdm_filter->Instance->FLTCR2 |= ((Channel & DFSDM_LSB_MASK) << DFSDM_FLTCR2_EXCH_Pos);
}
/* Return function status */
return status;
}
/**
* @brief This function allows to stop extreme detector feature.
* @param hdfsdm_filter DFSDM filter handle.
* @retval HAL status
*/
HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
HAL_StatusTypeDef status = HAL_OK;
__IO uint32_t reg1;
__IO uint32_t reg2;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Check DFSDM filter state */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_RESET) || \
(hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_ERROR))
{
/* Return error status */
status = HAL_ERROR;
}
else
{
/* Reset channels for extreme detector */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_EXCH);
/* Clear extreme detector values */
reg1 = hdfsdm_filter->Instance->FLTEXMAX;
reg2 = hdfsdm_filter->Instance->FLTEXMIN;
UNUSED(reg1); /* To avoid GCC warning */
UNUSED(reg2); /* To avoid GCC warning */
}
/* Return function status */
return status;
}
/**
* @brief This function allows to get extreme detector maximum value.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Corresponding channel.
* @retval Extreme detector maximum value
* This value is between Min_Data = -8388608 and Max_Data = 8388607.
*/
int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t *Channel)
{
uint32_t reg;
int32_t value;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(Channel != (void *)0);
/* Get value of extreme detector maximum register */
reg = hdfsdm_filter->Instance->FLTEXMAX;
/* Extract channel and extreme detector maximum value */
*Channel = (reg & DFSDM_FLTEXMAX_EXMAXCH);
/* Extreme detector maximum value is a signed value located on 24 MSB of register */
/* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
reg &= DFSDM_FLTEXMAX_EXMAX;
value = ((int32_t)reg) / 256;
/* return extreme detector maximum value */
return value;
}
/**
* @brief This function allows to get extreme detector minimum value.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Corresponding channel.
* @retval Extreme detector minimum value
* This value is between Min_Data = -8388608 and Max_Data = 8388607.
*/
int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t *Channel)
{
uint32_t reg;
int32_t value;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
assert_param(Channel != (void *)0);
/* Get value of extreme detector minimum register */
reg = hdfsdm_filter->Instance->FLTEXMIN;
/* Extract channel and extreme detector minimum value */
*Channel = (reg & DFSDM_FLTEXMIN_EXMINCH);
/* Extreme detector minimum value is a signed value located on 24 MSB of register */
/* So after applying a mask on these bits we have to perform a division by 256 (2 raised to the power of 8) */
reg &= DFSDM_FLTEXMIN_EXMIN;
value = ((int32_t)reg) / 256;
/* return extreme detector minimum value */
return value;
}
/**
* @brief This function allows to get conversion time value.
* @param hdfsdm_filter DFSDM filter handle.
* @retval Conversion time value
* @note To get time in second, this value has to be divided by DFSDM clock frequency.
*/
uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
uint32_t reg;
uint32_t value;
/* Check parameters */
assert_param(IS_DFSDM_FILTER_ALL_INSTANCE(hdfsdm_filter->Instance));
/* Get value of conversion timer register */
reg = hdfsdm_filter->Instance->FLTCNVTIMR;
/* Extract conversion time value */
value = ((reg & DFSDM_FLTCNVTIMR_CNVCNT) >> DFSDM_FLTCNVTIMR_CNVCNT_Pos);
/* return extreme detector minimum value */
return value;
}
/**
* @brief This function handles the DFSDM interrupts.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Get FTLISR and FLTCR2 register values */
const uint32_t temp_fltisr = hdfsdm_filter->Instance->FLTISR;
const uint32_t temp_fltcr2 = hdfsdm_filter->Instance->FLTCR2;
/* Check if overrun occurs during regular conversion */
if (((temp_fltisr & DFSDM_FLTISR_ROVRF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_ROVRIE) != 0U))
{
/* Clear regular overrun flag */
hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRROVRF;
/* Update error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_REGULAR_OVERRUN;
/* Call error callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->ErrorCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
#endif
}
/* Check if overrun occurs during injected conversion */
else if (((temp_fltisr & DFSDM_FLTISR_JOVRF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_JOVRIE) != 0U))
{
/* Clear injected overrun flag */
hdfsdm_filter->Instance->FLTICR = DFSDM_FLTICR_CLRJOVRF;
/* Update error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_INJECTED_OVERRUN;
/* Call error callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->ErrorCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
#endif
}
/* Check if end of regular conversion */
else if (((temp_fltisr & DFSDM_FLTISR_REOCF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_REOCIE) != 0U))
{
/* Call regular conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->RegConvCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterRegConvCpltCallback(hdfsdm_filter);
#endif
/* End of conversion if mode is not continuous and software trigger */
if ((hdfsdm_filter->RegularContMode == DFSDM_CONTINUOUS_CONV_OFF) && \
(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
{
/* Disable interrupts for regular conversions */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_REOCIE);
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_INJ;
}
}
/* Check if end of injected conversion */
else if (((temp_fltisr & DFSDM_FLTISR_JEOCF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_JEOCIE) != 0U))
{
/* Call injected conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->InjConvCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterInjConvCpltCallback(hdfsdm_filter);
#endif
/* Update remaining injected conversions */
hdfsdm_filter->InjConvRemaining--;
if (hdfsdm_filter->InjConvRemaining == 0U)
{
/* End of conversion if trigger is software */
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
{
/* Disable interrupts for injected conversions */
hdfsdm_filter->Instance->FLTCR2 &= ~(DFSDM_FLTCR2_JEOCIE);
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_REG;
}
/* end of injected sequence, reset the value */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
}
}
/* Check if analog watchdog occurs */
else if (((temp_fltisr & DFSDM_FLTISR_AWDF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_AWDIE) != 0U))
{
uint32_t reg;
uint32_t threshold;
uint32_t channel = 0;
/* Get channel and threshold */
reg = hdfsdm_filter->Instance->FLTAWSR;
threshold = ((reg & DFSDM_FLTAWSR_AWLTF) != 0U) ? DFSDM_AWD_LOW_THRESHOLD : DFSDM_AWD_HIGH_THRESHOLD;
if (threshold == DFSDM_AWD_HIGH_THRESHOLD)
{
reg = reg >> DFSDM_FLTAWSR_AWHTF_Pos;
}
while (((reg & 1U) == 0U) && (channel < (DFSDM1_CHANNEL_NUMBER - 1U)))
{
channel++;
reg = reg >> 1;
}
/* Clear analog watchdog flag */
hdfsdm_filter->Instance->FLTAWCFR = (threshold == DFSDM_AWD_HIGH_THRESHOLD) ? \
(1UL << (DFSDM_FLTAWSR_AWHTF_Pos + channel)) : \
(1UL << channel);
/* Call analog watchdog callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->AwdCallback(hdfsdm_filter, channel, threshold);
#else
HAL_DFSDM_FilterAwdCallback(hdfsdm_filter, channel, threshold);
#endif
}
/* Check if clock absence occurs */
else if ((hdfsdm_filter->Instance == DFSDM1_Filter0) && \
((temp_fltisr & DFSDM_FLTISR_CKABF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_CKABIE) != 0U))
{
uint32_t reg;
uint32_t channel = 0;
reg = ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_CKABF) >> DFSDM_FLTISR_CKABF_Pos);
while (channel < DFSDM1_CHANNEL_NUMBER)
{
/* Check if flag is set and corresponding channel is enabled */
if (((reg & 1U) != 0U) && (a_dfsdm1ChannelHandle[channel] != NULL))
{
/* Check clock absence has been enabled for this channel */
if ((a_dfsdm1ChannelHandle[channel]->Instance->CHCFGR1 & DFSDM_CHCFGR1_CKABEN) != 0U)
{
/* Clear clock absence flag */
hdfsdm_filter->Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRCKABF_Pos + channel));
/* Call clock absence callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
a_dfsdm1ChannelHandle[channel]->CkabCallback(a_dfsdm1ChannelHandle[channel]);
#else
HAL_DFSDM_ChannelCkabCallback(a_dfsdm1ChannelHandle[channel]);
#endif
}
}
channel++;
reg = reg >> 1;
}
}
/* Check if short circuit detection occurs */
else if ((hdfsdm_filter->Instance == DFSDM1_Filter0) && \
((temp_fltisr & DFSDM_FLTISR_SCDF) != 0U) && \
((temp_fltcr2 & DFSDM_FLTCR2_SCDIE) != 0U))
{
uint32_t reg;
uint32_t channel = 0;
/* Get channel */
reg = ((hdfsdm_filter->Instance->FLTISR & DFSDM_FLTISR_SCDF) >> DFSDM_FLTISR_SCDF_Pos);
while (((reg & 1U) == 0U) && (channel < (DFSDM1_CHANNEL_NUMBER - 1U)))
{
channel++;
reg = reg >> 1;
}
/* Clear short circuit detection flag */
hdfsdm_filter->Instance->FLTICR = (1UL << (DFSDM_FLTICR_CLRSCDF_Pos + channel));
/* Call short circuit detection callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
a_dfsdm1ChannelHandle[channel]->ScdCallback(a_dfsdm1ChannelHandle[channel]);
#else
HAL_DFSDM_ChannelScdCallback(a_dfsdm1ChannelHandle[channel]);
#endif
}
}
/**
* @brief Regular conversion complete callback.
* @note In interrupt mode, user has to read conversion value in this function
* using HAL_DFSDM_FilterGetRegularValue.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterRegConvCpltCallback could be implemented in the user file.
*/
}
/**
* @brief Half regular conversion complete callback.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterRegConvHalfCpltCallback could be implemented in the user file.
*/
}
/**
* @brief Injected conversion complete callback.
* @note In interrupt mode, user has to read conversion value in this function
* using HAL_DFSDM_FilterGetInjectedValue.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterInjConvCpltCallback could be implemented in the user file.
*/
}
/**
* @brief Half injected conversion complete callback.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterInjConvHalfCpltCallback could be implemented in the user file.
*/
}
/**
* @brief Filter analog watchdog callback.
* @param hdfsdm_filter DFSDM filter handle.
* @param Channel Corresponding channel.
* @param Threshold Low or high threshold has been reached.
* @retval None
*/
__weak void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
uint32_t Channel, uint32_t Threshold)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
UNUSED(Channel);
UNUSED(Threshold);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterAwdCallback could be implemented in the user file.
*/
}
/**
* @brief Error callback.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
__weak void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Prevent unused argument(s) compilation warning */
UNUSED(hdfsdm_filter);
/* NOTE : This function should not be modified, when the callback is needed,
the HAL_DFSDM_FilterErrorCallback could be implemented in the user file.
*/
}
/**
* @}
*/
/** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
* @brief Filter state functions
*
@verbatim
==============================================================================
##### Filter state functions #####
==============================================================================
[..] This section provides functions allowing to:
(+) Get the DFSDM filter state.
(+) Get the DFSDM filter error.
@endverbatim
* @{
*/
/**
* @brief This function allows to get the current DFSDM filter handle state.
* @param hdfsdm_filter DFSDM filter handle.
* @retval DFSDM filter state.
*/
HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Return DFSDM filter handle state */
return hdfsdm_filter->State;
}
/**
* @brief This function allows to get the current DFSDM filter error.
* @param hdfsdm_filter DFSDM filter handle.
* @retval DFSDM filter error code.
*/
uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
return hdfsdm_filter->ErrorCode;
}
/**
* @}
*/
/**
* @}
*/
/* End of exported functions -------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/** @addtogroup DFSDM_Private_Functions DFSDM Private Functions
* @{
*/
/**
* @brief DMA half transfer complete callback for regular conversion.
* @param hdma DMA handle.
* @retval None
*/
static void DFSDM_DMARegularHalfConvCplt(DMA_HandleTypeDef *hdma)
{
/* Get DFSDM filter handle */
DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call regular half conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->RegConvHalfCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterRegConvHalfCpltCallback(hdfsdm_filter);
#endif
}
/**
* @brief DMA transfer complete callback for regular conversion.
* @param hdma DMA handle.
* @retval None
*/
static void DFSDM_DMARegularConvCplt(DMA_HandleTypeDef *hdma)
{
/* Get DFSDM filter handle */
DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call regular conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->RegConvCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterRegConvCpltCallback(hdfsdm_filter);
#endif
}
/**
* @brief DMA half transfer complete callback for injected conversion.
* @param hdma DMA handle.
* @retval None
*/
static void DFSDM_DMAInjectedHalfConvCplt(DMA_HandleTypeDef *hdma)
{
/* Get DFSDM filter handle */
DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call injected half conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->InjConvHalfCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterInjConvHalfCpltCallback(hdfsdm_filter);
#endif
}
/**
* @brief DMA transfer complete callback for injected conversion.
* @param hdma DMA handle.
* @retval None
*/
static void DFSDM_DMAInjectedConvCplt(DMA_HandleTypeDef *hdma)
{
/* Get DFSDM filter handle */
DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Call injected conversion complete callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->InjConvCpltCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterInjConvCpltCallback(hdfsdm_filter);
#endif
}
/**
* @brief DMA error callback.
* @param hdma DMA handle.
* @retval None
*/
static void DFSDM_DMAError(DMA_HandleTypeDef *hdma)
{
/* Get DFSDM filter handle */
DFSDM_Filter_HandleTypeDef *hdfsdm_filter = (DFSDM_Filter_HandleTypeDef *)((DMA_HandleTypeDef *)hdma)->Parent;
/* Update error code */
hdfsdm_filter->ErrorCode = DFSDM_FILTER_ERROR_DMA;
/* Call error callback */
#if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
hdfsdm_filter->ErrorCallback(hdfsdm_filter);
#else
HAL_DFSDM_FilterErrorCallback(hdfsdm_filter);
#endif
}
/**
* @brief This function allows to get the number of injected channels.
* @param Channels bitfield of injected channels.
* @retval Number of injected channels.
*/
static uint32_t DFSDM_GetInjChannelsNbr(uint32_t Channels)
{
uint32_t nbChannels = 0;
uint32_t tmp;
/* Get the number of channels from bitfield */
tmp = (uint32_t)(Channels & DFSDM_LSB_MASK);
while (tmp != 0U)
{
if ((tmp & 1U) != 0U)
{
nbChannels++;
}
tmp = (uint32_t)(tmp >> 1);
}
return nbChannels;
}
/**
* @brief This function allows to get the channel number from channel instance.
* @param Instance DFSDM channel instance.
* @retval Channel number.
*/
static uint32_t DFSDM_GetChannelFromInstance(const DFSDM_Channel_TypeDef *Instance)
{
uint32_t channel;
/* Get channel from instance */
if (Instance == DFSDM1_Channel0)
{
channel = 0;
}
else if (Instance == DFSDM1_Channel1)
{
channel = 1;
}
else if (Instance == DFSDM1_Channel2)
{
channel = 2;
}
else if (Instance == DFSDM1_Channel3)
{
channel = 3;
}
#if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \
defined(STM32L496xx) || defined(STM32L4A6xx) || \
defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx)
else if (Instance == DFSDM1_Channel4)
{
channel = 4;
}
else if (Instance == DFSDM1_Channel5)
{
channel = 5;
}
else if (Instance == DFSDM1_Channel6)
{
channel = 6;
}
else if (Instance == DFSDM1_Channel7)
{
channel = 7;
}
#endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || STM32L496xx || STM32L4A6xx || STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
else
{
channel = 0;
}
return channel;
}
/**
* @brief This function allows to really start regular conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
static void DFSDM_RegConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Check regular trigger */
if (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER)
{
/* Software start of regular conversion */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
}
else /* synchronous trigger */
{
/* Disable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
/* Set RSYNC bit in DFSDM_FLTCR1 register */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSYNC;
/* Enable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
/* If injected conversion was in progress, restart it */
if (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ)
{
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
}
/* Update remaining injected conversions */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
}
}
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) ? \
HAL_DFSDM_FILTER_STATE_REG : HAL_DFSDM_FILTER_STATE_REG_INJ;
}
/**
* @brief This function allows to really stop regular conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
static void DFSDM_RegConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Disable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
/* If regular trigger was synchronous, reset RSYNC bit in DFSDM_FLTCR1 register */
if (hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SYNC_TRIGGER)
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_RSYNC);
}
/* Enable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
/* If injected conversion was in progress, restart it */
if (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG_INJ)
{
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
}
/* Update remaining injected conversions */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
}
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_INJ;
}
/**
* @brief This function allows to really start injected conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
static void DFSDM_InjConvStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Check injected trigger */
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SW_TRIGGER)
{
/* Software start of injected conversion */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSWSTART;
}
else /* external or synchronous trigger */
{
/* Disable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SYNC_TRIGGER)
{
/* Set JSYNC bit in DFSDM_FLTCR1 register */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_JSYNC;
}
else /* external trigger */
{
/* Set JEXTEN[1:0] bits in DFSDM_FLTCR1 register */
hdfsdm_filter->Instance->FLTCR1 |= hdfsdm_filter->ExtTriggerEdge;
}
/* Enable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
/* If regular conversion was in progress, restart it */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG) && \
(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
}
}
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_READY) ? \
HAL_DFSDM_FILTER_STATE_INJ : HAL_DFSDM_FILTER_STATE_REG_INJ;
}
/**
* @brief This function allows to really stop injected conversion.
* @param hdfsdm_filter DFSDM filter handle.
* @retval None
*/
static void DFSDM_InjConvStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter)
{
/* Disable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_DFEN);
/* If injected trigger was synchronous, reset JSYNC bit in DFSDM_FLTCR1 register */
if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_SYNC_TRIGGER)
{
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JSYNC);
}
else if (hdfsdm_filter->InjectedTrigger == DFSDM_FILTER_EXT_TRIGGER)
{
/* Reset JEXTEN[1:0] bits in DFSDM_FLTCR1 register */
hdfsdm_filter->Instance->FLTCR1 &= ~(DFSDM_FLTCR1_JEXTEN);
}
else
{
/* Nothing to do */
}
/* Enable DFSDM filter */
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_DFEN;
/* If regular conversion was in progress, restart it */
if ((hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_REG_INJ) && \
(hdfsdm_filter->RegularTrigger == DFSDM_FILTER_SW_TRIGGER))
{
hdfsdm_filter->Instance->FLTCR1 |= DFSDM_FLTCR1_RSWSTART;
}
/* Update remaining injected conversions */
hdfsdm_filter->InjConvRemaining = (hdfsdm_filter->InjectedScanMode == ENABLE) ? \
hdfsdm_filter->InjectedChannelsNbr : 1U;
/* Update DFSDM filter state */
hdfsdm_filter->State = (hdfsdm_filter->State == HAL_DFSDM_FILTER_STATE_INJ) ? \
HAL_DFSDM_FILTER_STATE_READY : HAL_DFSDM_FILTER_STATE_REG;
}
/**
* @}
*/
/* End of private functions --------------------------------------------------*/
/**
* @}
*/
#endif /* STM32L451xx || STM32L452xx || STM32L462xx || STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || STM32L496xx || STM32L4A6xx || STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */
#endif /* HAL_DFSDM_MODULE_ENABLED */
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| apache-2.0 |
ARM-software/mbed-beetle | hal/targets/hal/TARGET_STM/TARGET_STM32F0/serial_api.c | 20 | 13140 | /* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2015, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#include "mbed_assert.h"
#include "serial_api.h"
#if DEVICE_SERIAL
#include "cmsis.h"
#include "pinmap.h"
#include <string.h>
#include "PeripheralPins.h"
#if defined (TARGET_STM32F091RC)
#define UART_NUM (8)
static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0, 0, 0, 0, 0};
#elif defined (TARGET_STM32F030R8) || defined (TARGET_STM32F051R8) || defined (TARGET_STM32F042K6)
#define UART_NUM (2)
static uint32_t serial_irq_ids[UART_NUM] = {0, 0};
#elif defined (TARGET_STM32F031K6)
#define UART_NUM (1)
static uint32_t serial_irq_ids[UART_NUM] = {0};
#else
#define UART_NUM (4)
static uint32_t serial_irq_ids[UART_NUM] = {0, 0, 0, 0};
#endif
static uart_irq_handler irq_handler;
UART_HandleTypeDef UartHandle;
int stdio_uart_inited = 0;
serial_t stdio_uart;
static void init_uart(serial_t *obj) {
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
UartHandle.Init.BaudRate = obj->baudrate;
UartHandle.Init.WordLength = obj->databits;
UartHandle.Init.StopBits = obj->stopbits;
UartHandle.Init.Parity = obj->parity;
UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
if (obj->pin_rx == NC) {
UartHandle.Init.Mode = UART_MODE_TX;
} else if (obj->pin_tx == NC) {
UartHandle.Init.Mode = UART_MODE_RX;
} else {
UartHandle.Init.Mode = UART_MODE_TX_RX;
}
// Disable the reception overrun detection
UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT;
UartHandle.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE;
HAL_UART_Init(&UartHandle);
}
void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Determine the UART to use (UART_1, UART_2, ...)
UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
// Get the peripheral name (UART_1, UART_2, ...) from the pin and assign it to the object
obj->uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
MBED_ASSERT(obj->uart != (UARTName)NC);
// Enable USART clock
if (obj->uart == UART_1) {
__USART1_CLK_ENABLE();
obj->index = 0;
}
#if defined USART2_BASE
if (obj->uart == UART_2) {
__USART2_CLK_ENABLE();
obj->index = 1;
}
#endif
#if defined USART3_BASE
if (obj->uart == UART_3) {
__USART3_CLK_ENABLE();
obj->index = 2;
}
#endif
#if defined USART4_BASE
if (obj->uart == UART_4) {
__USART4_CLK_ENABLE();
obj->index = 3;
}
#endif
#if defined USART5_BASE
if (obj->uart == UART_5) {
__USART5_CLK_ENABLE();
obj->index = 4;
}
#endif
#if defined USART6_BASE
if (obj->uart == UART_6) {
__USART6_CLK_ENABLE();
obj->index = 5;
}
#endif
#if defined USART7_BASE
if (obj->uart == UART_7) {
__USART7_CLK_ENABLE();
obj->index = 6;
}
#endif
#if defined USART8_BASE
if (obj->uart == UART_8) {
__USART8_CLK_ENABLE();
obj->index = 7;
}
#endif
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;
obj->databits = UART_WORDLENGTH_8B;
obj->stopbits = UART_STOPBITS_1;
obj->parity = UART_PARITY_NONE;
obj->pin_tx = tx;
obj->pin_rx = rx;
init_uart(obj);
// For stdio management
if (obj->uart == STDIO_UART) {
stdio_uart_inited = 1;
memcpy(&stdio_uart, obj, sizeof(serial_t));
}
}
void serial_free(serial_t *obj) {
// Reset UART and disable clock
if (obj->uart == UART_1) {
__USART1_FORCE_RESET();
__USART1_RELEASE_RESET();
__USART1_CLK_DISABLE();
}
#if defined(USART2_BASE)
if (obj->uart == UART_2) {
__USART2_FORCE_RESET();
__USART2_RELEASE_RESET();
__USART2_CLK_DISABLE();
}
#endif
#if defined USART3_BASE
if (obj->uart == UART_3) {
__USART3_FORCE_RESET();
__USART3_RELEASE_RESET();
__USART3_CLK_DISABLE();
}
#endif
#if defined USART4_BASE
if (obj->uart == UART_4) {
__USART4_FORCE_RESET();
__USART4_RELEASE_RESET();
__USART4_CLK_DISABLE();
}
#endif
#if defined USART5_BASE
if (obj->uart == UART_5) {
__USART5_FORCE_RESET();
__USART5_RELEASE_RESET();
__USART5_CLK_DISABLE();
}
#endif
#if defined USART6_BASE
if (obj->uart == UART_6) {
__USART6_FORCE_RESET();
__USART6_RELEASE_RESET();
__USART6_CLK_DISABLE();
}
#endif
#if defined USART7_BASE
if (obj->uart == UART_7) {
__USART7_FORCE_RESET();
__USART7_RELEASE_RESET();
__USART7_CLK_DISABLE();
}
#endif
#if defined USART8_BASE
if (obj->uart == UART_8) {
__USART8_FORCE_RESET();
__USART8_RELEASE_RESET();
__USART8_CLK_DISABLE();
}
#endif
// Configure GPIOs
pin_function(obj->pin_tx, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
pin_function(obj->pin_rx, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
serial_irq_ids[obj->index] = 0;
}
void serial_baud(serial_t *obj, int baudrate) {
obj->baudrate = baudrate;
init_uart(obj);
}
void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
if (data_bits == 9) {
obj->databits = UART_WORDLENGTH_9B;
} else {
obj->databits = UART_WORDLENGTH_8B;
}
switch (parity) {
case ParityOdd:
case ParityForced0:
obj->parity = UART_PARITY_ODD;
break;
case ParityEven:
case ParityForced1:
obj->parity = UART_PARITY_EVEN;
break;
default: // ParityNone
obj->parity = UART_PARITY_NONE;
break;
}
if (stop_bits == 2) {
obj->stopbits = UART_STOPBITS_2;
} else {
obj->stopbits = UART_STOPBITS_1;
}
init_uart(obj);
}
/******************************************************************************
* INTERRUPTS HANDLING
******************************************************************************/
static void uart_irq(UARTName name, int id) {
UartHandle.Instance = (USART_TypeDef *)name;
if (serial_irq_ids[id] != 0) {
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_TC) != RESET) {
irq_handler(serial_irq_ids[id], TxIrq);
__HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_TC);
}
if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE) != RESET) {
irq_handler(serial_irq_ids[id], RxIrq);
volatile uint32_t tmpval = UartHandle.Instance->RDR; // Clear RXNE bit
}
}
}
static void uart1_irq(void) {
uart_irq(UART_1, 0);
}
#if defined(USART2_BASE)
static void uart2_irq(void) {
uart_irq(UART_2, 1);
}
#endif
#if defined USART3_BASE
static void uart3_irq(void) {
uart_irq(UART_3, 2);
}
#endif
#if defined USART4_BASE
static void uart4_irq(void) {
uart_irq(UART_4, 3);
}
#endif
#if defined USART5_BASE
static void uart5_irq(void) {
uart_irq(UART_5, 4);
}
#endif
#if defined USART6_BASE
static void uart6_irq(void) {
uart_irq(UART_6, 5);
}
#endif
#if defined USART7_BASE
static void uart7_irq(void) {
uart_irq(UART_7, 6);
}
#endif
#if defined USART8_BASE
static void uart8_irq(void) {
uart_irq(UART_8, 7);
}
#endif
void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id) {
irq_handler = handler;
serial_irq_ids[obj->index] = id;
}
void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable) {
IRQn_Type irq_n = (IRQn_Type)0;
uint32_t vector = 0;
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
if (obj->uart == UART_1) {
irq_n = USART1_IRQn;
vector = (uint32_t)&uart1_irq;
}
#if defined(USART2_BASE)
if (obj->uart == UART_2) {
irq_n = USART2_IRQn;
vector = (uint32_t)&uart2_irq;
}
#endif
#if defined (TARGET_STM32F091RC)
if (obj->uart == UART_3) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart3_irq;
}
if (obj->uart == UART_4) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart4_irq;
}
if (obj->uart == UART_5) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart5_irq;
}
if (obj->uart == UART_6) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart6_irq;
}
if (obj->uart == UART_7) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart7_irq;
}
if (obj->uart == UART_8) {
irq_n = USART3_8_IRQn;
vector = (uint32_t)&uart8_irq;
}
#elif defined (TARGET_STM32F030R8) || defined (TARGET_STM32F051R8)
#else
#if defined(USART3_BASE)
if (obj->uart == UART_3) {
irq_n = USART3_4_IRQn;
vector = (uint32_t)&uart3_irq;
}
#endif
#if defined(USART4_BASE)
if (obj->uart == UART_4) {
irq_n = USART3_4_IRQn;
vector = (uint32_t)&uart4_irq;
}
#endif
#endif
if (enable) {
if (irq == RxIrq) {
__HAL_UART_ENABLE_IT(&UartHandle, UART_IT_RXNE);
} else { // TxIrq
__HAL_UART_ENABLE_IT(&UartHandle, UART_IT_TC);
}
NVIC_SetVector(irq_n, vector);
NVIC_EnableIRQ(irq_n);
} else { // disable
int all_disabled = 0;
if (irq == RxIrq) {
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_RXNE);
// Check if TxIrq is disabled too
if ((UartHandle.Instance->CR1 & USART_CR1_TCIE) == 0) all_disabled = 1;
} else { // TxIrq
__HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC);
// Check if RxIrq is disabled too
if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1;
}
if (all_disabled) NVIC_DisableIRQ(irq_n);
}
}
/******************************************************************************
* READ/WRITE
******************************************************************************/
int serial_getc(serial_t *obj) {
USART_TypeDef *uart = (USART_TypeDef *)(obj->uart);
while (!serial_readable(obj));
return (int)(uart->RDR & (uint16_t)0xFF);
}
void serial_putc(serial_t *obj, int c) {
USART_TypeDef *uart = (USART_TypeDef *)(obj->uart);
while (!serial_writable(obj));
uart->TDR = (uint32_t)(c & (uint16_t)0xFF);
}
int serial_readable(serial_t *obj) {
int status;
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
// Check if data is received
status = ((__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE) != RESET) ? 1 : 0);
return status;
}
int serial_writable(serial_t *obj) {
int status;
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
// Check if data is transmitted
status = ((__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_TXE) != RESET) ? 1 : 0);
return status;
}
void serial_clear(serial_t *obj) {
UartHandle.Instance = (USART_TypeDef *)(obj->uart);
__HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_TC);
__HAL_UART_SEND_REQ(&UartHandle, UART_RXDATA_FLUSH_REQUEST);
}
void serial_pinout_tx(PinName tx) {
pinmap_pinout(tx, PinMap_UART_TX);
}
void serial_break_set(serial_t *obj) {
// [TODO]
}
void serial_break_clear(serial_t *obj) {
// [TODO]
}
#endif
| apache-2.0 |
krasin/omim | render/feature_styler.cpp | 23 | 12525 | #include "feature_styler.hpp"
#include "geometry_processors.hpp"
#include "proto_to_styles.hpp"
#include "indexer/classificator.hpp"
#include "indexer/drawing_rules.hpp"
#include "indexer/feature.hpp"
#include "indexer/feature_visibility.hpp"
#include "indexer/ftypes_matcher.hpp"
#include "indexer/scales.hpp"
#include "indexer/drules_include.hpp"
#include "geometry/screenbase.hpp"
#include "graphics/glyph_cache.hpp"
#include "graphics/depth_constants.hpp"
#include "base/stl_add.hpp"
#include "base/logging.hpp"
#include "std/iterator_facade.hpp"
namespace
{
struct less_depth
{
bool operator() (di::DrawRule const & r1, di::DrawRule const & r2) const
{
return (r1.m_depth < r2.m_depth);
}
};
void FilterRulesByRuntimeSelector(FeatureType const & ft, int zoom, drule::KeysT & keys)
{
keys.erase_if([&ft, zoom](drule::Key const & key)->bool
{
drule::BaseRule const * const rule = drule::rules().Find(key);
ASSERT(rule != nullptr, ());
return !rule->TestFeature(ft, zoom);
});
}
}
namespace di
{
DrawRule::DrawRule(drule::BaseRule const * p, double depth)
: m_rule(p), m_depth(my::clamp(depth, graphics::minDepth, graphics::maxDepth))
{
}
uint32_t DrawRule::GetID(size_t threadSlot) const
{
return m_rule->GetID(threadSlot);
}
void DrawRule::SetID(size_t threadSlot, uint32_t id) const
{
m_rule->SetID(threadSlot, id);
}
FeatureStyler::FeatureStyler(FeatureType const & f,
int const zoom,
double const visualScale,
graphics::GlyphCache * glyphCache,
ScreenBase const * convertor,
m2::RectD const * rect)
: m_hasPathText(false),
m_visualScale(visualScale),
m_glyphCache(glyphCache),
m_convertor(convertor),
m_rect(rect)
{
drule::KeysT keys;
pair<int, bool> type = feature::GetDrawRule(f, zoom, keys);
FilterRulesByRuntimeSelector(f, zoom, keys);
// don't try to do anything to invisible feature
if (keys.empty())
return;
m_hasLineStyles = false;
m_hasPointStyles = false;
m_geometryType = type.first;
m_isCoastline = type.second;
f.GetPreferredNames(m_primaryText, m_secondaryText);
// Draw only one text for features on the World zoom level in user's native language.
if (zoom <= scales::GetUpperWorldScale() && !m_secondaryText.empty())
{
m_primaryText.swap(m_secondaryText);
m_secondaryText.clear();
}
// Low zoom heuristics - don't show superlong names on World map.
//if (zoom <= 5)
//{
// if (strings::MakeUniString(m_primaryText).size() > 50)
// m_primaryText.clear();
//}
bool const isBuilding = ftypes::IsBuildingChecker::Instance()(f);
bool const hasName = !m_primaryText.empty() || isBuilding;
m_refText = f.GetRoadNumber();
uint32_t const population = ftypes::GetPopulation(f);
// [STYLE_HARDCODE] Calculate population rank for cities and towns only.
// It affects font size. If population rank is less than zero, feature is not drawn.
ftypes::Type const localityType = ftypes::IsLocalityChecker::Instance().GetType(f);
if (localityType == ftypes::CITY || localityType == ftypes::TOWN)
m_popRank = drule::rules().GetCityRank(zoom, population);
else
m_popRank = 0.0;
double area = 0.0;
if (m_geometryType != feature::GEOM_POINT)
{
m2::RectD const bbox = f.GetLimitRect(zoom);
area = bbox.SizeX() * bbox.SizeY();
}
double priorityModifier;
if (area != 0)
{
// making area larger so it's not lost on double conversions
priorityModifier = min(1.0, area * 10000.0);
}
else
{
// dividing by planet population to get priorityModifier < 1
priorityModifier = static_cast<double>(population) / 7E9;
}
drule::MakeUnique(keys);
int layer = f.GetLayer();
if (layer == feature::LAYER_TRANSPARENT_TUNNEL)
layer = 0;
bool hasIcon = false;
bool hasCaptionWithoutOffset = false;
m_fontSize = 0;
size_t const count = keys.size();
m_rules.resize(count);
bool hasSecondaryText = false;
drule::text_type_t textType = drule::text_type_name;
for (size_t i = 0; i < count; ++i)
{
double depth = keys[i].m_priority;
if (layer != 0 && depth < 19000)
{
if (keys[i].m_type == drule::line || keys[i].m_type == drule::waymarker)
depth = (layer * drule::layer_base_priority) + fmod(depth, drule::layer_base_priority);
else if (keys[i].m_type == drule::area)
{
// Use raw depth adding in area feature layers
// (avoid overlap linear objects in case of "fmod").
depth += layer * drule::layer_base_priority;
}
}
if (keys[i].m_type == drule::symbol || keys[i].m_type == drule::circle)
hasIcon = true;
if ((keys[i].m_type == drule::caption && hasName)
|| (keys[i].m_type == drule::symbol)
|| (keys[i].m_type == drule::circle))
m_hasPointStyles = true;
if (keys[i].m_type == drule::caption
|| keys[i].m_type == drule::symbol
|| keys[i].m_type == drule::circle
|| keys[i].m_type == drule::pathtext)
{
// show labels of larger objects first
depth += priorityModifier;
// show labels of nodes first
if (m_geometryType == feature::GEOM_POINT)
++depth;
}
else if (keys[i].m_type == drule::area)
{
// show smaller polygons on top
depth -= priorityModifier;
}
if (!m_hasLineStyles && (keys[i].m_type == drule::line))
m_hasLineStyles = true;
m_rules[i] = di::DrawRule(drule::rules().Find(keys[i]), depth);
if (m_rules[i].m_rule->GetCaption(1) != 0)
hasSecondaryText = true;
CaptionDefProto const * pCap0 = m_rules[i].m_rule->GetCaption(0);
if (pCap0)
{
textType = m_rules[i].m_rule->GetCaptionTextType(0);
if (!m_hasPathText && hasName && (m_geometryType == feature::GEOM_LINE))
{
m_hasPathText = true;
if (!FilterTextSize(m_rules[i].m_rule))
m_fontSize = max(m_fontSize, GetTextFontSize(m_rules[i].m_rule));
}
if (keys[i].m_type == drule::caption)
hasCaptionWithoutOffset = !(pCap0->has_offset_y() || pCap0->has_offset_x());
}
}
// User's language name is better if we don't have secondary text draw rule.
if (!hasSecondaryText && !m_secondaryText.empty() && (m_geometryType != feature::GEOM_LINE))
{
f.GetReadableName(m_primaryText);
if (m_primaryText == m_secondaryText)
m_secondaryText.clear();
}
if (isBuilding)
{
string houseNumber = f.GetHouseNumber();
// Mark houses without names/numbers so user can select them by single tap.
if (houseNumber.empty() && m_primaryText.empty())
houseNumber = "·";
if (textType == drule::text_type_housenumber)
{
m_primaryText = move(houseNumber);
}
else if (textType == drule::text_type_name)
{
// Get or concat house number if feature has one.
if (!houseNumber.empty())
{
if (m_primaryText.empty() || houseNumber.find(m_primaryText) != string::npos)
m_primaryText = move(houseNumber);
else
m_primaryText = m_primaryText + " (" + houseNumber + ")";
}
}
}
// placing a text on the path
if (m_hasPathText && (m_fontSize != 0))
{
typedef gp::filter_screenpts_adapter<gp::get_path_intervals> functor_t;
functor_t::params p;
p.m_convertor = m_convertor;
p.m_rect = m_rect;
p.m_intervals = &m_intervals;
functor_t fun(p);
f.ForEachPointRef(fun, zoom);
LayoutTexts(fun.m_length);
}
if (hasIcon && hasCaptionWithoutOffset)
{
// we need to delete symbol style and circle style
for (size_t i = 0; i < m_rules.size();)
{
if (keys[i].m_type == drule::symbol || keys[i].m_type == drule::circle)
{
m_rules[i] = m_rules[m_rules.size() - 1];
m_rules.pop_back();
keys[i] = keys[keys.size() - 1];
keys.pop_back();
}
else
++i;
}
}
sort(m_rules.begin(), m_rules.end(), less_depth());
}
typedef pair<double, double> RangeT;
template <class IterT> class RangeIterT :
public iterator_facade<RangeIterT<IterT>, RangeT, forward_traversal_tag, RangeT>
{
IterT m_iter;
public:
RangeIterT(IterT iter) : m_iter(iter) {}
RangeT dereference() const
{
IterT next = m_iter;
++next;
return RangeT(*m_iter, *next);
}
bool equal(RangeIterT const & r) const { return (m_iter == r.m_iter); }
void increment()
{
++m_iter; ++m_iter;
}
};
template <class ContT> class RangeInserter
{
ContT & m_cont;
public:
RangeInserter(ContT & cont) : m_cont(cont) {}
RangeInserter & operator*() { return *this; }
RangeInserter & operator++(int) { return *this; }
RangeInserter & operator=(RangeT const & r)
{
m_cont.push_back(r.first);
m_cont.push_back(r.second);
return *this;
}
};
void FeatureStyler::LayoutTexts(double pathLength)
{
double const textLength = m_glyphCache->getTextLength(m_fontSize, GetPathName());
/// @todo Choose best constant for minimal space.
double const emptySize = max(200 * m_visualScale, textLength);
// multiply on factor because tiles will be rendered in smaller scales
double const minPeriodSize = 1.5 * (emptySize + textLength);
size_t textCnt = 0;
double firstTextOffset = 0;
if (pathLength > textLength)
{
textCnt = ceil((pathLength - textLength) / minPeriodSize);
firstTextOffset = 0.5 * (pathLength - (textCnt * textLength + (textCnt - 1) * emptySize));
}
if (textCnt != 0 && !m_intervals.empty())
{
buffer_vector<RangeT, 8> deadZones;
for (size_t i = 0; i < textCnt; ++i)
{
double const deadZoneStart = firstTextOffset + minPeriodSize * i;
double const deadZoneEnd = deadZoneStart + textLength;
if (deadZoneStart > m_intervals.back())
break;
deadZones.push_back(make_pair(deadZoneStart, deadZoneEnd));
}
if (!deadZones.empty())
{
buffer_vector<double, 16> res;
// accumulate text layout intervals with cliping intervals
typedef RangeIterT<ClipIntervalsT::iterator> IterT;
AccumulateIntervals1With2(IterT(m_intervals.begin()), IterT(m_intervals.end()),
deadZones.begin(), deadZones.end(),
RangeInserter<ClipIntervalsT>(res));
m_intervals = res;
ASSERT_EQUAL(m_intervals.size() % 2, 0, ());
// get final text offsets (belongs to final clipping intervals)
size_t i = 0;
size_t j = 0;
while (i != deadZones.size() && j != m_intervals.size())
{
ASSERT_LESS(deadZones[i].first, deadZones[i].second, ());
ASSERT_LESS(m_intervals[j], m_intervals[j+1], ());
if (deadZones[i].first < m_intervals[j])
{
++i;
continue;
}
if (m_intervals[j+1] <= deadZones[i].first)
{
j += 2;
continue;
}
ASSERT_LESS_OR_EQUAL(m_intervals[j], deadZones[i].first, ());
ASSERT_LESS_OR_EQUAL(deadZones[i].second, m_intervals[j+1], ());
m_offsets.push_back(deadZones[i].first);
++i;
}
}
}
}
string const FeatureStyler::GetPathName() const
{
// Always concat names for linear features because we process only one draw rule now.
if (m_secondaryText.empty())
return m_primaryText;
else
return m_primaryText + " " + m_secondaryText;
}
bool FeatureStyler::IsEmpty() const
{
return m_rules.empty();
}
uint8_t FeatureStyler::GetTextFontSize(drule::BaseRule const * pRule) const
{
return pRule->GetCaption(0)->height() * m_visualScale;
}
bool FeatureStyler::FilterTextSize(drule::BaseRule const * pRule) const
{
if (pRule->GetCaption(0))
return (GetFontSize(pRule->GetCaption(0)) < 3);
else
{
// this rule is not a caption at all
return true;
}
}
}
| apache-2.0 |
mcherkasov/ignite | modules/platforms/cpp/odbc-test/src/sql_outer_join_test.cpp | 24 | 13974 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
#ifndef _MSC_VER
# define BOOST_TEST_DYN_LINK
#endif
#include <boost/test/unit_test.hpp>
#include "sql_test_suite_fixture.h"
#include "test_utils.h"
using namespace ignite;
using namespace ignite_test;
using namespace boost::unit_test;
BOOST_FIXTURE_TEST_SUITE(SqlOuterJoinTestSuite, ignite::SqlTestSuiteFixture)
// Checking that left outer joins are supported.
// Corresponds to SQL_OJ_LEFT flag.
BOOST_AUTO_TEST_CASE(TestOuterJoinLeft)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T1.i32Field = T2.i16Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the column names in the ON clause of the outer join do not
// have to be in the same order as their respective table names in the OUTER
// JOIN clause. Corresponds to SQL_OJ_NOT_ORDERED flag.
BOOST_AUTO_TEST_CASE(TestOuterJoinOrdering)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field = T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the comparison operator in the ON clause can be any of the ODBC
// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
// Operator '<'.
BOOST_AUTO_TEST_CASE(TestOuterJoinOpsLess)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field < T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_EQUAL(columnsLen[1], SQL_NULL_DATA);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the comparison operator in the ON clause can be any of the ODBC
// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
// Operator '>'.
BOOST_AUTO_TEST_CASE(TestOuterJoinOpsGreater)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field > T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the comparison operator in the ON clause can be any of the ODBC
// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
// Operator '<='.
BOOST_AUTO_TEST_CASE(TestOuterJoinOpsLessOrEqual)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field <= T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the comparison operator in the ON clause can be any of the ODBC
// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
// Operator '>='.
BOOST_AUTO_TEST_CASE(TestOuterJoinOpsGreaterOrEqual)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field >= T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
// Checking that the comparison operator in the ON clause can be any of the ODBC
// comparison operators. Corresponds to SQL_OJ_ALL_COMPARISON_OPS flag.
// Operator '!='.
BOOST_AUTO_TEST_CASE(TestOuterJoinOpsNotEqual)
{
TestType in1;
TestType in2;
in1.i32Field = 20;
in2.i32Field = 30;
in1.i16Field = 40;
in2.i16Field = 20;
testCache.Put(1, in1);
testCache.Put(2, in2);
SQLINTEGER columns[2];
SQLLEN columnsLen[2];
SQLRETURN ret = SQLBindCol(stmt, 1, SQL_C_SLONG, &columns[0], 0, &columnsLen[0]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLBindCol(stmt, 2, SQL_C_SLONG, &columns[1], 0, &columnsLen[1]);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
SQLCHAR request[] = "SELECT T1.i32Field, T2.i16Field FROM "
"{oj TestType T1 LEFT OUTER JOIN TestType T2 ON T2.i16Field != T1.i32Field}";
ret = SQLExecDirect(stmt, request, SQL_NTS);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 20);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 40);
ret = SQLFetch(stmt);
if (!SQL_SUCCEEDED(ret))
BOOST_FAIL(GetOdbcErrorMessage(SQL_HANDLE_STMT, stmt));
BOOST_CHECK_NE(columnsLen[0], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[0], 30);
BOOST_CHECK_NE(columnsLen[1], SQL_NULL_DATA);
BOOST_CHECK_EQUAL(columns[1], 20);
ret = SQLFetch(stmt);
BOOST_CHECK(ret == SQL_NO_DATA);
}
BOOST_AUTO_TEST_SUITE_END()
| apache-2.0 |
parallella/pal | src/math/msun/src/e_remainderf.c | 24 | 1458 | /* e_remainderf.c -- float version of e_remainder.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
*/
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "math.h"
#include "math_private.h"
static const float zero = 0.0;
float
__ieee754_remainderf(float x, float p)
{
int32_t hx,hp;
u_int32_t sx;
float p_half;
GET_FLOAT_WORD(hx,x);
GET_FLOAT_WORD(hp,p);
sx = hx&0x80000000;
hp &= 0x7fffffff;
hx &= 0x7fffffff;
/* purge off exception values */
if(hp==0) return (x*p)/(x*p); /* p = 0 */
if((hx>=0x7f800000)|| /* x not finite */
((hp>0x7f800000))) /* p is NaN */
return ((long double)x*p)/((long double)x*p);
if (hp<=0x7effffff) x = __ieee754_fmodf(x,p+p); /* now x < 2p */
if ((hx-hp)==0) return zero*x;
x = fabsf(x);
p = fabsf(p);
if (hp<0x01000000) {
if(x+x>p) {
x-=p;
if(x+x>=p) x -= p;
}
} else {
p_half = (float)0.5*p;
if(x>p_half) {
x-=p;
if(x>=p_half) x -= p;
}
}
GET_FLOAT_WORD(hx,x);
if ((hx&0x7fffffff)==0) hx = 0;
SET_FLOAT_WORD(x,hx^sx);
return x;
}
| apache-2.0 |
jaengineer/android-ndk | endless-tunnel/app/src/main/jni/anim.cpp | 36 | 1651 | /*
* Copyright (C) Google Inc.
*
* 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 "anim.hpp"
#include "engine.hpp"
#include "shape_renderer.hpp"
#include "util.hpp"
void RenderBackgroundAnimation(ShapeRenderer *r) {
float aspect = SceneManager::GetInstance()->GetScreenAspect();
static const int BG_RECTS = 50;
static const float RECT_W = 0.3f;
static const float RECT_H = 0.1f;
static float rectX[BG_RECTS];
static float rectY[BG_RECTS];
static bool rectsInitted = false;
int i;
if (!rectsInitted) {
for (i = 0; i < BG_RECTS; i++) {
rectX[i] = aspect * (Random(100) / 100.0f);
rectY[i] = Random(100) / 100.0f;
}
rectsInitted = true;
}
glClear(GL_COLOR_BUFFER_BIT);
for (i = 0; i < BG_RECTS; i++) {
float c = 0.1f + 0.1f * (i % 4);
r->SetColor(c, c, c);
r->RenderRect(rectX[i], rectY[i], RECT_W, RECT_H);
rectX[i] -= (0.01f + 0.01f * (i % 4));
if (rectX[i] < -RECT_W * 0.5f) {
rectX[i] = aspect + RECT_W * 0.5f;
rectY[i] = Random(100) / 100.0f;
}
}
}
| apache-2.0 |
Ant-OS/android_packages_apps_OTAUpdates | jni/boost_1_57_0/libs/container/example/doc_recursive_containers.cpp | 38 | 2050 | //////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2009-2013. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
//[doc_recursive_containers
#include <boost/container/vector.hpp>
#include <boost/container/stable_vector.hpp>
#include <boost/container/deque.hpp>
#include <boost/container/list.hpp>
#include <boost/container/map.hpp>
#include <boost/container/string.hpp>
using namespace boost::container;
struct data
{
int i_;
//A vector holding still undefined class 'data'
vector<data> v_;
vector<data>::iterator vi_;
//A stable_vector holding still undefined class 'data'
stable_vector<data> sv_;
stable_vector<data>::iterator svi_;
//A stable_vector holding still undefined class 'data'
deque<data> d_;
deque<data>::iterator di_;
//A list holding still undefined 'data'
list<data> l_;
list<data>::iterator li_;
//A map holding still undefined 'data'
map<data, data> m_;
map<data, data>::iterator mi_;
friend bool operator <(const data &l, const data &r)
{ return l.i_ < r.i_; }
};
struct tree_node
{
string name;
string value;
//children nodes of this node
list<tree_node> children_;
list<tree_node>::iterator selected_child_;
};
int main()
{
//a container holding a recursive data type
stable_vector<data> sv;
sv.resize(100);
//Let's build a tree based in
//a recursive data type
tree_node root;
root.name = "root";
root.value = "root_value";
root.children_.resize(7);
root.selected_child_ = root.children_.begin();
return 0;
}
//]
#include <boost/container/detail/config_end.hpp>
| apache-2.0 |
AubrCool/rt-thread | components/net/freemodbus/port/user_mb_app_m.c | 46 | 9685 | /*
* FreeModbus Libary: user callback functions and buffer define in master mode
* Copyright (C) 2013 Armink <armink.ztl@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* File: $Id: user_mb_app_m.c,v 1.60 2013/11/23 11:49:05 Armink $
*/
#include "user_mb_app.h"
/*-----------------------Master mode use these variables----------------------*/
#if MB_MASTER_RTU_ENABLED > 0 || MB_MASTER_ASCII_ENABLED > 0
//Master mode:DiscreteInputs variables
USHORT usMDiscInStart = M_DISCRETE_INPUT_START;
#if M_DISCRETE_INPUT_NDISCRETES%8
UCHAR ucMDiscInBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_DISCRETE_INPUT_NDISCRETES/8+1];
#else
UCHAR ucMDiscInBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_DISCRETE_INPUT_NDISCRETES/8];
#endif
//Master mode:Coils variables
USHORT usMCoilStart = M_COIL_START;
#if M_COIL_NCOILS%8
UCHAR ucMCoilBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_COIL_NCOILS/8+1];
#else
UCHAR ucMCoilBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_COIL_NCOILS/8];
#endif
//Master mode:InputRegister variables
USHORT usMRegInStart = M_REG_INPUT_START;
USHORT usMRegInBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_REG_INPUT_NREGS];
//Master mode:HoldingRegister variables
USHORT usMRegHoldStart = M_REG_HOLDING_START;
USHORT usMRegHoldBuf[MB_MASTER_TOTAL_SLAVE_NUM][M_REG_HOLDING_NREGS];
/**
* Modbus master input register callback function.
*
* @param pucRegBuffer input register buffer
* @param usAddress input register address
* @param usNRegs input register number
*
* @return result
*/
eMBErrorCode eMBMasterRegInputCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNRegs )
{
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex;
USHORT * pusRegInputBuf;
USHORT REG_INPUT_START;
USHORT REG_INPUT_NREGS;
USHORT usRegInStart;
pusRegInputBuf = usMRegInBuf[ucMBMasterGetDestAddress() - 1];
REG_INPUT_START = M_REG_INPUT_START;
REG_INPUT_NREGS = M_REG_INPUT_NREGS;
usRegInStart = usMRegInStart;
/* it already plus one in modbus function method. */
usAddress--;
if ((usAddress >= REG_INPUT_START)
&& (usAddress + usNRegs <= REG_INPUT_START + REG_INPUT_NREGS))
{
iRegIndex = usAddress - usRegInStart;
while (usNRegs > 0)
{
pusRegInputBuf[iRegIndex] = *pucRegBuffer++ << 8;
pusRegInputBuf[iRegIndex] |= *pucRegBuffer++;
iRegIndex++;
usNRegs--;
}
}
else
{
eStatus = MB_ENOREG;
}
return eStatus;
}
/**
* Modbus master holding register callback function.
*
* @param pucRegBuffer holding register buffer
* @param usAddress holding register address
* @param usNRegs holding register number
* @param eMode read or write
*
* @return result
*/
eMBErrorCode eMBMasterRegHoldingCB(UCHAR * pucRegBuffer, USHORT usAddress,
USHORT usNRegs, eMBRegisterMode eMode)
{
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex;
USHORT * pusRegHoldingBuf;
USHORT REG_HOLDING_START;
USHORT REG_HOLDING_NREGS;
USHORT usRegHoldStart;
pusRegHoldingBuf = usMRegHoldBuf[ucMBMasterGetDestAddress() - 1];
REG_HOLDING_START = M_REG_HOLDING_START;
REG_HOLDING_NREGS = M_REG_HOLDING_NREGS;
usRegHoldStart = usMRegHoldStart;
/* if mode is read, the master will write the received date to buffer. */
eMode = MB_REG_WRITE;
/* it already plus one in modbus function method. */
usAddress--;
if ((usAddress >= REG_HOLDING_START)
&& (usAddress + usNRegs <= REG_HOLDING_START + REG_HOLDING_NREGS))
{
iRegIndex = usAddress - usRegHoldStart;
switch (eMode)
{
/* read current register values from the protocol stack. */
case MB_REG_READ:
while (usNRegs > 0)
{
*pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] >> 8);
*pucRegBuffer++ = (UCHAR) (pusRegHoldingBuf[iRegIndex] & 0xFF);
iRegIndex++;
usNRegs--;
}
break;
/* write current register values with new values from the protocol stack. */
case MB_REG_WRITE:
while (usNRegs > 0)
{
pusRegHoldingBuf[iRegIndex] = *pucRegBuffer++ << 8;
pusRegHoldingBuf[iRegIndex] |= *pucRegBuffer++;
iRegIndex++;
usNRegs--;
}
break;
}
}
else
{
eStatus = MB_ENOREG;
}
return eStatus;
}
/**
* Modbus master coils callback function.
*
* @param pucRegBuffer coils buffer
* @param usAddress coils address
* @param usNCoils coils number
* @param eMode read or write
*
* @return result
*/
eMBErrorCode eMBMasterRegCoilsCB(UCHAR * pucRegBuffer, USHORT usAddress,
USHORT usNCoils, eMBRegisterMode eMode)
{
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex , iRegBitIndex , iNReg;
UCHAR * pucCoilBuf;
USHORT COIL_START;
USHORT COIL_NCOILS;
USHORT usCoilStart;
iNReg = usNCoils / 8 + 1;
pucCoilBuf = ucMCoilBuf[ucMBMasterGetDestAddress() - 1];
COIL_START = M_COIL_START;
COIL_NCOILS = M_COIL_NCOILS;
usCoilStart = usMCoilStart;
/* if mode is read,the master will write the received date to buffer. */
eMode = MB_REG_WRITE;
/* it already plus one in modbus function method. */
usAddress--;
if ((usAddress >= COIL_START)
&& (usAddress + usNCoils <= COIL_START + COIL_NCOILS))
{
iRegIndex = (USHORT) (usAddress - usCoilStart) / 8;
iRegBitIndex = (USHORT) (usAddress - usCoilStart) % 8;
switch (eMode)
{
/* read current coil values from the protocol stack. */
case MB_REG_READ:
while (iNReg > 0)
{
*pucRegBuffer++ = xMBUtilGetBits(&pucCoilBuf[iRegIndex++],
iRegBitIndex, 8);
iNReg--;
}
pucRegBuffer--;
/* last coils */
usNCoils = usNCoils % 8;
/* filling zero to high bit */
*pucRegBuffer = *pucRegBuffer << (8 - usNCoils);
*pucRegBuffer = *pucRegBuffer >> (8 - usNCoils);
break;
/* write current coil values with new values from the protocol stack. */
case MB_REG_WRITE:
while (iNReg > 1)
{
xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, 8,
*pucRegBuffer++);
iNReg--;
}
/* last coils */
usNCoils = usNCoils % 8;
/* xMBUtilSetBits has bug when ucNBits is zero */
if (usNCoils != 0)
{
xMBUtilSetBits(&pucCoilBuf[iRegIndex++], iRegBitIndex, usNCoils,
*pucRegBuffer++);
}
break;
}
}
else
{
eStatus = MB_ENOREG;
}
return eStatus;
}
/**
* Modbus master discrete callback function.
*
* @param pucRegBuffer discrete buffer
* @param usAddress discrete address
* @param usNDiscrete discrete number
*
* @return result
*/
eMBErrorCode eMBMasterRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT usNDiscrete )
{
eMBErrorCode eStatus = MB_ENOERR;
USHORT iRegIndex , iRegBitIndex , iNReg;
UCHAR * pucDiscreteInputBuf;
USHORT DISCRETE_INPUT_START;
USHORT DISCRETE_INPUT_NDISCRETES;
USHORT usDiscreteInputStart;
iNReg = usNDiscrete / 8 + 1;
pucDiscreteInputBuf = ucMDiscInBuf[ucMBMasterGetDestAddress() - 1];
DISCRETE_INPUT_START = M_DISCRETE_INPUT_START;
DISCRETE_INPUT_NDISCRETES = M_DISCRETE_INPUT_NDISCRETES;
usDiscreteInputStart = usMDiscInStart;
/* it already plus one in modbus function method. */
usAddress--;
if ((usAddress >= DISCRETE_INPUT_START)
&& (usAddress + usNDiscrete <= DISCRETE_INPUT_START + DISCRETE_INPUT_NDISCRETES))
{
iRegIndex = (USHORT) (usAddress - usDiscreteInputStart) / 8;
iRegBitIndex = (USHORT) (usAddress - usDiscreteInputStart) % 8;
/* write current discrete values with new values from the protocol stack. */
while (iNReg > 1)
{
xMBUtilSetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex, 8,
*pucRegBuffer++);
iNReg--;
}
/* last discrete */
usNDiscrete = usNDiscrete % 8;
/* xMBUtilSetBits has bug when ucNBits is zero */
if (usNDiscrete != 0)
{
xMBUtilSetBits(&pucDiscreteInputBuf[iRegIndex++], iRegBitIndex,
usNDiscrete, *pucRegBuffer++);
}
}
else
{
eStatus = MB_ENOREG;
}
return eStatus;
}
#endif
| apache-2.0 |
indashnet/InDashNet.Open.UN2000 | lichee/linux-3.4/sound/core/sound_oss.c | 1589 | 7702 | /*
* Advanced Linux Sound Architecture
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifdef CONFIG_SND_OSSEMUL
#if !defined(CONFIG_SOUND) && !(defined(MODULE) && defined(CONFIG_SOUND_MODULE))
#error "Enable the OSS soundcore multiplexer (CONFIG_SOUND) in the kernel."
#endif
#include <linux/init.h>
#include <linux/export.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <sound/core.h>
#include <sound/minors.h>
#include <sound/info.h>
#include <linux/sound.h>
#include <linux/mutex.h>
#define SNDRV_OSS_MINORS 128
static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
static DEFINE_MUTEX(sound_oss_mutex);
/* NOTE: This function increments the refcount of the associated card like
* snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
*/
void *snd_lookup_oss_minor_data(unsigned int minor, int type)
{
struct snd_minor *mreg;
void *private_data;
if (minor >= ARRAY_SIZE(snd_oss_minors))
return NULL;
mutex_lock(&sound_oss_mutex);
mreg = snd_oss_minors[minor];
if (mreg && mreg->type == type) {
private_data = mreg->private_data;
if (private_data && mreg->card_ptr)
atomic_inc(&mreg->card_ptr->refcount);
} else
private_data = NULL;
mutex_unlock(&sound_oss_mutex);
return private_data;
}
EXPORT_SYMBOL(snd_lookup_oss_minor_data);
static int snd_oss_kernel_minor(int type, struct snd_card *card, int dev)
{
int minor;
switch (type) {
case SNDRV_OSS_DEVICE_TYPE_MIXER:
if (snd_BUG_ON(!card || dev < 0 || dev > 1))
return -EINVAL;
minor = SNDRV_MINOR_OSS(card->number, (dev ? SNDRV_MINOR_OSS_MIXER1 : SNDRV_MINOR_OSS_MIXER));
break;
case SNDRV_OSS_DEVICE_TYPE_SEQUENCER:
minor = SNDRV_MINOR_OSS_SEQUENCER;
break;
case SNDRV_OSS_DEVICE_TYPE_MUSIC:
minor = SNDRV_MINOR_OSS_MUSIC;
break;
case SNDRV_OSS_DEVICE_TYPE_PCM:
if (snd_BUG_ON(!card || dev < 0 || dev > 1))
return -EINVAL;
minor = SNDRV_MINOR_OSS(card->number, (dev ? SNDRV_MINOR_OSS_PCM1 : SNDRV_MINOR_OSS_PCM));
break;
case SNDRV_OSS_DEVICE_TYPE_MIDI:
if (snd_BUG_ON(!card || dev < 0 || dev > 1))
return -EINVAL;
minor = SNDRV_MINOR_OSS(card->number, (dev ? SNDRV_MINOR_OSS_MIDI1 : SNDRV_MINOR_OSS_MIDI));
break;
case SNDRV_OSS_DEVICE_TYPE_DMFM:
minor = SNDRV_MINOR_OSS(card->number, SNDRV_MINOR_OSS_DMFM);
break;
case SNDRV_OSS_DEVICE_TYPE_SNDSTAT:
minor = SNDRV_MINOR_OSS_SNDSTAT;
break;
default:
return -EINVAL;
}
if (minor < 0 || minor >= SNDRV_OSS_MINORS)
return -EINVAL;
return minor;
}
int snd_register_oss_device(int type, struct snd_card *card, int dev,
const struct file_operations *f_ops, void *private_data,
const char *name)
{
int minor = snd_oss_kernel_minor(type, card, dev);
int minor_unit;
struct snd_minor *preg;
int cidx = SNDRV_MINOR_OSS_CARD(minor);
int track2 = -1;
int register1 = -1, register2 = -1;
struct device *carddev = snd_card_get_device_link(card);
if (card && card->number >= 8)
return 0; /* ignore silently */
if (minor < 0)
return minor;
preg = kmalloc(sizeof(struct snd_minor), GFP_KERNEL);
if (preg == NULL)
return -ENOMEM;
preg->type = type;
preg->card = card ? card->number : -1;
preg->device = dev;
preg->f_ops = f_ops;
preg->private_data = private_data;
preg->card_ptr = card;
mutex_lock(&sound_oss_mutex);
snd_oss_minors[minor] = preg;
minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
switch (minor_unit) {
case SNDRV_MINOR_OSS_PCM:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_AUDIO);
break;
case SNDRV_MINOR_OSS_MIDI:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI);
break;
case SNDRV_MINOR_OSS_MIDI1:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1);
break;
}
register1 = register_sound_special_device(f_ops, minor, carddev);
if (register1 != minor)
goto __end;
if (track2 >= 0) {
register2 = register_sound_special_device(f_ops, track2,
carddev);
if (register2 != track2)
goto __end;
snd_oss_minors[track2] = preg;
}
mutex_unlock(&sound_oss_mutex);
return 0;
__end:
if (register2 >= 0)
unregister_sound_special(register2);
if (register1 >= 0)
unregister_sound_special(register1);
snd_oss_minors[minor] = NULL;
mutex_unlock(&sound_oss_mutex);
kfree(preg);
return -EBUSY;
}
EXPORT_SYMBOL(snd_register_oss_device);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev)
{
int minor = snd_oss_kernel_minor(type, card, dev);
int cidx = SNDRV_MINOR_OSS_CARD(minor);
int track2 = -1;
struct snd_minor *mptr;
if (card && card->number >= 8)
return 0;
if (minor < 0)
return minor;
mutex_lock(&sound_oss_mutex);
mptr = snd_oss_minors[minor];
if (mptr == NULL) {
mutex_unlock(&sound_oss_mutex);
return -ENOENT;
}
unregister_sound_special(minor);
switch (SNDRV_MINOR_OSS_DEVICE(minor)) {
case SNDRV_MINOR_OSS_PCM:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_AUDIO);
break;
case SNDRV_MINOR_OSS_MIDI:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI);
break;
case SNDRV_MINOR_OSS_MIDI1:
track2 = SNDRV_MINOR_OSS(cidx, SNDRV_MINOR_OSS_DMMIDI1);
break;
}
if (track2 >= 0) {
unregister_sound_special(track2);
snd_oss_minors[track2] = NULL;
}
snd_oss_minors[minor] = NULL;
mutex_unlock(&sound_oss_mutex);
kfree(mptr);
return 0;
}
EXPORT_SYMBOL(snd_unregister_oss_device);
/*
* INFO PART
*/
#ifdef CONFIG_PROC_FS
static struct snd_info_entry *snd_minor_info_oss_entry;
static const char *snd_oss_device_type_name(int type)
{
switch (type) {
case SNDRV_OSS_DEVICE_TYPE_MIXER:
return "mixer";
case SNDRV_OSS_DEVICE_TYPE_SEQUENCER:
case SNDRV_OSS_DEVICE_TYPE_MUSIC:
return "sequencer";
case SNDRV_OSS_DEVICE_TYPE_PCM:
return "digital audio";
case SNDRV_OSS_DEVICE_TYPE_MIDI:
return "raw midi";
case SNDRV_OSS_DEVICE_TYPE_DMFM:
return "hardware dependent";
default:
return "?";
}
}
static void snd_minor_info_oss_read(struct snd_info_entry *entry,
struct snd_info_buffer *buffer)
{
int minor;
struct snd_minor *mptr;
mutex_lock(&sound_oss_mutex);
for (minor = 0; minor < SNDRV_OSS_MINORS; ++minor) {
if (!(mptr = snd_oss_minors[minor]))
continue;
if (mptr->card >= 0)
snd_iprintf(buffer, "%3i: [%i-%2i]: %s\n", minor,
mptr->card, mptr->device,
snd_oss_device_type_name(mptr->type));
else
snd_iprintf(buffer, "%3i: : %s\n", minor,
snd_oss_device_type_name(mptr->type));
}
mutex_unlock(&sound_oss_mutex);
}
int __init snd_minor_info_oss_init(void)
{
struct snd_info_entry *entry;
entry = snd_info_create_module_entry(THIS_MODULE, "devices", snd_oss_root);
if (entry) {
entry->c.text.read = snd_minor_info_oss_read;
if (snd_info_register(entry) < 0) {
snd_info_free_entry(entry);
entry = NULL;
}
}
snd_minor_info_oss_entry = entry;
return 0;
}
int __exit snd_minor_info_oss_done(void)
{
snd_info_free_entry(snd_minor_info_oss_entry);
return 0;
}
#endif /* CONFIG_PROC_FS */
#endif /* CONFIG_SND_OSSEMUL */
| apache-2.0 |
yuanzhao/gpdb | src/interfaces/ecpg/ecpglib/typename.c | 54 | 2207 | /* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/typename.c,v 1.14 2007/11/15 21:14:45 momjian Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
#include <stdlib.h>
#include "ecpgtype.h"
#include "ecpglib.h"
#include "extern.h"
#include "sql3types.h"
#include "pg_type.h"
/*
* This function is used to generate the correct type names.
*/
const char *
ecpg_type_name(enum ECPGttype typ)
{
switch (typ)
{
case ECPGt_char:
return "char";
case ECPGt_unsigned_char:
return "unsigned char";
case ECPGt_short:
return "short";
case ECPGt_unsigned_short:
return "unsigned short";
case ECPGt_int:
return "int";
case ECPGt_unsigned_int:
return "unsigned int";
case ECPGt_long:
return "long";
case ECPGt_unsigned_long:
return "unsigned long";
case ECPGt_long_long:
return "long long";
case ECPGt_unsigned_long_long:
return "unsigned long long";
case ECPGt_float:
return "float";
case ECPGt_double:
return "double";
case ECPGt_bool:
return "bool";
case ECPGt_varchar:
return "varchar";
case ECPGt_char_variable:
return "char";
case ECPGt_decimal:
return "decimal";
case ECPGt_numeric:
return "numeric";
case ECPGt_date:
return "date";
case ECPGt_timestamp:
return "timestamp";
case ECPGt_interval:
return "interval";
case ECPGt_const:
return "Const";
default:
abort();
}
return NULL;
}
int
ecpg_dynamic_type(Oid type)
{
switch (type)
{
case BOOLOID:
return SQL3_BOOLEAN; /* bool */
case INT2OID:
return SQL3_SMALLINT; /* int2 */
case INT4OID:
return SQL3_INTEGER; /* int4 */
case TEXTOID:
return SQL3_CHARACTER; /* text */
case FLOAT4OID:
return SQL3_REAL; /* float4 */
case FLOAT8OID:
return SQL3_DOUBLE_PRECISION; /* float8 */
case BPCHAROID:
return SQL3_CHARACTER; /* bpchar */
case VARCHAROID:
return SQL3_CHARACTER_VARYING; /* varchar */
case DATEOID:
return SQL3_DATE_TIME_TIMESTAMP; /* date */
case TIMEOID:
return SQL3_DATE_TIME_TIMESTAMP; /* time */
case TIMESTAMPOID:
return SQL3_DATE_TIME_TIMESTAMP; /* datetime */
case NUMERICOID:
return SQL3_NUMERIC; /* numeric */
default:
return -(int) type;
}
}
| apache-2.0 |
zhengdejin/X1_Code | kernel-3.10/sound/soc/codecs/wm8731.c | 1086 | 18954 | /*
* wm8731.c -- WM8731 ALSA SoC Audio driver
*
* Copyright 2005 Openedhand Ltd.
* Copyright 2006-12 Wolfson Microelectronics, plc
*
* Author: Richard Purdie <richard@openedhand.com>
*
* Based on wm8753.c by Liam Girdwood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <linux/of_device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include "wm8731.h"
#define WM8731_NUM_SUPPLIES 4
static const char *wm8731_supply_names[WM8731_NUM_SUPPLIES] = {
"AVDD",
"HPVDD",
"DCVDD",
"DBVDD",
};
/* codec private data */
struct wm8731_priv {
struct regmap *regmap;
struct regulator_bulk_data supplies[WM8731_NUM_SUPPLIES];
unsigned int sysclk;
int sysclk_type;
int playback_fs;
bool deemph;
};
/*
* wm8731 register cache
*/
static const struct reg_default wm8731_reg_defaults[] = {
{ 0, 0x0097 },
{ 1, 0x0097 },
{ 2, 0x0079 },
{ 3, 0x0079 },
{ 4, 0x000a },
{ 5, 0x0008 },
{ 6, 0x009f },
{ 7, 0x000a },
{ 8, 0x0000 },
{ 9, 0x0000 },
};
static bool wm8731_volatile(struct device *dev, unsigned int reg)
{
return reg == WM8731_RESET;
}
static bool wm8731_writeable(struct device *dev, unsigned int reg)
{
return reg <= WM8731_RESET;
}
#define wm8731_reset(c) snd_soc_write(c, WM8731_RESET, 0)
static const char *wm8731_input_select[] = {"Line In", "Mic"};
static const struct soc_enum wm8731_insel_enum =
SOC_ENUM_SINGLE(WM8731_APANA, 2, 2, wm8731_input_select);
static int wm8731_deemph[] = { 0, 32000, 44100, 48000 };
static int wm8731_set_deemph(struct snd_soc_codec *codec)
{
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
int val, i, best;
/* If we're using deemphasis select the nearest available sample
* rate.
*/
if (wm8731->deemph) {
best = 1;
for (i = 2; i < ARRAY_SIZE(wm8731_deemph); i++) {
if (abs(wm8731_deemph[i] - wm8731->playback_fs) <
abs(wm8731_deemph[best] - wm8731->playback_fs))
best = i;
}
val = best << 1;
} else {
best = 0;
val = 0;
}
dev_dbg(codec->dev, "Set deemphasis %d (%dHz)\n",
best, wm8731_deemph[best]);
return snd_soc_update_bits(codec, WM8731_APDIGI, 0x6, val);
}
static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
ucontrol->value.enumerated.item[0] = wm8731->deemph;
return 0;
}
static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
int deemph = ucontrol->value.enumerated.item[0];
int ret = 0;
if (deemph > 1)
return -EINVAL;
mutex_lock(&codec->mutex);
if (wm8731->deemph != deemph) {
wm8731->deemph = deemph;
wm8731_set_deemph(codec);
ret = 1;
}
mutex_unlock(&codec->mutex);
return ret;
}
static const DECLARE_TLV_DB_SCALE(in_tlv, -3450, 150, 0);
static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -1500, 300, 0);
static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 2000, 0);
static const struct snd_kcontrol_new wm8731_snd_controls[] = {
SOC_DOUBLE_R_TLV("Master Playback Volume", WM8731_LOUT1V, WM8731_ROUT1V,
0, 127, 0, out_tlv),
SOC_DOUBLE_R("Master Playback ZC Switch", WM8731_LOUT1V, WM8731_ROUT1V,
7, 1, 0),
SOC_DOUBLE_R_TLV("Capture Volume", WM8731_LINVOL, WM8731_RINVOL, 0, 31, 0,
in_tlv),
SOC_DOUBLE_R("Line Capture Switch", WM8731_LINVOL, WM8731_RINVOL, 7, 1, 1),
SOC_SINGLE_TLV("Mic Boost Volume", WM8731_APANA, 0, 1, 0, mic_tlv),
SOC_SINGLE("Mic Capture Switch", WM8731_APANA, 1, 1, 1),
SOC_SINGLE_TLV("Sidetone Playback Volume", WM8731_APANA, 6, 3, 1,
sidetone_tlv),
SOC_SINGLE("ADC High Pass Filter Switch", WM8731_APDIGI, 0, 1, 1),
SOC_SINGLE("Store DC Offset Switch", WM8731_APDIGI, 4, 1, 0),
SOC_SINGLE_BOOL_EXT("Playback Deemphasis Switch", 0,
wm8731_get_deemph, wm8731_put_deemph),
};
/* Output Mixer */
static const struct snd_kcontrol_new wm8731_output_mixer_controls[] = {
SOC_DAPM_SINGLE("Line Bypass Switch", WM8731_APANA, 3, 1, 0),
SOC_DAPM_SINGLE("Mic Sidetone Switch", WM8731_APANA, 5, 1, 0),
SOC_DAPM_SINGLE("HiFi Playback Switch", WM8731_APANA, 4, 1, 0),
};
/* Input mux */
static const struct snd_kcontrol_new wm8731_input_mux_controls =
SOC_DAPM_ENUM("Input Select", wm8731_insel_enum);
static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("ACTIVE",WM8731_ACTIVE, 0, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0),
SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1,
&wm8731_output_mixer_controls[0],
ARRAY_SIZE(wm8731_output_mixer_controls)),
SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8731_PWR, 3, 1),
SND_SOC_DAPM_OUTPUT("LOUT"),
SND_SOC_DAPM_OUTPUT("LHPOUT"),
SND_SOC_DAPM_OUTPUT("ROUT"),
SND_SOC_DAPM_OUTPUT("RHPOUT"),
SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8731_PWR, 2, 1),
SND_SOC_DAPM_MUX("Input Mux", SND_SOC_NOPM, 0, 0, &wm8731_input_mux_controls),
SND_SOC_DAPM_PGA("Line Input", WM8731_PWR, 0, 1, NULL, 0),
SND_SOC_DAPM_MICBIAS("Mic Bias", WM8731_PWR, 1, 1),
SND_SOC_DAPM_INPUT("MICIN"),
SND_SOC_DAPM_INPUT("RLINEIN"),
SND_SOC_DAPM_INPUT("LLINEIN"),
};
static int wm8731_check_osc(struct snd_soc_dapm_widget *source,
struct snd_soc_dapm_widget *sink)
{
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(source->codec);
return wm8731->sysclk_type == WM8731_SYSCLK_XTAL;
}
static const struct snd_soc_dapm_route wm8731_intercon[] = {
{"DAC", NULL, "OSC", wm8731_check_osc},
{"ADC", NULL, "OSC", wm8731_check_osc},
{"DAC", NULL, "ACTIVE"},
{"ADC", NULL, "ACTIVE"},
/* output mixer */
{"Output Mixer", "Line Bypass Switch", "Line Input"},
{"Output Mixer", "HiFi Playback Switch", "DAC"},
{"Output Mixer", "Mic Sidetone Switch", "Mic Bias"},
/* outputs */
{"RHPOUT", NULL, "Output Mixer"},
{"ROUT", NULL, "Output Mixer"},
{"LHPOUT", NULL, "Output Mixer"},
{"LOUT", NULL, "Output Mixer"},
/* input mux */
{"Input Mux", "Line In", "Line Input"},
{"Input Mux", "Mic", "Mic Bias"},
{"ADC", NULL, "Input Mux"},
/* inputs */
{"Line Input", NULL, "LLINEIN"},
{"Line Input", NULL, "RLINEIN"},
{"Mic Bias", NULL, "MICIN"},
};
struct _coeff_div {
u32 mclk;
u32 rate;
u16 fs;
u8 sr:4;
u8 bosr:1;
u8 usb:1;
};
/* codec mclk clock divider coefficients */
static const struct _coeff_div coeff_div[] = {
/* 48k */
{12288000, 48000, 256, 0x0, 0x0, 0x0},
{18432000, 48000, 384, 0x0, 0x1, 0x0},
{12000000, 48000, 250, 0x0, 0x0, 0x1},
/* 32k */
{12288000, 32000, 384, 0x6, 0x0, 0x0},
{18432000, 32000, 576, 0x6, 0x1, 0x0},
{12000000, 32000, 375, 0x6, 0x0, 0x1},
/* 8k */
{12288000, 8000, 1536, 0x3, 0x0, 0x0},
{18432000, 8000, 2304, 0x3, 0x1, 0x0},
{11289600, 8000, 1408, 0xb, 0x0, 0x0},
{16934400, 8000, 2112, 0xb, 0x1, 0x0},
{12000000, 8000, 1500, 0x3, 0x0, 0x1},
/* 96k */
{12288000, 96000, 128, 0x7, 0x0, 0x0},
{18432000, 96000, 192, 0x7, 0x1, 0x0},
{12000000, 96000, 125, 0x7, 0x0, 0x1},
/* 44.1k */
{11289600, 44100, 256, 0x8, 0x0, 0x0},
{16934400, 44100, 384, 0x8, 0x1, 0x0},
{12000000, 44100, 272, 0x8, 0x1, 0x1},
/* 88.2k */
{11289600, 88200, 128, 0xf, 0x0, 0x0},
{16934400, 88200, 192, 0xf, 0x1, 0x0},
{12000000, 88200, 136, 0xf, 0x1, 0x1},
};
static inline int get_coeff(int mclk, int rate)
{
int i;
for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk)
return i;
}
return 0;
}
static int wm8731_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct snd_soc_codec *codec = dai->codec;
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
u16 iface = snd_soc_read(codec, WM8731_IFACE) & 0xfff3;
int i = get_coeff(wm8731->sysclk, params_rate(params));
u16 srate = (coeff_div[i].sr << 2) |
(coeff_div[i].bosr << 1) | coeff_div[i].usb;
wm8731->playback_fs = params_rate(params);
snd_soc_write(codec, WM8731_SRATE, srate);
/* bit size */
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
break;
case SNDRV_PCM_FORMAT_S20_3LE:
iface |= 0x0004;
break;
case SNDRV_PCM_FORMAT_S24_LE:
iface |= 0x0008;
break;
}
wm8731_set_deemph(codec);
snd_soc_write(codec, WM8731_IFACE, iface);
return 0;
}
static int wm8731_mute(struct snd_soc_dai *dai, int mute)
{
struct snd_soc_codec *codec = dai->codec;
u16 mute_reg = snd_soc_read(codec, WM8731_APDIGI) & 0xfff7;
if (mute)
snd_soc_write(codec, WM8731_APDIGI, mute_reg | 0x8);
else
snd_soc_write(codec, WM8731_APDIGI, mute_reg);
return 0;
}
static int wm8731_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir)
{
struct snd_soc_codec *codec = codec_dai->codec;
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
switch (clk_id) {
case WM8731_SYSCLK_XTAL:
case WM8731_SYSCLK_MCLK:
wm8731->sysclk_type = clk_id;
break;
default:
return -EINVAL;
}
switch (freq) {
case 11289600:
case 12000000:
case 12288000:
case 16934400:
case 18432000:
wm8731->sysclk = freq;
break;
default:
return -EINVAL;
}
snd_soc_dapm_sync(&codec->dapm);
return 0;
}
static int wm8731_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt)
{
struct snd_soc_codec *codec = codec_dai->codec;
u16 iface = 0;
/* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
case SND_SOC_DAIFMT_CBM_CFM:
iface |= 0x0040;
break;
case SND_SOC_DAIFMT_CBS_CFS:
break;
default:
return -EINVAL;
}
/* interface format */
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
iface |= 0x0002;
break;
case SND_SOC_DAIFMT_RIGHT_J:
break;
case SND_SOC_DAIFMT_LEFT_J:
iface |= 0x0001;
break;
case SND_SOC_DAIFMT_DSP_A:
iface |= 0x0013;
break;
case SND_SOC_DAIFMT_DSP_B:
iface |= 0x0003;
break;
default:
return -EINVAL;
}
/* clock inversion */
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
break;
case SND_SOC_DAIFMT_IB_IF:
iface |= 0x0090;
break;
case SND_SOC_DAIFMT_IB_NF:
iface |= 0x0080;
break;
case SND_SOC_DAIFMT_NB_IF:
iface |= 0x0010;
break;
default:
return -EINVAL;
}
/* set iface */
snd_soc_write(codec, WM8731_IFACE, iface);
return 0;
}
static int wm8731_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
int ret;
u16 reg;
switch (level) {
case SND_SOC_BIAS_ON:
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
wm8731->supplies);
if (ret != 0)
return ret;
regcache_sync(wm8731->regmap);
}
/* Clear PWROFF, gate CLKOUT, everything else as-is */
reg = snd_soc_read(codec, WM8731_PWR) & 0xff7f;
snd_soc_write(codec, WM8731_PWR, reg | 0x0040);
break;
case SND_SOC_BIAS_OFF:
snd_soc_write(codec, WM8731_PWR, 0xffff);
regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies),
wm8731->supplies);
regcache_mark_dirty(wm8731->regmap);
break;
}
codec->dapm.bias_level = level;
return 0;
}
#define WM8731_RATES SNDRV_PCM_RATE_8000_96000
#define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
SNDRV_PCM_FMTBIT_S24_LE)
static const struct snd_soc_dai_ops wm8731_dai_ops = {
.hw_params = wm8731_hw_params,
.digital_mute = wm8731_mute,
.set_sysclk = wm8731_set_dai_sysclk,
.set_fmt = wm8731_set_dai_fmt,
};
static struct snd_soc_dai_driver wm8731_dai = {
.name = "wm8731-hifi",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 2,
.rates = WM8731_RATES,
.formats = WM8731_FORMATS,},
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 2,
.rates = WM8731_RATES,
.formats = WM8731_FORMATS,},
.ops = &wm8731_dai_ops,
.symmetric_rates = 1,
};
#ifdef CONFIG_PM
static int wm8731_suspend(struct snd_soc_codec *codec)
{
wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int wm8731_resume(struct snd_soc_codec *codec)
{
wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
#else
#define wm8731_suspend NULL
#define wm8731_resume NULL
#endif
static int wm8731_probe(struct snd_soc_codec *codec)
{
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
int ret = 0, i;
codec->control_data = wm8731->regmap;
ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
if (ret < 0) {
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}
for (i = 0; i < ARRAY_SIZE(wm8731->supplies); i++)
wm8731->supplies[i].supply = wm8731_supply_names[i];
ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8731->supplies),
wm8731->supplies);
if (ret != 0) {
dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
return ret;
}
ret = regulator_bulk_enable(ARRAY_SIZE(wm8731->supplies),
wm8731->supplies);
if (ret != 0) {
dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
goto err_regulator_get;
}
ret = wm8731_reset(codec);
if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset: %d\n", ret);
goto err_regulator_enable;
}
wm8731_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
/* Latch the update bits */
snd_soc_update_bits(codec, WM8731_LOUT1V, 0x100, 0);
snd_soc_update_bits(codec, WM8731_ROUT1V, 0x100, 0);
snd_soc_update_bits(codec, WM8731_LINVOL, 0x100, 0);
snd_soc_update_bits(codec, WM8731_RINVOL, 0x100, 0);
/* Disable bypass path by default */
snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0);
/* Regulators will have been enabled by bias management */
regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
return 0;
err_regulator_enable:
regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
err_regulator_get:
regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
return ret;
}
/* power down chip */
static int wm8731_remove(struct snd_soc_codec *codec)
{
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
regulator_bulk_free(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
return 0;
}
static struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
.probe = wm8731_probe,
.remove = wm8731_remove,
.suspend = wm8731_suspend,
.resume = wm8731_resume,
.set_bias_level = wm8731_set_bias_level,
.dapm_widgets = wm8731_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
.dapm_routes = wm8731_intercon,
.num_dapm_routes = ARRAY_SIZE(wm8731_intercon),
.controls = wm8731_snd_controls,
.num_controls = ARRAY_SIZE(wm8731_snd_controls),
};
static const struct of_device_id wm8731_of_match[] = {
{ .compatible = "wlf,wm8731", },
{ }
};
MODULE_DEVICE_TABLE(of, wm8731_of_match);
static const struct regmap_config wm8731_regmap = {
.reg_bits = 7,
.val_bits = 9,
.max_register = WM8731_RESET,
.volatile_reg = wm8731_volatile,
.writeable_reg = wm8731_writeable,
.cache_type = REGCACHE_RBTREE,
.reg_defaults = wm8731_reg_defaults,
.num_reg_defaults = ARRAY_SIZE(wm8731_reg_defaults),
};
#if defined(CONFIG_SPI_MASTER)
static int wm8731_spi_probe(struct spi_device *spi)
{
struct wm8731_priv *wm8731;
int ret;
wm8731 = devm_kzalloc(&spi->dev, sizeof(struct wm8731_priv),
GFP_KERNEL);
if (wm8731 == NULL)
return -ENOMEM;
wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
if (IS_ERR(wm8731->regmap)) {
ret = PTR_ERR(wm8731->regmap);
dev_err(&spi->dev, "Failed to allocate register map: %d\n",
ret);
return ret;
}
spi_set_drvdata(spi, wm8731);
ret = snd_soc_register_codec(&spi->dev,
&soc_codec_dev_wm8731, &wm8731_dai, 1);
if (ret != 0) {
dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
return ret;
}
return 0;
}
static int wm8731_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static struct spi_driver wm8731_spi_driver = {
.driver = {
.name = "wm8731",
.owner = THIS_MODULE,
.of_match_table = wm8731_of_match,
},
.probe = wm8731_spi_probe,
.remove = wm8731_spi_remove,
};
#endif /* CONFIG_SPI_MASTER */
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
static int wm8731_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct wm8731_priv *wm8731;
int ret;
wm8731 = devm_kzalloc(&i2c->dev, sizeof(struct wm8731_priv),
GFP_KERNEL);
if (wm8731 == NULL)
return -ENOMEM;
wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap);
if (IS_ERR(wm8731->regmap)) {
ret = PTR_ERR(wm8731->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret);
return ret;
}
i2c_set_clientdata(i2c, wm8731);
ret = snd_soc_register_codec(&i2c->dev,
&soc_codec_dev_wm8731, &wm8731_dai, 1);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
return ret;
}
return 0;
}
static int wm8731_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id wm8731_i2c_id[] = {
{ "wm8731", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, wm8731_i2c_id);
static struct i2c_driver wm8731_i2c_driver = {
.driver = {
.name = "wm8731",
.owner = THIS_MODULE,
.of_match_table = wm8731_of_match,
},
.probe = wm8731_i2c_probe,
.remove = wm8731_i2c_remove,
.id_table = wm8731_i2c_id,
};
#endif
static int __init wm8731_modinit(void)
{
int ret = 0;
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
ret = i2c_add_driver(&wm8731_i2c_driver);
if (ret != 0) {
printk(KERN_ERR "Failed to register WM8731 I2C driver: %d\n",
ret);
}
#endif
#if defined(CONFIG_SPI_MASTER)
ret = spi_register_driver(&wm8731_spi_driver);
if (ret != 0) {
printk(KERN_ERR "Failed to register WM8731 SPI driver: %d\n",
ret);
}
#endif
return ret;
}
module_init(wm8731_modinit);
static void __exit wm8731_exit(void)
{
#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
i2c_del_driver(&wm8731_i2c_driver);
#endif
#if defined(CONFIG_SPI_MASTER)
spi_unregister_driver(&wm8731_spi_driver);
#endif
}
module_exit(wm8731_exit);
MODULE_DESCRIPTION("ASoC WM8731 driver");
MODULE_AUTHOR("Richard Purdie");
MODULE_LICENSE("GPL");
| apache-2.0 |
ghostkim-sc/SMG920T_profiling_enabled | drivers/parport/parport_serial.c | 2366 | 20173 | /*
* Support for common PCI multi-I/O cards (which is most of them)
*
* Copyright (C) 2001 Tim Waugh <twaugh@redhat.com>
*
* 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.
*
*
* Multi-function PCI cards are supposed to present separate logical
* devices on the bus. A common thing to do seems to be to just use
* one logical device with lots of base address registers for both
* parallel ports and serial ports. This driver is for dealing with
* that.
*
*/
#include <linux/types.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/parport.h>
#include <linux/parport_pc.h>
#include <linux/8250_pci.h>
enum parport_pc_pci_cards {
titan_110l = 0,
titan_210l,
netmos_9xx5_combo,
netmos_9855,
netmos_9855_2p,
netmos_9900,
netmos_9900_2p,
netmos_99xx_1p,
avlab_1s1p,
avlab_1s2p,
avlab_2s1p,
siig_1s1p_10x,
siig_2s1p_10x,
siig_2p1s_20x,
siig_1s1p_20x,
siig_2s1p_20x,
timedia_4078a,
timedia_4079h,
timedia_4085h,
timedia_4088a,
timedia_4089a,
timedia_4095a,
timedia_4096a,
timedia_4078u,
timedia_4079a,
timedia_4085u,
timedia_4079r,
timedia_4079s,
timedia_4079d,
timedia_4079e,
timedia_4079f,
timedia_9079a,
timedia_9079b,
timedia_9079c,
wch_ch353_2s1p,
sunix_2s1p,
};
/* each element directly indexed from enum list, above */
struct parport_pc_pci {
int numports;
struct { /* BAR (base address registers) numbers in the config
space header */
int lo;
int hi; /* -1 if not there, >6 for offset-method (max
BAR is 6) */
} addr[4];
/* If set, this is called immediately after pci_enable_device.
* If it returns non-zero, no probing will take place and the
* ports will not be used. */
int (*preinit_hook) (struct pci_dev *pdev, struct parport_pc_pci *card,
int autoirq, int autodma);
/* If set, this is called after probing for ports. If 'failed'
* is non-zero we couldn't use any of the ports. */
void (*postinit_hook) (struct pci_dev *pdev,
struct parport_pc_pci *card, int failed);
};
static int netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *par,
int autoirq, int autodma)
{
/* the rule described below doesn't hold for this device */
if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
dev->subsystem_device == 0x0299)
return -ENODEV;
if (dev->device == PCI_DEVICE_ID_NETMOS_9912) {
par->numports = 1;
} else {
/*
* Netmos uses the subdevice ID to indicate the number of parallel
* and serial ports. The form is 0x00PS, where <P> is the number of
* parallel ports and <S> is the number of serial ports.
*/
par->numports = (dev->subsystem_device & 0xf0) >> 4;
if (par->numports > ARRAY_SIZE(par->addr))
par->numports = ARRAY_SIZE(par->addr);
}
return 0;
}
static struct parport_pc_pci cards[] = {
/* titan_110l */ { 1, { { 3, -1 }, } },
/* titan_210l */ { 1, { { 3, -1 }, } },
/* netmos_9xx5_combo */ { 1, { { 2, -1 }, }, netmos_parallel_init },
/* netmos_9855 */ { 1, { { 0, -1 }, }, netmos_parallel_init },
/* netmos_9855_2p */ { 2, { { 0, -1 }, { 2, -1 }, } },
/* netmos_9900 */ {1, { { 3, 4 }, }, netmos_parallel_init },
/* netmos_9900_2p */ {2, { { 0, 1 }, { 3, 4 }, } },
/* netmos_99xx_1p */ {1, { { 0, 1 }, } },
/* avlab_1s1p */ { 1, { { 1, 2}, } },
/* avlab_1s2p */ { 2, { { 1, 2}, { 3, 4 },} },
/* avlab_2s1p */ { 1, { { 2, 3}, } },
/* siig_1s1p_10x */ { 1, { { 3, 4 }, } },
/* siig_2s1p_10x */ { 1, { { 4, 5 }, } },
/* siig_2p1s_20x */ { 2, { { 1, 2 }, { 3, 4 }, } },
/* siig_1s1p_20x */ { 1, { { 1, 2 }, } },
/* siig_2s1p_20x */ { 1, { { 2, 3 }, } },
/* timedia_4078a */ { 1, { { 2, -1 }, } },
/* timedia_4079h */ { 1, { { 2, 3 }, } },
/* timedia_4085h */ { 2, { { 2, -1 }, { 4, -1 }, } },
/* timedia_4088a */ { 2, { { 2, 3 }, { 4, 5 }, } },
/* timedia_4089a */ { 2, { { 2, 3 }, { 4, 5 }, } },
/* timedia_4095a */ { 2, { { 2, 3 }, { 4, 5 }, } },
/* timedia_4096a */ { 2, { { 2, 3 }, { 4, 5 }, } },
/* timedia_4078u */ { 1, { { 2, -1 }, } },
/* timedia_4079a */ { 1, { { 2, 3 }, } },
/* timedia_4085u */ { 2, { { 2, -1 }, { 4, -1 }, } },
/* timedia_4079r */ { 1, { { 2, 3 }, } },
/* timedia_4079s */ { 1, { { 2, 3 }, } },
/* timedia_4079d */ { 1, { { 2, 3 }, } },
/* timedia_4079e */ { 1, { { 2, 3 }, } },
/* timedia_4079f */ { 1, { { 2, 3 }, } },
/* timedia_9079a */ { 1, { { 2, 3 }, } },
/* timedia_9079b */ { 1, { { 2, 3 }, } },
/* timedia_9079c */ { 1, { { 2, 3 }, } },
/* wch_ch353_2s1p*/ { 1, { { 2, -1}, } },
/* sunix_2s1p */ { 1, { { 3, -1 }, } },
};
#define PCI_VENDOR_ID_SUNIX 0x1fd4
#define PCI_DEVICE_ID_SUNIX_1999 0x1999
static struct pci_device_id parport_serial_pci_tbl[] = {
/* PCI cards */
{ PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_110L,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_110l },
{ PCI_VENDOR_ID_TITAN, PCI_DEVICE_ID_TITAN_210L,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, titan_210l },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9735,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9745,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9845,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9xx5_combo },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
0x1000, 0x0020, 0, 0, netmos_9855_2p },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
0x1000, 0x0022, 0, 0, netmos_9855_2p },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9855,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, netmos_9855 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
0xA000, 0x3011, 0, 0, netmos_9900 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
0xA000, 0x3012, 0, 0, netmos_9900 },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
0xA000, 0x3020, 0, 0, netmos_9900_2p },
{ PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9912,
0xA000, 0x2000, 0, 0, netmos_99xx_1p },
/* PCI_VENDOR_ID_AVLAB/Intek21 has another bunch of cards ...*/
{ PCI_VENDOR_ID_AFAVLAB, 0x2110,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2111,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2112,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s1p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2140,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2141,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2142,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_1s2p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2160,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2161,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p },
{ PCI_VENDOR_ID_AFAVLAB, 0x2162,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, avlab_2s1p },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_650,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_10x_850,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_650,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_10x_850,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_10x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_650,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2P1S_20x_850,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2p1s_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_650,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_1S1P_20x_850,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_1s1p_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_550,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_650,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
{ PCI_VENDOR_ID_SIIG, PCI_DEVICE_ID_SIIG_2S1P_20x_850,
PCI_ANY_ID, PCI_ANY_ID, 0, 0, siig_2s1p_20x },
/* PCI_VENDOR_ID_TIMEDIA/SUNIX has many differing cards ...*/
{ 0x1409, 0x7168, 0x1409, 0x4078, 0, 0, timedia_4078a },
{ 0x1409, 0x7168, 0x1409, 0x4079, 0, 0, timedia_4079h },
{ 0x1409, 0x7168, 0x1409, 0x4085, 0, 0, timedia_4085h },
{ 0x1409, 0x7168, 0x1409, 0x4088, 0, 0, timedia_4088a },
{ 0x1409, 0x7168, 0x1409, 0x4089, 0, 0, timedia_4089a },
{ 0x1409, 0x7168, 0x1409, 0x4095, 0, 0, timedia_4095a },
{ 0x1409, 0x7168, 0x1409, 0x4096, 0, 0, timedia_4096a },
{ 0x1409, 0x7168, 0x1409, 0x5078, 0, 0, timedia_4078u },
{ 0x1409, 0x7168, 0x1409, 0x5079, 0, 0, timedia_4079a },
{ 0x1409, 0x7168, 0x1409, 0x5085, 0, 0, timedia_4085u },
{ 0x1409, 0x7168, 0x1409, 0x6079, 0, 0, timedia_4079r },
{ 0x1409, 0x7168, 0x1409, 0x7079, 0, 0, timedia_4079s },
{ 0x1409, 0x7168, 0x1409, 0x8079, 0, 0, timedia_4079d },
{ 0x1409, 0x7168, 0x1409, 0x9079, 0, 0, timedia_4079e },
{ 0x1409, 0x7168, 0x1409, 0xa079, 0, 0, timedia_4079f },
{ 0x1409, 0x7168, 0x1409, 0xb079, 0, 0, timedia_9079a },
{ 0x1409, 0x7168, 0x1409, 0xc079, 0, 0, timedia_9079b },
{ 0x1409, 0x7168, 0x1409, 0xd079, 0, 0, timedia_9079c },
/* WCH CARDS */
{ 0x4348, 0x7053, 0x4348, 0x3253, 0, 0, wch_ch353_2s1p},
/*
* More SUNIX variations. At least one of these has part number
* '5079A but subdevice 0x102. That board reports 0x0708 as
* its PCI Class.
*/
{ PCI_VENDOR_ID_SUNIX, PCI_DEVICE_ID_SUNIX_1999, PCI_VENDOR_ID_SUNIX,
0x0102, 0, 0, sunix_2s1p },
{ 0, } /* terminate list */
};
MODULE_DEVICE_TABLE(pci,parport_serial_pci_tbl);
/*
* This table describes the serial "geometry" of these boards. Any
* quirks for these can be found in drivers/serial/8250_pci.c
*
* Cards not tested are marked n/t
* If you have one of these cards and it works for you, please tell me..
*/
static struct pciserial_board pci_parport_serial_boards[] = {
[titan_110l] = {
.flags = FL_BASE1 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[titan_210l] = {
.flags = FL_BASE1 | FL_BASE_BARS,
.num_ports = 2,
.base_baud = 921600,
.uart_offset = 8,
},
[netmos_9xx5_combo] = {
.flags = FL_BASE0 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[netmos_9855] = {
.flags = FL_BASE2 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[netmos_9855_2p] = {
.flags = FL_BASE4 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[netmos_9900] = { /* n/t */
.flags = FL_BASE0 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[netmos_9900_2p] = { /* parallel only */ /* n/t */
.flags = FL_BASE0,
.num_ports = 0,
.base_baud = 115200,
.uart_offset = 8,
},
[netmos_99xx_1p] = { /* parallel only */ /* n/t */
.flags = FL_BASE0,
.num_ports = 0,
.base_baud = 115200,
.uart_offset = 8,
},
[avlab_1s1p] = { /* n/t */
.flags = FL_BASE0 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[avlab_1s2p] = { /* n/t */
.flags = FL_BASE0 | FL_BASE_BARS,
.num_ports = 1,
.base_baud = 115200,
.uart_offset = 8,
},
[avlab_2s1p] = { /* n/t */
.flags = FL_BASE0 | FL_BASE_BARS,
.num_ports = 2,
.base_baud = 115200,
.uart_offset = 8,
},
[siig_1s1p_10x] = {
.flags = FL_BASE2,
.num_ports = 1,
.base_baud = 460800,
.uart_offset = 8,
},
[siig_2s1p_10x] = {
.flags = FL_BASE2,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[siig_2p1s_20x] = {
.flags = FL_BASE0,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[siig_1s1p_20x] = {
.flags = FL_BASE0,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[siig_2s1p_20x] = {
.flags = FL_BASE0,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4078a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079h] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4085h] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4088a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4089a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4095a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4096a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4078u] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4085u] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079r] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079s] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079d] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079e] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_4079f] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_9079a] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_9079b] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[timedia_9079c] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 1,
.base_baud = 921600,
.uart_offset = 8,
},
[wch_ch353_2s1p] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 2,
.base_baud = 115200,
.uart_offset = 8,
},
[sunix_2s1p] = {
.flags = FL_BASE0|FL_BASE_BARS,
.num_ports = 2,
.base_baud = 921600,
.uart_offset = 8,
},
};
struct parport_serial_private {
struct serial_private *serial;
int num_par;
struct parport *port[PARPORT_MAX];
struct parport_pc_pci par;
};
/* Register the serial port(s) of a PCI card. */
static int serial_register(struct pci_dev *dev, const struct pci_device_id *id)
{
struct parport_serial_private *priv = pci_get_drvdata (dev);
struct pciserial_board *board;
struct serial_private *serial;
board = &pci_parport_serial_boards[id->driver_data];
if (board->num_ports == 0)
return 0;
serial = pciserial_init_ports(dev, board);
if (IS_ERR(serial))
return PTR_ERR(serial);
priv->serial = serial;
return 0;
}
/* Register the parallel port(s) of a PCI card. */
static int parport_register(struct pci_dev *dev, const struct pci_device_id *id)
{
struct parport_pc_pci *card;
struct parport_serial_private *priv = pci_get_drvdata (dev);
int n, success = 0;
priv->par = cards[id->driver_data];
card = &priv->par;
if (card->preinit_hook &&
card->preinit_hook (dev, card, PARPORT_IRQ_NONE, PARPORT_DMA_NONE))
return -ENODEV;
for (n = 0; n < card->numports; n++) {
struct parport *port;
int lo = card->addr[n].lo;
int hi = card->addr[n].hi;
unsigned long io_lo, io_hi;
int irq;
if (priv->num_par == ARRAY_SIZE (priv->port)) {
printk (KERN_WARNING
"parport_serial: %s: only %zu parallel ports "
"supported (%d reported)\n", pci_name (dev),
ARRAY_SIZE(priv->port), card->numports);
break;
}
io_lo = pci_resource_start (dev, lo);
io_hi = 0;
if ((hi >= 0) && (hi <= 6))
io_hi = pci_resource_start (dev, hi);
else if (hi > 6)
io_lo += hi; /* Reinterpret the meaning of
"hi" as an offset (see SYBA
def.) */
/* TODO: test if sharing interrupts works */
irq = dev->irq;
if (irq == IRQ_NONE) {
dev_dbg(&dev->dev,
"PCI parallel port detected: I/O at %#lx(%#lx)\n",
io_lo, io_hi);
irq = PARPORT_IRQ_NONE;
} else {
dev_dbg(&dev->dev,
"PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n",
io_lo, io_hi, irq);
}
port = parport_pc_probe_port (io_lo, io_hi, irq,
PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED);
if (port) {
priv->port[priv->num_par++] = port;
success = 1;
}
}
if (card->postinit_hook)
card->postinit_hook (dev, card, !success);
return 0;
}
static int parport_serial_pci_probe(struct pci_dev *dev,
const struct pci_device_id *id)
{
struct parport_serial_private *priv;
int err;
priv = kzalloc (sizeof *priv, GFP_KERNEL);
if (!priv)
return -ENOMEM;
pci_set_drvdata (dev, priv);
err = pci_enable_device (dev);
if (err) {
pci_set_drvdata (dev, NULL);
kfree (priv);
return err;
}
if (parport_register (dev, id)) {
pci_set_drvdata (dev, NULL);
kfree (priv);
return -ENODEV;
}
if (serial_register (dev, id)) {
int i;
for (i = 0; i < priv->num_par; i++)
parport_pc_unregister_port (priv->port[i]);
pci_set_drvdata (dev, NULL);
kfree (priv);
return -ENODEV;
}
return 0;
}
static void parport_serial_pci_remove(struct pci_dev *dev)
{
struct parport_serial_private *priv = pci_get_drvdata (dev);
int i;
pci_set_drvdata(dev, NULL);
// Serial ports
if (priv->serial)
pciserial_remove_ports(priv->serial);
// Parallel ports
for (i = 0; i < priv->num_par; i++)
parport_pc_unregister_port (priv->port[i]);
kfree (priv);
return;
}
#ifdef CONFIG_PM
static int parport_serial_pci_suspend(struct pci_dev *dev, pm_message_t state)
{
struct parport_serial_private *priv = pci_get_drvdata(dev);
if (priv->serial)
pciserial_suspend_ports(priv->serial);
/* FIXME: What about parport? */
pci_save_state(dev);
pci_set_power_state(dev, pci_choose_state(dev, state));
return 0;
}
static int parport_serial_pci_resume(struct pci_dev *dev)
{
struct parport_serial_private *priv = pci_get_drvdata(dev);
int err;
pci_set_power_state(dev, PCI_D0);
pci_restore_state(dev);
/*
* The device may have been disabled. Re-enable it.
*/
err = pci_enable_device(dev);
if (err) {
printk(KERN_ERR "parport_serial: %s: error enabling "
"device for resume (%d)\n", pci_name(dev), err);
return err;
}
if (priv->serial)
pciserial_resume_ports(priv->serial);
/* FIXME: What about parport? */
return 0;
}
#endif
static struct pci_driver parport_serial_pci_driver = {
.name = "parport_serial",
.id_table = parport_serial_pci_tbl,
.probe = parport_serial_pci_probe,
.remove = parport_serial_pci_remove,
#ifdef CONFIG_PM
.suspend = parport_serial_pci_suspend,
.resume = parport_serial_pci_resume,
#endif
};
static int __init parport_serial_init (void)
{
return pci_register_driver (&parport_serial_pci_driver);
}
static void __exit parport_serial_exit (void)
{
pci_unregister_driver (&parport_serial_pci_driver);
return;
}
MODULE_AUTHOR("Tim Waugh <twaugh@redhat.com>");
MODULE_DESCRIPTION("Driver for common parallel+serial multi-I/O PCI cards");
MODULE_LICENSE("GPL");
module_init(parport_serial_init);
module_exit(parport_serial_exit);
| apache-2.0 |
armink/rt-thread | bsp/lpc176x/CMSIS/CM3/DeviceSupport/NXP/LPC17xx/system_LPC17xx.c | 64 | 22618 | /**************************************************************************//**
* @file system_LPC17xx.c
* @brief CMSIS Cortex-M3 Device Peripheral Access Layer Source File
* for the NXP LPC17xx Device Series
* @version V1.03
* @date 07. October 2009
*
* @note
* Copyright (C) 2009 ARM Limited. All rights reserved.
*
* @par
* ARM Limited (ARM) is supplying this software for use with Cortex-M
* processor based microcontrollers. This file can be freely distributed
* within development tools that are supporting such ARM based processors.
*
* @par
* THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
* ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
******************************************************************************/
#include <stdint.h>
#include "LPC17xx.h"
/*
//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
*/
/*--------------------- Clock Configuration ----------------------------------
//
// <e> Clock Configuration
// <h> System Controls and Status Register (SCS)
// <o1.4> OSCRANGE: Main Oscillator Range Select
// <0=> 1 MHz to 20 MHz
// <1=> 15 MHz to 24 MHz
// <e1.5> OSCEN: Main Oscillator Enable
// </e>
// </h>
//
// <h> Clock Source Select Register (CLKSRCSEL)
// <o2.0..1> CLKSRC: PLL Clock Source Selection
// <0=> Internal RC oscillator
// <1=> Main oscillator
// <2=> RTC oscillator
// </h>
//
// <e3> PLL0 Configuration (Main PLL)
// <h> PLL0 Configuration Register (PLL0CFG)
// <i> F_cco0 = (2 * M * F_in) / N
// <i> F_in must be in the range of 32 kHz to 50 MHz
// <i> F_cco0 must be in the range of 275 MHz to 550 MHz
// <o4.0..14> MSEL: PLL Multiplier Selection
// <6-32768><#-1>
// <i> M Value
// <o4.16..23> NSEL: PLL Divider Selection
// <1-256><#-1>
// <i> N Value
// </h>
// </e>
//
// <e5> PLL1 Configuration (USB PLL)
// <h> PLL1 Configuration Register (PLL1CFG)
// <i> F_usb = M * F_osc or F_usb = F_cco1 / (2 * P)
// <i> F_cco1 = F_osc * M * 2 * P
// <i> F_cco1 must be in the range of 156 MHz to 320 MHz
// <o6.0..4> MSEL: PLL Multiplier Selection
// <1-32><#-1>
// <i> M Value (for USB maximum value is 4)
// <o6.5..6> PSEL: PLL Divider Selection
// <0=> 1
// <1=> 2
// <2=> 4
// <3=> 8
// <i> P Value
// </h>
// </e>
//
// <h> CPU Clock Configuration Register (CCLKCFG)
// <o7.0..7> CCLKSEL: Divide Value for CPU Clock from PLL0
// <3-256><#-1>
// </h>
//
// <h> USB Clock Configuration Register (USBCLKCFG)
// <o8.0..3> USBSEL: Divide Value for USB Clock from PLL0
// <0-15>
// <i> Divide is USBSEL + 1
// </h>
//
// <h> Peripheral Clock Selection Register 0 (PCLKSEL0)
// <o9.0..1> PCLK_WDT: Peripheral Clock Selection for WDT
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.2..3> PCLK_TIMER0: Peripheral Clock Selection for TIMER0
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.4..5> PCLK_TIMER1: Peripheral Clock Selection for TIMER1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.6..7> PCLK_UART0: Peripheral Clock Selection for UART0
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.8..9> PCLK_UART1: Peripheral Clock Selection for UART1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.12..13> PCLK_PWM1: Peripheral Clock Selection for PWM1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.14..15> PCLK_I2C0: Peripheral Clock Selection for I2C0
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.16..17> PCLK_SPI: Peripheral Clock Selection for SPI
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.20..21> PCLK_SSP1: Peripheral Clock Selection for SSP1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.22..23> PCLK_DAC: Peripheral Clock Selection for DAC
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.24..25> PCLK_ADC: Peripheral Clock Selection for ADC
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o9.26..27> PCLK_CAN1: Peripheral Clock Selection for CAN1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 6
// <o9.28..29> PCLK_CAN2: Peripheral Clock Selection for CAN2
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 6
// <o9.30..31> PCLK_ACF: Peripheral Clock Selection for ACF
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 6
// </h>
//
// <h> Peripheral Clock Selection Register 1 (PCLKSEL1)
// <o10.0..1> PCLK_QEI: Peripheral Clock Selection for the Quadrature Encoder Interface
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.2..3> PCLK_GPIO: Peripheral Clock Selection for GPIOs
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.4..5> PCLK_PCB: Peripheral Clock Selection for the Pin Connect Block
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.6..7> PCLK_I2C1: Peripheral Clock Selection for I2C1
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.10..11> PCLK_SSP0: Peripheral Clock Selection for SSP0
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.12..13> PCLK_TIMER2: Peripheral Clock Selection for TIMER2
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.14..15> PCLK_TIMER3: Peripheral Clock Selection for TIMER3
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.16..17> PCLK_UART2: Peripheral Clock Selection for UART2
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.18..19> PCLK_UART3: Peripheral Clock Selection for UART3
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.20..21> PCLK_I2C2: Peripheral Clock Selection for I2C2
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.22..23> PCLK_I2S: Peripheral Clock Selection for I2S
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.26..27> PCLK_RIT: Peripheral Clock Selection for the Repetitive Interrupt Timer
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.28..29> PCLK_SYSCON: Peripheral Clock Selection for the System Control Block
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// <o10.30..31> PCLK_MC: Peripheral Clock Selection for the Motor Control PWM
// <0=> Pclk = Cclk / 4
// <1=> Pclk = Cclk
// <2=> Pclk = Cclk / 2
// <3=> Pclk = Hclk / 8
// </h>
//
// <h> Power Control for Peripherals Register (PCONP)
// <o11.1> PCTIM0: Timer/Counter 0 power/clock enable
// <o11.2> PCTIM1: Timer/Counter 1 power/clock enable
// <o11.3> PCUART0: UART 0 power/clock enable
// <o11.4> PCUART1: UART 1 power/clock enable
// <o11.6> PCPWM1: PWM 1 power/clock enable
// <o11.7> PCI2C0: I2C interface 0 power/clock enable
// <o11.8> PCSPI: SPI interface power/clock enable
// <o11.9> PCRTC: RTC power/clock enable
// <o11.10> PCSSP1: SSP interface 1 power/clock enable
// <o11.12> PCAD: A/D converter power/clock enable
// <o11.13> PCCAN1: CAN controller 1 power/clock enable
// <o11.14> PCCAN2: CAN controller 2 power/clock enable
// <o11.15> PCGPIO: GPIOs power/clock enable
// <o11.16> PCRIT: Repetitive interrupt timer power/clock enable
// <o11.17> PCMC: Motor control PWM power/clock enable
// <o11.18> PCQEI: Quadrature encoder interface power/clock enable
// <o11.19> PCI2C1: I2C interface 1 power/clock enable
// <o11.21> PCSSP0: SSP interface 0 power/clock enable
// <o11.22> PCTIM2: Timer 2 power/clock enable
// <o11.23> PCTIM3: Timer 3 power/clock enable
// <o11.24> PCUART2: UART 2 power/clock enable
// <o11.25> PCUART3: UART 3 power/clock enable
// <o11.26> PCI2C2: I2C interface 2 power/clock enable
// <o11.27> PCI2S: I2S interface power/clock enable
// <o11.29> PCGPDMA: GP DMA function power/clock enable
// <o11.30> PCENET: Ethernet block power/clock enable
// <o11.31> PCUSB: USB interface power/clock enable
// </h>
//
// <h> Clock Output Configuration Register (CLKOUTCFG)
// <o12.0..3> CLKOUTSEL: Selects clock source for CLKOUT
// <0=> CPU clock
// <1=> Main oscillator
// <2=> Internal RC oscillator
// <3=> USB clock
// <4=> RTC oscillator
// <o12.4..7> CLKOUTDIV: Selects clock divider for CLKOUT
// <1-16><#-1>
// <o12.8> CLKOUT_EN: CLKOUT enable control
// </h>
//
// </e>
*/
#define CLOCK_SETUP 1
#define SCS_Val 0x00000020
#define CLKSRCSEL_Val 0x00000001
#define PLL0_SETUP 1
#define PLL0CFG_Val 0x00050063
#define PLL1_SETUP 1
#define PLL1CFG_Val 0x00000023
#define CCLKCFG_Val 0x00000003
#define USBCLKCFG_Val 0x00000000
#define PCLKSEL0_Val 0x00000000
#define PCLKSEL1_Val 0x00000000
#define PCONP_Val 0x042887DE
#define CLKOUTCFG_Val 0x00000000
/*--------------------- Flash Accelerator Configuration ----------------------
//
// <e> Flash Accelerator Configuration
// <o1.0..1> FETCHCFG: Fetch Configuration
// <0=> Instruction fetches from flash are not buffered
// <1=> One buffer is used for all instruction fetch buffering
// <2=> All buffers may be used for instruction fetch buffering
// <3=> Reserved (do not use this setting)
// <o1.2..3> DATACFG: Data Configuration
// <0=> Data accesses from flash are not buffered
// <1=> One buffer is used for all data access buffering
// <2=> All buffers may be used for data access buffering
// <3=> Reserved (do not use this setting)
// <o1.4> ACCEL: Acceleration Enable
// <o1.5> PREFEN: Prefetch Enable
// <o1.6> PREFOVR: Prefetch Override
// <o1.12..15> FLASHTIM: Flash Access Time
// <0=> 1 CPU clock (for CPU clock up to 20 MHz)
// <1=> 2 CPU clocks (for CPU clock up to 40 MHz)
// <2=> 3 CPU clocks (for CPU clock up to 60 MHz)
// <3=> 4 CPU clocks (for CPU clock up to 80 MHz)
// <4=> 5 CPU clocks (for CPU clock up to 100 MHz)
// <5=> 6 CPU clocks (for any CPU clock)
// </e>
*/
#define FLASH_SETUP 1
#define FLASHCFG_Val 0x0000303A
/*
//-------- <<< end of configuration section >>> ------------------------------
*/
/*----------------------------------------------------------------------------
Check the register settings
*----------------------------------------------------------------------------*/
#define CHECK_RANGE(val, min, max) ((val < min) || (val > max))
#define CHECK_RSVD(val, mask) (val & mask)
/* Clock Configuration -------------------------------------------------------*/
#if (CHECK_RSVD((SCS_Val), ~0x00000030))
#error "SCS: Invalid values of reserved bits!"
#endif
#if (CHECK_RANGE((CLKSRCSEL_Val), 0, 2))
#error "CLKSRCSEL: Value out of range!"
#endif
#if (CHECK_RSVD((PLL0CFG_Val), ~0x00FF7FFF))
#error "PLL0CFG: Invalid values of reserved bits!"
#endif
#if (CHECK_RSVD((PLL1CFG_Val), ~0x0000007F))
#error "PLL1CFG: Invalid values of reserved bits!"
#endif
#if ((CCLKCFG_Val != 0) && (((CCLKCFG_Val - 1) % 2)))
#error "CCLKCFG: CCLKSEL field does not contain only odd values or 0!"
#endif
#if (CHECK_RSVD((USBCLKCFG_Val), ~0x0000000F))
#error "USBCLKCFG: Invalid values of reserved bits!"
#endif
#if (CHECK_RSVD((PCLKSEL0_Val), 0x000C0C00))
#error "PCLKSEL0: Invalid values of reserved bits!"
#endif
#if (CHECK_RSVD((PCLKSEL1_Val), 0x03000300))
#error "PCLKSEL1: Invalid values of reserved bits!"
#endif
#if (CHECK_RSVD((PCONP_Val), 0x10100821))
#error "PCONP: Invalid values of reserved bits!"
#endif
#if (CHECK_RSVD((CLKOUTCFG_Val), ~0x000001FF))
#error "CLKOUTCFG: Invalid values of reserved bits!"
#endif
/* Flash Accelerator Configuration -------------------------------------------*/
#if (CHECK_RSVD((FLASHCFG_Val), ~0x0000F07F))
#error "FLASHCFG: Invalid values of reserved bits!"
#endif
/*----------------------------------------------------------------------------
DEFINES
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
Define clocks
*----------------------------------------------------------------------------*/
#define XTAL (12000000UL) /* Oscillator frequency */
#define OSC_CLK ( XTAL) /* Main oscillator frequency */
#define RTC_CLK ( 32000UL) /* RTC oscillator frequency */
#define IRC_OSC ( 4000000UL) /* Internal RC oscillator frequency */
/* F_cco0 = (2 * M * F_in) / N */
#define __M (((PLL0CFG_Val ) & 0x7FFF) + 1)
#define __N (((PLL0CFG_Val >> 16) & 0x00FF) + 1)
#define __FCCO(__F_IN) ((2 * __M * __F_IN) / __N)
#define __CCLK_DIV (((CCLKCFG_Val ) & 0x00FF) + 1)
/* Determine core clock frequency according to settings */
#if (PLL0_SETUP)
#if ((CLKSRCSEL_Val & 0x03) == 1)
#define __CORE_CLK (__FCCO(OSC_CLK) / __CCLK_DIV)
#elif ((CLKSRCSEL_Val & 0x03) == 2)
#define __CORE_CLK (__FCCO(RTC_CLK) / __CCLK_DIV)
#else
#define __CORE_CLK (__FCCO(IRC_OSC) / __CCLK_DIV)
#endif
#else
#if ((CLKSRCSEL_Val & 0x03) == 1)
#define __CORE_CLK (OSC_CLK / __CCLK_DIV)
#elif ((CLKSRCSEL_Val & 0x03) == 2)
#define __CORE_CLK (RTC_CLK / __CCLK_DIV)
#else
#define __CORE_CLK (IRC_OSC / __CCLK_DIV)
#endif
#endif
/*----------------------------------------------------------------------------
Clock Variable definitions
*----------------------------------------------------------------------------*/
uint32_t SystemCoreClock = __CORE_CLK;/*!< System Clock Frequency (Core Clock)*/
/*----------------------------------------------------------------------------
Clock functions
*----------------------------------------------------------------------------*/
void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
{
/* Determine clock frequency according to clock register values */
if (((LPC_SC->PLL0STAT >> 24) & 3) == 3) { /* If PLL0 enabled and connected */
switch (LPC_SC->CLKSRCSEL & 0x03) {
case 0: /* Int. RC oscillator => PLL0 */
case 3: /* Reserved, default to Int. RC */
SystemCoreClock = (IRC_OSC *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
case 1: /* Main oscillator => PLL0 */
SystemCoreClock = (OSC_CLK *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
case 2: /* RTC oscillator => PLL0 */
SystemCoreClock = (RTC_CLK *
((2 * ((LPC_SC->PLL0STAT & 0x7FFF) + 1))) /
(((LPC_SC->PLL0STAT >> 16) & 0xFF) + 1) /
((LPC_SC->CCLKCFG & 0xFF)+ 1));
break;
}
} else {
switch (LPC_SC->CLKSRCSEL & 0x03) {
case 0: /* Int. RC oscillator => PLL0 */
case 3: /* Reserved, default to Int. RC */
SystemCoreClock = IRC_OSC / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
case 1: /* Main oscillator => PLL0 */
SystemCoreClock = OSC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
case 2: /* RTC oscillator => PLL0 */
SystemCoreClock = RTC_CLK / ((LPC_SC->CCLKCFG & 0xFF)+ 1);
break;
}
}
}
/**
* Initialize the system
*
* @param none
* @return none
*
* @brief Setup the microcontroller system.
* Initialize the System.
*/
void SystemInit (void)
{
#if (CLOCK_SETUP) /* Clock Setup */
LPC_SC->SCS = SCS_Val;
if (SCS_Val & (1 << 5)) { /* If Main Oscillator is enabled */
while ((LPC_SC->SCS & (1<<6)) == 0);/* Wait for Oscillator to be ready */
}
LPC_SC->CCLKCFG = CCLKCFG_Val; /* Setup Clock Divider */
#if (PLL0_SETUP)
LPC_SC->CLKSRCSEL = CLKSRCSEL_Val; /* Select Clock Source for PLL0 */
LPC_SC->PLL0CFG = PLL0CFG_Val; /* configure PLL0 */
LPC_SC->PLL0FEED = 0xAA;
LPC_SC->PLL0FEED = 0x55;
LPC_SC->PLL0CON = 0x01; /* PLL0 Enable */
LPC_SC->PLL0FEED = 0xAA;
LPC_SC->PLL0FEED = 0x55;
while (!(LPC_SC->PLL0STAT & (1<<26)));/* Wait for PLOCK0 */
LPC_SC->PLL0CON = 0x03; /* PLL0 Enable & Connect */
LPC_SC->PLL0FEED = 0xAA;
LPC_SC->PLL0FEED = 0x55;
while (!(LPC_SC->PLL0STAT & ((1<<25) | (1<<24))));/* Wait for PLLC0_STAT & PLLE0_STAT */
#endif
#if (PLL1_SETUP)
LPC_SC->PLL1CFG = PLL1CFG_Val;
LPC_SC->PLL1FEED = 0xAA;
LPC_SC->PLL1FEED = 0x55;
LPC_SC->PLL1CON = 0x01; /* PLL1 Enable */
LPC_SC->PLL1FEED = 0xAA;
LPC_SC->PLL1FEED = 0x55;
while (!(LPC_SC->PLL1STAT & (1<<10)));/* Wait for PLOCK1 */
LPC_SC->PLL1CON = 0x03; /* PLL1 Enable & Connect */
LPC_SC->PLL1FEED = 0xAA;
LPC_SC->PLL1FEED = 0x55;
while (!(LPC_SC->PLL1STAT & ((1<< 9) | (1<< 8))));/* Wait for PLLC1_STAT & PLLE1_STAT */
#else
LPC_SC->USBCLKCFG = USBCLKCFG_Val; /* Setup USB Clock Divider */
#endif
LPC_SC->PCLKSEL0 = PCLKSEL0_Val; /* Peripheral Clock Selection */
LPC_SC->PCLKSEL1 = PCLKSEL1_Val;
LPC_SC->PCONP = PCONP_Val; /* Power Control for Peripherals */
LPC_SC->CLKOUTCFG = CLKOUTCFG_Val; /* Clock Output Configuration */
#endif
#if (FLASH_SETUP == 1) /* Flash Accelerator Setup */
LPC_SC->FLASHCFG = FLASHCFG_Val;
#endif
}
| apache-2.0 |
monkiineko/mbed-os | targets/TARGET_NORDIC/TARGET_NRF5/TARGET_SDK11/libraries/pwm/app_pwm.c | 69 | 31415 | /*
* Copyright (c) 2015 Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
* integrated circuit in a product or a software update for such product, must reproduce
* the above copyright notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific prior
* written permission.
*
* 4. This software, with or without modification, must only be used with a
* Nordic Semiconductor ASA integrated circuit.
*
* 5. Any software provided in binary or object form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "app_pwm.h"
#include "nrf_drv_timer.h"
#include "nrf_drv_ppi.h"
#include "nrf_drv_common.h"
#include "nrf_drv_gpiote.h"
#include "nrf_gpiote.h"
#include "nrf_gpio.h"
#include "app_util.h"
#include "app_util_platform.h"
#include "nrf_assert.h"
#define APP_PWM_CHANNEL_INITIALIZED 1
#define APP_PWM_CHANNEL_UNINITIALIZED 0
#define APP_PWM_CHANNEL_ENABLED 1
#define APP_PWM_CHANNEL_DISABLED 0
#define TIMER_PRESCALER_MAX 9
#define TIMER_MAX_PULSEWIDTH_US_ON_16M 4095
#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE 2
#define APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL 2
#define UNALLOCATED 0xFFFFFFFFUL
#define BUSY_STATE_CHANGING 0xFE
#define BUSY_STATE_IDLE 0xFF
#define PWM_MAIN_CC_CHANNEL 2
#define PWM_SECONDARY_CC_CHANNEL 3
#ifdef NRF52
static bool m_use_ppi_delay_workaround;
#endif
/**
* @brief PWM busy status
*
* Stores the number of a channel being currently updated.
*
*/
static volatile uint8_t m_pwm_busy[TIMER_COUNT];
/**
* @brief New duty cycle value
*
* When the channel duty cycle reaches this value, the update process is complete.
*/
static volatile uint32_t m_pwm_target_value[TIMER_COUNT];
/**
* @brief PWM ready counter
*
* The value in this counter is decremented in every PWM cycle after initiating the update.
* If an event handler function was specified by the user, it is being called
* after two cycle events (at least one full PWM cycle).
*/
volatile uint8_t m_pwm_ready_counter[TIMER_COUNT][APP_PWM_CHANNELS_PER_INSTANCE];
/**
* @brief Pointers to instances
*
* This array connects any active timer instance number with the pointer to the PWM instance.
* It is used by the interrupt runtime.
*/
static const app_pwm_t * m_instances[TIMER_COUNT];
// Macros for getting the polarity of given instance/channel.
#define POLARITY_ACTIVE(INST,CH) (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \
APP_PWM_POLARITY_ACTIVE_LOW)?(0):(1))
#define POLARITY_INACTIVE(INST,CH) (( ((INST)->p_cb)->channels_cb[(CH)].polarity == \
APP_PWM_POLARITY_ACTIVE_LOW)?(1):(0))
//lint -save -e534
/**
* @brief Workaround for PAN-73.
*
* @param[in] timer Timer.
* @param[in] enable Enable or disable.
*/
static void pan73_workaround(NRF_TIMER_Type * p_timer, bool enable)
{
#ifdef NRF51
if (p_timer == NRF_TIMER0)
{
*(uint32_t *)0x40008C0C = (enable ? 1 : 0);
}
else if (p_timer == NRF_TIMER1)
{
*(uint32_t *)0x40009C0C = (enable ? 1 : 0);
}
else if (p_timer == NRF_TIMER2)
{
*(uint32_t *)0x4000AC0C = (enable ? 1 : 0);
}
#endif
return;
}
bool app_pwm_busy_check(app_pwm_t const * const p_instance)
{
uint8_t busy_state = (m_pwm_busy[p_instance->p_timer->instance_id]);
bool busy = true;
if (busy_state != BUSY_STATE_IDLE)
{
if (busy_state != BUSY_STATE_CHANGING)
{
if (nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) busy_state)
== m_pwm_target_value[p_instance->p_timer->instance_id])
{
m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
busy = false;
}
}
}
else
{
busy = false;
}
return busy;
}
/**
* @brief Function for enabling the IRQ for a given PWM instance.
*
* @param[in] p_instance PWM instance.
*/
__STATIC_INLINE void pwm_irq_enable(app_pwm_t const * const p_instance)
{
nrf_drv_timer_compare_int_enable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
}
/**
* @brief Function for disabling the IRQ for a given PWM instance.
*
* @param[in] p_instance PWM instance.
*/
__STATIC_INLINE void pwm_irq_disable(app_pwm_t const * const p_instance)
{
nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
}
/**
* @brief Function for disabling PWM channel PPI.
*
* @param[in] p_instance PWM instance.
*/
__STATIC_INLINE void pwm_channel_ppi_disable(app_pwm_t const * const p_instance, uint8_t channel)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[0]);
nrf_drv_ppi_channel_disable(p_cb->channels_cb[channel].ppi_channels[1]);
}
/**
* @brief Function for disabling PWM PPI.
*
* @param[in] p_instance PWM instance.
*/
__STATIC_INLINE void pwm_ppi_disable(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
nrf_drv_ppi_channel_disable(p_cb->ppi_channels[0]);
nrf_drv_ppi_channel_disable(p_cb->ppi_channels[1]);
}
/**
* @brief This function is called on interrupt after duty set.
*
* @param[in] timer Timer used by PWM.
* @param[in] timer_instance_id Timer index.
*/
void pwm_ready_tick(nrf_timer_event_t event_type, void * p_context)
{
uint32_t timer_instance_id = (uint32_t)p_context;
uint8_t disable = 1;
for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
{
if (m_pwm_ready_counter[timer_instance_id][channel])
{
--m_pwm_ready_counter[timer_instance_id][channel];
if (!m_pwm_ready_counter[timer_instance_id][channel])
{
app_pwm_cb_t * p_cb = m_instances[timer_instance_id]->p_cb;
p_cb->p_ready_callback(timer_instance_id);
}
else
{
disable = 0;
}
}
}
if (disable)
{
pwm_irq_disable(m_instances[timer_instance_id]);
}
}
/**
* @brief Function for resource de-allocation.
*
* @param[in] p_instance PWM instance.
*/
//lint -e{650}
static void pwm_dealloc(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i)
{
if (p_cb->ppi_channels[i] != (nrf_ppi_channel_t)(uint8_t)(UNALLOCATED))
{
nrf_drv_ppi_channel_free(p_cb->ppi_channels[i]);
}
}
if (p_cb->ppi_group != (nrf_ppi_channel_group_t)UNALLOCATED)
{
nrf_drv_ppi_group_free(p_cb->ppi_group);
}
for (uint8_t ch = 0; ch < APP_PWM_CHANNELS_PER_INSTANCE; ++ch)
{
for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i)
{
if (p_cb->channels_cb[ch].ppi_channels[i] != (nrf_ppi_channel_t)UNALLOCATED)
{
nrf_drv_ppi_channel_free(p_cb->channels_cb[ch].ppi_channels[i]);
p_cb->channels_cb[ch].ppi_channels[i] = (nrf_ppi_channel_t)UNALLOCATED;
}
}
if (p_cb->channels_cb[ch].gpio_pin != UNALLOCATED)
{
nrf_drv_gpiote_out_uninit(p_cb->channels_cb[ch].gpio_pin);
p_cb->channels_cb[ch].gpio_pin = UNALLOCATED;
}
p_cb->channels_cb[ch].initialized = APP_PWM_CHANNEL_UNINITIALIZED;
}
nrf_drv_timer_uninit(p_instance->p_timer);
return;
}
/**
* @brief PWM state transition from (0%, 100%) to 0% or 100%.
*
* @param[in] p_instance PWM instance.
* @param[in] channel PWM channel number.
* @param[in] ticks Number of clock ticks.
*/
static void pwm_transition_n_to_0or100(app_pwm_t const * const p_instance,
uint8_t channel, uint16_t ticks)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group;
pwm_ppi_disable(p_instance);
nrf_drv_ppi_group_clear(p_ppigrp);
nrf_drv_ppi_channels_include_in_group(
nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0]) |
nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]),
p_ppigrp);
if (!ticks)
{
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp));
nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false);
m_pwm_target_value[p_instance->p_timer->instance_id] =
nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel);
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
}
else
{
ticks = p_cb->period;
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
nrf_drv_ppi_task_addr_group_disable_get(p_ppigrp));
// Set secondary CC channel to non-zero value:
nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false);
m_pwm_target_value[p_instance->p_timer->instance_id] = 0;
// The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled.
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
}
nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]);
nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]);
p_ch_cb->pulsewidth = ticks;
m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL;
}
/**
* @brief PWM state transition from (0%, 100%) to (0%, 100%).
*
* @param[in] p_instance PWM instance.
* @param[in] channel PWM channel number.
* @param[in] ticks Number of clock ticks.
*/
static void pwm_transition_n_to_m(app_pwm_t const * const p_instance,
uint8_t channel, uint16_t ticks)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group;
pwm_ppi_disable(p_instance);
nrf_drv_ppi_group_clear(p_ppigrp);
nrf_drv_ppi_channels_include_in_group(
nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[0]) |
nrf_drv_ppi_channel_to_mask(p_cb->ppi_channels[1]),
p_ppigrp);
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL),
nrf_drv_timer_capture_task_address_get(p_instance->p_timer, channel));
#ifdef NRF52
if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) ==
(m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1U : 0U)
< p_ch_cb->pulsewidth)
#else
if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1U : 0U)
< p_ch_cb->pulsewidth)
#endif
{
// For lower value, we need one more transition. Timer task delay is included.
// If prescaler is disabled, one tick must be added because of 1 PCLK16M clock cycle delay.
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL),
nrf_drv_gpiote_out_task_addr_get(p_ch_cb->gpio_pin));
}
else
{
nrf_drv_ppi_channel_remove_from_group(p_cb->ppi_channels[1], p_ppigrp);
}
p_ch_cb->pulsewidth = ticks;
nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, ticks, false);
nrf_drv_ppi_group_enable(p_ppigrp);
m_pwm_target_value[p_instance->p_timer->instance_id] = ticks;
m_pwm_busy[p_instance->p_timer->instance_id] = channel;
}
/**
* @brief PWM state transition from 0% or 100% to (0%, 100%).
*
* @param[in] p_instance PWM instance.
* @param[in] channel PWM channel number.
* @param[in] ticks Number of clock ticks.
*/
static void pwm_transition_0or100_to_n(app_pwm_t const * const p_instance,
uint8_t channel, uint16_t ticks)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
nrf_ppi_channel_group_t p_ppigrp = p_cb->ppi_group;
nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel);
pwm_ppi_disable(p_instance);
pwm_channel_ppi_disable(p_instance, channel);
nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false);
nrf_drv_ppi_group_clear(p_ppigrp);
nrf_drv_ppi_channels_include_in_group(
nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[0])|
nrf_drv_ppi_channel_to_mask(p_ch_cb->ppi_channels[1]),
p_ppigrp);
if (!p_ch_cb->pulsewidth)
{
// Channel is at 0%.
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp));
nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 0, false);
m_pwm_target_value[p_instance->p_timer->instance_id] =
nrf_drv_timer_capture_get(p_instance->p_timer, (nrf_timer_cc_channel_t) channel);
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
}
else
{
// Channel is at 100%.
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
nrf_drv_ppi_task_addr_group_enable_get(p_ppigrp));
// Set secondary CC channel to non-zero value:
nrf_drv_timer_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_SECONDARY_CC_CHANNEL, 1, false);
m_pwm_target_value[p_instance->p_timer->instance_id] = 0;
// The captured value will be equal to 0, because timer clear on main PWM CC channel compare is enabled.
nrf_drv_ppi_channel_assign(p_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
nrf_drv_timer_capture_task_address_get(p_instance->p_timer, PWM_SECONDARY_CC_CHANNEL));
}
nrf_drv_ppi_channel_enable(p_cb->ppi_channels[0]);
nrf_drv_ppi_channel_enable(p_cb->ppi_channels[1]);
p_ch_cb->pulsewidth = ticks;
m_pwm_busy[p_instance->p_timer->instance_id] = PWM_SECONDARY_CC_CHANNEL;
}
/**
* @brief PWM state transition from 0% or 100% to 0% or 100%.
*
* @param[in] p_instance PWM instance.
* @param[in] channel PWM channel number.
* @param[in] ticks Number of clock ticks.
*/
static void pwm_transition_0or100_to_0or100(app_pwm_t const * const p_instance,
uint8_t channel, uint16_t ticks)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
nrf_timer_cc_channel_t pwm_ch_cc = (nrf_timer_cc_channel_t)(channel);
pwm_ppi_disable(p_instance);
pwm_channel_ppi_disable(p_instance, channel);
if (!ticks)
{
// Set to 0%.
nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel));
}
else if (ticks >= p_cb->period)
{
// Set to 100%.
ticks = p_cb->period;
nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_ACTIVE(p_instance, channel));
}
nrf_drv_timer_compare(p_instance->p_timer, pwm_ch_cc, ticks, false);
p_ch_cb->pulsewidth = ticks;
m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
return;
}
ret_code_t app_pwm_channel_duty_ticks_set(app_pwm_t const * const p_instance,
uint8_t channel,
uint16_t ticks)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE);
ASSERT(p_ch_cb->initialized == APP_PWM_CHANNEL_INITIALIZED);
if (p_cb->state != NRF_DRV_STATE_POWERED_ON)
{
return NRF_ERROR_INVALID_STATE;
}
if (ticks == p_ch_cb->pulsewidth)
{
if (p_cb->p_ready_callback)
{
p_cb->p_ready_callback(p_instance->p_timer->instance_id);
}
return NRF_SUCCESS; // No action required.
}
if (app_pwm_busy_check(p_instance))
{
return NRF_ERROR_BUSY; // PPI channels for synchronization are still in use.
}
m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_CHANGING;
// Pulse width change sequence:
if (!p_ch_cb->pulsewidth || p_ch_cb->pulsewidth >= p_cb->period)
{
// Channel is disabled (0%) or at 100%.
if (!ticks || ticks >= p_cb->period)
{
// Set to 0 or 100%.
pwm_transition_0or100_to_0or100(p_instance, channel, ticks);
}
else
{
// Other value.
pwm_transition_0or100_to_n(p_instance, channel, ticks);
}
}
else
{
// Channel is at other value.
if (!ticks || ticks >= p_cb->period)
{
// Disable channel (set to 0%) or set to 100%.
pwm_transition_n_to_0or100(p_instance, channel, ticks);
}
else
{
// Set to any other value.
pwm_transition_n_to_m(p_instance, channel, ticks);
}
}
if (p_instance->p_cb->p_ready_callback)
{
//PWM ready interrupt handler will be called after one full period.
m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 2;
pwm_irq_enable(p_instance);
}
return NRF_SUCCESS;
}
uint16_t app_pwm_channel_duty_ticks_get(app_pwm_t const * const p_instance, uint8_t channel)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
return p_ch_cb->pulsewidth;
}
uint16_t app_pwm_cycle_ticks_get(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
return (uint16_t)p_cb->period;
}
ret_code_t app_pwm_channel_duty_set(app_pwm_t const * const p_instance,
uint8_t channel, app_pwm_duty_t duty)
{
uint32_t ticks = ((uint32_t)app_pwm_cycle_ticks_get(p_instance) * (uint32_t)duty) / 100UL;
return app_pwm_channel_duty_ticks_set(p_instance, channel, ticks);
}
app_pwm_duty_t app_pwm_channel_duty_get(app_pwm_t const * const p_instance, uint8_t channel)
{
uint32_t value = ((uint32_t)app_pwm_channel_duty_ticks_get(p_instance, channel) * 100UL) \
/ (uint32_t)app_pwm_cycle_ticks_get(p_instance);
return (app_pwm_duty_t)value;
}
/**
* @brief Function for initializing the PWM channel.
*
* @param[in] p_instance PWM instance.
* @param[in] channel Channel number.
* @param[in] pin GPIO pin number.
*
* @retval NRF_SUCCESS If initialization was successful.
* @retval NRF_ERROR_NO_MEM If there were not enough free resources.
* @retval NRF_ERROR_INVALID_STATE If the timer is already in use or initialization failed.
*/
static ret_code_t app_pwm_channel_init(app_pwm_t const * const p_instance, uint8_t channel,
uint32_t pin, app_pwm_polarity_t polarity)
{
ASSERT(channel < APP_PWM_CHANNELS_PER_INSTANCE);
app_pwm_cb_t * p_cb = p_instance->p_cb;
app_pwm_channel_cb_t * p_channel_cb = &p_cb->channels_cb[channel];
if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
{
return NRF_ERROR_INVALID_STATE;
}
p_channel_cb->pulsewidth = 0;
p_channel_cb->polarity = polarity;
ret_code_t err_code;
/* GPIOTE setup: */
nrf_drv_gpiote_out_config_t out_cfg = GPIOTE_CONFIG_OUT_TASK_TOGGLE( POLARITY_INACTIVE(p_instance, channel) );
err_code = nrf_drv_gpiote_out_init((nrf_drv_gpiote_pin_t)pin,&out_cfg);
if (err_code != NRF_SUCCESS)
{
return NRF_ERROR_NO_MEM;
}
p_cb->channels_cb[channel].gpio_pin = pin;
// Set output to inactive state.
if (polarity)
{
nrf_gpio_pin_clear(pin);
}
else
{
nrf_gpio_pin_set(pin);
}
/* PPI setup: */
for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_CHANNEL; ++i)
{
if (nrf_drv_ppi_channel_alloc(&p_channel_cb->ppi_channels[i]) != NRF_SUCCESS)
{
return NRF_ERROR_NO_MEM; // Resource de-allocation is done by callee.
}
}
nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[0]);
nrf_drv_ppi_channel_disable(p_channel_cb->ppi_channels[1]);
nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[0],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, channel),
nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin));
nrf_drv_ppi_channel_assign(p_channel_cb->ppi_channels[1],
nrf_drv_timer_compare_event_address_get(p_instance->p_timer, PWM_MAIN_CC_CHANNEL),
nrf_drv_gpiote_out_task_addr_get(p_channel_cb->gpio_pin));
p_channel_cb->initialized = APP_PWM_CHANNEL_INITIALIZED;
m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0;
return NRF_SUCCESS;
}
/**
* @brief Function for calculating target timer frequency, which will allow to set given period length.
*
* @param[in] period_us Desired period in microseconds.
*
* @retval Timer frequency.
*/
__STATIC_INLINE nrf_timer_frequency_t pwm_calculate_timer_frequency(uint32_t period_us)
{
uint32_t f = (uint32_t) NRF_TIMER_FREQ_16MHz;
uint32_t min = (uint32_t) NRF_TIMER_FREQ_31250Hz;
while ((period_us > TIMER_MAX_PULSEWIDTH_US_ON_16M) && (f < min))
{
period_us >>= 1;
++f;
}
#ifdef NRF52
if ((m_use_ppi_delay_workaround) && (f == (uint32_t) NRF_TIMER_FREQ_16MHz))
{
f = (uint32_t) NRF_TIMER_FREQ_8MHz;
}
#endif
return (nrf_timer_frequency_t) f;
}
ret_code_t app_pwm_init(app_pwm_t const * const p_instance, app_pwm_config_t const * const p_config,
app_pwm_callback_t p_ready_callback)
{
ASSERT(p_instance);
if (!p_config)
{
return NRF_ERROR_INVALID_DATA;
}
app_pwm_cb_t * p_cb = p_instance->p_cb;
if (p_cb->state != NRF_DRV_STATE_UNINITIALIZED)
{
return NRF_ERROR_INVALID_STATE;
}
uint32_t err_code = nrf_drv_ppi_init();
if ((err_code != NRF_SUCCESS) && (err_code != MODULE_ALREADY_INITIALIZED))
{
return NRF_ERROR_NO_MEM;
}
if (!nrf_drv_gpiote_is_init())
{
err_code = nrf_drv_gpiote_init();
if (err_code != NRF_SUCCESS)
{
return NRF_ERROR_INTERNAL;
}
}
#ifdef NRF52
if (((*(uint32_t *)0xF0000FE8) & 0x000000F0) == 0x30)
{
m_use_ppi_delay_workaround = false;
}
else
{
m_use_ppi_delay_workaround = true;
}
#endif
// Innitialize resource status:
p_cb->ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED;
p_cb->ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED;
p_cb->ppi_group = (nrf_ppi_channel_group_t)UNALLOCATED;
for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i)
{
p_cb->channels_cb[i].initialized = APP_PWM_CHANNEL_UNINITIALIZED;
p_cb->channels_cb[i].ppi_channels[0] = (nrf_ppi_channel_t)UNALLOCATED;
p_cb->channels_cb[i].ppi_channels[1] = (nrf_ppi_channel_t)UNALLOCATED;
p_cb->channels_cb[i].gpio_pin = UNALLOCATED;
}
// Allocate PPI channels and groups:
for (uint8_t i = 0; i < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++i)
{
if (nrf_drv_ppi_channel_alloc(&p_cb->ppi_channels[i]) != NRF_SUCCESS)
{
pwm_dealloc(p_instance);
return NRF_ERROR_NO_MEM;
}
}
if (nrf_drv_ppi_group_alloc(&p_cb->ppi_group) != NRF_SUCCESS)
{
pwm_dealloc(p_instance);
return NRF_ERROR_NO_MEM;
}
// Initialize channels:
for (uint8_t i = 0; i < APP_PWM_CHANNELS_PER_INSTANCE; ++i)
{
if (p_config->pins[i] != APP_PWM_NOPIN)
{
err_code = app_pwm_channel_init(p_instance, i, p_config->pins[i], p_config->pin_polarity[i]);
if (err_code != NRF_SUCCESS)
{
pwm_dealloc(p_instance);
return err_code;
}
app_pwm_channel_duty_ticks_set(p_instance, i, 0);
}
}
// Initialize timer:
nrf_timer_frequency_t timer_freq = pwm_calculate_timer_frequency(p_config->period_us);
nrf_drv_timer_config_t timer_cfg = {
.frequency = timer_freq,
.mode = NRF_TIMER_MODE_TIMER,
.bit_width = NRF_TIMER_BIT_WIDTH_16,
#ifdef NRF51
.interrupt_priority = APP_IRQ_PRIORITY_LOW,
#elif defined(NRF52)
.interrupt_priority = APP_IRQ_PRIORITY_LOWEST,
#endif
.p_context = (void *) (uint32_t) p_instance->p_timer->instance_id
};
err_code = nrf_drv_timer_init(p_instance->p_timer, &timer_cfg,
pwm_ready_tick);
if (err_code != NRF_SUCCESS)
{
pwm_dealloc(p_instance);
return err_code;
}
uint32_t ticks = nrf_drv_timer_us_to_ticks(p_instance->p_timer, p_config->period_us);
p_cb->period = ticks;
nrf_drv_timer_clear(p_instance->p_timer);
nrf_drv_timer_extended_compare(p_instance->p_timer, (nrf_timer_cc_channel_t) PWM_MAIN_CC_CHANNEL,
ticks, NRF_TIMER_SHORT_COMPARE2_CLEAR_MASK, true);
nrf_drv_timer_compare_int_disable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
p_cb->p_ready_callback = p_ready_callback;
m_instances[p_instance->p_timer->instance_id] = p_instance;
m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
p_cb->state = NRF_DRV_STATE_INITIALIZED;
return NRF_SUCCESS;
}
void app_pwm_enable(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
for (uint32_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
{
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
m_pwm_ready_counter[p_instance->p_timer->instance_id][channel] = 0;
if (p_ch_cb->initialized)
{
nrf_drv_gpiote_out_task_force(p_ch_cb->gpio_pin, POLARITY_INACTIVE(p_instance, channel));
nrf_drv_gpiote_out_task_enable(p_ch_cb->gpio_pin);
p_ch_cb->pulsewidth = 0;
}
}
m_pwm_busy[p_instance->p_timer->instance_id] = BUSY_STATE_IDLE;
pan73_workaround(p_instance->p_timer->p_reg, true);
nrf_drv_timer_clear(p_instance->p_timer);
nrf_drv_timer_enable(p_instance->p_timer);
p_cb->state = NRF_DRV_STATE_POWERED_ON;
return;
}
void app_pwm_disable(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
ASSERT(p_cb->state != NRF_DRV_STATE_UNINITIALIZED);
nrf_drv_timer_disable(p_instance->p_timer);
pwm_irq_disable(p_instance);
for (uint8_t ppi_channel = 0; ppi_channel < APP_PWM_REQUIRED_PPI_CHANNELS_PER_INSTANCE; ++ppi_channel)
{
nrf_drv_ppi_channel_disable(p_cb->ppi_channels[ppi_channel]);
}
for (uint8_t channel = 0; channel < APP_PWM_CHANNELS_PER_INSTANCE; ++channel)
{
app_pwm_channel_cb_t * p_ch_cb = &p_cb->channels_cb[channel];
if (p_ch_cb->initialized)
{
uint8_t polarity = POLARITY_INACTIVE(p_instance, channel);
if (polarity)
{
nrf_gpio_pin_set(p_ch_cb->gpio_pin);
}
else
{
nrf_gpio_pin_clear(p_ch_cb->gpio_pin);
}
nrf_drv_gpiote_out_task_disable(p_ch_cb->gpio_pin);
nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[0]);
nrf_drv_ppi_channel_disable(p_ch_cb->ppi_channels[1]);
}
}
pan73_workaround(p_instance->p_timer->p_reg, false);
p_cb->state = NRF_DRV_STATE_INITIALIZED;
return;
}
ret_code_t app_pwm_uninit(app_pwm_t const * const p_instance)
{
app_pwm_cb_t * p_cb = p_instance->p_cb;
if (p_cb->state == NRF_DRV_STATE_POWERED_ON)
{
app_pwm_disable(p_instance);
}
else if (p_cb->state == NRF_DRV_STATE_UNINITIALIZED)
{
return NRF_ERROR_INVALID_STATE;
}
pwm_dealloc(p_instance);
p_cb->state = NRF_DRV_STATE_UNINITIALIZED;
return NRF_SUCCESS;
}
//lint -restore
| apache-2.0 |
tung7970/mbed-os | features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/peer_id.c | 77 | 3665 | /*
* Copyright (c) Nordic Semiconductor ASA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "peer_id.h"
#include <stdint.h>
#include <string.h>
#include "sdk_errors.h"
#include "peer_manager_types.h"
#include "pm_mutex.h"
typedef struct
{
uint8_t peer_ids[MUTEX_STORAGE_SIZE(PM_PEER_ID_N_AVAILABLE_IDS)]; /*< bitmap. */
} pi_t;
static pi_t m_pi = {.peer_ids = {0}};
static void internal_state_reset(pi_t * p_pi)
{
memset(p_pi, 0, sizeof(pi_t));
}
void peer_id_init(void)
{
internal_state_reset(&m_pi);
pm_mutex_init(m_pi.peer_ids, PM_PEER_ID_N_AVAILABLE_IDS);
}
pm_peer_id_t peer_id_allocate(pm_peer_id_t peer_id)
{
pm_peer_id_t allocated_peer_id = PM_PEER_ID_INVALID;
if (peer_id == PM_PEER_ID_INVALID)
{
allocated_peer_id = pm_mutex_lock_first_available(m_pi.peer_ids, PM_PEER_ID_N_AVAILABLE_IDS);
if (allocated_peer_id == PM_PEER_ID_N_AVAILABLE_IDS)
{
allocated_peer_id = PM_PEER_ID_INVALID;
}
}
else if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS)
{
bool lock_success = pm_mutex_lock(m_pi.peer_ids, peer_id);
allocated_peer_id = lock_success ? peer_id : PM_PEER_ID_INVALID;
}
return allocated_peer_id;
}
void peer_id_free(pm_peer_id_t peer_id)
{
if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS)
{
pm_mutex_unlock(m_pi.peer_ids, peer_id);
}
}
bool peer_id_is_allocated(pm_peer_id_t peer_id)
{
if (peer_id < PM_PEER_ID_N_AVAILABLE_IDS)
{
return pm_mutex_lock_status_get(m_pi.peer_ids, peer_id);
}
return false;
}
pm_peer_id_t peer_id_next_id_get(pm_peer_id_t prev_peer_id)
{
pm_peer_id_t i = (prev_peer_id == PM_PEER_ID_INVALID) ? 0 : (prev_peer_id + 1);
for (; i < PM_PEER_ID_N_AVAILABLE_IDS; i++)
{
if (pm_mutex_lock_status_get(m_pi.peer_ids, i))
{
return i;
}
}
return PM_PEER_ID_INVALID;
}
uint32_t peer_id_n_ids(void)
{
uint32_t n_ids = 0;
for (pm_peer_id_t i = 0; i < PM_PEER_ID_N_AVAILABLE_IDS; i++)
{
n_ids += pm_mutex_lock_status_get(m_pi.peer_ids, i);
}
return n_ids;
}
| apache-2.0 |
darlyhellen/oto | NDKFFmpeg/jni/ffmpeg/libavcodec/sipr16k.c | 83 | 9373 | /*
* SIPR decoder for the 16k mode
*
* Copyright (c) 2008 Vladimir Voroshilov
* Copyright (c) 2009 Vitor Sessak
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <math.h>
#include "sipr.h"
#include "libavutil/attributes.h"
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mathematics.h"
#include "lsp.h"
#include "acelp_vectors.h"
#include "acelp_pitch_delay.h"
#include "acelp_filters.h"
#include "celp_filters.h"
#include "sipr16kdata.h"
/**
* Convert an lsf vector into an lsp vector.
*
* @param lsf input lsf vector
* @param lsp output lsp vector
*/
static void lsf2lsp(const float *lsf, double *lsp)
{
int i;
for (i = 0; i < LP_FILTER_ORDER_16k; i++)
lsp[i] = cosf(lsf[i]);
}
static void dequant(float *out, const int *idx, const float * const cbs[])
{
int i;
for (i = 0; i < 4; i++)
memcpy(out + 3*i, cbs[i] + 3*idx[i], 3*sizeof(float));
memcpy(out + 12, cbs[4] + 4*idx[4], 4*sizeof(float));
}
static void lsf_decode_fp_16k(float* lsf_history, float* isp_new,
const int* parm, int ma_pred)
{
int i;
float isp_q[LP_FILTER_ORDER_16k];
dequant(isp_q, parm, lsf_codebooks_16k);
for (i = 0; i < LP_FILTER_ORDER_16k; i++) {
isp_new[i] = (1 - qu[ma_pred]) * isp_q[i]
+ qu[ma_pred] * lsf_history[i]
+ mean_lsf_16k[i];
}
memcpy(lsf_history, isp_q, LP_FILTER_ORDER_16k * sizeof(float));
}
static int dec_delay3_1st(int index)
{
if (index < 390) {
return index + 88;
} else
return 3 * index - 690;
}
static int dec_delay3_2nd(int index, int pit_min, int pit_max,
int pitch_lag_prev)
{
if (index < 62) {
int pitch_delay_min = av_clip(pitch_lag_prev - 10,
pit_min, pit_max - 19);
return 3 * pitch_delay_min + index - 2;
} else
return 3 * pitch_lag_prev;
}
static void postfilter(float *out_data, float* synth, float* iir_mem,
float* filt_mem[2], float* mem_preemph)
{
float buf[30 + LP_FILTER_ORDER_16k];
float *tmpbuf = buf + LP_FILTER_ORDER_16k;
float s;
int i;
for (i = 0; i < LP_FILTER_ORDER_16k; i++)
filt_mem[0][i] = iir_mem[i] * ff_pow_0_5[i];
memcpy(tmpbuf - LP_FILTER_ORDER_16k, mem_preemph,
LP_FILTER_ORDER_16k*sizeof(*buf));
ff_celp_lp_synthesis_filterf(tmpbuf, filt_mem[1], synth, 30,
LP_FILTER_ORDER_16k);
memcpy(synth - LP_FILTER_ORDER_16k, mem_preemph,
LP_FILTER_ORDER_16k * sizeof(*synth));
ff_celp_lp_synthesis_filterf(synth, filt_mem[0], synth, 30,
LP_FILTER_ORDER_16k);
memcpy(out_data + 30 - LP_FILTER_ORDER_16k,
synth + 30 - LP_FILTER_ORDER_16k,
LP_FILTER_ORDER_16k * sizeof(*synth));
ff_celp_lp_synthesis_filterf(out_data + 30, filt_mem[0],
synth + 30, 2 * L_SUBFR_16k - 30,
LP_FILTER_ORDER_16k);
memcpy(mem_preemph, out_data + 2*L_SUBFR_16k - LP_FILTER_ORDER_16k,
LP_FILTER_ORDER_16k * sizeof(*synth));
FFSWAP(float *, filt_mem[0], filt_mem[1]);
for (i = 0, s = 0; i < 30; i++, s += 1.0/30)
out_data[i] = tmpbuf[i] + s * (synth[i] - tmpbuf[i]);
}
/**
* Floating point version of ff_acelp_lp_decode().
*/
static void acelp_lp_decodef(float *lp_1st, float *lp_2nd,
const double *lsp_2nd, const double *lsp_prev)
{
double lsp_1st[LP_FILTER_ORDER_16k];
int i;
/* LSP values for first subframe (3.2.5 of G.729, Equation 24) */
for (i = 0; i < LP_FILTER_ORDER_16k; i++)
lsp_1st[i] = (lsp_2nd[i] + lsp_prev[i]) * 0.5;
ff_acelp_lspd2lpc(lsp_1st, lp_1st, LP_FILTER_ORDER_16k >> 1);
/* LSP values for second subframe (3.2.5 of G.729) */
ff_acelp_lspd2lpc(lsp_2nd, lp_2nd, LP_FILTER_ORDER_16k >> 1);
}
/**
* Floating point version of ff_acelp_decode_gain_code().
*/
static float acelp_decode_gain_codef(float gain_corr_factor, const float *fc_v,
float mr_energy, const float *quant_energy,
const float *ma_prediction_coeff,
int subframe_size, int ma_pred_order)
{
mr_energy += avpriv_scalarproduct_float_c(quant_energy, ma_prediction_coeff,
ma_pred_order);
mr_energy = gain_corr_factor * exp(M_LN10 / 20. * mr_energy) /
sqrt((0.01 + avpriv_scalarproduct_float_c(fc_v, fc_v, subframe_size)));
return mr_energy;
}
#define DIVIDE_BY_3(x) ((x) * 10923 >> 15)
void ff_sipr_decode_frame_16k(SiprContext *ctx, SiprParameters *params,
float *out_data)
{
int frame_size = SUBFRAME_COUNT_16k * L_SUBFR_16k;
float *synth = ctx->synth_buf + LP_FILTER_ORDER_16k;
float lsf_new[LP_FILTER_ORDER_16k];
double lsp_new[LP_FILTER_ORDER_16k];
float Az[2][LP_FILTER_ORDER_16k];
float fixed_vector[L_SUBFR_16k];
float pitch_fac, gain_code;
int i;
int pitch_delay_3x;
float *excitation = ctx->excitation + 292;
lsf_decode_fp_16k(ctx->lsf_history, lsf_new, params->vq_indexes,
params->ma_pred_switch);
ff_set_min_dist_lsf(lsf_new, LSFQ_DIFF_MIN / 2, LP_FILTER_ORDER_16k);
lsf2lsp(lsf_new, lsp_new);
acelp_lp_decodef(Az[0], Az[1], lsp_new, ctx->lsp_history_16k);
memcpy(ctx->lsp_history_16k, lsp_new, LP_FILTER_ORDER_16k * sizeof(double));
memcpy(synth - LP_FILTER_ORDER_16k, ctx->synth,
LP_FILTER_ORDER_16k * sizeof(*synth));
for (i = 0; i < SUBFRAME_COUNT_16k; i++) {
int i_subfr = i * L_SUBFR_16k;
AMRFixed f;
float gain_corr_factor;
int pitch_delay_int;
int pitch_delay_frac;
if (!i) {
pitch_delay_3x = dec_delay3_1st(params->pitch_delay[i]);
} else
pitch_delay_3x = dec_delay3_2nd(params->pitch_delay[i],
PITCH_MIN, PITCH_MAX,
ctx->pitch_lag_prev);
pitch_fac = gain_pitch_cb_16k[params->gp_index[i]];
f.pitch_fac = FFMIN(pitch_fac, 1.0);
f.pitch_lag = DIVIDE_BY_3(pitch_delay_3x+1);
ctx->pitch_lag_prev = f.pitch_lag;
pitch_delay_int = DIVIDE_BY_3(pitch_delay_3x + 2);
pitch_delay_frac = pitch_delay_3x + 2 - 3*pitch_delay_int;
ff_acelp_interpolatef(&excitation[i_subfr],
&excitation[i_subfr] - pitch_delay_int + 1,
sinc_win, 3, pitch_delay_frac + 1,
LP_FILTER_ORDER, L_SUBFR_16k);
memset(fixed_vector, 0, sizeof(fixed_vector));
ff_decode_10_pulses_35bits(params->fc_indexes[i], &f,
ff_fc_4pulses_8bits_tracks_13, 5, 4);
ff_set_fixed_vector(fixed_vector, &f, 1.0, L_SUBFR_16k);
gain_corr_factor = gain_cb_16k[params->gc_index[i]];
gain_code = gain_corr_factor *
acelp_decode_gain_codef(sqrt(L_SUBFR_16k), fixed_vector,
19.0 - 15.0/(0.05*M_LN10/M_LN2),
pred_16k, ctx->energy_history,
L_SUBFR_16k, 2);
ctx->energy_history[1] = ctx->energy_history[0];
ctx->energy_history[0] = 20.0 * log10f(gain_corr_factor);
ff_weighted_vector_sumf(&excitation[i_subfr], &excitation[i_subfr],
fixed_vector, pitch_fac,
gain_code, L_SUBFR_16k);
ff_celp_lp_synthesis_filterf(synth + i_subfr, Az[i],
&excitation[i_subfr], L_SUBFR_16k,
LP_FILTER_ORDER_16k);
}
memcpy(ctx->synth, synth + frame_size - LP_FILTER_ORDER_16k,
LP_FILTER_ORDER_16k * sizeof(*synth));
memmove(ctx->excitation, ctx->excitation + 2 * L_SUBFR_16k,
(L_INTERPOL+PITCH_MAX) * sizeof(float));
postfilter(out_data, synth, ctx->iir_mem, ctx->filt_mem, ctx->mem_preemph);
memcpy(ctx->iir_mem, Az[1], LP_FILTER_ORDER_16k * sizeof(float));
}
av_cold void ff_sipr_init_16k(SiprContext *ctx)
{
int i;
for (i = 0; i < LP_FILTER_ORDER_16k; i++)
ctx->lsp_history_16k[i] = cos((i + 1) * M_PI/(LP_FILTER_ORDER_16k + 1));
ctx->filt_mem[0] = ctx->filt_buf[0];
ctx->filt_mem[1] = ctx->filt_buf[1];
ctx->pitch_lag_prev = 180;
}
| apache-2.0 |
flyfei/python-for-android | python3-alpha/openssl/crypto/evp/bio_ok.c | 599 | 15847 | /* crypto/evp/bio_ok.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
/*
From: Arne Ansper <arne@cyber.ee>
Why BIO_f_reliable?
I wrote function which took BIO* as argument, read data from it
and processed it. Then I wanted to store the input file in
encrypted form. OK I pushed BIO_f_cipher to the BIO stack
and everything was OK. BUT if user types wrong password
BIO_f_cipher outputs only garbage and my function crashes. Yes
I can and I should fix my function, but BIO_f_cipher is
easy way to add encryption support to many existing applications
and it's hard to debug and fix them all.
So I wanted another BIO which would catch the incorrect passwords and
file damages which cause garbage on BIO_f_cipher's output.
The easy way is to push the BIO_f_md and save the checksum at
the end of the file. However there are several problems with this
approach:
1) you must somehow separate checksum from actual data.
2) you need lot's of memory when reading the file, because you
must read to the end of the file and verify the checksum before
letting the application to read the data.
BIO_f_reliable tries to solve both problems, so that you can
read and write arbitrary long streams using only fixed amount
of memory.
BIO_f_reliable splits data stream into blocks. Each block is prefixed
with it's length and suffixed with it's digest. So you need only
several Kbytes of memory to buffer single block before verifying
it's digest.
BIO_f_reliable goes further and adds several important capabilities:
1) the digest of the block is computed over the whole stream
-- so nobody can rearrange the blocks or remove or replace them.
2) to detect invalid passwords right at the start BIO_f_reliable
adds special prefix to the stream. In order to avoid known plain-text
attacks this prefix is generated as follows:
*) digest is initialized with random seed instead of
standardized one.
*) same seed is written to output
*) well-known text is then hashed and the output
of the digest is also written to output.
reader can now read the seed from stream, hash the same string
and then compare the digest output.
Bad things: BIO_f_reliable knows what's going on in EVP_Digest. I
initially wrote and tested this code on x86 machine and wrote the
digests out in machine-dependent order :( There are people using
this code and I cannot change this easily without making existing
data files unreadable.
*/
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include "cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
static int ok_write(BIO *h, const char *buf, int num);
static int ok_read(BIO *h, char *buf, int size);
static long ok_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int ok_new(BIO *h);
static int ok_free(BIO *data);
static long ok_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
static int sig_out(BIO* b);
static int sig_in(BIO* b);
static int block_out(BIO* b);
static int block_in(BIO* b);
#define OK_BLOCK_SIZE (1024*4)
#define OK_BLOCK_BLOCK 4
#define IOBS (OK_BLOCK_SIZE+ OK_BLOCK_BLOCK+ 3*EVP_MAX_MD_SIZE)
#define WELLKNOWN "The quick brown fox jumped over the lazy dog's back."
typedef struct ok_struct
{
size_t buf_len;
size_t buf_off;
size_t buf_len_save;
size_t buf_off_save;
int cont; /* <= 0 when finished */
int finished;
EVP_MD_CTX md;
int blockout; /* output block is ready */
int sigio; /* must process signature */
unsigned char buf[IOBS];
} BIO_OK_CTX;
static BIO_METHOD methods_ok=
{
BIO_TYPE_CIPHER,"reliable",
ok_write,
ok_read,
NULL, /* ok_puts, */
NULL, /* ok_gets, */
ok_ctrl,
ok_new,
ok_free,
ok_callback_ctrl,
};
BIO_METHOD *BIO_f_reliable(void)
{
return(&methods_ok);
}
static int ok_new(BIO *bi)
{
BIO_OK_CTX *ctx;
ctx=(BIO_OK_CTX *)OPENSSL_malloc(sizeof(BIO_OK_CTX));
if (ctx == NULL) return(0);
ctx->buf_len=0;
ctx->buf_off=0;
ctx->buf_len_save=0;
ctx->buf_off_save=0;
ctx->cont=1;
ctx->finished=0;
ctx->blockout= 0;
ctx->sigio=1;
EVP_MD_CTX_init(&ctx->md);
bi->init=0;
bi->ptr=(char *)ctx;
bi->flags=0;
return(1);
}
static int ok_free(BIO *a)
{
if (a == NULL) return(0);
EVP_MD_CTX_cleanup(&((BIO_OK_CTX *)a->ptr)->md);
OPENSSL_cleanse(a->ptr,sizeof(BIO_OK_CTX));
OPENSSL_free(a->ptr);
a->ptr=NULL;
a->init=0;
a->flags=0;
return(1);
}
static int ok_read(BIO *b, char *out, int outl)
{
int ret=0,i,n;
BIO_OK_CTX *ctx;
if (out == NULL) return(0);
ctx=(BIO_OK_CTX *)b->ptr;
if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
while(outl > 0)
{
/* copy clean bytes to output buffer */
if (ctx->blockout)
{
i=ctx->buf_len-ctx->buf_off;
if (i > outl) i=outl;
memcpy(out,&(ctx->buf[ctx->buf_off]),i);
ret+=i;
out+=i;
outl-=i;
ctx->buf_off+=i;
/* all clean bytes are out */
if (ctx->buf_len == ctx->buf_off)
{
ctx->buf_off=0;
/* copy start of the next block into proper place */
if(ctx->buf_len_save- ctx->buf_off_save > 0)
{
ctx->buf_len= ctx->buf_len_save- ctx->buf_off_save;
memmove(ctx->buf, &(ctx->buf[ctx->buf_off_save]),
ctx->buf_len);
}
else
{
ctx->buf_len=0;
}
ctx->blockout= 0;
}
}
/* output buffer full -- cancel */
if (outl == 0) break;
/* no clean bytes in buffer -- fill it */
n=IOBS- ctx->buf_len;
i=BIO_read(b->next_bio,&(ctx->buf[ctx->buf_len]),n);
if (i <= 0) break; /* nothing new */
ctx->buf_len+= i;
/* no signature yet -- check if we got one */
if (ctx->sigio == 1)
{
if (!sig_in(b))
{
BIO_clear_retry_flags(b);
return 0;
}
}
/* signature ok -- check if we got block */
if (ctx->sigio == 0)
{
if (!block_in(b))
{
BIO_clear_retry_flags(b);
return 0;
}
}
/* invalid block -- cancel */
if (ctx->cont <= 0) break;
}
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return(ret);
}
static int ok_write(BIO *b, const char *in, int inl)
{
int ret=0,n,i;
BIO_OK_CTX *ctx;
if (inl <= 0) return inl;
ctx=(BIO_OK_CTX *)b->ptr;
ret=inl;
if ((ctx == NULL) || (b->next_bio == NULL) || (b->init == 0)) return(0);
if(ctx->sigio && !sig_out(b))
return 0;
do{
BIO_clear_retry_flags(b);
n=ctx->buf_len-ctx->buf_off;
while (ctx->blockout && n > 0)
{
i=BIO_write(b->next_bio,&(ctx->buf[ctx->buf_off]),n);
if (i <= 0)
{
BIO_copy_next_retry(b);
if(!BIO_should_retry(b))
ctx->cont= 0;
return(i);
}
ctx->buf_off+=i;
n-=i;
}
/* at this point all pending data has been written */
ctx->blockout= 0;
if (ctx->buf_len == ctx->buf_off)
{
ctx->buf_len=OK_BLOCK_BLOCK;
ctx->buf_off=0;
}
if ((in == NULL) || (inl <= 0)) return(0);
n= (inl+ ctx->buf_len > OK_BLOCK_SIZE+ OK_BLOCK_BLOCK) ?
(int)(OK_BLOCK_SIZE+OK_BLOCK_BLOCK-ctx->buf_len) : inl;
memcpy((unsigned char *)(&(ctx->buf[ctx->buf_len])),(unsigned char *)in,n);
ctx->buf_len+= n;
inl-=n;
in+=n;
if(ctx->buf_len >= OK_BLOCK_SIZE+ OK_BLOCK_BLOCK)
{
if (!block_out(b))
{
BIO_clear_retry_flags(b);
return 0;
}
}
}while(inl > 0);
BIO_clear_retry_flags(b);
BIO_copy_next_retry(b);
return(ret);
}
static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
{
BIO_OK_CTX *ctx;
EVP_MD *md;
const EVP_MD **ppmd;
long ret=1;
int i;
ctx=b->ptr;
switch (cmd)
{
case BIO_CTRL_RESET:
ctx->buf_len=0;
ctx->buf_off=0;
ctx->buf_len_save=0;
ctx->buf_off_save=0;
ctx->cont=1;
ctx->finished=0;
ctx->blockout= 0;
ctx->sigio=1;
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
case BIO_CTRL_EOF: /* More to read */
if (ctx->cont <= 0)
ret=1;
else
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
case BIO_CTRL_PENDING: /* More to read in buffer */
case BIO_CTRL_WPENDING: /* More to read in buffer */
ret=ctx->blockout ? ctx->buf_len-ctx->buf_off : 0;
if (ret <= 0)
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
case BIO_CTRL_FLUSH:
/* do a final write */
if(ctx->blockout == 0)
if (!block_out(b))
return 0;
while (ctx->blockout)
{
i=ok_write(b,NULL,0);
if (i < 0)
{
ret=i;
break;
}
}
ctx->finished=1;
ctx->buf_off=ctx->buf_len=0;
ctx->cont=(int)ret;
/* Finally flush the underlying BIO */
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
case BIO_C_DO_STATE_MACHINE:
BIO_clear_retry_flags(b);
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
BIO_copy_next_retry(b);
break;
case BIO_CTRL_INFO:
ret=(long)ctx->cont;
break;
case BIO_C_SET_MD:
md=ptr;
if (!EVP_DigestInit_ex(&ctx->md, md, NULL))
return 0;
b->init=1;
break;
case BIO_C_GET_MD:
if (b->init)
{
ppmd=ptr;
*ppmd=ctx->md.digest;
}
else
ret=0;
break;
default:
ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
break;
}
return(ret);
}
static long ok_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
{
long ret=1;
if (b->next_bio == NULL) return(0);
switch (cmd)
{
default:
ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
break;
}
return(ret);
}
static void longswap(void *_ptr, size_t len)
{ const union { long one; char little; } is_endian = {1};
if (is_endian.little) {
size_t i;
unsigned char *p=_ptr,c;
for(i= 0;i < len;i+= 4) {
c=p[0],p[0]=p[3],p[3]=c;
c=p[1],p[1]=p[2],p[2]=c;
}
}
}
static int sig_out(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
ctx=b->ptr;
md=&ctx->md;
if(ctx->buf_len+ 2* md->digest->md_size > OK_BLOCK_SIZE) return 1;
if (!EVP_DigestInit_ex(md, md->digest, NULL))
goto berr;
/* FIXME: there's absolutely no guarantee this makes any sense at all,
* particularly now EVP_MD_CTX has been restructured.
*/
RAND_pseudo_bytes(md->md_data, md->digest->md_size);
memcpy(&(ctx->buf[ctx->buf_len]), md->md_data, md->digest->md_size);
longswap(&(ctx->buf[ctx->buf_len]), md->digest->md_size);
ctx->buf_len+= md->digest->md_size;
if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
goto berr;
if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
goto berr;
ctx->buf_len+= md->digest->md_size;
ctx->blockout= 1;
ctx->sigio= 0;
return 1;
berr:
BIO_clear_retry_flags(b);
return 0;
}
static int sig_in(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
unsigned char tmp[EVP_MAX_MD_SIZE];
int ret= 0;
ctx=b->ptr;
md=&ctx->md;
if((int)(ctx->buf_len-ctx->buf_off) < 2*md->digest->md_size) return 1;
if (!EVP_DigestInit_ex(md, md->digest, NULL))
goto berr;
memcpy(md->md_data, &(ctx->buf[ctx->buf_off]), md->digest->md_size);
longswap(md->md_data, md->digest->md_size);
ctx->buf_off+= md->digest->md_size;
if (!EVP_DigestUpdate(md, WELLKNOWN, strlen(WELLKNOWN)))
goto berr;
if (!EVP_DigestFinal_ex(md, tmp, NULL))
goto berr;
ret= memcmp(&(ctx->buf[ctx->buf_off]), tmp, md->digest->md_size) == 0;
ctx->buf_off+= md->digest->md_size;
if(ret == 1)
{
ctx->sigio= 0;
if(ctx->buf_len != ctx->buf_off)
{
memmove(ctx->buf, &(ctx->buf[ctx->buf_off]), ctx->buf_len- ctx->buf_off);
}
ctx->buf_len-= ctx->buf_off;
ctx->buf_off= 0;
}
else
{
ctx->cont= 0;
}
return 1;
berr:
BIO_clear_retry_flags(b);
return 0;
}
static int block_out(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
unsigned long tl;
ctx=b->ptr;
md=&ctx->md;
tl= ctx->buf_len- OK_BLOCK_BLOCK;
ctx->buf[0]=(unsigned char)(tl>>24);
ctx->buf[1]=(unsigned char)(tl>>16);
ctx->buf[2]=(unsigned char)(tl>>8);
ctx->buf[3]=(unsigned char)(tl);
if (!EVP_DigestUpdate(md,
(unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
goto berr;
if (!EVP_DigestFinal_ex(md, &(ctx->buf[ctx->buf_len]), NULL))
goto berr;
ctx->buf_len+= md->digest->md_size;
ctx->blockout= 1;
return 1;
berr:
BIO_clear_retry_flags(b);
return 0;
}
static int block_in(BIO* b)
{
BIO_OK_CTX *ctx;
EVP_MD_CTX *md;
unsigned long tl= 0;
unsigned char tmp[EVP_MAX_MD_SIZE];
ctx=b->ptr;
md=&ctx->md;
assert(sizeof(tl)>=OK_BLOCK_BLOCK); /* always true */
tl =ctx->buf[0]; tl<<=8;
tl|=ctx->buf[1]; tl<<=8;
tl|=ctx->buf[2]; tl<<=8;
tl|=ctx->buf[3];
if (ctx->buf_len < tl+ OK_BLOCK_BLOCK+ md->digest->md_size) return 1;
if (!EVP_DigestUpdate(md,
(unsigned char*) &(ctx->buf[OK_BLOCK_BLOCK]), tl))
goto berr;
if (!EVP_DigestFinal_ex(md, tmp, NULL))
goto berr;
if(memcmp(&(ctx->buf[tl+ OK_BLOCK_BLOCK]), tmp, md->digest->md_size) == 0)
{
/* there might be parts from next block lurking around ! */
ctx->buf_off_save= tl+ OK_BLOCK_BLOCK+ md->digest->md_size;
ctx->buf_len_save= ctx->buf_len;
ctx->buf_off= OK_BLOCK_BLOCK;
ctx->buf_len= tl+ OK_BLOCK_BLOCK;
ctx->blockout= 1;
}
else
{
ctx->cont= 0;
}
return 1;
berr:
BIO_clear_retry_flags(b);
return 0;
}
| apache-2.0 |
indashnet/InDashNet.Open.UN2000 | android/external/dnsmasq/src/helper.c | 96 | 11918 | /* dnsmasq is Copyright (c) 2000-2009 Simon Kelley
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; version 2 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007.
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, see <http://www.gnu.org/licenses/>.
*/
#include "dnsmasq.h"
/* This file has code to fork a helper process which recieves data via a pipe
shared with the main process and which is responsible for calling a script when
DHCP leases change.
The helper process is forked before the main process drops root, so it retains root
privs to pass on to the script. For this reason it tries to be paranoid about
data received from the main process, in case that has been compromised. We don't
want the helper to give an attacker root. In particular, the script to be run is
not settable via the pipe, once the fork has taken place it is not alterable by the
main process.
*/
#if defined(HAVE_DHCP) && defined(HAVE_SCRIPT)
static void my_setenv(const char *name, const char *value, int *error);
struct script_data
{
unsigned char action, hwaddr_len, hwaddr_type;
unsigned char clid_len, hostname_len, uclass_len, vclass_len, shost_len;
struct in_addr addr, giaddr;
unsigned int remaining_time;
#ifdef HAVE_BROKEN_RTC
unsigned int length;
#else
time_t expires;
#endif
unsigned char hwaddr[DHCP_CHADDR_MAX];
char interface[IF_NAMESIZE];
};
static struct script_data *buf = NULL;
static size_t bytes_in_buf = 0, buf_size = 0;
int create_helper(int event_fd, int err_fd, uid_t uid, gid_t gid, long max_fd)
{
pid_t pid;
int i, pipefd[2];
struct sigaction sigact;
/* create the pipe through which the main program sends us commands,
then fork our process. */
if (pipe(pipefd) == -1 || !fix_fd(pipefd[1]) || (pid = fork()) == -1)
{
send_event(err_fd, EVENT_PIPE_ERR, errno);
_exit(0);
}
if (pid != 0)
{
close(pipefd[0]); /* close reader side */
return pipefd[1];
}
/* ignore SIGTERM, so that we can clean up when the main process gets hit
and SIGALRM so that we can use sleep() */
sigact.sa_handler = SIG_IGN;
sigact.sa_flags = 0;
sigemptyset(&sigact.sa_mask);
sigaction(SIGTERM, &sigact, NULL);
sigaction(SIGALRM, &sigact, NULL);
if (!(daemon->options & OPT_DEBUG) && uid != 0)
{
gid_t dummy;
if (setgroups(0, &dummy) == -1 ||
setgid(gid) == -1 ||
setuid(uid) == -1)
{
if (daemon->options & OPT_NO_FORK)
/* send error to daemon process if no-fork */
send_event(event_fd, EVENT_HUSER_ERR, errno);
else
{
/* kill daemon */
send_event(event_fd, EVENT_DIE, 0);
/* return error */
send_event(err_fd, EVENT_HUSER_ERR, errno);
}
_exit(0);
}
}
/* close all the sockets etc, we don't need them here. This closes err_fd, so that
main process can return. */
for (max_fd--; max_fd >= 0; max_fd--)
if (max_fd != STDOUT_FILENO && max_fd != STDERR_FILENO &&
max_fd != STDIN_FILENO && max_fd != pipefd[0] && max_fd != event_fd)
close(max_fd);
/* loop here */
while(1)
{
struct script_data data;
char *p, *action_str, *hostname = NULL;
unsigned char *buf = (unsigned char *)daemon->namebuff;
int err = 0;
/* we read zero bytes when pipe closed: this is our signal to exit */
if (!read_write(pipefd[0], (unsigned char *)&data, sizeof(data), 1))
_exit(0);
if (data.action == ACTION_DEL)
action_str = "del";
else if (data.action == ACTION_ADD)
action_str = "add";
else if (data.action == ACTION_OLD || data.action == ACTION_OLD_HOSTNAME)
action_str = "old";
else
continue;
/* stringify MAC into dhcp_buff */
p = daemon->dhcp_buff;
if (data.hwaddr_type != ARPHRD_ETHER || data.hwaddr_len == 0)
p += sprintf(p, "%.2x-", data.hwaddr_type);
for (i = 0; (i < data.hwaddr_len) && (i < DHCP_CHADDR_MAX); i++)
{
p += sprintf(p, "%.2x", data.hwaddr[i]);
if (i != data.hwaddr_len - 1)
p += sprintf(p, ":");
}
/* and CLID into packet */
if (!read_write(pipefd[0], buf, data.clid_len, 1))
continue;
for (p = daemon->packet, i = 0; i < data.clid_len; i++)
{
p += sprintf(p, "%.2x", buf[i]);
if (i != data.clid_len - 1)
p += sprintf(p, ":");
}
/* and expiry or length into dhcp_buff2 */
#ifdef HAVE_BROKEN_RTC
sprintf(daemon->dhcp_buff2, "%u ", data.length);
#else
sprintf(daemon->dhcp_buff2, "%lu ", (unsigned long)data.expires);
#endif
if (!read_write(pipefd[0], buf,
data.hostname_len + data.uclass_len + data.vclass_len + data.shost_len, 1))
continue;
/* possible fork errors are all temporary resource problems */
while ((pid = fork()) == -1 && (errno == EAGAIN || errno == ENOMEM))
sleep(2);
if (pid == -1)
continue;
/* wait for child to complete */
if (pid != 0)
{
/* reap our children's children, if necessary */
while (1)
{
int status;
pid_t rc = wait(&status);
if (rc == pid)
{
/* On error send event back to main process for logging */
if (WIFSIGNALED(status))
send_event(event_fd, EVENT_KILLED, WTERMSIG(status));
else if (WIFEXITED(status) && WEXITSTATUS(status) != 0)
send_event(event_fd, EVENT_EXITED, WEXITSTATUS(status));
break;
}
if (rc == -1 && errno != EINTR)
break;
}
continue;
}
if (data.clid_len != 0)
my_setenv("DNSMASQ_CLIENT_ID", daemon->packet, &err);
if (strlen(data.interface) != 0)
my_setenv("DNSMASQ_INTERFACE", data.interface, &err);
#ifdef HAVE_BROKEN_RTC
my_setenv("DNSMASQ_LEASE_LENGTH", daemon->dhcp_buff2, &err);
#else
my_setenv("DNSMASQ_LEASE_EXPIRES", daemon->dhcp_buff2, &err);
#endif
if (data.vclass_len != 0)
{
buf[data.vclass_len - 1] = 0; /* don't trust zero-term */
/* cannot have = chars in env - truncate if found . */
if ((p = strchr((char *)buf, '=')))
*p = 0;
my_setenv("DNSMASQ_VENDOR_CLASS", (char *)buf, &err);
buf += data.vclass_len;
}
if (data.uclass_len != 0)
{
unsigned char *end = buf + data.uclass_len;
buf[data.uclass_len - 1] = 0; /* don't trust zero-term */
for (i = 0; buf < end;)
{
size_t len = strlen((char *)buf) + 1;
if ((p = strchr((char *)buf, '=')))
*p = 0;
if (strlen((char *)buf) != 0)
{
sprintf(daemon->dhcp_buff2, "DNSMASQ_USER_CLASS%i", i++);
my_setenv(daemon->dhcp_buff2, (char *)buf, &err);
}
buf += len;
}
}
if (data.shost_len != 0)
{
buf[data.shost_len - 1] = 0; /* don't trust zero-term */
/* cannot have = chars in env - truncate if found . */
if ((p = strchr((char *)buf, '=')))
*p = 0;
my_setenv("DNSMASQ_SUPPLIED_HOSTNAME", (char *)buf, &err);
buf += data.shost_len;
}
if (data.giaddr.s_addr != 0)
my_setenv("DNSMASQ_RELAY_ADDRESS", inet_ntoa(data.giaddr), &err);
sprintf(daemon->dhcp_buff2, "%u ", data.remaining_time);
my_setenv("DNSMASQ_TIME_REMAINING", daemon->dhcp_buff2, &err);
if (data.hostname_len != 0)
{
char *dot;
hostname = (char *)buf;
hostname[data.hostname_len - 1] = 0;
if (!legal_hostname(hostname))
hostname = NULL;
else if ((dot = strchr(hostname, '.')))
{
my_setenv("DNSMASQ_DOMAIN", dot+1, &err);
*dot = 0;
}
}
if (data.action == ACTION_OLD_HOSTNAME && hostname)
{
my_setenv("DNSMASQ_OLD_HOSTNAME", hostname, &err);
hostname = NULL;
}
/* we need to have the event_fd around if exec fails */
if ((i = fcntl(event_fd, F_GETFD)) != -1)
fcntl(event_fd, F_SETFD, i | FD_CLOEXEC);
close(pipefd[0]);
p = strrchr(daemon->lease_change_command, '/');
if (err == 0)
{
execl(daemon->lease_change_command,
p ? p+1 : daemon->lease_change_command,
action_str, daemon->dhcp_buff, inet_ntoa(data.addr), hostname, (char*)NULL);
err = errno;
}
/* failed, send event so the main process logs the problem */
send_event(event_fd, EVENT_EXEC_ERR, err);
_exit(0);
}
}
static void my_setenv(const char *name, const char *value, int *error)
{
if (*error == 0 && setenv(name, value, 1) != 0)
*error = errno;
}
/* pack up lease data into a buffer */
void queue_script(int action, struct dhcp_lease *lease, char *hostname, time_t now)
{
unsigned char *p;
size_t size;
unsigned int hostname_len = 0, clid_len = 0, vclass_len = 0;
unsigned int uclass_len = 0, shost_len = 0;
/* no script */
if (daemon->helperfd == -1)
return;
if (lease->vendorclass)
vclass_len = lease->vendorclass_len;
if (lease->userclass)
uclass_len = lease->userclass_len;
if (lease->supplied_hostname)
shost_len = lease->supplied_hostname_len;
if (lease->clid)
clid_len = lease->clid_len;
if (hostname)
hostname_len = strlen(hostname) + 1;
size = sizeof(struct script_data) + clid_len + vclass_len + uclass_len + shost_len + hostname_len;
if (size > buf_size)
{
struct script_data *new;
/* start with reasonable size, will almost never need extending. */
if (size < sizeof(struct script_data) + 200)
size = sizeof(struct script_data) + 200;
if (!(new = whine_malloc(size)))
return;
if (buf)
free(buf);
buf = new;
buf_size = size;
}
buf->action = action;
buf->hwaddr_len = lease->hwaddr_len;
buf->hwaddr_type = lease->hwaddr_type;
buf->clid_len = clid_len;
buf->vclass_len = vclass_len;
buf->uclass_len = uclass_len;
buf->shost_len = shost_len;
buf->hostname_len = hostname_len;
buf->addr = lease->addr;
buf->giaddr = lease->giaddr;
memcpy(buf->hwaddr, lease->hwaddr, lease->hwaddr_len);
buf->interface[0] = 0;
#ifdef HAVE_LINUX_NETWORK
if (lease->last_interface != 0)
{
struct ifreq ifr;
ifr.ifr_ifindex = lease->last_interface;
if (ioctl(daemon->dhcpfd, SIOCGIFNAME, &ifr) != -1)
strncpy(buf->interface, ifr.ifr_name, IF_NAMESIZE);
}
#else
if (lease->last_interface != 0)
if_indextoname(lease->last_interface, buf->interface);
#endif
#ifdef HAVE_BROKEN_RTC
buf->length = lease->length;
#else
buf->expires = lease->expires;
#endif
buf->remaining_time = (unsigned int)difftime(lease->expires, now);
p = (unsigned char *)(buf+1);
if (clid_len != 0)
{
memcpy(p, lease->clid, clid_len);
p += clid_len;
}
if (vclass_len != 0)
{
memcpy(p, lease->vendorclass, vclass_len);
p += vclass_len;
}
if (uclass_len != 0)
{
memcpy(p, lease->userclass, uclass_len);
p += uclass_len;
}
if (shost_len != 0)
{
memcpy(p, lease->supplied_hostname, shost_len);
p += shost_len;
}
if (hostname_len != 0)
{
memcpy(p, hostname, hostname_len);
p += hostname_len;
}
bytes_in_buf = p - (unsigned char *)buf;
}
int helper_buf_empty(void)
{
return bytes_in_buf == 0;
}
void helper_write(void)
{
ssize_t rc;
if (bytes_in_buf == 0)
return;
if ((rc = write(daemon->helperfd, buf, bytes_in_buf)) != -1)
{
if (bytes_in_buf != (size_t)rc)
memmove(buf, buf + rc, bytes_in_buf - rc);
bytes_in_buf -= rc;
}
else
{
if (errno == EAGAIN || errno == EINTR)
return;
bytes_in_buf = 0;
}
}
#endif
| apache-2.0 |
zhuwenping/python-for-android | python3-alpha/python3-src/Modules/_ctypes/libffi/testsuite/libffi.call/cls_7byte.c | 366 | 2768 | /* Area: ffi_call, closure_call
Purpose: Check structure passing with different structure size.
Depending on the ABI. Check overlapping.
Limitations: none.
PR: none.
Originator: <andreast@gcc.gnu.org> 20030828 */
/* { dg-do run } */
#include "ffitest.h"
typedef struct cls_struct_7byte {
unsigned short a;
unsigned short b;
unsigned char c;
unsigned short d;
} cls_struct_7byte;
cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1,
struct cls_struct_7byte a2)
{
struct cls_struct_7byte result;
result.a = a1.a + a2.a;
result.b = a1.b + a2.b;
result.c = a1.c + a2.c;
result.d = a1.d + a2.d;
printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d,
a2.a, a2.b, a2.c, a2.d,
result.a, result.b, result.c, result.d);
return result;
}
static void
cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args,
void* userdata __UNUSED__)
{
struct cls_struct_7byte a1, a2;
a1 = *(struct cls_struct_7byte*)(args[0]);
a2 = *(struct cls_struct_7byte*)(args[1]);
*(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2);
}
int main (void)
{
ffi_cif cif;
void *code;
ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code);
void* args_dbl[5];
ffi_type* cls_struct_fields[5];
ffi_type cls_struct_type;
ffi_type* dbl_arg_types[5];
cls_struct_type.size = 0;
cls_struct_type.alignment = 0;
cls_struct_type.type = FFI_TYPE_STRUCT;
cls_struct_type.elements = cls_struct_fields;
struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 };
struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 };
struct cls_struct_7byte res_dbl;
cls_struct_fields[0] = &ffi_type_ushort;
cls_struct_fields[1] = &ffi_type_ushort;
cls_struct_fields[2] = &ffi_type_uchar;
cls_struct_fields[3] = &ffi_type_ushort;
cls_struct_fields[4] = NULL;
dbl_arg_types[0] = &cls_struct_type;
dbl_arg_types[1] = &cls_struct_type;
dbl_arg_types[2] = NULL;
CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type,
dbl_arg_types) == FFI_OK);
args_dbl[0] = &g_dbl;
args_dbl[1] = &f_dbl;
args_dbl[2] = NULL;
ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl);
/* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 509" } */
CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK);
res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl);
/* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */
printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d);
/* { dg-output "\nres: 139 248 10 509" } */
exit(0);
}
| apache-2.0 |
manuelmagix/kernel_bq_piccolo | drivers/net/wireless/brcm80211/brcmsmac/ampdu.c | 2160 | 33590 | /*
* Copyright (c) 2010 Broadcom Corporation
*
* Permission to use, copy, modify, and/or 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.
*/
#include <net/mac80211.h>
#include "rate.h"
#include "scb.h"
#include "phy/phy_hal.h"
#include "antsel.h"
#include "main.h"
#include "ampdu.h"
#include "debug.h"
#include "brcms_trace_events.h"
/* max number of mpdus in an ampdu */
#define AMPDU_MAX_MPDU 32
/* max number of mpdus in an ampdu to a legacy */
#define AMPDU_NUM_MPDU_LEGACY 16
/* max Tx ba window size (in pdu) */
#define AMPDU_TX_BA_MAX_WSIZE 64
/* default Tx ba window size (in pdu) */
#define AMPDU_TX_BA_DEF_WSIZE 64
/* default Rx ba window size (in pdu) */
#define AMPDU_RX_BA_DEF_WSIZE 64
/* max Rx ba window size (in pdu) */
#define AMPDU_RX_BA_MAX_WSIZE 64
/* max dur of tx ampdu (in msec) */
#define AMPDU_MAX_DUR 5
/* default tx retry limit */
#define AMPDU_DEF_RETRY_LIMIT 5
/* default tx retry limit at reg rate */
#define AMPDU_DEF_RR_RETRY_LIMIT 2
/* default ffpld reserved bytes */
#define AMPDU_DEF_FFPLD_RSVD 2048
/* # of inis to be freed on detach */
#define AMPDU_INI_FREE 10
/* max # of mpdus released at a time */
#define AMPDU_SCB_MAX_RELEASE 20
#define NUM_FFPLD_FIFO 4 /* number of fifo concerned by pre-loading */
#define FFPLD_TX_MAX_UNFL 200 /* default value of the average number of ampdu
* without underflows
*/
#define FFPLD_MPDU_SIZE 1800 /* estimate of maximum mpdu size */
#define FFPLD_MAX_MCS 23 /* we don't deal with mcs 32 */
#define FFPLD_PLD_INCR 1000 /* increments in bytes */
#define FFPLD_MAX_AMPDU_CNT 5000 /* maximum number of ampdu we
* accumulate between resets.
*/
#define AMPDU_DELIMITER_LEN 4
/* max allowed number of mpdus in an ampdu (2 streams) */
#define AMPDU_NUM_MPDU 16
#define TX_SEQ_TO_INDEX(seq) ((seq) % AMPDU_TX_BA_MAX_WSIZE)
/* max possible overhead per mpdu in the ampdu; 3 is for roundup if needed */
#define AMPDU_MAX_MPDU_OVERHEAD (FCS_LEN + DOT11_ICV_AES_LEN +\
AMPDU_DELIMITER_LEN + 3\
+ DOT11_A4_HDR_LEN + DOT11_QOS_LEN + DOT11_IV_MAX_LEN)
/* modulo add/sub, bound = 2^k */
#define MODADD_POW2(x, y, bound) (((x) + (y)) & ((bound) - 1))
#define MODSUB_POW2(x, y, bound) (((x) - (y)) & ((bound) - 1))
/* structure to hold tx fifo information and pre-loading state
* counters specific to tx underflows of ampdus
* some counters might be redundant with the ones in wlc or ampdu structures.
* This allows to maintain a specific state independently of
* how often and/or when the wlc counters are updated.
*
* ampdu_pld_size: number of bytes to be pre-loaded
* mcs2ampdu_table: per-mcs max # of mpdus in an ampdu
* prev_txfunfl: num of underflows last read from the HW macstats counter
* accum_txfunfl: num of underflows since we modified pld params
* accum_txampdu: num of tx ampdu since we modified pld params
* prev_txampdu: previous reading of tx ampdu
* dmaxferrate: estimated dma avg xfer rate in kbits/sec
*/
struct brcms_fifo_info {
u16 ampdu_pld_size;
u8 mcs2ampdu_table[FFPLD_MAX_MCS + 1];
u16 prev_txfunfl;
u32 accum_txfunfl;
u32 accum_txampdu;
u32 prev_txampdu;
u32 dmaxferrate;
};
/* AMPDU module specific state
*
* wlc: pointer to main wlc structure
* scb_handle: scb cubby handle to retrieve data from scb
* ini_enable: per-tid initiator enable/disable of ampdu
* ba_tx_wsize: Tx ba window size (in pdu)
* ba_rx_wsize: Rx ba window size (in pdu)
* retry_limit: mpdu transmit retry limit
* rr_retry_limit: mpdu transmit retry limit at regular rate
* retry_limit_tid: per-tid mpdu transmit retry limit
* rr_retry_limit_tid: per-tid mpdu transmit retry limit at regular rate
* mpdu_density: min mpdu spacing (0-7) ==> 2^(x-1)/8 usec
* max_pdu: max pdus allowed in ampdu
* dur: max duration of an ampdu (in msec)
* rx_factor: maximum rx ampdu factor (0-3) ==> 2^(13+x) bytes
* ffpld_rsvd: number of bytes to reserve for preload
* max_txlen: max size of ampdu per mcs, bw and sgi
* mfbr: enable multiple fallback rate
* tx_max_funl: underflows should be kept such that
* (tx_max_funfl*underflows) < tx frames
* fifo_tb: table of fifo infos
*/
struct ampdu_info {
struct brcms_c_info *wlc;
int scb_handle;
u8 ini_enable[AMPDU_MAX_SCB_TID];
u8 ba_tx_wsize;
u8 ba_rx_wsize;
u8 retry_limit;
u8 rr_retry_limit;
u8 retry_limit_tid[AMPDU_MAX_SCB_TID];
u8 rr_retry_limit_tid[AMPDU_MAX_SCB_TID];
u8 mpdu_density;
s8 max_pdu;
u8 dur;
u8 rx_factor;
u32 ffpld_rsvd;
u32 max_txlen[MCS_TABLE_SIZE][2][2];
bool mfbr;
u32 tx_max_funl;
struct brcms_fifo_info fifo_tb[NUM_FFPLD_FIFO];
};
/* used for flushing ampdu packets */
struct cb_del_ampdu_pars {
struct ieee80211_sta *sta;
u16 tid;
};
static void brcms_c_scb_ampdu_update_max_txlen(struct ampdu_info *ampdu, u8 dur)
{
u32 rate, mcs;
for (mcs = 0; mcs < MCS_TABLE_SIZE; mcs++) {
/* rate is in Kbps; dur is in msec ==> len = (rate * dur) / 8 */
/* 20MHz, No SGI */
rate = mcs_2_rate(mcs, false, false);
ampdu->max_txlen[mcs][0][0] = (rate * dur) >> 3;
/* 40 MHz, No SGI */
rate = mcs_2_rate(mcs, true, false);
ampdu->max_txlen[mcs][1][0] = (rate * dur) >> 3;
/* 20MHz, SGI */
rate = mcs_2_rate(mcs, false, true);
ampdu->max_txlen[mcs][0][1] = (rate * dur) >> 3;
/* 40 MHz, SGI */
rate = mcs_2_rate(mcs, true, true);
ampdu->max_txlen[mcs][1][1] = (rate * dur) >> 3;
}
}
static bool brcms_c_ampdu_cap(struct ampdu_info *ampdu)
{
if (BRCMS_PHY_11N_CAP(ampdu->wlc->band))
return true;
else
return false;
}
static int brcms_c_ampdu_set(struct ampdu_info *ampdu, bool on)
{
struct brcms_c_info *wlc = ampdu->wlc;
struct bcma_device *core = wlc->hw->d11core;
wlc->pub->_ampdu = false;
if (on) {
if (!(wlc->pub->_n_enab & SUPPORT_11N)) {
brcms_err(core, "wl%d: driver not nmode enabled\n",
wlc->pub->unit);
return -ENOTSUPP;
}
if (!brcms_c_ampdu_cap(ampdu)) {
brcms_err(core, "wl%d: device not ampdu capable\n",
wlc->pub->unit);
return -ENOTSUPP;
}
wlc->pub->_ampdu = on;
}
return 0;
}
static void brcms_c_ffpld_init(struct ampdu_info *ampdu)
{
int i, j;
struct brcms_fifo_info *fifo;
for (j = 0; j < NUM_FFPLD_FIFO; j++) {
fifo = (ampdu->fifo_tb + j);
fifo->ampdu_pld_size = 0;
for (i = 0; i <= FFPLD_MAX_MCS; i++)
fifo->mcs2ampdu_table[i] = 255;
fifo->dmaxferrate = 0;
fifo->accum_txampdu = 0;
fifo->prev_txfunfl = 0;
fifo->accum_txfunfl = 0;
}
}
struct ampdu_info *brcms_c_ampdu_attach(struct brcms_c_info *wlc)
{
struct ampdu_info *ampdu;
int i;
ampdu = kzalloc(sizeof(struct ampdu_info), GFP_ATOMIC);
if (!ampdu)
return NULL;
ampdu->wlc = wlc;
for (i = 0; i < AMPDU_MAX_SCB_TID; i++)
ampdu->ini_enable[i] = true;
/* Disable ampdu for VO by default */
ampdu->ini_enable[PRIO_8021D_VO] = false;
ampdu->ini_enable[PRIO_8021D_NC] = false;
/* Disable ampdu for BK by default since not enough fifo space */
ampdu->ini_enable[PRIO_8021D_NONE] = false;
ampdu->ini_enable[PRIO_8021D_BK] = false;
ampdu->ba_tx_wsize = AMPDU_TX_BA_DEF_WSIZE;
ampdu->ba_rx_wsize = AMPDU_RX_BA_DEF_WSIZE;
ampdu->mpdu_density = AMPDU_DEF_MPDU_DENSITY;
ampdu->max_pdu = AUTO;
ampdu->dur = AMPDU_MAX_DUR;
ampdu->ffpld_rsvd = AMPDU_DEF_FFPLD_RSVD;
/*
* bump max ampdu rcv size to 64k for all 11n
* devices except 4321A0 and 4321A1
*/
if (BRCMS_ISNPHY(wlc->band) && NREV_LT(wlc->band->phyrev, 2))
ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_32K;
else
ampdu->rx_factor = IEEE80211_HT_MAX_AMPDU_64K;
ampdu->retry_limit = AMPDU_DEF_RETRY_LIMIT;
ampdu->rr_retry_limit = AMPDU_DEF_RR_RETRY_LIMIT;
for (i = 0; i < AMPDU_MAX_SCB_TID; i++) {
ampdu->retry_limit_tid[i] = ampdu->retry_limit;
ampdu->rr_retry_limit_tid[i] = ampdu->rr_retry_limit;
}
brcms_c_scb_ampdu_update_max_txlen(ampdu, ampdu->dur);
ampdu->mfbr = false;
/* try to set ampdu to the default value */
brcms_c_ampdu_set(ampdu, wlc->pub->_ampdu);
ampdu->tx_max_funl = FFPLD_TX_MAX_UNFL;
brcms_c_ffpld_init(ampdu);
return ampdu;
}
void brcms_c_ampdu_detach(struct ampdu_info *ampdu)
{
kfree(ampdu);
}
static void brcms_c_scb_ampdu_update_config(struct ampdu_info *ampdu,
struct scb *scb)
{
struct scb_ampdu *scb_ampdu = &scb->scb_ampdu;
int i;
scb_ampdu->max_pdu = AMPDU_NUM_MPDU;
/* go back to legacy size if some preloading is occurring */
for (i = 0; i < NUM_FFPLD_FIFO; i++) {
if (ampdu->fifo_tb[i].ampdu_pld_size > FFPLD_PLD_INCR)
scb_ampdu->max_pdu = AMPDU_NUM_MPDU_LEGACY;
}
/* apply user override */
if (ampdu->max_pdu != AUTO)
scb_ampdu->max_pdu = (u8) ampdu->max_pdu;
scb_ampdu->release = min_t(u8, scb_ampdu->max_pdu,
AMPDU_SCB_MAX_RELEASE);
if (scb_ampdu->max_rx_ampdu_bytes)
scb_ampdu->release = min_t(u8, scb_ampdu->release,
scb_ampdu->max_rx_ampdu_bytes / 1600);
scb_ampdu->release = min(scb_ampdu->release,
ampdu->fifo_tb[TX_AC_BE_FIFO].
mcs2ampdu_table[FFPLD_MAX_MCS]);
}
static void brcms_c_scb_ampdu_update_config_all(struct ampdu_info *ampdu)
{
brcms_c_scb_ampdu_update_config(ampdu, &du->wlc->pri_scb);
}
static void brcms_c_ffpld_calc_mcs2ampdu_table(struct ampdu_info *ampdu, int f)
{
int i;
u32 phy_rate, dma_rate, tmp;
u8 max_mpdu;
struct brcms_fifo_info *fifo = (ampdu->fifo_tb + f);
/* recompute the dma rate */
/* note : we divide/multiply by 100 to avoid integer overflows */
max_mpdu = min_t(u8, fifo->mcs2ampdu_table[FFPLD_MAX_MCS],
AMPDU_NUM_MPDU_LEGACY);
phy_rate = mcs_2_rate(FFPLD_MAX_MCS, true, false);
dma_rate =
(((phy_rate / 100) *
(max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size))
/ (max_mpdu * FFPLD_MPDU_SIZE)) * 100;
fifo->dmaxferrate = dma_rate;
/* fill up the mcs2ampdu table; do not recalc the last mcs */
dma_rate = dma_rate >> 7;
for (i = 0; i < FFPLD_MAX_MCS; i++) {
/* shifting to keep it within integer range */
phy_rate = mcs_2_rate(i, true, false) >> 7;
if (phy_rate > dma_rate) {
tmp = ((fifo->ampdu_pld_size * phy_rate) /
((phy_rate - dma_rate) * FFPLD_MPDU_SIZE)) + 1;
tmp = min_t(u32, tmp, 255);
fifo->mcs2ampdu_table[i] = (u8) tmp;
}
}
}
/* evaluate the dma transfer rate using the tx underflows as feedback.
* If necessary, increase tx fifo preloading. If not enough,
* decrease maximum ampdu size for each mcs till underflows stop
* Return 1 if pre-loading not active, -1 if not an underflow event,
* 0 if pre-loading module took care of the event.
*/
static int brcms_c_ffpld_check_txfunfl(struct brcms_c_info *wlc, int fid)
{
struct ampdu_info *ampdu = wlc->ampdu;
u32 phy_rate = mcs_2_rate(FFPLD_MAX_MCS, true, false);
u32 txunfl_ratio;
u8 max_mpdu;
u32 current_ampdu_cnt = 0;
u16 max_pld_size;
u32 new_txunfl;
struct brcms_fifo_info *fifo = (ampdu->fifo_tb + fid);
uint xmtfifo_sz;
u16 cur_txunfl;
/* return if we got here for a different reason than underflows */
cur_txunfl = brcms_b_read_shm(wlc->hw,
M_UCODE_MACSTAT +
offsetof(struct macstat, txfunfl[fid]));
new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl);
if (new_txunfl == 0) {
brcms_dbg_ht(wlc->hw->d11core,
"TX status FRAG set but no tx underflows\n");
return -1;
}
fifo->prev_txfunfl = cur_txunfl;
if (!ampdu->tx_max_funl)
return 1;
/* check if fifo is big enough */
if (brcms_b_xmtfifo_sz_get(wlc->hw, fid, &xmtfifo_sz))
return -1;
if ((TXFIFO_SIZE_UNIT * (u32) xmtfifo_sz) <= ampdu->ffpld_rsvd)
return 1;
max_pld_size = TXFIFO_SIZE_UNIT * xmtfifo_sz - ampdu->ffpld_rsvd;
fifo->accum_txfunfl += new_txunfl;
/* we need to wait for at least 10 underflows */
if (fifo->accum_txfunfl < 10)
return 0;
brcms_dbg_ht(wlc->hw->d11core, "ampdu_count %d tx_underflows %d\n",
current_ampdu_cnt, fifo->accum_txfunfl);
/*
compute the current ratio of tx unfl per ampdu.
When the current ampdu count becomes too
big while the ratio remains small, we reset
the current count in order to not
introduce too big of a latency in detecting a
large amount of tx underflows later.
*/
txunfl_ratio = current_ampdu_cnt / fifo->accum_txfunfl;
if (txunfl_ratio > ampdu->tx_max_funl) {
if (current_ampdu_cnt >= FFPLD_MAX_AMPDU_CNT)
fifo->accum_txfunfl = 0;
return 0;
}
max_mpdu = min_t(u8, fifo->mcs2ampdu_table[FFPLD_MAX_MCS],
AMPDU_NUM_MPDU_LEGACY);
/* In case max value max_pdu is already lower than
the fifo depth, there is nothing more we can do.
*/
if (fifo->ampdu_pld_size >= max_mpdu * FFPLD_MPDU_SIZE) {
fifo->accum_txfunfl = 0;
return 0;
}
if (fifo->ampdu_pld_size < max_pld_size) {
/* increment by TX_FIFO_PLD_INC bytes */
fifo->ampdu_pld_size += FFPLD_PLD_INCR;
if (fifo->ampdu_pld_size > max_pld_size)
fifo->ampdu_pld_size = max_pld_size;
/* update scb release size */
brcms_c_scb_ampdu_update_config_all(ampdu);
/*
* compute a new dma xfer rate for max_mpdu @ max mcs.
* This is the minimum dma rate that can achieve no
* underflow condition for the current mpdu size.
*
* note : we divide/multiply by 100 to avoid integer overflows
*/
fifo->dmaxferrate =
(((phy_rate / 100) *
(max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size))
/ (max_mpdu * FFPLD_MPDU_SIZE)) * 100;
brcms_dbg_ht(wlc->hw->d11core,
"DMA estimated transfer rate %d; "
"pre-load size %d\n",
fifo->dmaxferrate, fifo->ampdu_pld_size);
} else {
/* decrease ampdu size */
if (fifo->mcs2ampdu_table[FFPLD_MAX_MCS] > 1) {
if (fifo->mcs2ampdu_table[FFPLD_MAX_MCS] == 255)
fifo->mcs2ampdu_table[FFPLD_MAX_MCS] =
AMPDU_NUM_MPDU_LEGACY - 1;
else
fifo->mcs2ampdu_table[FFPLD_MAX_MCS] -= 1;
/* recompute the table */
brcms_c_ffpld_calc_mcs2ampdu_table(ampdu, fid);
/* update scb release size */
brcms_c_scb_ampdu_update_config_all(ampdu);
}
}
fifo->accum_txfunfl = 0;
return 0;
}
void
brcms_c_ampdu_tx_operational(struct brcms_c_info *wlc, u8 tid,
u8 ba_wsize, /* negotiated ba window size (in pdu) */
uint max_rx_ampdu_bytes) /* from ht_cap in beacon */
{
struct scb_ampdu *scb_ampdu;
struct scb_ampdu_tid_ini *ini;
struct ampdu_info *ampdu = wlc->ampdu;
struct scb *scb = &wlc->pri_scb;
scb_ampdu = &scb->scb_ampdu;
if (!ampdu->ini_enable[tid]) {
brcms_err(wlc->hw->d11core, "%s: Rejecting tid %d\n",
__func__, tid);
return;
}
ini = &scb_ampdu->ini[tid];
ini->tid = tid;
ini->scb = scb_ampdu->scb;
ini->ba_wsize = ba_wsize;
scb_ampdu->max_rx_ampdu_bytes = max_rx_ampdu_bytes;
}
void brcms_c_ampdu_reset_session(struct brcms_ampdu_session *session,
struct brcms_c_info *wlc)
{
session->wlc = wlc;
skb_queue_head_init(&session->skb_list);
session->max_ampdu_len = 0; /* determined from first MPDU */
session->max_ampdu_frames = 0; /* determined from first MPDU */
session->ampdu_len = 0;
session->dma_len = 0;
}
/*
* Preps the given packet for AMPDU based on the session data. If the
* frame cannot be accomodated in the current session, -ENOSPC is
* returned.
*/
int brcms_c_ampdu_add_frame(struct brcms_ampdu_session *session,
struct sk_buff *p)
{
struct brcms_c_info *wlc = session->wlc;
struct ampdu_info *ampdu = wlc->ampdu;
struct scb *scb = &wlc->pri_scb;
struct scb_ampdu *scb_ampdu = &scb->scb_ampdu;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p);
struct ieee80211_tx_rate *txrate = tx_info->status.rates;
struct d11txh *txh = (struct d11txh *)p->data;
unsigned ampdu_frames;
u8 ndelim, tid;
u8 *plcp;
uint len;
u16 mcl;
bool fbr_iscck;
bool rr;
ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
plcp = (u8 *)(txh + 1);
fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03);
len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) :
BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
len = roundup(len, 4) + (ndelim + 1) * AMPDU_DELIMITER_LEN;
ampdu_frames = skb_queue_len(&session->skb_list);
if (ampdu_frames != 0) {
struct sk_buff *first;
if (ampdu_frames + 1 > session->max_ampdu_frames ||
session->ampdu_len + len > session->max_ampdu_len)
return -ENOSPC;
/*
* We aren't really out of space if the new frame is of
* a different priority, but we want the same behaviour
* so return -ENOSPC anyway.
*
* XXX: The old AMPDU code did this, but is it really
* necessary?
*/
first = skb_peek(&session->skb_list);
if (p->priority != first->priority)
return -ENOSPC;
}
/*
* Now that we're sure this frame can be accomodated, update the
* session information.
*/
session->ampdu_len += len;
session->dma_len += p->len;
tid = (u8)p->priority;
/* Handle retry limits */
if (txrate[0].count <= ampdu->rr_retry_limit_tid[tid]) {
txrate[0].count++;
rr = true;
} else {
txrate[1].count++;
rr = false;
}
if (ampdu_frames == 0) {
u8 plcp0, plcp3, is40, sgi, mcs;
uint fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK;
struct brcms_fifo_info *f = &du->fifo_tb[fifo];
if (rr) {
plcp0 = plcp[0];
plcp3 = plcp[3];
} else {
plcp0 = txh->FragPLCPFallback[0];
plcp3 = txh->FragPLCPFallback[3];
}
/* Limit AMPDU size based on MCS */
is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0;
sgi = plcp3_issgi(plcp3) ? 1 : 0;
mcs = plcp0 & ~MIMO_PLCP_40MHZ;
session->max_ampdu_len = min(scb_ampdu->max_rx_ampdu_bytes,
ampdu->max_txlen[mcs][is40][sgi]);
session->max_ampdu_frames = scb_ampdu->max_pdu;
if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) {
session->max_ampdu_frames =
min_t(u16, f->mcs2ampdu_table[mcs],
session->max_ampdu_frames);
}
}
/*
* Treat all frames as "middle" frames of AMPDU here. First and
* last frames must be fixed up after all MPDUs have been prepped.
*/
mcl = le16_to_cpu(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_MIDDLE << TXC_AMPDU_SHIFT);
mcl &= ~(TXC_STARTMSDU | TXC_SENDRTS | TXC_SENDCTS);
txh->MacTxControlLow = cpu_to_le16(mcl);
txh->PreloadSize = 0; /* always default to 0 */
skb_queue_tail(&session->skb_list, p);
return 0;
}
void brcms_c_ampdu_finalize(struct brcms_ampdu_session *session)
{
struct brcms_c_info *wlc = session->wlc;
struct ampdu_info *ampdu = wlc->ampdu;
struct sk_buff *first, *last;
struct d11txh *txh;
struct ieee80211_tx_info *tx_info;
struct ieee80211_tx_rate *txrate;
u8 ndelim;
u8 *plcp;
uint len;
uint fifo;
struct brcms_fifo_info *f;
u16 mcl;
bool fbr;
bool fbr_iscck;
struct ieee80211_rts *rts;
bool use_rts = false, use_cts = false;
u16 dma_len = session->dma_len;
u16 mimo_ctlchbw = PHY_TXC1_BW_20MHZ;
u32 rspec = 0, rspec_fallback = 0;
u32 rts_rspec = 0, rts_rspec_fallback = 0;
u8 plcp0, plcp3, is40, sgi, mcs;
u16 mch;
u8 preamble_type = BRCMS_GF_PREAMBLE;
u8 fbr_preamble_type = BRCMS_GF_PREAMBLE;
u8 rts_preamble_type = BRCMS_LONG_PREAMBLE;
u8 rts_fbr_preamble_type = BRCMS_LONG_PREAMBLE;
if (skb_queue_empty(&session->skb_list))
return;
first = skb_peek(&session->skb_list);
last = skb_peek_tail(&session->skb_list);
/* Need to fix up last MPDU first to adjust AMPDU length */
txh = (struct d11txh *)last->data;
fifo = le16_to_cpu(txh->TxFrameID) & TXFID_QUEUE_MASK;
f = &du->fifo_tb[fifo];
mcl = le16_to_cpu(txh->MacTxControlLow);
mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_LAST << TXC_AMPDU_SHIFT);
txh->MacTxControlLow = cpu_to_le16(mcl);
/* remove the null delimiter after last mpdu */
ndelim = txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM];
txh->RTSPLCPFallback[AMPDU_FBR_NULL_DELIM] = 0;
session->ampdu_len -= ndelim * AMPDU_DELIMITER_LEN;
/* remove the pad len from last mpdu */
fbr_iscck = ((le16_to_cpu(txh->XtraFrameTypes) & 0x3) == 0);
len = fbr_iscck ? BRCMS_GET_CCK_PLCP_LEN(txh->FragPLCPFallback) :
BRCMS_GET_MIMO_PLCP_LEN(txh->FragPLCPFallback);
session->ampdu_len -= roundup(len, 4) - len;
/* Now fix up the first MPDU */
tx_info = IEEE80211_SKB_CB(first);
txrate = tx_info->status.rates;
txh = (struct d11txh *)first->data;
plcp = (u8 *)(txh + 1);
rts = (struct ieee80211_rts *)&txh->rts_frame;
mcl = le16_to_cpu(txh->MacTxControlLow);
/* If only one MPDU leave it marked as last */
if (first != last) {
mcl &= ~TXC_AMPDU_MASK;
mcl |= (TXC_AMPDU_FIRST << TXC_AMPDU_SHIFT);
}
mcl |= TXC_STARTMSDU;
if (ieee80211_is_rts(rts->frame_control)) {
mcl |= TXC_SENDRTS;
use_rts = true;
}
if (ieee80211_is_cts(rts->frame_control)) {
mcl |= TXC_SENDCTS;
use_cts = true;
}
txh->MacTxControlLow = cpu_to_le16(mcl);
fbr = txrate[1].count > 0;
if (!fbr) {
plcp0 = plcp[0];
plcp3 = plcp[3];
} else {
plcp0 = txh->FragPLCPFallback[0];
plcp3 = txh->FragPLCPFallback[3];
}
is40 = (plcp0 & MIMO_PLCP_40MHZ) ? 1 : 0;
sgi = plcp3_issgi(plcp3) ? 1 : 0;
mcs = plcp0 & ~MIMO_PLCP_40MHZ;
if (is40) {
if (CHSPEC_SB_UPPER(wlc_phy_chanspec_get(wlc->band->pi)))
mimo_ctlchbw = PHY_TXC1_BW_20MHZ_UP;
else
mimo_ctlchbw = PHY_TXC1_BW_20MHZ;
}
/* rebuild the rspec and rspec_fallback */
rspec = RSPEC_MIMORATE;
rspec |= plcp[0] & ~MIMO_PLCP_40MHZ;
if (plcp[0] & MIMO_PLCP_40MHZ)
rspec |= (PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT);
fbr_iscck = !(le16_to_cpu(txh->XtraFrameTypes) & 0x03);
if (fbr_iscck) {
rspec_fallback =
cck_rspec(cck_phy2mac_rate(txh->FragPLCPFallback[0]));
} else {
rspec_fallback = RSPEC_MIMORATE;
rspec_fallback |= txh->FragPLCPFallback[0] & ~MIMO_PLCP_40MHZ;
if (txh->FragPLCPFallback[0] & MIMO_PLCP_40MHZ)
rspec_fallback |= PHY_TXC1_BW_40MHZ << RSPEC_BW_SHIFT;
}
if (use_rts || use_cts) {
rts_rspec =
brcms_c_rspec_to_rts_rspec(wlc, rspec,
false, mimo_ctlchbw);
rts_rspec_fallback =
brcms_c_rspec_to_rts_rspec(wlc, rspec_fallback,
false, mimo_ctlchbw);
}
BRCMS_SET_MIMO_PLCP_LEN(plcp, session->ampdu_len);
/* mark plcp to indicate ampdu */
BRCMS_SET_MIMO_PLCP_AMPDU(plcp);
/* reset the mixed mode header durations */
if (txh->MModeLen) {
u16 mmodelen = brcms_c_calc_lsig_len(wlc, rspec,
session->ampdu_len);
txh->MModeLen = cpu_to_le16(mmodelen);
preamble_type = BRCMS_MM_PREAMBLE;
}
if (txh->MModeFbrLen) {
u16 mmfbrlen = brcms_c_calc_lsig_len(wlc, rspec_fallback,
session->ampdu_len);
txh->MModeFbrLen = cpu_to_le16(mmfbrlen);
fbr_preamble_type = BRCMS_MM_PREAMBLE;
}
/* set the preload length */
if (mcs_2_rate(mcs, true, false) >= f->dmaxferrate) {
dma_len = min(dma_len, f->ampdu_pld_size);
txh->PreloadSize = cpu_to_le16(dma_len);
} else {
txh->PreloadSize = 0;
}
mch = le16_to_cpu(txh->MacTxControlHigh);
/* update RTS dur fields */
if (use_rts || use_cts) {
u16 durid;
if ((mch & TXC_PREAMBLE_RTS_MAIN_SHORT) ==
TXC_PREAMBLE_RTS_MAIN_SHORT)
rts_preamble_type = BRCMS_SHORT_PREAMBLE;
if ((mch & TXC_PREAMBLE_RTS_FB_SHORT) ==
TXC_PREAMBLE_RTS_FB_SHORT)
rts_fbr_preamble_type = BRCMS_SHORT_PREAMBLE;
durid = brcms_c_compute_rtscts_dur(wlc, use_cts, rts_rspec,
rspec, rts_preamble_type,
preamble_type,
session->ampdu_len, true);
rts->duration = cpu_to_le16(durid);
durid = brcms_c_compute_rtscts_dur(wlc, use_cts,
rts_rspec_fallback,
rspec_fallback,
rts_fbr_preamble_type,
fbr_preamble_type,
session->ampdu_len, true);
txh->RTSDurFallback = cpu_to_le16(durid);
/* set TxFesTimeNormal */
txh->TxFesTimeNormal = rts->duration;
/* set fallback rate version of TxFesTimeNormal */
txh->TxFesTimeFallback = txh->RTSDurFallback;
}
/* set flag and plcp for fallback rate */
if (fbr) {
mch |= TXC_AMPDU_FBR;
txh->MacTxControlHigh = cpu_to_le16(mch);
BRCMS_SET_MIMO_PLCP_AMPDU(plcp);
BRCMS_SET_MIMO_PLCP_AMPDU(txh->FragPLCPFallback);
}
brcms_dbg_ht(wlc->hw->d11core, "wl%d: count %d ampdu_len %d\n",
wlc->pub->unit, skb_queue_len(&session->skb_list),
session->ampdu_len);
}
static void
brcms_c_ampdu_rate_status(struct brcms_c_info *wlc,
struct ieee80211_tx_info *tx_info,
struct tx_status *txs, u8 mcs)
{
struct ieee80211_tx_rate *txrate = tx_info->status.rates;
int i;
/* clear the rest of the rates */
for (i = 2; i < IEEE80211_TX_MAX_RATES; i++) {
txrate[i].idx = -1;
txrate[i].count = 0;
}
}
static void
brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, struct tx_status *txs,
u32 s1, u32 s2)
{
struct scb_ampdu *scb_ampdu;
struct brcms_c_info *wlc = ampdu->wlc;
struct scb_ampdu_tid_ini *ini;
u8 bitmap[8], queue, tid;
struct d11txh *txh;
u8 *plcp;
struct ieee80211_hdr *h;
u16 seq, start_seq = 0, bindex, index, mcl;
u8 mcs = 0;
bool ba_recd = false, ack_recd = false;
u8 suc_mpdu = 0, tot_mpdu = 0;
uint supr_status;
bool update_rate = true, retry = true, tx_error = false;
u16 mimoantsel = 0;
u8 antselid = 0;
u8 retry_limit, rr_retry_limit;
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(p);
#ifdef DEBUG
u8 hole[AMPDU_MAX_MPDU];
memset(hole, 0, sizeof(hole));
#endif
scb_ampdu = &scb->scb_ampdu;
tid = (u8) (p->priority);
ini = &scb_ampdu->ini[tid];
retry_limit = ampdu->retry_limit_tid[tid];
rr_retry_limit = ampdu->rr_retry_limit_tid[tid];
memset(bitmap, 0, sizeof(bitmap));
queue = txs->frameid & TXFID_QUEUE_MASK;
supr_status = txs->status & TX_STATUS_SUPR_MASK;
if (txs->status & TX_STATUS_ACK_RCV) {
if (TX_STATUS_SUPR_UF == supr_status)
update_rate = false;
WARN_ON(!(txs->status & TX_STATUS_INTERMEDIATE));
start_seq = txs->sequence >> SEQNUM_SHIFT;
bitmap[0] = (txs->status & TX_STATUS_BA_BMAP03_MASK) >>
TX_STATUS_BA_BMAP03_SHIFT;
WARN_ON(s1 & TX_STATUS_INTERMEDIATE);
WARN_ON(!(s1 & TX_STATUS_AMPDU));
bitmap[0] |=
(s1 & TX_STATUS_BA_BMAP47_MASK) <<
TX_STATUS_BA_BMAP47_SHIFT;
bitmap[1] = (s1 >> 8) & 0xff;
bitmap[2] = (s1 >> 16) & 0xff;
bitmap[3] = (s1 >> 24) & 0xff;
bitmap[4] = s2 & 0xff;
bitmap[5] = (s2 >> 8) & 0xff;
bitmap[6] = (s2 >> 16) & 0xff;
bitmap[7] = (s2 >> 24) & 0xff;
ba_recd = true;
} else {
if (supr_status) {
update_rate = false;
if (supr_status == TX_STATUS_SUPR_BADCH) {
brcms_err(wlc->hw->d11core,
"%s: Pkt tx suppressed, illegal channel possibly %d\n",
__func__, CHSPEC_CHANNEL(
wlc->default_bss->chanspec));
} else {
if (supr_status != TX_STATUS_SUPR_FRAG)
brcms_err(wlc->hw->d11core,
"%s: supr_status 0x%x\n",
__func__, supr_status);
}
/* no need to retry for badch; will fail again */
if (supr_status == TX_STATUS_SUPR_BADCH ||
supr_status == TX_STATUS_SUPR_EXPTIME) {
retry = false;
} else if (supr_status == TX_STATUS_SUPR_EXPTIME) {
/* TX underflow:
* try tuning pre-loading or ampdu size
*/
} else if (supr_status == TX_STATUS_SUPR_FRAG) {
/*
* if there were underflows, but pre-loading
* is not active, notify rate adaptation.
*/
if (brcms_c_ffpld_check_txfunfl(wlc, queue) > 0)
tx_error = true;
}
} else if (txs->phyerr) {
update_rate = false;
brcms_err(wlc->hw->d11core,
"%s: ampdu tx phy error (0x%x)\n",
__func__, txs->phyerr);
}
}
/* loop through all pkts and retry if not acked */
while (p) {
tx_info = IEEE80211_SKB_CB(p);
txh = (struct d11txh *) p->data;
mcl = le16_to_cpu(txh->MacTxControlLow);
plcp = (u8 *) (txh + 1);
h = (struct ieee80211_hdr *)(plcp + D11_PHY_HDR_LEN);
seq = le16_to_cpu(h->seq_ctrl) >> SEQNUM_SHIFT;
trace_brcms_txdesc(&wlc->hw->d11core->dev, txh, sizeof(*txh));
if (tot_mpdu == 0) {
mcs = plcp[0] & MIMO_PLCP_MCS_MASK;
mimoantsel = le16_to_cpu(txh->ABI_MimoAntSel);
}
index = TX_SEQ_TO_INDEX(seq);
ack_recd = false;
if (ba_recd) {
bindex = MODSUB_POW2(seq, start_seq, SEQNUM_MAX);
brcms_dbg_ht(wlc->hw->d11core,
"tid %d seq %d, start_seq %d, bindex %d set %d, index %d\n",
tid, seq, start_seq, bindex,
isset(bitmap, bindex), index);
/* if acked then clear bit and free packet */
if ((bindex < AMPDU_TX_BA_MAX_WSIZE)
&& isset(bitmap, bindex)) {
ini->txretry[index] = 0;
/*
* ampdu_ack_len:
* number of acked aggregated frames
*/
/* ampdu_len: number of aggregated frames */
brcms_c_ampdu_rate_status(wlc, tx_info, txs,
mcs);
tx_info->flags |= IEEE80211_TX_STAT_ACK;
tx_info->flags |= IEEE80211_TX_STAT_AMPDU;
tx_info->status.ampdu_ack_len =
tx_info->status.ampdu_len = 1;
skb_pull(p, D11_PHY_HDR_LEN);
skb_pull(p, D11_TXH_LEN);
ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
p);
ack_recd = true;
suc_mpdu++;
}
}
/* either retransmit or send bar if ack not recd */
if (!ack_recd) {
if (retry && (ini->txretry[index] < (int)retry_limit)) {
int ret;
ini->txretry[index]++;
ret = brcms_c_txfifo(wlc, queue, p);
/*
* We shouldn't be out of space in the DMA
* ring here since we're reinserting a frame
* that was just pulled out.
*/
WARN_ONCE(ret, "queue %d out of txds\n", queue);
} else {
/* Retry timeout */
ieee80211_tx_info_clear_status(tx_info);
tx_info->status.ampdu_ack_len = 0;
tx_info->status.ampdu_len = 1;
tx_info->flags |=
IEEE80211_TX_STAT_AMPDU_NO_BACK;
skb_pull(p, D11_PHY_HDR_LEN);
skb_pull(p, D11_TXH_LEN);
brcms_dbg_ht(wlc->hw->d11core,
"BA Timeout, seq %d\n",
seq);
ieee80211_tx_status_irqsafe(wlc->pub->ieee_hw,
p);
}
}
tot_mpdu++;
/* break out if last packet of ampdu */
if (((mcl & TXC_AMPDU_MASK) >> TXC_AMPDU_SHIFT) ==
TXC_AMPDU_LAST)
break;
p = dma_getnexttxp(wlc->hw->di[queue], DMA_RANGE_TRANSMITTED);
}
/* update rate state */
antselid = brcms_c_antsel_antsel2id(wlc->asi, mimoantsel);
}
void
brcms_c_ampdu_dotxstatus(struct ampdu_info *ampdu, struct scb *scb,
struct sk_buff *p, struct tx_status *txs)
{
struct scb_ampdu *scb_ampdu;
struct brcms_c_info *wlc = ampdu->wlc;
struct scb_ampdu_tid_ini *ini;
u32 s1 = 0, s2 = 0;
struct ieee80211_tx_info *tx_info;
tx_info = IEEE80211_SKB_CB(p);
/* BMAC_NOTE: For the split driver, second level txstatus comes later
* So if the ACK was received then wait for the second level else just
* call the first one
*/
if (txs->status & TX_STATUS_ACK_RCV) {
u8 status_delay = 0;
/* wait till the next 8 bytes of txstatus is available */
s1 = bcma_read32(wlc->hw->d11core, D11REGOFFS(frmtxstatus));
while ((s1 & TXS_V) == 0) {
udelay(1);
status_delay++;
if (status_delay > 10)
return; /* error condition */
s1 = bcma_read32(wlc->hw->d11core,
D11REGOFFS(frmtxstatus));
}
s2 = bcma_read32(wlc->hw->d11core, D11REGOFFS(frmtxstatus2));
}
if (scb) {
scb_ampdu = &scb->scb_ampdu;
ini = &scb_ampdu->ini[p->priority];
brcms_c_ampdu_dotxstatus_complete(ampdu, scb, p, txs, s1, s2);
} else {
/* loop through all pkts and free */
u8 queue = txs->frameid & TXFID_QUEUE_MASK;
struct d11txh *txh;
u16 mcl;
while (p) {
tx_info = IEEE80211_SKB_CB(p);
txh = (struct d11txh *) p->data;
trace_brcms_txdesc(&wlc->hw->d11core->dev, txh,
sizeof(*txh));
mcl = le16_to_cpu(txh->MacTxControlLow);
brcmu_pkt_buf_free_skb(p);
/* break out if last packet of ampdu */
if (((mcl & TXC_AMPDU_MASK) >> TXC_AMPDU_SHIFT) ==
TXC_AMPDU_LAST)
break;
p = dma_getnexttxp(wlc->hw->di[queue],
DMA_RANGE_TRANSMITTED);
}
}
}
void brcms_c_ampdu_macaddr_upd(struct brcms_c_info *wlc)
{
char template[T_RAM_ACCESS_SZ * 2];
/* driver needs to write the ta in the template; ta is at offset 16 */
memset(template, 0, sizeof(template));
memcpy(template, wlc->pub->cur_etheraddr, ETH_ALEN);
brcms_b_write_template_ram(wlc->hw, (T_BA_TPL_BASE + 16),
(T_RAM_ACCESS_SZ * 2),
template);
}
bool brcms_c_aggregatable(struct brcms_c_info *wlc, u8 tid)
{
return wlc->ampdu->ini_enable[tid];
}
void brcms_c_ampdu_shm_upd(struct ampdu_info *ampdu)
{
struct brcms_c_info *wlc = ampdu->wlc;
/*
* Extend ucode internal watchdog timer to
* match larger received frames
*/
if ((ampdu->rx_factor & IEEE80211_HT_AMPDU_PARM_FACTOR) ==
IEEE80211_HT_MAX_AMPDU_64K) {
brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_MAX);
brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_MAX);
} else {
brcms_b_write_shm(wlc->hw, M_MIMO_MAXSYM, MIMO_MAXSYM_DEF);
brcms_b_write_shm(wlc->hw, M_WATCHDOG_8TU, WATCHDOG_8TU_DEF);
}
}
/*
* callback function that helps invalidating ampdu packets in a DMA queue
*/
static void dma_cb_fn_ampdu(void *txi, void *arg_a)
{
struct ieee80211_sta *sta = arg_a;
struct ieee80211_tx_info *tx_info = (struct ieee80211_tx_info *)txi;
if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) &&
(tx_info->rate_driver_data[0] == sta || sta == NULL))
tx_info->rate_driver_data[0] = NULL;
}
/*
* When a remote party is no longer available for ampdu communication, any
* pending tx ampdu packets in the driver have to be flushed.
*/
void brcms_c_ampdu_flush(struct brcms_c_info *wlc,
struct ieee80211_sta *sta, u16 tid)
{
brcms_c_inval_dma_pkts(wlc->hw, sta, dma_cb_fn_ampdu);
}
| apache-2.0 |
glycerine/docker | vendor/src/github.com/opencontainers/runc/libcontainer/nsenter/nsexec.c | 370 | 4337 | #define _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <linux/limits.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>
#include <sched.h>
#include <signal.h>
/* All arguments should be above stack, because it grows down */
struct clone_arg {
/*
* Reserve some space for clone() to locate arguments
* and retcode in this place
*/
char stack[4096] __attribute__ ((aligned(8)));
char stack_ptr[0];
jmp_buf *env;
};
#define pr_perror(fmt, ...) fprintf(stderr, "nsenter: " fmt ": %m\n", ##__VA_ARGS__)
static int child_func(void *_arg)
{
struct clone_arg *arg = (struct clone_arg *)_arg;
longjmp(*arg->env, 1);
}
// Use raw setns syscall for versions of glibc that don't include it (namely glibc-2.12)
#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 14
#define _GNU_SOURCE
#include "syscall.h"
#if defined(__NR_setns) && !defined(SYS_setns)
#define SYS_setns __NR_setns
#endif
#ifdef SYS_setns
int setns(int fd, int nstype)
{
return syscall(SYS_setns, fd, nstype);
}
#endif
#endif
static int clone_parent(jmp_buf * env) __attribute__ ((noinline));
static int clone_parent(jmp_buf * env)
{
struct clone_arg ca;
int child;
ca.env = env;
child = clone(child_func, ca.stack_ptr, CLONE_PARENT | SIGCHLD, &ca);
return child;
}
void nsexec()
{
char *namespaces[] = { "ipc", "uts", "net", "pid", "mnt" };
const int num = sizeof(namespaces) / sizeof(char *);
jmp_buf env;
char buf[PATH_MAX], *val;
int i, tfd, child, len, pipenum, consolefd = -1;
pid_t pid;
char *console;
val = getenv("_LIBCONTAINER_INITPID");
if (val == NULL)
return;
pid = atoi(val);
snprintf(buf, sizeof(buf), "%d", pid);
if (strcmp(val, buf)) {
pr_perror("Unable to parse _LIBCONTAINER_INITPID");
exit(1);
}
val = getenv("_LIBCONTAINER_INITPIPE");
if (val == NULL) {
pr_perror("Child pipe not found");
exit(1);
}
pipenum = atoi(val);
snprintf(buf, sizeof(buf), "%d", pipenum);
if (strcmp(val, buf)) {
pr_perror("Unable to parse _LIBCONTAINER_INITPIPE");
exit(1);
}
console = getenv("_LIBCONTAINER_CONSOLE_PATH");
if (console != NULL) {
consolefd = open(console, O_RDWR);
if (consolefd < 0) {
pr_perror("Failed to open console %s", console);
exit(1);
}
}
/* Check that the specified process exists */
snprintf(buf, PATH_MAX - 1, "/proc/%d/ns", pid);
tfd = open(buf, O_DIRECTORY | O_RDONLY);
if (tfd == -1) {
pr_perror("Failed to open \"%s\"", buf);
exit(1);
}
for (i = 0; i < num; i++) {
struct stat st;
int fd;
/* Symlinks on all namespaces exist for dead processes, but they can't be opened */
if (fstatat(tfd, namespaces[i], &st, AT_SYMLINK_NOFOLLOW) == -1) {
// Ignore nonexistent namespaces.
if (errno == ENOENT)
continue;
}
fd = openat(tfd, namespaces[i], O_RDONLY);
if (fd == -1) {
pr_perror("Failed to open ns file %s for ns %s", buf,
namespaces[i]);
exit(1);
}
// Set the namespace.
if (setns(fd, 0) == -1) {
pr_perror("Failed to setns for %s", namespaces[i]);
exit(1);
}
close(fd);
}
if (setjmp(env) == 1) {
// Child
if (setsid() == -1) {
pr_perror("setsid failed");
exit(1);
}
if (consolefd != -1) {
if (ioctl(consolefd, TIOCSCTTY, 0) == -1) {
pr_perror("ioctl TIOCSCTTY failed");
exit(1);
}
if (dup3(consolefd, STDIN_FILENO, 0) != STDIN_FILENO) {
pr_perror("Failed to dup 0");
exit(1);
}
if (dup3(consolefd, STDOUT_FILENO, 0) != STDOUT_FILENO) {
pr_perror("Failed to dup 1");
exit(1);
}
if (dup3(consolefd, STDERR_FILENO, 0) != STDERR_FILENO) {
pr_perror("Failed to dup 2");
exit(1);
}
}
// Finish executing, let the Go runtime take over.
return;
}
// Parent
// We must fork to actually enter the PID namespace, use CLONE_PARENT
// so the child can have the right parent, and we don't need to forward
// the child's exit code or resend its death signal.
child = clone_parent(&env);
if (child < 0) {
pr_perror("Unable to fork");
exit(1);
}
len = snprintf(buf, sizeof(buf), "{ \"pid\" : %d }\n", child);
if (write(pipenum, buf, len) != len) {
pr_perror("Unable to send a child pid");
kill(child, SIGKILL);
exit(1);
}
exit(0);
}
| apache-2.0 |
halmani/Lua | lib/lua-5.3.4/src/linit.c | 142 | 1728 | /*
** $Id: linit.c,v 1.39 2016/12/04 20:17:24 roberto Exp $
** Initialization of libraries for lua.c and other clients
** See Copyright Notice in lua.h
*/
#define linit_c
#define LUA_LIB
/*
** If you embed Lua in your program and need to open the standard
** libraries, call luaL_openlibs in your program. If you need a
** different set of libraries, copy this file to your project and edit
** it to suit your needs.
**
** You can also *preload* libraries, so that a later 'require' can
** open the library, which is already linked to the application.
** For that, do the following code:
**
** luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
** lua_pushcfunction(L, luaopen_modname);
** lua_setfield(L, -2, modname);
** lua_pop(L, 1); // remove PRELOAD table
*/
#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/*
** these libs are loaded by lua.c and are readily available to any Lua
** program
*/
static const luaL_Reg loadedlibs[] = {
{"_G", luaopen_base},
{LUA_LOADLIBNAME, luaopen_package},
{LUA_COLIBNAME, luaopen_coroutine},
{LUA_TABLIBNAME, luaopen_table},
{LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_UTF8LIBNAME, luaopen_utf8},
{LUA_DBLIBNAME, luaopen_debug},
#if defined(LUA_COMPAT_BITLIB)
{LUA_BITLIBNAME, luaopen_bit32},
#endif
{NULL, NULL}
};
LUALIB_API void luaL_openlibs (lua_State *L) {
const luaL_Reg *lib;
/* "require" functions from 'loadedlibs' and set results to global table */
for (lib = loadedlibs; lib->func; lib++) {
luaL_requiref(L, lib->name, lib->func, 1);
lua_pop(L, 1); /* remove lib */
}
}
| apache-2.0 |
Ant-OS/android_kernel_moto_shamu | drivers/staging/wlags49_h2/mmd.c | 2961 | 13363 |
/************************************************************************************************************
*
* FILE : mmd.c
*
* DATE : $Date: 2004/07/23 11:57:45 $ $Revision: 1.4 $
* Original: 2004/05/28 14:05:35 Revision: 1.32 Tag: hcf7_t20040602_01
* Original: 2004/05/13 15:31:45 Revision: 1.30 Tag: hcf7_t7_20040513_01
* Original: 2004/04/15 09:24:42 Revision: 1.25 Tag: hcf7_t7_20040415_01
* Original: 2004/04/08 15:18:17 Revision: 1.24 Tag: t7_20040413_01
* Original: 2004/04/01 15:32:55 Revision: 1.22 Tag: t7_20040401_01
* Original: 2004/03/10 15:39:28 Revision: 1.18 Tag: t20040310_01
* Original: 2004/03/03 14:10:12 Revision: 1.16 Tag: t20040304_01
* Original: 2004/03/02 09:27:12 Revision: 1.14 Tag: t20040302_03
* Original: 2004/02/24 13:00:29 Revision: 1.12 Tag: t20040224_01
* Original: 2004/01/30 09:59:33 Revision: 1.11 Tag: t20040219_01
*
* AUTHOR : Nico Valster
*
* DESC : Common routines for HCF, MSF, UIL as well as USF sources
*
* Note: relative to Asserts, the following can be observed:
* Since the IFB is not known inside the routine, the macro HCFASSERT is replaced with MDDASSERT.
* Also the line number reported in the assert is raised by FILE_NAME_OFFSET (20000) to discriminate the
* MMD Asserts from HCF and DHF asserts.
*
***************************************************************************************************************
*
*
* SOFTWARE LICENSE
*
* This software is provided subject to the following terms and conditions,
* which you should read carefully before using the software. Using this
* software indicates your acceptance of these terms and conditions. If you do
* not agree with these terms and conditions, do not use the software.
*
* COPYRIGHT © 2001 - 2004 by Agere Systems Inc. All Rights Reserved
* All rights reserved.
*
* Redistribution and use in source or binary forms, with or without
* modifications, are permitted provided that the following conditions are met:
*
* . Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following Disclaimer as comments in the code as
* well as in the documentation and/or other materials provided with the
* distribution.
*
* . Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following Disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* . Neither the name of Agere Systems Inc. nor the names of the contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* Disclaimer
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
* USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
* RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*
**************************************************************************************************************/
#include "hcf.h" // Needed as long as we do not really sort out the mess
#include "hcfdef.h" // get CNV_LITTLE_TO_SHORT
#include "mmd.h" // MoreModularDriver common include file
//to distinguish DHF from HCF asserts by means of line number
#undef FILE_NAME_OFFSET
#define FILE_NAME_OFFSET DHF_FILE_NAME_OFFSET
/*************************************************************************************************************
*
*.MODULE CFG_RANGE_SPEC_STRCT* mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp )
*.PURPOSE Checks compatibility between an actor and a supplier.
*
*.ARGUMENTS
* actp
* supp
*
*.RETURNS
* NULL incompatible
* <>NULL pointer to matching CFG_RANGE_SPEC_STRCT substructure in actor-structure matching the supplier
*
*.NARRATIVE
*
* Parameters:
* actp address of the actor specification
* supp address of the supplier specification
*
* Description: mmd_check_comp is a support routine to check the compatibility between an actor and a
* supplier. mmd_check_comp is independent of the endianness of the actp and supp structures. This is
* achieved by checking the "bottom" or "role" fields of these structures. Since these fields are restricted
* to a limited range, comparing the contents to a value with a known endian-ess gives a clue to their actual
* endianness.
*
*.DIAGRAM
*1a: The role-field of the actor structure has a known non-zero, not "byte symmetric" value (namely
* COMP_ROLE_ACT or 0x0001), so if and only the contents of this field matches COMP_ROLE_ACT (in Native
* Endian format), the actor structure is Native Endian.
*2a: Since the role-field of the supplier structure is 0x0000, the test as used for the actor does not work
* for a supplier. A supplier has always exactly 1 variant,top,bottom record with (officially, but see the
* note below) each of these 3 values in the range 1 through 99, so one byte of the word value of variant,
* top and bottom words is 0x00 and the other byte is non-zero. Whether the lowest address byte or the
* highest address byte is non-zero depends on the Endianness of the LTV. If and only if the word value of
* bottom is less than 0x0100, the supplier is Native Endian.
* NOTE: the variant field of the supplier structure can not be used for the Endian Detection Algorithm,
* because a a zero-valued variant has been used as Controlled Deployment indication in the past.
* Note: An actor may have multiple sets of variant,top,bottom records, including dummy sets with variant,
* top and bottom fields with a zero-value. As a consequence the endianness of the actor can not be determined
* based on its variant,top,bottom values.
*
* Note: the L and T field of the structures are always in Native Endian format, so you can not draw
* conclusions concerning the Endianness of the structure based on these two fields.
*
*1b/2b
* The only purpose of the CFG_RANGE_SPEC_BYTE_STRCT is to give easy access to the non-zero byte of the word
* value of variant, top and bottom. The variables sup_endian and act_endian are used for the supplier and
* actor structure respectively. These variables must be 0 when the structure has LE format and 1 if the
* structure has BE format. This can be phrased as:
* the variable is false (i.e 0x0000) if either
* (the platform is LE and the LTV is the same as the platform)
* or
* (the platform is BE and the LTV differs from the platform).
* the variable is true (i.e 0x0001) if either
* (the platform is BE and the LTV is the same as the platform)
* or
* (the platform is LE and the LTV differs from the platform).
*
* Alternatively this can be phrased as:
* if the platform is LE
* if the LTV is LE (i.e the same as the platform), then the variable = 0
* else (the LTV is BE (i.e. different from the platform) ), then the variable = 1
* if the platform is BE
* if the LTV is BE (i.e the same as the platform), then the variable = 1
* else (the LTV is LE (i.e. different from the platform) ), then the variable = 0
*
* This is implemented as:
* #if HCF_BIG_ENDIAN == 0 //platform is LE
* sup/act_endian becomes reverse of structure-endianness as determined in 1a/1b
* #endif
*6: Each of the actor variant-bottom-top records is checked against the (single) supplier variant-bottom-top
* range till either an acceptable match is found or all actor records are tried. As explained above, due to
* the limited ranges of these values, checking a byte is acceptable and suitable.
*8: depending on whether a match was found or not (as reflected by the value of the control variable of the
* for loop), the NULL pointer or a pointer to the matching Number/Bottom/Top record of the Actor structure
* is returned.
* As an additional safety, checking the supplier length protects against invalid Supplier structures, which
* may be caused by failing hcf_get_info (in which case the len-field is zero). Note that the contraption
* "supp->len != sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1"
* did turn out not to work for a compiler which padded the structure definition.
*
* Note: when consulting references like DesignNotes and Architecture specifications there is a confusing use
* of the notions number and variant. This resulted in an inconsistent use in the HCF nomenclature as well.
* This makes the logic hard to follow and one has to be very much aware of the context when walking through
* the code.
* NOTE: The Endian Detection Algorithm places limitations on future extensions of the fields, i.e. they should
* stay within the currently defined boundaries of 1 through 99 (although 1 through 255) would work as well
* and there should never be used a zero value for the bottom of a valid supplier.
* Note: relative to Asserts, the following can be observed:
* 1: Supplier variant 0x0000 has been used for Controlled Deployment
* 2: An actor may have one or more variant record specifications with a top of zero and a non-zero bottom
* to override the HCF default support of a particular variant by the MSF programmer via hcfcfg.h
* 3: An actor range can be specified as all zeros, e.g. as padding in the automatically generated firmware
* image files.
*.ENDDOC END DOCUMENTATION
*************************************************************************************************************/
CFG_RANGE_SPEC_STRCT*
mmd_check_comp( CFG_RANGES_STRCT *actp, CFG_SUP_RANGE_STRCT *supp )
{
CFG_RANGE_SPEC_BYTE_STRCT *actq = (CFG_RANGE_SPEC_BYTE_STRCT*)actp->var_rec;
CFG_RANGE_SPEC_BYTE_STRCT *supq = (CFG_RANGE_SPEC_BYTE_STRCT*)&(supp->variant);
hcf_16 i;
int act_endian; //actor endian flag
int sup_endian; //supplier endian flag
act_endian = actp->role == COMP_ROLE_ACT; //true if native endian /* 1a */
sup_endian = supp->bottom < 0x0100; //true if native endian /* 2a */
#if HCF_ASSERT
MMDASSERT( supp->len == 6, supp->len )
MMDASSERT( actp->len >= 6 && actp->len%3 == 0, actp->len )
if ( act_endian ) { //native endian
MMDASSERT( actp->role == COMP_ROLE_ACT, actp->role )
MMDASSERT( 1 <= actp->id && actp->id <= 99, actp->id )
} else { //non-native endian
MMDASSERT( actp->role == CNV_END_SHORT(COMP_ROLE_ACT), actp->role )
MMDASSERT( 1 <= CNV_END_SHORT(actp->id) && CNV_END_SHORT(actp->id) <= 99, actp->id )
}
if ( sup_endian ) { //native endian
MMDASSERT( supp->role == COMP_ROLE_SUPL, supp->role )
MMDASSERT( 1 <= supp->id && supp->id <= 99, supp->id )
MMDASSERT( 1 <= supp->variant && supp->variant <= 99, supp->variant )
MMDASSERT( 1 <= supp->bottom && supp->bottom <= 99, supp->bottom )
MMDASSERT( 1 <= supp->top && supp->top <= 99, supp->top )
MMDASSERT( supp->bottom <= supp->top, supp->bottom << 8 | supp->top )
} else { //non-native endian
MMDASSERT( supp->role == CNV_END_SHORT(COMP_ROLE_SUPL), supp->role )
MMDASSERT( 1 <= CNV_END_SHORT(supp->id) && CNV_END_SHORT(supp->id) <= 99, supp->id )
MMDASSERT( 1 <= CNV_END_SHORT(supp->variant) && CNV_END_SHORT(supp->variant) <= 99, supp->variant )
MMDASSERT( 1 <= CNV_END_SHORT(supp->bottom) && CNV_END_SHORT(supp->bottom) <=99, supp->bottom )
MMDASSERT( 1 <= CNV_END_SHORT(supp->top) && CNV_END_SHORT(supp->top) <=99, supp->top )
MMDASSERT( CNV_END_SHORT(supp->bottom) <= CNV_END_SHORT(supp->top), supp->bottom << 8 | supp->top )
}
#endif // HCF_ASSERT
#if HCF_BIG_ENDIAN == 0
act_endian = !act_endian; /* 1b*/
sup_endian = !sup_endian; /* 2b*/
#endif // HCF_BIG_ENDIAN
for ( i = actp->len ; i > 3; actq++, i -= 3 ) { /* 6 */
MMDASSERT( actq->variant[act_endian] <= 99, i<<8 | actq->variant[act_endian] )
MMDASSERT( actq->bottom[act_endian] <= 99 , i<<8 | actq->bottom[act_endian] )
MMDASSERT( actq->top[act_endian] <= 99 , i<<8 | actq->top[act_endian] )
MMDASSERT( actq->bottom[act_endian] <= actq->top[act_endian], i<<8 | actq->bottom[act_endian] )
if ( actq->variant[act_endian] == supq->variant[sup_endian] &&
actq->bottom[act_endian] <= supq->top[sup_endian] &&
actq->top[act_endian] >= supq->bottom[sup_endian]
) break;
}
if ( i <= 3 || supp->len != 6 /*sizeof(CFG_SUP_RANGE_STRCT)/sizeof(hcf_16) - 1 */ ) {
actq = NULL; /* 8 */
}
#if HCF_ASSERT
if ( actq == NULL ) {
for ( i = 0; i <= supp->len; i += 2 ) {
MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)supp)[i], ((hcf_16*)supp)[i+1] ) );
}
for ( i = 0; i <= actp->len; i += 2 ) {
MMDASSERT( DO_ASSERT, MERGE_2( ((hcf_16*)actp)[i], ((hcf_16*)actp)[i+1] ) );
}
}
#endif // HCF_ASSERT
return (CFG_RANGE_SPEC_STRCT*)actq;
} // mmd_check_comp
| apache-2.0 |
BackupGGCode/python-for-android | python-build/openssl/crypto/asn1/a_utctm.c | 148 | 8494 | /* crypto/asn1/a_utctm.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include <time.h>
#include "cryptlib.h"
#include "o_time.h"
#include <openssl/asn1.h>
#if 0
int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **pp)
{
#ifndef CHARSET_EBCDIC
return(i2d_ASN1_bytes((ASN1_STRING *)a,pp,
V_ASN1_UTCTIME,V_ASN1_UNIVERSAL));
#else
/* KLUDGE! We convert to ascii before writing DER */
int len;
char tmp[24];
ASN1_STRING x = *(ASN1_STRING *)a;
len = x.length;
ebcdic2ascii(tmp, x.data, (len >= sizeof tmp) ? sizeof tmp : len);
x.data = tmp;
return i2d_ASN1_bytes(&x, pp, V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
#endif
}
ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, unsigned char **pp,
long length)
{
ASN1_UTCTIME *ret=NULL;
ret=(ASN1_UTCTIME *)d2i_ASN1_bytes((ASN1_STRING **)a,pp,length,
V_ASN1_UTCTIME,V_ASN1_UNIVERSAL);
if (ret == NULL)
{
ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ERR_R_NESTED_ASN1_ERROR);
return(NULL);
}
#ifdef CHARSET_EBCDIC
ascii2ebcdic(ret->data, ret->data, ret->length);
#endif
if (!ASN1_UTCTIME_check(ret))
{
ASN1err(ASN1_F_D2I_ASN1_UTCTIME,ASN1_R_INVALID_TIME_FORMAT);
goto err;
}
return(ret);
err:
if ((ret != NULL) && ((a == NULL) || (*a != ret)))
M_ASN1_UTCTIME_free(ret);
return(NULL);
}
#endif
int ASN1_UTCTIME_check(ASN1_UTCTIME *d)
{
static int min[8]={ 0, 1, 1, 0, 0, 0, 0, 0};
static int max[8]={99,12,31,23,59,59,12,59};
char *a;
int n,i,l,o;
if (d->type != V_ASN1_UTCTIME) return(0);
l=d->length;
a=(char *)d->data;
o=0;
if (l < 11) goto err;
for (i=0; i<6; i++)
{
if ((i == 5) && ((a[o] == 'Z') ||
(a[o] == '+') || (a[o] == '-')))
{ i++; break; }
if ((a[o] < '0') || (a[o] > '9')) goto err;
n= a[o]-'0';
if (++o > l) goto err;
if ((a[o] < '0') || (a[o] > '9')) goto err;
n=(n*10)+ a[o]-'0';
if (++o > l) goto err;
if ((n < min[i]) || (n > max[i])) goto err;
}
if (a[o] == 'Z')
o++;
else if ((a[o] == '+') || (a[o] == '-'))
{
o++;
if (o+4 > l) goto err;
for (i=6; i<8; i++)
{
if ((a[o] < '0') || (a[o] > '9')) goto err;
n= a[o]-'0';
o++;
if ((a[o] < '0') || (a[o] > '9')) goto err;
n=(n*10)+ a[o]-'0';
if ((n < min[i]) || (n > max[i])) goto err;
o++;
}
}
return(o == l);
err:
return(0);
}
int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str)
{
ASN1_UTCTIME t;
t.type=V_ASN1_UTCTIME;
t.length=strlen(str);
t.data=(unsigned char *)str;
if (ASN1_UTCTIME_check(&t))
{
if (s != NULL)
{
if (!ASN1_STRING_set((ASN1_STRING *)s,
(unsigned char *)str,t.length))
return 0;
s->type = V_ASN1_UTCTIME;
}
return(1);
}
else
return(0);
}
ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t)
{
char *p;
struct tm *ts;
struct tm data;
size_t len = 20;
if (s == NULL)
s=M_ASN1_UTCTIME_new();
if (s == NULL)
return(NULL);
ts=OPENSSL_gmtime(&t, &data);
if (ts == NULL)
return(NULL);
p=(char *)s->data;
if ((p == NULL) || ((size_t)s->length < len))
{
p=OPENSSL_malloc(len);
if (p == NULL)
{
ASN1err(ASN1_F_ASN1_UTCTIME_SET,ERR_R_MALLOC_FAILURE);
return(NULL);
}
if (s->data != NULL)
OPENSSL_free(s->data);
s->data=(unsigned char *)p;
}
BIO_snprintf(p,len,"%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100,
ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec);
s->length=strlen(p);
s->type=V_ASN1_UTCTIME;
#ifdef CHARSET_EBCDIC_not
ebcdic2ascii(s->data, s->data, s->length);
#endif
return(s);
}
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t)
{
struct tm *tm;
struct tm data;
int offset;
int year;
#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
if (s->data[12] == 'Z')
offset=0;
else
{
offset = g2(s->data+13)*60+g2(s->data+15);
if (s->data[12] == '-')
offset = -offset;
}
t -= offset*60; /* FIXME: may overflow in extreme cases */
tm = OPENSSL_gmtime(&t, &data);
#define return_cmp(a,b) if ((a)<(b)) return -1; else if ((a)>(b)) return 1
year = g2(s->data);
if (year < 50)
year += 100;
return_cmp(year, tm->tm_year);
return_cmp(g2(s->data+2) - 1, tm->tm_mon);
return_cmp(g2(s->data+4), tm->tm_mday);
return_cmp(g2(s->data+6), tm->tm_hour);
return_cmp(g2(s->data+8), tm->tm_min);
return_cmp(g2(s->data+10), tm->tm_sec);
#undef g2
#undef return_cmp
return 0;
}
#if 0
time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s)
{
struct tm tm;
int offset;
memset(&tm,'\0',sizeof tm);
#define g2(p) (((p)[0]-'0')*10+(p)[1]-'0')
tm.tm_year=g2(s->data);
if(tm.tm_year < 50)
tm.tm_year+=100;
tm.tm_mon=g2(s->data+2)-1;
tm.tm_mday=g2(s->data+4);
tm.tm_hour=g2(s->data+6);
tm.tm_min=g2(s->data+8);
tm.tm_sec=g2(s->data+10);
if(s->data[12] == 'Z')
offset=0;
else
{
offset=g2(s->data+13)*60+g2(s->data+15);
if(s->data[12] == '-')
offset= -offset;
}
#undef g2
return mktime(&tm)-offset*60; /* FIXME: mktime assumes the current timezone
* instead of UTC, and unless we rewrite OpenSSL
* in Lisp we cannot locally change the timezone
* without possibly interfering with other parts
* of the program. timegm, which uses UTC, is
* non-standard.
* Also time_t is inappropriate for general
* UTC times because it may a 32 bit type. */
}
#endif
| apache-2.0 |
Salat-Cx65/python-for-android | python-build/openssl/crypto/ecdsa/ecs_lib.c | 183 | 6862 | /* crypto/ecdsa/ecs_lib.c */
/* ====================================================================
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <string.h>
#include "ecs_locl.h"
#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#endif
#include <openssl/err.h>
#include <openssl/bn.h>
const char ECDSA_version[]="ECDSA" OPENSSL_VERSION_PTEXT;
static const ECDSA_METHOD *default_ECDSA_method = NULL;
static void *ecdsa_data_new(void);
static void *ecdsa_data_dup(void *);
static void ecdsa_data_free(void *);
void ECDSA_set_default_method(const ECDSA_METHOD *meth)
{
default_ECDSA_method = meth;
}
const ECDSA_METHOD *ECDSA_get_default_method(void)
{
if(!default_ECDSA_method)
default_ECDSA_method = ECDSA_OpenSSL();
return default_ECDSA_method;
}
int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth)
{
const ECDSA_METHOD *mtmp;
ECDSA_DATA *ecdsa;
ecdsa = ecdsa_check(eckey);
if (ecdsa == NULL)
return 0;
mtmp = ecdsa->meth;
#ifndef OPENSSL_NO_ENGINE
if (ecdsa->engine)
{
ENGINE_finish(ecdsa->engine);
ecdsa->engine = NULL;
}
#endif
ecdsa->meth = meth;
return 1;
}
static ECDSA_DATA *ECDSA_DATA_new_method(ENGINE *engine)
{
ECDSA_DATA *ret;
ret=(ECDSA_DATA *)OPENSSL_malloc(sizeof(ECDSA_DATA));
if (ret == NULL)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
return(NULL);
}
ret->init = NULL;
ret->meth = ECDSA_get_default_method();
ret->engine = engine;
#ifndef OPENSSL_NO_ENGINE
if (!ret->engine)
ret->engine = ENGINE_get_default_ECDSA();
if (ret->engine)
{
ret->meth = ENGINE_get_ECDSA(ret->engine);
if (!ret->meth)
{
ECDSAerr(ECDSA_F_ECDSA_DATA_NEW_METHOD, ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
OPENSSL_free(ret);
return NULL;
}
}
#endif
ret->flags = ret->meth->flags;
CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
#if 0
if ((ret->meth->init != NULL) && !ret->meth->init(ret))
{
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, ret, &ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
#endif
return(ret);
}
static void *ecdsa_data_new(void)
{
return (void *)ECDSA_DATA_new_method(NULL);
}
static void *ecdsa_data_dup(void *data)
{
ECDSA_DATA *r = (ECDSA_DATA *)data;
/* XXX: dummy operation */
if (r == NULL)
return NULL;
return ecdsa_data_new();
}
static void ecdsa_data_free(void *data)
{
ECDSA_DATA *r = (ECDSA_DATA *)data;
#ifndef OPENSSL_NO_ENGINE
if (r->engine)
ENGINE_finish(r->engine);
#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ECDSA, r, &r->ex_data);
OPENSSL_cleanse((void *)r, sizeof(ECDSA_DATA));
OPENSSL_free(r);
}
ECDSA_DATA *ecdsa_check(EC_KEY *key)
{
ECDSA_DATA *ecdsa_data;
void *data = EC_KEY_get_key_method_data(key, ecdsa_data_dup,
ecdsa_data_free, ecdsa_data_free);
if (data == NULL)
{
ecdsa_data = (ECDSA_DATA *)ecdsa_data_new();
if (ecdsa_data == NULL)
return NULL;
EC_KEY_insert_key_method_data(key, (void *)ecdsa_data,
ecdsa_data_dup, ecdsa_data_free, ecdsa_data_free);
}
else
ecdsa_data = (ECDSA_DATA *)data;
return ecdsa_data;
}
int ECDSA_size(const EC_KEY *r)
{
int ret,i;
ASN1_INTEGER bs;
BIGNUM *order=NULL;
unsigned char buf[4];
const EC_GROUP *group;
if (r == NULL)
return 0;
group = EC_KEY_get0_group(r);
if (group == NULL)
return 0;
if ((order = BN_new()) == NULL) return 0;
if (!EC_GROUP_get_order(group,order,NULL))
{
BN_clear_free(order);
return 0;
}
i=BN_num_bits(order);
bs.length=(i+7)/8;
bs.data=buf;
bs.type=V_ASN1_INTEGER;
/* If the top bit is set the asn1 encoding is 1 larger. */
buf[0]=0xff;
i=i2d_ASN1_INTEGER(&bs,NULL);
i+=i; /* r and s */
ret=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
BN_clear_free(order);
return(ret);
}
int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_ECDSA, argl, argp,
new_func, dup_func, free_func);
}
int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg)
{
ECDSA_DATA *ecdsa;
ecdsa = ecdsa_check(d);
if (ecdsa == NULL)
return 0;
return(CRYPTO_set_ex_data(&ecdsa->ex_data,idx,arg));
}
void *ECDSA_get_ex_data(EC_KEY *d, int idx)
{
ECDSA_DATA *ecdsa;
ecdsa = ecdsa_check(d);
if (ecdsa == NULL)
return NULL;
return(CRYPTO_get_ex_data(&ecdsa->ex_data,idx));
}
| apache-2.0 |
larks/mbed | libraries/USBHost/USBHost/TARGET_RENESAS/TARGET_RZ_A1H/usb0/src/common/usb0_host_dma.c | 200 | 12791 | /*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
/*******************************************************************************
* File Name : usb0_host_dma.c
* $Rev: 1116 $
* $Date:: 2014-07-09 16:29:19 +0900#$
* Device(s) : RZ/A1H
* Tool-Chain :
* OS : None
* H/W Platform :
* Description : RZ/A1H R7S72100 USB Sample Program
* Operation :
* Limitations :
*******************************************************************************/
/*******************************************************************************
Includes <System Includes> , "Project Includes"
*******************************************************************************/
#include "usb0_host.h"
/* #include "usb0_host_dmacdrv.h" */
/*******************************************************************************
Typedef definitions
*******************************************************************************/
/*******************************************************************************
Macro definitions
*******************************************************************************/
/*******************************************************************************
Imported global variables and functions (from other files)
*******************************************************************************/
/*******************************************************************************
Exported global variables and functions (to be accessed by other files)
*******************************************************************************/
/*******************************************************************************
Private global variables and functions
*******************************************************************************/
static void usb0_host_dmaint(uint16_t fifo);
static void usb0_host_dmaint_buf2fifo(uint16_t pipe);
static void usb0_host_dmaint_fifo2buf(uint16_t pipe);
/*******************************************************************************
* Function Name: usb0_host_dma_stop_d0
* Description : D0FIFO DMA stop
* Arguments : uint16_t pipe : pipe number
* : uint32_t remain : transfer byte
* Return Value : none
*******************************************************************************/
void usb0_host_dma_stop_d0 (uint16_t pipe, uint32_t remain)
{
uint16_t dtln;
uint16_t dfacc;
uint16_t buffer;
uint16_t sds_b = 1;
dfacc = RZA_IO_RegRead_16(&USB200.D0FBCFG,
USB_DnFBCFG_DFACC_SHIFT,
USB_DnFBCFG_DFACC);
if (dfacc == 2)
{
sds_b = 32;
}
else if (dfacc == 1)
{
sds_b = 16;
}
else
{
if (g_usb0_host_DmaInfo[USB_HOST_D0FIFO].size == 2)
{
sds_b = 4;
}
else if (g_usb0_host_DmaInfo[USB_HOST_D0FIFO].size == 1)
{
sds_b = 2;
}
else
{
sds_b = 1;
}
}
if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 1)
{
if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
{
buffer = USB200.D0FIFOCTR;
dtln = (buffer & USB_HOST_BITDTLN);
if ((dtln % sds_b) != 0)
{
remain += (sds_b - (dtln % sds_b));
}
g_usb0_host_PipeDataSize[pipe] = (g_usb0_host_data_count[pipe] - remain);
g_usb0_host_data_count[pipe] = remain;
}
}
RZA_IO_RegWrite_16(&USB200.D0FIFOSEL,
0,
USB_DnFIFOSEL_DREQE_SHIFT,
USB_DnFIFOSEL_DREQE);
}
/*******************************************************************************
* Function Name: usb0_host_dma_stop_d1
* Description : D1FIFO DMA stop
* Arguments : uint16_t pipe : pipe number
* : uint32_t remain : transfer byte
* Return Value : none
*******************************************************************************/
void usb0_host_dma_stop_d1 (uint16_t pipe, uint32_t remain)
{
uint16_t dtln;
uint16_t dfacc;
uint16_t buffer;
uint16_t sds_b = 1;
dfacc = RZA_IO_RegRead_16(&USB200.D1FBCFG,
USB_DnFBCFG_DFACC_SHIFT,
USB_DnFBCFG_DFACC);
if (dfacc == 2)
{
sds_b = 32;
}
else if (dfacc == 1)
{
sds_b = 16;
}
else
{
if (g_usb0_host_DmaInfo[USB_HOST_D1FIFO].size == 2)
{
sds_b = 4;
}
else if (g_usb0_host_DmaInfo[USB_HOST_D1FIFO].size == 1)
{
sds_b = 2;
}
else
{
sds_b = 1;
}
}
if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 1)
{
if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
{
buffer = USB200.D1FIFOCTR;
dtln = (buffer & USB_HOST_BITDTLN);
if ((dtln % sds_b) != 0)
{
remain += (sds_b - (dtln % sds_b));
}
g_usb0_host_PipeDataSize[pipe] = (g_usb0_host_data_count[pipe] - remain);
g_usb0_host_data_count[pipe] = remain;
}
}
RZA_IO_RegWrite_16(&USB200.D1FIFOSEL,
0,
USB_DnFIFOSEL_DREQE_SHIFT,
USB_DnFIFOSEL_DREQE);
}
/*******************************************************************************
* Function Name: usb0_host_dma_interrupt_d0fifo
* Description : This function is DMA interrupt handler entry.
* : Execute usb1_host_dmaint() after disabling DMA interrupt in this function.
* : Disable DMA interrupt to DMAC executed when USB_HOST_D0FIFO_DMA is
* : specified by dma->fifo.
* : Register this function as DMA complete interrupt.
* Arguments : uint32_t int_sense ; Interrupts detection mode
* : ; INTC_LEVEL_SENSITIVE : Level sense
* : ; INTC_EDGE_TRIGGER : Edge trigger
* Return Value : none
*******************************************************************************/
void usb0_host_dma_interrupt_d0fifo (uint32_t int_sense)
{
usb0_host_dmaint(USB_HOST_D0FIFO);
g_usb0_host_DmaStatus[USB_HOST_D0FIFO] = USB_HOST_DMA_READY;
}
/*******************************************************************************
* Function Name: usb0_host_dma_interrupt_d1fifo
* Description : This function is DMA interrupt handler entry.
* : Execute usb0_host_dmaint() after disabling DMA interrupt in this function.
* : Disable DMA interrupt to DMAC executed when USB_HOST_D1FIFO_DMA is
* : specified by dma->fifo.
* : Register this function as DMA complete interrupt.
* Arguments : uint32_t int_sense ; Interrupts detection mode
* : ; INTC_LEVEL_SENSITIVE : Level sense
* : ; INTC_EDGE_TRIGGER : Edge trigger
* Return Value : none
*******************************************************************************/
void usb0_host_dma_interrupt_d1fifo (uint32_t int_sense)
{
usb0_host_dmaint(USB_HOST_D1FIFO);
g_usb0_host_DmaStatus[USB_HOST_D1FIFO] = USB_HOST_DMA_READY;
}
/*******************************************************************************
* Function Name: usb0_host_dmaint
* Description : This function is DMA transfer end interrupt
* Arguments : uint16_t fifo ; fifo number
* : ; USB_HOST_D0FIFO
* : ; USB_HOST_D1FIFO
* Return Value : none
*******************************************************************************/
static void usb0_host_dmaint (uint16_t fifo)
{
uint16_t pipe;
pipe = g_usb0_host_DmaPipe[fifo];
if (g_usb0_host_DmaInfo[fifo].dir == USB_HOST_BUF2FIFO)
{
usb0_host_dmaint_buf2fifo(pipe);
}
else
{
usb0_host_dmaint_fifo2buf(pipe);
}
}
/*******************************************************************************
* Function Name: usb0_host_dmaint_fifo2buf
* Description : Executes read completion from FIFO by DMAC.
* Arguments : uint16_t pipe : pipe number
* Return Value : none
*******************************************************************************/
static void usb0_host_dmaint_fifo2buf (uint16_t pipe)
{
uint32_t remain;
uint16_t useport;
if (g_usb0_host_pipe_status[pipe] != USB_HOST_PIPE_DONE)
{
useport = (uint16_t)(g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE);
if (useport == USB_HOST_D0FIFO_DMA)
{
remain = Userdef_USB_usb0_host_stop_dma0();
usb0_host_dma_stop_d0(pipe, remain);
if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
{
if (g_usb0_host_DmaStatus[USB_HOST_D0FIFO] == USB_HOST_DMA_BUSYEND)
{
USB200.D0FIFOCTR = USB_HOST_BITBCLR;
g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
}
else
{
usb0_host_enable_brdy_int(pipe);
}
}
}
else
{
remain = Userdef_USB_usb0_host_stop_dma1();
usb0_host_dma_stop_d1(pipe, remain);
if (RZA_IO_RegRead_16(&g_usb0_host_pipecfg[pipe], USB_PIPECFG_BFRE_SHIFT, USB_PIPECFG_BFRE) == 0)
{
if (g_usb0_host_DmaStatus[USB_HOST_D1FIFO] == USB_HOST_DMA_BUSYEND)
{
USB200.D1FIFOCTR = USB_HOST_BITBCLR;
g_usb0_host_pipe_status[pipe] = USB_HOST_PIPE_DONE;
}
else
{
usb0_host_enable_brdy_int(pipe);
}
}
}
}
}
/*******************************************************************************
* Function Name: usb0_host_dmaint_buf2fifo
* Description : Executes write completion in FIFO by DMAC.
* Arguments : uint16_t pipe : pipe number
* Return Value : none
*******************************************************************************/
static void usb0_host_dmaint_buf2fifo (uint16_t pipe)
{
uint16_t useport;
uint32_t remain;
useport = (uint16_t)(g_usb0_host_PipeTbl[pipe] & USB_HOST_FIFO_USE);
if (useport == USB_HOST_D0FIFO_DMA)
{
remain = Userdef_USB_usb0_host_stop_dma0();
usb0_host_dma_stop_d0(pipe, remain);
if (g_usb0_host_DmaBval[USB_HOST_D0FIFO] != 0)
{
RZA_IO_RegWrite_16(&USB200.D0FIFOCTR,
1,
USB_DnFIFOCTR_BVAL_SHIFT,
USB_DnFIFOCTR_BVAL);
}
}
else
{
remain = Userdef_USB_usb0_host_stop_dma1();
usb0_host_dma_stop_d1(pipe, remain);
if (g_usb0_host_DmaBval[USB_HOST_D1FIFO] != 0)
{
RZA_IO_RegWrite_16(&USB200.D1FIFOCTR,
1,
USB_DnFIFOCTR_BVAL_SHIFT,
USB_DnFIFOCTR_BVAL);
}
}
usb0_host_enable_bemp_int(pipe);
}
/* End of File */
| apache-2.0 |
Ant-Droid/android_kernel_moto_shamu_OLD | drivers/staging/rtl8712/xmit_linux.c | 2300 | 5402 | /******************************************************************************
* xmit_linux.c
*
* Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
* Linux device driver for RTL8192SU
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* 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, USA
*
* Modifications for inclusion into the Linux staging tree are
* Copyright(c) 2010 Larry Finger. All rights reserved.
*
* Contact information:
* WLAN FAE <wlanfae@realtek.com>
* Larry Finger <Larry.Finger@lwfinger.net>
*
******************************************************************************/
#define _XMIT_OSDEP_C_
#include <linux/usb.h>
#include <linux/ip.h>
#include <linux/if_ether.h>
#include "osdep_service.h"
#include "drv_types.h"
#include "wifi.h"
#include "mlme_osdep.h"
#include "xmit_osdep.h"
#include "osdep_intf.h"
static uint remainder_len(struct pkt_file *pfile)
{
return (uint)(pfile->buf_len - ((addr_t)(pfile->cur_addr) -
(addr_t)(pfile->buf_start)));
}
void _r8712_open_pktfile(_pkt *pktptr, struct pkt_file *pfile)
{
pfile->pkt = pktptr;
pfile->cur_addr = pfile->buf_start = pktptr->data;
pfile->pkt_len = pfile->buf_len = pktptr->len;
pfile->cur_buffer = pfile->buf_start ;
}
uint _r8712_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
{
uint len;
len = remainder_len(pfile);
len = (rlen > len) ? len : rlen;
if (rmem)
skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len,
rmem, len);
pfile->cur_addr += len;
pfile->pkt_len -= len;
return len;
}
sint r8712_endofpktfile(struct pkt_file *pfile)
{
if (pfile->pkt_len == 0)
return true;
else
return false;
}
void r8712_set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
{
int i;
struct ethhdr etherhdr;
struct iphdr ip_hdr;
u16 UserPriority = 0;
_r8712_open_pktfile(ppktfile->pkt, ppktfile);
_r8712_pktfile_read(ppktfile, (unsigned char *)ðerhdr, ETH_HLEN);
/* get UserPriority from IP hdr*/
if (pattrib->ether_type == 0x0800) {
i = _r8712_pktfile_read(ppktfile, (u8 *)&ip_hdr,
sizeof(ip_hdr));
/*UserPriority = (ntohs(ip_hdr.tos) >> 5) & 0x3 ;*/
UserPriority = ip_hdr.tos >> 5;
} else {
/* "When priority processing of data frames is supported,
* a STA's SME should send EAPOL-Key frames at the highest
* priority." */
if (pattrib->ether_type == 0x888e)
UserPriority = 7;
}
pattrib->priority = UserPriority;
pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN;
pattrib->subtype = WIFI_QOS_DATA_TYPE;
}
void r8712_SetFilter(struct work_struct *work)
{
struct _adapter *padapter = container_of(work, struct _adapter,
wkFilterRxFF0);
u8 oldvalue = 0x00, newvalue = 0x00;
unsigned long irqL;
oldvalue = r8712_read8(padapter, 0x117);
newvalue = oldvalue & 0xfe;
r8712_write8(padapter, 0x117, newvalue);
spin_lock_irqsave(&padapter->lockRxFF0Filter, irqL);
padapter->blnEnableRxFF0Filter = 1;
spin_unlock_irqrestore(&padapter->lockRxFF0Filter, irqL);
do {
msleep(100);
} while (padapter->blnEnableRxFF0Filter == 1);
r8712_write8(padapter, 0x117, oldvalue);
}
int r8712_xmit_resource_alloc(struct _adapter *padapter,
struct xmit_buf *pxmitbuf)
{
int i;
for (i = 0; i < 8; i++) {
pxmitbuf->pxmit_urb[i] = usb_alloc_urb(0, GFP_KERNEL);
if (pxmitbuf->pxmit_urb[i] == NULL) {
netdev_err(padapter->pnetdev, "pxmitbuf->pxmit_urb[i] == NULL\n");
return _FAIL;
}
}
return _SUCCESS;
}
void r8712_xmit_resource_free(struct _adapter *padapter,
struct xmit_buf *pxmitbuf)
{
int i;
for (i = 0; i < 8; i++) {
if (pxmitbuf->pxmit_urb[i]) {
usb_kill_urb(pxmitbuf->pxmit_urb[i]);
usb_free_urb(pxmitbuf->pxmit_urb[i]);
}
}
}
void r8712_xmit_complete(struct _adapter *padapter, struct xmit_frame *pxframe)
{
if (pxframe->pkt)
dev_kfree_skb_any(pxframe->pkt);
pxframe->pkt = NULL;
}
int r8712_xmit_entry(_pkt *pkt, struct net_device *pnetdev)
{
struct xmit_frame *pxmitframe = NULL;
struct _adapter *padapter = (struct _adapter *)netdev_priv(pnetdev);
struct xmit_priv *pxmitpriv = &(padapter->xmitpriv);
int ret = 0;
if (r8712_if_up(padapter) == false) {
ret = 0;
goto _xmit_entry_drop;
}
pxmitframe = r8712_alloc_xmitframe(pxmitpriv);
if (pxmitframe == NULL) {
ret = 0;
goto _xmit_entry_drop;
}
if ((!r8712_update_attrib(padapter, pkt, &pxmitframe->attrib))) {
ret = 0;
goto _xmit_entry_drop;
}
padapter->ledpriv.LedControlHandler(padapter, LED_CTL_TX);
pxmitframe->pkt = pkt;
if (r8712_pre_xmit(padapter, pxmitframe) == true) {
/*dump xmitframe directly or drop xframe*/
dev_kfree_skb_any(pkt);
pxmitframe->pkt = NULL;
}
pxmitpriv->tx_pkts++;
pxmitpriv->tx_bytes += pxmitframe->attrib.last_txcmdsz;
return ret;
_xmit_entry_drop:
if (pxmitframe)
r8712_free_xmitframe(pxmitpriv, pxmitframe);
pxmitpriv->tx_drop++;
dev_kfree_skb_any(pkt);
return ret;
}
| apache-2.0 |
erasoni/clipdiff | clipdiff/LVInfo.cpp | 1 | 1615 | //Copyright (C) 2017 Ambiesoft All rights reserved.
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions
//are met:
//1. Redistributions of source code must retain the above copyright
//notice, this list of conditions and the following disclaimer.
//2. Redistributions in binary form must reproduce the above copyright
//notice, this list of conditions and the following disclaimer in the
//documentation and/or other materials provided with the distribution.
//
//THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
//ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
//IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
//ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
//FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
//DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
//OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
//OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
//SUCH DAMAGE.
#include "StdAfx.h"
#include "LVInfo.h"
#include "DiffList.h"
namespace clipdiff {
LVInfo::LVInfo()
{
df_ = gcnew DiffList(String::Empty);
}
DiffList^ LVInfo::Diff::get()
{
return df_;
}
void LVInfo::Diff::set(DiffList^ dl)
{
df_ = dl;
}
} | bsd-2-clause |
dpt/PrivateEye | libs/appengine/graphics/sprite-effects/expand.c | 1 | 2178 | /* --------------------------------------------------------------------------
* Name: expand.c
* Purpose: Expand dynamic range
* ----------------------------------------------------------------------- */
#include <stdio.h>
#include <string.h>
#include "oslib/osspriteop.h"
#include "appengine/base/errors.h"
#include "appengine/vdu/sprite.h"
#include "appengine/graphics/sprite-effects.h"
/* FIXME: Threshold should use a percentage rather than literal count. */
result_t effects_expand_apply(osspriteop_area *area,
osspriteop_header *src,
osspriteop_header *dst,
unsigned int threshold)
{
result_t err;
sprite_histograms hists;
int min;
int max;
int i;
int j;
sprite_luts luts;
int nbins;
double v;
unsigned char *l;
err = sprite_get_histograms(area, src, &hists);
if (err)
return err;
/* find the minima and maxima for all of the R,G,B histograms */
min = 255;
max = 0;
for (i = 0; i < 3; i++)
{
unsigned int *h;
h = &hists.h[i + 1].v[0]; /* i+1 to skip initial luma hist */
for (j = 0; j < 256; j++)
if (h[j] > threshold)
break;
if (j < min)
min = j;
for (j = 255; j >= 0; j--)
if (h[j] > threshold)
break;
if (j > max)
max = j;
}
if ((min == 0 && max == 255) || (min == max))
goto copy_only;
memset(&luts.l[0], 0, sizeof(luts.l[0]));
nbins = max + 1 - min;
v = 255.0 / (nbins - 1.0);
/* min,max are indices of the first,last non-zero buckets */
l = &luts.l[0].v[min];
for (j = 0; j < nbins; j++)
l[j] = (int) (v * j);
memcpy(&luts.l[1], &luts.l[0], sizeof(luts.l[0]));
memcpy(&luts.l[2], &luts.l[0], sizeof(luts.l[0]));
if (0)
{
for (j = 0; j < 256; j++)
fprintf(stderr, "%d:%d\n", j, luts.l[0].v[j]);
}
err = sprite_remap(area, src, dst, &luts);
if (err)
return err;
return result_OK;
copy_only:
memcpy(sprite_data(dst), sprite_data(src), sprite_data_bytes(src));
return result_OK;
}
| bsd-2-clause |
inviwo/inviwo | modules/example/src/examplemodule.cpp | 1 | 2389 | /*********************************************************************************
*
* Inviwo - Interactive Visualization Workshop
*
* Copyright (c) 2013-2022 Inviwo Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*********************************************************************************/
#include <modules/example/examplemodule.h>
#include <modules/example/exampleprocessor.h>
#include <modules/example/exampleprogressbar.h>
#include <modules/example/processors/simpleraycaster.h>
#include <modules/opengl/shader/shadermanager.h>
// Autogenerated
#include <modules/example/shader_resources.h>
namespace inviwo {
ExampleModule::ExampleModule(InviwoApplication* app) : InviwoModule(app, "Example") {
// Add a directory to the search path of the Shadermanager
ShaderManager::getPtr()->addShaderSearchPath(getPath(ModulePath::GLSL));
// Register objects that can be shared with the rest of inviwo here:
// Processors
registerProcessor<ExampleProcessor>();
registerProcessor<ExampleProgressBar>();
registerProcessor<SimpleRaycaster>();
}
} // namespace inviwo
| bsd-2-clause |
dplbsd/zcaplib | head/lib/libz/gzlib.c | 2 | 16520 | /* gzlib.c -- zlib functions common to reading and writing gzip files
* Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* $FreeBSD: soc2013/dpl/head/lib/libz/gzlib.c 257259 2013-09-13 06:41:29Z dpl $ */
#include "gzguts.h"
#include "zutil.h"
#if defined(_WIN32) && !defined(__BORLANDC__)
# define LSEEK _lseeki64
#else
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
# define LSEEK lseek64
#else
# define LSEEK lseek
#endif
#endif
/* Local functions */
local void gz_reset OF((gz_statep));
local gzFile gz_open OF((const void *, int, const char *));
#if defined UNDER_CE
/* Map the Windows error number in ERROR to a locale-dependent error message
string and return a pointer to it. Typically, the values for ERROR come
from GetLastError.
The string pointed to shall not be modified by the application, but may be
overwritten by a subsequent call to gz_strwinerror
The gz_strwinerror function does not change the current setting of
GetLastError. */
char ZLIB_INTERNAL *gz_strwinerror (error)
DWORD error;
{
static char buf[1024];
wchar_t *msgbuf;
DWORD lasterr = GetLastError();
DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER,
NULL,
error,
0, /* Default language */
(LPVOID)&msgbuf,
0,
NULL);
if (chars != 0) {
/* If there is an \r\n appended, zap it. */
if (chars >= 2
&& msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
chars -= 2;
msgbuf[chars] = 0;
}
if (chars > sizeof (buf) - 1) {
chars = sizeof (buf) - 1;
msgbuf[chars] = 0;
}
wcstombs(buf, msgbuf, chars + 1);
LocalFree(msgbuf);
}
else {
sprintf(buf, "unknown win32 error (%ld)", error);
}
SetLastError(lasterr);
return buf;
}
#endif /* UNDER_CE */
/* Reset gzip file state */
local void gz_reset(state)
gz_statep state;
{
state->x.have = 0; /* no output data available */
if (state->mode == GZ_READ) { /* for reading ... */
state->eof = 0; /* not at end of file */
state->past = 0; /* have not read past end yet */
state->how = LOOK; /* look for gzip header */
}
state->seek = 0; /* no seek request pending */
gz_error(state, Z_OK, NULL); /* clear error */
state->x.pos = 0; /* no uncompressed data yet */
state->strm.avail_in = 0; /* no input data yet */
}
/* Open a gzip file either by name or file descriptor. */
local gzFile gz_open(path, fd, mode)
const void *path;
int fd;
const char *mode;
{
gz_statep state;
size_t len;
int oflag;
#ifdef O_CLOEXEC
int cloexec = 0;
#endif
#ifdef O_EXCL
int exclusive = 0;
#endif
/* check input */
if (path == NULL)
return NULL;
/* allocate gzFile structure to return */
state = (gz_statep)malloc(sizeof(gz_state));
if (state == NULL)
return NULL;
state->size = 0; /* no buffers allocated yet */
state->want = GZBUFSIZE; /* requested buffer size */
state->msg = NULL; /* no error message yet */
/* interpret mode */
state->mode = GZ_NONE;
state->level = Z_DEFAULT_COMPRESSION;
state->strategy = Z_DEFAULT_STRATEGY;
state->direct = 0;
while (*mode) {
if (*mode >= '0' && *mode <= '9')
state->level = *mode - '0';
else
switch (*mode) {
case 'r':
state->mode = GZ_READ;
break;
#ifndef NO_GZCOMPRESS
case 'w':
state->mode = GZ_WRITE;
break;
case 'a':
state->mode = GZ_APPEND;
break;
#endif
case '+': /* can't read and write at the same time */
free(state);
return NULL;
case 'b': /* ignore -- will request binary anyway */
break;
#ifdef O_CLOEXEC
case 'e':
cloexec = 1;
break;
#endif
#ifdef O_EXCL
case 'x':
exclusive = 1;
break;
#endif
case 'f':
state->strategy = Z_FILTERED;
break;
case 'h':
state->strategy = Z_HUFFMAN_ONLY;
break;
case 'R':
state->strategy = Z_RLE;
break;
case 'F':
state->strategy = Z_FIXED;
break;
case 'T':
state->direct = 1;
break;
default: /* could consider as an error, but just ignore */
;
}
mode++;
}
/* must provide an "r", "w", or "a" */
if (state->mode == GZ_NONE) {
free(state);
return NULL;
}
/* can't force transparent read */
if (state->mode == GZ_READ) {
if (state->direct) {
free(state);
return NULL;
}
state->direct = 1; /* for empty file */
}
/* save the path name for error messages */
#ifdef _WIN32
if (fd == -2) {
len = wcstombs(NULL, path, 0);
if (len == (size_t)-1)
len = 0;
}
else
#endif
len = strlen((const char *)path);
state->path = (char *)malloc(len + 1);
if (state->path == NULL) {
free(state);
return NULL;
}
#ifdef _WIN32
if (fd == -2)
if (len)
wcstombs(state->path, path, len + 1);
else
*(state->path) = 0;
else
#endif
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->path, len + 1, "%s", (const char *)path);
#else
strcpy(state->path, path);
#endif
/* compute the flags for open() */
oflag =
#ifdef O_LARGEFILE
O_LARGEFILE |
#endif
#ifdef O_BINARY
O_BINARY |
#endif
#ifdef O_CLOEXEC
(cloexec ? O_CLOEXEC : 0) |
#endif
(state->mode == GZ_READ ?
O_RDONLY :
(O_WRONLY | O_CREAT |
#ifdef O_EXCL
(exclusive ? O_EXCL : 0) |
#endif
(state->mode == GZ_WRITE ?
O_TRUNC :
O_APPEND)));
/* open the file with the appropriate flags (or just use fd) */
state->fd = fd > -1 ? fd : (
#ifdef _WIN32
fd == -2 ? _wopen(path, oflag, 0666) :
#endif
open((const char *)path, oflag, 0666));
if (state->fd == -1) {
free(state->path);
free(state);
return NULL;
}
if (state->mode == GZ_APPEND)
state->mode = GZ_WRITE; /* simplify later checks */
/* save the current position for rewinding (only if reading) */
if (state->mode == GZ_READ) {
state->start = LSEEK(state->fd, 0, SEEK_CUR);
if (state->start == -1) state->start = 0;
}
/* initialize stream */
gz_reset(state);
/* return stream */
return (gzFile)state;
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen(path, mode)
const char *path;
const char *mode;
{
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzopen64(path, mode)
const char *path;
const char *mode;
{
return gz_open(path, -1, mode);
}
/* -- see zlib.h -- */
gzFile ZEXPORT gzdopen(fd, mode)
int fd;
const char *mode;
{
char *path; /* identifier for error messages */
gzFile gz;
if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
return NULL;
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); /* for debugging */
#else
sprintf(path, "<fd:%d>", fd); /* for debugging */
#endif
gz = gz_open(path, fd, mode);
free(path);
return gz;
}
/* -- see zlib.h -- */
#ifdef _WIN32
gzFile ZEXPORT gzopen_w(path, mode)
const wchar_t *path;
const char *mode;
{
return gz_open(path, -2, mode);
}
#endif
/* -- see zlib.h -- */
int ZEXPORT gzbuffer(file, size)
gzFile file;
unsigned size;
{
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return -1;
/* make sure we haven't already allocated memory */
if (state->size != 0)
return -1;
/* check and set requested size */
if (size < 2)
size = 2; /* need two bytes to check magic header */
state->want = size;
return 0;
}
/* -- see zlib.h -- */
int ZEXPORT gzrewind(file)
gzFile file;
{
gz_statep state;
/* get internal structure */
if (file == NULL)
return -1;
state = (gz_statep)file;
/* check that we're reading and that there's no error */
if (state->mode != GZ_READ ||
(state->err != Z_OK && state->err != Z_BUF_ERROR))
return -1;
/* back up and start over */
if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
return -1;
gz_reset(state);
return 0;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzseek64(file, offset, whence)
gzFile file;
z_off64_t offset;
int whence;
{
unsigned n;
z_off64_t ret;
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return -1;
/* check that there's no error */
if (state->err != Z_OK && state->err != Z_BUF_ERROR)
return -1;
/* can only seek from start or relative to current position */
if (whence != SEEK_SET && whence != SEEK_CUR)
return -1;
/* normalize offset to a SEEK_CUR specification */
if (whence == SEEK_SET)
offset -= state->x.pos;
else if (state->seek)
offset += state->skip;
state->seek = 0;
/* if within raw area while reading, just go there */
if (state->mode == GZ_READ && state->how == COPY &&
state->x.pos + offset >= 0) {
ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
if (ret == -1)
return -1;
state->x.have = 0;
state->eof = 0;
state->past = 0;
state->seek = 0;
gz_error(state, Z_OK, NULL);
state->strm.avail_in = 0;
state->x.pos += offset;
return state->x.pos;
}
/* calculate skip amount, rewinding if needed for back seek when reading */
if (offset < 0) {
if (state->mode != GZ_READ) /* writing -- can't go backwards */
return -1;
offset += state->x.pos;
if (offset < 0) /* before start of file! */
return -1;
if (gzrewind(file) == -1) /* rewind, then skip to offset */
return -1;
}
/* if reading, skip what's in output buffer (one less gzgetc() check) */
if (state->mode == GZ_READ) {
n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
(unsigned)offset : state->x.have;
state->x.have -= n;
state->x.next += n;
state->x.pos += n;
offset -= n;
}
/* request skip (if not zero) */
if (offset) {
state->seek = 1;
state->skip = offset;
}
return state->x.pos + offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzseek(file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
{
z_off64_t ret;
ret = gzseek64(file, (z_off64_t)offset, whence);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gztell64(file)
gzFile file;
{
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return -1;
/* return position */
return state->x.pos + (state->seek ? state->skip : 0);
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gztell(file)
gzFile file;
{
z_off64_t ret;
ret = gztell64(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
z_off64_t ZEXPORT gzoffset64(file)
gzFile file;
{
z_off64_t offset;
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return -1;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return -1;
/* compute and return effective offset in file */
offset = LSEEK(state->fd, 0, SEEK_CUR);
if (offset == -1)
return -1;
if (state->mode == GZ_READ) /* reading */
offset -= state->strm.avail_in; /* don't count buffered input */
return offset;
}
/* -- see zlib.h -- */
z_off_t ZEXPORT gzoffset(file)
gzFile file;
{
z_off64_t ret;
ret = gzoffset64(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
/* -- see zlib.h -- */
int ZEXPORT gzeof(file)
gzFile file;
{
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return 0;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return 0;
/* return end-of-file state */
return state->mode == GZ_READ ? state->past : 0;
}
/* -- see zlib.h -- */
const char * ZEXPORT gzerror(file, errnum)
gzFile file;
int *errnum;
{
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return NULL;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return NULL;
/* return error information */
if (errnum != NULL)
*errnum = state->err;
return state->err == Z_MEM_ERROR ? "out of memory" :
(state->msg == NULL ? "" : state->msg);
}
/* -- see zlib.h -- */
void ZEXPORT gzclearerr(file)
gzFile file;
{
gz_statep state;
/* get internal structure and check integrity */
if (file == NULL)
return;
state = (gz_statep)file;
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
return;
/* clear error and end-of-file */
if (state->mode == GZ_READ) {
state->eof = 0;
state->past = 0;
}
gz_error(state, Z_OK, NULL);
}
/* Create an error message in allocated memory and set state->err and
state->msg accordingly. Free any previous error message already there. Do
not try to free or allocate space if the error is Z_MEM_ERROR (out of
memory). Simply save the error message as a static string. If there is an
allocation failure constructing the error message, then convert the error to
out of memory. */
void ZLIB_INTERNAL gz_error(state, err, msg)
gz_statep state;
int err;
const char *msg;
{
/* free previously allocated message and clear */
if (state->msg != NULL) {
if (state->err != Z_MEM_ERROR)
free(state->msg);
state->msg = NULL;
}
/* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
if (err != Z_OK && err != Z_BUF_ERROR)
state->x.have = 0;
/* set error code, and if no message, then done */
state->err = err;
if (msg == NULL)
return;
/* for an out of memory error, return literal string when requested */
if (err == Z_MEM_ERROR)
return;
/* construct error message with path */
if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
NULL) {
state->err = Z_MEM_ERROR;
return;
}
#if !defined(NO_snprintf) && !defined(NO_vsnprintf)
snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
"%s%s%s", state->path, ": ", msg);
#else
strcpy(state->msg, state->path);
strcat(state->msg, ": ");
strcat(state->msg, msg);
#endif
return;
}
#ifndef INT_MAX
/* portably return maximum value for an int (when limits.h presumed not
available) -- we need to do this to cover cases where 2's complement not
used, since C standard permits 1's complement and sign-bit representations,
otherwise we could just use ((unsigned)-1) >> 1 */
unsigned ZLIB_INTERNAL gz_intmax()
{
unsigned p, q;
p = 1;
do {
q = p;
p <<= 1;
p++;
} while (p > q);
return q >> 1;
}
#endif
| bsd-2-clause |
Jetpie/open-linear | lib/eigen/test/product_small.cpp | 13 | 1876 | // This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#define EIGEN_NO_STATIC_ASSERT
#include "product.h"
#include <Eigen/LU>
// regression test for bug 447
void product1x1()
{
Matrix<float,1,3> matAstatic;
Matrix<float,3,1> matBstatic;
matAstatic.setRandom();
matBstatic.setRandom();
VERIFY_IS_APPROX( (matAstatic * matBstatic).coeff(0,0),
matAstatic.cwiseProduct(matBstatic.transpose()).sum() );
MatrixXf matAdynamic(1,3);
MatrixXf matBdynamic(3,1);
matAdynamic.setRandom();
matBdynamic.setRandom();
VERIFY_IS_APPROX( (matAdynamic * matBdynamic).coeff(0,0),
matAdynamic.cwiseProduct(matBdynamic.transpose()).sum() );
}
void test_product_small()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( product(Matrix<float, 3, 2>()) );
CALL_SUBTEST_2( product(Matrix<int, 3, 5>()) );
CALL_SUBTEST_3( product(Matrix3d()) );
CALL_SUBTEST_4( product(Matrix4d()) );
CALL_SUBTEST_5( product(Matrix4f()) );
CALL_SUBTEST_6( product1x1() );
}
#ifdef EIGEN_TEST_PART_6
{
// test compilation of (outer_product) * vector
Vector3f v = Vector3f::Random();
VERIFY_IS_APPROX( (v * v.transpose()) * v, (v * v.transpose()).eval() * v);
}
{
// regression test for pull-request #93
Eigen::Matrix<double, 1, 1> A; A.setRandom();
Eigen::Matrix<double, 18, 1> B; B.setRandom();
Eigen::Matrix<double, 1, 18> C; C.setRandom();
VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]);
VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C);
}
#endif
}
| bsd-2-clause |
tiantian20007/RakNet | DependentExtensions/cat/src/io/MMapFile.cpp | 26 | 3460 | /*
Copyright (c) 2009-2010 Christopher A. Taylor. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of LibCat nor the names of its contributors may be used
to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include <cat/io/MMapFile.hpp>
#include <cat/io/Logging.hpp>
using namespace cat;
#if defined(CAT_OS_LINUX)
# include <sys/mman.h>
# include <sys/stat.h>
# include <fcntl.h>
#endif
MMapFile::MMapFile(const char *path)
{
data = 0;
offset = 0;
len = 0;
#if defined(CAT_OS_LINUX)
fd = open(path, O_RDONLY);
if (fd == -1) { INANE("MMapFile") << "Unable to open file: " << path; return; }
struct stat st;
if (fstat(fd, &st) < 0) { INANE("MMapFile") << "Unable to stat file: " << path; return; }
len = st.st_size;
if (len == 0) return;
data = (char *)mmap(0, len, PROT_READ, MAP_SHARED, fd, 0);
if (data == MAP_FAILED) { INANE("MMapFile") << "Unable to mmap file: " << path; return; }
close(fd);
fd = -1;
#elif defined(CAT_OS_WINDOWS)
hMapping = hFile = 0;
hFile = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS, 0);
if (hFile == INVALID_HANDLE_VALUE) { INANE("MMapFile") << "Unable to open file: " << path; return; }
len = GetFileSize(hFile, 0);
if (len == -1) { INANE("MMapFile") << "Unable to stat file: " << path; return; }
if (len == 0) return;
hMapping = CreateFileMapping(hFile, 0, PAGE_READONLY, 0, 0, 0);
if (!hMapping) { INANE("MMapFile") << "Unable to CreateFileMapping[" << GetLastError() << "]: " << path; return; }
data = (char *)MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
if (!data) { INANE("MMapFile") << "Unable to MapViewOfFile[" << GetLastError() << "]: " << path; return; }
#endif
}
MMapFile::~MMapFile()
{
#if defined(CAT_OS_LINUX)
if (fd != -1) close(fd);
if (data) munmap(data, len);
#elif defined(CAT_OS_WINDOWS)
if (data) UnmapViewOfFile(data);
if (hMapping) CloseHandle(hMapping);
if (hFile) CloseHandle(hFile);
#endif
}
| bsd-2-clause |
chipitsine/nginx-1.4.4 | src/mail/ngx_mail_smtp_handler.c | 57 | 20626 |
/*
* Copyright (C) Igor Sysoev
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_mail.h>
#include <ngx_mail_smtp_module.h>
static void ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx);
static void ngx_mail_smtp_resolve_name(ngx_event_t *rev);
static void ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx);
static void ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c);
static void ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev);
static ngx_int_t ngx_mail_smtp_create_buffer(ngx_mail_session_t *s,
ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_helo(ngx_mail_session_t *s, ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_auth(ngx_mail_session_t *s, ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_mail(ngx_mail_session_t *s, ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_starttls(ngx_mail_session_t *s,
ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_rset(ngx_mail_session_t *s, ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_rcpt(ngx_mail_session_t *s, ngx_connection_t *c);
static ngx_int_t ngx_mail_smtp_discard_command(ngx_mail_session_t *s,
ngx_connection_t *c, char *err);
static void ngx_mail_smtp_log_rejected_command(ngx_mail_session_t *s,
ngx_connection_t *c, char *err);
static u_char smtp_ok[] = "250 2.0.0 OK" CRLF;
static u_char smtp_bye[] = "221 2.0.0 Bye" CRLF;
static u_char smtp_starttls[] = "220 2.0.0 Start TLS" CRLF;
static u_char smtp_next[] = "334 " CRLF;
static u_char smtp_username[] = "334 VXNlcm5hbWU6" CRLF;
static u_char smtp_password[] = "334 UGFzc3dvcmQ6" CRLF;
static u_char smtp_invalid_command[] = "500 5.5.1 Invalid command" CRLF;
static u_char smtp_invalid_pipelining[] =
"503 5.5.0 Improper use of SMTP command pipelining" CRLF;
static u_char smtp_invalid_argument[] = "501 5.5.4 Invalid argument" CRLF;
static u_char smtp_auth_required[] = "530 5.7.1 Authentication required" CRLF;
static u_char smtp_bad_sequence[] = "503 5.5.1 Bad sequence of commands" CRLF;
static ngx_str_t smtp_unavailable = ngx_string("[UNAVAILABLE]");
static ngx_str_t smtp_tempunavail = ngx_string("[TEMPUNAVAIL]");
void
ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
{
struct sockaddr_in *sin;
ngx_resolver_ctx_t *ctx;
ngx_mail_core_srv_conf_t *cscf;
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
if (cscf->resolver == NULL) {
s->host = smtp_unavailable;
ngx_mail_smtp_greeting(s, c);
return;
}
if (c->sockaddr->sa_family != AF_INET) {
s->host = smtp_tempunavail;
ngx_mail_smtp_greeting(s, c);
return;
}
c->log->action = "in resolving client address";
ctx = ngx_resolve_start(cscf->resolver, NULL);
if (ctx == NULL) {
ngx_mail_close_connection(c);
return;
}
/* AF_INET only */
sin = (struct sockaddr_in *) c->sockaddr;
ctx->addr = sin->sin_addr.s_addr;
ctx->handler = ngx_mail_smtp_resolve_addr_handler;
ctx->data = s;
ctx->timeout = cscf->resolver_timeout;
if (ngx_resolve_addr(ctx) != NGX_OK) {
ngx_mail_close_connection(c);
}
}
static void
ngx_mail_smtp_resolve_addr_handler(ngx_resolver_ctx_t *ctx)
{
ngx_connection_t *c;
ngx_mail_session_t *s;
s = ctx->data;
c = s->connection;
if (ctx->state) {
ngx_log_error(NGX_LOG_ERR, c->log, 0,
"%V could not be resolved (%i: %s)",
&c->addr_text, ctx->state,
ngx_resolver_strerror(ctx->state));
if (ctx->state == NGX_RESOLVE_NXDOMAIN) {
s->host = smtp_unavailable;
} else {
s->host = smtp_tempunavail;
}
ngx_resolve_addr_done(ctx);
ngx_mail_smtp_greeting(s, s->connection);
return;
}
c->log->action = "in resolving client hostname";
s->host.data = ngx_pstrdup(c->pool, &ctx->name);
if (s->host.data == NULL) {
ngx_resolve_addr_done(ctx);
ngx_mail_close_connection(c);
return;
}
s->host.len = ctx->name.len;
ngx_resolve_addr_done(ctx);
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"address resolved: %V", &s->host);
c->read->handler = ngx_mail_smtp_resolve_name;
ngx_post_event(c->read, &ngx_posted_events);
}
static void
ngx_mail_smtp_resolve_name(ngx_event_t *rev)
{
ngx_connection_t *c;
ngx_mail_session_t *s;
ngx_resolver_ctx_t *ctx;
ngx_mail_core_srv_conf_t *cscf;
c = rev->data;
s = c->data;
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
ctx = ngx_resolve_start(cscf->resolver, NULL);
if (ctx == NULL) {
ngx_mail_close_connection(c);
return;
}
ctx->name = s->host;
ctx->type = NGX_RESOLVE_A;
ctx->handler = ngx_mail_smtp_resolve_name_handler;
ctx->data = s;
ctx->timeout = cscf->resolver_timeout;
if (ngx_resolve_name(ctx) != NGX_OK) {
ngx_mail_close_connection(c);
}
}
static void
ngx_mail_smtp_resolve_name_handler(ngx_resolver_ctx_t *ctx)
{
in_addr_t addr;
ngx_uint_t i;
ngx_connection_t *c;
struct sockaddr_in *sin;
ngx_mail_session_t *s;
s = ctx->data;
c = s->connection;
if (ctx->state) {
ngx_log_error(NGX_LOG_ERR, c->log, 0,
"\"%V\" could not be resolved (%i: %s)",
&ctx->name, ctx->state,
ngx_resolver_strerror(ctx->state));
if (ctx->state == NGX_RESOLVE_NXDOMAIN) {
s->host = smtp_unavailable;
} else {
s->host = smtp_tempunavail;
}
} else {
/* AF_INET only */
sin = (struct sockaddr_in *) c->sockaddr;
for (i = 0; i < ctx->naddrs; i++) {
addr = ctx->addrs[i];
ngx_log_debug4(NGX_LOG_DEBUG_MAIL, c->log, 0,
"name was resolved to %ud.%ud.%ud.%ud",
(ntohl(addr) >> 24) & 0xff,
(ntohl(addr) >> 16) & 0xff,
(ntohl(addr) >> 8) & 0xff,
ntohl(addr) & 0xff);
if (addr == sin->sin_addr.s_addr) {
goto found;
}
}
s->host = smtp_unavailable;
}
found:
ngx_resolve_name_done(ctx);
ngx_mail_smtp_greeting(s, c);
}
static void
ngx_mail_smtp_greeting(ngx_mail_session_t *s, ngx_connection_t *c)
{
ngx_msec_t timeout;
ngx_mail_core_srv_conf_t *cscf;
ngx_mail_smtp_srv_conf_t *sscf;
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"smtp greeting for \"%V\"", &s->host);
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
timeout = sscf->greeting_delay ? sscf->greeting_delay : cscf->timeout;
ngx_add_timer(c->read, timeout);
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_close_connection(c);
}
if (sscf->greeting_delay) {
c->read->handler = ngx_mail_smtp_invalid_pipelining;
return;
}
c->read->handler = ngx_mail_smtp_init_protocol;
s->out = sscf->greeting;
ngx_mail_send(c->write);
}
static void
ngx_mail_smtp_invalid_pipelining(ngx_event_t *rev)
{
ngx_connection_t *c;
ngx_mail_session_t *s;
ngx_mail_core_srv_conf_t *cscf;
ngx_mail_smtp_srv_conf_t *sscf;
c = rev->data;
s = c->data;
c->log->action = "in delay pipelining state";
if (rev->timedout) {
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "delay greeting");
rev->timedout = 0;
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
c->read->handler = ngx_mail_smtp_init_protocol;
ngx_add_timer(c->read, cscf->timeout);
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_close_connection(c);
return;
}
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
s->out = sscf->greeting;
} else {
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "invalid pipelining");
if (s->buffer == NULL) {
if (ngx_mail_smtp_create_buffer(s, c) != NGX_OK) {
return;
}
}
if (ngx_mail_smtp_discard_command(s, c,
"client was rejected before greeting: \"%V\"")
!= NGX_OK)
{
return;
}
ngx_str_set(&s->out, smtp_invalid_pipelining);
}
ngx_mail_send(c->write);
}
void
ngx_mail_smtp_init_protocol(ngx_event_t *rev)
{
ngx_connection_t *c;
ngx_mail_session_t *s;
c = rev->data;
c->log->action = "in auth state";
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
c->timedout = 1;
ngx_mail_close_connection(c);
return;
}
s = c->data;
if (s->buffer == NULL) {
if (ngx_mail_smtp_create_buffer(s, c) != NGX_OK) {
return;
}
}
s->mail_state = ngx_smtp_start;
c->read->handler = ngx_mail_smtp_auth_state;
ngx_mail_smtp_auth_state(rev);
}
static ngx_int_t
ngx_mail_smtp_create_buffer(ngx_mail_session_t *s, ngx_connection_t *c)
{
ngx_mail_smtp_srv_conf_t *sscf;
if (ngx_array_init(&s->args, c->pool, 2, sizeof(ngx_str_t)) == NGX_ERROR) {
ngx_mail_session_internal_server_error(s);
return NGX_ERROR;
}
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
s->buffer = ngx_create_temp_buf(c->pool, sscf->client_buffer_size);
if (s->buffer == NULL) {
ngx_mail_session_internal_server_error(s);
return NGX_ERROR;
}
return NGX_OK;
}
void
ngx_mail_smtp_auth_state(ngx_event_t *rev)
{
ngx_int_t rc;
ngx_connection_t *c;
ngx_mail_session_t *s;
c = rev->data;
s = c->data;
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp auth state");
if (rev->timedout) {
ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out");
c->timedout = 1;
ngx_mail_close_connection(c);
return;
}
if (s->out.len) {
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "smtp send handler busy");
s->blocked = 1;
return;
}
s->blocked = 0;
rc = ngx_mail_read_command(s, c);
if (rc == NGX_AGAIN || rc == NGX_ERROR) {
return;
}
ngx_str_set(&s->out, smtp_ok);
if (rc == NGX_OK) {
switch (s->mail_state) {
case ngx_smtp_start:
switch (s->command) {
case NGX_SMTP_HELO:
case NGX_SMTP_EHLO:
rc = ngx_mail_smtp_helo(s, c);
break;
case NGX_SMTP_AUTH:
rc = ngx_mail_smtp_auth(s, c);
break;
case NGX_SMTP_QUIT:
s->quit = 1;
ngx_str_set(&s->out, smtp_bye);
break;
case NGX_SMTP_MAIL:
rc = ngx_mail_smtp_mail(s, c);
break;
case NGX_SMTP_RCPT:
rc = ngx_mail_smtp_rcpt(s, c);
break;
case NGX_SMTP_RSET:
rc = ngx_mail_smtp_rset(s, c);
break;
case NGX_SMTP_NOOP:
break;
case NGX_SMTP_STARTTLS:
rc = ngx_mail_smtp_starttls(s, c);
ngx_str_set(&s->out, smtp_starttls);
break;
default:
rc = NGX_MAIL_PARSE_INVALID_COMMAND;
break;
}
break;
case ngx_smtp_auth_login_username:
rc = ngx_mail_auth_login_username(s, c, 0);
ngx_str_set(&s->out, smtp_password);
s->mail_state = ngx_smtp_auth_login_password;
break;
case ngx_smtp_auth_login_password:
rc = ngx_mail_auth_login_password(s, c);
break;
case ngx_smtp_auth_plain:
rc = ngx_mail_auth_plain(s, c, 0);
break;
case ngx_smtp_auth_cram_md5:
rc = ngx_mail_auth_cram_md5(s, c);
break;
}
}
switch (rc) {
case NGX_DONE:
ngx_mail_auth(s, c);
return;
case NGX_ERROR:
ngx_mail_session_internal_server_error(s);
return;
case NGX_MAIL_PARSE_INVALID_COMMAND:
s->mail_state = ngx_smtp_start;
s->state = 0;
ngx_str_set(&s->out, smtp_invalid_command);
/* fall through */
case NGX_OK:
s->args.nelts = 0;
s->buffer->pos = s->buffer->start;
s->buffer->last = s->buffer->start;
if (s->state) {
s->arg_start = s->buffer->start;
}
ngx_mail_send(c->write);
}
}
static ngx_int_t
ngx_mail_smtp_helo(ngx_mail_session_t *s, ngx_connection_t *c)
{
ngx_str_t *arg;
ngx_mail_smtp_srv_conf_t *sscf;
if (s->args.nelts != 1) {
ngx_str_set(&s->out, smtp_invalid_argument);
s->state = 0;
return NGX_OK;
}
arg = s->args.elts;
s->smtp_helo.len = arg[0].len;
s->smtp_helo.data = ngx_pnalloc(c->pool, arg[0].len);
if (s->smtp_helo.data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(s->smtp_helo.data, arg[0].data, arg[0].len);
ngx_str_null(&s->smtp_from);
ngx_str_null(&s->smtp_to);
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
if (s->command == NGX_SMTP_HELO) {
s->out = sscf->server_name;
} else {
s->esmtp = 1;
#if (NGX_MAIL_SSL)
if (c->ssl == NULL) {
ngx_mail_ssl_conf_t *sslcf;
sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module);
if (sslcf->starttls == NGX_MAIL_STARTTLS_ON) {
s->out = sscf->starttls_capability;
return NGX_OK;
}
if (sslcf->starttls == NGX_MAIL_STARTTLS_ONLY) {
s->out = sscf->starttls_only_capability;
return NGX_OK;
}
}
#endif
s->out = sscf->capability;
}
return NGX_OK;
}
static ngx_int_t
ngx_mail_smtp_auth(ngx_mail_session_t *s, ngx_connection_t *c)
{
ngx_int_t rc;
ngx_mail_core_srv_conf_t *cscf;
ngx_mail_smtp_srv_conf_t *sscf;
#if (NGX_MAIL_SSL)
if (ngx_mail_starttls_only(s, c)) {
return NGX_MAIL_PARSE_INVALID_COMMAND;
}
#endif
if (s->args.nelts == 0) {
ngx_str_set(&s->out, smtp_invalid_argument);
s->state = 0;
return NGX_OK;
}
rc = ngx_mail_auth_parse(s, c);
switch (rc) {
case NGX_MAIL_AUTH_LOGIN:
ngx_str_set(&s->out, smtp_username);
s->mail_state = ngx_smtp_auth_login_username;
return NGX_OK;
case NGX_MAIL_AUTH_LOGIN_USERNAME:
ngx_str_set(&s->out, smtp_password);
s->mail_state = ngx_smtp_auth_login_password;
return ngx_mail_auth_login_username(s, c, 1);
case NGX_MAIL_AUTH_PLAIN:
ngx_str_set(&s->out, smtp_next);
s->mail_state = ngx_smtp_auth_plain;
return NGX_OK;
case NGX_MAIL_AUTH_CRAM_MD5:
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
if (!(sscf->auth_methods & NGX_MAIL_AUTH_CRAM_MD5_ENABLED)) {
return NGX_MAIL_PARSE_INVALID_COMMAND;
}
if (s->salt.data == NULL) {
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
if (ngx_mail_salt(s, c, cscf) != NGX_OK) {
return NGX_ERROR;
}
}
if (ngx_mail_auth_cram_md5_salt(s, c, "334 ", 4) == NGX_OK) {
s->mail_state = ngx_smtp_auth_cram_md5;
return NGX_OK;
}
return NGX_ERROR;
}
return rc;
}
static ngx_int_t
ngx_mail_smtp_mail(ngx_mail_session_t *s, ngx_connection_t *c)
{
u_char ch;
ngx_str_t l;
ngx_uint_t i;
ngx_mail_smtp_srv_conf_t *sscf;
sscf = ngx_mail_get_module_srv_conf(s, ngx_mail_smtp_module);
if (!(sscf->auth_methods & NGX_MAIL_AUTH_NONE_ENABLED)) {
ngx_mail_smtp_log_rejected_command(s, c, "client was rejected: \"%V\"");
ngx_str_set(&s->out, smtp_auth_required);
return NGX_OK;
}
/* auth none */
if (s->smtp_from.len) {
ngx_str_set(&s->out, smtp_bad_sequence);
return NGX_OK;
}
l.len = s->buffer->last - s->buffer->start;
l.data = s->buffer->start;
for (i = 0; i < l.len; i++) {
ch = l.data[i];
if (ch != CR && ch != LF) {
continue;
}
l.data[i] = ' ';
}
while (i) {
if (l.data[i - 1] != ' ') {
break;
}
i--;
}
l.len = i;
s->smtp_from.len = l.len;
s->smtp_from.data = ngx_pnalloc(c->pool, l.len);
if (s->smtp_from.data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(s->smtp_from.data, l.data, l.len);
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"smtp mail from:\"%V\"", &s->smtp_from);
ngx_str_set(&s->out, smtp_ok);
return NGX_OK;
}
static ngx_int_t
ngx_mail_smtp_rcpt(ngx_mail_session_t *s, ngx_connection_t *c)
{
u_char ch;
ngx_str_t l;
ngx_uint_t i;
if (s->smtp_from.len == 0) {
ngx_str_set(&s->out, smtp_bad_sequence);
return NGX_OK;
}
l.len = s->buffer->last - s->buffer->start;
l.data = s->buffer->start;
for (i = 0; i < l.len; i++) {
ch = l.data[i];
if (ch != CR && ch != LF) {
continue;
}
l.data[i] = ' ';
}
while (i) {
if (l.data[i - 1] != ' ') {
break;
}
i--;
}
l.len = i;
s->smtp_to.len = l.len;
s->smtp_to.data = ngx_pnalloc(c->pool, l.len);
if (s->smtp_to.data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(s->smtp_to.data, l.data, l.len);
ngx_log_debug1(NGX_LOG_DEBUG_MAIL, c->log, 0,
"smtp rcpt to:\"%V\"", &s->smtp_to);
s->auth_method = NGX_MAIL_AUTH_NONE;
return NGX_DONE;
}
static ngx_int_t
ngx_mail_smtp_rset(ngx_mail_session_t *s, ngx_connection_t *c)
{
ngx_str_null(&s->smtp_from);
ngx_str_null(&s->smtp_to);
ngx_str_set(&s->out, smtp_ok);
return NGX_OK;
}
static ngx_int_t
ngx_mail_smtp_starttls(ngx_mail_session_t *s, ngx_connection_t *c)
{
#if (NGX_MAIL_SSL)
ngx_mail_ssl_conf_t *sslcf;
if (c->ssl == NULL) {
sslcf = ngx_mail_get_module_srv_conf(s, ngx_mail_ssl_module);
if (sslcf->starttls) {
/*
* RFC3207 requires us to discard any knowledge
* obtained from client before STARTTLS.
*/
ngx_str_null(&s->smtp_helo);
ngx_str_null(&s->smtp_from);
ngx_str_null(&s->smtp_to);
c->read->handler = ngx_mail_starttls_handler;
return NGX_OK;
}
}
#endif
return NGX_MAIL_PARSE_INVALID_COMMAND;
}
static ngx_int_t
ngx_mail_smtp_discard_command(ngx_mail_session_t *s, ngx_connection_t *c,
char *err)
{
ssize_t n;
n = c->recv(c, s->buffer->last, s->buffer->end - s->buffer->last);
if (n == NGX_ERROR || n == 0) {
ngx_mail_close_connection(c);
return NGX_ERROR;
}
if (n > 0) {
s->buffer->last += n;
}
if (n == NGX_AGAIN) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_session_internal_server_error(s);
return NGX_ERROR;
}
return NGX_AGAIN;
}
ngx_mail_smtp_log_rejected_command(s, c, err);
s->buffer->pos = s->buffer->start;
s->buffer->last = s->buffer->start;
return NGX_OK;
}
static void
ngx_mail_smtp_log_rejected_command(ngx_mail_session_t *s, ngx_connection_t *c,
char *err)
{
u_char ch;
ngx_str_t cmd;
ngx_uint_t i;
if (c->log->log_level < NGX_LOG_INFO) {
return;
}
cmd.len = s->buffer->last - s->buffer->start;
cmd.data = s->buffer->start;
for (i = 0; i < cmd.len; i++) {
ch = cmd.data[i];
if (ch != CR && ch != LF) {
continue;
}
cmd.data[i] = '_';
}
cmd.len = i;
ngx_log_error(NGX_LOG_INFO, c->log, 0, err, &cmd);
}
| bsd-2-clause |
kulinacs/void-packages | srcpkgs/musl/files/iconv.c | 101 | 2577 | /*
* iconv.c
* Implementation of SUSv4 XCU iconv utility
* Copyright © 2011 Rich Felker
* Licensed under the terms of the GNU General Public License, v2 or later
*/
#include <stdlib.h>
#include <stdio.h>
#include <iconv.h>
#include <locale.h>
#include <langinfo.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
int main(int argc, char **argv)
{
const char *from=0, *to=0;
int b;
iconv_t cd;
char buf[BUFSIZ];
char outbuf[BUFSIZ*4];
char *in, *out;
size_t inb;
size_t l;
size_t unitsize=0;
int err=0;
FILE *f;
while ((b = getopt(argc, argv, "f:t:csl")) != EOF) switch(b) {
case 'l':
puts("UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF32-LE, UCS-2BE, UCS-2LE, WCHAR_T,\n"
"US_ASCII, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5,\n"
"ISO8859-6, ISO8859-7, ...");
exit(0);
case 'c': case 's': break;
case 'f': from=optarg; break;
case 't': to=optarg; break;
default: exit(1);
}
if (!from || !to) {
setlocale(LC_CTYPE, "");
if (!to) to = nl_langinfo(CODESET);
if (!from) from = nl_langinfo(CODESET);
}
cd = iconv_open(to, from);
if (cd == (iconv_t)-1) {
if (iconv_open(to, "WCHAR_T") == (iconv_t)-1)
fprintf(stderr, "iconv: destination charset %s: ", to);
else
fprintf(stderr, "iconv: source charset %s: ", from);
perror("");
exit(1);
}
if (optind == argc) argv[argc++] = "-";
for (; optind < argc; optind++) {
if (argv[optind][0]=='-' && !argv[optind][1]) {
f = stdin;
argv[optind] = "(stdin)";
} else if (!(f = fopen(argv[optind], "rb"))) {
fprintf(stderr, "iconv: %s: ", argv[optind]);
perror("");
err = 1;
continue;
}
inb = 0;
for (;;) {
in = buf;
out = outbuf;
l = fread(buf+inb, 1, sizeof(buf)-inb, f);
inb += l;
if (!inb) break;
if (iconv(cd, &in, &inb, &out, (size_t [1]){sizeof outbuf})==-1
&& errno == EILSEQ) {
if (!unitsize) {
wchar_t wc='0';
char dummy[4], *dummyp=dummy;
iconv_t cd2 = iconv_open(from, "WCHAR_T");
if (cd == (iconv_t)-1) {
unitsize = 1;
} else {
iconv(cd2,
(char *[1]){(char *)&wc},
(size_t[1]){1},
&dummyp, (size_t[1]){4});
unitsize = dummyp-dummy;
if (!unitsize) unitsize=1;
}
}
inb-=unitsize;
in+=unitsize;
}
if (inb && !l && errno==EINVAL) break;
if (out>outbuf && !fwrite(outbuf, out-outbuf, 1, stdout)) {
perror("iconv: write error");
exit(1);
}
if (inb) memmove(buf, in, inb);
}
if (ferror(f)) {
fprintf(stderr, "iconv: %s: ", argv[optind]);
perror("");
err = 1;
}
}
return err;
}
| bsd-2-clause |
endplay/omniplay | linux-lts-quantal-3.5.0/arch/mips/kernel/signal.c | 129 | 16757 | /*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1991, 1992 Linus Torvalds
* Copyright (C) 1994 - 2000 Ralf Baechle
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
*/
#include <linux/cache.h>
#include <linux/irqflags.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/personality.h>
#include <linux/smp.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/compiler.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
#include <linux/tracehook.h>
#include <asm/abi.h>
#include <asm/asm.h>
#include <linux/bitops.h>
#include <asm/cacheflush.h>
#include <asm/fpu.h>
#include <asm/sim.h>
#include <asm/ucontext.h>
#include <asm/cpu-features.h>
#include <asm/war.h>
#include <asm/vdso.h>
#include <asm/dsp.h>
#include "signal-common.h"
static int (*save_fp_context)(struct sigcontext __user *sc);
static int (*restore_fp_context)(struct sigcontext __user *sc);
extern asmlinkage int _save_fp_context(struct sigcontext __user *sc);
extern asmlinkage int _restore_fp_context(struct sigcontext __user *sc);
extern asmlinkage int fpu_emulator_save_context(struct sigcontext __user *sc);
extern asmlinkage int fpu_emulator_restore_context(struct sigcontext __user *sc);
struct sigframe {
u32 sf_ass[4]; /* argument save space for o32 */
u32 sf_pad[2]; /* Was: signal trampoline */
struct sigcontext sf_sc;
sigset_t sf_mask;
};
struct rt_sigframe {
u32 rs_ass[4]; /* argument save space for o32 */
u32 rs_pad[2]; /* Was: signal trampoline */
struct siginfo rs_info;
struct ucontext rs_uc;
};
/*
* Helper routines
*/
static int protected_save_fp_context(struct sigcontext __user *sc)
{
int err;
while (1) {
lock_fpu_owner();
own_fpu_inatomic(1);
err = save_fp_context(sc); /* this might fail */
unlock_fpu_owner();
if (likely(!err))
break;
/* touch the sigcontext and try again */
err = __put_user(0, &sc->sc_fpregs[0]) |
__put_user(0, &sc->sc_fpregs[31]) |
__put_user(0, &sc->sc_fpc_csr);
if (err)
break; /* really bad sigcontext */
}
return err;
}
static int protected_restore_fp_context(struct sigcontext __user *sc)
{
int err, tmp __maybe_unused;
while (1) {
lock_fpu_owner();
own_fpu_inatomic(0);
err = restore_fp_context(sc); /* this might fail */
unlock_fpu_owner();
if (likely(!err))
break;
/* touch the sigcontext and try again */
err = __get_user(tmp, &sc->sc_fpregs[0]) |
__get_user(tmp, &sc->sc_fpregs[31]) |
__get_user(tmp, &sc->sc_fpc_csr);
if (err)
break; /* really bad sigcontext */
}
return err;
}
int setup_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
{
int err = 0;
int i;
unsigned int used_math;
err |= __put_user(regs->cp0_epc, &sc->sc_pc);
err |= __put_user(0, &sc->sc_regs[0]);
for (i = 1; i < 32; i++)
err |= __put_user(regs->regs[i], &sc->sc_regs[i]);
#ifdef CONFIG_CPU_HAS_SMARTMIPS
err |= __put_user(regs->acx, &sc->sc_acx);
#endif
err |= __put_user(regs->hi, &sc->sc_mdhi);
err |= __put_user(regs->lo, &sc->sc_mdlo);
if (cpu_has_dsp) {
err |= __put_user(mfhi1(), &sc->sc_hi1);
err |= __put_user(mflo1(), &sc->sc_lo1);
err |= __put_user(mfhi2(), &sc->sc_hi2);
err |= __put_user(mflo2(), &sc->sc_lo2);
err |= __put_user(mfhi3(), &sc->sc_hi3);
err |= __put_user(mflo3(), &sc->sc_lo3);
err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
}
used_math = !!used_math();
err |= __put_user(used_math, &sc->sc_used_math);
if (used_math) {
/*
* Save FPU state to signal context. Signal handler
* will "inherit" current FPU state.
*/
err |= protected_save_fp_context(sc);
}
return err;
}
int fpcsr_pending(unsigned int __user *fpcsr)
{
int err, sig = 0;
unsigned int csr, enabled;
err = __get_user(csr, fpcsr);
enabled = FPU_CSR_UNI_X | ((csr & FPU_CSR_ALL_E) << 5);
/*
* If the signal handler set some FPU exceptions, clear it and
* send SIGFPE.
*/
if (csr & enabled) {
csr &= ~enabled;
err |= __put_user(csr, fpcsr);
sig = SIGFPE;
}
return err ?: sig;
}
static int
check_and_restore_fp_context(struct sigcontext __user *sc)
{
int err, sig;
err = sig = fpcsr_pending(&sc->sc_fpc_csr);
if (err > 0)
err = 0;
err |= protected_restore_fp_context(sc);
return err ?: sig;
}
int restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
{
unsigned int used_math;
unsigned long treg;
int err = 0;
int i;
/* Always make any pending restarted system calls return -EINTR */
current_thread_info()->restart_block.fn = do_no_restart_syscall;
err |= __get_user(regs->cp0_epc, &sc->sc_pc);
#ifdef CONFIG_CPU_HAS_SMARTMIPS
err |= __get_user(regs->acx, &sc->sc_acx);
#endif
err |= __get_user(regs->hi, &sc->sc_mdhi);
err |= __get_user(regs->lo, &sc->sc_mdlo);
if (cpu_has_dsp) {
err |= __get_user(treg, &sc->sc_hi1); mthi1(treg);
err |= __get_user(treg, &sc->sc_lo1); mtlo1(treg);
err |= __get_user(treg, &sc->sc_hi2); mthi2(treg);
err |= __get_user(treg, &sc->sc_lo2); mtlo2(treg);
err |= __get_user(treg, &sc->sc_hi3); mthi3(treg);
err |= __get_user(treg, &sc->sc_lo3); mtlo3(treg);
err |= __get_user(treg, &sc->sc_dsp); wrdsp(treg, DSP_MASK);
}
for (i = 1; i < 32; i++)
err |= __get_user(regs->regs[i], &sc->sc_regs[i]);
err |= __get_user(used_math, &sc->sc_used_math);
conditional_used_math(used_math);
if (used_math) {
/* restore fpu context if we have used it before */
if (!err)
err = check_and_restore_fp_context(sc);
} else {
/* signal handler may have used FPU. Give it up. */
lose_fpu(0);
}
return err;
}
void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
size_t frame_size)
{
unsigned long sp;
/* Default to using normal stack */
sp = regs->regs[29];
/*
* FPU emulator may have it's own trampoline active just
* above the user stack, 16-bytes before the next lowest
* 16 byte boundary. Try to avoid trashing it.
*/
sp -= 32;
/* This is the X/Open sanctioned signal stack switching. */
if ((ka->sa.sa_flags & SA_ONSTACK) && (sas_ss_flags (sp) == 0))
sp = current->sas_ss_sp + current->sas_ss_size;
return (void __user *)((sp - frame_size) & (ICACHE_REFILLS_WORKAROUND_WAR ? ~(cpu_icache_line_size()-1) : ALMASK));
}
/*
* Atomically swap in the new signal mask, and wait for a signal.
*/
#ifdef CONFIG_TRAD_SIGNALS
asmlinkage int sys_sigsuspend(nabi_no_regargs struct pt_regs regs)
{
sigset_t newset;
sigset_t __user *uset;
uset = (sigset_t __user *) regs.regs[4];
if (copy_from_user(&newset, uset, sizeof(sigset_t)))
return -EFAULT;
return sigsuspend(&newset);
}
#endif
asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
{
sigset_t newset;
sigset_t __user *unewset;
size_t sigsetsize;
/* XXX Don't preclude handling different sized sigset_t's. */
sigsetsize = regs.regs[5];
if (sigsetsize != sizeof(sigset_t))
return -EINVAL;
unewset = (sigset_t __user *) regs.regs[4];
if (copy_from_user(&newset, unewset, sizeof(newset)))
return -EFAULT;
return sigsuspend(&newset);
}
#ifdef CONFIG_TRAD_SIGNALS
SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
struct sigaction __user *, oact)
{
struct k_sigaction new_ka, old_ka;
int ret;
int err = 0;
if (act) {
old_sigset_t mask;
if (!access_ok(VERIFY_READ, act, sizeof(*act)))
return -EFAULT;
err |= __get_user(new_ka.sa.sa_handler, &act->sa_handler);
err |= __get_user(new_ka.sa.sa_flags, &act->sa_flags);
err |= __get_user(mask, &act->sa_mask.sig[0]);
if (err)
return -EFAULT;
siginitset(&new_ka.sa.sa_mask, mask);
}
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) {
if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)))
return -EFAULT;
err |= __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
err |= __put_user(old_ka.sa.sa_handler, &oact->sa_handler);
err |= __put_user(old_ka.sa.sa_mask.sig[0], oact->sa_mask.sig);
err |= __put_user(0, &oact->sa_mask.sig[1]);
err |= __put_user(0, &oact->sa_mask.sig[2]);
err |= __put_user(0, &oact->sa_mask.sig[3]);
if (err)
return -EFAULT;
}
return ret;
}
#endif
asmlinkage int sys_sigaltstack(nabi_no_regargs struct pt_regs regs)
{
const stack_t __user *uss = (const stack_t __user *) regs.regs[4];
stack_t __user *uoss = (stack_t __user *) regs.regs[5];
unsigned long usp = regs.regs[29];
return do_sigaltstack(uss, uoss, usp);
}
#ifdef CONFIG_TRAD_SIGNALS
asmlinkage void sys_sigreturn(nabi_no_regargs struct pt_regs regs)
{
struct sigframe __user *frame;
sigset_t blocked;
int sig;
frame = (struct sigframe __user *) regs.regs[29];
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&blocked, &frame->sf_mask, sizeof(blocked)))
goto badframe;
set_current_blocked(&blocked);
sig = restore_sigcontext(®s, &frame->sf_sc);
if (sig < 0)
goto badframe;
else if (sig)
force_sig(sig, current);
/*
* Don't let your children do this ...
*/
__asm__ __volatile__(
"move\t$29, %0\n\t"
"j\tsyscall_exit"
:/* no outputs */
:"r" (®s));
/* Unreached */
badframe:
force_sig(SIGSEGV, current);
}
#endif /* CONFIG_TRAD_SIGNALS */
asmlinkage void sys_rt_sigreturn(nabi_no_regargs struct pt_regs regs)
{
struct rt_sigframe __user *frame;
sigset_t set;
int sig;
frame = (struct rt_sigframe __user *) regs.regs[29];
if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
goto badframe;
if (__copy_from_user(&set, &frame->rs_uc.uc_sigmask, sizeof(set)))
goto badframe;
set_current_blocked(&set);
sig = restore_sigcontext(®s, &frame->rs_uc.uc_mcontext);
if (sig < 0)
goto badframe;
else if (sig)
force_sig(sig, current);
/* It is more difficult to avoid calling this function than to
call it and ignore errors. */
do_sigaltstack(&frame->rs_uc.uc_stack, NULL, regs.regs[29]);
/*
* Don't let your children do this ...
*/
__asm__ __volatile__(
"move\t$29, %0\n\t"
"j\tsyscall_exit"
:/* no outputs */
:"r" (®s));
/* Unreached */
badframe:
force_sig(SIGSEGV, current);
}
#ifdef CONFIG_TRAD_SIGNALS
static int setup_frame(void *sig_return, struct k_sigaction *ka,
struct pt_regs *regs, int signr, sigset_t *set)
{
struct sigframe __user *frame;
int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
goto give_sigsegv;
err |= setup_sigcontext(regs, &frame->sf_sc);
err |= __copy_to_user(&frame->sf_mask, set, sizeof(*set));
if (err)
goto give_sigsegv;
/*
* Arguments to signal handler:
*
* a0 = signal number
* a1 = 0 (should be cause)
* a2 = pointer to struct sigcontext
*
* $25 and c0_epc point to the signal handler, $29 points to the
* struct sigframe.
*/
regs->regs[ 4] = signr;
regs->regs[ 5] = 0;
regs->regs[ 6] = (unsigned long) &frame->sf_sc;
regs->regs[29] = (unsigned long) frame;
regs->regs[31] = (unsigned long) sig_return;
regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
current->comm, current->pid,
frame, regs->cp0_epc, regs->regs[31]);
return 0;
give_sigsegv:
force_sigsegv(signr, current);
return -EFAULT;
}
#endif
static int setup_rt_frame(void *sig_return, struct k_sigaction *ka,
struct pt_regs *regs, int signr, sigset_t *set,
siginfo_t *info)
{
struct rt_sigframe __user *frame;
int err = 0;
frame = get_sigframe(ka, regs, sizeof(*frame));
if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
goto give_sigsegv;
/* Create siginfo. */
err |= copy_siginfo_to_user(&frame->rs_info, info);
/* Create the ucontext. */
err |= __put_user(0, &frame->rs_uc.uc_flags);
err |= __put_user(NULL, &frame->rs_uc.uc_link);
err |= __put_user((void __user *)current->sas_ss_sp,
&frame->rs_uc.uc_stack.ss_sp);
err |= __put_user(sas_ss_flags(regs->regs[29]),
&frame->rs_uc.uc_stack.ss_flags);
err |= __put_user(current->sas_ss_size,
&frame->rs_uc.uc_stack.ss_size);
err |= setup_sigcontext(regs, &frame->rs_uc.uc_mcontext);
err |= __copy_to_user(&frame->rs_uc.uc_sigmask, set, sizeof(*set));
if (err)
goto give_sigsegv;
/*
* Arguments to signal handler:
*
* a0 = signal number
* a1 = 0 (should be cause)
* a2 = pointer to ucontext
*
* $25 and c0_epc point to the signal handler, $29 points to
* the struct rt_sigframe.
*/
regs->regs[ 4] = signr;
regs->regs[ 5] = (unsigned long) &frame->rs_info;
regs->regs[ 6] = (unsigned long) &frame->rs_uc;
regs->regs[29] = (unsigned long) frame;
regs->regs[31] = (unsigned long) sig_return;
regs->cp0_epc = regs->regs[25] = (unsigned long) ka->sa.sa_handler;
DEBUGP("SIG deliver (%s:%d): sp=0x%p pc=0x%lx ra=0x%lx\n",
current->comm, current->pid,
frame, regs->cp0_epc, regs->regs[31]);
return 0;
give_sigsegv:
force_sigsegv(signr, current);
return -EFAULT;
}
struct mips_abi mips_abi = {
#ifdef CONFIG_TRAD_SIGNALS
.setup_frame = setup_frame,
.signal_return_offset = offsetof(struct mips_vdso, signal_trampoline),
#endif
.setup_rt_frame = setup_rt_frame,
.rt_signal_return_offset =
offsetof(struct mips_vdso, rt_signal_trampoline),
.restart = __NR_restart_syscall
};
static void handle_signal(unsigned long sig, siginfo_t *info,
struct k_sigaction *ka, struct pt_regs *regs)
{
sigset_t *oldset = sigmask_to_save();
int ret;
struct mips_abi *abi = current->thread.abi;
void *vdso = current->mm->context.vdso;
if (regs->regs[0]) {
switch(regs->regs[2]) {
case ERESTART_RESTARTBLOCK:
case ERESTARTNOHAND:
regs->regs[2] = EINTR;
break;
case ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) {
regs->regs[2] = EINTR;
break;
}
/* fallthrough */
case ERESTARTNOINTR:
regs->regs[7] = regs->regs[26];
regs->regs[2] = regs->regs[0];
regs->cp0_epc -= 4;
}
regs->regs[0] = 0; /* Don't deal with this again. */
}
if (sig_uses_siginfo(ka))
ret = abi->setup_rt_frame(vdso + abi->rt_signal_return_offset,
ka, regs, sig, oldset, info);
else
ret = abi->setup_frame(vdso + abi->signal_return_offset,
ka, regs, sig, oldset);
if (ret)
return;
signal_delivered(sig, info, ka, regs, 0);
}
static void do_signal(struct pt_regs *regs)
{
struct k_sigaction ka;
siginfo_t info;
int signr;
/*
* We want the common case to go fast, which is why we may in certain
* cases get here from kernel mode. Just return without doing anything
* if so.
*/
if (!user_mode(regs))
return;
signr = get_signal_to_deliver(&info, &ka, regs, NULL);
if (signr > 0) {
/* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, regs);
return;
}
if (regs->regs[0]) {
if (regs->regs[2] == ERESTARTNOHAND ||
regs->regs[2] == ERESTARTSYS ||
regs->regs[2] == ERESTARTNOINTR) {
regs->regs[2] = regs->regs[0];
regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4;
}
if (regs->regs[2] == ERESTART_RESTARTBLOCK) {
regs->regs[2] = current->thread.abi->restart;
regs->regs[7] = regs->regs[26];
regs->cp0_epc -= 4;
}
regs->regs[0] = 0; /* Don't deal with this again. */
}
/*
* If there's no signal to deliver, we just put the saved sigmask
* back
*/
restore_saved_sigmask();
}
/*
* notification of userspace execution resumption
* - triggered by the TIF_WORK_MASK flags
*/
asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
__u32 thread_info_flags)
{
local_irq_enable();
/* deal with pending signal delivery */
if (thread_info_flags & _TIF_SIGPENDING)
do_signal(regs);
if (thread_info_flags & _TIF_NOTIFY_RESUME) {
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(regs);
}
}
#ifdef CONFIG_SMP
static int smp_save_fp_context(struct sigcontext __user *sc)
{
return raw_cpu_has_fpu
? _save_fp_context(sc)
: fpu_emulator_save_context(sc);
}
static int smp_restore_fp_context(struct sigcontext __user *sc)
{
return raw_cpu_has_fpu
? _restore_fp_context(sc)
: fpu_emulator_restore_context(sc);
}
#endif
static int signal_setup(void)
{
#ifdef CONFIG_SMP
/* For now just do the cpu_has_fpu check when the functions are invoked */
save_fp_context = smp_save_fp_context;
restore_fp_context = smp_restore_fp_context;
#else
if (cpu_has_fpu) {
save_fp_context = _save_fp_context;
restore_fp_context = _restore_fp_context;
} else {
save_fp_context = fpu_emulator_save_context;
restore_fp_context = fpu_emulator_restore_context;
}
#endif
return 0;
}
arch_initcall(signal_setup);
| bsd-2-clause |
upsoft/nginx-openresty-windows | nginx/objs/lib_x64/openssl-1.0.2d/engines/e_cswift.c | 130 | 35576 | /* crypto/engine/hw_cswift.c */
/*
* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project
* 2000.
*/
/* ====================================================================
* Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
#include <stdio.h>
#include <string.h>
#include <openssl/crypto.h>
#include <openssl/buffer.h>
#include <openssl/dso.h>
#include <openssl/engine.h>
#ifndef OPENSSL_NO_RSA
# include <openssl/rsa.h>
#endif
#ifndef OPENSSL_NO_DSA
# include <openssl/dsa.h>
#endif
#ifndef OPENSSL_NO_DH
# include <openssl/dh.h>
#endif
#include <openssl/rand.h>
#include <openssl/bn.h>
#ifndef OPENSSL_NO_HW
# ifndef OPENSSL_NO_HW_CSWIFT
/*
* Attribution notice: Rainbow have generously allowed me to reproduce the
* necessary definitions here from their API. This means the support can
* build independently of whether application builders have the API or
* hardware. This will allow developers to easily produce software that has
* latent hardware support for any users that have accelerators installed,
* without the developers themselves needing anything extra. I have only
* clipped the parts from the CryptoSwift header files that are (or seem)
* relevant to the CryptoSwift support code. This is simply to keep the file
* sizes reasonable. [Geoff]
*/
# ifdef FLAT_INC
# include "cswift.h"
# else
# include "vendor_defns/cswift.h"
# endif
# define CSWIFT_LIB_NAME "cswift engine"
# include "e_cswift_err.c"
# define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
static int cswift_destroy(ENGINE *e);
static int cswift_init(ENGINE *e);
static int cswift_finish(ENGINE *e);
static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));
# ifndef OPENSSL_NO_RSA
static int cswift_bn_32copy(SW_LARGENUMBER *out, const BIGNUM *in);
# endif
/* BIGNUM stuff */
static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx);
# ifndef OPENSSL_NO_RSA
static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *q, const BIGNUM *dmp1,
const BIGNUM *dmq1, const BIGNUM *iqmp,
BN_CTX *ctx);
# endif
# ifndef OPENSSL_NO_RSA
/* RSA stuff */
static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
BN_CTX *ctx);
/* This function is aliased to mod_exp (with the mont stuff dropped). */
static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx,
BN_MONT_CTX *m_ctx);
# endif
# ifndef OPENSSL_NO_DSA
/* DSA stuff */
static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen,
DSA *dsa);
static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,
DSA_SIG *sig, DSA *dsa);
# endif
# ifndef OPENSSL_NO_DH
/* DH stuff */
/* This function is alised to mod_exp (with the DH and mont dropped). */
static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx,
BN_MONT_CTX *m_ctx);
# endif
/* RAND stuff */
static int cswift_rand_bytes(unsigned char *buf, int num);
static int cswift_rand_status(void);
/* The definitions for control commands specific to this engine */
# define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE
static const ENGINE_CMD_DEFN cswift_cmd_defns[] = {
{CSWIFT_CMD_SO_PATH,
"SO_PATH",
"Specifies the path to the 'cswift' shared library",
ENGINE_CMD_FLAG_STRING},
{0, NULL, NULL, 0}
};
# ifndef OPENSSL_NO_RSA
/* Our internal RSA_METHOD that we provide pointers to */
static RSA_METHOD cswift_rsa = {
"CryptoSwift RSA method",
NULL,
NULL,
NULL,
NULL,
cswift_rsa_mod_exp,
cswift_mod_exp_mont,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
};
# endif
# ifndef OPENSSL_NO_DSA
/* Our internal DSA_METHOD that we provide pointers to */
static DSA_METHOD cswift_dsa = {
"CryptoSwift DSA method",
cswift_dsa_sign,
NULL, /* dsa_sign_setup */
cswift_dsa_verify,
NULL, /* dsa_mod_exp */
NULL, /* bn_mod_exp */
NULL, /* init */
NULL, /* finish */
0, /* flags */
NULL, /* app_data */
NULL, /* dsa_paramgen */
NULL /* dsa_keygen */
};
# endif
# ifndef OPENSSL_NO_DH
/* Our internal DH_METHOD that we provide pointers to */
static DH_METHOD cswift_dh = {
"CryptoSwift DH method",
NULL,
NULL,
cswift_mod_exp_dh,
NULL,
NULL,
0,
NULL,
NULL
};
# endif
static RAND_METHOD cswift_random = {
/* "CryptoSwift RAND method", */
NULL,
cswift_rand_bytes,
NULL,
NULL,
cswift_rand_bytes,
cswift_rand_status,
};
/* Constants used when creating the ENGINE */
static const char *engine_cswift_id = "cswift";
static const char *engine_cswift_name = "CryptoSwift hardware engine support";
/*
* This internal function is used by ENGINE_cswift() and possibly by the
* "dynamic" ENGINE support too
*/
static int bind_helper(ENGINE *e)
{
# ifndef OPENSSL_NO_RSA
const RSA_METHOD *meth1;
# endif
# ifndef OPENSSL_NO_DH
const DH_METHOD *meth2;
# endif
if (!ENGINE_set_id(e, engine_cswift_id) ||
!ENGINE_set_name(e, engine_cswift_name) ||
# ifndef OPENSSL_NO_RSA
!ENGINE_set_RSA(e, &cswift_rsa) ||
# endif
# ifndef OPENSSL_NO_DSA
!ENGINE_set_DSA(e, &cswift_dsa) ||
# endif
# ifndef OPENSSL_NO_DH
!ENGINE_set_DH(e, &cswift_dh) ||
# endif
!ENGINE_set_RAND(e, &cswift_random) ||
!ENGINE_set_destroy_function(e, cswift_destroy) ||
!ENGINE_set_init_function(e, cswift_init) ||
!ENGINE_set_finish_function(e, cswift_finish) ||
!ENGINE_set_ctrl_function(e, cswift_ctrl) ||
!ENGINE_set_cmd_defns(e, cswift_cmd_defns))
return 0;
# ifndef OPENSSL_NO_RSA
/*
* We know that the "PKCS1_SSLeay()" functions hook properly to the
* cswift-specific mod_exp and mod_exp_crt so we use those functions. NB:
* We don't use ENGINE_openssl() or anything "more generic" because
* something like the RSAref code may not hook properly, and if you own
* one of these cards then you have the right to do RSA operations on it
* anyway!
*/
meth1 = RSA_PKCS1_SSLeay();
cswift_rsa.rsa_pub_enc = meth1->rsa_pub_enc;
cswift_rsa.rsa_pub_dec = meth1->rsa_pub_dec;
cswift_rsa.rsa_priv_enc = meth1->rsa_priv_enc;
cswift_rsa.rsa_priv_dec = meth1->rsa_priv_dec;
# endif
# ifndef OPENSSL_NO_DH
/* Much the same for Diffie-Hellman */
meth2 = DH_OpenSSL();
cswift_dh.generate_key = meth2->generate_key;
cswift_dh.compute_key = meth2->compute_key;
# endif
/* Ensure the cswift error handling is set up */
ERR_load_CSWIFT_strings();
return 1;
}
# ifdef OPENSSL_NO_DYNAMIC_ENGINE
static ENGINE *engine_cswift(void)
{
ENGINE *ret = ENGINE_new();
if (!ret)
return NULL;
if (!bind_helper(ret)) {
ENGINE_free(ret);
return NULL;
}
return ret;
}
void ENGINE_load_cswift(void)
{
/* Copied from eng_[openssl|dyn].c */
ENGINE *toadd = engine_cswift();
if (!toadd)
return;
ENGINE_add(toadd);
ENGINE_free(toadd);
ERR_clear_error();
}
# endif
/*
* This is a process-global DSO handle used for loading and unloading the
* CryptoSwift library. NB: This is only set (or unset) during an init() or
* finish() call (reference counts permitting) and they're operating with
* global locks, so this should be thread-safe implicitly.
*/
static DSO *cswift_dso = NULL;
/*
* These are the function pointers that are (un)set when the library has
* successfully (un)loaded.
*/
t_swAcquireAccContext *p_CSwift_AcquireAccContext = NULL;
t_swAttachKeyParam *p_CSwift_AttachKeyParam = NULL;
t_swSimpleRequest *p_CSwift_SimpleRequest = NULL;
t_swReleaseAccContext *p_CSwift_ReleaseAccContext = NULL;
/* Used in the DSO operations. */
static const char *CSWIFT_LIBNAME = NULL;
static const char *get_CSWIFT_LIBNAME(void)
{
if (CSWIFT_LIBNAME)
return CSWIFT_LIBNAME;
return "swift";
}
static void free_CSWIFT_LIBNAME(void)
{
if (CSWIFT_LIBNAME)
OPENSSL_free((void *)CSWIFT_LIBNAME);
CSWIFT_LIBNAME = NULL;
}
static long set_CSWIFT_LIBNAME(const char *name)
{
free_CSWIFT_LIBNAME();
return (((CSWIFT_LIBNAME = BUF_strdup(name)) != NULL) ? 1 : 0);
}
static const char *CSWIFT_F1 = "swAcquireAccContext";
static const char *CSWIFT_F2 = "swAttachKeyParam";
static const char *CSWIFT_F3 = "swSimpleRequest";
static const char *CSWIFT_F4 = "swReleaseAccContext";
/*
* CryptoSwift library functions and mechanics - these are used by the
* higher-level functions further down. NB: As and where there's no error
* checking, take a look lower down where these functions are called, the
* checking and error handling is probably down there.
*/
/* utility function to obtain a context */
static int get_context(SW_CONTEXT_HANDLE *hac)
{
SW_STATUS status;
status = p_CSwift_AcquireAccContext(hac);
if (status != SW_OK)
return 0;
return 1;
}
/* similarly to release one. */
static void release_context(SW_CONTEXT_HANDLE hac)
{
p_CSwift_ReleaseAccContext(hac);
}
/* Destructor (complements the "ENGINE_cswift()" constructor) */
static int cswift_destroy(ENGINE *e)
{
free_CSWIFT_LIBNAME();
ERR_unload_CSWIFT_strings();
return 1;
}
/* (de)initialisation functions. */
static int cswift_init(ENGINE *e)
{
SW_CONTEXT_HANDLE hac;
t_swAcquireAccContext *p1;
t_swAttachKeyParam *p2;
t_swSimpleRequest *p3;
t_swReleaseAccContext *p4;
if (cswift_dso != NULL) {
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_ALREADY_LOADED);
goto err;
}
/* Attempt to load libswift.so/swift.dll/whatever. */
cswift_dso = DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0);
if (cswift_dso == NULL) {
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);
goto err;
}
if (!(p1 = (t_swAcquireAccContext *)
DSO_bind_func(cswift_dso, CSWIFT_F1)) ||
!(p2 = (t_swAttachKeyParam *)
DSO_bind_func(cswift_dso, CSWIFT_F2)) ||
!(p3 = (t_swSimpleRequest *)
DSO_bind_func(cswift_dso, CSWIFT_F3)) ||
!(p4 = (t_swReleaseAccContext *)
DSO_bind_func(cswift_dso, CSWIFT_F4))) {
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);
goto err;
}
/* Copy the pointers */
p_CSwift_AcquireAccContext = p1;
p_CSwift_AttachKeyParam = p2;
p_CSwift_SimpleRequest = p3;
p_CSwift_ReleaseAccContext = p4;
/*
* Try and get a context - if not, we may have a DSO but no accelerator!
*/
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_UNIT_FAILURE);
goto err;
}
release_context(hac);
/* Everything's fine. */
return 1;
err:
if (cswift_dso) {
DSO_free(cswift_dso);
cswift_dso = NULL;
}
p_CSwift_AcquireAccContext = NULL;
p_CSwift_AttachKeyParam = NULL;
p_CSwift_SimpleRequest = NULL;
p_CSwift_ReleaseAccContext = NULL;
return 0;
}
static int cswift_finish(ENGINE *e)
{
free_CSWIFT_LIBNAME();
if (cswift_dso == NULL) {
CSWIFTerr(CSWIFT_F_CSWIFT_FINISH, CSWIFT_R_NOT_LOADED);
return 0;
}
if (!DSO_free(cswift_dso)) {
CSWIFTerr(CSWIFT_F_CSWIFT_FINISH, CSWIFT_R_UNIT_FAILURE);
return 0;
}
cswift_dso = NULL;
p_CSwift_AcquireAccContext = NULL;
p_CSwift_AttachKeyParam = NULL;
p_CSwift_SimpleRequest = NULL;
p_CSwift_ReleaseAccContext = NULL;
return 1;
}
static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))
{
int initialised = ((cswift_dso == NULL) ? 0 : 1);
switch (cmd) {
case CSWIFT_CMD_SO_PATH:
if (p == NULL) {
CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, ERR_R_PASSED_NULL_PARAMETER);
return 0;
}
if (initialised) {
CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_ALREADY_LOADED);
return 0;
}
return set_CSWIFT_LIBNAME((const char *)p);
default:
break;
}
CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED);
return 0;
}
/* Un petit mod_exp */
static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx)
{
/*
* I need somewhere to store temporary serialised values for use with the
* CryptoSwift API calls. A neat cheat - I'll use BIGNUMs from the BN_CTX
* but access their arrays directly as byte arrays <grin>. This way I
* don't have to clean anything up.
*/
BIGNUM *modulus;
BIGNUM *exponent;
BIGNUM *argument;
BIGNUM *result;
SW_STATUS sw_status;
SW_LARGENUMBER arg, res;
SW_PARAM sw_param;
SW_CONTEXT_HANDLE hac;
int to_return, acquired;
modulus = exponent = argument = result = NULL;
to_return = 0; /* expect failure */
acquired = 0;
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/* Prepare the params */
BN_CTX_start(ctx);
modulus = BN_CTX_get(ctx);
exponent = BN_CTX_get(ctx);
argument = BN_CTX_get(ctx);
result = BN_CTX_get(ctx);
if (!result) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BN_CTX_FULL);
goto err;
}
if (!bn_wexpand(modulus, m->top) || !bn_wexpand(exponent, p->top) ||
!bn_wexpand(argument, a->top) || !bn_wexpand(result, m->top)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
sw_param.type = SW_ALG_EXP;
sw_param.up.exp.modulus.nbytes = BN_bn2bin(m,
(unsigned char *)modulus->d);
sw_param.up.exp.modulus.value = (unsigned char *)modulus->d;
sw_param.up.exp.exponent.nbytes = BN_bn2bin(p,
(unsigned char *)exponent->d);
sw_param.up.exp.exponent.value = (unsigned char *)exponent->d;
/* Attach the key params */
sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
switch (sw_status) {
case SW_OK:
break;
case SW_ERR_INPUT_SIZE:
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BAD_KEY_SIZE);
goto err;
default:
{
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
}
goto err;
}
/* Prepare the argument and response */
arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d);
arg.value = (unsigned char *)argument->d;
res.nbytes = BN_num_bytes(m);
memset(result->d, 0, res.nbytes);
res.value = (unsigned char *)result->d;
/* Perform the operation */
if ((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP, &arg, 1,
&res, 1)) != SW_OK) {
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
/* Convert the response */
BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
to_return = 1;
err:
if (acquired)
release_context(hac);
BN_CTX_end(ctx);
return to_return;
}
# ifndef OPENSSL_NO_RSA
int cswift_bn_32copy(SW_LARGENUMBER *out, const BIGNUM *in)
{
int mod;
int numbytes = BN_num_bytes(in);
mod = 0;
while (((out->nbytes = (numbytes + mod)) % 32)) {
mod++;
}
out->value = (unsigned char *)OPENSSL_malloc(out->nbytes);
if (!out->value) {
return 0;
}
BN_bn2bin(in, &out->value[mod]);
if (mod)
memset(out->value, 0, mod);
return 1;
}
# endif
# ifndef OPENSSL_NO_RSA
/* Un petit mod_exp chinois */
static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *q, const BIGNUM *dmp1,
const BIGNUM *dmq1, const BIGNUM *iqmp,
BN_CTX *ctx)
{
SW_STATUS sw_status;
SW_LARGENUMBER arg, res;
SW_PARAM sw_param;
SW_CONTEXT_HANDLE hac;
BIGNUM *result = NULL;
BIGNUM *argument = NULL;
int to_return = 0; /* expect failure */
int acquired = 0;
sw_param.up.crt.p.value = NULL;
sw_param.up.crt.q.value = NULL;
sw_param.up.crt.dmp1.value = NULL;
sw_param.up.crt.dmq1.value = NULL;
sw_param.up.crt.iqmp.value = NULL;
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/* Prepare the params */
argument = BN_new();
result = BN_new();
if (!result || !argument) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_CTX_FULL);
goto err;
}
sw_param.type = SW_ALG_CRT;
/************************************************************************/
/*
* 04/02/2003
*/
/*
* Modified by Frederic Giudicelli (deny-all.com) to overcome the
*/
/*
* limitation of cswift with values not a multiple of 32
*/
/************************************************************************/
if (!cswift_bn_32copy(&sw_param.up.crt.p, p)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
if (!cswift_bn_32copy(&sw_param.up.crt.q, q)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
if (!cswift_bn_32copy(&sw_param.up.crt.dmp1, dmp1)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
if (!cswift_bn_32copy(&sw_param.up.crt.dmq1, dmq1)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
if (!cswift_bn_32copy(&sw_param.up.crt.iqmp, iqmp)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
if (!bn_wexpand(argument, a->top) || !bn_wexpand(result, p->top + q->top)) {
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
/* Attach the key params */
sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
switch (sw_status) {
case SW_OK:
break;
case SW_ERR_INPUT_SIZE:
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BAD_KEY_SIZE);
goto err;
default:
{
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
}
goto err;
}
/* Prepare the argument and response */
arg.nbytes = BN_bn2bin(a, (unsigned char *)argument->d);
arg.value = (unsigned char *)argument->d;
res.nbytes = 2 * BN_num_bytes(p);
memset(result->d, 0, res.nbytes);
res.value = (unsigned char *)result->d;
/* Perform the operation */
if ((sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP_CRT, &arg, 1,
&res, 1)) != SW_OK) {
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
/* Convert the response */
BN_bin2bn((unsigned char *)result->d, res.nbytes, r);
to_return = 1;
err:
if (sw_param.up.crt.p.value)
OPENSSL_free(sw_param.up.crt.p.value);
if (sw_param.up.crt.q.value)
OPENSSL_free(sw_param.up.crt.q.value);
if (sw_param.up.crt.dmp1.value)
OPENSSL_free(sw_param.up.crt.dmp1.value);
if (sw_param.up.crt.dmq1.value)
OPENSSL_free(sw_param.up.crt.dmq1.value);
if (sw_param.up.crt.iqmp.value)
OPENSSL_free(sw_param.up.crt.iqmp.value);
if (result)
BN_free(result);
if (argument)
BN_free(argument);
if (acquired)
release_context(hac);
return to_return;
}
# endif
# ifndef OPENSSL_NO_RSA
static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
BN_CTX *ctx)
{
int to_return = 0;
const RSA_METHOD *def_rsa_method;
if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) {
CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,
CSWIFT_R_MISSING_KEY_COMPONENTS);
goto err;
}
/* Try the limits of RSA (2048 bits) */
if (BN_num_bytes(rsa->p) > 128 ||
BN_num_bytes(rsa->q) > 128 ||
BN_num_bytes(rsa->dmp1) > 128 ||
BN_num_bytes(rsa->dmq1) > 128 || BN_num_bytes(rsa->iqmp) > 128) {
# ifdef RSA_NULL
def_rsa_method = RSA_null_method();
# else
# if 0
def_rsa_method = RSA_PKCS1_RSAref();
# else
def_rsa_method = RSA_PKCS1_SSLeay();
# endif
# endif
if (def_rsa_method)
return def_rsa_method->rsa_mod_exp(r0, I, rsa, ctx);
}
to_return = cswift_mod_exp_crt(r0, I, rsa->p, rsa->q, rsa->dmp1,
rsa->dmq1, rsa->iqmp, ctx);
err:
return to_return;
}
/* This function is aliased to mod_exp (with the mont stuff dropped). */
static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx,
BN_MONT_CTX *m_ctx)
{
const RSA_METHOD *def_rsa_method;
/* Try the limits of RSA (2048 bits) */
if (BN_num_bytes(r) > 256 ||
BN_num_bytes(a) > 256 || BN_num_bytes(m) > 256) {
# ifdef RSA_NULL
def_rsa_method = RSA_null_method();
# else
# if 0
def_rsa_method = RSA_PKCS1_RSAref();
# else
def_rsa_method = RSA_PKCS1_SSLeay();
# endif
# endif
if (def_rsa_method)
return def_rsa_method->bn_mod_exp(r, a, p, m, ctx, m_ctx);
}
return cswift_mod_exp(r, a, p, m, ctx);
}
# endif /* OPENSSL_NO_RSA */
# ifndef OPENSSL_NO_DSA
static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa)
{
SW_CONTEXT_HANDLE hac;
SW_PARAM sw_param;
SW_STATUS sw_status;
SW_LARGENUMBER arg, res;
BN_CTX *ctx;
BIGNUM *dsa_p = NULL;
BIGNUM *dsa_q = NULL;
BIGNUM *dsa_g = NULL;
BIGNUM *dsa_key = NULL;
BIGNUM *result = NULL;
DSA_SIG *to_return = NULL;
int acquired = 0;
if ((ctx = BN_CTX_new()) == NULL)
goto err;
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/* Prepare the params */
BN_CTX_start(ctx);
dsa_p = BN_CTX_get(ctx);
dsa_q = BN_CTX_get(ctx);
dsa_g = BN_CTX_get(ctx);
dsa_key = BN_CTX_get(ctx);
result = BN_CTX_get(ctx);
if (!result) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BN_CTX_FULL);
goto err;
}
if (!bn_wexpand(dsa_p, dsa->p->top) ||
!bn_wexpand(dsa_q, dsa->q->top) ||
!bn_wexpand(dsa_g, dsa->g->top) ||
!bn_wexpand(dsa_key, dsa->priv_key->top) ||
!bn_wexpand(result, dsa->p->top)) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
sw_param.type = SW_ALG_DSA;
sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p, (unsigned char *)dsa_p->d);
sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d;
sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q, (unsigned char *)dsa_q->d);
sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d;
sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g, (unsigned char *)dsa_g->d);
sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d;
sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->priv_key,
(unsigned char *)dsa_key->d);
sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d;
/* Attach the key params */
sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
switch (sw_status) {
case SW_OK:
break;
case SW_ERR_INPUT_SIZE:
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BAD_KEY_SIZE);
goto err;
default:
{
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
}
goto err;
}
/* Prepare the argument and response */
arg.nbytes = dlen;
arg.value = (unsigned char *)dgst;
res.nbytes = BN_num_bytes(dsa->p);
memset(result->d, 0, res.nbytes);
res.value = (unsigned char *)result->d;
/* Perform the operation */
sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_SIGN, &arg, 1,
&res, 1);
if (sw_status != SW_OK) {
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
/* Convert the response */
if ((to_return = DSA_SIG_new()) == NULL)
goto err;
to_return->r = BN_bin2bn((unsigned char *)result->d, 20, NULL);
to_return->s = BN_bin2bn((unsigned char *)result->d + 20, 20, NULL);
err:
if (acquired)
release_context(hac);
if (ctx) {
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
return to_return;
}
static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,
DSA_SIG *sig, DSA *dsa)
{
SW_CONTEXT_HANDLE hac;
SW_PARAM sw_param;
SW_STATUS sw_status;
SW_LARGENUMBER arg[2], res;
unsigned long sig_result;
BN_CTX *ctx;
BIGNUM *dsa_p = NULL;
BIGNUM *dsa_q = NULL;
BIGNUM *dsa_g = NULL;
BIGNUM *dsa_key = NULL;
BIGNUM *argument = NULL;
int to_return = -1;
int acquired = 0;
if ((ctx = BN_CTX_new()) == NULL)
goto err;
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/* Prepare the params */
BN_CTX_start(ctx);
dsa_p = BN_CTX_get(ctx);
dsa_q = BN_CTX_get(ctx);
dsa_g = BN_CTX_get(ctx);
dsa_key = BN_CTX_get(ctx);
argument = BN_CTX_get(ctx);
if (!argument) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BN_CTX_FULL);
goto err;
}
if (!bn_wexpand(dsa_p, dsa->p->top) ||
!bn_wexpand(dsa_q, dsa->q->top) ||
!bn_wexpand(dsa_g, dsa->g->top) ||
!bn_wexpand(dsa_key, dsa->pub_key->top) ||
!bn_wexpand(argument, 40)) {
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BN_EXPAND_FAIL);
goto err;
}
sw_param.type = SW_ALG_DSA;
sw_param.up.dsa.p.nbytes = BN_bn2bin(dsa->p, (unsigned char *)dsa_p->d);
sw_param.up.dsa.p.value = (unsigned char *)dsa_p->d;
sw_param.up.dsa.q.nbytes = BN_bn2bin(dsa->q, (unsigned char *)dsa_q->d);
sw_param.up.dsa.q.value = (unsigned char *)dsa_q->d;
sw_param.up.dsa.g.nbytes = BN_bn2bin(dsa->g, (unsigned char *)dsa_g->d);
sw_param.up.dsa.g.value = (unsigned char *)dsa_g->d;
sw_param.up.dsa.key.nbytes = BN_bn2bin(dsa->pub_key,
(unsigned char *)dsa_key->d);
sw_param.up.dsa.key.value = (unsigned char *)dsa_key->d;
/* Attach the key params */
sw_status = p_CSwift_AttachKeyParam(hac, &sw_param);
switch (sw_status) {
case SW_OK:
break;
case SW_ERR_INPUT_SIZE:
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BAD_KEY_SIZE);
goto err;
default:
{
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
}
goto err;
}
/* Prepare the argument and response */
arg[0].nbytes = dgst_len;
arg[0].value = (unsigned char *)dgst;
arg[1].nbytes = 40;
arg[1].value = (unsigned char *)argument->d;
memset(arg[1].value, 0, 40);
BN_bn2bin(sig->r, arg[1].value + 20 - BN_num_bytes(sig->r));
BN_bn2bin(sig->s, arg[1].value + 40 - BN_num_bytes(sig->s));
res.nbytes = 4; /* unsigned long */
res.value = (unsigned char *)(&sig_result);
/* Perform the operation */
sw_status = p_CSwift_SimpleRequest(hac, SW_CMD_DSS_VERIFY, arg, 2,
&res, 1);
if (sw_status != SW_OK) {
char tmpbuf[DECIMAL_SIZE(sw_status) + 1];
CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", sw_status);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
/* Convert the response */
to_return = ((sig_result == 0) ? 0 : 1);
err:
if (acquired)
release_context(hac);
if (ctx) {
BN_CTX_end(ctx);
BN_CTX_free(ctx);
}
return to_return;
}
# endif
# ifndef OPENSSL_NO_DH
/* This function is aliased to mod_exp (with the dh and mont dropped). */
static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,
const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
{
return cswift_mod_exp(r, a, p, m, ctx);
}
# endif
/* Random bytes are good */
static int cswift_rand_bytes(unsigned char *buf, int num)
{
SW_CONTEXT_HANDLE hac;
SW_STATUS swrc;
SW_LARGENUMBER largenum;
int acquired = 0;
int to_return = 0; /* assume failure */
unsigned char buf32[1024];
if (!get_context(&hac)) {
CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_UNIT_FAILURE);
goto err;
}
acquired = 1;
/************************************************************************/
/*
* 04/02/2003
*/
/*
* Modified by Frederic Giudicelli (deny-all.com) to overcome the
*/
/*
* limitation of cswift with values not a multiple of 32
*/
/************************************************************************/
while (num >= (int)sizeof(buf32)) {
largenum.value = buf;
largenum.nbytes = sizeof(buf32);
/*-
* tell CryptoSwift how many bytes we want and where we want it.
* Note: - CryptoSwift cannot do more than 4096 bytes at a time.
* - CryptoSwift can only do multiple of 32-bits.
*/
swrc =
p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1);
if (swrc != SW_OK) {
char tmpbuf[20];
CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", swrc);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
buf += sizeof(buf32);
num -= sizeof(buf32);
}
if (num) {
largenum.nbytes = sizeof(buf32);
largenum.value = buf32;
swrc =
p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, &largenum, 1);
if (swrc != SW_OK) {
char tmpbuf[20];
CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_REQUEST_FAILED);
sprintf(tmpbuf, "%ld", swrc);
ERR_add_error_data(2, "CryptoSwift error number is ", tmpbuf);
goto err;
}
memcpy(buf, largenum.value, num);
}
to_return = 1; /* success */
err:
if (acquired)
release_context(hac);
return to_return;
}
static int cswift_rand_status(void)
{
return 1;
}
/*
* This stuff is needed if this ENGINE is being compiled into a
* self-contained shared-library.
*/
# ifndef OPENSSL_NO_DYNAMIC_ENGINE
static int bind_fn(ENGINE *e, const char *id)
{
if (id && (strcmp(id, engine_cswift_id) != 0))
return 0;
if (!bind_helper(e))
return 0;
return 1;
}
IMPLEMENT_DYNAMIC_CHECK_FN()
IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)
# endif /* OPENSSL_NO_DYNAMIC_ENGINE */
# endif /* !OPENSSL_NO_HW_CSWIFT */
#endif /* !OPENSSL_NO_HW */
| bsd-2-clause |
mikedlowis-prototypes/albase | source/kernel/arch/powerpc/boot/mpc8xx.c | 13972 | 1692 | /*
* MPC8xx support functions
*
* Author: Scott Wood <scottwood@freescale.com>
*
* Copyright (c) 2007 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/
#include "ops.h"
#include "types.h"
#include "fsl-soc.h"
#include "mpc8xx.h"
#include "stdio.h"
#include "io.h"
#define MPC8XX_PLPRCR (0x284/4) /* PLL and Reset Control Register */
/* Return system clock from crystal frequency */
u32 mpc885_get_clock(u32 crystal)
{
u32 *immr;
u32 plprcr;
int mfi, mfn, mfd, pdf, div;
u32 ret;
immr = fsl_get_immr();
if (!immr) {
printf("mpc885_get_clock: Couldn't get IMMR base.\r\n");
return 0;
}
plprcr = in_be32(&immr[MPC8XX_PLPRCR]);
mfi = (plprcr >> 16) & 15;
if (mfi < 5) {
printf("Warning: PLPRCR[MFI] value of %d out-of-bounds\r\n",
mfi);
mfi = 5;
}
pdf = (plprcr >> 1) & 0xf;
div = (plprcr >> 20) & 3;
mfd = (plprcr >> 22) & 0x1f;
mfn = (plprcr >> 27) & 0x1f;
ret = crystal * mfi;
if (mfn != 0)
ret += crystal * mfn / (mfd + 1);
return ret / (pdf + 1);
}
/* Set common device tree fields based on the given clock frequencies. */
void mpc8xx_set_clocks(u32 sysclk)
{
void *node;
dt_fixup_cpu_clocks(sysclk, sysclk / 16, sysclk);
node = finddevice("/soc/cpm");
if (node)
setprop(node, "clock-frequency", &sysclk, 4);
node = finddevice("/soc/cpm/brg");
if (node)
setprop(node, "clock-frequency", &sysclk, 4);
}
int mpc885_fixup_clocks(u32 crystal)
{
u32 sysclk = mpc885_get_clock(crystal);
if (!sysclk)
return 0;
mpc8xx_set_clocks(sysclk);
return 1;
}
| bsd-2-clause |
rserban/chrono | src/chrono_models/vehicle/feda/FEDA.cpp | 1 | 8853 | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Radu Serban, Asher Elmquist, Rainer Gericke
// =============================================================================
//
// Wrapper classes for modeling an entire Sedan vehicle assembly
// (including the vehicle itself, the powertrain, and the tires).
//
// =============================================================================
#include "chrono/ChConfig.h"
#include "chrono_vehicle/ChVehicleModelData.h"
#include "chrono_models/vehicle/feda/FEDA.h"
namespace chrono {
namespace vehicle {
namespace feda {
// -----------------------------------------------------------------------------
FEDA::FEDA()
: m_system(nullptr),
m_vehicle(nullptr),
m_contactMethod(ChContactMethod::NSC),
m_chassisCollisionType(CollisionType::NONE),
m_fixed(false),
m_powertrain_type(PowertrainModelType::SIMPLE_MAP),
m_brake_type(BrakeType::SIMPLE),
m_tireType(TireModelType::RIGID),
m_tire_step_size(-1),
m_initFwdVel(0),
m_initPos(ChCoordsys<>(ChVector<>(0, 0, 1), QUNIT)),
m_initOmega({0, 0, 0, 0}),
m_apply_drag(false),
m_ride_height_config(1),
m_tire_collision_type(ChTire::CollisionType::SINGLE_POINT),
m_tire_pressure_level(2),
m_damper_mode(1) {}
FEDA::FEDA(ChSystem* system)
: m_system(system),
m_vehicle(nullptr),
m_contactMethod(ChContactMethod::NSC),
m_chassisCollisionType(CollisionType::NONE),
m_fixed(false),
m_powertrain_type(PowertrainModelType::SIMPLE_MAP),
m_brake_type(BrakeType::SIMPLE),
m_tireType(TireModelType::RIGID),
m_tire_step_size(-1),
m_initFwdVel(0),
m_initPos(ChCoordsys<>(ChVector<>(0, 0, 1), QUNIT)),
m_initOmega({0, 0, 0, 0}),
m_apply_drag(false),
m_ride_height_config(1),
m_tire_collision_type(ChTire::CollisionType::SINGLE_POINT),
m_tire_pressure_level(2),
m_damper_mode(1) {}
FEDA::~FEDA() {
delete m_vehicle;
}
// -----------------------------------------------------------------------------
void FEDA::SetAerodynamicDrag(double Cd, double area, double air_density) {
m_Cd = Cd;
m_area = area;
m_air_density = air_density;
m_apply_drag = true;
}
void FEDA::SetDamperMode(DamperMode theDamperMode) {
switch (theDamperMode) {
case DamperMode::FSD:
m_damper_mode = 1;
break;
case DamperMode::PASSIVE_LOW:
m_damper_mode = 2;
break;
case DamperMode::PASSIVE_HIGH:
m_damper_mode = 3;
break;
}
}
// -----------------------------------------------------------------------------
void FEDA::Initialize() {
// Create and initialize the Sedan vehicle
GetLog() << "FEDA::Initialize(): Damper Mode = " << m_damper_mode << "\n";
m_vehicle = m_system ? new FEDA_Vehicle(m_system, m_fixed, m_brake_type, m_chassisCollisionType,
m_ride_height_config, m_damper_mode)
: new FEDA_Vehicle(m_fixed, m_brake_type, m_contactMethod, m_chassisCollisionType,
m_ride_height_config, m_damper_mode);
m_vehicle->SetInitWheelAngVel(m_initOmega);
m_vehicle->Initialize(m_initPos, m_initFwdVel);
// If specified, enable aerodynamic drag
if (m_apply_drag) {
m_vehicle->GetChassis()->SetAerodynamicDrag(m_Cd, m_area, m_air_density);
}
// Create and initialize the powertrain system
switch (m_powertrain_type) {
case PowertrainModelType::SHAFTS: {
auto powertrain = chrono_types::make_shared<FEDA_Powertrain>("Powertrain");
m_vehicle->InitializePowertrain(powertrain);
break;
}
default:
std::cout << "Warning! Powertrain type not supported. Useing SIMPLE_MAP" << std::endl;
case PowertrainModelType::SIMPLE_MAP: {
auto powertrain = chrono_types::make_shared<FEDA_SimpleMapPowertrain>("Powertrain");
m_vehicle->InitializePowertrain(powertrain);
break;
}
}
// Create the tires and set parameters depending on type.
switch (m_tireType) {
case TireModelType::RIGID_MESH:
case TireModelType::RIGID: {
bool use_mesh = (m_tireType == TireModelType::RIGID_MESH);
auto tire_FL = chrono_types::make_shared<FEDA_RigidTire>("FL", use_mesh);
auto tire_FR = chrono_types::make_shared<FEDA_RigidTire>("FR", use_mesh);
auto tire_RL = chrono_types::make_shared<FEDA_RigidTire>("RL", use_mesh);
auto tire_RR = chrono_types::make_shared<FEDA_RigidTire>("RR", use_mesh);
m_vehicle->InitializeTire(tire_FL, m_vehicle->GetAxle(0)->m_wheels[LEFT], VisualizationType::NONE);
m_vehicle->InitializeTire(tire_FR, m_vehicle->GetAxle(0)->m_wheels[RIGHT], VisualizationType::NONE);
m_vehicle->InitializeTire(tire_RL, m_vehicle->GetAxle(1)->m_wheels[LEFT], VisualizationType::NONE);
m_vehicle->InitializeTire(tire_RR, m_vehicle->GetAxle(1)->m_wheels[RIGHT], VisualizationType::NONE);
m_tire_mass = tire_FL->GetMass();
break;
}
////case TireModelType::TMEASY: {
//// auto tire_FL = chrono_types::make_shared<FEDA_TMeasyTire>("FL");
//// auto tire_FR = chrono_types::make_shared<FEDA_TMeasyTire>("FR");
//// auto tire_RL = chrono_types::make_shared<FEDA_TMeasyTire>("RL");
//// auto tire_RR = chrono_types::make_shared<FEDA_TMeasyTire>("RR");
//// m_vehicle->InitializeTire(tire_FL, m_vehicle->GetAxle(0)->m_wheels[LEFT], VisualizationType::NONE);
//// m_vehicle->InitializeTire(tire_FR, m_vehicle->GetAxle(0)->m_wheels[RIGHT], VisualizationType::NONE);
//// m_vehicle->InitializeTire(tire_RL, m_vehicle->GetAxle(1)->m_wheels[LEFT], VisualizationType::NONE);
//// m_vehicle->InitializeTire(tire_RR, m_vehicle->GetAxle(1)->m_wheels[RIGHT], VisualizationType::NONE);
//// m_tire_mass = tire_FL->GetMass();
//// break;
////}
case TireModelType::PAC02: {
auto tire_FL = chrono_types::make_shared<FEDA_Pac02Tire>("FL", m_tire_pressure_level);
auto tire_FR = chrono_types::make_shared<FEDA_Pac02Tire>("FR", m_tire_pressure_level);
auto tire_RL = chrono_types::make_shared<FEDA_Pac02Tire>("RL", m_tire_pressure_level);
auto tire_RR = chrono_types::make_shared<FEDA_Pac02Tire>("RR", m_tire_pressure_level);
m_vehicle->InitializeTire(tire_FL, m_vehicle->GetAxle(0)->m_wheels[LEFT], VisualizationType::NONE,
m_tire_collision_type);
m_vehicle->InitializeTire(tire_FR, m_vehicle->GetAxle(0)->m_wheels[RIGHT], VisualizationType::NONE,
m_tire_collision_type);
m_vehicle->InitializeTire(tire_RL, m_vehicle->GetAxle(1)->m_wheels[LEFT], VisualizationType::NONE,
m_tire_collision_type);
m_vehicle->InitializeTire(tire_RR, m_vehicle->GetAxle(1)->m_wheels[RIGHT], VisualizationType::NONE,
m_tire_collision_type);
m_tire_mass = tire_FL->GetMass();
break;
}
default:
break;
}
for (auto& axle : m_vehicle->GetAxles()) {
for (auto& wheel : axle->GetWheels()) {
if (m_tire_step_size > 0)
wheel->GetTire()->SetStepsize(m_tire_step_size);
}
}
// Recalculate vehicle mass, to properly account for all subsystems
m_vehicle->InitializeInertiaProperties();
}
// -----------------------------------------------------------------------------
void FEDA::Synchronize(double time, const DriverInputs& driver_inputs, const ChTerrain& terrain) {
m_vehicle->Synchronize(time, driver_inputs, terrain);
}
// -----------------------------------------------------------------------------
void FEDA::Advance(double step) {
m_vehicle->Advance(step);
}
} // namespace feda
} // end namespace vehicle
} // end namespace chrono
| bsd-3-clause |
kkaempf/openwbem | src/common/OW_Exception.cpp | 1 | 10349 | /*******************************************************************************
* Copyright (C) 2001-2004 Vintela, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of Vintela, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL Vintela, Inc. OR THE CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/
/**
* @author Jon Carey
* @author Dan Nuffer
*/
#include "OW_config.h"
#include "OW_Exception.hpp"
#include "OW_StackTrace.hpp"
#include "OW_Format.hpp"
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
#include "OW_Mutex.hpp"
#endif
#include <string.h>
// Not <cstring>, because strerror_r is not part of C or C++ standard lib,
// but is a POSIX function defined to be in <string.h>.
#include <cstdlib>
#if defined(OW_HAVE_ISTREAM) && defined(OW_HAVE_OSTREAM)
#include <istream>
#include <ostream>
#else
#include <iostream>
#endif
#include <algorithm> // for std::swap
namespace OW_NAMESPACE
{
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
Mutex* Exception::m_mutex = new Mutex();
#endif
//////////////////////////////////////////////////////////////////////////////
static void freeBuf(char** ptr)
{
delete [] *ptr;
*ptr = NULL;
}
//////////////////////////////////////////////////////////////////////////////
char* Exception::dupString(const char* str)
{
if (!str)
{
return 0;
}
char* rv = new (std::nothrow) char[strlen(str)+1];
if (!rv)
{
return 0;
}
strcpy(rv, str);
return rv;
}
//////////////////////////////////////////////////////////////////////////////
Exception::Exception(const char* file, int line, const char* msg)
: std::exception()
, m_file(dupString(file))
, m_line(line)
, m_msg(dupString(msg))
, m_subClassId(UNKNOWN_SUBCLASS_ID)
, m_subException(0)
, m_errorCode(UNKNOWN_ERROR_CODE)
{
#ifdef OW_ENABLE_STACK_TRACE_ON_EXCEPTIONS
StackTrace::printStackTrace();
#endif
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
m_mutex->acquire();
#endif
}
//////////////////////////////////////////////////////////////////////////////
Exception::Exception(int subClassId, const char* file, int line, const char* msg, int errorCode, const Exception* subException)
: std::exception()
, m_file(dupString(file))
, m_line(line)
, m_msg(dupString(msg))
, m_subClassId(subClassId)
, m_subException(subException ? subException->clone() : 0)
, m_errorCode(errorCode)
{
#ifdef OW_ENABLE_STACK_TRACE_ON_EXCEPTIONS
StackTrace::printStackTrace();
#endif
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
m_mutex->acquire();
#endif
}
//////////////////////////////////////////////////////////////////////////////
Exception::Exception(const char* file, int line, const char* msg, int errorCode, const Exception* subException, int subClassId)
: std::exception()
, m_file(dupString(file))
, m_line(line)
, m_msg(dupString(msg))
, m_subClassId(subClassId)
, m_subException(subException ? subException->clone() : 0)
, m_errorCode(errorCode)
{
#ifdef OW_ENABLE_STACK_TRACE_ON_EXCEPTIONS
StackTrace::printStackTrace();
#endif
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
m_mutex->acquire();
#endif
}
//////////////////////////////////////////////////////////////////////////////
Exception::Exception( const Exception& e )
: std::exception(e)
, m_file(dupString(e.m_file))
, m_line(e.m_line)
, m_msg(dupString(e.m_msg))
, m_subClassId(e.m_subClassId)
, m_subException(e.m_subException ? e.m_subException->clone() : 0)
, m_errorCode(e.m_errorCode)
{
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
m_mutex->acquire();
#endif
}
//////////////////////////////////////////////////////////////////////////////
Exception::~Exception() throw()
{
try
{
delete m_subException;
freeBuf(&m_file);
freeBuf(&m_msg);
#if defined(OW_NON_THREAD_SAFE_EXCEPTION_HANDLING)
m_mutex->release();
#endif
}
catch (...)
{
// don't let exceptions escape
}
}
//////////////////////////////////////////////////////////////////////////////
Exception&
Exception::operator=(const Exception& rhs)
{
Exception(rhs).swap(*this);
return *this;
}
//////////////////////////////////////////////////////////////////////////////
void
Exception::swap(Exception& rhs)
{
std::swap(static_cast<std::exception&>(*this), static_cast<std::exception&>(rhs));
std::swap(m_file, rhs.m_file);
std::swap(m_line, rhs.m_line);
std::swap(m_msg, rhs.m_msg);
std::swap(m_subClassId, rhs.m_subClassId);
std::swap(m_subException, rhs.m_subException);
std::swap(m_errorCode, rhs.m_errorCode);
}
//////////////////////////////////////////////////////////////////////////////
const char*
Exception::type() const
{
return "Exception";
}
//////////////////////////////////////////////////////////////////////////////
int
Exception::getLine() const
{
return m_line;
}
//////////////////////////////////////////////////////////////////////////////
const char*
Exception::getMessage() const
{
return (m_msg != NULL) ? m_msg : "";
}
//////////////////////////////////////////////////////////////////////////////
const char*
Exception::getFile() const
{
return (m_file != NULL) ? m_file : "";
}
//////////////////////////////////////////////////////////////////////////////
std::ostream&
operator<<(std::ostream& os, const Exception& e)
{
if (*e.getFile() == '\0')
{
os << "[no file]: ";
}
else
{
os << e.getFile() << ": ";
}
if (e.getLine() == 0)
{
os << "[no line] ";
}
else
{
os << e.getLine() << ' ';
}
os << e.type() << ": ";
if (*e.getMessage() == '\0')
{
os << "[no message]";
}
else
{
os << e.getMessage();
}
const Exception* subEx = e.getSubException();
if (subEx)
{
os << " <" << *subEx << '>';
}
return os;
}
//////////////////////////////////////////////////////////////////////////////
const char*
Exception::what() const throw()
{
return getMessage();
}
//////////////////////////////////////////////////////////////////////////////
int
Exception::getSubClassId() const
{
return m_subClassId;
}
//////////////////////////////////////////////////////////////////////////////
void
Exception::setSubClassId(int subClassId)
{
m_subClassId = subClassId;
}
//////////////////////////////////////////////////////////////////////////////
Exception*
Exception::clone() const
{
return new(std::nothrow) Exception(*this);
}
//////////////////////////////////////////////////////////////////////////////
const Exception*
Exception::getSubException() const
{
return m_subException;
}
//////////////////////////////////////////////////////////////////////////////
int
Exception::getErrorCode() const
{
return m_errorCode;
}
//////////////////////////////////////////////////////////////////////////////
void
Exception::setErrorCode(int errorCode)
{
m_errorCode = errorCode;
}
namespace ExceptionDetail
{
// HPUX, solaris have a thread safe strerror(), windows doesn't have strerror_r(), and doesn't document whether strerror() is thread safe or not.
#if defined(OW_HPUX) || defined(OW_SOLARIS) || defined(OW_WIN32)
void portable_strerror_r(int errnum, char * buf, unsigned n)
{
::strncpy(buf, strerror(errnum), n);
buf[n-1] = '\0'; // just in case...
}
#else
typedef int (*posix_fct)(int, char *, ::std::size_t);
typedef char * (*gnu_fct)(int, char *, ::std::size_t);
typedef int (*aix_fct)(int, char *, int);
struct dummy
{
};
// We make the strerror_r_wrap functions into templates so that
// code is generated only for the one that gets used.
template <typename Dummy>
inline int
strerror_r_wrap(posix_fct strerror_r, int errnum, char * buf, unsigned n,
Dummy)
{
return strerror_r(errnum, buf, n);
}
template <typename Dummy>
inline int
strerror_r_wrap(aix_fct strerror_r, int errnum, char * buf, unsigned n,
Dummy)
{
return strerror_r(errnum, buf, n);
}
template <typename Dummy>
inline int
strerror_r_wrap(gnu_fct strerror_r, int errnum, char * buf, unsigned n,
Dummy)
{
char * errstr = strerror_r(errnum, buf, n);
if (errstr != buf)
{
if (errstr)
{
::strncpy(buf, errstr, n);
}
else
{
return -1;
}
}
return 0;
}
void portable_strerror_r(int errnum, char * buf, unsigned n)
{
int errc = strerror_r_wrap(&::strerror_r, errnum, buf, n, dummy());
if (errc != 0)
{
::strncpy(buf, "[Could not create error message for error code]", n);
}
buf[n-1] = '\0'; // just in case...
}
#endif
struct OW_COMMON_API FormatMsgImpl
{
String fm;
};
FormatMsg::FormatMsg(char const * msg, int errnum)
: pImpl(new FormatMsgImpl)
{
char arr[BUFSZ];
portable_strerror_r(errnum, arr, BUFSZ);
char const * sarr = static_cast<char const *>(arr);
pImpl->fm = Format("%1: %2(%3)", msg, errnum, sarr).toString();
}
FormatMsg::~FormatMsg()
{
}
char const * FormatMsg::get() const
{
return pImpl->fm.c_str();
}
} // namespace ExceptionDetail
} // end namespace OW_NAMESPACE
| bsd-3-clause |
klim-iv/phantomjs-qt5 | src/webkit/Source/WebCore/css/CSSReflectValue.cpp | 1 | 2659 | /*
* Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "CSSReflectValue.h"
#include "CSSPrimitiveValue.h"
#include <wtf/text/StringBuilder.h>
using namespace std;
namespace WebCore {
String CSSReflectValue::customCSSText() const
{
if (m_mask)
return m_direction->cssText() + ' ' + m_offset->cssText() + ' ' + m_mask->cssText();
return m_direction->cssText() + ' ' + m_offset->cssText();
}
#if ENABLE(CSS_VARIABLES)
String CSSReflectValue::customSerializeResolvingVariables(const HashMap<AtomicString, String>& variables) const
{
if (m_mask)
return m_direction->customSerializeResolvingVariables(variables) + ' ' + m_offset->customSerializeResolvingVariables(variables) + ' ' + m_mask->serializeResolvingVariables(variables);
return m_direction->customSerializeResolvingVariables(variables) + ' ' + m_offset->customSerializeResolvingVariables(variables);
}
#endif
void CSSReflectValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const StyleSheetContents* styleSheet) const
{
if (m_mask)
m_mask->addSubresourceStyleURLs(urls, styleSheet);
}
bool CSSReflectValue::equals(const CSSReflectValue& other) const
{
return m_direction == other.m_direction
&& compareCSSValuePtr(m_offset, other.m_offset)
&& compareCSSValuePtr(m_mask, other.m_mask);
}
} // namespace WebCore
| bsd-3-clause |
MarginC/kame | netbsd/sys/arch/sbmips/sbmips/disksubr.c | 1 | 12429 | /* $NetBSD: disksubr.c,v 1.2 2002/03/17 06:28:57 simonb Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/disklabel.h>
#include <sys/disk.h>
#include <sys/syslog.h>
#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1)
static struct mbr_partition *
mbr_findslice(struct mbr_partition* dp, struct buf *bp);
/*
* Scan MBR for NetBSD partittion. Return NO_MBR_SIGNATURE if no MBR found
* Otherwise, copy valid MBR partition-table into dp, and if a NetBSD
* partition is found, return a pointer to it; else return NULL.
*/
static
struct mbr_partition *
mbr_findslice(dp, bp)
struct mbr_partition *dp;
struct buf *bp;
{
struct mbr_partition *ourdp = NULL;
uint16_t *mbrmagicp;
int i;
/* Note: Magic number is little-endian. */
mbrmagicp = (uint16_t *)(bp->b_data + MBR_MAGICOFF);
if (*mbrmagicp != MBR_MAGIC)
return (NO_MBR_SIGNATURE);
/* XXX how do we check veracity/bounds of this? */
memcpy(dp, bp->b_data + MBR_PARTOFF, NMBRPART * sizeof(*dp));
/* look for NetBSD partition */
for (i = 0; i < NMBRPART; i++) {
if (dp[i].mbrp_typ == MBR_PTYPE_NETBSD) {
ourdp = &dp[i];
break;
}
}
return (ourdp);
}
/*
* Attempt to read a disk label from a device
* using the indicated stategy routine.
* The label must be partly set up before this:
* secpercyl, secsize and anything required for a block i/o read
* operation in the driver's strategy/start routines
* must be filled in before calling us.
*
* If dos partition table requested, attempt to load it and
* find disklabel inside a DOS partition. Also, if bad block
* table needed, attempt to extract it as well. Return buffer
* for use in signalling errors if requested.
*
* Returns null on success and an error string on failure.
*/
char *
readdisklabel(dev, strat, lp, osdep)
dev_t dev;
void (*strat)(struct buf *);
struct disklabel *lp;
struct cpu_disklabel *osdep;
{
struct mbr_partition *dp;
struct partition *pp;
struct dkbad *bdp;
struct buf *bp;
struct disklabel *dlp;
char *msg = NULL;
int dospartoff, cyl, i;
/* minimal requirements for archtypal disk label */
if (lp->d_secsize == 0)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
#if 0
if (lp->d_ncylinders == 16383) {
printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors;
printf("%d/%d/%d\n",
lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
}
#endif
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < RAW_PART; i++) {
lp->d_partitions[i].p_size = 0;
lp->d_partitions[i].p_offset = 0;
}
if (lp->d_partitions[i].p_size == 0)
lp->d_partitions[i].p_size = 0x1fffffff;
lp->d_partitions[i].p_offset = 0;
/* get a buffer and initialize it */
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
/* do dos partitions in the process of getting disklabel? */
dospartoff = 0;
cyl = LABELSECTOR / lp->d_secpercyl;
if (!osdep)
goto nombrpart;
dp = osdep->dosparts;
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
/* if successful, wander through dos partition table */
if (biowait(bp)) {
msg = "dos partition I/O error";
goto done;
} else {
struct mbr_partition *ourdp = NULL;
ourdp = mbr_findslice(dp, bp);
if (ourdp == NO_MBR_SIGNATURE)
goto nombrpart;
for (i = 0; i < NMBRPART; i++, dp++) {
/* Install in partition e, f, g, or h. */
pp = &lp->d_partitions[RAW_PART + 1 + i];
pp->p_offset = dp->mbrp_start;
pp->p_size = dp->mbrp_size;
if (dp->mbrp_typ == MBR_PTYPE_LNXEXT2)
pp->p_fstype = FS_EX2FS;
if (dp->mbrp_typ == MBR_PTYPE_LNXSWAP)
pp->p_fstype = FS_SWAP;
/* is this ours? */
if (dp == ourdp) {
/* need sector address for SCSI/IDE,
cylinder for ESDI/ST506/RLL */
dospartoff = dp->mbrp_start;
cyl = MBR_PCYL(dp->mbrp_scyl, dp->mbrp_ssect);
/* update disklabel with details */
lp->d_partitions[2].p_size =
dp->mbrp_size;
lp->d_partitions[2].p_offset =
dp->mbrp_start;
}
}
lp->d_npartitions = RAW_PART + 1 + i;
}
nombrpart:
/* next, dig out disk label */
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
if (biowait(bp)) {
msg = "disk label I/O error";
goto done;
}
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)
(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
if (msg == NULL)
msg = "no disk label";
} else if (dlp->d_npartitions > MAXPARTITIONS ||
dkcksum(dlp) != 0)
msg = "disk label corrupted";
else {
*lp = *dlp;
msg = NULL;
break;
}
}
if (msg)
goto done;
/* obtain bad sector table if requested and present */
if (osdep && (lp->d_flags & D_BADSECT)) {
struct dkbad *db;
bdp = &osdep->bad;
i = 0;
do {
/* read a bad sector table */
bp->b_flags = B_BUSY | B_READ;
bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
if (lp->d_secsize > DEV_BSIZE)
bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
else
bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
bp->b_bcount = lp->d_secsize;
bp->b_cylinder = lp->d_ncylinders - 1;
(*strat)(bp);
/* if successful, validate, otherwise try another */
if (biowait(bp)) {
msg = "bad sector table I/O error";
} else {
db = (struct dkbad *)(bp->b_data);
#define DKBAD_MAGIC 0x4321
if (db->bt_mbz == 0
&& db->bt_flag == DKBAD_MAGIC) {
msg = NULL;
*bdp = *db;
break;
} else
msg = "bad sector table corrupted";
}
} while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
i < lp->d_nsectors);
}
done:
bp->b_flags |= B_INVAL;
brelse(bp);
return (msg);
}
/*
* Check new disk label for sensibility
* before setting it.
*/
int
setdisklabel(olp, nlp, openmask, osdep)
struct disklabel *olp, *nlp;
u_long openmask;
struct cpu_disklabel *osdep;
{
int i;
struct partition *opp, *npp;
/* sanity clause */
if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
|| (nlp->d_secsize % DEV_BSIZE) != 0)
return(EINVAL);
/* special case to allow disklabel to be invalidated */
if (nlp->d_magic == 0xffffffff) {
*olp = *nlp;
return (0);
}
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
dkcksum(nlp) != 0)
return (EINVAL);
/* XXX missing check if other dos partitions will be overwritten */
while (openmask != 0) {
i = ffs(openmask) - 1;
openmask &= ~(1 << i);
if (nlp->d_npartitions <= i)
return (EBUSY);
opp = &olp->d_partitions[i];
npp = &nlp->d_partitions[i];
if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
return (EBUSY);
/*
* Copy internally-set partition information
* if new label doesn't include it. XXX
*/
if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
npp->p_fstype = opp->p_fstype;
npp->p_fsize = opp->p_fsize;
npp->p_frag = opp->p_frag;
npp->p_cpg = opp->p_cpg;
}
}
nlp->d_checksum = 0;
nlp->d_checksum = dkcksum(nlp);
*olp = *nlp;
return (0);
}
/*
* Write disk label back to device after modification.
*/
int
writedisklabel(dev, strat, lp, osdep)
dev_t dev;
void (*strat)(struct buf *);
struct disklabel *lp;
struct cpu_disklabel *osdep;
{
struct mbr_partition *dp;
struct buf *bp;
struct disklabel *dlp;
int error, dospartoff, cyl;
/* get a buffer and initialize it */
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
/* do dos partitions in the process of getting disklabel? */
dospartoff = 0;
cyl = LABELSECTOR / lp->d_secpercyl;
if (!osdep)
goto nombrpart;
dp = osdep->dosparts;
/* read master boot record */
bp->b_blkno = MBR_BBSECTOR;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
(*strat)(bp);
if ((error = biowait(bp)) == 0) {
struct mbr_partition *ourdp = NULL;
ourdp = mbr_findslice(dp, bp);
if (ourdp == NO_MBR_SIGNATURE)
goto nombrpart;
if (ourdp) {
/* need sector address for SCSI/IDE,
cylinder for ESDI/ST506/RLL */
dospartoff = ourdp->mbrp_start;
cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect);
}
}
nombrpart:
/* next, dig out disk label */
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylinder = cyl;
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_BUSY | B_READ;
(*strat)(bp);
/* if successful, locate disk label within block and validate */
if ((error = biowait(bp)) != 0)
goto done;
for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)
(bp->b_data + lp->d_secsize - sizeof(*dlp));
dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
dkcksum(dlp) == 0) {
*dlp = *lp;
bp->b_flags = B_BUSY | B_WRITE;
(*strat)(bp);
error = biowait(bp);
goto done;
}
}
error = ESRCH;
done:
bp->b_flags |= B_INVAL;
brelse(bp);
return (error);
}
/*
* Determine the size of the transfer, and make sure it is
* within the boundaries of the partition. Adjust transfer
* if needed, and signal errors or early completion.
*/
int
bounds_check_with_label(bp, lp, wlabel)
struct buf *bp;
struct disklabel *lp;
int wlabel;
{
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
int sz;
sz = howmany(bp->b_bcount, lp->d_secsize);
if (bp->b_blkno + sz > p->p_size) {
sz = p->p_size - bp->b_blkno;
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
goto done;
}
if (sz < 0) {
/* If past end of disk, return EINVAL. */
bp->b_error = EINVAL;
goto bad;
}
/* Otherwise, truncate request. */
bp->b_bcount = sz << DEV_BSHIFT;
}
/* Overwriting disk label? */
if (bp->b_blkno + p->p_offset <= labelsector &&
#if LABELSECTOR != 0
bp->b_blkno + p->p_offset + sz > labelsector &&
#endif
(bp->b_flags & B_READ) == 0 && !wlabel) {
bp->b_error = EROFS;
goto bad;
}
/* calculate cylinder for disksort to order transfers with */
bp->b_cylinder = (bp->b_blkno + p->p_offset) /
(lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
return (1);
bad:
bp->b_flags |= B_ERROR;
done:
return (0);
}
| bsd-3-clause |
sorig/shogun | src/shogun/structure/StochasticSOSVM.cpp | 1 | 5580 | /*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Abinash Panda, Shell Hu, Soeren Sonnenburg, Fernando Iglesias,
* Bjoern Esser
*/
#include <shogun/base/progress.h>
#include <shogun/lib/SGVector.h>
#include <shogun/mathematics/Math.h>
#include <shogun/structure/StochasticSOSVM.h>
using namespace shogun;
CStochasticSOSVM::CStochasticSOSVM()
: CLinearStructuredOutputMachine()
{
init();
}
CStochasticSOSVM::CStochasticSOSVM(
CStructuredModel* model,
CStructuredLabels* labs,
bool do_weighted_averaging,
bool verbose)
: CLinearStructuredOutputMachine(model, labs)
{
REQUIRE(model != NULL && labs != NULL,
"%s::CStochasticSOSVM(): model and labels cannot be NULL!\n", get_name());
REQUIRE(labs->get_num_labels() > 0,
"%s::CStochasticSOSVM(): number of labels should be greater than 0!\n", get_name());
init();
m_lambda = 1.0 / labs->get_num_labels();
m_do_weighted_averaging = do_weighted_averaging;
m_verbose = verbose;
}
void CStochasticSOSVM::init()
{
SG_ADD(&m_lambda, "lambda", "Regularization constant");
SG_ADD(&m_num_iter, "num_iter", "Number of iterations");
SG_ADD(&m_do_weighted_averaging, "do_weighted_averaging", "Do weighted averaging");
SG_ADD(&m_debug_multiplier, "debug_multiplier", "Debug multiplier");
SG_ADD(&m_rand_seed, "rand_seed", "Random seed");
m_lambda = 1.0;
m_num_iter = 50;
m_do_weighted_averaging = true;
m_debug_multiplier = 0;
m_rand_seed = 1;
}
CStochasticSOSVM::~CStochasticSOSVM()
{
}
EMachineType CStochasticSOSVM::get_classifier_type()
{
return CT_STOCHASTICSOSVM;
}
bool CStochasticSOSVM::train_machine(CFeatures* data)
{
SG_DEBUG("Entering CStochasticSOSVM::train_machine.\n");
if (data)
set_features(data);
// Initialize the model for training
m_model->init_training();
// Check that the scenary is correct to start with training
m_model->check_training_setup();
SG_DEBUG("The training setup is correct.\n");
// Dimensionality of the joint feature space
int32_t M = m_model->get_dim();
// Number of training examples
int32_t N = m_labels->as<CStructuredLabels>()->get_num_labels();
SG_DEBUG("M=%d, N =%d.\n", M, N);
// Initialize the weight vector
m_w = SGVector<float64_t>(M);
m_w.zero();
SGVector<float64_t> w_avg;
if (m_do_weighted_averaging)
w_avg = m_w.clone();
// logging
if (m_verbose)
{
if (m_helper != NULL)
SG_UNREF(m_helper);
m_helper = new CSOSVMHelper();
SG_REF(m_helper);
}
int32_t debug_iter = 1;
if (m_debug_multiplier == 0)
{
debug_iter = N;
m_debug_multiplier = 100;
}
CMath::init_random(m_rand_seed);
// Main loop
int32_t k = 0;
for (auto pi : SG_PROGRESS(range(m_num_iter)))
{
for (int32_t si = 0; si < N; ++si)
{
// 1) Picking random example
int32_t i = CMath::random(0, N-1);
// 2) solve the loss-augmented inference for point i
CResultSet* result = m_model->argmax(m_w, i);
// 3) get the subgradient
// psi_i(y) := phi(x_i,y_i) - phi(x_i, y)
SGVector<float64_t> psi_i(M);
SGVector<float64_t> w_s(M);
if (result->psi_computed)
{
SGVector<float64_t>::add(psi_i.vector,
1.0, result->psi_truth.vector, -1.0, result->psi_pred.vector,
psi_i.vlen);
}
else if(result->psi_computed_sparse)
{
psi_i.zero();
result->psi_pred_sparse.add_to_dense(1.0, psi_i.vector, psi_i.vlen);
result->psi_truth_sparse.add_to_dense(-1.0, psi_i.vector, psi_i.vlen);
}
else
{
SG_ERROR("model(%s) should have either of psi_computed or psi_computed_sparse"
"to be set true\n", m_model->get_name());
}
w_s = psi_i.clone();
w_s.scale(1.0 / (N*m_lambda));
// 4) step-size gamma
float64_t gamma = 1.0 / (k+1.0);
// 5) finally update the weights
SGVector<float64_t>::add(m_w.vector,
1.0-gamma, m_w.vector, gamma*N, w_s.vector, m_w.vlen);
// 6) Optionally, update the weighted average
if (m_do_weighted_averaging)
{
float64_t rho = 2.0 / (k+2.0);
SGVector<float64_t>::add(w_avg.vector,
1.0-rho, w_avg.vector, rho, m_w.vector, w_avg.vlen);
}
k += 1;
SG_UNREF(result);
// Debug: compute objective and training error
if (m_verbose && k == debug_iter)
{
SGVector<float64_t> w_debug;
if (m_do_weighted_averaging)
w_debug = w_avg.clone();
else
w_debug = m_w.clone();
float64_t primal = CSOSVMHelper::primal_objective(w_debug, m_model, m_lambda);
float64_t train_error = CSOSVMHelper::average_loss(w_debug, m_model);
SG_DEBUG("pass %d (iteration %d), SVM primal = %f, train_error = %f \n",
pi, k, primal, train_error);
m_helper->add_debug_info(primal, (1.0*k) / N, train_error);
debug_iter = CMath::min(debug_iter+N, debug_iter*(1+m_debug_multiplier/100));
}
}
}
if (m_do_weighted_averaging)
m_w = w_avg.clone();
if (m_verbose)
m_helper->terminate();
SG_DEBUG("Leaving CStochasticSOSVM::train_machine.\n");
return true;
}
float64_t CStochasticSOSVM::get_lambda() const
{
return m_lambda;
}
void CStochasticSOSVM::set_lambda(float64_t lbda)
{
m_lambda = lbda;
}
int32_t CStochasticSOSVM::get_num_iter() const
{
return m_num_iter;
}
void CStochasticSOSVM::set_num_iter(int32_t num_iter)
{
m_num_iter = num_iter;
}
int32_t CStochasticSOSVM::get_debug_multiplier() const
{
return m_debug_multiplier;
}
void CStochasticSOSVM::set_debug_multiplier(int32_t multiplier)
{
m_debug_multiplier = multiplier;
}
uint32_t CStochasticSOSVM::get_rand_seed() const
{
return m_rand_seed;
}
void CStochasticSOSVM::set_rand_seed(uint32_t rand_seed)
{
m_rand_seed = rand_seed;
}
| bsd-3-clause |
dlin172/Plange | source/plc/src/document/UNIT_EXPONENTIATION.cpp | 1 | 1129 | // This file was generated using Parlex's cpp_generator
#include "UNIT_EXPONENTIATION.hpp"
#include "plange_grammar.hpp"
#include "parlex/detail/document.hpp"
#include "DIMENSION.hpp"
#include "NON_FRACTIONAL.hpp"
plc::UNIT_EXPONENTIATION plc::UNIT_EXPONENTIATION::build(parlex::detail::ast_node const & n) {
static auto const * b = state_machine().behavior;
parlex::detail::document::walk w{ n.children.cbegin(), n.children.cend() };
auto const & children = b->children;
auto v0 = parlex::detail::document::element<erased<DIMENSION>>::build(&*children[0], w);
auto v1 = parlex::detail::document::element<parlex::detail::document::text<literal_0x5E_t>>::build(&*children[1], w);
auto v2 = parlex::detail::document::element<erased<NON_FRACTIONAL>>::build(&*children[2], w);
return UNIT_EXPONENTIATION(std::move(v0), std::move(v1), std::move(v2));
}
parlex::detail::state_machine const & plc::UNIT_EXPONENTIATION::state_machine() {
static auto const & result = *static_cast<parlex::detail::state_machine const *>(&plange_grammar::get().get_recognizer(plange_grammar::get().UNIT_EXPONENTIATION));
return result;
}
| bsd-3-clause |
ViDA-NYU/TaxiVis | src/preprocess/unif96_to_bin.cpp | 1 | 2685 | #include <stdio.h>
#include <stdint.h>
#include "../TaxiVis/KdTrip.hpp"
struct Trip {
uint64_t db_idx; // 8 bytes
double pick_x, pick_y; //8+8 bytes
double drop_x, drop_y; //8+8 bytes
uint64_t pickup_time; // 8 bytes
uint64_t dropoff_time; // 8 bytes
char vendor[4]; // 4 bytes
uint32_t duration; // 4 bytes
float miles; // 4 bytes
uint32_t calc_field;//#calculated field here //4 bytes
uint16_t fare; // 2 bytes
uint16_t surcharge; // 2 bytes
uint16_t mta_tax; // 2 bytes
uint16_t tip; // 2 bytes
uint16_t toll; // 2 bytes
uint16_t total; // 2 bytes
uint16_t medallion_id; // 2 bytes
uint16_t license_id; // 2 bytes
bool store_and_forward; // 1 byte
uint8_t payment_type; // 2 byte
uint8_t passengers; // 1 byte
uint8_t rate_code; // 1 byte
};
// The calc_field use the order below
//0 id, 1 medallion_id, 2 license_id, 3 pick_time, 4 drop_time, 5 vendor, 6 rate_code
//7 store_fwd, 8 passengers, 9 duration, 10 miles, 11 fare, 12 surcharge, 13 mta_tax
//14 tip, 15 toll, 16 total, 17 payment_type, 18 19 pick_loc, 20 21 drop_loc
// We want these bits to be mandatory
// 0 id
// 1 medallion_id
// 3 pick_time
//
// 4 drop_time
//
// 9 duration
// 10 miles
// 11 fares
//
// 14 tip
// 15 toll
//
// 16 total
// 18 pick_loc
// 19 pick_loc
//
// 20 drop_loc
// 21 drop_loc
// MASK = (bin)11 1101 1100 1110 0001 1011
// MASK = (hex) 3 d c e 1 b
// MASK = 0x3dce1b
int main(int argc, char **argv)
{
FILE *fi = fopen(argv[1], "rb");
FILE *fo = fopen(argv[2], "wb");
int totalCount = 0;
int validCount = 0;
Trip t;
KdTrip::Trip to;
uint32_t MASK = ~0x3dce1b;
while (fread(&t, 1, sizeof(t), fi)>0) {
totalCount++;
if ((t.calc_field & MASK)==t.calc_field) {
validCount++;
to.pickup_time = t.pickup_time;
to.dropoff_time = t.dropoff_time;
to.pickup_long = t.pick_x;
to.pickup_lat = t.pick_y;
to.dropoff_long = t.drop_x;
to.dropoff_lat = t.drop_y;
to.distance = t.miles*100;
to.fare_amount = t.fare;
to.surcharge = t.surcharge;
to.mta_tax = t.mta_tax;
to.tip_amount = t.tip;
to.tolls_amount = t.toll;
to.id_taxi = t.medallion_id;
to.payment_type = t.payment_type;
to.passengers = t.passengers;
fwrite(&to, 1, sizeof(to), fo);
}
if (totalCount%1000000==0) {
fprintf(stderr, "\r%d/%d", validCount, totalCount);
}
}
fprintf(stderr, "\n");
fclose(fi);
fclose(fo);
}
| bsd-3-clause |
DiamondLovesYou/skia-sys | src/images/SkImageDecoder_libpng.cpp | 2 | 47299 | /*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkImageDecoder.h"
#include "SkImageEncoder.h"
#include "SkColor.h"
#include "SkColorPriv.h"
#include "SkDither.h"
#include "SkMath.h"
#include "SkRTConf.h"
#include "SkScaledBitmapSampler.h"
#include "SkStream.h"
#include "SkTemplates.h"
#include "SkUtils.h"
#include "transform_scanline.h"
extern "C" {
#include "png.h"
}
/* These were dropped in libpng >= 1.4 */
#ifndef png_infopp_NULL
#define png_infopp_NULL NULL
#endif
#ifndef png_bytepp_NULL
#define png_bytepp_NULL NULL
#endif
#ifndef int_p_NULL
#define int_p_NULL NULL
#endif
#ifndef png_flush_ptr_NULL
#define png_flush_ptr_NULL NULL
#endif
#if defined(SK_DEBUG)
#define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS false
#else // !defined(SK_DEBUG)
#define DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS true
#endif // defined(SK_DEBUG)
SK_CONF_DECLARE(bool, c_suppressPNGImageDecoderWarnings,
"images.png.suppressDecoderWarnings",
DEFAULT_FOR_SUPPRESS_PNG_IMAGE_DECODER_WARNINGS,
"Suppress most PNG warnings when calling image decode "
"functions.");
class SkPNGImageIndex {
public:
SkPNGImageIndex(SkStreamRewindable* stream, png_structp png_ptr, png_infop info_ptr)
: fStream(stream)
, fPng_ptr(png_ptr)
, fInfo_ptr(info_ptr)
, fColorType(kUnknown_SkColorType) {
SkASSERT(stream != NULL);
stream->ref();
}
~SkPNGImageIndex() {
if (fPng_ptr) {
png_destroy_read_struct(&fPng_ptr, &fInfo_ptr, png_infopp_NULL);
}
}
SkAutoTUnref<SkStreamRewindable> fStream;
png_structp fPng_ptr;
png_infop fInfo_ptr;
SkColorType fColorType;
};
class SkPNGImageDecoder : public SkImageDecoder {
public:
SkPNGImageDecoder() {
fImageIndex = NULL;
}
virtual Format getFormat() const SK_OVERRIDE {
return kPNG_Format;
}
virtual ~SkPNGImageDecoder() {
SkDELETE(fImageIndex);
}
protected:
#ifdef SK_BUILD_FOR_ANDROID
virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) SK_OVERRIDE;
virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& region) SK_OVERRIDE;
#endif
virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
private:
SkPNGImageIndex* fImageIndex;
bool onDecodeInit(SkStream* stream, png_structp *png_ptrp, png_infop *info_ptrp);
bool decodePalette(png_structp png_ptr, png_infop info_ptr,
bool * SK_RESTRICT hasAlphap, bool *reallyHasAlphap,
SkColorTable **colorTablep);
bool getBitmapColorType(png_structp, png_infop, SkColorType*, bool* hasAlpha,
SkPMColor* theTranspColor);
typedef SkImageDecoder INHERITED;
};
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif
#define PNG_BYTES_TO_CHECK 4
/* Automatically clean up after throwing an exception */
struct PNGAutoClean {
PNGAutoClean(png_structp p, png_infop i): png_ptr(p), info_ptr(i) {}
~PNGAutoClean() {
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
}
private:
png_structp png_ptr;
png_infop info_ptr;
};
static void sk_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) {
SkStream* sk_stream = (SkStream*) png_get_io_ptr(png_ptr);
size_t bytes = sk_stream->read(data, length);
if (bytes != length) {
png_error(png_ptr, "Read Error!");
}
}
#ifdef SK_BUILD_FOR_ANDROID
static void sk_seek_fn(png_structp png_ptr, png_uint_32 offset) {
SkStreamRewindable* sk_stream = (SkStreamRewindable*) png_get_io_ptr(png_ptr);
if (!sk_stream->rewind()) {
png_error(png_ptr, "Failed to rewind stream!");
}
(void)sk_stream->skip(offset);
}
#endif
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
static int sk_read_user_chunk(png_structp png_ptr, png_unknown_chunkp chunk) {
SkImageDecoder::Peeker* peeker =
(SkImageDecoder::Peeker*)png_get_user_chunk_ptr(png_ptr);
// peek() returning true means continue decoding
return peeker->peek((const char*)chunk->name, chunk->data, chunk->size) ?
1 : -1;
}
#endif
static void sk_error_fn(png_structp png_ptr, png_const_charp msg) {
SkDEBUGF(("------ png error %s\n", msg));
longjmp(png_jmpbuf(png_ptr), 1);
}
static void skip_src_rows(png_structp png_ptr, uint8_t storage[], int count) {
for (int i = 0; i < count; i++) {
uint8_t* tmp = storage;
png_read_rows(png_ptr, &tmp, png_bytepp_NULL, 1);
}
}
static bool pos_le(int value, int max) {
return value > 0 && value <= max;
}
static bool substituteTranspColor(SkBitmap* bm, SkPMColor match) {
SkASSERT(bm->colorType() == kN32_SkColorType);
bool reallyHasAlpha = false;
for (int y = bm->height() - 1; y >= 0; --y) {
SkPMColor* p = bm->getAddr32(0, y);
for (int x = bm->width() - 1; x >= 0; --x) {
if (match == *p) {
*p = 0;
reallyHasAlpha = true;
}
p += 1;
}
}
return reallyHasAlpha;
}
static bool canUpscalePaletteToConfig(SkColorType dstColorType, bool srcHasAlpha) {
switch (dstColorType) {
case kN32_SkColorType:
case kARGB_4444_SkColorType:
return true;
case kRGB_565_SkColorType:
// only return true if the src is opaque (since 565 is opaque)
return !srcHasAlpha;
default:
return false;
}
}
// call only if color_type is PALETTE. Returns true if the ctable has alpha
static bool hasTransparencyInPalette(png_structp png_ptr, png_infop info_ptr) {
png_bytep trans;
int num_trans;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, NULL);
return num_trans > 0;
}
return false;
}
void do_nothing_warning_fn(png_structp, png_const_charp) {
/* do nothing */
}
bool SkPNGImageDecoder::onDecodeInit(SkStream* sk_stream, png_structp *png_ptrp,
png_infop *info_ptrp) {
/* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method,
* you can supply NULL for the last three parameters. We also supply the
* the compiler header file version, so that we know if the application
* was compiled with a compatible version of the library. */
png_error_ptr user_warning_fn =
(c_suppressPNGImageDecoderWarnings) ? (&do_nothing_warning_fn) : NULL;
/* NULL means to leave as default library behavior. */
/* c_suppressPNGImageDecoderWarnings default depends on SK_DEBUG. */
/* To suppress warnings with a SK_DEBUG binary, set the
* environment variable "skia_images_png_suppressDecoderWarnings"
* to "true". Inside a program that links to skia:
* SK_CONF_SET("images.png.suppressDecoderWarnings", true); */
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL, sk_error_fn, user_warning_fn);
// png_voidp user_error_ptr, user_error_fn, user_warning_fn);
if (png_ptr == NULL) {
return false;
}
*png_ptrp = png_ptr;
/* Allocate/initialize the memory for image information. */
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
png_destroy_read_struct(&png_ptr, png_infopp_NULL, png_infopp_NULL);
return false;
}
*info_ptrp = info_ptr;
/* Set error handling if you are using the setjmp/longjmp method (this is
* the normal method of doing things with libpng). REQUIRED unless you
* set up your own error handlers in the png_create_read_struct() earlier.
*/
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
return false;
}
/* If you are using replacement read functions, instead of calling
* png_init_io() here you would call:
*/
png_set_read_fn(png_ptr, (void *)sk_stream, sk_read_fn);
#ifdef SK_BUILD_FOR_ANDROID
png_set_seek_fn(png_ptr, sk_seek_fn);
#endif
/* where user_io_ptr is a structure you want available to the callbacks */
/* If we have already read some of the signature */
// png_set_sig_bytes(png_ptr, 0 /* sig_read */ );
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
// hookup our peeker so we can see any user-chunks the caller may be interested in
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_ALWAYS, (png_byte*)"", 0);
if (this->getPeeker()) {
png_set_read_user_chunk_fn(png_ptr, (png_voidp)this->getPeeker(), sk_read_user_chunk);
}
#endif
/* The call to png_read_info() gives us all of the information from the
* PNG file before the first IDAT (image data chunk). */
png_read_info(png_ptr, info_ptr);
png_uint_32 origWidth, origHeight;
int bitDepth, colorType;
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
&colorType, int_p_NULL, int_p_NULL, int_p_NULL);
/* tell libpng to strip 16 bit/color files down to 8 bits/color */
if (bitDepth == 16) {
png_set_strip_16(png_ptr);
}
#ifdef PNG_READ_PACK_SUPPORTED
/* Extract multiple pixels with bit depths of 1, 2, and 4 from a single
* byte into separate bytes (useful for paletted and grayscale images). */
if (bitDepth < 8) {
png_set_packing(png_ptr);
}
#endif
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
if (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8) {
png_set_expand_gray_1_2_4_to_8(png_ptr);
}
return true;
}
SkImageDecoder::Result SkPNGImageDecoder::onDecode(SkStream* sk_stream, SkBitmap* decodedBitmap,
Mode mode) {
png_structp png_ptr;
png_infop info_ptr;
if (!onDecodeInit(sk_stream, &png_ptr, &info_ptr)) {
return kFailure;
}
PNGAutoClean autoClean(png_ptr, info_ptr);
if (setjmp(png_jmpbuf(png_ptr))) {
return kFailure;
}
png_uint_32 origWidth, origHeight;
int bitDepth, pngColorType, interlaceType;
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
&pngColorType, &interlaceType, int_p_NULL, int_p_NULL);
SkColorType colorType;
bool hasAlpha = false;
SkPMColor theTranspColor = 0; // 0 tells us not to try to match
if (!this->getBitmapColorType(png_ptr, info_ptr, &colorType, &hasAlpha, &theTranspColor)) {
return kFailure;
}
SkAlphaType alphaType = this->getRequireUnpremultipliedColors() ?
kUnpremul_SkAlphaType : kPremul_SkAlphaType;
const int sampleSize = this->getSampleSize();
SkScaledBitmapSampler sampler(origWidth, origHeight, sampleSize);
decodedBitmap->setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
colorType, alphaType));
if (SkImageDecoder::kDecodeBounds_Mode == mode) {
return kSuccess;
}
// from here down we are concerned with colortables and pixels
// we track if we actually see a non-opaque pixels, since sometimes a PNG sets its colortype
// to |= PNG_COLOR_MASK_ALPHA, but all of its pixels are in fact opaque. We care, since we
// draw lots faster if we can flag the bitmap has being opaque
bool reallyHasAlpha = false;
SkColorTable* colorTable = NULL;
if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
decodePalette(png_ptr, info_ptr, &hasAlpha, &reallyHasAlpha, &colorTable);
}
SkAutoUnref aur(colorTable);
if (!this->allocPixelRef(decodedBitmap,
kIndex_8_SkColorType == colorType ? colorTable : NULL)) {
return kFailure;
}
SkAutoLockPixels alp(*decodedBitmap);
/* Turn on interlace handling. REQUIRED if you are not using
* png_read_image(). To see how to handle interlacing passes,
* see the png_read_row() method below:
*/
const int number_passes = (interlaceType != PNG_INTERLACE_NONE) ?
png_set_interlace_handling(png_ptr) : 1;
/* Optional call to gamma correct and add the background to the palette
* and update info structure. REQUIRED if you are expecting libpng to
* update the palette for you (ie you selected such a transform above).
*/
png_read_update_info(png_ptr, info_ptr);
if ((kAlpha_8_SkColorType == colorType || kIndex_8_SkColorType == colorType) &&
1 == sampleSize) {
if (kAlpha_8_SkColorType == colorType) {
// For an A8 bitmap, we assume there is an alpha for speed. It is
// possible the bitmap is opaque, but that is an unlikely use case
// since it would not be very interesting.
reallyHasAlpha = true;
// A8 is only allowed if the original was GRAY.
SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
}
for (int i = 0; i < number_passes; i++) {
for (png_uint_32 y = 0; y < origHeight; y++) {
uint8_t* bmRow = decodedBitmap->getAddr8(0, y);
png_read_rows(png_ptr, &bmRow, png_bytepp_NULL, 1);
}
}
} else {
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
if (colorTable != NULL) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
} else if (kAlpha_8_SkColorType == colorType) {
// A8 is only allowed if the original was GRAY.
SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
sc = SkScaledBitmapSampler::kGray;
srcBytesPerPixel = 1;
} else if (hasAlpha) {
sc = SkScaledBitmapSampler::kRGBA;
} else {
sc = SkScaledBitmapSampler::kRGBX;
}
/* We have to pass the colortable explicitly, since we may have one
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
if (!sampler.begin(decodedBitmap, sc, *this, colors)) {
return kFailure;
}
const int height = decodedBitmap->height();
if (number_passes > 1) {
SkAutoMalloc storage(origWidth * origHeight * srcBytesPerPixel);
uint8_t* base = (uint8_t*)storage.get();
size_t rowBytes = origWidth * srcBytesPerPixel;
for (int i = 0; i < number_passes; i++) {
uint8_t* row = base;
for (png_uint_32 y = 0; y < origHeight; y++) {
uint8_t* bmRow = row;
png_read_rows(png_ptr, &bmRow, png_bytepp_NULL, 1);
row += rowBytes;
}
}
// now sample it
base += sampler.srcY0() * rowBytes;
for (int y = 0; y < height; y++) {
reallyHasAlpha |= sampler.next(base);
base += sampler.srcDY() * rowBytes;
}
} else {
SkAutoMalloc storage(origWidth * srcBytesPerPixel);
uint8_t* srcRow = (uint8_t*)storage.get();
skip_src_rows(png_ptr, srcRow, sampler.srcY0());
for (int y = 0; y < height; y++) {
uint8_t* tmp = srcRow;
png_read_rows(png_ptr, &tmp, png_bytepp_NULL, 1);
reallyHasAlpha |= sampler.next(srcRow);
if (y < height - 1) {
skip_src_rows(png_ptr, srcRow, sampler.srcDY() - 1);
}
}
// skip the rest of the rows (if any)
png_uint_32 read = (height - 1) * sampler.srcDY() +
sampler.srcY0() + 1;
SkASSERT(read <= origHeight);
skip_src_rows(png_ptr, srcRow, origHeight - read);
}
}
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
if (0 != theTranspColor) {
reallyHasAlpha |= substituteTranspColor(decodedBitmap, theTranspColor);
}
if (reallyHasAlpha && this->getRequireUnpremultipliedColors()) {
switch (decodedBitmap->colorType()) {
case kIndex_8_SkColorType:
// Fall through.
case kARGB_4444_SkColorType:
// We have chosen not to support unpremul for these colortypes.
return kFailure;
default: {
// Fall through to finish the decode. This colortype either
// supports unpremul or it is irrelevant because it has no
// alpha (or only alpha).
// These brackets prevent a warning.
}
}
}
if (!reallyHasAlpha) {
decodedBitmap->setAlphaType(kOpaque_SkAlphaType);
}
return kSuccess;
}
bool SkPNGImageDecoder::getBitmapColorType(png_structp png_ptr, png_infop info_ptr,
SkColorType* colorTypep,
bool* hasAlphap,
SkPMColor* SK_RESTRICT theTranspColorp) {
png_uint_32 origWidth, origHeight;
int bitDepth, colorType;
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
&colorType, int_p_NULL, int_p_NULL, int_p_NULL);
#ifdef PNG_sBIT_SUPPORTED
// check for sBIT chunk data, in case we should disable dithering because
// our data is not truely 8bits per component
png_color_8p sig_bit;
if (this->getDitherImage() && png_get_sBIT(png_ptr, info_ptr, &sig_bit)) {
#if 0
SkDebugf("----- sBIT %d %d %d %d\n", sig_bit->red, sig_bit->green,
sig_bit->blue, sig_bit->alpha);
#endif
// 0 seems to indicate no information available
if (pos_le(sig_bit->red, SK_R16_BITS) &&
pos_le(sig_bit->green, SK_G16_BITS) &&
pos_le(sig_bit->blue, SK_B16_BITS)) {
this->setDitherImage(false);
}
}
#endif
if (colorType == PNG_COLOR_TYPE_PALETTE) {
bool paletteHasAlpha = hasTransparencyInPalette(png_ptr, info_ptr);
*colorTypep = this->getPrefColorType(kIndex_SrcDepth, paletteHasAlpha);
// now see if we can upscale to their requested colortype
if (!canUpscalePaletteToConfig(*colorTypep, paletteHasAlpha)) {
*colorTypep = kIndex_8_SkColorType;
}
} else {
png_color_16p transpColor = NULL;
int numTransp = 0;
png_get_tRNS(png_ptr, info_ptr, NULL, &numTransp, &transpColor);
bool valid = png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS);
if (valid && numTransp == 1 && transpColor != NULL) {
/* Compute our transparent color, which we'll match against later.
We don't really handle 16bit components properly here, since we
do our compare *after* the values have been knocked down to 8bit
which means we will find more matches than we should. The real
fix seems to be to see the actual 16bit components, do the
compare, and then knock it down to 8bits ourselves.
*/
if (colorType & PNG_COLOR_MASK_COLOR) {
if (16 == bitDepth) {
*theTranspColorp = SkPackARGB32(0xFF, transpColor->red >> 8,
transpColor->green >> 8,
transpColor->blue >> 8);
} else {
/* We apply the mask because in a very small
number of corrupt PNGs, (transpColor->red > 255)
and (bitDepth == 8), for certain versions of libpng. */
*theTranspColorp = SkPackARGB32(0xFF,
0xFF & (transpColor->red),
0xFF & (transpColor->green),
0xFF & (transpColor->blue));
}
} else { // gray
if (16 == bitDepth) {
*theTranspColorp = SkPackARGB32(0xFF, transpColor->gray >> 8,
transpColor->gray >> 8,
transpColor->gray >> 8);
} else {
/* We apply the mask because in a very small
number of corrupt PNGs, (transpColor->red >
255) and (bitDepth == 8), for certain versions
of libpng. For safety we assume the same could
happen with a grayscale PNG. */
*theTranspColorp = SkPackARGB32(0xFF,
0xFF & (transpColor->gray),
0xFF & (transpColor->gray),
0xFF & (transpColor->gray));
}
}
}
if (valid ||
PNG_COLOR_TYPE_RGB_ALPHA == colorType ||
PNG_COLOR_TYPE_GRAY_ALPHA == colorType) {
*hasAlphap = true;
}
SrcDepth srcDepth = k32Bit_SrcDepth;
if (PNG_COLOR_TYPE_GRAY == colorType) {
srcDepth = k8BitGray_SrcDepth;
// Remove this assert, which fails on desk_pokemonwiki.skp
//SkASSERT(!*hasAlphap);
}
*colorTypep = this->getPrefColorType(srcDepth, *hasAlphap);
// now match the request against our capabilities
if (*hasAlphap) {
if (*colorTypep != kARGB_4444_SkColorType) {
*colorTypep = kN32_SkColorType;
}
} else {
if (kAlpha_8_SkColorType == *colorTypep) {
if (k8BitGray_SrcDepth != srcDepth) {
// Converting a non grayscale image to A8 is not currently supported.
*colorTypep = kN32_SkColorType;
}
} else if (*colorTypep != kRGB_565_SkColorType &&
*colorTypep != kARGB_4444_SkColorType) {
*colorTypep = kN32_SkColorType;
}
}
}
// sanity check for size
{
int64_t size = sk_64_mul(origWidth, origHeight);
// now check that if we are 4-bytes per pixel, we also don't overflow
if (size < 0 || size > (0x7FFFFFFF >> 2)) {
return false;
}
}
// If the image has alpha and the decoder wants unpremultiplied
// colors, the only supported colortype is 8888.
if (this->getRequireUnpremultipliedColors() && *hasAlphap) {
*colorTypep = kN32_SkColorType;
}
if (fImageIndex != NULL) {
if (kUnknown_SkColorType == fImageIndex->fColorType) {
// This is the first time for this subset decode. From now on,
// all decodes must be in the same colortype.
fImageIndex->fColorType = *colorTypep;
} else if (fImageIndex->fColorType != *colorTypep) {
// Requesting a different colortype for a subsequent decode is not
// supported. Report failure before we make changes to png_ptr.
return false;
}
}
bool convertGrayToRGB = PNG_COLOR_TYPE_GRAY == colorType && *colorTypep != kAlpha_8_SkColorType;
// Unless the user is requesting A8, convert a grayscale image into RGB.
// GRAY_ALPHA will always be converted to RGB
if (convertGrayToRGB || colorType == PNG_COLOR_TYPE_GRAY_ALPHA) {
png_set_gray_to_rgb(png_ptr);
}
// Add filler (or alpha) byte (after each RGB triplet) if necessary.
if (colorType == PNG_COLOR_TYPE_RGB || convertGrayToRGB) {
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
}
return true;
}
typedef uint32_t (*PackColorProc)(U8CPU a, U8CPU r, U8CPU g, U8CPU b);
bool SkPNGImageDecoder::decodePalette(png_structp png_ptr, png_infop info_ptr,
bool *hasAlphap, bool *reallyHasAlphap,
SkColorTable **colorTablep) {
int numPalette;
png_colorp palette;
png_bytep trans;
int numTrans;
png_get_PLTE(png_ptr, info_ptr, &palette, &numPalette);
/* BUGGY IMAGE WORKAROUND
We hit some images (e.g. fruit_.png) who contain bytes that are == colortable_count
which is a problem since we use the byte as an index. To work around this we grow
the colortable by 1 (if its < 256) and duplicate the last color into that slot.
*/
int colorCount = numPalette + (numPalette < 256);
SkPMColor colorStorage[256]; // worst-case storage
SkPMColor* colorPtr = colorStorage;
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_get_tRNS(png_ptr, info_ptr, &trans, &numTrans, NULL);
*hasAlphap = (numTrans > 0);
} else {
numTrans = 0;
}
// check for bad images that might make us crash
if (numTrans > numPalette) {
numTrans = numPalette;
}
int index = 0;
int transLessThanFF = 0;
// Choose which function to use to create the color table. If the final destination's
// colortype is unpremultiplied, the color table will store unpremultiplied colors.
PackColorProc proc;
if (this->getRequireUnpremultipliedColors()) {
proc = &SkPackARGB32NoCheck;
} else {
proc = &SkPreMultiplyARGB;
}
for (; index < numTrans; index++) {
transLessThanFF |= (int)*trans - 0xFF;
*colorPtr++ = proc(*trans++, palette->red, palette->green, palette->blue);
palette++;
}
bool reallyHasAlpha = (transLessThanFF < 0);
for (; index < numPalette; index++) {
*colorPtr++ = SkPackARGB32(0xFF, palette->red, palette->green, palette->blue);
palette++;
}
// see BUGGY IMAGE WORKAROUND comment above
if (numPalette < 256) {
*colorPtr = colorPtr[-1];
}
*colorTablep = SkNEW_ARGS(SkColorTable, (colorStorage, colorCount));
*reallyHasAlphap = reallyHasAlpha;
return true;
}
#ifdef SK_BUILD_FOR_ANDROID
bool SkPNGImageDecoder::onBuildTileIndex(SkStreamRewindable* sk_stream, int *width, int *height) {
png_structp png_ptr;
png_infop info_ptr;
if (!onDecodeInit(sk_stream, &png_ptr, &info_ptr)) {
return false;
}
if (setjmp(png_jmpbuf(png_ptr)) != 0) {
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
return false;
}
png_uint_32 origWidth, origHeight;
int bitDepth, colorType;
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
&colorType, int_p_NULL, int_p_NULL, int_p_NULL);
*width = origWidth;
*height = origHeight;
png_build_index(png_ptr);
if (fImageIndex) {
SkDELETE(fImageIndex);
}
fImageIndex = SkNEW_ARGS(SkPNGImageIndex, (sk_stream, png_ptr, info_ptr));
return true;
}
bool SkPNGImageDecoder::onDecodeSubset(SkBitmap* bm, const SkIRect& region) {
if (NULL == fImageIndex) {
return false;
}
png_structp png_ptr = fImageIndex->fPng_ptr;
png_infop info_ptr = fImageIndex->fInfo_ptr;
if (setjmp(png_jmpbuf(png_ptr))) {
return false;
}
png_uint_32 origWidth, origHeight;
int bitDepth, pngColorType, interlaceType;
png_get_IHDR(png_ptr, info_ptr, &origWidth, &origHeight, &bitDepth,
&pngColorType, &interlaceType, int_p_NULL, int_p_NULL);
SkIRect rect = SkIRect::MakeWH(origWidth, origHeight);
if (!rect.intersect(region)) {
// If the requested region is entirely outside the image, just
// returns false
return false;
}
SkColorType colorType;
bool hasAlpha = false;
SkPMColor theTranspColor = 0; // 0 tells us not to try to match
if (!this->getBitmapColorType(png_ptr, info_ptr, &colorType, &hasAlpha, &theTranspColor)) {
return false;
}
const int sampleSize = this->getSampleSize();
SkScaledBitmapSampler sampler(origWidth, rect.height(), sampleSize);
SkBitmap decodedBitmap;
decodedBitmap.setInfo(SkImageInfo::Make(sampler.scaledWidth(), sampler.scaledHeight(),
colorType, kPremul_SkAlphaType));
// from here down we are concerned with colortables and pixels
// we track if we actually see a non-opaque pixels, since sometimes a PNG sets its colortype
// to |= PNG_COLOR_MASK_ALPHA, but all of its pixels are in fact opaque. We care, since we
// draw lots faster if we can flag the bitmap has being opaque
bool reallyHasAlpha = false;
SkColorTable* colorTable = NULL;
if (pngColorType == PNG_COLOR_TYPE_PALETTE) {
decodePalette(png_ptr, info_ptr, &hasAlpha, &reallyHasAlpha, &colorTable);
}
SkAutoUnref aur(colorTable);
// Check ahead of time if the swap(dest, src) is possible.
// If yes, then we will stick to AllocPixelRef since it's cheaper with the swap happening.
// If no, then we will use alloc to allocate pixels to prevent garbage collection.
int w = rect.width() / sampleSize;
int h = rect.height() / sampleSize;
const bool swapOnly = (rect == region) && (w == decodedBitmap.width()) &&
(h == decodedBitmap.height()) && bm->isNull();
const bool needColorTable = kIndex_8_SkColorType == colorType;
if (swapOnly) {
if (!this->allocPixelRef(&decodedBitmap, needColorTable ? colorTable : NULL)) {
return false;
}
} else {
if (!decodedBitmap.tryAllocPixels(NULL, needColorTable ? colorTable : NULL)) {
return false;
}
}
SkAutoLockPixels alp(decodedBitmap);
/* Turn on interlace handling. REQUIRED if you are not using
* png_read_image(). To see how to handle interlacing passes,
* see the png_read_row() method below:
*/
const int number_passes = (interlaceType != PNG_INTERLACE_NONE) ?
png_set_interlace_handling(png_ptr) : 1;
/* Optional call to gamma correct and add the background to the palette
* and update info structure. REQUIRED if you are expecting libpng to
* update the palette for you (ie you selected such a transform above).
*/
// Direct access to png_ptr fields is deprecated in libpng > 1.2.
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
png_ptr->pass = 0;
#else
// FIXME: This sets pass as desired, but also sets iwidth. Is that ok?
png_set_interlaced_pass(png_ptr, 0);
#endif
png_read_update_info(png_ptr, info_ptr);
int actualTop = rect.fTop;
if ((kAlpha_8_SkColorType == colorType || kIndex_8_SkColorType == colorType)
&& 1 == sampleSize) {
if (kAlpha_8_SkColorType == colorType) {
// For an A8 bitmap, we assume there is an alpha for speed. It is
// possible the bitmap is opaque, but that is an unlikely use case
// since it would not be very interesting.
reallyHasAlpha = true;
// A8 is only allowed if the original was GRAY.
SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
}
for (int i = 0; i < number_passes; i++) {
png_configure_decoder(png_ptr, &actualTop, i);
for (int j = 0; j < rect.fTop - actualTop; j++) {
uint8_t* bmRow = decodedBitmap.getAddr8(0, 0);
png_read_rows(png_ptr, &bmRow, png_bytepp_NULL, 1);
}
png_uint_32 bitmapHeight = (png_uint_32) decodedBitmap.height();
for (png_uint_32 y = 0; y < bitmapHeight; y++) {
uint8_t* bmRow = decodedBitmap.getAddr8(0, y);
png_read_rows(png_ptr, &bmRow, png_bytepp_NULL, 1);
}
}
} else {
SkScaledBitmapSampler::SrcConfig sc;
int srcBytesPerPixel = 4;
if (colorTable != NULL) {
sc = SkScaledBitmapSampler::kIndex;
srcBytesPerPixel = 1;
} else if (kAlpha_8_SkColorType == colorType) {
// A8 is only allowed if the original was GRAY.
SkASSERT(PNG_COLOR_TYPE_GRAY == pngColorType);
sc = SkScaledBitmapSampler::kGray;
srcBytesPerPixel = 1;
} else if (hasAlpha) {
sc = SkScaledBitmapSampler::kRGBA;
} else {
sc = SkScaledBitmapSampler::kRGBX;
}
/* We have to pass the colortable explicitly, since we may have one
even if our decodedBitmap doesn't, due to the request that we
upscale png's palette to a direct model
*/
const SkPMColor* colors = colorTable ? colorTable->readColors() : NULL;
if (!sampler.begin(&decodedBitmap, sc, *this, colors)) {
return false;
}
const int height = decodedBitmap.height();
if (number_passes > 1) {
SkAutoMalloc storage(origWidth * origHeight * srcBytesPerPixel);
uint8_t* base = (uint8_t*)storage.get();
size_t rb = origWidth * srcBytesPerPixel;
for (int i = 0; i < number_passes; i++) {
png_configure_decoder(png_ptr, &actualTop, i);
for (int j = 0; j < rect.fTop - actualTop; j++) {
png_read_rows(png_ptr, &base, png_bytepp_NULL, 1);
}
uint8_t* row = base;
for (int32_t y = 0; y < rect.height(); y++) {
uint8_t* bmRow = row;
png_read_rows(png_ptr, &bmRow, png_bytepp_NULL, 1);
row += rb;
}
}
// now sample it
base += sampler.srcY0() * rb;
for (int y = 0; y < height; y++) {
reallyHasAlpha |= sampler.next(base);
base += sampler.srcDY() * rb;
}
} else {
SkAutoMalloc storage(origWidth * srcBytesPerPixel);
uint8_t* srcRow = (uint8_t*)storage.get();
png_configure_decoder(png_ptr, &actualTop, 0);
skip_src_rows(png_ptr, srcRow, sampler.srcY0());
for (int i = 0; i < rect.fTop - actualTop; i++) {
png_read_rows(png_ptr, &srcRow, png_bytepp_NULL, 1);
}
for (int y = 0; y < height; y++) {
uint8_t* tmp = srcRow;
png_read_rows(png_ptr, &tmp, png_bytepp_NULL, 1);
reallyHasAlpha |= sampler.next(srcRow);
if (y < height - 1) {
skip_src_rows(png_ptr, srcRow, sampler.srcDY() - 1);
}
}
}
}
if (0 != theTranspColor) {
reallyHasAlpha |= substituteTranspColor(&decodedBitmap, theTranspColor);
}
if (reallyHasAlpha && this->getRequireUnpremultipliedColors()) {
switch (decodedBitmap.colorType()) {
case kIndex_8_SkColorType:
// Fall through.
case kARGB_4444_SkColorType:
// We have chosen not to support unpremul for these colortypess.
return false;
default: {
// Fall through to finish the decode. This config either
// supports unpremul or it is irrelevant because it has no
// alpha (or only alpha).
// These brackets prevent a warning.
}
}
}
SkAlphaType alphaType = kOpaque_SkAlphaType;
if (reallyHasAlpha) {
if (this->getRequireUnpremultipliedColors()) {
alphaType = kUnpremul_SkAlphaType;
} else {
alphaType = kPremul_SkAlphaType;
}
}
decodedBitmap.setAlphaType(alphaType);
if (swapOnly) {
bm->swap(decodedBitmap);
return true;
}
return this->cropBitmap(bm, &decodedBitmap, sampleSize, region.x(), region.y(),
region.width(), region.height(), 0, rect.y());
}
#endif
///////////////////////////////////////////////////////////////////////////////
#include "SkColorPriv.h"
#include "SkUnPreMultiply.h"
static void sk_write_fn(png_structp png_ptr, png_bytep data, png_size_t len) {
SkWStream* sk_stream = (SkWStream*)png_get_io_ptr(png_ptr);
if (!sk_stream->write(data, len)) {
png_error(png_ptr, "sk_write_fn Error!");
}
}
static transform_scanline_proc choose_proc(SkColorType ct, bool hasAlpha) {
// we don't care about search on alpha if we're kIndex8, since only the
// colortable packing cares about that distinction, not the pixels
if (kIndex_8_SkColorType == ct) {
hasAlpha = false; // we store false in the table entries for kIndex8
}
static const struct {
SkColorType fColorType;
bool fHasAlpha;
transform_scanline_proc fProc;
} gMap[] = {
{ kRGB_565_SkColorType, false, transform_scanline_565 },
{ kN32_SkColorType, false, transform_scanline_888 },
{ kN32_SkColorType, true, transform_scanline_8888 },
{ kARGB_4444_SkColorType, false, transform_scanline_444 },
{ kARGB_4444_SkColorType, true, transform_scanline_4444 },
{ kIndex_8_SkColorType, false, transform_scanline_memcpy },
};
for (int i = SK_ARRAY_COUNT(gMap) - 1; i >= 0; --i) {
if (gMap[i].fColorType == ct && gMap[i].fHasAlpha == hasAlpha) {
return gMap[i].fProc;
}
}
sk_throw();
return NULL;
}
// return the minimum legal bitdepth (by png standards) for this many colortable
// entries. SkBitmap always stores in 8bits per pixel, but for colorcount <= 16,
// we can use fewer bits per in png
static int computeBitDepth(int colorCount) {
#if 0
int bits = SkNextLog2(colorCount);
SkASSERT(bits >= 1 && bits <= 8);
// now we need bits itself to be a power of 2 (e.g. 1, 2, 4, 8)
return SkNextPow2(bits);
#else
// for the moment, we don't know how to pack bitdepth < 8
return 8;
#endif
}
/* Pack palette[] with the corresponding colors, and if hasAlpha is true, also
pack trans[] and return the number of trans[] entries written. If hasAlpha
is false, the return value will always be 0.
Note: this routine takes care of unpremultiplying the RGB values when we
have alpha in the colortable, since png doesn't support premul colors
*/
static inline int pack_palette(SkColorTable* ctable,
png_color* SK_RESTRICT palette,
png_byte* SK_RESTRICT trans, bool hasAlpha) {
const SkPMColor* SK_RESTRICT colors = ctable ? ctable->readColors() : NULL;
const int ctCount = ctable->count();
int i, num_trans = 0;
if (hasAlpha) {
/* first see if we have some number of fully opaque at the end of the
ctable. PNG allows num_trans < num_palette, but all of the trans
entries must come first in the palette. If I was smarter, I'd
reorder the indices and ctable so that all non-opaque colors came
first in the palette. But, since that would slow down the encode,
I'm leaving the indices and ctable order as is, and just looking
at the tail of the ctable for opaqueness.
*/
num_trans = ctCount;
for (i = ctCount - 1; i >= 0; --i) {
if (SkGetPackedA32(colors[i]) != 0xFF) {
break;
}
num_trans -= 1;
}
const SkUnPreMultiply::Scale* SK_RESTRICT table =
SkUnPreMultiply::GetScaleTable();
for (i = 0; i < num_trans; i++) {
const SkPMColor c = *colors++;
const unsigned a = SkGetPackedA32(c);
const SkUnPreMultiply::Scale s = table[a];
trans[i] = a;
palette[i].red = SkUnPreMultiply::ApplyScale(s, SkGetPackedR32(c));
palette[i].green = SkUnPreMultiply::ApplyScale(s,SkGetPackedG32(c));
palette[i].blue = SkUnPreMultiply::ApplyScale(s, SkGetPackedB32(c));
}
// now fall out of this if-block to use common code for the trailing
// opaque entries
}
// these (remaining) entries are opaque
for (i = num_trans; i < ctCount; i++) {
SkPMColor c = *colors++;
palette[i].red = SkGetPackedR32(c);
palette[i].green = SkGetPackedG32(c);
palette[i].blue = SkGetPackedB32(c);
}
return num_trans;
}
class SkPNGImageEncoder : public SkImageEncoder {
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK_OVERRIDE;
private:
bool doEncode(SkWStream* stream, const SkBitmap& bm,
const bool& hasAlpha, int colorType,
int bitDepth, SkColorType ct,
png_color_8& sig_bit);
typedef SkImageEncoder INHERITED;
};
bool SkPNGImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bitmap, int /*quality*/) {
SkColorType ct = bitmap.colorType();
const bool hasAlpha = !bitmap.isOpaque();
int colorType = PNG_COLOR_MASK_COLOR;
int bitDepth = 8; // default for color
png_color_8 sig_bit;
switch (ct) {
case kIndex_8_SkColorType:
colorType |= PNG_COLOR_MASK_PALETTE;
// fall through to the ARGB_8888 case
case kN32_SkColorType:
sig_bit.red = 8;
sig_bit.green = 8;
sig_bit.blue = 8;
sig_bit.alpha = 8;
break;
case kARGB_4444_SkColorType:
sig_bit.red = 4;
sig_bit.green = 4;
sig_bit.blue = 4;
sig_bit.alpha = 4;
break;
case kRGB_565_SkColorType:
sig_bit.red = 5;
sig_bit.green = 6;
sig_bit.blue = 5;
sig_bit.alpha = 0;
break;
default:
return false;
}
if (hasAlpha) {
// don't specify alpha if we're a palette, even if our ctable has alpha
if (!(colorType & PNG_COLOR_MASK_PALETTE)) {
colorType |= PNG_COLOR_MASK_ALPHA;
}
} else {
sig_bit.alpha = 0;
}
SkAutoLockPixels alp(bitmap);
// readyToDraw checks for pixels (and colortable if that is required)
if (!bitmap.readyToDraw()) {
return false;
}
// we must do this after we have locked the pixels
SkColorTable* ctable = bitmap.getColorTable();
if (ctable) {
if (ctable->count() == 0) {
return false;
}
// check if we can store in fewer than 8 bits
bitDepth = computeBitDepth(ctable->count());
}
return doEncode(stream, bitmap, hasAlpha, colorType, bitDepth, ct, sig_bit);
}
bool SkPNGImageEncoder::doEncode(SkWStream* stream, const SkBitmap& bitmap,
const bool& hasAlpha, int colorType,
int bitDepth, SkColorType ct,
png_color_8& sig_bit) {
png_structp png_ptr;
png_infop info_ptr;
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, sk_error_fn,
NULL);
if (NULL == png_ptr) {
return false;
}
info_ptr = png_create_info_struct(png_ptr);
if (NULL == info_ptr) {
png_destroy_write_struct(&png_ptr, png_infopp_NULL);
return false;
}
/* Set error handling. REQUIRED if you aren't supplying your own
* error handling functions in the png_create_write_struct() call.
*/
if (setjmp(png_jmpbuf(png_ptr))) {
png_destroy_write_struct(&png_ptr, &info_ptr);
return false;
}
png_set_write_fn(png_ptr, (void*)stream, sk_write_fn, png_flush_ptr_NULL);
/* Set the image information here. Width and height are up to 2^31,
* bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
* the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
* PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
* or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
* PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
* currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
*/
png_set_IHDR(png_ptr, info_ptr, bitmap.width(), bitmap.height(),
bitDepth, colorType,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
PNG_FILTER_TYPE_BASE);
// set our colortable/trans arrays if needed
png_color paletteColors[256];
png_byte trans[256];
if (kIndex_8_SkColorType == ct) {
SkColorTable* ct = bitmap.getColorTable();
int numTrans = pack_palette(ct, paletteColors, trans, hasAlpha);
png_set_PLTE(png_ptr, info_ptr, paletteColors, ct->count());
if (numTrans > 0) {
png_set_tRNS(png_ptr, info_ptr, trans, numTrans, NULL);
}
}
#ifdef PNG_sBIT_SUPPORTED
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
#endif
png_write_info(png_ptr, info_ptr);
const char* srcImage = (const char*)bitmap.getPixels();
SkAutoSMalloc<1024> rowStorage(bitmap.width() << 2);
char* storage = (char*)rowStorage.get();
transform_scanline_proc proc = choose_proc(ct, hasAlpha);
for (int y = 0; y < bitmap.height(); y++) {
png_bytep row_ptr = (png_bytep)storage;
proc(srcImage, bitmap.width(), storage);
png_write_rows(png_ptr, &row_ptr, 1);
srcImage += bitmap.rowBytes();
}
png_write_end(png_ptr, info_ptr);
/* clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr);
return true;
}
///////////////////////////////////////////////////////////////////////////////
DEFINE_DECODER_CREATOR(PNGImageDecoder);
DEFINE_ENCODER_CREATOR(PNGImageEncoder);
///////////////////////////////////////////////////////////////////////////////
static bool is_png(SkStreamRewindable* stream) {
char buf[PNG_BYTES_TO_CHECK];
if (stream->read(buf, PNG_BYTES_TO_CHECK) == PNG_BYTES_TO_CHECK &&
!png_sig_cmp((png_bytep) buf, (png_size_t)0, PNG_BYTES_TO_CHECK)) {
return true;
}
return false;
}
SkImageDecoder* sk_libpng_dfactory(SkStreamRewindable* stream) {
if (is_png(stream)) {
return SkNEW(SkPNGImageDecoder);
}
return NULL;
}
static SkImageDecoder::Format get_format_png(SkStreamRewindable* stream) {
if (is_png(stream)) {
return SkImageDecoder::kPNG_Format;
}
return SkImageDecoder::kUnknown_Format;
}
SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL;
}
static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
static SkImageDecoder_FormatReg gFormatReg(get_format_png);
static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory);
| bsd-3-clause |
GaloisInc/sk-dev-platform | libs/SCD/libsepol-2.0.41/src/ports.c | 2 | 7094 | #include <netinet/in.h>
#include <stdlib.h>
#include "debug.h"
#include "context.h"
#include "handle.h"
#include <sepol/policydb/policydb.h>
#include "port_internal.h"
static inline int sepol2ipproto(sepol_handle_t * handle, int proto)
{
switch (proto) {
case SEPOL_PROTO_TCP:
return IPPROTO_TCP;
case SEPOL_PROTO_UDP:
return IPPROTO_UDP;
default:
ERR(handle, "unsupported protocol %u", proto);
return STATUS_ERR;
}
}
static inline int ipproto2sepol(sepol_handle_t * handle, int proto)
{
switch (proto) {
case IPPROTO_TCP:
return SEPOL_PROTO_TCP;
case IPPROTO_UDP:
return SEPOL_PROTO_UDP;
default:
ERR(handle, "invalid protocol %u " "found in policy", proto);
return STATUS_ERR;
}
}
/* Create a low level port structure from
* a high level representation */
static int port_from_record(sepol_handle_t * handle,
const policydb_t * policydb,
ocontext_t ** port, const sepol_port_t * data)
{
ocontext_t *tmp_port = NULL;
context_struct_t *tmp_con = NULL;
int tmp_proto;
int low = sepol_port_get_low(data);
int high = sepol_port_get_high(data);
int proto = sepol_port_get_proto(data);
tmp_port = (ocontext_t *) calloc(1, sizeof(ocontext_t));
if (!tmp_port)
goto omem;
/* Process protocol */
tmp_proto = sepol2ipproto(handle, proto);
if (tmp_proto < 0)
goto err;
tmp_port->u.port.protocol = tmp_proto;
/* Port range */
tmp_port->u.port.low_port = low;
tmp_port->u.port.high_port = high;
if (tmp_port->u.port.low_port > tmp_port->u.port.high_port) {
ERR(handle, "low port %d exceeds high port %d",
tmp_port->u.port.low_port, tmp_port->u.port.high_port);
goto err;
}
/* Context */
if (context_from_record(handle, policydb, &tmp_con,
sepol_port_get_con(data)) < 0)
goto err;
context_cpy(&tmp_port->context[0], tmp_con);
context_destroy(tmp_con);
free(tmp_con);
tmp_con = NULL;
*port = tmp_port;
return STATUS_SUCCESS;
omem:
ERR(handle, "out of memory");
err:
if (tmp_port != NULL) {
context_destroy(&tmp_port->context[0]);
free(tmp_port);
}
context_destroy(tmp_con);
free(tmp_con);
ERR(handle, "could not create port structure for range %u:%u (%s)",
low, high, sepol_port_get_proto_str(proto));
return STATUS_ERR;
}
static int port_to_record(sepol_handle_t * handle,
const policydb_t * policydb,
ocontext_t * port, sepol_port_t ** record)
{
int proto = port->u.port.protocol;
int low = port->u.port.low_port;
int high = port->u.port.high_port;
context_struct_t *con = &port->context[0];
int rec_proto = -1;
sepol_context_t *tmp_con = NULL;
sepol_port_t *tmp_record = NULL;
if (sepol_port_create(handle, &tmp_record) < 0)
goto err;
rec_proto = ipproto2sepol(handle, proto);
if (rec_proto < 0)
goto err;
sepol_port_set_proto(tmp_record, rec_proto);
sepol_port_set_range(tmp_record, low, high);
if (context_to_record(handle, policydb, con, &tmp_con) < 0)
goto err;
if (sepol_port_set_con(handle, tmp_record, tmp_con) < 0)
goto err;
sepol_context_free(tmp_con);
*record = tmp_record;
return STATUS_SUCCESS;
err:
ERR(handle, "could not convert port range %u - %u (%s) "
"to record", low, high, sepol_port_get_proto_str(rec_proto));
sepol_context_free(tmp_con);
sepol_port_free(tmp_record);
return STATUS_ERR;
}
/* Return the number of ports */
extern int sepol_port_count(sepol_handle_t * handle,
const sepol_policydb_t * p, unsigned int *response)
{
unsigned int count = 0;
ocontext_t *c, *head;
const policydb_t *policydb = &p->p;
head = policydb->ocontexts[OCON_PORT];
for (c = head; c != NULL; c = c->next)
count++;
*response = count;
handle = NULL;
return STATUS_SUCCESS;
}
/* Check if a port exists */
int sepol_port_exists(sepol_handle_t * handle,
const sepol_policydb_t * p,
const sepol_port_key_t * key, int *response)
{
const policydb_t *policydb = &p->p;
ocontext_t *c, *head;
int low, high, proto;
const char *proto_str;
sepol_port_key_unpack(key, &low, &high, &proto);
proto_str = sepol_port_get_proto_str(proto);
proto = sepol2ipproto(handle, proto);
if (proto < 0)
goto err;
head = policydb->ocontexts[OCON_PORT];
for (c = head; c; c = c->next) {
int proto2 = c->u.port.protocol;
int low2 = c->u.port.low_port;
int high2 = c->u.port.high_port;
if (proto == proto2 && low2 == low && high2 == high) {
*response = 1;
return STATUS_SUCCESS;
}
}
*response = 0;
return STATUS_SUCCESS;
err:
ERR(handle, "could not check if port range %u - %u (%s) exists",
low, high, proto_str);
return STATUS_ERR;
}
/* Query a port */
int sepol_port_query(sepol_handle_t * handle,
const sepol_policydb_t * p,
const sepol_port_key_t * key, sepol_port_t ** response)
{
const policydb_t *policydb = &p->p;
ocontext_t *c, *head;
int low, high, proto;
const char *proto_str;
sepol_port_key_unpack(key, &low, &high, &proto);
proto_str = sepol_port_get_proto_str(proto);
proto = sepol2ipproto(handle, proto);
if (proto < 0)
goto err;
head = policydb->ocontexts[OCON_PORT];
for (c = head; c; c = c->next) {
int proto2 = c->u.port.protocol;
int low2 = c->u.port.low_port;
int high2 = c->u.port.high_port;
if (proto == proto2 && low2 == low && high2 == high) {
if (port_to_record(handle, policydb, c, response) < 0)
goto err;
return STATUS_SUCCESS;
}
}
*response = NULL;
return STATUS_SUCCESS;
err:
ERR(handle, "could not query port range %u - %u (%s)",
low, high, proto_str);
return STATUS_ERR;
}
/* Load a port into policy */
int sepol_port_modify(sepol_handle_t * handle,
sepol_policydb_t * p,
const sepol_port_key_t * key, const sepol_port_t * data)
{
policydb_t *policydb = &p->p;
ocontext_t *port = NULL;
int low, high, proto;
const char *proto_str;
sepol_port_key_unpack(key, &low, &high, &proto);
proto_str = sepol_port_get_proto_str(proto);
proto = sepol2ipproto(handle, proto);
if (proto < 0)
goto err;
if (port_from_record(handle, policydb, &port, data) < 0)
goto err;
/* Attach to context list */
port->next = policydb->ocontexts[OCON_PORT];
policydb->ocontexts[OCON_PORT] = port;
return STATUS_SUCCESS;
err:
ERR(handle, "could not load port range %u - %u (%s)",
low, high, proto_str);
if (port != NULL) {
context_destroy(&port->context[0]);
free(port);
}
return STATUS_ERR;
}
int sepol_port_iterate(sepol_handle_t * handle,
const sepol_policydb_t * p,
int (*fn) (const sepol_port_t * port,
void *fn_arg), void *arg)
{
const policydb_t *policydb = &p->p;
ocontext_t *c, *head;
sepol_port_t *port = NULL;
head = policydb->ocontexts[OCON_PORT];
for (c = head; c; c = c->next) {
int status;
if (port_to_record(handle, policydb, c, &port) < 0)
goto err;
/* Invoke handler */
status = fn(port, arg);
if (status < 0)
goto err;
sepol_port_free(port);
port = NULL;
/* Handler requested exit */
if (status > 0)
break;
}
return STATUS_SUCCESS;
err:
ERR(handle, "could not iterate over ports");
sepol_port_free(port);
return STATUS_ERR;
}
| bsd-3-clause |
drmateo/pcl | test/people/test_people_groundBasedPeopleDetectionApp.cpp | 2 | 5366 | /*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2013-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* main_ground_based_people_detection_app.cpp
* Created on: Nov 30, 2012
* Author: Matteo Munaro
*
* Test file for testing people detection on a point cloud.
* As a first step, the ground is manually initialized, then people detection is performed with the GroundBasedPeopleDetectionApp class,
* which implements the people detection algorithm described here:
* M. Munaro, F. Basso and E. Menegatti,
* Tracking people within groups with RGB-D data,
* In Proceedings of the International Conference on Intelligent Robots and Systems (IROS) 2012, Vilamoura (Portugal), 2012.
*/
#include <gtest/gtest.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <pcl/sample_consensus/sac_model_plane.h>
#include <pcl/people/ground_based_people_detection_app.h>
using PointT = pcl::PointXYZRGB;
using PointCloudT = pcl::PointCloud<PointT>;
enum { COLS = 640, ROWS = 480 };
PointCloudT::Ptr cloud;
pcl::people::PersonClassifier<pcl::RGB> person_classifier;
std::string svm_filename;
float min_confidence;
float min_width;
float max_width;
float min_height;
float max_height;
float voxel_size;
Eigen::Matrix3f rgb_intrinsics_matrix;
Eigen::VectorXf ground_coeffs;
TEST (PCL, PersonClassifier)
{
// Create classifier for people detection:
EXPECT_TRUE (person_classifier.loadSVMFromFile(svm_filename)); // load trained SVM
}
TEST (PCL, GroundBasedPeopleDetectionApp)
{
// People detection app initialization:
pcl::people::GroundBasedPeopleDetectionApp<PointT> people_detector; // people detection object
people_detector.setVoxelSize(voxel_size); // set the voxel size
people_detector.setIntrinsics(rgb_intrinsics_matrix); // set RGB camera intrinsic parameters
people_detector.setClassifier(person_classifier); // set person classifier
people_detector.setPersonClusterLimits(min_height, max_height, min_width, max_width);
// Perform people detection on the new cloud:
std::vector<pcl::people::PersonCluster<PointT> > clusters; // vector containing persons clusters
people_detector.setInputCloud(cloud);
people_detector.setGround(ground_coeffs); // set floor coefficients
EXPECT_TRUE (people_detector.compute(clusters)); // perform people detection
unsigned int k = 0;
for(const auto &cluster : clusters)
{
if(cluster.getPersonConfidence() > min_confidence) // draw only people with confidence above a threshold
k++;
}
EXPECT_EQ (k, 5); // verify number of people found (should be five)
}
int main (int argc, char** argv)
{
if (argc < 2)
{
cerr << "No svm filename provided. Please download `trainedLinearSVMForPeopleDetectionWithHOG.yaml` and pass its path to the test." << endl;
return (-1);
}
if (argc < 3)
{
cerr << "No test file given. Please download 'five_people.pcd` and pass its path to the test." << endl;
return (-1);
}
cloud = PointCloudT::Ptr (new PointCloudT);
if (pcl::io::loadPCDFile (argv[2], *cloud) < 0)
{
cerr << "Failed to read test file. Please download `five_people.pcd` and pass its path to the test." << endl;
return (-1);
}
// Algorithm parameters:
svm_filename = argv[1];
min_confidence = -1.5;
min_width = 0.1;
max_width = 8.0;
min_height = 1.3;
max_height = 2.3;
voxel_size = 0.06;
rgb_intrinsics_matrix << 525, 0.0, 319.5, 0.0, 525, 239.5, 0.0, 0.0, 1.0; // Kinect RGB camera intrinsics
ground_coeffs.resize(4);
ground_coeffs << -0.0103586, 0.997011, 0.0765573, -1.26614; // set ground coefficients
testing::InitGoogleTest (&argc, argv);
return (RUN_ALL_TESTS ());
}
| bsd-3-clause |
exponentjs/exponent | ios/versioned-react-native/ABI44_0_0/ReactNative/ReactCommon/react/renderer/components/text/ABI44_0_0ParagraphEventEmitter.cpp | 2 | 1957 | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ABI44_0_0ParagraphEventEmitter.h"
namespace ABI44_0_0facebook {
namespace ABI44_0_0React {
static jsi::Value linesMeasurementsPayload(
jsi::Runtime &runtime,
LinesMeasurements const &linesMeasurements) {
auto payload = jsi::Object(runtime);
auto lines = jsi::Array(runtime, linesMeasurements.size());
for (size_t i = 0; i < linesMeasurements.size(); ++i) {
auto const &lineMeasurement = linesMeasurements[i];
auto jsiLine = jsi::Object(runtime);
jsiLine.setProperty(runtime, "text", lineMeasurement.text);
jsiLine.setProperty(runtime, "x", lineMeasurement.frame.origin.x);
jsiLine.setProperty(runtime, "y", lineMeasurement.frame.origin.y);
jsiLine.setProperty(runtime, "width", lineMeasurement.frame.size.width);
jsiLine.setProperty(runtime, "height", lineMeasurement.frame.size.height);
jsiLine.setProperty(runtime, "descender", lineMeasurement.descender);
jsiLine.setProperty(runtime, "capHeight", lineMeasurement.capHeight);
jsiLine.setProperty(runtime, "ascender", lineMeasurement.ascender);
jsiLine.setProperty(runtime, "xHeight", lineMeasurement.xHeight);
lines.setValueAtIndex(runtime, i, jsiLine);
}
payload.setProperty(runtime, "lines", lines);
return payload;
}
void ParagraphEventEmitter::onTextLayout(
LinesMeasurements const &linesMeasurements) const {
{
std::lock_guard<std::mutex> guard(linesMeasurementsMutex_);
if (linesMeasurementsMetrics_ == linesMeasurements) {
return;
}
linesMeasurementsMetrics_ = linesMeasurements;
}
dispatchEvent("textLayout", [linesMeasurements](jsi::Runtime &runtime) {
return linesMeasurementsPayload(runtime, linesMeasurements);
});
}
} // namespace ABI44_0_0React
} // namespace ABI44_0_0facebook
| bsd-3-clause |
youtube/cobalt | third_party/skia/tools/gpu/gl/GLTestContext.cpp | 2 | 13203 | /*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "tools/gpu/gl/GLTestContext.h"
#include "include/gpu/GrContext.h"
#include "src/gpu/gl/GrGLUtil.h"
#include "tools/gpu/GpuTimer.h"
namespace {
class GLFenceSync : public sk_gpu_test::FenceSync {
public:
static std::unique_ptr<FenceSync> MakeIfSupported(const sk_gpu_test::GLTestContext*);
sk_gpu_test::PlatformFence SK_WARN_UNUSED_RESULT insertFence() const override;
bool waitFence(sk_gpu_test::PlatformFence fence) const override;
void deleteFence(sk_gpu_test::PlatformFence fence) const override;
private:
GLFenceSync(const sk_gpu_test::GLTestContext*, const char* ext = "");
bool validate() const override { return fGLFenceSync && fGLClientWaitSync && fGLDeleteSync; }
static constexpr GrGLenum GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117;
static constexpr GrGLenum GL_WAIT_FAILED = 0x911d;
static constexpr GrGLbitfield GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
typedef struct __GLsync *GLsync;
GR_STATIC_ASSERT(sizeof(GLsync) <= sizeof(sk_gpu_test::PlatformFence));
typedef GLsync (GR_GL_FUNCTION_TYPE* GLFenceSyncProc) (GrGLenum, GrGLbitfield);
typedef GrGLenum (GR_GL_FUNCTION_TYPE* GLClientWaitSyncProc) (GLsync, GrGLbitfield, GrGLuint64);
typedef GrGLvoid (GR_GL_FUNCTION_TYPE* GLDeleteSyncProc) (GLsync);
GLFenceSyncProc fGLFenceSync;
GLClientWaitSyncProc fGLClientWaitSync;
GLDeleteSyncProc fGLDeleteSync;
typedef FenceSync INHERITED;
};
class GLNVFenceSync : public sk_gpu_test::FenceSync {
public:
GLNVFenceSync(const sk_gpu_test::GLTestContext*);
sk_gpu_test::PlatformFence SK_WARN_UNUSED_RESULT insertFence() const override;
bool waitFence(sk_gpu_test::PlatformFence fence) const override;
void deleteFence(sk_gpu_test::PlatformFence fence) const override;
private:
bool validate() const override {
return fGLGenFencesNV && fGLDeleteFencesNV && fGLSetFenceNV && fGLFinishFenceNV;
}
static constexpr GrGLenum GL_ALL_COMPLETED_NV = 0x84F2;
typedef GrGLvoid(GR_GL_FUNCTION_TYPE* GLGenFencesNVProc) (GrGLsizei, GrGLuint*);
typedef GrGLvoid(GR_GL_FUNCTION_TYPE* GLDeleteFencesNVProc) (GrGLsizei, const GrGLuint*);
typedef GrGLvoid(GR_GL_FUNCTION_TYPE* GLSetFenceNVProc) (GrGLuint, GrGLenum);
typedef GrGLvoid(GR_GL_FUNCTION_TYPE* GLFinishFenceNVProc) (GrGLuint);
GLGenFencesNVProc fGLGenFencesNV;
GLDeleteFencesNVProc fGLDeleteFencesNV;
GLSetFenceNVProc fGLSetFenceNV;
GLFinishFenceNVProc fGLFinishFenceNV;
typedef FenceSync INHERITED;
};
std::unique_ptr<sk_gpu_test::FenceSync> GLFenceSync::MakeIfSupported(
const sk_gpu_test::GLTestContext* ctx) {
std::unique_ptr<FenceSync> ret;
if (kGL_GrGLStandard == ctx->gl()->fStandard) {
if (GrGLGetVersion(ctx->gl()) < GR_GL_VER(3,2) && !ctx->gl()->hasExtension("GL_ARB_sync")) {
return nullptr;
}
ret.reset(new GLFenceSync(ctx));
} else {
if (ctx->gl()->hasExtension("GL_APPLE_sync")) {
ret.reset(new GLFenceSync(ctx, "APPLE"));
} else if (ctx->gl()->hasExtension("GL_NV_fence")) {
ret.reset(new GLNVFenceSync(ctx));
} else if (GrGLGetVersion(ctx->gl()) >= GR_GL_VER(3, 0)) {
ret.reset(new GLFenceSync(ctx));
} else {
return nullptr;
}
}
if (!ret->validate()) {
ret = nullptr;
}
return ret;
}
GLFenceSync::GLFenceSync(const sk_gpu_test::GLTestContext* ctx, const char* ext) {
ctx->getGLProcAddress(&fGLFenceSync, "glFenceSync", ext);
ctx->getGLProcAddress(&fGLClientWaitSync, "glClientWaitSync", ext);
ctx->getGLProcAddress(&fGLDeleteSync, "glDeleteSync", ext);
}
sk_gpu_test::PlatformFence GLFenceSync::insertFence() const {
__GLsync* glsync = fGLFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
return reinterpret_cast<sk_gpu_test::PlatformFence>(glsync);
}
bool GLFenceSync::waitFence(sk_gpu_test::PlatformFence fence) const {
GLsync glsync = reinterpret_cast<GLsync>(fence);
return GL_WAIT_FAILED != fGLClientWaitSync(glsync, GL_SYNC_FLUSH_COMMANDS_BIT, -1);
}
void GLFenceSync::deleteFence(sk_gpu_test::PlatformFence fence) const {
GLsync glsync = reinterpret_cast<GLsync>(fence);
fGLDeleteSync(glsync);
}
GLNVFenceSync::GLNVFenceSync(const sk_gpu_test::GLTestContext* ctx) {
ctx->getGLProcAddress(&fGLGenFencesNV, "glGenFencesNV");
ctx->getGLProcAddress(&fGLDeleteFencesNV, "glDeleteFencesNV");
ctx->getGLProcAddress(&fGLSetFenceNV, "glSetFenceNV");
ctx->getGLProcAddress(&fGLFinishFenceNV, "glFinishFenceNV");
}
sk_gpu_test::PlatformFence GLNVFenceSync::insertFence() const {
GrGLuint fence;
fGLGenFencesNV(1, &fence);
fGLSetFenceNV(fence, GL_ALL_COMPLETED_NV);
return fence;
}
bool GLNVFenceSync::waitFence(sk_gpu_test::PlatformFence fence) const {
fGLFinishFenceNV(fence);
return true;
}
void GLNVFenceSync::deleteFence(sk_gpu_test::PlatformFence fence) const {
GrGLuint glFence = static_cast<GrGLuint>(fence);
fGLDeleteFencesNV(1, &glFence);
}
class GLGpuTimer : public sk_gpu_test::GpuTimer {
public:
static std::unique_ptr<GLGpuTimer> MakeIfSupported(const sk_gpu_test::GLTestContext*);
QueryStatus checkQueryStatus(sk_gpu_test::PlatformTimerQuery) override;
std::chrono::nanoseconds getTimeElapsed(sk_gpu_test::PlatformTimerQuery) override;
void deleteQuery(sk_gpu_test::PlatformTimerQuery) override;
private:
GLGpuTimer(bool disjointSupport, const sk_gpu_test::GLTestContext*, const char* ext = "");
bool validate() const;
sk_gpu_test::PlatformTimerQuery onQueueTimerStart() const override;
void onQueueTimerStop(sk_gpu_test::PlatformTimerQuery) const override;
static constexpr GrGLenum GL_QUERY_RESULT = 0x8866;
static constexpr GrGLenum GL_QUERY_RESULT_AVAILABLE = 0x8867;
static constexpr GrGLenum GL_TIME_ELAPSED = 0x88bf;
static constexpr GrGLenum GL_GPU_DISJOINT = 0x8fbb;
typedef void (GR_GL_FUNCTION_TYPE* GLGetIntegervProc) (GrGLenum, GrGLint*);
typedef void (GR_GL_FUNCTION_TYPE* GLGenQueriesProc) (GrGLsizei, GrGLuint*);
typedef void (GR_GL_FUNCTION_TYPE* GLDeleteQueriesProc) (GrGLsizei, const GrGLuint*);
typedef void (GR_GL_FUNCTION_TYPE* GLBeginQueryProc) (GrGLenum, GrGLuint);
typedef void (GR_GL_FUNCTION_TYPE* GLEndQueryProc) (GrGLenum);
typedef void (GR_GL_FUNCTION_TYPE* GLGetQueryObjectuivProc) (GrGLuint, GrGLenum, GrGLuint*);
typedef void (GR_GL_FUNCTION_TYPE* GLGetQueryObjectui64vProc) (GrGLuint, GrGLenum, GrGLuint64*);
GLGetIntegervProc fGLGetIntegerv;
GLGenQueriesProc fGLGenQueries;
GLDeleteQueriesProc fGLDeleteQueries;
GLBeginQueryProc fGLBeginQuery;
GLEndQueryProc fGLEndQuery;
GLGetQueryObjectuivProc fGLGetQueryObjectuiv;
GLGetQueryObjectui64vProc fGLGetQueryObjectui64v;
typedef sk_gpu_test::GpuTimer INHERITED;
};
std::unique_ptr<GLGpuTimer> GLGpuTimer::MakeIfSupported(const sk_gpu_test::GLTestContext* ctx) {
std::unique_ptr<GLGpuTimer> ret;
const GrGLInterface* gl = ctx->gl();
if (gl->fExtensions.has("GL_EXT_disjoint_timer_query")) {
ret.reset(new GLGpuTimer(true, ctx, "EXT"));
} else if (kGL_GrGLStandard == gl->fStandard &&
(GrGLGetVersion(gl) > GR_GL_VER(3,3) || gl->fExtensions.has("GL_ARB_timer_query"))) {
ret.reset(new GLGpuTimer(false, ctx));
} else if (gl->fExtensions.has("GL_EXT_timer_query")) {
ret.reset(new GLGpuTimer(false, ctx, "EXT"));
}
if (ret && !ret->validate()) {
ret = nullptr;
}
return ret;
}
GLGpuTimer::GLGpuTimer(bool disjointSupport, const sk_gpu_test::GLTestContext* ctx, const char* ext)
: INHERITED(disjointSupport) {
ctx->getGLProcAddress(&fGLGetIntegerv, "glGetIntegerv");
ctx->getGLProcAddress(&fGLGenQueries, "glGenQueries", ext);
ctx->getGLProcAddress(&fGLDeleteQueries, "glDeleteQueries", ext);
ctx->getGLProcAddress(&fGLBeginQuery, "glBeginQuery", ext);
ctx->getGLProcAddress(&fGLEndQuery, "glEndQuery", ext);
ctx->getGLProcAddress(&fGLGetQueryObjectuiv, "glGetQueryObjectuiv", ext);
ctx->getGLProcAddress(&fGLGetQueryObjectui64v, "glGetQueryObjectui64v", ext);
}
bool GLGpuTimer::validate() const {
return fGLGetIntegerv && fGLGenQueries && fGLDeleteQueries && fGLBeginQuery && fGLEndQuery &&
fGLGetQueryObjectuiv && fGLGetQueryObjectui64v;
}
sk_gpu_test::PlatformTimerQuery GLGpuTimer::onQueueTimerStart() const {
GrGLuint queryID;
fGLGenQueries(1, &queryID);
if (!queryID) {
return sk_gpu_test::kInvalidTimerQuery;
}
if (this->disjointSupport()) {
// Clear the disjoint flag.
GrGLint disjoint;
fGLGetIntegerv(GL_GPU_DISJOINT, &disjoint);
}
fGLBeginQuery(GL_TIME_ELAPSED, queryID);
return static_cast<sk_gpu_test::PlatformTimerQuery>(queryID);
}
void GLGpuTimer::onQueueTimerStop(sk_gpu_test::PlatformTimerQuery platformTimer) const {
if (sk_gpu_test::kInvalidTimerQuery == platformTimer) {
return;
}
fGLEndQuery(GL_TIME_ELAPSED);
}
sk_gpu_test::GpuTimer::QueryStatus
GLGpuTimer::checkQueryStatus(sk_gpu_test::PlatformTimerQuery platformTimer) {
const GrGLuint queryID = static_cast<GrGLuint>(platformTimer);
if (!queryID) {
return QueryStatus::kInvalid;
}
GrGLuint available = 0;
fGLGetQueryObjectuiv(queryID, GL_QUERY_RESULT_AVAILABLE, &available);
if (!available) {
return QueryStatus::kPending;
}
if (this->disjointSupport()) {
GrGLint disjoint = 1;
fGLGetIntegerv(GL_GPU_DISJOINT, &disjoint);
if (disjoint) {
return QueryStatus::kDisjoint;
}
}
return QueryStatus::kAccurate;
}
std::chrono::nanoseconds GLGpuTimer::getTimeElapsed(sk_gpu_test::PlatformTimerQuery platformTimer) {
SkASSERT(this->checkQueryStatus(platformTimer) >= QueryStatus::kDisjoint);
const GrGLuint queryID = static_cast<GrGLuint>(platformTimer);
GrGLuint64 nanoseconds;
fGLGetQueryObjectui64v(queryID, GL_QUERY_RESULT, &nanoseconds);
return std::chrono::nanoseconds(nanoseconds);
}
void GLGpuTimer::deleteQuery(sk_gpu_test::PlatformTimerQuery platformTimer) {
const GrGLuint queryID = static_cast<GrGLuint>(platformTimer);
fGLDeleteQueries(1, &queryID);
}
GR_STATIC_ASSERT(sizeof(GrGLuint) <= sizeof(sk_gpu_test::PlatformTimerQuery));
} // anonymous namespace
namespace sk_gpu_test {
GLTestContext::GLTestContext() : TestContext() {}
GLTestContext::~GLTestContext() {
SkASSERT(nullptr == fGL.get());
}
void GLTestContext::init(sk_sp<const GrGLInterface> gl, std::unique_ptr<FenceSync> fenceSync) {
fGL = std::move(gl);
fFenceSync = fenceSync ? std::move(fenceSync) : GLFenceSync::MakeIfSupported(this);
fGpuTimer = GLGpuTimer::MakeIfSupported(this);
}
void GLTestContext::teardown() {
fGL.reset(nullptr);
INHERITED::teardown();
}
void GLTestContext::testAbandon() {
INHERITED::testAbandon();
if (fGL) {
fGL->abandon();
}
}
void GLTestContext::submit() {
if (fGL) {
GR_GL_CALL(fGL.get(), Flush());
}
}
void GLTestContext::finish() {
if (fGL) {
GR_GL_CALL(fGL.get(), Finish());
}
}
GrGLuint GLTestContext::createTextureRectangle(int width, int height, GrGLenum internalFormat,
GrGLenum externalFormat, GrGLenum externalType,
GrGLvoid* data) {
// Should match GrGLCaps check for fRectangleTextureSupport.
if (kGL_GrGLStandard != fGL->fStandard ||
(GrGLGetVersion(fGL.get()) < GR_GL_VER(3, 1) &&
!fGL->fExtensions.has("GL_ARB_texture_rectangle") &&
!fGL->fExtensions.has("GL_ANGLE_texture_rectangle"))) {
return 0;
}
if (GrGLGetGLSLVersion(fGL.get()) < GR_GLSL_VER(1, 40)) {
return 0;
}
GrGLuint id;
GR_GL_CALL(fGL.get(), GenTextures(1, &id));
GR_GL_CALL(fGL.get(), BindTexture(GR_GL_TEXTURE_RECTANGLE, id));
GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MAG_FILTER,
GR_GL_NEAREST));
GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_MIN_FILTER,
GR_GL_NEAREST));
GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_S,
GR_GL_CLAMP_TO_EDGE));
GR_GL_CALL(fGL.get(), TexParameteri(GR_GL_TEXTURE_RECTANGLE, GR_GL_TEXTURE_WRAP_T,
GR_GL_CLAMP_TO_EDGE));
GR_GL_CALL(fGL.get(), TexImage2D(GR_GL_TEXTURE_RECTANGLE, 0, internalFormat, width, height, 0,
externalFormat, externalType, data));
return id;
}
sk_sp<GrContext> GLTestContext::makeGrContext(const GrContextOptions& options) {
return GrContext::MakeGL(fGL, options);
}
} // namespace sk_gpu_test
| bsd-3-clause |
chdinh/mne-cpp | applications/mne_scan/libs/scShared/Management/pluginmanager.cpp | 2 | 7652 | //=============================================================================================================
/**
* @file pluginmanager.cpp
* @author Christoph Dinh <chdinh@nmr.mgh.harvard.edu>;
* Lorenz Esch <lesch@mgh.harvard.edu>
* @since 0.1.0
* @date February, 2013
*
* @section LICENSE
*
* Copyright (C) 2013, Christoph Dinh, Lorenz Esch. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that
* the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of MNE-CPP authors nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* @brief Definition of the PluginManager class.
*
*/
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "pluginmanager.h"
#include "../Plugins/abstractplugin.h"
#include "../Plugins/abstractsensor.h"
#include "../Plugins/abstractalgorithm.h"
//=============================================================================================================
// QT INCLUDES
//=============================================================================================================
#include <QDir>
#include <QDebug>
//=============================================================================================================
// USED NAMESPACES
//=============================================================================================================
using namespace SCSHAREDLIB;
//=============================================================================================================
// DEFINE MEMBER METHODS
//=============================================================================================================
PluginManager::PluginManager(QObject *parent)
: QPluginLoader(parent)
{
}
//=============================================================================================================
PluginManager::~PluginManager()
{
}
//=============================================================================================================
void PluginManager::loadPlugins(const QString& dir)
{
#ifdef STATICBUILD
Q_UNUSED(dir);
const auto staticInstances = QPluginLoader::staticInstances();
for(QObject *plugin : staticInstances) {
// AbstractPlugin
if(plugin) {
if(AbstractPlugin* pPlugin = qobject_cast<AbstractPlugin*>(plugin)) {
// plugins are always disabled when they are first loaded
m_qVecPlugins.push_back(pPlugin);
AbstractPlugin::PluginType pluginType = pPlugin->getType();
QString msg = "Plugin " + pPlugin->getName() + " loaded.";
// AbstractSensor
if(pluginType == AbstractPlugin::_ISensor) {
if(AbstractSensor* pSensor = qobject_cast<AbstractSensor*>(pPlugin)) {
m_qVecSensorPlugins.push_back(pSensor);
qDebug() << "Sensor" << pSensor->getName() << "loaded.";
}
}
// AbstractAlgorithm
else if(pluginType == AbstractPlugin::_IAlgorithm) {
if(AbstractAlgorithm* pAlgorithm = qobject_cast<AbstractAlgorithm*>(pPlugin)) {
m_qVecAlgorithmPlugins.push_back(pAlgorithm);
qDebug() << "RTAlgorithm" << pAlgorithm->getName() << "loaded.";
}
}
emit pluginLoaded(msg);
}
} else {
qDebug() << "Plugin could not be instantiated!";
}
}
#else
QDir PluginsDir(dir);
foreach(QString file, PluginsDir.entryList(QDir::Files)) {
// Exclude .exp and .lib files (only relevant for windows builds)
if(!file.contains(".exp") && !file.contains(".lib")) {
this->setFileName(PluginsDir.absoluteFilePath(file));
QObject *pPlugin = this->instance();
// AbstractPlugin
if(pPlugin) {
// plugins are always disabled when they are first loaded
m_qVecPlugins.push_back(qobject_cast<AbstractPlugin*>(pPlugin));
AbstractPlugin::PluginType pluginType = qobject_cast<AbstractPlugin*>(pPlugin)->getType();
QString msg = "Plugin " + qobject_cast<AbstractPlugin*>(pPlugin)->getName() + " loaded.";
if(pluginType == AbstractPlugin::_ISensor) {
// AbstractSensor
AbstractSensor* pSensor = qobject_cast<AbstractSensor*>(pPlugin);
if(pSensor) {
m_qVecSensorPlugins.push_back(pSensor);
qInfo() << "[PluginManager::loadPlugins] Loading sensor plugin" << pSensor->getName() << "succeeded.";
qInfo() << "[PluginManager::loadPlugins] Build Info:" << pSensor->getBuildInfo();
} else {
qInfo() << "[PluginManager::loadPlugins] Loading sensor plugin failed.";
}
} else if(pluginType == AbstractPlugin::_IAlgorithm) {
// AbstractAlgorithm
AbstractAlgorithm* pAlgorithm = qobject_cast<AbstractAlgorithm*>(pPlugin);
if(pAlgorithm) {
m_qVecAlgorithmPlugins.push_back(pAlgorithm);
qInfo() << "[PluginManager::loadPlugins] Loading algorithm plugin" << pAlgorithm->getName() << "succeeded.";
qInfo() << "[PluginManager::loadPlugins] Build Timestamp:" << pAlgorithm->getBuildInfo();
} else {
qInfo() << "[PluginManager::loadPlugins] Loading algorithm plugin failed.";
}
}
emit pluginLoaded(msg);
}
}
}
#endif
}
//=============================================================================================================
int PluginManager::findByName(const QString& name)
{
QVector<AbstractPlugin*>::const_iterator it = m_qVecPlugins.begin();
for(int i = 0; it != m_qVecPlugins.end(); ++i, ++it)
if((*it)->getName() == name)
return i;
return -1;
}
| bsd-3-clause |
ragsns/nuodb-drivers | dotnet/nuodb/connection.cpp | 4 | 9950 | /*
Copyright (c) 2012, NuoDB, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of NuoDB, Inc. nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL NUODB, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "stdafx.h"
#include "exception.h"
#include "connection.h"
#include "transaction.h"
#include "command.h"
#pragma region Construction / Destruction
NuoDb::NuoDbConnection::NuoDbConnection() :
m_connection(NULL),
m_inTransaction(false),
m_connectionString(System::String::Empty),
m_database(System::String::Empty),
m_schema(System::String::Empty),
m_username(System::String::Empty),
m_password(System::String::Empty),
m_disposed(false)
{
}
NuoDb::NuoDbConnection::NuoDbConnection(System::String^ connectionString) :
m_connection(NULL),
m_inTransaction(false),
m_database(System::String::Empty),
m_schema(System::String::Empty),
m_username(System::String::Empty),
m_password(System::String::Empty),
m_disposed(false)
{
if (System::String::IsNullOrEmpty(connectionString))
throw gcnew ArgumentNullException("connectionString");
m_connectionString = connectionString;
ParseConnectionString();
}
NuoDb::NuoDbConnection::~NuoDbConnection()
{
if (m_disposed)
return;
RollbackTransaction();
this->!NuoDbConnection();
m_disposed = true;
}
NuoDb::NuoDbConnection::!NuoDbConnection()
{
if (m_connection != NULL)
delete m_connection;
m_connection = NULL;
}
#pragma endregion
#pragma region Methods
void NuoDb::NuoDbConnection::EnlistDistributedTransaction(System::EnterpriseServices::ITransaction^ transaction)
{
throw gcnew NotSupportedException();
}
NuoDb::NuoDbCommand^ NuoDb::NuoDbConnection::CreateCommand()
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is not open.");
NuoDbCommand^ c = gcnew NuoDbCommand();
c->Connection = this;
return c;
}
void NuoDb::NuoDbConnection::CommitTransaction()
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is not open.");
if (!m_inTransaction)
return;
m_connection->ref()->commit();
m_inTransaction = false;
m_connection->ref()->setAutoCommit(true);
}
void NuoDb::NuoDbConnection::RollbackTransaction()
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is not open.");
if (!m_inTransaction)
return;
m_connection->ref()->rollback();
m_inTransaction = false;
m_connection->ref()->setAutoCommit(true);
}
void NuoDb::NuoDbConnection::ParseConnectionString()
{
if (System::String::IsNullOrEmpty(m_connectionString))
throw gcnew ArgumentNullException("ConnectionString");
m_database = System::String::Empty;
m_schema = System::String::Empty;
m_username = System::String::Empty;
m_password = System::String::Empty;
for each (System::String^ item in m_connectionString->Split(';'))
{
array<System::String^>^ parts = item->Split('=');
if (parts->Length != 2)
throw gcnew ArgumentException("The connection string was malformed.");
parts[0] = parts[0]->Trim();
parts[1] = parts[1]->Trim();
if (0 == parts[0]->Length || 0 == parts[1]->Length)
throw gcnew ArgumentException("The connection string was malformed.");
if (parts[0]->Equals("Database", System::StringComparison::InvariantCulture))
m_database = parts[1];
else if (parts[0]->Equals("Schema", System::StringComparison::InvariantCulture))
m_schema = parts[1];
else if (parts[0]->Equals("User", System::StringComparison::InvariantCulture))
m_username = parts[1];
else if (parts[0]->Equals("Password", System::StringComparison::InvariantCulture))
m_password = parts[1];
else
throw gcnew ArgumentException("The connection string contained an unknown key \"" + parts[0] + "\".");
}
}
void NuoDb::NuoDbConnection::OpenConnection()
{
if (m_connection != NULL)
throw gcnew NuoDbException("The connection is already open.");
if (System::String::IsNullOrEmpty(m_connectionString))
throw gcnew ArgumentNullException("ConnectionString");
if (System::String::IsNullOrEmpty(m_database))
throw gcnew ArgumentNullException("No database was specified in the ConnectionString");
if (System::String::IsNullOrEmpty(m_schema))
throw gcnew ArgumentNullException("No schema was specified in the ConnectionString");
if (System::String::IsNullOrEmpty(m_username))
throw gcnew ArgumentNullException("No username was specified in the ConnectionString");
if (System::String::IsNullOrEmpty(m_password))
throw gcnew ArgumentNullException("No password was specified in the ConnectionString");
msclr::interop::marshal_context^ mc = gcnew msclr::interop::marshal_context();
try
{
nuodb::sqlapi::SqlOptionArray env_opts;
env_opts.count = 0;
SqlEnvironmentWrapper env(nuodb::sqlapi::SqlEnvironment::createSqlEnvironment(&env_opts));
nuodb::sqlapi::SqlOption opts[4];
nuodb::sqlapi::SqlOptionArray conn_opts;
#if DOTNET_35
System::String^ localDatabase(m_database);
opts[0].option = "database";
opts[0].extra = (void*)mc->marshal_as<const char*>(localDatabase);
System::String^ localSchema(m_schema);
opts[1].option = "schema";
opts[1].extra = (void*)mc->marshal_as<const char*>(localSchema);
System::String^ localUsername(m_username);
opts[2].option = "username";
opts[2].extra = (void*)mc->marshal_as<const char*>(localUsername);
System::String^ localPassword(m_password);
opts[3].option = "password";
opts[3].extra = (void*)mc->marshal_as<const char*>(localPassword);
#else
opts[0].option = "database";
opts[0].extra = (void*)mc->marshal_as<const char*>(m_database);
opts[1].option = "schema";
opts[1].extra = (void*)mc->marshal_as<const char*>(m_schema);
opts[2].option = "username";
opts[2].extra = (void*)mc->marshal_as<const char*>(m_username);
opts[3].option = "password";
opts[3].extra = (void*)mc->marshal_as<const char*>(m_password);
#endif //DOTNET_35
conn_opts.count = 4;
conn_opts.array = opts;
m_connection = new SqlConnectionWrapper(env.ref()->createSqlConnection(&conn_opts));
}
catch (nuodb::sqlapi::ErrorCodeException& e)
{
throw gcnew NuoDbException(e);
}
finally
{
delete mc;
}
}
#pragma endregion
#pragma region DbConnection Overrides
#pragma region Properties
void NuoDb::NuoDbConnection::ConnectionString::set(System::String^ value)
{
if (System::String::IsNullOrEmpty(value))
throw gcnew ArgumentNullException("value");
m_connectionString = value;
ParseConnectionString();
}
String^ NuoDb::NuoDbConnection::ServerVersion::get()
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is closed.");
try
{
return gcnew System::String(m_connection->ref()->getMetaData()->getDatabaseVersion());
}
catch (nuodb::sqlapi::ErrorCodeException& e)
{
throw gcnew NuoDbException(e);
}
}
ConnectionState NuoDb::NuoDbConnection::State::get()
{
return NULL == m_connection ? ConnectionState::Closed : ConnectionState::Open;
}
#pragma endregion
#pragma region Methods
NuoDb::NuoDbTransaction^ NuoDb::NuoDbConnection::BeginTransaction()
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is closed.");
if (m_inTransaction)
throw gcnew NuoDbException("A transaction is already underway.");
m_inTransaction = true;
m_connection->ref()->setAutoCommit(false);
return gcnew NuoDbTransaction(this, System::Data::IsolationLevel::ReadCommitted);
}
NuoDb::NuoDbTransaction^ NuoDb::NuoDbConnection::BeginTransaction(IsolationLevel isolationLevel)
{
if (NULL == m_connection)
throw gcnew NuoDbException("The connection is closed.");
if (m_inTransaction)
throw gcnew NuoDbException("A transaction is already underway.");
if (isolationLevel != System::Data::IsolationLevel::ReadCommitted)
throw gcnew NuoDbException("The isolation level is unsupported.");
m_inTransaction = true;
m_connection->ref()->setAutoCommit(false);
return gcnew NuoDbTransaction(this, isolationLevel);
}
DbTransaction^ NuoDb::NuoDbConnection::BeginDbTransaction(IsolationLevel isolationLevel)
{
return BeginTransaction(isolationLevel);
}
void NuoDb::NuoDbConnection::ChangeDatabase(System::String^ databaseName)
{
if (System::String::IsNullOrEmpty(databaseName))
throw gcnew ArgumentNullException("databaseName");
Close();
m_schema = databaseName;
OpenConnection();
}
void NuoDb::NuoDbConnection::Close()
{
RollbackTransaction();
if (m_connection != NULL)
delete m_connection;
m_connection = NULL;
}
void NuoDb::NuoDbConnection::EnlistTransaction(System::Transactions::Transaction^ transaction)
{
throw gcnew NotSupportedException();
}
void NuoDb::NuoDbConnection::Open()
{
OpenConnection();
}
DbCommand^ NuoDb::NuoDbConnection::CreateDbCommand()
{
return CreateCommand();
}
#pragma endregion
#pragma endregion
| bsd-3-clause |
kortschak/OpenBLAS | lapack-netlib/BLAS/SRC/sswap.f | 4 | 3401 | *> \brief \b SSWAP
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE SSWAP(N,SX,INCX,SY,INCY)
*
* .. Scalar Arguments ..
* INTEGER INCX,INCY,N
* ..
* .. Array Arguments ..
* REAL SX(*),SY(*)
* ..
*
*
*> \par Purpose:
* =============
*>
*> \verbatim
*>
*> SSWAP interchanges two vectors.
*> uses unrolled loops for increments equal to 1.
*> \endverbatim
*
* Arguments:
* ==========
*
*> \param[in] N
*> \verbatim
*> N is INTEGER
*> number of elements in input vector(s)
*> \endverbatim
*>
*> \param[in,out] SX
*> \verbatim
*> SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
*> \endverbatim
*>
*> \param[in] INCX
*> \verbatim
*> INCX is INTEGER
*> storage spacing between elements of SX
*> \endverbatim
*>
*> \param[in,out] SY
*> \verbatim
*> SY is REAL array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
*> \endverbatim
*>
*> \param[in] INCY
*> \verbatim
*> INCY is INTEGER
*> storage spacing between elements of SY
*> \endverbatim
*
* Authors:
* ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date November 2017
*
*> \ingroup single_blas_level1
*
*> \par Further Details:
* =====================
*>
*> \verbatim
*>
*> jack dongarra, linpack, 3/11/78.
*> modified 12/3/93, array(1) declarations changed to array(*)
*> \endverbatim
*>
* =====================================================================
SUBROUTINE SSWAP(N,SX,INCX,SY,INCY)
*
* -- Reference BLAS level1 routine (version 3.8.0) --
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2017
*
* .. Scalar Arguments ..
INTEGER INCX,INCY,N
* ..
* .. Array Arguments ..
REAL SX(*),SY(*)
* ..
*
* =====================================================================
*
* .. Local Scalars ..
REAL STEMP
INTEGER I,IX,IY,M,MP1
* ..
* .. Intrinsic Functions ..
INTRINSIC MOD
* ..
IF (N.LE.0) RETURN
IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
*
* code for both increments equal to 1
*
*
* clean-up loop
*
M = MOD(N,3)
IF (M.NE.0) THEN
DO I = 1,M
STEMP = SX(I)
SX(I) = SY(I)
SY(I) = STEMP
END DO
IF (N.LT.3) RETURN
END IF
MP1 = M + 1
DO I = MP1,N,3
STEMP = SX(I)
SX(I) = SY(I)
SY(I) = STEMP
STEMP = SX(I+1)
SX(I+1) = SY(I+1)
SY(I+1) = STEMP
STEMP = SX(I+2)
SX(I+2) = SY(I+2)
SY(I+2) = STEMP
END DO
ELSE
*
* code for unequal increments or equal increments not equal
* to 1
*
IX = 1
IY = 1
IF (INCX.LT.0) IX = (-N+1)*INCX + 1
IF (INCY.LT.0) IY = (-N+1)*INCY + 1
DO I = 1,N
STEMP = SX(IX)
SX(IX) = SY(IY)
SY(IY) = STEMP
IX = IX + INCX
IY = IY + INCY
END DO
END IF
RETURN
END
| bsd-3-clause |
joone/chromium-crosswalk | third_party/WebKit/Source/web/WebKit.cpp | 6 | 10241 | /*
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "public/web/WebKit.h"
#include "bindings/core/v8/ScriptStreamerThread.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8GCController.h"
#include "bindings/core/v8/V8Initializer.h"
#include "core/Init.h"
#include "core/animation/AnimationClock.h"
#include "core/dom/Microtask.h"
#include "core/fetch/WebCacheMemoryDumpProvider.h"
#include "core/frame/Settings.h"
#include "core/page/Page.h"
#include "core/workers/WorkerGlobalScopeProxy.h"
#include "gin/public/v8_platform.h"
#include "modules/InitModules.h"
#include "platform/LayoutTestSupport.h"
#include "platform/Logging.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/fonts/FontCacheMemoryDumpProvider.h"
#include "platform/graphics/ImageDecodingStore.h"
#include "platform/heap/GCTaskRunner.h"
#include "platform/heap/Heap.h"
#include "public/platform/Platform.h"
#include "public/platform/WebPrerenderingSupport.h"
#include "public/platform/WebThread.h"
#include "web/IndexedDBClientImpl.h"
#include "wtf/Assertions.h"
#include "wtf/CryptographicallyRandomNumber.h"
#include "wtf/MainThread.h"
#include "wtf/Partitions.h"
#include "wtf/WTF.h"
#include "wtf/text/AtomicString.h"
#include "wtf/text/TextEncoding.h"
#include <v8.h>
namespace blink {
namespace {
class EndOfTaskRunner : public WebThread::TaskObserver {
public:
void willProcessTask() override
{
AnimationClock::notifyTaskStart();
}
void didProcessTask() override
{
Microtask::performCheckpoint(mainThreadIsolate());
V8GCController::reportDOMMemoryUsageToV8(mainThreadIsolate());
V8Initializer::reportRejectedPromisesOnMainThread();
}
};
class MainThreadTaskRunner: public WebTaskRunner::Task {
WTF_MAKE_NONCOPYABLE(MainThreadTaskRunner);
public:
MainThreadTaskRunner(WTF::MainThreadFunction* function, void* context)
: m_function(function)
, m_context(context) { }
void run() override
{
m_function(m_context);
}
private:
WTF::MainThreadFunction* m_function;
void* m_context;
};
} // namespace
static WebThread::TaskObserver* s_endOfTaskRunner = nullptr;
static GCTaskRunner* s_gcTaskRunner = nullptr;
// Make sure we are not re-initialized in the same address space.
// Doing so may cause hard to reproduce crashes.
static bool s_webKitInitialized = false;
void initialize(Platform* platform)
{
initializeWithoutV8(platform);
V8Initializer::initializeMainThreadIfNeeded();
OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor(V8PerIsolateData::mainThreadIsolate()));
ThreadState::current()->addInterruptor(interruptor.release());
ThreadState::current()->registerTraceDOMWrappers(V8PerIsolateData::mainThreadIsolate(), V8GCController::traceDOMWrappers);
// currentThread is null if we are running on a thread without a message loop.
if (WebThread* currentThread = platform->currentThread()) {
ASSERT(!s_endOfTaskRunner);
s_endOfTaskRunner = new EndOfTaskRunner;
currentThread->addTaskObserver(s_endOfTaskRunner);
// Register web cache dump provider for tracing.
platform->registerMemoryDumpProvider(WebCacheMemoryDumpProvider::instance(), "MemoryCache");
platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instance(), "FontCaches");
}
}
v8::Isolate* mainThreadIsolate()
{
return V8PerIsolateData::mainThreadIsolate();
}
static double currentTimeFunction()
{
return Platform::current()->currentTimeSeconds();
}
static double monotonicallyIncreasingTimeFunction()
{
return Platform::current()->monotonicallyIncreasingTimeSeconds();
}
static void histogramEnumerationFunction(const char* name, int sample, int boundaryValue)
{
Platform::current()->histogramEnumeration(name, sample, boundaryValue);
}
static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* context)
{
Platform::current()->mainThread()->taskRunner()->postTask(BLINK_FROM_HERE, new MainThreadTaskRunner(function, context));
}
static void adjustAmountOfExternalAllocatedMemory(int size)
{
v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size);
}
void initializeWithoutV8(Platform* platform)
{
ASSERT(!s_webKitInitialized);
s_webKitInitialized = true;
ASSERT(platform);
Platform::initialize(platform);
WTF::initialize(currentTimeFunction, monotonicallyIncreasingTimeFunction, histogramEnumerationFunction, adjustAmountOfExternalAllocatedMemory);
WTF::initializeMainThread(callOnMainThreadFunction);
Heap::init();
ThreadState::attachMainThread();
// currentThread() is null if we are running on a thread without a message loop.
if (WebThread* currentThread = platform->currentThread()) {
ASSERT(!s_gcTaskRunner);
s_gcTaskRunner = new GCTaskRunner(currentThread);
}
DEFINE_STATIC_LOCAL(ModulesInitializer, initializer, ());
initializer.init();
setIndexedDBClientCreateFunction(IndexedDBClientImpl::create);
}
void shutdown()
{
#if defined(LEAK_SANITIZER)
// If LSan is about to perform leak detection, release all the registered
// static Persistent<> root references to global caches that Blink keeps,
// followed by GCs to clear out all they referred to. A full v8 GC cycle
// is needed to flush out all garbage.
//
// This is not needed for caches over non-Oilpan objects, as they're
// not scanned by LSan due to being held in non-global storage
// ("static" references inside functions/methods.)
if (ThreadState* threadState = ThreadState::current()) {
threadState->releaseStaticPersistentNodes();
Heap::collectAllGarbage();
}
#endif
// currentThread() is null if we are running on a thread without a message loop.
if (Platform::current()->currentThread()) {
Platform::current()->unregisterMemoryDumpProvider(WebCacheMemoryDumpProvider::instance());
Platform::current()->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::instance());
// We don't need to (cannot) remove s_endOfTaskRunner from the current
// message loop, because the message loop is already destructed before
// the shutdown() is called.
delete s_endOfTaskRunner;
s_endOfTaskRunner = nullptr;
ASSERT(s_gcTaskRunner);
delete s_gcTaskRunner;
s_gcTaskRunner = nullptr;
}
// Shutdown V8-related background threads before V8 is ramped down. Note
// that this will wait the thread to stop its operations.
ScriptStreamerThread::shutdown();
v8::Isolate* isolate = V8PerIsolateData::mainThreadIsolate();
V8PerIsolateData::willBeDestroyed(isolate);
// Make sure we stop WorkerThreads before the main thread's ThreadState
// and later shutdown steps starts freeing up resources needed during
// worker termination.
WorkerThread::terminateAndWaitForAllWorkers();
ModulesInitializer::terminateThreads();
// Detach the main thread before starting the shutdown sequence
// so that the main thread won't get involved in a GC during the shutdown.
ThreadState::detachMainThread();
V8PerIsolateData::destroy(isolate);
shutdownWithoutV8();
}
void shutdownWithoutV8()
{
ASSERT(!s_endOfTaskRunner);
CoreInitializer::shutdown();
Heap::shutdown();
WTF::shutdown();
Platform::shutdown();
WebPrerenderingSupport::shutdown();
}
// TODO(tkent): The following functions to wrap LayoutTestSupport should be
// moved to public/platform/.
void setLayoutTestMode(bool value)
{
LayoutTestSupport::setIsRunningLayoutTest(value);
}
bool layoutTestMode()
{
return LayoutTestSupport::isRunningLayoutTest();
}
void setMockThemeEnabledForTest(bool value)
{
LayoutTestSupport::setMockThemeEnabledForTest(value);
}
void setFontAntialiasingEnabledForTest(bool value)
{
LayoutTestSupport::setFontAntialiasingEnabledForTest(value);
}
bool fontAntialiasingEnabledForTest()
{
return LayoutTestSupport::isFontAntialiasingEnabledForTest();
}
void setAlwaysUseComplexTextForTest(bool value)
{
LayoutTestSupport::setAlwaysUseComplexTextForTest(value);
}
bool alwaysUseComplexTextForTest()
{
return LayoutTestSupport::alwaysUseComplexTextForTest();
}
void enableLogChannel(const char* name)
{
#if !LOG_DISABLED
WTFLogChannel* channel = getChannelFromName(name);
if (channel)
channel->state = WTFLogChannelOn;
#endif // !LOG_DISABLED
}
void resetPluginCache(bool reloadPages)
{
ASSERT(!reloadPages);
Page::refreshPlugins();
}
void decommitFreeableMemory()
{
WTF::Partitions::decommitFreeableMemory();
}
} // namespace blink
| bsd-3-clause |
buffer51/OpenBLAS | lapack-netlib/LAPACKE/src/lapacke_ztpttf_work.c | 8 | 3917 | /*****************************************************************************
Copyright (c) 2014, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************
* Contents: Native middle-level C interface to LAPACK function ztpttf
* Author: Intel Corporation
* Generated November 2015
*****************************************************************************/
#include "lapacke_utils.h"
lapack_int LAPACKE_ztpttf_work( int matrix_layout, char transr, char uplo,
lapack_int n, const lapack_complex_double* ap,
lapack_complex_double* arf )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_ztpttf( &transr, &uplo, &n, ap, arf, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_complex_double* ap_t = NULL;
lapack_complex_double* arf_t = NULL;
/* Allocate memory for temporary array(s) */
ap_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
( MAX(1,n) * MAX(2,n+1) ) / 2 );
if( ap_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
arf_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
( MAX(1,n) * MAX(2,n+1) ) / 2 );
if( arf_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
/* Transpose input matrices */
LAPACKE_zpp_trans( matrix_layout, uplo, n, ap, ap_t );
/* Call LAPACK function and adjust info */
LAPACK_ztpttf( &transr, &uplo, &n, ap_t, arf_t, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zpf_trans( LAPACK_COL_MAJOR, transr, uplo, n, arf_t, arf );
/* Release memory and exit */
LAPACKE_free( arf_t );
exit_level_1:
LAPACKE_free( ap_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ztpttf_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_ztpttf_work", info );
}
return info;
}
| bsd-3-clause |
crosswalk-project/blink-crosswalk-efl | Source/platform/network/SocketStreamHandle.cpp | 11 | 9504 | /*
* Copyright (C) 2009, 2011, 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "platform/network/SocketStreamHandle.h"
#include "platform/Logging.h"
#include "platform/network/SocketStreamError.h"
#include "platform/network/SocketStreamHandleClient.h"
#include "platform/network/SocketStreamHandleInternal.h"
#include "public/platform/Platform.h"
#include "public/platform/WebData.h"
#include "public/platform/WebSocketStreamError.h"
#include "public/platform/WebSocketStreamHandle.h"
#include "wtf/PassOwnPtr.h"
namespace blink {
static const unsigned bufferSize = 100 * 1024 * 1024;
SocketStreamHandleInternal::SocketStreamHandleInternal(SocketStreamHandle* handle)
: m_handle(handle)
, m_socket(adoptPtr(blink::Platform::current()->createSocketStreamHandle()))
, m_maxPendingSendAllowed(0)
, m_pendingAmountSent(0)
{
}
SocketStreamHandleInternal::~SocketStreamHandleInternal()
{
#if !ENABLE(OILPAN)
m_handle = nullptr;
#endif
}
void SocketStreamHandleInternal::connect(const KURL& url)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p connect()", this);
ASSERT(m_socket);
m_socket->connect(url, this);
}
int SocketStreamHandleInternal::send(const char* data, int len)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p send() len=%d", this, len);
// FIXME: |m_socket| should not be null here, but it seems that there is the
// case. We should figure out such a path and fix it rather than checking
// null here.
if (!m_socket) {
WTF_LOG(Network, "SocketStreamHandleInternal %p send() m_socket is NULL", this);
return 0;
}
if (m_pendingAmountSent + len > m_maxPendingSendAllowed)
len = m_maxPendingSendAllowed - m_pendingAmountSent;
if (len <= 0)
return len;
blink::WebData webdata(data, len);
if (m_socket->send(webdata)) {
m_pendingAmountSent += len;
WTF_LOG(Network, "SocketStreamHandleInternal %p send() Sent %d bytes", this, len);
return len;
}
WTF_LOG(Network, "SocketStreamHandleInternal %p send() m_socket->send() failed", this);
return 0;
}
void SocketStreamHandleInternal::close()
{
WTF_LOG(Network, "SocketStreamHandleInternal %p close()", this);
if (m_socket)
m_socket->close();
}
void SocketStreamHandleInternal::didOpenStream(blink::WebSocketStreamHandle* socketHandle, int maxPendingSendAllowed)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p didOpenStream() maxPendingSendAllowed=%d", this, maxPendingSendAllowed);
ASSERT(maxPendingSendAllowed > 0);
if (m_handle && m_socket) {
ASSERT(socketHandle == m_socket.get());
m_maxPendingSendAllowed = maxPendingSendAllowed;
m_handle->m_state = SocketStreamHandle::Open;
if (m_handle->m_client) {
m_handle->m_client->didOpenSocketStream(m_handle);
return;
}
}
WTF_LOG(Network, "SocketStreamHandleInternal %p didOpenStream() m_handle or m_socket is NULL", this);
}
void SocketStreamHandleInternal::didSendData(blink::WebSocketStreamHandle* socketHandle, int amountSent)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p didSendData() amountSent=%d", this, amountSent);
ASSERT(amountSent > 0);
if (m_handle && m_socket) {
ASSERT(socketHandle == m_socket.get());
m_pendingAmountSent -= amountSent;
ASSERT(m_pendingAmountSent >= 0);
m_handle->sendPendingData();
}
}
void SocketStreamHandleInternal::didReceiveData(blink::WebSocketStreamHandle* socketHandle, const blink::WebData& data)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p didReceiveData() Received %lu bytes", this, static_cast<unsigned long>(data.size()));
if (m_handle && m_socket) {
ASSERT(socketHandle == m_socket.get());
if (m_handle->m_client)
m_handle->m_client->didReceiveSocketStreamData(m_handle, data.data(), data.size());
}
}
void SocketStreamHandleInternal::didClose(blink::WebSocketStreamHandle* socketHandle)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p didClose()", this);
if (m_handle && m_socket) {
ASSERT(socketHandle == m_socket.get());
m_socket.clear();
SocketStreamHandle* h = m_handle;
m_handle = nullptr;
if (h->m_client)
h->m_client->didCloseSocketStream(h);
}
}
void SocketStreamHandleInternal::didFail(blink::WebSocketStreamHandle* socketHandle, const blink::WebSocketStreamError& err)
{
WTF_LOG(Network, "SocketStreamHandleInternal %p didFail()", this);
if (m_handle && m_socket) {
ASSERT(socketHandle == m_socket.get());
if (m_handle->m_client)
m_handle->m_client->didFailSocketStream(m_handle, *(PassRefPtr<SocketStreamError>(err)));
}
}
void SocketStreamHandleInternal::trace(Visitor* visitor)
{
visitor->trace(m_handle);
}
// SocketStreamHandle ----------------------------------------------------------
SocketStreamHandle::SocketStreamHandle(SocketStreamHandleClient* client)
: m_client(client)
, m_state(Connecting)
{
m_internal = SocketStreamHandleInternal::create(this);
}
void SocketStreamHandle::connect(const KURL& url)
{
m_internal->connect(url);
}
SocketStreamHandle::~SocketStreamHandle()
{
#if !ENABLE(OILPAN)
setClient(0);
#endif
}
SocketStreamHandle::SocketStreamState SocketStreamHandle::state() const
{
return m_state;
}
bool SocketStreamHandle::send(const char* data, int length)
{
if (m_state == Connecting || m_state == Closing)
return false;
if (!m_buffer.isEmpty()) {
if (m_buffer.size() + length > bufferSize) {
// FIXME: report error to indicate that buffer has no more space.
return false;
}
m_buffer.append(data, length);
return true;
}
int bytesWritten = 0;
if (m_state == Open)
bytesWritten = sendInternal(data, length);
if (bytesWritten < 0)
return false;
if (m_client)
m_client->didConsumeBufferedAmount(this, bytesWritten);
if (m_buffer.size() + length - bytesWritten > bufferSize) {
// FIXME: report error to indicate that buffer has no more space.
return false;
}
if (bytesWritten < length) {
m_buffer.append(data + bytesWritten, length - bytesWritten);
}
return true;
}
void SocketStreamHandle::close()
{
if (m_state == Closed)
return;
m_state = Closing;
if (!m_buffer.isEmpty())
return;
disconnect();
}
void SocketStreamHandle::disconnect()
{
closeInternal();
m_state = Closed;
}
void SocketStreamHandle::setClient(SocketStreamHandleClient* client)
{
ASSERT(!client || (!m_client && m_state == Connecting));
m_client = client;
}
bool SocketStreamHandle::sendPendingData()
{
if (m_state != Open && m_state != Closing)
return false;
if (m_buffer.isEmpty()) {
if (m_state == Open)
return false;
if (m_state == Closing) {
disconnect();
return false;
}
}
bool pending;
do {
int bytesWritten = sendInternal(m_buffer.firstBlockData(), m_buffer.firstBlockSize());
pending = bytesWritten != static_cast<int>(m_buffer.firstBlockSize());
if (bytesWritten <= 0)
return false;
ASSERT(m_buffer.size() - bytesWritten <= bufferSize);
m_buffer.consume(bytesWritten);
// FIXME: place didConsumeBufferedAmount out of do-while.
if (m_client)
m_client->didConsumeBufferedAmount(this, bytesWritten);
} while (!pending && !m_buffer.isEmpty());
return true;
}
int SocketStreamHandle::sendInternal(const char* buf, int len)
{
if (!m_internal)
return 0;
return m_internal->send(buf, len);
}
void SocketStreamHandle::closeInternal()
{
if (m_internal)
m_internal->close();
}
void SocketStreamHandle::trace(Visitor* visitor)
{
visitor->trace(m_client);
visitor->trace(m_internal);
}
} // namespace blink
| bsd-3-clause |
holyglenn/bosen | app/caffe/src/caffe/layers/softmax_loss_layer.cpp | 12 | 3198 | #include <algorithm>
#include <cfloat>
#include <vector>
#include "caffe/layer.hpp"
#include "caffe/util/math_functions.hpp"
#include "caffe/vision_layers.hpp"
namespace caffe {
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::LayerSetUp(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top,
const bool init_ps, int* num_tables,
map<string, vector<int> >* layer_name_to_blob_global_idx) {
LossLayer<Dtype>::LayerSetUp(bottom, top, init_ps, num_tables,
layer_name_to_blob_global_idx);
softmax_bottom_vec_.clear();
softmax_bottom_vec_.push_back(bottom[0]);
softmax_top_vec_.clear();
softmax_top_vec_.push_back(&prob_);
softmax_layer_->SetUp(softmax_bottom_vec_, &softmax_top_vec_, this->net_id_,
this->thread_id_, init_ps, num_tables, layer_name_to_blob_global_idx);
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Reshape(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
LossLayer<Dtype>::Reshape(bottom, top);
softmax_layer_->Reshape(softmax_bottom_vec_, &softmax_top_vec_);
if (top->size() >= 2) {
// softmax output
(*top)[1]->ReshapeLike(*bottom[0]);
}
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Forward_cpu(
const vector<Blob<Dtype>*>& bottom, vector<Blob<Dtype>*>* top) {
// The forward pass computes the softmax prob values.
softmax_layer_->Forward(softmax_bottom_vec_, &softmax_top_vec_);
const Dtype* prob_data = prob_.cpu_data();
const Dtype* label = bottom[1]->cpu_data();
int num = prob_.num();
int dim = prob_.count() / num;
int spatial_dim = prob_.height() * prob_.width();
Dtype loss = 0;
for (int i = 0; i < num; ++i) {
for (int j = 0; j < spatial_dim; j++) {
loss -= log(std::max(prob_data[i * dim +
static_cast<int>(label[i * spatial_dim + j]) * spatial_dim + j],
Dtype(FLT_MIN)));
}
}
(*top)[0]->mutable_cpu_data()[0] = loss / num / spatial_dim;
if (top->size() == 2) {
(*top)[1]->ShareData(prob_);
}
}
template <typename Dtype>
void SoftmaxWithLossLayer<Dtype>::Backward_cpu(const vector<Blob<Dtype>*>& top,
const vector<bool>& propagate_down,
vector<Blob<Dtype>*>* bottom) {
if (propagate_down[1]) {
LOG(FATAL) << this->type_name()
<< " Layer cannot backpropagate to label inputs.";
}
if (propagate_down[0]) {
Dtype* bottom_diff = (*bottom)[0]->mutable_cpu_diff();
const Dtype* prob_data = prob_.cpu_data();
caffe_copy(prob_.count(), prob_data, bottom_diff);
const Dtype* label = (*bottom)[1]->cpu_data();
int num = prob_.num();
int dim = prob_.count() / num;
int spatial_dim = prob_.height() * prob_.width();
for (int i = 0; i < num; ++i) {
for (int j = 0; j < spatial_dim; ++j) {
bottom_diff[i * dim + static_cast<int>(label[i * spatial_dim + j])
* spatial_dim + j] -= 1;
}
}
// Scale gradient
const Dtype loss_weight = top[0]->cpu_diff()[0];
caffe_scal(prob_.count(), loss_weight / num / spatial_dim, bottom_diff);
}
}
#ifdef CPU_ONLY
STUB_GPU(SoftmaxWithLossLayer);
#endif
INSTANTIATE_CLASS(SoftmaxWithLossLayer);
} // namespace caffe
| bsd-3-clause |
olgirard/openmsp430 | fpga/altera_de0_nano_soc/doc/Terasic/DE0_NANO_SOC/Demonstrations/FPGA/DE0_NANO_SOC_ADC/software/DE0_NANO_SOC_ADC_bsp/HAL/src/alt_environ.c | 16 | 2795 | /******************************************************************************
* *
* License Agreement *
* *
* Copyright (c) 2004 Altera Corporation, San Jose, California, USA. *
* All rights reserved. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the "Software"), *
* to deal in the Software without restriction, including without limitation *
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
* and/or sell copies of the Software, and to permit persons to whom the *
* Software is furnished to do so, subject to the following conditions: *
* *
* The above copyright notice and this permission notice shall be included in *
* all copies or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
* DEALINGS IN THE SOFTWARE. *
* *
* This agreement shall be governed in all respects by the laws of the State *
* of California and by the laws of the United States of America. *
* *
* Altera does not recommend, suggest or require that this reference design *
* file be used in conjunction or combination with any other product. *
******************************************************************************/
#include "os/alt_syscall.h"
/*
* These are the environment variables passed to the C code. By default there
* are no variables registered. An application can manipulate this list using
* getenv() and setenv().
*/
char *__env[1] = { 0 };
char **ALT_ENVIRON = __env;
| bsd-3-clause |
lsalamon/blaze-lib | blazetest/src/mathtest/tdvecsmatmult/V2aMCa.cpp | 19 | 3798 | //=================================================================================================
/*!
// \file src/mathtest/tdvecsmatmult/V2aMCa.cpp
// \brief Source file for the V2aMCa dense vector/sparse matrix multiplication math test
//
// Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/CompressedMatrix.h>
#include <blaze/math/StaticVector.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/tdvecsmatmult/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'V2aMCa'..." << std::endl;
using blazetest::mathtest::TypeA;
try
{
// Matrix type definitions
typedef blaze::StaticVector<TypeA,2UL> V2a;
typedef blaze::CompressedMatrix<TypeA> MCa;
// Creator type definitions
typedef blazetest::Creator<V2a> CV2a;
typedef blazetest::Creator<MCa> CMCa;
// Running the tests
for( size_t i=0UL; i<=6UL; ++i ) {
for( size_t j=0UL; j<=2UL*i; ++j ) {
RUN_TDVECSMATMULT_OPERATION_TEST( CV2a(), CMCa( 2UL, i, j ) );
}
}
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during dense vector/sparse matrix multiplication:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| bsd-3-clause |
wdv4758h/blaze-lib | blazetest/src/mathtest/dmatdmatadd/M3x3bM3x3a.cpp | 19 | 3687 | //=================================================================================================
/*!
// \file src/mathtest/dmatdmatadd/M3x3bM3x3a.cpp
// \brief Source file for the M3x3bM3x3a dense matrix/dense matrix addition math test
//
// Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
// This file is part of the Blaze library. You can redistribute it and/or modify it under
// the terms of the New (Revised) BSD License. Redistribution and use in source and binary
// forms, with or without modification, are permitted provided that the following conditions
// are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
// 3. Neither the names of the Blaze development group nor the names of its contributors
// may be used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
// SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
*/
//=================================================================================================
//*************************************************************************************************
// Includes
//*************************************************************************************************
#include <cstdlib>
#include <iostream>
#include <blaze/math/StaticMatrix.h>
#include <blazetest/mathtest/Creator.h>
#include <blazetest/mathtest/dmatdmatadd/OperationTest.h>
#include <blazetest/system/MathTest.h>
//=================================================================================================
//
// MAIN FUNCTION
//
//=================================================================================================
//*************************************************************************************************
int main()
{
std::cout << " Running 'M3x3bM3x3a'..." << std::endl;
using blazetest::mathtest::TypeA;
using blazetest::mathtest::TypeB;
try
{
// Matrix type definitions
typedef blaze::StaticMatrix<TypeB,3UL,3UL> M3x3b;
typedef blaze::StaticMatrix<TypeA,3UL,3UL> M3x3a;
// Creator type definitions
typedef blazetest::Creator<M3x3b> CM3x3b;
typedef blazetest::Creator<M3x3a> CM3x3a;
// Running the tests
RUN_DMATDMATADD_OPERATION_TEST( CM3x3b(), CM3x3a() );
}
catch( std::exception& ex ) {
std::cerr << "\n\n ERROR DETECTED during dense matrix/dense matrix addition:\n"
<< ex.what() << "\n";
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
//*************************************************************************************************
| bsd-3-clause |
underwriteme/phantomjs | src/qt/src/plugins/codecs/jp/qjpunicode.cpp | 19 | 665074 | /****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
/*! \class QJpUnicodeConv
\reentrant
\internal
*/
#include "qjpunicode.h"
#include "qbytearray.h"
#include <stdlib.h>
QT_BEGIN_NAMESPACE
#define USE_JISX0212
#define Q_STRICT
#define IsLatin(c) (/*((c) >= 0x00) &&*/ ((c) <= 0x7f))
#define IsKana(c) (((c) >= 0xa1) && ((c) <= 0xdf))
#define IsJisChar(c) (((c) >= 0x21) && ((c) <= 0x7e))
#define IsSjisChar1(c) ((((c) >= 0x81) && ((c) <= 0x9f)) || \
(((c) >= 0xe0) && ((c) <= 0xfc)))
#define IsSjisUDC1(c) (((c) >= 0xf0) && ((c) <= 0xfc))
#define IsSjisChar2(c) (((c) >= 0x40) && ((c) != 0x7f) && ((c) <= 0xfc))
#define IsSjisIBMVDCChar1(c) (((c) >= 0xfa) && ((c) <= 0xfc))
static uint jisx0208ToSjis(uint h, uint l);
static
inline uint jisx0208ToSjis(uint jis)
{
return jisx0208ToSjis((jis & 0xff00) >> 8, (jis & 0x00ff));
}
static uint sjisToJisx0208(uint h, uint l);
#if 0
static
inline uint sjisToJisx0208(uint sjis)
{
return sjisToJisx0208((sjis & 0xff00) >> 8, (sjis & 0x00ff));
}
#endif
static uint jisx0201ToUnicode11(uint h, uint l);
static uint jisx0208ToUnicode11(uint h, uint l);
static uint jisx0212ToUnicode11(uint h, uint l);
static uint unicode11ToJisx0201(uint h, uint l);
static uint unicode11ToJisx0208(uint h, uint l);
static uint unicode11ToJisx0212(uint h, uint l);
/*
* Unicode 1.1 conversion.
*/
/*!
\fn QJpUnicodeConv::QJpUnicodeConv (int r)
\internal
*/
/*! \internal */
uint QJpUnicodeConv::asciiToUnicode(uint h, uint l) const
{
if ((h == 0) && (l < 0x80)) {
return l;
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::jisx0201ToUnicode(uint h, uint l) const
{
if (h == 0) {
if (IsLatin(l)) {
return jisx0201LatinToUnicode(h, l);
} else if (IsKana(l)) {
return jisx0201KanaToUnicode(h, l);
}
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::jisx0201LatinToUnicode(uint h, uint l) const
{
if ((h == 0) && IsLatin(l)) {
return jisx0201ToUnicode11(h, l);
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::jisx0201KanaToUnicode(uint h, uint l) const
{
if ((h == 0) && IsKana(l)) {
return jisx0201ToUnicode11(h, l);
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::jisx0208ToUnicode(uint h, uint l) const
{
if (rule & UDC){
if ((0x75 <= h) && (h <= 0x7e) && IsJisChar(l)/*0x21 - 0x7e*/) {
// User Defined Char (mapped to Private Use Area)
return 0xe000 + (h - 0x75) * 0x5e + (l - 0x21);
}
}
if ((rule & NEC_VDC) == 0) {
if ((h == 0x2d) && (IsJisChar(l)/*0x21 - 0x7c*/)) {
// NEC Vendor Defined Char
return 0x0000;
}
}
return jisx0208ToUnicode11(h, l);
}
/*! \internal */
uint QJpUnicodeConv::jisx0212ToUnicode(uint h, uint l) const
{
if (rule & UDC){
if ((0x75 <= h) && (h <= 0x7e) && IsJisChar(l)/*0x21 - 0x7e*/) {
// User Defined Char (mapped to Private Use Area)
return 0xe3ac + (h - 0x75) * 0x5e + (l - 0x21);
}
}
if ((rule & IBM_VDC) == 0){
if (((h == 0x73) && (0x73 <= l) && (l <= 0x7e)) ||
((h == 0x74) && (IsJisChar(l)/*0x21 - 0x7e*/))) {
// IBM Vendor Defined Char
return 0x0000;
}
}
return jisx0212ToUnicode11(h, l);
}
/*! \internal */
uint QJpUnicodeConv::unicodeToAscii(uint h, uint l) const
{
if ((h == 0) && (l < 0x80)) {
return l;
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToJisx0201(uint h, uint l) const
{
uint jis;
if ((jis = unicodeToJisx0201Latin(h, l)) != 0) {
return jis;
} else if ((jis = unicodeToJisx0201Kana(h, l)) != 0) {
return jis;
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToJisx0201Latin(uint h, uint l) const
{
uint jis = unicode11ToJisx0201(h, l);
if (IsLatin(jis)) {
return jis;
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToJisx0201Kana(uint h, uint l) const
{
uint jis = unicode11ToJisx0201(h, l);
if (IsKana(jis)) {
return jis;
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToJisx0208(uint h, uint l) const
{
if (rule & UDC){
uint unicode = (h << 8) | l;
if ((0xe000 <= unicode) && (unicode <= 0xe3ab)) {
// User Defined Char (mapped to Private Use Area)
unicode -= 0xe000;
return ((0x75 + unicode / 0x5e) << 8) | (0x21 + unicode % 0x5e);
}
}
uint jis = unicode11ToJisx0208(h, l);
if ((rule & NEC_VDC) == 0) {
if ((0x2d21 <= jis) && (jis <= 0x2d7c)) {
// NEC Vendor Defined Char
return 0x0000;
}
}
return jis;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToJisx0212(uint h, uint l) const
{
if (rule & UDC){
uint unicode = (h << 8) | l;
if ((0xe3ac <= unicode) && (unicode <= 0xe757)) {
// User Defined Char (mapped to Private Use Area)
unicode -= 0xe3ac;
return ((0x75 + unicode / 0x5e) << 8) | (0x21 + unicode % 0x5e);
}
}
uint jis = unicode11ToJisx0212(h, l);
if ((rule & IBM_VDC) == 0){
if (((0x7373 <= jis) && (jis <= 0x737e)) ||
((0x7421 <= jis) && (jis <= 0x747e))) {
// IBM Vendor Defined Char
return 0x0000;
}
}
return jis;
}
/*! \internal */
uint QJpUnicodeConv::sjisToUnicode(uint h, uint l) const
{
if (h == 0) {
return jisx0201ToUnicode(h, l);
} else if (IsSjisChar1(h) && IsSjisChar2(l)) {
return jisx0208ToUnicode(sjisToJisx0208(h, l));
}
return 0x0000;
}
/*! \internal */
uint QJpUnicodeConv::unicodeToSjis(uint h, uint l) const
{
uint jis;
if ((jis = unicodeToJisx0201(h, l)) != 0x0000) {
return jis;
} else if ((jis = unicodeToJisx0208(h, l)) != 0x0000) {
return jisx0208ToSjis(jis);
} else if ((jis = unicodeToJisx0212(h, l)) != 0x0000) {
return 0x0000;
}
return 0x0000;
}
/*
* Unicode 1.1 with JISX0201 conversion.
*/
class QJpUnicodeConv_Unicode_JISX0201 : public QJpUnicodeConv {
public:
QJpUnicodeConv_Unicode_JISX0201(int r) : QJpUnicodeConv(r) {}
// uint AsciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
// uint Jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
// uint Jisx0208ToUnicode(uint h, uint l) const;
// uint Jisx0212ToUnicode(uint h, uint l) const;
// uint UnicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
// uint UnicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
// uint UnicodeToJisx0208(uint h, uint l) const;
// uint UnicodeToJisx0212(uint h, uint l) const;
};
/*
* Unicode 1.1 with ASCII conversion.
*/
class QJpUnicodeConv_Unicode_ASCII : public QJpUnicodeConv {
public:
QJpUnicodeConv_Unicode_ASCII(int r) : QJpUnicodeConv(r) {}
// uint AsciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
// uint Jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
uint jisx0208ToUnicode(uint h, uint l) const;
uint jisx0212ToUnicode(uint h, uint l) const;
// uint UnicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
// uint UnicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
uint unicodeToJisx0208(uint h, uint l) const;
uint unicodeToJisx0212(uint h, uint l) const;
};
uint QJpUnicodeConv_Unicode_ASCII::jisx0208ToUnicode(uint h, uint l) const
{
if ((h == 0x21) && (l == 0x40)) {
return 0xff3c;
}
return QJpUnicodeConv::jisx0208ToUnicode(h, l);
}
uint QJpUnicodeConv_Unicode_ASCII::jisx0212ToUnicode(uint h, uint l) const
{
if ((h == 0x22) && (l == 0x37)) {
return 0xff5e;
}
return QJpUnicodeConv::jisx0212ToUnicode(h, l);
}
uint QJpUnicodeConv_Unicode_ASCII::unicodeToJisx0208(uint h, uint l) const
{
if ((h == 0x00) && (l == 0x5c)) {
return 0x0000;
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
/*! \internal */
uint QJpUnicodeConv_Unicode_ASCII::unicodeToJisx0212(uint h, uint l) const
{
if ((h == 0x00) && (l == 0x7e)) {
return 0x0000;
}
if ((h == 0xff) && (l == 0x5e)) {
return 0x2237;
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
/*
* JISX0221 with JISX0201 conversion.
*/
class QJpUnicodeConv_JISX0221_JISX0201 : public QJpUnicodeConv {
public:
QJpUnicodeConv_JISX0221_JISX0201(int r) : QJpUnicodeConv(r) {}
uint asciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
// uint Jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
uint jisx0208ToUnicode(uint h, uint l) const;
// uint Jisx0212ToUnicode(uint h, uint l) const;
uint unicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
// uint UnicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
uint unicodeToJisx0208(uint h, uint l) const;
// uint UnicodeToJisx0212(uint h, uint l) const;
};
uint QJpUnicodeConv_JISX0221_JISX0201::asciiToUnicode(uint h, uint l) const
{
return jisx0201LatinToUnicode(h, l);
}
uint QJpUnicodeConv_JISX0221_JISX0201::jisx0208ToUnicode(uint h, uint l) const
{
if ((h == 0x21) && (l == 0x3d)) {
return 0x2014;
}
return QJpUnicodeConv::jisx0208ToUnicode(h, l);
}
uint QJpUnicodeConv_JISX0221_JISX0201::unicodeToAscii(uint h, uint l) const
{
return unicodeToJisx0201Latin(h, l);
}
uint QJpUnicodeConv_JISX0221_JISX0201::unicodeToJisx0208(uint h, uint l) const
{
#ifdef Q_STRICT
if ((h == 0x20) && (l == 0x15)) {
return 0x0000;
}
#endif
if ((h == 0x20) && (l == 0x14)) {
return 0x213d;
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
/*
* JISX0221 with ASCII conversion.
*/
class QJpUnicodeConv_JISX0221_ASCII : public QJpUnicodeConv {
public:
QJpUnicodeConv_JISX0221_ASCII(int r) : QJpUnicodeConv(r) {}
// uint AsciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
uint jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
uint jisx0208ToUnicode(uint h, uint l) const;
uint jisx0212ToUnicode(uint h, uint l) const;
// uint UnicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
uint unicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
uint unicodeToJisx0208(uint h, uint l) const;
uint unicodeToJisx0212(uint h, uint l) const;
};
uint QJpUnicodeConv_JISX0221_ASCII::jisx0201LatinToUnicode(uint h, uint l) const
{
return asciiToUnicode(h, l);
}
uint QJpUnicodeConv_JISX0221_ASCII::jisx0208ToUnicode(uint h, uint l) const
{
if (h == 0x21) {
if (l == 0x31) {
return 0x203e;
} else if (l == 0x3d) {
return 0x02014;
} else if (l == 0x40) {
return 0xff3c;
} else if (l == 0x6f) {
return 0x00a5;
}
}
return QJpUnicodeConv::jisx0208ToUnicode(h, l);
}
uint QJpUnicodeConv_JISX0221_ASCII::jisx0212ToUnicode(uint h, uint l) const
{
if ((h == 0x22) && (l == 0x37)) {
return 0xff5e;
}
return QJpUnicodeConv::jisx0212ToUnicode(h, l);
}
uint QJpUnicodeConv_JISX0221_ASCII::unicodeToJisx0201Latin(uint h, uint l) const
{
return QJpUnicodeConv::unicodeToAscii(h, l);
}
uint QJpUnicodeConv_JISX0221_ASCII::unicodeToJisx0208(uint h, uint l) const
{
#ifdef Q_STRICT
if (((h == 0x00) && (l == 0x5c)) ||
((h == 0x20) && (l == 0x15)) ||
((h == 0xff) && ((l == 0xe3) || (l == 0xe5)))) {
return 0x0000;
}
#else
if ((h == 0x00) && (l == 0x5c)) {
return 0x0000;
}
#endif
if ((h == 0x00) && (l == 0xa5)) {
return 0x216f;
} else if (h == 0x20) {
if (l == 0x14) {
return 0x213d;
} else if (l == 0x3e) {
return 0x2131;
}
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
/*! \internal */
uint QJpUnicodeConv_JISX0221_ASCII::unicodeToJisx0212(uint h, uint l) const
{
if ((h == 0x00) && (l == 0x7e)) {
return 0x0000;
}
if ((h == 0xff) && (l == 0x5e)) {
return 0x2237;
}
return QJpUnicodeConv::unicodeToJisx0212(h, l);
}
/*
* Sun Microsystems conversion.
*/
class QJpUnicodeConv_Sun : public QJpUnicodeConv {
public:
QJpUnicodeConv_Sun(int r) : QJpUnicodeConv(r) {}
// uint AsciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
uint jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
uint jisx0208ToUnicode(uint h, uint l) const;
uint jisx0212ToUnicode(uint h, uint l) const;
uint unicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
uint unicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
uint unicodeToJisx0208(uint h, uint l) const;
uint unicodeToJisx0212(uint h, uint l) const;
};
uint QJpUnicodeConv_Sun::jisx0201LatinToUnicode(uint h, uint l) const
{
return asciiToUnicode(h, l);
}
uint QJpUnicodeConv_Sun::jisx0208ToUnicode(uint h, uint l) const
{
if ((h == 0x21) && (l == 0x40)) {
return 0xff3c;
}
return QJpUnicodeConv::jisx0208ToUnicode(h, l);
}
uint QJpUnicodeConv_Sun::jisx0212ToUnicode(uint h, uint l) const
{
#if 1
// Added by Serika Kususugawa to avoid conflict on U+007c.
if ((h == 0x22) && (l == 0x37)) {
return 0xff5e;
}
#endif
return QJpUnicodeConv::jisx0212ToUnicode(h, l);
}
uint QJpUnicodeConv_Sun::unicodeToAscii(uint h, uint l) const
{
if ((h == 0x00) && (l == 0xa5)) {
return 0x005c;
} else if ((h == 0x20) && (l == 0x3e)) {
return 0x007e;
}
return QJpUnicodeConv::unicodeToAscii(h, l);
}
uint QJpUnicodeConv_Sun::unicodeToJisx0201Latin(uint h, uint l) const
{
return QJpUnicodeConv::unicodeToAscii(h, l);
}
uint QJpUnicodeConv_Sun::unicodeToJisx0208(uint h, uint l) const
{
if ((h == 0x00) && (l == 0xa5)) {
return 0x0000;
} else if ((h == 0x20) && (l == 0x3e)) {
return 0x0000;
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
/*! \internal */
uint QJpUnicodeConv_Sun::unicodeToJisx0212(uint h, uint l) const
{
#if 1
// Added by Serika Kususugawa to avoid conflict on U+007c.
if ((h == 0x00) && (l == 0x7e)) {
return 0x0000;
}
if ((h == 0xff) && (l == 0x5e)) {
return 0x2237;
}
#endif
return QJpUnicodeConv::unicodeToJisx0212(h, l);
}
/*
* Microsoft conversion.
*/
class QJpUnicodeConv_Microsoft : public QJpUnicodeConv {
public:
QJpUnicodeConv_Microsoft(int r) : QJpUnicodeConv(r) {}
// uint AsciiToUnicode(uint h, uint l) const;
// uint Jisx0201ToUnicode(uint h, uint l) const;
uint jisx0201LatinToUnicode(uint h, uint l) const;
// uint Jisx0201KanaToUnicode(uint h, uint l) const;
uint jisx0208ToUnicode(uint h, uint l) const;
uint jisx0212ToUnicode(uint h, uint l) const;
// uint UnicodeToAscii(uint h, uint l) const;
// uint UnicodeToJisx0201(uint h, uint l) const;
uint unicodeToJisx0201Latin(uint h, uint l) const;
// uint UnicodeToJisx0201Kana(uint h, uint l) const;
uint unicodeToJisx0208(uint h, uint l) const;
uint unicodeToJisx0212(uint h, uint l) const;
};
uint QJpUnicodeConv_Microsoft::jisx0201LatinToUnicode(uint h, uint l) const
{
return asciiToUnicode(h, l);
}
uint QJpUnicodeConv_Microsoft::jisx0208ToUnicode(uint h, uint l) const
{
if (h == 0x21) {
if (l == 0x40) {
return 0xff3c;
} else if (l == 0x41) {
return 0xff5e;
} else if (l == 0x42) {
return 0x2225;
} else if (l == 0x5d) {
return 0xff0d;
} else if (l == 0x71) {
return 0xffe0;
} else if (l == 0x72) {
return 0xffe1;
}
} else if (h == 0x22) {
if (l == 0x4c) {
return 0xffe2;
}
}
return QJpUnicodeConv::jisx0208ToUnicode(h, l);
}
uint QJpUnicodeConv_Microsoft::jisx0212ToUnicode(uint h, uint l) const
{
if (h == 0x22) {
if (l == 0x37) {
return 0xff5e;
} else if (l == 0x43) {
return 0xffe4;
}
}
return QJpUnicodeConv::jisx0212ToUnicode(h, l);
}
uint QJpUnicodeConv_Microsoft::unicodeToJisx0201Latin(uint h, uint l) const
{
return QJpUnicodeConv::unicodeToAscii(h, l);
}
uint QJpUnicodeConv_Microsoft::unicodeToJisx0208(uint h, uint l) const
{
#ifdef Q_STRICT
if (((h == 0x00) && ((l == 0x5c) || (l == 0xa2) || (l == 0xa3) || (l == 0xac))) ||
((h == 0x20) && (l == 0x16)) ||
((h == 0x22) && (l == 0x12)) ||
((h == 0x30) && (l == 0x1c))) {
return 0x0000;
}
#else
if ((h == 0x00) && (l == 0x5c)) {
return 0x0000;
}
#endif
if ((h == 0x22) && (l == 0x25)) {
return 0x2142;
} else if (h == 0xff) {
if (l == 0x0d) {
return 0x215d;
} else if (l == 0xe0) {
return 0x2171;
} else if (l == 0xe1) {
return 0x2172;
} else if (l == 0xe2) {
return 0x224c;
}
}
return QJpUnicodeConv::unicodeToJisx0208(h, l);
}
uint QJpUnicodeConv_Microsoft::unicodeToJisx0212(uint h, uint l) const
{
#ifdef Q_STRICT
if ((h == 0x00) && ((l == 0x7e) || (l == 0xa6))) {
return 0x0000;
}
#else
if ((h == 0x00) && (l == 0x7e)) {
return 0x0000;
}
#endif
if (h == 0xff) {
if (l == 0x5e) {
return 0x2237;
} else if (l == 0xe4) {
return 0x2243;
}
}
return QJpUnicodeConv::unicodeToJisx0212(h, l);
}
/*! \internal */
QJpUnicodeConv *QJpUnicodeConv::newConverter(int rule)
{
QByteArray env = qgetenv("UNICODEMAP_JP");
if (rule == Default && !env.isNull()) {
for (int i = 0; i < (int)env.length();) {
int j = env.indexOf(',', i);
QByteArray s;
if (j < 0) {
s = env.mid(i).trimmed();
i = env.length();
} else {
s = env.mid(i, j - i).trimmed();
i = j + 1;
}
if (qstricmp(s, "unicode-0.9") == 0) {
rule = (rule & 0xff00) | Unicode;
} else if (qstricmp(s, "unicode-0201") == 0) {
rule = (rule & 0xff00) | Unicode_JISX0201;
} else if (qstricmp(s, "unicode-ascii") == 0) {
rule = (rule & 0xff00) | Unicode_ASCII;
} else if (qstricmp(s, "jisx0221-1995") == 0) {
rule = (rule & 0xff00) | JISX0221_JISX0201;
} else if ((qstricmp(s, "open-0201") == 0) ||
(qstricmp(s, "open-19970715-0201") == 0)) {
rule = (rule & 0xff00) | JISX0221_JISX0201;
} else if ((qstricmp(s, "open-ascii") == 0) ||
(qstricmp(s, "open-19970715-ascii") == 0)) {
rule = (rule & 0xff00) | JISX0221_ASCII;
} else if ((qstricmp(s, "open-ms") == 0) ||
(qstricmp(s, "open-19970715-ms") == 0)) {
rule = (rule & 0xff00) | Microsoft_CP932;
} else if (qstricmp(s, "cp932") == 0) {
rule = (rule & 0xff00) | Microsoft_CP932;
} else if (qstricmp(s, "jdk1.1.7") == 0) {
rule = (rule & 0xff00) | Sun_JDK117;
} else if (qstricmp(s, "nec-vdc") == 0) {
rule = rule | NEC_VDC;
} else if (qstricmp(s, "ibm-vdc") == 0) {
rule = rule | IBM_VDC;
} else if (qstricmp(s, "udc") == 0) {
rule = rule | UDC;
}
}
}
switch (rule & 0x00ff) {
case Unicode_JISX0201:
return new QJpUnicodeConv_Unicode_JISX0201(rule);
case Unicode_ASCII:
return new QJpUnicodeConv_Unicode_ASCII(rule);
case JISX0221_JISX0201:
return new QJpUnicodeConv_JISX0221_JISX0201(rule);
case JISX0221_ASCII:
return new QJpUnicodeConv_JISX0221_ASCII(rule);
case Sun_JDK117:
return new QJpUnicodeConv_Sun(rule);
case Microsoft_CP932:
return new QJpUnicodeConv_Microsoft(rule);
default:
return new QJpUnicodeConv_Unicode_ASCII(rule);
}
}
/*
* JISX0208 <-> ShiftJIS conversion.
*/
static uint jisx0208ToSjis(uint h, uint l)
{
if ((0x0021 <= h) && (h <= 0x007e) && (0x0021 <= l) && (l <= 0x007e)) {
return ((((h - 1) >> 1) + ((h <= 0x5e) ? 0x71 : 0xb1)) << 8) |
(l + ((h & 1) ? ((l < 0x60) ? 0x1f : 0x20) : 0x7e));
}
return 0x0000;
}
static uint sjisToJisx0208(uint h, uint l)
{
if ((((0x81 <= h) && (h <= 0x9f)) || ((0xe0 <= h) && (h <= 0xef))) &&
((0x40 <= l) && (l != 0x7f) && (l <= 0xfc))) {
if (l < 0x9f) {
return (((h << 1) - ((h <= 0x9f) ? 0x00e1 : 0x0161)) << 8) |
(l - ((l <= 0x7f) ? 0x1f : 0x20));
} else {
return (((h << 1) - ((h <= 0x9f) ? 0x00e1 : 0x0161) + 1) << 8) |
(l - 0x7e);
}
}
return 0x0000;
}
/*
* This function is derived from Unicode 1.1,
* JIS X 0201 (1976) to Unicode mapping table version 0.9 .
*/
#define JISX0201_YEN_SIGN 0x005c
#define UNICODE_YEN_SIGN 0x00a5
#define JISX0201_OVERLINE 0x007e
#define UNICODE_OVERLINE 0x203e
static uint jisx0201ToUnicode11(uint h, uint l)
{
if (h == 0x00) {
if (l < 0x80) {
if (l == JISX0201_YEN_SIGN) {
return UNICODE_YEN_SIGN;
} else if (l == JISX0201_OVERLINE) {
return UNICODE_OVERLINE;
} else {
return l;
}
} else if ((0xa1 <= l) && (l <= 0x00df)) {
return 0xff61 + l - 0x00a1;
}
}
return 0x0000;
}
/*
* This function is derived from Unicode 1.1,
* JIS X 0201 (1976) to Unicode mapping table version 0.9 .
*/
static uint unicode11ToJisx0201(uint h, uint l)
{
if ((h == 0x00) && (l < 0x80)) {
if ((l == JISX0201_YEN_SIGN) ||
(l == JISX0201_OVERLINE)) {
return 0x0000;
}
return l;
} else if ((h == 0x00) && (l == 0xa5)) {
return JISX0201_YEN_SIGN;
} else if ((h == 0x20) && (l == 0x3e)) {
return JISX0201_OVERLINE;
} else if ((h == 0xff) && (0x61 <= l) && (l <= 0x9f)) {
return 0x00a1 + l - 0x61;
}
return 0x0000;
}
/*
* This data is derived from Unicode 1.1,
* JIS X 0208 (1990) to Unicode mapping table version 0.9 .
* (In addition NEC Vender Defined Char included)
*/
static unsigned short const jisx0208_to_unicode[] = {
/* 0x2121 - 0x217e */
0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a,
0xff1b, 0xff1f, 0xff01, 0x309b, 0x309c, 0x00b4, 0xff40, 0x00a8,
0xff3e, 0xffe3, 0xff3f, 0x30fd, 0x30fe, 0x309d, 0x309e, 0x3003,
0x4edd, 0x3005, 0x3006, 0x3007, 0x30fc, 0x2015, 0x2010, 0xff0f,
0x005c, 0x301c, 0x2016, 0xff5c, 0x2026, 0x2025, 0x2018, 0x2019,
0x201c, 0x201d, 0xff08, 0xff09, 0x3014, 0x3015, 0xff3b, 0xff3d,
0xff5b, 0xff5d, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d,
0x300e, 0x300f, 0x3010, 0x3011, 0xff0b, 0xff0d, 0x00b1, 0x00d7,
0x00f7, 0xff1d, 0x2260, 0xff1c, 0xff1e, 0x2266, 0x2267, 0x221e,
0x2234, 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xffe5,
0xff04, 0x00a2, 0x00a3, 0xff05, 0xff03, 0xff06, 0xff0a, 0xff20,
0x00a7, 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7,
/* 0x2221 - 0x227e */
0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc,
0x203b, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283,
0x222a, 0x2229, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2227, 0x2228, 0x00ac, 0x21d2, 0x21d4, 0x2200,
0x2203, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2220, 0x22a5, 0x2312, 0x2202,
0x2207, 0x2261, 0x2252, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d,
0x2235, 0x222b, 0x222c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x212b, 0x2030, 0x266f, 0x266d, 0x266a, 0x2020,
0x2021, 0x00b6, 0x0000, 0x0000, 0x0000, 0x0000, 0x25ef,
/* 0x2321 - 0x237e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0xff10, 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17,
0xff18, 0xff19, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27,
0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f,
0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37,
0xff38, 0xff39, 0xff3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47,
0xff48, 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f,
0xff50, 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57,
0xff58, 0xff59, 0xff5a, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2421 - 0x247e */
0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047,
0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f,
0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057,
0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f,
0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067,
0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f,
0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077,
0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f,
0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087,
0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f,
0x3090, 0x3091, 0x3092, 0x3093, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2521 - 0x257e */
0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7,
0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af,
0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7,
0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf,
0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7,
0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf,
0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7,
0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df,
0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7,
0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef,
0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2621 - 0x267e */
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f,
0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8,
0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8,
0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2721 - 0x277e */
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401,
0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d,
0x041e, 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425,
0x0426, 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d,
0x042e, 0x042f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451,
0x0436, 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d,
0x043e, 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445,
0x0446, 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d,
0x044e, 0x044f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2821 - 0x287e */
0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c,
0x252c, 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513,
0x251b, 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520,
0x252f, 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538,
0x2542, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2921 - 0x297e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2a21 - 0x2a7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2b21 - 0x2b7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2c21 - 0x2c7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2d21 - 0x2d7e */
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466,
0x2467, 0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e,
0x246f, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162,
0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x0000,
0x3349, 0x3314, 0x3322, 0x334d, 0x3318, 0x3327, 0x3303, 0x3336,
0x3351, 0x3357, 0x330d, 0x3326, 0x3323, 0x332b, 0x334a, 0x333b,
0x339c, 0x339d, 0x339e, 0x338e, 0x338f, 0x33c4, 0x33a1, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x337b,
0x301d, 0x301f, 0x2116, 0x33cd, 0x2121, 0x32a4, 0x32a5, 0x32a6,
0x32a7, 0x32a8, 0x3231, 0x3232, 0x3239, 0x337e, 0x337d, 0x337c,
0x2252, 0x2261, 0x222b, 0x222e, 0x2211, 0x221a, 0x22a5, 0x2220,
0x221f, 0x22bf, 0x2235, 0x2229, 0x222a, 0x0000, 0x0000,
/* 0x2e21 - 0x2e7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2f21 - 0x2f7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x3021 - 0x307e */
0x4e9c, 0x5516, 0x5a03, 0x963f, 0x54c0, 0x611b, 0x6328,
0x59f6, 0x9022, 0x8475, 0x831c, 0x7a50, 0x60aa, 0x63e1, 0x6e25,
0x65ed, 0x8466, 0x82a6, 0x9bf5, 0x6893, 0x5727, 0x65a1, 0x6271,
0x5b9b, 0x59d0, 0x867b, 0x98f4, 0x7d62, 0x7dbe, 0x9b8e, 0x6216,
0x7c9f, 0x88b7, 0x5b89, 0x5eb5, 0x6309, 0x6697, 0x6848, 0x95c7,
0x978d, 0x674f, 0x4ee5, 0x4f0a, 0x4f4d, 0x4f9d, 0x5049, 0x56f2,
0x5937, 0x59d4, 0x5a01, 0x5c09, 0x60df, 0x610f, 0x6170, 0x6613,
0x6905, 0x70ba, 0x754f, 0x7570, 0x79fb, 0x7dad, 0x7def, 0x80c3,
0x840e, 0x8863, 0x8b02, 0x9055, 0x907a, 0x533b, 0x4e95, 0x4ea5,
0x57df, 0x80b2, 0x90c1, 0x78ef, 0x4e00, 0x58f1, 0x6ea2, 0x9038,
0x7a32, 0x8328, 0x828b, 0x9c2f, 0x5141, 0x5370, 0x54bd, 0x54e1,
0x56e0, 0x59fb, 0x5f15, 0x98f2, 0x6deb, 0x80e4, 0x852d,
/* 0x3121 - 0x317e */
0x9662, 0x9670, 0x96a0, 0x97fb, 0x540b, 0x53f3, 0x5b87,
0x70cf, 0x7fbd, 0x8fc2, 0x96e8, 0x536f, 0x9d5c, 0x7aba, 0x4e11,
0x7893, 0x81fc, 0x6e26, 0x5618, 0x5504, 0x6b1d, 0x851a, 0x9c3b,
0x59e5, 0x53a9, 0x6d66, 0x74dc, 0x958f, 0x5642, 0x4e91, 0x904b,
0x96f2, 0x834f, 0x990c, 0x53e1, 0x55b6, 0x5b30, 0x5f71, 0x6620,
0x66f3, 0x6804, 0x6c38, 0x6cf3, 0x6d29, 0x745b, 0x76c8, 0x7a4e,
0x9834, 0x82f1, 0x885b, 0x8a60, 0x92ed, 0x6db2, 0x75ab, 0x76ca,
0x99c5, 0x60a6, 0x8b01, 0x8d8a, 0x95b2, 0x698e, 0x53ad, 0x5186,
0x5712, 0x5830, 0x5944, 0x5bb4, 0x5ef6, 0x6028, 0x63a9, 0x63f4,
0x6cbf, 0x6f14, 0x708e, 0x7114, 0x7159, 0x71d5, 0x733f, 0x7e01,
0x8276, 0x82d1, 0x8597, 0x9060, 0x925b, 0x9d1b, 0x5869, 0x65bc,
0x6c5a, 0x7525, 0x51f9, 0x592e, 0x5965, 0x5f80, 0x5fdc,
/* 0x3221 - 0x327e */
0x62bc, 0x65fa, 0x6a2a, 0x6b27, 0x6bb4, 0x738b, 0x7fc1,
0x8956, 0x9d2c, 0x9d0e, 0x9ec4, 0x5ca1, 0x6c96, 0x837b, 0x5104,
0x5c4b, 0x61b6, 0x81c6, 0x6876, 0x7261, 0x4e59, 0x4ffa, 0x5378,
0x6069, 0x6e29, 0x7a4f, 0x97f3, 0x4e0b, 0x5316, 0x4eee, 0x4f55,
0x4f3d, 0x4fa1, 0x4f73, 0x52a0, 0x53ef, 0x5609, 0x590f, 0x5ac1,
0x5bb6, 0x5be1, 0x79d1, 0x6687, 0x679c, 0x67b6, 0x6b4c, 0x6cb3,
0x706b, 0x73c2, 0x798d, 0x79be, 0x7a3c, 0x7b87, 0x82b1, 0x82db,
0x8304, 0x8377, 0x83ef, 0x83d3, 0x8766, 0x8ab2, 0x5629, 0x8ca8,
0x8fe6, 0x904e, 0x971e, 0x868a, 0x4fc4, 0x5ce8, 0x6211, 0x7259,
0x753b, 0x81e5, 0x82bd, 0x86fe, 0x8cc0, 0x96c5, 0x9913, 0x99d5,
0x4ecb, 0x4f1a, 0x89e3, 0x56de, 0x584a, 0x58ca, 0x5efb, 0x5feb,
0x602a, 0x6094, 0x6062, 0x61d0, 0x6212, 0x62d0, 0x6539,
/* 0x3321 - 0x337e */
0x9b41, 0x6666, 0x68b0, 0x6d77, 0x7070, 0x754c, 0x7686,
0x7d75, 0x82a5, 0x87f9, 0x958b, 0x968e, 0x8c9d, 0x51f1, 0x52be,
0x5916, 0x54b3, 0x5bb3, 0x5d16, 0x6168, 0x6982, 0x6daf, 0x788d,
0x84cb, 0x8857, 0x8a72, 0x93a7, 0x9ab8, 0x6d6c, 0x99a8, 0x86d9,
0x57a3, 0x67ff, 0x86ce, 0x920e, 0x5283, 0x5687, 0x5404, 0x5ed3,
0x62e1, 0x64b9, 0x683c, 0x6838, 0x6bbb, 0x7372, 0x78ba, 0x7a6b,
0x899a, 0x89d2, 0x8d6b, 0x8f03, 0x90ed, 0x95a3, 0x9694, 0x9769,
0x5b66, 0x5cb3, 0x697d, 0x984d, 0x984e, 0x639b, 0x7b20, 0x6a2b,
0x6a7f, 0x68b6, 0x9c0d, 0x6f5f, 0x5272, 0x559d, 0x6070, 0x62ec,
0x6d3b, 0x6e07, 0x6ed1, 0x845b, 0x8910, 0x8f44, 0x4e14, 0x9c39,
0x53f6, 0x691b, 0x6a3a, 0x9784, 0x682a, 0x515c, 0x7ac3, 0x84b2,
0x91dc, 0x938c, 0x565b, 0x9d28, 0x6822, 0x8305, 0x8431,
/* 0x3421 - 0x347e */
0x7ca5, 0x5208, 0x82c5, 0x74e6, 0x4e7e, 0x4f83, 0x51a0,
0x5bd2, 0x520a, 0x52d8, 0x52e7, 0x5dfb, 0x559a, 0x582a, 0x59e6,
0x5b8c, 0x5b98, 0x5bdb, 0x5e72, 0x5e79, 0x60a3, 0x611f, 0x6163,
0x61be, 0x63db, 0x6562, 0x67d1, 0x6853, 0x68fa, 0x6b3e, 0x6b53,
0x6c57, 0x6f22, 0x6f97, 0x6f45, 0x74b0, 0x7518, 0x76e3, 0x770b,
0x7aff, 0x7ba1, 0x7c21, 0x7de9, 0x7f36, 0x7ff0, 0x809d, 0x8266,
0x839e, 0x89b3, 0x8acc, 0x8cab, 0x9084, 0x9451, 0x9593, 0x9591,
0x95a2, 0x9665, 0x97d3, 0x9928, 0x8218, 0x4e38, 0x542b, 0x5cb8,
0x5dcc, 0x73a9, 0x764c, 0x773c, 0x5ca9, 0x7feb, 0x8d0b, 0x96c1,
0x9811, 0x9854, 0x9858, 0x4f01, 0x4f0e, 0x5371, 0x559c, 0x5668,
0x57fa, 0x5947, 0x5b09, 0x5bc4, 0x5c90, 0x5e0c, 0x5e7e, 0x5fcc,
0x63ee, 0x673a, 0x65d7, 0x65e2, 0x671f, 0x68cb, 0x68c4,
/* 0x3521 - 0x357e */
0x6a5f, 0x5e30, 0x6bc5, 0x6c17, 0x6c7d, 0x757f, 0x7948,
0x5b63, 0x7a00, 0x7d00, 0x5fbd, 0x898f, 0x8a18, 0x8cb4, 0x8d77,
0x8ecc, 0x8f1d, 0x98e2, 0x9a0e, 0x9b3c, 0x4e80, 0x507d, 0x5100,
0x5993, 0x5b9c, 0x622f, 0x6280, 0x64ec, 0x6b3a, 0x72a0, 0x7591,
0x7947, 0x7fa9, 0x87fb, 0x8abc, 0x8b70, 0x63ac, 0x83ca, 0x97a0,
0x5409, 0x5403, 0x55ab, 0x6854, 0x6a58, 0x8a70, 0x7827, 0x6775,
0x9ecd, 0x5374, 0x5ba2, 0x811a, 0x8650, 0x9006, 0x4e18, 0x4e45,
0x4ec7, 0x4f11, 0x53ca, 0x5438, 0x5bae, 0x5f13, 0x6025, 0x6551,
0x673d, 0x6c42, 0x6c72, 0x6ce3, 0x7078, 0x7403, 0x7a76, 0x7aae,
0x7b08, 0x7d1a, 0x7cfe, 0x7d66, 0x65e7, 0x725b, 0x53bb, 0x5c45,
0x5de8, 0x62d2, 0x62e0, 0x6319, 0x6e20, 0x865a, 0x8a31, 0x8ddd,
0x92f8, 0x6f01, 0x79a6, 0x9b5a, 0x4ea8, 0x4eab, 0x4eac,
/* 0x3621 - 0x367e */
0x4f9b, 0x4fa0, 0x50d1, 0x5147, 0x7af6, 0x5171, 0x51f6,
0x5354, 0x5321, 0x537f, 0x53eb, 0x55ac, 0x5883, 0x5ce1, 0x5f37,
0x5f4a, 0x602f, 0x6050, 0x606d, 0x631f, 0x6559, 0x6a4b, 0x6cc1,
0x72c2, 0x72ed, 0x77ef, 0x80f8, 0x8105, 0x8208, 0x854e, 0x90f7,
0x93e1, 0x97ff, 0x9957, 0x9a5a, 0x4ef0, 0x51dd, 0x5c2d, 0x6681,
0x696d, 0x5c40, 0x66f2, 0x6975, 0x7389, 0x6850, 0x7c81, 0x50c5,
0x52e4, 0x5747, 0x5dfe, 0x9326, 0x65a4, 0x6b23, 0x6b3d, 0x7434,
0x7981, 0x79bd, 0x7b4b, 0x7dca, 0x82b9, 0x83cc, 0x887f, 0x895f,
0x8b39, 0x8fd1, 0x91d1, 0x541f, 0x9280, 0x4e5d, 0x5036, 0x53e5,
0x533a, 0x72d7, 0x7396, 0x77e9, 0x82e6, 0x8eaf, 0x99c6, 0x99c8,
0x99d2, 0x5177, 0x611a, 0x865e, 0x55b0, 0x7a7a, 0x5076, 0x5bd3,
0x9047, 0x9685, 0x4e32, 0x6adb, 0x91e7, 0x5c51, 0x5c48,
/* 0x3721 - 0x377e */
0x6398, 0x7a9f, 0x6c93, 0x9774, 0x8f61, 0x7aaa, 0x718a,
0x9688, 0x7c82, 0x6817, 0x7e70, 0x6851, 0x936c, 0x52f2, 0x541b,
0x85ab, 0x8a13, 0x7fa4, 0x8ecd, 0x90e1, 0x5366, 0x8888, 0x7941,
0x4fc2, 0x50be, 0x5211, 0x5144, 0x5553, 0x572d, 0x73ea, 0x578b,
0x5951, 0x5f62, 0x5f84, 0x6075, 0x6176, 0x6167, 0x61a9, 0x63b2,
0x643a, 0x656c, 0x666f, 0x6842, 0x6e13, 0x7566, 0x7a3d, 0x7cfb,
0x7d4c, 0x7d99, 0x7e4b, 0x7f6b, 0x830e, 0x834a, 0x86cd, 0x8a08,
0x8a63, 0x8b66, 0x8efd, 0x981a, 0x9d8f, 0x82b8, 0x8fce, 0x9be8,
0x5287, 0x621f, 0x6483, 0x6fc0, 0x9699, 0x6841, 0x5091, 0x6b20,
0x6c7a, 0x6f54, 0x7a74, 0x7d50, 0x8840, 0x8a23, 0x6708, 0x4ef6,
0x5039, 0x5026, 0x5065, 0x517c, 0x5238, 0x5263, 0x55a7, 0x570f,
0x5805, 0x5acc, 0x5efa, 0x61b2, 0x61f8, 0x62f3, 0x6372,
/* 0x3821 - 0x387e */
0x691c, 0x6a29, 0x727d, 0x72ac, 0x732e, 0x7814, 0x786f,
0x7d79, 0x770c, 0x80a9, 0x898b, 0x8b19, 0x8ce2, 0x8ed2, 0x9063,
0x9375, 0x967a, 0x9855, 0x9a13, 0x9e78, 0x5143, 0x539f, 0x53b3,
0x5e7b, 0x5f26, 0x6e1b, 0x6e90, 0x7384, 0x73fe, 0x7d43, 0x8237,
0x8a00, 0x8afa, 0x9650, 0x4e4e, 0x500b, 0x53e4, 0x547c, 0x56fa,
0x59d1, 0x5b64, 0x5df1, 0x5eab, 0x5f27, 0x6238, 0x6545, 0x67af,
0x6e56, 0x72d0, 0x7cca, 0x88b4, 0x80a1, 0x80e1, 0x83f0, 0x864e,
0x8a87, 0x8de8, 0x9237, 0x96c7, 0x9867, 0x9f13, 0x4e94, 0x4e92,
0x4f0d, 0x5348, 0x5449, 0x543e, 0x5a2f, 0x5f8c, 0x5fa1, 0x609f,
0x68a7, 0x6a8e, 0x745a, 0x7881, 0x8a9e, 0x8aa4, 0x8b77, 0x9190,
0x4e5e, 0x9bc9, 0x4ea4, 0x4f7c, 0x4faf, 0x5019, 0x5016, 0x5149,
0x516c, 0x529f, 0x52b9, 0x52fe, 0x539a, 0x53e3, 0x5411,
/* 0x3921 - 0x397e */
0x540e, 0x5589, 0x5751, 0x57a2, 0x597d, 0x5b54, 0x5b5d,
0x5b8f, 0x5de5, 0x5de7, 0x5df7, 0x5e78, 0x5e83, 0x5e9a, 0x5eb7,
0x5f18, 0x6052, 0x614c, 0x6297, 0x62d8, 0x63a7, 0x653b, 0x6602,
0x6643, 0x66f4, 0x676d, 0x6821, 0x6897, 0x69cb, 0x6c5f, 0x6d2a,
0x6d69, 0x6e2f, 0x6e9d, 0x7532, 0x7687, 0x786c, 0x7a3f, 0x7ce0,
0x7d05, 0x7d18, 0x7d5e, 0x7db1, 0x8015, 0x8003, 0x80af, 0x80b1,
0x8154, 0x818f, 0x822a, 0x8352, 0x884c, 0x8861, 0x8b1b, 0x8ca2,
0x8cfc, 0x90ca, 0x9175, 0x9271, 0x783f, 0x92fc, 0x95a4, 0x964d,
0x9805, 0x9999, 0x9ad8, 0x9d3b, 0x525b, 0x52ab, 0x53f7, 0x5408,
0x58d5, 0x62f7, 0x6fe0, 0x8c6a, 0x8f5f, 0x9eb9, 0x514b, 0x523b,
0x544a, 0x56fd, 0x7a40, 0x9177, 0x9d60, 0x9ed2, 0x7344, 0x6f09,
0x8170, 0x7511, 0x5ffd, 0x60da, 0x9aa8, 0x72db, 0x8fbc,
/* 0x3a21 - 0x3a7e */
0x6b64, 0x9803, 0x4eca, 0x56f0, 0x5764, 0x58be, 0x5a5a,
0x6068, 0x61c7, 0x660f, 0x6606, 0x6839, 0x68b1, 0x6df7, 0x75d5,
0x7d3a, 0x826e, 0x9b42, 0x4e9b, 0x4f50, 0x53c9, 0x5506, 0x5d6f,
0x5de6, 0x5dee, 0x67fb, 0x6c99, 0x7473, 0x7802, 0x8a50, 0x9396,
0x88df, 0x5750, 0x5ea7, 0x632b, 0x50b5, 0x50ac, 0x518d, 0x6700,
0x54c9, 0x585e, 0x59bb, 0x5bb0, 0x5f69, 0x624d, 0x63a1, 0x683d,
0x6b73, 0x6e08, 0x707d, 0x91c7, 0x7280, 0x7815, 0x7826, 0x796d,
0x658e, 0x7d30, 0x83dc, 0x88c1, 0x8f09, 0x969b, 0x5264, 0x5728,
0x6750, 0x7f6a, 0x8ca1, 0x51b4, 0x5742, 0x962a, 0x583a, 0x698a,
0x80b4, 0x54b2, 0x5d0e, 0x57fc, 0x7895, 0x9dfa, 0x4f5c, 0x524a,
0x548b, 0x643e, 0x6628, 0x6714, 0x67f5, 0x7a84, 0x7b56, 0x7d22,
0x932f, 0x685c, 0x9bad, 0x7b39, 0x5319, 0x518a, 0x5237,
/* 0x3b21 - 0x3b7e */
0x5bdf, 0x62f6, 0x64ae, 0x64e6, 0x672d, 0x6bba, 0x85a9,
0x96d1, 0x7690, 0x9bd6, 0x634c, 0x9306, 0x9bab, 0x76bf, 0x6652,
0x4e09, 0x5098, 0x53c2, 0x5c71, 0x60e8, 0x6492, 0x6563, 0x685f,
0x71e6, 0x73ca, 0x7523, 0x7b97, 0x7e82, 0x8695, 0x8b83, 0x8cdb,
0x9178, 0x9910, 0x65ac, 0x66ab, 0x6b8b, 0x4ed5, 0x4ed4, 0x4f3a,
0x4f7f, 0x523a, 0x53f8, 0x53f2, 0x55e3, 0x56db, 0x58eb, 0x59cb,
0x59c9, 0x59ff, 0x5b50, 0x5c4d, 0x5e02, 0x5e2b, 0x5fd7, 0x601d,
0x6307, 0x652f, 0x5b5c, 0x65af, 0x65bd, 0x65e8, 0x679d, 0x6b62,
0x6b7b, 0x6c0f, 0x7345, 0x7949, 0x79c1, 0x7cf8, 0x7d19, 0x7d2b,
0x80a2, 0x8102, 0x81f3, 0x8996, 0x8a5e, 0x8a69, 0x8a66, 0x8a8c,
0x8aee, 0x8cc7, 0x8cdc, 0x96cc, 0x98fc, 0x6b6f, 0x4e8b, 0x4f3c,
0x4f8d, 0x5150, 0x5b57, 0x5bfa, 0x6148, 0x6301, 0x6642,
/* 0x3c21 - 0x3c7e */
0x6b21, 0x6ecb, 0x6cbb, 0x723e, 0x74bd, 0x75d4, 0x78c1,
0x793a, 0x800c, 0x8033, 0x81ea, 0x8494, 0x8f9e, 0x6c50, 0x9e7f,
0x5f0f, 0x8b58, 0x9d2b, 0x7afa, 0x8ef8, 0x5b8d, 0x96eb, 0x4e03,
0x53f1, 0x57f7, 0x5931, 0x5ac9, 0x5ba4, 0x6089, 0x6e7f, 0x6f06,
0x75be, 0x8cea, 0x5b9f, 0x8500, 0x7be0, 0x5072, 0x67f4, 0x829d,
0x5c61, 0x854a, 0x7e1e, 0x820e, 0x5199, 0x5c04, 0x6368, 0x8d66,
0x659c, 0x716e, 0x793e, 0x7d17, 0x8005, 0x8b1d, 0x8eca, 0x906e,
0x86c7, 0x90aa, 0x501f, 0x52fa, 0x5c3a, 0x6753, 0x707c, 0x7235,
0x914c, 0x91c8, 0x932b, 0x82e5, 0x5bc2, 0x5f31, 0x60f9, 0x4e3b,
0x53d6, 0x5b88, 0x624b, 0x6731, 0x6b8a, 0x72e9, 0x73e0, 0x7a2e,
0x816b, 0x8da3, 0x9152, 0x9996, 0x5112, 0x53d7, 0x546a, 0x5bff,
0x6388, 0x6a39, 0x7dac, 0x9700, 0x56da, 0x53ce, 0x5468,
/* 0x3d21 - 0x3d7e */
0x5b97, 0x5c31, 0x5dde, 0x4fee, 0x6101, 0x62fe, 0x6d32,
0x79c0, 0x79cb, 0x7d42, 0x7e4d, 0x7fd2, 0x81ed, 0x821f, 0x8490,
0x8846, 0x8972, 0x8b90, 0x8e74, 0x8f2f, 0x9031, 0x914b, 0x916c,
0x96c6, 0x919c, 0x4ec0, 0x4f4f, 0x5145, 0x5341, 0x5f93, 0x620e,
0x67d4, 0x6c41, 0x6e0b, 0x7363, 0x7e26, 0x91cd, 0x9283, 0x53d4,
0x5919, 0x5bbf, 0x6dd1, 0x795d, 0x7e2e, 0x7c9b, 0x587e, 0x719f,
0x51fa, 0x8853, 0x8ff0, 0x4fca, 0x5cfb, 0x6625, 0x77ac, 0x7ae3,
0x821c, 0x99ff, 0x51c6, 0x5faa, 0x65ec, 0x696f, 0x6b89, 0x6df3,
0x6e96, 0x6f64, 0x76fe, 0x7d14, 0x5de1, 0x9075, 0x9187, 0x9806,
0x51e6, 0x521d, 0x6240, 0x6691, 0x66d9, 0x6e1a, 0x5eb6, 0x7dd2,
0x7f72, 0x66f8, 0x85af, 0x85f7, 0x8af8, 0x52a9, 0x53d9, 0x5973,
0x5e8f, 0x5f90, 0x6055, 0x92e4, 0x9664, 0x50b7, 0x511f,
/* 0x3e21 - 0x3e7e */
0x52dd, 0x5320, 0x5347, 0x53ec, 0x54e8, 0x5546, 0x5531,
0x5617, 0x5968, 0x59be, 0x5a3c, 0x5bb5, 0x5c06, 0x5c0f, 0x5c11,
0x5c1a, 0x5e84, 0x5e8a, 0x5ee0, 0x5f70, 0x627f, 0x6284, 0x62db,
0x638c, 0x6377, 0x6607, 0x660c, 0x662d, 0x6676, 0x677e, 0x68a2,
0x6a1f, 0x6a35, 0x6cbc, 0x6d88, 0x6e09, 0x6e58, 0x713c, 0x7126,
0x7167, 0x75c7, 0x7701, 0x785d, 0x7901, 0x7965, 0x79f0, 0x7ae0,
0x7b11, 0x7ca7, 0x7d39, 0x8096, 0x83d6, 0x848b, 0x8549, 0x885d,
0x88f3, 0x8a1f, 0x8a3c, 0x8a54, 0x8a73, 0x8c61, 0x8cde, 0x91a4,
0x9266, 0x937e, 0x9418, 0x969c, 0x9798, 0x4e0a, 0x4e08, 0x4e1e,
0x4e57, 0x5197, 0x5270, 0x57ce, 0x5834, 0x58cc, 0x5b22, 0x5e38,
0x60c5, 0x64fe, 0x6761, 0x6756, 0x6d44, 0x72b6, 0x7573, 0x7a63,
0x84b8, 0x8b72, 0x91b8, 0x9320, 0x5631, 0x57f4, 0x98fe,
/* 0x3f21 - 0x3f7e */
0x62ed, 0x690d, 0x6b96, 0x71ed, 0x7e54, 0x8077, 0x8272,
0x89e6, 0x98df, 0x8755, 0x8fb1, 0x5c3b, 0x4f38, 0x4fe1, 0x4fb5,
0x5507, 0x5a20, 0x5bdd, 0x5be9, 0x5fc3, 0x614e, 0x632f, 0x65b0,
0x664b, 0x68ee, 0x699b, 0x6d78, 0x6df1, 0x7533, 0x75b9, 0x771f,
0x795e, 0x79e6, 0x7d33, 0x81e3, 0x82af, 0x85aa, 0x89aa, 0x8a3a,
0x8eab, 0x8f9b, 0x9032, 0x91dd, 0x9707, 0x4eba, 0x4ec1, 0x5203,
0x5875, 0x58ec, 0x5c0b, 0x751a, 0x5c3d, 0x814e, 0x8a0a, 0x8fc5,
0x9663, 0x976d, 0x7b25, 0x8acf, 0x9808, 0x9162, 0x56f3, 0x53a8,
0x9017, 0x5439, 0x5782, 0x5e25, 0x63a8, 0x6c34, 0x708a, 0x7761,
0x7c8b, 0x7fe0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968f,
0x745e, 0x9ac4, 0x5d07, 0x5d69, 0x6570, 0x67a2, 0x8da8, 0x96db,
0x636e, 0x6749, 0x6919, 0x83c5, 0x9817, 0x96c0, 0x88fe,
/* 0x4021 - 0x407e */
0x6f84, 0x647a, 0x5bf8, 0x4e16, 0x702c, 0x755d, 0x662f,
0x51c4, 0x5236, 0x52e2, 0x59d3, 0x5f81, 0x6027, 0x6210, 0x653f,
0x6574, 0x661f, 0x6674, 0x68f2, 0x6816, 0x6b63, 0x6e05, 0x7272,
0x751f, 0x76db, 0x7cbe, 0x8056, 0x58f0, 0x88fd, 0x897f, 0x8aa0,
0x8a93, 0x8acb, 0x901d, 0x9192, 0x9752, 0x9759, 0x6589, 0x7a0e,
0x8106, 0x96bb, 0x5e2d, 0x60dc, 0x621a, 0x65a5, 0x6614, 0x6790,
0x77f3, 0x7a4d, 0x7c4d, 0x7e3e, 0x810a, 0x8cac, 0x8d64, 0x8de1,
0x8e5f, 0x78a9, 0x5207, 0x62d9, 0x63a5, 0x6442, 0x6298, 0x8a2d,
0x7a83, 0x7bc0, 0x8aac, 0x96ea, 0x7d76, 0x820c, 0x8749, 0x4ed9,
0x5148, 0x5343, 0x5360, 0x5ba3, 0x5c02, 0x5c16, 0x5ddd, 0x6226,
0x6247, 0x64b0, 0x6813, 0x6834, 0x6cc9, 0x6d45, 0x6d17, 0x67d3,
0x6f5c, 0x714e, 0x717d, 0x65cb, 0x7a7f, 0x7bad, 0x7dda,
/* 0x4121 - 0x417e */
0x7e4a, 0x7fa8, 0x817a, 0x821b, 0x8239, 0x85a6, 0x8a6e,
0x8cce, 0x8df5, 0x9078, 0x9077, 0x92ad, 0x9291, 0x9583, 0x9bae,
0x524d, 0x5584, 0x6f38, 0x7136, 0x5168, 0x7985, 0x7e55, 0x81b3,
0x7cce, 0x564c, 0x5851, 0x5ca8, 0x63aa, 0x66fe, 0x66fd, 0x695a,
0x72d9, 0x758f, 0x758e, 0x790e, 0x7956, 0x79df, 0x7c97, 0x7d20,
0x7d44, 0x8607, 0x8a34, 0x963b, 0x9061, 0x9f20, 0x50e7, 0x5275,
0x53cc, 0x53e2, 0x5009, 0x55aa, 0x58ee, 0x594f, 0x723d, 0x5b8b,
0x5c64, 0x531d, 0x60e3, 0x60f3, 0x635c, 0x6383, 0x633f, 0x63bb,
0x64cd, 0x65e9, 0x66f9, 0x5de3, 0x69cd, 0x69fd, 0x6f15, 0x71e5,
0x4e89, 0x75e9, 0x76f8, 0x7a93, 0x7cdf, 0x7dcf, 0x7d9c, 0x8061,
0x8349, 0x8358, 0x846c, 0x84bc, 0x85fb, 0x88c5, 0x8d70, 0x9001,
0x906d, 0x9397, 0x971c, 0x9a12, 0x50cf, 0x5897, 0x618e,
/* 0x4221 - 0x427e */
0x81d3, 0x8535, 0x8d08, 0x9020, 0x4fc3, 0x5074, 0x5247,
0x5373, 0x606f, 0x6349, 0x675f, 0x6e2c, 0x8db3, 0x901f, 0x4fd7,
0x5c5e, 0x8cca, 0x65cf, 0x7d9a, 0x5352, 0x8896, 0x5176, 0x63c3,
0x5b58, 0x5b6b, 0x5c0a, 0x640d, 0x6751, 0x905c, 0x4ed6, 0x591a,
0x592a, 0x6c70, 0x8a51, 0x553e, 0x5815, 0x59a5, 0x60f0, 0x6253,
0x67c1, 0x8235, 0x6955, 0x9640, 0x99c4, 0x9a28, 0x4f53, 0x5806,
0x5bfe, 0x8010, 0x5cb1, 0x5e2f, 0x5f85, 0x6020, 0x614b, 0x6234,
0x66ff, 0x6cf0, 0x6ede, 0x80ce, 0x817f, 0x82d4, 0x888b, 0x8cb8,
0x9000, 0x902e, 0x968a, 0x9edb, 0x9bdb, 0x4ee3, 0x53f0, 0x5927,
0x7b2c, 0x918d, 0x984c, 0x9df9, 0x6edd, 0x7027, 0x5353, 0x5544,
0x5b85, 0x6258, 0x629e, 0x62d3, 0x6ca2, 0x6fef, 0x7422, 0x8a17,
0x9438, 0x6fc1, 0x8afe, 0x8338, 0x51e7, 0x86f8, 0x53ea,
/* 0x4321 - 0x437e */
0x53e9, 0x4f46, 0x9054, 0x8fb0, 0x596a, 0x8131, 0x5dfd,
0x7aea, 0x8fbf, 0x68da, 0x8c37, 0x72f8, 0x9c48, 0x6a3d, 0x8ab0,
0x4e39, 0x5358, 0x5606, 0x5766, 0x62c5, 0x63a2, 0x65e6, 0x6b4e,
0x6de1, 0x6e5b, 0x70ad, 0x77ed, 0x7aef, 0x7baa, 0x7dbb, 0x803d,
0x80c6, 0x86cb, 0x8a95, 0x935b, 0x56e3, 0x58c7, 0x5f3e, 0x65ad,
0x6696, 0x6a80, 0x6bb5, 0x7537, 0x8ac7, 0x5024, 0x77e5, 0x5730,
0x5f1b, 0x6065, 0x667a, 0x6c60, 0x75f4, 0x7a1a, 0x7f6e, 0x81f4,
0x8718, 0x9045, 0x99b3, 0x7bc9, 0x755c, 0x7af9, 0x7b51, 0x84c4,
0x9010, 0x79e9, 0x7a92, 0x8336, 0x5ae1, 0x7740, 0x4e2d, 0x4ef2,
0x5b99, 0x5fe0, 0x62bd, 0x663c, 0x67f1, 0x6ce8, 0x866b, 0x8877,
0x8a3b, 0x914e, 0x92f3, 0x99d0, 0x6a17, 0x7026, 0x732a, 0x82e7,
0x8457, 0x8caf, 0x4e01, 0x5146, 0x51cb, 0x558b, 0x5bf5,
/* 0x4421 - 0x447e */
0x5e16, 0x5e33, 0x5e81, 0x5f14, 0x5f35, 0x5f6b, 0x5fb4,
0x61f2, 0x6311, 0x66a2, 0x671d, 0x6f6e, 0x7252, 0x753a, 0x773a,
0x8074, 0x8139, 0x8178, 0x8776, 0x8abf, 0x8adc, 0x8d85, 0x8df3,
0x929a, 0x9577, 0x9802, 0x9ce5, 0x52c5, 0x6357, 0x76f4, 0x6715,
0x6c88, 0x73cd, 0x8cc3, 0x93ae, 0x9673, 0x6d25, 0x589c, 0x690e,
0x69cc, 0x8ffd, 0x939a, 0x75db, 0x901a, 0x585a, 0x6802, 0x63b4,
0x69fb, 0x4f43, 0x6f2c, 0x67d8, 0x8fbb, 0x8526, 0x7db4, 0x9354,
0x693f, 0x6f70, 0x576a, 0x58f7, 0x5b2c, 0x7d2c, 0x722a, 0x540a,
0x91e3, 0x9db4, 0x4ead, 0x4f4e, 0x505c, 0x5075, 0x5243, 0x8c9e,
0x5448, 0x5824, 0x5b9a, 0x5e1d, 0x5e95, 0x5ead, 0x5ef7, 0x5f1f,
0x608c, 0x62b5, 0x633a, 0x63d0, 0x68af, 0x6c40, 0x7887, 0x798e,
0x7a0b, 0x7de0, 0x8247, 0x8a02, 0x8ae6, 0x8e44, 0x9013,
/* 0x4521 - 0x457e */
0x90b8, 0x912d, 0x91d8, 0x9f0e, 0x6ce5, 0x6458, 0x64e2,
0x6575, 0x6ef4, 0x7684, 0x7b1b, 0x9069, 0x93d1, 0x6eba, 0x54f2,
0x5fb9, 0x64a4, 0x8f4d, 0x8fed, 0x9244, 0x5178, 0x586b, 0x5929,
0x5c55, 0x5e97, 0x6dfb, 0x7e8f, 0x751c, 0x8cbc, 0x8ee2, 0x985b,
0x70b9, 0x4f1d, 0x6bbf, 0x6fb1, 0x7530, 0x96fb, 0x514e, 0x5410,
0x5835, 0x5857, 0x59ac, 0x5c60, 0x5f92, 0x6597, 0x675c, 0x6e21,
0x767b, 0x83df, 0x8ced, 0x9014, 0x90fd, 0x934d, 0x7825, 0x783a,
0x52aa, 0x5ea6, 0x571f, 0x5974, 0x6012, 0x5012, 0x515a, 0x51ac,
0x51cd, 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5b95, 0x5cf6,
0x5d8b, 0x60bc, 0x6295, 0x642d, 0x6771, 0x6843, 0x68bc, 0x68df,
0x76d7, 0x6dd8, 0x6e6f, 0x6d9b, 0x706f, 0x71c8, 0x5f53, 0x75d8,
0x7977, 0x7b49, 0x7b54, 0x7b52, 0x7cd6, 0x7d71, 0x5230,
/* 0x4621 - 0x467e */
0x8463, 0x8569, 0x85e4, 0x8a0e, 0x8b04, 0x8c46, 0x8e0f,
0x9003, 0x900f, 0x9419, 0x9676, 0x982d, 0x9a30, 0x95d8, 0x50cd,
0x52d5, 0x540c, 0x5802, 0x5c0e, 0x61a7, 0x649e, 0x6d1e, 0x77b3,
0x7ae5, 0x80f4, 0x8404, 0x9053, 0x9285, 0x5ce0, 0x9d07, 0x533f,
0x5f97, 0x5fb3, 0x6d9c, 0x7279, 0x7763, 0x79bf, 0x7be4, 0x6bd2,
0x72ec, 0x8aad, 0x6803, 0x6a61, 0x51f8, 0x7a81, 0x6934, 0x5c4a,
0x9cf6, 0x82eb, 0x5bc5, 0x9149, 0x701e, 0x5678, 0x5c6f, 0x60c7,
0x6566, 0x6c8c, 0x8c5a, 0x9041, 0x9813, 0x5451, 0x66c7, 0x920d,
0x5948, 0x90a3, 0x5185, 0x4e4d, 0x51ea, 0x8599, 0x8b0e, 0x7058,
0x637a, 0x934b, 0x6962, 0x99b4, 0x7e04, 0x7577, 0x5357, 0x6960,
0x8edf, 0x96e3, 0x6c5d, 0x4e8c, 0x5c3c, 0x5f10, 0x8fe9, 0x5302,
0x8cd1, 0x8089, 0x8679, 0x5eff, 0x65e5, 0x4e73, 0x5165,
/* 0x4721 - 0x477e */
0x5982, 0x5c3f, 0x97ee, 0x4efb, 0x598a, 0x5fcd, 0x8a8d,
0x6fe1, 0x79b0, 0x7962, 0x5be7, 0x8471, 0x732b, 0x71b1, 0x5e74,
0x5ff5, 0x637b, 0x649a, 0x71c3, 0x7c98, 0x4e43, 0x5efc, 0x4e4b,
0x57dc, 0x56a2, 0x60a9, 0x6fc3, 0x7d0d, 0x80fd, 0x8133, 0x81bf,
0x8fb2, 0x8997, 0x86a4, 0x5df4, 0x628a, 0x64ad, 0x8987, 0x6777,
0x6ce2, 0x6d3e, 0x7436, 0x7834, 0x5a46, 0x7f75, 0x82ad, 0x99ac,
0x4ff3, 0x5ec3, 0x62dd, 0x6392, 0x6557, 0x676f, 0x76c3, 0x724c,
0x80cc, 0x80ba, 0x8f29, 0x914d, 0x500d, 0x57f9, 0x5a92, 0x6885,
0x6973, 0x7164, 0x72fd, 0x8cb7, 0x58f2, 0x8ce0, 0x966a, 0x9019,
0x877f, 0x79e4, 0x77e7, 0x8429, 0x4f2f, 0x5265, 0x535a, 0x62cd,
0x67cf, 0x6cca, 0x767d, 0x7b94, 0x7c95, 0x8236, 0x8584, 0x8feb,
0x66dd, 0x6f20, 0x7206, 0x7e1b, 0x83ab, 0x99c1, 0x9ea6,
/* 0x4821 - 0x487e */
0x51fd, 0x7bb1, 0x7872, 0x7bb8, 0x8087, 0x7b48, 0x6ae8,
0x5e61, 0x808c, 0x7551, 0x7560, 0x516b, 0x9262, 0x6e8c, 0x767a,
0x9197, 0x9aea, 0x4f10, 0x7f70, 0x629c, 0x7b4f, 0x95a5, 0x9ce9,
0x567a, 0x5859, 0x86e4, 0x96bc, 0x4f34, 0x5224, 0x534a, 0x53cd,
0x53db, 0x5e06, 0x642c, 0x6591, 0x677f, 0x6c3e, 0x6c4e, 0x7248,
0x72af, 0x73ed, 0x7554, 0x7e41, 0x822c, 0x85e9, 0x8ca9, 0x7bc4,
0x91c6, 0x7169, 0x9812, 0x98ef, 0x633d, 0x6669, 0x756a, 0x76e4,
0x78d0, 0x8543, 0x86ee, 0x532a, 0x5351, 0x5426, 0x5983, 0x5e87,
0x5f7c, 0x60b2, 0x6249, 0x6279, 0x62ab, 0x6590, 0x6bd4, 0x6ccc,
0x75b2, 0x76ae, 0x7891, 0x79d8, 0x7dcb, 0x7f77, 0x80a5, 0x88ab,
0x8ab9, 0x8cbb, 0x907f, 0x975e, 0x98db, 0x6a0b, 0x7c38, 0x5099,
0x5c3e, 0x5fae, 0x6787, 0x6bd8, 0x7435, 0x7709, 0x7f8e,
/* 0x4921 - 0x497e */
0x9f3b, 0x67ca, 0x7a17, 0x5339, 0x758b, 0x9aed, 0x5f66,
0x819d, 0x83f1, 0x8098, 0x5f3c, 0x5fc5, 0x7562, 0x7b46, 0x903c,
0x6867, 0x59eb, 0x5a9b, 0x7d10, 0x767e, 0x8b2c, 0x4ff5, 0x5f6a,
0x6a19, 0x6c37, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8a55, 0x8c79,
0x5edf, 0x63cf, 0x75c5, 0x79d2, 0x82d7, 0x9328, 0x92f2, 0x849c,
0x86ed, 0x9c2d, 0x54c1, 0x5f6c, 0x658c, 0x6d5c, 0x7015, 0x8ca7,
0x8cd3, 0x983b, 0x654f, 0x74f6, 0x4e0d, 0x4ed8, 0x57e0, 0x592b,
0x5a66, 0x5bcc, 0x51a8, 0x5e03, 0x5e9c, 0x6016, 0x6276, 0x6577,
0x65a7, 0x666e, 0x6d6e, 0x7236, 0x7b26, 0x8150, 0x819a, 0x8299,
0x8b5c, 0x8ca0, 0x8ce6, 0x8d74, 0x961c, 0x9644, 0x4fae, 0x64ab,
0x6b66, 0x821e, 0x8461, 0x856a, 0x90e8, 0x5c01, 0x6953, 0x98a8,
0x847a, 0x8557, 0x4f0f, 0x526f, 0x5fa9, 0x5e45, 0x670d,
/* 0x4a21 - 0x4a7e */
0x798f, 0x8179, 0x8907, 0x8986, 0x6df5, 0x5f17, 0x6255,
0x6cb8, 0x4ecf, 0x7269, 0x9b92, 0x5206, 0x543b, 0x5674, 0x58b3,
0x61a4, 0x626e, 0x711a, 0x596e, 0x7c89, 0x7cde, 0x7d1b, 0x96f0,
0x6587, 0x805e, 0x4e19, 0x4f75, 0x5175, 0x5840, 0x5e63, 0x5e73,
0x5f0a, 0x67c4, 0x4e26, 0x853d, 0x9589, 0x965b, 0x7c73, 0x9801,
0x50fb, 0x58c1, 0x7656, 0x78a7, 0x5225, 0x77a5, 0x8511, 0x7b86,
0x504f, 0x5909, 0x7247, 0x7bc7, 0x7de8, 0x8fba, 0x8fd4, 0x904d,
0x4fbf, 0x52c9, 0x5a29, 0x5f01, 0x97ad, 0x4fdd, 0x8217, 0x92ea,
0x5703, 0x6355, 0x6b69, 0x752b, 0x88dc, 0x8f14, 0x7a42, 0x52df,
0x5893, 0x6155, 0x620a, 0x66ae, 0x6bcd, 0x7c3f, 0x83e9, 0x5023,
0x4ff8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5b9d, 0x5cf0, 0x5cef,
0x5d29, 0x5e96, 0x62b1, 0x6367, 0x653e, 0x65b9, 0x670b,
/* 0x4b21 - 0x4b7e */
0x6cd5, 0x6ce1, 0x70f9, 0x7832, 0x7e2b, 0x80de, 0x82b3,
0x840c, 0x84ec, 0x8702, 0x8912, 0x8a2a, 0x8c4a, 0x90a6, 0x92d2,
0x98fd, 0x9cf3, 0x9d6c, 0x4e4f, 0x4ea1, 0x508d, 0x5256, 0x574a,
0x59a8, 0x5e3d, 0x5fd8, 0x5fd9, 0x623f, 0x66b4, 0x671b, 0x67d0,
0x68d2, 0x5192, 0x7d21, 0x80aa, 0x81a8, 0x8b00, 0x8c8c, 0x8cbf,
0x927e, 0x9632, 0x5420, 0x982c, 0x5317, 0x50d5, 0x535c, 0x58a8,
0x64b2, 0x6734, 0x7267, 0x7766, 0x7a46, 0x91e6, 0x52c3, 0x6ca1,
0x6b86, 0x5800, 0x5e4c, 0x5954, 0x672c, 0x7ffb, 0x51e1, 0x76c6,
0x6469, 0x78e8, 0x9b54, 0x9ebb, 0x57cb, 0x59b9, 0x6627, 0x679a,
0x6bce, 0x54e9, 0x69d9, 0x5e55, 0x819c, 0x6795, 0x9baa, 0x67fe,
0x9c52, 0x685d, 0x4ea6, 0x4fe3, 0x53c8, 0x62b9, 0x672b, 0x6cab,
0x8fc4, 0x4fad, 0x7e6d, 0x9ebf, 0x4e07, 0x6162, 0x6e80,
/* 0x4c21 - 0x4c7e */
0x6f2b, 0x8513, 0x5473, 0x672a, 0x9b45, 0x5df3, 0x7b95,
0x5cac, 0x5bc6, 0x871c, 0x6e4a, 0x84d1, 0x7a14, 0x8108, 0x5999,
0x7c8d, 0x6c11, 0x7720, 0x52d9, 0x5922, 0x7121, 0x725f, 0x77db,
0x9727, 0x9d61, 0x690b, 0x5a7f, 0x5a18, 0x51a5, 0x540d, 0x547d,
0x660e, 0x76df, 0x8ff7, 0x9298, 0x9cf4, 0x59ea, 0x725d, 0x6ec5,
0x514d, 0x68c9, 0x7dbf, 0x7dec, 0x9762, 0x9eba, 0x6478, 0x6a21,
0x8302, 0x5984, 0x5b5f, 0x6bdb, 0x731b, 0x76f2, 0x7db2, 0x8017,
0x8499, 0x5132, 0x6728, 0x9ed9, 0x76ee, 0x6762, 0x52ff, 0x9905,
0x5c24, 0x623b, 0x7c7e, 0x8cb0, 0x554f, 0x60b6, 0x7d0b, 0x9580,
0x5301, 0x4e5f, 0x51b6, 0x591c, 0x723a, 0x8036, 0x91ce, 0x5f25,
0x77e2, 0x5384, 0x5f79, 0x7d04, 0x85ac, 0x8a33, 0x8e8d, 0x9756,
0x67f3, 0x85ae, 0x9453, 0x6109, 0x6108, 0x6cb9, 0x7652,
/* 0x4d21 - 0x4d7e */
0x8aed, 0x8f38, 0x552f, 0x4f51, 0x512a, 0x52c7, 0x53cb,
0x5ba5, 0x5e7d, 0x60a0, 0x6182, 0x63d6, 0x6709, 0x67da, 0x6e67,
0x6d8c, 0x7336, 0x7337, 0x7531, 0x7950, 0x88d5, 0x8a98, 0x904a,
0x9091, 0x90f5, 0x96c4, 0x878d, 0x5915, 0x4e88, 0x4f59, 0x4e0e,
0x8a89, 0x8f3f, 0x9810, 0x50ad, 0x5e7c, 0x5996, 0x5bb9, 0x5eb8,
0x63da, 0x63fa, 0x64c1, 0x66dc, 0x694a, 0x69d8, 0x6d0b, 0x6eb6,
0x7194, 0x7528, 0x7aaf, 0x7f8a, 0x8000, 0x8449, 0x84c9, 0x8981,
0x8b21, 0x8e0a, 0x9065, 0x967d, 0x990a, 0x617e, 0x6291, 0x6b32,
0x6c83, 0x6d74, 0x7fcc, 0x7ffc, 0x6dc0, 0x7f85, 0x87ba, 0x88f8,
0x6765, 0x83b1, 0x983c, 0x96f7, 0x6d1b, 0x7d61, 0x843d, 0x916a,
0x4e71, 0x5375, 0x5d50, 0x6b04, 0x6feb, 0x85cd, 0x862d, 0x89a7,
0x5229, 0x540f, 0x5c65, 0x674e, 0x68a8, 0x7406, 0x7483,
/* 0x4e21 - 0x4e7e */
0x75e2, 0x88cf, 0x88e1, 0x91cc, 0x96e2, 0x9678, 0x5f8b,
0x7387, 0x7acb, 0x844e, 0x63a0, 0x7565, 0x5289, 0x6d41, 0x6e9c,
0x7409, 0x7559, 0x786b, 0x7c92, 0x9686, 0x7adc, 0x9f8d, 0x4fb6,
0x616e, 0x65c5, 0x865c, 0x4e86, 0x4eae, 0x50da, 0x4e21, 0x51cc,
0x5bee, 0x6599, 0x6881, 0x6dbc, 0x731f, 0x7642, 0x77ad, 0x7a1c,
0x7ce7, 0x826f, 0x8ad2, 0x907c, 0x91cf, 0x9675, 0x9818, 0x529b,
0x7dd1, 0x502b, 0x5398, 0x6797, 0x6dcb, 0x71d0, 0x7433, 0x81e8,
0x8f2a, 0x96a3, 0x9c57, 0x9e9f, 0x7460, 0x5841, 0x6d99, 0x7d2f,
0x985e, 0x4ee4, 0x4f36, 0x4f8b, 0x51b7, 0x52b1, 0x5dba, 0x601c,
0x73b2, 0x793c, 0x82d3, 0x9234, 0x96b7, 0x96f6, 0x970a, 0x9e97,
0x9f62, 0x66a6, 0x6b74, 0x5217, 0x52a3, 0x70c8, 0x88c2, 0x5ec9,
0x604b, 0x6190, 0x6f23, 0x7149, 0x7c3e, 0x7df4, 0x806f,
/* 0x4f21 - 0x4f7e */
0x84ee, 0x9023, 0x932c, 0x5442, 0x9b6f, 0x6ad3, 0x7089,
0x8cc2, 0x8def, 0x9732, 0x52b4, 0x5a41, 0x5eca, 0x5f04, 0x6717,
0x697c, 0x6994, 0x6d6a, 0x6f0f, 0x7262, 0x72fc, 0x7bed, 0x8001,
0x807e, 0x874b, 0x90ce, 0x516d, 0x9e93, 0x7984, 0x808b, 0x9332,
0x8ad6, 0x502d, 0x548c, 0x8a71, 0x6b6a, 0x8cc4, 0x8107, 0x60d1,
0x67a0, 0x9df2, 0x4e99, 0x4e98, 0x9c10, 0x8a6b, 0x85c1, 0x8568,
0x6900, 0x6e7e, 0x7897, 0x8155, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x5021 - 0x507e */
0x5f0c, 0x4e10, 0x4e15, 0x4e2a, 0x4e31, 0x4e36, 0x4e3c,
0x4e3f, 0x4e42, 0x4e56, 0x4e58, 0x4e82, 0x4e85, 0x8c6b, 0x4e8a,
0x8212, 0x5f0d, 0x4e8e, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea2, 0x4eb0,
0x4eb3, 0x4eb6, 0x4ece, 0x4ecd, 0x4ec4, 0x4ec6, 0x4ec2, 0x4ed7,
0x4ede, 0x4eed, 0x4edf, 0x4ef7, 0x4f09, 0x4f5a, 0x4f30, 0x4f5b,
0x4f5d, 0x4f57, 0x4f47, 0x4f76, 0x4f88, 0x4f8f, 0x4f98, 0x4f7b,
0x4f69, 0x4f70, 0x4f91, 0x4f6f, 0x4f86, 0x4f96, 0x5118, 0x4fd4,
0x4fdf, 0x4fce, 0x4fd8, 0x4fdb, 0x4fd1, 0x4fda, 0x4fd0, 0x4fe4,
0x4fe5, 0x501a, 0x5028, 0x5014, 0x502a, 0x5025, 0x5005, 0x4f1c,
0x4ff6, 0x5021, 0x5029, 0x502c, 0x4ffe, 0x4fef, 0x5011, 0x5006,
0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505a, 0x5056,
0x506c, 0x5078, 0x5080, 0x509a, 0x5085, 0x50b4, 0x50b2,
/* 0x5121 - 0x517e */
0x50c9, 0x50ca, 0x50b3, 0x50c2, 0x50d6, 0x50de, 0x50e5,
0x50ed, 0x50e3, 0x50ee, 0x50f9, 0x50f5, 0x5109, 0x5101, 0x5102,
0x5116, 0x5115, 0x5114, 0x511a, 0x5121, 0x513a, 0x5137, 0x513c,
0x513b, 0x513f, 0x5140, 0x5152, 0x514c, 0x5154, 0x5162, 0x7af8,
0x5169, 0x516a, 0x516e, 0x5180, 0x5182, 0x56d8, 0x518c, 0x5189,
0x518f, 0x5191, 0x5193, 0x5195, 0x5196, 0x51a4, 0x51a6, 0x51a2,
0x51a9, 0x51aa, 0x51ab, 0x51b3, 0x51b1, 0x51b2, 0x51b0, 0x51b5,
0x51bd, 0x51c5, 0x51c9, 0x51db, 0x51e0, 0x8655, 0x51e9, 0x51ed,
0x51f0, 0x51f5, 0x51fe, 0x5204, 0x520b, 0x5214, 0x520e, 0x5227,
0x522a, 0x522e, 0x5233, 0x5239, 0x524f, 0x5244, 0x524b, 0x524c,
0x525e, 0x5254, 0x526a, 0x5274, 0x5269, 0x5273, 0x527f, 0x527d,
0x528d, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8fa8,
/* 0x5221 - 0x527e */
0x8fa7, 0x52ac, 0x52ad, 0x52bc, 0x52b5, 0x52c1, 0x52cd,
0x52d7, 0x52de, 0x52e3, 0x52e6, 0x98ed, 0x52e0, 0x52f3, 0x52f5,
0x52f8, 0x52f9, 0x5306, 0x5308, 0x7538, 0x530d, 0x5310, 0x530f,
0x5315, 0x531a, 0x5323, 0x532f, 0x5331, 0x5333, 0x5338, 0x5340,
0x5346, 0x5345, 0x4e17, 0x5349, 0x534d, 0x51d6, 0x535e, 0x5369,
0x536e, 0x5918, 0x537b, 0x5377, 0x5382, 0x5396, 0x53a0, 0x53a6,
0x53a5, 0x53ae, 0x53b0, 0x53b6, 0x53c3, 0x7c12, 0x96d9, 0x53df,
0x66fc, 0x71ee, 0x53ee, 0x53e8, 0x53ed, 0x53fa, 0x5401, 0x543d,
0x5440, 0x542c, 0x542d, 0x543c, 0x542e, 0x5436, 0x5429, 0x541d,
0x544e, 0x548f, 0x5475, 0x548e, 0x545f, 0x5471, 0x5477, 0x5470,
0x5492, 0x547b, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54c7,
0x54a2, 0x54b8, 0x54a5, 0x54ac, 0x54c4, 0x54c8, 0x54a8,
/* 0x5321 - 0x537e */
0x54ab, 0x54c2, 0x54a4, 0x54be, 0x54bc, 0x54d8, 0x54e5,
0x54e6, 0x550f, 0x5514, 0x54fd, 0x54ee, 0x54ed, 0x54fa, 0x54e2,
0x5539, 0x5540, 0x5563, 0x554c, 0x552e, 0x555c, 0x5545, 0x5556,
0x5557, 0x5538, 0x5533, 0x555d, 0x5599, 0x5580, 0x54af, 0x558a,
0x559f, 0x557b, 0x557e, 0x5598, 0x559e, 0x55ae, 0x557c, 0x5583,
0x55a9, 0x5587, 0x55a8, 0x55da, 0x55c5, 0x55df, 0x55c4, 0x55dc,
0x55e4, 0x55d4, 0x5614, 0x55f7, 0x5616, 0x55fe, 0x55fd, 0x561b,
0x55f9, 0x564e, 0x5650, 0x71df, 0x5634, 0x5636, 0x5632, 0x5638,
0x566b, 0x5664, 0x562f, 0x566c, 0x566a, 0x5686, 0x5680, 0x568a,
0x56a0, 0x5694, 0x568f, 0x56a5, 0x56ae, 0x56b6, 0x56b4, 0x56c2,
0x56bc, 0x56c1, 0x56c3, 0x56c0, 0x56c8, 0x56ce, 0x56d1, 0x56d3,
0x56d7, 0x56ee, 0x56f9, 0x5700, 0x56ff, 0x5704, 0x5709,
/* 0x5421 - 0x547e */
0x5708, 0x570b, 0x570d, 0x5713, 0x5718, 0x5716, 0x55c7,
0x571c, 0x5726, 0x5737, 0x5738, 0x574e, 0x573b, 0x5740, 0x574f,
0x5769, 0x57c0, 0x5788, 0x5761, 0x577f, 0x5789, 0x5793, 0x57a0,
0x57b3, 0x57a4, 0x57aa, 0x57b0, 0x57c3, 0x57c6, 0x57d4, 0x57d2,
0x57d3, 0x580a, 0x57d6, 0x57e3, 0x580b, 0x5819, 0x581d, 0x5872,
0x5821, 0x5862, 0x584b, 0x5870, 0x6bc0, 0x5852, 0x583d, 0x5879,
0x5885, 0x58b9, 0x589f, 0x58ab, 0x58ba, 0x58de, 0x58bb, 0x58b8,
0x58ae, 0x58c5, 0x58d3, 0x58d1, 0x58d7, 0x58d9, 0x58d8, 0x58e5,
0x58dc, 0x58e4, 0x58df, 0x58ef, 0x58fa, 0x58f9, 0x58fb, 0x58fc,
0x58fd, 0x5902, 0x590a, 0x5910, 0x591b, 0x68a6, 0x5925, 0x592c,
0x592d, 0x5932, 0x5938, 0x593e, 0x7ad2, 0x5955, 0x5950, 0x594e,
0x595a, 0x5958, 0x5962, 0x5960, 0x5967, 0x596c, 0x5969,
/* 0x5521 - 0x557e */
0x5978, 0x5981, 0x599d, 0x4f5e, 0x4fab, 0x59a3, 0x59b2,
0x59c6, 0x59e8, 0x59dc, 0x598d, 0x59d9, 0x59da, 0x5a25, 0x5a1f,
0x5a11, 0x5a1c, 0x5a09, 0x5a1a, 0x5a40, 0x5a6c, 0x5a49, 0x5a35,
0x5a36, 0x5a62, 0x5a6a, 0x5a9a, 0x5abc, 0x5abe, 0x5acb, 0x5ac2,
0x5abd, 0x5ae3, 0x5ad7, 0x5ae6, 0x5ae9, 0x5ad6, 0x5afa, 0x5afb,
0x5b0c, 0x5b0b, 0x5b16, 0x5b32, 0x5ad0, 0x5b2a, 0x5b36, 0x5b3e,
0x5b43, 0x5b45, 0x5b40, 0x5b51, 0x5b55, 0x5b5a, 0x5b5b, 0x5b65,
0x5b69, 0x5b70, 0x5b73, 0x5b75, 0x5b78, 0x6588, 0x5b7a, 0x5b80,
0x5b83, 0x5ba6, 0x5bb8, 0x5bc3, 0x5bc7, 0x5bc9, 0x5bd4, 0x5bd0,
0x5be4, 0x5be6, 0x5be2, 0x5bde, 0x5be5, 0x5beb, 0x5bf0, 0x5bf6,
0x5bf3, 0x5c05, 0x5c07, 0x5c08, 0x5c0d, 0x5c13, 0x5c20, 0x5c22,
0x5c28, 0x5c38, 0x5c39, 0x5c41, 0x5c46, 0x5c4e, 0x5c53,
/* 0x5621 - 0x567e */
0x5c50, 0x5c4f, 0x5b71, 0x5c6c, 0x5c6e, 0x4e62, 0x5c76,
0x5c79, 0x5c8c, 0x5c91, 0x5c94, 0x599b, 0x5cab, 0x5cbb, 0x5cb6,
0x5cbc, 0x5cb7, 0x5cc5, 0x5cbe, 0x5cc7, 0x5cd9, 0x5ce9, 0x5cfd,
0x5cfa, 0x5ced, 0x5d8c, 0x5cea, 0x5d0b, 0x5d15, 0x5d17, 0x5d5c,
0x5d1f, 0x5d1b, 0x5d11, 0x5d14, 0x5d22, 0x5d1a, 0x5d19, 0x5d18,
0x5d4c, 0x5d52, 0x5d4e, 0x5d4b, 0x5d6c, 0x5d73, 0x5d76, 0x5d87,
0x5d84, 0x5d82, 0x5da2, 0x5d9d, 0x5dac, 0x5dae, 0x5dbd, 0x5d90,
0x5db7, 0x5dbc, 0x5dc9, 0x5dcd, 0x5dd3, 0x5dd2, 0x5dd6, 0x5ddb,
0x5deb, 0x5df2, 0x5df5, 0x5e0b, 0x5e1a, 0x5e19, 0x5e11, 0x5e1b,
0x5e36, 0x5e37, 0x5e44, 0x5e43, 0x5e40, 0x5e4e, 0x5e57, 0x5e54,
0x5e5f, 0x5e62, 0x5e64, 0x5e47, 0x5e75, 0x5e76, 0x5e7a, 0x9ebc,
0x5e7f, 0x5ea0, 0x5ec1, 0x5ec2, 0x5ec8, 0x5ed0, 0x5ecf,
/* 0x5721 - 0x577e */
0x5ed6, 0x5ee3, 0x5edd, 0x5eda, 0x5edb, 0x5ee2, 0x5ee1,
0x5ee8, 0x5ee9, 0x5eec, 0x5ef1, 0x5ef3, 0x5ef0, 0x5ef4, 0x5ef8,
0x5efe, 0x5f03, 0x5f09, 0x5f5d, 0x5f5c, 0x5f0b, 0x5f11, 0x5f16,
0x5f29, 0x5f2d, 0x5f38, 0x5f41, 0x5f48, 0x5f4c, 0x5f4e, 0x5f2f,
0x5f51, 0x5f56, 0x5f57, 0x5f59, 0x5f61, 0x5f6d, 0x5f73, 0x5f77,
0x5f83, 0x5f82, 0x5f7f, 0x5f8a, 0x5f88, 0x5f91, 0x5f87, 0x5f9e,
0x5f99, 0x5f98, 0x5fa0, 0x5fa8, 0x5fad, 0x5fbc, 0x5fd6, 0x5ffb,
0x5fe4, 0x5ff8, 0x5ff1, 0x5fdd, 0x60b3, 0x5fff, 0x6021, 0x6060,
0x6019, 0x6010, 0x6029, 0x600e, 0x6031, 0x601b, 0x6015, 0x602b,
0x6026, 0x600f, 0x603a, 0x605a, 0x6041, 0x606a, 0x6077, 0x605f,
0x604a, 0x6046, 0x604d, 0x6063, 0x6043, 0x6064, 0x6042, 0x606c,
0x606b, 0x6059, 0x6081, 0x608d, 0x60e7, 0x6083, 0x609a,
/* 0x5821 - 0x587e */
0x6084, 0x609b, 0x6096, 0x6097, 0x6092, 0x60a7, 0x608b,
0x60e1, 0x60b8, 0x60e0, 0x60d3, 0x60b4, 0x5ff0, 0x60bd, 0x60c6,
0x60b5, 0x60d8, 0x614d, 0x6115, 0x6106, 0x60f6, 0x60f7, 0x6100,
0x60f4, 0x60fa, 0x6103, 0x6121, 0x60fb, 0x60f1, 0x610d, 0x610e,
0x6147, 0x613e, 0x6128, 0x6127, 0x614a, 0x613f, 0x613c, 0x612c,
0x6134, 0x613d, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159,
0x615a, 0x616b, 0x6174, 0x616f, 0x6165, 0x6171, 0x615f, 0x615d,
0x6153, 0x6175, 0x6199, 0x6196, 0x6187, 0x61ac, 0x6194, 0x619a,
0x618a, 0x6191, 0x61ab, 0x61ae, 0x61cc, 0x61ca, 0x61c9, 0x61f7,
0x61c8, 0x61c3, 0x61c6, 0x61ba, 0x61cb, 0x7f79, 0x61cd, 0x61e6,
0x61e3, 0x61f6, 0x61fa, 0x61f4, 0x61ff, 0x61fd, 0x61fc, 0x61fe,
0x6200, 0x6208, 0x6209, 0x620d, 0x620c, 0x6214, 0x621b,
/* 0x5921 - 0x597e */
0x621e, 0x6221, 0x622a, 0x622e, 0x6230, 0x6232, 0x6233,
0x6241, 0x624e, 0x625e, 0x6263, 0x625b, 0x6260, 0x6268, 0x627c,
0x6282, 0x6289, 0x627e, 0x6292, 0x6293, 0x6296, 0x62d4, 0x6283,
0x6294, 0x62d7, 0x62d1, 0x62bb, 0x62cf, 0x62ff, 0x62c6, 0x64d4,
0x62c8, 0x62dc, 0x62cc, 0x62ca, 0x62c2, 0x62c7, 0x629b, 0x62c9,
0x630c, 0x62ee, 0x62f1, 0x6327, 0x6302, 0x6308, 0x62ef, 0x62f5,
0x6350, 0x633e, 0x634d, 0x641c, 0x634f, 0x6396, 0x638e, 0x6380,
0x63ab, 0x6376, 0x63a3, 0x638f, 0x6389, 0x639f, 0x63b5, 0x636b,
0x6369, 0x63be, 0x63e9, 0x63c0, 0x63c6, 0x63e3, 0x63c9, 0x63d2,
0x63f6, 0x63c4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436,
0x651d, 0x6417, 0x6428, 0x640f, 0x6467, 0x646f, 0x6476, 0x644e,
0x652a, 0x6495, 0x6493, 0x64a5, 0x64a9, 0x6488, 0x64bc,
/* 0x5a21 - 0x5a7e */
0x64da, 0x64d2, 0x64c5, 0x64c7, 0x64bb, 0x64d8, 0x64c2,
0x64f1, 0x64e7, 0x8209, 0x64e0, 0x64e1, 0x62ac, 0x64e3, 0x64ef,
0x652c, 0x64f6, 0x64f4, 0x64f2, 0x64fa, 0x6500, 0x64fd, 0x6518,
0x651c, 0x6505, 0x6524, 0x6523, 0x652b, 0x6534, 0x6535, 0x6537,
0x6536, 0x6538, 0x754b, 0x6548, 0x6556, 0x6555, 0x654d, 0x6558,
0x655e, 0x655d, 0x6572, 0x6578, 0x6582, 0x6583, 0x8b8a, 0x659b,
0x659f, 0x65ab, 0x65b7, 0x65c3, 0x65c6, 0x65c1, 0x65c4, 0x65cc,
0x65d2, 0x65db, 0x65d9, 0x65e0, 0x65e1, 0x65f1, 0x6772, 0x660a,
0x6603, 0x65fb, 0x6773, 0x6635, 0x6636, 0x6634, 0x661c, 0x664f,
0x6644, 0x6649, 0x6641, 0x665e, 0x665d, 0x6664, 0x6667, 0x6668,
0x665f, 0x6662, 0x6670, 0x6683, 0x6688, 0x668e, 0x6689, 0x6684,
0x6698, 0x669d, 0x66c1, 0x66b9, 0x66c9, 0x66be, 0x66bc,
/* 0x5b21 - 0x5b7e */
0x66c4, 0x66b8, 0x66d6, 0x66da, 0x66e0, 0x663f, 0x66e6,
0x66e9, 0x66f0, 0x66f5, 0x66f7, 0x670f, 0x6716, 0x671e, 0x6726,
0x6727, 0x9738, 0x672e, 0x673f, 0x6736, 0x6741, 0x6738, 0x6737,
0x6746, 0x675e, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770,
0x67a9, 0x677c, 0x676a, 0x678c, 0x678b, 0x67a6, 0x67a1, 0x6785,
0x67b7, 0x67ef, 0x67b4, 0x67ec, 0x67b3, 0x67e9, 0x67b8, 0x67e4,
0x67de, 0x67dd, 0x67e2, 0x67ee, 0x67b9, 0x67ce, 0x67c6, 0x67e7,
0x6a9c, 0x681e, 0x6846, 0x6829, 0x6840, 0x684d, 0x6832, 0x684e,
0x68b3, 0x682b, 0x6859, 0x6863, 0x6877, 0x687f, 0x689f, 0x688f,
0x68ad, 0x6894, 0x689d, 0x689b, 0x6883, 0x6aae, 0x68b9, 0x6874,
0x68b5, 0x68a0, 0x68ba, 0x690f, 0x688d, 0x687e, 0x6901, 0x68ca,
0x6908, 0x68d8, 0x6922, 0x6926, 0x68e1, 0x690c, 0x68cd,
/* 0x5c21 - 0x5c7e */
0x68d4, 0x68e7, 0x68d5, 0x6936, 0x6912, 0x6904, 0x68d7,
0x68e3, 0x6925, 0x68f9, 0x68e0, 0x68ef, 0x6928, 0x692a, 0x691a,
0x6923, 0x6921, 0x68c6, 0x6979, 0x6977, 0x695c, 0x6978, 0x696b,
0x6954, 0x697e, 0x696e, 0x6939, 0x6974, 0x693d, 0x6959, 0x6930,
0x6961, 0x695e, 0x695d, 0x6981, 0x696a, 0x69b2, 0x69ae, 0x69d0,
0x69bf, 0x69c1, 0x69d3, 0x69be, 0x69ce, 0x5be8, 0x69ca, 0x69dd,
0x69bb, 0x69c3, 0x69a7, 0x6a2e, 0x6991, 0x69a0, 0x699c, 0x6995,
0x69b4, 0x69de, 0x69e8, 0x6a02, 0x6a1b, 0x69ff, 0x6b0a, 0x69f9,
0x69f2, 0x69e7, 0x6a05, 0x69b1, 0x6a1e, 0x69ed, 0x6a14, 0x69eb,
0x6a0a, 0x6a12, 0x6ac1, 0x6a23, 0x6a13, 0x6a44, 0x6a0c, 0x6a72,
0x6a36, 0x6a78, 0x6a47, 0x6a62, 0x6a59, 0x6a66, 0x6a48, 0x6a38,
0x6a22, 0x6a90, 0x6a8d, 0x6aa0, 0x6a84, 0x6aa2, 0x6aa3,
/* 0x5d21 - 0x5d7e */
0x6a97, 0x8617, 0x6abb, 0x6ac3, 0x6ac2, 0x6ab8, 0x6ab3,
0x6aac, 0x6ade, 0x6ad1, 0x6adf, 0x6aaa, 0x6ada, 0x6aea, 0x6afb,
0x6b05, 0x8616, 0x6afa, 0x6b12, 0x6b16, 0x9b31, 0x6b1f, 0x6b38,
0x6b37, 0x76dc, 0x6b39, 0x98ee, 0x6b47, 0x6b43, 0x6b49, 0x6b50,
0x6b59, 0x6b54, 0x6b5b, 0x6b5f, 0x6b61, 0x6b78, 0x6b79, 0x6b7f,
0x6b80, 0x6b84, 0x6b83, 0x6b8d, 0x6b98, 0x6b95, 0x6b9e, 0x6ba4,
0x6baa, 0x6bab, 0x6baf, 0x6bb2, 0x6bb1, 0x6bb3, 0x6bb7, 0x6bbc,
0x6bc6, 0x6bcb, 0x6bd3, 0x6bdf, 0x6bec, 0x6beb, 0x6bf3, 0x6bef,
0x9ebe, 0x6c08, 0x6c13, 0x6c14, 0x6c1b, 0x6c24, 0x6c23, 0x6c5e,
0x6c55, 0x6c62, 0x6c6a, 0x6c82, 0x6c8d, 0x6c9a, 0x6c81, 0x6c9b,
0x6c7e, 0x6c68, 0x6c73, 0x6c92, 0x6c90, 0x6cc4, 0x6cf1, 0x6cd3,
0x6cbd, 0x6cd7, 0x6cc5, 0x6cdd, 0x6cae, 0x6cb1, 0x6cbe,
/* 0x5e21 - 0x5e7e */
0x6cba, 0x6cdb, 0x6cef, 0x6cd9, 0x6cea, 0x6d1f, 0x884d,
0x6d36, 0x6d2b, 0x6d3d, 0x6d38, 0x6d19, 0x6d35, 0x6d33, 0x6d12,
0x6d0c, 0x6d63, 0x6d93, 0x6d64, 0x6d5a, 0x6d79, 0x6d59, 0x6d8e,
0x6d95, 0x6fe4, 0x6d85, 0x6df9, 0x6e15, 0x6e0a, 0x6db5, 0x6dc7,
0x6de6, 0x6db8, 0x6dc6, 0x6dec, 0x6dde, 0x6dcc, 0x6de8, 0x6dd2,
0x6dc5, 0x6dfa, 0x6dd9, 0x6de4, 0x6dd5, 0x6dea, 0x6dee, 0x6e2d,
0x6e6e, 0x6e2e, 0x6e19, 0x6e72, 0x6e5f, 0x6e3e, 0x6e23, 0x6e6b,
0x6e2b, 0x6e76, 0x6e4d, 0x6e1f, 0x6e43, 0x6e3a, 0x6e4e, 0x6e24,
0x6eff, 0x6e1d, 0x6e38, 0x6e82, 0x6eaa, 0x6e98, 0x6ec9, 0x6eb7,
0x6ed3, 0x6ebd, 0x6eaf, 0x6ec4, 0x6eb2, 0x6ed4, 0x6ed5, 0x6e8f,
0x6ea5, 0x6ec2, 0x6e9f, 0x6f41, 0x6f11, 0x704c, 0x6eec, 0x6ef8,
0x6efe, 0x6f3f, 0x6ef2, 0x6f31, 0x6eef, 0x6f32, 0x6ecc,
/* 0x5f21 - 0x5f7e */
0x6f3e, 0x6f13, 0x6ef7, 0x6f86, 0x6f7a, 0x6f78, 0x6f81,
0x6f80, 0x6f6f, 0x6f5b, 0x6ff3, 0x6f6d, 0x6f82, 0x6f7c, 0x6f58,
0x6f8e, 0x6f91, 0x6fc2, 0x6f66, 0x6fb3, 0x6fa3, 0x6fa1, 0x6fa4,
0x6fb9, 0x6fc6, 0x6faa, 0x6fdf, 0x6fd5, 0x6fec, 0x6fd4, 0x6fd8,
0x6ff1, 0x6fee, 0x6fdb, 0x7009, 0x700b, 0x6ffa, 0x7011, 0x7001,
0x700f, 0x6ffe, 0x701b, 0x701a, 0x6f74, 0x701d, 0x7018, 0x701f,
0x7030, 0x703e, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70af,
0x70f1, 0x70ac, 0x70b8, 0x70b3, 0x70ae, 0x70df, 0x70cb, 0x70dd,
0x70d9, 0x7109, 0x70fd, 0x711c, 0x7119, 0x7165, 0x7155, 0x7188,
0x7166, 0x7162, 0x714c, 0x7156, 0x716c, 0x718f, 0x71fb, 0x7184,
0x7195, 0x71a8, 0x71ac, 0x71d7, 0x71b9, 0x71be, 0x71d2, 0x71c9,
0x71d4, 0x71ce, 0x71e0, 0x71ec, 0x71e7, 0x71f5, 0x71fc,
/* 0x6021 - 0x607e */
0x71f9, 0x71ff, 0x720d, 0x7210, 0x721b, 0x7228, 0x722d,
0x722c, 0x7230, 0x7232, 0x723b, 0x723c, 0x723f, 0x7240, 0x7246,
0x724b, 0x7258, 0x7274, 0x727e, 0x7282, 0x7281, 0x7287, 0x7292,
0x7296, 0x72a2, 0x72a7, 0x72b9, 0x72b2, 0x72c3, 0x72c6, 0x72c4,
0x72ce, 0x72d2, 0x72e2, 0x72e0, 0x72e1, 0x72f9, 0x72f7, 0x500f,
0x7317, 0x730a, 0x731c, 0x7316, 0x731d, 0x7334, 0x732f, 0x7329,
0x7325, 0x733e, 0x734e, 0x734f, 0x9ed8, 0x7357, 0x736a, 0x7368,
0x7370, 0x7378, 0x7375, 0x737b, 0x737a, 0x73c8, 0x73b3, 0x73ce,
0x73bb, 0x73c0, 0x73e5, 0x73ee, 0x73de, 0x74a2, 0x7405, 0x746f,
0x7425, 0x73f8, 0x7432, 0x743a, 0x7455, 0x743f, 0x745f, 0x7459,
0x7441, 0x745c, 0x7469, 0x7470, 0x7463, 0x746a, 0x7476, 0x747e,
0x748b, 0x749e, 0x74a7, 0x74ca, 0x74cf, 0x74d4, 0x73f1,
/* 0x6121 - 0x617e */
0x74e0, 0x74e3, 0x74e7, 0x74e9, 0x74ee, 0x74f2, 0x74f0,
0x74f1, 0x74f8, 0x74f7, 0x7504, 0x7503, 0x7505, 0x750c, 0x750e,
0x750d, 0x7515, 0x7513, 0x751e, 0x7526, 0x752c, 0x753c, 0x7544,
0x754d, 0x754a, 0x7549, 0x755b, 0x7546, 0x755a, 0x7569, 0x7564,
0x7567, 0x756b, 0x756d, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574,
0x758a, 0x7589, 0x7582, 0x7594, 0x759a, 0x759d, 0x75a5, 0x75a3,
0x75c2, 0x75b3, 0x75c3, 0x75b5, 0x75bd, 0x75b8, 0x75bc, 0x75b1,
0x75cd, 0x75ca, 0x75d2, 0x75d9, 0x75e3, 0x75de, 0x75fe, 0x75ff,
0x75fc, 0x7601, 0x75f0, 0x75fa, 0x75f2, 0x75f3, 0x760b, 0x760d,
0x7609, 0x761f, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634,
0x7630, 0x763b, 0x7647, 0x7648, 0x7646, 0x765c, 0x7658, 0x7661,
0x7662, 0x7668, 0x7669, 0x766a, 0x7667, 0x766c, 0x7670,
/* 0x6221 - 0x627e */
0x7672, 0x7676, 0x7678, 0x767c, 0x7680, 0x7683, 0x7688,
0x768b, 0x768e, 0x7696, 0x7693, 0x7699, 0x769a, 0x76b0, 0x76b4,
0x76b8, 0x76b9, 0x76ba, 0x76c2, 0x76cd, 0x76d6, 0x76d2, 0x76de,
0x76e1, 0x76e5, 0x76e7, 0x76ea, 0x862f, 0x76fb, 0x7708, 0x7707,
0x7704, 0x7729, 0x7724, 0x771e, 0x7725, 0x7726, 0x771b, 0x7737,
0x7738, 0x7747, 0x775a, 0x7768, 0x776b, 0x775b, 0x7765, 0x777f,
0x777e, 0x7779, 0x778e, 0x778b, 0x7791, 0x77a0, 0x779e, 0x77b0,
0x77b6, 0x77b9, 0x77bf, 0x77bc, 0x77bd, 0x77bb, 0x77c7, 0x77cd,
0x77d7, 0x77da, 0x77dc, 0x77e3, 0x77ee, 0x77fc, 0x780c, 0x7812,
0x7926, 0x7820, 0x792a, 0x7845, 0x788e, 0x7874, 0x7886, 0x787c,
0x789a, 0x788c, 0x78a3, 0x78b5, 0x78aa, 0x78af, 0x78d1, 0x78c6,
0x78cb, 0x78d4, 0x78be, 0x78bc, 0x78c5, 0x78ca, 0x78ec,
/* 0x6321 - 0x637e */
0x78e7, 0x78da, 0x78fd, 0x78f4, 0x7907, 0x7912, 0x7911,
0x7919, 0x792c, 0x792b, 0x7940, 0x7960, 0x7957, 0x795f, 0x795a,
0x7955, 0x7953, 0x797a, 0x797f, 0x798a, 0x799d, 0x79a7, 0x9f4b,
0x79aa, 0x79ae, 0x79b3, 0x79b9, 0x79ba, 0x79c9, 0x79d5, 0x79e7,
0x79ec, 0x79e1, 0x79e3, 0x7a08, 0x7a0d, 0x7a18, 0x7a19, 0x7a20,
0x7a1f, 0x7980, 0x7a31, 0x7a3b, 0x7a3e, 0x7a37, 0x7a43, 0x7a57,
0x7a49, 0x7a61, 0x7a62, 0x7a69, 0x9f9d, 0x7a70, 0x7a79, 0x7a7d,
0x7a88, 0x7a97, 0x7a95, 0x7a98, 0x7a96, 0x7aa9, 0x7ac8, 0x7ab0,
0x7ab6, 0x7ac5, 0x7ac4, 0x7abf, 0x9083, 0x7ac7, 0x7aca, 0x7acd,
0x7acf, 0x7ad5, 0x7ad3, 0x7ad9, 0x7ada, 0x7add, 0x7ae1, 0x7ae2,
0x7ae6, 0x7aed, 0x7af0, 0x7b02, 0x7b0f, 0x7b0a, 0x7b06, 0x7b33,
0x7b18, 0x7b19, 0x7b1e, 0x7b35, 0x7b28, 0x7b36, 0x7b50,
/* 0x6421 - 0x647e */
0x7b7a, 0x7b04, 0x7b4d, 0x7b0b, 0x7b4c, 0x7b45, 0x7b75,
0x7b65, 0x7b74, 0x7b67, 0x7b70, 0x7b71, 0x7b6c, 0x7b6e, 0x7b9d,
0x7b98, 0x7b9f, 0x7b8d, 0x7b9c, 0x7b9a, 0x7b8b, 0x7b92, 0x7b8f,
0x7b5d, 0x7b99, 0x7bcb, 0x7bc1, 0x7bcc, 0x7bcf, 0x7bb4, 0x7bc6,
0x7bdd, 0x7be9, 0x7c11, 0x7c14, 0x7be6, 0x7be5, 0x7c60, 0x7c00,
0x7c07, 0x7c13, 0x7bf3, 0x7bf7, 0x7c17, 0x7c0d, 0x7bf6, 0x7c23,
0x7c27, 0x7c2a, 0x7c1f, 0x7c37, 0x7c2b, 0x7c3d, 0x7c4c, 0x7c43,
0x7c54, 0x7c4f, 0x7c40, 0x7c50, 0x7c58, 0x7c5f, 0x7c64, 0x7c56,
0x7c65, 0x7c6c, 0x7c75, 0x7c83, 0x7c90, 0x7ca4, 0x7cad, 0x7ca2,
0x7cab, 0x7ca1, 0x7ca8, 0x7cb3, 0x7cb2, 0x7cb1, 0x7cae, 0x7cb9,
0x7cbd, 0x7cc0, 0x7cc5, 0x7cc2, 0x7cd8, 0x7cd2, 0x7cdc, 0x7ce2,
0x9b3b, 0x7cef, 0x7cf2, 0x7cf4, 0x7cf6, 0x7cfa, 0x7d06,
/* 0x6521 - 0x657e */
0x7d02, 0x7d1c, 0x7d15, 0x7d0a, 0x7d45, 0x7d4b, 0x7d2e,
0x7d32, 0x7d3f, 0x7d35, 0x7d46, 0x7d73, 0x7d56, 0x7d4e, 0x7d72,
0x7d68, 0x7d6e, 0x7d4f, 0x7d63, 0x7d93, 0x7d89, 0x7d5b, 0x7d8f,
0x7d7d, 0x7d9b, 0x7dba, 0x7dae, 0x7da3, 0x7db5, 0x7dc7, 0x7dbd,
0x7dab, 0x7e3d, 0x7da2, 0x7daf, 0x7ddc, 0x7db8, 0x7d9f, 0x7db0,
0x7dd8, 0x7ddd, 0x7de4, 0x7dde, 0x7dfb, 0x7df2, 0x7de1, 0x7e05,
0x7e0a, 0x7e23, 0x7e21, 0x7e12, 0x7e31, 0x7e1f, 0x7e09, 0x7e0b,
0x7e22, 0x7e46, 0x7e66, 0x7e3b, 0x7e35, 0x7e39, 0x7e43, 0x7e37,
0x7e32, 0x7e3a, 0x7e67, 0x7e5d, 0x7e56, 0x7e5e, 0x7e59, 0x7e5a,
0x7e79, 0x7e6a, 0x7e69, 0x7e7c, 0x7e7b, 0x7e83, 0x7dd5, 0x7e7d,
0x8fae, 0x7e7f, 0x7e88, 0x7e89, 0x7e8c, 0x7e92, 0x7e90, 0x7e93,
0x7e94, 0x7e96, 0x7e8e, 0x7e9b, 0x7e9c, 0x7f38, 0x7f3a,
/* 0x6621 - 0x667e */
0x7f45, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f50, 0x7f51, 0x7f55,
0x7f54, 0x7f58, 0x7f5f, 0x7f60, 0x7f68, 0x7f69, 0x7f67, 0x7f78,
0x7f82, 0x7f86, 0x7f83, 0x7f88, 0x7f87, 0x7f8c, 0x7f94, 0x7f9e,
0x7f9d, 0x7f9a, 0x7fa3, 0x7faf, 0x7fb2, 0x7fb9, 0x7fae, 0x7fb6,
0x7fb8, 0x8b71, 0x7fc5, 0x7fc6, 0x7fca, 0x7fd5, 0x7fd4, 0x7fe1,
0x7fe6, 0x7fe9, 0x7ff3, 0x7ff9, 0x98dc, 0x8006, 0x8004, 0x800b,
0x8012, 0x8018, 0x8019, 0x801c, 0x8021, 0x8028, 0x803f, 0x803b,
0x804a, 0x8046, 0x8052, 0x8058, 0x805a, 0x805f, 0x8062, 0x8068,
0x8073, 0x8072, 0x8070, 0x8076, 0x8079, 0x807d, 0x807f, 0x8084,
0x8086, 0x8085, 0x809b, 0x8093, 0x809a, 0x80ad, 0x5190, 0x80ac,
0x80db, 0x80e5, 0x80d9, 0x80dd, 0x80c4, 0x80da, 0x80d6, 0x8109,
0x80ef, 0x80f1, 0x811b, 0x8129, 0x8123, 0x812f, 0x814b,
/* 0x6721 - 0x677e */
0x968b, 0x8146, 0x813e, 0x8153, 0x8151, 0x80fc, 0x8171,
0x816e, 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818a, 0x8180,
0x8182, 0x81a0, 0x8195, 0x81a4, 0x81a3, 0x815f, 0x8193, 0x81a9,
0x81b0, 0x81b5, 0x81be, 0x81b8, 0x81bd, 0x81c0, 0x81c2, 0x81ba,
0x81c9, 0x81cd, 0x81d1, 0x81d9, 0x81d8, 0x81c8, 0x81da, 0x81df,
0x81e0, 0x81e7, 0x81fa, 0x81fb, 0x81fe, 0x8201, 0x8202, 0x8205,
0x8207, 0x820a, 0x820d, 0x8210, 0x8216, 0x8229, 0x822b, 0x8238,
0x8233, 0x8240, 0x8259, 0x8258, 0x825d, 0x825a, 0x825f, 0x8264,
0x8262, 0x8268, 0x826a, 0x826b, 0x822e, 0x8271, 0x8277, 0x8278,
0x827e, 0x828d, 0x8292, 0x82ab, 0x829f, 0x82bb, 0x82ac, 0x82e1,
0x82e3, 0x82df, 0x82d2, 0x82f4, 0x82f3, 0x82fa, 0x8393, 0x8303,
0x82fb, 0x82f9, 0x82de, 0x8306, 0x82dc, 0x8309, 0x82d9,
/* 0x6821 - 0x687e */
0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339,
0x8350, 0x8345, 0x832f, 0x832b, 0x8317, 0x8318, 0x8385, 0x839a,
0x83aa, 0x839f, 0x83a2, 0x8396, 0x8323, 0x838e, 0x8387, 0x838a,
0x837c, 0x83b5, 0x8373, 0x8375, 0x83a0, 0x8389, 0x83a8, 0x83f4,
0x8413, 0x83eb, 0x83ce, 0x83fd, 0x8403, 0x83d8, 0x840b, 0x83c1,
0x83f7, 0x8407, 0x83e0, 0x83f2, 0x840d, 0x8422, 0x8420, 0x83bd,
0x8438, 0x8506, 0x83fb, 0x846d, 0x842a, 0x843c, 0x855a, 0x8484,
0x8477, 0x846b, 0x84ad, 0x846e, 0x8482, 0x8469, 0x8446, 0x842c,
0x846f, 0x8479, 0x8435, 0x84ca, 0x8462, 0x84b9, 0x84bf, 0x849f,
0x84d9, 0x84cd, 0x84bb, 0x84da, 0x84d0, 0x84c1, 0x84c6, 0x84d6,
0x84a1, 0x8521, 0x84ff, 0x84f4, 0x8517, 0x8518, 0x852c, 0x851f,
0x8515, 0x8514, 0x84fc, 0x8540, 0x8563, 0x8558, 0x8548,
/* 0x6921 - 0x697e */
0x8541, 0x8602, 0x854b, 0x8555, 0x8580, 0x85a4, 0x8588,
0x8591, 0x858a, 0x85a8, 0x856d, 0x8594, 0x859b, 0x85ea, 0x8587,
0x859c, 0x8577, 0x857e, 0x8590, 0x85c9, 0x85ba, 0x85cf, 0x85b9,
0x85d0, 0x85d5, 0x85dd, 0x85e5, 0x85dc, 0x85f9, 0x860a, 0x8613,
0x860b, 0x85fe, 0x85fa, 0x8606, 0x8622, 0x861a, 0x8630, 0x863f,
0x864d, 0x4e55, 0x8654, 0x865f, 0x8667, 0x8671, 0x8693, 0x86a3,
0x86a9, 0x86aa, 0x868b, 0x868c, 0x86b6, 0x86af, 0x86c4, 0x86c6,
0x86b0, 0x86c9, 0x8823, 0x86ab, 0x86d4, 0x86de, 0x86e9, 0x86ec,
0x86df, 0x86db, 0x86ef, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703,
0x86fb, 0x8711, 0x8709, 0x870d, 0x86f9, 0x870a, 0x8734, 0x873f,
0x8737, 0x873b, 0x8725, 0x8729, 0x871a, 0x8760, 0x875f, 0x8778,
0x874c, 0x874e, 0x8774, 0x8757, 0x8768, 0x876e, 0x8759,
/* 0x6a21 - 0x6a7e */
0x8753, 0x8763, 0x876a, 0x8805, 0x87a2, 0x879f, 0x8782,
0x87af, 0x87cb, 0x87bd, 0x87c0, 0x87d0, 0x96d6, 0x87ab, 0x87c4,
0x87b3, 0x87c7, 0x87c6, 0x87bb, 0x87ef, 0x87f2, 0x87e0, 0x880f,
0x880d, 0x87fe, 0x87f6, 0x87f7, 0x880e, 0x87d2, 0x8811, 0x8816,
0x8815, 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883b,
0x8844, 0x8842, 0x8852, 0x8859, 0x885e, 0x8862, 0x886b, 0x8881,
0x887e, 0x889e, 0x8875, 0x887d, 0x88b5, 0x8872, 0x8882, 0x8897,
0x8892, 0x88ae, 0x8899, 0x88a2, 0x888d, 0x88a4, 0x88b0, 0x88bf,
0x88b1, 0x88c3, 0x88c4, 0x88d4, 0x88d8, 0x88d9, 0x88dd, 0x88f9,
0x8902, 0x88fc, 0x88f4, 0x88e8, 0x88f2, 0x8904, 0x890c, 0x890a,
0x8913, 0x8943, 0x891e, 0x8925, 0x892a, 0x892b, 0x8941, 0x8944,
0x893b, 0x8936, 0x8938, 0x894c, 0x891d, 0x8960, 0x895e,
/* 0x6b21 - 0x6b7e */
0x8966, 0x8964, 0x896d, 0x896a, 0x896f, 0x8974, 0x8977,
0x897e, 0x8983, 0x8988, 0x898a, 0x8993, 0x8998, 0x89a1, 0x89a9,
0x89a6, 0x89ac, 0x89af, 0x89b2, 0x89ba, 0x89bd, 0x89bf, 0x89c0,
0x89da, 0x89dc, 0x89dd, 0x89e7, 0x89f4, 0x89f8, 0x8a03, 0x8a16,
0x8a10, 0x8a0c, 0x8a1b, 0x8a1d, 0x8a25, 0x8a36, 0x8a41, 0x8a5b,
0x8a52, 0x8a46, 0x8a48, 0x8a7c, 0x8a6d, 0x8a6c, 0x8a62, 0x8a85,
0x8a82, 0x8a84, 0x8aa8, 0x8aa1, 0x8a91, 0x8aa5, 0x8aa6, 0x8a9a,
0x8aa3, 0x8ac4, 0x8acd, 0x8ac2, 0x8ada, 0x8aeb, 0x8af3, 0x8ae7,
0x8ae4, 0x8af1, 0x8b14, 0x8ae0, 0x8ae2, 0x8af7, 0x8ade, 0x8adb,
0x8b0c, 0x8b07, 0x8b1a, 0x8ae1, 0x8b16, 0x8b10, 0x8b17, 0x8b20,
0x8b33, 0x97ab, 0x8b26, 0x8b2b, 0x8b3e, 0x8b28, 0x8b41, 0x8b4c,
0x8b4f, 0x8b4e, 0x8b49, 0x8b56, 0x8b5b, 0x8b5a, 0x8b6b,
/* 0x6c21 - 0x6c7e */
0x8b5f, 0x8b6c, 0x8b6f, 0x8b74, 0x8b7d, 0x8b80, 0x8b8c,
0x8b8e, 0x8b92, 0x8b93, 0x8b96, 0x8b99, 0x8b9a, 0x8c3a, 0x8c41,
0x8c3f, 0x8c48, 0x8c4c, 0x8c4e, 0x8c50, 0x8c55, 0x8c62, 0x8c6c,
0x8c78, 0x8c7a, 0x8c82, 0x8c89, 0x8c85, 0x8c8a, 0x8c8d, 0x8c8e,
0x8c94, 0x8c7c, 0x8c98, 0x621d, 0x8cad, 0x8caa, 0x8cbd, 0x8cb2,
0x8cb3, 0x8cae, 0x8cb6, 0x8cc8, 0x8cc1, 0x8ce4, 0x8ce3, 0x8cda,
0x8cfd, 0x8cfa, 0x8cfb, 0x8d04, 0x8d05, 0x8d0a, 0x8d07, 0x8d0f,
0x8d0d, 0x8d10, 0x9f4e, 0x8d13, 0x8ccd, 0x8d14, 0x8d16, 0x8d67,
0x8d6d, 0x8d71, 0x8d73, 0x8d81, 0x8d99, 0x8dc2, 0x8dbe, 0x8dba,
0x8dcf, 0x8dda, 0x8dd6, 0x8dcc, 0x8ddb, 0x8dcb, 0x8dea, 0x8deb,
0x8ddf, 0x8de3, 0x8dfc, 0x8e08, 0x8e09, 0x8dff, 0x8e1d, 0x8e1e,
0x8e10, 0x8e1f, 0x8e42, 0x8e35, 0x8e30, 0x8e34, 0x8e4a,
/* 0x6d21 - 0x6d7e */
0x8e47, 0x8e49, 0x8e4c, 0x8e50, 0x8e48, 0x8e59, 0x8e64,
0x8e60, 0x8e2a, 0x8e63, 0x8e55, 0x8e76, 0x8e72, 0x8e7c, 0x8e81,
0x8e87, 0x8e85, 0x8e84, 0x8e8b, 0x8e8a, 0x8e93, 0x8e91, 0x8e94,
0x8e99, 0x8eaa, 0x8ea1, 0x8eac, 0x8eb0, 0x8ec6, 0x8eb1, 0x8ebe,
0x8ec5, 0x8ec8, 0x8ecb, 0x8edb, 0x8ee3, 0x8efc, 0x8efb, 0x8eeb,
0x8efe, 0x8f0a, 0x8f05, 0x8f15, 0x8f12, 0x8f19, 0x8f13, 0x8f1c,
0x8f1f, 0x8f1b, 0x8f0c, 0x8f26, 0x8f33, 0x8f3b, 0x8f39, 0x8f45,
0x8f42, 0x8f3e, 0x8f4c, 0x8f49, 0x8f46, 0x8f4e, 0x8f57, 0x8f5c,
0x8f62, 0x8f63, 0x8f64, 0x8f9c, 0x8f9f, 0x8fa3, 0x8fad, 0x8faf,
0x8fb7, 0x8fda, 0x8fe5, 0x8fe2, 0x8fea, 0x8fef, 0x9087, 0x8ff4,
0x9005, 0x8ff9, 0x8ffa, 0x9011, 0x9015, 0x9021, 0x900d, 0x901e,
0x9016, 0x900b, 0x9027, 0x9036, 0x9035, 0x9039, 0x8ff8,
/* 0x6e21 - 0x6e7e */
0x904f, 0x9050, 0x9051, 0x9052, 0x900e, 0x9049, 0x903e,
0x9056, 0x9058, 0x905e, 0x9068, 0x906f, 0x9076, 0x96a8, 0x9072,
0x9082, 0x907d, 0x9081, 0x9080, 0x908a, 0x9089, 0x908f, 0x90a8,
0x90af, 0x90b1, 0x90b5, 0x90e2, 0x90e4, 0x6248, 0x90db, 0x9102,
0x9112, 0x9119, 0x9132, 0x9130, 0x914a, 0x9156, 0x9158, 0x9163,
0x9165, 0x9169, 0x9173, 0x9172, 0x918b, 0x9189, 0x9182, 0x91a2,
0x91ab, 0x91af, 0x91aa, 0x91b5, 0x91b4, 0x91ba, 0x91c0, 0x91c1,
0x91c9, 0x91cb, 0x91d0, 0x91d6, 0x91df, 0x91e1, 0x91db, 0x91fc,
0x91f5, 0x91f6, 0x921e, 0x91ff, 0x9214, 0x922c, 0x9215, 0x9211,
0x925e, 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923f,
0x924b, 0x9250, 0x929c, 0x9296, 0x9293, 0x929b, 0x925a, 0x92cf,
0x92b9, 0x92b7, 0x92e9, 0x930f, 0x92fa, 0x9344, 0x932e,
/* 0x6f21 - 0x6f7e */
0x9319, 0x9322, 0x931a, 0x9323, 0x933a, 0x9335, 0x933b,
0x935c, 0x9360, 0x937c, 0x936e, 0x9356, 0x93b0, 0x93ac, 0x93ad,
0x9394, 0x93b9, 0x93d6, 0x93d7, 0x93e8, 0x93e5, 0x93d8, 0x93c3,
0x93dd, 0x93d0, 0x93c8, 0x93e4, 0x941a, 0x9414, 0x9413, 0x9403,
0x9407, 0x9410, 0x9436, 0x942b, 0x9435, 0x9421, 0x943a, 0x9441,
0x9452, 0x9444, 0x945b, 0x9460, 0x9462, 0x945e, 0x946a, 0x9229,
0x9470, 0x9475, 0x9477, 0x947d, 0x945a, 0x947c, 0x947e, 0x9481,
0x947f, 0x9582, 0x9587, 0x958a, 0x9594, 0x9596, 0x9598, 0x9599,
0x95a0, 0x95a8, 0x95a7, 0x95ad, 0x95bc, 0x95bb, 0x95b9, 0x95be,
0x95ca, 0x6ff6, 0x95c3, 0x95cd, 0x95cc, 0x95d5, 0x95d4, 0x95d6,
0x95dc, 0x95e1, 0x95e5, 0x95e2, 0x9621, 0x9628, 0x962e, 0x962f,
0x9642, 0x964c, 0x964f, 0x964b, 0x9677, 0x965c, 0x965e,
/* 0x7021 - 0x707e */
0x965d, 0x965f, 0x9666, 0x9672, 0x966c, 0x968d, 0x9698,
0x9695, 0x9697, 0x96aa, 0x96a7, 0x96b1, 0x96b2, 0x96b0, 0x96b4,
0x96b6, 0x96b8, 0x96b9, 0x96ce, 0x96cb, 0x96c9, 0x96cd, 0x894d,
0x96dc, 0x970d, 0x96d5, 0x96f9, 0x9704, 0x9706, 0x9708, 0x9713,
0x970e, 0x9711, 0x970f, 0x9716, 0x9719, 0x9724, 0x972a, 0x9730,
0x9739, 0x973d, 0x973e, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749,
0x975c, 0x9760, 0x9764, 0x9766, 0x9768, 0x52d2, 0x976b, 0x9771,
0x9779, 0x9785, 0x977c, 0x9781, 0x977a, 0x9786, 0x978b, 0x978f,
0x9790, 0x979c, 0x97a8, 0x97a6, 0x97a3, 0x97b3, 0x97b4, 0x97c3,
0x97c6, 0x97c8, 0x97cb, 0x97dc, 0x97ed, 0x9f4f, 0x97f2, 0x7adf,
0x97f6, 0x97f5, 0x980f, 0x980c, 0x9838, 0x9824, 0x9821, 0x9837,
0x983d, 0x9846, 0x984f, 0x984b, 0x986b, 0x986f, 0x9870,
/* 0x7121 - 0x717e */
0x9871, 0x9874, 0x9873, 0x98aa, 0x98af, 0x98b1, 0x98b6,
0x98c4, 0x98c3, 0x98c6, 0x98e9, 0x98eb, 0x9903, 0x9909, 0x9912,
0x9914, 0x9918, 0x9921, 0x991d, 0x991e, 0x9924, 0x9920, 0x992c,
0x992e, 0x993d, 0x993e, 0x9942, 0x9949, 0x9945, 0x9950, 0x994b,
0x9951, 0x9952, 0x994c, 0x9955, 0x9997, 0x9998, 0x99a5, 0x99ad,
0x99ae, 0x99bc, 0x99df, 0x99db, 0x99dd, 0x99d8, 0x99d1, 0x99ed,
0x99ee, 0x99f1, 0x99f2, 0x99fb, 0x99f8, 0x9a01, 0x9a0f, 0x9a05,
0x99e2, 0x9a19, 0x9a2b, 0x9a37, 0x9a45, 0x9a42, 0x9a40, 0x9a43,
0x9a3e, 0x9a55, 0x9a4d, 0x9a5b, 0x9a57, 0x9a5f, 0x9a62, 0x9a65,
0x9a64, 0x9a69, 0x9a6b, 0x9a6a, 0x9aad, 0x9ab0, 0x9abc, 0x9ac0,
0x9acf, 0x9ad1, 0x9ad3, 0x9ad4, 0x9ade, 0x9adf, 0x9ae2, 0x9ae3,
0x9ae6, 0x9aef, 0x9aeb, 0x9aee, 0x9af4, 0x9af1, 0x9af7,
/* 0x7221 - 0x727e */
0x9afb, 0x9b06, 0x9b18, 0x9b1a, 0x9b1f, 0x9b22, 0x9b23,
0x9b25, 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2e, 0x9b2f, 0x9b32,
0x9b44, 0x9b43, 0x9b4f, 0x9b4d, 0x9b4e, 0x9b51, 0x9b58, 0x9b74,
0x9b93, 0x9b83, 0x9b91, 0x9b96, 0x9b97, 0x9b9f, 0x9ba0, 0x9ba8,
0x9bb4, 0x9bc0, 0x9bca, 0x9bb9, 0x9bc6, 0x9bcf, 0x9bd1, 0x9bd2,
0x9be3, 0x9be2, 0x9be4, 0x9bd4, 0x9be1, 0x9c3a, 0x9bf2, 0x9bf1,
0x9bf0, 0x9c15, 0x9c14, 0x9c09, 0x9c13, 0x9c0c, 0x9c06, 0x9c08,
0x9c12, 0x9c0a, 0x9c04, 0x9c2e, 0x9c1b, 0x9c25, 0x9c24, 0x9c21,
0x9c30, 0x9c47, 0x9c32, 0x9c46, 0x9c3e, 0x9c5a, 0x9c60, 0x9c67,
0x9c76, 0x9c78, 0x9ce7, 0x9cec, 0x9cf0, 0x9d09, 0x9d08, 0x9ceb,
0x9d03, 0x9d06, 0x9d2a, 0x9d26, 0x9daf, 0x9d23, 0x9d1f, 0x9d44,
0x9d15, 0x9d12, 0x9d41, 0x9d3f, 0x9d3e, 0x9d46, 0x9d48,
/* 0x7321 - 0x737e */
0x9d5d, 0x9d5e, 0x9d64, 0x9d51, 0x9d50, 0x9d59, 0x9d72,
0x9d89, 0x9d87, 0x9dab, 0x9d6f, 0x9d7a, 0x9d9a, 0x9da4, 0x9da9,
0x9db2, 0x9dc4, 0x9dc1, 0x9dbb, 0x9db8, 0x9dba, 0x9dc6, 0x9dcf,
0x9dc2, 0x9dd9, 0x9dd3, 0x9df8, 0x9de6, 0x9ded, 0x9def, 0x9dfd,
0x9e1a, 0x9e1b, 0x9e1e, 0x9e75, 0x9e79, 0x9e7d, 0x9e81, 0x9e88,
0x9e8b, 0x9e8c, 0x9e92, 0x9e95, 0x9e91, 0x9e9d, 0x9ea5, 0x9ea9,
0x9eb8, 0x9eaa, 0x9ead, 0x9761, 0x9ecc, 0x9ece, 0x9ecf, 0x9ed0,
0x9ed4, 0x9edc, 0x9ede, 0x9edd, 0x9ee0, 0x9ee5, 0x9ee8, 0x9eef,
0x9ef4, 0x9ef6, 0x9ef7, 0x9ef9, 0x9efb, 0x9efc, 0x9efd, 0x9f07,
0x9f08, 0x76b7, 0x9f15, 0x9f21, 0x9f2c, 0x9f3e, 0x9f4a, 0x9f52,
0x9f54, 0x9f63, 0x9f5f, 0x9f60, 0x9f61, 0x9f66, 0x9f67, 0x9f6c,
0x9f6a, 0x9f77, 0x9f72, 0x9f76, 0x9f95, 0x9f9c, 0x9fa0,
/* 0x7421 - 0x747e */
0x582f, 0x69c7, 0x9059, 0x7464, 0x51dc, 0x7199, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7521 - 0x757e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7621 - 0x767e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7721 - 0x777e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7821 - 0x787e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7921 - 0x797e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7a21 - 0x7a7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7b21 - 0x7b7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7c21 - 0x7c7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7d21 - 0x7d7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7e21 - 0x7e7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static uint jisx0208ToUnicode11(uint h, uint l)
{
if ((0x0021 <= h) && (h <= 0x007e) && (0x0021 <= l) && (l <= 0x007e)) {
return jisx0208_to_unicode[(h - 0x0021) * 0x005e + (l - 0x0021)];
}
return 0x0000;
}
/*
* This data is derived from Unicode 1.1,
* JIS X 0208 (1990) to Unicode mapping table version 0.9 .
* (In addition NEC Vender Defined Char included)
*/
static unsigned short const unicode_to_jisx0208_00[] = {
/* 0x0000 - 0x00ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2140, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2171, 0x2172, 0x0000, 0x0000, 0x0000, 0x2178,
0x212f, 0x0000, 0x0000, 0x0000, 0x224c, 0x0000, 0x0000, 0x0000,
0x216b, 0x215e, 0x0000, 0x0000, 0x212d, 0x0000, 0x2279, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x215f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2160,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_03[] = {
/* 0x0300 - 0x03ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627,
0x2628, 0x2629, 0x262a, 0x262b, 0x262c, 0x262d, 0x262e, 0x262f,
0x2630, 0x2631, 0x0000, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636,
0x2637, 0x2638, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647,
0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, 0x264e, 0x264f,
0x2650, 0x2651, 0x0000, 0x2652, 0x2653, 0x2654, 0x2655, 0x2656,
0x2657, 0x2658, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_04[] = {
/* 0x0400 - 0x04ff */
0x0000, 0x2727, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729,
0x272a, 0x272b, 0x272c, 0x272d, 0x272e, 0x272f, 0x2730, 0x2731,
0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739,
0x273a, 0x273b, 0x273c, 0x273d, 0x273e, 0x273f, 0x2740, 0x2741,
0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759,
0x275a, 0x275b, 0x275c, 0x275d, 0x275e, 0x275f, 0x2760, 0x2761,
0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769,
0x276a, 0x276b, 0x276c, 0x276d, 0x276e, 0x276f, 0x2770, 0x2771,
0x0000, 0x2757, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_20[] = {
/* 0x2000 - 0x20ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x213e, 0x0000, 0x0000, 0x0000, 0x0000, 0x213d, 0x2142, 0x0000,
0x2146, 0x2147, 0x0000, 0x0000, 0x2148, 0x2149, 0x0000, 0x0000,
0x2277, 0x2278, 0x0000, 0x0000, 0x0000, 0x2145, 0x2144, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2273, 0x0000, 0x216c, 0x216d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2228, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_21[] = {
/* 0x2100 - 0x21ff */
0x0000, 0x0000, 0x0000, 0x216e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d62, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2d64, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2272, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2d35, 0x2d36, 0x2d37, 0x2d38, 0x2d39, 0x2d3a, 0x2d3b, 0x2d3c,
0x2d3d, 0x2d3e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x222b, 0x222c, 0x222a, 0x222d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x224d, 0x0000, 0x224e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_22[] = {
/* 0x2200 - 0x22ff */
0x224f, 0x0000, 0x225f, 0x2250, 0x0000, 0x0000, 0x0000, 0x2260,
0x223a, 0x0000, 0x0000, 0x223b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2d74, 0x215d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2265, 0x0000, 0x0000, 0x2267, 0x2167, 0x2d78,
0x225c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x224a,
0x224b, 0x2241, 0x2240, 0x2269, 0x226a, 0x0000, 0x2d73, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2168, 0x2268, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2266, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2262, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2162, 0x2261, 0x0000, 0x0000, 0x0000, 0x0000, 0x2165, 0x2166,
0x0000, 0x0000, 0x2263, 0x2264, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x223e, 0x223f, 0x0000, 0x0000, 0x223c, 0x223d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x225d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d79,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_23[] = {
/* 0x2300 - 0x23ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x225e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_24[] = {
/* 0x2400 - 0x24ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2d21, 0x2d22, 0x2d23, 0x2d24, 0x2d25, 0x2d26, 0x2d27, 0x2d28,
0x2d29, 0x2d2a, 0x2d2b, 0x2d2c, 0x2d2d, 0x2d2e, 0x2d2f, 0x2d30,
0x2d31, 0x2d32, 0x2d33, 0x2d34, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_25[] = {
/* 0x2500 - 0x25ff */
0x2821, 0x282c, 0x2822, 0x282d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2823, 0x0000, 0x0000, 0x282e,
0x2824, 0x0000, 0x0000, 0x282f, 0x2826, 0x0000, 0x0000, 0x2831,
0x2825, 0x0000, 0x0000, 0x2830, 0x2827, 0x283c, 0x0000, 0x0000,
0x2837, 0x0000, 0x0000, 0x2832, 0x2829, 0x283e, 0x0000, 0x0000,
0x2839, 0x0000, 0x0000, 0x2834, 0x2828, 0x0000, 0x0000, 0x2838,
0x283d, 0x0000, 0x0000, 0x2833, 0x282a, 0x0000, 0x0000, 0x283a,
0x283f, 0x0000, 0x0000, 0x2835, 0x282b, 0x0000, 0x0000, 0x283b,
0x0000, 0x0000, 0x2840, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2836, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2223, 0x2222, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2225, 0x2224, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2227, 0x2226, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2221, 0x217e,
0x0000, 0x0000, 0x0000, 0x217b, 0x0000, 0x0000, 0x217d, 0x217c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x227e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_26[] = {
/* 0x2600 - 0x26ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x217a, 0x2179, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x216a, 0x0000, 0x2169, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2276, 0x0000, 0x0000, 0x2275, 0x0000, 0x2274,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_30[] = {
/* 0x3000 - 0x30ff */
0x2121, 0x2122, 0x2123, 0x2137, 0x0000, 0x2139, 0x213a, 0x213b,
0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159,
0x215a, 0x215b, 0x2229, 0x222e, 0x214c, 0x214d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2141, 0x2d60, 0x0000, 0x2d61,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2421, 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427,
0x2428, 0x2429, 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f,
0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437,
0x2438, 0x2439, 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f,
0x2440, 0x2441, 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447,
0x2448, 0x2449, 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f,
0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457,
0x2458, 0x2459, 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f,
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f,
0x2470, 0x2471, 0x2472, 0x2473, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x212b, 0x212c, 0x2135, 0x2136, 0x0000,
0x0000, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, 0x2527,
0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, 0x252f,
0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, 0x2537,
0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, 0x253f,
0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547,
0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f,
0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557,
0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, 0x255f,
0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567,
0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f,
0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x0000,
0x0000, 0x0000, 0x0000, 0x2126, 0x213c, 0x2133, 0x2134, 0x0000,
};
static unsigned short const unicode_to_jisx0208_32[] = {
/* 0x3200 - 0x32ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2d6a, 0x2d6b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2d6c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2d65, 0x2d66, 0x2d67, 0x2d68,
0x2d69, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_33[] = {
/* 0x3300 - 0x33ff */
0x0000, 0x0000, 0x0000, 0x2d46, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d4a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2d41, 0x0000, 0x0000, 0x0000,
0x2d44, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2d42, 0x2d4c, 0x0000, 0x0000, 0x2d4b, 0x2d45,
0x0000, 0x0000, 0x0000, 0x2d4d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d47, 0x0000,
0x0000, 0x0000, 0x0000, 0x2d4f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2d40, 0x2d4e, 0x0000, 0x0000, 0x2d43, 0x0000, 0x0000,
0x0000, 0x2d48, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d49,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2d5f, 0x2d6f, 0x2d6e, 0x2d6d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d53, 0x2d54,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2d50, 0x2d51, 0x2d52, 0x0000,
0x0000, 0x2d56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2d55, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2d63, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_4e[] = {
/* 0x4e00 - 0x4eff */
0x306c, 0x437a, 0x0000, 0x3c37, 0x0000, 0x0000, 0x0000, 0x4b7c,
0x3e66, 0x3b30, 0x3e65, 0x323c, 0x0000, 0x4954, 0x4d3f, 0x0000,
0x5022, 0x312f, 0x0000, 0x0000, 0x336e, 0x5023, 0x4024, 0x5242,
0x3556, 0x4a3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e67, 0x0000,
0x0000, 0x4e3e, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a42, 0x0000,
0x0000, 0x0000, 0x5024, 0x0000, 0x0000, 0x4366, 0x0000, 0x0000,
0x0000, 0x5025, 0x367a, 0x0000, 0x0000, 0x0000, 0x5026, 0x0000,
0x345d, 0x4330, 0x0000, 0x3c67, 0x5027, 0x0000, 0x0000, 0x5028,
0x0000, 0x0000, 0x5029, 0x4735, 0x0000, 0x3557, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4737, 0x0000, 0x4663, 0x3843, 0x4b33,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6949, 0x502a, 0x3e68,
0x502b, 0x3235, 0x0000, 0x0000, 0x0000, 0x3665, 0x3870, 0x4c69,
0x0000, 0x0000, 0x5626, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d70, 0x0000, 0x467d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3425, 0x0000,
0x3535, 0x0000, 0x502c, 0x0000, 0x0000, 0x502d, 0x4e3b, 0x0000,
0x4d3d, 0x4168, 0x502f, 0x3b76, 0x4673, 0x0000, 0x5032, 0x0000,
0x0000, 0x313e, 0x385f, 0x0000, 0x385e, 0x3066, 0x0000, 0x0000,
0x4f4b, 0x4f4a, 0x0000, 0x3a33, 0x3021, 0x0000, 0x5033, 0x5034,
0x5035, 0x4b34, 0x5036, 0x0000, 0x3872, 0x3067, 0x4b72, 0x0000,
0x357c, 0x0000, 0x0000, 0x357d, 0x357e, 0x4462, 0x4e3c, 0x0000,
0x5037, 0x0000, 0x0000, 0x5038, 0x0000, 0x0000, 0x5039, 0x0000,
0x0000, 0x0000, 0x3f4d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d3a, 0x3f4e, 0x503e, 0x0000, 0x503c, 0x0000, 0x503d, 0x3558,
0x0000, 0x0000, 0x3a23, 0x3270, 0x0000, 0x503b, 0x503a, 0x4a29,
0x0000, 0x0000, 0x0000, 0x0000, 0x3b46, 0x3b45, 0x423e, 0x503f,
0x4955, 0x4067, 0x0000, 0x0000, 0x0000, 0x2138, 0x5040, 0x5042,
0x0000, 0x0000, 0x0000, 0x4265, 0x4e61, 0x304a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5041, 0x323e, 0x0000,
0x3644, 0x0000, 0x4367, 0x0000, 0x0000, 0x0000, 0x376f, 0x5043,
0x0000, 0x0000, 0x0000, 0x4724, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_4f[] = {
/* 0x4f00 - 0x4fff */
0x0000, 0x346b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5044, 0x304b, 0x0000, 0x0000, 0x3860, 0x346c, 0x497a,
0x4832, 0x3559, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3271, 0x0000, 0x5067, 0x4541, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x476c,
0x5046, 0x0000, 0x0000, 0x0000, 0x483c, 0x0000, 0x4e62, 0x0000,
0x3f2d, 0x0000, 0x3b47, 0x0000, 0x3b77, 0x3240, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4451, 0x0000, 0x0000, 0x4322, 0x504a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x304c, 0x4463, 0x3d3b,
0x3a34, 0x4d24, 0x0000, 0x424e, 0x0000, 0x323f, 0x0000, 0x5049,
0x0000, 0x4d3e, 0x5045, 0x5047, 0x3a6e, 0x5048, 0x5524, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5050, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5053,
0x5051, 0x0000, 0x0000, 0x3242, 0x0000, 0x4a3b, 0x504b, 0x0000,
0x0000, 0x0000, 0x0000, 0x504f, 0x3873, 0x0000, 0x0000, 0x3b48,
0x0000, 0x0000, 0x0000, 0x3426, 0x0000, 0x0000, 0x5054, 0x0000,
0x504c, 0x0000, 0x0000, 0x4e63, 0x0000, 0x3b78, 0x0000, 0x504d,
0x0000, 0x5052, 0x0000, 0x0000, 0x0000, 0x0000, 0x5055, 0x0000,
0x504e, 0x0000, 0x0000, 0x3621, 0x0000, 0x304d, 0x0000, 0x0000,
0x3622, 0x3241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5525, 0x0000, 0x4b79, 0x496e, 0x3874,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f2f, 0x4e37, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a58,
0x0000, 0x0000, 0x3738, 0x4225, 0x3264, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3d53, 0x0000, 0x0000, 0x0000, 0x5059, 0x0000,
0x505e, 0x505c, 0x0000, 0x0000, 0x5057, 0x0000, 0x0000, 0x422f,
0x505a, 0x0000, 0x505d, 0x505b, 0x0000, 0x4a5d, 0x0000, 0x5058,
0x0000, 0x3f2e, 0x0000, 0x4b73, 0x505f, 0x5060, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d24, 0x506d,
0x0000, 0x0000, 0x0000, 0x4750, 0x0000, 0x4936, 0x5068, 0x0000,
0x4a70, 0x0000, 0x3236, 0x0000, 0x0000, 0x0000, 0x506c, 0x0000,
};
static unsigned short const unicode_to_jisx0208_50[] = {
/* 0x5000 - 0x50ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5066, 0x506f, 0x0000,
0x0000, 0x4152, 0x0000, 0x3844, 0x0000, 0x475c, 0x0000, 0x6047,
0x0000, 0x506e, 0x455d, 0x0000, 0x5063, 0x0000, 0x3876, 0x0000,
0x0000, 0x3875, 0x5061, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c5a,
0x0000, 0x5069, 0x0000, 0x4a6f, 0x434d, 0x5065, 0x3771, 0x0000,
0x5062, 0x506a, 0x5064, 0x4e51, 0x506b, 0x4f41, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3666, 0x0000,
0x0000, 0x3770, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5070, 0x0000, 0x0000, 0x0000, 0x5071,
0x5075, 0x304e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a50,
0x5074, 0x0000, 0x0000, 0x0000, 0x0000, 0x5073, 0x5077, 0x0000,
0x0000, 0x0000, 0x5076, 0x0000, 0x4464, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3772, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5078, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3c45, 0x0000, 0x4226, 0x4465, 0x3676, 0x0000,
0x5079, 0x0000, 0x0000, 0x0000, 0x0000, 0x3536, 0x0000, 0x0000,
0x507a, 0x0000, 0x0000, 0x0000, 0x0000, 0x507c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b35, 0x0000, 0x0000,
0x0000, 0x3766, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b31, 0x4877, 0x507b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a45, 0x4d43, 0x0000, 0x0000,
0x0000, 0x0000, 0x507e, 0x5123, 0x507d, 0x3a44, 0x0000, 0x3d7d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3739, 0x0000,
0x0000, 0x0000, 0x5124, 0x0000, 0x0000, 0x364f, 0x0000, 0x0000,
0x0000, 0x5121, 0x5122, 0x0000, 0x0000, 0x462f, 0x0000, 0x417c,
0x0000, 0x3623, 0x0000, 0x0000, 0x0000, 0x4b4d, 0x5125, 0x0000,
0x0000, 0x0000, 0x4e3d, 0x0000, 0x0000, 0x0000, 0x5126, 0x0000,
0x0000, 0x0000, 0x0000, 0x5129, 0x0000, 0x5127, 0x0000, 0x414e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5128, 0x512a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x512c, 0x0000, 0x0000,
0x0000, 0x512b, 0x0000, 0x4a48, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_51[] = {
/* 0x5100 - 0x51ff */
0x3537, 0x512e, 0x512f, 0x0000, 0x322f, 0x0000, 0x0000, 0x0000,
0x0000, 0x512d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3c74, 0x0000, 0x5132, 0x5131, 0x5130, 0x0000,
0x5056, 0x0000, 0x5133, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d7e,
0x0000, 0x5134, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c59, 0x0000, 0x0000, 0x0000, 0x0000, 0x5136,
0x0000, 0x0000, 0x5135, 0x5138, 0x5137, 0x0000, 0x0000, 0x5139,
0x513a, 0x3074, 0x0000, 0x3835, 0x373b, 0x3d3c, 0x437b, 0x3624,
0x4068, 0x3877, 0x0000, 0x396e, 0x513c, 0x4c48, 0x4546, 0x0000,
0x3b79, 0x0000, 0x513b, 0x0000, 0x513d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x455e, 0x0000, 0x3375, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x513e, 0x0000, 0x0000, 0x467e, 0x0000, 0x0000,
0x4134, 0x5140, 0x5141, 0x482c, 0x3878, 0x4f3b, 0x5142, 0x0000,
0x0000, 0x3626, 0x0000, 0x0000, 0x0000, 0x4a3c, 0x4236, 0x3671,
0x4535, 0x0000, 0x0000, 0x0000, 0x3773, 0x0000, 0x0000, 0x0000,
0x5143, 0x0000, 0x5144, 0x0000, 0x0000, 0x4662, 0x315f, 0x0000,
0x0000, 0x5147, 0x3a7d, 0x0000, 0x5146, 0x3a46, 0x0000, 0x5148,
0x666e, 0x5149, 0x4b41, 0x514a, 0x0000, 0x514b, 0x514c, 0x3e69,
0x0000, 0x3c4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3427, 0x0000, 0x514f, 0x0000, 0x514d, 0x4c3d, 0x514e, 0x0000,
0x495a, 0x5150, 0x5151, 0x5152, 0x455f, 0x0000, 0x0000, 0x0000,
0x5156, 0x5154, 0x5155, 0x5153, 0x3a63, 0x5157, 0x4c6a, 0x4e64,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5158, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4028, 0x5159, 0x3d5a, 0x0000,
0x0000, 0x515a, 0x0000, 0x437c, 0x4e3f, 0x4560, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5245, 0x0000,
0x0000, 0x0000, 0x0000, 0x515b, 0x7425, 0x3645, 0x0000, 0x0000,
0x515c, 0x4b5e, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d68, 0x427c,
0x0000, 0x515e, 0x4664, 0x0000, 0x0000, 0x515f, 0x0000, 0x0000,
0x5160, 0x332e, 0x0000, 0x0000, 0x0000, 0x5161, 0x3627, 0x0000,
0x464c, 0x317a, 0x3d50, 0x0000, 0x0000, 0x4821, 0x5162, 0x0000,
};
static unsigned short const unicode_to_jisx0208_52[] = {
/* 0x5200 - 0x52ff */
0x4561, 0x0000, 0x0000, 0x3f4f, 0x5163, 0x0000, 0x4a2c, 0x405a,
0x3422, 0x0000, 0x3429, 0x5164, 0x0000, 0x0000, 0x5166, 0x0000,
0x0000, 0x373a, 0x0000, 0x0000, 0x5165, 0x0000, 0x0000, 0x4e73,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d69, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x483d, 0x4a4c, 0x0000, 0x5167,
0x0000, 0x4d78, 0x5168, 0x0000, 0x0000, 0x0000, 0x5169, 0x0000,
0x457e, 0x0000, 0x0000, 0x516a, 0x0000, 0x0000, 0x4029, 0x3a7e,
0x3774, 0x516b, 0x3b49, 0x396f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4466, 0x516d, 0x0000, 0x0000, 0x4227,
0x0000, 0x0000, 0x3a6f, 0x516e, 0x516f, 0x4130, 0x0000, 0x516c,
0x0000, 0x0000, 0x0000, 0x0000, 0x5171, 0x0000, 0x4b36, 0x0000,
0x0000, 0x0000, 0x0000, 0x3964, 0x0000, 0x0000, 0x5170, 0x0000,
0x0000, 0x0000, 0x0000, 0x3775, 0x3a5e, 0x476d, 0x0000, 0x0000,
0x0000, 0x5174, 0x5172, 0x0000, 0x0000, 0x0000, 0x0000, 0x497b,
0x3e6a, 0x517b, 0x3364, 0x5175, 0x5173, 0x414f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5177, 0x0000, 0x5176,
0x0000, 0x0000, 0x0000, 0x3344, 0x0000, 0x0000, 0x0000, 0x3760,
0x517c, 0x4e2d, 0x0000, 0x0000, 0x0000, 0x5178, 0x0000, 0x0000,
0x0000, 0x517d, 0x517a, 0x0000, 0x5179, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4e4f, 0x0000, 0x0000, 0x0000, 0x3879,
0x3243, 0x0000, 0x0000, 0x4e74, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3d75, 0x4558, 0x3965, 0x5222, 0x5223, 0x0000, 0x0000,
0x0000, 0x4e65, 0x0000, 0x0000, 0x4f2b, 0x5225, 0x0000, 0x0000,
0x0000, 0x387a, 0x0000, 0x0000, 0x5224, 0x0000, 0x332f, 0x0000,
0x0000, 0x5226, 0x0000, 0x4b56, 0x0000, 0x443c, 0x0000, 0x4d26,
0x0000, 0x4a59, 0x0000, 0x0000, 0x0000, 0x5227, 0x0000, 0x0000,
0x0000, 0x0000, 0x7055, 0x0000, 0x0000, 0x4630, 0x0000, 0x5228,
0x342a, 0x4c33, 0x0000, 0x0000, 0x0000, 0x3e21, 0x5229, 0x4a67,
0x522d, 0x0000, 0x402a, 0x522a, 0x3650, 0x0000, 0x522b, 0x342b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x372e, 0x522e, 0x0000, 0x522f, 0x0000, 0x0000,
0x5230, 0x5231, 0x3c5b, 0x0000, 0x0000, 0x0000, 0x387b, 0x4c5e,
};
static unsigned short const unicode_to_jisx0208_53[] = {
/* 0x5300 - 0x53ff */
0x0000, 0x4c68, 0x4677, 0x0000, 0x0000, 0x4a71, 0x5232, 0x0000,
0x5233, 0x0000, 0x0000, 0x0000, 0x0000, 0x5235, 0x0000, 0x5237,
0x5236, 0x0000, 0x0000, 0x0000, 0x0000, 0x5238, 0x323d, 0x4b4c,
0x0000, 0x3a7c, 0x5239, 0x0000, 0x0000, 0x4159, 0x0000, 0x0000,
0x3e22, 0x3629, 0x0000, 0x523a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x485b, 0x0000, 0x0000, 0x0000, 0x0000, 0x523b,
0x0000, 0x523c, 0x0000, 0x523d, 0x0000, 0x0000, 0x0000, 0x0000,
0x523e, 0x4924, 0x3668, 0x3065, 0x0000, 0x0000, 0x0000, 0x463f,
0x523f, 0x3d3d, 0x0000, 0x4069, 0x0000, 0x5241, 0x5240, 0x3e23,
0x3861, 0x5243, 0x483e, 0x0000, 0x0000, 0x5244, 0x0000, 0x0000,
0x0000, 0x485c, 0x4234, 0x426e, 0x3628, 0x0000, 0x0000, 0x466e,
0x4331, 0x0000, 0x476e, 0x0000, 0x4b4e, 0x0000, 0x5246, 0x0000,
0x406a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3735, 0x0000,
0x0000, 0x5247, 0x0000, 0x0000, 0x0000, 0x0000, 0x5248, 0x312c,
0x3075, 0x346d, 0x0000, 0x4228, 0x3551, 0x4d71, 0x0000, 0x524b,
0x3237, 0x0000, 0x0000, 0x524a, 0x0000, 0x0000, 0x0000, 0x362a,
0x0000, 0x0000, 0x524c, 0x0000, 0x4c71, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x524d, 0x0000,
0x4e52, 0x0000, 0x387c, 0x0000, 0x0000, 0x0000, 0x0000, 0x3836,
0x524e, 0x0000, 0x0000, 0x0000, 0x0000, 0x5250, 0x524f, 0x0000,
0x3f5f, 0x3139, 0x0000, 0x0000, 0x0000, 0x315e, 0x5251, 0x0000,
0x5252, 0x0000, 0x0000, 0x3837, 0x0000, 0x0000, 0x5253, 0x0000,
0x0000, 0x0000, 0x0000, 0x356e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b32, 0x5254, 0x0000, 0x0000, 0x0000, 0x0000,
0x4b74, 0x3a35, 0x355a, 0x4d27, 0x4150, 0x483f, 0x3c7d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d47, 0x0000, 0x3c68, 0x3c75,
0x0000, 0x3d76, 0x0000, 0x4840, 0x0000, 0x0000, 0x0000, 0x5257,
0x0000, 0x3143, 0x4151, 0x387d, 0x3845, 0x3667, 0x0000, 0x0000,
0x525b, 0x4321, 0x427e, 0x362b, 0x3e24, 0x525c, 0x525a, 0x3244,
0x4266, 0x3c38, 0x3b4b, 0x3126, 0x0000, 0x0000, 0x3370, 0x3966,
0x3b4a, 0x0000, 0x525d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_54[] = {
/* 0x5400 - 0x54ff */
0x0000, 0x525e, 0x0000, 0x3549, 0x3346, 0x0000, 0x0000, 0x0000,
0x3967, 0x3548, 0x445f, 0x3125, 0x4631, 0x4c3e, 0x3921, 0x4d79,
0x4547, 0x387e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x372f, 0x0000, 0x5267, 0x0000, 0x3663,
0x4b4a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x485d, 0x0000,
0x0000, 0x5266, 0x0000, 0x345e, 0x5261, 0x5262, 0x5264, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5265, 0x0000,
0x355b, 0x3f61, 0x0000, 0x4a2d, 0x5263, 0x525f, 0x3863, 0x0000,
0x5260, 0x0000, 0x4f24, 0x0000, 0x0000, 0x0000, 0x4a72, 0x0000,
0x4468, 0x3862, 0x3970, 0x0000, 0x0000, 0x0000, 0x5268, 0x0000,
0x0000, 0x465d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x526c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c7e, 0x0000, 0x3c76, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x526f, 0x526d, 0x0000, 0x4c23, 0x0000, 0x526a, 0x5273, 0x526e,
0x0000, 0x0000, 0x0000, 0x5271, 0x3846, 0x4c3f, 0x0000, 0x0000,
0x5272, 0x0000, 0x0000, 0x0000, 0x5274, 0x0000, 0x5276, 0x0000,
0x0000, 0x0000, 0x0000, 0x3a70, 0x4f42, 0x0000, 0x526b, 0x5269,
0x5275, 0x0000, 0x5270, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5278, 0x0000, 0x5323, 0x527a, 0x0000, 0x0000,
0x527e, 0x0000, 0x0000, 0x5321, 0x527b, 0x0000, 0x0000, 0x533e,
0x0000, 0x0000, 0x3a69, 0x3331, 0x0000, 0x0000, 0x0000, 0x0000,
0x5279, 0x0000, 0x0000, 0x0000, 0x5325, 0x3076, 0x5324, 0x0000,
0x3025, 0x494a, 0x5322, 0x0000, 0x527c, 0x0000, 0x0000, 0x5277,
0x527d, 0x3a48, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5326, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3077, 0x532f, 0x0000, 0x0000, 0x5327, 0x5328, 0x0000,
0x3e25, 0x4b69, 0x0000, 0x0000, 0x0000, 0x532d, 0x532c, 0x0000,
0x0000, 0x0000, 0x452f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x532e, 0x0000, 0x0000, 0x532b, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_55[] = {
/* 0x5500 - 0x55ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x3134, 0x0000, 0x3a36, 0x3f30,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5329,
0x4562, 0x0000, 0x0000, 0x0000, 0x532a, 0x0000, 0x3022, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5334, 0x4d23,
0x0000, 0x3e27, 0x0000, 0x533a, 0x0000, 0x0000, 0x0000, 0x0000,
0x5339, 0x5330, 0x0000, 0x0000, 0x0000, 0x0000, 0x4243, 0x0000,
0x5331, 0x0000, 0x0000, 0x0000, 0x426f, 0x5336, 0x3e26, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5333, 0x0000, 0x0000, 0x4c64,
0x0000, 0x0000, 0x0000, 0x373c, 0x0000, 0x0000, 0x5337, 0x5338,
0x0000, 0x0000, 0x0000, 0x0000, 0x5335, 0x533b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5332, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5341, 0x5346, 0x0000, 0x5342, 0x0000,
0x533d, 0x0000, 0x0000, 0x5347, 0x4131, 0x0000, 0x0000, 0x5349,
0x0000, 0x3922, 0x533f, 0x437d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5343, 0x533c, 0x342d, 0x0000, 0x346e, 0x3365, 0x5344, 0x5340,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3776,
0x534a, 0x5348, 0x4153, 0x354a, 0x362c, 0x0000, 0x5345, 0x0000,
0x3674, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3144, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x534e, 0x534c, 0x0000, 0x5427,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5351, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x534b, 0x0000, 0x534f, 0x0000, 0x0000, 0x534d,
0x0000, 0x0000, 0x0000, 0x3b4c, 0x5350, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5353,
0x0000, 0x5358, 0x0000, 0x0000, 0x0000, 0x5356, 0x5355, 0x0000,
};
static unsigned short const unicode_to_jisx0208_56[] = {
/* 0x5600 - 0x56ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4332, 0x0000,
0x0000, 0x3245, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5352, 0x0000, 0x5354, 0x3e28,
0x3133, 0x0000, 0x0000, 0x5357, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x325e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5362,
0x0000, 0x3e7c, 0x535e, 0x0000, 0x535c, 0x0000, 0x535d, 0x0000,
0x535f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x313d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4139, 0x0000, 0x5359, 0x0000,
0x535a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x337a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5361, 0x0000, 0x0000, 0x0000,
0x346f, 0x0000, 0x5364, 0x5360, 0x5363, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a2e, 0x0000, 0x0000, 0x0000,
0x4655, 0x0000, 0x4838, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5366, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5365, 0x3345,
0x0000, 0x0000, 0x5367, 0x0000, 0x0000, 0x0000, 0x0000, 0x536a,
0x0000, 0x0000, 0x0000, 0x0000, 0x5369, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5368, 0x0000, 0x4739, 0x0000, 0x0000, 0x536b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x536c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x536e, 0x0000, 0x536d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5370, 0x0000, 0x0000, 0x0000,
0x5373, 0x5371, 0x536f, 0x5372, 0x0000, 0x0000, 0x0000, 0x0000,
0x5374, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5375, 0x0000,
0x0000, 0x5376, 0x0000, 0x5377, 0x0000, 0x0000, 0x0000, 0x5378,
0x5145, 0x0000, 0x3c7c, 0x3b4d, 0x0000, 0x0000, 0x3273, 0x0000,
0x3078, 0x0000, 0x0000, 0x4344, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5379, 0x0000,
0x3a24, 0x0000, 0x304f, 0x3f5e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x537a, 0x3847, 0x0000, 0x0000, 0x3971, 0x0000, 0x537c,
};
static unsigned short const unicode_to_jisx0208_57[] = {
/* 0x5700 - 0x57ff */
0x537b, 0x0000, 0x0000, 0x4a60, 0x537d, 0x0000, 0x0000, 0x0000,
0x5421, 0x537e, 0x0000, 0x5422, 0x0000, 0x5423, 0x0000, 0x3777,
0x0000, 0x0000, 0x3160, 0x5424, 0x0000, 0x0000, 0x5426, 0x0000,
0x5425, 0x0000, 0x0000, 0x0000, 0x5428, 0x0000, 0x0000, 0x455a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5429, 0x3035,
0x3a5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x373d, 0x0000, 0x0000,
0x434f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x542a,
0x542b, 0x0000, 0x0000, 0x542d, 0x0000, 0x0000, 0x0000, 0x0000,
0x542e, 0x0000, 0x3a64, 0x0000, 0x0000, 0x0000, 0x0000, 0x3651,
0x0000, 0x0000, 0x4b37, 0x0000, 0x0000, 0x0000, 0x542c, 0x542f,
0x3a41, 0x3923, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5433, 0x0000, 0x0000, 0x3a25, 0x0000, 0x4333, 0x0000,
0x0000, 0x5430, 0x445a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5434,
0x0000, 0x0000, 0x3f62, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5432, 0x5435, 0x0000, 0x373f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5436, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5437, 0x0000, 0x3924, 0x3340, 0x5439, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x543a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x543b, 0x0000, 0x0000, 0x5438, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5431, 0x0000, 0x0000, 0x543c, 0x0000, 0x0000, 0x543d, 0x0000,
0x0000, 0x0000, 0x0000, 0x4b64, 0x0000, 0x0000, 0x3e6b, 0x0000,
0x0000, 0x0000, 0x543f, 0x5440, 0x543e, 0x0000, 0x5442, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4738, 0x0000, 0x0000, 0x3068,
0x4956, 0x0000, 0x0000, 0x5443, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e7d, 0x0000, 0x0000, 0x3c39,
0x0000, 0x475d, 0x3470, 0x0000, 0x3a6b, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_58[] = {
/* 0x5800 - 0x58ff */
0x4b59, 0x0000, 0x4632, 0x0000, 0x0000, 0x3778, 0x424f, 0x0000,
0x0000, 0x0000, 0x5441, 0x5444, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4244, 0x0000, 0x0000,
0x0000, 0x5445, 0x0000, 0x0000, 0x0000, 0x5446, 0x0000, 0x0000,
0x0000, 0x5448, 0x0000, 0x0000, 0x4469, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x342e, 0x0000, 0x0000, 0x0000, 0x0000, 0x7421,
0x3161, 0x4a73, 0x0000, 0x0000, 0x3e6c, 0x4548, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a66, 0x0000, 0x0000, 0x544e, 0x0000, 0x0000,
0x4a3d, 0x4e5d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3274, 0x544a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x413a, 0x544d, 0x0000, 0x4563, 0x0000, 0x0000, 0x4549,
0x4564, 0x4839, 0x444d, 0x0000, 0x0000, 0x0000, 0x3a49, 0x0000,
0x0000, 0x0000, 0x5449, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3176, 0x0000, 0x4536, 0x0000, 0x0000, 0x0000, 0x0000,
0x544b, 0x0000, 0x5447, 0x0000, 0x0000, 0x3f50, 0x0000, 0x0000,
0x0000, 0x544f, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d4e, 0x0000,
0x0000, 0x0000, 0x0000, 0x362d, 0x0000, 0x5450, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a68, 0x0000, 0x0000, 0x0000, 0x417d,
0x0000, 0x0000, 0x0000, 0x0000, 0x4446, 0x0000, 0x0000, 0x5452,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4b4f, 0x0000, 0x0000, 0x5453, 0x0000, 0x0000, 0x5458, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a2f, 0x0000, 0x0000, 0x0000, 0x0000,
0x5457, 0x5451, 0x5454, 0x5456, 0x0000, 0x0000, 0x3a26, 0x0000,
0x0000, 0x4a49, 0x0000, 0x0000, 0x0000, 0x5459, 0x0000, 0x4345,
0x0000, 0x0000, 0x3275, 0x0000, 0x3e6d, 0x0000, 0x0000, 0x0000,
0x0000, 0x545b, 0x0000, 0x545a, 0x0000, 0x3968, 0x0000, 0x545c,
0x545e, 0x545d, 0x0000, 0x0000, 0x5460, 0x0000, 0x5455, 0x5462,
0x0000, 0x0000, 0x0000, 0x0000, 0x5461, 0x545f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b4e, 0x3f51, 0x0000, 0x4154, 0x5463,
0x403c, 0x306d, 0x4764, 0x0000, 0x0000, 0x0000, 0x0000, 0x445b,
0x0000, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_59[] = {
/* 0x5900 - 0x59ff */
0x0000, 0x0000, 0x5469, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a51, 0x546a, 0x0000, 0x0000, 0x0000, 0x0000, 0x3246,
0x546b, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d3c, 0x3330, 0x0000,
0x5249, 0x3d48, 0x423f, 0x546c, 0x4c6b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c34, 0x0000, 0x0000, 0x546e, 0x0000, 0x4267,
0x0000, 0x4537, 0x4240, 0x4957, 0x546f, 0x5470, 0x317b, 0x0000,
0x0000, 0x3c3a, 0x5471, 0x0000, 0x0000, 0x0000, 0x0000, 0x3050,
0x5472, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5473, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3162, 0x0000, 0x0000, 0x3471,
0x4660, 0x4a74, 0x0000, 0x0000, 0x0000, 0x0000, 0x5477, 0x4155,
0x5476, 0x3740, 0x0000, 0x0000, 0x4b5b, 0x5475, 0x0000, 0x4565,
0x5479, 0x0000, 0x5478, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x547b, 0x0000, 0x547a, 0x0000, 0x0000, 0x317c, 0x0000, 0x547c,
0x3e29, 0x547e, 0x4325, 0x0000, 0x547d, 0x0000, 0x4a33, 0x0000,
0x0000, 0x0000, 0x0000, 0x3d77, 0x455b, 0x0000, 0x0000, 0x0000,
0x5521, 0x0000, 0x0000, 0x0000, 0x0000, 0x3925, 0x0000, 0x0000,
0x0000, 0x5522, 0x4721, 0x485e, 0x4c51, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4725, 0x0000, 0x0000, 0x552b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3538, 0x0000, 0x0000, 0x4d45, 0x0000,
0x0000, 0x4c2f, 0x0000, 0x562c, 0x0000, 0x5523, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5526, 0x0000, 0x4245, 0x0000, 0x0000,
0x4b38, 0x0000, 0x0000, 0x0000, 0x454a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5527, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4b65, 0x0000, 0x3a4a, 0x0000, 0x0000, 0x3e2a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5528, 0x0000,
0x0000, 0x3b50, 0x0000, 0x3b4f, 0x0000, 0x0000, 0x0000, 0x0000,
0x3039, 0x3848, 0x0000, 0x402b, 0x3051, 0x0000, 0x0000, 0x0000,
0x0000, 0x552c, 0x552d, 0x0000, 0x552a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3138, 0x342f, 0x0000,
0x5529, 0x0000, 0x4c45, 0x4931, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3028, 0x0000,
0x0000, 0x0000, 0x0000, 0x3079, 0x0000, 0x0000, 0x0000, 0x3b51,
};
static unsigned short const unicode_to_jisx0208_5a[] = {
/* 0x5a00 - 0x5aff */
0x0000, 0x3052, 0x0000, 0x3023, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5532, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5530, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c3c, 0x0000, 0x5533, 0x0000, 0x5531, 0x0000, 0x0000, 0x552f,
0x3f31, 0x0000, 0x0000, 0x0000, 0x0000, 0x552e, 0x0000, 0x0000,
0x0000, 0x4a5a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3864,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5537, 0x5538, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e2b, 0x0000, 0x0000, 0x0000,
0x5534, 0x4f2c, 0x0000, 0x0000, 0x0000, 0x0000, 0x474c, 0x0000,
0x0000, 0x5536, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5539, 0x0000, 0x0000, 0x0000, 0x4958, 0x0000,
0x0000, 0x0000, 0x553a, 0x0000, 0x5535, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c3b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x475e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x553b, 0x4932, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x553c, 0x5540, 0x553d, 0x0000,
0x0000, 0x3247, 0x553f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c3b, 0x0000, 0x553e, 0x3779, 0x0000, 0x0000, 0x0000,
0x554c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5545, 0x5542,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4364, 0x0000, 0x5541, 0x0000, 0x0000, 0x5543, 0x0000,
0x0000, 0x5544, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5546, 0x5547, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_5b[] = {
/* 0x5b00 - 0x5bff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3472, 0x0000, 0x5549, 0x5548, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x554a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3e6e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x554d, 0x0000, 0x445c, 0x0000, 0x0000, 0x0000,
0x3145, 0x0000, 0x554b, 0x0000, 0x0000, 0x0000, 0x554e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x554f, 0x0000,
0x5552, 0x0000, 0x0000, 0x5550, 0x0000, 0x5551, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b52, 0x5553, 0x0000, 0x0000, 0x3926, 0x5554, 0x0000, 0x3b7a,
0x4238, 0x0000, 0x5555, 0x5556, 0x3b5a, 0x3927, 0x0000, 0x4c52,
0x0000, 0x0000, 0x0000, 0x3528, 0x3849, 0x5557, 0x3358, 0x0000,
0x0000, 0x5558, 0x0000, 0x4239, 0x0000, 0x0000, 0x0000, 0x0000,
0x5559, 0x5623, 0x0000, 0x555a, 0x0000, 0x555b, 0x0000, 0x0000,
0x555c, 0x0000, 0x555e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x555f, 0x0000, 0x0000, 0x5560, 0x0000, 0x4270, 0x0000, 0x3127,
0x3c69, 0x3042, 0x0000, 0x4157, 0x3430, 0x3c35, 0x0000, 0x3928,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4566, 0x0000, 0x3d21,
0x3431, 0x4368, 0x446a, 0x3038, 0x3539, 0x4a75, 0x0000, 0x3c42,
0x0000, 0x0000, 0x3552, 0x406b, 0x3c3c, 0x4d28, 0x5561, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x355c, 0x0000,
0x3a4b, 0x0000, 0x0000, 0x3332, 0x3163, 0x3e2c, 0x3248, 0x0000,
0x5562, 0x4d46, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d49,
0x0000, 0x0000, 0x3c64, 0x5563, 0x3473, 0x4652, 0x4c29, 0x5564,
0x0000, 0x5565, 0x0000, 0x0000, 0x4959, 0x0000, 0x0000, 0x0000,
0x5567, 0x0000, 0x3428, 0x3677, 0x5566, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3432, 0x0000, 0x3f32, 0x556b, 0x3b21,
0x0000, 0x3249, 0x556a, 0x0000, 0x5568, 0x556c, 0x5569, 0x472b,
0x5c4d, 0x3f33, 0x0000, 0x556d, 0x0000, 0x0000, 0x4e40, 0x0000,
0x556e, 0x0000, 0x0000, 0x5570, 0x0000, 0x437e, 0x556f, 0x0000,
0x4023, 0x0000, 0x3b7b, 0x0000, 0x0000, 0x0000, 0x4250, 0x3c77,
};
static unsigned short const unicode_to_jisx0208_5c[] = {
/* 0x5c00 - 0x5cff */
0x0000, 0x4975, 0x406c, 0x0000, 0x3c4d, 0x5571, 0x3e2d, 0x5572,
0x5573, 0x3053, 0x423a, 0x3f52, 0x0000, 0x5574, 0x4633, 0x3e2e,
0x0000, 0x3e2f, 0x0000, 0x5575, 0x0000, 0x0000, 0x406d, 0x0000,
0x0000, 0x0000, 0x3e30, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5576, 0x0000, 0x5577, 0x0000, 0x4c60, 0x0000, 0x0000, 0x0000,
0x5578, 0x0000, 0x0000, 0x0000, 0x0000, 0x3646, 0x0000, 0x0000,
0x0000, 0x3d22, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5579, 0x557a, 0x3c5c, 0x3f2c, 0x4674, 0x3f54, 0x4878, 0x4722,
0x3649, 0x557b, 0x0000, 0x0000, 0x0000, 0x356f, 0x557c, 0x0000,
0x367e, 0x0000, 0x464f, 0x3230, 0x0000, 0x3b53, 0x557d, 0x5622,
0x5621, 0x367d, 0x0000, 0x557e, 0x0000, 0x4538, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4230, 0x0000,
0x454b, 0x3c48, 0x0000, 0x0000, 0x4158, 0x4d7a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5624, 0x0000, 0x5625, 0x4656,
0x0000, 0x3b33, 0x0000, 0x0000, 0x0000, 0x0000, 0x5627, 0x0000,
0x0000, 0x5628, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5629, 0x0000, 0x0000, 0x0000,
0x3474, 0x562a, 0x0000, 0x0000, 0x562b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x322c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x413b, 0x3464, 0x0000, 0x562d, 0x4c28, 0x0000, 0x0000, 0x0000,
0x0000, 0x4252, 0x0000, 0x3359, 0x0000, 0x0000, 0x562f, 0x5631,
0x345f, 0x0000, 0x0000, 0x562e, 0x5630, 0x0000, 0x5633, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5632, 0x0000, 0x5634,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5635, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x463d, 0x362e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3265, 0x5636, 0x563b, 0x0000, 0x0000, 0x5639, 0x0000, 0x4a77,
0x4a76, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4567, 0x0000,
0x0000, 0x0000, 0x5638, 0x3d54, 0x0000, 0x5637, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_5d[] = {
/* 0x5d00 - 0x5dff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f72,
0x0000, 0x0000, 0x0000, 0x563c, 0x0000, 0x0000, 0x3a6a, 0x0000,
0x0000, 0x5642, 0x0000, 0x0000, 0x5643, 0x563d, 0x3333, 0x563e,
0x5647, 0x5646, 0x5645, 0x5641, 0x0000, 0x0000, 0x0000, 0x5640,
0x0000, 0x0000, 0x5644, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x564b, 0x5648, 0x0000, 0x564a, 0x0000,
0x4d72, 0x0000, 0x5649, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x563f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f73, 0x0000, 0x0000, 0x564c, 0x0000, 0x0000, 0x3a37,
0x0000, 0x0000, 0x0000, 0x564d, 0x0000, 0x0000, 0x564e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5651, 0x0000, 0x5650, 0x0000, 0x0000, 0x564f,
0x0000, 0x0000, 0x0000, 0x4568, 0x563a, 0x0000, 0x0000, 0x0000,
0x5657, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5653, 0x0000, 0x0000,
0x0000, 0x0000, 0x5652, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5654, 0x0000, 0x5655, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5658,
0x0000, 0x0000, 0x4e66, 0x0000, 0x5659, 0x5656, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x565a, 0x0000, 0x0000, 0x3460, 0x565b, 0x0000, 0x0000,
0x0000, 0x0000, 0x565d, 0x565c, 0x0000, 0x0000, 0x565e, 0x0000,
0x0000, 0x0000, 0x0000, 0x565f, 0x0000, 0x406e, 0x3d23, 0x0000,
0x0000, 0x3d64, 0x0000, 0x4163, 0x0000, 0x3929, 0x3a38, 0x392a,
0x3570, 0x0000, 0x0000, 0x5660, 0x0000, 0x0000, 0x3a39, 0x0000,
0x0000, 0x384a, 0x5661, 0x4c26, 0x4743, 0x5662, 0x0000, 0x392b,
0x0000, 0x0000, 0x0000, 0x342c, 0x0000, 0x4327, 0x3652, 0x0000,
};
static unsigned short const unicode_to_jisx0208_5e[] = {
/* 0x5e00 - 0x5eff */
0x0000, 0x0000, 0x3b54, 0x495b, 0x0000, 0x0000, 0x4841, 0x0000,
0x0000, 0x0000, 0x0000, 0x5663, 0x3475, 0x0000, 0x0000, 0x0000,
0x0000, 0x5666, 0x0000, 0x0000, 0x0000, 0x0000, 0x4421, 0x0000,
0x0000, 0x5665, 0x5664, 0x5667, 0x0000, 0x446b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f63, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b55, 0x0000, 0x404a, 0x0000, 0x4253,
0x3522, 0x0000, 0x0000, 0x4422, 0x0000, 0x0000, 0x5668, 0x5669,
0x3e6f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b39, 0x0000, 0x0000,
0x566c, 0x0000, 0x0000, 0x566b, 0x566a, 0x497d, 0x0000, 0x5673,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b5a, 0x0000, 0x566d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x566f, 0x4b6b, 0x0000, 0x566e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5670,
0x0000, 0x4828, 0x5671, 0x4a3e, 0x5672, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3433, 0x4a3f, 0x472f, 0x5674, 0x5675, 0x0000,
0x392c, 0x3434, 0x5676, 0x3838, 0x4d44, 0x4d29, 0x3476, 0x5678,
0x0000, 0x4423, 0x0000, 0x392d, 0x3e31, 0x0000, 0x0000, 0x485f,
0x0000, 0x0000, 0x3e32, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d78,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x446c, 0x4a79, 0x4539,
0x0000, 0x0000, 0x392e, 0x0000, 0x495c, 0x0000, 0x0000, 0x0000,
0x5679, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4559, 0x3a42,
0x0000, 0x0000, 0x0000, 0x384b, 0x0000, 0x446d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3043, 0x3d6e, 0x392f,
0x4d47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x567a, 0x567b, 0x4751, 0x0000, 0x0000, 0x0000, 0x0000,
0x567c, 0x4e77, 0x4f2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x567e,
0x567d, 0x0000, 0x0000, 0x3347, 0x0000, 0x0000, 0x5721, 0x0000,
0x0000, 0x0000, 0x5724, 0x5725, 0x0000, 0x5723, 0x0000, 0x4940,
0x3e33, 0x5727, 0x5726, 0x5722, 0x0000, 0x0000, 0x0000, 0x0000,
0x5728, 0x5729, 0x0000, 0x0000, 0x572a, 0x0000, 0x0000, 0x0000,
0x572d, 0x572b, 0x0000, 0x572c, 0x572e, 0x0000, 0x3164, 0x446e,
0x572f, 0x0000, 0x377a, 0x3276, 0x4736, 0x0000, 0x5730, 0x467b,
};
static unsigned short const unicode_to_jisx0208_5f[] = {
/* 0x5f00 - 0x5fff */
0x0000, 0x4a5b, 0x0000, 0x5731, 0x4f2e, 0x0000, 0x0000, 0x0000,
0x0000, 0x5732, 0x4a40, 0x5735, 0x5021, 0x5031, 0x0000, 0x3c30,
0x4675, 0x5736, 0x0000, 0x355d, 0x4424, 0x307a, 0x5737, 0x4a26,
0x3930, 0x0000, 0x0000, 0x4350, 0x0000, 0x0000, 0x0000, 0x446f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c6f, 0x3839, 0x384c,
0x0000, 0x5738, 0x0000, 0x0000, 0x0000, 0x5739, 0x0000, 0x573f,
0x0000, 0x3c65, 0x0000, 0x0000, 0x0000, 0x4425, 0x0000, 0x362f,
0x573a, 0x0000, 0x0000, 0x0000, 0x492b, 0x0000, 0x4346, 0x0000,
0x0000, 0x573b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x573c, 0x0000, 0x3630, 0x0000, 0x573d, 0x0000, 0x573e, 0x0000,
0x0000, 0x5740, 0x0000, 0x4576, 0x0000, 0x0000, 0x5741, 0x5742,
0x0000, 0x5743, 0x0000, 0x0000, 0x5734, 0x5733, 0x0000, 0x0000,
0x0000, 0x5744, 0x3741, 0x0000, 0x0000, 0x0000, 0x4927, 0x0000,
0x0000, 0x3a4c, 0x4937, 0x4426, 0x494b, 0x5745, 0x0000, 0x0000,
0x3e34, 0x3146, 0x0000, 0x5746, 0x0000, 0x0000, 0x0000, 0x5747,
0x0000, 0x4c72, 0x0000, 0x0000, 0x4860, 0x0000, 0x0000, 0x574a,
0x317d, 0x402c, 0x5749, 0x5748, 0x3742, 0x4254, 0x0000, 0x574e,
0x574c, 0x0000, 0x574b, 0x4e27, 0x3865, 0x0000, 0x0000, 0x0000,
0x3d79, 0x574d, 0x454c, 0x3d3e, 0x0000, 0x0000, 0x0000, 0x4640,
0x5751, 0x5750, 0x0000, 0x0000, 0x0000, 0x0000, 0x574f, 0x0000,
0x5752, 0x3866, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5753, 0x497c, 0x3d5b, 0x0000, 0x0000, 0x5754, 0x4879, 0x0000,
0x0000, 0x0000, 0x0000, 0x4641, 0x4427, 0x0000, 0x0000, 0x0000,
0x0000, 0x4530, 0x0000, 0x0000, 0x5755, 0x352b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3f34, 0x0000, 0x492c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3477, 0x4726, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5756, 0x3b56,
0x4b3a, 0x4b3b, 0x0000, 0x0000, 0x317e, 0x575b, 0x0000, 0x0000,
0x4369, 0x0000, 0x0000, 0x0000, 0x5758, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3277, 0x0000, 0x0000, 0x0000, 0x0000,
0x582d, 0x575a, 0x0000, 0x0000, 0x0000, 0x4730, 0x0000, 0x0000,
0x5759, 0x0000, 0x0000, 0x5757, 0x0000, 0x397a, 0x0000, 0x575d,
};
static unsigned short const unicode_to_jisx0208_60[] = {
/* 0x6000 - 0x60ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5763, 0x5769,
0x5761, 0x0000, 0x455c, 0x0000, 0x0000, 0x5766, 0x495d, 0x0000,
0x0000, 0x5760, 0x0000, 0x5765, 0x4e67, 0x3b57, 0x0000, 0x0000,
0x4255, 0x575e, 0x0000, 0x0000, 0x0000, 0x355e, 0x5768, 0x402d,
0x3165, 0x5762, 0x3278, 0x5767, 0x0000, 0x0000, 0x0000, 0x3631,
0x0000, 0x5764, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x576a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x576c, 0x5776, 0x5774, 0x0000, 0x0000, 0x5771, 0x0000,
0x0000, 0x0000, 0x5770, 0x4e78, 0x0000, 0x5772, 0x0000, 0x0000,
0x3632, 0x0000, 0x3931, 0x0000, 0x0000, 0x3d7a, 0x0000, 0x0000,
0x0000, 0x5779, 0x576b, 0x0000, 0x0000, 0x0000, 0x0000, 0x576f,
0x575f, 0x0000, 0x327a, 0x5773, 0x5775, 0x4351, 0x0000, 0x0000,
0x3a28, 0x3238, 0x576d, 0x5778, 0x5777, 0x3633, 0x0000, 0x4229,
0x3366, 0x0000, 0x0000, 0x0000, 0x0000, 0x3743, 0x0000, 0x576e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x577a, 0x0000, 0x577d, 0x5821, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c3d, 0x0000, 0x5827, 0x4470, 0x577b, 0x0000, 0x0000,
0x0000, 0x0000, 0x5825, 0x0000, 0x3279, 0x0000, 0x5823, 0x5824,
0x0000, 0x0000, 0x577e, 0x5822, 0x0000, 0x0000, 0x0000, 0x3867,
0x4d2a, 0x0000, 0x0000, 0x3435, 0x0000, 0x0000, 0x3159, 0x5826,
0x0000, 0x473a, 0x302d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4861, 0x575c, 0x582c, 0x5830, 0x4c65, 0x0000,
0x5829, 0x0000, 0x0000, 0x0000, 0x4569, 0x582e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e70, 0x582f, 0x4657,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4f47, 0x0000, 0x582b, 0x0000, 0x0000, 0x0000, 0x0000,
0x5831, 0x0000, 0x397b, 0x0000, 0x404b, 0x0000, 0x0000, 0x3054,
0x582a, 0x5828, 0x0000, 0x415a, 0x0000, 0x0000, 0x0000, 0x577c,
0x3b34, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4246, 0x583d, 0x0000, 0x415b, 0x5838, 0x0000, 0x5835, 0x5836,
0x0000, 0x3c66, 0x5839, 0x583c, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_61[] = {
/* 0x6100 - 0x61ff */
0x5837, 0x3d25, 0x0000, 0x583a, 0x0000, 0x0000, 0x5834, 0x0000,
0x4c7c, 0x4c7b, 0x0000, 0x0000, 0x0000, 0x583e, 0x583f, 0x3055,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5833, 0x0000, 0x0000,
0x0000, 0x0000, 0x3672, 0x3026, 0x0000, 0x0000, 0x0000, 0x3436,
0x0000, 0x583b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5843,
0x5842, 0x0000, 0x0000, 0x0000, 0x5847, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5848, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5846, 0x5849, 0x5841, 0x5845,
0x0000, 0x0000, 0x584a, 0x0000, 0x584b, 0x0000, 0x0000, 0x5840,
0x3b7c, 0x0000, 0x5844, 0x4256, 0x3932, 0x5832, 0x3f35, 0x0000,
0x0000, 0x0000, 0x0000, 0x5858, 0x0000, 0x4a69, 0x0000, 0x0000,
0x584e, 0x584f, 0x5850, 0x0000, 0x0000, 0x5857, 0x0000, 0x5856,
0x0000, 0x0000, 0x4b7d, 0x3437, 0x0000, 0x5854, 0x0000, 0x3745,
0x3334, 0x0000, 0x0000, 0x5851, 0x0000, 0x0000, 0x4e38, 0x5853,
0x3056, 0x5855, 0x0000, 0x584c, 0x5852, 0x5859, 0x3744, 0x584d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d5d, 0x0000,
0x0000, 0x0000, 0x4d2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x585c,
0x0000, 0x0000, 0x5860, 0x0000, 0x0000, 0x0000, 0x417e, 0x0000,
0x4e79, 0x5861, 0x0000, 0x0000, 0x585e, 0x0000, 0x585b, 0x0000,
0x0000, 0x585a, 0x585f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a30, 0x0000, 0x0000, 0x4634,
0x0000, 0x3746, 0x0000, 0x5862, 0x585d, 0x0000, 0x5863, 0x0000,
0x0000, 0x0000, 0x377b, 0x0000, 0x0000, 0x0000, 0x3231, 0x0000,
0x0000, 0x0000, 0x586b, 0x0000, 0x0000, 0x0000, 0x3438, 0x0000,
0x0000, 0x0000, 0x0000, 0x5869, 0x0000, 0x0000, 0x586a, 0x3a29,
0x5868, 0x5866, 0x5865, 0x586c, 0x5864, 0x586e, 0x0000, 0x0000,
0x327b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5870, 0x0000, 0x0000, 0x586f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4428, 0x0000, 0x5873, 0x0000, 0x5871, 0x5867,
0x377c, 0x0000, 0x5872, 0x0000, 0x5876, 0x5875, 0x5877, 0x5874,
};
static unsigned short const unicode_to_jisx0208_62[] = {
/* 0x6200 - 0x62ff */
0x5878, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5879, 0x587a, 0x4a6a, 0x0000, 0x587c, 0x587b, 0x3d3f, 0x0000,
0x402e, 0x3266, 0x327c, 0x0000, 0x587d, 0x0000, 0x303f, 0x0000,
0x0000, 0x0000, 0x404c, 0x587e, 0x0000, 0x6c43, 0x5921, 0x3761,
0x0000, 0x5922, 0x0000, 0x0000, 0x0000, 0x0000, 0x406f, 0x0000,
0x0000, 0x0000, 0x5923, 0x0000, 0x0000, 0x0000, 0x5924, 0x353a,
0x5925, 0x0000, 0x5926, 0x5927, 0x4257, 0x0000, 0x0000, 0x0000,
0x384d, 0x0000, 0x0000, 0x4c61, 0x0000, 0x0000, 0x0000, 0x4b3c,
0x3d6a, 0x5928, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4070,
0x6e3d, 0x4862, 0x0000, 0x3c6a, 0x0000, 0x3a4d, 0x5929, 0x0000,
0x0000, 0x0000, 0x0000, 0x4247, 0x0000, 0x4a27, 0x0000, 0x0000,
0x4271, 0x0000, 0x0000, 0x592c, 0x0000, 0x0000, 0x592a, 0x0000,
0x592d, 0x0000, 0x0000, 0x592b, 0x0000, 0x0000, 0x0000, 0x0000,
0x592e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a31, 0x0000,
0x0000, 0x3037, 0x0000, 0x0000, 0x0000, 0x0000, 0x495e, 0x0000,
0x0000, 0x4863, 0x0000, 0x0000, 0x592f, 0x0000, 0x5932, 0x3e35,
0x353b, 0x0000, 0x5930, 0x5937, 0x3e36, 0x0000, 0x0000, 0x0000,
0x0000, 0x5931, 0x4744, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d5e, 0x5933, 0x5934, 0x5938, 0x456a, 0x5935, 0x3933,
0x405e, 0x0000, 0x0000, 0x5946, 0x4834, 0x0000, 0x4272, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4864, 0x5a2d, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a7a, 0x0000, 0x0000, 0x0000, 0x4471, 0x0000, 0x0000,
0x0000, 0x4b75, 0x0000, 0x593b, 0x3221, 0x436a, 0x0000, 0x0000,
0x0000, 0x0000, 0x5944, 0x0000, 0x0000, 0x4334, 0x593e, 0x5945,
0x5940, 0x5947, 0x5943, 0x0000, 0x5942, 0x476f, 0x0000, 0x593c,
0x327d, 0x593a, 0x3571, 0x4273, 0x5936, 0x0000, 0x0000, 0x5939,
0x3934, 0x405b, 0x0000, 0x3e37, 0x5941, 0x4752, 0x0000, 0x0000,
0x3572, 0x3348, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3367, 0x3f21, 0x5949, 0x594e,
0x0000, 0x594a, 0x0000, 0x377d, 0x0000, 0x594f, 0x3b22, 0x3969,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d26, 0x593d,
};
static unsigned short const unicode_to_jisx0208_63[] = {
/* 0x6300 - 0x63ff */
0x0000, 0x3b7d, 0x594c, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b58,
0x594d, 0x3044, 0x0000, 0x0000, 0x5948, 0x0000, 0x0000, 0x0000,
0x0000, 0x4429, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3573, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3634,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x594b,
0x3027, 0x0000, 0x0000, 0x3a43, 0x0000, 0x0000, 0x0000, 0x3f36,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4472, 0x0000, 0x0000, 0x4854, 0x5951, 0x415e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x422a, 0x0000, 0x0000, 0x3b2b, 0x5952, 0x0000, 0x5954,
0x5950, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a61, 0x0000, 0x443d,
0x0000, 0x0000, 0x0000, 0x0000, 0x415c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a7b,
0x3c4e, 0x5960, 0x0000, 0x595f, 0x0000, 0x0000, 0x3f78, 0x0000,
0x0000, 0x0000, 0x377e, 0x0000, 0x0000, 0x0000, 0x5959, 0x3e39,
0x0000, 0x0000, 0x4668, 0x4731, 0x0000, 0x0000, 0x0000, 0x0000,
0x5957, 0x0000, 0x0000, 0x415d, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c78, 0x595c, 0x0000, 0x0000, 0x3e38, 0x0000, 0x5956, 0x595b,
0x0000, 0x0000, 0x4753, 0x0000, 0x0000, 0x0000, 0x5955, 0x0000,
0x3721, 0x0000, 0x0000, 0x335d, 0x0000, 0x0000, 0x0000, 0x595d,
0x4e2b, 0x3a4e, 0x4335, 0x595a, 0x0000, 0x405c, 0x0000, 0x3935,
0x3f64, 0x3166, 0x413c, 0x5958, 0x3545, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3747, 0x0000, 0x444f, 0x595e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x415f, 0x0000, 0x0000, 0x5961, 0x0000,
0x5963, 0x0000, 0x0000, 0x4237, 0x5969, 0x0000, 0x5964, 0x0000,
0x0000, 0x5966, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4941,
0x4473, 0x0000, 0x5967, 0x0000, 0x0000, 0x0000, 0x4d2c, 0x0000,
0x0000, 0x0000, 0x4d48, 0x3439, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x302e, 0x0000, 0x5965, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5962, 0x0000, 0x0000, 0x0000, 0x0000, 0x3478, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3167, 0x0000, 0x5968, 0x0000,
0x0000, 0x0000, 0x4d49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_64[] = {
/* 0x6400 - 0x64ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x596c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x423b, 0x0000, 0x5973,
0x0000, 0x0000, 0x0000, 0x596d, 0x0000, 0x0000, 0x596a, 0x5971,
0x0000, 0x0000, 0x0000, 0x0000, 0x5953, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x596e, 0x0000,
0x5972, 0x0000, 0x0000, 0x0000, 0x4842, 0x456b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x596b, 0x0000, 0x596f, 0x0000,
0x0000, 0x0000, 0x3748, 0x0000, 0x0000, 0x0000, 0x3a71, 0x0000,
0x0000, 0x0000, 0x405d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5977, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4526, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5974,
0x0000, 0x4b60, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5975,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5976, 0x0000,
0x4c4e, 0x0000, 0x4022, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3762, 0x0000, 0x0000, 0x0000, 0x0000,
0x597d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b35, 0x597a, 0x0000, 0x5979, 0x0000, 0x0000,
0x0000, 0x0000, 0x4732, 0x0000, 0x0000, 0x0000, 0x4635, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4531, 0x597b, 0x0000, 0x0000,
0x0000, 0x597c, 0x0000, 0x496f, 0x0000, 0x4745, 0x3b23, 0x0000,
0x4071, 0x0000, 0x4b50, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3349, 0x0000, 0x5a25, 0x597e, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d4a, 0x5a27, 0x0000, 0x0000, 0x5a23, 0x0000, 0x5a24,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4160, 0x0000, 0x0000,
0x0000, 0x0000, 0x5a22, 0x0000, 0x593f, 0x0000, 0x0000, 0x0000,
0x5a26, 0x0000, 0x5a21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5a2b, 0x5a2c, 0x4527, 0x5a2e, 0x0000, 0x0000, 0x3b24, 0x5a29,
0x0000, 0x0000, 0x0000, 0x0000, 0x353c, 0x0000, 0x0000, 0x5a2f,
0x0000, 0x5a28, 0x5a33, 0x0000, 0x5a32, 0x0000, 0x5a31, 0x0000,
0x0000, 0x0000, 0x5a34, 0x0000, 0x0000, 0x5a36, 0x3e71, 0x0000,
};
static unsigned short const unicode_to_jisx0208_65[] = {
/* 0x6500 - 0x65ff */
0x5a35, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a39, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5a37, 0x0000, 0x0000, 0x0000, 0x5a38, 0x5970, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5a3b, 0x5a3a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5978, 0x5a3c, 0x5a30, 0x0000, 0x0000, 0x3b59,
0x0000, 0x0000, 0x0000, 0x0000, 0x5a3d, 0x5a3e, 0x5a40, 0x5a3f,
0x5a41, 0x327e, 0x0000, 0x3936, 0x0000, 0x0000, 0x4a7c, 0x402f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x384e, 0x0000, 0x0000,
0x5a43, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a46, 0x0000, 0x4952,
0x0000, 0x355f, 0x0000, 0x0000, 0x0000, 0x5a45, 0x5a44, 0x4754,
0x5a47, 0x3635, 0x0000, 0x0000, 0x0000, 0x5a49, 0x5a48, 0x0000,
0x0000, 0x0000, 0x343a, 0x3b36, 0x0000, 0x0000, 0x4658, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3749, 0x0000, 0x0000, 0x0000,
0x3f74, 0x0000, 0x5a4a, 0x0000, 0x4030, 0x4528, 0x0000, 0x495f,
0x5a4b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5a4c, 0x5a4d, 0x0000, 0x0000, 0x0000, 0x4a38,
0x555d, 0x4046, 0x0000, 0x0000, 0x494c, 0x0000, 0x3a58, 0x0000,
0x4865, 0x4843, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x454d,
0x0000, 0x4e41, 0x0000, 0x5a4f, 0x3c50, 0x0000, 0x0000, 0x5a50,
0x0000, 0x3036, 0x0000, 0x0000, 0x3654, 0x404d, 0x0000, 0x4960,
0x0000, 0x0000, 0x0000, 0x5a51, 0x3b42, 0x4347, 0x0000, 0x3b5b,
0x3f37, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a52,
0x0000, 0x4a7d, 0x0000, 0x0000, 0x3177, 0x3b5c, 0x0000, 0x0000,
0x0000, 0x5a55, 0x0000, 0x5a53, 0x5a56, 0x4e39, 0x5a54, 0x0000,
0x0000, 0x0000, 0x0000, 0x407b, 0x5a57, 0x0000, 0x0000, 0x4232,
0x0000, 0x0000, 0x5a58, 0x0000, 0x0000, 0x0000, 0x0000, 0x347a,
0x0000, 0x5a5a, 0x0000, 0x5a59, 0x0000, 0x0000, 0x0000, 0x0000,
0x5a5b, 0x5a5c, 0x347b, 0x0000, 0x0000, 0x467c, 0x4336, 0x356c,
0x3b5d, 0x4161, 0x0000, 0x0000, 0x3d5c, 0x3030, 0x0000, 0x0000,
0x0000, 0x5a5d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3222, 0x5a61, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_66[] = {
/* 0x6600 - 0x66ff */
0x0000, 0x0000, 0x3937, 0x5a60, 0x0000, 0x0000, 0x3a2b, 0x3e3a,
0x0000, 0x0000, 0x5a5f, 0x0000, 0x3e3b, 0x0000, 0x4c40, 0x3a2a,
0x0000, 0x0000, 0x0000, 0x3057, 0x404e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5a66, 0x0000, 0x0000, 0x4031,
0x3147, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d55, 0x0000, 0x4b66,
0x3a72, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e3c, 0x0000, 0x4027,
0x0000, 0x0000, 0x0000, 0x0000, 0x5a65, 0x5a63, 0x5a64, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x436b, 0x0000, 0x0000, 0x5b26,
0x0000, 0x5a6a, 0x3b7e, 0x3938, 0x5a68, 0x0000, 0x0000, 0x0000,
0x0000, 0x5a69, 0x0000, 0x3f38, 0x0000, 0x0000, 0x0000, 0x5a67,
0x0000, 0x0000, 0x3b2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a6c, 0x5a6b, 0x5a70,
0x0000, 0x0000, 0x5a71, 0x0000, 0x5a6d, 0x0000, 0x3322, 0x5a6e,
0x5a6f, 0x4855, 0x0000, 0x0000, 0x0000, 0x0000, 0x4961, 0x374a,
0x5a72, 0x0000, 0x0000, 0x0000, 0x4032, 0x0000, 0x3e3d, 0x0000,
0x0000, 0x0000, 0x4352, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3647, 0x0000, 0x5a73, 0x5a77, 0x0000, 0x0000, 0x324b,
0x5a74, 0x5a76, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a75, 0x0000,
0x0000, 0x3d6b, 0x0000, 0x0000, 0x0000, 0x0000, 0x4348, 0x3045,
0x5a78, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a79, 0x0000, 0x0000,
0x0000, 0x0000, 0x442a, 0x0000, 0x0000, 0x0000, 0x4e71, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b43, 0x0000, 0x0000, 0x4a6b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b3d, 0x0000, 0x0000, 0x0000,
0x5b22, 0x5a7b, 0x0000, 0x0000, 0x5a7e, 0x0000, 0x5a7d, 0x0000,
0x0000, 0x5a7a, 0x0000, 0x0000, 0x5b21, 0x0000, 0x0000, 0x465e,
0x0000, 0x5a7c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b23, 0x0000,
0x0000, 0x3d6c, 0x5b24, 0x0000, 0x4d4b, 0x4778, 0x0000, 0x0000,
0x5b25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b27, 0x0000,
0x0000, 0x5b28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b29, 0x0000, 0x364a, 0x3148, 0x3939, 0x5b2a, 0x0000, 0x5b2b,
0x3d71, 0x4162, 0x0000, 0x0000, 0x5258, 0x413e, 0x413d, 0x4258,
};
static unsigned short const unicode_to_jisx0208_67[] = {
/* 0x6700 - 0x67ff */
0x3a47, 0x0000, 0x0000, 0x5072, 0x0000, 0x0000, 0x0000, 0x0000,
0x376e, 0x4d2d, 0x0000, 0x4a7e, 0x0000, 0x497e, 0x0000, 0x5b2c,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a73, 0x443f, 0x5b2d, 0x4f2f,
0x0000, 0x0000, 0x0000, 0x4b3e, 0x0000, 0x442b, 0x5b2e, 0x347c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b2f, 0x5b30,
0x4c5a, 0x0000, 0x4c24, 0x4b76, 0x4b5c, 0x3b25, 0x5b32, 0x0000,
0x0000, 0x3c6b, 0x0000, 0x0000, 0x4b51, 0x0000, 0x5b34, 0x5b37,
0x5b36, 0x0000, 0x3479, 0x0000, 0x0000, 0x3560, 0x0000, 0x5b33,
0x0000, 0x5b35, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b38, 0x0000,
0x0000, 0x3f79, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d7b, 0x3049,
0x3a60, 0x423c, 0x0000, 0x3c5d, 0x0000, 0x0000, 0x3e73, 0x0000,
0x0000, 0x5b3b, 0x0000, 0x0000, 0x454e, 0x0000, 0x5b39, 0x422b,
0x5b3a, 0x3e72, 0x4c5d, 0x5b3c, 0x5b3d, 0x4d68, 0x0000, 0x0000,
0x0000, 0x0000, 0x5b42, 0x0000, 0x0000, 0x393a, 0x0000, 0x4755,
0x5b3f, 0x456c, 0x5a5e, 0x5a62, 0x0000, 0x354f, 0x0000, 0x4747,
0x0000, 0x0000, 0x0000, 0x0000, 0x5b41, 0x0000, 0x3e3e, 0x4844,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b47, 0x0000, 0x487a,
0x0000, 0x5b3e, 0x0000, 0x5b44, 0x5b43, 0x0000, 0x0000, 0x0000,
0x404f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b6d, 0x0000, 0x4e53,
0x0000, 0x0000, 0x4b67, 0x0000, 0x324c, 0x3b5e, 0x0000, 0x0000,
0x4f48, 0x5b46, 0x3f75, 0x0000, 0x0000, 0x0000, 0x5b45, 0x0000,
0x0000, 0x5b40, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x384f,
0x0000, 0x0000, 0x0000, 0x5b4c, 0x5b4a, 0x0000, 0x324d, 0x5b48,
0x5b4e, 0x5b54, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4248, 0x0000, 0x0000, 0x4a41, 0x0000, 0x5b56, 0x0000,
0x0000, 0x0000, 0x4922, 0x0000, 0x0000, 0x0000, 0x5b55, 0x4770,
0x4b3f, 0x343b, 0x0000, 0x4077, 0x3d40, 0x0000, 0x0000, 0x0000,
0x4453, 0x0000, 0x4d2e, 0x0000, 0x0000, 0x5b51, 0x5b50, 0x0000,
0x0000, 0x0000, 0x5b52, 0x0000, 0x5b4f, 0x0000, 0x0000, 0x5b57,
0x0000, 0x5b4d, 0x0000, 0x0000, 0x5b4b, 0x0000, 0x5b53, 0x5b49,
0x0000, 0x436c, 0x0000, 0x4c78, 0x3c46, 0x3a74, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3a3a, 0x0000, 0x0000, 0x4b6f, 0x3341,
};
static unsigned short const unicode_to_jisx0208_68[] = {
/* 0x6800 - 0x68ff */
0x0000, 0x0000, 0x444e, 0x464a, 0x3149, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4072, 0x0000, 0x0000, 0x4034, 0x372a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b59, 0x0000,
0x0000, 0x393b, 0x337c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5b5b, 0x3374, 0x5b61, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5b5e, 0x0000, 0x4073, 0x0000, 0x0000, 0x0000,
0x334b, 0x3a2c, 0x0000, 0x0000, 0x334a, 0x3a4f, 0x0000, 0x0000,
0x5b5c, 0x3765, 0x374b, 0x456d, 0x0000, 0x0000, 0x5b5a, 0x0000,
0x3046, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b5d, 0x5b5f, 0x0000,
0x364d, 0x372c, 0x0000, 0x343c, 0x354b, 0x0000, 0x0000, 0x0000,
0x0000, 0x5b62, 0x0000, 0x0000, 0x3a79, 0x4b71, 0x0000, 0x3b37,
0x0000, 0x0000, 0x0000, 0x5b63, 0x0000, 0x0000, 0x0000, 0x4930,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5b6f, 0x0000, 0x3233, 0x5b64,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b75, 0x5b65,
0x0000, 0x4e42, 0x0000, 0x5b6c, 0x0000, 0x475f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b74, 0x0000, 0x5b67,
0x0000, 0x0000, 0x0000, 0x3034, 0x5b69, 0x0000, 0x0000, 0x393c,
0x0000, 0x0000, 0x0000, 0x5b6b, 0x0000, 0x5b6a, 0x0000, 0x5b66,
0x5b71, 0x0000, 0x3e3f, 0x0000, 0x0000, 0x0000, 0x546d, 0x3868,
0x4d7c, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b68, 0x0000, 0x4474,
0x3323, 0x3a2d, 0x0000, 0x5b60, 0x0000, 0x5b70, 0x3361, 0x0000,
0x0000, 0x5b6e, 0x5b72, 0x0000, 0x456e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x347e, 0x0000, 0x5c32, 0x0000,
0x0000, 0x4c49, 0x5b77, 0x347d, 0x0000, 0x5b7e, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b40, 0x0000, 0x5c21, 0x5c23, 0x0000, 0x5c27,
0x5b79, 0x0000, 0x432a, 0x0000, 0x0000, 0x0000, 0x0000, 0x456f,
0x5c2b, 0x5b7c, 0x0000, 0x5c28, 0x0000, 0x0000, 0x0000, 0x5c22,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f39, 0x5c2c,
0x0000, 0x0000, 0x4033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c2a, 0x343d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_69[] = {
/* 0x6900 - 0x69ff */
0x4f50, 0x5b76, 0x0000, 0x0000, 0x5c26, 0x3058, 0x0000, 0x0000,
0x5b78, 0x0000, 0x0000, 0x4c3a, 0x5b7d, 0x3f22, 0x4447, 0x5b73,
0x0000, 0x0000, 0x5c25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f7a, 0x5c2f, 0x3371, 0x3821, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c31, 0x5b7a, 0x5c30, 0x0000, 0x5c29, 0x5b7b, 0x0000,
0x5c2d, 0x0000, 0x5c2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c3f, 0x0000, 0x0000, 0x0000, 0x464e, 0x0000, 0x5c24, 0x0000,
0x0000, 0x5c3b, 0x0000, 0x0000, 0x0000, 0x5c3d, 0x0000, 0x4458,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4976, 0x5c38, 0x424a, 0x0000, 0x0000,
0x0000, 0x5c3e, 0x413f, 0x0000, 0x5c35, 0x5c42, 0x5c41, 0x0000,
0x466f, 0x5c40, 0x466a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c44, 0x5c37, 0x0000, 0x3648, 0x5c3a, 0x3d5d,
0x0000, 0x0000, 0x0000, 0x4760, 0x5c3c, 0x364b, 0x0000, 0x5c34,
0x5c36, 0x5c33, 0x0000, 0x0000, 0x4f30, 0x335a, 0x5c39, 0x0000,
0x0000, 0x5c43, 0x3335, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a67, 0x0000, 0x0000, 0x0000, 0x315d, 0x0000,
0x0000, 0x5c54, 0x0000, 0x0000, 0x4f31, 0x5c57, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3f3a, 0x5c56, 0x0000, 0x0000, 0x0000,
0x5c55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c52,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c46, 0x0000,
0x0000, 0x5c63, 0x5c45, 0x0000, 0x5c58, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5c50, 0x0000, 0x0000, 0x5c4b, 0x5c48,
0x0000, 0x5c49, 0x0000, 0x5c51, 0x0000, 0x0000, 0x0000, 0x7422,
0x0000, 0x0000, 0x5c4e, 0x393d, 0x4448, 0x4164, 0x5c4c, 0x0000,
0x5c47, 0x0000, 0x0000, 0x5c4a, 0x0000, 0x0000, 0x0000, 0x0000,
0x4d4d, 0x4b6a, 0x0000, 0x0000, 0x0000, 0x5c4f, 0x5c59, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c61,
0x5c5a, 0x0000, 0x0000, 0x5c67, 0x0000, 0x5c65, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c60, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c5f, 0x0000, 0x4450, 0x0000, 0x4165, 0x0000, 0x5c5d,
};
static unsigned short const unicode_to_jisx0208_6a[] = {
/* 0x6a00 - 0x6aff */
0x0000, 0x0000, 0x5c5b, 0x0000, 0x0000, 0x5c62, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c68, 0x4875, 0x5c6e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c69, 0x5c6c, 0x5c66, 0x0000, 0x0000, 0x4374,
0x0000, 0x4938, 0x0000, 0x5c5c, 0x0000, 0x0000, 0x5c64, 0x3e40,
0x0000, 0x4c4f, 0x5c78, 0x5c6b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3822, 0x3223, 0x335f, 0x0000, 0x0000, 0x5c53, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e41, 0x5c70, 0x0000,
0x5c77, 0x3c79, 0x3372, 0x0000, 0x0000, 0x432e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5c6d, 0x0000, 0x0000, 0x5c72,
0x5c76, 0x0000, 0x0000, 0x3636, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x354c, 0x5c74, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3521,
0x0000, 0x464b, 0x5c73, 0x0000, 0x0000, 0x0000, 0x5c75, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c6f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c71, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3360,
0x4349, 0x0000, 0x0000, 0x0000, 0x5c7c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c7a, 0x3869, 0x0000,
0x5c79, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d21,
0x0000, 0x0000, 0x0000, 0x0000, 0x5b58, 0x0000, 0x0000, 0x0000,
0x5c7b, 0x0000, 0x5c7d, 0x5c7e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5d2c, 0x0000, 0x5d28, 0x0000, 0x5b6d, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d27, 0x0000, 0x0000, 0x0000, 0x0000,
0x5d26, 0x0000, 0x0000, 0x5d23, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c6a, 0x5d25, 0x5d24, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5d2a, 0x0000, 0x4f26, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5d2d, 0x367b, 0x0000, 0x0000, 0x5d29, 0x5d2b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4827, 0x0000, 0x5d2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5d32, 0x5d2f, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_6b[] = {
/* 0x6b00 - 0x6bff */
0x0000, 0x0000, 0x0000, 0x0000, 0x4d73, 0x5d30, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c5e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5d33, 0x0000, 0x0000, 0x0000, 0x5d34, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3135, 0x0000, 0x5d36,
0x3767, 0x3c21, 0x0000, 0x3655, 0x0000, 0x0000, 0x0000, 0x3224,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d38,
0x5d37, 0x5d3a, 0x353d, 0x0000, 0x0000, 0x3656, 0x343e, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d3d, 0x0000, 0x0000, 0x0000, 0x5d3c,
0x0000, 0x5d3e, 0x0000, 0x0000, 0x324e, 0x0000, 0x4337, 0x0000,
0x5d3f, 0x0000, 0x0000, 0x343f, 0x5d41, 0x0000, 0x0000, 0x0000,
0x0000, 0x5d40, 0x0000, 0x5d42, 0x0000, 0x0000, 0x0000, 0x5d43,
0x0000, 0x5d44, 0x3b5f, 0x4035, 0x3a21, 0x0000, 0x4970, 0x0000,
0x0000, 0x4a62, 0x4f44, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b75,
0x0000, 0x0000, 0x0000, 0x3a50, 0x4e72, 0x0000, 0x0000, 0x0000,
0x5d45, 0x5d46, 0x0000, 0x3b60, 0x0000, 0x0000, 0x0000, 0x5d47,
0x5d48, 0x0000, 0x0000, 0x5d4a, 0x5d49, 0x0000, 0x4b58, 0x0000,
0x0000, 0x3d5e, 0x3c6c, 0x3b44, 0x0000, 0x5d4b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d4d, 0x3f23, 0x0000,
0x5d4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d4e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5d4f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5d50, 0x5d51, 0x0000, 0x0000, 0x0000, 0x5d52,
0x0000, 0x5d54, 0x5d53, 0x5d55, 0x3225, 0x434a, 0x0000, 0x5d56,
0x0000, 0x0000, 0x3b26, 0x334c, 0x5d57, 0x0000, 0x0000, 0x4542,
0x544c, 0x0000, 0x0000, 0x0000, 0x0000, 0x3523, 0x5d58, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d59, 0x0000, 0x4a6c, 0x4b68, 0x0000,
0x0000, 0x0000, 0x4647, 0x5d5a, 0x4866, 0x0000, 0x0000, 0x0000,
0x487b, 0x0000, 0x0000, 0x4c53, 0x0000, 0x0000, 0x0000, 0x5d5b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d5d, 0x5d5c, 0x0000, 0x0000, 0x5d5f,
0x0000, 0x0000, 0x0000, 0x5d5e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_6c[] = {
/* 0x6c00 - 0x6cff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5d61, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b61,
0x0000, 0x4c31, 0x0000, 0x5d62, 0x5d63, 0x0000, 0x0000, 0x3524,
0x0000, 0x0000, 0x0000, 0x5d64, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d66, 0x5d65, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f65, 0x0000, 0x0000, 0x4939,
0x314a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4845, 0x0000,
0x4475, 0x3d41, 0x3561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4846, 0x0000,
0x3c2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d68, 0x0000, 0x3440,
0x0000, 0x0000, 0x3178, 0x0000, 0x0000, 0x4672, 0x5d67, 0x393e,
0x4353, 0x0000, 0x5d69, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5d71, 0x0000, 0x5d6a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4241, 0x0000, 0x3562, 0x5d72, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3768, 0x0000, 0x0000, 0x3525, 0x5d70, 0x0000,
0x0000, 0x5d6e, 0x5d6b, 0x4d60, 0x0000, 0x0000, 0x0000, 0x0000,
0x4440, 0x0000, 0x0000, 0x0000, 0x4659, 0x5d6c, 0x0000, 0x0000,
0x5d74, 0x0000, 0x5d73, 0x3723, 0x0000, 0x0000, 0x322d, 0x0000,
0x0000, 0x3a3b, 0x5d6d, 0x5d6f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4b57, 0x4274, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4b77, 0x0000, 0x0000, 0x5d7c, 0x0000,
0x0000, 0x5d7d, 0x0000, 0x324f, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a28, 0x4c7d, 0x5e21, 0x3c23, 0x3e42, 0x5d78, 0x5d7e, 0x3168,
0x0000, 0x3637, 0x0000, 0x0000, 0x5d75, 0x5d7a, 0x0000, 0x0000,
0x0000, 0x4074, 0x4771, 0x0000, 0x4867, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d77, 0x0000, 0x4b21, 0x0000, 0x5d79,
0x0000, 0x5e24, 0x0000, 0x5e22, 0x0000, 0x5d7b, 0x0000, 0x0000,
0x0000, 0x4b22, 0x4748, 0x3563, 0x0000, 0x4525, 0x0000, 0x0000,
0x436d, 0x0000, 0x5e25, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e23,
0x4259, 0x5d76, 0x0000, 0x314b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_6d[] = {
/* 0x6d00 - 0x6dff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4d4e, 0x5e30, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5e2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4076,
0x0000, 0x5e2c, 0x0000, 0x4d6c, 0x0000, 0x0000, 0x4636, 0x5e26,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4445, 0x0000, 0x0000,
0x0000, 0x314c, 0x393f, 0x5e29, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3d27, 0x5e2e, 0x0000, 0x5e2d, 0x5e28, 0x0000,
0x5e2b, 0x0000, 0x0000, 0x3368, 0x0000, 0x5e2a, 0x4749, 0x0000,
0x0000, 0x4e2e, 0x0000, 0x0000, 0x3e74, 0x4075, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5e36, 0x5e34, 0x0000, 0x494d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e31, 0x5e33, 0x0000, 0x313a, 0x0000,
0x0000, 0x3940, 0x4f32, 0x0000, 0x333d, 0x0000, 0x4962, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d61, 0x0000, 0x0000, 0x3324,
0x3f3b, 0x5e35, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e3a, 0x0000, 0x0000,
0x3e43, 0x0000, 0x0000, 0x0000, 0x4d30, 0x0000, 0x5e37, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e32, 0x0000, 0x5e38, 0x0000, 0x0000,
0x0000, 0x4e5e, 0x0000, 0x4573, 0x4642, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3336,
0x0000, 0x0000, 0x3155, 0x0000, 0x0000, 0x5e3e, 0x0000, 0x0000,
0x5e41, 0x0000, 0x0000, 0x0000, 0x4e43, 0x0000, 0x0000, 0x0000,
0x4d64, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e48, 0x5e42, 0x5e3f,
0x0000, 0x0000, 0x0000, 0x4e54, 0x5e45, 0x0000, 0x0000, 0x0000,
0x0000, 0x3d4a, 0x5e47, 0x0000, 0x0000, 0x5e4c, 0x0000, 0x0000,
0x4571, 0x5e4a, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e44, 0x0000,
0x0000, 0x4338, 0x0000, 0x0000, 0x5e4b, 0x0000, 0x5e40, 0x0000,
0x5e46, 0x0000, 0x5e4d, 0x307c, 0x5e43, 0x0000, 0x5e4e, 0x0000,
0x0000, 0x3f3c, 0x0000, 0x3d5f, 0x0000, 0x4a25, 0x0000, 0x3a2e,
0x0000, 0x5e3b, 0x5e49, 0x453a, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_6e[] = {
/* 0x6e00 - 0x6eff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4036, 0x0000, 0x3369,
0x3a51, 0x3e44, 0x5e3d, 0x3d42, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x374c, 0x0000, 0x5e3c, 0x0000, 0x0000,
0x0000, 0x5e52, 0x3d6d, 0x383a, 0x0000, 0x5e61, 0x0000, 0x5e5b,
0x3574, 0x454f, 0x0000, 0x5e56, 0x5e5f, 0x302f, 0x3132, 0x0000,
0x0000, 0x3239, 0x0000, 0x5e58, 0x422c, 0x5e4f, 0x5e51, 0x3941,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5e62, 0x0000, 0x5e5d, 0x0000, 0x0000, 0x0000, 0x5e55, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e5c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c2b, 0x0000, 0x0000, 0x5e5a, 0x5e5e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3850, 0x0000,
0x3e45, 0x0000, 0x0000, 0x4339, 0x0000, 0x0000, 0x0000, 0x5e54,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d2f,
0x0000, 0x0000, 0x0000, 0x5e57, 0x0000, 0x0000, 0x5e50, 0x4572,
0x0000, 0x0000, 0x5e53, 0x0000, 0x0000, 0x0000, 0x5e59, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f51, 0x3c3e,
0x4b7e, 0x0000, 0x5e63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x482e, 0x0000, 0x0000, 0x5e6f,
0x383b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d60, 0x0000,
0x5e65, 0x0000, 0x0000, 0x0000, 0x4e2f, 0x3942, 0x0000, 0x5e72,
0x0000, 0x0000, 0x306e, 0x0000, 0x0000, 0x5e70, 0x0000, 0x0000,
0x0000, 0x0000, 0x5e64, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e6a,
0x0000, 0x0000, 0x5e6c, 0x0000, 0x0000, 0x0000, 0x4d4f, 0x5e67,
0x0000, 0x0000, 0x452e, 0x0000, 0x0000, 0x5e69, 0x0000, 0x0000,
0x0000, 0x0000, 0x5e71, 0x0000, 0x5e6b, 0x4c47, 0x0000, 0x0000,
0x0000, 0x5e66, 0x0000, 0x3c22, 0x5e7e, 0x0000, 0x0000, 0x0000,
0x0000, 0x336a, 0x0000, 0x5e68, 0x5e6d, 0x5e6e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x426c, 0x425a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e76, 0x0000, 0x0000, 0x5e7c,
0x0000, 0x0000, 0x5e7a, 0x0000, 0x4529, 0x0000, 0x0000, 0x5f23,
0x5e77, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e78, 0x5e60,
};
static unsigned short const unicode_to_jisx0208_6f[] = {
/* 0x6f00 - 0x6fff */
0x0000, 0x3579, 0x493a, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x0000,
0x0000, 0x3977, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f33,
0x0000, 0x5e74, 0x0000, 0x5f22, 0x3169, 0x4166, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4779, 0x0000, 0x3441, 0x4e7a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4c21, 0x4452, 0x0000, 0x0000, 0x0000,
0x0000, 0x5e7b, 0x5e7d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4132, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f21, 0x5e79,
0x0000, 0x5e73, 0x0000, 0x0000, 0x0000, 0x3443, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3769, 0x0000, 0x0000, 0x0000,
0x5f2f, 0x0000, 0x0000, 0x5f2a, 0x4078, 0x0000, 0x0000, 0x3363,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d61, 0x0000, 0x5f33, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f2c, 0x442c, 0x5f29,
0x4459, 0x0000, 0x0000, 0x0000, 0x5f4c, 0x0000, 0x0000, 0x0000,
0x5f26, 0x0000, 0x5f25, 0x0000, 0x5f2e, 0x0000, 0x0000, 0x0000,
0x5f28, 0x5f27, 0x5f2d, 0x0000, 0x4021, 0x0000, 0x5f24, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f30, 0x0000,
0x0000, 0x5f31, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3442,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f36, 0x0000, 0x5f35, 0x5f37, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5f3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4543, 0x0000, 0x5f34, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3763, 0x4279, 0x5f32, 0x473b, 0x0000, 0x0000, 0x5f39, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f3e, 0x5f3c, 0x0000, 0x0000,
0x5f3f, 0x0000, 0x0000, 0x5f42, 0x0000, 0x0000, 0x0000, 0x5f3b,
0x396a, 0x4728, 0x0000, 0x0000, 0x5e39, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4d74, 0x5f3d, 0x0000, 0x5f41, 0x4275,
0x0000, 0x5f40, 0x0000, 0x5f2b, 0x0000, 0x0000, 0x6f69, 0x0000,
0x0000, 0x0000, 0x5f45, 0x0000, 0x0000, 0x0000, 0x5f49, 0x0000,
};
static unsigned short const unicode_to_jisx0208_70[] = {
/* 0x7000 - 0x70ff */
0x0000, 0x5f47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f43, 0x0000, 0x5f44, 0x0000, 0x0000, 0x0000, 0x5f48,
0x0000, 0x5f46, 0x0000, 0x0000, 0x0000, 0x494e, 0x0000, 0x0000,
0x5f4e, 0x0000, 0x5f4b, 0x5f4a, 0x0000, 0x5f4d, 0x4654, 0x5f4f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4375, 0x426d,
0x0000, 0x0000, 0x0000, 0x0000, 0x4025, 0x0000, 0x0000, 0x0000,
0x5f50, 0x0000, 0x5f52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f51, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e75, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f53, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4667, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5f54, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3250, 0x0000, 0x0000, 0x0000, 0x4574,
0x3325, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3564, 0x0000, 0x0000, 0x0000, 0x3c5e, 0x3a52, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4f27, 0x3f66, 0x0000, 0x0000, 0x0000, 0x316a, 0x0000,
0x0000, 0x0000, 0x5f56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f59, 0x433a, 0x5f5c, 0x5f57,
0x0000, 0x0000, 0x0000, 0x5f5b, 0x0000, 0x0000, 0x0000, 0x0000,
0x5f5a, 0x4540, 0x3059, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4e75, 0x0000, 0x0000, 0x5f5e, 0x0000, 0x0000, 0x0000, 0x3128,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f60, 0x0000, 0x0000, 0x0000, 0x5f5f, 0x0000, 0x5f5d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f58, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4b23, 0x0000, 0x0000, 0x0000, 0x5f62, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_71[] = {
/* 0x7100 - 0x71ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f61, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x316b, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f64, 0x4a32, 0x0000, 0x5f63, 0x0000, 0x0000, 0x0000,
0x0000, 0x4c35, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e47, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4133, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e46, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4e7b, 0x0000, 0x0000, 0x5f6a, 0x0000, 0x4079, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f66, 0x5f6b, 0x0000,
0x0000, 0x316c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5f69, 0x0000, 0x4761, 0x5f65, 0x5f68, 0x3e48,
0x0000, 0x4851, 0x0000, 0x0000, 0x5f6c, 0x0000, 0x3c51, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x407a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f6f, 0x0000, 0x0000, 0x0000,
0x5f67, 0x0000, 0x3727, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f6d,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d50, 0x5f70, 0x0000, 0x0000,
0x0000, 0x7426, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d4f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5f71, 0x0000, 0x0000, 0x0000, 0x5f72, 0x0000, 0x0000, 0x0000,
0x0000, 0x472e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f74, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f75, 0x0000,
0x0000, 0x0000, 0x0000, 0x4733, 0x0000, 0x0000, 0x0000, 0x0000,
0x4575, 0x5f77, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f79, 0x0000,
0x4e55, 0x0000, 0x5f76, 0x0000, 0x5f78, 0x316d, 0x0000, 0x5f73,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x535b,
0x5f7a, 0x0000, 0x0000, 0x0000, 0x0000, 0x4167, 0x3b38, 0x5f7c,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f7b, 0x3f24, 0x5259, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f7d, 0x0000, 0x0000,
0x0000, 0x6021, 0x0000, 0x5f6e, 0x5f7e, 0x0000, 0x0000, 0x6022,
};
static unsigned short const unicode_to_jisx0208_72[] = {
/* 0x7200 - 0x72ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x477a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6023, 0x0000, 0x0000,
0x6024, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6025, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6026, 0x0000, 0x445e, 0x0000, 0x6028, 0x6027, 0x0000, 0x0000,
0x6029, 0x0000, 0x602a, 0x0000, 0x0000, 0x3c5f, 0x4963, 0x0000,
0x0000, 0x0000, 0x4c6c, 0x602b, 0x602c, 0x4156, 0x3c24, 0x602d,
0x602e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x602f, 0x4a52,
0x4847, 0x0000, 0x0000, 0x6030, 0x4757, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x442d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6031, 0x3267, 0x0000, 0x356d, 0x0000, 0x4c46, 0x0000, 0x4c36,
0x0000, 0x3234, 0x4f34, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b52,
0x0000, 0x4a2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4037, 0x0000, 0x6032, 0x0000, 0x0000, 0x0000,
0x0000, 0x4643, 0x0000, 0x0000, 0x0000, 0x3823, 0x6033, 0x0000,
0x3a54, 0x6035, 0x6034, 0x0000, 0x0000, 0x0000, 0x0000, 0x6036,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6037, 0x0000, 0x0000, 0x0000, 0x6038, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x353e, 0x0000, 0x6039, 0x0000, 0x0000, 0x0000, 0x0000, 0x603a,
0x0000, 0x0000, 0x0000, 0x0000, 0x3824, 0x0000, 0x0000, 0x4848,
0x0000, 0x0000, 0x603c, 0x0000, 0x0000, 0x0000, 0x3e75, 0x0000,
0x0000, 0x603b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3638, 0x603d, 0x603f, 0x0000, 0x603e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6040, 0x0000,
0x3851, 0x0000, 0x6041, 0x0000, 0x0000, 0x0000, 0x0000, 0x3669,
0x0000, 0x4140, 0x0000, 0x397d, 0x0000, 0x0000, 0x0000, 0x0000,
0x6043, 0x6044, 0x6042, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c6d, 0x0000, 0x0000, 0x4648, 0x3639, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6046,
0x432c, 0x6045, 0x0000, 0x0000, 0x4f35, 0x4762, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_73[] = {
/* 0x7300 - 0x73ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x604b, 0x6048,
0x0000, 0x0000, 0x0000, 0x4c54, 0x604a, 0x604c, 0x0000, 0x4e44,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6050, 0x0000, 0x0000,
0x0000, 0x604f, 0x4376, 0x472d, 0x0000, 0x0000, 0x3825, 0x604e,
0x0000, 0x0000, 0x0000, 0x0000, 0x604d, 0x0000, 0x4d31, 0x4d32,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6051, 0x316e,
0x0000, 0x0000, 0x0000, 0x0000, 0x3976, 0x3b62, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6052, 0x6053,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6055,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3d43, 0x0000, 0x0000, 0x0000, 0x0000,
0x6057, 0x0000, 0x6056, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6058, 0x0000, 0x334d, 0x0000, 0x0000, 0x605a, 0x0000, 0x0000,
0x6059, 0x0000, 0x605c, 0x605b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x383c, 0x0000, 0x0000, 0x4e28,
0x0000, 0x364c, 0x0000, 0x3226, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x366a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3461, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4e68, 0x605e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6060, 0x0000, 0x0000, 0x0000, 0x0000,
0x6061, 0x0000, 0x3251, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x605d, 0x0000, 0x3b39, 0x0000, 0x0000, 0x4441, 0x605f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6064, 0x0000,
0x3c6e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6062, 0x0000, 0x0000,
0x0000, 0x0000, 0x373e, 0x0000, 0x0000, 0x4849, 0x6063, 0x0000,
0x0000, 0x607e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x383d, 0x0000,
};
static unsigned short const unicode_to_jisx0208_74[] = {
/* 0x7400 - 0x74ff */
0x0000, 0x0000, 0x0000, 0x3565, 0x0000, 0x6066, 0x4d7d, 0x0000,
0x0000, 0x4e30, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4276, 0x0000, 0x0000, 0x6068, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x606a, 0x4e56, 0x3657, 0x487c, 0x474a, 0x0000,
0x0000, 0x0000, 0x606b, 0x0000, 0x0000, 0x0000, 0x0000, 0x606d,
0x0000, 0x6070, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x606c, 0x0000, 0x0000,
0x0000, 0x606f, 0x386a, 0x314d, 0x6071, 0x0000, 0x3f70, 0x606e,
0x4e5c, 0x0000, 0x0000, 0x6074, 0x7424, 0x0000, 0x0000, 0x0000,
0x0000, 0x6072, 0x6075, 0x0000, 0x0000, 0x0000, 0x0000, 0x6067,
0x6073, 0x0000, 0x0000, 0x3a3c, 0x0000, 0x0000, 0x6076, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6077, 0x0000,
0x0000, 0x0000, 0x0000, 0x4d7e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6078, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6079, 0x0000,
0x0000, 0x0000, 0x6065, 0x0000, 0x0000, 0x0000, 0x0000, 0x607a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3444, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c25, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x607b, 0x0000, 0x0000, 0x0000, 0x0000, 0x607c,
0x0000, 0x0000, 0x0000, 0x0000, 0x607d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x313b, 0x0000, 0x0000, 0x0000,
0x6121, 0x0000, 0x493b, 0x6122, 0x0000, 0x0000, 0x3424, 0x6123,
0x0000, 0x6124, 0x0000, 0x0000, 0x0000, 0x0000, 0x6125, 0x0000,
0x6127, 0x6128, 0x6126, 0x0000, 0x0000, 0x0000, 0x4953, 0x612a,
0x6129, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_75[] = {
/* 0x7500 - 0x75ff */
0x0000, 0x0000, 0x0000, 0x612c, 0x612b, 0x612d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x612e, 0x6130, 0x612f, 0x0000,
0x0000, 0x3979, 0x0000, 0x6132, 0x0000, 0x6131, 0x0000, 0x0000,
0x3445, 0x0000, 0x3f53, 0x0000, 0x453c, 0x0000, 0x6133, 0x4038,
0x0000, 0x0000, 0x0000, 0x3b3a, 0x0000, 0x3179, 0x6134, 0x0000,
0x4d51, 0x0000, 0x0000, 0x4a63, 0x6135, 0x0000, 0x0000, 0x0000,
0x4544, 0x4d33, 0x3943, 0x3f3d, 0x0000, 0x0000, 0x0000, 0x434b,
0x5234, 0x0000, 0x442e, 0x3268, 0x6136, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6137, 0x0000, 0x613c, 0x0000,
0x0000, 0x613a, 0x6139, 0x5a42, 0x3326, 0x6138, 0x0000, 0x305a,
0x0000, 0x482a, 0x0000, 0x0000, 0x484a, 0x0000, 0x0000, 0x0000,
0x0000, 0x4e31, 0x613d, 0x613b, 0x435c, 0x4026, 0x0000, 0x0000,
0x482b, 0x0000, 0x492d, 0x0000, 0x613f, 0x4e2c, 0x374d, 0x6140,
0x0000, 0x613e, 0x4856, 0x6141, 0x0000, 0x6142, 0x0000, 0x0000,
0x305b, 0x0000, 0x0000, 0x3e76, 0x6147, 0x0000, 0x6144, 0x466d,
0x6143, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3526,
0x0000, 0x0000, 0x614a, 0x0000, 0x0000, 0x0000, 0x6145, 0x6146,
0x0000, 0x6149, 0x6148, 0x4925, 0x0000, 0x0000, 0x4142, 0x4141,
0x0000, 0x353f, 0x0000, 0x0000, 0x614b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x614c, 0x0000, 0x0000, 0x614d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x614f, 0x0000, 0x614e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3156, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6157, 0x4868, 0x6151, 0x0000, 0x6153, 0x0000, 0x0000,
0x6155, 0x3f3e, 0x0000, 0x0000, 0x6156, 0x6154, 0x3c40, 0x0000,
0x0000, 0x0000, 0x6150, 0x6152, 0x0000, 0x4942, 0x0000, 0x3e49,
0x0000, 0x0000, 0x6159, 0x0000, 0x0000, 0x6158, 0x0000, 0x0000,
0x0000, 0x0000, 0x615a, 0x0000, 0x3c26, 0x3a2f, 0x0000, 0x0000,
0x4577, 0x615b, 0x0000, 0x444b, 0x0000, 0x0000, 0x615d, 0x0000,
0x0000, 0x0000, 0x4e21, 0x615c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4169, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6162, 0x0000, 0x6164, 0x6165, 0x4354, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6163, 0x0000, 0x6160, 0x0000, 0x615e, 0x615f,
};
static unsigned short const unicode_to_jisx0208_76[] = {
/* 0x7600 - 0x76ff */
0x0000, 0x6161, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6168, 0x0000, 0x6166, 0x0000, 0x6167, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6169,
0x616b, 0x616c, 0x616d, 0x0000, 0x616e, 0x0000, 0x0000, 0x616a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6170, 0x0000, 0x0000, 0x0000, 0x616f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6171, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4e45, 0x0000, 0x0000, 0x0000, 0x6174, 0x6172,
0x6173, 0x0000, 0x0000, 0x0000, 0x3462, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c7e, 0x0000, 0x0000, 0x0000, 0x4a4a, 0x0000,
0x6176, 0x0000, 0x0000, 0x0000, 0x6175, 0x0000, 0x0000, 0x0000,
0x0000, 0x6177, 0x6178, 0x0000, 0x0000, 0x0000, 0x0000, 0x617c,
0x6179, 0x617a, 0x617b, 0x0000, 0x617d, 0x0000, 0x0000, 0x0000,
0x617e, 0x0000, 0x6221, 0x0000, 0x0000, 0x0000, 0x6222, 0x0000,
0x6223, 0x0000, 0x482f, 0x4550, 0x6224, 0x4772, 0x4934, 0x0000,
0x6225, 0x0000, 0x0000, 0x6226, 0x452a, 0x0000, 0x3327, 0x3944,
0x6227, 0x0000, 0x0000, 0x6228, 0x0000, 0x0000, 0x6229, 0x0000,
0x3b29, 0x0000, 0x0000, 0x622b, 0x0000, 0x0000, 0x622a, 0x0000,
0x0000, 0x622c, 0x622d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4869, 0x0000,
0x622e, 0x0000, 0x0000, 0x0000, 0x622f, 0x0000, 0x0000, 0x7369,
0x6230, 0x6231, 0x6232, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b2e,
0x0000, 0x0000, 0x6233, 0x4756, 0x0000, 0x0000, 0x4b5f, 0x0000,
0x314e, 0x0000, 0x3157, 0x0000, 0x0000, 0x6234, 0x0000, 0x0000,
0x0000, 0x0000, 0x6236, 0x0000, 0x0000, 0x0000, 0x6235, 0x4570,
0x0000, 0x0000, 0x0000, 0x4039, 0x5d39, 0x0000, 0x6237, 0x4c41,
0x0000, 0x6238, 0x0000, 0x3446, 0x4857, 0x6239, 0x0000, 0x623a,
0x0000, 0x0000, 0x623b, 0x0000, 0x0000, 0x0000, 0x4c5c, 0x0000,
0x0000, 0x0000, 0x4c55, 0x0000, 0x443e, 0x0000, 0x0000, 0x0000,
0x416a, 0x0000, 0x0000, 0x623d, 0x0000, 0x0000, 0x3d62, 0x0000,
};
static unsigned short const unicode_to_jisx0208_77[] = {
/* 0x7700 - 0x77ff */
0x0000, 0x3e4a, 0x0000, 0x0000, 0x6240, 0x0000, 0x0000, 0x623f,
0x623e, 0x487d, 0x0000, 0x3447, 0x3829, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6246, 0x0000, 0x0000, 0x6243, 0x3f3f,
0x4c32, 0x0000, 0x0000, 0x0000, 0x6242, 0x6244, 0x6245, 0x0000,
0x0000, 0x6241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6247,
0x6248, 0x0000, 0x442f, 0x0000, 0x3463, 0x0000, 0x0000, 0x0000,
0x4365, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6249,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x624a, 0x624d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f67, 0x0000, 0x4644, 0x0000, 0x624e, 0x4b53, 0x0000,
0x624b, 0x0000, 0x0000, 0x624c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6251, 0x0000, 0x0000, 0x0000, 0x0000, 0x6250, 0x624f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6253, 0x0000, 0x0000, 0x6252, 0x0000,
0x0000, 0x6254, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6256, 0x0000,
0x6255, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a4d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d56, 0x4e46, 0x0000, 0x0000,
0x6257, 0x0000, 0x0000, 0x4637, 0x0000, 0x0000, 0x6258, 0x0000,
0x0000, 0x6259, 0x0000, 0x625d, 0x625b, 0x625c, 0x0000, 0x625a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x625e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x625f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6260,
0x0000, 0x0000, 0x6261, 0x4c37, 0x6262, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c70, 0x6263, 0x0000, 0x434e, 0x0000, 0x476a,
0x0000, 0x366b, 0x0000, 0x0000, 0x0000, 0x433b, 0x6264, 0x363a,
0x0000, 0x0000, 0x0000, 0x4050, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6265, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_78[] = {
/* 0x7800 - 0x78ff */
0x0000, 0x0000, 0x3a3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6266, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6267, 0x0000, 0x3826, 0x3a55, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6269, 0x0000, 0x0000, 0x0000, 0x0000, 0x4556, 0x3a56, 0x354e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b24, 0x0000, 0x474b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4557, 0x0000, 0x0000, 0x0000, 0x0000, 0x395c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x626b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e4b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4e32, 0x3945, 0x0000, 0x0000, 0x3827,
0x0000, 0x0000, 0x4823, 0x0000, 0x626d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x626f, 0x0000, 0x0000, 0x0000,
0x0000, 0x386b, 0x0000, 0x0000, 0x0000, 0x0000, 0x626e, 0x4476,
0x0000, 0x0000, 0x0000, 0x0000, 0x6271, 0x3337, 0x626c, 0x0000,
0x0000, 0x486a, 0x0000, 0x3130, 0x0000, 0x3a6c, 0x0000, 0x4f52,
0x0000, 0x0000, 0x6270, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6272, 0x0000, 0x0000, 0x0000, 0x4a4b,
0x0000, 0x4059, 0x6274, 0x0000, 0x0000, 0x0000, 0x0000, 0x6275,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6273, 0x0000, 0x0000,
0x0000, 0x0000, 0x334e, 0x0000, 0x627b, 0x0000, 0x627a, 0x0000,
0x0000, 0x3c27, 0x0000, 0x0000, 0x0000, 0x627c, 0x6277, 0x0000,
0x0000, 0x0000, 0x627d, 0x6278, 0x0000, 0x0000, 0x0000, 0x0000,
0x4858, 0x6276, 0x0000, 0x0000, 0x6279, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6322, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6321,
0x4b61, 0x0000, 0x0000, 0x0000, 0x627e, 0x0000, 0x0000, 0x306b,
0x0000, 0x0000, 0x0000, 0x0000, 0x6324, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6323, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_79[] = {
/* 0x7900 - 0x79ff */
0x0000, 0x3e4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6325,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4143, 0x0000,
0x0000, 0x6327, 0x6326, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6328, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6268, 0x0000,
0x0000, 0x0000, 0x626a, 0x632a, 0x6329, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3c28, 0x0000, 0x4e69, 0x0000, 0x3c52, 0x0000,
0x632b, 0x3737, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3540,
0x3527, 0x3b63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4d34, 0x0000, 0x0000, 0x6331, 0x0000, 0x6330, 0x4144, 0x632d,
0x0000, 0x0000, 0x632f, 0x0000, 0x0000, 0x3d4b, 0x3f40, 0x632e,
0x632c, 0x0000, 0x472a, 0x0000, 0x0000, 0x3e4d, 0x0000, 0x0000,
0x493c, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a57, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4578,
0x0000, 0x0000, 0x6332, 0x0000, 0x0000, 0x0000, 0x0000, 0x6333,
0x6349, 0x3658, 0x0000, 0x0000, 0x4f3d, 0x4135, 0x0000, 0x0000,
0x0000, 0x0000, 0x6334, 0x0000, 0x0000, 0x3252, 0x4477, 0x4a21,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6335, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x357a, 0x6336,
0x0000, 0x0000, 0x6338, 0x0000, 0x0000, 0x0000, 0x6339, 0x0000,
0x4729, 0x0000, 0x0000, 0x633a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x633b, 0x633c, 0x0000, 0x0000, 0x3659, 0x3253, 0x4645,
0x3d28, 0x3b64, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x633d, 0x0000, 0x3d29, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x324a, 0x4943, 0x0000, 0x0000, 0x633e, 0x0000, 0x0000,
0x486b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4145,
0x0000, 0x6341, 0x0000, 0x6342, 0x4769, 0x0000, 0x3f41, 0x633f,
0x0000, 0x4361, 0x0000, 0x0000, 0x6340, 0x0000, 0x0000, 0x0000,
0x3e4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x305c, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_7a[] = {
/* 0x7a00 - 0x7aff */
0x3529, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6343, 0x0000, 0x0000, 0x4478, 0x0000, 0x6344, 0x4047, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4c2d, 0x0000, 0x0000, 0x4923,
0x6345, 0x6346, 0x4355, 0x0000, 0x4e47, 0x0000, 0x0000, 0x6348,
0x6347, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c6f, 0x0000,
0x0000, 0x634a, 0x3070, 0x0000, 0x0000, 0x0000, 0x0000, 0x634d,
0x0000, 0x0000, 0x0000, 0x634b, 0x3254, 0x374e, 0x634c, 0x3946,
0x3972, 0x0000, 0x4a66, 0x634e, 0x0000, 0x0000, 0x4b54, 0x0000,
0x0000, 0x6350, 0x0000, 0x0000, 0x0000, 0x4051, 0x314f, 0x323a,
0x302c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x634f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6351, 0x6352, 0x3e77, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6353, 0x0000, 0x334f, 0x0000, 0x0000, 0x0000, 0x0000,
0x6355, 0x0000, 0x0000, 0x0000, 0x376a, 0x0000, 0x3566, 0x0000,
0x0000, 0x6356, 0x3675, 0x0000, 0x0000, 0x6357, 0x0000, 0x407c,
0x0000, 0x464d, 0x0000, 0x4060, 0x3a75, 0x0000, 0x0000, 0x0000,
0x6358, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4362, 0x416b, 0x0000, 0x635a, 0x635c, 0x6359,
0x635b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3722,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x635d, 0x3726, 0x0000, 0x0000, 0x0000, 0x3567, 0x4d52,
0x635f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6360, 0x0000,
0x0000, 0x0000, 0x312e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6363,
0x0000, 0x0000, 0x0000, 0x3376, 0x6362, 0x6361, 0x0000, 0x6365,
0x635e, 0x0000, 0x6366, 0x4e29, 0x0000, 0x6367, 0x0000, 0x6368,
0x0000, 0x0000, 0x5474, 0x636a, 0x0000, 0x6369, 0x0000, 0x0000,
0x0000, 0x636b, 0x636c, 0x0000, 0x4e35, 0x636d, 0x0000, 0x706f,
0x3e4f, 0x636e, 0x636f, 0x3d57, 0x0000, 0x4638, 0x6370, 0x0000,
0x0000, 0x0000, 0x4328, 0x0000, 0x0000, 0x6371, 0x0000, 0x433c,
0x6372, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3625, 0x0000,
0x513f, 0x435d, 0x3c33, 0x0000, 0x0000, 0x0000, 0x0000, 0x3448,
};
static unsigned short const unicode_to_jisx0208_7b[] = {
/* 0x7b00 - 0x7bff */
0x0000, 0x0000, 0x6373, 0x0000, 0x6422, 0x0000, 0x6376, 0x0000,
0x3568, 0x0000, 0x6375, 0x6424, 0x0000, 0x0000, 0x0000, 0x6374,
0x0000, 0x3e50, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6378, 0x6379, 0x0000, 0x452b, 0x0000, 0x0000, 0x637a, 0x0000,
0x335e, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f5a, 0x4964, 0x0000,
0x637c, 0x0000, 0x0000, 0x0000, 0x4268, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6377, 0x0000, 0x637b, 0x637d, 0x0000,
0x0000, 0x3a7b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6426, 0x492e, 0x0000,
0x4826, 0x4579, 0x0000, 0x365a, 0x6425, 0x6423, 0x0000, 0x4835,
0x637e, 0x435e, 0x457b, 0x0000, 0x457a, 0x0000, 0x3a76, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6438, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6428, 0x0000, 0x642a,
0x0000, 0x0000, 0x0000, 0x0000, 0x642d, 0x0000, 0x642e, 0x0000,
0x642b, 0x642c, 0x0000, 0x0000, 0x6429, 0x6427, 0x0000, 0x0000,
0x0000, 0x0000, 0x6421, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a4f, 0x3255,
0x0000, 0x0000, 0x0000, 0x6435, 0x0000, 0x6432, 0x0000, 0x6437,
0x0000, 0x0000, 0x6436, 0x0000, 0x4773, 0x4c27, 0x0000, 0x3b3b,
0x6430, 0x6439, 0x6434, 0x0000, 0x6433, 0x642f, 0x0000, 0x6431,
0x0000, 0x3449, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x433d, 0x0000, 0x0000, 0x407d, 0x0000, 0x0000,
0x0000, 0x4822, 0x0000, 0x0000, 0x643e, 0x0000, 0x0000, 0x0000,
0x4824, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4061, 0x643b, 0x0000, 0x0000, 0x484f, 0x0000, 0x643f, 0x4a53,
0x0000, 0x435b, 0x0000, 0x643a, 0x643c, 0x0000, 0x0000, 0x643d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6440, 0x0000, 0x0000,
0x3c44, 0x0000, 0x0000, 0x0000, 0x4646, 0x6445, 0x6444, 0x0000,
0x0000, 0x6441, 0x0000, 0x0000, 0x0000, 0x4f36, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x644a, 0x0000, 0x0000, 0x644e, 0x644b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_7c[] = {
/* 0x7c00 - 0x7cff */
0x6447, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6448,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x644d, 0x0000, 0x0000,
0x0000, 0x6442, 0x5255, 0x6449, 0x6443, 0x0000, 0x0000, 0x644c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6452,
0x0000, 0x344a, 0x0000, 0x644f, 0x0000, 0x0000, 0x0000, 0x6450,
0x0000, 0x0000, 0x6451, 0x6454, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6453,
0x4876, 0x0000, 0x0000, 0x0000, 0x0000, 0x6455, 0x4e7c, 0x4a6d,
0x645a, 0x0000, 0x0000, 0x6457, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6456, 0x4052, 0x0000, 0x6459,
0x645b, 0x0000, 0x0000, 0x0000, 0x6458, 0x0000, 0x645f, 0x0000,
0x645c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x645d,
0x6446, 0x0000, 0x0000, 0x0000, 0x645e, 0x6460, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6461, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a46, 0x0000, 0x6462, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c62, 0x0000,
0x0000, 0x364e, 0x3729, 0x6463, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a34, 0x0000, 0x3f68, 0x0000, 0x4c30, 0x0000, 0x0000,
0x6464, 0x0000, 0x4e33, 0x0000, 0x0000, 0x4774, 0x0000, 0x4146,
0x4734, 0x0000, 0x0000, 0x3d4d, 0x0000, 0x0000, 0x0000, 0x3040,
0x0000, 0x6469, 0x6467, 0x0000, 0x6465, 0x3421, 0x0000, 0x3e51,
0x646a, 0x0000, 0x0000, 0x6468, 0x0000, 0x6466, 0x646e, 0x0000,
0x0000, 0x646d, 0x646c, 0x646b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x646f, 0x0000, 0x0000, 0x0000, 0x6470, 0x403a, 0x0000,
0x6471, 0x0000, 0x6473, 0x0000, 0x0000, 0x6472, 0x0000, 0x0000,
0x0000, 0x0000, 0x3852, 0x0000, 0x0000, 0x0000, 0x4138, 0x0000,
0x0000, 0x0000, 0x6475, 0x0000, 0x0000, 0x0000, 0x457c, 0x0000,
0x6474, 0x0000, 0x0000, 0x0000, 0x6476, 0x0000, 0x4a35, 0x416c,
0x3947, 0x0000, 0x6477, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e48,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6479,
0x0000, 0x0000, 0x647a, 0x0000, 0x647b, 0x0000, 0x647c, 0x0000,
0x3b65, 0x0000, 0x647d, 0x374f, 0x0000, 0x0000, 0x356a, 0x0000,
};
static unsigned short const unicode_to_jisx0208_7d[] = {
/* 0x7d00 - 0x7dff */
0x352a, 0x0000, 0x6521, 0x0000, 0x4c73, 0x3948, 0x647e, 0x0000,
0x0000, 0x0000, 0x6524, 0x4c66, 0x0000, 0x473c, 0x0000, 0x0000,
0x4933, 0x0000, 0x0000, 0x0000, 0x3d63, 0x6523, 0x0000, 0x3c53,
0x3949, 0x3b66, 0x3569, 0x4a36, 0x6522, 0x0000, 0x0000, 0x0000,
0x4147, 0x4b42, 0x3a77, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b67, 0x445d, 0x0000, 0x6527, 0x4e5f,
0x3a59, 0x0000, 0x6528, 0x3f42, 0x0000, 0x652a, 0x0000, 0x0000,
0x0000, 0x3e52, 0x3a30, 0x0000, 0x0000, 0x0000, 0x0000, 0x6529,
0x0000, 0x0000, 0x3d2a, 0x383e, 0x4148, 0x6525, 0x652b, 0x0000,
0x0000, 0x0000, 0x0000, 0x6526, 0x3750, 0x0000, 0x652e, 0x6532,
0x376b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x652d, 0x0000,
0x0000, 0x0000, 0x0000, 0x6536, 0x0000, 0x0000, 0x394a, 0x0000,
0x0000, 0x4d6d, 0x303c, 0x6533, 0x0000, 0x0000, 0x356b, 0x0000,
0x6530, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6531, 0x0000,
0x0000, 0x457d, 0x652f, 0x652c, 0x0000, 0x3328, 0x4064, 0x0000,
0x0000, 0x3828, 0x0000, 0x0000, 0x0000, 0x6538, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6535, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6537,
0x0000, 0x0000, 0x0000, 0x6534, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3751, 0x4233, 0x6539, 0x416e, 0x0000, 0x0000, 0x6546,
0x0000, 0x0000, 0x6542, 0x653c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6540, 0x3c7a, 0x305d, 0x653b, 0x6543,
0x6547, 0x394b, 0x4c56, 0x0000, 0x4456, 0x653d, 0x0000, 0x0000,
0x6545, 0x0000, 0x653a, 0x433e, 0x0000, 0x653f, 0x303d, 0x4c4a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x653e,
0x0000, 0x0000, 0x365b, 0x486c, 0x0000, 0x0000, 0x0000, 0x416d,
0x0000, 0x4e50, 0x3d6f, 0x0000, 0x0000, 0x656e, 0x0000, 0x0000,
0x6548, 0x0000, 0x407e, 0x0000, 0x6544, 0x6549, 0x654b, 0x0000,
0x4479, 0x654e, 0x0000, 0x0000, 0x654a, 0x0000, 0x0000, 0x0000,
0x4a54, 0x344b, 0x0000, 0x0000, 0x4c4b, 0x0000, 0x0000, 0x305e,
0x0000, 0x0000, 0x654d, 0x0000, 0x4e7d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x654c, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_7e[] = {
/* 0x7e00 - 0x7eff */
0x0000, 0x316f, 0x0000, 0x0000, 0x466c, 0x654f, 0x0000, 0x0000,
0x0000, 0x6556, 0x6550, 0x6557, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6553, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x477b, 0x0000, 0x0000, 0x3c4a, 0x6555,
0x0000, 0x6552, 0x6558, 0x6551, 0x0000, 0x0000, 0x3d44, 0x0000,
0x0000, 0x0000, 0x0000, 0x4b25, 0x0000, 0x0000, 0x3d4c, 0x0000,
0x0000, 0x6554, 0x6560, 0x0000, 0x0000, 0x655c, 0x0000, 0x655f,
0x0000, 0x655d, 0x6561, 0x655b, 0x0000, 0x6541, 0x4053, 0x0000,
0x0000, 0x484b, 0x0000, 0x655e, 0x0000, 0x0000, 0x6559, 0x0000,
0x0000, 0x0000, 0x4121, 0x3752, 0x0000, 0x3d2b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f25, 0x4136, 0x6564, 0x0000,
0x0000, 0x6566, 0x6567, 0x0000, 0x0000, 0x6563, 0x6565, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x655a, 0x6562,
0x0000, 0x656a, 0x6569, 0x0000, 0x0000, 0x4b7a, 0x0000, 0x0000,
0x372b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6568, 0x0000, 0x656c, 0x656b, 0x656f, 0x0000, 0x6571,
0x0000, 0x0000, 0x3b3c, 0x656d, 0x0000, 0x0000, 0x0000, 0x0000,
0x6572, 0x6573, 0x0000, 0x0000, 0x6574, 0x0000, 0x657a, 0x453b,
0x6576, 0x0000, 0x6575, 0x6577, 0x6578, 0x0000, 0x6579, 0x0000,
0x0000, 0x0000, 0x0000, 0x657b, 0x657c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_7f[] = {
/* 0x7f00 - 0x7fff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x344c, 0x0000,
0x657d, 0x0000, 0x657e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6621, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6622, 0x6623, 0x6624, 0x0000,
0x6625, 0x6626, 0x0000, 0x0000, 0x6628, 0x6627, 0x0000, 0x0000,
0x6629, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x662a,
0x662b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x662e,
0x662c, 0x662d, 0x3a61, 0x3753, 0x0000, 0x0000, 0x4356, 0x0000,
0x4833, 0x0000, 0x3d70, 0x0000, 0x0000, 0x474d, 0x0000, 0x486d,
0x662f, 0x586d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6630, 0x6632, 0x0000, 0x4d65, 0x6631, 0x6634,
0x6633, 0x0000, 0x4d53, 0x0000, 0x6635, 0x0000, 0x487e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6636, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6639, 0x0000, 0x0000, 0x6638, 0x6637, 0x0000,
0x0000, 0x0000, 0x0000, 0x663a, 0x3732, 0x0000, 0x0000, 0x0000,
0x4122, 0x3541, 0x0000, 0x0000, 0x0000, 0x0000, 0x663e, 0x663b,
0x0000, 0x0000, 0x663c, 0x0000, 0x0000, 0x0000, 0x663f, 0x0000,
0x6640, 0x663d, 0x0000, 0x0000, 0x0000, 0x3129, 0x0000, 0x0000,
0x0000, 0x3227, 0x0000, 0x0000, 0x0000, 0x6642, 0x6643, 0x0000,
0x0000, 0x0000, 0x6644, 0x0000, 0x4d62, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3d2c, 0x0000, 0x6646, 0x6645, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3f69, 0x6647, 0x0000, 0x0000, 0x0000, 0x0000, 0x6648, 0x0000,
0x0000, 0x6649, 0x0000, 0x3465, 0x0000, 0x0000, 0x0000, 0x0000,
0x344d, 0x0000, 0x0000, 0x664a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x664b, 0x0000, 0x4b5d, 0x4d63, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_80[] = {
/* 0x8000 - 0x80ff */
0x4d54, 0x4f37, 0x0000, 0x394d, 0x664e, 0x3c54, 0x664d, 0x0000,
0x0000, 0x0000, 0x0000, 0x664f, 0x3c29, 0x0000, 0x0000, 0x0000,
0x4251, 0x0000, 0x6650, 0x0000, 0x0000, 0x394c, 0x0000, 0x4c57,
0x6651, 0x6652, 0x0000, 0x0000, 0x6653, 0x0000, 0x0000, 0x0000,
0x0000, 0x6654, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6655, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c2a, 0x0000, 0x0000, 0x4c6d, 0x0000,
0x0000, 0x0000, 0x0000, 0x6657, 0x0000, 0x433f, 0x0000, 0x6656,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6659, 0x0000,
0x0000, 0x0000, 0x6658, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x665a, 0x0000, 0x0000, 0x0000, 0x403b, 0x0000,
0x665b, 0x0000, 0x665c, 0x0000, 0x0000, 0x0000, 0x4a39, 0x665d,
0x0000, 0x416f, 0x665e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x665f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e7e,
0x6662, 0x0000, 0x6661, 0x6660, 0x4430, 0x0000, 0x6663, 0x3f26,
0x0000, 0x6664, 0x0000, 0x0000, 0x0000, 0x6665, 0x4f38, 0x6666,
0x0000, 0x0000, 0x0000, 0x0000, 0x6667, 0x6669, 0x6668, 0x4825,
0x0000, 0x4679, 0x0000, 0x4f3e, 0x4829, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x666b, 0x0000, 0x0000, 0x3e53, 0x0000,
0x492a, 0x0000, 0x666c, 0x666a, 0x0000, 0x344e, 0x0000, 0x0000,
0x0000, 0x3854, 0x3b68, 0x0000, 0x0000, 0x486e, 0x0000, 0x0000,
0x0000, 0x382a, 0x4b43, 0x0000, 0x666f, 0x666d, 0x0000, 0x394e,
0x0000, 0x394f, 0x3069, 0x0000, 0x3a68, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4759, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x305f, 0x6674, 0x0000, 0x4340, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4758, 0x0000, 0x425b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6676, 0x0000,
0x0000, 0x6672, 0x6675, 0x6670, 0x0000, 0x6673, 0x4b26, 0x0000,
0x0000, 0x3855, 0x0000, 0x0000, 0x307d, 0x6671, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6678,
0x0000, 0x6679, 0x0000, 0x0000, 0x4639, 0x0000, 0x0000, 0x0000,
0x363b, 0x0000, 0x0000, 0x0000, 0x6726, 0x473d, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_81[] = {
/* 0x8100 - 0x81ff */
0x0000, 0x0000, 0x3b69, 0x0000, 0x0000, 0x363c, 0x4048, 0x4f46,
0x4c2e, 0x6677, 0x4054, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3553, 0x667a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x667c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x667b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x667d,
0x0000, 0x4326, 0x0000, 0x473e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4431, 0x0000, 0x0000, 0x0000, 0x0000, 0x6723, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6722, 0x0000,
0x0000, 0x0000, 0x0000, 0x667e, 0x0000, 0x0000, 0x3f55, 0x0000,
0x4965, 0x6725, 0x0000, 0x6724, 0x3950, 0x4f53, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6735,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6729, 0x672a, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c70, 0x0000, 0x0000, 0x6728, 0x0000,
0x3978, 0x6727, 0x0000, 0x0000, 0x672b, 0x0000, 0x0000, 0x0000,
0x4432, 0x4a22, 0x4123, 0x0000, 0x0000, 0x0000, 0x0000, 0x425c,
0x672f, 0x0000, 0x6730, 0x672c, 0x0000, 0x0000, 0x0000, 0x0000,
0x672d, 0x0000, 0x672e, 0x0000, 0x0000, 0x0000, 0x0000, 0x3951,
0x0000, 0x0000, 0x0000, 0x6736, 0x0000, 0x6732, 0x0000, 0x0000,
0x0000, 0x0000, 0x4966, 0x0000, 0x4b6c, 0x4928, 0x0000, 0x0000,
0x6731, 0x0000, 0x0000, 0x6734, 0x6733, 0x0000, 0x0000, 0x0000,
0x4b44, 0x6737, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6738, 0x0000, 0x0000, 0x4137, 0x0000, 0x6739, 0x0000, 0x0000,
0x673b, 0x0000, 0x673f, 0x0000, 0x0000, 0x673c, 0x673a, 0x473f,
0x673d, 0x0000, 0x673e, 0x0000, 0x0000, 0x0000, 0x3232, 0x0000,
0x6745, 0x6740, 0x0000, 0x0000, 0x0000, 0x6741, 0x0000, 0x0000,
0x0000, 0x6742, 0x0000, 0x4221, 0x0000, 0x0000, 0x0000, 0x0000,
0x6744, 0x6743, 0x6746, 0x0000, 0x0000, 0x0000, 0x0000, 0x6747,
0x6748, 0x0000, 0x0000, 0x3f43, 0x0000, 0x3269, 0x0000, 0x6749,
0x4e57, 0x0000, 0x3c2b, 0x0000, 0x0000, 0x3d2d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b6a, 0x4357, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x674a, 0x674b, 0x3131, 0x0000, 0x674c, 0x0000,
};
static unsigned short const unicode_to_jisx0208_82[] = {
/* 0x8200 - 0x82ff */
0x0000, 0x674d, 0x674e, 0x0000, 0x0000, 0x674f, 0x0000, 0x6750,
0x363d, 0x5a2a, 0x6751, 0x0000, 0x4065, 0x6752, 0x3c4b, 0x0000,
0x6753, 0x0000, 0x5030, 0x0000, 0x0000, 0x0000, 0x6754, 0x4a5e,
0x345c, 0x0000, 0x0000, 0x4124, 0x3d58, 0x0000, 0x4971, 0x3d2e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6755, 0x3952, 0x6756, 0x484c, 0x0000, 0x6764, 0x0000,
0x0000, 0x0000, 0x0000, 0x6758, 0x0000, 0x4249, 0x4775, 0x383f,
0x6757, 0x4125, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6759, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x447a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x675b, 0x675a, 0x675d, 0x0000, 0x0000, 0x675c, 0x0000, 0x675e,
0x0000, 0x0000, 0x6760, 0x0000, 0x675f, 0x0000, 0x344f, 0x0000,
0x6761, 0x0000, 0x6762, 0x6763, 0x0000, 0x0000, 0x3a31, 0x4e49,
0x0000, 0x6765, 0x3f27, 0x0000, 0x0000, 0x0000, 0x3170, 0x6766,
0x6767, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6768, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3072, 0x0000, 0x6769, 0x0000, 0x0000,
0x0000, 0x0000, 0x676a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4967, 0x0000, 0x0000, 0x0000, 0x3c47, 0x0000, 0x676c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3329, 0x3032, 0x0000,
0x0000, 0x0000, 0x0000, 0x676b, 0x676e, 0x474e, 0x0000, 0x3f44,
0x0000, 0x3256, 0x0000, 0x4b27, 0x0000, 0x0000, 0x0000, 0x0000,
0x375d, 0x365c, 0x0000, 0x676d, 0x0000, 0x326a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3423, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3171, 0x6772, 0x4e6a, 0x425d, 0x0000, 0x0000, 0x4944,
0x0000, 0x677e, 0x0000, 0x3257, 0x677c, 0x0000, 0x677a, 0x6771,
0x0000, 0x676f, 0x0000, 0x6770, 0x0000, 0x3c63, 0x366c, 0x4377,
0x0000, 0x0000, 0x0000, 0x4651, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3151, 0x0000, 0x6774, 0x6773, 0x0000, 0x0000, 0x0000,
0x0000, 0x6779, 0x6775, 0x6778, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_83[] = {
/* 0x8300 - 0x83ff */
0x0000, 0x0000, 0x4c50, 0x6777, 0x3258, 0x337d, 0x677b, 0x0000,
0x0000, 0x677d, 0x0000, 0x0000, 0x0000, 0x0000, 0x3754, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6823, 0x682c,
0x682d, 0x0000, 0x0000, 0x0000, 0x302b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6834, 0x0000, 0x0000, 0x0000, 0x0000,
0x3071, 0x0000, 0x0000, 0x682b, 0x0000, 0x0000, 0x0000, 0x682a,
0x0000, 0x6825, 0x6824, 0x0000, 0x6822, 0x6821, 0x4363, 0x0000,
0x427b, 0x6827, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6826, 0x0000, 0x0000, 0x0000, 0x0000, 0x6829, 0x0000, 0x0000,
0x0000, 0x4170, 0x3755, 0x0000, 0x0000, 0x0000, 0x0000, 0x3141,
0x6828, 0x0000, 0x3953, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4171, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x683a, 0x0000, 0x683b, 0x0000, 0x3259,
0x0000, 0x0000, 0x0000, 0x322e, 0x6838, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x682e, 0x0000, 0x6836,
0x0000, 0x683d, 0x6837, 0x0000, 0x0000, 0x0000, 0x6835, 0x0000,
0x0000, 0x0000, 0x0000, 0x6776, 0x0000, 0x0000, 0x6833, 0x0000,
0x0000, 0x0000, 0x682f, 0x0000, 0x0000, 0x0000, 0x3450, 0x6831,
0x683c, 0x0000, 0x6832, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x683e, 0x0000, 0x6830, 0x477c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d69, 0x0000, 0x0000, 0x0000, 0x6839, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x684f, 0x0000, 0x0000,
0x0000, 0x6847, 0x0000, 0x0000, 0x0000, 0x3f7b, 0x0000, 0x0000,
0x0000, 0x0000, 0x3546, 0x0000, 0x365d, 0x0000, 0x6842, 0x0000,
0x0000, 0x0000, 0x0000, 0x325b, 0x0000, 0x0000, 0x3e54, 0x0000,
0x6845, 0x0000, 0x0000, 0x0000, 0x3a5a, 0x0000, 0x0000, 0x4551,
0x684a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a6e, 0x0000, 0x6841, 0x0000, 0x0000, 0x0000, 0x325a,
0x3856, 0x4929, 0x684b, 0x0000, 0x683f, 0x0000, 0x0000, 0x6848,
0x0000, 0x0000, 0x0000, 0x6852, 0x0000, 0x6843, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_84[] = {
/* 0x8400 - 0x84ff */
0x0000, 0x0000, 0x0000, 0x6844, 0x463a, 0x0000, 0x0000, 0x6849,
0x0000, 0x0000, 0x0000, 0x6846, 0x4b28, 0x684c, 0x3060, 0x0000,
0x0000, 0x0000, 0x0000, 0x6840, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x684e, 0x0000, 0x684d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x476b, 0x6854, 0x0000, 0x685f, 0x0000, 0x0000, 0x0000,
0x0000, 0x337e, 0x0000, 0x0000, 0x0000, 0x6862, 0x0000, 0x0000,
0x6850, 0x0000, 0x0000, 0x0000, 0x6855, 0x4d6e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x685e, 0x0000,
0x0000, 0x4d55, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e2a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4378,
0x0000, 0x0000, 0x0000, 0x336b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4972, 0x6864, 0x4621, 0x0000, 0x0000, 0x3031, 0x0000,
0x0000, 0x685d, 0x0000, 0x6859, 0x4172, 0x6853, 0x685b, 0x6860,
0x0000, 0x472c, 0x0000, 0x0000, 0x0000, 0x302a, 0x0000, 0x6858,
0x0000, 0x6861, 0x4978, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x685c, 0x0000, 0x6857, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3e55, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d2f, 0x0000, 0x0000, 0x0000, 0x3c2c, 0x0000, 0x0000, 0x0000,
0x0000, 0x4c58, 0x0000, 0x0000, 0x4947, 0x0000, 0x0000, 0x6867,
0x0000, 0x6870, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x685a, 0x0000, 0x0000,
0x0000, 0x0000, 0x3377, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e78, 0x6865, 0x0000, 0x686a, 0x4173, 0x0000, 0x0000, 0x6866,
0x0000, 0x686d, 0x0000, 0x0000, 0x435f, 0x0000, 0x686e, 0x0000,
0x0000, 0x4d56, 0x6863, 0x3338, 0x0000, 0x6869, 0x0000, 0x0000,
0x686c, 0x4c2c, 0x0000, 0x0000, 0x0000, 0x0000, 0x686f, 0x0000,
0x0000, 0x6868, 0x686b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b29, 0x0000, 0x4f21, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6873, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x687a, 0x0000, 0x0000, 0x6872,
};
static unsigned short const unicode_to_jisx0208_85[] = {
/* 0x8500 - 0x85ff */
0x3c43, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6851, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a4e, 0x0000, 0x4c22, 0x6879, 0x6878, 0x0000, 0x6874,
0x6875, 0x0000, 0x3136, 0x0000, 0x0000, 0x0000, 0x0000, 0x6877,
0x0000, 0x6871, 0x0000, 0x0000, 0x0000, 0x0000, 0x4455, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6876, 0x307e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4222, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a43, 0x0000, 0x0000,
0x687b, 0x6921, 0x0000, 0x4859, 0x0000, 0x0000, 0x0000, 0x0000,
0x687e, 0x3e56, 0x3c49, 0x6923, 0x0000, 0x0000, 0x363e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6924, 0x0000, 0x4979,
0x687d, 0x0000, 0x6856, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x687c, 0x0000, 0x0000, 0x0000, 0x0000,
0x4f4f, 0x4622, 0x4973, 0x0000, 0x0000, 0x692b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6931,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6932, 0x0000,
0x6925, 0x0000, 0x0000, 0x0000, 0x4776, 0x0000, 0x0000, 0x692f,
0x6927, 0x0000, 0x6929, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6933, 0x6928, 0x0000, 0x0000, 0x692c, 0x0000, 0x0000, 0x3172,
0x0000, 0x4665, 0x0000, 0x692d, 0x6930, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6926, 0x0000, 0x4126, 0x0000,
0x692a, 0x3b27, 0x3f45, 0x3730, 0x4c74, 0x0000, 0x4c79, 0x3d72,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6937, 0x6935, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4f4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6934, 0x0000, 0x0000, 0x0000, 0x4d75, 0x0000, 0x6936,
0x6938, 0x0000, 0x0000, 0x0000, 0x0000, 0x6939, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x693c, 0x693a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4623, 0x693b, 0x0000, 0x0000,
0x0000, 0x484d, 0x692e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d73,
0x0000, 0x693d, 0x6942, 0x4174, 0x0000, 0x0000, 0x6941, 0x0000,
};
static unsigned short const unicode_to_jisx0208_86[] = {
/* 0x8600 - 0x86ff */
0x0000, 0x0000, 0x6922, 0x0000, 0x0000, 0x0000, 0x6943, 0x4149,
0x0000, 0x0000, 0x693e, 0x6940, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x693f, 0x0000, 0x0000, 0x5d31, 0x5d22,
0x0000, 0x0000, 0x6945, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6944, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d76, 0x0000, 0x623c,
0x6946, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6947,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6948, 0x3857, 0x0000,
0x3554, 0x0000, 0x0000, 0x0000, 0x694a, 0x515d, 0x0000, 0x0000,
0x0000, 0x0000, 0x3575, 0x0000, 0x4e3a, 0x0000, 0x3673, 0x694b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x694c,
0x0000, 0x0000, 0x0000, 0x436e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x694d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x467a, 0x0000, 0x303a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3263, 0x6952, 0x6953, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x694e, 0x0000, 0x3b3d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x694f, 0x4742, 0x0000, 0x0000, 0x0000,
0x0000, 0x6950, 0x6951, 0x695b, 0x0000, 0x0000, 0x0000, 0x6955,
0x6958, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6954, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6956, 0x0000, 0x6957, 0x3c58,
0x0000, 0x6959, 0x0000, 0x4341, 0x0000, 0x3756, 0x3342, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x695c, 0x0000, 0x0000, 0x0000,
0x0000, 0x333f, 0x0000, 0x6961, 0x0000, 0x0000, 0x695d, 0x6960,
0x0000, 0x0000, 0x0000, 0x0000, 0x483a, 0x0000, 0x0000, 0x0000,
0x0000, 0x695e, 0x0000, 0x0000, 0x695f, 0x4948, 0x485a, 0x6962,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x427d, 0x696c, 0x0000, 0x6968, 0x0000, 0x0000, 0x326b, 0x0000,
};
static unsigned short const unicode_to_jisx0208_87[] = {
/* 0x8700 - 0x87ff */
0x6966, 0x0000, 0x4b2a, 0x6967, 0x0000, 0x0000, 0x6964, 0x0000,
0x6965, 0x696a, 0x696d, 0x0000, 0x0000, 0x696b, 0x0000, 0x0000,
0x0000, 0x6969, 0x6963, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4358, 0x0000, 0x6974, 0x0000, 0x4c2a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6972, 0x0000, 0x0000,
0x0000, 0x6973, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x696e, 0x0000, 0x0000, 0x6970,
0x0000, 0x0000, 0x0000, 0x6971, 0x0000, 0x0000, 0x0000, 0x696f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4066, 0x0000, 0x4f39, 0x6978, 0x0000, 0x6979, 0x0000,
0x0000, 0x0000, 0x0000, 0x6a21, 0x0000, 0x3f2a, 0x0000, 0x697b,
0x0000, 0x697e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6976,
0x6975, 0x0000, 0x0000, 0x6a22, 0x0000, 0x0000, 0x325c, 0x0000,
0x697c, 0x0000, 0x6a23, 0x0000, 0x0000, 0x0000, 0x697d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x697a, 0x0000, 0x4433, 0x0000,
0x6977, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4768,
0x0000, 0x0000, 0x6a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d3b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a26,
0x0000, 0x0000, 0x6a25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6a2e, 0x0000, 0x0000, 0x0000, 0x6a28,
0x0000, 0x0000, 0x0000, 0x6a30, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d66, 0x6a33, 0x0000, 0x6a2a, 0x0000, 0x0000,
0x6a2b, 0x0000, 0x0000, 0x0000, 0x6a2f, 0x0000, 0x6a32, 0x6a31,
0x0000, 0x0000, 0x0000, 0x6a29, 0x0000, 0x0000, 0x0000, 0x0000,
0x6a2c, 0x0000, 0x6a3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6a36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a34,
0x0000, 0x0000, 0x6a35, 0x0000, 0x0000, 0x0000, 0x6a3a, 0x6a3b,
0x0000, 0x332a, 0x0000, 0x3542, 0x0000, 0x0000, 0x6a39, 0x0000,
};
static unsigned short const unicode_to_jisx0208_88[] = {
/* 0x8800 - 0x88ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a24, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a38, 0x6a3c, 0x6a37,
0x0000, 0x6a3e, 0x0000, 0x0000, 0x0000, 0x6a40, 0x6a3f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6a42, 0x6a41, 0x695a, 0x0000, 0x0000, 0x0000, 0x6a46,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6a43, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a44, 0x0000,
0x0000, 0x6a45, 0x0000, 0x6a47, 0x0000, 0x0000, 0x0000, 0x0000,
0x376c, 0x0000, 0x6a49, 0x0000, 0x6a48, 0x0000, 0x3d30, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3954, 0x5e27, 0x0000, 0x0000,
0x0000, 0x0000, 0x6a4a, 0x3d51, 0x0000, 0x0000, 0x0000, 0x3339,
0x0000, 0x6a4b, 0x0000, 0x3152, 0x0000, 0x3e57, 0x6a4c, 0x0000,
0x0000, 0x3955, 0x6a4d, 0x3061, 0x0000, 0x0000, 0x0000, 0x0000,
0x493d, 0x0000, 0x0000, 0x6a4e, 0x0000, 0x0000, 0x0000, 0x0000,
0x3f6a, 0x0000, 0x6a55, 0x0000, 0x0000, 0x6a52, 0x0000, 0x436f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a53, 0x6a50, 0x365e,
0x0000, 0x6a4f, 0x6a56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3736, 0x0000, 0x0000, 0x425e, 0x0000, 0x6a5c, 0x0000, 0x0000,
0x0000, 0x0000, 0x6a58, 0x0000, 0x0000, 0x0000, 0x4235, 0x6a57,
0x0000, 0x6a5a, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a51, 0x0000,
0x0000, 0x0000, 0x6a5b, 0x0000, 0x6a5d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x486f, 0x0000, 0x0000, 0x6a59, 0x0000,
0x6a5e, 0x6a60, 0x0000, 0x0000, 0x3853, 0x6a54, 0x0000, 0x3041,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a5f,
0x0000, 0x3a5b, 0x4e76, 0x6a61, 0x6a62, 0x4175, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e22,
0x0000, 0x0000, 0x0000, 0x0000, 0x6a63, 0x4d35, 0x0000, 0x0000,
0x6a64, 0x6a65, 0x0000, 0x0000, 0x4a64, 0x6a66, 0x0000, 0x3a40,
0x0000, 0x4e23, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6a6b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6a6c, 0x3e58, 0x6a6a, 0x0000, 0x0000, 0x0000,
0x4d67, 0x6a67, 0x0000, 0x0000, 0x6a69, 0x403d, 0x3f7e, 0x0000,
};
static unsigned short const unicode_to_jisx0208_89[] = {
/* 0x8900 - 0x89ff */
0x0000, 0x0000, 0x6a68, 0x0000, 0x6a6d, 0x0000, 0x0000, 0x4a23,
0x0000, 0x0000, 0x6a6f, 0x0000, 0x6a6e, 0x0000, 0x0000, 0x0000,
0x336c, 0x0000, 0x4b2b, 0x6a70, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a7c, 0x6a72, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a73, 0x0000, 0x0000,
0x0000, 0x0000, 0x6a74, 0x6a75, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a79, 0x0000,
0x6a7a, 0x0000, 0x0000, 0x6a78, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6a76, 0x0000, 0x6a71, 0x6a77, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6a7b, 0x7037, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3228, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a7e, 0x365f,
0x6a7d, 0x0000, 0x0000, 0x0000, 0x6b22, 0x0000, 0x6b21, 0x0000,
0x0000, 0x0000, 0x6b24, 0x0000, 0x0000, 0x6b23, 0x0000, 0x6b25,
0x0000, 0x0000, 0x3d31, 0x0000, 0x6b26, 0x0000, 0x0000, 0x6b27,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b28, 0x403e,
0x0000, 0x4d57, 0x0000, 0x6b29, 0x0000, 0x0000, 0x4a24, 0x4746,
0x6b2a, 0x0000, 0x6b2b, 0x382b, 0x0000, 0x0000, 0x0000, 0x352c,
0x0000, 0x0000, 0x0000, 0x6b2c, 0x0000, 0x0000, 0x3b6b, 0x4741,
0x6b2d, 0x0000, 0x3350, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6b2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b30, 0x4d77,
0x0000, 0x6b2f, 0x3f46, 0x0000, 0x6b31, 0x0000, 0x0000, 0x6b32,
0x0000, 0x0000, 0x6b33, 0x3451, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b34, 0x0000, 0x0000, 0x6b35, 0x0000, 0x6b36,
0x6b37, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3351, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b38, 0x0000, 0x6b39, 0x6b3a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3272, 0x0000, 0x0000, 0x3f28, 0x6b3b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6b3c, 0x0000, 0x0000, 0x0000,
0x6b3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_8a[] = {
/* 0x8a00 - 0x8aff */
0x3840, 0x0000, 0x447b, 0x6b3e, 0x0000, 0x0000, 0x0000, 0x0000,
0x3757, 0x0000, 0x3f56, 0x0000, 0x6b41, 0x0000, 0x4624, 0x0000,
0x6b40, 0x0000, 0x0000, 0x3731, 0x0000, 0x0000, 0x6b3f, 0x4277,
0x352d, 0x0000, 0x0000, 0x6b42, 0x0000, 0x6b43, 0x0000, 0x3e59,
0x0000, 0x0000, 0x0000, 0x376d, 0x0000, 0x6b44, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b2c, 0x0000, 0x0000, 0x405f, 0x0000, 0x0000,
0x0000, 0x3576, 0x0000, 0x4c75, 0x414a, 0x0000, 0x6b45, 0x0000,
0x0000, 0x0000, 0x3f47, 0x4370, 0x3e5a, 0x0000, 0x0000, 0x0000,
0x0000, 0x6b46, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b49, 0x0000,
0x6b4a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3a3e, 0x4242, 0x6b48, 0x0000, 0x3e5b, 0x493e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b47, 0x0000, 0x0000, 0x3b6c, 0x0000,
0x3153, 0x0000, 0x6b4e, 0x3758, 0x0000, 0x0000, 0x3b6e, 0x0000,
0x0000, 0x3b6d, 0x0000, 0x4f4d, 0x6b4d, 0x6b4c, 0x4127, 0x0000,
0x354d, 0x4f43, 0x333a, 0x3e5c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6b4b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b50, 0x0000, 0x6b51, 0x6b4f, 0x0000, 0x3858,
0x0000, 0x4d40, 0x0000, 0x0000, 0x3b6f, 0x4727, 0x0000, 0x0000,
0x0000, 0x6b54, 0x0000, 0x4040, 0x0000, 0x4342, 0x0000, 0x0000,
0x4d36, 0x0000, 0x6b57, 0x0000, 0x0000, 0x0000, 0x386c, 0x0000,
0x403f, 0x6b53, 0x0000, 0x6b58, 0x386d, 0x6b55, 0x6b56, 0x0000,
0x6b52, 0x0000, 0x0000, 0x0000, 0x4062, 0x4649, 0x0000, 0x0000,
0x432f, 0x0000, 0x325d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4870, 0x0000, 0x0000, 0x3543, 0x0000, 0x0000, 0x4434,
0x0000, 0x0000, 0x6b5b, 0x0000, 0x6b59, 0x0000, 0x0000, 0x434c,
0x0000, 0x0000, 0x0000, 0x4041, 0x3452, 0x6b5a, 0x0000, 0x3f5b,
0x0000, 0x0000, 0x4e4a, 0x0000, 0x0000, 0x0000, 0x4f40, 0x0000,
0x0000, 0x0000, 0x6b5c, 0x6b67, 0x4435, 0x0000, 0x6b66, 0x0000,
0x6b63, 0x6b6b, 0x6b64, 0x0000, 0x6b60, 0x0000, 0x447c, 0x6b5f,
0x0000, 0x0000, 0x0000, 0x6b5d, 0x0000, 0x4d21, 0x3b70, 0x0000,
0x0000, 0x6b61, 0x0000, 0x6b5e, 0x0000, 0x0000, 0x0000, 0x6b65,
0x3d74, 0x0000, 0x3841, 0x0000, 0x0000, 0x0000, 0x427a, 0x0000,
};
static unsigned short const unicode_to_jisx0208_8b[] = {
/* 0x8b00 - 0x8bff */
0x4b45, 0x315a, 0x3062, 0x0000, 0x4625, 0x0000, 0x0000, 0x6b69,
0x0000, 0x0000, 0x0000, 0x0000, 0x6b68, 0x0000, 0x4666, 0x0000,
0x6b6d, 0x0000, 0x0000, 0x0000, 0x6b62, 0x0000, 0x6b6c, 0x6b6e,
0x0000, 0x382c, 0x6b6a, 0x3956, 0x0000, 0x3c55, 0x0000, 0x0000,
0x6b6f, 0x4d58, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b72, 0x0000,
0x6b75, 0x0000, 0x0000, 0x6b73, 0x4935, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b70, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3660, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b74, 0x0000,
0x0000, 0x6b76, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6b7a, 0x0000, 0x0000, 0x6b77, 0x0000, 0x6b79, 0x6b78,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b7b, 0x0000,
0x3c31, 0x0000, 0x6b7d, 0x6b7c, 0x4968, 0x0000, 0x0000, 0x6c21,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3759, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b7e, 0x6c22, 0x0000, 0x0000, 0x6c23,
0x3544, 0x6641, 0x3e79, 0x0000, 0x6c24, 0x0000, 0x0000, 0x386e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c25, 0x0000, 0x0000,
0x6c26, 0x0000, 0x0000, 0x3b3e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5a4e, 0x0000, 0x6c27, 0x0000, 0x6c28, 0x0000,
0x3d32, 0x0000, 0x6c29, 0x6c2a, 0x0000, 0x0000, 0x6c2b, 0x0000,
0x0000, 0x6c2c, 0x6c2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_8c[] = {
/* 0x8c00 - 0x8cff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x432b,
0x0000, 0x0000, 0x6c2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c30,
0x0000, 0x6c2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4626, 0x0000,
0x6c31, 0x0000, 0x4b2d, 0x0000, 0x6c32, 0x0000, 0x6c33, 0x0000,
0x6c34, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c35, 0x0000, 0x0000,
0x0000, 0x0000, 0x465a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3e5d, 0x6c36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x396b, 0x502e, 0x6c37, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6c38, 0x493f, 0x6c39, 0x0000, 0x6c41, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c3a, 0x0000, 0x0000, 0x6c3c, 0x0000, 0x0000,
0x0000, 0x6c3b, 0x6c3d, 0x0000, 0x4b46, 0x6c3e, 0x6c3f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c40, 0x0000, 0x0000, 0x0000,
0x6c42, 0x0000, 0x0000, 0x0000, 0x0000, 0x332d, 0x4467, 0x0000,
0x4969, 0x3a62, 0x3957, 0x0000, 0x0000, 0x0000, 0x0000, 0x494f,
0x325f, 0x484e, 0x6c45, 0x3453, 0x4055, 0x6c44, 0x6c49, 0x4379,
0x4c63, 0x0000, 0x6c47, 0x6c48, 0x352e, 0x0000, 0x6c4a, 0x4763,
0x425f, 0x0000, 0x0000, 0x4871, 0x453d, 0x6c46, 0x0000, 0x4b47,
0x326c, 0x6c4c, 0x4f28, 0x4442, 0x4f45, 0x0000, 0x0000, 0x3b71,
0x6c4b, 0x0000, 0x4231, 0x0000, 0x0000, 0x6c5c, 0x4128, 0x0000,
0x0000, 0x4678, 0x0000, 0x4950, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c4f, 0x3b3f, 0x3b72, 0x0000, 0x3e5e, 0x0000,
0x4765, 0x0000, 0x382d, 0x6c4e, 0x6c4d, 0x0000, 0x496a, 0x0000,
0x0000, 0x0000, 0x3c41, 0x0000, 0x0000, 0x4552, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c51, 0x6c52, 0x3958, 0x6c50, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_8d[] = {
/* 0x8d00 - 0x8dff */
0x0000, 0x0000, 0x0000, 0x0000, 0x6c53, 0x6c54, 0x0000, 0x6c56,
0x4223, 0x0000, 0x6c55, 0x3466, 0x0000, 0x6c58, 0x0000, 0x6c57,
0x6c59, 0x0000, 0x0000, 0x6c5b, 0x6c5d, 0x0000, 0x6c5e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4056, 0x0000, 0x3c4f, 0x6c5f,
0x0000, 0x0000, 0x0000, 0x3352, 0x0000, 0x6c60, 0x0000, 0x0000,
0x4176, 0x6c61, 0x0000, 0x6c62, 0x496b, 0x0000, 0x0000, 0x352f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6c63, 0x0000, 0x0000, 0x0000, 0x4436, 0x0000, 0x0000,
0x0000, 0x0000, 0x315b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6c64, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c71, 0x0000, 0x0000, 0x0000, 0x0000,
0x3f76, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x422d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c67, 0x0000, 0x0000, 0x0000, 0x6c66, 0x0000,
0x0000, 0x0000, 0x6c65, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6c6d, 0x6c6b, 0x0000, 0x0000, 0x6c68,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c6a, 0x0000,
0x0000, 0x0000, 0x6c69, 0x6c6c, 0x0000, 0x3577, 0x0000, 0x6c70,
0x0000, 0x4057, 0x0000, 0x6c71, 0x0000, 0x0000, 0x0000, 0x0000,
0x3859, 0x0000, 0x6c6e, 0x6c6f, 0x0000, 0x0000, 0x0000, 0x4f29,
0x0000, 0x0000, 0x0000, 0x4437, 0x0000, 0x4129, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c72, 0x0000, 0x0000, 0x6c75,
};
static unsigned short const unicode_to_jisx0208_8e[] = {
/* 0x8e00 - 0x8eff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6c73, 0x6c74, 0x4d59, 0x0000, 0x0000, 0x0000, 0x0000, 0x4627,
0x6c78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c76, 0x6c77, 0x6c79,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d29, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6c7c, 0x0000, 0x0000, 0x0000, 0x6c7d, 0x6c7b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c7a, 0x0000, 0x447d, 0x0000, 0x0000, 0x6d21,
0x6d25, 0x6d22, 0x6c7e, 0x0000, 0x6d23, 0x0000, 0x0000, 0x0000,
0x6d24, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d2b, 0x0000, 0x0000,
0x0000, 0x6d26, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4058,
0x6d28, 0x0000, 0x0000, 0x6d2a, 0x6d27, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d2d, 0x0000, 0x3d33, 0x0000, 0x6d2c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6d2e, 0x0000, 0x0000, 0x0000,
0x0000, 0x6d2f, 0x0000, 0x0000, 0x6d32, 0x6d31, 0x0000, 0x6d30,
0x0000, 0x0000, 0x6d34, 0x6d33, 0x0000, 0x4c76, 0x0000, 0x0000,
0x0000, 0x6d36, 0x0000, 0x6d35, 0x6d37, 0x0000, 0x0000, 0x0000,
0x0000, 0x6d38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6d3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d39, 0x3f48, 0x6d3b, 0x0000, 0x0000, 0x366d,
0x6d3c, 0x6d3e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d3f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d40, 0x6d3d, 0x0000,
0x6d41, 0x0000, 0x3c56, 0x6d42, 0x3530, 0x3733, 0x0000, 0x0000,
0x0000, 0x0000, 0x382e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6d43, 0x0000, 0x0000, 0x0000, 0x4670,
0x0000, 0x0000, 0x453e, 0x6d44, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6d47, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c34, 0x0000, 0x0000, 0x6d46, 0x6d45, 0x375a, 0x6d48, 0x0000,
};
static unsigned short const unicode_to_jisx0208_8f[] = {
/* 0x8f00 - 0x8fff */
0x0000, 0x0000, 0x0000, 0x3353, 0x0000, 0x6d4a, 0x0000, 0x0000,
0x0000, 0x3a5c, 0x6d49, 0x0000, 0x6d52, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d4c, 0x6d4e, 0x4a65, 0x6d4b, 0x0000, 0x0000,
0x0000, 0x6d4d, 0x0000, 0x6d51, 0x6d4f, 0x3531, 0x0000, 0x6d50,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d53, 0x0000,
0x0000, 0x475a, 0x4e58, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d34,
0x0000, 0x0000, 0x0000, 0x6d54, 0x0000, 0x0000, 0x0000, 0x0000,
0x4d22, 0x6d56, 0x0000, 0x6d55, 0x0000, 0x0000, 0x6d59, 0x4d41,
0x0000, 0x0000, 0x6d58, 0x0000, 0x336d, 0x6d57, 0x6d5c, 0x0000,
0x0000, 0x6d5b, 0x0000, 0x0000, 0x6d5a, 0x4532, 0x6d5d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d5e,
0x0000, 0x0000, 0x0000, 0x0000, 0x6d5f, 0x0000, 0x0000, 0x396c,
0x0000, 0x3725, 0x6d60, 0x6d61, 0x6d62, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3f49, 0x6d63, 0x0000, 0x3c2d, 0x6d64,
0x0000, 0x0000, 0x0000, 0x6d65, 0x0000, 0x0000, 0x0000, 0x5221,
0x517e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d66, 0x6570, 0x6d67,
0x4324, 0x3f2b, 0x4740, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d68,
0x0000, 0x0000, 0x4a55, 0x4454, 0x397e, 0x0000, 0x0000, 0x4329,
0x0000, 0x0000, 0x312a, 0x0000, 0x4b78, 0x3f57, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x375e, 0x0000,
0x0000, 0x3661, 0x0000, 0x0000, 0x4a56, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d69, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d6b, 0x0000, 0x0000, 0x6d6a, 0x3260, 0x0000,
0x0000, 0x4676, 0x6d6c, 0x4777, 0x0000, 0x4533, 0x0000, 0x6d6d,
0x3d52, 0x0000, 0x0000, 0x0000, 0x6d6f, 0x0000, 0x0000, 0x4c42,
0x6d7e, 0x6d71, 0x6d72, 0x0000, 0x0000, 0x4449, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_90[] = {
/* 0x9000 - 0x90ff */
0x4260, 0x4177, 0x0000, 0x4628, 0x0000, 0x6d70, 0x3555, 0x0000,
0x0000, 0x0000, 0x0000, 0x6d79, 0x0000, 0x6d76, 0x6e25, 0x4629,
0x4360, 0x6d73, 0x0000, 0x447e, 0x4553, 0x6d74, 0x6d78, 0x3f60,
0x0000, 0x4767, 0x444c, 0x0000, 0x0000, 0x4042, 0x6d77, 0x422e,
0x4224, 0x6d75, 0x3029, 0x4f22, 0x0000, 0x0000, 0x0000, 0x6d7a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4261, 0x0000,
0x0000, 0x3d35, 0x3f4a, 0x0000, 0x0000, 0x6d7c, 0x6d7b, 0x0000,
0x306f, 0x6d7d, 0x0000, 0x0000, 0x492f, 0x0000, 0x6e27, 0x0000,
0x0000, 0x465b, 0x3f6b, 0x0000, 0x0000, 0x4359, 0x0000, 0x3678,
0x0000, 0x6e26, 0x4d37, 0x313f, 0x0000, 0x4a57, 0x3261, 0x6e21,
0x6e22, 0x6e23, 0x6e24, 0x463b, 0x4323, 0x3063, 0x6e28, 0x0000,
0x6e29, 0x7423, 0x0000, 0x0000, 0x423d, 0x0000, 0x6e2a, 0x0000,
0x3173, 0x414c, 0x0000, 0x382f, 0x0000, 0x4d5a, 0x0000, 0x0000,
0x6e2b, 0x452c, 0x0000, 0x0000, 0x0000, 0x4178, 0x3c57, 0x6e2c,
0x0000, 0x0000, 0x6e2f, 0x0000, 0x0000, 0x3d65, 0x6e2d, 0x412b,
0x412a, 0x0000, 0x3064, 0x0000, 0x4e4b, 0x6e31, 0x0000, 0x4872,
0x6e33, 0x6e32, 0x6e30, 0x6364, 0x3454, 0x0000, 0x0000, 0x6d6e,
0x0000, 0x6e35, 0x6e34, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e36,
0x0000, 0x4d38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4661, 0x0000, 0x0000, 0x4b2e, 0x0000,
0x6e37, 0x0000, 0x3c59, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e38,
0x0000, 0x6e39, 0x0000, 0x0000, 0x0000, 0x6e3a, 0x0000, 0x0000,
0x4521, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x306a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3959, 0x0000, 0x0000, 0x0000, 0x4f3a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6e3e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3734, 0x6e3b, 0x0000, 0x6e3c, 0x0000, 0x0000, 0x0000,
0x4974, 0x0000, 0x0000, 0x0000, 0x0000, 0x3354, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d39, 0x0000, 0x363f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4554, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_91[] = {
/* 0x9100 - 0x91ff */
0x0000, 0x0000, 0x6e3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6e40, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6e41, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4522, 0x0000, 0x0000,
0x6e43, 0x0000, 0x6e42, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4653, 0x6e44, 0x3d36, 0x3c60, 0x475b, 0x4371, 0x0000,
0x0000, 0x0000, 0x3c72, 0x0000, 0x3f6c, 0x0000, 0x6e45, 0x0000,
0x6e46, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f5d, 0x6e47, 0x0000, 0x6e48, 0x0000, 0x0000,
0x0000, 0x6e49, 0x4d6f, 0x0000, 0x3d37, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6e4b, 0x6e4a, 0x0000, 0x395a, 0x0000, 0x3973,
0x3b40, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6e4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d66,
0x0000, 0x6e4d, 0x0000, 0x6e4c, 0x0000, 0x4269, 0x0000, 0x0000,
0x386f, 0x0000, 0x4043, 0x0000, 0x0000, 0x0000, 0x0000, 0x4830,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d39, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6e4f, 0x0000, 0x3e5f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6e52, 0x6e50, 0x0000, 0x0000, 0x0000, 0x6e51,
0x0000, 0x0000, 0x0000, 0x0000, 0x6e54, 0x6e53, 0x0000, 0x0000,
0x3e7a, 0x0000, 0x6e55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6e56, 0x6e57, 0x0000, 0x0000, 0x0000, 0x0000, 0x4850, 0x3a53,
0x3c61, 0x6e58, 0x0000, 0x6e59, 0x4e24, 0x3d45, 0x4c6e, 0x4e4c,
0x6e5a, 0x3662, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e5b, 0x0000,
0x4523, 0x0000, 0x0000, 0x6e5e, 0x3378, 0x3f4b, 0x0000, 0x6e5c,
0x0000, 0x6e5d, 0x0000, 0x4460, 0x0000, 0x0000, 0x4b55, 0x367c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e60, 0x6e61, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6e5f, 0x0000, 0x0000, 0x6e63,
};
static unsigned short const unicode_to_jisx0208_92[] = {
/* 0x9200 - 0x92ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x465f, 0x3343, 0x0000,
0x0000, 0x6e67, 0x0000, 0x0000, 0x6e64, 0x6e66, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e62, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f4f, 0x0000, 0x0000, 0x6e65, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e6b, 0x0000, 0x0000, 0x385a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e6f,
0x0000, 0x0000, 0x0000, 0x0000, 0x4534, 0x6e6a, 0x0000, 0x0000,
0x6e6d, 0x6e6b, 0x0000, 0x6e70, 0x0000, 0x0000, 0x0000, 0x0000,
0x6e71, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e69,
0x0000, 0x0000, 0x6e76, 0x3174, 0x0000, 0x0000, 0x6e68, 0x0000,
0x0000, 0x0000, 0x482d, 0x0000, 0x6e6c, 0x0000, 0x3e60, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x395b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b48, 0x0000,
0x3664, 0x0000, 0x0000, 0x3d46, 0x0000, 0x463c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x412d, 0x0000, 0x6e74, 0x0000, 0x6e6e, 0x6e73, 0x0000,
0x4c43, 0x0000, 0x4438, 0x6e75, 0x6e72, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x412c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e79,
0x0000, 0x6e78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e77,
0x0000, 0x0000, 0x4b2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d7b, 0x0000, 0x0000, 0x0000,
0x0000, 0x6e7a, 0x4a5f, 0x0000, 0x0000, 0x3154, 0x0000, 0x0000,
0x0000, 0x0000, 0x4946, 0x4372, 0x0000, 0x0000, 0x0000, 0x0000,
0x3578, 0x0000, 0x6e7c, 0x0000, 0x395d, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_93[] = {
/* 0x9300 - 0x93ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b2c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6e7b,
0x3f6d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3f6e, 0x6f21, 0x6f23, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e7b, 0x0000, 0x6f22, 0x6f24, 0x0000, 0x0000, 0x3653, 0x0000,
0x4945, 0x0000, 0x0000, 0x3c62, 0x4f23, 0x0000, 0x6e7e, 0x3a78,
0x0000, 0x0000, 0x4f3f, 0x0000, 0x0000, 0x6f26, 0x0000, 0x0000,
0x0000, 0x0000, 0x6f25, 0x6f27, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6e7d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4669, 0x0000, 0x4555, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4457, 0x0000, 0x6f2c, 0x0000,
0x0000, 0x0000, 0x0000, 0x4343, 0x6f28, 0x0000, 0x0000, 0x0000,
0x6f29, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x372d, 0x0000, 0x6f2b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3830, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6f2a, 0x0000, 0x3e61, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3379, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6f30, 0x0000, 0x3a3f, 0x4179,
0x0000, 0x0000, 0x444a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x333b,
0x0000, 0x0000, 0x0000, 0x0000, 0x6f2e, 0x6f2f, 0x4443, 0x0000,
0x6f2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f31, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6f37, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f39, 0x452d, 0x0000, 0x0000, 0x0000, 0x0000, 0x6f32, 0x6f33,
0x6f36, 0x0000, 0x0000, 0x0000, 0x0000, 0x6f38, 0x0000, 0x0000,
0x0000, 0x3640, 0x0000, 0x0000, 0x6f3b, 0x6f35, 0x0000, 0x0000,
0x6f34, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_94[] = {
/* 0x9400 - 0x94ff */
0x0000, 0x0000, 0x0000, 0x6f3f, 0x0000, 0x0000, 0x0000, 0x6f40,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f41, 0x0000, 0x0000, 0x6f3e, 0x6f3d, 0x0000, 0x0000, 0x0000,
0x3e62, 0x462a, 0x6f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f45, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6f43, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6f44, 0x6f42, 0x0000,
0x4278, 0x0000, 0x6f46, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f47, 0x0000, 0x0000, 0x6f49, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3455, 0x6f48, 0x4c7a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6f54, 0x6f4a, 0x0000, 0x0000, 0x6f4d, 0x0000,
0x6f4b, 0x0000, 0x6f4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6f4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f50, 0x0000, 0x0000, 0x0000, 0x0000, 0x6f51, 0x0000, 0x6f52,
0x0000, 0x0000, 0x0000, 0x0000, 0x6f55, 0x6f53, 0x6f56, 0x6f58,
0x0000, 0x6f57, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_95[] = {
/* 0x9500 - 0x95ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4439,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c67, 0x0000, 0x6f59, 0x412e, 0x0000, 0x0000, 0x0000, 0x6f5a,
0x0000, 0x4a44, 0x6f5b, 0x332b, 0x0000, 0x0000, 0x0000, 0x313c,
0x0000, 0x3457, 0x0000, 0x3456, 0x6f5c, 0x0000, 0x6f5d, 0x0000,
0x6f5e, 0x6f5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f60, 0x0000, 0x3458, 0x3355, 0x395e, 0x4836, 0x0000, 0x6f62,
0x6f61, 0x0000, 0x0000, 0x0000, 0x0000, 0x6f63, 0x0000, 0x0000,
0x0000, 0x0000, 0x315c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f66, 0x0000, 0x6f65, 0x6f64, 0x0000, 0x6f67, 0x0000,
0x0000, 0x0000, 0x0000, 0x6f6a, 0x0000, 0x0000, 0x0000, 0x3047,
0x0000, 0x0000, 0x6f68, 0x0000, 0x6f6c, 0x6f6b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6f6e, 0x6f6d, 0x6f6f, 0x0000,
0x462e, 0x0000, 0x0000, 0x0000, 0x6f70, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f71, 0x6f73, 0x0000, 0x0000, 0x6f72, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_96[] = {
/* 0x9600 - 0x96ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x496c, 0x0000, 0x0000, 0x0000,
0x0000, 0x6f74, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6f75, 0x0000, 0x3a65, 0x0000, 0x0000, 0x0000, 0x6f76, 0x6f77,
0x0000, 0x0000, 0x4b49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x414b, 0x0000, 0x0000, 0x0000, 0x3024,
0x424b, 0x0000, 0x6f78, 0x0000, 0x496d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6f7b, 0x6f79, 0x395f, 0x0000, 0x6f7a,
0x3842, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a45, 0x6f7d, 0x7021, 0x6f7e, 0x7022,
0x0000, 0x0000, 0x3121, 0x3f58, 0x3d7c, 0x3459, 0x7023, 0x0000,
0x0000, 0x0000, 0x4766, 0x0000, 0x7025, 0x0000, 0x0000, 0x0000,
0x3122, 0x0000, 0x7024, 0x4444, 0x0000, 0x4e4d, 0x462b, 0x6f7c,
0x4e26, 0x0000, 0x3831, 0x0000, 0x0000, 0x4d5b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3679, 0x4e34, 0x0000,
0x3728, 0x0000, 0x4262, 0x6721, 0x0000, 0x7026, 0x332c, 0x3f6f,
0x0000, 0x0000, 0x0000, 0x0000, 0x3356, 0x7028, 0x0000, 0x7029,
0x7027, 0x3764, 0x0000, 0x3a5d, 0x3e63, 0x0000, 0x0000, 0x0000,
0x3123, 0x0000, 0x0000, 0x4e59, 0x0000, 0x0000, 0x0000, 0x702b,
0x6e2e, 0x0000, 0x702a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x702e, 0x702c, 0x702d, 0x0000, 0x702f, 0x0000, 0x7030, 0x4e6c,
0x7031, 0x7032, 0x0000, 0x4049, 0x483b, 0x0000, 0x0000, 0x0000,
0x3f7d, 0x3467, 0x0000, 0x0000, 0x4d3a, 0x326d, 0x3d38, 0x385b,
0x0000, 0x7035, 0x0000, 0x7034, 0x3b73, 0x7036, 0x7033, 0x0000,
0x0000, 0x3b28, 0x0000, 0x0000, 0x0000, 0x703a, 0x6a2d, 0x0000,
0x0000, 0x5256, 0x0000, 0x3f77, 0x7038, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4e25, 0x4671, 0x0000, 0x0000, 0x0000, 0x0000,
0x312b, 0x0000, 0x4063, 0x3c36, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a37, 0x0000, 0x3140, 0x0000, 0x0000, 0x0000, 0x4e6d, 0x4d6b,
0x0000, 0x703b, 0x0000, 0x4545, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_97[] = {
/* 0x9700 - 0x97ff */
0x3c7b, 0x0000, 0x0000, 0x0000, 0x703c, 0x0000, 0x703d, 0x3f4c,
0x703e, 0x0000, 0x4e6e, 0x0000, 0x0000, 0x7039, 0x7040, 0x7042,
0x0000, 0x7041, 0x0000, 0x703f, 0x0000, 0x0000, 0x7043, 0x0000,
0x0000, 0x7044, 0x0000, 0x0000, 0x417a, 0x0000, 0x3262, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7045, 0x0000, 0x0000, 0x4c38,
0x0000, 0x0000, 0x7046, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7047, 0x0000, 0x4f2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b31, 0x7048, 0x0000, 0x0000, 0x0000, 0x7049, 0x704a, 0x0000,
0x0000, 0x0000, 0x704e, 0x0000, 0x704b, 0x0000, 0x704c, 0x0000,
0x704d, 0x704f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4044, 0x0000, 0x0000, 0x0000, 0x4c77, 0x0000,
0x0000, 0x4045, 0x0000, 0x0000, 0x7050, 0x0000, 0x4873, 0x0000,
0x7051, 0x7353, 0x4c4c, 0x0000, 0x7052, 0x0000, 0x7053, 0x0000,
0x7054, 0x3357, 0x0000, 0x7056, 0x0000, 0x3f59, 0x0000, 0x0000,
0x0000, 0x7057, 0x0000, 0x0000, 0x3724, 0x0000, 0x0000, 0x0000,
0x0000, 0x7058, 0x705c, 0x0000, 0x705a, 0x0000, 0x0000, 0x0000,
0x0000, 0x705b, 0x0000, 0x0000, 0x3373, 0x7059, 0x705d, 0x0000,
0x0000, 0x0000, 0x0000, 0x705e, 0x0000, 0x3048, 0x0000, 0x705f,
0x7060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e64, 0x0000, 0x0000, 0x0000, 0x7061, 0x0000, 0x0000, 0x0000,
0x3547, 0x0000, 0x0000, 0x7064, 0x0000, 0x0000, 0x7063, 0x0000,
0x7062, 0x0000, 0x0000, 0x6b71, 0x0000, 0x4a5c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7065, 0x7066, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7067, 0x0000, 0x0000, 0x7068, 0x0000,
0x7069, 0x0000, 0x0000, 0x706a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x345a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x706b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x706c, 0x4723, 0x0000,
0x0000, 0x0000, 0x706e, 0x323b, 0x0000, 0x7071, 0x7070, 0x0000,
0x0000, 0x0000, 0x0000, 0x3124, 0x0000, 0x0000, 0x0000, 0x3641,
};
static unsigned short const unicode_to_jisx0208_98[] = {
/* 0x9800 - 0x98ff */
0x0000, 0x4a47, 0x443a, 0x3a22, 0x0000, 0x3960, 0x3d67, 0x0000,
0x3f5c, 0x0000, 0x0000, 0x0000, 0x7073, 0x0000, 0x0000, 0x7072,
0x4d42, 0x3468, 0x4852, 0x465c, 0x0000, 0x0000, 0x0000, 0x3f7c,
0x4e4e, 0x0000, 0x375b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7076, 0x0000, 0x0000, 0x7075, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b4b, 0x462c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3150, 0x0000, 0x0000, 0x7077,
0x7074, 0x0000, 0x0000, 0x4951, 0x4d6a, 0x7078, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7079, 0x0000,
0x0000, 0x0000, 0x0000, 0x707b, 0x426a, 0x335b, 0x335c, 0x707a,
0x0000, 0x0000, 0x0000, 0x0000, 0x3469, 0x3832, 0x0000, 0x0000,
0x346a, 0x0000, 0x0000, 0x453f, 0x0000, 0x0000, 0x4e60, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x385c,
0x0000, 0x0000, 0x0000, 0x707c, 0x0000, 0x0000, 0x0000, 0x707d,
0x707e, 0x7121, 0x0000, 0x7123, 0x7122, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4977, 0x0000, 0x7124, 0x0000, 0x0000, 0x0000, 0x0000, 0x7125,
0x0000, 0x7126, 0x0000, 0x0000, 0x0000, 0x0000, 0x7127, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7129, 0x7128, 0x0000, 0x712a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4874, 0x664c, 0x0000, 0x0000, 0x3f29,
0x0000, 0x0000, 0x3532, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x712b, 0x0000, 0x712c, 0x0000, 0x522c, 0x5d3b, 0x4853,
0x0000, 0x0000, 0x307b, 0x0000, 0x303b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3b74, 0x4b30, 0x3e7e, 0x0000,
};
static unsigned short const unicode_to_jisx0208_99[] = {
/* 0x9900 - 0x99ff */
0x0000, 0x0000, 0x0000, 0x712d, 0x0000, 0x4c5f, 0x0000, 0x0000,
0x0000, 0x712e, 0x4d5c, 0x0000, 0x3142, 0x0000, 0x0000, 0x0000,
0x3b41, 0x0000, 0x712f, 0x326e, 0x7130, 0x0000, 0x0000, 0x0000,
0x7131, 0x0000, 0x0000, 0x0000, 0x0000, 0x7133, 0x7134, 0x0000,
0x7136, 0x7132, 0x0000, 0x0000, 0x7135, 0x0000, 0x0000, 0x0000,
0x345b, 0x0000, 0x0000, 0x0000, 0x7137, 0x0000, 0x7138, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7139, 0x713a, 0x0000,
0x0000, 0x0000, 0x713b, 0x0000, 0x0000, 0x713d, 0x0000, 0x0000,
0x0000, 0x713c, 0x0000, 0x713f, 0x7142, 0x0000, 0x0000, 0x0000,
0x713e, 0x7140, 0x7141, 0x0000, 0x0000, 0x7143, 0x0000, 0x3642,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c73, 0x7144,
0x7145, 0x3961, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7146, 0x0000, 0x0000,
0x333e, 0x0000, 0x0000, 0x0000, 0x474f, 0x7147, 0x7148, 0x0000,
0x0000, 0x0000, 0x0000, 0x435a, 0x466b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7149, 0x0000, 0x0000, 0x0000,
0x0000, 0x477d, 0x0000, 0x0000, 0x424c, 0x3158, 0x366e, 0x0000,
0x366f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4373, 0x714e, 0x3670, 0x0000, 0x0000, 0x326f, 0x0000, 0x0000,
0x714d, 0x0000, 0x0000, 0x714b, 0x0000, 0x714c, 0x0000, 0x714a,
0x0000, 0x0000, 0x7158, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x714f, 0x7150, 0x0000,
0x0000, 0x7151, 0x7152, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7154, 0x0000, 0x0000, 0x7153, 0x0000, 0x0000, 0x0000, 0x3d59,
};
static unsigned short const unicode_to_jisx0208_9a[] = {
/* 0x9a00 - 0x9aff */
0x0000, 0x7155, 0x0000, 0x0000, 0x0000, 0x7157, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3533, 0x7156,
0x0000, 0x0000, 0x417b, 0x3833, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7159, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x424d, 0x0000, 0x0000, 0x715a, 0x0000, 0x0000, 0x0000, 0x0000,
0x462d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x715b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7160, 0x0000,
0x715e, 0x0000, 0x715d, 0x715f, 0x0000, 0x715c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7162, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7161, 0x0000, 0x7164,
0x0000, 0x0000, 0x3643, 0x7163, 0x0000, 0x0000, 0x0000, 0x7165,
0x0000, 0x0000, 0x7166, 0x0000, 0x7168, 0x7167, 0x0000, 0x0000,
0x0000, 0x7169, 0x716b, 0x716a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x397c, 0x0000, 0x0000, 0x0000, 0x0000, 0x716c, 0x0000, 0x0000,
0x716d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x333c, 0x0000, 0x0000, 0x0000, 0x716e, 0x0000, 0x0000, 0x0000,
0x716f, 0x0000, 0x0000, 0x0000, 0x3f71, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7170,
0x0000, 0x7171, 0x0000, 0x7172, 0x7173, 0x0000, 0x0000, 0x0000,
0x3962, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7174, 0x7175,
0x0000, 0x0000, 0x7176, 0x7177, 0x0000, 0x0000, 0x7178, 0x0000,
0x0000, 0x0000, 0x4831, 0x717a, 0x0000, 0x4926, 0x717b, 0x7179,
0x0000, 0x717d, 0x0000, 0x0000, 0x717c, 0x0000, 0x0000, 0x717e,
0x0000, 0x0000, 0x0000, 0x7221, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_9b[] = {
/* 0x9b00 - 0x9bff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7222, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7223, 0x0000, 0x7224, 0x0000, 0x0000, 0x0000, 0x0000, 0x7225,
0x0000, 0x0000, 0x7226, 0x7227, 0x0000, 0x7228, 0x0000, 0x7229,
0x722a, 0x722b, 0x722c, 0x0000, 0x0000, 0x0000, 0x722d, 0x722e,
0x0000, 0x5d35, 0x722f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6478, 0x3534, 0x0000, 0x0000, 0x0000,
0x0000, 0x3321, 0x3a32, 0x7231, 0x7230, 0x4c25, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7233, 0x7234, 0x7232,
0x0000, 0x7235, 0x0000, 0x0000, 0x4b62, 0x0000, 0x0000, 0x0000,
0x7236, 0x0000, 0x357b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f25,
0x0000, 0x0000, 0x0000, 0x0000, 0x7237, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7239, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x303e, 0x0000,
0x0000, 0x723a, 0x4a2b, 0x7238, 0x0000, 0x0000, 0x723b, 0x723c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x723d,
0x723e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x723f, 0x0000, 0x4b6e, 0x3b2d, 0x0000, 0x3a7a, 0x412f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7240, 0x0000, 0x0000, 0x0000,
0x0000, 0x7243, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7241, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7244, 0x0000,
0x0000, 0x3871, 0x7242, 0x0000, 0x0000, 0x0000, 0x0000, 0x7245,
0x0000, 0x7246, 0x7247, 0x0000, 0x724b, 0x0000, 0x3b2a, 0x0000,
0x0000, 0x0000, 0x0000, 0x4264, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x724c, 0x7249, 0x7248, 0x724a, 0x0000, 0x0000, 0x0000,
0x375f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7250, 0x724f, 0x724e, 0x0000, 0x0000, 0x3033, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_9c[] = {
/* 0x9c00 - 0x9cff */
0x0000, 0x0000, 0x0000, 0x0000, 0x725a, 0x0000, 0x7256, 0x0000,
0x7257, 0x7253, 0x7259, 0x0000, 0x7255, 0x3362, 0x0000, 0x0000,
0x4f4c, 0x0000, 0x7258, 0x7254, 0x7252, 0x7251, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x725c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x725f, 0x0000, 0x0000, 0x725e, 0x725d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4949, 0x725b, 0x3073,
0x7260, 0x0000, 0x7262, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x336f, 0x724d, 0x3137, 0x0000, 0x0000, 0x7264, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7263, 0x7261,
0x432d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b70, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e5a,
0x0000, 0x0000, 0x7265, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7266, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7267,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7268, 0x0000,
0x7269, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x443b, 0x0000, 0x726a,
0x0000, 0x4837, 0x0000, 0x726f, 0x726b, 0x0000, 0x0000, 0x0000,
0x726c, 0x0000, 0x0000, 0x4b31, 0x4c44, 0x0000, 0x4650, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_9d[] = {
/* 0x9d00 - 0x9dff */
0x0000, 0x0000, 0x0000, 0x7270, 0x0000, 0x0000, 0x7271, 0x463e,
0x726e, 0x726d, 0x0000, 0x0000, 0x0000, 0x0000, 0x322a, 0x0000,
0x0000, 0x0000, 0x7279, 0x0000, 0x0000, 0x7278, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3175, 0x0000, 0x0000, 0x0000, 0x7276,
0x0000, 0x0000, 0x0000, 0x7275, 0x0000, 0x0000, 0x7273, 0x0000,
0x337b, 0x0000, 0x7272, 0x3c32, 0x3229, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3963, 0x0000, 0x0000, 0x727c, 0x727b,
0x0000, 0x727a, 0x0000, 0x0000, 0x7277, 0x0000, 0x727d, 0x0000,
0x727e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7325, 0x7324, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7326, 0x0000, 0x0000, 0x312d, 0x7321, 0x7322, 0x0000,
0x3974, 0x4c39, 0x0000, 0x0000, 0x7323, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b32, 0x0000, 0x0000, 0x732b,
0x0000, 0x0000, 0x7327, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x732c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7329,
0x0000, 0x7328, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x375c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x732d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x732e, 0x0000, 0x0000, 0x0000,
0x0000, 0x732f, 0x0000, 0x732a, 0x0000, 0x0000, 0x0000, 0x7274,
0x0000, 0x0000, 0x7330, 0x0000, 0x4461, 0x0000, 0x0000, 0x0000,
0x7334, 0x0000, 0x7335, 0x7333, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7332, 0x7338, 0x0000, 0x7331, 0x0000, 0x7336, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7337,
0x0000, 0x0000, 0x0000, 0x733a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7339, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x733c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x733d, 0x0000, 0x733e,
0x0000, 0x0000, 0x4f49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x733b, 0x426b, 0x3a6d, 0x0000, 0x0000, 0x733f, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_9e[] = {
/* 0x9e00 - 0x9eff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x7340, 0x7341, 0x0000, 0x0000, 0x7342, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7343, 0x0000, 0x0000,
0x3834, 0x7344, 0x0000, 0x0000, 0x0000, 0x7345, 0x0000, 0x3c2f,
0x0000, 0x7346, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7347, 0x0000, 0x0000, 0x7348, 0x7349, 0x0000, 0x0000, 0x0000,
0x0000, 0x734c, 0x734a, 0x4f3c, 0x0000, 0x734b, 0x0000, 0x4e6f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x734d, 0x0000, 0x4e5b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x734e, 0x477e, 0x0000,
0x0000, 0x734f, 0x7351, 0x0000, 0x0000, 0x7352, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7350, 0x396d, 0x4c4d, 0x4b63, 0x5677, 0x0000, 0x5d60, 0x4b7b,
0x0000, 0x0000, 0x0000, 0x0000, 0x322b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7354, 0x3550, 0x7355, 0x7356,
0x7357, 0x0000, 0x3975, 0x0000, 0x7358, 0x0000, 0x0000, 0x0000,
0x6054, 0x4c5b, 0x0000, 0x4263, 0x7359, 0x735b, 0x735a, 0x0000,
0x735c, 0x0000, 0x0000, 0x0000, 0x0000, 0x735d, 0x0000, 0x0000,
0x735e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x735f,
0x0000, 0x0000, 0x0000, 0x0000, 0x7360, 0x0000, 0x7361, 0x7362,
0x0000, 0x7363, 0x0000, 0x7364, 0x7365, 0x7366, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_9f[] = {
/* 0x9f00 - 0x9fff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7367,
0x7368, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4524, 0x0000,
0x0000, 0x0000, 0x0000, 0x385d, 0x0000, 0x736a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x414d, 0x736b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x736c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4921, 0x0000, 0x0000, 0x736d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x736e, 0x6337, 0x0000, 0x0000, 0x6c5a, 0x706d,
0x0000, 0x0000, 0x736f, 0x0000, 0x7370, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7372,
0x7373, 0x7374, 0x4e70, 0x7371, 0x0000, 0x0000, 0x7375, 0x7376,
0x0000, 0x0000, 0x7378, 0x0000, 0x7377, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x737a, 0x0000, 0x0000, 0x0000, 0x737b, 0x7379,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e36, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x737c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x737d, 0x6354, 0x0000, 0x0000,
0x737e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0208_ff[] = {
/* 0xff00 - 0xffff */
0x0000, 0x212a, 0x2149, 0x2174, 0x2170, 0x2173, 0x2175, 0x216d,
0x214a, 0x214b, 0x2176, 0x215c, 0x2124, 0x213e, 0x2125, 0x213f,
0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337,
0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129,
0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347,
0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f,
0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357,
0x2358, 0x2359, 0x235a, 0x214e, 0x2140, 0x214f, 0x2130, 0x2132,
0x212e, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367,
0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f,
0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377,
0x2378, 0x2379, 0x237a, 0x2150, 0x2143, 0x2151, 0x2141, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2131, 0x0000, 0x216f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const * const unicode_to_jisx0208_map[0x100] = {
/* 0x00XX - 0x0fXX */
unicode_to_jisx0208_00,
0, 0,
unicode_to_jisx0208_03,
unicode_to_jisx0208_04,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x10XX - 0x1fXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x20XX - 0x2fXX */
unicode_to_jisx0208_20,
unicode_to_jisx0208_21,
unicode_to_jisx0208_22,
unicode_to_jisx0208_23,
unicode_to_jisx0208_24,
unicode_to_jisx0208_25,
unicode_to_jisx0208_26,
0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x30XX - 0x3fXX */
unicode_to_jisx0208_30,
0,
unicode_to_jisx0208_32,
unicode_to_jisx0208_33,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x40XX - 0x4fXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
unicode_to_jisx0208_4e,
unicode_to_jisx0208_4f,
/* 0x50XX - 0x5fXX */
unicode_to_jisx0208_50,
unicode_to_jisx0208_51,
unicode_to_jisx0208_52,
unicode_to_jisx0208_53,
unicode_to_jisx0208_54,
unicode_to_jisx0208_55,
unicode_to_jisx0208_56,
unicode_to_jisx0208_57,
unicode_to_jisx0208_58,
unicode_to_jisx0208_59,
unicode_to_jisx0208_5a,
unicode_to_jisx0208_5b,
unicode_to_jisx0208_5c,
unicode_to_jisx0208_5d,
unicode_to_jisx0208_5e,
unicode_to_jisx0208_5f,
/* 0x60XX - 0x6fXX */
unicode_to_jisx0208_60,
unicode_to_jisx0208_61,
unicode_to_jisx0208_62,
unicode_to_jisx0208_63,
unicode_to_jisx0208_64,
unicode_to_jisx0208_65,
unicode_to_jisx0208_66,
unicode_to_jisx0208_67,
unicode_to_jisx0208_68,
unicode_to_jisx0208_69,
unicode_to_jisx0208_6a,
unicode_to_jisx0208_6b,
unicode_to_jisx0208_6c,
unicode_to_jisx0208_6d,
unicode_to_jisx0208_6e,
unicode_to_jisx0208_6f,
/* 0x70XX - 0x7fXX */
unicode_to_jisx0208_70,
unicode_to_jisx0208_71,
unicode_to_jisx0208_72,
unicode_to_jisx0208_73,
unicode_to_jisx0208_74,
unicode_to_jisx0208_75,
unicode_to_jisx0208_76,
unicode_to_jisx0208_77,
unicode_to_jisx0208_78,
unicode_to_jisx0208_79,
unicode_to_jisx0208_7a,
unicode_to_jisx0208_7b,
unicode_to_jisx0208_7c,
unicode_to_jisx0208_7d,
unicode_to_jisx0208_7e,
unicode_to_jisx0208_7f,
/* 0x80XX - 0x8fXX */
unicode_to_jisx0208_80,
unicode_to_jisx0208_81,
unicode_to_jisx0208_82,
unicode_to_jisx0208_83,
unicode_to_jisx0208_84,
unicode_to_jisx0208_85,
unicode_to_jisx0208_86,
unicode_to_jisx0208_87,
unicode_to_jisx0208_88,
unicode_to_jisx0208_89,
unicode_to_jisx0208_8a,
unicode_to_jisx0208_8b,
unicode_to_jisx0208_8c,
unicode_to_jisx0208_8d,
unicode_to_jisx0208_8e,
unicode_to_jisx0208_8f,
/* 0x90XX - 0x9fXX */
unicode_to_jisx0208_90,
unicode_to_jisx0208_91,
unicode_to_jisx0208_92,
unicode_to_jisx0208_93,
unicode_to_jisx0208_94,
unicode_to_jisx0208_95,
unicode_to_jisx0208_96,
unicode_to_jisx0208_97,
unicode_to_jisx0208_98,
unicode_to_jisx0208_99,
unicode_to_jisx0208_9a,
unicode_to_jisx0208_9b,
unicode_to_jisx0208_9c,
unicode_to_jisx0208_9d,
unicode_to_jisx0208_9e,
unicode_to_jisx0208_9f,
/* 0xa0XX - 0xafXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xb0XX - 0xbfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xc0XX - 0xcfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xd0XX - 0xdfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xe0XX - 0xefXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xf0XX - 0xffXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
unicode_to_jisx0208_ff,
};
static uint unicode11ToJisx0208(uint h, uint l)
{
unsigned short const *table;
table = unicode_to_jisx0208_map[h];
if (table != 0) {
return table[l];
}
return 0x0000;
}
#ifdef USE_JISX0212
/*
* This data is derived from Unicode 1.1,
* JIS X 0212 (1990) to Unicode mapping table version 0.9 .
* (In addition IBM Vender Defined Char included)
*/
static unsigned short const jisx0212_to_unicode[] = {
/* 0x2121 - 0x217e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2221 - 0x227e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02d8,
0x02c7, 0x00b8, 0x02d9, 0x02dd, 0x00af, 0x02db, 0x02da, 0x007e,
0x0384, 0x0385, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x00a1, 0x00a6, 0x00bf, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x00ba, 0x00aa, 0x00a9, 0x00ae, 0x2122,
0x00a4, 0x2116, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2321 - 0x237e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2421 - 0x247e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2521 - 0x257e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2621 - 0x267e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c,
0x0000, 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0000,
0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc,
0x03c2, 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000,
/* 0x2721 - 0x277e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x040e, 0x040f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457,
0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x045e, 0x045f,
/* 0x2821 - 0x287e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2921 - 0x297e */
0x00c6, 0x0110, 0x0000, 0x0126, 0x0000, 0x0132, 0x0000,
0x0141, 0x013f, 0x0000, 0x014a, 0x00d8, 0x0152, 0x0000, 0x0166,
0x00de, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138,
0x0142, 0x0140, 0x0149, 0x014b, 0x00f8, 0x0153, 0x00df, 0x0167,
0x00fe, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2a21 - 0x2a7e */
0x00c1, 0x00c0, 0x00c4, 0x00c2, 0x0102, 0x01cd, 0x0100,
0x0104, 0x00c5, 0x00c3, 0x0106, 0x0108, 0x010c, 0x00c7, 0x010a,
0x010e, 0x00c9, 0x00c8, 0x00cb, 0x00ca, 0x011a, 0x0116, 0x0112,
0x0118, 0x0000, 0x011c, 0x011e, 0x0122, 0x0120, 0x0124, 0x00cd,
0x00cc, 0x00cf, 0x00ce, 0x01cf, 0x0130, 0x012a, 0x012e, 0x0128,
0x0134, 0x0136, 0x0139, 0x013d, 0x013b, 0x0143, 0x0147, 0x0145,
0x00d1, 0x00d3, 0x00d2, 0x00d6, 0x00d4, 0x01d1, 0x0150, 0x014c,
0x00d5, 0x0154, 0x0158, 0x0156, 0x015a, 0x015c, 0x0160, 0x015e,
0x0164, 0x0162, 0x00da, 0x00d9, 0x00dc, 0x00db, 0x016c, 0x01d3,
0x0170, 0x016a, 0x0172, 0x016e, 0x0168, 0x01d7, 0x01db, 0x01d9,
0x01d5, 0x0174, 0x00dd, 0x0178, 0x0176, 0x0179, 0x017d, 0x017b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2b21 - 0x2b7e */
0x00e1, 0x00e0, 0x00e4, 0x00e2, 0x0103, 0x01ce, 0x0101,
0x0105, 0x00e5, 0x00e3, 0x0107, 0x0109, 0x010d, 0x00e7, 0x010b,
0x010f, 0x00e9, 0x00e8, 0x00eb, 0x00ea, 0x011b, 0x0117, 0x0113,
0x0119, 0x01f5, 0x011d, 0x011f, 0x0000, 0x0121, 0x0125, 0x00ed,
0x00ec, 0x00ef, 0x00ee, 0x01d0, 0x0000, 0x012b, 0x012f, 0x0129,
0x0135, 0x0137, 0x013a, 0x013e, 0x013c, 0x0144, 0x0148, 0x0146,
0x00f1, 0x00f3, 0x00f2, 0x00f6, 0x00f4, 0x01d2, 0x0151, 0x014d,
0x00f5, 0x0155, 0x0159, 0x0157, 0x015b, 0x015d, 0x0161, 0x015f,
0x0165, 0x0163, 0x00fa, 0x00f9, 0x00fc, 0x00fb, 0x016d, 0x01d4,
0x0171, 0x016b, 0x0173, 0x016f, 0x0169, 0x01d8, 0x01dc, 0x01da,
0x01d6, 0x0175, 0x00fd, 0x00ff, 0x0177, 0x017a, 0x017e, 0x017c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2c21 - 0x2c7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2d21 - 0x2d7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2e21 - 0x2e7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x2f21 - 0x2f7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x3021 - 0x307e */
0x4e02, 0x4e04, 0x4e05, 0x4e0c, 0x4e12, 0x4e1f, 0x4e23,
0x4e24, 0x4e28, 0x4e2b, 0x4e2e, 0x4e2f, 0x4e30, 0x4e35, 0x4e40,
0x4e41, 0x4e44, 0x4e47, 0x4e51, 0x4e5a, 0x4e5c, 0x4e63, 0x4e68,
0x4e69, 0x4e74, 0x4e75, 0x4e79, 0x4e7f, 0x4e8d, 0x4e96, 0x4e97,
0x4e9d, 0x4eaf, 0x4eb9, 0x4ec3, 0x4ed0, 0x4eda, 0x4edb, 0x4ee0,
0x4ee1, 0x4ee2, 0x4ee8, 0x4eef, 0x4ef1, 0x4ef3, 0x4ef5, 0x4efd,
0x4efe, 0x4eff, 0x4f00, 0x4f02, 0x4f03, 0x4f08, 0x4f0b, 0x4f0c,
0x4f12, 0x4f15, 0x4f16, 0x4f17, 0x4f19, 0x4f2e, 0x4f31, 0x4f60,
0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f40, 0x4f42,
0x4f48, 0x4f49, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f58,
0x4f5f, 0x4f63, 0x4f6a, 0x4f6c, 0x4f6e, 0x4f71, 0x4f77, 0x4f78,
0x4f79, 0x4f7a, 0x4f7d, 0x4f7e, 0x4f81, 0x4f82, 0x4f84,
/* 0x3121 - 0x317e */
0x4f85, 0x4f89, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92,
0x4f93, 0x4f94, 0x4f97, 0x4f99, 0x4f9a, 0x4f9e, 0x4f9f, 0x4fb2,
0x4fb7, 0x4fb9, 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1,
0x4fc5, 0x4fc6, 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fcf,
0x4fd2, 0x4fdc, 0x4fe0, 0x4fe2, 0x4ff0, 0x4ff2, 0x4ffc, 0x4ffd,
0x4fff, 0x5000, 0x5001, 0x5004, 0x5007, 0x500a, 0x500c, 0x500e,
0x5010, 0x5013, 0x5017, 0x5018, 0x501b, 0x501c, 0x501d, 0x501e,
0x5022, 0x5027, 0x502e, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040,
0x5041, 0x5042, 0x5045, 0x5046, 0x504a, 0x504c, 0x504e, 0x5051,
0x5052, 0x5053, 0x5057, 0x5059, 0x505f, 0x5060, 0x5062, 0x5063,
0x5066, 0x5067, 0x506a, 0x506d, 0x5070, 0x5071, 0x503b, 0x5081,
0x5083, 0x5084, 0x5086, 0x508a, 0x508e, 0x508f, 0x5090,
/* 0x3221 - 0x327e */
0x5092, 0x5093, 0x5094, 0x5096, 0x509b, 0x509c, 0x509e,
0x509f, 0x50a0, 0x50a1, 0x50a2, 0x50aa, 0x50af, 0x50b0, 0x50b9,
0x50ba, 0x50bd, 0x50c0, 0x50c3, 0x50c4, 0x50c7, 0x50cc, 0x50ce,
0x50d0, 0x50d3, 0x50d4, 0x50d8, 0x50dc, 0x50dd, 0x50df, 0x50e2,
0x50e4, 0x50e6, 0x50e8, 0x50e9, 0x50ef, 0x50f1, 0x50f6, 0x50fa,
0x50fe, 0x5103, 0x5106, 0x5107, 0x5108, 0x510b, 0x510c, 0x510d,
0x510e, 0x50f2, 0x5110, 0x5117, 0x5119, 0x511b, 0x511c, 0x511d,
0x511e, 0x5123, 0x5127, 0x5128, 0x512c, 0x512d, 0x512f, 0x5131,
0x5133, 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514a, 0x514f,
0x5153, 0x5155, 0x5157, 0x5158, 0x515f, 0x5164, 0x5166, 0x517e,
0x5183, 0x5184, 0x518b, 0x518e, 0x5198, 0x519d, 0x51a1, 0x51a3,
0x51ad, 0x51b8, 0x51ba, 0x51bc, 0x51be, 0x51bf, 0x51c2,
/* 0x3321 - 0x337e */
0x51c8, 0x51cf, 0x51d1, 0x51d2, 0x51d3, 0x51d5, 0x51d8,
0x51de, 0x51e2, 0x51e5, 0x51ee, 0x51f2, 0x51f3, 0x51f4, 0x51f7,
0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218,
0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523c, 0x5245, 0x5249,
0x5255, 0x5257, 0x5258, 0x525a, 0x525c, 0x525f, 0x5260, 0x5261,
0x5266, 0x526e, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285,
0x528a, 0x528c, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529a,
0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52af, 0x52b0, 0x52b6,
0x52b7, 0x52b8, 0x52ba, 0x52bb, 0x52bd, 0x52c0, 0x52c4, 0x52c6,
0x52c8, 0x52cc, 0x52cf, 0x52d1, 0x52d4, 0x52d6, 0x52db, 0x52dc,
0x52e1, 0x52e5, 0x52e8, 0x52e9, 0x52ea, 0x52ec, 0x52f0, 0x52f1,
0x52f4, 0x52f6, 0x52f7, 0x5300, 0x5303, 0x530a, 0x530b,
/* 0x3421 - 0x347e */
0x530c, 0x5311, 0x5313, 0x5318, 0x531b, 0x531c, 0x531e,
0x531f, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d,
0x5330, 0x5332, 0x5335, 0x533c, 0x533d, 0x533e, 0x5342, 0x534c,
0x534b, 0x5359, 0x535b, 0x5361, 0x5363, 0x5365, 0x536c, 0x536d,
0x5372, 0x5379, 0x537e, 0x5383, 0x5387, 0x5388, 0x538e, 0x5393,
0x5394, 0x5399, 0x539d, 0x53a1, 0x53a4, 0x53aa, 0x53ab, 0x53af,
0x53b2, 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53ba, 0x53bd, 0x53c0,
0x53c5, 0x53cf, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dd, 0x53de,
0x53e0, 0x53e6, 0x53e7, 0x53f5, 0x5402, 0x5413, 0x541a, 0x5421,
0x5427, 0x5428, 0x542a, 0x542f, 0x5431, 0x5434, 0x5435, 0x5443,
0x5444, 0x5447, 0x544d, 0x544f, 0x545e, 0x5462, 0x5464, 0x5466,
0x5467, 0x5469, 0x546b, 0x546d, 0x546e, 0x5474, 0x547f,
/* 0x3521 - 0x357e */
0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548d, 0x5491,
0x5495, 0x5496, 0x549c, 0x549f, 0x54a1, 0x54a6, 0x54a7, 0x54a9,
0x54aa, 0x54ad, 0x54ae, 0x54b1, 0x54b7, 0x54b9, 0x54ba, 0x54bb,
0x54bf, 0x54c6, 0x54ca, 0x54cd, 0x54ce, 0x54e0, 0x54ea, 0x54ec,
0x54ef, 0x54f6, 0x54fc, 0x54fe, 0x54ff, 0x5500, 0x5501, 0x5505,
0x5508, 0x5509, 0x550c, 0x550d, 0x550e, 0x5515, 0x552a, 0x552b,
0x5532, 0x5535, 0x5536, 0x553b, 0x553c, 0x553d, 0x5541, 0x5547,
0x5549, 0x554a, 0x554d, 0x5550, 0x5551, 0x5558, 0x555a, 0x555b,
0x555e, 0x5560, 0x5561, 0x5564, 0x5566, 0x557f, 0x5581, 0x5582,
0x5586, 0x5588, 0x558e, 0x558f, 0x5591, 0x5592, 0x5593, 0x5594,
0x5597, 0x55a3, 0x55a4, 0x55ad, 0x55b2, 0x55bf, 0x55c1, 0x55c3,
0x55c6, 0x55c9, 0x55cb, 0x55cc, 0x55ce, 0x55d1, 0x55d2,
/* 0x3621 - 0x367e */
0x55d3, 0x55d7, 0x55d8, 0x55db, 0x55de, 0x55e2, 0x55e9,
0x55f6, 0x55ff, 0x5605, 0x5608, 0x560a, 0x560d, 0x560e, 0x560f,
0x5610, 0x5611, 0x5612, 0x5619, 0x562c, 0x5630, 0x5633, 0x5635,
0x5637, 0x5639, 0x563b, 0x563c, 0x563d, 0x563f, 0x5640, 0x5641,
0x5643, 0x5644, 0x5646, 0x5649, 0x564b, 0x564d, 0x564f, 0x5654,
0x565e, 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566d,
0x566f, 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568b,
0x568c, 0x5695, 0x5699, 0x569a, 0x569d, 0x569e, 0x569f, 0x56a6,
0x56a7, 0x56a8, 0x56a9, 0x56ab, 0x56ac, 0x56ad, 0x56b1, 0x56b3,
0x56b7, 0x56be, 0x56c5, 0x56c9, 0x56ca, 0x56cb, 0x56cf, 0x56d0,
0x56cc, 0x56cd, 0x56d9, 0x56dc, 0x56dd, 0x56df, 0x56e1, 0x56e4,
0x56e5, 0x56e6, 0x56e7, 0x56e8, 0x56f1, 0x56eb, 0x56ed,
/* 0x3721 - 0x377e */
0x56f6, 0x56f7, 0x5701, 0x5702, 0x5707, 0x570a, 0x570c,
0x5711, 0x5715, 0x571a, 0x571b, 0x571d, 0x5720, 0x5722, 0x5723,
0x5724, 0x5725, 0x5729, 0x572a, 0x572c, 0x572e, 0x572f, 0x5733,
0x5734, 0x573d, 0x573e, 0x573f, 0x5745, 0x5746, 0x574c, 0x574d,
0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576b, 0x576d, 0x576e,
0x576f, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779,
0x577a, 0x577b, 0x577c, 0x577e, 0x5781, 0x5783, 0x578c, 0x5794,
0x5797, 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, 0x579f, 0x57a1,
0x5795, 0x57a7, 0x57a8, 0x57a9, 0x57ac, 0x57b8, 0x57bd, 0x57c7,
0x57c8, 0x57cc, 0x57cf, 0x57d5, 0x57dd, 0x57de, 0x57e4, 0x57e6,
0x57e7, 0x57e9, 0x57ed, 0x57f0, 0x57f5, 0x57f6, 0x57f8, 0x57fd,
0x57fe, 0x57ff, 0x5803, 0x5804, 0x5808, 0x5809, 0x57e1,
/* 0x3821 - 0x387e */
0x580c, 0x580d, 0x581b, 0x581e, 0x581f, 0x5820, 0x5826,
0x5827, 0x582d, 0x5832, 0x5839, 0x583f, 0x5849, 0x584c, 0x584d,
0x584f, 0x5850, 0x5855, 0x585f, 0x5861, 0x5864, 0x5867, 0x5868,
0x5878, 0x587c, 0x587f, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889,
0x588a, 0x588c, 0x588d, 0x588f, 0x5890, 0x5894, 0x5896, 0x589d,
0x58a0, 0x58a1, 0x58a2, 0x58a6, 0x58a9, 0x58b1, 0x58b2, 0x58c4,
0x58bc, 0x58c2, 0x58c8, 0x58cd, 0x58ce, 0x58d0, 0x58d2, 0x58d4,
0x58d6, 0x58da, 0x58dd, 0x58e1, 0x58e2, 0x58e9, 0x58f3, 0x5905,
0x5906, 0x590b, 0x590c, 0x5912, 0x5913, 0x5914, 0x8641, 0x591d,
0x5921, 0x5923, 0x5924, 0x5928, 0x592f, 0x5930, 0x5933, 0x5935,
0x5936, 0x593f, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595b,
0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x596b, 0x596d,
/* 0x3921 - 0x397e */
0x596f, 0x5972, 0x5975, 0x5976, 0x5979, 0x597b, 0x597c,
0x598b, 0x598c, 0x598e, 0x5992, 0x5995, 0x5997, 0x599f, 0x59a4,
0x59a7, 0x59ad, 0x59ae, 0x59af, 0x59b0, 0x59b3, 0x59b7, 0x59ba,
0x59bc, 0x59c1, 0x59c3, 0x59c4, 0x59c8, 0x59ca, 0x59cd, 0x59d2,
0x59dd, 0x59de, 0x59df, 0x59e3, 0x59e4, 0x59e7, 0x59ee, 0x59ef,
0x59f1, 0x59f2, 0x59f4, 0x59f7, 0x5a00, 0x5a04, 0x5a0c, 0x5a0d,
0x5a0e, 0x5a12, 0x5a13, 0x5a1e, 0x5a23, 0x5a24, 0x5a27, 0x5a28,
0x5a2a, 0x5a2d, 0x5a30, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4c,
0x5a50, 0x5a55, 0x5a5e, 0x5a63, 0x5a65, 0x5a67, 0x5a6d, 0x5a77,
0x5a7a, 0x5a7b, 0x5a7e, 0x5a8b, 0x5a90, 0x5a93, 0x5a96, 0x5a99,
0x5a9c, 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa2, 0x5aa7, 0x5aac, 0x5ab1,
0x5ab2, 0x5ab3, 0x5ab5, 0x5ab8, 0x5aba, 0x5abb, 0x5abf,
/* 0x3a21 - 0x3a7e */
0x5ac4, 0x5ac6, 0x5ac8, 0x5acf, 0x5ada, 0x5adc, 0x5ae0,
0x5ae5, 0x5aea, 0x5aee, 0x5af5, 0x5af6, 0x5afd, 0x5b00, 0x5b01,
0x5b08, 0x5b17, 0x5b34, 0x5b19, 0x5b1b, 0x5b1d, 0x5b21, 0x5b25,
0x5b2d, 0x5b38, 0x5b41, 0x5b4b, 0x5b4c, 0x5b52, 0x5b56, 0x5b5e,
0x5b68, 0x5b6e, 0x5b6f, 0x5b7c, 0x5b7d, 0x5b7e, 0x5b7f, 0x5b81,
0x5b84, 0x5b86, 0x5b8a, 0x5b8e, 0x5b90, 0x5b91, 0x5b93, 0x5b94,
0x5b96, 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5baf, 0x5bb1, 0x5bb2,
0x5bb7, 0x5bba, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bcd, 0x5bcf, 0x5bd6,
0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, 0x5be0, 0x5bef, 0x5bf1, 0x5bf4,
0x5bfd, 0x5c0c, 0x5c17, 0x5c1e, 0x5c1f, 0x5c23, 0x5c26, 0x5c29,
0x5c2b, 0x5c2c, 0x5c2e, 0x5c30, 0x5c32, 0x5c35, 0x5c36, 0x5c59,
0x5c5a, 0x5c5c, 0x5c62, 0x5c63, 0x5c67, 0x5c68, 0x5c69,
/* 0x3b21 - 0x3b7e */
0x5c6d, 0x5c70, 0x5c74, 0x5c75, 0x5c7a, 0x5c7b, 0x5c7c,
0x5c7d, 0x5c87, 0x5c88, 0x5c8a, 0x5c8f, 0x5c92, 0x5c9d, 0x5c9f,
0x5ca0, 0x5ca2, 0x5ca3, 0x5ca6, 0x5caa, 0x5cb2, 0x5cb4, 0x5cb5,
0x5cba, 0x5cc9, 0x5ccb, 0x5cd2, 0x5cdd, 0x5cd7, 0x5cee, 0x5cf1,
0x5cf2, 0x5cf4, 0x5d01, 0x5d06, 0x5d0d, 0x5d12, 0x5d2b, 0x5d23,
0x5d24, 0x5d26, 0x5d27, 0x5d31, 0x5d34, 0x5d39, 0x5d3d, 0x5d3f,
0x5d42, 0x5d43, 0x5d46, 0x5d48, 0x5d55, 0x5d51, 0x5d59, 0x5d4a,
0x5d5f, 0x5d60, 0x5d61, 0x5d62, 0x5d64, 0x5d6a, 0x5d6d, 0x5d70,
0x5d79, 0x5d7a, 0x5d7e, 0x5d7f, 0x5d81, 0x5d83, 0x5d88, 0x5d8a,
0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d99, 0x5d9b, 0x5d9f, 0x5da0,
0x5da7, 0x5dab, 0x5db0, 0x5db4, 0x5db8, 0x5db9, 0x5dc3, 0x5dc7,
0x5dcb, 0x5dd0, 0x5dce, 0x5dd8, 0x5dd9, 0x5de0, 0x5de4,
/* 0x3c21 - 0x3c7e */
0x5de9, 0x5df8, 0x5df9, 0x5e00, 0x5e07, 0x5e0d, 0x5e12,
0x5e14, 0x5e15, 0x5e18, 0x5e1f, 0x5e20, 0x5e2e, 0x5e28, 0x5e32,
0x5e35, 0x5e3e, 0x5e4b, 0x5e50, 0x5e49, 0x5e51, 0x5e56, 0x5e58,
0x5e5b, 0x5e5c, 0x5e5e, 0x5e68, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d,
0x5e6e, 0x5e70, 0x5e80, 0x5e8b, 0x5e8e, 0x5ea2, 0x5ea4, 0x5ea5,
0x5ea8, 0x5eaa, 0x5eac, 0x5eb1, 0x5eb3, 0x5ebd, 0x5ebe, 0x5ebf,
0x5ec6, 0x5ecc, 0x5ecb, 0x5ece, 0x5ed1, 0x5ed2, 0x5ed4, 0x5ed5,
0x5edc, 0x5ede, 0x5ee5, 0x5eeb, 0x5f02, 0x5f06, 0x5f07, 0x5f08,
0x5f0e, 0x5f19, 0x5f1c, 0x5f1d, 0x5f21, 0x5f22, 0x5f23, 0x5f24,
0x5f28, 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f34, 0x5f36, 0x5f3b,
0x5f3d, 0x5f3f, 0x5f40, 0x5f44, 0x5f45, 0x5f47, 0x5f4d, 0x5f50,
0x5f54, 0x5f58, 0x5f5b, 0x5f60, 0x5f63, 0x5f64, 0x5f67,
/* 0x3d21 - 0x3d7e */
0x5f6f, 0x5f72, 0x5f74, 0x5f75, 0x5f78, 0x5f7a, 0x5f7d,
0x5f7e, 0x5f89, 0x5f8d, 0x5f8f, 0x5f96, 0x5f9c, 0x5f9d, 0x5fa2,
0x5fa7, 0x5fab, 0x5fa4, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb8,
0x5fc4, 0x5fc7, 0x5fc8, 0x5fc9, 0x5fcb, 0x5fd0, 0x5fd1, 0x5fd2,
0x5fd3, 0x5fd4, 0x5fde, 0x5fe1, 0x5fe2, 0x5fe8, 0x5fe9, 0x5fea,
0x5fec, 0x5fed, 0x5fee, 0x5fef, 0x5ff2, 0x5ff3, 0x5ff6, 0x5ffa,
0x5ffc, 0x6007, 0x600a, 0x600d, 0x6013, 0x6014, 0x6017, 0x6018,
0x601a, 0x601f, 0x6024, 0x602d, 0x6033, 0x6035, 0x6040, 0x6047,
0x6048, 0x6049, 0x604c, 0x6051, 0x6054, 0x6056, 0x6057, 0x605d,
0x6061, 0x6067, 0x6071, 0x607e, 0x607f, 0x6082, 0x6086, 0x6088,
0x608a, 0x608e, 0x6091, 0x6093, 0x6095, 0x6098, 0x609d, 0x609e,
0x60a2, 0x60a4, 0x60a5, 0x60a8, 0x60b0, 0x60b1, 0x60b7,
/* 0x3e21 - 0x3e7e */
0x60bb, 0x60be, 0x60c2, 0x60c4, 0x60c8, 0x60c9, 0x60ca,
0x60cb, 0x60ce, 0x60cf, 0x60d4, 0x60d5, 0x60d9, 0x60db, 0x60dd,
0x60de, 0x60e2, 0x60e5, 0x60f2, 0x60f5, 0x60f8, 0x60fc, 0x60fd,
0x6102, 0x6107, 0x610a, 0x610c, 0x6110, 0x6111, 0x6112, 0x6113,
0x6114, 0x6116, 0x6117, 0x6119, 0x611c, 0x611e, 0x6122, 0x612a,
0x612b, 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141,
0x6145, 0x6146, 0x6149, 0x615e, 0x6160, 0x616c, 0x6172, 0x6178,
0x617b, 0x617c, 0x617f, 0x6180, 0x6181, 0x6183, 0x6184, 0x618b,
0x618d, 0x6192, 0x6193, 0x6197, 0x6198, 0x619c, 0x619d, 0x619f,
0x61a0, 0x61a5, 0x61a8, 0x61aa, 0x61ad, 0x61b8, 0x61b9, 0x61bc,
0x61c0, 0x61c1, 0x61c2, 0x61ce, 0x61cf, 0x61d5, 0x61dc, 0x61dd,
0x61de, 0x61df, 0x61e1, 0x61e2, 0x61e7, 0x61e9, 0x61e5,
/* 0x3f21 - 0x3f7e */
0x61ec, 0x61ed, 0x61ef, 0x6201, 0x6203, 0x6204, 0x6207,
0x6213, 0x6215, 0x621c, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229,
0x622b, 0x6239, 0x623d, 0x6242, 0x6243, 0x6244, 0x6246, 0x624c,
0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625a, 0x625c, 0x6264,
0x626d, 0x626f, 0x6273, 0x627a, 0x627d, 0x628d, 0x628e, 0x628f,
0x6290, 0x62a6, 0x62a8, 0x62b3, 0x62b6, 0x62b7, 0x62ba, 0x62be,
0x62bf, 0x62c4, 0x62ce, 0x62d5, 0x62d6, 0x62da, 0x62ea, 0x62f2,
0x62f4, 0x62fc, 0x62fd, 0x6303, 0x6304, 0x630a, 0x630b, 0x630d,
0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632a, 0x632d, 0x6335,
0x6336, 0x6339, 0x633c, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346,
0x634a, 0x634b, 0x634e, 0x6352, 0x6353, 0x6354, 0x6358, 0x635b,
0x6365, 0x6366, 0x636c, 0x636d, 0x6371, 0x6374, 0x6375,
/* 0x4021 - 0x407e */
0x6378, 0x637c, 0x637d, 0x637f, 0x6382, 0x6384, 0x6387,
0x638a, 0x6390, 0x6394, 0x6395, 0x6399, 0x639a, 0x639e, 0x63a4,
0x63a6, 0x63ad, 0x63ae, 0x63af, 0x63bd, 0x63c1, 0x63c5, 0x63c8,
0x63ce, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63dc, 0x63e0, 0x63e5,
0x63ea, 0x63ec, 0x63f2, 0x63f3, 0x63f5, 0x63f8, 0x63f9, 0x6409,
0x640a, 0x6410, 0x6412, 0x6414, 0x6418, 0x641e, 0x6420, 0x6422,
0x6424, 0x6425, 0x6429, 0x642a, 0x642f, 0x6430, 0x6435, 0x643d,
0x643f, 0x644b, 0x644f, 0x6451, 0x6452, 0x6453, 0x6454, 0x645a,
0x645b, 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6463, 0x646d,
0x6473, 0x6474, 0x647b, 0x647d, 0x6485, 0x6487, 0x648f, 0x6490,
0x6491, 0x6498, 0x6499, 0x649b, 0x649d, 0x649f, 0x64a1, 0x64a3,
0x64a6, 0x64a8, 0x64ac, 0x64b3, 0x64bd, 0x64be, 0x64bf,
/* 0x4121 - 0x417e */
0x64c4, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64ce, 0x64d0,
0x64d1, 0x64d5, 0x64d7, 0x64e4, 0x64e5, 0x64e9, 0x64ea, 0x64ed,
0x64f0, 0x64f5, 0x64f7, 0x64fb, 0x64ff, 0x6501, 0x6504, 0x6508,
0x6509, 0x650a, 0x650f, 0x6513, 0x6514, 0x6516, 0x6519, 0x651b,
0x651e, 0x651f, 0x6522, 0x6526, 0x6529, 0x652e, 0x6531, 0x653a,
0x653c, 0x653d, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554,
0x655f, 0x6560, 0x6567, 0x656b, 0x657a, 0x657d, 0x6581, 0x6585,
0x658a, 0x6592, 0x6595, 0x6598, 0x659d, 0x65a0, 0x65a3, 0x65a6,
0x65ae, 0x65b2, 0x65b3, 0x65b4, 0x65bf, 0x65c2, 0x65c8, 0x65c9,
0x65ce, 0x65d0, 0x65d4, 0x65d6, 0x65d8, 0x65df, 0x65f0, 0x65f2,
0x65f4, 0x65f5, 0x65f9, 0x65fe, 0x65ff, 0x6600, 0x6604, 0x6608,
0x6609, 0x660d, 0x6611, 0x6612, 0x6615, 0x6616, 0x661d,
/* 0x4221 - 0x427e */
0x661e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629,
0x662a, 0x662b, 0x662c, 0x662e, 0x6630, 0x6631, 0x6633, 0x6639,
0x6637, 0x6640, 0x6645, 0x6646, 0x664a, 0x664c, 0x6651, 0x664e,
0x6657, 0x6658, 0x6659, 0x665b, 0x665c, 0x6660, 0x6661, 0x66fb,
0x666a, 0x666b, 0x666c, 0x667e, 0x6673, 0x6675, 0x667f, 0x6677,
0x6678, 0x6679, 0x667b, 0x6680, 0x667c, 0x668b, 0x668c, 0x668d,
0x6690, 0x6692, 0x6699, 0x669a, 0x669b, 0x669c, 0x669f, 0x66a0,
0x66a4, 0x66ad, 0x66b1, 0x66b2, 0x66b5, 0x66bb, 0x66bf, 0x66c0,
0x66c2, 0x66c3, 0x66c8, 0x66cc, 0x66ce, 0x66cf, 0x66d4, 0x66db,
0x66df, 0x66e8, 0x66eb, 0x66ec, 0x66ee, 0x66fa, 0x6705, 0x6707,
0x670e, 0x6713, 0x6719, 0x671c, 0x6720, 0x6722, 0x6733, 0x673e,
0x6745, 0x6747, 0x6748, 0x674c, 0x6754, 0x6755, 0x675d,
/* 0x4321 - 0x437e */
0x6766, 0x676c, 0x676e, 0x6774, 0x6776, 0x677b, 0x6781,
0x6784, 0x678e, 0x678f, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799,
0x679b, 0x67b0, 0x67b1, 0x67b2, 0x67b5, 0x67bb, 0x67bc, 0x67bd,
0x67f9, 0x67c0, 0x67c2, 0x67c3, 0x67c5, 0x67c8, 0x67c9, 0x67d2,
0x67d7, 0x67d9, 0x67dc, 0x67e1, 0x67e6, 0x67f0, 0x67f2, 0x67f6,
0x67f7, 0x6852, 0x6814, 0x6819, 0x681d, 0x681f, 0x6828, 0x6827,
0x682c, 0x682d, 0x682f, 0x6830, 0x6831, 0x6833, 0x683b, 0x683f,
0x6844, 0x6845, 0x684a, 0x684c, 0x6855, 0x6857, 0x6858, 0x685b,
0x686b, 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879,
0x687a, 0x687b, 0x687c, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896,
0x6898, 0x689a, 0x689c, 0x68a1, 0x68a3, 0x68a5, 0x68a9, 0x68aa,
0x68ae, 0x68b2, 0x68bb, 0x68c5, 0x68c8, 0x68cc, 0x68cf,
/* 0x4421 - 0x447e */
0x68d0, 0x68d1, 0x68d3, 0x68d6, 0x68d9, 0x68dc, 0x68dd,
0x68e5, 0x68e8, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68f0, 0x68f1,
0x68f5, 0x68f6, 0x68fb, 0x68fc, 0x68fd, 0x6906, 0x6909, 0x690a,
0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935,
0x6938, 0x693b, 0x6942, 0x6945, 0x6949, 0x694e, 0x6957, 0x695b,
0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696c, 0x6970,
0x6971, 0x6972, 0x697a, 0x697b, 0x697f, 0x6980, 0x698d, 0x6992,
0x6996, 0x6998, 0x69a1, 0x69a5, 0x69a6, 0x69a8, 0x69ab, 0x69ad,
0x69af, 0x69b7, 0x69b8, 0x69ba, 0x69bc, 0x69c5, 0x69c8, 0x69d1,
0x69d6, 0x69d7, 0x69e2, 0x69e5, 0x69ee, 0x69ef, 0x69f1, 0x69f3,
0x69f5, 0x69fe, 0x6a00, 0x6a01, 0x6a03, 0x6a0f, 0x6a11, 0x6a15,
0x6a1a, 0x6a1d, 0x6a20, 0x6a24, 0x6a28, 0x6a30, 0x6a32,
/* 0x4521 - 0x457e */
0x6a34, 0x6a37, 0x6a3b, 0x6a3e, 0x6a3f, 0x6a45, 0x6a46,
0x6a49, 0x6a4a, 0x6a4e, 0x6a50, 0x6a51, 0x6a52, 0x6a55, 0x6a56,
0x6a5b, 0x6a64, 0x6a67, 0x6a6a, 0x6a71, 0x6a73, 0x6a7e, 0x6a81,
0x6a83, 0x6a86, 0x6a87, 0x6a89, 0x6a8b, 0x6a91, 0x6a9b, 0x6a9d,
0x6a9e, 0x6a9f, 0x6aa5, 0x6aab, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab4,
0x6abd, 0x6abe, 0x6abf, 0x6ac6, 0x6ac9, 0x6ac8, 0x6acc, 0x6ad0,
0x6ad4, 0x6ad5, 0x6ad6, 0x6adc, 0x6add, 0x6ae4, 0x6ae7, 0x6aec,
0x6af0, 0x6af1, 0x6af2, 0x6afc, 0x6afd, 0x6b02, 0x6b03, 0x6b06,
0x6b07, 0x6b09, 0x6b0f, 0x6b10, 0x6b11, 0x6b17, 0x6b1b, 0x6b1e,
0x6b24, 0x6b28, 0x6b2b, 0x6b2c, 0x6b2f, 0x6b35, 0x6b36, 0x6b3b,
0x6b3f, 0x6b46, 0x6b4a, 0x6b4d, 0x6b52, 0x6b56, 0x6b58, 0x6b5d,
0x6b60, 0x6b67, 0x6b6b, 0x6b6e, 0x6b70, 0x6b75, 0x6b7d,
/* 0x4621 - 0x467e */
0x6b7e, 0x6b82, 0x6b85, 0x6b97, 0x6b9b, 0x6b9f, 0x6ba0,
0x6ba2, 0x6ba3, 0x6ba8, 0x6ba9, 0x6bac, 0x6bad, 0x6bae, 0x6bb0,
0x6bb8, 0x6bb9, 0x6bbd, 0x6bbe, 0x6bc3, 0x6bc4, 0x6bc9, 0x6bcc,
0x6bd6, 0x6bda, 0x6be1, 0x6be3, 0x6be6, 0x6be7, 0x6bee, 0x6bf1,
0x6bf7, 0x6bf9, 0x6bff, 0x6c02, 0x6c04, 0x6c05, 0x6c09, 0x6c0d,
0x6c0e, 0x6c10, 0x6c12, 0x6c19, 0x6c1f, 0x6c26, 0x6c27, 0x6c28,
0x6c2c, 0x6c2e, 0x6c33, 0x6c35, 0x6c36, 0x6c3a, 0x6c3b, 0x6c3f,
0x6c4a, 0x6c4b, 0x6c4d, 0x6c4f, 0x6c52, 0x6c54, 0x6c59, 0x6c5b,
0x6c5c, 0x6c6b, 0x6c6d, 0x6c6f, 0x6c74, 0x6c76, 0x6c78, 0x6c79,
0x6c7b, 0x6c85, 0x6c86, 0x6c87, 0x6c89, 0x6c94, 0x6c95, 0x6c97,
0x6c98, 0x6c9c, 0x6c9f, 0x6cb0, 0x6cb2, 0x6cb4, 0x6cc2, 0x6cc6,
0x6ccd, 0x6ccf, 0x6cd0, 0x6cd1, 0x6cd2, 0x6cd4, 0x6cd6,
/* 0x4721 - 0x477e */
0x6cda, 0x6cdc, 0x6ce0, 0x6ce7, 0x6ce9, 0x6ceb, 0x6cec,
0x6cee, 0x6cf2, 0x6cf4, 0x6d04, 0x6d07, 0x6d0a, 0x6d0e, 0x6d0f,
0x6d11, 0x6d13, 0x6d1a, 0x6d26, 0x6d27, 0x6d28, 0x6c67, 0x6d2e,
0x6d2f, 0x6d31, 0x6d39, 0x6d3c, 0x6d3f, 0x6d57, 0x6d5e, 0x6d5f,
0x6d61, 0x6d65, 0x6d67, 0x6d6f, 0x6d70, 0x6d7c, 0x6d82, 0x6d87,
0x6d91, 0x6d92, 0x6d94, 0x6d96, 0x6d97, 0x6d98, 0x6daa, 0x6dac,
0x6db4, 0x6db7, 0x6db9, 0x6dbd, 0x6dbf, 0x6dc4, 0x6dc8, 0x6dca,
0x6dce, 0x6dcf, 0x6dd6, 0x6ddb, 0x6ddd, 0x6ddf, 0x6de0, 0x6de2,
0x6de5, 0x6de9, 0x6def, 0x6df0, 0x6df4, 0x6df6, 0x6dfc, 0x6e00,
0x6e04, 0x6e1e, 0x6e22, 0x6e27, 0x6e32, 0x6e36, 0x6e39, 0x6e3b,
0x6e3c, 0x6e44, 0x6e45, 0x6e48, 0x6e49, 0x6e4b, 0x6e4f, 0x6e51,
0x6e52, 0x6e53, 0x6e54, 0x6e57, 0x6e5c, 0x6e5d, 0x6e5e,
/* 0x4821 - 0x487e */
0x6e62, 0x6e63, 0x6e68, 0x6e73, 0x6e7b, 0x6e7d, 0x6e8d,
0x6e93, 0x6e99, 0x6ea0, 0x6ea7, 0x6ead, 0x6eae, 0x6eb1, 0x6eb3,
0x6ebb, 0x6ebf, 0x6ec0, 0x6ec1, 0x6ec3, 0x6ec7, 0x6ec8, 0x6eca,
0x6ecd, 0x6ece, 0x6ecf, 0x6eeb, 0x6eed, 0x6eee, 0x6ef9, 0x6efb,
0x6efd, 0x6f04, 0x6f08, 0x6f0a, 0x6f0c, 0x6f0d, 0x6f16, 0x6f18,
0x6f1a, 0x6f1b, 0x6f26, 0x6f29, 0x6f2a, 0x6f2f, 0x6f30, 0x6f33,
0x6f36, 0x6f3b, 0x6f3c, 0x6f2d, 0x6f4f, 0x6f51, 0x6f52, 0x6f53,
0x6f57, 0x6f59, 0x6f5a, 0x6f5d, 0x6f5e, 0x6f61, 0x6f62, 0x6f68,
0x6f6c, 0x6f7d, 0x6f7e, 0x6f83, 0x6f87, 0x6f88, 0x6f8b, 0x6f8c,
0x6f8d, 0x6f90, 0x6f92, 0x6f93, 0x6f94, 0x6f96, 0x6f9a, 0x6f9f,
0x6fa0, 0x6fa5, 0x6fa6, 0x6fa7, 0x6fa8, 0x6fae, 0x6faf, 0x6fb0,
0x6fb5, 0x6fb6, 0x6fbc, 0x6fc5, 0x6fc7, 0x6fc8, 0x6fca,
/* 0x4921 - 0x497e */
0x6fda, 0x6fde, 0x6fe8, 0x6fe9, 0x6ff0, 0x6ff5, 0x6ff9,
0x6ffc, 0x6ffd, 0x7000, 0x7005, 0x7006, 0x7007, 0x700d, 0x7017,
0x7020, 0x7023, 0x702f, 0x7034, 0x7037, 0x7039, 0x703c, 0x7043,
0x7044, 0x7048, 0x7049, 0x704a, 0x704b, 0x7054, 0x7055, 0x705d,
0x705e, 0x704e, 0x7064, 0x7065, 0x706c, 0x706e, 0x7075, 0x7076,
0x707e, 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097,
0x7098, 0x709b, 0x70a4, 0x70ab, 0x70b0, 0x70b1, 0x70b4, 0x70b7,
0x70ca, 0x70d1, 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d8, 0x70dc,
0x70e4, 0x70fa, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710b,
0x710c, 0x710f, 0x711e, 0x7120, 0x712b, 0x712d, 0x712f, 0x7130,
0x7131, 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714a, 0x714b,
0x7150, 0x7152, 0x7157, 0x715a, 0x715c, 0x715e, 0x7160,
/* 0x4a21 - 0x4a7e */
0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718c, 0x7192,
0x719a, 0x719b, 0x71a0, 0x71a2, 0x71af, 0x71b0, 0x71b2, 0x71b3,
0x71ba, 0x71bf, 0x71c0, 0x71c1, 0x71c4, 0x71cb, 0x71cc, 0x71d3,
0x71d6, 0x71d9, 0x71da, 0x71dc, 0x71f8, 0x71fe, 0x7200, 0x7207,
0x7208, 0x7209, 0x7213, 0x7217, 0x721a, 0x721d, 0x721f, 0x7224,
0x722b, 0x722f, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243,
0x7245, 0x724e, 0x724f, 0x7250, 0x7253, 0x7255, 0x7256, 0x725a,
0x725c, 0x725e, 0x7260, 0x7263, 0x7268, 0x726b, 0x726e, 0x726f,
0x7271, 0x7277, 0x7278, 0x727b, 0x727c, 0x727f, 0x7284, 0x7289,
0x728d, 0x728e, 0x7293, 0x729b, 0x72a8, 0x72ad, 0x72ae, 0x72b1,
0x72b4, 0x72be, 0x72c1, 0x72c7, 0x72c9, 0x72cc, 0x72d5, 0x72d6,
0x72d8, 0x72df, 0x72e5, 0x72f3, 0x72f4, 0x72fa, 0x72fb,
/* 0x4b21 - 0x4b7e */
0x72fe, 0x7302, 0x7304, 0x7305, 0x7307, 0x730b, 0x730d,
0x7312, 0x7313, 0x7318, 0x7319, 0x731e, 0x7322, 0x7324, 0x7327,
0x7328, 0x732c, 0x7331, 0x7332, 0x7335, 0x733a, 0x733b, 0x733d,
0x7343, 0x734d, 0x7350, 0x7352, 0x7356, 0x7358, 0x735d, 0x735e,
0x735f, 0x7360, 0x7366, 0x7367, 0x7369, 0x736b, 0x736c, 0x736e,
0x736f, 0x7371, 0x7377, 0x7379, 0x737c, 0x7380, 0x7381, 0x7383,
0x7385, 0x7386, 0x738e, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398,
0x739c, 0x739e, 0x739f, 0x73a0, 0x73a2, 0x73a5, 0x73a6, 0x73aa,
0x73ab, 0x73ad, 0x73b5, 0x73b7, 0x73b9, 0x73bc, 0x73bd, 0x73bf,
0x73c5, 0x73c6, 0x73c9, 0x73cb, 0x73cc, 0x73cf, 0x73d2, 0x73d3,
0x73d6, 0x73d9, 0x73dd, 0x73e1, 0x73e3, 0x73e6, 0x73e7, 0x73e9,
0x73f4, 0x73f5, 0x73f7, 0x73f9, 0x73fa, 0x73fb, 0x73fd,
/* 0x4c21 - 0x4c7e */
0x73ff, 0x7400, 0x7401, 0x7404, 0x7407, 0x740a, 0x7411,
0x741a, 0x741b, 0x7424, 0x7426, 0x7428, 0x7429, 0x742a, 0x742b,
0x742c, 0x742d, 0x742e, 0x742f, 0x7430, 0x7431, 0x7439, 0x7440,
0x7443, 0x7444, 0x7446, 0x7447, 0x744b, 0x744d, 0x7451, 0x7452,
0x7457, 0x745d, 0x7462, 0x7466, 0x7467, 0x7468, 0x746b, 0x746d,
0x746e, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487,
0x7489, 0x748f, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749a,
0x749c, 0x749f, 0x74a0, 0x74a1, 0x74a3, 0x74a6, 0x74a8, 0x74a9,
0x74aa, 0x74ab, 0x74ae, 0x74af, 0x74b1, 0x74b2, 0x74b5, 0x74b9,
0x74bb, 0x74bf, 0x74c8, 0x74c9, 0x74cc, 0x74d0, 0x74d3, 0x74d8,
0x74da, 0x74db, 0x74de, 0x74df, 0x74e4, 0x74e8, 0x74ea, 0x74eb,
0x74ef, 0x74f4, 0x74fa, 0x74fb, 0x74fc, 0x74ff, 0x7506,
/* 0x4d21 - 0x4d7e */
0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527,
0x7529, 0x752a, 0x752f, 0x7536, 0x7539, 0x753d, 0x753e, 0x753f,
0x7540, 0x7543, 0x7547, 0x7548, 0x754e, 0x7550, 0x7552, 0x7557,
0x755e, 0x755f, 0x7561, 0x756f, 0x7571, 0x7579, 0x757a, 0x757b,
0x757c, 0x757d, 0x757e, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593,
0x7595, 0x7599, 0x759c, 0x75a2, 0x75a4, 0x75b4, 0x75ba, 0x75bf,
0x75c0, 0x75c1, 0x75c4, 0x75c6, 0x75cc, 0x75ce, 0x75cf, 0x75d7,
0x75dc, 0x75df, 0x75e0, 0x75e1, 0x75e4, 0x75e7, 0x75ec, 0x75ee,
0x75ef, 0x75f1, 0x75f9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607,
0x7608, 0x760a, 0x760c, 0x760f, 0x7612, 0x7613, 0x7615, 0x7616,
0x7619, 0x761b, 0x761c, 0x761d, 0x761e, 0x7623, 0x7625, 0x7626,
0x7629, 0x762d, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639,
/* 0x4e21 - 0x4e7e */
0x763a, 0x763c, 0x764a, 0x7640, 0x7641, 0x7643, 0x7644,
0x7645, 0x7649, 0x764b, 0x7655, 0x7659, 0x765f, 0x7664, 0x7665,
0x766d, 0x766e, 0x766f, 0x7671, 0x7674, 0x7681, 0x7685, 0x768c,
0x768d, 0x7695, 0x769b, 0x769c, 0x769d, 0x769f, 0x76a0, 0x76a2,
0x76a3, 0x76a4, 0x76a5, 0x76a6, 0x76a7, 0x76a8, 0x76aa, 0x76ad,
0x76bd, 0x76c1, 0x76c5, 0x76c9, 0x76cb, 0x76cc, 0x76ce, 0x76d4,
0x76d9, 0x76e0, 0x76e6, 0x76e8, 0x76ec, 0x76f0, 0x76f1, 0x76f6,
0x76f9, 0x76fc, 0x7700, 0x7706, 0x770a, 0x770e, 0x7712, 0x7714,
0x7715, 0x7717, 0x7719, 0x771a, 0x771c, 0x7722, 0x7728, 0x772d,
0x772e, 0x772f, 0x7734, 0x7735, 0x7736, 0x7739, 0x773d, 0x773e,
0x7742, 0x7745, 0x7746, 0x774a, 0x774d, 0x774e, 0x774f, 0x7752,
0x7756, 0x7757, 0x775c, 0x775e, 0x775f, 0x7760, 0x7762,
/* 0x4f21 - 0x4f7e */
0x7764, 0x7767, 0x776a, 0x776c, 0x7770, 0x7772, 0x7773,
0x7774, 0x777a, 0x777d, 0x7780, 0x7784, 0x778c, 0x778d, 0x7794,
0x7795, 0x7796, 0x779a, 0x779f, 0x77a2, 0x77a7, 0x77aa, 0x77ae,
0x77af, 0x77b1, 0x77b5, 0x77be, 0x77c3, 0x77c9, 0x77d1, 0x77d2,
0x77d5, 0x77d9, 0x77de, 0x77df, 0x77e0, 0x77e4, 0x77e6, 0x77ea,
0x77ec, 0x77f0, 0x77f1, 0x77f4, 0x77f8, 0x77fb, 0x7805, 0x7806,
0x7809, 0x780d, 0x780e, 0x7811, 0x781d, 0x7821, 0x7822, 0x7823,
0x782d, 0x782e, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847,
0x7848, 0x784c, 0x784e, 0x7852, 0x785c, 0x785e, 0x7860, 0x7861,
0x7863, 0x7864, 0x7868, 0x786a, 0x786e, 0x787a, 0x787e, 0x788a,
0x788f, 0x7894, 0x7898, 0x78a1, 0x789d, 0x789e, 0x789f, 0x78a4,
0x78a8, 0x78ac, 0x78ad, 0x78b0, 0x78b1, 0x78b2, 0x78b3,
/* 0x5021 - 0x507e */
0x78bb, 0x78bd, 0x78bf, 0x78c7, 0x78c8, 0x78c9, 0x78cc,
0x78ce, 0x78d2, 0x78d3, 0x78d5, 0x78d6, 0x78e4, 0x78db, 0x78df,
0x78e0, 0x78e1, 0x78e6, 0x78ea, 0x78f2, 0x78f3, 0x7900, 0x78f6,
0x78f7, 0x78fa, 0x78fb, 0x78ff, 0x7906, 0x790c, 0x7910, 0x791a,
0x791c, 0x791e, 0x791f, 0x7920, 0x7925, 0x7927, 0x7929, 0x792d,
0x7931, 0x7934, 0x7935, 0x793b, 0x793d, 0x793f, 0x7944, 0x7945,
0x7946, 0x794a, 0x794b, 0x794f, 0x7951, 0x7954, 0x7958, 0x795b,
0x795c, 0x7967, 0x7969, 0x796b, 0x7972, 0x7979, 0x797b, 0x797c,
0x797e, 0x798b, 0x798c, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996,
0x7998, 0x799b, 0x799c, 0x79a1, 0x79a8, 0x79a9, 0x79ab, 0x79af,
0x79b1, 0x79b4, 0x79b8, 0x79bb, 0x79c2, 0x79c4, 0x79c7, 0x79c8,
0x79ca, 0x79cf, 0x79d4, 0x79d6, 0x79da, 0x79dd, 0x79de,
/* 0x5121 - 0x517e */
0x79e0, 0x79e2, 0x79e5, 0x79ea, 0x79eb, 0x79ed, 0x79f1,
0x79f8, 0x79fc, 0x7a02, 0x7a03, 0x7a07, 0x7a09, 0x7a0a, 0x7a0c,
0x7a11, 0x7a15, 0x7a1b, 0x7a1e, 0x7a21, 0x7a27, 0x7a2b, 0x7a2d,
0x7a2f, 0x7a30, 0x7a34, 0x7a35, 0x7a38, 0x7a39, 0x7a3a, 0x7a44,
0x7a45, 0x7a47, 0x7a48, 0x7a4c, 0x7a55, 0x7a56, 0x7a59, 0x7a5c,
0x7a5d, 0x7a5f, 0x7a60, 0x7a65, 0x7a67, 0x7a6a, 0x7a6d, 0x7a75,
0x7a78, 0x7a7e, 0x7a80, 0x7a82, 0x7a85, 0x7a86, 0x7a8a, 0x7a8b,
0x7a90, 0x7a91, 0x7a94, 0x7a9e, 0x7aa0, 0x7aa3, 0x7aac, 0x7ab3,
0x7ab5, 0x7ab9, 0x7abb, 0x7abc, 0x7ac6, 0x7ac9, 0x7acc, 0x7ace,
0x7ad1, 0x7adb, 0x7ae8, 0x7ae9, 0x7aeb, 0x7aec, 0x7af1, 0x7af4,
0x7afb, 0x7afd, 0x7afe, 0x7b07, 0x7b14, 0x7b1f, 0x7b23, 0x7b27,
0x7b29, 0x7b2a, 0x7b2b, 0x7b2d, 0x7b2e, 0x7b2f, 0x7b30,
/* 0x5221 - 0x527e */
0x7b31, 0x7b34, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b47,
0x7b4e, 0x7b55, 0x7b60, 0x7b64, 0x7b66, 0x7b69, 0x7b6a, 0x7b6d,
0x7b6f, 0x7b72, 0x7b73, 0x7b77, 0x7b84, 0x7b89, 0x7b8e, 0x7b90,
0x7b91, 0x7b96, 0x7b9b, 0x7b9e, 0x7ba0, 0x7ba5, 0x7bac, 0x7baf,
0x7bb0, 0x7bb2, 0x7bb5, 0x7bb6, 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd,
0x7bc2, 0x7bc5, 0x7bc8, 0x7bca, 0x7bd4, 0x7bd6, 0x7bd7, 0x7bd9,
0x7bda, 0x7bdb, 0x7be8, 0x7bea, 0x7bf2, 0x7bf4, 0x7bf5, 0x7bf8,
0x7bf9, 0x7bfa, 0x7bfc, 0x7bfe, 0x7c01, 0x7c02, 0x7c03, 0x7c04,
0x7c06, 0x7c09, 0x7c0b, 0x7c0c, 0x7c0e, 0x7c0f, 0x7c19, 0x7c1b,
0x7c20, 0x7c25, 0x7c26, 0x7c28, 0x7c2c, 0x7c31, 0x7c33, 0x7c34,
0x7c36, 0x7c39, 0x7c3a, 0x7c46, 0x7c4a, 0x7c55, 0x7c51, 0x7c52,
0x7c53, 0x7c59, 0x7c5a, 0x7c5b, 0x7c5c, 0x7c5d, 0x7c5e,
/* 0x5321 - 0x537e */
0x7c61, 0x7c63, 0x7c67, 0x7c69, 0x7c6d, 0x7c6e, 0x7c70,
0x7c72, 0x7c79, 0x7c7c, 0x7c7d, 0x7c86, 0x7c87, 0x7c8f, 0x7c94,
0x7c9e, 0x7ca0, 0x7ca6, 0x7cb0, 0x7cb6, 0x7cb7, 0x7cba, 0x7cbb,
0x7cbc, 0x7cbf, 0x7cc4, 0x7cc7, 0x7cc8, 0x7cc9, 0x7ccd, 0x7ccf,
0x7cd3, 0x7cd4, 0x7cd5, 0x7cd7, 0x7cd9, 0x7cda, 0x7cdd, 0x7ce6,
0x7ce9, 0x7ceb, 0x7cf5, 0x7d03, 0x7d07, 0x7d08, 0x7d09, 0x7d0f,
0x7d11, 0x7d12, 0x7d13, 0x7d16, 0x7d1d, 0x7d1e, 0x7d23, 0x7d26,
0x7d2a, 0x7d2d, 0x7d31, 0x7d3c, 0x7d3d, 0x7d3e, 0x7d40, 0x7d41,
0x7d47, 0x7d48, 0x7d4d, 0x7d51, 0x7d53, 0x7d57, 0x7d59, 0x7d5a,
0x7d5c, 0x7d5d, 0x7d65, 0x7d67, 0x7d6a, 0x7d70, 0x7d78, 0x7d7a,
0x7d7b, 0x7d7f, 0x7d81, 0x7d82, 0x7d83, 0x7d85, 0x7d86, 0x7d88,
0x7d8b, 0x7d8c, 0x7d8d, 0x7d91, 0x7d96, 0x7d97, 0x7d9d,
/* 0x5421 - 0x547e */
0x7d9e, 0x7da6, 0x7da7, 0x7daa, 0x7db3, 0x7db6, 0x7db7,
0x7db9, 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dcc, 0x7dcd,
0x7dce, 0x7dd7, 0x7dd9, 0x7e00, 0x7de2, 0x7de5, 0x7de6, 0x7dea,
0x7deb, 0x7ded, 0x7df1, 0x7df5, 0x7df6, 0x7df9, 0x7dfa, 0x7e08,
0x7e10, 0x7e11, 0x7e15, 0x7e17, 0x7e1c, 0x7e1d, 0x7e20, 0x7e27,
0x7e28, 0x7e2c, 0x7e2d, 0x7e2f, 0x7e33, 0x7e36, 0x7e3f, 0x7e44,
0x7e45, 0x7e47, 0x7e4e, 0x7e50, 0x7e52, 0x7e58, 0x7e5f, 0x7e61,
0x7e62, 0x7e65, 0x7e6b, 0x7e6e, 0x7e6f, 0x7e73, 0x7e78, 0x7e7e,
0x7e81, 0x7e86, 0x7e87, 0x7e8a, 0x7e8d, 0x7e91, 0x7e95, 0x7e98,
0x7e9a, 0x7e9d, 0x7e9e, 0x7f3c, 0x7f3b, 0x7f3d, 0x7f3e, 0x7f3f,
0x7f43, 0x7f44, 0x7f47, 0x7f4f, 0x7f52, 0x7f53, 0x7f5b, 0x7f5c,
0x7f5d, 0x7f61, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f6d,
/* 0x5521 - 0x557e */
0x7f71, 0x7f7d, 0x7f7e, 0x7f7f, 0x7f80, 0x7f8b, 0x7f8d,
0x7f8f, 0x7f90, 0x7f91, 0x7f96, 0x7f97, 0x7f9c, 0x7fa1, 0x7fa2,
0x7fa6, 0x7faa, 0x7fad, 0x7fb4, 0x7fbc, 0x7fbf, 0x7fc0, 0x7fc3,
0x7fc8, 0x7fce, 0x7fcf, 0x7fdb, 0x7fdf, 0x7fe3, 0x7fe5, 0x7fe8,
0x7fec, 0x7fee, 0x7fef, 0x7ff2, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff,
0x8007, 0x8008, 0x800a, 0x800d, 0x800e, 0x800f, 0x8011, 0x8013,
0x8014, 0x8016, 0x801d, 0x801e, 0x801f, 0x8020, 0x8024, 0x8026,
0x802c, 0x802e, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803a,
0x803c, 0x803e, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806d,
0x8071, 0x8075, 0x8081, 0x8088, 0x808e, 0x809c, 0x809e, 0x80a6,
0x80a7, 0x80ab, 0x80b8, 0x80b9, 0x80c8, 0x80cd, 0x80cf, 0x80d2,
0x80d4, 0x80d5, 0x80d7, 0x80d8, 0x80e0, 0x80ed, 0x80ee,
/* 0x5621 - 0x567e */
0x80f0, 0x80f2, 0x80f3, 0x80f6, 0x80f9, 0x80fa, 0x80fe,
0x8103, 0x810b, 0x8116, 0x8117, 0x8118, 0x811c, 0x811e, 0x8120,
0x8124, 0x8127, 0x812c, 0x8130, 0x8135, 0x813a, 0x813c, 0x8145,
0x8147, 0x814a, 0x814c, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167,
0x8168, 0x8169, 0x816d, 0x816f, 0x8177, 0x8181, 0x8190, 0x8184,
0x8185, 0x8186, 0x818b, 0x818e, 0x8196, 0x8198, 0x819b, 0x819e,
0x81a2, 0x81ae, 0x81b2, 0x81b4, 0x81bb, 0x81cb, 0x81c3, 0x81c5,
0x81ca, 0x81ce, 0x81cf, 0x81d5, 0x81d7, 0x81db, 0x81dd, 0x81de,
0x81e1, 0x81e4, 0x81eb, 0x81ec, 0x81f0, 0x81f1, 0x81f2, 0x81f5,
0x81f6, 0x81f8, 0x81f9, 0x81fd, 0x81ff, 0x8200, 0x8203, 0x820f,
0x8213, 0x8214, 0x8219, 0x821a, 0x821d, 0x8221, 0x8222, 0x8228,
0x8232, 0x8234, 0x823a, 0x8243, 0x8244, 0x8245, 0x8246,
/* 0x5721 - 0x577e */
0x824b, 0x824e, 0x824f, 0x8251, 0x8256, 0x825c, 0x8260,
0x8263, 0x8267, 0x826d, 0x8274, 0x827b, 0x827d, 0x827f, 0x8280,
0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828a, 0x828e, 0x8291,
0x8294, 0x8296, 0x8298, 0x829a, 0x829b, 0x82a0, 0x82a1, 0x82a3,
0x82a4, 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ae, 0x82b0, 0x82b2,
0x82b4, 0x82b7, 0x82ba, 0x82bc, 0x82be, 0x82bf, 0x82c6, 0x82d0,
0x82d5, 0x82da, 0x82e0, 0x82e2, 0x82e4, 0x82e8, 0x82ea, 0x82ed,
0x82ef, 0x82f6, 0x82f7, 0x82fd, 0x82fe, 0x8300, 0x8301, 0x8307,
0x8308, 0x830a, 0x830b, 0x8354, 0x831b, 0x831d, 0x831e, 0x831f,
0x8321, 0x8322, 0x832c, 0x832d, 0x832e, 0x8330, 0x8333, 0x8337,
0x833a, 0x833c, 0x833d, 0x8342, 0x8343, 0x8344, 0x8347, 0x834d,
0x834e, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378,
/* 0x5821 - 0x587e */
0x837d, 0x837f, 0x8380, 0x8382, 0x8384, 0x8386, 0x838d,
0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839b, 0x839c, 0x839d,
0x83a6, 0x83a7, 0x83a9, 0x83ac, 0x83be, 0x83bf, 0x83c0, 0x83c7,
0x83c9, 0x83cf, 0x83d0, 0x83d1, 0x83d4, 0x83dd, 0x8353, 0x83e8,
0x83ea, 0x83f6, 0x83f8, 0x83f9, 0x83fc, 0x8401, 0x8406, 0x840a,
0x840f, 0x8411, 0x8415, 0x8419, 0x83ad, 0x842f, 0x8439, 0x8445,
0x8447, 0x8448, 0x844a, 0x844d, 0x844f, 0x8451, 0x8452, 0x8456,
0x8458, 0x8459, 0x845a, 0x845c, 0x8460, 0x8464, 0x8465, 0x8467,
0x846a, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847c, 0x847d,
0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849e, 0x84a6, 0x84a8,
0x84a9, 0x84aa, 0x84af, 0x84b1, 0x84b4, 0x84ba, 0x84bd, 0x84be,
0x84c0, 0x84c2, 0x84c7, 0x84c8, 0x84cc, 0x84cf, 0x84d3,
/* 0x5921 - 0x597e */
0x84dc, 0x84e7, 0x84ea, 0x84ef, 0x84f0, 0x84f1, 0x84f2,
0x84f7, 0x8532, 0x84fa, 0x84fb, 0x84fd, 0x8502, 0x8503, 0x8507,
0x850c, 0x850e, 0x8510, 0x851c, 0x851e, 0x8522, 0x8523, 0x8524,
0x8525, 0x8527, 0x852a, 0x852b, 0x852f, 0x8533, 0x8534, 0x8536,
0x853f, 0x8546, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556,
0x8559, 0x855c, 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562,
0x8564, 0x856b, 0x856f, 0x8579, 0x857a, 0x857b, 0x857d, 0x857f,
0x8581, 0x8585, 0x8586, 0x8589, 0x858b, 0x858c, 0x858f, 0x8593,
0x8598, 0x859d, 0x859f, 0x85a0, 0x85a2, 0x85a5, 0x85a7, 0x85b4,
0x85b6, 0x85b7, 0x85b8, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c2,
0x85c7, 0x85ca, 0x85cb, 0x85ce, 0x85ad, 0x85d8, 0x85da, 0x85df,
0x85e0, 0x85e6, 0x85e8, 0x85ed, 0x85f3, 0x85f6, 0x85fc,
/* 0x5a21 - 0x5a7e */
0x85ff, 0x8600, 0x8604, 0x8605, 0x860d, 0x860e, 0x8610,
0x8611, 0x8612, 0x8618, 0x8619, 0x861b, 0x861e, 0x8621, 0x8627,
0x8629, 0x8636, 0x8638, 0x863a, 0x863c, 0x863d, 0x8640, 0x8642,
0x8646, 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865d,
0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866c, 0x866f,
0x8675, 0x8676, 0x8677, 0x867a, 0x868d, 0x8691, 0x8696, 0x8698,
0x869a, 0x869c, 0x86a1, 0x86a6, 0x86a7, 0x86a8, 0x86ad, 0x86b1,
0x86b3, 0x86b4, 0x86b5, 0x86b7, 0x86b8, 0x86b9, 0x86bf, 0x86c0,
0x86c1, 0x86c3, 0x86c5, 0x86d1, 0x86d2, 0x86d5, 0x86d7, 0x86da,
0x86dc, 0x86e0, 0x86e3, 0x86e5, 0x86e7, 0x8688, 0x86fa, 0x86fc,
0x86fd, 0x8704, 0x8705, 0x8707, 0x870b, 0x870e, 0x870f, 0x8710,
0x8713, 0x8714, 0x8719, 0x871e, 0x871f, 0x8721, 0x8723,
/* 0x5b21 - 0x5b7e */
0x8728, 0x872e, 0x872f, 0x8731, 0x8732, 0x8739, 0x873a,
0x873c, 0x873d, 0x873e, 0x8740, 0x8743, 0x8745, 0x874d, 0x8758,
0x875d, 0x8761, 0x8764, 0x8765, 0x876f, 0x8771, 0x8772, 0x877b,
0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878b,
0x878c, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879e,
0x87a0, 0x87a3, 0x87a7, 0x87ac, 0x87ad, 0x87ae, 0x87b1, 0x87b5,
0x87be, 0x87bf, 0x87c1, 0x87c8, 0x87c9, 0x87ca, 0x87ce, 0x87d5,
0x87d6, 0x87d9, 0x87da, 0x87dc, 0x87df, 0x87e2, 0x87e3, 0x87e4,
0x87ea, 0x87eb, 0x87ed, 0x87f1, 0x87f3, 0x87f8, 0x87fa, 0x87ff,
0x8801, 0x8803, 0x8806, 0x8809, 0x880a, 0x880b, 0x8810, 0x8819,
0x8812, 0x8813, 0x8814, 0x8818, 0x881a, 0x881b, 0x881c, 0x881e,
0x881f, 0x8828, 0x882d, 0x882e, 0x8830, 0x8832, 0x8835,
/* 0x5c21 - 0x5c7e */
0x883a, 0x883c, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849,
0x884a, 0x884b, 0x884e, 0x8851, 0x8855, 0x8856, 0x8858, 0x885a,
0x885c, 0x885f, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887b,
0x8880, 0x8898, 0x889a, 0x889b, 0x889c, 0x889f, 0x88a0, 0x88a8,
0x88aa, 0x88ba, 0x88bd, 0x88be, 0x88c0, 0x88ca, 0x88cb, 0x88cc,
0x88cd, 0x88ce, 0x88d1, 0x88d2, 0x88d3, 0x88db, 0x88de, 0x88e7,
0x88ef, 0x88f0, 0x88f1, 0x88f5, 0x88f7, 0x8901, 0x8906, 0x890d,
0x890e, 0x890f, 0x8915, 0x8916, 0x8918, 0x8919, 0x891a, 0x891c,
0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935,
0x8939, 0x893a, 0x893e, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949,
0x894f, 0x8952, 0x8957, 0x895a, 0x895b, 0x895c, 0x8961, 0x8962,
0x8963, 0x896b, 0x896e, 0x8970, 0x8973, 0x8975, 0x897a,
/* 0x5d21 - 0x5d7e */
0x897b, 0x897c, 0x897d, 0x8989, 0x898d, 0x8990, 0x8994,
0x8995, 0x899b, 0x899c, 0x899f, 0x89a0, 0x89a5, 0x89b0, 0x89b4,
0x89b5, 0x89b6, 0x89b7, 0x89bc, 0x89d4, 0x89d5, 0x89d6, 0x89d7,
0x89d8, 0x89e5, 0x89e9, 0x89eb, 0x89ed, 0x89f1, 0x89f3, 0x89f6,
0x89f9, 0x89fd, 0x89ff, 0x8a04, 0x8a05, 0x8a07, 0x8a0f, 0x8a11,
0x8a12, 0x8a14, 0x8a15, 0x8a1e, 0x8a20, 0x8a22, 0x8a24, 0x8a26,
0x8a2b, 0x8a2c, 0x8a2f, 0x8a35, 0x8a37, 0x8a3d, 0x8a3e, 0x8a40,
0x8a43, 0x8a45, 0x8a47, 0x8a49, 0x8a4d, 0x8a4e, 0x8a53, 0x8a56,
0x8a57, 0x8a58, 0x8a5c, 0x8a5d, 0x8a61, 0x8a65, 0x8a67, 0x8a75,
0x8a76, 0x8a77, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7e, 0x8a7f, 0x8a80,
0x8a83, 0x8a86, 0x8a8b, 0x8a8f, 0x8a90, 0x8a92, 0x8a96, 0x8a97,
0x8a99, 0x8a9f, 0x8aa7, 0x8aa9, 0x8aae, 0x8aaf, 0x8ab3,
/* 0x5e21 - 0x5e7e */
0x8ab6, 0x8ab7, 0x8abb, 0x8abe, 0x8ac3, 0x8ac6, 0x8ac8,
0x8ac9, 0x8aca, 0x8ad1, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad7, 0x8add,
0x8adf, 0x8aec, 0x8af0, 0x8af4, 0x8af5, 0x8af6, 0x8afc, 0x8aff,
0x8b05, 0x8b06, 0x8b0b, 0x8b11, 0x8b1c, 0x8b1e, 0x8b1f, 0x8b0a,
0x8b2d, 0x8b30, 0x8b37, 0x8b3c, 0x8b42, 0x8b43, 0x8b44, 0x8b45,
0x8b46, 0x8b48, 0x8b52, 0x8b53, 0x8b54, 0x8b59, 0x8b4d, 0x8b5e,
0x8b63, 0x8b6d, 0x8b76, 0x8b78, 0x8b79, 0x8b7c, 0x8b7e, 0x8b81,
0x8b84, 0x8b85, 0x8b8b, 0x8b8d, 0x8b8f, 0x8b94, 0x8b95, 0x8b9c,
0x8b9e, 0x8b9f, 0x8c38, 0x8c39, 0x8c3d, 0x8c3e, 0x8c45, 0x8c47,
0x8c49, 0x8c4b, 0x8c4f, 0x8c51, 0x8c53, 0x8c54, 0x8c57, 0x8c58,
0x8c5b, 0x8c5d, 0x8c59, 0x8c63, 0x8c64, 0x8c66, 0x8c68, 0x8c69,
0x8c6d, 0x8c73, 0x8c75, 0x8c76, 0x8c7b, 0x8c7e, 0x8c86,
/* 0x5f21 - 0x5f7e */
0x8c87, 0x8c8b, 0x8c90, 0x8c92, 0x8c93, 0x8c99, 0x8c9b,
0x8c9c, 0x8ca4, 0x8cb9, 0x8cba, 0x8cc5, 0x8cc6, 0x8cc9, 0x8ccb,
0x8ccf, 0x8cd6, 0x8cd5, 0x8cd9, 0x8cdd, 0x8ce1, 0x8ce8, 0x8cec,
0x8cef, 0x8cf0, 0x8cf2, 0x8cf5, 0x8cf7, 0x8cf8, 0x8cfe, 0x8cff,
0x8d01, 0x8d03, 0x8d09, 0x8d12, 0x8d17, 0x8d1b, 0x8d65, 0x8d69,
0x8d6c, 0x8d6e, 0x8d7f, 0x8d82, 0x8d84, 0x8d88, 0x8d8d, 0x8d90,
0x8d91, 0x8d95, 0x8d9e, 0x8d9f, 0x8da0, 0x8da6, 0x8dab, 0x8dac,
0x8daf, 0x8db2, 0x8db5, 0x8db7, 0x8db9, 0x8dbb, 0x8dc0, 0x8dc5,
0x8dc6, 0x8dc7, 0x8dc8, 0x8dca, 0x8dce, 0x8dd1, 0x8dd4, 0x8dd5,
0x8dd7, 0x8dd9, 0x8de4, 0x8de5, 0x8de7, 0x8dec, 0x8df0, 0x8dbc,
0x8df1, 0x8df2, 0x8df4, 0x8dfd, 0x8e01, 0x8e04, 0x8e05, 0x8e06,
0x8e0b, 0x8e11, 0x8e14, 0x8e16, 0x8e20, 0x8e21, 0x8e22,
/* 0x6021 - 0x607e */
0x8e23, 0x8e26, 0x8e27, 0x8e31, 0x8e33, 0x8e36, 0x8e37,
0x8e38, 0x8e39, 0x8e3d, 0x8e40, 0x8e41, 0x8e4b, 0x8e4d, 0x8e4e,
0x8e4f, 0x8e54, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e61, 0x8e62,
0x8e69, 0x8e6c, 0x8e6d, 0x8e6f, 0x8e70, 0x8e71, 0x8e79, 0x8e7a,
0x8e7b, 0x8e82, 0x8e83, 0x8e89, 0x8e90, 0x8e92, 0x8e95, 0x8e9a,
0x8e9b, 0x8e9d, 0x8e9e, 0x8ea2, 0x8ea7, 0x8ea9, 0x8ead, 0x8eae,
0x8eb3, 0x8eb5, 0x8eba, 0x8ebb, 0x8ec0, 0x8ec1, 0x8ec3, 0x8ec4,
0x8ec7, 0x8ecf, 0x8ed1, 0x8ed4, 0x8edc, 0x8ee8, 0x8eee, 0x8ef0,
0x8ef1, 0x8ef7, 0x8ef9, 0x8efa, 0x8eed, 0x8f00, 0x8f02, 0x8f07,
0x8f08, 0x8f0f, 0x8f10, 0x8f16, 0x8f17, 0x8f18, 0x8f1e, 0x8f20,
0x8f21, 0x8f23, 0x8f25, 0x8f27, 0x8f28, 0x8f2c, 0x8f2d, 0x8f2e,
0x8f34, 0x8f35, 0x8f36, 0x8f37, 0x8f3a, 0x8f40, 0x8f41,
/* 0x6121 - 0x617e */
0x8f43, 0x8f47, 0x8f4f, 0x8f51, 0x8f52, 0x8f53, 0x8f54,
0x8f55, 0x8f58, 0x8f5d, 0x8f5e, 0x8f65, 0x8f9d, 0x8fa0, 0x8fa1,
0x8fa4, 0x8fa5, 0x8fa6, 0x8fb5, 0x8fb6, 0x8fb8, 0x8fbe, 0x8fc0,
0x8fc1, 0x8fc6, 0x8fca, 0x8fcb, 0x8fcd, 0x8fd0, 0x8fd2, 0x8fd3,
0x8fd5, 0x8fe0, 0x8fe3, 0x8fe4, 0x8fe8, 0x8fee, 0x8ff1, 0x8ff5,
0x8ff6, 0x8ffb, 0x8ffe, 0x9002, 0x9004, 0x9008, 0x900c, 0x9018,
0x901b, 0x9028, 0x9029, 0x902f, 0x902a, 0x902c, 0x902d, 0x9033,
0x9034, 0x9037, 0x903f, 0x9043, 0x9044, 0x904c, 0x905b, 0x905d,
0x9062, 0x9066, 0x9067, 0x906c, 0x9070, 0x9074, 0x9079, 0x9085,
0x9088, 0x908b, 0x908c, 0x908e, 0x9090, 0x9095, 0x9097, 0x9098,
0x9099, 0x909b, 0x90a0, 0x90a1, 0x90a2, 0x90a5, 0x90b0, 0x90b2,
0x90b3, 0x90b4, 0x90b6, 0x90bd, 0x90cc, 0x90be, 0x90c3,
/* 0x6221 - 0x627e */
0x90c4, 0x90c5, 0x90c7, 0x90c8, 0x90d5, 0x90d7, 0x90d8,
0x90d9, 0x90dc, 0x90dd, 0x90df, 0x90e5, 0x90d2, 0x90f6, 0x90eb,
0x90ef, 0x90f0, 0x90f4, 0x90fe, 0x90ff, 0x9100, 0x9104, 0x9105,
0x9106, 0x9108, 0x910d, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118,
0x911a, 0x911c, 0x911e, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127,
0x9129, 0x912e, 0x912f, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139,
0x913a, 0x913c, 0x913d, 0x9143, 0x9147, 0x9148, 0x914f, 0x9153,
0x9157, 0x9159, 0x915a, 0x915b, 0x9161, 0x9164, 0x9167, 0x916d,
0x9174, 0x9179, 0x917a, 0x917b, 0x9181, 0x9183, 0x9185, 0x9186,
0x918a, 0x918e, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919e,
0x91a1, 0x91a6, 0x91a8, 0x91ac, 0x91ad, 0x91ae, 0x91b0, 0x91b1,
0x91b2, 0x91b3, 0x91b6, 0x91bb, 0x91bc, 0x91bd, 0x91bf,
/* 0x6321 - 0x637e */
0x91c2, 0x91c3, 0x91c5, 0x91d3, 0x91d4, 0x91d7, 0x91d9,
0x91da, 0x91de, 0x91e4, 0x91e5, 0x91e9, 0x91ea, 0x91ec, 0x91ed,
0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f7, 0x91f9, 0x91fb, 0x91fd,
0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920a,
0x920c, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921c, 0x921d,
0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922e, 0x922f, 0x9230,
0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923a, 0x923c, 0x923e,
0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924a, 0x924d, 0x924e,
0x924f, 0x9251, 0x9258, 0x9259, 0x925c, 0x925d, 0x9260, 0x9261,
0x9265, 0x9267, 0x9268, 0x9269, 0x926e, 0x926f, 0x9270, 0x9275,
0x9276, 0x9277, 0x9278, 0x9279, 0x927b, 0x927c, 0x927d, 0x927f,
0x9288, 0x9289, 0x928a, 0x928d, 0x928e, 0x9292, 0x9297,
/* 0x6421 - 0x647e */
0x9299, 0x929f, 0x92a0, 0x92a4, 0x92a5, 0x92a7, 0x92a8,
0x92ab, 0x92af, 0x92b2, 0x92b6, 0x92b8, 0x92ba, 0x92bb, 0x92bc,
0x92bd, 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c5, 0x92c6,
0x92c7, 0x92c8, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92d0, 0x92d3,
0x92d5, 0x92d7, 0x92d8, 0x92d9, 0x92dc, 0x92dd, 0x92df, 0x92e0,
0x92e1, 0x92e3, 0x92e5, 0x92e7, 0x92e8, 0x92ec, 0x92ee, 0x92f0,
0x92f9, 0x92fb, 0x92ff, 0x9300, 0x9302, 0x9308, 0x930d, 0x9311,
0x9314, 0x9315, 0x931c, 0x931d, 0x931e, 0x931f, 0x9321, 0x9324,
0x9325, 0x9327, 0x9329, 0x932a, 0x9333, 0x9334, 0x9336, 0x9337,
0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357,
0x9358, 0x935a, 0x935e, 0x9364, 0x9365, 0x9367, 0x9369, 0x936a,
0x936d, 0x936f, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376,
/* 0x6521 - 0x657e */
0x937a, 0x937d, 0x937f, 0x9380, 0x9381, 0x9382, 0x9388,
0x938a, 0x938b, 0x938d, 0x938f, 0x9392, 0x9395, 0x9398, 0x939b,
0x939e, 0x93a1, 0x93a3, 0x93a4, 0x93a6, 0x93a8, 0x93ab, 0x93b4,
0x93b5, 0x93b6, 0x93ba, 0x93a9, 0x93c1, 0x93c4, 0x93c5, 0x93c6,
0x93c7, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93d3, 0x93d9,
0x93dc, 0x93de, 0x93df, 0x93e2, 0x93e6, 0x93e7, 0x93f9, 0x93f7,
0x93f8, 0x93fa, 0x93fb, 0x93fd, 0x9401, 0x9402, 0x9404, 0x9408,
0x9409, 0x940d, 0x940e, 0x940f, 0x9415, 0x9416, 0x9417, 0x941f,
0x942e, 0x942f, 0x9431, 0x9432, 0x9433, 0x9434, 0x943b, 0x943f,
0x943d, 0x9443, 0x9445, 0x9448, 0x944a, 0x944c, 0x9455, 0x9459,
0x945c, 0x945f, 0x9461, 0x9463, 0x9468, 0x946b, 0x946d, 0x946e,
0x946f, 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579,
/* 0x6621 - 0x667e */
0x957e, 0x9584, 0x9588, 0x958c, 0x958d, 0x958e, 0x959d,
0x959e, 0x959f, 0x95a1, 0x95a6, 0x95a9, 0x95ab, 0x95ac, 0x95b4,
0x95b6, 0x95ba, 0x95bd, 0x95bf, 0x95c6, 0x95c8, 0x95c9, 0x95cb,
0x95d0, 0x95d1, 0x95d2, 0x95d3, 0x95d9, 0x95da, 0x95dd, 0x95de,
0x95df, 0x95e0, 0x95e4, 0x95e6, 0x961d, 0x961e, 0x9622, 0x9624,
0x9625, 0x9626, 0x962c, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639,
0x963a, 0x963c, 0x963d, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657,
0x9658, 0x9661, 0x966e, 0x9674, 0x967b, 0x967c, 0x967e, 0x967f,
0x9681, 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969a,
0x969d, 0x969f, 0x96a4, 0x96a5, 0x96a6, 0x96a9, 0x96ae, 0x96af,
0x96b3, 0x96ba, 0x96ca, 0x96d2, 0x5db2, 0x96d8, 0x96da, 0x96dd,
0x96de, 0x96df, 0x96e9, 0x96ef, 0x96f1, 0x96fa, 0x9702,
/* 0x6721 - 0x677e */
0x9703, 0x9705, 0x9709, 0x971a, 0x971b, 0x971d, 0x9721,
0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974a,
0x974e, 0x974f, 0x9755, 0x9757, 0x9758, 0x975a, 0x975b, 0x9763,
0x9767, 0x976a, 0x976e, 0x9773, 0x9776, 0x9777, 0x9778, 0x977b,
0x977d, 0x977f, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799,
0x979a, 0x979e, 0x979f, 0x97a2, 0x97ac, 0x97ae, 0x97b1, 0x97b2,
0x97b5, 0x97b6, 0x97b8, 0x97b9, 0x97ba, 0x97bc, 0x97be, 0x97bf,
0x97c1, 0x97c4, 0x97c5, 0x97c7, 0x97c9, 0x97ca, 0x97cc, 0x97cd,
0x97ce, 0x97d0, 0x97d1, 0x97d4, 0x97d7, 0x97d8, 0x97d9, 0x97dd,
0x97de, 0x97e0, 0x97db, 0x97e1, 0x97e4, 0x97ef, 0x97f1, 0x97f4,
0x97f7, 0x97f8, 0x97fa, 0x9807, 0x980a, 0x9819, 0x980d, 0x980e,
0x9814, 0x9816, 0x981c, 0x981e, 0x9820, 0x9823, 0x9826,
/* 0x6821 - 0x687e */
0x982b, 0x982e, 0x982f, 0x9830, 0x9832, 0x9833, 0x9835,
0x9825, 0x983e, 0x9844, 0x9847, 0x984a, 0x9851, 0x9852, 0x9853,
0x9856, 0x9857, 0x9859, 0x985a, 0x9862, 0x9863, 0x9865, 0x9866,
0x986a, 0x986c, 0x98ab, 0x98ad, 0x98ae, 0x98b0, 0x98b4, 0x98b7,
0x98b8, 0x98ba, 0x98bb, 0x98bf, 0x98c2, 0x98c5, 0x98c8, 0x98cc,
0x98e1, 0x98e3, 0x98e5, 0x98e6, 0x98e7, 0x98ea, 0x98f3, 0x98f6,
0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991a,
0x991b, 0x991c, 0x991f, 0x9922, 0x9926, 0x9927, 0x992b, 0x9931,
0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993a, 0x993b, 0x993c,
0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994d, 0x994e, 0x9954,
0x9958, 0x9959, 0x995b, 0x995c, 0x995e, 0x995f, 0x9960, 0x999b,
0x999d, 0x999f, 0x99a6, 0x99b0, 0x99b1, 0x99b2, 0x99b5,
/* 0x6921 - 0x697e */
0x99b9, 0x99ba, 0x99bd, 0x99bf, 0x99c3, 0x99c9, 0x99d3,
0x99d4, 0x99d9, 0x99da, 0x99dc, 0x99de, 0x99e7, 0x99ea, 0x99eb,
0x99ec, 0x99f0, 0x99f4, 0x99f5, 0x99f9, 0x99fd, 0x99fe, 0x9a02,
0x9a03, 0x9a04, 0x9a0b, 0x9a0c, 0x9a10, 0x9a11, 0x9a16, 0x9a1e,
0x9a20, 0x9a22, 0x9a23, 0x9a24, 0x9a27, 0x9a2d, 0x9a2e, 0x9a33,
0x9a35, 0x9a36, 0x9a38, 0x9a47, 0x9a41, 0x9a44, 0x9a4a, 0x9a4b,
0x9a4c, 0x9a4e, 0x9a51, 0x9a54, 0x9a56, 0x9a5d, 0x9aaa, 0x9aac,
0x9aae, 0x9aaf, 0x9ab2, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab9, 0x9abb,
0x9abe, 0x9abf, 0x9ac1, 0x9ac3, 0x9ac6, 0x9ac8, 0x9ace, 0x9ad0,
0x9ad2, 0x9ad5, 0x9ad6, 0x9ad7, 0x9adb, 0x9adc, 0x9ae0, 0x9ae4,
0x9ae5, 0x9ae7, 0x9ae9, 0x9aec, 0x9af2, 0x9af3, 0x9af5, 0x9af9,
0x9afa, 0x9afd, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b03,
/* 0x6a21 - 0x6a7e */
0x9b04, 0x9b05, 0x9b08, 0x9b09, 0x9b0b, 0x9b0c, 0x9b0d,
0x9b0e, 0x9b10, 0x9b12, 0x9b16, 0x9b19, 0x9b1b, 0x9b1c, 0x9b20,
0x9b26, 0x9b2b, 0x9b2d, 0x9b33, 0x9b34, 0x9b35, 0x9b37, 0x9b39,
0x9b3a, 0x9b3d, 0x9b48, 0x9b4b, 0x9b4c, 0x9b55, 0x9b56, 0x9b57,
0x9b5b, 0x9b5e, 0x9b61, 0x9b63, 0x9b65, 0x9b66, 0x9b68, 0x9b6a,
0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b73, 0x9b75, 0x9b77, 0x9b78,
0x9b79, 0x9b7f, 0x9b80, 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b89,
0x9b8a, 0x9b8b, 0x9b8d, 0x9b8f, 0x9b90, 0x9b94, 0x9b9a, 0x9b9d,
0x9b9e, 0x9ba6, 0x9ba7, 0x9ba9, 0x9bac, 0x9bb0, 0x9bb1, 0x9bb2,
0x9bb7, 0x9bb8, 0x9bbb, 0x9bbc, 0x9bbe, 0x9bbf, 0x9bc1, 0x9bc7,
0x9bc8, 0x9bce, 0x9bd0, 0x9bd7, 0x9bd8, 0x9bdd, 0x9bdf, 0x9be5,
0x9be7, 0x9bea, 0x9beb, 0x9bef, 0x9bf3, 0x9bf7, 0x9bf8,
/* 0x6b21 - 0x6b7e */
0x9bf9, 0x9bfa, 0x9bfd, 0x9bff, 0x9c00, 0x9c02, 0x9c0b,
0x9c0f, 0x9c11, 0x9c16, 0x9c18, 0x9c19, 0x9c1a, 0x9c1c, 0x9c1e,
0x9c22, 0x9c23, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c31,
0x9c35, 0x9c36, 0x9c37, 0x9c3d, 0x9c41, 0x9c43, 0x9c44, 0x9c45,
0x9c49, 0x9c4a, 0x9c4e, 0x9c4f, 0x9c50, 0x9c53, 0x9c54, 0x9c56,
0x9c58, 0x9c5b, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c63, 0x9c69, 0x9c6a,
0x9c5c, 0x9c6b, 0x9c68, 0x9c6e, 0x9c70, 0x9c72, 0x9c75, 0x9c77,
0x9c7b, 0x9ce6, 0x9cf2, 0x9cf7, 0x9cf9, 0x9d0b, 0x9d02, 0x9d11,
0x9d17, 0x9d18, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d2f, 0x9d30, 0x9d32,
0x9d33, 0x9d34, 0x9d3a, 0x9d3c, 0x9d45, 0x9d3d, 0x9d42, 0x9d43,
0x9d47, 0x9d4a, 0x9d53, 0x9d54, 0x9d5f, 0x9d63, 0x9d62, 0x9d65,
0x9d69, 0x9d6a, 0x9d6b, 0x9d70, 0x9d76, 0x9d77, 0x9d7b,
/* 0x6c21 - 0x6c7e */
0x9d7c, 0x9d7e, 0x9d83, 0x9d84, 0x9d86, 0x9d8a, 0x9d8d,
0x9d8e, 0x9d92, 0x9d93, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9da1,
0x9daa, 0x9dac, 0x9dae, 0x9db1, 0x9db5, 0x9db9, 0x9dbc, 0x9dbf,
0x9dc3, 0x9dc7, 0x9dc9, 0x9dca, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7,
0x9dda, 0x9dde, 0x9ddf, 0x9de0, 0x9de5, 0x9de7, 0x9de9, 0x9deb,
0x9dee, 0x9df0, 0x9df3, 0x9df4, 0x9dfe, 0x9e0a, 0x9e02, 0x9e07,
0x9e0e, 0x9e10, 0x9e11, 0x9e12, 0x9e15, 0x9e16, 0x9e19, 0x9e1c,
0x9e1d, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e80, 0x9e82, 0x9e83, 0x9e84,
0x9e85, 0x9e87, 0x9e8e, 0x9e8f, 0x9e96, 0x9e98, 0x9e9b, 0x9e9e,
0x9ea4, 0x9ea8, 0x9eac, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb3, 0x9eb4,
0x9eb5, 0x9ec6, 0x9ec8, 0x9ecb, 0x9ed5, 0x9edf, 0x9ee4, 0x9ee7,
0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef5,
/* 0x6d21 - 0x6d7e */
0x9ef8, 0x9eff, 0x9f02, 0x9f03, 0x9f09, 0x9f0f, 0x9f10,
0x9f11, 0x9f12, 0x9f14, 0x9f16, 0x9f17, 0x9f19, 0x9f1a, 0x9f1b,
0x9f1f, 0x9f22, 0x9f26, 0x9f2a, 0x9f2b, 0x9f2f, 0x9f31, 0x9f32,
0x9f34, 0x9f37, 0x9f39, 0x9f3a, 0x9f3c, 0x9f3d, 0x9f3f, 0x9f41,
0x9f43, 0x9f44, 0x9f45, 0x9f46, 0x9f47, 0x9f53, 0x9f55, 0x9f56,
0x9f57, 0x9f58, 0x9f5a, 0x9f5d, 0x9f5e, 0x9f68, 0x9f69, 0x9f6d,
0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f73, 0x9f75, 0x9f7a, 0x9f7d,
0x9f8f, 0x9f90, 0x9f91, 0x9f92, 0x9f94, 0x9f96, 0x9f97, 0x9f9e,
0x9fa1, 0x9fa2, 0x9fa3, 0x9fa5, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x6e21 - 0x6e7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x6f21 - 0x6f7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7021 - 0x707e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7121 - 0x717e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7221 - 0x727e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7321 - 0x737e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174,
0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x2160, 0x2161,
/* 0x7421 - 0x747e */
0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168,
0x2169, 0xff07, 0xff02, 0x3231, 0x2116, 0x2121, 0x70bb, 0x4efc,
0x50f4, 0x51ec, 0x5307, 0x5324, 0xfa0e, 0x548a, 0x5759, 0xfa0f,
0xfa10, 0x589e, 0x5bec, 0x5cf5, 0x5d53, 0xfa11, 0x5fb7, 0x6085,
0x6120, 0x654e, 0x663b, 0x6665, 0xfa12, 0xf929, 0x6801, 0xfa13,
0xfa14, 0x6a6b, 0x6ae2, 0x6df8, 0x6df2, 0x7028, 0xfa15, 0xfa16,
0x7501, 0x7682, 0x769e, 0xfa17, 0x7930, 0xfa18, 0xfa19, 0xfa1a,
0xfa1b, 0x7ae7, 0xfa1c, 0xfa1d, 0x7da0, 0x7dd6, 0xfa1e, 0x8362,
0xfa1f, 0x85b0, 0xfa20, 0xfa21, 0x8807, 0xfa22, 0x8b7f, 0x8cf4,
0x8d76, 0xfa23, 0xfa24, 0xfa25, 0x90de, 0xfa26, 0x9115, 0xfa27,
0xfa28, 0x9592, 0xf9dc, 0xfa29, 0x973b, 0x974d, 0x9751, 0xfa2a,
0xfa2b, 0xfa2c, 0x999e, 0x9ad9, 0x9b72, 0xfa2d, 0x9ed1,
/* 0x7521 - 0x757e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7621 - 0x767e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7721 - 0x777e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7821 - 0x787e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7921 - 0x797e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7a21 - 0x7a7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7b21 - 0x7b7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7c21 - 0x7c7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7d21 - 0x7d7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
/* 0x7e21 - 0x7e7e */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
#endif
#ifdef USE_JISX0212
static uint jisx0212ToUnicode11(uint h, uint l)
{
if ((0x0021 <= h) && (h <= 0x007e) && (0x0021 <= l) && (l <= 0x007e)) {
return jisx0212_to_unicode[(h - 0x0021) * 0x005e + (l - 0x0021)];
}
return 0x0000;
}
#else
static uint jisx0212ToUnicode11(uint h, uint l)
{
return 0x0000;
}
#endif
#ifdef USE_JISX0212
/*
* This data is derived from Unicode 1.1,
* JIS X 0212 (1990) to Unicode mapping table version 0.9 .
* (In addition IBM Vender Defined Char included)
*/
static unsigned short const unicode_to_jisx0212_00[] = {
/* 0x0000 - 0x00ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2237, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x2242, 0x0000, 0x0000, 0x2270, 0x0000, 0x2243, 0x0000,
0x0000, 0x226d, 0x226c, 0x0000, 0x0000, 0x0000, 0x226e, 0x2234,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x2231, 0x0000, 0x226b, 0x0000, 0x0000, 0x0000, 0x0000, 0x2244,
0x2a22, 0x2a21, 0x2a24, 0x2a2a, 0x2a23, 0x2a29, 0x2921, 0x2a2e,
0x2a32, 0x2a31, 0x2a34, 0x2a33, 0x2a40, 0x2a3f, 0x2a42, 0x2a41,
0x0000, 0x2a50, 0x2a52, 0x2a51, 0x2a54, 0x2a58, 0x2a53, 0x0000,
0x292c, 0x2a63, 0x2a62, 0x2a65, 0x2a64, 0x2a72, 0x2930, 0x294e,
0x2b22, 0x2b21, 0x2b24, 0x2b2a, 0x2b23, 0x2b29, 0x2941, 0x2b2e,
0x2b32, 0x2b31, 0x2b34, 0x2b33, 0x2b40, 0x2b3f, 0x2b42, 0x2b41,
0x2943, 0x2b50, 0x2b52, 0x2b51, 0x2b54, 0x2b58, 0x2b53, 0x0000,
0x294c, 0x2b63, 0x2b62, 0x2b65, 0x2b64, 0x2b72, 0x2950, 0x2b73,
};
static unsigned short const unicode_to_jisx0212_01[] = {
/* 0x0100 - 0x01ff */
0x2a27, 0x2b27, 0x2a25, 0x2b25, 0x2a28, 0x2b28, 0x2a2b, 0x2b2b,
0x2a2c, 0x2b2c, 0x2a2f, 0x2b2f, 0x2a2d, 0x2b2d, 0x2a30, 0x2b30,
0x2922, 0x2942, 0x2a37, 0x2b37, 0x0000, 0x0000, 0x2a36, 0x2b36,
0x2a38, 0x2b38, 0x2a35, 0x2b35, 0x2a3a, 0x2b3a, 0x2a3b, 0x2b3b,
0x2a3d, 0x2b3d, 0x2a3c, 0x0000, 0x2a3e, 0x2b3e, 0x2924, 0x2944,
0x2a47, 0x2b47, 0x2a45, 0x2b45, 0x0000, 0x0000, 0x2a46, 0x2b46,
0x2a44, 0x2945, 0x2926, 0x2946, 0x2a48, 0x2b48, 0x2a49, 0x2b49,
0x2947, 0x2a4a, 0x2b4a, 0x2a4c, 0x2b4c, 0x2a4b, 0x2b4b, 0x2929,
0x2949, 0x2928, 0x2948, 0x2a4d, 0x2b4d, 0x2a4f, 0x2b4f, 0x2a4e,
0x2b4e, 0x294a, 0x292b, 0x294b, 0x2a57, 0x2b57, 0x0000, 0x0000,
0x2a56, 0x2b56, 0x292d, 0x294d, 0x2a59, 0x2b59, 0x2a5b, 0x2b5b,
0x2a5a, 0x2b5a, 0x2a5c, 0x2b5c, 0x2a5d, 0x2b5d, 0x2a5f, 0x2b5f,
0x2a5e, 0x2b5e, 0x2a61, 0x2b61, 0x2a60, 0x2b60, 0x292f, 0x294f,
0x2a6c, 0x2b6c, 0x2a69, 0x2b69, 0x2a66, 0x2b66, 0x2a6b, 0x2b6b,
0x2a68, 0x2b68, 0x2a6a, 0x2b6a, 0x2a71, 0x2b71, 0x2a74, 0x2b74,
0x2a73, 0x2a75, 0x2b75, 0x2a77, 0x2b77, 0x2a76, 0x2b76, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2a26, 0x2b26, 0x2a43,
0x2b43, 0x2a55, 0x2b55, 0x2a67, 0x2b67, 0x2a70, 0x2b70, 0x2a6d,
0x2b6d, 0x2a6f, 0x2b6f, 0x2a6e, 0x2b6e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2b39, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_02[] = {
/* 0x0200 - 0x02ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2230,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x222f, 0x2232, 0x2236, 0x2235, 0x0000, 0x2233, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_03[] = {
/* 0x0300 - 0x03ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x2238, 0x2239, 0x2661, 0x0000,
0x2662, 0x2663, 0x2664, 0x0000, 0x2667, 0x0000, 0x2669, 0x266c,
0x2676, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2665, 0x266a, 0x2671, 0x2672, 0x2673, 0x2674,
0x267b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2678, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2675, 0x267a, 0x2677, 0x2679, 0x267c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_04[] = {
/* 0x0400 - 0x04ff */
0x0000, 0x0000, 0x2742, 0x2743, 0x2744, 0x2745, 0x2746, 0x2747,
0x2748, 0x2749, 0x274a, 0x274b, 0x274c, 0x0000, 0x274d, 0x274e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x2772, 0x2773, 0x2774, 0x2775, 0x2776, 0x2777,
0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x0000, 0x277d, 0x277e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_21[] = {
/* 0x2100 - 0x21ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2271, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x742d, 0x226f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x737d, 0x737e, 0x7421, 0x7422, 0x7423, 0x7424, 0x7425, 0x7426,
0x7427, 0x7428, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x7373, 0x7374, 0x7375, 0x7376, 0x7377, 0x7378, 0x7379, 0x737a,
0x737b, 0x737c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_32[] = {
/* 0x3200 - 0x32ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x742b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_4e[] = {
/* 0x4e00 - 0x4eff */
0x0000, 0x0000, 0x3021, 0x0000, 0x3022, 0x3023, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3024, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3025, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3026,
0x0000, 0x0000, 0x0000, 0x3027, 0x3028, 0x0000, 0x0000, 0x0000,
0x3029, 0x0000, 0x0000, 0x302a, 0x0000, 0x0000, 0x302b, 0x302c,
0x302d, 0x0000, 0x0000, 0x0000, 0x0000, 0x302e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x302f, 0x3030, 0x0000, 0x0000, 0x3031, 0x0000, 0x0000, 0x3032,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3034, 0x0000, 0x3035, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3036, 0x0000, 0x0000, 0x0000, 0x0000,
0x3037, 0x3038, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3039, 0x303a, 0x0000, 0x0000,
0x0000, 0x303b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x303c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x303d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x303e, 0x303f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3040, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3041,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3042, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3043, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3044, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3045, 0x3046, 0x0000, 0x0000, 0x0000, 0x0000,
0x3047, 0x3048, 0x3049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x304a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x304b,
0x0000, 0x304c, 0x0000, 0x304d, 0x0000, 0x304e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x742f, 0x304f, 0x3050, 0x3051,
};
static unsigned short const unicode_to_jisx0212_4f[] = {
/* 0x4f00 - 0x4fff */
0x3052, 0x0000, 0x3053, 0x3054, 0x0000, 0x0000, 0x0000, 0x0000,
0x3055, 0x0000, 0x0000, 0x3056, 0x3057, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3058, 0x0000, 0x0000, 0x3059, 0x305a, 0x305b,
0x0000, 0x305c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x305d, 0x0000,
0x0000, 0x305e, 0x0000, 0x3060, 0x0000, 0x3061, 0x0000, 0x3062,
0x0000, 0x3063, 0x0000, 0x3064, 0x0000, 0x0000, 0x3065, 0x0000,
0x3066, 0x0000, 0x3067, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3068, 0x3069, 0x0000, 0x306a, 0x306b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x306c, 0x0000, 0x306d, 0x0000, 0x306e, 0x0000,
0x306f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3070,
0x305f, 0x0000, 0x0000, 0x3071, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3072, 0x0000, 0x3073, 0x0000, 0x3074, 0x0000,
0x0000, 0x3075, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3076,
0x3077, 0x3078, 0x3079, 0x0000, 0x0000, 0x307a, 0x307b, 0x0000,
0x0000, 0x307c, 0x307d, 0x0000, 0x307e, 0x3121, 0x0000, 0x0000,
0x0000, 0x3122, 0x3123, 0x0000, 0x3124, 0x0000, 0x3125, 0x0000,
0x3126, 0x0000, 0x3127, 0x3128, 0x3129, 0x0000, 0x0000, 0x312a,
0x0000, 0x312b, 0x312c, 0x0000, 0x0000, 0x0000, 0x312d, 0x312e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x312f, 0x0000, 0x0000, 0x0000, 0x0000, 0x3130,
0x0000, 0x3131, 0x0000, 0x3132, 0x3133, 0x3134, 0x3135, 0x0000,
0x3136, 0x3137, 0x0000, 0x0000, 0x0000, 0x3138, 0x3139, 0x0000,
0x313a, 0x313b, 0x0000, 0x313c, 0x313d, 0x313e, 0x0000, 0x313f,
0x0000, 0x0000, 0x3140, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3141, 0x0000, 0x0000, 0x0000,
0x3142, 0x0000, 0x3143, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3144, 0x0000, 0x3145, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3146, 0x3147, 0x0000, 0x3148,
};
static unsigned short const unicode_to_jisx0212_50[] = {
/* 0x5000 - 0x50ff */
0x3149, 0x314a, 0x0000, 0x0000, 0x314b, 0x0000, 0x0000, 0x314c,
0x0000, 0x0000, 0x314d, 0x0000, 0x314e, 0x0000, 0x314f, 0x0000,
0x3150, 0x0000, 0x0000, 0x3151, 0x0000, 0x0000, 0x0000, 0x3152,
0x3153, 0x0000, 0x0000, 0x3154, 0x3155, 0x3156, 0x3157, 0x0000,
0x0000, 0x0000, 0x3158, 0x0000, 0x0000, 0x0000, 0x0000, 0x3159,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x315a, 0x0000,
0x315b, 0x0000, 0x315c, 0x315d, 0x0000, 0x315e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3176, 0x0000, 0x0000, 0x0000, 0x0000,
0x315f, 0x3160, 0x3161, 0x0000, 0x0000, 0x3162, 0x3163, 0x0000,
0x0000, 0x0000, 0x3164, 0x0000, 0x3165, 0x0000, 0x3166, 0x0000,
0x0000, 0x3167, 0x3168, 0x3169, 0x0000, 0x0000, 0x0000, 0x316a,
0x0000, 0x316b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x316c,
0x316d, 0x0000, 0x316e, 0x316f, 0x0000, 0x0000, 0x3170, 0x3171,
0x0000, 0x0000, 0x3172, 0x0000, 0x0000, 0x3173, 0x0000, 0x0000,
0x3174, 0x3175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3177, 0x0000, 0x3178, 0x3179, 0x0000, 0x317a, 0x0000,
0x0000, 0x0000, 0x317b, 0x0000, 0x0000, 0x0000, 0x317c, 0x317d,
0x317e, 0x0000, 0x3221, 0x3222, 0x3223, 0x0000, 0x3224, 0x0000,
0x0000, 0x0000, 0x0000, 0x3225, 0x3226, 0x0000, 0x3227, 0x3228,
0x3229, 0x322a, 0x322b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x322c, 0x0000, 0x0000, 0x0000, 0x0000, 0x322d,
0x322e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x322f, 0x3230, 0x0000, 0x0000, 0x3231, 0x0000, 0x0000,
0x3232, 0x0000, 0x0000, 0x3233, 0x3234, 0x0000, 0x0000, 0x3235,
0x0000, 0x0000, 0x0000, 0x0000, 0x3236, 0x0000, 0x3237, 0x0000,
0x3238, 0x0000, 0x0000, 0x3239, 0x323a, 0x0000, 0x0000, 0x0000,
0x323b, 0x0000, 0x0000, 0x0000, 0x323c, 0x323d, 0x0000, 0x323e,
0x0000, 0x0000, 0x323f, 0x0000, 0x3240, 0x0000, 0x3241, 0x0000,
0x3242, 0x3243, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3244,
0x0000, 0x3245, 0x3251, 0x0000, 0x7430, 0x0000, 0x3246, 0x0000,
0x0000, 0x0000, 0x3247, 0x0000, 0x0000, 0x0000, 0x3248, 0x0000,
};
static unsigned short const unicode_to_jisx0212_51[] = {
/* 0x5100 - 0x51ff */
0x0000, 0x0000, 0x0000, 0x3249, 0x0000, 0x0000, 0x324a, 0x324b,
0x324c, 0x0000, 0x0000, 0x324d, 0x324e, 0x324f, 0x3250, 0x0000,
0x3252, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3253,
0x0000, 0x3254, 0x0000, 0x3255, 0x3256, 0x3257, 0x3258, 0x0000,
0x0000, 0x0000, 0x0000, 0x3259, 0x0000, 0x0000, 0x0000, 0x325a,
0x325b, 0x0000, 0x0000, 0x0000, 0x325c, 0x325d, 0x0000, 0x325e,
0x0000, 0x325f, 0x0000, 0x3260, 0x3261, 0x3262, 0x0000, 0x0000,
0x3263, 0x3264, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3265, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3266, 0x0000, 0x0000, 0x0000, 0x0000, 0x3267,
0x0000, 0x0000, 0x0000, 0x3268, 0x0000, 0x3269, 0x0000, 0x326a,
0x326b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x326c,
0x0000, 0x0000, 0x0000, 0x0000, 0x326d, 0x0000, 0x326e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x326f, 0x0000,
0x0000, 0x0000, 0x0000, 0x3270, 0x3271, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3272, 0x0000, 0x0000, 0x3273, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3274, 0x0000, 0x0000, 0x0000, 0x0000, 0x3275, 0x0000, 0x0000,
0x0000, 0x3276, 0x0000, 0x3277, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3278, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3279, 0x0000, 0x327a, 0x0000, 0x327b, 0x0000, 0x327c, 0x327d,
0x0000, 0x0000, 0x327e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3321, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3322,
0x0000, 0x3323, 0x3324, 0x3325, 0x0000, 0x3326, 0x0000, 0x0000,
0x3327, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3328, 0x0000,
0x0000, 0x0000, 0x3329, 0x0000, 0x0000, 0x332a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7431, 0x0000, 0x332b, 0x0000,
0x0000, 0x0000, 0x332c, 0x332d, 0x332e, 0x0000, 0x0000, 0x332f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_52[] = {
/* 0x5200 - 0x52ff */
0x0000, 0x3330, 0x3331, 0x0000, 0x0000, 0x3332, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3333, 0x3334, 0x0000, 0x3335, 0x3336, 0x0000,
0x3337, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3338, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3339, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x333a, 0x333b, 0x0000, 0x0000, 0x333c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x333d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x333e, 0x0000, 0x0000,
0x0000, 0x333f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3340, 0x0000, 0x3341,
0x3342, 0x0000, 0x3343, 0x0000, 0x3344, 0x0000, 0x0000, 0x3345,
0x3346, 0x3347, 0x0000, 0x0000, 0x0000, 0x0000, 0x3348, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3349, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x334a,
0x334b, 0x334c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x334d, 0x0000, 0x334e, 0x0000, 0x0000, 0x334f, 0x0000, 0x0000,
0x0000, 0x0000, 0x3350, 0x0000, 0x3351, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3352, 0x0000, 0x3353, 0x3354, 0x3355,
0x3356, 0x0000, 0x3357, 0x0000, 0x3358, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3359, 0x335a, 0x335b, 0x335c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x335d,
0x335e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x335f, 0x3360,
0x3361, 0x0000, 0x3362, 0x3363, 0x0000, 0x3364, 0x0000, 0x0000,
0x3365, 0x0000, 0x0000, 0x0000, 0x3366, 0x0000, 0x3367, 0x0000,
0x3368, 0x0000, 0x0000, 0x0000, 0x3369, 0x0000, 0x0000, 0x336a,
0x0000, 0x336b, 0x0000, 0x0000, 0x336c, 0x0000, 0x336d, 0x0000,
0x0000, 0x0000, 0x0000, 0x336e, 0x336f, 0x0000, 0x0000, 0x0000,
0x0000, 0x3370, 0x0000, 0x0000, 0x0000, 0x3371, 0x0000, 0x0000,
0x3372, 0x3373, 0x3374, 0x0000, 0x3375, 0x0000, 0x0000, 0x0000,
0x3376, 0x3377, 0x0000, 0x0000, 0x3378, 0x0000, 0x3379, 0x337a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_53[] = {
/* 0x5300 - 0x53ff */
0x337b, 0x0000, 0x0000, 0x337c, 0x0000, 0x0000, 0x0000, 0x7432,
0x0000, 0x0000, 0x337d, 0x337e, 0x3421, 0x0000, 0x0000, 0x0000,
0x0000, 0x3422, 0x0000, 0x3423, 0x0000, 0x0000, 0x0000, 0x0000,
0x3424, 0x0000, 0x0000, 0x3425, 0x3426, 0x0000, 0x3427, 0x3428,
0x0000, 0x0000, 0x0000, 0x0000, 0x7433, 0x3429, 0x0000, 0x342a,
0x342b, 0x342c, 0x0000, 0x342d, 0x342e, 0x342f, 0x0000, 0x0000,
0x3430, 0x0000, 0x3431, 0x0000, 0x0000, 0x3432, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3433, 0x3434, 0x3435, 0x0000,
0x0000, 0x0000, 0x3436, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3438, 0x3437, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3439, 0x0000, 0x343a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x343b, 0x0000, 0x343c, 0x0000, 0x343d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x343e, 0x343f, 0x0000, 0x0000,
0x0000, 0x0000, 0x3440, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3441, 0x0000, 0x0000, 0x0000, 0x0000, 0x3442, 0x0000,
0x0000, 0x0000, 0x0000, 0x3443, 0x0000, 0x0000, 0x0000, 0x3444,
0x3445, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3446, 0x0000,
0x0000, 0x0000, 0x0000, 0x3447, 0x3448, 0x0000, 0x0000, 0x0000,
0x0000, 0x3449, 0x0000, 0x0000, 0x0000, 0x344a, 0x0000, 0x0000,
0x0000, 0x344b, 0x0000, 0x0000, 0x344c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x344d, 0x344e, 0x0000, 0x0000, 0x0000, 0x344f,
0x0000, 0x0000, 0x3450, 0x0000, 0x3451, 0x3452, 0x0000, 0x3453,
0x3454, 0x0000, 0x3455, 0x0000, 0x0000, 0x3456, 0x0000, 0x0000,
0x3457, 0x0000, 0x0000, 0x0000, 0x0000, 0x3458, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3459,
0x0000, 0x0000, 0x345a, 0x345b, 0x0000, 0x345c, 0x0000, 0x0000,
0x0000, 0x0000, 0x345d, 0x0000, 0x0000, 0x345e, 0x345f, 0x0000,
0x3460, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3461, 0x3462,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3463, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_54[] = {
/* 0x5400 - 0x54ff */
0x0000, 0x0000, 0x3464, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3465, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3466, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3467, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3468,
0x3469, 0x0000, 0x346a, 0x0000, 0x0000, 0x0000, 0x0000, 0x346b,
0x0000, 0x346c, 0x0000, 0x0000, 0x346d, 0x346e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x346f, 0x3470, 0x0000, 0x0000, 0x3471,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3472, 0x0000, 0x3473,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3474, 0x0000,
0x0000, 0x0000, 0x3475, 0x0000, 0x3476, 0x0000, 0x3477, 0x3478,
0x0000, 0x3479, 0x0000, 0x347a, 0x0000, 0x347b, 0x347c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x347d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x347e,
0x0000, 0x3521, 0x0000, 0x3522, 0x0000, 0x3523, 0x0000, 0x0000,
0x3524, 0x3525, 0x7435, 0x0000, 0x0000, 0x3526, 0x0000, 0x0000,
0x0000, 0x3527, 0x0000, 0x0000, 0x0000, 0x3528, 0x3529, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x352a, 0x0000, 0x0000, 0x352b,
0x0000, 0x352c, 0x0000, 0x0000, 0x0000, 0x0000, 0x352d, 0x352e,
0x0000, 0x352f, 0x3530, 0x0000, 0x0000, 0x3531, 0x3532, 0x0000,
0x0000, 0x3533, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3534,
0x0000, 0x3535, 0x3536, 0x3537, 0x0000, 0x0000, 0x0000, 0x3538,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3539, 0x0000,
0x0000, 0x0000, 0x353a, 0x0000, 0x0000, 0x353b, 0x353c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x353d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x353e, 0x0000, 0x353f, 0x0000, 0x0000, 0x3540,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3541, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3542, 0x0000, 0x3543, 0x3544,
};
static unsigned short const unicode_to_jisx0212_55[] = {
/* 0x5500 - 0x55ff */
0x3545, 0x3546, 0x0000, 0x0000, 0x0000, 0x3547, 0x0000, 0x0000,
0x3548, 0x3549, 0x0000, 0x0000, 0x354a, 0x354b, 0x354c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x354d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x354e, 0x354f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3550, 0x0000, 0x0000, 0x3551, 0x3552, 0x0000,
0x0000, 0x0000, 0x0000, 0x3553, 0x3554, 0x3555, 0x0000, 0x0000,
0x0000, 0x3556, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3557,
0x0000, 0x3558, 0x3559, 0x0000, 0x0000, 0x355a, 0x0000, 0x0000,
0x355b, 0x355c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x355d, 0x0000, 0x355e, 0x355f, 0x0000, 0x0000, 0x3560, 0x0000,
0x3561, 0x3562, 0x0000, 0x0000, 0x3563, 0x0000, 0x3564, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3565,
0x0000, 0x3566, 0x3567, 0x0000, 0x0000, 0x0000, 0x3568, 0x0000,
0x3569, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x356a, 0x356b,
0x0000, 0x356c, 0x356d, 0x356e, 0x356f, 0x0000, 0x0000, 0x3570,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3571, 0x3572, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3573, 0x0000, 0x0000,
0x0000, 0x0000, 0x3574, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3575,
0x0000, 0x3576, 0x0000, 0x3577, 0x0000, 0x0000, 0x3578, 0x0000,
0x0000, 0x3579, 0x0000, 0x357a, 0x357b, 0x0000, 0x357c, 0x0000,
0x0000, 0x357d, 0x357e, 0x3621, 0x0000, 0x0000, 0x0000, 0x3622,
0x3623, 0x0000, 0x0000, 0x3624, 0x0000, 0x0000, 0x3625, 0x0000,
0x0000, 0x0000, 0x3626, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3627, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3628, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3629,
};
static unsigned short const unicode_to_jisx0212_56[] = {
/* 0x5600 - 0x56ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x362a, 0x0000, 0x0000,
0x362b, 0x0000, 0x362c, 0x0000, 0x0000, 0x362d, 0x362e, 0x362f,
0x3630, 0x3631, 0x3632, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3633, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3634, 0x0000, 0x0000, 0x0000,
0x3635, 0x0000, 0x0000, 0x3636, 0x0000, 0x3637, 0x0000, 0x3638,
0x0000, 0x3639, 0x0000, 0x363a, 0x363b, 0x363c, 0x0000, 0x363d,
0x363e, 0x363f, 0x0000, 0x3640, 0x3641, 0x0000, 0x3642, 0x0000,
0x0000, 0x3643, 0x0000, 0x3644, 0x0000, 0x3645, 0x0000, 0x3646,
0x0000, 0x0000, 0x0000, 0x0000, 0x3647, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3648, 0x0000,
0x3649, 0x364a, 0x364b, 0x364c, 0x0000, 0x0000, 0x364d, 0x0000,
0x0000, 0x364e, 0x0000, 0x0000, 0x0000, 0x364f, 0x0000, 0x3650,
0x0000, 0x3651, 0x3652, 0x0000, 0x0000, 0x3653, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3654, 0x3655, 0x0000, 0x0000,
0x3656, 0x0000, 0x0000, 0x3657, 0x3658, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3659, 0x0000, 0x0000,
0x0000, 0x365a, 0x365b, 0x0000, 0x0000, 0x365c, 0x365d, 0x365e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x365f, 0x3660,
0x3661, 0x3662, 0x0000, 0x3663, 0x3664, 0x3665, 0x0000, 0x0000,
0x0000, 0x3666, 0x0000, 0x3667, 0x0000, 0x0000, 0x0000, 0x3668,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3669, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x366a, 0x0000, 0x0000,
0x0000, 0x366b, 0x366c, 0x366d, 0x3670, 0x3671, 0x0000, 0x366e,
0x366f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3672, 0x0000, 0x0000, 0x3673, 0x3674, 0x0000, 0x3675,
0x0000, 0x3676, 0x0000, 0x0000, 0x3677, 0x3678, 0x3679, 0x367a,
0x367b, 0x0000, 0x0000, 0x367d, 0x0000, 0x367e, 0x0000, 0x0000,
0x0000, 0x367c, 0x0000, 0x0000, 0x0000, 0x0000, 0x3721, 0x3722,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_57[] = {
/* 0x5700 - 0x57ff */
0x0000, 0x3723, 0x3724, 0x0000, 0x0000, 0x0000, 0x0000, 0x3725,
0x0000, 0x0000, 0x3726, 0x0000, 0x3727, 0x0000, 0x0000, 0x0000,
0x0000, 0x3728, 0x0000, 0x0000, 0x0000, 0x3729, 0x0000, 0x0000,
0x0000, 0x0000, 0x372a, 0x372b, 0x0000, 0x372c, 0x0000, 0x0000,
0x372d, 0x0000, 0x372e, 0x372f, 0x3730, 0x3731, 0x0000, 0x0000,
0x0000, 0x3732, 0x3733, 0x0000, 0x3734, 0x0000, 0x3735, 0x3736,
0x0000, 0x0000, 0x0000, 0x3737, 0x3738, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3739, 0x373a, 0x373b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x373c, 0x373d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x373e, 0x373f, 0x0000, 0x0000,
0x0000, 0x0000, 0x3740, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7436, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3741, 0x0000, 0x0000, 0x3742, 0x0000, 0x3743,
0x3744, 0x0000, 0x0000, 0x3745, 0x0000, 0x3746, 0x3747, 0x3748,
0x3749, 0x374a, 0x0000, 0x374b, 0x374c, 0x374d, 0x0000, 0x374e,
0x0000, 0x374f, 0x3750, 0x3751, 0x3752, 0x0000, 0x3753, 0x0000,
0x0000, 0x3754, 0x0000, 0x3755, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3756, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3757, 0x3760, 0x0000, 0x3758,
0x0000, 0x3759, 0x375a, 0x0000, 0x375b, 0x375c, 0x375d, 0x375e,
0x0000, 0x375f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3761,
0x3762, 0x3763, 0x0000, 0x0000, 0x3764, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3765, 0x0000, 0x0000, 0x0000, 0x0000, 0x3766, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3767,
0x3768, 0x0000, 0x0000, 0x0000, 0x3769, 0x0000, 0x0000, 0x376a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x376b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x376c, 0x376d, 0x0000,
0x0000, 0x377e, 0x0000, 0x0000, 0x376e, 0x0000, 0x376f, 0x3770,
0x0000, 0x3771, 0x0000, 0x0000, 0x0000, 0x3772, 0x0000, 0x0000,
0x3773, 0x0000, 0x0000, 0x0000, 0x0000, 0x3774, 0x3775, 0x0000,
0x3776, 0x0000, 0x0000, 0x0000, 0x0000, 0x3777, 0x3778, 0x3779,
};
static unsigned short const unicode_to_jisx0212_58[] = {
/* 0x5800 - 0x58ff */
0x0000, 0x0000, 0x0000, 0x377a, 0x377b, 0x0000, 0x0000, 0x0000,
0x377c, 0x377d, 0x0000, 0x0000, 0x3821, 0x3822, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3823, 0x0000, 0x0000, 0x3824, 0x3825,
0x3826, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3827, 0x3828,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3829, 0x0000, 0x0000,
0x0000, 0x0000, 0x382a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x382b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x382c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x382d, 0x0000, 0x0000, 0x382e, 0x382f, 0x0000, 0x3830,
0x3831, 0x0000, 0x0000, 0x0000, 0x0000, 0x3832, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3833,
0x0000, 0x3834, 0x0000, 0x0000, 0x3835, 0x0000, 0x0000, 0x3836,
0x3837, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3838, 0x0000, 0x0000, 0x0000, 0x3839, 0x0000, 0x0000, 0x383a,
0x383b, 0x383c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x383d,
0x383e, 0x383f, 0x3840, 0x0000, 0x3841, 0x3842, 0x0000, 0x3843,
0x3844, 0x0000, 0x0000, 0x0000, 0x3845, 0x0000, 0x3846, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3847, 0x7439, 0x0000,
0x3848, 0x3849, 0x384a, 0x0000, 0x0000, 0x0000, 0x384b, 0x0000,
0x0000, 0x384c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x384d, 0x384e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3850, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3851, 0x0000, 0x384f, 0x0000, 0x0000, 0x0000,
0x3852, 0x0000, 0x0000, 0x0000, 0x0000, 0x3853, 0x3854, 0x0000,
0x3855, 0x0000, 0x3856, 0x0000, 0x3857, 0x0000, 0x3858, 0x0000,
0x0000, 0x0000, 0x3859, 0x0000, 0x0000, 0x385a, 0x0000, 0x0000,
0x0000, 0x385b, 0x385c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x385d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x385e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_59[] = {
/* 0x5900 - 0x59ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x385f, 0x3860, 0x0000,
0x0000, 0x0000, 0x0000, 0x3861, 0x3862, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3863, 0x3864, 0x3865, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3867, 0x0000, 0x0000,
0x0000, 0x3868, 0x0000, 0x3869, 0x386a, 0x0000, 0x0000, 0x0000,
0x386b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x386c,
0x386d, 0x0000, 0x0000, 0x386e, 0x0000, 0x386f, 0x3870, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3871,
0x0000, 0x0000, 0x0000, 0x3872, 0x0000, 0x0000, 0x3873, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3874, 0x3875, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3876, 0x0000, 0x3877, 0x0000, 0x3878, 0x3879, 0x387a,
0x0000, 0x387b, 0x0000, 0x387c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x387d, 0x0000, 0x387e, 0x0000, 0x3921,
0x0000, 0x0000, 0x3922, 0x0000, 0x0000, 0x3923, 0x3924, 0x0000,
0x0000, 0x3925, 0x0000, 0x3926, 0x3927, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3928, 0x3929, 0x0000, 0x392a, 0x0000,
0x0000, 0x0000, 0x392b, 0x0000, 0x0000, 0x392c, 0x0000, 0x392d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x392e,
0x0000, 0x0000, 0x0000, 0x0000, 0x392f, 0x0000, 0x0000, 0x3930,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3931, 0x3932, 0x3933,
0x3934, 0x0000, 0x0000, 0x3935, 0x0000, 0x0000, 0x0000, 0x3936,
0x0000, 0x0000, 0x3937, 0x0000, 0x3938, 0x0000, 0x0000, 0x0000,
0x0000, 0x3939, 0x0000, 0x393a, 0x393b, 0x0000, 0x0000, 0x0000,
0x393c, 0x0000, 0x393d, 0x0000, 0x0000, 0x393e, 0x0000, 0x0000,
0x0000, 0x0000, 0x393f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3940, 0x3941, 0x3942,
0x0000, 0x0000, 0x0000, 0x3943, 0x3944, 0x0000, 0x0000, 0x3945,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3946, 0x3947,
0x0000, 0x3948, 0x3949, 0x0000, 0x394a, 0x0000, 0x0000, 0x394b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5a[] = {
/* 0x5a00 - 0x5aff */
0x394c, 0x0000, 0x0000, 0x0000, 0x394d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x394e, 0x394f, 0x3950, 0x0000,
0x0000, 0x0000, 0x3951, 0x3952, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3953, 0x0000,
0x0000, 0x0000, 0x0000, 0x3954, 0x3955, 0x0000, 0x0000, 0x3956,
0x3957, 0x0000, 0x3958, 0x0000, 0x0000, 0x3959, 0x0000, 0x0000,
0x395a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x395b, 0x395c, 0x0000, 0x395d,
0x395e, 0x0000, 0x0000, 0x0000, 0x395f, 0x0000, 0x0000, 0x0000,
0x3960, 0x0000, 0x0000, 0x0000, 0x0000, 0x3961, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3962, 0x0000,
0x0000, 0x0000, 0x0000, 0x3963, 0x0000, 0x3964, 0x0000, 0x3965,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3966, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3967,
0x0000, 0x0000, 0x3968, 0x3969, 0x0000, 0x0000, 0x396a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x396b, 0x0000, 0x0000, 0x0000, 0x0000,
0x396c, 0x0000, 0x0000, 0x396d, 0x0000, 0x0000, 0x396e, 0x0000,
0x0000, 0x396f, 0x0000, 0x0000, 0x3970, 0x0000, 0x3971, 0x3972,
0x3973, 0x0000, 0x3974, 0x0000, 0x0000, 0x0000, 0x0000, 0x3975,
0x0000, 0x0000, 0x0000, 0x0000, 0x3976, 0x0000, 0x0000, 0x0000,
0x0000, 0x3977, 0x3978, 0x3979, 0x0000, 0x397a, 0x0000, 0x0000,
0x397b, 0x0000, 0x397c, 0x397d, 0x0000, 0x0000, 0x0000, 0x397e,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a21, 0x0000, 0x3a22, 0x0000,
0x3a23, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a24,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a25, 0x0000, 0x3a26, 0x0000, 0x0000, 0x0000,
0x3a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a28, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a29, 0x0000, 0x0000, 0x0000, 0x3a2a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a2b, 0x3a2c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a2d, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5b[] = {
/* 0x5b00 - 0x5bff */
0x3a2e, 0x3a2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3a30, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a31,
0x0000, 0x3a33, 0x0000, 0x3a34, 0x0000, 0x3a35, 0x0000, 0x0000,
0x0000, 0x3a36, 0x0000, 0x0000, 0x0000, 0x3a37, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a38, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a32, 0x0000, 0x0000, 0x0000,
0x3a39, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3a3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3a3b, 0x3a3c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a3d, 0x0000, 0x0000, 0x0000, 0x3a3e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a3f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3a40, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a41, 0x3a42,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a43, 0x3a44, 0x3a45, 0x3a46,
0x0000, 0x3a47, 0x0000, 0x0000, 0x3a48, 0x0000, 0x3a49, 0x0000,
0x0000, 0x0000, 0x3a4a, 0x0000, 0x0000, 0x0000, 0x3a4b, 0x0000,
0x3a4c, 0x3a4d, 0x0000, 0x3a4e, 0x3a4f, 0x0000, 0x3a50, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3a51, 0x3a52, 0x0000, 0x0000, 0x3a53, 0x3a54, 0x0000, 0x3a55,
0x0000, 0x3a56, 0x3a57, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a58,
0x0000, 0x0000, 0x3a59, 0x0000, 0x3a5a, 0x0000, 0x0000, 0x0000,
0x3a5b, 0x3a5c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a5d, 0x0000, 0x3a5e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a5f, 0x3a60,
0x3a61, 0x3a62, 0x3a63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3a64, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x743a, 0x0000, 0x0000, 0x3a65,
0x0000, 0x3a66, 0x0000, 0x0000, 0x3a67, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a68, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5c[] = {
/* 0x5c00 - 0x5cff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3a69, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a6a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3a6b, 0x3a6c,
0x0000, 0x0000, 0x0000, 0x3a6d, 0x0000, 0x0000, 0x3a6e, 0x0000,
0x0000, 0x3a6f, 0x0000, 0x3a70, 0x3a71, 0x0000, 0x3a72, 0x0000,
0x3a73, 0x0000, 0x3a74, 0x0000, 0x0000, 0x3a75, 0x3a76, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3a77, 0x3a78, 0x0000, 0x3a79, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3a7a, 0x3a7b, 0x0000, 0x0000, 0x0000, 0x3a7c,
0x3a7d, 0x3a7e, 0x0000, 0x0000, 0x0000, 0x3b21, 0x0000, 0x0000,
0x3b22, 0x0000, 0x0000, 0x0000, 0x3b23, 0x3b24, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b25, 0x3b26, 0x3b27, 0x3b28, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b29,
0x3b2a, 0x0000, 0x3b2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b2c,
0x0000, 0x0000, 0x3b2d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b2e, 0x0000, 0x3b2f,
0x3b30, 0x0000, 0x3b31, 0x3b32, 0x0000, 0x0000, 0x3b33, 0x0000,
0x0000, 0x0000, 0x3b34, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b35, 0x0000, 0x3b36, 0x3b37, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3b39, 0x0000, 0x3b3a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b3b, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b3d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b3c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b3e, 0x0000,
0x0000, 0x3b3f, 0x3b40, 0x0000, 0x3b41, 0x743b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5d[] = {
/* 0x5d00 - 0x5dff */
0x0000, 0x3b42, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b43, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b44, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b45, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b47, 0x3b48, 0x0000, 0x3b49, 0x3b4a,
0x0000, 0x0000, 0x0000, 0x3b46, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3b4b, 0x0000, 0x0000, 0x3b4c, 0x0000, 0x0000, 0x0000,
0x0000, 0x3b4d, 0x0000, 0x0000, 0x0000, 0x3b4e, 0x0000, 0x3b4f,
0x0000, 0x0000, 0x3b50, 0x3b51, 0x0000, 0x0000, 0x3b52, 0x0000,
0x3b53, 0x0000, 0x3b57, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3b55, 0x0000, 0x743c, 0x0000, 0x3b54, 0x0000, 0x0000,
0x0000, 0x3b56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b58,
0x3b59, 0x3b5a, 0x3b5b, 0x0000, 0x3b5c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b5d, 0x0000, 0x0000, 0x3b5e, 0x0000, 0x0000,
0x3b5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3b60, 0x3b61, 0x0000, 0x0000, 0x0000, 0x3b62, 0x3b63,
0x0000, 0x3b64, 0x0000, 0x3b65, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b66, 0x0000, 0x3b67, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x0000, 0x0000,
0x0000, 0x3b6c, 0x0000, 0x3b6d, 0x0000, 0x0000, 0x0000, 0x3b6e,
0x3b6f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3b70,
0x0000, 0x0000, 0x0000, 0x3b71, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b72, 0x0000, 0x6674, 0x0000, 0x3b73, 0x0000, 0x0000, 0x0000,
0x3b74, 0x3b75, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3b76, 0x0000, 0x0000, 0x0000, 0x3b77,
0x0000, 0x0000, 0x0000, 0x3b78, 0x0000, 0x0000, 0x3b7a, 0x0000,
0x3b79, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b7b, 0x3b7c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3b7d, 0x0000, 0x0000, 0x0000, 0x3b7e, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c22, 0x3c23, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5e[] = {
/* 0x5e00 - 0x5eff */
0x3c24, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c25,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c26, 0x0000, 0x0000,
0x0000, 0x0000, 0x3c27, 0x0000, 0x3c28, 0x3c29, 0x0000, 0x0000,
0x3c2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c2b,
0x3c2c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c2d, 0x0000,
0x0000, 0x0000, 0x3c2f, 0x0000, 0x0000, 0x3c30, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c31, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c34, 0x0000, 0x3c32, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c33, 0x3c35, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c36, 0x0000,
0x3c37, 0x0000, 0x0000, 0x3c38, 0x3c39, 0x0000, 0x3c3a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c3b, 0x0000, 0x3c3c, 0x3c3d, 0x3c3e, 0x3c3f, 0x3c40, 0x0000,
0x3c41, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c42, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c43, 0x0000, 0x0000, 0x3c44, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3c45, 0x0000, 0x3c46, 0x3c47, 0x0000, 0x0000,
0x3c48, 0x0000, 0x3c49, 0x0000, 0x3c4a, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c4b, 0x0000, 0x3c4c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c4d, 0x3c4e, 0x3c4f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c50, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c52, 0x3c51, 0x0000, 0x3c53, 0x0000,
0x0000, 0x3c54, 0x3c55, 0x0000, 0x3c56, 0x3c57, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3c58, 0x0000, 0x3c59, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c5a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c5b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_5f[] = {
/* 0x5f00 - 0x5fff */
0x0000, 0x0000, 0x3c5c, 0x0000, 0x0000, 0x0000, 0x3c5d, 0x3c5e,
0x3c5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c60, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3c61, 0x0000, 0x0000, 0x3c62, 0x3c63, 0x0000, 0x0000,
0x0000, 0x3c64, 0x3c65, 0x3c66, 0x3c67, 0x0000, 0x0000, 0x0000,
0x3c68, 0x0000, 0x0000, 0x3c69, 0x3c6a, 0x0000, 0x3c6b, 0x0000,
0x3c6c, 0x0000, 0x0000, 0x0000, 0x3c6d, 0x0000, 0x3c6e, 0x0000,
0x0000, 0x0000, 0x0000, 0x3c6f, 0x0000, 0x3c70, 0x0000, 0x3c71,
0x3c72, 0x0000, 0x0000, 0x0000, 0x3c73, 0x3c74, 0x0000, 0x3c75,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c76, 0x0000, 0x0000,
0x3c77, 0x0000, 0x0000, 0x0000, 0x3c78, 0x0000, 0x0000, 0x0000,
0x3c79, 0x0000, 0x0000, 0x3c7a, 0x0000, 0x0000, 0x0000, 0x0000,
0x3c7b, 0x0000, 0x0000, 0x3c7c, 0x3c7d, 0x0000, 0x0000, 0x3c7e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d21,
0x0000, 0x0000, 0x3d22, 0x0000, 0x3d23, 0x3d24, 0x0000, 0x0000,
0x3d25, 0x0000, 0x3d26, 0x0000, 0x0000, 0x3d27, 0x3d28, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3d29, 0x0000, 0x0000, 0x0000, 0x3d2a, 0x0000, 0x3d2b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d2c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d2d, 0x3d2e, 0x0000, 0x0000,
0x0000, 0x0000, 0x3d2f, 0x0000, 0x3d32, 0x0000, 0x0000, 0x3d30,
0x0000, 0x0000, 0x0000, 0x3d31, 0x3d33, 0x0000, 0x0000, 0x3d34,
0x3d35, 0x3d36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x743e,
0x3d37, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d38, 0x0000, 0x0000, 0x3d39,
0x3d3a, 0x3d3b, 0x0000, 0x3d3c, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, 0x3d41, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d42, 0x0000,
0x0000, 0x3d43, 0x3d44, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d45, 0x3d46, 0x3d47, 0x0000, 0x3d48, 0x3d49, 0x3d4a, 0x3d4b,
0x0000, 0x0000, 0x3d4c, 0x3d4d, 0x0000, 0x0000, 0x3d4e, 0x0000,
0x0000, 0x0000, 0x3d4f, 0x0000, 0x3d50, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_60[] = {
/* 0x6000 - 0x60ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d51,
0x0000, 0x0000, 0x3d52, 0x0000, 0x0000, 0x3d53, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3d54, 0x3d55, 0x0000, 0x0000, 0x3d56,
0x3d57, 0x0000, 0x3d58, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d59,
0x0000, 0x0000, 0x0000, 0x0000, 0x3d5a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d5b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3d5c, 0x0000, 0x3d5d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d5e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d5f,
0x3d60, 0x3d61, 0x0000, 0x0000, 0x3d62, 0x0000, 0x0000, 0x0000,
0x0000, 0x3d63, 0x0000, 0x0000, 0x3d64, 0x0000, 0x3d65, 0x3d66,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d67, 0x0000, 0x0000,
0x0000, 0x3d68, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d69,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3d6a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d6b, 0x3d6c,
0x0000, 0x0000, 0x3d6d, 0x0000, 0x0000, 0x743f, 0x3d6e, 0x0000,
0x3d6f, 0x0000, 0x3d70, 0x0000, 0x0000, 0x0000, 0x3d71, 0x0000,
0x0000, 0x3d72, 0x0000, 0x3d73, 0x0000, 0x3d74, 0x0000, 0x0000,
0x3d75, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d76, 0x3d77, 0x0000,
0x0000, 0x0000, 0x3d78, 0x0000, 0x3d79, 0x3d7a, 0x0000, 0x0000,
0x3d7b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3d7c, 0x3d7d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3d7e,
0x0000, 0x0000, 0x0000, 0x3e21, 0x0000, 0x0000, 0x3e22, 0x0000,
0x0000, 0x0000, 0x3e23, 0x0000, 0x3e24, 0x0000, 0x0000, 0x0000,
0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x0000, 0x0000, 0x3e29, 0x3e2a,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e2b, 0x3e2c, 0x0000, 0x0000,
0x0000, 0x3e2d, 0x0000, 0x3e2e, 0x0000, 0x3e2f, 0x3e30, 0x0000,
0x0000, 0x0000, 0x3e31, 0x0000, 0x0000, 0x3e32, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3e33, 0x0000, 0x0000, 0x3e34, 0x0000, 0x0000,
0x3e35, 0x0000, 0x0000, 0x0000, 0x3e36, 0x3e37, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_61[] = {
/* 0x6100 - 0x61ff */
0x0000, 0x0000, 0x3e38, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e39,
0x0000, 0x0000, 0x3e3a, 0x0000, 0x3e3b, 0x0000, 0x0000, 0x0000,
0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x0000, 0x3e41, 0x3e42,
0x0000, 0x3e43, 0x0000, 0x0000, 0x3e44, 0x0000, 0x3e45, 0x0000,
0x7440, 0x0000, 0x3e46, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3e47, 0x3e48, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e49, 0x3e4a, 0x0000, 0x0000, 0x0000, 0x3e4b, 0x3e4c, 0x3e4d,
0x0000, 0x3e4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3e4f, 0x0000, 0x0000, 0x0000, 0x3e50, 0x3e51, 0x0000,
0x0000, 0x3e52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e53, 0x0000,
0x3e54, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e55, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3e56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e57, 0x0000, 0x0000, 0x3e58, 0x3e59, 0x0000, 0x0000, 0x3e5a,
0x3e5b, 0x3e5c, 0x0000, 0x3e5d, 0x3e5e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3e5f, 0x0000, 0x3e60, 0x0000, 0x0000,
0x0000, 0x0000, 0x3e61, 0x3e62, 0x0000, 0x0000, 0x0000, 0x3e63,
0x3e64, 0x0000, 0x0000, 0x0000, 0x3e65, 0x3e66, 0x0000, 0x3e67,
0x3e68, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e69, 0x0000, 0x0000,
0x3e6a, 0x0000, 0x3e6b, 0x0000, 0x0000, 0x3e6c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x3e6d, 0x3e6e, 0x0000, 0x0000, 0x3e6f, 0x0000, 0x0000, 0x0000,
0x3e70, 0x3e71, 0x3e72, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e73, 0x3e74,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3e75, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3e76, 0x3e77, 0x3e78, 0x3e79,
0x0000, 0x3e7a, 0x3e7b, 0x0000, 0x0000, 0x3e7e, 0x0000, 0x3e7c,
0x0000, 0x3e7d, 0x0000, 0x0000, 0x3f21, 0x3f22, 0x0000, 0x3f23,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_62[] = {
/* 0x6200 - 0x62ff */
0x0000, 0x3f24, 0x0000, 0x3f25, 0x3f26, 0x0000, 0x0000, 0x3f27,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3f28, 0x0000, 0x3f29, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f2a, 0x0000, 0x0000, 0x0000,
0x3f2b, 0x0000, 0x3f2c, 0x3f2d, 0x0000, 0x0000, 0x0000, 0x3f2e,
0x0000, 0x3f2f, 0x0000, 0x3f30, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f31, 0x0000, 0x0000, 0x0000, 0x3f32, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f33, 0x3f34, 0x3f35, 0x0000, 0x3f36, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f37, 0x0000, 0x0000, 0x0000,
0x3f38, 0x3f39, 0x3f3a, 0x0000, 0x3f3b, 0x0000, 0x3f3c, 0x0000,
0x0000, 0x0000, 0x3f3d, 0x0000, 0x3f3e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f3f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f40, 0x0000, 0x3f41,
0x0000, 0x0000, 0x0000, 0x3f42, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f43, 0x0000, 0x0000, 0x3f44, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f45, 0x3f46, 0x3f47,
0x3f48, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f49, 0x0000,
0x3f4a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x3f4b, 0x0000, 0x0000, 0x3f4c, 0x3f4d,
0x0000, 0x0000, 0x3f4e, 0x0000, 0x0000, 0x0000, 0x3f4f, 0x3f50,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f51, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f52, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f53, 0x3f54, 0x0000,
0x0000, 0x0000, 0x3f55, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f56, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f57, 0x0000, 0x3f58, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f59, 0x3f5a, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_63[] = {
/* 0x6300 - 0x63ff */
0x0000, 0x0000, 0x0000, 0x3f5b, 0x3f5c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x3f5d, 0x3f5e, 0x0000, 0x3f5f, 0x0000, 0x0000,
0x3f60, 0x0000, 0x0000, 0x3f61, 0x0000, 0x0000, 0x3f62, 0x0000,
0x3f63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f64, 0x3f65, 0x0000, 0x0000, 0x3f66, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f67, 0x3f68, 0x0000,
0x0000, 0x3f69, 0x0000, 0x0000, 0x3f6a, 0x0000, 0x0000, 0x0000,
0x0000, 0x3f6b, 0x3f6c, 0x3f6d, 0x3f6e, 0x0000, 0x3f6f, 0x0000,
0x0000, 0x0000, 0x3f70, 0x3f71, 0x0000, 0x0000, 0x3f72, 0x0000,
0x0000, 0x0000, 0x3f73, 0x3f74, 0x3f75, 0x0000, 0x0000, 0x0000,
0x3f76, 0x0000, 0x0000, 0x3f77, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3f78, 0x3f79, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x3f7a, 0x3f7b, 0x0000, 0x0000,
0x0000, 0x3f7c, 0x0000, 0x0000, 0x3f7d, 0x3f7e, 0x0000, 0x0000,
0x4021, 0x0000, 0x0000, 0x0000, 0x4022, 0x4023, 0x0000, 0x4024,
0x0000, 0x0000, 0x4025, 0x0000, 0x4026, 0x0000, 0x0000, 0x4027,
0x0000, 0x0000, 0x4028, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4029, 0x0000, 0x0000, 0x0000, 0x402a, 0x402b, 0x0000, 0x0000,
0x0000, 0x402c, 0x402d, 0x0000, 0x0000, 0x0000, 0x402e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x402f, 0x0000, 0x4030, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4031, 0x4032, 0x4033,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4034, 0x0000, 0x0000,
0x0000, 0x4035, 0x0000, 0x0000, 0x0000, 0x4036, 0x0000, 0x0000,
0x4037, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4038, 0x0000,
0x0000, 0x4039, 0x0000, 0x403a, 0x403b, 0x403c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x403d, 0x0000, 0x0000, 0x0000,
0x403e, 0x0000, 0x0000, 0x0000, 0x0000, 0x403f, 0x0000, 0x0000,
0x0000, 0x0000, 0x4040, 0x0000, 0x4041, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4042, 0x4043, 0x0000, 0x4044, 0x0000, 0x0000,
0x4045, 0x4046, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_64[] = {
/* 0x6400 - 0x64ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4047, 0x4048, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4049, 0x0000, 0x404a, 0x0000, 0x404b, 0x0000, 0x0000, 0x0000,
0x404c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x404d, 0x0000,
0x404e, 0x0000, 0x404f, 0x0000, 0x4050, 0x4051, 0x0000, 0x0000,
0x0000, 0x4052, 0x4053, 0x0000, 0x0000, 0x0000, 0x0000, 0x4054,
0x4055, 0x0000, 0x0000, 0x0000, 0x0000, 0x4056, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4057, 0x0000, 0x4058,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4059, 0x0000, 0x0000, 0x0000, 0x405a,
0x0000, 0x405b, 0x405c, 0x405d, 0x405e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x405f, 0x4060, 0x4061, 0x4062, 0x0000, 0x4063,
0x4064, 0x4065, 0x0000, 0x4066, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4067, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4068, 0x4069, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x406a, 0x0000, 0x406b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x406c, 0x0000, 0x406d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x406e,
0x406f, 0x4070, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4071, 0x4072, 0x0000, 0x4073, 0x0000, 0x4074, 0x0000, 0x4075,
0x0000, 0x4076, 0x0000, 0x4077, 0x0000, 0x0000, 0x4078, 0x0000,
0x4079, 0x0000, 0x0000, 0x0000, 0x407a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x407b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x407c, 0x407d, 0x407e,
0x0000, 0x0000, 0x0000, 0x0000, 0x4121, 0x0000, 0x0000, 0x0000,
0x0000, 0x4122, 0x4123, 0x4124, 0x4125, 0x0000, 0x4126, 0x0000,
0x4127, 0x4128, 0x0000, 0x0000, 0x0000, 0x4129, 0x0000, 0x412a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x412b, 0x412c, 0x0000, 0x0000,
0x0000, 0x412d, 0x412e, 0x0000, 0x0000, 0x412f, 0x0000, 0x0000,
0x4130, 0x0000, 0x0000, 0x0000, 0x0000, 0x4131, 0x0000, 0x4132,
0x0000, 0x0000, 0x0000, 0x4133, 0x0000, 0x0000, 0x0000, 0x4134,
};
static unsigned short const unicode_to_jisx0212_65[] = {
/* 0x6500 - 0x65ff */
0x0000, 0x4135, 0x0000, 0x0000, 0x4136, 0x0000, 0x0000, 0x0000,
0x4137, 0x4138, 0x4139, 0x0000, 0x0000, 0x0000, 0x0000, 0x413a,
0x0000, 0x0000, 0x0000, 0x413b, 0x413c, 0x0000, 0x413d, 0x0000,
0x0000, 0x413e, 0x0000, 0x413f, 0x0000, 0x0000, 0x4140, 0x4141,
0x0000, 0x0000, 0x4142, 0x0000, 0x0000, 0x0000, 0x4143, 0x0000,
0x0000, 0x4144, 0x0000, 0x0000, 0x0000, 0x0000, 0x4145, 0x0000,
0x0000, 0x4146, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4147, 0x0000, 0x4148, 0x4149, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x414a, 0x0000, 0x0000, 0x0000, 0x414b,
0x0000, 0x414c, 0x0000, 0x0000, 0x0000, 0x0000, 0x7441, 0x0000,
0x414d, 0x0000, 0x414e, 0x0000, 0x414f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4150,
0x4151, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4152,
0x0000, 0x0000, 0x0000, 0x4153, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4154, 0x0000, 0x0000, 0x4155, 0x0000, 0x0000,
0x0000, 0x4156, 0x0000, 0x0000, 0x0000, 0x4157, 0x0000, 0x0000,
0x0000, 0x0000, 0x4158, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4159, 0x0000, 0x0000, 0x415a, 0x0000, 0x0000,
0x415b, 0x0000, 0x0000, 0x0000, 0x0000, 0x415c, 0x0000, 0x0000,
0x415d, 0x0000, 0x0000, 0x415e, 0x0000, 0x0000, 0x415f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4160, 0x0000,
0x0000, 0x0000, 0x4161, 0x4162, 0x4163, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4164,
0x0000, 0x0000, 0x4165, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4166, 0x4167, 0x0000, 0x0000, 0x0000, 0x0000, 0x4168, 0x0000,
0x4169, 0x0000, 0x0000, 0x0000, 0x416a, 0x0000, 0x416b, 0x0000,
0x416c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x416d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x416e, 0x0000, 0x416f, 0x0000, 0x4170, 0x4171, 0x0000, 0x0000,
0x0000, 0x4172, 0x0000, 0x0000, 0x0000, 0x0000, 0x4173, 0x4174,
};
static unsigned short const unicode_to_jisx0212_66[] = {
/* 0x6600 - 0x66ff */
0x4175, 0x0000, 0x0000, 0x0000, 0x4176, 0x0000, 0x0000, 0x0000,
0x4177, 0x4178, 0x0000, 0x0000, 0x0000, 0x4179, 0x0000, 0x0000,
0x0000, 0x417a, 0x417b, 0x0000, 0x0000, 0x417c, 0x417d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x417e, 0x4221, 0x0000,
0x0000, 0x4222, 0x4223, 0x4224, 0x4225, 0x0000, 0x4226, 0x0000,
0x0000, 0x4227, 0x4228, 0x4229, 0x422a, 0x0000, 0x422b, 0x0000,
0x422c, 0x422d, 0x0000, 0x422e, 0x0000, 0x0000, 0x0000, 0x4230,
0x0000, 0x422f, 0x0000, 0x7442, 0x0000, 0x0000, 0x0000, 0x0000,
0x4231, 0x0000, 0x0000, 0x0000, 0x0000, 0x4232, 0x4233, 0x0000,
0x0000, 0x0000, 0x4234, 0x0000, 0x4235, 0x0000, 0x4237, 0x0000,
0x0000, 0x4236, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4238,
0x4239, 0x423a, 0x0000, 0x423b, 0x423c, 0x0000, 0x0000, 0x0000,
0x423d, 0x423e, 0x0000, 0x0000, 0x0000, 0x7443, 0x0000, 0x0000,
0x0000, 0x0000, 0x4240, 0x4241, 0x4242, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4244, 0x0000, 0x4245, 0x0000, 0x4247,
0x4248, 0x4249, 0x0000, 0x424a, 0x424c, 0x0000, 0x4243, 0x4246,
0x424b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x424d, 0x424e, 0x424f, 0x0000, 0x0000,
0x4250, 0x0000, 0x4251, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4252, 0x4253, 0x4254, 0x4255, 0x0000, 0x0000, 0x4256,
0x4257, 0x0000, 0x0000, 0x0000, 0x4258, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4259, 0x0000, 0x0000,
0x0000, 0x425a, 0x425b, 0x0000, 0x0000, 0x425c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x425d, 0x0000, 0x0000, 0x0000, 0x425e,
0x425f, 0x0000, 0x4260, 0x4261, 0x0000, 0x0000, 0x0000, 0x0000,
0x4262, 0x0000, 0x0000, 0x0000, 0x4263, 0x0000, 0x4264, 0x4265,
0x0000, 0x0000, 0x0000, 0x0000, 0x4266, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4267, 0x0000, 0x0000, 0x0000, 0x4268,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4269, 0x0000, 0x0000, 0x426a, 0x426b, 0x0000, 0x426c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x426d, 0x423f, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_67[] = {
/* 0x6700 - 0x67ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x426e, 0x0000, 0x426f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4270, 0x0000,
0x0000, 0x0000, 0x0000, 0x4271, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4272, 0x0000, 0x0000, 0x4273, 0x0000, 0x0000, 0x0000,
0x4274, 0x0000, 0x4275, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4276, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4277, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4278, 0x0000, 0x4279,
0x427a, 0x0000, 0x0000, 0x0000, 0x427b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x427c, 0x427d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x427e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4321, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4322, 0x0000, 0x4323, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4324, 0x0000, 0x4325, 0x0000,
0x0000, 0x0000, 0x0000, 0x4326, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4327, 0x0000, 0x0000, 0x4328, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4329, 0x432a,
0x0000, 0x432b, 0x0000, 0x432c, 0x0000, 0x0000, 0x432d, 0x0000,
0x432e, 0x432f, 0x0000, 0x4330, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4331, 0x4332, 0x4333, 0x0000, 0x0000, 0x4334, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4335, 0x4336, 0x4337, 0x0000, 0x0000,
0x4339, 0x0000, 0x433a, 0x433b, 0x0000, 0x433c, 0x0000, 0x0000,
0x433d, 0x433e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x433f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4340,
0x0000, 0x4341, 0x0000, 0x0000, 0x4342, 0x0000, 0x0000, 0x0000,
0x0000, 0x4343, 0x0000, 0x0000, 0x0000, 0x0000, 0x4344, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4345, 0x0000, 0x4346, 0x0000, 0x0000, 0x0000, 0x4347, 0x4348,
0x0000, 0x4338, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_68[] = {
/* 0x6800 - 0x68ff */
0x0000, 0x7446, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x434a, 0x0000, 0x0000, 0x0000,
0x0000, 0x434b, 0x0000, 0x0000, 0x0000, 0x434c, 0x0000, 0x434d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x434f,
0x434e, 0x0000, 0x0000, 0x0000, 0x4350, 0x4351, 0x0000, 0x4352,
0x4353, 0x4354, 0x0000, 0x4355, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4356, 0x0000, 0x0000, 0x0000, 0x4357,
0x0000, 0x0000, 0x0000, 0x0000, 0x4358, 0x4359, 0x0000, 0x0000,
0x0000, 0x0000, 0x435a, 0x0000, 0x435b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4349, 0x0000, 0x0000, 0x435c, 0x0000, 0x435d,
0x435e, 0x0000, 0x0000, 0x435f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4360, 0x0000, 0x0000, 0x4361, 0x4362,
0x4363, 0x4364, 0x4365, 0x0000, 0x0000, 0x4366, 0x0000, 0x0000,
0x0000, 0x4367, 0x4368, 0x4369, 0x436a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x436b, 0x0000, 0x436c, 0x0000, 0x436d, 0x0000,
0x436e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x436f, 0x0000,
0x4370, 0x0000, 0x4371, 0x0000, 0x4372, 0x0000, 0x0000, 0x0000,
0x0000, 0x4373, 0x0000, 0x4374, 0x0000, 0x4375, 0x0000, 0x0000,
0x0000, 0x4376, 0x4377, 0x0000, 0x0000, 0x0000, 0x4378, 0x0000,
0x0000, 0x0000, 0x4379, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x437a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x437b, 0x0000, 0x0000,
0x437c, 0x0000, 0x0000, 0x0000, 0x437d, 0x0000, 0x0000, 0x437e,
0x4421, 0x4422, 0x0000, 0x4423, 0x0000, 0x0000, 0x4424, 0x0000,
0x0000, 0x4425, 0x0000, 0x0000, 0x4426, 0x4427, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4428, 0x0000, 0x0000,
0x4429, 0x0000, 0x442a, 0x442b, 0x442c, 0x442d, 0x0000, 0x0000,
0x442e, 0x442f, 0x0000, 0x0000, 0x0000, 0x4430, 0x4431, 0x0000,
0x0000, 0x0000, 0x0000, 0x4432, 0x4433, 0x4434, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_69[] = {
/* 0x6900 - 0x69ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4435, 0x0000,
0x0000, 0x4436, 0x4437, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4438, 0x4439, 0x0000, 0x443a, 0x0000, 0x0000, 0x443b, 0x443c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x443d, 0x0000, 0x443e, 0x0000, 0x443f, 0x0000, 0x0000,
0x4440, 0x0000, 0x0000, 0x4441, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4442, 0x0000, 0x0000, 0x4443, 0x0000, 0x0000,
0x0000, 0x4444, 0x0000, 0x0000, 0x0000, 0x0000, 0x4445, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4446,
0x0000, 0x0000, 0x0000, 0x4447, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4448, 0x4449, 0x444a, 0x444b, 0x0000,
0x444c, 0x444d, 0x0000, 0x0000, 0x444e, 0x0000, 0x0000, 0x0000,
0x444f, 0x4450, 0x4451, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4452, 0x4453, 0x0000, 0x0000, 0x0000, 0x4454,
0x4455, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4456, 0x0000, 0x0000,
0x0000, 0x0000, 0x4457, 0x0000, 0x0000, 0x0000, 0x4458, 0x0000,
0x4459, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x445a, 0x0000, 0x0000, 0x0000, 0x445b, 0x445c, 0x0000,
0x445d, 0x0000, 0x0000, 0x445e, 0x0000, 0x445f, 0x0000, 0x4460,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4461,
0x4462, 0x0000, 0x4463, 0x0000, 0x4464, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4465, 0x0000, 0x0000,
0x4466, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4467, 0x0000, 0x0000, 0x0000, 0x0000, 0x4468, 0x4469,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x446a, 0x0000, 0x0000, 0x446b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x446c, 0x446d,
0x0000, 0x446e, 0x0000, 0x446f, 0x0000, 0x4470, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4471, 0x0000,
};
static unsigned short const unicode_to_jisx0212_6a[] = {
/* 0x6a00 - 0x6aff */
0x4472, 0x4473, 0x0000, 0x4474, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4475,
0x0000, 0x4476, 0x0000, 0x0000, 0x0000, 0x4477, 0x0000, 0x0000,
0x0000, 0x0000, 0x4478, 0x0000, 0x0000, 0x4479, 0x0000, 0x0000,
0x447a, 0x0000, 0x0000, 0x0000, 0x447b, 0x0000, 0x0000, 0x0000,
0x447c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x447d, 0x0000, 0x447e, 0x0000, 0x4521, 0x0000, 0x0000, 0x4522,
0x0000, 0x0000, 0x0000, 0x4523, 0x0000, 0x0000, 0x4524, 0x4525,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4526, 0x4527, 0x0000,
0x0000, 0x4528, 0x4529, 0x0000, 0x0000, 0x0000, 0x452a, 0x0000,
0x452b, 0x452c, 0x452d, 0x0000, 0x0000, 0x452e, 0x452f, 0x0000,
0x0000, 0x0000, 0x0000, 0x4530, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4531, 0x0000, 0x0000, 0x4532,
0x0000, 0x0000, 0x4533, 0x7449, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4534, 0x0000, 0x4535, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4536, 0x0000,
0x0000, 0x4537, 0x0000, 0x4538, 0x0000, 0x0000, 0x4539, 0x453a,
0x0000, 0x453b, 0x0000, 0x453c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x453d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x453e, 0x0000, 0x453f, 0x4540, 0x4541,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4542, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4543, 0x0000, 0x0000, 0x0000, 0x4544,
0x4545, 0x4546, 0x0000, 0x0000, 0x4547, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4548, 0x4549, 0x454a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x454b, 0x0000,
0x454d, 0x454c, 0x0000, 0x0000, 0x454e, 0x0000, 0x0000, 0x0000,
0x454f, 0x0000, 0x0000, 0x0000, 0x4550, 0x4551, 0x4552, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4553, 0x4554, 0x0000, 0x0000,
0x0000, 0x0000, 0x744a, 0x0000, 0x4555, 0x0000, 0x0000, 0x4556,
0x0000, 0x0000, 0x0000, 0x0000, 0x4557, 0x0000, 0x0000, 0x0000,
0x4558, 0x4559, 0x455a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x455b, 0x455c, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_6b[] = {
/* 0x6b00 - 0x6bff */
0x0000, 0x0000, 0x455d, 0x455e, 0x0000, 0x0000, 0x455f, 0x4560,
0x0000, 0x4561, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4562,
0x4563, 0x4564, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4565,
0x0000, 0x0000, 0x0000, 0x4566, 0x0000, 0x0000, 0x4567, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4568, 0x0000, 0x0000, 0x0000,
0x4569, 0x0000, 0x0000, 0x456a, 0x456b, 0x0000, 0x0000, 0x456c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x456d, 0x456e, 0x0000,
0x0000, 0x0000, 0x0000, 0x456f, 0x0000, 0x0000, 0x0000, 0x4570,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4571, 0x0000,
0x0000, 0x0000, 0x4572, 0x0000, 0x0000, 0x4573, 0x0000, 0x0000,
0x0000, 0x0000, 0x4574, 0x0000, 0x0000, 0x0000, 0x4575, 0x0000,
0x4576, 0x0000, 0x0000, 0x0000, 0x0000, 0x4577, 0x0000, 0x0000,
0x4578, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4579,
0x0000, 0x0000, 0x0000, 0x457a, 0x0000, 0x0000, 0x457b, 0x0000,
0x457c, 0x0000, 0x0000, 0x0000, 0x0000, 0x457d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x457e, 0x4621, 0x0000,
0x0000, 0x0000, 0x4622, 0x0000, 0x0000, 0x4623, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4624,
0x0000, 0x0000, 0x0000, 0x4625, 0x0000, 0x0000, 0x0000, 0x4626,
0x4627, 0x0000, 0x4628, 0x4629, 0x0000, 0x0000, 0x0000, 0x0000,
0x462a, 0x462b, 0x0000, 0x0000, 0x462c, 0x462d, 0x462e, 0x0000,
0x462f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4630, 0x4631, 0x0000, 0x0000, 0x0000, 0x4632, 0x4633, 0x0000,
0x0000, 0x0000, 0x0000, 0x4634, 0x4635, 0x0000, 0x0000, 0x0000,
0x0000, 0x4636, 0x0000, 0x0000, 0x4637, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4638, 0x0000,
0x0000, 0x0000, 0x4639, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x463a, 0x0000, 0x463b, 0x0000, 0x0000, 0x463c, 0x463d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x463e, 0x0000,
0x0000, 0x463f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4640,
0x0000, 0x4641, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4642,
};
static unsigned short const unicode_to_jisx0212_6c[] = {
/* 0x6c00 - 0x6cff */
0x0000, 0x0000, 0x4643, 0x0000, 0x4644, 0x4645, 0x0000, 0x0000,
0x0000, 0x4646, 0x0000, 0x0000, 0x0000, 0x4647, 0x4648, 0x0000,
0x4649, 0x0000, 0x464a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x464b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x464c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x464d, 0x464e,
0x464f, 0x0000, 0x0000, 0x0000, 0x4650, 0x0000, 0x4651, 0x0000,
0x0000, 0x0000, 0x0000, 0x4652, 0x0000, 0x4653, 0x4654, 0x0000,
0x0000, 0x0000, 0x4655, 0x4656, 0x0000, 0x0000, 0x0000, 0x4657,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4658, 0x4659, 0x0000, 0x465a, 0x0000, 0x465b,
0x0000, 0x0000, 0x465c, 0x0000, 0x465d, 0x0000, 0x0000, 0x0000,
0x0000, 0x465e, 0x0000, 0x465f, 0x4660, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4736,
0x0000, 0x0000, 0x0000, 0x4661, 0x0000, 0x4662, 0x0000, 0x4663,
0x0000, 0x0000, 0x0000, 0x0000, 0x4664, 0x0000, 0x4665, 0x0000,
0x4666, 0x4667, 0x0000, 0x4668, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4669, 0x466a, 0x466b,
0x0000, 0x466c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x466d, 0x466e, 0x0000, 0x466f,
0x4670, 0x0000, 0x0000, 0x0000, 0x4671, 0x0000, 0x0000, 0x4672,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4673, 0x0000, 0x4674, 0x0000, 0x4675, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4676, 0x0000, 0x0000, 0x0000, 0x4677, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4678, 0x0000, 0x4679,
0x467a, 0x467b, 0x467c, 0x0000, 0x467d, 0x0000, 0x467e, 0x0000,
0x0000, 0x0000, 0x4721, 0x0000, 0x4722, 0x0000, 0x0000, 0x0000,
0x4723, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4724,
0x0000, 0x4725, 0x0000, 0x4726, 0x4727, 0x0000, 0x4728, 0x0000,
0x0000, 0x0000, 0x4729, 0x0000, 0x472a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_6d[] = {
/* 0x6d00 - 0x6dff */
0x0000, 0x0000, 0x0000, 0x0000, 0x472b, 0x0000, 0x0000, 0x472c,
0x0000, 0x0000, 0x472d, 0x0000, 0x0000, 0x0000, 0x472e, 0x472f,
0x0000, 0x4730, 0x0000, 0x4731, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4732, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4733, 0x4734,
0x4735, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4737, 0x4738,
0x0000, 0x4739, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x473a, 0x0000, 0x0000, 0x473b, 0x0000, 0x0000, 0x473c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x473d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x473e, 0x473f,
0x0000, 0x4740, 0x0000, 0x0000, 0x0000, 0x4741, 0x0000, 0x4742,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4743,
0x4744, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4745, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4746, 0x0000, 0x0000, 0x0000, 0x0000, 0x4747,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4748, 0x4749, 0x0000, 0x474a, 0x0000, 0x474b, 0x474c,
0x474d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x474e, 0x0000, 0x474f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4750, 0x0000, 0x0000, 0x4751,
0x0000, 0x4752, 0x0000, 0x0000, 0x0000, 0x4753, 0x0000, 0x4754,
0x0000, 0x0000, 0x0000, 0x0000, 0x4755, 0x0000, 0x0000, 0x0000,
0x4756, 0x0000, 0x4757, 0x0000, 0x0000, 0x0000, 0x4758, 0x4759,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x475a, 0x0000,
0x0000, 0x0000, 0x0000, 0x475b, 0x0000, 0x475c, 0x0000, 0x475d,
0x475e, 0x0000, 0x475f, 0x0000, 0x0000, 0x4760, 0x0000, 0x0000,
0x0000, 0x4761, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4762,
0x4763, 0x0000, 0x744c, 0x0000, 0x4764, 0x0000, 0x4765, 0x0000,
0x744b, 0x0000, 0x0000, 0x0000, 0x4766, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_6e[] = {
/* 0x6e00 - 0x6eff */
0x4767, 0x0000, 0x0000, 0x0000, 0x4768, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4769, 0x0000,
0x0000, 0x0000, 0x476a, 0x0000, 0x0000, 0x0000, 0x0000, 0x476b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x476c, 0x0000, 0x0000, 0x0000, 0x476d, 0x0000,
0x0000, 0x476e, 0x0000, 0x476f, 0x4770, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4771, 0x4772, 0x0000, 0x0000,
0x4773, 0x4774, 0x0000, 0x4775, 0x0000, 0x0000, 0x0000, 0x4776,
0x0000, 0x4777, 0x4778, 0x4779, 0x477a, 0x0000, 0x0000, 0x477b,
0x0000, 0x0000, 0x0000, 0x0000, 0x477c, 0x477d, 0x477e, 0x0000,
0x0000, 0x0000, 0x4821, 0x4822, 0x0000, 0x0000, 0x0000, 0x0000,
0x4823, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4824, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4825, 0x0000, 0x4826, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4827, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4828, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4829, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x482a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x482b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x482c, 0x482d, 0x0000,
0x0000, 0x482e, 0x0000, 0x482f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4830, 0x0000, 0x0000, 0x0000, 0x4831,
0x4832, 0x4833, 0x0000, 0x4834, 0x0000, 0x0000, 0x0000, 0x4835,
0x4836, 0x0000, 0x4837, 0x0000, 0x0000, 0x4838, 0x4839, 0x483a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x483b, 0x0000, 0x483c, 0x483d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x483e, 0x0000, 0x483f, 0x0000, 0x4840, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_6f[] = {
/* 0x6f00 - 0x6fff */
0x0000, 0x0000, 0x0000, 0x0000, 0x4841, 0x0000, 0x0000, 0x0000,
0x4842, 0x0000, 0x4843, 0x0000, 0x4844, 0x4845, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4846, 0x0000,
0x4847, 0x0000, 0x4848, 0x4849, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x484a, 0x0000,
0x0000, 0x484b, 0x484c, 0x0000, 0x0000, 0x4853, 0x0000, 0x484d,
0x484e, 0x0000, 0x0000, 0x484f, 0x0000, 0x0000, 0x4850, 0x0000,
0x0000, 0x0000, 0x0000, 0x4851, 0x4852, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4854,
0x0000, 0x4855, 0x4856, 0x4857, 0x0000, 0x0000, 0x0000, 0x4858,
0x0000, 0x4859, 0x485a, 0x0000, 0x0000, 0x485b, 0x485c, 0x0000,
0x0000, 0x485d, 0x485e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x485f, 0x0000, 0x0000, 0x0000, 0x4860, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4861, 0x4862, 0x0000,
0x0000, 0x0000, 0x0000, 0x4863, 0x0000, 0x0000, 0x0000, 0x4864,
0x4865, 0x0000, 0x0000, 0x4866, 0x4867, 0x4868, 0x0000, 0x0000,
0x4869, 0x0000, 0x486a, 0x486b, 0x486c, 0x0000, 0x486d, 0x0000,
0x0000, 0x0000, 0x486e, 0x0000, 0x0000, 0x0000, 0x0000, 0x486f,
0x4870, 0x0000, 0x0000, 0x0000, 0x0000, 0x4871, 0x4872, 0x4873,
0x4874, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4875, 0x4876,
0x4877, 0x0000, 0x0000, 0x0000, 0x0000, 0x4878, 0x4879, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x487a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x487b, 0x0000, 0x487c,
0x487d, 0x0000, 0x487e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4921, 0x0000, 0x0000, 0x0000, 0x4922, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4923, 0x4924, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4925, 0x0000, 0x0000, 0x0000, 0x0000, 0x4926, 0x0000, 0x0000,
0x0000, 0x4927, 0x0000, 0x0000, 0x4928, 0x4929, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_70[] = {
/* 0x7000 - 0x70ff */
0x492a, 0x0000, 0x0000, 0x0000, 0x0000, 0x492b, 0x492c, 0x492d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x492e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x492f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4930, 0x0000, 0x0000, 0x4931, 0x0000, 0x0000, 0x0000, 0x0000,
0x744d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4932,
0x0000, 0x0000, 0x0000, 0x0000, 0x4933, 0x0000, 0x0000, 0x4934,
0x0000, 0x4935, 0x0000, 0x0000, 0x4936, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4937, 0x4938, 0x0000, 0x0000, 0x0000,
0x4939, 0x493a, 0x493b, 0x493c, 0x0000, 0x0000, 0x4941, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x493d, 0x493e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x493f, 0x4940, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4942, 0x4943, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4944, 0x0000, 0x4945, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4946, 0x4947, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4948, 0x0000,
0x0000, 0x4949, 0x0000, 0x0000, 0x0000, 0x494a, 0x494b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x494c, 0x494d, 0x494e, 0x494f,
0x4950, 0x0000, 0x0000, 0x4951, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4952, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4953, 0x0000, 0x0000, 0x0000, 0x0000,
0x4954, 0x4955, 0x0000, 0x0000, 0x4956, 0x0000, 0x0000, 0x4957,
0x0000, 0x0000, 0x0000, 0x742e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4958, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4959, 0x0000, 0x495a, 0x495b, 0x495c, 0x495d, 0x0000,
0x495e, 0x0000, 0x0000, 0x0000, 0x495f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4960, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4961, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_71[] = {
/* 0x7100 - 0x71ff */
0x0000, 0x0000, 0x0000, 0x4962, 0x4963, 0x4964, 0x4965, 0x4966,
0x0000, 0x0000, 0x0000, 0x4967, 0x4968, 0x0000, 0x0000, 0x4969,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x496a, 0x0000,
0x496b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x496c, 0x0000, 0x496d, 0x0000, 0x496e,
0x496f, 0x4970, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4971, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4972, 0x0000, 0x0000, 0x0000, 0x4973, 0x4974, 0x4975,
0x0000, 0x0000, 0x4976, 0x4977, 0x0000, 0x0000, 0x0000, 0x0000,
0x4978, 0x0000, 0x4979, 0x0000, 0x0000, 0x0000, 0x0000, 0x497a,
0x0000, 0x0000, 0x497b, 0x0000, 0x497c, 0x0000, 0x497d, 0x0000,
0x497e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a22, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a23, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a24, 0x0000, 0x4a25,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a26, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4a27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4a28, 0x4a29, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a2a, 0x0000, 0x4a2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a2c,
0x4a2d, 0x0000, 0x4a2e, 0x4a2f, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4a30, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a31,
0x4a32, 0x4a33, 0x0000, 0x0000, 0x4a34, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a35, 0x4a36, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a37, 0x0000, 0x0000, 0x4a38, 0x0000,
0x0000, 0x4a39, 0x4a3a, 0x0000, 0x4a3b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a3d, 0x0000,
};
static unsigned short const unicode_to_jisx0212_72[] = {
/* 0x7200 - 0x72ff */
0x4a3e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a3f,
0x4a40, 0x4a41, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a42, 0x0000, 0x0000, 0x0000, 0x4a43,
0x0000, 0x0000, 0x4a44, 0x0000, 0x0000, 0x4a45, 0x0000, 0x4a46,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a47, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a48, 0x0000, 0x0000, 0x0000, 0x4a49,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a4a, 0x0000, 0x0000, 0x0000,
0x4a4b, 0x4a4c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a4d, 0x4a4e, 0x4a4f, 0x0000, 0x4a50, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a51, 0x4a52,
0x4a53, 0x0000, 0x0000, 0x4a54, 0x0000, 0x4a55, 0x4a56, 0x0000,
0x0000, 0x0000, 0x4a57, 0x0000, 0x4a58, 0x0000, 0x4a59, 0x0000,
0x4a5a, 0x0000, 0x0000, 0x4a5b, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a5c, 0x0000, 0x0000, 0x4a5d, 0x0000, 0x0000, 0x4a5e, 0x4a5f,
0x0000, 0x4a60, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a61,
0x4a62, 0x0000, 0x0000, 0x4a63, 0x4a64, 0x0000, 0x0000, 0x4a65,
0x0000, 0x0000, 0x0000, 0x0000, 0x4a66, 0x0000, 0x0000, 0x0000,
0x0000, 0x4a67, 0x0000, 0x0000, 0x0000, 0x4a68, 0x4a69, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a6a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a6b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4a6c, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a6d, 0x4a6e, 0x0000,
0x0000, 0x4a6f, 0x0000, 0x0000, 0x4a70, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a71, 0x0000,
0x0000, 0x4a72, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a73,
0x0000, 0x4a74, 0x0000, 0x0000, 0x4a75, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a76, 0x4a77, 0x0000,
0x4a78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a79,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4a7a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4a7b, 0x4a7c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4a7d, 0x4a7e, 0x0000, 0x0000, 0x4b21, 0x0000,
};
static unsigned short const unicode_to_jisx0212_73[] = {
/* 0x7300 - 0x73ff */
0x0000, 0x0000, 0x4b22, 0x0000, 0x4b23, 0x4b24, 0x0000, 0x4b25,
0x0000, 0x0000, 0x0000, 0x4b26, 0x0000, 0x4b27, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b28, 0x4b29, 0x0000, 0x0000, 0x0000, 0x0000,
0x4b2a, 0x4b2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b2c, 0x0000,
0x0000, 0x0000, 0x4b2d, 0x0000, 0x4b2e, 0x0000, 0x0000, 0x4b2f,
0x4b30, 0x0000, 0x0000, 0x0000, 0x4b31, 0x0000, 0x0000, 0x0000,
0x0000, 0x4b32, 0x4b33, 0x0000, 0x0000, 0x4b34, 0x0000, 0x0000,
0x0000, 0x0000, 0x4b35, 0x4b36, 0x0000, 0x4b37, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4b38, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b39, 0x0000, 0x0000,
0x4b3a, 0x0000, 0x4b3b, 0x0000, 0x0000, 0x0000, 0x4b3c, 0x0000,
0x4b3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b3e, 0x4b3f, 0x4b40,
0x4b41, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b42, 0x4b43,
0x0000, 0x4b44, 0x0000, 0x4b45, 0x4b46, 0x0000, 0x4b47, 0x4b48,
0x0000, 0x4b49, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b4a,
0x0000, 0x4b4b, 0x0000, 0x0000, 0x4b4c, 0x0000, 0x0000, 0x0000,
0x4b4d, 0x4b4e, 0x0000, 0x4b4f, 0x0000, 0x4b50, 0x4b51, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b52, 0x0000,
0x4b53, 0x0000, 0x0000, 0x4b54, 0x0000, 0x4b55, 0x0000, 0x4b56,
0x4b57, 0x0000, 0x0000, 0x0000, 0x4b58, 0x0000, 0x4b59, 0x4b5a,
0x4b5b, 0x0000, 0x4b5c, 0x0000, 0x0000, 0x4b5d, 0x4b5e, 0x0000,
0x0000, 0x0000, 0x4b5f, 0x4b60, 0x0000, 0x4b61, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b62, 0x0000, 0x4b63,
0x0000, 0x4b64, 0x0000, 0x0000, 0x4b65, 0x4b66, 0x0000, 0x4b67,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4b68, 0x4b69, 0x0000,
0x0000, 0x4b6a, 0x0000, 0x4b6b, 0x4b6c, 0x0000, 0x0000, 0x4b6d,
0x0000, 0x0000, 0x4b6e, 0x4b6f, 0x0000, 0x0000, 0x4b70, 0x0000,
0x0000, 0x4b71, 0x0000, 0x0000, 0x0000, 0x4b72, 0x0000, 0x0000,
0x0000, 0x4b73, 0x0000, 0x4b74, 0x0000, 0x0000, 0x4b75, 0x4b76,
0x0000, 0x4b77, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4b78, 0x4b79, 0x0000, 0x4b7a,
0x0000, 0x4b7b, 0x4b7c, 0x4b7d, 0x0000, 0x4b7e, 0x0000, 0x4c21,
};
static unsigned short const unicode_to_jisx0212_74[] = {
/* 0x7400 - 0x74ff */
0x4c22, 0x4c23, 0x0000, 0x0000, 0x4c24, 0x0000, 0x0000, 0x4c25,
0x0000, 0x0000, 0x4c26, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4c27, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c28, 0x4c29, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4c2a, 0x0000, 0x4c2b, 0x0000,
0x4c2c, 0x4c2d, 0x4c2e, 0x4c2f, 0x4c30, 0x4c31, 0x4c32, 0x4c33,
0x4c34, 0x4c35, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4c36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c37, 0x0000, 0x0000, 0x4c38, 0x4c39, 0x0000, 0x4c3a, 0x4c3b,
0x0000, 0x0000, 0x0000, 0x4c3c, 0x0000, 0x4c3d, 0x0000, 0x0000,
0x0000, 0x4c3e, 0x4c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c40,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c41, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c42, 0x0000, 0x0000, 0x0000, 0x4c43, 0x4c44,
0x4c45, 0x0000, 0x0000, 0x4c46, 0x0000, 0x4c47, 0x4c48, 0x0000,
0x0000, 0x4c49, 0x4c4a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c4b, 0x4c4c, 0x0000, 0x0000, 0x0000, 0x4c4d, 0x4c4e, 0x4c4f,
0x0000, 0x4c50, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c51,
0x4c52, 0x4c53, 0x4c54, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c55, 0x4c56, 0x4c57, 0x0000, 0x4c58, 0x0000, 0x0000, 0x4c59,
0x4c5a, 0x4c5b, 0x0000, 0x4c5c, 0x0000, 0x0000, 0x4c5d, 0x0000,
0x4c5e, 0x4c5f, 0x4c60, 0x4c61, 0x0000, 0x0000, 0x4c62, 0x4c63,
0x0000, 0x4c64, 0x4c65, 0x0000, 0x0000, 0x4c66, 0x0000, 0x0000,
0x0000, 0x4c67, 0x0000, 0x4c68, 0x0000, 0x0000, 0x0000, 0x4c69,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c6a, 0x4c6b, 0x0000, 0x0000, 0x4c6c, 0x0000, 0x0000, 0x0000,
0x4c6d, 0x0000, 0x0000, 0x4c6e, 0x0000, 0x0000, 0x0000, 0x0000,
0x4c6f, 0x0000, 0x4c70, 0x4c71, 0x0000, 0x0000, 0x4c72, 0x4c73,
0x0000, 0x0000, 0x0000, 0x0000, 0x4c74, 0x0000, 0x0000, 0x0000,
0x4c75, 0x0000, 0x4c76, 0x4c77, 0x0000, 0x0000, 0x0000, 0x4c78,
0x0000, 0x0000, 0x0000, 0x0000, 0x4c79, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4c7a, 0x4c7b, 0x4c7c, 0x0000, 0x0000, 0x4c7d,
};
static unsigned short const unicode_to_jisx0212_75[] = {
/* 0x7500 - 0x75ff */
0x0000, 0x7450, 0x0000, 0x0000, 0x0000, 0x0000, 0x4c7e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d21, 0x0000, 0x0000, 0x0000, 0x4d22, 0x4d23,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4d24, 0x4d25, 0x0000, 0x0000, 0x4d26, 0x0000, 0x0000, 0x4d27,
0x0000, 0x4d28, 0x4d29, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d2a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d2b, 0x0000,
0x0000, 0x4d2c, 0x0000, 0x0000, 0x0000, 0x4d2d, 0x4d2e, 0x4d2f,
0x4d30, 0x0000, 0x0000, 0x4d31, 0x0000, 0x0000, 0x0000, 0x4d32,
0x4d33, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d34, 0x0000,
0x4d35, 0x0000, 0x4d36, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d37,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d38, 0x4d39,
0x0000, 0x4d3a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d3b,
0x0000, 0x4d3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d3d, 0x4d3e, 0x4d3f, 0x4d40, 0x4d41, 0x4d42, 0x0000,
0x0000, 0x4d43, 0x0000, 0x0000, 0x0000, 0x4d44, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4d45, 0x0000, 0x4d46, 0x4d47, 0x0000, 0x4d48, 0x0000, 0x0000,
0x0000, 0x4d49, 0x0000, 0x0000, 0x4d4a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d4b, 0x0000, 0x4d4c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d4d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d4f,
0x4d50, 0x4d51, 0x0000, 0x0000, 0x4d52, 0x0000, 0x4d53, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d54, 0x0000, 0x4d55, 0x4d56,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4d57,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d58, 0x0000, 0x0000, 0x4d59,
0x4d5a, 0x4d5b, 0x0000, 0x0000, 0x4d5c, 0x0000, 0x0000, 0x4d5d,
0x0000, 0x0000, 0x0000, 0x0000, 0x4d5e, 0x0000, 0x4d5f, 0x4d60,
0x0000, 0x4d61, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4d62, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_76[] = {
/* 0x7600 - 0x76ff */
0x4d63, 0x0000, 0x4d64, 0x4d65, 0x4d66, 0x0000, 0x0000, 0x4d67,
0x4d68, 0x0000, 0x4d69, 0x0000, 0x4d6a, 0x0000, 0x0000, 0x4d6b,
0x0000, 0x0000, 0x4d6c, 0x4d6d, 0x0000, 0x4d6e, 0x4d6f, 0x0000,
0x0000, 0x4d70, 0x0000, 0x4d71, 0x4d72, 0x4d73, 0x4d74, 0x0000,
0x0000, 0x0000, 0x0000, 0x4d75, 0x0000, 0x4d76, 0x4d77, 0x0000,
0x0000, 0x4d78, 0x0000, 0x0000, 0x0000, 0x4d79, 0x0000, 0x0000,
0x0000, 0x0000, 0x4d7a, 0x4d7b, 0x0000, 0x4d7c, 0x0000, 0x0000,
0x4d7d, 0x4d7e, 0x4e21, 0x0000, 0x4e22, 0x0000, 0x0000, 0x0000,
0x4e24, 0x4e25, 0x0000, 0x4e26, 0x4e27, 0x4e28, 0x0000, 0x0000,
0x0000, 0x4e29, 0x4e23, 0x4e2a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e2b, 0x0000, 0x0000,
0x0000, 0x4e2c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e2d,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e2e, 0x4e2f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e30, 0x4e31, 0x4e32,
0x0000, 0x4e33, 0x0000, 0x0000, 0x4e34, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4e35, 0x7451, 0x0000, 0x0000, 0x4e36, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e37, 0x4e38, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e39, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4e3a, 0x4e3b, 0x4e3c, 0x7452, 0x4e3d,
0x4e3e, 0x0000, 0x4e3f, 0x4e40, 0x4e41, 0x4e42, 0x4e43, 0x4e44,
0x4e45, 0x0000, 0x4e46, 0x0000, 0x0000, 0x4e47, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e48, 0x0000, 0x0000,
0x0000, 0x4e49, 0x0000, 0x0000, 0x0000, 0x4e4a, 0x0000, 0x0000,
0x0000, 0x4e4b, 0x0000, 0x4e4c, 0x4e4d, 0x0000, 0x4e4e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e4f, 0x0000, 0x0000, 0x0000,
0x0000, 0x4e50, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4e51, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e52, 0x0000,
0x4e53, 0x0000, 0x0000, 0x0000, 0x4e54, 0x0000, 0x0000, 0x0000,
0x4e55, 0x4e56, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e57, 0x0000,
0x0000, 0x4e58, 0x0000, 0x0000, 0x4e59, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_77[] = {
/* 0x7700 - 0x77ff */
0x4e5a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e5b, 0x0000,
0x0000, 0x0000, 0x4e5c, 0x0000, 0x0000, 0x0000, 0x4e5d, 0x0000,
0x0000, 0x0000, 0x4e5e, 0x0000, 0x4e5f, 0x4e60, 0x0000, 0x4e61,
0x0000, 0x4e62, 0x4e63, 0x0000, 0x4e64, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4e65, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x4e66, 0x0000, 0x0000, 0x0000, 0x0000, 0x4e67, 0x4e68, 0x4e69,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e6a, 0x4e6b, 0x4e6c, 0x0000,
0x0000, 0x4e6d, 0x0000, 0x0000, 0x0000, 0x4e6e, 0x4e6f, 0x0000,
0x0000, 0x0000, 0x4e70, 0x0000, 0x0000, 0x4e71, 0x4e72, 0x0000,
0x0000, 0x0000, 0x4e73, 0x0000, 0x0000, 0x4e74, 0x4e75, 0x4e76,
0x0000, 0x0000, 0x4e77, 0x0000, 0x0000, 0x0000, 0x4e78, 0x4e79,
0x0000, 0x0000, 0x0000, 0x0000, 0x4e7a, 0x0000, 0x4e7b, 0x4e7c,
0x4e7d, 0x0000, 0x4e7e, 0x0000, 0x4f21, 0x0000, 0x0000, 0x4f22,
0x0000, 0x0000, 0x4f23, 0x0000, 0x4f24, 0x0000, 0x0000, 0x0000,
0x4f25, 0x0000, 0x4f26, 0x4f27, 0x4f28, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4f29, 0x0000, 0x0000, 0x4f2a, 0x0000, 0x0000,
0x4f2b, 0x0000, 0x0000, 0x0000, 0x4f2c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4f2d, 0x4f2e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4f2f, 0x4f30, 0x4f31, 0x0000,
0x0000, 0x0000, 0x4f32, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f33,
0x0000, 0x0000, 0x4f34, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f35,
0x0000, 0x0000, 0x4f36, 0x0000, 0x0000, 0x0000, 0x4f37, 0x4f38,
0x0000, 0x4f39, 0x0000, 0x0000, 0x0000, 0x4f3a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f3b, 0x0000,
0x0000, 0x0000, 0x0000, 0x4f3c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4f3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x4f3e, 0x4f3f, 0x0000, 0x0000, 0x4f40, 0x0000, 0x0000,
0x0000, 0x4f41, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f42, 0x4f43,
0x4f44, 0x0000, 0x0000, 0x0000, 0x4f45, 0x0000, 0x4f46, 0x0000,
0x0000, 0x0000, 0x4f47, 0x0000, 0x4f48, 0x0000, 0x0000, 0x0000,
0x4f49, 0x4f4a, 0x0000, 0x0000, 0x4f4b, 0x0000, 0x0000, 0x0000,
0x4f4c, 0x0000, 0x0000, 0x4f4d, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_78[] = {
/* 0x7800 - 0x78ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f4e, 0x4f4f, 0x0000,
0x0000, 0x4f50, 0x0000, 0x0000, 0x0000, 0x4f51, 0x4f52, 0x0000,
0x0000, 0x4f53, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f54, 0x0000, 0x0000,
0x0000, 0x4f55, 0x4f56, 0x4f57, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f58, 0x4f59, 0x0000,
0x4f5a, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f5b, 0x0000, 0x4f5c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x4f5d, 0x4f5e, 0x0000, 0x0000, 0x4f5f,
0x4f60, 0x0000, 0x0000, 0x0000, 0x4f61, 0x0000, 0x4f62, 0x0000,
0x0000, 0x0000, 0x4f63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x4f64, 0x0000, 0x4f65, 0x0000,
0x4f66, 0x4f67, 0x0000, 0x4f68, 0x4f69, 0x0000, 0x0000, 0x0000,
0x4f6a, 0x0000, 0x4f6b, 0x0000, 0x0000, 0x0000, 0x4f6c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4f6d, 0x0000, 0x0000, 0x0000, 0x4f6e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x4f6f, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f70,
0x0000, 0x0000, 0x0000, 0x0000, 0x4f71, 0x0000, 0x0000, 0x0000,
0x4f72, 0x0000, 0x0000, 0x0000, 0x0000, 0x4f74, 0x4f75, 0x4f76,
0x0000, 0x4f73, 0x0000, 0x0000, 0x4f77, 0x0000, 0x0000, 0x0000,
0x4f78, 0x0000, 0x0000, 0x0000, 0x4f79, 0x4f7a, 0x0000, 0x0000,
0x4f7b, 0x4f7c, 0x4f7d, 0x4f7e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5021, 0x0000, 0x5022, 0x0000, 0x5023,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5024,
0x5025, 0x5026, 0x0000, 0x0000, 0x5027, 0x0000, 0x5028, 0x0000,
0x0000, 0x0000, 0x5029, 0x502a, 0x0000, 0x502b, 0x502c, 0x0000,
0x0000, 0x0000, 0x0000, 0x502e, 0x0000, 0x0000, 0x0000, 0x502f,
0x5030, 0x5031, 0x0000, 0x0000, 0x502d, 0x0000, 0x5032, 0x0000,
0x0000, 0x0000, 0x5033, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5034, 0x5035, 0x0000, 0x0000, 0x5037, 0x5038,
0x0000, 0x0000, 0x5039, 0x503a, 0x0000, 0x0000, 0x0000, 0x503b,
};
static unsigned short const unicode_to_jisx0212_79[] = {
/* 0x7900 - 0x79ff */
0x5036, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x503c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x503d, 0x0000, 0x0000, 0x0000,
0x503e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x503f, 0x0000, 0x5040, 0x0000, 0x5041, 0x5042,
0x5043, 0x0000, 0x0000, 0x0000, 0x0000, 0x5044, 0x0000, 0x5045,
0x0000, 0x5046, 0x0000, 0x0000, 0x0000, 0x5047, 0x0000, 0x0000,
0x7454, 0x5048, 0x0000, 0x0000, 0x5049, 0x504a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x504b, 0x0000, 0x504c, 0x0000, 0x504d,
0x0000, 0x0000, 0x0000, 0x0000, 0x504e, 0x504f, 0x5050, 0x0000,
0x0000, 0x0000, 0x5051, 0x5052, 0x0000, 0x0000, 0x0000, 0x5053,
0x0000, 0x5054, 0x0000, 0x0000, 0x5055, 0x0000, 0x0000, 0x0000,
0x5056, 0x0000, 0x0000, 0x5057, 0x5058, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5059,
0x0000, 0x505a, 0x0000, 0x505b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x505c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x505d, 0x0000, 0x505e, 0x505f, 0x0000, 0x5060, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5061, 0x5062, 0x0000, 0x0000, 0x0000,
0x0000, 0x5063, 0x0000, 0x5064, 0x5065, 0x5066, 0x5067, 0x0000,
0x5068, 0x0000, 0x0000, 0x5069, 0x506a, 0x0000, 0x0000, 0x0000,
0x0000, 0x506b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x506c, 0x506d, 0x0000, 0x506e, 0x0000, 0x0000, 0x0000, 0x506f,
0x0000, 0x5070, 0x0000, 0x0000, 0x5071, 0x0000, 0x0000, 0x0000,
0x5072, 0x0000, 0x0000, 0x5073, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5074, 0x0000, 0x5075, 0x0000, 0x0000, 0x5076,
0x5077, 0x0000, 0x5078, 0x0000, 0x0000, 0x0000, 0x0000, 0x5079,
0x0000, 0x0000, 0x0000, 0x0000, 0x507a, 0x0000, 0x507b, 0x0000,
0x0000, 0x0000, 0x507c, 0x0000, 0x0000, 0x507d, 0x507e, 0x0000,
0x5121, 0x0000, 0x5122, 0x0000, 0x0000, 0x5123, 0x0000, 0x0000,
0x0000, 0x0000, 0x5124, 0x5125, 0x0000, 0x5126, 0x0000, 0x0000,
0x0000, 0x5127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5128, 0x0000, 0x0000, 0x0000, 0x5129, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7a[] = {
/* 0x7a00 - 0x7aff */
0x0000, 0x0000, 0x512a, 0x512b, 0x0000, 0x0000, 0x0000, 0x512c,
0x0000, 0x512d, 0x512e, 0x0000, 0x512f, 0x0000, 0x0000, 0x0000,
0x0000, 0x5130, 0x0000, 0x0000, 0x0000, 0x5131, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5132, 0x0000, 0x0000, 0x5133, 0x0000,
0x0000, 0x5134, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5135,
0x0000, 0x0000, 0x0000, 0x5136, 0x0000, 0x5137, 0x0000, 0x5138,
0x5139, 0x0000, 0x0000, 0x0000, 0x513a, 0x513b, 0x0000, 0x0000,
0x513c, 0x513d, 0x513e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x513f, 0x5140, 0x0000, 0x5141,
0x5142, 0x0000, 0x0000, 0x0000, 0x5143, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5144, 0x5145, 0x0000,
0x0000, 0x5146, 0x0000, 0x0000, 0x5147, 0x5148, 0x0000, 0x5149,
0x514a, 0x0000, 0x0000, 0x0000, 0x0000, 0x514b, 0x0000, 0x514c,
0x0000, 0x0000, 0x514d, 0x0000, 0x0000, 0x514e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x514f, 0x0000, 0x0000,
0x5150, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5151, 0x0000,
0x5152, 0x0000, 0x5153, 0x0000, 0x0000, 0x5154, 0x5155, 0x0000,
0x0000, 0x0000, 0x5156, 0x5157, 0x0000, 0x0000, 0x0000, 0x0000,
0x5158, 0x5159, 0x0000, 0x0000, 0x515a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x515b, 0x0000,
0x515c, 0x0000, 0x0000, 0x515d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x515e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x515f, 0x0000, 0x5160, 0x0000, 0x0000,
0x0000, 0x5161, 0x0000, 0x5162, 0x5163, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5164, 0x0000,
0x0000, 0x5165, 0x0000, 0x0000, 0x5166, 0x0000, 0x5167, 0x0000,
0x0000, 0x5168, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5169, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7459,
0x516a, 0x516b, 0x0000, 0x516c, 0x516d, 0x0000, 0x0000, 0x0000,
0x0000, 0x516e, 0x0000, 0x0000, 0x516f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5170, 0x0000, 0x5171, 0x5172, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7b[] = {
/* 0x7b00 - 0x7bff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5173,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5174, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5175,
0x0000, 0x0000, 0x0000, 0x5176, 0x0000, 0x0000, 0x0000, 0x5177,
0x0000, 0x5178, 0x5179, 0x517a, 0x0000, 0x517b, 0x517c, 0x517d,
0x517e, 0x5221, 0x0000, 0x0000, 0x5222, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5223, 0x0000, 0x5224,
0x5225, 0x5226, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5227,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5228, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5229, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x522a, 0x0000, 0x0000, 0x0000, 0x522b, 0x0000, 0x522c, 0x0000,
0x0000, 0x522d, 0x522e, 0x0000, 0x0000, 0x522f, 0x0000, 0x5230,
0x0000, 0x0000, 0x5231, 0x5232, 0x0000, 0x0000, 0x0000, 0x5233,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5234, 0x0000, 0x0000, 0x0000,
0x0000, 0x5235, 0x0000, 0x0000, 0x0000, 0x0000, 0x5236, 0x0000,
0x5237, 0x5238, 0x0000, 0x0000, 0x0000, 0x0000, 0x5239, 0x0000,
0x0000, 0x0000, 0x0000, 0x523a, 0x0000, 0x0000, 0x523b, 0x0000,
0x523c, 0x0000, 0x0000, 0x0000, 0x0000, 0x523d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x523e, 0x0000, 0x0000, 0x523f,
0x5240, 0x0000, 0x5241, 0x0000, 0x0000, 0x5242, 0x5243, 0x0000,
0x0000, 0x0000, 0x5244, 0x5245, 0x5246, 0x5247, 0x0000, 0x0000,
0x0000, 0x0000, 0x5248, 0x0000, 0x0000, 0x5249, 0x0000, 0x0000,
0x524a, 0x0000, 0x524b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x524c, 0x0000, 0x524d, 0x524e,
0x0000, 0x524f, 0x5250, 0x5251, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5252, 0x0000, 0x5253, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5254, 0x0000, 0x5255, 0x5256, 0x0000, 0x0000,
0x5257, 0x5258, 0x5259, 0x0000, 0x525a, 0x0000, 0x525b, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7c[] = {
/* 0x7c00 - 0x7cff */
0x0000, 0x525c, 0x525d, 0x525e, 0x525f, 0x0000, 0x5260, 0x0000,
0x0000, 0x5261, 0x0000, 0x5262, 0x5263, 0x0000, 0x5264, 0x5265,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5266, 0x0000, 0x5267, 0x0000, 0x0000, 0x0000, 0x0000,
0x5268, 0x0000, 0x0000, 0x0000, 0x0000, 0x5269, 0x526a, 0x0000,
0x526b, 0x0000, 0x0000, 0x0000, 0x526c, 0x0000, 0x0000, 0x0000,
0x0000, 0x526d, 0x0000, 0x526e, 0x526f, 0x0000, 0x5270, 0x0000,
0x0000, 0x5271, 0x5272, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5273, 0x0000,
0x0000, 0x0000, 0x5274, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5276, 0x5277, 0x5278, 0x0000, 0x5275, 0x0000, 0x0000,
0x0000, 0x5279, 0x527a, 0x527b, 0x527c, 0x527d, 0x527e, 0x0000,
0x0000, 0x5321, 0x0000, 0x5322, 0x0000, 0x0000, 0x0000, 0x5323,
0x0000, 0x5324, 0x0000, 0x0000, 0x0000, 0x5325, 0x5326, 0x0000,
0x5327, 0x0000, 0x5328, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5329, 0x0000, 0x0000, 0x532a, 0x532b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x532c, 0x532d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x532e,
0x0000, 0x0000, 0x0000, 0x0000, 0x532f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5330, 0x0000,
0x5331, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5332, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5334, 0x5335,
0x0000, 0x0000, 0x5336, 0x5337, 0x5338, 0x0000, 0x0000, 0x5339,
0x0000, 0x0000, 0x0000, 0x0000, 0x533a, 0x0000, 0x0000, 0x533b,
0x533c, 0x533d, 0x0000, 0x0000, 0x0000, 0x533e, 0x0000, 0x533f,
0x0000, 0x0000, 0x0000, 0x5340, 0x5341, 0x5342, 0x0000, 0x5343,
0x0000, 0x5344, 0x5345, 0x0000, 0x0000, 0x5346, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5347, 0x0000,
0x0000, 0x5348, 0x0000, 0x5349, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x534a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7d[] = {
/* 0x7d00 - 0x7dff */
0x0000, 0x0000, 0x0000, 0x534b, 0x0000, 0x0000, 0x0000, 0x534c,
0x534d, 0x534e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x534f,
0x0000, 0x5350, 0x5351, 0x5352, 0x0000, 0x0000, 0x5353, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5354, 0x5355, 0x0000,
0x0000, 0x0000, 0x0000, 0x5356, 0x0000, 0x0000, 0x5357, 0x0000,
0x0000, 0x0000, 0x5358, 0x0000, 0x0000, 0x5359, 0x0000, 0x0000,
0x0000, 0x535a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x535b, 0x535c, 0x535d, 0x0000,
0x535e, 0x535f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5360,
0x5361, 0x0000, 0x0000, 0x0000, 0x0000, 0x5362, 0x0000, 0x0000,
0x0000, 0x5363, 0x0000, 0x5364, 0x0000, 0x0000, 0x0000, 0x5365,
0x0000, 0x5366, 0x5367, 0x0000, 0x5368, 0x5369, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x536a, 0x0000, 0x536b,
0x0000, 0x0000, 0x536c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x536d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x536e, 0x0000, 0x536f, 0x5370, 0x0000, 0x0000, 0x0000, 0x5371,
0x0000, 0x5372, 0x5373, 0x5374, 0x0000, 0x5375, 0x5376, 0x0000,
0x5377, 0x0000, 0x0000, 0x5378, 0x5379, 0x537a, 0x0000, 0x0000,
0x0000, 0x537b, 0x0000, 0x0000, 0x0000, 0x0000, 0x537c, 0x537d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x537e, 0x5421, 0x0000,
0x745c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5422, 0x5423,
0x0000, 0x0000, 0x5424, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5425, 0x0000, 0x0000, 0x5426, 0x5427,
0x0000, 0x5428, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5429, 0x542a, 0x542b, 0x542c, 0x542d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x542e, 0x542f, 0x5430, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x745d, 0x5431,
0x0000, 0x5432, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5434, 0x0000, 0x0000, 0x5435, 0x5436, 0x0000,
0x0000, 0x0000, 0x5437, 0x5438, 0x0000, 0x5439, 0x0000, 0x0000,
0x0000, 0x543a, 0x0000, 0x0000, 0x0000, 0x543b, 0x543c, 0x0000,
0x0000, 0x543d, 0x543e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7e[] = {
/* 0x7e00 - 0x7eff */
0x5433, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x543f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5440, 0x5441, 0x0000, 0x0000, 0x0000, 0x5442, 0x0000, 0x5443,
0x0000, 0x0000, 0x0000, 0x0000, 0x5444, 0x5445, 0x0000, 0x0000,
0x5446, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5447,
0x5448, 0x0000, 0x0000, 0x0000, 0x5449, 0x544a, 0x0000, 0x544b,
0x0000, 0x0000, 0x0000, 0x544c, 0x0000, 0x0000, 0x544d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x544e,
0x0000, 0x0000, 0x0000, 0x0000, 0x544f, 0x5450, 0x0000, 0x5451,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5452, 0x0000,
0x5453, 0x0000, 0x5454, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5455, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5456,
0x0000, 0x5457, 0x5458, 0x0000, 0x0000, 0x5459, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x545a, 0x0000, 0x0000, 0x545b, 0x545c,
0x0000, 0x0000, 0x0000, 0x545d, 0x0000, 0x0000, 0x0000, 0x0000,
0x545e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x545f, 0x0000,
0x0000, 0x5460, 0x0000, 0x0000, 0x0000, 0x0000, 0x5461, 0x5462,
0x0000, 0x0000, 0x5463, 0x0000, 0x0000, 0x5464, 0x0000, 0x0000,
0x0000, 0x5465, 0x0000, 0x0000, 0x0000, 0x5466, 0x0000, 0x0000,
0x5467, 0x0000, 0x5468, 0x0000, 0x0000, 0x5469, 0x546a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_7f[] = {
/* 0x7f00 - 0x7fff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x546c, 0x546b, 0x546d, 0x546e, 0x546f,
0x0000, 0x0000, 0x0000, 0x5470, 0x5471, 0x0000, 0x0000, 0x5472,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5473,
0x0000, 0x0000, 0x5474, 0x5475, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5476, 0x5477, 0x5478, 0x0000, 0x0000,
0x0000, 0x5479, 0x0000, 0x547a, 0x547b, 0x547c, 0x547d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x547e, 0x0000, 0x0000,
0x0000, 0x5521, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5522, 0x5523, 0x5524,
0x5525, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5526, 0x0000, 0x5527, 0x0000, 0x5528,
0x5529, 0x552a, 0x0000, 0x0000, 0x0000, 0x0000, 0x552b, 0x552c,
0x0000, 0x0000, 0x0000, 0x0000, 0x552d, 0x0000, 0x0000, 0x0000,
0x0000, 0x552e, 0x552f, 0x0000, 0x0000, 0x0000, 0x5530, 0x0000,
0x0000, 0x0000, 0x5531, 0x0000, 0x0000, 0x5532, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5533, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5534, 0x0000, 0x0000, 0x5535,
0x5536, 0x0000, 0x0000, 0x5537, 0x0000, 0x0000, 0x0000, 0x0000,
0x5538, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5539, 0x553a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x553b, 0x0000, 0x0000, 0x0000, 0x553c,
0x0000, 0x0000, 0x0000, 0x553d, 0x0000, 0x553e, 0x0000, 0x0000,
0x553f, 0x0000, 0x0000, 0x0000, 0x5540, 0x0000, 0x5541, 0x5542,
0x0000, 0x0000, 0x5543, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5544, 0x0000, 0x0000, 0x5545, 0x5546, 0x5547,
};
static unsigned short const unicode_to_jisx0212_80[] = {
/* 0x8000 - 0x80ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5548,
0x5549, 0x0000, 0x554a, 0x0000, 0x0000, 0x554b, 0x554c, 0x554d,
0x0000, 0x554e, 0x0000, 0x554f, 0x5550, 0x0000, 0x5551, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5552, 0x5553, 0x5554,
0x5555, 0x0000, 0x0000, 0x0000, 0x5556, 0x0000, 0x5557, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5558, 0x0000, 0x5559, 0x0000,
0x555a, 0x0000, 0x0000, 0x0000, 0x555b, 0x555c, 0x0000, 0x555d,
0x0000, 0x555e, 0x555f, 0x0000, 0x5560, 0x0000, 0x5561, 0x0000,
0x5562, 0x0000, 0x0000, 0x0000, 0x5563, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5564, 0x0000, 0x0000, 0x0000, 0x5565, 0x0000, 0x5566, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5567, 0x0000, 0x0000,
0x0000, 0x5568, 0x0000, 0x0000, 0x0000, 0x5569, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x556a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x556b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x556c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x556d, 0x0000, 0x556e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x556f, 0x5570,
0x0000, 0x0000, 0x0000, 0x5571, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5572, 0x5573, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5574, 0x0000, 0x0000, 0x0000, 0x0000, 0x5575, 0x0000, 0x5576,
0x0000, 0x0000, 0x5577, 0x0000, 0x5578, 0x5579, 0x0000, 0x557a,
0x557b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x557c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x557d, 0x557e, 0x0000,
0x5621, 0x0000, 0x5622, 0x5623, 0x0000, 0x0000, 0x5624, 0x0000,
0x0000, 0x5625, 0x5626, 0x0000, 0x0000, 0x0000, 0x5627, 0x0000,
};
static unsigned short const unicode_to_jisx0212_81[] = {
/* 0x8100 - 0x81ff */
0x0000, 0x0000, 0x0000, 0x5628, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5629, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x562a, 0x562b,
0x562c, 0x0000, 0x0000, 0x0000, 0x562d, 0x0000, 0x562e, 0x0000,
0x562f, 0x0000, 0x0000, 0x0000, 0x5630, 0x0000, 0x0000, 0x5631,
0x0000, 0x0000, 0x0000, 0x0000, 0x5632, 0x0000, 0x0000, 0x0000,
0x5633, 0x0000, 0x0000, 0x0000, 0x0000, 0x5634, 0x0000, 0x0000,
0x0000, 0x0000, 0x5635, 0x0000, 0x5636, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5637, 0x0000, 0x5638,
0x0000, 0x0000, 0x5639, 0x0000, 0x563a, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x563b, 0x0000, 0x0000, 0x0000, 0x0000, 0x563c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x563d, 0x563e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x563f,
0x5640, 0x5641, 0x0000, 0x0000, 0x0000, 0x5642, 0x0000, 0x5643,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5644,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5645, 0x0000, 0x0000, 0x5647, 0x5648, 0x5649, 0x0000,
0x0000, 0x0000, 0x0000, 0x564a, 0x0000, 0x0000, 0x564b, 0x0000,
0x5646, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x564c, 0x0000,
0x564d, 0x0000, 0x0000, 0x564e, 0x0000, 0x0000, 0x564f, 0x0000,
0x0000, 0x0000, 0x5650, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5651, 0x0000,
0x0000, 0x0000, 0x5652, 0x0000, 0x5653, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5654, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5656, 0x0000, 0x5657, 0x0000, 0x0000,
0x0000, 0x0000, 0x5658, 0x5655, 0x0000, 0x0000, 0x5659, 0x565a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x565b, 0x0000, 0x565c,
0x0000, 0x0000, 0x0000, 0x565d, 0x0000, 0x565e, 0x565f, 0x0000,
0x0000, 0x5660, 0x0000, 0x0000, 0x5661, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5662, 0x5663, 0x0000, 0x0000, 0x0000,
0x5664, 0x5665, 0x5666, 0x0000, 0x0000, 0x5667, 0x5668, 0x0000,
0x5669, 0x566a, 0x0000, 0x0000, 0x0000, 0x566b, 0x0000, 0x566c,
};
static unsigned short const unicode_to_jisx0212_82[] = {
/* 0x8200 - 0x82ff */
0x566d, 0x0000, 0x0000, 0x566e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x566f,
0x0000, 0x0000, 0x0000, 0x5670, 0x5671, 0x0000, 0x0000, 0x0000,
0x0000, 0x5672, 0x5673, 0x0000, 0x0000, 0x5674, 0x0000, 0x0000,
0x0000, 0x5675, 0x5676, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5677, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5678, 0x0000, 0x5679, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x567a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x567b, 0x567c, 0x567d, 0x567e, 0x0000,
0x0000, 0x0000, 0x0000, 0x5721, 0x0000, 0x0000, 0x5722, 0x5723,
0x0000, 0x5724, 0x0000, 0x0000, 0x0000, 0x0000, 0x5725, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5726, 0x0000, 0x0000, 0x0000,
0x5727, 0x0000, 0x0000, 0x5728, 0x0000, 0x0000, 0x0000, 0x5729,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x572a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x572b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x572c, 0x0000, 0x572d, 0x0000, 0x572e,
0x572f, 0x5730, 0x0000, 0x5731, 0x5732, 0x0000, 0x0000, 0x5733,
0x0000, 0x5734, 0x5735, 0x0000, 0x0000, 0x0000, 0x5736, 0x0000,
0x0000, 0x5737, 0x0000, 0x0000, 0x5738, 0x0000, 0x5739, 0x0000,
0x573a, 0x0000, 0x573b, 0x573c, 0x0000, 0x0000, 0x0000, 0x0000,
0x573d, 0x573e, 0x0000, 0x573f, 0x5740, 0x0000, 0x0000, 0x5741,
0x5742, 0x5743, 0x5744, 0x0000, 0x0000, 0x0000, 0x5745, 0x0000,
0x5746, 0x0000, 0x5747, 0x0000, 0x5748, 0x0000, 0x0000, 0x5749,
0x0000, 0x0000, 0x574a, 0x0000, 0x574b, 0x0000, 0x574c, 0x574d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x574e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x574f, 0x0000, 0x0000, 0x0000, 0x0000, 0x5750, 0x0000, 0x0000,
0x0000, 0x0000, 0x5751, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5752, 0x0000, 0x5753, 0x0000, 0x5754, 0x0000, 0x0000, 0x0000,
0x5755, 0x0000, 0x5756, 0x0000, 0x0000, 0x5757, 0x0000, 0x5758,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5759, 0x575a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x575b, 0x575c, 0x0000,
};
static unsigned short const unicode_to_jisx0212_83[] = {
/* 0x8300 - 0x83ff */
0x575d, 0x575e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x575f,
0x5760, 0x0000, 0x5761, 0x5762, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5764, 0x0000, 0x5765, 0x5766, 0x5767,
0x0000, 0x5768, 0x5769, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x576a, 0x576b, 0x576c, 0x0000,
0x576d, 0x0000, 0x0000, 0x576e, 0x0000, 0x0000, 0x0000, 0x576f,
0x0000, 0x0000, 0x5770, 0x0000, 0x5771, 0x5772, 0x0000, 0x0000,
0x0000, 0x0000, 0x5773, 0x5774, 0x5775, 0x0000, 0x0000, 0x5776,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5777, 0x5778, 0x0000,
0x0000, 0x5779, 0x0000, 0x583e, 0x5763, 0x577a, 0x577b, 0x577c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x745f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x577d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x577e, 0x0000, 0x0000, 0x0000, 0x0000, 0x5821, 0x0000, 0x5822,
0x5823, 0x0000, 0x5824, 0x0000, 0x5825, 0x0000, 0x5826, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5827, 0x0000, 0x0000,
0x0000, 0x0000, 0x5828, 0x0000, 0x5829, 0x582a, 0x0000, 0x0000,
0x582b, 0x582c, 0x0000, 0x582d, 0x582e, 0x582f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5830, 0x5831,
0x0000, 0x5832, 0x0000, 0x0000, 0x5833, 0x584c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5834, 0x5835,
0x5836, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5837,
0x0000, 0x5838, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5839,
0x583a, 0x583b, 0x0000, 0x0000, 0x583c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x583d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x583f, 0x0000, 0x5840, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5841, 0x0000,
0x5842, 0x5843, 0x0000, 0x0000, 0x5844, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_84[] = {
/* 0x8400 - 0x84ff */
0x0000, 0x5845, 0x0000, 0x0000, 0x0000, 0x0000, 0x5846, 0x0000,
0x0000, 0x0000, 0x5847, 0x0000, 0x0000, 0x0000, 0x0000, 0x5848,
0x0000, 0x5849, 0x0000, 0x0000, 0x0000, 0x584a, 0x0000, 0x0000,
0x0000, 0x584b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x584d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x584e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x584f, 0x0000, 0x5850,
0x5851, 0x0000, 0x5852, 0x0000, 0x0000, 0x5853, 0x0000, 0x5854,
0x0000, 0x5855, 0x5856, 0x0000, 0x0000, 0x0000, 0x5857, 0x0000,
0x5858, 0x5859, 0x585a, 0x0000, 0x585b, 0x0000, 0x0000, 0x0000,
0x585c, 0x0000, 0x0000, 0x0000, 0x585d, 0x585e, 0x0000, 0x585f,
0x0000, 0x0000, 0x5860, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5861, 0x0000, 0x0000, 0x5862, 0x5863, 0x0000, 0x5864, 0x0000,
0x5865, 0x0000, 0x0000, 0x0000, 0x5866, 0x5867, 0x0000, 0x0000,
0x0000, 0x5868, 0x0000, 0x0000, 0x0000, 0x5869, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x586a, 0x586b, 0x0000, 0x586c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x586d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x586e, 0x0000,
0x586f, 0x5870, 0x5871, 0x0000, 0x0000, 0x0000, 0x0000, 0x5872,
0x0000, 0x5873, 0x0000, 0x0000, 0x5874, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5875, 0x0000, 0x0000, 0x5876, 0x5877, 0x0000,
0x5878, 0x0000, 0x5879, 0x0000, 0x0000, 0x0000, 0x0000, 0x587a,
0x587b, 0x0000, 0x0000, 0x0000, 0x587c, 0x0000, 0x0000, 0x587d,
0x0000, 0x0000, 0x0000, 0x587e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5921, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5922,
0x0000, 0x0000, 0x5923, 0x0000, 0x0000, 0x0000, 0x0000, 0x5924,
0x5925, 0x5926, 0x5927, 0x0000, 0x0000, 0x0000, 0x0000, 0x5928,
0x0000, 0x0000, 0x592a, 0x592b, 0x0000, 0x592c, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_85[] = {
/* 0x8500 - 0x85ff */
0x0000, 0x0000, 0x592d, 0x592e, 0x0000, 0x0000, 0x0000, 0x592f,
0x0000, 0x0000, 0x0000, 0x0000, 0x5930, 0x0000, 0x5931, 0x0000,
0x5932, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5933, 0x0000, 0x5934, 0x0000,
0x0000, 0x0000, 0x5935, 0x5936, 0x5937, 0x5938, 0x0000, 0x5939,
0x0000, 0x0000, 0x593a, 0x593b, 0x0000, 0x0000, 0x0000, 0x593c,
0x0000, 0x0000, 0x5929, 0x593d, 0x593e, 0x0000, 0x593f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5940,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5941, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5942,
0x5943, 0x5944, 0x5945, 0x5946, 0x0000, 0x0000, 0x5947, 0x0000,
0x0000, 0x5948, 0x0000, 0x0000, 0x5949, 0x594a, 0x594b, 0x594c,
0x594d, 0x594e, 0x594f, 0x0000, 0x5950, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5951, 0x0000, 0x0000, 0x0000, 0x5952,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5953, 0x5954, 0x5955, 0x0000, 0x5956, 0x0000, 0x5957,
0x0000, 0x5958, 0x0000, 0x0000, 0x0000, 0x5959, 0x595a, 0x0000,
0x0000, 0x595b, 0x0000, 0x595c, 0x595d, 0x0000, 0x0000, 0x595e,
0x0000, 0x0000, 0x0000, 0x595f, 0x0000, 0x0000, 0x0000, 0x0000,
0x5960, 0x0000, 0x0000, 0x0000, 0x0000, 0x5961, 0x0000, 0x5962,
0x5963, 0x0000, 0x5964, 0x0000, 0x0000, 0x5965, 0x0000, 0x5966,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5974, 0x0000, 0x0000,
0x7461, 0x0000, 0x0000, 0x0000, 0x5967, 0x0000, 0x5968, 0x5969,
0x596a, 0x0000, 0x0000, 0x0000, 0x596b, 0x596c, 0x596d, 0x596e,
0x0000, 0x0000, 0x596f, 0x0000, 0x0000, 0x0000, 0x0000, 0x5970,
0x0000, 0x0000, 0x5971, 0x5972, 0x0000, 0x0000, 0x5973, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5975, 0x0000, 0x5976, 0x0000, 0x0000, 0x0000, 0x0000, 0x5977,
0x5978, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5979, 0x0000,
0x597a, 0x0000, 0x0000, 0x0000, 0x0000, 0x597b, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x597c, 0x0000, 0x0000, 0x597d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x597e, 0x0000, 0x0000, 0x5a21,
};
static unsigned short const unicode_to_jisx0212_86[] = {
/* 0x8600 - 0x86ff */
0x5a22, 0x0000, 0x0000, 0x0000, 0x5a23, 0x5a24, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a25, 0x5a26, 0x0000,
0x5a27, 0x5a28, 0x5a29, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5a2a, 0x5a2b, 0x0000, 0x5a2c, 0x0000, 0x0000, 0x5a2d, 0x0000,
0x0000, 0x5a2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a2f,
0x0000, 0x5a30, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a31, 0x0000,
0x5a32, 0x0000, 0x5a33, 0x0000, 0x5a34, 0x5a35, 0x0000, 0x0000,
0x5a36, 0x3866, 0x5a37, 0x0000, 0x0000, 0x0000, 0x5a38, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5a39, 0x5a3a, 0x0000, 0x0000, 0x5a3b, 0x5a3c,
0x5a3d, 0x5a3e, 0x0000, 0x0000, 0x0000, 0x5a3f, 0x0000, 0x0000,
0x5a40, 0x5a41, 0x5a42, 0x5a43, 0x5a44, 0x0000, 0x0000, 0x0000,
0x0000, 0x5a45, 0x0000, 0x0000, 0x5a46, 0x0000, 0x0000, 0x5a47,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a48, 0x5a49, 0x5a4a,
0x0000, 0x0000, 0x5a4b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5a6d, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a4c, 0x0000, 0x0000,
0x0000, 0x5a4d, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a4e, 0x0000,
0x5a4f, 0x0000, 0x5a50, 0x0000, 0x5a51, 0x0000, 0x0000, 0x0000,
0x0000, 0x5a52, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a53, 0x5a54,
0x5a55, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a56, 0x0000, 0x0000,
0x0000, 0x5a57, 0x0000, 0x5a58, 0x5a59, 0x5a5a, 0x0000, 0x5a5b,
0x5a5c, 0x5a5d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a5e,
0x5a5f, 0x5a60, 0x0000, 0x5a61, 0x0000, 0x5a62, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5a63, 0x5a64, 0x0000, 0x0000, 0x5a65, 0x0000, 0x5a66,
0x0000, 0x0000, 0x5a67, 0x0000, 0x5a68, 0x0000, 0x0000, 0x0000,
0x5a69, 0x0000, 0x0000, 0x5a6a, 0x0000, 0x5a6b, 0x0000, 0x5a6c,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5a6e, 0x0000, 0x5a6f, 0x5a70, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_87[] = {
/* 0x8700 - 0x87ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x5a71, 0x5a72, 0x0000, 0x5a73,
0x0000, 0x0000, 0x0000, 0x5a74, 0x0000, 0x0000, 0x5a75, 0x5a76,
0x5a77, 0x0000, 0x0000, 0x5a78, 0x5a79, 0x0000, 0x0000, 0x0000,
0x0000, 0x5a7a, 0x0000, 0x0000, 0x0000, 0x0000, 0x5a7b, 0x5a7c,
0x0000, 0x5a7d, 0x0000, 0x5a7e, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b22, 0x5b23,
0x0000, 0x5b24, 0x5b25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5b26, 0x5b27, 0x0000, 0x5b28, 0x5b29, 0x5b2a, 0x0000,
0x5b2b, 0x0000, 0x0000, 0x5b2c, 0x0000, 0x5b2d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b2e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b30, 0x0000, 0x0000,
0x0000, 0x5b31, 0x0000, 0x0000, 0x5b32, 0x5b33, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b34,
0x0000, 0x5b35, 0x5b36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5b37, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5b38, 0x5b39, 0x5b3a, 0x5b3b, 0x5b3c,
0x5b3d, 0x5b3e, 0x0000, 0x5b3f, 0x5b40, 0x0000, 0x0000, 0x0000,
0x5b41, 0x0000, 0x0000, 0x5b42, 0x0000, 0x5b43, 0x0000, 0x5b44,
0x5b45, 0x5b46, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b47, 0x0000,
0x5b48, 0x0000, 0x0000, 0x5b49, 0x0000, 0x0000, 0x0000, 0x5b4a,
0x0000, 0x0000, 0x0000, 0x0000, 0x5b4b, 0x5b4c, 0x5b4d, 0x0000,
0x0000, 0x5b4e, 0x0000, 0x0000, 0x0000, 0x5b4f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b50, 0x5b51,
0x0000, 0x5b52, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b53, 0x5b54, 0x5b55, 0x0000, 0x0000, 0x0000, 0x5b56, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b57, 0x5b58, 0x0000,
0x0000, 0x5b59, 0x5b5a, 0x0000, 0x5b5b, 0x0000, 0x0000, 0x5b5c,
0x0000, 0x0000, 0x5b5d, 0x5b5e, 0x5b5f, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5b60, 0x5b61, 0x0000, 0x5b62, 0x0000, 0x0000,
0x0000, 0x5b63, 0x0000, 0x5b64, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b65, 0x0000, 0x5b66, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b67,
};
static unsigned short const unicode_to_jisx0212_88[] = {
/* 0x8800 - 0x88ff */
0x0000, 0x5b68, 0x0000, 0x5b69, 0x0000, 0x0000, 0x5b6a, 0x7464,
0x0000, 0x5b6b, 0x5b6c, 0x5b6d, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b6e, 0x0000, 0x5b70, 0x5b71, 0x5b72, 0x0000, 0x0000, 0x0000,
0x5b73, 0x5b6f, 0x5b74, 0x5b75, 0x5b76, 0x0000, 0x5b77, 0x5b78,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5b79, 0x0000, 0x0000, 0x0000, 0x0000, 0x5b7a, 0x5b7b, 0x0000,
0x5b7c, 0x0000, 0x5b7d, 0x0000, 0x0000, 0x5b7e, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c21, 0x0000, 0x5c22, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c23, 0x0000, 0x5c24, 0x0000, 0x5c25, 0x0000, 0x0000,
0x5c26, 0x5c27, 0x5c28, 0x5c29, 0x0000, 0x0000, 0x5c2a, 0x0000,
0x0000, 0x5c2b, 0x0000, 0x0000, 0x0000, 0x5c2c, 0x5c2d, 0x0000,
0x5c2e, 0x0000, 0x5c2f, 0x0000, 0x5c30, 0x0000, 0x0000, 0x5c31,
0x5c32, 0x0000, 0x0000, 0x0000, 0x5c33, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c34, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c35, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c36, 0x0000, 0x5c37, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c39, 0x0000, 0x5c3a, 0x5c3b, 0x5c3c, 0x0000, 0x0000, 0x5c3d,
0x5c3e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c3f, 0x0000, 0x5c40, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c41, 0x0000, 0x0000, 0x5c42, 0x5c43, 0x0000,
0x5c44, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c45, 0x5c46, 0x5c47, 0x5c48, 0x5c49, 0x0000,
0x0000, 0x5c4a, 0x5c4b, 0x5c4c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5c4d, 0x0000, 0x0000, 0x5c4e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c4f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c50,
0x5c51, 0x5c52, 0x0000, 0x0000, 0x0000, 0x5c53, 0x0000, 0x5c54,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_89[] = {
/* 0x8900 - 0x89ff */
0x0000, 0x5c55, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c56, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c57, 0x5c58, 0x5c59,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c5a, 0x5c5b, 0x0000,
0x5c5c, 0x5c5d, 0x5c5e, 0x0000, 0x5c5f, 0x0000, 0x0000, 0x0000,
0x5c60, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c61, 0x5c62,
0x5c63, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5c64, 0x5c65, 0x5c66, 0x0000, 0x0000, 0x5c67, 0x0000, 0x0000,
0x0000, 0x5c68, 0x5c69, 0x0000, 0x0000, 0x0000, 0x5c6a, 0x0000,
0x5c6b, 0x0000, 0x5c6c, 0x0000, 0x0000, 0x5c6d, 0x5c6e, 0x0000,
0x0000, 0x5c6f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c70,
0x0000, 0x0000, 0x5c71, 0x0000, 0x0000, 0x0000, 0x0000, 0x5c72,
0x0000, 0x0000, 0x5c73, 0x5c74, 0x5c75, 0x0000, 0x0000, 0x0000,
0x0000, 0x5c76, 0x5c77, 0x5c78, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5c79, 0x0000, 0x0000, 0x5c7a, 0x0000,
0x5c7b, 0x0000, 0x0000, 0x5c7c, 0x0000, 0x5c7d, 0x0000, 0x0000,
0x0000, 0x0000, 0x5c7e, 0x5d21, 0x5d22, 0x5d23, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5d24, 0x0000, 0x0000, 0x0000, 0x5d25, 0x0000, 0x0000,
0x5d26, 0x0000, 0x0000, 0x0000, 0x5d27, 0x5d28, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d29, 0x5d2a, 0x0000, 0x0000, 0x5d2b,
0x5d2c, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d2d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5d2e, 0x0000, 0x0000, 0x0000, 0x5d2f, 0x5d30, 0x5d31, 0x5d32,
0x0000, 0x0000, 0x0000, 0x0000, 0x5d33, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5d34, 0x5d35, 0x5d36, 0x5d37,
0x5d38, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d39, 0x0000, 0x0000,
0x0000, 0x5d3a, 0x0000, 0x5d3b, 0x0000, 0x5d3c, 0x0000, 0x0000,
0x0000, 0x5d3d, 0x0000, 0x5d3e, 0x0000, 0x0000, 0x5d3f, 0x0000,
0x0000, 0x5d40, 0x0000, 0x0000, 0x0000, 0x5d41, 0x0000, 0x5d42,
};
static unsigned short const unicode_to_jisx0212_8a[] = {
/* 0x8a00 - 0x8aff */
0x0000, 0x0000, 0x0000, 0x0000, 0x5d43, 0x5d44, 0x0000, 0x5d45,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d46,
0x0000, 0x5d47, 0x5d48, 0x0000, 0x5d49, 0x5d4a, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d4b, 0x0000,
0x5d4c, 0x0000, 0x5d4d, 0x0000, 0x5d4e, 0x0000, 0x5d4f, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d50, 0x5d51, 0x0000, 0x0000, 0x5d52,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d53, 0x0000, 0x5d54,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d55, 0x5d56, 0x0000,
0x5d57, 0x0000, 0x0000, 0x5d58, 0x0000, 0x5d59, 0x0000, 0x5d5a,
0x0000, 0x5d5b, 0x0000, 0x0000, 0x0000, 0x5d5c, 0x5d5d, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d5e, 0x0000, 0x0000, 0x5d5f, 0x5d60,
0x5d61, 0x0000, 0x0000, 0x0000, 0x5d62, 0x5d63, 0x0000, 0x0000,
0x0000, 0x5d64, 0x0000, 0x0000, 0x0000, 0x5d65, 0x0000, 0x5d66,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d67, 0x5d68, 0x5d69,
0x0000, 0x5d6a, 0x5d6b, 0x5d6c, 0x0000, 0x0000, 0x5d6d, 0x5d6e,
0x5d6f, 0x0000, 0x0000, 0x5d70, 0x0000, 0x0000, 0x5d71, 0x0000,
0x0000, 0x0000, 0x0000, 0x5d72, 0x0000, 0x0000, 0x0000, 0x5d73,
0x5d74, 0x0000, 0x5d75, 0x0000, 0x0000, 0x0000, 0x5d76, 0x5d77,
0x0000, 0x5d78, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d79,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d7a,
0x0000, 0x5d7b, 0x0000, 0x0000, 0x0000, 0x0000, 0x5d7c, 0x5d7d,
0x0000, 0x0000, 0x0000, 0x5d7e, 0x0000, 0x0000, 0x5e21, 0x5e22,
0x0000, 0x0000, 0x0000, 0x5e23, 0x0000, 0x0000, 0x5e24, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e25, 0x0000, 0x0000, 0x5e26, 0x0000,
0x5e27, 0x5e28, 0x5e29, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5e2a, 0x0000, 0x5e2b, 0x5e2c, 0x5e2d, 0x0000, 0x5e2e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e2f, 0x0000, 0x5e30,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e31, 0x0000, 0x0000, 0x0000,
0x5e32, 0x0000, 0x0000, 0x0000, 0x5e33, 0x5e34, 0x5e35, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e36, 0x0000, 0x0000, 0x5e37,
};
static unsigned short const unicode_to_jisx0212_8b[] = {
/* 0x8b00 - 0x8bff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e38, 0x5e39, 0x0000,
0x0000, 0x0000, 0x5e3f, 0x5e3a, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5e3b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e3c, 0x0000, 0x5e3d, 0x5e3e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e40, 0x0000, 0x0000,
0x5e41, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e42,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e43, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5e44, 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x0000,
0x5e49, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e4e, 0x0000, 0x0000,
0x0000, 0x0000, 0x5e4a, 0x5e4b, 0x5e4c, 0x0000, 0x0000, 0x0000,
0x0000, 0x5e4d, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e4f, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e50, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e51, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e52, 0x0000,
0x5e53, 0x5e54, 0x0000, 0x0000, 0x5e55, 0x0000, 0x5e56, 0x7466,
0x0000, 0x5e57, 0x0000, 0x0000, 0x5e58, 0x5e59, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e5a, 0x0000, 0x5e5b, 0x0000, 0x5e5c,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e5d, 0x5e5e, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5e5f, 0x0000, 0x5e60, 0x5e61,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_8c[] = {
/* 0x8c00 - 0x8cff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5e62, 0x5e63, 0x0000, 0x0000, 0x0000, 0x5e64, 0x5e65, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e66, 0x0000, 0x5e67,
0x0000, 0x5e68, 0x0000, 0x5e69, 0x0000, 0x0000, 0x0000, 0x5e6a,
0x0000, 0x5e6b, 0x0000, 0x5e6c, 0x5e6d, 0x0000, 0x0000, 0x5e6e,
0x5e6f, 0x5e72, 0x0000, 0x5e70, 0x0000, 0x5e71, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e73, 0x5e74, 0x0000, 0x5e75, 0x0000,
0x5e76, 0x5e77, 0x0000, 0x0000, 0x0000, 0x5e78, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e79, 0x0000, 0x5e7a, 0x5e7b, 0x0000,
0x0000, 0x0000, 0x0000, 0x5e7c, 0x0000, 0x0000, 0x5e7d, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5e7e, 0x5f21,
0x0000, 0x0000, 0x0000, 0x5f22, 0x0000, 0x0000, 0x0000, 0x0000,
0x5f23, 0x0000, 0x5f24, 0x5f25, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f26, 0x0000, 0x5f27, 0x5f28, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f29, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f2a, 0x5f2b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f2c, 0x5f2d, 0x0000,
0x0000, 0x5f2e, 0x0000, 0x5f2f, 0x0000, 0x0000, 0x0000, 0x5f30,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f32, 0x5f31, 0x0000,
0x0000, 0x5f33, 0x0000, 0x0000, 0x0000, 0x5f34, 0x0000, 0x0000,
0x0000, 0x5f35, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5f36, 0x0000, 0x0000, 0x0000, 0x5f37, 0x0000, 0x0000, 0x5f38,
0x5f39, 0x0000, 0x5f3a, 0x0000, 0x7467, 0x5f3b, 0x0000, 0x5f3c,
0x5f3d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f3e, 0x5f3f,
};
static unsigned short const unicode_to_jisx0212_8d[] = {
/* 0x8d00 - 0x8dff */
0x0000, 0x5f40, 0x0000, 0x5f41, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f42, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x5f43, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f44,
0x0000, 0x0000, 0x0000, 0x5f45, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f46, 0x0000, 0x0000,
0x0000, 0x5f47, 0x0000, 0x0000, 0x5f48, 0x0000, 0x5f49, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7468, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f4a,
0x0000, 0x0000, 0x5f4b, 0x0000, 0x5f4c, 0x0000, 0x0000, 0x0000,
0x5f4d, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f4e, 0x0000, 0x0000,
0x5f4f, 0x5f50, 0x0000, 0x0000, 0x0000, 0x5f51, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f52, 0x5f53,
0x5f54, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f55, 0x0000,
0x0000, 0x0000, 0x0000, 0x5f56, 0x5f57, 0x0000, 0x0000, 0x5f58,
0x0000, 0x0000, 0x5f59, 0x0000, 0x0000, 0x5f5a, 0x0000, 0x5f5b,
0x0000, 0x5f5c, 0x0000, 0x5f5d, 0x5f6f, 0x0000, 0x0000, 0x0000,
0x5f5e, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f5f, 0x5f60, 0x5f61,
0x5f62, 0x0000, 0x5f63, 0x0000, 0x0000, 0x0000, 0x5f64, 0x0000,
0x0000, 0x5f65, 0x0000, 0x0000, 0x5f66, 0x5f67, 0x0000, 0x5f68,
0x0000, 0x5f69, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f6a, 0x5f6b, 0x0000, 0x5f6c,
0x0000, 0x0000, 0x0000, 0x0000, 0x5f6d, 0x0000, 0x0000, 0x0000,
0x5f6e, 0x5f70, 0x5f71, 0x0000, 0x5f72, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x5f73, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_8e[] = {
/* 0x8e00 - 0x8eff */
0x0000, 0x5f74, 0x0000, 0x0000, 0x5f75, 0x5f76, 0x5f77, 0x0000,
0x0000, 0x0000, 0x0000, 0x5f78, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x5f79, 0x0000, 0x0000, 0x5f7a, 0x0000, 0x5f7b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x5f7c, 0x5f7d, 0x5f7e, 0x6021, 0x0000, 0x0000, 0x6022, 0x6023,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6024, 0x0000, 0x6025, 0x0000, 0x0000, 0x6026, 0x6027,
0x6028, 0x6029, 0x0000, 0x0000, 0x0000, 0x602a, 0x0000, 0x0000,
0x602b, 0x602c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x602d, 0x0000, 0x602e, 0x602f, 0x6030,
0x0000, 0x0000, 0x0000, 0x0000, 0x6031, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6032, 0x6033, 0x6034, 0x6035, 0x0000,
0x0000, 0x6036, 0x6037, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6038, 0x0000, 0x0000, 0x6039, 0x603a, 0x0000, 0x603b,
0x603c, 0x603d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x603e, 0x603f, 0x6040, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6041, 0x6042, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6043, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6044, 0x0000, 0x6045, 0x0000, 0x0000, 0x6046, 0x0000, 0x0000,
0x0000, 0x0000, 0x6047, 0x6048, 0x0000, 0x6049, 0x604a, 0x0000,
0x0000, 0x0000, 0x604b, 0x0000, 0x0000, 0x0000, 0x0000, 0x604c,
0x0000, 0x604d, 0x0000, 0x0000, 0x0000, 0x604e, 0x604f, 0x0000,
0x0000, 0x0000, 0x0000, 0x6050, 0x0000, 0x6051, 0x0000, 0x0000,
0x0000, 0x0000, 0x6052, 0x6053, 0x0000, 0x0000, 0x0000, 0x0000,
0x6054, 0x6055, 0x0000, 0x6056, 0x6057, 0x0000, 0x0000, 0x6058,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6059,
0x0000, 0x605a, 0x0000, 0x0000, 0x605b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x605c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x605d, 0x0000, 0x0000, 0x0000, 0x0000, 0x6064, 0x605e, 0x0000,
0x605f, 0x6060, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6061,
0x0000, 0x6062, 0x6063, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_8f[] = {
/* 0x8f00 - 0x8fff */
0x6065, 0x0000, 0x6066, 0x0000, 0x0000, 0x0000, 0x0000, 0x6067,
0x6068, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6069,
0x606a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x606b, 0x606c,
0x606d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x606e, 0x0000,
0x606f, 0x6070, 0x0000, 0x6071, 0x0000, 0x6072, 0x0000, 0x6073,
0x6074, 0x0000, 0x0000, 0x0000, 0x6075, 0x6076, 0x6077, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6078, 0x6079, 0x607a, 0x607b,
0x0000, 0x0000, 0x607c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x607d, 0x607e, 0x0000, 0x6121, 0x0000, 0x0000, 0x0000, 0x6122,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6123,
0x0000, 0x6124, 0x6125, 0x6126, 0x6127, 0x6128, 0x0000, 0x0000,
0x6129, 0x0000, 0x0000, 0x0000, 0x0000, 0x612a, 0x612b, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x612c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x612d, 0x0000, 0x0000,
0x612e, 0x612f, 0x0000, 0x0000, 0x6130, 0x6131, 0x6132, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6133, 0x6134, 0x0000,
0x6135, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6136, 0x0000,
0x6137, 0x6138, 0x0000, 0x0000, 0x0000, 0x0000, 0x6139, 0x0000,
0x0000, 0x0000, 0x613a, 0x613b, 0x0000, 0x613c, 0x0000, 0x0000,
0x613d, 0x0000, 0x613e, 0x613f, 0x0000, 0x6140, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6141, 0x0000, 0x0000, 0x6142, 0x6143, 0x0000, 0x0000, 0x0000,
0x6144, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6145, 0x0000,
0x0000, 0x6146, 0x0000, 0x0000, 0x0000, 0x6147, 0x6148, 0x0000,
0x0000, 0x0000, 0x0000, 0x6149, 0x0000, 0x0000, 0x614a, 0x0000,
};
static unsigned short const unicode_to_jisx0212_90[] = {
/* 0x9000 - 0x90ff */
0x0000, 0x0000, 0x614b, 0x0000, 0x614c, 0x0000, 0x0000, 0x0000,
0x614d, 0x0000, 0x0000, 0x0000, 0x614e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x614f, 0x0000, 0x0000, 0x6150, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6151, 0x6152, 0x6154, 0x0000, 0x6155, 0x6156, 0x0000, 0x6153,
0x0000, 0x0000, 0x0000, 0x6157, 0x6158, 0x0000, 0x0000, 0x6159,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x615a,
0x0000, 0x0000, 0x0000, 0x615b, 0x615c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x615d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x615e, 0x0000, 0x615f, 0x0000, 0x0000,
0x0000, 0x0000, 0x6160, 0x0000, 0x0000, 0x0000, 0x6161, 0x6162,
0x0000, 0x0000, 0x0000, 0x0000, 0x6163, 0x0000, 0x0000, 0x0000,
0x6164, 0x0000, 0x0000, 0x0000, 0x6165, 0x0000, 0x0000, 0x0000,
0x0000, 0x6166, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6167, 0x0000, 0x0000,
0x6168, 0x0000, 0x0000, 0x6169, 0x616a, 0x0000, 0x616b, 0x0000,
0x616c, 0x0000, 0x0000, 0x0000, 0x0000, 0x616d, 0x0000, 0x616e,
0x616f, 0x6170, 0x0000, 0x6171, 0x0000, 0x0000, 0x0000, 0x0000,
0x6172, 0x6173, 0x6174, 0x0000, 0x0000, 0x6175, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6176, 0x0000, 0x6177, 0x6178, 0x6179, 0x0000, 0x617a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x617b, 0x617d, 0x0000,
0x0000, 0x0000, 0x0000, 0x617e, 0x6221, 0x6222, 0x0000, 0x6223,
0x6224, 0x0000, 0x0000, 0x0000, 0x617c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x622d, 0x0000, 0x0000, 0x6225, 0x0000, 0x6226,
0x6227, 0x6228, 0x0000, 0x0000, 0x6229, 0x622a, 0x746c, 0x622b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x622c, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x622f, 0x0000, 0x0000, 0x0000, 0x6230,
0x6231, 0x0000, 0x0000, 0x0000, 0x6232, 0x0000, 0x622e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6233, 0x6234,
};
static unsigned short const unicode_to_jisx0212_91[] = {
/* 0x9100 - 0x91ff */
0x6235, 0x0000, 0x0000, 0x0000, 0x6236, 0x6237, 0x6238, 0x0000,
0x6239, 0x0000, 0x0000, 0x0000, 0x0000, 0x623a, 0x0000, 0x0000,
0x623b, 0x0000, 0x0000, 0x0000, 0x623c, 0x746e, 0x623d, 0x623e,
0x623f, 0x0000, 0x6240, 0x0000, 0x6241, 0x0000, 0x6242, 0x0000,
0x6243, 0x0000, 0x6245, 0x6246, 0x0000, 0x6244, 0x0000, 0x6247,
0x0000, 0x6248, 0x0000, 0x0000, 0x0000, 0x0000, 0x6249, 0x624a,
0x0000, 0x624b, 0x0000, 0x0000, 0x624c, 0x0000, 0x624d, 0x624e,
0x0000, 0x624f, 0x6250, 0x0000, 0x6251, 0x6252, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6253, 0x0000, 0x0000, 0x0000, 0x6254,
0x6255, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6256,
0x0000, 0x0000, 0x0000, 0x6257, 0x0000, 0x0000, 0x0000, 0x6258,
0x0000, 0x6259, 0x625a, 0x625b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x625c, 0x0000, 0x0000, 0x625d, 0x0000, 0x0000, 0x625e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x625f, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6260, 0x0000, 0x0000, 0x0000,
0x0000, 0x6261, 0x6262, 0x6263, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6264, 0x0000, 0x6265, 0x0000, 0x6266, 0x6267, 0x0000,
0x0000, 0x0000, 0x6268, 0x0000, 0x0000, 0x0000, 0x6269, 0x0000,
0x0000, 0x626a, 0x0000, 0x626b, 0x626c, 0x626d, 0x0000, 0x0000,
0x626e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x626f, 0x0000,
0x0000, 0x6270, 0x0000, 0x0000, 0x0000, 0x0000, 0x6271, 0x0000,
0x6272, 0x0000, 0x0000, 0x0000, 0x6273, 0x6274, 0x6275, 0x0000,
0x6276, 0x6277, 0x6278, 0x6279, 0x0000, 0x0000, 0x627a, 0x0000,
0x0000, 0x0000, 0x0000, 0x627b, 0x627c, 0x627d, 0x0000, 0x627e,
0x0000, 0x0000, 0x6321, 0x6322, 0x0000, 0x6323, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6324, 0x6325, 0x0000, 0x0000, 0x6326,
0x0000, 0x6327, 0x6328, 0x0000, 0x0000, 0x0000, 0x6329, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x632a, 0x632b, 0x0000, 0x0000,
0x0000, 0x632c, 0x632d, 0x0000, 0x632e, 0x632f, 0x6330, 0x6331,
0x6332, 0x6333, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6334,
0x0000, 0x6335, 0x0000, 0x6336, 0x0000, 0x6337, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_92[] = {
/* 0x9200 - 0x92ff */
0x6338, 0x6339, 0x0000, 0x0000, 0x633a, 0x633b, 0x633c, 0x633d,
0x0000, 0x633e, 0x633f, 0x0000, 0x6340, 0x0000, 0x0000, 0x0000,
0x6341, 0x0000, 0x6342, 0x6343, 0x0000, 0x0000, 0x6344, 0x0000,
0x6345, 0x0000, 0x0000, 0x0000, 0x6346, 0x6347, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6348, 0x6349, 0x634a, 0x634b, 0x0000,
0x634c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x634d, 0x634e,
0x634f, 0x0000, 0x0000, 0x6350, 0x0000, 0x6351, 0x6352, 0x0000,
0x6353, 0x6354, 0x6355, 0x0000, 0x6356, 0x0000, 0x6357, 0x0000,
0x6358, 0x0000, 0x6359, 0x635a, 0x0000, 0x0000, 0x635b, 0x635c,
0x0000, 0x0000, 0x635d, 0x0000, 0x0000, 0x635e, 0x635f, 0x6360,
0x0000, 0x6361, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6362, 0x6363, 0x0000, 0x0000, 0x6364, 0x6365, 0x0000, 0x0000,
0x6366, 0x6367, 0x0000, 0x0000, 0x0000, 0x6368, 0x0000, 0x6369,
0x636a, 0x636b, 0x0000, 0x0000, 0x0000, 0x0000, 0x636c, 0x636d,
0x636e, 0x0000, 0x0000, 0x0000, 0x0000, 0x636f, 0x6370, 0x6371,
0x6372, 0x6373, 0x0000, 0x6374, 0x6375, 0x6376, 0x0000, 0x6377,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6378, 0x6379, 0x637a, 0x0000, 0x0000, 0x637b, 0x637c, 0x0000,
0x0000, 0x0000, 0x637d, 0x0000, 0x0000, 0x0000, 0x0000, 0x637e,
0x0000, 0x6421, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6422,
0x6423, 0x0000, 0x0000, 0x0000, 0x6424, 0x6425, 0x0000, 0x6426,
0x6427, 0x0000, 0x0000, 0x6428, 0x0000, 0x0000, 0x0000, 0x6429,
0x0000, 0x0000, 0x642a, 0x0000, 0x0000, 0x0000, 0x642b, 0x0000,
0x642c, 0x0000, 0x642d, 0x642e, 0x642f, 0x6430, 0x0000, 0x6431,
0x6432, 0x6433, 0x6434, 0x6435, 0x0000, 0x6436, 0x6437, 0x6438,
0x6439, 0x0000, 0x0000, 0x643a, 0x643b, 0x643c, 0x643d, 0x0000,
0x643e, 0x0000, 0x0000, 0x643f, 0x0000, 0x6440, 0x0000, 0x6441,
0x6442, 0x6443, 0x0000, 0x0000, 0x6444, 0x6445, 0x0000, 0x6446,
0x6447, 0x6448, 0x0000, 0x6449, 0x0000, 0x644a, 0x0000, 0x644b,
0x644c, 0x0000, 0x0000, 0x0000, 0x644d, 0x0000, 0x644e, 0x0000,
0x644f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6450, 0x0000, 0x6451, 0x0000, 0x0000, 0x0000, 0x6452,
};
static unsigned short const unicode_to_jisx0212_93[] = {
/* 0x9300 - 0x93ff */
0x6453, 0x0000, 0x6454, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6455, 0x0000, 0x0000, 0x0000, 0x0000, 0x6456, 0x0000, 0x0000,
0x0000, 0x6457, 0x0000, 0x0000, 0x6458, 0x6459, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x645a, 0x645b, 0x645c, 0x645d,
0x0000, 0x645e, 0x0000, 0x0000, 0x645f, 0x6460, 0x0000, 0x6461,
0x0000, 0x6462, 0x6463, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6464, 0x6465, 0x0000, 0x6466, 0x6467,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6468,
0x6469, 0x646a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x646b, 0x646c, 0x646d, 0x0000, 0x0000, 0x646e, 0x0000, 0x646f,
0x6470, 0x0000, 0x6471, 0x0000, 0x0000, 0x0000, 0x6472, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6473, 0x6474, 0x0000, 0x6475,
0x0000, 0x6476, 0x6477, 0x0000, 0x0000, 0x6478, 0x0000, 0x6479,
0x647a, 0x647b, 0x0000, 0x647c, 0x647d, 0x0000, 0x647e, 0x0000,
0x0000, 0x0000, 0x6521, 0x0000, 0x0000, 0x6522, 0x0000, 0x6523,
0x6524, 0x6525, 0x6526, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6527, 0x0000, 0x6528, 0x6529, 0x0000, 0x652a, 0x0000, 0x652b,
0x0000, 0x0000, 0x652c, 0x0000, 0x0000, 0x652d, 0x0000, 0x0000,
0x652e, 0x0000, 0x0000, 0x652f, 0x0000, 0x0000, 0x6530, 0x0000,
0x0000, 0x6531, 0x0000, 0x6532, 0x6533, 0x0000, 0x6534, 0x0000,
0x6535, 0x653b, 0x0000, 0x6536, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6537, 0x6538, 0x6539, 0x0000,
0x0000, 0x0000, 0x653a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x653c, 0x0000, 0x0000, 0x653d, 0x653e, 0x653f, 0x6540,
0x0000, 0x6541, 0x6542, 0x6543, 0x6544, 0x6545, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6546, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6547, 0x0000, 0x0000, 0x6548, 0x0000, 0x6549, 0x654a,
0x0000, 0x0000, 0x654b, 0x0000, 0x0000, 0x0000, 0x654c, 0x654d,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x654f,
0x6550, 0x654e, 0x6551, 0x6552, 0x0000, 0x6553, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_94[] = {
/* 0x9400 - 0x94ff */
0x0000, 0x6554, 0x6555, 0x0000, 0x6556, 0x0000, 0x0000, 0x0000,
0x6557, 0x6558, 0x0000, 0x0000, 0x0000, 0x6559, 0x655a, 0x655b,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x655c, 0x655d, 0x655e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x655f,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6560, 0x6561,
0x0000, 0x6562, 0x6563, 0x6564, 0x6565, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6566, 0x0000, 0x6568, 0x0000, 0x6567,
0x0000, 0x0000, 0x0000, 0x6569, 0x0000, 0x656a, 0x0000, 0x0000,
0x656b, 0x0000, 0x656c, 0x0000, 0x656d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x656e, 0x0000, 0x0000,
0x0000, 0x656f, 0x0000, 0x0000, 0x6570, 0x0000, 0x0000, 0x6571,
0x0000, 0x6572, 0x0000, 0x6573, 0x0000, 0x0000, 0x0000, 0x0000,
0x6574, 0x0000, 0x0000, 0x6575, 0x0000, 0x6576, 0x6577, 0x6578,
0x0000, 0x6579, 0x657a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x657c, 0x657b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_95[] = {
/* 0x9500 - 0x95ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x657d, 0x657e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6621, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6622, 0x0000, 0x0000, 0x0000,
0x6623, 0x0000, 0x0000, 0x0000, 0x6624, 0x6625, 0x6626, 0x0000,
0x0000, 0x0000, 0x7471, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6627, 0x6628, 0x6629,
0x0000, 0x662a, 0x0000, 0x0000, 0x0000, 0x0000, 0x662b, 0x0000,
0x0000, 0x662c, 0x0000, 0x662d, 0x662e, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x662f, 0x0000, 0x6630, 0x0000,
0x0000, 0x0000, 0x6631, 0x0000, 0x0000, 0x6632, 0x0000, 0x6633,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6634, 0x0000,
0x6635, 0x6636, 0x0000, 0x6637, 0x0000, 0x0000, 0x0000, 0x0000,
0x6638, 0x6639, 0x663a, 0x663b, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x663c, 0x663d, 0x0000, 0x0000, 0x663e, 0x663f, 0x6640,
0x6641, 0x0000, 0x0000, 0x0000, 0x6642, 0x0000, 0x6643, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_96[] = {
/* 0x9600 - 0x96ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6644, 0x6645, 0x0000,
0x0000, 0x0000, 0x6646, 0x0000, 0x6647, 0x6648, 0x6649, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x664a, 0x0000, 0x0000, 0x0000,
0x0000, 0x664b, 0x0000, 0x664c, 0x0000, 0x0000, 0x0000, 0x664d,
0x664e, 0x664f, 0x6650, 0x0000, 0x6651, 0x6652, 0x0000, 0x0000,
0x0000, 0x6653, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6654, 0x0000, 0x6655, 0x0000, 0x6656, 0x6657,
0x6658, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6659, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x665a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x665b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x665c, 0x665d, 0x0000, 0x665e, 0x665f,
0x0000, 0x6660, 0x6661, 0x6662, 0x6663, 0x0000, 0x0000, 0x0000,
0x0000, 0x6664, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6665, 0x0000, 0x0000, 0x0000, 0x0000, 0x6666, 0x0000,
0x0000, 0x0000, 0x6667, 0x0000, 0x0000, 0x6668, 0x0000, 0x6669,
0x0000, 0x0000, 0x0000, 0x0000, 0x666a, 0x666b, 0x666c, 0x0000,
0x0000, 0x666d, 0x0000, 0x0000, 0x0000, 0x0000, 0x666e, 0x666f,
0x0000, 0x0000, 0x0000, 0x6670, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6671, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6672, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6673, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6675, 0x0000, 0x6676, 0x0000, 0x0000, 0x6677, 0x6678, 0x6679,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x667a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x667b,
0x0000, 0x667c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x667d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_97[] = {
/* 0x9700 - 0x97ff */
0x0000, 0x0000, 0x667e, 0x6721, 0x0000, 0x6722, 0x0000, 0x0000,
0x0000, 0x6723, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6724, 0x6725, 0x0000, 0x6726, 0x0000, 0x0000,
0x0000, 0x6727, 0x6728, 0x6729, 0x0000, 0x0000, 0x0000, 0x0000,
0x672a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x672b, 0x0000, 0x672c, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x7474, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x672d, 0x0000, 0x672e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x672f, 0x0000, 0x0000, 0x7475, 0x6730, 0x6731,
0x0000, 0x7476, 0x0000, 0x0000, 0x0000, 0x6732, 0x0000, 0x6733,
0x6734, 0x0000, 0x6735, 0x6736, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6737, 0x0000, 0x0000, 0x0000, 0x6738,
0x0000, 0x0000, 0x6739, 0x0000, 0x0000, 0x0000, 0x673a, 0x0000,
0x0000, 0x0000, 0x0000, 0x673b, 0x0000, 0x0000, 0x673c, 0x673d,
0x673e, 0x0000, 0x0000, 0x673f, 0x0000, 0x6740, 0x0000, 0x6741,
0x6742, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6743, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6744, 0x6745, 0x6746,
0x0000, 0x6747, 0x6748, 0x0000, 0x0000, 0x0000, 0x6749, 0x674a,
0x0000, 0x0000, 0x674b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x674c, 0x0000, 0x674d, 0x0000,
0x0000, 0x674e, 0x674f, 0x0000, 0x0000, 0x6750, 0x6751, 0x0000,
0x6752, 0x6753, 0x6754, 0x0000, 0x6755, 0x0000, 0x6756, 0x6757,
0x0000, 0x6758, 0x0000, 0x0000, 0x6759, 0x675a, 0x0000, 0x675b,
0x0000, 0x675c, 0x675d, 0x0000, 0x675e, 0x675f, 0x6760, 0x0000,
0x6761, 0x6762, 0x0000, 0x0000, 0x6763, 0x0000, 0x0000, 0x6764,
0x6765, 0x6766, 0x0000, 0x676a, 0x0000, 0x6767, 0x6768, 0x0000,
0x6769, 0x676b, 0x0000, 0x0000, 0x676c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x676d,
0x0000, 0x676e, 0x0000, 0x0000, 0x676f, 0x0000, 0x0000, 0x6770,
0x6771, 0x0000, 0x6772, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_98[] = {
/* 0x9800 - 0x98ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6773,
0x0000, 0x0000, 0x6774, 0x0000, 0x0000, 0x6776, 0x6777, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6778, 0x0000, 0x6779, 0x0000,
0x0000, 0x6775, 0x0000, 0x0000, 0x677a, 0x0000, 0x677b, 0x0000,
0x677c, 0x0000, 0x0000, 0x677d, 0x0000, 0x6828, 0x677e, 0x0000,
0x0000, 0x0000, 0x0000, 0x6821, 0x0000, 0x0000, 0x6822, 0x6823,
0x6824, 0x0000, 0x6825, 0x6826, 0x0000, 0x6827, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6829, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x682a, 0x0000, 0x0000, 0x682b,
0x0000, 0x0000, 0x682c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x682d, 0x682e, 0x682f, 0x0000, 0x0000, 0x6830, 0x6831,
0x0000, 0x6832, 0x6833, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6834, 0x6835, 0x0000, 0x6836, 0x6837, 0x0000,
0x0000, 0x0000, 0x6838, 0x0000, 0x6839, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x683a, 0x0000, 0x683b, 0x683c, 0x0000,
0x683d, 0x0000, 0x0000, 0x0000, 0x683e, 0x0000, 0x0000, 0x683f,
0x6840, 0x0000, 0x6841, 0x6842, 0x0000, 0x0000, 0x0000, 0x6843,
0x0000, 0x0000, 0x6844, 0x0000, 0x0000, 0x6845, 0x0000, 0x0000,
0x6846, 0x0000, 0x0000, 0x0000, 0x6847, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6848, 0x0000, 0x6849, 0x0000, 0x684a, 0x684b, 0x684c,
0x0000, 0x0000, 0x684d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x684e, 0x0000, 0x0000, 0x684f, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_99[] = {
/* 0x9900 - 0x99ff */
0x0000, 0x0000, 0x6850, 0x0000, 0x0000, 0x0000, 0x0000, 0x6851,
0x6852, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6853, 0x0000, 0x0000, 0x0000, 0x6854, 0x6855, 0x6856,
0x0000, 0x0000, 0x6857, 0x6858, 0x6859, 0x0000, 0x0000, 0x685a,
0x0000, 0x0000, 0x685b, 0x0000, 0x0000, 0x0000, 0x685c, 0x685d,
0x0000, 0x0000, 0x0000, 0x685e, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x685f, 0x6860, 0x6861, 0x6862, 0x6863, 0x0000, 0x0000,
0x0000, 0x6864, 0x6865, 0x6866, 0x6867, 0x0000, 0x0000, 0x0000,
0x6868, 0x6869, 0x0000, 0x0000, 0x0000, 0x0000, 0x686a, 0x686b,
0x686c, 0x0000, 0x0000, 0x0000, 0x0000, 0x686d, 0x686e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x686f, 0x0000, 0x0000, 0x0000,
0x6870, 0x6871, 0x0000, 0x6872, 0x6873, 0x0000, 0x6874, 0x6875,
0x6876, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6877, 0x0000, 0x6878, 0x747a, 0x6879,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x687a, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x687b, 0x687c, 0x687d, 0x0000, 0x0000, 0x687e, 0x0000, 0x0000,
0x0000, 0x6921, 0x6922, 0x0000, 0x0000, 0x6923, 0x0000, 0x6924,
0x0000, 0x0000, 0x0000, 0x6925, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6926, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6927, 0x6928, 0x0000, 0x0000, 0x0000,
0x0000, 0x6929, 0x692a, 0x0000, 0x692b, 0x0000, 0x692c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x692d,
0x0000, 0x0000, 0x692e, 0x692f, 0x6930, 0x0000, 0x0000, 0x0000,
0x6931, 0x0000, 0x0000, 0x0000, 0x6932, 0x6933, 0x0000, 0x0000,
0x0000, 0x6934, 0x0000, 0x0000, 0x0000, 0x6935, 0x6936, 0x0000,
};
static unsigned short const unicode_to_jisx0212_9a[] = {
/* 0x9a00 - 0x9aff */
0x0000, 0x0000, 0x6937, 0x6938, 0x6939, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x693a, 0x693b, 0x0000, 0x0000, 0x0000,
0x693c, 0x693d, 0x0000, 0x0000, 0x0000, 0x0000, 0x693e, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x693f, 0x0000,
0x6940, 0x0000, 0x6941, 0x6942, 0x6943, 0x0000, 0x0000, 0x6944,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6945, 0x6946, 0x0000,
0x0000, 0x0000, 0x0000, 0x6947, 0x0000, 0x6948, 0x6949, 0x0000,
0x694a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x694c, 0x0000, 0x0000, 0x694d, 0x0000, 0x0000, 0x694b,
0x0000, 0x0000, 0x694e, 0x694f, 0x6950, 0x0000, 0x6951, 0x0000,
0x0000, 0x6952, 0x0000, 0x0000, 0x6953, 0x0000, 0x6954, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6955, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6956, 0x0000, 0x6957, 0x0000, 0x6958, 0x6959,
0x0000, 0x0000, 0x695a, 0x0000, 0x695b, 0x695c, 0x695d, 0x0000,
0x0000, 0x695e, 0x0000, 0x695f, 0x0000, 0x0000, 0x6960, 0x6961,
0x0000, 0x6962, 0x0000, 0x6963, 0x0000, 0x0000, 0x6964, 0x0000,
0x6965, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6966, 0x0000,
0x6967, 0x0000, 0x6968, 0x0000, 0x0000, 0x6969, 0x696a, 0x696b,
0x0000, 0x747b, 0x0000, 0x696c, 0x696d, 0x0000, 0x0000, 0x0000,
0x696e, 0x0000, 0x0000, 0x0000, 0x696f, 0x6970, 0x0000, 0x6971,
0x0000, 0x6972, 0x0000, 0x0000, 0x6973, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6974, 0x6975, 0x0000, 0x6976, 0x0000, 0x0000,
0x0000, 0x6977, 0x6978, 0x0000, 0x0000, 0x6979, 0x0000, 0x697a,
};
static unsigned short const unicode_to_jisx0212_9b[] = {
/* 0x9b00 - 0x9bff */
0x697b, 0x697c, 0x697d, 0x697e, 0x6a21, 0x6a22, 0x0000, 0x0000,
0x6a23, 0x6a24, 0x0000, 0x6a25, 0x6a26, 0x6a27, 0x6a28, 0x0000,
0x6a29, 0x0000, 0x6a2a, 0x0000, 0x0000, 0x0000, 0x6a2b, 0x0000,
0x0000, 0x6a2c, 0x0000, 0x6a2d, 0x6a2e, 0x0000, 0x0000, 0x0000,
0x6a2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a30, 0x0000,
0x0000, 0x0000, 0x0000, 0x6a31, 0x0000, 0x6a32, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6a33, 0x6a34, 0x6a35, 0x0000, 0x6a36,
0x0000, 0x6a37, 0x6a38, 0x0000, 0x0000, 0x6a39, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6a3a, 0x0000, 0x0000, 0x6a3b, 0x6a3c, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a3d, 0x6a3e, 0x6a3f,
0x0000, 0x0000, 0x0000, 0x6a40, 0x0000, 0x0000, 0x6a41, 0x0000,
0x0000, 0x6a42, 0x0000, 0x6a43, 0x0000, 0x6a44, 0x6a45, 0x0000,
0x6a46, 0x0000, 0x6a47, 0x6a48, 0x6a49, 0x6a4a, 0x6a4b, 0x0000,
0x0000, 0x0000, 0x747c, 0x6a4c, 0x0000, 0x6a4d, 0x0000, 0x6a4e,
0x6a4f, 0x6a50, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a51,
0x6a52, 0x0000, 0x0000, 0x0000, 0x6a53, 0x6a54, 0x6a55, 0x6a56,
0x0000, 0x6a57, 0x6a58, 0x6a59, 0x0000, 0x6a5a, 0x0000, 0x6a5b,
0x6a5c, 0x0000, 0x0000, 0x0000, 0x6a5d, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6a5e, 0x0000, 0x0000, 0x6a5f, 0x6a60, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a61, 0x6a62,
0x0000, 0x6a63, 0x0000, 0x0000, 0x6a64, 0x0000, 0x0000, 0x0000,
0x6a65, 0x6a66, 0x6a67, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a68,
0x6a69, 0x0000, 0x0000, 0x6a6a, 0x6a6b, 0x0000, 0x6a6c, 0x6a6d,
0x0000, 0x6a6e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a6f,
0x6a70, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a71, 0x0000,
0x6a72, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a73,
0x6a74, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a75, 0x0000, 0x6a76,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6a77, 0x0000, 0x6a78,
0x0000, 0x0000, 0x6a79, 0x6a7a, 0x0000, 0x0000, 0x0000, 0x6a7b,
0x0000, 0x0000, 0x0000, 0x6a7c, 0x0000, 0x0000, 0x0000, 0x6a7d,
0x6a7e, 0x6b21, 0x6b22, 0x0000, 0x0000, 0x6b23, 0x0000, 0x6b24,
};
static unsigned short const unicode_to_jisx0212_9c[] = {
/* 0x9c00 - 0x9cff */
0x6b25, 0x0000, 0x6b26, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b27, 0x0000, 0x0000, 0x0000, 0x6b28,
0x0000, 0x6b29, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b2a, 0x0000,
0x6b2b, 0x6b2c, 0x6b2d, 0x0000, 0x6b2e, 0x0000, 0x6b2f, 0x0000,
0x0000, 0x0000, 0x6b30, 0x6b31, 0x0000, 0x0000, 0x6b32, 0x6b33,
0x6b34, 0x6b35, 0x6b36, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6b37, 0x0000, 0x0000, 0x0000, 0x6b38, 0x6b39, 0x6b3a,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b3b, 0x0000, 0x0000,
0x0000, 0x6b3c, 0x0000, 0x6b3d, 0x6b3e, 0x6b3f, 0x0000, 0x0000,
0x0000, 0x6b40, 0x6b41, 0x0000, 0x0000, 0x0000, 0x6b42, 0x6b43,
0x6b44, 0x0000, 0x0000, 0x6b45, 0x6b46, 0x0000, 0x6b47, 0x0000,
0x6b48, 0x0000, 0x0000, 0x6b49, 0x6b50, 0x6b4a, 0x6b4b, 0x6b4c,
0x0000, 0x0000, 0x0000, 0x6b4d, 0x0000, 0x0000, 0x0000, 0x0000,
0x6b52, 0x6b4e, 0x6b4f, 0x6b51, 0x0000, 0x0000, 0x6b53, 0x0000,
0x6b54, 0x0000, 0x6b55, 0x0000, 0x0000, 0x6b56, 0x0000, 0x6b57,
0x0000, 0x0000, 0x0000, 0x6b58, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b59, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b5a, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b5b,
0x0000, 0x6b5c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_9d[] = {
/* 0x9d00 - 0x9dff */
0x0000, 0x0000, 0x6b5e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b5d, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6b5f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b60,
0x6b61, 0x0000, 0x0000, 0x0000, 0x6b62, 0x6b63, 0x6b64, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b65,
0x6b66, 0x0000, 0x6b67, 0x6b68, 0x6b69, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b6a, 0x0000, 0x6b6b, 0x6b6d, 0x0000, 0x0000,
0x0000, 0x0000, 0x6b6e, 0x6b6f, 0x0000, 0x6b6c, 0x0000, 0x6b70,
0x0000, 0x0000, 0x6b71, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6b72, 0x6b73, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b74,
0x0000, 0x0000, 0x6b76, 0x6b75, 0x0000, 0x6b77, 0x0000, 0x0000,
0x0000, 0x6b78, 0x6b79, 0x6b7a, 0x0000, 0x0000, 0x0000, 0x0000,
0x6b7b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6b7c, 0x6b7d,
0x0000, 0x0000, 0x0000, 0x6b7e, 0x6c21, 0x0000, 0x6c22, 0x0000,
0x0000, 0x0000, 0x0000, 0x6c23, 0x6c24, 0x0000, 0x6c25, 0x0000,
0x0000, 0x0000, 0x6c26, 0x0000, 0x0000, 0x6c27, 0x6c28, 0x0000,
0x0000, 0x0000, 0x6c29, 0x6c2a, 0x0000, 0x6c2b, 0x6c2c, 0x6c2d,
0x6c2e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6c2f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c30, 0x0000, 0x6c31, 0x0000, 0x6c32, 0x0000,
0x0000, 0x6c33, 0x0000, 0x0000, 0x0000, 0x6c34, 0x0000, 0x0000,
0x0000, 0x6c35, 0x0000, 0x0000, 0x6c36, 0x0000, 0x0000, 0x6c37,
0x0000, 0x0000, 0x0000, 0x6c38, 0x0000, 0x0000, 0x0000, 0x6c39,
0x0000, 0x6c3a, 0x6c3b, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c3c, 0x6c3d, 0x6c3e, 0x6c3f,
0x0000, 0x0000, 0x6c40, 0x0000, 0x0000, 0x0000, 0x6c41, 0x6c42,
0x6c43, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c44, 0x0000, 0x6c45,
0x0000, 0x6c46, 0x0000, 0x6c47, 0x0000, 0x0000, 0x6c48, 0x0000,
0x6c49, 0x0000, 0x0000, 0x6c4a, 0x6c4b, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c4c, 0x0000,
};
static unsigned short const unicode_to_jisx0212_9e[] = {
/* 0x9e00 - 0x9eff */
0x0000, 0x0000, 0x6c4e, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c4f,
0x0000, 0x0000, 0x6c4d, 0x0000, 0x0000, 0x0000, 0x6c50, 0x0000,
0x6c51, 0x6c52, 0x6c53, 0x0000, 0x0000, 0x6c54, 0x6c55, 0x0000,
0x0000, 0x6c56, 0x0000, 0x0000, 0x6c57, 0x6c58, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x6c59, 0x6c5a, 0x6c5b, 0x0000, 0x0000, 0x0000,
0x6c5c, 0x0000, 0x6c5d, 0x6c5e, 0x6c5f, 0x6c60, 0x0000, 0x6c61,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c62, 0x6c63,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c64, 0x0000,
0x6c65, 0x0000, 0x0000, 0x6c66, 0x0000, 0x0000, 0x6c67, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c68, 0x0000, 0x0000, 0x0000,
0x6c69, 0x0000, 0x0000, 0x0000, 0x6c6a, 0x0000, 0x6c6b, 0x6c6c,
0x6c6d, 0x0000, 0x0000, 0x6c6e, 0x6c6f, 0x6c70, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c71, 0x0000,
0x6c72, 0x0000, 0x0000, 0x6c73, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x747e, 0x0000, 0x0000, 0x0000, 0x6c74, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6c75,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c76, 0x0000, 0x0000, 0x6c77,
0x0000, 0x0000, 0x0000, 0x0000, 0x6c78, 0x6c79, 0x6c7a, 0x0000,
0x6c7b, 0x6c7c, 0x6c7d, 0x0000, 0x0000, 0x6c7e, 0x0000, 0x0000,
0x6d21, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d22,
};
static unsigned short const unicode_to_jisx0212_9f[] = {
/* 0x9f00 - 0x9fff */
0x0000, 0x0000, 0x6d23, 0x6d24, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x6d25, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d26,
0x6d27, 0x6d28, 0x6d29, 0x0000, 0x6d2a, 0x0000, 0x6d2b, 0x6d2c,
0x0000, 0x6d2d, 0x6d2e, 0x6d2f, 0x0000, 0x0000, 0x0000, 0x6d30,
0x0000, 0x0000, 0x6d31, 0x0000, 0x0000, 0x0000, 0x6d32, 0x0000,
0x0000, 0x0000, 0x6d33, 0x6d34, 0x0000, 0x0000, 0x0000, 0x6d35,
0x0000, 0x6d36, 0x6d37, 0x0000, 0x6d38, 0x0000, 0x0000, 0x6d39,
0x0000, 0x6d3a, 0x6d3b, 0x0000, 0x6d3c, 0x6d3d, 0x0000, 0x6d3e,
0x0000, 0x6d3f, 0x0000, 0x6d40, 0x6d41, 0x6d42, 0x6d43, 0x6d44,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x6d45, 0x0000, 0x6d46, 0x6d47, 0x6d48,
0x6d49, 0x0000, 0x6d4a, 0x0000, 0x0000, 0x6d4b, 0x6d4c, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x6d4d, 0x6d4e, 0x0000, 0x0000, 0x0000, 0x6d4f, 0x6d50, 0x6d51,
0x6d52, 0x6d53, 0x0000, 0x6d54, 0x0000, 0x6d55, 0x0000, 0x0000,
0x0000, 0x0000, 0x6d56, 0x0000, 0x0000, 0x6d57, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d58,
0x6d59, 0x6d5a, 0x6d5b, 0x0000, 0x6d5c, 0x0000, 0x6d5d, 0x6d5e,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x6d5f, 0x0000,
0x0000, 0x6d60, 0x6d61, 0x6d62, 0x0000, 0x6d63, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_f9[] = {
/* 0xf900 - 0xf9ff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x7445, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x7472, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_fa[] = {
/* 0xfa00 - 0xfaff */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7434, 0x7437,
0x7438, 0x743d, 0x7444, 0x7447, 0x7448, 0x744e, 0x744f, 0x7453,
0x7455, 0x7456, 0x7457, 0x7458, 0x745a, 0x745b, 0x745e, 0x7460,
0x7462, 0x7463, 0x7465, 0x7469, 0x746a, 0x746b, 0x746d, 0x746f,
0x7470, 0x7473, 0x7477, 0x7478, 0x7479, 0x747d, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const unicode_to_jisx0212_ff[] = {
/* 0xff00 - 0xffff */
0x0000, 0x0000, 0x742a, 0x0000, 0x0000, 0x0000, 0x0000, 0x7429,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
static unsigned short const * const unicode_to_jisx0212_map[0x100] = {
/* 0x00XX - 0x0fXX */
unicode_to_jisx0212_00,
unicode_to_jisx0212_01,
unicode_to_jisx0212_02,
unicode_to_jisx0212_03,
unicode_to_jisx0212_04,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x10XX - 0x1fXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x20XX - 0x2fXX */
0,
unicode_to_jisx0212_21,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x30XX - 0x3fXX */
0, 0,
unicode_to_jisx0212_32,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x40XX - 0x4fXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
unicode_to_jisx0212_4e,
unicode_to_jisx0212_4f,
/* 0x50XX - 0x5fXX */
unicode_to_jisx0212_50,
unicode_to_jisx0212_51,
unicode_to_jisx0212_52,
unicode_to_jisx0212_53,
unicode_to_jisx0212_54,
unicode_to_jisx0212_55,
unicode_to_jisx0212_56,
unicode_to_jisx0212_57,
unicode_to_jisx0212_58,
unicode_to_jisx0212_59,
unicode_to_jisx0212_5a,
unicode_to_jisx0212_5b,
unicode_to_jisx0212_5c,
unicode_to_jisx0212_5d,
unicode_to_jisx0212_5e,
unicode_to_jisx0212_5f,
/* 0x60XX - 0x6fXX */
unicode_to_jisx0212_60,
unicode_to_jisx0212_61,
unicode_to_jisx0212_62,
unicode_to_jisx0212_63,
unicode_to_jisx0212_64,
unicode_to_jisx0212_65,
unicode_to_jisx0212_66,
unicode_to_jisx0212_67,
unicode_to_jisx0212_68,
unicode_to_jisx0212_69,
unicode_to_jisx0212_6a,
unicode_to_jisx0212_6b,
unicode_to_jisx0212_6c,
unicode_to_jisx0212_6d,
unicode_to_jisx0212_6e,
unicode_to_jisx0212_6f,
/* 0x70XX - 0x7fXX */
unicode_to_jisx0212_70,
unicode_to_jisx0212_71,
unicode_to_jisx0212_72,
unicode_to_jisx0212_73,
unicode_to_jisx0212_74,
unicode_to_jisx0212_75,
unicode_to_jisx0212_76,
unicode_to_jisx0212_77,
unicode_to_jisx0212_78,
unicode_to_jisx0212_79,
unicode_to_jisx0212_7a,
unicode_to_jisx0212_7b,
unicode_to_jisx0212_7c,
unicode_to_jisx0212_7d,
unicode_to_jisx0212_7e,
unicode_to_jisx0212_7f,
/* 0x80XX - 0x8fXX */
unicode_to_jisx0212_80,
unicode_to_jisx0212_81,
unicode_to_jisx0212_82,
unicode_to_jisx0212_83,
unicode_to_jisx0212_84,
unicode_to_jisx0212_85,
unicode_to_jisx0212_86,
unicode_to_jisx0212_87,
unicode_to_jisx0212_88,
unicode_to_jisx0212_89,
unicode_to_jisx0212_8a,
unicode_to_jisx0212_8b,
unicode_to_jisx0212_8c,
unicode_to_jisx0212_8d,
unicode_to_jisx0212_8e,
unicode_to_jisx0212_8f,
/* 0x90XX - 0x9fXX */
unicode_to_jisx0212_90,
unicode_to_jisx0212_91,
unicode_to_jisx0212_92,
unicode_to_jisx0212_93,
unicode_to_jisx0212_94,
unicode_to_jisx0212_95,
unicode_to_jisx0212_96,
unicode_to_jisx0212_97,
unicode_to_jisx0212_98,
unicode_to_jisx0212_99,
unicode_to_jisx0212_9a,
unicode_to_jisx0212_9b,
unicode_to_jisx0212_9c,
unicode_to_jisx0212_9d,
unicode_to_jisx0212_9e,
unicode_to_jisx0212_9f,
/* 0xa0XX - 0xafXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xb0XX - 0xbfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xc0XX - 0xcfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xd0XX - 0xdfXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xe0XX - 0xefXX */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xf0XX - 0xffXX */
0, 0, 0, 0, 0, 0, 0, 0, 0,
unicode_to_jisx0212_f9,
unicode_to_jisx0212_fa,
0, 0, 0, 0,
unicode_to_jisx0212_ff,
};
#endif
#ifdef USE_JISX0212
static uint unicode11ToJisx0212(uint h, uint l)
{
unsigned short const *table;
table = unicode_to_jisx0212_map[h];
if (table != 0) {
return table[l];
}
return 0x0000;
}
#else
static uint unicode11ToJisx0212(uint h, uint l)
{
return 0x0000;
}
#endif
static unsigned short const sjis208ibmvdc_unicode[] = {
/*0xfa40 -0xfafc*/
0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177,
0x2178, 0x2179, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165,
0x2166, 0x2167, 0x2168, 0x2169, 0xffe2, 0xffe4, 0xff07, 0xff02,
0x3231, 0x2116, 0x2121, 0x2235, 0x7e8a, 0x891c, 0x9348, 0x9288,
0x84dc, 0x4fc9, 0x70bb, 0x6631, 0x68c8, 0x92f9, 0x66fb, 0x5f45,
0x4e28, 0x4ee1, 0x4efc, 0x4f00, 0x4f03, 0x4f39, 0x4f56, 0x4f92,
0x4f8a, 0x4f9a, 0x4f94, 0x4fcd, 0x5040, 0x5022, 0x4fff, 0x501e,
0x5046, 0x5070, 0x5042, 0x5094, 0x50f4, 0x50d8, 0x514a, 0x30fb,
0x5164, 0x519d, 0x51be, 0x51ec, 0x5215, 0x529c, 0x52a6, 0x52c0,
0x52db, 0x5300, 0x5307, 0x5324, 0x5372, 0x5393, 0x53b2, 0x53dd,
0xfa0e, 0x549c, 0x548a, 0x54a9, 0x54ff, 0x5586, 0x5759, 0x5765,
0x57ac, 0x57c8, 0x57c7, 0xfa0f, 0xfa10, 0x589e, 0x58b2, 0x590b,
0x5953, 0x595b, 0x595d, 0x5963, 0x59a4, 0x59ba, 0x5b56, 0x5bc0,
0x752f, 0x5bd8, 0x5bec, 0x5c1e, 0x5ca6, 0x5cba, 0x5cf5, 0x5d27,
0x5d53, 0xfa11, 0x5d42, 0x5d6d, 0x5db8, 0x5db9, 0x5dd0, 0x5f21,
0x5f34, 0x5f67, 0x5fb7, 0x5fde, 0x605d, 0x6085, 0x608a, 0x60de,
0x60d5, 0x6120, 0x60f2, 0x6111, 0x6137, 0x6130, 0x6198, 0x6213,
0x62a6, 0x63f5, 0x6460, 0x649d, 0x64ce, 0x654e, 0x6600, 0x6615,
0x663b, 0x6609, 0x662e, 0x661e, 0x6624, 0x6665, 0x6657, 0x6659,
0xfa12, 0x6673, 0x6699, 0x66a0, 0x66b2, 0x66bf, 0x66fa, 0x670e,
0xf929, 0x6766, 0x67bb, 0x6852, 0x67c0, 0x6801, 0x6844, 0x68cf,
0xfa13, 0x6968, 0xfa14, 0x6998, 0x69e2, 0x6a30, 0x6a6b, 0x6a46,
0x6a73, 0x6a7e, 0x6ae2, 0x6ae4, 0x6bd6, 0x6c3f, 0x6c5c, 0x6c86,
0x6c6f, 0x6cda, 0x6d04, 0x6d87, 0x6d6f,
/*0xfb40 -0xfbfc*/
0x6d96, 0x6dac, 0x6dcf, 0x6df8, 0x6df2, 0x6dfc, 0x6e39, 0x6e5c,
0x6e27, 0x6e3c, 0x6ebf, 0x6f88, 0x6fb5, 0x6ff5, 0x7005, 0x7007,
0x7028, 0x7085, 0x70ab, 0x710f, 0x7104, 0x715c, 0x7146, 0x7147,
0xfa15, 0x71c1, 0x71fe, 0x72b1, 0x72be, 0x7324, 0xfa16, 0x7377,
0x73bd, 0x73c9, 0x73d6, 0x73e3, 0x73d2, 0x7407, 0x73f5, 0x7426,
0x742a, 0x7429, 0x742e, 0x7462, 0x7489, 0x749f, 0x7501, 0x756f,
0x7682, 0x769c, 0x769e, 0x769b, 0x76a6, 0xfa17, 0x7746, 0x52af,
0x7821, 0x784e, 0x7864, 0x787a, 0x7930, 0xfa18, 0xfa19, 0x30fb,
0xfa1a, 0x7994, 0xfa1b, 0x799b, 0x7ad1, 0x7ae7, 0xfa1c, 0x7aeb,
0x7b9e, 0xfa1d, 0x7d48, 0x7d5c, 0x7db7, 0x7da0, 0x7dd6, 0x7e52,
0x7f47, 0x7fa1, 0xfa1e, 0x8301, 0x8362, 0x837f, 0x83c7, 0x83f6,
0x8448, 0x84b4, 0x8553, 0x8559, 0x856b, 0xfa1f, 0x85b0, 0xfa20,
0xfa21, 0x8807, 0x88f5, 0x8a12, 0x8a37, 0x8a79, 0x8aa7, 0x8abe,
0x8adf, 0xfa22, 0x8af6, 0x8b53, 0x8b7f, 0x8cf0, 0x8cf4, 0x8d12,
0x8d76, 0xfa23, 0x8ecf, 0xfa24, 0xfa25, 0x9067, 0x90de, 0xfa26,
0x9115, 0x9127, 0x91da, 0x91d7, 0x91de, 0x91ed, 0x91ee, 0x91e4,
0x91e5, 0x9206, 0x9210, 0x920a, 0x923a, 0x9240, 0x923c, 0x924e,
0x9259, 0x9251, 0x9239, 0x9267, 0x92a7, 0x9277, 0x9278, 0x92e7,
0x92d7, 0x92d9, 0x92d0, 0xfa27, 0x92d5, 0x92e0, 0x92d3, 0x9325,
0x9321, 0x92fb, 0xfa28, 0x931e, 0x92ff, 0x931d, 0x9302, 0x9370,
0x9357, 0x93a4, 0x93c6, 0x93de, 0x93f8, 0x9431, 0x9445, 0x9448,
0x9592, 0xf9dc, 0xfa29, 0x969d, 0x96af, 0x9733, 0x973b, 0x9743,
0x974d, 0x974f, 0x9751, 0x9755, 0x9857, 0x9865, 0xfa2a, 0xfa2b,
0x9927, 0xfa2c, 0x999e, 0x9a4e, 0x9ad9,
/*0xfc40 -0xfc4b*/
0x9adc, 0x9b75, 0x9b72, 0x9b8f, 0x9bb1, 0x9bbb, 0x9c00, 0x9d70,
0x9d6b, 0xfa2d, 0x9e19, 0x9ed1, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000
};
uint QJpUnicodeConv::sjisibmvdcToUnicode(uint h, uint l) const
{
if (((rule & IBM_VDC) || (rule & Microsoft_CP932)) && IsSjisIBMVDCChar1(h))
return sjis208ibmvdc_unicode[((h - 0x00fa)*189 + (l-0x0040))];
else
return 0;
}
uint QJpUnicodeConv::unicodeToSjisibmvdc(uint h, uint l) const
{
if ((rule & IBM_VDC) || (rule & Microsoft_CP932)) {
uint u = (h<<8) | l;
//since there is no direct mapping, do a linear search
for (uint i =0; i<sizeof(sjis208ibmvdc_unicode)/sizeof(short) ; i++) {
//the table has zeros after 0xfc4b
if (!sjis208ibmvdc_unicode[i])
return 0;
if (u==sjis208ibmvdc_unicode[i]){
return (((0x00fa +(i/189))<<8) | (0x0040+(i%189)));
}
}
}
return 0;
}
static unsigned short const cp932_87_unicode[] = {
/*0x8740 -0x879c*/
0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467,
0x2468, 0x2469, 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f,
0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, 0x2163,
0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x0000, 0x3349,
0x3314, 0x3322, 0x334d, 0x3318, 0x3327, 0x3303, 0x3336, 0x3351,
0x3357, 0x330d, 0x3326, 0x3323, 0x332b, 0x334a, 0x333b, 0x339c,
0x339d, 0x339e, 0x338e, 0x338f, 0x33c4, 0x33a1, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x337b, 0x0000,
0x301d, 0x301f, 0x2116, 0x33cd, 0x2121, 0x32a4, 0x32a5, 0x32a6,
0x32a7, 0x32a8, 0x3231, 0x3232, 0x3239, 0x337e, 0x337d, 0x337c,
0x2252, 0x2261, 0x222b, 0x222e, 0x2211, 0x221a, 0x22a5, 0x2220,
0x221f, 0x22bf, 0x2235, 0x2229, 0x222a
};
static unsigned short const cp932_ed_ee_unicode[] = {
/*0xed40-0xedfc*/
0x7e8a, 0x891c, 0x9348, 0x9288, 0x84dc, 0x4fc9, 0x70bb, 0x6631,
0x68c8, 0x92f9, 0x66fb, 0x5f45, 0x4e28, 0x4ee1, 0x4efc, 0x4f00,
0x4f03, 0x4f39, 0x4f56, 0x4f92, 0x4f8a, 0x4f9a, 0x4f94, 0x4fcd,
0x5040, 0x5022, 0x4fff, 0x501e, 0x5046, 0x5070, 0x5042, 0x5094,
0x50f4, 0x50d8, 0x514a, 0x5164, 0x519d, 0x51be, 0x51ec, 0x5215,
0x529c, 0x52a6, 0x52c0, 0x52db, 0x5300, 0x5307, 0x5324, 0x5372,
0x5393, 0x53b2, 0x53dd, 0xfa0e, 0x549c, 0x548a, 0x54a9, 0x54ff,
0x5586, 0x5759, 0x5765, 0x57ac, 0x57c8, 0x57c7, 0xfa0f, 0x0000,
0xfa10, 0x589e, 0x58b2, 0x590b, 0x5953, 0x595b, 0x595d, 0x5963,
0x59a4, 0x59ba, 0x5b56, 0x5bc0, 0x752f, 0x5bd8, 0x5bec, 0x5c1e,
0x5ca6, 0x5cba, 0x5cf5, 0x5d27, 0x5d53, 0xfa11, 0x5d42, 0x5d6d,
0x5db8, 0x5db9, 0x5dd0, 0x5f21, 0x5f34, 0x5f67, 0x5fb7, 0x5fde,
0x605d, 0x6085, 0x608a, 0x60de, 0x60d5, 0x6120, 0x60f2, 0x6111,
0x6137, 0x6130, 0x6198, 0x6213, 0x62a6, 0x63f5, 0x6460, 0x649d,
0x64ce, 0x654e, 0x6600, 0x6615, 0x663b, 0x6609, 0x662e, 0x661e,
0x6624, 0x6665, 0x6657, 0x6659, 0xfa12, 0x6673, 0x6699, 0x66a0,
0x66b2, 0x66bf, 0x66fa, 0x670e, 0xf929, 0x6766, 0x67bb, 0x6852,
0x67c0, 0x6801, 0x6844, 0x68cf, 0xfa13, 0x6968, 0xfa14, 0x6998,
0x69e2, 0x6a30, 0x6a6b, 0x6a46, 0x6a73, 0x6a7e, 0x6ae2, 0x6ae4,
0x6bd6, 0x6c3f, 0x6c5c, 0x6c86, 0x6c6f, 0x6cda, 0x6d04, 0x6d87,
0x6d6f, 0x6d96, 0x6dac, 0x6dcf, 0x6df8, 0x6df2, 0x6dfc, 0x6e39,
0x6e5c, 0x6e27, 0x6e3c, 0x6ebf, 0x6f88, 0x6fb5, 0x6ff5, 0x7005,
0x7007, 0x7028, 0x7085, 0x70ab, 0x710f, 0x7104, 0x715c, 0x7146,
0x7147, 0xfa15, 0x71c1, 0x71fe, 0x72b1,
/*0xee40-0xeefc*/
0x72be, 0x7324, 0xfa16, 0x7377, 0x73bd, 0x73c9, 0x73d6, 0x73e3,
0x73d2, 0x7407, 0x73f5, 0x7426, 0x742a, 0x7429, 0x742e, 0x7462,
0x7489, 0x749f, 0x7501, 0x756f, 0x7682, 0x769c, 0x769e, 0x769b,
0x76a6, 0xfa17, 0x7746, 0x52af, 0x7821, 0x784e, 0x7864, 0x787a,
0x7930, 0xfa18, 0xfa19, 0xfa1a, 0x7994, 0xfa1b, 0x799b, 0x7ad1,
0x7ae7, 0xfa1c, 0x7aeb, 0x7b9e, 0xfa1d, 0x7d48, 0x7d5c, 0x7db7,
0x7da0, 0x7dd6, 0x7e52, 0x7f47, 0x7fa1, 0xfa1e, 0x8301, 0x8362,
0x837f, 0x83c7, 0x83f6, 0x8448, 0x84b4, 0x8553, 0x8559, 0x0000,
0x856b, 0xfa1f, 0x85b0, 0xfa20, 0xfa21, 0x8807, 0x88f5, 0x8a12,
0x8a37, 0x8a79, 0x8aa7, 0x8abe, 0x8adf, 0xfa22, 0x8af6, 0x8b53,
0x8b7f, 0x8cf0, 0x8cf4, 0x8d12, 0x8d76, 0xfa23, 0x8ecf, 0xfa24,
0xfa25, 0x9067, 0x90de, 0xfa26, 0x9115, 0x9127, 0x91da, 0x91d7,
0x91de, 0x91ed, 0x91ee, 0x91e4, 0x91e5, 0x9206, 0x9210, 0x920a,
0x923a, 0x9240, 0x923c, 0x924e, 0x9259, 0x9251, 0x9239, 0x9267,
0x92a7, 0x9277, 0x9278, 0x92e7, 0x92d7, 0x92d9, 0x92d0, 0xfa27,
0x92d5, 0x92e0, 0x92d3, 0x9325, 0x9321, 0x92fb, 0xfa28, 0x931e,
0x92ff, 0x931d, 0x9302, 0x9370, 0x9357, 0x93a4, 0x93c6, 0x93de,
0x93f8, 0x9431, 0x9445, 0x9448, 0x9592, 0xf9dc, 0xfa29, 0x969d,
0x96af, 0x9733, 0x973b, 0x9743, 0x974d, 0x974f, 0x9751, 0x9755,
0x9857, 0x9865, 0xfa2a, 0xfa2b, 0x9927, 0xfa2c, 0x999e, 0x9a4e,
0x9ad9, 0x9adc, 0x9b75, 0x9b72, 0x9b8f, 0x9bb1, 0x9bbb, 0x9c00,
0x9d70, 0x9d6b, 0xfa2d, 0x9e19, 0x9ed1, 0x0000, 0x0000, 0x2170,
0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178,
0x2179, 0xffe2, 0xffe4, 0xff07, 0xff02
};
uint QJpUnicodeConv::cp932ToUnicode(uint h, uint l) const
{
if (rule & Microsoft_CP932) {
if (h == 0x0087 && (l >= 0x0040 && l <= 0x009c))
return cp932_87_unicode[l-0x0040];
else if ((h == 0x00ed || h == 0x00ee) && (l >= 0x0040 && l <= 0x00fc))
return cp932_ed_ee_unicode[((h - 0x00ed)*189 + (l-0x0040))];
}
return 0;
}
uint QJpUnicodeConv::unicodeToCp932(uint h, uint l) const
{
if ((rule & Microsoft_CP932)) {
uint u = (h<<8) | l;
//since there is no direct mapping, do a linear search
for (uint i =0; i<sizeof(cp932_87_unicode)/sizeof(short) ; i++) {
//the table has zeros for some characters
if (!cp932_87_unicode[i])
return 0;
if (u == cp932_87_unicode[i]){
return ((0x0087<<8) | (0x0040+i));
}
}
for (uint j =0; j<sizeof(cp932_ed_ee_unicode)/sizeof(short) ; j++) {
if (!cp932_ed_ee_unicode[j])
return 0;
if (u==cp932_ed_ee_unicode[j]){
return (((0x00ed +(j/189))<<8) | (0x0040+(j%189)));
}
}
}
return 0;
}
// and now for the inlines:
/*! \fn uint QJpUnicodeConv::asciiToUnicode (uint ascii) const
\internal
*/
/*! \fn uint QJpUnicodeConv::jisx0201ToUnicode (uint jis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::jisx0201LatinToUnicode (uint jis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::jisx0201KanaToUnicode (uint jis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::jisx0208ToUnicode (uint jis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::jisx0212ToUnicode (uint jis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToAscii (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToJisx0201 (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToJisx0201Latin (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToJisx0201Kana (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToJisx0208 (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToJisx0212 (uint unicode) const
\internal
*/
/*! \fn uint QJpUnicodeConv::sjisToUnicode (uint sjis) const
\internal
*/
/*! \fn uint QJpUnicodeConv::unicodeToSjis (uint unicode) const
\internal
*/
QT_END_NAMESPACE
| bsd-3-clause |
ismagom/lwm2m-galileo | core/list.c | 19 | 3235 | /*
Copyright (c) 2013, Intel Corporation
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
David Navarro <david.navarro@intel.com>
*/
#include "internals.h"
lwm2m_list_t * lwm2m_list_add(lwm2m_list_t * head,
lwm2m_list_t * node)
{
lwm2m_list_t * target;
if (NULL == head) return node;
if (head->id > node->id)
{
node->next = head;
return node;
}
target = head;
while (NULL != target->next && target->next->id < node->id)
{
target = target->next;
}
node->next = target->next;
target->next = node;
return head;
}
lwm2m_list_t * lwm2m_list_find(lwm2m_list_t * head,
uint16_t id)
{
while (NULL != head && head->id < id)
{
head = head->next;
}
if (NULL != head && head->id == id) return head;
return NULL;
}
lwm2m_list_t * lwm2m_list_remove(lwm2m_list_t * head,
uint16_t id,
lwm2m_list_t ** nodeP)
{
lwm2m_list_t * target;
if (head == NULL)
{
*nodeP = NULL;
return NULL;
}
if (head->id == id)
{
*nodeP = head;
return head->next;
}
target = head;
while (NULL != target->next && target->next->id < id)
{
target = target->next;
}
if (NULL != target->next && target->next->id == id)
{
*nodeP = target->next;
target->next = target->next->next;
}
else
{
*nodeP = NULL;
}
return head;
}
uint16_t lwm2m_list_newId(lwm2m_list_t * head)
{
uint16_t id;
lwm2m_list_t * target;
id = 0;
target = head;
while (target != NULL && id == target->id)
{
id = target->id + 1;
target = target->next;
}
return id;
}
| bsd-3-clause |
FauxFaux/i3 | libi3/ipc_recv_message.c | 20 | 2002 | /*
* vim:ts=4:sw=4:expandtab
*
* i3 - an improved dynamic tiling window manager
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
*
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <i3/ipc.h>
#include "libi3.h"
/*
* Reads a message from the given socket file descriptor and stores its length
* (reply_length) as well as a pointer to its contents (reply).
*
* Returns -1 when read() fails, errno will remain.
* Returns -2 on EOF.
* Returns -3 when the IPC protocol is violated (invalid magic, unexpected
* message type, EOF instead of a message). Additionally, the error will be
* printed to stderr.
* Returns 0 on success.
*
*/
int ipc_recv_message(int sockfd, uint32_t *message_type,
uint32_t *reply_length, uint8_t **reply) {
/* Read the message header first */
const uint32_t to_read = strlen(I3_IPC_MAGIC) + sizeof(uint32_t) + sizeof(uint32_t);
char msg[to_read];
char *walk = msg;
uint32_t read_bytes = 0;
while (read_bytes < to_read) {
int n = read(sockfd, msg + read_bytes, to_read - read_bytes);
if (n == -1)
return -1;
if (n == 0) {
return -2;
}
read_bytes += n;
}
if (memcmp(walk, I3_IPC_MAGIC, strlen(I3_IPC_MAGIC)) != 0) {
ELOG("IPC: invalid magic in reply\n");
return -3;
}
walk += strlen(I3_IPC_MAGIC);
memcpy(reply_length, walk, sizeof(uint32_t));
walk += sizeof(uint32_t);
if (message_type != NULL)
memcpy(message_type, walk, sizeof(uint32_t));
*reply = smalloc(*reply_length);
read_bytes = 0;
int n;
while (read_bytes < *reply_length) {
if ((n = read(sockfd, *reply + read_bytes, *reply_length - read_bytes)) == -1) {
if (errno == EINTR || errno == EAGAIN)
continue;
return -1;
}
read_bytes += n;
}
return 0;
}
| bsd-3-clause |
Pluto-tv/chromium-crosswalk | net/third_party/nss/ssl/dtlscon.c | 23 | 37412 | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* DTLS Protocol
*/
#include "ssl.h"
#include "sslimpl.h"
#include "sslproto.h"
#ifndef PR_ARRAY_SIZE
#define PR_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#endif
static SECStatus dtls_TransmitMessageFlight(sslSocket *ss);
static void dtls_RetransmitTimerExpiredCb(sslSocket *ss);
static SECStatus dtls_SendSavedWriteData(sslSocket *ss);
/* -28 adjusts for the IP/UDP header */
static const PRUint16 COMMON_MTU_VALUES[] = {
1500 - 28, /* Ethernet MTU */
1280 - 28, /* IPv6 minimum MTU */
576 - 28, /* Common assumption */
256 - 28 /* We're in serious trouble now */
};
#define DTLS_COOKIE_BYTES 32
/* List copied from ssl3con.c:cipherSuites */
static const ssl3CipherSuite nonDTLSSuites[] = {
#ifndef NSS_DISABLE_ECC
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA,
TLS_ECDHE_RSA_WITH_RC4_128_SHA,
#endif /* NSS_DISABLE_ECC */
TLS_DHE_DSS_WITH_RC4_128_SHA,
#ifndef NSS_DISABLE_ECC
TLS_ECDH_RSA_WITH_RC4_128_SHA,
TLS_ECDH_ECDSA_WITH_RC4_128_SHA,
#endif /* NSS_DISABLE_ECC */
TLS_RSA_WITH_RC4_128_MD5,
TLS_RSA_WITH_RC4_128_SHA,
TLS_RSA_EXPORT1024_WITH_RC4_56_SHA,
TLS_RSA_EXPORT_WITH_RC4_40_MD5,
0 /* End of list marker */
};
/* Map back and forth between TLS and DTLS versions in wire format.
* Mapping table is:
*
* TLS DTLS
* 1.1 (0302) 1.0 (feff)
* 1.2 (0303) 1.2 (fefd)
* 1.3 (0304) 1.3 (fefc)
*/
SSL3ProtocolVersion
dtls_TLSVersionToDTLSVersion(SSL3ProtocolVersion tlsv)
{
if (tlsv == SSL_LIBRARY_VERSION_TLS_1_1) {
return SSL_LIBRARY_VERSION_DTLS_1_0_WIRE;
}
if (tlsv == SSL_LIBRARY_VERSION_TLS_1_2) {
return SSL_LIBRARY_VERSION_DTLS_1_2_WIRE;
}
if (tlsv == SSL_LIBRARY_VERSION_TLS_1_3) {
return SSL_LIBRARY_VERSION_DTLS_1_3_WIRE;
}
/* Anything other than TLS 1.1 or 1.2 is an error, so return
* the invalid version 0xffff. */
return 0xffff;
}
/* Map known DTLS versions to known TLS versions.
* - Invalid versions (< 1.0) return a version of 0
* - Versions > known return a version one higher than we know of
* to accomodate a theoretically newer version */
SSL3ProtocolVersion
dtls_DTLSVersionToTLSVersion(SSL3ProtocolVersion dtlsv)
{
if (MSB(dtlsv) == 0xff) {
return 0;
}
if (dtlsv == SSL_LIBRARY_VERSION_DTLS_1_0_WIRE) {
return SSL_LIBRARY_VERSION_TLS_1_1;
}
if (dtlsv == SSL_LIBRARY_VERSION_DTLS_1_2_WIRE) {
return SSL_LIBRARY_VERSION_TLS_1_2;
}
if (dtlsv == SSL_LIBRARY_VERSION_DTLS_1_3_WIRE) {
return SSL_LIBRARY_VERSION_TLS_1_3;
}
/* Return a fictional higher version than we know of */
return SSL_LIBRARY_VERSION_TLS_1_2 + 1;
}
/* On this socket, Disable non-DTLS cipher suites in the argument's list */
SECStatus
ssl3_DisableNonDTLSSuites(sslSocket * ss)
{
const ssl3CipherSuite * suite;
for (suite = nonDTLSSuites; *suite; ++suite) {
SECStatus rv = ssl3_CipherPrefSet(ss, *suite, PR_FALSE);
PORT_Assert(rv == SECSuccess); /* else is coding error */
}
return SECSuccess;
}
/* Allocate a DTLSQueuedMessage.
*
* Called from dtls_QueueMessage()
*/
static DTLSQueuedMessage *
dtls_AllocQueuedMessage(PRUint16 epoch, SSL3ContentType type,
const unsigned char *data, PRUint32 len)
{
DTLSQueuedMessage *msg = NULL;
msg = PORT_ZAlloc(sizeof(DTLSQueuedMessage));
if (!msg)
return NULL;
msg->data = PORT_Alloc(len);
if (!msg->data) {
PORT_Free(msg);
return NULL;
}
PORT_Memcpy(msg->data, data, len);
msg->len = len;
msg->epoch = epoch;
msg->type = type;
return msg;
}
/*
* Free a handshake message
*
* Called from dtls_FreeHandshakeMessages()
*/
static void
dtls_FreeHandshakeMessage(DTLSQueuedMessage *msg)
{
if (!msg)
return;
PORT_ZFree(msg->data, msg->len);
PORT_Free(msg);
}
/*
* Free a list of handshake messages
*
* Called from:
* dtls_HandleHandshake()
* ssl3_DestroySSL3Info()
*/
void
dtls_FreeHandshakeMessages(PRCList *list)
{
PRCList *cur_p;
while (!PR_CLIST_IS_EMPTY(list)) {
cur_p = PR_LIST_TAIL(list);
PR_REMOVE_LINK(cur_p);
dtls_FreeHandshakeMessage((DTLSQueuedMessage *)cur_p);
}
}
/* Called only from ssl3_HandleRecord, for each (deciphered) DTLS record.
* origBuf is the decrypted ssl record content and is expected to contain
* complete handshake records
* Caller must hold the handshake and RecvBuf locks.
*
* Note that this code uses msg_len for two purposes:
*
* (1) To pass the length to ssl3_HandleHandshakeMessage()
* (2) To carry the length of a message currently being reassembled
*
* However, unlike ssl3_HandleHandshake(), it is not used to carry
* the state of reassembly (i.e., whether one is in progress). That
* is carried in recvdHighWater and recvdFragments.
*/
#define OFFSET_BYTE(o) (o/8)
#define OFFSET_MASK(o) (1 << (o%8))
SECStatus
dtls_HandleHandshake(sslSocket *ss, sslBuffer *origBuf)
{
/* XXX OK for now.
* This doesn't work properly with asynchronous certificate validation.
* because that returns a WOULDBLOCK error. The current DTLS
* applications do not need asynchronous validation, but in the
* future we will need to add this.
*/
sslBuffer buf = *origBuf;
SECStatus rv = SECSuccess;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
while (buf.len > 0) {
PRUint8 type;
PRUint32 message_length;
PRUint16 message_seq;
PRUint32 fragment_offset;
PRUint32 fragment_length;
PRUint32 offset;
if (buf.len < 12) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
break;
}
/* Parse the header */
type = buf.buf[0];
message_length = (buf.buf[1] << 16) | (buf.buf[2] << 8) | buf.buf[3];
message_seq = (buf.buf[4] << 8) | buf.buf[5];
fragment_offset = (buf.buf[6] << 16) | (buf.buf[7] << 8) | buf.buf[8];
fragment_length = (buf.buf[9] << 16) | (buf.buf[10] << 8) | buf.buf[11];
#define MAX_HANDSHAKE_MSG_LEN 0x1ffff /* 128k - 1 */
if (message_length > MAX_HANDSHAKE_MSG_LEN) {
(void)ssl3_DecodeError(ss);
PORT_SetError(SSL_ERROR_RX_RECORD_TOO_LONG);
return SECFailure;
}
#undef MAX_HANDSHAKE_MSG_LEN
buf.buf += 12;
buf.len -= 12;
/* This fragment must be complete */
if (buf.len < fragment_length) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
break;
}
/* Sanity check the packet contents */
if ((fragment_length + fragment_offset) > message_length) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
break;
}
/* There are three ways we could not be ready for this packet.
*
* 1. It's a partial next message.
* 2. It's a partial or complete message beyond the next
* 3. It's a message we've already seen
*
* If it's the complete next message we accept it right away.
* This is the common case for short messages
*/
if ((message_seq == ss->ssl3.hs.recvMessageSeq)
&& (fragment_offset == 0)
&& (fragment_length == message_length)) {
/* Complete next message. Process immediately */
ss->ssl3.hs.msg_type = (SSL3HandshakeType)type;
ss->ssl3.hs.msg_len = message_length;
/* At this point we are advancing our state machine, so
* we can free our last flight of messages */
dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
ss->ssl3.hs.recvdHighWater = -1;
dtls_CancelTimer(ss);
/* Reset the timer to the initial value if the retry counter
* is 0, per Sec. 4.2.4.1 */
if (ss->ssl3.hs.rtRetries == 0) {
ss->ssl3.hs.rtTimeoutMs = INITIAL_DTLS_TIMEOUT_MS;
}
rv = ssl3_HandleHandshakeMessage(ss, buf.buf, ss->ssl3.hs.msg_len);
if (rv == SECFailure) {
/* Do not attempt to process rest of messages in this record */
break;
}
} else {
if (message_seq < ss->ssl3.hs.recvMessageSeq) {
/* Case 3: we do an immediate retransmit if we're
* in a waiting state*/
if (ss->ssl3.hs.rtTimerCb == NULL) {
/* Ignore */
} else if (ss->ssl3.hs.rtTimerCb ==
dtls_RetransmitTimerExpiredCb) {
SSL_TRC(30, ("%d: SSL3[%d]: Retransmit detected",
SSL_GETPID(), ss->fd));
/* Check to see if we retransmitted recently. If so,
* suppress the triggered retransmit. This avoids
* retransmit wars after packet loss.
* This is not in RFC 5346 but should be
*/
if ((PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted) >
(ss->ssl3.hs.rtTimeoutMs / 4)) {
SSL_TRC(30,
("%d: SSL3[%d]: Shortcutting retransmit timer",
SSL_GETPID(), ss->fd));
/* Cancel the timer and call the CB,
* which re-arms the timer */
dtls_CancelTimer(ss);
dtls_RetransmitTimerExpiredCb(ss);
rv = SECSuccess;
break;
} else {
SSL_TRC(30,
("%d: SSL3[%d]: We just retransmitted. Ignoring.",
SSL_GETPID(), ss->fd));
rv = SECSuccess;
break;
}
} else if (ss->ssl3.hs.rtTimerCb == dtls_FinishedTimerCb) {
/* Retransmit the messages and re-arm the timer
* Note that we are not backing off the timer here.
* The spec isn't clear and my reasoning is that this
* may be a re-ordered packet rather than slowness,
* so let's be aggressive. */
dtls_CancelTimer(ss);
rv = dtls_TransmitMessageFlight(ss);
if (rv == SECSuccess) {
rv = dtls_StartTimer(ss, dtls_FinishedTimerCb);
}
if (rv != SECSuccess)
return rv;
break;
}
} else if (message_seq > ss->ssl3.hs.recvMessageSeq) {
/* Case 2
*
* Ignore this message. This means we don't handle out of
* order complete messages that well, but we're still
* compliant and this probably does not happen often
*
* XXX OK for now. Maybe do something smarter at some point?
*/
} else {
/* Case 1
*
* Buffer the fragment for reassembly
*/
/* Make room for the message */
if (ss->ssl3.hs.recvdHighWater == -1) {
PRUint32 map_length = OFFSET_BYTE(message_length) + 1;
rv = sslBuffer_Grow(&ss->ssl3.hs.msg_body, message_length);
if (rv != SECSuccess)
break;
/* Make room for the fragment map */
rv = sslBuffer_Grow(&ss->ssl3.hs.recvdFragments,
map_length);
if (rv != SECSuccess)
break;
/* Reset the reassembly map */
ss->ssl3.hs.recvdHighWater = 0;
PORT_Memset(ss->ssl3.hs.recvdFragments.buf, 0,
ss->ssl3.hs.recvdFragments.space);
ss->ssl3.hs.msg_type = (SSL3HandshakeType)type;
ss->ssl3.hs.msg_len = message_length;
}
/* If we have a message length mismatch, abandon the reassembly
* in progress and hope that the next retransmit will give us
* something sane
*/
if (message_length != ss->ssl3.hs.msg_len) {
ss->ssl3.hs.recvdHighWater = -1;
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
break;
}
/* Now copy this fragment into the buffer */
PORT_Assert((fragment_offset + fragment_length) <=
ss->ssl3.hs.msg_body.space);
PORT_Memcpy(ss->ssl3.hs.msg_body.buf + fragment_offset,
buf.buf, fragment_length);
/* This logic is a bit tricky. We have two values for
* reassembly state:
*
* - recvdHighWater contains the highest contiguous number of
* bytes received
* - recvdFragments contains a bitmask of packets received
* above recvdHighWater
*
* This avoids having to fill in the bitmask in the common
* case of adjacent fragments received in sequence
*/
if (fragment_offset <= ss->ssl3.hs.recvdHighWater) {
/* Either this is the adjacent fragment or an overlapping
* fragment */
ss->ssl3.hs.recvdHighWater = fragment_offset +
fragment_length;
} else {
for (offset = fragment_offset;
offset < fragment_offset + fragment_length;
offset++) {
ss->ssl3.hs.recvdFragments.buf[OFFSET_BYTE(offset)] |=
OFFSET_MASK(offset);
}
}
/* Now figure out the new high water mark if appropriate */
for (offset = ss->ssl3.hs.recvdHighWater;
offset < ss->ssl3.hs.msg_len; offset++) {
/* Note that this loop is not efficient, since it counts
* bit by bit. If we have a lot of out-of-order packets,
* we should optimize this */
if (ss->ssl3.hs.recvdFragments.buf[OFFSET_BYTE(offset)] &
OFFSET_MASK(offset)) {
ss->ssl3.hs.recvdHighWater++;
} else {
break;
}
}
/* If we have all the bytes, then we are good to go */
if (ss->ssl3.hs.recvdHighWater == ss->ssl3.hs.msg_len) {
ss->ssl3.hs.recvdHighWater = -1;
rv = ssl3_HandleHandshakeMessage(ss,
ss->ssl3.hs.msg_body.buf,
ss->ssl3.hs.msg_len);
if (rv == SECFailure)
break; /* Skip rest of record */
/* At this point we are advancing our state machine, so
* we can free our last flight of messages */
dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
dtls_CancelTimer(ss);
/* If there have been no retries this time, reset the
* timer value to the default per Section 4.2.4.1 */
if (ss->ssl3.hs.rtRetries == 0) {
ss->ssl3.hs.rtTimeoutMs = INITIAL_DTLS_TIMEOUT_MS;
}
}
}
}
buf.buf += fragment_length;
buf.len -= fragment_length;
}
origBuf->len = 0; /* So ssl3_GatherAppDataRecord will keep looping. */
/* XXX OK for now. In future handle rv == SECWouldBlock safely in order
* to deal with asynchronous certificate verification */
return rv;
}
/* Enqueue a message (either handshake or CCS)
*
* Called from:
* dtls_StageHandshakeMessage()
* ssl3_SendChangeCipherSpecs()
*/
SECStatus dtls_QueueMessage(sslSocket *ss, SSL3ContentType type,
const SSL3Opaque *pIn, PRInt32 nIn)
{
SECStatus rv = SECSuccess;
DTLSQueuedMessage *msg = NULL;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
msg = dtls_AllocQueuedMessage(ss->ssl3.cwSpec->epoch, type, pIn, nIn);
if (!msg) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
rv = SECFailure;
} else {
PR_APPEND_LINK(&msg->link, &ss->ssl3.hs.lastMessageFlight);
}
return rv;
}
/* Add DTLS handshake message to the pending queue
* Empty the sendBuf buffer.
* This function returns SECSuccess or SECFailure, never SECWouldBlock.
* Always set sendBuf.len to 0, even when returning SECFailure.
*
* Called from:
* ssl3_AppendHandshakeHeader()
* dtls_FlushHandshake()
*/
SECStatus
dtls_StageHandshakeMessage(sslSocket *ss)
{
SECStatus rv = SECSuccess;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
/* This function is sometimes called when no data is actually to
* be staged, so just return SECSuccess. */
if (!ss->sec.ci.sendBuf.buf || !ss->sec.ci.sendBuf.len)
return rv;
rv = dtls_QueueMessage(ss, content_handshake,
ss->sec.ci.sendBuf.buf, ss->sec.ci.sendBuf.len);
/* Whether we succeeded or failed, toss the old handshake data. */
ss->sec.ci.sendBuf.len = 0;
return rv;
}
/* Enqueue the handshake message in sendBuf (if any) and then
* transmit the resulting flight of handshake messages.
*
* Called from:
* ssl3_FlushHandshake()
*/
SECStatus
dtls_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags)
{
SECStatus rv = SECSuccess;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
rv = dtls_StageHandshakeMessage(ss);
if (rv != SECSuccess)
return rv;
if (!(flags & ssl_SEND_FLAG_FORCE_INTO_BUFFER)) {
rv = dtls_TransmitMessageFlight(ss);
if (rv != SECSuccess)
return rv;
if (!(flags & ssl_SEND_FLAG_NO_RETRANSMIT)) {
ss->ssl3.hs.rtRetries = 0;
rv = dtls_StartTimer(ss, dtls_RetransmitTimerExpiredCb);
}
}
return rv;
}
/* The callback for when the retransmit timer expires
*
* Called from:
* dtls_CheckTimer()
* dtls_HandleHandshake()
*/
static void
dtls_RetransmitTimerExpiredCb(sslSocket *ss)
{
SECStatus rv = SECFailure;
ss->ssl3.hs.rtRetries++;
if (!(ss->ssl3.hs.rtRetries % 3)) {
/* If one of the messages was potentially greater than > MTU,
* then downgrade. Do this every time we have retransmitted a
* message twice, per RFC 6347 Sec. 4.1.1 */
dtls_SetMTU(ss, ss->ssl3.hs.maxMessageSent - 1);
}
rv = dtls_TransmitMessageFlight(ss);
if (rv == SECSuccess) {
/* Re-arm the timer */
rv = dtls_RestartTimer(ss, PR_TRUE, dtls_RetransmitTimerExpiredCb);
}
if (rv == SECFailure) {
/* XXX OK for now. In future maybe signal the stack that we couldn't
* transmit. For now, let the read handle any real network errors */
}
}
/* Transmit a flight of handshake messages, stuffing them
* into as few records as seems reasonable
*
* Called from:
* dtls_FlushHandshake()
* dtls_RetransmitTimerExpiredCb()
*/
static SECStatus
dtls_TransmitMessageFlight(sslSocket *ss)
{
SECStatus rv = SECSuccess;
PRCList *msg_p;
PRUint16 room_left = ss->ssl3.mtu;
PRInt32 sent;
ssl_GetXmitBufLock(ss);
ssl_GetSpecReadLock(ss);
/* DTLS does not buffer its handshake messages in
* ss->pendingBuf, but rather in the lastMessageFlight
* structure. This is just a sanity check that
* some programming error hasn't inadvertantly
* stuffed something in ss->pendingBuf
*/
PORT_Assert(!ss->pendingBuf.len);
for (msg_p = PR_LIST_HEAD(&ss->ssl3.hs.lastMessageFlight);
msg_p != &ss->ssl3.hs.lastMessageFlight;
msg_p = PR_NEXT_LINK(msg_p)) {
DTLSQueuedMessage *msg = (DTLSQueuedMessage *)msg_p;
/* The logic here is:
*
* 1. If this is a message that will not fit into the remaining
* space, then flush.
* 2. If the message will now fit into the remaining space,
* encrypt, buffer, and loop.
* 3. If the message will not fit, then fragment.
*
* At the end of the function, flush.
*/
if ((msg->len + SSL3_BUFFER_FUDGE) > room_left) {
/* The message will not fit into the remaining space, so flush */
rv = dtls_SendSavedWriteData(ss);
if (rv != SECSuccess)
break;
room_left = ss->ssl3.mtu;
}
if ((msg->len + SSL3_BUFFER_FUDGE) <= room_left) {
/* The message will fit, so encrypt and then continue with the
* next packet */
sent = ssl3_SendRecord(ss, msg->epoch, msg->type,
msg->data, msg->len,
ssl_SEND_FLAG_FORCE_INTO_BUFFER |
ssl_SEND_FLAG_USE_EPOCH);
if (sent != msg->len) {
rv = SECFailure;
if (sent != -1) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
}
break;
}
room_left = ss->ssl3.mtu - ss->pendingBuf.len;
} else {
/* The message will not fit, so fragment.
*
* XXX OK for now. Arrange to coalesce the last fragment
* of this message with the next message if possible.
* That would be more efficient.
*/
PRUint32 fragment_offset = 0;
unsigned char fragment[DTLS_MAX_MTU]; /* >= than largest
* plausible MTU */
/* Assert that we have already flushed */
PORT_Assert(room_left == ss->ssl3.mtu);
/* Case 3: We now need to fragment this message
* DTLS only supports fragmenting handshaking messages */
PORT_Assert(msg->type == content_handshake);
/* The headers consume 12 bytes so the smalles possible
* message (i.e., an empty one) is 12 bytes
*/
PORT_Assert(msg->len >= 12);
while ((fragment_offset + 12) < msg->len) {
PRUint32 fragment_len;
const unsigned char *content = msg->data + 12;
PRUint32 content_len = msg->len - 12;
/* The reason we use 8 here is that that's the length of
* the new DTLS data that we add to the header */
fragment_len = PR_MIN(room_left - (SSL3_BUFFER_FUDGE + 8),
content_len - fragment_offset);
PORT_Assert(fragment_len < DTLS_MAX_MTU - 12);
/* Make totally sure that we are within the buffer.
* Note that the only way that fragment len could get
* adjusted here is if
*
* (a) we are in release mode so the PORT_Assert is compiled out
* (b) either the MTU table is inconsistent with DTLS_MAX_MTU
* or ss->ssl3.mtu has become corrupt.
*/
fragment_len = PR_MIN(fragment_len, DTLS_MAX_MTU - 12);
/* Construct an appropriate-sized fragment */
/* Type, length, sequence */
PORT_Memcpy(fragment, msg->data, 6);
/* Offset */
fragment[6] = (fragment_offset >> 16) & 0xff;
fragment[7] = (fragment_offset >> 8) & 0xff;
fragment[8] = (fragment_offset) & 0xff;
/* Fragment length */
fragment[9] = (fragment_len >> 16) & 0xff;
fragment[10] = (fragment_len >> 8) & 0xff;
fragment[11] = (fragment_len) & 0xff;
PORT_Memcpy(fragment + 12, content + fragment_offset,
fragment_len);
/*
* Send the record. We do this in two stages
* 1. Encrypt
*/
sent = ssl3_SendRecord(ss, msg->epoch, msg->type,
fragment, fragment_len + 12,
ssl_SEND_FLAG_FORCE_INTO_BUFFER |
ssl_SEND_FLAG_USE_EPOCH);
if (sent != (fragment_len + 12)) {
rv = SECFailure;
if (sent != -1) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
}
break;
}
/* 2. Flush */
rv = dtls_SendSavedWriteData(ss);
if (rv != SECSuccess)
break;
fragment_offset += fragment_len;
}
}
}
/* Finally, we need to flush */
if (rv == SECSuccess)
rv = dtls_SendSavedWriteData(ss);
/* Give up the locks */
ssl_ReleaseSpecReadLock(ss);
ssl_ReleaseXmitBufLock(ss);
return rv;
}
/* Flush the data in the pendingBuf and update the max message sent
* so we can adjust the MTU estimate if we need to.
* Wrapper for ssl_SendSavedWriteData.
*
* Called from dtls_TransmitMessageFlight()
*/
static
SECStatus dtls_SendSavedWriteData(sslSocket *ss)
{
PRInt32 sent;
sent = ssl_SendSavedWriteData(ss);
if (sent < 0)
return SECFailure;
/* We should always have complete writes b/c datagram sockets
* don't really block */
if (ss->pendingBuf.len > 0) {
ssl_MapLowLevelError(SSL_ERROR_SOCKET_WRITE_FAILURE);
return SECFailure;
}
/* Update the largest message sent so we can adjust the MTU
* estimate if necessary */
if (sent > ss->ssl3.hs.maxMessageSent)
ss->ssl3.hs.maxMessageSent = sent;
return SECSuccess;
}
/* Compress, MAC, encrypt a DTLS record. Allows specification of
* the epoch using epoch value. If use_epoch is PR_TRUE then
* we use the provided epoch. If use_epoch is PR_FALSE then
* whatever the current value is in effect is used.
*
* Called from ssl3_SendRecord()
*/
SECStatus
dtls_CompressMACEncryptRecord(sslSocket * ss,
DTLSEpoch epoch,
PRBool use_epoch,
SSL3ContentType type,
const SSL3Opaque * pIn,
PRUint32 contentLen,
sslBuffer * wrBuf)
{
SECStatus rv = SECFailure;
ssl3CipherSpec * cwSpec;
ssl_GetSpecReadLock(ss); /********************************/
/* The reason for this switch-hitting code is that we might have
* a flight of records spanning an epoch boundary, e.g.,
*
* ClientKeyExchange (epoch = 0)
* ChangeCipherSpec (epoch = 0)
* Finished (epoch = 1)
*
* Thus, each record needs a different cipher spec. The information
* about which epoch to use is carried with the record.
*/
if (use_epoch) {
if (ss->ssl3.cwSpec->epoch == epoch)
cwSpec = ss->ssl3.cwSpec;
else if (ss->ssl3.pwSpec->epoch == epoch)
cwSpec = ss->ssl3.pwSpec;
else
cwSpec = NULL;
} else {
cwSpec = ss->ssl3.cwSpec;
}
if (cwSpec) {
rv = ssl3_CompressMACEncryptRecord(cwSpec, ss->sec.isServer, PR_TRUE,
PR_FALSE, type, pIn, contentLen,
wrBuf);
} else {
PR_NOT_REACHED("Couldn't find a cipher spec matching epoch");
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
}
ssl_ReleaseSpecReadLock(ss); /************************************/
return rv;
}
/* Start a timer
*
* Called from:
* dtls_HandleHandshake()
* dtls_FlushHAndshake()
* dtls_RestartTimer()
*/
SECStatus
dtls_StartTimer(sslSocket *ss, DTLSTimerCb cb)
{
PORT_Assert(ss->ssl3.hs.rtTimerCb == NULL);
ss->ssl3.hs.rtTimerStarted = PR_IntervalNow();
ss->ssl3.hs.rtTimerCb = cb;
return SECSuccess;
}
/* Restart a timer with optional backoff
*
* Called from dtls_RetransmitTimerExpiredCb()
*/
SECStatus
dtls_RestartTimer(sslSocket *ss, PRBool backoff, DTLSTimerCb cb)
{
if (backoff) {
ss->ssl3.hs.rtTimeoutMs *= 2;
if (ss->ssl3.hs.rtTimeoutMs > MAX_DTLS_TIMEOUT_MS)
ss->ssl3.hs.rtTimeoutMs = MAX_DTLS_TIMEOUT_MS;
}
return dtls_StartTimer(ss, cb);
}
/* Cancel a pending timer
*
* Called from:
* dtls_HandleHandshake()
* dtls_CheckTimer()
*/
void
dtls_CancelTimer(sslSocket *ss)
{
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
ss->ssl3.hs.rtTimerCb = NULL;
}
/* Check the pending timer and fire the callback if it expired
*
* Called from ssl3_GatherCompleteHandshake()
*/
void
dtls_CheckTimer(sslSocket *ss)
{
if (!ss->ssl3.hs.rtTimerCb)
return;
if ((PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted) >
PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs)) {
/* Timer has expired */
DTLSTimerCb cb = ss->ssl3.hs.rtTimerCb;
/* Cancel the timer so that we can call the CB safely */
dtls_CancelTimer(ss);
/* Now call the CB */
cb(ss);
}
}
/* The callback to fire when the holddown timer for the Finished
* message expires and we can delete it
*
* Called from dtls_CheckTimer()
*/
void
dtls_FinishedTimerCb(sslSocket *ss)
{
ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_FALSE);
}
/* Cancel the Finished hold-down timer and destroy the
* pending cipher spec. Note that this means that
* successive rehandshakes will fail if the Finished is
* lost.
*
* XXX OK for now. Figure out how to handle the combination
* of Finished lost and rehandshake
*/
void
dtls_RehandshakeCleanup(sslSocket *ss)
{
dtls_CancelTimer(ss);
ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_FALSE);
ss->ssl3.hs.sendMessageSeq = 0;
ss->ssl3.hs.recvMessageSeq = 0;
}
/* Set the MTU to the next step less than or equal to the
* advertised value. Also used to downgrade the MTU by
* doing dtls_SetMTU(ss, biggest packet set).
*
* Passing 0 means set this to the largest MTU known
* (effectively resetting the PMTU backoff value).
*
* Called by:
* ssl3_InitState()
* dtls_RetransmitTimerExpiredCb()
*/
void
dtls_SetMTU(sslSocket *ss, PRUint16 advertised)
{
int i;
if (advertised == 0) {
ss->ssl3.mtu = COMMON_MTU_VALUES[0];
SSL_TRC(30, ("Resetting MTU to %d", ss->ssl3.mtu));
return;
}
for (i = 0; i < PR_ARRAY_SIZE(COMMON_MTU_VALUES); i++) {
if (COMMON_MTU_VALUES[i] <= advertised) {
ss->ssl3.mtu = COMMON_MTU_VALUES[i];
SSL_TRC(30, ("Resetting MTU to %d", ss->ssl3.mtu));
return;
}
}
/* Fallback */
ss->ssl3.mtu = COMMON_MTU_VALUES[PR_ARRAY_SIZE(COMMON_MTU_VALUES)-1];
SSL_TRC(30, ("Resetting MTU to %d", ss->ssl3.mtu));
}
/* Called from ssl3_HandleHandshakeMessage() when it has deciphered a
* DTLS hello_verify_request
* Caller must hold Handshake and RecvBuf locks.
*/
SECStatus
dtls_HandleHelloVerifyRequest(sslSocket *ss, SSL3Opaque *b, PRUint32 length)
{
int errCode = SSL_ERROR_RX_MALFORMED_HELLO_VERIFY_REQUEST;
SECStatus rv;
PRInt32 temp;
SECItem cookie = {siBuffer, NULL, 0};
SSL3AlertDescription desc = illegal_parameter;
SSL_TRC(3, ("%d: SSL3[%d]: handle hello_verify_request handshake",
SSL_GETPID(), ss->fd));
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
if (ss->ssl3.hs.ws != wait_server_hello) {
errCode = SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST;
desc = unexpected_message;
goto alert_loser;
}
/* The version */
temp = ssl3_ConsumeHandshakeNumber(ss, 2, &b, &length);
if (temp < 0) {
goto loser; /* alert has been sent */
}
if (temp != SSL_LIBRARY_VERSION_DTLS_1_0_WIRE &&
temp != SSL_LIBRARY_VERSION_DTLS_1_2_WIRE) {
goto alert_loser;
}
/* The cookie */
rv = ssl3_ConsumeHandshakeVariable(ss, &cookie, 1, &b, &length);
if (rv != SECSuccess) {
goto loser; /* alert has been sent */
}
if (cookie.len > DTLS_COOKIE_BYTES) {
desc = decode_error;
goto alert_loser; /* malformed. */
}
PORT_Memcpy(ss->ssl3.hs.cookie, cookie.data, cookie.len);
ss->ssl3.hs.cookieLen = cookie.len;
ssl_GetXmitBufLock(ss); /*******************************/
/* Now re-send the client hello */
rv = ssl3_SendClientHello(ss, PR_TRUE);
ssl_ReleaseXmitBufLock(ss); /*******************************/
if (rv == SECSuccess)
return rv;
alert_loser:
(void)SSL3_SendAlert(ss, alert_fatal, desc);
loser:
errCode = ssl_MapLowLevelError(errCode);
return SECFailure;
}
/* Initialize the DTLS anti-replay window
*
* Called from:
* ssl3_SetupPendingCipherSpec()
* ssl3_InitCipherSpec()
*/
void
dtls_InitRecvdRecords(DTLSRecvdRecords *records)
{
PORT_Memset(records->data, 0, sizeof(records->data));
records->left = 0;
records->right = DTLS_RECVD_RECORDS_WINDOW - 1;
}
/*
* Has this DTLS record been received? Return values are:
* -1 -- out of range to the left
* 0 -- not received yet
* 1 -- replay
*
* Called from: dtls_HandleRecord()
*/
int
dtls_RecordGetRecvd(DTLSRecvdRecords *records, PRUint64 seq)
{
PRUint64 offset;
/* Out of range to the left */
if (seq < records->left) {
return -1;
}
/* Out of range to the right; since we advance the window on
* receipt, that means that this packet has not been received
* yet */
if (seq > records->right)
return 0;
offset = seq % DTLS_RECVD_RECORDS_WINDOW;
return !!(records->data[offset / 8] & (1 << (offset % 8)));
}
/* Update the DTLS anti-replay window
*
* Called from ssl3_HandleRecord()
*/
void
dtls_RecordSetRecvd(DTLSRecvdRecords *records, PRUint64 seq)
{
PRUint64 offset;
if (seq < records->left)
return;
if (seq > records->right) {
PRUint64 new_left;
PRUint64 new_right;
PRUint64 right;
/* Slide to the right; this is the tricky part
*
* 1. new_top is set to have room for seq, on the
* next byte boundary by setting the right 8
* bits of seq
* 2. new_left is set to compensate.
* 3. Zero all bits between top and new_top. Since
* this is a ring, this zeroes everything as-yet
* unseen. Because we always operate on byte
* boundaries, we can zero one byte at a time
*/
new_right = seq | 0x07;
new_left = (new_right - DTLS_RECVD_RECORDS_WINDOW) + 1;
for (right = records->right + 8; right <= new_right; right += 8) {
offset = right % DTLS_RECVD_RECORDS_WINDOW;
records->data[offset / 8] = 0;
}
records->right = new_right;
records->left = new_left;
}
offset = seq % DTLS_RECVD_RECORDS_WINDOW;
records->data[offset / 8] |= (1 << (offset % 8));
}
SECStatus
DTLS_GetHandshakeTimeout(PRFileDesc *socket, PRIntervalTime *timeout)
{
sslSocket * ss = NULL;
PRIntervalTime elapsed;
PRIntervalTime desired;
ss = ssl_FindSocket(socket);
if (!ss)
return SECFailure;
if (!IS_DTLS(ss))
return SECFailure;
if (!ss->ssl3.hs.rtTimerCb)
return SECFailure;
elapsed = PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted;
desired = PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs);
if (elapsed > desired) {
/* Timer expired */
*timeout = PR_INTERVAL_NO_WAIT;
} else {
*timeout = desired - elapsed;
}
return SECSuccess;
}
| bsd-3-clause |
Wuteyan/VTK | Utilities/vtklibproj4/proj_gnom.c | 27 | 3635 | /*
** libproj -- library of cartographic projections
**
** Copyright (c) 2003, 2006 Gerald I. Evenden
*/
static const char
LIBPROJ_ID[] = "Id";
/*
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#define PROJ_PARMS__ \
double sinph0; \
double cosph0; \
int mode;
#define PROJ_LIB__
#include <lib_proj.h>
PROJ_HEAD(gnom, "Gnomonic") "\n\tAzi, Sph.";
#define EPS10 1.e-10
#define N_POLE 0
#define S_POLE 1
#define EQUIT 2
#define OBLIQ 3
FORWARD(s_forward); /* spheroid */
double coslam, cosphi, sinphi;
sinphi = sin(lp.phi);
cosphi = cos(lp.phi);
coslam = cos(lp.lam);
switch (P->mode) {
case EQUIT:
xy.y = cosphi * coslam;
break;
case OBLIQ:
xy.y = P->sinph0 * sinphi + P->cosph0 * cosphi * coslam;
break;
case S_POLE:
xy.y = - sinphi;
break;
case N_POLE:
xy.y = sinphi;
break;
}
if (xy.y <= EPS10) F_ERROR;
xy.x = (xy.y = 1. / xy.y) * cosphi * sin(lp.lam);
switch (P->mode) {
case EQUIT:
xy.y *= sinphi;
break;
case OBLIQ:
xy.y *= P->cosph0 * sinphi - P->sinph0 * cosphi * coslam;
break;
case N_POLE:
coslam = - coslam;
case S_POLE:
xy.y *= cosphi * coslam;
break;
}
return (xy);
}
INVERSE(s_inverse); /* spheroid */
double rh, cosz, sinz;
rh = hypot(xy.x, xy.y);
sinz = sin(lp.phi = atan(rh));
cosz = sqrt(1. - sinz * sinz);
if (fabs(rh) <= EPS10) {
lp.phi = P->phi0;
lp.lam = 0.;
} else {
switch (P->mode) {
case OBLIQ:
lp.phi = cosz * P->sinph0 + xy.y * sinz * P->cosph0 / rh;
if (fabs(lp.phi) >= 1.)
lp.phi = lp.phi > 0. ? HALFPI : - HALFPI;
else
lp.phi = asin(lp.phi);
xy.y = (cosz - P->sinph0 * sin(lp.phi)) * rh;
xy.x *= sinz * P->cosph0;
break;
case EQUIT:
lp.phi = xy.y * sinz / rh;
if (fabs(lp.phi) >= 1.)
lp.phi = lp.phi > 0. ? HALFPI : - HALFPI;
else
lp.phi = asin(lp.phi);
xy.y = cosz * rh;
xy.x *= sinz;
break;
case S_POLE:
lp.phi -= HALFPI;
break;
case N_POLE:
lp.phi = HALFPI - lp.phi;
xy.y = -xy.y;
break;
}
lp.lam = atan2(xy.x, xy.y);
}
return (lp);
}
FREEUP; if (P) free(P); }
ENTRY0(gnom)
if (fabs(fabs(P->phi0) - HALFPI) < EPS10)
P->mode = P->phi0 < 0. ? S_POLE : N_POLE;
else if (fabs(P->phi0) < EPS10)
P->mode = EQUIT;
else {
P->mode = OBLIQ;
P->sinph0 = sin(P->phi0);
P->cosph0 = cos(P->phi0);
}
P->inv = s_inverse;
P->fwd = s_forward;
P->es = 0.;
ENDENTRY(P)
/*
** Log: proj_gnom.c
** Revision 3.1 2006/01/11 01:38:18 gie
** Initial
**
*/
| bsd-3-clause |
ngpestelos/rubinius | vendor/winpthreads/tests/join3.c | 28 | 2205 | /*
* Test for pthread_join() returning return value from threads.
*
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2005 Pthreads-win32 contributors
*
* Contact Email: rpj@callisto.canberra.edu.au
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* --------------------------------------------------------------------------
*
* Depends on API functions: pthread_create().
*/
#include "test.h"
void *
func(void * arg)
{
sched_yield();
return arg;
}
int
main(int argc, char * argv[])
{
pthread_t id[4];
int i;
intptr_t result = 0;
/* Create a few threads and then exit. */
for (i = 0; i < 4; i++)
{
assert(pthread_create(&id[i], NULL, func, UINT2PTR(i)) == 0);
}
/*
* Let threads exit before we join them.
* We should still retrieve the exit code for the threads.
*/
Sleep(1000);
for (i = 0; i < 4; i++)
{
assert(pthread_join(id[i], (void **) &result) == 0);
assert((int) result == i);
}
/* Success. */
return 0;
}
| bsd-3-clause |
PurityPlus/android_external_skia | src/pipe/SkGPipeRead.cpp | 28 | 29394 |
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBitmapHeap.h"
#include "SkCanvas.h"
#include "SkPaint.h"
#include "SkGPipe.h"
#include "SkGPipePriv.h"
#include "SkReader32.h"
#include "SkStream.h"
#include "SkAnnotation.h"
#include "SkColorFilter.h"
#include "SkDrawLooper.h"
#include "SkImageFilter.h"
#include "SkMaskFilter.h"
#include "SkOrderedReadBuffer.h"
#include "SkPathEffect.h"
#include "SkRasterizer.h"
#include "SkRRect.h"
#include "SkShader.h"
#include "SkTypeface.h"
#include "SkXfermode.h"
static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) {
static const uint8_t gEffectTypesInPaintFlatsOrder[] = {
SkFlattenable::kSkColorFilter_Type,
SkFlattenable::kSkDrawLooper_Type,
SkFlattenable::kSkImageFilter_Type,
SkFlattenable::kSkMaskFilter_Type,
SkFlattenable::kSkPathEffect_Type,
SkFlattenable::kSkRasterizer_Type,
SkFlattenable::kSkShader_Type,
SkFlattenable::kSkXfermode_Type,
};
SkASSERT((size_t)pf < SK_ARRAY_COUNT(gEffectTypesInPaintFlatsOrder));
return (SkFlattenable::Type)gEffectTypesInPaintFlatsOrder[pf];
}
static void set_paintflat(SkPaint* paint, SkFlattenable* obj, unsigned paintFlat) {
SkASSERT(paintFlat < kCount_PaintFlats);
switch (paintFlat) {
case kColorFilter_PaintFlat:
paint->setColorFilter((SkColorFilter*)obj);
break;
case kDrawLooper_PaintFlat:
paint->setLooper((SkDrawLooper*)obj);
break;
case kMaskFilter_PaintFlat:
paint->setMaskFilter((SkMaskFilter*)obj);
break;
case kPathEffect_PaintFlat:
paint->setPathEffect((SkPathEffect*)obj);
break;
case kRasterizer_PaintFlat:
paint->setRasterizer((SkRasterizer*)obj);
break;
case kShader_PaintFlat:
paint->setShader((SkShader*)obj);
break;
case kImageFilter_PaintFlat:
paint->setImageFilter((SkImageFilter*)obj);
break;
case kXfermode_PaintFlat:
paint->setXfermode((SkXfermode*)obj);
break;
default:
SkDEBUGFAIL("never gets here");
}
}
template <typename T> class SkRefCntTDArray : public SkTDArray<T> {
public:
~SkRefCntTDArray() { this->unrefAll(); }
};
class SkGPipeState : public SkBitmapHeapReader {
public:
SkGPipeState();
~SkGPipeState();
void setSilent(bool silent) {
fSilent = silent;
}
bool shouldDraw() {
return !fSilent;
}
void setFlags(unsigned flags) {
if (fFlags != flags) {
fFlags = flags;
this->updateReader();
}
}
unsigned getFlags() const {
return fFlags;
}
void setReader(SkOrderedReadBuffer* reader) {
fReader = reader;
this->updateReader();
}
const SkPaint& paint() const { return fPaint; }
SkPaint* editPaint() { return &fPaint; }
SkFlattenable* getFlat(unsigned index) const {
if (0 == index) {
return NULL;
}
return fFlatArray[index - 1];
}
void defFlattenable(PaintFlats pf, int index) {
index--;
SkFlattenable* obj = fReader->readFlattenable(paintflat_to_flattype(pf));
if (fFlatArray.count() == index) {
*fFlatArray.append() = obj;
} else {
SkSafeUnref(fFlatArray[index]);
fFlatArray[index] = obj;
}
}
void defFactory(const char* name) {
SkFlattenable::Factory factory = SkFlattenable::NameToFactory(name);
if (factory) {
SkASSERT(fFactoryArray.find(factory) < 0);
*fFactoryArray.append() = factory;
}
}
/**
* Add a bitmap to the array of bitmaps, or replace an existing one.
* This is only used when in cross process mode without a shared heap.
*/
void addBitmap(int index) {
SkASSERT(shouldFlattenBitmaps(fFlags));
SkBitmap* bm;
if(fBitmaps.count() == index) {
bm = SkNEW(SkBitmap);
*fBitmaps.append() = bm;
} else {
bm = fBitmaps[index];
}
fReader->readBitmap(bm);
}
/**
* Override of SkBitmapHeapReader, so that SkOrderedReadBuffer can use
* these SkBitmaps for bitmap shaders. Used only in cross process mode
* without a shared heap.
*/
virtual SkBitmap* getBitmap(int32_t index) const SK_OVERRIDE {
SkASSERT(shouldFlattenBitmaps(fFlags));
return fBitmaps[index];
}
/**
* Needed to be a non-abstract subclass of SkBitmapHeapReader.
*/
virtual void releaseRef(int32_t) SK_OVERRIDE {}
void setSharedHeap(SkBitmapHeap* heap) {
SkASSERT(!shouldFlattenBitmaps(fFlags) || NULL == heap);
SkRefCnt_SafeAssign(fSharedHeap, heap);
this->updateReader();
}
/**
* Access the shared heap. Only used in the case when bitmaps are not
* flattened.
*/
SkBitmapHeap* getSharedHeap() const {
SkASSERT(!shouldFlattenBitmaps(fFlags));
return fSharedHeap;
}
void addTypeface() {
size_t size = fReader->read32();
const void* data = fReader->skip(SkAlign4(size));
SkMemoryStream stream(data, size, false);
*fTypefaces.append() = SkTypeface::Deserialize(&stream);
}
void setTypeface(SkPaint* paint, unsigned id) {
paint->setTypeface(id ? fTypefaces[id - 1] : NULL);
}
private:
void updateReader() {
if (NULL == fReader) {
return;
}
bool crossProcess = SkToBool(fFlags & SkGPipeWriter::kCrossProcess_Flag);
fReader->setFlags(SkSetClearMask(fReader->getFlags(), crossProcess,
SkFlattenableReadBuffer::kCrossProcess_Flag));
if (crossProcess) {
fReader->setFactoryArray(&fFactoryArray);
} else {
fReader->setFactoryArray(NULL);
}
if (shouldFlattenBitmaps(fFlags)) {
fReader->setBitmapStorage(this);
} else {
fReader->setBitmapStorage(fSharedHeap);
}
}
SkOrderedReadBuffer* fReader;
SkPaint fPaint;
SkTDArray<SkFlattenable*> fFlatArray;
SkTDArray<SkTypeface*> fTypefaces;
SkTDArray<SkFlattenable::Factory> fFactoryArray;
SkTDArray<SkBitmap*> fBitmaps;
bool fSilent;
// Only used when sharing bitmaps with the writer.
SkBitmapHeap* fSharedHeap;
unsigned fFlags;
};
///////////////////////////////////////////////////////////////////////////////
template <typename T> const T* skip(SkReader32* reader, int count = 1) {
SkASSERT(count >= 0);
size_t size = sizeof(T) * count;
SkASSERT(SkAlign4(size) == size);
return reinterpret_cast<const T*>(reader->skip(size));
}
template <typename T> const T* skipAlign(SkReader32* reader, int count = 1) {
SkASSERT(count >= 0);
size_t size = SkAlign4(sizeof(T) * count);
return reinterpret_cast<const T*>(reader->skip(size));
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
static void clipPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkPath path;
reader->readPath(&path);
bool doAA = SkToBool(DrawOp_unpackFlags(op32) & kClip_HasAntiAlias_DrawOpFlag);
canvas->clipPath(path, (SkRegion::Op)DrawOp_unpackData(op32), doAA);
}
static void clipRegion_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkRegion rgn;
reader->readRegion(&rgn);
canvas->clipRegion(rgn, (SkRegion::Op)DrawOp_unpackData(op32));
}
static void clipRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkRect* rect = skip<SkRect>(reader);
bool doAA = SkToBool(DrawOp_unpackFlags(op32) & kClip_HasAntiAlias_DrawOpFlag);
canvas->clipRect(*rect, (SkRegion::Op)DrawOp_unpackData(op32), doAA);
}
static void clipRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkRRect rrect;
reader->readRRect(&rrect);
bool doAA = SkToBool(DrawOp_unpackFlags(op32) & kClip_HasAntiAlias_DrawOpFlag);
canvas->clipRRect(rrect, (SkRegion::Op)DrawOp_unpackData(op32), doAA);
}
///////////////////////////////////////////////////////////////////////////////
static void setMatrix_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkMatrix matrix;
reader->readMatrix(&matrix);
canvas->setMatrix(matrix);
}
static void concat_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkMatrix matrix;
reader->readMatrix(&matrix);
canvas->concat(matrix);
}
static void scale_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkScalar* param = skip<SkScalar>(reader, 2);
canvas->scale(param[0], param[1]);
}
static void skew_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkScalar* param = skip<SkScalar>(reader, 2);
canvas->skew(param[0], param[1]);
}
static void rotate_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
canvas->rotate(reader->readScalar());
}
static void translate_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkScalar* param = skip<SkScalar>(reader, 2);
canvas->translate(param[0], param[1]);
}
///////////////////////////////////////////////////////////////////////////////
static void save_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
canvas->save((SkCanvas::SaveFlags)DrawOp_unpackData(op32));
}
static void saveLayer_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
unsigned flags = DrawOp_unpackFlags(op32);
SkCanvas::SaveFlags saveFlags = (SkCanvas::SaveFlags)DrawOp_unpackData(op32);
const SkRect* bounds = NULL;
if (flags & kSaveLayer_HasBounds_DrawOpFlag) {
bounds = skip<SkRect>(reader);
}
const SkPaint* paint = NULL;
if (flags & kSaveLayer_HasPaint_DrawOpFlag) {
paint = &state->paint();
}
canvas->saveLayer(bounds, paint, saveFlags);
}
static void restore_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
canvas->restore();
}
///////////////////////////////////////////////////////////////////////////////
static void drawClear_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkColor color = 0;
if (DrawOp_unpackFlags(op32) & kClear_HasColor_DrawOpFlag) {
color = reader->readU32();
}
canvas->clear(color);
}
static void drawPaint_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
if (state->shouldDraw()) {
canvas->drawPaint(state->paint());
}
}
static void drawPoints_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkCanvas::PointMode mode = (SkCanvas::PointMode)DrawOp_unpackFlags(op32);
size_t count = reader->readU32();
const SkPoint* pts = skip<SkPoint>(reader, count);
if (state->shouldDraw()) {
canvas->drawPoints(mode, count, pts, state->paint());
}
}
static void drawOval_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkRect* rect = skip<SkRect>(reader);
if (state->shouldDraw()) {
canvas->drawOval(*rect, state->paint());
}
}
static void drawRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const SkRect* rect = skip<SkRect>(reader);
if (state->shouldDraw()) {
canvas->drawRect(*rect, state->paint());
}
}
static void drawRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkRRect rrect;
reader->readRRect(&rrect);
if (state->shouldDraw()) {
canvas->drawRRect(rrect, state->paint());
}
}
static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkPath path;
reader->readPath(&path);
if (state->shouldDraw()) {
canvas->drawPath(path, state->paint());
}
}
static void drawVertices_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
unsigned flags = DrawOp_unpackFlags(op32);
SkCanvas::VertexMode mode = (SkCanvas::VertexMode)reader->readU32();
int vertexCount = reader->readU32();
const SkPoint* verts = skip<SkPoint>(reader, vertexCount);
const SkPoint* texs = NULL;
if (flags & kDrawVertices_HasTexs_DrawOpFlag) {
texs = skip<SkPoint>(reader, vertexCount);
}
const SkColor* colors = NULL;
if (flags & kDrawVertices_HasColors_DrawOpFlag) {
colors = skip<SkColor>(reader, vertexCount);
}
// TODO: flatten/unflatten xfermodes
SkXfermode* xfer = NULL;
int indexCount = 0;
const uint16_t* indices = NULL;
if (flags & kDrawVertices_HasIndices_DrawOpFlag) {
indexCount = reader->readU32();
indices = skipAlign<uint16_t>(reader, indexCount);
}
if (state->shouldDraw()) {
canvas->drawVertices(mode, vertexCount, verts, texs, colors, xfer,
indices, indexCount, state->paint());
}
}
///////////////////////////////////////////////////////////////////////////////
static void drawText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
size_t len = reader->readU32();
const void* text = reader->skip(SkAlign4(len));
const SkScalar* xy = skip<SkScalar>(reader, 2);
if (state->shouldDraw()) {
canvas->drawText(text, len, xy[0], xy[1], state->paint());
}
}
static void drawPosText_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
size_t len = reader->readU32();
const void* text = reader->skip(SkAlign4(len));
size_t posCount = reader->readU32(); // compute by our writer
const SkPoint* pos = skip<SkPoint>(reader, posCount);
if (state->shouldDraw()) {
canvas->drawPosText(text, len, pos, state->paint());
}
}
static void drawPosTextH_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
size_t len = reader->readU32();
const void* text = reader->skip(SkAlign4(len));
size_t posCount = reader->readU32(); // compute by our writer
const SkScalar* xpos = skip<SkScalar>(reader, posCount);
SkScalar constY = reader->readScalar();
if (state->shouldDraw()) {
canvas->drawPosTextH(text, len, xpos, constY, state->paint());
}
}
static void drawTextOnPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
size_t len = reader->readU32();
const void* text = reader->skip(SkAlign4(len));
SkPath path;
reader->readPath(&path);
SkMatrix matrixStorage;
const SkMatrix* matrix = NULL;
if (DrawOp_unpackFlags(op32) & kDrawTextOnPath_HasMatrix_DrawOpFlag) {
reader->readMatrix(&matrixStorage);
matrix = &matrixStorage;
}
if (state->shouldDraw()) {
canvas->drawTextOnPath(text, len, path, matrix, state->paint());
}
}
///////////////////////////////////////////////////////////////////////////////
class BitmapHolder : SkNoncopyable {
public:
BitmapHolder(SkReader32* reader, uint32_t op32, SkGPipeState* state);
~BitmapHolder() {
if (fHeapEntry != NULL) {
fHeapEntry->releaseRef();
}
}
const SkBitmap* getBitmap() {
return fBitmap;
}
private:
SkBitmapHeapEntry* fHeapEntry;
const SkBitmap* fBitmap;
SkBitmap fBitmapStorage;
};
BitmapHolder::BitmapHolder(SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
const unsigned flags = state->getFlags();
const unsigned index = DrawOp_unpackData(op32);
if (shouldFlattenBitmaps(flags)) {
fHeapEntry = NULL;
fBitmap = state->getBitmap(index);
} else {
SkBitmapHeapEntry* entry = state->getSharedHeap()->getEntry(index);
if (SkToBool(flags & SkGPipeWriter::kSimultaneousReaders_Flag)) {
// Make a shallow copy for thread safety. Each thread will point to the same SkPixelRef,
// which is thread safe.
fBitmapStorage = *entry->getBitmap();
fBitmap = &fBitmapStorage;
// Release the ref on the bitmap now, since we made our own copy.
entry->releaseRef();
fHeapEntry = NULL;
} else {
SkASSERT(!shouldFlattenBitmaps(flags));
SkASSERT(!SkToBool(flags & SkGPipeWriter::kSimultaneousReaders_Flag));
fHeapEntry = entry;
fBitmap = fHeapEntry->getBitmap();
}
}
}
static void drawBitmap_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
BitmapHolder holder(reader, op32, state);
bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag);
SkScalar left = reader->readScalar();
SkScalar top = reader->readScalar();
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawBitmap(*bitmap, left, top, hasPaint ? &state->paint() : NULL);
}
}
static void drawBitmapMatrix_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
BitmapHolder holder(reader, op32, state);
bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag);
SkMatrix matrix;
reader->readMatrix(&matrix);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawBitmapMatrix(*bitmap, matrix,
hasPaint ? &state->paint() : NULL);
}
}
static void drawBitmapNine_rp(SkCanvas* canvas, SkReader32* reader,
uint32_t op32, SkGPipeState* state) {
BitmapHolder holder(reader, op32, state);
bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag);
const SkIRect* center = skip<SkIRect>(reader);
const SkRect* dst = skip<SkRect>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawBitmapNine(*bitmap, *center, *dst,
hasPaint ? &state->paint() : NULL);
}
}
static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader,
uint32_t op32, SkGPipeState* state) {
BitmapHolder holder(reader, op32, state);
unsigned flags = DrawOp_unpackFlags(op32);
bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag);
bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag);
const SkRect* src;
if (hasSrc) {
src = skip<SkRect>(reader);
} else {
src = NULL;
}
SkCanvas::DrawBitmapRectFlags dbmrFlags = SkCanvas::kNone_DrawBitmapRectFlag;
if (flags & kDrawBitmap_Bleed_DrawOpFlag) {
dbmrFlags = (SkCanvas::DrawBitmapRectFlags)(dbmrFlags|SkCanvas::kBleed_DrawBitmapRectFlag);
}
const SkRect* dst = skip<SkRect>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawBitmapRectToRect(*bitmap, src, *dst,
hasPaint ? &state->paint() : NULL, dbmrFlags);
}
}
static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
BitmapHolder holder(reader, op32, state);
bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_DrawOpFlag);
const SkIPoint* point = skip<SkIPoint>(reader);
const SkBitmap* bitmap = holder.getBitmap();
if (state->shouldDraw()) {
canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->paint() : NULL);
}
}
///////////////////////////////////////////////////////////////////////////////
static void drawData_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
// since we don't have a paint, we can use data for our (small) sizes
size_t size = DrawOp_unpackData(op32);
if (0 == size) {
size = reader->readU32();
}
const void* data = reader->skip(SkAlign4(size));
if (state->shouldDraw()) {
canvas->drawData(data, size);
}
}
static void drawPicture_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
UNIMPLEMENTED
}
///////////////////////////////////////////////////////////////////////////////
static void paintOp_rp(SkCanvas*, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
size_t offset = reader->offset();
size_t stop = offset + PaintOp_unpackData(op32);
SkPaint* p = state->editPaint();
do {
uint32_t p32 = reader->readU32();
unsigned op = PaintOp_unpackOp(p32);
unsigned data = PaintOp_unpackData(p32);
// SkDebugf(" read %08X op=%d flags=%d data=%d\n", p32, op, done, data);
switch (op) {
case kReset_PaintOp: p->reset(); break;
case kFlags_PaintOp: p->setFlags(data); break;
case kColor_PaintOp: p->setColor(reader->readU32()); break;
case kStyle_PaintOp: p->setStyle((SkPaint::Style)data); break;
case kJoin_PaintOp: p->setStrokeJoin((SkPaint::Join)data); break;
case kCap_PaintOp: p->setStrokeCap((SkPaint::Cap)data); break;
case kWidth_PaintOp: p->setStrokeWidth(reader->readScalar()); break;
case kMiter_PaintOp: p->setStrokeMiter(reader->readScalar()); break;
case kEncoding_PaintOp:
p->setTextEncoding((SkPaint::TextEncoding)data);
break;
case kHinting_PaintOp: p->setHinting((SkPaint::Hinting)data); break;
case kAlign_PaintOp: p->setTextAlign((SkPaint::Align)data); break;
case kTextSize_PaintOp: p->setTextSize(reader->readScalar()); break;
case kTextScaleX_PaintOp: p->setTextScaleX(reader->readScalar()); break;
case kTextSkewX_PaintOp: p->setTextSkewX(reader->readScalar()); break;
case kFlatIndex_PaintOp: {
PaintFlats pf = (PaintFlats)PaintOp_unpackFlags(p32);
unsigned index = data;
set_paintflat(p, state->getFlat(index), pf);
break;
}
case kTypeface_PaintOp:
SkASSERT(SkToBool(state->getFlags() &
SkGPipeWriter::kCrossProcess_Flag));
state->setTypeface(p, data); break;
default: SkDEBUGFAIL("bad paintop"); return;
}
SkASSERT(reader->offset() <= stop);
} while (reader->offset() < stop);
}
static void typeface_rp(SkCanvas*, SkReader32* reader, uint32_t,
SkGPipeState* state) {
SkASSERT(!SkToBool(state->getFlags() & SkGPipeWriter::kCrossProcess_Flag));
SkPaint* p = state->editPaint();
p->setTypeface(static_cast<SkTypeface*>(reader->readPtr()));
}
static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkPaint* p = state->editPaint();
const size_t size = DrawOp_unpackData(op32);
if (size > 0) {
SkOrderedReadBuffer buffer(reader->skip(size), size);
p->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref();
SkASSERT(buffer.offset() == size);
} else {
p->setAnnotation(NULL);
}
}
///////////////////////////////////////////////////////////////////////////////
static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* state) {
state->addTypeface();
}
static void def_PaintFlat_rp(SkCanvas*, SkReader32*, uint32_t op32,
SkGPipeState* state) {
PaintFlats pf = (PaintFlats)DrawOp_unpackFlags(op32);
unsigned index = DrawOp_unpackData(op32);
state->defFlattenable(pf, index);
}
static void def_Bitmap_rp(SkCanvas*, SkReader32*, uint32_t op32,
SkGPipeState* state) {
unsigned index = DrawOp_unpackData(op32);
state->addBitmap(index);
}
static void def_Factory_rp(SkCanvas*, SkReader32* reader, uint32_t,
SkGPipeState* state) {
state->defFactory(reader->readString());
}
///////////////////////////////////////////////////////////////////////////////
static void skip_rp(SkCanvas*, SkReader32* reader, uint32_t op32, SkGPipeState*) {
size_t bytes = DrawOp_unpackData(op32);
(void)reader->skip(bytes);
}
static void reportFlags_rp(SkCanvas*, SkReader32*, uint32_t op32,
SkGPipeState* state) {
unsigned flags = DrawOp_unpackFlags(op32);
state->setFlags(flags);
}
static void shareBitmapHeap_rp(SkCanvas*, SkReader32* reader, uint32_t,
SkGPipeState* state) {
state->setSharedHeap(static_cast<SkBitmapHeap*>(reader->readPtr()));
}
static void done_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState*) {}
typedef void (*ReadProc)(SkCanvas*, SkReader32*, uint32_t op32, SkGPipeState*);
static const ReadProc gReadTable[] = {
skip_rp,
clipPath_rp,
clipRegion_rp,
clipRect_rp,
clipRRect_rp,
concat_rp,
drawBitmap_rp,
drawBitmapMatrix_rp,
drawBitmapNine_rp,
drawBitmapRect_rp,
drawClear_rp,
drawData_rp,
drawOval_rp,
drawPaint_rp,
drawPath_rp,
drawPicture_rp,
drawPoints_rp,
drawPosText_rp,
drawPosTextH_rp,
drawRect_rp,
drawRRect_rp,
drawSprite_rp,
drawText_rp,
drawTextOnPath_rp,
drawVertices_rp,
restore_rp,
rotate_rp,
save_rp,
saveLayer_rp,
scale_rp,
setMatrix_rp,
skew_rp,
translate_rp,
paintOp_rp,
typeface_rp,
annotation_rp,
def_Typeface_rp,
def_PaintFlat_rp,
def_Bitmap_rp,
def_Factory_rp,
reportFlags_rp,
shareBitmapHeap_rp,
done_rp
};
///////////////////////////////////////////////////////////////////////////////
SkGPipeState::SkGPipeState()
: fReader(0)
, fSilent(false)
, fSharedHeap(NULL)
, fFlags(0) {
}
SkGPipeState::~SkGPipeState() {
fTypefaces.safeUnrefAll();
fFlatArray.safeUnrefAll();
fBitmaps.deleteAll();
SkSafeUnref(fSharedHeap);
}
///////////////////////////////////////////////////////////////////////////////
#include "SkGPipe.h"
SkGPipeReader::SkGPipeReader() {
fCanvas = NULL;
fState = NULL;
fProc = NULL;
}
SkGPipeReader::SkGPipeReader(SkCanvas* target) {
fCanvas = NULL;
this->setCanvas(target);
fState = NULL;
fProc = NULL;
}
void SkGPipeReader::setCanvas(SkCanvas *target) {
SkRefCnt_SafeAssign(fCanvas, target);
}
SkGPipeReader::~SkGPipeReader() {
SkSafeUnref(fCanvas);
delete fState;
}
SkGPipeReader::Status SkGPipeReader::playback(const void* data, size_t length,
uint32_t playbackFlags, size_t* bytesRead) {
if (NULL == fCanvas) {
return kError_Status;
}
if (NULL == fState) {
fState = new SkGPipeState;
}
fState->setSilent(playbackFlags & kSilent_PlaybackFlag);
SkASSERT(SK_ARRAY_COUNT(gReadTable) == (kDone_DrawOp + 1));
const ReadProc* table = gReadTable;
SkOrderedReadBuffer reader(data, length);
reader.setBitmapDecoder(fProc);
SkCanvas* canvas = fCanvas;
Status status = kEOF_Status;
fState->setReader(&reader);
while (!reader.eof()) {
uint32_t op32 = reader.readUInt();
unsigned op = DrawOp_unpackOp(op32);
// SkDEBUGCODE(DrawOps drawOp = (DrawOps)op;)
if (op >= SK_ARRAY_COUNT(gReadTable)) {
SkDebugf("---- bad op during GPipeState::playback\n");
status = kError_Status;
break;
}
if (kDone_DrawOp == op) {
status = kDone_Status;
break;
}
table[op](canvas, reader.getReader32(), op32, fState);
if ((playbackFlags & kReadAtom_PlaybackFlag) &&
(table[op] != paintOp_rp &&
table[op] != def_Typeface_rp &&
table[op] != def_PaintFlat_rp &&
table[op] != def_Bitmap_rp
)) {
status = kReadAtom_Status;
break;
}
}
if (bytesRead) {
*bytesRead = reader.offset();
}
return status;
}
| bsd-3-clause |
hpanderson/OpenBLAS | lapack-netlib/TESTING/EIG/cchkgl.f | 32 | 4956 | *> \brief \b CCHKGL
*
* =========== DOCUMENTATION ===========
*
* Online html documentation available at
* http://www.netlib.org/lapack/explore-html/
*
* Definition:
* ===========
*
* SUBROUTINE CCHKGL( NIN, NOUT )
*
* .. Scalar Arguments ..
* INTEGER NIN, NOUT
* ..
*
*
*> \par Purpose:
* =============
*>
*> \verbatim
*>
*> CCHKGL tests CGGBAL, a routine for balancing a matrix pair (A, B).
*> \endverbatim
*
* Arguments:
* ==========
*
*> \param[in] NIN
*> \verbatim
*> NIN is INTEGER
*> The logical unit number for input. NIN > 0.
*> \endverbatim
*>
*> \param[in] NOUT
*> \verbatim
*> NOUT is INTEGER
*> The logical unit number for output. NOUT > 0.
*> \endverbatim
*
* Authors:
* ========
*
*> \author Univ. of Tennessee
*> \author Univ. of California Berkeley
*> \author Univ. of Colorado Denver
*> \author NAG Ltd.
*
*> \date November 2011
*
*> \ingroup complex_eig
*
* =====================================================================
SUBROUTINE CCHKGL( NIN, NOUT )
*
* -- LAPACK test routine (version 3.4.0) --
* -- LAPACK is a software package provided by Univ. of Tennessee, --
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
* November 2011
*
* .. Scalar Arguments ..
INTEGER NIN, NOUT
* ..
*
* =====================================================================
*
* .. Parameters ..
INTEGER LDA, LDB, LWORK
PARAMETER ( LDA = 20, LDB = 20, LWORK = 6*LDA )
REAL ZERO
PARAMETER ( ZERO = 0.0E+0 )
* ..
* .. Local Scalars ..
INTEGER I, IHI, IHIIN, ILO, ILOIN, INFO, J, KNT, N,
$ NINFO
REAL ANORM, BNORM, EPS, RMAX, VMAX
* ..
* .. Local Arrays ..
INTEGER LMAX( 3 )
REAL LSCALE( LDA ), LSCLIN( LDA ), RSCALE( LDA ),
$ RSCLIN( LDA ), WORK( LWORK )
COMPLEX A( LDA, LDA ), AIN( LDA, LDA ), B( LDB, LDB ),
$ BIN( LDB, LDB )
* ..
* .. External Functions ..
REAL CLANGE, SLAMCH
EXTERNAL CLANGE, SLAMCH
* ..
* .. External Subroutines ..
EXTERNAL CGGBAL
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, MAX
* ..
* .. Executable Statements ..
*
LMAX( 1 ) = 0
LMAX( 2 ) = 0
LMAX( 3 ) = 0
NINFO = 0
KNT = 0
RMAX = ZERO
*
EPS = SLAMCH( 'Precision' )
*
10 CONTINUE
*
READ( NIN, FMT = * )N
IF( N.EQ.0 )
$ GO TO 90
DO 20 I = 1, N
READ( NIN, FMT = * )( A( I, J ), J = 1, N )
20 CONTINUE
*
DO 30 I = 1, N
READ( NIN, FMT = * )( B( I, J ), J = 1, N )
30 CONTINUE
*
READ( NIN, FMT = * )ILOIN, IHIIN
DO 40 I = 1, N
READ( NIN, FMT = * )( AIN( I, J ), J = 1, N )
40 CONTINUE
DO 50 I = 1, N
READ( NIN, FMT = * )( BIN( I, J ), J = 1, N )
50 CONTINUE
*
READ( NIN, FMT = * )( LSCLIN( I ), I = 1, N )
READ( NIN, FMT = * )( RSCLIN( I ), I = 1, N )
*
ANORM = CLANGE( 'M', N, N, A, LDA, WORK )
BNORM = CLANGE( 'M', N, N, B, LDB, WORK )
*
KNT = KNT + 1
*
CALL CGGBAL( 'B', N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE,
$ WORK, INFO )
*
IF( INFO.NE.0 ) THEN
NINFO = NINFO + 1
LMAX( 1 ) = KNT
END IF
*
IF( ILO.NE.ILOIN .OR. IHI.NE.IHIIN ) THEN
NINFO = NINFO + 1
LMAX( 2 ) = KNT
END IF
*
VMAX = ZERO
DO 70 I = 1, N
DO 60 J = 1, N
VMAX = MAX( VMAX, ABS( A( I, J )-AIN( I, J ) ) )
VMAX = MAX( VMAX, ABS( B( I, J )-BIN( I, J ) ) )
60 CONTINUE
70 CONTINUE
*
DO 80 I = 1, N
VMAX = MAX( VMAX, ABS( LSCALE( I )-LSCLIN( I ) ) )
VMAX = MAX( VMAX, ABS( RSCALE( I )-RSCLIN( I ) ) )
80 CONTINUE
*
VMAX = VMAX / ( EPS*MAX( ANORM, BNORM ) )
*
IF( VMAX.GT.RMAX ) THEN
LMAX( 3 ) = KNT
RMAX = VMAX
END IF
*
GO TO 10
*
90 CONTINUE
*
WRITE( NOUT, FMT = 9999 )
9999 FORMAT( ' .. test output of CGGBAL .. ' )
*
WRITE( NOUT, FMT = 9998 )RMAX
9998 FORMAT( ' ratio of largest test error = ', E12.3 )
WRITE( NOUT, FMT = 9997 )LMAX( 1 )
9997 FORMAT( ' example number where info is not zero = ', I4 )
WRITE( NOUT, FMT = 9996 )LMAX( 2 )
9996 FORMAT( ' example number where ILO or IHI is wrong = ', I4 )
WRITE( NOUT, FMT = 9995 )LMAX( 3 )
9995 FORMAT( ' example number having largest error = ', I4 )
WRITE( NOUT, FMT = 9994 )NINFO
9994 FORMAT( ' number of examples where info is not 0 = ', I4 )
WRITE( NOUT, FMT = 9993 )KNT
9993 FORMAT( ' total number of examples tested = ', I4 )
*
RETURN
*
* End of CCHKGL
*
END
| bsd-3-clause |
m15k/mongrel2 | src/request.c | 35 | 14189 | /**
*
* Copyright (c) 2010, Zed A. Shaw and Mongrel2 Project Contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the Mongrel2 Project, Zed A. Shaw, nor the names
* of its contributors may be used to endorse or promote products
* derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#define _XOPEN_SOURCE 1
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include "setting.h"
#include "register.h"
#include "headers.h"
#include "adt/hash.h"
#include "dbg.h"
#include "request.h"
#include "tnetstrings.h"
#include "websocket.h"
int MAX_HEADER_COUNT=0;
int MAX_DUPE_HEADERS=5;
void Request_init()
{
MAX_HEADER_COUNT = Setting_get_int("limits.header_count", 128 * 10);
log_info("MAX limits.header_count=%d", MAX_HEADER_COUNT);
}
static hnode_t *req_alloc_hash(void *notused)
{
(void)notused;
return (hnode_t *)malloc(sizeof(hnode_t));
}
static void req_free_hash(hnode_t *node, void *notused)
{
(void)notused;
bstrListDestroy((struct bstrList *)hnode_get(node));
bdestroy((bstring)hnode_getkey(node));
free(node);
}
static void request_method_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
req->request_method = blk2bstr(at, length);
}
static void fragment_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
req->fragment = blk2bstr(at, length);
}
static void http_version_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
req->version = blk2bstr(at, length);
}
static void header_done_cb(void *data, const char *at, size_t length)
{
(void)at;
(void)length;
Request *req = (Request *)data;
// extract content_len
const char *clen = bdata(Request_get(req, &HTTP_CONTENT_LENGTH));
if(clen) req->parser.content_len = atoi(clen);
// extract host header
req->host = Request_get(req, &HTTP_HOST);
int colon = bstrchr(req->host, ':');
if(req->host) {
req->host_name = colon > 0 ? bHead(req->host, colon) : bstrcpy(req->host);
}
}
static void uri_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
req->uri = blk2bstr(at, length);
}
static void path_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
assert(req->path == NULL && "This should not happen, Tell Zed.");
req->path = blk2bstr(at, length);
}
static void query_string_cb(void *data, const char *at, size_t length)
{
Request *req = (Request *)data;
req->query_string = blk2bstr(at, length);
}
static void header_field_cb(void *data, const char *field, size_t flen,
const char *value, size_t vlen)
{
Request *req = (Request *)data;
if(hash_isfull(req->headers)) {
log_err("Request had more than %d headers allowed by limits.header_count.",
MAX_HEADER_COUNT);
} else {
bstring vstr = blk2bstr(value, vlen);
bstring fstr = blk2bstr(field, flen);
btolower(fstr);
Request_set(req, fstr, vstr, 0);
bdestroy(fstr); // we still own the key
}
}
/**
* The caller owns the key, and this function will duplicate it
* if needed. This function owns the value and will destroy it
* if there's an error.
*/
void Request_set(Request *req, bstring key, bstring val, int replace)
{
hnode_t *n = hash_lookup(req->headers, key);
struct bstrList *val_list = NULL;
int rc = 0;
int i = 0;
if(n == NULL) {
// make a new bstring list to use as our storage
val_list = bstrListCreate();
rc = bstrListAlloc(val_list, MAX_DUPE_HEADERS);
check(rc == BSTR_OK, "Couldn't allocate space for header values.");
val_list->entry[0] = val;
val_list->qty = 1;
hash_alloc_insert(req->headers, bstrcpy(key), val_list);
} else {
val_list = hnode_get(n);
check(val_list != NULL, "Malformed request, missing bstrlist in node. Tell Zed: %s=%s", bdata(key), bdata(val));
if(replace) {
// destroy ALL old ones and put this in their place
for(i = 0; i < val_list->qty; i++) {
bdestroy(val_list->entry[i]);
}
val_list->entry[0] = val;
val_list->qty = 1;
} else {
check(val_list->qty < MAX_DUPE_HEADERS,
"Header %s duplicated more than %d times allowed.",
bdata(key), MAX_DUPE_HEADERS);
val_list->entry[val_list->qty++] = val;
}
}
return;
error:
bdestroy(val);
return;
}
Request *Request_create()
{
Request *req = calloc(sizeof(Request), 1);
check_mem(req);
req->parser.http_field = header_field_cb;
req->parser.request_method = request_method_cb;
req->parser.request_uri = uri_cb;
req->parser.fragment = fragment_cb;
req->parser.request_path = path_cb;
req->parser.query_string = query_string_cb;
req->parser.http_version = http_version_cb;
req->parser.header_done = header_done_cb;
req->headers = hash_create(MAX_HEADER_COUNT, (hash_comp_t)bstrcmp, bstr_hash_fun);
check_mem(req->headers);
hash_set_allocator(req->headers, req_alloc_hash, req_free_hash, NULL);
req->parser.data = req; // for the http callbacks
return req;
error:
Request_destroy(req);
return NULL;
}
static inline void Request_nuke_parts(Request *req)
{
bdestroy(req->request_method); req->request_method = NULL;
bdestroy(req->version); req->version = NULL;
bdestroy(req->uri); req->uri = NULL;
bdestroy(req->path); req->path = NULL;
bdestroy(req->query_string); req->query_string = NULL;
bdestroy(req->fragment); req->fragment = NULL;
bdestroy(req->host_name); req->host_name = NULL;
// not owned by us: host, pattern, prefix
req->pattern = NULL;
req->prefix = NULL;
req->host = NULL;
req->status_code = 0;
req->response_size = 0;
req->parser.json_sent = 0;
req->parser.xml_sent = 0;
req->ws_flags=0;
}
void Request_destroy(Request *req)
{
if(req) {
Request_nuke_parts(req);
hash_free_nodes(req->headers);
hash_destroy(req->headers);
free(req);
}
}
void Request_start(Request *req)
{
assert(req && "NULL pointer error.");
http_parser_init(&(req->parser));
Request_nuke_parts(req);
if(req->headers) {
hash_free_nodes(req->headers);
}
}
int Request_parse(Request *req, char *buf, size_t nread, size_t *out_nparsed)
{
assert(req && "NULL pointer error.");
*out_nparsed = http_parser_execute(&(req->parser), buf, nread, *out_nparsed);
int finished = http_parser_finish(&(req->parser));
return finished;
}
bstring Request_get(Request *req, bstring field)
{
hnode_t *node = hash_lookup(req->headers, field);
struct bstrList *vals = NULL;
if(node == NULL) {
return NULL;
} else {
vals = hnode_get(node);
return vals->entry[0];
}
}
int Request_get_date(Request *req, bstring field, const char *format)
{
struct tm tm_val;
bstring value = Request_get(req, field);
if(value) {
memset(&tm_val, 0, sizeof(struct tm));
if(strptime(bdata(value), format, &tm_val) == NULL) {
return 0;
} else {
return (int)mktime(&tm_val);
}
} else {
return 0;
}
}
static inline bstring json_escape(bstring in)
{
if(in == NULL) return NULL;
// Slightly better than the old solution.
bstring vstr = bstrcpy(in);
int i;
for(i = 0; i < blength(vstr); i++)
{
if(bdata(vstr)[i] == '\\')
{
binsertch(vstr, i, 1, '\\');
i++;
}
else if(bdata(vstr)[i] == '"')
{
binsertch(vstr, i, 1, '\\');
i++;
}
}
return vstr;
}
struct tagbstring JSON_LISTSEP = bsStatic("\",\"");
struct tagbstring JSON_OBJSEP = bsStatic("\":\"");
// This chosen extremely arbitrarily. Certainly needs work.
static const int PAYLOAD_GUESS = 256;
static inline void B(bstring headers, const bstring k, const bstring v)
{
if(v)
{
bcatcstr(headers, ",\"");
bconcat(headers, k);
bconcat(headers, &JSON_OBJSEP);
bstring vstr = json_escape(v);
bconcat(headers, vstr);
bcatcstr(headers, "\"");
bdestroy(vstr);
}
}
static inline bstring request_determine_method(Request *req)
{
if(Request_is_json(req)) {
return &JSON_METHOD;
} else if(Request_is_xml(req)) {
return &XML_METHOD;
} else {
return req->request_method;
}
}
bstring Request_to_tnetstring(Request *req, bstring uuid, int fd, const char *buf, size_t len)
{
tns_outbuf outbuf = {.buffer = NULL};
bstring method = request_determine_method(req);
check(method, "Impossible, got an invalid request method.");
uint32_t id = Register_id_for_fd(fd);
check_debug(id != UINT32_MAX, "Asked to generate a payload for a fd that doesn't exist: %d", fd);
int header_start = tns_render_request_start(&outbuf);
check(header_start != -1, "Failed to initialize outbuf.");
check(tns_render_request_headers(&outbuf, req->headers) == 0,
"Failed to render headers to a tnetstring.");
if(req->path) tns_render_hash_pair(&outbuf, &HTTP_PATH, req->path);
if(req->version) tns_render_hash_pair(&outbuf, &HTTP_VERSION, req->version);
if(req->uri) tns_render_hash_pair(&outbuf, &HTTP_URI, req->uri);
if(req->query_string) tns_render_hash_pair(&outbuf, &HTTP_QUERY, req->query_string);
if(req->fragment) tns_render_hash_pair(&outbuf, &HTTP_FRAGMENT, req->fragment);
if(req->pattern) tns_render_hash_pair(&outbuf, &HTTP_PATTERN, req->pattern);
tns_render_hash_pair(&outbuf, &HTTP_METHOD, method);
check(tns_render_request_end(&outbuf, header_start, uuid, id, Request_path(req)) != -1, "Failed to finalize request.");
// header now owns the outbuf buffer
bstring headers = tns_outbuf_to_bstring(&outbuf);
bformata(headers, "%d:", len);
bcatblk(headers, buf, len);
bconchar(headers, ',');
return headers;
error:
if(outbuf.buffer) free(outbuf.buffer);
return NULL;
}
bstring Request_to_payload(Request *req, bstring uuid, int fd, const char *buf, size_t len)
{
bstring headers = NULL;
bstring result = NULL;
uint32_t id = Register_id_for_fd(fd);
check_debug(id != UINT32_MAX, "Asked to generate a payload for a fd that doesn't exist: %d", fd);
headers = bfromcstralloc(PAYLOAD_GUESS, "{\"");
bconcat(headers, &HTTP_PATH);
bconcat(headers, &JSON_OBJSEP);
bconcat(headers, req->path);
bconchar(headers, '"');
hscan_t scan;
hnode_t *i;
hash_scan_begin(&scan, req->headers);
for(i = hash_scan_next(&scan); i != NULL; i = hash_scan_next(&scan))
{
struct bstrList *val_list = hnode_get(i);
bstring key = (bstring)hnode_getkey(i);
if(val_list->qty > 1)
{
struct bstrList *escaped = bstrListCreate();
bstrListAlloc(escaped, val_list->qty);
escaped->qty = val_list->qty;
int x = 0;
for(x = 0; x < val_list->qty; x++) {
escaped->entry[x] = json_escape(val_list->entry[x]);
}
bstring list = bjoin(escaped, &JSON_LISTSEP);
bcatcstr(headers, ",\"");
bconcat(headers, key);
bcatcstr(headers, "\":[\"");
bconcat(headers, list);
bcatcstr(headers, "\"]");
bdestroy(list);
bstrListDestroy(escaped);
}
else
{
B(headers, key, val_list->entry[0]);
}
}
// these come after so that if anyone attempts to hijack these somehow, most
// hash algorithms languages have will replace the browser ones with ours
if(Request_is_json(req)) {
B(headers, &HTTP_METHOD, &JSON_METHOD);
} else if(Request_is_xml(req)) {
B(headers, &HTTP_METHOD, &XML_METHOD);
} else {
B(headers, &HTTP_METHOD, req->request_method);
}
B(headers, &HTTP_VERSION, req->version);
B(headers, &HTTP_URI, req->uri);
B(headers, &HTTP_QUERY, req->query_string);
B(headers, &HTTP_FRAGMENT, req->fragment);
B(headers, &HTTP_PATTERN, req->pattern);
bconchar(headers, '}');
result = bformat("%s %d %s %d:%s,%d:", bdata(uuid), id,
bdata(Request_path(req)),
blength(headers),
bdata(headers),
len);
bdestroy(headers);
bcatblk(result, buf, len);
bconchar(result, ',');
check(result, "Failed to construct payload result.");
return result;
error:
bdestroy(headers);
bdestroy(result);
return NULL;
}
| bsd-3-clause |
vigna/scipy | scipy/sparse/linalg/_eigen/arpack/ARPACK/SRC/sneigh.f | 36 | 10370 | c-----------------------------------------------------------------------
c\BeginDoc
c
c\Name: sneigh
c
c\Description:
c Compute the eigenvalues of the current upper Hessenberg matrix
c and the corresponding Ritz estimates given the current residual norm.
c
c\Usage:
c call sneigh
c ( RNORM, N, H, LDH, RITZR, RITZI, BOUNDS, Q, LDQ, WORKL, IERR )
c
c\Arguments
c RNORM Real scalar. (INPUT)
c Residual norm corresponding to the current upper Hessenberg
c matrix H.
c
c N Integer. (INPUT)
c Size of the matrix H.
c
c H Real N by N array. (INPUT)
c H contains the current upper Hessenberg matrix.
c
c LDH Integer. (INPUT)
c Leading dimension of H exactly as declared in the calling
c program.
c
c RITZR, Real arrays of length N. (OUTPUT)
c RITZI On output, RITZR(1:N) (resp. RITZI(1:N)) contains the real
c (respectively imaginary) parts of the eigenvalues of H.
c
c BOUNDS Real array of length N. (OUTPUT)
c On output, BOUNDS contains the Ritz estimates associated with
c the eigenvalues RITZR and RITZI. This is equal to RNORM
c times the last components of the eigenvectors corresponding
c to the eigenvalues in RITZR and RITZI.
c
c Q Real N by N array. (WORKSPACE)
c Workspace needed to store the eigenvectors of H.
c
c LDQ Integer. (INPUT)
c Leading dimension of Q exactly as declared in the calling
c program.
c
c WORKL Real work array of length N**2 + 3*N. (WORKSPACE)
c Private (replicated) array on each PE or array allocated on
c the front end. This is needed to keep the full Schur form
c of H and also in the calculation of the eigenvectors of H.
c
c IERR Integer. (OUTPUT)
c Error exit flag from slahqr or strevc.
c
c\EndDoc
c
c-----------------------------------------------------------------------
c
c\BeginLib
c
c\Local variables:
c xxxxxx real
c
c\Routines called:
c slahqr ARPACK routine to compute the real Schur form of an
c upper Hessenberg matrix and last row of the Schur vectors.
c arscnd ARPACK utility routine for timing.
c smout ARPACK utility routine that prints matrices
c svout ARPACK utility routine that prints vectors.
c slacpy LAPACK matrix copy routine.
c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c strevc LAPACK routine to compute the eigenvectors of a matrix
c in upper quasi-triangular form
c sgemv Level 2 BLAS routine for matrix vector multiplication.
c scopy Level 1 BLAS that copies one vector to another .
c snrm2 Level 1 BLAS that computes the norm of a vector.
c sscal Level 1 BLAS that scales a vector.
c
c
c\Author
c Danny Sorensen Phuong Vu
c Richard Lehoucq CRPC / Rice University
c Dept. of Computational & Houston, Texas
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\Revision history:
c xx/xx/92: Version ' 2.1'
c
c\SCCS Information: @(#)
c FILE: neigh.F SID: 2.3 DATE OF SID: 4/20/96 RELEASE: 2
c
c\Remarks
c None
c
c\EndLib
c
c-----------------------------------------------------------------------
c
subroutine sneigh (rnorm, n, h, ldh, ritzr, ritzi, bounds,
& q, ldq, workl, ierr)
c
c %----------------------------------------------------%
c | Include files for debugging and timing information |
c %----------------------------------------------------%
c
include 'debug.h'
include 'stat.h'
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
integer ierr, n, ldh, ldq
Real
& rnorm
c
c %-----------------%
c | Array Arguments |
c %-----------------%
c
Real
& bounds(n), h(ldh,n), q(ldq,n), ritzi(n), ritzr(n),
& workl(n*(n+3))
c
c %------------%
c | Parameters |
c %------------%
c
Real
& one, zero
parameter (one = 1.0E+0, zero = 0.0E+0)
c
c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical select(1)
integer i, iconj, msglvl
Real
& temp, vl(1)
c
c %----------------------%
c | External Subroutines |
c %----------------------%
c
external scopy, slacpy, slahqr, strevc, svout, arscnd
c
c %--------------------%
c | External Functions |
c %--------------------%
c
Real
& slapy2, snrm2
external slapy2, snrm2
c
c %---------------------%
c | Intrinsic Functions |
c %---------------------%
c
intrinsic abs
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %-------------------------------%
c | Initialize timing statistics |
c | & message level for debugging |
c %-------------------------------%
c
call arscnd (t0)
msglvl = mneigh
c
if (msglvl .gt. 2) then
call smout (logfil, n, n, h, ldh, ndigit,
& '_neigh: Entering upper Hessenberg matrix H ')
end if
c
c %-----------------------------------------------------------%
c | 1. Compute the eigenvalues, the last components of the |
c | corresponding Schur vectors and the full Schur form T |
c | of the current upper Hessenberg matrix H. |
c | slahqr returns the full Schur form of H in WORKL(1:N**2) |
c | and the last components of the Schur vectors in BOUNDS. |
c %-----------------------------------------------------------%
c
call slacpy ('All', n, n, h, ldh, workl, n)
do 5 j = 1, n-1
bounds(j) = zero
5 continue
bounds(n) = one
call slahqr(.true., .true., n, 1, n, workl, n, ritzr, ritzi, 1, 1,
& bounds, 1, ierr)
if (ierr .ne. 0) go to 9000
c
if (msglvl .gt. 1) then
call svout (logfil, n, bounds, ndigit,
& '_neigh: last row of the Schur matrix for H')
end if
c
c %-----------------------------------------------------------%
c | 2. Compute the eigenvectors of the full Schur form T and |
c | apply the last components of the Schur vectors to get |
c | the last components of the corresponding eigenvectors. |
c | Remember that if the i-th and (i+1)-st eigenvalues are |
c | complex conjugate pairs, then the real & imaginary part |
c | of the eigenvector components are split across adjacent |
c | columns of Q. |
c %-----------------------------------------------------------%
c
call strevc ('R', 'A', select, n, workl, n, vl, n, q, ldq,
& n, n, workl(n*n+1), ierr)
c
if (ierr .ne. 0) go to 9000
c
c %------------------------------------------------%
c | Scale the returning eigenvectors so that their |
c | euclidean norms are all one. LAPACK subroutine |
c | strevc returns each eigenvector normalized so |
c | that the element of largest magnitude has |
c | magnitude 1; here the magnitude of a complex |
c | number (x,y) is taken to be |x| + |y|. |
c %------------------------------------------------%
c
iconj = 0
do 10 i=1, n
if ( abs( ritzi(i) ) .le. zero ) then
c
c %----------------------%
c | Real eigenvalue case |
c %----------------------%
c
temp = snrm2( n, q(1,i), 1 )
call sscal ( n, one / temp, q(1,i), 1 )
else
c
c %-------------------------------------------%
c | Complex conjugate pair case. Note that |
c | since the real and imaginary part of |
c | the eigenvector are stored in consecutive |
c | columns, we further normalize by the |
c | square root of two. |
c %-------------------------------------------%
c
if (iconj .eq. 0) then
temp = slapy2( snrm2( n, q(1,i), 1 ),
& snrm2( n, q(1,i+1), 1 ) )
call sscal ( n, one / temp, q(1,i), 1 )
call sscal ( n, one / temp, q(1,i+1), 1 )
iconj = 1
else
iconj = 0
end if
end if
10 continue
c
call sgemv ('T', n, n, one, q, ldq, bounds, 1, zero, workl, 1)
c
if (msglvl .gt. 1) then
call svout (logfil, n, workl, ndigit,
& '_neigh: Last row of the eigenvector matrix for H')
end if
c
c %----------------------------%
c | Compute the Ritz estimates |
c %----------------------------%
c
iconj = 0
do 20 i = 1, n
if ( abs( ritzi(i) ) .le. zero ) then
c
c %----------------------%
c | Real eigenvalue case |
c %----------------------%
c
bounds(i) = rnorm * abs( workl(i) )
else
c
c %-------------------------------------------%
c | Complex conjugate pair case. Note that |
c | since the real and imaginary part of |
c | the eigenvector are stored in consecutive |
c | columns, we need to take the magnitude |
c | of the last components of the two vectors |
c %-------------------------------------------%
c
if (iconj .eq. 0) then
bounds(i) = rnorm * slapy2( workl(i), workl(i+1) )
bounds(i+1) = bounds(i)
iconj = 1
else
iconj = 0
end if
end if
20 continue
c
if (msglvl .gt. 2) then
call svout (logfil, n, ritzr, ndigit,
& '_neigh: Real part of the eigenvalues of H')
call svout (logfil, n, ritzi, ndigit,
& '_neigh: Imaginary part of the eigenvalues of H')
call svout (logfil, n, bounds, ndigit,
& '_neigh: Ritz estimates for the eigenvalues of H')
end if
c
call arscnd (t1)
tneigh = tneigh + (t1 - t0)
c
9000 continue
return
c
c %---------------%
c | End of sneigh |
c %---------------%
c
end
| bsd-3-clause |
DARKPOP/external_chromium_org_third_party_WebKit | Source/core/html/forms/MonthInputType.cpp | 38 | 5789 | /*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "core/html/forms/MonthInputType.h"
#include "core/HTMLNames.h"
#include "core/InputTypeNames.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/forms/DateTimeFieldsState.h"
#include "platform/DateComponents.h"
#include "platform/text/PlatformLocale.h"
#include "wtf/CurrentTime.h"
#include "wtf/DateMath.h"
#include "wtf/MathExtras.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/text/WTFString.h"
namespace blink {
using namespace HTMLNames;
static const int monthDefaultStep = 1;
static const int monthDefaultStepBase = 0;
static const int monthStepScaleFactor = 1;
PassRefPtrWillBeRawPtr<InputType> MonthInputType::create(HTMLInputElement& element)
{
return adoptRefWillBeNoop(new MonthInputType(element));
}
void MonthInputType::countUsage()
{
countUsageIfVisible(UseCounter::InputTypeMonth);
}
const AtomicString& MonthInputType::formControlType() const
{
return InputTypeNames::month;
}
double MonthInputType::valueAsDate() const
{
DateComponents date;
if (!parseToDateComponents(element().value(), &date))
return DateComponents::invalidMilliseconds();
double msec = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(msec));
return msec;
}
String MonthInputType::serializeWithMilliseconds(double value) const
{
DateComponents date;
if (!date.setMillisecondsSinceEpochForMonth(value))
return String();
return serializeWithComponents(date);
}
Decimal MonthInputType::defaultValueForStepUp() const
{
DateComponents date;
date.setMillisecondsSinceEpochForMonth(convertToLocalTime(currentTimeMS()));
double months = date.monthsSinceEpoch();
ASSERT(std::isfinite(months));
return Decimal::fromDouble(months);
}
StepRange MonthInputType::createStepRange(AnyStepHandling anyStepHandling) const
{
DEFINE_STATIC_LOCAL(const StepRange::StepDescription, stepDescription, (monthDefaultStep, monthDefaultStepBase, monthStepScaleFactor, StepRange::ParsedStepValueShouldBeInteger));
return InputType::createStepRange(anyStepHandling, Decimal::fromDouble(monthDefaultStepBase), Decimal::fromDouble(DateComponents::minimumMonth()), Decimal::fromDouble(DateComponents::maximumMonth()), stepDescription);
}
Decimal MonthInputType::parseToNumber(const String& src, const Decimal& defaultValue) const
{
DateComponents date;
if (!parseToDateComponents(src, &date))
return defaultValue;
double months = date.monthsSinceEpoch();
ASSERT(std::isfinite(months));
return Decimal::fromDouble(months);
}
bool MonthInputType::parseToDateComponentsInternal(const String& string, DateComponents* out) const
{
ASSERT(out);
unsigned end;
return out->parseMonth(string, 0, end) && end == string.length();
}
bool MonthInputType::setMillisecondToDateComponents(double value, DateComponents* date) const
{
ASSERT(date);
return date->setMonthsSinceEpoch(value);
}
bool MonthInputType::canSetSuggestedValue()
{
return true;
}
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
String MonthInputType::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
{
if (!dateTimeFieldsState.hasMonth() || !dateTimeFieldsState.hasYear())
return emptyString();
return String::format("%04u-%02u", dateTimeFieldsState.year(), dateTimeFieldsState.month());
}
void MonthInputType::setupLayoutParameters(DateTimeEditElement::LayoutParameters& layoutParameters, const DateComponents& date) const
{
layoutParameters.dateTimeFormat = layoutParameters.locale.monthFormat();
layoutParameters.fallbackDateTimeFormat = "yyyy-MM";
if (!parseToDateComponents(element().fastGetAttribute(minAttr), &layoutParameters.minimum))
layoutParameters.minimum = DateComponents();
if (!parseToDateComponents(element().fastGetAttribute(maxAttr), &layoutParameters.maximum))
layoutParameters.maximum = DateComponents();
layoutParameters.placeholderForMonth = "--";
layoutParameters.placeholderForYear = "----";
}
bool MonthInputType::isValidFormat(bool hasYear, bool hasMonth, bool hasWeek, bool hasDay, bool hasAMPM, bool hasHour, bool hasMinute, bool hasSecond) const
{
return hasYear && hasMonth;
}
#endif
} // namespace blink
| bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.