text
stringlengths 5
1.04M
|
|---|
// ObjectWindows Library
//
// 1998 Yura Bidus
//
//
#include <owlext/pch.h>
#pragma hdrstop
#ifdef _DLL
// The following symbol used to force inclusion of this module for _OCFDLL
#if defined(_M_IX86) || defined(_MAC)
extern "C" { int _afxForceSTDAFX; }
#else
extern "C" { int __afxForceSTDAFX; }
#endif
#endif
|
#pragma once
#include "drape/pointers.hpp"
#include "drape/texture.hpp"
#include "drape/glyph_manager.hpp"
#include "drape/dynamic_texture.hpp"
#include "std/atomic.hpp"
#include "std/condition_variable.hpp"
#include "std/list.hpp"
#include "std/map.hpp"
#include "std/vector.hpp"
#include "std/string.hpp"
#include "std/thread.hpp"
namespace dp
{
class GlyphPacker
{
public:
GlyphPacker(m2::PointU const & size);
bool PackGlyph(uint32_t width, uint32_t height, m2::RectU & rect);
bool CanBePacked(uint32_t glyphsCount, uint32_t width, uint32_t height) const;
m2::RectF MapTextureCoords(m2::RectU const & pixelRect) const;
bool IsFull() const;
private:
m2::PointU m_size = m2::PointU(0, 0);
m2::PointU m_cursor = m2::PointU(0, 0);
uint32_t m_yStep = 0;
bool m_isFull = false;
};
class GlyphKey : public Texture::Key
{
public:
GlyphKey(strings::UniChar unicodePoint, int fixedSize)
: m_unicodePoint(unicodePoint)
, m_fixedSize(fixedSize)
{}
Texture::ResourceType GetType() const { return Texture::Glyph; }
strings::UniChar GetUnicodePoint() const { return m_unicodePoint; }
int GetFixedSize() const { return m_fixedSize; }
bool operator<(GlyphKey const & g) const
{
if (m_unicodePoint == g.m_unicodePoint)
return m_fixedSize < g.m_fixedSize;
return m_unicodePoint < g.m_unicodePoint;
}
private:
strings::UniChar m_unicodePoint;
int m_fixedSize;
};
class GlyphInfo : public Texture::ResourceInfo
{
typedef Texture::ResourceInfo TBase;
public:
GlyphInfo(m2::RectF const & texRect, GlyphManager::GlyphMetrics const & metrics)
: TBase(texRect)
, m_metrics(metrics)
{}
virtual Texture::ResourceType GetType() const { return Texture::Glyph; }
GlyphManager::GlyphMetrics const & GetMetrics() const { return m_metrics; }
private:
GlyphManager::GlyphMetrics m_metrics;
};
class GlyphGenerator
{
public:
using TCompletionHandler = function<void(m2::RectU const &, GlyphManager::Glyph const &)>;
struct GlyphGenerationData
{
m2::RectU m_rect;
GlyphManager::Glyph m_glyph;
GlyphGenerationData(m2::RectU const & rect, GlyphManager::Glyph const & glyph)
: m_rect(rect), m_glyph(glyph)
{}
};
GlyphGenerator(ref_ptr<GlyphManager> mng, TCompletionHandler const & completionHandler);
~GlyphGenerator();
void GenerateGlyph(m2::RectU const & rect, GlyphManager::Glyph const & glyph);
bool IsSuspended() const;
private:
static void Routine(GlyphGenerator * generator);
void WaitForGlyph(list<GlyphGenerationData> & queue);
ref_ptr<GlyphManager> m_mng;
TCompletionHandler m_completionHandler;
list<GlyphGenerationData> m_queue;
mutable mutex m_queueLock;
atomic<bool> m_isRunning;
condition_variable m_condition;
bool m_isSuspended;
thread m_thread;
};
class GlyphIndex
{
public:
GlyphIndex(m2::PointU size, ref_ptr<GlyphManager> mng);
~GlyphIndex();
// This function can return nullptr.
ref_ptr<Texture::ResourceInfo> MapResource(GlyphKey const & key, bool & newResource);
void UploadResources(ref_ptr<Texture> texture);
bool CanBeGlyphPacked(uint32_t glyphsCount) const;
bool HasAsyncRoutines() const;
uint32_t GetAbsentGlyphsCount(strings::UniString const & text, int fixedHeight) const;
// ONLY for unit-tests. DO NOT use this function anywhere else.
size_t GetPendingNodesCount();
private:
void OnGlyphGenerationCompletion(m2::RectU const & rect, GlyphManager::Glyph const & glyph);
GlyphPacker m_packer;
ref_ptr<GlyphManager> m_mng;
unique_ptr<GlyphGenerator> m_generator;
typedef map<GlyphKey, GlyphInfo> TResourceMapping;
typedef pair<m2::RectU, GlyphManager::Glyph> TPendingNode;
typedef vector<TPendingNode> TPendingNodes;
TResourceMapping m_index;
TPendingNodes m_pendingNodes;
threads::Mutex m_lock;
};
class FontTexture : public DynamicTexture<GlyphIndex, GlyphKey, Texture::Glyph>
{
typedef DynamicTexture<GlyphIndex, GlyphKey, Texture::Glyph> TBase;
public:
FontTexture(m2::PointU const & size, ref_ptr<GlyphManager> glyphMng, ref_ptr<HWTextureAllocator> allocator)
: m_index(size, glyphMng)
{
TBase::TextureParams params;
params.m_size = size;
params.m_format = TextureFormat::ALPHA;
params.m_filter = gl_const::GLLinear;
vector<uint8_t> initData(params.m_size.x * params.m_size.y, 0);
TBase::Init(allocator, make_ref(&m_index), params, make_ref(initData.data()));
}
~FontTexture() { TBase::Reset(); }
bool HasEnoughSpace(uint32_t newKeysCount) const override
{
return m_index.CanBeGlyphPacked(newKeysCount);
}
bool HasAsyncRoutines() const override
{
return m_index.HasAsyncRoutines();
}
uint32_t GetAbsentGlyphsCount(strings::UniString const & text, int fixedHeight) const
{
return m_index.GetAbsentGlyphsCount(text, fixedHeight);
}
private:
GlyphIndex m_index;
};
}
|
#include "propertiesview.h"
#ifdef QT_GUI_LIB
#include <QSortFilterProxyModel>
#include <QHeaderView>
#include <QProcess>
#include <QAction>
#include <QMouseEvent>
#include <SharedModule/External/utils.h>
#include "PropertiesModule/propertiessystem.h"
#include "propertiesmodel.h"
#include "SharedGuiModule/decl.h"
#include "Widgets/propertiesdelegate.h"
#include "propertiesscope.h"
PropertiesView::PropertiesView(QWidget* parent, Qt::WindowFlags flags)
: PropertiesView(PropertiesSystem::GetCurrentScope()->GetName(), parent, flags)
{
}
PropertiesView::PropertiesView(const PropertiesScopeName& scope, QWidget* parent, Qt::WindowFlags flags)
: Super(parent)
, m_defaultTextEditor("Common/TextEditor", PropertiesSystem::Global)
{
setWindowFlags(windowFlags() | flags);
setItemDelegate(new PropertiesDelegate(this));
setRootIsDecorated(false);
setUniformRowHeights(true);
header()->hide();
setIndentation(10);
setAnimated(true);
setSortingEnabled(true);
sortByColumn(0, Qt::AscendingOrder);
m_propertiesModel = new PropertiesModel(scope, this);
QSortFilterProxyModel* proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(m_propertiesModel);
setModel(proxy);
header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
m_actionOpenWithTextEditor = createAction(tr("Open with text editor"), [this](){
QString openFile = m_indexUnderCursor.data().toString();
QStringList arguments { openFile };
QProcess *process = new QProcess(this);
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
process->start(m_defaultTextEditor, arguments);
qCWarning(LC_SYSTEM) << "Opening" << m_defaultTextEditor << arguments;
});
addAction(m_actionOpenWithTextEditor);
setContextMenuPolicy(Qt::ActionsContextMenu);
}
void PropertiesView::Update(const FAction& action)
{
m_propertiesModel->Change(action);
}
void PropertiesView::SetContextIndex(const Name& contextIndex)
{
m_propertiesModel->Scope = contextIndex;
}
const Name& PropertiesView::GetContextIndex() const
{
return m_propertiesModel->Scope;
}
void PropertiesView::Save(const QString& fileName)
{
m_propertiesModel->Save(fileName);
}
void PropertiesView::Load(const QString& fileName)
{
m_propertiesModel->Load(fileName);
}
void PropertiesView::showEvent(QShowEvent*)
{
if(!model()->rowCount()) {
m_propertiesModel->Change([]{});
}
}
void PropertiesView::mouseReleaseEvent(QMouseEvent* event)
{
if(event->button() == Qt::RightButton) {
m_indexUnderCursor = this->indexAt(event->pos());
validateActionsVisiblity();
}
QAbstractItemView::State preState = state();
QTreeView::mouseReleaseEvent(event);
if (preState == QAbstractItemView::AnimatingState)
setState(preState);
}
void PropertiesView::validateActionsVisiblity()
{
if(m_defaultTextEditor.IsValid() && m_indexUnderCursor.data(Property::RoleDelegateValue).toInt() == Property::DelegateFileName) {
m_actionOpenWithTextEditor->setVisible(true);
}
else {
m_actionOpenWithTextEditor->setVisible(false);
}
}
#endif
|
/**********************************************************************
* Copyright (c) 2008-2014, Alliance for Sustainable Energy.
* All rights reserved.
*
* 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 Street, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
#include "MainWindow.hpp"
#include "HorizontalTabWidget.hpp"
#include "LibraryTabWidget.hpp"
#include "LoopLibraryDialog.hpp"
#include "MainMenu.hpp"
#include "MainTabView.hpp"
#include "VerticalTabWidget.hpp"
#include "../utilities/core/Assert.hpp"
#include "../shared_gui_components/NetworkProxyDialog.hpp"
#include <QAction>
#include <QApplication>
#include <QCloseEvent>
#include <QColumnView>
#include <QComboBox>
#include <QFileDialog>
#include <QFrame>
#include <QGraphicsView>
#include <QListWidget>
#include <QMenuBar>
#include <QMimeData>
#include <QScrollArea>
#include <QSettings>
#include <QSizePolicy>
#include <QSplitter>
#include <QStackedWidget>
#include <QStatusBar>
#include <QUrl>
#include <QVBoxLayout>
#include <QWidget>
#include <QMessageBox>
namespace openstudio {
MainWindow::MainWindow(bool isPlugin, QWidget *parent) :
QMainWindow(parent),
m_isPlugin(isPlugin),
m_displayIP(true)
{
setMinimumSize(900,658);
setAcceptDrops(true);
readSettings();
this->statusBar()->show();
#ifdef Q_OS_LINUX
QIcon icon = QIcon(":/images/os_16.png");
icon.addPixmap(QPixmap(":/images/os_32.png"));
icon.addPixmap(QPixmap(":/images/os_48.png"));
icon.addPixmap(QPixmap(":/images/os_64.png"));
icon.addPixmap(QPixmap(":/images/os_128.png"));
icon.addPixmap(QPixmap(":/images/os_256.png"));
setWindowIcon(icon);
#endif
setObjectName("MainWindow");
setStyleSheet("QWidget#MainWindow { background-color: #2C3233; }");
m_mainSplitter = new QSplitter(Qt::Horizontal);
m_verticalTabWidget = new VerticalTabWidget();
connect(m_verticalTabWidget, &VerticalTabWidget::tabSelected, this, &MainWindow::verticalTabSelected);
m_mainSplitter->addWidget(m_verticalTabWidget);
m_mainRightColumnContainer = new QStackedWidget();
m_mainRightColumnContainer->setMinimumWidth(235);
m_mainSplitter->addWidget(m_mainRightColumnContainer);
m_mainSplitter->setStretchFactor(0,10000);
setCentralWidget(m_mainSplitter);
MainMenu * mainMenu = new MainMenu(m_displayIP, m_isPlugin);
connect(mainMenu, &MainMenu::toggleUnitsClicked, this, &MainWindow::toggleUnits);
connect(mainMenu, &MainMenu::downloadComponentsClicked, this, &MainWindow::downloadComponentsClicked);
connect(mainMenu, &MainMenu::openLibDlgClicked, this, &MainWindow::openLibDlgClicked);
this->setMenuBar(mainMenu);
connect(mainMenu, &MainMenu::exportClicked, this, &MainWindow::exportClicked);
connect(mainMenu, &MainMenu::exportgbXMLClicked, this, &MainWindow::exportgbXMLClicked);
connect(mainMenu, &MainMenu::exportSDDClicked, this, &MainWindow::exportSDDClicked);
connect(mainMenu, &MainMenu::importClicked, this, &MainWindow::importClicked);
connect(mainMenu, &MainMenu::importgbXMLClicked, this, &MainWindow::importgbXMLClicked);
connect(mainMenu, &MainMenu::importSDDClicked, this, &MainWindow::importSDDClicked);
connect(mainMenu, &MainMenu::importIFCClicked, this, &MainWindow::importIFCClicked);
connect(mainMenu, &MainMenu::loadFileClicked, this, &MainWindow::loadFileClicked);
connect(mainMenu, &MainMenu::loadLibraryClicked, this, &MainWindow::loadLibraryClicked);
connect(mainMenu, &MainMenu::saveAsFileClicked, this, &MainWindow::saveAsFileClicked);
connect(mainMenu, &MainMenu::saveFileClicked, this, &MainWindow::saveFileClicked);
connect(mainMenu, &MainMenu::revertFileClicked, this, &MainWindow::revertFileClicked);
connect(mainMenu, &MainMenu::newClicked, this, &MainWindow::newClicked);
connect(mainMenu, &MainMenu::exitClicked, this, &MainWindow::exitClicked);
connect(mainMenu, &MainMenu::helpClicked, this, &MainWindow::helpClicked);
connect(mainMenu, &MainMenu::aboutClicked, this, &MainWindow::aboutClicked);
connect(mainMenu, &MainMenu::scanForToolsClicked, this, &MainWindow::scanForToolsClicked);
connect(mainMenu, &MainMenu::showRunManagerPreferencesClicked, this, &MainWindow::showRunManagerPreferencesClicked);
connect(mainMenu, &MainMenu::showRubyConsoleClicked, this, &MainWindow::showRubyConsoleClicked);
connect(mainMenu, &MainMenu::toggleUnitsClicked, this, &MainWindow::toggleUnitsClicked);
connect(mainMenu, &MainMenu::changeMyMeasuresDir, this, &MainWindow::changeMyMeasuresDir);
connect(mainMenu, &MainMenu::applyMeasureClicked, this, &MainWindow::applyMeasureClicked);
connect(mainMenu, &MainMenu::downloadMeasuresClicked, this, &MainWindow::downloadMeasuresClicked);
connect(mainMenu, &MainMenu::changeBclLogin, this, &MainWindow::changeBclLogin);
connect(mainMenu, &MainMenu::configureProxyClicked, this, &MainWindow::configureProxyClicked);
connect(this, &MainWindow::enableRevertToSaved, mainMenu, &MainMenu::enableRevertToSavedAction);
}
QSize MainWindow::sizeHint() const
{
return QSize(1024,700);
}
void MainWindow::setMainRightColumnView(QWidget * widget)
{
if( QWidget * oldwidget = m_mainRightColumnContainer->currentWidget() )
{
m_mainRightColumnContainer->removeWidget(oldwidget);
}
m_mainRightColumnContainer->addWidget(widget);
}
void MainWindow::closeEvent(QCloseEvent *event)
{
event->ignore();
writeSettings();
emit closeClicked();
}
void MainWindow::dragEnterEvent(QDragEnterEvent * event)
{
if(event->mimeData()->hasUrls())
{
event->ignore();
/*QUrl url = event->mimeData()->urls().first();
if (url.scheme().compare("file", Qt::CaseInsensitive) == 0 && url.toString().toLower().endsWith(".osm"))
{
//event->accept();
event->ignore();
}
else
{
event->ignore();
}*/
}
}
void MainWindow::dropEvent(QDropEvent * event)
{
if(event->mimeData()->hasUrls())
{
emit osmDropped(event->mimeData()->urls().first().toLocalFile());
}
}
void MainWindow::addVerticalTab( QWidget * widget,
int id,
QString toolTip,
const QString & selectedImagePath,
const QString & unSelectedImagePath )
{
m_verticalTabWidget->addTab(widget,id,toolTip,selectedImagePath,unSelectedImagePath);
}
void MainWindow::deleteAllVerticalTabs()
{
m_verticalTabWidget->deleteAllTabs();
}
//void MainWindow::addHorizontalTab( QWidget * widget,
// int id,
// const QString & label )
//{
// m_horizontalTabWidget->addTab(widget,id,label);
//}
void MainWindow::selectVerticalTab(int id)
{
m_verticalTabWidget->setCurrentId(id);
}
void MainWindow::selectVerticalTabByIndex(int index)
{
m_verticalTabWidget->setCurrentIndex(index);
}
MainTabView* MainWindow::verticalTabByIndex(int index)
{
MainTabView* mainTabView = qobject_cast<MainTabView *>(m_verticalTabWidget->verticalTabWidgetByIndex(index));
return mainTabView;
}
int MainWindow::verticalTabIndex()
{
return m_verticalTabWidget->verticalTabIndex();
}
//void MainWindow::selectHorizontalTab(int id)
//{
// m_horizontalTabWidget->setCurrentId(id);
//}
void MainWindow::closeSidebar()
{
QList<int> sizeList;
sizeList.push_back(1);
sizeList.push_back(0);
m_mainSplitter->setSizes(sizeList);
}
void MainWindow::openSidebar()
{
QList<int> sizeList;
sizeList.push_back(2);
sizeList.push_back(1);
m_mainSplitter->setSizes(sizeList);
}
bool MainWindow::displayIP()
{
return m_displayIP;
}
void MainWindow::enableRevertToSavedAction(bool enable)
{
emit enableRevertToSaved(enable);
}
void MainWindow::readSettings()
{
QString organizationName = QCoreApplication::organizationName();
QString applicationName = QCoreApplication::applicationName();
QSettings settings(organizationName, applicationName);
QPoint pos = settings.value("pos", QPoint(200, 200)).toPoint();
QSize size = settings.value("size", QSize(600, 400)).toSize();
m_lastPath = settings.value("lastPath", QDir::homePath()).toString();
resize(size);
move(pos);
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("state").toByteArray());
m_displayIP = settings.value("displayIP").toBool();
}
void MainWindow::writeSettings()
{
QString organizationName = QCoreApplication::organizationName();
QString applicationName = QCoreApplication::applicationName();
QSettings settings(organizationName, applicationName);
settings.setValue("pos", pos());
settings.setValue("size", size());
settings.setValue("geometry", saveGeometry());
settings.setValue("state", saveState());
settings.setValue("displayIP", m_displayIP);
}
QString MainWindow::lastPath() const
{
return QDir().exists(m_lastPath) ? m_lastPath : QDir::homePath();
}
void MainWindow::toggleUnits(bool displayIP)
{
m_displayIP = displayIP;
}
void MainWindow::configureProxyClicked()
{
QString organizationName = QCoreApplication::organizationName();
QString applicationName = QCoreApplication::applicationName();
QSettings settings(organizationName, applicationName);
NetworkProxyDialog dialog(settings, this);
QDialog::DialogCode result = static_cast<QDialog::DialogCode>(dialog.exec());
if (result == QDialog::Accepted)
{
QNetworkProxy proxy = dialog.createProxy();
if (proxy.type() != QNetworkProxy::NoProxy)
{
if (dialog.testProxy(proxy))
{
QNetworkProxy::setApplicationProxy(proxy);
//setRubyProxyEnvironment(proxy);
} else {
QMessageBox::critical(this, "Proxy Configuration Error", "There is an error in your proxy configuration.");
}
}
}
}
void MainWindow::loadProxySettings()
{
QString organizationName = QCoreApplication::organizationName();
QString applicationName = QCoreApplication::applicationName();
QSettings settings(organizationName, applicationName);
QNetworkProxy proxy = NetworkProxyDialog::createProxy(settings);
if (proxy.type() != QNetworkProxy::NoProxy)
{
if (NetworkProxyDialog::testProxy(proxy, this))
{
QNetworkProxy::setApplicationProxy(proxy);
//setRubyProxyEnvironment(proxy);
} else {
QMessageBox::critical(this, "Proxy Configuration Error", "There is an error in your proxy configuration.");
configureProxyClicked();
}
}
}
} // openstudio
|
/*=========================================================================
Program: Visualization Toolkit
Module: TestOSPRayAMRVolumeRenderer.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// This test checks if OSPRay based AMR Volume rendering works
#include "vtkAMRGaussianPulseSource.h"
#include "vtkAMRVolumeMapper.h"
#include "vtkCamera.h"
#include "vtkColorTransferFunction.h"
#include "vtkNew.h"
#include "vtkOSPRayPass.h"
#include "vtkOverlappingAMR.h"
#include "vtkPiecewiseFunction.h"
#include "vtkRegressionTestImage.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
#include "vtkTestUtilities.h"
#include "vtkVolumeProperty.h"
int TestOSPRayAMRVolumeRenderer(int argc, char* argv[])
{
bool useOSP = true;
for (int i = 0; i < argc; i++)
{
if (!strcmp(argv[i], "-GL"))
{
cerr << "GL" << endl;
useOSP = false;
}
}
double scalarRange[2] = { 4.849e-23, 0.4145 };
vtkNew<vtkAMRVolumeMapper> volumeMapper;
vtkNew<vtkAMRGaussianPulseSource> amrSource;
amrSource->SetXPulseOrigin(0);
amrSource->SetYPulseOrigin(0);
amrSource->SetZPulseOrigin(0);
amrSource->SetXPulseWidth(.5);
amrSource->SetYPulseWidth(.5);
amrSource->SetZPulseWidth(.5);
amrSource->SetPulseAmplitude(0.5);
amrSource->SetDimension(3);
amrSource->SetRootSpacing(0.5);
amrSource->SetRefinementRatio(2);
amrSource->Update();
volumeMapper->SetInputConnection(amrSource->GetOutputPort());
volumeMapper->SelectScalarArray("Gaussian-Pulse");
volumeMapper->SetScalarMode(VTK_SCALAR_MODE_USE_POINT_FIELD_DATA);
vtkNew<vtkRenderWindow> renWin;
renWin->SetMultiSamples(0);
vtkNew<vtkRenderer> ren;
renWin->AddRenderer(ren.GetPointer());
ren->SetBackground(0.2, 0.2, 0.5);
renWin->SetSize(400, 400);
vtkNew<vtkRenderWindowInteractor> iren;
iren->SetRenderWindow(renWin.GetPointer());
vtkNew<vtkPiecewiseFunction> scalarOpacity;
scalarOpacity->AddPoint(scalarRange[0], 0.0);
scalarOpacity->AddPoint(scalarRange[1], 0.2);
vtkNew<vtkVolumeProperty> volumeProperty;
volumeProperty->ShadeOff();
volumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);
volumeProperty->SetScalarOpacity(scalarOpacity.GetPointer());
vtkColorTransferFunction* colorTransferFunction = volumeProperty->GetRGBTransferFunction(0);
colorTransferFunction->RemoveAllPoints();
colorTransferFunction->AddRGBPoint(scalarRange[0], 0.8, 0.6, 0.1);
colorTransferFunction->AddRGBPoint(scalarRange[1], 0.1, 0.2, 0.8);
vtkNew<vtkVolume> volume;
volume->SetMapper(volumeMapper.GetPointer());
volume->SetProperty(volumeProperty.GetPointer());
// Attach OSPRay render pass
vtkNew<vtkOSPRayPass> osprayPass;
if (useOSP)
{
ren->SetPass(osprayPass.GetPointer());
}
ren->AddViewProp(volume.GetPointer());
renWin->Render();
ren->ResetCamera();
ren->GetActiveCamera()->Azimuth(140);
ren->GetActiveCamera()->Elevation(30);
iren->Initialize();
iren->SetDesiredUpdateRate(30.0);
int retVal = vtkRegressionTestImage(renWin.GetPointer());
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
volumeMapper->SetInputConnection(nullptr);
return !retVal;
}
|
/*
* MRustC - Rust Compiler
* - By John Hodge (Mutabah/thePowersGang)
*
* hir_conv/expand_type.cpp
* - Expand `type` aliases in HIR
*/
#include "main_bindings.hpp"
#include <hir/hir.hpp>
#include <hir/expr.hpp>
#include <hir/visitor.hpp>
#include <hir_typeck/common.hpp> // monomorphise_type_with
::HIR::TypeRef ConvertHIR_ExpandAliases_GetExpansion_GP(const Span& sp, const ::HIR::Crate& crate, const ::HIR::GenericPath& path, bool is_expr)
{
const auto& ti = crate.get_typeitem_by_path(sp, path.m_path);
if(const auto* ep = ti.opt_TypeAlias() )
{
const auto& ta = *ep;
auto pp = path.m_params.clone();
if( !is_expr ) {
auto ms_o = MonomorphStatePtr(nullptr, &path.m_params, nullptr);
while( pp.m_types.size() < ta.m_params.m_types.size() && ta.m_params.m_types[pp.m_types.size()].m_default != ::HIR::TypeRef() ) {
pp.m_types.push_back( ms_o.monomorph_type(sp, ta.m_params.m_types[pp.m_types.size()].m_default) );
}
if( pp.m_types.size() != ta.m_params.m_types.size() ) {
ERROR(sp, E0000, "Mismatched parameter count in " << path << ", expected " << ta.m_params.m_types.size() << " got " << pp.m_types.size());
}
}
else {
while( pp.m_types.size() < ta.m_params.m_types.size() )
{
pp.m_types.push_back( ::HIR::TypeRef() );
}
}
if( ta.m_params.m_types.size() > 0 ) {
// Monomorphise the exapnded type using the created params
auto ms = MonomorphStatePtr(nullptr, &pp, nullptr);
return ms.monomorph_type(sp, ta.m_type);
}
else {
return ta.m_type.clone();
}
}
return ::HIR::TypeRef();
}
::HIR::TypeRef ConvertHIR_ExpandAliases_GetExpansion(const ::HIR::Crate& crate, const ::HIR::Path& path, bool is_expr)
{
static Span sp;
TU_MATCH(::HIR::Path::Data, (path.m_data), (e),
(Generic,
return ConvertHIR_ExpandAliases_GetExpansion_GP(sp, crate, e, is_expr);
),
(UfcsInherent,
DEBUG("TODO: Locate impl blocks for types - path=" << path);
),
(UfcsKnown,
DEBUG("TODO: Locate impl blocks for traits on types - path=" << path);
),
(UfcsUnknown,
DEBUG("TODO: Locate impl blocks for traits on types - path=" << path);
)
)
return ::HIR::TypeRef();
}
class Expander:
public ::HIR::Visitor
{
const ::HIR::Crate& m_crate;
bool m_in_expr = false;
const ::HIR::TypeRef* m_impl_type = nullptr;
public:
Expander(const ::HIR::Crate& crate):
m_crate(crate)
{}
void visit_type(::HIR::TypeRef& ty) override
{
static Span sp;
::HIR::Visitor::visit_type(ty);
if( const auto* e = ty.data().opt_Path() )
{
::HIR::TypeRef new_type = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e->path, m_in_expr);
// Keep trying to expand down the chain
unsigned int num_exp = 1;
const unsigned int MAX_RECURSIVE_TYPE_EXPANSIONS = 100;
while(num_exp < MAX_RECURSIVE_TYPE_EXPANSIONS)
{
// NOTE: inner recurses
::HIR::Visitor::visit_type(new_type);
if( const auto* e = new_type.data().opt_Path() )
{
auto nt = ConvertHIR_ExpandAliases_GetExpansion(m_crate, e->path, m_in_expr);
if( nt == ::HIR::TypeRef() )
break;
num_exp ++;
new_type = mv$(nt);
}
else {
break;
}
}
ASSERT_BUG(sp, num_exp < MAX_RECURSIVE_TYPE_EXPANSIONS, "Recursion limit hit expanding " << ty << " (currently on " << new_type << ")");
if( ! new_type.data().is_Infer() ) {
DEBUG("Replacing " << ty << " with " << new_type << " (" << num_exp << " expansions)");
ty = mv$(new_type);
}
}
}
::HIR::Path expand_alias_path(const Span& sp, const ::HIR::Path& path)
{
const unsigned int MAX_RECURSIVE_TYPE_EXPANSIONS = 100;
// If the path is already generic and points at an enum variant, skip
if( path.m_data.is_Generic() )
{
const auto& gp = path.m_data.as_Generic();
if( gp.m_path.m_components.size() > 1 && m_crate.get_typeitem_by_path(sp, gp.m_path, /*igncrate*/false, /*ignlast*/true).is_Enum() )
{
return ::HIR::GenericPath();
}
}
::HIR::Path rv = ::HIR::GenericPath();
const auto* cur = &path;
unsigned int num_exp = 0;
do {
auto ty = ConvertHIR_ExpandAliases_GetExpansion(m_crate, *cur, m_in_expr);
if( ty == ::HIR::TypeRef() )
break ;
if( !ty.data().is_Path() )
ERROR(sp, E0000, "Type alias referenced in generic path doesn't point to a path");
rv = std::move(ty.get_unique().as_Path().path);
this->visit_path(rv, ::HIR::Visitor::PathContext::TYPE);
cur = &rv;
} while( ++num_exp < MAX_RECURSIVE_TYPE_EXPANSIONS );
ASSERT_BUG(sp, num_exp < MAX_RECURSIVE_TYPE_EXPANSIONS, "Recursion limit expanding " << path << " (currently on " << *cur << ")");
return mv$( rv );
}
::HIR::Pattern::PathBinding visit_pattern_PathBinding(const Span& sp, ::HIR::Path& path)
{
if( path.m_data.is_UfcsUnknown() ) {
const auto& ty = path.m_data.as_UfcsUnknown().type;
const auto& name = path.m_data.as_UfcsUnknown().item;
if( !ty.data().is_Path() ) {
ERROR(sp, E0000, "Expeted path in pattern binding, got " << ty);
}
if( !ty.data().as_Path().path.m_data.is_Generic() ) {
ERROR(sp, E0000, "Expeted generic path in pattern binding, got " << ty);
}
const auto& gp = ty.data().as_Path().path.m_data.as_Generic();
const auto& ti = m_crate.get_typeitem_by_path(sp, gp.m_path);
if( !ti.is_Enum() ) {
ERROR(sp, E0000, "Expeted enum path in pattern binding, got " << ti.tag_str());
}
const auto& enm = ti.as_Enum();
auto gp2 = gp.clone();
gp2.m_path.m_components.push_back(name);
gp2.m_params.m_types.resize( enm.m_params.m_types.size() );
auto idx = enm.find_variant(name);
if(idx == ~0u) {
TODO(sp, "Variant " << name << " not found in " << gp);
}
path = std::move(gp2);
return ::HIR::Pattern::PathBinding::make_Enum({ &enm, static_cast<unsigned>(idx) });
}
// `Self { ... }` patterns - Encoded as `<Self>::`
if( path.m_data.is_UfcsInherent() ) {
const auto& ty = path.m_data.as_UfcsInherent().type;
const auto& name = path.m_data.as_UfcsInherent().item;
ASSERT_BUG(sp, ty.data().is_Generic() && ty.data().as_Generic().binding == GENERIC_Self, path);
ASSERT_BUG(sp, name == "", path);
if(!m_impl_type) {
ERROR(sp, E0000, "Use of `Self` pattern outside of an impl block");
}
if(!TU_TEST1(m_impl_type->data(), Path, .path.m_data.is_Generic()) ) {
ERROR(sp, E0000, "Use of `Self` pattern in non-struct impl block - " << *m_impl_type);
}
const auto& p = m_impl_type->data().as_Path().path.m_data.as_Generic();
const auto& str = m_crate.get_struct_by_path(sp, p.m_path);
path = p.clone();
return ::HIR::Pattern::PathBinding::make_Struct(&str);
}
// TODO: `Self { ... }` encoded as `<Self>::`
ASSERT_BUG(sp, path.m_data.is_Generic(), path);
auto& gp = path.m_data.as_Generic();
// TODO: Better error messages?
if( gp.m_path.m_components.size() > 1 )
{
const auto& ti = m_crate.get_typeitem_by_path(sp, gp.m_path, false, /*ignore_last*/true);
if( ti.is_Enum() ) {
// Enum variant!
const auto& enm = ti.as_Enum();
gp.m_params.m_types.resize( enm.m_params.m_types.size() );
auto idx = ti.as_Enum().find_variant(gp.m_path.m_components.back());
return ::HIR::Pattern::PathBinding::make_Enum({ &enm, static_cast<unsigned>(idx) });
}
}
// Has to be a struct
const auto& str = m_crate.get_struct_by_path(sp, gp.m_path);
gp.m_params.m_types.resize( str.m_params.m_types.size() );
return ::HIR::Pattern::PathBinding::make_Struct(&str);
}
void visit_pattern(::HIR::Pattern& pat) override
{
static Span sp;
::HIR::Visitor::visit_pattern(pat);
TU_MATCH_HDRA( (pat.m_data), {)
default:
break;
TU_ARMA(PathValue, e) {
auto new_path = expand_alias_path(sp, e.path);
if( new_path != ::HIR::GenericPath() )
{
DEBUG("Replacing " << e.path << " with " << new_path);
e.path = mv$(new_path);
}
e.binding = visit_pattern_PathBinding(sp, e.path);
}
TU_ARMA(PathTuple, e) {
auto new_path = expand_alias_path(sp, e.path);
if( new_path != ::HIR::GenericPath() )
{
DEBUG("Replacing " << e.path << " with " << new_path);
e.path = mv$(new_path);
}
e.binding = visit_pattern_PathBinding(sp, e.path);
}
TU_ARMA(PathNamed, e) {
auto new_path = expand_alias_path(sp, e.path);
if( new_path != ::HIR::GenericPath() )
{
DEBUG("Replacing " << e.path << " with " << new_path);
e.path = mv$(new_path);
}
e.binding = visit_pattern_PathBinding(sp, e.path);
// TODO: If this is an empty/wildcard AND it's poiting at a value/tuple entry, change to PathValue/PathTuple
}
}
}
void visit_expr(::HIR::ExprPtr& expr) override
{
struct Visitor:
public ::HIR::ExprVisitorDef
{
Expander& upper_visitor;
Visitor(Expander& uv):
upper_visitor(uv)
{}
void visit_type(::HIR::TypeRef& ty) override
{
upper_visitor.visit_type(ty);
}
void visit_pattern(const Span& sp, ::HIR::Pattern& pat) override
{
upper_visitor.visit_pattern(pat);
}
// Custom impl to visit the inner expression
void visit(::HIR::ExprNode_ArraySized& node) override
{
auto& as = node.m_size;
if( as.is_Unevaluated() && as.as_Unevaluated().is_Unevaluated() )
{
upper_visitor.visit_expr(*as.as_Unevaluated().as_Unevaluated());
}
::HIR::ExprVisitorDef::visit(node);
}
};
if( expr.get() != nullptr )
{
auto old = m_in_expr;
m_in_expr = true;
Visitor v { *this };
(*expr).visit(v);
m_in_expr = old;
}
}
void visit_type_impl(::HIR::TypeImpl& impl) override
{
m_impl_type = &impl.m_type;
::HIR::Visitor::visit_type_impl(impl);
m_impl_type = nullptr;
}
void visit_trait_impl(const ::HIR::SimplePath& trait_path, ::HIR::TraitImpl& impl) override
{
static Span sp;
m_impl_type = &impl.m_type;
::HIR::Visitor::visit_trait_impl(trait_path, impl);
m_impl_type = nullptr;
}
};
class Expander_Self:
public ::HIR::Visitor
{
const ::HIR::Crate& m_crate;
const ::HIR::TypeRef* m_impl_type = nullptr;
bool m_in_expr = false;
public:
Expander_Self(const ::HIR::Crate& crate):
m_crate(crate)
{}
void visit_type(::HIR::TypeRef& ty) override
{
::HIR::Visitor::visit_type(ty);
if(const auto* te = ty.data().opt_Generic() )
{
if( te->binding == GENERIC_Self )
{
if( m_impl_type )
{
DEBUG("Replace Self with " << *m_impl_type);
ty = m_impl_type->clone();
}
else
{
// NOTE: Valid for `trait` definitions.
DEBUG("Self outside of an `impl` block");
}
}
}
}
void visit_expr(::HIR::ExprPtr& expr) override
{
struct Visitor:
public ::HIR::ExprVisitorDef
{
Expander_Self& upper_visitor;
Visitor(Expander_Self& uv):
upper_visitor(uv)
{}
void visit_type(::HIR::TypeRef& ty) override
{
upper_visitor.visit_type(ty);
}
void visit_pattern(const Span& sp, ::HIR::Pattern& pat) override
{
upper_visitor.visit_pattern(pat);
}
// Custom impl to visit the inner expression
void visit(::HIR::ExprNode_ArraySized& node) override
{
auto& as = node.m_size;
if( as.is_Unevaluated() && as.as_Unevaluated().is_Unevaluated() )
{
upper_visitor.visit_expr(*as.as_Unevaluated().as_Unevaluated());
}
::HIR::ExprVisitorDef::visit(node);
}
};
if( expr.get() != nullptr )
{
auto old = m_in_expr;
m_in_expr = true;
Visitor v { *this };
(*expr).visit(v);
m_in_expr = old;
}
}
void visit_type_impl(::HIR::TypeImpl& impl) override
{
m_impl_type = &impl.m_type;
::HIR::Visitor::visit_type_impl(impl);
m_impl_type = nullptr;
}
void visit_trait_impl(const ::HIR::SimplePath& trait_path, ::HIR::TraitImpl& impl) override
{
static Span sp;
m_impl_type = &impl.m_type;
::HIR::Visitor::visit_trait_impl(trait_path, impl);
m_impl_type = nullptr;
}
};
void ConvertHIR_ExpandAliases(::HIR::Crate& crate)
{
Expander exp { crate };
exp.visit_crate( crate );
}
void ConvertHIR_ExpandAliases_Self(::HIR::Crate& crate)
{
Expander_Self exp { crate };
exp.visit_crate( crate );
}
|
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int countInversion (const vector <int> &A, int N) {
int Count = 0;
for (int i = 1; i < N; i++) {
for (int j = i + 1; j <= N; j++) {
if (A[i] > A[j])
Count++;
}
}
return Count;
}
int countLocalInversion (const vector <int> &A, int N) {
int Count = 0;
for (int i = 1; i < N; i++) {
if (A[i] > A[i + 1])
Count++;
}
return Count;
}
int main () {
int T, N;
scanf ("%d", &T);
while (T--) {
scanf ("%d", &N);
vector <int> P (N + 1);
for (int i = 1; i <= N; i++)
scanf ("%d", &P[i]);
int count1 = countInversion (P, N);
int count2 = countLocalInversion (P, N);
if (count1 == count2)
printf ("YES\n");
else
printf ("NO\n");
}
return 0;
}
|
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* hprose/rpc/Client.cpp *
* *
* hprose rpc client for cpp. *
* *
* LastModified: Dec 8, 2016 *
* Author: Chen fei <cf@hprose.com> *
* *
\**********************************************************/
#include <hprose/rpc/Client.h>
namespace hprose {
namespace rpc {
ClientContext Client::getContext(const InvokeSettings *settings) {
auto context = ClientContext(*this);
if (settings) {
context.settings = *settings;
if (settings->retry <= 0) {
context.settings.retry = retry;
}
if (settings->timeout <= 0) {
context.settings.timeout = timeout;
}
} else {
context.settings.retry = retry;
context.settings.timeout = timeout;
}
return context;
}
std::string Client::sendRequest(const std::string &request, const ClientContext &context) {
return sendAndReceive(request, context);
}
}
} // hprose::rpc
|
#include "cppch.h"
#include "OpenGLShader.h"
#include <fstream>
#include <glad\glad.h>
#include <glm\gtc\type_ptr.hpp>
namespace Cyprium
{
static GLenum ShaderTypeFromString(const std::string& type)
{
if (type == "vertex") return GL_VERTEX_SHADER;
else if (type == "fragment" || type == "pixel") return GL_FRAGMENT_SHADER;
CP_CORE_ASSERT(false, "Unknown shader type!");
return 0;
}
OpenGLShader::OpenGLShader(const std::string& filepath)
{
std::string source = ReadFile(filepath);
auto shaderSources = Preprocess(source);
Compile(shaderSources);
// Extract name from filepath
auto lastSlash = filepath.find_last_of("/\\");
lastSlash = lastSlash == std::string::npos ? 0 : lastSlash + 1;
auto lastDot = filepath.rfind('.');
auto count = lastDot == std::string::npos ? filepath.size() - lastSlash : lastDot - lastSlash;
m_Name = filepath.substr(lastSlash, count);
}
OpenGLShader::OpenGLShader(const std::string& name, const std::string& vertexSrc, const std::string& fragmentSrc)
: m_Name(name)
{
std::unordered_map<GLenum, std::string> sources;
sources[GL_VERTEX_SHADER] = vertexSrc;
sources[GL_FRAGMENT_SHADER] = fragmentSrc;
Compile(sources);
}
OpenGLShader::~OpenGLShader()
{
glDeleteProgram(m_RendererID);
}
std::string OpenGLShader::ReadFile(const std::string& filepath)
{
std::string result;
std::ifstream in(filepath, std::ios::in | std::ios::binary);
if (in)
{
in.seekg(0, std::ios::end);
result.resize(in.tellg());
in.seekg(0, std::ios::beg);
in.read(&result[0], result.size());
in.close();
}
else
{
CP_CORE_ERROR("Could not open file '{0}'", filepath);
}
return result;
}
std::unordered_map<GLenum, std::string> OpenGLShader::Preprocess(const std::string& source)
{
std::unordered_map<GLenum, std::string> shaderSources;
const char* typeToken = "#type";
size_t typeTokenLength = strlen(typeToken);
size_t pos = source.find(typeToken, 0); //Start of shader type declaration line
while (pos != std::string::npos)
{
size_t eol = source.find_first_of("\r\n", pos); //End of shader type declaration line
CP_CORE_ASSERT(eol != std::string::npos, "Syntax error");
size_t begin = pos + typeTokenLength + 1; //Start of shader type name (after "#type " keyword)
std::string type = source.substr(begin, eol - begin);
CP_CORE_ASSERT(ShaderTypeFromString(type), "Invalid shader type specified");
size_t nextLinePos = source.find_first_not_of("\r\n", eol); //Start of shader code after shader type declaration line
CP_CORE_ASSERT(nextLinePos != std::string::npos, "Syntax error");
pos = source.find(typeToken, nextLinePos); //Start of next shader type declaration line
shaderSources[ShaderTypeFromString(type)] = (pos == std::string::npos) ? source.substr(nextLinePos) : source.substr(nextLinePos, pos - nextLinePos);
}
return shaderSources;
}
void OpenGLShader::Compile(std::unordered_map<GLenum, std::string>& shaderSources)
{
GLuint program = glCreateProgram();
CP_CORE_ASSERT(shaderSources.size() <= 2, "Invalid amount of shaders, only 2 (max) are currently supported!");
std::array<GLenum, 2> glShaderIDs;
int glShaderIDIndex = 0;
for (auto& kv : shaderSources)
{
GLenum type = kv.first;
const std::string& source = kv.second;
// Create an empty shader handle
GLuint shader = glCreateShader(type);
// Send the shader source code to GL
// Note that std::string's .c_str is NULL character terminated.
const GLchar* sourceCStr = source.c_str();
glShaderSource(shader, 1, &sourceCStr, 0);
// Compile the shader
glCompileShader(shader);
GLint isCompiled = 0;
glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled);
if (isCompiled == GL_FALSE)
{
GLint maxLength = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
// The maxLength includes the NULL character
std::vector<GLchar> infoLog(maxLength);
glGetShaderInfoLog(shader, maxLength, &maxLength, &infoLog[0]);
// We don't need the shader anymore.
glDeleteShader(shader);
CP_CORE_ERROR("{0}", infoLog.data());
CP_CORE_ASSERT(false, "Shader compilation failure!");
break;
}
glAttachShader(program, shader);
glShaderIDs[glShaderIDIndex++] = shader;
}
m_RendererID = program;
// Link our program
glLinkProgram(program);
// Note the different functions here: glGetProgram* instead of glGetShader*.
GLint isLinked = 0;
glGetProgramiv(program, GL_LINK_STATUS, (int*)&isLinked);
if (isLinked == GL_FALSE)
{
GLint maxLength = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
// The maxLength includes the NULL character
std::vector<GLchar> infoLog(maxLength);
glGetProgramInfoLog(program, maxLength, &maxLength, &infoLog[0]);
// We don't need the program anymore.
glDeleteProgram(program);
for (auto id : glShaderIDs)
glDeleteShader(id);
CP_CORE_ERROR("{0}", infoLog.data());
CP_CORE_ASSERT(false, "Shader link failure!");
return;
}
for (auto id : glShaderIDs)
glDetachShader(program, id);
}
void OpenGLShader::Bind() const
{
glUseProgram(m_RendererID);
}
void OpenGLShader::Unbind() const
{
glUseProgram(0);
}
void OpenGLShader::UploadUniformInt(const std::string& name, int value)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniform1i(location, value);
}
void OpenGLShader::UploadUniformFloat(const std::string & name, float value)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniform1f(location, value);
}
void OpenGLShader::UploadUniformFloat2(const std::string & name, const glm::vec2 & value)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniform2f(location, value.x, value.y);
}
void OpenGLShader::UploadUniformFloat3(const std::string & name, const glm::vec3 & value)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniform3f(location, value.x, value.y, value.z);
}
void OpenGLShader::UploadUniformFloat4(const std::string& name, const glm::vec4& value)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniform4f(location, value.x, value.y, value.z, value.w);
}
void OpenGLShader::UploadUniformMat3(const std::string& name, const glm::mat3& matrix)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniformMatrix3fv(location, 1, GL_FALSE, glm::value_ptr(matrix));
}
void OpenGLShader::UploadUniformMat4(const std::string& name, const glm::mat4& matrix)
{
GLint location = glGetUniformLocation(m_RendererID, name.c_str());
glUniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(matrix));
}
}
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "db.h"
#include "net.h"
#include "init.h"
#include "strlcpy.h"
#include "addrman.h"
#include "ui_interface.h"
#ifdef WIN32
#include <string.h>
#endif
#ifdef USE_UPNP
#include <miniupnpc/miniwget.h>
#include <miniupnpc/miniupnpc.h>
#include <miniupnpc/upnpcommands.h>
#include <miniupnpc/upnperrors.h>
#endif
using namespace std;
using namespace boost;
static const int MAX_OUTBOUND_CONNECTIONS = 12;
void ThreadMessageHandler2(void* parg);
void ThreadSocketHandler2(void* parg);
void ThreadOpenConnections2(void* parg);
void ThreadOpenAddedConnections2(void* parg);
#ifdef USE_UPNP
void ThreadMapPort2(void* parg);
#endif
void ThreadDNSAddressSeed2(void* parg);
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound = NULL, const char *strDest = NULL, bool fOneShot = false);
struct LocalServiceInfo {
int nScore;
int nPort;
};
//
// Global state variables
//
bool fClient = false;
bool fDiscover = true;
bool fUseUPnP = false;
uint64 nLocalServices = (fClient ? 0 : NODE_NETWORK);
static CCriticalSection cs_mapLocalHost;
static map<CNetAddr, LocalServiceInfo> mapLocalHost;
static bool vfReachable[NET_MAX] = {};
static bool vfLimited[NET_MAX] = {};
static CNode* pnodeLocalHost = NULL;
CAddress addrSeenByPeer(CService("0.0.0.0", 0), nLocalServices);
uint64 nLocalHostNonce = 0;
boost::array<int, THREAD_MAX> vnThreadsRunning;
static std::vector<SOCKET> vhListenSocket;
CAddrMan addrman;
vector<CNode*> vNodes;
CCriticalSection cs_vNodes;
map<CInv, CDataStream> mapRelay;
deque<pair<int64, CInv> > vRelayExpiration;
CCriticalSection cs_mapRelay;
map<CInv, int64> mapAlreadyAskedFor;
static deque<string> vOneShots;
CCriticalSection cs_vOneShots;
set<CNetAddr> setservAddNodeAddresses;
CCriticalSection cs_setservAddNodeAddresses;
static CSemaphore *semOutbound = NULL;
void AddOneShot(string strDest)
{
LOCK(cs_vOneShots);
vOneShots.push_back(strDest);
}
unsigned short GetListenPort()
{
return (unsigned short)(GetArg("-port", GetDefaultPort()));
}
void CNode::PushGetBlocks(CBlockIndex* pindexBegin, uint256 hashEnd)
{
// Filter out duplicate requests
if (pindexBegin == pindexLastGetBlocksBegin && hashEnd == hashLastGetBlocksEnd)
return;
pindexLastGetBlocksBegin = pindexBegin;
hashLastGetBlocksEnd = hashEnd;
PushMessage("getblocks", CBlockLocator(pindexBegin), hashEnd);
}
// find 'best' local address for a particular peer
bool GetLocal(CService& addr, const CNetAddr *paddrPeer)
{
if (fNoListen)
return false;
int nBestScore = -1;
int nBestReachability = -1;
{
LOCK(cs_mapLocalHost);
for (map<CNetAddr, LocalServiceInfo>::iterator it = mapLocalHost.begin(); it != mapLocalHost.end(); it++)
{
int nScore = (*it).second.nScore;
int nReachability = (*it).first.GetReachabilityFrom(paddrPeer);
if (nReachability > nBestReachability || (nReachability == nBestReachability && nScore > nBestScore))
{
addr = CService((*it).first, (*it).second.nPort);
nBestReachability = nReachability;
nBestScore = nScore;
}
}
}
return nBestScore >= 0;
}
// get best local address for a particular peer as a CAddress
CAddress GetLocalAddress(const CNetAddr *paddrPeer)
{
CAddress ret(CService("0.0.0.0",0),0);
CService addr;
if (GetLocal(addr, paddrPeer))
{
ret = CAddress(addr);
ret.nServices = nLocalServices;
ret.nTime = GetAdjustedTime();
}
return ret;
}
bool RecvLine(SOCKET hSocket, string& strLine)
{
strLine = "";
loop
{
char c;
int nBytes = recv(hSocket, &c, 1, 0);
if (nBytes > 0)
{
if (c == '\n')
continue;
if (c == '\r')
return true;
strLine += c;
if (strLine.size() >= 9000)
return true;
}
else if (nBytes <= 0)
{
if (fShutdown)
return false;
if (nBytes < 0)
{
int nErr = WSAGetLastError();
if (nErr == WSAEMSGSIZE)
continue;
if (nErr == WSAEWOULDBLOCK || nErr == WSAEINTR || nErr == WSAEINPROGRESS)
{
Sleep(10);
continue;
}
}
if (!strLine.empty())
return true;
if (nBytes == 0)
{
// socket closed
printf("socket closed\n");
return false;
}
else
{
// socket error
int nErr = WSAGetLastError();
printf("recv failed: %d\n", nErr);
return false;
}
}
}
}
// used when scores of local addresses may have changed
// pushes better local address to peers
void static AdvertizeLocal()
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->fSuccessfullyConnected)
{
CAddress addrLocal = GetLocalAddress(&pnode->addr);
if (addrLocal.IsRoutable() && (CService)addrLocal != (CService)pnode->addrLocal)
{
pnode->PushAddress(addrLocal);
pnode->addrLocal = addrLocal;
}
}
}
}
void SetReachable(enum Network net, bool fFlag)
{
LOCK(cs_mapLocalHost);
vfReachable[net] = fFlag;
if (net == NET_IPV6 && fFlag)
vfReachable[NET_IPV4] = true;
}
// learn a new local address
bool AddLocal(const CService& addr, int nScore)
{
if (!addr.IsRoutable())
return false;
if (!fDiscover && nScore < LOCAL_MANUAL)
return false;
if (IsLimited(addr))
return false;
printf("AddLocal(%s,%i)\n", addr.ToString().c_str(), nScore);
{
LOCK(cs_mapLocalHost);
bool fAlready = mapLocalHost.count(addr) > 0;
LocalServiceInfo &info = mapLocalHost[addr];
if (!fAlready || nScore >= info.nScore) {
info.nScore = nScore + (fAlready ? 1 : 0);
info.nPort = addr.GetPort();
}
SetReachable(addr.GetNetwork());
}
AdvertizeLocal();
return true;
}
bool AddLocal(const CNetAddr &addr, int nScore)
{
return AddLocal(CService(addr, GetListenPort()), nScore);
}
/** Make a particular network entirely off-limits (no automatic connects to it) */
void SetLimited(enum Network net, bool fLimited)
{
if (net == NET_UNROUTABLE)
return;
LOCK(cs_mapLocalHost);
vfLimited[net] = fLimited;
}
bool IsLimited(enum Network net)
{
LOCK(cs_mapLocalHost);
return vfLimited[net];
}
bool IsLimited(const CNetAddr &addr)
{
return IsLimited(addr.GetNetwork());
}
/** vote for a local address */
bool SeenLocal(const CService& addr)
{
{
LOCK(cs_mapLocalHost);
if (mapLocalHost.count(addr) == 0)
return false;
mapLocalHost[addr].nScore++;
}
AdvertizeLocal();
return true;
}
/** check whether a given address is potentially local */
bool IsLocal(const CService& addr)
{
LOCK(cs_mapLocalHost);
return mapLocalHost.count(addr) > 0;
}
/** check whether a given address is in a network we can probably connect to */
bool IsReachable(const CNetAddr& addr)
{
LOCK(cs_mapLocalHost);
enum Network net = addr.GetNetwork();
return vfReachable[net] && !vfLimited[net];
}
bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const char* pszKeyword, CNetAddr& ipRet)
{
SOCKET hSocket;
if (!ConnectSocket(addrConnect, hSocket))
return error("GetMyExternalIP() : connection to %s failed", addrConnect.ToString().c_str());
send(hSocket, pszGet, strlen(pszGet), MSG_NOSIGNAL);
string strLine;
while (RecvLine(hSocket, strLine))
{
if (strLine.empty()) // HTTP response is separated from headers by blank line
{
loop
{
if (!RecvLine(hSocket, strLine))
{
closesocket(hSocket);
return false;
}
if (pszKeyword == NULL)
break;
if (strLine.find(pszKeyword) != string::npos)
{
strLine = strLine.substr(strLine.find(pszKeyword) + strlen(pszKeyword));
break;
}
}
closesocket(hSocket);
if (strLine.find("<") != string::npos)
strLine = strLine.substr(0, strLine.find("<"));
strLine = strLine.substr(strspn(strLine.c_str(), " \t\n\r"));
while (strLine.size() > 0 && isspace(strLine[strLine.size()-1]))
strLine.resize(strLine.size()-1);
CService addr(strLine,0,true);
printf("GetMyExternalIP() received [%s] %s\n", strLine.c_str(), addr.ToString().c_str());
if (!addr.IsValid() || !addr.IsRoutable())
return false;
ipRet.SetIP(addr);
return true;
}
}
closesocket(hSocket);
return error("GetMyExternalIP() : connection closed");
}
// We now get our external IP
bool GetMyExternalIP(CNetAddr& ipRet)
{
CService addrConnect;
const char* pszGet;
const char* pszKeyword;
for (int nLookup = 0; nLookup <= 1; nLookup++)
for (int nHost = 1; nHost <= 2; nHost++)
{
// We should be phasing out our use of sites like these. If we need
// replacements, we should ask for volunteers to put this simple
// php file on their web server that prints the client IP:
// <?php echo $_SERVER["REMOTE_ADDR"]; ?>
if (nHost == 1)
{
addrConnect = CService("91.198.22.70",80); // checkip.dyndns.org
if (nLookup == 1)
{
CService addrIP("checkip.dyndns.org", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;
}
pszGet = "GET / HTTP/1.1\r\n"
"Host: checkip.dyndns.org\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
"Connection: close\r\n"
"\r\n";
pszKeyword = "Address:";
}
else if (nHost == 2)
{
addrConnect = CService("74.208.43.192", 80); // www.showmyip.com
if (nLookup == 1)
{
CService addrIP("www.showmyip.com", 80, true);
if (addrIP.IsValid())
addrConnect = addrIP;
}
pszGet = "GET /simple/ HTTP/1.1\r\n"
"Host: www.showmyip.com\r\n"
"User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)\r\n"
"Connection: close\r\n"
"\r\n";
pszKeyword = NULL; // Returns just IP address
}
if (GetMyExternalIP2(addrConnect, pszGet, pszKeyword, ipRet))
return true;
}
return false;
}
void ThreadGetMyExternalIP(void* parg)
{
// Make this thread recognisable as the external IP detection thread
RenameThread("bitcoin-ext-ip");
CNetAddr addrLocalHost;
if (GetMyExternalIP(addrLocalHost))
{
printf("GetMyExternalIP() returned %s\n", addrLocalHost.ToStringIP().c_str());
AddLocal(addrLocalHost, LOCAL_HTTP);
}
}
void AddressCurrentlyConnected(const CService& addr)
{
addrman.Connected(addr);
}
CNode* FindNode(const CNetAddr& ip)
{
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if ((CNetAddr)pnode->addr == ip)
return (pnode);
}
return NULL;
}
CNode* FindNode(std::string addrName)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->addrName == addrName)
return (pnode);
return NULL;
}
CNode* FindNode(const CService& addr)
{
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if ((CService)pnode->addr == addr)
return (pnode);
}
return NULL;
}
CNode* ConnectNode(CAddress addrConnect, const char *pszDest, int64 nTimeout)
{
if (pszDest == NULL) {
if (IsLocal(addrConnect))
return NULL;
// Look for an existing connection
CNode* pnode = FindNode((CService)addrConnect);
if (pnode)
{
if (nTimeout != 0)
pnode->AddRef(nTimeout);
else
pnode->AddRef();
return pnode;
}
}
/// debug print
printf("trying connection %s lastseen=%.1fhrs\n",
pszDest ? pszDest : addrConnect.ToString().c_str(),
pszDest ? 0 : (double)(GetAdjustedTime() - addrConnect.nTime)/3600.0);
// Connect
SOCKET hSocket;
if (pszDest ? ConnectSocketByName(addrConnect, hSocket, pszDest, GetDefaultPort()) : ConnectSocket(addrConnect, hSocket))
{
addrman.Attempt(addrConnect);
/// debug print
printf("connected %s\n", pszDest ? pszDest : addrConnect.ToString().c_str());
// Set to non-blocking
#ifdef WIN32
u_long nOne = 1;
if (ioctlsocket(hSocket, FIONBIO, &nOne) == SOCKET_ERROR)
printf("ConnectSocket() : ioctlsocket non-blocking setting failed, error %d\n", WSAGetLastError());
#else
if (fcntl(hSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
printf("ConnectSocket() : fcntl non-blocking setting failed, error %d\n", errno);
#endif
// Add node
CNode* pnode = new CNode(hSocket, addrConnect, pszDest ? pszDest : "", false);
if (nTimeout != 0)
pnode->AddRef(nTimeout);
else
pnode->AddRef();
{
LOCK(cs_vNodes);
vNodes.push_back(pnode);
}
pnode->nTimeConnected = GetTime();
return pnode;
}
else
{
return NULL;
}
}
void CNode::CloseSocketDisconnect()
{
fDisconnect = true;
if (hSocket != INVALID_SOCKET)
{
printf("disconnecting node %s\n", addrName.c_str());
closesocket(hSocket);
hSocket = INVALID_SOCKET;
vRecv.clear();
}
}
void CNode::Cleanup()
{
}
void CNode::PushVersion()
{
/// when NTP implemented, change to just nTime = GetAdjustedTime()
int64 nTime = (fInbound ? GetAdjustedTime() : GetTime());
CAddress addrYou = (addr.IsRoutable() && !IsProxy(addr) ? addr : CAddress(CService("0.0.0.0",0)));
CAddress addrMe = GetLocalAddress(&addr);
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
printf("send version message: version %d, blocks=%d, us=%s, them=%s, peer=%s\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString().c_str(), addrYou.ToString().c_str(), addr.ToString().c_str());
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
nLocalHostNonce, FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, std::vector<string>()), nBestHeight);
}
std::map<CNetAddr, int64> CNode::setBanned;
CCriticalSection CNode::cs_setBanned;
void CNode::ClearBanned()
{
setBanned.clear();
}
bool CNode::IsBanned(CNetAddr ip)
{
bool fResult = false;
{
LOCK(cs_setBanned);
std::map<CNetAddr, int64>::iterator i = setBanned.find(ip);
if (i != setBanned.end())
{
int64 t = (*i).second;
if (GetTime() < t)
fResult = true;
}
}
return fResult;
}
bool CNode::Misbehaving(int howmuch)
{
if (addr.IsLocal())
{
printf("Warning: Local node %s misbehaving (delta: %d)!\n", addrName.c_str(), howmuch);
return false;
}
nMisbehavior += howmuch;
if (nMisbehavior >= GetArg("-banscore", 100))
{
int64 banTime = GetTime()+GetArg("-bantime", 60*60*24); // Default 24-hour ban
printf("Misbehaving: %s (%d -> %d) DISCONNECTING\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior);
{
LOCK(cs_setBanned);
if (setBanned[addr] < banTime)
setBanned[addr] = banTime;
}
CloseSocketDisconnect();
return true;
} else
printf("Misbehaving: %s (%d -> %d)\n", addr.ToString().c_str(), nMisbehavior-howmuch, nMisbehavior);
return false;
}
#undef X
#define X(name) stats.name = name
void CNode::copyStats(CNodeStats &stats)
{
X(nServices);
X(nLastSend);
X(nLastRecv);
X(nTimeConnected);
X(addrName);
X(nVersion);
X(strSubVer);
X(fInbound);
X(nReleaseTime);
X(nStartingHeight);
X(nMisbehavior);
}
#undef X
void ThreadSocketHandler(void* parg)
{
// Make this thread recognisable as the networking thread
RenameThread("bitcoin-net");
try
{
vnThreadsRunning[THREAD_SOCKETHANDLER]++;
ThreadSocketHandler2(parg);
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
PrintException(&e, "ThreadSocketHandler()");
} catch (...) {
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
throw; // support pthread_cancel()
}
printf("ThreadSocketHandler exited\n");
}
void ThreadSocketHandler2(void* parg)
{
printf("ThreadSocketHandler started\n");
list<CNode*> vNodesDisconnected;
unsigned int nPrevNodeCount = 0;
loop
{
//
// Disconnect nodes
//
{
LOCK(cs_vNodes);
// Disconnect unused nodes
vector<CNode*> vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (pnode->fDisconnect ||
(pnode->GetRefCount() <= 0 && pnode->vRecv.empty() && pnode->vSend.empty()))
{
// remove from vNodes
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
// release outbound grant (if any)
pnode->grantOutbound.Release();
// close socket and cleanup
pnode->CloseSocketDisconnect();
pnode->Cleanup();
// hold in disconnected pool until all refs are released
pnode->nReleaseTime = max(pnode->nReleaseTime, GetTime() + 15 * 60);
if (pnode->fNetworkNode || pnode->fInbound)
pnode->Release();
vNodesDisconnected.push_back(pnode);
}
}
// Delete disconnected nodes
list<CNode*> vNodesDisconnectedCopy = vNodesDisconnected;
BOOST_FOREACH(CNode* pnode, vNodesDisconnectedCopy)
{
// wait until threads are done using it
if (pnode->GetRefCount() <= 0)
{
bool fDelete = false;
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
{
TRY_LOCK(pnode->cs_vRecv, lockRecv);
if (lockRecv)
{
TRY_LOCK(pnode->cs_mapRequests, lockReq);
if (lockReq)
{
TRY_LOCK(pnode->cs_inventory, lockInv);
if (lockInv)
fDelete = true;
}
}
}
}
if (fDelete)
{
vNodesDisconnected.remove(pnode);
delete pnode;
}
}
}
}
if (vNodes.size() != nPrevNodeCount)
{
nPrevNodeCount = vNodes.size();
uiInterface.NotifyNumConnectionsChanged(vNodes.size());
}
//
// Find which sockets have data to receive
//
struct timeval timeout;
timeout.tv_sec = 0;
timeout.tv_usec = 50000; // frequency to poll pnode->vSend
fd_set fdsetRecv;
fd_set fdsetSend;
fd_set fdsetError;
FD_ZERO(&fdsetRecv);
FD_ZERO(&fdsetSend);
FD_ZERO(&fdsetError);
SOCKET hSocketMax = 0;
bool have_fds = false;
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket) {
FD_SET(hListenSocket, &fdsetRecv);
hSocketMax = max(hSocketMax, hListenSocket);
have_fds = true;
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if (pnode->hSocket == INVALID_SOCKET)
continue;
FD_SET(pnode->hSocket, &fdsetRecv);
FD_SET(pnode->hSocket, &fdsetError);
hSocketMax = max(hSocketMax, pnode->hSocket);
have_fds = true;
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend && !pnode->vSend.empty())
FD_SET(pnode->hSocket, &fdsetSend);
}
}
}
vnThreadsRunning[THREAD_SOCKETHANDLER]--;
int nSelect = select(have_fds ? hSocketMax + 1 : 0,
&fdsetRecv, &fdsetSend, &fdsetError, &timeout);
vnThreadsRunning[THREAD_SOCKETHANDLER]++;
if (fShutdown)
return;
if (nSelect == SOCKET_ERROR)
{
if (have_fds)
{
int nErr = WSAGetLastError();
printf("socket select error %d\n", nErr);
for (unsigned int i = 0; i <= hSocketMax; i++)
FD_SET(i, &fdsetRecv);
}
FD_ZERO(&fdsetSend);
FD_ZERO(&fdsetError);
Sleep(timeout.tv_usec/1000);
}
//
// Accept new connections
//
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
{
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t len = sizeof(sockaddr);
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
CAddress addr;
int nInbound = 0;
if (hSocket != INVALID_SOCKET)
if (!addr.SetSockAddr((const struct sockaddr*)&sockaddr))
printf("Warning: Unknown socket family\n");
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->fInbound)
nInbound++;
}
if (hSocket == INVALID_SOCKET)
{
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK)
printf("socket error accept failed: %d\n", nErr);
}
else if (nInbound >= GetArg("-maxconnections", 125) - MAX_OUTBOUND_CONNECTIONS)
{
{
LOCK(cs_setservAddNodeAddresses);
if (!setservAddNodeAddresses.count(addr))
closesocket(hSocket);
}
}
else if (CNode::IsBanned(addr))
{
printf("connection from %s dropped (banned)\n", addr.ToString().c_str());
closesocket(hSocket);
}
else
{
printf("accepted connection %s\n", addr.ToString().c_str());
CNode* pnode = new CNode(hSocket, addr, "", true);
pnode->AddRef();
{
LOCK(cs_vNodes);
vNodes.push_back(pnode);
}
}
}
//
// Service each socket
//
vector<CNode*> vNodesCopy;
{
LOCK(cs_vNodes);
vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->AddRef();
}
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
if (fShutdown)
return;
//
// Receive
//
if (pnode->hSocket == INVALID_SOCKET)
continue;
if (FD_ISSET(pnode->hSocket, &fdsetRecv) || FD_ISSET(pnode->hSocket, &fdsetError))
{
TRY_LOCK(pnode->cs_vRecv, lockRecv);
if (lockRecv)
{
CDataStream& vRecv = pnode->vRecv;
unsigned int nPos = vRecv.size();
if (nPos > ReceiveBufferSize()) {
if (!pnode->fDisconnect)
printf("socket recv flood control disconnect (%"PRIszu" bytes)\n", vRecv.size());
pnode->CloseSocketDisconnect();
}
else {
// typical socket buffer is 8K-64K
char pchBuf[0x10000];
int nBytes = recv(pnode->hSocket, pchBuf, sizeof(pchBuf), MSG_DONTWAIT);
if (nBytes > 0)
{
vRecv.resize(nPos + nBytes);
memcpy(&vRecv[nPos], pchBuf, nBytes);
pnode->nLastRecv = GetTime();
}
else if (nBytes == 0)
{
// socket closed gracefully
if (!pnode->fDisconnect)
printf("socket closed\n");
pnode->CloseSocketDisconnect();
}
else if (nBytes < 0)
{
// error
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
{
if (!pnode->fDisconnect)
printf("socket recv error %d\n", nErr);
pnode->CloseSocketDisconnect();
}
}
}
}
}
//
// Send
//
if (pnode->hSocket == INVALID_SOCKET)
continue;
if (FD_ISSET(pnode->hSocket, &fdsetSend))
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
{
CDataStream& vSend = pnode->vSend;
if (!vSend.empty())
{
int nBytes = send(pnode->hSocket, &vSend[0], vSend.size(), MSG_NOSIGNAL | MSG_DONTWAIT);
if (nBytes > 0)
{
vSend.erase(vSend.begin(), vSend.begin() + nBytes);
pnode->nLastSend = GetTime();
}
else if (nBytes < 0)
{
// error
int nErr = WSAGetLastError();
if (nErr != WSAEWOULDBLOCK && nErr != WSAEMSGSIZE && nErr != WSAEINTR && nErr != WSAEINPROGRESS)
{
printf("socket send error %d\n", nErr);
pnode->CloseSocketDisconnect();
}
}
}
}
}
//
// Inactivity checking
//
if (pnode->vSend.empty())
pnode->nLastSendEmpty = GetTime();
if (GetTime() - pnode->nTimeConnected > 60)
{
if (pnode->nLastRecv == 0 || pnode->nLastSend == 0)
{
printf("socket no message in first 60 seconds, %d %d\n", pnode->nLastRecv != 0, pnode->nLastSend != 0);
pnode->fDisconnect = true;
}
else if (GetTime() - pnode->nLastSend > 90*60 && GetTime() - pnode->nLastSendEmpty > 90*60)
{
printf("socket not sending\n");
pnode->fDisconnect = true;
}
else if (GetTime() - pnode->nLastRecv > 90*60)
{
printf("socket inactivity timeout\n");
pnode->fDisconnect = true;
}
}
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
Sleep(10);
}
}
#ifdef USE_UPNP
void ThreadMapPort(void* parg)
{
// Make this thread recognisable as the UPnP thread
RenameThread("bitcoin-UPnP");
try
{
vnThreadsRunning[THREAD_UPNP]++;
ThreadMapPort2(parg);
vnThreadsRunning[THREAD_UPNP]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_UPNP]--;
PrintException(&e, "ThreadMapPort()");
} catch (...) {
vnThreadsRunning[THREAD_UPNP]--;
PrintException(NULL, "ThreadMapPort()");
}
printf("ThreadMapPort exited\n");
}
void ThreadMapPort2(void* parg)
{
printf("ThreadMapPort started\n");
std::string port = strprintf("%u", GetListenPort());
const char * multicastif = 0;
const char * minissdpdpath = 0;
struct UPNPDev * devlist = 0;
char lanaddr[64];
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0);
#else
/* miniupnpc 1.6 */
int error = 0;
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
#endif
struct UPNPUrls urls;
struct IGDdatas data;
int r;
r = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
if (r == 1)
{
if (fDiscover) {
char externalIPAddress[40];
r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
if(r != UPNPCOMMAND_SUCCESS)
printf("UPnP: GetExternalIPAddress() returned %d\n", r);
else
{
if(externalIPAddress[0])
{
printf("UPnP: ExternalIPAddress = %s\n", externalIPAddress);
AddLocal(CNetAddr(externalIPAddress), LOCAL_UPNP);
}
else
printf("UPnP: GetExternalIPAddress failed.\n");
}
}
string strDesc = "BitcoinFast " + FormatFullVersion();
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
#else
/* miniupnpc 1.6 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
#endif
if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
port.c_str(), port.c_str(), lanaddr, r, strupnperror(r));
else
printf("UPnP Port Mapping successful.\n");
int i = 1;
loop {
if (fShutdown || !fUseUPnP)
{
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
printf("UPNP_DeletePortMapping() returned : %d\n", r);
freeUPNPDevlist(devlist); devlist = 0;
FreeUPNPUrls(&urls);
return;
}
if (i % 600 == 0) // Refresh every 20 minutes
{
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0);
#else
/* miniupnpc 1.6 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
#endif
if(r!=UPNPCOMMAND_SUCCESS)
printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
port.c_str(), port.c_str(), lanaddr, r, strupnperror(r));
else
printf("UPnP Port Mapping successful.\n");;
}
Sleep(2000);
i++;
}
} else {
printf("No valid UPnP IGDs found\n");
freeUPNPDevlist(devlist); devlist = 0;
if (r != 0)
FreeUPNPUrls(&urls);
loop {
if (fShutdown || !fUseUPnP)
return;
Sleep(2000);
}
}
}
void MapPort()
{
if (fUseUPnP && vnThreadsRunning[THREAD_UPNP] < 1)
{
if (!NewThread(ThreadMapPort, NULL))
printf("Error: ThreadMapPort(ThreadMapPort) failed\n");
}
}
#else
void MapPort()
{
// Intentionally left blank.
}
#endif
// DNS seeds
// Each pair gives a source name and a seed name.
// The first name is used as information source for addrman.
// The second name should resolve to a list of seed addresses.
static const char *strDNSSeed[][2] = {
{"bitcoinfast.co", "bitcoinfast.co"},
};
void ThreadDNSAddressSeed(void* parg)
{
// Make this thread recognisable as the DNS seeding thread
RenameThread("bitcoin-dnsseed");
try
{
vnThreadsRunning[THREAD_DNSSEED]++;
ThreadDNSAddressSeed2(parg);
vnThreadsRunning[THREAD_DNSSEED]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_DNSSEED]--;
PrintException(&e, "ThreadDNSAddressSeed()");
} catch (...) {
vnThreadsRunning[THREAD_DNSSEED]--;
throw; // support pthread_cancel()
}
printf("ThreadDNSAddressSeed exited\n");
}
void ThreadDNSAddressSeed2(void* parg)
{
printf("ThreadDNSAddressSeed started\n");
int found = 0;
if (!fTestNet)
{
printf("Loading addresses from DNS seeds (could take a while)\n");
for (unsigned int seed_idx = 0; seed_idx < ARRAYLEN(strDNSSeed); seed_idx++) {
if (HaveNameProxy()) {
AddOneShot(strDNSSeed[seed_idx][1]);
} else {
vector<CNetAddr> vaddr;
vector<CAddress> vAdd;
if (LookupHost(strDNSSeed[seed_idx][1], vaddr))
{
BOOST_FOREACH(CNetAddr& ip, vaddr)
{
int nOneDay = 24*3600;
CAddress addr = CAddress(CService(ip, GetDefaultPort()));
addr.nTime = GetTime() - 3*nOneDay - GetRand(4*nOneDay); // use a random age between 3 and 7 days old
vAdd.push_back(addr);
found++;
}
}
addrman.Add(vAdd, CNetAddr(strDNSSeed[seed_idx][0], true));
}
}
}
printf("%d addresses found from DNS seeds\n", found);
}
unsigned int pnSeed[] =
{
};
void DumpAddresses()
{
int64 nStart = GetTimeMillis();
CAddrDB adb;
adb.Write(addrman);
printf("Flushed %d addresses to peers.dat %"PRI64d"ms\n",
addrman.size(), GetTimeMillis() - nStart);
}
void ThreadDumpAddress2(void* parg)
{
vnThreadsRunning[THREAD_DUMPADDRESS]++;
while (!fShutdown)
{
DumpAddresses();
vnThreadsRunning[THREAD_DUMPADDRESS]--;
Sleep(100000);
vnThreadsRunning[THREAD_DUMPADDRESS]++;
}
vnThreadsRunning[THREAD_DUMPADDRESS]--;
}
void ThreadDumpAddress(void* parg)
{
// Make this thread recognisable as the address dumping thread
RenameThread("bitcoin-adrdump");
try
{
ThreadDumpAddress2(parg);
}
catch (std::exception& e) {
PrintException(&e, "ThreadDumpAddress()");
}
printf("ThreadDumpAddress exited\n");
}
void ThreadOpenConnections(void* parg)
{
// Make this thread recognisable as the connection opening thread
RenameThread("bitcoin-opencon");
try
{
vnThreadsRunning[THREAD_OPENCONNECTIONS]++;
ThreadOpenConnections2(parg);
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
PrintException(&e, "ThreadOpenConnections()");
} catch (...) {
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
PrintException(NULL, "ThreadOpenConnections()");
}
printf("ThreadOpenConnections exited\n");
}
void static ProcessOneShot()
{
string strDest;
{
LOCK(cs_vOneShots);
if (vOneShots.empty())
return;
strDest = vOneShots.front();
vOneShots.pop_front();
}
CAddress addr;
CSemaphoreGrant grant(*semOutbound, true);
if (grant) {
if (!OpenNetworkConnection(addr, &grant, strDest.c_str(), true))
AddOneShot(strDest);
}
}
// ppcoin: stake minter thread
void static ThreadStakeMinter(void* parg)
{
printf("ThreadStakeMinter started\n");
CWallet* pwallet = (CWallet*)parg;
try
{
vnThreadsRunning[THREAD_MINTER]++;
BitcoinMiner(pwallet, true);
vnThreadsRunning[THREAD_MINTER]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_MINTER]--;
PrintException(&e, "ThreadStakeMinter()");
} catch (...) {
vnThreadsRunning[THREAD_MINTER]--;
PrintException(NULL, "ThreadStakeMinter()");
}
printf("ThreadStakeMinter exiting, %d threads remaining\n", vnThreadsRunning[THREAD_MINTER]);
}
void ThreadOpenConnections2(void* parg)
{
printf("ThreadOpenConnections started\n");
// Connect to specific addresses
if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0)
{
for (int64 nLoop = 0;; nLoop++)
{
ProcessOneShot();
BOOST_FOREACH(string strAddr, mapMultiArgs["-connect"])
{
CAddress addr;
OpenNetworkConnection(addr, NULL, strAddr.c_str());
for (int i = 0; i < 10 && i < nLoop; i++)
{
Sleep(500);
if (fShutdown)
return;
}
}
Sleep(500);
}
}
// Initiate network connections
int64 nStart = GetTime();
loop
{
ProcessOneShot();
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
Sleep(500);
vnThreadsRunning[THREAD_OPENCONNECTIONS]++;
if (fShutdown)
return;
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
CSemaphoreGrant grant(*semOutbound);
vnThreadsRunning[THREAD_OPENCONNECTIONS]++;
if (fShutdown)
return;
// Add seed nodes
if (addrman.size()==0 && (GetTime() - nStart > 60) && !fTestNet)
{
std::vector<CAddress> vAdd;
for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)
{
// It'll only connect to one or two seed nodes because once it connects,
// it'll get a pile of addresses with newer timestamps.
// Seed nodes are given a random 'last seen time' of between one and two
// weeks ago.
const int64 nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));
addr.nTime = GetTime()-GetRand(nOneWeek)-nOneWeek;
vAdd.push_back(addr);
}
addrman.Add(vAdd, CNetAddr("127.0.0.1"));
}
//
// Choose an address to connect to based on most recently seen
//
CAddress addrConnect;
// Only connect out to one peer per network group (/16 for IPv4).
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
int nOutbound = 0;
set<vector<unsigned char> > setConnected;
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes) {
if (!pnode->fInbound) {
setConnected.insert(pnode->addr.GetGroup());
nOutbound++;
}
}
}
int64 nANow = GetAdjustedTime();
int nTries = 0;
loop
{
// use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
// if we selected an invalid address, restart
if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr))
break;
// If we didn't find an appropriate destination after trying 100 addresses fetched from addrman,
// stop this loop, and let the outer loop run again (which sleeps, adds seed nodes, recalculates
// already-connected network ranges, ...) before trying new addrman addresses.
nTries++;
if (nTries > 100)
break;
if (IsLimited(addr))
continue;
// only consider very recently tried nodes after 30 failed attempts
if (nANow - addr.nLastTry < 600 && nTries < 30)
continue;
// do not allow non-default ports, unless after 50 invalid addresses selected already
if (addr.GetPort() != GetDefaultPort() && nTries < 50)
continue;
addrConnect = addr;
break;
}
if (addrConnect.IsValid())
OpenNetworkConnection(addrConnect, &grant);
}
}
void ThreadOpenAddedConnections(void* parg)
{
// Make this thread recognisable as the connection opening thread
RenameThread("bitcoin-opencon");
try
{
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++;
ThreadOpenAddedConnections2(parg);
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
PrintException(&e, "ThreadOpenAddedConnections()");
} catch (...) {
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
PrintException(NULL, "ThreadOpenAddedConnections()");
}
printf("ThreadOpenAddedConnections exited\n");
}
void ThreadOpenAddedConnections2(void* parg)
{
printf("ThreadOpenAddedConnections started\n");
if (mapArgs.count("-addnode") == 0)
return;
if (HaveNameProxy()) {
while(!fShutdown) {
BOOST_FOREACH(string& strAddNode, mapMultiArgs["-addnode"]) {
CAddress addr;
CSemaphoreGrant grant(*semOutbound);
OpenNetworkConnection(addr, &grant, strAddNode.c_str());
Sleep(500);
}
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
Sleep(120000); // Retry every 2 minutes
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++;
}
return;
}
vector<vector<CService> > vservAddressesToAdd(0);
BOOST_FOREACH(string& strAddNode, mapMultiArgs["-addnode"])
{
vector<CService> vservNode(0);
if(Lookup(strAddNode.c_str(), vservNode, GetDefaultPort(), fNameLookup, 0))
{
vservAddressesToAdd.push_back(vservNode);
{
LOCK(cs_setservAddNodeAddresses);
BOOST_FOREACH(CService& serv, vservNode)
setservAddNodeAddresses.insert(serv);
}
}
}
loop
{
vector<vector<CService> > vservConnectAddresses = vservAddressesToAdd;
// Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry
// (keeping in mind that addnode entries can have many IPs if fNameLookup)
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
for (vector<vector<CService> >::iterator it = vservConnectAddresses.begin(); it != vservConnectAddresses.end(); it++)
BOOST_FOREACH(CService& addrNode, *(it))
if (pnode->addr == addrNode)
{
it = vservConnectAddresses.erase(it);
it--;
break;
}
}
BOOST_FOREACH(vector<CService>& vserv, vservConnectAddresses)
{
CSemaphoreGrant grant(*semOutbound);
OpenNetworkConnection(CAddress(*(vserv.begin())), &grant);
Sleep(500);
if (fShutdown)
return;
}
if (fShutdown)
return;
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]--;
Sleep(120000); // Retry every 2 minutes
vnThreadsRunning[THREAD_ADDEDCONNECTIONS]++;
if (fShutdown)
return;
}
}
// if successful, this moves the passed grant to the constructed node
bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOutbound, const char *strDest, bool fOneShot)
{
//
// Initiate outbound network connection
//
if (fShutdown)
return false;
if (!strDest)
if (IsLocal(addrConnect) ||
FindNode((CNetAddr)addrConnect) || CNode::IsBanned(addrConnect) ||
FindNode(addrConnect.ToStringIPPort().c_str()))
return false;
if (strDest && FindNode(strDest))
return false;
vnThreadsRunning[THREAD_OPENCONNECTIONS]--;
CNode* pnode = ConnectNode(addrConnect, strDest);
vnThreadsRunning[THREAD_OPENCONNECTIONS]++;
if (fShutdown)
return false;
if (!pnode)
return false;
if (grantOutbound)
grantOutbound->MoveTo(pnode->grantOutbound);
pnode->fNetworkNode = true;
if (fOneShot)
pnode->fOneShot = true;
return true;
}
void ThreadMessageHandler(void* parg)
{
// Make this thread recognisable as the message handling thread
RenameThread("bitcoin-msghand");
try
{
vnThreadsRunning[THREAD_MESSAGEHANDLER]++;
ThreadMessageHandler2(parg);
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
}
catch (std::exception& e) {
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
PrintException(&e, "ThreadMessageHandler()");
} catch (...) {
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
PrintException(NULL, "ThreadMessageHandler()");
}
printf("ThreadMessageHandler exited\n");
}
void ThreadMessageHandler2(void* parg)
{
printf("ThreadMessageHandler started\n");
SetThreadPriority(THREAD_PRIORITY_BELOW_NORMAL);
while (!fShutdown)
{
vector<CNode*> vNodesCopy;
{
LOCK(cs_vNodes);
vNodesCopy = vNodes;
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->AddRef();
}
// Poll the connected nodes for messages
CNode* pnodeTrickle = NULL;
if (!vNodesCopy.empty())
pnodeTrickle = vNodesCopy[GetRand(vNodesCopy.size())];
BOOST_FOREACH(CNode* pnode, vNodesCopy)
{
// Receive messages
{
TRY_LOCK(pnode->cs_vRecv, lockRecv);
if (lockRecv)
ProcessMessages(pnode);
}
if (fShutdown)
return;
// Send messages
{
TRY_LOCK(pnode->cs_vSend, lockSend);
if (lockSend)
SendMessages(pnode, pnode == pnodeTrickle);
}
if (fShutdown)
return;
}
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodesCopy)
pnode->Release();
}
// Wait and allow messages to bunch up.
// Reduce vnThreadsRunning so StopNode has permission to exit while
// we're sleeping, but we must always check fShutdown after doing this.
vnThreadsRunning[THREAD_MESSAGEHANDLER]--;
Sleep(100);
if (fRequestShutdown)
StartShutdown();
vnThreadsRunning[THREAD_MESSAGEHANDLER]++;
if (fShutdown)
return;
}
}
bool BindListenPort(const CService &addrBind, string& strError)
{
strError = "";
int nOne = 1;
#ifdef WIN32
// Initialize Windows Sockets
WSADATA wsadata;
int ret = WSAStartup(MAKEWORD(2,2), &wsadata);
if (ret != NO_ERROR)
{
strError = strprintf("Error: TCP/IP socket library failed to start (WSAStartup returned error %d)", ret);
printf("%s\n", strError.c_str());
return false;
}
#endif
// Create socket for listening for incoming connections
#ifdef USE_IPV6
struct sockaddr_storage sockaddr;
#else
struct sockaddr sockaddr;
#endif
socklen_t len = sizeof(sockaddr);
if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len))
{
strError = strprintf("Error: bind address family for %s not supported", addrBind.ToString().c_str());
printf("%s\n", strError.c_str());
return false;
}
SOCKET hListenSocket = socket(((struct sockaddr*)&sockaddr)->sa_family, SOCK_STREAM, IPPROTO_TCP);
if (hListenSocket == INVALID_SOCKET)
{
strError = strprintf("Error: Couldn't open socket for incoming connections (socket returned error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
#ifdef SO_NOSIGPIPE
// Different way of disabling SIGPIPE on BSD
setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, sizeof(int));
#endif
#ifndef WIN32
// Allow binding if the port is still in TIME_WAIT state after
// the program was closed and restarted. Not an issue on windows.
setsockopt(hListenSocket, SOL_SOCKET, SO_REUSEADDR, (void*)&nOne, sizeof(int));
#endif
#ifdef WIN32
// Set to non-blocking, incoming connections will also inherit this
if (ioctlsocket(hListenSocket, FIONBIO, (u_long*)&nOne) == SOCKET_ERROR)
#else
if (fcntl(hListenSocket, F_SETFL, O_NONBLOCK) == SOCKET_ERROR)
#endif
{
strError = strprintf("Error: Couldn't set properties on socket for incoming connections (error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
#ifdef USE_IPV6
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
// and enable it by default or not. Try to enable it, if possible.
if (addrBind.IsIPv6()) {
#ifdef IPV6_V6ONLY
#ifdef WIN32
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (const char*)&nOne, sizeof(int));
#else
setsockopt(hListenSocket, IPPROTO_IPV6, IPV6_V6ONLY, (void*)&nOne, sizeof(int));
#endif
#endif
#ifdef WIN32
int nProtLevel = 10 /* PROTECTION_LEVEL_UNRESTRICTED */;
int nParameterId = 23 /* IPV6_PROTECTION_LEVEl */;
// this call is allowed to fail
setsockopt(hListenSocket, IPPROTO_IPV6, nParameterId, (const char*)&nProtLevel, sizeof(int));
#endif
}
#endif
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
{
int nErr = WSAGetLastError();
if (nErr == WSAEADDRINUSE)
strError = strprintf(_("Unable to bind to %s on this computer. BitcoinFast is probably already running."), addrBind.ToString().c_str());
else
strError = strprintf(_("Unable to bind to %s on this computer (bind returned error %d, %s)"), addrBind.ToString().c_str(), nErr, strerror(nErr));
printf("%s\n", strError.c_str());
return false;
}
printf("Bound to %s\n", addrBind.ToString().c_str());
// Listen for incoming connections
if (listen(hListenSocket, SOMAXCONN) == SOCKET_ERROR)
{
strError = strprintf("Error: Listening for incoming connections failed (listen returned error %d)", WSAGetLastError());
printf("%s\n", strError.c_str());
return false;
}
vhListenSocket.push_back(hListenSocket);
if (addrBind.IsRoutable() && fDiscover)
AddLocal(addrBind, LOCAL_BIND);
return true;
}
void static Discover()
{
if (!fDiscover)
return;
#ifdef WIN32
// Get local host IP
char pszHostName[1000] = "";
if (gethostname(pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
{
vector<CNetAddr> vaddr;
if (LookupHost(pszHostName, vaddr))
{
BOOST_FOREACH (const CNetAddr &addr, vaddr)
{
AddLocal(addr, LOCAL_IF);
}
}
}
#else
// Get local host ip
struct ifaddrs* myaddrs;
if (getifaddrs(&myaddrs) == 0)
{
for (struct ifaddrs* ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next)
{
if (ifa->ifa_addr == NULL) continue;
if ((ifa->ifa_flags & IFF_UP) == 0) continue;
if (strcmp(ifa->ifa_name, "lo") == 0) continue;
if (strcmp(ifa->ifa_name, "lo0") == 0) continue;
if (ifa->ifa_addr->sa_family == AF_INET)
{
struct sockaddr_in* s4 = (struct sockaddr_in*)(ifa->ifa_addr);
CNetAddr addr(s4->sin_addr);
if (AddLocal(addr, LOCAL_IF))
printf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
}
#ifdef USE_IPV6
else if (ifa->ifa_addr->sa_family == AF_INET6)
{
struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
CNetAddr addr(s6->sin6_addr);
if (AddLocal(addr, LOCAL_IF))
printf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString().c_str());
}
#endif
}
freeifaddrs(myaddrs);
}
#endif
// Don't use external IPv4 discovery, when -onlynet="IPv6"
if (!IsLimited(NET_IPV4))
NewThread(ThreadGetMyExternalIP, NULL);
}
void StartNode(void* parg)
{
// Make this thread recognisable as the startup thread
RenameThread("bitcoin-start");
if (semOutbound == NULL) {
// initialize semaphore
int nMaxOutbound = min(MAX_OUTBOUND_CONNECTIONS, (int)GetArg("-maxconnections", 125));
semOutbound = new CSemaphore(nMaxOutbound);
}
if (pnodeLocalHost == NULL)
pnodeLocalHost = new CNode(INVALID_SOCKET, CAddress(CService("127.0.0.1", 0), nLocalServices));
Discover();
//
// Start threads
//
if (!GetBoolArg("-dnsseed", true))
printf("DNS seeding disabled\n");
else
if (!NewThread(ThreadDNSAddressSeed, NULL))
printf("Error: NewThread(ThreadDNSAddressSeed) failed\n");
/*
if (!GetBoolArg("-dnsseed", false))
printf("DNS seeding disabled\n");
if (GetBoolArg("-dnsseed", false))
printf("DNS seeding NYI\n");
*/
// Map ports with UPnP
if (fUseUPnP)
MapPort();
// Send and receive from sockets, accept connections
if (!NewThread(ThreadSocketHandler, NULL))
printf("Error: NewThread(ThreadSocketHandler) failed\n");
// Initiate outbound connections from -addnode
if (!NewThread(ThreadOpenAddedConnections, NULL))
printf("Error: NewThread(ThreadOpenAddedConnections) failed\n");
// Initiate outbound connections
if (!NewThread(ThreadOpenConnections, NULL))
printf("Error: NewThread(ThreadOpenConnections) failed\n");
// Process messages
if (!NewThread(ThreadMessageHandler, NULL))
printf("Error: NewThread(ThreadMessageHandler) failed\n");
// Dump network addresses
if (!NewThread(ThreadDumpAddress, NULL))
printf("Error; NewThread(ThreadDumpAddress) failed\n");
// ppcoin: mint proof-of-stake blocks in the background
if (!NewThread(ThreadStakeMinter, pwalletMain))
printf("Error: NewThread(ThreadStakeMinter) failed\n");
// Generate coins in the background
GenerateBitcoins(GetBoolArg("-gen", false), pwalletMain);
}
bool StopNode()
{
printf("StopNode()\n");
fShutdown = true;
nTransactionsUpdated++;
int64 nStart = GetTime();
if (semOutbound)
for (int i=0; i<MAX_OUTBOUND_CONNECTIONS; i++)
semOutbound->post();
do
{
int nThreadsRunning = 0;
for (int n = 0; n < THREAD_MAX; n++)
nThreadsRunning += vnThreadsRunning[n];
if (nThreadsRunning == 0)
break;
if (GetTime() - nStart > 20)
break;
Sleep(20);
} while(true);
if (vnThreadsRunning[THREAD_SOCKETHANDLER] > 0) printf("ThreadSocketHandler still running\n");
if (vnThreadsRunning[THREAD_OPENCONNECTIONS] > 0) printf("ThreadOpenConnections still running\n");
if (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0) printf("ThreadMessageHandler still running\n");
if (vnThreadsRunning[THREAD_MINER] > 0) printf("ThreadBitcoinMiner still running\n");
if (vnThreadsRunning[THREAD_RPCLISTENER] > 0) printf("ThreadRPCListener still running\n");
if (vnThreadsRunning[THREAD_RPCHANDLER] > 0) printf("ThreadsRPCServer still running\n");
#ifdef USE_UPNP
if (vnThreadsRunning[THREAD_UPNP] > 0) printf("ThreadMapPort still running\n");
#endif
if (vnThreadsRunning[THREAD_DNSSEED] > 0) printf("ThreadDNSAddressSeed still running\n");
if (vnThreadsRunning[THREAD_ADDEDCONNECTIONS] > 0) printf("ThreadOpenAddedConnections still running\n");
if (vnThreadsRunning[THREAD_DUMPADDRESS] > 0) printf("ThreadDumpAddresses still running\n");
if (vnThreadsRunning[THREAD_MINTER] > 0) printf("ThreadStakeMinter still running\n");
while (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0 || vnThreadsRunning[THREAD_RPCHANDLER] > 0)
Sleep(20);
Sleep(50);
DumpAddresses();
return true;
}
class CNetCleanup
{
public:
CNetCleanup()
{
}
~CNetCleanup()
{
// Close sockets
BOOST_FOREACH(CNode* pnode, vNodes)
if (pnode->hSocket != INVALID_SOCKET)
closesocket(pnode->hSocket);
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
if (hListenSocket != INVALID_SOCKET)
if (closesocket(hListenSocket) == SOCKET_ERROR)
printf("closesocket(hListenSocket) failed with error %d\n", WSAGetLastError());
#ifdef WIN32
// Shutdown Windows Sockets
WSACleanup();
#endif
}
}
instance_of_cnetcleanup;
|
/***************************************************************************
*
* Project _____ __ ____ _ _
* ( _ ) /__\ (_ _)_| |_ _| |_
* )(_)( /(__)\ )( (_ _)(_ _)
* (_____)(__)(__)(__) |_| |_|
*
*
* Copyright 2018-present, Leonid Stryzhevskyi, <lganzzzo@gmail.com>
*
* 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.
*
***************************************************************************/
#ifndef oatpp_test_UnitTest_hpp
#define oatpp_test_UnitTest_hpp
#include "oatpp/core/base/Environment.hpp"
namespace oatpp { namespace test {
class UnitTest{
protected:
const char* const TAG;
public:
UnitTest(const char* testTAG)
: TAG(testTAG)
{}
virtual ~UnitTest(){
}
v_int64 getTickCount();
bool run(v_int32 times);
bool run(){
return run(1);
}
virtual bool onRun() = 0;
template<class T>
static void runTest(v_int32 times){
T test;
test.run(times);
}
};
#define OATPP_RUN_TEST(TEST) oatpp::test::UnitTest::runTest<TEST>(1)
}}
#endif /* oatpp_test_UnitTest_hpp */
|
/******************************************************************************
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Implements OGRGeomediaDataSource class.
* Author: Even Rouault, <even dot rouault at mines dash paris dot org>
*
******************************************************************************
* Copyright (c) 2011-2013, Even Rouault <even dot rouault at mines-paris dot org>
* Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
*
* 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.
****************************************************************************/
#include "ogr_geomedia.h"
#include "ogrgeomediageometry.h"
#include "cpl_conv.h"
#include "cpl_string.h"
#include <vector>
CPL_CVSID("$Id: ogrgeomediadatasource.cpp 4971449609881d6ffdca70188292293852d12691 2017-12-17 16:48:14Z Even Rouault $")
/************************************************************************/
/* OGRGeomediaDataSource() */
/************************************************************************/
OGRGeomediaDataSource::OGRGeomediaDataSource() :
papoLayers(nullptr),
nLayers(0),
papoLayersInvisible(nullptr),
nLayersWithInvisible(0),
pszName(nullptr),
bDSUpdate(FALSE)
{}
/************************************************************************/
/* ~OGRGeomediaDataSource() */
/************************************************************************/
OGRGeomediaDataSource::~OGRGeomediaDataSource()
{
CPLFree( pszName );
for( int i = 0; i < nLayers; i++ )
delete papoLayers[i];
CPLFree( papoLayers );
for( int i = 0; i < nLayersWithInvisible; i++ )
delete papoLayersInvisible[i];
CPLFree( papoLayersInvisible );
}
/************************************************************************/
/* CheckDSNStringTemplate() */
/* The string will be used as the formatting argument of sprintf with */
/* a string in vararg. So let's check there's only one '%s', and nothing*/
/* else */
/************************************************************************/
static int CheckDSNStringTemplate(const char* pszStr)
{
int nPercentSFound = FALSE;
while(*pszStr)
{
if (*pszStr == '%')
{
if (pszStr[1] != 's')
{
return FALSE;
}
else
{
if (nPercentSFound)
return FALSE;
nPercentSFound = TRUE;
}
}
pszStr ++;
}
return TRUE;
}
/************************************************************************/
/* Open() */
/************************************************************************/
int OGRGeomediaDataSource::Open( const char * pszNewName, int bUpdate,
CPL_UNUSED int bTestOpen )
{
CPLAssert( nLayers == 0 );
/* -------------------------------------------------------------------- */
/* If this is the name of an MDB file, then construct the */
/* appropriate connection string. Otherwise clip of GEOMEDIA: to */
/* get the DSN. */
/* */
/* -------------------------------------------------------------------- */
char *pszDSN = nullptr;
if( STARTS_WITH_CI(pszNewName, "GEOMEDIA:") )
pszDSN = CPLStrdup( pszNewName + 9 );
else
{
const char *pszDSNStringTemplate =
CPLGetConfigOption( "GEOMEDIA_DRIVER_TEMPLATE",
"DRIVER=Microsoft Access Driver (*.mdb);DBQ=%s");
if (!CheckDSNStringTemplate(pszDSNStringTemplate))
{
CPLError( CE_Failure, CPLE_AppDefined,
"Illegal value for GEOMEDIA_DRIVER_TEMPLATE option");
return FALSE;
}
pszDSN = (char *) CPLMalloc(strlen(pszNewName)+strlen(pszDSNStringTemplate)+100);
/* coverity[tainted_string] */
snprintf( pszDSN,
strlen(pszNewName)+strlen(pszDSNStringTemplate)+100,
pszDSNStringTemplate, pszNewName );
}
/* -------------------------------------------------------------------- */
/* Initialize based on the DSN. */
/* -------------------------------------------------------------------- */
CPLDebug( "Geomedia", "EstablishSession(%s)", pszDSN );
if( !oSession.EstablishSession( pszDSN, nullptr, nullptr ) )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to initialize ODBC connection to DSN for %s,\n"
"%s", pszDSN, oSession.GetLastError() );
CPLFree( pszDSN );
return FALSE;
}
CPLFree( pszDSN );
pszName = CPLStrdup( pszNewName );
bDSUpdate = bUpdate;
/* -------------------------------------------------------------------- */
/* Collect list of tables and their supporting info from */
/* GAliasTable. */
/* -------------------------------------------------------------------- */
CPLString osGFeaturesTable = GetTableNameFromType("INGRFeatures");
if (osGFeaturesTable.empty())
return FALSE;
CPLString osGeometryProperties = GetTableNameFromType("INGRGeometryProperties");
CPLString osGCoordSystemTable = GetTableNameFromType("GCoordSystemTable");
std::vector<char **> apapszGeomColumns;
{
CPLODBCStatement oStmt( &oSession );
oStmt.Appendf( "SELECT FeatureName, PrimaryGeometryFieldName FROM %s", osGFeaturesTable.c_str() );
if( !oStmt.ExecuteSQL() )
{
CPLDebug( "GEOMEDIA",
"SELECT on %s fails, perhaps not a geomedia geodatabase?\n%s",
osGFeaturesTable.c_str(),
oSession.GetLastError() );
return FALSE;
}
while( oStmt.Fetch() )
{
int i, iNew = static_cast<int>(apapszGeomColumns.size());
char **papszRecord = nullptr;
for( i = 0; i < 2; i++ )
papszRecord = CSLAddString( papszRecord,
oStmt.GetColData(i) );
apapszGeomColumns.resize(iNew+1);
apapszGeomColumns[iNew] = papszRecord;
}
}
std::vector<OGRSpatialReference*> apoSRS;
if (!osGeometryProperties.empty() && !osGCoordSystemTable.empty())
{
std::vector<CPLString> aosGUID;
{
CPLODBCStatement oStmt( &oSession );
oStmt.Appendf( "SELECT GCoordSystemGUID FROM %s", osGeometryProperties.c_str() );
if( !oStmt.ExecuteSQL() )
{
CPLDebug( "GEOMEDIA",
"SELECT on %s fails, perhaps not a geomedia geodatabase?\n%s",
osGeometryProperties.c_str(),
oSession.GetLastError() );
return FALSE;
}
while( oStmt.Fetch() )
{
aosGUID.push_back(oStmt.GetColData(0));
}
if (apapszGeomColumns.size() != aosGUID.size())
{
CPLDebug( "GEOMEDIA", "%s and %s don't have the same size",
osGFeaturesTable.c_str(), osGeometryProperties.c_str() );
return FALSE;
}
}
for( size_t i = 0; i < aosGUID.size(); i++ )
{
apoSRS.push_back(GetGeomediaSRS(osGCoordSystemTable, aosGUID[i]));
}
}
/* -------------------------------------------------------------------- */
/* Create a layer for each spatial table. */
/* -------------------------------------------------------------------- */
papoLayers = (OGRGeomediaLayer **) CPLCalloc(apapszGeomColumns.size(),
sizeof(void*));
for( unsigned int iTable = 0; iTable < apapszGeomColumns.size(); iTable++ )
{
char **papszRecord = apapszGeomColumns[iTable];
OGRGeomediaTableLayer *poLayer = new OGRGeomediaTableLayer( this );
if( poLayer->Initialize( papszRecord[0], papszRecord[1], (apoSRS.size()) ? apoSRS[iTable] : nullptr )
!= CE_None )
{
delete poLayer;
}
else
{
papoLayers[nLayers++] = poLayer;
}
CSLDestroy(papszRecord);
}
return TRUE;
}
/************************************************************************/
/* GetTableNameFromType() */
/************************************************************************/
CPLString OGRGeomediaDataSource::GetTableNameFromType(const char* pszTableType)
{
CPLODBCStatement oStmt( &oSession );
oStmt.Appendf( "SELECT TableName FROM GAliasTable WHERE TableType = '%s'", pszTableType );
if( !oStmt.ExecuteSQL() )
{
CPLDebug( "GEOMEDIA",
"SELECT for %s on GAliasTable fails, perhaps not a geomedia geodatabase?\n%s",
pszTableType,
oSession.GetLastError() );
return "";
}
while( oStmt.Fetch() )
{
return oStmt.GetColData(0);
}
return "";
}
/************************************************************************/
/* GetGeomediaSRS() */
/************************************************************************/
OGRSpatialReference* OGRGeomediaDataSource::GetGeomediaSRS(const char* pszGCoordSystemTable,
const char* pszGCoordSystemGUID)
{
if (pszGCoordSystemTable == nullptr || pszGCoordSystemGUID == nullptr)
return nullptr;
OGRLayer* poGCoordSystemTable = GetLayerByName(pszGCoordSystemTable);
if (poGCoordSystemTable == nullptr)
return nullptr;
poGCoordSystemTable->ResetReading();
OGRFeature* poFeature = nullptr;
while((poFeature = poGCoordSystemTable->GetNextFeature()) != nullptr)
{
const char* pszCSGUID = poFeature->GetFieldAsString("CSGUID");
if (pszCSGUID && strcmp(pszCSGUID, pszGCoordSystemGUID) == 0)
{
OGRSpatialReference* poSRS = OGRGetGeomediaSRS(poFeature);
delete poFeature;
return poSRS;
}
delete poFeature;
}
return nullptr;
}
/************************************************************************/
/* TestCapability() */
/************************************************************************/
int OGRGeomediaDataSource::TestCapability( CPL_UNUSED const char * pszCap )
{
return FALSE;
}
/************************************************************************/
/* GetLayer() */
/************************************************************************/
OGRLayer *OGRGeomediaDataSource::GetLayer( int iLayer )
{
if( iLayer < 0 || iLayer >= nLayers )
return nullptr;
else
return papoLayers[iLayer];
}
/************************************************************************/
/* GetLayerByName() */
/************************************************************************/
OGRLayer *OGRGeomediaDataSource::GetLayerByName( const char* pszNameIn )
{
if (pszNameIn == nullptr)
return nullptr;
OGRLayer* poLayer = OGRDataSource::GetLayerByName(pszNameIn);
if (poLayer)
return poLayer;
for( int i = 0; i < nLayersWithInvisible; i++ )
{
poLayer = papoLayersInvisible[i];
if( strcmp( pszNameIn, poLayer->GetName() ) == 0 )
return poLayer;
}
OGRGeomediaTableLayer *poGeomediaLayer = new OGRGeomediaTableLayer( this );
if( poGeomediaLayer->Initialize(pszNameIn, nullptr, nullptr) != CE_None )
{
delete poGeomediaLayer;
return nullptr;
}
papoLayersInvisible = (OGRGeomediaLayer**)CPLRealloc(papoLayersInvisible,
(nLayersWithInvisible+1) * sizeof(OGRGeomediaLayer*));
papoLayersInvisible[nLayersWithInvisible++] = poGeomediaLayer;
return poGeomediaLayer;
}
/************************************************************************/
/* ExecuteSQL() */
/************************************************************************/
OGRLayer * OGRGeomediaDataSource::ExecuteSQL( const char *pszSQLCommand,
OGRGeometry *poSpatialFilter,
const char *pszDialect )
{
/* -------------------------------------------------------------------- */
/* Use generic implementation for recognized dialects */
/* -------------------------------------------------------------------- */
if( IsGenericSQLDialect(pszDialect) )
return OGRDataSource::ExecuteSQL( pszSQLCommand,
poSpatialFilter,
pszDialect );
/* -------------------------------------------------------------------- */
/* Execute statement. */
/* -------------------------------------------------------------------- */
CPLODBCStatement *poStmt = new CPLODBCStatement( &oSession );
poStmt->Append( pszSQLCommand );
if( !poStmt->ExecuteSQL() )
{
CPLError( CE_Failure, CPLE_AppDefined,
"%s", oSession.GetLastError() );
delete poStmt;
return nullptr;
}
/* -------------------------------------------------------------------- */
/* Are there result columns for this statement? */
/* -------------------------------------------------------------------- */
if( poStmt->GetColCount() == 0 )
{
delete poStmt;
CPLErrorReset();
return nullptr;
}
/* -------------------------------------------------------------------- */
/* Create a results layer. It will take ownership of the */
/* statement. */
/* -------------------------------------------------------------------- */
OGRGeomediaSelectLayer *poLayer =
new OGRGeomediaSelectLayer( this, poStmt );
if( poSpatialFilter != nullptr )
poLayer->SetSpatialFilter( poSpatialFilter );
return poLayer;
}
/************************************************************************/
/* ReleaseResultSet() */
/************************************************************************/
void OGRGeomediaDataSource::ReleaseResultSet( OGRLayer * poLayer )
{
delete poLayer;
}
|
/*
MANGO Multimedia Development Platform
Copyright (C) 2012-2021 Twilight Finland 3D Oy Ltd. All rights reserved.
*/
#pragma once
#include <cmath>
#include <algorithm>
#include <type_traits>
#include <mango/core/configure.hpp>
#include <mango/core/half.hpp>
#include <mango/core/bits.hpp>
// ------------------------------------------------------------------
// Configure SIMD implementation
// ------------------------------------------------------------------
namespace mango::simd
{
using f16 = float16;
using f32 = float32;
using f64 = float64;
// --------------------------------------------------------------
// SIMD vector base classes
// --------------------------------------------------------------
// The C++ does not have strong typedef:
// Wrap the hardware-supported SIMD vector types so that we get
// strong types for the compiler to be able to resolve the overloads
// when the underlying types are identical.
template <int ScalarBits, int VectorSize, typename MaskType>
struct hardware_mask
{
MaskType data;
hardware_mask() = default;
hardware_mask(MaskType mask)
: data(mask)
{
}
operator MaskType () const
{
return data;
}
};
template <typename ScalarType, int VectorSize, typename VectorType>
struct hardware_vector
{
using scalar = ScalarType;
using vector = VectorType;
enum
{
scalar_bits = sizeof(ScalarType) * 8,
vector_bits = sizeof(VectorType) * 8,
size = VectorSize,
is_hardware = 1,
is_composite = 0
};
VectorType data;
hardware_vector() = default;
hardware_vector(VectorType v)
: data(v)
{
}
operator VectorType () const
{
return data;
}
};
// Scalar Emulated vector types not supported by hardware instructions
template <int ScalarBits, int VectorSize>
struct scalar_mask
{
u32 mask;
scalar_mask() = default;
scalar_mask(u32 mask)
: mask(mask)
{
}
operator u32 () const
{
return mask;
}
};
template <typename ScalarType, int VectorSize>
struct scalar_vector
{
using scalar = ScalarType;
using vector = void;
enum
{
scalar_bits = sizeof(ScalarType) * 8,
vector_bits = sizeof(ScalarType) * VectorSize * 8,
size = VectorSize,
is_hardware = 0,
is_composite = 0
};
ScalarType data[VectorSize];
ScalarType & operator [] (int index)
{
return data[index];
}
const ScalarType & operator [] (int index) const
{
return data[index];
}
};
// Vector types implemented as separate low/high parts, which typically have hardware support
template <typename VectorType>
struct composite_mask
{
VectorType lo;
VectorType hi;
};
template <typename VectorType>
struct composite_vector
{
using scalar = typename VectorType::scalar;
using vector = void;
enum
{
scalar_bits = sizeof(scalar) * 8,
vector_bits = sizeof(VectorType) * 2 * 8,
size = VectorType::size * 2,
is_hardware = VectorType::is_hardware,
is_composite = 1
};
VectorType lo;
VectorType hi;
composite_vector() = default;
composite_vector(VectorType lo, VectorType hi)
: lo(lo)
, hi(hi)
{
}
};
} // namespace mango::simd
#if defined(MANGO_ENABLE_AVX512)
namespace mango::simd
{
// --------------------------------------------------------------
// Intel AVX512 vector intrinsics
// --------------------------------------------------------------
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define int256_is_hardware_vector
#define int512_is_hardware_vector
#define float128_is_hardware_vector
#define float256_is_hardware_vector
#define float512_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, __m128i>;
using s16x8 = hardware_vector<s16, 8, __m128i>;
using s32x4 = hardware_vector<s32, 4, __m128i>;
using s64x2 = hardware_vector<s64, 2, __m128i>;
using u8x16 = hardware_vector<u8, 16, __m128i>;
using u16x8 = hardware_vector<u16, 8, __m128i>;
using u32x4 = hardware_vector<u32, 4, __m128i>;
using u64x2 = hardware_vector<u64, 2, __m128i>;
using f32x4 = hardware_vector<f32, 4, __m128>;
using f64x2 = hardware_vector<f64, 2, __m128d>;
// 256 bit vector
using s8x32 = hardware_vector<s8, 32, __m256i>;
using s16x16 = hardware_vector<s16, 16, __m256i>;
using s32x8 = hardware_vector<s32, 8, __m256i>;
using s64x4 = hardware_vector<s64, 4, __m256i>;
using u8x32 = hardware_vector<u8, 32, __m256i>;
using u16x16 = hardware_vector<u16, 16, __m256i>;
using u32x8 = hardware_vector<u32, 8, __m256i>;
using u64x4 = hardware_vector<u64, 4, __m256i>;
using f32x8 = hardware_vector<f32, 8, __m256>;
using f64x4 = hardware_vector<f64, 4, __m256d>;
// 512 bit vector
using s8x64 = hardware_vector<s8, 64, __m512i>;
using s16x32 = hardware_vector<s16, 32, __m512i>;
using s32x16 = hardware_vector<s32, 16, __m512i>;
using s64x8 = hardware_vector<s64, 8, __m512i>;
using u8x64 = hardware_vector<u8, 64, __m512i>;
using u16x32 = hardware_vector<u16, 32, __m512i>;
using u32x16 = hardware_vector<u32, 16, __m512i>;
using u64x8 = hardware_vector<u64, 8, __m512i>;
using f32x16 = hardware_vector<f32, 16, __m512>;
using f64x8 = hardware_vector<f64, 8, __m512d>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, __mmask16>;
using mask16x8 = hardware_mask<16, 8, __mmask8>;
using mask32x4 = hardware_mask<32, 4, __mmask8>;
using mask64x2 = hardware_mask<64, 2, __mmask8>;
// 256 bit vector mask
using mask8x32 = hardware_mask<8, 32, __mmask32>;
using mask16x16 = hardware_mask<16, 16, __mmask16>;
using mask32x8 = hardware_mask<32, 8, __mmask8>;
using mask64x4 = hardware_mask<64, 4, __mmask8>;
// 512 bit vector mask
using mask8x64 = hardware_mask<8, 64, __mmask64>;
using mask16x32 = hardware_mask<16, 32, __mmask32>;
using mask32x16 = hardware_mask<32, 16, __mmask16>;
using mask64x8 = hardware_mask<64, 8, __mmask8>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/avx512_float128.hpp>
#include <mango/simd/avx512_float256.hpp>
#include <mango/simd/avx512_float512.hpp>
#include <mango/simd/avx512_double128.hpp>
#include <mango/simd/avx512_double256.hpp>
#include <mango/simd/avx512_double512.hpp>
#include <mango/simd/avx512_int128.hpp>
#include <mango/simd/avx512_int256.hpp>
#include <mango/simd/avx512_int512.hpp>
#include <mango/simd/avx512_convert.hpp>
#include <mango/simd/avx512_gather.hpp>
#elif defined(MANGO_ENABLE_AVX2)
namespace mango::simd
{
// --------------------------------------------------------------
// Intel AVX2 vector intrinsics
// --------------------------------------------------------------
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define int256_is_hardware_vector
#define float128_is_hardware_vector
#define float256_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, __m128i>;
using s16x8 = hardware_vector<s16, 8, __m128i>;
using s32x4 = hardware_vector<s32, 4, __m128i>;
using s64x2 = hardware_vector<s64, 2, __m128i>;
using u8x16 = hardware_vector<u8, 16, __m128i>;
using u16x8 = hardware_vector<u16, 8, __m128i>;
using u32x4 = hardware_vector<u32, 4, __m128i>;
using u64x2 = hardware_vector<u64, 2, __m128i>;
using f32x4 = hardware_vector<f32, 4, __m128>;
using f64x2 = hardware_vector<f64, 2, __m128d>;
// 256 bit vector
using s8x32 = hardware_vector<s8, 32, __m256i>;
using s16x16 = hardware_vector<s16, 16, __m256i>;
using s32x8 = hardware_vector<s32, 8, __m256i>;
using s64x4 = hardware_vector<s64, 4, __m256i>;
using u8x32 = hardware_vector<u8, 32, __m256i>;
using u16x16 = hardware_vector<u16, 16, __m256i>;
using u32x8 = hardware_vector<u32, 8, __m256i>;
using u64x4 = hardware_vector<u64, 4, __m256i>;
using f32x8 = hardware_vector<f32, 8, __m256>;
using f64x4 = hardware_vector<f64, 4, __m256d>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, __m128i>;
using mask16x8 = hardware_mask<16, 8, __m128i>;
using mask32x4 = hardware_mask<32, 4, __m128i>;
using mask64x2 = hardware_mask<64, 2, __m128i>;
// 256 bit vector mask
using mask8x32 = hardware_mask<8, 32, __m256i>;
using mask16x16 = hardware_mask<16, 16, __m256i>;
using mask32x8 = hardware_mask<32, 8, __m256i>;
using mask64x4 = hardware_mask<64, 4, __m256i>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/sse2_int128.hpp>
#include <mango/simd/sse2_float128.hpp>
#include <mango/simd/sse2_double128.hpp>
#include <mango/simd/avx2_int256.hpp>
#include <mango/simd/avx_float256.hpp>
#include <mango/simd/avx_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/avx_convert.hpp>
#include <mango/simd/avx2_gather.hpp>
#elif defined(MANGO_ENABLE_AVX)
namespace mango::simd
{
// --------------------------------------------------------------
// Intel AVX vector intrinsics
// --------------------------------------------------------------
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define float128_is_hardware_vector
#define float256_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, __m128i>;
using s16x8 = hardware_vector<s16, 8, __m128i>;
using s32x4 = hardware_vector<s32, 4, __m128i>;
using s64x2 = hardware_vector<s64, 2, __m128i>;
using u8x16 = hardware_vector<u8, 16, __m128i>;
using u16x8 = hardware_vector<u16, 8, __m128i>;
using u32x4 = hardware_vector<u32, 4, __m128i>;
using u64x2 = hardware_vector<u64, 2, __m128i>;
using f32x4 = hardware_vector<f32, 4, __m128>;
using f64x2 = hardware_vector<f64, 2, __m128d>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = hardware_vector<f32, 8, __m256>;
using f64x4 = hardware_vector<f64, 4, __m256d>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, __m128i>;
using mask16x8 = hardware_mask<16, 8, __m128i>;
using mask32x4 = hardware_mask<32, 4, __m128i>;
using mask64x2 = hardware_mask<64, 2, __m128i>;
// 256 bit vector mask
using mask8x32 = hardware_mask<8, 32, __m256i>;
using mask16x16 = hardware_mask<16, 16, __m256i>;
using mask32x8 = hardware_mask<32, 8, __m256i>;
using mask64x4 = hardware_mask<64, 4, __m256i>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/sse2_int128.hpp>
#include <mango/simd/sse2_float128.hpp>
#include <mango/simd/sse2_double128.hpp>
#include <mango/simd/avx_int256.hpp>
#include <mango/simd/avx_float256.hpp>
#include <mango/simd/avx_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/avx_convert.hpp>
#include <mango/simd/common_gather.hpp>
#elif defined(MANGO_ENABLE_SSE2)
namespace mango::simd
{
// --------------------------------------------------------------
// Intel SSE2 vector intrinsics
// --------------------------------------------------------------
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define float128_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, __m128i>;
using s16x8 = hardware_vector<s16, 8, __m128i>;
using s32x4 = hardware_vector<s32, 4, __m128i>;
using s64x2 = hardware_vector<s64, 2, __m128i>;
using u8x16 = hardware_vector<u8, 16, __m128i>;
using u16x8 = hardware_vector<u16, 8, __m128i>;
using u32x4 = hardware_vector<u32, 4, __m128i>;
using u64x2 = hardware_vector<u64, 2, __m128i>;
using f32x4 = hardware_vector<f32, 4, __m128>;
using f64x2 = hardware_vector<f64, 2, __m128d>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = composite_vector<f32x4>;
using f64x4 = composite_vector<f64x2>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, __m128i>;
using mask16x8 = hardware_mask<16, 8, __m128i>;
using mask32x4 = hardware_mask<32, 4, __m128i>;
using mask64x2 = hardware_mask<64, 2, __m128i>;
// 256 bit vector mask
using mask8x32 = composite_mask<mask8x16>;
using mask16x16 = composite_mask<mask16x8>;
using mask32x8 = composite_mask<mask32x4>;
using mask64x4 = composite_mask<mask64x2>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/sse2_int128.hpp>
#include <mango/simd/sse2_float128.hpp>
#include <mango/simd/sse2_double128.hpp>
#include <mango/simd/composite_int256.hpp>
#include <mango/simd/composite_float256.hpp>
#include <mango/simd/composite_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/sse2_convert.hpp>
#include <mango/simd/common_gather.hpp>
#elif defined(MANGO_ENABLE_NEON)
namespace mango::simd
{
// --------------------------------------------------------------
// ARM NEON vector instrinsics
// --------------------------------------------------------------
// http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0491f/BABDFJCI.html
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0073a/IHI0073A_arm_neon_intrinsics_ref.pdf
// http://kib.kiev.ua/x86docs/ARMARM/DDI0487A_e_armv8_arm.pdf
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define float128_is_hardware_vector
#ifndef __aarch64__
struct float64x2_t
{
f64 data[2];
float64x2_t() = default;
float64x2_t(f64 x, f64 y) { data[0] = x; data[1] = y; }
f64 & operator [] (int index) { return data[index]; }
const f64 & operator [] (int index) const { return data[index]; }
};
#endif
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
#ifdef MANGO_ENABLE_FP16
using f16x4 = hardware_vector<f16, 4, float16x4_t>;
#else
using f16x4 = scalar_vector<f16, 4>;
#endif
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, int8x16_t>;
using s16x8 = hardware_vector<s16, 8, int16x8_t>;
using s32x4 = hardware_vector<s32, 4, int32x4_t>;
using s64x2 = hardware_vector<s64, 2, int64x2_t>;
using u8x16 = hardware_vector<u8, 16, uint8x16_t>;
using u16x8 = hardware_vector<u16, 8, uint16x8_t>;
using u32x4 = hardware_vector<u32, 4, uint32x4_t>;
using u64x2 = hardware_vector<u64, 2, uint64x2_t>;
using f32x4 = hardware_vector<f32, 4, float32x4_t>;
using f64x2 = hardware_vector<f64, 2, float64x2_t>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = composite_vector<f32x4>;
using f64x4 = composite_vector<f64x2>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, uint8x16_t>;
using mask16x8 = hardware_mask<16, 8, uint16x8_t>;
using mask32x4 = hardware_mask<32, 4, uint32x4_t>;
using mask64x2 = hardware_mask<64, 2, uint64x2_t>;
// 256 bit vector mask
using mask8x32 = composite_mask<mask8x16>;
using mask16x16 = composite_mask<mask16x8>;
using mask32x8 = composite_mask<mask32x4>;
using mask64x4 = composite_mask<mask64x2>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/neon_int128.hpp>
#include <mango/simd/neon_float128.hpp>
#include <mango/simd/neon_double128.hpp>
#include <mango/simd/composite_double256.hpp>
#include <mango/simd/composite_int256.hpp>
#include <mango/simd/composite_float256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/neon_convert.hpp>
#include <mango/simd/common_gather.hpp>
#elif defined(MANGO_ENABLE_ALTIVEC) && defined(MANGO_ENABLE_VSX)
#include <altivec.h>
//#include <builtins.h>
namespace mango::simd
{
// --------------------------------------------------------------
// Altivec / VSX
// --------------------------------------------------------------
// https://www.nxp.com/docs/en/reference-manual/ALTIVECPIM.pdf
// https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.cbcpx01/vectorbltin.htm
// https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.2/com.ibm.xlc131.aix.doc/compiler_ref/vec_intrin_cpp.html
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define float128_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, __vector signed char>;
using s16x8 = hardware_vector<s16, 8, __vector signed short>;
using s32x4 = hardware_vector<s32, 4, __vector signed int>;
using s64x2 = hardware_vector<s64, 2, __vector signed long long>;
using u8x16 = hardware_vector<u8, 16, __vector unsigned char>;
using u16x8 = hardware_vector<u16, 8, __vector unsigned short>;
using u32x4 = hardware_vector<u32, 4, __vector unsigned int>;
using u64x2 = hardware_vector<u64, 2, __vector unsigned long long>;
using f32x4 = hardware_vector<f32, 4, __vector float>;
using f64x2 = hardware_vector<f64, 2, __vector double>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = composite_vector<f32x4>;
using f64x4 = composite_vector<f64x2>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, __vector bool char>;
using mask16x8 = hardware_mask<16, 8, __vector bool short>;
using mask32x4 = hardware_mask<32, 4, __vector bool int>;
using mask64x2 = hardware_mask<64, 2, __vector bool long long>;
// 256 bit vector mask
using mask8x32 = composite_mask<mask8x16>;
using mask16x16 = composite_mask<mask16x8>;
using mask32x8 = composite_mask<mask32x4>;
using mask64x4 = composite_mask<mask64x2>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
// <altivec.h> defined these; clean up
#undef bool
#undef vector
#undef pixel
#undef __bool
#undef __vector
#undef __pixel
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/altivec_int128.hpp>
#include <mango/simd/altivec_float128.hpp>
#include <mango/simd/altivec_double128.hpp>
#include <mango/simd/composite_int256.hpp>
#include <mango/simd/composite_float256.hpp>
#include <mango/simd/composite_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/altivec_convert.hpp>
#include <mango/simd/common_gather.hpp>
#elif defined(MANGO_ENABLE_MSA)
namespace mango::simd
{
// --------------------------------------------------------------
// MIPS MSA
// --------------------------------------------------------------
#define MANGO_ENABLE_SIMD
#define int128_is_hardware_vector
#define float128_is_hardware_vector
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = hardware_vector<s8, 16, v16i8>;
using s16x8 = hardware_vector<s16, 8, v8i16>;
using s32x4 = hardware_vector<s32, 4, v4i32>;
using s64x2 = hardware_vector<s64, 2, v2i64>;
using u8x16 = hardware_vector<u8, 16, v16u8>;
using u16x8 = hardware_vector<u16, 8, v8u16>;
using u32x4 = hardware_vector<u32, 4, v4u32>;
using u64x2 = hardware_vector<u64, 2, v2u64>;
using f32x4 = hardware_vector<f32, 4, v4f32>;
using f64x2 = hardware_vector<f64, 2, v2f64>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = composite_vector<f32x4>;
using f64x4 = composite_vector<f64x2>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = hardware_mask<8, 16, v16u8>;
using mask16x8 = hardware_mask<16, 8, v8u16>;
using mask32x4 = hardware_mask<32, 4, v4u32>;
using mask64x2 = hardware_mask<64, 2, v2u64>;
// 256 bit vector mask
using mask8x32 = composite_mask<mask8x16>;
using mask16x16 = composite_mask<mask16x8>;
using mask32x8 = composite_mask<mask32x4>;
using mask64x4 = composite_mask<mask64x2>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/msa_int128.hpp>
#include <mango/simd/msa_float128.hpp>
#include <mango/simd/msa_double128.hpp>
#include <mango/simd/composite_int256.hpp>
#include <mango/simd/composite_float256.hpp>
#include <mango/simd/composite_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/msa_convert.hpp>
#include <mango/simd/common_gather.hpp>
#else
namespace mango::simd
{
// --------------------------------------------------------------
// SIMD emulation
// --------------------------------------------------------------
// 64 bit vector
using s32x2 = scalar_vector<s32, 2>;
using u32x2 = scalar_vector<u32, 2>;
using f32x2 = scalar_vector<f32, 2>;
using f16x4 = scalar_vector<f16, 4>;
// 128 bit vector
using s8x16 = scalar_vector<s8, 16>;
using s16x8 = scalar_vector<s16, 8>;
using s32x4 = scalar_vector<s32, 4>;
using s64x2 = scalar_vector<s64, 2>;
using u8x16 = scalar_vector<u8, 16>;
using u16x8 = scalar_vector<u16, 8>;
using u32x4 = scalar_vector<u32, 4>;
using u64x2 = scalar_vector<u64, 2>;
using f32x4 = scalar_vector<f32, 4>;
using f64x2 = scalar_vector<f64, 2>;
// 256 bit vector
using s8x32 = composite_vector<s8x16>;
using s16x16 = composite_vector<s16x8>;
using s32x8 = composite_vector<s32x4>;
using s64x4 = composite_vector<s64x2>;
using u8x32 = composite_vector<u8x16>;
using u16x16 = composite_vector<u16x8>;
using u32x8 = composite_vector<u32x4>;
using u64x4 = composite_vector<u64x2>;
using f32x8 = composite_vector<f32x4>;
using f64x4 = composite_vector<f64x2>;
// 512 bit vector
using s8x64 = composite_vector<s8x32>;
using s16x32 = composite_vector<s16x16>;
using s32x16 = composite_vector<s32x8>;
using s64x8 = composite_vector<s64x4>;
using u8x64 = composite_vector<u8x32>;
using u16x32 = composite_vector<u16x16>;
using u32x16 = composite_vector<u32x8>;
using u64x8 = composite_vector<u64x4>;
using f32x16 = composite_vector<f32x8>;
using f64x8 = composite_vector<f64x4>;
// 128 bit vector mask
using mask8x16 = scalar_mask<8, 16>;
using mask16x8 = scalar_mask<16, 8>;
using mask32x4 = scalar_mask<32, 4>;
using mask64x2 = scalar_mask<64, 2>;
// 256 bit vector mask
using mask8x32 = composite_mask<mask8x16>;
using mask16x16 = composite_mask<mask16x8>;
using mask32x8 = composite_mask<mask32x4>;
using mask64x4 = composite_mask<mask64x2>;
// 512 bit vector mask
using mask8x64 = composite_mask<mask8x32>;
using mask16x32 = composite_mask<mask16x16>;
using mask32x16 = composite_mask<mask32x8>;
using mask64x8 = composite_mask<mask64x4>;
} // namespace mango::simd
#include <mango/simd/scalar_int64.hpp>
#include <mango/simd/scalar_float64.hpp>
#include <mango/simd/scalar_int128.hpp>
#include <mango/simd/scalar_float128.hpp>
#include <mango/simd/scalar_double128.hpp>
#include <mango/simd/composite_int256.hpp>
#include <mango/simd/composite_float256.hpp>
#include <mango/simd/composite_double256.hpp>
#include <mango/simd/composite_int512.hpp>
#include <mango/simd/composite_float512.hpp>
#include <mango/simd/composite_double512.hpp>
#include <mango/simd/scalar_convert.hpp>
#include <mango/simd/common_gather.hpp>
#endif
|
/*
* Copyright 2012 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/examples/peerconnection/client/defaults.h"
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <winsock2.h>
#else
#include <unistd.h>
#endif
#include "webrtc/base/arraysize.h"
#include "webrtc/base/common.h"
const char kAudioLabel[] = "audio_label";
const char kVideoLabel[] = "video_label";
const char kStreamLabel[] = "stream_label";
const uint16_t kDefaultServerPort = 8888;
std::string GetEnvVarOrDefault(const char* env_var_name,
const char* default_value) {
std::string value;
const char* env_var = getenv(env_var_name);
if (env_var)
value = env_var;
if (value.empty())
value = default_value;
return value;
}
std::string GetPeerConnectionString() {
return GetEnvVarOrDefault("WEBRTC_CONNECT", "stun:stun.l.google.com:19302");
}
std::string GetDefaultServerName() {
return GetEnvVarOrDefault("WEBRTC_SERVER", "localhost");
}
std::string GetPeerName() {
char computer_name[256];
if (gethostname(computer_name, arraysize(computer_name)) != 0)
strcpy(computer_name, "host");
std::string ret(GetEnvVarOrDefault("USERNAME", "user"));
ret += '@';
ret += computer_name;
return ret;
}
|
/*
* Copyright (c) 2021 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
* not be construed as granting a license to any other intellectual
* property including but not limited to intellectual property relating
* to a hardware implementation of the functionality of the software
* licensed hereunder. You may use the software subject to the license
* terms below provided that you ensure that this notice is replicated
* unmodified and in its entirety in all distributions of the software,
* modified or unmodified, in source code or in binary form.
*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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 holders 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 "mem/ruby/common/DataBlock.hh"
#include "mem/ruby/common/WriteMask.hh"
#include "mem/ruby/system/RubySystem.hh"
namespace gem5
{
namespace ruby
{
DataBlock::DataBlock(const DataBlock &cp)
{
m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
memcpy(m_data, cp.m_data, RubySystem::getBlockSizeBytes());
m_alloc = true;
}
void
DataBlock::alloc()
{
m_data = new uint8_t[RubySystem::getBlockSizeBytes()];
m_alloc = true;
clear();
}
void
DataBlock::clear()
{
memset(m_data, 0, RubySystem::getBlockSizeBytes());
}
bool
DataBlock::equal(const DataBlock& obj) const
{
return !memcmp(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
}
void
DataBlock::copyPartial(const DataBlock &dblk, const WriteMask &mask)
{
for (int i = 0; i < RubySystem::getBlockSizeBytes(); i++) {
if (mask.getMask(i, 1)) {
m_data[i] = dblk.m_data[i];
}
}
}
void
DataBlock::atomicPartial(const DataBlock &dblk, const WriteMask &mask)
{
for (int i = 0; i < RubySystem::getBlockSizeBytes(); i++) {
m_data[i] = dblk.m_data[i];
}
mask.performAtomic(m_data);
}
void
DataBlock::print(std::ostream& out) const
{
int size = RubySystem::getBlockSizeBytes();
out << "[ ";
for (int i = 0; i < size; i++) {
out << std::setw(2) << std::setfill('0') << std::hex
<< "0x" << (int)m_data[i] << " " << std::setfill(' ');
}
out << std::dec << "]" << std::flush;
}
const uint8_t*
DataBlock::getData(int offset, int len) const
{
assert(offset + len <= RubySystem::getBlockSizeBytes());
return &m_data[offset];
}
uint8_t*
DataBlock::getDataMod(int offset)
{
return &m_data[offset];
}
void
DataBlock::setData(const uint8_t *data, int offset, int len)
{
memcpy(&m_data[offset], data, len);
}
void
DataBlock::setData(PacketPtr pkt)
{
int offset = getOffset(pkt->getAddr());
assert(offset + pkt->getSize() <= RubySystem::getBlockSizeBytes());
pkt->writeData(&m_data[offset]);
}
DataBlock &
DataBlock::operator=(const DataBlock & obj)
{
memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
return *this;
}
} // namespace ruby
} // namespace gem5
|
// Copyright (c) 2011-2019 The Luascoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <util/strencodings.h>
#include <test/util/setup_common.h>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(base64_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(base64_testvectors)
{
static const std::string vstrIn[] = {"","f","fo","foo","foob","fooba","foobar"};
static const std::string vstrOut[] = {"","Zg==","Zm8=","Zm9v","Zm9vYg==","Zm9vYmE=","Zm9vYmFy"};
for (unsigned int i=0; i<sizeof(vstrIn)/sizeof(vstrIn[0]); i++)
{
std::string strEnc = EncodeBase64(vstrIn[i]);
BOOST_CHECK_EQUAL(strEnc, vstrOut[i]);
std::string strDec = DecodeBase64(strEnc);
BOOST_CHECK_EQUAL(strDec, vstrIn[i]);
}
// Decoding strings with embedded NUL characters should fail
bool failure;
(void)DecodeBase64(std::string("invalid", 7), &failure);
BOOST_CHECK_EQUAL(failure, true);
(void)DecodeBase64(std::string("nQB/pZw=", 8), &failure);
BOOST_CHECK_EQUAL(failure, false);
(void)DecodeBase64(std::string("nQB/pZw=\0invalid", 16), &failure);
BOOST_CHECK_EQUAL(failure, true);
(void)DecodeBase64(std::string("nQB/pZw=invalid", 15), &failure);
BOOST_CHECK_EQUAL(failure, true);
}
BOOST_AUTO_TEST_SUITE_END()
|
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <algorithm> //max...
#include <utility> //pair
#include <complex>
#include <climits> //int, ll...
#include <limits> //double...
#include <cmath> //abs, atan...
#include <cstring> //memset
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> ll_ll;
typedef vector<int> vi;
typedef map<int, int> mii;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<vi> vvi;
int main (){
int t, n, aux, q;
int e[100], s[100], d[100], v, llega[100];
double sol[100];
cin >> t;
for (int i =0 ; i<t; i++){
cin >> n >> q;
for (int j = 0; j< n; j++){
cin>> e[j] >> s[j];
}
for (int j = 0; j< n; j++){
for (int k = 0; k< n; k++){
if(j+1==k)
cin>> d[j];
else
cin >> aux;
}
}
cin >> aux >> v;
v--;
for (int j = 0; j <v;j++){
llega[j] = j;
int aux = j, aux2 = e[j];
while(aux2 > 0){
aux2-=d[j];
aux++;
if (aux2 >= 0)
llega[j] = aux;
}
}
for (int j = 1; j< v; j++){
d[j] += d[j-1];
}
sol[0] = 0;
for (int j = 1; j<= v; j++){
sol[j] = -1;
for (int k = 0; k< j; k++){
if(llega[k] >= j && sol[k] != -1){
long int dist;
if (k==0)
dist = d[j-1];
else
dist = d[j-1]-d[k-1];
double aux3 = dist/((double)(0.0+s[k]))+sol[k];
if (sol[j] == -1)
sol[j] = aux3;
else{
if (aux3< sol[j])
sol[j] = aux3;
}
}
}
}
std::cout << std::fixed;
std::cout << std::setprecision(7);
cout << "Case #" << i+1 << ": " << sol[v] << endl;
}
return 0;
}
|
#include "common.h"
BOOL My_OpenEventLogA()
{
LPCSTR lpUNCServerName=NULL;
LPCSTR lpSourceName=NULL;
HANDLE returnVal_Real = NULL;
HANDLE returnVal_Intercepted = NULL;
DWORD error_Real = 0;
DWORD error_Intercepted = 0;
__try{
disableInterception();
returnVal_Real = OpenEventLogA (lpUNCServerName,lpSourceName);
error_Real = GetLastError();
enableInterception();
returnVal_Intercepted = OpenEventLogA (lpUNCServerName,lpSourceName);
error_Intercepted = GetLastError();
}__except(puts("in filter"), 1){puts("exception caught");}
return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));
}
|
/*
SAWD Small ASCII Walk-around Demo (C) Copyright 2008, CCPS Solutions
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <cstdarg>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include "clib.h"
#include "sawd.h"
// SHOP DESIGN version 3.6
// the form that is shown when you enter a shop
int shop_form_a(void* d)
{
char cursor_icon = (char)31;
int cursor_x = 0;
// the three buttons
int btn[3][4] =
{
{4, 6, 7, 3},
{12, 6, 8, 3},
{21, 6, 8, 3}
};
char* btn_caption[3] = {"BUY","SELL","EXIT"};
shopkeeper* keeper = (shopkeeper*)d;
if (keeper->is_magic_shop)
{
if (player->chr_class != 3)
{
cl->show_message(3,"","You are not a Mage!","");
return SHOP_OPTION_EXIT;
}
}
char* shop_name = keeper->name;
int box[] = {40 - (38 / 2), (25 / 2) - (14 / 2), 38, 14};
int x = box[0] + 2;
int y = box[1] + 2;
int caption_x = x - 2 + (box[2] / 2) - strlen(shop_name) / 2;
char* msg = "What would you like to do?";
int msg_x = x - 2 + (box[2] / 2) - strlen(msg) / 2;
bool close_box = false;
// draw the form
clibwindow* wnd = cl->open_window(box[0], box[1], box[2], box[3]);
// draw the caption and the message
cl->outchars(caption_x, y, shop_name);
cl->outchars(msg_x, y + 2, msg);
// draw the buttons
{for(int n = 0; n < 3; n++)
{
//draw_message_box(x + btn[n][0], y + btn[n][1], btn[n][2], btn[n][3]);
//cl->outchars(x + btn[n][0] + 2, y + btn[n][1] + 1, btn_caption[n]);
cl->draw_button(x + btn[n][0], y + btn[n][1], btn[n][2], btn[n][3], btn_caption[n]);
cl->outchar(x + btn[n][0]+3, y + 4, ' ');
}
}
int form_result = SHOP_OPTION_EXIT;
while(!close_box)
{
// clear the previous cursors
{for(int n = 0; n < 3; n++){cl->outchar(x + btn[n][0]+3, y + 4, ' ');}}
// draw the cursors in the right location
if (cursor_x == 0) // BUY
{
cl->outchar(x + btn[0][0]+3, y + 4, cursor_icon);
}
else if (cursor_x == 1) // SELL
{
cl->outchar(x + btn[1][0]+3, y + 4, cursor_icon);
}
else if (cursor_x == 2) // EXIT
{
cl->outchar(x + btn[2][0]+3, y + 4, cursor_icon);
}
int k = cl->get_key();
switch (k)
{
case VK_LEFT:
{
if (cursor_x > 0)
cursor_x--;
else if (cursor_x <= 0)
cursor_x = 2;
} break;
case VK_RIGHT:
{
if (cursor_x < 2)
cursor_x++;
else if (cursor_x >= 2)
cursor_x = 0;
} break;
case VK_BACK:
case VK_ESCAPE:
{
form_result = SHOP_OPTION_EXIT;
close_box = true;
} break;
case VK_SPACE:
case VK_RETURN:
{
if (cursor_x == 0) // BUY
{
form_result = SHOP_OPTION_BUY;
}
else if (cursor_x == 1) // SELL
{
form_result = SHOP_OPTION_SELL;
}
else if (cursor_x == 2) // EXIT
{
form_result = SHOP_OPTION_EXIT;
}
close_box = true;
} break;
}
}
cl->close_window(wnd);
return form_result;
}
void draw_shop_ext()
{
char msg[32];
sprintf_s(msg, 32, "$%d", player->gold);
cl->draw_button(60,1,19,3,msg);
}
void hide_shop_ext()
{
cl->draw_button(60,1,19,3,"",0,0);
}
// the form that is shown when you are buying items
int shop_form_b(void* d)
{
int form_result = SHOP_OPTION_CANCEL;
shopkeeper* keeper = (shopkeeper*)d;
int num_items = 0;
if (keeper->is_magic_shop)
{
num_items = (int)keeper->spells.size();
}
else
{
num_items = (int)keeper->items.size();
}
int* item_qty = new int [num_items];
char btn_cursor_icon = (unsigned char)31;
char itm_cursor_icon_l = (unsigned char)17;
char itm_cursor_icon_r = (unsigned char)16;
int cursor_x = 0;
int cursor_y = 0;
int btn[2][4] = { {3, 15, 10, 3}, {21, 15, 10, 3} };
char* btn_caption[2] = {"ACCEPT", "CANCEL"};
for (int i = 0; i < num_items; i++) { item_qty[i] = 0; }
int box[] = {40 - (38 / 2), (25 / 2) - (22 / 2), 38, 22};
int x = box[0] + 2;
int y = box[1] + 2;
int caption_x = x - 2 + (box[2] / 2) - strlen(keeper->name) / 2;
char* msg = "What would you like to buy?";
int msg_x = x - 2 + (box[2] / 2) - strlen(msg) / 2;
bool close_box = false;
clibwindow* wnd = cl->open_window(box[0], box[1], box[2], box[3]);
cl->outchars(caption_x, y, keeper->name);
cl->outchars(msg_x, y + 2, msg);
// draw the available items
{
if (keeper->is_magic_shop)
{
for (unsigned int i = 0; i < keeper->spells.size(); i++)
{
cl->outchars(x, y + (4 + i), keeper->spells.at(i)->name);
cl->outcharsf(x + 20, y + (4 + i), "$%d", keeper->spells.at(i)->cost);
}
}
else
{
for (unsigned int i = 0; i < keeper->items.size(); i++)
{
cl->outchars(x, y + (4 + i), keeper->items.at(i)->name);
cl->outcharsf(x + 20, y + (4 + i), "$%d", keeper->items.at(i)->cost);
}
}
}
// draw the buttons
{
for(int n = 0; n < 2; n++)
{
cl->draw_button(x + btn[n][0], y + btn[n][1], btn[n][2], btn[n][3], btn_caption[n]);
}
}
draw_shop_ext();
while(!close_box)
{
// draw the quantities
{
for (int n = 0; n < num_items; n++)
{
cl->outchars(x+28, y + (4 + n), "x "); // clear old
cl->outcharsf(x+28, y + (4 + n), "x%d", item_qty[n]);
}
}
// clear all cursor positions
{for(int n=0;n<num_items;n++){cl->outchar(x+26,y+4+n,' ');cl->outchar(x+33,y+4+n,' ');}
cl->outchar(x + btn[0][0] + 3, y + 14, ' ');
cl->outchar(x + btn[1][0] + 3, y + 14, ' ');
}
// draw the cursor where it should be
if (cursor_x == 1 || cursor_x == 2) // cursor is at the buttons
{
if (cursor_x == 1) // ACCEPT
cl->outchar(x + btn[0][0] + 3, y + 14, btn_cursor_icon);
else
cl->outchar(x + btn[1][0] + 3, y + 14, btn_cursor_icon);
}
else if (cursor_x == 0) // cursor is browsing items
{
cl->outchar(x+26, y + 4 + cursor_y, itm_cursor_icon_l);
cl->outchar(x+33, y + 4 + cursor_y, itm_cursor_icon_r);
}
int k = cl->get_key();
switch (k)
{
case VK_UP:
{
// if browsing items
if (cursor_x == 0)
{
if (cursor_y > 0)
{
cursor_y--;
}
else if (cursor_y <= 0)
{
cursor_y = num_items-1;
}
}
else
{
// move up to the last item
// move cursor x
cursor_y = num_items-1;
cursor_x = 0;
}
} break;
case VK_DOWN:
{
// if browsing items
if (cursor_x == 0)
{
if (cursor_y < num_items-1)
{
cursor_y++;
}
else if (cursor_y >= num_items-1)
{
// move to the buttons
cursor_x = 1;
}
}
} break;
case VK_LEFT:
{
if (cursor_x == 0)
{
if (item_qty[cursor_y] > 0)
{
item_qty[cursor_y]--;
}
}
else
{
// cursor is at buttons
// toggle between them
if (cursor_x == 1) // Accept is selected
{
cursor_x = 2;
}
else if (cursor_x == 2) // Cancel is selected
{
cursor_x = 1;
}
}
} break;
case VK_RIGHT:
{
if (cursor_x == 0)
{
//##
//## insert patch 11:42PM 3.16.2008
//## Mage crashes when trying to purchase magic!
//##
// if this shop is a magic shop then we only deal with
// magic spells not items!
// this was the cause of the runtime crash.
if (keeper->is_magic_shop)
{
// limit magic purchase to one each
if (!obj_has_spell(player, keeper->spells.at(cursor_y)->name))
{
item_qty[cursor_y] = 1; // limit equipment to 1 each
}
else
{
item_qty[cursor_y] = 0;
char nobuy[80];
sprintf_s(nobuy,80,"Cannot purchase more than one %s!",keeper->spells.at(cursor_y)->name);
cl->show_message(3,"",nobuy,"");
} // end limit to one
}
else
{
// this shop has no spells, and is an item shop
if (keeper->items.at(cursor_y)->can_equip)
{
// can we use this item?
// do not allow purchase if we cannot use it
if ( (keeper->items.at(cursor_y)->chr_class == player->chr_class) || (keeper->items.at(cursor_y)->chr_class == 9))
{
// only allow purchase if we don't have it already!
if (!obj_has_equipped(player,keeper->items.at(cursor_y)->name))
{
item_qty[cursor_y] = 1; // limit equipment to 1 each
}
else
{
item_qty[cursor_y] = 0;
char nobuy[80];
sprintf_s(nobuy,80,"Cannot purchase more than one %s!",keeper->items.at(cursor_y)->name);
cl->show_message(3,"",nobuy,"");
}
}
else
{
// cannot use...cannot purchase
item_qty[cursor_y] = 0;
cl->show_message(3,"","Cannot purchase equipment you cannot use!","");
} // end if cannot use
}
else
{
if (item_qty[cursor_y] < 255)
{
item_qty[cursor_y]++;
}
} // end else is not equipment
} // end else not a magic shop
}
else
{
// cursor is at buttons
// toggle between them
if (cursor_x == 1) // Accept is selected
{
cursor_x = 2;
}
else if (cursor_x == 2) // Cancel is selected
{
cursor_x = 1;
}
} // end else is buttons
} break;
// CANCEL
case VK_BACK:
case VK_ESCAPE:
{
// prevent accidentally leaving the shop
int yesno = cl->show_choice("Exit the Shop?");
if (yesno == 1)
{
form_result = SHOP_OPTION_CANCEL;
close_box = true;
}
} break;
// ACCEPT
case VK_SPACE:
case VK_RETURN:
{
if (cursor_x != 0) // cursor is on buttons
{
if (cursor_x == 1) // accept
{
// calculate the total cost
unsigned long total = 0;
{
for (int n = 0; n < num_items; n++)
{
if (item_qty[n] > 0)
{
if (keeper->is_magic_shop)
{
total += (item_qty[n] * keeper->spells.at(n)->cost);
}
else
{
total += (item_qty[n] * keeper->items.at(n)->cost);
}
}
}
}
if (total > 0) // did we actually make a purchase?
{
char totalc[64];
sprintf_s(totalc, 64, "Your total is $%d.", total);
// show the cost
cl->show_message(3, "", totalc, "");
// prompt user to really purchase
int yesno = cl->show_choice("Purchase these items?");
if (yesno == 1)
{
// check for enough money
if (player->gold < total)
{
// if not enough money tell user
cl->show_message(1, "Not enough money!");
}
else
{
// subtract total
player->gold -= total;
// if all ok, then give items to
int items_gained = 0;
{
for(int n = 0; n < num_items; n++)
{
if (item_qty[n] > 0)
{
for (int q = 0; q < item_qty[n]; q++)
{
if (keeper->is_magic_shop)
{
player->spells.push_back(get_master_magic(keeper->spells.at(n)->name));
}
else
{
player->items.push_back(get_master_item(keeper->items.at(n)->name));
// equip any equipment
if (keeper->items.at(n)->can_equip)
{
if (0!=keeper->items.at(n)->equip_func)
{
char m9[40];
sprintf_s(m9,40,"equipping %s", keeper->items.at(n)->name);
cl->show_message(4,"Auto-Equip: ON","",m9,"");
item_target* t = new item_target(
keeper->items.at(n),
player);
keeper->items.at(n)->equip_func(t);
delete t;
}
}
}
}
items_gained += item_qty[n];
}
}
}
// the user, tell the user
char gains[64];
//char bank[64];
draw_shop_ext();
sprintf_s(gains, 64, "Purchased %d items for $%d.", items_gained, total);
//sprintf_s(bank, 64, "You have $%d remaining.", player->gold);
cl->show_message(3, "", gains, "");
// and then reset the item quantities
// for the shop so that you can
// continue to shop.
{for(int n=0;n<num_items;n++){item_qty[n]=0;}}
}
}
form_result = SHOP_OPTION_ACCEPT;
close_box = true;
}
else
{
// nothing purchased, tell the user to buy something
cl->show_message(2,
"Shop Keeper:",
"You haven't selected anything to buy!");
}
}
else if (cursor_x == 2) // cancel
{
form_result = SHOP_OPTION_CANCEL;
close_box = true;
}
}
else
{
// cursor is at items
// so show details of the selected item
// :D a nice feature
if (!keeper->is_magic_shop)
{
display_item_detail(keeper->items.at(cursor_y)->name);
cl->set_bgcolor(4);
cl->set_fgcolor(1|2|4|8);
}
}
} break;
}
}
delete [] item_qty;
hide_shop_ext();
// close the window
cl->close_window(wnd);
// cl->close_window(masterwnd);
return form_result;
}
// the form that is shown when you are selling items
int shop_form_c(void* d)
{
/*
char btn_cursor_icon = (char)31;
char itm_cursor_icon_l = (char)17;
char itm_cursor_icon_r = (char)16;
int cursor_x = 0; // cursor begins at the first item
int cursor_y = 0; // ..
// the two buttons
int btn[2][4] =
{
{3, 15, 10, 3},
{21, 15, 10, 3}
};
char* btn_caption[2] = {"ACCEPT","CANCEL"};
// fake the shop data
char* shop_name = "DUSHAL ITEM SHOP";
char* item_name[10] =
{
// XXXXXXXXXXXXXXXX $10000 x255
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name ",
"Item Name "
};
int item_cost[10] =
{
10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000
};
int item_qty[10] = {0,0,0,0,0,0,0,0,0,0}; //
int box[] = {40 - (38 / 2), (25 / 2) - (22 / 2), 38, 22};
int x = box[0] + 2;
int y = box[1] + 2;
int caption_x = x - 2 + (box[2] / 2) - strlen(shop_name) / 2;
char* msg = "What would you like to sell?";
int msg_x = x - 2 + (box[2] / 2) - strlen(msg) / 2;
bool close_box = false;
// draw the form
clibwindow* wnd = cl->open_window(box[0], box[1], box[2], box[3]);
// draw the caption and the message
cl->outchars(caption_x, y, shop_name);
cl->outchars(msg_x, y + 2, msg);
// draw the available items
{for(int n = 0; n < 10; n++)
{
cl->outchars(x, y + (4 + n), item_name[n]);
cl->outcharsf(x+20, y + (4 + n), "$%d", item_cost[n]);
}
}
// draw the buttons
{for(int n = 0; n < 2; n++)
{
cl->draw_button(x + btn[n][0], y + btn[n][1], btn[n][2], btn[n][3], btn_caption[n]);
}
}
int form_result = SHOP_OPTION_CANCEL;
while(!close_box)
{
// draw the quantities
{for(int n = 0; n < 10; n++)
{
cl->outchars(x+28, y + (4 + n), "x "); // clear old
cl->outcharsf(x+28, y + (4 + n), "x%d", item_qty[n]);
}
}
// clear all cursor positions
{for(int n=0;n<10;n++){cl->outchar(x+26,y+4+n,' ');cl->outchar(x+33,y+4+n,' ');}
cl->outchar(x + btn[0][0] + 3, y + 14, ' ');
cl->outchar(x + btn[1][0] + 3, y + 14, ' ');
}
// draw the cursor where it should be
if (cursor_x == 1 || cursor_x == 2) // cursor is at the buttons
{
if (cursor_x == 1) // ACCEPT
cl->outchar(x + btn[0][0] + 3, y + 14, btn_cursor_icon);
else
cl->outchar(x + btn[1][0] + 3, y + 14, btn_cursor_icon);
}
else if (cursor_x == 0) // cursor is browsing items
{
cl->outchar(x+26, y + 4 + cursor_y, itm_cursor_icon_l);
cl->outchar(x+33, y + 4 + cursor_y, itm_cursor_icon_r);
}
int k = cl->get_key();
switch (k)
{
case VK_UP:
{
// if browsing items
if (cursor_x == 0)
{
if (cursor_y > 0)
{
cursor_y--;
}
else if (cursor_y <= 0)
{
cursor_y = 9;
}
}
else
{
// move up to the last item
// move cursor x
cursor_y = 9;
cursor_x = 0;
}
} break;
case VK_DOWN:
{
// if browsing items
if (cursor_x == 0)
{
if (cursor_y < 9)
{
cursor_y++;
}
else if (cursor_y >= 9)
{
// move to the buttons
cursor_x = 1;
}
}
} break;
case VK_LEFT:
{
if (cursor_x == 0)
{
if (item_qty[cursor_y] > 0)
{
item_qty[cursor_y]--;
}
}
else
{
// cursor is at buttons
// toggle between them
if (cursor_x == 1) // Accept is selected
{
cursor_x = 2;
}
else if (cursor_x == 2) // Cancel is selected
{
cursor_x = 1;
}
}
} break;
case VK_RIGHT:
{
if (cursor_x == 0)
{
if (item_qty[cursor_y] < 255)
{
item_qty[cursor_y]++;
}
}
else
{
// cursor is at buttons
// toggle between them
if (cursor_x == 1) // Accept is selected
{
cursor_x = 2;
}
else if (cursor_x == 2) // Cancel is selected
{
cursor_x = 1;
}
}
} break;
// CANCEL
case VK_BACK:
case VK_ESCAPE:
{
// prevent accidentally leaving the shop
int yesno = cl->show_choice("Exit the Shop?");
if (yesno == 1)
{
form_result = SHOP_OPTION_CANCEL;
close_box = true;
}
} break;
// ACCEPT
case VK_SPACE:
case VK_RETURN:
{
if (cursor_x != 0) // cursor is on buttons
{
if (cursor_x == 1) // accept
{
// calculate the total cost
long total = 0;
{for(int n=0;n<10;n++){if (item_qty[n]>0)total += (item_qty[n] * item_cost[n]);}}
char totalc[64];
sprintf_s(totalc, 64, "Your total is $%d.", total);
// show the cost
cl->show_message(3,"",totalc,"");
// prompt user to really purchase
int yesno = cl->show_choice("Purchase these items?");
if (yesno == 1)
{
// check for enough money
if (player->gold < total)
{
// if not enough money tell user
cl->show_message(1, "Not enough money!");
}
else
{
// subtract total
player->gold -= total;
// if all ok, then give items to
int items_gained = 0;
{
for(int n=0;n<10;n++)
{
if (item_qty[n] > 0)
{
for (int q = 0; q < item_qty[n]; q++)
{
player->items.push_back(item_name[n]);
}
items_gained += item_qty[n];
}
}
}
// the user, tell the user
char gains[64];
char bank[64];
sprintf_s(gains, 64, "Purchased %d items for $%d.", items_gained, total);
sprintf_s(bank, 64, "You have $%d left.", player->gold);
cl->show_message(3, gains, "", bank);
// and then reset the item quantities
// for the shop so that you can
// continue to shop.
{for(int n=0;n<10;n++){item_qty[n]=0;}}
}
}
form_result = SHOP_OPTION_ACCEPT;
{
int yesno = cl->show_choice("Continue shopping?");
if (yesno != 1)
{
close_box = true;
}
}
}
else if (cursor_x == 2) // cancel
{
form_result = SHOP_OPTION_CANCEL;
close_box = true;
}
}
else
{
// cursor is at items
// so show details of the selected item
// :D a nice feature
}
} break;
}
}
// close the window
cl->close_window(wnd);
return form_result;
*/
return 0;
}
|
// copyright_check implementation ------------------------------------------------//
// Copyright Beman Dawes 2002.
// SPDX-License-Identifier: BSL-1.0
// 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)
#include <pika/config.hpp>
#include "copyright_check.hpp"
#include "function_hyper.hpp"
namespace boost { namespace inspect {
copyright_check::copyright_check()
: m_files_with_errors(0)
{
}
void copyright_check::inspect(const string& library_name,
const path& full_path, // example: c:/foo/boost/filesystem/path.hpp
const string& contents) // contents of file to be inspected
{
if (contents.find("pikainspect:"
"nocopyright") != string::npos)
return;
if (contents.find("Copyright") == string::npos &&
contents.find("copyright") == string::npos)
{
++m_files_with_errors;
std::string lineloc = loclink(full_path, name());
error(library_name, full_path, lineloc);
}
}
}} // namespace boost::inspect
|
#ifndef __GLIPSTUDIO_RESOURCETAB__
#define __GLIPSTUDIO_RESOURCETAB__
#include "GLIPLib.hpp"
#include "dataModules.hpp"
#include "imagesCollection.hpp"
#include <QString>
#include <QMenu>
#include <QAction>
#include <QHBoxLayout>
#include <QPushButton>
#include <QProgressBar>
#include <QStringList>
#include <QVBoxLayout>
#include <QMenuBar>
#include <QTreeWidget>
#include <QSignalMapper>
#include <QFileInfo>
#include <QMessageBox>
#include <QFileDialog>
#include <QInputDialog>
using namespace Glip;
using namespace Glip::CoreGL;
using namespace Glip::CorePipeline;
class ConnectionMenu : public QMenu
{
Q_OBJECT
private :
QList<QString> portsNames;
QList<QAction*> currentActions;
QSignalMapper mapper;
public :
ConnectionMenu(QWidget* parent=NULL);
~ConnectionMenu(void);
void activate(bool state, int numConnections=1);
void update(void);
void update(const __ReadOnly_PipelineLayout& layout);
signals :
void connectToInput(int i);
};
class ResourcesTab : public Module
{
Q_OBJECT
private :
std::vector<int> imageRecordIDs;
QVBoxLayout layout;
QMenuBar menuBar;
ConnectionMenu connectionMenu;
ImagesCollection collection;
ViewManager* viewManager;
//void updateDisplay(WindowRenderer& display);
bool isValidTexture(int recordID);
HdlTexture& getTexture(int recordID);
const __ReadOnly_HdlTextureFormat& getTextureFormat(int recordID) const;
void giveTextureInformation(int recordID, std::string& name);
void cleanRecordDependances(int recordID);
void updateTexturesLinkInformation(void);
bool canBeClosed(void);
private slots :
// These will be called upon external modifications, in order for the module to update itself :
void pipelineWasCreated(void);
void pipelineInputFromThisModuleWasReleased(int portID, int recordID);
void pipelineWasDestroyed(void);
void focusChanged(int recordID);
void selectionChanged(void);
void connectToInput(int i);
void imageLoaded(int recordID);
void imageReplaced(int recordID);
void imageSettingsChanged(int recordID);
void imageUnloadedFromDevice(int recordID);
void imageFreed(int recordID);
void createNewView(void);
public :
ResourcesTab(ControlModule& _masterModule, QWidget* parent=NULL);
~ResourcesTab(void);
ImagesCollection* getResourcesManagerLink(void);
};
#endif
|
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/compiler/xla/client/client.h"
#include <string>
#include <utility>
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/ptr_util.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/core/lib/core/errors.h"
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/protobuf.h"
#include "tensorflow/core/platform/types.h"
namespace xla {
Client::Client(ServiceInterface* stub) : stub_(stub) {}
Client::~Client() = default;
StatusOr<std::unique_ptr<Literal>> Client::Transfer(
const GlobalData& data, const Shape* shape_with_layout) {
TransferToClientRequest request;
*request.mutable_data() = data.handle();
if (shape_with_layout != nullptr) {
*request.mutable_shape_with_layout() = *shape_with_layout;
}
TransferToClientResponse response;
VLOG(1) << "making transfer request";
VLOG(3) << "TransferToClientRequest: {" << request.DebugString() << "}";
Status s = stub_->TransferToClient(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "TransferToClientResponse: {" << response.DebugString() << "}";
if (!response.has_literal()) {
return FailedPrecondition(
"server provided response without a literal in "
"TransferToClient request");
}
return WrapUnique(response.release_literal());
}
Status Client::TransferInProcess(const GlobalData& data, void* destination) {
TransferToClientInProcessRequest request;
*request.mutable_data() = data.handle();
request.set_buffer(reinterpret_cast<uint64>(destination));
TransferToClientInProcessResponse response;
VLOG(1) << "making transfer in-process request";
VLOG(3) << "TransferToClientInProcessRequest: {" << request.DebugString()
<< "}";
Status s = stub_->TransferToClientInProcess(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "TransferToClientInProcessResponse: {" << response.DebugString()
<< "}";
return Status::OK();
}
StatusOr<std::unique_ptr<GlobalData>> Client::TransferToServer(
const Literal& literal, const DeviceHandle* device_handle) {
TransferToServerRequest request;
*request.mutable_literal() = literal;
if (device_handle) {
*request.mutable_device_handle() = *device_handle;
}
TransferToServerResponse response;
VLOG(1) << "making transfer to server request";
VLOG(3) << "TransferToServerRequest: {" << request.DebugString() << "}";
Status s = stub_->TransferToServer(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "TransferToServerResponse: {" << response.DebugString() << "}";
if (!response.has_data()) {
return FailedPrecondition(
"server provided response without a data handle in "
"TransferToServer request");
}
return MakeUnique<GlobalData>(stub_, response.data());
}
Status Client::TransferToInfeed(const Literal& literal, int64 replica_id,
const DeviceHandle* device_handle) {
TransferToInfeedRequest request;
*request.mutable_literal() = literal;
if (device_handle) {
*request.mutable_device_handle() = *device_handle;
}
request.set_replica_id(replica_id);
TransferToInfeedResponse response;
VLOG(1) << "making transfer to infeed request";
VLOG(3) << "TransferToInfeedRequest: {" << request.DebugString() << "}";
Status s = stub_->TransferToInfeed(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "TransferToInfeedResponse: {" << response.DebugString() << "}";
return Status::OK();
}
Status Client::ResetDevice() {
ResetDeviceRequest request;
ResetDeviceResponse response;
VLOG(1) << "making reset device request";
VLOG(3) << "ResetDeviceRequest: {" << request.DebugString() << "}";
Status s = stub_->ResetDevice(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "ResetDeviceResponse: {" << response.DebugString() << "}";
return Status::OK();
}
StatusOr<std::unique_ptr<Literal>> Client::ExecuteAndTransfer(
const Computation& computation,
tensorflow::gtl::ArraySlice<GlobalData*> arguments,
const Shape* shape_with_output_layout, ExecutionProfile* execution_profile,
uint64 seed) {
TF_ASSIGN_OR_RETURN(std::unique_ptr<GlobalData> data,
Execute(computation, arguments, shape_with_output_layout,
execution_profile, seed));
return Transfer(*data, shape_with_output_layout);
}
StatusOr<std::unique_ptr<GlobalData>> Client::TransferToServerInProcess(
const Shape& shape, const void* buffer) {
TransferToServerInProcessRequest request;
request.set_buffer(reinterpret_cast<uint64>(buffer));
*request.mutable_shape() = shape;
TransferToServerInProcessResponse response;
VLOG(1) << "making transfer to server in-process request";
VLOG(3) << "TransferToServerInProcessRequest: {" << request.DebugString()
<< "}";
Status s = stub_->TransferToServerInProcess(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
VLOG(3) << "TransferToServerInProcessResponse: {" << response.DebugString()
<< "}";
if (!response.has_data()) {
return FailedPrecondition(
"server provided response without a data handle in "
"TransferToServerInProcess request");
}
return MakeUnique<GlobalData>(stub_, response.data());
}
StatusOr<Computation> Client::LoadSnapshot(const SessionModule& module) {
LoadComputationSnapshotRequest request;
*request.mutable_module() = module;
LoadComputationSnapshotResponse response;
Status s = stub_->LoadComputationSnapshot(&request, &response);
if (!s.ok()) {
return s;
}
VLOG(1) << "load snapshot response: " << response.ShortDebugString();
return Computation(stub_, response.computation());
}
StatusOr<std::unique_ptr<GlobalData>> Client::Execute(
const Computation& computation,
tensorflow::gtl::ArraySlice<GlobalData*> arguments,
const Shape* shape_with_output_layout, ExecutionProfile* execution_profile,
uint64 seed) {
ExecuteRequest request;
*request.mutable_computation() = computation.handle();
request.set_seed(seed);
for (GlobalData* argument : arguments) {
*request.add_arguments() = argument->handle();
}
if (shape_with_output_layout != nullptr) {
*request.mutable_shape_with_output_layout() = *shape_with_output_layout;
}
ExecuteResponse response;
VLOG(1) << "making execute request: " << request.ShortDebugString();
Status s = stub_->Execute(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
if (execution_profile != nullptr) {
*execution_profile = response.profile();
if (VLOG_IS_ON(1)) {
TF_ASSIGN_OR_RETURN(
auto execution_stats,
ExecutionStatsAsString(computation, response.profile()));
VLOG(1) << execution_stats;
}
}
return MakeUnique<GlobalData>(stub_, response.output());
}
StatusOr<std::vector<std::unique_ptr<GlobalData>>> Client::ExecuteParallel(
tensorflow::gtl::ArraySlice<ComputationInstance> computations) {
ExecuteParallelRequest request;
for (const ComputationInstance& computation : computations) {
ExecuteRequest single_request;
*single_request.mutable_computation() = computation.computation.handle();
for (GlobalData* argument : computation.arguments) {
*single_request.add_arguments() = argument->handle();
}
if (computation.device_handle != nullptr) {
*single_request.mutable_device_handle() = *computation.device_handle;
}
if (computation.shape_with_output_layout != nullptr) {
*single_request.mutable_shape_with_output_layout() =
*computation.shape_with_output_layout;
}
single_request.set_seed(computation.seed);
*request.add_requests() = single_request;
}
ExecuteParallelResponse response;
VLOG(1) << "making execute-parallel request: " << request.ShortDebugString();
tensorflow::Status s = stub_->ExecuteParallel(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
std::vector<std::unique_ptr<GlobalData>> outputs;
for (int64 i = 0; i < computations.size(); ++i) {
outputs.push_back(
MakeUnique<GlobalData>(stub_, response.responses(i).output()));
if (computations[i].execution_profile != nullptr) {
*computations[i].execution_profile = response.responses(i).profile();
}
}
return std::move(outputs);
}
StatusOr<std::vector<DeviceHandle>> Client::GetDeviceHandles(
int64 device_count) {
if (device_count < 1) {
return InvalidArgument("device_count must be greater than 0");
}
GetDeviceHandlesRequest request;
request.set_device_count(device_count);
GetDeviceHandlesResponse response;
VLOG(1) << "making get device request: " << request.ShortDebugString();
tensorflow::Status s = stub_->GetDeviceHandles(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
std::vector<DeviceHandle> device_handles;
for (const DeviceHandle& device_handle : response.device_handles()) {
device_handles.push_back(device_handle);
}
return device_handles;
}
StatusOr<ExecutionHandle> Client::ExecuteAsync(
const Computation& computation,
tensorflow::gtl::ArraySlice<GlobalData*> arguments,
const Shape* shape_with_output_layout, uint64 seed) {
ExecuteAsyncRequest request;
*request.mutable_computation() = computation.handle();
request.set_seed(seed);
for (GlobalData* argument : arguments) {
*request.add_arguments() = argument->handle();
}
if (shape_with_output_layout != nullptr) {
*request.mutable_shape_with_output_layout() = *shape_with_output_layout;
}
ExecuteAsyncResponse response;
VLOG(1) << "making execute async request: " << request.ShortDebugString();
Status s = stub_->ExecuteAsync(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
return response.execution();
}
StatusOr<std::unique_ptr<GlobalData>> Client::WaitForExecution(
const Computation& computation, const ExecutionHandle& execution,
ExecutionProfile* execution_profile) {
WaitForExecutionRequest request;
*request.mutable_execution() = execution;
WaitForExecutionResponse response;
VLOG(1) << "making wait-for-execute request: " << request.ShortDebugString();
Status s = stub_->WaitForExecution(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
if (execution_profile != nullptr) {
*execution_profile = response.profile();
if (VLOG_IS_ON(1)) {
TF_ASSIGN_OR_RETURN(
auto execution_stats,
ExecutionStatsAsString(computation, response.profile()));
VLOG(1) << execution_stats;
}
}
return MakeUnique<GlobalData>(stub_, response.output());
}
Status Client::Unregister(const GlobalData& data) {
UnregisterRequest request;
*request.mutable_data() = data.handle();
UnregisterResponse response;
VLOG(1) << "making unregister request";
Status s = stub_->Unregister(&request, &response);
VLOG(1) << "done with request";
return s;
}
StatusOr<std::vector<std::unique_ptr<GlobalData>>> Client::DeconstructTuple(
const GlobalData& data) {
DeconstructTupleRequest request;
*request.mutable_tuple_handle() = data.handle();
DeconstructTupleResponse response;
VLOG(1) << "making DestructTuple request";
Status s = stub_->DeconstructTuple(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
std::vector<std::unique_ptr<GlobalData>> handles;
for (auto& handle : response.element_handles()) {
handles.push_back(MakeUnique<GlobalData>(stub_, handle));
}
return std::move(handles);
}
StatusOr<ComputationStats> Client::GetComputationStats(
const Computation& computation) const {
ComputationStatsRequest request;
*request.mutable_computation() = computation.handle();
ComputationStatsResponse response;
VLOG(1) << "making computation stats request";
Status s = stub_->GetComputationStats(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
CHECK(response.has_stats());
return response.stats();
}
StatusOr<std::unique_ptr<ProgramShape>> Client::GetComputationShape(
const Computation& computation) {
GetComputationShapeRequest request;
*request.mutable_computation() = computation.handle();
GetComputationShapeResponse response;
VLOG(1) << "making get-computation-shape request";
Status s = stub_->GetComputationShape(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
return WrapUnique(response.release_program_shape());
}
StatusOr<Shape> Client::GetShape(const GlobalData& data) {
GetShapeRequest request;
*request.mutable_data() = data.handle();
GetShapeResponse response;
VLOG(1) << "making get shape request";
Status s = stub_->GetShape(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
return response.shape();
}
StatusOr<string> Client::ExecutionStatsAsString(
const Computation& computation, const ExecutionProfile& profile) {
TF_ASSIGN_OR_RETURN(auto computation_stats, GetComputationStats(computation));
int64 total_flops =
computation_stats.flop_count() + computation_stats.transcendental_count();
if (profile.compute_time_ns() > 0) {
int64 nanoseconds = profile.compute_time_ns();
int64 cycle_count = profile.compute_cycle_count();
double gflops = total_flops / nanoseconds;
return tensorflow::strings::StrCat(
"[Execution Statistics] flop count: ", computation_stats.flop_count(),
", transcendental count: ", computation_stats.transcendental_count(),
", compute execution time: ", nanoseconds, " nsec",
", compute cycles: ", cycle_count, ", performance: ", gflops,
"gflop/s");
}
return string("[Execution Statistics] not available.");
}
StatusOr<ChannelHandle> Client::CreateChannelHandle() {
CreateChannelHandleRequest request;
CreateChannelHandleResponse response;
VLOG(1) << "making create channel handle request";
Status s = stub_->CreateChannelHandle(&request, &response);
VLOG(1) << "done with request";
if (!s.ok()) {
return s;
}
return response.channel();
}
} // namespace xla
|
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
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)
This is an auto-generated file. Do not edit!
==============================================================================*/
namespace boost { namespace fusion
{
template <typename T0 , typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 , typename T14 , typename T15 , typename T16 , typename T17 , typename T18 , typename T19 , typename T20 , typename T21 , typename T22 , typename T23 , typename T24 , typename T25 , typename T26 , typename T27 , typename T28 , typename T29 , typename T30 , typename T31 , typename T32 , typename T33 , typename T34 , typename T35 , typename T36 , typename T37 , typename T38 , typename T39>
struct tuple : vector<T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39>
{
typedef vector<
T0 , T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 , T17 , T18 , T19 , T20 , T21 , T22 , T23 , T24 , T25 , T26 , T27 , T28 , T29 , T30 , T31 , T32 , T33 , T34 , T35 , T36 , T37 , T38 , T39>
base_type;
tuple()
: base_type() {}
tuple(tuple const& rhs)
: base_type(rhs) {}
template <typename U1, typename U2>
tuple(std::pair<U1, U2> const& rhs)
: base_type(rhs) {}
explicit
tuple(typename detail::call_param<T0 >::type _0)
: base_type(_0) {}
template <typename U0>
tuple(tuple<U0> const& rhs)
: base_type(rhs) {}
template <typename U0>
tuple& operator=(tuple<U0> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1)
: base_type(_0 , _1) {}
template <typename U0 , typename U1>
tuple(tuple<U0 , U1> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1>
tuple& operator=(tuple<U0 , U1> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2)
: base_type(_0 , _1 , _2) {}
template <typename U0 , typename U1 , typename U2>
tuple(tuple<U0 , U1 , U2> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2>
tuple& operator=(tuple<U0 , U1 , U2> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3)
: base_type(_0 , _1 , _2 , _3) {}
template <typename U0 , typename U1 , typename U2 , typename U3>
tuple(tuple<U0 , U1 , U2 , U3> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3>
tuple& operator=(tuple<U0 , U1 , U2 , U3> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4)
: base_type(_0 , _1 , _2 , _3 , _4) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4>
tuple(tuple<U0 , U1 , U2 , U3 , U4> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5)
: base_type(_0 , _1 , _2 , _3 , _4 , _5) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34 , typename detail::call_param<T35 >::type _35)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34 , _35) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34 , typename detail::call_param<T35 >::type _35 , typename detail::call_param<T36 >::type _36)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34 , _35 , _36) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34 , typename detail::call_param<T35 >::type _35 , typename detail::call_param<T36 >::type _36 , typename detail::call_param<T37 >::type _37)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34 , _35 , _36 , _37) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34 , typename detail::call_param<T35 >::type _35 , typename detail::call_param<T36 >::type _36 , typename detail::call_param<T37 >::type _37 , typename detail::call_param<T38 >::type _38)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34 , _35 , _36 , _37 , _38) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37 , U38> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37 , U38> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple(typename detail::call_param<T0 >::type _0 , typename detail::call_param<T1 >::type _1 , typename detail::call_param<T2 >::type _2 , typename detail::call_param<T3 >::type _3 , typename detail::call_param<T4 >::type _4 , typename detail::call_param<T5 >::type _5 , typename detail::call_param<T6 >::type _6 , typename detail::call_param<T7 >::type _7 , typename detail::call_param<T8 >::type _8 , typename detail::call_param<T9 >::type _9 , typename detail::call_param<T10 >::type _10 , typename detail::call_param<T11 >::type _11 , typename detail::call_param<T12 >::type _12 , typename detail::call_param<T13 >::type _13 , typename detail::call_param<T14 >::type _14 , typename detail::call_param<T15 >::type _15 , typename detail::call_param<T16 >::type _16 , typename detail::call_param<T17 >::type _17 , typename detail::call_param<T18 >::type _18 , typename detail::call_param<T19 >::type _19 , typename detail::call_param<T20 >::type _20 , typename detail::call_param<T21 >::type _21 , typename detail::call_param<T22 >::type _22 , typename detail::call_param<T23 >::type _23 , typename detail::call_param<T24 >::type _24 , typename detail::call_param<T25 >::type _25 , typename detail::call_param<T26 >::type _26 , typename detail::call_param<T27 >::type _27 , typename detail::call_param<T28 >::type _28 , typename detail::call_param<T29 >::type _29 , typename detail::call_param<T30 >::type _30 , typename detail::call_param<T31 >::type _31 , typename detail::call_param<T32 >::type _32 , typename detail::call_param<T33 >::type _33 , typename detail::call_param<T34 >::type _34 , typename detail::call_param<T35 >::type _35 , typename detail::call_param<T36 >::type _36 , typename detail::call_param<T37 >::type _37 , typename detail::call_param<T38 >::type _38 , typename detail::call_param<T39 >::type _39)
: base_type(_0 , _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 , _9 , _10 , _11 , _12 , _13 , _14 , _15 , _16 , _17 , _18 , _19 , _20 , _21 , _22 , _23 , _24 , _25 , _26 , _27 , _28 , _29 , _30 , _31 , _32 , _33 , _34 , _35 , _36 , _37 , _38 , _39) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39>
tuple(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37 , U38 , U39> const& rhs)
: base_type(rhs) {}
template <typename U0 , typename U1 , typename U2 , typename U3 , typename U4 , typename U5 , typename U6 , typename U7 , typename U8 , typename U9 , typename U10 , typename U11 , typename U12 , typename U13 , typename U14 , typename U15 , typename U16 , typename U17 , typename U18 , typename U19 , typename U20 , typename U21 , typename U22 , typename U23 , typename U24 , typename U25 , typename U26 , typename U27 , typename U28 , typename U29 , typename U30 , typename U31 , typename U32 , typename U33 , typename U34 , typename U35 , typename U36 , typename U37 , typename U38 , typename U39>
tuple& operator=(tuple<U0 , U1 , U2 , U3 , U4 , U5 , U6 , U7 , U8 , U9 , U10 , U11 , U12 , U13 , U14 , U15 , U16 , U17 , U18 , U19 , U20 , U21 , U22 , U23 , U24 , U25 , U26 , U27 , U28 , U29 , U30 , U31 , U32 , U33 , U34 , U35 , U36 , U37 , U38 , U39> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
template <typename T>
tuple& operator=(T const& rhs)
{
base_type::operator=(rhs);
return *this;
}
tuple& operator=(tuple const& rhs)
{
base_type::operator=(rhs);
return *this;
}
template <typename U1, typename U2>
tuple& operator=(std::pair<U1, U2> const& rhs)
{
base_type::operator=(rhs);
return *this;
}
};
template <typename Tuple>
struct tuple_size : result_of::size<Tuple> {};
template <int N, typename Tuple>
struct tuple_element : result_of::value_at_c<Tuple, N> {};
template <int N, typename Tuple>
inline typename
lazy_disable_if<
is_const<Tuple>
, result_of::at_c<Tuple, N>
>::type
get(Tuple& tup)
{
return at_c<N>(tup);
}
template <int N, typename Tuple>
inline typename result_of::at_c<Tuple const, N>::type
get(Tuple const& tup)
{
return at_c<N>(tup);
}
}}
|
#ifdef WIN32
#pragma execution_character_set("utf-8")
#endif
#include "mytextbrowser.h"
#include <QMenu>
MyTextBrowser::MyTextBrowser(QWidget *parent):
QTextBrowser(parent)
{
initMenu();
initConnect();
}
void MyTextBrowser::slotClearText()
{
this->clear();
}
void MyTextBrowser::contextMenuEvent (QContextMenuEvent * event)
{
QMenu* popMenu = new QMenu(this);
popMenu->addAction(clearTextAction);
// 菜单出现的位置为当前鼠标的位置
popMenu->exec(QCursor::pos());
QTextBrowser::contextMenuEvent(event);
}
void MyTextBrowser::initMenu()
{
clearTextAction = new QAction(tr("清空信息"), this);
}
void MyTextBrowser::initConnect()
{
connect(clearTextAction, &QAction::triggered, this, &MyTextBrowser::slotClearText);
}
|
#include <QtWidgets/QApplication>
#include <base/logger/logger.h>
#include <module_db/database.h>
#include <base/encoder.h>
#include "app_ctrl.h"
#include <string>
#include <stdint.h>
#include <module_file/file/file.h>
using namespace std;
using namespace file;
int app(int argc, char* argv[])
{
QApplication a(argc, argv);
AppCtrl App;
bool bRes=App.init();
if (false == bRes)
{
return a.exec();
}
App.start();
return a.exec();
}
int main(int argc, char* argv[])
{
return app(argc, argv);
//test();
return 0;
}
|
/**
* Copyright (C) 2016-2019 Xilinx, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located 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 "shim.h"
#include "system_hwemu.h"
#include "xclbin.h"
#include <cctype>
#include <string.h>
#include <boost/property_tree/xml_parser.hpp>
#include <errno.h>
#include <unistd.h>
#include <boost/lexical_cast.hpp>
#include "core/common/xclbin_parser.h"
#include "core/common/AlignedAllocator.h"
#include "xcl_perfmon_parameters.h"
#include <mutex>
#include <set>
#define SEND_RESP2QDMA() \
{ \
auto raw_response_header = std::make_unique<char[]>(ri_len); \
auto raw_response_payload = std::make_unique<char[]>(r_len);\
response_header->set_size(r_len);\
response_header->SerializeToArray((void*)raw_response_header.get(),ri_len);\
response_payload.SerializeToArray((void*)raw_response_payload.get(),r_len);\
Q2h_sock->sk_write((void*)raw_response_header.get(),ri_len);\
Q2h_sock->sk_write((void*)raw_response_payload.get(),r_len);\
}
namespace {
inline bool
file_exists(const std::string& fnm)
{
struct stat statBuf;
return stat(fnm.c_str(), &statBuf) == 0;
}
}
namespace xclhwemhal2 {
//Thread for which pooling for transaction from SIM_QDMA
void hostMemAccessThread(xclhwemhal2::HwEmShim* inst);
/**
* helper class for transactions from SIM_QDMA to XRT
*
*/
class Q2H_helper {
private:
std::unique_ptr<call_packet_info> header;
std::unique_ptr<response_packet_info> response_header;
size_t i_len;
size_t ri_len;
unix_socket* Q2h_sock;
xclhwemhal2::HwEmShim* inst;
public:
Q2H_helper(xclhwemhal2::HwEmShim* _inst);
~Q2H_helper();
int poolingon_Qdma();
bool connect_sock();
};
namespace pt = boost::property_tree;
std::map<unsigned int, HwEmShim*> devices;
std::map<std::string, std::string> HwEmShim::mEnvironmentNameValueMap(xclemulation::getEnvironmentByReadingIni());
std::map<int, std::tuple<std::string,int,void*, unsigned int> > HwEmShim::mFdToFileNameMap;
std::ofstream HwEmShim::mDebugLogStream;
bool HwEmShim::mFirstBinary = true;
unsigned int HwEmShim::mBufferCount = 0;
const int xclhwemhal2::HwEmShim::SPIR_ADDRSPACE_PRIVATE = 0;
const int xclhwemhal2::HwEmShim::SPIR_ADDRSPACE_GLOBAL = 1;
const int xclhwemhal2::HwEmShim::SPIR_ADDRSPACE_CONSTANT = 2;
const int xclhwemhal2::HwEmShim::SPIR_ADDRSPACE_LOCAL = 3;
const int xclhwemhal2::HwEmShim::SPIR_ADDRSPACE_PIPES = 4;
const unsigned HwEmShim::CONTROL_AP_START = 1;
const unsigned HwEmShim::CONTROL_AP_DONE = 2;
const unsigned HwEmShim::CONTROL_AP_IDLE = 4;
const unsigned HwEmShim::CONTROL_AP_CONTINUE = 0x10;
const unsigned HwEmShim::REG_BUFF_SIZE = 0x4;
const unsigned HwEmShim::M2M_KERNEL_ARGS_SIZE = 36;
void messagesThread(xclhwemhal2::HwEmShim* inst);
// Maintain a list of all currently open device handles.
//
// xclClose removes a handle from the list. At static destruction
// the list of still open handles is iterated and devices are
// manually closed. This ensures xclClose is called for all opened
// devices even when upper level code (OpenCL in particular) doesn't
// close all acquired resources.
//
// The static handles must be descructed before other static data
// members, so it is important device_handles::handles is defined
// after above initializations. Order of static destruciton is in
// reverse order of construction.
//
// Ideally all statics should be managed in the unnamed namespace of
// this compilation unit and not be data members of the shim class.
namespace device_handles {
static std::mutex mutex;
static std::set<xclDeviceHandle> handles;
inline void
add(xclDeviceHandle hdl)
{
std::lock_guard<std::mutex> lk(mutex);
handles.insert(hdl);
}
inline void
remove(xclDeviceHandle hdl)
{
std::lock_guard<std::mutex> lk(mutex);
handles.erase(hdl);
}
struct X
{
~X()
{
auto end = handles.end();
for (auto itr = handles.begin(); itr != end;) {
xclClose(*itr); // removes handle from handles
itr = handles.begin();
}
}
};
static X x;
}
Event::Event()
{
awlen = 0;
arlen = 0 ;
eventflags = 0;
timestamp = 0;
host_timestamp =0;
readBytes = 0;
writeBytes = 0;
}
size_t HwEmShim::alloc_void(size_t new_size)
{
if (buf_size == 0)
{
buf = malloc(new_size);
return new_size;
}
if (buf_size < new_size)
{
void *temp = buf;
buf = (void*) realloc(temp,new_size);
if (!buf) // prevent leak of original buf
free(temp);
return new_size;
}
return buf_size;
}
static void saveWaveDataBases()
{
std::map<unsigned int, HwEmShim*>::iterator start = devices.begin();
std::map<unsigned int, HwEmShim*>::iterator end = devices.end();
for(; start != end; start++)
{
HwEmShim* handle = (*start).second;
if(!handle)
continue;
handle->saveWaveDataBase();
if (xclemulation::config::getInstance()->isKeepRunDirEnabled() == false) {
systemUtil::makeSystemCall(handle->deviceDirectory, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
}
}
}
std::string HwEmShim::loadFileContentsToString(const std::string& path)
{
std::ifstream file(path);
return {std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};
}
void HwEmShim::writeStringIntoFile(const std::string& path, const std::string& content)
{
std::ofstream out(path);
out << content << std::endl;
out.close();
}
std::string HwEmShim::modifyContent(const std::string& simulatorName, std::string& content)
{
if (simulatorName == "xcelium") {
// Append "-gui " to xmsim command line if not already present
if (content.find("-gui ") == std::string::npos) {
content.replace(content.find("xmsim "), 6, "xmsim -gui ");
}
} else if (simulatorName == "questa") {
// Questa always generates simulate.sh with "-c " which is batch mode. Replace "-c " with "-gui " to run in GUI mode
if (content.find("-c ") != std::string::npos) {
content.replace(content.find("-c "), 3, "-gui ");
}
}
return content;
}
void HwEmShim::writeNewSimulateScript (const std::string& simPath, const std::string& simulatorName )
{
// Write the contents of this file into a string
std::string content = loadFileContentsToString(simPath + "/simulate.sh");
// Modify as per simulator name
content = modifyContent(simulatorName, content);
// overwrite the file with modified string
writeStringIntoFile(simPath + "/simulate.sh", content);
// give permissions
std::string filePath = simPath + "/simulate.sh";
systemUtil::makeSystemCall(filePath, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
}
void HwEmShim::parseHLSPrintf(const std::string& simPath)
{
std::ifstream ifs(simPath + "/simulate.log");
std::string word = "HLS_PRINT";
std::string line;
while( getline(ifs, line ))
{
size_t pos = line.find(word);
if ( pos != std::string::npos) {
logMessage(line, 0);
}
}
}
void HwEmShim::parseSimulateLog ()
{
std::string simPath = getSimPath();
std::string content = loadFileContentsToString(simPath + "/simulate.log");
parseHLSPrintf(simPath);
if (content.find("// ERROR!!! DEADLOCK DETECTED ") != std::string::npos) {
size_t first = content.find("// ERROR!!! DEADLOCK DETECTED");
size_t last = content.find("detected!", first);
// substr including the word detected!
std::string deadlockMsg = content.substr(first , last + 9 - first);
logMessage(deadlockMsg, 0);
}
}
static size_t convert(const std::string& str)
{
return str.empty() ? 0 : std::stoul(str,0,0);
}
static void sigHandler(int sn, siginfo_t *si, void *sc)
{
switch(sn) {
case SIGSEGV:
{
saveWaveDataBases();
kill(0,SIGSEGV);
exit(1);
break;
}
case SIGFPE :
{
saveWaveDataBases();
kill(0,SIGTERM);
exit(1);
break;
}
case SIGABRT:
{
saveWaveDataBases();
kill(0,SIGABRT);
exit(1);
break;
}
default:
{
break;
}
}
}
static void printMem(std::ofstream &os, int base, uint64_t offset, void* buf, unsigned int size )
{
std::ios_base::fmtflags f( os.flags() );
if(os.is_open())
{
for(uint64_t i = 0; i < size ; i = i + base)
{
os << "@" << std::hex << offset + i <<std::endl;
for(int j = base-1 ;j >=0 ; j--)
os << std::hex << std::setfill('0') << std::setw(2) << (unsigned int)(((unsigned char*)buf)[i+j]);
os << std::endl;
}
}
os.flags( f );
}
bool HwEmShim::isUltraScale() const
{
return false;
}
int HwEmShim::xclLoadXclBin(const xclBin *header)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
char *bitstreambin = reinterpret_cast<char*> (const_cast<xclBin*> (header));
//int result = 0; Not used. Removed to get rid of compiler warning, and probably a Coverity CID.
ssize_t zipFileSize = 0;
ssize_t xmlFileSize = 0;
ssize_t debugFileSize = 0;
ssize_t memTopologySize = 0;
ssize_t pdiSize = 0;
ssize_t emuDataSize = 0;
char* zipFile = nullptr;
char* xmlFile = nullptr;
char* debugFile = nullptr;
char* memTopology = nullptr;
char* pdi = nullptr;
char* emuData = nullptr;
if (std::memcmp(bitstreambin, "xclbin2", 7)) {
PRINTENDFUNC;
return -1;
}
//check xclbin version with vivado tool version
xclemulation::checkXclibinVersionWithTool(header);
auto top = reinterpret_cast<const axlf*>(header);
if (auto sec = xclbin::get_axlf_section(top, EMBEDDED_METADATA)) {
xmlFileSize = sec->m_sectionSize;
xmlFile = new char[xmlFileSize];
memcpy(xmlFile, bitstreambin + sec->m_sectionOffset, xmlFileSize);
}
if (auto sec = xclbin::get_axlf_section(top, BITSTREAM)) {
zipFileSize = sec->m_sectionSize;
zipFile = new char[zipFileSize];
memcpy(zipFile, bitstreambin + sec->m_sectionOffset, zipFileSize);
}
if (auto sec = xclbin::get_axlf_section(top, DEBUG_IP_LAYOUT)) {
debugFileSize = sec->m_sectionSize;
debugFile = new char[debugFileSize];
memcpy(debugFile, bitstreambin + sec->m_sectionOffset, debugFileSize);
}
if (auto sec = xrt_core::xclbin::get_axlf_section(top, ASK_GROUP_TOPOLOGY)) {
memTopologySize = sec->m_sectionSize;
memTopology = new char[memTopologySize];
memcpy(memTopology, bitstreambin + sec->m_sectionOffset, memTopologySize);
}
if (auto sec = xclbin::get_axlf_section(top, PDI)) {
pdiSize = sec->m_sectionSize;
pdi = new char[pdiSize];
memcpy(pdi, bitstreambin + sec->m_sectionOffset, pdiSize);
}
if (auto sec = xclbin::get_axlf_section(top, EMULATION_DATA)) {
emuDataSize = sec->m_sectionSize;
emuData = new char[emuDataSize];
memcpy(emuData, bitstreambin + sec->m_sectionOffset, emuDataSize);
}
if(!zipFile || !xmlFile)
{
//deallocate all allocated memories to fix memory leak
if(zipFile)
{
delete[] zipFile;
zipFile = nullptr;
}
if(debugFile)
{
delete[] debugFile;
debugFile = nullptr;
}
if(xmlFile)
{
delete[] xmlFile;
xmlFile = nullptr;
}
if(memTopology)
{
delete[] memTopology;
memTopology = nullptr;
}
if (pdi) {
delete[] pdi;
pdi = nullptr;
}
if (emuData) {
delete[] emuData;
emuData = nullptr;
}
return -1;
}
bitStreamArg loadBitStreamArgs;
loadBitStreamArgs.m_zipFile = zipFile;
loadBitStreamArgs.m_zipFileSize = zipFileSize;
loadBitStreamArgs.m_xmlfile = xmlFile;
loadBitStreamArgs.m_xmlFileSize = xmlFileSize;
loadBitStreamArgs.m_debugFile = debugFile;
loadBitStreamArgs.m_debugFileSize = debugFileSize;
loadBitStreamArgs.m_memTopology = memTopology;
loadBitStreamArgs.m_memTopologySize = memTopologySize;
loadBitStreamArgs.m_pdi = pdi;
loadBitStreamArgs.m_pdiSize = pdiSize;
loadBitStreamArgs.m_emuData = emuData;
loadBitStreamArgs.m_emuDataSize = emuDataSize;
int returnValue = xclLoadBitstreamWorker(loadBitStreamArgs);
//mFirstBinary is a static member variable which becomes false once first binary gets loaded
if(returnValue >=0 && mFirstBinary )
{
HwEmShim::mDebugLogStream.open(xclemulation::getEmDebugLogFile(),std::ofstream::out);
if(xclemulation::config::getInstance()->isInfoSuppressed() == false)
{
std::string initMsg ="INFO: [HW-EMU 01] Hardware emulation runs simulation underneath. Using a large data set will result in long simulation times. It is recommended that a small dataset is used for faster execution. The flow uses approximate models for Global memories and interconnect and hence the performance data generated is approximate.";
logMessage(initMsg);
}
mFirstBinary = false;
}
if(xclemulation::config::getInstance()->isNewMbscheduler()) {
m_scheduler = new hwemu::xocl_scheduler(this);
}
else {
mCore = new exec_core;
mMBSch = new MBScheduler(this);
mMBSch->init_scheduler_thread();
}
delete[] zipFile;
delete[] debugFile;
delete[] xmlFile;
delete[] memTopology;
delete[] pdi;
delete[] emuData;
PRINTENDFUNC;
return returnValue;
}
int HwEmShim::xclLoadBitstreamWorker(bitStreamArg args)
{
bool is_enable_debug = xrt_core::config::get_is_enable_debug();
std::string aie_sim_options = xrt_core::config::get_aie_sim_options();
if (mLogStream.is_open()) {
// mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << args.m_zipFile << std::endl;
}
mCuIndx = 0;
//TBD the file read may slowdown things...whenever xclLoadBitStream hal API implementation changes, we also need to make changes.
boost::format fmt = boost::format("%1%/tempFile_%2%.zip") % deviceDirectory.c_str() % std::to_string(binaryCounter);
std::string zip_fileName = fmt.str();
//systemUtil::makeSystemCall(deviceDirectory, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
if (mMemModel)
{
delete mMemModel;
mMemModel = NULL;
}
if (sock)
{
resetProgram();
}
std::stringstream ss;
ss << deviceDirectory << "/binary_" << binaryCounter;
std::string binaryDirectory = ss.str();
systemUtil::makeSystemCall(binaryDirectory, systemUtil::systemOperation::CREATE, "", boost::lexical_cast<std::string>(__LINE__));
systemUtil::makeSystemCall(binaryDirectory, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
mRunDeviceBinDir = binaryDirectory;
std::ofstream os(zip_fileName);
os.write(args.m_zipFile, args.m_zipFileSize);
os.close();
struct sigaction s;
memset(&s, 0, sizeof(s));
s.sa_flags = SA_SIGINFO;
s.sa_sigaction = sigHandler;
if (sigaction(SIGSEGV, &s, (struct sigaction *)0) ||
sigaction(SIGFPE, &s, (struct sigaction *)0) ||
sigaction(SIGABRT, &s, (struct sigaction *)0))
{
//debug_print("unable to support all signals");
}
std::string sim_file("launch_hw_emu.sh");
// Write and read debug IP layout (for debug & profiling)
// NOTE: for now, let's do this file based so we can debug
std::string debugFileName = mRunDeviceBinDir + "/debug_ip_layout";
FILE *fp2 = fopen(debugFileName.c_str(), "wb");
if (fp2 == NULL) {
if (mLogStream.is_open())
mLogStream << __func__ << " failed to create temporary debug_ip_layout file " << std::endl;
return -1;
}
if ((args.m_debugFile != nullptr) && (args.m_debugFileSize > 1))
fwrite(args.m_debugFile, args.m_debugFileSize, 1, fp2);
fflush(fp2);
fclose(fp2);
std::string pdiFileName = binaryDirectory + "/aie_pdi";
if ((args.m_pdi != nullptr) && (args.m_pdiSize > 1))
{
FILE *fp2 = fopen(pdiFileName.c_str(), "wb");
if (fp2 == NULL) {
if (mLogStream.is_open())
mLogStream << __func__ << " failed to create temporary aie_pdi file " << std::endl;
return -1;
}
fwrite(args.m_pdi, args.m_pdiSize, 1, fp2);
fflush(fp2);
fclose(fp2);
}
readDebugIpLayout(debugFileName);
const mem_topology* m_mem = (reinterpret_cast<const ::mem_topology*>(args.m_memTopology));
if (m_mem)
{
mMembanks.clear();
for (int32_t i = 0; i<m_mem->m_count; ++i)
{
if (m_mem->m_mem_data[i].m_type == MEM_TYPE::MEM_STREAMING)
continue;
std::string tag = reinterpret_cast<const char*>(m_mem->m_mem_data[i].m_tag);
mMembanks.emplace_back(membank{ m_mem->m_mem_data[i].m_base_address, tag, m_mem->m_mem_data[i].m_size * 1024, i });
}
if (m_mem->m_count > 0)
{
mDDRMemoryManager.clear();
}
if (mLogStream.is_open())
mLogStream << __func__ << " Creating the DDRMemoryManager Object with RTD section info" << std::endl;
for (auto it : mMembanks)
{
//CR 966701: alignment to 4k (instead of mDeviceInfo.mDataAlignment)
mDDRMemoryManager.push_back(new xclemulation::MemoryManager(it.size, it.base_addr, getpagesize(), it.tag));
}
for (auto it:mDDRMemoryManager)
{
std::string tag = it->tag();
if(tag.empty() || tag.find("MBG") == std::string::npos)
continue;
for (auto it2:mDDRMemoryManager)
{
if(it2->size() !=0 &&
it2 != it &&
it->start() <= it2->start() &&
(it->start() + it->size()) >= (it2->start() + it2->size()))
{
//add child memories
it->mChildMemories.push_back(it2);
}
}
}
}
pt::ptree xml_project;
std::string sXmlFile;
sXmlFile.assign(args.m_xmlfile, args.m_xmlFileSize);
std::stringstream xml_stream;
xml_stream << sXmlFile;
pt::read_xml(xml_stream, xml_project);
// iterate platforms
int count = 0;
for (auto& xml_platform : xml_project.get_child("project"))
{
if (xml_platform.first != "platform")
continue;
if (++count > 1)
{
//Give error and return from here
}
}
std::string fpgaDevice="";
// iterate devices
count = 0;
for (auto& xml_device : xml_project.get_child("project.platform"))
{
if (xml_device.first != "device")
continue;
fpgaDevice = xml_device.second.get<std::string>("<xmlattr>.fpgaDevice");
if (++count > 1)
{
//Give error and return from here
}
}
//New DRC check for Versal Platforms
if (fpgaDevice != "" && fpgaDevice.find("versal:") != std::string::npos) {
mVersalPlatform=true;
if ((args.m_emuData == nullptr) && (args.m_emuDataSize <= 0)) {
std::string dMsg = "ERROR: [HW-EMU 09] EMULATION_DATA section is missing in XCLBIN. This is a mandatory section required for Versal platforms. Please ensure the design is built with 'v++ -package' step, which inserts EMULATION_DATA into the XCLBIN.";
logMessage(dMsg, 0);
return -1;
}
}
if (xclemulation::config::getInstance()->isSharedFmodel() && !mVersalPlatform) {
setenv("SDX_USE_SHARED_MEMORY","true",true);
}
// iterate cores
count = 0;
for (auto& xml_core : xml_project.get_child("project.platform.device"))
{
if (xml_core.first != "core")
continue;
if (++count > 1)
{
//Give error and return from here
}
}
std::vector<std::string> kernels;
// iterate kernels
for (auto& xml_kernel : xml_project.get_child("project.platform.device.core"))
{
if (xml_kernel.first != "kernel")
continue;
std::string kernelName = xml_kernel.second.get<std::string>("<xmlattr>.name");
kernels.push_back(kernelName);
if (mLogStream.is_open())
mLogStream << __func__ << " Filling kernel " << kernelName << " info from xclbin.xml" << std::endl;
for (auto& xml_kernel_info : xml_kernel.second)
{
std::map<uint64_t, KernelArg> kernelArgInfo;
if (xml_kernel_info.first == "arg")
{
std::string name = xml_kernel_info.second.get<std::string>("<xmlattr>.name");
std::string id = xml_kernel_info.second.get<std::string>("<xmlattr>.id");
std::string port = xml_kernel_info.second.get<std::string>("<xmlattr>.port");
uint64_t offset = convert(xml_kernel_info.second.get<std::string>("<xmlattr>.offset"));
uint64_t size = convert(xml_kernel_info.second.get<std::string>("<xmlattr>.size"));
KernelArg kArg;
kArg.name = kernelName + ":" + name;
kArg.size = size;
kernelArgInfo[offset] = kArg;
if (mLogStream.is_open())
mLogStream << __func__ << " Filling kernel Args name: " << name << " id: " << id << " port: " << port << " info from xclbin.xml" << std::endl;
}
if (xml_kernel_info.first == "instance")
{
std::string instanceName = xml_kernel_info.second.get<std::string>("<xmlattr>.name");
for (auto& xml_remap : xml_kernel_info.second)
{
if (xml_remap.first != "addrRemap")
continue;
if (mLogStream.is_open())
mLogStream << __func__ << " Filling kernel Instance info from xclbin.xml" << std::endl;
uint64_t base = convert(xml_remap.second.get<std::string>("<xmlattr>.base"));
mCuBaseAddress = base & 0xFFFFFFFF00000000;
std::string vbnv = mDeviceInfo.mName;
//BAD Worharound for vck5000 need to remove once SIM_QDMA supports PCIE bar
if(xclemulation::config::getInstance()->getCuBaseAddrForce()!=-1) {
mCuBaseAddress = xclemulation::config::getInstance()->getCuBaseAddrForce();
} else if(mVersalPlatform) {
mCuBaseAddress = 0x20200000000;
}
mKernelOffsetArgsInfoMap[base] = kernelArgInfo;
if (xclemulation::config::getInstance()->isMemLogsEnabled())
{
std::ofstream* controlStream = new std::ofstream;
controlStream->open(instanceName + "_control.mem");
mOffsetInstanceStreamMap[base] = controlStream;
}
break;
}
}
}
}
std::string xclBinName = xml_project.get<std::string>("project.<xmlattr>.name", "");
set_simulator_started(true);
//Thread to fetch messages from Device to display on host
if(mMessengerThreadStarted == false) {
mMessengerThread = std::thread(xclhwemhal2::messagesThread,this);
mMessengerThreadStarted = true;
}
if (mLogStream.is_open())
mLogStream << __func__ << " mMessengerThreadStarted " << std::endl;
bool simDontRun = xclemulation::config::getInstance()->isDontRun();
std::string launcherArgs = xclemulation::config::getInstance()->getLauncherArgs();
std::string wdbFileName("");
std::string kernelProfileFileName("profile_kernels.csv");
std::string kernelTraceFileName("timeline_kernels.csv");
// The following is evil--hardcoding. This name may change.
// Is there a way we can determine the name from the directories or otherwise?
std::string bdName("dr"); // Used to be opencldesign. This is new default.
unsetenv("VITIS_WAVEFORM_WDB_FILENAME");
unsetenv("VITIS_KERNEL_PROFILE_FILENAME");
unsetenv("VITIS_KERNEL_TRACE_FILENAME");
if (!simDontRun)
{
wdbFileName = std::string(mDeviceInfo.mName) + "-" + std::to_string(mDeviceIndex) + "-" + xclBinName;
xclemulation::debug_mode lWaveform = xclemulation::config::getInstance()->getLaunchWaveform();
if (lWaveform == xclemulation::debug_mode::gdb) {
std::string dMsg = "ERROR: [HW-EMU 21] debug_mode option 'gdb' is no more valid. Valid options for debug_mode are 'gui', 'batch' and 'off'. Please make sure you build the application with 'wdb' mode";
logMessage(dMsg, 0);
return -1;
}
std::string userSpecifiedSimPath = xclemulation::config::getInstance()->getSimDir();
if (userSpecifiedSimPath.empty())
{
if (mLogStream.is_open())
mLogStream << __func__ << " UNZIP of sim bin started" << std::endl;
systemUtil::makeSystemCall(zip_fileName, systemUtil::systemOperation::UNZIP, binaryDirectory, boost::lexical_cast<std::string>(__LINE__));
if (mLogStream.is_open())
mLogStream << __func__ << " UNZIP of sim bin complete" << std::endl;
systemUtil::makeSystemCall(binaryDirectory, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
if (mLogStream.is_open())
mLogStream << __func__ << " Permissions operation is complete" << std::endl;
simulatorType = getSimulatorType(binaryDirectory);
std::transform(simulatorType.begin(), simulatorType.end(), simulatorType.begin(), [](unsigned char c){return std::tolower(c);});
}
if (lWaveform == xclemulation::debug_mode::gui)
{
// NOTE: proto inst filename must match name in HPIKernelCompilerHwEmu.cpp
std::string protoFileName = "./" + bdName + "_behav.protoinst";
std::stringstream cmdLineOption;
std::string waveformDebugfilePath = "";
sim_path = binaryDirectory + "/behav_waveform/" + simulatorType;
setSimPath(sim_path);
if (boost::filesystem::exists(sim_path) != false) {
waveformDebugfilePath = sim_path + "/waveform_debug_enable.txt";
if (simulatorType == "xsim") {
cmdLineOption << " -g --wdb " << wdbFileName << ".wdb"
<< " --protoinst " << protoFileName;
launcherArgs = launcherArgs + cmdLineOption.str();
} else {
writeNewSimulateScript(sim_path, simulatorType);
}
}
std::string generatedWcfgFileName = sim_path + "/" + bdName + "_behav.wcfg";
unsetenv("VITIS_LAUNCH_WAVEFORM_BATCH");
if (waveformDebugfilePath != "" && boost::filesystem::exists(waveformDebugfilePath) != false) {
setenv("VITIS_WAVEFORM", generatedWcfgFileName.c_str(), true);
setenv("VITIS_WAVEFORM_WDB_FILENAME", std::string(wdbFileName + ".wdb").c_str(), true);
} else {
std::string dMsg = "WARNING: [HW-EMU 08-1] None of the Kernels compiled in the waveform enabled mode to get the WDB file. Do run V++ link with the -g option";
logMessage(dMsg, 0);
}
setenv("VITIS_KERNEL_PROFILE_FILENAME", kernelProfileFileName.c_str(), true);
setenv("VITIS_KERNEL_TRACE_FILENAME", kernelTraceFileName.c_str(), true);
}
if (lWaveform == xclemulation::debug_mode::batch)
{
// NOTE: proto inst filename must match name in HPIKernelCompilerHwEmu.cpp
std::string protoFileName = "./" + bdName + "_behav.protoinst";
std::stringstream cmdLineOption;
cmdLineOption << " --wdb " << wdbFileName << ".wdb"
<< " --protoinst " << protoFileName;
launcherArgs = launcherArgs + cmdLineOption.str();
sim_path = binaryDirectory + "/behav_waveform/" + simulatorType;
setSimPath(sim_path);
std::string waveformDebugfilePath = sim_path + "/waveform_debug_enable.txt";
std::string generatedWcfgFileName = sim_path + "/" + bdName + "_behav.wcfg";
setenv("VITIS_LAUNCH_WAVEFORM_BATCH", "1", true);
if (boost::filesystem::exists(waveformDebugfilePath) != false) {
setenv("VITIS_WAVEFORM", generatedWcfgFileName.c_str(), true);
setenv("VITIS_WAVEFORM_WDB_FILENAME", std::string(wdbFileName + ".wdb").c_str(), true);
} else {
std::string dMsg = "WARNING: [HW-EMU 08-2] None of the Kernels compiled in the waveform enabled mode to get the WDB file. Do run v++ link with the -g option";
logMessage(dMsg, 0);
}
setenv("VITIS_KERNEL_PROFILE_FILENAME", kernelProfileFileName.c_str(), true);
setenv("VITIS_KERNEL_TRACE_FILENAME", kernelTraceFileName.c_str(), true);
}
if (lWaveform == xclemulation::debug_mode::off) {
// NOTE: proto inst filename must match name in HPIKernelCompilerHwEmu.cpp
std::string protoFileName = "./" + bdName + "_behav.protoinst";
std::stringstream cmdLineOption;
cmdLineOption << " --wdb " << wdbFileName << ".wdb"
<< " --protoinst " << protoFileName;
launcherArgs = launcherArgs + cmdLineOption.str();
sim_path = binaryDirectory + "/behav_waveform/" + simulatorType;
setSimPath(sim_path);
setenv("VITIS_LAUNCH_WAVEFORM_BATCH", "1", true);
}
/*if (lWaveform == xclemulation::debug_mode::gdb) {
sim_path = binaryDirectory + "/behav_gdb/" + simulatorType;
setSimPath(sim_path);
}*/
if (userSpecifiedSimPath.empty() == false)
{
sim_path = userSpecifiedSimPath;
setSimPath(sim_path);
systemUtil::makeSystemCall(sim_path, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
}
else
{
if (sim_path.empty())
{
sim_path = binaryDirectory + "/behav_waveform/" + simulatorType;
setSimPath(sim_path);
}
// As gdb feature is unsupported for 2021.1, we removed this cross check. We will re-enable it once we have 2 possibilities
/*if (boost::filesystem::exists(sim_path) == false)
{
if (lWaveform == xclemulation::debug_mode::gdb) {
sim_path = binaryDirectory + "/behav_waveform/" + simulatorType;
setSimPath(sim_path);
std::string waveformDebugfilePath = sim_path + "/waveform_debug_enable.txt";
std::string dMsg = "WARNING: [HW-EMU 07] debug_mode is set to 'gdb' in INI file and none of kernels compiled in 'gdb' mode. Running simulation using waveform mode. Do run v++ link with -g and --xp param:hw_emu.debugMode=gdb options to launch simulation in 'gdb' mode";
logMessage(dMsg, 0);
std::string protoFileName = "./" + bdName + "_behav.protoinst";
std::stringstream cmdLineOption;
cmdLineOption << " --wdb " << wdbFileName << ".wdb"
<< " --protoinst " << protoFileName;
launcherArgs = launcherArgs + cmdLineOption.str();
std::string generatedWcfgFileName = sim_path + "/" + bdName + "_behav.wcfg";
setenv("VITIS_LAUNCH_WAVEFORM_BATCH", "1", true);
if (boost::filesystem::exists(waveformDebugfilePath) != false) {
setenv("VITIS_WAVEFORM", generatedWcfgFileName.c_str(), true);
setenv("VITIS_WAVEFORM_WDB_FILENAME", std::string(wdbFileName + ".wdb").c_str(), true);
}
// Commented to set these when debug_mode is set to gdb
//setenv("VITIS_KERNEL_PROFILE_FILENAME", kernelProfileFileName.c_str(), true);
//setenv("VITIS_KERNEL_TRACE_FILENAME", kernelTraceFileName.c_str(), true);
}
else {
std::string dMsg;
sim_path = binaryDirectory + "/behav_gdb/" + simulatorType;
setSimPath(sim_path);
if (lWaveform == xclemulation::debug_mode::gui)
dMsg = "WARNING: [HW-EMU 07] debug_mode is set to 'gui' in ini file. Cannot enable simulator gui in this mode. Using " + sim_path + " as simulation directory.";
else if (lWaveform == xclemulation::debug_mode::batch)
dMsg = "WARNING: [HW-EMU 07] debug_mode is set to 'batch' in ini file. Using " + sim_path + " as simulation directory.";
else
dMsg = "WARNING: [HW-EMU 07] debug_mode is set to 'off' in ini file (or) considered by default. Using " + sim_path + " as simulation directory.";
logMessage(dMsg, 0);
}
}*/
}
if (mLogStream.is_open())
mLogStream << __func__ << " Preparing the launcher args and construction of proper simpath is complete sim_path: " << sim_path << std::endl;
std::stringstream socket_id;
socket_id << deviceName << "_" << binaryCounter << "_";
#ifndef _WINDOWS
// TODO: Windows build support
// getpid is defined in unistd.h
// setenv is defined in stdlib.h
socket_id << getpid();
setenv("EMULATION_SOCKETID", socket_id.str().c_str(), true);
#endif
if (mLogStream.is_open())
mLogStream << __func__ << " socket_id: " << socket_id.str().c_str() << " binaryCounter: " << binaryCounter << std::endl;
binaryCounter++;
}
if(mHostMemAccessThreadStarted == false) {
mHostMemAccessThread = std::thread(xclhwemhal2::hostMemAccessThread,this);
}
if (deviceDirectory.empty() == false)
setenv("EMULATION_RUN_DIR", deviceDirectory.c_str(), true);
// Create waveform config file
// NOTE: see corresponding wdb file in saveWaveDataBase
if (wdbFileName.empty() == false)
{
setenv("SDX_QUESTA_WLF_FILENAME", std::string(wdbFileName + ".wlf").c_str(), true);
mBinaryDirectories[sim_path] = wdbFileName;
}
//launch simulation
if (boost::filesystem::exists(sim_path) == true) {
#ifndef _WINDOWS
// TODO: Windows build support
// pid_t, fork, chdir, execl is defined in unistd.h
// this environment variable is added to disable the systemc copyright message
setenv("SYSTEMC_DISABLE_COPYRIGHT_MESSAGE", "1", true);
pid_t pid = fork();
assert(pid >= 0);
if (mLogStream.is_open())
mLogStream << __func__ << " Child process created to launch the simulation process " << std::endl;
if (pid == 0) { //I am child
//Redirecting the XSIM log to a file
FILE* nP = freopen("/dev/null", "w", stdout);
if (!nP) { std::cerr << "FATAR ERROR : Unable to redirect simulation output " << std::endl; exit(1); }
int rV = chdir(sim_path.c_str());
if (rV == -1){ std::cerr << "FATAL ERROR : Unable to go to simulation directory " << std::endl; exit(1); }
// If the sdx server port was specified in the .ini file,
// we need to pass this information to the spawned xsim process.
if (xclemulation::config::getInstance()->getServerPort() != 0)
{
std::stringstream convert;
convert << xclemulation::config::getInstance()->getServerPort();
setenv("XILINX_SDX_SERVER_PORT", convert.str().c_str(), 1);
}
if (mLogStream.is_open() && launcherArgs.empty() == false)
mLogStream << __func__ << " xocc command line: " << launcherArgs << std::endl;
const char* simMode = NULL;
std::string userSpecifiedPreSimScript = xclemulation::config::getInstance()->getUserPreSimScript();
std::string userSpecifiedPostSimScript = xclemulation::config::getInstance()->getUserPostSimScript();
std::string wcfgFilePath = xclemulation::config::getInstance()->getWcfgFilePath();
if (userSpecifiedPreSimScript != "" && wcfgFilePath != "") {
std::cout << "WARNING: [HW-EMU] Both user_pre_sim_script and wcfg_file_path are provided. Either one of the option is accepted. Giving predence for wcfg_file_path." << std::endl;
}
std::string pre_sim_script;
if (wcfgFilePath != "") {
createPreSimScript(wcfgFilePath, pre_sim_script);
}
if (args.m_emuData) {
//Assuming that we will have only one AIE Kernel, need to
//update this logic when we have suport for multiple AIE Kernels
extractEmuData(sim_path, binaryCounter, args);
if (boost::filesystem::exists(sim_path + "/emulation_data/libsdf/cfg/aie.sim.config.txt")) {
launcherArgs += " -emuData " + sim_path + "/emulation_data/libsdf/cfg/aie.sim.config.txt";
launcherArgs += " -aie-sim-config " + sim_path + "/emulation_data/libsdf/cfg/aie.sim.config.txt";
} else if (boost::filesystem::exists(sim_path + "/emulation_data/libadf/cfg/aie.sim.config.txt")) {
launcherArgs += " -emuData " + sim_path + "/emulation_data/libadf/cfg/aie.sim.config.txt";
launcherArgs += " -aie-sim-config " + sim_path + "/emulation_data/libadf/cfg/aie.sim.config.txt";
} else {
launcherArgs += " -emuData " + sim_path + "/emulation_data/cfg/aie.sim.config.txt";
launcherArgs += " -aie-sim-config " + sim_path + "/emulation_data/cfg/aie.sim.config.txt";
}
launcherArgs += " -boot-bh " + sim_path + "/emulation_data/BOOT_bh.bin";
launcherArgs += " -ospi-image " + sim_path + "/emulation_data/qemu_ospi.bin";
launcherArgs += " -qemu-args-file " + sim_path + "/emulation_data/qemu_args.txt";
if (boost::filesystem::exists(sim_path + "/emulation_data/pmc_args.txt")) {
launcherArgs += " -pmc-args-file " + sim_path + "/emulation_data/pmc_args.txt";
}
else if (boost::filesystem::exists(sim_path + "/emulation_data/pmu_args.txt")) {
launcherArgs += " -pmc-args-file " + sim_path + "/emulation_data/pmu_args.txt";
}
else {
std::cout << "ERROR: [HW-EMU] Unable to find either PMU/PMC args which are required to launch the emulation." << std::endl;
}
if (is_enable_debug) {
launcherArgs += " -enable-debug ";
}
if (aie_sim_options != "") {
launcherArgs += " -aie-sim-options " + aie_sim_options;
}
if (wcfgFilePath != "") {
launcherArgs += " -user-pre-sim-script " + pre_sim_script;
}
else {
if (userSpecifiedPreSimScript != "") {
launcherArgs += " -user-pre-sim-script " + userSpecifiedPreSimScript;
}
}
if (userSpecifiedPostSimScript != "") {
launcherArgs += " -user-post-sim-script " + userSpecifiedPostSimScript;
}
}
else {
if (pre_sim_script != "" && wcfgFilePath != "") {
setenv("USER_PRE_SIM_SCRIPT", pre_sim_script.c_str(), true);
}
}
if (!launcherArgs.empty())
simMode = launcherArgs.c_str();
if (!file_exists(sim_file))
sim_file = "simulate.sh";
int r = execl(sim_file.c_str(), sim_file.c_str(), simMode, NULL);
fclose(stdout);
if (r == -1){ std::cerr << "FATAL ERROR : Simulation process did not launch" << std::endl; exit(1); }
exit(0);
}
#endif
}
if (mLogStream.is_open())
mLogStream << __func__ << " Child process launched... " << std::endl;
//if platform is a XPR platform, dont serilize ddr memory
if (isXPR())
{
mEnvironmentNameValueMap["enable_pr"] = "false";
}
sock = new unix_socket;
if (mLogStream.is_open())
mLogStream << __func__ << " Created the Unix socket." << std::endl;
if (sock && mEnvironmentNameValueMap.empty() == false)
{
//send environment information to device
bool ack = true;
if (mLogStream.is_open())
mLogStream << __func__ << " Before RPC call xclSetEnvironment_RPC_CALL." << std::endl;
xclSetEnvironment_RPC_CALL(xclSetEnvironment);
if (!ack)
{
if (mLogStream.is_open())
mLogStream << __func__ << "Environment is NOT set properly" << std::endl;
//std::cout<<"environment is not set properly"<<std::endl;
}
if (mLogStream.is_open())
mLogStream << __func__ << "Environment is set properly" << std::endl;
}
return 0;
}
void HwEmShim::createPreSimScript(const std::string& wcfgFilePath, std::string& preSimScriptPath) {
char path[FILENAME_MAX];
size_t size = MAXPATHLEN;
char* pPath = GetCurrentDir(path, size);
preSimScriptPath = std::string(pPath) + "/pre_sim_script.tcl";
std::ofstream pssStrem;
pssStrem.open(preSimScriptPath);
pssStrem << "open_wave_config " << wcfgFilePath << std::endl;
pssStrem.close();
}
void HwEmShim::extractEmuData(const std::string& simPath, int binaryCounter, bitStreamArg args) {
std::unique_ptr<char[]> emuDataFileName(new char[1024]);
#ifndef _WINDOWS
// TODO: Windows build support
// getpid is defined in unistd.h
std::sprintf(emuDataFileName.get(), "%s/emuDataFile_%d", mRunDeviceBinDir.c_str(), binaryCounter);
#endif
if ((args.m_emuData != nullptr) && (args.m_emuDataSize > 1))
{
std::ofstream os(emuDataFileName.get());
os.write(args.m_emuData, args.m_emuDataSize);
os.close();
std::string emuDataFilePath(emuDataFileName.get());
systemUtil::makeSystemCall(emuDataFilePath, systemUtil::systemOperation::UNZIP, simPath, boost::lexical_cast<std::string>(__LINE__));
systemUtil::makeSystemCall(mRunDeviceBinDir, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
}
}
size_t HwEmShim::xclWrite(xclAddressSpace space, uint64_t offset, const void *hostBuf, size_t size) {
if (!simulator_started)
return 0;
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << space << ", "
<< offset << ", " << hostBuf << ", " << size << std::endl;
}
offset = offset | mCuBaseAddress;
switch (space) {
case XCL_ADDR_SPACE_DEVICE_RAM:
{
const size_t totalSize = size;
const size_t mod_size1 = offset % DDR_BUFFER_ALIGNMENT;
const size_t mod_size2 = size % DDR_BUFFER_ALIGNMENT;
if (mod_size1) {
// Buffer not aligned at DDR_BUFFER_ALIGNMENT boundary, need to do Read-Modify-Write
size_t returnVal = xclReadModifyWrite(offset, hostBuf, size);
PRINTENDFUNC;
return returnVal;
}
else if (mod_size2) {
// Buffer not a multiple of DDR_BUFFER_ALIGNMENT, write out the initial block and
// then perform a Read-Modify-Write for the remainder buffer
const size_t blockSize = size - mod_size2;
if (xclWrite(space, offset, hostBuf, blockSize) != blockSize)
{
PRINTENDFUNC;
return -1;
}
offset += blockSize;
hostBuf = static_cast<const char*>(hostBuf) + blockSize;
if (xclReadModifyWrite(offset, hostBuf, mod_size2) != mod_size2)
{
PRINTENDFUNC;
return -1;
}
PRINTENDFUNC;
return totalSize;
}
const char *curr = (const char *)hostBuf;
xclWriteAddrSpaceDeviceRam_RPC_CALL(xclWriteAddrSpaceDeviceRam ,space,offset,curr,size);
PRINTENDFUNC;
return totalSize;
}
case XCL_ADDR_SPACE_DEVICE_PERFMON:
{
const char *curr = (const char *)hostBuf;
std::map<uint64_t,std::pair<std::string,unsigned int>> offsetArgInfo;
xclWriteAddrKernelCtrl_RPC_CALL(xclWriteAddrKernelCtrl ,space,offset,curr,size,offsetArgInfo);
PRINTENDFUNC;
return size;
}
case XCL_ADDR_SPACE_DEVICE_CHECKER:
{
PRINTENDFUNC;
return -1;
}
case XCL_ADDR_KERNEL_CTRL:
{
std::map<uint64_t,std::pair<std::string,unsigned int>> offsetArgInfo;
unsigned int paddingFactor = xclemulation::config::getInstance()->getPaddingFactor();
std::string kernelName("");
uint32_t *hostBuf32 = ((uint32_t*)hostBuf);
// if(hostBuf32[0] & CONTROL_AP_START)
{
auto offsetKernelArgInfoItr = mKernelOffsetArgsInfoMap.find(offset);
if(offsetKernelArgInfoItr != mKernelOffsetArgsInfoMap.end())
{
unsigned char* axibuf=((unsigned char*) hostBuf);
std::map<uint64_t, KernelArg> kernelArgInfo = (*offsetKernelArgInfoItr).second;
for (auto i : kernelArgInfo)
{
uint64_t argOffset = i.first;
KernelArg kArg = i.second;
uint64_t argPointer = 0;
std::memcpy(&argPointer,axibuf+ argOffset,kArg.size);
std::map<uint64_t,uint64_t>::iterator it = mAddrMap.find(argPointer);
if(it != mAddrMap.end())
{
uint64_t offsetSize = (*it).second;
uint64_t padding = (paddingFactor == 0) ? 0 : offsetSize/(1+(paddingFactor*2));
std::pair<std::string,unsigned int> sizeNamePair(kArg.name,offsetSize);
if(hostBuf32[0] & CONTROL_AP_START)
offsetArgInfo[argPointer-padding] = sizeNamePair;
size_t pos = kArg.name.find(":");
if(pos != std::string::npos)
{
kernelName = kArg.name.substr(0,pos);
}
}
}
}
}
auto controlStreamItr = mOffsetInstanceStreamMap.find(offset);
if(controlStreamItr != mOffsetInstanceStreamMap.end())
{
std::ofstream* controlStream = (*controlStreamItr).second;
if(hostBuf32[0] & CONTROL_AP_START)
printMem(*controlStream,4, offset, (void*)hostBuf, 4 );
else
printMem(*controlStream,4, offset, (void*)hostBuf, size );
}
if(hostBuf32[0] & CONTROL_AP_START)
{
std::string dMsg ="INFO: [HW-EMU 04-0] Sending start signal to the kernel " + kernelName;
logMessage(dMsg,1);
}
else
{
std::string dMsg ="INFO: [HW-EMU 03-0] Configuring registers for the kernel " + kernelName +" Started";
logMessage(dMsg,1);
}
xclWriteAddrKernelCtrl_RPC_CALL(xclWriteAddrKernelCtrl,space,offset,hostBuf,size,offsetArgInfo);
if(hostBuf32[0] & CONTROL_AP_START)
{
std::string dMsg ="INFO: [HW-EMU 04-1] Kernel " + kernelName +" is Started";
logMessage(dMsg,1);
}
else
{
std::string dMsg ="INFO: [HW-EMU 03-1] Configuring registers for the kernel " + kernelName +" Ended";
logMessage(dMsg,1);
}
PRINTENDFUNC;
return size;
}
default:
{
PRINTENDFUNC;
return -1;
}
}
}
size_t HwEmShim::xclRead(xclAddressSpace space, uint64_t offset, void *hostBuf, size_t size) {
//if(tracecount_calls < xclemulation::config::getInstance()->getMaxTraceCount())
//{
// tracecount_calls = tracecount_calls + 1;
// return 0;
//}
//tracecount_calls = 0;
if (!simulator_started)
return 0;
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << space << ", "
<< offset << ", " << hostBuf << ", " << size << std::endl;
}
offset = offset | mCuBaseAddress;
switch (space) {
case XCL_ADDR_SPACE_DEVICE_RAM:
{
const size_t mod_size1 = offset % DDR_BUFFER_ALIGNMENT;
const size_t mod_size2 = size % DDR_BUFFER_ALIGNMENT;
const size_t totalSize = size;
if (mod_size1) {
// Buffer not aligned at DDR_BUFFER_ALIGNMENT boundary, need to do Read-Skip-Copy
size_t returnVal = xclReadSkipCopy(offset, hostBuf, size);
PRINTENDFUNC;
return returnVal;
}
else if (mod_size2) {
// Buffer not a multiple of DDR_BUFFER_ALIGNMENT, read the initial block and
// then perform a Read-Skip-Copy for the remainder buffer
const size_t blockSize = size - mod_size2;
if (xclRead(space, offset, hostBuf, blockSize) != blockSize)
{
PRINTENDFUNC;
return -1;
}
offset += blockSize;
hostBuf = static_cast<char*>(hostBuf) + blockSize;
if (xclReadSkipCopy(offset, hostBuf, mod_size2) != mod_size2)
{
PRINTENDFUNC;
return -1;
}
PRINTENDFUNC;
return totalSize;
}
//const char *curr = (const char *)hostBuf;
xclReadAddrSpaceDeviceRam_RPC_CALL(xclReadAddrSpaceDeviceRam,space,offset,hostBuf,size);
PRINTENDFUNC;
return totalSize;
}
case XCL_ADDR_SPACE_DEVICE_PERFMON:
{
xclGetDebugMessages();
xclReadAddrKernelCtrl_RPC_CALL(xclReadAddrKernelCtrl,space,offset,hostBuf,size);
PRINTENDFUNC;
return -1;
}
case XCL_ADDR_SPACE_DEVICE_CHECKER:
{
PRINTENDFUNC;
return -1;
}
case XCL_ADDR_KERNEL_CTRL:
{
xclGetDebugMessages();
xclReadAddrKernelCtrl_RPC_CALL(xclReadAddrKernelCtrl,space,offset,hostBuf,size);
PRINTENDFUNC;
return size;
}
default:
{
PRINTENDFUNC;
return -1;
}
}
}
uint32_t HwEmShim::getAddressSpace (uint32_t topology)
{
if(mMembanks.size() <= topology)
return 0;
if(mMembanks[topology].tag.find("bank") != std::string::npos)
{
return 0;
}
if(mMembanks[topology].tag.find("HBM") != std::string::npos)
{
return 2;
}
return 1;
}
size_t HwEmShim::xclCopyBufferHost2Device(uint64_t dest, const void *src, size_t size, size_t seek, uint32_t topology)
{
if(!sock)
{
if(!mMemModel)
mMemModel = new mem_model(deviceName);
mMemModel->writeDevMem(dest,src,size);
return size;
}
src = (unsigned char*)src + seek;
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << dest << ", "
<< src << ", " << size << ", " << seek << std::endl;
}
std::string dMsg ="INFO: [HW-EMU 02-0] Copying buffer from host to device started : size = " + std::to_string(size);
logMessage(dMsg,1);
void *handle = this;
uint64_t messageSize = xclemulation::config::getInstance()->getPacketSize();
uint64_t c_size = messageSize;
uint64_t processed_bytes = 0;
while(processed_bytes < size){
if((size - processed_bytes) < messageSize){
c_size = size - processed_bytes;
}else{
c_size = messageSize;
}
void* c_src = (((unsigned char*)(src)) + processed_bytes);
uint64_t c_dest = dest + processed_bytes;
#ifndef _WINDOWS
// TODO: Windows build support
// *_RPC_CALL uses unix_socket
uint32_t space = getAddressSpace(topology);
xclCopyBufferHost2Device_RPC_CALL(xclCopyBufferHost2Device,handle,c_dest,c_src,c_size,seek,space);
#endif
processed_bytes += c_size;
}
dMsg ="INFO: [HW-EMU 02-1] Copying buffer from host to device ended";
logMessage(dMsg,1);
PRINTENDFUNC;
printMem(mGlobalInMemStream, 16 , dest , (void*)src, size );
return size;
}
size_t HwEmShim::xclCopyBufferDevice2Host(void *dest, uint64_t src, size_t size, size_t skip, uint32_t topology)
{
dest = ((unsigned char*)dest) + skip;
if(!sock)
{
if(!mMemModel)
mMemModel = new mem_model(deviceName);
mMemModel->readDevMem(src,dest,size);
return size;
}
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << dest << ", "
<< src << ", " << size << ", " << skip << std::endl;
}
std::string dMsg ="INFO: [HW-EMU 05-0] Copying buffer from device to host started. size := " + std::to_string(size);
logMessage(dMsg,1);
void *handle = this;
uint64_t messageSize = xclemulation::config::getInstance()->getPacketSize();
uint64_t c_size = messageSize;
uint64_t processed_bytes = 0;
while(processed_bytes < size){
if((size - processed_bytes) < messageSize){
c_size = size - processed_bytes;
}else{
c_size = messageSize;
}
void* c_dest = (((unsigned char*)(dest)) + processed_bytes);
uint64_t c_src = src + processed_bytes;
#ifndef _WINDOWS
uint32_t space = getAddressSpace(topology);
xclCopyBufferDevice2Host_RPC_CALL(xclCopyBufferDevice2Host,handle,c_dest,c_src,c_size,skip,space);
#endif
processed_bytes += c_size;
}
dMsg ="INFO: [HW-EMU 05-1] Copying buffer from device to host ended";
logMessage(dMsg,1);
PRINTENDFUNC;
printMem(mGlobalOutMemStream, 16 , src , dest , size );
return size;
}
uint64_t HwEmShim::xclAllocDeviceBuffer(size_t size)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << size << std::endl;
}
uint64_t origSize = size;
if (size == 0)
size = DDR_BUFFER_ALIGNMENT;
unsigned int paddingFactor = xclemulation::config::getInstance()->getPaddingFactor();
uint64_t result = xclemulation::MemoryManager::mNull;
for (auto i : mDDRMemoryManager) {
result = i->alloc(size,paddingFactor);
if (result != xclemulation::MemoryManager::mNull)
break;
}
uint64_t finalValidAddress = result+(paddingFactor*size);
uint64_t finalSize = size+(2*paddingFactor*size);
mAddrMap[finalValidAddress] = finalSize;
bool ack = false;
if(sock)
{
bool noHostMemory= false;
std::string sFileName("");
xclAllocDeviceBuffer_RPC_CALL(xclAllocDeviceBuffer,finalValidAddress,origSize,noHostMemory);
PRINTENDFUNC;
if(!ack)
return 0;
}
return finalValidAddress;
}
uint64_t HwEmShim::xclAllocDeviceBuffer2(size_t& size, xclMemoryDomains domain, unsigned flags, bool noHostMemory, unsigned boFlags, std::string &sFileName, std::map<uint64_t,uint64_t>& chunks)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << size <<", "<<domain<<", "<< flags <<std::endl;
}
if (domain != XCL_MEM_DEVICE_RAM)
{
PRINTENDFUNC;
return xclemulation::MemoryManager::mNull;
}
if (size == 0)
size = DDR_BUFFER_ALIGNMENT;
if (flags >= mDDRMemoryManager.size()) {
PRINTENDFUNC;
return xclemulation::MemoryManager::mNull;
}
uint64_t origSize = size;
unsigned int paddingFactor = xclemulation::config::getInstance()->getPaddingFactor();
uint64_t result = mDDRMemoryManager[flags]->alloc(size, paddingFactor,chunks);
if(result == xclemulation::MemoryManager::mNull)
return result;
uint64_t finalValidAddress = result+(paddingFactor*size);
uint64_t finalSize = size+(2*paddingFactor*size);
mAddrMap[finalValidAddress] = finalSize;
bool ack = false;
if(sock)
{
if (boFlags & XCL_BO_FLAGS_HOST_ONLY) { // bypassed the xclAllocDeviceBuffer RPC call for Slave Bridge (host only buffer)
} else {
if(chunks.size())
{
for (auto it:chunks)
{
xclAllocDeviceBuffer_RPC_CALL(xclAllocDeviceBuffer, it.first, it.second, noHostMemory);
}
}
else
{
xclAllocDeviceBuffer_RPC_CALL(xclAllocDeviceBuffer, finalValidAddress, origSize, noHostMemory);
}
PRINTENDFUNC;
if (!ack)
return 0;
}
}
return finalValidAddress;
}
void HwEmShim::xclFreeDeviceBuffer(uint64_t offset, bool sendtoxsim)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << offset << std::endl;
}
for (auto i : mDDRMemoryManager) {
if (offset < i->start() + i->size()) {
i->free(offset);
}
}
bool ack = true;
if(sock)
{
//Currently Versal platforms does not support buffer deallocation
if(!mVersalPlatform && sendtoxsim) {
xclFreeDeviceBuffer_RPC_CALL(xclFreeDeviceBuffer,offset);
}
}
if(!ack)
{
PRINTENDFUNC;
return;
}
PRINTENDFUNC;
}
void HwEmShim::logMessage(std::string& msg , int verbosity)
{
if( verbosity > xclemulation::config::getInstance()->getVerbosityLevel())
return;
if ( mDebugLogStream.is_open())
mDebugLogStream << msg<<std::endl;
if(xclemulation::config::getInstance()->isInfosToBePrintedOnConsole())
std::cout<<msg<<std::endl;
}
void HwEmShim::saveWaveDataBase()
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
xclemulation::debug_mode lWaveform = xclemulation::config::getInstance()->getLaunchWaveform();
// The following is evil--hardcoding. This name may change.
// Is there a way we can determine the name from the directories or otherwise?
std::string bdName("dr"); // Used to be opencldesign. This is new default.
int i = 0;
for(auto it :mBinaryDirectories)
{
std::string binaryDirectory = it.first;
std::string fileName = it.second;
char path[FILENAME_MAX];
size_t size = MAXPATHLEN;
char* pPath = GetCurrentDir(path,size);
if(pPath)
{
// Copy waveform database
if (lWaveform != xclemulation::debug_mode::off) {
std::string extension = "wdb";
if (boost::filesystem::exists(binaryDirectory+"/msim"))
{
extension = "wlf";
}
std::string wdbFileName = binaryDirectory + "/" + fileName + "."+extension;
std::string destPath = "'" + std::string(path) + "/" + fileName +"." + extension + "'";
systemUtil::makeSystemCall(wdbFileName, systemUtil::systemOperation::COPY,destPath, boost::lexical_cast<std::string>(__LINE__));
// Copy waveform config
std::string wcfgFilePath= binaryDirectory + "/" + bdName + "_behav.wcfg";
std::string destPath2 = "'" + std::string(path) + "/" + fileName + ".wcfg'";
systemUtil::makeSystemCall(wcfgFilePath, systemUtil::systemOperation::COPY, destPath2, boost::lexical_cast<std::string>(__LINE__));
// Append to detailed kernel trace data mining results file
std::string logFilePath= binaryDirectory + "/profile_kernels.csv";
std::string destPath3 = "'" + std::string(path) + "/profile_kernels.csv'";
systemUtil::makeSystemCall(logFilePath, systemUtil::systemOperation::APPEND, destPath3, boost::lexical_cast<std::string>(__LINE__));
xclemulation::copyLogsFromOneFileToAnother(logFilePath, mDebugLogStream);
// Append to detailed kernel trace "timeline" file
std::string traceFilePath = binaryDirectory + "/timeline_kernels.csv";
std::string destPath4 = "'" + std::string(path) + "/timeline_kernels.csv'";
systemUtil::makeSystemCall(traceFilePath, systemUtil::systemOperation::APPEND, destPath4, boost::lexical_cast<std::string>(__LINE__));
// Copy proto inst file
std::string protoFilePath= binaryDirectory + "/" + bdName + "_behav.protoinst";
std::string destPath6 = "'" + std::string(path) + "/" + fileName + ".protoinst'";
systemUtil::makeSystemCall(protoFilePath, systemUtil::systemOperation::COPY, destPath6, boost::lexical_cast<std::string>(__LINE__));
if (mLogStream.is_open())
mLogStream << "appended " << logFilePath << " to " << destPath3 << std::endl;
}
// Copy Simulation Log file
std::string simulationLogFilePath= binaryDirectory + "/" + "simulate.log";
std::string destPath5 = "'" + std::string(path) + "/" + fileName + "_simulate.log'";
systemUtil::makeSystemCall(simulationLogFilePath, systemUtil::systemOperation::COPY, destPath5, boost::lexical_cast<std::string>(__LINE__));
// Copy xsc_report Log file
std::string xscReportLogFilePath= binaryDirectory + "/" + "xsc_report.log";
std::string destPath8 = "'" + std::string(path) + "/" + fileName + "_xsc_report.log'";
systemUtil::makeSystemCall(xscReportLogFilePath, systemUtil::systemOperation::COPY, destPath8, boost::lexical_cast<std::string>(__LINE__));
}
i++;
}
mBinaryDirectories.clear();
PRINTENDFUNC;
if (mLogStream.is_open()) {
mLogStream.close();
}
}
void HwEmShim::xclClose()
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
for (auto& it: mFdToFileNameMap)
{
int fd=it.first;
int sSize = std::get<1>(it.second);
void* addr = std::get<2>(it.second);
munmap(addr,sSize);
close(fd);
}
mFdToFileNameMap.clear();
// Shim object is not deleted as part of closing device.
// The core device must correspond to open and close, so
// reset here rather than in destructor
mCoreDevice.reset();
device_handles::remove(this);
if (!sock)
{
if (xclemulation::config::getInstance()->isKeepRunDirEnabled() == false) {
systemUtil::makeSystemCall(deviceDirectory, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
}
if(mMBSch && mCore)
{
mMBSch->fini_scheduler_thread();
delete mCore;
mCore = NULL;
delete mMBSch;
mMBSch = NULL;
}
if(m_scheduler)
{
delete m_scheduler;
m_scheduler = nullptr;
}
PRINTENDFUNC;
if (mLogStream.is_open()) {
mLogStream.close();
}
return;
}
resetProgram(false);
int status = 0;
xclemulation::debug_mode lWaveform = xclemulation::config::getInstance()->getLaunchWaveform();
if(( lWaveform == xclemulation::debug_mode::gui || lWaveform == xclemulation::debug_mode::batch || lWaveform == xclemulation::debug_mode::off)
&& xclemulation::config::getInstance()->isInfoSuppressed() == false)
{
std::string waitingMsg ="INFO: [HW-EMU 06-0] Waiting for the simulator process to exit";
logMessage(waitingMsg);
}
bool simDontRun = xclemulation::config::getInstance()->isDontRun();
if(!simDontRun)
while (-1 == waitpid(0, &status, 0));
if(( lWaveform == xclemulation::debug_mode::gui || lWaveform == xclemulation::debug_mode::batch || lWaveform == xclemulation::debug_mode::off)
&& xclemulation::config::getInstance()->isInfoSuppressed() == false)
{
std::string waitingMsg ="INFO: [HW-EMU 06-1] All the simulator processes exited successfully";
logMessage(waitingMsg);
}
saveWaveDataBase();
if( xclemulation::config::getInstance()->isKeepRunDirEnabled() == false)
systemUtil::makeSystemCall(deviceDirectory, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
google::protobuf::ShutdownProtobufLibrary();
PRINTENDFUNC;
if (mLogStream.is_open()) {
mLogStream.close();
}
}
int HwEmShim::resetProgram(bool saveWdb)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
for (auto& it: mFdToFileNameMap)
{
int fd=it.first;
int sSize = std::get<1>(it.second);
void* addr = std::get<2>(it.second);
munmap(addr,sSize);
close(fd);
}
mFdToFileNameMap.clear();
if(!sock)
{
PRINTENDFUNC;
if(mMBSch && mCore)
{
mMBSch->fini_scheduler_thread();
delete mCore;
mCore = NULL;
delete mMBSch;
mMBSch = NULL;
}
if(m_scheduler)
{
delete m_scheduler;
m_scheduler = nullptr;
}
return 0;
}
#ifndef _WINDOWS
// TODO: Windows build support
// *_RPC_CALL uses unix_socket
#endif
Event eventObj;
uint32_t numSlots = getPerfMonNumberSlots(XCL_PERF_MON_MEMORY);
bool ack = true;
for(unsigned int counter = 0 ; counter < numSlots; counter++)
{
unsigned int samplessize = 0;
if (counter == XPAR_AIM0_HOST_SLOT)
continue;
char slotname[128];
getPerfMonSlotName(XCL_PERF_MON_MEMORY,counter,slotname,128);
if (simulator_started == true)
{
#ifndef _WINDOWS
// TODO: Windows build support
// *_RPC_CALL uses unix_socket
do
{
bool accel=false;
xclPerfMonReadTrace_RPC_CALL(xclPerfMonReadTrace,ack,samplessize,slotname,accel);
#endif
for(unsigned int i = 0; i<samplessize ; i++)
{
#ifndef _WINDOWS
// TODO: Windows build support
// r_msg is defined as part of *RPC_CALL definition
const xclPerfMonReadTrace_response::events &event = r_msg.output_data(i);
eventObj.timestamp = event.timestamp();
eventObj.eventflags = event.eventflags();
eventObj.arlen = event.arlen();
eventObj.awlen = event.awlen();
eventObj.host_timestamp = event.host_timestamp();
eventObj.readBytes = event.rd_bytes();
eventObj.writeBytes = event.wr_bytes();
list_of_events[counter].push_back(eventObj);
#endif
}
} while (samplessize != 0);
}
}
xclGetDebugMessages(true);
mPrintMessagesLock.lock();
fetchAndPrintMessages();
simulator_started = false;
mPrintMessagesLock.unlock();
std::string socketName = sock->get_name();
if(socketName.empty() == false)// device is active if socketName is non-empty
{
#ifndef _WINDOWS
xclClose_RPC_CALL(xclClose,this);
#endif
closemMessengerThread();
//clean up directories which are created inside the driver
systemUtil::makeSystemCall(socketName, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
}
if(saveWdb)
{
int status = 0;
xclemulation::debug_mode lWaveform = xclemulation::config::getInstance()->getLaunchWaveform();
if(( lWaveform == xclemulation::debug_mode::gui || lWaveform == xclemulation::debug_mode::batch || lWaveform == xclemulation::debug_mode::off )
&& xclemulation::config::getInstance()->isInfoSuppressed() == false)
{
std::string waitingMsg ="INFO: [HW-EMU 06-0] Waiting for the simulator process to exit";
logMessage(waitingMsg);
}
bool simDontRun = xclemulation::config::getInstance()->isDontRun();
if(!simDontRun)
while (-1 == waitpid(0, &status, 0));
if(( lWaveform == xclemulation::debug_mode::gui || lWaveform == xclemulation::debug_mode::batch || lWaveform == xclemulation::debug_mode::off )
&& xclemulation::config::getInstance()->isInfoSuppressed() == false)
{
std::string waitingMsg ="INFO: [HW-EMU 06-1] All the simulator processes exited successfully";
logMessage(waitingMsg);
}
saveWaveDataBase();
}
//ProfilerStop();
delete sock;
sock = NULL;
PRINTENDFUNC;
if(mMBSch && mCore)
{
mMBSch->fini_scheduler_thread();
delete mCore;
mCore = NULL;
delete mMBSch;
mMBSch = NULL;
}
if(m_scheduler)
{
delete m_scheduler;
m_scheduler = nullptr;
}
return 0;
}
HwEmShim *HwEmShim::handleCheck(void *handle) {
if (!handle)
return 0;
return (HwEmShim *)handle;
}
HwEmShim::~HwEmShim() {
free(ci_buf);
free(ri_buf);
free(buf);
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
mLogStream.close();
}
if (xclemulation::config::getInstance()->isMemLogsEnabled())
{
mGlobalInMemStream.close();
mGlobalOutMemStream.close();
}
for(auto controlStreamItr : mOffsetInstanceStreamMap)
{
std::ofstream* os = controlStreamItr.second;
if(os)
{
os->close();
delete os;
os=NULL;
}
}
if(mMBSch && mCore)
{
mMBSch->fini_scheduler_thread();
delete mCore;
mCore = NULL;
delete mMBSch;
mMBSch = NULL;
}
if(m_scheduler)
{
delete m_scheduler;
m_scheduler = nullptr;
}
if(mDataSpace)
{
delete mDataSpace;
mDataSpace = NULL;
}
closemMessengerThread();
}
void HwEmShim::initMemoryManager(std::list<xclemulation::DDRBank>& DDRBankList)
{
std::list<xclemulation::DDRBank>::iterator start = DDRBankList.begin();
std::list<xclemulation::DDRBank>::iterator end = DDRBankList.end();
uint64_t base = 0;
for(;start != end; start++)
{
const uint64_t bankSize = (*start).ddrSize;
mDdrBanks.push_back(*start);
mDDRMemoryManager.push_back(new xclemulation::MemoryManager(bankSize, base , getpagesize()));
base += bankSize;
}
}
std::string HwEmShim::getSimulatorType(const std::string& binaryDirectory) {
std::string simulator;
std::string sim_path1 = binaryDirectory + "/behav_waveform/xsim";
std::string sim_path2 = binaryDirectory + "/behav_gdb/xsim";
std::string sim_path3 = binaryDirectory + "/behav_waveform/questa";
std::string sim_path4 = binaryDirectory + "/behav_waveform/xcelium";
std::string sim_path5 = binaryDirectory + "/behav_waveform/vcs";
if (boost::filesystem::exists(sim_path1) || boost::filesystem::exists(sim_path2)) {
simulator = "xsim";
}
else if (boost::filesystem::exists(sim_path3)) {
simulator = "questa";
}
else if (boost::filesystem::exists(sim_path4)) {
simulator = "xcelium";
}
else if (boost::filesystem::exists(sim_path5)) {
simulator = "vcs";
}
if (!boost::filesystem::exists(sim_path1) && !boost::filesystem::exists(sim_path2)
&& !boost::filesystem::exists(sim_path3) && !boost::filesystem::exists(sim_path4)
&& !boost::filesystem::exists(sim_path5)) {
std::string dMsg = "ERROR: [HW-EMU 11] UNZIP operation failed. Not to able to get the required simulation binaries from xclbin";
logMessage(dMsg, 0);
}
return simulator;
}
void HwEmShim::fillDeviceInfo(xclDeviceInfo2* dest, xclDeviceInfo2* src)
{
std::strcpy(dest->mName, src->mName);
dest->mMagic = src->mMagic ;
dest->mHALMajorVersion = src->mHALMajorVersion;
dest->mHALMinorVersion = src->mHALMinorVersion;
dest->mVendorId = src->mVendorId;
dest->mDeviceId = src->mDeviceId;
dest->mSubsystemVendorId = src->mSubsystemVendorId;
dest->mDeviceVersion = src->mDeviceVersion;
dest->mDDRSize = src->mDDRSize;
dest->mDataAlignment = src->mDataAlignment;
dest->mDDRBankCount = src->mDDRBankCount;
uint32_t numCdma = 0;
if(isCdmaEnabled())
{
for(unsigned int i =0 ; i < 4; i++)
{
if ( getCdmaBaseAddress(i) != 0)
{
numCdma++;
}
}
}
dest->mNumCDMA = numCdma;
for(unsigned int i = 0; i < 4 ;i++)
dest->mOCLFrequency[i] = src->mOCLFrequency[i];
}
HwEmShim::HwEmShim(unsigned int deviceIndex, xclDeviceInfo2 &info, std::list<xclemulation::DDRBank>& DDRBankList, bool _unified, bool _xpr,
FeatureRomHeader &fRomHeader, const boost::property_tree::ptree& platformData)
:mRAMSize(info.mDDRSize)
,mCoalesceThreshold(4)
,mDSAMajorVersion(DSA_MAJOR_VERSION)
,mDSAMinorVersion(DSA_MINOR_VERSION)
,mDeviceIndex(deviceIndex)
,mCuIndx(0)
{
simulator_started = false;
tracecount_calls = 0;
mReqCounter = 0;
simulatorType = "xsim";
sim_path = "";
ci_msg.set_size(0);
ci_msg.set_xcl_api(0);
#if GOOGLE_PROTOBUF_VERSION < 3006001
ci_buf = malloc(ci_msg.ByteSize());
#else
ci_buf = malloc(ci_msg.ByteSizeLong());
#endif
ri_msg.set_size(0);
#if GOOGLE_PROTOBUF_VERSION < 3006001
ri_buf = malloc(ri_msg.ByteSize());
#else
ri_buf = malloc(ri_msg.ByteSizeLong());
#endif
buf = nullptr;
buf_size = 0;
binaryCounter = 0;
sock = nullptr;
deviceName = "device"+std::to_string(deviceIndex);
deviceDirectory = xclemulation::getRunDirectory() +"/" + std::to_string(getpid())+"/hw_em/"+deviceName;
systemUtil::makeSystemCall(deviceDirectory, systemUtil::systemOperation::CREATE, "", boost::lexical_cast<std::string>(__LINE__));
systemUtil::makeSystemCall(deviceDirectory, systemUtil::systemOperation::PERMISSIONS, "777", boost::lexical_cast<std::string>(__LINE__));
mPlatformData = platformData;
constructQueryTable();
std::memset(&mDeviceInfo, 0, sizeof(xclDeviceInfo2));
fillDeviceInfo(&mDeviceInfo,&info);
initMemoryManager(DDRBankList);
std::memset(&mFeatureRom, 0, sizeof(FeatureRomHeader));
std::memcpy(&mFeatureRom, &fRomHeader, sizeof(FeatureRomHeader));
last_clk_time = clock();
mCloseAll = false;
mMemModel = nullptr;
// Delete detailed kernel trace data mining results file
// NOTE: do this only if we're going to write a new one
xclemulation::debug_mode lWaveform = xclemulation::config::getInstance()->getLaunchWaveform();
if (lWaveform == xclemulation::debug_mode::gui
|| lWaveform == xclemulation::debug_mode::batch
|| lWaveform == xclemulation::debug_mode::off) {
char path[FILENAME_MAX];
size_t size = MAXPATHLEN;
char* pPath = GetCurrentDir(path,size);
if(pPath)
{
std::string sdxProfileKernelFile = std::string(path) + "/profile_kernels.csv";
systemUtil::makeSystemCall(sdxProfileKernelFile, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
std::string sdxTraceKernelFile = std::string(path) + "/timeline_kernels.csv";
systemUtil::makeSystemCall(sdxTraceKernelFile, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
}
}
bUnified = _unified;
bXPR = _xpr;
mCore = nullptr;
mMBSch = nullptr;
m_scheduler = nullptr;
mIsDebugIpLayoutRead = false;
mIsDeviceProfiling = false;
mMemoryProfilingNumberSlots = 0;
mAccelProfilingNumberSlots = 0;
mStallProfilingNumberSlots = 0;
mStreamProfilingNumberSlots = 0;
mPerfMonFifoCtrlBaseAddress = 0;
mPerfMonFifoReadBaseAddress = 0;
mTraceFunnelAddress = 0;
mDataSpace = new xclemulation::MemoryManager(0x10000000, 0, getpagesize());
mCuBaseAddress = 0x0;
mMessengerThreadStarted = false;
mIsTraceHubAvailable = false;
mVersalPlatform=false;
mHostMemAccessThreadStarted = false;
}
bool HwEmShim::isMBSchedulerEnabled()
{
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.ert").is_initialized()) {
std::string ertStr = mPlatformData.get<std::string>("plp.ert");
return (ertStr == "enabled" ? true : false);
}
}
bool mbSchEnabled = mFeatureRom.FeatureBitMap & FeatureBitMask::MB_SCHEDULER;
bool QDMAPlatform = (getDsaVersion() == 60) ? true : false;
return mbSchEnabled && !QDMAPlatform;
}
void HwEmShim::constructQueryTable() {
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.m2m").is_initialized()) {
mQueryTable[key_type::m2m] = mPlatformData.get<std::string>("plp.m2m");
}
if (mPlatformData.get_optional<std::string>("plp.dma").is_initialized()) {
std::string dmaVal = mPlatformData.get<std::string>("plp.dma");
mQueryTable[key_type::nodma] = (dmaVal == "none" ? "enabled" : "disabled");
}
}
}
// New API's for device query - m2m and no-dma
int HwEmShim::deviceQuery(key_type queryKey) {
if (mQueryTable.find(queryKey) != mQueryTable.end())
return (mQueryTable[queryKey] == "enabled" ? 1 : 0);
return 0;
}
std::string HwEmShim::getERTVersion() {
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.ertVersion").is_initialized()) {
return (mPlatformData.get<std::string>("plp.ertVersion"));
}
}
return "10";
}
uint64_t HwEmShim::getM2MAddress() {
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.m2m_address").is_initialized()) {
std::stringstream streamSS;
streamSS << std::hex << mPlatformData.get<std::string>("plp.m2m_address");
uint64_t baseAddr_u;
streamSS >> baseAddr_u;
return baseAddr_u;
}
}
return 0;
}
uint64_t HwEmShim::getErtCmdQAddress() {
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.ertCmdqBaseAddr").is_initialized()) {
std::stringstream streamSS ;
streamSS << std::hex << mPlatformData.get<std::string>("plp.ertCmdqBaseAddr");
uint64_t baseAddr_u;
streamSS >> baseAddr_u;
return baseAddr_u;
}
}
return 0;
}
uint64_t HwEmShim::getErtBaseAddress() {
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.ertBaseAddr").is_initialized()) {
std::stringstream streamSS ;
streamSS << std::hex << mPlatformData.get<std::string>("plp.ertBaseAddr");
uint64_t baseAddr_u;
streamSS >> baseAddr_u;
return baseAddr_u;
}
}
return 0;
}
bool HwEmShim::isLegacyErt()
{
if(xclemulation::config::getInstance()->getLegacyErt() == xclemulation::ertmode::legacy)
return true;
else if(xclemulation::config::getInstance()->getLegacyErt() == xclemulation::ertmode::updated)
return false;
//Following platforms uses legacyErt As per Emulation team.
//There is no other way to get whether platform uses legacy ERT or not
std::string vbnv = mDeviceInfo.mName;
if(!vbnv.empty() &&
( vbnv.find("u200_xdma-gen3x4_201830") != std::string::npos
|| vbnv.find("u200_xdma_201830") != std::string::npos
|| vbnv.find("u250_qep_201910") != std::string::npos
|| vbnv.find("u250_xdma_201830") != std::string::npos
|| vbnv.find("u280_xdma_201920") != std::string::npos
|| vbnv.find("u50_xdma_201910") != std::string::npos
|| vbnv.find("u50_xdma_201920") != std::string::npos))
return true;
return false;
}
bool HwEmShim::isCdmaEnabled()
{
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
if (mPlatformData.get_optional<std::string>("plp.numCdma").is_initialized()) {
int numCdma = boost::lexical_cast<int>(mPlatformData.get<std::string>("plp.numCdma"));
return (numCdma > 0 ? true : false);
}
}
return mFeatureRom.FeatureBitMap & FeatureBitMask::CDMA;
}
uint64_t HwEmShim::getCdmaBaseAddress(unsigned int index)
{
if (xclemulation::config::getInstance()->getIsPlatformEnabled()) {
std::string cdmaAddrStr = "plp.cdmaBaseAddress" + std::to_string(index);
if (mPlatformData.get_optional<std::string>(cdmaAddrStr).is_initialized()) {
std::stringstream streamSS ;
streamSS << std::hex << mPlatformData.get<std::string>(cdmaAddrStr);
uint64_t baseAddr_u;
streamSS >> baseAddr_u;
return baseAddr_u;
}
}
return mFeatureRom.CDMABaseAddress[index];
}
//following code is copied from core/pcie/driver/linux/xocl/subdev/feature_rom.c
unsigned int HwEmShim::getDsaVersion()
{
std::string vbnv = mDeviceInfo.mName;
if(vbnv.empty())
return 52;
if (vbnv.find("5_0") != std::string::npos)
return 50;
else if (vbnv.find("qdma") != std::string::npos)
return 60;
else if ( (vbnv.find("5_1") != std::string::npos)
|| (vbnv.find("u200_xdma_201820_1") != std::string::npos))
return 51;
else if ((vbnv.find("5_2") != std::string::npos)
|| (vbnv.find("u200_xdma_201820_2") != std::string::npos )
|| (vbnv.find("u250_xdma_201820_1") != std::string::npos )
|| (vbnv.find("201830") != std::string::npos))
return 52;
else if (vbnv.find("5_3") != std::string::npos)
return 53;
else if (vbnv.find("6_0") != std::string::npos)
return 60;
return 52;
}
size_t HwEmShim::xclGetDeviceTimestamp()
{
bool ack = true;
size_t deviceTimeStamp = 0;
xclGetDeviceTimestamp_RPC_CALL(xclGetDeviceTimestamp,ack,deviceTimeStamp);
return deviceTimeStamp;
}
void HwEmShim::xclReadBusStatus(xclPerfMonType type) {
bool is_bus_idle = true;
uint64_t l_idle_bus_cycles = 0;
uint64_t idle_bus_cycles = 0;
time_t currentTime;
struct tm *localTime;
time( ¤tTime );
localTime = localtime( ¤tTime );
std::string time_s = "[Time: " + std::to_string(localTime->tm_hour) + ":" + std::to_string(localTime->tm_min) + "]";
for(uint32_t slot_n = 0; slot_n < getPerfMonNumberSlots(type)-1; slot_n++) {
xclReadBusStatus_RPC_CALL(xclReadBusStatus,idle_bus_cycles,slot_n);
is_bus_idle = is_bus_idle & (idle_bus_cycles > 0);
if(idle_bus_cycles > 0) {
l_idle_bus_cycles = idle_bus_cycles;
}
}
if(is_bus_idle) {
std::cout << "INFO " << time_s <<" There is no traffic between DDR Memory and Kernel for last " << l_idle_bus_cycles << " clock cycles" << std::endl;
} else {
if ((clock() - last_clk_time)/CLOCKS_PER_SEC > 60*5) {
last_clk_time = clock();
std::cout << "INFO " << time_s<<" Hardware Emulation is in progress..." << std::endl;
}
}
}
void HwEmShim::xclGetDebugMessages(bool force)
{
if(xclemulation::config::getInstance()->isSystemDPAEnabled() == true) {
return;
}
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
bool ack = true;
std::string displayMsgs;
std::string logMsgs;
std::string stopMsgs;
xclGetDebugMessages_RPC_CALL(xclGetDebugMessages,ack,force,displayMsgs,logMsgs,stopMsgs);
if(mDebugLogStream.is_open() && logMsgs.empty() == false)
{
mDebugLogStream <<logMsgs;
mDebugLogStream.flush();
}
if(displayMsgs.empty() == false)
{
std::cout<<displayMsgs;
std::cout.flush();
}
PRINTENDFUNC;
}
size_t HwEmShim::xclReadSkipCopy(uint64_t offset, void *hostBuf, size_t size)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", "
<< offset << ", " << hostBuf << ", " << size << std::endl;
}
const size_t mod_size = offset % DDR_BUFFER_ALIGNMENT;
// Need to do Read-Modify-Read
#ifndef _WINDOWS
// TODO: Windows build support
// alignas is defined in c++11
alignas(DDR_BUFFER_ALIGNMENT) char buffer[DDR_BUFFER_ALIGNMENT];
#else
char buffer[DDR_BUFFER_ALIGNMENT];
#endif
// Read back one full aligned block starting from preceding aligned address
const uint64_t mod_offset = offset - mod_size;
if (xclRead(XCL_ADDR_SPACE_DEVICE_RAM, mod_offset, buffer, DDR_BUFFER_ALIGNMENT) != DDR_BUFFER_ALIGNMENT)
{
PRINTENDFUNC;
return -1;
}
const size_t copy_size = (size + mod_size > DDR_BUFFER_ALIGNMENT) ? DDR_BUFFER_ALIGNMENT - mod_size : size;
// Update the user buffer with partial read
std::memcpy(hostBuf, buffer + mod_size, copy_size);
// Update the remainder of user buffer
if (size + mod_size > DDR_BUFFER_ALIGNMENT) {
const size_t read_size = xclRead(XCL_ADDR_SPACE_DEVICE_RAM, mod_offset + DDR_BUFFER_ALIGNMENT,
(char *)hostBuf + copy_size, size - copy_size);
if (read_size != (size - copy_size))
{
PRINTENDFUNC;
return -1;
}
}
PRINTENDFUNC;
return size;
}
size_t HwEmShim::xclReadModifyWrite(uint64_t offset, const void *hostBuf, size_t size)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", "
<< offset << ", " << hostBuf << ", " << size << std::endl;
}
#ifndef _WINDOWS
// TODO: Windows build support
// alignas is defined in c++11
alignas(DDR_BUFFER_ALIGNMENT) char buffer[DDR_BUFFER_ALIGNMENT];
#else
char buffer[DDR_BUFFER_ALIGNMENT];
#endif
const size_t mod_size = offset % DDR_BUFFER_ALIGNMENT;
// Read back one full aligned block starting from preceding aligned address
const uint64_t mod_offset = offset - mod_size;
if (xclRead(XCL_ADDR_SPACE_DEVICE_RAM, mod_offset, buffer, DDR_BUFFER_ALIGNMENT) != DDR_BUFFER_ALIGNMENT)
{
PRINTENDFUNC;
return -1;
}
// Update the local copy of buffer with user requested data
const size_t copy_size = (size + mod_size > DDR_BUFFER_ALIGNMENT) ? DDR_BUFFER_ALIGNMENT - mod_size : size;
std::memcpy(buffer + mod_size, hostBuf, copy_size);
// Write back the updated aligned block
if (xclWrite(XCL_ADDR_SPACE_DEVICE_RAM, mod_offset, buffer, DDR_BUFFER_ALIGNMENT) != DDR_BUFFER_ALIGNMENT)
{
PRINTENDFUNC;
return -1;
}
// Write any remaining blocks over DDR_BUFFER_ALIGNMENT size
if (size + mod_size > DDR_BUFFER_ALIGNMENT) {
size_t write_size = xclWrite(XCL_ADDR_SPACE_DEVICE_RAM, mod_offset + DDR_BUFFER_ALIGNMENT,
(const char *)hostBuf + copy_size, size - copy_size);
if (write_size != (size - copy_size))
{
PRINTENDFUNC;
return -1;
}
}
PRINTENDFUNC;
return size;
}
int HwEmShim::xclGetDeviceInfo2(xclDeviceInfo2 *info)
{
std::memset(info, 0, sizeof(xclDeviceInfo2));
fillDeviceInfo(info,&mDeviceInfo);
for (auto i : mDDRMemoryManager) {
info->mDDRFreeSize += i->freeSize();
}
return 0;
}
//TODO::SPECIFIC TO LINUX
//Need to modify for windows
void HwEmShim::xclOpen(const char* logfileName)
{
//populate environment information in driver
xclemulation::config::getInstance()->populateEnvironmentSetup(mEnvironmentNameValueMap);
char path[FILENAME_MAX];
size_t size = MAXPATHLEN;
char* pPath = GetCurrentDir(path,size);
if(pPath)
{
std::string sdxProfileKernelFile = std::string(path) + "/profile_kernels.csv";
systemUtil::makeSystemCall(sdxProfileKernelFile, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
std::string sdxTraceKernelFile = std::string(path) + "/timeline_kernels.csv";
systemUtil::makeSystemCall(sdxTraceKernelFile, systemUtil::systemOperation::REMOVE, "", boost::lexical_cast<std::string>(__LINE__));
}
std::string lf = "";
if (getenv("ENABLE_HAL_HW_EMU_DEBUG")) {
lf = std::string(pPath) + "/hal_log.txt";
}
else {
lf = "";
}
//if ( logfileName && (logfileName[0] != '\0'))
if (!lf.empty())
{
mLogStream.open(lf);
mLogStream << "FUNCTION, THREAD ID, ARG..." << std::endl;
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
if (xclemulation::config::getInstance()->isMemLogsEnabled())
{
mGlobalInMemStream.open("global_in.mem");
mGlobalOutMemStream.open("global_out.mem");
}
// Shim object creation doesn't follow xclOpen/xclClose.
// The core device must correspond to open and close, so
// create here rather than in constructor
mCoreDevice = xrt_core::hwemu::get_userpf_device(this, mDeviceIndex);
device_handles::add(this);
}
/**********************************************HAL2 API's START HERE **********************************************/
/*********************************** Utility ******************************************/
static bool check_bo_user_flags(HwEmShim* dev, unsigned flags)
{
const unsigned ddr_count = dev->xocl_ddr_channel_count();
unsigned ddr;
if(ddr_count == 0)
return false;
if (flags == XOCL_MEM_BANK_MSK)
return true;
ddr = xclemulation::xocl_bo_ddr_idx(flags,false);
if (ddr > ddr_count)
return false;
return true;
}
xclemulation::drm_xocl_bo* HwEmShim::xclGetBoByHandle(unsigned int boHandle)
{
auto it = mXoclObjMap.find(boHandle);
if(it == mXoclObjMap.end())
return nullptr;
xclemulation::drm_xocl_bo* bo = (*it).second;
return bo;
}
inline unsigned short HwEmShim::xocl_ddr_channel_count()
{
if(mMembanks.size() > 0)
return mMembanks.size();
return mDeviceInfo.mDDRBankCount;
}
inline unsigned long long HwEmShim::xocl_ddr_channel_size()
{
return 0;
}
int HwEmShim::xclGetBOProperties(unsigned int boHandle, xclBOProperties *properties)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if (!bo) {
PRINTENDFUNC;
return -1;
}
properties->handle = bo->handle;
properties->flags = bo->flags;
properties->size = bo->size;
properties->paddr = bo->base;
PRINTENDFUNC;
return 0;
}
/*****************************************************************************************/
/******************************** xclAllocBO *********************************************/
uint64_t HwEmShim::xoclCreateBo(xclemulation::xocl_create_bo* info)
{
size_t size = info->size;
unsigned ddr = xclemulation::xocl_bo_ddr_idx(info->flags,false);
if (!size)
{
return -1;
}
/* Either none or only one DDR should be specified */
if (!check_bo_user_flags(this, info->flags))
{
return -1;
}
auto xobj = std::make_unique<xclemulation::drm_xocl_bo>();
xobj->flags=info->flags;
/* check whether buffer is p2p or not*/
bool noHostMemory = xclemulation::no_host_memory(xobj.get());
std::string sFileName("");
if(xobj->flags & XCL_BO_FLAGS_EXECBUF)
{
uint64_t result = mDataSpace->alloc(size,1);
xobj->base = result;
}
else
{
xobj->base = xclAllocDeviceBuffer2(size, XCL_MEM_DEVICE_RAM, ddr, noHostMemory, info->flags, sFileName, xobj->chunks);
}
xobj->filename = sFileName;
xobj->size = size;
xobj->userptr = NULL;
xobj->buf = NULL;
xobj->topology=ddr;
xobj->fd = -1;
if(xobj->base == xclemulation::MemoryManager::mNull)
{
return xclemulation::MemoryManager::mNull;
}
info->handle = mBufferCount;
mXoclObjMap[mBufferCount++] = xobj.release();
return 0;
}
unsigned int HwEmShim::xclAllocBO(size_t size, int unused, unsigned flags)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << size << std::dec << " , "<< unused <<" , "<< flags << std::endl;
}
xclemulation::xocl_create_bo info = {size, mNullBO, flags};
uint64_t result = xoclCreateBo(&info);
PRINTENDFUNC;
return result ? mNullBO : info.handle;
}
/***************************************************************************************/
/******************************** xclAllocUserPtrBO ************************************/
unsigned int HwEmShim::xclAllocUserPtrBO(void *userptr, size_t size, unsigned flags)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << userptr <<", " << std::hex << size << std::dec <<" , "<< flags << std::endl;
}
xclemulation::xocl_create_bo info = {size, mNullBO, flags};
uint64_t result = xoclCreateBo(&info);
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(info.handle);
if (bo) {
bo->userptr = userptr;
}
PRINTENDFUNC;
return result ? mNullBO : info.handle;
}
/***************************************************************************************/
/******************************** xclExportBO *******************************************/
int HwEmShim::xclExportBO(unsigned int boHandle)
{
//TODO
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if(!bo)
return -1;
std::string sFileName = bo->filename;
if(sFileName.empty())
{
std::cout<<"Exported Buffer is not P2P "<<std::endl;
PRINTENDFUNC;
return -1;
}
uint64_t size = bo->size;
int fd = open(sFileName.c_str(), (O_CREAT | O_RDWR), 0666);
if (fd == -1)
{
printf("Error opening exported BO file.\n");
PRINTENDFUNC;
return -1;
};
char* data = (char*) mmap(0, bo->size , PROT_READ |PROT_WRITE |PROT_EXEC , MAP_SHARED, fd, 0);
if(!data)
{
PRINTENDFUNC;
return -1;
}
int rf = ftruncate(fd, bo->size);
if(rf == -1 )
{
close(fd);
munmap(data,size);
return -1;
}
mFdToFileNameMap [fd] = std::make_tuple(sFileName,size,(void*)data,bo->flags);
PRINTENDFUNC;
return fd;
}
/***************************************************************************************/
/******************************** xclImportBO *******************************************/
unsigned int HwEmShim::xclImportBO(int boGlobalHandle, unsigned flags)
{
//TODO
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boGlobalHandle << std::endl;
}
auto itr = mFdToFileNameMap.find(boGlobalHandle);
if(itr != mFdToFileNameMap.end())
{
const std::string& fileName = std::get<0>((*itr).second);
int size = std::get<1>((*itr).second);
unsigned boFlags = std::get<3>((*itr).second);
unsigned int importedBo = xclAllocBO(size, 0, boFlags);
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(importedBo);
if(!bo)
{
std::cout<<"ERROR HERE in importBO "<<std::endl;
return -1;
}
mImportedBOs.insert(importedBo);
bo->fd = boGlobalHandle;
bool ack;
xclImportBO_RPC_CALL(xclImportBO,fileName,bo->base,size);
PRINTENDFUNC;
if(!ack)
return -1;
return importedBo;
}
PRINTENDFUNC;
return -1;
}
/***************************************************************************************/
/******************************** xclCopyBO *******************************************/
int HwEmShim::xclCopyBO(unsigned int dst_boHandle, unsigned int src_boHandle, size_t size, size_t dst_offset, size_t src_offset)
{
std::lock_guard<std::mutex> lk(mApiMtx);
//TODO
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << dst_boHandle
<< ", "<< src_boHandle << ", "<< size << ", " << dst_offset << ", " << src_offset<< std::endl;
}
xclemulation::drm_xocl_bo* sBO = xclGetBoByHandle(src_boHandle);
if(!sBO)
{
PRINTENDFUNC;
return -1;
}
xclemulation::drm_xocl_bo* dBO = xclGetBoByHandle(dst_boHandle);
if(!dBO)
{
PRINTENDFUNC;
return -1;
}
// Disabling the m2m for timebeing as it is not working as expected. So still data is getting transferred thru DMA.
// Will enable this logic unless we have a clarity from the m2m hw_emu kernel. Please do not remove this code
/*if ( deviceQuery(key_type::m2m) && getM2MAddress() != 0 ) {
char hostBuf[M2M_KERNEL_ARGS_SIZE];
std::memset(hostBuf, 0, M2M_KERNEL_ARGS_SIZE);
//src and dest addresses construction
uint64_t src_addr = sBO->base + src_offset;
uint64_t dest_addr = dBO->base + dst_offset;
//fill the hostbuf with the src offset and dest offset and size offset
std::memcpy(hostBuf+0x10, (unsigned char*)&src_addr, 8); //copying the src address to the hostbuf to the specified offset by M2M IP
std::memcpy(hostBuf+0x18, (unsigned char*)&dest_addr, 8); //copying the dest address to the hostbuf to the specified offset by M2M IP
std::memcpy(hostBuf+0x20, (unsigned char*)&size, 4); //copying the size address to the hostbuf to the specified offset by M2M IP
//Configuring the kernel with hostbuf by providing the Base address of the IP
if (xclWrite(XCL_ADDR_KERNEL_CTRL, getErtBaseAddress()+0x20000, hostBuf, M2M_KERNEL_ARGS_SIZE) != M2M_KERNEL_ARGS_SIZE) {
std::cerr << "ERROR: Failed to write to args to the m2m IP" << std::endl;
}
hostBuf[0] = 0x1; //filling the hostbuf with the start info
//Starting the kernel
if (xclWrite(XCL_ADDR_KERNEL_CTRL, getErtBaseAddress()+0x20000, hostBuf, 4) != 4) {
std::cerr << "ERROR: Failed to start the m2m kernel" << std::endl;
}
do {
//Read the status of the kernel by polling the hostBuf[0]
//check for the base_address is either 4 or 6
xclRead(XCL_ADDR_KERNEL_CTRL, getErtBaseAddress()+0x20000, hostBuf, 4);
} while (!(hostBuf[0] & (CONTROL_AP_DONE | CONTROL_AP_IDLE)) );
PRINTENDFUNC;
return 0;
}*/
// source buffer is host_only and destination buffer is device_only
if (xclemulation::xocl_bo_host_only(sBO) && !xclemulation::xocl_bo_p2p(sBO) && xclemulation::xocl_bo_dev_only(dBO)) {
unsigned char* host_only_buffer = (unsigned char*)(sBO->buf) + src_offset;
if (xclCopyBufferHost2Device(dBO->base, (void*)host_only_buffer, size, dst_offset, dBO->topology) != size) {
return -1;
}
} // source buffer is device_only and destination buffer is host_only
else if (xclemulation::xocl_bo_host_only(dBO) && !xclemulation::xocl_bo_p2p(dBO) && xclemulation::xocl_bo_dev_only(sBO)) {
unsigned char* host_only_buffer = (unsigned char*)(dBO->buf) + dst_offset;
if (xclCopyBufferDevice2Host((void*)host_only_buffer, sBO->base, size, src_offset, sBO->topology) != size) {
return -1;
}
}// source and destination buffers are device_only
else if (!xclemulation::xocl_bo_host_only(sBO) && !xclemulation::xocl_bo_host_only(dBO) && (dBO->fd < 0) && (sBO->fd < 0)) {
unsigned char temp_buffer[size];
// copy data from source buffer to temp buffer
if (xclCopyBufferDevice2Host((void*)temp_buffer, sBO->base, size, src_offset, sBO->topology) != size) {
std::cerr << "ERROR: copy buffer from device to host failed " << std::endl;
return -1;
}
// copy data from temp buffer to destination buffer
if (xclCopyBufferHost2Device(dBO->base, (void*)temp_buffer, size, dst_offset, dBO->topology) != size) {
std::cerr << "ERROR: copy buffer from host to device failed " << std::endl;
return -1;
}
}
else if(dBO->fd >= 0){ //destination p2p buffer
int ack = false;
auto fItr = mFdToFileNameMap.find(dBO->fd);
if (fItr != mFdToFileNameMap.end()) {
const std::string& sFileName = std::get<0>((*fItr).second);
xclCopyBO_RPC_CALL(xclCopyBO, sBO->base, sFileName, size, src_offset, dst_offset);
}
if (!ack)
return -1;
}
else{
std::cerr << "ERROR: Copy buffer from source to destination faliled" << std::endl;
return -1;
}
PRINTENDFUNC;
return 0;
}
/***************************************************************************************/
/******************************** xclMapBO *********************************************/
void *HwEmShim::xclMapBO(unsigned int boHandle, bool write)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << " , " << write << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if (!bo) {
PRINTENDFUNC;
return nullptr;
}
std::string sFileName = bo->filename;
if(!sFileName.empty() ) // In case of peer-to-peer
{
int fd = open(sFileName.c_str(), (O_CREAT | O_RDWR), 0666);
if (fd == -1)
{
printf("Error opening exported BO file.\n");
return nullptr;
};
char* data = (char*) mmap(0, bo->size , PROT_READ |PROT_WRITE |PROT_EXEC , MAP_SHARED, fd, 0);
if(!data)
return nullptr;
int rf = ftruncate(fd, bo->size);
if(rf == -1)
{
close(fd);
munmap(data,bo->size);
return nullptr;
}
mFdToFileNameMap [fd] = std::make_tuple(sFileName,bo->size,(void*)data, bo->flags);
bo->buf = data;
PRINTENDFUNC;
return data;
}
void *pBuf=nullptr;
if (posix_memalign(&pBuf, getpagesize(), bo->size))
{
if (mLogStream.is_open()) mLogStream << "posix_memalign failed" << std::endl;
pBuf=nullptr;
return pBuf;
}
memset(pBuf, 0, bo->size);
bo->buf = pBuf;
//For Slave Bridge scenario, maintaining the map for base vs pBuf pointer
if (xclemulation::xocl_bo_host_only(bo)) {
mHostOnlyMemMap[bo->base] = std::make_pair(pBuf, bo->size);
}
PRINTENDFUNC;
return pBuf;
}
int HwEmShim::xclUnmapBO(unsigned int boHandle, void* addr)
{
std::lock_guard<std::mutex> lk(mApiMtx);
auto bo = xclGetBoByHandle(boHandle);
return bo ? munmap(addr, bo->size) : -1;
}
/**************************************************************************************/
/******************************** xclSyncBO *******************************************/
int HwEmShim::xclSyncBO(unsigned int boHandle, xclBOSyncDirection dir, size_t size, size_t offset)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << " , " << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if(!bo)
{
PRINTENDFUNC;
return -1;
}
int returnVal = 0;
if (!xclemulation::xocl_bo_host_only(bo)) { // bypassed the xclCopyBufferDevice2Host/Host2Device RPC calls for Slave Bridge (host only buffer scenario)
void* buffer = bo->userptr ? bo->userptr : bo->buf;
if (dir == XCL_BO_SYNC_BO_TO_DEVICE)
{
if (xclCopyBufferHost2Device(bo->base, buffer, size, offset, bo->topology) != size)
{
returnVal = EIO;
}
}
else
{
if (xclCopyBufferDevice2Host(buffer, bo->base, size, offset, bo->topology) != size)
{
returnVal = EIO;
}
}
}
PRINTENDFUNC;
return returnVal;
}
/***************************************************************************************/
/******************************** xclFreeBO *******************************************/
void HwEmShim::xclFreeBO(unsigned int boHandle)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << std::endl;
}
auto it = mXoclObjMap.find(boHandle);
if(it == mXoclObjMap.end())
{
PRINTENDFUNC;
return;
}
xclemulation::drm_xocl_bo* bo = (*it).second;;
if(bo)
{
bool bSendToSim = true;
if(bo->flags & XCL_BO_FLAGS_EXECBUF)
bSendToSim = false;
if(bo->chunks.size())
{
for(auto it: bo->chunks)
xclFreeDeviceBuffer(it.first,bSendToSim);
}
else
{
xclFreeDeviceBuffer(bo->base, bSendToSim);
}
mXoclObjMap.erase(it);
}
PRINTENDFUNC;
}
/***************************************************************************************/
/******************************** xclWriteBO *******************************************/
size_t HwEmShim::xclWriteBO(unsigned int boHandle, const void *src, size_t size, size_t seek)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << " , "<< src <<" , "<< size << ", " << seek << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if(!bo)
{
PRINTENDFUNC;
return -1;
}
size_t returnVal = 0;
if (xclCopyBufferHost2Device(bo->base, src, size, seek, bo->topology) != size)
{
returnVal = EIO;
}
PRINTENDFUNC;
return returnVal;
}
/***************************************************************************************/
/******************************** xclReadBO *******************************************/
size_t HwEmShim::xclReadBO(unsigned int boHandle, void *dst, size_t size, size_t skip)
{
std::lock_guard<std::mutex> lk(mApiMtx);
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << std::hex << boHandle << " , "<< dst <<" , "<< size << ", " << skip << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(boHandle);
if(!bo)
{
PRINTENDFUNC;
return -1;
}
size_t returnVal = 0;
if (xclCopyBufferDevice2Host(dst, bo->base, size, skip, bo->topology) != size)
{
returnVal = EIO;
}
PRINTENDFUNC;
return returnVal;
}
/***************************************************************************************/
int HwEmShim::xclExecBuf(unsigned int cmdBO)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << cmdBO << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(cmdBO);
int ret=-1;
if(xclemulation::config::getInstance()->isNewMbscheduler())
{
if(!m_scheduler || !bo)
{
PRINTENDFUNC;
return ret;
}
ret = m_scheduler->add_exec_buffer(bo);
PRINTENDFUNC;
return ret;
}
else {
if(!mMBSch || !bo)
{
PRINTENDFUNC;
return ret;
}
ret = mMBSch->add_exec_buffer(mCore, bo);
PRINTENDFUNC;
}
return ret;
}
/*
* xclExecBuf()
*/
int HwEmShim::xclExecBuf(unsigned int cmdBO, size_t num_bo_in_wait_list, unsigned int *bo_wait_list)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << cmdBO << ", " << num_bo_in_wait_list << ", " << bo_wait_list << std::endl;
}
xclemulation::drm_xocl_bo* bo = xclGetBoByHandle(cmdBO);
xcl_LogMsg(XRT_INFO, "", "%s, cmdBO: %d, num_bo_in_wait_list: %d, bo_wait_list: %d",
__func__, cmdBO, num_bo_in_wait_list, bo_wait_list);
if (num_bo_in_wait_list > MAX_DEPS) {
xcl_LogMsg(XRT_ERROR, "", "%s, Incorrect argument. Max num of BOs in wait_list: %d",
__func__, MAX_DEPS);
return -EINVAL;
}
/*int ret;
unsigned int bwl[8] = {0};
std::memcpy(bwl,bo_wait_list,num_bo_in_wait_list*sizeof(unsigned int));
drm_xocl_execbuf exec = {0, cmdBO, bwl[0],bwl[1],bwl[2],bwl[3],bwl[4],bwl[5],bwl[6],bwl[7]};
ret = mDev->ioctl(mUserHandle, DRM_IOCTL_XOCL_EXECBUF, &exec);
return ret ? -errno : ret;*/
int ret=-1;
if(xclemulation::config::getInstance()->isNewMbscheduler())
{
if(!m_scheduler || !bo)
{
PRINTENDFUNC;
return ret;
}
ret = m_scheduler->add_exec_buffer(bo);
PRINTENDFUNC;
} else {
ret = mMBSch->add_exec_buffer(mCore, bo);
PRINTENDFUNC;
}
return ret;
}
int HwEmShim::xclRegisterEventNotify(unsigned int userInterrupt, int fd)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << userInterrupt <<", "<< fd << std::endl;
}
PRINTENDFUNC;
return 0;
}
int HwEmShim::xclExecWait(int timeoutMilliSec)
{
if (mLogStream.is_open())
{
// mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << timeoutMilliSec << std::endl;
}
unsigned int tSec = 0;
static bool bConfig = true;
tSec = timeoutMilliSec/1000;
if(bConfig)
{
tSec = timeoutMilliSec/100;
bConfig = false;
}
sleep(tSec);
//PRINTENDFUNC;
return 1;
}
ssize_t HwEmShim::xclUnmgdPwrite(unsigned flags, const void *buf, size_t count, uint64_t offset)
{
if (flags)
return -EINVAL;
return xclCopyBufferHost2Device(offset, buf, count, 0 ,0);
}
ssize_t HwEmShim::xclUnmgdPread(unsigned flags, void *buf, size_t count, uint64_t offset)
{
if (flags)
return -EINVAL;
return xclCopyBufferDevice2Host(buf, offset, count, 0 , 0);
}
int HwEmShim::xclGetDebugIPlayoutPath(char* layoutPath, size_t size)
{
// get path of the debug_ip_layout (in binary format) created in the HW Emu run directory
if(mRunDeviceBinDir.empty())
return -1;
std::string debugIPlayoutPath = mRunDeviceBinDir + "/debug_ip_layout";
if(debugIPlayoutPath.size() >= size)
return -1;
strncpy(layoutPath, debugIPlayoutPath.c_str(), size);
return 0;
}
int HwEmShim::xclGetTraceBufferInfo(uint32_t nSamples, uint32_t& traceSamples, uint32_t& traceBufSz)
{
uint32_t bytesPerSample = (XPAR_AXI_PERF_MON_0_TRACE_WORD_WIDTH / 8);
traceBufSz = MAX_TRACE_NUMBER_SAMPLES * bytesPerSample; /* Buffer size in bytes */
traceSamples = nSamples;
return 0;
}
int HwEmShim::xclReadTraceData(void* traceBuf, uint32_t traceBufSz, uint32_t numSamples, uint64_t ipBaseAddress, uint32_t& wordsPerSample)
{
// Create trace buffer on host (requires alignment)
const int traceBufWordSz = traceBufSz / 4; // traceBufSz is in number of bytes
uint32_t size = 0;
wordsPerSample = (XPAR_AXI_PERF_MON_0_TRACE_WORD_WIDTH / 32);
uint32_t numWords = numSamples * wordsPerSample;
// alignas is defined in c++11
#ifndef _WINDOWS
/* Alignment is limited to 16 by PPC64LE : so , should it be
alignas(16) uint32_t hostbuf[traceBufSzInWords];
*/
alignas(AXI_FIFO_RDFD_AXI_FULL) uint32_t hostbuf[traceBufWordSz];
#else
xrt_core::AlignedAllocator<uint32_t> alignedBuffer(AXI_FIFO_RDFD_AXI_FULL, traceBufWordSz);
uint32_t* hostbuf = alignedBuffer.getBuffer();
#endif
// Now read trace data
memset((void *)hostbuf, 0, traceBufSz);
// Iterate over chunks
// NOTE: AXI limits this to 4K bytes per transfer
uint32_t chunkSizeWords = 256 * wordsPerSample;
if (chunkSizeWords > 1024) chunkSizeWords = 1024;
uint32_t chunkSizeBytes = 4 * chunkSizeWords;
uint32_t words=0;
// Read trace a chunk of bytes at a time
if (numWords > chunkSizeWords) {
for (; words < (numWords-chunkSizeWords); words += chunkSizeWords) {
if(mLogStream.is_open())
mLogStream << __func__ << ": reading " << chunkSizeBytes << " bytes from 0x"
<< std::hex << ipBaseAddress /*fifoReadAddress[0] or AXI_FIFO_RDFD*/ << " and writing it to 0x"
<< (void *)(hostbuf + words) << std::dec << std::endl;
xclUnmgdPread(0 /*flags*/, (void *)(hostbuf + words) /*buf*/, chunkSizeBytes /*count*/, ipBaseAddress /*offset : or AXI_FIFO_RDFD*/);
size += chunkSizeBytes;
}
}
// Read remainder of trace not divisible by chunk size
if (words < numWords) {
chunkSizeBytes = 4 * (numWords - words);
if(mLogStream.is_open()) {
mLogStream << __func__ << ": reading " << chunkSizeBytes << " bytes from 0x"
<< std::hex << ipBaseAddress /*fifoReadAddress[0]*/ << " and writing it to 0x"
<< (void *)(hostbuf + words) << std::dec << std::endl;
}
xclUnmgdPread(0 /*flags*/, (void *)(hostbuf + words) /*buf*/, chunkSizeBytes /*count*/, ipBaseAddress /*offset : or AXI_FIFO_RDFD*/);
size += chunkSizeBytes;
}
if(mLogStream.is_open())
mLogStream << __func__ << ": done reading " << size << " bytes " << std::endl;
memcpy((char*)traceBuf, (char*)hostbuf, traceBufSz);
return size;
}
double HwEmShim::xclGetDeviceClockFreqMHz()
{
//return 1.0;
double clockSpeed;
//300.0 MHz
clockSpeed = 300.0;
return clockSpeed;
}
// Get the maximum bandwidth for host reads from the device (in MB/sec)
// NOTE: for now, just return 8.0 GBps (the max achievable for PCIe Gen3)
double HwEmShim::xclGetReadMaxBandwidthMBps()
{
return 8000.0;
}
// Get the maximum bandwidth for host writes to the device (in MB/sec)
// NOTE: for now, just return 8.0 GBps (the max achievable for PCIe Gen3)
double HwEmShim::xclGetWriteMaxBandwidthMBps()
{
return 8000.0;
}
uint32_t HwEmShim::getPerfMonNumberSlots(xclPerfMonType type)
{
if (type == XCL_PERF_MON_MEMORY)
return mMemoryProfilingNumberSlots;
if (type == XCL_PERF_MON_ACCEL)
return mAccelProfilingNumberSlots;
if (type == XCL_PERF_MON_STALL)
return mStallProfilingNumberSlots;
if (type == XCL_PERF_MON_HOST)
return 1;
if (type == XCL_PERF_MON_STR)
return mStreamProfilingNumberSlots;
return 0;
}
// Get slot name
void HwEmShim::getPerfMonSlotName(xclPerfMonType type, uint32_t slotnum,
char* slotName, uint32_t length) {
std::string str = "";
if (type == XCL_PERF_MON_MEMORY) {
str = (slotnum < XAIM_MAX_NUMBER_SLOTS) ? mPerfMonSlotName[slotnum] : "";
}
if (type == XCL_PERF_MON_ACCEL) {
str = (slotnum < XAM_MAX_NUMBER_SLOTS) ? mAccelMonSlotName[slotnum] : "";
}
if (type == XCL_PERF_MON_STR) {
str = (slotnum < XASM_MAX_NUMBER_SLOTS) ? mStreamMonSlotName[slotnum] : "";
}
if(str.length() < length) {
strncpy(slotName, str.c_str(), length);
} else {
strncpy(slotName, str.c_str(), length-1);
slotName[length-1] = '\0';
}
}
/********************************************** QDMA APIs IMPLEMENTATION START **********************************************/
/*
* xclCreateWriteQueue()
*/
int HwEmShim::xclCreateWriteQueue(xclQueueContext *q_ctx, uint64_t *q_hdl)
{
if (mLogStream.is_open())
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
uint64_t q_handle = 0;
xclCreateQueue_RPC_CALL(xclCreateQueue,q_ctx,true);
if(q_handle <= 0)
{
if (mLogStream.is_open())
mLogStream << " unable to create write queue "<<std::endl;
PRINTENDFUNC;
return -1;
}
*q_hdl = q_handle;
PRINTENDFUNC;
return 0;
}
/*
* xclCreateReadQueue()
*/
int HwEmShim::xclCreateReadQueue(xclQueueContext *q_ctx, uint64_t *q_hdl)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
uint64_t q_handle = 0;
xclCreateQueue_RPC_CALL(xclCreateQueue,q_ctx,false);
if(q_handle <= 0)
{
if (mLogStream.is_open())
mLogStream << " unable to create read queue "<<std::endl;
PRINTENDFUNC;
return -1;
}
*q_hdl = q_handle;
PRINTENDFUNC;
return 0;
}
/*
* xclDestroyQueue()
*/
int HwEmShim::xclDestroyQueue(uint64_t q_hdl)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
uint64_t q_handle = q_hdl;
bool success = false;
xclDestroyQueue_RPC_CALL(xclDestroyQueue, q_handle);
if(!success)
{
if (mLogStream.is_open())
mLogStream <<" unable to destroy the queue"<<std::endl;
PRINTENDFUNC;
return -1;
}
PRINTENDFUNC;
return 0;
}
/*
* xclWriteQueue()
*/
ssize_t HwEmShim::xclWriteQueue(uint64_t q_hdl, xclQueueRequest *wr)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
bool eot = false;
if(wr->flag & XCL_QUEUE_REQ_EOT)
eot = true;
bool nonBlocking = false;
if (wr->flag & XCL_QUEUE_REQ_NONBLOCKING)
{
std::map<uint64_t,uint64_t> vaLenMap;
for (unsigned i = 0; i < wr->buf_num; i++)
{
//vaLenMap[wr->bufs[i].va] = wr->bufs[i].len;
vaLenMap[wr->bufs[i].va] = 0;//for write we should not read the data back
}
mReqList.push_back(std::make_tuple(mReqCounter, wr->priv_data, vaLenMap));
nonBlocking = true;
}
uint64_t fullSize = 0;
for (unsigned i = 0; i < wr->buf_num; i++)
{
xclWriteQueue_RPC_CALL(xclWriteQueue,q_hdl, wr->bufs[i].va, wr->bufs[i].len);
fullSize += written_size;
}
PRINTENDFUNC;
mReqCounter++;
return fullSize;
}
/*
* xclReadQueue()
*/
ssize_t HwEmShim::xclReadQueue(uint64_t q_hdl, xclQueueRequest *rd)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
bool eot = false;
if(rd->flag & XCL_QUEUE_REQ_EOT)
eot = true;
bool nonBlocking = false;
if (rd->flag & XCL_QUEUE_REQ_NONBLOCKING)
{
nonBlocking = true;
std::map<uint64_t,uint64_t> vaLenMap;
for (unsigned i = 0; i < rd->buf_num; i++)
{
vaLenMap[rd->bufs[i].va] = rd->bufs[i].len;
}
mReqList.push_back(std::make_tuple(mReqCounter,rd->priv_data, vaLenMap));
}
void *dest;
uint64_t fullSize = 0;
for (unsigned i = 0; i < rd->buf_num; i++)
{
dest = (void *)rd->bufs[i].va;
uint64_t read_size = 0;
do
{
xclReadQueue_RPC_CALL(xclReadQueue,q_hdl, dest , rd->bufs[i].len);
} while (read_size == 0 && !nonBlocking);
fullSize += read_size;
}
mReqCounter++;
PRINTENDFUNC;
return fullSize;
}
/*
* xclPollCompletion
*/
int HwEmShim::xclPollCompletion(int min_compl, int max_compl, xclReqCompletion *comps, int* actual, int timeout)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << " , "<< max_compl <<", "<<min_compl<<" ," << *actual <<" ," << timeout << std::endl;
}
xclemulation::TIMEOUT_SCALE timeout_scale=xclemulation::config::getInstance()->getTimeOutScale();
if(timeout_scale==xclemulation::TIMEOUT_SCALE::NA) {
std::string dMsg = "WARNING: [HW-EMU 10] xclPollCompletion : Timeout is not enabled in emulation by default.Please use xrt.ini (key: timeout_scale=ms|sec|min) to enable";
logMessage(dMsg, 0);
}
xclemulation::ApiWatchdog watch(timeout_scale,timeout);
watch.reset();
*actual = 0;
while(*actual < min_compl)
{
std::list<std::tuple<uint64_t ,void*, std::map<uint64_t,uint64_t> > >::iterator it = mReqList.begin();
while ( it != mReqList.end() )
{
unsigned numBytesProcessed = 0;
uint64_t reqCounter = std::get<0>(*it);
void* priv_data = std::get<1>(*it);
std::map<uint64_t,uint64_t>vaLenMap = std::get<2>(*it);
xclPollCompletion_RPC_CALL(xclPollCompletion,reqCounter,vaLenMap);
if(numBytesProcessed > 0)
{
comps[*actual].priv_data = priv_data;
comps[*actual].nbytes = numBytesProcessed;
(*actual)++;
mReqList.erase(it++);
if(*actual >= max_compl) {
PRINTENDFUNC;
return (*actual);
}
}
else
{
it++;
}
if(watch.isTimeout()) {
PRINTENDFUNC;
if (*actual <=0) {
return -ETIMEDOUT;
} else {
return *actual;
}
}
}
}
PRINTENDFUNC;
return (*actual);
}
/*
* xclAllocQDMABuf()
*/
void * HwEmShim::xclAllocQDMABuf(size_t size, uint64_t *buf_hdl)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
void *pBuf=nullptr;
if (posix_memalign(&pBuf, getpagesize(), size))
{
if (mLogStream.is_open()) mLogStream << "posix_memalign failed" << std::endl;
pBuf=nullptr;
return pBuf;
}
memset(pBuf, 0, size);
return pBuf;
}
/*
* xclFreeQDMABuf()
*/
int HwEmShim::xclFreeQDMABuf(uint64_t buf_hdl)
{
if (mLogStream.is_open())
{
mLogStream << __func__ << ", " << std::this_thread::get_id() << std::endl;
}
PRINTENDFUNC;
return 0;//TODO
}
int HwEmShim::xcl_LogMsg(xrtLogMsgLevel level, const char* tag, const char* format, ...)
{
va_list args;
va_start(args, format);
int ret = xclLogMsg(level, tag, format, args);
va_end(args);
return ret;
}
/*
* xclLogMsg()
*/
int HwEmShim::xclLogMsg(xrtLogMsgLevel level, const char* tag, const char* format, va_list args1)
{
int len = std::vsnprintf(nullptr, 0, format, args1);
if (len < 0)
{
//illegal arguments
std::string err_str = "ERROR: Illegal arguments in log format string. ";
err_str.append(std::string(format));
xrt_core::message::send((xrt_core::message::severity_level)level, tag, err_str.c_str());
return len;
}
len++; //To include null terminator
std::vector<char> buf(len);
len = std::vsnprintf(buf.data(), len, format, args1);
if (len < 0)
{
//error processing arguments
std::string err_str = "ERROR: When processing arguments in log format string. ";
err_str.append(std::string(format));
xrt_core::message::send((xrt_core::message::severity_level)level, tag, err_str.c_str());
return len;
}
xrt_core::message::send((xrt_core::message::severity_level)level, tag, buf.data());
return 0;
}
void HwEmShim::closemMessengerThread() {
if(mMessengerThreadStarted) {
mMessengerThread.join();
mMessengerThreadStarted = false;
}
if(mHostMemAccessThreadStarted) {
mHostMemAccessThreadStarted = false;
if(mHostMemAccessThread.joinable()){
mHostMemAccessThread.join();
}
}
}
//Construct CU index vs Base address map from IP_LAYOUT section in xclbin.
int HwEmShim::getCuIdxBaseAddrMap()
{
std::string errmsg;
if (!mCoreDevice){
errmsg = "ERROR: [HW-EMU] getCuIdxBaseAddrMap - core device not found";
std::cerr << errmsg << std::endl;
return -EINVAL;
}
auto buffer = mCoreDevice->get_axlf_section(IP_LAYOUT);
if (!buffer.first){
errmsg = "ERROR: [HW-EMU] getCuIdxBaseAddrMap - can't load ip_layout section";
std::cerr << errmsg << std::endl;
return -EINVAL;
}
auto map = reinterpret_cast<const ::ip_layout*>(buffer.first);
if (map->m_count < 0) {
errmsg = "ERROR: [HW-EMU] getCuIdxBaseAddrMap - invalid ip_layout section content";
std::cerr << errmsg << std::endl;
return -EINVAL;
}
mCuIndxVsBaseAddrMap.clear();
//Fill map with CU Index and Base address of the kernel in IP_LAYOUT section in XCLBIN
for (int i = 0; i < map->m_count; i++) {
mCuIndxVsBaseAddrMap[i] = map->m_ip_data[i].m_base_address;
}
return 0;
}
//CU register space for xclRegRead/Write()
int HwEmShim::xclRegRW(bool rd, uint32_t cu_index, uint32_t offset, uint32_t *datap)
{
if (mLogStream.is_open()) {
mLogStream << __func__ << ", " << std::this_thread::get_id() << ", " << "CU Idx : " << cu_index << " Offset : " << offset << " Datap : " << (*datap) << std::endl;
}
//get cu idx vs base addr map from IP_LAYOUT section in xclbin.
getCuIdxBaseAddrMap();
std::string strCuidx = boost::lexical_cast<std::string>(cu_index);
if (cu_index >= mCuIndxVsBaseAddrMap.size()) {
std::string strMsg = "ERROR: [HW-EMU 20] xclRegRW - invalid CU index: " + strCuidx;
logMessage(strMsg);
return -EINVAL;
}
if (offset >= mCuMapSize || (offset & (sizeof(uint32_t) - 1)) != 0) {
std::string strOffset = boost::lexical_cast<std::string>(offset);
std::string strMsg = "ERROR: [HW-EMU 21] xclRegRW - invalid CU offset: " + strOffset;
logMessage(strMsg);
return -EINVAL;
}
char *buff = new char[REG_BUFF_SIZE];
std::memset(buff, 0, sizeof(char)*REG_BUFF_SIZE);
uint64_t baseAddr = mCuIndxVsBaseAddrMap[cu_index] + offset;
if (rd) {
if (xclRead(XCL_ADDR_KERNEL_CTRL, baseAddr, buff, REG_BUFF_SIZE) != REG_BUFF_SIZE) {
std::string strMsg = "ERROR: [HW-EMU 22] xclRegRW - xclRead failed for CU: " + strCuidx;
logMessage(strMsg);
return -EINVAL;
}
uint32_t * tmp_buff = (uint32_t *) buff;
*datap = tmp_buff[0];
}
else {
uint32_t * tmp_buff = (uint32_t *)buff;
tmp_buff[0] = *datap;
if (xclWrite(XCL_ADDR_KERNEL_CTRL, baseAddr, tmp_buff, REG_BUFF_SIZE) != REG_BUFF_SIZE) {
std::string strMsg = "ERROR: [HW-EMU 23] xclRegRW - xclWrite failed for CU: " + strCuidx;
logMessage(strMsg);
return -EINVAL;
}
}
return 0;
}
int HwEmShim::xclRegRead(uint32_t cu_index, uint32_t offset, uint32_t *datap)
{
return xclRegRW(true, cu_index, offset, datap);
}
int HwEmShim::xclRegWrite(uint32_t cu_index, uint32_t offset, uint32_t data)
{
return xclRegRW(false, cu_index, offset, &data);
}
//Get CU index from IP_LAYOUT section for corresponding kernel name
int HwEmShim::xclIPName2Index(const char *name)
{
//Get IP_LAYOUT buffer from xclbin
auto buffer = mCoreDevice->get_axlf_section(IP_LAYOUT);
return xclemulation::getIPName2Index(name, buffer.first);
}
volatile bool HwEmShim::get_mHostMemAccessThreadStarted() { return mHostMemAccessThreadStarted; }
volatile void HwEmShim::set_mHostMemAccessThreadStarted(bool val) { mHostMemAccessThreadStarted = val; }
/********************************************** QDMA APIs IMPLEMENTATION END**********************************************/
/**********************************************HAL2 API's END HERE **********************************************/
/********************************************** Q2H_helper class implementation starts **********************************************/
/**
* Function: device2xrt_rd_trans_cb
* Description : Its a Read request from Device to HOST Buffer Call back function which gets read Address,
* size and Data pointer to be filled.
* Arguments:
* 1. addr: Read request addr
* 2. data_ptr: container of read data which gets filled by Host. size of this container
* is = size rgument of this function
* 3. size: size of read request
* Return Value: This funtion returns boolean value. Incase of successful read from Host
* it will return true or else false.
*
**/
bool HwEmShim::device2xrt_rd_trans_cb(unsigned long int addr, void* const data_ptr,unsigned long int size) {
auto itStart = mHostOnlyMemMap.begin();
auto itEnd = mHostOnlyMemMap.end();
while (itStart != itEnd)
{
uint64_t baseAddress = (*itStart).first;
std::pair<void*, uint64_t> osAddressSizePair = (*itStart).second;
void* startOSAddress = osAddressSizePair.first;
uint64_t buf_size = osAddressSizePair.second;
if (addr >= baseAddress && addr < baseAddress + buf_size)
{
unsigned char* finalOsAddress = (unsigned char*)startOSAddress + (addr - baseAddress);
if ((addr + size) > (baseAddress + buf_size)) {
std::string dMsg = "ERROR: [HW-EMU 24] Host Memory - Accessing the invalid address range which is not within the boundary. Valid address range is "
+ std::to_string(baseAddress) + " - " + std::to_string(baseAddress + buf_size) + ". Whereas requested address range is " + std::to_string(addr) + " - " + std::to_string(addr+size);
logMessage(dMsg, 0);
return false;
}
std::memcpy((unsigned char*)data_ptr, finalOsAddress, size);
break;
}
itStart++;
}
return true;
}
/**
* Function: device2xrt_wr_trans_cb
* Description : Its a Write request from Device to HOST Buffer Call back function which gets Write address,
* size and Data pointer of written data.
* Arguments:
* 1. addr: Read request addr
* 2. data_ptr: container which holds write data which is already filled by deivce. size of this container
* is = size rgument of this function
* 3. size: size of Write request
* Return Value: This funtion returns boolean value. Incase of successful write to Host Buffer
* it will return true or else false.
*
**/
bool HwEmShim::device2xrt_wr_trans_cb(unsigned long int addr, void const* data_ptr,unsigned long int size) {
auto itStart = mHostOnlyMemMap.begin();
auto itEnd = mHostOnlyMemMap.end();
while (itStart != itEnd)
{
uint64_t baseAddress = (*itStart).first;
std::pair<void*, uint64_t> osAddressSizePair = (*itStart).second;
void* startOSAddress = osAddressSizePair.first;
uint64_t buf_size = osAddressSizePair.second;
if (addr >= baseAddress && addr < baseAddress + buf_size)
{
unsigned char* finalOsAddress = (unsigned char*)startOSAddress + (addr - baseAddress);
if ((addr + size) > (baseAddress + buf_size)) {
std::string dMsg = "ERROR: [HW-EMU 25] Host Memory - Accessing the invalid address range which is not within the boundary. Valid address range is "
+ std::to_string(baseAddress) + " - " + std::to_string(baseAddress + buf_size) + ". Whereas requested address range is " + std::to_string(addr) + " - " + std::to_string(addr + size);
logMessage(dMsg, 0);
return false;
}
std::memcpy(finalOsAddress, (unsigned char*)data_ptr, size);
break;
}
itStart++;
}
return true;
}
bool HwEmShim::device2xrt_irq_trans_cb(uint32_t,unsigned long int) {
// TODO: We need to return a ERROR here as we are not supporting this. Its helps users to get notified
return true;
}
Q2H_helper :: Q2H_helper(xclhwemhal2::HwEmShim* _inst) {
header = std::make_unique<call_packet_info>();
response_header = std::make_unique<response_packet_info>();
inst = _inst;
Q2h_sock = NULL;
header->set_size(0);
header->set_xcl_api(0);
response_header->set_size(0);
response_header->set_xcl_api(0);
#if GOOGLE_PROTOBUF_VERSION < 3006001
i_len = header->ByteSize();
ri_len = response_header->ByteSize();
#else
i_len = header->ByteSizeLong();
ri_len = response_header->ByteSizeLong();
#endif
}
Q2H_helper::~Q2H_helper() {
delete Q2h_sock;
Q2h_sock = 0;
}
/**
* Pooling on socket for any memory or interrupt requests from SIM_QDMA
*
*/
int Q2H_helper::poolingon_Qdma() {
//Getting incoming header packet from sim_qdma
auto raw_header = std::make_unique<char[]>(i_len);
int r = Q2h_sock->sk_read((void*)raw_header.get(), i_len);
if (r <= 0) {
return r;
}
assert(i_len == (uint32_t)r);
//deserializing protobuf message
header->ParseFromArray((void*)raw_header.get(), i_len);
if (header->xcl_api() == xclClose_n) {
return -1;
}
//Getting incoming header packet from sim_qdma
auto raw_payload = std::make_unique<char[]>(header->size());
r = Q2h_sock->sk_read((void*)raw_payload.get(), header->size());
assert((uint32_t)r == header->size());
//processing payload and sending the response message back to sim_qdma
if (header->xcl_api() == xclQdma2HostReadMem_n) {
xclSlaveReadReq_call payload;
xclSlaveReadReq_response response_payload;
payload.ParseFromArray((void*)raw_payload.get(), r);
auto data = std::make_unique<char[]>(payload.size());
bool resp = inst->device2xrt_rd_trans_cb((unsigned long int)payload.addr(),(void* const)data.get(),(unsigned long int)payload.size());
response_payload.set_valid(resp);
response_payload.set_data((void*)data.get(),payload.size());
#if GOOGLE_PROTOBUF_VERSION < 3006001
auto r_len = response_payload.ByteSize();
#else
auto r_len = response_payload.ByteSizeLong();
#endif
SEND_RESP2QDMA()
}
if (header->xcl_api() == xclQdma2HostWriteMem_n) {
xclSlaveWriteReq_call payload;
xclSlaveWriteReq_response response_payload;
payload.ParseFromArray((void*)raw_payload.get(), r);
bool resp = inst->device2xrt_wr_trans_cb((unsigned long int)payload.addr(),(void const*)payload.data().c_str(),(unsigned long int)payload.size());
response_payload.set_valid(resp);
#if GOOGLE_PROTOBUF_VERSION < 3006001
auto r_len = response_payload.ByteSize();
#else
auto r_len = response_payload.ByteSizeLong();
#endif
SEND_RESP2QDMA()
}
if (header->xcl_api() == xclQdma2HostInterrupt_n) {
xclInterruptOccured_call payload;
xclInterruptOccured_response response_payload;
payload.ParseFromArray((void*)raw_payload.get(), r);
uint32_t interrupt_line = payload.interrupt_line();
bool resp = inst->device2xrt_irq_trans_cb(interrupt_line,4);
response_payload.set_valid(resp);
#if GOOGLE_PROTOBUF_VERSION < 3006001
auto r_len = response_payload.ByteSize();
#else
auto r_len = response_payload.ByteSizeLong();
#endif
SEND_RESP2QDMA()
}
return 1;
}
bool Q2H_helper::connect_sock() {
std::string sock_name;
if(getenv("EMULATION_SOCKETID")) {
sock_name = "D2X_unix_sock_" + std::string(getenv("EMULATION_SOCKETID"));
} else {
sock_name = "D2X_unix_sock";
}
if(Q2h_sock == NULL) {
Q2h_sock = new unix_socket(sock_name,5,false);
}
else if (!Q2h_sock->server_started) {
Q2h_sock->start_server(5,false);
}
return Q2h_sock->server_started;
}
void hostMemAccessThread(xclhwemhal2::HwEmShim* inst) {
inst->set_mHostMemAccessThreadStarted(true);
auto mq2h_helper_ptr = std::make_unique<Q2H_helper>(inst);
bool sock_ret = false;
int count = 0;
while(inst->get_mHostMemAccessThreadStarted() && !sock_ret && count < 71){
sock_ret = mq2h_helper_ptr->connect_sock();
count++;
}
int r =0;
while(inst->get_mHostMemAccessThreadStarted() && r >= 0){
try {
if (!inst->get_simulator_started())
return;
r = mq2h_helper_ptr->poolingon_Qdma();
} catch(int e) {
std::cout << " Exception during socket communitication between SIM_QDMA ---> HE_EMU driver.." << std::endl;
}
}
}
/********************************************** Q2H_helper class implementation Ends **********************************************/
} // end namespace xclhwemhal2
|
//3541
#include <stdio.h>
int main(){
char n;
while(scanf("%c",&n),n!='\n');
while(scanf("%c",&n)!=EOF){
if(n>='a'&&n<='z'){
n -= 32;
}else if(n>='A'&&n<='Z'){
n += 32;
}
printf("%c",n);
}
}
|
/**
* This file is part of the MultiDimSparseArray library
*
* @license BSD-3
* @author Abhilekh Agarwal
*/
#pragma once
#include <array>
#include <iostream>
#include "exception.h"
template<unsigned N>
class mdrange {
private:
std::array<int, N> last;
std::array<int, N> first, iter;
bool overflow;
int step;
void init() {
for (auto i = 0U; i < N; i++) {
iter[i] = first[i];
last[i] -= 1;
if (last[i] < first[i]) {
throw InvalidDimensionsException("Wrong Dimension");
}
}
overflow = false;
}
public:
mdrange(std::array<int, N> end) :
last(end), step(1) {
first.fill(0);
init();
}
mdrange(std::array<int, N> start, std::array<int, N> end) :
last(end), first(start), step(1) {
init();
}
const mdrange& begin() const {
return *this;
}
const mdrange& end() const {
return *this;
}
// Iterator functions
bool operator!=(const mdrange&) const {
return !overflow;
}
void operator++() {
for (int i = N - 1; i > -1; i--) {
if (last[i] == iter[i]) {
continue;
}
iter[i] += step;
if (i == N - 1)
return;
for (unsigned j = i + 1; j < N; j++) {
iter[j] = first[j];
}
return;
}
overflow = true;
}
const std::array<int, N>& operator*() const {
return iter;
}
};
|
/* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
/*
* Implementation for DefaultStoreClient class.
*
* Copyright (c) 2009 Webroot Software, 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 <voldemort/InconsistentDataException.h>
#include <voldemort/InvalidMetadataException.h>
#include "DefaultStoreClient.h"
#include "VectorClock.h"
#include <iostream>
#include <list>
namespace Voldemort {
using namespace boost;
using namespace std;
static const int METADATA_REFRESH_ATTEMPTS = 3;
DefaultStoreClient::DefaultStoreClient(shared_ptr<Store>& store,
shared_ptr<InconsistencyResolver>& resolver,
shared_ptr<ClientConfig>& config,
StoreClientFactory* factory)
: config_(config), resolver_(resolver),
store_(store), factory_(factory), curValue_() {
}
DefaultStoreClient::~DefaultStoreClient() {
}
void DefaultStoreClient::reinit() {
shared_ptr<Store>
nstore(factory_->getRawStore(*(store_->getName()), resolver_));
store_ = nstore;
}
const std::string* DefaultStoreClient::getValue(const std::string* key) {
return getValue(key, NULL);
}
const std::string* DefaultStoreClient::getValue(const std::string* key,
const std::string* defaultValue) {
const VersionedValue* vv = get(key, NULL);
if (vv == NULL)
return defaultValue;
else
return vv->getValue();
}
const VersionedValue* DefaultStoreClient::get(const std::string* key) {
return get(key, NULL);
}
const VersionedValue* DefaultStoreClient::get(const std::string* key,
const VersionedValue* defaultValue) {
for (int attempts = 0; attempts < METADATA_REFRESH_ATTEMPTS; attempts++) {
try {
auto_ptr<list<VersionedValue> > items(store_->get(*key));
if (items->size() == 0) {
if (!defaultValue)
return NULL;
curValue_ = *defaultValue;
}
else if (items->size() == 1)
curValue_ = items->front();
else
throw InconsistentDataException("Unresolved versions returned from get(" +
*key + ")");
return &curValue_;
} catch (InvalidMetadataException& e) {
reinit();
}
}
throw InvalidMetadataException("Exceeded maximum metadata refresh attempts");
}
void DefaultStoreClient::put(const std::string* key,
const std::string* value) {
const VersionedValue* vv = get(key);
if (vv == NULL) {
std::string* valuec = NULL;
Version* version = NULL;
try {
version = new VectorClock();
valuec = new std::string(*value);
curValue_.setVersion(version);
version = NULL;
curValue_.setValue(valuec);
valuec = NULL;
} catch (...) {
if (version) delete version;
if (valuec) delete valuec;
throw;
}
} else {
curValue_ = *vv;
curValue_.setValue(new std::string(*value));
}
put(key, &curValue_);
}
void DefaultStoreClient::put(const std::string* key,
const VersionedValue* value) {
for (int attempts = 0; attempts < METADATA_REFRESH_ATTEMPTS; attempts++) {
try {
store_->put(*key, *value);
return;
} catch (InvalidMetadataException& e) {
reinit();
}
}
throw InvalidMetadataException("Exceeded maximum metadata refresh attempts");
}
bool DefaultStoreClient::putifNotObsolete(const std::string* key,
const VersionedValue* value) {
try {
put(key, value);
return true;
} catch (ObsoleteVersionException& e) {
return false;
}
}
bool DefaultStoreClient::deleteKey(const std::string* key) {
const VersionedValue* vv = get(key);
if (vv == NULL)
return false;
return deleteKey(key, vv->getVersion());
}
bool DefaultStoreClient::deleteKey(const std::string* key,
const Version* version) {
for (int attempts = 0; attempts < METADATA_REFRESH_ATTEMPTS; attempts++) {
try {
return store_->deleteKey(*key, *version);
} catch (InvalidMetadataException& e) {
reinit();
}
}
throw InvalidMetadataException("Exceeded maximum metadata refresh attempts");
}
} /* namespace Voldemort */
|
// This file is licensed under the Elastic License 2.0. Copyright 2021-present, StarRocks Limited.
#include "exec/vectorized/tablet_scanner.h"
#include <memory>
#include <utility>
#include "column/column_helper.h"
#include "column/column_pool.h"
#include "column/field.h"
#include "column/fixed_length_column.h"
#include "column/vectorized_fwd.h"
#include "common/status.h"
#include "exec/vectorized/olap_scan_node.h"
#include "storage/storage_engine.h"
#include "storage/vectorized/chunk_helper.h"
#include "storage/vectorized/column_predicate_rewriter.h"
#include "storage/vectorized/predicate_parser.h"
#include "storage/vectorized/projection_iterator.h"
namespace starrocks::vectorized {
TabletScanner::TabletScanner(OlapScanNode* parent) : _parent(parent) {}
TabletScanner::~TabletScanner() {
if (_runtime_state != nullptr) {
close(_runtime_state);
}
}
Status TabletScanner::init(RuntimeState* runtime_state, const TabletScannerParams& params) {
_runtime_state = runtime_state;
_skip_aggregation = params.skip_aggregation;
_need_agg_finalize = params.need_agg_finalize;
RETURN_IF_ERROR(Expr::clone_if_not_exists(*params.conjunct_ctxs, runtime_state, &_conjunct_ctxs));
RETURN_IF_ERROR(_get_tablet(params.scan_range));
RETURN_IF_ERROR(_init_unused_output_columns(*params.unused_output_columns));
RETURN_IF_ERROR(_init_return_columns());
RETURN_IF_ERROR(_init_global_dicts());
RETURN_IF_ERROR(_init_reader_params(params.key_ranges));
const TabletSchema& tablet_schema = _tablet->tablet_schema();
Schema child_schema = ChunkHelper::convert_schema_to_format_v2(tablet_schema, _reader_columns);
_reader = std::make_shared<TabletReader>(_tablet, Version(0, _version), std::move(child_schema));
if (_reader_columns.size() == _scanner_columns.size()) {
_prj_iter = _reader;
} else {
Schema output_schema = ChunkHelper::convert_schema_to_format_v2(tablet_schema, _scanner_columns);
_prj_iter = new_projection_iterator(output_schema, _reader);
}
if (!_conjunct_ctxs.empty() || !_predicates.empty()) {
_expr_filter_timer = ADD_TIMER(_parent->_runtime_profile, "ExprFilterTime");
}
DCHECK(_params.global_dictmaps != nullptr);
RETURN_IF_ERROR(_prj_iter->init_encoded_schema(*_params.global_dictmaps));
RETURN_IF_ERROR(_prj_iter->init_output_schema(*_params.unused_output_column_ids));
Status st = _reader->prepare();
if (!st.ok()) {
std::string msg = strings::Substitute("Fail to scan tablet. error: $0, backend: $1", st.get_error_msg(),
BackendOptions::get_localhost());
LOG(WARNING) << msg;
return Status::InternalError(msg);
} else {
return Status::OK();
}
}
Status TabletScanner::open([[maybe_unused]] RuntimeState* runtime_state) {
if (_is_open) {
return Status::OK();
} else {
_is_open = true;
Status st = _reader->open(_params);
if (!st.ok()) {
auto msg = strings::Substitute("Fail to scan tablet. error: $0, backend: $1", st.get_error_msg(),
BackendOptions::get_localhost());
st = Status::InternalError(msg);
LOG(WARNING) << st;
} else {
RETURN_IF_ERROR(runtime_state->check_mem_limit("tablet_scanner"));
}
return st;
}
}
Status TabletScanner::close(RuntimeState* state) {
if (_is_closed) {
return Status::OK();
}
if (_prj_iter) {
_prj_iter->close();
}
update_counter();
_reader.reset();
_predicate_free_pool.clear();
Expr::close(_conjunct_ctxs, state);
// Reduce the memory usage if the the average string size is greater than 512.
release_large_columns<BinaryColumn>(state->chunk_size() * 512);
_is_closed = true;
return Status::OK();
}
Status TabletScanner::_get_tablet(const TInternalScanRange* scan_range) {
TTabletId tablet_id = scan_range->tablet_id;
_version = strtoul(scan_range->version.c_str(), nullptr, 10);
std::string err;
_tablet = StorageEngine::instance()->tablet_manager()->get_tablet(tablet_id, true, &err);
if (!_tablet) {
auto msg = strings::Substitute("Not found tablet. tablet_id: $0, error: $1", tablet_id, err);
LOG(WARNING) << msg;
return Status::InternalError(msg);
}
return Status::OK();
}
Status TabletScanner::_init_reader_params(const std::vector<OlapScanRange*>* key_ranges) {
_params.reader_type = READER_QUERY;
_params.skip_aggregation = _skip_aggregation;
_params.profile = _parent->_scan_profile;
_params.runtime_state = _runtime_state;
// If a agg node is this scan node direct parent
// we will not call agg object finalize method in scan node,
// to avoid the unnecessary SerDe and improve query performance
_params.need_agg_finalize = _need_agg_finalize;
_params.use_page_cache = !config::disable_storage_page_cache;
// Improve for select * from table limit x, x is small
if (_parent->_limit != -1 && _parent->_limit < runtime_state()->chunk_size()) {
_params.chunk_size = _parent->_limit;
} else {
_params.chunk_size = runtime_state()->chunk_size();
}
PredicateParser parser(_tablet->tablet_schema());
std::vector<PredicatePtr> preds;
RETURN_IF_ERROR(_parent->_conjuncts_manager.get_column_predicates(&parser, &preds));
for (auto& p : preds) {
if (parser.can_pushdown(p.get())) {
_params.predicates.push_back(p.get());
} else {
_predicates.add(p.get());
}
_predicate_free_pool.emplace_back(std::move(p));
}
ConjunctivePredicatesRewriter not_pushdown_predicate_rewriter(_predicates, *_params.global_dictmaps);
not_pushdown_predicate_rewriter.rewrite_predicate(&_parent->_obj_pool);
// Range
for (auto key_range : *key_ranges) {
if (key_range->begin_scan_range.size() == 1 && key_range->begin_scan_range.get_value(0) == NEGATIVE_INFINITY) {
continue;
}
_params.range = key_range->begin_include ? "ge" : "gt";
_params.end_range = key_range->end_include ? "le" : "lt";
_params.start_key.push_back(key_range->begin_scan_range);
_params.end_key.push_back(key_range->end_scan_range);
}
// Return columns
if (_skip_aggregation) {
_reader_columns = _scanner_columns;
} else {
for (size_t i = 0; i < _tablet->num_key_columns(); i++) {
_reader_columns.push_back(i);
}
for (auto index : _scanner_columns) {
if (!_tablet->tablet_schema().column(index).is_key()) {
_reader_columns.push_back(index);
}
}
}
// Actually only the key columns need to be sorted by id, here we check all
// for simplicity.
DCHECK(std::is_sorted(_reader_columns.begin(), _reader_columns.end()));
return Status::OK();
}
Status TabletScanner::_init_return_columns() {
for (auto slot : _parent->_tuple_desc->slots()) {
if (!slot->is_materialized()) {
continue;
}
int32_t index = _tablet->field_index(slot->col_name());
if (index < 0) {
auto msg = strings::Substitute("Invalid column name: $0", slot->col_name());
LOG(WARNING) << msg;
return Status::InvalidArgument(msg);
}
_scanner_columns.push_back(index);
if (!_unused_output_column_ids.count(index)) {
_query_slots.push_back(slot);
}
}
// Put key columns before non-key columns, as the `MergeIterator` and `AggregateIterator`
// required.
std::sort(_scanner_columns.begin(), _scanner_columns.end());
if (_scanner_columns.empty()) {
return Status::InternalError("failed to build storage scanner, no materialized slot!");
}
return Status::OK();
}
Status TabletScanner::_init_unused_output_columns(const std::vector<std::string>& unused_output_columns) {
for (const auto& col_name : unused_output_columns) {
int32_t index = _tablet->field_index(col_name);
if (index < 0) {
auto msg = strings::Substitute("Invalid column name: $0", col_name);
LOG(WARNING) << msg;
return Status::InvalidArgument(msg);
}
_unused_output_column_ids.insert(index);
}
_params.unused_output_column_ids = &_unused_output_column_ids;
return Status::OK();
}
// mapping a slot-column-id to schema-columnid
Status TabletScanner::_init_global_dicts() {
const auto& global_dict_map = _runtime_state->get_query_global_dict_map();
auto global_dict = _parent->_obj_pool.add(new ColumnIdToGlobalDictMap());
// mapping column id to storage column ids
for (auto slot : _parent->_tuple_desc->slots()) {
if (!slot->is_materialized()) {
continue;
}
auto iter = global_dict_map.find(slot->id());
if (iter != global_dict_map.end()) {
auto& dict_map = iter->second.first;
int32_t index = _tablet->field_index(slot->col_name());
DCHECK(index >= 0);
global_dict->emplace(index, const_cast<GlobalDictMap*>(&dict_map));
}
}
_params.global_dictmaps = global_dict;
return Status::OK();
}
Status TabletScanner::get_chunk(RuntimeState* state, Chunk* chunk) {
if (state->is_cancelled()) {
return Status::Cancelled("canceled state");
}
SCOPED_TIMER(_parent->_scan_timer);
do {
if (Status status = _prj_iter->get_next(chunk); !status.ok()) {
return status;
}
for (auto slot : _query_slots) {
size_t column_index = chunk->schema()->get_field_index_by_name(slot->col_name());
chunk->set_slot_id_to_index(slot->id(), column_index);
}
if (!_predicates.empty()) {
SCOPED_TIMER(_expr_filter_timer);
size_t nrows = chunk->num_rows();
_selection.resize(nrows);
_predicates.evaluate(chunk, _selection.data(), 0, nrows);
chunk->filter(_selection);
DCHECK_CHUNK(chunk);
}
if (!_conjunct_ctxs.empty()) {
SCOPED_TIMER(_expr_filter_timer);
ExecNode::eval_conjuncts(_conjunct_ctxs, chunk);
DCHECK_CHUNK(chunk);
}
} while (chunk->num_rows() == 0);
_update_realtime_counter(chunk);
return Status::OK();
}
void TabletScanner::_update_realtime_counter(Chunk* chunk) {
COUNTER_UPDATE(_parent->_read_compressed_counter, _reader->stats().compressed_bytes_read);
_compressed_bytes_read += _reader->stats().compressed_bytes_read;
_reader->mutable_stats()->compressed_bytes_read = 0;
COUNTER_UPDATE(_parent->_raw_rows_counter, _reader->stats().raw_rows_read);
_raw_rows_read += _reader->stats().raw_rows_read;
_reader->mutable_stats()->raw_rows_read = 0;
_num_rows_read += chunk->num_rows();
}
void TabletScanner::update_counter() {
if (_has_update_counter) {
return;
}
if (!_reader) {
return;
}
COUNTER_UPDATE(_parent->_create_seg_iter_timer, _reader->stats().create_segment_iter_ns);
COUNTER_UPDATE(_parent->_rows_read_counter, _num_rows_read);
COUNTER_UPDATE(_parent->_io_timer, _reader->stats().io_ns);
COUNTER_UPDATE(_parent->_read_compressed_counter, _reader->stats().compressed_bytes_read);
_compressed_bytes_read += _reader->stats().compressed_bytes_read;
COUNTER_UPDATE(_parent->_decompress_timer, _reader->stats().decompress_ns);
COUNTER_UPDATE(_parent->_read_uncompressed_counter, _reader->stats().uncompressed_bytes_read);
COUNTER_UPDATE(_parent->bytes_read_counter(), _reader->stats().bytes_read);
COUNTER_UPDATE(_parent->_block_load_timer, _reader->stats().block_load_ns);
COUNTER_UPDATE(_parent->_block_load_counter, _reader->stats().blocks_load);
COUNTER_UPDATE(_parent->_block_fetch_timer, _reader->stats().block_fetch_ns);
COUNTER_UPDATE(_parent->_block_seek_timer, _reader->stats().block_seek_ns);
COUNTER_UPDATE(_parent->_raw_rows_counter, _reader->stats().raw_rows_read);
_raw_rows_read += _reader->mutable_stats()->raw_rows_read;
COUNTER_UPDATE(_parent->_chunk_copy_timer, _reader->stats().vec_cond_chunk_copy_ns);
COUNTER_UPDATE(_parent->_seg_init_timer, _reader->stats().segment_init_ns);
COUNTER_UPDATE(_parent->_pred_filter_timer, _reader->stats().vec_cond_evaluate_ns);
COUNTER_UPDATE(_parent->_pred_filter_counter, _reader->stats().rows_vec_cond_filtered);
COUNTER_UPDATE(_parent->_del_vec_filter_counter, _reader->stats().rows_del_vec_filtered);
COUNTER_UPDATE(_parent->_seg_zm_filtered_counter, _reader->stats().segment_stats_filtered);
COUNTER_UPDATE(_parent->_zm_filtered_counter, _reader->stats().rows_stats_filtered);
COUNTER_UPDATE(_parent->_bf_filtered_counter, _reader->stats().rows_bf_filtered);
COUNTER_UPDATE(_parent->_sk_filtered_counter, _reader->stats().rows_key_range_filtered);
COUNTER_UPDATE(_parent->_index_load_timer, _reader->stats().index_load_ns);
COUNTER_UPDATE(_parent->_read_pages_num_counter, _reader->stats().total_pages_num);
COUNTER_UPDATE(_parent->_cached_pages_num_counter, _reader->stats().cached_pages_num);
COUNTER_UPDATE(_parent->_bi_filtered_counter, _reader->stats().rows_bitmap_index_filtered);
COUNTER_UPDATE(_parent->_bi_filter_timer, _reader->stats().bitmap_index_filter_timer);
COUNTER_UPDATE(_parent->_block_seek_counter, _reader->stats().block_seek_num);
COUNTER_UPDATE(_parent->_rowsets_read_count, _reader->stats().rowsets_read_count);
COUNTER_UPDATE(_parent->_segments_read_count, _reader->stats().segments_read_count);
COUNTER_UPDATE(_parent->_total_columns_data_page_count, _reader->stats().total_columns_data_page_count);
COUNTER_SET(_parent->_pushdown_predicates_counter, (int64_t)_params.predicates.size());
StarRocksMetrics::instance()->query_scan_bytes.increment(_compressed_bytes_read);
StarRocksMetrics::instance()->query_scan_rows.increment(_raw_rows_read);
if (_reader->stats().decode_dict_ns > 0) {
RuntimeProfile::Counter* c = ADD_TIMER(_parent->_scan_profile, "DictDecode");
COUNTER_UPDATE(c, _reader->stats().decode_dict_ns);
}
if (_reader->stats().late_materialize_ns > 0) {
RuntimeProfile::Counter* c = ADD_TIMER(_parent->_scan_profile, "LateMaterialize");
COUNTER_UPDATE(c, _reader->stats().late_materialize_ns);
}
if (_reader->stats().del_filter_ns > 0) {
RuntimeProfile::Counter* c1 = ADD_TIMER(_parent->_scan_profile, "DeleteFilter");
RuntimeProfile::Counter* c2 = ADD_COUNTER(_parent->_scan_profile, "DeleteFilterRows", TUnit::UNIT);
COUNTER_UPDATE(c1, _reader->stats().del_filter_ns);
COUNTER_UPDATE(c2, _reader->stats().rows_del_filtered);
}
_has_update_counter = true;
}
} // namespace starrocks::vectorized
|
/*************************************************************************/
/* csg_gizmos.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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. */
/*************************************************************************/
#include "csg_gizmos.h"
///////////
CSGShapeSpatialGizmoPlugin::CSGShapeSpatialGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/csg", Color(0.0, 0.4, 1, 0.15));
create_material("shape_union_material", gizmo_color);
create_material("shape_union_solid_material", gizmo_color);
gizmo_color.invert();
create_material("shape_subtraction_material", gizmo_color);
create_material("shape_subtraction_solid_material", gizmo_color);
gizmo_color.r = 0.95;
gizmo_color.g = 0.95;
gizmo_color.b = 0.95;
create_material("shape_intersection_material", gizmo_color);
create_material("shape_intersection_solid_material", gizmo_color);
create_handle_material("handles");
}
String CSGShapeSpatialGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const {
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
if (Object::cast_to<CSGSphere>(cs)) {
return "Radius";
}
if (Object::cast_to<CSGBox>(cs)) {
static const char *hname[3] = { "Width", "Height", "Depth" };
return hname[p_idx];
}
if (Object::cast_to<CSGCylinder>(cs)) {
return p_idx == 0 ? "Radius" : "Height";
}
if (Object::cast_to<CSGTorus>(cs)) {
return p_idx == 0 ? "InnerRadius" : "OuterRadius";
}
return "";
}
Variant CSGShapeSpatialGizmoPlugin::get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const {
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
if (Object::cast_to<CSGSphere>(cs)) {
CSGSphere *s = Object::cast_to<CSGSphere>(cs);
return s->get_radius();
}
if (Object::cast_to<CSGBox>(cs)) {
CSGBox *s = Object::cast_to<CSGBox>(cs);
switch (p_idx) {
case 0:
return s->get_width();
case 1:
return s->get_height();
case 2:
return s->get_depth();
}
}
if (Object::cast_to<CSGCylinder>(cs)) {
CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
return p_idx == 0 ? s->get_radius() : s->get_height();
}
if (Object::cast_to<CSGTorus>(cs)) {
CSGTorus *s = Object::cast_to<CSGTorus>(cs);
return p_idx == 0 ? s->get_inner_radius() : s->get_outer_radius();
}
return Variant();
}
void CSGShapeSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point) {
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
Transform gt = cs->get_global_transform();
//gt.orthonormalize();
Transform gi = gt.affine_inverse();
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 16384) };
if (Object::cast_to<CSGSphere>(cs)) {
CSGSphere *s = Object::cast_to<CSGSphere>(cs);
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), Vector3(4096, 0, 0), sg[0], sg[1], ra, rb);
float d = ra.x;
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
s->set_radius(d);
}
if (Object::cast_to<CSGBox>(cs)) {
CSGBox *s = Object::cast_to<CSGBox>(cs);
Vector3 axis;
axis[p_idx] = 1.0;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = ra[p_idx];
if (Math::is_nan(d)) {
// The handle is perpendicular to the camera.
return;
}
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
switch (p_idx) {
case 0:
s->set_width(d * 2);
break;
case 1:
s->set_height(d * 2);
break;
case 2:
s->set_depth(d * 2);
break;
}
}
if (Object::cast_to<CSGCylinder>(cs)) {
CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
Vector3 axis;
axis[p_idx == 0 ? 0 : 1] = 1.0;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
if (p_idx == 0) {
s->set_radius(d);
} else if (p_idx == 1) {
s->set_height(d * 2.0);
}
}
if (Object::cast_to<CSGTorus>(cs)) {
CSGTorus *s = Object::cast_to<CSGTorus>(cs);
Vector3 axis;
axis[0] = 1.0;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 4096, sg[0], sg[1], ra, rb);
float d = axis.dot(ra);
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
if (p_idx == 0) {
s->set_inner_radius(d);
} else if (p_idx == 1) {
s->set_outer_radius(d);
}
}
}
void CSGShapeSpatialGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
if (Object::cast_to<CSGSphere>(cs)) {
CSGSphere *s = Object::cast_to<CSGSphere>(cs);
if (p_cancel) {
s->set_radius(p_restore);
return;
}
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Sphere Shape Radius"));
ur->add_do_method(s, "set_radius", s->get_radius());
ur->add_undo_method(s, "set_radius", p_restore);
ur->commit_action();
}
if (Object::cast_to<CSGBox>(cs)) {
CSGBox *s = Object::cast_to<CSGBox>(cs);
if (p_cancel) {
switch (p_idx) {
case 0:
s->set_width(p_restore);
break;
case 1:
s->set_height(p_restore);
break;
case 2:
s->set_depth(p_restore);
break;
}
return;
}
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Box Shape Extents"));
static const char *method[3] = { "set_width", "set_height", "set_depth" };
float current = 0;
switch (p_idx) {
case 0:
current = s->get_width();
break;
case 1:
current = s->get_height();
break;
case 2:
current = s->get_depth();
break;
}
ur->add_do_method(s, method[p_idx], current);
ur->add_undo_method(s, method[p_idx], p_restore);
ur->commit_action();
}
if (Object::cast_to<CSGCylinder>(cs)) {
CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
if (p_cancel) {
if (p_idx == 0) {
s->set_radius(p_restore);
} else {
s->set_height(p_restore);
}
return;
}
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
if (p_idx == 0) {
ur->create_action(TTR("Change Cylinder Radius"));
ur->add_do_method(s, "set_radius", s->get_radius());
ur->add_undo_method(s, "set_radius", p_restore);
} else {
ur->create_action(TTR("Change Cylinder Height"));
ur->add_do_method(s, "set_height", s->get_height());
ur->add_undo_method(s, "set_height", p_restore);
}
ur->commit_action();
}
if (Object::cast_to<CSGTorus>(cs)) {
CSGTorus *s = Object::cast_to<CSGTorus>(cs);
if (p_cancel) {
if (p_idx == 0) {
s->set_inner_radius(p_restore);
} else {
s->set_outer_radius(p_restore);
}
return;
}
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
if (p_idx == 0) {
ur->create_action(TTR("Change Torus Inner Radius"));
ur->add_do_method(s, "set_inner_radius", s->get_inner_radius());
ur->add_undo_method(s, "set_inner_radius", p_restore);
} else {
ur->create_action(TTR("Change Torus Outer Radius"));
ur->add_do_method(s, "set_outer_radius", s->get_outer_radius());
ur->add_undo_method(s, "set_outer_radius", p_restore);
}
ur->commit_action();
}
}
bool CSGShapeSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
return Object::cast_to<CSGSphere>(p_spatial) || Object::cast_to<CSGBox>(p_spatial) || Object::cast_to<CSGCylinder>(p_spatial) || Object::cast_to<CSGTorus>(p_spatial) || Object::cast_to<CSGMesh>(p_spatial) || Object::cast_to<CSGPolygon>(p_spatial);
}
String CSGShapeSpatialGizmoPlugin::get_name() const {
return "CSGShapes";
}
int CSGShapeSpatialGizmoPlugin::get_priority() const {
return -1;
}
bool CSGShapeSpatialGizmoPlugin::is_selectable_when_hidden() const {
return true;
}
void CSGShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->clear();
CSGShape *cs = Object::cast_to<CSGShape>(p_gizmo->get_spatial_node());
PoolVector<Vector3> faces = cs->get_brush_faces();
if (faces.size() == 0) {
return;
}
Vector<Vector3> lines;
lines.resize(faces.size() * 2);
{
PoolVector<Vector3>::Read r = faces.read();
for (int i = 0; i < lines.size(); i += 6) {
int f = i / 6;
for (int j = 0; j < 3; j++) {
int j_n = (j + 1) % 3;
lines.write[i + j * 2 + 0] = r[f * 3 + j];
lines.write[i + j * 2 + 1] = r[f * 3 + j_n];
}
}
}
Ref<Material> material;
switch (cs->get_operation()) {
case CSGShape::OPERATION_UNION:
material = get_material("shape_union_material", p_gizmo);
break;
case CSGShape::OPERATION_INTERSECTION:
material = get_material("shape_intersection_material", p_gizmo);
break;
case CSGShape::OPERATION_SUBTRACTION:
material = get_material("shape_subtraction_material", p_gizmo);
break;
}
Ref<Material> handles_material = get_material("handles");
p_gizmo->add_lines(lines, material);
p_gizmo->add_collision_segments(lines);
if (p_gizmo->is_selected()) {
// Draw a translucent representation of the CSG node
Ref<ArrayMesh> mesh = memnew(ArrayMesh);
Array array;
array.resize(Mesh::ARRAY_MAX);
array[Mesh::ARRAY_VERTEX] = faces;
mesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, array);
Ref<Material> solid_material;
switch (cs->get_operation()) {
case CSGShape::OPERATION_UNION:
solid_material = get_material("shape_union_solid_material", p_gizmo);
break;
case CSGShape::OPERATION_INTERSECTION:
solid_material = get_material("shape_intersection_solid_material", p_gizmo);
break;
case CSGShape::OPERATION_SUBTRACTION:
solid_material = get_material("shape_subtraction_solid_material", p_gizmo);
break;
}
p_gizmo->add_mesh(mesh, false, Ref<SkinReference>(), solid_material);
}
if (Object::cast_to<CSGSphere>(cs)) {
CSGSphere *s = Object::cast_to<CSGSphere>(cs);
float r = s->get_radius();
Vector<Vector3> handles;
handles.push_back(Vector3(r, 0, 0));
p_gizmo->add_handles(handles, handles_material);
}
if (Object::cast_to<CSGBox>(cs)) {
CSGBox *s = Object::cast_to<CSGBox>(cs);
Vector<Vector3> handles;
handles.push_back(Vector3(s->get_width() * 0.5, 0, 0));
handles.push_back(Vector3(0, s->get_height() * 0.5, 0));
handles.push_back(Vector3(0, 0, s->get_depth() * 0.5));
p_gizmo->add_handles(handles, handles_material);
}
if (Object::cast_to<CSGCylinder>(cs)) {
CSGCylinder *s = Object::cast_to<CSGCylinder>(cs);
Vector<Vector3> handles;
handles.push_back(Vector3(s->get_radius(), 0, 0));
handles.push_back(Vector3(0, s->get_height() * 0.5, 0));
p_gizmo->add_handles(handles, handles_material);
}
if (Object::cast_to<CSGTorus>(cs)) {
CSGTorus *s = Object::cast_to<CSGTorus>(cs);
Vector<Vector3> handles;
handles.push_back(Vector3(s->get_inner_radius(), 0, 0));
handles.push_back(Vector3(s->get_outer_radius(), 0, 0));
p_gizmo->add_handles(handles, handles_material);
}
}
EditorPluginCSG::EditorPluginCSG(EditorNode *p_editor) {
Ref<CSGShapeSpatialGizmoPlugin> gizmo_plugin = Ref<CSGShapeSpatialGizmoPlugin>(memnew(CSGShapeSpatialGizmoPlugin));
SpatialEditor::get_singleton()->add_gizmo_plugin(gizmo_plugin);
}
|
#include "batchrenderer2d.h"
BatchRenderer2D::BatchRenderer2D() {
init();
}
BatchRenderer2D::~BatchRenderer2D() {
delete m_IBO;
glDeleteBuffers(1, &m_VBO);
}
void BatchRenderer2D::init() {
glGenVertexArrays(1, &m_VAO);
glBindVertexArray(m_VAO);
glGenBuffers(1, &m_VBO);
glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
glBufferData(GL_ARRAY_BUFFER, BUFFER_SIZE, NULL, GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(SHADER_VERTEX_INDEX);
glEnableVertexAttribArray(SHADER_COLOR_INDEX);
glVertexAttribPointer(SHADER_VERTEX_INDEX, 3, GL_FLOAT, GL_FALSE, VERTEX_SIZE, (const GLvoid*) 0);
glVertexAttribPointer(SHADER_COLOR_INDEX, 4, GL_FLOAT, GL_FALSE, VERTEX_SIZE, (const GLvoid*) (3 * sizeof(GLfloat)));
glBindBuffer(GL_ARRAY_BUFFER, 0);
GLuint *indicies = new GLuint[INDICIES_SIZE];
int offset = 0;
for (int i = 0; i < INDICIES_SIZE; i+=6) {
indicies[ i ] = offset + 0;
indicies[i + 1] = offset + 1;
indicies[i + 2] = offset + 2;
indicies[i + 3] = offset + 2;
indicies[i + 4] = offset + 3;
indicies[i + 5] = offset + 0;
offset += 4;
}
m_IBO = new IndexBuffer(indicies, INDICIES_SIZE);
glBindVertexArray(0);
}
void BatchRenderer2D::begin() {
glBindBuffer(GL_ARRAY_BUFFER, m_VBO);
m_Buffer = (VertexData*)glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
}
void BatchRenderer2D::submit(const Renderable2D* renderable) {
const vec3& position = renderable->getPosition();
const vec2& size = renderable->getSize();
const vec4& color = renderable->getColor();
m_Buffer->vertex = position;
m_Buffer->color = color;
m_Buffer++;
m_Buffer->vertex = vec3(position.x, position.y + size.y, position.z);
m_Buffer->color = color;
m_Buffer++;
m_Buffer->vertex = vec3(position.x + size.x, position.y + size.y, position.z);
m_Buffer->color = color;
m_Buffer++;
m_Buffer->vertex = vec3(position.x + size.x, position.y, position.z);
m_Buffer->color = color;
m_Buffer++;
m_Indexcount += 6;
}
void BatchRenderer2D::end() {
glUnmapBuffer(GL_ARRAY_BUFFER);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
void BatchRenderer2D::flush() {
glBindVertexArray(m_VAO);
m_IBO->bind();
glDrawElements(GL_TRIANGLES, m_Indexcount, GL_UNSIGNED_INT, NULL);
m_IBO->unbind();
glBindVertexArray(0);
m_Indexcount = 0;
}
|
#include <fileobserver.hpp>
#include <unistd.h>
#include <getopt.h>
#include <SDL.h>
#include <SDL_image.h>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <memory>
//#include <regex>
#include <sstream>
#include <utility>
//example usage:
//spriteview -w 16 -h 16 -s 2 -f 16 -i 0:16 -t sprtmap.png
struct options {
int imageWidth;
int imageHeight;
int spriteWidth;
int spriteHeight;
int scale;
int tiled;
int fps;
int frameStartIndex;
int frameEndIndex;
std::string imgPath;
};
options viewopts = {
-1, //width of spritemap
-1, //height of spritemap
-1, //width of sprite/tile
-1, //height of sprite/tile
1, //scale
0, //should not tile
8, //8 frames per second
0, //first sprite index
1, //last sprite index + 1.
"" //no default path
};
std::string appname;
std::vector<SDL_Surface*> spriteList;
SDL_Surface* spriteMap;
SDL_Surface* screen;
int spritesPerRow = -1;
int spritesPerCol = -1;
bool fullscreen = false;
bool fullscreenSupported = true;
int viewportWidth_Windowed = 640;
int viewportHeight_Windowed = 360;
//fullscreen resolution is detected in init()
int viewportWidth_Fullscreen = 0;
int viewportHeight_Fullscreen = 0;
int viewportWidth = viewportWidth_Windowed;
int viewportHeight = viewportHeight_Windowed;
static void print_usage(){
printf("Usage: %s [options] file\n", appname.c_str());
printf("Options:\n");
printf(" %-20s%s\n", "-w <width>", "Sprite width");
printf(" %-20s%s\n", "-h <height>", "Sprite height");
printf(" %-20s%s\n", "-s <scale>", "Sprite scale");
printf(" %-20s%s\n", "-f <fps>", "Animation frames per second");
printf(" %-20s%s\n", "-i start:end", "The start- and end sprite indices.");
printf(" %-20s%s\n", "-t", "Enable tiling/repeat");
}
static void init(){
if(SDL_Init(SDL_INIT_VIDEO) < 0){
printf("%s - error: Failed to initialize the SDL library\n", appname.c_str());
exit(1);
}
int imgFlags = (IMG_INIT_JPG | IMG_INIT_PNG | IMG_INIT_TIF);
if((IMG_Init(imgFlags) & imgFlags) != imgFlags){
printf("%s - error: Failed to initialize the SDL_Image library\n", appname.c_str());
SDL_Quit();
exit(1);
}
SDL_Surface* tmpSpriteMap = IMG_Load(viewopts.imgPath.c_str());
if(!tmpSpriteMap){
printf("%s - error: Failed to open \"%s\"\n", appname.c_str(), viewopts.imgPath.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
viewopts.imageWidth = tmpSpriteMap->w;
viewopts.imageHeight = tmpSpriteMap->h;
if((viewopts.imageWidth % viewopts.spriteWidth) != 0){
printf("%s - error: Sprite map width is not a multiple of the sprite width\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
if((viewopts.imageHeight % viewopts.spriteHeight) != 0){
printf("%s - error: Sprite map height is not a multiple of the sprite height\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
spritesPerRow = viewopts.imageWidth / viewopts.spriteWidth;
spritesPerCol = viewopts.imageHeight / viewopts.spriteHeight;
if(!spritesPerRow || !spritesPerCol){
printf("%s - error: Sprite map size is smaller than the sprite size\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
int total_num_sprites = spritesPerRow*spritesPerCol;
if((viewopts.frameStartIndex < -1) ||
(viewopts.frameStartIndex >= total_num_sprites) ||
(viewopts.frameEndIndex < -1) ||
(viewopts.frameEndIndex >= total_num_sprites))
{
printf("%s - error: Sprite index out of range\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
if(viewopts.frameStartIndex > viewopts.frameEndIndex){
printf("%s - error: Start sprite index is greater than end index\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
//Find the best resolution for fullscreen
SDL_Rect** videoMode = SDL_ListModes(0, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
if(!videoMode){
//no fullscreen support
fullscreenSupported = false;
} else if(videoMode == (SDL_Rect**)-1){
//no restrictions, set to 1080p
viewportWidth_Fullscreen = 1920;
viewportHeight_Fullscreen = 1080;
} else {
int highestResFound = 0;
for(int i=0; videoMode[i] != 0; i++){
int numPixelsInMode = videoMode[i]->w * videoMode[i]->h;
if(highestResFound < numPixelsInMode){
viewportWidth_Fullscreen = videoMode[i]->w;
viewportHeight_Fullscreen = videoMode[i]->h;
highestResFound = numPixelsInMode;
}
}
if(!viewportWidth_Fullscreen || !viewportHeight_Fullscreen){
fullscreenSupported = false;
}
}
//default window size is 640x360
screen = SDL_SetVideoMode(viewportWidth, viewportHeight, 32, SDL_HWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF);
if(!screen){
printf("%s - error: Failed to set video mode\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
//clipping
SDL_SetClipRect(screen, 0);
//allocate spritemap with same pixel format as the window
spriteMap = SDL_DisplayFormatAlpha(tmpSpriteMap);
if(!spriteMap){
printf("%s - error: Out of memory while converting video surface\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
SDL_FreeSurface(tmpSpriteMap);
}
static SDL_Surface* create_sprite_surface(int width, int height, SDL_Surface* ref){
SDL_Surface* s;
s = SDL_CreateRGBSurface(
SDL_HWSURFACE,
width,
height,
ref->format->BitsPerPixel,
ref->format->Rmask,
ref->format->Gmask,
ref->format->Bmask,
ref->format->Amask
);
if(!s) return 0;
SDL_SetAlpha(s, 0, 0);
return s;
}
static void init_sprites(){
int x,y,iy,ix;
int ret;
if(SDL_MUSTLOCK(spriteMap)){
SDL_LockSurface(spriteMap);
}
const unsigned int* src = (unsigned int*)spriteMap->pixels;
int srcPitch = spriteMap->pitch / sizeof(unsigned int);
for(y = 0; y < spritesPerCol; y++){
for(x = 0; x < spritesPerRow; x++){
SDL_Surface* sprite = create_sprite_surface(
viewopts.spriteWidth * viewopts.scale,
viewopts.spriteHeight * viewopts.scale,
spriteMap
);
if(!sprite){
printf("%s - error: Out of memory while creating sprites.\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
if(SDL_MUSTLOCK(sprite)){
SDL_LockSurface(sprite);
}
unsigned int* dst = (unsigned int*)sprite->pixels;
int dstPitch = sprite->pitch / sizeof(unsigned int);
for(iy=0; iy < viewopts.spriteHeight; iy++){
for(ix=0; ix < viewopts.spriteWidth; ix++){
int dstY = iy * viewopts.scale;
int dstX = ix * viewopts.scale;
int srcY = (y * viewopts.spriteHeight) + iy;
int srcX = (x * viewopts.spriteWidth) + ix;
unsigned int color = src[srcX + srcY * srcPitch];
for(int sy = 0; sy < viewopts.scale; sy++){
for(int sx = 0; sx < viewopts.scale; sx++){
dst[(dstX + sx) + (dstY + sy) * dstPitch] = color;
}
}
}
}
if(SDL_MUSTLOCK(sprite)){
SDL_UnlockSurface(sprite);
}
spriteList.push_back(sprite);
}
}
if(SDL_MUSTLOCK(spriteMap)){
SDL_UnlockSurface(spriteMap);
}
}
static void destroy_sprites(){
size_t i;
for(i = 0; i < spriteList.size(); i++){
SDL_FreeSurface(spriteList[i]);
}
spriteList.clear();
}
class file_observer_impl : public file_observer {
public:
file_observer_impl(const std::string& name) : file_observer(name){}
~file_observer_impl(){}
protected:
void on_write(){
//printf("Spritemap modified outside of viewer. Reloading.");
SDL_Surface* tmpSpriteMap = IMG_Load(viewopts.imgPath.c_str());
if(!tmpSpriteMap){
return;
}
if(tmpSpriteMap->w != spriteMap->w){
return;
}
if(tmpSpriteMap->h != spriteMap->h){
return;
}
SDL_FreeSurface(spriteMap);
spriteMap = SDL_DisplayFormatAlpha(tmpSpriteMap);
SDL_FreeSurface(tmpSpriteMap);
destroy_sprites();
init_sprites();
}
};
static void draw_sprite(int spriteIdx){
int scale = viewopts.scale;
SDL_Surface* sprite = spriteList[spriteIdx];
int srcWidth = sprite->w;
int srcHeight = sprite->h;
int srcPitch = sprite->pitch / sizeof(unsigned int);
int dstWidth = screen->w;
int dstHeight = screen->h;
int dstPitch = screen->pitch / sizeof(unsigned int);
SDL_Rect dstRect;
const unsigned int* src = (unsigned int*)sprite->pixels;
unsigned int* dst = (unsigned int*)screen->pixels;
if(viewopts.tiled &&
(srcWidth < dstWidth) &&
(srcHeight < dstHeight)){
int x,y;
for(y = 0; y < dstHeight; y+=srcHeight){
for(x = 0; x < dstWidth; x+=srcWidth){
dstRect.y = y;
dstRect.x = x;
dstRect.w = 0;
dstRect.h = 0;
SDL_BlitSurface(sprite, 0, screen, &dstRect);
}
}
SDL_Flip(screen);
} else {
//render a single tile centered on screen
dstRect.y = (dstHeight - srcHeight) / 2;
dstRect.x = (dstWidth - srcWidth) / 2;
dstRect.w = 0;
dstRect.h = 0;
SDL_BlitSurface(sprite, 0, screen, &dstRect);
SDL_Flip(screen);
}
}
void main_loop(){
SDL_Event event;
bool running = true;
Uint32 lastTime = SDL_GetTicks();
Uint32 timeAccum = 0;
Uint32 msPerFrame = 1000/viewopts.fps;
Uint32 frameOffs = 0;
Uint32 numFrames = viewopts.frameEndIndex - viewopts.frameStartIndex + 1;
std::shared_ptr<file_observer> file_change_event(new file_observer_impl(viewopts.imgPath));
while(running){
while(SDL_PollEvent(&event)){
switch(event.type){
case SDL_VIDEORESIZE:
{
viewportWidth = event.resize.w;
viewportHeight = event.resize.h;
if(viewportWidth < 256){
viewportWidth = 256;
}
if(viewportHeight < 256){
viewportHeight = 256;
}
screen = SDL_SetVideoMode(viewportWidth, viewportHeight, 32, SDL_HWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF);
if(!screen){
printf("%s - error: Window resize failed\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
}
}
break;
case SDL_KEYDOWN:
//running = false;
switch(event.key.keysym.sym){
case SDLK_ESCAPE:
running = false;
break;
case 'f':
{
if(!fullscreenSupported){
break;
}
if(!fullscreen){
//entering fullscreen
viewportWidth = viewportWidth_Fullscreen;
viewportHeight = viewportHeight_Fullscreen;
screen = SDL_SetVideoMode(viewportWidth, viewportHeight, 32, SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN);
if(!screen){
printf("%s - error: Window resize failed\n", appname.c_str());
viewportWidth = viewportWidth_Windowed;
viewportHeight = viewportHeight_Windowed;
screen = SDL_SetVideoMode(viewportWidth, viewportHeight, 32, SDL_HWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF);
} else {
fullscreen = true;
}
} else {
//leaving fullscreen
viewportWidth = viewportWidth_Windowed;
viewportHeight = viewportHeight_Windowed;
screen = SDL_SetVideoMode(viewportWidth, viewportHeight, 32, SDL_HWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF);
if(!screen){
printf("%s - error: Window resize failed\n", appname.c_str());
IMG_Quit();
SDL_Quit();
exit(1);
} else {
fullscreen = false;
}
}
}
}
break;
case SDL_QUIT:
running = false;
break;
}
}
//check if file has been modified externally
file_change_event->poll();
Uint32 currentTime = SDL_GetTicks();
Uint32 timeDelta = currentTime - lastTime;
lastTime = currentTime;
timeAccum += timeDelta;
if(timeAccum > 1000)
timeAccum = 0;
while(timeAccum >= msPerFrame){
frameOffs = (frameOffs + 1) % numFrames;
int frameIndex = viewopts.frameStartIndex + frameOffs;
draw_sprite(frameIndex);
timeAccum -= msPerFrame;
}
}
}
int main(int argc, char* argv[]){
if(argc < 2){
print_usage();
exit(1);
}
appname = std::string(argv[0]);
char c;
std::string i_param;
while ((c = getopt (argc, argv, "tw:h:s:f:i:")) != -1){
switch(c){
case 't':
viewopts.tiled = 1;
break;
case 'w':
viewopts.spriteWidth = atoi(optarg);
break;
case 'h':
viewopts.spriteHeight = atoi(optarg);
break;
case 's':
viewopts.scale = atoi(optarg);
break;
case 'f':
viewopts.fps = atoi(optarg);
break;
case 'i':
i_param = std::string(optarg);
break;
default:
print_usage();
exit(1);
break;
}
}
//Parse -i argument. It has the syntax "-i 16:8", that is, -i start:end
if(i_param.empty()){
printf("%s - error: missing sprite start and end index\n", argv[0]);
exit(1);
} else {
std::istringstream i_strm;
char i_delim;
i_strm.str(i_param);
if(!(i_strm >> viewopts.frameStartIndex)){
printf("%s - error: \"-i %s\" incorrect syntax\n", argv[0], i_param.c_str());
exit(1);
}
if(!(i_strm >> i_delim) || i_delim != ':'){
printf("%s - error: \"-i %s\" incorrect syntax\n", argv[0], i_param.c_str());
exit(1);
}
if(!(i_strm >> viewopts.frameEndIndex)){
printf("%s - error: \"-i %s\" incorrect syntax\n", argv[0], i_param.c_str());
exit(1);
}
}
int i = optind;
if(i >= argc){
printf("%s: No input given.\n", argv[0]);
exit(1);
}
viewopts.imgPath = std::string(argv[i]);
if(viewopts.spriteWidth < 4){
printf("%s - error: missing sprite width or invalid value (min=4px)\n", argv[0]);
exit(1);
}
if(viewopts.spriteHeight < 4){
printf("%s - error: missing sprite height or invalid value (min=4px)\n", argv[0]);
exit(1);
}
printf("Running with these parameters:\n");
printf(" %-20s %d\n", "sprite map width:", viewopts.imageWidth);
printf(" %-20s %d\n", "sprite map height:", viewopts.imageHeight);
printf(" %-20s %d\n", "sprite width:", viewopts.spriteWidth);
printf(" %-20s %d\n", "sprite height:", viewopts.spriteHeight);
printf(" %-20s %d\n", "scale:", viewopts.scale);
printf(" %-20s %s\n", "tiled/repeat mode", (viewopts.tiled ? "enabled" : "disabled"));
printf(" %-20s %d fps\n", "animation speed:", viewopts.fps);
printf(" %-20s %d\n", "first frame index:", viewopts.frameStartIndex);
printf(" %-20s %d\n", "last frame index:", viewopts.frameEndIndex);
printf(" %-20s %s\n", "image path:", viewopts.imgPath.c_str());
init();
init_sprites();
main_loop();
destroy_sprites();
IMG_Quit();
SDL_Quit();
return 0;
}
|
#include <eve/module/math.hpp>
#include <eve/wide.hpp>
#include <iostream>
#include <iomanip>
using wide_ft = eve::wide<float>;
int main()
{
std::cout << "---- simd" << std::setprecision(9) << std::endl
<< "-> inv_egamma(as<wide_ft>()) = " << eve::inv_egamma(eve::as<wide_ft>()) << std::endl
<< "-> upward(inv_egamma)(as<wide_ft>()) = " << eve::upward(eve::inv_egamma)(eve::as<wide_ft>()) << std::endl
<< "-> downward(inv_egamma)(as<wide_ft>()) = " << eve::downward(eve::inv_egamma)(eve::as<wide_ft>()) << std::endl;
std::cout << "---- scalar" << std::endl
<< "-> inv_egamma(as<float>()) = " << eve::inv_egamma(eve::as(float())) << std::endl;
return 0;
}
|
// codeforces/e107/C/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }
template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }
using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;
constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;
int main(int argc, char *argv[])
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.setf(ios_base::fixed);
cout.precision(15);
int n, m;
while (cin >> n >> m) {
vec<int> a(n);
cin >> a;
map<int, int> pos;
for (int i = 0; i < a.size(); ++i) {
if (pos.count(a[i])) continue;
pos[a[i]] = i;
}
vec<int> v;
while (m--) {
int t;
cin >> t;
v.push_back(pos[t]);
int p = pos[t];
each (i, pos) {
if (i.second < pos[t]) ++i.second;
}
pos[t] = 0;
}
each (i, v) cout << i+1 << ' '; cout << endl;
}
return 0;
}
|
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011 Bryce Adelstein-Lelbach
// Copyright (c) 2007-2017 Hartmut Kaiser
//
// SPDX-License-Identifier: BSL-1.0
// 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)
////////////////////////////////////////////////////////////////////////////////
#include <hpx/assert.hpp>
#include <hpx/components_base/pinned_ptr.hpp>
#include <hpx/runtime/actions/continuation.hpp>
#include <hpx/runtime/agas/interface.hpp>
#include <hpx/runtime/components/stubs/runtime_support.hpp>
#include <hpx/runtime/naming/resolver_client.hpp>
#include <hpx/runtime/runtime_fwd.hpp>
#include <hpx/runtime_distributed.hpp>
#include <hpx/util/generate_unique_ids.hpp>
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <string>
#include <utility>
#include <vector>
namespace hpx { namespace agas
{
///////////////////////////////////////////////////////////////////////////////
bool is_console()
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.is_console();
}
///////////////////////////////////////////////////////////////////////////////
bool register_name(launch::sync_policy, std::string const& name,
naming::gid_type const& gid, error_code& /* ec */
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.register_name(name, gid);
}
bool register_name(
launch::sync_policy
, std::string const& name
, naming::id_type const& id
, error_code& ec
)
{
if (&ec == &throws)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.register_name(name, id);
}
return register_name(name, id).get(ec);
}
lcos::future<bool> register_name(
std::string const& name
, naming::id_type const& id
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.register_name_async(name, id);
}
///////////////////////////////////////////////////////////////////////////////
naming::id_type unregister_name(
launch::sync_policy, std::string const& name, error_code& /* ec */
)
{
if (!hpx::is_stopped())
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.unregister_name(name);
}
return naming::invalid_id;
}
lcos::future<naming::id_type> unregister_name(
std::string const& name
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.unregister_name_async(name);
}
///////////////////////////////////////////////////////////////////////////////
lcos::future<naming::id_type> resolve_name(
std::string const& name
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.resolve_name_async(name);
}
naming::id_type resolve_name(
launch::sync_policy
, std::string const& name
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.resolve_name(name, ec);
}
///////////////////////////////////////////////////////////////////////////////
// lcos::future<std::vector<naming::id_type> > get_localities(
// components::component_type type
// )
// {
// naming::resolver_client& agas_ = naming::get_agas_client();
// return agas_.get_localities_async();
// }
//
// std::vector<naming::id_type> get_localities_sync(
// components::component_type type
// , error_code& ec
// )
// {
// naming::resolver_client& agas_ = naming::get_agas_client();
// return agas_.get_localities(type, ec);
// }
lcos::future<std::uint32_t> get_num_localities(
components::component_type /* type */
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_localities_async();
}
std::uint32_t get_num_localities(
launch::sync_policy
, components::component_type type
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_localities(type, ec);
}
lcos::future<std::vector<std::uint32_t> > get_num_threads()
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_threads_async();
}
std::vector<std::uint32_t> get_num_threads(
launch::sync_policy
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_threads(ec);
}
lcos::future<std::uint32_t> get_num_overall_threads()
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_overall_threads_async();
}
std::uint32_t get_num_overall_threads(
launch::sync_policy
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_num_overall_threads(ec);
}
std::string get_component_type_name(
components::component_type type, error_code& ec)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.get_component_type_name(type, ec);
}
///////////////////////////////////////////////////////////////////////////////
// bool is_local_address(
// naming::gid_type const& gid
// , error_code& ec
// )
// {
// return naming::get_agas_client().is_local_address(gid, ec);
// }
//
// bool is_local_address(
// naming::gid_type const& gid
// , naming::address& addr
// , error_code& ec
// )
// {
// return naming::get_agas_client().is_local_address(gid, addr, ec);
// }
//
// inline naming::gid_type const& convert_to_gid(naming::id_type const& id)
// {
// return id.get_gid();
// }
//
// bool is_local_address(
// std::vector<naming::id_type> const& ids
// , std::vector<naming::address>& addrs
// , boost::dynamic_bitset<>& locals
// , error_code& ec
// )
// {
// std::size_t count = ids.size();
//
// std::vector<naming::gid_type> gids;
// gids.reserve(count);
//
// std::transform(ids.begin(), ids.end(), std::back_inserter(gids), convert_to_gid);
//
// addrs.resize(count);
// return naming::get_agas_client().is_local_address(gids.data(),
// addrs.data(), count, locals, ec);
// }
bool is_local_address_cached(
naming::gid_type const& gid
, error_code& ec
)
{
return naming::get_agas_client().is_local_address_cached(gid, ec);
}
bool is_local_address_cached(
naming::gid_type const& gid
, naming::address& addr
, error_code& ec
)
{
return naming::get_agas_client().is_local_address_cached(gid, addr, ec);
}
bool is_local_lva_encoded_address(
naming::gid_type const& gid
)
{
return naming::get_agas_client().is_local_lva_encoded_address(gid.get_msb());
}
///////////////////////////////////////////////////////////////////////////////
hpx::future<naming::address> resolve(
naming::id_type const& id
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.resolve_async(id);
}
naming::address resolve(
launch::sync_policy
, naming::id_type const& id
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.resolve_async(id).get(ec);
}
hpx::future<bool> bind(
naming::gid_type const& gid
, naming::address const& addr
, std::uint32_t locality_id
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.bind_async(gid, addr, locality_id);
}
bool bind(
launch::sync_policy
, naming::gid_type const& gid
, naming::address const& addr
, std::uint32_t locality_id
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.bind_async(gid, addr, locality_id).get(ec);
}
hpx::future<bool> bind(
naming::gid_type const& gid
, naming::address const& addr
, naming::gid_type const& locality_
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.bind_async(gid, addr, locality_);
}
bool bind(
launch::sync_policy
, naming::gid_type const& gid
, naming::address const& addr
, naming::gid_type const& locality_
, error_code& ec
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.bind_async(gid, addr, locality_).get(ec);
}
hpx::future<naming::address> unbind(
naming::gid_type const& id, std::uint64_t /* count */
)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.unbind_range_async(id);
}
naming::address unbind(launch::sync_policy, naming::gid_type const& id,
std::uint64_t /* count */
,
error_code& ec)
{
naming::resolver_client& agas_ = naming::get_agas_client();
return agas_.unbind_range_async(id).get(ec);
}
///////////////////////////////////////////////////////////////////////////////
void garbage_collect_non_blocking(
error_code& ec
)
{
naming::get_agas_client().garbage_collect_non_blocking(ec);
}
void garbage_collect(
error_code& ec
)
{
naming::get_agas_client().garbage_collect(ec);
}
/// \brief Invoke an asynchronous garbage collection step on the given target
/// locality.
void garbage_collect_non_blocking(
naming::id_type const& id
, error_code& ec
)
{
try {
components::stubs::runtime_support::garbage_collect_non_blocking(id);
}
catch (hpx::exception const& e) {
if (&ec == &throws)
throw;
ec = make_error_code(e.get_error(), e.what());
}
}
/// \brief Invoke a synchronous garbage collection step on the given target
/// locality.
void garbage_collect(
naming::id_type const& id
, error_code& ec
)
{
try {
components::stubs::runtime_support::garbage_collect(id);
}
catch (hpx::exception const& e) {
if (&ec == &throws)
throw;
ec = make_error_code(e.get_error(), e.what());
}
}
/// \brief Return an id_type referring to the console locality.
naming::id_type get_console_locality(
error_code& ec
)
{
runtime_distributed* rtd = get_runtime_distributed_ptr();
if (rtd == nullptr || rtd->get_state() == state_invalid)
return naming::invalid_id;
naming::gid_type console;
naming::get_agas_client().get_console_locality(console, ec);
if (ec) return naming::invalid_id;
return naming::id_type(console, naming::id_type::unmanaged);
}
std::uint32_t get_locality_id(error_code& ec)
{
runtime_distributed* rtd = get_runtime_distributed_ptr();
if (rtd == nullptr || rtd->get_state() == state_invalid)
return naming::invalid_locality_id;
naming::gid_type l = naming::get_agas_client().get_local_locality(ec);
return l ? naming::get_locality_id_from_gid(l) : naming::invalid_locality_id;
}
///////////////////////////////////////////////////////////////////////////////
naming::gid_type get_next_id(
std::size_t count
, error_code& ec
)
{
runtime_distributed* rtd = get_runtime_distributed_ptr();
if (rtd == nullptr)
{
HPX_THROWS_IF(ec, invalid_status,
"get_next_id", "the runtime system has not been started yet.");
return naming::invalid_gid;
}
// during bootstrap we use the id pool
if (rtd->get_state() == state_invalid)
{
return rtd->get_id_pool().get_id(count);
}
naming::resolver_client& agas_ = naming::get_agas_client();
naming::gid_type lower_bound, upper_bound;
agas_.get_id_range(count, lower_bound, upper_bound, ec);
if (ec) return naming::invalid_gid;
return lower_bound;
}
///////////////////////////////////////////////////////////////////////////////
void decref(
naming::gid_type const& gid
, std::int64_t credits
, error_code& ec
)
{
naming::resolver_client& resolver = naming::get_agas_client();
resolver.decref(gid, credits, ec);
}
///////////////////////////////////////////////////////////////////////////////
hpx::future<std::int64_t> incref(
naming::gid_type const& gid
, std::int64_t credits
, naming::id_type const& keep_alive_
)
{
HPX_ASSERT(!naming::detail::is_locked(gid));
naming::resolver_client& resolver = naming::get_agas_client();
if (keep_alive_)
return resolver.incref_async(gid, credits, keep_alive_);
naming::id_type keep_alive = naming::id_type(gid, id_type::unmanaged);
return resolver.incref_async(gid, credits, keep_alive);
}
std::int64_t incref(
launch::sync_policy, naming::gid_type const& gid, std::int64_t credits,
naming::id_type const& keep_alive_, error_code& /* ec */
)
{
HPX_ASSERT(!naming::detail::is_locked(gid));
naming::resolver_client& resolver = naming::get_agas_client();
if (keep_alive_)
return resolver.incref_async(gid, credits, keep_alive_).get();
naming::id_type keep_alive = naming::id_type(gid, id_type::unmanaged);
return resolver.incref_async(gid, credits, keep_alive).get();
}
///////////////////////////////////////////////////////////////////////////////
hpx::future<naming::id_type> get_colocation_id(
naming::id_type const& id)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.get_colocation_id_async(id);
}
naming::id_type get_colocation_id(
launch::sync_policy
, naming::id_type const& id
, error_code& ec)
{
return get_colocation_id(id).get(ec);
}
///////////////////////////////////////////////////////////////////////////////
hpx::future<hpx::id_type> on_symbol_namespace_event(
std::string const& name, bool call_for_past_events)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.on_symbol_namespace_event(name, call_for_past_events);
}
///////////////////////////////////////////////////////////////////////////////
hpx::future<std::pair<naming::id_type, naming::address>>
begin_migration(naming::id_type const& id)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.begin_migration(id);
}
bool end_migration(naming::id_type const& id)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.end_migration(id);
}
hpx::future<void> mark_as_migrated(naming::gid_type const& gid,
util::unique_function_nonser<std::pair<bool, hpx::future<void> >()> && f,
bool expect_to_be_marked_as_migrating)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.mark_as_migrated(
gid, std::move(f), expect_to_be_marked_as_migrating);
}
std::pair<bool, components::pinned_ptr>
was_object_migrated(naming::gid_type const& gid,
util::unique_function_nonser<components::pinned_ptr()> && f)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.was_object_migrated(gid, std::move(f));
}
void unmark_as_migrated(naming::gid_type const& gid)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.unmark_as_migrated(gid);
}
hpx::future<symbol_namespace::iterate_names_return_type> find_symbols(
std::string const& pattern)
{
naming::resolver_client& resolver = naming::get_agas_client();
return resolver.iterate_ids(pattern);
}
symbol_namespace::iterate_names_return_type find_symbols(
hpx::launch::sync_policy, std::string const& pattern)
{
return find_symbols(pattern).get();
}
}}
|
/****************************************************************************************
* @author: JU_AAA: aniks2645, kzvd4729, prdx9_abir created: Sep/18/2017 23:01
* solution_verdict: Time limit exceeded on test 15 language: GNU C++14
* run_time: 5000 ms memory_used: 2700 KB
* problem: https://codeforces.com/contest/847/problem/I
****************************************************************************************/
#include<bits/stdc++.h>
using namespace std;
int x[]= {-1,0,1,0};
int y[]= {0,1,0,-1};
int n,m,p,q,i,j,k,px,py,rslt,rsltval[255][255],vis[255][255],val[255][255];
char ara[255][255];
queue<pair<int,int> >qu;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n>>m>>q>>p;
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
cin>>ara[i][j];
}
}
memset(rsltval,0,sizeof(rsltval));
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
if(ara[i][j]>='A'&&ara[i][j]<='Z')
{
memset(vis,0,sizeof(vis));
memset(val,0,sizeof(val));
qu.push(make_pair(i,j));
vis[i][j]=1;
val[i][j]=(ara[i][j]-'A'+1)*q;
rsltval[i][j]+=val[i][j];
while(!qu.empty())
{
pair<int,int>u=qu.front();
qu.pop();
for(k=0; k<4; k++)
{
px=u.first+x[k];
py=u.second+y[k];
if(px>=0&&px<n&&py>=0&&py<m&&ara[px][py]!='*')
if(vis[px][py]==0)
{
qu.push(make_pair(px,py));
vis[px][py]=1;
val[px][py]=val[u.first][u.second]/2;
rsltval[px][py]+=val[px][py];
}
}
}
}
}
}
rslt=0;
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
if(rsltval[i][j]>p)rslt++;
}
}
cout<<rslt<<endl;
return 0;
}
|
/*
* Copyright (c) 2011 Derek Buitenhuis
*
* This file is part of FFmpeg.
*
* FFmpeg 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 of the License.
*
* 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
* General Public License for more details.
*
* You should have received a copy of the GNU 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
*/
/**
* @file
* Known FOURCCs:
* 'ULY0' (YCbCr 4:2:0), 'ULY2' (YCbCr 4:2:2), 'ULRG' (RGB), 'ULRA' (RGBA)
*/
extern "C" {
#include "avcodec.h"
}
#include "libutvideo.h"
#include "get_bits.h"
static av_cold int utvideo_decode_init(AVCodecContext *avctx)
{
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
UtVideoExtra info;
int format;
int begin_ret;
if (avctx->extradata_size != 4*4) {
av_log(avctx, AV_LOG_ERROR, "Extradata size mismatch.\n");
return -1;
}
/* Read extradata */
info.version = AV_RL32(avctx->extradata);
info.original_format = AV_RL32(avctx->extradata + 4);
info.frameinfo_size = AV_RL32(avctx->extradata + 8);
info.flags = AV_RL32(avctx->extradata + 12);
/* Pick format based on FOURCC */
switch (avctx->codec_tag) {
case MKTAG('U', 'L', 'Y', '0'):
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
format = UTVF_YV12;
break;
case MKTAG('U', 'L', 'Y', '2'):
avctx->pix_fmt = AV_PIX_FMT_YUYV422;
format = UTVF_YUY2;
break;
case MKTAG('U', 'L', 'R', 'G'):
avctx->pix_fmt = AV_PIX_FMT_BGR24;
format = UTVF_RGB24_WIN;
break;
case MKTAG('U', 'L', 'R', 'A'):
avctx->pix_fmt = AV_PIX_FMT_RGB32;
format = UTVF_RGB32_WIN;
break;
default:
av_log(avctx, AV_LOG_ERROR,
"Not a Ut Video FOURCC: %X\n", avctx->codec_tag);
return -1;
}
/* Only allocate the buffer once */
utv->buf_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
utv->buffer = (uint8_t *)av_malloc(utv->buf_size * sizeof(uint8_t));
if (utv->buffer == NULL) {
av_log(avctx, AV_LOG_ERROR, "Unable to allocate output buffer.\n");
return -1;
}
/* Allocate the output frame */
avctx->coded_frame = avcodec_alloc_frame();
/* Ut Video only supports 8-bit */
avctx->bits_per_raw_sample = 8;
/* Is it interlaced? */
avctx->coded_frame->interlaced_frame = info.flags & 0x800 ? 1 : 0;
/* Apparently Ut Video doesn't store this info... */
avctx->coded_frame->top_field_first = 1;
/*
* Create a Ut Video instance. Since the function wants
* an "interface name" string, pass it the name of the lib.
*/
utv->codec = CCodec::CreateInstance(UNFCC(avctx->codec_tag), "libavcodec");
/* Initialize Decoding */
begin_ret = utv->codec->DecodeBegin(format, avctx->width, avctx->height,
CBGROSSWIDTH_WINDOWS, &info, sizeof(UtVideoExtra));
/* Check to see if the decoder initlized properly */
if (begin_ret != 0) {
av_log(avctx, AV_LOG_ERROR,
"Could not initialize decoder: %d\n", begin_ret);
return -1;
}
return 0;
}
static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
AVFrame *pic = avctx->coded_frame;
int w = avctx->width, h = avctx->height;
/* Set flags */
pic->reference = 0;
pic->pict_type = AV_PICTURE_TYPE_I;
pic->key_frame = 1;
/* Decode the frame */
utv->codec->DecodeFrame(utv->buffer, avpkt->data, true);
/* Set the output data depending on the colorspace */
switch (avctx->pix_fmt) {
case AV_PIX_FMT_YUV420P:
pic->linesize[0] = w;
pic->linesize[1] = pic->linesize[2] = w / 2;
pic->data[0] = utv->buffer;
pic->data[2] = utv->buffer + (w * h);
pic->data[1] = pic->data[2] + (w * h / 4);
break;
case AV_PIX_FMT_YUYV422:
pic->linesize[0] = w * 2;
pic->data[0] = utv->buffer;
break;
case AV_PIX_FMT_BGR24:
case AV_PIX_FMT_RGB32:
/* Make the linesize negative, since Ut Video uses bottom-up BGR */
pic->linesize[0] = -1 * w * (avctx->pix_fmt == AV_PIX_FMT_BGR24 ? 3 : 4);
pic->data[0] = utv->buffer + utv->buf_size + pic->linesize[0];
break;
}
*got_frame = 1;
*(AVFrame *)data = *pic;
return avpkt->size;
}
static av_cold int utvideo_decode_close(AVCodecContext *avctx)
{
UtVideoContext *utv = (UtVideoContext *)avctx->priv_data;
/* Free output */
av_freep(&avctx->coded_frame);
av_freep(&utv->buffer);
/* Finish decoding and clean up the instance */
utv->codec->DecodeEnd();
CCodec::DeleteInstance(utv->codec);
return 0;
}
AVCodec ff_libutvideo_decoder = {
"libutvideo",
NULL_IF_CONFIG_SMALL("Ut Video"),
AVMEDIA_TYPE_VIDEO,
AV_CODEC_ID_UTVIDEO,
0, //capabilities
NULL, //supported_framerates
NULL, //pix_fmts
NULL, //supported_samplerates
NULL, //sample_fmts
NULL, //channel_layouts
0, //max_lowres
NULL, //priv_class
NULL, //profiles
sizeof(UtVideoContext),
NULL, //next
NULL, //init_thread_copy
NULL, //update_thread_context
NULL, //defaults
NULL, //init_static_data
utvideo_decode_init,
NULL, //encode
NULL, //encode2
utvideo_decode_frame,
utvideo_decode_close,
};
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include <usGetModuleContext.h>
#include <usModule.h>
#include <usModuleActivator.h>
#include <usModuleContext.h>
#include "mitkLabelSetImageIO.h"
namespace mitk
{
/**
\brief Registers services for multilabel module.
*/
class MultilabelIOModuleActivator : public us::ModuleActivator
{
std::vector<AbstractFileIO *> m_FileIOs;
public:
void Load(us::ModuleContext * /*context*/) override
{
m_FileIOs.push_back(new LabelSetImageIO());
}
void Unload(us::ModuleContext *) override
{
for (auto &elem : m_FileIOs)
{
delete elem;
}
}
};
}
US_EXPORT_MODULE_ACTIVATOR(mitk::MultilabelIOModuleActivator)
|
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// GambleKit Copyright (C) 2014 Ivan Donev
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// contact: gamblekit@gmail.com
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#include "GkGameWinningPotentialsAnalyzer.h"
GkGameWinningPotentialsAnalyzer::GkGameWinningPotentialsAnalyzer(GkGameWinningsModel *model)
: GkGameWinningsAnalyzer(model)
{
}
GkGameWinningPotentialsAnalyzer::~GkGameWinningPotentialsAnalyzer(void)
{
}
GameWinning GkGameWinningPotentialsAnalyzer::GetSymbolWinning(int symbolIndex, int lineIndex)
{
GameWinning reelItem;
reelItem.symbolIndex = symbolIndex;
reelItem.lineIndex = lineIndex;
reelItem.numItems = 0;
reelItem.itemsStart = 0;
GameWinning result = reelItem;
GameWinningSymbolModel *symbolModel = this->model->GetSymbolModel(symbolIndex);
bool interrupted = false;
for (int reelIndex = 0; reelIndex < this->numReels; reelIndex++)
{
int reelSymbolIndex = this->GetLineSymbol(reelIndex, lineIndex);
GameWinningSymbolModel *reelSymbolModel = this->model->GetSymbolModel(reelSymbolIndex);
bool match = GkGameWinningsAnalyzer::SymbolsMatch(symbolIndex, reelSymbolIndex);
if (match || !interrupted)
{
if (reelItem.numItems == 0)
{
reelItem.itemsStart = reelIndex;
reelItem.symbolsFlags = GkGameWinningsModel::SymbolFlag_None;
}
reelItem.numItems++;
reelItem.symbolsFlags |= reelSymbolModel->flags;
if (reelItem.numItems > result.numItems)
{
result = reelItem;
}
if (!match)
interrupted = true;
}
else
{
if ((symbolModel->flags & GkGameWinningsModel::SymbolFlag_AnyPlace) == 0)
break;
reelItem.numItems = 0;
interrupted = false;
}
}
result.itemsEnd = result.itemsStart + result.numItems - 1;
result.winningCoefficient = this->model->GetSymbolCoefficient(result.symbolIndex, result.numItems);
return result;
}
GameWinning GkGameWinningPotentialsAnalyzer::GetScatterWinning(int symbolIndex)
{
GameWinning result = GkGameWinningsAnalyzer::GetScatterWinning(symbolIndex);
if (result.numItems < this->numReels - 1)
{
result.numItems++;
result.winningCoefficient = this->model->GetSymbolCoefficient(result.symbolIndex, result.numItems);
}
return result;
}
bool GkGameWinningPotentialsAnalyzer::ReelBelongsToWinningAndSymbol(int reelIndex, int winningIndex)
{
if (!GkGameWinningsAnalyzer::ReelBelongsToWinning(reelIndex, winningIndex))
return false;
return this->SymbolsMatch(this->winnings.win[winningIndex].symbolIndex, this->GetLineSymbol(reelIndex, this->winnings.win[winningIndex].lineIndex));
}
bool GkGameWinningPotentialsAnalyzer::ContainsActualWin(int winningIndex)
{
if ((winningIndex < 0) || (winningIndex >= this->winnings.count))
return false;
int actualSequenceLength = 0;
for (int reelIndex = this->winnings.win[winningIndex].itemsStart; reelIndex <= this->winnings.win[winningIndex].itemsEnd; reelIndex++)
{
if (this->ReelBelongsToWinningAndSymbol(reelIndex, winningIndex))
actualSequenceLength++;
else
break;
}
return this->model->GetSymbolCoefficient(this->winnings.win[winningIndex].symbolIndex, actualSequenceLength) != 0;
}
|
// Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "askpassphrasedialog.h"
#include "ui_askpassphrasedialog.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "walletmodel.h"
#include "allocators.h"
#include <QKeyEvent>
#include <QMessageBox>
#include <QPushButton>
AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget* parent, WalletModel* model) : QDialog(parent),
ui(new Ui::AskPassphraseDialog),
mode(mode),
model(model),
fCapsLock(false)
{
ui->setupUi(this);
this->setStyleSheet(GUIUtil::loadStyleSheet());
ui->passEdit1->setMinimumSize(ui->passEdit1->sizeHint());
ui->passEdit2->setMinimumSize(ui->passEdit2->sizeHint());
ui->passEdit3->setMinimumSize(ui->passEdit3->sizeHint());
ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE);
ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE);
ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE);
// Setup Caps Lock detection.
ui->passEdit1->installEventFilter(this);
ui->passEdit2->installEventFilter(this);
ui->passEdit3->installEventFilter(this);
this->model = model;
switch (mode) {
case Encrypt: // Ask passphrase x2
ui->warningLabel->setText(tr("Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>."));
ui->passLabel1->hide();
ui->passEdit1->hide();
setWindowTitle(tr("Encrypt wallet"));
break;
case UnlockStaking:
ui->stakingCheckBox->setChecked(true);
ui->stakingCheckBox->show();
case Unlock: // Ask passphrase
ui->warningLabel->setText(tr("This operation needs your wallet passphrase to unlock the wallet."));
ui->passLabel2->hide();
ui->passEdit2->hide();
ui->passLabel3->hide();
ui->passEdit3->hide();
setWindowTitle(tr("Unlock wallet"));
break;
case Decrypt: // Ask passphrase
ui->warningLabel->setText(tr("This operation needs your wallet passphrase to decrypt the wallet."));
ui->passLabel2->hide();
ui->passEdit2->hide();
ui->passLabel3->hide();
ui->passEdit3->hide();
setWindowTitle(tr("Decrypt wallet"));
break;
case ChangePass: // Ask old passphrase + new passphrase x2
setWindowTitle(tr("Change passphrase"));
ui->warningLabel->setText(tr("Enter the old and new passphrase to the wallet."));
break;
}
ui->stakingCheckBox->setChecked(model->isStakingOnlyUnlocked());
textChanged();
connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
}
AskPassphraseDialog::~AskPassphraseDialog()
{
// Attempt to overwrite text so that they do not linger around in memory
ui->passEdit1->setText(QString(" ").repeated(ui->passEdit1->text().size()));
ui->passEdit2->setText(QString(" ").repeated(ui->passEdit2->text().size()));
ui->passEdit3->setText(QString(" ").repeated(ui->passEdit3->text().size()));
delete ui;
}
void AskPassphraseDialog::accept()
{
SecureString oldpass, newpass1, newpass2;
if (!model)
return;
oldpass.reserve(MAX_PASSPHRASE_SIZE);
newpass1.reserve(MAX_PASSPHRASE_SIZE);
newpass2.reserve(MAX_PASSPHRASE_SIZE);
// TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)
// Alternately, find a way to make this input mlock()'d to begin with.
oldpass.assign(ui->passEdit1->text().toStdString().c_str());
newpass1.assign(ui->passEdit2->text().toStdString().c_str());
newpass2.assign(ui->passEdit3->text().toStdString().c_str());
switch (mode) {
case Encrypt: {
if (newpass1.empty() || newpass2.empty()) {
// Cannot encrypt with empty passphrase
break;
}
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR SYX</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);
if (retval == QMessageBox::Yes) {
if (newpass1 == newpass2) {
if (model->setWalletEncrypted(true, newpass1)) {
QMessageBox::warning(this, tr("Wallet encrypted"),
"<qt>" +
tr("SynteX will close now to finish the encryption process. "
"Remember that encrypting your wallet cannot fully protect "
"your SYXs from being stolen by malware infecting your computer.") +
"<br><br><b>" +
tr("IMPORTANT: Any previous backups you have made of your wallet file "
"should be replaced with the newly generated, encrypted wallet file. "
"For security reasons, previous backups of the unencrypted wallet file "
"will become useless as soon as you start using the new, encrypted wallet.") +
"</b></qt>");
QApplication::quit();
} else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
}
QDialog::accept(); // Success
} else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("The supplied passphrases do not match."));
}
} else {
QDialog::reject(); // Cancelled
}
} break;
case UnlockStaking:
case Unlock:
if (!model->setWalletLocked(false, oldpass, ui->stakingCheckBox->isChecked())) {
QMessageBox::critical(this, tr("Wallet unlock failed"),
tr("The passphrase entered for the wallet decryption was incorrect."));
} else {
QDialog::accept(); // Success
}
break;
case Decrypt:
if (!model->setWalletEncrypted(false, oldpass)) {
QMessageBox::critical(this, tr("Wallet decryption failed"),
tr("The passphrase entered for the wallet decryption was incorrect."));
} else {
QDialog::accept(); // Success
}
break;
case ChangePass:
if (newpass1 == newpass2) {
if (model->changePassphrase(oldpass, newpass1)) {
QMessageBox::information(this, tr("Wallet encrypted"),
tr("Wallet passphrase was successfully changed."));
QDialog::accept(); // Success
} else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("The passphrase entered for the wallet decryption was incorrect."));
}
} else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("The supplied passphrases do not match."));
}
break;
}
}
void AskPassphraseDialog::textChanged()
{
// Validate input, set Ok button to enabled when acceptable
bool acceptable = false;
switch (mode) {
case Encrypt: // New passphrase x2
acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
break;
case UnlockStaking: // Old passphrase x1
case Unlock: // Old passphrase x1
case Decrypt:
acceptable = !ui->passEdit1->text().isEmpty();
break;
case ChangePass: // Old passphrase x1, new passphrase x2
acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
break;
}
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(acceptable);
}
bool AskPassphraseDialog::event(QEvent* event)
{
// Detect Caps Lock key press.
if (event->type() == QEvent::KeyPress) {
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
if (ke->key() == Qt::Key_CapsLock) {
fCapsLock = !fCapsLock;
}
if (fCapsLock) {
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
} else {
ui->capsLabel->clear();
}
}
return QWidget::event(event);
}
bool AskPassphraseDialog::eventFilter(QObject* object, QEvent* event)
{
/* Detect Caps Lock.
* There is no good OS-independent way to check a key state in Qt, but we
* can detect Caps Lock by checking for the following condition:
* Shift key is down and the result is a lower case character, or
* Shift key is not down and the result is an upper case character.
*/
if (event->type() == QEvent::KeyPress) {
QKeyEvent* ke = static_cast<QKeyEvent*>(event);
QString str = ke->text();
if (str.length() != 0) {
const QChar* psz = str.unicode();
bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0;
if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) {
fCapsLock = true;
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
} else if (psz->isLetter()) {
fCapsLock = false;
ui->capsLabel->clear();
}
}
}
return QDialog::eventFilter(object, event);
}
|
// AirMap Platform SDK
// Copyright © 2018 AirMap, Inc. 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 <airmap/cmds/airmap/cmd/test.h>
#include <airmap/paths.h>
#include <airmap/cmds/airmap/cmd/test/laanc.phoenix.h>
#include <airmap/util/formatting_logger.h>
#include <signal.h>
namespace cli = airmap::util::cli;
namespace cmd = airmap::cmds::airmap::cmd;
namespace {
constexpr const char* component{"test"};
} // namespace
cmd::Test::Test() : cli::CommandWithFlagsAndAction{"test", "executes runtime tests", "executes runtime tests"} {
flag(flags::version(version_));
flag(flags::log_level(log_level_));
flag(flags::config_file(config_file_));
flag(flags::token_file(token_file_));
flag(cli::make_flag("test-suite", "test suite name", test_suite_));
test_suite_registry_[test::laanc::PhoenixZoo::name] = []() { return std::make_shared<test::laanc::PhoenixZoo>(); };
test_suite_registry_[test::laanc::PhoenixManual::name] = []() {
return std::make_shared<test::laanc::PhoenixManual>();
};
test_suite_registry_[test::laanc::PhoenixSchwegg::name] = []() {
return std::make_shared<test::laanc::PhoenixSchwegg>();
};
test_suite_registry_[test::laanc::PhoenixUniversity::name] = []() {
return std::make_shared<test::laanc::PhoenixUniversity>();
};
test_suite_registry_[test::laanc::KentuckyFlorence::name] = []() {
return std::make_shared<test::laanc::KentuckyFlorence>();
};
test_suite_registry_[test::laanc::NevadaReno::name] = []() { return std::make_shared<test::laanc::NevadaReno>(); };
test_suite_registry_[test::laanc::ArkansasPineBluff::name] = []() {
return std::make_shared<test::laanc::ArkansasPineBluff>();
};
test_suite_registry_[test::laanc::WyomingTetonVillage::name] = []() {
return std::make_shared<test::laanc::WyomingTetonVillage>();
};
action([this](const cli::Command::Context& ctxt) {
log_ = util::FormattingLogger(create_filtering_logger(log_level_, create_default_logger(ctxt.cerr)));
if (!test_suite_ || !test_suite_.get().validate()) {
auto record = log_.error(component);
record.print("missing parameter 'test-suite', choose from:\n");
for (const auto& pair : test_suite_registry_) {
record << " " << pair.first << "\n";
}
return 1;
}
auto it = test_suite_registry_.find(test_suite_.get());
if (it == test_suite_registry_.end()) {
log_.errorf(component, "failed to identify test suite %s", test_suite_.get());
return 1;
}
auto suite = it->second();
if (!config_file_) {
config_file_ = ConfigFile{paths::config_file(version_).string()};
}
if (!token_file_) {
token_file_ = TokenFile{paths::token_file(version_).string()};
}
std::ifstream in_config{config_file_.get()};
if (!in_config) {
log_.errorf(component, "failed to open configuration file %s for reading", config_file_);
return 1;
}
auto config = Client::load_configuration_from_json(in_config);
std::ifstream in_token{token_file_.get()};
if (!in_token) {
log_.errorf(component, "failed to open token file %s for reading", token_file_);
return 1;
}
auto result = ::airmap::Context::create(log_.logger());
if (!result) {
log_.errorf(component, "failed to acquire resources for accessing AirMap services");
return 1;
}
auto context = result.value();
auto token = Token::load_from_json(in_token);
log_.infof(component,
"client configuration:\n"
" host: %s\n"
" version: %s\n"
" telemetry.host: %s\n"
" telemetry.port: %d\n"
" credentials.api_key: %s\n",
config.host, config.version, config.telemetry.host, config.telemetry.port, config.credentials.api_key);
context->create_client_with_configuration(
config, [this, suite, config, token, context](const ::airmap::Context::ClientCreateResult& result) {
if (not result) {
log_.errorf(component, "failed to create client: %s", result.error());
context->stop(::airmap::Context::ReturnCode::error);
return;
}
suite->run(log_.logger(), result.value(), context, token);
});
return context->exec({SIGINT, SIGQUIT},
[this, context](int sig) {
log_.infof(component, "received [%s], shutting down", ::strsignal(sig));
context->stop();
}) == ::airmap::Context::ReturnCode::success
? 0
: 1;
});
}
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ShrubberyCreationForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ioleinik <ioleinik@student.42wolfsburg.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/24 07:40:15 by ioleinik #+# #+# */
/* Updated: 2021/11/24 09:56:09 by ioleinik ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef SHRUBBERYCREATIONFORM_HPP
#define SHRUBBERYCREATIONFORM_HPP
#include <iostream>
#include <string>
#include "Form.hpp"
class ShrubberyCreationForm
: public Form
{
public:
ShrubberyCreationForm();
ShrubberyCreationForm(std::string const _target);
ShrubberyCreationForm(ShrubberyCreationForm const &src);
~ShrubberyCreationForm();
ShrubberyCreationForm &operator=(ShrubberyCreationForm const &rhs);
void execute(Bureaucrat const &executor) const;
const std::string &getTarget() const;
private:
std::string _target;
};
std::ostream &operator<<(std::ostream &o, ShrubberyCreationForm const &i);
#endif /* ******************************************* SHRUBBERYCREATIONFORM_H */
|
#pragma once
#ifndef GLC_ERROR_HPP
#define GLC_ERROR_HPP
#include <stdexcept>
#include <string>
#include <vector>
namespace glc {
class MalformedShaderName : public std::runtime_error
{
public:
explicit MalformedShaderName(const std::string& path);
};
class MalformedShaderText : public std::runtime_error
{
public:
explicit MalformedShaderText(const std::string& path, const std::string& msg);
};
class MalformedShader : public std::runtime_error
{
public:
explicit MalformedShader(const std::string& msg);
};
class MalformedFilePath : public std::runtime_error
{
public:
explicit MalformedFilePath(const std::string& path);
};
class MalformedModel : public std::runtime_error
{
public:
explicit MalformedModel(const std::string& path, const std::string& msg);
};
class MalformedUniform : public std::runtime_error
{
public:
explicit MalformedUniform(
const std::vector<std::string>& paths,
const std::string& name);
};
}
#endif
|
#include <qt/qvalidatedspinbox.h>
#include <qt/guiconstants.h>
#include <qt/skinize.h>
#include <QDialog>
QValidatedSpinBox::QValidatedSpinBox(QDialog *parent) :
QSpinBox(parent),
valid(true)
{
connect(this, SIGNAL(textChanged(QString)), this, SLOT(markValid()));
}
void QValidatedSpinBox::setValid(bool valid)
{
if(valid == this->valid)
{
return;
}
if(valid)
{
setStyleSheet(Skinize());
}
else
{
setStyleSheet(STYLE_INVALID);
}
this->valid = valid;
}
void QValidatedSpinBox::focusInEvent(QFocusEvent *evt)
{
// Clear invalid flag on focus
setValid(true);
Q_EMIT clickedSpinBox();
QSpinBox::focusInEvent(evt);
}
void QValidatedSpinBox::markValid()
{
// As long as a user is typing ensure we display state as valid
setValid(true);
}
void QValidatedSpinBox::clear()
{
setValid(true);
QSpinBox::clear();
}
|
/*
Copyright (c) 2016 Xavier Leclercq
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.
*/
#include "State/RecentWorkspaces.h"
#include "CodeSmithy/Core/Utilities/XMLUtilities.h"
namespace CodeSmithy
{
static const char* workspaceElementName = "workspace";
RecentWorkspaces::RecentWorkspaces()
{
}
RecentWorkspaces::~RecentWorkspaces()
{
}
size_t RecentWorkspaces::size() const
{
return m_workspaces.size();
}
const std::string& RecentWorkspaces::operator[](size_t index) const
{
return m_workspaces[index];
}
void RecentWorkspaces::set(const std::string& filePath)
{
for (size_t i = 0; i < m_workspaces.size(); ++i)
{
if (m_workspaces[i] == filePath)
{
m_workspaces.erase(m_workspaces.begin() + i);
break;
}
}
m_workspaces.push_back(filePath);
}
void RecentWorkspaces::load(pugi::xml_node node)
{
for (pugi::xml_node workspaceNode = node.child(workspaceElementName);
workspaceNode != 0;
workspaceNode = workspaceNode.next_sibling(workspaceElementName))
{
m_workspaces.push_back(workspaceNode.child_value());
}
}
void RecentWorkspaces::save(pugi::xml_node node) const
{
while (node.remove_child(workspaceElementName))
{
}
for (size_t i = 0; i < m_workspaces.size(); ++i)
{
XMLUtilities::appendChildNode(node, workspaceElementName, m_workspaces[i]);
}
}
}
|
// sol3
// The MIT License (MIT)
// Copyright (c) 2013-2019 Rapptz, ThePhD and contributors
// 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.
#include "sol_defines.hpp"
//#include <sol/stack_get.hpp>
#include <sol/stack.hpp>
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/web_exposed_isolation_info.h"
#include "base/test/gtest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
namespace content {
using WebExposedIsolationInfoTest = testing::Test;
TEST_F(WebExposedIsolationInfoTest, NonIsolated) {
WebExposedIsolationInfo info = WebExposedIsolationInfo::CreateNonIsolated();
EXPECT_FALSE(info.is_isolated());
EXPECT_FALSE(info.is_isolated_application());
ASSERT_DCHECK_DEATH(info.origin());
}
TEST_F(WebExposedIsolationInfoTest, Isolated) {
url::Origin origin =
url::Origin::CreateFromNormalizedTuple("https", "example.com", 443);
WebExposedIsolationInfo info =
WebExposedIsolationInfo::CreateIsolated(origin);
EXPECT_TRUE(info.is_isolated());
EXPECT_FALSE(info.is_isolated_application());
EXPECT_EQ(origin, info.origin());
}
TEST_F(WebExposedIsolationInfoTest, IsolatedApplication) {
url::Origin origin =
url::Origin::CreateFromNormalizedTuple("https", "example.com", 443);
WebExposedIsolationInfo info =
WebExposedIsolationInfo::CreateIsolatedApplication(origin);
EXPECT_TRUE(info.is_isolated());
EXPECT_TRUE(info.is_isolated_application());
EXPECT_EQ(origin, info.origin());
}
TEST_F(WebExposedIsolationInfoTest, Comparisons) {
WebExposedIsolationInfo nonA = WebExposedIsolationInfo::CreateNonIsolated();
WebExposedIsolationInfo nonB = WebExposedIsolationInfo::CreateNonIsolated();
// All non-isolated COII are equivalennt.
EXPECT_EQ(nonA, nonA);
EXPECT_EQ(nonA, nonB);
EXPECT_EQ(nonB, nonA);
EXPECT_FALSE(nonA < nonB);
EXPECT_FALSE(nonB < nonA);
url::Origin originA =
url::Origin::CreateFromNormalizedTuple("https", "aaa.example", 443);
url::Origin originB =
url::Origin::CreateFromNormalizedTuple("https", "bbb.example", 443);
WebExposedIsolationInfo isolatedA =
WebExposedIsolationInfo::CreateIsolated(originA);
WebExposedIsolationInfo isolatedB =
WebExposedIsolationInfo::CreateIsolated(originB);
// Isolated == self.
EXPECT_EQ(isolatedA, isolatedA);
// Non-isolated COII are < isolated COII (note that WebExposedIsolationInfo
// only implements <, so we can't use EXPECT_GT here and below).
EXPECT_LT(nonA, isolatedA);
EXPECT_FALSE(isolatedA < nonA);
// Origin comparison for isolated < isolated
EXPECT_LT(isolatedA, isolatedB);
EXPECT_FALSE(isolatedB < isolatedA);
WebExposedIsolationInfo appA =
WebExposedIsolationInfo::CreateIsolatedApplication(originA);
WebExposedIsolationInfo appB =
WebExposedIsolationInfo::CreateIsolatedApplication(originB);
// Isolated app == self.
EXPECT_EQ(appA, appA);
// Non-isolated COII are < isolated app COII.
EXPECT_LT(nonA, appA);
EXPECT_FALSE(appA < nonA);
// Non-isolated COII are < isolated app COII.
EXPECT_LT(isolatedA, appA);
EXPECT_FALSE(appA < isolatedA);
// Origin comparison for isolated app < isolated app
EXPECT_LT(appA, appB);
EXPECT_FALSE(appB < appA);
}
} // namespace content
|
#include <ctime>
#include <cstdio>
#include <cstdarg>
#include <cstdint>
#include <memory>
#include "Chunk.h"
#include "Value.h"
#include "Object.h"
#include "VirtualMachine.h"
namespace lox
{
namespace vm
{
static val::Value
ClockNative(
[[maybe_unused]]int arg_count,
[[maybe_unused]]val::Value* args)
{
return val::NumberVal(static_cast<double>(clock()) / CLOCKS_PER_SEC);
}
void
VirtualMachine::RuntimeError(const char* format, ...)
{
va_list args;
va_start(args, format);
std::vfprintf(stderr, format, args);
va_end(args);
std::fputs("\n", stderr);
for (int i = frame_count - 1; i >= 0; --i) {
CallFrame* frame = &frames_[i];
std::shared_ptr<obj::ObjFunction> function = frame->closure->function;
std::size_t instruction = frame->ip - 1;
std::fprintf(stderr, "[line %d] in ",
function->chunk.GetLines()[instruction]);
if (!function->name)
std::fprintf(stderr, "script\n");
else
std::fprintf(stderr, "%s()\n", function->name->chars.c_str());
}
ResetStack();
}
bool
VirtualMachine::Call(std::shared_ptr<obj::ObjClosure> closure, int arg_count)
{
if (arg_count != closure->function->arity) {
RuntimeError("Expected %d arguments but got %d.",
closure->function->arity, arg_count);
return false;
}
if (frame_count == kFramesMax) {
RuntimeError("Stack overflow.");
return false;
}
CallFrame* frame = &frames_[frame_count++];
frame->closure = closure;
frame->ip = 0;
frame->slots = vm_stack.stack_top - arg_count - 1;
return true;
}
bool
VirtualMachine::CallValue(const val::Value& callee, int arg_count)
{
if (obj::IsObject(callee)) {
switch (obj::GetType(callee)) {
case obj::ObjType::kObjClosure:
return Call(obj::AsClosure(callee), arg_count);
break;
case obj::ObjType::kObjNative: {
obj::NativeFn native = obj::AsNative(callee);
val::Value result = native(arg_count,
vm_stack.stack_top - arg_count);
vm_stack.stack_top -= arg_count + 1;
Push(result);
return true;
break;
}
case obj::ObjType::kObjClass: {
std::shared_ptr<obj::ObjClass> klass = obj::AsClass(callee);
vm_stack.stack_top[-arg_count - 1] =
obj::ObjVal(obj::NewInstance(klass));
if (klass->methods.find(init_string_) != klass->methods.end()) {
return Call(obj::AsClosure(klass->methods[init_string_]),
arg_count);
} else if (arg_count != 0) {
RuntimeError("Expected 0 arguments but got %d.",
arg_count);
return false;
}
return true;
break;
}
case obj::ObjType::kObjBoundMethod: {
std::shared_ptr<obj::ObjBoundMethod> bound =
obj::AsBoundMethod(callee);
vm_stack.stack_top[-arg_count - 1] = bound->receiver;
return Call(bound->method, arg_count);
}
default:
/* Non-callable object type. */
break;
}
}
RuntimeError("Can only call functions and classes.");
return false;
}
uint16_t
VirtualMachine::ReadShort(CallFrame* frame)
{
frame->ip += 2;
return ((frame->closure->function->chunk.GetInstruction(frame->ip - 2) << 8) |
frame->closure->function->chunk.GetInstruction(frame->ip - 1));
}
void
VirtualMachine::Concatenate()
{
LoxString b = obj::AsString(Pop());
LoxString a = obj::AsString(Pop());
LoxString result = std::make_shared<obj::ObjString>();
result->type = obj::ObjType::kObjString;
result->chars = a->chars + b->chars;
Push(ObjVal(result));
}
void
VirtualMachine::DefineNative(const std::string& name, obj::NativeFn function)
{
Push(obj::ObjVal(obj::CopyString(name, interned_strs_)));
Push(obj::ObjVal(obj::NewNative(function)));
globals_[obj::AsString(vm_stack.stack[0])] = vm_stack.stack[1];
Pop();
Pop();
}
void
VirtualMachine::DefineMethod(LoxString name)
{
val::Value method = Peek(0);
std::shared_ptr<obj::ObjClass> klass = obj::AsClass(Peek(1));
klass->methods[name] = method;
Pop();
}
bool
VirtualMachine::BindMethod(
std::shared_ptr<obj::ObjClass> klass,
LoxString name)
{
if (klass->methods.find(name) == klass->methods.end()) {
RuntimeError("Undefined property '%s'.", name->chars.c_str());
return false;
}
std::shared_ptr<obj::ObjBoundMethod> bound =
obj::NewBoundMethod(Peek(0), obj::AsClosure(klass->methods[name]));
Pop();
Push(obj::ObjVal(bound));
return true;
}
bool
VirtualMachine::InvokeFromClass(
std::shared_ptr<obj::ObjClass> klass,
LoxString name,
int arg_count)
{
if (klass->methods.find(name) == klass->methods.end()) {
RuntimeError("Undefined property '%s'.", name->chars.c_str());
return false;
}
return Call(obj::AsClosure(klass->methods[name]), arg_count);
}
bool
VirtualMachine::Invoke(LoxString name, int arg_count)
{
val::Value receiver = Peek(arg_count);
if (!obj::IsInstance(receiver)) {
RuntimeError("Only instances have methods.");
return false;
}
std::shared_ptr<obj::ObjInstance> instance = obj::AsInstance(receiver);
if (instance->fields.find(name) != instance->fields.end()) {
vm_stack.stack_top[-arg_count - 1] = instance->fields[name];
return CallValue(instance->fields[name], arg_count);
}
return InvokeFromClass(instance->klass, name, arg_count);
}
void
VirtualMachine::CloseUpvalues(val::Value* last)
{
while (open_upvalues_ && (open_upvalues_->location >= last)) {
UpvaluePtr upvalue = open_upvalues_;
upvalue->closed = *upvalue->location;
upvalue->location = &upvalue->closed;
open_upvalues_ = upvalue->next;
}
}
std::shared_ptr<obj::ObjUpvalue>
VirtualMachine::CaptureUpvalue(val::Value* local)
{
UpvaluePtr prev_upvalue = nullptr;
UpvaluePtr upvalue = open_upvalues_;
while (upvalue && (upvalue->location > local)) {
prev_upvalue = upvalue;
upvalue = upvalue->next;
}
if (upvalue && (upvalue->location == local))
return upvalue;
UpvaluePtr created_upvalue = obj::NewUpvalue(local);
created_upvalue->next = upvalue;
if (!prev_upvalue)
open_upvalues_ = created_upvalue;
else
prev_upvalue->next = created_upvalue;
return created_upvalue;
}
VirtualMachine::InterpretResult
VirtualMachine::Run()
{
CallFrame* frame = &frames_[frame_count - 1];
while (true) {
#ifdef DEBUG_TRACE_EXECUTION
PrintStack();
frame->closure->function->chunk.Disassemble(frame->ip);
#endif
uint8_t instruction = ReadByte(frame);
switch (instruction) {
case Chunk::OpCode::kOpConstant:
Push(ReadConstant(frame));
break;
case Chunk::OpCode::kOpNil:
Push(val::NilVal());
break;
case Chunk::OpCode::kOpTrue:
Push(val::BoolVal(true));
break;
case Chunk::OpCode::kOpFalse:
Push(val::BoolVal(false));
break;
case Chunk::OpCode::KOpEqual: {
val::Value b = Pop();
val::Value a = Pop();
Push(val::BoolVal(val::ValuesEqual(a, b)));
break;
}
case Chunk::OpCode::kOpGreater:
case Chunk::OpCode::kOpLess:
BinaryOp<bool>(val::BoolVal,
static_cast<Chunk::OpCode>(instruction));
break;
case Chunk::OpCode::kOpNot: {
bool is_falsey = IsFalsey(Pop());
Push(val::BoolVal(is_falsey));
break;
}
case Chunk::OpCode::kOpNegate: {
val::Value val = Peek(0);
if (!val::IsNumber(val)) {
RuntimeError("Operand must be a number.");
return InterpretResult::kInterpretRuntimeError;
}
Pop();
Push(val::NumberVal(-val::AsNumber(val)));
break;
}
case Chunk::OpCode::kOpAdd: {
val::Value b = Peek(0);
val::Value a = Peek(1);
if (obj::IsString(a) && obj::IsString(b)) {
Concatenate();
} else if (val::IsNumber(a) && val::IsNumber(b)) {
BinaryOp<double>(val::NumberVal,
static_cast<Chunk::OpCode>(instruction));
} else {
RuntimeError(
"Operands must be two numbers or two strings.");
return InterpretResult::kInterpretRuntimeError;
}
break;
}
case Chunk::OpCode::kOpSubtract:
case Chunk::OpCode::kOpMultiply:
case Chunk::OpCode::kOpDivide:
BinaryOp<double>(val::NumberVal,
static_cast<Chunk::OpCode>(instruction));
break;
case Chunk::OpCode::kOpPrint:
PrintValue(Pop());
std::printf("\n");
break;
case Chunk::OpCode::kOpPop:
Pop();
break;
case Chunk::OpCode::kOpDefineGlobal: {
LoxString name = obj::AsString(ReadConstant(frame));
globals_[name] = Pop();
break;
}
case Chunk::OpCode::kOpGetGlobal: {
LoxString name = obj::AsString(ReadConstant(frame));
if (globals_.find(name) == globals_.end()) {
RuntimeError(
"Undefined variable '%s'.",
name->chars.c_str());
return InterpretResult::kInterpretRuntimeError;
}
Push(globals_[name]);
break;
}
case Chunk::OpCode::kOpSetGlobal: {
LoxString name = obj::AsString(ReadConstant(frame));
if (globals_.find(name) == globals_.end()) {
RuntimeError(
"Undefined variable '%s'.",
name->chars.c_str());
return InterpretResult::kInterpretRuntimeError;
}
globals_[name] = Peek(0);
break;
}
case Chunk::OpCode::kOpGetLocal: {
uint8_t slot = ReadByte(frame);
Push(frame->slots[slot]);
break;
}
case Chunk::OpCode::kOpSetLocal: {
uint8_t slot = ReadByte(frame);
frame->slots[slot] = Peek(0);
break;
}
case Chunk::OpCode::kOpJumpIfFalse: {
uint16_t offset = ReadShort(frame);
if (IsFalsey(Peek(0)))
frame->ip += offset;
break;
}
case Chunk::OpCode::kOpJump: {
uint16_t offset = ReadShort(frame);
frame->ip += offset;
break;
}
case Chunk::OpCode::kOpLoop: {
uint16_t offset = ReadShort(frame);
frame->ip -= offset;
break;
}
case Chunk::OpCode::kOpCall: {
int arg_count = ReadByte(frame);
if (!CallValue(Peek(arg_count), arg_count))
return InterpretResult::kInterpretRuntimeError;
frame = &frames_[frame_count - 1];
break;
}
case Chunk::OpCode::kOpReturn: {
val::Value result = Pop();
CloseUpvalues(frame->slots);
frame_count--;
if (0 == frame_count) {
Pop();
return InterpretResult::kInterpretOk;
}
vm_stack.stack_top = frame->slots;
Push(result);
frame = &frames_[frame_count - 1];
break;
}
case Chunk::OpCode::kOpClosure: {
std::shared_ptr<obj::ObjFunction> function =
obj::AsFunction(ReadConstant(frame));
std::shared_ptr<obj::ObjClosure> closure =
obj::NewClosure(function);
Push(obj::ObjVal(closure));
for (int i = 0; i < closure->upvalue_count; ++i) {
uint8_t is_local = ReadByte(frame);
uint8_t index = ReadByte(frame);
if (is_local) {
closure->upvalues[i] =
CaptureUpvalue(frame->slots + index);
} else {
closure->upvalues[i] = frame->closure->upvalues[index];
}
}
break;
}
case Chunk::OpCode::kOpGetUpvalue: {
uint8_t slot = ReadByte(frame);
Push(*frame->closure->upvalues[slot]->location);
break;
}
case Chunk::OpCode::kOpSetUpvalue: {
uint8_t slot = ReadByte(frame);
*frame->closure->upvalues[slot]->location = Peek(0);
break;
}
case Chunk::OpCode::kOpCloseUpvalue: {
CloseUpvalues(vm_stack.stack_top - 1);
Pop();
break;
}
case Chunk::OpCode::kOpClass: {
LoxString klass_name = ReadString(frame);
Push(obj::ObjVal(obj::NewClass(klass_name)));
break;
}
case Chunk::OpCode::kOpGetProperty: {
if (!obj::IsInstance(Peek(0))) {
RuntimeError("Only instances have properties.");
return InterpretResult::kInterpretRuntimeError;
}
std::shared_ptr<obj::ObjInstance> instance =
obj::AsInstance(Peek(0));
LoxString name =
ReadString(frame);
if (instance->fields.find(name) != instance->fields.end()) {
Pop();
Push(instance->fields[name]);
break;
}
if (!BindMethod(instance->klass, name))
return InterpretResult::kInterpretRuntimeError;
break;
}
case Chunk::OpCode::kOpSetProperty: {
if (!obj::IsInstance(Peek(1))) {
RuntimeError("Only instances have fields.");
return InterpretResult::kInterpretRuntimeError;
}
std::shared_ptr<obj::ObjInstance> instance =
obj::AsInstance(Peek(1));
instance->fields[ReadString(frame)] = Peek(0);
val::Value value = Pop();
Pop();
Push(value);
break;
}
case Chunk::OpCode::kOpInvoke: {
LoxString method = ReadString(frame);
int arg_count = ReadByte(frame);
if (!Invoke(method, arg_count))
return InterpretResult::kInterpretRuntimeError;
frame = &frames_[frame_count - 1];
break;
}
case Chunk::OpCode::kOpMethod:
DefineMethod(ReadString(frame));
break;
case Chunk::OpCode::kOpInherit: {
val::Value superclass = Peek(1);
if (!obj::IsClass(superclass)) {
RuntimeError("Superclass must be a class.");
return InterpretResult::kInterpretRuntimeError;
}
std::shared_ptr<obj::ObjClass> subclass =
obj::AsClass(Peek(0));
for (const auto& kv : obj::AsClass(superclass)->methods)
subclass->methods[kv.first] = kv.second;
Pop();
break;
}
case Chunk::OpCode::kOpGetSuper: {
LoxString name = ReadString(frame);
std::shared_ptr<obj::ObjClass> superclass =
obj::AsClass(Pop());
if (!BindMethod(superclass, name))
return InterpretResult::kInterpretRuntimeError;
break;
}
case Chunk::OpCode::kOpSuperInvoke: {
LoxString method = ReadString(frame);
int arg_count = ReadByte(frame);
std::shared_ptr<obj::ObjClass> superclass =
obj::AsClass(Pop());
if (!InvokeFromClass(superclass, method, arg_count))
return InterpretResult::kInterpretRuntimeError;
frame = &frames_[frame_count - 1];
break;
}
}
}
}
VirtualMachine::VirtualMachine() :
interned_strs_(std::make_shared<LoxStringMap>()),
frame_count(0),
open_upvalues_(nullptr),
init_string_(nullptr)
{
ResetStack();
init_string_ = obj::CopyString("init", interned_strs_);
DefineNative("clock", ClockNative);
}
VirtualMachine::InterpretResult
VirtualMachine::Interpret(
const std::string& source)
{
lox::cl::Compiler compiler;
std::shared_ptr<obj::ObjFunction> function =
compiler.Compile(source, interned_strs_);
if (!function)
return InterpretResult::kInterpretCompileError;
Push(obj::ObjVal(function));
std::shared_ptr<obj::ObjClosure> closure = obj::NewClosure(function);
Pop();
Push(obj::ObjVal(closure));
Call(closure, 0);
return Run();
}
} // end vm
} // end lox
|
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
// <unordered_map>
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
// class Alloc = allocator<pair<const Key, T>>>
// class unordered_map
// unordered_map(size_type n, const hasher& hf);
#include <unordered_map>
#include <cassert>
#include "../../../NotConstructible.h"
#include "../../../test_compare.h"
#include "../../../test_hash.h"
#include "test_allocator.h"
#include "min_allocator.h"
int main()
{
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
test_compare<std::equal_to<NotConstructible> >,
test_allocator<std::pair<const NotConstructible,
NotConstructible> >
> C;
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
assert(c.bucket_count() == 7);
assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
assert(c.get_allocator() ==
(test_allocator<std::pair<const NotConstructible, NotConstructible> >()));
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
#if TEST_STD_VER >= 11
{
typedef std::unordered_map<NotConstructible, NotConstructible,
test_hash<std::hash<NotConstructible> >,
test_compare<std::equal_to<NotConstructible> >,
min_allocator<std::pair<const NotConstructible,
NotConstructible> >
> C;
C c(7,
test_hash<std::hash<NotConstructible> >(8)
);
assert(c.bucket_count() == 7);
assert(c.hash_function() == test_hash<std::hash<NotConstructible> >(8));
assert(c.key_eq() == test_compare<std::equal_to<NotConstructible> >());
assert(c.get_allocator() ==
(min_allocator<std::pair<const NotConstructible, NotConstructible> >()));
assert(c.size() == 0);
assert(c.empty());
assert(std::distance(c.begin(), c.end()) == 0);
assert(c.load_factor() == 0);
assert(c.max_load_factor() == 1);
}
#endif
}
|
//
// Created by xiaofeng on 2019/11/29.
//
//This part of the program is used to detect missing constructor errors,
//which include not adding constructors, or constructor name spelling errors.
//source file
/*
author = __xiaofeng__
*/
//The procedure for detecting missing constructors is as follows:
//step 1:Find each contract head
//step 2:Use bracket matching to determine the scope of the contract body and
// retrieve statements in the contract body
//step 3:If there are two types of sentence below, it is considered that there
// is no such error, otherwise there is.
//statement 1: function ContractName(__pargs__) {
//statement 2: constructor(__pargs__) {
//using head files
#include "MissConstructor.h"
#include <iostream>
//MC_Match's constructor
MC_Match::MC_Match() {
count = 0;
}
//MC_Match's destructor
MC_Match::~MC_Match() {
brackets.clear();
count = 0;
}
//Brackets matching
bool MC_Match::DoMatch(const string& _statement) {
//Useless sentence
if (_statement.find("{") >= _statement.size() && _statement.find("}") >= _statement.size())
return false;
for (char c : _statement) {
if (c == '{') {
brackets.push_back('{');
count++;
}
else if (c == '}') {
brackets.pop_back();
}
}
if (brackets.empty() && count != 0) {
return true;
}
else
return false;
}
string MissConstru::getConName(const string & _str)
{
int right;
int left = _str.find("contract");
left += 8;
while (left < _str.size() && isblank(_str[left]))
left++;
right = left;
while (right < _str.size() && (isalnum(_str[right]) || _str[right] == '_') && _str[right]!= '{')
right++;
return _str.substr(left, right-left);
}
vector<int> MissConstru::getRowNumber()
{
return row_number;
}
int MissConstru::GetNumber()
{
return row_number.size();
}
MissConstru::MissConstru(const string _report_name, const vector<string> _content)
{
report_name = _report_name;
content = _content;
MCName = "Incorrect constructor name";
OtherOperation = "Constructors are special functions that are called only once during the contract creation.\n"
"They often perform critical, privileged actions such as setting the owner of the contract.\n "
"Before Solidity version 0.4.22, the only way of defining a constructor was to create a function\n "
"with the same name as the contract class containing it. A function meant to become a constructor\n"
"becomes a normal, callable function if its name doesn't exactly match the contract name. This\n"
"behavior sometimes leads to security issues, in particular when smart contract code is re-used\n"
"with a different name but the name of the constructor function is not changed accordingly.\nBug level:error";
}
MissConstru::~MissConstru()
{
content.clear();
report_name.clear();
row_number.clear();
MCName.clear();
OtherOperation.clear();
}
string MissConstru::MakeReport(const vector<int>& _row_number)
{
if (_row_number.empty()) {
return "No missing constructor.\n\n";
}
string _report = "";
_report += "[Bug 18]\n";
_report += "bug name: ";
_report += MCName;
_report += '\n';
_report += "number of bugs: ";
_report += to_string(_row_number.size());
_report += '\n';
_report += "row number: ";
for (auto i = _row_number.begin(); i != _row_number.end(); i++) {
_report += to_string((*i));
_report += " ";
}
_report += '\n';
if (OtherOperation.size() != 0) {
_report += "additional description: ";
_report += OtherOperation;
_report += '\n';
}
return _report;
}
void MissConstru::Re_Detection()
{
//regex
regex reg1{ MC_RE_HeadOfContract };
//detection
for (int i = 0; i < content.size();) {
if (content[i].find("contract") < content[i].size()) {
smatch s;
if (regex_match(content[i], s, reg1)) {
//find head of contract
//Take out the name of the contract
string contractName = getConName(content[i]);
//start matching brackets
MC_Match mc;
int j = i;
regex reg2{ MC_RE_Constructor };
string MC_RE_FunctionContract = "^(\\s)*(function)(\\s)*(" + contractName + ")(\\s)*(\\()";
regex reg3{ MC_RE_FunctionContract };
bool flag = false;
while (mc.DoMatch(content[j]) == false) {
smatch s1, s2;
//Detection constructor
if (content[j].find("constructor") < content[j].size() || content[j].find("function") < content[j].size()) {
if (regex_search(content[j], s1, reg2) || regex_search(content[j], s2, reg3)) {
//Find the constructor
flag = true;
break;
}
else {
j++;
}
}
else
j++;
}
if (flag == false) {
row_number.push_back((i + 1));
}
i = j;
}
else
i++;
}
else
i++;
}
}
|
/* clang-format off */
/*******************************************************************************
* Size: 32 px
* Bpp: 3
* Opts: --no-kerning --bpp 3 --size 32 --font src/font/roboto/RobotoCondensed-Regular.ttf -r 0x20-0x7E,0xA0,0xA3,0xB0,0xB1,0xB2,0xB3,0xB5,0xC1,0xC2,0x00C4,0xC9,0x00CB,0xCD,0xCE,0xD3,0x00D4,0xD6,0xD7,0xDA,0xDC,0xDD,0xE1,0xE2,0x00E4,0xE9,0xED,0xEE,0xF3,0x00F4,0xF6,0xF7,0xFA,0xFC,0x00FD,0x0102-0x0103,0x0104-0x0105,0x0106-0x0107,0x010C-0x010D,0x010E-0x010F,0x0110-0x0111,0x0114-0x0115,0x0118-0x0119,0x011A-0x011B,0x0139-0x013A,0x013D-0x013E,0x0141-0x0142,0x0143-0x0144,0x0147-0x0148,0x0150-0x0151,0x0154-0x0155,0x0158-0x0159,0x015A-0x015B,0x015E-0x015F,0x0160-0x0161,0x0162-0x0163,0x0164-0X0165,0x016E-0x016F,0x0170-0x0171,0x0179-0x017A,0x017B-0x017C,0x017D-0x017E,0x01CD-0x01CE,0x0200-0x021B,0x2022,0x20AC --font src/font/MaterialDesign-Webfont/materialdesignicons-webfont.ttf -r 0xF0004=>0xE004,0xF001B=>0xE01B,0xF0026=>0xE026,0xF0045=>0xE045,0xF004D=>0xE04D,0xF0054=>0xE054,0xF005D=>0xE05D,0xF008E=>0xE08E,0xF009A=>0xE09A,0xF00AC=>0xE0AC,0xF00AF=>0xE0AF,0xF00ED=>0xE0ED,0xF010B=>0xE10B,0xF011C=>0xE11C,0xF012C=>0xE12C,0xF0140=>0xE140,0xF0141=>0xE141,0xF0142=>0xE142,0xF0143=>0xE143,0xF0150=>0xE150,0xF0156=>0xE156,0xF0176=>0xE176,0xF01D9=>0xE1D9,0xF01FA=>0xE1FA,0xF0210=>0xE210,0xF0238=>0xE238,0xF028F=>0xE28F,0xF02DA=>0xE2DA,0xF02DC=>0xE2DC,0xF02E3=>0xE2E3,0xF030B=>0xE30B,0xF0322=>0xE322,0xF032A=>0xE32A,0xF0335=>0xE335,0xF033E=>0xE33E,0xF0374=>0xE374,0xF03E4=>0xE3E4,0xF040A=>0xE40A,0xF0415=>0xE415,0xF0425=>0xE425,0xF0438=>0xE438,0xF0456=>0xE456,0xF0457=>0xE457,0xF0458=>0xE458,0xF0493=>0xE493,0xF049D=>0xE49D,0xF049E=>0xE49E,0xF04AD=>0xE4AD,0xF04AE=>0xE4AE,0xF04B9=>0xE4B9,0xF04C3=>0xE4C3,0xF04DB=>0xE4DB,0xF04DE=>0xE4DE,0xF0502=>0xE502,0xF050F=>0xE50F,0xF051B=>0xE51B,0xF0565=>0xE565,0xF057E=>0xE57E,0xF0580=>0xE580,0xF058C=>0xE58C,0xF058E=>0xE58E,0xF058F=>0xE58F,0xF0590=>0xE590,0xF0591=>0xE591,0xF0592=>0xE592,0xF0593=>0xE593,0xF0594=>0xE594,0xF0595=>0xE595,0xF0596=>0xE596,0xF0597=>0xE597,0xF0598=>0xE598,0xF0599=>0xE599,0xF059D=>0xE59D,0xF059E=>0xE59E,0xF05A8=>0xE5A8,0xF05A9=>0xE5A9,0xF05F1=>0xE5F1,0xF05FA=>0xE5FA,0xF0606=>0xE606,0xF060C=>0xE60C,0xF064A=>0xE64A,0xF067E=>0xE67E,0xF067F=>0xE67F,0xF068A=>0xE68A,0xF06A1=>0xE6A1,0xF06A5=>0xE6A5,0xF06B5=>0xE6B5,0xF06C0=>0xE6C0,0xF06C3=>0xE6C3,0xF06E8=>0xE6E8,0xF070D=>0xE70D,0xF070E=>0xE70E,0xF0717=>0xE717,0xF072A=>0xE72A,0xF075A=>0xE75A,0xF075F=>0xE75F,0xF0769=>0xE769,0xF07AE=>0xE7AE,0xF081B=>0xE81B,0xF081C=>0xE81C,0xF08DD=>0xE8DD,0xF0917=>0xE917,0xF091C=>0xE91C,0xF0957=>0xE957,0xF095F=>0xE95F,0xF096B=>0xE96B,0xF099D=>0xE99D,0xF09A0=>0xE9A0,0xF09AB=>0xE9AB,0xF0A70=>0xEA70,0xF0A7A=>0xEA7A,0xF0AAC=>0xEAAC,0xF0AD7=>0xEAD7,0xF0C99=>0xEC99,0xF0F5F=>0xEF5F,0xF0FC6=>0xEFC6,0xF1011=>0xF011,0xF1020=>0xF020,0xF1054=>0xF054,0xF10AF=>0xF0AF,0xF111C=>0xF11C,0xF111D=>0xF11D,0xF111E=>0xF11E,0xF11DB=>0xF1DB,0xF11E1=>0xF1E1,0xF11F3=>0xF1F3,0xF12A1=>0xF2A1,0xF12A2=>0xF2A2,0xF12A3=>0xF2A3,0xF12BA=>0xF2BA,0xF12D3=>0xF2D3,0xF12D4=>0xF2D4,0xF139D=>0xF39D,0xF140B=>0xF40B --format bin -o src/font/latin2/robotocondensed_regular_32_latin2.cpp --format lvgl
******************************************************************************/
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN2
#define ROBOTOCONDENSED_REGULAR_32_LATIN2 0 // default to off
#endif
#if ROBOTOCONDENSED_REGULAR_32_LATIN2
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+0020 " " */
/* U+0021 "!" */
0x7f, 0x98, 0x1f, 0x10, 0x3f, 0xf9, 0x84, 0xf,
0xfe, 0x13, 0x3, 0xff, 0x80, 0xbf, 0x10, 0x38,
0x90, 0x5b, 0x16, 0x1, 0xa8, 0xa,
/* U+0022 "\"" */
0xdd, 0xb, 0xe0, 0x1f, 0xfc, 0x46, 0x5, 0xc0,
0xf1, 0x0, 0x40, 0xff, 0x34, 0xc0, 0x66, 0x40,
/* U+0023 "#" */
0x3, 0x97, 0xc0, 0x5f, 0x88, 0x1e, 0x21, 0x80,
0x20, 0x8, 0x1e, 0xc3, 0x0, 0x60, 0x81, 0xf3,
0x4, 0x1, 0x8, 0xf, 0x88, 0x40, 0x30, 0xe0,
0x78, 0x81, 0xcc, 0x20, 0x2f, 0xec, 0x3, 0xf8,
0x8d, 0xe8, 0x1f, 0xfc, 0x4d, 0xa4, 0x26, 0xc8,
0xe, 0xca, 0x9, 0x98, 0x26, 0xe1, 0x12, 0x3,
0x88, 0x40, 0x8, 0xe0, 0x78, 0x81, 0xcc, 0x10,
0x3c, 0xc1, 0x2, 0x21, 0x1, 0x89, 0x60, 0xc9,
0x20, 0x4, 0x80, 0x7d, 0x8c, 0x2d, 0x94, 0x6,
0xca, 0x7, 0xff, 0x13, 0xf8, 0x7, 0xf2, 0x13,
0xf5, 0x2, 0x20, 0x73, 0x4, 0xf, 0x30, 0x40,
0x88, 0x40, 0x7b, 0x4, 0x0, 0x81, 0xfc, 0x47,
0x0, 0x82, 0x3, 0xe6, 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0x58, 0x1f, 0x34, 0x32, 0x14, 0x81, 0xc6, 0x6,
0x68, 0xe, 0x7, 0x40, 0x60, 0xa, 0xb, 0x3,
0x57, 0x0, 0x92, 0x46, 0x7, 0x44, 0x6, 0xac,
0x8,
/* U+002B "+" */
0x3, 0x8a, 0x40, 0x3f, 0xe5, 0x69, 0x1, 0xff,
0xff, 0x76, 0xf0, 0x9, 0x6e, 0x59, 0x2c, 0x40,
0x14, 0xb1, 0x3, 0xff, 0x85, 0x7f, 0xd0, 0x5,
0xff, 0x30, 0x3f, 0xff, 0xe0, 0x7f, 0x0,
/* U+002C "," */
0x1, 0xfb, 0x1, 0xff, 0xc2, 0x61, 0x80, 0xc2,
0x80, 0x68, 0x8a, 0x14, 0x84, 0x0,
/* U+002D "-" */
0x9, 0x78, 0x2b, 0x7c, 0x40, 0xfc,
/* U+002E "." */
0x9, 0x4, 0xb5, 0x8, 0x5, 0xc0, 0x40,
/* U+002F "/" */
0x3, 0xf5, 0xf4, 0xf, 0xc8, 0x70, 0x3e, 0x40,
0x10, 0x1f, 0x70, 0x80, 0xfc, 0x87, 0x3, 0xe4,
0x1, 0x1, 0xf7, 0x8, 0xf, 0xc8, 0x70, 0x3e,
0x40, 0x10, 0x1f, 0x60, 0x80, 0xfc, 0xc6, 0x3,
0xe4, 0x1, 0x81, 0xf6, 0x8, 0xf, 0xcc, 0x60,
0x3e, 0x20, 0x18, 0x1f, 0x50, 0x40, 0xfc, 0xc5,
0x3, 0xe2, 0x1, 0x81, 0xf5, 0x4, 0xf, 0xc8,
0x50, 0x3e, 0x24, 0x10, 0x1f, 0x50, 0x48, 0xf,
0x90, 0xa0, 0x7c, 0x48, 0x20, 0x3f, 0x38, 0x40,
0xf8,
/* U+0030 "0" */
0x3, 0x3d, 0xfb, 0x30, 0x38, 0xe8, 0x40, 0x19,
0x40, 0xdc, 0x85, 0x20, 0x85, 0x0, 0x22, 0x15,
0x6d, 0x88, 0x64, 0x70, 0x10, 0xd, 0x0, 0x20,
0x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fd, 0x40, 0x30, 0x3f, 0x12, 0x18,
0xf, 0xe4, 0x10, 0x1f, 0xd5, 0xb1,
/* U+005D "]" */
0x29, 0x63, 0x6f, 0x40, 0x3d, 0x3f, 0x1, 0xff,
0xff, 0x3, 0xff, 0xf8, 0x53, 0x2, 0xb5, 0x0,
0xfe,
/* U+005E "^" */
0x2, 0x3f, 0x80, 0xfa, 0x80, 0x60, 0x79, 0x80,
0xa0, 0x71, 0x2, 0x20, 0x75, 0x8, 0x86, 0x6,
0x63, 0xd1, 0x40, 0x90, 0x4, 0x80, 0x90, 0xe,
0x10, 0x24, 0x28, 0x4, 0x30, 0x4, 0x18, 0x60,
0x18, 0xa, 0x0, 0xe0, 0x40, 0x88, 0xa,
/* U+005F "_" */
0x29, 0x7f, 0xc6, 0xdf, 0xfe, 0x8, 0x1f, 0xfc,
0x10,
/* U+0060 "`" */
0xe, 0x42, 0x3, 0x26, 0xd4, 0xc, 0x68, 0xa,
0x6, 0x50, 0x26, 0x6, 0x6c, 0x20,
/* U+0061 "a" */
0x2, 0x33, 0x7e, 0xcc, 0xe, 0x59, 0x90, 0x6,
0x60, 0x23, 0x40, 0x39, 0x4, 0x1a, 0x2, 0x0,
0xb1, 0xb6, 0x0, 0x80, 0x20, 0x8, 0xc, 0x80,
0xdf, 0xc0, 0x7f, 0xf2, 0x48, 0x11, 0x9b, 0xf9,
0x1, 0xcf, 0x32, 0x7, 0xe5, 0x0, 0x4d, 0xf9,
0x1, 0xa8, 0xe, 0xc8, 0x1e, 0x20, 0x18, 0x1f,
0xfc, 0xa2, 0x1, 0x1, 0x92, 0x1, 0x88, 0x3a,
0x46, 0xa0, 0x77, 0x0, 0x5b, 0x12, 0x60, 0x18,
0x39, 0x81, 0x3d, 0x52, 0x10,
/* U+0062 "b" */
0xfd, 0x80, 0xff, 0xff, 0x81, 0x9e, 0xfd, 0x50,
0x1e, 0xb0, 0x80, 0x56, 0x1, 0x8a, 0x32, 0x10,
0x6, 0x80, 0xcf, 0x36, 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0xbd, 0xfa, 0x90, 0x3a,
0xc2, 0x1, 0x64, 0x4, 0x51, 0x90, 0x40, 0x40,
0x31, 0xcd, 0xb1, 0x4, 0x80, 0xb0, 0x1a, 0x80,
0x60, 0x8, 0x1c, 0x40, 0x10, 0x3f, 0xff, 0xe0,
0x7f, 0xfb, 0x40,
/* U+0069 "i" */
0x7e, 0x8a, 0x11, 0x40, 0xc, 0xdc, 0x1, 0x1,
0x7f, 0x1, 0xff, 0xf5,
/* U+006A "j" */
0x2, 0x9e, 0x1, 0x98, 0x60, 0x62, 0x8, 0x1b,
0x68, 0xe, 0x20, 0x76, 0xfc, 0x7, 0xff, 0xfc,
0xf, 0xff, 0x59, 0x4, 0x17, 0x40, 0x20, 0xe2,
0x1, 0x40, 0xc6, 0x90,
/* U+006B "k" */
0xfd, 0x80, 0xff, 0xff, 0x81, 0xf2, 0xfe, 0x20,
0x7e, 0xa0, 0x29, 0x3, 0xea, 0x1, 0xa0, 0x3e,
0x68, 0x18, 0x7, 0xc6, 0x0, 0xc0, 0x7e, 0xe0,
0x28, 0x1f, 0xa1, 0xd, 0x1, 0xf1, 0x60, 0x30,
0x1f, 0xfc, 0xa, 0x7, 0xf9, 0x80, 0x80, 0x7e,
0xd0, 0x86, 0x40, 0xf1, 0x21, 0x0, 0x70, 0x3f,
0x92, 0x2, 0x80, 0xfe, 0x80, 0x28, 0x1f, 0xc5,
0x80, 0x80, 0x7f, 0x40, 0xc, 0x81, 0xfd, 0x0,
0x70,
/* U+006C "l" */
0xbf, 0x80, 0xff, 0xff, 0x81, 0xff, 0xc2,
/* U+006D "m" */
0xfd, 0x44, 0xdf, 0xa9, 0x0, 0xaf, 0xec, 0xc0,
0xcf, 0x32, 0x1, 0x62, 0xea, 0x0, 0x65, 0x2,
0x24, 0xa3, 0x2, 0xd0, 0x38, 0x80, 0x24, 0x2,
0x95, 0xce, 0x6, 0xb1, 0xda, 0x1, 0xc0, 0x98,
0x19, 0x80, 0x48, 0x4, 0x80, 0x20, 0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, 0x5f, 0xc0, 0x17,
0xe4, 0x7, 0xf5, 0xd8, 0x0, 0xec, 0x40, 0x90,
0x6, 0x48, 0xf, 0xff, 0xf8, 0x1f, 0xfc, 0x6,
0x7, 0x88, 0x36, 0x10, 0x2a, 0x1, 0x30, 0x33,
0x84, 0x10,
/* U+0075 "u" */
0xfd, 0x80, 0xe7, 0xf9, 0x81, 0xff, 0xff, 0x3,
0xff, 0xda, 0x41, 0x3, 0xb8, 0x13, 0x0, 0x80,
0x8b, 0x2, 0xe0, 0x2c, 0x77, 0x1, 0x92, 0x0,
0x71, 0x2, 0x6, 0xb0, 0x80, 0x56, 0x1, 0x0,
/* U+0076 "v" */
0x3f, 0xa8, 0x1e, 0xfd, 0x49, 0x4, 0x7, 0x20,
0x18, 0x20, 0x4, 0xd, 0x80, 0x21, 0x40, 0x20,
0x32, 0x4, 0x81, 0x1, 0x80, 0xc4, 0x20, 0x24,
0x10, 0x12, 0x1, 0x80, 0xb8, 0x2, 0x3, 0x0,
0x40, 0x48, 0x2, 0x0, 0x82, 0x3, 0x90, 0xa0,
0x8, 0xc0, 0x76, 0x4, 0x20, 0xc, 0xe, 0x40,
0x16, 0x4, 0xf, 0x12, 0x19, 0xa, 0x7, 0xc8,
0x22, 0x10, 0x1f, 0x60, 0x40, 0x10, 0x3e, 0x40,
0x4c, 0xf, 0xe4, 0x3, 0x1, 0xfd, 0xc0, 0x20,
0x30,
/* U+0077 "w" */
0x1f, 0xa8, 0x1d, 0xbc, 0x3, 0xb7, 0xc0, 0x86,
0x7, 0x10, 0x80, 0xe2, 0x10, 0x40, 0x81, 0x98,
0x2, 0x40, 0x48, 0x6, 0x18, 0x2, 0x2, 0xc0,
0x48, 0x8, 0x80, 0x41, 0x80, 0xc0, 0x48, 0xb,
0x1, 0x60, 0x31, 0x0, 0x40, 0x10, 0x8, 0x20,
0x24, 0x10, 0x12, 0x8, 0x2, 0x1, 0x0, 0x10,
0x40, 0x60, 0x2c, 0x0, 0x8c, 0x11, 0x0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DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 118, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 0, .adv_w = 126, .box_w = 4, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 22, .adv_w = 164, .box_w = 7, .box_h = 8, .ofs_x = 2, .ofs_y = 15},
{.bitmap_index = 38, .adv_w = 281, .box_w = 15, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 142, .adv_w = 253, .box_w = 14, .box_h = 29, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 259, .adv_w = 324, .box_w = 18, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 384, .adv_w = 279, .box_w = 17, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 506, .adv_w = 90, .box_w = 3, .box_h = 8, .ofs_x = 1, .ofs_y = 15},
{.bitmap_index = 514, .adv_w = 161, .box_w = 8, .box_h = 34, .ofs_x = 2, .ofs_y = -8},
{.bitmap_index = 591, .adv_w = 163, .box_w = 9, .box_h = 34, .ofs_x = 0, .ofs_y = -8},
{.bitmap_index = 669, .adv_w = 221, .box_w = 14, .box_h = 14, .ofs_x = 0, .ofs_y = 8},
{.bitmap_index = 726, .adv_w = 255, .box_w = 14, .box_h = 17, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 757, .adv_w = 101, .box_w = 5, .box_h = 8, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 771, .adv_w = 127, .box_w = 8, .box_h = 3, .ofs_x = 0, .ofs_y = 8},
{.bitmap_index = 777, .adv_w = 135, .box_w = 4, .box_h = 4, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 784, .adv_w = 190, .box_w = 11, .box_h = 25, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 857, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 931, .adv_w = 253, .box_w = 9, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 955, .adv_w = 253, .box_w = 14, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1046, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1141, .adv_w = 253, .box_w = 15, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1212, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1302, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1394, .adv_w = 253, .box_w = 14, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1472, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1574, .adv_w = 253, .box_w = 13, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1670, .adv_w = 120, .box_w = 4, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1687, .adv_w = 104, .box_w = 6, .box_h = 22, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 1719, .adv_w = 228, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 1768, .adv_w = 245, .box_w = 12, .box_h = 9, .ofs_x = 2, .ofs_y = 6},
{.bitmap_index = 1790, .adv_w = 236, .box_w = 12, .box_h = 14, .ofs_x = 2, .ofs_y = 3},
{.bitmap_index = 1844, .adv_w = 216, .box_w = 12, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1919, .adv_w = 394, .box_w = 23, .box_h = 28, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 2114, .adv_w = 295, .box_w = 18, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2230, .adv_w = 280, .box_w = 14, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2314, .adv_w = 290, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2406, .adv_w = 292, .box_w = 15, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2481, .adv_w = 255, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2519, .adv_w = 246, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2549, .adv_w = 303, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2646, .adv_w = 318, .box_w = 16, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2674, .adv_w = 128, .box_w = 4, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2681, .adv_w = 248, .box_w = 14, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2726, .adv_w = 279, .box_w = 16, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2821, .adv_w = 244, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2843, .adv_w = 387, .box_w = 20, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2960, .adv_w = 317, .box_w = 16, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3050, .adv_w = 308, .box_w = 17, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3150, .adv_w = 284, .box_w = 15, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3209, .adv_w = 308, .box_w = 17, .box_h = 26, .ofs_x = 1, .ofs_y = -4},
{.bitmap_index = 3328, .adv_w = 272, .box_w = 15, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3417, .adv_w = 266, .box_w = 15, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3523, .adv_w = 267, .box_w = 16, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3550, .adv_w = 288, .box_w = 15, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3594, .adv_w = 287, .box_w = 18, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3713, .adv_w = 390, .box_w = 23, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3880, .adv_w = 282, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3992, .adv_w = 269, .box_w = 17, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4075, .adv_w = 268, .box_w = 15, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4156, .adv_w = 128, .box_w = 6, .box_h = 31, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 4173, .adv_w = 189, .box_w = 12, .box_h = 25, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 4251, .adv_w = 128, .box_w = 6, .box_h = 31, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 4268, .adv_w = 190, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 11},
{.bitmap_index = 4307, .adv_w = 207, .box_w = 13, .box_h = 3, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 4316, .adv_w = 158, .box_w = 8, .box_h = 5, .ofs_x = 0, .ofs_y = 19},
{.bitmap_index = 4330, .adv_w = 245, .box_w = 13, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4399, .adv_w = 253, .box_w = 13, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4461, .adv_w = 237, .box_w = 13, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4526, .adv_w = 254, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4594, .adv_w = 240, .box_w = 13, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4665, .adv_w = 162, .box_w = 9, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 4703, .adv_w = 253, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 4788, .adv_w = 247, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4823, .adv_w = 118, .box_w = 4, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4835, .adv_w = 115, .box_w = 7, .box_h = 28, .ofs_x = -1, .ofs_y = -6},
{.bitmap_index = 4863, .adv_w = 231, .box_w = 13, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4928, .adv_w = 118, .box_w = 4, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4935, .adv_w = 386, .box_w = 20, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4990, .adv_w = 248, .box_w = 12, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5022, .adv_w = 257, .box_w = 14, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5100, .adv_w = 253, .box_w = 13, .box_h = 23, .ofs_x = 2, .ofs_y = -6},
{.bitmap_index = 5170, .adv_w = 256, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 5239, .adv_w = 156, .box_w = 8, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5260, .adv_w = 234, .box_w = 13, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5338, .adv_w = 152, .box_w = 9, .box_h = 21, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5372, .adv_w = 248, .box_w = 12, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5404, .adv_w = 219, .box_w = 13, .box_h = 17, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5477, .adv_w = 333, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5596, .adv_w = 225, .box_w = 14, .box_h = 17, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5676, .adv_w = 213, .box_w = 13, .box_h = 23, .ofs_x = 0, .ofs_y = -6},
{.bitmap_index = 5771, .adv_w = 225, .box_w = 12, .box_h = 17, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5827, .adv_w = 157, .box_w = 9, .box_h = 32, .ofs_x = 1, .ofs_y = -7},
{.bitmap_index = 5897, .adv_w = 125, .box_w = 4, .box_h = 27, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 5906, .adv_w = 157, .box_w = 9, .box_h = 32, .ofs_x = 0, .ofs_y = -7},
{.bitmap_index = 5974, .adv_w = 302, .box_w = 16, .box_h = 6, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 6010, .adv_w = 118, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6010, .adv_w = 262, .box_w = 15, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6091, .adv_w = 191, .box_w = 8, .box_h = 8, .ofs_x = 2, .ofs_y = 15},
{.bitmap_index = 6115, .adv_w = 241, .box_w = 13, .box_h = 20, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6151, .adv_w = 169, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 10},
{.bitmap_index = 6191, .adv_w = 169, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 10},
{.bitmap_index = 6234, .adv_w = 255, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = -6},
{.bitmap_index = 6271, .adv_w = 295, .box_w = 18, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6415, .adv_w = 295, .box_w = 18, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6560, .adv_w = 295, .box_w = 18, .box_h = 28, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6704, .adv_w = 255, .box_w = 13, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 6765, .adv_w = 255, .box_w = 13, .box_h = 28, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 6829, .adv_w = 128, .box_w = 7, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 6854, .adv_w = 128, .box_w = 10, .box_h = 29, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 6888, .adv_w = 308, .box_w = 17, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7015, .adv_w = 308, .box_w = 17, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7144, .adv_w = 308, .box_w = 17, .box_h = 28, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7272, .adv_w = 241, .box_w = 13, .box_h = 15, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 7338, .adv_w = 288, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7406, .adv_w = 288, .box_w = 15, .box_h = 28, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7477, .adv_w = 269, .box_w = 17, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 7587, .adv_w = 245, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7674, .adv_w = 245, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7764, .adv_w = 245, .box_w = 13, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7855, .adv_w = 240, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7944, .adv_w = 121, .box_w = 7, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7965, .adv_w = 121, .box_w = 9, .box_h = 23, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 7992, .adv_w = 257, .box_w = 14, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 8089, .adv_w = 257, .box_w = 14, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 8188, .adv_w = 257, .box_w = 14, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 8289, .adv_w = 256, .box_w = 14, .box_h = 16, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 8337, .adv_w = 248, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 8387, .adv_w = 248, .box_w = 12, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 8440, .adv_w = 213, .box_w = 13, .box_h = 29, .ofs_x = 0, .ofs_y = -6},
{.bitmap_index = 8554, .adv_w = 295, .box_w = 18, .box_h = 28, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 8696, .adv_w = 245, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 8789, .adv_w = 295, .box_w = 18, .box_h = 28, .ofs_x = 0, .ofs_y = -6},
{.bitmap_index = 8933, .adv_w = 245, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 9029, .adv_w = 290, .box_w = 16, .box_h = 30, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9146, .adv_w = 237, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9229, .adv_w = 290, .box_w = 16, .box_h = 30, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9349, .adv_w = 237, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9435, .adv_w = 292, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 9537, .adv_w = 292, .box_w = 17, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9635, .adv_w = 300, .box_w = 17, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 9732, .adv_w = 271, .box_w = 16, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9830, .adv_w = 255, .box_w = 13, .box_h = 28, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 9893, .adv_w = 240, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 9987, .adv_w = 255, .box_w = 13, .box_h = 28, .ofs_x = 2, .ofs_y = -6},
{.bitmap_index = 10048, .adv_w = 240, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 10141, .adv_w = 255, .box_w = 13, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10205, .adv_w = 240, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 10296, .adv_w = 244, .box_w = 13, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10340, .adv_w = 118, .box_w = 7, .box_h = 30, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10366, .adv_w = 244, .box_w = 13, .box_h = 22, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10404, .adv_w = 155, .box_w = 8, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10428, .adv_w = 244, .box_w = 15, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 10470, .adv_w = 128, .box_w = 8, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 10492, .adv_w = 317, .box_w = 16, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10607, .adv_w = 248, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10659, .adv_w = 317, .box_w = 16, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10777, .adv_w = 248, .box_w = 12, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 10830, .adv_w = 308, .box_w = 17, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 10961, .adv_w = 257, .box_w = 14, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 11065, .adv_w = 272, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 11177, .adv_w = 156, .box_w = 9, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 11215, .adv_w = 272, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 11331, .adv_w = 156, .box_w = 9, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 11371, .adv_w = 266, .box_w = 15, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 11499, .adv_w = 234, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 11596, .adv_w = 266, .box_w = 15, .box_h = 28, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 11722, .adv_w = 234, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = -6},
{.bitmap_index = 11820, .adv_w = 266, .box_w = 15, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 11952, .adv_w = 234, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12050, .adv_w = 267, .box_w = 16, .box_h = 28, .ofs_x = 0, .ofs_y = -6},
{.bitmap_index = 12099, .adv_w = 152, .box_w = 10, .box_h = 28, .ofs_x = 0, .ofs_y = -6},
{.bitmap_index = 12152, .adv_w = 267, .box_w = 16, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 12207, .adv_w = 162, .box_w = 11, .box_h = 26, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 12264, .adv_w = 288, .box_w = 15, .box_h = 31, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 12343, .adv_w = 248, .box_w = 12, .box_h = 26, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 12404, .adv_w = 288, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 12479, .adv_w = 248, .box_w = 13, .box_h = 23, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 12538, .adv_w = 268, .box_w = 15, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12642, .adv_w = 225, .box_w = 12, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12717, .adv_w = 268, .box_w = 15, .box_h = 28, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12818, .adv_w = 225, .box_w = 12, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12891, .adv_w = 268, .box_w = 15, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 12999, .adv_w = 225, .box_w = 12, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 13076, .adv_w = 295, .box_w = 18, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13221, .adv_w = 245, .box_w = 13, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 13312, .adv_w = 295, .box_w = 18, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13456, .adv_w = 245, .box_w = 14, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13552, .adv_w = 295, .box_w = 18, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13699, .adv_w = 245, .box_w = 13, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 13795, .adv_w = 255, .box_w = 14, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 13863, .adv_w = 240, .box_w = 14, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 13960, .adv_w = 255, .box_w = 13, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 14027, .adv_w = 240, .box_w = 13, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 14124, .adv_w = 128, .box_w = 11, .box_h = 29, .ofs_x = -4, .ofs_y = 0},
{.bitmap_index = 14162, .adv_w = 121, .box_w = 11, .box_h = 23, .ofs_x = -4, .ofs_y = 0},
{.bitmap_index = 14195, .adv_w = 128, .box_w = 8, .box_h = 29, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 14227, .adv_w = 121, .box_w = 9, .box_h = 24, .ofs_x = -1, .ofs_y = 0},
{.bitmap_index = 14257, .adv_w = 308, .box_w = 17, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 14385, .adv_w = 257, .box_w = 15, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 14490, .adv_w = 308, .box_w = 17, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 14620, .adv_w = 257, .box_w = 14, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 14725, .adv_w = 272, .box_w = 16, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 14852, .adv_w = 156, .box_w = 12, .box_h = 23, .ofs_x = -2, .ofs_y = 0},
{.bitmap_index = 14899, .adv_w = 272, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 15017, .adv_w = 156, .box_w = 9, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 15061, .adv_w = 288, .box_w = 16, .box_h = 29, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 15135, .adv_w = 248, .box_w = 14, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 15194, .adv_w = 288, .box_w = 15, .box_h = 29, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 15268, .adv_w = 248, .box_w = 12, .box_h = 24, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 15323, .adv_w = 266, .box_w = 15, .box_h = 30, .ofs_x = 1, .ofs_y = -8},
{.bitmap_index = 15458, .adv_w = 234, .box_w = 13, .box_h = 25, .ofs_x = 1, .ofs_y = -8},
{.bitmap_index = 15560, .adv_w = 267, .box_w = 16, .box_h = 31, .ofs_x = 0, .ofs_y = -9},
{.bitmap_index = 15614, .adv_w = 152, .box_w = 9, .box_h = 29, .ofs_x = 0, .ofs_y = -8},
{.bitmap_index = 15670, .adv_w = 173, .box_w = 7, .box_h = 7, .ofs_x = 2, .ofs_y = 8},
{.bitmap_index = 15687, .adv_w = 253, .box_w = 14, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 15775, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 15872, .adv_w = 512, .box_w = 24, .box_h = 33, .ofs_x = 4, .ofs_y = -4},
{.bitmap_index = 16081, .adv_w = 512, .box_w = 30, .box_h = 26, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 16228, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 16323, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 16433, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 16544, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 16639, .adv_w = 512, .box_w = 16, .box_h = 28, .ofs_x = 8, .ofs_y = -2},
{.bitmap_index = 16690, .adv_w = 512, .box_w = 24, .box_h = 29, .ofs_x = 4, .ofs_y = -3},
{.bitmap_index = 16799, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 16902, .adv_w = 512, .box_w = 18, .box_h = 28, .ofs_x = 6, .ofs_y = -2},
{.bitmap_index = 17041, .adv_w = 512, .box_w = 24, .box_h = 27, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 17118, .adv_w = 512, .box_w = 24, .box_h = 22, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 17222, .adv_w = 512, .box_w = 20, .box_h = 30, .ofs_x = 6, .ofs_y = -3},
{.bitmap_index = 17282, .adv_w = 512, .box_w = 24, .box_h = 19, .ofs_x = 4, .ofs_y = 2},
{.bitmap_index = 17383, .adv_w = 512, .box_w = 16, .box_h = 11, .ofs_x = 8, .ofs_y = 6},
{.bitmap_index = 17436, .adv_w = 512, .box_w = 11, .box_h = 16, .ofs_x = 10, .ofs_y = 4},
{.bitmap_index = 17486, .adv_w = 512, .box_w = 11, .box_h = 16, .ofs_x = 11, .ofs_y = 4},
{.bitmap_index = 17536, .adv_w = 512, .box_w = 16, .box_h = 11, .ofs_x = 8, .ofs_y = 7},
{.bitmap_index = 17586, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 17800, .adv_w = 512, .box_w = 20, .box_h = 20, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 17917, .adv_w = 512, .box_w = 28, .box_h = 24, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 18010, .adv_w = 512, .box_w = 6, .box_h = 22, .ofs_x = 13, .ofs_y = 1},
{.bitmap_index = 18055, .adv_w = 512, .box_w = 30, .box_h = 22, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 18152, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 18325, .adv_w = 512, .box_w = 20, .box_h = 25, .ofs_x = 6, .ofs_y = -1},
{.bitmap_index = 18461, .adv_w = 512, .box_w = 20, .box_h = 28, .ofs_x = 6, .ofs_y = -2},
{.bitmap_index = 18555, .adv_w = 512, .box_w = 29, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 18754, .adv_w = 512, .box_w = 28, .box_h = 23, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 18853, .adv_w = 512, .box_w = 30, .box_h = 21, .ofs_x = 1, .ofs_y = 1},
{.bitmap_index = 18941, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 19094, .adv_w = 512, .box_w = 32, .box_h = 22, .ofs_x = 0, .ofs_y = 1},
{.bitmap_index = 19165, .adv_w = 512, .box_w = 28, .box_h = 26, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 19343, .adv_w = 512, .box_w = 20, .box_h = 28, .ofs_x = 6, .ofs_y = -2},
{.bitmap_index = 19453, .adv_w = 512, .box_w = 22, .box_h = 29, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 19575, .adv_w = 512, .box_w = 20, .box_h = 4, .ofs_x = 6, .ofs_y = 10},
{.bitmap_index = 19589, .adv_w = 512, .box_w = 16, .box_h = 20, .ofs_x = 8, .ofs_y = 2},
{.bitmap_index = 19614, .adv_w = 512, .box_w = 16, .box_h = 20, .ofs_x = 10, .ofs_y = 2},
{.bitmap_index = 19689, .adv_w = 512, .box_w = 20, .box_h = 20, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 19731, .adv_w = 512, .box_w = 23, .box_h = 23, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 19867, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 20046, .adv_w = 512, .box_w = 25, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 20160, .adv_w = 512, .box_w = 27, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 20345, .adv_w = 512, .box_w = 25, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 20469, .adv_w = 512, .box_w = 26, .box_h = 28, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 20641, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 20783, .adv_w = 512, .box_w = 20, .box_h = 20, .ofs_x = 6, .ofs_y = 2},
{.bitmap_index = 20863, .adv_w = 512, .box_w = 16, .box_h = 16, .ofs_x = 8, .ofs_y = 4},
{.bitmap_index = 20922, .adv_w = 512, .box_w = 16, .box_h = 16, .ofs_x = 8, .ofs_y = 4},
{.bitmap_index = 20981, .adv_w = 512, .box_w = 30, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 21100, .adv_w = 512, .box_w = 20, .box_h = 28, .ofs_x = 6, .ofs_y = -2},
{.bitmap_index = 21240, .adv_w = 512, .box_w = 16, .box_h = 16, .ofs_x = 8, .ofs_y = 4},
{.bitmap_index = 21255, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 21423, .adv_w = 512, .box_w = 30, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 21488, .adv_w = 512, .box_w = 14, .box_h = 28, .ofs_x = 9, .ofs_y = -2},
{.bitmap_index = 21568, .adv_w = 512, .box_w = 24, .box_h = 29, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 21753, .adv_w = 512, .box_w = 24, .box_h = 30, .ofs_x = 4, .ofs_y = -3},
{.bitmap_index = 21918, .adv_w = 512, .box_w = 24, .box_h = 24, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 22059, .adv_w = 512, .box_w = 19, .box_h = 22, .ofs_x = 6, .ofs_y = 1},
{.bitmap_index = 22140, .adv_w = 512, .box_w = 16, .box_h = 23, .ofs_x = 8, .ofs_y = 1},
{.bitmap_index = 22233, .adv_w = 512, .box_w = 16, .box_h = 23, .ofs_x = 8, .ofs_y = 1},
{.bitmap_index = 22346, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 22477, .adv_w = 512, .box_w = 30, .box_h = 20, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 22623, .adv_w = 512, .box_w = 30, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 22790, .adv_w = 512, .box_w = 30, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 23003, .adv_w = 512, .box_w = 30, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 23212, .adv_w = 512, .box_w = 27, .box_h = 29, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 23433, .adv_w = 512, .box_w = 29, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 23648, .adv_w = 512, .box_w = 30, .box_h = 27, .ofs_x = 1, .ofs_y = -1},
{.bitmap_index = 23872, .adv_w = 512, .box_w = 30, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 24092, .adv_w = 512, .box_w = 30, .box_h = 29, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 24318, .adv_w = 512, .box_w = 24, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 24493, .adv_w = 512, .box_w = 26, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 24643, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 24814, .adv_w = 512, .box_w = 30, .box_h = 30, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 25006, .adv_w = 512, .box_w = 30, .box_h = 24, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 25170, .adv_w = 512, .box_w = 23, .box_h = 25, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 25305, .adv_w = 512, .box_w = 25, .box_h = 26, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 25464, .adv_w = 512, .box_w = 28, .box_h = 26, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 25637, .adv_w = 512, .box_w = 21, .box_h = 23, .ofs_x = 6, .ofs_y = 0},
{.bitmap_index = 25730, .adv_w = 512, .box_w = 28, .box_h = 22, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 25862, .adv_w = 512, .box_w = 30, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 26087, .adv_w = 512, .box_w = 30, .box_h = 26, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 26315, .adv_w = 512, .box_w = 24, .box_h = 30, .ofs_x = 4, .ofs_y = -3},
{.bitmap_index = 26481, .adv_w = 512, .box_w = 28, .box_h = 23, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 26599, .adv_w = 512, .box_w = 16, .box_h = 24, .ofs_x = 8, .ofs_y = 0},
{.bitmap_index = 26655, .adv_w = 512, .box_w = 22, .box_h = 28, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 26766, .adv_w = 512, .box_w = 24, .box_h = 24, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 26857, .adv_w = 512, .box_w = 24, .box_h = 24, .ofs_x = 4, .ofs_y = 0},
{.bitmap_index = 26948, .adv_w = 512, .box_w = 30, .box_h = 30, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 27128, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 27361, .adv_w = 512, .box_w = 23, .box_h = 29, .ofs_x = 3, .ofs_y = -3},
{.bitmap_index = 27514, .adv_w = 512, .box_w = 26, .box_h = 28, .ofs_x = 3, .ofs_y = -2},
{.bitmap_index = 27714, .adv_w = 512, .box_w = 22, .box_h = 28, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 27867, .adv_w = 512, .box_w = 26, .box_h = 24, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 27993, .adv_w = 512, .box_w = 26, .box_h = 22, .ofs_x = 4, .ofs_y = 1},
{.bitmap_index = 28104, .adv_w = 512, .box_w = 22, .box_h = 22, .ofs_x = 5, .ofs_y = 1},
{.bitmap_index = 28190, .adv_w = 512, .box_w = 28, .box_h = 21, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 28329, .adv_w = 512, .box_w = 28, .box_h = 24, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 28400, .adv_w = 512, .box_w = 28, .box_h = 24, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 28470, .adv_w = 512, .box_w = 14, .box_h = 28, .ofs_x = 9, .ofs_y = -2},
{.bitmap_index = 28536, .adv_w = 512, .box_w = 22, .box_h = 28, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 28697, .adv_w = 512, .box_w = 21, .box_h = 25, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 28790, .adv_w = 512, .box_w = 32, .box_h = 30, .ofs_x = 0, .ofs_y = -4},
{.bitmap_index = 29037, .adv_w = 512, .box_w = 20, .box_h = 28, .ofs_x = 6, .ofs_y = -2},
{.bitmap_index = 29182, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 29365, .adv_w = 512, .box_w = 24, .box_h = 30, .ofs_x = 4, .ofs_y = -3},
{.bitmap_index = 29525, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 29667, .adv_w = 512, .box_w = 24, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 29788, .adv_w = 512, .box_w = 24, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 29885, .adv_w = 512, .box_w = 22, .box_h = 24, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 29957, .adv_w = 512, .box_w = 22, .box_h = 28, .ofs_x = 5, .ofs_y = -2},
{.bitmap_index = 30080, .adv_w = 512, .box_w = 28, .box_h = 14, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 30154, .adv_w = 512, .box_w = 28, .box_h = 20, .ofs_x = 2, .ofs_y = 2},
{.bitmap_index = 30236, .adv_w = 512, .box_w = 30, .box_h = 28, .ofs_x = 1, .ofs_y = -2},
{.bitmap_index = 30382, .adv_w = 512, .box_w = 29, .box_h = 29, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 30509, .adv_w = 512, .box_w = 28, .box_h = 20, .ofs_x = 2, .ofs_y = 6},
{.bitmap_index = 30604, .adv_w = 512, .box_w = 28, .box_h = 28, .ofs_x = 2, .ofs_y = -2},
{.bitmap_index = 30781, .adv_w = 512, .box_w = 24, .box_h = 28, .ofs_x = 4, .ofs_y = -2},
{.bitmap_index = 30907, .adv_w = 512, .box_w = 29, .box_h = 26, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 31007, .adv_w = 512, .box_w = 24, .box_h = 22, .ofs_x = 4, .ofs_y = 1},
{.bitmap_index = 31090, .adv_w = 512, .box_w = 28, .box_h = 22, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 31167, .adv_w = 512, .box_w = 24, .box_h = 22, .ofs_x = 4, .ofs_y = 1},
{.bitmap_index = 31213, .adv_w = 512, .box_w = 30, .box_h = 29, .ofs_x = 1, .ofs_y = -3},
{.bitmap_index = 31300, .adv_w = 512, .box_w = 28, .box_h = 22, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 31443, .adv_w = 512, .box_w = 30, .box_h = 20, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 31601, .adv_w = 512, .box_w = 16, .box_h = 28, .ofs_x = 8, .ofs_y = -2},
{.bitmap_index = 31657, .adv_w = 512, .box_w = 16, .box_h = 28, .ofs_x = 8, .ofs_y = -2},
{.bitmap_index = 31719, .adv_w = 512, .box_w = 16, .box_h = 28, .ofs_x = 8, .ofs_y = -2},
{.bitmap_index = 31786, .adv_w = 512, .box_w = 31, .box_h = 20, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 31975, .adv_w = 512, .box_w = 28, .box_h = 21, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 32078, .adv_w = 512, .box_w = 28, .box_h = 21, .ofs_x = 2, .ofs_y = 1},
{.bitmap_index = 32164, .adv_w = 512, .box_w = 28, .box_h = 30, .ofs_x = 2, .ofs_y = -3},
{.bitmap_index = 32378, .adv_w = 512, .box_w = 16, .box_h = 30, .ofs_x = 8, .ofs_y = -3}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
static const uint16_t unicode_list_1[] = {
0x0, 0x3, 0x10, 0x11, 0x12, 0x13, 0x15, 0x21,
0x22, 0x24, 0x29, 0x2b, 0x2d, 0x2e, 0x33, 0x34,
0x36, 0x37, 0x3a, 0x3c, 0x3d, 0x41, 0x42, 0x44,
0x49, 0x4d, 0x4e, 0x53, 0x54, 0x56, 0x57, 0x5a,
0x5c, 0x5d, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x74, 0x75,
0x78, 0x79, 0x7a, 0x7b, 0x99, 0x9a, 0x9d, 0x9e,
0xa1, 0xa2, 0xa3, 0xa4, 0xa7, 0xa8, 0xb0, 0xb1,
0xb4, 0xb5, 0xb8, 0xb9, 0xba, 0xbb, 0xbe, 0xbf,
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xce, 0xcf,
0xd0, 0xd1, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
0x12d, 0x12e
};
static const uint16_t unicode_list_3[] = {
0x0, 0x8a, 0xbfe2, 0xbff9, 0xc004, 0xc023, 0xc02b, 0xc032,
0xc03b, 0xc06c, 0xc078, 0xc08a, 0xc08d, 0xc0cb, 0xc0e9, 0xc0fa,
0xc10a, 0xc11e, 0xc11f, 0xc120, 0xc121, 0xc12e, 0xc134, 0xc154,
0xc1b7, 0xc1d8, 0xc1ee, 0xc216, 0xc26d, 0xc2b8, 0xc2ba, 0xc2c1,
0xc2e9, 0xc300, 0xc308, 0xc313, 0xc31c, 0xc352, 0xc3c2, 0xc3e8,
0xc3f3, 0xc403, 0xc416, 0xc434, 0xc435, 0xc436, 0xc471, 0xc47b,
0xc47c, 0xc48b, 0xc48c, 0xc497, 0xc4a1, 0xc4b9, 0xc4bc, 0xc4e0,
0xc4ed, 0xc4f9, 0xc543, 0xc55c, 0xc55e, 0xc56a, 0xc56c, 0xc56d,
0xc56e, 0xc56f, 0xc570, 0xc571, 0xc572, 0xc573, 0xc574, 0xc575,
0xc576, 0xc577, 0xc57b, 0xc57c, 0xc586, 0xc587, 0xc5cf, 0xc5d8,
0xc5e4, 0xc5ea, 0xc628, 0xc65c, 0xc65d, 0xc668, 0xc67f, 0xc683,
0xc693, 0xc69e, 0xc6a1, 0xc6c6, 0xc6eb, 0xc6ec, 0xc6f5, 0xc708,
0xc738, 0xc73d, 0xc747, 0xc78c, 0xc7f9, 0xc7fa, 0xc8bb, 0xc8f5,
0xc8fa, 0xc935, 0xc93d, 0xc949, 0xc97b, 0xc97e, 0xc989, 0xca4e,
0xca58, 0xca8a, 0xcab5, 0xcc77, 0xcf3d, 0xcfa4, 0xcfef, 0xcffe,
0xd032, 0xd08d, 0xd0fa, 0xd0fb, 0xd0fc, 0xd1b9, 0xd1bf, 0xd1d1,
0xd27f, 0xd280, 0xd281, 0xd298, 0xd2b1, 0xd2b2, 0xd37b, 0xd3e9
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
},
{
.range_start = 160, .range_length = 303, .glyph_id_start = 96,
.unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 90, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
},
{
.range_start = 512, .range_length = 28, .glyph_id_start = 186,
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
},
{
.range_start = 8226, .range_length = 54250, .glyph_id_start = 214,
.unicode_list = unicode_list_3, .glyph_id_ofs_list = NULL, .list_length = 136, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 4,
.bpp = 3,
.kern_classes = 0,
.bitmap_format = 1,
#if LV_VERSION_CHECK(8, 0, 0)
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t robotocondensed_regular_32_latin2 = {
#else
lv_font_t robotocondensed_regular_32_latin2 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 40, /*The maximum line height required by the font*/
.base_line = 9, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -2,
.underline_thickness = 2,
#endif
.dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};
#endif /*#if ROBOTOCONDENSED_REGULAR_32_LATIN2*/
|
/* ************************************************************************
* Copyright 2016-2020 Advanced Micro Devices, Inc.
* ************************************************************************ */
#include "logging.h"
#include "rocblas_her2k.hpp"
#include "utility.h"
namespace
{
template <typename>
constexpr char rocblas_her2k_name[] = "unknown";
template <>
constexpr char rocblas_her2k_name<rocblas_float_complex>[] = "rocblas_cher2k_batched";
template <>
constexpr char rocblas_her2k_name<rocblas_double_complex>[] = "rocblas_zher2k_batched";
template <typename T>
rocblas_status rocblas_her2k_batched_impl(rocblas_handle handle,
rocblas_fill uplo,
rocblas_operation trans,
rocblas_int n,
rocblas_int k,
const T* alpha,
const T* const A[],
rocblas_int lda,
const T* const B[],
rocblas_int ldb,
const real_t<T>* beta,
T* const C[],
rocblas_int ldc,
rocblas_int batch_count)
{
if(!handle)
return rocblas_status_invalid_handle;
RETURN_ZERO_DEVICE_MEMORY_SIZE_IF_QUERIED(handle);
auto layer_mode = handle->layer_mode;
if(layer_mode
& (rocblas_layer_mode_log_trace | rocblas_layer_mode_log_bench
| rocblas_layer_mode_log_profile))
{
auto uplo_letter = rocblas_fill_letter(uplo);
auto transA_letter = rocblas_transpose_letter(trans);
if(handle->pointer_mode == rocblas_pointer_mode_host)
{
if(layer_mode & rocblas_layer_mode_log_trace)
log_trace(handle,
rocblas_her2k_name<T>,
uplo,
trans,
n,
k,
log_trace_scalar_value(alpha),
A,
lda,
B,
ldb,
log_trace_scalar_value(beta),
C,
ldc,
batch_count);
if(layer_mode & rocblas_layer_mode_log_bench)
log_bench(handle,
"./rocblas-bench -f her2k_batched -r",
rocblas_precision_string<T>,
"--uplo",
uplo_letter,
"--transposeA",
transA_letter,
"-n",
n,
"-k",
k,
LOG_BENCH_SCALAR_VALUE(alpha),
"--lda",
lda,
"--ldb",
ldb,
LOG_BENCH_SCALAR_VALUE(beta),
"--ldc",
ldc,
"--batch_count",
batch_count);
}
else
{
if(layer_mode & rocblas_layer_mode_log_trace)
log_trace(handle,
rocblas_her2k_name<T>,
uplo,
trans,
n,
k,
log_trace_scalar_value(alpha),
A,
lda,
B,
ldb,
log_trace_scalar_value(beta),
C,
ldc,
batch_count);
}
if(layer_mode & rocblas_layer_mode_log_profile)
log_profile(handle,
rocblas_her2k_name<T>,
"uplo",
uplo_letter,
"trans",
transA_letter,
"N",
n,
"K",
k,
"lda",
lda,
"ldb",
ldb,
"ldc",
ldc,
"batch_count",
batch_count);
}
static constexpr rocblas_int offset_C = 0, offset_A = 0, offset_B = 0;
static constexpr rocblas_stride stride_C = 0, stride_A = 0, stride_B = 0;
rocblas_status arg_status = rocblas_her2k_arg_check(handle,
uplo,
trans,
n,
k,
alpha,
A,
offset_A,
lda,
stride_A,
B,
offset_B,
ldb,
stride_B,
beta,
C,
offset_C,
ldc,
stride_C,
batch_count);
if(arg_status != rocblas_status_continue)
return arg_status;
return rocblas_her2k_template(handle,
uplo,
trans,
n,
k,
alpha,
A,
offset_A,
lda,
stride_A,
B,
offset_B,
ldb,
stride_B,
beta,
C,
offset_C,
ldc,
stride_C,
batch_count);
}
}
/*
* ===========================================================================
* C wrapper
* ===========================================================================
*/
extern "C" {
#ifdef IMPL
#error IMPL ALREADY DEFINED
#endif
#define IMPL(routine_name_, S_, T_) \
rocblas_status routine_name_(rocblas_handle handle, \
rocblas_fill uplo, \
rocblas_operation trans, \
rocblas_int n, \
rocblas_int k, \
const T_* alpha, \
const T_* const A[], \
rocblas_int lda, \
const T_* const B[], \
rocblas_int ldb, \
const S_* beta, \
T_* const C[], \
rocblas_int ldc, \
rocblas_int batch_count) \
try \
{ \
return rocblas_her2k_batched_impl( \
handle, uplo, trans, n, k, alpha, A, lda, B, ldb, beta, C, ldc, batch_count); \
} \
catch(...) \
{ \
return exception_to_rocblas_status(); \
}
IMPL(rocblas_cher2k_batched, float, rocblas_float_complex);
IMPL(rocblas_zher2k_batched, double, rocblas_double_complex);
#undef IMPL
} // extern "C"
|
#include "MephAppSingleton.h"
class MephAppSingleton * MephAppSingleton::mephappsingleton=0;
MephAppSingleton::MephAppSingleton()
{
}
MephAppSingleton::MephAppSingleton(const MephAppSingleton &right)
{
}
MephAppSingleton::~MephAppSingleton()
{
}
const MephAppSingleton & MephAppSingleton::operator=(const MephAppSingleton &right)
{
}
int MephAppSingleton::operator==(const MephAppSingleton &right) const
{
}
int MephAppSingleton::operator!=(const MephAppSingleton &right) const
{
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/partial_screenshot_event_filter.h"
#include "ash/wm/partial_screenshot_view.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
PartialScreenshotEventFilter::PartialScreenshotEventFilter()
: view_(NULL) {
}
PartialScreenshotEventFilter::~PartialScreenshotEventFilter() {
view_ = NULL;
}
bool PartialScreenshotEventFilter::PreHandleKeyEvent(
aura::Window* target, aura::KeyEvent* event) {
if (!view_)
return false;
// Do not consume a translated key event which is generated by an IME (e.g.,
// ui::VKEY_PROCESSKEY) since the key event is generated in response to a key
// press or release before showing the screenshot view. This is important not
// to confuse key event handling JavaScript code in a page.
if (event->type() == ui::ET_TRANSLATED_KEY_PRESS ||
event->type() == ui::ET_TRANSLATED_KEY_RELEASE) {
return false;
}
if (event->key_code() == ui::VKEY_ESCAPE)
Cancel();
// Always handled: other windows shouldn't receive input while we're
// taking a screenshot.
return true;
}
bool PartialScreenshotEventFilter::PreHandleMouseEvent(
aura::Window* target, aura::MouseEvent* event) {
if (view_) {
DCHECK_EQ(target, view_->GetWidget()->GetNativeWindow());
target->delegate()->OnMouseEvent(event);
return true;
}
return false; // Not handled.
}
ui::TouchStatus PartialScreenshotEventFilter::PreHandleTouchEvent(
aura::Window* target, aura::TouchEvent* event) {
return ui::TOUCH_STATUS_UNKNOWN; // Not handled.
}
ui::GestureStatus PartialScreenshotEventFilter::PreHandleGestureEvent(
aura::Window* target, aura::GestureEvent* event) {
return ui::GESTURE_STATUS_UNKNOWN; // Not handled.
}
void PartialScreenshotEventFilter::OnLoginStateChanged(
user::LoginStatus status) {
Cancel();
}
void PartialScreenshotEventFilter::OnAppTerminating() {
Cancel();
}
void PartialScreenshotEventFilter::OnLockStateChanged(bool locked) {
Cancel();
}
void PartialScreenshotEventFilter::Activate(PartialScreenshotView* view) {
view_ = view;
}
void PartialScreenshotEventFilter::Deactivate() {
view_ = NULL;
}
void PartialScreenshotEventFilter::Cancel() {
if (view_)
view_->Cancel();
}
} // namespace internal
} // namespace ash
|
// Copyright (c) 2019 The PIVX developers
// Copyright (c) 2020 The CLEARCOIN developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "qt/clr/optionbutton.h"
#include "qt/clr/forms/ui_optionbutton.h"
#include "qt/clr/qtutils.h"
#include <QMouseEvent>
OptionButton::OptionButton(QWidget *parent) :
QWidget(parent),
ui(new Ui::OptionButton)
{
ui->setupUi(this);
setCssProperty(ui->labelArrow3, "ic-arrow");
setCssProperty(ui->layoutOptions2, "container-options");
ui->layoutOptions2->setContentsMargins(0,10,10,10);
setCssProperty(ui->labelCircle, "btn-options-indicator");
connect(ui->labelArrow3, &QPushButton::clicked, [this](){setChecked(!ui->labelArrow3->isChecked());});
setActive(false);
}
OptionButton::~OptionButton()
{
delete ui;
}
void OptionButton::setTitleClassAndText(QString className, QString text)
{
ui->labelTitleChange->setText(text);
setCssProperty(ui->labelTitleChange, className);
}
void OptionButton::setTitleText(QString text)
{
ui->labelTitleChange->setText(text);
}
void OptionButton::setSubTitleClassAndText(QString className, QString text)
{
ui->labelSubtitleChange->setText(text);
setCssProperty(ui->labelSubtitleChange, className);
}
void OptionButton::setRightIconClass(QString className, bool forceUpdate)
{
setCssProperty(ui->labelArrow3, className);
if (forceUpdate) updateStyle(ui->labelArrow3);
}
void OptionButton::setRightIcon(QPixmap icon)
{
//ui->labelArrow3->setPixmap(icon);
}
void OptionButton::setActive(bool isActive)
{
if (isActive) {
ui->layoutCircle->setVisible(true);
setCssProperty(ui->labelTitleChange, "btn-title-purple");
updateStyle(ui->labelTitleChange);
} else {
ui->layoutCircle->setVisible(false);
setCssProperty(ui->labelTitleChange, "btn-title-grey");
updateStyle(ui->labelTitleChange);
}
}
void OptionButton::setChecked(bool checked)
{
ui->labelArrow3->setChecked(checked);
Q_EMIT clicked();
}
void OptionButton::mousePressEvent(QMouseEvent *qevent)
{
if (qevent->button() == Qt::LeftButton){
setChecked(!ui->labelArrow3->isChecked());
}
}
|
// Copyright (c) Facebook, Inc. and its affiliates.
// All rights reserved.
//
// This source code is licensed under the license found in the
// LICENSE file in the root directory of this source tree.
#include <string>
#include <cassert>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <set>
#include <algorithm>
#include <atomic>
#include <cstring>
#include "SearchBot.h"
#include <thread>
#include <mutex>
#include <shared_mutex>
using namespace Hanabi;
using namespace HanabiParams;
using namespace SearchBotParams;
namespace SearchBotParams {
float SEARCH_THRESH = Params::getParameterFloat("SEARCH_THRESH", 0.1,
"Search deviates from the blueprint only if the EV of a move exceeds the blueprint action EV by SEARCH_THRESH.");
}
static void _registerBots() {
registerBotFactory("SearchBot", std::shared_ptr<Hanabi::BotFactory>(new ::BotFactory<SearchBot>()));
}
static int dummy = (_registerBots(), 0);
void applyDelayedObservations(HandDist &handDist, const std::vector<BoxedHand> &handDistKeys) {
if (handDist.size() > DELAYED_OBS_THRESH) {
// bail to save memory
return;
}
std::vector<boost::fibers::future<void>> futures;
std::cerr << now() << "Applying "
<< handDist[handDistKeys[0]].delayed_observations.size() << " observations to "
<< handDistKeys.size() << " bots." << std::endl;
for (int t = 0; t < NUM_THREADS; t++) {
futures.push_back(getThreadPool().enqueue([&, t]() {
for (int i = t; i < handDistKeys.size(); i += NUM_THREADS) {
auto key = handDistKeys[i];
handDist.at(key).applyObservations();
}
}));
}
for (auto &f: futures) {
f.get();
}
std::cerr << now() << "Done applying delayed observations." << std::endl;
}
SearchBot::SearchBot(int index, int numPlayers, int handSize) : simulserver_(numPlayers)
{
std::cerr << now() << "SearchBotParams {" << std::endl; // legacy
me_ = index;
last_move_ = std::vector<Move>(numPlayers, Move());
std::cerr << now() << "Initializing sub-bots..." << std::endl;
auto botFactory = getBotFactory(SearchBotParams::BPBOT);
for (int player = 0; player < numPlayers; player++) {
auto bot = botFactory->create(player, numPlayers, handSize);
if (PARTNER_BOLTZMANN_UNC > 0 && player != me_) {
bot->setActionUncertainty(PARTNER_BOLTZMANN_UNC);
}
players_.push_back(std::shared_ptr<Bot>(bot));
players_.back()->setPermissive(true); // because we may not follow the blueprint
}
simulserver_.setPlayers(players_);
}
void SearchBot::populateInitialHandDistribution_(Hand &hand, float prob, DeckComposition &deck, int handSize, int who, HandDist &handDist, const BotVec &partners) {
// This function recursively populates a hand distribution with all possible
// five-card hands composed of the provided deck composition.
if (hand.size() == 0) {
hand.reserve(handSize);
}
if (hand.size() == handSize) {
if (handDist.size() % 1000000 == 0) {
std::cerr << now() << "Generated " << handDist.size() << " hands." << std::endl;
}
// assert(handDist.count(hand) == 0);
handDist[hand] = HandDistVal(prob, partners);
return;
}
for (auto &kv : deck) {
const Card &card = kv.first;
int count = kv.second;
if (count > 0) {
deck[card]--;
hand.push_back(card);
populateInitialHandDistribution_(hand, prob * count, deck, handSize, who, handDist, partners);
hand.pop_back();
deck[card]++;
}
}
}
void SearchBot::applyToAll(ObservationFunc f) {
simulserver_.applyToAll(f, hand_distribution_, me_);
}
void SearchBot::init_(const Server &server) {
// we have to generate the initial hand distribution here rather than in the constructor
// because we need access to the server to know what the partner hand is
assert(hand_distribution_.empty());
std::cerr << now() << "Generating initial hand distribution..." << std::endl;
DeckComposition deck = getCurrentDeckComposition(server, me_);
Hand hand;
auto partners = cloneBotVec(players_, me_);
populateInitialHandDistribution_(hand, 1, deck, server.handSize(), me_, hand_distribution_, partners);
std::cerr << now() << "Hand distribution contains " << hand_distribution_.size() << " hands." << std::endl;
}
void SearchBot::pleaseObserveBeforeMove(const Server &server) {
simulserver_.sync(server);
if (!inited_) {
this->init_(server);
inited_ = true;
}
assert(server.whoAmI() == me_);
simulserver_.sync(server);
std::cerr << now() << "applyToAll ObserveBeforeMove start" << std::endl;
applyToAll(
[](Bot *bot, const Server &server) { bot->pleaseObserveBeforeMove(server); }
);
std::cerr << now() << "applyToAll ObserveBeforeMove end" << std::endl;
}
void SearchBot::pleaseObserveBeforeDiscard(const Server &server, int from, int card_index) {
simulserver_.sync(server);
Move move(DISCARD_CARD, card_index);
last_move_[from] = move;
last_active_card_ = (from == me_) ? server.activeCard() : server.handOfPlayer(from)[card_index];
player_about_to_draw_ = from;
filterBeliefsConsistentWithAction_(move, from, server);
applyToAll(
[from, card_index](Bot *bot, const Server &server) {
bot->pleaseObserveBeforeDiscard(server, from, card_index); }
);
}
void SearchBot::pleaseObserveBeforePlay(const Server &server, int from, int card_index) {
simulserver_.sync(server);
Move move(PLAY_CARD, card_index);
last_move_[from] = move;
last_active_card_ = (from == me_) ? server.activeCard() : server.handOfPlayer(from)[card_index];
player_about_to_draw_ = from;
filterBeliefsConsistentWithAction_(move, from, server);
applyToAll(
[from, card_index](Bot *bot, const Server &server) {
bot->pleaseObserveBeforePlay(server, from, card_index); }
);
}
void SearchBot::pleaseObserveColorHint(const Server &server, int from, int to, Color color, CardIndices card_indices) {
simulserver_.sync(server);
Move move(HINT_COLOR, (int) color, to);
last_move_[from] = move;
filterBeliefsConsistentWithHint_(from, move, card_indices, server);
filterBeliefsConsistentWithAction_(move, from, server);
applyToAll(
[from, to, color, card_indices](Bot *bot, const Server &server) {
bot->pleaseObserveColorHint(server, from, to, color, card_indices); }
);
}
void SearchBot::pleaseObserveValueHint(const Server &server, int from, int to, Value value, CardIndices card_indices) {
simulserver_.sync(server);
Move move(HINT_VALUE, (int) value, to);
last_move_[from] = move;
filterBeliefsConsistentWithHint_(from, move, card_indices, server);
filterBeliefsConsistentWithAction_(move, from, server);
applyToAll(
[from, to, value, card_indices](Bot *bot, const Server &server) {
bot->pleaseObserveValueHint(server, from, to, value, card_indices); }
);
}
void SearchBot::pleaseObserveAfterMove(const Server &server) {
simulserver_.sync(server);
if (player_about_to_draw_ != -1) {
updateBeliefsFromDraw_(player_about_to_draw_, last_move_[player_about_to_draw_].value, last_active_card_, server);
player_about_to_draw_ = -1;
}
applyToAll(
[](Bot *bot, const Server &server){
bot->pleaseObserveAfterMove(server); }
);
if(server.gameOver() || server.finalCountdown() == server.numPlayers()) {
std::cout << "SearchBot changed " << changed_moves_ << " moves, gaining ";
if (DOUBLE_SEARCH) {
std::cout << unbiased_score_difference_ << " (unbiased) " << score_difference_ << " (biased) ";
std::cout << "Win delta: " << unbiased_win_difference_ << " (unbiased) ";
} else {
std::cout << score_difference_;
}
std::cout << " points. Total search iters: " << total_iters_ << std::endl;
}
}
void SearchBot::filterBeliefsConsistentWithHint_(
int from,
const Move &move,
const CardIndices &card_indices,
const Server &server) {
if (move.to != me_) {
return;
}
filterBeliefsConsistentWithHint_(from, move, card_indices, server, hand_distribution_);
checkBeliefs_(server);
}
void SearchBot::filterBeliefsConsistentWithHint_(
int from,
const Move &move,
const CardIndices &card_indices,
const Server &server,
HandDist &handDist,
const CardIndices *relevant_indices) const {
auto hand_dist_keys = copyKeys(handDist);
auto old_size = handDist.size();
for (auto &hand : hand_dist_keys) {
bool keep = true;
for (int i = 0; i < hand.size(); i++) {
if (relevant_indices && !relevant_indices->contains(i)) {
continue;
}
const Card &card = hand[i];
int card_value = move.type == HINT_COLOR ? (int) card.color : (int) card.value;
bool consistent = card_indices.contains(i) ?
card_value == move.value : // positive info
card_value != move.value; // negative info
if (!consistent) {
keep = false;
break;
}
}
if (!keep) {
handDist.erase(hand);
}
}
std::cerr << now() << "Player " << me_ << ": Filtered beliefs consistent with hint " << move.toString()
<< " reduced from " << old_size << " to " <<
handDist.size() << std::endl;
}
void SearchBot::filterBeliefsConsistentWithAction_(const Move &move, int from, const Server &server) {
if (from == me_) {
return;
}
{
// just for logging
auto cheat_hand = server.cheatGetHand(me_);
auto cheat_bot = hand_distribution_[cheat_hand].getPartner(from);
auto cheat_server = SimulServer(server);
cheat_server.setHand(me_, cheat_hand);
auto expected_move = cheat_server.simulatePlayerMove(from, cheat_bot->clone());
std::cerr << "SearchBot expected " << expected_move.toString() << " , observed " << move.toString() << std::endl;
}
if (PARTNER_UNIFORM_UNC == 1) {
return;
}
size_t old_size = hand_distribution_.size();
std::cerr << now() << "filterAction_ with " << old_size << " beliefs." << std::endl;
auto hand_dist_keys = copyKeys(hand_distribution_);
applyDelayedObservations(hand_distribution_, hand_dist_keys);
std::vector<boost::fibers::future<void>> futures;
for (int t = 0; t < NUM_THREADS; t++) {
futures.push_back(getThreadPool().enqueue([&, t]() {
SimulServer simulserver(simulserver_);
for (int i = t; i < hand_dist_keys.size(); i += NUM_THREADS) {
auto &hand = hand_dist_keys[i];
simulserver.setHand(me_, hand);
auto bot = hand_distribution_[hand].getPartner(from);
if (PARTNER_BOLTZMANN_UNC > 0) {
auto action_probs = bot->getActionProbs();
if (server.cheatGetHand(me_) == hand.get()) {
for (auto kv : action_probs) std::cerr << "Action " << kv.first << " : " <<kv.second << std::endl;
std::cerr << "Prob of " << move.toString() << " ( " << moveToIndex(move, server) << ") : " << action_probs[moveToIndex(move, server)] << std::endl;
}
hand_distribution_[hand].prob *= (action_probs[moveToIndex(move, server)] + PARTNER_UNIFORM_UNC);
} else {
Move cf_move = simulserver.simulatePlayerMove(from, bot.get());
if (move != cf_move) {
hand_distribution_[hand].prob *= PARTNER_UNIFORM_UNC;
}
}
}
}));
}
for (auto &f: futures) {
f.get();
}
for (auto &hand: hand_dist_keys) {
if (hand_distribution_[hand].prob == 0) {
hand_distribution_.erase(hand);
}
}
std::cerr << now() << "Player " << me_ << ": Filtered beliefs consistent with player " << from << " action '" << move.toString()
<< "' reduced from " << old_size << " to " <<
hand_distribution_.size() << std::endl;
checkBeliefs_(server);
}
void SearchBot::updateBeliefsFromDraw_(int who, int card_index, Card played_card, const Server &server) {
if (who == me_) {
updateBeliefsFromMyDraw_(who, card_index, played_card, server, hand_distribution_, false);
} else if (server.sizeOfHandOfPlayer(who) == server.handSize()) {
Card drawn_card = server.handOfPlayer(who).back();
updateBeliefsFromRevealedCard_(me_, drawn_card, server, hand_distribution_);
}
checkBeliefs_(server);
DeckComposition deck = getCurrentDeckComposition(server, -1);
}
void SearchBot::updateBeliefsFromMyDraw_(
int who,
int card_index,
Card played_card,
const Server &server,
HandDist &handDist,
bool public_beliefs) const
{
HandDist new_hand_distribution;
DeckComposition deck = getCurrentDeckComposition(server, public_beliefs ? -1 : who);
int hand_size = server.sizeOfHandOfPlayer(who);
for (auto &kv : handDist) {
const Hand &hand = kv.first;
//std::cerr << now() << "MyDraw_: " << handAsString(hand) << std::endl;
if (hand[card_index] != played_card) {
//std::cerr << now() << "pruned : (" << card_index << ") " << hand[card_index].toString() << " != " << played_card.toString() << std::endl;
continue;
}
Hand new_hand = hand;
new_hand.erase(new_hand.begin() + card_index);
// for (int i = 0; i < hand.size(); i++) {
// if (i != card_index) {
// new_hand.push_back(hand[i]);
// }
// }
// std::cerr << now() << "Removing from deck: " << handAsString(new_hand) << std::endl;
removeFromDeck(new_hand, deck);
if (server.sizeOfHandOfPlayer(who) == server.handSize()) {
// update distribution with all possible drawn cards
for (const auto &kv2 : deck) {
const Card &card = kv2.first;
int count = kv2.second;
//std::cerr << now() << "Added card: " << card.toString() << " with count " << count << std::endl;
if (count > 0) {
new_hand.push_back(card);
assert(new_hand.size() == hand_size);
assert(new_hand_distribution.count(new_hand) == 0);
new_hand_distribution[new_hand] = kv.second;
//std::cerr << now() << "new hand: " << handAsString(new_hand) << std::endl;
new_hand.pop_back();
}
}
} else {
// no new card drawn, just keep your old hand
assert(server.cardsRemainingInDeck() == 0 || server.gameOver());
assert(new_hand.size() == hand_size);
new_hand_distribution[new_hand] = kv.second;
}
addToDeck(new_hand, deck);
}
std::cerr << now() << "Player " << me_ << ": Filtered player " << who << " beliefs consistent with my draw; went from "
<< handDist.size() << " to " <<
new_hand_distribution.size() << std::endl;
handDist = new_hand_distribution;
}
void SearchBot::updateBeliefsFromRevealedCard_(
int who,
Card revealed_card,
const Server &server,
HandDist &handDist,
CardIndices *relevant_indices) const
{
DeckComposition deck = getCurrentDeckComposition(server, who);
int remaining = deck[revealed_card] + 1; // this is what was remaining *before* the draw
assert(remaining > 0);
int old_size = handDist.size();
auto hand_dist_keys = copyKeys(handDist);
for (auto &hand: hand_dist_keys) {
int in_hand = 0;
for (int i = 0; i < hand.size(); i++) {
const Card &my_card = hand[i];
if (relevant_indices && !relevant_indices->contains(i)) continue;
if (my_card == revealed_card) in_hand++;
}
if (in_hand > 0) {
auto &val = handDist[hand];
float new_prob = val.prob * (remaining - in_hand) / remaining;
if (new_prob > 0) {
val.prob = new_prob;
} else {
handDist.erase(hand);
}
}
}
std::cerr << now() << "Player " << me_ << ": Filtered player " << who << " beliefs consistent with revealed card " << revealed_card.toString()
<< " reduced from " << old_size << " to " <<
handDist.size() << std::endl;
}
void SearchBot::checkBeliefs_(const Server &server) const {
checkBeliefs_(server, me_, hand_distribution_, server.cheatGetHand(me_));
}
void SearchBot::checkBeliefs_(const Server &server, int who, const HandDist &handDist, const Hand &trueHand) const {
if (handDist.count(trueHand) == 0) {
std::cerr << now() << "ERROR: player's true hand not contained in beliefs" << std::endl;
std::cerr << now() << "Who am I? " << who << std::endl;
std::cerr << now() << "true hand: " << handAsString(trueHand) << std::endl;
std::cerr << now() << "Hands: " << server.handsAsString() << std::endl;
std::cerr << now() << "Discards: " << server.discardsAsString() << std::endl;
std::cerr << now() << "Piles: " << server.pilesAsString() << std::endl;
std::cerr << now() << "-------------------------" << std::endl;
std::cerr << now() << "Hand distribution: (count= " << handDist.size() << ")" << std::endl;
int count = 0;
for (auto &kv : handDist) {
std::cerr << now() << handAsString(kv.first) << std::endl;
if (count++ > 100) {
std::cerr << now() << "..." << std::endl;
break;
}
}
throw std::runtime_error("Belief check failed.");
} else {
// std::cerr << now() << "CheckBeliefs: Found player " << who << " true hand " << handAsString(trueHand) << " among " << handDist.size() << " beliefs." << std::endl;
}
}
static std::uniform_real_distribution<double> real_dist(0., 1.);
Hand sampleFromCDF_(const HandDistCDF &cdf, std::mt19937 &gen) {
double prob = real_dist(gen);
auto it = std::upper_bound(cdf.probs.begin(), cdf.probs.end(), prob);
int idx = it - cdf.probs.begin() - 1;
if (idx >= cdf.hands.size()) {
std::cerr << now() << "CDF uhoh: " << idx << " >= " << cdf.hands.size() << " [ "
<< cdf.probs.size() << " " << cdf.probs.back() << " " << prob << std::endl;
assert(0);
}
Hand hand = cdf.hands[idx];
assert(cdf.probs[idx + 1] - cdf.probs[idx] > 0 || idx + 1 == cdf.probs.size());
// std::cerr << now() << "Got prob " << prob << " sampled idx " << idx << " i.e. hand " << handAsString(hand) << " cdf: " << cdf.probs[idx] << std::endl;
return hand;
}
bool canPruneMove(const SearchStats &stats, Move move, Move bp_move) {
if (SEARCH_BASELINE && move == bp_move) {
return false;
}
if (!UCB) {
return false;
}
const UCBStats &this_ucb = stats.at(move);
Move best_move(INVALID_MOVE, 0);
if (SEARCH_BASELINE) {
double best_stderr = 0;
double best_mean = -100;
for (auto &kv: stats) {
if (!kv.second.pruned && (kv.second.mean + kv.second.bias > best_mean || best_move.type == INVALID_MOVE)) {
best_stderr = kv.second.search_baseline_stderr();
best_move = kv.first;
best_mean = kv.second.mean + kv.second.bias;
}
}
assert(best_move.type != INVALID_MOVE);
double this_stderr = this_ucb.search_baseline_stderr();
double this_mean = this_ucb.mean + this_ucb.bias;
double diff = best_mean - this_mean;
double combined_err = sqrt((this_stderr * this_stderr) + (best_stderr * best_stderr));
return diff - 2.5 * combined_err > 0;
}
else {
double best_lcb = 0;
for (auto &kv: stats) {
// std::cout << move.toString() << " : " << kv.second.lcb() << " " << best_lcb << std::endl;
if (kv.second.lcb() > best_lcb || best_move.type == INVALID_MOVE) {
best_lcb = kv.second.lcb();
best_move = kv.first;
}
}
assert(best_move.type != INVALID_MOVE);
return this_ucb.ucb() < best_lcb;
}
}
std::string oneMoveStatToString(const SearchStats &stats, Move m) {
if(stats.count(m)) {
char buff[100];
if (SEARCH_BASELINE) {
snprintf(buff, sizeof(buff), "%6.2f +/- %4.2g (%4d)",
stats.at(m).mean,
((float)((int) (stats.at(m).search_baseline_stderr() * 100))) / 100, stats.at(m).N);
}
else {
snprintf(buff, sizeof(buff), "%6.2f +/- %4.2g (%4d)",
stats.at(m).mean,
((float)((int) (stats.at(m).stderr() * 100))) / 100, stats.at(m).N);
}
return std::string(buff);
} else {
return " --- ";
}
}
void logSearchResults(const SearchStats &stats, int numPlayers, int me) {
std::cerr << now() << "Play: ";
for (int i = 0; i < 5; i++) {
std::cerr << i << ": ";
std::cerr << oneMoveStatToString(stats, Move(PLAY_CARD, i)) << " ";
}
std::cerr << std::endl;
std::cerr << now() << "Discard: ";
for (int i = 0; i < 5; i++) {
std::cerr << i << ": ";
std::cerr << oneMoveStatToString(stats, Move(DISCARD_CARD, i)) << " ";
}
std::cerr << std::endl;
for (int to = 0; to < numPlayers; to++) {
if (to == me) continue;
std::cerr << now() << "Hint Color to " << to << ": ";
for (Color color = RED; color < NUMCOLORS; color++) {
std::cerr << colorname(color)[0] << ": ";
std::cerr << oneMoveStatToString(stats, Move(HINT_COLOR, color, to)) << " ";
}
std::cerr << std::endl;
std::cerr << now() << "Hint Value to " << to << ": ";
for (Value value = ONE; value <= VALUE_MAX; value++) {
std::cerr << value << ": ";
std::cerr << oneMoveStatToString(stats, Move(HINT_VALUE, value, to)) << " ";
}
std::cerr << std::endl;
}
}
template<class It, class Gen>
static void portable_shuffle(It first, It last, Gen& g)
{
const int n = (last - first);
for (int i=0; i < n; ++i) {
int j = (g() % (i + 1));
if (j != i) {
using std::swap;
swap(first[i], first[j]);
}
}
}
class Barrier {
public:
explicit Barrier(std::size_t iCount) :
mThreshold(iCount),
mCount(iCount),
mGeneration(0) {
}
void wait() {
std::unique_lock<std::mutex> lLock{mMutex};
auto lGen = mGeneration;
if (!--mCount) {
mGeneration++;
mCount = mThreshold;
mCond.notify_all();
} else {
mCond.wait(lLock, [this, lGen] { return lGen != mGeneration; });
}
}
private:
std::mutex mMutex;
boost::fibers::condition_variable_any mCond;
std::size_t mThreshold;
std::size_t mCount;
std::size_t mGeneration;
};
int oneSearchIter_(
Bot *me_bot,
int who,
const Move &sampled_move,
const HandDistCDF &cdf,
const Server &server,
const HandDist &handDist,
std::mt19937 &gen
){
// pick a hand from the beliefs, and a move, and a deck
Hand sampled_hand = sampleFromCDF_(cdf, gen);
// sample a deck
DeckComposition search_deck = getCurrentDeckComposition(server, who);
removeFromDeck(sampled_hand, search_deck);
std::vector<Card> deck_order;
for(auto kv : search_deck) {
for (int i = 0; i < kv.second; i++) deck_order.push_back(kv.first);
}
portable_shuffle(deck_order.begin(), deck_order.end(), gen);
// setup server
SimulServer search_server(server);
auto &distval = handDist.at(sampled_hand);
BotVec search_bots;
for(int p = 0; p < server.numPlayers(); p++) {
if (p == who) search_bots.push_back(std::shared_ptr<Bot>(me_bot->clone()));
else search_bots.push_back(distval.getPartner(p));
}
search_server.setPlayers(search_bots);
search_server.setHand(who, sampled_hand);
search_server.setDeck(deck_order);
execute_(server.whoAmI(), sampled_move, search_server);
for(int i = 0; i < search_bots.size(); i++) {
search_server.setObservingPlayer(i);
search_bots[i]->pleaseObserveAfterMove(search_server);
}
search_server.incrementActivePlayer();
// sanity check
for(int p = 0; p < search_server.numPlayers(); p++) {
const Hand &hand = search_server.cheatGetHand(p);
for (const Card &card : hand) {
assert(card.color != INVALID_COLOR);
}
}
// simulate!
int score = search_server.runToCompletion();
return score;
}
inline void accumScore(int score, int bp_score, Move &move, SearchStats &stats, SearchStats *win_stats) {
if (score == -1) { // skipped
return;
}
assert(score >= 0);
int adj_score = score;
if (SEARCH_BASELINE) {
assert(bp_score >= 0);
adj_score = score - bp_score;
}
stats[move].add(OPTIMIZE_WINS ? (score == 25 ? 1 : 0) : adj_score);
if (win_stats) {
(*win_stats)[move].add(score == 25);
}
}
Move SearchBot::doSearch_(
int who,
Move bp_move,
Move frame_move,
Bot *me_bot,
const HandDist &handDist,
const HandDistCDF &cdf,
SearchStats &stats,
std::mt19937 &gen,
const Server &server,
bool verbose,
SearchStats *win_stats) const {
// n.b. the probabilities in handDist may not be right, because it's too
// slow to update them for public -> private conversion. The probabilities in
// cdf are considered the ground truth for the purposes of search
std::vector<Move> moves = enumerateLegalMoves(server);
int num_moves = moves.size();
for (auto &move : moves) {
stats[move] = UCBStats();
if (win_stats) (*win_stats)[move] = UCBStats();
}
stats[bp_move].bias = SEARCH_THRESH;
std::atomic<int> loop_count(0);
if (verbose) {
std::cerr << now() << "search player " << server.whoAmI() << " start" << std::endl;
}
bool frame_bail = false;
int prune_count = 0;
int bp_mi = -1;
int frame_mi = -1;
for (int mi = 0; mi < num_moves; mi++) {
if (moves.at(mi) == bp_move) {
bp_mi = mi;
}
if (frame_move != Move() && moves.at(mi) == frame_move) {
frame_mi = mi;
}
}
//We use this to facilitate baseline usage. Shouldn't make a big difference
int temp_num_threads = NUM_THREADS - (NUM_THREADS % num_moves);
assert(temp_num_threads >= num_moves);
//std::cerr << "Temporary number of threads: " << temp_num_threads << std::endl;
int temp_search_n = SEARCH_N - (SEARCH_N % temp_num_threads);
std::vector<boost::fibers::future<void>> futures;
std::mutex mtx;
Barrier barrier(temp_num_threads);
std::uniform_int_distribution<int> uid1(0, 1 << 30);
std::vector<int> seeds(SEARCH_N / num_moves + 1);
for(int i = 0; i < seeds.size(); i++) seeds[i] = uid1(gen);
std::vector<int> scores(SEARCH_N, -2);
int accumed = 0;
for (int t = 0; t < temp_num_threads; t++) {
futures.push_back(getThreadPool().enqueue([&, t](){
for (int j = t; j < temp_search_n; j += temp_num_threads) {
if (frame_bail || prune_count >= num_moves - 1) {
break;
}
// multi-threaded stuff
int mi = j % num_moves;
int g = j / num_moves;
if (seeds[g] == 0) {
std::cerr << "WARNING: seed is 0!\n";
}
assert(g < seeds.size());
std::mt19937 my_gen(seeds[g]);
auto sampled_move = moves.at(mi);
if (!stats[sampled_move].pruned) {
loop_count++;
scores[j] = oneSearchIter_(me_bot, who, sampled_move, cdf, server, handDist, my_gen);
} else {
scores[j] = -1; // sentinel
}
// single-threaded stuff
if (UCB && j + temp_num_threads < temp_search_n) {
barrier.wait();
if (t == 0) {
for (int k = j; k < j + temp_num_threads; k++) {
int bp_score = scores[k - (k % num_moves) + bp_mi];
accumScore(scores[k], bp_score, moves[k % num_moves], stats, win_stats);
}
for (int mi = 0; mi < num_moves; mi++) {
if (!stats[moves[mi]].pruned && canPruneMove(stats, moves[mi], bp_move)) {
stats[moves[mi]].pruned = true;
prune_count++;
if (moves[mi] == frame_move) {
frame_bail = true;
}
}
}
accumed += temp_num_threads;
} // if (t == 0)
barrier.wait();
}
}
}));
}
for(auto &f: futures) {
f.get();
}
if (frame_bail) { //Then all that matters is we didn't choose the observed action
return Move();
}
if (prune_count < num_moves - 1) { // accumulate the stragglers
for (int k = accumed; k < temp_search_n; k++) {
int bp_score = scores[k - (k % num_moves) + bp_mi];
accumScore(scores[k], bp_score, moves[k % num_moves], stats, win_stats);
}
}
total_iters_ += loop_count;
Move best_move;
double best_score = -1;
for(auto &kv: stats) {
if (kv.second.pruned) continue;
if (kv.second.mean + kv.second.bias > best_score) {
best_move = kv.first;
best_score = kv.second.mean + kv.second.bias;
}
}
if (verbose) {
std::cerr << now() << "Ran " << loop_count << " search iters over " << num_moves << " moves. ( " << server.handsAsString()
<< " ) , p " << server.whoAmI() << " --> " << best_move.toString() << " (" << stats[best_move].mean << ") [bp " << bp_move.toString() << " (" << stats[bp_move].mean << ") ]" << std::endl << std::flush;
}
return best_move;
}
void SearchBot::pleaseMakeMove(Server &server)
{
simulserver_.sync(server);
Move bp_move = simulserver_.simulatePlayerMove(me_, players_[me_].get());
std::cerr << now() << "Blueprint strat says to play " << bp_move.toString() << std::endl;
SearchStats stats;
auto hand_dist_keys = copyKeys(hand_distribution_);
applyDelayedObservations(hand_distribution_, hand_dist_keys);
HandDistCDF cdf = populateHandDistCDF(hand_distribution_);
Move move = doSearch_(me_, bp_move, Move(), players_[me_].get(), hand_distribution_, cdf, stats, gen_, server);
logSearchResults(stats, server.numPlayers(), me_);
if (bp_move != move) std::cerr << now() << "Search changed move. ";
std::cerr << now() << "Blueprint picked " << bp_move.toString() << " with average score " << stats[bp_move].mean
<< "; search picked " << move.toString() << " with average score " << stats[move].mean << std::endl;
if (move != bp_move) {
changed_moves_++;
score_difference_ += stats[move].mean - stats[bp_move].mean;
if (DOUBLE_SEARCH) {
SearchStats unbiased_stats;
SearchStats unbiased_win_stats;
doSearch_(me_, bp_move, Move(), players_[me_].get(), hand_distribution_, cdf, unbiased_stats, gen_, server, false, &unbiased_win_stats);
unbiased_score_difference_ += unbiased_stats[move].mean - unbiased_stats[bp_move].mean;
unbiased_win_difference_ += unbiased_win_stats[move].mean - unbiased_win_stats[bp_move].mean;
}
}
execute_(me_, move, server);
}
|
// Copyright (c) 2011 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.
// Original author: Jim Blandy <jimb@mozilla.com> <jimb@red-bean.com>
// module.cc: Implement google_breakpad::Module. See module.h.
#include "common/module.h"
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <utility>
namespace google_breakpad {
using std::dec;
using std::hex;
Module::Module(const string& name, const string& os,
const string& architecture, const string& id,
const string& code_id /* = "" */) :
name_(name),
os_(os),
architecture_(architecture),
id_(id),
code_id_(code_id),
load_address_(0) { }
Module::~Module() {
for (FileByNameMap::iterator it = files_.begin(); it != files_.end(); ++it)
delete it->second;
for (FunctionSet::iterator it = functions_.begin();
it != functions_.end(); ++it) {
delete *it;
}
for (vector<StackFrameEntry*>::iterator it = stack_frame_entries_.begin();
it != stack_frame_entries_.end(); ++it) {
delete *it;
}
for (ExternSet::iterator it = externs_.begin(); it != externs_.end(); ++it)
delete *it;
}
void Module::SetLoadAddress(Address address) {
load_address_ = address;
}
void Module::SetAddressRanges(const vector<Range>& ranges) {
address_ranges_ = ranges;
}
void Module::AddFunction(Function* function) {
// FUNC lines must not hold an empty name, so catch the problem early if
// callers try to add one.
assert(!function->name.empty());
if (!AddressIsInModule(function->address)) {
return;
}
// FUNCs are better than PUBLICs as they come with sizes, so remove an extern
// with the same address if present.
Extern ext(function->address);
ExternSet::iterator it_ext = externs_.find(&ext);
if (it_ext == externs_.end() &&
architecture_ == "arm" &&
(function->address & 0x1) == 0) {
// ARM THUMB functions have bit 0 set. ARM64 does not have THUMB.
Extern arm_thumb_ext(function->address | 0x1);
it_ext = externs_.find(&arm_thumb_ext);
}
if (it_ext != externs_.end()) {
delete *it_ext;
externs_.erase(it_ext);
}
#if _DEBUG
{
// There should be no other PUBLIC symbols that overlap with the function.
for (const Range& range : function->ranges) {
Extern debug_ext(range.address);
ExternSet::iterator it_debug = externs_.lower_bound(&ext);
assert(it_debug == externs_.end() ||
(*it_debug)->address >= range.address + range.size);
}
}
#endif
std::pair<FunctionSet::iterator,bool> ret = functions_.insert(function);
if (!ret.second && (*ret.first != function)) {
// Free the duplicate that was not inserted because this Module
// now owns it.
delete function;
}
}
void Module::AddFunctions(vector<Function*>::iterator begin,
vector<Function*>::iterator end) {
for (vector<Function*>::iterator it = begin; it != end; ++it)
AddFunction(*it);
}
void Module::AddStackFrameEntry(StackFrameEntry* stack_frame_entry) {
if (!AddressIsInModule(stack_frame_entry->address)) {
return;
}
stack_frame_entries_.push_back(stack_frame_entry);
}
void Module::AddExtern(Extern* ext) {
if (!AddressIsInModule(ext->address)) {
return;
}
std::pair<ExternSet::iterator,bool> ret = externs_.insert(ext);
if (!ret.second) {
// Free the duplicate that was not inserted because this Module
// now owns it.
delete ext;
}
}
void Module::GetFunctions(vector<Function*>* vec,
vector<Function*>::iterator i) {
vec->insert(i, functions_.begin(), functions_.end());
}
void Module::GetExterns(vector<Extern*>* vec,
vector<Extern*>::iterator i) {
vec->insert(i, externs_.begin(), externs_.end());
}
Module::File* Module::FindFile(const string& name) {
// A tricky bit here. The key of each map entry needs to be a
// pointer to the entry's File's name string. This means that we
// can't do the initial lookup with any operation that would create
// an empty entry for us if the name isn't found (like, say,
// operator[] or insert do), because such a created entry's key will
// be a pointer the string passed as our argument. Since the key of
// a map's value type is const, we can't fix it up once we've
// created our file. lower_bound does the lookup without doing an
// insertion, and returns a good hint iterator to pass to insert.
// Our "destiny" is where we belong, whether we're there or not now.
FileByNameMap::iterator destiny = files_.lower_bound(&name);
if (destiny == files_.end()
|| *destiny->first != name) { // Repeated string comparison, boo hoo.
File* file = new File(name);
file->source_id = -1;
destiny = files_.insert(destiny,
FileByNameMap::value_type(&file->name, file));
}
return destiny->second;
}
Module::File* Module::FindFile(const char* name) {
string name_string = name;
return FindFile(name_string);
}
Module::File* Module::FindExistingFile(const string& name) {
FileByNameMap::iterator it = files_.find(&name);
return (it == files_.end()) ? NULL : it->second;
}
void Module::GetFiles(vector<File*>* vec) {
vec->clear();
for (FileByNameMap::iterator it = files_.begin(); it != files_.end(); ++it)
vec->push_back(it->second);
}
void Module::GetStackFrameEntries(vector<StackFrameEntry*>* vec) const {
*vec = stack_frame_entries_;
}
void Module::AssignSourceIds() {
// First, give every source file an id of -1.
for (FileByNameMap::iterator file_it = files_.begin();
file_it != files_.end(); ++file_it) {
file_it->second->source_id = -1;
}
// Next, mark all files actually cited by our functions' line number
// info, by setting each one's source id to zero.
for (FunctionSet::const_iterator func_it = functions_.begin();
func_it != functions_.end(); ++func_it) {
Function* func = *func_it;
for (vector<Line>::iterator line_it = func->lines.begin();
line_it != func->lines.end(); ++line_it)
line_it->file->source_id = 0;
}
// Finally, assign source ids to those files that have been marked.
// We could have just assigned source id numbers while traversing
// the line numbers, but doing it this way numbers the files in
// lexicographical order by name, which is neat.
int next_source_id = 0;
for (FileByNameMap::iterator file_it = files_.begin();
file_it != files_.end(); ++file_it) {
if (!file_it->second->source_id)
file_it->second->source_id = next_source_id++;
}
}
bool Module::ReportError() {
fprintf(stderr, "error writing symbol file: %s\n",
strerror(errno));
return false;
}
bool Module::WriteRuleMap(const RuleMap& rule_map, std::ostream& stream) {
for (RuleMap::const_iterator it = rule_map.begin();
it != rule_map.end(); ++it) {
if (it != rule_map.begin())
stream << ' ';
stream << it->first << ": " << it->second;
}
return stream.good();
}
bool Module::AddressIsInModule(Address address) const {
if (address_ranges_.empty()) {
return true;
}
for (const auto& segment : address_ranges_) {
if (address >= segment.address &&
address < segment.address + segment.size) {
return true;
}
}
return false;
}
bool Module::Write(std::ostream& stream, SymbolData symbol_data) {
stream << "MODULE " << os_ << " " << architecture_ << " "
<< id_ << " " << name_ << "\n";
if (!stream.good())
return ReportError();
if (!code_id_.empty()) {
stream << "INFO CODE_ID " << code_id_ << "\n";
}
if (symbol_data != ONLY_CFI) {
AssignSourceIds();
// Write out files.
for (FileByNameMap::iterator file_it = files_.begin();
file_it != files_.end(); ++file_it) {
File* file = file_it->second;
if (file->source_id >= 0) {
stream << "FILE " << file->source_id << " " << file->name << "\n";
if (!stream.good())
return ReportError();
}
}
// Write out functions and their lines.
for (FunctionSet::const_iterator func_it = functions_.begin();
func_it != functions_.end(); ++func_it) {
Function* func = *func_it;
vector<Line>::iterator line_it = func->lines.begin();
for (auto range_it = func->ranges.cbegin();
range_it != func->ranges.cend(); ++range_it) {
stream << "FUNC " << hex
<< (range_it->address - load_address_) << " "
<< range_it->size << " "
<< func->parameter_size << " "
<< func->name << dec << "\n";
if (!stream.good())
return ReportError();
while ((line_it != func->lines.end()) &&
(line_it->address >= range_it->address) &&
(line_it->address < (range_it->address + range_it->size))) {
stream << hex
<< (line_it->address - load_address_) << " "
<< line_it->size << " "
<< dec
<< line_it->number << " "
<< line_it->file->source_id << "\n";
if (!stream.good())
return ReportError();
++line_it;
}
}
}
// Write out 'PUBLIC' records.
for (ExternSet::const_iterator extern_it = externs_.begin();
extern_it != externs_.end(); ++extern_it) {
Extern* ext = *extern_it;
stream << "PUBLIC " << hex
<< (ext->address - load_address_) << " 0 "
<< ext->name << dec << "\n";
}
}
if (symbol_data != NO_CFI) {
// Write out 'STACK CFI INIT' and 'STACK CFI' records.
vector<StackFrameEntry*>::const_iterator frame_it;
for (frame_it = stack_frame_entries_.begin();
frame_it != stack_frame_entries_.end(); ++frame_it) {
StackFrameEntry* entry = *frame_it;
stream << "STACK CFI INIT " << hex
<< (entry->address - load_address_) << " "
<< entry->size << " " << dec;
if (!stream.good()
|| !WriteRuleMap(entry->initial_rules, stream))
return ReportError();
stream << "\n";
// Write out this entry's delta rules as 'STACK CFI' records.
for (RuleChangeMap::const_iterator delta_it = entry->rule_changes.begin();
delta_it != entry->rule_changes.end(); ++delta_it) {
stream << "STACK CFI " << hex
<< (delta_it->first - load_address_) << " " << dec;
if (!stream.good()
|| !WriteRuleMap(delta_it->second, stream))
return ReportError();
stream << "\n";
}
}
}
return true;
}
} // namespace google_breakpad
|
/*
* Copyright 2020 MusicScience37 (Kenta Kabashima)
*
* 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.
*/
/*!
* \file
* \brief test of helpers for basic_endpoint class
*/
#include "mprpc/transport/asio_helper/basic_endpoint.h"
#include <cstdint>
#include <asio/ip/tcp.hpp>
#include <catch2/catch_test_macros.hpp>
#include "mprpc/logging/format_log_data.h"
TEST_CASE("mprpc::logging::log_data_traits<asio::ip::tcp::endpoint>") {
SECTION("format an IP v4 address") {
const auto address = asio::ip::address_v4::from_string("192.0.2.0");
constexpr std::uint16_t port = 12345;
const auto endpoint = asio::ip::tcp::endpoint(address, port);
REQUIRE(mprpc::logging::format_log_data("{}", endpoint) ==
"192.0.2.0:12345");
}
SECTION("format an IP v6 address") {
const auto address = asio::ip::address_v6::from_string(
"2001:db8:85a3:0:0:8a2e:370:7334");
constexpr std::uint16_t port = 4321;
const auto endpoint = asio::ip::tcp::endpoint(address, port);
REQUIRE(mprpc::logging::format_log_data("{}", endpoint) ==
"[2001:db8:85a3::8a2e:370:7334]:4321");
}
}
|
/*
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include <string>
#include "engine/alice/alice_codelet.hpp"
#include "engine/gems/sight/sight_interface.hpp"
namespace isaac {
namespace sight {
// Interface for sight.
// Provide a default implementation which does nothing.
class AliceSight : public alice::Codelet, public SightInterface {
public:
void start() override;
void stop() override;
void plotValue(const std::string& name, double time, float value) override;
void plotValue(const std::string& name, double time, double value) override;
void plotValue(const std::string& name, double time, int value) override;
void plotValue(const std::string& name, double time, int64_t value) override;
void log(const char* file, int line, logger::Severity severity, const char* log,
double time) override;
void drawCanvas(const std::string& name, sight::Sop sop) override;
};
} // namespace sight
} // namespace isaac
ISAAC_ALICE_REGISTER_CODELET(isaac::sight::AliceSight);
|
/*****************************************************
* PROJECT : ummap-io-v2 *
* LICENSE : Apache 2.0 *
* COPYRIGHT: 2020-2021 Bull SAS All rights reserved *
*****************************************************/
#ifndef UMMAP_FD_DRIVER_HPP
#define UMMAP_FD_DRIVER_HPP
/******************** HEADERS *********************/
#include "../core/Driver.hpp"
/******************** NAMESPACE *******************/
namespace ummapio
{
/********************* CLASS **********************/
/**
* Implement a driver accessing the a file via its file descriptor.
**/
class FDDriver : public Driver
{
public:
FDDriver(int fd);
~FDDriver(void);
virtual ssize_t pwrite(const void * buffer, size_t size, size_t offset) override;
virtual ssize_t pread(void * buffer, size_t size, size_t offset) override;
virtual void sync(void * ptr, size_t offset, size_t size) override;
void setFd(int fd);
int getFd(void) {return fd;};
bool cloneRange(int targetFd, size_t offset, size_t size);
private:
/** File descriptor to be used for data transfers **/
int fd;
};
}
#endif //UMMAP_FD_DRIVER_HPP
|
#include <vcg/complex/algorithms/create/platonic.h>
using namespace vcg;
using namespace std;
class MyFace;
class MyVertex;
struct MyUsedTypes : public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::AsFaceType> {};
class MyVertex : public Vertex< MyUsedTypes,
vertex::Coord3f,
vertex::Normal3f,
vertex::BitFlags,
vertex::VFAdj
> {};
class MyFace : public Face< MyUsedTypes,
face::VertexRef,
face::Normal3f,
face::VFAdj,
face::BitFlags
> {};
class MyMesh : public tri::TriMesh<
vector<MyVertex>,
vector<MyFace>
> {};
int main(){
MyMesh mesh;
vcg::tri::Octahedron(mesh); // create preset mesh data
MyMesh::FaceIterator fi;
for(fi=mesh.face.begin(); fi!=mesh.face.end(); ++fi){ // iterate each faces
std::cout << vcg::tri::Index(mesh, *fi) << ": "; // get face index
for(int i=0; i<fi->VN(); ++i){ // iterate each vertex of face
std::cout << vcg::tri::Index(mesh, fi->V(i)) << ","; // get vertex index
}
std::cout << std::endl;
}
return 1;
}
|
#include "../vidhrdw/copsnrob.cpp"
#include "../machine/copsnrob.cpp"
/***************************************************************************
Cops'n Robbers memory map (preliminary)
driver by Zsolt Vasvari
0000-00ff RAM
0c00-0fff Video RAM
1200-1fff ROM
I/O Read:
1000 Vertical Sync
1002 Bit 0-6 Player 1 Gun Position
Bit 7 Player 1 Gas Pedal
1006 Same as above for Player 2
100A Same as above for Player 3
100E Same as above for Player 4
1012 DIP Switches
0-1 Coinage
2-3 Time Limit
4-7 Fire button for Player 1-4
1016 Bit 6 - Start 1
Bit 7 - Coin 1
101A Bit 6 - Start 2
Bit 7 - Coin 2
I/O Write:
0500-0503 Direction of the cars
0504-0507 ???
0600 Beer Truck Y
0700-07ff Beer Truck Sync Area
0800-08ff Bullets RAM
0900-0903 Car Sprite #
0a00-0a03 Car Y Pos
0b00-0bff Car Sync Area
1000 ??? Sound effect and start led triggers must be here
1001-1003 ???
***************************************************************************/
#include "driver.h"
#include "vidhrdw/generic.h"
extern unsigned char *copsnrob_bulletsram;
extern unsigned char *copsnrob_carimage;
extern unsigned char *copsnrob_cary;
extern unsigned char *copsnrob_trucky;
extern unsigned char *copsnrob_truckram;
READ_HANDLER( copsnrob_gun_position_r );
int copsnrob_vh_start(void);
void copsnrob_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
static struct MemoryReadAddress readmem[] =
{
{ 0x0000, 0x01ff, MRA_RAM },
{ 0x0800, 0x08ff, MRA_RAM },
{ 0x0b00, 0x0bff, MRA_RAM },
{ 0x0c00, 0x0fff, MRA_RAM },
{ 0x1000, 0x1000, input_port_0_r },
{ 0x1002, 0x100e, copsnrob_gun_position_r},
{ 0x1012, 0x1012, input_port_3_r },
{ 0x1016, 0x1016, input_port_1_r },
{ 0x101a, 0x101a, input_port_2_r },
{ 0x1200, 0x1fff, MRA_ROM },
{ 0xfff8, 0xffff, MRA_ROM },
{ -1 } /* end of table */
};
static struct MemoryWriteAddress writemem[] =
{
{ 0x0000, 0x01ff, MWA_RAM },
{ 0x0500, 0x0503, MWA_RAM },
{ 0x0504, 0x0507, MWA_NOP }, // ???
{ 0x0600, 0x0600, MWA_RAM, &copsnrob_trucky },
{ 0x0700, 0x07ff, MWA_RAM, &copsnrob_truckram },
{ 0x0800, 0x08ff, MWA_RAM, &copsnrob_bulletsram },
{ 0x0900, 0x0903, MWA_RAM, &copsnrob_carimage },
{ 0x0a00, 0x0a03, MWA_RAM, &copsnrob_cary },
{ 0x0b00, 0x0bff, MWA_RAM },
{ 0x0c00, 0x0fff, MWA_RAM, &videoram, &videoram_size },
{ 0x1000, 0x1003, MWA_NOP },
{ 0x1200, 0x1fff, MWA_ROM },
{ 0xfff8, 0xffff, MWA_ROM },
{ -1 } /* end of table */
};
INPUT_PORTS_START( copsnrob )
PORT_START /* IN0 */
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_VBLANK )
PORT_START /* IN1 */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_START /* IN2 */
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START /* DIP1 */
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x03, "1 Coin/1 Player" )
PORT_DIPSETTING( 0x02, "1 Coin/2 Players" )
PORT_DIPSETTING( 0x01, "1 Coin/Game" )
PORT_DIPSETTING( 0x00, "2 Coins/1 Player" )
PORT_DIPNAME( 0x0c, 0x00, "Time Limit" )
PORT_DIPSETTING( 0x0c, "1min" )
PORT_DIPSETTING( 0x08, "1min 45sec" )
PORT_DIPSETTING( 0x04, "2min 20sec" )
PORT_DIPSETTING( 0x00, "3min" )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3)
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1)
/* These input ports are fake */
PORT_START /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_PLAYER1 | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER1 | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
PORT_START /* IN4 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER2 | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
PORT_START /* IN5 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_PLAYER3 | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER3 | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
PORT_START /* IN6 */
PORT_BIT( 0x01, IP_ACTIVE_HIGH,IPT_JOYSTICK_UP | IPF_PLAYER4 | IPF_4WAY )
PORT_BIT( 0x02, IP_ACTIVE_HIGH,IPT_JOYSTICK_DOWN | IPF_PLAYER4 | IPF_4WAY )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
INPUT_PORTS_END
static struct GfxLayout charlayout =
{
8,8, /* 8*8 characters */
64, /* 64 characters */
1, /* 1 bit per pixel */
{ 0 }, /* no separation in 1 bpp */
{ 0, 1, 2, 3, 4, 5, 6, 7},
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8 /* every char takes 8 consecutive bytes */
};
static struct GfxLayout carlayout =
{
32,32, /* 32*32 sprites */
16, /* 16 sprites */
1, /* 1 bit per pixel */
{ 0 }, /* no separation in 1 bpp */
{ 7, 6, 5, 4, 3, 2, 1, 0,
15, 14, 13, 12, 11, 10, 9, 8,
23, 22, 21, 20, 19, 18, 17, 16,
31, 30, 29, 28, 27, 26, 25, 24},
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32,
16*32, 17*32, 18*32, 19*32, 20*32, 21*32, 22*32, 23*32,
24*32, 25*32, 26*32, 27*32, 28*32, 29*32, 30*32, 31*32 },
32*32 /* every sprite takes 128 consecutive bytes */
};
static struct GfxLayout trucklayout =
{
16,32, /* 16*32 sprites */
2, /* 2 sprites */
1, /* 1 bit per pixel */
{ 0 }, /* no separation in 1 bpp */
{ 3*256+4, 3*256+5, 3*256+6, 3*256+7, 2*256+4, 2*256+5, 2*256+6, 2*256+7,
1*256+4, 1*256+5, 1*256+6, 1*256+7, 0*256+4, 0*256+5, 0*256+6, 0*256+7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8,
24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8 },
32*32 /* every sprite takes 128 consecutive bytes */
};
static struct GfxDecodeInfo gfxdecodeinfo[] =
{
{ REGION_GFX1, 0, &charlayout, 0, 1 },
{ REGION_GFX2, 0, &carlayout, 0, 1 },
{ REGION_GFX3, 0, &trucklayout, 0, 1 },
{ -1 } /* end of array */
};
static unsigned char palette[] =
{
0x00,0x00,0x00, /* black */
0xff,0xff,0xff /* white */
};
static unsigned short colortable[] =
{
0x00, 0x01
};
static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
{
memcpy(game_palette,palette,sizeof(palette));
memcpy(game_colortable,colortable,sizeof(colortable));
}
static struct MachineDriver machine_driver_copsnrob =
{
/* basic machine hardware */
{
{
CPU_M6502,
14318180/16, /* 894886.25 kHz */
readmem,writemem,0,0,
ignore_interrupt,1
}
},
60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
1, /* single CPU, no need for interleaving */
0,
/* video hardware */
32*8, 32*8, { 0*8, 32*8-1, 0*8, 26*8-1 },
gfxdecodeinfo,
2+32768, 2,
init_palette,
VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
0,
copsnrob_vh_start,
0,
copsnrob_vh_screenrefresh,
/* sound hardware */
0,0,0,0
};
/***************************************************************************
Game driver(s)
***************************************************************************/
ROM_START( copsnrob )
ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
ROM_LOAD( "5777.l7", 0x1200, 0x0200, 0x2b62d627 )
ROM_LOAD( "5776.k7", 0x1400, 0x0200, 0x7fb12a49 )
ROM_LOAD( "5775.j7", 0x1600, 0x0200, 0x627dee63 )
ROM_LOAD( "5774.h7", 0x1800, 0x0200, 0xdfbcb7f2 )
ROM_LOAD( "5773.e7", 0x1a00, 0x0200, 0xff7c95f4 )
ROM_LOAD( "5772.d7", 0x1c00, 0x0200, 0x8d26afdc )
ROM_LOAD( "5771.b7", 0x1e00, 0x0200, 0xd61758d6 )
ROM_RELOAD( 0xfe00, 0x0200 ) // For 6502 vectors
ROM_REGION( 0x0200, REGION_GFX1 | REGIONFLAG_DISPOSE )
ROM_LOAD( "5782.m3", 0x0000, 0x0200, 0x82b86852 )
ROM_REGION( 0x0800, REGION_GFX2 | REGIONFLAG_DISPOSE )
ROM_LOAD( "5778.p1", 0x0000, 0x0200, 0x78bff86a )
ROM_LOAD( "5779.m1", 0x0200, 0x0200, 0x8b1d0d83 )
ROM_LOAD( "5780.l1", 0x0400, 0x0200, 0x6f4c6bab )
ROM_LOAD( "5781.j1", 0x0600, 0x0200, 0xc87f2f13 )
ROM_REGION( 0x0100, REGION_GFX3 | REGIONFLAG_DISPOSE )
ROM_LOAD( "5770.m2", 0x0000, 0x0100, 0xb00bbe77 )
ROM_REGION( 0x0060, REGION_PROMS ) /* misc. PROMs (timing?) */
ROM_LOAD( "5765.h8", 0x0000, 0x0020, 0x6cd58931 )
ROM_LOAD( "5766.k8", 0x0020, 0x0020, 0xe63edf4f )
ROM_LOAD( "5767.j8", 0x0040, 0x0020, 0x381b5ae4 )
ROM_END
GAMEX( 1976, copsnrob, 0, copsnrob, copsnrob, 0, ROT0, "Atari", "Cops'n Robbers", GAME_NO_SOUND )
|
#ifndef __PARSE_ERROR_HPP__
#define __PARSE_ERROR_HPP__
#include <string>
#include <fmt/core.h>
class ParseError {
public:
ParseError (std::string _code, int _error_pos, int _line, int _start_pos) {
ErrorPos = _error_pos;
Line = _line;
LinePos = _error_pos - _start_pos;
int _end_pos = _code.find ('\n', _start_pos);
if (_end_pos == -1) {
LineCode = _code.substr (_start_pos);
} else {
LineCode = _code.substr (_start_pos, _end_pos - _start_pos);
if (LineCode.size () > 0 && LineCode [LineCode.size () - 1] == '\r')
LineCode = LineCode.substr (0, LineCode.size () - 1);
}
ErrorInfo = fmt::format ("Invalid Character '{}'", _code [_error_pos - (_error_pos == _code.size () ? 1 : 0)]);
}
int ErrorPos = -1;
int Line = -1;
int LinePos = -1;
std::string LineCode;
std::string ErrorInfo;
};
#endif // __PARSE_ERROR_HPP__
|
#include <iostream>
#include "HumanPlayer.h"
#include "GameUI.h"
#include "Controller.h"
//called on program start
int main() {
Controller control = Controller(); //initialize the controller
control.start(); //start the game
return 0;
}
|
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) by Kongsberg Oil & Gas Technologies.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg Oil & Gas Technologies
* about acquiring a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
#ifdef HAVE_NODEKITS
/*!
\class SoLightKit SoLightKit.h Inventor/nodekits/SoLightKit.h
\brief The SoLightKit class provides a kit with a transform, a light and a shape or subgraph.
\ingroup nodekits
\NODEKIT_PRE_DIAGRAM
\verbatim
CLASS SoLightKit
-->"this"
"callbackList"
--> "transformGroup"
--> "transform"
--> "light"
--> "iconSeparator"
--> "icon"
\endverbatim
\NODEKIT_POST_DIAGRAM
\NODEKIT_PRE_TABLE
\verbatim
CLASS SoLightKit
PVT "this", SoLightKit ---
"callbackList", SoNodeKitListPart [ SoCallback, SoEventCallback ]
PVT "transformGroup", SoTransformSeparator ---
"transform", SoTransform ---
"light", SoLight --- , (default type = SoDirectionalLight)
PVT "iconSeparator", SoSeparator ---
"icon", SoNode --- , (default type = SoCube)
\endverbatim
\NODEKIT_POST_TABLE
*/
#include <Inventor/nodekits/SoLightKit.h>
#include <Inventor/nodes/SoTransformSeparator.h>
#include <Inventor/nodes/SoTransform.h>
#include <Inventor/nodes/SoDirectionalLight.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoCube.h>
#include "nodekits/SoSubKitP.h"
SO_KIT_SOURCE(SoLightKit);
/*!
Constructor.
*/
SoLightKit::SoLightKit(void)
{
SO_KIT_INTERNAL_CONSTRUCTOR(SoLightKit);
// Note: we must use "" instead of , , to humour MS VisualC++ 6.
SO_KIT_ADD_CATALOG_ENTRY(transformGroup, SoTransformSeparator, TRUE, this, "", FALSE);
SO_KIT_ADD_CATALOG_ENTRY(transform, SoTransform, TRUE, transformGroup, light, TRUE);
SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(light, SoLight, SoDirectionalLight, FALSE, transformGroup, iconSeparator, TRUE);
SO_KIT_ADD_CATALOG_ENTRY(iconSeparator, SoSeparator, TRUE, transformGroup, "", FALSE);
SO_KIT_ADD_CATALOG_ABSTRACT_ENTRY(icon, SoNode, SoCube, TRUE, iconSeparator, "", TRUE);
SO_KIT_INIT_INSTANCE();
}
/*!
Destructor.
*/
SoLightKit::~SoLightKit()
{
}
// Documented in superclass.
void
SoLightKit::initClass(void)
{
SO_KIT_INTERNAL_INIT_CLASS(SoLightKit, SO_FROM_INVENTOR_1);
}
#endif // HAVE_NODEKITS
|
/*=========================================================================
*
* Copyright RTK Consortium
*
* 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.txt
*
* 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 "rtkXRadGeometryReader.h"
#include "rtkXRadImageIOFactory.h"
#include <itkImageIOFactory.h>
#include <itkMetaDataObject.h>
rtk::XRadGeometryReader ::XRadGeometryReader()
: m_Geometry(nullptr)
{}
void
rtk::XRadGeometryReader ::GenerateData()
{
// Create new RTK geometry object
m_Geometry = GeometryType::New();
GeometryType::Pointer tmpGeo = GeometryType::New();
// Read image information which contains geometry information
rtk::XRadImageIOFactory::RegisterOneFactory();
itk::ImageIOBase::Pointer reader =
#if (ITK_VERSION_MAJOR == 5) && (ITK_VERSION_MINOR >= 1)
itk::ImageIOFactory::CreateImageIO(m_ImageFileName.c_str(), itk::ImageIOFactory::FileModeEnum::ReadMode);
#else
itk::ImageIOFactory::CreateImageIO(m_ImageFileName.c_str(), itk::ImageIOFactory::FileModeType::ReadMode);
#endif
if (!reader)
itkExceptionMacro(<< m_ImageFileName << " is not an XRad file.");
reader->SetFileName(m_ImageFileName);
reader->ReadImageInformation();
std::string sectionName, paramName;
using MetaDataStringType = itk::MetaDataObject<std::string>;
itk::MetaDataDictionary & dic = reader->GetMetaDataDictionary();
for (unsigned int i = 0; i < reader->GetDimensions(2); i++)
{
std::ostringstream os;
os << "iView3D(Projection " << i << ")";
sectionName = os.str();
paramName = sectionName + "_CBCT.ProjectionGeometryArray.u_axis";
std::istringstream isu(dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue());
paramName = sectionName + "_CBCT.ProjectionGeometryArray.v_axis";
std::istringstream isv(dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue());
paramName = sectionName + "_CBCT.ProjectionGeometryArray.focus";
std::istringstream isfocus(
dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue());
paramName = sectionName + "_CBCT.ProjectionGeometryArray.center";
std::istringstream iscenter(
dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue());
itk::Vector<double, 3> u, v;
itk::Vector<double, 3> focus, center;
for (unsigned int j = 0; j < 3; j++)
{
isu >> u[j];
isv >> v[j];
isfocus >> focus[j];
iscenter >> center[j];
// cm to mm
focus[j] *= 10.;
center[j] *= 10.;
}
// Change of coordinate system to IEC
// The coordinate system of XRad is supposed to be illustrated in figure 1 of
// [Clarkson et al, Med Phys, 2011]. Real acquisition of a Playmobil have been
// actually used to be sure...
u[0] *= -1.;
v[0] *= -1.;
focus[0] *= -1.;
center[0] *= -1;
u[2] *= -1.;
v[2] *= -1.;
focus[2] *= -1.;
center[2] *= -1;
std::swap(u[1], u[2]);
std::swap(v[1], v[2]);
std::swap(focus[1], focus[2]);
std::swap(center[1], center[2]);
u.Normalize();
v.Normalize();
tmpGeo->AddReg23Projection(&(focus[0]), &(center[0]), u, v);
paramName = sectionName + "_CBCT.ProjectionGeometryArray.u_off";
std::string suoff = dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue();
double uoff = atof(suoff.c_str()) * reader->GetSpacing(0);
paramName = sectionName + "_CBCT.ProjectionGeometryArray.v_off";
std::string svoff = dynamic_cast<MetaDataStringType *>(dic[paramName].GetPointer())->GetMetaDataObjectValue();
double voff = atof(svoff.c_str()) * reader->GetSpacing(1);
m_Geometry->AddProjectionInRadians(tmpGeo->GetSourceToIsocenterDistances()[i],
tmpGeo->GetSourceToDetectorDistances()[i],
tmpGeo->GetGantryAngles()[i],
tmpGeo->GetProjectionOffsetsX()[i] - uoff,
tmpGeo->GetProjectionOffsetsY()[i] - voff,
tmpGeo->GetOutOfPlaneAngles()[i],
tmpGeo->GetInPlaneAngles()[i],
tmpGeo->GetSourceOffsetsX()[i],
tmpGeo->GetSourceOffsetsY()[i]);
}
}
|
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
#pragma once
#include "LayerWithParameters.hpp"
namespace armnn
{
/// This layer represents a pooling 2d operation.
class Pooling2dLayer : public LayerWithParameters<Pooling2dDescriptor>
{
public:
/// Makes a workload for the Pooling2d type.
/// @param [in] graph The graph where this layer can be found.
/// @param [in] factory The workload factory which will create the workload.
/// @return A pointer to the created workload, or nullptr if not created.
virtual std::unique_ptr<IWorkload> CreateWorkload(const Graph& graph,
const IWorkloadFactory& factory) const override;
/// Creates a dynamically-allocated copy of this layer.
/// @param [in] graph The graph into which this layer is being cloned.
Pooling2dLayer* Clone(Graph& graph) const override;
/// Check if the input tensor shape(s)
/// will lead to a valid configuration of @ref Pooling2dLayer.
void ValidateTensorShapesFromInputs() override;
/// By default returns inputShapes if the number of inputs are equal to number of outputs,
/// otherwise infers the output shapes from given input shapes and layer properties.
/// @param [in] inputShapes The input shapes layer has.
/// @return A vector to the inferred output shape.
std::vector<TensorShape> InferOutputShapes(const std::vector<TensorShape>& inputShapes) const override;
void Accept(ILayerVisitor& visitor) const override;
protected:
/// Constructor to create a Pooling2dLayer.
/// @param [in] param Pooling2dDescriptor to configure the pooling2d operation.
/// @param [in] name Optional name for the layer.
Pooling2dLayer(const Pooling2dDescriptor& param, const char* name);
/// Default destructor
~Pooling2dLayer() = default;
};
} // namespace
|
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include "gloo/cuda_broadcast_one_to_all.h"
#include "gloo/cuda_collectives_device.h"
#include "gloo/cuda_collectives_host.h"
#include "gloo/cuda_private.h"
namespace gloo {
template <typename T, typename W>
CudaBroadcastOneToAll<T, W>::CudaBroadcastOneToAll(
const std::shared_ptr<Context>& context,
const std::vector<T*>& ptrs,
int count,
int rootRank,
int rootPointerRank,
const std::vector<cudaStream_t>& streams)
: Algorithm(context),
count_(count),
bytes_(count * sizeof(T)),
rootRank_(rootRank),
rootPointerRank_(rootPointerRank),
synchronizeDeviceOutputs_(streams.size() == 0) {
GLOO_ENFORCE_GE(rootRank_, 0);
GLOO_ENFORCE_LT(rootRank_, contextSize_);
auto newStream = true;
if (streams.size() > 0) {
GLOO_ENFORCE_EQ(streams.size(), ptrs.size());
newStream = false;
}
for (auto i = 0; i < ptrs.size(); i++) {
auto ptr = CudaDevicePointer<T>::create(ptrs[i], count_);
if (newStream) {
streams_.push_back(CudaStream(ptr.getDeviceID()));
} else {
streams_.push_back(CudaStream(ptr.getDeviceID(), streams[i]));
}
devicePtrs_.push_back(std::move(ptr));
}
// Workspace specific initialization (see below)
init();
// Setup pairs/buffers for sender/receivers
if (contextSize_ > 1) {
auto slot = context_->nextSlot();
if (contextRank_ == rootRank_) {
sender_.resize(contextSize_);
for (auto i = 0; i < contextSize_; i++) {
if (i == contextRank_) {
continue;
}
sender_[i] = make_unique<forSender>();
auto& pair = context_->getPair(i);
sender_[i]->clearToSendBuffer = pair->createRecvBuffer(
slot, &sender_[i]->dummy, sizeof(sender_[i]->dummy));
sender_[i]->sendBuffer = pair->createSendBuffer(
slot, *scratch_, bytes_);
}
} else {
receiver_ = make_unique<forReceiver>();
auto& rootPair = context_->getPair(rootRank_);
receiver_->clearToSendBuffer = rootPair->createSendBuffer(
slot, &receiver_->dummy, sizeof(receiver_->dummy));
receiver_->recvBuffer = rootPair->createRecvBuffer(
slot, *scratch_, bytes_);
}
}
// Setup local broadcast if needed
if (devicePtrs_.size() > 1) {
localBroadcastOp_ =
cudaDeviceBroadcast(streams_, devicePtrs_, devicePtrs_[0], 0, count_);
}
}
template <typename T, typename W>
void CudaBroadcastOneToAll<T, W>::run() {
if (contextSize_ == 1) {
if (localBroadcastOp_) {
localBroadcastOp_->runAsync();
if (synchronizeDeviceOutputs_) {
localBroadcastOp_->wait();
}
}
return;
}
if (contextRank_ == rootRank_) {
CudaStream& stream = streams_[rootPointerRank_];
// Copy device buffer to host
stream.copyAsync(scratch_, devicePtrs_[rootPointerRank_]);
stream.wait();
// Fire off send operations after receiving clear to send
for (auto i = 0; i < contextSize_; i++) {
if (i == contextRank_) {
continue;
}
sender_[i]->clearToSendBuffer->waitRecv();
sender_[i]->sendBuffer->send();
}
// Broadcast locally while sends are happening
if (localBroadcastOp_) {
localBroadcastOp_->runAsync();
if (synchronizeDeviceOutputs_) {
localBroadcastOp_->wait();
}
}
// Wait for all send operations to complete
for (auto i = 0; i < contextSize_; i++) {
if (i == contextRank_) {
continue;
}
sender_[i]->sendBuffer->waitSend();
}
} else {
CudaStream& stream = streams_[rootPointerRank_];
// Ensure previous H2D copy is complete before notifying the sender
// NOTE: this only waits for last copyAsync, not for the whole stream
stream.wait();
receiver_->clearToSendBuffer->send();
receiver_->recvBuffer->waitRecv();
// Copy host buffer to device
stream.copyAsync(devicePtrs_[rootPointerRank_], scratch_);
// Broadcast locally after receiving from root
if (localBroadcastOp_) {
// Since broadcast synchronizes on root pointer, there is no
// need to explicity wait for the memcpy to complete.
localBroadcastOp_->runAsync();
if (synchronizeDeviceOutputs_) {
localBroadcastOp_->wait();
}
} else {
// Wait for memcpy to complete
if (synchronizeDeviceOutputs_) {
stream.wait();
}
}
}
}
template <typename T, typename W>
template <typename U>
void CudaBroadcastOneToAll<T, W>::init(
typename std::enable_if<std::is_same<U, CudaHostWorkspace<T> >::value,
typename U::Pointer>::type*) {
// Allocate host side buffer if we need to communicate
if (contextSize_ > 1) {
// Since broadcast transmits from/to a buffer in system memory, the
// scratch space is a new host side buffer.
scratch_ = W::Pointer::alloc(count_);
}
}
template <typename T, typename W>
template <typename U>
void CudaBroadcastOneToAll<T, W>::init(
typename std::enable_if<std::is_same<U, CudaDeviceWorkspace<T> >::value,
typename U::Pointer>::type*) {
if (contextSize_ > 1) {
// For GPUDirect, an additional buffer allocation is unnecessary.
// Instead, use the provided input buffer itself as the scratch space.
// The caller is the owner_
scratch_ = CudaDevicePointer<T>::create(devicePtrs_[0]);
}
}
// Instantiate templates
#define INSTANTIATE_TEMPLATE(T) \
template class CudaBroadcastOneToAll<T, CudaHostWorkspace<T> >; \
template class CudaBroadcastOneToAll<T, CudaDeviceWorkspace<T> >;
INSTANTIATE_TEMPLATE(int8_t);
INSTANTIATE_TEMPLATE(uint8_t);
INSTANTIATE_TEMPLATE(int32_t);
INSTANTIATE_TEMPLATE(int64_t);
INSTANTIATE_TEMPLATE(uint64_t);
INSTANTIATE_TEMPLATE(float);
INSTANTIATE_TEMPLATE(double);
INSTANTIATE_TEMPLATE(float16);
} // namespace gloo
|
class Solution {
public:
vector<vector<int>> dp;
int calculateManhattan(vector<int>& p1, vector<int>& p2) {
return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1]);
}
int makeMove(vector<vector<int>>& workers, int worker_ids, vector<vector<int>>& bikes, int bike_ids) {
if (dp[worker_ids][bike_ids] != INT_MAX)
return dp[worker_ids][bike_ids];
int sum = 0;
for (int i = 0; i < 10; i++) {
if (worker_ids & (1 << i)) {
for (int j = 0; j < 10; j++) {
if (bike_ids & (1 << j)) {
sum = calculateManhattan(workers[i], bikes[j]);
worker_ids &= ~(1 << i);
bike_ids &= ~(1 << j);
sum += makeMove(workers, worker_ids, bikes, bike_ids);
worker_ids |= (1 << i);
bike_ids |= (1 << j);
dp[worker_ids][bike_ids] = min(dp[worker_ids][bike_ids], sum);
}
}
}
}
return dp[worker_ids][bike_ids];
}
int assignBikes(vector<vector<int>>& workers, vector<vector<int>>& bikes) {
dp.assign(1024, vector<int>(1024, INT_MAX));
for (int j = 0; j < 1024; j++)
dp[0][j] = 0;
for (int i = 0; i < 1024; i++)
dp[i][0] = 0;
int m = workers.size(), n = bikes.size();
return makeMove(workers, (1 << m) - 1, bikes, (1 << n) - 1);
}
};
/*
* Dynamic programming.
*/
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Stefan Schimanski (1Stein@gmx.de)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "HTMLObjectElement.h"
#include "Attribute.h"
#include "CSSValueKeywords.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLFormElement.h"
#include "HTMLImageLoader.h"
#include "HTMLMetaElement.h"
#include "HTMLNames.h"
#include "HTMLParamElement.h"
#include "HTMLParserIdioms.h"
#include "MIMETypeRegistry.h"
#include "NodeList.h"
#include "Page.h"
#include "RenderEmbeddedObject.h"
#include "RenderImage.h"
#include "RenderWidget.h"
#include "ScriptEventListener.h"
#include "Settings.h"
#include "Text.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLObjectElement::HTMLObjectElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
: HTMLPlugInImageElement(tagName, document, createdByParser, ShouldNotPreferPlugInsForImages)
, FormAssociatedElement(form)
, m_docNamedItem(true)
, m_useFallbackContent(false)
{
ASSERT(hasTagName(objectTag));
if (!this->form())
setForm(findFormAncestor());
if (this->form())
this->form()->registerFormElement(this);
}
inline HTMLObjectElement::~HTMLObjectElement()
{
if (form())
form()->removeFormElement(this);
}
PassRefPtr<HTMLObjectElement> HTMLObjectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
{
return adoptRef(new HTMLObjectElement(tagName, document, form, createdByParser));
}
RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
{
document()->updateLayoutIgnorePendingStylesheets();
return renderPart(); // This will return 0 if the renderer is not a RenderPart.
}
void HTMLObjectElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == typeAttr) {
m_serviceType = attr->value().lower();
size_t pos = m_serviceType.find(";");
if (pos != notFound)
m_serviceType = m_serviceType.left(pos);
if (renderer())
setNeedsWidgetUpdate(true);
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
} else if (attr->name() == dataAttr) {
m_url = stripLeadingAndTrailingHTMLSpaces(attr->value());
if (renderer()) {
setNeedsWidgetUpdate(true);
if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = adoptPtr(new HTMLImageLoader(this));
m_imageLoader->updateFromElementIgnoringPreviousError();
}
}
} else if (attr->name() == classidAttr) {
m_classId = attr->value();
if (renderer())
setNeedsWidgetUpdate(true);
} else if (attr->name() == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == nameAttr) {
const AtomicString& newName = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->addNamedItem(newName);
}
m_name = newName;
} else if (attr->name() == borderAttr) {
addCSSLength(attr, CSSPropertyBorderWidth, attr->value().toInt() ? attr->value() : "0");
addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid);
addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid);
} else if (isIdAttributeName(attr->name())) {
const AtomicString& newId = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_id);
document->addExtraNamedItem(newId);
}
m_id = newId;
// also call superclass
HTMLPlugInImageElement::parseMappedAttribute(attr);
} else
HTMLPlugInImageElement::parseMappedAttribute(attr);
}
static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues)
{
// Some plugins don't understand the "data" attribute of the OBJECT tag (i.e. Real and WMP
// require "src" attribute).
int srcIndex = -1, dataIndex = -1;
for (unsigned int i = 0; i < paramNames->size(); ++i) {
if (equalIgnoringCase((*paramNames)[i], "src"))
srcIndex = i;
else if (equalIgnoringCase((*paramNames)[i], "data"))
dataIndex = i;
}
if (srcIndex == -1 && dataIndex != -1) {
paramNames->append("src");
paramValues->append((*paramValues)[dataIndex]);
}
}
// FIXME: This function should not deal with url or serviceType!
void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType)
{
HashSet<StringImpl*, CaseFoldingHash> uniqueParamNames;
String urlParameter;
// Scan the PARAM children and store their name/value pairs.
// Get the URL and type from the params if we don't already have them.
for (Node* child = firstChild(); child; child = child->nextSibling()) {
if (!child->hasTagName(paramTag))
continue;
HTMLParamElement* p = static_cast<HTMLParamElement*>(child);
String name = p->name();
if (name.isEmpty())
continue;
uniqueParamNames.add(name.impl());
paramNames.append(p->name());
paramValues.append(p->value());
// FIXME: url adjustment does not belong in this function.
if (url.isEmpty() && urlParameter.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url")))
urlParameter = stripLeadingAndTrailingHTMLSpaces(p->value());
// FIXME: serviceType calculation does not belong in this function.
if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) {
serviceType = p->value();
size_t pos = serviceType.find(";");
if (pos != notFound)
serviceType = serviceType.left(pos);
}
}
// When OBJECT is used for an applet via Sun's Java plugin, the CODEBASE attribute in the tag
// points to the Java plugin itself (an ActiveX component) while the actual applet CODEBASE is
// in a PARAM tag. See <http://java.sun.com/products/plugin/1.2/docs/tags.html>. This means
// we have to explicitly suppress the tag's CODEBASE attribute if there is none in a PARAM,
// else our Java plugin will misinterpret it. [4004531]
String codebase;
if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType)) {
codebase = "codebase";
uniqueParamNames.add(codebase.impl()); // pretend we found it in a PARAM already
}
// Turn the attributes of the <object> element into arrays, but don't override <param> values.
NamedNodeMap* attributes = this->attributes(true);
if (attributes) {
for (unsigned i = 0; i < attributes->length(); ++i) {
Attribute* it = attributes->attributeItem(i);
const AtomicString& name = it->name().localName();
if (!uniqueParamNames.contains(name.impl())) {
paramNames.append(name.string());
paramValues.append(it->value().string());
}
}
}
mapDataParamToSrc(¶mNames, ¶mValues);
// HTML5 says that an object resource's URL is specified by the object's data
// attribute, not by a param element. However, for compatibility, allow the
// resource's URL to be given by a param named "src", "movie", "code" or "url"
// if we know that resource points to a plug-in.
if (url.isEmpty() && !urlParameter.isEmpty()) {
SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
if (loader->resourceWillUsePlugin(urlParameter, serviceType, shouldPreferPlugInsForImages()))
url = urlParameter;
}
}
bool HTMLObjectElement::hasFallbackContent() const
{
for (Node* child = firstChild(); child; child = child->nextSibling()) {
// Ignore whitespace-only text, and <param> tags, any other content is fallback content.
if (child->isTextNode()) {
if (!static_cast<Text*>(child)->containsOnlyWhitespace())
return true;
} else if (!child->hasTagName(paramTag))
return true;
}
return false;
}
bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk()
{
// This site-specific hack maintains compatibility with Mac OS X Wiki Server,
// which embeds QuickTime movies using an object tag containing QuickTime's
// ActiveX classid. Treat this classid as valid only if OS X Server's unique
// 'generator' meta tag is present. Only apply this quirk if there is no
// fallback content, which ensures the quirk will disable itself if Wiki
// Server is updated to generate an alternate embed tag as fallback content.
if (!document()->page()
|| !document()->page()->settings()->needsSiteSpecificQuirks()
|| hasFallbackContent()
|| !equalIgnoringCase(classId(), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
return false;
RefPtr<NodeList> metaElements = document()->getElementsByTagName(HTMLNames::metaTag.localName());
unsigned length = metaElements->length();
for (unsigned i = 0; i < length; ++i) {
ASSERT(metaElements->item(i)->isHTMLElement());
HTMLMetaElement* metaElement = static_cast<HTMLMetaElement*>(metaElements->item(i));
if (equalIgnoringCase(metaElement->name(), "generator") && metaElement->content().startsWith("Mac OS X Server Web Services Server", false))
return true;
}
return false;
}
bool HTMLObjectElement::hasValidClassId()
{
#if PLATFORM(QT)
if (equalIgnoringCase(serviceType(), "application/x-qt-plugin") || equalIgnoringCase(serviceType(), "application/x-qt-styled-widget"))
return true;
#endif
if (MIMETypeRegistry::isJavaAppletMIMEType(serviceType()) && classId().startsWith("java:", false))
return true;
if (shouldAllowQuickTimeClassIdQuirk())
return true;
// HTML5 says that fallback content should be rendered if a non-empty
// classid is specified for which the UA can't find a suitable plug-in.
return classId().isEmpty();
}
// FIXME: This should be unified with HTMLEmbedElement::updateWidget and
// moved down into HTMLPluginImageElement.cpp
void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption)
{
ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
// FIXME: We should ASSERT(needsWidgetUpdate()), but currently
// FrameView::updateWidget() calls updateWidget(false) without checking if
// the widget actually needs updating!
setNeedsWidgetUpdate(false);
// FIXME: This should ASSERT isFinishedParsingChildren() instead.
if (!isFinishedParsingChildren())
return;
String url = this->url();
String serviceType = this->serviceType();
// FIXME: These should be joined into a PluginParameters class.
Vector<String> paramNames;
Vector<String> paramValues;
parametersForPlugin(paramNames, paramValues, url, serviceType);
// Note: url is modified above by parametersForPlugin.
if (!allowedToLoadFrameURL(url))
return;
bool fallbackContent = hasFallbackContent();
renderEmbeddedObject()->setHasFallbackContent(fallbackContent);
if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType))
return;
ASSERT(!m_inBeforeLoadEventHandler);
m_inBeforeLoadEventHandler = true;
bool beforeLoadAllowedLoad = dispatchBeforeLoadEvent(url);
m_inBeforeLoadEventHandler = false;
// beforeload events can modify the DOM, potentially causing
// RenderWidget::destroy() to be called. Ensure we haven't been
// destroyed before continuing.
// FIXME: Should this render fallback content?
if (!renderer())
return;
SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
bool success = beforeLoadAllowedLoad && hasValidClassId() && loader->requestObject(this, url, getAttribute(nameAttr), serviceType, paramNames, paramValues);
if (!success && fallbackContent)
renderFallbackContent();
}
bool HTMLObjectElement::rendererIsNeeded(RenderStyle* style)
{
// FIXME: This check should not be needed, detached documents never render!
Frame* frame = document()->frame();
if (!frame)
return false;
return HTMLPlugInImageElement::rendererIsNeeded(style);
}
void HTMLObjectElement::insertedIntoDocument()
{
HTMLPlugInImageElement::insertedIntoDocument();
if (!inDocument())
return;
if (isDocNamedItem() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
}
FormAssociatedElement::insertedIntoDocument();
}
void HTMLObjectElement::removedFromDocument()
{
if (isDocNamedItem() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeNamedItem(m_name);
document->removeExtraNamedItem(m_id);
}
HTMLPlugInImageElement::removedFromDocument();
FormAssociatedElement::removedFromDocument();
}
void HTMLObjectElement::attributeChanged(Attribute* attr, bool preserveDecls)
{
if (attr->name() == formAttr)
formAttributeChanged();
else
HTMLPlugInImageElement::attributeChanged(attr, preserveDecls);
}
void HTMLObjectElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
updateDocNamedItem();
if (inDocument() && !useFallbackContent()) {
setNeedsWidgetUpdate(true);
setNeedsStyleRecalc();
}
HTMLPlugInImageElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
bool HTMLObjectElement::isURLAttribute(Attribute *attr) const
{
return (attr->name() == dataAttr || (attr->name() == usemapAttr && attr->value().string()[0] != '#'));
}
const QualifiedName& HTMLObjectElement::imageSourceAttributeName() const
{
return dataAttr;
}
void HTMLObjectElement::renderFallbackContent()
{
if (useFallbackContent())
return;
if (!inDocument())
return;
// Before we give up and use fallback content, check to see if this is a MIME type issue.
if (m_imageLoader && m_imageLoader->image() && m_imageLoader->image()->status() != CachedResource::LoadError) {
m_serviceType = m_imageLoader->image()->response().mimeType();
if (!isImageType()) {
// If we don't think we have an image type anymore, then clear the image from the loader.
m_imageLoader->setImage(0);
detach();
attach();
return;
}
}
m_useFallbackContent = true;
// FIXME: Style gets recalculated which is suboptimal.
detach();
attach();
}
// FIXME: This should be removed, all callers are almost certainly wrong.
static bool isRecognizedTagName(const QualifiedName& tagName)
{
DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, tagList, ());
if (tagList.isEmpty()) {
size_t tagCount = 0;
QualifiedName** tags = HTMLNames::getHTMLTags(&tagCount);
for (size_t i = 0; i < tagCount; i++) {
if (*tags[i] == bgsoundTag
|| *tags[i] == commandTag
|| *tags[i] == detailsTag
|| *tags[i] == figcaptionTag
|| *tags[i] == figureTag
|| *tags[i] == summaryTag
|| *tags[i] == trackTag) {
// Even though we have atoms for these tags, we don't want to
// treat them as "recognized tags" for the purpose of parsing
// because that changes how we parse documents.
continue;
}
tagList.add(tags[i]->localName().impl());
}
}
return tagList.contains(tagName.localName().impl());
}
void HTMLObjectElement::updateDocNamedItem()
{
// The rule is "<object> elements with no children other than
// <param> elements, unknown elements and whitespace can be
// found by name in a document, and other <object> elements cannot."
bool wasNamedItem = m_docNamedItem;
bool isNamedItem = true;
Node* child = firstChild();
while (child && isNamedItem) {
if (child->isElementNode()) {
Element* element = static_cast<Element*>(child);
// FIXME: Use of isRecognizedTagName is almost certainly wrong here.
if (isRecognizedTagName(element->tagQName()) && !element->hasTagName(paramTag))
isNamedItem = false;
} else if (child->isTextNode()) {
if (!static_cast<Text*>(child)->containsOnlyWhitespace())
isNamedItem = false;
} else
isNamedItem = false;
child = child->nextSibling();
}
if (isNamedItem != wasNamedItem && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
if (isNamedItem) {
document->addNamedItem(m_name);
document->addExtraNamedItem(m_id);
} else {
document->removeNamedItem(m_name);
document->removeExtraNamedItem(m_id);
}
}
m_docNamedItem = isNamedItem;
}
bool HTMLObjectElement::containsJavaApplet() const
{
if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr)))
return true;
for (Element* child = firstElementChild(); child; child = child->nextElementSibling()) {
if (child->hasTagName(paramTag)
&& equalIgnoringCase(child->getAttribute(nameAttr), "type")
&& MIMETypeRegistry::isJavaAppletMIMEType(child->getAttribute(valueAttr).string()))
return true;
if (child->hasTagName(objectTag)
&& static_cast<HTMLObjectElement*>(child)->containsJavaApplet())
return true;
if (child->hasTagName(appletTag))
return true;
}
return false;
}
void HTMLObjectElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLPlugInImageElement::addSubresourceAttributeURLs(urls);
addSubresourceURL(urls, document()->completeURL(getAttribute(dataAttr)));
// FIXME: Passing a string that starts with "#" to the completeURL function does
// not seem like it would work. The image element has similar but not identical code.
const AtomicString& useMap = getAttribute(usemapAttr);
if (useMap.startsWith("#"))
addSubresourceURL(urls, document()->completeURL(useMap));
}
void HTMLObjectElement::willMoveToNewOwnerDocument()
{
FormAssociatedElement::willMoveToNewOwnerDocument();
HTMLPlugInImageElement::willMoveToNewOwnerDocument();
}
void HTMLObjectElement::insertedIntoTree(bool deep)
{
FormAssociatedElement::insertedIntoTree();
HTMLPlugInImageElement::insertedIntoTree(deep);
}
void HTMLObjectElement::removedFromTree(bool deep)
{
FormAssociatedElement::removedFromTree();
HTMLPlugInImageElement::removedFromTree(deep);
}
bool HTMLObjectElement::appendFormData(FormDataList&, bool)
{
// FIXME: Implements this function.
return false;
}
const AtomicString& HTMLObjectElement::formControlName() const
{
return m_name.isNull() ? emptyAtom : m_name;
}
HTMLFormElement* HTMLObjectElement::virtualForm() const
{
return FormAssociatedElement::form();
}
}
|
// Copyright (C) 2014, Pawel Tomulik <ptomulik@meil.pw.edu.pl>
//
// 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)
// yaul/tml/aux_/divides.hpp
/** // doc: yaul/tml/aux_/divides.hpp {{{
* \file yaul/tml/aux_/divides.hpp
* \brief Implements \ref yaul::tml::divides
*/ // }}}
# ifndef YAUL_TML_AUX_DIVIDES_HPP
# define YAUL_TML_AUX_DIVIDES_HPP
#include <yaul/tml/aux_/num_op_includes.hpp>
#include <yaul/tml/integral_c/aux_/num_op_includes.hpp>
#define AUX862492_OP /
#define AUX862492_OP_NAME divides
#include <yaul/tml/aux_/num_op.hpp>
#include <yaul/tml/integral_c/aux_/num_op.hpp>
#include <yaul/tml/aux_/num_op_cleanup.hpp>
#include <yaul/tml/integral_c/aux_/num_op_cleanup.hpp>
#endif /* YAUL_TML_AUX_DIVIDES_HPP */
// vim: set expandtab tabstop=2 shiftwidth=2:
// vim: set foldmethod=marker foldcolumn=4:
|
// Copyright 2020 Teratide B.V.
//
// 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 "bolson/parse/opae/trip.h"
#include <arrow/api.h>
#include <arrow/ipc/api.h>
#include <fletcher/context.h>
#include <fletcher/fletcher.h>
#include <fletcher/kernel.h>
#include <fletcher/platform.h>
#include <putong/timer.h>
#include <CLI/CLI.hpp>
#include <chrono>
#include <memory>
#include <thread>
#include <utility>
#include "bolson/buffer/opae_allocator.h"
#include "bolson/latency.h"
#include "bolson/log.h"
#include "bolson/parse/fpga/common.h"
#include "bolson/parse/opae/opae.h"
#include "bolson/parse/parser.h"
namespace bolson::parse::opae {
using bolson::parse::fpga::ReadMMIO;
using bolson::parse::fpga::WriteMMIO;
auto TripParser::input_schema() -> std::shared_ptr<arrow::Schema> {
static auto result = arrow::schema(
{arrow::field("timestamp", arrow::utf8(), false),
arrow::field("timezone", arrow::uint64(), false),
arrow::field("vin", arrow::uint64(), false),
arrow::field("odometer", arrow::uint64(), false),
arrow::field("hypermiling", arrow::boolean(), false),
arrow::field("avgspeed", arrow::uint64(), false),
arrow::field(
"sec_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"miles_in_time_range",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 24),
false),
arrow::field(
"const_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"vary_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"sec_decel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"sec_accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"braking",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field(
"accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field("orientation", arrow::boolean(), false),
arrow::field(
"small_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field(
"large_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field("accel_decel", arrow::uint64(), false),
arrow::field("speed_changes", arrow::uint64(), false)});
return result;
}
static auto output_schema_hw() -> std::shared_ptr<arrow::Schema> {
static auto result = fletcher::WithMetaRequired(
*arrow::schema(
{fletcher::WithMetaEPC(*arrow::field("timestamp", arrow::utf8(), false), 1),
arrow::field("tag", arrow::uint64(), false),
arrow::field("timezone", arrow::uint64(), false),
arrow::field("vin", arrow::uint64(), false),
arrow::field("odometer", arrow::uint64(), false),
arrow::field("hypermiling", arrow::uint8(), false),
arrow::field("avgspeed", arrow::uint64(), false),
arrow::field("sec_in_band", arrow::uint64(), false),
arrow::field("miles_in_time_range", arrow::uint64(), false),
arrow::field("const_speed_miles_in_band", arrow::uint64(), false),
arrow::field("vary_speed_miles_in_band", arrow::uint64(), false),
arrow::field("sec_decel", arrow::uint64(), false),
arrow::field("sec_accel", arrow::uint64(), false),
arrow::field("braking", arrow::uint64(), false),
arrow::field("accel", arrow::uint64(), false),
arrow::field("orientation", arrow::uint8(), false),
arrow::field("small_speed_var", arrow::uint64(), false),
arrow::field("large_speed_var", arrow::uint64(), false),
arrow::field("accel_decel", arrow::uint64(), false),
arrow::field("speed_changes", arrow::uint64(), false)}),
"output", fletcher::Mode::WRITE);
return result;
}
static auto output_schema_sw() -> std::shared_ptr<arrow::Schema> {
static auto result = fletcher::WithMetaRequired(
*arrow::schema(
{arrow::field("timestamp", arrow::utf8(), false),
arrow::field("tag", arrow::uint64(), false),
arrow::field("timezone", arrow::uint64(), false),
arrow::field("vin", arrow::uint64(), false),
arrow::field("odometer", arrow::uint64(), false),
arrow::field("hypermiling", arrow::uint8(), false),
arrow::field("avgspeed", arrow::uint64(), false),
arrow::field(
"sec_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"miles_in_time_range",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 24),
false),
arrow::field(
"const_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"vary_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"sec_decel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"sec_accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"braking",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field(
"accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field("orientation", arrow::uint8(), false),
arrow::field(
"small_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field(
"large_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field("accel_decel", arrow::uint64(), false),
arrow::field("speed_changes", arrow::uint64(), false)}),
"output", fletcher::Mode::WRITE);
return result;
}
auto TripParser::output_schema() -> std::shared_ptr<arrow::Schema> {
static auto result = arrow::schema(
{arrow::field("bolson_seq", arrow::uint64(), false),
arrow::field("timestamp", arrow::utf8(), false),
arrow::field("timezone", arrow::uint64(), false),
arrow::field("vin", arrow::uint64(), false),
arrow::field("odometer", arrow::uint64(), false),
arrow::field("hypermiling", arrow::boolean(), false),
arrow::field("avgspeed", arrow::uint64(), false),
arrow::field(
"sec_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"miles_in_time_range",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 24),
false),
arrow::field(
"const_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"vary_speed_miles_in_band",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 12),
false),
arrow::field(
"sec_decel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"sec_accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 10),
false),
arrow::field(
"braking",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field(
"accel",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 6),
false),
arrow::field("orientation", arrow::boolean(), false),
arrow::field(
"small_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field(
"large_speed_var",
arrow::fixed_size_list(arrow::field("item", arrow::uint64(), false), 13),
false),
arrow::field("accel_decel", arrow::uint64(), false),
arrow::field("speed_changes", arrow::uint64(), false)});
return result;
}
// Fletcher default regs (unused):
// 0 control
// 1 status
// 2 return lo
// 3 return hi
static const size_t default_regs = 4;
// Input batches ranges per parser hardware instance:
// 0 input firstidx
// 1 input lastidx
static const size_t input_range_regs_per_inst = 2;
// Output batch ranges:
// 0 output firstidx
// 1 output lastidx
static const size_t output_range_regs = 2;
// Input buffers address registers per hardware instance:
// 0 input val addr lo
// 1 input val addr hi
static const size_t in_addr_regs_per_inst = 2;
// Output buffer address registers:
static const size_t out_addr_regs = 42;
// Custom registers per instance:
// 0 tag
// 1 consumed_bytes
static const size_t custom_regs_per_inst = 2;
auto TripParser::custom_regs_offset() const -> size_t {
return default_regs +
num_hardware_parsers_ * (input_range_regs_per_inst + in_addr_regs_per_inst) +
output_range_regs + out_addr_regs;
}
auto TripParser::input_firstidx_offset(size_t idx) -> size_t {
return default_regs + input_range_regs_per_inst * idx;
}
auto TripParser::input_lastidx_offset(size_t idx) -> size_t {
return input_firstidx_offset(idx) + 1;
}
auto TripParser::input_values_lo_offset(size_t idx) const -> size_t {
return default_regs + input_range_regs_per_inst * num_hardware_parsers_ + 2 +
in_addr_regs_per_inst * idx;
}
auto TripParser::input_values_hi_offset(size_t idx) const -> size_t {
return input_values_lo_offset(idx) + 1;
}
auto TripParser::tag_offset(size_t idx) const -> size_t {
return custom_regs_offset() + custom_regs_per_inst * idx;
}
auto TripParser::bytes_consumed_offset(size_t idx) const -> size_t {
return custom_regs_offset() + custom_regs_per_inst * idx + 1;
}
auto TripParserContext::PrepareInputBatches() -> Status {
for (const auto& buf : buffers_) {
auto wrapped = arrow::Buffer::Wrap(buf.data(), buf.capacity());
auto array =
std::make_shared<arrow::PrimitiveArray>(arrow::uint8(), buf.capacity(), wrapped);
auto batch = arrow::RecordBatch::Make(bolson::parse::fpga::raw_json_input_schema(),
buf.capacity(), {array});
batches_in.push_back(batch);
}
return Status::OK();
}
[[nodiscard]] static auto AllocateFixedSizeListArray(
const std::shared_ptr<arrow::DataType>& type,
const std::shared_ptr<arrow::Array>& value_array, size_t list_size,
std::shared_ptr<arrow::FixedSizeListArray>* out) -> Status {
auto list_array = std::make_shared<arrow::FixedSizeListArray>(
arrow::fixed_size_list(type, list_size), 0, value_array);
*out = list_array;
return Status::OK();
}
[[nodiscard]] static auto AllocatePrimitiveArray(
buffer::OpaeAllocator* allocator, const std::shared_ptr<arrow::DataType>& type,
size_t buffer_size, std::shared_ptr<arrow::PrimitiveArray>* out) -> Status {
std::byte* value_data = nullptr;
BOLSON_ROE(allocator->Allocate(buffer::OpaeAllocator().fixed_capacity(), &value_data));
auto value_buffer = arrow::Buffer::Wrap(value_data, buffer_size);
auto value_array = std::make_shared<arrow::PrimitiveArray>(type, 0, value_buffer);
*out = value_array;
return Status::OK();
}
[[nodiscard]] static auto AllocateStringArray(buffer::OpaeAllocator* allocator,
size_t offset_buffer_size,
size_t value_buffer_size,
std::shared_ptr<arrow::StringArray>* out)
-> Status {
std::byte* offset_data = nullptr;
BOLSON_ROE(allocator->Allocate(offset_buffer_size, &offset_data));
memset(offset_data, 0, offset_buffer_size);
auto offset_buffer = arrow::Buffer::Wrap(offset_data, offset_buffer_size);
std::byte* value_data = nullptr;
BOLSON_ROE(allocator->Allocate(value_buffer_size, &value_data));
auto value_buffer = arrow::Buffer::Wrap(value_data, value_buffer_size);
auto string_array =
std::make_shared<arrow::StringArray>(0, offset_buffer, value_buffer);
*out = string_array;
return Status::OK();
}
template <typename T>
static auto ResizeArray(const std::shared_ptr<T>& array,
const std::shared_ptr<arrow::DataType>& type, size_t num_rows)
-> std::shared_ptr<T> {
auto value_array = std::make_shared<T>(num_rows, array->values(), nullptr, 0);
return value_array;
}
static auto ResizeArray(const std::shared_ptr<arrow::StringArray>& array, size_t num_rows)
-> std::shared_ptr<arrow::StringArray> {
auto string_array = std::make_shared<arrow::StringArray>(
num_rows, array->value_offsets(), array->value_data());
return string_array;
}
static auto ResizeArray(const std::shared_ptr<arrow::FixedSizeListArray>& array,
const std::shared_ptr<arrow::DataType>& type, size_t num_rows)
-> std::shared_ptr<arrow::FixedSizeListArray> {
assert(array->type()->field(0)->type()->id() == arrow::Type::UINT64);
size_t list_size = array->list_type()->list_size();
auto values_buf = array->values()->data()->buffers[1];
auto num_values = num_rows * list_size;
auto values = std::make_shared<arrow::UInt64Array>(num_values, values_buf, nullptr, 0);
auto list_array = arrow::FixedSizeListArray::FromArrays(values, list_size).ValueOrDie();
return std::static_pointer_cast<arrow::FixedSizeListArray>(list_array);
}
static auto WrapTripReport(int32_t num_rows,
const std::vector<std::shared_ptr<arrow::Array>>& arrays,
const std::shared_ptr<arrow::Schema>& schema,
std::shared_ptr<arrow::RecordBatch>* out) -> Status {
std::vector<std::shared_ptr<arrow::Array>> resized_arrays;
for (const auto& array : arrays) {
if (array->type()->Equals(arrow::uint64())) {
auto field = std::static_pointer_cast<arrow::UInt64Array>(array);
resized_arrays.push_back(ResizeArray(field, arrow::uint64(), num_rows));
} else if (array->type()->Equals(arrow::uint8())) {
auto field = std::static_pointer_cast<arrow::UInt8Array>(array);
resized_arrays.push_back(ResizeArray(field, arrow::uint8(), num_rows));
} else if (array->type()->id() == arrow::Type::FIXED_SIZE_LIST) {
if (array->type()->field(0)->type()->id() == arrow::Type::UINT64) {
auto field = std::static_pointer_cast<arrow::FixedSizeListArray>(array);
resized_arrays.push_back(ResizeArray(field, arrow::uint64(), num_rows));
} else {
return Status(Error::GenericError,
"Unexpected fixed size list item type when wrapping trip report "
"parser output.");
}
} else if (array->type()->Equals(arrow::utf8())) {
auto field = std::static_pointer_cast<arrow::StringArray>(array);
resized_arrays.push_back(ResizeArray(field, num_rows));
} else {
return Status(Error::GenericError,
"Unexpected array type when wrapping trip report parser output.");
}
}
*out = arrow::RecordBatch::Make(schema, num_rows, resized_arrays);
return Status::OK();
}
auto TripParserContext::PrepareOutputBatch() -> Status {
for (const auto& f : output_schema_sw()->fields()) {
if (f->type()->Equals(arrow::uint64())) {
std::shared_ptr<arrow::PrimitiveArray> array;
BOLSON_ROE(AllocatePrimitiveArray(&allocator, arrow::uint64(),
allocator.fixed_capacity(), &array));
output_arrays_sw.push_back(array);
output_arrays_hw.push_back(array);
} else if (f->type()->Equals(arrow::uint8())) {
std::shared_ptr<arrow::PrimitiveArray> array;
BOLSON_ROE(AllocatePrimitiveArray(&allocator, arrow::uint8(),
allocator.fixed_capacity(), &array));
output_arrays_sw.push_back(array);
output_arrays_hw.push_back(array);
} else if (f->type()->Equals(arrow::utf8())) {
std::shared_ptr<arrow::StringArray> array;
BOLSON_ROE(AllocateStringArray(&allocator, allocator.fixed_capacity(),
allocator.fixed_capacity(), &array));
output_arrays_sw.push_back(array);
output_arrays_hw.push_back(array);
} else if (f->type()->id() == arrow::Type::FIXED_SIZE_LIST) {
std::shared_ptr<arrow::PrimitiveArray> values_array;
std::shared_ptr<arrow::FixedSizeListArray> fixed_size_list_array;
auto field = std::static_pointer_cast<arrow::FixedSizeListType>(f->type());
BOLSON_ROE(AllocatePrimitiveArray(&allocator, arrow::uint64(),
allocator.fixed_capacity(), &values_array));
BOLSON_ROE(AllocateFixedSizeListArray(field->value_type(), values_array,
field->list_size(), &fixed_size_list_array));
output_arrays_sw.push_back(fixed_size_list_array);
output_arrays_hw.push_back(values_array);
}
}
batch_out_sw = arrow::RecordBatch::Make(output_schema_sw(), 0, output_arrays_sw);
batch_out_hw = arrow::RecordBatch::Make(output_schema_hw(), 0, output_arrays_hw);
return Status::OK();
}
static auto ConvertTagsToSeq(const std::shared_ptr<arrow::UInt64Array>& tags,
std::vector<uint64_t> seq_nos,
std::shared_ptr<arrow::UInt64Array>* out) -> Status {
arrow::UInt64Builder bld;
ARROW_ROE(bld.Reserve(tags->length()));
for (size_t i = 0; i < tags->length(); i++) {
assert(tags->Value(i) < seq_nos.size());
bld.UnsafeAppend(seq_nos[tags->Value(i)]++);
}
ARROW_ROE(bld.Finish(out));
return Status::OK();
}
static auto ConvertUInt8ToBool(const std::shared_ptr<arrow::UInt8Array>& col,
std::shared_ptr<arrow::BooleanArray>* out) -> Status {
arrow::BooleanBuilder bld;
ARROW_ROE(bld.Reserve(col->length()));
const uint8_t* values = col->raw_values();
for (size_t i = 0; i < col->length(); i++) {
bld.UnsafeAppend(static_cast<bool>(values[i]));
}
ARROW_ROE(bld.Finish(out));
return Status::OK();
}
/**
* \brief Work-around for a couple of limitations to Fletcher / FPGA impl.
*
* Limitations:
* - no boolean ArrayWriter (this is probably supported in HW, but the type may just not
* have been included in Fletchgen.
* - rows from each parser are interleaved in the output in an order depending on the
* data.
* - rows currently get a tag saying which parser processed them, this must be turned
* into sequence numbers to comply to the other out of order parser implementations
*/
static auto FixResult(const std::shared_ptr<arrow::RecordBatch>& batch,
std::vector<uint64_t> seq_nos)
-> std::shared_ptr<arrow::RecordBatch> {
// Work-around to turn tag into sequence numbers (overwrites existing buffer)
assert(batch->column_name(1) == "tag"); // sanity check
assert(batch->column(1)->type_id() == arrow::Type::UINT64);
std::shared_ptr<arrow::UInt64Array> seq;
ConvertTagsToSeq(std::static_pointer_cast<arrow::UInt64Array>(batch->column(1)),
std::move(seq_nos), &seq);
// Work-around to turn uint8 fields back into boolean again.
std::shared_ptr<arrow::BooleanArray> hypermiling, orientation;
ConvertUInt8ToBool(
std::static_pointer_cast<arrow::UInt8Array>(batch->GetColumnByName("hypermiling")),
&hypermiling);
ConvertUInt8ToBool(
std::static_pointer_cast<arrow::UInt8Array>(batch->GetColumnByName("orientation")),
&orientation);
std::vector<std::shared_ptr<arrow::Array>> columns = {
seq,
batch->GetColumnByName("timestamp"),
batch->GetColumnByName("timezone"),
batch->GetColumnByName("vin"),
batch->GetColumnByName("odometer"),
hypermiling,
batch->GetColumnByName("avgspeed"),
batch->GetColumnByName("sec_in_band"),
batch->GetColumnByName("miles_in_time_range"),
batch->GetColumnByName("const_speed_miles_in_band"),
batch->GetColumnByName("vary_speed_miles_in_band"),
batch->GetColumnByName("sec_decel"),
batch->GetColumnByName("sec_accel"),
batch->GetColumnByName("braking"),
batch->GetColumnByName("accel"),
orientation,
batch->GetColumnByName("small_speed_var"),
batch->GetColumnByName("large_speed_var"),
batch->GetColumnByName("accel_decel"),
batch->GetColumnByName("speed_changes")};
// Sanity check in debug.
for (const auto& col : columns) {
assert(col != nullptr);
}
// Work-around to fix schema field order (should be zero-copy)
auto result =
arrow::RecordBatch::Make(TripParser::output_schema(), batch->num_rows(), columns);
return result;
}
[[nodiscard]] auto TripParser::Parse(const std::vector<illex::JSONBuffer*>& in,
std::vector<ParsedBatch>* out) -> Status {
std::vector<uint64_t> seq_nos;
size_t bytes_total = 0;
size_t expected_rows = 0;
for (size_t i = 0; i < in.size(); i++) {
SPDLOG_DEBUG("TripParser | Parsing buffer {:2}:\n{}", i, ToString(*in[i], false));
BOLSON_ROE(WriteInputMetaData(platform_, in[i], i));
seq_nos.push_back(in[i]->range().first);
bytes_total += in[i]->size();
expected_rows += in[i]->num_jsons();
}
// Reset kernel.
kernel_->Reset();
// Start kernel.
kernel_->Start();
// Wait for finish.
// kernel_->PollUntilDone();
// Grab the return value (number of parsed JSON objects) and wrap the output Batch.
dau_t ret_val;
ret_val.full = 0;
uint64_t num_rows = 0;
uint32_t status = 0;
do {
// status reg @ offset 1
ReadMMIO(platform_, 1, &status, 0, "Status");
#ifndef NDEBUG
uint64_t bytes_consumed = 0;
for (int i = 0; i < num_hardware_parsers_; i++) {
uint32_t bc = 0;
BOLSON_ROE(ReadMMIO(platform_, bytes_consumed_offset(i), &bc, 0,
"Bytes consumed " + std::to_string(i)));
SPDLOG_DEBUG("TripParser | Parser {:2} bytes consumed: {}/{}", i, bc,
in[i]->size());
bytes_consumed += bc;
}
SPDLOG_DEBUG("TripParser | Total bytes consumed: {}/{}", bytes_consumed, bytes_total);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
#else
std::this_thread::sleep_for(std::chrono::microseconds(BOLSON_QUEUE_WAIT_US));
#endif
} while ((status & stat_done) != stat_done);
// Grab the return value (number of parsed JSON objects) and wrap the output Batch.
FLETCHER_ROE(kernel_->GetReturn(&ret_val.lo, &ret_val.hi));
num_rows = static_cast<uint64_t>(ret_val.full);
if (num_rows != expected_rows) {
return Status(Error::OpaeError,
"Expected " + std::to_string(expected_rows) +
" rows, but OPAE TripParser returned batch with " +
std::to_string(num_rows) + " rows.");
}
std::shared_ptr<arrow::RecordBatch> unfixed_result;
BOLSON_ROE(
WrapTripReport(num_rows, *output_arrays_sw_, output_schema_sw(), &unfixed_result));
auto result = FixResult(unfixed_result, seq_nos);
out->push_back(ParsedBatch(result, {0, static_cast<uint64_t>(result->num_rows() - 1)}));
return Status::OK();
}
auto TripParser::WriteInputMetaData(fletcher::Platform* platform, illex::JSONBuffer* in,
size_t idx) -> Status {
// rewrite the input last index because of opae limitations.
BOLSON_ROE(WriteMMIO(platform, input_lastidx_offset(idx),
static_cast<uint32_t>(in->size()), idx, "input last idx"));
dau_t input_addr;
input_addr.full = h2d_addr_map->at(in->data());
BOLSON_ROE(WriteMMIO(platform, input_values_lo_offset(idx), input_addr.lo, idx,
"input values addr lo"));
BOLSON_ROE(WriteMMIO(platform, input_values_hi_offset(idx), input_addr.hi, idx,
"input values addr hi"));
BOLSON_ROE(WriteMMIO(platform, tag_offset(idx), idx, idx, "tag"));
return Status::OK();
}
TripParser::TripParser(fletcher::Platform* platform, fletcher::Context* context,
fletcher::Kernel* kernel, AddrMap* addr_map,
std::vector<std::shared_ptr<arrow::Array>>* output_arrays,
size_t num_parsers)
: platform_(platform),
context_(context),
kernel_(kernel),
h2d_addr_map(addr_map),
output_arrays_sw_(output_arrays),
num_hardware_parsers_(num_parsers) {}
auto ToString(const illex::JSONBuffer& buffer, bool show_contents) -> std::string {
std::stringstream ss;
ss << "Buffer : " << buffer.data() << "\n"
<< "Capacity : " << buffer.capacity() << "\n"
<< "Size : " << buffer.size() << "\n"
<< "JSONS : " << buffer.num_jsons();
if (show_contents) {
ss << "\n";
ss << std::string_view(reinterpret_cast<const char*>(buffer.data()), buffer.size());
}
return ss.str();
}
void AddTripOptionsToCLI(CLI::App* sub, TripOptions* out) {
sub->add_option("--trip-afu-id", out->afu_id,
"OPAE \"trip report\" AFU ID. "
"If not supplied, it is derived from number of parser instances.");
sub->add_option("--trip-num-parsers", out->num_parsers,
"OPAE \"trip report\" number of parser instances.")
->default_val(BOLSON_DEFAULT_OPAE_TRIP_PARSERS);
}
auto TripReportBatchToString(const arrow::RecordBatch& batch) -> std::string {
std::stringstream ss;
for (size_t r = 0; r < batch.num_rows(); r++) {
for (size_t c = 0; c < batch.num_columns(); c++) {
ss << std::setw(25) << batch.column_name(c) << " : ";
switch (batch.column(c)->type_id()) {
case arrow::Type::UINT64:
ss << std::static_pointer_cast<arrow::UInt64Array>(batch.column(c))->Value(r);
break;
case arrow::Type::BOOL:
ss << std::static_pointer_cast<arrow::BooleanArray>(batch.column(c))->Value(r);
break;
case arrow::Type::FIXED_SIZE_LIST: {
assert(batch.column(c)->type()->field(0)->type()->id() == arrow::Type::UINT64);
auto slice = std::static_pointer_cast<arrow::UInt64Array>(
std::static_pointer_cast<arrow::FixedSizeListArray>(batch.column(c))
->value_slice(r));
ss << "[";
for (int i = 0; i < slice->length(); i++) {
ss << slice->Value(i);
if (i != slice->length() - 1) {
ss << ",";
}
}
ss << "]";
break;
}
case arrow::Type::STRING:
ss << std::static_pointer_cast<arrow::StringArray>(batch.column(c))
->GetString(r);
break;
default:
ss << "INVALID TYPE!";
}
ss << std::endl;
}
ss << std::string(96, '-') << std::endl;
}
return ss.str();
}
auto TripParserContext::input_schema() const -> std::shared_ptr<arrow::Schema> {
return TripParser::input_schema();
}
auto TripParserContext::output_schema() const -> std::shared_ptr<arrow::Schema> {
return TripParser::output_schema();
}
auto TripParserContext::CheckThreadCount(size_t num_threads) const -> size_t { return 1; }
auto TripParserContext::CheckBufferCount(size_t num_buffers) const -> size_t {
return num_parsers_;
}
auto TripParserContext::Make(const TripOptions& opts, size_t input_size,
std::shared_ptr<ParserContext>* out) -> Status {
std::string afu_id;
DeriveAFUID(opts.afu_id, BOLSON_DEFAULT_OPAE_TRIP_AFUID, opts.num_parsers, &afu_id);
SPDLOG_DEBUG("TripParserContext | Using AFU ID: {}", afu_id);
// Create and set up result.
auto result = std::shared_ptr<TripParserContext>(new TripParserContext(opts));
SPDLOG_DEBUG("TripParserContext | Setting up for {} parsers.", result->num_parsers_);
FLETCHER_ROE(fletcher::Platform::Make("opae", &result->platform, false));
result->afu_id_ = afu_id;
char* afu_id_ptr = result->afu_id_.data();
result->platform->init_data = &afu_id_ptr;
// Initialize the platform.
FLETCHER_ROE(result->platform->Init());
// Allocate input buffers.
BOLSON_ROE(result->AllocateBuffers(result->num_parsers_,
DivideCeil(input_size, result->num_parsers_)));
// Pull everything through the fletcher stack once.
FLETCHER_ROE(fletcher::Context::Make(&result->context, result->platform));
BOLSON_ROE(result->PrepareInputBatches());
BOLSON_ROE(result->PrepareOutputBatch());
for (const auto& batch : result->batches_in) {
FLETCHER_ROE(result->context->QueueRecordBatch(batch));
}
FLETCHER_ROE(result->context->QueueRecordBatch(result->batch_out_hw));
// Enable context.
FLETCHER_ROE(result->context->Enable());
// Construct kernel handler.
result->kernel = std::make_shared<fletcher::Kernel>(result->context);
// Write metadata.
FLETCHER_ROE(result->kernel->WriteMetaData());
// Workaround to obtain buffer device address.
result->h2d_addr_map = ExtractAddrMap(result->context.get());
SPDLOG_DEBUG("TripParserContext | OPAE host address / device address map:");
for (auto& kv : result->h2d_addr_map) {
SPDLOG_DEBUG(" H: 0x{:016X} <--> D: 0x{:016X}", reinterpret_cast<uint64_t>(kv.first),
kv.second);
}
SPDLOG_DEBUG("TripParserContext | Preparing parser.");
BOLSON_ROE(result->PrepareParser());
*out = result;
return Status::OK();
}
auto TripParserContext::parsers() -> std::vector<std::shared_ptr<Parser>> {
return {parser};
}
TripParserContext::TripParserContext(const TripOptions& opts)
: num_parsers_(opts.num_parsers), afu_id_(opts.afu_id) {
allocator_ = std::make_shared<buffer::OpaeAllocator>();
}
auto TripParserContext::PrepareParser() -> Status {
parser = std::make_shared<TripParser>(platform.get(), context.get(), kernel.get(),
&h2d_addr_map, &output_arrays_sw, num_parsers_);
return Status::OK();
}
} // namespace bolson::parse::opae
|
#include "app/MouseEvents.h"
#include "app/Context.h"
#include "system/ScriptSystem.h"
#include "utils/Log.h"
#include "utils/StringBimap.h"
#include <SDL_mouse.h>
#include <cstdint>
#include <utility>
namespace {
pg::StringBimap<pg::MouseButton> initMap() {
pg::StringBimap<pg::MouseButton> bimap{};
bimap.insert(pg::MouseButton::Left, "Left");
bimap.insert(pg::MouseButton::Middle, "Middle");
bimap.insert(pg::MouseButton::Right, "Right");
return bimap;
}
const pg::StringBimap<pg::MouseButton>& mousemapInstance() {
static pg::StringBimap<pg::MouseButton> instance = initMap();
return instance;
}
const char* toString(pg::MouseButton button) {
return mousemapInstance().at(button).c_str();
}
pg::MouseButton toEnum(std::string str) {
return mousemapInstance().at(str);
}
}
namespace pg {
MouseEvents::MouseEvents(Context& context)
: mouseDownCallbacks_{},
mousePressedCallbacks_{},
mouseUpCallbacks_{},
mouseScrollCallbacks_{},
mouseScrollEntityCallbacks_{},
context_{ context },
scriptSystem_{ nullptr } {}
math::Vec2i MouseEvents::getMouseCoords() const {
return currentCoords_;
}
math::Vec2f MouseEvents::getNormalizedMouseCoords() const {
return math::Vec2f{
2.f * currentCoords_.x / context_.window->width() - 1.f,
1.f - (2.f * currentCoords_.y / context_.window->height())
};
}
math::Vec2f MouseEvents::getMouseDelta() const {
return math::Vec2f{
float(currentCoords_.x - previousCoords_.x) / context_.window->width(),
- float(currentCoords_.y - previousCoords_.y) / context_.window->height()
};
}
bool MouseEvents::handleEvent(const SDL_Event& event) {
if (event.type == SDL_MOUSEBUTTONDOWN) {
auto it = mouseDownCallbacks_.find(event.button.button);
if (it != mouseDownCallbacks_.end()) {
it->second.callback();
for (ecs::Entity* entity : it->second.entities) {
scriptSystem_->onMouseDown(toString(MouseButton(it->first)), entity);
}
return true;
}
}
else if (event.type == SDL_MOUSEBUTTONUP) {
auto it = mouseUpCallbacks_.find(event.button.button);
if (it != mouseUpCallbacks_.end()) {
it->second.callback();
for (ecs::Entity* entity : it->second.entities) {
scriptSystem_->onMouseUp(toString(MouseButton(it->first)), entity);
}
return true;
}
}
else if (event.type == SDL_MOUSEWHEEL) {
for (auto& callback : mouseScrollCallbacks_) {
callback(event.wheel.x, event.wheel.y);
}
for (auto* entity : mouseScrollEntityCallbacks_) {
scriptSystem_->onMouseScroll(event.wheel.x, event.wheel.y, entity);
}
return mouseScrollCallbacks_.size() || mouseScrollEntityCallbacks_.size();
}
return false;
}
void MouseEvents::handleMousePressedCallbacks() {
previousCoords_ = currentCoords_;
const uint32_t state = SDL_GetMouseState(¤tCoords_.x, ¤tCoords_.y);
for (auto& pair : mousePressedCallbacks_) {
if (state & SDL_BUTTON(pair.first)) {
pair.second.callback();
for (ecs::Entity* entity : pair.second.entities) {
scriptSystem_->onMousePressed(toString(MouseButton(pair.first)), entity);
}
}
}
}
void MouseEvents::addToMap_(std::map<int, CallbackData>& m, MouseButton button, ecs::Entity* entity) {
auto it = m.find(int(button));
if (it != m.end()) {
it->second.entities.push_back(entity);
}
else {
m.insert(std::make_pair(int(button), CallbackData(entity)));
}
}
void MouseEvents::addToMap_(std::map<int, CallbackData>& m, MouseButton button, std::function<void()> callback) {
auto it = m.find(int(button));
if (it != m.end()) {
it->second.callback = callback;
}
else {
m.insert(std::make_pair(int(button), CallbackData(callback)));
}
}
void MouseEvents::registerMouseDownScriptCallback(std::string button, ecs::Entity* entity) {
addToMap_(mouseDownCallbacks_, toEnum(button), entity);
}
void MouseEvents::registerMousePressedScriptCallback(std::string button, ecs::Entity* entity) {
addToMap_(mousePressedCallbacks_, toEnum(button), entity);
}
void MouseEvents::registerMouseUpScriptCallback(std::string button, ecs::Entity* entity) {
addToMap_(mouseUpCallbacks_, toEnum(button), entity);
}
void MouseEvents::registerMouseDownCallback(MouseButton button, std::function<void()> callback) {
addToMap_(mouseDownCallbacks_, button, callback);
}
void MouseEvents::registerMousePressedCallback(MouseButton button, std::function<void()> callback) {
addToMap_(mousePressedCallbacks_, button, callback);
}
void MouseEvents::registerMouseUpCallback(MouseButton button, std::function<void()> callback) {
addToMap_(mouseUpCallbacks_, button, callback);
}
void MouseEvents::registerMouseScrollCallback(std::function<void(std::int32_t, std::int32_t)> callback) {
mouseScrollCallbacks_.push_back(callback);
}
void MouseEvents::registerMouseScrollScriptCallback(ecs::Entity* entity) {
mouseScrollEntityCallbacks_.push_back(entity);
}
void MouseEvents::setScriptHandler(system::ScriptSystem& system) {
scriptSystem_ = &system;
}
}
|
/*
* Copyright (C) 2011-2020 Intel Corporation. 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.
*
*/
#include "ValidityTestUtils.h"
namespace intel { namespace sgx { namespace dcap { namespace parser {
const std::time_t NOT_BEFORE_TIME = 1523600956;
const std::time_t NOT_AFTER_TIME = 1744525756;
x509::Validity createValidity(std::time_t notBeforeTime,
std::time_t notAfterTime)
{
return x509::Validity(notBeforeTime, notAfterTime);
}
}}}} // namespace intel { namespace sgx { namespace dcap { namespace parser {
|
/*******************************************************************************
"A Collection of Useful C++ Classes for Digital Signal Processing"
By Vinnie Falco
Official project location:
https://github.com/vinniefalco/DSPFilters
See Documentation.cpp for contact information, notes, and bibliography.
--------------------------------------------------------------------------------
License: MIT License (http://www.opensource.org/licenses/mit-license.php)
Copyright (c) 2009 by Vinnie Falco
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.
*******************************************************************************/
#include "DspFilters/Common.h"
#include "DspFilters/Elliptic.h"
namespace Dsp {
namespace Elliptic {
// shit ton of math in here
// approximation to complete elliptic integral of the first kind.
// fast convergence, peak error less than 2e-16.
double Solver::ellipticK (double k)
{
double m = k*k;
double a = 1;
double b = sqrt (1 - m);
double c = a - b;
double co;
do
{
co = c;
c = (a - b) / 2;
double ao = (a + b) / 2;
b = sqrt (a*b);
a = ao;
}
while (c<co);
return doublePi / (a + a);
}
//------------------------------------------------------------------------------
AnalogLowPass::AnalogLowPass ()
: m_numPoles (-1)
{
setNormal (0, 1);
}
void AnalogLowPass::design (int numPoles,
double rippleDb,
double rolloff)
{
if (m_numPoles != numPoles ||
m_rippleDb != rippleDb ||
m_rolloff != rolloff)
{
m_numPoles = numPoles;
m_rippleDb = rippleDb;
m_rolloff = rolloff;
reset ();
// calculate
//const double ep = rippleDb; // passband ripple
const int n = numPoles;
double e2=pow(10.,rippleDb/10)-1;
//double xi = rolloff + 1;
double xi = 5 * exp (rolloff - 1) + 1;
m_K = Solver::ellipticK(1/xi);
m_Kprime = Solver::ellipticK(sqrt(1-1/(xi*xi)));
int ni = ((n & 1) == 1) ? 0 : 1;
int i;
double f[100]; // HACK!!!
for (i = 1; i <= n/2; i++)
{
double u = (2*i-ni)*m_K/n;
double sn = calcsn(u);
sn *= 2*doublePi/m_K;
f[i] = m_zeros[i-1] = 1/sn;
}
m_zeros[n/2] = std::numeric_limits<double>::infinity();
double fb = 1/(2*doublePi);
m_nin = n % 2;
m_n2 = n/2;
for (i = 1; i <= m_n2; i++)
{
double x = f[m_n2+1-i];
m_z1[i] = sqrt(1-1/(x*x));
}
double ee = e2;//pow(10., rippleDb/20)-1;
m_e = sqrt(ee);
double fbb = fb*fb;
m_m = m_nin+2*m_n2;
m_em = 2*(m_m/2);
double tp = 2*doublePi;
calcfz();
calcqz();
if (m_m > m_em)
m_c1[2*m_m] = 0;
for (i = 0; i <= 2*m_m; i += 2)
m_a1[m_m-i/2] = m_c1[i] + m_d1[i];
double a0 = findfact(m_m);
int r = 0;
while (r < m_em/2)
{
r++;
m_p[r] /= 10;
m_q1[r] /= 100;
double d = 1+m_p[r]+m_q1[r];
m_b1[r] = (1+m_p[r]/2)*fbb/d;
m_zf1[r] = fb/pow(d, .25);
m_zq1[r] = 1/sqrt(fabs(2*(1-m_b1[r]/(m_zf1[r]*m_zf1[r]))));
m_zw1[r] = tp*m_zf1[r];
m_rootR[r] = -.5*m_zw1[r]/m_zq1[r];
m_rootR[r+m_em/2] = m_rootR[r];
m_rootI[r] = .5*sqrt(fabs(m_zw1[r]*m_zw1[r]/(m_zq1[r]*m_zq1[r]) - 4*m_zw1[r]*m_zw1[r]));
m_rootI[r+m_em/2] = -m_rootI[r];
complex_t pole (
-.5*m_zw1[r]/m_zq1[r],
.5*sqrt(fabs(m_zw1[r]*m_zw1[r]/(m_zq1[r]*m_zq1[r]) - 4*m_zw1[r]*m_zw1[r])));
complex_t zero (0, m_zeros[r-1]);
addPoleZeroConjugatePairs (pole, zero);
}
if (a0 != 0)
{
m_rootR[r+1+m_em/2] = -sqrt(fbb/(.1*a0-1))*tp;
m_rootI[r+1+m_em/2] = 0;
add (-sqrt(fbb/(.1*a0-1))*tp, infinity());
}
setNormal (0, (numPoles&1) ? 1. : pow (10., -rippleDb / 20.0));
}
}
// generate the product of (z+s1[i]) for i = 1 .. sn and store it in b1[]
// (i.e. f[z] = b1[0] + b1[1] z + b1[2] z^2 + ... b1[sn] z^sn)
void AnalogLowPass::prodpoly( int sn )
{
m_b1[0] = m_s1[1];
m_b1[1] = 1;
int i, j;
for (j = 2; j <= sn; j++)
{
m_a1[0] = m_s1[j]*m_b1[0];
for (i = 1; i <= j-1; i++)
m_a1[i] = m_b1[i-1]+m_s1[j]*m_b1[i];
for (i = 0; i != j; i++)
m_b1[i] = m_a1[i];
m_b1[j] = 1;
}
}
// determine f(z)^2
void AnalogLowPass::calcfz2( int i )
{
int ji = 0;
int jf = 0;
if (i < m_em+2)
{
ji = 0;
jf = i;
}
if (i > m_em)
{
ji = i-m_em;
jf = m_em;
}
m_c1[i] = 0;
int j;
for(j = ji; j <= jf; j += 2)
m_c1[i] += m_a1[j]*(m_a1[i-j]*pow(10., m_m-i/2));
}
// calculate f(z)
void AnalogLowPass::calcfz( void )
{
int i = 1;
if( m_nin == 1 )
m_s1[i++] = 1;
for (; i <= m_nin+m_n2; i++)
m_s1[i] = m_s1[i+m_n2] = m_z1[i-m_nin];
prodpoly(m_nin+2*m_n2);
for (i = 0; i <= m_em; i += 2)
m_a1[i] = m_e*m_b1[i];
for (i = 0; i <= 2*m_em; i += 2)
calcfz2(i);
}
// determine q(z)
void AnalogLowPass::calcqz( void )
{
int i;
for (i = 1; i <= m_nin; i++)
m_s1[i] = -10;
for (; i <= m_nin+m_n2; i++)
m_s1[i] = -10*m_z1[i-m_nin]*m_z1[i-m_nin];
for (; i <= m_nin+2*m_n2; i++)
m_s1[i] = m_s1[i-m_n2];
prodpoly(m_m);
int dd = ((m_nin & 1) == 1) ? -1 : 1;
for (i = 0; i <= 2*m_m; i += 2)
m_d1[i] = dd*m_b1[i/2];
}
// compute factors
double AnalogLowPass::findfact(int t)
{
int i;
double a = 0;
for (i = 1; i <= t; i++)
m_a1[i] /= m_a1[0];
m_a1[0] = m_b1[0] = m_c1[0] = 1;
int i1 = 0;
for(;;)
{
if (t <= 2)
break;
double p0 = 0, q0 = 0;
i1++;
for(;;)
{
m_b1[1] = m_a1[1] - p0;
m_c1[1] = m_b1[1] - p0;
for (i = 2; i <= t; i++)
m_b1[i] = m_a1[i]-p0*m_b1[i-1]-q0*m_b1[i-2];
for (i = 2; i < t; i++)
m_c1[i] = m_b1[i]-p0*m_c1[i-1]-q0*m_c1[i-2];
int x1 = t-1;
int x2 = t-2;
int x3 = t-3;
double x4 = m_c1[x2]*m_c1[x2]+m_c1[x3]*(m_b1[x1]-m_c1[x1]);
if (x4 == 0)
x4 = 1e-3;
double ddp = (m_b1[x1]*m_c1[x2]-m_b1[t]*m_c1[x3])/x4;
p0 += ddp;
double dq = (m_b1[t]*m_c1[x2]-m_b1[x1]*(m_c1[x1]-m_b1[x1]))/x4;
q0 += dq;
if (fabs(ddp+dq) < 1e-6)
break;
}
m_p[i1] = p0;
m_q1[i1] = q0;
m_a1[1] = m_a1[1]-p0;
t -= 2;
for (i = 2; i <= t; i++)
m_a1[i] -= p0*m_a1[i-1]+q0*m_a1[i-2];
if (t <= 2)
break;
}
if (t == 2)
{
i1++;
m_p[i1] = m_a1[1];
m_q1[i1] = m_a1[2];
}
if (t == 1)
a = -m_a1[1];
return a;
}
double AnalogLowPass::calcsn(double u)
{
double sn = 0;
int j;
// q = modular constant
double q = exp(-doublePi*m_Kprime/m_K);
double v = doublePi*.5*u/m_K;
for (j = 0; ; j++)
{
double w = pow(q, j+.5);
sn += w*sin((2*j+1)*v)/(1-w*w);
if (w < 1e-7)
break;
}
return sn;
}
//------------------------------------------------------------------------------
void LowPassBase::setup (int order,
double sampleRate,
double cutoffFrequency,
double rippleDb,
double rolloff)
{
m_analogProto.design (order, rippleDb, rolloff);
LowPassTransform (cutoffFrequency / sampleRate,
m_digitalProto,
m_analogProto);
Cascade::setLayout (m_digitalProto);
}
void HighPassBase::setup (int order,
double sampleRate,
double cutoffFrequency,
double rippleDb,
double rolloff)
{
m_analogProto.design (order, rippleDb, rolloff);
HighPassTransform (cutoffFrequency / sampleRate,
m_digitalProto,
m_analogProto);
Cascade::setLayout (m_digitalProto);
}
void BandPassBase::setup (int order,
double sampleRate,
double centerFrequency,
double widthFrequency,
double rippleDb,
double rolloff)
{
m_analogProto.design (order, rippleDb, rolloff);
BandPassTransform (centerFrequency / sampleRate,
widthFrequency / sampleRate,
m_digitalProto,
m_analogProto);
Cascade::setLayout (m_digitalProto);
}
void BandStopBase::setup (int order,
double sampleRate,
double centerFrequency,
double widthFrequency,
double rippleDb,
double rolloff)
{
m_analogProto.design (order, rippleDb, rolloff);
BandStopTransform (centerFrequency / sampleRate,
widthFrequency / sampleRate,
m_digitalProto,
m_analogProto);
Cascade::setLayout (m_digitalProto);
}
}
}
|
//
// Copyright (c) 2012-2020 Kris Jusiak (kris at jusiak dot net)
//
// 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)
//
#ifndef BOOST_DI_TYPE_TRAITS_REBIND_TRAITS_HPP
#define BOOST_DI_TYPE_TRAITS_REBIND_TRAITS_HPP
#include "boost/di/fwd.hpp"
namespace type_traits {
template <class, class T>
struct rebind_traits {
using type = T;
};
template <class T, class TName, class _>
struct rebind_traits<T, named<TName, _>> {
using type = named<TName, T>;
};
template <class T, class D, class U>
struct rebind_traits<std::unique_ptr<T, D>, U> {
using type = std::unique_ptr<U, D>;
};
template <class T, class D, class TName, class _>
struct rebind_traits<std::unique_ptr<T, D>, named<TName, _>> {
using type = named<TName, std::unique_ptr<T, D>>;
};
template <class T, class U>
struct rebind_traits<std::shared_ptr<T>, U> {
using type = std::shared_ptr<U>;
};
template <class T, class TName, class _>
struct rebind_traits<std::shared_ptr<T>, named<TName, _>> {
using type = named<TName, std::shared_ptr<T>>;
};
template <class T, class U>
struct rebind_traits<std::weak_ptr<T>, U> {
using type = std::weak_ptr<U>;
};
template <class T, class TName, class _>
struct rebind_traits<std::weak_ptr<T>, named<TName, _>> {
using type = named<TName, std::weak_ptr<T>>;
};
template <class T, class U>
struct rebind_traits<boost::shared_ptr<T>, U> {
using type = boost::shared_ptr<U>;
};
template <class T, class TName, class _>
struct rebind_traits<boost::shared_ptr<T>, named<TName, _>> {
using type = named<TName, boost::shared_ptr<T>>;
};
template <class T, class U>
using rebind_traits_t = typename rebind_traits<T, U>::type;
} // namespace type_traits
#endif
|
// Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
#include "extern/beatsaber-hook/shared/utils/byref.hpp"
// Including type: System.Enum
#include "System/Enum.hpp"
// Completed includes
// Type namespace: Polyglot
namespace Polyglot {
// Size: 0x4
#pragma pack(push, 1)
// Autogenerated type: Polyglot.LanguageDirection
// [TokenAttribute] Offset: FFFFFFFF
struct LanguageDirection/*, public System::Enum*/ {
public:
// public System.Int32 value__
// Size: 0x4
// Offset: 0x0
int value;
// Field size check
static_assert(sizeof(int) == 0x4);
// Creating value type constructor for type: LanguageDirection
constexpr LanguageDirection(int value_ = {}) noexcept : value{value_} {}
// Creating interface conversion operator: operator System::Enum
operator System::Enum() noexcept {
return *reinterpret_cast<System::Enum*>(this);
}
// Creating conversion operator: operator int
constexpr operator int() const noexcept {
return value;
}
// static field const value: static public Polyglot.LanguageDirection LeftToRight
static constexpr const int LeftToRight = 0;
// Get static field: static public Polyglot.LanguageDirection LeftToRight
static Polyglot::LanguageDirection _get_LeftToRight();
// Set static field: static public Polyglot.LanguageDirection LeftToRight
static void _set_LeftToRight(Polyglot::LanguageDirection value);
// static field const value: static public Polyglot.LanguageDirection RightToLeft
static constexpr const int RightToLeft = 1;
// Get static field: static public Polyglot.LanguageDirection RightToLeft
static Polyglot::LanguageDirection _get_RightToLeft();
// Set static field: static public Polyglot.LanguageDirection RightToLeft
static void _set_RightToLeft(Polyglot::LanguageDirection value);
// Get instance field: public System.Int32 value__
int _get_value__();
// Set instance field: public System.Int32 value__
void _set_value__(int value);
}; // Polyglot.LanguageDirection
#pragma pack(pop)
static check_size<sizeof(LanguageDirection), 0 + sizeof(int)> __Polyglot_LanguageDirectionSizeCheck;
static_assert(sizeof(LanguageDirection) == 0x4);
}
#include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
DEFINE_IL2CPP_ARG_TYPE(Polyglot::LanguageDirection, "Polyglot", "LanguageDirection");
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
|
/*
*
* Copyright (c) 2021 Project CHIP Authors
*
* 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.
*/
// THIS FILE IS GENERATED BY ZAP
#include <cinttypes>
#include <cstdint>
#include "app/util/util.h"
#include <app-common/zap-generated/af-structs.h>
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app-common/zap-generated/ids/Commands.h>
#include <app/InteractionModelEngine.h>
// Currently we need some work to keep compatible with ember lib.
#include <app/util/ember-compatibility-functions.h>
namespace chip {
namespace app {
namespace {
void ReportCommandUnsupported(Command * aCommandObj, EndpointId aEndpointId, ClusterId aClusterId, CommandId aCommandId)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
aClusterId, aCommandId, (CommandPathFlags::kEndpointIdValid) };
aCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::UnsupportedCommand);
ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandId),
ChipLogValueMEI(aClusterId));
}
} // anonymous namespace
// Cluster specific command parsing
namespace clusters {
namespace AdministratorCommissioning {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::AdministratorCommissioning::Commands::Ids::OpenBasicCommissioningWindow: {
expectArgumentCount = 1;
uint16_t CommissioningTimeout;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(CommissioningTimeout);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfAdministratorCommissioningClusterOpenBasicCommissioningWindowCallback(aEndpointId, apCommandObj,
CommissioningTimeout);
}
break;
}
case Clusters::AdministratorCommissioning::Commands::Ids::OpenCommissioningWindow: {
expectArgumentCount = 6;
uint16_t CommissioningTimeout;
chip::ByteSpan PAKEVerifier;
uint16_t Discriminator;
uint32_t Iterations;
chip::ByteSpan Salt;
uint16_t PasscodeID;
bool argExists[6];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 6)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(CommissioningTimeout);
break;
case 1:
TLVUnpackError = aDataTlv.Get(PAKEVerifier);
break;
case 2:
TLVUnpackError = aDataTlv.Get(Discriminator);
break;
case 3:
TLVUnpackError = aDataTlv.Get(Iterations);
break;
case 4:
TLVUnpackError = aDataTlv.Get(Salt);
break;
case 5:
TLVUnpackError = aDataTlv.Get(PasscodeID);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount)
{
wasHandled = emberAfAdministratorCommissioningClusterOpenCommissioningWindowCallback(
aEndpointId, apCommandObj, CommissioningTimeout, PAKEVerifier, Discriminator, Iterations, Salt, PasscodeID);
}
break;
}
case Clusters::AdministratorCommissioning::Commands::Ids::RevokeCommissioning: {
wasHandled = emberAfAdministratorCommissioningClusterRevokeCommissioningCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::AdministratorCommissioning::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::AdministratorCommissioning::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace AdministratorCommissioning
namespace BarrierControl {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::BarrierControl::Commands::Ids::BarrierControlGoToPercent: {
expectArgumentCount = 1;
uint8_t percentOpen;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(percentOpen);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfBarrierControlClusterBarrierControlGoToPercentCallback(aEndpointId, apCommandObj, percentOpen);
}
break;
}
case Clusters::BarrierControl::Commands::Ids::BarrierControlStop: {
wasHandled = emberAfBarrierControlClusterBarrierControlStopCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::BarrierControl::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::BarrierControl::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace BarrierControl
namespace Basic {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::Basic::Id, aCommandId);
}
} // namespace Basic
namespace Binding {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::Binding::Commands::Ids::Bind: {
expectArgumentCount = 4;
chip::NodeId nodeId;
chip::GroupId groupId;
chip::EndpointId endpointId;
chip::ClusterId clusterId;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(nodeId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(endpointId);
break;
case 3:
TLVUnpackError = aDataTlv.Get(clusterId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfBindingClusterBindCallback(aEndpointId, apCommandObj, nodeId, groupId, endpointId, clusterId);
}
break;
}
case Clusters::Binding::Commands::Ids::Unbind: {
expectArgumentCount = 4;
chip::NodeId nodeId;
chip::GroupId groupId;
chip::EndpointId endpointId;
chip::ClusterId clusterId;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(nodeId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(endpointId);
break;
case 3:
TLVUnpackError = aDataTlv.Get(clusterId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfBindingClusterUnbindCallback(aEndpointId, apCommandObj, nodeId, groupId, endpointId, clusterId);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::Binding::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::Binding::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace Binding
namespace ColorControl {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::ColorControl::Commands::Ids::ColorLoopSet: {
expectArgumentCount = 7;
uint8_t updateFlags;
uint8_t action;
uint8_t direction;
uint16_t time;
uint16_t startHue;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[7];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 7)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(updateFlags);
break;
case 1:
TLVUnpackError = aDataTlv.Get(action);
break;
case 2:
TLVUnpackError = aDataTlv.Get(direction);
break;
case 3:
TLVUnpackError = aDataTlv.Get(time);
break;
case 4:
TLVUnpackError = aDataTlv.Get(startHue);
break;
case 5:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 6:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterColorLoopSetCallback(
aEndpointId, apCommandObj, updateFlags, action, direction, time, startHue, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::EnhancedMoveHue: {
expectArgumentCount = 4;
uint8_t moveMode;
uint16_t rate;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterEnhancedMoveHueCallback(aEndpointId, apCommandObj, moveMode, rate,
optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::EnhancedMoveToHue: {
expectArgumentCount = 5;
uint16_t enhancedHue;
uint8_t direction;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(enhancedHue);
break;
case 1:
TLVUnpackError = aDataTlv.Get(direction);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterEnhancedMoveToHueCallback(aEndpointId, apCommandObj, enhancedHue, direction,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::EnhancedMoveToHueAndSaturation: {
expectArgumentCount = 5;
uint16_t enhancedHue;
uint8_t saturation;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(enhancedHue);
break;
case 1:
TLVUnpackError = aDataTlv.Get(saturation);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterEnhancedMoveToHueAndSaturationCallback(
aEndpointId, apCommandObj, enhancedHue, saturation, transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::EnhancedStepHue: {
expectArgumentCount = 5;
uint8_t stepMode;
uint16_t stepSize;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterEnhancedStepHueCallback(aEndpointId, apCommandObj, stepMode, stepSize,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveColor: {
expectArgumentCount = 4;
int16_t rateX;
int16_t rateY;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(rateX);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rateY);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveColorCallback(aEndpointId, apCommandObj, rateX, rateY, optionsMask,
optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveColorTemperature: {
expectArgumentCount = 6;
uint8_t moveMode;
uint16_t rate;
uint16_t colorTemperatureMinimum;
uint16_t colorTemperatureMaximum;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[6];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 6)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
case 2:
TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum);
break;
case 3:
TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 5:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 6 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveColorTemperatureCallback(
aEndpointId, apCommandObj, moveMode, rate, colorTemperatureMinimum, colorTemperatureMaximum, optionsMask,
optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveHue: {
expectArgumentCount = 4;
uint8_t moveMode;
uint8_t rate;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveHueCallback(aEndpointId, apCommandObj, moveMode, rate, optionsMask,
optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveSaturation: {
expectArgumentCount = 4;
uint8_t moveMode;
uint8_t rate;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveSaturationCallback(aEndpointId, apCommandObj, moveMode, rate,
optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveToColor: {
expectArgumentCount = 5;
uint16_t colorX;
uint16_t colorY;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(colorX);
break;
case 1:
TLVUnpackError = aDataTlv.Get(colorY);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveToColorCallback(aEndpointId, apCommandObj, colorX, colorY,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveToColorTemperature: {
expectArgumentCount = 4;
uint16_t colorTemperature;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(colorTemperature);
break;
case 1:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveToColorTemperatureCallback(aEndpointId, apCommandObj, colorTemperature,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveToHue: {
expectArgumentCount = 5;
uint8_t hue;
uint8_t direction;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(hue);
break;
case 1:
TLVUnpackError = aDataTlv.Get(direction);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveToHueCallback(aEndpointId, apCommandObj, hue, direction, transitionTime,
optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveToHueAndSaturation: {
expectArgumentCount = 5;
uint8_t hue;
uint8_t saturation;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(hue);
break;
case 1:
TLVUnpackError = aDataTlv.Get(saturation);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveToHueAndSaturationCallback(aEndpointId, apCommandObj, hue, saturation,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::MoveToSaturation: {
expectArgumentCount = 4;
uint8_t saturation;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(saturation);
break;
case 1:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterMoveToSaturationCallback(aEndpointId, apCommandObj, saturation,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::StepColor: {
expectArgumentCount = 5;
int16_t stepX;
int16_t stepY;
uint16_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepX);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepY);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterStepColorCallback(aEndpointId, apCommandObj, stepX, stepY, transitionTime,
optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::StepColorTemperature: {
expectArgumentCount = 7;
uint8_t stepMode;
uint16_t stepSize;
uint16_t transitionTime;
uint16_t colorTemperatureMinimum;
uint16_t colorTemperatureMaximum;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[7];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 7)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(colorTemperatureMinimum);
break;
case 4:
TLVUnpackError = aDataTlv.Get(colorTemperatureMaximum);
break;
case 5:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 6:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterStepColorTemperatureCallback(
aEndpointId, apCommandObj, stepMode, stepSize, transitionTime, colorTemperatureMinimum, colorTemperatureMaximum,
optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::StepHue: {
expectArgumentCount = 5;
uint8_t stepMode;
uint8_t stepSize;
uint8_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterStepHueCallback(aEndpointId, apCommandObj, stepMode, stepSize,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::StepSaturation: {
expectArgumentCount = 5;
uint8_t stepMode;
uint8_t stepSize;
uint8_t transitionTime;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfColorControlClusterStepSaturationCallback(aEndpointId, apCommandObj, stepMode, stepSize,
transitionTime, optionsMask, optionsOverride);
}
break;
}
case Clusters::ColorControl::Commands::Ids::StopMoveStep: {
expectArgumentCount = 2;
uint8_t optionsMask;
uint8_t optionsOverride;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(optionsMask);
break;
case 1:
TLVUnpackError = aDataTlv.Get(optionsOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled =
emberAfColorControlClusterStopMoveStepCallback(aEndpointId, apCommandObj, optionsMask, optionsOverride);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::ColorControl::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::ColorControl::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace ColorControl
namespace DiagnosticLogs {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::DiagnosticLogs::Commands::Ids::RetrieveLogsRequest: {
expectArgumentCount = 3;
uint8_t intent;
uint8_t requestedProtocol;
chip::ByteSpan transferFileDesignator;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(intent);
break;
case 1:
TLVUnpackError = aDataTlv.Get(requestedProtocol);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transferFileDesignator);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfDiagnosticLogsClusterRetrieveLogsRequestCallback(aEndpointId, apCommandObj, intent,
requestedProtocol, transferFileDesignator);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::DiagnosticLogs::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::DiagnosticLogs::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace DiagnosticLogs
namespace DoorLock {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::DoorLock::Commands::Ids::ClearAllPins: {
wasHandled = emberAfDoorLockClusterClearAllPinsCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::DoorLock::Commands::Ids::ClearAllRfids: {
wasHandled = emberAfDoorLockClusterClearAllRfidsCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::DoorLock::Commands::Ids::ClearHolidaySchedule: {
expectArgumentCount = 1;
uint8_t scheduleId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterClearHolidayScheduleCallback(aEndpointId, apCommandObj, scheduleId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::ClearPin: {
expectArgumentCount = 1;
uint16_t userId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterClearPinCallback(aEndpointId, apCommandObj, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::ClearRfid: {
expectArgumentCount = 1;
uint16_t userId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterClearRfidCallback(aEndpointId, apCommandObj, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::ClearWeekdaySchedule: {
expectArgumentCount = 2;
uint8_t scheduleId;
uint16_t userId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterClearWeekdayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::ClearYeardaySchedule: {
expectArgumentCount = 2;
uint8_t scheduleId;
uint16_t userId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterClearYeardayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetHolidaySchedule: {
expectArgumentCount = 1;
uint8_t scheduleId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetHolidayScheduleCallback(aEndpointId, apCommandObj, scheduleId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetLogRecord: {
expectArgumentCount = 1;
uint16_t logIndex;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(logIndex);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetLogRecordCallback(aEndpointId, apCommandObj, logIndex);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetPin: {
expectArgumentCount = 1;
uint16_t userId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetPinCallback(aEndpointId, apCommandObj, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetRfid: {
expectArgumentCount = 1;
uint16_t userId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetRfidCallback(aEndpointId, apCommandObj, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetUserType: {
expectArgumentCount = 1;
uint16_t userId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetUserTypeCallback(aEndpointId, apCommandObj, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetWeekdaySchedule: {
expectArgumentCount = 2;
uint8_t scheduleId;
uint16_t userId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetWeekdayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::GetYeardaySchedule: {
expectArgumentCount = 2;
uint8_t scheduleId;
uint16_t userId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterGetYeardayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId);
}
break;
}
case Clusters::DoorLock::Commands::Ids::LockDoor: {
expectArgumentCount = 1;
const uint8_t * PIN;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(PIN);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterLockDoorCallback(aEndpointId, apCommandObj, const_cast<uint8_t *>(PIN));
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetHolidaySchedule: {
expectArgumentCount = 4;
uint8_t scheduleId;
uint32_t localStartTime;
uint32_t localEndTime;
uint8_t operatingModeDuringHoliday;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(localStartTime);
break;
case 2:
TLVUnpackError = aDataTlv.Get(localEndTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(operatingModeDuringHoliday);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetHolidayScheduleCallback(aEndpointId, apCommandObj, scheduleId, localStartTime,
localEndTime, operatingModeDuringHoliday);
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetPin: {
expectArgumentCount = 4;
uint16_t userId;
uint8_t userStatus;
uint8_t userType;
const uint8_t * pin;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userStatus);
break;
case 2:
TLVUnpackError = aDataTlv.Get(userType);
break;
case 3:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(pin);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetPinCallback(aEndpointId, apCommandObj, userId, userStatus, userType,
const_cast<uint8_t *>(pin));
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetRfid: {
expectArgumentCount = 4;
uint16_t userId;
uint8_t userStatus;
uint8_t userType;
const uint8_t * id;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userStatus);
break;
case 2:
TLVUnpackError = aDataTlv.Get(userType);
break;
case 3:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(id);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetRfidCallback(aEndpointId, apCommandObj, userId, userStatus, userType,
const_cast<uint8_t *>(id));
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetUserType: {
expectArgumentCount = 2;
uint16_t userId;
uint8_t userType;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(userId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userType);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetUserTypeCallback(aEndpointId, apCommandObj, userId, userType);
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetWeekdaySchedule: {
expectArgumentCount = 7;
uint8_t scheduleId;
uint16_t userId;
uint8_t daysMask;
uint8_t startHour;
uint8_t startMinute;
uint8_t endHour;
uint8_t endMinute;
bool argExists[7];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 7)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(daysMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(startHour);
break;
case 4:
TLVUnpackError = aDataTlv.Get(startMinute);
break;
case 5:
TLVUnpackError = aDataTlv.Get(endHour);
break;
case 6:
TLVUnpackError = aDataTlv.Get(endMinute);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 7 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetWeekdayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId,
daysMask, startHour, startMinute, endHour, endMinute);
}
break;
}
case Clusters::DoorLock::Commands::Ids::SetYeardaySchedule: {
expectArgumentCount = 4;
uint8_t scheduleId;
uint16_t userId;
uint32_t localStartTime;
uint32_t localEndTime;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(scheduleId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(userId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(localStartTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(localEndTime);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterSetYeardayScheduleCallback(aEndpointId, apCommandObj, scheduleId, userId,
localStartTime, localEndTime);
}
break;
}
case Clusters::DoorLock::Commands::Ids::UnlockDoor: {
expectArgumentCount = 1;
const uint8_t * PIN;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(PIN);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterUnlockDoorCallback(aEndpointId, apCommandObj, const_cast<uint8_t *>(PIN));
}
break;
}
case Clusters::DoorLock::Commands::Ids::UnlockWithTimeout: {
expectArgumentCount = 2;
uint16_t timeoutInSeconds;
const uint8_t * pin;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(timeoutInSeconds);
break;
case 1:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(pin);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfDoorLockClusterUnlockWithTimeoutCallback(aEndpointId, apCommandObj, timeoutInSeconds,
const_cast<uint8_t *>(pin));
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::DoorLock::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::DoorLock::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace DoorLock
namespace EthernetNetworkDiagnostics {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::EthernetNetworkDiagnostics::Commands::Ids::ResetCounts: {
wasHandled = emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::EthernetNetworkDiagnostics::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::EthernetNetworkDiagnostics::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace EthernetNetworkDiagnostics
namespace GeneralCommissioning {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::GeneralCommissioning::Commands::Ids::ArmFailSafe: {
expectArgumentCount = 3;
uint16_t expiryLengthSeconds;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(expiryLengthSeconds);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfGeneralCommissioningClusterArmFailSafeCallback(aEndpointId, apCommandObj, expiryLengthSeconds,
breadcrumb, timeoutMs);
}
break;
}
case Clusters::GeneralCommissioning::Commands::Ids::CommissioningComplete: {
wasHandled = emberAfGeneralCommissioningClusterCommissioningCompleteCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::GeneralCommissioning::Commands::Ids::SetRegulatoryConfig: {
expectArgumentCount = 4;
uint8_t location;
const uint8_t * countryCode;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(location);
break;
case 1:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(countryCode);
break;
case 2:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 3:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfGeneralCommissioningClusterSetRegulatoryConfigCallback(
aEndpointId, apCommandObj, location, const_cast<uint8_t *>(countryCode), breadcrumb, timeoutMs);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::GeneralCommissioning::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::GeneralCommissioning::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace GeneralCommissioning
namespace Groups {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::Groups::Commands::Ids::AddGroup: {
expectArgumentCount = 2;
uint16_t groupId;
const uint8_t * groupName;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(groupName);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled =
emberAfGroupsClusterAddGroupCallback(aEndpointId, apCommandObj, groupId, const_cast<uint8_t *>(groupName));
}
break;
}
case Clusters::Groups::Commands::Ids::AddGroupIfIdentifying: {
expectArgumentCount = 2;
uint16_t groupId;
const uint8_t * groupName;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(groupName);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfGroupsClusterAddGroupIfIdentifyingCallback(aEndpointId, apCommandObj, groupId,
const_cast<uint8_t *>(groupName));
}
break;
}
case Clusters::Groups::Commands::Ids::GetGroupMembership: {
expectArgumentCount = 2;
uint8_t groupCount;
/* TYPE WARNING: array array defaults to */ uint8_t * groupList;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupCount);
break;
case 1:
// Just for compatibility, we will add array type support in IM later.
TLVUnpackError = aDataTlv.GetDataPtr(const_cast<const uint8_t *&>(groupList));
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfGroupsClusterGetGroupMembershipCallback(aEndpointId, apCommandObj, groupCount, groupList);
}
break;
}
case Clusters::Groups::Commands::Ids::RemoveAllGroups: {
wasHandled = emberAfGroupsClusterRemoveAllGroupsCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::Groups::Commands::Ids::RemoveGroup: {
expectArgumentCount = 1;
uint16_t groupId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfGroupsClusterRemoveGroupCallback(aEndpointId, apCommandObj, groupId);
}
break;
}
case Clusters::Groups::Commands::Ids::ViewGroup: {
expectArgumentCount = 1;
uint16_t groupId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfGroupsClusterViewGroupCallback(aEndpointId, apCommandObj, groupId);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::Groups::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::Groups::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace Groups
namespace IasZone {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::IasZone::Commands::Ids::ZoneEnrollResponse: {
expectArgumentCount = 2;
uint8_t enrollResponseCode;
uint8_t zoneId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(enrollResponseCode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(zoneId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfIasZoneClusterZoneEnrollResponseCallback(aEndpointId, apCommandObj, enrollResponseCode, zoneId);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::IasZone::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::IasZone::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace IasZone
namespace Identify {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::Identify::Commands::Ids::Identify: {
expectArgumentCount = 1;
uint16_t identifyTime;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(identifyTime);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfIdentifyClusterIdentifyCallback(aEndpointId, apCommandObj, identifyTime);
}
break;
}
case Clusters::Identify::Commands::Ids::IdentifyQuery: {
wasHandled = emberAfIdentifyClusterIdentifyQueryCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::Identify::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::Identify::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace Identify
namespace LevelControl {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::LevelControl::Commands::Ids::Move: {
expectArgumentCount = 4;
uint8_t moveMode;
uint8_t rate;
uint8_t optionMask;
uint8_t optionOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled =
emberAfLevelControlClusterMoveCallback(aEndpointId, apCommandObj, moveMode, rate, optionMask, optionOverride);
}
break;
}
case Clusters::LevelControl::Commands::Ids::MoveToLevel: {
expectArgumentCount = 4;
uint8_t level;
uint16_t transitionTime;
uint8_t optionMask;
uint8_t optionOverride;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(level);
break;
case 1:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 2:
TLVUnpackError = aDataTlv.Get(optionMask);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfLevelControlClusterMoveToLevelCallback(aEndpointId, apCommandObj, level, transitionTime,
optionMask, optionOverride);
}
break;
}
case Clusters::LevelControl::Commands::Ids::MoveToLevelWithOnOff: {
expectArgumentCount = 2;
uint8_t level;
uint16_t transitionTime;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(level);
break;
case 1:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled =
emberAfLevelControlClusterMoveToLevelWithOnOffCallback(aEndpointId, apCommandObj, level, transitionTime);
}
break;
}
case Clusters::LevelControl::Commands::Ids::MoveWithOnOff: {
expectArgumentCount = 2;
uint8_t moveMode;
uint8_t rate;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(moveMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(rate);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfLevelControlClusterMoveWithOnOffCallback(aEndpointId, apCommandObj, moveMode, rate);
}
break;
}
case Clusters::LevelControl::Commands::Ids::Step: {
expectArgumentCount = 5;
uint8_t stepMode;
uint8_t stepSize;
uint16_t transitionTime;
uint8_t optionMask;
uint8_t optionOverride;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
TLVUnpackError = aDataTlv.Get(optionMask);
break;
case 4:
TLVUnpackError = aDataTlv.Get(optionOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfLevelControlClusterStepCallback(aEndpointId, apCommandObj, stepMode, stepSize, transitionTime,
optionMask, optionOverride);
}
break;
}
case Clusters::LevelControl::Commands::Ids::StepWithOnOff: {
expectArgumentCount = 3;
uint8_t stepMode;
uint8_t stepSize;
uint16_t transitionTime;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(stepMode);
break;
case 1:
TLVUnpackError = aDataTlv.Get(stepSize);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled =
emberAfLevelControlClusterStepWithOnOffCallback(aEndpointId, apCommandObj, stepMode, stepSize, transitionTime);
}
break;
}
case Clusters::LevelControl::Commands::Ids::Stop: {
expectArgumentCount = 2;
uint8_t optionMask;
uint8_t optionOverride;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(optionMask);
break;
case 1:
TLVUnpackError = aDataTlv.Get(optionOverride);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfLevelControlClusterStopCallback(aEndpointId, apCommandObj, optionMask, optionOverride);
}
break;
}
case Clusters::LevelControl::Commands::Ids::StopWithOnOff: {
wasHandled = emberAfLevelControlClusterStopWithOnOffCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::LevelControl::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::LevelControl::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace LevelControl
namespace LowPower {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::LowPower::Commands::Ids::Sleep: {
wasHandled = emberAfLowPowerClusterSleepCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::LowPower::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::LowPower::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace LowPower
namespace NetworkCommissioning {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::NetworkCommissioning::Commands::Ids::AddThreadNetwork: {
expectArgumentCount = 3;
chip::ByteSpan operationalDataset;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(operationalDataset);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterAddThreadNetworkCallback(aEndpointId, apCommandObj,
operationalDataset, breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::AddWiFiNetwork: {
expectArgumentCount = 4;
chip::ByteSpan ssid;
chip::ByteSpan credentials;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(ssid);
break;
case 1:
TLVUnpackError = aDataTlv.Get(credentials);
break;
case 2:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 3:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterAddWiFiNetworkCallback(aEndpointId, apCommandObj, ssid, credentials,
breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::DisableNetwork: {
expectArgumentCount = 3;
chip::ByteSpan networkID;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(networkID);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterDisableNetworkCallback(aEndpointId, apCommandObj, networkID,
breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::EnableNetwork: {
expectArgumentCount = 3;
chip::ByteSpan networkID;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(networkID);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterEnableNetworkCallback(aEndpointId, apCommandObj, networkID,
breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::GetLastNetworkCommissioningResult: {
expectArgumentCount = 1;
uint32_t timeoutMs;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterGetLastNetworkCommissioningResultCallback(aEndpointId, apCommandObj,
timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::RemoveNetwork: {
expectArgumentCount = 3;
chip::ByteSpan NetworkID;
uint64_t Breadcrumb;
uint32_t TimeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(NetworkID);
break;
case 1:
TLVUnpackError = aDataTlv.Get(Breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(TimeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterRemoveNetworkCallback(aEndpointId, apCommandObj, NetworkID,
Breadcrumb, TimeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::ScanNetworks: {
expectArgumentCount = 3;
chip::ByteSpan ssid;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(ssid);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled =
emberAfNetworkCommissioningClusterScanNetworksCallback(aEndpointId, apCommandObj, ssid, breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::UpdateThreadNetwork: {
expectArgumentCount = 3;
chip::ByteSpan operationalDataset;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(operationalDataset);
break;
case 1:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 2:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterUpdateThreadNetworkCallback(
aEndpointId, apCommandObj, operationalDataset, breadcrumb, timeoutMs);
}
break;
}
case Clusters::NetworkCommissioning::Commands::Ids::UpdateWiFiNetwork: {
expectArgumentCount = 4;
chip::ByteSpan ssid;
chip::ByteSpan credentials;
uint64_t breadcrumb;
uint32_t timeoutMs;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(ssid);
break;
case 1:
TLVUnpackError = aDataTlv.Get(credentials);
break;
case 2:
TLVUnpackError = aDataTlv.Get(breadcrumb);
break;
case 3:
TLVUnpackError = aDataTlv.Get(timeoutMs);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfNetworkCommissioningClusterUpdateWiFiNetworkCallback(aEndpointId, apCommandObj, ssid,
credentials, breadcrumb, timeoutMs);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::NetworkCommissioning::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::NetworkCommissioning::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace NetworkCommissioning
namespace OtaSoftwareUpdateProvider {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::OtaSoftwareUpdateProvider::Commands::Ids::ApplyUpdateRequest: {
expectArgumentCount = 2;
chip::ByteSpan updateToken;
uint32_t newVersion;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(updateToken);
break;
case 1:
TLVUnpackError = aDataTlv.Get(newVersion);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(aEndpointId, apCommandObj,
updateToken, newVersion);
}
break;
}
case Clusters::OtaSoftwareUpdateProvider::Commands::Ids::NotifyUpdateApplied: {
expectArgumentCount = 2;
chip::ByteSpan updateToken;
uint32_t currentVersion;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(updateToken);
break;
case 1:
TLVUnpackError = aDataTlv.Get(currentVersion);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(aEndpointId, apCommandObj,
updateToken, currentVersion);
}
break;
}
case Clusters::OtaSoftwareUpdateProvider::Commands::Ids::QueryImage: {
expectArgumentCount = 9;
uint16_t vendorId;
uint16_t productId;
uint16_t imageType;
uint16_t hardwareVersion;
uint32_t currentVersion;
uint8_t protocolsSupported;
const uint8_t * location;
bool requestorCanConsent;
chip::ByteSpan metadataForProvider;
bool argExists[9];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 9)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(vendorId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(productId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(imageType);
break;
case 3:
TLVUnpackError = aDataTlv.Get(hardwareVersion);
break;
case 4:
TLVUnpackError = aDataTlv.Get(currentVersion);
break;
case 5:
TLVUnpackError = aDataTlv.Get(protocolsSupported);
break;
case 6:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(location);
break;
case 7:
TLVUnpackError = aDataTlv.Get(requestorCanConsent);
break;
case 8:
TLVUnpackError = aDataTlv.Get(metadataForProvider);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 9 == validArgumentCount)
{
wasHandled = emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(
aEndpointId, apCommandObj, vendorId, productId, imageType, hardwareVersion, currentVersion, protocolsSupported,
const_cast<uint8_t *>(location), requestorCanConsent, metadataForProvider);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OtaSoftwareUpdateProvider::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::OtaSoftwareUpdateProvider::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace OtaSoftwareUpdateProvider
namespace OnOff {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::OnOff::Commands::Ids::Off: {
wasHandled = emberAfOnOffClusterOffCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::OnOff::Commands::Ids::On: {
wasHandled = emberAfOnOffClusterOnCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::OnOff::Commands::Ids::Toggle: {
wasHandled = emberAfOnOffClusterToggleCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OnOff::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::OnOff::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace OnOff
namespace OperationalCredentials {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::OperationalCredentials::Commands::Ids::AddNOC: {
expectArgumentCount = 4;
chip::ByteSpan NOCArray;
chip::ByteSpan IPKValue;
chip::NodeId CaseAdminNode;
uint16_t AdminVendorId;
bool argExists[4];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 4)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(NOCArray);
break;
case 1:
TLVUnpackError = aDataTlv.Get(IPKValue);
break;
case 2:
TLVUnpackError = aDataTlv.Get(CaseAdminNode);
break;
case 3:
TLVUnpackError = aDataTlv.Get(AdminVendorId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 4 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddNOCCallback(aEndpointId, apCommandObj, NOCArray, IPKValue,
CaseAdminNode, AdminVendorId);
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::AddTrustedRootCertificate: {
expectArgumentCount = 1;
chip::ByteSpan RootCertificate;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(RootCertificate);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterAddTrustedRootCertificateCallback(aEndpointId, apCommandObj,
RootCertificate);
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::OpCSRRequest: {
expectArgumentCount = 1;
chip::ByteSpan CSRNonce;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(CSRNonce);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterOpCSRRequestCallback(aEndpointId, apCommandObj, CSRNonce);
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::RemoveFabric: {
expectArgumentCount = 1;
uint8_t FabricIndex;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(FabricIndex);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterRemoveFabricCallback(aEndpointId, apCommandObj, FabricIndex);
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::RemoveTrustedRootCertificate: {
expectArgumentCount = 1;
chip::ByteSpan TrustedRootIdentifier;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(TrustedRootIdentifier);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterRemoveTrustedRootCertificateCallback(aEndpointId, apCommandObj,
TrustedRootIdentifier);
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::UpdateFabricLabel: {
expectArgumentCount = 1;
const uint8_t * Label;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(Label);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterUpdateFabricLabelCallback(aEndpointId, apCommandObj,
const_cast<uint8_t *>(Label));
}
break;
}
case Clusters::OperationalCredentials::Commands::Ids::UpdateNOC: {
expectArgumentCount = 1;
chip::ByteSpan NOCArray;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(NOCArray);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfOperationalCredentialsClusterUpdateNOCCallback(aEndpointId, apCommandObj, NOCArray);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::OperationalCredentials::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::OperationalCredentials::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace OperationalCredentials
namespace Scenes {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::Scenes::Commands::Ids::AddScene: {
expectArgumentCount = 5;
uint16_t groupId;
uint8_t sceneId;
uint16_t transitionTime;
const uint8_t * sceneName;
/* TYPE WARNING: array array defaults to */ uint8_t * extensionFieldSets;
bool argExists[5];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 5)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(sceneId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
case 3:
// TODO(#5542): The cluster handlers should accept a ByteSpan for all string types.
TLVUnpackError = aDataTlv.GetDataPtr(sceneName);
break;
case 4:
// Just for compatibility, we will add array type support in IM later.
TLVUnpackError = aDataTlv.GetDataPtr(const_cast<const uint8_t *&>(extensionFieldSets));
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 5 == validArgumentCount)
{
wasHandled = emberAfScenesClusterAddSceneCallback(aEndpointId, apCommandObj, groupId, sceneId, transitionTime,
const_cast<uint8_t *>(sceneName), extensionFieldSets);
}
break;
}
case Clusters::Scenes::Commands::Ids::GetSceneMembership: {
expectArgumentCount = 1;
uint16_t groupId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfScenesClusterGetSceneMembershipCallback(aEndpointId, apCommandObj, groupId);
}
break;
}
case Clusters::Scenes::Commands::Ids::RecallScene: {
expectArgumentCount = 3;
uint16_t groupId;
uint8_t sceneId;
uint16_t transitionTime;
bool argExists[3];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 3)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(sceneId);
break;
case 2:
TLVUnpackError = aDataTlv.Get(transitionTime);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 3 == validArgumentCount)
{
wasHandled = emberAfScenesClusterRecallSceneCallback(aEndpointId, apCommandObj, groupId, sceneId, transitionTime);
}
break;
}
case Clusters::Scenes::Commands::Ids::RemoveAllScenes: {
expectArgumentCount = 1;
uint16_t groupId;
bool argExists[1];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 1)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 1 == validArgumentCount)
{
wasHandled = emberAfScenesClusterRemoveAllScenesCallback(aEndpointId, apCommandObj, groupId);
}
break;
}
case Clusters::Scenes::Commands::Ids::RemoveScene: {
expectArgumentCount = 2;
uint16_t groupId;
uint8_t sceneId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(sceneId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfScenesClusterRemoveSceneCallback(aEndpointId, apCommandObj, groupId, sceneId);
}
break;
}
case Clusters::Scenes::Commands::Ids::StoreScene: {
expectArgumentCount = 2;
uint16_t groupId;
uint8_t sceneId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(sceneId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfScenesClusterStoreSceneCallback(aEndpointId, apCommandObj, groupId, sceneId);
}
break;
}
case Clusters::Scenes::Commands::Ids::ViewScene: {
expectArgumentCount = 2;
uint16_t groupId;
uint8_t sceneId;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(groupId);
break;
case 1:
TLVUnpackError = aDataTlv.Get(sceneId);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfScenesClusterViewSceneCallback(aEndpointId, apCommandObj, groupId, sceneId);
}
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::Scenes::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::Scenes::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace Scenes
namespace SoftwareDiagnostics {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::SoftwareDiagnostics::Commands::Ids::ResetWatermarks: {
wasHandled = emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::SoftwareDiagnostics::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::SoftwareDiagnostics::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace SoftwareDiagnostics
namespace TestCluster {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::TestCluster::Commands::Ids::Test: {
wasHandled = emberAfTestClusterClusterTestCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::TestCluster::Commands::Ids::TestAddArguments: {
expectArgumentCount = 2;
uint8_t arg1;
uint8_t arg2;
bool argExists[2];
memset(argExists, 0, sizeof argExists);
while ((TLVError = aDataTlv.Next()) == CHIP_NO_ERROR)
{
// Since call to aDataTlv.Next() is CHIP_NO_ERROR, the read head always points to an element.
// Skip this element if it is not a ContextTag, not consider it as an error if other values are valid.
if (!TLV::IsContextTag(aDataTlv.GetTag()))
{
continue;
}
currentDecodeTagId = TLV::TagNumFromTag(aDataTlv.GetTag());
if (currentDecodeTagId < 2)
{
if (argExists[currentDecodeTagId])
{
ChipLogProgress(Zcl, "Duplicate TLV tag %" PRIx32, TLV::TagNumFromTag(aDataTlv.GetTag()));
TLVUnpackError = CHIP_ERROR_IM_MALFORMED_COMMAND_DATA_ELEMENT;
break;
}
else
{
argExists[currentDecodeTagId] = true;
validArgumentCount++;
}
}
switch (currentDecodeTagId)
{
case 0:
TLVUnpackError = aDataTlv.Get(arg1);
break;
case 1:
TLVUnpackError = aDataTlv.Get(arg2);
break;
default:
// Unsupported tag, ignore it.
ChipLogProgress(Zcl, "Unknown TLV tag during processing.");
break;
}
if (CHIP_NO_ERROR != TLVUnpackError)
{
break;
}
}
if (CHIP_END_OF_TLV == TLVError)
{
// CHIP_END_OF_TLV means we have iterated all items in the structure, which is not a real error.
TLVError = CHIP_NO_ERROR;
}
if (CHIP_NO_ERROR == TLVError && CHIP_NO_ERROR == TLVUnpackError && 2 == validArgumentCount)
{
wasHandled = emberAfTestClusterClusterTestAddArgumentsCallback(aEndpointId, apCommandObj, arg1, arg2);
}
break;
}
case Clusters::TestCluster::Commands::Ids::TestNotHandled: {
wasHandled = emberAfTestClusterClusterTestNotHandledCallback(aEndpointId, apCommandObj);
break;
}
case Clusters::TestCluster::Commands::Ids::TestSpecific: {
wasHandled = emberAfTestClusterClusterTestSpecificCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::TestCluster::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::TestCluster::Id, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace TestCluster
namespace ThreadNetworkDiagnostics {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::ThreadNetworkDiagnostics::Commands::Ids::ResetCounts: {
wasHandled = emberAfThreadNetworkDiagnosticsClusterResetCountsCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::ThreadNetworkDiagnostics::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::ThreadNetworkDiagnostics::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace ThreadNetworkDiagnostics
namespace WiFiNetworkDiagnostics {
void DispatchServerCommand(CommandHandler * apCommandObj, CommandId aCommandId, EndpointId aEndpointId, TLV::TLVReader & aDataTlv)
{
// We are using TLVUnpackError and TLVError here since both of them can be CHIP_END_OF_TLV
// When TLVError is CHIP_END_OF_TLV, it means we have iterated all of the items, which is not a real error.
// Any error value TLVUnpackError means we have received an illegal value.
// The following variables are used for all commands to save code size.
CHIP_ERROR TLVError = CHIP_NO_ERROR;
CHIP_ERROR TLVUnpackError = CHIP_NO_ERROR;
uint32_t validArgumentCount = 0;
uint32_t expectArgumentCount = 0;
uint32_t currentDecodeTagId = 0;
bool wasHandled = false;
{
switch (aCommandId)
{
case Clusters::WiFiNetworkDiagnostics::Commands::Ids::ResetCounts: {
wasHandled = emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback(aEndpointId, apCommandObj);
break;
}
default: {
// Unrecognized command ID, error status will apply.
ReportCommandUnsupported(apCommandObj, aEndpointId, Clusters::WiFiNetworkDiagnostics::Id, aCommandId);
return;
}
}
}
if (CHIP_NO_ERROR != TLVError || CHIP_NO_ERROR != TLVUnpackError || expectArgumentCount != validArgumentCount || !wasHandled)
{
CommandPathParams returnStatusParam = { aEndpointId,
0, // GroupId
Clusters::WiFiNetworkDiagnostics::Id, aCommandId,
(CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kBadRequest,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogProgress(Zcl,
"Failed to dispatch command, %" PRIu32 "/%" PRIu32 " arguments parsed, TLVError=%" CHIP_ERROR_FORMAT
", UnpackError=%" CHIP_ERROR_FORMAT " (last decoded tag = %" PRIu32,
validArgumentCount, expectArgumentCount, TLVError.Format(), TLVUnpackError.Format(), currentDecodeTagId);
// A command with no arguments would never write currentDecodeTagId. If
// progress logging is also disabled, it would look unused. Silence that
// warning.
UNUSED_VAR(currentDecodeTagId);
}
}
} // namespace WiFiNetworkDiagnostics
} // namespace clusters
void DispatchSingleClusterCommand(ClusterId aClusterId, CommandId aCommandId, EndpointId aEndPointId, TLV::TLVReader & aReader,
CommandHandler * apCommandObj)
{
ChipLogDetail(Zcl, "Received Cluster Command: Cluster=" ChipLogFormatMEI " Command=" ChipLogFormatMEI " Endpoint=%" PRIx16,
ChipLogValueMEI(aClusterId), ChipLogValueMEI(aCommandId), aEndPointId);
Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
TLV::TLVType dataTlvType;
SuccessOrExit(aReader.EnterContainer(dataTlvType));
switch (aClusterId)
{
case Clusters::AdministratorCommissioning::Id:
clusters::AdministratorCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::BarrierControl::Id:
clusters::BarrierControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::Basic::Id:
clusters::Basic::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::Binding::Id:
clusters::Binding::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::ColorControl::Id:
clusters::ColorControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::DiagnosticLogs::Id:
clusters::DiagnosticLogs::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::DoorLock::Id:
clusters::DoorLock::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::EthernetNetworkDiagnostics::Id:
clusters::EthernetNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::GeneralCommissioning::Id:
clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::Groups::Id:
clusters::Groups::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::IasZone::Id:
clusters::IasZone::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::Identify::Id:
clusters::Identify::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::LevelControl::Id:
clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::LowPower::Id:
clusters::LowPower::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::NetworkCommissioning::Id:
clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::OtaSoftwareUpdateProvider::Id:
clusters::OtaSoftwareUpdateProvider::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::OnOff::Id:
clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::OperationalCredentials::Id:
clusters::OperationalCredentials::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::Scenes::Id:
clusters::Scenes::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::SoftwareDiagnostics::Id:
clusters::SoftwareDiagnostics::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::TestCluster::Id:
clusters::TestCluster::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::ThreadNetworkDiagnostics::Id:
clusters::ThreadNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
case Clusters::WiFiNetworkDiagnostics::Id:
clusters::WiFiNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandId, aEndPointId, aReader);
break;
default:
// Unrecognized cluster ID, error status will apply.
CommandPathParams returnStatusParam = { aEndPointId,
0, // GroupId
aClusterId, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogError(Zcl, "Unknown cluster %" PRIx32, aClusterId);
break;
}
exit:
Compatibility::ResetEmberAfObjects();
aReader.ExitContainer(dataTlvType);
}
void DispatchSingleClusterResponseCommand(ClusterId aClusterId, CommandId aCommandId, EndpointId aEndPointId,
TLV::TLVReader & aReader, CommandSender * apCommandObj)
{
ChipLogDetail(Zcl, "Received Cluster Command: Cluster=%" PRIx32 " Command=%" PRIx32 " Endpoint=%" PRIx16, aClusterId,
aCommandId, aEndPointId);
Compatibility::SetupEmberAfObjects(apCommandObj, aClusterId, aCommandId, aEndPointId);
TLV::TLVType dataTlvType;
SuccessOrExit(aReader.EnterContainer(dataTlvType));
switch (aClusterId)
{
default:
// Unrecognized cluster ID, error status will apply.
CommandPathParams returnStatusParam = { aEndPointId,
0, // GroupId
aClusterId, aCommandId, (CommandPathFlags::kEndpointIdValid) };
apCommandObj->AddStatusCode(returnStatusParam, Protocols::SecureChannel::GeneralStatusCode::kNotFound,
Protocols::SecureChannel::Id, Protocols::InteractionModel::ProtocolCode::InvalidCommand);
ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aClusterId));
break;
}
exit:
Compatibility::ResetEmberAfObjects();
aReader.ExitContainer(dataTlvType);
}
} // namespace app
} // namespace chip
|
// The IYFEngine
//
// Copyright (C) 2015-2018, Manvydas Šliamka
//
// 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 the copyright holder 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.
#ifndef ENTITY_SYSTEM_MANAGER_HPP
#define ENTITY_SYSTEM_MANAGER_HPP
#include <vector>
#include <map>
#include <memory>
#include <unordered_map>
#include "io/Path.hpp"
#include "core/interfaces/ComponentContainer.hpp"
#include "core/TransformationComponent.hpp"
#include "core/ComponentType.hpp"
#include "core/Component.hpp"
#include "core/interfaces/GarbageCollecting.hpp"
#include "utilities/ChunkedVector.hpp"
#include "utilities/IntegerPacking.hpp"
#include "utilities/NonCopyable.hpp"
#include "localization/LocalizationHandle.hpp"
namespace iyf {
/// \todo Is 8192 as good chunk size?
constexpr std::size_t SystemChunkSize = 8192;
/// \warning The container used here must ensure that all pointers remain STABLE when it grows or the contents of the elements
/// are replaced (they will never be removed).
using TransformationVector = ChunkedVector<TransformationComponent, SystemChunkSize>;
class Engine;
class EntitySystemManager;
class World;
enum class EntityMode {
/// If this mode is set, the Entity MUST forever remain in its initial place.
/// Setting this mode on objects that are not supposed to move is really important
/// for optimization.
/// \warning Enabling this and moving the object via the scripting system will invoke UNDEFINED BEHAVIOUR.
/// You may end up causing graphics bugs, navigation bugs, "invisible walls" or even crash the engine.
/// Even if everything "works" on your machine it may not work for other people, so don't do it.
/// \todo Should this forbid certain components, e.g. skeletal animation?
Static,
/// If this mode is set, the Entity can be safely moved and animated. Setting this mode on
/// objects that don't move is a waste of resources
Dynamic
};
/// The Entities can easily self destruct or be destroyed by other Entities. Moreover, the EntitySystemManager recycles destoryed Entities to
/// conserve memory and to keep the data close for CPU cache coherence. This means that using simple pointers or references is often a recipe
/// for disaster because it is impossible to know if the Entity is still the same Entity that was retrieved several frames ago. Enter EntityKey.
/// This class stores the ID of the Entity (used to determine offsets into various arrays) and its version. The version is incremented every
/// time an Entity is destoryed. By comparing a previously stored EntityKey with an EntityKey stored in an Entity, you can determine if it's
/// still valid or not. To make these checks easier (or at least less verbose), you can use EntityHandle objects that can be created by calling
/// Entity::makeHandle().
class EntityKey {
public:
static const std::uint32_t InvalidID = std::numeric_limits<std::uint32_t>::max();
static const std::uint32_t InvalidVersion = 0;
static const std::uint64_t InvalidHandle = util::Int32sToInt64(InvalidID, InvalidVersion);
/// Empty constructor that creates an invalid Entity that can be used as a placeholder
///
/// To create a valid Entity, use one of EntitySystemManager.create...() methods
EntityKey() : handle(InvalidHandle) {}
inline std::uint32_t getID() const {
return util::Int64ToInt32a(handle);
}
inline std::uint32_t getVersion() const {
return util::Int64ToInt32b(handle);
}
friend bool operator==(const EntityKey& a, const EntityKey& b) {
return a.handle == b.handle;
}
private:
friend class EntitySystemManager;
friend class Entity;
/// Creates a new valid Entity. This constructor is only accessible to EntitySystemManager and Entity
EntityKey(std::uint32_t id, std::uint32_t version) : handle(util::Int32sToInt64(id, version)) {}
std::uint64_t handle;
};
class EntityState {
private:
static_assert(static_cast<std::size_t>(ComponentBaseType::COUNT) <= 48, "You cannot have more than 48 ComponentBaseTypes");
static const int Active = 63;
static const int Initialized = 62;
static const int AwaitingDestruction = 61;
/// This bit is only used if the EntitySystemManager containing the Entity was created in editor mode.
static const int Selected = 60;
public:
inline bool isSelected() const {
return data[Selected];
}
/// Sets the selection state. Used to determine if a selection outline needs to be drawn.
inline void setSelected(bool selected) {
data[Selected] = selected;
}
inline bool isActive() const {
return data[Active];
}
/// Enables or disables the Entity.
inline void setActive(bool active) {
data[Active] = active;
}
inline bool isInitialized() const {
return data[Initialized];
}
inline bool isAwaitingDestruction() const {
return data[AwaitingDestruction];
}
/// Checks if the Entity has any components of the specified ComponentBaseType. Typically used to quickly determine if
/// a System needs to process a specific Entity or not.
inline bool hasComponentsOfType(ComponentBaseType component) const {
return data[static_cast<std::size_t>(component)];
}
/// Clears the EntityState
inline void reset() {
data.reset();
}
private:
friend class EntitySystemManager;
/// Enables or disables the bit indicating the presence of components of the specified ComponentBaseType.
inline void setHasComponentsAvailable(ComponentBaseType component, bool available) {
data[static_cast<std::size_t>(component)] = available;
}
inline void setInitialized(bool initialized) {
data[Initialized] = initialized;
}
inline void setAwaitingDestruction(bool awaitingDestruction) {
data[AwaitingDestruction] = awaitingDestruction;
}
std::bitset<64> data;
};
/// Used to make sure that an Entity is valid. The typical usage scenario is to first call isValid() and, if it returns true,
/// obtain the reference to the Entity by calling get(). Even if you call EntitySystemManager::free, the Entity will persist
/// until the end of the frame. Therefore, calling isValid() once per frame is sufficent.
class EntityHandle {
public:
EntityHandle(Entity& entity);
/// Checks if the Entity is still valid by comparing an EntityKey retrieved from it with an EntityKey stored in this object.
/// \remark Entities do not get destroyed or replaced mid-frame. Calling this method once per frame is sufficent.
bool isValid() const;
/// Obtains a reference to the Entity. If isValid() is false, it may return a different Entity, stale data or an empty region
/// that may cause undefined behaviour when accessed. Remember: Entity::getKey() is THE ONLY member function that can be
/// trusted when an Entity is empty.
inline Entity& get() const {
return entity;
}
private:
Entity& entity;
EntityKey key;
};
/// \warning The container used here must ensure that all pointers remain STABLE when it grows or the contents of the elements
/// are replaced (they will never be removed).
using EntityStateVector = ChunkedVector<EntityState, SystemChunkSize>;
/// Represents an object in the world. Each object is constructed from multiple Component objects that are managed by specific
/// System objects. All Entities have a TransformationComponent, all other components are optional and depend on desired functionality.
///
/// \todo Implement Entity parent-child relationships. Some work has already been done (e.g., EntityHierarchy that's used by the Editor
/// was made with hierarchies in mind), however, a lot of work still remains.
class Entity {
public:
/// \warning This is only public for the sake of the containers that store the entities. This constructor creates
/// an invalid and unusable Entity. To create and initialize valid entities, use EntitySystemManager::create() and
/// other similar methods from the EntitySystemManager class.
inline Entity() : manager(nullptr), transformation(nullptr), state(nullptr) {
}
template <typename T>
inline T& getComponent();
template <typename T>
inline const T& getComponent() const;
inline const EntityState& getState() const {
return *state;
}
inline bool isSelected() const {
return state->isSelected();
}
inline void setSelected(bool selected) {
state->setSelected(selected);
}
inline const TransformationComponent& getTransformation() const {
return *transformation;
}
inline TransformationComponent& getTransformation() {
return *transformation;
}
inline EntitySystemManager* getManager() const {
return manager;
}
inline EntityKey getKey() const {
return key;
}
inline const std::string& getName() const {
return name;
}
inline EntityHandle makeHandle() {
return EntityHandle(*this);
}
const std::vector<Component*>& getAllComponents() const;
/// See EntitySystemManager::attachComponent(const Component&)
/// \todo I think it should be possible to avoid additional checks here and use the key.getID() directly
bool attachComponent(const Component& component);
/// See EntitySystemManager::attachComponent(Component&&)
/// \todo I think it should be possible to avoid additional checks here and use the key.getID() directly
bool attachComponent(Component&& component);
bool removeComponent(const ComponentType& type);
/// Checks if the Entity has any components of the specifed ComponentBaseType
bool hasComponents(ComponentBaseType baseType) const;
/// Checks if the Entity has a Component of the specifed ComponentType
bool hasComponent(const ComponentType& type) const;
/// Rename the Entity.
/// \throws std::logic_error If the EntitySystemManager is not running in Editor Mode.
void setName(std::string newName);
private:
friend class EntitySystemManager;
/// Called by the EntitySystemManager when a completely new Entity is created
inline void initialize(EntitySystemManager* manager, std::string name, EntityKey key, TransformationComponent* transformation, EntityState* state) {
assert(manager != nullptr);
assert(transformation != nullptr);
assert(state != nullptr);
this->manager = manager;
this->key = key;
this->transformation = transformation;
this->name = std::move(name);
this->state = state;
}
/// Called by the EntitySystemManager when an Entity is reused
inline void reinitialize(std::string name) {
// We only need to update the name. The key is updated when the Entity is cleared, everything else is managed by the EntitySystemManager.
this->name = std::move(name);
}
inline void clear() {
EntityKey newKey(key.getID(), key.getVersion() + 1);
key = newKey;
}
EntitySystemManager* manager;
EntityKey key;
TransformationComponent* transformation;
std::string name;
EntityState* state;
};
inline EntityHandle::EntityHandle(Entity& entity) : entity(entity) {
key = entity.getKey();
}
inline bool EntityHandle::isValid() const {
return entity.getKey() == key;
}
enum class SystemSetting {
HasPreAttachCallback = 0,
HasPostDetachCallback = 1,
};
class SystemSettings {
public:
SystemSettings() {}
inline void activateSetting(SystemSetting setting) {
settings[static_cast<std::size_t>(setting)] = true;
}
inline bool isSettingActive(SystemSetting setting) const {
return settings[static_cast<std::size_t>(setting)];
}
inline std::bitset<64> getSettings() const {
return settings;
}
private:
std::bitset<64> settings;
};
/// A base class for all systems used in the Engine.
class System : public GarbageCollecting {
public:
System(EntitySystemManager* manager, SystemSettings settings, ComponentBaseType baseType, std::uint32_t subtypeCount)
: settings(settings.getSettings()), baseType(baseType), subtypeCount(subtypeCount), manager(manager) {}
inline EntitySystemManager* getManager() const {
return manager;
}
inline bool isSettingActive(SystemSetting setting) const {
return settings[static_cast<std::size_t>(setting)];
}
inline std::bitset<64> getSettings() const {
return settings;
}
/// Each system is responsible for a single ComponentBaseType
inline ComponentBaseType getManagedComponentType() const {
return baseType;
}
/// A bitset that indicates which components of this System are attached to the Entity
/// with the specifed id.
inline ComponentSubTypeFlags getAvailableComponents(std::uint32_t id) const {
return availableComponents[id];
}
/// Checks if a specific component is attached to the Entity with the specifed id
inline bool hasComponent(std::uint32_t id, const ComponentType& componentType) const {
if (componentType.getBaseType() != baseType) {
return false;
}
return hasComponent(id, componentType.getSubType());
}
inline bool hasComponent(std::uint32_t id, std::uint32_t componentSubType) const {
return availableComponents[id][componentSubType];
}
/// Checks if the Entity with the specifed id has any components that are managed by this System
inline bool hasAnyComponents(std::uint32_t id) const {
return availableComponents[id].any();
}
virtual void initialize() = 0;
virtual void dispose() = 0;
virtual void update(float delta, const EntityStateVector& entityStates) = 0;
/// Obtain the number of Component subtypes that are managed by this System. The return value must match
/// the COUNT value from a subtype enumerator (located in ComponentTypes.hpp) that corresponds to this System.
/// E.g., GraphicsSystem must return GraphicsComponent::COUNT here.
virtual std::size_t getSubTypeCount() const = 0;
inline LocalizationHandle getManagedComponentTypeName() const {
return con::ComponentBaseTypeNames[static_cast<std::size_t>(getManagedComponentType())];
}
template <typename T, bool safe = false>
inline T& getComponent(std::uint32_t id) {
static_assert(std::is_base_of_v<Component, T>, "Must provide a class derived from Component.");
if (safe) {
return dynamic_cast<T&>(getComponentBase(id, T::Type));
} else {
return static_cast<T&>(getComponentBase(id, T::Type));
}
}
template <typename T, bool safe = false>
inline const T& getComponent(std::uint32_t id) const {
static_assert(std::is_base_of_v<Component, T>, "Must provide a class derived from Component.");
if (safe) {
return dynamic_cast<const T&>(getComponentBase(id, T::Type));
} else {
return static_cast<const T&>(getComponentBase(id, T::Type));
}
}
inline Component& getComponentBase(std::uint32_t id, const ComponentType& type) {
if (type.getBaseType() != baseType) {
throw std::invalid_argument("The requested base type does not match the base type of the System.");
}
if (!availableComponents[id][type.getSubType()]) {
throw std::runtime_error("The Entity does not have any components of the requested subtype.");
}
ComponentContainer* container = getContainer(type.getSubType());
return container->get(id);
}
inline const Component& getComponentBase(std::uint32_t id, const ComponentType& type) const {
if (type.getBaseType() != baseType) {
throw std::invalid_argument("The requested base type does not match the base type of the System.");
}
if (!availableComponents[id][type.getSubType()]) {
throw std::runtime_error("The Entity does not have any components of the requested subtype.");
}
const ComponentContainer* container = getContainer(type.getSubType());
return container->get(id);
}
virtual ~System() {};
protected:
friend class EntitySystemManager;
virtual void preAttach([[maybe_unused]] Component& component, [[maybe_unused]] std::uint32_t id) {}
virtual void postDetach([[maybe_unused]] Component& component, [[maybe_unused]] std::uint32_t id) {}
/// Creates a default constructed Component of specifed ComponentType and attaches it to an Entity. Returns false if an
/// existing Component is attached to the specifed Entity. This should only be called by our friend, the EntitySystemManager
/// because some additional bookkeeping needs to be performed.
virtual Component& createAndAttachComponent(const EntityKey& key, const ComponentType& type) = 0;
inline ComponentContainer* getContainer(std::uint32_t subtype) {
return components[subtype].get();
}
inline const ComponentContainer* getContainer(std::uint32_t subtype) const {
return components[subtype].get();
}
inline Component& setComponent(std::uint32_t id, const Component& component) {
ComponentType type = component.getType();
if (type.getBaseType() != baseType) {
throw std::invalid_argument("The requested base type does not match the base type of the System.");
}
ComponentContainer* container = getContainer(type.getSubType());
Component& ret = container->set(id, component);
availableComponents[id][type.getSubType()] = true;
if (isSettingActive(SystemSetting::HasPreAttachCallback)) {
preAttach(ret, id);
}
ret.attach(this, id);
return ret;
}
inline Component& setComponent(std::uint32_t id, Component&& component) {
ComponentType type = component.getType();
if (type.getBaseType() != baseType) {
throw std::invalid_argument("The requested base type does not match the base type of the System.");
}
ComponentContainer* container = getContainer(type.getSubType());
assert(container != nullptr);
Component& ret = container->set(id, std::move(component));
availableComponents[id][type.getSubType()] = true;
if (isSettingActive(SystemSetting::HasPreAttachCallback)) {
preAttach(ret, id);
}
ret.attach(this, id);
return ret;
}
inline void destroyAllComponents(std::uint32_t id) {
ComponentSubTypeFlags flags = availableComponents[id];
throw std::runtime_error("I'm broken. FIX ME.");
for (std::size_t i = 0; i < static_cast<std::size_t>(GraphicsComponent::COUNT); ++i) {
if (flags[i]) {
destroyComponentUnchecked(id, i);
}
}
}
inline Component& destroyComponent(std::uint32_t id, const ComponentType& type) {
if (type.getBaseType() != baseType) {
throw std::invalid_argument("The requested base type does not match the base type of the System.");
}
if (!availableComponents[id][type.getSubType()]) {
throw std::runtime_error("The Entity does not have any components of the requested subtype.");
}
return destroyComponentUnchecked(id, type.getSubType());
}
inline Component& destroyComponentUnchecked(std::uint32_t id, std::uint32_t subtype) {
ComponentContainer* container = getContainer(subtype);
Component& ptr = container->get(id);
ptr.detach(this, id);
if (isSettingActive(SystemSetting::HasPostDetachCallback)) {
postDetach(ptr, id);
}
availableComponents[id][subtype] = false;
return ptr;
}
inline void resize(std::uint32_t newSize) {
availableComponents.resize(newSize);
for (std::size_t i = 0; i < subtypeCount; ++i) {
ComponentContainer* container = getContainer(i);
if (container != nullptr) {
container->resize(newSize);
}
}
}
std::bitset<64> settings;
ComponentBaseType baseType;
std::uint32_t subtypeCount;
std::array<std::unique_ptr<ComponentContainer>, 64> components;
EntitySystemManager* manager;
std::vector<ComponentSubTypeFlags> availableComponents;
};
class EntitySystemManagerCreateInfo {
public:
/// \param[in] engine Pointer to the Engine instance. Must not be nullptr
inline EntitySystemManagerCreateInfo(Engine* engine) : engine(engine), initialCapacity(1024), capacityGrowthInterval(1024), maxCapacity(8192), editorMode(false) {
if (engine == nullptr) {
throw std::invalid_argument("Engine pointer was null");
}
// Used to determine if initial values are correct
validate(true);
}
Engine* getEngine() const {
return engine;
}
/// See setInitialCapacity()
inline std::uint32_t getInitialCapacity() const {
return initialCapacity;
}
/// \warning Growth requires memory allocations or reallocations that can cause lag spikes. You should always try to set
/// initialCapacity to a sufficiently high value that won't be reached during gameplay.
///
/// \param[in] capacity when EntitySystemManager::initialize() is called, all Entity data vectors will be resized to accomodate
/// getInitialCapacity() entities. Must not be 0.
inline void setInitialCapacity(std::uint32_t capacity) {
initialCapacity = capacity;
}
/// See setCapacityGrowthInterval()
inline std::uint32_t getCapacityGrowthInterval() const {
return capacityGrowthInterval;
}
/// \param[in] growth How much should internal data vectors grow every time their capacity is exceeded? This happens when a new Entity
/// needs to be created, but internal vectors are full. In that case, EntitySystemManager::resize(currentCapaity + capacityGrowthInterval)
/// will be called. Must not be 0. Must also satisfy this condition: (maxCapacity - initialCapacity) % capacityGrowthInterval == 0
inline void setCapacityGrowthInterval(std::uint32_t growth) {
capacityGrowthInterval = growth;
}
/// See setMaxCapacity()
inline std::uint32_t getMaxCapacity() const {
return maxCapacity;
}
/// \param[in] max This value sets the maximum number of entities that the EntitySystemManager is allowed to create. Must be >= initialCapacity.
/// If the maximumCapacity is exceeded, an exception will be thrown. Used to limit memory use on purpose. Set to max value of unit32_t by default.
inline void setMaxCapacity(std::uint32_t max) {
maxCapacity = max;
}
/// See setEditorMode()
inline bool isEditorMode() const {
return editorMode;
}
/// If this is set, the EntitySystemManager will be created in "editor mode". This changes certain behaviours
inline void setEditorMode(bool editor) {
editorMode = editor;
}
/// Validates the values in this struct.
/// \throws std::invalid_argument if throwException is true and validation fails
bool validate(bool throwException = false);
private:
Engine* engine;
std::uint32_t initialCapacity;
std::uint32_t capacityGrowthInterval;
std::uint32_t maxCapacity;
bool editorMode;
};
class EntityHierarchyNode;
using EntityHierarchy = std::map<std::string, EntityHierarchyNode>;
/// For use in the EntitySystemManager::entityHierachy (check the documentation there) and the Editor.
class EntityHierarchyNode {
public:
EntityHierarchyNode() : entity(nullptr), parent(nullptr), selected(false) {}
void setSelected(bool selected) {
this->selected = selected;
entity->setSelected(selected);
}
bool isSelected() const {
return selected;
}
const EntityHierarchyNode* getParent() const {
return parent;
}
const EntityHierarchy& getChildren() const {
return children;
}
Entity& getEntity() const {
return *entity;
}
private:
friend class EntitySystemManager;
Entity* entity;
EntityHierarchyNode* parent;
EntityHierarchy children;
bool selected;
};
using SystemArray = std::array<std::unique_ptr<System>, static_cast<std::size_t>(ComponentBaseType::COUNT)>;
/// \todo Functions that take EntityKey objects should check if they are valid. Those that take just the ID, should not.
class EntitySystemManager : private NonCopyable {
public:
/// Constructs a new EntitySystemManager
///
/// \todo Now that we mostly use ChunkedVector, does the warning still apply? Is it ok to turn the remaining std::vectors into ChunkedVectors?
///
/// \todo Maybe remove initialCapacity and capacityGrowthInterval? They should probably match the chunk sizes.
EntitySystemManager(EntitySystemManagerCreateInfo createInfo);
virtual ~EntitySystemManager() { }
inline Engine* getEngine() {
return createInfo.getEngine();
}
virtual void initialize();
virtual void dispose();
virtual void update(float delta);
inline bool isEditorMode() const {
return getCreateInfo().isEditorMode();
}
/// Returns the number of Entity objects that have been created, including free slots that are not currently used at the moment.
inline std::uint32_t getEntityCount() const {
return nextID;
}
/// Turns a file path into a unique name for an Entity by extracting the filename without an extension and
/// appending a number to it if the initial result was not unique.
///
/// \remark This method is not particularly fast
std::string filePathToEntityName(const Path& name) const;
/// Turns a string into a unique name for an Entity
std::string makeUniqueName(const std::string& name) const;
// inline void getComponent(const Entity& entity, ComponentType ct) {
// SystemBase* system = getSystemManagingComponentType(ct);
// }
/// Creates a new Entity with no Components and returns an reference to it. You may start adding Components
/// and using its name in lookups immediately. Even if active is true, no updates or scripts will be called until the
/// Entity is initialized at the start of the next frame.
///
/// \remark If you're planning to use the Entity for more than a single frame, calling Entity::makeHandle() may be
/// a good idea.
///
/// \remark This method is not thread safe.
/// \todo Should I make it thread safe?
///
/// \param[in] name The name of the Entity. Must be unique in this EntitySystemManager. Use filePathToEntityName()
/// or makeUniqueName() to generate unique names when creating Entities manually
/// \param[in] active Should the Entity be automatically activated when it is initialized the next frame.
/// \return An reference to the new Entity.
EntityKey create(const std::string& name, bool active = true);
// FIXME this dude is borked.
// /// Creates n empty Entities that are guaranteed to be stored contiguously and returns their keys. Typically used when creating Entity hierarchies
// /// or when loading.
// ///
// /// \remark This method is not thread safe.
// /// \todo Should I make it thread safe?
// ///
// /// \note You should make sure that the output vector has enough space reserved to accomodate the returned entities before calling this function.
// /// This function calls push_back n times and using a vector of insufficient capacity will trigger a resize (or several).
// ///
// /// \param[in] n Number of Entity objects to create
// /// \param[out] output New EntityKey values, corresponding to created entities, will be pushed to the back of this vector.
// /// \param[in] atEnd Optional parameter. Setting it to false will tell the function to look for a contiguous range of freeSlots and place the new
// /// entities there (if a sufficent free range is found). This can be expensive because it sorts the freeSlots vector, however, it will likely save memory.
// /// Setting it to true (default) will append the entities at the end of data arrays, ignoring the freeSlots vector altogether.
// ///
// /// \todo THIS IS BROKEN AT THE MOMENT!!!
// void create(std::uint32_t n, std::vector<EntityKey>& output, bool atEnd = true);
/// Adds the Entity to the awaitingDestruction vector and sets the AwaitingDestruction bit. Actual destruction will take place some time later.
/// Freeing a parent will automatically free all child Entities as well.
///
/// The Entity and its children are guaraneed to stay alive and usable until the end of this frame.
///
/// \remark This method is not thread safe.
/// \todo Should I make it thread safe?
///
/// \param[in] key The EntityKey of the Entity to destroy
void free(const EntityKey& key);
inline void free(std::vector<EntityKey>& keys) {
for (const auto& key : keys) {
free(key);
}
}
/// Retrieve an Entity by ID. In most cases, you should prefer to use getEntityByName().
///
/// \warning This function should only be used in extremely rare cases. It does not perform ANY checks - it's possible to get an invalid Entity or
/// even crash the Engine. Moreover, the IDs are not guaranteed to stay consistent over multiple executions.
inline const Entity& getEntityByID(std::uint32_t id) const {
return entities[id];
}
/// Retrieve an Entity by ID. In most cases, you should prefer to use getEntityByName().
///
/// \warning This function should only be used in extremely rare cases. It does not perform ANY checks - it's possible to get an invalid Entity or
/// even crash the Engine. Moreover, the IDs are not guaranteed to stay consistent over multiple executions.
inline Entity& getEntityByID(std::uint32_t id) {
return entities[id];
}
/// Returns a pointer to a System that manages the specified ComponentBaseType.
///
/// \warning The EntitySystemManager retains ownership of the pointer. DO NOT call delete on it.
/// \todo This function's name is dumb. Think of something better
///
/// \param[in] ct ComponentBaseType that's managed by the system you want to get
inline System* getSystemManagingComponentType(ComponentBaseType ct) {
assert(ct != ComponentBaseType::COUNT);
return systems[static_cast<std::size_t>(ct)].get();
}
/// Returns a const pointer to a System that manages the specified ComponentBaseType.
///
/// \warning The EntitySystemManager retains ownership of the pointer. DO NOT call delete on it.
///
/// \param[in] ct ComponentBaseType that's managed by the system you want to get
inline const System* getSystemManagingComponentType(ComponentBaseType ct) const {
assert(ct != ComponentBaseType::COUNT);
return systems[static_cast<std::size_t>(ct)].get();
}
/// Attaches a default constructed Component to an Entity. Any existing components won't be replaced (this function will return
/// false) because they need to be explicitly destroyed.
///
/// \param key the EntityKey of the Entity to attach to.
/// \param component The component you want to attach.
/// \return true if attachment succeeded
bool attachComponent(const EntityKey& key, const ComponentType& type);
/// Attaches a Component to an Entity by copying it. Any existing components won't be replaced (this function will return false)
/// because they need to be explicitly destroyed.
///
/// \param key the EntityKey of the Entity to attach to.
/// \param component The component you want to attach.
/// \return true if attachment succeeded
bool attachComponent(const EntityKey& key, const Component& component);
/// Attaches a Component to an Entity by moving it. Any existing components won't be replaced (this function will return false)
/// because they need to be explicitly destroyed.
///
/// \param key the EntityKey of the Entity to attach to.
/// \param component The component you want to attach.
/// \return true if attachment succeeded
bool attachComponent(const EntityKey& key, Component&& component);
bool removeComponent(const EntityKey& key, const ComponentType& type);
/// Determines if the Entity is valid by comparing the version components of the EntityKey objects
inline bool isEntityValid(const EntityKey& key) const {
return key.getVersion() == entities[key.getID()].getKey().getVersion();
}
/// Checks if the Entity has any Components of a specific base type.
///
/// \warning This function does not perform any validation on its own and will return invalid data or
/// even crash the program if it's called on an Entity that is not valid (isEntityValid() == false)
///
/// \todo This should perform validation, but what needs to be returned when it is invalid? false? Custom enum? Throw an exception?
///
/// \param[in] key the EntityKey of the Entity to check
/// \param[in] ct Base type to look for
/// \return If a component is present or not
inline bool entityHasAnyComponents(const EntityKey& key, ComponentBaseType ct) const {
return entityHasAnyComponents(key.getID(), ct);
}
/// Checks if the Entity has any Components of a specific base type.
///
/// \warning This function does not perform any validation on its own and will return invalid data or
/// even crash the program if it's called on an Entity that is not valid (isEntityValid() == false)
///
/// \param[in] entityID the id of the Entity to check
/// \param[in] ct Base type to look for
/// \return If a component is present or not
inline bool entityHasAnyComponents(std::uint32_t entityID, ComponentBaseType ct) const {
return entityStates[entityID].hasComponentsOfType(ct);
}
/// Checks if the entity has the specified component
inline bool entityHasComponent(const EntityKey& key, const ComponentType& type) const {
return entityHasComponent(key.getID(), type);
}
inline bool entityHasComponent(std::uint32_t entityID, const ComponentType& type) const {
const System* system = getSystemManagingComponentType(type.getBaseType());
return system->hasComponent(entityID, type.getSubType());
}
inline const std::vector<Component*>& getAllComponents(const EntityKey& key) const {
return componentsInEntity[key.getID()];
}
inline const EntityState& getEntityState(const EntityKey& key) const {
return entityStates[key.getID()];
}
inline const EntityState& getEntityState(std::uint32_t entityID) const {
return entityStates[entityID];
}
inline TransformationComponent& getEntityTransformation(std::uint32_t id) {
return transformations[id];
}
inline const TransformationComponent& getEntityTransformation(std::uint32_t id) const {
return transformations[id];
}
inline TransformationComponent& getEntityTransformation(const EntityKey& key) {
return transformations[key.getID()];
}
inline const TransformationComponent& getEntityTransformation(const EntityKey& key) const {
return transformations[key.getID()];
}
inline const TransformationVector& getEntityTransformations() const {
return transformations;
}
inline TransformationVector& getEntityTransformations() {
return transformations;
}
inline std::size_t getFreeSlotCount() const {
return freeSlots.size();
}
inline std::size_t getHighestID() const {
return nextID - 1;
}
inline EntityHierarchy& getEntityHierarchy() {
if (!createInfo.isEditorMode()) {
std::logic_error("This function can only be called when an EntitySystemManager is created in editor mode.");
}
return entityHierachy;
}
/// Obtain a const reference to an array containing all Systems that are running in the Engine. Since every System corresponds to a single
/// ComponentBaseType, the array contains ComponentBaseType::COUNT elements. Moreover, when cast to an integer, ComponentBaseType enumeration
/// values may be used to access specific Systems.
///
/// Typically, you should use getSystemManagingComponentType() to fetch the Systems that you actually need. This function was created for use
/// in the Editor.
const SystemArray& getSystems() const {
return systems;
}
protected:
/// Adds a new System to this manager
void registerSystem(std::unique_ptr<System> system);
inline const EntitySystemManagerCreateInfo& getCreateInfo() const {
return createInfo;
}
private:
/// Checks if we need to resize and performs the operation if we do
void resize(std::uint32_t newSize);
void manageEntityLifecycles(float delta);
bool validateComponentAttachment() const;
/// All Entity instances and their Component instances are stored in big vectors (some exceptions exist). Simply removing them
/// (e.g. when an object gets destroyed) by using vector::erase() is not an option because that would invalidate all Entity IDs
/// that go after the removed element. Instead, we simply invalidate the data and add the ID to a list of "free slots".
std::vector<std::uint32_t> freeSlots;
/// The size of this vector must always match the number of existing Entities. It is used to determine which components exist
/// in each Entity. Using a container that exists inside the EntitySystemManager instead of storing ComponentBaseTypeFlags in each
/// Entity makes iteration signifficantly faster because a lot less data is pulled to cache.
///
/// \todo Now that I'm using a ChunkedVector, are iterators used whenever possible?
EntityStateVector entityStates;
/// The EntitySystemManager manages all transformations since they're mandatory for all entities
TransformationVector transformations;
/// A list of all components assigned to a specific entity
ChunkedVector<std::vector<Component*>, SystemChunkSize> componentsInEntity;
/// Used to check for conflicts of systems. E.g. someone attempts to register multiple systems that manage a single component type
std::bitset<static_cast<std::size_t>(ComponentBaseType::COUNT)> managedComponents;
/// The handle implementation used in this engine takes some ideas from this article: http://gamesfromwithin.com/managing-data-relationships.
/// The Entity objects stored in this vector have EntityKey variables that contain the "version" (called "counter field" in the article) of each Entity slot.
ChunkedVector<Entity, SystemChunkSize> entities;
/// Contains all Systems that are derived from System and registered with this manager.
SystemArray systems;
std::vector<EntityKey> awaitingInitialization;
std::vector<EntityKey> awaitingDestruction;
/// Maps Entity names to pointers. We're not using hash32_t here because it makes resolving hash colisions difficult.
std::unordered_map<std::string, Entity*> nameToEntity;
/// A lexicographically sorted hierarchy of EntityHierarchyNode objects. It is used to display a nice sorted list of Entities in the editor and to perform
/// searches by using incomplete Entity names. For performance reasons, this map is only built and updated when EntitySystemManager.getCreateInfo().isEditorMode()
/// is true.
///
/// \remark A map is used for several reasons, first of all, it always statys sorted. Next, neither iterators, nor references to existing elements are invalidated
/// when elements are inserted or erased. Finally, when the hierarchy changes, nodes may easily be moved from one map to another by using std::map::extract().
/// The best part? Moving an element with std::map::extract() PRESERVES its location in memory and pointers to it stay valid, which means there's no need to
/// update the parent pointer in child objects.
EntityHierarchy entityHierachy;
EntitySystemManagerCreateInfo createInfo;
std::uint32_t nextID;
std::uint32_t currentCapacity;
bool initialized;
};
inline bool Entity::attachComponent(const Component& component) {
return manager->attachComponent(key, component);
}
inline bool Entity::attachComponent(Component&& component) {
return manager->attachComponent(key, std::move(component));
}
inline bool Entity::removeComponent(const ComponentType& type) {
return manager->removeComponent(key, type);
}
inline bool Entity::hasComponents(ComponentBaseType baseType) const {
return manager->entityHasAnyComponents(key.getID(), baseType);
}
inline bool Entity::hasComponent(const ComponentType& type) const {
return manager->entityHasComponent(key.getID(), type);
}
inline const std::vector<Component*>& Entity::getAllComponents() const {
return manager->getAllComponents(key);
}
template <typename T>
inline T& Entity::getComponent() {
static_assert(std::is_base_of_v<Component, T>, "Must provide a class derived from Component.");
System* system = manager->getSystemManagingComponentType(T::Type.getBaseType());
return system->getComponent<T>(key.getID());
}
template <typename T>
inline const T& Entity::getComponent() const {
static_assert(std::is_base_of_v<Component, T>, "Must provide a class derived from Component.");
const System* system = manager->getSystemManagingComponentType(T::Type.getBaseType());
return system->getComponent<T>(key.getID());
}
// template <typename T>
// const T& System<T>::getComponent(const Entity& entity) const {
// if (manager->isEntityValid(entity) && manager->entityHasComponent(entity, getType())) {
// return components[entity.getID()];
// } else {
// throw std::out_of_range("An Entity is not valid or it does not have this component.");
// }
// }
//
// template <typename T>
// T& System<T>::getComponent(const Entity& entity) {
// if (manager->isEntityValid(entity) && manager->entityHasComponent(entity, getType())) {
// return components[entity.getID()];
// } else {
// throw std::out_of_range("An Entity is not valid or it does not have this component.");
// }
// }
}
#endif //ENTITY_SYSTEM_MANAGER_HPP
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-no-concepts
// UNSUPPORTED: gcc-10
// array
#include <array>
#include <concepts>
#include <ranges>
using range = std::array<int, 10>;
namespace stdr = std::ranges;
static_assert(!stdr::view<range>);
static_assert(std::same_as<stdr::iterator_t<range>, range::iterator>);
static_assert(stdr::common_range<range>);
static_assert(stdr::random_access_range<range>);
static_assert(stdr::contiguous_range<range>);
static_assert(stdr::sized_range<range>);
static_assert(!stdr::borrowed_range<range>);
static_assert(!stdr::view<range const>);
static_assert(std::same_as<stdr::iterator_t<range const>, range::const_iterator>);
static_assert(stdr::common_range<range const>);
static_assert(stdr::random_access_range<range const>);
static_assert(stdr::contiguous_range<range const>);
static_assert(stdr::sized_range<range const>);
static_assert(!stdr::borrowed_range<range const>);
|
// Unit test for the Partition class.
//
// C.M. Cantalupo 2011
// cmcantalupo@gmail.com
#include <iostream>
#include <algorithm>
#include <assert.h>
#include "partition.hpp"
using namespace SorterThreadedHelper;
int main(int argc, char **argv) {
int testSize = 100000;
std::vector<double> testVec(testSize);
for (int i = 0; i < testSize; ++i) {
testVec[i] = i;
}
random_shuffle(testVec.begin(), testVec.end());
int numPivots = 4;
std::set<double> pivots;
for (int i = 0; i < numPivots; i++) {
pivots.insert(testVec[i]);
}
random_shuffle(testVec.begin(), testVec.end());
Partition<double> part(pivots);
part.fill(testVec.begin(), testVec.end());
int numTasks = part.numTasks();
assert(numTasks == numPivots+1);
std::vector<size_t> taskSizes(numTasks);
part.taskSizes(taskSizes);
int sumTaskSizes = 0;
for (int i = 0; i < numTasks; ++i) {
sumTaskSizes += taskSizes[i];
}
assert(sumTaskSizes == testSize);
std::vector<double> task(testSize);
std::set<double>::iterator pivIt = pivots.begin();
for (int i = 0; i < numTasks; ++i) {
assert(i == part.curTask());
part.popTask(task.begin());
for (int j = 0; j < taskSizes[i]; j++ ) {
if (i != numPivots)
assert(task[j] < *pivIt);
else
assert(task[j] >= *pivIt);
}
if (i != numPivots-1) {
++pivIt;
}
}
}
|
#include "../Headers/FinishBlock.h"
#include "../Headers/ModelMatrix.h"
#include "../Headers/Player.h"
FinishBlock::FinishBlock(glm::vec3 pos, glm::vec3 dim, Player* p) {
this->m_pos = pos;
this->m_dimension = dim;
this->playerPointer = p;
this->hitBox.width = m_dimension.x;
this->hitBox.height = m_dimension.y;
this->hitBox.depth = m_dimension.z;
this->hitBox.pos = m_pos;
this->identifier = packIdentifier;
}
FinishBlock::~FinishBlock() {
// Empty
}
void FinishBlock::update(float deltaTime) {
GameObject::update();
// Update the hitbox
hitBox.updateBoxPos(this->m_pos);
// "Animate" the pack
this->animateTimer += deltaTime;
float offsetSine = 0.75 * sin(animateTimer * 2);
glm::vec3 p = this->m_model->getPositon();
this->m_model->setPosition(glm::vec3(p.x, p.y + offsetSine, p.z));
// Rotate them
float offset = animateTimer * 0.5;
glm::vec3 r = this->m_model->getRotations();
this->m_model->setRotations(glm::vec3(r.x, r.y + offset, r.z));
// Check if the player is picking up the pickup
checkHit();
}
void FinishBlock::checkHit() {
if (this->hitBox.AABBAABBIntersect(playerPointer->hitBox)) {
// Give information to the player
playerPointer->storePickUpPointer(this);
playerPointer->pickUpBool = true;
// Now this pickup is no longer avaiable for pickup
pickUped = true;
}
}
|
/*
* Copyright 2017 Google LLC
*
* 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 "app/src/assert.h"
#include "auth/src/desktop/auth_providers/email_auth_credential.h"
#include "auth/src/desktop/credential_impl.h"
#include "auth/src/include/firebase/auth/credential.h"
namespace firebase {
namespace auth {
// static
Credential EmailAuthProvider::GetCredential(const char* const email,
const char* const password) {
FIREBASE_ASSERT_RETURN(Credential(), email && password);
return Credential{
new CredentialImpl{new EmailAuthCredential(email, password)}};
}
} // namespace auth
} // namespace firebase
|
/*
Copyright 2018-2021 Tatsuya Yamasaki.
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.
*/
#ifndef INCLUDED_MEEVAX_KERNEL_IDENTIFIER_HPP
#define INCLUDED_MEEVAX_KERNEL_IDENTIFIER_HPP
#include <meevax/kernel/list.hpp>
#include <meevax/kernel/symbol.hpp>
namespace meevax
{
inline namespace kernel
{
struct identifier : public virtual pair
{
using pair::pair;
auto is_bound() const -> bool;
auto is_free() const -> bool;
auto symbol() const noexcept -> const_reference;
};
auto operator <<(std::ostream &, identifier const&) -> std::ostream &;
} // namespace kernel
} // namespace meevax
#endif // INCLUDED_MEEVAX_KERNEL_IDENTIFIER_HPP
|
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/dbus/init/dbus_thread_manager_base.h"
#include "base/check.h"
#include "base/command_line.h"
#include "base/system/sys_info.h"
#include "base/threading/thread.h"
#include "chromeos/dbus/constants/dbus_switches.h"
#include "dbus/bus.h"
#include "dbus/dbus_statistics.h"
namespace chromeos {
namespace {
// Returns whether to use a real D-Bus client or a stub.
bool GetUseRealClients() {
#if defined(USE_REAL_DBUS_CLIENTS)
return true;
#else
// TODO(crbug.com/952745): Always use fakes after adding
// use_real_dbus_clients=true to where needed.
return base::SysInfo::IsRunningOnChromeOS() &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kDbusStub);
#endif
}
} // namespace
DBusThreadManagerBase::DBusThreadManagerBase()
: use_real_clients_(GetUseRealClients()) {
dbus::statistics::Initialize();
if (use_real_clients_) {
// Create the D-Bus thread.
base::Thread::Options thread_options;
thread_options.message_pump_type = base::MessagePumpType::IO;
dbus_thread_ = std::make_unique<base::Thread>("D-Bus thread");
dbus_thread_->StartWithOptions(std::move(thread_options));
// Create the connection to the system bus.
dbus::Bus::Options system_bus_options;
system_bus_options.bus_type = dbus::Bus::SYSTEM;
system_bus_options.connection_type = dbus::Bus::PRIVATE;
system_bus_options.dbus_task_runner = dbus_thread_->task_runner();
system_bus_ = new dbus::Bus(system_bus_options);
}
}
DBusThreadManagerBase::~DBusThreadManagerBase() {
// Shut down the bus. During the browser shutdown, it's ok to shut down
// the bus synchronously.
if (system_bus_.get())
system_bus_->ShutdownOnDBusThreadAndBlock();
// Stop the D-Bus thread.
if (dbus_thread_)
dbus_thread_->Stop();
dbus::statistics::Shutdown();
}
bool DBusThreadManagerBase::IsUsingFakes() {
return !use_real_clients_;
}
dbus::Bus* DBusThreadManagerBase::GetSystemBus() {
return system_bus_.get();
}
} // namespace chromeos
|
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* 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 "frameworks/core/components/svg/render_svg_fe_composite.h"
#include "frameworks/core/components/svg/svg_fe_composite_component.h"
namespace OHOS::Ace {
void RenderSvgFeComposite::Update(const RefPtr<Component> &component)
{
const RefPtr<SvgFeCompositeComponent> feComponent = AceType::DynamicCast<SvgFeCompositeComponent>(component);
if (!feComponent) {
LOGW("fe offset component is null");
return;
}
auto& declaration = feComponent->GetDeclaration();
if (declaration) {
in2_ = declaration->GetIn2();
operatorType_ = declaration->GetOperatorType();
k1_ = declaration->GetK1();
k2_ = declaration->GetK2();
k3_ = declaration->GetK3();
k4_ = declaration->GetK4();
SetFeCommonAttrs(declaration);
}
}
FeInType RenderSvgFeComposite::GetIn2Type()
{
return in2_;
}
} // namespace OHOS::Ace
|
#include "pch.h"
#include "graphics.h"
#include "png_image.h"
#include "texture.h"
#include "texture_metadata.h"
#include "texture_util.h"
ff::texture::texture(const ff::resource_file& resource_file, DXGI_FORMAT new_format, size_t new_mip_count)
{
auto data = ff::internal::load_texture_data(resource_file, new_format, new_mip_count, this->palette_);
this->assign(ff::dxgi_client().create_static_texture(data, ff::dxgi::sprite_type::unknown));
}
ff::texture::texture(const std::shared_ptr<ff::dxgi::texture_base>& dxgi_texture, const std::shared_ptr<DirectX::ScratchImage>& palette)
: palette_(palette)
{
this->assign(dxgi_texture);
}
ff::texture::texture(const texture& other, DXGI_FORMAT new_format, size_t new_mip_count)
{
ff::dxgi::sprite_type sprite_type = ff::dxgi::sprite_type::unknown;
std::shared_ptr<DirectX::ScratchImage> other_data = other.dxgi_texture_->data();
std::shared_ptr<DirectX::ScratchImage> new_data;
if (other_data)
{
new_data = ff::dxgi::convert_texture_data(other_data, new_format, new_mip_count);
if (new_data)
{
sprite_type = (new_data == other_data) ? other.dxgi_texture_->sprite_type() : ff::dxgi::get_sprite_type(*new_data);
this->assign(ff::dxgi_client().create_static_texture(new_data, sprite_type));
}
}
if (ff::dxgi::palette_format(other.dxgi_texture_->format()) && ff::dxgi::palette_format(new_format))
{
this->palette_ = other.palette_;
}
}
ff::texture::operator bool() const
{
return this->dxgi_texture_ != nullptr;
}
const std::shared_ptr<DirectX::ScratchImage>& ff::texture::palette() const
{
return this->palette_;
}
const std::shared_ptr<ff::dxgi::texture_base>& ff::texture::dxgi_texture() const
{
return this->dxgi_texture_;
}
ff::dict ff::texture::resource_get_siblings(const std::shared_ptr<ff::resource>& self) const
{
ff::value_ptr value;
{
ff::dxgi::texture_base* tb = this->dxgi_texture_.get();
std::shared_ptr<ff::resource_object_base> metadata = std::make_shared<ff::texture_metadata>(
tb->size(), tb->mip_count(), tb->array_size(), tb->sample_count(), tb->format());
value = ff::value::create<ff::resource_object_base>(std::move(metadata));
}
std::ostringstream name;
name << self->name() << ".metadata";
ff::dict dict;
dict.set(name.str(), value);
return dict;
}
bool ff::texture::resource_save_to_file(const std::filesystem::path& directory_path, std::string_view name) const
{
std::shared_ptr<DirectX::ScratchImage> data = this->dxgi_texture_->data();
if (data)
{
if (!ff::dxgi::palette_format(data->GetMetadata().format))
{
data = ff::dxgi::convert_texture_data(data, DXGI_FORMAT_R8G8B8A8_UNORM, this->dxgi_texture_->mip_count());
}
for (size_t i = 0; i < data->GetImageCount(); i++)
{
std::ostringstream file_name;
file_name << name << "." << i << ".png";
ff::file_writer file_writer(directory_path / file_name.str());
ff::png_image_writer png(file_writer);
png.write(data->GetImages()[i], this->palette_ ? this->palette_->GetImages() : nullptr);
}
return true;
}
return false;
}
std::string_view ff::texture::name() const
{
return "";
}
const ff::dxgi::sprite_data& ff::texture::sprite_data() const
{
return this->sprite_data_;
}
float ff::texture::frame_length() const
{
return 0.0f;
}
float ff::texture::frames_per_second() const
{
return 0.0f;
}
void ff::texture::frame_events(float start, float end, bool include_start, ff::push_base<ff::animation_event>& events)
{}
void ff::texture::draw_frame(ff::dxgi::draw_base& draw, const ff::dxgi::transform& transform, float frame, const ff::dict* params)
{
draw.draw_sprite(this->sprite_data_, transform);
}
void ff::texture::draw_frame(ff::dxgi::draw_base& draw, const ff::dxgi::pixel_transform& transform, float frame, const ff::dict* params)
{
draw.draw_sprite(this->sprite_data_, transform);
}
ff::value_ptr ff::texture::frame_value(size_t value_id, float frame, const ff::dict* params)
{
return ff::value_ptr();
}
void ff::texture::advance_animation(ff::push_base<ff::animation_event>* events)
{}
void ff::texture::draw_animation(ff::dxgi::draw_base& draw, const ff::dxgi::transform& transform) const
{
draw.draw_sprite(this->sprite_data_, transform);
}
void ff::texture::draw_animation(ff::dxgi::draw_base& draw, const ff::dxgi::pixel_transform& transform) const
{
draw.draw_sprite(this->sprite_data_, transform);
}
float ff::texture::animation_frame() const
{
return 0.0f;
}
const ff::animation_base* ff::texture::animation() const
{
return this;
}
bool ff::texture::save_to_cache(ff::dict& dict, bool& allow_compress) const
{
dict.set_enum<ff::dxgi::sprite_type>("sprite_type", this->dxgi_texture_->sprite_type());
std::shared_ptr<DirectX::ScratchImage> data = this->dxgi_texture_->data();
if (data)
{
DirectX::Blob blob;
if (FAILED(DirectX::SaveToDDSMemory(
data->GetImages(), data->GetImageCount(), data->GetMetadata(), DirectX::DDS_FLAGS_NONE, blob)))
{
return false;
}
std::shared_ptr<ff::data_base> blob_data = std::make_shared<ff::dxgi::data_blob_dxtex>(std::move(blob));
dict.set<ff::data_base>("data", blob_data, ff::saved_data_type::zlib_compressed);
}
else
{
return false;
}
if (this->palette_)
{
DirectX::Blob blob;
if (FAILED(DirectX::SaveToDDSMemory(
this->palette_->GetImages(), this->palette_->GetImageCount(), this->palette_->GetMetadata(), DirectX::DDS_FLAGS_NONE, blob)))
{
return false;
}
std::shared_ptr<ff::data_base> blob_data = std::make_shared<ff::dxgi::data_blob_dxtex>(std::move(blob));
dict.set<ff::data_base>("palette", blob_data, ff::saved_data_type::zlib_compressed);
}
return true;
}
void ff::texture::assign(const std::shared_ptr<ff::dxgi::texture_base>& dxgi_texture)
{
assert(dxgi_texture);
this->dxgi_texture_ = dxgi_texture;
this->sprite_data_ = ff::dxgi::sprite_data(this->dxgi_texture_.get(),
ff::rect_float(0, 0, 1, 1),
ff::rect_float(ff::point_float{}, this->dxgi_texture_->size().cast<float>()),
this->dxgi_texture_->sprite_type());
}
std::shared_ptr<ff::resource_object_base> ff::internal::texture_factory::load_from_source(const ff::dict& dict, resource_load_context& context) const
{
bool pma = dict.get<bool>("pma");
size_t mip_count = dict.get<size_t>("mips", 1);
std::filesystem::path full_file = dict.get<std::string>("file");
DXGI_FORMAT format = ff::dxgi::parse_format(dict.get<std::string>("format", std::string("rgbs32")));
if (format != DXGI_FORMAT_UNKNOWN)
{
std::shared_ptr<DirectX::ScratchImage> palette;
std::shared_ptr<DirectX::ScratchImage> data = ff::internal::load_texture_data(full_file, format, mip_count, palette);
for (size_t i = 0; pma && i < data->GetImageCount(); i++)
{
const DirectX::Image& image = data->GetImages()[i];
DirectX::ScratchImage scratch;
if (FAILED(DirectX::PremultiplyAlpha(image, DirectX::TEX_PMALPHA_DEFAULT, scratch)) ||
FAILED(DirectX::CopyRectangle(*scratch.GetImages(), DirectX::Rect(0, 0, image.width, image.height), image, DirectX::TEX_FILTER_DEFAULT, 0, 0)))
{
assert(false);
return nullptr;
}
}
auto dxgi_texture = ff::dxgi_client().create_static_texture(data, ff::dxgi::sprite_type::unknown);
std::shared_ptr<ff::texture> texture = std::make_shared<ff::texture>(dxgi_texture, palette);
return *texture ? texture : nullptr;
}
return nullptr;
}
std::shared_ptr<ff::resource_object_base> ff::internal::texture_factory::load_from_cache(const ff::dict& dict) const
{
ff::dxgi::sprite_type sprite_type = dict.get_enum<ff::dxgi::sprite_type>("sprite_type");
std::shared_ptr<ff::data_base> palette_data = dict.get<ff::data_base>("palette");
std::shared_ptr<ff::data_base> data = dict.get<ff::data_base>("data");
DirectX::ScratchImage palette_scratch;
if (palette_data && FAILED(DirectX::LoadFromDDSMemory(
palette_data->data(), palette_data->size(), DirectX::DDS_FLAGS_NONE, nullptr, palette_scratch)))
{
assert(false);
return false;
}
DirectX::ScratchImage data_scratch;
if (data && FAILED(DirectX::LoadFromDDSMemory(
data->data(), data->size(), DirectX::DDS_FLAGS_NONE, nullptr, data_scratch)))
{
assert(false);
return false;
}
auto dxgi_texture = ff::dxgi_client().create_static_texture(data_scratch.GetImageCount() ? std::make_shared<DirectX::ScratchImage>(std::move(data_scratch)) : nullptr, sprite_type);
auto texture = std::make_shared<ff::texture>(dxgi_texture, palette_scratch.GetImageCount() ? std::make_shared<DirectX::ScratchImage>(std::move(palette_scratch)) : nullptr);
return *texture ? texture : nullptr;
}
|
#include "parser_pos.cpp"
Token token_end_of_line(AstFile *f, Token tok) {
u8 const *start = f->tokenizer.start + tok.pos.offset;
u8 const *s = start;
while (*s && *s != '\n' && s < f->tokenizer.end) {
s += 1;
}
tok.pos.column += cast(i32)(s - start) - 1;
return tok;
}
gbString get_file_line_as_string(TokenPos const &pos, i32 *offset_) {
AstFile *file = thread_safe_get_ast_file_from_id(pos.file_id);
if (file == nullptr) {
return nullptr;
}
isize offset = pos.offset;
u8 *start = file->tokenizer.start;
u8 *end = file->tokenizer.end;
isize len = end-start;
if (len < offset) {
return nullptr;
}
u8 *pos_offset = start+offset;
u8 *line_start = pos_offset;
u8 *line_end = pos_offset;
while (line_start >= start) {
if (*line_start == '\n') {
line_start += 1;
break;
}
line_start -= 1;
}
while (line_end < end) {
if (*line_end == '\n') {
line_end -= 1;
break;
}
line_end += 1;
}
String the_line = make_string(line_start, line_end-line_start);
the_line = string_trim_whitespace(the_line);
if (offset_) *offset_ = cast(i32)(pos_offset - the_line.text);
return gb_string_make_length(heap_allocator(), the_line.text, the_line.len);
}
isize ast_node_size(AstKind kind) {
return align_formula_isize(gb_size_of(AstCommonStuff) + ast_variant_sizes[kind], gb_align_of(void *));
}
gb_global std::atomic<isize> global_total_node_memory_allocated;
// NOTE(bill): And this below is why is I/we need a new language! Discriminated unions are a pain in C/C++
Ast *alloc_ast_node(AstFile *f, AstKind kind) {
gbAllocator a = ast_allocator(f);
isize size = ast_node_size(kind);
Ast *node = cast(Ast *)gb_alloc(a, size);
node->kind = kind;
node->file_id = f ? f->id : 0;
global_total_node_memory_allocated += size;
return node;
}
Ast *clone_ast(Ast *node);
Array<Ast *> clone_ast_array(Array<Ast *> const &array) {
Array<Ast *> result = {};
if (array.count > 0) {
result = array_make<Ast *>(ast_allocator(nullptr), array.count);
for_array(i, array) {
result[i] = clone_ast(array[i]);
}
}
return result;
}
Slice<Ast *> clone_ast_array(Slice<Ast *> const &array) {
Slice<Ast *> result = {};
if (array.count > 0) {
result = slice_clone(permanent_allocator(), array);
for_array(i, array) {
result[i] = clone_ast(array[i]);
}
}
return result;
}
Ast *clone_ast(Ast *node) {
if (node == nullptr) {
return nullptr;
}
AstFile *f = node->thread_safe_file();
Ast *n = alloc_ast_node(f, node->kind);
gb_memmove(n, node, ast_node_size(node->kind));
switch (n->kind) {
default: GB_PANIC("Unhandled Ast %.*s", LIT(ast_strings[n->kind])); break;
case Ast_Invalid: break;
case Ast_Ident:
n->Ident.entity = nullptr;
break;
case Ast_Implicit: break;
case Ast_Undef: break;
case Ast_BasicLit: break;
case Ast_BasicDirective: break;
case Ast_PolyType:
n->PolyType.type = clone_ast(n->PolyType.type);
n->PolyType.specialization = clone_ast(n->PolyType.specialization);
break;
case Ast_Ellipsis:
n->Ellipsis.expr = clone_ast(n->Ellipsis.expr);
break;
case Ast_ProcGroup:
n->ProcGroup.args = clone_ast_array(n->ProcGroup.args);
break;
case Ast_ProcLit:
n->ProcLit.type = clone_ast(n->ProcLit.type);
n->ProcLit.body = clone_ast(n->ProcLit.body);
n->ProcLit.where_clauses = clone_ast_array(n->ProcLit.where_clauses);
break;
case Ast_CompoundLit:
n->CompoundLit.type = clone_ast(n->CompoundLit.type);
n->CompoundLit.elems = clone_ast_array(n->CompoundLit.elems);
break;
case Ast_BadExpr: break;
case Ast_TagExpr:
n->TagExpr.expr = clone_ast(n->TagExpr.expr);
break;
case Ast_UnaryExpr:
n->UnaryExpr.expr = clone_ast(n->UnaryExpr.expr);
break;
case Ast_BinaryExpr:
n->BinaryExpr.left = clone_ast(n->BinaryExpr.left);
n->BinaryExpr.right = clone_ast(n->BinaryExpr.right);
break;
case Ast_ParenExpr:
n->ParenExpr.expr = clone_ast(n->ParenExpr.expr);
break;
case Ast_SelectorExpr:
n->SelectorExpr.expr = clone_ast(n->SelectorExpr.expr);
n->SelectorExpr.selector = clone_ast(n->SelectorExpr.selector);
break;
case Ast_ImplicitSelectorExpr:
n->ImplicitSelectorExpr.selector = clone_ast(n->ImplicitSelectorExpr.selector);
break;
case Ast_SelectorCallExpr:
n->SelectorCallExpr.expr = clone_ast(n->SelectorCallExpr.expr);
n->SelectorCallExpr.call = clone_ast(n->SelectorCallExpr.call);
break;
case Ast_IndexExpr:
n->IndexExpr.expr = clone_ast(n->IndexExpr.expr);
n->IndexExpr.index = clone_ast(n->IndexExpr.index);
break;
case Ast_MatrixIndexExpr:
n->MatrixIndexExpr.expr = clone_ast(n->MatrixIndexExpr.expr);
n->MatrixIndexExpr.row_index = clone_ast(n->MatrixIndexExpr.row_index);
n->MatrixIndexExpr.column_index = clone_ast(n->MatrixIndexExpr.column_index);
break;
case Ast_DerefExpr:
n->DerefExpr.expr = clone_ast(n->DerefExpr.expr);
break;
case Ast_SliceExpr:
n->SliceExpr.expr = clone_ast(n->SliceExpr.expr);
n->SliceExpr.low = clone_ast(n->SliceExpr.low);
n->SliceExpr.high = clone_ast(n->SliceExpr.high);
break;
case Ast_CallExpr:
n->CallExpr.proc = clone_ast(n->CallExpr.proc);
n->CallExpr.args = clone_ast_array(n->CallExpr.args);
break;
case Ast_FieldValue:
n->FieldValue.field = clone_ast(n->FieldValue.field);
n->FieldValue.value = clone_ast(n->FieldValue.value);
break;
case Ast_EnumFieldValue:
n->EnumFieldValue.name = clone_ast(n->EnumFieldValue.name);
n->EnumFieldValue.value = clone_ast(n->EnumFieldValue.value);
break;
case Ast_TernaryIfExpr:
n->TernaryIfExpr.x = clone_ast(n->TernaryIfExpr.x);
n->TernaryIfExpr.cond = clone_ast(n->TernaryIfExpr.cond);
n->TernaryIfExpr.y = clone_ast(n->TernaryIfExpr.y);
break;
case Ast_TernaryWhenExpr:
n->TernaryWhenExpr.x = clone_ast(n->TernaryWhenExpr.x);
n->TernaryWhenExpr.cond = clone_ast(n->TernaryWhenExpr.cond);
n->TernaryWhenExpr.y = clone_ast(n->TernaryWhenExpr.y);
break;
case Ast_OrElseExpr:
n->OrElseExpr.x = clone_ast(n->OrElseExpr.x);
n->OrElseExpr.y = clone_ast(n->OrElseExpr.y);
break;
case Ast_OrReturnExpr:
n->OrReturnExpr.expr = clone_ast(n->OrReturnExpr.expr);
break;
case Ast_TypeAssertion:
n->TypeAssertion.expr = clone_ast(n->TypeAssertion.expr);
n->TypeAssertion.type = clone_ast(n->TypeAssertion.type);
break;
case Ast_TypeCast:
n->TypeCast.type = clone_ast(n->TypeCast.type);
n->TypeCast.expr = clone_ast(n->TypeCast.expr);
break;
case Ast_AutoCast:
n->AutoCast.expr = clone_ast(n->AutoCast.expr);
break;
case Ast_InlineAsmExpr:
n->InlineAsmExpr.param_types = clone_ast_array(n->InlineAsmExpr.param_types);
n->InlineAsmExpr.return_type = clone_ast(n->InlineAsmExpr.return_type);
n->InlineAsmExpr.asm_string = clone_ast(n->InlineAsmExpr.asm_string);
n->InlineAsmExpr.constraints_string = clone_ast(n->InlineAsmExpr.constraints_string);
break;
case Ast_BadStmt: break;
case Ast_EmptyStmt: break;
case Ast_ExprStmt:
n->ExprStmt.expr = clone_ast(n->ExprStmt.expr);
break;
case Ast_TagStmt:
n->TagStmt.stmt = clone_ast(n->TagStmt.stmt);
break;
case Ast_AssignStmt:
n->AssignStmt.lhs = clone_ast_array(n->AssignStmt.lhs);
n->AssignStmt.rhs = clone_ast_array(n->AssignStmt.rhs);
break;
case Ast_BlockStmt:
n->BlockStmt.label = clone_ast(n->BlockStmt.label);
n->BlockStmt.stmts = clone_ast_array(n->BlockStmt.stmts);
break;
case Ast_IfStmt:
n->IfStmt.label = clone_ast(n->IfStmt.label);
n->IfStmt.init = clone_ast(n->IfStmt.init);
n->IfStmt.cond = clone_ast(n->IfStmt.cond);
n->IfStmt.body = clone_ast(n->IfStmt.body);
n->IfStmt.else_stmt = clone_ast(n->IfStmt.else_stmt);
break;
case Ast_WhenStmt:
n->WhenStmt.cond = clone_ast(n->WhenStmt.cond);
n->WhenStmt.body = clone_ast(n->WhenStmt.body);
n->WhenStmt.else_stmt = clone_ast(n->WhenStmt.else_stmt);
break;
case Ast_ReturnStmt:
n->ReturnStmt.results = clone_ast_array(n->ReturnStmt.results);
break;
case Ast_ForStmt:
n->ForStmt.label = clone_ast(n->ForStmt.label);
n->ForStmt.init = clone_ast(n->ForStmt.init);
n->ForStmt.cond = clone_ast(n->ForStmt.cond);
n->ForStmt.post = clone_ast(n->ForStmt.post);
n->ForStmt.body = clone_ast(n->ForStmt.body);
break;
case Ast_RangeStmt:
n->RangeStmt.label = clone_ast(n->RangeStmt.label);
n->RangeStmt.vals = clone_ast_array(n->RangeStmt.vals);
n->RangeStmt.expr = clone_ast(n->RangeStmt.expr);
n->RangeStmt.body = clone_ast(n->RangeStmt.body);
break;
case Ast_UnrollRangeStmt:
n->UnrollRangeStmt.val0 = clone_ast(n->UnrollRangeStmt.val0);
n->UnrollRangeStmt.val1 = clone_ast(n->UnrollRangeStmt.val1);
n->UnrollRangeStmt.expr = clone_ast(n->UnrollRangeStmt.expr);
n->UnrollRangeStmt.body = clone_ast(n->UnrollRangeStmt.body);
break;
case Ast_CaseClause:
n->CaseClause.list = clone_ast_array(n->CaseClause.list);
n->CaseClause.stmts = clone_ast_array(n->CaseClause.stmts);
n->CaseClause.implicit_entity = nullptr;
break;
case Ast_SwitchStmt:
n->SwitchStmt.label = clone_ast(n->SwitchStmt.label);
n->SwitchStmt.init = clone_ast(n->SwitchStmt.init);
n->SwitchStmt.tag = clone_ast(n->SwitchStmt.tag);
n->SwitchStmt.body = clone_ast(n->SwitchStmt.body);
break;
case Ast_TypeSwitchStmt:
n->TypeSwitchStmt.label = clone_ast(n->TypeSwitchStmt.label);
n->TypeSwitchStmt.tag = clone_ast(n->TypeSwitchStmt.tag);
n->TypeSwitchStmt.body = clone_ast(n->TypeSwitchStmt.body);
break;
case Ast_DeferStmt:
n->DeferStmt.stmt = clone_ast(n->DeferStmt.stmt);
break;
case Ast_BranchStmt:
n->BranchStmt.label = clone_ast(n->BranchStmt.label);
break;
case Ast_UsingStmt:
n->UsingStmt.list = clone_ast_array(n->UsingStmt.list);
break;
case Ast_BadDecl: break;
case Ast_ForeignBlockDecl:
n->ForeignBlockDecl.foreign_library = clone_ast(n->ForeignBlockDecl.foreign_library);
n->ForeignBlockDecl.body = clone_ast(n->ForeignBlockDecl.body);
n->ForeignBlockDecl.attributes = clone_ast_array(n->ForeignBlockDecl.attributes);
break;
case Ast_Label:
n->Label.name = clone_ast(n->Label.name);
break;
case Ast_ValueDecl:
n->ValueDecl.names = clone_ast_array(n->ValueDecl.names);
n->ValueDecl.type = clone_ast(n->ValueDecl.type);
n->ValueDecl.values = clone_ast_array(n->ValueDecl.values);
n->ValueDecl.attributes = clone_ast_array(n->ValueDecl.attributes);
break;
case Ast_Attribute:
n->Attribute.elems = clone_ast_array(n->Attribute.elems);
break;
case Ast_Field:
n->Field.names = clone_ast_array(n->Field.names);
n->Field.type = clone_ast(n->Field.type);
break;
case Ast_FieldList:
n->FieldList.list = clone_ast_array(n->FieldList.list);
break;
case Ast_TypeidType:
n->TypeidType.specialization = clone_ast(n->TypeidType.specialization);
break;
case Ast_HelperType:
n->HelperType.type = clone_ast(n->HelperType.type);
break;
case Ast_DistinctType:
n->DistinctType.type = clone_ast(n->DistinctType.type);
break;
case Ast_ProcType:
n->ProcType.params = clone_ast(n->ProcType.params);
n->ProcType.results = clone_ast(n->ProcType.results);
break;
case Ast_RelativeType:
n->RelativeType.tag = clone_ast(n->RelativeType.tag);
n->RelativeType.type = clone_ast(n->RelativeType.type);
break;
case Ast_PointerType:
n->PointerType.type = clone_ast(n->PointerType.type);
break;
case Ast_MultiPointerType:
n->MultiPointerType.type = clone_ast(n->MultiPointerType.type);
break;
case Ast_ArrayType:
n->ArrayType.count = clone_ast(n->ArrayType.count);
n->ArrayType.elem = clone_ast(n->ArrayType.elem);
break;
case Ast_DynamicArrayType:
n->DynamicArrayType.elem = clone_ast(n->DynamicArrayType.elem);
break;
case Ast_StructType:
n->StructType.fields = clone_ast_array(n->StructType.fields);
n->StructType.polymorphic_params = clone_ast(n->StructType.polymorphic_params);
n->StructType.align = clone_ast(n->StructType.align);
n->StructType.where_clauses = clone_ast_array(n->StructType.where_clauses);
break;
case Ast_UnionType:
n->UnionType.variants = clone_ast_array(n->UnionType.variants);
n->UnionType.polymorphic_params = clone_ast(n->UnionType.polymorphic_params);
n->UnionType.where_clauses = clone_ast_array(n->UnionType.where_clauses);
break;
case Ast_EnumType:
n->EnumType.base_type = clone_ast(n->EnumType.base_type);
n->EnumType.fields = clone_ast_array(n->EnumType.fields);
break;
case Ast_BitSetType:
n->BitSetType.elem = clone_ast(n->BitSetType.elem);
n->BitSetType.underlying = clone_ast(n->BitSetType.underlying);
break;
case Ast_MapType:
n->MapType.count = clone_ast(n->MapType.count);
n->MapType.key = clone_ast(n->MapType.key);
n->MapType.value = clone_ast(n->MapType.value);
break;
case Ast_MatrixType:
n->MatrixType.row_count = clone_ast(n->MatrixType.row_count);
n->MatrixType.column_count = clone_ast(n->MatrixType.column_count);
n->MatrixType.elem = clone_ast(n->MatrixType.elem);
break;
}
return n;
}
void error(Ast *node, char const *fmt, ...) {
Token token = {};
TokenPos end_pos = {};
if (node != nullptr) {
token = ast_token(node);
end_pos = ast_end_pos(node);
}
va_list va;
va_start(va, fmt);
error_va(token.pos, end_pos, fmt, va);
va_end(va);
if (node != nullptr && node->file_id != 0) {
AstFile *f = node->thread_safe_file();
f->error_count += 1;
}
}
void error_no_newline(Ast *node, char const *fmt, ...) {
Token token = {};
if (node != nullptr) {
token = ast_token(node);
}
va_list va;
va_start(va, fmt);
error_no_newline_va(token.pos, fmt, va);
va_end(va);
if (node != nullptr && node->file_id != 0) {
AstFile *f = node->thread_safe_file();
f->error_count += 1;
}
}
void warning(Ast *node, char const *fmt, ...) {
Token token = {};
TokenPos end_pos = {};
if (node != nullptr) {
token = ast_token(node);
end_pos = ast_end_pos(node);
}
va_list va;
va_start(va, fmt);
warning_va(token.pos, end_pos, fmt, va);
va_end(va);
}
void syntax_error(Ast *node, char const *fmt, ...) {
Token token = {};
TokenPos end_pos = {};
if (node != nullptr) {
token = ast_token(node);
end_pos = ast_end_pos(node);
}
va_list va;
va_start(va, fmt);
syntax_error_va(token.pos, end_pos, fmt, va);
va_end(va);
if (node != nullptr && node->file_id != 0) {
AstFile *f = node->thread_safe_file();
f->error_count += 1;
}
}
bool ast_node_expect(Ast *node, AstKind kind) {
if (node->kind != kind) {
syntax_error(node, "Expected %.*s, got %.*s", LIT(ast_strings[kind]), LIT(ast_strings[node->kind]));
return false;
}
return true;
}
bool ast_node_expect2(Ast *node, AstKind kind0, AstKind kind1) {
if (node->kind != kind0 && node->kind != kind1) {
syntax_error(node, "Expected %.*s or %.*s, got %.*s", LIT(ast_strings[kind0]), LIT(ast_strings[kind1]), LIT(ast_strings[node->kind]));
return false;
}
return true;
}
Ast *ast_bad_expr(AstFile *f, Token begin, Token end) {
Ast *result = alloc_ast_node(f, Ast_BadExpr);
result->BadExpr.begin = begin;
result->BadExpr.end = end;
return result;
}
Ast *ast_tag_expr(AstFile *f, Token token, Token name, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_TagExpr);
result->TagExpr.token = token;
result->TagExpr.name = name;
result->TagExpr.expr = expr;
return result;
}
Ast *ast_tag_stmt(AstFile *f, Token token, Token name, Ast *stmt) {
Ast *result = alloc_ast_node(f, Ast_TagStmt);
result->TagStmt.token = token;
result->TagStmt.name = name;
result->TagStmt.stmt = stmt;
return result;
}
Ast *ast_unary_expr(AstFile *f, Token op, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_UnaryExpr);
result->UnaryExpr.op = op;
result->UnaryExpr.expr = expr;
return result;
}
Ast *ast_binary_expr(AstFile *f, Token op, Ast *left, Ast *right) {
Ast *result = alloc_ast_node(f, Ast_BinaryExpr);
if (left == nullptr) {
syntax_error(op, "No lhs expression for binary expression '%.*s'", LIT(op.string));
left = ast_bad_expr(f, op, op);
}
if (right == nullptr) {
syntax_error(op, "No rhs expression for binary expression '%.*s'", LIT(op.string));
right = ast_bad_expr(f, op, op);
}
result->BinaryExpr.op = op;
result->BinaryExpr.left = left;
result->BinaryExpr.right = right;
return result;
}
Ast *ast_paren_expr(AstFile *f, Ast *expr, Token open, Token close) {
Ast *result = alloc_ast_node(f, Ast_ParenExpr);
result->ParenExpr.expr = expr;
result->ParenExpr.open = open;
result->ParenExpr.close = close;
return result;
}
Ast *ast_call_expr(AstFile *f, Ast *proc, Array<Ast *> const &args, Token open, Token close, Token ellipsis) {
Ast *result = alloc_ast_node(f, Ast_CallExpr);
result->CallExpr.proc = proc;
result->CallExpr.args = slice_from_array(args);
result->CallExpr.open = open;
result->CallExpr.close = close;
result->CallExpr.ellipsis = ellipsis;
return result;
}
Ast *ast_selector_expr(AstFile *f, Token token, Ast *expr, Ast *selector) {
Ast *result = alloc_ast_node(f, Ast_SelectorExpr);
result->SelectorExpr.token = token;
result->SelectorExpr.expr = expr;
result->SelectorExpr.selector = selector;
return result;
}
Ast *ast_implicit_selector_expr(AstFile *f, Token token, Ast *selector) {
Ast *result = alloc_ast_node(f, Ast_ImplicitSelectorExpr);
result->ImplicitSelectorExpr.token = token;
result->ImplicitSelectorExpr.selector = selector;
return result;
}
Ast *ast_selector_call_expr(AstFile *f, Token token, Ast *expr, Ast *call) {
Ast *result = alloc_ast_node(f, Ast_SelectorCallExpr);
result->SelectorCallExpr.token = token;
result->SelectorCallExpr.expr = expr;
result->SelectorCallExpr.call = call;
return result;
}
Ast *ast_index_expr(AstFile *f, Ast *expr, Ast *index, Token open, Token close) {
Ast *result = alloc_ast_node(f, Ast_IndexExpr);
result->IndexExpr.expr = expr;
result->IndexExpr.index = index;
result->IndexExpr.open = open;
result->IndexExpr.close = close;
return result;
}
Ast *ast_slice_expr(AstFile *f, Ast *expr, Token open, Token close, Token interval, Ast *low, Ast *high) {
Ast *result = alloc_ast_node(f, Ast_SliceExpr);
result->SliceExpr.expr = expr;
result->SliceExpr.open = open;
result->SliceExpr.close = close;
result->SliceExpr.interval = interval;
result->SliceExpr.low = low;
result->SliceExpr.high = high;
return result;
}
Ast *ast_deref_expr(AstFile *f, Ast *expr, Token op) {
Ast *result = alloc_ast_node(f, Ast_DerefExpr);
result->DerefExpr.expr = expr;
result->DerefExpr.op = op;
return result;
}
Ast *ast_matrix_index_expr(AstFile *f, Ast *expr, Token open, Token close, Token interval, Ast *row, Ast *column) {
Ast *result = alloc_ast_node(f, Ast_MatrixIndexExpr);
result->MatrixIndexExpr.expr = expr;
result->MatrixIndexExpr.row_index = row;
result->MatrixIndexExpr.column_index = column;
result->MatrixIndexExpr.open = open;
result->MatrixIndexExpr.close = close;
return result;
}
Ast *ast_ident(AstFile *f, Token token) {
Ast *result = alloc_ast_node(f, Ast_Ident);
result->Ident.token = token;
return result;
}
Ast *ast_implicit(AstFile *f, Token token) {
Ast *result = alloc_ast_node(f, Ast_Implicit);
result->Implicit = token;
return result;
}
Ast *ast_undef(AstFile *f, Token token) {
Ast *result = alloc_ast_node(f, Ast_Undef);
result->Undef = token;
return result;
}
ExactValue exact_value_from_token(AstFile *f, Token const &token) {
String s = token.string;
switch (token.kind) {
case Token_Rune:
if (!unquote_string(ast_allocator(f), &s, 0)) {
syntax_error(token, "Invalid rune literal");
}
break;
case Token_String:
if (!unquote_string(ast_allocator(f), &s, 0, s.text[0] == '`')) {
syntax_error(token, "Invalid string literal");
}
break;
}
return exact_value_from_basic_literal(token.kind, s);
}
String string_value_from_token(AstFile *f, Token const &token) {
ExactValue value = exact_value_from_token(f, token);
String str = {};
if (value.kind == ExactValue_String) {
str = value.value_string;
}
return str;
}
Ast *ast_basic_lit(AstFile *f, Token basic_lit) {
Ast *result = alloc_ast_node(f, Ast_BasicLit);
result->BasicLit.token = basic_lit;
result->tav.mode = Addressing_Constant;
result->tav.value = exact_value_from_token(f, basic_lit);
return result;
}
Ast *ast_basic_directive(AstFile *f, Token token, Token name) {
Ast *result = alloc_ast_node(f, Ast_BasicDirective);
result->BasicDirective.token = token;
result->BasicDirective.name = name;
return result;
}
Ast *ast_ellipsis(AstFile *f, Token token, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_Ellipsis);
result->Ellipsis.token = token;
result->Ellipsis.expr = expr;
return result;
}
Ast *ast_proc_group(AstFile *f, Token token, Token open, Token close, Array<Ast *> const &args) {
Ast *result = alloc_ast_node(f, Ast_ProcGroup);
result->ProcGroup.token = token;
result->ProcGroup.open = open;
result->ProcGroup.close = close;
result->ProcGroup.args = slice_from_array(args);
return result;
}
Ast *ast_proc_lit(AstFile *f, Ast *type, Ast *body, u64 tags, Token where_token, Array<Ast *> const &where_clauses) {
Ast *result = alloc_ast_node(f, Ast_ProcLit);
result->ProcLit.type = type;
result->ProcLit.body = body;
result->ProcLit.tags = tags;
result->ProcLit.where_token = where_token;
result->ProcLit.where_clauses = slice_from_array(where_clauses);
return result;
}
Ast *ast_field_value(AstFile *f, Ast *field, Ast *value, Token eq) {
Ast *result = alloc_ast_node(f, Ast_FieldValue);
result->FieldValue.field = field;
result->FieldValue.value = value;
result->FieldValue.eq = eq;
return result;
}
Ast *ast_enum_field_value(AstFile *f, Ast *name, Ast *value, CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_EnumFieldValue);
result->EnumFieldValue.name = name;
result->EnumFieldValue.value = value;
result->EnumFieldValue.docs = docs;
result->EnumFieldValue.comment = comment;
return result;
}
Ast *ast_compound_lit(AstFile *f, Ast *type, Array<Ast *> const &elems, Token open, Token close) {
Ast *result = alloc_ast_node(f, Ast_CompoundLit);
result->CompoundLit.type = type;
result->CompoundLit.elems = slice_from_array(elems);
result->CompoundLit.open = open;
result->CompoundLit.close = close;
return result;
}
Ast *ast_ternary_if_expr(AstFile *f, Ast *x, Ast *cond, Ast *y) {
Ast *result = alloc_ast_node(f, Ast_TernaryIfExpr);
result->TernaryIfExpr.x = x;
result->TernaryIfExpr.cond = cond;
result->TernaryIfExpr.y = y;
return result;
}
Ast *ast_ternary_when_expr(AstFile *f, Ast *x, Ast *cond, Ast *y) {
Ast *result = alloc_ast_node(f, Ast_TernaryWhenExpr);
result->TernaryWhenExpr.x = x;
result->TernaryWhenExpr.cond = cond;
result->TernaryWhenExpr.y = y;
return result;
}
Ast *ast_or_else_expr(AstFile *f, Ast *x, Token const &token, Ast *y) {
Ast *result = alloc_ast_node(f, Ast_OrElseExpr);
result->OrElseExpr.x = x;
result->OrElseExpr.token = token;
result->OrElseExpr.y = y;
return result;
}
Ast *ast_or_return_expr(AstFile *f, Ast *expr, Token const &token) {
Ast *result = alloc_ast_node(f, Ast_OrReturnExpr);
result->OrReturnExpr.expr = expr;
result->OrReturnExpr.token = token;
return result;
}
Ast *ast_type_assertion(AstFile *f, Ast *expr, Token dot, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_TypeAssertion);
result->TypeAssertion.expr = expr;
result->TypeAssertion.dot = dot;
result->TypeAssertion.type = type;
return result;
}
Ast *ast_type_cast(AstFile *f, Token token, Ast *type, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_TypeCast);
result->TypeCast.token = token;
result->TypeCast.type = type;
result->TypeCast.expr = expr;
return result;
}
Ast *ast_auto_cast(AstFile *f, Token token, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_AutoCast);
result->AutoCast.token = token;
result->AutoCast.expr = expr;
return result;
}
Ast *ast_inline_asm_expr(AstFile *f, Token token, Token open, Token close,
Array<Ast *> const ¶m_types,
Ast *return_type,
Ast *asm_string,
Ast *constraints_string,
bool has_side_effects,
bool is_align_stack,
InlineAsmDialectKind dialect) {
Ast *result = alloc_ast_node(f, Ast_InlineAsmExpr);
result->InlineAsmExpr.token = token;
result->InlineAsmExpr.open = open;
result->InlineAsmExpr.close = close;
result->InlineAsmExpr.param_types = slice_from_array(param_types);
result->InlineAsmExpr.return_type = return_type;
result->InlineAsmExpr.asm_string = asm_string;
result->InlineAsmExpr.constraints_string = constraints_string;
result->InlineAsmExpr.has_side_effects = has_side_effects;
result->InlineAsmExpr.is_align_stack = is_align_stack;
result->InlineAsmExpr.dialect = dialect;
return result;
}
Ast *ast_bad_stmt(AstFile *f, Token begin, Token end) {
Ast *result = alloc_ast_node(f, Ast_BadStmt);
result->BadStmt.begin = begin;
result->BadStmt.end = end;
return result;
}
Ast *ast_empty_stmt(AstFile *f, Token token) {
Ast *result = alloc_ast_node(f, Ast_EmptyStmt);
result->EmptyStmt.token = token;
return result;
}
Ast *ast_expr_stmt(AstFile *f, Ast *expr) {
Ast *result = alloc_ast_node(f, Ast_ExprStmt);
result->ExprStmt.expr = expr;
return result;
}
Ast *ast_assign_stmt(AstFile *f, Token op, Array<Ast *> const &lhs, Array<Ast *> const &rhs) {
Ast *result = alloc_ast_node(f, Ast_AssignStmt);
result->AssignStmt.op = op;
result->AssignStmt.lhs = slice_from_array(lhs);
result->AssignStmt.rhs = slice_from_array(rhs);
return result;
}
Ast *ast_block_stmt(AstFile *f, Array<Ast *> const &stmts, Token open, Token close) {
Ast *result = alloc_ast_node(f, Ast_BlockStmt);
result->BlockStmt.stmts = slice_from_array(stmts);
result->BlockStmt.open = open;
result->BlockStmt.close = close;
return result;
}
Ast *ast_if_stmt(AstFile *f, Token token, Ast *init, Ast *cond, Ast *body, Ast *else_stmt) {
Ast *result = alloc_ast_node(f, Ast_IfStmt);
result->IfStmt.token = token;
result->IfStmt.init = init;
result->IfStmt.cond = cond;
result->IfStmt.body = body;
result->IfStmt.else_stmt = else_stmt;
return result;
}
Ast *ast_when_stmt(AstFile *f, Token token, Ast *cond, Ast *body, Ast *else_stmt) {
Ast *result = alloc_ast_node(f, Ast_WhenStmt);
result->WhenStmt.token = token;
result->WhenStmt.cond = cond;
result->WhenStmt.body = body;
result->WhenStmt.else_stmt = else_stmt;
return result;
}
Ast *ast_return_stmt(AstFile *f, Token token, Array<Ast *> const &results) {
Ast *result = alloc_ast_node(f, Ast_ReturnStmt);
result->ReturnStmt.token = token;
result->ReturnStmt.results = slice_from_array(results);
return result;
}
Ast *ast_for_stmt(AstFile *f, Token token, Ast *init, Ast *cond, Ast *post, Ast *body) {
Ast *result = alloc_ast_node(f, Ast_ForStmt);
result->ForStmt.token = token;
result->ForStmt.init = init;
result->ForStmt.cond = cond;
result->ForStmt.post = post;
result->ForStmt.body = body;
return result;
}
Ast *ast_range_stmt(AstFile *f, Token token, Slice<Ast *> vals, Token in_token, Ast *expr, Ast *body) {
Ast *result = alloc_ast_node(f, Ast_RangeStmt);
result->RangeStmt.token = token;
result->RangeStmt.vals = vals;
result->RangeStmt.in_token = in_token;
result->RangeStmt.expr = expr;
result->RangeStmt.body = body;
return result;
}
Ast *ast_unroll_range_stmt(AstFile *f, Token unroll_token, Token for_token, Ast *val0, Ast *val1, Token in_token, Ast *expr, Ast *body) {
Ast *result = alloc_ast_node(f, Ast_UnrollRangeStmt);
result->UnrollRangeStmt.unroll_token = unroll_token;
result->UnrollRangeStmt.for_token = for_token;
result->UnrollRangeStmt.val0 = val0;
result->UnrollRangeStmt.val1 = val1;
result->UnrollRangeStmt.in_token = in_token;
result->UnrollRangeStmt.expr = expr;
result->UnrollRangeStmt.body = body;
return result;
}
Ast *ast_switch_stmt(AstFile *f, Token token, Ast *init, Ast *tag, Ast *body) {
Ast *result = alloc_ast_node(f, Ast_SwitchStmt);
result->SwitchStmt.token = token;
result->SwitchStmt.init = init;
result->SwitchStmt.tag = tag;
result->SwitchStmt.body = body;
result->SwitchStmt.partial = false;
return result;
}
Ast *ast_type_switch_stmt(AstFile *f, Token token, Ast *tag, Ast *body) {
Ast *result = alloc_ast_node(f, Ast_TypeSwitchStmt);
result->TypeSwitchStmt.token = token;
result->TypeSwitchStmt.tag = tag;
result->TypeSwitchStmt.body = body;
result->TypeSwitchStmt.partial = false;
return result;
}
Ast *ast_case_clause(AstFile *f, Token token, Array<Ast *> const &list, Array<Ast *> const &stmts) {
Ast *result = alloc_ast_node(f, Ast_CaseClause);
result->CaseClause.token = token;
result->CaseClause.list = slice_from_array(list);
result->CaseClause.stmts = slice_from_array(stmts);
return result;
}
Ast *ast_defer_stmt(AstFile *f, Token token, Ast *stmt) {
Ast *result = alloc_ast_node(f, Ast_DeferStmt);
result->DeferStmt.token = token;
result->DeferStmt.stmt = stmt;
return result;
}
Ast *ast_branch_stmt(AstFile *f, Token token, Ast *label) {
Ast *result = alloc_ast_node(f, Ast_BranchStmt);
result->BranchStmt.token = token;
result->BranchStmt.label = label;
return result;
}
Ast *ast_using_stmt(AstFile *f, Token token, Array<Ast *> const &list) {
Ast *result = alloc_ast_node(f, Ast_UsingStmt);
result->UsingStmt.token = token;
result->UsingStmt.list = slice_from_array(list);
return result;
}
Ast *ast_bad_decl(AstFile *f, Token begin, Token end) {
Ast *result = alloc_ast_node(f, Ast_BadDecl);
result->BadDecl.begin = begin;
result->BadDecl.end = end;
return result;
}
Ast *ast_field(AstFile *f, Array<Ast *> const &names, Ast *type, Ast *default_value, u32 flags, Token tag,
CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_Field);
result->Field.names = slice_from_array(names);
result->Field.type = type;
result->Field.default_value = default_value;
result->Field.flags = flags;
result->Field.tag = tag;
result->Field.docs = docs;
result->Field.comment = comment;
return result;
}
Ast *ast_field_list(AstFile *f, Token token, Array<Ast *> const &list) {
Ast *result = alloc_ast_node(f, Ast_FieldList);
result->FieldList.token = token;
result->FieldList.list = slice_from_array(list);
return result;
}
Ast *ast_typeid_type(AstFile *f, Token token, Ast *specialization) {
Ast *result = alloc_ast_node(f, Ast_TypeidType);
result->TypeidType.token = token;
result->TypeidType.specialization = specialization;
return result;
}
Ast *ast_helper_type(AstFile *f, Token token, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_HelperType);
result->HelperType.token = token;
result->HelperType.type = type;
return result;
}
Ast *ast_distinct_type(AstFile *f, Token token, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_DistinctType);
result->DistinctType.token = token;
result->DistinctType.type = type;
return result;
}
Ast *ast_poly_type(AstFile *f, Token token, Ast *type, Ast *specialization) {
Ast *result = alloc_ast_node(f, Ast_PolyType);
result->PolyType.token = token;
result->PolyType.type = type;
result->PolyType.specialization = specialization;
return result;
}
Ast *ast_proc_type(AstFile *f, Token token, Ast *params, Ast *results, u64 tags, ProcCallingConvention calling_convention, bool generic, bool diverging) {
Ast *result = alloc_ast_node(f, Ast_ProcType);
result->ProcType.token = token;
result->ProcType.params = params;
result->ProcType.results = results;
result->ProcType.tags = tags;
result->ProcType.calling_convention = calling_convention;
result->ProcType.generic = generic;
result->ProcType.diverging = diverging;
return result;
}
Ast *ast_relative_type(AstFile *f, Ast *tag, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_RelativeType);
result->RelativeType.tag = tag;
result->RelativeType.type = type;
return result;
}
Ast *ast_pointer_type(AstFile *f, Token token, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_PointerType);
result->PointerType.token = token;
result->PointerType.type = type;
return result;
}
Ast *ast_multi_pointer_type(AstFile *f, Token token, Ast *type) {
Ast *result = alloc_ast_node(f, Ast_MultiPointerType);
result->MultiPointerType.token = token;
result->MultiPointerType.type = type;
return result;
}
Ast *ast_array_type(AstFile *f, Token token, Ast *count, Ast *elem) {
Ast *result = alloc_ast_node(f, Ast_ArrayType);
result->ArrayType.token = token;
result->ArrayType.count = count;
result->ArrayType.elem = elem;
return result;
}
Ast *ast_dynamic_array_type(AstFile *f, Token token, Ast *elem) {
Ast *result = alloc_ast_node(f, Ast_DynamicArrayType);
result->DynamicArrayType.token = token;
result->DynamicArrayType.elem = elem;
return result;
}
Ast *ast_struct_type(AstFile *f, Token token, Slice<Ast *> fields, isize field_count,
Ast *polymorphic_params, bool is_packed, bool is_raw_union,
Ast *align,
Token where_token, Array<Ast *> const &where_clauses) {
Ast *result = alloc_ast_node(f, Ast_StructType);
result->StructType.token = token;
result->StructType.fields = fields;
result->StructType.field_count = field_count;
result->StructType.polymorphic_params = polymorphic_params;
result->StructType.is_packed = is_packed;
result->StructType.is_raw_union = is_raw_union;
result->StructType.align = align;
result->StructType.where_token = where_token;
result->StructType.where_clauses = slice_from_array(where_clauses);
return result;
}
Ast *ast_union_type(AstFile *f, Token token, Array<Ast *> const &variants, Ast *polymorphic_params, Ast *align, bool no_nil, bool maybe,
Token where_token, Array<Ast *> const &where_clauses) {
Ast *result = alloc_ast_node(f, Ast_UnionType);
result->UnionType.token = token;
result->UnionType.variants = slice_from_array(variants);
result->UnionType.polymorphic_params = polymorphic_params;
result->UnionType.align = align;
result->UnionType.no_nil = no_nil;
result->UnionType.maybe = maybe;
result->UnionType.where_token = where_token;
result->UnionType.where_clauses = slice_from_array(where_clauses);
return result;
}
Ast *ast_enum_type(AstFile *f, Token token, Ast *base_type, Array<Ast *> const &fields) {
Ast *result = alloc_ast_node(f, Ast_EnumType);
result->EnumType.token = token;
result->EnumType.base_type = base_type;
result->EnumType.fields = slice_from_array(fields);
return result;
}
Ast *ast_bit_set_type(AstFile *f, Token token, Ast *elem, Ast *underlying) {
Ast *result = alloc_ast_node(f, Ast_BitSetType);
result->BitSetType.token = token;
result->BitSetType.elem = elem;
result->BitSetType.underlying = underlying;
return result;
}
Ast *ast_map_type(AstFile *f, Token token, Ast *key, Ast *value) {
Ast *result = alloc_ast_node(f, Ast_MapType);
result->MapType.token = token;
result->MapType.key = key;
result->MapType.value = value;
return result;
}
Ast *ast_matrix_type(AstFile *f, Token token, Ast *row_count, Ast *column_count, Ast *elem) {
Ast *result = alloc_ast_node(f, Ast_MatrixType);
result->MatrixType.token = token;
result->MatrixType.row_count = row_count;
result->MatrixType.column_count = column_count;
result->MatrixType.elem = elem;
return result;
}
Ast *ast_foreign_block_decl(AstFile *f, Token token, Ast *foreign_library, Ast *body,
CommentGroup *docs) {
Ast *result = alloc_ast_node(f, Ast_ForeignBlockDecl);
result->ForeignBlockDecl.token = token;
result->ForeignBlockDecl.foreign_library = foreign_library;
result->ForeignBlockDecl.body = body;
result->ForeignBlockDecl.docs = docs;
result->ForeignBlockDecl.attributes.allocator = heap_allocator();
return result;
}
Ast *ast_label_decl(AstFile *f, Token token, Ast *name) {
Ast *result = alloc_ast_node(f, Ast_Label);
result->Label.token = token;
result->Label.name = name;
return result;
}
Ast *ast_value_decl(AstFile *f, Array<Ast *> const &names, Ast *type, Array<Ast *> const &values, bool is_mutable,
CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_ValueDecl);
result->ValueDecl.names = slice_from_array(names);
result->ValueDecl.type = type;
result->ValueDecl.values = slice_from_array(values);
result->ValueDecl.is_mutable = is_mutable;
result->ValueDecl.docs = docs;
result->ValueDecl.comment = comment;
result->ValueDecl.attributes.allocator = heap_allocator();
return result;
}
Ast *ast_package_decl(AstFile *f, Token token, Token name, CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_PackageDecl);
result->PackageDecl.token = token;
result->PackageDecl.name = name;
result->PackageDecl.docs = docs;
result->PackageDecl.comment = comment;
return result;
}
Ast *ast_import_decl(AstFile *f, Token token, bool is_using, Token relpath, Token import_name,
CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_ImportDecl);
result->ImportDecl.token = token;
result->ImportDecl.is_using = is_using;
result->ImportDecl.relpath = relpath;
result->ImportDecl.import_name = import_name;
result->ImportDecl.docs = docs;
result->ImportDecl.comment = comment;
return result;
}
Ast *ast_foreign_import_decl(AstFile *f, Token token, Array<Token> filepaths, Token library_name,
CommentGroup *docs, CommentGroup *comment) {
Ast *result = alloc_ast_node(f, Ast_ForeignImportDecl);
result->ForeignImportDecl.token = token;
result->ForeignImportDecl.filepaths = slice_from_array(filepaths);
result->ForeignImportDecl.library_name = library_name;
result->ForeignImportDecl.docs = docs;
result->ForeignImportDecl.comment = comment;
result->ForeignImportDecl.attributes.allocator = heap_allocator();
return result;
}
Ast *ast_attribute(AstFile *f, Token token, Token open, Token close, Array<Ast *> const &elems) {
Ast *result = alloc_ast_node(f, Ast_Attribute);
result->Attribute.token = token;
result->Attribute.open = open;
result->Attribute.elems = slice_from_array(elems);
result->Attribute.close = close;
return result;
}
bool next_token0(AstFile *f) {
if (f->curr_token_index+1 < f->tokens.count) {
f->curr_token = f->tokens[++f->curr_token_index];
return true;
}
syntax_error(f->curr_token, "Token is EOF");
return false;
}
Token consume_comment(AstFile *f, isize *end_line_) {
Token tok = f->curr_token;
GB_ASSERT(tok.kind == Token_Comment);
isize end_line = tok.pos.line;
if (tok.string[1] == '*') {
for (isize i = 2; i < tok.string.len; i++) {
if (tok.string[i] == '\n') {
end_line++;
}
}
}
if (end_line_) *end_line_ = end_line;
next_token0(f);
if (f->curr_token.pos.line > tok.pos.line || tok.kind == Token_EOF) {
end_line++;
}
return tok;
}
CommentGroup *consume_comment_group(AstFile *f, isize n, isize *end_line_) {
Array<Token> list = {};
list.allocator = heap_allocator();
isize end_line = f->curr_token.pos.line;
if (f->curr_token_index == 1 &&
f->prev_token.kind == Token_Comment &&
f->prev_token.pos.line+1 == f->curr_token.pos.line) {
// NOTE(bill): Special logic for the first comment in the file
array_add(&list, f->prev_token);
}
while (f->curr_token.kind == Token_Comment &&
f->curr_token.pos.line <= end_line+n) {
array_add(&list, consume_comment(f, &end_line));
}
if (end_line_) *end_line_ = end_line;
CommentGroup *comments = nullptr;
if (list.count > 0) {
comments = gb_alloc_item(permanent_allocator(), CommentGroup);
comments->list = slice_from_array(list);
array_add(&f->comments, comments);
}
return comments;
}
void consume_comment_groups(AstFile *f, Token prev) {
if (f->curr_token.kind == Token_Comment) {
CommentGroup *comment = nullptr;
isize end_line = 0;
if (f->curr_token.pos.line == prev.pos.line) {
comment = consume_comment_group(f, 0, &end_line);
if (f->curr_token.pos.line != end_line || f->curr_token.kind == Token_EOF) {
f->line_comment = comment;
}
}
end_line = -1;
while (f->curr_token.kind == Token_Comment) {
comment = consume_comment_group(f, 1, &end_line);
}
if (end_line+1 == f->curr_token.pos.line || end_line < 0) {
f->lead_comment = comment;
}
GB_ASSERT(f->curr_token.kind != Token_Comment);
}
}
bool ignore_newlines(AstFile *f) {
if (f->allow_newline) {
return f->expr_level > 0;
}
return f->expr_level >= 0;
}
Token advance_token(AstFile *f) {
f->lead_comment = nullptr;
f->line_comment = nullptr;
f->prev_token_index = f->curr_token_index;
Token prev = f->prev_token = f->curr_token;
bool ok = next_token0(f);
if (ok) {
switch (f->curr_token.kind) {
case Token_Comment:
consume_comment_groups(f, prev);
break;
case Token_Semicolon:
if (ignore_newlines(f) && f->curr_token.string == "\n") {
advance_token(f);
}
break;
}
}
return prev;
}
bool peek_token_kind(AstFile *f, TokenKind kind) {
for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
Token tok = f->tokens[i];
if (kind != Token_Comment && tok.kind == Token_Comment) {
continue;
}
return tok.kind == kind;
}
return false;
}
Token peek_token(AstFile *f) {
for (isize i = f->curr_token_index+1; i < f->tokens.count; i++) {
Token tok = f->tokens[i];
if (tok.kind == Token_Comment) {
continue;
}
return tok;
}
return {};
}
bool skip_possible_newline(AstFile *f) {
if (token_is_newline(f->curr_token)) {
advance_token(f);
return true;
}
return false;
}
bool skip_possible_newline_for_literal(AstFile *f) {
Token curr = f->curr_token;
if (token_is_newline(curr)) {
Token next = peek_token(f);
if (curr.pos.line+1 >= next.pos.line) {
switch (next.kind) {
case Token_OpenBrace:
case Token_else:
case Token_where:
advance_token(f);
return true;
}
}
}
return false;
}
String token_to_string(Token const &tok) {
String p = token_strings[tok.kind];
if (token_is_newline(tok)) {
p = str_lit("newline");
}
return p;
}
Token expect_token(AstFile *f, TokenKind kind) {
Token prev = f->curr_token;
if (prev.kind != kind) {
String c = token_strings[kind];
String p = token_to_string(prev);
syntax_error(f->curr_token, "Expected '%.*s', got '%.*s'", LIT(c), LIT(p));
if (prev.kind == Token_EOF) {
gb_exit(1);
}
}
advance_token(f);
return prev;
}
Token expect_token_after(AstFile *f, TokenKind kind, char const *msg) {
Token prev = f->curr_token;
if (prev.kind != kind) {
String p = token_to_string(prev);
syntax_error(f->curr_token, "Expected '%.*s' after %s, got '%.*s'",
LIT(token_strings[kind]),
msg,
LIT(p));
}
advance_token(f);
return prev;
}
bool is_token_range(TokenKind kind) {
switch (kind) {
case Token_Ellipsis:
case Token_RangeFull:
case Token_RangeHalf:
return true;
}
return false;
}
bool is_token_range(Token tok) {
return is_token_range(tok.kind);
}
Token expect_operator(AstFile *f) {
Token prev = f->curr_token;
if ((prev.kind == Token_in || prev.kind == Token_not_in) && (f->expr_level >= 0 || f->allow_in_expr)) {
// okay
} else if (prev.kind == Token_if || prev.kind == Token_when) {
// okay
} else if (prev.kind == Token_or_else || prev.kind == Token_or_return) {
// okay
} else if (!gb_is_between(prev.kind, Token__OperatorBegin+1, Token__OperatorEnd-1)) {
String p = token_to_string(prev);
syntax_error(f->curr_token, "Expected an operator, got '%.*s'",
LIT(p));
} else if (!f->allow_range && is_token_range(prev)) {
String p = token_to_string(prev);
syntax_error(f->curr_token, "Expected an non-range operator, got '%.*s'",
LIT(p));
}
if (f->curr_token.kind == Token_Ellipsis) {
f->tokens[f->curr_token_index].flags |= TokenFlag_Replace;
}
advance_token(f);
return prev;
}
Token expect_keyword(AstFile *f) {
Token prev = f->curr_token;
if (!gb_is_between(prev.kind, Token__KeywordBegin+1, Token__KeywordEnd-1)) {
String p = token_to_string(prev);
syntax_error(f->curr_token, "Expected a keyword, got '%.*s'",
LIT(p));
}
advance_token(f);
return prev;
}
bool allow_token(AstFile *f, TokenKind kind) {
Token prev = f->curr_token;
if (prev.kind == kind) {
advance_token(f);
return true;
}
return false;
}
Token expect_closing_brace_of_field_list(AstFile *f) {
Token token = f->curr_token;
if (allow_token(f, Token_CloseBrace)) {
return token;
}
if (allow_token(f, Token_Semicolon)) {
String p = token_to_string(token);
syntax_error(token_end_of_line(f, f->prev_token), "Expected a comma, got a %.*s", LIT(p));
}
return expect_token(f, Token_CloseBrace);
}
bool is_blank_ident(String str) {
if (str.len == 1) {
return str[0] == '_';
}
return false;
}
bool is_blank_ident(Token token) {
if (token.kind == Token_Ident) {
return is_blank_ident(token.string);
}
return false;
}
bool is_blank_ident(Ast *node) {
if (node->kind == Ast_Ident) {
ast_node(i, Ident, node);
return is_blank_ident(i->token.string);
}
return false;
}
// NOTE(bill): Go to next statement to prevent numerous error messages popping up
void fix_advance_to_next_stmt(AstFile *f) {
for (;;) {
Token t = f->curr_token;
switch (t.kind) {
case Token_EOF:
case Token_Semicolon:
return;
case Token_package:
case Token_foreign:
case Token_import:
case Token_if:
case Token_for:
case Token_when:
case Token_return:
case Token_switch:
case Token_defer:
case Token_using:
case Token_break:
case Token_continue:
case Token_fallthrough:
case Token_Hash:
{
if (t.pos == f->fix_prev_pos &&
f->fix_count < PARSER_MAX_FIX_COUNT) {
f->fix_count++;
return;
}
if (f->fix_prev_pos < t.pos) {
f->fix_prev_pos = t.pos;
f->fix_count = 0; // NOTE(bill): Reset
return;
}
// NOTE(bill): Reaching here means there is a parsing bug
} break;
}
advance_token(f);
}
}
Token expect_closing(AstFile *f, TokenKind kind, String context) {
if (f->curr_token.kind != kind &&
f->curr_token.kind == Token_Semicolon &&
f->curr_token.string == "\n") {
Token tok = f->prev_token;
tok.pos.column += cast(i32)tok.string.len;
syntax_error(tok, "Missing ',' before newline in %.*s", LIT(context));
advance_token(f);
}
return expect_token(f, kind);
}
void assign_removal_flag_to_semicolon(AstFile *f) {
// NOTE(bill): this is used for rewriting files to strip unneeded semicolons
Token *prev_token = &f->tokens[f->prev_token_index];
Token *curr_token = &f->tokens[f->curr_token_index];
GB_ASSERT(prev_token->kind == Token_Semicolon);
if (prev_token->string == ";") {
bool ok = false;
if (curr_token->pos.line > prev_token->pos.line) {
ok = true;
} else if (curr_token->pos.line == prev_token->pos.line) {
switch (curr_token->kind) {
case Token_CloseBrace:
case Token_CloseParen:
ok = true;
break;
}
}
if (ok) {
if (build_context.strict_style) {
syntax_error(*prev_token, "Found unneeded semicolon");
} else if (build_context.strict_style_init_only && f->pkg->kind == Package_Init) {
syntax_error(*prev_token, "Found unneeded semicolon");
}
prev_token->flags |= TokenFlag_Remove;
}
}
}
void expect_semicolon(AstFile *f, Ast *s) {
Token prev_token = {};
if (allow_token(f, Token_Semicolon)) {
assign_removal_flag_to_semicolon(f);
return;
}
switch (f->curr_token.kind) {
case Token_CloseBrace:
case Token_CloseParen:
if (f->curr_token.pos.line == f->prev_token.pos.line) {
return;
}
break;
}
prev_token = f->prev_token;
if (prev_token.kind == Token_Semicolon) {
assign_removal_flag_to_semicolon(f);
return;
}
if (f->curr_token.kind == Token_EOF) {
return;
}
if (s != nullptr) {
return;
}
switch (f->curr_token.kind) {
case Token_EOF:
return;
}
String p = token_to_string(f->curr_token);
syntax_error(prev_token, "Expected ';', got %.*s", LIT(p));
fix_advance_to_next_stmt(f);
}
Ast * parse_expr(AstFile *f, bool lhs);
Ast * parse_proc_type(AstFile *f, Token proc_token);
Array<Ast *> parse_stmt_list(AstFile *f);
Ast * parse_stmt(AstFile *f);
Ast * parse_body(AstFile *f);
Ast * parse_block_stmt(AstFile *f, b32 is_when);
Ast *parse_ident(AstFile *f, bool allow_poly_names=false) {
Token token = f->curr_token;
if (token.kind == Token_Ident) {
advance_token(f);
} else if (allow_poly_names && token.kind == Token_Dollar) {
Token dollar = expect_token(f, Token_Dollar);
Ast *name = ast_ident(f, expect_token(f, Token_Ident));
if (is_blank_ident(name)) {
syntax_error(name, "Invalid polymorphic type definition with a blank identifier");
}
return ast_poly_type(f, dollar, name, nullptr);
} else {
token.string = str_lit("_");
expect_token(f, Token_Ident);
}
return ast_ident(f, token);
}
Ast *parse_tag_expr(AstFile *f, Ast *expression) {
Token token = expect_token(f, Token_Hash);
Token name = expect_token(f, Token_Ident);
return ast_tag_expr(f, token, name, expression);
}
Ast *unparen_expr(Ast *node) {
for (;;) {
if (node == nullptr) {
return nullptr;
}
if (node->kind != Ast_ParenExpr) {
return node;
}
node = node->ParenExpr.expr;
}
}
Ast *unselector_expr(Ast *node) {
node = unparen_expr(node);
if (node == nullptr) {
return nullptr;
}
while (node->kind == Ast_SelectorExpr) {
node = node->SelectorExpr.selector;
}
return node;
}
Ast *strip_or_return_expr(Ast *node) {
for (;;) {
if (node == nullptr) {
return node;
}
if (node->kind == Ast_OrReturnExpr) {
node = node->OrReturnExpr.expr;
} else if (node->kind == Ast_ParenExpr) {
node = node->ParenExpr.expr;
} else {
return node;
}
}
}
Ast *parse_value(AstFile *f);
Array<Ast *> parse_element_list(AstFile *f) {
auto elems = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
Ast *elem = parse_value(f);
if (f->curr_token.kind == Token_Eq) {
Token eq = expect_token(f, Token_Eq);
Ast *value = parse_value(f);
elem = ast_field_value(f, elem, value, eq);
}
array_add(&elems, elem);
if (!allow_token(f, Token_Comma)) {
break;
}
}
return elems;
}
CommentGroup *consume_line_comment(AstFile *f) {
CommentGroup *comment = f->line_comment;
if (f->line_comment == f->lead_comment) {
f->lead_comment = nullptr;
}
f->line_comment = nullptr;
return comment;
}
Array<Ast *> parse_enum_field_list(AstFile *f) {
auto elems = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
CommentGroup *docs = f->lead_comment;
CommentGroup *comment = nullptr;
Ast *name = parse_value(f);
Ast *value = nullptr;
if (f->curr_token.kind == Token_Eq) {
Token eq = expect_token(f, Token_Eq);
value = parse_value(f);
}
comment = consume_line_comment(f);
Ast *elem = ast_enum_field_value(f, name, value, docs, comment);
array_add(&elems, elem);
if (!allow_token(f, Token_Comma)) {
break;
}
if (!elem->EnumFieldValue.comment) {
elem->EnumFieldValue.comment = consume_line_comment(f);
}
}
return elems;
}
Ast *parse_literal_value(AstFile *f, Ast *type) {
Array<Ast *> elems = {};
Token open = expect_token(f, Token_OpenBrace);
isize expr_level = f->expr_level;
f->expr_level = 0;
if (f->curr_token.kind != Token_CloseBrace) {
elems = parse_element_list(f);
}
f->expr_level = expr_level;
Token close = expect_closing(f, Token_CloseBrace, str_lit("compound literal"));
return ast_compound_lit(f, type, elems, open, close);
}
Ast *parse_value(AstFile *f) {
if (f->curr_token.kind == Token_OpenBrace) {
return parse_literal_value(f, nullptr);
}
Ast *value;
bool prev_allow_range = f->allow_range;
f->allow_range = true;
value = parse_expr(f, false);
f->allow_range = prev_allow_range;
return value;
}
Ast *parse_type_or_ident(AstFile *f);
void check_proc_add_tag(AstFile *f, Ast *tag_expr, u64 *tags, ProcTag tag, String tag_name) {
if (*tags & tag) {
syntax_error(tag_expr, "Procedure tag already used: %.*s", LIT(tag_name));
}
*tags |= tag;
}
bool is_foreign_name_valid(String name) {
if (name.len == 0) {
return false;
}
isize offset = 0;
while (offset < name.len) {
Rune rune;
isize remaining = name.len - offset;
isize width = utf8_decode(name.text+offset, remaining, &rune);
if (rune == GB_RUNE_INVALID && width == 1) {
return false;
} else if (rune == GB_RUNE_BOM && remaining > 0) {
return false;
}
if (offset == 0) {
switch (rune) {
case '-':
case '$':
case '.':
case '_':
break;
default:
if (!gb_char_is_alpha(cast(char)rune))
return false;
break;
}
} else {
switch (rune) {
case '-':
case '$':
case '.':
case '_':
break;
default:
if (!gb_char_is_alphanumeric(cast(char)rune)) {
return false;
}
break;
}
}
offset += width;
}
return true;
}
void parse_proc_tags(AstFile *f, u64 *tags) {
GB_ASSERT(tags != nullptr);
while (f->curr_token.kind == Token_Hash) {
Ast *tag_expr = parse_tag_expr(f, nullptr);
ast_node(te, TagExpr, tag_expr);
String tag_name = te->name.string;
#define ELSE_IF_ADD_TAG(name) \
else if (tag_name == #name) { \
check_proc_add_tag(f, tag_expr, tags, ProcTag_##name, tag_name); \
}
if (false) {}
ELSE_IF_ADD_TAG(optional_ok)
ELSE_IF_ADD_TAG(optional_second)
ELSE_IF_ADD_TAG(require_results)
ELSE_IF_ADD_TAG(bounds_check)
ELSE_IF_ADD_TAG(no_bounds_check)
ELSE_IF_ADD_TAG(type_assert)
ELSE_IF_ADD_TAG(no_type_assert)
else {
syntax_error(tag_expr, "Unknown procedure type tag #%.*s", LIT(tag_name));
}
#undef ELSE_IF_ADD_TAG
}
if ((*tags & ProcTag_bounds_check) && (*tags & ProcTag_no_bounds_check)) {
syntax_error(f->curr_token, "You cannot apply both #bounds_check and #no_bounds_check to a procedure");
}
if ((*tags & ProcTag_type_assert) && (*tags & ProcTag_no_type_assert)) {
syntax_error(f->curr_token, "You cannot apply both #type_assert and #no_type_assert to a procedure");
}
}
Array<Ast *> parse_lhs_expr_list (AstFile *f);
Array<Ast *> parse_rhs_expr_list (AstFile *f);
Ast * parse_simple_stmt (AstFile *f, u32 flags);
Ast * parse_type (AstFile *f);
Ast * parse_call_expr (AstFile *f, Ast *operand);
Ast * parse_struct_field_list(AstFile *f, isize *name_count_);
Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, TokenKind follow, bool allow_default_parameters, bool allow_typeid_token);
Ast *parse_unary_expr(AstFile *f, bool lhs);
Ast *convert_stmt_to_expr(AstFile *f, Ast *statement, String kind) {
if (statement == nullptr) {
return nullptr;
}
if (statement->kind == Ast_ExprStmt) {
return statement->ExprStmt.expr;
}
syntax_error(f->curr_token, "Expected '%.*s', found a simple statement.", LIT(kind));
Token end = f->curr_token;
if (f->tokens.count < f->curr_token_index) {
end = f->tokens[f->curr_token_index+1];
}
return ast_bad_expr(f, f->curr_token, end);
}
Ast *convert_stmt_to_body(AstFile *f, Ast *stmt) {
if (stmt->kind == Ast_BlockStmt) {
syntax_error(stmt, "Expected a normal statement rather than a block statement");
return stmt;
}
if (stmt->kind == Ast_EmptyStmt) {
syntax_error(stmt, "Expected a non-empty statement");
}
GB_ASSERT(is_ast_stmt(stmt) || is_ast_decl(stmt));
Token open = ast_token(stmt);
Token close = ast_token(stmt);
auto stmts = array_make<Ast *>(heap_allocator(), 0, 1);
array_add(&stmts, stmt);
return ast_block_stmt(f, stmts, open, close);
}
void check_polymorphic_params_for_type(AstFile *f, Ast *polymorphic_params, Token token) {
if (polymorphic_params == nullptr) {
return;
}
if (polymorphic_params->kind != Ast_FieldList) {
return;
}
ast_node(fl, FieldList, polymorphic_params);
for_array(fi, fl->list) {
Ast *field = fl->list[fi];
if (field->kind != Ast_Field) {
continue;
}
for_array(i, field->Field.names) {
Ast *name = field->Field.names[i];
if (name->kind != field->Field.names[0]->kind) {
syntax_error(name, "Mixture of polymorphic names using both $ and not for %.*s parameters", LIT(token.string));
return;
}
}
}
}
bool ast_on_same_line(Token const &x, Ast *yp) {
Token y = ast_token(yp);
return x.pos.line == y.pos.line;
}
bool ast_on_same_line(Ast *x, Ast *y) {
return ast_on_same_line(ast_token(x), y);
}
Ast *parse_force_inlining_operand(AstFile *f, Token token) {
Ast *expr = parse_unary_expr(f, false);
Ast *e = strip_or_return_expr(expr);
if (e->kind != Ast_ProcLit && e->kind != Ast_CallExpr) {
syntax_error(expr, "%.*s must be followed by a procedure literal or call, got %.*s", LIT(token.string), LIT(ast_strings[expr->kind]));
return ast_bad_expr(f, token, f->curr_token);
}
ProcInlining pi = ProcInlining_none;
if (token.kind == Token_Ident) {
if (token.string == "force_inline") {
pi = ProcInlining_inline;
} else if (token.string == "force_no_inline") {
pi = ProcInlining_no_inline;
}
}
if (pi != ProcInlining_none) {
if (e->kind == Ast_ProcLit) {
if (expr->ProcLit.inlining != ProcInlining_none &&
expr->ProcLit.inlining != pi) {
syntax_error(expr, "Cannot apply both '#force_inline' and '#force_no_inline' to a procedure literal");
}
expr->ProcLit.inlining = pi;
} else if (e->kind == Ast_CallExpr) {
if (expr->CallExpr.inlining != ProcInlining_none &&
expr->CallExpr.inlining != pi) {
syntax_error(expr, "Cannot apply both '#force_inline' and '#force_no_inline' to a procedure call");
}
expr->CallExpr.inlining = pi;
}
}
return expr;
}
Ast *parse_check_directive_for_statement(Ast *s, Token const &tag_token, u16 state_flag) {
String name = tag_token.string;
if (s == nullptr) {
syntax_error(tag_token, "Invalid operand for #%.*s", LIT(name));
return nullptr;
}
if (s != nullptr && s->kind == Ast_EmptyStmt) {
if (s->EmptyStmt.token.string == "\n") {
syntax_error(tag_token, "#%.*s cannot be followed by a newline", LIT(name));
} else {
syntax_error(tag_token, "#%.*s cannot be applied to an empty statement ';'", LIT(name));
}
}
if (s->state_flags & state_flag) {
syntax_error(tag_token, "#%.*s has been applied multiple times", LIT(name));
}
s->state_flags |= state_flag;
switch (state_flag) {
case StateFlag_bounds_check:
if ((s->state_flags & StateFlag_no_bounds_check) != 0) {
syntax_error(tag_token, "#bounds_check and #no_bounds_check cannot be applied together");
}
break;
case StateFlag_no_bounds_check:
if ((s->state_flags & StateFlag_bounds_check) != 0) {
syntax_error(tag_token, "#bounds_check and #no_bounds_check cannot be applied together");
}
break;
case StateFlag_type_assert:
if ((s->state_flags & StateFlag_no_type_assert) != 0) {
syntax_error(tag_token, "#type_assert and #no_type_assert cannot be applied together");
}
break;
case StateFlag_no_type_assert:
if ((s->state_flags & StateFlag_type_assert) != 0) {
syntax_error(tag_token, "#type_assert and #no_type_assert cannot be applied together");
}
break;
}
switch (state_flag) {
case StateFlag_bounds_check:
case StateFlag_no_bounds_check:
case StateFlag_type_assert:
case StateFlag_no_type_assert:
switch (s->kind) {
case Ast_BlockStmt:
case Ast_IfStmt:
case Ast_WhenStmt:
case Ast_ForStmt:
case Ast_RangeStmt:
case Ast_UnrollRangeStmt:
case Ast_SwitchStmt:
case Ast_TypeSwitchStmt:
case Ast_ReturnStmt:
case Ast_DeferStmt:
case Ast_AssignStmt:
// Okay
break;
case Ast_ValueDecl:
if (!s->ValueDecl.is_mutable) {
syntax_error(tag_token, "#%.*s may only be applied to a variable declaration, and not a constant value declaration", LIT(name));
}
break;
default:
syntax_error(tag_token, "#%.*s may only be applied to the following statements: '{}', 'if', 'when', 'for', 'switch', 'return', 'defer', assignment, variable declaration", LIT(name));
break;
}
break;
}
return s;
}
Ast *parse_operand(AstFile *f, bool lhs) {
Ast *operand = nullptr; // Operand
switch (f->curr_token.kind) {
case Token_Ident:
return parse_ident(f);
case Token_Undef:
return ast_undef(f, expect_token(f, Token_Undef));
case Token_context:
return ast_implicit(f, expect_token(f, Token_context));
case Token_Integer:
case Token_Float:
case Token_Imag:
case Token_Rune:
return ast_basic_lit(f, advance_token(f));
case Token_String:
return ast_basic_lit(f, advance_token(f));
case Token_OpenBrace:
if (!lhs) return parse_literal_value(f, nullptr);
break;
case Token_OpenParen: {
bool allow_newline;
Token open, close;
// NOTE(bill): Skip the Paren Expression
open = expect_token(f, Token_OpenParen);
if (f->prev_token.kind == Token_CloseParen) {
close = expect_token(f, Token_CloseParen);
syntax_error(open, "Invalid parentheses expression with no inside expression");
return ast_bad_expr(f, open, close);
}
allow_newline = f->allow_newline;
if (f->expr_level < 0) {
f->allow_newline = false;
}
f->expr_level++;
operand = parse_expr(f, false);
f->expr_level--;
f->allow_newline = allow_newline;
close = expect_token(f, Token_CloseParen);
return ast_paren_expr(f, operand, open, close);
}
case Token_distinct: {
Token token = expect_token(f, Token_distinct);
Ast *type = parse_type(f);
return ast_distinct_type(f, token, type);
}
case Token_Hash: {
Token token = expect_token(f, Token_Hash);
Token name = expect_token(f, Token_Ident);
if (name.string == "type") {
return ast_helper_type(f, token, parse_type(f));
} else if (name.string == "soa" || name.string == "simd") {
Ast *tag = ast_basic_directive(f, token, name);
Ast *original_type = parse_type(f);
Ast *type = unparen_expr(original_type);
switch (type->kind) {
case Ast_ArrayType: type->ArrayType.tag = tag; break;
case Ast_DynamicArrayType: type->DynamicArrayType.tag = tag; break;
default:
syntax_error(type, "Expected an array type after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[type->kind]));
break;
}
return original_type;
} else if (name.string == "partial") {
Ast *tag = ast_basic_directive(f, token, name);
Ast *original_expr = parse_expr(f, lhs);
Ast *expr = unparen_expr(original_expr);
switch (expr->kind) {
case Ast_ArrayType:
syntax_error(expr, "#partial has been replaced with #sparse for non-contiguous enumerated array types");
break;
case Ast_CompoundLit:
expr->CompoundLit.tag = tag;
break;
default:
syntax_error(expr, "Expected a compound literal after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[expr->kind]));
break;
}
return original_expr;
} else if (name.string == "sparse") {
Ast *tag = ast_basic_directive(f, token, name);
Ast *original_type = parse_type(f);
Ast *type = unparen_expr(original_type);
switch (type->kind) {
case Ast_ArrayType: type->ArrayType.tag = tag; break;
default:
syntax_error(type, "Expected an enumerated array type after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[type->kind]));
break;
}
return original_type;
} else if (name.string == "bounds_check") {
Ast *operand = parse_expr(f, lhs);
return parse_check_directive_for_statement(operand, name, StateFlag_bounds_check);
} else if (name.string == "no_bounds_check") {
Ast *operand = parse_expr(f, lhs);
return parse_check_directive_for_statement(operand, name, StateFlag_no_bounds_check);
} else if (name.string == "type_assert") {
Ast *operand = parse_expr(f, lhs);
return parse_check_directive_for_statement(operand, name, StateFlag_type_assert);
} else if (name.string == "no_type_assert") {
Ast *operand = parse_expr(f, lhs);
return parse_check_directive_for_statement(operand, name, StateFlag_no_type_assert);
} else if (name.string == "relative") {
Ast *tag = ast_basic_directive(f, token, name);
tag = parse_call_expr(f, tag);
Ast *type = parse_type(f);
return ast_relative_type(f, tag, type);
} else if (name.string == "force_inline" ||
name.string == "force_no_inline") {
return parse_force_inlining_operand(f, name);
}
return ast_basic_directive(f, token, name);
}
// Parse Procedure Type or Literal or Group
case Token_proc: {
Token token = expect_token(f, Token_proc);
if (f->curr_token.kind == Token_OpenBrace) { // ProcGroup
Token open = expect_token(f, Token_OpenBrace);
auto args = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
Ast *elem = parse_expr(f, false);
array_add(&args, elem);
if (!allow_token(f, Token_Comma)) {
break;
}
}
Token close = expect_token(f, Token_CloseBrace);
if (args.count == 0) {
syntax_error(token, "Expected a least 1 argument in a procedure group");
}
return ast_proc_group(f, token, open, close, args);
}
Ast *type = parse_proc_type(f, token);
Token where_token = {};
Array<Ast *> where_clauses = {};
u64 tags = 0;
skip_possible_newline_for_literal(f);
if (f->curr_token.kind == Token_where) {
where_token = expect_token(f, Token_where);
isize prev_level = f->expr_level;
f->expr_level = -1;
where_clauses = parse_rhs_expr_list(f);
f->expr_level = prev_level;
}
parse_proc_tags(f, &tags);
if ((tags & ProcTag_require_results) != 0) {
syntax_error(f->curr_token, "#require_results has now been replaced as an attribute @(require_results) on the declaration");
tags &= ~ProcTag_require_results;
}
GB_ASSERT(type->kind == Ast_ProcType);
type->ProcType.tags = tags;
if (f->allow_type && f->expr_level < 0) {
if (tags != 0) {
syntax_error(token, "A procedure type cannot have suffix tags");
}
if (where_token.kind != Token_Invalid) {
syntax_error(where_token, "'where' clauses are not allowed on procedure types");
}
return type;
}
skip_possible_newline_for_literal(f);
if (allow_token(f, Token_Undef)) {
if (where_token.kind != Token_Invalid) {
syntax_error(where_token, "'where' clauses are not allowed on procedure literals without a defined body (replaced with ---)");
}
return ast_proc_lit(f, type, nullptr, tags, where_token, where_clauses);
} else if (f->curr_token.kind == Token_OpenBrace) {
Ast *curr_proc = f->curr_proc;
Ast *body = nullptr;
f->curr_proc = type;
body = parse_body(f);
f->curr_proc = curr_proc;
// Apply the tags directly to the body rather than the type
if (tags & ProcTag_no_bounds_check) {
body->state_flags |= StateFlag_no_bounds_check;
}
if (tags & ProcTag_bounds_check) {
body->state_flags |= StateFlag_bounds_check;
}
if (tags & ProcTag_no_type_assert) {
body->state_flags |= StateFlag_no_type_assert;
}
if (tags & ProcTag_type_assert) {
body->state_flags |= StateFlag_type_assert;
}
return ast_proc_lit(f, type, body, tags, where_token, where_clauses);
} else if (allow_token(f, Token_do)) {
Ast *curr_proc = f->curr_proc;
Ast *body = nullptr;
f->curr_proc = type;
body = convert_stmt_to_body(f, parse_stmt(f));
f->curr_proc = curr_proc;
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(type, body)) {
syntax_error(body, "The body of a 'do' must be on the same line as the signature");
}
return ast_proc_lit(f, type, body, tags, where_token, where_clauses);
}
if (tags != 0) {
syntax_error(token, "A procedure type cannot have suffix tags");
}
if (where_token.kind != Token_Invalid) {
syntax_error(where_token, "'where' clauses are not allowed on procedure types");
}
return type;
}
// Check for Types
case Token_Dollar: {
Token token = expect_token(f, Token_Dollar);
Ast *type = parse_ident(f);
if (is_blank_ident(type)) {
syntax_error(type, "Invalid polymorphic type definition with a blank identifier");
}
Ast *specialization = nullptr;
if (allow_token(f, Token_Quo)) {
specialization = parse_type(f);
}
return ast_poly_type(f, token, type, specialization);
} break;
case Token_typeid: {
Token token = expect_token(f, Token_typeid);
return ast_typeid_type(f, token, nullptr);
} break;
case Token_Pointer: {
Token token = expect_token(f, Token_Pointer);
Ast *elem = parse_type(f);
return ast_pointer_type(f, token, elem);
} break;
case Token_OpenBracket: {
Token token = expect_token(f, Token_OpenBracket);
Ast *count_expr = nullptr;
if (f->curr_token.kind == Token_Pointer) {
expect_token(f, Token_Pointer);
expect_token(f, Token_CloseBracket);
return ast_multi_pointer_type(f, token, parse_type(f));
} else if (f->curr_token.kind == Token_Question) {
count_expr = ast_unary_expr(f, expect_token(f, Token_Question), nullptr);
} else if (allow_token(f, Token_dynamic)) {
expect_token(f, Token_CloseBracket);
return ast_dynamic_array_type(f, token, parse_type(f));
} else if (f->curr_token.kind != Token_CloseBracket) {
f->expr_level++;
count_expr = parse_expr(f, false);
f->expr_level--;
}
expect_token(f, Token_CloseBracket);
return ast_array_type(f, token, count_expr, parse_type(f));
} break;
case Token_map: {
Token token = expect_token(f, Token_map);
Ast *key = nullptr;
Ast *value = nullptr;
Token open, close;
open = expect_token_after(f, Token_OpenBracket, "map");
key = parse_expr(f, true);
close = expect_token(f, Token_CloseBracket);
value = parse_type(f);
return ast_map_type(f, token, key, value);
} break;
case Token_matrix: {
Token token = expect_token(f, Token_matrix);
Ast *row_count = nullptr;
Ast *column_count = nullptr;
Ast *type = nullptr;
Token open, close;
open = expect_token_after(f, Token_OpenBracket, "matrix");
row_count = parse_expr(f, true);
expect_token(f, Token_Comma);
column_count = parse_expr(f, true);
close = expect_token(f, Token_CloseBracket);
type = parse_type(f);
return ast_matrix_type(f, token, row_count, column_count, type);
} break;
case Token_struct: {
Token token = expect_token(f, Token_struct);
Ast *polymorphic_params = nullptr;
bool is_packed = false;
bool is_raw_union = false;
Ast *align = nullptr;
if (allow_token(f, Token_OpenParen)) {
isize param_count = 0;
polymorphic_params = parse_field_list(f, ¶m_count, 0, Token_CloseParen, true, true);
if (param_count == 0) {
syntax_error(polymorphic_params, "Expected at least 1 polymorphic parameter");
polymorphic_params = nullptr;
}
expect_token_after(f, Token_CloseParen, "parameter list");
check_polymorphic_params_for_type(f, polymorphic_params, token);
}
isize prev_level = f->expr_level;
f->expr_level = -1;
while (allow_token(f, Token_Hash)) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "packed") {
if (is_packed) {
syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_packed = true;
} else if (tag.string == "align") {
if (align) {
syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else if (tag.string == "raw_union") {
if (is_raw_union) {
syntax_error(tag, "Duplicate struct tag '#%.*s'", LIT(tag.string));
}
is_raw_union = true;
} else {
syntax_error(tag, "Invalid struct tag '#%.*s'", LIT(tag.string));
}
}
f->expr_level = prev_level;
if (is_raw_union && is_packed) {
is_packed = false;
syntax_error(token, "'#raw_union' cannot also be '#packed'");
}
Token where_token = {};
Array<Ast *> where_clauses = {};
skip_possible_newline_for_literal(f);
if (f->curr_token.kind == Token_where) {
where_token = expect_token(f, Token_where);
isize prev_level = f->expr_level;
f->expr_level = -1;
where_clauses = parse_rhs_expr_list(f);
f->expr_level = prev_level;
}
skip_possible_newline_for_literal(f);
Token open = expect_token_after(f, Token_OpenBrace, "struct");
isize name_count = 0;
Ast *fields = parse_struct_field_list(f, &name_count);
Token close = expect_closing_brace_of_field_list(f);
Slice<Ast *> decls = {};
if (fields != nullptr) {
GB_ASSERT(fields->kind == Ast_FieldList);
decls = fields->FieldList.list;
}
return ast_struct_type(f, token, decls, name_count, polymorphic_params, is_packed, is_raw_union, align, where_token, where_clauses);
} break;
case Token_union: {
Token token = expect_token(f, Token_union);
auto variants = array_make<Ast *>(heap_allocator());
Ast *polymorphic_params = nullptr;
Ast *align = nullptr;
bool no_nil = false;
bool maybe = false;
Token start_token = f->curr_token;
if (allow_token(f, Token_OpenParen)) {
isize param_count = 0;
polymorphic_params = parse_field_list(f, ¶m_count, 0, Token_CloseParen, true, true);
if (param_count == 0) {
syntax_error(polymorphic_params, "Expected at least 1 polymorphic parametric");
polymorphic_params = nullptr;
}
expect_token_after(f, Token_CloseParen, "parameter list");
check_polymorphic_params_for_type(f, polymorphic_params, token);
}
while (allow_token(f, Token_Hash)) {
Token tag = expect_token_after(f, Token_Ident, "#");
if (tag.string == "align") {
if (align) {
syntax_error(tag, "Duplicate union tag '#%.*s'", LIT(tag.string));
}
align = parse_expr(f, true);
} else if (tag.string == "no_nil") {
if (no_nil) {
syntax_error(tag, "Duplicate union tag '#%.*s'", LIT(tag.string));
}
no_nil = true;
} else if (tag.string == "maybe") {
if (maybe) {
syntax_error(tag, "Duplicate union tag '#%.*s'", LIT(tag.string));
}
maybe = true;
}else {
syntax_error(tag, "Invalid union tag '#%.*s'", LIT(tag.string));
}
}
if (no_nil && maybe) {
syntax_error(f->curr_token, "#maybe and #no_nil cannot be applied together");
}
skip_possible_newline_for_literal(f);
Token where_token = {};
Array<Ast *> where_clauses = {};
if (f->curr_token.kind == Token_where) {
where_token = expect_token(f, Token_where);
isize prev_level = f->expr_level;
f->expr_level = -1;
where_clauses = parse_rhs_expr_list(f);
f->expr_level = prev_level;
}
skip_possible_newline_for_literal(f);
Token open = expect_token_after(f, Token_OpenBrace, "union");
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
Ast *type = parse_type(f);
if (type->kind != Ast_BadExpr) {
array_add(&variants, type);
}
if (!allow_token(f, Token_Comma)) {
break;
}
}
Token close = expect_closing_brace_of_field_list(f);
return ast_union_type(f, token, variants, polymorphic_params, align, no_nil, maybe, where_token, where_clauses);
} break;
case Token_enum: {
Token token = expect_token(f, Token_enum);
Ast *base_type = nullptr;
if (f->curr_token.kind != Token_OpenBrace) {
base_type = parse_type(f);
}
skip_possible_newline_for_literal(f);
Token open = expect_token(f, Token_OpenBrace);
Array<Ast *> values = parse_enum_field_list(f);
Token close = expect_closing_brace_of_field_list(f);
return ast_enum_type(f, token, base_type, values);
} break;
case Token_bit_set: {
Token token = expect_token(f, Token_bit_set);
expect_token(f, Token_OpenBracket);
Ast *elem = nullptr;
Ast *underlying = nullptr;
bool prev_allow_range = f->allow_range;
f->allow_range = true;
elem = parse_expr(f, true);
f->allow_range = prev_allow_range;
if (allow_token(f, Token_Semicolon)) {
underlying = parse_type(f);
} else if (allow_token(f, Token_Comma)) {
String p = token_to_string(f->prev_token);
syntax_error(token_end_of_line(f, f->prev_token), "Expected a semicolon, got a %.*s", LIT(p));
underlying = parse_type(f);
}
expect_token(f, Token_CloseBracket);
return ast_bit_set_type(f, token, elem, underlying);
}
case Token_asm: {
Token token = expect_token(f, Token_asm);
Array<Ast *> param_types = {};
Ast *return_type = nullptr;
if (allow_token(f, Token_OpenParen)) {
param_types = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_CloseParen && f->curr_token.kind != Token_EOF) {
Ast *t = parse_type(f);
array_add(¶m_types, t);
if (f->curr_token.kind != Token_Comma ||
f->curr_token.kind == Token_EOF) {
break;
}
advance_token(f);
}
expect_token(f, Token_CloseParen);
if (allow_token(f, Token_ArrowRight)) {
return_type = parse_type(f);
}
}
bool has_side_effects = false;
bool is_align_stack = false;
InlineAsmDialectKind dialect = InlineAsmDialect_Default;
while (f->curr_token.kind == Token_Hash) {
advance_token(f);
if (f->curr_token.kind == Token_Ident) {
Token token = advance_token(f);
String name = token.string;
if (name == "side_effects") {
if (has_side_effects) {
syntax_error(token, "Duplicate directive on inline asm expression: '#side_effects'");
}
has_side_effects = true;
} else if (name == "align_stack") {
if (is_align_stack) {
syntax_error(token, "Duplicate directive on inline asm expression: '#align_stack'");
}
is_align_stack = true;
} else if (name == "att") {
if (dialect == InlineAsmDialect_ATT) {
syntax_error(token, "Duplicate directive on inline asm expression: '#att'");
} else if (dialect != InlineAsmDialect_Default) {
syntax_error(token, "Conflicting asm dialects");
} else {
dialect = InlineAsmDialect_ATT;
}
} else if (name == "intel") {
if (dialect == InlineAsmDialect_Intel) {
syntax_error(token, "Duplicate directive on inline asm expression: '#intel'");
} else if (dialect != InlineAsmDialect_Default) {
syntax_error(token, "Conflicting asm dialects");
} else {
dialect = InlineAsmDialect_Intel;
}
}
} else {
syntax_error(f->curr_token, "Expected an identifier after hash");
}
}
skip_possible_newline_for_literal(f);
Token open = expect_token(f, Token_OpenBrace);
Ast *asm_string = parse_expr(f, false);
expect_token(f, Token_Comma);
Ast *constraints_string = parse_expr(f, false);
allow_token(f, Token_Comma);
Token close = expect_closing_brace_of_field_list(f);
return ast_inline_asm_expr(f, token, open, close, param_types, return_type, asm_string, constraints_string, has_side_effects, is_align_stack, dialect);
}
}
return nullptr;
}
bool is_literal_type(Ast *node) {
node = unparen_expr(node);
switch (node->kind) {
case Ast_BadExpr:
case Ast_Ident:
case Ast_SelectorExpr:
case Ast_ArrayType:
case Ast_StructType:
case Ast_UnionType:
case Ast_EnumType:
case Ast_DynamicArrayType:
case Ast_MapType:
case Ast_BitSetType:
case Ast_MatrixType:
case Ast_CallExpr:
return true;
case Ast_MultiPointerType:
// For better error messages
return true;
}
return false;
}
Ast *parse_call_expr(AstFile *f, Ast *operand) {
auto args = array_make<Ast *>(heap_allocator());
Token open_paren, close_paren;
Token ellipsis = {};
isize prev_expr_level = f->expr_level;
bool prev_allow_newline = f->allow_newline;
f->expr_level = 0;
f->allow_newline = true;
open_paren = expect_token(f, Token_OpenParen);
while (f->curr_token.kind != Token_CloseParen &&
f->curr_token.kind != Token_EOF &&
ellipsis.pos.line == 0) {
if (f->curr_token.kind == Token_Comma) {
syntax_error(f->curr_token, "Expected an expression not ,");
} else if (f->curr_token.kind == Token_Eq) {
syntax_error(f->curr_token, "Expected an expression not =");
}
bool prefix_ellipsis = false;
if (f->curr_token.kind == Token_Ellipsis) {
prefix_ellipsis = true;
ellipsis = expect_token(f, Token_Ellipsis);
}
Ast *arg = parse_expr(f, false);
if (f->curr_token.kind == Token_Eq) {
Token eq = expect_token(f, Token_Eq);
if (prefix_ellipsis) {
syntax_error(ellipsis, "'..' must be applied to value rather than the field name");
}
Ast *value = parse_value(f);
arg = ast_field_value(f, arg, value, eq);
}
array_add(&args, arg);
if (!allow_token(f, Token_Comma)) {
break;
}
}
f->allow_newline = prev_allow_newline;
f->expr_level = prev_expr_level;
close_paren = expect_closing(f, Token_CloseParen, str_lit("argument list"));
Ast *call = ast_call_expr(f, operand, args, open_paren, close_paren, ellipsis);
Ast *o = unparen_expr(operand);
if (o->kind == Ast_SelectorExpr && o->SelectorExpr.token.kind == Token_ArrowRight) {
return ast_selector_call_expr(f, o->SelectorExpr.token, o, call);
}
return call;
}
Ast *parse_atom_expr(AstFile *f, Ast *operand, bool lhs) {
if (operand == nullptr) {
if (f->allow_type) return nullptr;
Token begin = f->curr_token;
syntax_error(begin, "Expected an operand");
fix_advance_to_next_stmt(f);
operand = ast_bad_expr(f, begin, f->curr_token);
}
bool loop = true;
while (loop) {
switch (f->curr_token.kind) {
case Token_OpenParen:
operand = parse_call_expr(f, operand);
break;
case Token_Period: {
Token token = advance_token(f);
switch (f->curr_token.kind) {
case Token_Ident:
operand = ast_selector_expr(f, token, operand, parse_ident(f));
break;
// case Token_Integer:
// operand = ast_selector_expr(f, token, operand, parse_expr(f, lhs));
// break;
case Token_OpenParen: {
Token open = expect_token(f, Token_OpenParen);
Ast *type = parse_type(f);
Token close = expect_token(f, Token_CloseParen);
operand = ast_type_assertion(f, operand, token, type);
} break;
case Token_Question: {
Token question = expect_token(f, Token_Question);
Ast *type = ast_unary_expr(f, question, nullptr);
operand = ast_type_assertion(f, operand, token, type);
} break;
default:
syntax_error(f->curr_token, "Expected a selector");
advance_token(f);
operand = ast_bad_expr(f, ast_token(operand), f->curr_token);
// operand = ast_selector_expr(f, f->curr_token, operand, nullptr);
break;
}
} break;
case Token_ArrowRight: {
Token token = advance_token(f);
operand = ast_selector_expr(f, token, operand, parse_ident(f));
// Ast *call = parse_call_expr(f, sel);
// operand = ast_selector_call_expr(f, token, sel, call);
break;
}
case Token_OpenBracket: {
bool prev_allow_range = f->allow_range;
f->allow_range = false;
Token open = {}, close = {}, interval = {};
Ast *indices[2] = {};
bool is_interval = false;
f->expr_level++;
open = expect_token(f, Token_OpenBracket);
switch (f->curr_token.kind) {
case Token_Ellipsis:
case Token_RangeFull:
case Token_RangeHalf:
// NOTE(bill): Do not err yet
case Token_Colon:
break;
default:
indices[0] = parse_expr(f, false);
break;
}
switch (f->curr_token.kind) {
case Token_Ellipsis:
case Token_RangeFull:
case Token_RangeHalf:
syntax_error(f->curr_token, "Expected a colon, not a range");
/* fallthrough */
case Token_Comma: // matrix index
case Token_Colon:
interval = advance_token(f);
is_interval = true;
if (f->curr_token.kind != Token_CloseBracket &&
f->curr_token.kind != Token_EOF) {
indices[1] = parse_expr(f, false);
}
break;
}
f->expr_level--;
close = expect_token(f, Token_CloseBracket);
if (is_interval) {
if (interval.kind == Token_Comma) {
if (indices[0] == nullptr || indices[1] == nullptr) {
syntax_error(open, "Matrix index expressions require both row and column indices");
}
operand = ast_matrix_index_expr(f, operand, open, close, interval, indices[0], indices[1]);
} else {
operand = ast_slice_expr(f, operand, open, close, interval, indices[0], indices[1]);
}
} else {
operand = ast_index_expr(f, operand, indices[0], open, close);
}
f->allow_range = prev_allow_range;
} break;
case Token_Pointer: // Deference
operand = ast_deref_expr(f, operand, expect_token(f, Token_Pointer));
break;
case Token_or_return:
operand = ast_or_return_expr(f, operand, expect_token(f, Token_or_return));
break;
case Token_OpenBrace:
if (!lhs && is_literal_type(operand) && f->expr_level >= 0) {
operand = parse_literal_value(f, operand);
} else {
loop = false;
}
break;
case Token_Increment:
case Token_Decrement:
if (!lhs) {
Token token = advance_token(f);
syntax_error(token, "Postfix '%.*s' operator is not supported", LIT(token.string));
} else {
loop = false;
}
break;
default:
loop = false;
break;
}
lhs = false; // NOTE(bill): 'tis not lhs anymore
}
return operand;
}
Ast *parse_unary_expr(AstFile *f, bool lhs) {
switch (f->curr_token.kind) {
case Token_transmute:
case Token_cast: {
Token token = advance_token(f);
expect_token(f, Token_OpenParen);
Ast *type = parse_type(f);
expect_token(f, Token_CloseParen);
Ast *expr = parse_unary_expr(f, lhs);
return ast_type_cast(f, token, type, expr);
}
case Token_auto_cast: {
Token token = advance_token(f);
Ast *expr = parse_unary_expr(f, lhs);
return ast_auto_cast(f, token, expr);
}
case Token_Add:
case Token_Sub:
case Token_Xor:
case Token_And:
case Token_Not: {
Token token = advance_token(f);
Ast *expr = parse_unary_expr(f, lhs);
return ast_unary_expr(f, token, expr);
}
case Token_Increment:
case Token_Decrement: {
Token token = advance_token(f);
syntax_error(token, "Unary '%.*s' operator is not supported", LIT(token.string));
Ast *expr = parse_unary_expr(f, lhs);
return ast_unary_expr(f, token, expr);
}
case Token_Period: {
Token token = expect_token(f, Token_Period);
Ast *ident = parse_ident(f);
return ast_implicit_selector_expr(f, token, ident);
}
}
return parse_atom_expr(f, parse_operand(f, lhs), lhs);
}
bool is_ast_range(Ast *expr) {
if (expr == nullptr) {
return false;
}
if (expr->kind != Ast_BinaryExpr) {
return false;
}
return is_token_range(expr->BinaryExpr.op.kind);
}
// NOTE(bill): result == priority
i32 token_precedence(AstFile *f, TokenKind t) {
switch (t) {
case Token_Question:
case Token_if:
case Token_when:
case Token_or_else:
return 1;
case Token_Ellipsis:
case Token_RangeFull:
case Token_RangeHalf:
if (!f->allow_range) {
return 0;
}
return 2;
case Token_CmpOr:
return 3;
case Token_CmpAnd:
return 4;
case Token_CmpEq:
case Token_NotEq:
case Token_Lt:
case Token_Gt:
case Token_LtEq:
case Token_GtEq:
return 5;
case Token_in:
case Token_not_in:
if (f->expr_level < 0 && !f->allow_in_expr) {
return 0;
}
/*fallthrough*/
case Token_Add:
case Token_Sub:
case Token_Or:
case Token_Xor:
return 6;
case Token_Mul:
case Token_Quo:
case Token_Mod:
case Token_ModMod:
case Token_And:
case Token_AndNot:
case Token_Shl:
case Token_Shr:
return 7;
}
return 0;
}
Ast *parse_binary_expr(AstFile *f, bool lhs, i32 prec_in) {
Ast *expr = parse_unary_expr(f, lhs);
for (;;) {
Token op = f->curr_token;
i32 op_prec = token_precedence(f, op.kind);
if (op_prec < prec_in) {
// NOTE(bill): This will also catch operators that are not valid "binary" operators
break;
}
Token prev = f->prev_token;
switch (op.kind) {
case Token_if:
case Token_when:
if (prev.pos.line < op.pos.line) {
// NOTE(bill): Check to see if the `if` or `when` is on the same line of the `lhs` condition
goto loop_end;
}
break;
}
expect_operator(f); // NOTE(bill): error checks too
if (op.kind == Token_Question) {
Ast *cond = expr;
// Token_Question
Ast *x = parse_expr(f, lhs);
Token token_c = expect_token(f, Token_Colon);
Ast *y = parse_expr(f, lhs);
expr = ast_ternary_if_expr(f, x, cond, y);
} else if (op.kind == Token_if || op.kind == Token_when) {
Ast *x = expr;
Ast *cond = parse_expr(f, lhs);
Token tok_else = expect_token(f, Token_else);
Ast *y = parse_expr(f, lhs);
switch (op.kind) {
case Token_if:
expr = ast_ternary_if_expr(f, x, cond, y);
break;
case Token_when:
expr = ast_ternary_when_expr(f, x, cond, y);
break;
}
} else {
Ast *right = parse_binary_expr(f, false, op_prec+1);
if (right == nullptr) {
syntax_error(op, "Expected expression on the right-hand side of the binary operator '%.*s'", LIT(op.string));
}
if (op.kind == Token_or_else) {
// NOTE(bill): easier to handle its logic different with its own AST kind
expr = ast_or_else_expr(f, expr, op, right);
} else {
expr = ast_binary_expr(f, op, expr, right);
}
}
lhs = false;
}
loop_end:;
return expr;
}
Ast *parse_expr(AstFile *f, bool lhs) {
return parse_binary_expr(f, lhs, 0+1);
}
Array<Ast *> parse_expr_list(AstFile *f, bool lhs) {
bool allow_newline = f->allow_newline;
f->allow_newline = true;
auto list = array_make<Ast *>(heap_allocator());
for (;;) {
Ast *e = parse_expr(f, lhs);
array_add(&list, e);
if (f->curr_token.kind != Token_Comma ||
f->curr_token.kind == Token_EOF) {
break;
}
advance_token(f);
}
f->allow_newline = allow_newline;
return list;
}
Array<Ast *> parse_lhs_expr_list(AstFile *f) {
return parse_expr_list(f, true);
}
Array<Ast *> parse_rhs_expr_list(AstFile *f) {
return parse_expr_list(f, false);
}
Array<Ast *> parse_ident_list(AstFile *f, bool allow_poly_names) {
auto list = array_make<Ast *>(heap_allocator());
for (;;) {
array_add(&list, parse_ident(f, allow_poly_names));
if (f->curr_token.kind != Token_Comma ||
f->curr_token.kind == Token_EOF) {
break;
}
advance_token(f);
}
return list;
}
Ast *parse_type(AstFile *f) {
Ast *type = parse_type_or_ident(f);
if (type == nullptr) {
Token token = advance_token(f);
syntax_error(token, "Expected a type");
return ast_bad_expr(f, token, f->curr_token);
}
return type;
}
void parse_foreign_block_decl(AstFile *f, Array<Ast *> *decls) {
Ast *decl = parse_stmt(f);
switch (decl->kind) {
case Ast_EmptyStmt:
case Ast_BadStmt:
case Ast_BadDecl:
return;
case Ast_WhenStmt:
case Ast_ValueDecl:
array_add(decls, decl);
return;
default:
syntax_error(decl, "Foreign blocks only allow procedure and variable declarations");
return;
}
}
Ast *parse_foreign_block(AstFile *f, Token token) {
CommentGroup *docs = f->lead_comment;
Ast *foreign_library = nullptr;
if (f->curr_token.kind == Token_OpenBrace) {
foreign_library = ast_ident(f, blank_token);
} else {
foreign_library = parse_ident(f);
}
Token open = {};
Token close = {};
auto decls = array_make<Ast *>(heap_allocator());
bool prev_in_foreign_block = f->in_foreign_block;
defer (f->in_foreign_block = prev_in_foreign_block);
f->in_foreign_block = true;
skip_possible_newline_for_literal(f);
open = expect_token(f, Token_OpenBrace);
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
parse_foreign_block_decl(f, &decls);
}
close = expect_token(f, Token_CloseBrace);
Ast *body = ast_block_stmt(f, decls, open, close);
Ast *decl = ast_foreign_block_decl(f, token, foreign_library, body, docs);
expect_semicolon(f, decl);
return decl;
}
Ast *parse_value_decl(AstFile *f, Array<Ast *> names, CommentGroup *docs) {
bool is_mutable = true;
Array<Ast *> values = {};
Ast *type = parse_type_or_ident(f);
if (f->curr_token.kind == Token_Eq ||
f->curr_token.kind == Token_Colon) {
Token sep = {};
if (!is_mutable) {
sep = expect_token_after(f, Token_Colon, "type");
} else {
sep = advance_token(f);
is_mutable = sep.kind != Token_Colon;
}
values = parse_rhs_expr_list(f);
if (values.count > names.count) {
syntax_error(f->curr_token, "Too many values on the right hand side of the declaration");
} else if (values.count < names.count && !is_mutable) {
syntax_error(f->curr_token, "All constant declarations must be defined");
} else if (values.count == 0) {
syntax_error(f->curr_token, "Expected an expression for this declaration");
}
}
if (is_mutable) {
if (type == nullptr && values.count == 0) {
syntax_error(f->curr_token, "Missing variable type or initialization");
return ast_bad_decl(f, f->curr_token, f->curr_token);
}
} else {
if (type == nullptr && values.count == 0 && names.count > 0) {
syntax_error(f->curr_token, "Missing constant value");
return ast_bad_decl(f, f->curr_token, f->curr_token);
}
}
if (values.data == nullptr) {
values.allocator = heap_allocator();
}
if (f->expr_level >= 0) {
Ast *end = nullptr;
if (!is_mutable && values.count > 0) {
end = values[values.count-1];
}
if (f->curr_token.kind == Token_CloseBrace &&
f->curr_token.pos.line == f->prev_token.pos.line) {
} else {
expect_semicolon(f, end);
}
}
if (f->curr_proc == nullptr) {
if (values.count > 0 && names.count != values.count) {
syntax_error(
values[0],
"Expected %td expressions on the right hand side, got %td\n"
"\tNote: Global declarations do not allow for multi-valued expressions",
names.count, values.count
);
}
}
return ast_value_decl(f, names, type, values, is_mutable, docs, f->line_comment);
}
Ast *parse_simple_stmt(AstFile *f, u32 flags) {
Token token = f->curr_token;
CommentGroup *docs = f->lead_comment;
Array<Ast *> lhs = parse_lhs_expr_list(f);
token = f->curr_token;
switch (token.kind) {
case Token_Eq:
case Token_AddEq:
case Token_SubEq:
case Token_MulEq:
case Token_QuoEq:
case Token_ModEq:
case Token_ModModEq:
case Token_AndEq:
case Token_OrEq:
case Token_XorEq:
case Token_ShlEq:
case Token_ShrEq:
case Token_AndNotEq:
case Token_CmpAndEq:
case Token_CmpOrEq:
{
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a simple statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
advance_token(f);
Array<Ast *> rhs = parse_rhs_expr_list(f);
if (rhs.count == 0) {
syntax_error(token, "No right-hand side in assignment statement.");
return ast_bad_stmt(f, token, f->curr_token);
}
return ast_assign_stmt(f, token, lhs, rhs);
} break;
case Token_in:
if (flags&StmtAllowFlag_In) {
allow_token(f, Token_in);
bool prev_allow_range = f->allow_range;
f->allow_range = true;
Ast *expr = parse_expr(f, true);
f->allow_range = prev_allow_range;
auto rhs = array_make<Ast *>(heap_allocator(), 0, 1);
array_add(&rhs, expr);
return ast_assign_stmt(f, token, lhs, rhs);
}
break;
case Token_Colon:
expect_token_after(f, Token_Colon, "identifier list");
if ((flags&StmtAllowFlag_Label) && lhs.count == 1) {
switch (f->curr_token.kind) {
case Token_OpenBrace: // block statement
case Token_if:
case Token_for:
case Token_switch: {
Ast *name = lhs[0];
Ast *label = ast_label_decl(f, ast_token(name), name);
Ast *stmt = parse_stmt(f);
#define _SET_LABEL(Kind_, label_) case GB_JOIN2(Ast_, Kind_): (stmt->Kind_).label = label_; break
switch (stmt->kind) {
_SET_LABEL(BlockStmt, label);
_SET_LABEL(IfStmt, label);
_SET_LABEL(ForStmt, label);
_SET_LABEL(RangeStmt, label);
_SET_LABEL(SwitchStmt, label);
_SET_LABEL(TypeSwitchStmt, label);
default:
syntax_error(token, "Labels can only be applied to a loop or switch statement");
break;
}
#undef _SET_LABEL
return stmt;
} break;
}
}
return parse_value_decl(f, lhs, docs);
}
if (lhs.count > 1) {
syntax_error(token, "Expected 1 expression");
return ast_bad_stmt(f, token, f->curr_token);
}
switch (token.kind) {
case Token_Increment:
case Token_Decrement:
advance_token(f);
syntax_error(token, "Postfix '%.*s' statement is not supported", LIT(token.string));
break;
}
#if 0
switch (token.kind) {
case Token_Inc:
case Token_Dec:
advance_token(f);
return ast_inc_dec_stmt(f, token, lhs[0]);
}
#endif
return ast_expr_stmt(f, lhs[0]);
}
Ast *parse_block_stmt(AstFile *f, b32 is_when) {
skip_possible_newline_for_literal(f);
if (!is_when && f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a block statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
return parse_body(f);
}
Ast *parse_results(AstFile *f, bool *diverging) {
if (!allow_token(f, Token_ArrowRight)) {
return nullptr;
}
if (allow_token(f, Token_Not)) {
if (diverging) *diverging = true;
return nullptr;
}
isize prev_level = f->expr_level;
defer (f->expr_level = prev_level);
// f->expr_level = -1;
if (f->curr_token.kind != Token_OpenParen) {
Token begin_token = f->curr_token;
Array<Ast *> empty_names = {};
auto list = array_make<Ast *>(heap_allocator(), 0, 1);
Ast *type = parse_type(f);
Token tag = {};
array_add(&list, ast_field(f, empty_names, type, nullptr, 0, tag, nullptr, nullptr));
return ast_field_list(f, begin_token, list);
}
Ast *list = nullptr;
expect_token(f, Token_OpenParen);
list = parse_field_list(f, nullptr, FieldFlag_Results, Token_CloseParen, true, false);
expect_token_after(f, Token_CloseParen, "parameter list");
return list;
}
ProcCallingConvention string_to_calling_convention(String s) {
if (s == "odin") return ProcCC_Odin;
if (s == "contextless") return ProcCC_Contextless;
if (s == "cdecl") return ProcCC_CDecl;
if (s == "c") return ProcCC_CDecl;
if (s == "stdcall") return ProcCC_StdCall;
if (s == "std") return ProcCC_StdCall;
if (s == "fastcall") return ProcCC_FastCall;
if (s == "fast") return ProcCC_FastCall;
if (s == "none") return ProcCC_None;
if (s == "naked") return ProcCC_Naked;
if (s == "win64") return ProcCC_Win64;
if (s == "sysv") return ProcCC_SysV;
if (s == "system") {
if (build_context.metrics.os == TargetOs_windows) {
return ProcCC_StdCall;
}
return ProcCC_CDecl;
}
return ProcCC_Invalid;
}
Ast *parse_proc_type(AstFile *f, Token proc_token) {
Ast *params = nullptr;
Ast *results = nullptr;
bool diverging = false;
ProcCallingConvention cc = ProcCC_Invalid;
if (f->curr_token.kind == Token_String) {
Token token = expect_token(f, Token_String);
auto c = string_to_calling_convention(string_value_from_token(f, token));
if (c == ProcCC_Invalid) {
syntax_error(token, "Unknown procedure calling convention: '%.*s'", LIT(token.string));
} else {
cc = c;
}
}
if (cc == ProcCC_Invalid) {
if (f->in_foreign_block) {
cc = ProcCC_ForeignBlockDefault;
} else {
cc = default_calling_convention();
}
}
expect_token(f, Token_OpenParen);
params = parse_field_list(f, nullptr, FieldFlag_Signature, Token_CloseParen, true, true);
expect_token_after(f, Token_CloseParen, "parameter list");
results = parse_results(f, &diverging);
u64 tags = 0;
bool is_generic = false;
for_array(i, params->FieldList.list) {
Ast *param = params->FieldList.list[i];
ast_node(field, Field, param);
if (field->type != nullptr) {
if (field->type->kind == Ast_PolyType) {
is_generic = true;
goto end;
}
for_array(j, field->names) {
Ast *name = field->names[j];
if (name->kind == Ast_PolyType) {
is_generic = true;
goto end;
}
}
}
}
end:
return ast_proc_type(f, proc_token, params, results, tags, cc, is_generic, diverging);
}
Ast *parse_var_type(AstFile *f, bool allow_ellipsis, bool allow_typeid_token) {
if (allow_ellipsis && f->curr_token.kind == Token_Ellipsis) {
Token tok = advance_token(f);
Ast *type = parse_type_or_ident(f);
if (type == nullptr) {
syntax_error(tok, "variadic field missing type after '..'");
type = ast_bad_expr(f, tok, f->curr_token);
}
return ast_ellipsis(f, tok, type);
}
Ast *type = nullptr;
if (allow_typeid_token &&
f->curr_token.kind == Token_typeid) {
Token token = expect_token(f, Token_typeid);
Ast *specialization = nullptr;
if (allow_token(f, Token_Quo)) {
specialization = parse_type(f);
}
type = ast_typeid_type(f, token, specialization);
} else {
type = parse_type(f);
}
return type;
}
enum FieldPrefixKind : i32 {
FieldPrefix_Unknown = -1,
FieldPrefix_Invalid = 0,
FieldPrefix_using, // implies #subtype
FieldPrefix_const,
FieldPrefix_no_alias,
FieldPrefix_c_vararg,
FieldPrefix_auto_cast,
FieldPrefix_any_int,
FieldPrefix_subtype, // does not imply `using` semantics
};
struct ParseFieldPrefixMapping {
String name;
TokenKind token_kind;
FieldPrefixKind prefix;
FieldFlag flag;
};
gb_global ParseFieldPrefixMapping parse_field_prefix_mappings[] = {
{str_lit("using"), Token_using, FieldPrefix_using, FieldFlag_using},
{str_lit("auto_cast"), Token_auto_cast, FieldPrefix_auto_cast, FieldFlag_auto_cast},
{str_lit("no_alias"), Token_Hash, FieldPrefix_no_alias, FieldFlag_no_alias},
{str_lit("c_vararg"), Token_Hash, FieldPrefix_c_vararg, FieldFlag_c_vararg},
{str_lit("const"), Token_Hash, FieldPrefix_const, FieldFlag_const},
{str_lit("any_int"), Token_Hash, FieldPrefix_any_int, FieldFlag_any_int},
{str_lit("subtype"), Token_Hash, FieldPrefix_subtype, FieldFlag_subtype},
};
FieldPrefixKind is_token_field_prefix(AstFile *f) {
switch (f->curr_token.kind) {
case Token_EOF:
return FieldPrefix_Invalid;
case Token_using:
return FieldPrefix_using;
case Token_auto_cast:
return FieldPrefix_auto_cast;
case Token_Hash:
advance_token(f);
switch (f->curr_token.kind) {
case Token_Ident:
for (i32 i = 0; i < gb_count_of(parse_field_prefix_mappings); i++) {
auto const &mapping = parse_field_prefix_mappings[i];
if (mapping.token_kind == Token_Hash) {
if (f->curr_token.string == mapping.name) {
return mapping.prefix;
}
}
}
break;
}
return FieldPrefix_Unknown;
}
return FieldPrefix_Invalid;
}
u32 parse_field_prefixes(AstFile *f) {
i32 counts[gb_count_of(parse_field_prefix_mappings)] = {};
for (;;) {
FieldPrefixKind kind = is_token_field_prefix(f);
if (kind == FieldPrefix_Invalid) {
break;
}
if (kind == FieldPrefix_Unknown) {
syntax_error(f->curr_token, "Unknown prefix kind '#%.*s'", LIT(f->curr_token.string));
advance_token(f);
continue;
}
for (i32 i = 0; i < gb_count_of(parse_field_prefix_mappings); i++) {
if (parse_field_prefix_mappings[i].prefix == kind) {
counts[i] += 1;
advance_token(f);
break;
}
}
}
u32 field_flags = 0;
for (i32 i = 0; i < gb_count_of(parse_field_prefix_mappings); i++) {
if (counts[i] > 0) {
field_flags |= parse_field_prefix_mappings[i].flag;
if (counts[i] != 1) {
auto const &mapping = parse_field_prefix_mappings[i];
String name = mapping.name;
char const *prefix = "";
if (mapping.token_kind == Token_Hash) {
prefix = "#";
}
syntax_error(f->curr_token, "Multiple '%s%.*s' in this field list", prefix, LIT(name));
}
}
}
return field_flags;
}
u32 check_field_prefixes(AstFile *f, isize name_count, u32 allowed_flags, u32 set_flags) {
for (i32 i = 0; i < gb_count_of(parse_field_prefix_mappings); i++) {
bool err = false;
auto const &m = parse_field_prefix_mappings[i];
if ((set_flags & m.flag) != 0) {
if (m.flag == FieldFlag_using && name_count > 1) {
err = true;
syntax_error(f->curr_token, "Cannot apply 'using' to more than one of the same type");
}
if ((allowed_flags & m.flag) == 0) {
err = true;
char const *prefix = "";
if (m.token_kind == Token_Hash) {
prefix = "#";
}
syntax_error(f->curr_token, "'%s%.*s' in not allowed within this field list", prefix, LIT(m.name));
}
}
if (err) {
set_flags &= ~m.flag;
}
}
return set_flags;
}
struct AstAndFlags {
Ast *node;
u32 flags;
};
Array<Ast *> convert_to_ident_list(AstFile *f, Array<AstAndFlags> list, bool ignore_flags, bool allow_poly_names) {
auto idents = array_make<Ast *>(heap_allocator(), 0, list.count);
// Convert to ident list
for_array(i, list) {
Ast *ident = list[i].node;
if (!ignore_flags) {
if (i != 0) {
syntax_error(ident, "Illegal use of prefixes in parameter list");
}
}
switch (ident->kind) {
case Ast_Ident:
case Ast_BadExpr:
break;
case Ast_PolyType:
if (allow_poly_names) {
if (ident->PolyType.specialization == nullptr) {
break;
} else {
syntax_error(ident, "Expected a polymorphic identifier without any specialization");
}
} else {
syntax_error(ident, "Expected a non-polymorphic identifier");
}
/*fallthrough*/
default:
syntax_error(ident, "Expected an identifier");
ident = ast_ident(f, blank_token);
break;
}
array_add(&idents, ident);
}
return idents;
}
bool parse_expect_field_separator(AstFile *f, Ast *param) {
Token token = f->curr_token;
if (allow_token(f, Token_Comma)) {
return true;
}
if (token.kind == Token_Semicolon) {
String p = token_to_string(token);
syntax_error(token_end_of_line(f, f->prev_token), "Expected a comma, got a %.*s", LIT(p));
advance_token(f);
return true;
}
return false;
}
Ast *parse_struct_field_list(AstFile *f, isize *name_count_) {
Token start_token = f->curr_token;
auto decls = array_make<Ast *>(heap_allocator());
isize total_name_count = 0;
Ast *params = parse_field_list(f, &total_name_count, FieldFlag_Struct, Token_CloseBrace, false, false);
if (name_count_) *name_count_ = total_name_count;
return params;
}
// Returns true if any are polymorphic names
bool check_procedure_name_list(Array<Ast *> const &names) {
if (names.count == 0) {
return false;
}
bool first_is_polymorphic = names[0]->kind == Ast_PolyType;
bool any_polymorphic_names = first_is_polymorphic;
for (isize i = 1; i < names.count; i++) {
Ast *name = names[i];
if (first_is_polymorphic) {
if (name->kind == Ast_PolyType) {
any_polymorphic_names = true;
} else {
syntax_error(name, "Mixture of polymorphic and non-polymorphic identifiers");
return any_polymorphic_names;
}
} else {
if (name->kind == Ast_PolyType) {
any_polymorphic_names = true;
syntax_error(name, "Mixture of polymorphic and non-polymorphic identifiers");
return any_polymorphic_names;
} else {
// Okay
}
}
}
return any_polymorphic_names;
}
Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, TokenKind follow, bool allow_default_parameters, bool allow_typeid_token) {
Token start_token = f->curr_token;
CommentGroup *docs = f->lead_comment;
auto params = array_make<Ast *>(heap_allocator());
auto list = array_make<AstAndFlags>(heap_allocator());
defer (array_free(&list));
bool allow_poly_names = allow_typeid_token;
isize total_name_count = 0;
bool allow_ellipsis = allowed_flags&FieldFlag_ellipsis;
bool seen_ellipsis = false;
bool is_signature = (allowed_flags & FieldFlag_Signature) == FieldFlag_Signature;
while (f->curr_token.kind != follow &&
f->curr_token.kind != Token_Colon &&
f->curr_token.kind != Token_EOF) {
u32 flags = parse_field_prefixes(f);
Ast *param = parse_var_type(f, allow_ellipsis, allow_typeid_token);
if (param->kind == Ast_Ellipsis) {
if (seen_ellipsis) syntax_error(param, "Extra variadic parameter after ellipsis");
seen_ellipsis = true;
} else if (seen_ellipsis) {
syntax_error(param, "Extra parameter after ellipsis");
}
AstAndFlags naf = {param, flags};
array_add(&list, naf);
if (!allow_token(f, Token_Comma)) {
break;
}
}
if (f->curr_token.kind == Token_Colon) {
Array<Ast *> names = convert_to_ident_list(f, list, true, allow_poly_names); // Copy for semantic reasons
if (names.count == 0) {
syntax_error(f->curr_token, "Empty field declaration");
}
bool any_polymorphic_names = check_procedure_name_list(names);
u32 set_flags = 0;
if (list.count > 0) {
set_flags = list[0].flags;
}
set_flags = check_field_prefixes(f, names.count, allowed_flags, set_flags);
total_name_count += names.count;
Ast *type = nullptr;
Ast *default_value = nullptr;
Token tag = {};
expect_token_after(f, Token_Colon, "field list");
if (f->curr_token.kind != Token_Eq) {
type = parse_var_type(f, allow_ellipsis, allow_typeid_token);
Ast *tt = unparen_expr(type);
if (tt == nullptr) {
syntax_error(f->prev_token, "Invalid type expression in field list");
} else if (is_signature && !any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) {
syntax_error(type, "Specialization of typeid is not allowed without polymorphic names");
}
}
if (allow_token(f, Token_Eq)) {
default_value = parse_expr(f, false);
if (!allow_default_parameters) {
syntax_error(f->curr_token, "Default parameters are only allowed for procedures");
default_value = nullptr;
}
}
if (default_value != nullptr && names.count > 1) {
syntax_error(f->curr_token, "Default parameters can only be applied to single values");
}
if (allowed_flags == FieldFlag_Struct && default_value != nullptr) {
syntax_error(default_value, "Default parameters are not allowed for structs");
default_value = nullptr;
}
if (type != nullptr && type->kind == Ast_Ellipsis) {
if (seen_ellipsis) syntax_error(type, "Extra variadic parameter after ellipsis");
seen_ellipsis = true;
if (names.count != 1) {
syntax_error(type, "Variadic parameters can only have one field name");
}
} else if (seen_ellipsis && default_value == nullptr) {
syntax_error(f->curr_token, "Extra parameter after ellipsis without a default value");
}
if (type != nullptr && default_value == nullptr) {
if (f->curr_token.kind == Token_String) {
tag = expect_token(f, Token_String);
if ((allowed_flags & FieldFlag_Tags) == 0) {
syntax_error(tag, "Field tags are only allowed within structures");
}
}
}
parse_expect_field_separator(f, type);
Ast *param = ast_field(f, names, type, default_value, set_flags, tag, docs, f->line_comment);
array_add(¶ms, param);
while (f->curr_token.kind != follow &&
f->curr_token.kind != Token_EOF) {
CommentGroup *docs = f->lead_comment;
u32 set_flags = parse_field_prefixes(f);
Token tag = {};
Array<Ast *> names = parse_ident_list(f, allow_poly_names);
if (names.count == 0) {
syntax_error(f->curr_token, "Empty field declaration");
break;
}
bool any_polymorphic_names = check_procedure_name_list(names);
set_flags = check_field_prefixes(f, names.count, allowed_flags, set_flags);
total_name_count += names.count;
Ast *type = nullptr;
Ast *default_value = nullptr;
expect_token_after(f, Token_Colon, "field list");
if (f->curr_token.kind != Token_Eq) {
type = parse_var_type(f, allow_ellipsis, allow_typeid_token);
Ast *tt = unparen_expr(type);
if (is_signature && !any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) {
syntax_error(type, "Specialization of typeid is not allowed without polymorphic names");
}
}
if (allow_token(f, Token_Eq)) {
default_value = parse_expr(f, false);
if (!allow_default_parameters) {
syntax_error(f->curr_token, "Default parameters are only allowed for procedures");
default_value = nullptr;
}
}
if (default_value != nullptr && names.count > 1) {
syntax_error(f->curr_token, "Default parameters can only be applied to single values");
}
if (type != nullptr && type->kind == Ast_Ellipsis) {
if (seen_ellipsis) syntax_error(type, "Extra variadic parameter after ellipsis");
seen_ellipsis = true;
if (names.count != 1) {
syntax_error(type, "Variadic parameters can only have one field name");
}
} else if (seen_ellipsis && default_value == nullptr) {
syntax_error(f->curr_token, "Extra parameter after ellipsis without a default value");
}
if (type != nullptr && default_value == nullptr) {
if (f->curr_token.kind == Token_String) {
tag = expect_token(f, Token_String);
if ((allowed_flags & FieldFlag_Tags) == 0) {
syntax_error(tag, "Field tags are only allowed within structures");
}
}
}
bool ok = parse_expect_field_separator(f, param);
Ast *param = ast_field(f, names, type, default_value, set_flags, tag, docs, f->line_comment);
array_add(¶ms, param);
if (!ok) {
break;
}
}
if (name_count_) *name_count_ = total_name_count;
return ast_field_list(f, start_token, params);
}
for_array(i, list) {
Ast *type = list[i].node;
Token token = blank_token;
if (allowed_flags&FieldFlag_Results) {
// NOTE(bill): Make this nothing and not `_`
token.string = str_lit("");
}
auto names = array_make<Ast *>(heap_allocator(), 1);
token.pos = ast_token(type).pos;
names[0] = ast_ident(f, token);
u32 flags = check_field_prefixes(f, list.count, allowed_flags, list[i].flags);
Token tag = {};
Ast *param = ast_field(f, names, list[i].node, nullptr, flags, tag, docs, f->line_comment);
array_add(¶ms, param);
}
if (name_count_) *name_count_ = total_name_count;
return ast_field_list(f, start_token, params);
}
Ast *parse_type_or_ident(AstFile *f) {
bool prev_allow_type = f->allow_type;
isize prev_expr_level = f->expr_level;
defer ({
f->allow_type = prev_allow_type;
f->expr_level = prev_expr_level;
});
f->allow_type = true;
f->expr_level = -1;
bool lhs = true;
Ast *operand = parse_operand(f, lhs);
Ast *type = parse_atom_expr(f, operand, lhs);
return type;
}
Ast *parse_body(AstFile *f) {
Array<Ast *> stmts = {};
Token open, close;
isize prev_expr_level = f->expr_level;
// NOTE(bill): The body may be within an expression so reset to zero
f->expr_level = 0;
open = expect_token(f, Token_OpenBrace);
stmts = parse_stmt_list(f);
close = expect_token(f, Token_CloseBrace);
f->expr_level = prev_expr_level;
return ast_block_stmt(f, stmts, open, close);
}
bool parse_control_statement_semicolon_separator(AstFile *f) {
Token tok = peek_token(f);
if (tok.kind != Token_OpenBrace) {
return allow_token(f, Token_Semicolon);
}
if (f->curr_token.string == ";") {
return allow_token(f, Token_Semicolon);
}
return false;
}
Ast *parse_if_stmt(AstFile *f) {
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use an if statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
Token token = expect_token(f, Token_if);
Ast *init = nullptr;
Ast *cond = nullptr;
Ast *body = nullptr;
Ast *else_stmt = nullptr;
isize prev_level = f->expr_level;
f->expr_level = -1;
bool prev_allow_in_expr = f->allow_in_expr;
f->allow_in_expr = true;
if (allow_token(f, Token_Semicolon)) {
cond = parse_expr(f, false);
} else {
init = parse_simple_stmt(f, StmtAllowFlag_None);
if (parse_control_statement_semicolon_separator(f)) {
cond = parse_expr(f, false);
} else {
cond = convert_stmt_to_expr(f, init, str_lit("boolean expression"));
init = nullptr;
}
}
f->expr_level = prev_level;
f->allow_in_expr = prev_allow_in_expr;
if (cond == nullptr) {
syntax_error(f->curr_token, "Expected condition for if statement");
}
if (allow_token(f, Token_do)) {
body = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(cond, body)) {
syntax_error(body, "The body of a 'do' be on the same line as if condition");
}
} else {
body = parse_block_stmt(f, false);
}
skip_possible_newline_for_literal(f);
if (f->curr_token.kind == Token_else) {
Token else_token = expect_token(f, Token_else);
switch (f->curr_token.kind) {
case Token_if:
else_stmt = parse_if_stmt(f);
break;
case Token_OpenBrace:
else_stmt = parse_block_stmt(f, false);
break;
case Token_do: {
expect_token(f, Token_do);
else_stmt = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(else_stmt, "'do' has been disallowed");
} else if (!ast_on_same_line(else_token, else_stmt)) {
syntax_error(else_stmt, "The body of a 'do' be on the same line as 'else'");
}
} break;
default:
syntax_error(f->curr_token, "Expected if statement block statement");
else_stmt = ast_bad_stmt(f, f->curr_token, f->tokens[f->curr_token_index+1]);
break;
}
}
return ast_if_stmt(f, token, init, cond, body, else_stmt);
}
Ast *parse_when_stmt(AstFile *f) {
Token token = expect_token(f, Token_when);
Ast *cond = nullptr;
Ast *body = nullptr;
Ast *else_stmt = nullptr;
isize prev_level = f->expr_level;
f->expr_level = -1;
cond = parse_expr(f, false);
f->expr_level = prev_level;
if (cond == nullptr) {
syntax_error(f->curr_token, "Expected condition for when statement");
}
if (allow_token(f, Token_do)) {
body = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(cond, body)) {
syntax_error(body, "The body of a 'do' be on the same line as when statement");
}
} else {
body = parse_block_stmt(f, true);
}
skip_possible_newline_for_literal(f);
if (f->curr_token.kind == Token_else) {
Token else_token = expect_token(f, Token_else);
switch (f->curr_token.kind) {
case Token_when:
else_stmt = parse_when_stmt(f);
break;
case Token_OpenBrace:
else_stmt = parse_block_stmt(f, true);
break;
case Token_do: {
expect_token(f, Token_do);
else_stmt = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(else_stmt, "'do' has been disallowed");
} else if (!ast_on_same_line(else_token, else_stmt)) {
syntax_error(else_stmt, "The body of a 'do' be on the same line as 'else'");
}
} break;
default:
syntax_error(f->curr_token, "Expected when statement block statement");
else_stmt = ast_bad_stmt(f, f->curr_token, f->tokens[f->curr_token_index+1]);
break;
}
}
return ast_when_stmt(f, token, cond, body, else_stmt);
}
Ast *parse_return_stmt(AstFile *f) {
Token token = expect_token(f, Token_return);
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a return statement in the file scope");
return ast_bad_stmt(f, token, f->curr_token);
}
if (f->expr_level > 0) {
syntax_error(f->curr_token, "You cannot use a return statement within an expression");
return ast_bad_stmt(f, token, f->curr_token);
}
auto results = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_Semicolon && f->curr_token.kind != Token_CloseBrace) {
Ast *arg = parse_expr(f, false);
array_add(&results, arg);
if (f->curr_token.kind != Token_Comma ||
f->curr_token.kind == Token_EOF) {
break;
}
advance_token(f);
}
Ast *end = nullptr;
if (results.count > 0) {
end = results[results.count-1];
}
expect_semicolon(f, end);
return ast_return_stmt(f, token, results);
}
Ast *parse_for_stmt(AstFile *f) {
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a for statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
Token token = expect_token(f, Token_for);
Ast *init = nullptr;
Ast *cond = nullptr;
Ast *post = nullptr;
Ast *body = nullptr;
bool is_range = false;
if (f->curr_token.kind != Token_OpenBrace &&
f->curr_token.kind != Token_do) {
isize prev_level = f->expr_level;
defer (f->expr_level = prev_level);
f->expr_level = -1;
if (f->curr_token.kind == Token_in) {
Token in_token = expect_token(f, Token_in);
Ast *rhs = nullptr;
bool prev_allow_range = f->allow_range;
f->allow_range = true;
rhs = parse_expr(f, false);
f->allow_range = prev_allow_range;
if (allow_token(f, Token_do)) {
body = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(token, body)) {
syntax_error(body, "The body of a 'do' be on the same line as the 'for' token");
}
} else {
body = parse_block_stmt(f, false);
}
return ast_range_stmt(f, token, {}, in_token, rhs, body);
}
if (f->curr_token.kind != Token_Semicolon) {
cond = parse_simple_stmt(f, StmtAllowFlag_In);
if (cond->kind == Ast_AssignStmt && cond->AssignStmt.op.kind == Token_in) {
is_range = true;
}
}
if (!is_range && parse_control_statement_semicolon_separator(f)) {
init = cond;
cond = nullptr;
if (f->curr_token.kind == Token_OpenBrace || f->curr_token.kind == Token_do) {
syntax_error(f->curr_token, "Expected ';', followed by a condition expression and post statement, got %.*s", LIT(token_strings[f->curr_token.kind]));
} else {
if (f->curr_token.kind != Token_Semicolon) {
cond = parse_simple_stmt(f, StmtAllowFlag_None);
}
if (f->curr_token.string != ";") {
syntax_error(f->curr_token, "Expected ';', got %.*s", LIT(token_to_string(f->curr_token)));
} else {
expect_token(f, Token_Semicolon);
}
if (f->curr_token.kind != Token_OpenBrace &&
f->curr_token.kind != Token_do) {
post = parse_simple_stmt(f, StmtAllowFlag_None);
}
}
}
}
if (allow_token(f, Token_do)) {
body = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(token, body)) {
syntax_error(body, "The body of a 'do' be on the same line as the 'for' token");
}
} else {
body = parse_block_stmt(f, false);
}
if (is_range) {
GB_ASSERT(cond->kind == Ast_AssignStmt);
Token in_token = cond->AssignStmt.op;
Slice<Ast *> vals = cond->AssignStmt.lhs;
Ast *rhs = nullptr;
if (cond->AssignStmt.rhs.count > 0) {
rhs = cond->AssignStmt.rhs[0];
}
return ast_range_stmt(f, token, vals, in_token, rhs, body);
}
cond = convert_stmt_to_expr(f, cond, str_lit("boolean expression"));
return ast_for_stmt(f, token, init, cond, post, body);
}
Ast *parse_case_clause(AstFile *f, bool is_type) {
Token token = f->curr_token;
Array<Ast *> list = {};
expect_token(f, Token_case);
bool prev_allow_range = f->allow_range;
bool prev_allow_in_expr = f->allow_in_expr;
f->allow_range = !is_type;
f->allow_in_expr = !is_type;
if (f->curr_token.kind != Token_Colon) {
list = parse_rhs_expr_list(f);
}
f->allow_range = prev_allow_range;
f->allow_in_expr = prev_allow_in_expr;
expect_token(f, Token_Colon);
Array<Ast *> stmts = parse_stmt_list(f);
return ast_case_clause(f, token, list, stmts);
}
Ast *parse_switch_stmt(AstFile *f) {
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a switch statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
Token token = expect_token(f, Token_switch);
Ast *init = nullptr;
Ast *tag = nullptr;
Ast *body = nullptr;
Token open, close;
bool is_type_switch = false;
auto list = array_make<Ast *>(heap_allocator());
if (f->curr_token.kind != Token_OpenBrace) {
isize prev_level = f->expr_level;
f->expr_level = -1;
defer (f->expr_level = prev_level);
if (allow_token(f, Token_in)) {
auto lhs = array_make<Ast *>(heap_allocator(), 0, 1);
auto rhs = array_make<Ast *>(heap_allocator(), 0, 1);
Token blank_ident = token;
blank_ident.kind = Token_Ident;
blank_ident.string = str_lit("_");
Ast *blank = ast_ident(f, blank_ident);
array_add(&lhs, blank);
array_add(&rhs, parse_expr(f, true));
tag = ast_assign_stmt(f, token, lhs, rhs);
is_type_switch = true;
} else {
tag = parse_simple_stmt(f, StmtAllowFlag_In);
if (tag->kind == Ast_AssignStmt && tag->AssignStmt.op.kind == Token_in) {
is_type_switch = true;
} else if (parse_control_statement_semicolon_separator(f)) {
init = tag;
tag = nullptr;
if (f->curr_token.kind != Token_OpenBrace) {
tag = parse_simple_stmt(f, StmtAllowFlag_None);
}
}
}
}
skip_possible_newline(f);
open = expect_token(f, Token_OpenBrace);
while (f->curr_token.kind == Token_case) {
array_add(&list, parse_case_clause(f, is_type_switch));
}
close = expect_token(f, Token_CloseBrace);
body = ast_block_stmt(f, list, open, close);
if (is_type_switch) {
return ast_type_switch_stmt(f, token, tag, body);
}
tag = convert_stmt_to_expr(f, tag, str_lit("switch expression"));
return ast_switch_stmt(f, token, init, tag, body);
}
Ast *parse_defer_stmt(AstFile *f) {
if (f->curr_proc == nullptr) {
syntax_error(f->curr_token, "You cannot use a defer statement in the file scope");
return ast_bad_stmt(f, f->curr_token, f->curr_token);
}
Token token = expect_token(f, Token_defer);
Ast *stmt = parse_stmt(f);
switch (stmt->kind) {
case Ast_EmptyStmt:
syntax_error(token, "Empty statement after defer (e.g. ';')");
break;
case Ast_DeferStmt:
syntax_error(token, "You cannot defer a defer statement");
stmt = stmt->DeferStmt.stmt;
break;
case Ast_ReturnStmt:
syntax_error(token, "You cannot defer a return statement");
break;
}
return ast_defer_stmt(f, token, stmt);
}
enum ImportDeclKind {
ImportDecl_Standard,
ImportDecl_Using,
};
Ast *parse_import_decl(AstFile *f, ImportDeclKind kind) {
CommentGroup *docs = f->lead_comment;
Token token = expect_token(f, Token_import);
Token import_name = {};
bool is_using = kind != ImportDecl_Standard;
switch (f->curr_token.kind) {
case Token_Ident:
import_name = advance_token(f);
break;
default:
import_name.pos = f->curr_token.pos;
break;
}
if (!is_using && is_blank_ident(import_name)) {
syntax_error(import_name, "Illegal import name: '_'");
}
Token file_path = expect_token_after(f, Token_String, "import");
Ast *s = nullptr;
if (f->curr_proc != nullptr) {
syntax_error(import_name, "You cannot use 'import' within a procedure. This must be done at the file scope");
s = ast_bad_decl(f, import_name, file_path);
} else {
s = ast_import_decl(f, token, is_using, file_path, import_name, docs, f->line_comment);
array_add(&f->imports, s);
}
if (is_using) {
syntax_error(import_name, "'using import' is not allowed, please use the import name explicitly");
}
expect_semicolon(f, s);
return s;
}
Ast *parse_foreign_decl(AstFile *f) {
CommentGroup *docs = f->lead_comment;
Token token = expect_token(f, Token_foreign);
switch (f->curr_token.kind) {
case Token_Ident:
case Token_OpenBrace:
return parse_foreign_block(f, token);
case Token_import: {
Token import_token = expect_token(f, Token_import);
Token lib_name = {};
switch (f->curr_token.kind) {
case Token_Ident:
lib_name = advance_token(f);
break;
default:
lib_name.pos = token.pos;
break;
}
if (is_blank_ident(lib_name)) {
syntax_error(lib_name, "Illegal foreign import name: '_'");
}
Array<Token> filepaths = {};
if (allow_token(f, Token_OpenBrace)) {
array_init(&filepaths, heap_allocator());
while (f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
Token path = expect_token(f, Token_String);
array_add(&filepaths, path);
if (!allow_token(f, Token_Comma)) {
break;
}
}
expect_token(f, Token_CloseBrace);
} else {
filepaths = array_make<Token>(heap_allocator(), 0, 1);
Token path = expect_token(f, Token_String);
array_add(&filepaths, path);
}
Ast *s = nullptr;
if (filepaths.count == 0) {
syntax_error(lib_name, "foreign import without any paths");
s = ast_bad_decl(f, lib_name, f->curr_token);
} else if (f->curr_proc != nullptr) {
syntax_error(lib_name, "You cannot use foreign import within a procedure. This must be done at the file scope");
s = ast_bad_decl(f, lib_name, filepaths[0]);
} else {
s = ast_foreign_import_decl(f, token, filepaths, lib_name, docs, f->line_comment);
}
expect_semicolon(f, s);
return s;
}
}
syntax_error(token, "Invalid foreign declaration");
return ast_bad_decl(f, token, f->curr_token);
}
Ast *parse_attribute(AstFile *f, Token token, TokenKind open_kind, TokenKind close_kind) {
Array<Ast *> elems = {};
Token open = {};
Token close = {};
if (f->curr_token.kind == Token_Ident) {
elems = array_make<Ast *>(heap_allocator(), 0, 1);
Ast *elem = parse_ident(f);
array_add(&elems, elem);
} else {
open = expect_token(f, open_kind);
f->expr_level++;
if (f->curr_token.kind != close_kind) {
elems = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != close_kind &&
f->curr_token.kind != Token_EOF) {
Ast *elem = nullptr;
elem = parse_ident(f);
if (f->curr_token.kind == Token_Eq) {
Token eq = expect_token(f, Token_Eq);
Ast *value = parse_value(f);
elem = ast_field_value(f, elem, value, eq);
}
array_add(&elems, elem);
if (!allow_token(f, Token_Comma)) {
break;
}
}
}
f->expr_level--;
close = expect_closing(f, close_kind, str_lit("attribute"));
}
Ast *attribute = ast_attribute(f, token, open, close, elems);
skip_possible_newline(f);
Ast *decl = parse_stmt(f);
if (decl->kind == Ast_ValueDecl) {
array_add(&decl->ValueDecl.attributes, attribute);
} else if (decl->kind == Ast_ForeignBlockDecl) {
array_add(&decl->ForeignBlockDecl.attributes, attribute);
} else if (decl->kind == Ast_ForeignImportDecl) {
array_add(&decl->ForeignImportDecl.attributes, attribute);
}else {
syntax_error(decl, "Expected a value or foreign declaration after an attribute, got %.*s", LIT(ast_strings[decl->kind]));
return ast_bad_stmt(f, token, f->curr_token);
}
return decl;
}
Ast *parse_unrolled_for_loop(AstFile *f, Token unroll_token) {
Token for_token = expect_token(f, Token_for);
Ast *val0 = nullptr;
Ast *val1 = nullptr;
Token in_token = {};
Ast *expr = nullptr;
Ast *body = nullptr;
bool bad_stmt = false;
if (f->curr_token.kind != Token_in) {
Array<Ast *> idents = parse_ident_list(f, false);
switch (idents.count) {
case 1:
val0 = idents[0];
break;
case 2:
val0 = idents[0];
val1 = idents[1];
break;
default:
syntax_error(for_token, "Expected either 1 or 2 identifiers");
bad_stmt = true;
break;
}
}
in_token = expect_token(f, Token_in);
bool prev_allow_range = f->allow_range;
isize prev_level = f->expr_level;
f->allow_range = true;
f->expr_level = -1;
expr = parse_expr(f, false);
f->expr_level = prev_level;
f->allow_range = prev_allow_range;
if (allow_token(f, Token_do)) {
body = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(body, "'do' has been disallowed");
} else if (!ast_on_same_line(for_token, body)) {
syntax_error(body, "The body of a 'do' be on the same line as the 'for' token");
}
} else {
body = parse_block_stmt(f, false);
}
if (bad_stmt) {
return ast_bad_stmt(f, unroll_token, f->curr_token);
}
return ast_unroll_range_stmt(f, unroll_token, for_token, val0, val1, in_token, expr, body);
}
Ast *parse_stmt(AstFile *f) {
Ast *s = nullptr;
Token token = f->curr_token;
switch (token.kind) {
// Operands
case Token_context: // Also allows for `context =`
case Token_proc:
case Token_Ident:
case Token_Integer:
case Token_Float:
case Token_Imag:
case Token_Rune:
case Token_String:
case Token_OpenParen:
case Token_Pointer:
case Token_asm: // Inline assembly
// Unary Operators
case Token_Add:
case Token_Sub:
case Token_Xor:
case Token_Not:
case Token_And:
s = parse_simple_stmt(f, StmtAllowFlag_Label);
expect_semicolon(f, s);
return s;
case Token_foreign:
return parse_foreign_decl(f);
case Token_import:
return parse_import_decl(f, ImportDecl_Standard);
case Token_if: return parse_if_stmt(f);
case Token_when: return parse_when_stmt(f);
case Token_for: return parse_for_stmt(f);
case Token_switch: return parse_switch_stmt(f);
case Token_defer: return parse_defer_stmt(f);
case Token_return: return parse_return_stmt(f);
case Token_break:
case Token_continue:
case Token_fallthrough: {
Token token = advance_token(f);
Ast *label = nullptr;
if (token.kind != Token_fallthrough &&
f->curr_token.kind == Token_Ident) {
label = parse_ident(f);
}
s = ast_branch_stmt(f, token, label);
expect_semicolon(f, s);
return s;
}
case Token_using: {
CommentGroup *docs = f->lead_comment;
Token token = expect_token(f, Token_using);
if (f->curr_token.kind == Token_import) {
return parse_import_decl(f, ImportDecl_Using);
}
Ast *decl = nullptr;
Array<Ast *> list = parse_lhs_expr_list(f);
if (list.count == 0) {
syntax_error(token, "Illegal use of 'using' statement");
expect_semicolon(f, nullptr);
return ast_bad_stmt(f, token, f->curr_token);
}
if (f->curr_token.kind != Token_Colon) {
expect_semicolon(f, list[list.count-1]);
return ast_using_stmt(f, token, list);
}
expect_token_after(f, Token_Colon, "identifier list");
decl = parse_value_decl(f, list, docs);
if (decl != nullptr && decl->kind == Ast_ValueDecl) {
decl->ValueDecl.is_using = true;
return decl;
}
syntax_error(token, "Illegal use of 'using' statement");
return ast_bad_stmt(f, token, f->curr_token);
} break;
case Token_At: {
Token token = expect_token(f, Token_At);
return parse_attribute(f, token, Token_OpenParen, Token_CloseParen);
}
case Token_Hash: {
Ast *s = nullptr;
Token hash_token = expect_token(f, Token_Hash);
Token name = expect_token(f, Token_Ident);
String tag = name.string;
if (tag == "bounds_check") {
s = parse_stmt(f);
return parse_check_directive_for_statement(s, name, StateFlag_bounds_check);
} else if (tag == "no_bounds_check") {
s = parse_stmt(f);
return parse_check_directive_for_statement(s, name, StateFlag_no_bounds_check);
} else if (tag == "type_assert") {
s = parse_stmt(f);
return parse_check_directive_for_statement(s, name, StateFlag_type_assert);
} else if (tag == "no_type_assert") {
s = parse_stmt(f);
return parse_check_directive_for_statement(s, name, StateFlag_no_type_assert);
} else if (tag == "partial") {
s = parse_stmt(f);
switch (s->kind) {
case Ast_SwitchStmt:
s->SwitchStmt.partial = true;
break;
case Ast_TypeSwitchStmt:
s->TypeSwitchStmt.partial = true;
break;
case Ast_EmptyStmt:
return parse_check_directive_for_statement(s, name, 0);
default:
syntax_error(token, "#partial can only be applied to a switch statement");
break;
}
return s;
} else if (tag == "assert" || tag == "panic") {
Ast *t = ast_basic_directive(f, hash_token, name);
Ast *stmt = ast_expr_stmt(f, parse_call_expr(f, t));
expect_semicolon(f, stmt);
return stmt;
} else if (name.string == "force_inline" ||
name.string == "force_no_inline") {
Ast *expr = parse_force_inlining_operand(f, name);
Ast *stmt = ast_expr_stmt(f, expr);
expect_semicolon(f, stmt);
return stmt;
} else if (tag == "unroll") {
return parse_unrolled_for_loop(f, name);
} else if (tag == "include") {
syntax_error(token, "#include is not a valid import declaration kind. Did you mean 'import'?");
s = ast_bad_stmt(f, token, f->curr_token);
} else {
syntax_error(token, "Unknown tag directive used: '%.*s'", LIT(tag));
s = ast_bad_stmt(f, token, f->curr_token);
}
fix_advance_to_next_stmt(f);
return s;
} break;
case Token_OpenBrace:
return parse_block_stmt(f, false);
case Token_Semicolon:
s = ast_empty_stmt(f, token);
expect_semicolon(f, nullptr);
return s;
}
// Error correction statements
switch (token.kind) {
case Token_else:
expect_token(f, Token_else);
syntax_error(token, "'else' unattached to an 'if' statement");
switch (f->curr_token.kind) {
case Token_if:
return parse_if_stmt(f);
case Token_when:
return parse_when_stmt(f);
case Token_OpenBrace:
return parse_block_stmt(f, true);
case Token_do: {
expect_token(f, Token_do);
Ast *stmt = convert_stmt_to_body(f, parse_stmt(f));
if (build_context.disallow_do) {
syntax_error(stmt, "'do' has been disallowed");
}
return stmt;
} break;
default:
fix_advance_to_next_stmt(f);
return ast_bad_stmt(f, token, f->curr_token);
}
}
syntax_error(token, "Expected a statement, got '%.*s'", LIT(token_strings[token.kind]));
fix_advance_to_next_stmt(f);
return ast_bad_stmt(f, token, f->curr_token);
}
Array<Ast *> parse_stmt_list(AstFile *f) {
auto list = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_case &&
f->curr_token.kind != Token_CloseBrace &&
f->curr_token.kind != Token_EOF) {
Ast *stmt = parse_stmt(f);
if (stmt && stmt->kind != Ast_EmptyStmt) {
array_add(&list, stmt);
if (stmt->kind == Ast_ExprStmt &&
stmt->ExprStmt.expr != nullptr &&
stmt->ExprStmt.expr->kind == Ast_ProcLit) {
syntax_error(stmt, "Procedure literal evaluated but not used");
}
}
}
return list;
}
ParseFileError init_ast_file(AstFile *f, String fullpath, TokenPos *err_pos) {
GB_ASSERT(f != nullptr);
f->fullpath = string_trim_whitespace(fullpath); // Just in case
set_file_path_string(f->id, fullpath);
thread_safe_set_ast_file_from_id(f->id, f);
if (!string_ends_with(f->fullpath, str_lit(".odin"))) {
return ParseFile_WrongExtension;
}
zero_item(&f->tokenizer);
f->tokenizer.curr_file_id = f->id;
TokenizerInitError err = init_tokenizer_from_fullpath(&f->tokenizer, f->fullpath, build_context.copy_file_contents);
if (err != TokenizerInit_None) {
switch (err) {
case TokenizerInit_Empty:
break;
case TokenizerInit_NotExists:
return ParseFile_NotFound;
case TokenizerInit_Permission:
return ParseFile_Permission;
case TokenizerInit_FileTooLarge:
return ParseFile_FileTooLarge;
default:
return ParseFile_InvalidFile;
}
}
isize file_size = f->tokenizer.end - f->tokenizer.start;
// NOTE(bill): Determine allocation size required for tokens
isize token_cap = file_size/3ll;
isize pow2_cap = gb_max(cast(isize)prev_pow2(cast(i64)token_cap)/2, 16);
token_cap = ((token_cap + pow2_cap-1)/pow2_cap) * pow2_cap;
isize init_token_cap = gb_max(token_cap, 16);
array_init(&f->tokens, heap_allocator(), 0, gb_max(init_token_cap, 16));
if (err == TokenizerInit_Empty) {
Token token = {Token_EOF};
token.pos.file_id = f->id;
token.pos.line = 1;
token.pos.column = 1;
array_add(&f->tokens, token);
return ParseFile_None;
}
u64 start = time_stamp_time_now();
for (;;) {
Token *token = array_add_and_get(&f->tokens);
tokenizer_get_token(&f->tokenizer, token);
if (token->kind == Token_Invalid) {
err_pos->line = token->pos.line;
err_pos->column = token->pos.column;
return ParseFile_InvalidToken;
}
if (token->kind == Token_EOF) {
break;
}
}
u64 end = time_stamp_time_now();
f->time_to_tokenize = cast(f64)(end-start)/cast(f64)time_stamp__freq();
f->prev_token_index = 0;
f->curr_token_index = 0;
f->prev_token = f->tokens[f->prev_token_index];
f->curr_token = f->tokens[f->curr_token_index];
array_init(&f->comments, heap_allocator(), 0, 0);
array_init(&f->imports, heap_allocator(), 0, 0);
f->curr_proc = nullptr;
return ParseFile_None;
}
void destroy_ast_file(AstFile *f) {
GB_ASSERT(f != nullptr);
array_free(&f->tokens);
array_free(&f->comments);
array_free(&f->imports);
}
bool init_parser(Parser *p) {
GB_ASSERT(p != nullptr);
string_set_init(&p->imported_files, heap_allocator());
array_init(&p->packages, heap_allocator());
array_init(&p->package_imports, heap_allocator());
mutex_init(&p->wait_mutex);
mutex_init(&p->import_mutex);
mutex_init(&p->file_add_mutex);
mutex_init(&p->file_decl_mutex);
mutex_init(&p->packages_mutex);
mpmc_init(&p->file_error_queue, heap_allocator(), 1024);
return true;
}
void destroy_parser(Parser *p) {
GB_ASSERT(p != nullptr);
// TODO(bill): Fix memory leak
for_array(i, p->packages) {
AstPackage *pkg = p->packages[i];
for_array(j, pkg->files) {
destroy_ast_file(pkg->files[j]);
}
array_free(&pkg->files);
array_free(&pkg->foreign_files);
}
#if 0
for_array(i, p->package_imports) {
// gb_free(heap_allocator(), p->package_imports[i].text);
}
#endif
array_free(&p->packages);
array_free(&p->package_imports);
string_set_destroy(&p->imported_files);
mutex_destroy(&p->wait_mutex);
mutex_destroy(&p->import_mutex);
mutex_destroy(&p->file_add_mutex);
mutex_destroy(&p->file_decl_mutex);
mutex_destroy(&p->packages_mutex);
mpmc_destroy(&p->file_error_queue);
}
void parser_add_package(Parser *p, AstPackage *pkg) {
mutex_lock(&p->packages_mutex);
pkg->id = p->packages.count+1;
array_add(&p->packages, pkg);
mutex_unlock(&p->packages_mutex);
}
ParseFileError process_imported_file(Parser *p, ImportedFile imported_file);
WORKER_TASK_PROC(parser_worker_proc) {
ParserWorkerData *wd = cast(ParserWorkerData *)data;
ParseFileError err = process_imported_file(wd->parser, wd->imported_file);
if (err != ParseFile_None) {
mpmc_enqueue(&wd->parser->file_error_queue, err);
}
return cast(isize)err;
}
void parser_add_file_to_process(Parser *p, AstPackage *pkg, FileInfo fi, TokenPos pos) {
// TODO(bill): Use a better allocator
ImportedFile f = {pkg, fi, pos, p->file_to_process_count++};
auto wd = gb_alloc_item(permanent_allocator(), ParserWorkerData);
wd->parser = p;
wd->imported_file = f;
global_thread_pool_add_task(parser_worker_proc, wd);
}
WORKER_TASK_PROC(foreign_file_worker_proc) {
ForeignFileWorkerData *wd = cast(ForeignFileWorkerData *)data;
Parser *p = wd->parser;
ImportedFile *imp = &wd->imported_file;
AstPackage *pkg = imp->pkg;
AstForeignFile foreign_file = {wd->foreign_kind};
String fullpath = string_trim_whitespace(imp->fi.fullpath); // Just in case
char *c_str = alloc_cstring(heap_allocator(), fullpath);
defer (gb_free(heap_allocator(), c_str));
gbFileContents fc = gb_file_read_contents(heap_allocator(), true, c_str);
foreign_file.source.text = (u8 *)fc.data;
foreign_file.source.len = fc.size;
switch (wd->foreign_kind) {
case AstForeignFile_S:
// TODO(bill): Actually do something with it
break;
}
mutex_lock(&p->file_add_mutex);
array_add(&pkg->foreign_files, foreign_file);
mutex_unlock(&p->file_add_mutex);
return 0;
}
void parser_add_foreign_file_to_process(Parser *p, AstPackage *pkg, AstForeignFileKind kind, FileInfo fi, TokenPos pos) {
// TODO(bill): Use a better allocator
ImportedFile f = {pkg, fi, pos, p->file_to_process_count++};
auto wd = gb_alloc_item(permanent_allocator(), ForeignFileWorkerData);
wd->parser = p;
wd->imported_file = f;
wd->foreign_kind = kind;
global_thread_pool_add_task(foreign_file_worker_proc, wd);
}
// NOTE(bill): Returns true if it's added
AstPackage *try_add_import_path(Parser *p, String const &path, String const &rel_path, TokenPos pos, PackageKind kind = Package_Normal) {
String const FILE_EXT = str_lit(".odin");
mutex_lock(&p->import_mutex);
defer (mutex_unlock(&p->import_mutex));
if (string_set_exists(&p->imported_files, path)) {
return nullptr;
}
string_set_add(&p->imported_files, path);
AstPackage *pkg = gb_alloc_item(permanent_allocator(), AstPackage);
pkg->kind = kind;
pkg->fullpath = path;
array_init(&pkg->files, heap_allocator());
pkg->foreign_files.allocator = heap_allocator();
// NOTE(bill): Single file initial package
if (kind == Package_Init && string_ends_with(path, FILE_EXT)) {
FileInfo fi = {};
fi.name = filename_from_path(path);
fi.fullpath = path;
fi.size = get_file_size(path);
fi.is_dir = false;
pkg->is_single_file = true;
parser_add_file_to_process(p, pkg, fi, pos);
parser_add_package(p, pkg);
return pkg;
}
Array<FileInfo> list = {};
ReadDirectoryError rd_err = read_directory(path, &list);
defer (array_free(&list));
if (list.count == 1) {
GB_ASSERT(path != list[0].fullpath);
}
switch (rd_err) {
case ReadDirectory_InvalidPath:
syntax_error(pos, "Invalid path: %.*s", LIT(rel_path));
return nullptr;
case ReadDirectory_NotExists:
syntax_error(pos, "Path does not exist: %.*s", LIT(rel_path));
return nullptr;
case ReadDirectory_Permission:
syntax_error(pos, "Unknown error whilst reading path %.*s", LIT(rel_path));
return nullptr;
case ReadDirectory_NotDir:
syntax_error(pos, "Expected a directory for a package, got a file: %.*s", LIT(rel_path));
return nullptr;
case ReadDirectory_Empty:
syntax_error(pos, "Empty directory: %.*s", LIT(rel_path));
return nullptr;
case ReadDirectory_Unknown:
syntax_error(pos, "Unknown error whilst reading path %.*s", LIT(rel_path));
return nullptr;
}
for_array(list_index, list) {
FileInfo fi = list[list_index];
String name = fi.name;
String ext = path_extension(name);
if (ext == FILE_EXT) {
if (is_excluded_target_filename(name)) {
continue;
}
parser_add_file_to_process(p, pkg, fi, pos);
} else if (ext == ".S" || ext ==".s") {
if (is_excluded_target_filename(name)) {
continue;
}
parser_add_foreign_file_to_process(p, pkg, AstForeignFile_S, fi, pos);
}
}
parser_add_package(p, pkg);
return pkg;
}
gb_global Rune illegal_import_runes[] = {
'"', '\'', '`',
'\t', '\r', '\n', '\v', '\f',
'\\', // NOTE(bill): Disallow windows style filepaths
'!', '$', '%', '^', '&', '*', '(', ')', '=',
'[', ']', '{', '}',
';',
':', // NOTE(bill): Disallow windows style absolute filepaths
'#',
'|', ',', '<', '>', '?',
};
bool is_import_path_valid(String path) {
if (path.len > 0) {
u8 *start = path.text;
u8 *end = path.text + path.len;
u8 *curr = start;
while (curr < end) {
isize width = 1;
Rune r = *curr;
if (r >= 0x80) {
width = utf8_decode(curr, end-curr, &r);
if (r == GB_RUNE_INVALID && width == 1) {
return false;
}
else if (r == GB_RUNE_BOM && curr-start > 0) {
return false;
}
}
for (isize i = 0; i < gb_count_of(illegal_import_runes); i++) {
if (r == illegal_import_runes[i]) {
return false;
}
}
curr += width;
}
return true;
}
return false;
}
bool is_build_flag_path_valid(String path) {
if (path.len > 0) {
u8 *start = path.text;
u8 *end = path.text + path.len;
u8 *curr = start;
isize index = 0;
while (curr < end) {
isize width = 1;
Rune r = *curr;
if (r >= 0x80) {
width = utf8_decode(curr, end-curr, &r);
if (r == GB_RUNE_INVALID && width == 1) {
return false;
}
else if (r == GB_RUNE_BOM && curr-start > 0) {
return false;
}
}
for (isize i = 0; i < gb_count_of(illegal_import_runes); i++) {
#if defined(GB_SYSTEM_WINDOWS)
if (r == '\\') {
break;
} else if (r == ':') {
break;
}
#endif
if (r == illegal_import_runes[i]) {
return false;
}
}
curr += width;
index += 1;
}
return true;
}
return false;
}
bool is_package_name_reserved(String const &name) {
if (name == "builtin") {
return true;
} else if (name == "intrinsics") {
return true;
}
return false;
}
bool determine_path_from_string(BlockingMutex *file_mutex, Ast *node, String base_dir, String original_string, String *path) {
GB_ASSERT(path != nullptr);
// NOTE(bill): if file_mutex == nullptr, this means that the code is used within the semantics stage
gbAllocator a = heap_allocator();
String collection_name = {};
isize colon_pos = -1;
for (isize j = 0; j < original_string.len; j++) {
if (original_string[j] == ':') {
colon_pos = j;
break;
}
}
bool has_windows_drive = false;
#if defined(GB_SYSTEM_WINDOWS)
if (file_mutex == nullptr) {
if (colon_pos == 1 && original_string.len > 2) {
if (original_string[2] == '/' || original_string[2] == '\\') {
colon_pos = -1;
has_windows_drive = true;
}
}
}
#endif
String file_str = {};
if (colon_pos == 0) {
syntax_error(node, "Expected a collection name");
return false;
}
if (original_string.len > 0 && colon_pos > 0) {
collection_name = substring(original_string, 0, colon_pos);
file_str = substring(original_string, colon_pos+1, original_string.len);
} else {
file_str = original_string;
}
if (has_windows_drive) {
String sub_file_path = substring(file_str, 3, file_str.len);
if (!is_import_path_valid(sub_file_path)) {
syntax_error(node, "Invalid import path: '%.*s'", LIT(file_str));
return false;
}
} else if (!is_import_path_valid(file_str)) {
syntax_error(node, "Invalid import path: '%.*s'", LIT(file_str));
return false;
}
if (collection_name.len > 0) {
if (collection_name == "system") {
if (node->kind != Ast_ForeignImportDecl) {
syntax_error(node, "The library collection 'system' is restrict for 'foreign_library'");
return false;
} else {
*path = file_str;
return true;
}
} else if (!find_library_collection_path(collection_name, &base_dir)) {
// NOTE(bill): It's a naughty name
syntax_error(node, "Unknown library collection: '%.*s'", LIT(collection_name));
return false;
}
} else {
#if !defined(GB_SYSTEM_WINDOWS)
// @NOTE(vassvik): foreign imports of shared libraries that are not in the system collection on
// linux/mac have to be local to the executable for consistency with shared libraries.
// Unix does not have a concept of "import library" for shared/dynamic libraries,
// so we need to pass the relative path to the linker, and add the current
// working directory of the exe to the library search paths.
// Static libraries can be linked directly with the full pathname
//
if (node->kind == Ast_ForeignImportDecl && string_ends_with(file_str, str_lit(".so"))) {
*path = file_str;
return true;
}
#endif
}
if (is_package_name_reserved(file_str)) {
*path = file_str;
if (collection_name == "core") {
return true;
} else {
syntax_error(node, "The package '%.*s' must be imported with the core library collection: 'core:%.*s'", LIT(file_str), LIT(file_str));
return false;
}
}
if (file_mutex) mutex_lock(file_mutex);
defer (if (file_mutex) mutex_unlock(file_mutex));
if (node->kind == Ast_ForeignImportDecl) {
node->ForeignImportDecl.collection_name = collection_name;
}
if (has_windows_drive) {
*path = file_str;
} else {
String fullpath = string_trim_whitespace(get_fullpath_relative(a, base_dir, file_str));
*path = fullpath;
}
return true;
}
void parse_setup_file_decls(Parser *p, AstFile *f, String base_dir, Slice<Ast *> &decls);
void parse_setup_file_when_stmt(Parser *p, AstFile *f, String base_dir, AstWhenStmt *ws) {
if (ws->body != nullptr) {
auto stmts = ws->body->BlockStmt.stmts;
parse_setup_file_decls(p, f, base_dir, stmts);
}
if (ws->else_stmt != nullptr) {
switch (ws->else_stmt->kind) {
case Ast_BlockStmt: {
auto stmts = ws->else_stmt->BlockStmt.stmts;
parse_setup_file_decls(p, f, base_dir, stmts);
} break;
case Ast_WhenStmt:
parse_setup_file_when_stmt(p, f, base_dir, &ws->else_stmt->WhenStmt);
break;
}
}
}
void parse_setup_file_decls(Parser *p, AstFile *f, String base_dir, Slice<Ast *> &decls) {
for_array(i, decls) {
Ast *node = decls[i];
if (!is_ast_decl(node) &&
node->kind != Ast_WhenStmt &&
node->kind != Ast_BadStmt &&
node->kind != Ast_EmptyStmt) {
// NOTE(bill): Sanity check
if (node->kind == Ast_ExprStmt) {
Ast *expr = node->ExprStmt.expr;
if (expr->kind == Ast_CallExpr &&
expr->CallExpr.proc->kind == Ast_BasicDirective) {
f->directive_count += 1;
continue;
}
}
syntax_error(node, "Only declarations are allowed at file scope, got %.*s", LIT(ast_strings[node->kind]));
} else if (node->kind == Ast_ImportDecl) {
ast_node(id, ImportDecl, node);
String original_string = string_trim_whitespace(string_value_from_token(f, id->relpath));
String import_path = {};
bool ok = determine_path_from_string(&p->file_decl_mutex, node, base_dir, original_string, &import_path);
if (!ok) {
decls[i] = ast_bad_decl(f, id->relpath, id->relpath);
continue;
}
import_path = string_trim_whitespace(import_path);
id->fullpath = import_path;
if (is_package_name_reserved(import_path)) {
continue;
}
try_add_import_path(p, import_path, original_string, ast_token(node).pos);
} else if (node->kind == Ast_ForeignImportDecl) {
ast_node(fl, ForeignImportDecl, node);
auto fullpaths = array_make<String>(permanent_allocator(), 0, fl->filepaths.count);
for_array(fp_idx, fl->filepaths) {
String file_str = string_trim_whitespace(string_value_from_token(f, fl->filepaths[fp_idx]));
String fullpath = file_str;
if (allow_check_foreign_filepath()) {
String foreign_path = {};
bool ok = determine_path_from_string(&p->file_decl_mutex, node, base_dir, file_str, &foreign_path);
if (!ok) {
decls[i] = ast_bad_decl(f, fl->filepaths[fp_idx], fl->filepaths[fl->filepaths.count-1]);
goto end;
}
fullpath = foreign_path;
}
array_add(&fullpaths, fullpath);
}
if (fullpaths.count == 0) {
syntax_error(decls[i], "No foreign paths found");
decls[i] = ast_bad_decl(f, fl->filepaths[0], fl->filepaths[fl->filepaths.count-1]);
goto end;
}
fl->fullpaths = slice_from_array(fullpaths);
} else if (node->kind == Ast_WhenStmt) {
ast_node(ws, WhenStmt, node);
parse_setup_file_when_stmt(p, f, base_dir, ws);
}
end:;
}
}
String build_tag_get_token(String s, String *out) {
s = string_trim_whitespace(s);
isize n = 0;
while (n < s.len) {
Rune rune = 0;
isize width = utf8_decode(&s[n], s.len-n, &rune);
if (n == 0 && rune == '!') {
} else if (!rune_is_letter(rune) && !rune_is_digit(rune)) {
isize k = gb_max(gb_max(n, width), 1);
*out = substring(s, k, s.len);
return substring(s, 0, k);
}
n += width;
}
out->len = 0;
return s;
}
bool parse_build_tag(Token token_for_pos, String s) {
String const prefix = str_lit("+build");
GB_ASSERT(string_starts_with(s, prefix));
s = string_trim_whitespace(substring(s, prefix.len, s.len));
if (s.len == 0) {
return true;
}
bool any_correct = false;
while (s.len > 0) {
bool this_kind_correct = true;
do {
String p = string_trim_whitespace(build_tag_get_token(s, &s));
if (p.len == 0) break;
if (p == ",") break;
bool is_notted = false;
if (p[0] == '!') {
is_notted = true;
p = substring(p, 1, p.len);
if (p.len == 0) {
syntax_error(token_for_pos, "Expected a build platform after '!'");
break;
}
}
if (p.len == 0) {
continue;
}
if (p == "ignore") {
this_kind_correct = false;
continue;
}
TargetOsKind os = get_target_os_from_string(p);
TargetArchKind arch = get_target_arch_from_string(p);
if (os != TargetOs_Invalid) {
GB_ASSERT(arch == TargetArch_Invalid);
if (is_notted) {
this_kind_correct = this_kind_correct && (os != build_context.metrics.os);
} else {
this_kind_correct = this_kind_correct && (os == build_context.metrics.os);
}
} else if (arch != TargetArch_Invalid) {
if (is_notted) {
this_kind_correct = this_kind_correct && (arch != build_context.metrics.arch);
} else {
this_kind_correct = this_kind_correct && (arch == build_context.metrics.arch);
}
}
if (os == TargetOs_Invalid && arch == TargetArch_Invalid) {
syntax_error(token_for_pos, "Invalid build tag platform: %.*s", LIT(p));
break;
}
} while (s.len > 0);
any_correct = any_correct || this_kind_correct;
}
return any_correct;
}
String dir_from_path(String path) {
String base_dir = path;
for (isize i = path.len-1; i >= 0; i--) {
if (base_dir[i] == '\\' ||
base_dir[i] == '/') {
break;
}
base_dir.len--;
}
return base_dir;
}
isize calc_decl_count(Ast *decl) {
isize count = 0;
switch (decl->kind) {
case Ast_BlockStmt:
for_array(i, decl->BlockStmt.stmts) {
count += calc_decl_count(decl->BlockStmt.stmts.data[i]);
}
break;
case Ast_WhenStmt:
{
isize inner_count = calc_decl_count(decl->WhenStmt.body);
if (decl->WhenStmt.else_stmt) {
inner_count = gb_max(inner_count, calc_decl_count(decl->WhenStmt.else_stmt));
}
count += inner_count;
}
break;
case Ast_ValueDecl:
count = decl->ValueDecl.names.count;
break;
case Ast_ForeignBlockDecl:
count = calc_decl_count(decl->ForeignBlockDecl.body);
break;
case Ast_ImportDecl:
case Ast_ForeignImportDecl:
count = 1;
break;
}
return count;
}
bool parse_file(Parser *p, AstFile *f) {
if (f->tokens.count == 0) {
return true;
}
if (f->tokens.count > 0 && f->tokens[0].kind == Token_EOF) {
return true;
}
u64 start = time_stamp_time_now();
String filepath = f->tokenizer.fullpath;
String base_dir = dir_from_path(filepath);
if (f->curr_token.kind == Token_Comment) {
consume_comment_groups(f, f->prev_token);
}
CommentGroup *docs = f->lead_comment;
if (f->curr_token.kind != Token_package) {
syntax_error(f->curr_token, "Expected a package declaration at the beginning of the file");
return false;
}
f->package_token = expect_token(f, Token_package);
if (f->package_token.kind != Token_package) {
return false;
}
if (docs != nullptr) {
TokenPos end = token_pos_end(docs->list[docs->list.count-1]);
if (end.line == f->package_token.pos.line || end.line+1 == f->package_token.pos.line) {
// Okay
} else {
docs = nullptr;
}
}
Token package_name = expect_token_after(f, Token_Ident, "package");
if (package_name.kind == Token_Ident) {
if (package_name.string == "_") {
syntax_error(package_name, "Invalid package name '_'");
} else if (f->pkg->kind != Package_Runtime && package_name.string == "runtime") {
syntax_error(package_name, "Use of reserved package name '%.*s'", LIT(package_name.string));
} else if (is_package_name_reserved(package_name.string)) {
syntax_error(package_name, "Use of reserved package name '%.*s'", LIT(package_name.string));
}
}
f->package_name = package_name.string;
if (!f->pkg->is_single_file && docs != nullptr && docs->list.count > 0) {
for_array(i, docs->list) {
Token tok = docs->list[i]; GB_ASSERT(tok.kind == Token_Comment);
String str = tok.string;
if (string_starts_with(str, str_lit("//"))) {
String lc = string_trim_whitespace(substring(str, 2, str.len));
if (lc.len > 0 && lc[0] == '+') {
if (string_starts_with(lc, str_lit("+build"))) {
if (!parse_build_tag(tok, lc)) {
return false;
}
} else if (string_starts_with(lc, str_lit("+private"))) {
f->flags |= AstFile_IsPrivatePkg;
String command = string_trim_starts_with(lc, str_lit("+private "));
command = string_trim_whitespace(command);
if (lc == "+private") {
f->flags |= AstFile_IsPrivatePkg;
} else if (command == "package") {
f->flags |= AstFile_IsPrivatePkg;
} else if (command == "file") {
f->flags |= AstFile_IsPrivateFile;
}
} else if (lc == "+lazy") {
if (build_context.ignore_lazy) {
// Ignore
} else if (f->flags & AstFile_IsTest) {
// Ignore
} else if (f->pkg->kind == Package_Init && build_context.command_kind == Command_doc) {
// Ignore
} else {
f->flags |= AstFile_IsLazy;
}
}
}
}
}
}
Ast *pd = ast_package_decl(f, f->package_token, package_name, docs, f->line_comment);
expect_semicolon(f, pd);
f->pkg_decl = pd;
if (f->error_count == 0) {
auto decls = array_make<Ast *>(heap_allocator());
while (f->curr_token.kind != Token_EOF) {
Ast *stmt = parse_stmt(f);
if (stmt && stmt->kind != Ast_EmptyStmt) {
array_add(&decls, stmt);
if (stmt->kind == Ast_ExprStmt &&
stmt->ExprStmt.expr != nullptr &&
stmt->ExprStmt.expr->kind == Ast_ProcLit) {
syntax_error(stmt, "Procedure literal evaluated but not used");
}
f->total_file_decl_count += calc_decl_count(stmt);
if (stmt->kind == Ast_WhenStmt || stmt->kind == Ast_ExprStmt || stmt->kind == Ast_ImportDecl) {
f->delayed_decl_count += 1;
}
}
}
f->decls = slice_from_array(decls);
parse_setup_file_decls(p, f, base_dir, f->decls);
}
u64 end = time_stamp_time_now();
f->time_to_parse = cast(f64)(end-start)/cast(f64)time_stamp__freq();
for (int i = 0; i < AstDelayQueue_COUNT; i++) {
mpmc_init(f->delayed_decls_queues+i, heap_allocator(), f->delayed_decl_count);
}
return f->error_count == 0;
}
ParseFileError process_imported_file(Parser *p, ImportedFile imported_file) {
AstPackage *pkg = imported_file.pkg;
FileInfo fi = imported_file.fi;
TokenPos pos = imported_file.pos;
AstFile *file = gb_alloc_item(permanent_allocator(), AstFile);
file->pkg = pkg;
file->id = cast(i32)(imported_file.index+1);
TokenPos err_pos = {0};
ParseFileError err = init_ast_file(file, fi.fullpath, &err_pos);
err_pos.file_id = file->id;
file->last_error = err;
if (err != ParseFile_None) {
if (err == ParseFile_EmptyFile) {
if (fi.fullpath == p->init_fullpath) {
syntax_error(pos, "Initial file is empty - %.*s\n", LIT(p->init_fullpath));
gb_exit(1);
}
} else {
switch (err) {
case ParseFile_WrongExtension:
syntax_error(pos, "Failed to parse file: %.*s; invalid file extension: File must have the extension '.odin'", LIT(fi.name));
break;
case ParseFile_InvalidFile:
syntax_error(pos, "Failed to parse file: %.*s; invalid file or cannot be found", LIT(fi.name));
break;
case ParseFile_Permission:
syntax_error(pos, "Failed to parse file: %.*s; file permissions problem", LIT(fi.name));
break;
case ParseFile_NotFound:
syntax_error(pos, "Failed to parse file: %.*s; file cannot be found ('%.*s')", LIT(fi.name), LIT(fi.fullpath));
break;
case ParseFile_InvalidToken:
syntax_error(err_pos, "Failed to parse file: %.*s; invalid token found in file", LIT(fi.name));
break;
case ParseFile_EmptyFile:
syntax_error(pos, "Failed to parse file: %.*s; file contains no tokens", LIT(fi.name));
break;
case ParseFile_FileTooLarge:
syntax_error(pos, "Failed to parse file: %.*s; file is too large, exceeds maximum file size of 2 GiB", LIT(fi.name));
break;
}
return err;
}
}
if (build_context.command_kind == Command_test) {
String name = file->fullpath;
name = remove_extension_from_path(name);
String test_suffix = str_lit("_test");
if (string_ends_with(name, test_suffix) && name != test_suffix) {
file->flags |= AstFile_IsTest;
}
}
if (parse_file(p, file)) {
mutex_lock(&p->file_add_mutex);
defer (mutex_unlock(&p->file_add_mutex));
array_add(&pkg->files, file);
if (pkg->name.len == 0) {
pkg->name = file->package_name;
} else if (pkg->name != file->package_name) {
if (file->tokens.count > 0 && file->tokens[0].kind != Token_EOF) {
Token tok = file->package_token;
tok.pos.file_id = file->id;
tok.pos.line = gb_max(tok.pos.line, 1);
tok.pos.column = gb_max(tok.pos.column, 1);
syntax_error(tok, "Different package name, expected '%.*s', got '%.*s'", LIT(pkg->name), LIT(file->package_name));
}
}
p->total_line_count += file->tokenizer.line_count;
p->total_token_count += file->tokens.count;
}
return ParseFile_None;
}
ParseFileError parse_packages(Parser *p, String init_filename) {
GB_ASSERT(init_filename.text[init_filename.len] == 0);
String init_fullpath = path_to_full_path(heap_allocator(), init_filename);
if (!path_is_directory(init_fullpath)) {
String const ext = str_lit(".odin");
if (!string_ends_with(init_fullpath, ext)) {
error_line("Expected either a directory or a .odin file, got '%.*s'\n", LIT(init_filename));
return ParseFile_WrongExtension;
}
} else if (init_fullpath.len != 0) {
String path = init_fullpath;
if (path[path.len-1] == '/') {
path.len -= 1;
}
if ((build_context.command_kind & Command__does_build) &&
build_context.build_mode == BuildMode_Executable) {
String short_path = filename_from_path(path);
char *cpath = alloc_cstring(heap_allocator(), short_path);
defer (gb_free(heap_allocator(), cpath));
if (gb_file_exists(cpath)) {
error_line("Please specify the executable name with -out:<string> as a directory exists with the same name in the current working directory");
return ParseFile_DirectoryAlreadyExists;
}
}
}
{ // Add these packages serially and then process them parallel
mutex_lock(&p->wait_mutex);
defer (mutex_unlock(&p->wait_mutex));
TokenPos init_pos = {};
{
String s = get_fullpath_core(heap_allocator(), str_lit("runtime"));
try_add_import_path(p, s, s, init_pos, Package_Runtime);
}
try_add_import_path(p, init_fullpath, init_fullpath, init_pos, Package_Init);
p->init_fullpath = init_fullpath;
if (build_context.command_kind == Command_test) {
String s = get_fullpath_core(heap_allocator(), str_lit("testing"));
try_add_import_path(p, s, s, init_pos, Package_Normal);
}
for_array(i, build_context.extra_packages) {
String path = build_context.extra_packages[i];
String fullpath = path_to_full_path(heap_allocator(), path); // LEAK?
if (!path_is_directory(fullpath)) {
String const ext = str_lit(".odin");
if (!string_ends_with(fullpath, ext)) {
error_line("Expected either a directory or a .odin file, got '%.*s'\n", LIT(fullpath));
return ParseFile_WrongExtension;
}
}
AstPackage *pkg = try_add_import_path(p, fullpath, fullpath, init_pos, Package_Normal);
if (pkg) {
pkg->is_extra = true;
}
}
}
global_thread_pool_wait();
for (ParseFileError err = ParseFile_None; mpmc_dequeue(&p->file_error_queue, &err); /**/) {
if (err != ParseFile_None) {
return err;
}
}
for (isize i = p->packages.count-1; i >= 0; i--) {
AstPackage *pkg = p->packages[i];
for (isize j = pkg->files.count-1; j >= 0; j--) {
AstFile *file = pkg->files[j];
if (file->error_count != 0) {
if (file->last_error != ParseFile_None) {
return file->last_error;
}
return ParseFile_GeneralError;
}
}
}
return ParseFile_None;
}
|
// 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.
//
// The following only applies to changes made to this file as part of YugaByte development.
//
// Portions Copyright (c) YugaByte, 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 "yb/consensus/consensus_queue.h"
#include <shared_mutex>
#include <algorithm>
#include <iostream>
#include <mutex>
#include <string>
#include <utility>
#include <boost/container/small_vector.hpp>
#include <gflags/gflags.h>
#include "yb/common/wire_protocol.h"
#include "yb/consensus/consensus_context.h"
#include "yb/consensus/log.h"
#include "yb/consensus/log_reader.h"
#include "yb/consensus/log_util.h"
#include "yb/consensus/opid_util.h"
#include "yb/consensus/quorum_util.h"
#include "yb/consensus/raft_consensus.h"
#include "yb/consensus/replicate_msgs_holder.h"
#include "yb/gutil/dynamic_annotations.h"
#include "yb/gutil/map-util.h"
#include "yb/gutil/stl_util.h"
#include "yb/gutil/strings/join.h"
#include "yb/gutil/strings/substitute.h"
#include "yb/gutil/strings/strcat.h"
#include "yb/gutil/strings/human_readable.h"
#include "yb/util/fault_injection.h"
#include "yb/util/flag_tags.h"
#include "yb/util/locks.h"
#include "yb/util/logging.h"
#include "yb/util/mem_tracker.h"
#include "yb/util/metrics.h"
#include "yb/util/random_util.h"
#include "yb/util/size_literals.h"
#include "yb/util/threadpool.h"
#include "yb/util/url-coding.h"
#include "yb/util/enums.h"
#include "yb/util/tostring.h"
using namespace std::literals;
using namespace yb::size_literals;
DECLARE_int32(rpc_max_message_size);
// We expect that consensus_max_batch_size_bytes + 1_KB would be less than rpc_max_message_size.
// Otherwise such batch would be rejected by RPC layer.
DEFINE_int32(consensus_max_batch_size_bytes, 4_MB,
"The maximum per-tablet RPC batch size when updating peers.");
TAG_FLAG(consensus_max_batch_size_bytes, advanced);
TAG_FLAG(consensus_max_batch_size_bytes, runtime);
DEFINE_int32(follower_unavailable_considered_failed_sec, 900,
"Seconds that a leader is unable to successfully heartbeat to a "
"follower after which the follower is considered to be failed and "
"evicted from the config.");
TAG_FLAG(follower_unavailable_considered_failed_sec, advanced);
DEFINE_int32(consensus_inject_latency_ms_in_notifications, 0,
"Injects a random sleep between 0 and this many milliseconds into "
"asynchronous notifications from the consensus queue back to the "
"consensus implementation.");
TAG_FLAG(consensus_inject_latency_ms_in_notifications, hidden);
TAG_FLAG(consensus_inject_latency_ms_in_notifications, unsafe);
DEFINE_int32(cdc_checkpoint_opid_interval_ms, 60 * 1000,
"Interval up to which CDC consumer's checkpoint is considered for retaining log cache."
"If we haven't received an updated checkpoint from CDC consumer within the interval "
"specified by cdc_checkpoint_opid_interval, then log cache does not consider that "
"consumer while determining which op IDs to evict.");
DEFINE_bool(enable_consensus_exponential_backoff, true,
"Whether exponential backoff based on number of retransmissions at tablet leader "
"for number of entries to replicate to lagging follower is enabled.");
TAG_FLAG(enable_consensus_exponential_backoff, advanced);
TAG_FLAG(enable_consensus_exponential_backoff, runtime);
DEFINE_int32(consensus_lagging_follower_threshold, 10,
"Number of retransmissions at tablet leader to mark a follower as lagging. "
"-1 disables the feature.");
TAG_FLAG(consensus_lagging_follower_threshold, advanced);
TAG_FLAG(consensus_lagging_follower_threshold, runtime);
DEFINE_test_flag(bool, disallow_lmp_failures, false,
"Whether we disallow PRECEDING_ENTRY_DIDNT_MATCH failures for non new peers.");
namespace {
constexpr const auto kMinRpcThrottleThresholdBytes = 16;
static bool RpcThrottleThresholdBytesValidator(const char* flagname, int32_t value) {
if (value > 0) {
if (value < kMinRpcThrottleThresholdBytes) {
LOG(ERROR) << "Expect " << flagname << " to be at least " << kMinRpcThrottleThresholdBytes;
return false;
} else if (value >= FLAGS_consensus_max_batch_size_bytes) {
LOG(ERROR) << "Expect " << flagname << " to be less than consensus_max_batch_size_bytes "
<< "value (" << FLAGS_consensus_max_batch_size_bytes << ")";
return false;
}
}
return true;
}
} // namespace
DECLARE_int32(rpc_throttle_threshold_bytes);
__attribute__((unused))
DEFINE_validator(rpc_throttle_threshold_bytes, &RpcThrottleThresholdBytesValidator);
namespace yb {
namespace consensus {
using log::AsyncLogReader;
using log::Log;
using std::unique_ptr;
using rpc::Messenger;
using strings::Substitute;
METRIC_DEFINE_gauge_int64(tablet, majority_done_ops, "Leader Operations Acked by Majority",
MetricUnit::kOperations,
"Number of operations in the leader queue ack'd by a majority but "
"not all peers.");
METRIC_DEFINE_gauge_int64(tablet, in_progress_ops, "Leader Operations in Progress",
MetricUnit::kOperations,
"Number of operations in the leader queue ack'd by a minority of "
"peers.");
const auto kCDCConsumerCheckpointInterval = FLAGS_cdc_checkpoint_opid_interval_ms * 1ms;
std::string MajorityReplicatedData::ToString() const {
return Format(
"{ op_id: $0 leader_lease_expiration: $1 ht_lease_expiration: $2 num_sst_files: $3 }",
op_id, leader_lease_expiration, ht_lease_expiration, num_sst_files);
}
std::string PeerMessageQueue::TrackedPeer::ToString() const {
return Format(
"{ peer: $0 is_new: $1 last_received: $2 next_index: $3 last_known_committed_idx: $4 "
"is_last_exchange_successful: $5 needs_remote_bootstrap: $6 member_type: $7 "
"num_sst_files: $8 last_applied: $9 }",
uuid, is_new, last_received, next_index, last_known_committed_idx,
is_last_exchange_successful, needs_remote_bootstrap, RaftPeerPB::MemberType_Name(member_type),
num_sst_files, last_applied);
}
void PeerMessageQueue::TrackedPeer::ResetLeaderLeases() {
leader_lease_expiration.Reset();
leader_ht_lease_expiration.Reset();
}
void PeerMessageQueue::TrackedPeer::ResetLastRequest() {
// Reset so that next transmission is not considered a re-transmission.
last_num_messages_sent = -1;
current_retransmissions = -1;
}
#define INSTANTIATE_METRIC(x) \
x.Instantiate(metric_entity, 0)
PeerMessageQueue::Metrics::Metrics(const scoped_refptr<MetricEntity>& metric_entity)
: num_majority_done_ops(INSTANTIATE_METRIC(METRIC_majority_done_ops)),
num_in_progress_ops(INSTANTIATE_METRIC(METRIC_in_progress_ops)) {
}
#undef INSTANTIATE_METRIC
PeerMessageQueue::PeerMessageQueue(const scoped_refptr<MetricEntity>& metric_entity,
const scoped_refptr<log::Log>& log,
const MemTrackerPtr& server_tracker,
const MemTrackerPtr& parent_tracker,
const RaftPeerPB& local_peer_pb,
const string& tablet_id,
const server::ClockPtr& clock,
ConsensusContext* context,
unique_ptr<ThreadPoolToken> raft_pool_token)
: raft_pool_observers_token_(std::move(raft_pool_token)),
local_peer_pb_(local_peer_pb),
local_peer_uuid_(local_peer_pb_.has_permanent_uuid() ? local_peer_pb_.permanent_uuid()
: string()),
tablet_id_(tablet_id),
log_cache_(metric_entity, log, server_tracker, local_peer_pb.permanent_uuid(), tablet_id),
operations_mem_tracker_(
MemTracker::FindOrCreateTracker("OperationsFromDisk", parent_tracker)),
metrics_(metric_entity),
clock_(clock),
context_(context) {
DCHECK(local_peer_pb_.has_permanent_uuid());
DCHECK(!local_peer_pb_.last_known_private_addr().empty());
}
void PeerMessageQueue::Init(const OpId& last_locally_replicated) {
LockGuard lock(queue_lock_);
CHECK_EQ(queue_state_.state, State::kQueueConstructed);
log_cache_.Init(last_locally_replicated.ToPB<OpIdPB>());
queue_state_.last_appended = last_locally_replicated;
queue_state_.state = State::kQueueOpen;
local_peer_ = TrackPeerUnlocked(local_peer_uuid_);
if (context_) {
context_->ListenNumSSTFilesChanged(std::bind(&PeerMessageQueue::NumSSTFilesChanged, this));
installed_num_sst_files_changed_listener_ = true;
}
}
void PeerMessageQueue::SetLeaderMode(const OpId& committed_op_id,
int64_t current_term,
const OpId& last_applied_op_id,
const RaftConfigPB& active_config) {
LockGuard lock(queue_lock_);
queue_state_.current_term = current_term;
queue_state_.committed_op_id = committed_op_id;
queue_state_.last_applied_op_id = last_applied_op_id;
queue_state_.majority_replicated_op_id = committed_op_id;
queue_state_.active_config.reset(new RaftConfigPB(active_config));
CHECK(IsRaftConfigVoter(local_peer_uuid_, *queue_state_.active_config))
<< local_peer_pb_.ShortDebugString() << " not a voter in config: "
<< queue_state_.active_config->ShortDebugString();
queue_state_.majority_size_ = MajoritySize(CountVoters(*queue_state_.active_config));
queue_state_.mode = Mode::LEADER;
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Queue going to LEADER mode. State: "
<< queue_state_.ToString();
CheckPeersInActiveConfigIfLeaderUnlocked();
// Reset last communication time with all peers to reset the clock on the
// failure timeout.
MonoTime now(MonoTime::Now());
for (const PeersMap::value_type& entry : peers_map_) {
entry.second->ResetLeaderLeases();
entry.second->last_successful_communication_time = now;
}
}
void PeerMessageQueue::SetNonLeaderMode() {
LockGuard lock(queue_lock_);
queue_state_.active_config.reset();
queue_state_.mode = Mode::NON_LEADER;
queue_state_.majority_size_ = -1;
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Queue going to NON_LEADER mode. State: "
<< queue_state_.ToString();
}
void PeerMessageQueue::TrackPeer(const string& uuid) {
LockGuard lock(queue_lock_);
TrackPeerUnlocked(uuid);
}
PeerMessageQueue::TrackedPeer* PeerMessageQueue::TrackPeerUnlocked(const string& uuid) {
CHECK(!uuid.empty()) << "Got request to track peer with empty UUID";
DCHECK_EQ(queue_state_.state, State::kQueueOpen);
TrackedPeer* tracked_peer = new TrackedPeer(uuid);
// We don't know the last operation received by the peer so, following the Raft protocol, we set
// next_index to one past the end of our own log. This way, if calling this method is the result
// of a successful leader election and the logs between the new leader and remote peer match, the
// peer->next_index will point to the index of the soon-to-be-written NO_OP entry that is used to
// assert leadership. If we guessed wrong, and the peer does not have a log that matches ours, the
// normal queue negotiation process will eventually find the right point to resume from.
tracked_peer->next_index = queue_state_.last_appended.index + 1;
InsertOrDie(&peers_map_, uuid, tracked_peer);
CheckPeersInActiveConfigIfLeaderUnlocked();
// We don't know how far back this peer is, so set the all replicated watermark to
// MinimumOpId. We'll advance it when we know how far along the peer is.
queue_state_.all_replicated_op_id = OpId::Min();
return tracked_peer;
}
void PeerMessageQueue::UntrackPeer(const string& uuid) {
LockGuard lock(queue_lock_);
TrackedPeer* peer = EraseKeyReturnValuePtr(&peers_map_, uuid);
if (peer != nullptr) {
delete peer;
}
}
void PeerMessageQueue::CheckPeersInActiveConfigIfLeaderUnlocked() const {
if (queue_state_.mode != Mode::LEADER) return;
unordered_set<string> config_peer_uuids;
for (const RaftPeerPB& peer_pb : queue_state_.active_config->peers()) {
InsertOrDie(&config_peer_uuids, peer_pb.permanent_uuid());
}
for (const PeersMap::value_type& entry : peers_map_) {
if (!ContainsKey(config_peer_uuids, entry.first)) {
LOG_WITH_PREFIX_UNLOCKED(FATAL) << Substitute("Peer $0 is not in the active config. "
"Queue state: $1",
entry.first,
queue_state_.ToString());
}
}
}
void PeerMessageQueue::NumSSTFilesChanged() {
auto num_sst_files = context_->NumSSTFiles();
uint64_t majority_replicated_num_sst_files;
{
LockGuard lock(queue_lock_);
if (queue_state_.mode != Mode::LEADER) {
return;
}
auto it = peers_map_.find(local_peer_uuid_);
if (it == peers_map_.end()) {
return;
}
it->second->num_sst_files = num_sst_files;
majority_replicated_num_sst_files = NumSSTFilesWatermark();
}
NotifyObservers(
"majority replicated num SST files changed",
[majority_replicated_num_sst_files](PeerMessageQueueObserver* observer) {
observer->MajorityReplicatedNumSSTFilesChanged(majority_replicated_num_sst_files);
});
}
void PeerMessageQueue::LocalPeerAppendFinished(const OpId& id, const Status& status) {
CHECK_OK(status);
// Fake an RPC response from the local peer.
// TODO: we should probably refactor the ResponseFromPeer function so that we don't need to
// construct this fake response, but this seems to work for now.
ConsensusResponsePB fake_response;
id.ToPB(fake_response.mutable_status()->mutable_last_received());
id.ToPB(fake_response.mutable_status()->mutable_last_received_current_leader());
if (context_) {
fake_response.set_num_sst_files(context_->NumSSTFiles());
}
{
LockGuard lock(queue_lock_);
// TODO This ugly fix is required because we unlock queue_lock_ while doing AppendOperations.
// So LocalPeerAppendFinished could be invoked before rest of AppendOperations.
if (queue_state_.last_appended.index < id.index) {
queue_state_.last_appended = id;
}
fake_response.mutable_status()->set_last_committed_idx(queue_state_.committed_op_id.index);
queue_state_.last_applied_op_id.ToPB(fake_response.mutable_status()->mutable_last_applied());
if (queue_state_.mode != Mode::LEADER) {
log_cache_.EvictThroughOp(id.index);
UpdateMetrics();
return;
}
}
ResponseFromPeer(local_peer_uuid_, fake_response);
}
Status PeerMessageQueue::TEST_AppendOperation(const ReplicateMsgPtr& msg) {
return AppendOperations(
{ msg }, yb::OpId::FromPB(msg->committed_op_id()), RestartSafeCoarseMonoClock().Now());
}
Status PeerMessageQueue::AppendOperations(const ReplicateMsgs& msgs,
const yb::OpId& committed_op_id,
RestartSafeCoarseTimePoint batch_mono_time) {
DFAKE_SCOPED_LOCK(append_fake_lock_);
OpId last_id;
if (!msgs.empty()) {
std::unique_lock<simple_spinlock> lock(queue_lock_);
last_id = OpId::FromPB(msgs.back()->id());
if (last_id.term > queue_state_.current_term) {
queue_state_.current_term = last_id.term;
}
} else {
std::unique_lock<simple_spinlock> lock(queue_lock_);
last_id = queue_state_.last_appended;
}
// Unlock ourselves during Append to prevent a deadlock: it's possible that the log buffer is
// full, in which case AppendOperations would block. However, for the log buffer to empty, it may
// need to call LocalPeerAppendFinished() which also needs queue_lock_.
//
// Since we are doing AppendOperations only in one thread, no concurrent AppendOperations could
// be executed and queue_state_.last_appended will be updated correctly.
RETURN_NOT_OK(log_cache_.AppendOperations(
msgs, committed_op_id, batch_mono_time,
Bind(&PeerMessageQueue::LocalPeerAppendFinished, Unretained(this), last_id)));
if (!msgs.empty()) {
std::unique_lock<simple_spinlock> lock(queue_lock_);
queue_state_.last_appended = last_id;
UpdateMetrics();
}
return Status::OK();
}
uint64_t GetNumMessagesToSendWithBackoff(int64_t last_num_messages_sent) {
return std::max<int64_t>((last_num_messages_sent >> 1) - 1, 0);
}
Status PeerMessageQueue::RequestForPeer(const string& uuid,
ConsensusRequestPB* request,
ReplicateMsgsHolder* msgs_holder,
bool* needs_remote_bootstrap,
RaftPeerPB::MemberType* member_type,
bool* last_exchange_successful) {
static constexpr uint64_t kSendUnboundedLogOps = std::numeric_limits<uint64_t>::max();
DCHECK(request->ops().empty()) << request->ShortDebugString();
OpId preceding_id;
MonoDelta unreachable_time = MonoDelta::kMin;
bool is_voter = false;
bool is_new;
int64_t previously_sent_index;
uint64_t num_log_ops_to_send;
HybridTime propagated_safe_time;
// Should be before now_ht, i.e. not greater than propagated_hybrid_time.
if (context_) {
propagated_safe_time = VERIFY_RESULT(context_->PreparePeerRequest());
}
{
LockGuard lock(queue_lock_);
DCHECK_EQ(queue_state_.state, State::kQueueOpen);
DCHECK_NE(uuid, local_peer_uuid_);
auto peer = FindPtrOrNull(peers_map_, uuid);
if (PREDICT_FALSE(peer == nullptr || queue_state_.mode == Mode::NON_LEADER)) {
return STATUS(NotFound, "Peer not tracked or queue not in leader mode.");
}
HybridTime now_ht;
is_new = peer->is_new;
if (!is_new) {
now_ht = clock_->Now();
auto ht_lease_expiration_micros = now_ht.GetPhysicalValueMicros() +
FLAGS_ht_lease_duration_ms * 1000;
auto leader_lease_duration_ms = GetAtomicFlag(&FLAGS_leader_lease_duration_ms);
request->set_leader_lease_duration_ms(leader_lease_duration_ms);
request->set_ht_lease_expiration(ht_lease_expiration_micros);
// As noted here:
// https://red.ht/2sCSErb
//
// The _COARSE variants are faster to read and have a precision (also known as resolution) of
// one millisecond (ms).
//
// Coarse clock precision is 1 millisecond.
const auto kCoarseClockPrecision = 1ms;
// Because of coarse clocks we subtract 2ms, to be sure that our local version of lease
// does not expire after it expires at follower.
peer->leader_lease_expiration.last_sent =
CoarseMonoClock::Now() + leader_lease_duration_ms * 1ms - kCoarseClockPrecision * 2;
peer->leader_ht_lease_expiration.last_sent = ht_lease_expiration_micros;
preceding_id = peer->last_received;
} else {
now_ht = clock_->Now();
request->clear_leader_lease_duration_ms();
request->clear_ht_lease_expiration();
peer->leader_lease_expiration.Reset();
peer->leader_ht_lease_expiration.Reset();
// This is initialized to the queue's last appended op but gets set to the id of the
// log entry preceding the first one in 'messages' if messages are found for the peer.
// Just because we don't know actual state of a new peer.
preceding_id = queue_state_.last_appended;
}
request->set_propagated_hybrid_time(now_ht.ToUint64());
// NOTE: committed_op_id may be overwritten later.
queue_state_.committed_op_id.ToPB(request->mutable_committed_op_id());
request->set_caller_term(queue_state_.current_term);
unreachable_time =
MonoTime::Now().GetDeltaSince(peer->last_successful_communication_time);
if (member_type) *member_type = peer->member_type;
if (last_exchange_successful) *last_exchange_successful = peer->is_last_exchange_successful;
*needs_remote_bootstrap = peer->needs_remote_bootstrap;
previously_sent_index = peer->next_index - 1;
if (FLAGS_enable_consensus_exponential_backoff && peer->last_num_messages_sent >= 0) {
// Previous request to peer has not been acked. Reduce number of entries to be sent
// in this attempt using exponential backoff. Note that to_index is inclusive.
num_log_ops_to_send = GetNumMessagesToSendWithBackoff(peer->last_num_messages_sent);
} else {
// Previous request to peer has been acked or a heartbeat response has been received.
// Transmit as many entries as allowed.
num_log_ops_to_send = kSendUnboundedLogOps;
}
peer->current_retransmissions++;
if (peer->member_type == RaftPeerPB::VOTER) {
is_voter = true;
}
}
if (unreachable_time.ToSeconds() > FLAGS_follower_unavailable_considered_failed_sec) {
if (!is_voter || CountVoters(*queue_state_.active_config) > 2) {
// We never drop from 2 voters to 1 voter automatically, at least for now (12/4/18). We may
// want to revisit this later, we're just being cautious with this.
// We remove unconditionally any failed non-voter replica (PRE_VOTER, PRE_OBSERVER, OBSERVER).
string msg = Substitute("Leader has been unable to successfully communicate "
"with Peer $0 for more than $1 seconds ($2)",
uuid,
FLAGS_follower_unavailable_considered_failed_sec,
unreachable_time.ToString());
NotifyObserversOfFailedFollower(uuid, queue_state_.current_term, msg);
}
}
if (PREDICT_FALSE(*needs_remote_bootstrap)) {
YB_LOG_WITH_PREFIX_UNLOCKED_EVERY_N_SECS(INFO, 30)
<< "Peer needs remote bootstrap: " << uuid;
return Status::OK();
}
*needs_remote_bootstrap = false;
// If we've never communicated with the peer, we don't know what messages to send, so we'll send a
// status-only request. If the peer has not responded to the point that our to_index == next_index
// due to exponential backoff of replicated segment size, we also send a status-only request.
// Otherwise, we grab requests from the log starting at the last_received point.
if (!is_new && num_log_ops_to_send > 0) {
// The batch of messages to send to the peer.
int max_batch_size = FLAGS_consensus_max_batch_size_bytes - request->ByteSize();
auto to_index = num_log_ops_to_send == kSendUnboundedLogOps ?
0 : previously_sent_index + num_log_ops_to_send;
auto result = ReadFromLogCache(previously_sent_index, to_index, max_batch_size, uuid);
if (PREDICT_FALSE(!result.ok())) {
if (PREDICT_TRUE(result.status().IsNotFound())) {
std::string msg = Format("The logs necessary to catch up peer $0 have been "
"garbage collected. The follower will never be able "
"to catch up ($1)", uuid, result.status());
NotifyObserversOfFailedFollower(uuid, queue_state_.current_term, msg);
}
return result.status();
}
if (!result->messages.empty()) {
// All entries committed at leader may not be available at lagging follower.
// `commited_op_id` in this request may make a lagging follower aware of the
// highest committed op index at the leader. We have a sanity check during tablet
// bootstrap, in TabletBootstrap::PlaySegments(), that this tablet did not lose a
// committed operation. Hence avoid sending a committed op id that is too large
// to such a lagging follower.
const auto& msg = result->messages.back();
if (msg->id().index() < request->mutable_committed_op_id()->index()) {
*request->mutable_committed_op_id() = msg->id();
}
}
preceding_id = result->preceding_op;
// We use AddAllocated rather than copy, because we pin the log cache at the "all replicated"
// point. At some point we may want to allow partially loading (and not pinning) earlier
// messages. At that point we'll need to do something smarter here, like copy or ref-count.
for (const auto& msg : result->messages) {
request->mutable_ops()->AddAllocated(msg.get());
}
{
LockGuard lock(queue_lock_);
auto peer = FindPtrOrNull(peers_map_, uuid);
if (PREDICT_FALSE(peer == nullptr)) {
return STATUS(NotFound, "Peer not tracked.");
}
peer->last_num_messages_sent = result->messages.size();
}
ScopedTrackedConsumption consumption;
if (result->read_from_disk_size) {
consumption = ScopedTrackedConsumption(operations_mem_tracker_, result->read_from_disk_size);
}
*msgs_holder = ReplicateMsgsHolder(
request->mutable_ops(), std::move(result->messages), std::move(consumption));
if (propagated_safe_time &&
!result->have_more_messages &&
num_log_ops_to_send == kSendUnboundedLogOps) {
// Get the current local safe time on the leader and propagate it to the follower.
request->set_propagated_safe_time(propagated_safe_time.ToUint64());
} else {
request->clear_propagated_safe_time();
}
}
preceding_id.ToPB(request->mutable_preceding_id());
if (PREDICT_FALSE(VLOG_IS_ON(2))) {
if (request->ops_size() > 0) {
VLOG_WITH_PREFIX_UNLOCKED(2) << "Sending request with operations to Peer: " << uuid
<< ". Size: " << request->ops_size()
<< ". From: " << request->ops(0).id().ShortDebugString() << ". To: "
<< request->ops(request->ops_size() - 1).id().ShortDebugString();
VLOG_WITH_PREFIX_UNLOCKED(3) << "Operations: " << yb::ToString(request->ops());
} else {
VLOG_WITH_PREFIX_UNLOCKED(2)
<< "Sending " << (is_new ? "new " : "") << "status only request to Peer: " << uuid
<< ": " << request->ShortDebugString();
}
}
return Status::OK();
}
Result<ReadOpsResult> PeerMessageQueue::ReadFromLogCache(int64_t after_index,
int64_t to_index,
int max_batch_size,
const std::string& peer_uuid) {
DCHECK_LT(FLAGS_consensus_max_batch_size_bytes + 1_KB, FLAGS_rpc_max_message_size);
// We try to get the follower's next_index from our log.
// Note this is not using "term" and needs to change
auto result = log_cache_.ReadOps(after_index, to_index, max_batch_size);
if (PREDICT_FALSE(!result.ok())) {
auto s = result.status();
if (PREDICT_TRUE(s.IsNotFound())) {
return s;
} else if (s.IsIncomplete()) {
// IsIncomplete() means that we tried to read beyond the head of the log (in the future).
// KUDU-1078 points to a fix of this log spew issue that we've ported. This should not
// happen under normal circumstances.
LOG_WITH_PREFIX_UNLOCKED(ERROR) << "Error trying to read ahead of the log "
<< "while preparing peer request: "
<< s.ToString() << ". Destination peer: "
<< peer_uuid;
return s;
} else {
LOG_WITH_PREFIX_UNLOCKED(FATAL) << "Error reading the log while preparing peer request: "
<< s.ToString() << ". Destination peer: "
<< peer_uuid;
return s;
}
}
return result;
}
// Read majority replicated messages from cache for CDC.
// CDC producer will use this to get the messages to send in response to cdc::GetChanges RPC.
Result<ReadOpsResult> PeerMessageQueue::ReadReplicatedMessagesForCDC(const yb::OpId& last_op_id,
int64_t* repl_index) {
// The batch of messages read from cache.
int64_t to_index;
bool pending_messages = false;
{
LockGuard lock(queue_lock_);
// Use committed_op_id because it's already been processed by the Transaction codepath.
to_index = queue_state_.committed_op_id.index;
// Determine if there are pending operations in RAFT but not yet LogCache.
pending_messages = to_index != queue_state_.majority_replicated_op_id.index;
}
if (repl_index) {
*repl_index = to_index;
}
if (last_op_id.index >= to_index) {
// Nothing to read.
return ReadOpsResult();
}
// If an empty OpID is only sent on the first read request, start at the earliest known entry.
int64_t after_op_index = last_op_id.empty() ?
max(log_cache_.earliest_op_index(), last_op_id.index) :
last_op_id.index;
auto result = ReadFromLogCache(
after_op_index, to_index, FLAGS_consensus_max_batch_size_bytes, local_peer_uuid_);
if (PREDICT_FALSE(!result.ok()) && PREDICT_TRUE(result.status().IsNotFound())) {
LOG_WITH_PREFIX_UNLOCKED(INFO) << Format(
"The logs from index $0 have been garbage collected and cannot be read ($1)",
after_op_index, result.status());
}
if (result.ok()) {
result->have_more_messages |= pending_messages;
}
return result;
}
Status PeerMessageQueue::GetRemoteBootstrapRequestForPeer(const string& uuid,
StartRemoteBootstrapRequestPB* req) {
TrackedPeer* peer = nullptr;
{
LockGuard lock(queue_lock_);
DCHECK_EQ(queue_state_.state, State::kQueueOpen);
DCHECK_NE(uuid, local_peer_uuid_);
peer = FindPtrOrNull(peers_map_, uuid);
if (PREDICT_FALSE(peer == nullptr || queue_state_.mode == Mode::NON_LEADER)) {
return STATUS(NotFound, "Peer not tracked or queue not in leader mode.");
}
}
if (PREDICT_FALSE(!peer->needs_remote_bootstrap)) {
return STATUS(IllegalState, "Peer does not need to remotely bootstrap", uuid);
}
if (peer->member_type == RaftPeerPB::VOTER || peer->member_type == RaftPeerPB::OBSERVER) {
LOG(INFO) << "Remote bootstrapping peer " << uuid << " with type "
<< RaftPeerPB::MemberType_Name(peer->member_type);
}
req->Clear();
req->set_dest_uuid(uuid);
req->set_tablet_id(tablet_id_);
req->set_bootstrap_peer_uuid(local_peer_uuid_);
*req->mutable_source_private_addr() = local_peer_pb_.last_known_private_addr();
*req->mutable_source_broadcast_addr() = local_peer_pb_.last_known_broadcast_addr();
*req->mutable_source_cloud_info() = local_peer_pb_.cloud_info();
req->set_caller_term(queue_state_.current_term);
peer->needs_remote_bootstrap = false; // Now reset the flag.
return Status::OK();
}
void PeerMessageQueue::UpdateCDCConsumerOpId(const yb::OpId& op_id) {
std::lock_guard<rw_spinlock> l(cdc_consumer_lock_);
cdc_consumer_op_id_ = op_id;
cdc_consumer_op_id_last_updated_ = CoarseMonoClock::Now();
}
yb::OpId PeerMessageQueue::GetCDCConsumerOpIdToEvict() {
std::shared_lock<rw_spinlock> l(cdc_consumer_lock_);
// For log cache eviction, we only want to include CDC consumers that are actively polling.
// If CDC consumer checkpoint has not been updated recently, we exclude it.
if (CoarseMonoClock::Now() - cdc_consumer_op_id_last_updated_ <= kCDCConsumerCheckpointInterval) {
return cdc_consumer_op_id_;
} else {
return yb::OpId::Max();
}
}
void PeerMessageQueue::UpdateAllReplicatedOpId(OpId* result) {
OpId new_op_id = OpId::Max();
for (const auto& peer : peers_map_) {
if (!peer.second->is_last_exchange_successful) {
return;
}
if (peer.second->last_received.index < new_op_id.index) {
new_op_id = peer.second->last_received;
}
}
CHECK_NE(OpId::Max(), new_op_id);
*result = new_op_id;
}
void PeerMessageQueue::UpdateAllAppliedOpId(OpId* result) {
OpId all_applied_op_id = OpId::Max();
for (const auto& peer : peers_map_) {
if (!peer.second->is_last_exchange_successful) {
return;
}
all_applied_op_id = std::min(all_applied_op_id, peer.second->last_applied);
}
CHECK_NE(OpId::Max(), all_applied_op_id);
*result = all_applied_op_id;
}
void PeerMessageQueue::UpdateAllNonLaggingReplicatedOpId(int32_t threshold) {
OpId new_op_id = OpId::Max();
for (const auto& peer : peers_map_) {
// Ignore lagging follower.
if (peer.second->current_retransmissions >= threshold) {
continue;
}
if (peer.second->last_received.index < new_op_id.index) {
new_op_id = peer.second->last_received;
}
}
if (new_op_id == OpId::Max()) {
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Non lagging peer(s) not found.";
new_op_id = queue_state_.all_replicated_op_id;
}
if (queue_state_.all_nonlagging_replicated_op_id.index < new_op_id.index) {
queue_state_.all_nonlagging_replicated_op_id = new_op_id;
}
}
HAS_MEMBER_FUNCTION(InfiniteWatermarkForLocalPeer);
template <class Policy, bool HasMemberFunction_InfiniteWatermarkForLocalPeer>
struct GetInfiniteWatermarkForLocalPeer;
template <class Policy>
struct GetInfiniteWatermarkForLocalPeer<Policy, true> {
static auto Apply() {
return Policy::InfiniteWatermarkForLocalPeer();
}
};
template <class Policy>
struct GetInfiniteWatermarkForLocalPeer<Policy, false> {
// Should not be invoked, but have to define to make compiler happy.
static typename Policy::result_type Apply() {
LOG(DFATAL) << "Invoked Apply when InfiniteWatermarkForLocalPeer is not defined";
return typename Policy::result_type();
}
};
template <class Policy>
typename Policy::result_type PeerMessageQueue::GetWatermark() {
DCHECK(queue_lock_.is_locked());
const int num_peers_required = queue_state_.majority_size_;
if (num_peers_required == kUninitializedMajoritySize) {
// We don't even know the quorum majority size yet.
return Policy::NotEnoughPeersValue();
}
CHECK_GE(num_peers_required, 0);
const size_t num_peers = peers_map_.size();
if (num_peers < num_peers_required) {
return Policy::NotEnoughPeersValue();
}
// This flag indicates whether to implicitly assume that the local peer has an "infinite"
// replicated value of the dimension that we are computing a watermark for. There is a difference
// in logic between handling of OpIds vs. leader leases:
// - For OpIds, the local peer might actually be less up-to-date than followers.
// - For leader leases, we always assume that we've replicated an "infinite" lease to ourselves.
const bool local_peer_infinite_watermark =
HasMemberFunction_InfiniteWatermarkForLocalPeer<Policy>::value;
if (num_peers_required == 1 && local_peer_infinite_watermark) {
// We give "infinite lease" to ourselves.
return GetInfiniteWatermarkForLocalPeer<
Policy, HasMemberFunction_InfiniteWatermarkForLocalPeer<Policy>::value>::Apply();
}
constexpr size_t kMaxPracticalReplicationFactor = 5;
boost::container::small_vector<
typename Policy::result_type, kMaxPracticalReplicationFactor> watermarks;
watermarks.reserve(num_peers - 1 + !local_peer_infinite_watermark);
for (const PeersMap::value_type &peer_map_entry : peers_map_) {
const TrackedPeer &peer = *peer_map_entry.second;
if (local_peer_infinite_watermark && peer.uuid == local_peer_uuid_) {
// Don't even include the local peer in the watermarks array. Assume it has an "infinite"
// value of the watermark.
continue;
}
if (!IsRaftConfigVoter(peer.uuid, *queue_state_.active_config)) {
// Only votes from VOTERs in the active config should be taken into consideration
continue;
}
if (peer.is_last_exchange_successful) {
watermarks.push_back(Policy::ExtractValue(peer));
}
}
// We always assume that local peer has most recent information.
const size_t num_responsive_peers = watermarks.size() + local_peer_infinite_watermark;
if (num_responsive_peers < num_peers_required) {
VLOG_WITH_PREFIX_UNLOCKED(2)
<< Policy::Name() << " watermarks by peer: " << ::yb::ToString(watermarks)
<< ", num_peers_required=" << num_peers_required
<< ", num_responsive_peers=" << num_responsive_peers
<< ", not enough responsive peers";
// There are not enough peers with which the last message exchange was successful.
return Policy::NotEnoughPeersValue();
}
// If there are 5 peers (and num_peers_required is 3), and we have successfully replicated
// something to 3 of them and 4th is our local peer, there are two possibilities:
// - If local_peer_infinite_watermark is false (for OpId): watermarks.size() is 4,
// and we want an OpId value such that 3 or more peers have replicated that or greater value.
// Then index_of_interest = 1, computed as watermarks.size() - num_peers_required, or
// num_responsive_peers - num_peers_required.
//
// - If local_peer_infinite_watermark is true (for leader leases): watermarks.size() is 3, and we
// are assuming that the local peer (leader) has replicated an infinitely high watermark to
// itself. Then watermark.size() is 3 (because we skip the local peer when populating
// watermarks), but num_responsive_peers is still 4, and the expression stays the same.
const size_t index_of_interest = num_responsive_peers - num_peers_required;
DCHECK_LT(index_of_interest, watermarks.size());
auto nth = watermarks.begin() + index_of_interest;
std::nth_element(watermarks.begin(), nth, watermarks.end(), typename Policy::Comparator());
VLOG_WITH_PREFIX_UNLOCKED(2)
<< Policy::Name() << " watermarks by peer: " << ::yb::ToString(watermarks)
<< ", num_peers_required=" << num_peers_required
<< ", local_peer_infinite_watermark=" << local_peer_infinite_watermark
<< ", watermark: " << yb::ToString(*nth);
return *nth;
}
CoarseTimePoint PeerMessageQueue::LeaderLeaseExpirationWatermark() {
struct Policy {
typedef CoarseTimePoint result_type;
// Workaround for a gcc bug. That does not understand that Comparator is actually being used.
__attribute__((unused)) typedef std::less<result_type> Comparator;
static result_type NotEnoughPeersValue() {
return result_type::min();
}
static result_type InfiniteWatermarkForLocalPeer() {
return result_type::max();
}
static result_type ExtractValue(const TrackedPeer& peer) {
auto lease_exp = peer.leader_lease_expiration.last_received;
return lease_exp != CoarseTimePoint() ? lease_exp : CoarseTimePoint::min();
}
static const char* Name() {
return "Leader lease expiration";
}
};
return GetWatermark<Policy>();
}
MicrosTime PeerMessageQueue::HybridTimeLeaseExpirationWatermark() {
struct Policy {
typedef MicrosTime result_type;
// Workaround for a gcc bug. That does not understand that Comparator is actually being used.
__attribute__((unused)) typedef std::less<result_type> Comparator;
static result_type NotEnoughPeersValue() {
return HybridTime::kMin.GetPhysicalValueMicros();
}
static result_type InfiniteWatermarkForLocalPeer() {
return HybridTime::kMax.GetPhysicalValueMicros();
}
static result_type ExtractValue(const TrackedPeer& peer) {
return peer.leader_ht_lease_expiration.last_received;
}
static const char* Name() {
return "Hybrid time leader lease expiration";
}
};
return GetWatermark<Policy>();
}
uint64_t PeerMessageQueue::NumSSTFilesWatermark() {
struct Policy {
typedef uint64_t result_type;
// Workaround for a gcc bug. That does not understand that Comparator is actually being used.
__attribute__((unused)) typedef std::greater<result_type> Comparator;
static result_type NotEnoughPeersValue() {
return 0;
}
static result_type ExtractValue(const TrackedPeer& peer) {
return peer.num_sst_files;
}
static const char* Name() {
return "Num SST files";
}
};
auto watermark = GetWatermark<Policy>();
return std::max(watermark, local_peer_->num_sst_files);
}
OpId PeerMessageQueue::OpIdWatermark() {
struct Policy {
typedef OpId result_type;
static result_type NotEnoughPeersValue() {
return OpId::Min();
}
static result_type ExtractValue(const TrackedPeer& peer) {
return peer.last_received;
}
struct Comparator {
bool operator()(const OpId& lhs, const OpId& rhs) {
return lhs.index < rhs.index;
}
};
static const char* Name() {
return "OpId";
}
};
return GetWatermark<Policy>();
}
void PeerMessageQueue::NotifyPeerIsResponsiveDespiteError(const std::string& peer_uuid) {
LockGuard l(queue_lock_);
TrackedPeer* peer = FindPtrOrNull(peers_map_, peer_uuid);
if (!peer) return;
peer->last_successful_communication_time = MonoTime::Now();
}
void PeerMessageQueue::RequestWasNotSent(const std::string& peer_uuid) {
LockGuard scoped_lock(queue_lock_);
DCHECK_NE(State::kQueueConstructed, queue_state_.state);
TrackedPeer* peer = FindPtrOrNull(peers_map_, peer_uuid);
if (PREDICT_FALSE(queue_state_.state != State::kQueueOpen || peer == nullptr)) {
LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Queue is closed or peer was untracked.";
return;
}
peer->ResetLastRequest();
}
bool PeerMessageQueue::ResponseFromPeer(const std::string& peer_uuid,
const ConsensusResponsePB& response) {
DCHECK(response.IsInitialized()) << "Error: Uninitialized: "
<< response.InitializationErrorString() << ". Response: " << response.ShortDebugString();
MajorityReplicatedData majority_replicated;
Mode mode_copy;
bool result = false;
{
LockGuard scoped_lock(queue_lock_);
DCHECK_NE(State::kQueueConstructed, queue_state_.state);
TrackedPeer* peer = FindPtrOrNull(peers_map_, peer_uuid);
if (PREDICT_FALSE(queue_state_.state != State::kQueueOpen || peer == nullptr)) {
LOG_WITH_PREFIX_UNLOCKED(WARNING) << "Queue is closed or peer was untracked, disregarding "
"peer response. Response: " << response.ShortDebugString();
return false;
}
// Remotely bootstrap the peer if the tablet is not found or deleted.
if (response.has_error()) {
// We only let special types of errors through to this point from the peer.
CHECK_EQ(tserver::TabletServerErrorPB::TABLET_NOT_FOUND, response.error().code())
<< response.ShortDebugString();
peer->needs_remote_bootstrap = true;
// Since we received a response from the peer, we know it is alive. So we need to update
// peer->last_successful_communication_time, otherwise, we will remove this peer from the
// configuration if the remote bootstrap is not completed within
// FLAGS_follower_unavailable_considered_failed_sec seconds.
peer->last_successful_communication_time = MonoTime::Now();
YB_LOG_WITH_PREFIX_UNLOCKED_EVERY_N_SECS(INFO, 30)
<< "Marked peer as needing remote bootstrap: " << peer->ToString();
return true;
}
if (queue_state_.active_config) {
RaftPeerPB peer_pb;
if (!GetRaftConfigMember(*queue_state_.active_config, peer_uuid, &peer_pb).ok()) {
LOG(FATAL) << "Peer " << peer_uuid << " not in active config";
}
peer->member_type = peer_pb.member_type();
} else {
peer->member_type = RaftPeerPB::UNKNOWN_MEMBER_TYPE;
}
// Application level errors should be handled elsewhere
DCHECK(!response.has_error());
// Take a snapshot of the current peer status.
TrackedPeer previous = *peer;
// Update the peer status based on the response.
peer->is_new = false;
peer->last_successful_communication_time = MonoTime::Now();
peer->ResetLastRequest();
if (response.has_status()) {
const auto& status = response.status();
// Sanity checks. Some of these can be eventually removed, but they are handy for now.
DCHECK(status.IsInitialized()) << "Error: Uninitialized: "
<< response.InitializationErrorString()
<< ". Response: " << response.ShortDebugString();
// The status must always have a last received op id and a last committed index.
DCHECK(status.has_last_received());
DCHECK(status.has_last_received_current_leader());
DCHECK(status.has_last_committed_idx());
peer->last_known_committed_idx = status.last_committed_idx();
peer->last_applied = OpId::FromPB(status.last_applied());
// If the reported last-received op for the replica is in our local log, then resume sending
// entries from that point onward. Otherwise, resume after the last op they received from us.
// If we've never successfully sent them anything, start after the last-committed op in their
// log, which is guaranteed by the Raft protocol to be a valid op.
bool peer_has_prefix_of_log = IsOpInLog(yb::OpId::FromPB(status.last_received()));
if (peer_has_prefix_of_log) {
// If the latest thing in their log is in our log, we are in sync.
peer->last_received = OpId::FromPB(status.last_received());
peer->next_index = peer->last_received.index + 1;
} else if (!OpIdEquals(status.last_received_current_leader(), MinimumOpId())) {
// Their log may have diverged from ours, however we are in the process of replicating our
// ops to them, so continue doing so. Eventually, we will cause the divergent entry in their
// log to be overwritten.
peer->last_received = OpId::FromPB(status.last_received_current_leader());
peer->next_index = peer->last_received.index + 1;
} else {
// The peer is divergent and they have not (successfully) received anything from us yet.
// Start sending from their last committed index. This logic differs from the Raft spec
// slightly because instead of stepping back one-by-one from the end until we no longer have
// an LMP error, we jump back to the last committed op indicated by the peer with the hope
// that doing so will result in a faster catch-up process.
DCHECK_GE(peer->last_known_committed_idx, 0);
peer->next_index = peer->last_known_committed_idx + 1;
}
if (PREDICT_FALSE(status.has_error())) {
peer->is_last_exchange_successful = false;
switch (status.error().code()) {
case ConsensusErrorPB::PRECEDING_ENTRY_DIDNT_MATCH: {
DCHECK(status.has_last_received());
if (previous.is_new) {
// That's currently how we can detect that we able to connect to a peer.
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Connected to new peer: " << peer->ToString();
} else {
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Got LMP mismatch error from peer: "
<< peer->ToString();
CHECK(!FLAGS_TEST_disallow_lmp_failures);
}
return true;
}
case ConsensusErrorPB::INVALID_TERM: {
CHECK(response.has_responder_term());
LOG_WITH_PREFIX_UNLOCKED(INFO) << "Peer responded invalid term: " << peer->ToString()
<< ". Peer's new term: " << response.responder_term();
NotifyObserversOfTermChange(response.responder_term());
return false;
}
default: {
LOG_WITH_PREFIX_UNLOCKED(FATAL) << "Unexpected consensus error. Code: "
<< ConsensusErrorPB::Code_Name(status.error().code()) << ". Response: "
<< response.ShortDebugString();
}
}
}
}
peer->is_last_exchange_successful = true;
peer->num_sst_files = response.num_sst_files();
if (response.has_responder_term()) {
// The peer must have responded with a term that is greater than or equal to the last known
// term for that peer.
peer->CheckMonotonicTerms(response.responder_term());
// If the responder didn't send an error back that must mean that it has a term that is the
// same or lower than ours.
CHECK_LE(response.responder_term(), queue_state_.current_term);
}
if (PREDICT_FALSE(VLOG_IS_ON(2))) {
VLOG_WITH_PREFIX_UNLOCKED(2) << "Received Response from Peer (" << peer->ToString() << "). "
<< "Response: " << response.ShortDebugString();
}
// If our log has the next request for the peer or if the peer's committed index is lower than
// our own, set 'more_pending' to true.
result = log_cache_.HasOpBeenWritten(peer->next_index) ||
(peer->last_known_committed_idx < queue_state_.committed_op_id.index);
mode_copy = queue_state_.mode;
if (mode_copy == Mode::LEADER) {
auto new_majority_replicated_opid = OpIdWatermark();
if (new_majority_replicated_opid != OpId::Min()) {
if (new_majority_replicated_opid.index == MaximumOpId().index()) {
queue_state_.majority_replicated_op_id = local_peer_->last_received;
} else {
queue_state_.majority_replicated_op_id = new_majority_replicated_opid;
}
}
peer->leader_lease_expiration.OnReplyFromFollower();
peer->leader_ht_lease_expiration.OnReplyFromFollower();
majority_replicated.op_id = queue_state_.majority_replicated_op_id;
majority_replicated.leader_lease_expiration = LeaderLeaseExpirationWatermark();
majority_replicated.ht_lease_expiration = HybridTimeLeaseExpirationWatermark();
majority_replicated.num_sst_files = NumSSTFilesWatermark();
if (peer->last_received == queue_state_.last_applied_op_id) {
majority_replicated.peer_got_all_ops = peer->uuid;
}
}
UpdateAllReplicatedOpId(&queue_state_.all_replicated_op_id);
UpdateAllAppliedOpId(&queue_state_.all_applied_op_id);
auto evict_index = GetCDCConsumerOpIdToEvict().index;
int32_t lagging_follower_threshold = FLAGS_consensus_lagging_follower_threshold;
if (lagging_follower_threshold > 0) {
UpdateAllNonLaggingReplicatedOpId(lagging_follower_threshold);
evict_index = std::min(evict_index, queue_state_.all_nonlagging_replicated_op_id.index);
} else {
evict_index = std::min(evict_index, queue_state_.all_replicated_op_id.index);
}
log_cache_.EvictThroughOp(evict_index);
UpdateMetrics();
}
if (mode_copy == Mode::LEADER) {
NotifyObserversOfMajorityReplOpChange(majority_replicated);
}
return result;
}
PeerMessageQueue::TrackedPeer PeerMessageQueue::GetTrackedPeerForTests(string uuid) {
LockGuard scoped_lock(queue_lock_);
TrackedPeer* tracked = FindOrDie(peers_map_, uuid);
return *tracked;
}
OpId PeerMessageQueue::TEST_GetAllReplicatedIndex() const {
LockGuard lock(queue_lock_);
return queue_state_.all_replicated_op_id;
}
OpId PeerMessageQueue::GetAllAppliedOpId() const {
LockGuard lock(queue_lock_);
return queue_state_.all_applied_op_id;
}
OpId PeerMessageQueue::TEST_GetCommittedIndex() const {
LockGuard lock(queue_lock_);
return queue_state_.committed_op_id;
}
OpId PeerMessageQueue::TEST_GetMajorityReplicatedOpId() const {
LockGuard lock(queue_lock_);
return queue_state_.majority_replicated_op_id;
}
OpId PeerMessageQueue::TEST_GetLastAppended() const {
LockGuard lock(queue_lock_);
return queue_state_.last_appended;
}
OpId PeerMessageQueue::TEST_GetLastAppliedOpId() const {
LockGuard lock(queue_lock_);
return queue_state_.last_applied_op_id;
}
void PeerMessageQueue::UpdateMetrics() {
// Since operations have consecutive indices we can update the metrics based on simple index math.
metrics_.num_majority_done_ops->set_value(
queue_state_.committed_op_id.index - queue_state_.all_replicated_op_id.index);
metrics_.num_in_progress_ops->set_value(
queue_state_.last_appended.index - queue_state_.committed_op_id.index);
}
void PeerMessageQueue::DumpToHtml(std::ostream& out) const {
using std::endl;
LockGuard lock(queue_lock_);
out << "<h3>Watermarks</h3>" << endl;
out << "<table>" << endl;;
out << " <tr><th>Peer</th><th>Watermark</th></tr>" << endl;
for (const PeersMap::value_type& entry : peers_map_) {
out << Substitute(" <tr><td>$0</td><td>$1</td></tr>",
EscapeForHtmlToString(entry.first),
EscapeForHtmlToString(entry.second->ToString())) << endl;
}
out << "</table>" << endl;
log_cache_.DumpToHtml(out);
}
void PeerMessageQueue::ClearUnlocked() {
STLDeleteValues(&peers_map_);
queue_state_.state = State::kQueueClosed;
}
void PeerMessageQueue::Close() {
if (installed_num_sst_files_changed_listener_) {
context_->ListenNumSSTFilesChanged(std::function<void()>());
installed_num_sst_files_changed_listener_ = false;
}
raft_pool_observers_token_->Shutdown();
LockGuard lock(queue_lock_);
ClearUnlocked();
}
string PeerMessageQueue::ToString() const {
// Even though metrics are thread-safe obtain the lock so that we get a "consistent" snapshot of
// the metrics.
LockGuard lock(queue_lock_);
return ToStringUnlocked();
}
string PeerMessageQueue::ToStringUnlocked() const {
return Substitute("Consensus queue metrics:"
"Only Majority Done Ops: $0, In Progress Ops: $1, Cache: $2",
metrics_.num_majority_done_ops->value(), metrics_.num_in_progress_ops->value(),
log_cache_.StatsString());
}
void PeerMessageQueue::RegisterObserver(PeerMessageQueueObserver* observer) {
LockGuard lock(queue_lock_);
auto iter = std::find(observers_.begin(), observers_.end(), observer);
if (iter == observers_.end()) {
observers_.push_back(observer);
}
}
Status PeerMessageQueue::UnRegisterObserver(PeerMessageQueueObserver* observer) {
LockGuard lock(queue_lock_);
auto iter = std::find(observers_.begin(), observers_.end(), observer);
if (iter == observers_.end()) {
return STATUS(NotFound, "Can't find observer.");
}
observers_.erase(iter);
return Status::OK();
}
const char* PeerMessageQueue::ModeToStr(Mode mode) {
switch (mode) {
case Mode::LEADER: return "LEADER";
case Mode::NON_LEADER: return "NON_LEADER";
}
FATAL_INVALID_ENUM_VALUE(PeerMessageQueue::Mode, mode);
}
const char* PeerMessageQueue::StateToStr(State state) {
switch (state) {
case State::kQueueConstructed:
return "QUEUE_CONSTRUCTED";
case State::kQueueOpen:
return "QUEUE_OPEN";
case State::kQueueClosed:
return "QUEUE_CLOSED";
}
FATAL_INVALID_ENUM_VALUE(PeerMessageQueue::State, state);
}
bool PeerMessageQueue::IsOpInLog(const yb::OpId& desired_op) const {
auto result = log_cache_.LookupOpId(desired_op.index);
if (PREDICT_TRUE(result.ok())) {
return desired_op == *result;
}
if (PREDICT_TRUE(result.status().IsNotFound() || result.status().IsIncomplete())) {
return false;
}
LOG_WITH_PREFIX_UNLOCKED(FATAL) << "Error while reading the log: " << result.status();
return false; // Unreachable; here to squelch GCC warning.
}
void PeerMessageQueue::NotifyObserversOfMajorityReplOpChange(
const MajorityReplicatedData& majority_replicated_data) {
WARN_NOT_OK(raft_pool_observers_token_->SubmitClosure(
Bind(&PeerMessageQueue::NotifyObserversOfMajorityReplOpChangeTask,
Unretained(this),
majority_replicated_data)),
LogPrefixUnlocked() + "Unable to notify RaftConsensus of "
"majority replicated op change.");
}
template <class Func>
void PeerMessageQueue::NotifyObservers(const char* title, Func&& func) {
WARN_NOT_OK(
raft_pool_observers_token_->SubmitFunc(
[this, func = std::move(func)] {
MAYBE_INJECT_RANDOM_LATENCY(FLAGS_consensus_inject_latency_ms_in_notifications);
std::vector<PeerMessageQueueObserver*> copy;
{
LockGuard lock(queue_lock_);
copy = observers_;
}
for (PeerMessageQueueObserver* observer : copy) {
func(observer);
}
}),
Format("$0Unable to notify observers for $1.", LogPrefixUnlocked(), title));
}
void PeerMessageQueue::NotifyObserversOfTermChange(int64_t term) {
NotifyObservers("term change", [term](PeerMessageQueueObserver* observer) {
observer->NotifyTermChange(term);
});
}
void PeerMessageQueue::NotifyObserversOfMajorityReplOpChangeTask(
const MajorityReplicatedData& majority_replicated_data) {
std::vector<PeerMessageQueueObserver*> copy;
{
LockGuard lock(queue_lock_);
copy = observers_;
}
// TODO move commit index advancement here so that the queue is not dependent on consensus at all,
// but that requires a bit more work.
OpId new_committed_op_id;
OpId last_applied_op_id;
for (PeerMessageQueueObserver* observer : copy) {
observer->UpdateMajorityReplicated(
majority_replicated_data, &new_committed_op_id, &last_applied_op_id);
}
{
LockGuard lock(queue_lock_);
if (!new_committed_op_id.empty() &&
new_committed_op_id.index > queue_state_.committed_op_id.index) {
queue_state_.committed_op_id = new_committed_op_id;
}
queue_state_.last_applied_op_id.MakeAtLeast(last_applied_op_id);
local_peer_->last_applied = queue_state_.last_applied_op_id;
UpdateAllAppliedOpId(&queue_state_.all_applied_op_id);
}
}
void PeerMessageQueue::NotifyObserversOfFailedFollower(const string& uuid,
const string& reason) {
int64_t current_term;
{
LockGuard lock(queue_lock_);
current_term = queue_state_.current_term;
}
NotifyObserversOfFailedFollower(uuid, current_term, reason);
}
void PeerMessageQueue::NotifyObserversOfFailedFollower(const string& uuid,
int64_t term,
const string& reason) {
NotifyObservers("failed follower", [uuid, term, reason](PeerMessageQueueObserver* observer) {
observer->NotifyFailedFollower(uuid, term, reason);
});
}
bool PeerMessageQueue::PeerAcceptedOurLease(const std::string& uuid) const {
std::lock_guard<simple_spinlock> lock(queue_lock_);
TrackedPeer* peer = FindPtrOrNull(peers_map_, uuid);
if (peer == nullptr) {
return false;
}
return peer->leader_lease_expiration.last_received != CoarseTimePoint();
}
bool PeerMessageQueue::CanPeerBecomeLeader(const std::string& peer_uuid) const {
std::lock_guard<simple_spinlock> lock(queue_lock_);
TrackedPeer* peer = FindPtrOrNull(peers_map_, peer_uuid);
if (peer == nullptr) {
LOG(ERROR) << "Invalid peer UUID: " << peer_uuid;
return false;
}
const bool peer_can_be_leader = peer->last_received >= queue_state_.majority_replicated_op_id;
if (!peer_can_be_leader) {
LOG(INFO) << Format(
"Peer $0 cannot become Leader as it is not caught up: Majority OpId $1, Peer OpId $2",
peer_uuid, queue_state_.majority_replicated_op_id, peer->last_received);
}
return peer_can_be_leader;
}
OpId PeerMessageQueue::PeerLastReceivedOpId(const TabletServerId& uuid) const {
std::lock_guard<simple_spinlock> lock(queue_lock_);
TrackedPeer* peer = FindPtrOrNull(peers_map_, uuid);
if (peer == nullptr) {
LOG(ERROR) << "Invalid peer UUID: " << uuid;
return OpId::Min();
}
return peer->last_received;
}
string PeerMessageQueue::GetUpToDatePeer() const {
OpId highest_op_id = OpId::Min();
std::vector<std::string> candidates;
{
std::lock_guard<simple_spinlock> lock(queue_lock_);
for (const PeersMap::value_type& entry : peers_map_) {
if (local_peer_uuid_ == entry.first) {
continue;
}
if (highest_op_id > entry.second->last_received) {
continue;
} else if (highest_op_id == entry.second->last_received) {
candidates.push_back(entry.first);
} else {
candidates = {entry.first};
highest_op_id = entry.second->last_received;
}
}
}
if (candidates.empty()) {
return string();
}
size_t index = 0;
if (candidates.size() > 1) {
// choose randomly among candidates at the same opid
index = RandomUniformInt<size_t>(0, candidates.size() - 1);
}
return candidates[index];
}
PeerMessageQueue::~PeerMessageQueue() {
Close();
}
string PeerMessageQueue::LogPrefixUnlocked() const {
// TODO: we should probably use an atomic here. We'll just annotate away the TSAN error for now,
// since the worst case is a slightly out-of-date log message, and not very likely.
Mode mode = ANNOTATE_UNPROTECTED_READ(queue_state_.mode);
return Substitute("T $0 P $1 [$2]: ",
tablet_id_,
local_peer_uuid_,
ModeToStr(mode));
}
string PeerMessageQueue::QueueState::ToString() const {
return Format(
"All replicated op: $0, Majority replicated op: $1, Committed index: $2, Last applied: $3, "
"Last appended: $4, Current term: $5, Majority size: $6, State: $7, Mode: $8$9",
/* 0 */ all_replicated_op_id,
/* 1 */ majority_replicated_op_id,
/* 2 */ committed_op_id,
/* 3 */ last_applied_op_id,
/* 4 */ last_appended,
/* 5 */ current_term,
/* 6 */ majority_size_,
/* 7 */ StateToStr(state),
/* 8 */ ModeToStr(mode),
/* 9 */ active_config ? ", active raft config: " + active_config->ShortDebugString() : "");
}
size_t PeerMessageQueue::LogCacheSize() {
return log_cache_.BytesUsed();
}
size_t PeerMessageQueue::EvictLogCache(size_t bytes_to_evict) {
return log_cache_.EvictThroughOp(std::numeric_limits<int64_t>::max(), bytes_to_evict);
}
Status PeerMessageQueue::FlushLogIndex() {
return log_cache_.FlushIndex();
}
Status PeerMessageQueue::CopyLogTo(const std::string& dest_dir) {
return log_cache_.CopyLogTo(dest_dir);
}
void PeerMessageQueue::TrackOperationsMemory(const OpIds& op_ids) {
log_cache_.TrackOperationsMemory(op_ids);
}
} // namespace consensus
} // namespace yb
|
#include "transport.hpp"
#include <assert.h>
#include <limits>
#include <vector>
#include <boost/intrusive/list.hpp>
#include <boost/intrusive/slist.hpp>
#include "union-find.hpp"
template <typename T>
class TransportGraph {
public:
TransportGraph(int sizeSupply, int sizeDemand)
: _sizeSupply(sizeSupply)
, _sizeDemand(sizeDemand)
, _nodes(sizeSupply+sizeDemand)
, _treeEdges(2*(sizeSupply+sizeDemand - 1))
{
for (int i = 0; i < _sizeSupply+_sizeDemand; ++i)
_nodes[i].id = i;
}
typedef boost::intrusive::list_base_hook<
boost::intrusive::link_mode<boost::intrusive::normal_link>
> ListHook;
struct Edge : public ListHook {
int target;
int edgeIdx;
Edge* reverse;
};
typedef boost::intrusive::list<Edge,
boost::intrusive::base_hook<ListHook>> EdgeList;
typedef boost::intrusive::slist_member_hook<
boost::intrusive::link_mode<boost::intrusive::normal_link>
> StackHook;
struct Node {
int id = 0;
T potential = 0;
EdgeList outEdges;
typename EdgeList::iterator dfsOutEdge;
StackHook stackHook;
bool inDfsStack = false;
};
typedef boost::intrusive::slist<Node,
boost::intrusive::member_hook<Node,
StackHook,
&Node::stackHook>
> NodeStack;
void addTreeEdge(int supply, int demand) {
assert(_numTreeEdges+2 <= static_cast<int>(_treeEdges.size()));
Edge& e1 = _treeEdges[_numTreeEdges];
Edge& e2 = _treeEdges[_numTreeEdges+1];
_numTreeEdges += 2;
int edgeIdx = supply*_sizeDemand+demand;
e1.target = demand+_sizeSupply;
e1.edgeIdx = edgeIdx;
e1.reverse = &e2;
e2.target = supply;
e2.edgeIdx = edgeIdx;
e2.reverse = &e1;
_nodes[supply].outEdges.push_back(e1);
_nodes[demand+_sizeSupply].outEdges.push_back(e2);
}
void augment(int supply, int demand, T* flows) {
int edgeIdx = supply*_sizeDemand+demand;
for (auto& n : _nodes)
n.inDfsStack = false;
NodeStack stack;
{
Node& startNode = _nodes.at(supply);
stack.push_front(startNode);
startNode.dfsOutEdge = startNode.outEdges.begin();
startNode.inDfsStack = true;
}
while (!stack.empty() && stack.front().id != demand+_sizeSupply) {
auto& n = stack.front();
if (n.dfsOutEdge == n.outEdges.end()) {
stack.pop_front();
assert(!stack.empty());
auto& nextN = stack.front();
assert(nextN.dfsOutEdge != nextN.outEdges.end());
assert(nextN.dfsOutEdge->target == n.id);
nextN.dfsOutEdge++;
continue;
} else {
int target = n.dfsOutEdge->target;
auto& nextN = _nodes.at(target);
if (nextN.inDfsStack) {
n.dfsOutEdge++;
continue;
} else {
stack.push_front(nextN);
nextN.dfsOutEdge = nextN.outEdges.begin();
nextN.inDfsStack = true;
continue;
}
}
}
assert(!stack.empty());
assert(stack.front().id == demand+_sizeSupply);
assert((stack.size() % 2) == 0);
stack.pop_front();
T bottleneckFlow = std::numeric_limits<T>::max();
Edge* bottleneckEdge = nullptr;
bool parity = true;
for (auto& n : stack) {
if (parity) {
auto& e = *n.dfsOutEdge;
auto f = flows[e.edgeIdx];
if (f < bottleneckFlow) {
bottleneckFlow = f;
bottleneckEdge = &e;
}
}
parity = !parity;
}
assert(bottleneckFlow < std::numeric_limits<T>::max());
assert(bottleneckEdge != nullptr);
parity = true;
for (auto& n : stack) {
auto& e = *n.dfsOutEdge;
if (parity)
flows[e.edgeIdx] -= bottleneckFlow;
else
flows[e.edgeIdx] += bottleneckFlow;
parity = !parity;
}
flows[edgeIdx] += bottleneckFlow;
Edge& e1 = *bottleneckEdge;
Edge& e2 = *e1.reverse;
{
Node& n1 = _nodes[e2.target];
Node& n2 = _nodes[e1.target];
n1.outEdges.erase(n1.outEdges.iterator_to(e1));
n2.outEdges.erase(n2.outEdges.iterator_to(e2));
}
{
Node& n1 = _nodes[supply];
Node& n2 = _nodes[demand+_sizeSupply];
e1.target = demand+_sizeSupply;
e1.edgeIdx = edgeIdx;
e1.reverse = &e2;
e2.target = supply;
e2.edgeIdx = edgeIdx;
e2.reverse = &e1;
n1.outEdges.push_back(e1);
n2.outEdges.push_back(e2);
}
}
void updatePotentials(const T* costs) {
for (auto& n : _nodes) {
n.potential = 0;
n.inDfsStack = false;
}
NodeStack stack;
{
Node& startNode = _nodes.at(0);
stack.push_front(startNode);
startNode.dfsOutEdge = startNode.outEdges.begin();
startNode.inDfsStack = true;
}
while (!stack.empty()) {
auto& n = stack.front();
if (n.dfsOutEdge == n.outEdges.end()) {
stack.pop_front();
if(!stack.empty()) {
auto& nextN = stack.front();
assert(nextN.dfsOutEdge != nextN.outEdges.end());
assert(nextN.dfsOutEdge->target == n.id);
nextN.dfsOutEdge++;
}
continue;
} else {
int target = n.dfsOutEdge->target;
auto& nextN = _nodes.at(target);
if (nextN.inDfsStack) {
n.dfsOutEdge++;
continue;
} else {
int edgeIdx = n.dfsOutEdge->edgeIdx;
T c = costs[edgeIdx];
nextN.potential = c - n.potential;
stack.push_front(nextN);
nextN.dfsOutEdge = nextN.outEdges.begin();
nextN.inDfsStack = true;
continue;
}
}
}
}
std::tuple<int, int, T> findPivot(const T* costs) {
std::tuple<int, int, T> minEdge
= {0, 0, std::numeric_limits<T>::max()};
for (int i = 0; i < _sizeSupply; ++i) {
for (int j = 0; j < _sizeDemand; ++j) {
int edgeIdx = i*_sizeDemand+j;
T resCost = costs[edgeIdx]
- _nodes[i].potential
- _nodes[j+_sizeSupply].potential;
if (resCost < std::get<2>(minEdge))
minEdge = {i, j, resCost};
}
}
return minEdge;
}
int _sizeSupply;
int _sizeDemand;
int _numTreeEdges = 0;
std::vector<Node> _nodes;
std::vector<Edge> _treeEdges;
};
template <typename T>
double solveTransport(int sizeSupply, int sizeDemand, const T* costs,
const T* supply, const T* demand, T* flow) {
T sumSupply = 0;
for (int i = 0; i < sizeSupply; ++i)
sumSupply += supply[i];
T sumDemand = 0;
for (int j = 0; j < sizeDemand; ++j)
sumDemand += demand[j];
assert(fabs(sumSupply - sumDemand) < 1e-5);
for (int k = 0; k < sizeSupply*sizeDemand; ++k)
flow[k] = 0;
std::vector<T> resSupply(supply, supply+sizeSupply);
std::vector<T> resDemand(demand, demand+sizeDemand);
TransportGraph<T> graph{sizeSupply, sizeDemand};
int numNodes = sizeSupply+sizeDemand;
auto uf = UnionFind{numNodes};
for (int k = 0; k < numNodes-1; ++k) {
T minCost = std::numeric_limits<T>::max();
int minI = 0;
int minJ = 0;
for (int i = 0; i < sizeSupply; ++i) {
if (resSupply.at(i) <= 0)
continue;
auto comp_i = uf.Find(i);
for (int j = 0; j < sizeDemand; ++j) {
if (resDemand.at(j) <= 0)
continue;
auto comp_j = uf.Find(j+sizeSupply);
if (comp_i == comp_j)
continue;
if (costs[i*sizeDemand+j] < minCost) {
minCost = costs[i*sizeDemand+j];
minI = i;
minJ = j;
}
}
}
if (minCost == std::numeric_limits<T>::max())
break;
assert(uf.Find(minI) != uf.Find(minJ+sizeSupply));
T f = std::min(resSupply.at(minI), resDemand.at(minJ));
resSupply.at(minI) -= f;
resDemand.at(minJ) -= f;
flow[minI*sizeDemand+minJ] += f;
graph.addTreeEdge(minI, minJ);
uf.Merge(minI, minJ+sizeSupply);
}
// Add any unconnected components to connect to 0
for (int i = 0; i < sizeSupply; ++i) {
if (uf.Find(i) != uf.Find(0+sizeSupply)) {
graph.addTreeEdge(i, 0);
uf.Merge(i, 0+sizeSupply);
}
}
for (int j = 0; j < sizeDemand; ++j) {
if (uf.Find(0) != uf.Find(j+sizeSupply)) {
graph.addTreeEdge(0, j);
uf.Merge(0, j+sizeSupply);
}
}
#ifndef NDEBUG
for (auto s : resSupply) {
assert(fabs(s) < 1e-5);
}
for (auto d : resDemand)
assert(fabs(d) < 1e-5);
#endif
while (true) {
graph.updatePotentials(costs);
std::tuple<int, int, T> minEdge = graph.findPivot(costs);
if (std::get<2>(minEdge) < 0)
graph.augment(std::get<0>(minEdge), std::get<1>(minEdge), flow);
else
break;
}
double cost = 0;
for (int i = 0; i < sizeSupply; ++i) {
for (int j = 0; j < sizeDemand; ++j) {
int idx = i*sizeDemand + j;
cost += flow[idx] * costs[idx];
}
}
return cost;
}
#define INSTANTIATE_TRANSPORT(T) \
template double solveTransport<T>(int sizeSupply, int sizeDemand, \
const T* costs, const T* supply, const T* demand, T* flow);
INSTANTIATE_TRANSPORT(double)
INSTANTIATE_TRANSPORT(int32_t)
INSTANTIATE_TRANSPORT(int64_t)
#undef INSTANTIATE_TRANSPORT
|
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
char str[66];
cin>>str;
for(int i=0;i<strlen(str);i++){
printf("%c",str[i]+2);
}
return 0;
}
|
#pragma once
#include "Matrix.hpp"
namespace kmaths
{
template<class T>
using Matrix4x2 = Matrix<T, 4, 2>;
using Matrix4x2s = Matrix4x2 < int >; // 4 rows - 2 columns - signed integer
using Matrix4x2f = Matrix4x2 < float >; // 4 rows - 2 columns - floating point
using Matrix4x2d = Matrix4x2 < double >; // 4 rows - 2 columns - double floating point
}
|
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// Test that libFuzzer itself does not read out of bounds.
#include <assert.h>
#include <cstdint>
#include <cstring>
#include <cstdlib>
#include <cstddef>
#include <iostream>
static volatile int Sink;
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (Size < 5) return 0;
const char *Ch = reinterpret_cast<const char *>(Data);
if (Ch[Size - 3] == 'a')
Sink = strncmp(Ch + Size - 3, "abcdefg", 6);
return 0;
}
|
#include <vtkImageData.h>
#include <vtkInteractorStyleImage.h>
#include <vtkTIFFWriter.h>
#include <vtkSmartPointer.h>
#include <vtkImageCanvasSource2D.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkImageActor.h>
#include <vtkImageMapper3D.h>
#include <vtkTIFFReader.h>
int main(int argc, char *argv[])
{
if(argc != 2)
{
std::cout << "Required parameters: OutputFilename.tif" << std::endl;
return EXIT_FAILURE;
}
std::string filename = argv[1];
vtkSmartPointer<vtkImageCanvasSource2D> imageSource =
vtkSmartPointer<vtkImageCanvasSource2D>::New();
imageSource->SetScalarTypeToUnsignedChar();
imageSource->SetExtent(0,9,0,9,0,0);
imageSource->SetNumberOfScalarComponents(3);
imageSource->SetDrawColor(0, 0, 0, 0);
imageSource->FillBox(0,9,0,9);
imageSource->SetDrawColor(255, 0, 0, 0);
imageSource->FillBox(5,7,5,7);
imageSource->Update();
vtkSmartPointer<vtkTIFFWriter> tiffWriter =
vtkSmartPointer<vtkTIFFWriter>::New();
tiffWriter->SetFileName(filename.c_str());
tiffWriter->SetInputConnection(imageSource->GetOutputPort());
tiffWriter->Write();
// Read and display for verification
vtkSmartPointer<vtkTIFFReader> reader =
vtkSmartPointer<vtkTIFFReader>::New();
reader->SetFileName(filename.c_str());
reader->Update();
vtkSmartPointer<vtkImageActor> actor =
vtkSmartPointer<vtkImageActor>::New();
actor->GetMapper()->SetInputConnection(reader->GetOutputPort());
// Setup renderer
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
renderer->AddActor(actor);
renderer->ResetCamera();
// Setup render window
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
// Setup render window interactor
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
vtkSmartPointer<vtkInteractorStyleImage> style =
vtkSmartPointer<vtkInteractorStyleImage>::New();
renderWindowInteractor->SetInteractorStyle(style);
// Render and start interaction
renderWindowInteractor->SetRenderWindow(renderWindow);
renderWindow->Render();
renderWindowInteractor->Initialize();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
|
#include <windows.h>
#include <iostream>
#include <wchar.h>
#define INTERCEPTION_STATIC
#include "../interception/library/interception.h"
extern "C" {
#include "../interception/library/interception.c"
}
using namespace std;
int main() {
// 高優先度化
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
//Interceptionのインスタンス生成
auto context = interception_create_context();
if (!context) {
cout << "Failed to create Intercaption context" << endl;
return 1;
}
interception_set_filter(context, interception_is_keyboard, INTERCEPTION_FILTER_KEY_ALL);
interception_set_filter(context, interception_is_mouse, INTERCEPTION_FILTER_MOUSE_ALL);
// 入力を処理する
InterceptionDevice device;
InterceptionStroke stroke;
while (interception_receive(context, device = interception_wait(context), &stroke, 1) > 0) {
if (interception_is_keyboard(device)) {
InterceptionKeyStroke& s = *(InterceptionKeyStroke*)&stroke;
cout << "Keyboard Input "
<< "ScanCode=" << s.code
<< " State=" << s.state << endl;
}
else if (interception_is_mouse(device)) {
InterceptionMouseStroke& s = *(InterceptionMouseStroke*)&stroke;
cout << "Mouse Input"
<< " State=" << s.state
<< " Rolling=" << s.rolling
<< " Flags=" << s.flags
<< " (x,y)=(" << s.x << "," << s.y << ")"
<< endl;
}
// 全てのデバイスの入力を通過させる
interception_send(context, device, &stroke, 1);
if (interception_is_keyboard(device)) { // Escapeで終了
InterceptionKeyStroke& s = *(InterceptionKeyStroke*)&stroke;
if (s.code == 1) break;
}
}
interception_destroy_context(context);
return 0;
}
|
#pragma once
#include "../../JObject.hpp"
class JObject;
class JString;
namespace android::util
{
class SparseArray : public JObject
{
public:
// Fields
// QJniObject forward
template<typename ...Ts> explicit SparseArray(const char *className, const char *sig, Ts...agv) : JObject(className, sig, std::forward<Ts>(agv)...) {}
SparseArray(QJniObject obj);
// Constructors
SparseArray();
SparseArray(jint arg0);
// Methods
void append(jint arg0, JObject arg1) const;
void clear() const;
android::util::SparseArray clone() const;
jboolean contains(jint arg0) const;
jboolean contentEquals(android::util::SparseArray arg0) const;
jint contentHashCode() const;
void delete_(jint arg0) const;
JObject get(jint arg0) const;
JObject get(jint arg0, JObject arg1) const;
jint indexOfKey(jint arg0) const;
jint indexOfValue(JObject arg0) const;
jint keyAt(jint arg0) const;
void put(jint arg0, JObject arg1) const;
void remove(jint arg0) const;
void removeAt(jint arg0) const;
void removeAtRange(jint arg0, jint arg1) const;
void set(jint arg0, JObject arg1) const;
void setValueAt(jint arg0, JObject arg1) const;
jint size() const;
JString toString() const;
JObject valueAt(jint arg0) const;
};
} // namespace android::util
|
/*
* Copyright 2018 Google
*
* 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 "Firestore/core/src/firebase/firestore/immutable/array_sorted_map.h"
#include <algorithm>
#include <numeric>
#include <random>
#include "Firestore/core/src/firebase/firestore/util/secure_random.h"
#include "Firestore/core/test/firebase/firestore/immutable/testing.h"
#include "gtest/gtest.h"
namespace firebase {
namespace firestore {
namespace immutable {
namespace impl {
using IntMap = ArraySortedMap<int, int>;
constexpr IntMap::size_type kFixedSize = IntMap::kFixedSize;
TEST(ArraySortedMap, ChecksSize) {
std::vector<int> to_insert = Sequence(kFixedSize);
IntMap map = ToMap<IntMap>(to_insert);
// Replacing an existing entry should not hit increase size
map = map.insert(5, 10);
int next = kFixedSize;
ASSERT_ANY_THROW(map.insert(next, next));
}
TEST(ArraySortedMap, InitializerIsSorted) {
IntMap map{{3, 0}, {2, 0}, {1, 0}};
EXPECT_TRUE(std::is_sorted(map.begin(), map.end()));
}
} // namespace impl
} // namespace immutable
} // namespace firestore
} // namespace firebase
|
// Copyright (c) 2014, the Scal Project Authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.
#define __STDC_FORMAT_MACROS 1 // we want PRIu64 and friends
#include <gflags/gflags.h>
#include <inttypes.h>
#include <string.h>
#include <new>
#include "benchmark/std_glue/std_pipe_api.h"
#include "datastructures/balancer_local_linearizability.h"
#include "datastructures/distributed_data_structure.h"
#include "datastructures/ms_queue.h"
DEFINE_uint64(p, 80, "number of partial queues");
void* ds_new(void) {
return static_cast<void*>(
new scal::DistributedDataStructure
<uint64_t, scal::MSQueue<uint64_t>,
scal::BalancerLocalLinearizability>(
FLAGS_p,
g_num_threads + 1,
new scal::BalancerLocalLinearizability(FLAGS_p)));
}
char* ds_get_stats(void) { return NULL; }
|
// Copyright (c) 2005-2014 Code Synthesis Tools CC
//
// This program was generated by CodeSynthesis XSD, an XML Schema to
// C++ data binding compiler.
//
// 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.
//
// 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 St, Fifth Floor, Boston, MA 02110-1301 USA
//
// In addition, as a special exception, Code Synthesis Tools CC gives
// permission to link this program with the Xerces-C++ library (or with
// modified versions of Xerces-C++ that use the same license as Xerces-C++),
// and distribute linked combinations including the two. You must obey
// the GNU General Public License version 2 in all respects for all of
// the code used other than Xerces-C++. If you modify this copy of the
// program, you may extend this exception to your version of the program,
// but you are not obligated to do so. If you do not wish to do so, delete
// this exception statement from your version.
//
// Furthermore, Code Synthesis Tools CC makes a special exception for
// the Free/Libre and Open Source Software (FLOSS) which is described
// in the accompanying FLOSSE file.
//
// Begin prologue.
//
//
// End prologue.
#include <xsd/cxx/pre.hxx>
#include "SimResultsViewSet.hxx"
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
// SimResultsViewSet
//
const SimResultsViewSet::ViewSetLayout_optional& SimResultsViewSet::
ViewSetLayout () const
{
return this->ViewSetLayout_;
}
SimResultsViewSet::ViewSetLayout_optional& SimResultsViewSet::
ViewSetLayout ()
{
return this->ViewSetLayout_;
}
void SimResultsViewSet::
ViewSetLayout (const ViewSetLayout_type& x)
{
this->ViewSetLayout_.set (x);
}
void SimResultsViewSet::
ViewSetLayout (const ViewSetLayout_optional& x)
{
this->ViewSetLayout_ = x;
}
const SimResultsViewSet::ViewSet_optional& SimResultsViewSet::
ViewSet () const
{
return this->ViewSet_;
}
SimResultsViewSet::ViewSet_optional& SimResultsViewSet::
ViewSet ()
{
return this->ViewSet_;
}
void SimResultsViewSet::
ViewSet (const ViewSet_type& x)
{
this->ViewSet_.set (x);
}
void SimResultsViewSet::
ViewSet (const ViewSet_optional& x)
{
this->ViewSet_ = x;
}
void SimResultsViewSet::
ViewSet (::std::auto_ptr< ViewSet_type > x)
{
this->ViewSet_.set (x);
}
const SimResultsViewSet::ViewSetString_optional& SimResultsViewSet::
ViewSetString () const
{
return this->ViewSetString_;
}
SimResultsViewSet::ViewSetString_optional& SimResultsViewSet::
ViewSetString ()
{
return this->ViewSetString_;
}
void SimResultsViewSet::
ViewSetString (const ViewSetString_type& x)
{
this->ViewSetString_.set (x);
}
void SimResultsViewSet::
ViewSetString (const ViewSetString_optional& x)
{
this->ViewSetString_ = x;
}
void SimResultsViewSet::
ViewSetString (::std::auto_ptr< ViewSetString_type > x)
{
this->ViewSetString_.set (x);
}
const SimResultsViewSet::ViewNumber_optional& SimResultsViewSet::
ViewNumber () const
{
return this->ViewNumber_;
}
SimResultsViewSet::ViewNumber_optional& SimResultsViewSet::
ViewNumber ()
{
return this->ViewNumber_;
}
void SimResultsViewSet::
ViewNumber (const ViewNumber_type& x)
{
this->ViewNumber_.set (x);
}
void SimResultsViewSet::
ViewNumber (const ViewNumber_optional& x)
{
this->ViewNumber_ = x;
}
const SimResultsViewSet::SubViewNumber_optional& SimResultsViewSet::
SubViewNumber () const
{
return this->SubViewNumber_;
}
SimResultsViewSet::SubViewNumber_optional& SimResultsViewSet::
SubViewNumber ()
{
return this->SubViewNumber_;
}
void SimResultsViewSet::
SubViewNumber (const SubViewNumber_type& x)
{
this->SubViewNumber_.set (x);
}
void SimResultsViewSet::
SubViewNumber (const SubViewNumber_optional& x)
{
this->SubViewNumber_ = x;
}
}
}
}
#include <xsd/cxx/xml/dom/parsing-source.hxx>
#include <xsd/cxx/tree/type-factory-map.hxx>
namespace _xsd
{
static
const ::xsd::cxx::tree::type_factory_plate< 0, char >
type_factory_plate_init;
}
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
// SimResultsViewSet
//
SimResultsViewSet::
SimResultsViewSet ()
: ::schema::simxml::ResourcesGeneral::SimResultsVisualization (),
ViewSetLayout_ (this),
ViewSet_ (this),
ViewSetString_ (this),
ViewNumber_ (this),
SubViewNumber_ (this)
{
}
SimResultsViewSet::
SimResultsViewSet (const RefId_type& RefId)
: ::schema::simxml::ResourcesGeneral::SimResultsVisualization (RefId),
ViewSetLayout_ (this),
ViewSet_ (this),
ViewSetString_ (this),
ViewNumber_ (this),
SubViewNumber_ (this)
{
}
SimResultsViewSet::
SimResultsViewSet (const SimResultsViewSet& x,
::xml_schema::flags f,
::xml_schema::container* c)
: ::schema::simxml::ResourcesGeneral::SimResultsVisualization (x, f, c),
ViewSetLayout_ (x.ViewSetLayout_, f, this),
ViewSet_ (x.ViewSet_, f, this),
ViewSetString_ (x.ViewSetString_, f, this),
ViewNumber_ (x.ViewNumber_, f, this),
SubViewNumber_ (x.SubViewNumber_, f, this)
{
}
SimResultsViewSet::
SimResultsViewSet (const ::xercesc::DOMElement& e,
::xml_schema::flags f,
::xml_schema::container* c)
: ::schema::simxml::ResourcesGeneral::SimResultsVisualization (e, f | ::xml_schema::flags::base, c),
ViewSetLayout_ (this),
ViewSet_ (this),
ViewSetString_ (this),
ViewNumber_ (this),
SubViewNumber_ (this)
{
if ((f & ::xml_schema::flags::base) == 0)
{
::xsd::cxx::xml::dom::parser< char > p (e, true, false, true);
this->parse (p, f);
}
}
void SimResultsViewSet::
parse (::xsd::cxx::xml::dom::parser< char >& p,
::xml_schema::flags f)
{
this->::schema::simxml::ResourcesGeneral::SimResultsVisualization::parse (p, f);
for (; p.more_content (); p.next_content (false))
{
const ::xercesc::DOMElement& i (p.cur_element ());
const ::xsd::cxx::xml::qualified_name< char > n (
::xsd::cxx::xml::dom::name< char > (i));
// ViewSetLayout
//
if (n.name () == "ViewSetLayout" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/ResourcesGeneral")
{
if (!this->ViewSetLayout_)
{
this->ViewSetLayout_.set (ViewSetLayout_traits::create (i, f, this));
continue;
}
}
// ViewSet
//
if (n.name () == "ViewSet" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/ResourcesGeneral")
{
::std::auto_ptr< ViewSet_type > r (
ViewSet_traits::create (i, f, this));
if (!this->ViewSet_)
{
this->ViewSet_.set (r);
continue;
}
}
// ViewSetString
//
if (n.name () == "ViewSetString" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/ResourcesGeneral")
{
::std::auto_ptr< ViewSetString_type > r (
ViewSetString_traits::create (i, f, this));
if (!this->ViewSetString_)
{
this->ViewSetString_.set (r);
continue;
}
}
// ViewNumber
//
if (n.name () == "ViewNumber" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/ResourcesGeneral")
{
if (!this->ViewNumber_)
{
this->ViewNumber_.set (ViewNumber_traits::create (i, f, this));
continue;
}
}
// SubViewNumber
//
if (n.name () == "SubViewNumber" && n.namespace_ () == "http://d-alchemy.com/schema/simxml/ResourcesGeneral")
{
if (!this->SubViewNumber_)
{
this->SubViewNumber_.set (SubViewNumber_traits::create (i, f, this));
continue;
}
}
break;
}
}
SimResultsViewSet* SimResultsViewSet::
_clone (::xml_schema::flags f,
::xml_schema::container* c) const
{
return new class SimResultsViewSet (*this, f, c);
}
SimResultsViewSet& SimResultsViewSet::
operator= (const SimResultsViewSet& x)
{
if (this != &x)
{
static_cast< ::schema::simxml::ResourcesGeneral::SimResultsVisualization& > (*this) = x;
this->ViewSetLayout_ = x.ViewSetLayout_;
this->ViewSet_ = x.ViewSet_;
this->ViewSetString_ = x.ViewSetString_;
this->ViewNumber_ = x.ViewNumber_;
this->SubViewNumber_ = x.SubViewNumber_;
}
return *this;
}
SimResultsViewSet::
~SimResultsViewSet ()
{
}
}
}
}
#include <istream>
#include <xsd/cxx/xml/sax/std-input-source.hxx>
#include <xsd/cxx/tree/error-handler.hxx>
namespace schema
{
namespace simxml
{
namespace ResourcesGeneral
{
}
}
}
#include <xsd/cxx/post.hxx>
// Begin epilogue.
//
//
// End epilogue.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.