hexsha stringlengths 40 40 | size int64 22 2.4M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 260 | max_stars_repo_name stringlengths 5 109 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 260 | max_issues_repo_name stringlengths 5 109 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 260 | max_forks_repo_name stringlengths 5 109 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 22 2.4M | avg_line_length float64 5 169k | max_line_length int64 5 786k | alphanum_fraction float64 0.06 0.95 | matches listlengths 1 11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b2045274e424fba5ef83f639de2e026937b8dbf8 | 16,748 | h | C | content/renderer/service_worker/service_worker_provider_context.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | content/renderer/service_worker/service_worker_provider_context.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2015-10-21T13:02:42.000Z | 2022-03-14T07:50:50.000Z | content/renderer/service_worker/service_worker_provider_context.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2014 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.
#ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
#define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_container.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_container_type.mojom-forward.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-forward.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom-forward.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_worker_client_registry.mojom.h"
#include "third_party/blink/public/mojom/timing/worker_timing_container.mojom-forward.h"
#include "third_party/blink/public/mojom/web_feature/web_feature.mojom-forward.h"
#include "third_party/blink/public/platform/modules/service_worker/web_service_worker_provider_client.h"
#include "third_party/blink/public/platform/modules/service_worker/web_service_worker_provider_context.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace network {
class SharedURLLoaderFactory;
class WeakWrapperSharedURLLoaderFactory;
} // namespace network
namespace content {
namespace mojom {
class URLLoaderFactory;
} // namespace mojom
namespace service_worker_provider_context_unittest {
class ServiceWorkerProviderContextTest;
FORWARD_DECLARE_TEST(ServiceWorkerProviderContextTest,
SetControllerServiceWorker);
FORWARD_DECLARE_TEST(ServiceWorkerProviderContextTest,
ControllerWithoutFetchHandler);
} // namespace service_worker_provider_context_unittest
class WebServiceWorkerProviderImpl;
struct ServiceWorkerProviderContextDeleter;
// ServiceWorkerProviderContext stores common state for "providers" for service
// worker clients (currently WebServiceWorkerProviderImpl and
// ServiceWorkerNetworkProviderForFrame). Providers for the same underlying
// entity hold strong references to a shared instance of this class.
//
// ServiceWorkerProviderContext is also a
// blink::mojom::ServiceWorkerWorkerClientRegistry. If it's a provider for a
// document, then it tracks all the dedicated workers created from the document
// (including nested workers), as dedicated workers don't yet have their own
// providers. If it's a provider for a shared worker, then it tracks only the
// shared worker itself.
//
// Created and destructed on the main thread. Unless otherwise noted, all
// methods are called on the main thread.
class CONTENT_EXPORT ServiceWorkerProviderContext
: public base::RefCountedThreadSafe<ServiceWorkerProviderContext,
ServiceWorkerProviderContextDeleter>,
public blink::WebServiceWorkerProviderContext,
public blink::mojom::ServiceWorkerContainer,
public blink::mojom::ServiceWorkerWorkerClientRegistry {
public:
// |receiver| is connected to the content::ServiceWorkerContainerHost that
// notifies of changes to the registration's and workers' status.
//
// |controller_info| contains the endpoint and object info that is needed to
// set up the controller service worker for the context.
//
// |fallback_loader_factory| is a default loader factory for fallback
// requests, and is used when we create a subresource loader for controllees.
// This is non-null only if the provider is created for controllees, and if
// the loading context, e.g. a frame, provides it.
ServiceWorkerProviderContext(
blink::mojom::ServiceWorkerContainerType container_type,
mojo::PendingAssociatedReceiver<blink::mojom::ServiceWorkerContainer>
receiver,
mojo::PendingAssociatedRemote<blink::mojom::ServiceWorkerContainerHost>
host_remote,
blink::mojom::ControllerServiceWorkerInfoPtr controller_info,
scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory);
ServiceWorkerProviderContext(const ServiceWorkerProviderContext&) = delete;
ServiceWorkerProviderContext& operator=(const ServiceWorkerProviderContext&) =
delete;
blink::mojom::ServiceWorkerContainerType container_type() const {
return container_type_;
}
// Returns version id of the controller service worker object
// (ServiceWorkerContainer#controller).
int64_t GetControllerVersionId() const;
// Takes the controller service worker object info set by SetController() if
// any, otherwise returns nullptr.
blink::mojom::ServiceWorkerObjectInfoPtr TakeController();
// Returns the factory for loading subresources with the controller
// ServiceWorker, or nullptr if no controller is attached. Returns a
// WeakWrapperSharedURLLoaderFactory because the inner factory is destroyed
// when this context is destroyed but loaders may persist a reference to the
// loader returned from this method.
scoped_refptr<network::WeakWrapperSharedURLLoaderFactory>
GetSubresourceLoaderFactory();
// Returns the feature usage of the controller service worker.
const std::set<blink::mojom::WebFeature>& used_features() const;
// For providers for frames. See |fetch_request_window_id| in
// network::ResourceRequest.
const base::UnguessableToken& fetch_request_window_id() const;
// Sets a weak pointer back to the WebServiceWorkerProviderImpl (which
// corresponds to ServiceWorkerContainer in JavaScript) which has a strong
// reference to |this|. This allows us to notify the
// WebServiceWorkerProviderImpl when ServiceWorkerContainer#controller should
// be changed.
void SetWebServiceWorkerProvider(
base::WeakPtr<WebServiceWorkerProviderImpl> provider);
// blink::mojom::ServiceWorkerWorkerClientRegistry:
void RegisterWorkerClient(
mojo::PendingRemote<blink::mojom::ServiceWorkerWorkerClient>
pending_client) override;
void CloneWorkerClientRegistry(
mojo::PendingReceiver<blink::mojom::ServiceWorkerWorkerClientRegistry>
receiver) override;
// Called when WebServiceWorkerNetworkProvider is destructed. This function
// severs the Mojo binding to the browser-side ServiceWorkerContainerHost. The
// reason WebServiceWorkerNetworkProvider is special compared to the other
// providers, is that it is destructed synchronously when a service worker
// client (Document) is removed from the DOM. Once this happens, the
// ServiceWorkerContainerHost must destruct quickly in order to remove the
// ServiceWorkerClient from the system (thus allowing unregistration/update to
// occur and ensuring the Clients API doesn't return the client).
//
// TODO(https://crbug.com/931497): Remove this weird partially destroyed
// state.
void OnNetworkProviderDestroyed();
// May be nullptr if OnNetworkProviderDestroyed() has already been called.
// Currently this can be called only for clients that are Documents,
// see comments of |container_host_|.
blink::mojom::ServiceWorkerContainerHost* container_host() const;
// Called when blink::IdlenessDetector emits its network idle signal. Tells
// the browser process that this page is quiet soon after page load, as a
// hint to start the service worker update check.
void DispatchNetworkQuiet();
// Tells the container host that this context is execution ready:
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-execution-ready-flag
void NotifyExecutionReady();
// Sets up |receiver| to receive resource performance timings for the given
// |request_id|. This receiver will be taken later by
// TakePendingWorkerTimingReceiver().
void AddPendingWorkerTimingReceiver(
int request_id,
mojo::PendingReceiver<blink::mojom::WorkerTimingContainer> receiver);
mojo::PendingReceiver<blink::mojom::WorkerTimingContainer>
TakePendingWorkerTimingReceiver(int request_id);
// WebServiceWorkerProviderContext implementation.
void BindServiceWorkerWorkerClientRemote(
blink::CrossVariantMojoRemote<
blink::mojom::ServiceWorkerWorkerClientInterfaceBase> pending_client)
override;
void BindServiceWorkerWorkerClientRegistryReceiver(
blink::CrossVariantMojoReceiver<
blink::mojom::ServiceWorkerWorkerClientRegistryInterfaceBase>
receiver) override;
blink::CrossVariantMojoRemote<
blink::mojom::ServiceWorkerContainerHostInterfaceBase>
CloneRemoteContainerHost() override;
blink::mojom::ControllerServiceWorkerMode GetControllerServiceWorkerMode()
const override;
const blink::WebString client_id() const override;
std::string subresource_filter() const { return subresource_filter_; }
void SetSubresourceFilter(const std::string& filter) {
subresource_filter_ = filter;
}
private:
friend class base::DeleteHelper<ServiceWorkerProviderContext>;
friend class base::RefCountedThreadSafe<ServiceWorkerProviderContext,
ServiceWorkerProviderContextDeleter>;
friend class service_worker_provider_context_unittest::
ServiceWorkerProviderContextTest;
friend struct ServiceWorkerProviderContextDeleter;
FRIEND_TEST_ALL_PREFIXES(service_worker_provider_context_unittest::
ServiceWorkerProviderContextTest,
SetControllerServiceWorker);
FRIEND_TEST_ALL_PREFIXES(service_worker_provider_context_unittest::
ServiceWorkerProviderContextTest,
ControllerWithoutFetchHandler);
using WorkerTimingContainerReceiverMap =
std::map<int /* request_id */,
mojo::PendingReceiver<blink::mojom::WorkerTimingContainer>>;
~ServiceWorkerProviderContext() override;
void DestructOnMainThread() const;
// Clears the information of the ServiceWorkerWorkerClient of dedicated (or
// shared) worker, when the connection to the worker is disconnected.
void UnregisterWorkerFetchContext(blink::mojom::ServiceWorkerWorkerClient*);
// Implementation of blink::mojom::ServiceWorkerContainer.
void SetController(
blink::mojom::ControllerServiceWorkerInfoPtr controller_info,
bool should_notify_controllerchange) override;
void PostMessageToClient(blink::mojom::ServiceWorkerObjectInfoPtr source,
blink::TransferableMessage message) override;
void CountFeature(blink::mojom::WebFeature feature) override;
// A convenient utility method to tell if a subresource loader factory
// can be created for this context.
bool CanCreateSubresourceLoaderFactory() const;
// Returns URLLoaderFactory for loading subresources with the controller
// ServiceWorker, or nullptr if no controller is attached.
network::mojom::URLLoaderFactory* GetSubresourceLoaderFactoryInternal();
const blink::mojom::ServiceWorkerContainerType container_type_;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
// This keeps the connection to the content::ServiceWorkerContainerHost in the
// browser process alive.
mojo::AssociatedReceiver<blink::mojom::ServiceWorkerContainer> receiver_;
// The |container_host_| remote represents the connection to the
// browser-side ServiceWorkerContainerHost, whose lifetime is bound to
// |container_host_| via the Mojo connection. This may be nullptr if the Mojo
// connection was broken in OnNetworkProviderDestroyed().
//
// The |container_host_| remote also implements functions for
// navigator.serviceWorker, but all the methods that correspond to
// navigator.serviceWorker.* can be used only if |this| is a provider
// for a Document, as navigator.serviceWorker is currently only implemented
// for Document (https://crbug.com/371690).
// Note: Currently this is always bound on main thread.
mojo::AssociatedRemote<blink::mojom::ServiceWorkerContainerHost>
container_host_;
// |controller_| will be set by SetController() and taken by TakeController().
blink::mojom::ServiceWorkerObjectInfoPtr controller_;
// Keeps version id of the current controller service worker object.
int64_t controller_version_id_ = blink::mojom::kInvalidServiceWorkerVersionId;
// Used to intercept requests from the controllee and dispatch them
// as events to the controller ServiceWorker.
mojo::Remote<network::mojom::URLLoaderFactory> subresource_loader_factory_;
// Used when we create |subresource_loader_factory_|.
scoped_refptr<network::SharedURLLoaderFactory> fallback_loader_factory_;
// Used to ensure handed out loader factories are properly detached when the
// contained subresource_loader_factory goes away.
scoped_refptr<network::WeakWrapperSharedURLLoaderFactory>
weak_wrapped_subresource_loader_factory_;
// The Client#id value for this context.
std::string client_id_;
// Corresponds to a request's "window" in the Fetch spec:
// https://fetch.spec.whatwg.org/#concept-request-window
base::UnguessableToken fetch_request_window_id_;
blink::mojom::ControllerServiceWorkerMode controller_mode_ =
blink::mojom::ControllerServiceWorkerMode::kNoController;
// Tracks feature usage for UseCounter.
std::set<blink::mojom::WebFeature> used_features_;
// Corresponds to this context's ServiceWorkerContainer. May be null when not
// yet created, when already destroyed, or when this client is not a Document
// and therefore doesn't support navigator.serviceWorker.
base::WeakPtr<WebServiceWorkerProviderImpl> web_service_worker_provider_;
// Remotes for dedicated or shared workers which are associated with the
// ServiceWorkerProviderContext.
// - If this ServiceWorkerProviderContext is for a Document, then
// |worker_clients| contains all its dedicated workers.
// - If this ServiceWorkerProviderContext is for a SharedWorker (technically
// speaking, for its shadow page), then |worker_clients| has one element:
// the shared worker.
std::vector<mojo::Remote<blink::mojom::ServiceWorkerWorkerClient>>
worker_clients_;
// For adding new ServiceWorkerWorkerClients.
mojo::ReceiverSet<blink::mojom::ServiceWorkerWorkerClientRegistry>
worker_client_registry_receivers_;
// Used in |subresource_loader_factory_| to get the connection to the
// controller service worker.
//
// |remote_controller_| is a Mojo pipe to the controller service worker,
// and is to be passed to (i.e. taken by) a subresource loader factory when
// GetSubresourceLoaderFactory() is called for the first time when a valid
// controller exists.
//
// |controller_connector_| is a Mojo pipe to the
// ControllerServiceWorkerConnector that is attached to the newly created
// subresource loader factory and lives on a background thread. This is
// populated when GetSubresourceLoader() creates the subresource loader
// factory and takes |controller_endpoint_|.
mojo::PendingRemote<blink::mojom::ControllerServiceWorker> remote_controller_;
mojo::Remote<blink::mojom::ControllerServiceWorkerConnector>
controller_connector_;
bool sent_execution_ready_ = false;
std::string subresource_filter_;
// Contains pending receivers whose corresponding requests are still
// in-flight. The pending receivers are taken by
// TakePendingWorkerTimingReceiver() when the request is completed.
WorkerTimingContainerReceiverMap worker_timing_container_receivers_;
base::WeakPtrFactory<ServiceWorkerProviderContext> weak_factory_{this};
};
struct ServiceWorkerProviderContextDeleter {
static void Destruct(const ServiceWorkerProviderContext* context) {
context->DestructOnMainThread();
}
};
} // namespace content
#endif // CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_CONTEXT_H_
| 46.782123 | 105 | 0.78278 | [
"object",
"vector"
] |
b204f09197a605cb3cb7c30e7b580d333a69c44e | 31,945 | h | C | Resources/doom3d.h | christymarc/raycasting-simulation | ed9b92143d3eb1c5a25900419ead517f93f8c315 | [
"MIT"
] | 3 | 2020-10-16T18:59:18.000Z | 2021-03-23T00:46:09.000Z | Resources/doom3d.h | christymarc/raycasting-simulation | ed9b92143d3eb1c5a25900419ead517f93f8c315 | [
"MIT"
] | 3 | 2020-12-09T21:34:34.000Z | 2021-06-04T05:17:51.000Z | Resources/doom3d.h | christymarc/raycasting-simulation | ed9b92143d3eb1c5a25900419ead517f93f8c315 | [
"MIT"
] | 5 | 2020-12-09T00:49:23.000Z | 2021-06-01T07:40:41.000Z | #ifndef _DOOM3D_H_
#define _DOOM3D_H_
// TODO:
// 1. check for TODO
// 2. remove casts? might not need them for non-pointer types
// 3. switch from array to vector or Array
// Doom 3D engine ver: 1.000
// Originally by: Spektre on stackoverflow
// https://stackoverflow.com/questions/47239797/ray-casting-with-different-height-size/47251071#47251071
//
// Edited by: Anthony Clark
#include <cmath>
#include <string>
using std::string;
#include <fstream>
using std::ifstream;
using std::ofstream;
#include <iostream>
using std::cerr;
using uint = unsigned int;
constexpr long double deg2rad(long double deg)
{
return deg * 3.141592 / 180;
}
constexpr long double operator"" _deg(long double deg)
{
return deg2rad(deg);
}
const uint _Doom3D_cell_size = 10; // 2D map cell size
const uint _Doom3D_wall_size = 100; // full height of wall in map
#define _Doom3D_filter_txr
class Doom3D
{
public:
uint mxs, mys, **pmap; // 2D map // txr + height<<16
uint sxs, sys, **pscr; // pseudo 3D screen
// Graphics::TBitmap *scr;
uint8_t *canvas;
uint txs, tys, **ptxr, tn; // 2D textures
// Graphics::TBitmap *txr, *txr2; // textures, texture mipmaps resolution: /2 and /4
uint8_t *texture;
double plrx, plry, plrz, plra; // player position [x,y,z,angle]
double view_ang; // [rad] view angle
double focus; // [cells] view focal length
struct _ray
{
double x, y, l; // hit or end of map position
uint hit; // map cell of hit or 0xFFFFFFFF
char typ; // H/V
_ray(){};
_ray(_ray &a) { *this = a; }
~_ray(){};
_ray *operator=(const _ray *a)
{
*this = *a;
return this;
}
//_ray* operator = (const _ray &a) { ..copy... return this; }
};
_ray *ray; // ray[sxs]
// keytab keys;
uint txr_sel;
uint cell_h;
Doom3D();
Doom3D(Doom3D &a) { *this = a; }
~Doom3D();
Doom3D *operator=(const Doom3D *a)
{
*this = *a;
return this;
}
//Doom3D* operator = (const Doom3D &a) { ..copy... return this; }
void map_resize(uint xs, uint ys); // change map resolution
void map_height(uint height); // set height for whole map to convert maps from Wolfenstein3D demo
void map_clear(); // clear whole map
void map_save(string name);
void map_load(string name);
void scr_resize(uint xs, uint ys);
void txr_load(string name);
void draw();
void update(double dt);
// void mouse(double x, double y, TShiftState sh)
// {
// x = floor(x / _Doom3D_cell_size);
// if (x >= mxs)
// x = mxs - 1;
// if (x < 0)
// x = 0;
// y = floor(y / _Doom3D_cell_size);
// if (y >= mys)
// y = mys - 1;
// if (y < 0)
// y = 0;
// uint xx = x, yy = y;
// keys.setm(x, y, sh);
// if (keys.Shift.Contains(ssLeft))
// pmap[yy][xx] = (txr_sel) | (cell_h << 16);
// if (keys.Shift.Contains(ssRight))
// pmap[yy][xx] = 0xFFFFFFFF;
// keys.rfsmouse();
// }
// void wheel(int delta, TShiftState sh)
// {
// if (sh.Contains(ssShift))
// {
// if (delta < 0)
// {
// cell_h -= 10;
// if (cell_h < 10)
// cell_h = 10;
// }
// if (delta > 0)
// {
// cell_h += 10;
// if (cell_h > _Doom3D_wall_size)
// cell_h = _Doom3D_wall_size;
// }
// }
// else
// {
// if (delta < 0)
// {
// txr_sel--;
// if (txr_sel == 0xFFFFFFFF)
// txr_sel = tn - 1;
// }
// if (delta > 0)
// {
// txr_sel++;
// if (txr_sel == tn)
// txr_sel = 0;
// }
// }
// }
};
//---------------------------------------------------------------------------
Doom3D::Doom3D()
{
mxs = 0;
mys = 0;
pmap = nullptr;
sxs = 0;
sys = 0;
// scr = new Graphics::TBitmap;
canvas = nullptr;
pscr = nullptr;
ray = nullptr;
txs = 0;
tys = 0;
// txr = new Graphics::TBitmap;
texture = nullptr;
ptxr = nullptr;
tn = 0;
// txr2 = new Graphics::TBitmap;
plrx = 0.0;
plry = 0.0;
plrz = 0.0;
plra = 0.0;
view_ang = 60.0_deg;
focus = 0.25;
txr_sel = 0;
cell_h = _Doom3D_wall_size;
txr_load("textures/textures128x128.ppm");
map_resize(16, 16);
map_load("Doom3D_map.dat");
}
//---------------------------------------------------------------------------
Doom3D::~Doom3D()
{
uint y;
map_save("Doom3D_map.dat");
if (pmap)
{
for (y = 0; y < mys; y++)
delete[] pmap[y];
delete[] pmap;
pmap = nullptr;
}
if (ray)
delete[] ray;
ray = nullptr;
if (pscr)
{
delete[] pscr;
pscr = nullptr;
}
// if (scr)
// delete scr;
// scr = nullptr;
if (canvas)
{
delete[] canvas;
}
canvas = nullptr;
if (ptxr)
{
delete[] ptxr;
ptxr = nullptr;
}
// if (txr)
// delete txr;
// txr = nullptr;
if (texture)
{
delete[] texture;
}
texture = nullptr;
// if (txr2)
// delete txr2;
// txr2 = nullptr;
}
//---------------------------------------------------------------------------
void Doom3D::map_resize(uint xs, uint ys)
{
uint y;
if (pmap)
{
for (y = 0; y < mys; y++)
delete[] pmap[y];
delete[] pmap;
pmap = nullptr;
}
mys = ys;
mxs = xs;
pmap = new uint *[mys];
for (y = 0; y < mys; y++)
pmap[y] = new uint[mxs];
map_clear();
plrx = (mxs - 1) * 0.5;
plry = (mys - 1) * 0.5;
plrz = 0.0;
plra = 0.0_deg;
}
//---------------------------------------------------------------------------
void Doom3D::map_height(uint h)
{
uint x, y, c;
for (y = 0; y < mys; y++)
for (x = 0; x < mxs; x++)
{
c = pmap[y][x];
c &= 0xFFFF;
c |= h << 16;
pmap[y][x] = c;
}
}
//---------------------------------------------------------------------------
void Doom3D::map_clear()
{
uint x, y, c;
for (y = 0; y < mys; y++)
for (x = 0; x < mxs; x++)
{
c = 0xFFFFFFFF;
if ((x == 0) || (x == mxs - 1))
c = 0;
if ((y == 0) || (y == mys - 1))
c = 0;
pmap[y][x] = c;
}
}
//---------------------------------------------------------------------------
void Doom3D::map_save(string name)
{
// int hnd = FileCreate(name);
// if (hnd < 0)
// return;
ofstream map_outfile(name, std::ios::binary);
if (!map_outfile.is_open())
{
cerr << "Could not open file: " << name << "\n";
return;
}
uint y;
y = ' PAM';
// FileWrite(hnd, &y, 4); // id
map_outfile.write(reinterpret_cast<char *>(&y), sizeof(y));
// FileWrite(hnd, &mxs, 4); // x resolution
map_outfile.write(reinterpret_cast<char *>(&mxs), sizeof(mxs));
// FileWrite(hnd, &mys, 4); // y resolution
map_outfile.write(reinterpret_cast<char *>(&mys), sizeof(mys));
// for (y = 0; y < mys; y++) // map
// FileWrite(hnd, pmap[y], mxs << 2);
for (y = 0; y < mys; y++)
{
map_outfile.write(reinterpret_cast<char *>(pmap[y]), sizeof(pmap[y][0]) * mxs);
}
y = ' RLP';
// FileWrite(hnd, &y, 4); // id
map_outfile.write(reinterpret_cast<char *>(&y), sizeof(y));
// FileWrite(hnd, &plrx, 8);
map_outfile.write(reinterpret_cast<char *>(&plrx), sizeof(plrx));
// FileWrite(hnd, &plry, 8);
map_outfile.write(reinterpret_cast<char *>(&plry), sizeof(plry));
// FileWrite(hnd, &plrz, 8);
map_outfile.write(reinterpret_cast<char *>(&plrz), sizeof(plrz));
// FileWrite(hnd, &plra, 8);
map_outfile.write(reinterpret_cast<char *>(&plra), sizeof(plra));
// FileClose(hnd);
}
//---------------------------------------------------------------------------
void Doom3D::map_load(string name)
{
// int hnd = FileOpen(name, fmOpenRead);
// if (hnd < 0)
// return;
ifstream map_infile(name, std::ios::binary);
if (!map_infile.is_open())
{
cerr << "Could not open file: " << name << "\n";
return;
}
uint x, y;
y = ' PAM';
// FileRead(hnd, &x, 4); // id
map_infile.read(reinterpret_cast<char *>(&x), sizeof(uint));
if (x == y)
{
// FileRead(hnd, &x, 4); // x resolution
map_infile.read(reinterpret_cast<char *>(&x), sizeof(x));
// FileRead(hnd, &y, 4); // y resolution
map_infile.read(reinterpret_cast<char *>(&y), sizeof(y));
map_resize(x, y);
// for (y = 0; y < mys; y++) // map
// FileRead(hnd, pmap[y], mxs << 2);
for (y = 0; y < mys; y++)
{
map_infile.read(reinterpret_cast<char *>(pmap[y]), sizeof(pmap[y][0]) * mxs);
}
}
y = ' RLP';
// FileRead(hnd, &x, 4); // id
map_infile.read(reinterpret_cast<char *>(&x), sizeof(x));
if (x == y)
{
// FileRead(hnd, &plrx, 8);
map_infile.read(reinterpret_cast<char *>(&plrx), sizeof(plrx));
// FileRead(hnd, &plry, 8);
map_infile.read(reinterpret_cast<char *>(&plry), sizeof(plry));
// FileRead(hnd, &plrz, 8);
map_infile.read(reinterpret_cast<char *>(&plrz), sizeof(plrz));
// FileRead(hnd, &plra, 8);
map_infile.read(reinterpret_cast<char *>(&plra), sizeof(plra));
}
// FileClose(hnd);
}
//---------------------------------------------------------------------------
void Doom3D::scr_resize(uint xs, uint ys)
{
// scr->HandleType = bmDIB;
// scr->PixelFormat = pf32bit;
// scr->SetSize(xs, ys);
// sxs = scr->Width;
// sys = scr->Height;
// width BY height BY channels (RGB)
canvas = new uint8_t[xs * ys * 3];
sxs = xs;
sys = ys;
delete[] pscr;
pscr = new uint *[sys];
for (uint y = 0; y < sys; y++)
{
// pscr[y] = (uint *)scr->ScanLine[y];
// TODO: is this valid?
pscr[y] = reinterpret_cast<uint *>(canvas + y * sxs);
}
if (ray)
{
delete[] ray;
}
ray = new _ray[sxs];
}
//---------------------------------------------------------------------------
void Doom3D::txr_load(string name)
{
// string ext = ExtractFileExt(name).LowerCase();
// for (;;)
// {
// if (ext == ".bmp")
// {
// txr->LoadFromFile(name);
// break;
// }
// if (ext == ".jpg")
// {
// TJPEGImage *jpg = new TJPEGImage;
// if (jpg == nullptr)
// return;
// jpg->LoadFromFile(name);
// txr->Assign(jpg);
// delete jpg;
// break;
// }
// return;
// }
// uint y = tys;
// txr->HandleType = bmDIB;
// txr->PixelFormat = pf32bit;
// txs = txr->Width;
// tys = txr->Height;
// Open file, seek to the end, read the size, seek to beggining
ifstream texture_file(name, std::ios::binary | std::ios::ate);
std::streamsize texture_size = texture_file.tellg();
texture_file.seekg(0, std::ios::beg);
// Read PPM header
string header;
int sizex, sizey, sizec;
texture_file >> header >> sizex >> sizey >> sizec;
std::cout << "Texture size : " << sizex * sizey * 3 << " (" << sizex << "x" << sizey << "x3)\n";
std::cout << "Expecting : " << 128 * 128 * 48 * 3 << "\n";
texture = new uint8_t[texture_size];
if (!texture_file.read(reinterpret_cast<char *>(texture), texture_size))
{
cerr << "Could not read texture file.\n";
}
txs = sizex;
tys = sizey;
// // mip map
// txr2->SetSize(txs >> 1, (tys >> 1) + (tys >> 2));
// txr2->Canvas->StretchDraw(TRect(0, 0, txs >> 1, tys >> 1), txr);
// txr2->Canvas->StretchDraw(TRect(0, tys >> 1, txs >> 2, (tys >> 1) + (tys >> 2)), txr);
tn = txs / tys;
txs = tys;
delete[] ptxr;
ptxr = new uint *[tys];
// for (y = 0; y < tys; y++)
// ptxr[y] = (uint *)txr->ScanLine[y];
for (int y = 0; y < tys; y++)
{
ptxr[y] = reinterpret_cast<uint *>(texture + y * txs);
}
}
//---------------------------------------------------------------------------
void Doom3D::draw()
{
// total time measurement
// tbeg();
// double tperf0 = performance_tms;
string tcls, tray, tmap, ttotal;
double a, a0, da, dx, dy, l, mx, my;
uint x, y, xs2, ys2, c, m;
double xx0, yy0, dx0, dy0, ll0;
uint c0, d0;
double xx1, yy1, dx1, dy1, ll1;
uint c1, d1;
_ray *p;
xs2 = sxs >> 1;
ys2 = sys >> 1;
// aspect ratio,view angle corrections
a = 90.0_deg - view_ang;
double wall = double(sxs) * (1.25 + (0.288 * a) + (2.04 * a * a)); // [px]
// floor,ceilling/sky
// tbeg();
for (y = 0; y < ys2; y++)
for (x = 0; x < sxs; x++)
pscr[y][x] = 0x000080FF;
for (; y < sys; y++)
for (x = 0; x < sxs; x++)
pscr[y][x] = 0x00404040;
// tend();
// tcls = tstr(1) + " cls";
// [cast rays]
// tbeg();
// diffuse + ambient lighting
uint ch = 155.0 + fabs(100.0 * sin(plra));
uint cv = 155.0 + fabs(100.0 * cos(plra));
a0 = plra - (0.5 * view_ang);
// da = divide(view_ang, sxs - 1);
// TODO: is this the correct way to handle divide by 0 here?
da = (sxs - 1) == 0 ? 0 : view_ang / (sxs - 1);
mx = mxs;
my = mys;
for (p = ray, a = a0, x = 0; x < sxs; x++, a += da, p++)
{
p->x = plrx;
p->y = plry;
p->hit = 0xFFFFFFFF;
p->typ = ' ';
p->l = 1.0e20;
ll0 = ll1 = p->l;
// grid V-line hits
c0 = 0;
dx0 = cos(a);
if (dx0 < 0.0)
{
c0 = 1;
xx0 = floor(plrx) - 0.001;
dx0 = -1.0;
}
if (dx0 > 0.0)
{
c0 = 1;
xx0 = ceil(plrx) + 0.001;
dx0 = +1.0;
}
if (c0)
{
dy0 = tan(a);
yy0 = plry + ((xx0 - plrx) * dy0);
dy0 *= dx0;
dx = xx0 - plrx;
dy = yy0 - plry;
ll0 = (dx * dx) + (dy * dy);
}
// grid H-line hits
c1 = 0;
dy1 = sin(a);
if (dy1 < 0.0)
{
c1 = 1;
yy1 = floor(plry) - 0.001;
dy1 = -1.0;
}
if (dy1 > 0.0)
{
c1 = 1;
yy1 = ceil(plry) + 0.001;
dy1 = +1.0;
}
if (c1)
{
// dx1 = divide(1.0, tan(a));
// TODO: divide by 0?
dx1 = tan(a) == 0 ? 0 : 1.0 / tan(a);
xx1 = plrx + ((yy1 - plry) * dx1);
dx1 *= dy1;
dx = xx1 - plrx;
dy = yy1 - plry;
ll1 = (dx * dx) + (dy * dy);
}
int height0 = sys; // already rendered height [pixels]
bool _hit, _back = false, _bck = true;
if (!c0)
ll0 = 1e20;
if (!c1)
ll1 = 1e20;
for (; c0 || c1;)
{
_hit = false;
// grid V-line hits
if (c0)
{
if (xx0 < 0.0)
{
c0 = 0;
ll0 = 1e20;
}
if (xx0 >= mx)
{
c0 = 0;
ll0 = 1e20;
}
if (yy0 < 0.0)
{
c0 = 0;
ll0 = 1e20;
}
if (yy0 >= my)
{
c0 = 0;
ll0 = 1e20;
}
}
if ((c0) && (ll0 < ll1))
{
m = uint(xx0 - dx0);
if ((m >= 0.0) && (m < mxs) && (!_bck))
{
c = pmap[uint(yy0)][m];
if ((c & 0xFFFF) != 0xFFFF)
{
p->hit = c;
p->typ = 'V';
p->l = ll0;
p->x = xx0;
p->y = yy0;
_hit = true;
_back = true;
_bck = true;
}
}
if (!_hit)
{
c = pmap[uint(yy0)][uint(xx0)];
if ((c & 0xFFFF) != 0xFFFF)
{
p->hit = c;
p->typ = 'V';
p->l = ll0;
p->x = xx0;
p->y = yy0;
_hit = true;
_back = false;
_bck = false;
}
xx0 += dx0;
dx = xx0 - plrx;
yy0 += dy0;
dy = yy0 - plry;
ll0 = (dx * dx) + (dy * dy);
}
}
// grid H-line hits
if (c1)
{
if (xx1 < 0.0)
{
c1 = 0;
ll1 = 1e20;
}
if (xx1 >= mx)
{
c1 = 0;
ll1 = 1e20;
}
if (yy1 < 0.0)
{
c1 = 0;
ll1 = 1e20;
}
if (yy1 >= my)
{
c1 = 0;
ll1 = 1e20;
}
}
if ((c1) && (ll0 > ll1) && (!_hit))
{
m = uint(yy1 - dy1);
if ((m >= 0.0) && (m < mys) && (!_bck))
{
c = pmap[m][uint(xx1)];
if ((c & 0xFFFF) != 0xFFFF)
{
p->hit = c;
p->typ = 'H';
p->l = ll1;
p->x = xx1;
p->y = yy1;
_hit = true;
_back = true;
_bck = true;
}
}
if (!_hit)
{
c = pmap[uint(yy1)][uint(xx1)];
if ((c & 0xFFFF) != 0xFFFF)
{
p->hit = c;
p->typ = 'H';
p->l = ll1;
p->x = xx1;
p->y = yy1;
_hit = true;
_back = false;
_bck = false;
}
xx1 += dx1;
dx = xx1 - plrx;
yy1 += dy1;
dy = yy1 - plry;
ll1 = (dx * dx) + (dy * dy);
}
}
// render scan line
if (_hit)
{
union
{
uint dd;
uint8_t db[4];
} cc;
int tx, ty, sy, sy0, sy1, cnt, dsy, dty;
p->l = sqrt(p->l) * cos(a - plra); // anti fish eye
// m = divide(wall * focus, p->l); // projected wall half size
// TODO: divide by 0
m = p->l == 0 ? 0 : (wall * focus) / p->l;
c = 0;
if (p->typ == 'H')
{
c = ch;
tx = double(double(txs) * (p->x - floor(p->x)));
}
if (p->typ == 'V')
{
c = cv;
tx = double(double(txs) * (p->y - floor(p->y)));
}
tx += txs * (p->hit & 0xFFFF);
// prepare interpolation
sy1 = ys2 + m;
// sy0=ys2-m; // constant wall height
sy0 = sy1 - (((m + m) * (p->hit >> 16)) / _Doom3D_wall_size); // variable wall height
dty = tys - 1;
dsy = sy1 - sy0 + 1;
// skip sy>=sys
if (sy1 >= sys)
sy1 = sys - 1;
// skip sy<0
for (cnt = dsy, sy = sy0, ty = 0; sy < 0; sy++)
{
cnt -= dty;
while (cnt <= 0)
{
cnt += dsy;
ty++;
}
}
#ifdef _Doom3D_filter_txr
uint r = 0, g = 0, b = 0, n = 0;
#else
cc.dd = ptxr[ty][tx];
cc.db[0] = uint((uint(cc.db[0]) * c) >> 8);
cc.db[1] = uint((uint(cc.db[1]) * c) >> 8);
cc.db[2] = uint((uint(cc.db[2]) * c) >> 8);
#endif
// continue sy>=0
y = height0;
if (sy1 > height0)
sy1 = height0;
if (sy0 < height0)
height0 = sy0;
if (_back)
{
for (sy = sy0; sy <= y; sy++)
{
if ((sy > 0) && (sy < sys))
pscr[sy][x] = 0x0000FF00;
}
}
else
for (; sy <= sy1; sy++)
{
#ifdef _Doom3D_filter_txr
if (!n)
{
cc.dd = ptxr[ty][tx];
b += uint(cc.db[0]);
g += uint(cc.db[1]);
r += uint(cc.db[2]);
n += 256;
}
if ((sy > 0) && (sy < sys))
{
cc.db[0] = uint(c * b / n);
b = 0;
cc.db[1] = uint(c * g / n);
g = 0;
cc.db[2] = uint(c * r / n);
r = 0;
n = 0;
pscr[sy][x] = cc.dd;
}
cnt -= dty;
while (cnt <= 0)
{
cnt += dsy;
ty++;
cc.dd = ptxr[ty][tx];
b += uint(cc.db[0]);
g += uint(cc.db[1]);
r += uint(cc.db[2]);
n += 256;
}
#else
if ((sy > 0) && (sy < sys))
pscr[sy][x] = cc.dd;
cnt -= dty;
while (cnt <= 0)
{
cnt += dsy;
ty++;
cc.dd = ptxr[ty][tx];
cc.db[0] = uint((uint(cc.db[0]) * c) >> 8);
cc.db[1] = uint((uint(cc.db[1]) * c) >> 8);
cc.db[2] = uint((uint(cc.db[2]) * c) >> 8);
}
#endif
}
if (height0 < 0)
break;
}
}
}
// tend();
// tray = tstr(1) + " ray";
// [2D map]
// tbeg();
m = _Doom3D_cell_size;
mx = _Doom3D_cell_size;
if ((sxs >= mxs * m) && (sys >= mys * m))
{
for (y = 0; y < mys * m; y++) // pmap[][]
for (x = 0; x < mxs * m; x++)
{
if ((pmap[y / m][x / m] & 0xFFFF) != 0xFFFF)
c = 0x00808080;
else
c = 0x00000000;
pscr[y][x] = c;
}
x = double(plrx * mx); // view rays
y = double(plry * mx);
// scr->Canvas->Pen->Color = 0x00005050;
uint8_t r = 0, g = 0x50, b = 0x50;
// scr->Canvas->Pen->Mode = pmMerge;
for (c = 0; c < sxs; c++)
{
// scr->Canvas->MoveTo(x, y);
// scr->Canvas->LineTo(uint(ray[c].x * mx), uint(ray[c].y * mx));
// Grid Walking: https://www.redblobgames.com/grids/line-drawing.html#stepping
// int dx = uint(ray[c].x * mx) - x;
// int dy = uint(ray[c].y * mx) - y;
// int nx = dx > 0 ? dx : -dx;
// int ny = dy > 0 ? dy : -dy;
// int sign_x = dx > 0 ? 1 : -1;
// int sign_y = dy > 0 ? 1 : -1;
// int current_x = x;
// int current_y = y;
// for (int ix = 0, iy = 0; ix < nx || iy < ny;)
// {
// if ((0.5 + ix) / nx < (0.5 + iy) / ny)
// {
// // next step is horizontal
// current_x += sign_x;
// ix++;
// }
// else
// {
// // next step is vertical
// current_y += sign_y;
// iy++;
// }
// canvas[current_x + current_y * sxs + 0] = r;
// canvas[current_x + current_y * sxs + 1] = g;
// canvas[current_x + current_y * sxs + 2] = b;
// std::cout << current_x << ", " << current_y << "\n";
// }
}
// scr->Canvas->Pen->Mode = pmCopy;
c = focus * m; // player and view direction
// scr->Canvas->Pen->Color = 0x000000FF;
// scr->Canvas->Brush->Color = 0x000000FF;
// scr->Canvas->MoveTo(x, y);
// scr->Canvas->LineTo(uint(ray[xs2].x * mx), uint(ray[xs2].y * mx));
// scr->Canvas->Ellipse(x - c, y - c, x + c, y + c);
// scr->Canvas->Pen->Color = 0x00202020;
for (y = 0; y <= mys; y++) // map grid
for (x = 0; x <= mxs; x++)
{
// scr->Canvas->MoveTo(0, y * m);
// scr->Canvas->LineTo(mxs * m, y * m);
// scr->Canvas->MoveTo(x * m, 0);
// scr->Canvas->LineTo(x * m, mys * m);
}
// x = keys.mx * m; // selected cell
// y = keys.my * m;
// scr->Canvas->Pen->Color = 0x0020FFFF;
// scr->Canvas->MoveTo(x, y);
// scr->Canvas->LineTo(x + m, y);
// scr->Canvas->LineTo(x + m, y + m);
// scr->Canvas->LineTo(x, y + m);
// scr->Canvas->LineTo(x, y);
}
// tend();
// tmap = tstr(1) + " map";
// [editor]
if (txr_sel != 0xFFFFFFFF)
{
int x = sxs, y = 5, s0, s1, s2, i, j;
s0 = txs >> 1;
s1 = txs >> 2;
s2 = (s0 * cell_h) / _Doom3D_wall_size;
for (i = -3; i <= 3; i++)
{
j = txr_sel + i;
while (j < 0)
j += tn;
while (j >= tn)
j -= tn;
if (i)
{
// scr->Canvas->CopyRect(TRect(x - s1, y + (s1 >> 1), x, s1 + (s1 >> 1)), txr2->Canvas, TRect(s1 * j, s0, s1 * j + s1, s0 + s1));
x -= s1 + 5;
}
else
{
// scr->Canvas->CopyRect(TRect(x - s0, y + s0 - s2, x, s0), txr2->Canvas, TRect(s0 * j, 0, s0 * j + s0, s2));
x -= s0 + 5;
}
}
}
// total time measurement
// performance_tms = tperf0;
// tend();
// ttotal = tstr(1) + " total";
x = m * mxs + m;
c = 16;
y = -c;
// scr->Canvas->Font->Color = clYellow;
// scr->Canvas->Brush->Style = bsClear;
// scr->Canvas->TextOutA(x, y += c, string().sprintf("player: %.2lf x %.2lf x %.2lf", plrx, plry, plrz));
// scr->Canvas->TextOutA(x, y += c, string().sprintf(" mouse: %.2lf x %.2lf", keys.mx, keys.my));
// scr->Canvas->TextOutA(x, y += c, tray);
// scr->Canvas->TextOutA(x, y += c, tcls);
// scr->Canvas->TextOutA(x, y += c, tmap);
// scr->Canvas->TextOutA(x, y += c, ttotal);
// scr->Canvas->TextOutA(x, y += c, string().sprintf(" key: %d", keys.Key));
// aspect ratio test
/*
c=ys2*7/10;
scr->Canvas->Rectangle(xs2-c,ys2-c,xs2+c,ys2+c);
*/
// cross
// c = 4, m = 32;
// scr->Canvas->Pen->Color = clRed;
// scr->Canvas->MoveTo(xs2 - c, ys2 - m);
// scr->Canvas->LineTo(xs2 - c, ys2 - c);
// scr->Canvas->LineTo(xs2 - m, ys2 - c);
// scr->Canvas->MoveTo(xs2 + c, ys2 - m);
// scr->Canvas->LineTo(xs2 + c, ys2 - c);
// scr->Canvas->LineTo(xs2 + m, ys2 - c);
// scr->Canvas->MoveTo(xs2 - c, ys2 + m);
// scr->Canvas->LineTo(xs2 - c, ys2 + c);
// scr->Canvas->LineTo(xs2 - m, ys2 + c);
// scr->Canvas->MoveTo(xs2 + c, ys2 + m);
// scr->Canvas->LineTo(xs2 + c, ys2 + c);
// scr->Canvas->LineTo(xs2 + m, ys2 + c);
// scr->Canvas->Brush->Style = bsSolid;
}
//---------------------------------------------------------------------------
void Doom3D::update(double dt)
{
int move = 0;
double da = 120.0_deg * dt;
double dl = 5.0 * dt;
double dx = 0.0, dy = 0.0, dz = 0.0;
// if (keys.get(104))
// {
// plra -= da;
// if (plra < 0.0)
// plra += pi2;
// } // turn l/r
// if (keys.get(105))
// {
// plra += da;
// if (plra >= pi2)
// plra -= pi2;
// }
// if (keys.get(101))
// {
// move = 1;
// dx = +dl * cos(plra);
// dy = +dl * sin(plra);
// } // move f/b
// if (keys.get(98))
// {
// move = 1;
// dx = -dl * cos(plra);
// dy = -dl * sin(plra);
// }
// if (keys.get(102))
// {
// move = 1;
// dx = dl * cos(plra - 90_deg);
// dy = dl * sin(plra - 90_deg);
// } // strafe l/r
// if (keys.get(99))
// {
// move = 1;
// dx = dl * cos(plra + 90_deg);
// dy = dl * sin(plra + 90_deg);
// }
// if (keys.get(100))
// {
// move = 1;
// dz = +dl;
// } // strafe u/d
// if (keys.get(97))
// {
// move = 1;
// dz = -dl;
// }
if (move) // update/test plr position
{
double x, y, z, mx, my;
x = plrx + dx;
mx = mxs - focus;
y = plry + dy;
my = mys - focus;
z = plrz + dz;
if ((z >= 0.0) && (z <= _Doom3D_wall_size))
plrz = z;
;
if (x < focus)
x = focus;
if (x > mx)
x = mx;
if (y < focus)
y = focus;
if (y > my)
y = my;
// dx *= divide(focus, dl);
// TODO: divide by 0
dx *= dl == 0 ? 0 : focus / dl;
// dy *= divide(focus, dl);
// TODO: divide by 0
dy *= dl == 0 ? 0 : focus / dl;
if ((pmap[uint(y + dy)][uint(x + dx)] & 0xFFFF) == 0xFFFF)
{
plrx = x;
plry = y;
}
else if ((pmap[uint(y + dy)][uint(x)] & 0xFFFF) == 0xFFFF)
plry = y;
else if ((pmap[uint(y)][uint(x + dx)] & 0xFFFF) == 0xFFFF)
plrx = x;
}
// keys.rfskey();
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#endif
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
| 30.05174 | 145 | 0.363813 | [
"render",
"vector",
"3d"
] |
850a380d9605d4e71416fea685265459e2cbd97c | 18,320 | c | C | hellfireos/drivers/noc/noc.c | brunoccst/LabirintoEmbarcado | 47e7a8b0c4be0a3a73c77923bbeaedb8a6909363 | [
"MIT"
] | null | null | null | hellfireos/drivers/noc/noc.c | brunoccst/LabirintoEmbarcado | 47e7a8b0c4be0a3a73c77923bbeaedb8a6909363 | [
"MIT"
] | null | null | null | hellfireos/drivers/noc/noc.c | brunoccst/LabirintoEmbarcado | 47e7a8b0c4be0a3a73c77923bbeaedb8a6909363 | [
"MIT"
] | null | null | null | /**
* @file noc.c
* @author Sergio Johann Filho
* @date April 2016
*
* @section LICENSE
*
* This source code is licensed under the GNU General Public License,
* Version 2. See the file 'doc/license/gpl-2.0.txt' for more details.
*
* @section DESCRIPTION
*
* NoC (Network-on-Chip) interconnect driver. This driver works with 16-bit word packets and
* a basic communication protocol between the cores and the network interface, provided by
* ni_ready(), ni_flush(), ni_read_packet() and ni_write_packet() helper functions (defined
* on ni_generic.h). The generic interfaces were defined for a typical Hermes NoC configuration
* (ni_hermes.c) but may be adapted for other NoCs or configurations if network packets are
* abstracted in the format presented below.
*
* Packet format is as follows:
*
\verbatim
2 bytes 2 bytes 2 bytes 2 bytes 2 bytes 2 bytes 2 bytes 2 bytes ....
--------------------------------------------------------------------------------------------------
|tgt_cpu |payload |src_cpu |src_port |tgt_port |msg_size |seq |channel | ... data ... |
--------------------------------------------------------------------------------------------------
\endverbatim
*
* The platform should include the following macros:
*
* NOC_INTERCONNECT intra-chip interconnection type
* CPU_ID a unique sequential number for each core
* NOC_WIDTH number of columns of the 2D mesh
* NOC_HEIGHT number of rows of the 2D mesh
* NOC_PACKET_SIZE packet size (in 16 bit flits)
* NOC_PACKET_SLOTS number of slots in the shared packet queue per core
*/
#include <hellfire.h>
#include <noc.h>
#include <ni.h>
#include <ni_generic.h>
/**
* @brief NoC driver: initializes the network interface.
*
* A queue for the packet driver is initialized with NOC_PACKET_SLOTS capacity (in packets).
* The queue is populated with empty packets (pointers to dinamically allocated memory areas)
* which will be used (shared) among all tasks for the reception of data. The hardware is reset
* and the NoC interrupt handler is registered. This routine is called during the system boot-up
* and is dependent on the architecture implementation.
*/
void ni_init(void)
{
int32_t i;
void *ptr;
kprintf("\nKERNEL: this is core #%d", CPU_ID);
kprintf("\nKERNEL: NoC queue init, %d packets", NOC_PACKET_SLOTS);
pktdrv_queue = hf_queue_create(NOC_PACKET_SLOTS);
if (pktdrv_queue == NULL) panic(PANIC_OOM);
for (i = 0; i < MAX_TASKS; i++)
pktdrv_ports[i] = 0;
for (i = 0; i < NOC_PACKET_SLOTS; i++){
ptr = hf_malloc(sizeof(int16_t) * NOC_PACKET_SIZE);
if (ptr == NULL) panic(PANIC_OOM);
hf_queue_addtail(pktdrv_queue, ptr);
}
i = ni_flush(NOC_PACKET_SIZE);
if (i){
_irq_register(IRQ_NOC_READ, (funcptr)ni_isr);
_irq_mask_set(IRQ_NOC_READ);
kprintf("\nKERNEL: NoC driver registered");
}else{
kprintf("\nKERNEL: NoC NI init failed");
}
}
/**
* @brief NoC driver: network interface interrupt service routine.
*
* This routine is called by the second level of interrupt handling. An interrupt from the network
* interface means a full packet has arrived. The packet header is decoded and the target port is
* identified. A reference to an empty packet is removed from the pool of buffers (packets), the
* contents of the empty packet are filled with flits from the hardware queue and the reference is
* put on the target task (associated to a port) queue of packets. There is one queue per task of
* configurable size (individual queues are elastic if size is zero, limited to the size of free
* buffer elements from the common pool). If port 0xffff (65535) is used as the target, the packet
* is passed to a callback. This mechanism can be used to build custom OS functions (such as user
* defined protocols, RPC or remote system calls). Port 0 is used as a discard function, for testing
* purposes.
*/
void ni_isr(void *arg)
{
int32_t k;
uint16_t *buf_ptr;
buf_ptr = hf_queue_remhead(pktdrv_queue);
if (buf_ptr) {
ni_read_packet(buf_ptr, NOC_PACKET_SIZE);
if (buf_ptr[PKT_PAYLOAD] != NOC_PACKET_SIZE - 2){
hf_queue_addtail(pktdrv_queue, buf_ptr);
return;
}
if (buf_ptr[PKT_TARGET_CPU] != ((NOC_COLUMN(CPU_ID) << 4) | NOC_LINE(CPU_ID))){
kprintf("\nKERNEL: hardware error: this is not CPU X:%d Y:%d", (buf_ptr[PKT_TARGET_CPU] & 0xf0) >> 4, buf_ptr[PKT_TARGET_CPU] & 0xf);
hf_queue_addtail(pktdrv_queue, buf_ptr);
return;
}
switch (buf_ptr[PKT_TARGET_PORT]) {
case 0x0000:
hf_queue_addtail(pktdrv_queue, buf_ptr);
return;
case 0xffff:
if (pktdrv_callback)
pktdrv_callback(buf_ptr);
hf_queue_addtail(pktdrv_queue, buf_ptr);
return;
default:
break;
}
for (k = 0; k < MAX_TASKS; k++)
if (pktdrv_ports[k] == buf_ptr[PKT_TARGET_PORT]) break;
if (k < MAX_TASKS && krnl_tcb[k].ptask){
if (hf_queue_addtail(pktdrv_tqueue[k], buf_ptr)){
kprintf("\nKERNEL: task (on port %d) queue full! dropping packet...", buf_ptr[PKT_TARGET_PORT]);
hf_queue_addtail(pktdrv_queue, buf_ptr);
}
}else{
kprintf("\nKERNEL: no task on port %d (offender: cpu %d port %d) - dropping packet...", buf_ptr[PKT_TARGET_PORT], buf_ptr[PKT_SOURCE_CPU], buf_ptr[PKT_SOURCE_PORT]);
hf_queue_addtail(pktdrv_queue, buf_ptr);
}
}else{
kprintf("\nKERNEL: NoC queue full! dropping packet...");
ni_flush(NOC_PACKET_SIZE);
}
return;
}
/**
* @brief Returns the current cpu id number.
*
* @return the current cpu id, defined by the CPU_ID macro.
*/
uint16_t hf_cpuid(void)
{
return CPU_ID;
}
/**
* @brief Returns the number of processors in the system.
*
* @return the number of cores, defined by the dimensions of the NoC mesh.
*/
uint16_t hf_ncores(void)
{
return NOC_WIDTH * NOC_HEIGHT;
}
/**
* @brief Creates a communication queue for a task, using a port number as an alias.
*
* @param id is the task id which will own the communication queue
* @param port is the receiving port for the task
* @param packets is the communication queue size, in packets
*
* @return ERR_OK when successful, ERR_INVALID_ID if no task matches the specified id, ERR_COMM_UNFEASIBLE
* if there is already a communication queue for the task, ERR_COMM_ERROR if there is already another task
* using the specified port and ERR_OUT_OF_MEMORY if the systems runs out of memory.
*
* The queue created for the task will be used for the reception of data. Both ni_isr() and hf_recv()
* routines will manage the queue, putting and pulling packets from the queue on demand. The communication
* subsystem is configured by the association of a task id to a receiving port (alias) and the definition
* of how many packet slots a task has on its queue.
*
* If the third parameter (packets) is set to 0, the maximum number of packets from the pool is available
* to the task for the reception of data. This is the default, and should be used in most situations.
*/
int32_t hf_comm_create(uint16_t id, uint16_t port, uint16_t packets)
{
int32_t k;
if (id < MAX_TASKS){
if (krnl_tcb[id].ptask == 0)
return ERR_INVALID_ID;
if (pktdrv_tqueue[id] != NULL)
return ERR_COMM_UNFEASIBLE;
for (k = 0; k < MAX_TASKS; k++)
if (pktdrv_ports[k] == port) break;
if (!k || k < MAX_TASKS)
return ERR_COMM_ERROR;
}else{
return ERR_INVALID_ID;
}
if (packets > NOC_PACKET_SLOTS || packets == 0)
packets = NOC_PACKET_SLOTS;
pktdrv_tqueue[id] = hf_queue_create(packets);
if (pktdrv_tqueue[id] == 0){
return ERR_OUT_OF_MEMORY;
}else{
pktdrv_ports[id] = port;
return ERR_OK;
}
}
/**
* @brief Destroys a communication queue, returning packets buffered on a task message queue to
* the shared pool of packets.
*
* @param id is the task id which owns the communication queue
*
* @return ERR_OK when successful, ERR_INVALID_ID if no task matches the specified id, ERR_COMM_ERROR
* if the queue could not be destroyed.
*/
int32_t hf_comm_destroy(uint16_t id)
{
int32_t status;
if (id < MAX_TASKS){
if (krnl_tcb[id].ptask == 0)
return ERR_INVALID_ID;
}else{
return ERR_INVALID_ID;
}
status = _di();
while (hf_queue_count(pktdrv_tqueue[id]))
hf_queue_addtail(pktdrv_queue, hf_queue_remhead(pktdrv_tqueue[id]));
_ei(status);
if (hf_queue_destroy(pktdrv_tqueue[id])){
return ERR_COMM_ERROR;
}else{
pktdrv_ports[id] = 0;
return ERR_OK;
}
}
/**
* @brief Probes for a message from a task.
* @return channel of the first message that is waiting in queue (a value >= 0), ERR_COMM_EMPTY when no messages are
* waiting in queue, ERR_COMM_UNFEASIBLE when no message queue (comm) was created.
*
* Asynchronous communication is possible using this primitive, as it first tests if there is data
* ready for reception with hf_recv() which is a blocking primitive. The main advantage of using hf_recvprobe()
* along with hf_recv() is that a selective receive can be performed in the right communication channel. As
* the message is waiting at the beginning of the queue, a receive on its channel can be used to process the
* messages in order, avoiding packet loss.
*/
int32_t hf_recvprobe(void)
{
uint16_t id;
int32_t k;
uint16_t *buf_ptr;
id = hf_selfid();
if (pktdrv_tqueue[id] == NULL) return ERR_COMM_UNFEASIBLE;
k = hf_queue_count(pktdrv_tqueue[id]);
if (k){
buf_ptr = hf_queue_get(pktdrv_tqueue[id], 0);
if (buf_ptr)
if (buf_ptr[PKT_CHANNEL] != 0xffff)
return buf_ptr[PKT_CHANNEL];
}
return ERR_COMM_EMPTY;
}
/**
* @brief Receives a message from a task (blocking receive).
*
* @param source_cpu is a pointer to a variable which will hold the source cpu
* @param source_port is a pointer to a variable which will hold the source port
* @param buf is a pointer to a buffer to hold the received message
* @param size a pointer to a variable which will hold the size (in bytes) of the received message
* @param channel is the selected message channel of this message (must be the same as in the sender)
*
* @return ERR_OK when successful, ERR_COMM_UNFEASIBLE when no message queue (comm) was
* created and ERR_SEQ_ERROR when received packets arrive out of order, so the message
* is corrupted.
*
* A message is build from packets received on the ni_isr() routine. Packets are decoded and
* combined in a complete message, returning the message, its size and source identification
* to the calling task. The buffer where the message will be stored must be large enough or
* we will have a problem that may not be noticed before its too late.
*/
int32_t hf_recv(uint16_t *source_cpu, uint16_t *source_port, int8_t *buf, uint16_t *size, uint16_t channel)
{
uint16_t id, seq = 0, packet = 0, packets, payload_bytes;
uint32_t status;
int32_t i, k, p = 0, error = ERR_OK;
uint16_t *buf_ptr;
id = hf_selfid();
if (pktdrv_tqueue[id] == NULL) return ERR_COMM_UNFEASIBLE;
while (1){
k = hf_queue_count(pktdrv_tqueue[id]);
if (k){
buf_ptr = hf_queue_get(pktdrv_tqueue[id], 0);
if (buf_ptr)
if (buf_ptr[PKT_CHANNEL] == channel && buf_ptr[PKT_SEQ] == seq + 1) break;
status = _di();
buf_ptr = hf_queue_remhead(pktdrv_tqueue[id]);
hf_queue_addtail(pktdrv_tqueue[id], buf_ptr);
_ei(status);
}
}
status = _di();
buf_ptr = hf_queue_remhead(pktdrv_tqueue[id]);
_ei(status);
*source_cpu = buf_ptr[PKT_SOURCE_CPU];
*source_port = buf_ptr[PKT_SOURCE_PORT];
*size = buf_ptr[PKT_MSG_SIZE];
seq = buf_ptr[PKT_SEQ];
payload_bytes = (NOC_PACKET_SIZE - PKT_HEADER_SIZE) * sizeof(uint16_t);
packets = (*size % payload_bytes == 0) ? (*size / payload_bytes) : (*size / payload_bytes + 1);
while (++packet < packets){
if (buf_ptr[PKT_SEQ] != seq++)
error = ERR_SEQ_ERROR;
for (i = PKT_HEADER_SIZE; i < NOC_PACKET_SIZE; i++){
buf[p++] = (uint8_t)(buf_ptr[i] >> 8);
buf[p++] = (uint8_t)(buf_ptr[i] & 0xff);
}
status = _di();
hf_queue_addtail(pktdrv_queue, buf_ptr);
_ei(status);
i = 0;
while (1){
k = hf_queue_count(pktdrv_tqueue[id]);
if (k){
buf_ptr = hf_queue_get(pktdrv_tqueue[id], 0);
if (buf_ptr)
if (buf_ptr[PKT_CHANNEL] == channel && buf_ptr[PKT_SEQ] == seq) break;
status = _di();
buf_ptr = hf_queue_remhead(pktdrv_tqueue[id]);
hf_queue_addtail(pktdrv_tqueue[id], buf_ptr);
_ei(status);
if (i++ > NOC_PACKET_SLOTS << 3) break;
}
}
status = _di();
buf_ptr = hf_queue_remhead(pktdrv_tqueue[id]);
_ei(status);
}
if (buf_ptr[PKT_SEQ] != seq++)
error = ERR_SEQ_ERROR;
for (i = PKT_HEADER_SIZE; i < NOC_PACKET_SIZE && p < *size; i++){
buf[p++] = (uint8_t)(buf_ptr[i] >> 8);
buf[p++] = (uint8_t)(buf_ptr[i] & 0xff);
}
status = _di();
hf_queue_addtail(pktdrv_queue, buf_ptr);
_ei(status);
return error;
}
/**
* @brief Sends a message to a task (blocking send).
*
* @param target_cpu is the target processor
* @param target_port is the target task port
* @param buf is a pointer to a buffer that holds the message
* @param size is the size (in bytes) of the message
* @param channel is the selected message channel of this message (must be the same as in the receiver)
*
* @return ERR_OK
*
* A message is broken into packets containing a header and part of the message as the payload.
* The packets are injected, one by one, in the network through the network interface.
*/
int32_t hf_send(uint16_t target_cpu, uint16_t target_port, int8_t *buf, uint16_t size, uint16_t channel)
{
uint16_t packet = 0, packets, payload_bytes, id;
int32_t i, p = 0;
uint16_t out_buf[NOC_PACKET_SIZE];
id = hf_selfid();
if (pktdrv_tqueue[id] == NULL) return ERR_COMM_UNFEASIBLE;
payload_bytes = (NOC_PACKET_SIZE - PKT_HEADER_SIZE) * sizeof(uint16_t);
packets = (size % payload_bytes == 0) ? (size / payload_bytes) : (size / payload_bytes + 1);
while (++packet < packets){
out_buf[PKT_TARGET_CPU] = (NOC_COLUMN(target_cpu) << 4) | NOC_LINE(target_cpu);
out_buf[PKT_PAYLOAD] = NOC_PACKET_SIZE - 2;
out_buf[PKT_SOURCE_CPU] = hf_cpuid();
out_buf[PKT_SOURCE_PORT] = pktdrv_ports[id];
out_buf[PKT_TARGET_PORT] = target_port;
out_buf[PKT_MSG_SIZE] = size;
out_buf[PKT_SEQ] = packet;
out_buf[PKT_CHANNEL] = channel;
for (i = PKT_HEADER_SIZE; i < NOC_PACKET_SIZE; i++, p+=2)
out_buf[i] = ((uint8_t)buf[p] << 8) | (uint8_t)buf[p+1];
ni_write_packet(out_buf, NOC_PACKET_SIZE);
}
out_buf[PKT_TARGET_CPU] = (NOC_COLUMN(target_cpu) << 4) | NOC_LINE(target_cpu);
out_buf[PKT_PAYLOAD] = NOC_PACKET_SIZE - 2;
out_buf[PKT_SOURCE_CPU] = hf_cpuid();
out_buf[PKT_SOURCE_PORT] = pktdrv_ports[id];
out_buf[PKT_TARGET_PORT] = target_port;
out_buf[PKT_MSG_SIZE] = size;
out_buf[PKT_SEQ] = packet;
out_buf[PKT_CHANNEL] = channel;
for (i = PKT_HEADER_SIZE; i < NOC_PACKET_SIZE && (p < size); i++, p+=2)
out_buf[i] = ((uint8_t)buf[p] << 8) | (uint8_t)buf[p+1];
for(; i < NOC_PACKET_SIZE; i++)
out_buf[i] = 0xdead;
ni_write_packet(out_buf, NOC_PACKET_SIZE);
delay_ms(1);
return ERR_OK;
}
/**
* @brief Receives a message from a task (blocking receive) with acknowledgement.
*
* @param source_cpu is a pointer to a variable which will hold the source cpu
* @param source_port is a pointer to a variable which will hold the source port
* @param buf is a pointer to a buffer to hold the received message
* @param size a pointer to a variable which will hold the size (in bytes) of the received message
* @param channel is the selected message channel of this message (must be the same as in the sender)
*
* @return ERR_OK when successful, ERR_COMM_UNFEASIBLE when no message queue (comm) was
* created and ERR_SEQ_ERROR when received packets arrive out of order, so the message
* is corrupted.
*
* A message is build from packets received on the ni_isr() routine. Packets are decoded and
* combined in a complete message, returning the message, its size and source identification
* to the calling task. The buffer where the message will be stored must be large enough or
* we will have a problem that may not be noticed before its too late. After the reception
* of the whole message is completed, an acknowledgement is sent to the sender task. This works
* as a flow control mechanism, avoiding buffer/queue overflows common to the raw protocol.
* Message channel 65535 will be used for the flow control mechanism. This routine must be used
* exclusively with hf_sendack().
*/
int32_t hf_recvack(uint16_t *source_cpu, uint16_t *source_port, int8_t *buf, uint16_t *size, uint16_t channel)
{
int32_t error;
error = hf_recv(source_cpu, source_port, buf, size, channel);
if (error == ERR_OK){
hf_send(*source_cpu, *source_port, "ok", 3, 65535);
}
return error;
}
/**
* @brief Sends a message to a task (blocking send) with acknowledgement.
*
* @param target_cpu is the target processor
* @param target_port is the target task port
* @param buf is a pointer to a buffer that holds the message
* @param size is the size (in bytes) of the message
* @param channel is the selected message channel of this message (must be the same as in the receiver)
* @param timeout is the time (in ms) that the sender will wait for a reception acknowledgement
*
* @return ERR_OK
*
* A message is broken into packets containing a header and part of the message as the payload.
* The packets are injected, one by one, in the network through the network interface. After that, the
* sender will wait for an acknowledgement from the receiver. This works as a flow control mechanism,
* avoiding buffer/queue overflows common to the raw protocol. Message channel 65535 will be used for
* the flow control mechanism. This routine should be used exclusively with hf_recvack().
*/
int32_t hf_sendack(uint16_t target_cpu, uint16_t target_port, int8_t *buf, uint16_t size, uint16_t channel, uint32_t timeout)
{
uint16_t id, source_cpu, source_port;
int32_t error, k;
uint32_t time;
int8_t ack[4];
uint16_t *buf_ptr;
error = hf_send(target_cpu, target_port, buf, size, channel);
if (error == ERR_OK){
id = hf_selfid();
time = _read_us() / 1000;
while (1){
k = hf_queue_count(pktdrv_tqueue[id]);
if (k){
buf_ptr = hf_queue_get(pktdrv_tqueue[id], 0);
if (buf_ptr)
if (buf_ptr[PKT_CHANNEL] == 65535 && buf_ptr[PKT_MSG_SIZE] == 3) break;
}
if (((_read_us() / 1000) - time) > timeout) return ERR_COMM_TIMEOUT;
}
hf_recv(&source_cpu, &source_port, ack, &size, 65535);
}
return error;
}
| 34.828897 | 168 | 0.711026 | [
"mesh"
] |
85141fabeca291faef117ae4367c90a903c016f1 | 1,588 | h | C | geonlp_ma_makedic/MakedicGenerator.h | t-sagara/geonlp-software | bcb57f55d4790b8f332f44dcb78b5a3cca2f1a63 | [
"BSD-2-Clause",
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-09-15T07:47:41.000Z | 2019-09-15T07:47:41.000Z | geonlp_ma_makedic/MakedicGenerator.h | t-sagara/geonlp-software | bcb57f55d4790b8f332f44dcb78b5a3cca2f1a63 | [
"BSD-2-Clause",
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-09-13T08:27:35.000Z | 2019-09-14T00:43:07.000Z | geonlp_ma_makedic/MakedicGenerator.h | t-sagara/geonlp-software | bcb57f55d4790b8f332f44dcb78b5a3cca2f1a63 | [
"BSD-2-Clause",
"BSD-2-Clause-FreeBSD"
] | 1 | 2018-10-03T10:56:23.000Z | 2018-10-03T10:56:23.000Z | ///
/// @file
/// @brief 地名語辞書からIPADIC辞書を作成する MakedicGenerator の最上位のビジネスロジッククラス。
/// @author Picolab Co.ltd
///
/// Copyright (c)2010-2011, NII
///
#ifndef _IPADIC_GENERATOR_
#define _IPADIC_GENERATOR_
#include <vector>
#include <string>
#include "MakedicException.h"
#include "MakedicGeneratorAppArgument.h"
#include "MakedicGeneratorConfiguration.h"
#include "MakedicItem.h"
#include "Wordlist.h"
#include "darts.h"
class MakedicGenerator {
private:
std::string mecab_dict_index_path;
std::string sysdic_directory_path;
std::string geoword_hinshi_id;
std::vector<std::string> example_sentences;
bool deleteTempFileFlag;
bool verboseMode;
bool geowordFeatureCheckMode;
geonlp::Profile profile;
std::string csv_output_filename;
/*
std::string geodic_filepath;
std::string darts_filepath;
std::string ipadic_filepath;
*/
// 一時ファイルのプレフィックス
std::string tmpfile_prefix;
void _read_db(std::vector<geonlp::Wordlist>& wordlists) const
throw(MakedicException);
std::string _create_tmpfile_name(const char* suffix, int counter = 0) const;
void _create_ipadic_item(const geonlp::Wordlist& wordlist, const long& cost, MakedicItem& item) const;
void _createDartsIndex(std::vector<geonlp::Wordlist>& wordlists) const;
public:
/// @brief コンストラクタ
///
/// @param [in] conf 構成
/// @param [in] profile プロファイル
MakedicGenerator(
const MakedicGeneratorConfiguration& conf,
const MakedicGeneratorAppArgument& arg);
/// @brief 地名語辞書からIPADIC辞書を作成する。
void generate(bool doUpdateWordlist = false) const throw (MakedicException);
};
#endif
| 20.101266 | 103 | 0.75 | [
"vector"
] |
851797d94c95ebef549f88444b9cef502045cd0c | 1,439 | h | C | EasyFramework3d/constr/ModelConstraintFactory.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | EasyFramework3d/constr/ModelConstraintFactory.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | EasyFramework3d/constr/ModelConstraintFactory.h | sizilium/FlexChess | f12b94e800ddcb00535067eca3b560519c9122e0 | [
"MIT"
] | null | null | null | /**
* @file ModelConstraintFactory.h
* @author sizilium
* @date 13.01.2008
* @brief This file is part of the Vision Synthesis Easy Framework.\n
* This file has no copyright; you can change everything.
* Visit www.vision-synthesis.de or www.easy-framework.de for further informations.\n
* If there is a bug please send a mail to bug@vision-synthesis.de. No warranty is given!
*/
#ifndef MODEL_CONSTRAINT_FACTORY_H
#define MODEL_CONSTRAINT_FACTORY_H
// includes
#include <vs/Build.hpp>
#include <vs/constr/AbstractConstraintFactory.h>
#include <vs/base/xml/AbstractXmlFactory.h>
#include <vs/base/math/DoubleVector.h>
namespace vs
{
// predeclarations
namespace managed {namespace gl {namespace model {class ManagedModel; }}}
namespace constr
{
/** @class ModelConstraintFactory
*
*/
class VS_EXPORT ModelConstraintFactory : public AbstractConstraintFactory,
public base::xml::AbstractXmlFactory
{
public:
ModelConstraintFactory();
~ModelConstraintFactory();
const std::string getName() const;
/**
*
*/
base::interfaces::AbstractConstraint* createModelMoveConstraint (
managed::gl::model::ManagedModel *model,
unsigned int modelId,
base::math::DoubleVector startCoord,
base::math::DoubleVector endCoord,
double time,
const std::string &name = "");
private:
};
} // constr
} // vs
#endif // MODEL_CONSTRAINT_FACTORY_H
| 25.245614 | 89 | 0.707436 | [
"model"
] |
8519ec3ae6a2b9178fea7473497d8eff70b70ef9 | 10,265 | c | C | shoveler/examples/lights.c | improbablejan/shoveler-spatialos | f0bed77332478ba2dfd2d282a57fd6fd5f3ad712 | [
"MIT"
] | null | null | null | shoveler/examples/lights.c | improbablejan/shoveler-spatialos | f0bed77332478ba2dfd2d282a57fd6fd5f3ad712 | [
"MIT"
] | null | null | null | shoveler/examples/lights.c | improbablejan/shoveler-spatialos | f0bed77332478ba2dfd2d282a57fd6fd5f3ad712 | [
"MIT"
] | null | null | null | #include <stdlib.h> // EXIT_FAILURE, EXIT_SUCCESS
#include <glib.h>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <shoveler/camera/perspective.h>
#include <shoveler/drawable/cube.h>
#include <shoveler/drawable/quad.h>
#include <shoveler/drawable/point.h>
#include <shoveler/light/point.h>
#include <shoveler/material/color.h>
#include <shoveler/material/particle.h>
#include <shoveler/material/texture.h>
#include <shoveler/constants.h>
#include <shoveler/controller.h>
#include <shoveler/framebuffer.h>
#include <shoveler/game.h>
#include <shoveler/global.h>
#include <shoveler/image.h>
#include <shoveler/input.h>
#include <shoveler/model.h>
#include <shoveler/opengl.h>
#include <shoveler/sampler.h>
#include <shoveler/scene.h>
#include <shoveler/shader_program.h>
#include <shoveler/texture.h>
static ShovelerSampler *nearestNeighborSampler;
static ShovelerSampler *interpolatingSampler;
static ShovelerMaterial *colorMaterial;
static ShovelerMaterial *particleMaterial;
static ShovelerMaterial *screenspaceTextureMaterial;
static ShovelerMaterial *textureMaterial;
static ShovelerDrawable *quad;
static ShovelerDrawable *cube;
static ShovelerDrawable *point;
static ShovelerModel *downCubeModel;
static ShovelerModel *frontCubeModel;
static ShovelerModel *leftCubeModel;
static ShovelerModel *rightCubeModel;
static void shovelerSampleTerminate();
static void shovelerSampleUpdate(ShovelerGame *game, double dt);
int main(int argc, char *argv[])
{
ShovelerGameWindowSettings windowSettings;
windowSettings.windowTitle = "shoveler";
windowSettings.fullscreen = false;
windowSettings.vsync = true;
windowSettings.samples = 4;
windowSettings.windowedWidth = 640;
windowSettings.windowedHeight = 480;
ShovelerGameCameraSettings cameraSettings;
cameraSettings.frame.position = shovelerVector3(0, 0, -5);
cameraSettings.frame.direction = shovelerVector3(0, 0, 1);
cameraSettings.frame.up = shovelerVector3(0, 1, 0);
cameraSettings.projection.fieldOfViewY = 2.0f * SHOVELER_PI * 50.0f / 360.0f;
cameraSettings.projection.aspectRatio = (float) windowSettings.windowedWidth / windowSettings.windowedHeight;
cameraSettings.projection.nearClippingPlane = 0.01;
cameraSettings.projection.farClippingPlane = 1000;
ShovelerGameControllerSettings controllerSettings;
controllerSettings.frame = cameraSettings.frame;
controllerSettings.moveFactor = 2.0f;
controllerSettings.tiltFactor = 0.0005f;
controllerSettings.boundingBoxSize2 = 0.0f;
controllerSettings.boundingBoxSize3 = 0.0f;
shovelerLogInit("shoveler/", SHOVELER_LOG_LEVEL_INFO_UP, stdout);
shovelerGlobalInit();
ShovelerGame *game = shovelerGameCreate(shovelerSampleUpdate, &windowSettings, &cameraSettings, &controllerSettings);
if(game == NULL) {
return EXIT_FAILURE;
}
nearestNeighborSampler = shovelerSamplerCreate(false, true, true);
interpolatingSampler = shovelerSamplerCreate(true, true, true);
colorMaterial = shovelerMaterialColorCreate(game->shaderCache, /* screenspace */ false, shovelerVector4(0.7, 0.7, 0.7, 1.0));
ShovelerImage *image = shovelerImageCreate(2, 2, 3);
shovelerImageClear(image);
shovelerImageGet(image, 0, 0, 0) = 255;
shovelerImageGet(image, 0, 1, 1) = 255;
shovelerImageGet(image, 1, 0, 2) = 255;
shovelerImageGet(image, 1, 1, 0) = 255;
shovelerImageGet(image, 1, 1, 1) = 255;
shovelerImageGet(image, 1, 1, 2) = 255;
ShovelerTexture *texture = shovelerTextureCreate2d(image, true);
shovelerTextureUpdate(texture);
textureMaterial = shovelerMaterialTextureCreate(game->shaderCache, /* screenspace */ false, SHOVELER_MATERIAL_TEXTURE_TYPE_PHONG, texture, true, nearestNeighborSampler, false);
shovelerOpenGLCheckSuccess();
quad = shovelerDrawableQuadCreate();
ShovelerModel *groundModel = shovelerModelCreate(quad, colorMaterial);
groundModel->translation.values[1] = -10.0f;
groundModel->rotation.values[0] = SHOVELER_PI / 2.0f;
groundModel->scale.values[0] = 10.0f;
groundModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(groundModel);
shovelerSceneAddModel(game->scene, groundModel);
ShovelerModel *ceilingModel = shovelerModelCreate(quad, colorMaterial);
ceilingModel->translation.values[1] = 10.0f;
ceilingModel->rotation.values[0] = -SHOVELER_PI / 2.0f;
ceilingModel->scale.values[0] = 10.0f;
ceilingModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(ceilingModel);
shovelerSceneAddModel(game->scene, ceilingModel);
ShovelerModel *frontWallModel = shovelerModelCreate(quad, colorMaterial);
frontWallModel->translation.values[2] = 10.0f;
frontWallModel->rotation.values[0] = SHOVELER_PI;
frontWallModel->scale.values[0] = 10.0f;
frontWallModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(frontWallModel);
shovelerSceneAddModel(game->scene, frontWallModel);
ShovelerModel *backWallModel = shovelerModelCreate(quad, colorMaterial);
backWallModel->translation.values[2] = -10.0f;
backWallModel->scale.values[0] = 10.0f;
backWallModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(backWallModel);
shovelerSceneAddModel(game->scene, backWallModel);
ShovelerModel *leftWallModel = shovelerModelCreate(quad, colorMaterial);
leftWallModel->translation.values[0] = 10.0f;
leftWallModel->rotation.values[1] = SHOVELER_PI / 2.0f;
leftWallModel->scale.values[0] = 10.0f;
leftWallModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(leftWallModel);
shovelerSceneAddModel(game->scene, leftWallModel);
ShovelerModel *rightWallModel = shovelerModelCreate(quad, colorMaterial);
rightWallModel->translation.values[0] = -10.0f;
rightWallModel->rotation.values[1] = -SHOVELER_PI / 2.0f;
rightWallModel->scale.values[0] = 10.0f;
rightWallModel->scale.values[1] = 10.0f;
shovelerModelUpdateTransformation(rightWallModel);
shovelerSceneAddModel(game->scene, rightWallModel);
cube = shovelerDrawableCubeCreate();
downCubeModel = shovelerModelCreate(cube, textureMaterial);
downCubeModel->translation.values[1] = -5;
shovelerModelUpdateTransformation(downCubeModel);
shovelerSceneAddModel(game->scene, downCubeModel);
frontCubeModel = shovelerModelCreate(cube, textureMaterial);
frontCubeModel->translation.values[2] = 5;
shovelerModelUpdateTransformation(frontCubeModel);
shovelerSceneAddModel(game->scene, frontCubeModel);
leftCubeModel = shovelerModelCreate(cube, textureMaterial);
leftCubeModel->translation.values[0] = 5;
shovelerModelUpdateTransformation(leftCubeModel);
shovelerSceneAddModel(game->scene, leftCubeModel);
rightCubeModel = shovelerModelCreate(cube, textureMaterial);
rightCubeModel->translation.values[0] = -5;
shovelerModelUpdateTransformation(rightCubeModel);
shovelerSceneAddModel(game->scene, rightCubeModel);
ShovelerLight *pointlight = shovelerLightPointCreate(game->shaderCache, shovelerVector3(0, 0, 0), 1024, 1024, 1, 0.0f, 80.0f, shovelerVector3(1.0f, 1.0f, 1.0f));
shovelerSceneAddLight(game->scene, pointlight);
ShovelerLight *pointlight2 = shovelerLightPointCreate(game->shaderCache, shovelerVector3(-8, -8, -8), 1024, 1024, 1, 0.0f, 80.0f, shovelerVector3(0.1f, 0.1f, 0.1f));
shovelerSceneAddLight(game->scene, pointlight2);
point = shovelerDrawablePointCreate();
particleMaterial = shovelerMaterialParticleCreate(game->shaderCache, shovelerVector4(1.0f, 1.0f, 1.0f, 1.0f));
ShovelerModel *pointlightModel = shovelerModelCreate(point, particleMaterial);
pointlightModel->scale = shovelerVector3(0.5f, 0.5f, 0);
pointlightModel->castsShadow = false;
pointlightModel->emitter = true;
shovelerModelUpdateTransformation(pointlightModel);
shovelerSceneAddModel(game->scene, pointlightModel);
ShovelerModel *pointlightModel2 = shovelerModelCreate(point, particleMaterial);
pointlightModel2->translation = shovelerLightGetPosition(pointlight2);
pointlightModel2->scale = shovelerVector3(0.1f, 0.1f, 0);
pointlightModel2->castsShadow = false;
pointlightModel2->emitter = true;
shovelerModelUpdateTransformation(pointlightModel2);
shovelerSceneAddModel(game->scene, pointlightModel2);
screenspaceTextureMaterial = shovelerMaterialTextureCreate(game->shaderCache, /* screenspace */ true, SHOVELER_MATERIAL_TEXTURE_TYPE_DEPTH, shovelerLightPointGetShared(pointlight)->depthFramebuffer->depthTarget, /* manageTexture */ false, nearestNeighborSampler, /* manageSampler */ false);
ShovelerModel *screenQuadModel = shovelerModelCreate(quad, screenspaceTextureMaterial);
screenQuadModel->translation.values[0] = -0.75;
screenQuadModel->translation.values[1] = -0.75;
screenQuadModel->scale.values[0] = 0.25;
screenQuadModel->scale.values[1] = 0.25;
shovelerModelUpdateTransformation(screenQuadModel);
shovelerSceneAddModel(game->scene, screenQuadModel);
shovelerOpenGLCheckSuccess();
while(shovelerGameIsRunning(game)) {
shovelerGameRenderFrame(game);
}
shovelerLogInfo("Exiting main loop, goodbye.");
shovelerSampleTerminate();
shovelerGameFree(game);
shovelerGlobalUninit();
shovelerLogTerminate();
return EXIT_SUCCESS;
}
static void shovelerSampleTerminate()
{
shovelerDrawableFree(cube);
shovelerDrawableFree(quad);
shovelerDrawableFree(point);
shovelerMaterialFree(colorMaterial);
shovelerMaterialFree(particleMaterial);
shovelerMaterialFree(screenspaceTextureMaterial);
shovelerMaterialFree(textureMaterial);
shovelerSamplerFree(interpolatingSampler);
shovelerSamplerFree(nearestNeighborSampler);
}
static void shovelerSampleUpdate(ShovelerGame *game, double dt)
{
shovelerCameraUpdateView(game->camera);
downCubeModel->rotation.values[0] += 0.1f * dt;
downCubeModel->rotation.values[1] += 0.2f * dt;
downCubeModel->rotation.values[2] += 0.5f * dt;
shovelerModelUpdateTransformation(downCubeModel);
frontCubeModel->rotation.values[0] += 0.1f * dt;
frontCubeModel->rotation.values[1] += 0.2f * dt;
frontCubeModel->rotation.values[2] += 0.3f * dt;
shovelerModelUpdateTransformation(frontCubeModel);
leftCubeModel->rotation.values[0] += 0.4f * dt;
leftCubeModel->rotation.values[1] += 0.2f * dt;
leftCubeModel->rotation.values[2] += 0.1f * dt;
shovelerModelUpdateTransformation(leftCubeModel);
rightCubeModel->rotation.values[0] += 0.5f * dt;
rightCubeModel->rotation.values[1] += 0.2f * dt;
rightCubeModel->rotation.values[2] += 0.3f * dt;
shovelerModelUpdateTransformation(rightCubeModel);
}
| 40.573123 | 291 | 0.793376 | [
"model"
] |
851a532709e8dc156e1ac18685da5dfd7e416a73 | 7,683 | h | C | smtk/mesh/utility/ExtractTessellation.h | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | null | null | null | smtk/mesh/utility/ExtractTessellation.h | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | null | null | null | smtk/mesh/utility/ExtractTessellation.h | jcfr/SMTK | 0069ea37f8f71a440b8f10a157b84a56ca004551 | [
"BSD-3-Clause-Clear"
] | null | null | null | //=========================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt 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.
//=========================================================================
#ifndef smtk_mesh_utility_ExtractTessellation_h
#define smtk_mesh_utility_ExtractTessellation_h
#include <cstdint>
#include "smtk/mesh/core/CellSet.h"
#include "smtk/mesh/core/MeshSet.h"
namespace smtk
{
namespace model
{
class EntityRef;
class Loop;
} // namespace model
namespace mesh
{
namespace utility
{
class SMTKCORE_EXPORT PreAllocatedTessellation
{
public:
// Todo: Document that connectivityLength is just pure length of connectivity
// if you are enabling vtk length you need to allocate for connectivityLength
// + numberOfCells
static void determineAllocationLengths(
const smtk::mesh::MeshSet& ms,
std::int64_t& connectivityLength,
std::int64_t& numberOfCells,
std::int64_t& numberOfPoints);
static void determineAllocationLengths(
const smtk::mesh::CellSet& cs,
std::int64_t& connectivityLength,
std::int64_t& numberOfCells,
std::int64_t& numberOfPoints);
static void determineAllocationLengths(
const smtk::model::EntityRef& eRef,
const smtk::mesh::ResourcePtr& c,
std::int64_t& connectivityLength,
std::int64_t& numberOfCells,
std::int64_t& numberOfPoints);
static void determineAllocationLengths(
const smtk::model::Loop& loop,
const smtk::mesh::ResourcePtr& c,
std::int64_t& connectivityLength,
std::int64_t& numberOfCells,
std::int64_t& numberOfPoints);
//Only converts connectivity. The following properties will not be
//converted: cellLocations, cellTypes, and Points
PreAllocatedTessellation(std::int64_t* connectivity);
//Converts connectivity and store the points as floats. The following properties will not be
//converted: cellLocations, and cellTypes.
PreAllocatedTessellation(std::int64_t* connectivity, float* points);
//Converts connectivityand store the points as doubles. The following properties will not be
//converted: cellLocations, and cellTypes.
PreAllocatedTessellation(std::int64_t* connectivity, double* points);
//Converts everything but Points.
PreAllocatedTessellation(
std::int64_t* connectivity,
std::int64_t* cellLocations,
unsigned char* cellTypes);
//Converts everything and stores the points as floats
PreAllocatedTessellation(
std::int64_t* connectivity,
std::int64_t* cellLocations,
unsigned char* cellTypes,
float* points);
//Converts everything and stores the points as doubles
PreAllocatedTessellation(
std::int64_t* connectivity,
std::int64_t* cellLocations,
unsigned char* cellTypes,
double* points);
//determine if you want VTK 6.0 style connectivity array where each cell
//is preceded with an entry that states the length of the cell. Passing
//in True will disable this behavior. The default behavior of the
//class is to use VTK style connectivity.
void disableVTKStyleConnectivity(bool disable) { m_useVTKConnectivity = !disable; }
//determine if you want VTK cell enum values for the cell types array.
//If this is disabled we use the smtk/mesh cell enum values.
void disableVTKCellTypes(bool disable) { m_useVTKCellTypes = !disable; }
bool hasConnectivity() const { return m_connectivity != nullptr; }
bool hasCellLocations() const { return m_cellLocations != nullptr; }
bool hasCellTypes() const { return m_cellTypes != nullptr; }
bool hasDoublePoints() const { return m_dpoints != nullptr; }
bool hasFloatPoints() const { return m_fpoints != nullptr; }
bool useVTKConnectivity() const { return m_useVTKConnectivity; }
bool useVTKCellTypes() const { return m_useVTKCellTypes; }
private:
template<class PointConnectivity>
friend SMTKCORE_EXPORT void extractTessellationInternal(
PointConnectivity&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
std::int64_t* m_connectivity;
std::int64_t* m_cellLocations;
unsigned char* m_cellTypes;
double* m_dpoints;
float* m_fpoints;
bool m_useVTKConnectivity;
bool m_useVTKCellTypes;
};
class SMTKCORE_EXPORT Tessellation
{
public:
//Default construction of Tessellation, enables vtk connectivity and cell types
Tessellation();
Tessellation(bool useVTKConnectivity, bool useVTKCellTypes);
bool useVTKConnectivity() const { return m_useVTKConnectivity; }
bool useVTKCellTypes() const { return m_useVTKCellTypes; }
//This class self allocates all the memory needed to extract tessellation
//and auto extract the tessellation based on the MeshSet or CellSet you
//pass in
void extract(const smtk::mesh::MeshSet& ms);
void extract(const smtk::mesh::CellSet& cs);
void extract(const smtk::mesh::MeshSet& cs, const smtk::mesh::PointSet& ps);
void extract(const smtk::mesh::CellSet& cs, const smtk::mesh::PointSet& ps);
//use these methods to gain access to the tessellation after
const std::vector<std::int64_t>& connectivity() const { return m_connectivity; }
const std::vector<std::int64_t>& cellLocations() const { return m_cellLocations; }
const std::vector<unsigned char>& cellTypes() const { return m_cellTypes; }
const std::vector<double>& points() const { return m_points; }
private:
std::vector<std::int64_t> m_connectivity;
std::vector<std::int64_t> m_cellLocations;
std::vector<unsigned char> m_cellTypes;
std::vector<double> m_points;
bool m_useVTKConnectivity{ true };
bool m_useVTKCellTypes{ true };
};
//Don't wrap these for python, instead python should use the Tessellation class
//and the extract method
SMTKCORE_EXPORT void extractTessellation(const smtk::mesh::MeshSet&, PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractTessellation(const smtk::mesh::CellSet&, PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractTessellation(
const smtk::model::EntityRef&,
const smtk::mesh::ResourcePtr&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractOrderedTessellation(
const smtk::model::EdgeUse&,
const smtk::mesh::ResourcePtr&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractOrderedTessellation(
const smtk::model::Loop&,
const smtk::mesh::ResourcePtr&,
PreAllocatedTessellation&);
//Extract Tessellation in respect to another PointSet instead of the PointSet
//contained by the meshset. This is useful if you are sharing a single
//PointSet among multiple Tessellations.
SMTKCORE_EXPORT void extractTessellation(
const smtk::mesh::MeshSet&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractTessellation(
const smtk::mesh::CellSet&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractTessellation(
smtk::mesh::PointConnectivity&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractTessellation(
const smtk::model::EntityRef&,
const smtk::mesh::ResourcePtr&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractOrderedTessellation(
const smtk::model::EdgeUse&,
const smtk::mesh::ResourcePtr&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
SMTKCORE_EXPORT void extractOrderedTessellation(
const smtk::model::Loop&,
const smtk::mesh::ResourcePtr&,
const smtk::mesh::PointSet&,
PreAllocatedTessellation&);
} // namespace utility
} // namespace mesh
} // namespace smtk
#endif
| 34.608108 | 96 | 0.744891 | [
"mesh",
"vector",
"model"
] |
852df46813c4a77d25a55f1b13124c5cae7a88d4 | 636 | h | C | sandbox/dynload/testObject.h | bapch/er-301 | e652eb9253009897747b0de7cfc57a27ac0cde1a | [
"MIT"
] | null | null | null | sandbox/dynload/testObject.h | bapch/er-301 | e652eb9253009897747b0de7cfc57a27ac0cde1a | [
"MIT"
] | null | null | null | sandbox/dynload/testObject.h | bapch/er-301 | e652eb9253009897747b0de7cfc57a27ac0cde1a | [
"MIT"
] | null | null | null | #ifndef __testObject_H__
#define __testObject_H__
#include <od/objects/Object.h>
#include <vector>
#include <string>
namespace testObject
{
class MicroDelay : public od::Object
{
public:
MicroDelay(const std::string &name, float secs);
virtual ~MicroDelay();
#ifndef SWIGLUA
virtual void process();
od::Inlet mInput{"In"};
od::Parameter mDelay{"Delay"};
od::Outlet mOutput{"Out"};
#endif
private:
std::vector<float> mBuffer;
int mReadIndex = 0;
int mWriteIndex = 0;
int mMaxDelayInSamples = 0;
void setMaxDelay(int n);
};
} // namespace testObject
#endif // __testObject_H__
| 18.171429 | 52 | 0.676101 | [
"object",
"vector"
] |
8530827b63c26b17d34b6fcb61e70bb9377857b6 | 599 | h | C | searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2018-12-30T05:42:18.000Z | 2018-12-30T05:42:18.000Z | searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2021-01-21T01:37:37.000Z | 2021-01-21T01:37:37.000Z | searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h | amahussein/vespa | 29d266ae1e5c95e25002b97822953fdd02b1451e | [
"Apache-2.0"
] | 1 | 2020-12-08T19:56:35.000Z | 2020-12-08T19:56:35.000Z | // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "unarybitfunctionnode.h"
namespace search::expression {
class XorBitFunctionNode : public UnaryBitFunctionNode
{
public:
DECLARE_EXPRESSIONNODE(XorBitFunctionNode);
XorBitFunctionNode();
XorBitFunctionNode(ExpressionNode::UP arg, unsigned numBits);
~XorBitFunctionNode();
private:
mutable std::vector<uint8_t> _tmpXor;
bool internalExecute(const vespalib::nbostream & os) const override;
void onPrepareResult() override;
};
}
| 27.227273 | 118 | 0.766277 | [
"vector"
] |
8536677e318d65afd32c0725880db961e3c83b6d | 902 | h | C | source/globjects/include/globjects/ProgramBinary.h | citron0xa9/globjects | 53a1de45f3c177fbd805610f274d3ffb1b97843a | [
"MIT"
] | null | null | null | source/globjects/include/globjects/ProgramBinary.h | citron0xa9/globjects | 53a1de45f3c177fbd805610f274d3ffb1b97843a | [
"MIT"
] | null | null | null | source/globjects/include/globjects/ProgramBinary.h | citron0xa9/globjects | 53a1de45f3c177fbd805610f274d3ffb1b97843a | [
"MIT"
] | 2 | 2020-10-01T04:10:51.000Z | 2021-07-01T07:45:45.000Z |
#pragma once
#include <vector>
#include <glbinding/gl/types.h>
#include <globjects/globjects_api.h>
#include <globjects/base/ChangeListener.h>
#include <globjects/base/Changeable.h>
#include <globjects/base/Instantiator.h>
namespace globjects
{
class AbstractStringSource;
/**
* \brief The ProgramBinary class is used for directly setting binary sources for a Program.
*
* \see Program
* \see http://www.opengl.org/registry/specs/ARB/get_program_binary.txt
*/
class GLOBJECTS_API ProgramBinary : public Changeable, public Instantiator<ProgramBinary>
{
public:
ProgramBinary(gl::GLenum binaryFormat, const std::vector<unsigned char> & data);
virtual ~ProgramBinary();
gl::GLenum format() const;
const void * data() const;
gl::GLsizei length() const;
protected:
gl::GLenum m_binaryFormat;
std::vector<unsigned char> m_binaryData;
};
} // namespace globjects
| 20.976744 | 92 | 0.737251 | [
"vector"
] |
8537774401578778412652973a63e932c5cb651d | 7,337 | h | C | imgui_orient.h | cmaughan/imgui | b562cfeb14060a6b3b0c8189c3e16ea1ffa01070 | [
"MIT"
] | 16 | 2017-01-03T15:48:39.000Z | 2020-05-26T02:02:55.000Z | imgui_orient.h | cmaughan/imgui | b562cfeb14060a6b3b0c8189c3e16ea1ffa01070 | [
"MIT"
] | null | null | null | imgui_orient.h | cmaughan/imgui | b562cfeb14060a6b3b0c8189c3e16ea1ffa01070 | [
"MIT"
] | 1 | 2021-12-10T23:43:53.000Z | 2021-12-10T23:43:53.000Z | #pragma once
#include <float.h>
#include <math.h>
#include <algorithm>
#ifndef M_PI
#define M_PI 3.14159862f
#endif
// ----------------------------
// Notes from: www.github.com/cmaughan
// Ported from AntTweakBar
// This is a really nice implementation of an orientation widget; all due respect to the original author ;)
// Dependencies kept to a minimum. I basically vectorized the original code, added a few math types, cleaned things up and
// made it clearer what the maths was doing.
// I tried to make it more imgui-like, and removed all the excess stuff not needed here. This still needs work.
// I also added triangle culling because ImGui doesn't support winding clip
// The widget works by transforming the 3D object to screen space and clipping the triangles. This makes it work with any
// imgui back end, without modifications to the renderers.
//
// TODO:
// More cleanup.
// Figure out what ShowDir is for.
// Test direction vectors more
// --------------------------
// Firstly, a little math, missing from ImGui but needed for this widget
// A Vec3, Matrix 3x3, Dot & Cross products, A Quaternion. Some helper functions, bare minimum
struct ImVec3
{
float x, y, z;
ImVec3() { x = y = z = 0.0f; }
ImVec3(float _x, float _y, float _z) { x = _x; y = _y; z = _z; }
ImVec3 RotY() const { return ImVec3(-z, y, x); }
ImVec3 RotZ() const { return ImVec3(-y, x, z); }
ImVec3 Cross(const ImVec3& b) const { return ImVec3(y * b.z - z * b.y, z * b.x - x * b.z, x * b.y - y * b.x); }
float Dot(const ImVec3& b) const { return x * b.x + y * b.y + z * b.z; }
ImVec3 Mult(float val) const { return ImVec3(x * val, y * val, z * val); }
ImVec3 Div(float val) const { return ImVec3(x / val, y / val, z / val); }
float Length() const { return (float)sqrt(x * x + y * y + z * z); }
#ifdef IM_VEC3_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
IM_VEC3_CLASS_EXTRA
#endif
};
// Added to the existing ImVec2 vector
inline ImVec2 ImVec2Subtract(const ImVec2& left, const ImVec2& right) { return ImVec2(left.x - right.x, left.y - right.y); }
inline float ImVec2Cross(const ImVec2& left, const ImVec2& right) { return (left.x * right.y) - (left.y * right.x); }
struct ImQuat
{
float x, y, z, w;
ImQuat() { x = y = z = 0.0f; w = 1.0f; }
ImQuat(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }
ImQuat Div(float val) { return ImQuat(x / val, y / val, z / val, w / val); }
ImVec3 Rotate(const ImVec3& dir)
{
float ps = -x * dir.x - y * dir.y - z * dir.z;
float px = w * dir.x + y * dir.z - z * dir.y;
float py = w * dir.y + z * dir.x - x * dir.z;
float pz = w * dir.z + x * dir.y - y * dir.x;
return ImVec3(-ps * x + px * w - py * z + pz * y, -ps * y + py * w - pz * x + px * z, -ps * z + pz * w - px * y + py * x);
}
ImQuat Mult(const ImQuat& q2)
{
ImQuat out;
out.x = w * q2.x + x * q2.w + y * q2.z - z * q2.y;
out.y = w * q2.y + y * q2.w + z * q2.x - x * q2.z;
out.z = w * q2.z + z * q2.w + x * q2.y - y * q2.x;
out.w = w * q2.w - (x * q2.x + y * q2.y + z * q2.z);
return out;
}
#ifdef IM_QUAT_CLASS_EXTRA // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.
IM_QUAT_CLASS_EXTRA
#endif
};
// Matrix used to allow user to specify axis orientation
struct ImMat3x3
{
float m[3][3];
ImMat3x3()
{
for (int x = 0; x < 3; x++)
{
for (int y = 0; y < 3; y++)
{
m[y][x] = (x == y) ? 1.0f : 0.0f;
}
}
}
ImVec3 Transform(const ImVec3& vec)
{
ImVec3 out;
out.x = m[0][0] * vec.x + m[1][0] * vec.y + m[2][0] * vec.z;
out.y = m[0][1] * vec.x + m[1][1] * vec.y + m[2][1] * vec.z;
out.z = m[0][2] * vec.x + m[1][2] * vec.y + m[2][2] * vec.z;
return out;
}
ImVec3 TransformInv(const ImVec3& vec)
{
ImVec3 out;
out.x = m[0][0] * vec.x + m[0][1] * vec.y + m[0][2] * vec.z;
out.y = m[1][0] * vec.x + m[1][1] * vec.y + m[1][2] * vec.z;
out.z = m[2][0] * vec.x + m[2][1] * vec.y + m[2][2] * vec.z;
return out;
}
};
inline float ImDegToRad(float degree) { return degree * (float(M_PI) / 180.0f); }
inline float ImRadToDeg(float radian) { return radian * (180.0f / float(M_PI)); }
// The data structure that holds the orientation among other things
struct ImOrient
{
ImQuat Qt; // Quaternion value
ImVec3 Axis; // Axis and Angle
float Angle;
ImVec3 Dir; // Dir value set when used as a direction
bool m_AAMode; // Axis & angle mode
bool m_IsDir; // Mapped to a dir vector instead of a quat
ImVec3 m_ShowDir; // CM: Not sure what this is all about?
ImU32 m_DirColor; // Direction vector color
ImMat3x3 AxisTransform; // Transform to required axis frame
// For the geometry
enum EArrowParts { ARROW_CONE, ARROW_CONE_CAP, ARROW_CYL, ARROW_CYL_CAP };
static ImVector<ImVec3> s_SphTri;
static ImVector<ImU32> s_SphCol;
static ImVector<ImVec2> s_SphTriProj;
static ImVector<ImU32> s_SphColLight;
static ImVector<ImVec3> s_ArrowTri[4];
static ImVector<ImVec2> s_ArrowTriProj[4];
static ImVector<ImVec3> s_ArrowNorm[4];
static ImVector<ImU32> s_ArrowColLight[4];
static void CreateSphere();
static void CreateArrow();
IMGUI_API bool Draw(const char* label);
IMGUI_API void DrawTriangles(ImDrawList* draw_list, const ImVec2& offset, const ImVector<ImVec2>& triProj, const ImVector<ImU32>& colLight, int numVertices, float cullDir);
IMGUI_API void ConvertToAxisAngle();
IMGUI_API void ConvertFromAxisAngle();
// Quaternions
inline float QuatD(float w, float h) { return (float)std::min(std::abs(w), std::abs(h)) - 4.0f; }
inline float QuatPX(float x, float w, float h) { return (x*0.5f*QuatD(w, h) + w*0.5f + 0.5f); }
inline float QuatPY(float y, float w, float h) { return (-y*0.5f*QuatD(w, h) + h*0.5f - 0.5f); }
inline float QuatIX(int x, float w, float h) { return (2.0f*x - w - 1.0f) / QuatD(w, h); }
inline float QuatIY(int y, float w, float h) { return (-2.0f*y + h - 1.0f) / QuatD(w, h); }
IMGUI_API void QuatFromDir(ImQuat& quat, const ImVec3& dir);
IMGUI_API static void QuatFromAxisAngle(ImQuat& qt, const ImVec3& axis, float angle);
// Useful colors
IMGUI_API static ImU32 ColorBlend(ImU32 _Color1, ImU32 _Color2, float _S);
typedef unsigned int color32;
const ImU32 COLOR32_BLACK = 0xff000000; // Black
const ImU32 COLOR32_WHITE = 0xffffffff; // White
const ImU32 COLOR32_ZERO = 0x00000000; // Zero
const ImU32 COLOR32_RED = 0xffff0000; // Red
const ImU32 COLOR32_GREEN = 0xff00ff00; // Green
const ImU32 COLOR32_BLUE = 0xff0000ff; // Blue
const int GIZMO_SIZE = 200;
};
// The API
namespace ImGui
{
IMGUI_API bool QuaternionGizmo(const char* label, ImQuat& quat);
IMGUI_API bool AxisAngleGizmo(const char* label, ImVec3& axis, float& angle);
IMGUI_API bool DirectionGizmo(const char* label, ImVec3& dir);
};
| 39.446237 | 176 | 0.607742 | [
"geometry",
"object",
"vector",
"transform",
"3d"
] |
855bcb99cb805006833a3cb07bd0808e2dd6c1e3 | 16,049 | h | C | engine/interior/interiorInstance.h | ClayHanson/B4v21-Public-Repo | c812aa7bf2ecb267e02969c85f0c9c2a29be0d28 | [
"MIT"
] | 1 | 2020-08-18T19:45:34.000Z | 2020-08-18T19:45:34.000Z | engine/interior/interiorInstance.h | ClayHanson/B4v21-Launcher-Public-Repo | c812aa7bf2ecb267e02969c85f0c9c2a29be0d28 | [
"MIT"
] | null | null | null | engine/interior/interiorInstance.h | ClayHanson/B4v21-Launcher-Public-Repo | c812aa7bf2ecb267e02969c85f0c9c2a29be0d28 | [
"MIT"
] | null | null | null | //-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
#ifndef _INTERIORINSTANCE_H_
#define _INTERIORINSTANCE_H_
//Includes
#ifndef _PLATFORM_H_
#include "platform/platform.h"
#endif
#ifndef _SCENEOBJECT_H_
#include "sim/sceneObject.h"
#endif
#ifndef _RESMANAGER_H_
#include "core/resManager.h"
#endif
#ifndef _INTERIORRES_H_
#include "interior/interiorRes.h"
#endif
#ifndef _INTERIORLMMANAGER_H_
#include "interior/interiorLMManager.h"
#endif
#ifndef _BITVECTOR_H_
#include "core/bitVector.h"
#endif
#ifndef _COLOR_H_
#include "core/color.h"
#endif
class AbstractPolyList;
class LightUpdateGrouper;
class InteriorSubObject;
class InteriorResTrigger;
class MaterialList;
class TextureObject;
class FloorPlan;
class Convex;
class AudioProfile;
class AudioEnvironment;
//--------------------------------------------------------------------------
class InteriorInstance : public SceneObject
{
typedef SceneObject Parent;
friend class SceneLighting;
friend class FloorPlan;
public:
InteriorInstance();
~InteriorInstance();
S32 getSurfaceZone(U32 surfaceindex, Interior *detail);
void processLightSurfaceList(U32 *lightSurfaces, U32 *numLightSurfaces,
InteriorInstance *interiorinstance, Interior *detail, ::LightInfo *light);
static void init();
static void destroy();
// Collision
public:
bool buildPolyList(AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere);
bool castRay(const Point3F &start, const Point3F &end, RayInfo *info);
virtual void setTransform(const MatrixF &mat);
void buildConvex(const Box3F& box,Convex* convex);
private:
Convex* mConvexList;
public:
/// @name Lighting control
/// @{
/// This returns true if the interior is in an alarm state. Alarm state
/// will put different lighting into the interior and also possibly
/// have an audio element also.
bool inAlarmState() {return(mAlarmState);}
/// This sets the alarm mode of the interior.
/// @param alarm If true the interior will be in an alarm state next frame
void setAlarmMode(const bool alarm);
/// Activates a light with the given name on all detail levels of the interior
/// @param pLightName Name of the light
void activateLight(const char* pLightName);
/// Deactivates a light with the given name on all detail levels of the interior
/// @param pLightName Name of the light
void deactivateLight(const char* pLightName);
/// Echos out all the lights in the interior, starting with triggerable then
/// animated lights
void echoTriggerableLights();
/// @}
public:
/// @name Subobject access interface
/// @{
/// Returns the number of detail levels for an object
U32 getNumDetailLevels();
/// Gets the interior associated with a particular detail level
/// @param level Detail level
Interior* getDetailLevel(const U32 level);
/// Sets the detail level to render manually
/// @param level Detail level to force
void setDetailLevel(S32 level = -1) { mForcedDetailLevel = level; }
/// @}
// Material management for overlays
public:
/// Reloads material information if the interior skin changes
void renewOverlays();
/// Sets the interior skin to something different
/// @param newBase New base skin
void setSkinBase(const char *newBase);
public:
static bool smDontRestrictOutside;
static F32 smDetailModification;
DECLARE_CONOBJECT(InteriorInstance);
static void initPersistFields();
static void consoleInit();
void onStaticModified( const char* slotName );
/// Reads the lightmaps of the interior into the provided pointer
/// @param lightmaps Lightmaps in the interior (out)
bool readLightmaps(GBitmap ****lightmaps);
protected:
bool onAdd();
void onRemove();
void inspectPreApply();
void inspectPostApply();
static U32 smLightUpdatePeriod;
static bool smRenderDynamicLights;
U32 mLightUpdatedTime;
void setLightUpdatedTime(const U32);
U32 getLightUpdatedTime() const;
bool onSceneAdd(SceneGraph *graph);
void onSceneRemove();
U32 getPointZone(const Point3F& p);
bool getOverlappingZones(SceneObject* obj, U32* zones, U32* numZones);
bool getLightingAmbientColor(ColorF * col)
{
*col = ColorF(1.0, 1.0, 1.0);
return true;
}
U32 calcDetailLevel(SceneState*, const Point3F&);
bool prepRenderImage(SceneState *state, const U32 stateKey, const U32 startZone, const bool modifyBaseZoneState);
void renderObject(SceneState *state, SceneRenderImage *image);
bool scopeObject(const Point3F& rootPosition,
const F32 rootDistance,
bool* zoneScopeState);
public:
/// This is used to store the preferred lighting method for this interior. It is networked.
bool mUseGLLighting;
/// This indicates what we're actually doing; that way we can bump things to use GL lighting when they are moved.
bool mDoSimpleDynamicRender;
/// Not yet implemented
void addChildren();
/// Returns true if the interiors are rendering dynamic lighting
static bool getRenderDynamicLights() { return(smRenderDynamicLights); }
/// Turns on or off dynamic lighting of interiors
/// @param val If true dynamic lighting is enabled
static void setRenderDynamicLights(bool val) { smRenderDynamicLights = val; }
private:
/// @name Light utility methods
/// These should not be called directly. Use the public activateLight(const char *)
/// method instead because unless the detail level is rendering and it's much
/// easier to not manage the lights on a per-detail level basis.
/// @{
/// Activates a specific light for a detail level
/// @param detail Detail level
/// @param lightIndex Index of light in light list
void activateLight(const U32 detail, const U32 lightIndex);
/// Deactivates a specific light for a detail level
/// @param detail Detail level
/// @param lightIndex Index of light in the light list
void deactivateLight(const U32 detail, const U32 lightIndex);
/// @}
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream);
void unpackUpdate(NetConnection *conn, BitStream *stream);
enum UpdateMaskBits {
InitMask = BIT(0),
TransformMask = BIT(1),
AlarmMask = BIT(2),
// Reserved for light updates (8 bits for now)
_lightupdate0 = BIT(3),
_lightupdate1 = BIT(4),
_lightupdate2 = BIT(5),
_lightupdate3 = BIT(6),
_lightupdate4 = BIT(7),
_lightupdate5 = BIT(8),
_lightupdate6 = BIT(9),
_lightupdate7 = BIT(10),
SkinBaseMask = BIT(11),
AudioMask = BIT(12),
NextFreeMask = BIT(13)
};
enum Constants {
LightUpdateBitStart = 3,
LightUpdateBitEnd = 10
};
private:
StringTableEntry mInteriorFileName; ///< File name of the interior this instance encapuslates
U32 mInteriorFileHash; ///< Hash for interior file name, used for sorting
Resource<InteriorResource> mInteriorRes; ///< Interior managed by resource manager
Vector<MaterialList*> mMaterialMaps; ///< Materials for this interior
StringTableEntry mSkinBase; ///< Skin for this interior
Vector< Vector<InteriorSubObject*> > mInteriorSubObjects; ///< Sub objects of this interior
bool mShowTerrainInside; ///< Enables or disables terrain showing through the interior
LM_HANDLE mLMHandle; ///< Handle to the light manager
AudioProfile * mAudioProfile; ///< Audio profile
AudioEnvironment * mAudioEnvironment; ///< Audio environment
S32 mForcedDetailLevel; ///< Forced LOD, if -1 auto LOD
U32 mCRC; ///< CRC for the interior
public:
/// Returns the Light Manager handle
LM_HANDLE getLMHandle() { return(mLMHandle); }
/// Returns the audio profile
AudioProfile * getAudioProfile() { return(mAudioProfile); }
/// Returns the audio environment
AudioEnvironment * getAudioEnvironment() { return(mAudioEnvironment); }
/// This is used to determine just how 'inside' a point is in an interior.
/// This is used by the environmental audio code for audio properties and the
/// function always returns true.
/// @param pos Point to test
/// @param pScale How inside is the point 0 = totally outside, 1 = totally inside (out)
bool getPointInsideScale(const Point3F & pos, F32 * pScale); // ~0: outside -> 1: inside
/// Returns the interior resource
Resource<InteriorResource> & getResource() {return(mInteriorRes);} // SceneLighting::InteriorProxy interface
/// Returns the CRC for validation
U32 getCRC() { return(mCRC); }
/// @name Vertex Lighting
/// Vertex lighting is the alternative to lightmapped interiors
/// @{
Vector<Vector<ColorI>*> mVertexColorsNormal; ///< Vertex colors under normal lighting per detail level
Vector<Vector<ColorI>*> mVertexColorsAlarm; ///< Vertex colors under alarm lighting per detail level
/// Rebuilds the vertex colors for alarm and normal states for all detail levels
void rebuildVertexColors();
/// Returns the normal vertex lighting colors for a detail level
/// @param detail Detail level
Vector<ColorI>* getVertexColorsNormal(U32 detail);
/// Returns the alarm vertex lighting colors for a detail level
/// @param detail Detail level
Vector<ColorI>* getVertexColorsAlarm(U32 detail);
/// @}
// Alarm state information
private:
enum AlarmState {
Normal = 0,
Alarm = 1
};
bool mAlarmState; ///< Alarm state of the interior
// LightingAnimation information
private:
struct LightInfo {
struct Light {
U32 curState;
U32 curTime;
ColorI curColor;
bool active;
bool alarm;
};
struct StateDataInfo {
ColorI curColor;
U8* curMap;
bool alarm;
};
Vector<Light> mLights;
BitVector mSurfaceInvalid;
Vector<StateDataInfo> mStateDataInfo;
};
Vector<LightInfo> mLightInfo; ///< Light info, one per detail level
LightUpdateGrouper* mUpdateGrouper; ///< Designed to group net updates for lights to reduce traffic
/// @name Light Grouper
/// This is for managing light updates across the network
/// @{
/// Creates an update key for the LightGrouper
/// @param detail Detail level
/// @param lightIndex Index of light in the interior
static U32 makeUpdateKey(const U32 detail, const U32 lightIndex);
/// Takes an update key and returns the detail level part of it
/// @param key Update key
static U32 detailFromUpdateKey(const U32 key);
/// Takes an update key and returns the light index part of it
/// 2param key Update key
static U32 indexFromUpdateKey(const U32 key);
/// @}
/// @name Animated light functions
/// @{
/// Steps the animated light simulation by a delta
/// @param detail Detail level of interior
/// @param lightIndex Index of light to work on
/// @param ms Time delta from last update in miliseconds
void updateLightTime(const U32 detail, const U32 lightIndex, const U32 ms);
/// This loops through all the surfaces in an interior and calls updateLightMap on them
/// @param state SceneState - Not used
/// @param pInterior Interior to operate on
/// @param rLightInfo Light to use
void downloadLightmaps(SceneState *state, Interior *pInterior, LightInfo &rLightInfo);
/// This will set up a particular light in a particular detail level
/// @param detail Detail level
/// @param lightIndex Light to install
void installLight(const U32 detail, const U32 lightIndex);
/// Called by updateLightTime to update a light with a looping animation
/// @param interior Interior to work on
/// @param light Light to update
/// @param lightIndex Index of animated light
/// @param ms Time delta from last update in miliseconds
void updateLoopingLight(Interior *interior, LightInfo::Light &light, const U32 lightIndex, const U32 ms);
/// Called by updateLightTime to update a light with a flicker animation
/// @param interior Interior to work on
/// @param light Light to update
/// @param lightIndex Index of animated light
/// @param ms Time delta from last update in miliseconds
void updateFlickerLight(Interior *interior, LightInfo::Light &light, const U32 lightIndex, const U32 ms);
/// Called by updateLightTime to update a light with a fade-up (ramp) animation light
/// @param interior Interior to work on
/// @param light Light to update
/// @param lightIndex Index of animated light
/// @param ms Time delta from last update in miliseconds
void updateRampLight(Interior *interior, LightInfo::Light &light, const U32 lightIndex, const U32 ms);
/// Updates the animation for all lights
/// @param ms Time delta since last call in ms
void updateAllLights(const U32 ms);
/// Takes the original lightmap and adds the animated lights to it and then
/// binds the texture to it
/// @param pInterior Interior object to map
/// @param rLightInfo Light info to use to update the light map
/// @param surfaceIndex The surface to operate on inside the interior
void updateLightMap(Interior *pInterior, LightInfo &rLightInfo, const U32 surfaceIndex);
/// lightMap is a 24-bit RGB texture, intensityMap is an 8 bit intensity map.
/// This generates lightmap = [lightmap + (intensityMap * color)]
/// @param lightMap Lightmap to operate on (in/out)
/// @param width width of the ligth map
/// @param height hight of the light map
/// @param intensityMap Intensity map
/// @param color Color
void intensityMapMerge(U8* lightMap,
const U32 width, const U32 height,
const U8* intensityMap, const ColorI& color);
/// @}
private:
/// Creates a transform based on an trigger area
/// @param trigger Trigger to create a transform for
/// @param transform Transform generated (out)
void createTriggerTransform(const InteriorResTrigger *trigger, MatrixF *transform);
};
inline void InteriorInstance::setLightUpdatedTime(const U32 now)
{
mLightUpdatedTime = now;
}
inline U32 InteriorInstance::getLightUpdatedTime() const
{
return mLightUpdatedTime;
}
inline U32 InteriorInstance::makeUpdateKey(const U32 detail, const U32 lightIndex)
{
AssertFatal(detail < (1 << 16) && lightIndex < (1 << 16), "Error, out of bounds key params");
return (detail << 16) | (lightIndex & 0x0000FFFF);
}
inline U32 InteriorInstance::detailFromUpdateKey(const U32 key)
{
return (key >> 16) & 0xFFFF;
}
inline U32 InteriorInstance::indexFromUpdateKey(const U32 key)
{
return (key >> 0) & 0xFFFF;
}
inline Vector<ColorI>* InteriorInstance::getVertexColorsNormal(U32 detail)
{
if (bool(mInteriorRes) == false || detail > mInteriorRes->getNumDetailLevels())
return NULL;
return mVertexColorsNormal[detail];
}
inline Vector<ColorI>* InteriorInstance::getVertexColorsAlarm(U32 detail)
{
if (bool(mInteriorRes) == false || detail > mInteriorRes->getNumDetailLevels())
return NULL;
return mVertexColorsAlarm[detail];
}
#endif //_INTERIORBLOCK_H_
| 34.439914 | 124 | 0.664714 | [
"render",
"object",
"vector",
"transform"
] |
856f3595bcd37b86dc3c65d2c48a70a4901f3b47 | 2,787 | h | C | mace/ops/delegator/deconv_2d.h | lq/mace | 27757d888d60a8790501f49fa47692802c49509a | [
"Apache-2.0"
] | null | null | null | mace/ops/delegator/deconv_2d.h | lq/mace | 27757d888d60a8790501f49fa47692802c49509a | [
"Apache-2.0"
] | null | null | null | mace/ops/delegator/deconv_2d.h | lq/mace | 27757d888d60a8790501f49fa47692802c49509a | [
"Apache-2.0"
] | null | null | null | // Copyright 2020 The MACE 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.
#ifndef MACE_OPS_DELEGATOR_DECONV_2D_H_
#define MACE_OPS_DELEGATOR_DECONV_2D_H_
#include <vector>
#include "mace/core/ops/op_context.h"
#include "mace/core/ops/op_delegator.h"
#include "mace/core/registry/op_delegator_registry.h"
namespace mace {
namespace ops {
enum DeconvType {
General,
K2x2S1,
K2x2S2,
K3x3S1,
K3x3S2,
K4x4S1,
K4x4S2,
};
namespace delegator {
struct Deconv2dParam : public DelegatorParam {
explicit Deconv2dParam(const std::vector<int> &strides,
const std::vector<int> &dilations,
const std::vector<int> &paddings,
const Padding padding_type,
const FrameworkType framework_type,
const int group = 1)
: strides_(strides), dilations_(dilations),
paddings_(paddings), padding_type_(padding_type),
framework_type_(framework_type),
group_(group) {}
const std::vector<int> &strides_;
const std::vector<int> &dilations_;
const std::vector<int> &paddings_;
const Padding padding_type_;
const FrameworkType framework_type_;
const int group_;
};
class Deconv2d : public OpDelegator {
public:
explicit Deconv2d(const Deconv2dParam ¶m)
: OpDelegator(param),
strides_(param.strides_),
dilations_(param.dilations_),
paddings_(param.paddings_),
padding_type_(param.padding_type_),
framework_type_(param.framework_type_),
group_(param.group_) {}
virtual ~Deconv2d() = default;
MACE_DEFINE_DELEGATOR_CREATOR(Deconv2d)
virtual MaceStatus Compute(const OpContext *context,
const Tensor *input,
const Tensor *filter,
const Tensor *output_shape,
Tensor *output) = 0;
protected:
const std::vector<int> strides_;
const std::vector<int> dilations_;
const std::vector<int> paddings_;
const Padding padding_type_;
const FrameworkType framework_type_;
const int group_;
};
} // namespace delegator
} // namespace ops
} // namespace mace
#endif // MACE_OPS_DELEGATOR_DECONV_2D_H_
| 29.03125 | 75 | 0.673484 | [
"vector"
] |
857f972906c87e5061cf974c4a5f2d37230d405d | 3,260 | h | C | source/solution_zoo/common/xproto_plugins/uvcplugin/include/uvcplugin/uvcplugin.h | HorizonRobotics-Platform/AI-EXPRESS | 413206d88dae1fbd465ced4d60b2a1769d15c171 | [
"BSD-2-Clause"
] | 98 | 2020-09-11T13:52:44.000Z | 2022-03-23T11:52:02.000Z | source/solution_zoo/common/xproto_plugins/uvcplugin/include/uvcplugin/uvcplugin.h | HorizonRobotics-Platform/ai-express | 413206d88dae1fbd465ced4d60b2a1769d15c171 | [
"BSD-2-Clause"
] | 8 | 2020-10-19T14:23:30.000Z | 2022-03-16T01:00:07.000Z | source/solution_zoo/common/xproto_plugins/uvcplugin/include/uvcplugin/uvcplugin.h | HorizonRobotics-Platform/AI-EXPRESS | 413206d88dae1fbd465ced4d60b2a1769d15c171 | [
"BSD-2-Clause"
] | 28 | 2020-09-17T14:20:35.000Z | 2022-01-10T16:26:00.000Z | /*!
* Copyright (c) 2016-present, Horizon Robotics, Inc.
* All rights reserved.
* \File uvcplugin.h
* \Author ronghui.zhang
* \Version 1.0.0.0
* \Date 2020/5/12
* \Brief implement of api header
*/
#ifndef INCLUDE_UVCPLUGIN_UVCPLUGIN_H_
#define INCLUDE_UVCPLUGIN_UVCPLUGIN_H_
#include <memory>
#include <string>
#include <thread>
#include <vector>
#include "./smart_manager.h"
#include "./hid_manager.h"
#include "./rndis_manager.h"
#include "./usb_common.h"
#include "guvc/uvc.h"
#include "guvc/uvc_gadget.h"
// undef problematic defines sometimes defined by system headers (uvc_gadget.h)
#undef max
#include "./uvc_server.h"
#include "./uac_server.h"
#include "./uvcplugin_config.h"
#include "./venc_client.h"
#include "xproto/message/pluginflow/flowmsg.h"
#include "xproto/plugin/xpluginasync.h"
#include "uevent_helper.h"
namespace horizon {
namespace vision {
namespace xproto {
namespace Uvcplugin {
using horizon::vision::xproto::XPluginAsync;
using horizon::vision::xproto::XProtoMessagePtr;
class UvcPlugin : public xproto::XPluginAsync {
public:
UvcPlugin() = delete;
explicit UvcPlugin(std::string config_path);
~UvcPlugin() override;
int Init() override;
int DeInit() override;
int Start() override;
int Stop() override;
std::string desc() const { return "uvcPlugin"; }
private:
int FeedVideoMsg(XProtoMessagePtr msg);
int FeedVideoDropMsg(XProtoMessagePtr msg);
int FeedVideo(XProtoMessagePtr msg);
int FeedSmart(XProtoMessagePtr msg);
int FeedVideoDrop(XProtoMessagePtr msg);
int FeedMc(XProtoMessagePtr msg);
int FeedMicphoneAudioMsg(XProtoMessagePtr msg);
int FeedMicphoneAudio(XProtoMessagePtr msg);
void ParseConfig();
int Reset();
int ParseConfig(std::string config_file);
void Dwc3UeventMonitor();
void MonitorEvent();
int ReInit();
int ReStart();
int StopUvcHid();
private:
int smart_transfer_mode_ = 0; // 0: hid, 1: rndis, default 0
std::string config_file_;
bool run_flag_;
std::shared_ptr<std::thread> worker_;
std::mutex map_mutex_;
const uint8_t cache_size_ = 25; // max input cache size
std::shared_ptr<UvcServer> uvc_server_;
std::shared_ptr<VencClient> venc_client_;
struct uvc_context *uvc_ctx;
std::shared_ptr<UvcConfig> config_;
std::shared_ptr<std::thread> thread_process_ap_ = nullptr;
std::shared_ptr<SmartManager> smart_manager_;
std::shared_ptr<std::thread> monitor_thread_;
std::shared_ptr<std::thread> dwc3_thread_;
std::shared_ptr<UacServer> uac_server_;
int origin_image_width_ = 1920; // update by FeedVideo
int origin_image_height_ = 1080;
int dst_image_width_ = 1920; // update by FeedVideo
int dst_image_height_ = 1080;
VIDEO_STREAM_S h264_sps_frame_;
std::mutex video_send_mutex_;
int video_sended_without_recv_count_;
hobot::CThreadPool encode_thread_;
hobot::CThreadPool send_audio_thread_;
bool print_timestamp_ = false;
int efd_;
int monitor_flag_;
// uac dev
alsa_device_t* uac_dev_;
int audio_enable_ = 0;
};
} // namespace Uvcplugin
} // namespace xproto
} // namespace vision
} // namespace horizon
#endif // INCLUDE_UVCPLUGIN_UVCPLUGIN_H_
| 28.849558 | 80 | 0.717485 | [
"vector"
] |
858b0f6817d436443901d8bc0bc83fdd6deac4ff | 2,968 | h | C | include/application.h | danilopeixoto/thesaurus | d4b5f9b24726fb1f26b3fd121c5845a818c63c42 | [
"BSD-3-Clause"
] | null | null | null | include/application.h | danilopeixoto/thesaurus | d4b5f9b24726fb1f26b3fd121c5845a818c63c42 | [
"BSD-3-Clause"
] | null | null | null | include/application.h | danilopeixoto/thesaurus | d4b5f9b24726fb1f26b3fd121c5845a818c63c42 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2017, Danilo Peixoto. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the copyright holder 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 THESAURUS_APPLICATION_H
#define THESAURUS_APPLICATION_H
#include "global.h"
#include "stringtype.h"
#include "vectortype.h"
#include "dictionary.h"
#include "translator.h"
#include <cstdio>
THESAURUS_NAMESPACE_BEGIN
class Application {
public:
enum Theme {
Light = 0,
Dark,
Default
};
struct Preferences {
Preferences(const Translator::Language & = Translator::Language::Default,
const Theme & = Theme::Default);
~Preferences();
Translator::Language language;
Theme theme;
};
Application();
~Application();
void execute();
private:
size_t option;
Dictionary dictionary;
Translator translator;
Preferences preferences;
FILE * preferenceFile;
void setTheme(const Theme &);
void requestText(String &);
void requestOption();
void createTitle();
void createMenu(const Vector<String> &);
void print(const String &);
void separator();
void clear();
bool isUInt(const String &) const;
void addAction();
void removeAction();
void editAction();
void searchAction();
void listAction();
void exportAction();
void preferencesAction();
void aboutAction();
void exitAction();
};
THESAURUS_NAMESPACE_END
#endif | 30.916667 | 82 | 0.693733 | [
"vector"
] |
858b1996854dd3698691316dcdd4657fffbb869e | 2,068 | h | C | vsSenVulkan/VulkanAPI/SenRenderer.h | SenonLi/vsSenVulkan_1.42 | a2eea87f9d86798b118811003108d50467891d12 | [
"MIT"
] | null | null | null | vsSenVulkan/VulkanAPI/SenRenderer.h | SenonLi/vsSenVulkan_1.42 | a2eea87f9d86798b118811003108d50467891d12 | [
"MIT"
] | null | null | null | vsSenVulkan/VulkanAPI/SenRenderer.h | SenonLi/vsSenVulkan_1.42 | a2eea87f9d86798b118811003108d50467891d12 | [
"MIT"
] | null | null | null | #pragma once
#ifndef __SenRenderer__
#define __SenRenderer__
#include <cstdlib>
#include <assert.h>
#include <vector>
#include <iostream>
#include <sstream>
#include "Shared.h"
#include <vulkan/vulkan.h>
class SenWindow;
class SenRenderer
{
public:
SenRenderer();
virtual ~SenRenderer();
void finalize();
void closeSenWindow();
SenWindow* openSenWindow(uint32_t size_X, uint32_t size_Y, std::string name);
bool run();
VkInstance _instance = VK_NULL_HANDLE;
VkPhysicalDevice _gpu = VK_NULL_HANDLE;
VkDevice _device = VK_NULL_HANDLE;
VkQueue _queue = VK_NULL_HANDLE;
VkPhysicalDeviceProperties _gpuProperties = {};
VkPhysicalDeviceMemoryProperties _gpuMemoryProperties = {};
uint32_t _graphicsFamilyIndex = 0;
SenWindow *_window = nullptr;
const VkInstance getInstance() const { return _instance; }
const VkPhysicalDevice getPhysicalDevice() const { return _gpu; }
const VkDevice getDevice() const { return _device; }
const VkQueue getQueue() const { return _queue; }
const uint32_t getGraphicsQueueFamilyIndex() const { return _graphicsFamilyIndex; }
const VkPhysicalDeviceProperties& getPhysicalDeviceProperties() const { return _gpuProperties; }
const VkPhysicalDeviceMemoryProperties& getPhysicalDeviceMemoryProperties() const { return _gpuMemoryProperties; }
private:
void _InitInstance();
void _DeInitInstance();
void _InitDevice();
void _DeInitDevice();
void _SetupDebug();
void _InitDebug();
void _DeInitDebug();
std::vector<const char*> _instanceLayersList;
std::vector<const char*> _instanceExtensionsList;
std::vector<const char*> _deviceLayersList;
std::vector<const char*> _deviceExtensionsList;
PFN_vkCreateDebugReportCallbackEXT fetch_vkCreateDebugReportCallbackEXT = VK_NULL_HANDLE;
PFN_vkDestroyDebugReportCallbackEXT fetch_vkDestroyDebugReportCallbackEXT = VK_NULL_HANDLE;
VkDebugReportCallbackEXT _debugReport = VK_NULL_HANDLE;
VkDebugReportCallbackCreateInfoEXT debugCallbackCreateInfo = {};
};
#endif // __SenRenderer__ | 29.126761 | 115 | 0.767892 | [
"vector"
] |
858b20b219ba5fe66cdf5bc86b9f073550afbb83 | 11,709 | h | C | Plugins/PLCompositing/include/PLCompositing/SRPBegin.h | ktotheoz/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 83 | 2015-01-08T15:06:14.000Z | 2021-07-20T17:07:00.000Z | Plugins/PLCompositing/include/PLCompositing/SRPBegin.h | PixelLightFoundation/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 19 | 2018-08-24T08:10:13.000Z | 2018-11-29T06:39:08.000Z | Plugins/PLCompositing/include/PLCompositing/SRPBegin.h | ktotheoz/pixellight | 43a661e762034054b47766d7e38d94baf22d2038 | [
"MIT"
] | 40 | 2015-02-25T18:24:34.000Z | 2021-03-06T09:01:48.000Z | /*********************************************************\
* File: SRPBegin.h *
*
* Copyright (C) 2002-2013 The PixelLight Team (http://www.pixellight.org/)
*
* This file is part of PixelLight.
*
* 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.
\*********************************************************/
#ifndef __PLCOMPOSITING_BEGIN_H__
#define __PLCOMPOSITING_BEGIN_H__
#pragma once
//[-------------------------------------------------------]
//[ Includes ]
//[-------------------------------------------------------]
#include <PLGraphics/Color/Color4.h>
#include <PLRenderer/Renderer/TextureBuffer.h>
#include <PLScene/Compositing/SceneRendererPass.h>
#include "PLCompositing/PLCompositing.h"
//[-------------------------------------------------------]
//[ Forward declarations ]
//[-------------------------------------------------------]
namespace PLRenderer {
class Surface;
class SurfaceTextureBuffer;
class TextureBufferRectangle;
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
namespace PLCompositing {
//[-------------------------------------------------------]
//[ Classes ]
//[-------------------------------------------------------]
/**
* @brief
* First scene renderer pass
*
* @note
* - This scene renderer pass should be at the very top of the scene render pipeline
* - Sets initial render states - sets all render states to known default settings
* - Manages render to texture with double buffering support
* - When render to texture is used, a separate depth buffer is used which is independent of the one of the surface we're render into
* - Doesn't use shaders or fixed functions features, therefore there's usually no need to derive from this class
*/
class SRPBegin : public PLScene::SceneRendererPass {
//[-------------------------------------------------------]
//[ Public definitions ]
//[-------------------------------------------------------]
public:
/**
* @brief
* Clear flags
*/
enum EClearFlags {
ClearColor = 1, /**< Clear color buffer */
ClearDepth = 2, /**< Clear depth buffer */
ClearStencil = 4 /**< Clear stencil buffer */
};
pl_enum(EClearFlags)
pl_enum_value(ClearColor, "Clear color buffer")
pl_enum_value(ClearDepth, "Clear depth buffer")
pl_enum_value(ClearStencil, "Clear stencil buffer")
pl_enum_end
/**
* @brief
* Fill mode
*/
enum EFillMode {
SolidMode = 0, /**< Solid fill mode */
LineMode = 1, /**< Line fill mode (also called wireframes) */
PointMode = 2 /**< Point fill mode */
};
pl_enum(EFillMode)
pl_enum_value(SolidMode, "Solid fill mode")
pl_enum_value(LineMode, "Line fill mode (also called wireframes)")
pl_enum_value(PointMode, "Point fill mode")
pl_enum_end
/**
* @brief
* Scene renderer pass flags (SceneRendererPass flags extension)
*/
enum EFlags {
NoStencil = 1<<1, /**< No stencil buffer */
NoMultisampleAntialiasing = 1<<2, /**< Do not use multisample antialiasing */
NoDepthTexture = 1<<4, /**< Do not provide a depth texture when rendering into a texture */
CustomTextureSize = 1<<5 /**< Use a texture size given by the user instead of using the original window size */
};
pl_enum(EFlags)
pl_enum_base(SceneRendererPass::EFlags)
pl_enum_value(NoStencil, "No stencil buffer")
pl_enum_value(NoMultisampleAntialiasing, "Do not use multisample antialiasing")
pl_enum_value(NoDepthTexture, "Do not provide a depth texture when rendering into a texture")
pl_enum_value(CustomTextureSize, "Use a texture size given by the user instead of using the original window size")
pl_enum_end
/**
* @brief
* Texture format
*/
pl_enum_direct(ETextureFormat, int)
pl_enum_value_direct(L8, PLRenderer::TextureBuffer::L8, "8-bit pixel format, all bits luminance")
pl_enum_value_direct(L16, PLRenderer::TextureBuffer::L16, "16-bit pixel format, all bits luminance")
pl_enum_value_direct(A8, PLRenderer::TextureBuffer::A8, "8-bit pixel format, all bits alpha")
pl_enum_value_direct(L4A4, PLRenderer::TextureBuffer::L4A4, "8-bit pixel format, 4 bits for luminance and alpha")
pl_enum_value_direct(L8A8, PLRenderer::TextureBuffer::L8A8, "16-bit pixel format, 8 bits for luminance and alpha")
pl_enum_value_direct(R3G3B2, PLRenderer::TextureBuffer::R3G3B2, "8-bit pixel format, 3 bits red, 3 bits green and 2 bits blue")
pl_enum_value_direct(R5G6B5, PLRenderer::TextureBuffer::R5G6B5, "16-bit pixel format, 5 bits red, 6 bits green and 5 bits blue")
pl_enum_value_direct(R5G5B5A1, PLRenderer::TextureBuffer::R5G5B5A1, "16-bit pixel format, 5 bits red, 5 bits green, 5 bits blue and 1 bits alpha")
pl_enum_value_direct(R4G4B4A4, PLRenderer::TextureBuffer::R4G4B4A4, "16-bit pixel format, 4 bits for red, green, blue and alpha")
pl_enum_value_direct(R8G8B8, PLRenderer::TextureBuffer::R8G8B8, "24-bit (or 32-bit if 24-bits are not supported by the hardware) pixel format, 8 bits for red, green and blue")
pl_enum_value_direct(R8G8B8A8, PLRenderer::TextureBuffer::R8G8B8A8, "32-bit pixel format, 8 bits for red, green, blue and alpha")
pl_enum_value_direct(R10G10B10A2, PLRenderer::TextureBuffer::R10G10B10A2, "32-bit pixel format, 10 bits for red, green, blue and 2 bits for alpha")
pl_enum_value_direct(R16G16B16A16, PLRenderer::TextureBuffer::R16G16B16A16, "64-bit pixel format, 16 bits for red, green, blue and alpha")
pl_enum_value_direct(L16F, PLRenderer::TextureBuffer::L16F, "16-bit float format using 16 bits for luminance")
pl_enum_value_direct(L32F, PLRenderer::TextureBuffer::L32F, "32-bit float format using 32 bits for luminance")
pl_enum_value_direct(R16G16B16A16F, PLRenderer::TextureBuffer::R16G16B16A16F, "64-bit float format using 16 bits for the each channel (red, green, blue, alpha)")
pl_enum_value_direct(R32G32B32A32F, PLRenderer::TextureBuffer::R32G32B32A32F, "128-bit float format using 32 bits for the each channel (red, green, blue, alpha)")
pl_enum_value_direct(Unknown, PLRenderer::TextureBuffer::Unknown, "Unknown texture pixel format")
pl_enum_end
//[-------------------------------------------------------]
//[ RTTI interface ]
//[-------------------------------------------------------]
pl_class(PLCOM_RTTI_EXPORT, SRPBegin, "PLCompositing", PLScene::SceneRendererPass, "First scene renderer pass")
// Attributes
pl_attribute(TextureFormat, pl_enum_type(ETextureFormat), PLRenderer::TextureBuffer::Unknown, ReadWrite, DirectValue, "Render target texture format, unknown means no render to texture", "")
pl_attribute(TextureSize, PLMath::Vector2i, PLMath::Vector2i::Zero, ReadWrite, DirectValue, "Render target size, only used in case the ''-flag is set", "")
pl_attribute(ClearFlags, pl_flag_type(EClearFlags), ClearColor|ClearDepth|ClearStencil, ReadWrite, DirectValue, "Clear flags", "")
pl_attribute(ColorClear, PLGraphics::Color4, PLGraphics::Color4(0.0f, 0.0f, 0.0f, 0.0f), ReadWrite, DirectValue, "Clear color (r/g/b/a)", "")
pl_attribute(FillMode, pl_enum_type(EFillMode), SolidMode, ReadWrite, DirectValue, "Fill mode", "")
// Overwritten PLScene::SceneRendererPass attributes
pl_attribute(Flags, pl_flag_type(EFlags), 0, ReadWrite, GetSet, "Flags", "")
// Constructors
pl_constructor_0(DefaultConstructor, "Default constructor", "")
pl_class_end
//[-------------------------------------------------------]
//[ Public functions ]
//[-------------------------------------------------------]
public:
/**
* @brief
* Default constructor
*/
PLCOM_API SRPBegin();
/**
* @brief
* Destructor
*/
PLCOM_API virtual ~SRPBegin();
/**
* @brief
* Returns the render target that was set before the current render target was changed to the front/back render target
*
* @return
* The render target that was set before the current render target was changed to the front/back render target, can be a null pointer
*/
PLCOM_API PLRenderer::Surface *GetOriginalRenderTarget() const;
/**
* @brief
* Returns the current front render target
*
* @return
* The current front render target, can be a null pointer
*/
PLCOM_API PLRenderer::SurfaceTextureBuffer *GetFrontRenderTarget() const;
/**
* @brief
* Returns the current back render target
*
* @return
* The current back render target, can be a null pointer
*
* @note
* - The back render target receives the current drawings
*/
PLCOM_API PLRenderer::SurfaceTextureBuffer *GetBackRenderTarget() const;
/**
* @brief
* Returns the depth texture (used when rendering into a texture)
*
* @return
* Depth texture (used when rendering into a texture), can be a null pointer
*/
PLCOM_API PLRenderer::TextureBufferRectangle *GetTextureBufferDepth() const;
/**
* @brief
* Swaps the render targets
*/
PLCOM_API void SwapRenderTargets();
//[-------------------------------------------------------]
//[ Protected virtual PLScene::SceneRendererPass functions ]
//[-------------------------------------------------------]
protected:
virtual void Draw(PLRenderer::Renderer &cRenderer, const PLScene::SQCull &cCullQuery) override;
//[-------------------------------------------------------]
//[ Private data ]
//[-------------------------------------------------------]
private:
PLRenderer::Surface *m_pOriginalRenderTarget; /**< The render target that was set before the current render target was changed to the front/back render target, can be a null pointer */
PLRenderer::SurfaceTextureBuffer *m_pRenderTarget[2]; /**< Render targets, can be a null pointer */
bool m_bCurrentFrontRenderTarget; /**< Index of the current front render target */
PLRenderer::SurfaceTextureBuffer *m_pTextureBufferDepth; /**< Depth texture (used when rendering into a texture) */
};
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
} // PLCompositing
#endif // __PLCOMPOSITING_BEGIN_H__
| 45.738281 | 193 | 0.614912 | [
"render",
"solid"
] |
858cfd8a6283056d80331510ce7890f8ce542039 | 44,559 | c | C | v4-cokapi/backends/c_cpp/valgrind-3.11.0/none/tests/amd64/pcmpstr64w.c | ambadhan/OnlinePythonTutor | 857bab941fbde20f1f020b05b7723094ddead62a | [
"MIT"
] | 17 | 2021-12-09T11:31:44.000Z | 2021-12-29T03:07:14.000Z | v4-cokapi/backends/c_cpp/valgrind-3.11.0/none/tests/amd64/pcmpstr64w.c | heysachin/OnlinePythonTutor | 0dcdacc7ff5be504dd6a47236ebc69dc0069f991 | [
"MIT"
] | 8 | 2020-02-04T20:23:26.000Z | 2020-02-17T00:23:37.000Z | v4-cokapi/backends/c_cpp/valgrind-3.11.0/none/tests/amd64/pcmpstr64w.c | heysachin/OnlinePythonTutor | 0dcdacc7ff5be504dd6a47236ebc69dc0069f991 | [
"MIT"
] | 12 | 2021-12-09T11:31:46.000Z | 2022-01-07T03:14:46.000Z |
/* Tests in detail the core arithmetic for pcmp{e,i}str{i,m} using
pcmpistri to drive it. Does not check the e-vs-i or i-vs-m
aspect. */
#include <string.h>
#include <stdio.h>
#include <assert.h>
typedef unsigned int UInt;
typedef signed int Int;
typedef unsigned char UChar;
typedef unsigned short UShort;
typedef unsigned long long int ULong;
typedef UChar Bool;
#define False ((Bool)0)
#define True ((Bool)1)
//typedef unsigned char V128[16];
typedef
union {
UChar uChar[16];
UShort uShort[8];
UInt uInt[4];
UInt w32[4];
}
V128;
#define SHIFT_O 11
#define SHIFT_S 7
#define SHIFT_Z 6
#define SHIFT_A 4
#define SHIFT_C 0
#define SHIFT_P 2
#define MASK_O (1ULL << SHIFT_O)
#define MASK_S (1ULL << SHIFT_S)
#define MASK_Z (1ULL << SHIFT_Z)
#define MASK_A (1ULL << SHIFT_A)
#define MASK_C (1ULL << SHIFT_C)
#define MASK_P (1ULL << SHIFT_P)
UInt clz32 ( UInt x )
{
Int y, m, n;
y = -(x >> 16);
m = (y >> 16) & 16;
n = 16 - m;
x = x >> m;
y = x - 0x100;
m = (y >> 16) & 8;
n = n + m;
x = x << m;
y = x - 0x1000;
m = (y >> 16) & 4;
n = n + m;
x = x << m;
y = x - 0x4000;
m = (y >> 16) & 2;
n = n + m;
x = x << m;
y = x >> 14;
m = y & ~(y >> 1);
return n + 2 - m;
}
UInt ctz32 ( UInt x )
{
return 32 - clz32((~x) & (x-1));
}
void expand ( V128* dst, char* summary )
{
Int i;
assert( strlen(summary) == 16 );
for (i = 0; i < 16; i++) {
UChar xx = 0;
UChar x = summary[15-i];
if (x >= '0' && x <= '9') { xx = x - '0'; }
else if (x >= 'A' && x <= 'F') { xx = x - 'A' + 10; }
else if (x >= 'a' && x <= 'f') { xx = x - 'a' + 10; }
else assert(0);
assert(xx < 16);
xx = (xx << 4) | xx;
assert(xx < 256);
dst->uChar[i] = xx;
}
}
void try_istri ( char* which,
UInt(*h_fn)(V128*,V128*),
UInt(*s_fn)(V128*,V128*),
char* summL, char* summR )
{
assert(strlen(which) == 2);
V128 argL, argR;
expand(&argL, summL);
expand(&argR, summR);
UInt h_res = h_fn(&argL, &argR);
UInt s_res = s_fn(&argL, &argR);
printf("istri %s %s %s -> %08x %08x %s\n",
which, summL, summR, h_res, s_res, h_res == s_res ? "" : "!!!!");
}
UInt zmask_from_V128 ( V128* arg )
{
UInt i, res = 0;
for (i = 0; i < 8; i++) {
res |= ((arg->uShort[i] == 0) ? 1 : 0) << i;
}
return res;
}
//////////////////////////////////////////////////////////
// //
// GENERAL //
// //
//////////////////////////////////////////////////////////
/* Given partial results from a 16-bit pcmpXstrX operation (intRes1,
basically), generate an I- or M-format output value, also the new
OSZACP flags. */
static
void PCMPxSTRx_WRK_gen_output_fmt_I_wide ( /*OUT*/V128* resV,
/*OUT*/UInt* resOSZACP,
UInt intRes1,
UInt zmaskL, UInt zmaskR,
UInt validL,
UInt pol, UInt idx )
{
assert((pol >> 2) == 0);
assert((idx >> 1) == 0);
UInt intRes2 = 0;
switch (pol) {
case 0: intRes2 = intRes1; break; // pol +
case 1: intRes2 = ~intRes1; break; // pol -
case 2: intRes2 = intRes1; break; // pol m+
case 3: intRes2 = intRes1 ^ validL; break; // pol m-
}
intRes2 &= 0xFF;
// generate I-format output (an index in ECX)
// generate ecx value
UInt newECX = 0;
if (idx) {
// index of ms-1-bit
newECX = intRes2 == 0 ? 8 : (31 - clz32(intRes2));
} else {
// index of ls-1-bit
newECX = intRes2 == 0 ? 8 : ctz32(intRes2);
}
resV->w32[0] = newECX;
resV->w32[1] = 0;
resV->w32[2] = 0;
resV->w32[3] = 0;
// generate new flags, common to all ISTRI and ISTRM cases
*resOSZACP // A, P are zero
= ((intRes2 == 0) ? 0 : MASK_C) // C == 0 iff intRes2 == 0
| ((zmaskL == 0) ? 0 : MASK_Z) // Z == 1 iff any in argL is 0
| ((zmaskR == 0) ? 0 : MASK_S) // S == 1 iff any in argR is 0
| ((intRes2 & 1) << SHIFT_O); // O == IntRes2[0]
}
/* Compute result and new OSZACP flags for all PCMP{E,I}STR{I,M}
variants on 16-bit characters.
For xSTRI variants, the new ECX value is placed in the 32 bits
pointed to by *resV, and the top 96 bits are zeroed. For xSTRM
variants, the result is a 128 bit value and is placed at *resV in
the obvious way.
For all variants, the new OSZACP value is placed at *resOSZACP.
argLV and argRV are the vector args. The caller must prepare a
8-bit mask for each, zmaskL and zmaskR. For ISTRx variants this
must be 1 for each zero byte of of the respective arg. For ESTRx
variants this is derived from the explicit length indication, and
must be 0 in all places except at the bit index corresponding to
the valid length (0 .. 8). If the valid length is 8 then the
mask must be all zeroes. In all cases, bits 31:8 must be zero.
imm8 is the original immediate from the instruction. isSTRM
indicates whether this is a xSTRM or xSTRI variant, which controls
how much of *res is written.
If the given imm8 case can be handled, the return value is True.
If not, False is returned, and neither *res not *resOSZACP are
altered.
*/
Bool pcmpXstrX_WRK_wide ( /*OUT*/V128* resV,
/*OUT*/UInt* resOSZACP,
V128* argLV, V128* argRV,
UInt zmaskL, UInt zmaskR,
UInt imm8, Bool isxSTRM )
{
assert(imm8 < 0x80);
assert((zmaskL >> 8) == 0);
assert((zmaskR >> 8) == 0);
/* Explicitly reject any imm8 values that haven't been validated,
even if they would probably work. Life is too short to have
unvalidated cases in the code base. */
switch (imm8) {
case 0x01: case 0x03: case 0x09: case 0x0B: case 0x0D:
case 0x13: case 0x1B:
case 0x39: case 0x3B:
case 0x45: case 0x4B:
break;
default:
return False;
}
UInt fmt = (imm8 >> 0) & 3; // imm8[1:0] data format
UInt agg = (imm8 >> 2) & 3; // imm8[3:2] aggregation fn
UInt pol = (imm8 >> 4) & 3; // imm8[5:4] polarity
UInt idx = (imm8 >> 6) & 1; // imm8[6] 1==msb/bytemask
/*----------------------------------------*/
/*-- strcmp on wide data --*/
/*----------------------------------------*/
if (agg == 2/*equal each, aka strcmp*/
&& (fmt == 1/*uw*/ || fmt == 3/*sw*/)) {
Int i;
UShort* argL = (UShort*)argLV;
UShort* argR = (UShort*)argRV;
UInt boolResII = 0;
for (i = 7; i >= 0; i--) {
UShort cL = argL[i];
UShort cR = argR[i];
boolResII = (boolResII << 1) | (cL == cR ? 1 : 0);
}
UInt validL = ~(zmaskL | -zmaskL); // not(left(zmaskL))
UInt validR = ~(zmaskR | -zmaskR); // not(left(zmaskR))
// do invalidation, common to all equal-each cases
UInt intRes1
= (boolResII & validL & validR) // if both valid, use cmpres
| (~ (validL | validR)); // if both invalid, force 1
// else force 0
intRes1 &= 0xFF;
// generate I-format output
PCMPxSTRx_WRK_gen_output_fmt_I_wide(
resV, resOSZACP,
intRes1, zmaskL, zmaskR, validL, pol, idx
);
return True;
}
/*----------------------------------------*/
/*-- set membership on wide data --*/
/*----------------------------------------*/
if (agg == 0/*equal any, aka find chars in a set*/
&& (fmt == 1/*uw*/ || fmt == 3/*sw*/)) {
/* argL: the string, argR: charset */
UInt si, ci;
UShort* argL = (UShort*)argLV;
UShort* argR = (UShort*)argRV;
UInt boolRes = 0;
UInt validL = ~(zmaskL | -zmaskL); // not(left(zmaskL))
UInt validR = ~(zmaskR | -zmaskR); // not(left(zmaskR))
for (si = 0; si < 8; si++) {
if ((validL & (1 << si)) == 0)
// run off the end of the string.
break;
UInt m = 0;
for (ci = 0; ci < 8; ci++) {
if ((validR & (1 << ci)) == 0) break;
if (argR[ci] == argL[si]) { m = 1; break; }
}
boolRes |= (m << si);
}
// boolRes is "pre-invalidated"
UInt intRes1 = boolRes & 0xFF;
// generate I-format output
PCMPxSTRx_WRK_gen_output_fmt_I_wide(
resV, resOSZACP,
intRes1, zmaskL, zmaskR, validL, pol, idx
);
return True;
}
/*----------------------------------------*/
/*-- substring search on wide data --*/
/*----------------------------------------*/
if (agg == 3/*equal ordered, aka substring search*/
&& (fmt == 1/*uw*/ || fmt == 3/*sw*/)) {
/* argL: haystack, argR: needle */
UInt ni, hi;
UShort* argL = (UShort*)argLV;
UShort* argR = (UShort*)argRV;
UInt boolRes = 0;
UInt validL = ~(zmaskL | -zmaskL); // not(left(zmaskL))
UInt validR = ~(zmaskR | -zmaskR); // not(left(zmaskR))
for (hi = 0; hi < 8; hi++) {
UInt m = 1;
for (ni = 0; ni < 8; ni++) {
if ((validR & (1 << ni)) == 0) break;
UInt i = ni + hi;
if (i >= 8) break;
if (argL[i] != argR[ni]) { m = 0; break; }
}
boolRes |= (m << hi);
if ((validL & (1 << hi)) == 0)
// run off the end of the haystack
break;
}
// boolRes is "pre-invalidated"
UInt intRes1 = boolRes & 0xFF;
// generate I-format output
PCMPxSTRx_WRK_gen_output_fmt_I_wide(
resV, resOSZACP,
intRes1, zmaskL, zmaskR, validL, pol, idx
);
return True;
}
/*----------------------------------------*/
/*-- ranges, unsigned wide data --*/
/*----------------------------------------*/
if (agg == 1/*ranges*/
&& fmt == 1/*uw*/) {
/* argL: string, argR: range-pairs */
UInt ri, si;
UShort* argL = (UShort*)argLV;
UShort* argR = (UShort*)argRV;
UInt boolRes = 0;
UInt validL = ~(zmaskL | -zmaskL); // not(left(zmaskL))
UInt validR = ~(zmaskR | -zmaskR); // not(left(zmaskR))
for (si = 0; si < 8; si++) {
if ((validL & (1 << si)) == 0)
// run off the end of the string
break;
UInt m = 0;
for (ri = 0; ri < 8; ri += 2) {
if ((validR & (3 << ri)) != (3 << ri)) break;
if (argR[ri] <= argL[si] && argL[si] <= argR[ri+1]) {
m = 1; break;
}
}
boolRes |= (m << si);
}
// boolRes is "pre-invalidated"
UInt intRes1 = boolRes & 0xFF;
// generate I-format output
PCMPxSTRx_WRK_gen_output_fmt_I_wide(
resV, resOSZACP,
intRes1, zmaskL, zmaskR, validL, pol, idx
);
return True;
}
return False;
}
//////////////////////////////////////////////////////////
// //
// ISTRI_4B //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_4B ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x4B, %%xmm2, %%xmm11" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_4B ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x4B, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_4B ( void )
{
char* wot = "4B";
UInt(*h)(V128*,V128*) = h_pcmpistri_4B;
UInt(*s)(V128*,V128*) = s_pcmpistri_4B;
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_3B //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_3B ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x3B, %%xmm2, %%xmm11" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_3B ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x3B, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_3B ( void )
{
char* wot = "3B";
UInt(*h)(V128*,V128*) = h_pcmpistri_3B;
UInt(*s)(V128*,V128*) = s_pcmpistri_3B;
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_0D //
// //
//////////////////////////////////////////////////////////
__attribute__((noinline))
UInt h_pcmpistri_0D ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res = 0, flags = 0;
__asm__ __volatile__(
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x0D, %%xmm2, %%xmm11" "\n\t"
//"pcmpistrm $0x0D, %%xmm2, %%xmm11" "\n\t"
//"movd %%xmm0, %%ecx" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_0D ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x0D, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_0D ( void )
{
char* wot = "0D";
UInt(*h)(V128*,V128*) = h_pcmpistri_0D;
UInt(*s)(V128*,V128*) = s_pcmpistri_0D;
try_istri(wot,h,s, "11111111abcdef11", "0000000000abcdef");
try_istri(wot,h,s, "11111111abcdef11", "00abcdef00abcdef");
try_istri(wot,h,s, "11111111abcdef11", "0000000000abcdef");
try_istri(wot,h,s, "1111111111abcdef", "0000000000abcdef");
try_istri(wot,h,s, "111111111111abcd", "0000000000abcdef");
try_istri(wot,h,s, "1111abcd11abcd11", "000000000000abcd");
try_istri(wot,h,s, "11abcd1111abcd11", "000000000000abcd");
try_istri(wot,h,s, "abcd111111abcd11", "000000000000abcd");
try_istri(wot,h,s, "cd11111111abcd11", "000000000000abcd");
try_istri(wot,h,s, "01abcd11abcd1111", "000000000000abcd");
try_istri(wot,h,s, "00abcd11abcd1111", "000000000000abcd");
try_istri(wot,h,s, "0000cd11abcd1111", "000000000000abcd");
try_istri(wot,h,s, "00abcd1100abcd11", "000000000000abcd");
try_istri(wot,h,s, "00abcd110000cd11", "000000000000abcd");
try_istri(wot,h,s, "1111111111111234", "0000000000000000");
try_istri(wot,h,s, "1111111111111234", "0000000000000011");
try_istri(wot,h,s, "1111111111111234", "0000000000001111");
try_istri(wot,h,s, "1111111111111234", "1111111111111234");
try_istri(wot,h,s, "0a11111111111111", "000000000000000a");
try_istri(wot,h,s, "0b11111111111111", "000000000000000a");
try_istri(wot,h,s, "b111111111111111", "0000000000000000");
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "123456789abcdef1", "0000000000000000");
try_istri(wot,h,s, "0000000000000000", "123456789abcdef1");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_09 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_09 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x09, %%xmm2, %%xmm11" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_09 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x09, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_09 ( void )
{
char* wot = "09";
UInt(*h)(V128*,V128*) = h_pcmpistri_09;
UInt(*s)(V128*,V128*) = s_pcmpistri_09;
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_1B //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_1B ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x1B, %%xmm2, %%xmm11" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_1B ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x1B, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_1B ( void )
{
char* wot = "1B";
UInt(*h)(V128*,V128*) = h_pcmpistri_1B;
UInt(*s)(V128*,V128*) = s_pcmpistri_1B;
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_03 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_03 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x03, %%xmm2, %%xmm11" "\n\t"
//"pcmpistrm $0x03, %%xmm2, %%xmm11" "\n\t"
//"movd %%xmm0, %%ecx" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_03 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x03, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_03 ( void )
{
char* wot = "03";
UInt(*h)(V128*,V128*) = h_pcmpistri_03;
UInt(*s)(V128*,V128*) = s_pcmpistri_03;
try_istri(wot,h,s, "aacdacbdaacdaacd", "00000000000000aa");
try_istri(wot,h,s, "aabbaabbaabbaabb", "00000000000000bb");
try_istri(wot,h,s, "aabbccddaabbccdd", "000000000000aabb");
try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "00bbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaa00ccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabb00dd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbcc00", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aa00ccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabb00dd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbcc00");
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
try_istri(wot,h,s, "0000aabbaabbaabb", "000000000000bbbb");
try_istri(wot,h,s, "0000ccddaabbccdd", "00000000bbaabbaa");
try_istri(wot,h,s, "0000ccddaabbccdd", "000000bbaabbaa00");
try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_13 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_13 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x13, %%xmm2, %%xmm11" "\n\t"
//"pcmpistrm $0x13, %%xmm2, %%xmm11" "\n\t"
//"movd %%xmm0, %%ecx" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_13 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x13, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_13 ( void )
{
char* wot = "13";
UInt(*h)(V128*,V128*) = h_pcmpistri_13;
UInt(*s)(V128*,V128*) = s_pcmpistri_13;
try_istri(wot,h,s, "aacdacbdaacdaacd", "00000000000000aa");
try_istri(wot,h,s, "aabbaabbaabbaabb", "00000000000000bb");
try_istri(wot,h,s, "aabbccddaabbccdd", "000000000000aabb");
try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "00bbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaa00ccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabb00dd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbcc00", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aa00ccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabb00dd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbcc00");
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
try_istri(wot,h,s, "0000aabbaabbaabb", "000000000000bbbb");
try_istri(wot,h,s, "0000ccddaabbccdd", "00000000bbaabbaa");
try_istri(wot,h,s, "0000ccddaabbccdd", "000000bbaabbaa00");
try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_45 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_45 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x45, %%xmm2, %%xmm11" "\n\t"
//"pcmpistrm $0x04, %%xmm2, %%xmm11" "\n\t"
//"movd %%xmm0, %%ecx" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_45 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x45, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_45 ( void )
{
char* wot = "45";
UInt(*h)(V128*,V128*) = h_pcmpistri_45;
UInt(*s)(V128*,V128*) = s_pcmpistri_45;
try_istri(wot,h,s, "aaaabbbbccccdddd", "000000000000bbcc");
try_istri(wot,h,s, "aaaabbbbccccdddd", "000000000000ccbb");
try_istri(wot,h,s, "baaabbbbccccdddd", "000000000000ccbb");
try_istri(wot,h,s, "baaabbbbccccdddc", "000000000000ccbb");
try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000ccbb");
try_istri(wot,h,s, "bbbbbbbb00bbbbbb", "000000000000ccbb");
try_istri(wot,h,s, "bbbbbbbbbbbb00bb", "000000000000ccbb");
try_istri(wot,h,s, "bbbbbbbbbbbbbb00", "000000000000ccbb");
try_istri(wot,h,s, "0000000000000000", "000000000000ccbb");
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "000000000000ccbb");
try_istri(wot,h,s, "bbbbbbbbbbbbbbbb", "00000000000000bb");
try_istri(wot,h,s, "bb44bb44bb44bb44", "000000006622ccbb");
try_istri(wot,h,s, "bb44bb44bb44bb44", "000000000022ccbb");
try_istri(wot,h,s, "bb44bb44bb44bb44", "000000000000ccbb");
try_istri(wot,h,s, "bb44bb44bb44bb44", "00000000000000bb");
try_istri(wot,h,s, "0011223344556677", "0000997755442211");
try_istri(wot,h,s, "1122334455667711", "0000997755442211");
try_istri(wot,h,s, "0011223344556677", "0000aa8866553322");
try_istri(wot,h,s, "1122334455667711", "0000aa8866553322");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_01 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_01 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x01, %%xmm2, %%xmm11" "\n\t"
//"pcmpistrm $0x01, %%xmm2, %%xmm11" "\n\t"
//"movd %%xmm0, %%ecx" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_01 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x01, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_01 ( void )
{
char* wot = "01";
UInt(*h)(V128*,V128*) = h_pcmpistri_01;
UInt(*s)(V128*,V128*) = s_pcmpistri_01;
try_istri(wot,h,s, "aacdacbdaacdaacd", "00000000000000aa");
try_istri(wot,h,s, "aabbaabbaabbaabb", "00000000000000bb");
try_istri(wot,h,s, "aabbccddaabbccdd", "000000000000aabb");
try_istri(wot,h,s, "abcdabc0abcdabcd", "000000000000abcd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "00bbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaa00ccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabb00dd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbcc00", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aa00ccdd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabb00dd");
try_istri(wot,h,s, "aabbccddaabbccdd", "00000000aabbcc00");
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000abcd");
try_istri(wot,h,s, "0000abcdabcdabcd", "000000000000dcba");
try_istri(wot,h,s, "0000aabbaabbaabb", "000000000000bbbb");
try_istri(wot,h,s, "0000ccddaabbccdd", "00000000bbaabbaa");
try_istri(wot,h,s, "0000ccddaabbccdd", "000000bbaabbaa00");
try_istri(wot,h,s, "0ddc0ffeebadf00d", "00000000cafebabe");
try_istri(wot,h,s, "0ddc0ffeebadfeed", "00000000cafebabe");
}
//////////////////////////////////////////////////////////
// //
// ISTRI_39 //
// //
//////////////////////////////////////////////////////////
UInt h_pcmpistri_39 ( V128* argL, V128* argR )
{
V128 block[2];
memcpy(&block[0], argL, sizeof(V128));
memcpy(&block[1], argR, sizeof(V128));
ULong res, flags;
__asm__ __volatile__(
"subq $1024, %%rsp" "\n\t"
"movdqu 0(%2), %%xmm2" "\n\t"
"movdqu 16(%2), %%xmm11" "\n\t"
"pcmpistri $0x39, %%xmm2, %%xmm11" "\n\t"
"pushfq" "\n\t"
"popq %%rdx" "\n\t"
"movq %%rcx, %0" "\n\t"
"movq %%rdx, %1" "\n\t"
"addq $1024, %%rsp" "\n\t"
: /*out*/ "=r"(res), "=r"(flags) : "r"/*in*/(&block[0])
: "rcx","rdx","xmm0","xmm2","xmm11","cc","memory"
);
return ((flags & 0x8D5) << 16) | (res & 0xFFFF);
}
UInt s_pcmpistri_39 ( V128* argLU, V128* argRU )
{
V128 resV;
UInt resOSZACP, resECX;
Bool ok
= pcmpXstrX_WRK_wide( &resV, &resOSZACP, argLU, argRU,
zmask_from_V128(argLU),
zmask_from_V128(argRU),
0x39, False/*!isSTRM*/
);
assert(ok);
resECX = resV.uInt[0];
return (resOSZACP << 16) | resECX;
}
void istri_39 ( void )
{
char* wot = "39";
UInt(*h)(V128*,V128*) = h_pcmpistri_39;
UInt(*s)(V128*,V128*) = s_pcmpistri_39;
try_istri(wot,h,s, "0000000000000000", "0000000000000000");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaa2aaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaa2aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaa2aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaa2aaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaa2aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaa2a");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "baaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9aaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaaaaaa7aaa");
try_istri(wot,h,s, "b9baaaaaaaaaaaaa", "aaaaaaaa2aaa4aaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaa00aaaaaa", "aaaaaaaaaaaa00aa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaa00aa", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "8000000000000000", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000001", "aaaaaaaa00aaaaaa");
try_istri(wot,h,s, "0000000000000000", "aaaaaaaaaaaaaaaa");
try_istri(wot,h,s, "aaaaaaaaaaaaaaaa", "0000000000000000");
}
//////////////////////////////////////////////////////////
// //
// main //
// //
//////////////////////////////////////////////////////////
int main ( void )
{
istri_4B();
istri_3B();
istri_09();
istri_1B();
istri_03();
istri_0D();
istri_13();
istri_45();
istri_01();
istri_39();
return 0;
}
| 34.920846 | 75 | 0.534684 | [
"vector"
] |
85916d3f2c96bc648ff95fb54f171565fd3cf6da | 2,432 | h | C | network_monitor/src/pcap_utils.h | trailofbits/osquery-extensions | 8a1a24a1142757579e001e4fa710e144169ab257 | [
"Apache-2.0"
] | 194 | 2017-12-14T14:00:34.000Z | 2022-03-21T23:56:06.000Z | network_monitor/src/pcap_utils.h | trailofbits/osquery-extensions | 8a1a24a1142757579e001e4fa710e144169ab257 | [
"Apache-2.0"
] | 49 | 2017-12-09T16:32:37.000Z | 2021-12-14T22:15:06.000Z | network_monitor/src/pcap_utils.h | trailofbits/osquery-extensions | 8a1a24a1142757579e001e4fa710e144169ab257 | [
"Apache-2.0"
] | 27 | 2017-12-14T23:48:39.000Z | 2022-02-25T01:54:45.000Z | /*
* Copyright (c) 2018 Trail of Bits, 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.
*/
#pragma once
#include <osquery/core/flags.h>
#include <memory>
#include <vector>
#include <pcap.h>
namespace trailofbits {
/// This is the std::unique_ptr deleter used when wrapping pcap handles
void pcapRefDeleter(pcap_t* handle);
/// A pcap handle reference
using PcapRef = std::unique_ptr<pcap_t, void (*)(pcap_t*)>;
/// Helper macro used to declare an empty ref for pcap handles
#define DeclarePcapRef(x) \
PcapRef x { \
nullptr, pcapRefDeleter \
}
/// A network address with the associated netmask (either IPV4 or IPV6)
struct NetworkAddress final {
std::string address;
std::string netmask;
};
/// Describes the properties for a network interface
struct NetworkDeviceInformation final {
std::string name;
std::string description;
std::vector<NetworkAddress> ipv4_address_list;
std::vector<NetworkAddress> ipv6_address_list;
bpf_u_int32 flags;
};
/// Creates a new pcap handle
osquery::Status createPcap(PcapRef& ref,
const std::string& device_name,
int capture_buffer_size,
int packet_capture_timeout,
bool promiscuous_mode);
/// Returns the device information for the specified network interface
osquery::Status getNetworkDeviceInformation(NetworkDeviceInformation& dev_info,
const std::string& device_name);
/// Performs a poll() on the given pcap handle, waiting for new packets
osquery::Status waitForNewPackets(bool& timed_out,
PcapRef& ref,
std::size_t msecs);
} // namespace trailofbits
| 33.777778 | 80 | 0.633224 | [
"vector"
] |
8591f9fe9694afe28e443c4b56ae70a39b643df1 | 546 | h | C | cases/spherical_surfers/param/post/objects/surfer__us_1o0__surftimeconst_1o0__reorientationtime_2o5/py/group/_member/passive/position/parameters.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/spherical_surfers/param/post/objects/surfer__us_1o0__surftimeconst_1o0__reorientationtime_2o5/py/group/_member/passive/position/parameters.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/spherical_surfers/param/post/objects/surfer__us_1o0__surftimeconst_1o0__reorientationtime_2o5/py/group/_member/passive/position/parameters.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | #ifndef C0P_PARAM_POST_OBJECTS_SURFER__US_1O0__SURFTIMECONST_1O0__REORIENTATIONTIME_2O5_PY_GROUP_MEMBER_PASSIVE_POSITION_PARAMETERS_H
#define C0P_PARAM_POST_OBJECTS_SURFER__US_1O0__SURFTIMECONST_1O0__REORIENTATIONTIME_2O5_PY_GROUP_MEMBER_PASSIVE_POSITION_PARAMETERS_H
#pragma once
// app include
#include "core/post/objects/object/post/passive/position/prop.h"
namespace c0p {
struct PostSurferUs1O0Surftimeconst1O0Reorientationtime2O5PyGroupMemberPassivePositionParameters {
std::string name = "pos";
std::size_t i = 1;
};
}
#endif
| 30.333333 | 133 | 0.8663 | [
"object"
] |
85922198fa086b6673a9cd8cf1c8e5126eb623f9 | 18,799 | c | C | jsmnrpc.c | acrop/jsmn | acd36cc84cf2c58a1e361f6ca0d30b9f06d71f07 | [
"MIT"
] | null | null | null | jsmnrpc.c | acrop/jsmn | acd36cc84cf2c58a1e361f6ca0d30b9f06d71f07 | [
"MIT"
] | null | null | null | jsmnrpc.c | acrop/jsmn | acd36cc84cf2c58a1e361f6ca0d30b9f06d71f07 | [
"MIT"
] | null | null | null | /**
@file jsmnrpc_tiny.cpp
@author lukasz.forynski
@date 06/08/2013
@brief Very lightweight implementation of JSON-RPC framework for C or C++.
It allows registering handlers, supports request handling and does not perform
any memory allocations. It can be used in embedded systems.
___________________________
The MIT License (MIT)
Copyright (c) 2013 Lukasz Forynski
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 <stdint.h>
#include "jsmnrpc.h"
/* Private types and definitions ------------------------------------------------------- */
static const char* response_1x_prefix = "{";
static const char* response_20_prefix = "{\"jsonrpc\": \"2.0\"";
typedef struct jsmnrpc_error_code
{
int error_code;
const char* error_msg;
} jsmnrpc_error_code_t;
jsmnrpc_error_code_t jsmnrpc_err_codes[] =
{
{ -32700, "Parse error" }, /* An error occurred on the server while parsing the JSON text */
{ -32600, "Invalid Request" }, /* The JSON sent is not a valid Request object */
{ -32601, "Method not found" }, /* The method does not exist / is not available */
{ -32602, "Invalid params" }, /* Invalid method parameter(s) */
{ -32603, "Internal error" } /* Internal JSON-RPC error */
};
enum jsmnrpc_key_ids
{
jsmnrpc_key_jsonrpc = 0,
jsmnrpc_key_method,
jsmnrpc_key_params,
jsmnrpc_key_id,
jsmnrpc_key_result,
jsmnrpc_key_error,
jsmnrpc_key_count
};
const char* jsmnrpc_keys[] =
{
"jsonrpc",
"method",
"params",
"id",
"result",
"error",
};
/* Private function declarations ------------------------------------------------------- */
static int str_len(const char* str);
/* Exported functions ------------------------------------------------------- */
void jsmnrpc_init(jsmnrpc_instance_t* self, jsmnrpc_handler_t* table_for_handlers, int max_num_of_handlers)
{
int i;
self->handlers = table_for_handlers;
self->num_of_handlers = 0;
self->max_num_of_handlers = max_num_of_handlers;
for (i = 0; i < self->max_num_of_handlers; i++)
{
self->handlers[i].handler_name = 0;
self->handlers[i].handler = 0;
}
}
void jsmnrpc_register_handler(jsmnrpc_instance_t* self, const char* handler_name, jsmnrpc_handler_callback_t handler)
{
if (self->num_of_handlers < self->max_num_of_handlers)
{
if (handler_name && handler)
{
self->handlers[self->num_of_handlers].handler_name = handler_name;
self->handlers[self->num_of_handlers].handler = handler;
self->num_of_handlers++;
}
}
}
static int jsmnrpc_get_handler_id(jsmnrpc_instance_t* table, const jsmnrpc_string_t name)
{
int result = -1;
for (int i = 0; i < table->num_of_handlers; i++)
{
if (str_are_equal(name.data, name.length, table->handlers[i].handler_name)) {
result = i;
break;
}
}
return result;
}
void jsmnrpc_handle_request_single(jsmnrpc_instance_t* self, jsmnrpc_request_info_t* request_info, int token_id)
{
jsmnrpc_token_list_t *tokens = &request_info->data->tokens;
int method_value_token = jsmnrpc_get_value(tokens, token_id, -1, jsmnrpc_keys[jsmnrpc_key_method]);
int jsonrpc_value_token = jsmnrpc_get_value(tokens, token_id, -1, jsmnrpc_keys[jsmnrpc_key_jsonrpc]);
request_info->params_value_token = jsmnrpc_get_value(tokens, token_id, -1, jsmnrpc_keys[jsmnrpc_key_params]);
request_info->id_value_token = jsmnrpc_get_value(tokens, token_id, -1, jsmnrpc_keys[jsmnrpc_key_id]);
request_info->info_flags = 0;
if (jsonrpc_value_token > 0) {
jsmnrpc_string_t str = jsmnrpc_get_string(tokens, jsonrpc_value_token);
if (str_are_equal(str.data, str.length, "2.0")) {
request_info->info_flags |= jsmnrpc_request_is_rpc_20;
}
}
if (request_info->id_value_token < 0)
{
/* For rpc client 1.0, id must be null for notification, so when id is not exist, treat as error */
if (!(request_info->info_flags & jsmnrpc_request_is_rpc_20)) {
jsmnrpc_create_error(jsmnrpc_err_invalid_request, NULL, request_info);
return;
}
request_info->info_flags |= jsmnrpc_request_is_notification;
/*
id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included.
If it is not included it is assumed to be a notification. The value SHOULD normally not be Null [1]
and Numbers SHOULD NOT contain fractional parts [2]
The Server MUST reply with the same value in the Response object if included. This member is used to
correlate the context between the two objects.
[1] The use of Null as a value for the id member in a Request object is discouraged, because this
specification uses a value of Null for Responses with an unknown id. Also, because JSON-RPC 1.0 uses
an id value of Null for Notifications this could cause confusion in handling.
[2] Fractional parts may be problematic, since many decimal fractions cannot be represented exactly
as binary fractions.
*/
}
else
{
jsmntok_t *id_value_token = NULL;
if (request_info->id_value_token >= 0) {
id_value_token = tokens->data + request_info->id_value_token;
}
/* if id value is not primitive or string, then it's an error */
if (id_value_token == NULL || (id_value_token->type != JSMN_PRIMITIVE && id_value_token->type != JSMN_STRING)) {
jsmnrpc_create_error(jsmnrpc_err_invalid_request, NULL, request_info);
return;
}
if (!(request_info->info_flags & jsmnrpc_request_is_rpc_20)) {
/* For rpc client 1.0, null is notification */
jsmnrpc_string_t str = jsmnrpc_get_string(tokens, request_info->id_value_token);
if (str_are_equal(str.data, str.length, "null")) {
request_info->info_flags |= jsmnrpc_request_is_notification;
}
}
}
{
if (method_value_token >= 0 && tokens->data[method_value_token].type == JSMN_STRING) {
jsmnrpc_string_t str = jsmnrpc_get_string(tokens, method_value_token);
int handler_id = jsmnrpc_get_handler_id(self, str);
if (handler_id >= 0) {
self->handlers[handler_id].handler(request_info);
if (request_info->info_flags & jsmnrpc_response_is_result)
{
append_str_with_len(&(request_info->data->response), "}", SIZE_MAX);
}
}
else
{
jsmnrpc_create_error(jsmnrpc_err_method_not_found, NULL, request_info);
}
}
else
{
jsmnrpc_create_error(jsmnrpc_err_invalid_request, NULL, request_info);
}
}
}
bool jsmnrpc_parse(jsmnrpc_token_list_t* tokens, jsmnrpc_string_t *str)
{
if (tokens) {
tokens->length = -1;
jsmn_init(&(tokens->parser));
if (str) {
tokens->json = str->data;
tokens->length = jsmn_parse(&(tokens->parser), str->data, (jsmn_size_t)str->length, tokens->data, tokens->capacity);
return tokens->length > 0;
}
}
return false;
}
void jsmnrpc_handle_request(jsmnrpc_instance_t* self, jsmnrpc_data_t* request_data)
{
jsmnrpc_request_info_t request_info;
request_info.data = request_data;
const int root_token_id = 0;
jsmnrpc_token_list_t *tokens = &request_data->tokens;
jsmnrpc_string_t *request = &request_data->request;
jsmntok_t *root_token = tokens->data + root_token_id;
request_data->response.length = 0;
request_info.id_value_token = -1;
request_info.params_value_token = -1;
request_info.info_flags = 0;
do {
if (!jsmnrpc_parse(tokens, request)) {
jsmnrpc_create_error(jsmnrpc_err_parse_error, NULL, &request_info);
break;
}
if (root_token->type != JSMN_ARRAY && root_token->type != JSMN_OBJECT) {
jsmnrpc_create_error(jsmnrpc_err_invalid_request, NULL, &request_info);
break;
}
if (root_token->type == JSMN_ARRAY && root_token->size < 1) {
jsmnrpc_create_error(jsmnrpc_err_invalid_request, NULL, &request_info);
break;
}
if (root_token->type == JSMN_ARRAY)
{
append_str_with_len(&request_data->response, "[", SIZE_MAX);
for (int i = 1; i < tokens->length; ++i) {
if (tokens->data[i].parent == root_token_id) {
jsmnrpc_handle_request_single(self, &request_info, i);
}
}
append_str_with_len(&request_data->response, "]", SIZE_MAX);
request_info.info_flags = jsmnrpc_response_is_array;
}
else
{
jsmnrpc_handle_request_single(self, &request_info, 0);
}
} while (0);
if (request_data->response.capacity > 0)
{
if (request_data->response.length < request_data->response.capacity)
{
request_data->response.data[request_data->response.length] = 0;
}
}
request_data->info_flags = request_info.info_flags;
}
bool jsmnrpc_create_result_prefix(jsmnrpc_request_info_t* info)
{
if (!(info->info_flags & jsmnrpc_request_is_notification))
{
jsmnrpc_string_t *response = &info->data->response;
if (response->length > 2) // not the beginning of a batch response
{
append_str_with_len(response, ", ", 2);
}
if (info->info_flags & jsmnrpc_request_is_rpc_20)
{
append_str_with_len(response, response_20_prefix, SIZE_MAX);
}
else
{
append_str_with_len(response, response_1x_prefix, SIZE_MAX);
append_str_with_len(response, "\"error\": null", SIZE_MAX);
}
if (info->id_value_token >= 0)
{
append_str_with_len(response, ", \"id\": ", SIZE_MAX);
append_str(response, jsmnrpc_get_string(&info->data->tokens, info->id_value_token));
}
append_str_with_len(response, ", \"result\": ", SIZE_MAX);
info->info_flags |= jsmnrpc_response_is_result;
return true;
}
return false;
}
void jsmnrpc_create_result(const char* result_str, jsmnrpc_request_info_t* info)
{
if (jsmnrpc_create_result_prefix(info)) {
append_str_with_len(&info->data->response, result_str, SIZE_MAX);
}
}
void jsmnrpc_create_error(int err, const char* err_msg, jsmnrpc_request_info_t* info)
{
char tmp_buffer[20];
int err_code = -1;
jsmnrpc_string_t *response = &info->data->response;
jsmnrpc_string_t *request = &info->data->request;
if (err >= 0 && err < jsmnrpc_err_count) {
err_code = jsmnrpc_err_codes[err].error_code;
err_msg = jsmnrpc_err_codes[err].error_msg;
}
else if (err < 0)
{
err_code = err;
}
else
{
err_code = -1;
}
info->info_flags |= jsmnrpc_response_is_error;
if (response->length > 2) // not the beginning of a batch response
{
append_str_with_len(response, ", ", 2);
}
if (!(info->info_flags & jsmnrpc_request_is_notification))
{
const char*err_code_str = NULL;
if (err == jsmnrpc_err_parse_error) {
char *request_filterd = tmp_buffer;
*request_filterd = 0;
for (int i = 0; i < request->length && (request_filterd < tmp_buffer + 20); ++i) {
char ch = request->data[i];
if (ch != '\t' && ch != '\n' && ch != '\r' && ch != ' ') {
*request_filterd = ch;
++request_filterd;
}
}
if (str_are_equal(tmp_buffer, str_len("{\"jsonrpc\":\"2.0\","), "{\"jsonrpc\":\"2.0\",")) {
info->info_flags |= jsmnrpc_request_is_rpc_20;
}
}
if (info->info_flags & jsmnrpc_request_is_rpc_20)
{
append_str_with_len(response, response_20_prefix, SIZE_MAX);
append_str_with_len(response, ", ", SIZE_MAX);
}
else
{
append_str_with_len(response, response_1x_prefix, SIZE_MAX);
}
append_str_with_len(response, "\"error\": {\"code\": ", SIZE_MAX);
err_code_str = i_to_str(err_code, tmp_buffer);
append_str_with_len(response, err_code_str, SIZE_MAX);
append_str_with_len(response, ", \"message\": \"", SIZE_MAX);
append_str_with_len(response, err_msg, SIZE_MAX);
append_str_with_len(response, "\"}", SIZE_MAX);
if (info->id_value_token >= 0 || err == jsmnrpc_err_invalid_request)
{
append_str_with_len(response, ", \"id\": ", SIZE_MAX);
if (info->id_value_token >= 0)
{
append_str(response, jsmnrpc_get_string(&info->data->tokens, info->id_value_token));
}
else
{
append_str_with_len(response, "null", SIZE_MAX);
}
}
append_str_with_len(response, "}", SIZE_MAX);
}
}
int jsmnrpc_get_object_key(jsmnrpc_token_list_t *tokens, int token_offset, int index)
{
int result = -1;
int offset = 0;
if (token_offset < 0 || tokens->data[token_offset].type != JSMN_OBJECT) {
return -1;
}
for (int i = token_offset + 1; i < tokens->length; ++i) {
jsmntok_t *token = tokens->data + i;
if (token->parent == token_offset) {
if (offset == index) {
result = i;
break;
}
++offset;
}
}
return result;
}
int jsmnrpc_get_value(jsmnrpc_token_list_t *tokens, int token_offset, int index, const char*key)
{
int result = -1;
if (token_offset >= 0)
{
jsmntok_t *node = tokens->data + token_offset;
if (node->type == JSMN_ARRAY && index < 0)
{
result = -1;
}
else if (node->type == JSMN_OBJECT && key == NULL)
{
result = -1;
}
else if (node->type != JSMN_ARRAY && node->type != JSMN_OBJECT)
{
if ((token_offset + 1 < tokens->length) && tokens->data[token_offset + 1].parent == token_offset) {
result = token_offset + 1;
}
else
{
result = token_offset;
}
}
else
{
int offset = 0;
for (int i = token_offset + 1; i < tokens->length; ++i) {
jsmntok_t *token = tokens->data + i;
if (token->parent == token_offset) {
jsmnrpc_string_t str = jsmnrpc_get_string(tokens, i);
if (node->type == JSMN_OBJECT) {
if (str_are_equal(str.data, str.length, key)) {
result = i + 1;
/* Protecting result */
if (result >= tokens->length || tokens->data[result].parent != i) {
result = -1;
}
break;
}
}
else if (node->type == JSMN_ARRAY)
{
if (offset == index)
{
result = i;
break;
}
++offset;
}
}
}
}
}
return result;
}
jsmnrpc_string_t jsmnrpc_get_string(jsmnrpc_token_list_t *tokens, int token) {
jsmnrpc_string_t result;
if (token < 0) {
result.data = NULL;
result.length = 0;
} else {
result.data = (char*)(tokens->json + tokens->data[token].start);
result.length = tokens->data[token].end - tokens->data[token].start;
}
result.capacity = 0;
return result;
}
void append_str_with_len(jsmnrpc_string_t *str, const char* from, size_t len)
{
size_t saved_len = str->length;
if (len == SIZE_MAX) {
len = str_len(from);
}
str->length += len;
if (str->length <= str->capacity) {
for (int i = 0; i < len; ++i) {
str->data[saved_len + i] = from[i];
}
}
}
void append_str(jsmnrpc_string_t *str, jsmnrpc_string_t rpc_str)
{
append_str_with_len(str, rpc_str.data, rpc_str.length);
}
int str_are_equal(const char* first, size_t first_len, const char* second_zero_ended)
{
int are_equal = 0;
while (*second_zero_ended != 0 && // not the end of string?
*first != 0 && // nor end of str
*first == *second_zero_ended) // until are equal
{
first++;
second_zero_ended++;
first_len--;
}
// here, if we're at the end of first and second they do match at least at first_len characters.
if (*second_zero_ended == 0 && first_len == 0)
{
are_equal = 1;
}
return are_equal;
}
char* i_to_str(int i, char b[])
{
char const digit[] = "0123456789";
char* p = b;
if (i<0) {
*p++ = '-';
i *= -1;
}
int shifter = i;
do { //Move to where representation ends
++p;
shifter = shifter / 10;
} while (shifter);
*p = '\0';
do { //Move back, inserting digits as u go
*--p = digit[i % 10];
i = i / 10;
} while (i);
return b;
}
static int int_val(char symbol, int* result)
{
int value_ok = 1;
int correct_by = 0;
if ((symbol >= '0') && (symbol <= '9'))
{
correct_by = '0';
}
else if ((symbol >= 'A') && (symbol <= 'F'))
{
correct_by = ('A' - 10);
}
else if ((symbol >= 'a') && (symbol <= 'f'))
{
correct_by = ('a' - 10);
}
else
{
value_ok = 0;
}
*result = symbol - correct_by;
return value_ok;
}
int str_to_i(const char* start, size_t length, int* result)
{
int extracted_ok = 1;
int base = 10;
int value = 0;
int sign = 1;
int val_start = 0;
int i = 0;
if (length > 0 && start[0] == '-')
{
sign = -1;
val_start++;
}
// find base: 0x: hex(16), 0:octal(8)
if (length > val_start + 2 &&
start[val_start] == '0')
{
if (start[val_start + 1] == 'x')
{
base = 16;
val_start += 2;
}
else
{
base = 8;
val_start += 1;
}
}
*result = 0;
for (i = val_start; i < length; i++)
{
if (i > val_start)
{
*result *= base;
}
if (!int_val(start[i], &value) ||
value > base)
{
extracted_ok = 0;
break;
}
*result += value;
}
*result *= sign;
return extracted_ok;
}
int str_len(const char* str)
{
// yes yes, the unsafe str_len.. hopefully we'll use it wisely ;)
int i = 0;
while (*str++)
{
i++;
}
return i;
}
| 30.030351 | 123 | 0.621416 | [
"object"
] |
8bf36b977eb58cf79f8213fb481444b323b42421 | 2,506 | h | C | 9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h | HelixOS/prebuilts-ndk | 6e97ff0d4f69d92c4c81b82340ff3b0b85d77789 | [
"Apache-2.0"
] | 1 | 2019-07-10T15:21:02.000Z | 2019-07-10T15:21:02.000Z | 9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h | HelixOS/prebuilts-ndk | 6e97ff0d4f69d92c4c81b82340ff3b0b85d77789 | [
"Apache-2.0"
] | null | null | null | 9/platforms/android-19/arch-x86/usr/include/rs/rsFileA3D.h | HelixOS/prebuilts-ndk | 6e97ff0d4f69d92c4c81b82340ff3b0b85d77789 | [
"Apache-2.0"
] | 1 | 2019-02-25T11:55:44.000Z | 2019-02-25T11:55:44.000Z | /*
* Copyright (C) 2009 The Android Open Source Project
*
* 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 ANDROID_RS_FILE_A3D_H
#define ANDROID_RS_FILE_A3D_H
#include "rsMesh.h"
#include "rsStream.h"
#include <stdio.h>
#define A3D_MAGIC_KEY "Android3D_ff"
// ---------------------------------------------------------------------------
namespace android {
class Asset;
namespace renderscript {
class FileA3D : public ObjectBase {
public:
FileA3D(Context *rsc);
~FileA3D();
uint32_t mMajorVersion;
uint32_t mMinorVersion;
uint64_t mIndexOffset;
uint64_t mStringTableOffset;
bool mUse64BitOffsets;
class A3DIndexEntry {
const char *mObjectName;
RsA3DClassID mType;
uint64_t mOffset;
uint64_t mLength;
ObjectBase *mRsObj;
public:
friend class FileA3D;
const char *getObjectName() const {
return mObjectName;
}
RsA3DClassID getType() const {
return mType;
}
~A3DIndexEntry();
};
bool load(FILE *f);
bool load(Asset *asset);
bool load(const void *data, size_t length);
size_t getNumIndexEntries() const;
const A3DIndexEntry* getIndexEntry(size_t index) const;
ObjectBase *initializeFromEntry(size_t index);
void appendToFile(Context *rsc, ObjectBase *obj);
bool writeFile(const char *filename);
// Currently files do not get serialized,
// but we need to inherit from ObjectBase for ref tracking
virtual void serialize(Context *rsc, OStream *stream) const {
}
virtual RsA3DClassID getClassId() const {
return RS_A3D_CLASS_ID_UNKNOWN;
}
protected:
void parseHeader(IStream *headerStream);
const uint8_t * mData;
void * mAlloc;
uint64_t mDataSize;
Asset *mAsset;
OStream *mWriteStream;
Vector<A3DIndexEntry*> mWriteIndex;
IStream *mReadStream;
Vector<A3DIndexEntry*> mIndex;
};
}
}
#endif //ANDROID_RS_FILE_A3D_H
| 24.330097 | 78 | 0.666002 | [
"vector"
] |
8bfe94a4669e9ff5ba45828ba535103f4fd3ae9f | 6,136 | h | C | src/orz/tools/hash_table.h | ViewFaceCore/OpenRoleZoo | 19cef3cdc5238374cedcf7068dc7a6ad8448c21b | [
"BSD-2-Clause"
] | null | null | null | src/orz/tools/hash_table.h | ViewFaceCore/OpenRoleZoo | 19cef3cdc5238374cedcf7068dc7a6ad8448c21b | [
"BSD-2-Clause"
] | null | null | null | src/orz/tools/hash_table.h | ViewFaceCore/OpenRoleZoo | 19cef3cdc5238374cedcf7068dc7a6ad8448c21b | [
"BSD-2-Clause"
] | null | null | null | //
// Created by kier on 2019/3/21.
//
#ifndef ORZ_HASH_TABLE_H
#define ORZ_HASH_TABLE_H
#include <string>
namespace orz {
inline unsigned int ELFhash(const char *str) {
unsigned int hash = 0;
unsigned int x = 0;
while (*str) {
hash = (hash << 4) + *str;
if ((x = hash & 0xf0000000) != 0) {
hash ^= (x >> 24);
hash &= ~x;
}
str++;
}
return (hash & 0x7fffffff);
}
template <typename resources>
class hash_node {
public:
using hash_type = unsigned int;
hash_node() = default;
explicit hash_node(const std::string &key, const resources &value)
: key(key), hash(ELFhash(key.c_str())), value(value) {}
std::string key;
hash_type hash = 0;
int64_t next = -1;
resources value;
};
template <typename resources>
class hash_table {
public:
using self = hash_table;
using node_type = orz::hash_node<resources>;
using hash_type = unsigned int;
using index_type = hash_type;
explicit hash_table(unsigned int size) : m_nodes(size_t(size > 2 ? size : 2), nullptr) {}
hash_table() : hash_table(2) {}
~hash_table() {
for (auto node : m_nodes) {
delete node;
}
}
hash_table(const self &) = delete;
self &operator==(const self &) = delete;
node_type *insert(const std::string &key, const resources &value) {
auto *found_node = this->find(key);
if (found_node) {
found_node->value = value;
return found_node;
}
auto *new_node = new node_type(key, value);
insert(new_node);
return new_node;
}
// TODO: add erase method
node_type *find(const std::string &key) {
auto hash = ELFhash(key.c_str());
auto index = index_type(hash % m_nodes.size());
while (m_nodes[index] != nullptr) {
auto node = m_nodes[index];
if (hash == node->hash && std::strcmp(key.c_str(), node->key.c_str()) == 0) {
return m_nodes[index];
}
auto next_index = m_nodes[index]->next;
if (next_index < 0) break;
index = index_type(next_index);
}
return nullptr;
}
size_t size() const {
return m_size;
}
const std::vector<node_type *> &nodes() const {
return m_nodes;
}
private:
void insert(node_type *node) {
if (node == nullptr) return;
if (m_size >= m_nodes.size() / 2) {
rehash(m_nodes.size() * 2);
}
++m_size;
auto hash = node->hash;
auto index = index_type(hash % m_nodes.size());
auto first_aid_index = index;
if (m_nodes[index] == nullptr) {
m_nodes[index] = node;
return;
}
do {
auto anchor = m_nodes[index];
auto anchor_hash = anchor->hash;
auto anchor_index = index_type(anchor_hash % m_nodes.size());
// if (anchor_hash == hash && anchor->key == key) {}
if (anchor_index == first_aid_index) {
auto next_index = anchor->next;
if (next_index < 0) {
// a.1 insert at empty slot
node->next = -1;
anchor->next = insert_at_next_ready(node);
break; // break when m_nodes[index]->next < 0
}
index = index_type(next_index);
} else {
// b.1 find pre-next value
auto pre_next_index = index_type(anchor_hash % m_nodes.size());
if (m_nodes[pre_next_index] == nullptr) {
m_nodes[pre_next_index] = anchor;
m_nodes[index] = node;
break;
}
while (m_nodes[pre_next_index]->next >= 0 &&
m_nodes[pre_next_index]->next != index) {
pre_next_index = index_type(m_nodes[pre_next_index]->next);
}
m_nodes[pre_next_index]->next = update_conflict_node(anchor);
m_nodes[index] = node;
break; // break when hash conflict
}
} while (m_nodes[index] != nullptr); ///< always true
}
index_type update_conflict_node(node_type *node) {
auto hash = node->hash;
auto index = index_type(hash % m_nodes.size());
if (m_nodes[index] == nullptr) {
m_nodes[index] = node;
return index;
}
return insert_at_next_ready(node);
}
index_type insert_at_next_ready(node_type *node) {
while (m_nodes[m_next_ready] != nullptr) m_next_ready = (m_next_ready + 1) % m_nodes.size();
auto index = index_type(m_next_ready);
m_next_ready = (m_next_ready + 1) % m_nodes.size();
m_nodes[index] = node;
return index;
}
void rehash(size_t size) {
if (size < m_nodes.size()) size = m_nodes.size();
hash_table temp((unsigned int) (size));
for (auto &node : m_nodes) {
if (node == nullptr) continue;
node->next = -1;
temp.insert(node);
}
m_nodes = temp.m_nodes;
m_next_ready = temp.m_next_ready;
m_size = temp.m_size;
temp.m_nodes.clear();
temp.m_next_ready = 0;
temp.m_size = 0;
}
private:
std::vector<node_type *> m_nodes;
size_t m_next_ready = 0;
size_t m_size = 0;
};
}
#endif //ORZ_HASH_TABLE_H
| 31.958333 | 104 | 0.480443 | [
"vector"
] |
e3015f7a335a532d17779d725b6bafe837c5737a | 1,795 | h | C | include/1.5/dom/domKinematics_index.h | TomDataworks/3p-colladadom | 5e37592a81525b94e707a53fb7c0bb17c68fb25e | [
"MIT",
"BSL-1.0",
"Zlib",
"BSD-3-Clause"
] | 7 | 2016-01-08T20:38:51.000Z | 2021-03-03T03:54:40.000Z | include/1.5/dom/domKinematics_index.h | TomDataworks/3p-colladadom | 5e37592a81525b94e707a53fb7c0bb17c68fb25e | [
"MIT",
"BSL-1.0",
"Zlib",
"BSD-3-Clause"
] | null | null | null | include/1.5/dom/domKinematics_index.h | TomDataworks/3p-colladadom | 5e37592a81525b94e707a53fb7c0bb17c68fb25e | [
"MIT",
"BSL-1.0",
"Zlib",
"BSD-3-Clause"
] | null | null | null | #ifndef __domKinematics_index_h__
#define __domKinematics_index_h__
#include <dae/daeDocument.h>
#include <dom/domTypes.h>
#include <dom/domElements.h>
#include <dom/domCommon_int_or_param.h>
class DAE;
class domKinematics_index : public domCommon_int_or_param
{
public:
virtual COLLADA_TYPE::TypeEnum getElementType() const { return COLLADA_TYPE::KINEMATICS_INDEX; }
static daeInt ID() { return 441; }
virtual daeInt typeID() const { return ID(); }
protected: // Attribute
xsNMTOKEN attrSemantic;
public: //Accessors and Mutators
/**
* Gets the semantic attribute.
* @return Returns a xsNMTOKEN of the semantic attribute.
*/
xsNMTOKEN getSemantic() const { return attrSemantic; }
/**
* Sets the semantic attribute.
* @param atSemantic The new value for the semantic attribute.
*/
void setSemantic( xsNMTOKEN atSemantic ) { *(daeStringRef*)&attrSemantic = atSemantic;}
protected:
/**
* Constructor
*/
domKinematics_index(DAE& dae) : domCommon_int_or_param(dae), attrSemantic() {}
/**
* Destructor
*/
virtual ~domKinematics_index() {}
/**
* Overloaded assignment operator
*/
virtual domKinematics_index &operator=( const domKinematics_index &cpy ) { (void)cpy; return *this; }
public: // STATIC METHODS
/**
* Creates an instance of this class and returns a daeElementRef referencing it.
* @return a daeElementRef referencing an instance of this object.
*/
static DLLSPEC daeElementRef create(DAE& dae);
/**
* Creates a daeMetaElement object that describes this element in the meta object reflection framework.
* If a daeMetaElement already exists it will return that instead of creating a new one.
* @return A daeMetaElement describing this COLLADA element.
*/
static DLLSPEC daeMetaElement* registerElement(DAE& dae);
};
#endif
| 28.492063 | 104 | 0.743175 | [
"object"
] |
e30247252e8c26f36aa260d1f035a65d2a00d040 | 4,949 | h | C | radixsort/RadixSort/radixSort.h | jeshi96/parbutterfly | 06af1f082736c446c740dcd8c1d0ce2b44442ee9 | [
"MIT"
] | 5 | 2019-08-18T22:07:09.000Z | 2021-03-25T20:52:20.000Z | radixsort/RadixSort/radixSort.h | jeshi96/parbutterfly | 06af1f082736c446c740dcd8c1d0ce2b44442ee9 | [
"MIT"
] | 1 | 2019-11-25T20:57:27.000Z | 2019-11-26T04:26:03.000Z | radixsort/RadixSort/radixSort.h | jeshi96/parbutterfly | 06af1f082736c446c740dcd8c1d0ce2b44442ee9 | [
"MIT"
] | 1 | 2019-12-03T05:58:26.000Z | 2019-12-03T05:58:26.000Z | // This code is part of the Problem Based Benchmark Suite (PBBS)
// Copyright (c) 2011 Guy Blelloch and the PBBS team
//
// 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.
#ifndef _S_RADIX_INCLUDED
#define _S_RADIX_INCLUDED
//#define DEBUG 0
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include "utils.h"
#include "radix_configs.h"
#include "parallel.h"
#include <vector>
#include <utility>
#include "regionsSort.h"
#include "misc.h"
#include "common_sort.h"
#include "sequence.h"
namespace radix{
using namespace std;
template <class E, class F>
void radixSortOneLevel(E* A, sizeT n, int doneOffset, F f, sizeT K, int depth) {
if(doneOffset <= 0 || n <= 1) {
return;
}
int bits = MAX_RADIX;
int buckets = R_BUCKETS;
int start = max(doneOffset - bits, 0);
bool needToRecurse = true;
long localCounts[R_BUCKETS];
needToRecurse = multiBitSwapBasedSort(A, n, buckets, K, localCounts, eBits<E, F>(doneOffset - start, start, f), f, depth, start);
if(start <= 0)
return;
if(needToRecurse) {
long sum = 0;
for(int i = 0; i < R_BUCKETS; i++) {
radixSortOneLevel(A + sum, localCounts[i], start, f, (sizeT)1, depth + 1);
sum += localCounts[i];
}
}
}
template <class E, class F>
void radixSortRoutine(sizeT index, E* A, sizeT n, int doneOffset, F f){
sizeT K;
#ifdef CYCLE
K = getWorkers();
#else
sizeT optimalCache = (n*sizeof(E))/BLOCK_DIVIDE;
if(optimalCache > getWorkers() && optimalCache <= K_BOUND){
K = optimalCache;
}
else{
if(optimalCache < getWorkers()) {
K = getWorkers();
} else {
K = K_BOUND;
}
}
#endif
global_K = K;
global_N = n;
radixSortOneLevel(A, n, doneOffset, f, K, 0);
};
int roundUpToRadixMultiple(int num){
if(num % MAX_RADIX == 0){
return num;
}
else{
return ((num / MAX_RADIX) + 1) * MAX_RADIX;
}
}
int roundUpBits(int num){
int multipleOfRadix = roundUpToRadixMultiple(num);
#ifdef BITS_HACK
#if MAX_RADIX == 8
if(multipleOfRadix >= num + 2) {
return num+2;
}
#endif
#endif
return multipleOfRadix;
}
template <class E, class F, class K>
void iSort(E *A, sizeT n, K m, F f) {
int bits = roundUpBits(utils::log2Up(m));
radixSortRoutine((sizeT)0, A, n, bits, f);
}
template <class E, class F, class K>
K findMaxHelper(E* A, sizeT n, F f, sizeT P, K t){
K* temp = (K*)malloc(sizeof(E) * (P + 1));
parallel_for(unsigned long i = 0; i <P; i ++) {
unsigned long start = i * (long)n / P;
unsigned long end = ((long)(i + 1) * n) / P;
K local_max = 0;
for(;start < end; start++){
K current = f(A[start]);
if(current > local_max) {
local_max = current;
}
}
temp[i] = local_max;
}
K global_max = temp[0];
for(int i = 0; i < P; i++) {
if(temp[i] > global_max) {
global_max = temp[i];
}
}
free(temp);
return global_max;
}
template <class E, class F, class K>
K findMax(E* A, sizeT n, F f, K temp){
K maxV = findMaxHelper(A, n, f, (sizeT)1000*getWorkers(), temp);
return maxV;
}
template <class X, class T, class F>
static void parallelIntegerSort(T *A, sizeT n, F f) {
X temp;
X maxV = findMax(A, n, f, temp);
iSort(A, n, maxV+1, f);
}
template <class T>
static void parallelIntegerSort(T *A, sizeT n) {
parallelIntegerSort(A, n, utils::identityF<T>());
}
template <class T1, class T2, class F>
void parallelIntegerSort(pair<T1, T2> *A, sizeT n, F f) {
T1 temp;
T1 maxV = findMax(A, n, f, temp);
iSort(A, n, maxV+1, f);
}
template <class T1, class T2>
void parallelIntegerSort(pair<T1, T2> *A, sizeT n) {
parallelIntegerSort(A, n, utils::firstF<T1, T2>());
}
}
#endif
| 24.994949 | 135 | 0.625985 | [
"vector"
] |
e30e3a6c0caa17cdac8865bbaaf0b2473687fe27 | 25,157 | h | C | partners/include/tencentcloud/partners/v20180321/model/AgentDealElem.h | sinjoywong/tencentcloud-sdk-cpp | 1b931d20956a90b15a6720f924e5c69f8786f9f4 | [
"Apache-2.0"
] | null | null | null | partners/include/tencentcloud/partners/v20180321/model/AgentDealElem.h | sinjoywong/tencentcloud-sdk-cpp | 1b931d20956a90b15a6720f924e5c69f8786f9f4 | [
"Apache-2.0"
] | null | null | null | partners/include/tencentcloud/partners/v20180321/model/AgentDealElem.h | sinjoywong/tencentcloud-sdk-cpp | 1b931d20956a90b15a6720f924e5c69f8786f9f4 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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.
*/
#ifndef TENCENTCLOUD_PARTNERS_V20180321_MODEL_AGENTDEALELEM_H_
#define TENCENTCLOUD_PARTNERS_V20180321_MODEL_AGENTDEALELEM_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
#include <tencentcloud/core/AbstractModel.h>
#include <tencentcloud/partners/v20180321/model/DealGoodsPriceElem.h>
#include <tencentcloud/partners/v20180321/model/ProductInfoElem.h>
namespace TencentCloud
{
namespace Partners
{
namespace V20180321
{
namespace Model
{
/**
* 描述代理商代付的订单信息
*/
class AgentDealElem : public AbstractModel
{
public:
AgentDealElem();
~AgentDealElem() = default;
void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const;
CoreInternalOutcome Deserialize(const rapidjson::Value &value);
/**
* 获取订单自增 ID
* @return DealId 订单自增 ID
*/
std::string GetDealId() const;
/**
* 设置订单自增 ID
* @param DealId 订单自增 ID
*/
void SetDealId(const std::string& _dealId);
/**
* 判断参数 DealId 是否已赋值
* @return DealId 是否已赋值
*/
bool DealIdHasBeenSet() const;
/**
* 获取订单号
* @return DealName 订单号
*/
std::string GetDealName() const;
/**
* 设置订单号
* @param DealName 订单号
*/
void SetDealName(const std::string& _dealName);
/**
* 判断参数 DealName 是否已赋值
* @return DealName 是否已赋值
*/
bool DealNameHasBeenSet() const;
/**
* 获取商品类型 ID
* @return GoodsCategoryId 商品类型 ID
*/
std::string GetGoodsCategoryId() const;
/**
* 设置商品类型 ID
* @param GoodsCategoryId 商品类型 ID
*/
void SetGoodsCategoryId(const std::string& _goodsCategoryId);
/**
* 判断参数 GoodsCategoryId 是否已赋值
* @return GoodsCategoryId 是否已赋值
*/
bool GoodsCategoryIdHasBeenSet() const;
/**
* 获取订单所有者
* @return OwnerUin 订单所有者
*/
std::string GetOwnerUin() const;
/**
* 设置订单所有者
* @param OwnerUin 订单所有者
*/
void SetOwnerUin(const std::string& _ownerUin);
/**
* 判断参数 OwnerUin 是否已赋值
* @return OwnerUin 是否已赋值
*/
bool OwnerUinHasBeenSet() const;
/**
* 获取订单所有者对应 appId
注意:此字段可能返回 null,表示取不到有效值。
* @return AppId 订单所有者对应 appId
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetAppId() const;
/**
* 设置订单所有者对应 appId
注意:此字段可能返回 null,表示取不到有效值。
* @param AppId 订单所有者对应 appId
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetAppId(const std::string& _appId);
/**
* 判断参数 AppId 是否已赋值
* @return AppId 是否已赋值
*/
bool AppIdHasBeenSet() const;
/**
* 获取商品数量
注意:此字段可能返回 null,表示取不到有效值。
* @return GoodsNum 商品数量
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetGoodsNum() const;
/**
* 设置商品数量
注意:此字段可能返回 null,表示取不到有效值。
* @param GoodsNum 商品数量
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetGoodsNum(const std::string& _goodsNum);
/**
* 判断参数 GoodsNum 是否已赋值
* @return GoodsNum 是否已赋值
*/
bool GoodsNumHasBeenSet() const;
/**
* 获取价格详情
注意:此字段可能返回 null,表示取不到有效值。
* @return GoodsPrice 价格详情
注意:此字段可能返回 null,表示取不到有效值。
*/
DealGoodsPriceElem GetGoodsPrice() const;
/**
* 设置价格详情
注意:此字段可能返回 null,表示取不到有效值。
* @param GoodsPrice 价格详情
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetGoodsPrice(const DealGoodsPriceElem& _goodsPrice);
/**
* 判断参数 GoodsPrice 是否已赋值
* @return GoodsPrice 是否已赋值
*/
bool GoodsPriceHasBeenSet() const;
/**
* 获取下单人
注意:此字段可能返回 null,表示取不到有效值。
* @return Creater 下单人
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetCreater() const;
/**
* 设置下单人
注意:此字段可能返回 null,表示取不到有效值。
* @param Creater 下单人
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetCreater(const std::string& _creater);
/**
* 判断参数 Creater 是否已赋值
* @return Creater 是否已赋值
*/
bool CreaterHasBeenSet() const;
/**
* 获取下单时间
注意:此字段可能返回 null,表示取不到有效值。
* @return CreatTime 下单时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetCreatTime() const;
/**
* 设置下单时间
注意:此字段可能返回 null,表示取不到有效值。
* @param CreatTime 下单时间
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetCreatTime(const std::string& _creatTime);
/**
* 判断参数 CreatTime 是否已赋值
* @return CreatTime 是否已赋值
*/
bool CreatTimeHasBeenSet() const;
/**
* 获取支付结束时间
注意:此字段可能返回 null,表示取不到有效值。
* @return PayEndTime 支付结束时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetPayEndTime() const;
/**
* 设置支付结束时间
注意:此字段可能返回 null,表示取不到有效值。
* @param PayEndTime 支付结束时间
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetPayEndTime(const std::string& _payEndTime);
/**
* 判断参数 PayEndTime 是否已赋值
* @return PayEndTime 是否已赋值
*/
bool PayEndTimeHasBeenSet() const;
/**
* 获取扣费流水号
注意:此字段可能返回 null,表示取不到有效值。
* @return BillId 扣费流水号
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetBillId() const;
/**
* 设置扣费流水号
注意:此字段可能返回 null,表示取不到有效值。
* @param BillId 扣费流水号
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetBillId(const std::string& _billId);
/**
* 判断参数 BillId 是否已赋值
* @return BillId 是否已赋值
*/
bool BillIdHasBeenSet() const;
/**
* 获取支付人
注意:此字段可能返回 null,表示取不到有效值。
* @return Payer 支付人
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetPayer() const;
/**
* 设置支付人
注意:此字段可能返回 null,表示取不到有效值。
* @param Payer 支付人
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetPayer(const std::string& _payer);
/**
* 判断参数 Payer 是否已赋值
* @return Payer 是否已赋值
*/
bool PayerHasBeenSet() const;
/**
* 获取订单状态,中文描述
注意:此字段可能返回 null,表示取不到有效值。
* @return DealStatus 订单状态,中文描述
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetDealStatus() const;
/**
* 设置订单状态,中文描述
注意:此字段可能返回 null,表示取不到有效值。
* @param DealStatus 订单状态,中文描述
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetDealStatus(const std::string& _dealStatus);
/**
* 判断参数 DealStatus 是否已赋值
* @return DealStatus 是否已赋值
*/
bool DealStatusHasBeenSet() const;
/**
* 获取订单的状态(1:未支付;2:已支付;3:发货中;4:已发货;5:发货失败;6:已退款;7:已关单;8:订单过期;9:订单已失效;10:产品已失效;11:代付拒绝;12:支付中)
注意:此字段可能返回 null,表示取不到有效值。
* @return Status 订单的状态(1:未支付;2:已支付;3:发货中;4:已发货;5:发货失败;6:已退款;7:已关单;8:订单过期;9:订单已失效;10:产品已失效;11:代付拒绝;12:支付中)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetStatus() const;
/**
* 设置订单的状态(1:未支付;2:已支付;3:发货中;4:已发货;5:发货失败;6:已退款;7:已关单;8:订单过期;9:订单已失效;10:产品已失效;11:代付拒绝;12:支付中)
注意:此字段可能返回 null,表示取不到有效值。
* @param Status 订单的状态(1:未支付;2:已支付;3:发货中;4:已发货;5:发货失败;6:已退款;7:已关单;8:订单过期;9:订单已失效;10:产品已失效;11:代付拒绝;12:支付中)
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetStatus(const std::string& _status);
/**
* 判断参数 Status 是否已赋值
* @return Status 是否已赋值
*/
bool StatusHasBeenSet() const;
/**
* 获取产品名称
注意:此字段可能返回 null,表示取不到有效值。
* @return GoodsName 产品名称
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetGoodsName() const;
/**
* 设置产品名称
注意:此字段可能返回 null,表示取不到有效值。
* @param GoodsName 产品名称
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetGoodsName(const std::string& _goodsName);
/**
* 判断参数 GoodsName 是否已赋值
* @return GoodsName 是否已赋值
*/
bool GoodsNameHasBeenSet() const;
/**
* 获取客户备注
注意:此字段可能返回 null,表示取不到有效值。
* @return ClientRemark 客户备注
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetClientRemark() const;
/**
* 设置客户备注
注意:此字段可能返回 null,表示取不到有效值。
* @param ClientRemark 客户备注
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetClientRemark(const std::string& _clientRemark);
/**
* 判断参数 ClientRemark 是否已赋值
* @return ClientRemark 是否已赋值
*/
bool ClientRemarkHasBeenSet() const;
/**
* 获取订单操作类型,purchase(新购),renew(续费),modify(配置变更)
注意:此字段可能返回 null,表示取不到有效值。
* @return ActionType 订单操作类型,purchase(新购),renew(续费),modify(配置变更)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetActionType() const;
/**
* 设置订单操作类型,purchase(新购),renew(续费),modify(配置变更)
注意:此字段可能返回 null,表示取不到有效值。
* @param ActionType 订单操作类型,purchase(新购),renew(续费),modify(配置变更)
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetActionType(const std::string& _actionType);
/**
* 判断参数 ActionType 是否已赋值
* @return ActionType 是否已赋值
*/
bool ActionTypeHasBeenSet() const;
/**
* 获取代金券抵扣金额,单位分
注意:此字段可能返回 null,表示取不到有效值。
* @return VoucherDecline 代金券抵扣金额,单位分
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetVoucherDecline() const;
/**
* 设置代金券抵扣金额,单位分
注意:此字段可能返回 null,表示取不到有效值。
* @param VoucherDecline 代金券抵扣金额,单位分
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetVoucherDecline(const std::string& _voucherDecline);
/**
* 判断参数 VoucherDecline 是否已赋值
* @return VoucherDecline 是否已赋值
*/
bool VoucherDeclineHasBeenSet() const;
/**
* 获取大订单号
注意:此字段可能返回 null,表示取不到有效值。
* @return BigDealId 大订单号
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetBigDealId() const;
/**
* 设置大订单号
注意:此字段可能返回 null,表示取不到有效值。
* @param BigDealId 大订单号
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetBigDealId(const std::string& _bigDealId);
/**
* 判断参数 BigDealId 是否已赋值
* @return BigDealId 是否已赋值
*/
bool BigDealIdHasBeenSet() const;
/**
* 获取客户类型(new:新拓;old:存量;assign:指派)
注意:此字段可能返回 null,表示取不到有效值。
* @return ClientType 客户类型(new:新拓;old:存量;assign:指派)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetClientType() const;
/**
* 设置客户类型(new:新拓;old:存量;assign:指派)
注意:此字段可能返回 null,表示取不到有效值。
* @param ClientType 客户类型(new:新拓;old:存量;assign:指派)
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetClientType(const std::string& _clientType);
/**
* 判断参数 ClientType 是否已赋值
* @return ClientType 是否已赋值
*/
bool ClientTypeHasBeenSet() const;
/**
* 获取项目类型(self:自拓;repeat:直销;platform:官网合作)
注意:此字段可能返回 null,表示取不到有效值。
* @return ProjectType 项目类型(self:自拓;repeat:直销;platform:官网合作)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetProjectType() const;
/**
* 设置项目类型(self:自拓;repeat:直销;platform:官网合作)
注意:此字段可能返回 null,表示取不到有效值。
* @param ProjectType 项目类型(self:自拓;repeat:直销;platform:官网合作)
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetProjectType(const std::string& _projectType);
/**
* 判断参数 ProjectType 是否已赋值
* @return ProjectType 是否已赋值
*/
bool ProjectTypeHasBeenSet() const;
/**
* 获取业务员账号ID
注意:此字段可能返回 null,表示取不到有效值。
* @return SalesUin 业务员账号ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetSalesUin() const;
/**
* 设置业务员账号ID
注意:此字段可能返回 null,表示取不到有效值。
* @param SalesUin 业务员账号ID
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetSalesUin(const std::string& _salesUin);
/**
* 判断参数 SalesUin 是否已赋值
* @return SalesUin 是否已赋值
*/
bool SalesUinHasBeenSet() const;
/**
* 获取支付方式,0:自付;1:代付
注意:此字段可能返回 null,表示取不到有效值。
* @return PayerMode 支付方式,0:自付;1:代付
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetPayerMode() const;
/**
* 设置支付方式,0:自付;1:代付
注意:此字段可能返回 null,表示取不到有效值。
* @param PayerMode 支付方式,0:自付;1:代付
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetPayerMode(const std::string& _payerMode);
/**
* 判断参数 PayerMode 是否已赋值
* @return PayerMode 是否已赋值
*/
bool PayerModeHasBeenSet() const;
/**
* 获取活动ID
注意:此字段可能返回 null,表示取不到有效值。
* @return ActivityId 活动ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetActivityId() const;
/**
* 设置活动ID
注意:此字段可能返回 null,表示取不到有效值。
* @param ActivityId 活动ID
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetActivityId(const std::string& _activityId);
/**
* 判断参数 ActivityId 是否已赋值
* @return ActivityId 是否已赋值
*/
bool ActivityIdHasBeenSet() const;
/**
* 获取订单过期时间
注意:此字段可能返回 null,表示取不到有效值。
* @return OverdueTime 订单过期时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetOverdueTime() const;
/**
* 设置订单过期时间
注意:此字段可能返回 null,表示取不到有效值。
* @param OverdueTime 订单过期时间
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetOverdueTime(const std::string& _overdueTime);
/**
* 判断参数 OverdueTime 是否已赋值
* @return OverdueTime 是否已赋值
*/
bool OverdueTimeHasBeenSet() const;
/**
* 获取产品详情
注意:此字段可能返回 null,表示取不到有效值。
* @return ProductInfo 产品详情
注意:此字段可能返回 null,表示取不到有效值。
*/
std::vector<ProductInfoElem> GetProductInfo() const;
/**
* 设置产品详情
注意:此字段可能返回 null,表示取不到有效值。
* @param ProductInfo 产品详情
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetProductInfo(const std::vector<ProductInfoElem>& _productInfo);
/**
* 判断参数 ProductInfo 是否已赋值
* @return ProductInfo 是否已赋值
*/
bool ProductInfoHasBeenSet() const;
private:
/**
* 订单自增 ID
*/
std::string m_dealId;
bool m_dealIdHasBeenSet;
/**
* 订单号
*/
std::string m_dealName;
bool m_dealNameHasBeenSet;
/**
* 商品类型 ID
*/
std::string m_goodsCategoryId;
bool m_goodsCategoryIdHasBeenSet;
/**
* 订单所有者
*/
std::string m_ownerUin;
bool m_ownerUinHasBeenSet;
/**
* 订单所有者对应 appId
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_appId;
bool m_appIdHasBeenSet;
/**
* 商品数量
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_goodsNum;
bool m_goodsNumHasBeenSet;
/**
* 价格详情
注意:此字段可能返回 null,表示取不到有效值。
*/
DealGoodsPriceElem m_goodsPrice;
bool m_goodsPriceHasBeenSet;
/**
* 下单人
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_creater;
bool m_createrHasBeenSet;
/**
* 下单时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_creatTime;
bool m_creatTimeHasBeenSet;
/**
* 支付结束时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_payEndTime;
bool m_payEndTimeHasBeenSet;
/**
* 扣费流水号
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_billId;
bool m_billIdHasBeenSet;
/**
* 支付人
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_payer;
bool m_payerHasBeenSet;
/**
* 订单状态,中文描述
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_dealStatus;
bool m_dealStatusHasBeenSet;
/**
* 订单的状态(1:未支付;2:已支付;3:发货中;4:已发货;5:发货失败;6:已退款;7:已关单;8:订单过期;9:订单已失效;10:产品已失效;11:代付拒绝;12:支付中)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_status;
bool m_statusHasBeenSet;
/**
* 产品名称
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_goodsName;
bool m_goodsNameHasBeenSet;
/**
* 客户备注
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_clientRemark;
bool m_clientRemarkHasBeenSet;
/**
* 订单操作类型,purchase(新购),renew(续费),modify(配置变更)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_actionType;
bool m_actionTypeHasBeenSet;
/**
* 代金券抵扣金额,单位分
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_voucherDecline;
bool m_voucherDeclineHasBeenSet;
/**
* 大订单号
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_bigDealId;
bool m_bigDealIdHasBeenSet;
/**
* 客户类型(new:新拓;old:存量;assign:指派)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_clientType;
bool m_clientTypeHasBeenSet;
/**
* 项目类型(self:自拓;repeat:直销;platform:官网合作)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_projectType;
bool m_projectTypeHasBeenSet;
/**
* 业务员账号ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_salesUin;
bool m_salesUinHasBeenSet;
/**
* 支付方式,0:自付;1:代付
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_payerMode;
bool m_payerModeHasBeenSet;
/**
* 活动ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_activityId;
bool m_activityIdHasBeenSet;
/**
* 订单过期时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_overdueTime;
bool m_overdueTimeHasBeenSet;
/**
* 产品详情
注意:此字段可能返回 null,表示取不到有效值。
*/
std::vector<ProductInfoElem> m_productInfo;
bool m_productInfoHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_PARTNERS_V20180321_MODEL_AGENTDEALELEM_H_
| 31.683879 | 126 | 0.417697 | [
"vector",
"model"
] |
e312deee25c3c52beaa6a44907f638c7b93f336c | 2,611 | h | C | NodeActivetick.h | shamahn/node-activetick | 656b8d84745b84fb7e8e5b9df75a6e76eaf78676 | [
"MIT"
] | 1 | 2020-10-04T04:22:08.000Z | 2020-10-04T04:22:08.000Z | NodeActivetick.h | shamahn/node-activetick | 656b8d84745b84fb7e8e5b9df75a6e76eaf78676 | [
"MIT"
] | null | null | null | NodeActivetick.h | shamahn/node-activetick | 656b8d84745b84fb7e8e5b9df75a6e76eaf78676 | [
"MIT"
] | null | null | null | #pragma once
#include <queue>
#include <node.h>
#include <node_object_wrap.h>
#include "Requestor.h"
#include "Session.h"
#include "Streamer.h"
#include "AtJsonParser.h"
#include "AtEnumConverter.h"
#include <ActiveTickServerAPI/ActiveTickServerAPI.h>
#include "import/atfeed-cppsdk/example/Helper.h"
#include "import/libjson/_internal/Source/JSONNode.h"
using namespace v8;
class NodeActivetick : public node::ObjectWrap {
public:
static void Init( Handle<Object> exports );
private:
explicit NodeActivetick();
~NodeActivetick();
static void New( const FunctionCallbackInfo<Value> &args );
static Persistent<Function> constructor;
// -- session --
static void SessionInit( const FunctionCallbackInfo<Value> &args );
static void GetSessionHandle( const FunctionCallbackInfo<Value> &args );
// -- requestor --
static void CloseAllATRequests( const FunctionCallbackInfo<Value> &args );
static void CloseATRequest( const FunctionCallbackInfo<Value> &args );
static void SendATBarHistoryDbRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATLoginRequest( const FunctionCallbackInfo<Value> &args );
static void SendATMarketHolidaysRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATMarketMoversDbRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATMarketMoversStreamRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATQuoteDbRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATQuoteStreamRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATTickHistoryDbRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATSectorListRequest(
const FunctionCallbackInfo<Value> &args );
static void SendATConstituentListRequest(
const FunctionCallbackInfo<Value> &args );
// -- streamer --
static void GetMsg( const FunctionCallbackInfo<Value> &args );
private:
static std::vector<ATSYMBOL> getATSymbols( Isolate* isolate,
AtEnumConverter& converter, Local<Value> symbols );
static char *getChar( Local<Value> value, const char *fallback = "" );
static bool convertString( wchar16_t* dest, const char* src,
uint32_t destcount, size_t max );
JSONNode getInboundMsg();
private:
APISession m_session;
Requestor m_requestor;
Streamer m_streamer;
AtJsonParser m_parser;
std::queue< JSONNode > m_inboundMsgs;
AtEnumConverter m_enumMap;
};
| 34.355263 | 78 | 0.71735 | [
"object",
"vector"
] |
e313482d6f103742f51bfa188abb7c91f8f29d54 | 958 | h | C | HW1/ring_buff.h | tobielf/CSE530-Spring20 | 2c7309fbf28beb5f896797991b3e2de5d109ccd3 | [
"MIT"
] | null | null | null | HW1/ring_buff.h | tobielf/CSE530-Spring20 | 2c7309fbf28beb5f896797991b3e2de5d109ccd3 | [
"MIT"
] | null | null | null | HW1/ring_buff.h | tobielf/CSE530-Spring20 | 2c7309fbf28beb5f896797991b3e2de5d109ccd3 | [
"MIT"
] | null | null | null | /**
* @file ring_buff.h
*/
#ifndef __RING_BUFF_H__
#define __RING_BUFF_H__
typedef struct mp_ring_buff mp_ring_buff_t;
struct mp_ring_buff;
/**
* @brief create a ring buffer object
* @return NULL on failed; otherwise a valid pointer to the object.
*/
mp_ring_buff_t *ring_buff_init(void);
/**
* @brief release a ring buffer object
* @param obj, a valid ring buffer object.
*/
void ring_buff_fini(mp_ring_buff_t *);
/**
* @brief put an element to ring buffer
* @param obj, a valid ring buffer object.
* @param data, a pointer to the data element.
* @return 0, on success; otherwise errno.
*/
int ring_buff_put(mp_ring_buff_t *, void *);
/**
* @brief get an element from ring buffer
* @param obj, a valid ring buffer object.
* @param data, a pointer of pointer to the data element.
* @return 0, on success; otherwise errno.
* @note the caller should free the data after using it.
*/
int ring_buff_get(mp_ring_buff_t *, void **);
#endif | 24.564103 | 67 | 0.715031 | [
"object"
] |
e32a612c12c9468825d94e5958439f68c6d06e0a | 5,211 | c | C | hexagon/ops/src/op_tanh.c | supersat/nnlib | 049585daa66f0aeff134310d81305286e2aacdff | [
"BSD-3-Clause-Clear"
] | 37 | 2018-07-09T09:52:13.000Z | 2022-01-24T23:15:54.000Z | hexagon/ops/src/op_tanh.c | supersat/nnlib | 049585daa66f0aeff134310d81305286e2aacdff | [
"BSD-3-Clause-Clear"
] | 13 | 2018-08-03T02:29:04.000Z | 2020-06-05T22:09:32.000Z | hexagon/ops/src/op_tanh.c | waau/nnlib | 049585daa66f0aeff134310d81305286e2aacdff | [
"BSD-3-Clause-Clear"
] | 11 | 2018-07-13T02:34:05.000Z | 2021-07-22T09:29:12.000Z | /*
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
* disclaimer below) 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 Linux Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
* GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <nn_graph.h>
#include <string.h>
#include <stdio.h>
#include <quantize.h>
#include <math.h>
#if defined(__hexagon__)
#include "hexagon_types.h"
#endif
//#define TEST_PERFORMANCE
// this does (slow, reference) 8-bit quantized tanh and sigmoid functions.
// The two are the same except for changes in input and output scaling.
static int qtanh_execute_ref(struct nn_node *self, struct nn_graph *nn)
{
const struct tensor *in_tensor = self->inputs[0];
const struct tensor *in_min_tensor = self->inputs[1];
const struct tensor *in_max_tensor = self->inputs[2];
struct tensor *out_tensor = self->outputs[0];
struct tensor *out_min_tensor = self->outputs[1];
struct tensor *out_max_tensor = self->outputs[2];
size_t elements = tensor_element_count(in_tensor);
const uint8_t *in_data = in_tensor->data;
uint8_t *out_data = out_tensor->data;
uint32_t i;
float inval,tmpval,outval;
float in_min = tensor_get_float(in_min_tensor,0);
float in_max = tensor_get_float(in_max_tensor,0);
float stepsize = flt_div_255(in_max - in_min);
logmsg(nn,2,"tanh/sigmoid execute. self=%p ",self);
if( tensor_out_prepare_normal_fromshape( out_tensor, &in_tensor->shape, NN_TYPE_QUINT8)!= 0){
return errlog(nn,"out too small");
}
// datapath is:
// tmp = tanh( in[i]*ingain + inoffs );
// out = (tmp + 1.0)*outgain;
// with ingain, inoffs, outgain depending the function we're doing
// and the input range.
//
float ingain = stepsize;
float inoff = in_min;
float outgain;
float out_min, out_max;
int is_sigmoid = (self->node_type == OP_QuantizedSigmoid_8_ref);
if( is_sigmoid){
ingain *= 0.5f;
inoff *= 0.5f;
// we want 0.5*(1+tanh)*255 = (tanh+1)*(255/2)
outgain = 255.0f*0.5f;
out_min = 0.0f;
out_max = 1.0f;
}else{
// range is -1.0 to 1.00787 (128/127) (zero code = 127)
// so scaling is (tanh+1)*(254/2) -- max output code is 254.
out_min = -1.0f;
out_max = 128.0/127.0;
outgain = 127.0f;
}
#ifdef TEST_PERFORMANCE
int start_time, end_time;
start_time = nn_os_get_cycles(nn);
#endif
for (i = 0; i < elements; i++) {
inval = inoff + ingain * in_data[i];
tmpval = tanhf(inval);
outval = (tmpval + 1.0f) * outgain;
out_data[i] = saturate_u8( roundf_i32(outval));
}
#ifdef TEST_PERFORMANCE
end_time = nn_os_get_cycles(nn);
printf("qtanh ref cycles = %d (elements = %d)\n", (end_time-start_time), elements);
#endif
tensor_set_single_float(out_min_tensor,out_min);
tensor_set_single_float(out_max_tensor,out_max);
logmsg(nn,2,"tanh/sigmoid %p done",self);
return 0;
}
/*
static int qtanh_check(struct nn_node *self, struct nn_graph *nn)
{
logmsg(nn,2,"Checking tanh/sigmoid node %p",self);
if (self->n_inputs != 3) return errlog(nn,"wrong # inputs");
if (self->n_outputs != 3) return errlog(nn,"wrong # outputs");
logmsg(nn,2,"tanh/sigmoid node %p check OK",self);
return 0;
}*/
struct nn_node_ops nn_ops_for_QuantizedTanh_8_ref = {
.execute = qtanh_execute_ref,
.check = NULL,// qtanh_check,
.ctor = node_alloc_common,
.dtor = node_free_common,
.n_inputs = NN_IOCOUNT(3),
.n_outputs = NN_IOCOUNT(3),
};
struct nn_node_ops nn_ops_for_QuantizedSigmoid_8_ref = {
.execute = qtanh_execute_ref,
.check = NULL,// qtanh_check,
.ctor = node_alloc_common,
.dtor = node_free_common,
.n_inputs = NN_IOCOUNT(3),
.n_outputs = NN_IOCOUNT(3),
};
// NOTE: the 'flat' QuantizedTanh_8 and QuantizedSigmoid_8 are done with hvx ops in op_tanh_d32.c
//
| 34.058824 | 97 | 0.720975 | [
"shape"
] |
e33008fe887f461cfbd9c6048b0a5d94d8edd425 | 2,862 | c | C | ALP-listings/chapter-4/job-queue3.c | bleandro/OS2 | 42a1c19635dbb290149c8983d15ad9d390ef846e | [
"MIT"
] | null | null | null | ALP-listings/chapter-4/job-queue3.c | bleandro/OS2 | 42a1c19635dbb290149c8983d15ad9d390ef846e | [
"MIT"
] | 2 | 2019-05-05T12:07:32.000Z | 2020-04-19T07:54:51.000Z | ALP-listings/chapter-4/job-queue3.c | bleandro/OS2 | 42a1c19635dbb290149c8983d15ad9d390ef846e | [
"MIT"
] | null | null | null | /***********************************************************************
* Code listing from "Advanced Linux Programming," by CodeSourcery LLC *
* Copyright (C) 2001 by New Riders Publishing *
* See COPYRIGHT for license information. *
***********************************************************************/
#include <malloc.h>
#include <pthread.h>
#include <semaphore.h>
struct job {
/* Link field for linked list. */
struct job* next;
/* Other fields describing work to be done... */
};
/* A linked list of pending jobs. */
struct job* job_queue;
extern void process_job (struct job*);
/* A mutex protecting job_queue. */
pthread_mutex_t job_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
/* A semaphore counting the number of jobs in the queue. */
sem_t job_queue_count;
/* Perform one-time initialization of the job queue. */
void initialize_job_queue ()
{
/* The queue is initially empty. */
job_queue = NULL;
/* Initialize the semaphore which counts jobs in the queue. Its
initial value should be zero. */
sem_init (&job_queue_count, 0, 0);
}
/* Process queued jobs until the queue is empty. */
void* thread_function (void* arg)
{
while (1) {
struct job* next_job;
/* Wait on the job queue semaphore. If its value is positive,
indicating that the queue is not empty, decrement the count by
one. If the queue is empty, block until a new job is enqueued. */
sem_wait (&job_queue_count);
/* Lock the mutex on the job queue. */
pthread_mutex_lock (&job_queue_mutex);
/* Because of the semaphore, we know the queue is not empty. Get
the next available job. */
next_job = job_queue;
/* Remove this job from the list. */
job_queue = job_queue->next;
/* Unlock the mutex on the job queue, since we're done with the
queue for now. */
pthread_mutex_unlock (&job_queue_mutex);
/* Carry out the work. */
process_job (next_job);
/* Clean up. */
free (next_job);
}
return NULL;
}
/* Add a new job to the front of the job queue. */
void enqueue_job (/* Pass job-specific data here... */)
{
struct job* new_job;
/* Allocate a new job object. */
new_job = (struct job*) malloc (sizeof (struct job));
/* Set the other fields of the job struct here... */
/* Lock the mutex on the job queue before accessing it. */
pthread_mutex_lock (&job_queue_mutex);
/* Place the new job at the head of the queue. */
new_job->next = job_queue;
job_queue = new_job;
/* Post to the semaphore to indicate another job is available. If
threads are blocked, waiting on the semaphore, one will become
unblocked so it can process the job. */
sem_post (&job_queue_count);
/* Unlock the job queue mutex. */
pthread_mutex_unlock (&job_queue_mutex);
}
| 30.126316 | 74 | 0.627184 | [
"object"
] |
e335541727f9bad9130859678b21693f7e25e067 | 80,980 | c | C | dir600b_v2.03/kernels/rt305x/fs/ocfs2/dlmglue.c | ghsecuritylab/DIR600B2 | 78510ce13e037c430c84b4cdc7f49939481fe894 | [
"BSD-2-Clause"
] | 1 | 2019-07-21T01:58:19.000Z | 2019-07-21T01:58:19.000Z | dir600b_v2.03/kernels/rt305x/fs/ocfs2/dlmglue.c | ghsecuritylab/DIR600B2 | 78510ce13e037c430c84b4cdc7f49939481fe894 | [
"BSD-2-Clause"
] | null | null | null | dir600b_v2.03/kernels/rt305x/fs/ocfs2/dlmglue.c | ghsecuritylab/DIR600B2 | 78510ce13e037c430c84b4cdc7f49939481fe894 | [
"BSD-2-Clause"
] | 3 | 2016-06-13T13:20:56.000Z | 2019-12-05T02:31:23.000Z | /* -*- mode: c; c-basic-offset: 8; -*-
* vim: noexpandtab sw=8 ts=8 sts=0:
*
* dlmglue.c
*
* Code which implements an OCFS2 specific interface to our DLM.
*
* Copyright (C) 2003, 2004 Oracle. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 021110-1307, USA.
*/
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/highmem.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/crc32.h>
#include <linux/kthread.h>
#include <linux/pagemap.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <cluster/heartbeat.h>
#include <cluster/nodemanager.h>
#include <cluster/tcp.h>
#include <dlm/dlmapi.h>
#define MLOG_MASK_PREFIX ML_DLM_GLUE
#include <cluster/masklog.h>
#include "ocfs2.h"
#include "alloc.h"
#include "dcache.h"
#include "dlmglue.h"
#include "extent_map.h"
#include "file.h"
#include "heartbeat.h"
#include "inode.h"
#include "journal.h"
#include "slot_map.h"
#include "super.h"
#include "uptodate.h"
#include "vote.h"
#include "buffer_head_io.h"
struct ocfs2_mask_waiter {
struct list_head mw_item;
int mw_status;
struct completion mw_complete;
unsigned long mw_mask;
unsigned long mw_goal;
};
static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres);
static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres);
/*
* Return value from ->downconvert_worker functions.
*
* These control the precise actions of ocfs2_unblock_lock()
* and ocfs2_process_blocked_lock()
*
*/
enum ocfs2_unblock_action {
UNBLOCK_CONTINUE = 0, /* Continue downconvert */
UNBLOCK_CONTINUE_POST = 1, /* Continue downconvert, fire
* ->post_unlock callback */
UNBLOCK_STOP_POST = 2, /* Do not downconvert, fire
* ->post_unlock() callback. */
};
struct ocfs2_unblock_ctl {
int requeue;
enum ocfs2_unblock_action unblock_action;
};
static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
int new_level);
static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres);
static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
int blocking);
static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
int blocking);
static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);
/*
* OCFS2 Lock Resource Operations
*
* These fine tune the behavior of the generic dlmglue locking infrastructure.
*
* The most basic of lock types can point ->l_priv to their respective
* struct ocfs2_super and allow the default actions to manage things.
*
* Right now, each lock type also needs to implement an init function,
* and trivial lock/unlock wrappers. ocfs2_simple_drop_lockres()
* should be called when the lock is no longer needed (i.e., object
* destruction time).
*/
struct ocfs2_lock_res_ops {
/*
* Translate an ocfs2_lock_res * into an ocfs2_super *. Define
* this callback if ->l_priv is not an ocfs2_super pointer
*/
struct ocfs2_super * (*get_osb)(struct ocfs2_lock_res *);
/*
* Optionally called in the downconvert (or "vote") thread
* after a successful downconvert. The lockres will not be
* referenced after this callback is called, so it is safe to
* free memory, etc.
*
* The exact semantics of when this is called are controlled
* by ->downconvert_worker()
*/
void (*post_unlock)(struct ocfs2_super *, struct ocfs2_lock_res *);
/*
* Allow a lock type to add checks to determine whether it is
* safe to downconvert a lock. Return 0 to re-queue the
* downconvert at a later time, nonzero to continue.
*
* For most locks, the default checks that there are no
* incompatible holders are sufficient.
*
* Called with the lockres spinlock held.
*/
int (*check_downconvert)(struct ocfs2_lock_res *, int);
/*
* Allows a lock type to populate the lock value block. This
* is called on downconvert, and when we drop a lock.
*
* Locks that want to use this should set LOCK_TYPE_USES_LVB
* in the flags field.
*
* Called with the lockres spinlock held.
*/
void (*set_lvb)(struct ocfs2_lock_res *);
/*
* Called from the downconvert thread when it is determined
* that a lock will be downconverted. This is called without
* any locks held so the function can do work that might
* schedule (syncing out data, etc).
*
* This should return any one of the ocfs2_unblock_action
* values, depending on what it wants the thread to do.
*/
int (*downconvert_worker)(struct ocfs2_lock_res *, int);
/*
* LOCK_TYPE_* flags which describe the specific requirements
* of a lock type. Descriptions of each individual flag follow.
*/
int flags;
};
/*
* Some locks want to "refresh" potentially stale data when a
* meaningful (PRMODE or EXMODE) lock level is first obtained. If this
* flag is set, the OCFS2_LOCK_NEEDS_REFRESH flag will be set on the
* individual lockres l_flags member from the ast function. It is
* expected that the locking wrapper will clear the
* OCFS2_LOCK_NEEDS_REFRESH flag when done.
*/
#define LOCK_TYPE_REQUIRES_REFRESH 0x1
/*
* Indicate that a lock type makes use of the lock value block. The
* ->set_lvb lock type callback must be defined.
*/
#define LOCK_TYPE_USES_LVB 0x2
static struct ocfs2_lock_res_ops ocfs2_inode_rw_lops = {
.get_osb = ocfs2_get_inode_osb,
.flags = 0,
};
static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = {
.get_osb = ocfs2_get_inode_osb,
.check_downconvert = ocfs2_check_meta_downconvert,
.set_lvb = ocfs2_set_meta_lvb,
.flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB,
};
static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = {
.get_osb = ocfs2_get_inode_osb,
.downconvert_worker = ocfs2_data_convert_worker,
.flags = 0,
};
static struct ocfs2_lock_res_ops ocfs2_super_lops = {
.flags = LOCK_TYPE_REQUIRES_REFRESH,
};
static struct ocfs2_lock_res_ops ocfs2_rename_lops = {
.flags = 0,
};
static struct ocfs2_lock_res_ops ocfs2_dentry_lops = {
.get_osb = ocfs2_get_dentry_osb,
.post_unlock = ocfs2_dentry_post_unlock,
.downconvert_worker = ocfs2_dentry_convert_worker,
.flags = 0,
};
static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
{
return lockres->l_type == OCFS2_LOCK_TYPE_META ||
lockres->l_type == OCFS2_LOCK_TYPE_DATA ||
lockres->l_type == OCFS2_LOCK_TYPE_RW;
}
static inline struct inode *ocfs2_lock_res_inode(struct ocfs2_lock_res *lockres)
{
BUG_ON(!ocfs2_is_inode_lock(lockres));
return (struct inode *) lockres->l_priv;
}
static inline struct ocfs2_dentry_lock *ocfs2_lock_res_dl(struct ocfs2_lock_res *lockres)
{
BUG_ON(lockres->l_type != OCFS2_LOCK_TYPE_DENTRY);
return (struct ocfs2_dentry_lock *)lockres->l_priv;
}
static inline struct ocfs2_super *ocfs2_get_lockres_osb(struct ocfs2_lock_res *lockres)
{
if (lockres->l_ops->get_osb)
return lockres->l_ops->get_osb(lockres);
return (struct ocfs2_super *)lockres->l_priv;
}
static int ocfs2_lock_create(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level,
int dlm_flags);
static inline int ocfs2_may_continue_on_blocked_lock(struct ocfs2_lock_res *lockres,
int wanted);
static void ocfs2_cluster_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level);
static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res *lockres);
static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lockres);
static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *lockres);
static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, int level);
static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);
static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
int convert);
#define ocfs2_log_dlm_error(_func, _stat, _lockres) do { \
mlog(ML_ERROR, "Dlm error \"%s\" while calling %s on " \
"resource %s: %s\n", dlm_errname(_stat), _func, \
_lockres->l_name, dlm_errmsg(_stat)); \
} while (0)
static void ocfs2_vote_on_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres);
static int ocfs2_meta_lock_update(struct inode *inode,
struct buffer_head **bh);
static void ocfs2_drop_osb_locks(struct ocfs2_super *osb);
static inline int ocfs2_highest_compat_lock_level(int level);
static void ocfs2_build_lock_name(enum ocfs2_lock_type type,
u64 blkno,
u32 generation,
char *name)
{
int len;
mlog_entry_void();
BUG_ON(type >= OCFS2_NUM_LOCK_TYPES);
len = snprintf(name, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016llx%08x",
ocfs2_lock_type_char(type), OCFS2_LOCK_ID_PAD,
(long long)blkno, generation);
BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1));
mlog(0, "built lock resource with name: %s\n", name);
mlog_exit_void();
}
static DEFINE_SPINLOCK(ocfs2_dlm_tracking_lock);
static void ocfs2_add_lockres_tracking(struct ocfs2_lock_res *res,
struct ocfs2_dlm_debug *dlm_debug)
{
mlog(0, "Add tracking for lockres %s\n", res->l_name);
spin_lock(&ocfs2_dlm_tracking_lock);
list_add(&res->l_debug_list, &dlm_debug->d_lockres_tracking);
spin_unlock(&ocfs2_dlm_tracking_lock);
}
static void ocfs2_remove_lockres_tracking(struct ocfs2_lock_res *res)
{
spin_lock(&ocfs2_dlm_tracking_lock);
if (!list_empty(&res->l_debug_list))
list_del_init(&res->l_debug_list);
spin_unlock(&ocfs2_dlm_tracking_lock);
}
static void ocfs2_lock_res_init_common(struct ocfs2_super *osb,
struct ocfs2_lock_res *res,
enum ocfs2_lock_type type,
struct ocfs2_lock_res_ops *ops,
void *priv)
{
res->l_type = type;
res->l_ops = ops;
res->l_priv = priv;
res->l_level = LKM_IVMODE;
res->l_requested = LKM_IVMODE;
res->l_blocking = LKM_IVMODE;
res->l_action = OCFS2_AST_INVALID;
res->l_unlock_action = OCFS2_UNLOCK_INVALID;
res->l_flags = OCFS2_LOCK_INITIALIZED;
ocfs2_add_lockres_tracking(res, osb->osb_dlm_debug);
}
void ocfs2_lock_res_init_once(struct ocfs2_lock_res *res)
{
/* This also clears out the lock status block */
memset(res, 0, sizeof(struct ocfs2_lock_res));
spin_lock_init(&res->l_lock);
init_waitqueue_head(&res->l_event);
INIT_LIST_HEAD(&res->l_blocked_list);
INIT_LIST_HEAD(&res->l_mask_waiters);
}
void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res,
enum ocfs2_lock_type type,
unsigned int generation,
struct inode *inode)
{
struct ocfs2_lock_res_ops *ops;
switch(type) {
case OCFS2_LOCK_TYPE_RW:
ops = &ocfs2_inode_rw_lops;
break;
case OCFS2_LOCK_TYPE_META:
ops = &ocfs2_inode_meta_lops;
break;
case OCFS2_LOCK_TYPE_DATA:
ops = &ocfs2_inode_data_lops;
break;
default:
mlog_bug_on_msg(1, "type: %d\n", type);
ops = NULL; /* thanks, gcc */
break;
};
ocfs2_build_lock_name(type, OCFS2_I(inode)->ip_blkno,
generation, res->l_name);
ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), res, type, ops, inode);
}
static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres)
{
struct inode *inode = ocfs2_lock_res_inode(lockres);
return OCFS2_SB(inode->i_sb);
}
static __u64 ocfs2_get_dentry_lock_ino(struct ocfs2_lock_res *lockres)
{
__be64 inode_blkno_be;
memcpy(&inode_blkno_be, &lockres->l_name[OCFS2_DENTRY_LOCK_INO_START],
sizeof(__be64));
return be64_to_cpu(inode_blkno_be);
}
static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres)
{
struct ocfs2_dentry_lock *dl = lockres->l_priv;
return OCFS2_SB(dl->dl_inode->i_sb);
}
void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
u64 parent, struct inode *inode)
{
int len;
u64 inode_blkno = OCFS2_I(inode)->ip_blkno;
__be64 inode_blkno_be = cpu_to_be64(inode_blkno);
struct ocfs2_lock_res *lockres = &dl->dl_lockres;
ocfs2_lock_res_init_once(lockres);
/*
* Unfortunately, the standard lock naming scheme won't work
* here because we have two 16 byte values to use. Instead,
* we'll stuff the inode number as a binary value. We still
* want error prints to show something without garbling the
* display, so drop a null byte in there before the inode
* number. A future version of OCFS2 will likely use all
* binary lock names. The stringified names have been a
* tremendous aid in debugging, but now that the debugfs
* interface exists, we can mangle things there if need be.
*
* NOTE: We also drop the standard "pad" value (the total lock
* name size stays the same though - the last part is all
* zeros due to the memset in ocfs2_lock_res_init_once()
*/
len = snprintf(lockres->l_name, OCFS2_DENTRY_LOCK_INO_START,
"%c%016llx",
ocfs2_lock_type_char(OCFS2_LOCK_TYPE_DENTRY),
(long long)parent);
BUG_ON(len != (OCFS2_DENTRY_LOCK_INO_START - 1));
memcpy(&lockres->l_name[OCFS2_DENTRY_LOCK_INO_START], &inode_blkno_be,
sizeof(__be64));
ocfs2_lock_res_init_common(OCFS2_SB(inode->i_sb), lockres,
OCFS2_LOCK_TYPE_DENTRY, &ocfs2_dentry_lops,
dl);
}
static void ocfs2_super_lock_res_init(struct ocfs2_lock_res *res,
struct ocfs2_super *osb)
{
/* Superblock lockres doesn't come from a slab so we call init
* once on it manually. */
ocfs2_lock_res_init_once(res);
ocfs2_build_lock_name(OCFS2_LOCK_TYPE_SUPER, OCFS2_SUPER_BLOCK_BLKNO,
0, res->l_name);
ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_SUPER,
&ocfs2_super_lops, osb);
}
static void ocfs2_rename_lock_res_init(struct ocfs2_lock_res *res,
struct ocfs2_super *osb)
{
/* Rename lockres doesn't come from a slab so we call init
* once on it manually. */
ocfs2_lock_res_init_once(res);
ocfs2_build_lock_name(OCFS2_LOCK_TYPE_RENAME, 0, 0, res->l_name);
ocfs2_lock_res_init_common(osb, res, OCFS2_LOCK_TYPE_RENAME,
&ocfs2_rename_lops, osb);
}
void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
{
mlog_entry_void();
if (!(res->l_flags & OCFS2_LOCK_INITIALIZED))
return;
ocfs2_remove_lockres_tracking(res);
mlog_bug_on_msg(!list_empty(&res->l_blocked_list),
"Lockres %s is on the blocked list\n",
res->l_name);
mlog_bug_on_msg(!list_empty(&res->l_mask_waiters),
"Lockres %s has mask waiters pending\n",
res->l_name);
mlog_bug_on_msg(spin_is_locked(&res->l_lock),
"Lockres %s is locked\n",
res->l_name);
mlog_bug_on_msg(res->l_ro_holders,
"Lockres %s has %u ro holders\n",
res->l_name, res->l_ro_holders);
mlog_bug_on_msg(res->l_ex_holders,
"Lockres %s has %u ex holders\n",
res->l_name, res->l_ex_holders);
/* Need to clear out the lock status block for the dlm */
memset(&res->l_lksb, 0, sizeof(res->l_lksb));
res->l_flags = 0UL;
mlog_exit_void();
}
static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres,
int level)
{
mlog_entry_void();
BUG_ON(!lockres);
switch(level) {
case LKM_EXMODE:
lockres->l_ex_holders++;
break;
case LKM_PRMODE:
lockres->l_ro_holders++;
break;
default:
BUG();
}
mlog_exit_void();
}
static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres,
int level)
{
mlog_entry_void();
BUG_ON(!lockres);
switch(level) {
case LKM_EXMODE:
BUG_ON(!lockres->l_ex_holders);
lockres->l_ex_holders--;
break;
case LKM_PRMODE:
BUG_ON(!lockres->l_ro_holders);
lockres->l_ro_holders--;
break;
default:
BUG();
}
mlog_exit_void();
}
/* WARNING: This function lives in a world where the only three lock
* levels are EX, PR, and NL. It *will* have to be adjusted when more
* lock types are added. */
static inline int ocfs2_highest_compat_lock_level(int level)
{
int new_level = LKM_EXMODE;
if (level == LKM_EXMODE)
new_level = LKM_NLMODE;
else if (level == LKM_PRMODE)
new_level = LKM_PRMODE;
return new_level;
}
static void lockres_set_flags(struct ocfs2_lock_res *lockres,
unsigned long newflags)
{
struct list_head *pos, *tmp;
struct ocfs2_mask_waiter *mw;
assert_spin_locked(&lockres->l_lock);
lockres->l_flags = newflags;
list_for_each_safe(pos, tmp, &lockres->l_mask_waiters) {
mw = list_entry(pos, struct ocfs2_mask_waiter, mw_item);
if ((lockres->l_flags & mw->mw_mask) != mw->mw_goal)
continue;
list_del_init(&mw->mw_item);
mw->mw_status = 0;
complete(&mw->mw_complete);
}
}
static void lockres_or_flags(struct ocfs2_lock_res *lockres, unsigned long or)
{
lockres_set_flags(lockres, lockres->l_flags | or);
}
static void lockres_clear_flags(struct ocfs2_lock_res *lockres,
unsigned long clear)
{
lockres_set_flags(lockres, lockres->l_flags & ~clear);
}
static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res *lockres)
{
mlog_entry_void();
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY));
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED));
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED));
BUG_ON(lockres->l_blocking <= LKM_NLMODE);
lockres->l_level = lockres->l_requested;
if (lockres->l_level <=
ocfs2_highest_compat_lock_level(lockres->l_blocking)) {
lockres->l_blocking = LKM_NLMODE;
lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED);
}
lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
mlog_exit_void();
}
static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lockres)
{
mlog_entry_void();
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY));
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED));
/* Convert from RO to EX doesn't really need anything as our
* information is already up to data. Convert from NL to
* *anything* however should mark ourselves as needing an
* update */
if (lockres->l_level == LKM_NLMODE &&
lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH)
lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH);
lockres->l_level = lockres->l_requested;
lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
mlog_exit_void();
}
static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *lockres)
{
mlog_entry_void();
BUG_ON((!lockres->l_flags & OCFS2_LOCK_BUSY));
BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED);
if (lockres->l_requested > LKM_NLMODE &&
!(lockres->l_flags & OCFS2_LOCK_LOCAL) &&
lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH)
lockres_or_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH);
lockres->l_level = lockres->l_requested;
lockres_or_flags(lockres, OCFS2_LOCK_ATTACHED);
lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
mlog_exit_void();
}
static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres,
int level)
{
int needs_downconvert = 0;
mlog_entry_void();
assert_spin_locked(&lockres->l_lock);
lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED);
if (level > lockres->l_blocking) {
/* only schedule a downconvert if we haven't already scheduled
* one that goes low enough to satisfy the level we're
* blocking. this also catches the case where we get
* duplicate BASTs */
if (ocfs2_highest_compat_lock_level(level) <
ocfs2_highest_compat_lock_level(lockres->l_blocking))
needs_downconvert = 1;
lockres->l_blocking = level;
}
mlog_exit(needs_downconvert);
return needs_downconvert;
}
static void ocfs2_blocking_ast(void *opaque, int level)
{
struct ocfs2_lock_res *lockres = opaque;
struct ocfs2_super *osb = ocfs2_get_lockres_osb(lockres);
int needs_downconvert;
unsigned long flags;
BUG_ON(level <= LKM_NLMODE);
mlog(0, "BAST fired for lockres %s, blocking %d, level %d type %s\n",
lockres->l_name, level, lockres->l_level,
ocfs2_lock_type_string(lockres->l_type));
spin_lock_irqsave(&lockres->l_lock, flags);
needs_downconvert = ocfs2_generic_handle_bast(lockres, level);
if (needs_downconvert)
ocfs2_schedule_blocked_lock(osb, lockres);
spin_unlock_irqrestore(&lockres->l_lock, flags);
wake_up(&lockres->l_event);
ocfs2_kick_vote_thread(osb);
}
static void ocfs2_locking_ast(void *opaque)
{
struct ocfs2_lock_res *lockres = opaque;
struct dlm_lockstatus *lksb = &lockres->l_lksb;
unsigned long flags;
spin_lock_irqsave(&lockres->l_lock, flags);
if (lksb->status != DLM_NORMAL) {
mlog(ML_ERROR, "lockres %s: lksb status value of %u!\n",
lockres->l_name, lksb->status);
spin_unlock_irqrestore(&lockres->l_lock, flags);
return;
}
switch(lockres->l_action) {
case OCFS2_AST_ATTACH:
ocfs2_generic_handle_attach_action(lockres);
lockres_clear_flags(lockres, OCFS2_LOCK_LOCAL);
break;
case OCFS2_AST_CONVERT:
ocfs2_generic_handle_convert_action(lockres);
break;
case OCFS2_AST_DOWNCONVERT:
ocfs2_generic_handle_downconvert_action(lockres);
break;
default:
mlog(ML_ERROR, "lockres %s: ast fired with invalid action: %u "
"lockres flags = 0x%lx, unlock action: %u\n",
lockres->l_name, lockres->l_action, lockres->l_flags,
lockres->l_unlock_action);
BUG();
}
/* set it to something invalid so if we get called again we
* can catch it. */
lockres->l_action = OCFS2_AST_INVALID;
wake_up(&lockres->l_event);
spin_unlock_irqrestore(&lockres->l_lock, flags);
}
static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres,
int convert)
{
unsigned long flags;
mlog_entry_void();
spin_lock_irqsave(&lockres->l_lock, flags);
lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
if (convert)
lockres->l_action = OCFS2_AST_INVALID;
else
lockres->l_unlock_action = OCFS2_UNLOCK_INVALID;
spin_unlock_irqrestore(&lockres->l_lock, flags);
wake_up(&lockres->l_event);
mlog_exit_void();
}
/* Note: If we detect another process working on the lock (i.e.,
* OCFS2_LOCK_BUSY), we'll bail out returning 0. It's up to the caller
* to do the right thing in that case.
*/
static int ocfs2_lock_create(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level,
int dlm_flags)
{
int ret = 0;
enum dlm_status status = DLM_NORMAL;
unsigned long flags;
mlog_entry_void();
mlog(0, "lock %s, level = %d, flags = %d\n", lockres->l_name, level,
dlm_flags);
spin_lock_irqsave(&lockres->l_lock, flags);
if ((lockres->l_flags & OCFS2_LOCK_ATTACHED) ||
(lockres->l_flags & OCFS2_LOCK_BUSY)) {
spin_unlock_irqrestore(&lockres->l_lock, flags);
goto bail;
}
lockres->l_action = OCFS2_AST_ATTACH;
lockres->l_requested = level;
lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
spin_unlock_irqrestore(&lockres->l_lock, flags);
status = dlmlock(osb->dlm,
level,
&lockres->l_lksb,
dlm_flags,
lockres->l_name,
OCFS2_LOCK_ID_MAX_LEN - 1,
ocfs2_locking_ast,
lockres,
ocfs2_blocking_ast);
if (status != DLM_NORMAL) {
ocfs2_log_dlm_error("dlmlock", status, lockres);
ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 1);
}
mlog(0, "lock %s, successfull return from dlmlock\n", lockres->l_name);
bail:
mlog_exit(ret);
return ret;
}
static inline int ocfs2_check_wait_flag(struct ocfs2_lock_res *lockres,
int flag)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&lockres->l_lock, flags);
ret = lockres->l_flags & flag;
spin_unlock_irqrestore(&lockres->l_lock, flags);
return ret;
}
static inline void ocfs2_wait_on_busy_lock(struct ocfs2_lock_res *lockres)
{
wait_event(lockres->l_event,
!ocfs2_check_wait_flag(lockres, OCFS2_LOCK_BUSY));
}
static inline void ocfs2_wait_on_refreshing_lock(struct ocfs2_lock_res *lockres)
{
wait_event(lockres->l_event,
!ocfs2_check_wait_flag(lockres, OCFS2_LOCK_REFRESHING));
}
/* predict what lock level we'll be dropping down to on behalf
* of another node, and return true if the currently wanted
* level will be compatible with it. */
static inline int ocfs2_may_continue_on_blocked_lock(struct ocfs2_lock_res *lockres,
int wanted)
{
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED));
return wanted <= ocfs2_highest_compat_lock_level(lockres->l_blocking);
}
static void ocfs2_init_mask_waiter(struct ocfs2_mask_waiter *mw)
{
INIT_LIST_HEAD(&mw->mw_item);
init_completion(&mw->mw_complete);
}
static int ocfs2_wait_for_mask(struct ocfs2_mask_waiter *mw)
{
wait_for_completion(&mw->mw_complete);
/* Re-arm the completion in case we want to wait on it again */
INIT_COMPLETION(mw->mw_complete);
return mw->mw_status;
}
static void lockres_add_mask_waiter(struct ocfs2_lock_res *lockres,
struct ocfs2_mask_waiter *mw,
unsigned long mask,
unsigned long goal)
{
BUG_ON(!list_empty(&mw->mw_item));
assert_spin_locked(&lockres->l_lock);
list_add_tail(&mw->mw_item, &lockres->l_mask_waiters);
mw->mw_mask = mask;
mw->mw_goal = goal;
}
/* returns 0 if the mw that was removed was already satisfied, -EBUSY
* if the mask still hadn't reached its goal */
static int lockres_remove_mask_waiter(struct ocfs2_lock_res *lockres,
struct ocfs2_mask_waiter *mw)
{
unsigned long flags;
int ret = 0;
spin_lock_irqsave(&lockres->l_lock, flags);
if (!list_empty(&mw->mw_item)) {
if ((lockres->l_flags & mw->mw_mask) != mw->mw_goal)
ret = -EBUSY;
list_del_init(&mw->mw_item);
init_completion(&mw->mw_complete);
}
spin_unlock_irqrestore(&lockres->l_lock, flags);
return ret;
}
static int ocfs2_cluster_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level,
int lkm_flags,
int arg_flags)
{
struct ocfs2_mask_waiter mw;
enum dlm_status status;
int wait, catch_signals = !(osb->s_mount_opt & OCFS2_MOUNT_NOINTR);
int ret = 0; /* gcc doesn't realize wait = 1 guarantees ret is set */
unsigned long flags;
mlog_entry_void();
ocfs2_init_mask_waiter(&mw);
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
lkm_flags |= LKM_VALBLK;
again:
wait = 0;
if (catch_signals && signal_pending(current)) {
ret = -ERESTARTSYS;
goto out;
}
spin_lock_irqsave(&lockres->l_lock, flags);
mlog_bug_on_msg(lockres->l_flags & OCFS2_LOCK_FREEING,
"Cluster lock called on freeing lockres %s! flags "
"0x%lx\n", lockres->l_name, lockres->l_flags);
/* We only compare against the currently granted level
* here. If the lock is blocked waiting on a downconvert,
* we'll get caught below. */
if (lockres->l_flags & OCFS2_LOCK_BUSY &&
level > lockres->l_level) {
/* is someone sitting in dlm_lock? If so, wait on
* them. */
lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BUSY, 0);
wait = 1;
goto unlock;
}
if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
/* lock has not been created yet. */
spin_unlock_irqrestore(&lockres->l_lock, flags);
ret = ocfs2_lock_create(osb, lockres, LKM_NLMODE, 0);
if (ret < 0) {
mlog_errno(ret);
goto out;
}
goto again;
}
if (lockres->l_flags & OCFS2_LOCK_BLOCKED &&
!ocfs2_may_continue_on_blocked_lock(lockres, level)) {
/* is the lock is currently blocked on behalf of
* another node */
lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_BLOCKED, 0);
wait = 1;
goto unlock;
}
if (level > lockres->l_level) {
if (lockres->l_action != OCFS2_AST_INVALID)
mlog(ML_ERROR, "lockres %s has action %u pending\n",
lockres->l_name, lockres->l_action);
lockres->l_action = OCFS2_AST_CONVERT;
lockres->l_requested = level;
lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
spin_unlock_irqrestore(&lockres->l_lock, flags);
BUG_ON(level == LKM_IVMODE);
BUG_ON(level == LKM_NLMODE);
mlog(0, "lock %s, convert from %d to level = %d\n",
lockres->l_name, lockres->l_level, level);
/* call dlm_lock to upgrade lock now */
status = dlmlock(osb->dlm,
level,
&lockres->l_lksb,
lkm_flags|LKM_CONVERT,
lockres->l_name,
OCFS2_LOCK_ID_MAX_LEN - 1,
ocfs2_locking_ast,
lockres,
ocfs2_blocking_ast);
if (status != DLM_NORMAL) {
if ((lkm_flags & LKM_NOQUEUE) &&
(status == DLM_NOTQUEUED))
ret = -EAGAIN;
else {
ocfs2_log_dlm_error("dlmlock", status,
lockres);
ret = -EINVAL;
}
ocfs2_recover_from_dlm_error(lockres, 1);
goto out;
}
mlog(0, "lock %s, successfull return from dlmlock\n",
lockres->l_name);
/* At this point we've gone inside the dlm and need to
* complete our work regardless. */
catch_signals = 0;
/* wait for busy to clear and carry on */
goto again;
}
/* Ok, if we get here then we're good to go. */
ocfs2_inc_holders(lockres, level);
ret = 0;
unlock:
spin_unlock_irqrestore(&lockres->l_lock, flags);
out:
/*
* This is helping work around a lock inversion between the page lock
* and dlm locks. One path holds the page lock while calling aops
* which block acquiring dlm locks. The voting thread holds dlm
* locks while acquiring page locks while down converting data locks.
* This block is helping an aop path notice the inversion and back
* off to unlock its page lock before trying the dlm lock again.
*/
if (wait && arg_flags & OCFS2_LOCK_NONBLOCK &&
mw.mw_mask & (OCFS2_LOCK_BUSY|OCFS2_LOCK_BLOCKED)) {
wait = 0;
if (lockres_remove_mask_waiter(lockres, &mw))
ret = -EAGAIN;
else
goto again;
}
if (wait) {
ret = ocfs2_wait_for_mask(&mw);
if (ret == 0)
goto again;
mlog_errno(ret);
}
mlog_exit(ret);
return ret;
}
static void ocfs2_cluster_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int level)
{
unsigned long flags;
mlog_entry_void();
spin_lock_irqsave(&lockres->l_lock, flags);
ocfs2_dec_holders(lockres, level);
ocfs2_vote_on_unlock(osb, lockres);
spin_unlock_irqrestore(&lockres->l_lock, flags);
mlog_exit_void();
}
static int ocfs2_create_new_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int ex,
int local)
{
int level = ex ? LKM_EXMODE : LKM_PRMODE;
unsigned long flags;
int lkm_flags = local ? LKM_LOCAL : 0;
spin_lock_irqsave(&lockres->l_lock, flags);
BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED);
lockres_or_flags(lockres, OCFS2_LOCK_LOCAL);
spin_unlock_irqrestore(&lockres->l_lock, flags);
return ocfs2_lock_create(osb, lockres, level, lkm_flags);
}
/* Grants us an EX lock on the data and metadata resources, skipping
* the normal cluster directory lookup. Use this ONLY on newly created
* inodes which other nodes can't possibly see, and which haven't been
* hashed in the inode hash yet. This can give us a good performance
* increase as it'll skip the network broadcast normally associated
* with creating a new lock resource. */
int ocfs2_create_new_inode_locks(struct inode *inode)
{
int ret;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
BUG_ON(!inode);
BUG_ON(!ocfs2_inode_is_new(inode));
mlog_entry_void();
mlog(0, "Inode %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno);
/* NOTE: That we don't increment any of the holder counts, nor
* do we add anything to a journal handle. Since this is
* supposed to be a new inode which the cluster doesn't know
* about yet, there is no need to. As far as the LVB handling
* is concerned, this is basically like acquiring an EX lock
* on a resource which has an invalid one -- we'll set it
* valid when we release the EX. */
ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_rw_lockres, 1, 1);
if (ret) {
mlog_errno(ret);
goto bail;
}
/*
* We don't want to use LKM_LOCAL on a meta data lock as they
* don't use a generation in their lock names.
*/
ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_meta_lockres, 1, 0);
if (ret) {
mlog_errno(ret);
goto bail;
}
ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_data_lockres, 1, 1);
if (ret) {
mlog_errno(ret);
goto bail;
}
bail:
mlog_exit(ret);
return ret;
}
int ocfs2_rw_lock(struct inode *inode, int write)
{
int status, level;
struct ocfs2_lock_res *lockres;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
BUG_ON(!inode);
mlog_entry_void();
mlog(0, "inode %llu take %s RW lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
write ? "EXMODE" : "PRMODE");
if (ocfs2_mount_local(osb))
return 0;
lockres = &OCFS2_I(inode)->ip_rw_lockres;
level = write ? LKM_EXMODE : LKM_PRMODE;
status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, 0,
0);
if (status < 0)
mlog_errno(status);
mlog_exit(status);
return status;
}
void ocfs2_rw_unlock(struct inode *inode, int write)
{
int level = write ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
mlog_entry_void();
mlog(0, "inode %llu drop %s RW lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
write ? "EXMODE" : "PRMODE");
if (!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
mlog_exit_void();
}
int ocfs2_data_lock_full(struct inode *inode,
int write,
int arg_flags)
{
int status = 0, level;
struct ocfs2_lock_res *lockres;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
BUG_ON(!inode);
mlog_entry_void();
mlog(0, "inode %llu take %s DATA lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
write ? "EXMODE" : "PRMODE");
/* We'll allow faking a readonly data lock for
* rodevices. */
if (ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) {
if (write) {
status = -EROFS;
mlog_errno(status);
}
goto out;
}
if (ocfs2_mount_local(osb))
goto out;
lockres = &OCFS2_I(inode)->ip_data_lockres;
level = write ? LKM_EXMODE : LKM_PRMODE;
status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level,
0, arg_flags);
if (status < 0 && status != -EAGAIN)
mlog_errno(status);
out:
mlog_exit(status);
return status;
}
/* see ocfs2_meta_lock_with_page() */
int ocfs2_data_lock_with_page(struct inode *inode,
int write,
struct page *page)
{
int ret;
ret = ocfs2_data_lock_full(inode, write, OCFS2_LOCK_NONBLOCK);
if (ret == -EAGAIN) {
unlock_page(page);
if (ocfs2_data_lock(inode, write) == 0)
ocfs2_data_unlock(inode, write);
ret = AOP_TRUNCATED_PAGE;
}
return ret;
}
static void ocfs2_vote_on_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
int kick = 0;
mlog_entry_void();
/* If we know that another node is waiting on our lock, kick
* the vote thread * pre-emptively when we reach a release
* condition. */
if (lockres->l_flags & OCFS2_LOCK_BLOCKED) {
switch(lockres->l_blocking) {
case LKM_EXMODE:
if (!lockres->l_ex_holders && !lockres->l_ro_holders)
kick = 1;
break;
case LKM_PRMODE:
if (!lockres->l_ex_holders)
kick = 1;
break;
default:
BUG();
}
}
if (kick)
ocfs2_kick_vote_thread(osb);
mlog_exit_void();
}
void ocfs2_data_unlock(struct inode *inode,
int write)
{
int level = write ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
mlog_entry_void();
mlog(0, "inode %llu drop %s DATA lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
write ? "EXMODE" : "PRMODE");
if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) &&
!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
mlog_exit_void();
}
#define OCFS2_SEC_BITS 34
#define OCFS2_SEC_SHIFT (64 - 34)
#define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1)
/* LVB only has room for 64 bits of time here so we pack it for
* now. */
static u64 ocfs2_pack_timespec(struct timespec *spec)
{
u64 res;
u64 sec = spec->tv_sec;
u32 nsec = spec->tv_nsec;
res = (sec << OCFS2_SEC_SHIFT) | (nsec & OCFS2_NSEC_MASK);
return res;
}
/* Call this with the lockres locked. I am reasonably sure we don't
* need ip_lock in this function as anyone who would be changing those
* values is supposed to be blocked in ocfs2_meta_lock right now. */
static void __ocfs2_stuff_meta_lvb(struct inode *inode)
{
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_lock_res *lockres = &oi->ip_meta_lockres;
struct ocfs2_meta_lvb *lvb;
mlog_entry_void();
lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
/*
* Invalidate the LVB of a deleted inode - this way other
* nodes are forced to go to disk and discover the new inode
* status.
*/
if (oi->ip_flags & OCFS2_INODE_DELETED) {
lvb->lvb_version = 0;
goto out;
}
lvb->lvb_version = OCFS2_LVB_VERSION;
lvb->lvb_isize = cpu_to_be64(i_size_read(inode));
lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
lvb->lvb_iuid = cpu_to_be32(inode->i_uid);
lvb->lvb_igid = cpu_to_be32(inode->i_gid);
lvb->lvb_imode = cpu_to_be16(inode->i_mode);
lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
lvb->lvb_iatime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_atime));
lvb->lvb_ictime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_ctime));
lvb->lvb_imtime_packed =
cpu_to_be64(ocfs2_pack_timespec(&inode->i_mtime));
lvb->lvb_iattr = cpu_to_be32(oi->ip_attr);
lvb->lvb_igeneration = cpu_to_be32(inode->i_generation);
out:
mlog_meta_lvb(0, lockres);
mlog_exit_void();
}
static void ocfs2_unpack_timespec(struct timespec *spec,
u64 packed_time)
{
spec->tv_sec = packed_time >> OCFS2_SEC_SHIFT;
spec->tv_nsec = packed_time & OCFS2_NSEC_MASK;
}
static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
{
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_lock_res *lockres = &oi->ip_meta_lockres;
struct ocfs2_meta_lvb *lvb;
mlog_entry_void();
mlog_meta_lvb(0, lockres);
lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
/* We're safe here without the lockres lock... */
spin_lock(&oi->ip_lock);
oi->ip_clusters = be32_to_cpu(lvb->lvb_iclusters);
i_size_write(inode, be64_to_cpu(lvb->lvb_isize));
oi->ip_attr = be32_to_cpu(lvb->lvb_iattr);
ocfs2_set_inode_flags(inode);
/* fast-symlinks are a special case */
if (S_ISLNK(inode->i_mode) && !oi->ip_clusters)
inode->i_blocks = 0;
else
inode->i_blocks =
ocfs2_align_bytes_to_sectors(i_size_read(inode));
inode->i_uid = be32_to_cpu(lvb->lvb_iuid);
inode->i_gid = be32_to_cpu(lvb->lvb_igid);
inode->i_mode = be16_to_cpu(lvb->lvb_imode);
inode->i_nlink = be16_to_cpu(lvb->lvb_inlink);
ocfs2_unpack_timespec(&inode->i_atime,
be64_to_cpu(lvb->lvb_iatime_packed));
ocfs2_unpack_timespec(&inode->i_mtime,
be64_to_cpu(lvb->lvb_imtime_packed));
ocfs2_unpack_timespec(&inode->i_ctime,
be64_to_cpu(lvb->lvb_ictime_packed));
spin_unlock(&oi->ip_lock);
mlog_exit_void();
}
static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
struct ocfs2_lock_res *lockres)
{
struct ocfs2_meta_lvb *lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
if (lvb->lvb_version == OCFS2_LVB_VERSION
&& be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
return 1;
return 0;
}
/* Determine whether a lock resource needs to be refreshed, and
* arbitrate who gets to refresh it.
*
* 0 means no refresh needed.
*
* > 0 means you need to refresh this and you MUST call
* ocfs2_complete_lock_res_refresh afterwards. */
static int ocfs2_should_refresh_lock_res(struct ocfs2_lock_res *lockres)
{
unsigned long flags;
int status = 0;
mlog_entry_void();
refresh_check:
spin_lock_irqsave(&lockres->l_lock, flags);
if (!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) {
spin_unlock_irqrestore(&lockres->l_lock, flags);
goto bail;
}
if (lockres->l_flags & OCFS2_LOCK_REFRESHING) {
spin_unlock_irqrestore(&lockres->l_lock, flags);
ocfs2_wait_on_refreshing_lock(lockres);
goto refresh_check;
}
/* Ok, I'll be the one to refresh this lock. */
lockres_or_flags(lockres, OCFS2_LOCK_REFRESHING);
spin_unlock_irqrestore(&lockres->l_lock, flags);
status = 1;
bail:
mlog_exit(status);
return status;
}
/* If status is non zero, I'll mark it as not being in refresh
* anymroe, but i won't clear the needs refresh flag. */
static inline void ocfs2_complete_lock_res_refresh(struct ocfs2_lock_res *lockres,
int status)
{
unsigned long flags;
mlog_entry_void();
spin_lock_irqsave(&lockres->l_lock, flags);
lockres_clear_flags(lockres, OCFS2_LOCK_REFRESHING);
if (!status)
lockres_clear_flags(lockres, OCFS2_LOCK_NEEDS_REFRESH);
spin_unlock_irqrestore(&lockres->l_lock, flags);
wake_up(&lockres->l_event);
mlog_exit_void();
}
/* may or may not return a bh if it went to disk. */
static int ocfs2_meta_lock_update(struct inode *inode,
struct buffer_head **bh)
{
int status = 0;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_lock_res *lockres = NULL;
struct ocfs2_dinode *fe;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
mlog_entry_void();
spin_lock(&oi->ip_lock);
if (oi->ip_flags & OCFS2_INODE_DELETED) {
mlog(0, "Orphaned inode %llu was deleted while we "
"were waiting on a lock. ip_flags = 0x%x\n",
(unsigned long long)oi->ip_blkno, oi->ip_flags);
spin_unlock(&oi->ip_lock);
status = -ENOENT;
goto bail;
}
spin_unlock(&oi->ip_lock);
if (!ocfs2_mount_local(osb)) {
lockres = &oi->ip_meta_lockres;
if (!ocfs2_should_refresh_lock_res(lockres))
goto bail;
}
/* This will discard any caching information we might have had
* for the inode metadata. */
ocfs2_metadata_cache_purge(inode);
/* will do nothing for inode types that don't use the extent
* map (directories, bitmap files, etc) */
ocfs2_extent_map_trunc(inode, 0);
if (lockres && ocfs2_meta_lvb_is_trustable(inode, lockres)) {
mlog(0, "Trusting LVB on inode %llu\n",
(unsigned long long)oi->ip_blkno);
ocfs2_refresh_inode_from_lvb(inode);
} else {
/* Boo, we have to go to disk. */
/* read bh, cast, ocfs2_refresh_inode */
status = ocfs2_read_block(OCFS2_SB(inode->i_sb), oi->ip_blkno,
bh, OCFS2_BH_CACHED, inode);
if (status < 0) {
mlog_errno(status);
goto bail_refresh;
}
fe = (struct ocfs2_dinode *) (*bh)->b_data;
/* This is a good chance to make sure we're not
* locking an invalid object.
*
* We bug on a stale inode here because we checked
* above whether it was wiped from disk. The wiping
* node provides a guarantee that we receive that
* message and can mark the inode before dropping any
* locks associated with it. */
if (!OCFS2_IS_VALID_DINODE(fe)) {
OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
status = -EIO;
goto bail_refresh;
}
mlog_bug_on_msg(inode->i_generation !=
le32_to_cpu(fe->i_generation),
"Invalid dinode %llu disk generation: %u "
"inode->i_generation: %u\n",
(unsigned long long)oi->ip_blkno,
le32_to_cpu(fe->i_generation),
inode->i_generation);
mlog_bug_on_msg(le64_to_cpu(fe->i_dtime) ||
!(fe->i_flags & cpu_to_le32(OCFS2_VALID_FL)),
"Stale dinode %llu dtime: %llu flags: 0x%x\n",
(unsigned long long)oi->ip_blkno,
(unsigned long long)le64_to_cpu(fe->i_dtime),
le32_to_cpu(fe->i_flags));
ocfs2_refresh_inode(inode, fe);
}
status = 0;
bail_refresh:
if (lockres)
ocfs2_complete_lock_res_refresh(lockres, status);
bail:
mlog_exit(status);
return status;
}
static int ocfs2_assign_bh(struct inode *inode,
struct buffer_head **ret_bh,
struct buffer_head *passed_bh)
{
int status;
if (passed_bh) {
/* Ok, the update went to disk for us, use the
* returned bh. */
*ret_bh = passed_bh;
get_bh(*ret_bh);
return 0;
}
status = ocfs2_read_block(OCFS2_SB(inode->i_sb),
OCFS2_I(inode)->ip_blkno,
ret_bh,
OCFS2_BH_CACHED,
inode);
if (status < 0)
mlog_errno(status);
return status;
}
/*
* returns < 0 error if the callback will never be called, otherwise
* the result of the lock will be communicated via the callback.
*/
int ocfs2_meta_lock_full(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
int arg_flags)
{
int status, level, dlm_flags, acquired;
struct ocfs2_lock_res *lockres = NULL;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
struct buffer_head *local_bh = NULL;
BUG_ON(!inode);
mlog_entry_void();
mlog(0, "inode %llu, take %s META lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
ex ? "EXMODE" : "PRMODE");
status = 0;
acquired = 0;
/* We'll allow faking a readonly metadata lock for
* rodevices. */
if (ocfs2_is_hard_readonly(osb)) {
if (ex)
status = -EROFS;
goto bail;
}
if (ocfs2_mount_local(osb))
goto local;
if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
wait_event(osb->recovery_event,
ocfs2_node_map_is_empty(osb, &osb->recovery_map));
acquired = 0;
lockres = &OCFS2_I(inode)->ip_meta_lockres;
level = ex ? LKM_EXMODE : LKM_PRMODE;
dlm_flags = 0;
if (arg_flags & OCFS2_META_LOCK_NOQUEUE)
dlm_flags |= LKM_NOQUEUE;
status = ocfs2_cluster_lock(osb, lockres, level, dlm_flags, arg_flags);
if (status < 0) {
if (status != -EAGAIN && status != -EIOCBRETRY)
mlog_errno(status);
goto bail;
}
/* Notify the error cleanup path to drop the cluster lock. */
acquired = 1;
/* We wait twice because a node may have died while we were in
* the lower dlm layers. The second time though, we've
* committed to owning this lock so we don't allow signals to
* abort the operation. */
if (!(arg_flags & OCFS2_META_LOCK_RECOVERY))
wait_event(osb->recovery_event,
ocfs2_node_map_is_empty(osb, &osb->recovery_map));
local:
/*
* We only see this flag if we're being called from
* ocfs2_read_locked_inode(). It means we're locking an inode
* which hasn't been populated yet, so clear the refresh flag
* and let the caller handle it.
*/
if (inode->i_state & I_NEW) {
status = 0;
if (lockres)
ocfs2_complete_lock_res_refresh(lockres, 0);
goto bail;
}
/* This is fun. The caller may want a bh back, or it may
* not. ocfs2_meta_lock_update definitely wants one in, but
* may or may not read one, depending on what's in the
* LVB. The result of all of this is that we've *only* gone to
* disk if we have to, so the complexity is worthwhile. */
status = ocfs2_meta_lock_update(inode, &local_bh);
if (status < 0) {
if (status != -ENOENT)
mlog_errno(status);
goto bail;
}
if (ret_bh) {
status = ocfs2_assign_bh(inode, ret_bh, local_bh);
if (status < 0) {
mlog_errno(status);
goto bail;
}
}
bail:
if (status < 0) {
if (ret_bh && (*ret_bh)) {
brelse(*ret_bh);
*ret_bh = NULL;
}
if (acquired)
ocfs2_meta_unlock(inode, ex);
}
if (local_bh)
brelse(local_bh);
mlog_exit(status);
return status;
}
/*
* This is working around a lock inversion between tasks acquiring DLM locks
* while holding a page lock and the vote thread which blocks dlm lock acquiry
* while acquiring page locks.
*
* ** These _with_page variantes are only intended to be called from aop
* methods that hold page locks and return a very specific *positive* error
* code that aop methods pass up to the VFS -- test for errors with != 0. **
*
* The DLM is called such that it returns -EAGAIN if it would have blocked
* waiting for the vote thread. In that case we unlock our page so the vote
* thread can make progress. Once we've done this we have to return
* AOP_TRUNCATED_PAGE so the aop method that called us can bubble that back up
* into the VFS who will then immediately retry the aop call.
*
* We do a blocking lock and immediate unlock before returning, though, so that
* the lock has a great chance of being cached on this node by the time the VFS
* calls back to retry the aop. This has a potential to livelock as nodes
* ping locks back and forth, but that's a risk we're willing to take to avoid
* the lock inversion simply.
*/
int ocfs2_meta_lock_with_page(struct inode *inode,
struct buffer_head **ret_bh,
int ex,
struct page *page)
{
int ret;
ret = ocfs2_meta_lock_full(inode, ret_bh, ex, OCFS2_LOCK_NONBLOCK);
if (ret == -EAGAIN) {
unlock_page(page);
if (ocfs2_meta_lock(inode, ret_bh, ex) == 0)
ocfs2_meta_unlock(inode, ex);
ret = AOP_TRUNCATED_PAGE;
}
return ret;
}
int ocfs2_meta_lock_atime(struct inode *inode,
struct vfsmount *vfsmnt,
int *level)
{
int ret;
mlog_entry_void();
ret = ocfs2_meta_lock(inode, NULL, 0);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
/*
* If we should update atime, we will get EX lock,
* otherwise we just get PR lock.
*/
if (ocfs2_should_update_atime(inode, vfsmnt)) {
struct buffer_head *bh = NULL;
ocfs2_meta_unlock(inode, 0);
ret = ocfs2_meta_lock(inode, &bh, 1);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
*level = 1;
if (ocfs2_should_update_atime(inode, vfsmnt))
ocfs2_update_inode_atime(inode, bh);
if (bh)
brelse(bh);
} else
*level = 0;
mlog_exit(ret);
return ret;
}
void ocfs2_meta_unlock(struct inode *inode,
int ex)
{
int level = ex ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_meta_lockres;
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
mlog_entry_void();
mlog(0, "inode %llu drop %s META lock\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
ex ? "EXMODE" : "PRMODE");
if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) &&
!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level);
mlog_exit_void();
}
int ocfs2_super_lock(struct ocfs2_super *osb,
int ex)
{
int status = 0;
int level = ex ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_lock_res *lockres = &osb->osb_super_lockres;
struct buffer_head *bh;
struct ocfs2_slot_info *si = osb->slot_info;
mlog_entry_void();
if (ocfs2_is_hard_readonly(osb))
return -EROFS;
if (ocfs2_mount_local(osb))
goto bail;
status = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
if (status < 0) {
mlog_errno(status);
goto bail;
}
/* The super block lock path is really in the best position to
* know when resources covered by the lock need to be
* refreshed, so we do it here. Of course, making sense of
* everything is up to the caller :) */
status = ocfs2_should_refresh_lock_res(lockres);
if (status < 0) {
mlog_errno(status);
goto bail;
}
if (status) {
bh = si->si_bh;
status = ocfs2_read_block(osb, bh->b_blocknr, &bh, 0,
si->si_inode);
if (status == 0)
ocfs2_update_slot_info(si);
ocfs2_complete_lock_res_refresh(lockres, status);
if (status < 0)
mlog_errno(status);
}
bail:
mlog_exit(status);
return status;
}
void ocfs2_super_unlock(struct ocfs2_super *osb,
int ex)
{
int level = ex ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_lock_res *lockres = &osb->osb_super_lockres;
if (!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(osb, lockres, level);
}
int ocfs2_rename_lock(struct ocfs2_super *osb)
{
int status;
struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres;
if (ocfs2_is_hard_readonly(osb))
return -EROFS;
if (ocfs2_mount_local(osb))
return 0;
status = ocfs2_cluster_lock(osb, lockres, LKM_EXMODE, 0, 0);
if (status < 0)
mlog_errno(status);
return status;
}
void ocfs2_rename_unlock(struct ocfs2_super *osb)
{
struct ocfs2_lock_res *lockres = &osb->osb_rename_lockres;
if (!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(osb, lockres, LKM_EXMODE);
}
int ocfs2_dentry_lock(struct dentry *dentry, int ex)
{
int ret;
int level = ex ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
BUG_ON(!dl);
if (ocfs2_is_hard_readonly(osb))
return -EROFS;
if (ocfs2_mount_local(osb))
return 0;
ret = ocfs2_cluster_lock(osb, &dl->dl_lockres, level, 0, 0);
if (ret < 0)
mlog_errno(ret);
return ret;
}
void ocfs2_dentry_unlock(struct dentry *dentry, int ex)
{
int level = ex ? LKM_EXMODE : LKM_PRMODE;
struct ocfs2_dentry_lock *dl = dentry->d_fsdata;
struct ocfs2_super *osb = OCFS2_SB(dentry->d_sb);
if (!ocfs2_mount_local(osb))
ocfs2_cluster_unlock(osb, &dl->dl_lockres, level);
}
/* Reference counting of the dlm debug structure. We want this because
* open references on the debug inodes can live on after a mount, so
* we can't rely on the ocfs2_super to always exist. */
static void ocfs2_dlm_debug_free(struct kref *kref)
{
struct ocfs2_dlm_debug *dlm_debug;
dlm_debug = container_of(kref, struct ocfs2_dlm_debug, d_refcnt);
kfree(dlm_debug);
}
void ocfs2_put_dlm_debug(struct ocfs2_dlm_debug *dlm_debug)
{
if (dlm_debug)
kref_put(&dlm_debug->d_refcnt, ocfs2_dlm_debug_free);
}
static void ocfs2_get_dlm_debug(struct ocfs2_dlm_debug *debug)
{
kref_get(&debug->d_refcnt);
}
struct ocfs2_dlm_debug *ocfs2_new_dlm_debug(void)
{
struct ocfs2_dlm_debug *dlm_debug;
dlm_debug = kmalloc(sizeof(struct ocfs2_dlm_debug), GFP_KERNEL);
if (!dlm_debug) {
mlog_errno(-ENOMEM);
goto out;
}
kref_init(&dlm_debug->d_refcnt);
INIT_LIST_HEAD(&dlm_debug->d_lockres_tracking);
dlm_debug->d_locking_state = NULL;
out:
return dlm_debug;
}
/* Access to this is arbitrated for us via seq_file->sem. */
struct ocfs2_dlm_seq_priv {
struct ocfs2_dlm_debug *p_dlm_debug;
struct ocfs2_lock_res p_iter_res;
struct ocfs2_lock_res p_tmp_res;
};
static struct ocfs2_lock_res *ocfs2_dlm_next_res(struct ocfs2_lock_res *start,
struct ocfs2_dlm_seq_priv *priv)
{
struct ocfs2_lock_res *iter, *ret = NULL;
struct ocfs2_dlm_debug *dlm_debug = priv->p_dlm_debug;
assert_spin_locked(&ocfs2_dlm_tracking_lock);
list_for_each_entry(iter, &start->l_debug_list, l_debug_list) {
/* discover the head of the list */
if (&iter->l_debug_list == &dlm_debug->d_lockres_tracking) {
mlog(0, "End of list found, %p\n", ret);
break;
}
/* We track our "dummy" iteration lockres' by a NULL
* l_ops field. */
if (iter->l_ops != NULL) {
ret = iter;
break;
}
}
return ret;
}
static void *ocfs2_dlm_seq_start(struct seq_file *m, loff_t *pos)
{
struct ocfs2_dlm_seq_priv *priv = m->private;
struct ocfs2_lock_res *iter;
spin_lock(&ocfs2_dlm_tracking_lock);
iter = ocfs2_dlm_next_res(&priv->p_iter_res, priv);
if (iter) {
/* Since lockres' have the lifetime of their container
* (which can be inodes, ocfs2_supers, etc) we want to
* copy this out to a temporary lockres while still
* under the spinlock. Obviously after this we can't
* trust any pointers on the copy returned, but that's
* ok as the information we want isn't typically held
* in them. */
priv->p_tmp_res = *iter;
iter = &priv->p_tmp_res;
}
spin_unlock(&ocfs2_dlm_tracking_lock);
return iter;
}
static void ocfs2_dlm_seq_stop(struct seq_file *m, void *v)
{
}
static void *ocfs2_dlm_seq_next(struct seq_file *m, void *v, loff_t *pos)
{
struct ocfs2_dlm_seq_priv *priv = m->private;
struct ocfs2_lock_res *iter = v;
struct ocfs2_lock_res *dummy = &priv->p_iter_res;
spin_lock(&ocfs2_dlm_tracking_lock);
iter = ocfs2_dlm_next_res(iter, priv);
list_del_init(&dummy->l_debug_list);
if (iter) {
list_add(&dummy->l_debug_list, &iter->l_debug_list);
priv->p_tmp_res = *iter;
iter = &priv->p_tmp_res;
}
spin_unlock(&ocfs2_dlm_tracking_lock);
return iter;
}
/* So that debugfs.ocfs2 can determine which format is being used */
#define OCFS2_DLM_DEBUG_STR_VERSION 1
static int ocfs2_dlm_seq_show(struct seq_file *m, void *v)
{
int i;
char *lvb;
struct ocfs2_lock_res *lockres = v;
if (!lockres)
return -EINVAL;
seq_printf(m, "0x%x\t", OCFS2_DLM_DEBUG_STR_VERSION);
if (lockres->l_type == OCFS2_LOCK_TYPE_DENTRY)
seq_printf(m, "%.*s%08x\t", OCFS2_DENTRY_LOCK_INO_START - 1,
lockres->l_name,
(unsigned int)ocfs2_get_dentry_lock_ino(lockres));
else
seq_printf(m, "%.*s\t", OCFS2_LOCK_ID_MAX_LEN, lockres->l_name);
seq_printf(m, "%d\t"
"0x%lx\t"
"0x%x\t"
"0x%x\t"
"%u\t"
"%u\t"
"%d\t"
"%d\t",
lockres->l_level,
lockres->l_flags,
lockres->l_action,
lockres->l_unlock_action,
lockres->l_ro_holders,
lockres->l_ex_holders,
lockres->l_requested,
lockres->l_blocking);
/* Dump the raw LVB */
lvb = lockres->l_lksb.lvb;
for(i = 0; i < DLM_LVB_LEN; i++)
seq_printf(m, "0x%x\t", lvb[i]);
/* End the line */
seq_printf(m, "\n");
return 0;
}
static struct seq_operations ocfs2_dlm_seq_ops = {
.start = ocfs2_dlm_seq_start,
.stop = ocfs2_dlm_seq_stop,
.next = ocfs2_dlm_seq_next,
.show = ocfs2_dlm_seq_show,
};
static int ocfs2_dlm_debug_release(struct inode *inode, struct file *file)
{
struct seq_file *seq = (struct seq_file *) file->private_data;
struct ocfs2_dlm_seq_priv *priv = seq->private;
struct ocfs2_lock_res *res = &priv->p_iter_res;
ocfs2_remove_lockres_tracking(res);
ocfs2_put_dlm_debug(priv->p_dlm_debug);
return seq_release_private(inode, file);
}
static int ocfs2_dlm_debug_open(struct inode *inode, struct file *file)
{
int ret;
struct ocfs2_dlm_seq_priv *priv;
struct seq_file *seq;
struct ocfs2_super *osb;
priv = kzalloc(sizeof(struct ocfs2_dlm_seq_priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
mlog_errno(ret);
goto out;
}
osb = inode->i_private;
ocfs2_get_dlm_debug(osb->osb_dlm_debug);
priv->p_dlm_debug = osb->osb_dlm_debug;
INIT_LIST_HEAD(&priv->p_iter_res.l_debug_list);
ret = seq_open(file, &ocfs2_dlm_seq_ops);
if (ret) {
kfree(priv);
mlog_errno(ret);
goto out;
}
seq = (struct seq_file *) file->private_data;
seq->private = priv;
ocfs2_add_lockres_tracking(&priv->p_iter_res,
priv->p_dlm_debug);
out:
return ret;
}
static const struct file_operations ocfs2_dlm_debug_fops = {
.open = ocfs2_dlm_debug_open,
.release = ocfs2_dlm_debug_release,
.read = seq_read,
.llseek = seq_lseek,
};
static int ocfs2_dlm_init_debug(struct ocfs2_super *osb)
{
int ret = 0;
struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
dlm_debug->d_locking_state = debugfs_create_file("locking_state",
S_IFREG|S_IRUSR,
osb->osb_debug_root,
osb,
&ocfs2_dlm_debug_fops);
if (!dlm_debug->d_locking_state) {
ret = -EINVAL;
mlog(ML_ERROR,
"Unable to create locking state debugfs file.\n");
goto out;
}
ocfs2_get_dlm_debug(dlm_debug);
out:
return ret;
}
static void ocfs2_dlm_shutdown_debug(struct ocfs2_super *osb)
{
struct ocfs2_dlm_debug *dlm_debug = osb->osb_dlm_debug;
if (dlm_debug) {
debugfs_remove(dlm_debug->d_locking_state);
ocfs2_put_dlm_debug(dlm_debug);
}
}
int ocfs2_dlm_init(struct ocfs2_super *osb)
{
int status = 0;
u32 dlm_key;
struct dlm_ctxt *dlm = NULL;
mlog_entry_void();
if (ocfs2_mount_local(osb))
goto local;
status = ocfs2_dlm_init_debug(osb);
if (status < 0) {
mlog_errno(status);
goto bail;
}
/* launch vote thread */
osb->vote_task = kthread_run(ocfs2_vote_thread, osb, "ocfs2vote");
if (IS_ERR(osb->vote_task)) {
status = PTR_ERR(osb->vote_task);
osb->vote_task = NULL;
mlog_errno(status);
goto bail;
}
/* used by the dlm code to make message headers unique, each
* node in this domain must agree on this. */
dlm_key = crc32_le(0, osb->uuid_str, strlen(osb->uuid_str));
/* for now, uuid == domain */
dlm = dlm_register_domain(osb->uuid_str, dlm_key);
if (IS_ERR(dlm)) {
status = PTR_ERR(dlm);
mlog_errno(status);
goto bail;
}
dlm_register_eviction_cb(dlm, &osb->osb_eviction_cb);
local:
ocfs2_super_lock_res_init(&osb->osb_super_lockres, osb);
ocfs2_rename_lock_res_init(&osb->osb_rename_lockres, osb);
osb->dlm = dlm;
status = 0;
bail:
if (status < 0) {
ocfs2_dlm_shutdown_debug(osb);
if (osb->vote_task)
kthread_stop(osb->vote_task);
}
mlog_exit(status);
return status;
}
void ocfs2_dlm_shutdown(struct ocfs2_super *osb)
{
mlog_entry_void();
dlm_unregister_eviction_cb(&osb->osb_eviction_cb);
ocfs2_drop_osb_locks(osb);
if (osb->vote_task) {
kthread_stop(osb->vote_task);
osb->vote_task = NULL;
}
ocfs2_lock_res_free(&osb->osb_super_lockres);
ocfs2_lock_res_free(&osb->osb_rename_lockres);
dlm_unregister_domain(osb->dlm);
osb->dlm = NULL;
ocfs2_dlm_shutdown_debug(osb);
mlog_exit_void();
}
static void ocfs2_unlock_ast(void *opaque, enum dlm_status status)
{
struct ocfs2_lock_res *lockres = opaque;
unsigned long flags;
mlog_entry_void();
mlog(0, "UNLOCK AST called on lock %s, action = %d\n", lockres->l_name,
lockres->l_unlock_action);
spin_lock_irqsave(&lockres->l_lock, flags);
/* We tried to cancel a convert request, but it was already
* granted. All we want to do here is clear our unlock
* state. The wake_up call done at the bottom is redundant
* (ocfs2_prepare_cancel_convert doesn't sleep on this) but doesn't
* hurt anything anyway */
if (status == DLM_CANCELGRANT &&
lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) {
mlog(0, "Got cancelgrant for %s\n", lockres->l_name);
/* We don't clear the busy flag in this case as it
* should have been cleared by the ast which the dlm
* has called. */
goto complete_unlock;
}
if (status != DLM_NORMAL) {
mlog(ML_ERROR, "Dlm passes status %d for lock %s, "
"unlock_action %d\n", status, lockres->l_name,
lockres->l_unlock_action);
spin_unlock_irqrestore(&lockres->l_lock, flags);
return;
}
switch(lockres->l_unlock_action) {
case OCFS2_UNLOCK_CANCEL_CONVERT:
mlog(0, "Cancel convert success for %s\n", lockres->l_name);
lockres->l_action = OCFS2_AST_INVALID;
break;
case OCFS2_UNLOCK_DROP_LOCK:
lockres->l_level = LKM_IVMODE;
break;
default:
BUG();
}
lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
complete_unlock:
lockres->l_unlock_action = OCFS2_UNLOCK_INVALID;
spin_unlock_irqrestore(&lockres->l_lock, flags);
wake_up(&lockres->l_event);
mlog_exit_void();
}
static int ocfs2_drop_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
enum dlm_status status;
unsigned long flags;
int lkm_flags = 0;
/* We didn't get anywhere near actually using this lockres. */
if (!(lockres->l_flags & OCFS2_LOCK_INITIALIZED))
goto out;
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB)
lkm_flags |= LKM_VALBLK;
spin_lock_irqsave(&lockres->l_lock, flags);
mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_FREEING),
"lockres %s, flags 0x%lx\n",
lockres->l_name, lockres->l_flags);
while (lockres->l_flags & OCFS2_LOCK_BUSY) {
mlog(0, "waiting on busy lock \"%s\": flags = %lx, action = "
"%u, unlock_action = %u\n",
lockres->l_name, lockres->l_flags, lockres->l_action,
lockres->l_unlock_action);
spin_unlock_irqrestore(&lockres->l_lock, flags);
/* XXX: Today we just wait on any busy
* locks... Perhaps we need to cancel converts in the
* future? */
ocfs2_wait_on_busy_lock(lockres);
spin_lock_irqsave(&lockres->l_lock, flags);
}
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) {
if (lockres->l_flags & OCFS2_LOCK_ATTACHED &&
lockres->l_level == LKM_EXMODE &&
!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH))
lockres->l_ops->set_lvb(lockres);
}
if (lockres->l_flags & OCFS2_LOCK_BUSY)
mlog(ML_ERROR, "destroying busy lock: \"%s\"\n",
lockres->l_name);
if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
mlog(0, "destroying blocked lock: \"%s\"\n", lockres->l_name);
if (!(lockres->l_flags & OCFS2_LOCK_ATTACHED)) {
spin_unlock_irqrestore(&lockres->l_lock, flags);
goto out;
}
lockres_clear_flags(lockres, OCFS2_LOCK_ATTACHED);
/* make sure we never get here while waiting for an ast to
* fire. */
BUG_ON(lockres->l_action != OCFS2_AST_INVALID);
/* is this necessary? */
lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
lockres->l_unlock_action = OCFS2_UNLOCK_DROP_LOCK;
spin_unlock_irqrestore(&lockres->l_lock, flags);
mlog(0, "lock %s\n", lockres->l_name);
status = dlmunlock(osb->dlm, &lockres->l_lksb, lkm_flags,
ocfs2_unlock_ast, lockres);
if (status != DLM_NORMAL) {
ocfs2_log_dlm_error("dlmunlock", status, lockres);
mlog(ML_ERROR, "lockres flags: %lu\n", lockres->l_flags);
dlm_print_one_lock(lockres->l_lksb.lockid);
BUG();
}
mlog(0, "lock %s, successfull return from dlmunlock\n",
lockres->l_name);
ocfs2_wait_on_busy_lock(lockres);
out:
mlog_exit(0);
return 0;
}
/* Mark the lockres as being dropped. It will no longer be
* queued if blocking, but we still may have to wait on it
* being dequeued from the vote thread before we can consider
* it safe to drop.
*
* You can *not* attempt to call cluster_lock on this lockres anymore. */
void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres)
{
int status;
struct ocfs2_mask_waiter mw;
unsigned long flags;
ocfs2_init_mask_waiter(&mw);
spin_lock_irqsave(&lockres->l_lock, flags);
lockres->l_flags |= OCFS2_LOCK_FREEING;
while (lockres->l_flags & OCFS2_LOCK_QUEUED) {
lockres_add_mask_waiter(lockres, &mw, OCFS2_LOCK_QUEUED, 0);
spin_unlock_irqrestore(&lockres->l_lock, flags);
mlog(0, "Waiting on lockres %s\n", lockres->l_name);
status = ocfs2_wait_for_mask(&mw);
if (status)
mlog_errno(status);
spin_lock_irqsave(&lockres->l_lock, flags);
}
spin_unlock_irqrestore(&lockres->l_lock, flags);
}
void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
int ret;
ocfs2_mark_lockres_freeing(lockres);
ret = ocfs2_drop_lock(osb, lockres);
if (ret)
mlog_errno(ret);
}
static void ocfs2_drop_osb_locks(struct ocfs2_super *osb)
{
ocfs2_simple_drop_lockres(osb, &osb->osb_super_lockres);
ocfs2_simple_drop_lockres(osb, &osb->osb_rename_lockres);
}
int ocfs2_drop_inode_locks(struct inode *inode)
{
int status, err;
mlog_entry_void();
/* No need to call ocfs2_mark_lockres_freeing here -
* ocfs2_clear_inode has done it for us. */
err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
&OCFS2_I(inode)->ip_data_lockres);
if (err < 0)
mlog_errno(err);
status = err;
err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
&OCFS2_I(inode)->ip_meta_lockres);
if (err < 0)
mlog_errno(err);
if (err < 0 && !status)
status = err;
err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb),
&OCFS2_I(inode)->ip_rw_lockres);
if (err < 0)
mlog_errno(err);
if (err < 0 && !status)
status = err;
mlog_exit(status);
return status;
}
static void ocfs2_prepare_downconvert(struct ocfs2_lock_res *lockres,
int new_level)
{
assert_spin_locked(&lockres->l_lock);
BUG_ON(lockres->l_blocking <= LKM_NLMODE);
if (lockres->l_level <= new_level) {
mlog(ML_ERROR, "lockres->l_level (%u) <= new_level (%u)\n",
lockres->l_level, new_level);
BUG();
}
mlog(0, "lock %s, new_level = %d, l_blocking = %d\n",
lockres->l_name, new_level, lockres->l_blocking);
lockres->l_action = OCFS2_AST_DOWNCONVERT;
lockres->l_requested = new_level;
lockres_or_flags(lockres, OCFS2_LOCK_BUSY);
}
static int ocfs2_downconvert_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
int new_level,
int lvb)
{
int ret, dlm_flags = LKM_CONVERT;
enum dlm_status status;
mlog_entry_void();
if (lvb)
dlm_flags |= LKM_VALBLK;
status = dlmlock(osb->dlm,
new_level,
&lockres->l_lksb,
dlm_flags,
lockres->l_name,
OCFS2_LOCK_ID_MAX_LEN - 1,
ocfs2_locking_ast,
lockres,
ocfs2_blocking_ast);
if (status != DLM_NORMAL) {
ocfs2_log_dlm_error("dlmlock", status, lockres);
ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 1);
goto bail;
}
ret = 0;
bail:
mlog_exit(ret);
return ret;
}
/* returns 1 when the caller should unlock and call dlmunlock */
static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
assert_spin_locked(&lockres->l_lock);
mlog_entry_void();
mlog(0, "lock %s\n", lockres->l_name);
if (lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) {
/* If we're already trying to cancel a lock conversion
* then just drop the spinlock and allow the caller to
* requeue this lock. */
mlog(0, "Lockres %s, skip convert\n", lockres->l_name);
return 0;
}
/* were we in a convert when we got the bast fire? */
BUG_ON(lockres->l_action != OCFS2_AST_CONVERT &&
lockres->l_action != OCFS2_AST_DOWNCONVERT);
/* set things up for the unlockast to know to just
* clear out the ast_action and unset busy, etc. */
lockres->l_unlock_action = OCFS2_UNLOCK_CANCEL_CONVERT;
mlog_bug_on_msg(!(lockres->l_flags & OCFS2_LOCK_BUSY),
"lock %s, invalid flags: 0x%lx\n",
lockres->l_name, lockres->l_flags);
return 1;
}
static int ocfs2_cancel_convert(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
int ret;
enum dlm_status status;
mlog_entry_void();
mlog(0, "lock %s\n", lockres->l_name);
ret = 0;
status = dlmunlock(osb->dlm,
&lockres->l_lksb,
LKM_CANCEL,
ocfs2_unlock_ast,
lockres);
if (status != DLM_NORMAL) {
ocfs2_log_dlm_error("dlmunlock", status, lockres);
ret = -EINVAL;
ocfs2_recover_from_dlm_error(lockres, 0);
}
mlog(0, "lock %s return from dlmunlock\n", lockres->l_name);
mlog_exit(ret);
return ret;
}
static int ocfs2_unblock_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres,
struct ocfs2_unblock_ctl *ctl)
{
unsigned long flags;
int blocking;
int new_level;
int ret = 0;
int set_lvb = 0;
mlog_entry_void();
spin_lock_irqsave(&lockres->l_lock, flags);
BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED));
recheck:
if (lockres->l_flags & OCFS2_LOCK_BUSY) {
ctl->requeue = 1;
ret = ocfs2_prepare_cancel_convert(osb, lockres);
spin_unlock_irqrestore(&lockres->l_lock, flags);
if (ret) {
ret = ocfs2_cancel_convert(osb, lockres);
if (ret < 0)
mlog_errno(ret);
}
goto leave;
}
/* if we're blocking an exclusive and we have *any* holders,
* then requeue. */
if ((lockres->l_blocking == LKM_EXMODE)
&& (lockres->l_ex_holders || lockres->l_ro_holders))
goto leave_requeue;
/* If it's a PR we're blocking, then only
* requeue if we've got any EX holders */
if (lockres->l_blocking == LKM_PRMODE &&
lockres->l_ex_holders)
goto leave_requeue;
/*
* Can we get a lock in this state if the holder counts are
* zero? The meta data unblock code used to check this.
*/
if ((lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH)
&& (lockres->l_flags & OCFS2_LOCK_REFRESHING))
goto leave_requeue;
new_level = ocfs2_highest_compat_lock_level(lockres->l_blocking);
if (lockres->l_ops->check_downconvert
&& !lockres->l_ops->check_downconvert(lockres, new_level))
goto leave_requeue;
/* If we get here, then we know that there are no more
* incompatible holders (and anyone asking for an incompatible
* lock is blocked). We can now downconvert the lock */
if (!lockres->l_ops->downconvert_worker)
goto downconvert;
/* Some lockres types want to do a bit of work before
* downconverting a lock. Allow that here. The worker function
* may sleep, so we save off a copy of what we're blocking as
* it may change while we're not holding the spin lock. */
blocking = lockres->l_blocking;
spin_unlock_irqrestore(&lockres->l_lock, flags);
ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking);
if (ctl->unblock_action == UNBLOCK_STOP_POST)
goto leave;
spin_lock_irqsave(&lockres->l_lock, flags);
if (blocking != lockres->l_blocking) {
/* If this changed underneath us, then we can't drop
* it just yet. */
goto recheck;
}
downconvert:
ctl->requeue = 0;
if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) {
if (lockres->l_level == LKM_EXMODE)
set_lvb = 1;
/*
* We only set the lvb if the lock has been fully
* refreshed - otherwise we risk setting stale
* data. Otherwise, there's no need to actually clear
* out the lvb here as it's value is still valid.
*/
if (set_lvb && !(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH))
lockres->l_ops->set_lvb(lockres);
}
ocfs2_prepare_downconvert(lockres, new_level);
spin_unlock_irqrestore(&lockres->l_lock, flags);
ret = ocfs2_downconvert_lock(osb, lockres, new_level, set_lvb);
leave:
mlog_exit(ret);
return ret;
leave_requeue:
spin_unlock_irqrestore(&lockres->l_lock, flags);
ctl->requeue = 1;
mlog_exit(0);
return 0;
}
static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
int blocking)
{
struct inode *inode;
struct address_space *mapping;
inode = ocfs2_lock_res_inode(lockres);
mapping = inode->i_mapping;
/*
* We need this before the filemap_fdatawrite() so that it can
* transfer the dirty bit from the PTE to the
* page. Unfortunately this means that even for EX->PR
* downconverts, we'll lose our mappings and have to build
* them up again.
*/
unmap_mapping_range(mapping, 0, 0, 0);
if (filemap_fdatawrite(mapping)) {
mlog(ML_ERROR, "Could not sync inode %llu for downconvert!",
(unsigned long long)OCFS2_I(inode)->ip_blkno);
}
sync_mapping_buffers(mapping);
if (blocking == LKM_EXMODE) {
truncate_inode_pages(mapping, 0);
} else {
/* We only need to wait on the I/O if we're not also
* truncating pages because truncate_inode_pages waits
* for us above. We don't truncate pages if we're
* blocking anything < EXMODE because we want to keep
* them around in that case. */
filemap_fdatawait(mapping);
}
return UNBLOCK_CONTINUE;
}
static int ocfs2_check_meta_downconvert(struct ocfs2_lock_res *lockres,
int new_level)
{
struct inode *inode = ocfs2_lock_res_inode(lockres);
int checkpointed = ocfs2_inode_fully_checkpointed(inode);
BUG_ON(new_level != LKM_NLMODE && new_level != LKM_PRMODE);
BUG_ON(lockres->l_level != LKM_EXMODE && !checkpointed);
if (checkpointed)
return 1;
ocfs2_start_checkpoint(OCFS2_SB(inode->i_sb));
return 0;
}
static void ocfs2_set_meta_lvb(struct ocfs2_lock_res *lockres)
{
struct inode *inode = ocfs2_lock_res_inode(lockres);
__ocfs2_stuff_meta_lvb(inode);
}
/*
* Does the final reference drop on our dentry lock. Right now this
* happens in the vote thread, but we could choose to simplify the
* dlmglue API and push these off to the ocfs2_wq in the future.
*/
static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres);
ocfs2_dentry_lock_put(osb, dl);
}
/*
* d_delete() matching dentries before the lock downconvert.
*
* At this point, any process waiting to destroy the
* dentry_lock due to last ref count is stopped by the
* OCFS2_LOCK_QUEUED flag.
*
* We have two potential problems
*
* 1) If we do the last reference drop on our dentry_lock (via dput)
* we'll wind up in ocfs2_release_dentry_lock(), waiting on
* the downconvert to finish. Instead we take an elevated
* reference and push the drop until after we've completed our
* unblock processing.
*
* 2) There might be another process with a final reference,
* waiting on us to finish processing. If this is the case, we
* detect it and exit out - there's no more dentries anyway.
*/
static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
int blocking)
{
struct ocfs2_dentry_lock *dl = ocfs2_lock_res_dl(lockres);
struct ocfs2_inode_info *oi = OCFS2_I(dl->dl_inode);
struct dentry *dentry;
unsigned long flags;
int extra_ref = 0;
/*
* This node is blocking another node from getting a read
* lock. This happens when we've renamed within a
* directory. We've forced the other nodes to d_delete(), but
* we never actually dropped our lock because it's still
* valid. The downconvert code will retain a PR for this node,
* so there's no further work to do.
*/
if (blocking == LKM_PRMODE)
return UNBLOCK_CONTINUE;
/*
* Mark this inode as potentially orphaned. The code in
* ocfs2_delete_inode() will figure out whether it actually
* needs to be freed or not.
*/
spin_lock(&oi->ip_lock);
oi->ip_flags |= OCFS2_INODE_MAYBE_ORPHANED;
spin_unlock(&oi->ip_lock);
/*
* Yuck. We need to make sure however that the check of
* OCFS2_LOCK_FREEING and the extra reference are atomic with
* respect to a reference decrement or the setting of that
* flag.
*/
spin_lock_irqsave(&lockres->l_lock, flags);
spin_lock(&dentry_attach_lock);
if (!(lockres->l_flags & OCFS2_LOCK_FREEING)
&& dl->dl_count) {
dl->dl_count++;
extra_ref = 1;
}
spin_unlock(&dentry_attach_lock);
spin_unlock_irqrestore(&lockres->l_lock, flags);
mlog(0, "extra_ref = %d\n", extra_ref);
/*
* We have a process waiting on us in ocfs2_dentry_iput(),
* which means we can't have any more outstanding
* aliases. There's no need to do any more work.
*/
if (!extra_ref)
return UNBLOCK_CONTINUE;
spin_lock(&dentry_attach_lock);
while (1) {
dentry = ocfs2_find_local_alias(dl->dl_inode,
dl->dl_parent_blkno, 1);
if (!dentry)
break;
spin_unlock(&dentry_attach_lock);
mlog(0, "d_delete(%.*s);\n", dentry->d_name.len,
dentry->d_name.name);
/*
* The following dcache calls may do an
* iput(). Normally we don't want that from the
* downconverting thread, but in this case it's ok
* because the requesting node already has an
* exclusive lock on the inode, so it can't be queued
* for a downconvert.
*/
d_delete(dentry);
dput(dentry);
spin_lock(&dentry_attach_lock);
}
spin_unlock(&dentry_attach_lock);
/*
* If we are the last holder of this dentry lock, there is no
* reason to downconvert so skip straight to the unlock.
*/
if (dl->dl_count == 1)
return UNBLOCK_STOP_POST;
return UNBLOCK_CONTINUE_POST;
}
void ocfs2_process_blocked_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
int status;
struct ocfs2_unblock_ctl ctl = {0, 0,};
unsigned long flags;
/* Our reference to the lockres in this function can be
* considered valid until we remove the OCFS2_LOCK_QUEUED
* flag. */
mlog_entry_void();
BUG_ON(!lockres);
BUG_ON(!lockres->l_ops);
mlog(0, "lockres %s blocked.\n", lockres->l_name);
/* Detect whether a lock has been marked as going away while
* the vote thread was processing other things. A lock can
* still be marked with OCFS2_LOCK_FREEING after this check,
* but short circuiting here will still save us some
* performance. */
spin_lock_irqsave(&lockres->l_lock, flags);
if (lockres->l_flags & OCFS2_LOCK_FREEING)
goto unqueue;
spin_unlock_irqrestore(&lockres->l_lock, flags);
status = ocfs2_unblock_lock(osb, lockres, &ctl);
if (status < 0)
mlog_errno(status);
spin_lock_irqsave(&lockres->l_lock, flags);
unqueue:
if (lockres->l_flags & OCFS2_LOCK_FREEING || !ctl.requeue) {
lockres_clear_flags(lockres, OCFS2_LOCK_QUEUED);
} else
ocfs2_schedule_blocked_lock(osb, lockres);
mlog(0, "lockres %s, requeue = %s.\n", lockres->l_name,
ctl.requeue ? "yes" : "no");
spin_unlock_irqrestore(&lockres->l_lock, flags);
if (ctl.unblock_action != UNBLOCK_CONTINUE
&& lockres->l_ops->post_unlock)
lockres->l_ops->post_unlock(osb, lockres);
mlog_exit_void();
}
static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb,
struct ocfs2_lock_res *lockres)
{
mlog_entry_void();
assert_spin_locked(&lockres->l_lock);
if (lockres->l_flags & OCFS2_LOCK_FREEING) {
/* Do not schedule a lock for downconvert when it's on
* the way to destruction - any nodes wanting access
* to the resource will get it soon. */
mlog(0, "Lockres %s won't be scheduled: flags 0x%lx\n",
lockres->l_name, lockres->l_flags);
return;
}
lockres_or_flags(lockres, OCFS2_LOCK_QUEUED);
spin_lock(&osb->vote_task_lock);
if (list_empty(&lockres->l_blocked_list)) {
list_add_tail(&lockres->l_blocked_list,
&osb->blocked_lock_list);
osb->blocked_lock_count++;
}
spin_unlock(&osb->vote_task_lock);
mlog_exit_void();
}
/* This aids in debugging situations where a bad LVB might be involved. */
void ocfs2_dump_meta_lvb_info(u64 level,
const char *function,
unsigned int line,
struct ocfs2_lock_res *lockres)
{
struct ocfs2_meta_lvb *lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
mlog(level, "LVB information for %s (called from %s:%u):\n",
lockres->l_name, function, line);
mlog(level, "version: %u, clusters: %u, generation: 0x%x\n",
lvb->lvb_version, be32_to_cpu(lvb->lvb_iclusters),
be32_to_cpu(lvb->lvb_igeneration));
mlog(level, "size: %llu, uid %u, gid %u, mode 0x%x\n",
(unsigned long long)be64_to_cpu(lvb->lvb_isize),
be32_to_cpu(lvb->lvb_iuid), be32_to_cpu(lvb->lvb_igid),
be16_to_cpu(lvb->lvb_imode));
mlog(level, "nlink %u, atime_packed 0x%llx, ctime_packed 0x%llx, "
"mtime_packed 0x%llx iattr 0x%x\n", be16_to_cpu(lvb->lvb_inlink),
(long long)be64_to_cpu(lvb->lvb_iatime_packed),
(long long)be64_to_cpu(lvb->lvb_ictime_packed),
(long long)be64_to_cpu(lvb->lvb_imtime_packed),
be32_to_cpu(lvb->lvb_iattr));
}
| 27.020354 | 91 | 0.718424 | [
"object"
] |
e33927496b3ea7e740cdbfbe6820309e19bec4c5 | 1,894 | h | C | ims/include/huaweicloud/ims/v2/model/GlanceUpdateImageRequestBody.h | yangzhaofeng/huaweicloud-sdk-cpp-v3 | 4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23 | [
"Apache-2.0"
] | 5 | 2021-03-03T08:23:43.000Z | 2022-02-16T02:16:39.000Z | ims/include/huaweicloud/ims/v2/model/GlanceUpdateImageRequestBody.h | yangzhaofeng/huaweicloud-sdk-cpp-v3 | 4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23 | [
"Apache-2.0"
] | null | null | null | ims/include/huaweicloud/ims/v2/model/GlanceUpdateImageRequestBody.h | yangzhaofeng/huaweicloud-sdk-cpp-v3 | 4f3caac5ba9a9b75b4e5fd61683d1c4d57ec1c23 | [
"Apache-2.0"
] | 7 | 2021-02-26T13:53:35.000Z | 2022-03-18T02:36:43.000Z |
#ifndef HUAWEICLOUD_SDK_IMS_V2_MODEL_GlanceUpdateImageRequestBody_H_
#define HUAWEICLOUD_SDK_IMS_V2_MODEL_GlanceUpdateImageRequestBody_H_
#include <huaweicloud/ims/v2/ImsExport.h>
#include <huaweicloud/core/utils/ModelBase.h>
#include <huaweicloud/core/http/HttpResponse.h>
#include <string>
namespace HuaweiCloud {
namespace Sdk {
namespace Ims {
namespace V2 {
namespace Model {
using namespace HuaweiCloud::Sdk::Core::Utils;
using namespace HuaweiCloud::Sdk::Core::Http;
/// <summary>
/// 原生更新接口请求体
/// </summary>
class HUAWEICLOUD_IMS_V2_EXPORT GlanceUpdateImageRequestBody
: public ModelBase
{
public:
GlanceUpdateImageRequestBody();
virtual ~GlanceUpdateImageRequestBody();
/////////////////////////////////////////////
/// ModelBase overrides
void validate() override;
web::json::value toJson() const override;
bool fromJson(const web::json::value& json) override;
/////////////////////////////////////////////
/// GlanceUpdateImageRequestBody members
/// <summary>
/// 所需进行的更新操作的类型:替换、添加、删除。取值范围:replace、add、remove
/// </summary>
std::string getOp() const;
bool opIsSet() const;
void unsetop();
void setOp(const std::string& value);
/// <summary>
/// 所要操作的属性名称。 replace和remove操作取值只能是镜像当前已有的属性、add操作取值只能是镜像当前不存在的属性,需要在属性名称前加”/”
/// </summary>
std::string getPath() const;
bool pathIsSet() const;
void unsetpath();
void setPath(const std::string& value);
/// <summary>
/// 所需更新/添加属性的值
/// </summary>
std::string getValue() const;
bool valueIsSet() const;
void unsetvalue();
void setValue(const std::string& value);
protected:
std::string op_;
bool opIsSet_;
std::string path_;
bool pathIsSet_;
std::string value_;
bool valueIsSet_;
};
}
}
}
}
}
#endif // HUAWEICLOUD_SDK_IMS_V2_MODEL_GlanceUpdateImageRequestBody_H_
| 21.522727 | 83 | 0.666315 | [
"model"
] |
e33ef181c9ec8af95d667687b57ca47f4c62eb09 | 8,627 | c | C | code/ioc_establish_serial_connection.c | iocafe/iocom | 9762b78fa1591994c74ed1fc6fe23b9ef44e0dff | [
"MIT"
] | 1 | 2020-04-28T23:25:50.000Z | 2020-04-28T23:25:50.000Z | code/ioc_establish_serial_connection.c | iocafe/iocom | 9762b78fa1591994c74ed1fc6fe23b9ef44e0dff | [
"MIT"
] | 11 | 2020-01-30T16:27:24.000Z | 2020-08-09T06:25:06.000Z | code/ioc_establish_serial_connection.c | iocafe/iocom | 9762b78fa1591994c74ed1fc6fe23b9ef44e0dff | [
"MIT"
] | null | null | null | /**
@file ioc_establish_serial_connection.c
@brief Send data to connection.
@author Pekka Lehtikoski
@version 1.0
@date 26.4.2021
Copyright 2020 Pekka Lehtikoski. This file is part of the iocom project and shall only be used,
modified, and distributed under the terms of the project licensing. By continuing to use, modify,
or distribute this file you indicate that you have read the license and understand and accept
it fully.
****************************************************************************************************
*/
#include "iocom.h"
#if OSAL_SERIAL_SUPPORT
/**
****************************************************************************************************
@brief Establish serial connection.
@anchor ioc_connection_send
The ioc_establish_serial_connection function establises the starting point for data transfer,
so that both ends of communication are at initial point.
@param con Pointer to the connection object.
@return OSAL_SUCCESS if all connection is establised and we can transfer data normally.
OSAL_PENDING = we are estabilishing serial connection
Other return values indicate on error.
****************************************************************************************************
*/
osalStatus ioc_establish_serial_connection(
iocConnection *con)
{
IOC_MT_ROOT_PTR;
os_memsz
n_written,
n_read;
const os_uchar
connect_char = IOC_SERIAL_CONNECT,
confirm_char = IOC_SERIAL_CONFIRM,
disconnect_char = IOC_SERIAL_DISCONNECT,
connect_reply_char = IOC_SERIAL_CONNECT_REPLY,
confirm_reply_char = IOC_SERIAL_CONFIRM_REPLY;
os_uchar
buf[32];
if ((con->flags & IOC_SOCKET) || con->sercon_state == OSAL_SERCON_STATE_CONNECTED_5)
{
return OSAL_SUCCESS;
}
ioc_set_mt_root(root, con->link.root);
ioc_lock(root);
/* If we are running serial connection, follow connect procedure. Notice that
checking for received control frames is in ioc_connection_receive.c.
*/
/* Client end of the serial connection.
*/
if ((con->flags & IOC_LISTENER) == 0)
{
switch (con->sercon_state)
{
default:
case OSAL_SERCON_STATE_INIT_1:
/* Clear RX and TX buffers.
*/
osal_stream_flush(con->stream,
OSAL_STREAM_CLEAR_RECEIVE_BUFFER|
OSAL_STREAM_CLEAR_TRANSMIT_BUFFER);
/* Start timer.
*/
os_get_timer(&con->sercon_timer);
/* Send connect character.
*/
osal_stream_write(con->stream, (os_char*)&connect_char, 1,
&n_written, OSAL_STREAM_DEFAULT);
osal_debug_assert(n_written == 1);
/* Move on to step 2.
*/
con->sercon_state = OSAL_SERCON_STATE_INIT_2;
break;
case OSAL_SERCON_STATE_INIT_2:
/* Try to read a character.
*/
osal_stream_read(con->stream, (os_char*)buf, sizeof(buf),
&n_read, OSAL_STREAM_DEFAULT);
/* If last character received is CONNECT_REPLY character,
then send CONFIRM character and start wait for CONFIRM_REPLY.
*/
if (n_read >= 1 && n_read < (os_memsz)sizeof(buf))
if (buf[n_read-1] == IOC_SERIAL_CONNECT_REPLY)
{
/* Send confirm character.
*/
osal_stream_write(con->stream, (os_char*)&confirm_char, 1,
&n_written, OSAL_STREAM_DEFAULT);
osal_debug_assert(n_written == 1);
/* Start timer.
*/
os_get_timer(&con->sercon_timer);
con->sercon_state = OSAL_SERCON_STATE_INIT_3;
break;
}
/* If time out while waiting for CONNECT_REPLY, start over.
*/
if (os_has_elapsed(&con->sercon_timer, IOC_SERIAL_CONNECT_PERIOD_MS))
{
con->sercon_state = OSAL_SERCON_STATE_INIT_1;
}
break;
case OSAL_SERCON_STATE_INIT_3:
/* Try to read a character. Now we read only one character
because other end may start sending acual data immediately
after confirm character.
*/
osal_stream_read(con->stream, (os_char*)buf, 1,
&n_read, OSAL_STREAM_DEFAULT);
/* If CONFIRM_REPLY character received, clear connection
state and move on to data transfer.
*/
if (n_read == 1 && buf[0] == IOC_SERIAL_CONFIRM_REPLY)
{
ioc_reset_connection_state(con);
con->sercon_state = OSAL_SERCON_STATE_CONNECTED_5;
ioc_unlock(root);
return OSAL_SUCCESS;
}
/* If time out while waiting for CONFIRMT_REPLY, start over.
*/
if (os_has_elapsed(&con->sercon_timer, IOC_SERIAL_CONNECT_PERIOD_MS) /* || n_read */)
{
con->sercon_state = OSAL_SERCON_STATE_INIT_1;
}
break;
}
}
/* Server end of the connection.
*/
else
{
switch (con->sercon_state)
{
default:
case OSAL_SERCON_STATE_INIT_1:
osal_stream_write(con->stream, (os_char*)&disconnect_char, 1,
&n_written, OSAL_STREAM_DEFAULT);
osal_debug_assert(n_written == 1);
con->sercon_state = OSAL_SERCON_STATE_INIT_2;
break;
case OSAL_SERCON_STATE_INIT_2:
osal_stream_flush(con->stream,
OSAL_STREAM_CLEAR_RECEIVE_BUFFER|
OSAL_STREAM_CLEAR_TRANSMIT_BUFFER);
con->sercon_state = OSAL_SERCON_STATE_INIT_3;
break;
case OSAL_SERCON_STATE_INIT_3:
/* Try to read a character.
*/
osal_stream_read(con->stream, (os_char*)buf, sizeof(buf),
&n_read, OSAL_STREAM_DEFAULT);
/* If last character received is CONNECT character, then send
CONNECT_REPLY character and start wait for CONFIRM.
*/
if (n_read >= 1 && n_read < (os_memsz)sizeof(buf))
if (buf[n_read-1] == IOC_SERIAL_CONNECT)
{
/* Send connect reply character.
*/
osal_stream_write(con->stream, (os_char*)&connect_reply_char, 1,
&n_written, OSAL_STREAM_DEFAULT);
osal_debug_assert(n_written == 1);
con->sercon_state = OSAL_SERCON_STATE_INIT_4;
}
break;
case OSAL_SERCON_STATE_INIT_4:
/* Try to read a character.
*/
osal_stream_read(con->stream, (os_char*)buf, sizeof(buf),
&n_read, OSAL_STREAM_DEFAULT);
/* If last character received is CONFIRM character, then send
CONNECT_REPLY character and start wait for CONFIRM.
*/
if (n_read == 1 && buf[0] == IOC_SERIAL_CONFIRM)
{
/* Send confirm reply character.
*/
osal_stream_write(con->stream, (os_char*)&confirm_reply_char, 1,
&n_written, OSAL_STREAM_DEFAULT);
osal_debug_assert(n_written == 1);
ioc_reset_connection_state(con);
con->sercon_state = OSAL_SERCON_STATE_CONNECTED_5;
ioc_unlock(root);
return OSAL_SUCCESS;
}
/* If we received something else but confirm, not good.
Go back to waiting for CONNECT charcter.
*/
if (n_read)
{
con->sercon_state = OSAL_SERCON_STATE_INIT_3;
}
break;
}
}
/* Still establishing serial connection.
*/
ioc_unlock(root);
return OSAL_PENDING;
}
#endif
| 35.212245 | 101 | 0.516402 | [
"object"
] |
e3487e4cae1b25b0ce7afb4f4f8f3847a71fa57e | 4,738 | h | C | Filters/ParallelDIY2/vtkDIYKdTreeUtilities.h | dsleep/VTK | cbf9c453cf50a954ab5d6a2448b8a0391bde9378 | [
"BSD-3-Clause"
] | 1 | 2020-03-24T14:08:58.000Z | 2020-03-24T14:08:58.000Z | Filters/ParallelDIY2/vtkDIYKdTreeUtilities.h | dsleep/VTK | cbf9c453cf50a954ab5d6a2448b8a0391bde9378 | [
"BSD-3-Clause"
] | null | null | null | Filters/ParallelDIY2/vtkDIYKdTreeUtilities.h | dsleep/VTK | cbf9c453cf50a954ab5d6a2448b8a0391bde9378 | [
"BSD-3-Clause"
] | 2 | 2020-03-24T14:09:05.000Z | 2021-09-17T09:30:26.000Z | /*=========================================================================
Program: Visualization Toolkit
Module: vtkDIYKdTreeUtilities.h
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.
=========================================================================*/
/**
* @class vtkDIYKdTreeUtilities
* @brief collection of utility functions for DIY-based KdTree algorithm
*
* vtkDIYKdTreeUtilities is intended for use by vtkRedistributeDataSetFilter. It
* encapsulates invocation of DIY algorithms for various steps in the
* vtkRedistributeDataSetFilter.
*/
#ifndef vtkDIYKdTreeUtilities_h
#define vtkDIYKdTreeUtilities_h
#include "vtkBoundingBox.h" // for vtkBoundingBox
#include "vtkFiltersParallelDIY2Module.h" // for export macros
#include "vtkObject.h"
#include "vtkSmartPointer.h" // for vtkSmartPointer
#include <vector> // for std::vector
class vtkDataObject;
class vtkDataSet;
class vtkIntArray;
class vtkMultiProcessController;
class vtkPartitionedDataSet;
class vtkPoints;
class vtkUnstructuredGrid;
class VTKFILTERSPARALLELDIY2_EXPORT vtkDIYKdTreeUtilities : public vtkObject
{
public:
vtkTypeMacro(vtkDIYKdTreeUtilities, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Given a dataset (or a composite dataset), this method will generate box
* cuts in the domain to approximately load balance the points (or
* cell-centers) into `number_of_partitions` requested. If `controller` is non-null,
* the operation will be performed taking points on the multiple ranks into consideration.
*
* Returns a vector a bounding boxes that can be used to partition the points
* into load balanced chunks. The size of the vector is greater than or equal
* to the `number_of_partitions`.
*/
static std::vector<vtkBoundingBox> GenerateCuts(vtkDataObject* dobj, int number_of_partitions,
bool use_cell_centers, vtkMultiProcessController* controller = nullptr);
/**
* Given a collection of points, this method will generate box cuts in the
* domain to approximately load balance the points into `number_of_partitions`
* requested. If `controller` is non-null, the operation will be performed
* taking points on the multiple ranks into consideration.
*
* `local_bounds` provides the local domain bounds. If not specified, domain
* bounds will be computed using the points provided.
*
* Returns a vector a bounding boxes that can be used to partition the points
* into load balanced chunks. The size of the vector is greater than or equal
* to the `number_of_partitions`.
*/
static std::vector<vtkBoundingBox> GenerateCuts(
const std::vector<vtkSmartPointer<vtkPoints> >& points, int number_of_partitions,
vtkMultiProcessController* controller = nullptr, const double* local_bounds = nullptr);
/**
* Exchange parts in the partitioned dataset among ranks in the parallel group
* defined by the `controller`. The parts are assigned to ranks in a
* contiguous fashion.
*
* This method assumes that the input vtkPartitionedDataSet will have exactly
* same number of partitions on all ranks. This is assumed since the
* partitions' index is what dictates which rank it is assigned to.
*
* The returned vtkPartitionedDataSet will also have exactly as many
* partitions as the input vtkPartitionedDataSet, however only the partitions
* assigned to this current rank may be non-null.
*/
static vtkSmartPointer<vtkPartitionedDataSet> Exchange(
vtkPartitionedDataSet* parts, vtkMultiProcessController* controller);
/**
* Generates and adds global cell ids to datasets in `parts`. One this to note
* that this method does not assign valid global ids to ghost cells. This may
* not be adequate for general use, however for vtkRedistributeDataSetFilter
* this is okay since the ghost cells in the input are anyways discarded when
* the dataset is being split based on the cuts provided. This simplifies the
* implementation and reduces communication.
*/
static bool GenerateGlobalCellIds(vtkPartitionedDataSet* parts,
vtkMultiProcessController* controller, vtkIdType* mb_offset = nullptr);
protected:
vtkDIYKdTreeUtilities();
~vtkDIYKdTreeUtilities() override;
private:
vtkDIYKdTreeUtilities(const vtkDIYKdTreeUtilities&) = delete;
void operator=(const vtkDIYKdTreeUtilities&) = delete;
};
#endif
| 41.561404 | 96 | 0.73913 | [
"vector"
] |
e34c25068f40cc14bab41e8890253bf1c19cbd37 | 6,650 | h | C | gcc/strlib/strlib.h | razzlefratz/MotleyTools | 3c69c574351ce6f4b7e687c13278d4b6cbb200f3 | [
"0BSD"
] | 2 | 2015-10-15T19:32:42.000Z | 2021-12-20T15:56:04.000Z | gcc/strlib/strlib.h | razzlefratz/MotleyTools | 3c69c574351ce6f4b7e687c13278d4b6cbb200f3 | [
"0BSD"
] | null | null | null | gcc/strlib/strlib.h | razzlefratz/MotleyTools | 3c69c574351ce6f4b7e687c13278d4b6cbb200f3 | [
"0BSD"
] | null | null | null | /*====================================================================*
*
* strlib.h - custom string constants, structures, functions and macros;
*
*. Motley Tools by Charles Maier
*: modified sun 07 sep 03 by user root on host zeus;
*; Licensed under the Internet Software Consortium License
*
*--------------------------------------------------------------------*/
#ifndef STRLIB_HEADER
#define STRLIB_HEADER
/*====================================================================*
* system header files;
*--------------------------------------------------------------------*/
#include <sys/types.h>
/*====================================================================*
* custom header files;
*--------------------------------------------------------------------*/
#include "../tools/types.h"
/*====================================================================*
* declare custom string function prototypes;
*--------------------------------------------------------------------*/
char * strlwr (char * string);
char * strupr (char * string);
char * stresc (char * string);
char * struesc (char * string);
char * strpcat (char * target, char const * source);
char * strpcpy (char * target, char const * source);
char * strnpcat (char * target, char const * source, size_t size);
char * strnpcpy (char * target, char const * source, size_t size);
char * strcpyn (char buffer [], size_t length, char const * source, size_t count);
char * strcatn (char buffer [], size_t length, char const * source, size_t count);
size_t strrcpy (char buffer [], size_t length, char const * string);
signed stricmp (char const *, char const *);
signed strucmp (char const *, char const *);
signed strlcmp (char const *, char const *);
signed strmcmp (char const *, char const *, signed convert (signed));
signed strdictcmp (char const *, char const *);
signed strxcmp (char const *, char const *, const unsigned char table []);
signed strvercmp (char const *, char const *, signed c);
signed strpkgcmp (char const *, char const *, unsigned c);
bool strwcmp (char const * string, char const * pattern, char const * charset);
bool ischarset (char const * string, char const * charset);
size_t strselect (char * string, char const * charset);
size_t strremove (char * string, char const * charset);
char * strcut (char * string, const unsigned c);
char * strrcut (char * string, const unsigned c);
char * strvis (char * string, char const c);
char * strend (char const * string);
char const * strpfx (char const * string, char const * prefix);
char const * strsfx (char const * string, char const * suffix);
char * strtrim (char buffer []);
char * strmin (char buffer [], char const * punct, char const * space, char const * trash);
char * strmap (char buffer [], char const * charset1, char const * charset2);
char * strcap (char buffer [], char const * charset);
char * strcrlf (char buffer [], char const * source, const int mode);
size_t strnchr (char const * string, char const * charset);
unsigned long strint (char const * string, char const * digits);
signed strcomp (char const *, char const *, unsigned char compare (unsigned c));
char * strconv (char * string, unsigned char convert (unsigned c));
signed strtoken (char buffer [], size_t length, char const ** string);
/*====================================================================*
* declare custom string function prototypes;
*--------------------------------------------------------------------*/
#define __strlen(sp) (strchr((sp),(char)(0))-(sp))
#define _strend(sp) (strchr((sp),(char)(0)))
#define _strtrim(sp) (strmin((sp),(char * )(0)," ",(char * )(0)))
#define _strpcat(bp,sp) (strchr(strcat((bp),(sp)),(char)(0)))
#define _strnpcat(bp,sp,n) (strchr(strncat((bp),(sp),(n)),(char)(0)))
#define _strpcpy(bp,sp) (strchr(strcpy((bp),(sp)),(char)(0)))
#define _strnpcpy(bp,sp,n) (strchr(strncpy((bp),(sp),(n)),(char)(0)))
/*====================================================================*
*
*--------------------------------------------------------------------*/
void svprint (char const * vector []);
size_t svindex (char const * string, char const * vector [], size_t length, signed comp (char const *, char const *));
size_t svfirst (char const * string, char const * vector [], size_t length, signed comp (char const *, char const *));
size_t svfinal (char const * string, char const * vector [], size_t length, signed comp (char const *, char const *));
void svorder (char const * string, char const * vector [], size_t length, signed comp (char const *, char const *));
size_t str2argv (char string [], char const * vector [], size_t length);
size_t strvsplit (char * vector [], char buffer []);
size_t strargv (size_t argc, char const * argv [], char buffer [], signed c);
char const * strenv (char const * vector [], char const * string, signed c);
char * *stov (char * string);
size_t strsplit (char const * vector [], size_t length, char buffer [], signed c);
size_t strmerge (char buffer [], size_t length, char const * vector [], signed c);
size_t strpart (char const * vector [], char buffer [], signed c);
size_t strjoin (char const * vector [], char buffer [], signed c);
/*====================================================================*
*
*--------------------------------------------------------------------*/
char * strfield (char buffer [], char const * string, char const * charset);
size_t strfcsv (char buffer [], size_t length, char const * vector [], char const * oper, char const * quote);
size_t strfbits (char buffer [], size_t length, char const * vector [], char const * oper, unsigned flagword);
size_t strfbin (char buffer [], size_t length, const byte memory [], size_t extent, unsigned extender);
size_t strfhex (char buffer [], size_t length, const byte memory [], size_t extent, unsigned extender);
size_t strfascii (char buffer [], size_t length, unsigned c);
size_t strfcntrl (char buffer [], size_t length, unsigned c);
size_t strfglyph (char buffer [], size_t length, unsigned c);
size_t strfunix (char buffer [], size_t length, unsigned c);
size_t strfietf (char buffer [], size_t length, unsigned c);
/*====================================================================*
*
*--------------------------------------------------------------------*/
#ifndef empty
#define empty(s) (((s)==(char * )(0))||(*(s)==(char)(0)))
#endif
#ifndef valid
#define valid(s) (((s)!=(char * )(0))&&(*(s)=!(char)(0)))
#endif
/*====================================================================*
* end definition;
*--------------------------------------------------------------------*/
#endif
| 49.259259 | 118 | 0.551128 | [
"vector"
] |
e34c966ae975a48e3eaa20936361d986caf7fc40 | 3,937 | h | C | src/openms/include/OpenMS/DATASTRUCTURES/Date.h | freestyle076/MyOpenMS | 99a484ce8fe598a95934e782f3ec47acab33c013 | [
"Zlib",
"Apache-2.0"
] | 1 | 2018-03-06T14:12:09.000Z | 2018-03-06T14:12:09.000Z | src/openms/include/OpenMS/DATASTRUCTURES/Date.h | freestyle076/MyOpenMS | 99a484ce8fe598a95934e782f3ec47acab33c013 | [
"Zlib",
"Apache-2.0"
] | null | null | null | src/openms/include/OpenMS/DATASTRUCTURES/Date.h | freestyle076/MyOpenMS | 99a484ce8fe598a95934e782f3ec47acab33c013 | [
"Zlib",
"Apache-2.0"
] | null | null | null | // --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2016.
//
// This software is released under a three-clause BSD license:
// * 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 any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// 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 ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS 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.
//
// --------------------------------------------------------------------------
// $Maintainer: Timo Sachsenberg$
// $Authors: Marc Sturm $
// --------------------------------------------------------------------------
#ifndef OPENMS_DATASTRUCTURES_DATE_H
#define OPENMS_DATASTRUCTURES_DATE_H
#include <OpenMS/CONCEPT/Types.h>
#include <OpenMS/DATASTRUCTURES/String.h>
#include <OpenMS/OpenMSConfig.h>
#include <QtCore/QDate>
namespace OpenMS
{
/**
@brief Date Class.
This class implements date handling.
Import and export to/from both string and integers is possible.
@ingroup Datastructures
*/
class OPENMS_DLLAPI Date :
public QDate
{
public:
/**
@brief Default constructor
Fills the object with an undefined date: 00/00/0000
*/
Date();
/// Copy constructor
Date(const Date& date);
/// Copy constructor from Qt base class
Date(const QDate& date);
/// Assignment operator
Date& operator=(const Date& source);
/**
@brief sets data from a string
The following date formats are supported:
- mm/dd/yyyy
- dd.mm.yyyy
- yyyy-mm-dd
@exception Exception::ParseError is thrown if the date is given in the wrong format
*/
void set(const String& date);
/**
@brief sets data from three integers
@exception Exception::ParseError is thrown if an invalid date is given
*/
void set(UInt month, UInt day, UInt year);
/// Returns the current date
static Date today();
/**
@brief Returns a string representation of the date
Uses the iso/ansi date format: 'yyyy-mm-dd'
*/
String get() const;
/**
@brief Fills the arguments with the date
Give the numbers in the following order: month, day and year.
*/
void get(UInt& month, UInt& day, UInt& year) const;
///Sets the undefined date: 00/00/0000
void clear();
protected:
};
} // namespace OPENMS
#endif // OPENMS_DATASTRUCTURES_DATE_H
| 33.649573 | 91 | 0.629159 | [
"object"
] |
e34c9c0521d7c7df5ae70a112182bda94efdb10a | 6,716 | h | C | src/mempool/include/mempool_allocator.h | isrc-cas/openarkcompiler | 35bdd8d940af7f19c30dee32e1c26969f3e24dc8 | [
"MulanPSL-1.0"
] | 80 | 2019-09-15T04:32:05.000Z | 2022-02-26T03:27:10.000Z | src/mempool/include/mempool_allocator.h | isrc-cas/openarkcompiler | 35bdd8d940af7f19c30dee32e1c26969f3e24dc8 | [
"MulanPSL-1.0"
] | 2 | 2019-09-20T14:06:40.000Z | 2020-04-03T05:37:17.000Z | src/mempool/include/mempool_allocator.h | isrc-cas/openarkcompiler | 35bdd8d940af7f19c30dee32e1c26969f3e24dc8 | [
"MulanPSL-1.0"
] | 18 | 2019-09-15T10:06:42.000Z | 2021-03-19T08:29:33.000Z | /*
* Copyright (c) [2019] Huawei Technologies Co.,Ltd.All rights reserved.
*
* OpenArkCompiler is licensed under the Mulan PSL v1.
* You can use this software according to the terms and conditions of the Mulan PSL v1.
* You may obtain a copy of Mulan PSL v1 at:
*
* http://license.coscl.org.cn/MulanPSL
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR
* FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v1 for more details.
*/
#ifndef MEMPOOL_INCLUDE_MEMPOOL_ALLOCATOR_H
#define MEMPOOL_INCLUDE_MEMPOOL_ALLOCATOR_H
#include <stddef.h>
#include <limits>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <forward_list>
#include "mempool.h"
namespace maple {
template <typename T>
class MapleAllocatorAdapter; // circular dependency exists, no other choice
class MapleAllocator {
public:
explicit MapleAllocator(MemPool *m) : memPool(m) {}
virtual ~MapleAllocator() {}
// Get adapter for use in STL containers. See arena_containers.h .
MapleAllocatorAdapter<void> Adapter();
void *Alloc(size_t bytes) {
return (memPool ? memPool->Malloc(bytes) : nullptr);
}
MemPool *GetMemPool() {
return memPool;
}
void SetMemPool(MemPool *m) {
memPool = m;
}
private:
MemPool *memPool;
template <typename U>
friend class MapleAllocatorAdapter;
}; // MapleAllocator
template <typename T>
class MapleAllocatorAdapter; // circular dependency exists, no other choice
template <typename T>
using MapleQueue = std::deque<T, MapleAllocatorAdapter<T>>;
template <typename T>
using MapleVector = std::vector<T, MapleAllocatorAdapter<T>>;
template <typename T>
class MapleStack {
public:
using size_type = typename MapleVector<T>::size_type;
using iterator = typename MapleVector<T>::iterator;
public:
MapleStack(MapleAllocatorAdapter<T> adapter) : vect(adapter) {}
~MapleStack() = default;
MapleVector<T> &GetVector() {
return vect;
}
bool empty() const {
return vect.empty();
}
size_type size() const {
return vect.size();
}
iterator begin() {
return vect.begin();
}
iterator end() {
return vect.end();
}
void push(T x) {
vect.push_back(x);
}
void pop() {
vect.pop_back();
}
T top() {
return vect.back();
}
void clear() {
vect.resize(0);
}
private:
MapleVector<T> vect;
};
template <typename T>
using MapleList = std::list<T, MapleAllocatorAdapter<T>>;
template <typename T>
using MapleForwardList = std::forward_list<T, MapleAllocatorAdapter<T>>;
template <typename T, typename Comparator = std::less<T>>
using MapleSet = std::set<T, Comparator, MapleAllocatorAdapter<T>>;
template <typename T, typename Hash = std::hash<T>, typename Equal = std::equal_to<T>>
using MapleUnorderedSet = std::unordered_set<T, Hash, Equal, MapleAllocatorAdapter<T>>;
template <typename K, typename V, typename Comparator = std::less<K>>
using MapleMap = std::map<K, V, Comparator, MapleAllocatorAdapter<std::pair<const K, V>>>;
template <typename K, typename V, typename Comparator = std::less<K>>
using MapleMultiMap = std::multimap<K, V, Comparator, MapleAllocatorAdapter<std::pair<const K, V>>>;
template <typename K, typename V, typename Hash = std::hash<K>, typename Equal = std::equal_to<K>>
using MapleUnorderedMap = std::unordered_map<K, V, Hash, Equal, MapleAllocatorAdapter<std::pair<const K, V>>>;
template <typename K, typename V, typename Hash = std::hash<K>, typename Equal = std::equal_to<K>>
using MapleUnorderedMultiMap = std::unordered_multimap<K, V, Hash, Equal, MapleAllocatorAdapter<std::pair<const K, V>>>;
// Implementation details below.
template <>
class MapleAllocatorAdapter<void> {
public:
using value_type = void;
using pointer = void*;
using const_pointer = const void*;
template <typename U>
struct rebind {
using other = MapleAllocatorAdapter<U>;
};
explicit MapleAllocatorAdapter(MapleAllocator &currMapleAllocator) : mapleAllocator(&currMapleAllocator) {}
template <typename U>
MapleAllocatorAdapter(const MapleAllocatorAdapter<U> &other) : mapleAllocator(other.mapleAllocator) {}
MapleAllocatorAdapter(const MapleAllocatorAdapter &other) = default;
MapleAllocatorAdapter &operator=(const MapleAllocatorAdapter &other) = default;
~MapleAllocatorAdapter() = default;
private:
MapleAllocator *mapleAllocator;
template <typename U>
friend class MapleAllocatorAdapter;
};
template <typename T>
class MapleAllocatorAdapter {
public:
using value_type = T;
using pointer = T*;
using reference = T&;
using const_pointer = const T*;
using const_reference = const T&;
using size_type = size_t;
using difference_type = std::ptrdiff_t;
template <typename U>
struct rebind {
using other = MapleAllocatorAdapter<U>;
};
explicit MapleAllocatorAdapter(MapleAllocator &currMapleAllocator) : mapleAllocator(&currMapleAllocator) {}
template <typename U>
MapleAllocatorAdapter(const MapleAllocatorAdapter<U> &other) : mapleAllocator(other.mapleAllocator) {}
MapleAllocatorAdapter(const MapleAllocatorAdapter &other) = default;
MapleAllocatorAdapter &operator=(const MapleAllocatorAdapter &other) = default;
~MapleAllocatorAdapter() = default;
size_type max_size() const {
return static_cast<size_type>(-1) / sizeof(T);
}
pointer address(reference x) const {
return &x;
}
const_pointer address(const_reference x) const {
return &x;
}
pointer allocate(size_type n, MapleAllocatorAdapter<void>::pointer hint = nullptr) {
return reinterpret_cast<T*>(mapleAllocator->Alloc(n * sizeof(T)));
}
void deallocate(pointer p, size_type n) {}
void construct(const pointer p, const_reference val) {
new (static_cast<void*>(p)) value_type(val);
}
void destroy(const pointer p) {
p->~value_type();
}
private:
MapleAllocator *mapleAllocator;
template <typename U>
friend class MapleAllocatorAdapter;
template <typename U>
friend bool operator==(const MapleAllocatorAdapter<U> &lhs, const MapleAllocatorAdapter<U> &rhs);
};
template <typename T>
inline bool operator==(const MapleAllocatorAdapter<T> &lhs, const MapleAllocatorAdapter<T> &rhs) {
return lhs.mapleAllocator == rhs.mapleAllocator;
}
template <typename T>
inline bool operator!=(const MapleAllocatorAdapter<T> &lhs, const MapleAllocatorAdapter<T> &rhs) {
return !(lhs == rhs);
}
inline MapleAllocatorAdapter<void> MapleAllocator::Adapter() {
return MapleAllocatorAdapter<void>(*this);
}
} // namespace maple
#endif // MEMPOOL_INCLUDE_MEMPOOL_ALLOCATOR_H
| 29.2 | 120 | 0.729303 | [
"vector"
] |
e34cce9167608f8029bf9fbe4bbfcb33e7416c11 | 27,617 | h | C | src/cnv.h | cvlvxi/delly | 8e3ccee9aab62101fb9f573d75b51b64f0aacf10 | [
"BSD-3-Clause"
] | null | null | null | src/cnv.h | cvlvxi/delly | 8e3ccee9aab62101fb9f573d75b51b64f0aacf10 | [
"BSD-3-Clause"
] | null | null | null | src/cnv.h | cvlvxi/delly | 8e3ccee9aab62101fb9f573d75b51b64f0aacf10 | [
"BSD-3-Clause"
] | null | null | null | #ifndef CNV_H
#define CNV_H
#include <boost/filesystem.hpp>
#include <boost/multi_array.hpp>
#include <boost/progress.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/unordered_map.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/tokenizer.hpp>
#include <boost/math/distributions/chi_squared.hpp>
#include <boost/math/distributions/hypergeometric.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/zlib.hpp>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics.hpp>
#include <htslib/faidx.h>
#include <htslib/vcf.h>
#include <htslib/sam.h>
#include "util.h"
namespace torali
{
struct SVBreakpoint {
int32_t pos;
int32_t cilow;
int32_t cihigh;
int32_t qual;
explicit SVBreakpoint(int32_t const p) : pos(p), cilow(0), cihigh(0), qual(0) {}
SVBreakpoint(int32_t const p, int32_t const cil, int32_t const cih, int32_t q) : pos(p), cilow(cil), cihigh(cih), qual(q) {}
};
template<typename TSVBp>
struct SortSVBreakpoint : public std::binary_function<TSVBp, TSVBp, bool>
{
inline bool operator()(TSVBp const& sv1, TSVBp const& sv2) {
return ((sv1.pos<sv2.pos) || ((sv1.pos==sv2.pos) && (sv1.qual<sv2.qual)));
}
};
struct BpCNV {
int32_t start;
int32_t end;
double zscore;
BpCNV(int32_t const s, int32_t const e, double const z) : start(s), end(e), zscore(z) {}
};
template<typename TConfig>
inline void
mergeCNVs(TConfig const& c, std::vector<CNV>& chrcnv, std::vector<CNV>& cnvs) {
// Merge neighboring segments if too similar
bool merged = true;
std::vector<CNV> newcnv;
while(merged) {
int32_t k = -1;
for(int32_t i = 0; i < (int32_t) chrcnv.size(); ++i) {
if (i <= k) continue;
k = i;
for(int32_t j = i + 1; j < (int32_t) chrcnv.size(); ++j) {
bool allValid = true;
for(int32_t pre = i; pre < j; ++pre) {
double diff = std::abs(chrcnv[pre].cn - chrcnv[j].cn);
if (diff >= c.cn_offset) {
allValid = false;
break;
}
}
if (allValid) k = j;
else break;
}
if (k > i) {
// Merge
double cn = (chrcnv[i].cn + chrcnv[k].cn) / 2.0;
double mp = (chrcnv[i].mappable + chrcnv[k].mappable) / 2.0;
newcnv.push_back(CNV(chrcnv[i].chr, chrcnv[i].start, chrcnv[k].end, chrcnv[i].ciposlow, chrcnv[i].ciposhigh, chrcnv[k].ciendlow, chrcnv[k].ciendhigh, cn, mp));
} else {
newcnv.push_back(chrcnv[i]);
}
}
if (newcnv.size() == chrcnv.size()) merged = false;
else {
chrcnv = newcnv;
newcnv.clear();
}
}
// Insert into global CNV vector
for(uint32_t i = 0; i < chrcnv.size(); ++i) {
cnvs.push_back(chrcnv[i]);
//std::cerr << chrcnv[i].chr << '\t' << chrcnv[i].start << '\t' << chrcnv[i].end << "\tMerged" << std::endl;
}
}
template<typename TConfig, typename TGcBias, typename TCoverage, typename TGenomicBreakpoints>
inline void
breakpointRefinement(TConfig const& c, std::pair<uint32_t, uint32_t> const& gcbound, std::vector<uint16_t> const& gcContent, std::vector<uint16_t> const& uniqContent, TGcBias const& gcbias, TCoverage const& cov, bam_hdr_t const* hdr, int32_t const refIndex, TGenomicBreakpoints const& svbp, std::vector<CNV>& cnvs) {
typedef typename TGenomicBreakpoints::value_type TSVs;
// Estimate CN shift
for(uint32_t n = 1; n < cnvs.size(); ++n) {
if ((cnvs[n-1].chr != refIndex) || (cnvs[n].chr != refIndex)) continue;
double precovsum = 0;
double preexpcov = 0;
double succovsum = 0;
double sucexpcov = 0;
int32_t pos = cnvs[n-1].start;
while((pos < cnvs[n].end) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
if (pos < cnvs[n-1].end) {
precovsum += cov[pos];
preexpcov += gcbias[gcContent[pos]].coverage;
} else {
succovsum += cov[pos];
sucexpcov += gcbias[gcContent[pos]].coverage;
}
}
++pos;
}
double precndiff = std::abs((c.ploidy * precovsum / preexpcov) - (c.ploidy * succovsum / sucexpcov));
// Intersect with delly SVs
typename TSVs::const_iterator itbest = svbp[refIndex].end();
int32_t searchStart = std::max(0, std::min(cnvs[n-1].ciendlow, cnvs[n-1].end - 1000));
int32_t searchEnd = std::max(cnvs[n].ciposhigh, cnvs[n].start + 1000);
int32_t midpoint = (int32_t) ((cnvs[n-1].start + cnvs[n-1].end) / 2);
if (searchStart < midpoint) searchStart = midpoint;
midpoint = (int32_t) ((cnvs[n].start + cnvs[n].end) / 2);
if (searchEnd > midpoint) searchEnd = midpoint;
// Current CNV start for this breakpoint
typename TSVs::const_iterator itsv = std::lower_bound(svbp[refIndex].begin(), svbp[refIndex].end(), SVBreakpoint(searchStart), SortSVBreakpoint<SVBreakpoint>());
for(; itsv != svbp[refIndex].end(); ++itsv) {
if (itsv->pos > searchEnd) break;
if ((itbest == svbp[refIndex].end()) || (itsv->qual > itbest->qual)) itbest = itsv;
}
if ((itbest != svbp[refIndex].end()) && (itbest->qual >= 50)) {
// Check refined CNV
precovsum = 0;
preexpcov = 0;
succovsum = 0;
sucexpcov = 0;
pos = cnvs[n-1].start;
while((pos < cnvs[n].end) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
if (pos < itbest->pos) {
precovsum += cov[pos];
preexpcov += gcbias[gcContent[pos]].coverage;
} else {
succovsum += cov[pos];
sucexpcov += gcbias[gcContent[pos]].coverage;
}
}
++pos;
}
double postcndiff = std::abs((c.ploidy * precovsum / preexpcov) - (c.ploidy * succovsum / sucexpcov));
//std::cerr << cnvs[n-1].end << ',' << itbest->pos << ',' << precndiff << ',' << postcndiff << std::endl;
if ((precndiff < postcndiff + c.cn_offset) && (std::abs(cnvs[n].start - itbest->pos) < 50000)) {
// Accept new breakpoint
cnvs[n-1].end = itbest->pos;
cnvs[n].start = itbest->pos;
cnvs[n-1].ciendlow = itbest->pos + itbest->cilow;
cnvs[n-1].ciendhigh = itbest->pos + itbest->cihigh;
cnvs[n].ciposlow = itbest->pos + itbest->cilow;
cnvs[n].ciposhigh = itbest->pos + itbest->cihigh;
}
}
}
}
template<typename TConfig, typename TGcBias, typename TCoverage>
inline void
breakpointRefinement2(TConfig const& c, std::pair<uint32_t, uint32_t> const& gcbound, std::vector<uint16_t> const& gcContent, std::vector<uint16_t> const& uniqContent, TGcBias const& gcbias, TCoverage const& cov, bam_hdr_t const* hdr, int32_t const refIndex, std::vector<CNV>& cnvs) {
int32_t maxbpshift = 10000;
// Breakpoint refinement
for(uint32_t n = 1; n < cnvs.size(); ++n) {
int32_t prehalf = (cnvs[n-1].start + cnvs[n-1].end) / 2;
prehalf = std::max(cnvs[n-1].end - maxbpshift, prehalf);
int32_t suchalf = (cnvs[n].start + cnvs[n].end) / 2;
suchalf = std::min(cnvs[n].start + maxbpshift, suchalf);
double precovsum = 0;
double preexpcov = 0;
double succovsum = 0;
double sucexpcov = 0;
int32_t pos = cnvs[n-1].start;
std::vector<int32_t> validpos;
while((pos < cnvs[n].end) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
if (pos < prehalf) {
precovsum += cov[pos];
preexpcov += gcbias[gcContent[pos]].coverage;
} else {
if (pos <= suchalf) validpos.push_back(pos);
succovsum += cov[pos];
sucexpcov += gcbias[gcContent[pos]].coverage;
}
}
++pos;
}
double precn = c.ploidy * precovsum / preexpcov;
double succn = c.ploidy * succovsum / sucexpcov;
// Shift Bp
std::vector<double> diffcn(validpos.size(), 0);
for(uint32_t idx = 0; idx < validpos.size(); ++idx) {
if ((preexpcov > 0) && (sucexpcov > 0)) {
precn = c.ploidy * precovsum / preexpcov;
succn = c.ploidy * succovsum / sucexpcov;
diffcn[idx] = std::abs(precn - succn);
//if (validpos[idx] == cnvs[n-1].end) std::cerr << "-->";
//std::cerr << validpos[idx] << ',' << precn << ',' << succn << ',' << diffcn[idx] << std::endl;
}
// Add to pre, remove from suc
precovsum += cov[validpos[idx]];
preexpcov += gcbias[gcContent[validpos[idx]]].coverage;
succovsum -= cov[validpos[idx]];
sucexpcov -= gcbias[gcContent[validpos[idx]]].coverage;
}
// Find best
int32_t bestIdx = -1;
for(uint32_t idx = 0; idx < validpos.size(); ++idx) {
if ((bestIdx == -1) || (diffcn[idx] > diffcn[bestIdx])) bestIdx = idx;
}
if (bestIdx != -1) {
// Update breakpoint
cnvs[n-1].end = validpos[bestIdx];
cnvs[n].start = validpos[bestIdx];
}
}
//for(uint32_t n = 0; n < cnvs.size(); ++n) std::cerr << hdr->target_name[cnvs[n].chr] << '\t' << cnvs[n].start << '\t' << cnvs[n].end << "\tRefinement" << std::endl;
}
template<typename TConfig, typename TGcBias, typename TCoverage>
inline void
genotypeCNVs(TConfig const& c, std::pair<uint32_t, uint32_t> const& gcbound, std::vector<uint16_t> const& gcContent, std::vector<uint16_t> const& uniqContent, TGcBias const& gcbias, TCoverage const& cov, bam_hdr_t const* hdr, int32_t const refIndex, std::vector<CNV>& cnvs) {
for(uint32_t n = 0; n < cnvs.size(); ++n) {
if (cnvs[n].chr != refIndex) continue;
double covsum = 0;
double expcov = 0;
int32_t winlen = 0;
int32_t pos = cnvs[n].start;
while((pos < cnvs[n].end) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
covsum += cov[pos];
expcov += gcbias[gcContent[pos]].coverage;
++winlen;
}
++pos;
}
double cn = c.ploidy;
if (expcov > 0) cn = c.ploidy * covsum / expcov;
double mp = (double) winlen / (double) (cnvs[n].end - cnvs[n].start);
cnvs[n].cn = cn;
cnvs[n].mappable = mp;
// Estimate SD
boost::accumulators::accumulator_set<double, boost::accumulators::features<boost::accumulators::tag::mean, boost::accumulators::tag::variance> > acc;
uint32_t wsz = winlen / 10;
if (wsz > 1) {
covsum = 0;
expcov = 0;
winlen = 0;
pos = cnvs[n].start;
while((pos < cnvs[n].end) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
covsum += cov[pos];
expcov += gcbias[gcContent[pos]].coverage;
++winlen;
if (winlen % wsz == 0) {
double cn = c.ploidy;
if (expcov > 0) cn = c.ploidy * covsum / expcov;
acc(cn);
covsum = 0;
expcov = 0;
}
}
++pos;
}
cnvs[n].sd = sqrt(boost::accumulators::variance(acc));
if (cnvs[n].sd < 0.025) cnvs[n].sd = 0.025;
} else {
// Invalid
cnvs[n].cn = -1;
cnvs[n].sd = 0.025;
}
}
}
template<typename TConfig, typename TGcBias, typename TCoverage>
inline void
callCNVs(TConfig const& c, std::pair<uint32_t, uint32_t> const& gcbound, std::vector<uint16_t> const& gcContent, std::vector<uint16_t> const& uniqContent, TGcBias const& gcbias, TCoverage const& cov, bam_hdr_t const* hdr, int32_t const refIndex, std::vector<CNV>& cnvs) {
// Parameters
int32_t smallestWin = c.minCnvSize / 10;
int32_t biggestWin = smallestWin * 200;
uint32_t chain = 10;
// Find breakpoints
std::vector<BpCNV> bpmax;
if (bpmax.empty()) {
// Scanning window sizes
std::vector<int32_t> winsize;
int32_t wsize = smallestWin;
while (wsize < biggestWin) {
winsize.push_back(wsize);
wsize *= 2;
}
// Iterate window sizes
typedef int32_t TCnVal;
typedef std::vector<TCnVal> TCN;
typedef std::vector<int32_t> TChrPos;
std::vector<BpCNV> bpvec;
for(uint32_t idx = 0; idx < winsize.size(); ++idx) {
uint32_t idxOffset = winsize[idx] / winsize[0];
//std::cerr << idx << ',' << winsize[idx] << ',' << idxOffset << ',' << bpvec.size() << ',' << hdr->target_len[refIndex] << std::endl;
TCN cnvec;
TChrPos wpos;
uint32_t wstart = 0;
while(wstart < hdr->target_len[refIndex]) {
double covsum = 0;
double expcov = 0;
int32_t winlen = 0;
uint32_t pos = wstart;
while ((winlen < winsize[idx]) && (pos < hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
covsum += cov[pos];
expcov += gcbias[gcContent[pos]].coverage;
++winlen;
}
++pos;
}
if (winlen == winsize[idx]) {
// Full window
if (expcov > 0) cnvec.push_back((int32_t) boost::math::round(c.ploidy * covsum / expcov * 100.0));
else cnvec.push_back((int32_t) boost::math::round(c.ploidy * 100.0));
wpos.push_back(wstart);
}
wstart = pos;
}
// Identify breakpoints
TCN pre(chain, -1);
TCN suc(chain, -1);
TChrPos prep(chain, 0);
TChrPos sucp(chain, 0);
uint32_t idxbp = 0;
for(uint32_t k = 0; k < cnvec.size(); ++k) {
if (k < chain) {
pre[k % chain] = cnvec[k];
prep[k % chain] = wpos[k];
if (k + 1 < cnvec.size()) {
if (idx == 0 ) bpvec.push_back(BpCNV(wpos[k], wpos[k+1], 0));
else idxbp += idxOffset;
}
} else if (k < 2 * chain) {
suc[k % chain] = cnvec[k];
sucp[k % chain] = wpos[k];
} else {
// Midpoint
TCnVal val = suc[k%chain];
int32_t pos = sucp[k%chain];
int32_t posNext = sucp[(k+1)%chain];
suc[k%chain] = cnvec[k];
sucp[k%chain] = wpos[k];
// Debug
//for(uint32_t m = 0; m < pre.size(); ++m) std::cerr << prep[m] << '\t' << pre[m] << std::endl;
//std::cerr << "M:" << pos << '\t' << val << std::endl;
//for(uint32_t m = 0; m < suc.size(); ++m) std::cerr << sucp[m] << '\t' << suc[m] << std::endl;
// Any shift in CN?
boost::accumulators::accumulator_set<TCnVal, boost::accumulators::features<boost::accumulators::tag::mean, boost::accumulators::tag::variance> > accpre;
boost::accumulators::accumulator_set<TCnVal, boost::accumulators::features<boost::accumulators::tag::mean, boost::accumulators::tag::variance> > accsuc;
for(uint32_t m = 0; m < pre.size(); ++m) accpre(pre[m]);
for(uint32_t m = 0; m < suc.size(); ++m) accsuc(suc[m]);
double diff = std::abs(boost::accumulators::mean(accsuc) - boost::accumulators::mean(accpre));
// Breakpoint candidate
double zscore = 0;
if ((diff > c.stringency * sqrt(boost::accumulators::variance(accpre))) && (diff > c.stringency * sqrt(boost::accumulators::variance(accsuc)))) {
zscore = diff / std::max(sqrt(boost::accumulators::variance(accpre)), sqrt(boost::accumulators::variance(accsuc)));
}
if (idx == 0) bpvec.push_back(BpCNV(pos, posNext, zscore));
else {
for(uint32_t sub = idxbp; sub < idxbp + idxOffset; ++sub) bpvec[sub].zscore += zscore;
idxbp += idxOffset;
}
pre[k%chain] = val;
prep[k%chain] = pos;
}
}
}
// Local maxima
if (bpvec.size()) {
int32_t pos = bpvec[0].start;
int32_t posNext = bpvec[0].end;
double bestDiff = bpvec[0].zscore;
for(uint32_t n = 1; n < bpvec.size(); ++n) {
//std::cerr << "B:" << bpvec[n].start << '-' << bpvec[n].end << ':' << bpvec[n].zscore << std::endl;
if (bpvec[n].zscore == 0) {
if (bestDiff != 0) {
//std::cerr << "M:" << pos << '-' << posNext << ':' << bestDiff << std::endl;
bpmax.push_back(BpCNV(pos, posNext, bestDiff));
pos = bpvec[n].start;
posNext = bpvec[n].end;
bestDiff = bpvec[n].zscore;
}
} else {
if (bpvec[n].zscore > bestDiff) {
// Replace local max
pos = bpvec[n].start;
posNext = bpvec[n].end;
bestDiff = bpvec[n].zscore;
} else if (bpvec[n].zscore == bestDiff) {
// Extend local max
posNext = bpvec[n].end;
}
}
}
}
}
// Breakpoints
for(uint32_t n = 0; n <= bpmax.size(); ++n) {
int32_t cil = 0;
int32_t cih = 0;
if (n > 0) {
cil = bpmax[n-1].start;
cih = bpmax[n-1].end;
}
int32_t cel = hdr->target_len[refIndex] - 1;
int32_t ceh = hdr->target_len[refIndex] - 1;
if (n < bpmax.size()) {
cel = bpmax[n].start;
ceh = bpmax[n].end;
}
//std::cerr << (cih - cil) << ';' << (ceh - cel) << std::endl;
int32_t cnvstart = (int32_t) ((cil + cih)/2);
int32_t cnvend = (int32_t) ((cel + ceh)/2);
int32_t estcnvstart = -1;
int32_t estcnvend = -1;
double covsum = 0;
double expcov = 0;
int32_t winlen = 0;
int32_t pos = cnvstart;
while((pos < cnvend) && (pos < (int32_t) hdr->target_len[refIndex])) {
if ((gcContent[pos] > gcbound.first) && (gcContent[pos] < gcbound.second) && (uniqContent[pos] >= c.fragmentUnique * c.meanisize)) {
if (estcnvstart == -1) estcnvstart = pos;
estcnvend = pos;
covsum += cov[pos];
expcov += gcbias[gcContent[pos]].coverage;
++winlen;
}
++pos;
}
if ((estcnvstart != -1) && (estcnvend != -1) && (estcnvend - estcnvstart > 0)) {
double cn = c.ploidy;
if (expcov > 0) cn = c.ploidy * covsum / expcov;
double mp = (double) winlen / (double) (estcnvend - estcnvstart);
cnvs.push_back(CNV(refIndex, estcnvstart, estcnvend, cil, cih, cel, ceh, cn, mp));
//std::cerr << hdr->target_name[refIndex] << '\t' << estcnvstart << '\t' << estcnvend << '\t' << '(' << cil << ',' << cih << ')' << '\t' << '(' << cel << ',' << ceh << ')' << '\t' << cn << '\t' << mp << std::endl;
}
}
}
// Parse Delly CNV VCF file
template<typename TConfig>
inline void
parseVcfCNV(TConfig const& c, bam_hdr_t* hd, std::vector<CNV>& cnvs) {
// Load bcf file
htsFile* ifile = bcf_open(c.genofile.string().c_str(), "r");
bcf_hdr_t* hdr = bcf_hdr_read(ifile);
bcf1_t* rec = bcf_init();
// Parse bcf
int32_t nsvend = 0;
int32_t* svend = NULL;
int32_t ncipos = 0;
int32_t* cipos = NULL;
int32_t nmp = 0;
float* mp = NULL;
int32_t nsvt = 0;
char* svt = NULL;
int32_t nmethod = 0;
char* method = NULL;
uint16_t wimethod = 0;
while (bcf_read(ifile, hdr, rec) == 0) {
bcf_unpack(rec, BCF_UN_INFO);
// Delly BCF file?
if (!wimethod) {
wimethod = 2;
if (bcf_get_info_string(hdr, rec, "SVMETHOD", &method, &nmethod) > 0) {
std::string mstr = std::string(method);
if ((mstr.size() >= 10) && (mstr.substr(0, 10) == "EMBL.DELLY")) wimethod = 1;
}
}
// Delly
if (wimethod == 1) {
// Fill SV record
CNV cnv;
std::string chrName = bcf_hdr_id2name(hdr, rec->rid);
int32_t tid = bam_name2id(hd, chrName.c_str());
cnv.chr = tid;
cnv.start = rec->pos - 1;
cnv.qval = rec->qual;
// Parse CNV type
if (bcf_get_info_string(hdr, rec, "SVTYPE", &svt, &nsvt) > 0) {
if (std::string(svt) != "CNV") continue;
} else continue;
// Parse INFO
if (bcf_get_info_int32(hdr, rec, "END", &svend, &nsvend) > 0) cnv.end = *svend;
else continue;
if (bcf_get_info_int32(hdr, rec, "CIPOS", &cipos, &ncipos) > 0) {
cnv.ciposlow = cnv.start + cipos[0];
cnv.ciposhigh = cnv.start + cipos[1];
} else {
cnv.ciposlow = cnv.start - 50;
cnv.ciposhigh = cnv.start + 50;
}
if (bcf_get_info_int32(hdr, rec, "CIEND", &cipos, &ncipos) > 0) {
cnv.ciendlow = cnv.end + cipos[0];
cnv.ciendhigh = cnv.end + cipos[1];
} else {
cnv.ciendlow = cnv.end - 50;
cnv.ciendhigh = cnv.end + 50;
}
if (bcf_get_info_float(hdr, rec, "MP", &mp, &nmp) > 0) cnv.mappable = (double) *mp;
else cnv.mappable = 0;
cnvs.push_back(cnv);
}
}
// Clean-up
free(svend);
free(svt);
free(method);
free(cipos);
free(mp);
// Close VCF
bcf_hdr_destroy(hdr);
bcf_close(ifile);
bcf_destroy(rec);
}
template<typename TConfig>
inline void
cnvVCF(TConfig const& c, std::vector<CNV> const& cnvs) {
// Open one bam file header
samFile* samfile = sam_open(c.bamFile.string().c_str(), "r");
hts_set_fai_filename(samfile, c.genome.string().c_str());
bam_hdr_t* bamhd = sam_hdr_read(samfile);
// Output all copy-number variants
htsFile *fp = hts_open(c.cnvfile.string().c_str(), "wb");
bcf_hdr_t *hdr = bcf_hdr_init("w");
// Print vcf header
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
boost::gregorian::date today = now.date();
std::string datestr("##fileDate=");
datestr += boost::gregorian::to_iso_string(today);
bcf_hdr_append(hdr, datestr.c_str());
bcf_hdr_append(hdr, "##ALT=<ID=CNV,Description=\"copy-number variants\">");
bcf_hdr_append(hdr, "##FILTER=<ID=LowQual,Description=\"Poor quality copy-number variant\">");
bcf_hdr_append(hdr, "##INFO=<ID=CIEND,Number=2,Type=Integer,Description=\"Confidence interval around END\">");
bcf_hdr_append(hdr, "##INFO=<ID=CIPOS,Number=2,Type=Integer,Description=\"Confidence interval around POS\">");
bcf_hdr_append(hdr, "##INFO=<ID=END,Number=1,Type=Integer,Description=\"End position of the copy-number variant\">");
bcf_hdr_append(hdr, "##INFO=<ID=MP,Number=1,Type=Float,Description=\"Mappable fraction of CNV\">");
bcf_hdr_append(hdr, "##INFO=<ID=IMPRECISE,Number=0,Type=Flag,Description=\"Imprecise copy-number variant\">");
bcf_hdr_append(hdr, "##INFO=<ID=SVTYPE,Number=1,Type=String,Description=\"Type of structural variant\">");
bcf_hdr_append(hdr, "##INFO=<ID=SVMETHOD,Number=1,Type=String,Description=\"Type of approach used to detect CNV\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=GT,Number=1,Type=String,Description=\"Genotype\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=CN,Number=1,Type=Integer,Description=\"Integer copy-number\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=CNL,Number=.,Type=Float,Description=\"Log10-scaled copy-number likelihoods\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=GQ,Number=1,Type=Integer,Description=\"Genotype Quality\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=FT,Number=1,Type=String,Description=\"Per-sample genotype filter\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=RDCN,Number=1,Type=Float,Description=\"Read-depth based copy-number estimate\">");
bcf_hdr_append(hdr, "##FORMAT=<ID=RDSD,Number=1,Type=Float,Description=\"Read-depth standard deviation\">");
// Add reference
std::string refloc("##reference=");
refloc += c.genome.string();
bcf_hdr_append(hdr, refloc.c_str());
for (int i = 0; i<bamhd->n_targets; ++i) {
std::string refname("##contig=<ID=");
refname += std::string(bamhd->target_name[i]) + ",length=" + boost::lexical_cast<std::string>(bamhd->target_len[i]) + ">";
bcf_hdr_append(hdr, refname.c_str());
}
// Add samples
bcf_hdr_add_sample(hdr, c.sampleName.c_str());
bcf_hdr_add_sample(hdr, NULL);
if (bcf_hdr_write(fp, hdr) != 0) std::cerr << "Error: Failed to write BCF header!" << std::endl;
uint32_t cnvid = 0;
if (!cnvs.empty()) {
// Genotype arrays
int32_t *gts = (int*) malloc(bcf_hdr_nsamples(hdr) * 2 * sizeof(int));
int32_t *gqval = (int*) malloc(bcf_hdr_nsamples(hdr) * sizeof(int));
int32_t *cnval = (int*) malloc(bcf_hdr_nsamples(hdr) * sizeof(int));
float *cnrdval = (float*) malloc(bcf_hdr_nsamples(hdr) * sizeof(float));
float *cnsdval = (float*) malloc(bcf_hdr_nsamples(hdr) * sizeof(float));
float *cnl = (float*) malloc(bcf_hdr_nsamples(hdr) * MAX_CN * sizeof(float));
std::vector<std::string> ftarr;
ftarr.resize(bcf_hdr_nsamples(hdr));
// Iterate all structural variants
now = boost::posix_time::second_clock::local_time();
std::cout << '[' << boost::posix_time::to_simple_string(now) << "] " << "Genotyping" << std::endl;
boost::progress_display show_progress( cnvs.size() );
bcf1_t *rec = bcf_init();
for(uint32_t i = 0; i < cnvs.size(); ++i) {
++show_progress;
// Invalid CNV?
if (cnvs[i].cn == -1) continue;
// Integer copy-number
int32_t absCN = (int32_t) boost::math::round(cnvs[i].cn);
if ((!c.segmentation) && (absCN == c.ploidy)) continue;
// Output main vcf fields
rec->rid = bcf_hdr_name2id(hdr, bamhd->target_name[cnvs[i].chr]);
int32_t svStartPos = cnvs[i].start + 1;
int32_t svEndPos = cnvs[i].end;
if (svEndPos >= (int32_t) bamhd->target_len[cnvs[i].chr]) svEndPos = bamhd->target_len[cnvs[i].chr] - 1;
rec->pos = svStartPos;
std::string id("CNV");
std::string padNumber = boost::lexical_cast<std::string>(++cnvid);
padNumber.insert(padNumber.begin(), 8 - padNumber.length(), '0');
id += padNumber;
bcf_update_id(hdr, rec, id.c_str());
std::string svtype = "CNV";
std::string alleles = "N,<" + svtype + ">";
bcf_update_alleles_str(hdr, rec, alleles.c_str());
// Add INFO fields
bcf_update_info_flag(hdr, rec, "IMPRECISE", NULL, 1);
bcf_update_info_string(hdr, rec, "SVTYPE", svtype.c_str());
std::string dellyVersion("EMBL.DELLYv");
dellyVersion += dellyVersionNumber;
bcf_update_info_string(hdr,rec, "SVMETHOD", dellyVersion.c_str());
int32_t tmpi = svEndPos;
bcf_update_info_int32(hdr, rec, "END", &tmpi, 1);
int32_t ciend[2];
ciend[0] = cnvs[i].ciendlow - cnvs[i].end;
ciend[1] = cnvs[i].ciendhigh - cnvs[i].end;
int32_t cipos[2];
cipos[0] = cnvs[i].ciposlow - cnvs[i].start;
cipos[1] = cnvs[i].ciposhigh - cnvs[i].start;
bcf_update_info_int32(hdr, rec, "CIPOS", cipos, 2);
bcf_update_info_int32(hdr, rec, "CIEND", ciend, 2);
float tmpf = cnvs[i].mappable;
bcf_update_info_float(hdr, rec, "MP", &tmpf, 1);
// Genotyping
cnval[0] = absCN;
cnrdval[0] = cnvs[i].cn;
cnsdval[0] = cnvs[i].sd;
gts[0] = bcf_gt_missing;
gts[1] = bcf_gt_missing;
int32_t qval = _computeCNLs(c, cnvs[i].cn, cnvs[i].sd, cnl, gqval);
if (c.hasGenoFile) rec->qual = cnvs[i].qval; // Leave site quality in genotyping mode
else rec->qual = qval;
tmpi = bcf_hdr_id2int(hdr, BCF_DT_ID, "PASS");
if (rec->qual < 15) tmpi = bcf_hdr_id2int(hdr, BCF_DT_ID, "LowQual");
bcf_update_filter(hdr, rec, &tmpi, 1);
if (gqval[0] < 15) ftarr[0] = "LowQual";
else ftarr[0] = "PASS";
std::vector<const char*> strp(bcf_hdr_nsamples(hdr));
std::transform(ftarr.begin(), ftarr.end(), strp.begin(), cstyle_str());
bcf_update_genotypes(hdr, rec, gts, bcf_hdr_nsamples(hdr) * 2);
bcf_update_format_int32(hdr, rec, "CN", cnval, bcf_hdr_nsamples(hdr));
bcf_update_format_float(hdr, rec, "CNL", cnl, bcf_hdr_nsamples(hdr) * MAX_CN);
bcf_update_format_int32(hdr, rec, "GQ", gqval, bcf_hdr_nsamples(hdr));
bcf_update_format_string(hdr, rec, "FT", &strp[0], bcf_hdr_nsamples(hdr));
bcf_update_format_float(hdr, rec, "RDCN", cnrdval, bcf_hdr_nsamples(hdr));
bcf_update_format_float(hdr, rec, "RDSD", cnsdval, bcf_hdr_nsamples(hdr));
bcf_write1(fp, hdr, rec);
bcf_clear1(rec);
}
bcf_destroy1(rec);
// Clean-up
free(gts);
free(gqval);
free(cnval);
free(cnrdval);
free(cnsdval);
free(cnl);
}
// Close BAM file
bam_hdr_destroy(bamhd);
sam_close(samfile);
// Close VCF file
bcf_hdr_destroy(hdr);
hts_close(fp);
// Build index
bcf_index_build(c.cnvfile.string().c_str(), 14);
}
}
#endif
| 37.625341 | 318 | 0.61893 | [
"vector",
"transform"
] |
87f6ee1ee288c0d6f01dba17d80ff0edbaa84c34 | 91,828 | h | C | kernelports/SAFERTOS/include/trcKernelPort.h | INCUS-Performance/TraceRecorderSource | 738d4f55e82beca7afde520fc8acd9a172b82da9 | [
"Apache-2.0"
] | 1 | 2022-02-23T02:20:35.000Z | 2022-02-23T02:20:35.000Z | kernelports/SAFERTOS/include/trcKernelPort.h | INCUS-Performance/TraceRecorderSource | 738d4f55e82beca7afde520fc8acd9a172b82da9 | [
"Apache-2.0"
] | 1 | 2021-06-15T15:39:00.000Z | 2021-06-15T15:39:00.000Z | kernelports/SAFERTOS/include/trcKernelPort.h | INCUS-Performance/TraceRecorderSource | 738d4f55e82beca7afde520fc8acd9a172b82da9 | [
"Apache-2.0"
] | 5 | 2021-05-06T15:34:04.000Z | 2022-01-21T14:22:25.000Z | /*
* Trace Recorder for Tracealyzer v4.5.2
* Copyright 2021 Percepio AB
* www.percepio.com
*
* SPDX-License-Identifier: Apache-2.0
*
* The SAFERTOS specific definitions of the trace recorder
*/
#ifndef TRC_KERNEL_PORT_H
#define TRC_KERNEL_PORT_H
#include "SafeRTOS.h" /* Defines configUSE_TRACE_FACILITY */
#include "trcPortDefines.h"
#ifdef __cplusplus
extern "C" {
#endif
#if ( configUSE_TRACE_FACILITY == 1 )
#define TRC_USE_TRACEALYZER_RECORDER 1
#else
#define TRC_USE_TRACEALYZER_RECORDER 0
#endif
#if (TRC_USE_TRACEALYZER_RECORDER == 1)
#define TRC_PLATFORM_CFG ""
#define TRC_PLATFORM_CFG_MAJOR 1
#define TRC_PLATFORM_CFG_MINOR 0
#define TRC_PLATFORM_CFG_PATCH 0
#define trcIS_TASK_VALID( pxTask ) ((pxTask != NULL) && xPortIsTaskHandleValid(pxTask))
#define trcIS_QUEUE_VALID( pxQueue ) ((pxQueue != NULL) && prvIS_QUEUE_VALID(pxQueue))
#define trcIS_TIMER_VALID( pxTimer ) ((pxTimer != NULL) && xTimerIsHandleValid(pxTimer))
#define trcIS_EVENTGROUP_VALID( pxEventGroup ) ((pxEventGroup != NULL) && prvIS_EVENT_GROUP_VALID(((eventGroupType*)pxEventGroup)))
unsigned char prvTraceIsSchedulerSuspended(void);
void* prvGetCurrentTaskHandle();
uint32_t prvGetTaskNumber(void* pxObject);
uint32_t prvGetQueueNumber(void* pxObject);
uint32_t prvGetTimerNumber(void* pxObject);
uint32_t prvGetEventGroupNumber(void* pxObject);
uint8_t prvTraceGetQueueType(void* handle);
/*******************************************************************************
* Note: Setting names for event groups is difficult to support, this has been
* excluded intentionally. This since we don't know if event_groups.c is
* included in the build, so referencing it from the recorder may cause errors.
******************************************************************************/
#define TRACE_KERNEL_VERSION 0x6AA6
#define TRACE_TICK_RATE_HZ configTICK_RATE_HZ
#define TRACE_CPU_CLOCK_HZ configCPU_CLOCK_HZ
#define TRACE_GET_CURRENT_TASK() prvGetCurrentTaskHandle()
#define TRACE_GET_OS_TICKS() (uiTraceTickCount) /* Streaming only */
#if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_Cortex_M)
#define TRACE_ALLOC_CRITICAL_SECTION() int __irq_status;
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = __get_PRIMASK(); __set_PRIMASK(1);} /* PRIMASK disables ALL interrupts - allows for tracing in any ISR */
#define TRACE_EXIT_CRITICAL_SECTION() {__set_PRIMASK(__irq_status);}
#endif
#if ((TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_ARM_CORTEX_A9) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Renesas_RX600) || (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_MICROCHIP_PIC24_PIC32))
#define TRACE_ALLOC_CRITICAL_SECTION() int __irq_status;
#define TRACE_ENTER_CRITICAL_SECTION() {__irq_status = portSET_INTERRUPT_MASK_FROM_ISR();}
#define TRACE_EXIT_CRITICAL_SECTION() {portCLEAR_INTERRUPT_MASK_FROM_ISR(__irq_status);}
#endif
#if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_Win32)
/* In the Win32 port, there are no real interrupts, so we can use the normal critical sections */
#define TRACE_ALLOC_CRITICAL_SECTION()
#define TRACE_ENTER_CRITICAL_SECTION() portENTER_CRITICAL()
#define TRACE_EXIT_CRITICAL_SECTION() portEXIT_CRITICAL()
#endif
#if (TRC_CFG_HARDWARE_PORT == TRC_HARDWARE_PORT_TEXAS_INSTRUMENTS_TMS570_RM48)
extern void prvTraceEnterCritical( void );
extern void prvTraceExitCritical ( void );
#define TRACE_ALLOC_CRITICAL_SECTION()
#define TRACE_ENTER_CRITICAL_SECTION() prvTraceEnterCritical()
#define TRACE_EXIT_CRITICAL_SECTION() prvTraceExitCritical()
#endif
#ifndef TRACE_ENTER_CRITICAL_SECTION
#error "This hardware port has no definition for critical sections! See http://percepio.com/2014/10/27/how-to-define-critical-sections-for-the-recorder/"
#endif
extern uint16_t CurrentFilterMask;
extern uint16_t CurrentFilterGroup;
#define TRACE_GET_TASK_FILTER(pxObject) TRACE_GET_HIGH16(prvGetTaskNumber(pxObject))
#define TRACE_SET_TASK_FILTER(pxObject, group) ((xTCB*)pxObject)->uxTaskNumber = TRACE_SET_HIGH16(((xTCB*)pxObject)->uxTaskNumber, group)
#define TRACE_GET_QUEUE_FILTER(pxObject) TRACE_GET_HIGH16(prvGetQueueNumber(pxObject))
#define TRACE_SET_QUEUE_FILTER(pxObject, group) ((xQUEUE*)pxObject)->uxQueueNumber = TRACE_SET_HIGH16(((xQUEUE*)pxObject)->uxQueueNumber, group)
#define TRACE_GET_TIMER_FILTER(pxObject) TRACE_GET_HIGH16(prvGetTimerNumber(pxObject))
#define TRACE_SET_TIMER_FILTER(pxObject, group) ((timerControlBlockType*)pxObject)->uxTimerNumber = TRACE_SET_HIGH16(((timerControlBlockType*)pxObject)->uxTimerNumber, group)
#define TRACE_GET_EVENTGROUP_FILTER(pxObject) TRACE_GET_HIGH16(prvGetEventGroupNumber(pxObject))
#define TRACE_SET_EVENTGROUP_FILTER(pxObject, group) ((eventGroupType*)pxObject)->uxEventGroupNumber = TRACE_SET_HIGH16(((eventGroupType*)pxObject)->uxEventGroupNumber, group)
#define TRACE_GET_OBJECT_FILTER(CLASS, pxObject) TRACE_GET_##CLASS##_FILTER(pxObject)
#define TRACE_SET_OBJECT_FILTER(CLASS, pxObject, group) TRACE_SET_##CLASS##_FILTER(pxObject, group)
/******************************************************************************/
/*** Definitions for Snapshot mode ********************************************/
/******************************************************************************/
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT)
/*******************************************************************************
* vTraceSetQueueName(void* object, const char* name)
*
* Parameter object: pointer to the Queue that shall be named
* Parameter name: the name to set (const string literal)
*
* Sets a name for Queue objects for display in Tracealyzer.
******************************************************************************/
#define vTraceSetQueueName(object, name) prvTraceSetObjectName(TRACE_CLASS_QUEUE, TRACE_GET_QUEUE_NUMBER(object), name)
/*******************************************************************************
* vTraceSetSemaphoreName(void* object, const char* name)
*
* Parameter object: pointer to the Semaphore that shall be named
* Parameter name: the name to set (const string literal)
*
* Sets a name for Semaphore objects for display in Tracealyzer.
******************************************************************************/
#define vTraceSetSemaphoreName(object, name) prvTraceSetObjectName(TRACE_CLASS_SEMAPHORE, TRACE_GET_QUEUE_NUMBER(object), name)
/*******************************************************************************
* vTraceSetMutexName(void* object, const char* name)
*
* Parameter object: pointer to the Mutex that shall be named
* Parameter name: the name to set (const string literal)
*
* Sets a name for Mutex objects for display in Tracealyzer.
******************************************************************************/
#define vTraceSetMutexName(object, name) prvTraceSetObjectName(TRACE_CLASS_MUTEX, TRACE_GET_QUEUE_NUMBER(object), name)
/*******************************************************************************
* vTraceSetEventGroupName(void* object, const char* name)
*
* Parameter object: pointer to the EventGroup that shall be named
* Parameter name: the name to set (const string literal)
*
* Sets a name for EventGroup objects for display in Tracealyzer.
******************************************************************************/
#define vTraceSetEventGroupName(object, name) prvTraceSetObjectName(TRACE_CLASS_EVENTGROUP, TRACE_GET_EVENTGROUP_NUMBER(object), name)
/*** The object classes *******************************************************/
#define TRACE_NCLASSES 7
#define TRACE_CLASS_QUEUE ((traceObjectClass)0)
#define TRACE_CLASS_TASK ((traceObjectClass)1)
#define TRACE_CLASS_ISR ((traceObjectClass)2)
#define TRACE_CLASS_TIMER ((traceObjectClass)3)
#define TRACE_CLASS_EVENTGROUP ((traceObjectClass)4)
#define TRACE_CLASS_SEMAPHORE ((traceObjectClass)5)
#define TRACE_CLASS_MUTEX ((traceObjectClass)6)
/*** Definitions for Object Table ********************************************/
#define TRACE_KERNEL_OBJECT_COUNT (TRC_CFG_NQUEUE + TRC_CFG_NTASK + TRC_CFG_NISR + TRC_CFG_NTIMER + TRC_CFG_NEVENTGROUP + TRC_CFG_NSEMAPHORE + TRC_CFG_NMUTEX)
/* Queue properties (except name): current number of message in queue */
#define PropertyTableSizeQueue (TRC_CFG_NAME_LEN_QUEUE + 1)
/* Semaphore properties (except name): state (signaled = 1, cleared = 0) */
#define PropertyTableSizeSemaphore (TRC_CFG_NAME_LEN_SEMAPHORE + 1)
/* Mutex properties (except name): owner (task handle, 0 = free) */
#define PropertyTableSizeMutex (TRC_CFG_NAME_LEN_MUTEX + 1)
/* Task properties (except name): Byte 0: Current priority
Byte 1: state (if already active)
Byte 2: legacy, not used
Byte 3: legacy, not used */
#define PropertyTableSizeTask (TRC_CFG_NAME_LEN_TASK + 4)
/* ISR properties: Byte 0: priority
Byte 1: state (if already active) */
#define PropertyTableSizeISR (TRC_CFG_NAME_LEN_ISR + 2)
/* TRC_CFG_NTIMER properties: Byte 0: state (unused for now) */
#define PropertyTableSizeTimer (TRC_CFG_NAME_LEN_TIMER + 1)
/* TRC_CFG_NEVENTGROUP properties: Byte 0-3: state (unused for now)*/
#define PropertyTableSizeEventGroup (TRC_CFG_NAME_LEN_EVENTGROUP + 4)
/* The layout of the byte array representing the Object Property Table */
#define StartIndexQueue 0
#define StartIndexTask (StartIndexQueue + (TRC_CFG_NQUEUE * PropertyTableSizeQueue))
#define StartIndexISR (StartIndexTask + (TRC_CFG_NTASK * PropertyTableSizeTask))
#define StartIndexTimer (StartIndexISR + (TRC_CFG_NISR * PropertyTableSizeISR))
#define StartIndexEventGroup (StartIndexTimer + (TRC_CFG_NTIMER * PropertyTableSizeTimer))
#define StartIndexSemaphore (StartIndexEventGroup + (TRC_CFG_NEVENTGROUP * PropertyTableSizeEventGroup))
#define StartIndexMutex (StartIndexSemaphore + (TRC_CFG_NSEMAPHORE * PropertyTableSizeSemaphore))
/* Number of bytes used by the object table */
#define TRACE_OBJECT_TABLE_SIZE (StartIndexMutex + TRC_CFG_NMUTEX * PropertyTableSizeMutex)
#if (TRC_CFG_INCLUDE_OSTICK_EVENTS == 1 && configUSE_TICKLESS_IDLE != 0)
#error "OS Tick events can not be traced in combination with tickless idle!"
#endif
/* Flag to tell the context of tracePEND_FUNC_CALL_FROM_ISR */
extern int uiInEventGroupSetBitsFromISR;
/* Initialization of the object property table */
void vTraceInitObjectPropertyTable(void);
/* Initialization of the handle mechanism, see e.g, prvTraceGetObjectHandle */
void vTraceInitObjectHandleStack(void);
/* Returns the "Not enough handles" error message for the specified object class */
const char* pszTraceGetErrorNotEnoughHandles(traceObjectClass objectclass);
/******************************************************************************
* TraceQueueClassTable
* Translates a QueueType into trace objects classes (TRACE_CLASS_).
* Has one entry for each QueueType, gives TRACE_CLASS ID.
******************************************************************************/
extern traceObjectClass TraceQueueClassTable[3];
/*** Event codes for snapshot mode - must match Tracealyzer config files ******/
#define NULL_EVENT (0x00UL) /*0x00*/
/*******************************************************************************
* EVENTGROUP_DIV
*
* Miscellaneous events.
******************************************************************************/
#define EVENTGROUP_DIV (NULL_EVENT + 1UL) /*0x01*/
#define DIV_XPS (EVENTGROUP_DIV + 0UL) /*0x01*/
#define DIV_TASK_READY (EVENTGROUP_DIV + 1UL) /*0x02*/
#define DIV_NEW_TIME (EVENTGROUP_DIV + 2UL) /*0x03*/
/*******************************************************************************
* EVENTGROUP_TS
*
* Events for storing task-switches and interrupts. The RESUME events are
* generated if the task/interrupt is already marked active.
******************************************************************************/
#define EVENTGROUP_TS (EVENTGROUP_DIV + 3UL) /*0x04*/
#define TS_ISR_BEGIN (EVENTGROUP_TS + 0UL) /*0x04*/
#define TS_ISR_RESUME (EVENTGROUP_TS + 1UL) /*0x05*/
#define TS_TASK_BEGIN (EVENTGROUP_TS + 2UL) /*0x06*/
#define TS_TASK_RESUME (EVENTGROUP_TS + 3UL) /*0x07*/
/*******************************************************************************
* EVENTGROUP_OBJCLOSE_NAME
*
* About Close Events
* When an object is evicted from the object property table (object close), two
* internal events are stored (EVENTGROUP_OBJCLOSE_NAME and
* EVENTGROUP_OBJCLOSE_PROP), containing the handle-name mapping and object
* properties valid up to this point.
******************************************************************************/
#define EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS (EVENTGROUP_TS + 4UL) /*0x08*/
/*******************************************************************************
* EVENTGROUP_OBJCLOSE_PROP
*
* The internal event carrying properties of deleted objects
* The handle and object class of the closed object is not stored in this event,
* but is assumed to be the same as in the preceding CLOSE event. Thus, these
* two events must be generated from within a critical section.
* When queues are closed, arg1 is the "state" property (i.e., number of
* buffered messages/signals).
* When actors are closed, arg1 is priority, arg2 is handle of the "instance
* finish" event, and arg3 is event code of the "instance finish" event.
* In this case, the lower three bits is the object class of the instance finish
* handle. The lower three bits are not used (always zero) when queues are
* closed since the queue type is given in the previous OBJCLOSE_NAME event.
******************************************************************************/
#define EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS (EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + 8UL) /*0x10*/
/*******************************************************************************
* EVENTGROUP_CREATE
*
* The events in this group are used to log Kernel object creations.
* The lower three bits in the event code gives the object class, i.e., type of
* create operation (task, queue, semaphore, etc).
******************************************************************************/
#define EVENTGROUP_CREATE_OBJ_TRCSUCCESS (EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + 8UL) /*0x18*/
/*******************************************************************************
* EVENTGROUP_SEND
*
* The events in this group are used to log Send/Give events on queues,
* semaphores and mutexes The lower three bits in the event code gives the
* object class, i.e., what type of object that is operated on (queue, semaphore
* or mutex).
******************************************************************************/
#define EVENTGROUP_SEND_TRCSUCCESS (EVENTGROUP_CREATE_OBJ_TRCSUCCESS + 8UL) /*0x20*/
/*******************************************************************************
* EVENTGROUP_RECEIVE
*
* The events in this group are used to log Receive/Take events on queues,
* semaphores and mutexes. The lower three bits in the event code gives the
* object class, i.e., what type of object that is operated on (queue, semaphore
* or mutex).
******************************************************************************/
#define EVENTGROUP_RECEIVE_TRCSUCCESS (EVENTGROUP_SEND_TRCSUCCESS + 8UL) /*0x28*/
/* Send/Give operations, from ISR */
#define EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS \
(EVENTGROUP_RECEIVE_TRCSUCCESS + 8UL) /*0x30*/
/* Receive/Take operations, from ISR */
#define EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS \
(EVENTGROUP_SEND_FROM_ISR_TRCSUCCESS + 8UL) /*0x38*/
/* Failed create calls - memory allocation failed */
#define EVENTGROUP_CREATE_OBJ_TRCFAILED (EVENTGROUP_RECEIVE_FROM_ISR_TRCSUCCESS + 8UL) /*0x40*/
/* Failed send/give - timeout! */
#define EVENTGROUP_SEND_TRCFAILED (EVENTGROUP_CREATE_OBJ_TRCFAILED + 8UL) /*0x48*/
/* Failed receive/take - timeout! */
#define EVENTGROUP_RECEIVE_TRCFAILED (EVENTGROUP_SEND_TRCFAILED + 8UL) /*0x50*/
/* Failed non-blocking send/give - queue full */
#define EVENTGROUP_SEND_FROM_ISR_TRCFAILED (EVENTGROUP_RECEIVE_TRCFAILED + 8UL) /*0x58*/
/* Failed non-blocking receive/take - queue empty */
#define EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED \
(EVENTGROUP_SEND_FROM_ISR_TRCFAILED + 8UL) /*0x60*/
/* Events when blocking on receive/take */
#define EVENTGROUP_RECEIVE_TRCBLOCK \
(EVENTGROUP_RECEIVE_FROM_ISR_TRCFAILED + 8UL) /*0x68*/
/* Events when blocking on send/give */
#define EVENTGROUP_SEND_TRCBLOCK (EVENTGROUP_RECEIVE_TRCBLOCK + 8UL) /*0x70*/
/* Events on queue peek (receive) */
#define EVENTGROUP_PEEK_TRCSUCCESS (EVENTGROUP_SEND_TRCBLOCK + 8UL) /*0x78*/
/* Events on object delete (vTaskDelete or vQueueDelete) */
#define EVENTGROUP_DELETE_OBJ_TRCSUCCESS (EVENTGROUP_PEEK_TRCSUCCESS + 8UL) /*0x80*/
/* Other events - object class is implied: TASK */
#define EVENTGROUP_OTHERS (EVENTGROUP_DELETE_OBJ_TRCSUCCESS + 8UL) /*0x88*/
#define TASK_DELAY_UNTIL (EVENTGROUP_OTHERS + 0UL) /*0x88*/
#define TASK_DELAY (EVENTGROUP_OTHERS + 1UL) /*0x89*/
#define TASK_SUSPEND (EVENTGROUP_OTHERS + 2UL) /*0x8A*/
#define TASK_RESUME (EVENTGROUP_OTHERS + 3UL) /*0x8B*/
#define TASK_RESUME_FROM_ISR (EVENTGROUP_OTHERS + 4UL) /*0x8C*/
#define TASK_PRIORITY_SET (EVENTGROUP_OTHERS + 5UL) /*0x8D*/
#define TASK_PRIORITY_INHERIT (EVENTGROUP_OTHERS + 6UL) /*0x8E*/
#define TASK_PRIORITY_DISINHERIT (EVENTGROUP_OTHERS + 7UL) /*0x8F*/
/* User events */
#define EVENTGROUP_USEREVENT (EVENTGROUP_OTHERS + 8UL) /*0x90*/
#define USER_EVENT (EVENTGROUP_USEREVENT + 0UL)
/* Allow for 0-15 arguments (the number of args is added to event code) */
#define USER_EVENT_LAST (EVENTGROUP_USEREVENT + 15UL) /*0x9F*/
/*******************************************************************************
* XTS Event - eXtended TimeStamp events
* The timestamps used in the recorder are "differential timestamps" (DTS), i.e.
* the time since the last stored event. The DTS fields are either 1 or 2 bytes
* in the other events, depending on the bytes available in the event struct.
* If the time since the last event (the DTS) is larger than allowed for by
* the DTS field of the current event, an XTS event is inserted immediately
* before the original event. The XTS event contains up to 3 additional bytes
* of the DTS value - the higher bytes of the true DTS value. The lower 1-2
* bytes are stored in the normal DTS field.
* There are two types of XTS events, XTS8 and XTS16. An XTS8 event is stored
* when there is only room for 1 byte (8 bit) DTS data in the original event,
* which means a limit of 0xFF (255UL). The XTS16 is used when the original event
* has a 16 bit DTS field and thereby can handle values up to 0xFFFF (65535UL).
*
* Using a very high frequency time base can result in many XTS events.
* Preferably, the time between two OS ticks should fit in 16 bits, i.e.,
* at most 65535. If your time base has a higher frequency, you can define
* the TRACE
******************************************************************************/
#define EVENTGROUP_SYS (USER_EVENT_LAST + 1UL) /*0xA0*/
#define XTS8 (EVENTGROUP_SYS + 0UL) /*0xA0*/
#define XTS16 (EVENTGROUP_SYS + 1UL) /*0xA1*/
#define EVENT_BEING_WRITTEN (EVENTGROUP_SYS + 2UL) /*0xA2*/
#define RESERVED_DUMMY_CODE (EVENTGROUP_SYS + 3UL) /*0xA3*/
#define LOW_POWER_BEGIN (EVENTGROUP_SYS + 4UL) /*0xA4*/
#define LOW_POWER_END (EVENTGROUP_SYS + 5UL) /*0xA5*/
#define XID (EVENTGROUP_SYS + 6UL) /*0xA6*/
#define XTS16L (EVENTGROUP_SYS + 7UL) /*0xA7*/
#define TASK_INSTANCE_FINISHED_NEXT_KSE (EVENTGROUP_SYS + 8UL) /*0xA8*/
#define TASK_INSTANCE_FINISHED_DIRECT (EVENTGROUP_SYS + 9UL) /*0xA9*/
#define EVENTGROUP_TIMER (EVENTGROUP_SYS + 10UL) /*0xAA*/
#define TIMER_CREATE (EVENTGROUP_TIMER + 0UL) /*0xAA*/
#define TIMER_DELETE_OBJ (EVENTGROUP_TIMER + 1UL) /*0xAB*/
#define TIMER_START (EVENTGROUP_TIMER + 2UL) /*0xAC*/
#define TIMER_STOP (EVENTGROUP_TIMER + 3UL) /*0xAD*/
#define TIMER_CHANGE_PERIOD (EVENTGROUP_TIMER + 4UL) /*0xAE*/
#define TIMER_START_FROM_ISR (EVENTGROUP_TIMER + 5UL) /*0xAF*/
#define TIMER_STOP_FROM_ISR (EVENTGROUP_TIMER + 6UL) /*0xB0*/
#define TIMER_CHANGE_PERIOD_FROM_ISR (EVENTGROUP_TIMER + 7UL) /*0xB1*/
#define TIMER_CREATE_TRCFAILED (EVENTGROUP_TIMER + 8UL) /*0xB2*/
#define TIMER_DELETE_OBJ_TRCFAILED (EVENTGROUP_TIMER + 9UL) /*0xB3*/
#define TIMER_START_TRCFAILED (EVENTGROUP_TIMER + 10UL) /*0xB4*/
#define TIMER_STOP_TRCFAILED (EVENTGROUP_TIMER + 11UL) /*0xB5*/
#define TIMER_CHANGE_PERIOD_TRCFAILED (EVENTGROUP_TIMER + 12UL) /*0xB6*/
#define TIMER_START_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 13UL) /*0xB7*/
#define TIMER_STOP_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 14UL) /*0xB8*/
#define TIMER_CHANGE_PERIOD_FROM_ISR_TRCFAILED (EVENTGROUP_TIMER + 15UL) /*0xB9*/
#define TIMER_PROCESS_START (EVENTGROUP_TIMER + 16UL) /*0xBA*/
#define TIMER_PROCESS_STOP (EVENTGROUP_TIMER + 17UL) /*0xBB*/
#define TIMER_PROCESS_CHANGE_PERIOD (EVENTGROUP_TIMER + 18UL) /*0xBC*/
#define TIMER_PROCESS_DELETE (EVENTGROUP_TIMER + 19UL) /*0xBD*/
#define TIMER_CALLBACK (EVENTGROUP_TIMER + 20UL) /*0xBE*/
#define EVENTGROUP_EG (EVENTGROUP_TIMER + 21UL) /*0xBF*/
#define EVENT_GROUP_CREATE (EVENTGROUP_EG + 0UL) /*0xBF*/
#define EVENT_GROUP_CREATE_TRCFAILED (EVENTGROUP_EG + 1UL) /*0xC0*/
#define EVENT_GROUP_DELETE_OBJ (EVENTGROUP_EG + 2UL) /*0xC1*/
#define EVENT_GROUP_DELETE_OBJ_TRCFAILED (EVENTGROUP_EG + 3UL) /*0xC2*/
#define EVENT_GROUP_SET_BITS (EVENTGROUP_EG + 4UL) /*0xC3*/
#define EVENT_GROUP_SET_BITS_TRCFAILED (EVENTGROUP_EG + 5UL) /*0xC4*/
#define EVENT_GROUP_SET_BITS_FROM_ISR (EVENTGROUP_EG + 6UL) /*0xC5*/
#define EVENT_GROUP_SET_BITS_FROM_ISR_TRCFAILED (EVENTGROUP_EG + 7UL) /*0xC6*/
#define EVENT_GROUP_WAIT_BITS (EVENTGROUP_EG + 8UL) /*0xC7*/
#define EVENT_GROUP_WAIT_BITS_TRCBLOCK (EVENTGROUP_EG + 9UL) /*0xC8*/
#define EVENT_GROUP_WAIT_BITS_TRCFAILED (EVENTGROUP_EG + 10UL) /*0xC9*/
#define EVENT_GROUP_CLEAR_BITS (EVENTGROUP_EG + 11UL) /*0xCA*/
#define EVENT_GROUP_CLEAR_BITS_TRCFAILED (EVENTGROUP_EG + 12UL) /*0xCB*/
#define EVENT_GROUP_CLEAR_BITS_FROM_ISR (EVENTGROUP_EG + 13UL) /*0xCC*/
#define EVENT_GROUP_CLEAR_BITS_FROM_ISR_TRCFAILED (EVENTGROUP_EG + 14UL) /*0xCD*/
#define TRACE_TASK_NOTIFY_GROUP (EVENTGROUP_EG + 15UL) /*0xCE*/
#define TRACE_TASK_NOTIFY_SEND_TRCSUCCESS (TRACE_TASK_NOTIFY_GROUP + 0UL) /*0xCE*/
#define TRACE_TASK_NOTIFY_SEND_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 1UL) /*0xCF*/
#define TRACE_TASK_NOTIFY_SEND_FROM_ISR_TRCSUCCESS (TRACE_TASK_NOTIFY_GROUP + 2UL) /*0xD0*/
#define TRACE_TASK_NOTIFY_SEND_FROM_ISR_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 3UL) /*0xD1*/
#define TRACE_TASK_NOTIFY_WAIT_TRCSUCCESS (TRACE_TASK_NOTIFY_GROUP + 4UL) /*0xD2*/
#define TRACE_TASK_NOTIFY_WAIT_TRCBLOCK (TRACE_TASK_NOTIFY_GROUP + 5UL) /*0xD3*/
#define TRACE_TASK_NOTIFY_WAIT_TRCFAILED (TRACE_TASK_NOTIFY_GROUP + 6UL) /*0xD4*/
#define EVENTGROUP_QUEUE_EXTRAS (TRACE_TASK_NOTIFY_GROUP + 7UL) /*0xD5*/
#define TRACE_QUEUE_PEEK_TRCBLOCK (EVENTGROUP_QUEUE_EXTRAS + 0UL) /*0xD5*/
#define TRACE_QUEUE_PEEK_TRCFAILED (EVENTGROUP_QUEUE_EXTRAS + 1UL) /*0xD6*/
#define TRACE_QUEUE_SEND_TO_FRONT_TRCSUCCESS (EVENTGROUP_QUEUE_EXTRAS + 2UL) /*0xD7*/
#define TRACE_QUEUE_SEND_TO_FRONT_TRCBLOCK (EVENTGROUP_QUEUE_EXTRAS + 3UL) /*0xD8*/
#define TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED (EVENTGROUP_QUEUE_EXTRAS + 4UL) /*0xD9*/
#define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCSUCCESS (EVENTGROUP_QUEUE_EXTRAS + 5UL) /*0xDA*/
#define TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED (EVENTGROUP_QUEUE_EXTRAS + 6UL) /*0xDB*/
/* LAST EVENT (0xDB) */
/****************************
* MACROS TO GET TRACE CLASS *
****************************/
#define TRACE_GET_TRACE_CLASS_FROM_TASK_CLASS(kernelClass) (TRACE_CLASS_TASK)
#define TRACE_GET_TRACE_CLASS_FROM_TASK_OBJECT(pxObject) (TRACE_CLASS_TASK)
#define TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(kernelClass) (TraceQueueClassTable[kernelClass])
#define TRACE_GET_TRACE_CLASS_FROM_QUEUE_OBJECT(pxObject) (TRACE_GET_TRACE_CLASS_FROM_QUEUE_CLASS(prvTraceGetQueueType(pxObject)))
#define TRACE_GET_TRACE_CLASS_FROM_TIMER_CLASS(kernelClass) (TRACE_CLASS_TIMER)
#define TRACE_GET_TRACE_CLASS_FROM_TIMER_OBJECT(pxObject) (TRACE_CLASS_TIMER)
#define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_CLASS(kernelClass) (TRACE_CLASS_EVENTGROUP)
#define TRACE_GET_TRACE_CLASS_FROM_EVENTGROUP_OBJECT(pxObject) (TRACE_CLASS_EVENTGROUP)
/* Generic versions */
#define TRACE_GET_CLASS_TRACE_CLASS(CLASS, kernelClass) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_CLASS(kernelClass)
#define TRACE_GET_OBJECT_TRACE_CLASS(CLASS, pxObject) TRACE_GET_TRACE_CLASS_FROM_##CLASS##_OBJECT(pxObject)
/******************************
* MACROS TO GET OBJECT NUMBER *
******************************/
#define TRACE_GET_TASK_NUMBER(pxTCB) ((traceHandle)TRACE_GET_LOW16(prvGetTaskNumber(pxTCB)))
#define TRACE_SET_TASK_NUMBER(pxTCB) ((xTCB*)pxTCB)->uxTaskNumber = TRACE_SET_LOW16(((xTCB*)pxTCB)->uxTaskNumber, prvTraceGetObjectHandle(TRACE_CLASS_TASK));
#define TRACE_GET_QUEUE_NUMBER(q) ((traceHandle)TRACE_GET_LOW16(prvGetQueueNumber(q)))
#define TRACE_SET_QUEUE_NUMBER(q) ((xQUEUE*)q)->uxQueueNumber = TRACE_SET_LOW16(((xQUEUE*)q)->uxQueueNumber, prvTraceGetObjectHandle(TRACE_CLASS_QUEUE));
#define TRACE_GET_TIMER_NUMBER(tmr) ((traceHandle)TRACE_GET_LOW16(prvGetTimerNumber(tmr)))
#define TRACE_SET_TIMER_NUMBER(tmr) ((timerControlBlockType*)tmr)->uxTimerNumber = TRACE_SET_LOW16(((timerControlBlockType*)tmr)->uxTimerNumber, prvTraceGetObjectHandle(TRACE_CLASS_TIMER));
#define TRACE_GET_EVENTGROUP_NUMBER(eg) ((traceHandle)TRACE_GET_LOW16(prvGetEventGroupNumber(eg)))
#define TRACE_SET_EVENTGROUP_NUMBER(eg) ((eventGroupType*)eg)->uxEventGroupNumber = TRACE_SET_LOW16(((eventGroupType*)eg)->uxEventGroupNumber, prvTraceGetObjectHandle(TRACE_CLASS_EVENTGROUP));
/* Generic versions */
#define TRACE_GET_OBJECT_NUMBER(CLASS, pxObject) TRACE_GET_##CLASS##_NUMBER(pxObject)
#define TRACE_SET_OBJECT_NUMBER(CLASS, pxObject) TRACE_SET_##CLASS##_NUMBER(pxObject)
/******************************
* MACROS TO GET EVENT CODES *
******************************/
#define TRACE_GET_TASK_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(TASK, kernelClass))
#define TRACE_GET_QUEUE_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_CLASS_TRACE_CLASS(QUEUE, kernelClass))
#define TRACE_GET_TIMER_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED --
#define TRACE_GET_EVENTGROUP_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass) -- THIS IS NOT USED --
#define TRACE_GET_TASK_OBJECT_EVENT_CODE(SERVICE, RESULT, pxTCB) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(TASK, pxTCB))
#define TRACE_GET_QUEUE_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject) (uint8_t)(EVENTGROUP_##SERVICE##_##RESULT + TRACE_GET_OBJECT_TRACE_CLASS(QUEUE, pxObject))
#define TRACE_GET_TIMER_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED --
#define TRACE_GET_EVENTGROUP_OBJECT_EVENT_CODE(SERVICE, RESULT, UNUSED) -- THIS IS NOT USED --
/* Generic versions */
#define TRACE_GET_CLASS_EVENT_CODE(SERVICE, RESULT, CLASS, kernelClass) TRACE_GET_##CLASS##_CLASS_EVENT_CODE(SERVICE, RESULT, kernelClass)
#define TRACE_GET_OBJECT_EVENT_CODE(SERVICE, RESULT, CLASS, pxObject) TRACE_GET_##CLASS##_OBJECT_EVENT_CODE(SERVICE, RESULT, pxObject)
/******************************
* SPECIAL MACROS FOR TASKS *
******************************/
#define TRACE_GET_TASK_PRIORITY(pxTCB) ((uint8_t)pxTCB->uxPriority)
#define TRACE_GET_TASK_NAME(pxTCB) ((char*)pxTCB->pcNameOfTask)
/*** The trace macros for snapshot mode **************************************/
/* A macro that will update the tick count when returning from tickless idle */
#undef traceINCREASE_TICK_COUNT
/* Note: This can handle time adjustments of max 2^32 ticks, i.e., 35 seconds at 120 MHz. Thus, tick-less idle periods longer than 2^32 ticks will appear "compressed" on the time line.*/
#define traceINCREASE_TICK_COUNT( xCount ) { TRC_DWT_CYCLES_ADDED += (xCount * (TRACE_CPU_CLOCK_HZ / TRACE_TICK_RATE_HZ)); }
/* Called for each task that becomes ready */
#if (TRC_CFG_INCLUDE_READY_EVENTS == 1)
#undef traceMOVED_TASK_TO_READY_STATE
#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
trcKERNEL_HOOKS_MOVED_TASK_TO_READY_STATE(pxTCB);
#else /* (TRC_CFG_INCLUDE_READY_EVENTS == 1) */
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
#endif /* (TRC_CFG_INCLUDE_READY_EVENTS == 1) */
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
#undef traceTASK_INCREMENT_TICK
#define traceTASK_INCREMENT_TICK( xTickCount ) \
if (uxSchedulerSuspended == ( portUnsignedBaseType ) pdTRUE || uxMissedTicks == 0) { trcKERNEL_HOOKS_INCREMENT_TICK(); } \
if (uxSchedulerSuspended == ( portUnsignedBaseType ) pdFALSE) { trcKERNEL_HOOKS_NEW_TIME(DIV_NEW_TIME, xTickCount + 1); }
/* Called on each task-switch */
#undef traceTASK_SWITCHED_IN
#define traceTASK_SWITCHED_IN() \
trcKERNEL_HOOKS_TASK_SWITCH(TRACE_GET_CURRENT_TASK());
/* Called on vTaskCreate */
#undef traceTASK_CREATE
#define traceTASK_CREATE(pxNewTCB) \
trcKERNEL_HOOKS_TASK_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, TASK, pxNewTCB), TASK, pxNewTCB);
/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */
#undef traceTASK_CREATE_FAILED
#define traceTASK_CREATE_FAILED() \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, TASK, NOT_USED), TRACE_GET_CLASS_TRACE_CLASS(TASK, NOT_USED));
/* Called on vTaskDelete */
#undef traceTASK_DELETE
#define traceTASK_DELETE( pxTaskToDelete ) \
{ TRACE_ALLOC_CRITICAL_SECTION(); \
TRACE_ENTER_CRITICAL_SECTION(); \
trcKERNEL_HOOKS_TASK_DELETE(TRACE_GET_OBJECT_EVENT_CODE(DELETE_OBJ, TRCSUCCESS, TASK, pxTaskToDelete), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_NAME, TRCSUCCESS, TASK, pxTaskToDelete), TRACE_GET_OBJECT_EVENT_CODE(OBJCLOSE_PROP, TRCSUCCESS, TASK, pxTaskToDelete), pxTaskToDelete); \
TRACE_EXIT_CRITICAL_SECTION(); }
#if (TRC_CFG_SCHEDULING_ONLY == 0)
#if defined(configUSE_TICKLESS_IDLE)
#if (configUSE_TICKLESS_IDLE != 0)
#undef traceLOW_POWER_IDLE_BEGIN
#define traceLOW_POWER_IDLE_BEGIN() \
{ \
extern uint32_t trace_disable_timestamp; \
prvTraceStoreLowPower(0); \
trace_disable_timestamp = 1; \
}
#undef traceLOW_POWER_IDLE_END
#define traceLOW_POWER_IDLE_END() \
{ \
extern uint32_t trace_disable_timestamp; \
trace_disable_timestamp = 0; \
prvTraceStoreLowPower(1); \
}
#endif /* (configUSE_TICKLESS_IDLE != 0) */
#endif /* defined(configUSE_TICKLESS_IDLE) */
/* Called on vTaskSuspend */
#undef traceTASK_SUSPEND
#define traceTASK_SUSPEND( pxTaskToSuspend ) \
trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend);
/* Called from special case with timer only */
#undef traceTASK_DELAY_SUSPEND
#define traceTASK_DELAY_SUSPEND( pxTaskToSuspend ) \
trcKERNEL_HOOKS_TASK_SUSPEND(TASK_SUSPEND, pxTaskToSuspend); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
/* Called on vTaskDelay - note the use of variable xTicksToDelay */
#undef traceTASK_DELAY
#define traceTASK_DELAY() \
trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY, pxCurrentTCB, xTicksToDelay); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
/* Called on vTaskDelayUntil - note the use of variable xTimeToWake */
#undef traceTASK_DELAY_UNTIL
#define traceTASK_DELAY_UNTIL(xTimeToWake) \
trcKERNEL_HOOKS_TASK_DELAY(TASK_DELAY_UNTIL, pxCurrentTCB, xTimeToWake); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */
#undef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue ) \
trcKERNEL_HOOKS_OBJECT_CREATE(TRACE_GET_OBJECT_EVENT_CODE(CREATE_OBJ, TRCSUCCESS, QUEUE, pxNewQueue), QUEUE, pxNewQueue);
/* Called in xQueueCreate, if the queue creation fails */
#undef traceQUEUE_CREATE_FAILED
#define traceQUEUE_CREATE_FAILED( pcBuffer, queueType, queueLength ) \
switch( queueType ) \
{ \
case queueQUEUE_IS_QUEUE: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, traceQueueType), TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, traceSemaphoreType), TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceSemaphoreType)); \
break; \
case queueQUEUE_IS_MUTEX: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_GET_CLASS_EVENT_CODE(CREATE_OBJ, TRCFAILED, QUEUE, traceMutexType), TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceMutexType)); \
break; \
}
/***************************************************/
/* Called when a message is sent to a queue */
#undef traceQUEUE_SEND
#define traceQUEUE_SEND( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(xPosition == queueSEND_TO_BACK ? TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCSUCCESS, QUEUE, pxQueue) : TRACE_QUEUE_SEND_TO_FRONT_TRCSUCCESS, QUEUE, pxQueue); \
trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxItemsWaiting + 1));
/* Called when a message failed to be sent to a queue (timeout) */
#undef traceQUEUE_SEND_FAILED
#define traceQUEUE_SEND_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(xPosition == queueSEND_TO_BACK ? TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCFAILED, QUEUE, pxQueue) : TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED, QUEUE, pxQueue); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(xPosition == queueSEND_TO_BACK ? TRACE_GET_CLASS_EVENT_CODE(SEND, TRCFAILED, QUEUE, traceQueueType) : TRACE_QUEUE_SEND_TO_FRONT_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
}
/* Called when the task is blocked due to a send operation on a full queue */
#undef traceBLOCKING_ON_QUEUE_SEND
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(xPosition == queueSEND_TO_BACK ? TRACE_GET_OBJECT_EVENT_CODE(SEND, TRCBLOCK, QUEUE, pxQueue) : TRACE_QUEUE_SEND_TO_FRONT_TRCBLOCK, QUEUE, pxQueue);
/* Called when a message is received from a queue */
#undef traceQUEUE_RECEIVE
#define traceQUEUE_RECEIVE( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \
trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxItemsWaiting - 1));
/* Called when a receive operation on a queue fails (timeout) */
#undef traceQUEUE_RECEIVE_FAILED
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_GET_CLASS_EVENT_CODE(RECEIVE, TRCFAILED, QUEUE, traceQueueType), TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
}
/* Called when the task is blocked due to a receive operation on an empty queue */
#undef traceBLOCKING_ON_QUEUE_RECEIVE
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE, TRCBLOCK, QUEUE, pxQueue), QUEUE, pxQueue); \
if (pxQueue->uxQueueType != queueQUEUE_IS_MUTEX) \
{ \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED(); \
}
/* Called on xQueuePeek */
#undef traceQUEUE_PEEK
#define traceQUEUE_PEEK( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_GET_OBJECT_EVENT_CODE(PEEK, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue);
/* Called on xQueuePeek */
#undef traceBLOCKING_ON_QUEUE_PEEK
#define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_QUEUE_PEEK_TRCBLOCK, QUEUE, pxQueue); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
/* Called on xQueuePeek */
#undef traceQUEUE_PEEK_FAILED
#define traceQUEUE_PEEK_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_QUEUE_PEEK_TRCFAILED, QUEUE, pxQueue); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_QUEUE_PEEK_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
}
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
#undef traceQUEUE_SEND_FROM_ISR
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(xPosition == queueSEND_TO_BACK ? TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCSUCCESS, QUEUE, pxQueue) : TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCSUCCESS, QUEUE, pxQueue); \
trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxItemsWaiting + 1));
/* Called when a message send from interrupt context fails (since the queue was full) */
#undef traceQUEUE_SEND_FROM_ISR_FAILED
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(xPosition == queueSEND_TO_BACK ? TRACE_GET_OBJECT_EVENT_CODE(SEND_FROM_ISR, TRCFAILED, QUEUE, pxQueue) : TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED, QUEUE, pxQueue); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(xPosition == queueSEND_TO_BACK ? TRACE_GET_CLASS_EVENT_CODE(SEND_FROM_ISR, TRCFAILED, QUEUE, traceQueueType) : TRACE_QUEUE_SEND_TO_FRONT_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
}
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */
#undef traceQUEUE_RECEIVE_FROM_ISR
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCSUCCESS, QUEUE, pxQueue), QUEUE, pxQueue); \
trcKERNEL_HOOKS_SET_OBJECT_STATE(QUEUE, pxQueue, (uint8_t)(pxQueue->uxItemsWaiting - 1));
/* Called when a message receive from interrupt context fails (since the queue was empty) */
#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_GET_OBJECT_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, QUEUE, pxQueue), QUEUE, pxQueue); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(TRACE_GET_CLASS_EVENT_CODE(RECEIVE_FROM_ISR, TRCFAILED, QUEUE, traceQueueType), TRACE_GET_CLASS_TRACE_CLASS(QUEUE, traceQueueType)); \
}
/* Called in vTaskPrioritySet */
#undef traceTASK_PRIORITY_SET
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \
trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_SET, pxTask, uxNewPriority);
/* Called in vTaskPriorityInherit, which is called by Mutex operations */
#undef traceTASK_PRIORITY_INHERIT
#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \
trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_INHERIT, pxTask, uxNewPriority);
/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */
#undef traceTASK_PRIORITY_DISINHERIT
#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \
trcKERNEL_HOOKS_TASK_PRIORITY_CHANGE(TASK_PRIORITY_DISINHERIT, pxTask, uxNewPriority);
/* Called in vTaskResume */
#undef traceTASK_RESUME
#define traceTASK_RESUME( pxTaskToResume ) \
trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME, pxTaskToResume);
/* Called in vTaskResumeFromISR */
#undef traceTASK_RESUME_FROM_ISR
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \
trcKERNEL_HOOKS_TASK_RESUME(TASK_RESUME_FROM_ISR, pxTaskToResume);
/* Called in timer.c - xTimerCreate */
#undef traceTIMER_CREATE
#define traceTIMER_CREATE(tmr) \
if (pdPASS == xReturn) \
{ \
trcKERNEL_HOOKS_OBJECT_CREATE(TIMER_CREATE, TIMER, tmr); \
prvTraceSetObjectName(TRACE_CLASS_TIMER, TRACE_GET_TIMER_NUMBER(tmr), (const char*)tmr->pcTimerName); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TIMER_CREATE_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
}
#undef traceTIMER_COMMAND_SEND
#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \
if (trcIS_TIMER_VALID(tmr)) \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
trcKERNEL_HOOKS_KERNEL_SERVICE((xReturn == pdPASS) ? TIMER_START : TIMER_START_TRCFAILED, TIMER, tmr); \
break; \
case timerCOMMAND_STOP: \
trcKERNEL_HOOKS_KERNEL_SERVICE((xReturn == pdPASS) ? TIMER_STOP : TIMER_STOP_TRCFAILED, TIMER, tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
trcKERNEL_HOOKS_KERNEL_SERVICE((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD : TIMER_CHANGE_PERIOD_TRCFAILED, TIMER, tmr); \
break; \
case timerCOMMAND_DELETE: \
trcKERNEL_HOOKS_KERNEL_SERVICE((xReturn == pdPASS) ? TIMER_DELETE_OBJ : TIMER_DELETE_OBJ_TRCFAILED, TIMER, tmr); \
break; \
} \
} \
else \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TIMER_START_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
case timerCOMMAND_STOP: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TIMER_STOP_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TIMER_CHANGE_PERIOD_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
case timerCOMMAND_DELETE: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TIMER_DELETE_OBJ_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
} \
}
#undef traceTIMER_COMMAND_SEND_FROM_ISR
#define traceTIMER_COMMAND_SEND_FROM_ISR(tmr, xCommandID, xOptionalValue, xReturn) \
if (trcIS_TIMER_VALID(tmr)) \
{ \
switch (xCommandID) \
{ \
case timerCOMMAND_START: \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR((xReturn == pdPASS) ? TIMER_START_FROM_ISR : TIMER_START_FROM_ISR_TRCFAILED, TIMER, tmr); \
break; \
case timerCOMMAND_STOP: \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR((xReturn == pdPASS) ? TIMER_STOP_FROM_ISR : TIMER_STOP_FROM_ISR_TRCFAILED, TIMER, tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR((xReturn == pdPASS) ? TIMER_CHANGE_PERIOD_FROM_ISR : TIMER_CHANGE_PERIOD_FROM_ISR_TRCFAILED, TIMER, tmr); \
break; \
} \
} \
else \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(TIMER_START_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
case timerCOMMAND_STOP: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(TIMER_STOP_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(TIMER_CHANGE_PERIOD_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TIMER, NOT_USED)); \
break; \
} \
}
/* We currently don't do anything with these timer command process events
case timerCOMMAND_START: \
trcKERNEL_HOOKS_KERNEL_SERVICE(TIMER_PROCESS_START, TIMER, tmr); \
break; \
case timerCOMMAND_STOP: \
trcKERNEL_HOOKS_KERNEL_SERVICE(TIMER_PROCESS_STOP, TIMER, tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
trcKERNEL_HOOKS_KERNEL_SERVICE(TIMER_PROCESS_CHANGE_PERIOD, TIMER, tmr); \
break;*/
#undef traceTIMER_COMMAND_PROCESS
#define traceTIMER_COMMAND_PROCESS( tmr, xCommandID, xOptionalValue ) \
switch(xCommandID) \
{ \
case timerCOMMAND_DELETE: \
{ \
TRACE_ALLOC_CRITICAL_SECTION(); \
TRACE_ENTER_CRITICAL_SECTION(); \
trcKERNEL_HOOKS_OBJECT_DELETE(TIMER_PROCESS_DELETE, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(TIMER, tmr), TIMER, tmr); \
TRACE_EXIT_CRITICAL_SECTION(); \
} \
break; \
}
#undef traceTIMER_CALLBACK
#define traceTIMER_CALLBACK( tmr, callbackFunction ) \
/*trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TIMER_CALLBACK, TIMER, tmr, (uint32_t)callbackFunction);*/
#undef traceEVENT_GROUP_CREATE
#define traceEVENT_GROUP_CREATE(eg) \
trcKERNEL_HOOKS_OBJECT_CREATE(EVENT_GROUP_CREATE, EVENTGROUP, eg);
#undef traceEVENT_GROUP_CREATE_FAILED
#define traceEVENT_GROUP_CREATE_FAILED() \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(EVENT_GROUP_CREATE_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED));
#undef traceEVENT_GROUP_DELETE
#define traceEVENT_GROUP_DELETE(eg) \
{ \
TRACE_ALLOC_CRITICAL_SECTION(); \
TRACE_ENTER_CRITICAL_SECTION(); \
trcKERNEL_HOOKS_OBJECT_DELETE(EVENT_GROUP_DELETE_OBJ, EVENTGROUP_OBJCLOSE_NAME_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP_OBJCLOSE_PROP_TRCSUCCESS + TRACE_GET_OBJECT_TRACE_CLASS(EVENTGROUP, eg), EVENTGROUP, eg); \
TRACE_EXIT_CRITICAL_SECTION(); \
}
#undef traceEVENT_GROUP_DELETE_FAILED
#define traceEVENT_GROUP_DELETE_FAILED(eg) \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(EVENT_GROUP_DELETE_OBJ_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED));
#undef traceEVENT_GROUP_SET_BITS
#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_SET_BITS, EVENTGROUP, eg);
#undef traceEVENT_GROUP_SET_BITS_FAILED
#define traceEVENT_GROUP_SET_BITS_FAILED(eg, bitsToSet) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_SET_BITS_TRCFAILED, EVENTGROUP, eg); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(EVENT_GROUP_SET_BITS_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED)); \
}
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR
#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(EVENT_GROUP_SET_BITS_FROM_ISR, EVENTGROUP, eg);
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR_FAILED
#define traceEVENT_GROUP_SET_BITS_FROM_ISR_FAILED(eg, bitsToSet) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(EVENT_GROUP_SET_BITS_FROM_ISR_TRCFAILED, EVENTGROUP, eg); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(EVENT_GROUP_SET_BITS_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED)); \
}
#undef traceEVENT_GROUP_CLEAR_BITS
#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_CLEAR_BITS, EVENTGROUP, eg);
#undef traceEVENT_GROUP_CLEAR_BITS_FAILED
#define traceEVENT_GROUP_CLEAR_BITS_FAILED(eg, bitsToClear) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_CLEAR_BITS_TRCFAILED, EVENTGROUP, eg); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(EVENT_GROUP_CLEAR_BITS_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED)); \
}
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(EVENT_GROUP_CLEAR_BITS_FROM_ISR, EVENTGROUP, eg);
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR_FAILED
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR_FAILED(eg, bitsToClear) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(EVENT_GROUP_CLEAR_BITS_FROM_ISR_TRCFAILED, EVENTGROUP, eg); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(EVENT_GROUP_CLEAR_BITS_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED)); \
}
#undef traceEVENT_GROUP_WAIT_BITS_BLOCK
#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor, timeout) \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_WAIT_BITS_TRCBLOCK, EVENTGROUP, eg); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
#undef traceEVENT_GROUP_WAIT_BITS
#define traceEVENT_GROUP_WAIT_BITS(eg, bitsToWaitFor, timeout) \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_WAIT_BITS, EVENTGROUP, eg);
#undef traceEVENT_GROUP_WAIT_BITS_FAILED
#define traceEVENT_GROUP_WAIT_BITS_FAILED(eg, bitsToWaitFor, timeout) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(EVENT_GROUP_WAIT_BITS_TRCFAILED, EVENTGROUP, eg); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(EVENT_GROUP_WAIT_BITS_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(EVENTGROUP, NOT_USED)); \
}
#undef traceTASK_NOTIFY_WAIT
#define traceTASK_NOTIFY_WAIT() \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_WAIT_TRCSUCCESS, TASK, pxCurrentTCB, xTicksToWait);
#undef traceTASK_NOTIFY_WAIT_FAILED
#define traceTASK_NOTIFY_WAIT_FAILED() \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_WAIT_TRCFAILED, TASK, pxCurrentTCB, xTicksToWait);
#undef traceTASK_NOTIFY_WAIT_BLOCK
#define traceTASK_NOTIFY_WAIT_BLOCK() \
trcKERNEL_HOOKS_KERNEL_SERVICE_WITH_PARAM(TRACE_TASK_NOTIFY_WAIT_TRCBLOCK, TASK, pxCurrentTCB, xTicksToWait); \
trcKERNEL_HOOKS_SET_TASK_INSTANCE_FINISHED();
#undef traceTASK_NOTIFY_SEND
#define traceTASK_NOTIFY_SEND() \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_TASK_NOTIFY_SEND_TRCSUCCESS, TASK, xTaskToNotify);
#undef traceTASK_NOTIFY_SEND_FAILED
#define traceTASK_NOTIFY_SEND_FAILED() \
if (trcIS_TASK_VALID(xTaskToNotify)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE(TRACE_TASK_NOTIFY_SEND_TRCFAILED, TASK, xTaskToNotify); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT(TRACE_TASK_NOTIFY_SEND_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TASK, NOT_USED)); \
}
#undef traceTASK_NOTIFY_SEND_FROM_ISR
#define traceTASK_NOTIFY_SEND_FROM_ISR() \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_TASK_NOTIFY_SEND_FROM_ISR_TRCSUCCESS, TASK, xTaskToNotify);
#undef traceTASK_NOTIFY_SEND_FROM_ISR_FAILED
#define traceTASK_NOTIFY_SEND_FROM_ISR_FAILED() \
if (trcIS_TASK_VALID(xTaskToNotify)) \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_FROM_ISR(TRACE_TASK_NOTIFY_SEND_FROM_ISR_TRCFAILED, TASK, xTaskToNotify); \
} \
else \
{ \
trcKERNEL_HOOKS_KERNEL_SERVICE_NULL_OBJECT_FROM_ISR(TRACE_TASK_NOTIFY_SEND_FROM_ISR_TRCFAILED, TRACE_GET_CLASS_TRACE_CLASS(TASK, NOT_USED)); \
}
#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */
#endif /*#if TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_SNAPSHOT */
/******************************************************************************/
/*** Definitions for Streaming mode *******************************************/
/******************************************************************************/
#if (TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING)
#define vTraceSetQueueName(object, name) vTraceStoreKernelObjectName(object, name)
#define vTraceSetSemaphoreName(object, name) vTraceStoreKernelObjectName(object, name)
#define vTraceSetMutexName(object, name) vTraceStoreKernelObjectName(object, name)
#define vTraceSetEventGroupName(object, name) vTraceStoreKernelObjectName(object, name)
/*******************************************************************************
* vTraceStoreKernelObjectName
*
* Set the name for a kernel object (defined by its address).
******************************************************************************/
void vTraceStoreKernelObjectName(void* object, const char* name);
/*******************************************************************************
* prvIsNewTCB
*
* Tells if this task is already executing, or if there has been a task-switch.
* Assumed to be called within a trace hook in kernel context.
*******************************************************************************/
uint32_t prvIsNewTCB(void* pNewTCB);
/*************************************************************************/
/* KERNEL SPECIFIC OBJECT CONFIGURATION */
/*************************************************************************/
/*******************************************************************************
* The event codes - should match the offline config file.
******************************************************************************/
/*** Event codes for streaming - should match the Tracealyzer config file *****/
#define PSF_EVENT_NULL_EVENT 0x00
#define PSF_EVENT_TRACE_START 0x01
#define PSF_EVENT_TS_CONFIG 0x02
#define PSF_EVENT_OBJ_NAME 0x03
#define PSF_EVENT_OBJ_DATA 0x04
#define PSF_EVENT_DEFINE_ISR 0x05
#define PSF_EVENT_TASK_READY 0x06
#define PSF_EVENT_NEW_TIME 0x07
#define PSF_EVENT_NEW_TIME_SCHEDULER_SUSPENDED 0x08
#define PSF_EVENT_ISR_BEGIN 0x09
#define PSF_EVENT_ISR_RESUME 0x0A
#define PSF_EVENT_TS_BEGIN 0x0B
#define PSF_EVENT_TS_RESUME 0x0C
#define PSF_EVENT_TASK_ACTIVATE 0x0D
#define PSF_EVENT_LOWPOWER_BEGIN 0x0E
#define PSF_EVENT_LOWPOWER_END 0x0F
#define PSF_EVENT_IFE_NEXT 0x10
#define PSF_EVENT_IFE_DIRECT 0x11
#define PSF_EVENT_TASK_CREATE 0x12
#define PSF_EVENT_TASK_CREATE_FAILED 0x13
#define PSF_EVENT_TASK_DELETE 0x14
#define PSF_EVENT_TASK_DELAY_UNTIL 0x15
#define PSF_EVENT_TASK_DELAY 0x16
#define PSF_EVENT_TASK_SUSPEND 0x17
#define PSF_EVENT_TASK_RESUME 0x18
#define PSF_EVENT_TASK_RESUME_FROMISR 0x19
#define PSF_EVENT_TASK_PRIORITY 0x1A
#define PSF_EVENT_TASK_PRIO_INHERIT 0x1B
#define PSF_EVENT_TASK_PRIO_DISINHERIT 0x1C
#define PSF_EVENT_TASK_NOTIFY_SEND 0x1D
#define PSF_EVENT_TASK_NOTIFY_SEND_FAILED 0x1E
#define PSF_EVENT_TASK_NOTIFY_SEND_FROM_ISR 0x1F
#define PSF_EVENT_TASK_NOTIFY_SEND_FROM_ISR_FAILED 0x20
#define PSF_EVENT_TASK_NOTIFY_WAIT 0x21
#define PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK 0x22
#define PSF_EVENT_TASK_NOTIFY_WAIT_FAILED 0x23
#define PSF_EVENT_QUEUE_CREATE 0x24
#define PSF_EVENT_QUEUE_CREATE_FAILED 0x25
#define PSF_EVENT_QUEUE_SEND 0x26
#define PSF_EVENT_QUEUE_SEND_FAILED 0x27
#define PSF_EVENT_QUEUE_SEND_BLOCK 0x28
#define PSF_EVENT_QUEUE_SEND_TO_FRONT 0x29
#define PSF_EVENT_QUEUE_SEND_TO_FRONT_FAILED 0x2A
#define PSF_EVENT_QUEUE_SEND_TO_FRONT_BLOCK 0x2B
#define PSF_EVENT_QUEUE_SEND_FROMISR 0x2C
#define PSF_EVENT_QUEUE_SEND_FROMISR_FAILED 0x2D
#define PSF_EVENT_QUEUE_SEND_TO_FRONT_FROMISR 0x2E
#define PSF_EVENT_QUEUE_SEND_TO_FRONT_FROMISR_FAILED 0x2F
#define PSF_EVENT_QUEUE_RECEIVE 0x30
#define PSF_EVENT_QUEUE_RECEIVE_FAILED 0x31
#define PSF_EVENT_QUEUE_RECEIVE_BLOCK 0x32
#define PSF_EVENT_QUEUE_RECEIVE_FROMISR 0x33
#define PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED 0x34
#define PSF_EVENT_QUEUE_PEEK 0x35
#define PSF_EVENT_QUEUE_PEEK_FAILED 0x36
#define PSF_EVENT_QUEUE_PEEK_BLOCK 0x37
#define PSF_EVENT_SEMAPHORE_CREATE 0x38
#define PSF_EVENT_SEMAPHORE_CREATE_FAILED 0x39
#define PSF_EVENT_SEMAPHORE_SEND 0x3A
#define PSF_EVENT_SEMAPHORE_SEND_FAILED 0x3B
#define PSF_EVENT_SEMAPHORE_SEND_FROMISR 0x3C
#define PSF_EVENT_SEMAPHORE_SEND_FROMISR_FAILED 0x3D
#define PSF_EVENT_SEMAPHORE_RECEIVE 0x3E
#define PSF_EVENT_SEMAPHORE_RECEIVE_FAILED 0x3F
#define PSF_EVENT_SEMAPHORE_RECEIVE_BLOCK 0x40
#define PSF_EVENT_SEMAPHORE_RECEIVE_FROMISR 0x41
#define PSF_EVENT_SEMAPHORE_RECEIVE_FROMISR_FAILED 0x42
#define PSF_EVENT_MUTEX_CREATE 0x43
#define PSF_EVENT_MUTEX_CREATE_FAILED 0x44
#define PSF_EVENT_MUTEX_SEND 0x45
#define PSF_EVENT_MUTEX_SEND_FAILED 0x46
#define PSF_EVENT_MUTEX_RECEIVE 0x47
#define PSF_EVENT_MUTEX_RECEIVE_FAILED 0x48
#define PSF_EVENT_MUTEX_RECEIVE_BLOCK 0x49
#define PSF_EVENT_TIMER_CREATE 0x4A
#define PSF_EVENT_TIMER_CREATE_FAILED 0x4B
#define PSF_EVENT_TIMER_DELETE 0x4C
#define PSF_EVENT_TIMER_DELETE_FAILED 0x4D
#define PSF_EVENT_TIMER_START 0x4E
#define PSF_EVENT_TIMER_START_FAILED 0x4F
#define PSF_EVENT_TIMER_STOP 0x50
#define PSF_EVENT_TIMER_STOP_FAILED 0x51
#define PSF_EVENT_TIMER_CHANGEPERIOD 0x52
#define PSF_EVENT_TIMER_CHANGEPERIOD_FAILED 0x53
#define PSF_EVENT_TIMER_START_FROMISR 0x54
#define PSF_EVENT_TIMER_START_FROMISR_FAILED 0x55
#define PSF_EVENT_TIMER_STOP_FROMISR 0x56
#define PSF_EVENT_TIMER_STOP_FROMISR_FAILED 0x57
#define PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR 0x58
#define PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED 0x59
#define PSF_EVENT_TIMER_PROCESS_START 0x5A
#define PSF_EVENT_TIMER_PROCESS_STOP 0x5B
#define PSF_EVENT_TIMER_PROCESS_CHANGEPERIOD 0x5C
#define PSF_EVENT_TIMER_PROCESS_DELETE 0x5D
#define PSF_EVENT_TIMER_CALLBACK 0x5E
/*
#define UNUSED_SO_FAR 0x5F
#define UNUSED_SO_FAR 0x60
#define UNUSED_SO_FAR 0x61
#define UNUSED_SO_FAR 0x62
#define UNUSED_SO_FAR 0x63
*/
#define PSF_EVENT_EVENTGROUP_CREATE 0x64
#define PSF_EVENT_EVENTGROUP_CREATE_FAILED 0x65
#define PSF_EVENT_EVENTGROUP_DELETE 0x66
#define PSF_EVENT_EVENTGROUP_DELETE_FAILED 0x67
#define PSF_EVENT_EVENTGROUP_SETBITS 0x68
#define PSF_EVENT_EVENTGROUP_SETBITS_FAILED 0x69
#define PSF_EVENT_EVENTGROUP_SETBITS_FROMISR 0x6A
#define PSF_EVENT_EVENTGROUP_SETBITS_FROMISR_FAILED 0x6B
#define PSF_EVENT_EVENTGROUP_WAITBITS 0x6C
#define PSF_EVENT_EVENTGROUP_WAITBITS_FAILED 0x6D
#define PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK 0x6E
#define PSF_EVENT_EVENTGROUP_CLEARBITS 0x6F
#define PSF_EVENT_EVENTGROUP_CLEARBITS_FAILED 0x70
#define PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR 0x71
#define PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR_FAILED 0x72
/* LAST EVENT 0x72 (except user events from 0xF0) */
/* Placing user events near the end */
#define PSF_EVENT_USER_EVENT 0xF0
#define PSF_EVENT_USER_EVENT_0 (PSF_EVENT_USER_EVENT + 0)
#define PSF_EVENT_USER_EVENT_1 (PSF_EVENT_USER_EVENT + 1)
#define PSF_EVENT_USER_EVENT_2 (PSF_EVENT_USER_EVENT + 2)
#define PSF_EVENT_USER_EVENT_3 (PSF_EVENT_USER_EVENT + 3)
#define PSF_EVENT_USER_EVENT_4 (PSF_EVENT_USER_EVENT + 4)
#define PSF_EVENT_USER_EVENT_5 (PSF_EVENT_USER_EVENT + 5)
#define PSF_EVENT_USER_EVENT_6 (PSF_EVENT_USER_EVENT + 6)
#define PSF_EVENT_USER_EVENT_7 (PSF_EVENT_USER_EVENT + 7)
/*** The trace macros for streaming ******************************************/
/* Called on each OS tick. Will call uiPortGetTimestamp to make sure it is called at least once every OS tick. */
#undef traceTASK_INCREMENT_TICK
#define traceTASK_INCREMENT_TICK( xTickCount ) \
if (uxSchedulerSuspended == ( portUnsignedBaseType ) pdTRUE || uxMissedTicks == 0) { extern uint32_t uiTraceTickCount; uiTraceTickCount++; } \
if (uxSchedulerSuspended == ( portUnsignedBaseType ) pdFALSE) { prvTraceStoreEvent1(PSF_EVENT_NEW_TIME, (xTickCount + 1)); }
/* A macro that will update the tick count when returning from tickless idle */
#undef traceINCREASE_TICK_COUNT
/* Note: This can handle time adjustments of max 2^32 ticks, i.e., 35 seconds at 120 MHz. Thus, tick-less idle periods longer than 2^32 ticks will appear "compressed" on the time line.*/
#define traceINCREASE_TICK_COUNT( xCount ) { extern uint32_t uiTraceTickCount; uiTraceTickCount += xCount; }
/* Called for each task that becomes ready */
#if (TRC_CFG_INCLUDE_READY_EVENTS == 1)
#undef traceMOVED_TASK_TO_READY_STATE
#define traceMOVED_TASK_TO_READY_STATE( pxTCB ) \
if (TRACE_GET_TASK_FILTER(pxTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_READY, (uint32_t)pxTCB); \
}
#else /* (TRC_CFG_INCLUDE_READY_EVENTS == 1) */
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
#endif /* (TRC_CFG_INCLUDE_READY_EVENTS == 1) */
extern volatile uint32_t uiTraceSystemState;
/* Called on each task-switch */
#undef traceTASK_SWITCHED_IN
#define traceTASK_SWITCHED_IN() \
uiTraceSystemState = TRC_STATE_IN_TASKSWITCH; \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
if (prvIsNewTCB(pxCurrentTCB)) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_ACTIVATE, (uint32_t)pxCurrentTCB, pxCurrentTCB->uxPriority); \
} \
} \
uiTraceSystemState = TRC_STATE_IN_APPLICATION;
/* Called on vTaskCreate */
#undef traceTASK_CREATE
#define traceTASK_CREATE(pxNewTCB) \
prvTraceSaveObjectSymbol(pxNewTCB, (const char*)pxNewTCB->pcNameOfTask); \
prvTraceSaveObjectData(pxNewTCB, pxNewTCB->uxPriority); \
prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, pxNewTCB->pcNameOfTask, pxNewTCB); \
TRACE_SET_TASK_FILTER(pxNewTCB, CurrentFilterGroup); \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
if (TRACE_GET_TASK_FILTER(pxNewTCB) & CurrentFilterMask) \
prvTraceStoreEvent2(PSF_EVENT_TASK_CREATE, (uint32_t)pxNewTCB, pxNewTCB->uxPriority);
/* Called in vTaskCreate, if it fails (typically if the stack can not be allocated) */
#undef traceTASK_CREATE_FAILED
#define traceTASK_CREATE_FAILED() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
prvTraceStoreEvent0(PSF_EVENT_TASK_CREATE_FAILED);
/* Called on vTaskDelete */
#undef traceTASK_DELETE
#define traceTASK_DELETE( pxTaskToDelete ) \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
if (TRACE_GET_TASK_FILTER(pxTaskToDelete) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_DELETE, (uint32_t)pxTaskToDelete, pxTaskToDelete->uxPriority); \
} \
} \
prvTraceDeleteSymbol(pxTaskToDelete); \
prvTraceDeleteObjectData(pxTaskToDelete);
#if (TRC_CFG_SCHEDULING_ONLY == 0)
#if (configUSE_TICKLESS_IDLE != 0)
#undef traceLOW_POWER_IDLE_BEGIN
#define traceLOW_POWER_IDLE_BEGIN() \
{ \
prvTraceStoreEvent1(PSF_EVENT_LOWPOWER_BEGIN, xExpectedIdleTime); \
}
#undef traceLOW_POWER_IDLE_END
#define traceLOW_POWER_IDLE_END() \
{ \
prvTraceStoreEvent0(PSF_EVENT_LOWPOWER_END); \
}
#endif
/* Called on vTaskSuspend */
#undef traceTASK_SUSPEND
#define traceTASK_SUSPEND( pxTaskToSuspend ) \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
if (TRACE_GET_TASK_FILTER(pxTaskToSuspend) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_SUSPEND, (uint32_t)pxTaskToSuspend); \
} \
}
/* Called on vTaskDelay - note the use of variable xTicksToDelay */
#undef traceTASK_DELAY
#define traceTASK_DELAY() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY, xTicksToDelay); \
}
/* Called on vTaskDelayUntil - note the use of variable xTimeToWake */
#undef traceTASK_DELAY_UNTIL
#define traceTASK_DELAY_UNTIL(xTimeToWake) \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_DELAY_UNTIL, xTimeToWake); \
}
/* Called in xQueueCreate, and thereby for all other object based on queues, such as semaphores. */
#undef traceQUEUE_CREATE
#define traceQUEUE_CREATE( pxNewQueue )\
TRACE_SET_OBJECT_FILTER(QUEUE, pxNewQueue, CurrentFilterGroup); \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxNewQueue) & CurrentFilterMask) \
{ \
switch (uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE, (uint32_t)pxNewQueue, pxNewQueue->uxMaxNumberOfItems); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_CREATE, (uint32_t)pxNewQueue, pxNewQueue->uxMaxNumberOfItems); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE, (uint32_t)pxNewQueue); \
break; \
} \
} \
}
/* Called in xQueueCreate, if the queue creation fails */
#undef traceQUEUE_CREATE_FAILED
#define traceQUEUE_CREATE_FAILED( pcBuffer, queueType, queueLength ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
switch (queueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(PSF_EVENT_QUEUE_CREATE_FAILED, (uint32_t)pcBuffer, queueLength); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_CREATE_FAILED, (uint32_t)pcBuffer, queueLength); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent1(PSF_EVENT_MUTEX_CREATE_FAILED, (uint32_t)pcBuffer); \
break; \
} \
}
/* Called when a message is sent to a queue */
#undef traceQUEUE_SEND
#define traceQUEUE_SEND( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent3(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND : PSF_EVENT_QUEUE_SEND_TO_FRONT, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting + 1); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_SEND, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent2(PSF_EVENT_MUTEX_SEND, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
} \
} \
}
/* Called when a message failed to be sent to a queue (timeout) */
#undef traceQUEUE_SEND_FAILED
#define traceQUEUE_SEND_FAILED( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent3(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FAILED : PSF_EVENT_QUEUE_SEND_TO_FRONT_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting + 1); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_SEND_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent2(PSF_EVENT_MUTEX_SEND_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
} \
} \
} \
else \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_SEND_FAILED, (uint32_t)pxQueue, xTicksToWait, 0); \
} \
}
/* Called when the task is blocked due to a send operation on a full queue */
/* Semaphores and mutexes don't block on send */
#undef traceBLOCKING_ON_QUEUE_SEND
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_BLOCK : PSF_EVENT_QUEUE_SEND_TO_FRONT_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting + 1); \
} \
}
/* Called when a message is sent from interrupt context, e.g., using xQueueSendFromISR */
/* Mutexes can't be given from ISR */
#undef traceQUEUE_SEND_FROM_ISR
#define traceQUEUE_SEND_FROM_ISR( pxQueue ) \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR : PSF_EVENT_QUEUE_SEND_TO_FRONT_FROMISR, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_SEND_FROMISR, (uint32_t)pxQueue, pxQueue->uxItemsWaiting + 1); \
break; \
} \
}
/* Called when a message send from interrupt context fails (since the queue was full) */
/* Mutexes can't be given from ISR */
#undef traceQUEUE_SEND_FROM_ISR_FAILED
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR_FAILED : PSF_EVENT_QUEUE_SEND_TO_FRONT_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_SEND_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting); \
break; \
} \
} \
} \
else \
{ \
prvTraceStoreEvent2(xPosition == queueSEND_TO_BACK ? PSF_EVENT_QUEUE_SEND_FROMISR_FAILED : PSF_EVENT_QUEUE_SEND_TO_FRONT_FROMISR_FAILED, (uint32_t)pxQueue, 0); \
}
/* Called when a message is received from a queue */
#undef traceQUEUE_RECEIVE
#define traceQUEUE_RECEIVE( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting - 1); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting - 1); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent3(PSF_EVENT_MUTEX_RECEIVE, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting - 1); \
break; \
} \
} \
}
/* Called when a receive operation on a queue fails (timeout) */
#undef traceQUEUE_RECEIVE_FAILED
#define traceQUEUE_RECEIVE_FAILED( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent3(PSF_EVENT_MUTEX_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
} \
} \
} \
else \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE_FAILED, (uint32_t)pxQueue, xTicksToWait, 0); \
} \
}
/* Called when the task is blocked due to a receive operation on an empty queue */
#undef traceBLOCKING_ON_QUEUE_RECEIVE
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_RECEIVE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent3(PSF_EVENT_SEMAPHORE_RECEIVE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_MUTEX: \
prvTraceStoreEvent3(PSF_EVENT_MUTEX_RECEIVE_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
break; \
} \
} \
}
/* Called when a message is received in interrupt context, e.g., using xQueueReceiveFromISR */
/* Mutexes can't be taken from ISR */
#undef traceQUEUE_RECEIVE_FROM_ISR
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue ) \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxItemsWaiting - 1); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_RECEIVE_FROMISR, (uint32_t)pxQueue, pxQueue->uxItemsWaiting - 1); \
break; \
} \
}
/* Called when a message receive from interrupt context fails (since the queue was empty) */
/* Mutexes can't be taken from ISR */
#undef traceQUEUE_RECEIVE_FROM_ISR_FAILED
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue ) \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
switch (pxQueue->uxQueueType) \
{ \
case queueQUEUE_IS_QUEUE: \
prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting); \
break; \
case queueQUEUE_IS_SEMAPHORE: \
prvTraceStoreEvent2(PSF_EVENT_SEMAPHORE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, pxQueue->uxItemsWaiting); \
break; \
} \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_QUEUE_RECEIVE_FROMISR_FAILED, (uint32_t)pxQueue, 0); \
}
/* Called on xQueuePeek */
/* Can't Peek Semaphores or Mutexes */
#undef traceQUEUE_PEEK
#define traceQUEUE_PEEK( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
} \
}
/* Called on xQueuePeek */
/* Can't Peek Semaphores or Mutexes */
#undef traceQUEUE_PEEK_FAILED
#define traceQUEUE_PEEK_FAILED( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_QUEUE_VALID(pxQueue)) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
} \
} \
else \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_FAILED, (uint32_t)pxQueue, xTicksToWait, 0); \
} \
}
/* Called on xQueuePeek */
/* Can't Peek Semaphores or Mutexes */
#undef traceBLOCKING_ON_QUEUE_PEEK
#define traceBLOCKING_ON_QUEUE_PEEK( pxQueue ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(QUEUE, pxQueue) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_QUEUE_PEEK_BLOCK, (uint32_t)pxQueue, xTicksToWait, pxQueue->uxItemsWaiting); \
} \
}
/* Called in xTaskPrioritySet */
#undef traceTASK_PRIORITY_SET
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority ) \
prvTraceSaveObjectData(pxTask, uxNewPriority); \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_PRIORITY, (uint32_t)pxTask, uxNewPriority); \
} \
}
/* Called in vTaskPriorityInherit, which is called by Mutex operations */
#undef traceTASK_PRIORITY_INHERIT
#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority ) \
if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_INHERIT, (uint32_t)pxTask, uxNewPriority); \
}
/* Called in vTaskPriorityDisinherit, which is called by Mutex operations */
#undef traceTASK_PRIORITY_DISINHERIT
#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority ) \
if (TRACE_GET_TASK_FILTER(pxTask) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_PRIO_DISINHERIT, (uint32_t)pxTask, uxNewPriority); \
}
/* Called in vTaskResume */
#undef traceTASK_RESUME
#define traceTASK_RESUME( pxTaskToResume ) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME, (uint32_t)pxTaskToResume); \
} \
}
/* Called in vTaskResumeFromISR */
#undef traceTASK_RESUME_FROM_ISR
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume ) \
if (TRACE_GET_TASK_FILTER(pxTaskToResume) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_TASK_RESUME_FROMISR, (uint32_t)pxTaskToResume); \
}
/* Called in timer.c - xTimerCreate */
#undef traceTIMER_CREATE
#define traceTIMER_CREATE(tmr) \
if (pdPASS == xReturn) \
{ \
TRACE_SET_OBJECT_FILTER(TIMER, tmr, CurrentFilterGroup); \
prvTraceSaveObjectSymbol(tmr, (const char*)tmr->pcTimerName); \
prvTraceStoreStringEvent(1, PSF_EVENT_OBJ_NAME, (const char*)tmr->pcTimerName, tmr); \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE, (uint32_t)tmr, tmr->xTimerPeriodInTicks); \
} \
} \
} \
else \
{ \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TIMER_CREATE_FAILED, 0, 0); \
} \
}
#undef traceTIMER_COMMAND_SEND
#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_TIMER_VALID(tmr)) \
{ \
if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START : PSF_EVENT_TIMER_START_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_STOP: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP : PSF_EVENT_TIMER_STOP_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD : PSF_EVENT_TIMER_CHANGEPERIOD_FAILED, (uint32_t)tmr, xOptionalValue); \
break; \
case timerCOMMAND_DELETE: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_DELETE : PSF_EVENT_TIMER_DELETE_FAILED, (uint32_t)tmr); \
break; \
} \
} \
} \
else \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START : PSF_EVENT_TIMER_START_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_STOP: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP : PSF_EVENT_TIMER_STOP_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD : PSF_EVENT_TIMER_CHANGEPERIOD_FAILED, (uint32_t)tmr, xOptionalValue); \
break; \
case timerCOMMAND_DELETE: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_DELETE : PSF_EVENT_TIMER_DELETE_FAILED, (uint32_t)tmr); \
break; \
} \
} \
}
#undef traceTIMER_COMMAND_SEND_FROM_ISR
#define traceTIMER_COMMAND_SEND_FROM_ISR(tmr, xCommandID, xOptionalValue, xReturn) \
if (trcIS_TIMER_VALID(tmr)) \
{ \
if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START_FROMISR : PSF_EVENT_TIMER_START_FROMISR_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_STOP: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP_FROMISR : PSF_EVENT_TIMER_STOP_FROMISR_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \
break; \
} \
} \
} \
else \
{ \
switch (xCommandID) \
{ \
case timerCOMMAND_START: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_START_FROMISR : PSF_EVENT_TIMER_START_FROMISR_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_STOP: \
prvTraceStoreEvent1((xReturn == pdPASS) ? PSF_EVENT_TIMER_STOP_FROMISR : PSF_EVENT_TIMER_STOP_FROMISR_FAILED, (uint32_t)tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
prvTraceStoreEvent2((xReturn == pdPASS) ? PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR : PSF_EVENT_TIMER_CHANGEPERIOD_FROMISR_FAILED, (uint32_t)tmr, xOptionalValue); \
break; \
} \
}
#undef traceTIMER_COMMAND_PROCESS
#define traceTIMER_COMMAND_PROCESS( tmr, xCommandID, xOptionalValue ) \
if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \
{ \
switch(xCommandID) \
{ \
case timerCOMMAND_START: \
prvTraceStoreEvent1(PSF_EVENT_TIMER_PROCESS_START, (uint32_t)tmr); \
break; \
case timerCOMMAND_STOP: \
prvTraceStoreEvent1(PSF_EVENT_TIMER_PROCESS_STOP, (uint32_t)tmr); \
break; \
case timerCOMMAND_CHANGE_PERIOD: \
prvTraceStoreEvent2(PSF_EVENT_TIMER_PROCESS_CHANGEPERIOD, (uint32_t)tmr, xOptionalValue); \
break; \
case timerCOMMAND_DELETE: \
prvTraceStoreEvent1(PSF_EVENT_TIMER_PROCESS_DELETE, (uint32_t)tmr); \
prvTraceDeleteSymbol(tmr); \
break; \
} \
}
#undef traceTIMER_CALLBACK
#define traceTIMER_CALLBACK( tmr, callbackFunction ) \
if (TRACE_GET_OBJECT_FILTER(TIMER, tmr) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TIMER_CALLBACK, (uint32_t)tmr, (uint32_t)callbackFunction); \
}
#undef traceEVENT_GROUP_CREATE
#define traceEVENT_GROUP_CREATE(eg) \
TRACE_SET_OBJECT_FILTER(EVENTGROUP, eg, CurrentFilterGroup); \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE, (uint32_t)eg); \
} \
}
#undef traceEVENT_GROUP_CREATE_FAILED
#define traceEVENT_GROUP_CREATE_FAILED() \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_CREATE_FAILED, 0); \
}
#undef traceEVENT_GROUP_DELETE
#define traceEVENT_GROUP_DELETE(eg) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE, (uint32_t)eg); \
} \
} \
prvTraceDeleteSymbol(eg);
#undef traceEVENT_GROUP_DELETE_FAILED
#define traceEVENT_GROUP_DELETE_FAILED(eg) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
prvTraceStoreEvent1(PSF_EVENT_EVENTGROUP_DELETE_FAILED, (uint32_t)eg); \
}
#undef traceEVENT_GROUP_SET_BITS
#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS, (uint32_t)eg, bitsToSet); \
} \
}
#undef traceEVENT_GROUP_SET_BITS_FAILED
#define traceEVENT_GROUP_SET_BITS_FAILED(eg, bitsToSet) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FAILED, (uint32_t)eg, bitsToSet); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FAILED, (uint32_t)eg, bitsToSet); \
} \
}
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR
#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet) \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR, (uint32_t)eg, bitsToSet); \
}
#undef traceEVENT_GROUP_SET_BITS_FROM_ISR_FAILED
#define traceEVENT_GROUP_SET_BITS_FROM_ISR_FAILED(eg, bitsToSet) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR_FAILED, (uint32_t)eg, bitsToSet); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_SETBITS_FROMISR_FAILED, (uint32_t)eg, bitsToSet); \
}
#undef traceEVENT_GROUP_WAIT_BITS
#define traceEVENT_GROUP_WAIT_BITS(eg, bitsToWaitFor, timeout) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_EVENTGROUP_WAITBITS, (uint32_t)eg, bitsToWaitFor, timeout); \
} \
}
#undef traceEVENT_GROUP_WAIT_BITS_FAILED
#define traceEVENT_GROUP_WAIT_BITS_FAILED(eg, bitsToWaitFor, timeout) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor, timeout); \
} \
} \
else \
{ \
prvTraceStoreEvent3(PSF_EVENT_EVENTGROUP_WAITBITS_FAILED, (uint32_t)eg, bitsToWaitFor, timeout); \
} \
}
#undef traceEVENT_GROUP_WAIT_BITS_BLOCK
#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor, timeout) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent3(PSF_EVENT_EVENTGROUP_WAITBITS_BLOCK, (uint32_t)eg, bitsToWaitFor, timeout); \
} \
}
#undef traceEVENT_GROUP_CLEAR_BITS
#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS, (uint32_t)eg, bitsToClear); \
} \
}
#undef traceEVENT_GROUP_CLEAR_BITS_FAILED
#define traceEVENT_GROUP_CLEAR_BITS_FAILED(eg, bitsToClear) \
if (TRACE_GET_TASK_FILTER(TRACE_GET_CURRENT_TASK()) & CurrentFilterMask) \
{ \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FAILED, (uint32_t)eg, bitsToClear); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FAILED, (uint32_t)eg, bitsToClear); \
} \
}
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear) \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR, (uint32_t)eg, bitsToClear); \
}
#undef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR_FAILED
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR_FAILED(eg, bitsToClear) \
if (trcIS_EVENTGROUP_VALID(eg)) \
{ \
if (TRACE_GET_OBJECT_FILTER(EVENTGROUP, eg) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR_FAILED, (uint32_t)eg, bitsToClear); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_EVENTGROUP_CLEARBITS_FROMISR_FAILED, (uint32_t)eg, bitsToClear); \
} \
#undef traceTASK_NOTIFY_WAIT
#define traceTASK_NOTIFY_WAIT() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT, (uint32_t)pxCurrentTCB, xTicksToWait); \
}
#undef traceTASK_NOTIFY_WAIT_FAILED
#define traceTASK_NOTIFY_WAIT_FAILED() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_FAILED, (uint32_t)pxCurrentTCB, xTicksToWait); \
}
#undef traceTASK_NOTIFY_WAIT_BLOCK
#define traceTASK_NOTIFY_WAIT_BLOCK() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_WAIT_BLOCK, (uint32_t)pxCurrentTCB, xTicksToWait); \
}
#undef traceTASK_NOTIFY_SEND
#define traceTASK_NOTIFY_SEND() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND, (uint32_t)xTaskToNotify, uxValue); \
} \
}
#undef traceTASK_NOTIFY_SEND_FAILED
#define traceTASK_NOTIFY_SEND_FAILED() \
if (TRACE_GET_TASK_FILTER(pxCurrentTCB) & CurrentFilterMask) \
{ \
if (trcIS_TASK_VALID(xTaskToNotify)) \
{ \
if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND_FAILED, (uint32_t)xTaskToNotify, uxValue); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND_FAILED, (uint32_t)xTaskToNotify, uxValue); \
} \
}
#undef traceTASK_NOTIFY_SEND_FROM_ISR
#define traceTASK_NOTIFY_SEND_FROM_ISR() \
if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND_FROM_ISR, (uint32_t)xTaskToNotify, uxValue); \
}
#undef traceTASK_NOTIFY_SEND_FROM_ISR_FAILED
#define traceTASK_NOTIFY_SEND_FROM_ISR_FAILED() \
if (trcIS_TASK_VALID(xTaskToNotify)) \
{ \
if (TRACE_GET_TASK_FILTER(xTaskToNotify) & CurrentFilterMask) \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND_FROM_ISR_FAILED, (uint32_t)xTaskToNotify, uxValue); \
} \
} \
else \
{ \
prvTraceStoreEvent2(PSF_EVENT_TASK_NOTIFY_SEND_FROM_ISR_FAILED, (uint32_t)xTaskToNotify, uxValue); \
} \
#endif /* (TRC_CFG_SCHEDULING_ONLY == 0) */
#endif /*#if TRC_CFG_RECORDER_MODE == TRC_RECORDER_MODE_STREAMING */
#if (TRC_CFG_SCHEDULING_ONLY == 1)
#define traceLOW_POWER_IDLE_BEGIN()
#define traceLOW_POWER_IDLE_END()
#define traceTASK_SUSPEND( pxTaskToSuspend )
#define traceTASK_DELAY()
#define traceTASK_DELAY_UNTIL(xTimeToWake)
#define traceQUEUE_CREATE( pxNewQueue )
#define traceQUEUE_CREATE_FAILED( pcBuffer, queueType, queueLength )
#define traceQUEUE_SEND( pxQueue )
#define traceQUEUE_SEND_FAILED( pxQueue )
#define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
#define traceQUEUE_SEND_FROM_ISR( pxQueue )
#define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
#define traceQUEUE_RECEIVE( pxQueue )
#define traceQUEUE_RECEIVE_FAILED( pxQueue )
#define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
#define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
#define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
#define traceQUEUE_PEEK( pxQueue )
#define traceQUEUE_PEEK_FAILED( pxQueue )
#define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
#define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
#define traceTASK_PRIORITY_INHERIT( pxTask, uxNewPriority )
#define traceTASK_PRIORITY_DISINHERIT( pxTask, uxNewPriority )
#define traceTASK_RESUME( pxTaskToResume )
#define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
#define traceTIMER_CREATE(tmr)
#define traceTIMER_COMMAND_SEND(tmr, xCommandID, xOptionalValue, xReturn)
#define traceTIMER_COMMAND_SEND_FROM_ISR(tmr, xCommandID, xOptionalValue, xReturn)
#define traceTIMER_COMMAND_PROCESS( tmr, xCommandID, xOptionalValue )
#define traceTIMER_CALLBACK( tmr, callbackFunction )
#define traceEVENT_GROUP_CREATE(eg)
#define traceEVENT_GROUP_CREATE_FAILED()
#define traceEVENT_GROUP_DELETE(eg)
#define traceEVENT_GROUP_DELETE_FAILED(eg)
#define traceEVENT_GROUP_SET_BITS(eg, bitsToSet)
#define traceEVENT_GROUP_SET_BITS_FAILED(eg, bitsToSet)
#define traceEVENT_GROUP_SET_BITS_FROM_ISR(eg, bitsToSet)
#define traceEVENT_GROUP_SET_BITS_FROM_ISR_FAILED(eg, bitsToSet)
#define traceEVENT_GROUP_WAIT_BITS(eg, bitsToWaitFor, timeout)
#define traceEVENT_GROUP_WAIT_BITS_FAILED(eg, bitsToWaitFor, timeout)
#define traceEVENT_GROUP_WAIT_BITS_BLOCK(eg, bitsToWaitFor, timeout)
#define traceEVENT_GROUP_CLEAR_BITS(eg, bitsToClear)
#define traceEVENT_GROUP_CLEAR_BITS_FAILED(eg, bitsToClear)
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR(eg, bitsToClear)
#define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR_FAILED(eg, bitsToClear)
#define traceTASK_NOTIFY_WAIT()
#define traceTASK_NOTIFY_WAIT_FAILED()
#define traceTASK_NOTIFY_WAIT_BLOCK()
#define traceTASK_NOTIFY_SEND()
#define traceTASK_NOTIFY_SEND_FAILED()
#define traceTASK_NOTIFY_SEND_FROM_ISR()
#define traceTASK_NOTIFY_SEND_FROM_ISR_FAILED()
#endif /* (TRC_CFG_SCHEDULING_ONLY == 1) */
#else /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
/* when recorder disabled */
#define vTraceSetQueueName(object, name)
#define vTraceSetSemaphoreName(object, name)
#define vTraceSetMutexName(object, name)
#define vTraceSetEventGroupName(object, name)
#endif /*(TRC_USE_TRACEALYZER_RECORDER == 1)*/
#ifdef __cplusplus
}
#endif
#endif /* TRC_KERNEL_PORT_H */
| 43.172543 | 278 | 0.747147 | [
"object"
] |
87fdacbffdf4fce42890d0a3e71b97b75d69f7de | 40,833 | h | C | redist/inc/cmqzc.h | gmarcon83/mq-mqi-nodejs | 27d44772254d0d76438022c6305277f603ff6acb | [
"Apache-2.0"
] | null | null | null | redist/inc/cmqzc.h | gmarcon83/mq-mqi-nodejs | 27d44772254d0d76438022c6305277f603ff6acb | [
"Apache-2.0"
] | null | null | null | redist/inc/cmqzc.h | gmarcon83/mq-mqi-nodejs | 27d44772254d0d76438022c6305277f603ff6acb | [
"Apache-2.0"
] | null | null | null | #if !defined(MQZC_INCLUDED) /* File not yet included? */
#define MQZC_INCLUDED /* Show file now included */
/****************************************************************/
/* */
/* IBM MQ for LinuxIntel */
/* */
/* FILE NAME: CMQZC */
/* */
/* DESCRIPTION: Declarations for Installable Services */
/* */
/****************************************************************/
/* */
/* <copyright */
/* notice="lm-source-program" */
/* pids="5724-H72" */
/* years="1993,2021" */
/* crc="2042140514" > */
/* Licensed Materials - Property of IBM */
/* */
/* 5724-H72 */
/* */
/* (C) Copyright IBM Corp. 1993, 2021 All Rights Reserved. */
/* */
/* US Government Users Restricted Rights - Use, duplication or */
/* disclosure restricted by GSA ADP Schedule Contract with */
/* IBM Corp. */
/* </copyright> */
/* */
/****************************************************************/
/* */
/* FUNCTION: This file declares the functions, */
/* structures and named constants for */
/* Installable Services. */
/* */
/* PROCESSOR: C */
/* */
/****************************************************************/
/****************************************************************/
/* <BEGIN_BUILDINFO> */
/* Generated on: 11/4/21 3:44 PM */
/* Build Level: p924-L211104 */
/* Build Type: Production */
/* Pointer Size: 32 Bit, 64 Bit */
/* Source File: */
/* @(#) MQMBID sn=p924-L211104 su=_OdbBaj17EeygWfM06SbNXw */
/* pn=com.ibm.mq.famfiles.data/xml/approved/cmqzc.xml */
/* <END_BUILDINFO> */
/****************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/****************************************************************/
/* Values Related to MQZED Structure */
/****************************************************************/
/* Structure Identifier */
#define MQZED_STRUC_ID "ZED "
/* Structure Identifier (array form) */
#define MQZED_STRUC_ID_ARRAY 'Z','E','D',' '
/* Structure Version Number */
#define MQZED_VERSION_1 1
#define MQZED_VERSION_2 2
#define MQZED_CURRENT_VERSION 2
/* Structure Length */
#if defined(MQ_64_BIT)
#define MQZED_LENGTH_1 64
#else
#define MQZED_LENGTH_1 56
#endif
#if defined(MQ_64_BIT)
#define MQZED_LENGTH_2 72
#else
#define MQZED_LENGTH_2 60
#endif
#if defined(MQ_64_BIT)
#define MQZED_CURRENT_LENGTH 72
#else
#define MQZED_CURRENT_LENGTH 60
#endif
/****************************************************************/
/* Values Related to MQZAC Structure */
/****************************************************************/
/* Structure Identifier */
#define MQZAC_STRUC_ID "ZAC "
/* Structure Identifier (array form) */
#define MQZAC_STRUC_ID_ARRAY 'Z','A','C',' '
/* Structure Version Number */
#define MQZAC_VERSION_1 1
#define MQZAC_CURRENT_VERSION 1
/* Structure Length */
#define MQZAC_LENGTH_1 84
#define MQZAC_CURRENT_LENGTH 84
/* Authentication Types */
#define MQZAT_INITIAL_CONTEXT 0
#define MQZAT_CHANGE_CONTEXT 1
/****************************************************************/
/* Values Related to MQZAD Structure */
/****************************************************************/
/* Structure Identifier */
#define MQZAD_STRUC_ID "ZAD "
/* Structure Identifier (array form) */
#define MQZAD_STRUC_ID_ARRAY 'Z','A','D',' '
/* Structure Version Number */
#define MQZAD_VERSION_1 1
#define MQZAD_VERSION_2 2
#define MQZAD_CURRENT_VERSION 2
/* Structure Length */
#if defined(MQ_64_BIT)
#define MQZAD_LENGTH_1 80
#else
#define MQZAD_LENGTH_1 72
#endif
#if defined(MQ_64_BIT)
#define MQZAD_LENGTH_2 80
#else
#define MQZAD_LENGTH_2 76
#endif
#if defined(MQ_64_BIT)
#define MQZAD_CURRENT_LENGTH 80
#else
#define MQZAD_CURRENT_LENGTH 76
#endif
/****************************************************************/
/* Values Related to MQZFP Structure */
/****************************************************************/
/* Structure Identifier */
#define MQZFP_STRUC_ID "ZFP "
/* Structure Identifier (array form) */
#define MQZFP_STRUC_ID_ARRAY 'Z','F','P',' '
/* Structure Version Number */
#define MQZFP_VERSION_1 1
#define MQZFP_CURRENT_VERSION 1
/* Structure Length */
#if defined(MQ_64_BIT)
#define MQZFP_LENGTH_1 24
#else
#define MQZFP_LENGTH_1 20
#endif
#if defined(MQ_64_BIT)
#define MQZFP_CURRENT_LENGTH 24
#else
#define MQZFP_CURRENT_LENGTH 20
#endif
/****************************************************************/
/* Values Related to MQZIC Structure */
/****************************************************************/
/* Structure Identifier */
#define MQZIC_STRUC_ID "ZIC "
/* Structure Identifier (array form) */
#define MQZIC_STRUC_ID_ARRAY 'Z','I','C',' '
/* Structure Version Number */
#define MQZIC_VERSION_1 1
#define MQZIC_CURRENT_VERSION 1
/* Structure Length */
#define MQZIC_LENGTH_1 84
#define MQZIC_CURRENT_LENGTH 84
/****************************************************************/
/* Values Related to All Services */
/****************************************************************/
/* Initialization Options */
#define MQZIO_PRIMARY 0
#define MQZIO_SECONDARY 1
/* Termination Options */
#define MQZTO_PRIMARY 0
#define MQZTO_SECONDARY 1
/* Continuation Indicator */
#define MQZCI_DEFAULT 0
#define MQZCI_CONTINUE 0
#define MQZCI_STOP 1
/****************************************************************/
/* Values Related to Authority Service */
/****************************************************************/
/* Service Interface Version */
#define MQZAS_VERSION_1 1
#define MQZAS_VERSION_2 2
#define MQZAS_VERSION_3 3
#define MQZAS_VERSION_4 4
#define MQZAS_VERSION_5 5
#define MQZAS_VERSION_6 6
/* Authorizations */
#define MQZAO_CONNECT 0x00000001
#define MQZAO_BROWSE 0x00000002
#define MQZAO_INPUT 0x00000004
#define MQZAO_OUTPUT 0x00000008
#define MQZAO_INQUIRE 0x00000010
#define MQZAO_SET 0x00000020
#define MQZAO_PASS_IDENTITY_CONTEXT 0x00000040
#define MQZAO_PASS_ALL_CONTEXT 0x00000080
#define MQZAO_SET_IDENTITY_CONTEXT 0x00000100
#define MQZAO_SET_ALL_CONTEXT 0x00000200
#define MQZAO_ALTERNATE_USER_AUTHORITY 0x00000400
#define MQZAO_PUBLISH 0x00000800
#define MQZAO_SUBSCRIBE 0x00001000
#define MQZAO_RESUME 0x00002000
#define MQZAO_ALL_MQI 0x00003FFF
#define MQZAO_CREATE 0x00010000
#define MQZAO_DELETE 0x00020000
#define MQZAO_DISPLAY 0x00040000
#define MQZAO_CHANGE 0x00080000
#define MQZAO_CLEAR 0x00100000
#define MQZAO_CONTROL 0x00200000
#define MQZAO_CONTROL_EXTENDED 0x00400000
#define MQZAO_AUTHORIZE 0x00800000
#define MQZAO_ALL_ADMIN 0x00FE0000
#define MQZAO_SYSTEM 0x02000000
#define MQZAO_ALL 0x02FE3FFF
#define MQZAO_REMOVE 0x01000000
#define MQZAO_NONE 0x00000000
#define MQZAO_CREATE_ONLY 0x04000000
/* Entity Types */
#define MQZAET_NONE 0x00000000
#define MQZAET_PRINCIPAL 0x00000001
#define MQZAET_GROUP 0x00000002
#define MQZAET_UNKNOWN 0x00000003
/* Start-Enumeration Indicator */
#define MQZSE_START 1
#define MQZSE_CONTINUE 0
/* Selector Indicator */
#define MQZSL_NOT_RETURNED 0
#define MQZSL_RETURNED 1
/****************************************************************/
/* Values Related to Name Service */
/****************************************************************/
/* Service Interface Version */
#define MQZNS_VERSION_1 1
/****************************************************************/
/* Values Related to Userid Service */
/****************************************************************/
/* Service Interface Version */
#define MQZUS_VERSION_1 1
/****************************************************************/
/* Values Related to MQZEP Function */
/****************************************************************/
/* Function ids common to all services */
#define MQZID_INIT 0
#define MQZID_TERM 1
/* Function ids for Authority service */
#define MQZID_INIT_AUTHORITY 0
#define MQZID_TERM_AUTHORITY 1
#define MQZID_CHECK_AUTHORITY 2
#define MQZID_COPY_ALL_AUTHORITY 3
#define MQZID_DELETE_AUTHORITY 4
#define MQZID_SET_AUTHORITY 5
#define MQZID_GET_AUTHORITY 6
#define MQZID_GET_EXPLICIT_AUTHORITY 7
#define MQZID_REFRESH_CACHE 8
#define MQZID_ENUMERATE_AUTHORITY_DATA 9
#define MQZID_AUTHENTICATE_USER 10
#define MQZID_FREE_USER 11
#define MQZID_INQUIRE 12
#define MQZID_CHECK_PRIVILEGED 13
/* Function ids for Name service */
#define MQZID_INIT_NAME 0
#define MQZID_TERM_NAME 1
#define MQZID_LOOKUP_NAME 2
#define MQZID_INSERT_NAME 3
#define MQZID_DELETE_NAME 4
/* Function ids for Userid service */
#define MQZID_INIT_USERID 0
#define MQZID_TERM_USERID 1
#define MQZID_FIND_USERID 2
/****************************************************************/
/* MQZED Structure -- Entity Data */
/****************************************************************/
typedef struct tagMQZED MQZED;
typedef MQZED MQPOINTER PMQZED;
struct tagMQZED {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
PMQCHAR EntityNamePtr; /* Address of entity name */
PMQCHAR EntityDomainPtr; /* Address of entity domain name */
MQBYTE40 SecurityId; /* Security identifier */
/* Ver:1 */
MQPTR CorrelationPtr; /* Address of correlational data */
/* Ver:2 */
};
#define MQZED_DEFAULT {MQZED_STRUC_ID_ARRAY},\
MQZED_VERSION_1,\
NULL,\
NULL,\
{MQSID_NONE_ARRAY},\
NULL
/****************************************************************/
/* MQZAC Structure -- Application Context */
/****************************************************************/
typedef struct tagMQZAC MQZAC;
typedef MQZAC MQPOINTER PMQZAC;
struct tagMQZAC {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQPID ProcessId; /* Process identifier of */
/* application */
MQTID ThreadId; /* Thread identifier of application */
MQCHAR28 ApplName; /* Application name */
MQCHAR12 UserID; /* User ID of application */
MQCHAR12 EffectiveUserID; /* Effective user ID of application */
MQLONG Environment; /* Environment of caller */
MQLONG CallerType; /* Type of caller */
MQLONG AuthenticationType; /* Type of authentication being */
/* performed */
MQLONG BindType; /* Type of bindings in use */
};
#define MQZAC_DEFAULT {MQZAC_STRUC_ID_ARRAY},\
MQZAC_VERSION_1,\
0,\
0,\
{""},\
{""},\
{""},\
0,\
0,\
0,\
0
/****************************************************************/
/* MQZAD Structure -- Authority Data */
/****************************************************************/
typedef struct tagMQZAD MQZAD;
typedef MQZAD MQPOINTER PMQZAD;
struct tagMQZAD {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQCHAR48 ProfileName; /* Profile name */
MQLONG ObjectType; /* Object type */
MQLONG Authority; /* Authority */
PMQZED EntityDataPtr; /* Address of MQZED structure */
/* identifying an entity */
MQLONG EntityType; /* Entity type */
/* Ver:1 */
MQLONG Options; /* Options */
/* Ver:2 */
};
#define MQZAD_DEFAULT {MQZAD_STRUC_ID_ARRAY},\
MQZAD_VERSION_1,\
{""},\
MQOT_ALL,\
0,\
NULL,\
0,\
(MQAUTHOPT_NAME_ALL_MATCHING | MQAUTHOPT_ENTITY_EXPLICIT)
/****************************************************************/
/* MQZFP Structure -- Free Parameters */
/****************************************************************/
typedef struct tagMQZFP MQZFP;
typedef MQZFP MQPOINTER PMQZFP;
struct tagMQZFP {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQBYTE8 Reserved; /* Reserved */
MQPTR CorrelationPtr; /* Address of correlational data */
};
#define MQZFP_DEFAULT {MQZFP_STRUC_ID_ARRAY},\
MQZFP_VERSION_1,\
{'\0','\0','\0','\0','\0','\0','\0','\0'},\
NULL
/****************************************************************/
/* MQZIC Structure -- Identity Context */
/****************************************************************/
typedef struct tagMQZIC MQZIC;
typedef MQZIC MQPOINTER PMQZIC;
struct tagMQZIC {
MQCHAR4 StrucId; /* Structure identifier */
MQLONG Version; /* Structure version number */
MQCHAR12 UserIdentifier; /* User identifier */
MQBYTE32 AccountingToken; /* Accounting token */
MQCHAR32 ApplIdentityData; /* Application data relating to */
/* identity */
};
#define MQZIC_DEFAULT {MQZIC_STRUC_ID_ARRAY},\
MQZIC_VERSION_1,\
{""},\
{MQACT_NONE_ARRAY},\
{""}
/****************************************************************/
/* MQZEP -- Add Component Entry Point */
/****************************************************************/
void MQENTRY MQZEP (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Function, /* I: Function identifier */
PMQFUNC pEntryPoint, /* I: Function entry point */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef void MQENTRY MQ_ZEP_CALL (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Function, /* I: Function identifier */
PMQFUNC pEntryPoint, /* I: Function entry point */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQ_ZEP_CALL MQPOINTER PMQ_ZEP_CALL;
/****************************************************************/
/* MQZ_INIT_AUTHORITY - Initialize Authority-Services */
/****************************************************************/
typedef void MQENTRY MQZ_INIT_AUTHORITY (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Initialization options */
PMQCHAR pQMgrName, /* I: Queue manager name */
MQLONG ComponentDataLength, /* I: Length of component data */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pVersion, /* I: Version number */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_INIT_AUTHORITY MQPOINTER PMQZ_INIT_AUTHORITY;
/****************************************************************/
/* MQZ_TERM_AUTHORITY - Terminate Authority-Services */
/****************************************************************/
typedef void MQENTRY MQZ_TERM_AUTHORITY (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Termination options */
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQBYTE pComponentData, /* I: Component data */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_TERM_AUTHORITY MQPOINTER PMQZ_TERM_AUTHORITY;
/****************************************************************/
/* MQZ_DELETE_AUTHORITY - Delete Authority */
/****************************************************************/
typedef void MQENTRY MQZ_DELETE_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_DELETE_AUTHORITY MQPOINTER PMQZ_DELETE_AUTHORITY;
/****************************************************************/
/* MQZ_GET_AUTHORITY - Get Authority */
/****************************************************************/
typedef void MQENTRY MQZ_GET_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pEntityName, /* I: Entity name */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQLONG pAuthority, /* O: Authority of entity */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_GET_AUTHORITY MQPOINTER PMQZ_GET_AUTHORITY;
/****************************************************************/
/* MQZ_GET_AUTHORITY_2 - Get Authority Version 2 */
/****************************************************************/
typedef void MQENTRY MQZ_GET_AUTHORITY_2 (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZED pEntityData, /* I: Entity data */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQLONG pAuthority, /* O: Authority of entity */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_GET_AUTHORITY_2 MQPOINTER PMQZ_GET_AUTHORITY_2;
/****************************************************************/
/* MQZ_GET_EXPLICIT_AUTHORITY - Get Explicit Authority */
/****************************************************************/
typedef void MQENTRY MQZ_GET_EXPLICIT_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pEntityName, /* I: Entity name */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQLONG pAuthority, /* O: Authority of entity */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_GET_EXPLICIT_AUTHORITY MQPOINTER PMQZ_GET_EXPLICIT_AUTHORITY;
/****************************************************************/
/* MQZ_GET_EXPLICIT_AUTHORITY_2 - Get Explicit Authority */
/* Version 2 */
/****************************************************************/
typedef void MQENTRY MQZ_GET_EXPLICIT_AUTHORITY_2 (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZED pEntityData, /* I: Entity data */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQLONG pAuthority, /* O: Authority of entity */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_GET_EXPLICIT_AUTHORITY_2 MQPOINTER PMQZ_GET_EXPLICIT_AUTHORITY_2;
/****************************************************************/
/* MQZ_ENUMERATE_AUTHORITY_DATA - Enumerate Authority Data */
/****************************************************************/
typedef void MQENTRY MQZ_ENUMERATE_AUTHORITY_DATA (
PMQCHAR pQMgrName, /* I: Queue manager name */
MQLONG StartEnumeration, /* I: Flag indicating whether */
/* call should start enumeration */
PMQZAD pFilter, /* I: Filter */
MQLONG AuthorityBufferLength, /* I: Length of AuthorityBuffer */
PMQZAD pAuthorityBuffer, /* O: Authority data */
PMQLONG pAuthorityDataLength, /* O: Length of data returned in */
/* AuthorityBuffer */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set */
/* by component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_ENUMERATE_AUTHORITY_DATA MQPOINTER PMQZ_ENUMERATE_AUTHORITY_DATA;
/****************************************************************/
/* MQZ_SET_AUTHORITY - Set Authority */
/****************************************************************/
typedef void MQENTRY MQZ_SET_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pEntityName, /* I: Entity name */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
MQLONG Authority, /* I: Authority to be checked */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_SET_AUTHORITY MQPOINTER PMQZ_SET_AUTHORITY;
/****************************************************************/
/* MQZ_SET_AUTHORITY_2 - Set Authority Version 2 */
/****************************************************************/
typedef void MQENTRY MQZ_SET_AUTHORITY_2 (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZED pEntityData, /* I: Entity data */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
MQLONG Authority, /* I: Authority to be checked */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_SET_AUTHORITY_2 MQPOINTER PMQZ_SET_AUTHORITY_2;
/****************************************************************/
/* MQZ_COPY_ALL_AUTHORITY - Copy All Authority */
/****************************************************************/
typedef void MQENTRY MQZ_COPY_ALL_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pRefObjectName, /* I: Reference object name */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_COPY_ALL_AUTHORITY MQPOINTER PMQZ_COPY_ALL_AUTHORITY;
/****************************************************************/
/* MQZ_CHECK_AUTHORITY - Check Authority */
/****************************************************************/
typedef void MQENTRY MQZ_CHECK_AUTHORITY (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pEntityName, /* I: Entity name */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
MQLONG Authority, /* I: Authority to be checked */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_CHECK_AUTHORITY MQPOINTER PMQZ_CHECK_AUTHORITY;
/****************************************************************/
/* MQZ_CHECK_AUTHORITY_2 - Check Authority Version 2 */
/****************************************************************/
typedef void MQENTRY MQZ_CHECK_AUTHORITY_2 (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZED pEntityData, /* I: Entity data */
MQLONG EntityType, /* I: Entity type */
PMQCHAR pObjectName, /* I: Object name */
MQLONG ObjectType, /* I: Object type */
MQLONG Authority, /* I: Authority to be checked */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_CHECK_AUTHORITY_2 MQPOINTER PMQZ_CHECK_AUTHORITY_2;
/****************************************************************/
/* MQZ_AUTHENTICATE_USER - Authenticate User */
/****************************************************************/
typedef void MQENTRY MQZ_AUTHENTICATE_USER (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCSP pSecurityParms, /* I: Security parameters */
PMQZAC pApplicationContext, /* I: Application context */
PMQZIC pIdentityContext, /* I: Identity context */
PMQPTR pCorrelationPtr, /* I: Correlation data */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_AUTHENTICATE_USER MQPOINTER PMQZ_AUTHENTICATE_USER;
/****************************************************************/
/* MQZ_FREE_USER - Free User */
/****************************************************************/
typedef void MQENTRY MQZ_FREE_USER (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZFP pFreeParms, /* I: Free parameters */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_FREE_USER MQPOINTER PMQZ_FREE_USER;
/****************************************************************/
/* MQZ_INQUIRE - Inquire */
/****************************************************************/
typedef void MQENTRY MQZ_INQUIRE (
PMQCHAR pQMgrName, /* I: Queue manager name */
MQLONG SelectorCount, /* I: Count of selectors */
PMQLONG pSelectors, /* I: Array of attribute selectors */
MQLONG IntAttrCount, /* I: Count of integer attributes */
PMQLONG pIntAttrs, /* I: Array of integer attributes */
MQLONG CharAttrLength, /* I: Length of character attributes */
/* buffer */
PMQCHAR pCharAttrs, /* I: Character attributes */
PMQLONG pSelectorReturned, /* O: Array of returned selector */
/* indicators */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_INQUIRE MQPOINTER PMQZ_INQUIRE;
/****************************************************************/
/* MQZ_REFRESH_CACHE - Refresh Cache */
/****************************************************************/
typedef void MQENTRY MQZ_REFRESH_CACHE (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_REFRESH_CACHE MQPOINTER PMQZ_REFRESH_CACHE;
/****************************************************************/
/* MQZ_CHECK_PRIVILEGED - Check if User is Privileged */
/****************************************************************/
typedef void MQENTRY MQZ_CHECK_PRIVILEGED (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQZED pEntityData, /* I: Entity data */
MQLONG EntityType, /* I: Entity type */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_CHECK_PRIVILEGED MQPOINTER PMQZ_CHECK_PRIVILEGED;
/****************************************************************/
/* MQZ_INIT_NAME - Initialize Name-Services */
/****************************************************************/
typedef void MQENTRY MQZ_INIT_NAME (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Initialization options */
PMQCHAR pQMgrName, /* I: Queue manager name */
MQLONG ComponentDataLength, /* I: Length of component data */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pVersion, /* I: Version number */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_INIT_NAME MQPOINTER PMQZ_INIT_NAME;
/****************************************************************/
/* MQZ_TERM_NAME - Terminate Name-Services */
/****************************************************************/
typedef void MQENTRY MQZ_TERM_NAME (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Termination options */
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQBYTE pComponentData, /* I: Component data */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_TERM_NAME MQPOINTER PMQZ_TERM_NAME;
/****************************************************************/
/* MQZ_LOOKUP_NAME - Look-Up Name */
/****************************************************************/
typedef void MQENTRY MQZ_LOOKUP_NAME (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pQName, /* I: Queue name */
PMQCHAR pResolvedQMgrName, /* I: Resolved queue manager name */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_LOOKUP_NAME MQPOINTER PMQZ_LOOKUP_NAME;
/****************************************************************/
/* MQZ_INSERT_NAME - Insert Name */
/****************************************************************/
typedef void MQENTRY MQZ_INSERT_NAME (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pQName, /* I: Queue name */
PMQCHAR pResolvedQMgrName, /* I: Resolved queue manager name */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_INSERT_NAME MQPOINTER PMQZ_INSERT_NAME;
/****************************************************************/
/* MQZ_DELETE_NAME - Delete Name */
/****************************************************************/
typedef void MQENTRY MQZ_DELETE_NAME (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pQName, /* I: Queue name */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_DELETE_NAME MQPOINTER PMQZ_DELETE_NAME;
/****************************************************************/
/* MQZ_INIT_USERID - Initialize Userid-Services */
/****************************************************************/
typedef void MQENTRY MQZ_INIT_USERID (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Initialization options */
PMQCHAR pQMgrName, /* I: Queue manager name */
MQLONG ComponentDataLength, /* I: Length of component data */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pVersion, /* I: Version number */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying */
/* CompCode */
typedef MQZ_INIT_USERID MQPOINTER PMQZ_INIT_USERID;
/****************************************************************/
/* MQZ_TERM_USERID - Terminate Userid-Services */
/****************************************************************/
typedef void MQENTRY MQZ_TERM_USERID (
MQHCONFIG Hconfig, /* I: Configuration handle */
MQLONG Options, /* I: Termination options */
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQBYTE pComponentData, /* I: Component data */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_TERM_USERID MQPOINTER PMQZ_TERM_USERID;
/****************************************************************/
/* MQZ_FIND_USERID - Find Userid */
/****************************************************************/
typedef void MQENTRY MQZ_FIND_USERID (
PMQCHAR pQMgrName, /* I: Queue manager name */
PMQCHAR pUserId, /* I: User identifier */
PMQCHAR pPassword, /* I: Password */
PMQBYTE pComponentData, /* IO: Component data */
PMQLONG pContinuation, /* O: Continuation indicator set by */
/* component */
PMQLONG pCompCode, /* OC: Completion code */
PMQLONG pReason); /* OR: Reason code qualifying CompCode */
typedef MQZ_FIND_USERID MQPOINTER PMQZ_FIND_USERID;
#if defined(__cplusplus)
}
#endif
/****************************************************************/
/* End of CMQZC */
/****************************************************************/
#endif /* End of header file */
| 43.906452 | 80 | 0.463204 | [
"object"
] |
87fdd0a482ceb2622e7961f2c42738d49f9da8b3 | 1,916 | h | C | blades/xbmc/xbmc/interfaces/builtins/Builtins.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 4 | 2016-04-26T03:43:54.000Z | 2016-11-17T08:09:04.000Z | blades/xbmc/xbmc/interfaces/builtins/Builtins.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 17 | 2015-01-05T21:06:22.000Z | 2015-12-07T20:45:44.000Z | blades/xbmc/xbmc/interfaces/builtins/Builtins.h | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 3 | 2016-04-26T03:43:55.000Z | 2020-11-06T11:02:08.000Z | #pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* 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, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <map>
#include <string>
#include <vector>
class CBuiltins
{
public:
//! \brief Struct representing a command from handler classes.
struct BUILT_IN
{
std::string description; //!< Description of command (help string)
size_t parameters; //!< Number of required parameters (can be 0)
int (*Execute)(const std::vector<std::string>& params); //!< Function to handle command
};
//! \brief A map of commands
typedef std::map<std::string,CBuiltins::BUILT_IN> CommandMap;
static CBuiltins& GetInstance();
bool HasCommand(const std::string& execString);
bool IsSystemPowerdownCommand(const std::string& execString);
void GetHelp(std::string &help);
int Execute(const std::string& execString);
protected:
CBuiltins();
CBuiltins(const CBuiltins&);
const CBuiltins& operator=(const CBuiltins&);
virtual ~CBuiltins();
private:
CommandMap m_command; //!< Map of registered commands
//! \brief Convenience template used to register commands from providers
template<class T>
void RegisterCommands()
{
T t;
CommandMap map = t.GetOperations();
m_command.insert(map.begin(), map.end());
}
};
| 28.176471 | 91 | 0.701983 | [
"vector"
] |
e201a5c8778f96f76f18a02ed310c62262c7f47f | 1,895 | h | C | SimTKmath/Integrators/src/CPodes/sundials/src/cpodes/cpodes_bandpre_impl.h | e-schumann/simbody | 4d8842270d5c400ef64cfd5723e0e0399161e51f | [
"Apache-2.0"
] | 1,916 | 2015-01-01T09:35:21.000Z | 2022-03-30T11:38:43.000Z | SimTKmath/Integrators/src/CPodes/sundials/src/cpodes/cpodes_bandpre_impl.h | e-schumann/simbody | 4d8842270d5c400ef64cfd5723e0e0399161e51f | [
"Apache-2.0"
] | 389 | 2015-01-01T01:13:51.000Z | 2022-03-16T15:30:58.000Z | SimTKmath/Integrators/src/CPodes/sundials/src/cpodes/cpodes_bandpre_impl.h | e-schumann/simbody | 4d8842270d5c400ef64cfd5723e0e0399161e51f | [
"Apache-2.0"
] | 486 | 2015-01-02T10:25:49.000Z | 2022-03-16T15:31:40.000Z | /*
* -----------------------------------------------------------------
* $Revision: 1.2 $
* $Date: 2006/11/22 00:12:48 $
* -----------------------------------------------------------------
* Programmer: Radu Serban @ LLNL
* -----------------------------------------------------------------
* Copyright (c) 2006, The Regents of the University of California.
* Produced at the Lawrence Livermore National Laboratory.
* All rights reserved.
* For details, see the LICENSE file.
* -----------------------------------------------------------------
* Implementation header file for the CPBANDPRE module.
* -----------------------------------------------------------------
*/
#ifndef _CPBANDPRE_IMPL_H
#define _CPBANDPRE_IMPL_H
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
#include <cpodes/cpodes_bandpre.h>
#include <sundials/sundials_band.h>
/*
* -----------------------------------------------------------------
* Type: CPBandPrecData
* -----------------------------------------------------------------
*/
typedef struct {
/* Data set by user in CPBandPrecAlloc */
int N;
int ml, mu;
/* Data set by CPBandPrecSetup */
DlsMat savedJ;
DlsMat savedP;
int *pivots;
/* Function evaluations for DQ Jacobian approximation */
long int nfeBP;
/* Pointer to cpode_mem */
void *cpode_mem;
} *CPBandPrecData;
/*
* -----------------------------------------------------------------
* CPBANDPRE error messages
* -----------------------------------------------------------------
*/
#define MSGBP_CPMEM_NULL "Integrator memory is NULL."
#define MSGBP_MEM_FAIL "A memory request failed."
#define MSGBP_BAD_NVECTOR "A required vector operation is not implemented."
#define MSGBP_PDATA_NULL "BandPrecData is NULL."
#define MSGBP_FUNC_FAILED "The ODE function failed in an unrecoverable manner."
#ifdef __cplusplus
}
#endif
#endif
| 27.071429 | 79 | 0.487599 | [
"vector"
] |
e202747e4af350ab36ef8939fb3ba756c24dfbc2 | 2,342 | h | C | OpenSees/SRC/domain/constraints/RigidDiaphragm.h | kuanshi/ductile-fracture | ccb350564df54f5c5ec3a079100effe261b46650 | [
"MIT"
] | 8 | 2019-03-05T16:25:10.000Z | 2020-04-17T14:12:03.000Z | SRC/domain/constraints/RigidDiaphragm.h | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | null | null | null | SRC/domain/constraints/RigidDiaphragm.h | steva44/OpenSees | 417c3be117992a108c6bbbcf5c9b63806b9362ab | [
"TCL"
] | 3 | 2019-09-21T03:11:11.000Z | 2020-01-19T07:29:37.000Z | /* ****************************************************************** **
** OpenSees - Open System for Earthquake Engineering Simulation **
** Pacific Earthquake Engineering Research Center **
** **
** **
** (C) Copyright 1999, The Regents of the University of California **
** All Rights Reserved. **
** **
** Commercial use of this program without express permission of the **
** University of California, Berkeley, is strictly prohibited. See **
** file 'COPYRIGHT' in main directory for information on usage and **
** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
** **
** Developed by: **
** Frank McKenna (fmckenna@ce.berkeley.edu) **
** Gregory L. Fenves (fenves@ce.berkeley.edu) **
** Filip C. Filippou (filippou@ce.berkeley.edu) **
** **
** ****************************************************************** */
// $Revision: 1.3 $
// $Date: 2010-04-23 22:50:19 $
// $Source: /usr/local/cvs/OpenSees/SRC/domain/constraints/RigidDiaphragm.h,v $
// File: ~/model/constraints/RigidDiaphragm.h
//
// Written: fmk 1/99
// Revised:
//
// Purpose: This file contains the class definition for RigidDiaphragm.
// RigidDiaphragm is a class which constructs MP_Constraint objects
// for a 3d Frame with a rigid diaphragm .. suitable for small
// displacement problems only.
#ifndef RigidDiaphragm_h
#define RigidDiaphragm_h
class Domain;
class ID;
class RigidDiaphragm
{
public:
RigidDiaphragm(Domain &theDomain, int nodeR, ID &nodeC,
int perpDirnToPlaneConstrained);
virtual ~RigidDiaphragm();
protected:
private:
};
#endif
| 42.581818 | 79 | 0.431682 | [
"model",
"3d"
] |
e205f30e34f8e1f052b5f1ab3325d632d31da787 | 3,225 | h | C | VisualizationBase/src/styles/StyleSet.h | dimitar-asenov/Envision | 1ab5c846fca502b7fe73ae4aff59e8746248446c | [
"BSD-3-Clause"
] | 75 | 2015-01-18T13:29:43.000Z | 2022-01-14T08:02:01.000Z | VisualizationBase/src/styles/StyleSet.h | dimitar-asenov/Envision | 1ab5c846fca502b7fe73ae4aff59e8746248446c | [
"BSD-3-Clause"
] | 364 | 2015-01-06T10:20:21.000Z | 2018-12-17T20:12:28.000Z | VisualizationBase/src/styles/StyleSet.h | dimitar-asenov/Envision | 1ab5c846fca502b7fe73ae4aff59e8746248446c | [
"BSD-3-Clause"
] | 14 | 2015-01-09T00:44:24.000Z | 2022-02-22T15:01:44.000Z | /***********************************************************************************************************************
**
** Copyright (c) 2011, 2014 ETH Zurich
** 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 ETH Zurich 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.
**
***********************************************************************************************************************/
#pragma once
#include "../VisualizationException.h"
#include "StyleLoader.h"
namespace Visualization {
class Style;
extern QList<QMap<QString, Style*>*> styleSetMaps_;
void clearAllStyleSets();
template<typename T> class StyleSet
{
public:
StyleSet(const QString& classType);
~StyleSet();
typename T::StyleType* get(const QString& styleName = {});
private:
QMap<QString, typename T::StyleType*> styles_;
/*
* This determines the folder inside the root 'styles' folder that will be used to look for this item's own
* directory. Typical values are "item", "shape", "layout" and "icon".
*/
QString classType_;
};
template<typename T> StyleSet<T>::StyleSet(const QString& classType) : classType_{classType}
{
styleSetMaps_.append(reinterpret_cast<QMap<QString, Style*>*>(&styles_));
}
template<typename T> StyleSet<T>::~StyleSet() {}
template<typename T> typename T::StyleType* StyleSet<T>::get(const QString& styleName)
{
QString name(styleName);
if (name.isEmpty()) name = "default";
typename T::StyleType* style = styles_.value(name, nullptr);
if (style) return style;
style = StyleLoader{}.loadStyle<typename T::StyleType>(classType_ + "/" + T::typeNameStatic(), name);
if (style)
{
styles_.insert(name, style);
return style;
}
else throw VisualizationException{"Could not find the style '" + classType_ + "/" + T::typeNameStatic()
+ "/" + styleName + "'"};
}
}
| 39.329268 | 120 | 0.682481 | [
"shape"
] |
e2158728039863f1f71c807cfbab43507523abaa | 3,049 | h | C | attacking_anti_tamper/taint_cpp/extern/keystone/llvm/include/llvm/Support/MemoryObject.h | tum-i4/dta-vs-osc | b39f4d4eb6ffea501025fc3e07622251c2118fe0 | [
"MIT"
] | 15 | 2021-12-08T09:53:35.000Z | 2022-03-07T10:13:37.000Z | attacking_anti_tamper/taint_cpp/extern/keystone/llvm/include/llvm/Support/MemoryObject.h | archercreat/dta-vs-osc | b39f4d4eb6ffea501025fc3e07622251c2118fe0 | [
"MIT"
] | null | null | null | attacking_anti_tamper/taint_cpp/extern/keystone/llvm/include/llvm/Support/MemoryObject.h | archercreat/dta-vs-osc | b39f4d4eb6ffea501025fc3e07622251c2118fe0 | [
"MIT"
] | 1 | 2021-12-27T18:01:41.000Z | 2021-12-27T18:01:41.000Z | //===- MemoryObject.h - Abstract memory interface ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_MEMORYOBJECT_H
#define LLVM_SUPPORT_MEMORYOBJECT_H
#include "llvm/Support/DataTypes.h"
namespace llvm_ks {
/// Interface to data which might be streamed. Streamability has 2 important
/// implications/restrictions. First, the data might not yet exist in memory
/// when the request is made. This just means that readByte/readBytes might have
/// to block or do some work to get it. More significantly, the exact size of
/// the object might not be known until it has all been fetched. This means that
/// to return the right result, getExtent must also wait for all the data to
/// arrive; therefore it should not be called on objects which are actually
/// streamed (this would defeat the purpose of streaming). Instead,
/// isValidAddress can be used to test addresses without knowing the exact size
/// of the stream. Finally, getPointer can be used instead of readBytes to avoid
/// extra copying.
class MemoryObject {
public:
virtual ~MemoryObject();
/// Returns the size of the region in bytes. (The region is contiguous, so
/// the highest valid address of the region is getExtent() - 1).
///
/// @result - The size of the region.
virtual uint64_t getExtent() const = 0;
/// Tries to read a contiguous range of bytes from the region, up to the end
/// of the region.
///
/// @param Buf - A pointer to a buffer to be filled in. Must be non-NULL
/// and large enough to hold size bytes.
/// @param Size - The number of bytes to copy.
/// @param Address - The address of the first byte, in the same space as
/// getBase().
/// @result - The number of bytes read.
virtual uint64_t readBytes(uint8_t *Buf, uint64_t Size,
uint64_t Address) const = 0;
/// Ensures that the requested data is in memory, and returns a pointer to it.
/// More efficient than using readBytes if the data is already in memory. May
/// block until (address - base + size) bytes have been read
/// @param address - address of the byte, in the same space as getBase()
/// @param size - amount of data that must be available on return
/// @result - valid pointer to the requested data
virtual const uint8_t *getPointer(uint64_t address, uint64_t size) const = 0;
/// Returns true if the address is within the object (i.e. between base and
/// base + extent - 1 inclusive). May block until (address - base) bytes have
/// been read
/// @param address - address of the byte, in the same space as getBase()
/// @result - true if the address may be read with readByte()
virtual bool isValidAddress(uint64_t address) const = 0;
};
}
#endif
| 44.188406 | 80 | 0.662184 | [
"object"
] |
e21fd2eb4ec9da35359debaa0e3e9d1db7be34a4 | 8,140 | h | C | SofaKernel/modules/SofaMeshCollision/LocalMinDistanceFilter.h | sofa-framework/issofa | 94855f488465bc3ed41223cbde987581dfca5389 | [
"OML"
] | null | null | null | SofaKernel/modules/SofaMeshCollision/LocalMinDistanceFilter.h | sofa-framework/issofa | 94855f488465bc3ed41223cbde987581dfca5389 | [
"OML"
] | null | null | null | SofaKernel/modules/SofaMeshCollision/LocalMinDistanceFilter.h | sofa-framework/issofa | 94855f488465bc3ed41223cbde987581dfca5389 | [
"OML"
] | null | null | null | /******************************************************************************
* SOFA, Simulation Open-Framework Architecture, development version *
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program 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 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 Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#ifndef SOFA_COMPONENT_COLLISION_LOCALMINDISTANCEFILTER_H
#define SOFA_COMPONENT_COLLISION_LOCALMINDISTANCEFILTER_H
#include "config.h"
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/defaulttype/VecTypes.h>
#include <sofa/defaulttype/RigidTypes.h>
namespace sofa
{
namespace component
{
namespace collision
{
class LocalMinDistanceFilter;
/**
* @brief LocalMinDistance cone information class for an unique collision primitive.
*/
//template< class TCollisionElement >
class SOFA_MESH_COLLISION_API InfoFilter
{
public:
/**
* @brief Default constructor.
*
* @param m_revision Cone information is up to date.
* @param m_lmdFilters The localMinDistance filtration class that contains this InfoFilter.
*/
InfoFilter(LocalMinDistanceFilter *lmdFilters)
: m_revision(-1),
m_lmdFilters(lmdFilters),
base_mesh_topology(NULL),
position_filtering(NULL)
{}
/**
* @brief Default destructor.
*/
virtual ~InfoFilter() {}
/**
* @brief Returns the validity of a detected contact according to the InfoFilter.
*/
virtual bool validate(const unsigned int /*edge_index*/, const defaulttype::Vector3& /*PQ*/) = 0;
/**
* @brief Returns cone information validity (up to date or not?).
*/
virtual bool isValid(void);
/**
* @brief Sets cone information validity.
*/
virtual void setValid();
/**
* @brief Returns the LocalMinDistanceFilters object that contains this InfoFilter.
*/
const LocalMinDistanceFilter *getLMDFilters(void) {return m_lmdFilters;}
/**
* @brief Sets the LocalMinDistanceFilters object that contains this InfoFilter.
*/
void setLMDFilters(const LocalMinDistanceFilter *lmdFilters) {m_lmdFilters = lmdFilters;}
void setBaseMeshTopology( core::topology::BaseMeshTopology *bmt) {base_mesh_topology = bmt;}
void setPositionFiltering(const sofa::helper::vector< sofa::defaulttype::Vector3 > *x) {position_filtering = x;}
protected:
/**
* @brief If InfoFilter data is invalid, computes the region of interest cone of the collision primitive.
*
* If the collision primitive is mapped to a rigid MState, the computation is only an update according to the
* rigid transformation.
*/
virtual void buildFilter( unsigned int /*edge_index*/) = 0;
int m_revision; ///< Last filter update revision.
const LocalMinDistanceFilter *m_lmdFilters; ///< The LocalMinDistanceFilters object that contains this InfoFilter.
core::topology::BaseMeshTopology* base_mesh_topology;
const sofa::helper::vector< sofa::defaulttype::Vector3 > *position_filtering;
};
/**
* @brief Collision detection validation class using cones ROI method.
*
* This class is used by detection collision methods such as Proximity detection to tests if a detected
* contact should be kept for collision response or not.
* It also manages an history of computed cones that allows faster computation for an already tested collision
* primitive.
*/
class SOFA_MESH_COLLISION_API LocalMinDistanceFilter : public virtual core::objectmodel::BaseObject
{
public:
SOFA_CLASS(LocalMinDistanceFilter,sofa::core::objectmodel::BaseObject);
protected:
/**
* @brief Default constructor.
* @param m_rigid Cone information is called on a rigid CollisionModel.
*/
LocalMinDistanceFilter();
/**
* @brief Default destructor.
*/
virtual ~LocalMinDistanceFilter();
public:
//virtual void init(){}
void reinit() { init(); bwdInit();}
void reset() {reinit();}
/**
* @brief Scene graph backward initialization method
*/
void bwdInit();
/**
* @brief Get filtering cone extension angle.
*/
double getConeExtension(void) const {return m_coneExtension.getValue();}
/**
* @brief Set filtering cone extension angle.
*/
void setConeExtenstion(const double coneExtension) {m_coneExtension.setValue(coneExtension);}
/**
* @brief Get the minimal filtering cone angle value, independently from geometry.
*/
double getConeMinAngle(void) const {return m_coneMinAngle.getValue();}
/**
* @brief Set the minimal filtering cone angle value, independently from geometry.
*/
void setConeMinAngle(const double coneMinAngle) {m_coneMinAngle.setValue(coneMinAngle);}
/**
* @brief Returns the current CollisionModel update index.
*/
int getRevision(void) const {return m_revision;}
/**
* @brief Sets the current CollisionModel update index.
*/
void setRevision(const int revision) {m_revision = revision;}
/**
* @brief Returns true if the CollisionElement is mapped to a rigid mechanical state.
*/
bool isRigid(void) const {return m_rigid.getValue();}
/**
* @brief Sets the rigid property, true if the CollisionElement is mapped to a rigid mechanical state.
*/
void setRigid(bool rigid) {m_rigid.setValue(rigid);}
/**
* @brief Increases LMDFilter revision number to notify a CollisionModel modification.
* Corresponding filtrations data should be rebuilt or updated.
*/
void invalidate();
protected:
defaulttype::Rigid3Types::Coord *pos;
private:
Data< double > m_coneExtension; ///< Filtering cone extension angle.
Data< double > m_coneMinAngle; ///< Minimal filtering cone angle value, independent from geometry.
unsigned int m_revision; ///< Simulation step index (CollisionModel revision).
Data< bool > m_rigid; ///< True if the CollisionElement is mapped to a rigid mechanical state.
};
/**
* @brief
*/
class SOFA_MESH_COLLISION_API EmptyFilter
{
public:
/**
* @brief Point Collision Primitive validation method.
*/
bool validPoint(const int /*pointIndex*/, const defaulttype::Vector3 &/*PQ*/)
{
return true;
}
/**
* @brief Line Collision Primitive validation method.
*/
bool validLine(const int /*lineIndex*/, const defaulttype::Vector3 &/*PQ*/)
{
return true;
}
/**
* @brief Triangle Collision Primitive validation method.
*/
bool validTriangle(const int /*triangleIndex*/, const defaulttype::Vector3 &/*PQ*/)
{
return true;
}
};
} // namespace collision
} // namespace component
} // namespace sofa
#endif // SOFA_COMPONENT_COLLISION_LOCALMINDISTANCEFILTER_H
| 32.955466 | 118 | 0.631941 | [
"geometry",
"object",
"vector"
] |
e221cb2f752836356b12feaff80064c3f4744b7b | 854 | h | C | src/tools/tools/include/halley/tools/runner/dynamic_loader.h | code-disaster/halley | 5c85c889b76c69c6bdef6f4801c6aba282b7af80 | [
"Apache-2.0"
] | 3,262 | 2016-04-10T15:24:10.000Z | 2022-03-31T17:47:08.000Z | src/tools/tools/include/halley/tools/runner/dynamic_loader.h | code-disaster/halley | 5c85c889b76c69c6bdef6f4801c6aba282b7af80 | [
"Apache-2.0"
] | 53 | 2016-10-09T16:25:04.000Z | 2022-01-10T13:52:37.000Z | src/tools/tools/include/halley/tools/runner/dynamic_loader.h | code-disaster/halley | 5c85c889b76c69c6bdef6f4801c6aba282b7af80 | [
"Apache-2.0"
] | 193 | 2017-10-23T06:08:41.000Z | 2022-03-22T12:59:58.000Z | #pragma once
#include <memory>
#include "halley/tools/dll/dynamic_library.h"
#include "symbol_loader.h"
#include <halley/core/game/main_loop.h>
#include "halley/core/entry/game_loader.h"
namespace Halley
{
class IHalleyEntryPoint;
class Game;
class DynamicGameLoader : public GameLoader
{
public:
DynamicGameLoader(std::string dllName);
~DynamicGameLoader();
std::unique_ptr<Core> createCore(Vector<std::string> args) override;
std::unique_ptr<Game> createGame() override;
bool needsToReload() const override;
void reload() override;
void setCore(IMainLoopable& core) override;
private:
std::string libName;
DynamicLibrary lib;
IHalleyEntryPoint* entry = nullptr;
IMainLoopable* core = nullptr;
Vector<DebugSymbol> symbols;
Vector<DebugSymbol> prevSymbols;
void load();
void unload();
void hotPatch();
};
}
| 21.897436 | 70 | 0.742389 | [
"vector"
] |
e22f18cacde8024a0e57e079c035d6ca424c6810 | 1,016 | h | C | Chapter01/Code/PhysicsSystem.h | PacktPublishing/Game-Physics-Cookbook | abb0caa14433be5f83a43126122ac1ad44280552 | [
"MIT"
] | 45 | 2017-03-30T15:39:14.000Z | 2022-03-09T08:32:57.000Z | Chapter01/Code/PhysicsSystem.h | PacktPublishing/Game-Physics-Cookbook | abb0caa14433be5f83a43126122ac1ad44280552 | [
"MIT"
] | 1 | 2019-11-18T08:22:25.000Z | 2019-11-18T08:22:25.000Z | Chapter01/Code/PhysicsSystem.h | PacktPublishing/Game-Physics-Cookbook | abb0caa14433be5f83a43126122ac1ad44280552 | [
"MIT"
] | 14 | 2017-04-05T12:05:31.000Z | 2021-08-09T20:40:07.000Z | #ifndef _H_PHYSICS_SYSTEM_
#define _H_PHYSICS_SYSTEM_
#include "Rigidbody.h"
#include "Spring.h"
#include "Cloth.h"
class PhysicsSystem {
protected:
std::vector<Rigidbody*> bodies;
std::vector<Cloth*> cloths;
std::vector<OBB> constraints;
std::vector<Spring> springs;
std::vector<Rigidbody*> colliders1;
std::vector<Rigidbody*> colliders2;
std::vector<CollisionManifold> results;
public:
float LinearProjectionPercent; // [0.2 to 0.8], Smaller = less jitter / more penetration
float PenetrationSlack; // [0.01 to 0.1], Samller = more accurate
int ImpulseIteration;
// Not in book, just for debug purposes
bool DebugRender;
bool DoLinearProjection;
bool RenderRandomColors;
PhysicsSystem();
void Update(float deltaTime);
void Render();
void AddRigidbody(Rigidbody* body);
void AddCloth(Cloth* cloth);
void AddSpring(const Spring& spring);
void AddConstraint(const OBB& constraint);
void ClearRigidbodys();
void ClearConstraints();
void ClearSprings();
void ClearCloths();
};
#endif | 23.090909 | 89 | 0.749016 | [
"render",
"vector"
] |
e237f408369c26a9418b93351a483545b3f9cb2d | 1,987 | h | C | mpi/systemOfLinearEquations/reference/Parallel-MPI-Jacobi-master/source/jacobi.h | StarlAllen/HPC | e555be8f76de0f7305f6df2844e5025c05c30eb1 | [
"MIT"
] | 1 | 2021-07-02T02:11:22.000Z | 2021-07-02T02:11:22.000Z | mpi/systemOfLinearEquations/reference/Parallel-MPI-Jacobi-master/source/jacobi.h | StarlAllen/HPC | e555be8f76de0f7305f6df2844e5025c05c30eb1 | [
"MIT"
] | null | null | null | mpi/systemOfLinearEquations/reference/Parallel-MPI-Jacobi-master/source/jacobi.h | StarlAllen/HPC | e555be8f76de0f7305f6df2844e5025c05c30eb1 | [
"MIT"
] | null | null | null | /**
* @file jacobi.h
* @brief Implements matrix vector multiplication and Jacobi's method.
*
* Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved.
*
*/
/*********************************************************************
* !! DO NOT CHANGE THIS FILE !! *
*********************************************************************/
#ifndef JACOBI_H
#define JACOBI_H
/**
* @brief Performs the matrix vector product: y = A*x
*
* @param n The size of the dimensions.
* @param A A n-by-n matrix represented in row-major order.
* @param x The input vector of length n.
* @param y The output vector of length n.
*/
void matrix_vector_mult(const int n, const double* A,
const double* x, double* y);
/**
* @brief Performs the matrix vector product: y = A*x
*
* @param n The size of the first dimension.
* @param m The size of the second dimension.
* @param A A n-by-m matrix represented in row-major order.
* @param x The input vector of length m.
* @param y The output vector of length n.
*/
void matrix_vector_mult(const int n, const int m, const double* A,
const double* x, double* y);
/**
* @brief Performs Jacobi's method for solving A*x=b for x.
*
* @param n The size of the input.
* @param A The input matrix `A` of size n-by-n.
* @param b The input vector `b` of size n.
* @param x The output vector `x` of size n.
* @param max_iter The maximum number of iterations to run.
* @param l2_termination The termination criteria for the L2-norm of
* ||Ax - b||. Terminates as soon as the total L2-norm
* is smaller or equal to this.
*/
void jacobi(const int n, double* A, double* b, double* x,
int max_iter = 100, double l2_termination = 1e-10);
#endif // JACOBI_H
| 34.859649 | 79 | 0.545043 | [
"vector"
] |
e24398f977582db765873f585f41e6e66125d63f | 17,237 | c | C | ds/ds/src/sam/server/gclookup.c | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | ds/ds/src/sam/server/gclookup.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | ds/ds/src/sam/server/gclookup.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | /*++
Copyright (C) 1996 Microsoft Corporation
Module Name:
gclookup.c
Abstract:
Contains routines to perform GC lookups for clients within samsrv.dll's
process space.
Author:
ColinBr
Revision History
--*/
#include <winerror.h>
#include <stdlib.h>
#include <samsrvp.h>
#include <ntdsa.h>
#include <dslayer.h>
#include <mappings.h>
#include <objids.h>
#include <filtypes.h>
#include <dsdsply.h>
#include <fileno.h>
#include <dsconfig.h>
#include <mdlocal.h>
#include <malloc.h>
#include <errno.h>
#include <mdcodes.h>
VOID
SampSplitSamAccountName(
IN UNICODE_STRING *AccountName,
OUT UNICODE_STRING *DomainName,
OUT UNICODE_STRING *UserName
)
/*++
Routine Description
This routine separates Account name into a Domain and User portion.
DomainName and UserName are not allocated -- they point to the buffer
in AccountName.
The Domain is consider the part before the first L'\\'. If this character
doesn't exist, then UserName == AccountName
Parameters:
AccountName -- the name to parse
DomainName -- the domain name portion
UserName -- the user name portion
Return Values:
None.
--*/
{
USHORT i;
USHORT Length;
ASSERT( AccountName );
ASSERT( DomainName );
ASSERT( UserName );
Length = (AccountName->Length/sizeof(WCHAR));
for (i = 0; i < Length; i++ ) {
if ( L'\\' == AccountName->Buffer[i] ) {
break;
}
}
if ( i < Length ) {
UserName->Buffer = &AccountName->Buffer[i+1];
UserName->Length = UserName->MaximumLength = (AccountName->Length - (i+1));
DomainName->Buffer = AccountName->Buffer;
DomainName->Length = DomainName->MaximumLength = i;
} else {
RtlCopyMemory( UserName, AccountName, sizeof(UNICODE_STRING));
RtlInitUnicodeString( DomainName, NULL );
}
return;
}
SID_NAME_USE
SampAccountTypeToNameUse(
ULONG AccountType
)
{
switch ( AccountType ) {
case SAM_DOMAIN_OBJECT:
return SidTypeDomain;
case SAM_NON_SECURITY_GROUP_OBJECT:
case SAM_GROUP_OBJECT:
return SidTypeGroup;
case SAM_NON_SECURITY_ALIAS_OBJECT:
case SAM_ALIAS_OBJECT:
case SAM_APP_BASIC_GROUP:
case SAM_APP_QUERY_GROUP:
return SidTypeAlias;
case SAM_USER_OBJECT:
case SAM_MACHINE_ACCOUNT:
case SAM_TRUST_ACCOUNT:
return SidTypeUser;
default:
ASSERT( FALSE && "Unexpected Account Type!" );
return SidTypeUnknown;
}
ASSERT( FALSE && "Unexpected control flow" );
return SidTypeUnknown;
}
BOOLEAN
SampSidWasFoundSimply(
ULONG status
)
//
// status is return code from the name cracking API. see ntdsapi.h
//
{
switch (status) {
case DS_NAME_ERROR_IS_SID_USER:
case DS_NAME_ERROR_IS_SID_GROUP:
case DS_NAME_ERROR_IS_SID_ALIAS:
case DS_NAME_ERROR_IS_SID_UNKNOWN:
return TRUE;
}
return FALSE;
}
BOOLEAN
SampSidWasFoundByHistory(
ULONG status
)
//
// status is return code from the name cracking API. see ntdsapi.h
//
{
switch (status) {
case DS_NAME_ERROR_IS_SID_HISTORY_USER:
case DS_NAME_ERROR_IS_SID_HISTORY_GROUP:
case DS_NAME_ERROR_IS_SID_HISTORY_ALIAS:
case DS_NAME_ERROR_IS_SID_HISTORY_UNKNOWN:
return TRUE;
}
return FALSE;
}
NTSTATUS
SamIGCLookupSids(
IN ULONG cSids,
IN PSID *SidArray,
IN ULONG Options,
OUT ULONG *Flags,
OUT SID_NAME_USE *SidNameUse,
OUT PSAMPR_RETURNED_USTRING_ARRAY Names
)
/*++
Routine Description
This routine, exported to in-proc clients, translates a list of sids
into sam account names as well as find thier sam object type (user, alias ... )
Parameters:
cSids -- the number of sids
SidArray -- the array of sids
Options -- flags to control this functions behavoir. Currently only
SAMP_LOOKUP_BY_SID_HISTORY is supported.
SidNameUse -- a preallocated array to be filled with each sid's use.
SidTypeUnknown is used if the sid can't be resolved
Names -- a preallocated array of empty unicode strings to be filled in
The string is set to blank if the name could not be resolved.
Return Values:
STATUS_SUCCESS
STATUS_DS_GC_NOT_AVAILABLE: the GC was not available, no names were translated
Standard resource errors
--*/
{
NTSTATUS NtStatus = STATUS_SUCCESS;
ULONG DsErr = 0;
PDS_NAME_RESULTW Results = NULL;
BOOL fKillThreadState = FALSE;
BOOLEAN fDoSidHistory = (Options & SAMP_LOOKUP_BY_SID_HISTORY) ? TRUE : FALSE;
ULONG i, j;
//
// We should not be called in registry mode or if we have a transaction
//
ASSERT( SampUseDsData );
// Parameter check
ASSERT( SidNameUse );
ASSERT( Names );
//
// Start a thread state if need be
//
if ( !THQuery() ) {
if ( THCreate( CALLERTYPE_SAM ) ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
fKillThreadState = TRUE;
}
// We should not be in a transaction
ASSERT(!SampExistsDsTransaction());
// Init the out params
for (i = 0; i < cSids; i++ ) {
SidNameUse[i] = SidTypeUnknown;
Flags[i] = 0;
}
Names->Count = 0;
Names->Element = (PSID) MIDL_user_allocate( sizeof(RPC_UNICODE_STRING) * cSids );
if ( !Names->Element ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
Names->Count = cSids;
RtlZeroMemory( Names->Element, sizeof(RPC_UNICODE_STRING) * cSids );
//
// Hit the GC if possible
//
DsErr = SampGCLookupSids(cSids,
SidArray,
&Results);
if ( 0 != DsErr )
{
//
// Assume any error implies a GC could not be reached
//
NtStatus = STATUS_DS_GC_NOT_AVAILABLE;
goto Cleanup;
}
ASSERT( cSids = Results->cItems );
//
// Now interpret the results
//
for ( i = 0; i < cSids; i++ ) {
//
// See if the sid was resolved
//
if ( SampSidWasFoundSimply( Results->rItems[i].status )
|| (fDoSidHistory
&& SampSidWasFoundByHistory( Results->rItems[i].status ) ) ) {
ULONG Length;
WCHAR *Name;
//
// Set the sid name use
//
switch ( Results->rItems[i].status ) {
case DS_NAME_ERROR_IS_SID_USER:
case DS_NAME_ERROR_IS_SID_HISTORY_USER:
SidNameUse[i] = SidTypeUser;
break;
case DS_NAME_ERROR_IS_SID_GROUP:
case DS_NAME_ERROR_IS_SID_HISTORY_GROUP:
SidNameUse[i] = SidTypeGroup;
break;
case DS_NAME_ERROR_IS_SID_ALIAS:
case DS_NAME_ERROR_IS_SID_HISTORY_ALIAS:
SidNameUse[i] = SidTypeAlias;
break;
default:
SidNameUse[i] = SidTypeUnknown;
break;
}
if ( SampSidWasFoundByHistory( Results->rItems[i].status ) )
{
Flags[i] |= SAMP_FOUND_BY_SID_HISTORY;
}
//
// Set up the name
//
Length = (wcslen( Results->rItems[i].pName ) + 1) * sizeof(WCHAR);
Name = (WCHAR*) MIDL_user_allocate( Length );
if ( !Name ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
wcscpy( Name, Results->rItems[i].pName );
RtlInitUnicodeString( (UNICODE_STRING *)&Names->Element[i], Name );
} else if ( (Results->rItems[i].status == DS_NAME_ERROR_TRUST_REFERRAL)
&& (Results->rItems[i].pDomain != NULL) ) {
//
// This is a routing hint indicating that the SID belongs to
// a cross forest domain.
//
Flags[i] |= SAMP_FOUND_XFOREST_REF;
}
}
Cleanup:
if ( !NT_SUCCESS( NtStatus ) ) {
// Release all allocated memory
SamIFree_SAMPR_RETURNED_USTRING_ARRAY( Names );
// reset out params just to be clean
for (i = 0; i < cSids; i++ ) {
SidNameUse[i] = SidTypeUnknown;
}
RtlZeroMemory( Names, sizeof(SAMPR_RETURNED_USTRING_ARRAY) );
}
if ( fKillThreadState ) {
THDestroy();
}
return NtStatus;
}
NTSTATUS
SamIGCLookupNames(
IN ULONG cNames,
IN PUNICODE_STRING Names,
IN ULONG Options,
IN OUT ULONG *Flags,
OUT SID_NAME_USE *SidNameUse,
OUT PSAMPR_PSID_ARRAY *pSidArray
)
/*++
Routine Description
This routine, exported to in-proc clients, translates a list of
names into sids as well as find thier sam object type (user, alias ... )
Parameters:
cNames -- the number of names
Names -- the array of names
Options -- flags to indicate what names to include. Currently only
SAMP_LOOKUP_BY_UPN supported
Flags -- Flags to indicate to the caller how the name was found.
SAMP_FOUND_BY_SAM_ACCOUNT_NAME -- the name passed in is
a sam account name
SAMP_FOUND_XFOREST_REF -- the name belongs to an trusted
forest
Note: this array is allocated by the caller.
SidNameUse -- a preallocated array to be filled with each sid's use.
SidTypeUnknown is used if the sid can't be resolved
SidArray -- a pointer to the structure to hold the sids. While usual SAM
practice would have this just be a pointer rather than
a pointer to a pointer, the exported "free" routines for SAM
don't handle this, so we'll make it a pointer to a pointer.
Return Values:
STATUS_SUCCESS
STATUS_DS_GC_NOT_AVAILABLE: the GC was not available, no names were translated
Standard resource errors
--*/
{
ULONG DsErr = 0;
NTSTATUS NtStatus = STATUS_SUCCESS;
ENTINF *ReturnedEntInf = 0;
BOOL fKillThreadState = FALSE;
ULONG i, j;
DWORD err;
PSAMPR_PSID_ARRAY SidArray = NULL;
UNICODE_STRING ReturnedName;
UNICODE_STRING DomainName1, DomainName2;
UNICODE_STRING UserName1, UserName2;
//
// We should not be called in registry mode or if we have a transaction
//
ASSERT( SampUseDsData );
// Parameter check
ASSERT( SidNameUse );
ASSERT( Names );
ASSERT( pSidArray );
ASSERT( Flags );
//
// Start a thread state if need be
//
if ( !THQuery() ) {
if ( THCreate( CALLERTYPE_SAM ) ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
fKillThreadState = TRUE;
}
ASSERT(!SampExistsDsTransaction());
// Init the out params
for (i = 0; i < cNames; i++ ) {
SidNameUse[i] = SidTypeUnknown;
}
*pSidArray = NULL;
SidArray = MIDL_user_allocate( sizeof( SAMPR_PSID_ARRAY ) );
if ( !SidArray ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
*pSidArray = SidArray;
SidArray->Count = 0;
SidArray->Sids = MIDL_user_allocate( cNames * sizeof( SAMPR_SID_INFORMATION ) );
if ( !SidArray->Sids ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
SidArray->Count = cNames;
RtlZeroMemory( SidArray->Sids, cNames * sizeof( SAMPR_SID_INFORMATION ) );
RtlZeroMemory( Flags, cNames * sizeof(ULONG) );
//
// Hit the GC if possible
//
DsErr = SampGCLookupNames(cNames,
Names,
&ReturnedEntInf);
if ( 0 != DsErr )
{
//
// Assume any error implies a GC could not be reached
//
NtStatus = STATUS_DS_GC_NOT_AVAILABLE;
goto Cleanup;
}
//
// Now interpret the results
//
for ( i = 0; i < cNames; i++ ) {
PSID Sid = NULL;
DWORD AccountType = 0;
BOOLEAN fAccountTypeFound = FALSE;
ULONG Length;
ENTINF *pEntInf = &ReturnedEntInf[i];
WCHAR *AccountName = NULL;
RtlZeroMemory( &ReturnedName, sizeof(ReturnedName) );
//
// If the object could not be resolved then no attributes
// we be set in the attr block, so we will fall through
// and the sidnameuse will remain "Unknown"
//
// Iterate through the ATTRBLOCK
//
for (j = 0; j < pEntInf->AttrBlock.attrCount; j++ ) {
ATTR *pAttr;
pAttr = &pEntInf->AttrBlock.pAttr[j];
switch ( pAttr->attrTyp ) {
case ATT_OBJECT_SID:
ASSERT( 1 == pAttr->AttrVal.valCount );
ASSERT( NULL != pAttr->AttrVal.pAVal[0].pVal );
Sid = (WCHAR*) pAttr->AttrVal.pAVal[0].pVal;
break;
case ATT_SAM_ACCOUNT_TYPE:
ASSERT( 1 == pAttr->AttrVal.valCount);
AccountType = *((DWORD*) pAttr->AttrVal.pAVal[0].pVal);
fAccountTypeFound = TRUE;
break;
case ATT_SAM_ACCOUNT_NAME:
ASSERT( 1 == pAttr->AttrVal.valCount);
AccountName = (WCHAR*) pAttr->AttrVal.pAVal[0].pVal;
ReturnedName.Buffer = (WCHAR*) pAttr->AttrVal.pAVal[0].pVal;
ReturnedName.Length = ReturnedName.MaximumLength = (USHORT)pAttr->AttrVal.pAVal[0].valLen;
break;
case FIXED_ATT_EX_FOREST:
//
// This indicates that the name belongs to a cross
// forest trust
//
Flags[i] |= SAMP_FOUND_XFOREST_REF;
break;
default:
ASSERT( FALSE && !"Unexpected switch statement" );
}
}
if ( Sid
&& fAccountTypeFound ) {
if ( AccountName ) {
ASSERT( ReturnedName.Length > 0 );
SampSplitSamAccountName( &Names[i], &DomainName1, &UserName1 );
SampSplitSamAccountName( &ReturnedName, &DomainName2, &UserName2 );
if ((CSTR_EQUAL == CompareString(DS_DEFAULT_LOCALE,
DS_DEFAULT_LOCALE_COMPARE_FLAGS,
UserName1.Buffer,
UserName1.Length/sizeof(WCHAR),
UserName2.Buffer,
UserName2.Length/sizeof(WCHAR) ))){
//
// The user name portion is the same we can use this value
// to cache
//
Flags[i] |= SAMP_FOUND_BY_SAM_ACCOUNT_NAME;
}
}
//
// Ok, we found something and we can use it
//
Length = RtlLengthSid( Sid );
SidArray->Sids[i].SidPointer = (PSID) midl_user_allocate( Length );
if ( !SidArray->Sids[i].SidPointer ) {
NtStatus = STATUS_NO_MEMORY;
goto Cleanup;
}
RtlCopySid( Length, SidArray->Sids[i].SidPointer, Sid );
SidNameUse[i] = SampAccountTypeToNameUse( AccountType );
}
}
Cleanup:
if ( !NT_SUCCESS( NtStatus ) ) {
// Release any allocated memory
SamIFreeSidArray( *pSidArray );
*pSidArray = NULL;
// Reset parameters to be clean
for (i = 0; i < cNames; i++ ) {
SidNameUse[i] = SidTypeUnknown;
}
}
if ( ReturnedEntInf ) {
THFree( ReturnedEntInf );
}
if ( fKillThreadState ) {
THDestroy();
}
return NtStatus;
}
| 26.807154 | 111 | 0.52631 | [
"object"
] |
e24e7a7c359f25d70f7daeb33e9f624f0ae7e34c | 16,012 | c | C | source/AppController.c | SoftwareAG/cumulocity-xdk-agent | c9015d91afa1e4c82c2cbb40375d7dc64873d03b | [
"Apache-2.0"
] | 3 | 2019-09-09T15:05:31.000Z | 2019-12-05T07:25:33.000Z | source/AppController.c | SoftwareAG/cumulocity-xdk-agent | c9015d91afa1e4c82c2cbb40375d7dc64873d03b | [
"Apache-2.0"
] | 1 | 2021-07-04T15:16:27.000Z | 2021-08-12T07:28:59.000Z | source/AppController.c | SoftwareAG/cumulocity-xdk-agent | c9015d91afa1e4c82c2cbb40375d7dc64873d03b | [
"Apache-2.0"
] | 1 | 2021-08-19T08:48:41.000Z | 2021-08-19T08:48:41.000Z | /******************************************************************************
** COPYRIGHT (c) 2019 Software AG
**
** The use of this software is subject to the XDK SDK EULA
**
*******************************************************************************
**
** OBJECT NAME: AppController.c
**
** DESCRIPTION: Source Code for the Cumulocity MQTT Client for the Bosch XDK
**
** AUTHOR(S): Christof Strack, Software AG
**
**
*******************************************************************************/
/* own header files */
#include "XdkAppInfo.h"
#undef BCDS_MODULE_ID /* Module ID define before including Basics package*/
#define BCDS_MODULE_ID XDK_APP_MODULE_ID_APP_CONTROLLER
/* own header files */
#include "AppController.h"
/* system header files */
#include <stdio.h>
/* additional interface header files */
#include "BSP_BoardType.h"
#include "BCDS_BSP_Board.h"
#include "BCDS_BSP_Button.h"
#include "BCDS_CmdProcessor.h"
#include "BCDS_Assert.h"
#include "BCDS_BSP_LED.h"
#include "Serval_Ip.h"
#include "XDK_Utils.h"
#include "XDK_WLAN.h"
#include "XDK_Sensor.h"
#include "XDK_SNTP.h"
#include "XDK_ServalPAL.h"
#include "XDK_Storage.h"
#include "XDK_TimeStamp.h"
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "Serval_Ip.h"
#include "BatteryMonitor.h"
#include "MQTTClient.h"
#include "MQTTStorage.h"
#include "MQTTCfgParser.h"
#include "MQTTRegistration.h"
#include "MQTTOperation.h"
#include "MQTTButton.h"
#include "XdkSensorHandle.h"
#include "BCDS_Orientation.h"
/* constant definitions ***************************************************** */
/* local variables ********************************************************** */
static WLAN_Setup_T WLANSetupInfo = { .IsEnterprise = false, .IsHostPgmEnabled =
false, .SSID = WLAN_SSID, .Username = WLAN_PSK, .Password = WLAN_PSK,
.IsStatic = WLAN_STATIC_IP, .IpAddr = WLAN_IP_ADDR, .GwAddr =
WLAN_GW_ADDR, .DnsAddr = WLAN_DNS_ADDR, .Mask = WLAN_MASK, };
static SNTP_Setup_T SNTPSetupInfo; /**< SNTP setup parameters */
static CmdProcessor_T * AppCmdProcessor; /**< Handle to store the main Command processor handle to be used by run-time event driven threads */
static void AppController_Enable (void *, uint32_t);
static void AppController_SetClientId (const char * clientId);
static void AppController_StartLEDBlinkTimer (int);
/* global variables ********************************************************* */
char clientId[14] = { 0 }; // MAC address 6*2 + \0 'terminating'
APP_STATUS app_status = APP_STATUS_UNKNOWN;
APP_STATUS cmd_status = APP_STATUS_UNKNOWN;
APP_STATUS boot_mode = APP_STATUS_UNKNOWN;
uint16_t logging_enabled = 0UL;
SensorDataBuffer sensorStreamBuffer;
AssetDataBuffer assetStreamBuffer;
xTaskHandle AppControllerHandle = NULL;/**< OS thread handle for Application controller to be used by run-time blocking threads */
MQTT_Setup_TZ MqttSetupInfo;
MQTT_Connect_TZ MqttConnectInfo;
MQTT_Credentials_TZ MqttCredentials;
Storage_Setup_T StorageSetup;
Sensor_Setup_T SensorSetup;
/* inline functions ********************************************************* */
/* local functions ********************************************************** */
/**
* @brief To setup the necessary modules for the application
* - WLAN
* - ServalPAL
* - SNTP (if secure communication)
* - MQTT
* - Sensor
*
* @param[in] param1
* Unused
*
* @param[in] param2
* Unused
*/
static void AppController_Setup(void * param1, uint32_t param2) {
BCDS_UNUSED(param1);
BCDS_UNUSED(param2);
// prepare storage
Retcode_T retcode = Storage_Setup(&StorageSetup);
retcode = Storage_Enable();
if ((Retcode_T) RETCODE_STORAGE_SDCARD_NOT_AVAILABLE
== Retcode_GetCode(retcode)) {
/* This is only a warning error. So we will raise and proceed */
LOG_AT_WARNING(
("AppController_Setup: SD card missing, using config from WIFI chip!\r\n"));
retcode = RETCODE_OK; /* SD card was not inserted */
}
// initialize Buttons
retcode = MQTTButton_Init(AppCmdProcessor);
if (retcode != RETCODE_OK) {
LOG_AT_ERROR(("AppController_Setup: Boot error!\r\n"));
assert(0);
}
// read boot status from flash. If boot status file does not exits create this file
if (MQTTStorage_Init() != RETCODE_OK) {
assert(0);
}
// in case button 2 is pressed delete the configuration files
if (BSP_Button_GetState((uint32_t) BSP_XDK_BUTTON_2) == 1) {
LOG_AT_INFO(
("AppController_Setup: Button 2 was pressed at startup, deleting config stored on WIFI chip!\r\n"));
MQTTStorage_Flash_DeleteConfig();
BSP_Board_SoftReset();
}
// initialize parameters from flash and inserted SD card
retcode = MQTTCfgParser_Init();
if (retcode != RETCODE_OK) {
LOG_AT_ERROR(
("AppController_Setup: Boot error. Inconsistent configuration!\r\n"));
assert(0);
}
// set boot mode: operation or registration
boot_mode = MQTTCfgParser_GetMode();
if (boot_mode == APP_STATUS_OPERATION_MODE) {
MqttCredentials.Username = MQTTCfgParser_GetMqttUser();
MqttCredentials.Password = MQTTCfgParser_GetMqttPassword();
MqttCredentials.Anonymous = MQTTCfgParser_IsMqttAnonymous();
} else {
MqttCredentials.Username = MQTT_REGISTRATION_USERNAME;
MqttCredentials.Password = MQTT_REGISTRATION_PASSWORD;
MqttCredentials.Anonymous = FALSE;
}
// set cfg parameter for WIFI access
WLANSetupInfo.SSID = MQTTCfgParser_GetWlanSSID();
WLANSetupInfo.Username = MQTTCfgParser_GetWlanPassword();
WLANSetupInfo.Password = MQTTCfgParser_GetWlanPassword();
retcode = WLAN_Setup(&WLANSetupInfo);
if (RETCODE_OK == retcode) {
retcode = ServalPAL_Setup(AppCmdProcessor);
}
// initialize time from SNTP server
MqttSetupInfo.IsSecure = MQTTCfgParser_IsMqttSecureEnabled();
if (MqttSetupInfo.IsSecure == true) {
if (RETCODE_OK == retcode) {
SNTPSetupInfo = (SNTP_Setup_T ) { .ServerUrl =
MQTTCfgParser_GetSntpName(), .ServerPort =
MQTTCfgParser_GetSntpPort() };
LOG_AT_INFO(
("AppController_Setup: SNTP server: [%s:%d]\r\n", SNTPSetupInfo.ServerUrl, SNTPSetupInfo.ServerPort));
retcode = SNTP_Setup(&SNTPSetupInfo);
}
}
if (RETCODE_OK == retcode) {
retcode = MQTT_Setup_Z(&MqttSetupInfo);
}
// enable/disable relevant sensors
if (RETCODE_OK == retcode && boot_mode == APP_STATUS_OPERATION_MODE) {
SensorSetup.CmdProcessorHandle = AppCmdProcessor;
SensorSetup.Enable.Accel = MQTTCfgParser_IsAccelEnabled();
SensorSetup.Enable.Gyro = MQTTCfgParser_IsGyroEnabled();
SensorSetup.Enable.Humidity = MQTTCfgParser_IsEnvEnabled();
SensorSetup.Enable.Light = MQTTCfgParser_IsLightEnabled();
SensorSetup.Enable.Mag = MQTTCfgParser_IsMagnetEnabled();
SensorSetup.Enable.Pressure = MQTTCfgParser_IsEnvEnabled();
SensorSetup.Enable.Temp = MQTTCfgParser_IsEnvEnabled();
SensorSetup.Enable.Noise = MQTTCfgParser_IsNoiseEnabled();
retcode = Sensor_Setup(&SensorSetup);
#if ENABLE_SENSOR_TOOLBOX
retcode = Orientation_init(xdkOrientationSensor_Handle);
#endif
}
if (RETCODE_OK == retcode) {
retcode = CmdProcessor_Enqueue(AppCmdProcessor, AppController_Enable,
NULL, UINT32_C(0));
}
if (RETCODE_OK != retcode) {
LOG_AT_ERROR(("AppController_Setup: Failed \r\n"));
Retcode_RaiseError(retcode);
assert(0); /* To provide LED indication for the user */
}
}
/**
* @brief To enable the necessary modules for the application
* - WLAN
* - ServalPAL
* - SNTP (if secure communication)
* - MQTT
* - Sensor
*
* @param[in] param1
* Unused
*
* @param[in] param2
* Unused
*/
static void AppController_Enable(void * param1, uint32_t param2) {
BCDS_UNUSED(param1);
BCDS_UNUSED(param2);
Retcode_T retcode = WLAN_Enable();
if (RETCODE_OK == retcode) {
retcode = ServalPAL_Enable();
}
if (MqttSetupInfo.IsSecure == true) {
if (RETCODE_OK == retcode) {
retcode = SNTP_Enable();
}
}
if (RETCODE_OK == retcode) {
retcode = MQTT_Enable_Z();
}
if (RETCODE_OK == retcode && boot_mode == APP_STATUS_OPERATION_MODE) {
retcode = Sensor_Enable();
}
MqttConnectInfo.BrokerURL = MQTTCfgParser_GetMqttBrokerName();
MqttConnectInfo.BrokerPort = MQTTCfgParser_GetMqttBrokerPort();
MqttConnectInfo.CleanSession = true;
MqttConnectInfo.KeepAliveInterval = 100;
AppController_SetClientId(MqttConnectInfo.ClientId);
LOG_AT_INFO(
("AppController_Enable: Device ID for registration in Cumulocity %s.\r\n", MqttConnectInfo.ClientId));
if (RETCODE_OK == retcode) {
BaseType_t task_result;
if (boot_mode == APP_STATUS_OPERATION_MODE) {
task_result = xTaskCreate(MQTTOperation_Init,
(const char * const ) "AppController", TASK_STACK_SIZE_APP_CONTROLLER, NULL,
TASK_PRIO_APP_CONTROLLER, &AppControllerHandle);
} else {
task_result = xTaskCreate(MQTTRegistration_Init,
(const char * const ) "AppController", TASK_STACK_SIZE_APP_CONTROLLER, NULL,
TASK_PRIO_APP_CONTROLLER, &AppControllerHandle);
}
if (pdPASS
!= task_result) {
LOG_AT_ERROR(
("AppController_Enable: Now calling SoftReset and reboot to recover\r\n"));
Retcode_RaiseError(retcode);
BSP_Board_SoftReset();
}
}
Utils_PrintResetCause();
}
static void AppController_SetClientId(const char * clientId) {
/* Initialize Variables */
uint8_t _macVal[WIFI_MAC_ADDR_LEN + 1] = { 0 };
uint8_t _macAddressLen = WIFI_MAC_ADDR_LEN;
/* Get the MAC Address */
sl_NetCfgGet(SL_MAC_ADDRESS_GET, NULL, &_macAddressLen,
(uint8_t *) _macVal);
sprintf(clientId, "%02X%02X%02X%02X%02X%02X", _macVal[0],
_macVal[1], _macVal[2], _macVal[3], _macVal[4], _macVal[5]);
}
static void AppController_ToogleLEDCallback(xTimerHandle xTimer) {
(void) xTimer;
switch (app_status) {
case APP_STATUS_STARTED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_TOGGLE);
break;
case APP_STATUS_OPERATING_STARTED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_OFF);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_O, (uint32_t) BSP_LED_COMMAND_TOGGLE);
break;
case APP_STATUS_OPERATING_STOPPED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_OFF);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_O, (uint32_t) BSP_LED_COMMAND_ON);
break;
case APP_STATUS_ERROR:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_ON);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_O, (uint32_t) BSP_LED_COMMAND_OFF);
break;
case APP_STATUS_REBOOT:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_TOGGLE);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_O, (uint32_t) BSP_LED_COMMAND_TOGGLE);
break;
case APP_STATUS_REGISTERED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_OFF);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_Y, (uint32_t) BSP_LED_COMMAND_ON);
break;
case APP_STATUS_REGISTERING:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_OFF);
BSP_LED_Switch((uint32_t) BSP_XDK_LED_Y, (uint32_t) BSP_LED_COMMAND_TOGGLE);
break;
default:
LOG_AT_WARNING(("AppController: Unknown app status\n"));
break;
}
LOG_AT_TRACE(("STATUS %s\r\n", app_status_text[app_status]));
switch (cmd_status) {
case APP_STATUS_COMMAND_RECEIVED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_TOGGLE);
cmd_status = APP_STATUS_COMMAND_CONFIRMED;
break;
case APP_STATUS_COMMAND_CONFIRMED:
BSP_LED_Switch((uint32_t) BSP_XDK_LED_R, (uint32_t) BSP_LED_COMMAND_TOGGLE);
cmd_status = APP_STATUS_STARTED;
break;
case APP_STATUS_STARTED:
// do nothing
break;
default:
LOG_AT_WARNING(("AppController: Unknown command status\n"));
break;
}
}
static void AppController_StartLEDBlinkTimer(int period) {
xTimerHandle timerHandle = xTimerCreate((const char * const ) "LED Timer", // used only for debugging purposes
MILLISECONDS(period), // timer period
pdTRUE, //Autoreload pdTRUE or pdFALSE - should the timer start again after it expired?
NULL, // optional identifier
AppController_ToogleLEDCallback // static callback function
);
xTimerStart(timerHandle, UINT32_C(0xffff));
}
Retcode_T AppController_SyncTime() {
uint64_t sntpTimeStampFromServer = 0UL;
uint16_t sntpAttemps = 0UL;
Retcode_T retcode = RETCODE_OK;
/* We Synchronize the node with the SNTP server for time-stamp.
* Since there is no point in doing a HTTPS communication without a valid time */
do {
retcode = SNTP_GetTimeFromServer(&sntpTimeStampFromServer,
APP_RESPONSE_FROM_SNTP_SERVER_TIMEOUT);
if ((RETCODE_OK != retcode) || (0UL == sntpTimeStampFromServer)) {
LOG_AT_WARNING(
("AppController: SNTP server time was not synchronized. Retrying...\r\n"));
}
sntpAttemps++;
//vTaskDelay(pdMS_TO_TICKS(500));
} while (0UL == sntpTimeStampFromServer && sntpAttemps < 3); // only try to sync time 3 times
if (0UL == sntpTimeStampFromServer) {
sntpTimeStampFromServer = 1580515200UL; // use default time 1. Feb 2020 00:00:00 UTC
SNTP_SetTime(sntpTimeStampFromServer);
LOG_AT_WARNING(
("AppController: Using fixed timestamp 1. Feb 2020 00:00:00 UTC, SNTP sync not possible\r\n"));
retcode = RETCODE_OK; // clear return code
}
//uint8_t * timeBuffer = (uint8_t *) &sntpTimeStampFromServer;
//LOG_AT_TRACE(("AppController: SNTP time: %d,%d,%d,%d,%d,%d,%d,%d\r\n", timeBuffer[0], timeBuffer[1], timeBuffer[2], timeBuffer[3],timeBuffer[4],timeBuffer[5],timeBuffer[6],timeBuffer[7]));
struct tm time;
char timezoneISO8601format[40];
TimeStamp_SecsToTm(sntpTimeStampFromServer, &time);
TimeStamp_TmToIso8601(&time, timezoneISO8601format, 40);
BCDS_UNUSED(sntpTimeStampFromServer); /* Copy of sntpTimeStampFromServer will be used be HTTPS for TLS handshake */
return retcode;
}
/* global functions ********************************************************* */
/** Initialize Application
*
*/
void AppController_Init(void * cmdProcessorHandle, uint32_t param2) {
/*
* Initialialze global variables
*/
MqttSetupInfo = (MQTT_Setup_TZ ) { .IsSecure = APP_MQTT_SECURE_ENABLE, };
MqttConnectInfo = (MQTT_Connect_TZ ) { .ClientId = clientId, .BrokerURL =
MQTT_BROKER_HOST_NAME, .BrokerPort = MQTT_BROKER_HOST_PORT,
.CleanSession = true, .KeepAliveInterval = 100, };
MqttCredentials = (MQTT_Credentials_TZ ) { .Username = APP_MQTT_USERNAME,
.Password = APP_MQTT_PASSWORD, .Anonymous = false,};
StorageSetup =
(Storage_Setup_T ) { .SDCard = true, .WiFiFileSystem = true, };
SensorSetup = (Sensor_Setup_T ) { .CmdProcessorHandle = NULL, .Enable = {
.Accel = false, .Mag = false, .Gyro = false, .Humidity =
false, .Temp = false, .Pressure = false, .Light =
false, .Noise = false, }, .Config = { .Accel = {
.Type = SENSOR_ACCEL_BMA280, .IsRawData = false,
.IsInteruptEnabled = false, .Callback = NULL, }, .Gyro = {
.Type = SENSOR_GYRO_BMG160, .IsRawData = false, }, .Mag = {
.IsRawData = false }, .Light = { .IsInteruptEnabled = false,
.Callback = NULL, }, .Temp = { .OffsetCorrection =
APP_TEMPERATURE_OFFSET_CORRECTION, }, }, };
Retcode_T retcode = RETCODE_OK;
BCDS_UNUSED(param2);
vTaskDelay(pdMS_TO_TICKS(1000));
LOG_AT_INFO(("AppController_Init: XDK Cumulocity Agent startup ...\r\n"));
// start status LED indicator
AppController_SetAppStatus(APP_STATUS_STARTED);
AppController_SetCmdStatus(APP_STATUS_STARTED);
AppController_StartLEDBlinkTimer(500);
// init battery monitor
BatteryMonitor_Init();
if (cmdProcessorHandle == NULL) {
retcode = RETCODE(RETCODE_SEVERITY_ERROR, RETCODE_NULL_POINTER);
} else if (RETCODE_OK == retcode) {
AppCmdProcessor = (CmdProcessor_T *) cmdProcessorHandle;
retcode = CmdProcessor_Enqueue(AppCmdProcessor, AppController_Setup,
NULL, UINT32_C(0));
}
if (RETCODE_OK != retcode) {
Retcode_RaiseError(retcode);
assert(0); /* To provide LED indication for the user */
}
}
void AppController_SetAppStatus(uint8_t status) {
if (app_status != APP_STATUS_REBOOT) {
app_status = status;
}
}
uint8_t AppController_GetAppStatus(void) {
return app_status;
}
void AppController_SetCmdStatus(uint8_t status) {
cmd_status = status;
}
uint8_t AppController_GetCmdStatus(void) {
return cmd_status;
}
| 33.151139 | 191 | 0.717899 | [
"object"
] |
e260cbb89c8832cf2ed86f90411e3b90d77da19c | 121,619 | h | C | version/Core/Public/API/Atlas/Other.h | Code4Cookie/ARK-Server-API | 6d444bd2a6993ae8e7ea82d7a3d6bd15af670f4d | [
"MIT"
] | 1 | 2021-02-08T07:45:57.000Z | 2021-02-08T07:45:57.000Z | version/Core/Public/API/Atlas/Other.h | Code4Cookie/ARK-Server-API | 6d444bd2a6993ae8e7ea82d7a3d6bd15af670f4d | [
"MIT"
] | null | null | null | version/Core/Public/API/Atlas/Other.h | Code4Cookie/ARK-Server-API | 6d444bd2a6993ae8e7ea82d7a3d6bd15af670f4d | [
"MIT"
] | null | null | null | #pragma once
struct FDamageEvent
{
float& ImpulseField() { return *GetNativePointerField<float*>(this, "FDamageEvent.Impulse"); }
float& OriginalDamageField() { return *GetNativePointerField<float*>(this, "FDamageEvent.OriginalDamage"); }
int& InstanceBodyIndexField() { return *GetNativePointerField<int*>(this, "FDamageEvent.InstanceBodyIndex"); }
TSubclassOf<UDamageType>& DamageTypeClassField() { return *GetNativePointerField<TSubclassOf<UDamageType>*>(this, "FDamageEvent.DamageTypeClass"); }
// Functions
void GetBestHitInfo(AActor* HitActor, AActor* HitInstigator, FHitResult* OutHitInfo, FVector* OutImpulseDir) { NativeCall<void, AActor*, AActor*, FHitResult*, FVector*>(this, "FDamageEvent.GetBestHitInfo", HitActor, HitInstigator, OutHitInfo, OutImpulseDir); }
static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FDamageEvent.StaticStruct"); }
};
struct UPhysicalMaterial
{
};
struct FBodyInstance
{
};
struct __declspec(align(8)) FHitResult
{
unsigned __int32 bBlockingHit : 1;
unsigned __int32 bStartPenetrating : 1;
unsigned __int32 bVolatileCollision : 1;
float Time;
FVector_NetQuantize Location;
FVector_NetQuantizeNormal Normal;
FVector_NetQuantize ImpactPoint;
FVector_NetQuantizeNormal ImpactNormal;
FVector_NetQuantize TraceStart;
FVector_NetQuantize TraceEnd;
float PenetrationDepth;
int Item;
TWeakObjectPtr<UPhysicalMaterial> PhysMaterial;
TWeakObjectPtr<AActor> Actor;
TWeakObjectPtr<UPrimitiveComponent> Component;
FBodyInstance* BodyInstance;
FName BoneName;
int FaceIndex;
// Functions
void operator=(FHitResult* __that) { NativeCall<void, FHitResult*>(this, "FHitResult.operator=", __that); }
AActor* GetActor() { return NativeCall<AActor*>(this, "FHitResult.GetActor"); }
UPrimitiveComponent* GetComponent() { return NativeCall<UPrimitiveComponent*>(this, "FHitResult.GetComponent"); }
static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FHitResult.StaticStruct"); }
};
struct FOverlapInfo
{
bool bFromSweep;
FHitResult OverlapInfo;
void* CachedCompPtr;
};
struct FInternetAddr
{
};
struct FSocket
{
ESocketType& SocketTypeField() { return *GetNativePointerField<ESocketType*>(this, "FSocket.SocketType"); }
FString& SocketDescriptionField() { return *GetNativePointerField<FString*>(this, "FSocket.SocketDescription"); }
};
struct FSocketBSD : FSocket
{
unsigned __int64& SocketField() { return *GetNativePointerField<unsigned __int64*>(this, "FSocketBSD.Socket"); }
FDateTime& LastActivityTimeField() { return *GetNativePointerField<FDateTime*>(this, "FSocketBSD.LastActivityTime"); }
// Functions
bool Close() { return NativeCall<bool>(this, "FSocketBSD.Close"); }
bool Bind(FInternetAddr* Addr) { return NativeCall<bool, FInternetAddr*>(this, "FSocketBSD.Bind", Addr); }
bool Connect(FInternetAddr* Addr) { return NativeCall<bool, FInternetAddr*>(this, "FSocketBSD.Connect", Addr); }
bool Listen(int MaxBacklog) { return NativeCall<bool, int>(this, "FSocketBSD.Listen", MaxBacklog); }
bool HasPendingConnection(bool* bHasPendingConnection) { return NativeCall<bool, bool*>(this, "FSocketBSD.HasPendingConnection", bHasPendingConnection); }
bool HasPendingData(unsigned int* PendingDataSize) { return NativeCall<bool, unsigned int*>(this, "FSocketBSD.HasPendingData", PendingDataSize); }
FSocket* Accept(FString* SocketDescription) { return NativeCall<FSocket*, FString*>(this, "FSocketBSD.Accept", SocketDescription); }
FSocket* Accept(FInternetAddr* OutAddr, FString* SocketDescription) { return NativeCall<FSocket*, FInternetAddr*, FString*>(this, "FSocketBSD.Accept", OutAddr, SocketDescription); }
bool SendTo(const char* Data, int Count, int* BytesSent, FInternetAddr* Destination) { return NativeCall<bool, const char*, int, int*, FInternetAddr*>(this, "FSocketBSD.SendTo", Data, Count, BytesSent, Destination); }
bool Send(const char* Data, int Count, int* BytesSent) { return NativeCall<bool, const char*, int, int*>(this, "FSocketBSD.Send", Data, Count, BytesSent); }
bool RecvFrom(char* Data, int BufferSize, int* BytesRead, FInternetAddr* Source, ESocketReceiveFlags::Type Flags) { return NativeCall<bool, char*, int, int*, FInternetAddr*, ESocketReceiveFlags::Type>(this, "FSocketBSD.RecvFrom", Data, BufferSize, BytesRead, Source, Flags); }
bool Recv(char* Data, int BufferSize, int* BytesRead, ESocketReceiveFlags::Type Flags) { return NativeCall<bool, char*, int, int*, ESocketReceiveFlags::Type>(this, "FSocketBSD.Recv", Data, BufferSize, BytesRead, Flags); }
ESocketConnectionState GetConnectionState() { return NativeCall<ESocketConnectionState>(this, "FSocketBSD.GetConnectionState"); }
void GetAddress(FInternetAddr* OutAddr) { NativeCall<void, FInternetAddr*>(this, "FSocketBSD.GetAddress", OutAddr); }
bool SetNonBlocking(bool bIsNonBlocking) { return NativeCall<bool, bool>(this, "FSocketBSD.SetNonBlocking", bIsNonBlocking); }
bool SetBroadcast(bool bAllowBroadcast) { return NativeCall<bool, bool>(this, "FSocketBSD.SetBroadcast", bAllowBroadcast); }
bool JoinMulticastGroup(FInternetAddr* GroupAddress) { return NativeCall<bool, FInternetAddr*>(this, "FSocketBSD.JoinMulticastGroup", GroupAddress); }
bool LeaveMulticastGroup(FInternetAddr* GroupAddress) { return NativeCall<bool, FInternetAddr*>(this, "FSocketBSD.LeaveMulticastGroup", GroupAddress); }
bool SetMulticastLoopback(bool bLoopback) { return NativeCall<bool, bool>(this, "FSocketBSD.SetMulticastLoopback", bLoopback); }
bool SetMulticastTtl(char TimeToLive) { return NativeCall<bool, char>(this, "FSocketBSD.SetMulticastTtl", TimeToLive); }
bool SetReuseAddr(bool bAllowReuse) { return NativeCall<bool, bool>(this, "FSocketBSD.SetReuseAddr", bAllowReuse); }
bool SetLinger(bool bShouldLinger, int Timeout) { return NativeCall<bool, bool, int>(this, "FSocketBSD.SetLinger", bShouldLinger, Timeout); }
bool SetSendBufferSize(int Size, int* NewSize) { return NativeCall<bool, int, int*>(this, "FSocketBSD.SetSendBufferSize", Size, NewSize); }
bool SetReceiveBufferSize(int Size, int* NewSize) { return NativeCall<bool, int, int*>(this, "FSocketBSD.SetReceiveBufferSize", Size, NewSize); }
int GetPortNo() { return NativeCall<int>(this, "FSocketBSD.GetPortNo"); }
};
struct RCONClientConnection
{
FSocket* SocketField() { return *GetNativePointerField<FSocket**>(this, "RCONClientConnection.Socket"); }
UShooterCheatManager* CheatManagerField() { return *GetNativePointerField<UShooterCheatManager**>(this, "RCONClientConnection.CheatManager"); }
bool& IsAuthenticatedField() { return *GetNativePointerField<bool*>(this, "RCONClientConnection.IsAuthenticated"); }
bool& IsClosedField() { return *GetNativePointerField<bool*>(this, "RCONClientConnection.IsClosed"); }
TArray<signed char>& DataBufferField() { return *GetNativePointerField<TArray<signed char>*>(this, "RCONClientConnection.DataBuffer"); }
unsigned int& CurrentPacketSizeField() { return *GetNativePointerField<unsigned int*>(this, "RCONClientConnection.CurrentPacketSize"); }
long double& LastReceiveTimeField() { return *GetNativePointerField<long double*>(this, "RCONClientConnection.LastReceiveTime"); }
long double& LastSendKeepAliveTimeField() { return *GetNativePointerField<long double*>(this, "RCONClientConnection.LastSendKeepAliveTime"); }
FString& ServerPasswordField() { return *GetNativePointerField<FString*>(this, "RCONClientConnection.ServerPassword"); }
// Functions
void Tick(long double WorldTime, UWorld* InWorld) { NativeCall<void, long double, UWorld*>(this, "RCONClientConnection.Tick", WorldTime, InWorld); }
void ProcessRCONPacket(RCONPacket* Packet, UWorld* InWorld) { NativeCall<void, RCONPacket*, UWorld*>(this, "RCONClientConnection.ProcessRCONPacket", Packet, InWorld); }
void SendMessageW(int Id, int Type, FString* OutGoingMessage) { NativeCall<void, int, int, FString*>(this, "RCONClientConnection.SendMessageW", Id, Type, OutGoingMessage); }
void Close() { NativeCall<void>(this, "RCONClientConnection.Close"); }
};
struct RCONPacket
{
int Length;
int Id;
int Type;
FString Body;
};
struct UGameInstance;
struct UGameplayStatics
{
// Functions
static float BPPointPlaneDist(FVector* Point, FVector* PlaneBase, FVector* PlaneNormal) { return NativeCall<float, FVector*, FVector*, FVector*>(nullptr, "UGameplayStatics.BPPointPlaneDist", Point, PlaneBase, PlaneNormal); }
static void ApplyDamage(AActor* DamagedActor, float BaseDamage, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<UDamageType> DamageTypeClass, float Impulse) { NativeCall<void, AActor*, float, AController*, AActor*, TSubclassOf<UDamageType>, float>(nullptr, "UGameplayStatics.ApplyDamage", DamagedActor, BaseDamage, EventInstigator, DamageCauser, DamageTypeClass, Impulse); }
static void ApplyPointDamage(AActor* DamagedActor, float BaseDamage, FVector* HitFromDirection, FHitResult* HitInfo, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<UDamageType> DamageTypeClass, float Impulse, bool bForceCollisionCheck, ECollisionChannel ForceCollisionCheckTraceChannel) { NativeCall<void, AActor*, float, FVector*, FHitResult*, AController*, AActor*, TSubclassOf<UDamageType>, float, bool, ECollisionChannel>(nullptr, "UGameplayStatics.ApplyPointDamage", DamagedActor, BaseDamage, HitFromDirection, HitInfo, EventInstigator, DamageCauser, DamageTypeClass, Impulse, bForceCollisionCheck, ForceCollisionCheckTraceChannel); }
static bool ApplyRadialDamage(UObject* WorldContextObject, float BaseDamage, FVector* Origin, float DamageRadius, TSubclassOf<UDamageType> DamageTypeClass, TArray<AActor*>* IgnoreActors, AActor* DamageCauser, AController* InstigatedByController, bool bDoFullDamage, ECollisionChannel DamagePreventionChannel, float Impulse) { return NativeCall<bool, UObject*, float, FVector*, float, TSubclassOf<UDamageType>, TArray<AActor*>*, AActor*, AController*, bool, ECollisionChannel, float>(nullptr, "UGameplayStatics.ApplyRadialDamage", WorldContextObject, BaseDamage, Origin, DamageRadius, DamageTypeClass, IgnoreActors, DamageCauser, InstigatedByController, bDoFullDamage, DamagePreventionChannel, Impulse); }
static bool ApplyRadialDamageIgnoreDamageActors(UObject* WorldContextObject, float BaseDamage, FVector* Origin, float DamageRadius, TSubclassOf<UDamageType> DamageTypeClass, TArray<AActor*>* IgnoreActors, TArray<AActor*>* IgnoreDamageActors, AActor* DamageCauser, AController* InstigatedByController, bool bDoFullDamage, ECollisionChannel DamagePreventionChannel, float Impulse) { return NativeCall<bool, UObject*, float, FVector*, float, TSubclassOf<UDamageType>, TArray<AActor*>*, TArray<AActor*>*, AActor*, AController*, bool, ECollisionChannel, float>(nullptr, "UGameplayStatics.ApplyRadialDamageIgnoreDamageActors", WorldContextObject, BaseDamage, Origin, DamageRadius, DamageTypeClass, IgnoreActors, IgnoreDamageActors, DamageCauser, InstigatedByController, bDoFullDamage, DamagePreventionChannel, Impulse); }
static bool ApplyRadialDamageWithFalloff(UObject* WorldContextObject, float BaseDamage, float MinimumDamage, FVector* Origin, float DamageInnerRadius, float DamageOuterRadius, float DamageFalloff, TSubclassOf<UDamageType> DamageTypeClass, TArray<AActor*>* IgnoreActors, AActor* DamageCauser, AController* InstigatedByController, ECollisionChannel DamagePreventionChannel, float Impulse, TArray<AActor*>* IgnoreDamageActors, int NumAdditionalAttempts) { return NativeCall<bool, UObject*, float, float, FVector*, float, float, float, TSubclassOf<UDamageType>, TArray<AActor*>*, AActor*, AController*, ECollisionChannel, float, TArray<AActor*>*, int>(nullptr, "UGameplayStatics.ApplyRadialDamageWithFalloff", WorldContextObject, BaseDamage, MinimumDamage, Origin, DamageInnerRadius, DamageOuterRadius, DamageFalloff, DamageTypeClass, IgnoreActors, DamageCauser, InstigatedByController, DamagePreventionChannel, Impulse, IgnoreDamageActors, NumAdditionalAttempts); }
static bool AreAnyListenersWithinRange(FVector Location, float MaximumRange) { return NativeCall<bool, FVector, float>(nullptr, "UGameplayStatics.AreAnyListenersWithinRange", Location, MaximumRange); }
static FVector* BPPointPlaneProject(FVector* result, FVector* Point, FVector* PlaneBase, FVector* PlaneNorm) { return NativeCall<FVector*, FVector*, FVector*, FVector*, FVector*>(nullptr, "UGameplayStatics.BPPointPlaneProject", result, Point, PlaneBase, PlaneNorm); }
static AActor* BeginSpawningActorFromBlueprint(UObject* WorldContextObject, UBlueprint* Blueprint, FTransform* SpawnTransform, bool bNoCollisionFail) { return NativeCall<AActor*, UObject*, UBlueprint*, FTransform*, bool>(nullptr, "UGameplayStatics.BeginSpawningActorFromBlueprint", WorldContextObject, Blueprint, SpawnTransform, bNoCollisionFail); }
static AActor* BeginSpawningActorFromClass(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, FTransform* SpawnTransform, bool bNoCollisionFail) { return NativeCall<AActor*, UObject*, TSubclassOf<AActor>, FTransform*, bool>(nullptr, "UGameplayStatics.BeginSpawningActorFromClass", WorldContextObject, ActorClass, SpawnTransform, bNoCollisionFail); }
static void BreakHitResult(FHitResult* Hit, FVector* Location, FVector* Normal, FVector* ImpactPoint, FVector* ImpactNormal, UPhysicalMaterial** PhysMat, AActor** HitActor, UPrimitiveComponent** HitComponent, FName* HitBoneName, int* HitItem, bool* BlockingHit) { NativeCall<void, FHitResult*, FVector*, FVector*, FVector*, FVector*, UPhysicalMaterial**, AActor**, UPrimitiveComponent**, FName*, int*, bool*>(nullptr, "UGameplayStatics.BreakHitResult", Hit, Location, Normal, ImpactPoint, ImpactNormal, PhysMat, HitActor, HitComponent, HitBoneName, HitItem, BlockingHit); }
static void BreakHitResult_OLD(FHitResult* Hit, FVector* Location, FVector* Normal, FVector* ImpactPoint, FVector* ImpactNormal, UPhysicalMaterial** PhysMat, AActor** HitActor, UPrimitiveComponent** HitComponent, FName* HitBoneName, int* HitItem) { NativeCall<void, FHitResult*, FVector*, FVector*, FVector*, FVector*, UPhysicalMaterial**, AActor**, UPrimitiveComponent**, FName*, int*>(nullptr, "UGameplayStatics.BreakHitResult_OLD", Hit, Location, Normal, ImpactPoint, ImpactNormal, PhysMat, HitActor, HitComponent, HitBoneName, HitItem); }
static APlayerController* CreatePlayer(UObject* WorldContextObject, int ControllerId, bool bSpawnPawn) { return NativeCall<APlayerController*, UObject*, int, bool>(nullptr, "UGameplayStatics.CreatePlayer", WorldContextObject, ControllerId, bSpawnPawn); }
static void DeactivateReverbEffect(FName TagName) { NativeCall<void, FName>(nullptr, "UGameplayStatics.DeactivateReverbEffect", TagName); }
static bool DeleteGameInSlot(FString* SlotName, const int UserIndex) { return NativeCall<bool, FString*, const int>(nullptr, "UGameplayStatics.DeleteGameInSlot", SlotName, UserIndex); }
static bool DoesSaveGameExist(FString* SlotName, const int UserIndex) { return NativeCall<bool, FString*, const int>(nullptr, "UGameplayStatics.DoesSaveGameExist", SlotName, UserIndex); }
static void EnableLiveStreaming(bool Enable) { NativeCall<void, bool>(nullptr, "UGameplayStatics.EnableLiveStreaming", Enable); }
static AActor* FinishSpawningActor(AActor* Actor, FTransform* SpawnTransform) { return NativeCall<AActor*, AActor*, FTransform*>(nullptr, "UGameplayStatics.FinishSpawningActor", Actor, SpawnTransform); }
static void GetAccurateRealTime(UObject* WorldContextObject, int* Seconds, float* PartialSeconds) { NativeCall<void, UObject*, int*, float*>(nullptr, "UGameplayStatics.GetAccurateRealTime", WorldContextObject, Seconds, PartialSeconds); }
static FVector* GetActorArrayAverageLocation(FVector* result, TArray<AActor*>* Actors) { return NativeCall<FVector*, FVector*, TArray<AActor*>*>(nullptr, "UGameplayStatics.GetActorArrayAverageLocation", result, Actors); }
static void GetActorArrayBounds(TArray<AActor*>* Actors, bool bOnlyCollidingComponents, FVector* Center, FVector* BoxExtent) { NativeCall<void, TArray<AActor*>*, bool, FVector*, FVector*>(nullptr, "UGameplayStatics.GetActorArrayBounds", Actors, bOnlyCollidingComponents, Center, BoxExtent); }
static void GetAllActorsOfClass(UObject* WorldContextObject, TSubclassOf<AActor> ActorClass, TArray<AActor*>* OutActors) { NativeCall<void, UObject*, TSubclassOf<AActor>, TArray<AActor*>*>(nullptr, "UGameplayStatics.GetAllActorsOfClass", WorldContextObject, ActorClass, OutActors); }
static void GetAllActorsWithInterface(UObject* WorldContextObject, TSubclassOf<UInterface> Interface, TArray<AActor*>* OutActors) { NativeCall<void, UObject*, TSubclassOf<UInterface>, TArray<AActor*>*>(nullptr, "UGameplayStatics.GetAllActorsWithInterface", WorldContextObject, Interface, OutActors); }
static float GetAudioTimeSeconds(UObject* WorldContextObject) { return NativeCall<float, UObject*>(nullptr, "UGameplayStatics.GetAudioTimeSeconds", WorldContextObject); }
static UGameInstance* GetGameInstance(UObject* WorldContextObject) { return NativeCall<UGameInstance*, UObject*>(nullptr, "UGameplayStatics.GetGameInstance", WorldContextObject); }
static AGameMode* GetGameMode(UObject* WorldContextObject) { return NativeCall<AGameMode*, UObject*>(nullptr, "UGameplayStatics.GetGameMode", WorldContextObject); }
static AGameState* GetGameState(UObject* WorldContextObject) { return NativeCall<AGameState*, UObject*>(nullptr, "UGameplayStatics.GetGameState", WorldContextObject); }
static float GetGlobalTimeDilation(UObject* WorldContextObject) { return NativeCall<float, UObject*>(nullptr, "UGameplayStatics.GetGlobalTimeDilation", WorldContextObject); }
static UClass* GetObjectClass(UObject* Object) { return NativeCall<UClass*, UObject*>(nullptr, "UGameplayStatics.GetObjectClass", Object); }
static FString* GetPlatformName(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UGameplayStatics.GetPlatformName", result); }
static APlayerCameraManager* GetPlayerCameraManager(UObject* WorldContextObject, int PlayerIndex) { return NativeCall<APlayerCameraManager*, UObject*, int>(nullptr, "UGameplayStatics.GetPlayerCameraManager", WorldContextObject, PlayerIndex); }
static ACharacter* GetPlayerCharacter(UObject* WorldContextObject, int PlayerIndex) { return NativeCall<ACharacter*, UObject*, int>(nullptr, "UGameplayStatics.GetPlayerCharacter", WorldContextObject, PlayerIndex); }
static APlayerController* GetPlayerController(UObject* WorldContextObject, int PlayerIndex) { return NativeCall<APlayerController*, UObject*, int>(nullptr, "UGameplayStatics.GetPlayerController", WorldContextObject, PlayerIndex); }
static APawn* GetPlayerPawn(UObject* WorldContextObject, int PlayerIndex) { return NativeCall<APawn*, UObject*, int>(nullptr, "UGameplayStatics.GetPlayerPawn", WorldContextObject, PlayerIndex); }
static float GetRealTimeSeconds(UObject* WorldContextObject) { return NativeCall<float, UObject*>(nullptr, "UGameplayStatics.GetRealTimeSeconds", WorldContextObject); }
static EPhysicalSurface GetSurfaceType(FHitResult* Hit) { return NativeCall<EPhysicalSurface, FHitResult*>(nullptr, "UGameplayStatics.GetSurfaceType", Hit); }
static float GetWorldDeltaSeconds(UObject* WorldContextObject) { return NativeCall<float, UObject*>(nullptr, "UGameplayStatics.GetWorldDeltaSeconds", WorldContextObject); }
static FIntVector* GetWorldOriginLocation(FIntVector* result, UObject* WorldContextObject) { return NativeCall<FIntVector*, FIntVector*, UObject*>(nullptr, "UGameplayStatics.GetWorldOriginLocation", result, WorldContextObject); }
static bool IsGamePaused(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UGameplayStatics.IsGamePaused", WorldContextObject); }
static bool IsGameWorld(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UGameplayStatics.IsGameWorld", WorldContextObject); }
static void LoadStreamLevel(UObject* WorldContextObject, FName LevelName, bool bMakeVisibleAfterLoad, bool bShouldBlockOnLoad, FLatentActionInfo LatentInfo) { NativeCall<void, UObject*, FName, bool, bool, FLatentActionInfo>(nullptr, "UGameplayStatics.LoadStreamLevel", WorldContextObject, LevelName, bMakeVisibleAfterLoad, bShouldBlockOnLoad, LatentInfo); }
static void OpenLevel(UObject* WorldContextObject, FName LevelName, bool bAbsolute, FString Options) { NativeCall<void, UObject*, FName, bool, FString>(nullptr, "UGameplayStatics.OpenLevel", WorldContextObject, LevelName, bAbsolute, Options); }
static void PlayDialogueAtLocation(UObject* WorldContextObject, UDialogueWave* Dialogue, FDialogueContext* Context, FVector Location, float VolumeMultiplier, float PitchMultiplier, float StartTime, USoundAttenuation* AttenuationSettings) { NativeCall<void, UObject*, UDialogueWave*, FDialogueContext*, FVector, float, float, float, USoundAttenuation*>(nullptr, "UGameplayStatics.PlayDialogueAtLocation", WorldContextObject, Dialogue, Context, Location, VolumeMultiplier, PitchMultiplier, StartTime, AttenuationSettings); }
static UAudioComponent* PlayDialogueAttached(UDialogueWave* Dialogue, FDialogueContext* Context, USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, EAttachLocation::Type LocationType, bool bStopWhenAttachedToDestroyed, float VolumeMultiplier, float PitchMultiplier, float StartTime, USoundAttenuation* AttenuationSettings) { return NativeCall<UAudioComponent*, UDialogueWave*, FDialogueContext*, USceneComponent*, FName, FVector, EAttachLocation::Type, bool, float, float, float, USoundAttenuation*>(nullptr, "UGameplayStatics.PlayDialogueAttached", Dialogue, Context, AttachToComponent, AttachPointName, Location, LocationType, bStopWhenAttachedToDestroyed, VolumeMultiplier, PitchMultiplier, StartTime, AttenuationSettings); }
static void PlaySound(UObject* WorldContextObject, USoundCue* InSoundCue, USceneComponent* AttachComponent, FName AttachName, bool bFollow, float VolumeMultiplier, float PitchMultiplier) { NativeCall<void, UObject*, USoundCue*, USceneComponent*, FName, bool, float, float>(nullptr, "UGameplayStatics.PlaySound", WorldContextObject, InSoundCue, AttachComponent, AttachName, bFollow, VolumeMultiplier, PitchMultiplier); }
static void PlaySoundAtLocation(UObject* WorldContextObject, USoundBase* Sound, FVector Location, float VolumeMultiplier, float PitchMultiplier, float StartTime, USoundAttenuation* AttenuationSettings, bool bAlwaysPlay) { NativeCall<void, UObject*, USoundBase*, FVector, float, float, float, USoundAttenuation*, bool>(nullptr, "UGameplayStatics.PlaySoundAtLocation", WorldContextObject, Sound, Location, VolumeMultiplier, PitchMultiplier, StartTime, AttenuationSettings, bAlwaysPlay); }
static UAudioComponent* PlaySoundAttached(USoundBase* Sound, USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, EAttachLocation::Type LocationType, bool bStopWhenAttachedToDestroyed, float VolumeMultiplier, float PitchMultiplier, float StartTime, USoundAttenuation* AttenuationSettings, bool bAlwaysPlay) { return NativeCall<UAudioComponent*, USoundBase*, USceneComponent*, FName, FVector, EAttachLocation::Type, bool, float, float, float, USoundAttenuation*, bool>(nullptr, "UGameplayStatics.PlaySoundAttached", Sound, AttachToComponent, AttachPointName, Location, LocationType, bStopWhenAttachedToDestroyed, VolumeMultiplier, PitchMultiplier, StartTime, AttenuationSettings, bAlwaysPlay); }
static void PopSoundMixModifier(USoundMix* InSoundMixModifier) { NativeCall<void, USoundMix*>(nullptr, "UGameplayStatics.PopSoundMixModifier", InSoundMixModifier); }
static void PushSoundMixModifier(USoundMix* InSoundMixModifier) { NativeCall<void, USoundMix*>(nullptr, "UGameplayStatics.PushSoundMixModifier", InSoundMixModifier); }
static void SetBaseSoundMix(USoundMix* InSoundMix) { NativeCall<void, USoundMix*>(nullptr, "UGameplayStatics.SetBaseSoundMix", InSoundMix); }
static bool SetGamePaused(UObject* WorldContextObject, bool bPaused) { return NativeCall<bool, UObject*, bool>(nullptr, "UGameplayStatics.SetGamePaused", WorldContextObject, bPaused); }
static void SetGlobalTimeDilation(UObject* WorldContextObject, float TimeDilation) { NativeCall<void, UObject*, float>(nullptr, "UGameplayStatics.SetGlobalTimeDilation", WorldContextObject, TimeDilation); }
static void SetWorldOriginLocation(UObject* WorldContextObject, FIntVector NewLocation) { NativeCall<void, UObject*, FIntVector>(nullptr, "UGameplayStatics.SetWorldOriginLocation", WorldContextObject, NewLocation); }
static void UnloadStreamLevel(UObject* WorldContextObject, FName LevelName, FLatentActionInfo LatentInfo) { NativeCall<void, UObject*, FName, FLatentActionInfo>(nullptr, "UGameplayStatics.UnloadStreamLevel", WorldContextObject, LevelName, LatentInfo); }
static UClass* GetPrivateStaticClass(const wchar_t* Package) { return NativeCall<UClass*, const wchar_t*>(nullptr, "UGameplayStatics.GetPrivateStaticClass", Package); }
static void StaticRegisterNativesUGameplayStatics() { NativeCall<void>(nullptr, "UGameplayStatics.StaticRegisterNativesUGameplayStatics"); }
};
struct FItemMultiplier
{
TSubclassOf<UPrimalItem> ItemClass;
float ItemMultiplier;
};
struct APrimalBuff
{
float& DeactivationLifespanField() { return *GetNativePointerField<float*>(this, "APrimalBuff.DeactivationLifespan"); }
FName& InstigatorAttachmentSocketField() { return *GetNativePointerField<FName*>(this, "APrimalBuff.InstigatorAttachmentSocket"); }
float& RemoteForcedFleeDurationField() { return *GetNativePointerField<float*>(this, "APrimalBuff.RemoteForcedFleeDuration"); }
FVector& AoETraceToTargetsStartOffsetField() { return *GetNativePointerField<FVector*>(this, "APrimalBuff.AoETraceToTargetsStartOffset"); }
TWeakObjectPtr<AActor>& TargetField() { return *GetNativePointerField<TWeakObjectPtr<AActor>*>(this, "APrimalBuff.Target"); }
TWeakObjectPtr<UPrimalItem>& InstigatorItemField() { return *GetNativePointerField<TWeakObjectPtr<UPrimalItem>*>(this, "APrimalBuff.InstigatorItem"); }
float& SlowInstigatorFallingAddZVelocityField() { return *GetNativePointerField<float*>(this, "APrimalBuff.SlowInstigatorFallingAddZVelocity"); }
float& SlowInstigatorFallingDampenZVelocityField() { return *GetNativePointerField<float*>(this, "APrimalBuff.SlowInstigatorFallingDampenZVelocity"); }
float& DeactivateAfterTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.DeactivateAfterTime"); }
float& WeaponRecoilMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.WeaponRecoilMultiplier"); }
float& ReceiveDamageMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.ReceiveDamageMultiplier"); }
float& MeleeDamageMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.MeleeDamageMultiplier"); }
float& DepleteInstigatorItemDurabilityPerSecondField() { return *GetNativePointerField<float*>(this, "APrimalBuff.DepleteInstigatorItemDurabilityPerSecond"); }
FieldArray<float, 12> ValuesToAddPerSecondField() { return { this, "APrimalBuff.ValuesToAddPerSecond" }; }
float& CharacterAdd_DefaultHyperthermicInsulationField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterAdd_DefaultHyperthermicInsulation"); }
float& CharacterAdd_DefaultHypothermicInsulationField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterAdd_DefaultHypothermicInsulation"); }
float& CharacterMultiplier_ExtraWaterConsumptionMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterMultiplier_ExtraWaterConsumptionMultiplier"); }
float& CharacterMultiplier_ExtraFoodConsumptionMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterMultiplier_ExtraFoodConsumptionMultiplier"); }
float& CharacterMultiplier_SubmergedOxygenDecreaseSpeedField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterMultiplier_SubmergedOxygenDecreaseSpeed"); }
float& ViewMinExposureMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.ViewMinExposureMultiplier"); }
float& ViewMaxExposureMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.ViewMaxExposureMultiplier"); }
float& XPtoAddField() { return *GetNativePointerField<float*>(this, "APrimalBuff.XPtoAdd"); }
float& XPtoAddRateField() { return *GetNativePointerField<float*>(this, "APrimalBuff.XPtoAddRate"); }
bool& bDeactivateAfterAddingXPField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bDeactivateAfterAddingXP"); }
float& SubmergedMaxSpeedModifierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.SubmergedMaxSpeedModifier"); }
float& UnsubmergedMaxSpeedModifierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.UnsubmergedMaxSpeedModifier"); }
long double& BuffStartTimeField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.BuffStartTime"); }
UMaterialInterface* BuffPostProcessEffectField() { return *GetNativePointerField<UMaterialInterface**>(this, "APrimalBuff.BuffPostProcessEffect"); }
TArray<TSubclassOf<AActor>>& PreventActorClassesTargetingField() { return *GetNativePointerField<TArray<TSubclassOf<AActor>>*>(this, "APrimalBuff.PreventActorClassesTargeting"); }
TArray<float>& PreventActorClassesTargetingRangesField() { return *GetNativePointerField<TArray<float>*>(this, "APrimalBuff.PreventActorClassesTargetingRanges"); }
TSubclassOf<APrimalBuff>& AOEOtherBuffToApplyField() { return *GetNativePointerField<TSubclassOf<APrimalBuff>*>(this, "APrimalBuff.AOEOtherBuffToApply"); }
float& AOEBuffRangeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.AOEBuffRange"); }
float& CharacterAOEBuffDamageField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterAOEBuffDamage"); }
float& CharacterAOEBuffResistanceField() { return *GetNativePointerField<float*>(this, "APrimalBuff.CharacterAOEBuffResistance"); }
float& Maximum2DVelocityForStaminaRecoveryField() { return *GetNativePointerField<float*>(this, "APrimalBuff.Maximum2DVelocityForStaminaRecovery"); }
TArray<UMaterialInterface*> PostprocessBlendablesToExcludeField() { return *GetNativePointerField<TArray<UMaterialInterface*>*>(this, "APrimalBuff.PostprocessBlendablesToExclude"); }
TArray<TWeakObjectPtr<APrimalCharacter>>& BuffedCharactersField() { return *GetNativePointerField<TArray<TWeakObjectPtr<APrimalCharacter>>*>(this, "APrimalBuff.BuffedCharacters"); }
long double& LastItemDurabilityDepletionTimeField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.LastItemDurabilityDepletionTime"); }
TSubclassOf<APrimalBuff>& BuffToGiveOnDeactivationField() { return *GetNativePointerField<TSubclassOf<APrimalBuff>*>(this, "APrimalBuff.BuffToGiveOnDeactivation"); }
TArray<TSubclassOf<APrimalBuff>>& BuffClassesToCancelOnActivationField() { return *GetNativePointerField<TArray<TSubclassOf<APrimalBuff>>*>(this, "APrimalBuff.BuffClassesToCancelOnActivation"); }
TArray<TSubclassOf<APrimalBuff>>& ActivePreventsBuffClassesField() { return *GetNativePointerField<TArray<TSubclassOf<APrimalBuff>>*>(this, "APrimalBuff.ActivePreventsBuffClasses"); }
TArray<TSubclassOf<APrimalCharacter>>& BuffRequiresOwnerClassField() { return *GetNativePointerField<TArray<TSubclassOf<APrimalCharacter>>*>(this, "APrimalBuff.BuffRequiresOwnerClass"); }
TArray<TSubclassOf<APrimalCharacter>>& BuffPreventsOwnerClassField() { return *GetNativePointerField<TArray<TSubclassOf<APrimalCharacter>>*>(this, "APrimalBuff.BuffPreventsOwnerClass"); }
float& XPEarningMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.XPEarningMultiplier"); }
bool& bUseBPSetupForInstigatorField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBPSetupForInstigator"); }
bool& bUseBPDeactivatedField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBPDeactivated"); }
bool& bUseBPCustomAllowAddBuffField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBPCustomAllowAddBuff"); }
FVector& staticPathingDestinationField() { return *GetNativePointerField<FVector*>(this, "APrimalBuff.staticPathingDestination"); }
long double& TickingDeactivationTimeField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.TickingDeactivationTime"); }
UPrimalBuffPersistentData* MyBuffPersistentDataField() { return *GetNativePointerField<UPrimalBuffPersistentData**>(this, "APrimalBuff.MyBuffPersistentData"); }
TSubclassOf<UPrimalBuffPersistentData>& BuffPersistentDataClassField() { return *GetNativePointerField<TSubclassOf<UPrimalBuffPersistentData>*>(this, "APrimalBuff.BuffPersistentDataClass"); }
TWeakObjectPtr<AActor>& DamageCauserField() { return *GetNativePointerField<TWeakObjectPtr<AActor>*>(this, "APrimalBuff.DamageCauser"); }
USoundBase* ExtraActivationSoundToPlayField() { return *GetNativePointerField<USoundBase**>(this, "APrimalBuff.ExtraActivationSoundToPlay"); }
bool& bPersistentBuffSurvivesLevelUpField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bPersistentBuffSurvivesLevelUp"); }
float& AoEApplyDamageField() { return *GetNativePointerField<float*>(this, "APrimalBuff.AoEApplyDamage"); }
float& AoEApplyDamageIntervalField() { return *GetNativePointerField<float*>(this, "APrimalBuff.AoEApplyDamageInterval"); }
TSubclassOf<UDamageType>& AoEApplyDamageTypeField() { return *GetNativePointerField<TSubclassOf<UDamageType>*>(this, "APrimalBuff.AoEApplyDamageType"); }
TSubclassOf<APrimalBuff>& ForceNetworkSpatializationMaxLimitBuffTypeField() { return *GetNativePointerField<TSubclassOf<APrimalBuff>*>(this, "APrimalBuff.ForceNetworkSpatializationMaxLimitBuffType"); }
int& ForceNetworkSpatializationBuffMaxLimitNumField() { return *GetNativePointerField<int*>(this, "APrimalBuff.ForceNetworkSpatializationBuffMaxLimitNum"); }
float& ForceNetworkSpatializationBuffMaxLimitRangeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.ForceNetworkSpatializationBuffMaxLimitRange"); }
float& InsulationRangeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.InsulationRange"); }
float& HyperThermiaInsulationField() { return *GetNativePointerField<float*>(this, "APrimalBuff.HyperThermiaInsulation"); }
float& HypoThermiaInsulationField() { return *GetNativePointerField<float*>(this, "APrimalBuff.HypoThermiaInsulation"); }
FVector& AoEBuffLocOffsetField() { return *GetNativePointerField<FVector*>(this, "APrimalBuff.AoEBuffLocOffset"); }
TArray<TSubclassOf<AActor>>& AoEClassesToIncludeField() { return *GetNativePointerField<TArray<TSubclassOf<AActor>>*>(this, "APrimalBuff.AoEClassesToInclude"); }
TArray<TSubclassOf<AActor>>& AoEClassesToExcludeField() { return *GetNativePointerField<TArray<TSubclassOf<AActor>>*>(this, "APrimalBuff.AoEClassesToExclude"); }
bool& bUseBPExcludeAoEActorField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBPExcludeAoEActor"); }
bool& bOverrideBuffDescriptionField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bOverrideBuffDescription"); }
bool& bOnlyTickWhenPossessedField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bOnlyTickWhenPossessed"); }
bool& bDestroyWhenUnpossessedField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bDestroyWhenUnpossessed"); }
long double& LastAoEApplyDamageTimeField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.LastAoEApplyDamageTime"); }
float& OnlyForInstigatorSoundFadeInTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.OnlyForInstigatorSoundFadeInTime"); }
bool& bUseBuffTickServerField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBuffTickServer"); }
bool& bUseBuffTickClientField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bUseBuffTickClient"); }
float& BuffTickServerMaxTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.BuffTickServerMaxTime"); }
float& BuffTickServerMinTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.BuffTickServerMinTime"); }
float& BuffTickClientMaxTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.BuffTickClientMaxTime"); }
float& BuffTickClientMinTimeField() { return *GetNativePointerField<float*>(this, "APrimalBuff.BuffTickClientMinTime"); }
long double& LastBuffTickTimeServerField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.LastBuffTickTimeServer"); }
long double& LastBuffTickTimeClientField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.LastBuffTickTimeClient"); }
long double& NextBuffTickTimeServerField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.NextBuffTickTimeServer"); }
long double& NextBuffTickTimeClientField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.NextBuffTickTimeClient"); }
bool& bTickFunctionDisabledField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bTickFunctionDisabled"); }
bool& bWasStasisedField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bWasStasised"); }
int& AddBuffMaxNumStacksField() { return *GetNativePointerField<int*>(this, "APrimalBuff.AddBuffMaxNumStacks"); }
USoundBase* DeactivatedSoundField() { return *GetNativePointerField<USoundBase**>(this, "APrimalBuff.DeactivatedSound"); }
bool& bDeactivatedSoundOnlyLocalField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bDeactivatedSoundOnlyLocal"); }
bool& bDisableBloomField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bDisableBloom"); }
bool& bBPOverrideCharacterNewFallVelocityField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bBPOverrideCharacterNewFallVelocity"); }
bool& bBPModifyCharacterFOVField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bBPModifyCharacterFOV"); }
bool& bDisableLightShaftsField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bDisableLightShafts"); }
float& PostProcessInterpSpeedDownField() { return *GetNativePointerField<float*>(this, "APrimalBuff.PostProcessInterpSpeedDown"); }
float& PostProcessInterpSpeedUpField() { return *GetNativePointerField<float*>(this, "APrimalBuff.PostProcessInterpSpeedUp"); }
float& TPVCameraSpeedInterpolationMultiplierField() { return *GetNativePointerField<float*>(this, "APrimalBuff.TPVCameraSpeedInterpolationMultiplier"); }
bool& bIsCarryBuffField() { return *GetNativePointerField<bool*>(this, "APrimalBuff.bIsCarryBuff"); }
long double& TimeForNextAOECheckField() { return *GetNativePointerField<long double*>(this, "APrimalBuff.TimeForNextAOECheck"); }
float& AOEBuffIntervalMinField() { return *GetNativePointerField<float*>(this, "APrimalBuff.AOEBuffIntervalMin"); }
float& AOEBuffIntervalMaxField() { return *GetNativePointerField<float*>(this, "APrimalBuff.AOEBuffIntervalMax"); }
float& MaximumVelocityZForSlowingFallField() { return *GetNativePointerField<float*>(this, "APrimalBuff.MaximumVelocityZForSlowingFall"); }
int& FNameIntField() { return *GetNativePointerField<int*>(this, "APrimalBuff.FNameInt"); }
// Bit fields
BitFieldValue<bool, unsigned __int32> bSlowInstigatorFalling() { return { this, "APrimalBuff.bSlowInstigatorFalling" }; }
BitFieldValue<bool, unsigned __int32> bDeactivateOnJump() { return { this, "APrimalBuff.bDeactivateOnJump" }; }
BitFieldValue<bool, unsigned __int32> bPreventJump() { return { this, "APrimalBuff.bPreventJump" }; }
BitFieldValue<bool, unsigned __int32> bDeactivated() { return { this, "APrimalBuff.bDeactivated" }; }
BitFieldValue<bool, unsigned __int32> bUsesInstigator() { return { this, "APrimalBuff.bUsesInstigator" }; }
BitFieldValue<bool, unsigned __int32> bFollowTarget() { return { this, "APrimalBuff.bFollowTarget" }; }
BitFieldValue<bool, unsigned __int32> bAddCharacterValues() { return { this, "APrimalBuff.bAddCharacterValues" }; }
BitFieldValue<bool, unsigned __int32> bOnlyAddCharacterValuesUnderwater() { return { this, "APrimalBuff.bOnlyAddCharacterValuesUnderwater" }; }
BitFieldValue<bool, unsigned __int32> bDisableIfCharacterUnderwater() { return { this, "APrimalBuff.bDisableIfCharacterUnderwater" }; }
BitFieldValue<bool, unsigned __int32> bUseInstigatorItem() { return { this, "APrimalBuff.bUseInstigatorItem" }; }
BitFieldValue<bool, unsigned __int32> bDestroyOnTargetStasis() { return { this, "APrimalBuff.bDestroyOnTargetStasis" }; }
BitFieldValue<bool, unsigned __int32> bAoETraceToTargets() { return { this, "APrimalBuff.bAoETraceToTargets" }; }
BitFieldValue<bool, unsigned __int32> bAOEOnlyApplyOtherBuffToWildDinos() { return { this, "APrimalBuff.bAOEOnlyApplyOtherBuffToWildDinos" }; }
BitFieldValue<bool, unsigned __int32> bAoEIgnoreDinosTargetingInstigator() { return { this, "APrimalBuff.bAoEIgnoreDinosTargetingInstigator" }; }
BitFieldValue<bool, unsigned __int32> bAoEOnlyOnDinosTargetingInstigator() { return { this, "APrimalBuff.bAoEOnlyOnDinosTargetingInstigator" }; }
BitFieldValue<bool, unsigned __int32> bBuffForceNoTick() { return { this, "APrimalBuff.bBuffForceNoTick" }; }
BitFieldValue<bool, unsigned __int32> bBuffForceNoTickDedicated() { return { this, "APrimalBuff.bBuffForceNoTickDedicated" }; }
BitFieldValue<bool, unsigned __int32> bCustomDepthStencilIgnoreHealth() { return { this, "APrimalBuff.bCustomDepthStencilIgnoreHealth" }; }
BitFieldValue<bool, unsigned __int32> bUseActivateSoundFadeInDuration() { return { this, "APrimalBuff.bUseActivateSoundFadeInDuration" }; }
BitFieldValue<bool, unsigned __int32> bDinoIgnoreBuffPostprocessEffectWhenRidden() { return { this, "APrimalBuff.bDinoIgnoreBuffPostprocessEffectWhenRidden" }; }
BitFieldValue<bool, unsigned __int32> bPlayerIgnoreBuffPostprocessEffectWhenRidingDino() { return { this, "APrimalBuff.bPlayerIgnoreBuffPostprocessEffectWhenRidingDino" }; }
BitFieldValue<bool, unsigned __int32> bRemoteForcedFlee() { return { this, "APrimalBuff.bRemoteForcedFlee" }; }
BitFieldValue<bool, unsigned __int32> bOnlyActivateSoundForInstigator() { return { this, "APrimalBuff.bOnlyActivateSoundForInstigator" }; }
BitFieldValue<bool, unsigned __int32> bAOEBuffCarnosOnly() { return { this, "APrimalBuff.bAOEBuffCarnosOnly" }; }
BitFieldValue<bool, unsigned __int32> bModifyMaxSpeed() { return { this, "APrimalBuff.bModifyMaxSpeed" }; }
BitFieldValue<bool, unsigned __int32> bDisplayHUDProgressBar() { return { this, "APrimalBuff.bDisplayHUDProgressBar" }; }
BitFieldValue<bool, unsigned __int32> bForceUsePreventTargeting() { return { this, "APrimalBuff.bForceUsePreventTargeting" }; }
BitFieldValue<bool, unsigned __int32> bForceUsePreventTargetingTurret() { return { this, "APrimalBuff.bForceUsePreventTargetingTurret" }; }
BitFieldValue<bool, unsigned __int32> bBPOverrideWeaponBob() { return { this, "APrimalBuff.bBPOverrideWeaponBob" }; }
BitFieldValue<bool, unsigned __int32> bUseBPModifyPlayerBoneModifiers() { return { this, "APrimalBuff.bUseBPModifyPlayerBoneModifiers" }; }
BitFieldValue<bool, unsigned __int32> bDediServerUseBPModifyPlayerBoneModifiers() { return { this, "APrimalBuff.bDediServerUseBPModifyPlayerBoneModifiers" }; }
BitFieldValue<bool, unsigned __int32> bUseBPNonDedicatedPlayerPostAnimUpdate() { return { this, "APrimalBuff.bUseBPNonDedicatedPlayerPostAnimUpdate" }; }
BitFieldValue<bool, unsigned __int32> bUseBPIsCharacterHardAttached() { return { this, "APrimalBuff.bUseBPIsCharacterHardAttached" }; }
BitFieldValue<bool, unsigned __int32> bDoCharacterDetachment() { return { this, "APrimalBuff.bDoCharacterDetachment" }; }
BitFieldValue<bool, unsigned __int32> bDoCharacterDetachmentIncludeRiding() { return { this, "APrimalBuff.bDoCharacterDetachmentIncludeRiding" }; }
BitFieldValue<bool, unsigned __int32> bDoCharacterDetachmentIncludeCarrying() { return { this, "APrimalBuff.bDoCharacterDetachmentIncludeCarrying" }; }
BitFieldValue<bool, unsigned __int32> bUseBPInitializedCharacterAnimScriptInstance() { return { this, "APrimalBuff.bUseBPInitializedCharacterAnimScriptInstance" }; }
BitFieldValue<bool, unsigned __int32> bUseBPCanBeCarried() { return { this, "APrimalBuff.bUseBPCanBeCarried" }; }
BitFieldValue<bool, unsigned __int32> bUsePostAdjustDamage() { return { this, "APrimalBuff.bUsePostAdjustDamage" }; }
BitFieldValue<bool, unsigned __int32> bAOEApplyOtherBuffOnPlayers() { return { this, "APrimalBuff.bAOEApplyOtherBuffOnPlayers" }; }
BitFieldValue<bool, unsigned __int32> bAOEApplyOtherBuffOnDinos() { return { this, "APrimalBuff.bAOEApplyOtherBuffOnDinos" }; }
BitFieldValue<bool, unsigned __int32> bAOEApplyOtherBuffIgnoreSameTeam() { return { this, "APrimalBuff.bAOEApplyOtherBuffIgnoreSameTeam" }; }
BitFieldValue<bool, unsigned __int32> bAOEApplyOtherBuffRequireSameTeam() { return { this, "APrimalBuff.bAOEApplyOtherBuffRequireSameTeam" }; }
BitFieldValue<bool, unsigned __int32> bBuffDrawFloatingHUD() { return { this, "APrimalBuff.bBuffDrawFloatingHUD" }; }
BitFieldValue<bool, unsigned __int32> bAddResetsBuffTime() { return { this, "APrimalBuff.bAddResetsBuffTime" }; }
BitFieldValue<bool, unsigned __int32> bAoEBuffAllowIfAlreadyBuffed() { return { this, "APrimalBuff.bAoEBuffAllowIfAlreadyBuffed" }; }
BitFieldValue<bool, unsigned __int32> bNetResetBuffStart() { return { this, "APrimalBuff.bNetResetBuffStart" }; }
BitFieldValue<bool, unsigned __int32> bImmobilizeTarget() { return { this, "APrimalBuff.bImmobilizeTarget" }; }
BitFieldValue<bool, unsigned __int32> bForcePlayerProne() { return { this, "APrimalBuff.bForcePlayerProne" }; }
BitFieldValue<bool, unsigned __int32> bHideBuffFromHUD() { return { this, "APrimalBuff.bHideBuffFromHUD" }; }
BitFieldValue<bool, unsigned __int32> bHideTimerFromHUD() { return { this, "APrimalBuff.bHideTimerFromHUD" }; }
BitFieldValue<bool, unsigned __int32> bBPAddMultiUseEntries() { return { this, "APrimalBuff.bBPAddMultiUseEntries" }; }
BitFieldValue<bool, unsigned __int32> bIsBuffPersistent() { return { this, "APrimalBuff.bIsBuffPersistent" }; }
BitFieldValue<bool, unsigned __int32> bBPUseBumpedByPawn() { return { this, "APrimalBuff.bBPUseBumpedByPawn" }; }
BitFieldValue<bool, unsigned __int32> bBPUseBumpedPawn() { return { this, "APrimalBuff.bBPUseBumpedPawn" }; }
BitFieldValue<bool, unsigned __int32> bAllowBuffWhenInstigatorDead() { return { this, "APrimalBuff.bAllowBuffWhenInstigatorDead" }; }
BitFieldValue<bool, unsigned __int32> bNotifyDamage() { return { this, "APrimalBuff.bNotifyDamage" }; }
BitFieldValue<bool, unsigned __int32> bAllowBuffStasis() { return { this, "APrimalBuff.bAllowBuffStasis" }; }
BitFieldValue<bool, unsigned __int32> bApplyStatModifierToPlayers() { return { this, "APrimalBuff.bApplyStatModifierToPlayers" }; }
BitFieldValue<bool, unsigned __int32> bApplyStatModifierToDinos() { return { this, "APrimalBuff.bApplyStatModifierToDinos" }; }
BitFieldValue<bool, unsigned __int32> bPreventOnWildDino() { return { this, "APrimalBuff.bPreventOnWildDino" }; }
BitFieldValue<bool, unsigned __int32> bPreventOnDino() { return { this, "APrimalBuff.bPreventOnDino" }; }
BitFieldValue<bool, unsigned __int32> bPreventOnPlayer() { return { this, "APrimalBuff.bPreventOnPlayer" }; }
BitFieldValue<bool, unsigned __int32> bPreventOnBigDino() { return { this, "APrimalBuff.bPreventOnBigDino" }; }
BitFieldValue<bool, unsigned __int32> bPreventOnBossDino() { return { this, "APrimalBuff.bPreventOnBossDino" }; }
BitFieldValue<bool, unsigned __int32> bIsDisease() { return { this, "APrimalBuff.bIsDisease" }; }
BitFieldValue<bool, unsigned __int32> bUseBPPreventAddingOtherBuff() { return { this, "APrimalBuff.bUseBPPreventAddingOtherBuff" }; }
BitFieldValue<bool, unsigned __int32> bUseBPPreventRunning() { return { this, "APrimalBuff.bUseBPPreventRunning" }; }
BitFieldValue<bool, unsigned __int32> bAoEApplyDamageAllTargetables() { return { this, "APrimalBuff.bAoEApplyDamageAllTargetables" }; }
BitFieldValue<bool, unsigned __int32> bUseBPActivated() { return { this, "APrimalBuff.bUseBPActivated" }; }
BitFieldValue<bool, unsigned __int32> bUseBPPreventFlight() { return { this, "APrimalBuff.bUseBPPreventFlight" }; }
BitFieldValue<bool, unsigned __int32> bRequireController() { return { this, "APrimalBuff.bRequireController" }; }
BitFieldValue<bool, unsigned __int32> bDontPlayInstigatorActiveSoundOnDino() { return { this, "APrimalBuff.bDontPlayInstigatorActiveSoundOnDino" }; }
BitFieldValue<bool, unsigned __int32> bAddExtendBuffTime() { return { this, "APrimalBuff.bAddExtendBuffTime" }; }
BitFieldValue<bool, unsigned __int32> bUseTickingDeactivation() { return { this, "APrimalBuff.bUseTickingDeactivation" }; }
BitFieldValue<bool, unsigned __int32> bCheckPreventInput() { return { this, "APrimalBuff.bCheckPreventInput" }; }
BitFieldValue<bool, unsigned __int32> bBPDrawBuffStatusHUD() { return { this, "APrimalBuff.bBPDrawBuffStatusHUD" }; }
BitFieldValue<bool, unsigned __int32> bEnableStaticPathing() { return { this, "APrimalBuff.bEnableStaticPathing" }; }
BitFieldValue<bool, unsigned __int32> bHUDFormatTimerAsTimecode() { return { this, "APrimalBuff.bHUDFormatTimerAsTimecode" }; }
BitFieldValue<bool, unsigned __int32> bUseBPPreventThrowingItem() { return { this, "APrimalBuff.bUseBPPreventThrowingItem" }; }
BitFieldValue<bool, unsigned __int32> bPreventInputDoesOffset() { return { this, "APrimalBuff.bPreventInputDoesOffset" }; }
BitFieldValue<bool, unsigned __int32> bNotifyExperienceGained() { return { this, "APrimalBuff.bNotifyExperienceGained" }; }
BitFieldValue<bool, unsigned __int32> bOnlyTickWhenVisible() { return { this, "APrimalBuff.bOnlyTickWhenVisible" }; }
BitFieldValue<bool, unsigned __int32> bBPAdjustStatusValueModification() { return { this, "APrimalBuff.bBPAdjustStatusValueModification" }; }
BitFieldValue<bool, unsigned __int32> bWasDestroyed() { return { this, "APrimalBuff.bWasDestroyed" }; }
BitFieldValue<bool, unsigned __int32> bUseBPNotifyOtherBuffActivated() { return { this, "APrimalBuff.bUseBPNotifyOtherBuffActivated" }; }
BitFieldValue<bool, unsigned __int32> bUseBPNotifyOtherBuffDeactivated() { return { this, "APrimalBuff.bUseBPNotifyOtherBuffDeactivated" }; }
BitFieldValue<bool, unsigned __int32> bUseBPPreventFirstPerson() { return { this, "APrimalBuff.bUseBPPreventFirstPerson" }; }
BitFieldValue<bool, unsigned __int32> bForceAddUnderwaterCharacterStatusValues() { return { this, "APrimalBuff.bForceAddUnderwaterCharacterStatusValues" }; }
// Functions
bool TemplateAllowActorSpawn(UWorld* World, FVector* AtLocation, FRotator* AtRotation, FActorSpawnParameters* SpawnParameters) { return NativeCall<bool, UWorld*, FVector*, FRotator*, FActorSpawnParameters*>(this, "APrimalBuff.TemplateAllowActorSpawn", World, AtLocation, AtRotation, SpawnParameters); }
void Deactivate() { NativeCall<void>(this, "APrimalBuff.Deactivate"); }
void NetDeactivate_Implementation() { NativeCall<void>(this, "APrimalBuff.NetDeactivate_Implementation"); }
void BeginPlay() { NativeCall<void>(this, "APrimalBuff.BeginPlay"); }
void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>* OutLifetimeProps) { NativeCall<void, TArray<FLifetimeProperty>*>(this, "APrimalBuff.GetLifetimeReplicatedProps", OutLifetimeProps); }
void AddDamageStatusValueModifier(APrimalCharacter* addToCharacter, EPrimalCharacterStatusValue::Type ValueType, bool bSpeedToAddInSeconds, bool bContinueOnUnchangedValue, bool bResetExistingModifierDescriptionIndex, bool bSetValue, bool bSetAdditionalValue, float LimitExistingModifierDescriptionToMaxAmount, float damageMultiplierAmountToAdd, float speedToAdd, int StatusValueModifierDescriptionIndex, bool bUsePercentualDamage, bool bMakeUntameable, float percentualDamage, TSubclassOf<UDamageType> ScaleValueByCharacterDamageType) { NativeCall<void, APrimalCharacter*, EPrimalCharacterStatusValue::Type, bool, bool, bool, bool, bool, float, float, float, int, bool, bool, float, TSubclassOf<UDamageType>>(this, "APrimalBuff.AddDamageStatusValueModifier", addToCharacter, ValueType, bSpeedToAddInSeconds, bContinueOnUnchangedValue, bResetExistingModifierDescriptionIndex, bSetValue, bSetAdditionalValue, LimitExistingModifierDescriptionToMaxAmount, damageMultiplierAmountToAdd, speedToAdd, StatusValueModifierDescriptionIndex, bUsePercentualDamage, bMakeUntameable, percentualDamage, ScaleValueByCharacterDamageType); }
void SetupForInstigator() { NativeCall<void>(this, "APrimalBuff.SetupForInstigator"); }
void Tick(float DeltaSeconds) { NativeCall<void, float>(this, "APrimalBuff.Tick", DeltaSeconds); }
void ProcessStaticPathing(bool triggerRunning) { NativeCall<void, bool>(this, "APrimalBuff.ProcessStaticPathing", triggerRunning); }
FVector* UpdateStaticPathingDestination(FVector* result, FVector locOverride, float randomOffsetMultiplier, bool useRandomNegativeXDir, bool orientRandOffsetByRotation, FRotator randOffsetByRotation, float GroundCheckSpreadOverride) { return NativeCall<FVector*, FVector*, FVector, float, bool, bool, FRotator, float>(this, "APrimalBuff.UpdateStaticPathingDestination", result, locOverride, randomOffsetMultiplier, useRandomNegativeXDir, orientRandOffsetByRotation, randOffsetByRotation, GroundCheckSpreadOverride); }
void EnableTickFunction() { NativeCall<void>(this, "APrimalBuff.EnableTickFunction"); }
bool AOEBuffCanAffect(APrimalCharacter* forChar) { return NativeCall<bool, APrimalCharacter*>(this, "APrimalBuff.AOEBuffCanAffect", forChar); }
void InstigatorJumped() { NativeCall<void>(this, "APrimalBuff.InstigatorJumped"); }
void Destroyed() { NativeCall<void>(this, "APrimalBuff.Destroyed"); }
void NetResetBuffStart_Implementation() { NativeCall<void>(this, "APrimalBuff.NetResetBuffStart_Implementation"); }
bool ResetBuffStart() { return NativeCall<bool>(this, "APrimalBuff.ResetBuffStart"); }
APrimalBuff* AddBuff(APrimalCharacter* ForCharacter, AActor* DamageCauser) { return NativeCall<APrimalBuff*, APrimalCharacter*, AActor*>(this, "APrimalBuff.AddBuff", ForCharacter, DamageCauser); }
static APrimalBuff* StaticAddBuff(TSubclassOf<APrimalBuff> BuffClass, APrimalCharacter* ForCharacter, UPrimalItem* AssociatedItem, AActor* DamageCauser, bool bForceOnClient) { return NativeCall<APrimalBuff*, TSubclassOf<APrimalBuff>, APrimalCharacter*, UPrimalItem*, AActor*, bool>(nullptr, "APrimalBuff.StaticAddBuff", BuffClass, ForCharacter, AssociatedItem, DamageCauser, bForceOnClient); }
bool ExcludePostProcessBlendableMaterial(UMaterialInterface* BlendableMaterialInterface) { return NativeCall<bool, UMaterialInterface*>(this, "APrimalBuff.ExcludePostProcessBlendableMaterial", BlendableMaterialInterface); }
bool PreventActorTargeting_Implementation(AActor* ByActor) { return NativeCall<bool, AActor*>(this, "APrimalBuff.PreventActorTargeting_Implementation", ByActor); }
bool PreventRunning() { return NativeCall<bool>(this, "APrimalBuff.PreventRunning"); }
bool ExcludeAoEActor(AActor* ActorToConsider) { return NativeCall<bool, AActor*>(this, "APrimalBuff.ExcludeAoEActor", ActorToConsider); }
bool HideBuffFromHUD_Implementation() { return NativeCall<bool>(this, "APrimalBuff.HideBuffFromHUD_Implementation"); }
void Stasis() { NativeCall<void>(this, "APrimalBuff.Stasis"); }
void Unstasis() { NativeCall<void>(this, "APrimalBuff.Unstasis"); }
bool ExtendBuffTime(float AmountOfAdditionalTime) { return NativeCall<bool, float>(this, "APrimalBuff.ExtendBuffTime", AmountOfAdditionalTime); }
int GetBuffType_Implementation() { return NativeCall<int>(this, "APrimalBuff.GetBuffType_Implementation"); }
bool ReduceBuffTime(float AmountOfTimeToReduce) { return NativeCall<bool, float>(this, "APrimalBuff.ReduceBuffTime", AmountOfTimeToReduce); }
static UClass* StaticClass() { return NativeCall<UClass*>(nullptr, "APrimalBuff.StaticClass"); }
static void StaticRegisterNativesAPrimalBuff() { NativeCall<void>(nullptr, "APrimalBuff.StaticRegisterNativesAPrimalBuff"); }
void BPDrawBuffStatusHUD(AShooterHUD* HUD, float XPos, float YPos, float ScaleMult) { NativeCall<void, AShooterHUD*, float, float, float>(this, "APrimalBuff.BPDrawBuffStatusHUD", HUD, XPos, YPos, ScaleMult); }
float BuffAdjustDamage(float Damage, FHitResult* HitInfo, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<UDamageType> TheDamgeType) { return NativeCall<float, float, FHitResult*, AController*, AActor*, TSubclassOf<UDamageType>>(this, "APrimalBuff.BuffAdjustDamage", Damage, HitInfo, EventInstigator, DamageCauser, TheDamgeType); }
void BuffPostAdjustDamage(float Damage, FHitResult* HitInfo, AController* EventInstigator, AActor* DamageCauser, TSubclassOf<UDamageType> TheDamgeType) { NativeCall<void, float, FHitResult*, AController*, AActor*, TSubclassOf<UDamageType>>(this, "APrimalBuff.BuffPostAdjustDamage", Damage, HitInfo, EventInstigator, DamageCauser, TheDamgeType); }
void BuffTickClient(float DeltaTime) { NativeCall<void, float>(this, "APrimalBuff.BuffTickClient", DeltaTime); }
void BuffTickServer(float DeltaTime) { NativeCall<void, float>(this, "APrimalBuff.BuffTickServer", DeltaTime); }
void DrawBuffFloatingHUD(int BuffIndex, AShooterHUD* HUD, float CenterX, float CenterY, float DrawScale) { NativeCall<void, int, AShooterHUD*, float, float, float>(this, "APrimalBuff.DrawBuffFloatingHUD", BuffIndex, HUD, CenterX, CenterY, DrawScale); }
void NotifyDamage(float DamageAmount, TSubclassOf<UDamageType> DamageClass, AController* EventInstigator, AActor* TheDamageCauser) { NativeCall<void, float, TSubclassOf<UDamageType>, AController*, AActor*>(this, "APrimalBuff.NotifyDamage", DamageAmount, DamageClass, EventInstigator, TheDamageCauser); }
bool PreventActorTargeting(AActor* ByActor) { return NativeCall<bool, AActor*>(this, "APrimalBuff.PreventActorTargeting", ByActor); }
void SetBuffCauser(AActor* CausedBy) { NativeCall<void, AActor*>(this, "APrimalBuff.SetBuffCauser", CausedBy); }
};
struct UPrimalEngramEntry : UObject
{
int& RequiredCharacterLevelField() { return *GetNativePointerField<int*>(this, "UPrimalEngramEntry.RequiredCharacterLevel"); }
int& RequiredEngramPointsField() { return *GetNativePointerField<int*>(this, "UPrimalEngramEntry.RequiredEngramPoints"); }
TSubclassOf<UPrimalItem>& BluePrintEntryField() { return *GetNativePointerField<TSubclassOf<UPrimalItem>*>(this, "UPrimalEngramEntry.BluePrintEntry"); }
FString& ExtraEngramDescriptionField() { return *GetNativePointerField<FString*>(this, "UPrimalEngramEntry.ExtraEngramDescription"); }
TArray<FEngramEntries>& EngramRequirementSetsField() { return *GetNativePointerField<TArray<FEngramEntries>*>(this, "UPrimalEngramEntry.EngramRequirementSets"); }
int& MyEngramIndexField() { return *GetNativePointerField<int*>(this, "UPrimalEngramEntry.MyEngramIndex"); }
TEnumAsByte<enum EEngramGroup::Type>& EngramGroupField() { return *GetNativePointerField<TEnumAsByte<enum EEngramGroup::Type>*>(this, "UPrimalEngramEntry.EngramGroup"); }
// Bit fields
BitFieldValue<bool, unsigned __int32> bGiveBlueprintToPlayerInventory() { return { this, "UPrimalEngramEntry.bGiveBlueprintToPlayerInventory" }; }
BitFieldValue<bool, unsigned __int32> bCanBeManuallyUnlocked() { return { this, "UPrimalEngramEntry.bCanBeManuallyUnlocked" }; }
// Functions
UObject* GetObjectW() { return NativeCall<UObject*>(this, "UPrimalEngramEntry.GetObjectW"); }
FString* GetEntryString(FString* result) { return NativeCall<FString*, FString*>(this, "UPrimalEngramEntry.GetEntryString", result); }
UTexture2D* GetEntryIcon(UObject* AssociatedDataObject, bool bIsEnabled) { return NativeCall<UTexture2D*, UObject*, bool>(this, "UPrimalEngramEntry.GetEntryIcon", AssociatedDataObject, bIsEnabled); }
bool MeetsEngramRequirements(AShooterPlayerState* aPlayerState, bool bOnlyCheckLevel, bool bDontCheckEngramPreRequirements) { return NativeCall<bool, AShooterPlayerState*, bool, bool>(this, "UPrimalEngramEntry.MeetsEngramRequirements", aPlayerState, bOnlyCheckLevel, bDontCheckEngramPreRequirements); }
bool MeetsEngramChainRequirements(AShooterPlayerState* aPlayerState) { return NativeCall<bool, AShooterPlayerState*>(this, "UPrimalEngramEntry.MeetsEngramChainRequirements", aPlayerState); }
FString* GetEngramDescription(FString* result, AShooterPlayerState* aPlayerState) { return NativeCall<FString*, FString*, AShooterPlayerState*>(this, "UPrimalEngramEntry.GetEngramDescription", result, aPlayerState); }
FString* GetEngramName(FString* result) { return NativeCall<FString*, FString*>(this, "UPrimalEngramEntry.GetEngramName", result); }
int GetRequiredEngramPoints() { return NativeCall<int>(this, "UPrimalEngramEntry.GetRequiredEngramPoints"); }
int GetRequiredLevel() { return NativeCall<int>(this, "UPrimalEngramEntry.GetRequiredLevel"); }
bool UseEngramRequirementSets() { return NativeCall<bool>(this, "UPrimalEngramEntry.UseEngramRequirementSets"); }
bool IsEngramClassHidden(TSubclassOf<UPrimalItem> ForItemClass) { return NativeCall<bool, TSubclassOf<UPrimalItem>>(this, "UPrimalEngramEntry.IsEngramClassHidden", ForItemClass); }
void GetAllChainedPreReqs(AShooterPlayerState* aPlayerState, TArray<TSubclassOf<UPrimalEngramEntry>>* TestedEntries) { NativeCall<void, AShooterPlayerState*, TArray<TSubclassOf<UPrimalEngramEntry>>*>(this, "UPrimalEngramEntry.GetAllChainedPreReqs", aPlayerState, TestedEntries); }
int GetChainRequiredEngramPoints(TArray<TSubclassOf<UPrimalEngramEntry>>* TestedEntries) { return NativeCall<int, TArray<TSubclassOf<UPrimalEngramEntry>>*>(this, "UPrimalEngramEntry.GetChainRequiredEngramPoints", TestedEntries); }
void ClearHiddenEngramRequirements() { NativeCall<void>(this, "UPrimalEngramEntry.ClearHiddenEngramRequirements"); }
};
struct FDinoAncestorsEntry
{
FString MaleName;
unsigned int MaleDinoID1;
unsigned int MaleDinoID2;
FString FemaleName;
unsigned int FemaleDinoID1;
unsigned int FemaleDinoID2;
};
struct FCraftingResourceRequirement
{
float BaseResourceRequirement;
TSubclassOf<UPrimalItem> ResourceItemType;
bool bCraftingRequireExactResourceType;
};
struct UKismetSystemLibrary
{
// Functions
static FDebugFloatHistory* AddFloatHistorySample(FDebugFloatHistory* result, float Value, FDebugFloatHistory* FloatHistory) { return NativeCall<FDebugFloatHistory*, FDebugFloatHistory*, float, FDebugFloatHistory*>(nullptr, "UKismetSystemLibrary.AddFloatHistorySample", result, Value, FloatHistory); }
static bool BoxOverlapActors_NEW(UObject* WorldContextObject, FVector BoxPos, FVector BoxExtent, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ActorClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<AActor*>* OutActors) { return NativeCall<bool, UObject*, FVector, FVector, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.BoxOverlapActors_NEW", WorldContextObject, BoxPos, BoxExtent, ObjectTypes, ActorClassFilter, ActorsToIgnore, OutActors); }
static bool BoxOverlapComponents_NEW(UObject* WorldContextObject, FVector BoxPos, FVector BoxExtent, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ComponentClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<UPrimitiveComponent*>* OutComponents) { return NativeCall<bool, UObject*, FVector, FVector, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<UPrimitiveComponent*>*>(nullptr, "UKismetSystemLibrary.BoxOverlapComponents_NEW", WorldContextObject, BoxPos, BoxExtent, ObjectTypes, ComponentClassFilter, ActorsToIgnore, OutComponents); }
static bool BoxTraceMulti(UObject* WorldContextObject, FVector Start, FVector End, FVector HalfSize, FRotator Orientation, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, FVector, FRotator, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.BoxTraceMulti", WorldContextObject, Start, End, HalfSize, Orientation, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool BoxTraceMultiForObjects(UObject* WorldContextObject, FVector Start, FVector End, FVector HalfSize, FRotator Orientation, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, FVector, FRotator, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.BoxTraceMultiForObjects", WorldContextObject, Start, End, HalfSize, Orientation, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool BoxTraceSingle(UObject* WorldContextObject, FVector Start, FVector End, FVector HalfSize, FRotator Orientation, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, FVector, FRotator, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.BoxTraceSingle", WorldContextObject, Start, End, HalfSize, Orientation, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool BoxTraceSingleForObjects(UObject* WorldContextObject, FVector Start, FVector End, FVector HalfSize, FRotator Orientation, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, FVector, FRotator, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.BoxTraceSingleForObjects", WorldContextObject, Start, End, HalfSize, Orientation, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool CapsuleOverlapActors_NEW(UObject* WorldContextObject, FVector CapsulePos, float Radius, float HalfHeight, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ActorClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<AActor*>* OutActors) { return NativeCall<bool, UObject*, FVector, float, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.CapsuleOverlapActors_NEW", WorldContextObject, CapsulePos, Radius, HalfHeight, ObjectTypes, ActorClassFilter, ActorsToIgnore, OutActors); }
static bool CapsuleOverlapComponents_NEW(UObject* WorldContextObject, FVector CapsulePos, float Radius, float HalfHeight, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ComponentClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<UPrimitiveComponent*>* OutComponents) { return NativeCall<bool, UObject*, FVector, float, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<UPrimitiveComponent*>*>(nullptr, "UKismetSystemLibrary.CapsuleOverlapComponents_NEW", WorldContextObject, CapsulePos, Radius, HalfHeight, ObjectTypes, ComponentClassFilter, ActorsToIgnore, OutComponents); }
static bool CapsuleTraceMultiForObjects(UObject* WorldContextObject, FVector Start, FVector End, float Radius, float HalfHeight, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.CapsuleTraceMultiForObjects", WorldContextObject, Start, End, Radius, HalfHeight, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool CapsuleTraceMulti_NEW(UObject* WorldContextObject, FVector Start, FVector End, float Radius, float HalfHeight, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, float, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.CapsuleTraceMulti_NEW", WorldContextObject, Start, End, Radius, HalfHeight, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool CapsuleTraceSingleForObjects(UObject* WorldContextObject, FVector Start, FVector End, float Radius, float HalfHeight, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.CapsuleTraceSingleForObjects", WorldContextObject, Start, End, Radius, HalfHeight, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool CapsuleTraceSingle_NEW(UObject* WorldContextObject, FVector Start, FVector End, float Radius, float HalfHeight, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, float, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.CapsuleTraceSingle_NEW", WorldContextObject, Start, End, Radius, HalfHeight, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool ComponentOverlapActors_NEW(UPrimitiveComponent* Component, FTransform* ComponentTransform, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ActorClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<AActor*>* OutActors) { return NativeCall<bool, UPrimitiveComponent*, FTransform*, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.ComponentOverlapActors_NEW", Component, ComponentTransform, ObjectTypes, ActorClassFilter, ActorsToIgnore, OutActors); }
static bool ComponentOverlapComponents_NEW(UPrimitiveComponent* Component, FTransform* ComponentTransform, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ComponentClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<UPrimitiveComponent*>* OutComponents) { return NativeCall<bool, UPrimitiveComponent*, FTransform*, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<UPrimitiveComponent*>*>(nullptr, "UKismetSystemLibrary.ComponentOverlapComponents_NEW", Component, ComponentTransform, ObjectTypes, ComponentClassFilter, ActorsToIgnore, OutComponents); }
static char MakeLiteralByte(char Value) { return NativeCall<char, char>(nullptr, "UKismetSystemLibrary.MakeLiteralByte", Value); }
static void CreateCopyForUndoBuffer(UObject* ObjectToModify) { NativeCall<void, UObject*>(nullptr, "UKismetSystemLibrary.CreateCopyForUndoBuffer", ObjectToModify); }
static void Delay(UObject* WorldContextObject, float Duration, FLatentActionInfo LatentInfo) { NativeCall<void, UObject*, float, FLatentActionInfo>(nullptr, "UKismetSystemLibrary.Delay", WorldContextObject, Duration, LatentInfo); }
static bool DoesImplementInterface(UObject* TestObject, TSubclassOf<UInterface> Interface) { return NativeCall<bool, UObject*, TSubclassOf<UInterface>>(nullptr, "UKismetSystemLibrary.DoesImplementInterface", TestObject, Interface); }
static void DrawDebugArrow(UObject* WorldContextObject, FVector LineStart, FVector LineEnd, float ArrowSize, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FVector, FVector, float, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugArrow", WorldContextObject, LineStart, LineEnd, ArrowSize, Color, LifeTime); }
static void DrawDebugBox(UObject* WorldContextObject, FVector Center, FVector Extent, FLinearColor Color, FRotator Rotation, float LifeTime) { NativeCall<void, UObject*, FVector, FVector, FLinearColor, FRotator, float>(nullptr, "UKismetSystemLibrary.DrawDebugBox", WorldContextObject, Center, Extent, Color, Rotation, LifeTime); }
static void DrawDebugCapsule(UObject* WorldContextObject, FVector Center, float HalfHeight, float Radius, FRotator Rotation, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FVector, float, float, FRotator, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugCapsule", WorldContextObject, Center, HalfHeight, Radius, Rotation, Color, LifeTime); }
static void DrawDebugCone(UObject* WorldContextObject, FVector Origin, FVector Direction, float Length, float AngleWidth, float AngleHeight, int NumSides, FLinearColor Color) { NativeCall<void, UObject*, FVector, FVector, float, float, float, int, FLinearColor>(nullptr, "UKismetSystemLibrary.DrawDebugCone", WorldContextObject, Origin, Direction, Length, AngleWidth, AngleHeight, NumSides, Color); }
static void DrawDebugConeInDegrees(UObject* WorldContextObject, FVector Origin, FVector Direction, float Length, float AngleWidth, float AngleHeight, int NumSides, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FVector, FVector, float, float, float, int, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugConeInDegrees", WorldContextObject, Origin, Direction, Length, AngleWidth, AngleHeight, NumSides, Color, LifeTime); }
static void DrawDebugCoordinateSystem(UObject* WorldContextObject, FVector AxisLoc, FRotator AxisRot, float Scale, float LifeTime) { NativeCall<void, UObject*, FVector, FRotator, float, float>(nullptr, "UKismetSystemLibrary.DrawDebugCoordinateSystem", WorldContextObject, AxisLoc, AxisRot, Scale, LifeTime); }
static void DrawDebugCylinder(UObject* WorldContextObject, FVector Start, FVector End, float Radius, int Segments, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FVector, FVector, float, int, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugCylinder", WorldContextObject, Start, End, Radius, Segments, Color, LifeTime); }
static void DrawDebugFloatHistoryLocation(UObject* WorldContextObject, FDebugFloatHistory* FloatHistory, FVector DrawLocation, FVector2D DrawSize, FLinearColor DrawColor, float LifeTime) { NativeCall<void, UObject*, FDebugFloatHistory*, FVector, FVector2D, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugFloatHistoryLocation", WorldContextObject, FloatHistory, DrawLocation, DrawSize, DrawColor, LifeTime); }
static void DrawDebugFloatHistoryTransform(UObject* WorldContextObject, FDebugFloatHistory* FloatHistory, FTransform* DrawTransform, FVector2D DrawSize, FLinearColor DrawColor, float LifeTime) { NativeCall<void, UObject*, FDebugFloatHistory*, FTransform*, FVector2D, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugFloatHistoryTransform", WorldContextObject, FloatHistory, DrawTransform, DrawSize, DrawColor, LifeTime); }
static void DrawDebugFrustum(UObject* WorldContextObject, FTransform* FrustumTransform, FLinearColor FrustumColor, float Duration) { NativeCall<void, UObject*, FTransform*, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugFrustum", WorldContextObject, FrustumTransform, FrustumColor, Duration); }
static void DrawDebugLine(UObject* WorldContextObject, FVector LineStart, FVector LineEnd, FLinearColor Color, float LifeTime, float Thickness) { NativeCall<void, UObject*, FVector, FVector, FLinearColor, float, float>(nullptr, "UKismetSystemLibrary.DrawDebugLine", WorldContextObject, LineStart, LineEnd, Color, LifeTime, Thickness); }
static void DrawDebugLineTraceHitResult(UObject* WorldContextObject, FHitResult* Hit, FVector* TraceStart, FVector* TraceEnd, FLinearColor StartColor, FLinearColor HitColor, float LineThickness, float HitSize, bool bDrawHitNormal, FLinearColor HitNormalColor, float HitNormalLength, float Duration) { NativeCall<void, UObject*, FHitResult*, FVector*, FVector*, FLinearColor, FLinearColor, float, float, bool, FLinearColor, float, float>(nullptr, "UKismetSystemLibrary.DrawDebugLineTraceHitResult", WorldContextObject, Hit, TraceStart, TraceEnd, StartColor, HitColor, LineThickness, HitSize, bDrawHitNormal, HitNormalColor, HitNormalLength, Duration); }
static void DrawDebugPlane(UObject* WorldContextObject, FPlane* P, FVector Loc, float Size, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FPlane*, FVector, float, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugPlane", WorldContextObject, P, Loc, Size, Color, LifeTime); }
static void DrawDebugPoint(UObject* WorldContextObject, FVector Position, float Size, FLinearColor PointColor, float LifeTime) { NativeCall<void, UObject*, FVector, float, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugPoint", WorldContextObject, Position, Size, PointColor, LifeTime); }
static void DrawDebugSphere(UObject* WorldContextObject, FVector Center, float Radius, int Segments, FLinearColor Color, float LifeTime) { NativeCall<void, UObject*, FVector, float, int, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugSphere", WorldContextObject, Center, Radius, Segments, Color, LifeTime); }
static void DrawDebugString(UObject* WorldContextObject, FVector TextLocation, FString* Text, AActor* TestBaseActor, FLinearColor TextColor, float Duration) { NativeCall<void, UObject*, FVector, FString*, AActor*, FLinearColor, float>(nullptr, "UKismetSystemLibrary.DrawDebugString", WorldContextObject, TextLocation, Text, TestBaseActor, TextColor, Duration); }
static void ExecuteConsoleCommand(UObject* WorldContextObject, FString* Command, APlayerController* Player) { NativeCall<void, UObject*, FString*, APlayerController*>(nullptr, "UKismetSystemLibrary.ExecuteConsoleCommand", WorldContextObject, Command, Player); }
static void FlushDebugStrings(UObject* WorldContextObject) { NativeCall<void, UObject*>(nullptr, "UKismetSystemLibrary.FlushDebugStrings", WorldContextObject); }
static void FlushPersistentDebugLines(UObject* WorldContextObject) { NativeCall<void, UObject*>(nullptr, "UKismetSystemLibrary.FlushPersistentDebugLines", WorldContextObject); }
static void Generic_SetStructurePropertyByName(UObject* OwnerObject, FName StructPropertyName, const void* SrcStructAddr) { NativeCall<void, UObject*, FName, const void*>(nullptr, "UKismetSystemLibrary.Generic_SetStructurePropertyByName", OwnerObject, StructPropertyName, SrcStructAddr); }
static void GetActorBounds(AActor* Actor, FVector* Origin, FVector* BoxExtent) { NativeCall<void, AActor*, FVector*, FVector*>(nullptr, "UKismetSystemLibrary.GetActorBounds", Actor, Origin, BoxExtent); }
static void GetActorListFromComponentList(TArray<UPrimitiveComponent*>* ComponentList, UClass* ActorClassFilter, TArray<AActor*>* OutActorList) { NativeCall<void, TArray<UPrimitiveComponent*>*, UClass*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.GetActorListFromComponentList", ComponentList, ActorClassFilter, OutActorList); }
static void GetComponentBounds(USceneComponent* Component, FVector* Origin, FVector* BoxExtent, float* SphereRadius) { NativeCall<void, USceneComponent*, FVector*, FVector*, float*>(nullptr, "UKismetSystemLibrary.GetComponentBounds", Component, Origin, BoxExtent, SphereRadius); }
static FString* GetDisplayName(FString* result, UObject* Object) { return NativeCall<FString*, FString*, UObject*>(nullptr, "UKismetSystemLibrary.GetDisplayName", result, Object); }
static FString* GetEngineVersion(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UKismetSystemLibrary.GetEngineVersion", result); }
static FString* GetGameName(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UKismetSystemLibrary.GetGameName", result); }
static long double GetGameTimeInSeconds(UObject* WorldContextObject) { return NativeCall<long double, UObject*>(nullptr, "UKismetSystemLibrary.GetGameTimeInSeconds", WorldContextObject); }
static FString* GetPlatformUserName(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UKismetSystemLibrary.GetPlatformUserName", result); }
static int GetRenderingDetailMode() { return NativeCall<int>(nullptr, "UKismetSystemLibrary.GetRenderingDetailMode"); }
static int GetRenderingMaterialQualityLevel() { return NativeCall<int>(nullptr, "UKismetSystemLibrary.GetRenderingMaterialQualityLevel"); }
static FString* GetUniqueDeviceId(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UKismetSystemLibrary.GetUniqueDeviceId", result); }
static bool IsClient(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsClient", WorldContextObject); }
static bool IsDedicatedServer(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsDedicatedServer", WorldContextObject); }
static bool IsListenServer(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsListenServer", WorldContextObject); }
static bool IsServer(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsServer", WorldContextObject); }
static bool IsStandalone(UObject* WorldContextObject) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsStandalone", WorldContextObject); }
static bool IsValid(UObject* Object) { return NativeCall<bool, UObject*>(nullptr, "UKismetSystemLibrary.IsValid", Object); }
static void K2_ClearTimer(UObject* Object, FString FunctionName) { NativeCall<void, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_ClearTimer", Object, FunctionName); }
static float K2_GetTimerElapsedTime(UObject* Object, FString FunctionName) { return NativeCall<float, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_GetTimerElapsedTime", Object, FunctionName); }
static float K2_GetTimerRemainingTime(UObject* Object, FString FunctionName) { return NativeCall<float, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_GetTimerRemainingTime", Object, FunctionName); }
static bool K2_IsTimerActive(UObject* Object, FString FunctionName) { return NativeCall<bool, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_IsTimerActive", Object, FunctionName); }
static bool K2_IsTimerPaused(UObject* Object, FString FunctionName) { return NativeCall<bool, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_IsTimerPaused", Object, FunctionName); }
static void K2_PauseTimer(UObject* Object, FString FunctionName) { NativeCall<void, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_PauseTimer", Object, FunctionName); }
static void K2_SetTimer(UObject* Object, FString FunctionName, float Time, bool bLooping) { NativeCall<void, UObject*, FString, float, bool>(nullptr, "UKismetSystemLibrary.K2_SetTimer", Object, FunctionName, Time, bLooping); }
static void K2_SetTimerDelegate(FBlueprintTimerDynamicDelegate Delegate, float Time, bool bLooping) { NativeCall<void, FBlueprintTimerDynamicDelegate, float, bool>(nullptr, "UKismetSystemLibrary.K2_SetTimerDelegate", Delegate, Time, bLooping); }
static void K2_SetTimerForNextTick(UObject* Object, FString FunctionName, bool bLooping) { NativeCall<void, UObject*, FString, bool>(nullptr, "UKismetSystemLibrary.K2_SetTimerForNextTick", Object, FunctionName, bLooping); }
static void K2_SetTimerForNextTickDelegate(FBlueprintTimerDynamicDelegate Delegate, bool bLooping) { NativeCall<void, FBlueprintTimerDynamicDelegate, bool>(nullptr, "UKismetSystemLibrary.K2_SetTimerForNextTickDelegate", Delegate, bLooping); }
static bool K2_TimerExists(UObject* Object, FString FunctionName) { return NativeCall<bool, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_TimerExists", Object, FunctionName); }
static void K2_UnPauseTimer(UObject* Object, FString FunctionName) { NativeCall<void, UObject*, FString>(nullptr, "UKismetSystemLibrary.K2_UnPauseTimer", Object, FunctionName); }
static void LaunchURL(FString* URL) { NativeCall<void, FString*>(nullptr, "UKismetSystemLibrary.LaunchURL", URL); }
static bool LineTraceMultiForObjects(UObject* WorldContextObject, FVector Start, FVector End, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.LineTraceMultiForObjects", WorldContextObject, Start, End, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool LineTraceMulti_NEW(UObject* WorldContextObject, FVector Start, FVector End, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.LineTraceMulti_NEW", WorldContextObject, Start, End, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool LineTraceSingleForObjects(UObject* WorldContextObject, FVector Start, FVector End, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.LineTraceSingleForObjects", WorldContextObject, Start, End, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool LineTraceSingle_NEW(UObject* WorldContextObject, FVector Start, FVector End, ECollisionChannel TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, ECollisionChannel, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.LineTraceSingle_NEW", WorldContextObject, Start, End, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static FName* MakeLiteralName(FName* result, FName Value) { return NativeCall<FName*, FName*, FName>(nullptr, "UKismetSystemLibrary.MakeLiteralName", result, Value); }
void MakeLiteralString(TArray<wchar_t>* Other) { NativeCall<void, TArray<wchar_t>*>(this, "UKismetSystemLibrary.MakeLiteralString", Other); }
static FText* MakeLiteralText(FText* result, FText Value) { return NativeCall<FText*, FText*, FText>(nullptr, "UKismetSystemLibrary.MakeLiteralText", result, Value); }
static void RetriggerableDelay(UObject* WorldContextObject, float Duration, FLatentActionInfo LatentInfo) { NativeCall<void, UObject*, float, FLatentActionInfo>(nullptr, "UKismetSystemLibrary.RetriggerableDelay", WorldContextObject, Duration, LatentInfo); }
static void SetBoolPropertyByName(UObject* Object, FName PropertyName, bool Value) { NativeCall<void, UObject*, FName, bool>(nullptr, "UKismetSystemLibrary.SetBoolPropertyByName", Object, PropertyName, Value); }
static void SetBytePropertyByName(UObject* Object, FName PropertyName, char Value) { NativeCall<void, UObject*, FName, char>(nullptr, "UKismetSystemLibrary.SetBytePropertyByName", Object, PropertyName, Value); }
static void SetClassPropertyByName(UObject* Object, FName PropertyName, TSubclassOf<UObject> Value) { NativeCall<void, UObject*, FName, TSubclassOf<UObject>>(nullptr, "UKismetSystemLibrary.SetClassPropertyByName", Object, PropertyName, Value); }
static void SetDoublePropertyByName(UObject* Object, FName PropertyName, long double Value) { NativeCall<void, UObject*, FName, long double>(nullptr, "UKismetSystemLibrary.SetDoublePropertyByName", Object, PropertyName, Value); }
static void SetFloatPropertyByName(UObject* Object, FName PropertyName, float Value) { NativeCall<void, UObject*, FName, float>(nullptr, "UKismetSystemLibrary.SetFloatPropertyByName", Object, PropertyName, Value); }
static void SetIntPropertyByName(UObject* Object, FName PropertyName, int Value) { NativeCall<void, UObject*, FName, int>(nullptr, "UKismetSystemLibrary.SetIntPropertyByName", Object, PropertyName, Value); }
static void SetLinearColorPropertyByName(UObject* Object, FName PropertyName, FLinearColor* Value) { NativeCall<void, UObject*, FName, FLinearColor*>(nullptr, "UKismetSystemLibrary.SetLinearColorPropertyByName", Object, PropertyName, Value); }
static void SetNamePropertyByName(UObject* Object, FName PropertyName, FName* Value) { NativeCall<void, UObject*, FName, FName*>(nullptr, "UKismetSystemLibrary.SetNamePropertyByName", Object, PropertyName, Value); }
static void SetObjectPropertyByName(UObject* Object, FName PropertyName, UObject* Value) { NativeCall<void, UObject*, FName, UObject*>(nullptr, "UKismetSystemLibrary.SetObjectPropertyByName", Object, PropertyName, Value); }
static void SetRotatorPropertyByName(UObject* Object, FName PropertyName, FRotator* Value) { NativeCall<void, UObject*, FName, FRotator*>(nullptr, "UKismetSystemLibrary.SetRotatorPropertyByName", Object, PropertyName, Value); }
static void SetStringPropertyByName(UObject* Object, FName PropertyName, FString* Value) { NativeCall<void, UObject*, FName, FString*>(nullptr, "UKismetSystemLibrary.SetStringPropertyByName", Object, PropertyName, Value); }
static void SetSupressViewportTransitionMessage(UObject* WorldContextObject, bool bState) { NativeCall<void, UObject*, bool>(nullptr, "UKismetSystemLibrary.SetSupressViewportTransitionMessage", WorldContextObject, bState); }
static void SetTextPropertyByName(UObject* Object, FName PropertyName, FText* Value) { NativeCall<void, UObject*, FName, FText*>(nullptr, "UKismetSystemLibrary.SetTextPropertyByName", Object, PropertyName, Value); }
static void SetTransformPropertyByName(UObject* Object, FName PropertyName, FTransform* Value) { NativeCall<void, UObject*, FName, FTransform*>(nullptr, "UKismetSystemLibrary.SetTransformPropertyByName", Object, PropertyName, Value); }
static void SetVectorPropertyByName(UObject* Object, FName PropertyName, FVector* Value) { NativeCall<void, UObject*, FName, FVector*>(nullptr, "UKismetSystemLibrary.SetVectorPropertyByName", Object, PropertyName, Value); }
static void ShowAdBanner(bool bShowOnBottomOfScreen) { NativeCall<void, bool>(nullptr, "UKismetSystemLibrary.ShowAdBanner", bShowOnBottomOfScreen); }
static void ShowPlatformSpecificAchievementsScreen(APlayerController* SpecificPlayer) { NativeCall<void, APlayerController*>(nullptr, "UKismetSystemLibrary.ShowPlatformSpecificAchievementsScreen", SpecificPlayer); }
static void ShowPlatformSpecificLeaderboardScreen(FString* CategoryName) { NativeCall<void, FString*>(nullptr, "UKismetSystemLibrary.ShowPlatformSpecificLeaderboardScreen", CategoryName); }
static bool SphereOverlapActorsSimple(UObject* WorldContextObject, FVector SpherePos, float SphereRadius, TEnumAsByte<enum EObjectTypeQuery> ObjectType, UClass* ActorClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<AActor*>* OutActors) { return NativeCall<bool, UObject*, FVector, float, TEnumAsByte<enum EObjectTypeQuery>, UClass*, TArray<AActor*>*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.SphereOverlapActorsSimple", WorldContextObject, SpherePos, SphereRadius, ObjectType, ActorClassFilter, ActorsToIgnore, OutActors); }
static bool SphereOverlapActors_NEW(UObject* WorldContextObject, FVector SpherePos, float SphereRadius, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ActorClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<AActor*>* OutActors) { return NativeCall<bool, UObject*, FVector, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<AActor*>*>(nullptr, "UKismetSystemLibrary.SphereOverlapActors_NEW", WorldContextObject, SpherePos, SphereRadius, ObjectTypes, ActorClassFilter, ActorsToIgnore, OutActors); }
static bool SphereOverlapComponents_NEW(UObject* WorldContextObject, FVector SpherePos, float SphereRadius, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, UClass* ComponentClassFilter, TArray<AActor*>* ActorsToIgnore, TArray<UPrimitiveComponent*>* OutComponents) { return NativeCall<bool, UObject*, FVector, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, UClass*, TArray<AActor*>*, TArray<UPrimitiveComponent*>*>(nullptr, "UKismetSystemLibrary.SphereOverlapComponents_NEW", WorldContextObject, SpherePos, SphereRadius, ObjectTypes, ComponentClassFilter, ActorsToIgnore, OutComponents); }
static bool SphereTraceMultiForObjects(UObject* WorldContextObject, FVector Start, FVector End, float Radius, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.SphereTraceMultiForObjects", WorldContextObject, Start, End, Radius, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool SphereTraceMulti_NEW(UObject* WorldContextObject, FVector Start, FVector End, float Radius, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, TArray<FHitResult>* OutHits, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, TArray<FHitResult>*, bool>(nullptr, "UKismetSystemLibrary.SphereTraceMulti_NEW", WorldContextObject, Start, End, Radius, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHits, bIgnoreSelf); }
static bool SphereTraceSingleForObjects(UObject* WorldContextObject, FVector Start, FVector End, float Radius, TArray<TEnumAsByte<enum EObjectTypeQuery>>* ObjectTypes, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, TArray<TEnumAsByte<enum EObjectTypeQuery>>*, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.SphereTraceSingleForObjects", WorldContextObject, Start, End, Radius, ObjectTypes, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static bool SphereTraceSingle_NEW(UObject* WorldContextObject, FVector Start, FVector End, float Radius, ETraceTypeQuery TraceChannel, bool bTraceComplex, TArray<AActor*>* ActorsToIgnore, EDrawDebugTrace::Type DrawDebugType, FHitResult* OutHit, bool bIgnoreSelf) { return NativeCall<bool, UObject*, FVector, FVector, float, ETraceTypeQuery, bool, TArray<AActor*>*, EDrawDebugTrace::Type, FHitResult*, bool>(nullptr, "UKismetSystemLibrary.SphereTraceSingle_NEW", WorldContextObject, Start, End, Radius, TraceChannel, bTraceComplex, ActorsToIgnore, DrawDebugType, OutHit, bIgnoreSelf); }
static UClass* GetPrivateStaticClass(const wchar_t* Package) { return NativeCall<UClass*, const wchar_t*>(nullptr, "UKismetSystemLibrary.GetPrivateStaticClass", Package); }
static void StaticRegisterNativesUKismetSystemLibrary() { NativeCall<void>(nullptr, "UKismetSystemLibrary.StaticRegisterNativesUKismetSystemLibrary"); }
static EPrimalCharacterStatusValue::Type MakeLiteralInt(int InInteger) { return NativeCall<EPrimalCharacterStatusValue::Type, int>(nullptr, "UKismetSystemLibrary.MakeLiteralInt", InInteger); }
};
struct FOverlapResult
{
TWeakObjectPtr<AActor> Actor;
TWeakObjectPtr<UPrimitiveComponent> Component;
int ItemIndex;
unsigned __int32 bBlockingHit : 1;
// Functions
AActor* GetActor() { return NativeCall<AActor*>(this, "FOverlapResult.GetActor"); }
static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FOverlapResult.StaticStruct"); }
};
struct UVictoryCore
{
static bool OverlappingActors(UWorld* theWorld, TArray<FOverlapResult>* Overlaps, FVector Origin, float Radius, int CollisionGroups, AActor* InIgnoreActor, FName TraceName, bool bComplexOverlapTest) { return NativeCall<bool, UWorld*, TArray<FOverlapResult>*, FVector, float, int, AActor*, FName, bool>(nullptr, "UVictoryCore.OverlappingActors", theWorld, Overlaps, Origin, Radius, CollisionGroups, InIgnoreActor, TraceName, bComplexOverlapTest); }
static FRotator* RLerp(FRotator* result, FRotator A, FRotator B, float Alpha, bool bShortestPath) { return NativeCall<FRotator*, FRotator*, FRotator, FRotator, float, bool>(nullptr, "UVictoryCore.RLerp", result, A, B, Alpha, bShortestPath); }
static int GetWeightedRandomIndex(TArray<float>* pArray, float ForceRand) { return NativeCall<int, TArray<float>*, float>(nullptr, "UVictoryCore.GetWeightedRandomIndex", pArray, ForceRand); }
static bool OverlappingActorsTrace(UWorld* theWorld, TArray<FOverlapResult>* Overlaps, FVector Origin, float Radius, ECollisionChannel TraceChannel, AActor* InIgnoreActor, FName TraceName, bool bComplexOverlapTest) { return NativeCall<bool, UWorld*, TArray<FOverlapResult>*, FVector, float, ECollisionChannel, AActor*, FName, bool>(nullptr, "UVictoryCore.OverlappingActorsTrace", theWorld, Overlaps, Origin, Radius, TraceChannel, InIgnoreActor, TraceName, bComplexOverlapTest); }
static UPhysicalMaterial* TracePhysMaterial(UWorld* theWorld, FVector StartPos, FVector EndPos, AActor* IgnoreActor) { return NativeCall<UPhysicalMaterial*, UWorld*, FVector, FVector, AActor*>(nullptr, "UVictoryCore.TracePhysMaterial", theWorld, StartPos, EndPos, IgnoreActor); }
static float ClampRotAxis(float BaseAxis, float DesiredAxis, float MaxDiff) { return NativeCall<float, float, float, float>(nullptr, "UVictoryCore.ClampRotAxis", BaseAxis, DesiredAxis, MaxDiff); }
static FVector* ClampLocation(FVector* result, FVector BaseLocation, FVector DesiredLocation, float MaxDiff, bool bTraceClampLocation, UWorld* TraceWorld, FVector* TraceFromLocation) { return NativeCall<FVector*, FVector*, FVector, FVector, float, bool, UWorld*, FVector*>(nullptr, "UVictoryCore.ClampLocation", result, BaseLocation, DesiredLocation, MaxDiff, bTraceClampLocation, TraceWorld, TraceFromLocation); }
static int BPGetWeightedRandomIndex(TArray<float>* pArray, float ForceRand) { return NativeCall<int, TArray<float>*, float>(nullptr, "UVictoryCore.BPGetWeightedRandomIndex", pArray, ForceRand); }
static void MultiTraceProjectSphere(UObject* WorldContextObject, TArray<FHitResult>* OutResults, FVector* Origin, ECollisionChannel TraceChannel, int HorizResolution, int VertResolution, float StartDistance, float EndDistance, float NorthConeSubtractAngle, float SouthConeSubtractAngle, int PctChanceToTrace, int MaxTraceCount, bool bDrawDebugLines, float DebugDrawDuration) { NativeCall<void, UObject*, TArray<FHitResult>*, FVector*, ECollisionChannel, int, int, float, float, float, float, int, int, bool, float>(nullptr, "UVictoryCore.MultiTraceProjectSphere", WorldContextObject, OutResults, Origin, TraceChannel, HorizResolution, VertResolution, StartDistance, EndDistance, NorthConeSubtractAngle, SouthConeSubtractAngle, PctChanceToTrace, MaxTraceCount, bDrawDebugLines, DebugDrawDuration); }
static FRotator* BPRotatorLerp(FRotator* result, FRotator* A, FRotator* B, const float* Alpha) { return NativeCall<FRotator*, FRotator*, FRotator*, FRotator*, const float*>(nullptr, "UVictoryCore.BPRotatorLerp", result, A, B, Alpha); }
static bool BPFastTrace(UWorld* theWorld, FVector TraceEnd, FVector TraceStart, AActor* ActorToIgnore) { return NativeCall<bool, UWorld*, FVector, FVector, AActor*>(nullptr, "UVictoryCore.BPFastTrace", theWorld, TraceEnd, TraceStart, ActorToIgnore); }
static bool VTraceIgnoreFoliage(UWorld* theWorld, FVector* Start, FVector* End, FHitResult* HitOut, AActor* ActorToIgnore, ECollisionChannel Channel, int CollisionGroups, bool bReturnPhysMaterial, bool bTraceComplex, FVector* BoxExtent, FName TraceTag, AActor* OtherActorToIgnore, TArray<AActor*>* OtherActorsToIgnore, FQuat* Rot, AActor* AnotherActorToIgnore, bool bIgnoreFoliage) { return NativeCall<bool, UWorld*, FVector*, FVector*, FHitResult*, AActor*, ECollisionChannel, int, bool, bool, FVector*, FName, AActor*, TArray<AActor*>*, FQuat*, AActor*, bool>(nullptr, "UVictoryCore.VTraceIgnoreFoliage", theWorld, Start, End, HitOut, ActorToIgnore, Channel, CollisionGroups, bReturnPhysMaterial, bTraceComplex, BoxExtent, TraceTag, OtherActorToIgnore, OtherActorsToIgnore, Rot, AnotherActorToIgnore, bIgnoreFoliage); }
static void SetSessionPrefix(FString* InPrefix) { NativeCall<void, FString*>(nullptr, "UVictoryCore.SetSessionPrefix", InPrefix); }
static FColor* GetTeamColor(FColor* result, const int TargetingTeam) { return NativeCall<FColor*, FColor*, const int>(nullptr, "UVictoryCore.GetTeamColor", result, TargetingTeam); }
static FString* FormatAsTime(FString* result, int InTime, bool UseLeadingZero, bool bForceLeadingZeroHour, bool bShowSeconds) { return NativeCall<FString*, FString*, int, bool, bool, bool>(nullptr, "UVictoryCore.FormatAsTime", result, InTime, UseLeadingZero, bForceLeadingZeroHour, bShowSeconds); }
static bool CalculateInterceptPosition(FVector* StartPosition, FVector* StartVelocity, float ProjectileVelocity, FVector* TargetPosition, FVector* TargetVelocity, FVector* InterceptPosition) { return NativeCall<bool, FVector*, FVector*, float, FVector*, FVector*, FVector*>(nullptr, "UVictoryCore.CalculateInterceptPosition", StartPosition, StartVelocity, ProjectileVelocity, TargetPosition, TargetVelocity, InterceptPosition); }
static int GetSecondsIntoDay() { return NativeCall<int>(nullptr, "UVictoryCore.GetSecondsIntoDay"); }
static bool StaticCheckForCommand(FString CommandName) { return NativeCall<bool, FString>(nullptr, "UVictoryCore.StaticCheckForCommand", CommandName); }
static bool GetGroundLocation(UWorld* forWorld, FVector* theGroundLoc, FVector* StartLoc, FVector* OffsetUp, FVector* OffsetDown) { return NativeCall<bool, UWorld*, FVector*, FVector*, FVector*, FVector*>(nullptr, "UVictoryCore.GetGroundLocation", forWorld, theGroundLoc, StartLoc, OffsetUp, OffsetDown); }
static void CallGlobalLevelEvent(UWorld* forWorld, FName EventName) { NativeCall<void, UWorld*, FName>(nullptr, "UVictoryCore.CallGlobalLevelEvent", forWorld, EventName); }
static FVector2D* BPProjectWorldToScreenPosition(FVector2D* result, FVector* WorldLocation, APlayerController* ThePC) { return NativeCall<FVector2D*, FVector2D*, FVector*, APlayerController*>(nullptr, "UVictoryCore.BPProjectWorldToScreenPosition", result, WorldLocation, ThePC); }
static TArray<AActor*>* ServerOctreeOverlapActors(TArray<AActor*>* result, UWorld* theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, bool bForceActorLocationDistanceCheck) { return NativeCall<TArray<AActor*>*, TArray<AActor*>*, UWorld*, FVector, float, EServerOctreeGroup::Type, bool>(nullptr, "UVictoryCore.ServerOctreeOverlapActors", result, theWorld, AtLoc, Radius, OctreeType, bForceActorLocationDistanceCheck); }
static TArray<AActor*>* ServerOctreeOverlapActorsBitMask(TArray<AActor*>* result, UWorld* theWorld, FVector AtLoc, float Radius, int OctreeTypeBitMask, bool bForceActorLocationDistanceCheck) { return NativeCall<TArray<AActor*>*, TArray<AActor*>*, UWorld*, FVector, float, int, bool>(nullptr, "UVictoryCore.ServerOctreeOverlapActorsBitMask", result, theWorld, AtLoc, Radius, OctreeTypeBitMask, bForceActorLocationDistanceCheck); }
static TArray<AActor*>* ServerOctreeOverlapActorsClass(TArray<AActor*>* result, UWorld* theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, TSubclassOf<AActor> ActorClass, bool bForceActorLocationDistanceCheck) { return NativeCall<TArray<AActor*>*, TArray<AActor*>*, UWorld*, FVector, float, EServerOctreeGroup::Type, TSubclassOf<AActor>, bool>(nullptr, "UVictoryCore.ServerOctreeOverlapActorsClass", result, theWorld, AtLoc, Radius, OctreeType, ActorClass, bForceActorLocationDistanceCheck); }
static TArray<AActor*>* ServerOctreeOverlapActorsClassBitMask(TArray<AActor*>* result, UWorld* theWorld, FVector AtLoc, float Radius, int OctreeTypeBitMask, TSubclassOf<AActor> ActorClass, bool bForceActorLocationDistanceCheck) { return NativeCall<TArray<AActor*>*, TArray<AActor*>*, UWorld*, FVector, float, int, TSubclassOf<AActor>, bool>(nullptr, "UVictoryCore.ServerOctreeOverlapActorsClassBitMask", result, theWorld, AtLoc, Radius, OctreeTypeBitMask, ActorClass, bForceActorLocationDistanceCheck); }
static FRotator* BPRTransform(FRotator* result, FRotator* R, FRotator* RBasis) { return NativeCall<FRotator*, FRotator*, FRotator*, FRotator*>(nullptr, "UVictoryCore.BPRTransform", result, R, RBasis); }
static FRotator* BPRTransformInverse(FRotator* result, FRotator* R, FRotator* RBasis) { return NativeCall<FRotator*, FRotator*, FRotator*, FRotator*>(nullptr, "UVictoryCore.BPRTransformInverse", result, R, RBasis); }
static bool FindWorldActors(UWorld* fWorld, TArray<AActor*>* fContainer, TSubclassOf<AActor> fType, FName fTag) { return NativeCall<bool, UWorld*, TArray<AActor*>*, TSubclassOf<AActor>, FName>(nullptr, "UVictoryCore.FindWorldActors", fWorld, fContainer, fType, fTag); }
static TArray<TWeakObjectPtr<APrimalDinoCharacter>>* RemoveInvalidObjectsInContainer(TArray<TWeakObjectPtr<APrimalDinoCharacter>>* result, TArray<TWeakObjectPtr<APrimalDinoCharacter>> fContainer) { return NativeCall<TArray<TWeakObjectPtr<APrimalDinoCharacter>>*, TArray<TWeakObjectPtr<APrimalDinoCharacter>>*, TArray<TWeakObjectPtr<APrimalDinoCharacter>>>(nullptr, "UVictoryCore.RemoveInvalidObjectsInContainer", result, fContainer); }
static void FinishSpawning(AActor* Actor) { NativeCall<void, AActor*>(nullptr, "UVictoryCore.FinishSpawning", Actor); }
static int GetWeightedRandomIndexFromArray(TArray<float> pArray, float ForceRand) { return NativeCall<int, TArray<float>, float>(nullptr, "UVictoryCore.GetWeightedRandomIndexFromArray", pArray, ForceRand); }
static AActor* GetClosestActorArray(FVector ToPoint, TArray<AActor*>* ActorArray) { return NativeCall<AActor*, FVector, TArray<AActor*>*>(nullptr, "UVictoryCore.GetClosestActorArray", ToPoint, ActorArray); }
static bool VTraceSingleBP(UWorld* theWorld, FHitResult* OutHit, FVector* Start, FVector* End, ECollisionChannel TraceChannel, int CollisionGroups, FName TraceTag, bool bTraceComplex, AActor* ActorToIgnore) { return NativeCall<bool, UWorld*, FHitResult*, FVector*, FVector*, ECollisionChannel, int, FName, bool, AActor*>(nullptr, "UVictoryCore.VTraceSingleBP", theWorld, OutHit, Start, End, TraceChannel, CollisionGroups, TraceTag, bTraceComplex, ActorToIgnore); }
static bool VTraceMulti(UWorld* theWorld, TArray<FHitResult>* OutHits, FVector* Start, FVector* End, AActor* InIgnoreActor, int CollisionGroups, float SphereRadius, FVector* BoxExtent, bool bReturnPhysMaterial, ECollisionChannel TraceChannel, bool bTraceComplex, FName TraceTag, bool bTraceChannelForceOverlap, bool bDoSort, AActor* AdditionalIgnoreActor, AActor* AnotherIgnoreActor, bool bJustDoSphereOverlapAtStartLoc, TArray<AActor*>* ExtraIgnoreActors) { return NativeCall<bool, UWorld*, TArray<FHitResult>*, FVector*, FVector*, AActor*, int, float, FVector*, bool, ECollisionChannel, bool, FName, bool, bool, AActor*, AActor*, bool, TArray<AActor*>*>(nullptr, "UVictoryCore.VTraceMulti", theWorld, OutHits, Start, End, InIgnoreActor, CollisionGroups, SphereRadius, BoxExtent, bReturnPhysMaterial, TraceChannel, bTraceComplex, TraceTag, bTraceChannelForceOverlap, bDoSort, AdditionalIgnoreActor, AnotherIgnoreActor, bJustDoSphereOverlapAtStartLoc, ExtraIgnoreActors); }
static bool IsGamePadConnected() { return NativeCall<bool>(nullptr, "UVictoryCore.IsGamePadConnected"); }
static int IsChildOfClasses(TSubclassOf<UObject> childClass, TArray<TSubclassOf<UObject>>* ParentClassesArray) { return NativeCall<int, TSubclassOf<UObject>, TArray<TSubclassOf<UObject>>*>(nullptr, "UVictoryCore.IsChildOfClasses", childClass, ParentClassesArray); }
static FString* GetLastMapPlayed(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UVictoryCore.GetLastMapPlayed", result); }
static void SetLastMapPlayed(FString* NewLastMapPlayed) { NativeCall<void, FString*>(nullptr, "UVictoryCore.SetLastMapPlayed", NewLastMapPlayed); }
static void SetLastHostedMapPlayed(FString* NewLastHostedMapPlayed) { NativeCall<void, FString*>(nullptr, "UVictoryCore.SetLastHostedMapPlayed", NewLastHostedMapPlayed); }
static bool OwnsScorchedEarth() { return NativeCall<bool>(nullptr, "UVictoryCore.OwnsScorchedEarth"); }
static bool OwnsDLC(FString DLCName) { return NativeCall<bool, FString>(nullptr, "UVictoryCore.OwnsDLC", DLCName); }
static bool OwnsSteamAppID(int AppID) { return NativeCall<bool, int>(nullptr, "UVictoryCore.OwnsSteamAppID", AppID); }
static void OpenStorePageForDLC(FString DLCName) { NativeCall<void, FString>(nullptr, "UVictoryCore.OpenStorePageForDLC", DLCName); }
static FVector* LeadTargetPosition(FVector* result, FVector* ProjLocation, float ProjSpeed, FVector* TargetLocation, FVector* TargetVelocity) { return NativeCall<FVector*, FVector*, FVector*, float, FVector*, FVector*>(nullptr, "UVictoryCore.LeadTargetPosition", result, ProjLocation, ProjSpeed, TargetLocation, TargetVelocity); }
static void AddToActorList(UWorld* ForWorld, int ActorListNum, AActor* ActorRef) { NativeCall<void, UWorld*, int, AActor*>(nullptr, "UVictoryCore.AddToActorList", ForWorld, ActorListNum, ActorRef); }
static bool IsWorkshopIDSubscribed(FString* WorkshopID) { return NativeCall<bool, FString*>(nullptr, "UVictoryCore.IsWorkshopIDSubscribed", WorkshopID); }
static FTransform* InverseTransform(FTransform* result, FTransform* TransformIn) { return NativeCall<FTransform*, FTransform*, FTransform*>(nullptr, "UVictoryCore.InverseTransform", result, TransformIn); }
static UClass* BPLoadClass(FString* PathName) { return NativeCall<UClass*, FString*>(nullptr, "UVictoryCore.BPLoadClass", PathName); }
static bool VTraceAgainstActorExpensive(UWorld* theWorld, FVector* Start, FVector* End, FHitResult* HitOut, AActor* ActorToTraceAgainst, ECollisionChannel Channel, int CollisionGroups, float SphereRadius, bool bReturnPhysMaterial, bool bTraceComplex, FVector* BoxExtent, FName TraceTag, bool bSort) { return NativeCall<bool, UWorld*, FVector*, FVector*, FHitResult*, AActor*, ECollisionChannel, int, float, bool, bool, FVector*, FName, bool>(nullptr, "UVictoryCore.VTraceAgainstActorExpensive", theWorld, Start, End, HitOut, ActorToTraceAgainst, Channel, CollisionGroups, SphereRadius, bReturnPhysMaterial, bTraceComplex, BoxExtent, TraceTag, bSort); }
static FString* GetClassString(FString* result, UClass* Class) { return NativeCall<FString*, FString*, UClass*>(nullptr, "UVictoryCore.GetClassString", result, Class); }
static FString* GetClassPathName(FString* result, UObject* ForObject) { return NativeCall<FString*, FString*, UObject*>(nullptr, "UVictoryCore.GetClassPathName", result, ForObject); }
static FString* GetTotalCoversionIdAsString(FString* result) { return NativeCall<FString*, FString*>(nullptr, "UVictoryCore.GetTotalCoversionIdAsString", result); }
static AActor* SpawnActorInWorld(UWorld* ForWorld, TSubclassOf<AActor> AnActorClass, FVector AtLocation, FRotator AtRotation, USceneComponent* attachToComponent, int dataIndex, FName attachSocketName, AActor* OwnerActor, APawn* InstigatorPawn) { return NativeCall<AActor*, UWorld*, TSubclassOf<AActor>, FVector, FRotator, USceneComponent*, int, FName, AActor*, APawn*>(nullptr, "UVictoryCore.SpawnActorInWorld", ForWorld, AnActorClass, AtLocation, AtRotation, attachToComponent, dataIndex, attachSocketName, OwnerActor, InstigatorPawn); }
static bool GetOverlappedHarvestActors(UWorld* ForWorld, FVector* AtLoc, float AtRadius, TArray<AActor*>* OutHarvestActors, TArray<UActorComponent*>* OutHarvestComponents, TArray<FVector>* OutHarvestLocations, TArray<int>* OutHitBodyIndices) { return NativeCall<bool, UWorld*, FVector*, float, TArray<AActor*>*, TArray<UActorComponent*>*, TArray<FVector>*, TArray<int>*>(nullptr, "UVictoryCore.GetOverlappedHarvestActors", ForWorld, AtLoc, AtRadius, OutHarvestActors, OutHarvestComponents, OutHarvestLocations, OutHitBodyIndices); }
static FName* GetHitBoneNameFromDamageEvent(FName* result, APrimalCharacter* Character, AController* HitInstigator, FDamageEvent* DamageEvent, bool bIsPointDamage, FHitResult* PointHitResult, FName MatchCollisionPresetName) { return NativeCall<FName*, FName*, APrimalCharacter*, AController*, FDamageEvent*, bool, FHitResult*, FName>(nullptr, "UVictoryCore.GetHitBoneNameFromDamageEvent", result, Character, HitInstigator, DamageEvent, bIsPointDamage, PointHitResult, MatchCollisionPresetName); }
static FHitResult* MakeHitResult(FHitResult* result, FVector* Location, FVector* Normal, UPhysicalMaterial* PhysMat, AActor* HitActor, UPrimitiveComponent* HitComponent, FName HitBoneName, int HitItem, bool bBlockingHit) { return NativeCall<FHitResult*, FHitResult*, FVector*, FVector*, UPhysicalMaterial*, AActor*, UPrimitiveComponent*, FName, int, bool>(nullptr, "UVictoryCore.MakeHitResult", result, Location, Normal, PhysMat, HitActor, HitComponent, HitBoneName, HitItem, bBlockingHit); }
static float GetAngleBetweenVectors(FVector* VectorA, FVector* VectorB, FVector* AroundAxis) { return NativeCall<float, FVector*, FVector*, FVector*>(nullptr, "UVictoryCore.GetAngleBetweenVectors", VectorA, VectorB, AroundAxis); }
static bool AreRotatorsNearlyEqual(FRotator* RotatorA, FRotator* RotatorB, float WithinError) { return NativeCall<bool, FRotator*, FRotator*, float>(nullptr, "UVictoryCore.AreRotatorsNearlyEqual", RotatorA, RotatorB, WithinError); }
static void SetBoolArrayElemTrue(TArray<bool>* TheArray, int TheIndex) { NativeCall<void, TArray<bool>*, int>(nullptr, "UVictoryCore.SetBoolArrayElemTrue", TheArray, TheIndex); }
static void SetBoolArrayElemFalse(TArray<bool>* TheArray, int TheIndex) { NativeCall<void, TArray<bool>*, int>(nullptr, "UVictoryCore.SetBoolArrayElemFalse", TheArray, TheIndex); }
static void GetIslandCustomDatas(AActor* SomeIslandActor, int* IslandID, TArray<FString>* IslandCustomDatas1, TArray<FString>* IslandCustomDatas2) { NativeCall<void, AActor*, int*, TArray<FString>*, TArray<FString>* >(nullptr, "UVictoryCore.GetIslandCustomDatas", SomeIslandActor, IslandID, IslandCustomDatas1, IslandCustomDatas2); }
};
struct UDamageType : UObject
{
float& ImpulseMinimumZPercentField() { return *GetNativePointerField<float*>(this, "UDamageType.ImpulseMinimumZPercent"); }
float& DestructibleImpulseScaleField() { return *GetNativePointerField<float*>(this, "UDamageType.DestructibleImpulseScale"); }
float& ImpulseRagdollScaleField() { return *GetNativePointerField<float*>(this, "UDamageType.ImpulseRagdollScale"); }
float& DefaultImpulseField() { return *GetNativePointerField<float*>(this, "UDamageType.DefaultImpulse"); }
float& PointDamageArmorEffectivenessField() { return *GetNativePointerField<float*>(this, "UDamageType.PointDamageArmorEffectiveness"); }
float& GeneralDamageArmorEffectivenessField() { return *GetNativePointerField<float*>(this, "UDamageType.GeneralDamageArmorEffectiveness"); }
float& ArmorDurabilityDegradationMultiplierField() { return *GetNativePointerField<float*>(this, "UDamageType.ArmorDurabilityDegradationMultiplier"); }
float& RadialPartiallyObstructedDamagePercentField() { return *GetNativePointerField<float*>(this, "UDamageType.RadialPartiallyObstructedDamagePercent"); }
// Bit fields
BitFieldValue<bool, unsigned __int32> bIsPhysicalDamage() { return { this, "UDamageType.bIsPhysicalDamage" }; }
BitFieldValue<bool, unsigned __int32> bAllowPerBoneDamageAdjustment() { return { this, "UDamageType.bAllowPerBoneDamageAdjustment" }; }
BitFieldValue<bool, unsigned __int32> bCausedByWorld() { return { this, "UDamageType.bCausedByWorld" }; }
BitFieldValue<bool, unsigned __int32> bScaleMomentumByMass() { return { this, "UDamageType.bScaleMomentumByMass" }; }
BitFieldValue<bool, unsigned __int32> bIsPassiveDamage() { return { this, "UDamageType.bIsPassiveDamage" }; }
BitFieldValue<bool, unsigned __int32> bRadialDamageVelChange() { return { this, "UDamageType.bRadialDamageVelChange" }; }
BitFieldValue<bool, unsigned __int32> bImpulseAffectsLivePawns() { return { this, "UDamageType.bImpulseAffectsLivePawns" }; }
// Functions
static UClass* GetPrivateStaticClass(const wchar_t* Package) { return NativeCall<UClass*, const wchar_t*>(nullptr, "UDamageType.GetPrivateStaticClass", Package); }
static void StaticRegisterNativesUDamageType() { NativeCall<void>(nullptr, "UDamageType.StaticRegisterNativesUDamageType"); }
};
struct FDinoAttackInfo
{
FName& AttackNameField() { return *GetNativePointerField<FName*>(this, "FDinoAttackInfo.AttackName"); }
float& AttackWeightField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackWeight"); }
float& AttackRangeField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackRange"); }
float& MinAttackRangeField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.MinAttackRange"); }
float& ActivateAttackRangeField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.ActivateAttackRange"); }
float& AttackIntervalField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackInterval"); }
TArray<int>& ChildStateIndexesField() { return *GetNativePointerField<TArray<int>*>(this, "FDinoAttackInfo.ChildStateIndexes"); }
float& AttackWithJumpChanceField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackWithJumpChance"); }
long double& LastAttackTimeField() { return *GetNativePointerField<long double*>(this, "FDinoAttackInfo.LastAttackTime"); }
long double& RiderLastAttackTimeField() { return *GetNativePointerField<long double*>(this, "FDinoAttackInfo.RiderLastAttackTime"); }
float& AttackSelectionExpirationTimeField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackSelectionExpirationTime"); }
long double& AttackSelectionTimeField() { return *GetNativePointerField<long double*>(this, "FDinoAttackInfo.AttackSelectionTime"); }
float& AttackRotationRangeDegreesField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackRotationRangeDegrees"); }
float& AttackRotationGroundSpeedMultiplierField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackRotationGroundSpeedMultiplier"); }
FRotator& AttackRotationRateField() { return *GetNativePointerField<FRotator*>(this, "FDinoAttackInfo.AttackRotationRate"); }
TArray<FName>& MeleeSwingSocketsField() { return *GetNativePointerField<TArray<FName>*>(this, "FDinoAttackInfo.MeleeSwingSockets"); }
FName& RangedSocketField() { return *GetNativePointerField<FName*>(this, "FDinoAttackInfo.RangedSocket"); }
int& MeleeDamageAmountField() { return *GetNativePointerField<int*>(this, "FDinoAttackInfo.MeleeDamageAmount"); }
float& MeleeDamageImpulseField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.MeleeDamageImpulse"); }
float& MeleeSwingRadiusField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.MeleeSwingRadius"); }
TSubclassOf<UDamageType>& MeleeDamageTypeField() { return *GetNativePointerField<TSubclassOf<UDamageType>*>(this, "FDinoAttackInfo.MeleeDamageType"); }
float& AttackOffsetField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackOffset"); }
float& StaminaCostField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.StaminaCost"); }
float& RiderAttackIntervalField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.RiderAttackInterval"); }
float& DotProductCheckMinField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.DotProductCheckMin"); }
float& DotProductCheckMaxField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.DotProductCheckMax"); }
TArray<UAnimMontage*> AttackAnimationsField() { return *GetNativePointerField<TArray<UAnimMontage*>*>(this, "FDinoAttackInfo.AttackAnimations"); }
TArray<float>& AttackAnimationWeightsField() { return *GetNativePointerField<TArray<float>*>(this, "FDinoAttackInfo.AttackAnimationWeights"); }
TArray<float>& AttackAnimationsTimeFromEndToConsiderFinishedField() { return *GetNativePointerField<TArray<float>*>(this, "FDinoAttackInfo.AttackAnimationsTimeFromEndToConsiderFinished"); }
float& AttackRunningSpeedModifierField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.AttackRunningSpeedModifier"); }
float& SwimmingAttackRunningSpeedModifierField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.SwimmingAttackRunningSpeedModifier"); }
float& SetAttackTargetTimeField() { return *GetNativePointerField<float*>(this, "FDinoAttackInfo.SetAttackTargetTime"); }
TArray<FVector>& LastSocketPositionsField() { return *GetNativePointerField<TArray<FVector>*>(this, "FDinoAttackInfo.LastSocketPositions"); }
long double& LastProjectileSpawnTimeField() { return *GetNativePointerField<long double*>(this, "FDinoAttackInfo.LastProjectileSpawnTime"); }
// Functions
FDinoAttackInfo* operator=(FDinoAttackInfo* __that) { return NativeCall<FDinoAttackInfo*, FDinoAttackInfo*>(this, "FDinoAttackInfo.operator=", __that); }
static UScriptStruct* StaticStruct() { return NativeCall<UScriptStruct*>(nullptr, "FDinoAttackInfo.StaticStruct"); }
}; | 162.592246 | 1,123 | 0.811592 | [
"object"
] |
e26dce2cd92963192cfbac6f65c7a15339dd44a0 | 958 | h | C | Client/MapleStory/CGameObject.h | Maechang/MapleStory | ea18171f273784ec3f5193b3a17c70dac1330ddf | [
"Apache-2.0"
] | 1 | 2020-03-20T09:21:23.000Z | 2020-03-20T09:21:23.000Z | Client/MapleStory/CGameObject.h | Maechang/MapleStory | ea18171f273784ec3f5193b3a17c70dac1330ddf | [
"Apache-2.0"
] | null | null | null | Client/MapleStory/CGameObject.h | Maechang/MapleStory | ea18171f273784ec3f5193b3a17c70dac1330ddf | [
"Apache-2.0"
] | 2 | 2020-03-20T09:21:32.000Z | 2021-09-30T01:58:46.000Z | #pragma once
#include "CComponent.h"
enum ObjectTag
{
Untagged
}Tag;
class CGameObject
{
public:
CGameObject();
~CGameObject();
private:
list<CComponent *> m_listComponent;
bool m_bDestroy;
ObjectTag m_Tag;
public:
template <typename T>
void AddComponent()
{
if (FALSE == std::is_base_of<CComponent, T>::value)
return nullptr;
else if (nullptr != this->GetComponent<T>())
return this->GetComponent<T>();
T * pComponent = new T();
pComponent->m_pObject = this;
pComponent->Transform = this->Transform;
pComponent->Awake();
pComponent->m_bIsEnable = true;
m_listComponent.push_back(pComponent);
return pComponent;
}
template <typename T>
T* GetComponent()
{
if (TRUE == std::is_base_of<CComponent, T>::value)
{
T * pComponent;
for (auto iter : m_listComponent)
{
pComponent = dynamic_cast<T*>(pComponent);
if (pComponent != nullptr)
return pComponent;
}
}
return nullptr;
}
};
| 17.107143 | 53 | 0.672234 | [
"transform"
] |
e2788aa9dfae9d37fc08cea9aaf082fa282620e5 | 17,547 | h | C | frontend/include/backstroke/valueGraph.h | uwplse/stng | ce12c2c079516df873382a5aa3c18c407833d130 | [
"MIT"
] | 14 | 2017-03-07T00:14:33.000Z | 2022-02-09T00:59:22.000Z | projects/backstroke/valueGraph/valueGraph.h | doubleotoo/edg4x-rose | e9744a840a8b48a73cec5e8635ff3c65b6a1344b | [
"BSD-3-Clause"
] | 11 | 2016-11-22T13:14:55.000Z | 2021-12-14T00:56:51.000Z | frontend/include/backstroke/valueGraph.h | uwplse/stng | ce12c2c079516df873382a5aa3c18c407833d130 | [
"MIT"
] | 6 | 2016-11-07T13:38:45.000Z | 2021-04-04T12:13:31.000Z | #ifndef BACKSTROKE_VALUE_GRAPH
#define BACKSTROKE_VALUE_GRAPH
#include "types.h"
#include "valueGraphNode.h"
#include "pathNumGenerator.h"
#include <staticSingleAssignment.h>
#include <boost/function.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
namespace Backstroke
{
typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS,
ValueGraphNode*, ValueGraphEdge*> ValueGraph;
class EventReverser
{
public:
typedef boost::graph_traits<ValueGraph>::vertex_descriptor VGVertex;
typedef boost::graph_traits<ValueGraph>::edge_descriptor VGEdge;
private:
//typedef std::pair<int, PathSet> PathSetWithIndex;
typedef StaticSingleAssignment SSA;
typedef SSA::VarName VarName;
typedef boost::filtered_graph<
ValueGraph,
boost::function<bool(const VGEdge&) >,
boost::function<bool(const VGVertex&) > > SubValueGraph;
typedef BackstrokeCFG::Vertex CFGVertex;
typedef BackstrokeCFG::Edge CFGEdge;
struct ReverseCFGNode
{
ReverseCFGNode() : dagIndex(0) {}
PathInfo paths;
std::vector<VGEdge> edges;
int dagIndex;
};
public:
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS,
ReverseCFGNode, PathInfo> ReverseCFG;
typedef boost::graph_traits<ReverseCFG>::vertex_descriptor RvsCFGVertex;
typedef boost::graph_traits<ReverseCFG>::edge_descriptor RvsCFGEdge;
private:
//! A functor to compare two route graph edges according to their indices from
//! the table passed in.
struct RouteGraphEdgeComp
{
RouteGraphEdgeComp(
const ValueGraph& routeG, int dagIdx, const std::map<SgNode*, int>& nodeIdx)
: routeGraph(routeG), dagIndex(dagIdx), nodeIndexTable(nodeIdx) {}
// For each VG edge, get the according AST node whose order in CFG decides the order of
// this edge in reverse CFG.
SgNode* getAstNode(const VGEdge& edge) const;
int getEdgeValue(const VGEdge& edge) const;
bool operator()(const VGEdge& edge1, const VGEdge& edge2) const;
const ValueGraph& routeGraph;
int dagIndex;
//const std::map<PathSet, int>& pathsIndexTable;
const std::map<SgNode*, int>& nodeIndexTable;
};
private:
//! The event function definition.
SgFunctionDefinition* funcDef_;
//! The forward event function definition.
SgFunctionDefinition* fwdFuncDef_;
//! The reverse event function definition.
SgFunctionDefinition* rvsFuncDef_;
//! The commit event function definition.
SgFunctionDefinition* cmtFuncDef_;
//! The CFG of the event function.
BackstrokeCFG* cfg_;
//! The full CFG of the event function.
Backstroke::FullCFG* fullCfg_;
//! The CDG of the event function.
BackstrokeCDG* cdg_;
//! The SSA form of the function definition.
SSA* ssa_;
//! The value graph object.
ValueGraph valueGraph_;
//! A special node in VG whose in edges are state saving edges.
VGVertex root_;
//! The graph representing the search result, which we call route.
ValueGraph routeGraph_;
//! The root node in routeGraph_ which is the same as in VG.
VGVertex routeGraphRoot_;
//! This object manages the path information of the function.
PathNumManager* pathNumManager_;
//! A map from SgNode to vertex of Value Graph.
std::map<SgNode*, VGVertex> nodeVertexMap_;
//! A map from variable with version to vertex of Value Graph.
std::map<VersionedVariable, VGVertex> varVertexMap_;
//! A map from each phi node to its reaching def object.
//! This map is only for pseudo defs.
std::map<VGVertex, SSA::ReachingDefPtr> pseudoDefMap_;
//! All values which need to be restored (state variables).
//std::vector<VGVertex> valuesToRestore_;
std::vector<std::set<VGVertex> > valuesToRestore_;
//! All available values, including constant and state variables (last version).
//std::set<VGVertex> availableValues_
std::vector<std::set<VGVertex> > availableValues_;
////!
//std::set<VGVertex> varsKilledAtEventEnd_;
//! All state variables.
std::set<SgInitializedName*> stateVariables_;
//! All edges in the VG which are used to reverse values.
std::vector<VGEdge> dagEdges_;
//! A table maps each path to all its nodes and edges in the VG. A path is expressed by
//! a region index and path index.
std::map<std::pair<int, int>,
std::pair<std::set<VGVertex>,
std::set<VGEdge> > > pathNodesAndEdges_;
//! A table maps the route for each path to all its nodes and edges in the VG.
std::map<std::pair<int, int>,
std::pair<std::set<VGVertex>,
std::set<VGEdge> > > routeNodesAndEdges_;
//! A table storing the original expressions and their replacement.
std::map<SgExpression*, SgExpression*> replaceTable_;
////! All backedges in the CFG.
//std::set<CFGEdge> backEdges_;
public:
//! The constructor.
EventReverser(SSA* ssa);
//! The destructor.
~EventReverser();
void reverseEvent(SgFunctionDefinition* funcDef);
//! Build the value graph for the given function.
void buildValueGraph();
//! Generate forward, reverse and commit functions according to the VG.
void generateCode();
//! Generate a dot file describing the value graph.
void valueGraphToDot(const std::string& filename) const;
//! Generate a dot file describing the search result.
void routeGraphToDot(const std::string& filename) const;
// void getPath(const SubValueGraph& g,
// const std::vector<VGVertex>& valuesToRestore);
private:
ValueGraphNode* getSource(const VGEdge& edge) const
{ return valueGraph_[boost::source(edge, valueGraph_)]; }
ValueGraphNode* getTarget(const VGEdge& edge) const
{ return valueGraph_[boost::target(edge, valueGraph_)]; }
//! Build the main part of the value graph.
void buildBasicValueGraph();
//! Process all data members of a class by adding them into state variables set.
void processClassDataMembers(SgClassDefinition* classDef);
// The following functions are used to build the value graph.
void processStatement(SgStatement* stmt);
void processExpression(SgExpression* expr);
void processVariableReference(SgExpression* var);
//! Add the given vertex as an available value.
void addAvailableValue(VGVertex val)
{ availableValues_[0].insert(val); }
//! Returns if a value is available.
bool isAvailableValue(VGVertex val) const
{ return availableValues_[0].find(val) != availableValues_[0].end(); }
//! Collect all available values for all DAGs.
void collectAvailableValues();
//! Build the path number declaration for DAGs.
void buildPathNumDeclForRvsCmtFunc(
const std::string& pathNumName,
SgScopeStatement* rvsScope,
SgScopeStatement* cmtScope);
//! Build the route graph representing search result.
void buildRouteGraph(const std::map<VGEdge, PathInfos>& routes);
//! Remove phi nodes from the route graph to facilitate code generation.
void removePhiNodesFromRouteGraph();
//! After the value graph is built, remove edges which don't help in the search.
void removeUselessEdges();
//! After the value graph is built, remove nodes which don't help in the search.
void removeUselessNodes();
//! Add path information to edges.
void addPathsToEdges();
//! Assign a global unique name for each value node in VG.
void assignNameToNodes();
//! Build the fwd, rvs and cmt functions.
void buildFunctionBodies();
//! Get all functions in place.
void insertFunctions();
//! Remove empty if statements.
void removeEmptyIfStmt(SgNode* node);
/** Given a VG node with a def, returns all VG nodes whose defs kill the given def.
* @param killedNode The value graph node which must contains a value node or phi node.
* @returns The value graph nodes which kill the def in the parameter.
*/
std::set<VGVertex> getKillers(VGVertex killedNode);
// //! Add path information to out edges of phi nodes.
// PathSetWithIndex addPathsForPhiNodes(VGVertex phiNode,
// std::set<VGVertex>& processedPhiNodes);
//! Add state saving edges for those killed by the given var. The second parameter
//! is the AST ndoe which defines the first parameter.
void addStateSavingEdges(const VarName& varName, SgNode* astNode);
//! A temporary function creating a value node which is not created for some reasons.
VGVertex createForgottenValueNode(const VersionedVariable& var);
//! Create a value node from the given AST node. This node must be a use.
VGVertex createValueNode(SgNode* node);
/** Create a value node from the given AST node.
*
* @param lhsNode The AST node which contains a lvalue.
* @param rhsNode The AST node which contains a rvalue.
* @returns The new vertex.
*/
VGVertex createValueNode(SgNode* lhsNode, SgNode* rhsNode);
//! Create an VG node for a functioin call expression. If this function call
//! modifies a value, create a value node for it, and add an edge between the
//! value node and function call node.
VGVertex createFunctionCallNode(SgFunctionCallExp* funcCallExp);
//! Create an VG node for this expression.
VGVertex createThisExpNode(SgThisExp* thisExp);
//! Create an operation node, plus two or three edges.
//! The AST node passed in represents its corresponding AST node.
VGVertex createOperatorNode(
VariantT t, SgNode* astNode,
VGVertex result, VGVertex lhs, VGVertex rhs = nullVertex(),
ValueGraphEdge* edgeToCopy = NULL);
//! Add a reverse edge for every non-ordered edge, and add extra edges for
//! + and - operations.
void addExtraNodesAndEdges();
//! Handle all final defs at the end of the event. This step is needed because
//! we cannot get the phi node if it is not used. New phi node is added to VG,
//! and all available variables are found.
void addAvailableAndTargetValues();
//! Returns if the given edge belongs to the given path.
bool edgeBelongsToPath(const VGEdge& e, int dagIndex, int pathIndex) const;
/** Get the final route in the given subgraph. The route connects each variable
* to store to the root node in the value graph.
* @param dagIndex The DAG index, which represents a region in CFG.
* @param valuesToRestore All variables to restore in the subgraph.
* @returns reversalRoute The search result.
*/
std::map<VGEdge, PathInfo> getReversalRoute(
int dagIndex,
const std::set<VGVertex>& valsToRestore);
/** Get the final route in the given subgraph. The route connects each variable
* to store to the root node in the value graph.
* @param path The path index.
* @param subgraph A subgraph represents a path in the CFG.
* @param valuesToRestore All variables to restore in the subgraph.
* @returns reversalRoute The search result.
*/
std::set<VGEdge> getReversalRoute(int dagIndex, int pathIndex,
const SubValueGraph& subgraph,
const std::set<VGVertex>& valuesToRestore,
const std::set<VGVertex>& availableNodes);
void writeValueGraphNode(std::ostream& out, VGVertex node) const;
void writeValueGraphEdge(std::ostream& out, const VGEdge& edge) const;
/** Add a new vertex to the value graph.
*
* @param newNode A value graph node which will be added.
* @returns The new added vertex.
*/
VGVertex addValueGraphNode(ValueGraphNode* newNode);
/** Add a new edge to the value graph.
*
* @param src The source vertex.
* @param tar The target vertex.
* @param edgeToCopy This edge will be copied to the new edge.
* @returns The new added edge.
*/
VGEdge addValueGraphEdge(VGVertex src, VGVertex tar, ValueGraphEdge* edgeToCopy = NULL);
/** Add a new edge to the value graph.
*
* @param src The source vertex.
* @param tar The target vertex.
* @param paths This path information.
* @returns The new added edge.
*/
VGEdge addValueGraphEdge(VGVertex src, VGVertex tar, const PathInfos& paths);
/** Add a new edge coming from a phi node to the value graph.
*
* @param src The source vertex.
* @param tar The target vertex.
* @param cfgEdges CFG edges from which the path information is calculated.
*/
void addValueGraphPhiEdge(VGVertex src, VGVertex tar,
const BackstrokeCFG::CFGEdgeType& cfgEdge);
/** Add a new ordered edge to the value graph.
*
* @param src The source vertex.
* @param tar The target vertex.
* @param index The index of the edge (for example, for a binary operator,
* 0 means lhs operand, and 1 means rhs operand).
* @returns The new added edge.
*/
VGEdge addValueGraphOrderedEdge(VGVertex src, VGVertex tar, int index);
void addValueGraphStateSavingEdges(VGVertex src, SgNode* killer, bool scopeKiller = false);
/** Add new state saving edges to the value graph. The target is the root.
*
* @param src The source vertex.
* @param pathNum The visible incomplete path number on this edge.
* @returns The new added edges.
*/
//std::vector<VGEdge> addValueGraphStateSavingEdges(VGVertex src);
//! Add a phi node to the value graph.
//VGVertex createPhiNode(VersionedVariable& var);
VGVertex createPhiNode(VersionedVariable& var, SSA::ReachingDefPtr reachingDef);
//! Connect each variable node to the root with cost.
void addStateSavingEdges();
//! Connect all phi nodes to their defs.
void addPhiEdges();
//! Add a state variable.
void addStateVariable(SgInitializedName* name)
{ stateVariables_.insert(name); }
//! Check if a variable is a state variable.
bool isStateVariable(SgInitializedName* name) const
{ return stateVariables_.find(name) != stateVariables_.end(); }
//! Check if a variable is a state variable.
bool isStateVariable(const VarName& name) const
{
if (name.empty()) return false;
return isStateVariable(name[0]);
}
/** Given a SgNode, return its variable name and version.
*
* @param node A SgNode which should be a variable (either a var ref or a declaration).
* @param isUse Inidicate if the variable is a use or a def.
*/
VersionedVariable getVersionedVariable(SgNode* node, bool isUse = true, SgNode* defNode = NULL);
//! For each path, find its corresponding subgraph.
std::set<VGEdge> getRouteFromSubGraph(int dagIndex, int pathIndex);
//! Get all nodes in the topological order in a subgraph.
std::vector<VGVertex> getGraphNodesInTopologicalOrder(
const SubValueGraph& subgraph) const;
//! Get all operands of an operator node.
std::pair<ValueNode*, ValueNode*>
getOperands(VGVertex opNode) const;
//! Generate the reverse function.
void generateReverseFunction(
SgScopeStatement* scope,
const SubValueGraph& route);
//! Build the reverse CFG for the given DAG.
void buildReverseCFG(int dagIndex,
ReverseCFG& rvsCFG);
//! Add a node to reverse CFG. Called by buildReverseCFG().
void addReverseCFGNode(
const PathInfo& paths, const VGEdge* edge, ReverseCFG& rvsCFG,
std::map<PathInfo, RvsCFGVertex>& rvsCFGBasicBlock,
std::map<PathInfo, PathInfo>& parentTable,
std::set<int>& dagAdded);
//! Given a DAG index, return all edges of its reversal in the proper order.
//! This order is decided by topological order from both CFG and route graph.
void getRouteGraphEdgesInProperOrder(int dagIndex, std::vector<VGEdge>& result);
//! Generate code in a basic block of the reverse CFG.
void generateCodeForBasicBlock(
const std::vector<VGEdge>& edges,
SgScopeStatement* rvsScope,
SgScopeStatement* cmtScope);
bool generateCode(
int dagIndex,
const std::vector<ReverseCFG>& rvsCFGs,
SgScopeStatement* rvsFuncBody,
SgScopeStatement* cmtFuncBody,
const std::string& pathNumName);
static VGVertex nullVertex()
{ return boost::graph_traits<ValueGraph>::null_vertex(); }
/**************************************************************************/
// The following functions are for debuging.
void printVarVertexMap()
{
std::map<VersionedVariable, VGVertex>::iterator it, itEnd;
for (it = varVertexMap_.begin(), itEnd = varVertexMap_.end();
it != itEnd; ++it)
{
std::cout << it->first.toString() << "\n";
}
}
std::string edgeToString(const VGEdge& edge)
{
VGVertex src = boost::source(edge, valueGraph_);
VGVertex tgt = boost::target(edge, valueGraph_);
return valueGraph_[src]->toString() + " ==> " +
valueGraph_[tgt]->toString();
}
};
void reverseFunctions(const std::set<SgFunctionDefinition*>& funcDefs);
} // End of namespace Backstroke
#endif // BACKSTROKE_VALUE_GRAPH
| 35.592292 | 97 | 0.673562 | [
"object",
"vector"
] |
12be97afb4c0925af5e74ccfb6b63e850f35fffc | 2,798 | h | C | include/mvo/feature.h | platonev/mono_vo | eba15a06187bd4bb6cea04d26a7a0c5978327926 | [
"MIT"
] | null | null | null | include/mvo/feature.h | platonev/mono_vo | eba15a06187bd4bb6cea04d26a7a0c5978327926 | [
"MIT"
] | null | null | null | include/mvo/feature.h | platonev/mono_vo | eba15a06187bd4bb6cea04d26a7a0c5978327926 | [
"MIT"
] | null | null | null | /*
The MIT License
Copyright (c) 2015 Avi Singh
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.
*/
#ifndef MVO_FEATURE_H
#define MVO_FEATURE_H
#include <opencv2/opencv.hpp>
namespace mvo{
void
featureTracking(cv::Mat img_1, cv::Mat img_2, std::vector<cv::Point2f>& points1, std::vector<cv::Point2f>& points2,
std::vector<uchar>& status){
//this function automatically gets rid of points for which tracking fails
std::vector<float> err;
cv::Size winSize = cv::Size(21, 21);
cv::TermCriteria termcrit = cv::TermCriteria(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 30, 0.01);
calcOpticalFlowPyrLK(img_1, img_2, points1, points2, status, err, winSize, 3, termcrit, 0, 0.001);
//getting rid of points for which the KLT tracking failed or those who have gone outside the frame
int indexCorrection = 0;
for(int i = 0; i < status.size(); i++){
cv::Point2f pt = points2.at(i - indexCorrection);
if((status.at(i) == 0) || (pt.x < 0) || (pt.y < 0)){
if((pt.x < 0) || (pt.y < 0)){
status.at(i) = 0;
}
points1.erase(points1.begin() + (i - indexCorrection));
points2.erase(points2.begin() + (i - indexCorrection));
indexCorrection++;
}
}
}
//uses FAST as of now, modify parameters as necessary
void featureDetection(cv::Mat img_1, std::vector<cv::Point2f>& points1){
std::vector<cv::KeyPoint> keypoints_1;
int fast_threshold = 20;
bool nonmaxSuppression = true;
cv::FAST(img_1, keypoints_1, fast_threshold, nonmaxSuppression);
cv::KeyPoint::convert(keypoints_1, points1, std::vector<int>());
}
} // namespace mvo
#endif //MVO_FEATURE_H
| 39.971429 | 119 | 0.673695 | [
"vector"
] |
12c6c0165305f860bd954b702b3268621d0747bb | 4,449 | h | C | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | //===-- NativeRegisterContextLinux_arm64.h ---------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#if defined(__arm64__) || defined(__aarch64__)
#ifndef lldb_NativeRegisterContextLinux_arm64_h
#define lldb_NativeRegisterContextLinux_arm64_h
#include "Plugins/Process/Linux/NativeRegisterContextLinux.h"
#include "Plugins/Process/Utility/NativeRegisterContextDBReg_arm64.h"
#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h"
#include <asm/ptrace.h>
namespace lldb_private {
namespace process_linux {
class NativeProcessLinux;
class NativeRegisterContextLinux_arm64
: public NativeRegisterContextLinux,
public NativeRegisterContextDBReg_arm64 {
public:
NativeRegisterContextLinux_arm64(
const ArchSpec &target_arch, NativeThreadProtocol &native_thread,
std::unique_ptr<RegisterInfoPOSIX_arm64> register_info_up);
uint32_t GetRegisterSetCount() const override;
uint32_t GetUserRegisterCount() const override;
const RegisterSet *GetRegisterSet(uint32_t set_index) const override;
Status ReadRegister(const RegisterInfo *reg_info,
RegisterValue ®_value) override;
Status WriteRegister(const RegisterInfo *reg_info,
const RegisterValue ®_value) override;
Status ReadAllRegisterValues(lldb::DataBufferSP &data_sp) override;
Status WriteAllRegisterValues(const lldb::DataBufferSP &data_sp) override;
void InvalidateAllRegisters() override;
std::vector<uint32_t>
GetExpeditedRegisters(ExpeditedRegs expType) const override;
bool RegisterOffsetIsDynamic() const override { return true; }
protected:
Status ReadGPR() override;
Status WriteGPR() override;
Status ReadFPR() override;
Status WriteFPR() override;
void *GetGPRBuffer() override { return &m_gpr_arm64; }
// GetGPRBufferSize returns sizeof arm64 GPR ptrace buffer, it is different
// from GetGPRSize which returns sizeof RegisterInfoPOSIX_arm64::GPR.
size_t GetGPRBufferSize() { return sizeof(m_gpr_arm64); }
void *GetFPRBuffer() override { return &m_fpr; }
size_t GetFPRSize() override { return sizeof(m_fpr); }
private:
bool m_gpr_is_valid;
bool m_fpu_is_valid;
bool m_sve_buffer_is_valid;
bool m_mte_ctrl_is_valid;
bool m_sve_header_is_valid;
bool m_pac_mask_is_valid;
struct user_pt_regs m_gpr_arm64; // 64-bit general purpose registers.
RegisterInfoPOSIX_arm64::FPU
m_fpr; // floating-point registers including extended register sets.
SVEState m_sve_state;
struct user_sve_header m_sve_header;
std::vector<uint8_t> m_sve_ptrace_payload;
bool m_refresh_hwdebug_info;
struct user_pac_mask {
uint64_t data_mask;
uint64_t insn_mask;
};
struct user_pac_mask m_pac_mask;
uint64_t m_mte_ctrl_reg;
bool IsGPR(unsigned reg) const;
bool IsFPR(unsigned reg) const;
Status ReadAllSVE();
Status WriteAllSVE();
Status ReadSVEHeader();
Status WriteSVEHeader();
Status ReadPAuthMask();
Status ReadMTEControl();
Status WriteMTEControl();
bool IsSVE(unsigned reg) const;
bool IsPAuth(unsigned reg) const;
bool IsMTE(unsigned reg) const;
uint64_t GetSVERegVG() { return m_sve_header.vl / 8; }
void SetSVERegVG(uint64_t vg) { m_sve_header.vl = vg * 8; }
void *GetSVEHeader() { return &m_sve_header; }
void *GetPACMask() { return &m_pac_mask; }
void *GetMTEControl() { return &m_mte_ctrl_reg; }
void *GetSVEBuffer();
size_t GetSVEHeaderSize() { return sizeof(m_sve_header); }
size_t GetPACMaskSize() { return sizeof(m_pac_mask); }
size_t GetSVEBufferSize() { return m_sve_ptrace_payload.size(); }
size_t GetMTEControlSize() { return sizeof(m_mte_ctrl_reg); }
llvm::Error ReadHardwareDebugInfo() override;
llvm::Error WriteHardwareDebugRegs(DREGType hwbType) override;
uint32_t CalculateFprOffset(const RegisterInfo *reg_info) const;
RegisterInfoPOSIX_arm64 &GetRegisterInfo() const;
void ConfigureRegisterContext();
uint32_t CalculateSVEOffset(const RegisterInfo *reg_info) const;
};
} // namespace process_linux
} // namespace lldb_private
#endif // #ifndef lldb_NativeRegisterContextLinux_arm64_h
#endif // defined (__arm64__) || defined (__aarch64__)
| 26.963636 | 80 | 0.744886 | [
"vector"
] |
12c816b9b45d885bff6b47a6f950f2dd39a8a5b7 | 2,197 | h | C | DataFormats/HLTReco/src/classes.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | 1 | 2020-08-12T08:37:04.000Z | 2020-08-12T08:37:04.000Z | DataFormats/HLTReco/src/classes.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | null | null | null | DataFormats/HLTReco/src/classes.h | nistefan/cmssw | ea13af97f7f2117a4f590a5e654e06ecd9825a5b | [
"Apache-2.0"
] | null | null | null | #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "DataFormats/HLTReco/interface/ModuleTiming.h"
#include "DataFormats/HLTReco/interface/HLTPerformanceInfo.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
#include "DataFormats/HLTReco/interface/HLTPrescaleTable.h"
#include "DataFormats/Common/interface/Wrapper.h"
#include "DataFormats/Candidate/interface/CompositeCandidate.h"
#include "DataFormats/Candidate/interface/CompositeCandidateFwd.h"
#include "DataFormats/Common/interface/Ref.h"
namespace DataFormats_HLTReco {
struct dictionary {
edm::EventTime et0;
edm::Wrapper<edm::EventTime> wet10;
// Performance Information
HLTPerformanceInfo pw0;
edm::Wrapper<HLTPerformanceInfo> pw1;
HLTPerformanceInfoCollection pw2;
edm::Wrapper<HLTPerformanceInfoCollection> pw3;
HLTPerformanceInfo::Module pw4;
HLTPerformanceInfo::Path pw6;
std::vector<HLTPerformanceInfo::Module> pw8;
std::vector<HLTPerformanceInfo::Module>::const_iterator pw9;
std::vector<HLTPerformanceInfo::Path> pw10;
std::vector<HLTPerformanceInfo::Path>::const_iterator pw11;
//HLTPerformanceInfo::Path::const_iterator pw13;
std::vector<trigger::TriggerObjectType> v_t_tot;
std::vector<trigger::TriggerObjectType>::const_iterator v_t_tot_ci;
edm::Wrapper<std::vector<trigger::TriggerObjectType> > w_v_t_tot;
trigger::TriggerObjectCollection toc;
trigger::TriggerRefsCollections trc;
trigger::TriggerFilterObjectWithRefs tfowr;
trigger::TriggerEvent te;
trigger::TriggerEventWithRefs tewr;
edm::Wrapper<trigger::TriggerObjectCollection> wtoc;
edm::Wrapper<trigger::TriggerFilterObjectWithRefs> wtfowr;
edm::Wrapper<trigger::TriggerEvent> wte;
edm::Wrapper<trigger::TriggerEventWithRefs> wtewr;
std::map<std::string,std::vector<unsigned int> > msu;
trigger::HLTPrescaleTable hpt;
edm::Wrapper<trigger::HLTPrescaleTable> whpt;
};
}
| 37.237288 | 71 | 0.761038 | [
"vector"
] |
12cc6b729eea77f586483c447632028cc923f36a | 1,660 | c | C | sm64ex-nightly/levels/jrb/leveldata.c | alex-free/sm64ex-creator | e7089df69fb43f266b2165078d94245b33b8e72a | [
"Intel",
"X11",
"Unlicense"
] | 2 | 2022-03-12T08:27:53.000Z | 2022-03-12T18:26:06.000Z | levels/jrb/leveldata.c | Daviz00/sm64 | fd2ed5e0e72d04732034919f8442f8d2cc40fd67 | [
"Unlicense"
] | null | null | null | levels/jrb/leveldata.c | Daviz00/sm64 | fd2ed5e0e72d04732034919f8442f8d2cc40fd67 | [
"Unlicense"
] | null | null | null | #include <ultra64.h>
#include "sm64.h"
#include "surface_terrains.h"
#include "moving_texture_macros.h"
#include "level_misc_macros.h"
#include "macro_preset_names.h"
#include "special_preset_names.h"
#include "textures.h"
#include "dialog_ids.h"
#include "make_const_nonconst.h"
#include "levels/jrb/texture.inc.c"
#include "levels/jrb/areas/1/1/model.inc.c"
#include "levels/jrb/areas/1/2/model.inc.c"
#include "levels/jrb/areas/1/3/model.inc.c"
#include "levels/jrb/areas/1/4/model.inc.c"
#include "levels/jrb/areas/1/5/model.inc.c"
#include "levels/jrb/areas/1/6/model.inc.c"
#include "levels/jrb/areas/1/7/model.inc.c"
#include "levels/jrb/rock/model.inc.c"
#include "levels/jrb/floating_platform/model.inc.c"
#include "levels/jrb/sliding_box/model.inc.c"
#include "levels/jrb/wooden_ship/model.inc.c"
#include "levels/jrb/falling_pillar/model.inc.c"
#include "levels/jrb/falling_pillar_base/model.inc.c"
#include "levels/jrb/areas/1/collision.inc.c"
#include "levels/jrb/areas/1/macro.inc.c"
#include "levels/jrb/rock/collision.inc.c"
#include "levels/jrb/floating_platform/collision.inc.c"
#include "levels/jrb/sliding_box/collision.inc.c"
#include "levels/jrb/wooden_ship/collision.inc.c"
#include "levels/jrb/falling_pillar_base/collision.inc.c"
#include "levels/jrb/unused_lid/collision.inc.c"
#include "levels/jrb/areas/1/trajectory.inc.c"
#include "levels/jrb/areas/1/movtext.inc.c"
#include "levels/jrb/areas/2/1/model.inc.c"
#include "levels/jrb/areas/2/2/model.inc.c"
#include "levels/jrb/areas/2/3/model.inc.c"
#include "levels/jrb/areas/2/collision.inc.c"
#include "levels/jrb/areas/2/macro.inc.c"
#include "levels/jrb/areas/2/movtext.inc.c"
| 39.52381 | 57 | 0.766867 | [
"model"
] |
12cff769e5dd941b26a1026625b9fbc3107874a7 | 6,066 | h | C | include/ossim/imaging/ossimImageCombiner.h | vladislav-horbatiuk/ossim | 82417ad868fac022672335e1684bdd91d662c18c | [
"MIT"
] | 251 | 2015-10-20T09:08:11.000Z | 2022-03-22T18:16:38.000Z | include/ossim/imaging/ossimImageCombiner.h | IvanLJF/ossim | 2e0143f682b9884a09ff2598ef8737f29e44fbdf | [
"MIT"
] | 73 | 2015-11-02T17:12:36.000Z | 2021-11-15T17:41:47.000Z | include/ossim/imaging/ossimImageCombiner.h | IvanLJF/ossim | 2e0143f682b9884a09ff2598ef8737f29e44fbdf | [
"MIT"
] | 146 | 2015-10-15T16:00:15.000Z | 2022-03-22T12:37:14.000Z | //*******************************************************************
//
// License: See LICENSE.txt file in the top level directory for more details.
//
// Author: Garrett Potts
//
//*************************************************************************
// $Id: ossimImageCombiner.h 23108 2015-01-27 17:00:20Z okramer $
#ifndef ossimImageCombiner_HEADER
#define ossimImageCombiner_HEADER
#include <vector>
#include <ossim/imaging/ossimImageSource.h>
#include <ossim/base/ossimConnectableObjectListener.h>
#include <ossim/base/ossimPropertyEvent.h>
/**
* This will be a base for all combiners. Combiners take N inputs and
* will produce a single output.
*/
class OSSIMDLLEXPORT ossimImageCombiner : public ossimImageSource,
public ossimConnectableObjectListener
{
public:
ossimImageCombiner();
ossimImageCombiner(ossimObject* owner,
int numberOfInputs,
int numberOfOutputs,
bool inputListIsFixedFlag,
bool outputListIsFixedFlag);
ossimImageCombiner(ossimConnectableObject::ConnectableObjectList& inputSources);
virtual ossimIrect getBoundingRect(ossim_uint32 resLevel=0) const;
virtual void initialize();
virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL);
virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=NULL)const;
/**
* This will go through and precompute the
* bounding rects of each input image.
*/
virtual void updateRects();
/**
* Returns the number of bands available from the input.
*/
virtual ossim_uint32 getNumberOfInputBands()const;
virtual ossimScalarType getOutputScalarType() const;
virtual ossim_uint32 getTileWidth()const;
virtual ossim_uint32 getTileHeight()const;
virtual double getNullPixelValue(ossim_uint32 band=0)const;
virtual double getMinPixelValue(ossim_uint32 band=0)const;
virtual double getMaxPixelValue(ossim_uint32 band=0)const;
/**
* Used to retrieve the number of overlapping images withint the given
* rect.
*/
virtual ossim_uint32 getNumberOfOverlappingImages(const ossimIrect& rect,
ossim_uint32 resLevel=0)const;
/**
* Used to populate the result with the index of the overlapping images.
*/
virtual void getOverlappingImages(std::vector<ossim_uint32>& result,
const ossimIrect& rect,
ossim_uint32 resLevel=0)const;
/* virtual ossimRefPtr<ossimImageData> getNextTile(ossim_uint32& returnedIdx, */
/* ossim_uint32 startIdx, */
/* const ossimIpt& origin, */
/* ossim_uint32 resLevel=0); */
/* virtual ossimRefPtr<ossimImageData> getNextTile(ossim_uint32& returnedIdx, */
/* const ossimIpt& origin, */
/* ossim_uint32 resLevel=0); */
virtual ossimRefPtr<ossimImageData> getNextTile(ossim_uint32& returnedIdx,
const ossim_uint32 startIdx,
const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
virtual ossimRefPtr<ossimImageData> getNextTile(ossim_uint32& returnedIdx,
const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
virtual bool getNextTile(ossim_uint32& returnedIdx,
const ossim_uint32 startIdx,
ossimImageData* tile,
ossim_uint32 resLevel=0);
virtual ossimRefPtr<ossimImageData> getNextNormTile(ossim_uint32& returnedIdx,
const ossim_uint32 index,
const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
virtual ossimRefPtr<ossimImageData> getNextNormTile(ossim_uint32& returnedIdx,
const ossimIrect& tileRect,
ossim_uint32 resLevel=0);
/* virtual ossimRefPtr<ossimImageData> getNextNormTile(ossim_uint32& returnedIdx, */
/* ossim_uint32 index, */
/* const ossimIpt& origin, */
/* ossim_uint32 resLevel=0); */
/* virtual ossimRefPtr<ossimImageData> getNextNormTile(ossim_uint32& returnedIdx, */
/* const ossimIpt& origin, */
/* ossim_uint32 resLevel=0); */
virtual bool canConnectMyInputTo(ossim_int32 inputIndex,
const ossimConnectableObject* object)const;
virtual void connectInputEvent(ossimConnectionEvent& event);
virtual void disconnectInputEvent(ossimConnectionEvent& event);
virtual void propertyEvent(ossimPropertyEvent& event);
virtual void refreshEvent(ossimRefreshEvent& event);
virtual bool hasDifferentInputs()const;
protected:
virtual ~ossimImageCombiner();
void precomputeBounds()const;
ossim_uint32 theLargestNumberOfInputBands;
ossim_uint32 theInputToPassThrough;
bool theHasDifferentInputs;
ossimRefPtr<ossimImageData> theNormTile;
mutable std::vector<ossimIrect> theFullResBounds;
mutable bool theComputeFullResBoundsFlag;
ossim_uint32 theCurrentIndex;
TYPE_DATA
};
#endif /* #ifndef ossimImageCombiner_HEADER */
| 43.021277 | 87 | 0.562479 | [
"object",
"vector"
] |
12d574f6db2c385db9420f24d84167f2c978e8c1 | 6,035 | h | C | Source/Voxel/Public/VoxelTexture.h | SolarStormInteractive/VoxelPlugin | b0b8a1838262227fa586fbcb1b46a6184cdf1e8c | [
"MIT"
] | null | null | null | Source/Voxel/Public/VoxelTexture.h | SolarStormInteractive/VoxelPlugin | b0b8a1838262227fa586fbcb1b46a6184cdf1e8c | [
"MIT"
] | null | null | null | Source/Voxel/Public/VoxelTexture.h | SolarStormInteractive/VoxelPlugin | b0b8a1838262227fa586fbcb1b46a6184cdf1e8c | [
"MIT"
] | null | null | null | // Copyright 2020 Phyronnaz
#pragma once
#include "CoreMinimal.h"
#include "VoxelMinimal.h"
#include "VoxelConfigEnums.h"
#include "VoxelUtilities/VoxelBaseUtilities.h"
#include "VoxelTexture.generated.h"
class UTexture;
class UTexture2D;
DECLARE_VOXEL_MEMORY_STAT(TEXT("Voxel Texture Memory"), STAT_VoxelTextureMemory, STATGROUP_VoxelMemory, VOXEL_API);
template<>
struct TNumericLimits<FColor>
{
typedef FColor NumericType;
static constexpr NumericType Min()
{
return FColor(MIN_uint8, MIN_uint8, MIN_uint8, MIN_uint8);
}
static constexpr NumericType Max()
{
return FColor(MAX_uint8, MAX_uint8, MAX_uint8, MAX_uint8);
}
static constexpr NumericType Lowest()
{
return Min();
}
};
namespace FVoxelUtilities
{
inline float ComponentMin(float A, float B)
{
return FMath::Min(A, B);
}
inline float ComponentMax(float A, float B)
{
return FMath::Max(A, B);
}
inline FColor ComponentMin(FColor A, FColor B)
{
return FColor(FMath::Min(A.R, B.R), FMath::Min(A.G, B.G), FMath::Min(A.B, B.B), FMath::Min(A.A, B.A));
}
inline FColor ComponentMax(FColor A, FColor B)
{
return FColor(FMath::Max(A.R, B.R), FMath::Max(A.G, B.G), FMath::Max(A.B, B.B), FMath::Max(A.A, B.A));
}
}
template<typename T>
struct TVoxelTexture
{
inline int32 GetSizeX() const
{
return DataPtr->SizeX;
}
inline int32 GetSizeY() const
{
return DataPtr->SizeY;
}
inline const TArray<T>& GetTextureData() const
{
return DataPtr->TextureData;
}
inline T GetMin() const
{
return DataPtr->Min;
}
inline T GetMax() const
{
return DataPtr->Max;
}
inline T SampleRaw(int32 X, int32 Y, EVoxelSamplerMode Mode) const
{
if (Mode == EVoxelSamplerMode::Clamp)
{
X = FMath::Clamp(X, 0, GetSizeX() - 1);
Y = FMath::Clamp(Y, 0, GetSizeY() - 1);
}
else
{
X = FVoxelUtilities::PositiveMod(X, GetSizeX());
Y = FVoxelUtilities::PositiveMod(Y, GetSizeY());
}
return GetTextureData()[X + GetSizeX() * Y];
}
template<typename U>
inline U Sample(int32 X, int32 Y, EVoxelSamplerMode Mode) const
{
return U(SampleRaw(X, Y, Mode));
}
template<typename U>
inline U Sample(v_flt X, v_flt Y, EVoxelSamplerMode Mode) const
{
const int32 MinX = FMath::FloorToInt(X);
const int32 MinY = FMath::FloorToInt(Y);
const int32 MaxX = FMath::CeilToInt(X);
const int32 MaxY = FMath::CeilToInt(Y);
const v_flt AlphaX = X - MinX;
const v_flt AlphaY = Y - MinY;
return FVoxelUtilities::BilinearInterpolation<U>(
Sample<U>(MinX, MinY, Mode),
Sample<U>(MaxX, MinY, Mode),
Sample<U>(MinX, MaxY, Mode),
Sample<U>(MaxX, MaxY, Mode),
AlphaX,
AlphaY);
}
public:
struct FTextureData
{
FTextureData() = default;
~FTextureData()
{
DEC_VOXEL_MEMORY_STAT_BY(STAT_VoxelTextureMemory, AllocatedSize);
}
void SetSize(int32 NewSizeX, int32 NewSizeY)
{
check(NewSizeX >= 0 && NewSizeY >= 0);
SizeX = NewSizeX;
SizeY = NewSizeY;
TextureData.Empty(SizeX * SizeY);
TextureData.SetNumUninitialized(SizeX * SizeY);
UpdateAllocatedSize();
Min = TNumericLimits<T>::Max();
Max = TNumericLimits<T>::Lowest();
}
void SetBounds(T NewMin, T NewMax)
{
Min = NewMin;
Max = NewMax;
}
FORCEINLINE void SetValue(int32 X, int32 Y, T Value)
{
checkVoxelSlow(0 <= X && X < SizeX);
checkVoxelSlow(0 <= Y && Y < SizeY);
SetValue(X + SizeX * Y, Value);
}
FORCEINLINE void SetValue(int32 Index, T Value)
{
SetValue_NoBounds(Index, Value);
Min = FVoxelUtilities::ComponentMin(Min, Value);
Max = FVoxelUtilities::ComponentMax(Max, Value);
}
FORCEINLINE void SetValue_NoBounds(int32 Index, T Value)
{
checkVoxelSlow(TextureData.IsValidIndex(Index));
TextureData.GetData()[Index] = Value;
}
private:
int32 SizeX = 1;
int32 SizeY = 1;
TArray<T> TextureData = { T{} };
T Min{};
T Max{};
int64 AllocatedSize = 0;
void UpdateAllocatedSize()
{
DEC_VOXEL_MEMORY_STAT_BY(STAT_VoxelTextureMemory, AllocatedSize);
AllocatedSize = TextureData.GetAllocatedSize();
INC_VOXEL_MEMORY_STAT_BY(STAT_VoxelTextureMemory, AllocatedSize);
}
friend TVoxelTexture;
};
TVoxelTexture()
: TVoxelTexture(MakeShareable(new FTextureData()))
{
}
explicit TVoxelTexture(const TVoxelSharedRef<const FTextureData>& InDataPtr)
: DataPtr(InDataPtr)
{
check(GetTextureData().Num() == GetSizeX() * GetSizeY());
}
private:
TVoxelSharedRef<const FTextureData> DataPtr;
};
// TODO: function to clear render target cache
namespace FVoxelTextureUtilities
{
VOXEL_API TVoxelTexture<FColor> CreateFromTexture_Color(UTexture* Texture);
VOXEL_API TVoxelTexture<float> CreateFromTexture_Float(UTexture* Texture, EVoxelRGBA Channel);
VOXEL_API bool CanCreateFromTexture(UTexture* Texture, FString& OutError);
VOXEL_API void FixTexture(UTexture* Texture);
VOXEL_API void ClearCache();
VOXEL_API void ClearCache(UTexture* Texture);
VOXEL_API void CreateOrUpdateUTexture2D(const TVoxelTexture<float>& Texture, UTexture2D*& InOutTexture);
VOXEL_API void CreateOrUpdateUTexture2D(const TVoxelTexture<FColor>& Texture, UTexture2D*& InOutTexture);
VOXEL_API TVoxelTexture<FColor> CreateColorTextureFromFloatTexture(const TVoxelTexture<float>& Texture, EVoxelRGBA Channel, bool bNormalize);
VOXEL_API TVoxelTexture<float> Normalize(const TVoxelTexture<float>& Texture);
};
USTRUCT(BlueprintType)
struct VOXEL_API FVoxelFloatTexture
{
GENERATED_BODY()
FVoxelFloatTexture() = default;
FVoxelFloatTexture(const TVoxelTexture<float>& Texture)
: Texture(Texture)
{
}
TVoxelTexture<float> Texture;
};
USTRUCT(BlueprintType)
struct VOXEL_API FVoxelColorTexture
{
GENERATED_BODY()
FVoxelColorTexture() = default;
FVoxelColorTexture(const TVoxelTexture<FColor>& Texture)
: Texture(Texture)
{
}
TVoxelTexture<FColor> Texture;
}; | 24.334677 | 143 | 0.686164 | [
"render"
] |
12e569207e584356d0cd47e92abec714395d6939 | 6,059 | h | C | wrappers/8.1.1/vtkGenericEnSightReaderWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | 6 | 2016-02-03T12:48:36.000Z | 2020-09-16T15:07:51.000Z | wrappers/8.1.1/vtkGenericEnSightReaderWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | 4 | 2016-02-13T01:30:43.000Z | 2020-03-30T16:59:32.000Z | wrappers/8.1.1/vtkGenericEnSightReaderWrap.h | axkibe/node-vtk | 900ad7b5500f672519da5aa24c99aa5a96466ef3 | [
"BSD-3-Clause"
] | null | null | null | /* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */
#ifndef NATIVE_EXTENSION_VTK_VTKGENERICENSIGHTREADERWRAP_H
#define NATIVE_EXTENSION_VTK_VTKGENERICENSIGHTREADERWRAP_H
#include <nan.h>
#include <vtkSmartPointer.h>
#include <vtkGenericEnSightReader.h>
#include "vtkMultiBlockDataSetAlgorithmWrap.h"
#include "../../plus/plus.h"
class VtkGenericEnSightReaderWrap : public VtkMultiBlockDataSetAlgorithmWrap
{
public:
using Nan::ObjectWrap::Wrap;
static void Init(v8::Local<v8::Object> exports);
static void InitPtpl();
static void ConstructorGetter(
v8::Local<v8::String> property,
const Nan::PropertyCallbackInfo<v8::Value>& info);
VtkGenericEnSightReaderWrap(vtkSmartPointer<vtkGenericEnSightReader>);
VtkGenericEnSightReaderWrap();
~VtkGenericEnSightReaderWrap( );
static Nan::Persistent<v8::FunctionTemplate> ptpl;
private:
static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void CanReadFile(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void DetermineEnSightVersion(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetByteOrder(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetByteOrderAsString(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetCaseFileName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetCellArrayName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetCellArrayStatus(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetCellDataArraySelection(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetComplexDescription(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetComplexVariableType(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetDescription(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetEnSightVersion(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetFilePath(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetGeometryFileName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetMaximumTimeValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetMinimumTimeValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfCellArrays(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfComplexScalarsPerElement(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfComplexScalarsPerNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfComplexVariables(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfComplexVectorsPerElement(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfComplexVectorsPerNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfPointArrays(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfScalarsPerElement(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfScalarsPerMeasuredNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfScalarsPerNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfTensorsSymmPerElement(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfTensorsSymmPerNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfVariables(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfVectorsPerElement(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfVectorsPerMeasuredNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetNumberOfVectorsPerNode(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetParticleCoordinatesByIndex(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetPointArrayName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetPointArrayStatus(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetPointDataArraySelection(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetReadAllVariables(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetReader(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetTimeSets(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetTimeValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void GetVariableType(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void ParticleCoordinatesByIndexOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void ParticleCoordinatesByIndexOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void ReadAllVariablesOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void ReadAllVariablesOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetByteOrder(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetByteOrderToBigEndian(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetByteOrderToLittleEndian(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetCaseFileName(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetCellArrayStatus(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetFilePath(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetParticleCoordinatesByIndex(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetPointArrayStatus(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetReadAllVariables(const Nan::FunctionCallbackInfo<v8::Value>& info);
static void SetTimeValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
#ifdef VTK_NODE_PLUS_VTKGENERICENSIGHTREADERWRAP_CLASSDEF
VTK_NODE_PLUS_VTKGENERICENSIGHTREADERWRAP_CLASSDEF
#endif
};
#endif
| 62.463918 | 100 | 0.803763 | [
"object"
] |
12ec1bb446543d329ec114213af6f149e7bede80 | 4,796 | h | C | aws-cpp-sdk-inspector2/include/aws/inspector2/model/EnableResult.h | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-02-12T08:09:30.000Z | 2022-02-12T08:09:30.000Z | aws-cpp-sdk-inspector2/include/aws/inspector2/model/EnableResult.h | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-01-03T23:59:37.000Z | 2022-01-03T23:59:37.000Z | aws-cpp-sdk-inspector2/include/aws/inspector2/model/EnableResult.h | ravindra-wagh/aws-sdk-cpp | 7d5ff01b3c3b872f31ca98fb4ce868cd01e97696 | [
"Apache-2.0"
] | 1 | 2021-11-09T11:58:03.000Z | 2021-11-09T11:58:03.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/inspector2/Inspector2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/inspector2/model/Account.h>
#include <aws/inspector2/model/FailedAccount.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace Inspector2
{
namespace Model
{
class AWS_INSPECTOR2_API EnableResult
{
public:
EnableResult();
EnableResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
EnableResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline const Aws::Vector<Account>& GetAccounts() const{ return m_accounts; }
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline void SetAccounts(const Aws::Vector<Account>& value) { m_accounts = value; }
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline void SetAccounts(Aws::Vector<Account>&& value) { m_accounts = std::move(value); }
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& WithAccounts(const Aws::Vector<Account>& value) { SetAccounts(value); return *this;}
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& WithAccounts(Aws::Vector<Account>&& value) { SetAccounts(std::move(value)); return *this;}
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& AddAccounts(const Account& value) { m_accounts.push_back(value); return *this; }
/**
* <p>Information on the accounts that have had Amazon Inspector scans successfully
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& AddAccounts(Account&& value) { m_accounts.push_back(std::move(value)); return *this; }
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline const Aws::Vector<FailedAccount>& GetFailedAccounts() const{ return m_failedAccounts; }
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline void SetFailedAccounts(const Aws::Vector<FailedAccount>& value) { m_failedAccounts = value; }
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline void SetFailedAccounts(Aws::Vector<FailedAccount>&& value) { m_failedAccounts = std::move(value); }
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& WithFailedAccounts(const Aws::Vector<FailedAccount>& value) { SetFailedAccounts(value); return *this;}
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& WithFailedAccounts(Aws::Vector<FailedAccount>&& value) { SetFailedAccounts(std::move(value)); return *this;}
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& AddFailedAccounts(const FailedAccount& value) { m_failedAccounts.push_back(value); return *this; }
/**
* <p>Information on any accounts for which Amazon Inspector scans could not be
* enabled. Details are provided for each account.</p>
*/
inline EnableResult& AddFailedAccounts(FailedAccount&& value) { m_failedAccounts.push_back(std::move(value)); return *this; }
private:
Aws::Vector<Account> m_accounts;
Aws::Vector<FailedAccount> m_failedAccounts;
};
} // namespace Model
} // namespace Inspector2
} // namespace Aws
| 36.333333 | 133 | 0.701835 | [
"vector",
"model"
] |
12f12f054de5483919ce258c9c57137b39f64d0a | 657 | h | C | direct/src/plugin/get_tinyxml.h | cmarshall108/panda3d-python3 | 8bea2c0c120b03ec1c9fd179701fdeb7510bb97b | [
"PHP-3.0",
"PHP-3.01"
] | null | null | null | direct/src/plugin/get_tinyxml.h | cmarshall108/panda3d-python3 | 8bea2c0c120b03ec1c9fd179701fdeb7510bb97b | [
"PHP-3.0",
"PHP-3.01"
] | null | null | null | direct/src/plugin/get_tinyxml.h | cmarshall108/panda3d-python3 | 8bea2c0c120b03ec1c9fd179701fdeb7510bb97b | [
"PHP-3.0",
"PHP-3.01"
] | null | null | null | /**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file get_tinyxml.h
* @author drose
* @date 2009-07-01
*/
#ifndef GET_TINYXML_H
#define GET_TINYXML_H
// This header file exists just to include tinyxml.h safely. We need this
// since tinyxml.h requires having the symbol TIXML_USE_STL already defined
// before you include it.
#ifndef TIXML_USE_STL
#define TIXML_USE_STL
#endif
#include <tinyxml.h>
#endif
| 23.464286 | 75 | 0.739726 | [
"3d"
] |
12f7ef7162d7f92806cc239c462ce8a8ab64901e | 680 | h | C | dataray-p1/include/Sphere.h | leRoderic/Graphics_20 | 12e9f43b40a50faa61bc15cfd3db4ad94b9ef8de | [
"MIT"
] | null | null | null | dataray-p1/include/Sphere.h | leRoderic/Graphics_20 | 12e9f43b40a50faa61bc15cfd3db4ad94b9ef8de | [
"MIT"
] | null | null | null | dataray-p1/include/Sphere.h | leRoderic/Graphics_20 | 12e9f43b40a50faa61bc15cfd3db4ad94b9ef8de | [
"MIT"
] | 1 | 2021-04-11T13:32:32.000Z | 2021-04-11T13:32:32.000Z | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
#ifndef SPHEREH
#define SPHEREH
#include "Object.h"
#include "Animation.h"
#include "Translate.h"
#include "Scale.h"
class Sphere: public Object {
public:
Sphere(vec3 cen, float r, float data);
virtual ~Sphere() {}
virtual bool intersection(const Ray &r, float t_min, float t_max, IntersectionInfo &info) const;
virtual void aplicaTG(TG *t);
// Centre de l'esfera
vec3 center;
// Radi de l'esfera
float radius;
float factor;
private:
};
#endif
| 17 | 100 | 0.683824 | [
"object"
] |
12ff3e0f5c8ad8cbc53ab85f7c4db84953ff6d8f | 1,815 | h | C | B2G/gecko/widget/nsIRollupListener.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/widget/nsIRollupListener.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/widget/nsIRollupListener.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __nsIRollupListener_h__
#define __nsIRollupListener_h__
#include "nsTArray.h"
class nsIContent;
class nsIWidget;
class nsIRollupListener {
public:
/**
* Notifies the object to rollup, optionally returning the node that
* was just rolled up.
*
* aCount is the number of popups in a chain to close. If this is
* UINT32_MAX, then all popups are closed.
* If aGetLastRolledUp is true, then return the last rolled up popup,
* if this is supported.
*/
virtual nsIContent* Rollup(uint32_t aCount, bool aGetLastRolledUp = false) = 0;
/**
* Asks the RollupListener if it should rollup on mousevents
*/
virtual bool ShouldRollupOnMouseWheelEvent() = 0;
/**
* Asks the RollupListener if it should rollup on mouse activate, eg. X-Mouse
*/
virtual bool ShouldRollupOnMouseActivate() = 0;
/*
* Retrieve the widgets for open menus and store them in the array
* aWidgetChain. The number of menus of the same type should be returned,
* for example, if a context menu is open, return only the number of menus
* that are part of the context menu chain. This allows closing up only
* those menus in different situations. The returned value should be exactly
* the same number of widgets added to aWidgetChain.
*/
virtual uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain) = 0;
/**
* Notify the RollupListener that the widget did a Move or Resize.
*/
virtual void NotifyGeometryChange() = 0;
};
#endif /* __nsIRollupListener_h__ */
| 32.410714 | 81 | 0.712948 | [
"object"
] |
4202731a1db358f176fe873151d46970add161dd | 6,250 | c | C | src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c | iColabora/pixie | 9bb302e3e5574cb7679c8cfabae8b826a20545c6 | [
"Apache-2.0"
] | null | null | null | src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c | iColabora/pixie | 9bb302e3e5574cb7679c8cfabae8b826a20545c6 | [
"Apache-2.0"
] | 1 | 2021-09-08T12:31:30.000Z | 2021-09-08T12:31:30.000Z | src/stirling/source_connectors/socket_tracer/bcc_bpf/openssl_trace.c | iColabora/pixie | 9bb302e3e5574cb7679c8cfabae8b826a20545c6 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2018- The Pixie Authors.
*
* 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.
*
* SPDX-License-Identifier: MIT
*/
// LINT_C_FILE: Do not remove this line. It ensures cpplint treats this as a C file.
#include "src/stirling/source_connectors/socket_tracer/bcc_bpf/macros.h"
#include "src/stirling/source_connectors/socket_tracer/bcc_bpf_intf/symaddrs.h"
// Maps that communicates the location of symbols within a binary.
// Key: TGID
// Value: Symbol addresses for the binary with that TGID.
// Technically the key should be the path to a binary/shared library object instead of a TGID.
// However, we use TGID for simplicity (rather than requiring a string as a key).
// This means there will be more entries in the map, when different binaries share libssl.so.
BPF_HASH(openssl_symaddrs_map, uint32_t, struct openssl_symaddrs_t);
/***********************************************************
* General helpers
***********************************************************/
static __inline void process_openssl_data(struct pt_regs* ctx, uint64_t id,
const enum TrafficDirection direction,
const struct data_args_t* args) {
// Do not change bytes_count to 'ssize_t' or 'long'.
// Using a 64b data type for bytes_count causes negative values,
// returned as 'int' from open-ssl, to be aliased into positive
// values. This confuses our downstream logic in process_data().
// This aliasing would cause process_data() to:
// 1. process a message it should not, and
// 2. miscalculate the expected next position (with a very large value)
// Succinctly, DO NOT MODIFY THE DATATYPE for bytes_count.
int bytes_count = PT_REGS_RC(ctx);
process_data(/* vecs */ false, ctx, id, direction, args, bytes_count, /* ssl */ true);
}
/***********************************************************
* Argument parsing helpers
***********************************************************/
// Given a pointer to an SSL object (i.e. the argument to functions like SSL_read),
// returns the FD of the SSL connection.
// The implementation navigates some internal structs to get this value,
// so this function may break with OpenSSL updates.
// To help combat this, the is parameterized with symbol addresses which are set by user-space,
// base on the OpenSSL version detected.
static int get_fd(uint32_t tgid, void* ssl) {
struct openssl_symaddrs_t* symaddrs = openssl_symaddrs_map.lookup(&tgid);
if (symaddrs == NULL) {
return kInvalidFD;
}
REQUIRE_SYMADDR(symaddrs->SSL_rbio_offset, kInvalidFD);
REQUIRE_SYMADDR(symaddrs->RBIO_num_offset, kInvalidFD);
// Extract FD via ssl->rbio->num.
const void** rbio_ptr_addr = ssl + symaddrs->SSL_rbio_offset;
const void* rbio_ptr = *rbio_ptr_addr;
const int* rbio_num_addr = rbio_ptr + symaddrs->RBIO_num_offset;
const int rbio_num = *rbio_num_addr;
return rbio_num;
}
/***********************************************************
* BPF probe function entry-points
***********************************************************/
BPF_HASH(active_ssl_read_args_map, uint64_t, struct data_args_t);
BPF_HASH(active_ssl_write_args_map, uint64_t, struct data_args_t);
// Function signature being probed:
// int SSL_write(SSL *ssl, const void *buf, int num);
int probe_entry_SSL_write(struct pt_regs* ctx) {
uint64_t id = bpf_get_current_pid_tgid();
uint32_t tgid = id >> 32;
void* ssl = (void*)PT_REGS_PARM1(ctx);
char* buf = (char*)PT_REGS_PARM2(ctx);
int32_t fd = get_fd(tgid, ssl);
if (fd == kInvalidFD) {
return 0;
}
struct data_args_t write_args = {};
write_args.source_fn = kSSLWrite;
write_args.fd = fd;
write_args.buf = buf;
active_ssl_write_args_map.update(&id, &write_args);
// Mark connection as SSL right away, so encrypted traffic does not get traced.
set_conn_as_ssl(tgid, write_args.fd);
return 0;
}
int probe_ret_SSL_write(struct pt_regs* ctx) {
uint64_t id = bpf_get_current_pid_tgid();
const struct data_args_t* write_args = active_ssl_write_args_map.lookup(&id);
if (write_args != NULL) {
process_openssl_data(ctx, id, kEgress, write_args);
}
active_ssl_write_args_map.delete(&id);
return 0;
}
// Function signature being probed:
// int SSL_read(SSL *s, void *buf, int num)
int probe_entry_SSL_read(struct pt_regs* ctx) {
uint64_t id = bpf_get_current_pid_tgid();
uint32_t tgid = id >> 32;
void* ssl = (void*)PT_REGS_PARM1(ctx);
char* buf = (char*)PT_REGS_PARM2(ctx);
int32_t fd = get_fd(tgid, ssl);
if (fd == kInvalidFD) {
return 0;
}
struct data_args_t read_args = {};
read_args.source_fn = kSSLRead;
read_args.fd = fd;
read_args.buf = buf;
active_ssl_read_args_map.update(&id, &read_args);
// Mark connection as SSL right away, so encrypted traffic does not get traced.
set_conn_as_ssl(tgid, read_args.fd);
return 0;
}
int probe_ret_SSL_read(struct pt_regs* ctx) {
uint64_t id = bpf_get_current_pid_tgid();
const struct data_args_t* read_args = active_ssl_read_args_map.lookup(&id);
if (read_args != NULL) {
process_openssl_data(ctx, id, kIngress, read_args);
}
active_ssl_read_args_map.delete(&id);
return 0;
}
| 37.202381 | 95 | 0.68848 | [
"object"
] |
42092e06fe1ccecba705198adaf1f7d569c251e1 | 4,321 | h | C | pi4home-core/src/pi4home/light/light_color_values.h | khzd/pi4home | 937bcdcf77bab111cca10af1fe45c63a55c29aae | [
"MIT"
] | 1 | 2019-05-16T02:52:12.000Z | 2019-05-16T02:52:12.000Z | pi4home-core/src/pi4home/light/light_color_values.h | khzd/pi4home | 937bcdcf77bab111cca10af1fe45c63a55c29aae | [
"MIT"
] | null | null | null | pi4home-core/src/pi4home/light/light_color_values.h | khzd/pi4home | 937bcdcf77bab111cca10af1fe45c63a55c29aae | [
"MIT"
] | null | null | null | #ifndef PI4HOME_LIGHT_LIGHT_COLOR_VALUES_H
#define PI4HOME_LIGHT_LIGHT_COLOR_VALUES_H
#include "pi4home/defines.h"
#ifdef USE_LIGHT
#include <ArduinoJson.h>
#include <string>
#include "pi4home/light/light_traits.h"
PI4HOME_NAMESPACE_BEGIN
namespace light {
/** This class represents the color state for a light object.
*
* All values in this class are represented using floats in the range from 0.0 (off) to 1.0 (on).
* Not all values have to be populated though, for example a simple monochromatic light only needs
* to access the state and brightness attributes.
*
* PLease note all float values are automatically clamped.
*
* state - Whether the light should be on/off. Represented as a float for transitions.
* brightness - The brightness of the light.
* red, green, blue - RGB values.
* white - The white value for RGBW lights.
*/
class LightColorValues {
public:
/// Construct the LightColorValues with all attributes enabled, but state set to 0.0
LightColorValues();
LightColorValues(float state, float brightness, float red, float green, float blue, float white,
float color_temperature = 1.0f);
LightColorValues(bool state, float brightness, float red, float green, float blue, float white,
float color_temperature = 1.0f);
static LightColorValues from_binary(bool state);
static LightColorValues from_monochromatic(float brightness);
static LightColorValues from_rgb(float r, float g, float b);
static LightColorValues from_rgbw(float r, float g, float b, float w);
/** Linearly interpolate between the values in start to the values in end.
*
* This function linearly interpolates the color value by just interpolating every attribute
* independently.
*
* @param start The interpolation start values.
* @param end The interpolation end values.
* @param completion The completion value. 0 -> start, 1 -> end.
* @return The linearly interpolated LightColorValues.
*/
static LightColorValues lerp(const LightColorValues &start, const LightColorValues &end, float completion);
/** Dump this color into a JsonObject. Only dumps values if the corresponding traits are marked supported by traits.
*
* @param root The json root object.
* @param traits The traits object used for determining whether to include certain attributes.
*/
void dump_json(JsonObject &root, const LightTraits &traits) const;
/** Normalize the color (RGB/W) component.
*
* Divides all color attributes by the maximum attribute, so effectively set at least one attribute to 1.
* For example: r=0.3, g=0.5, b=0.4 => r=0.6, g=1.0, b=0.8
*
* @param traits Used for determining which attributes to consider.
*/
void normalize_color(const LightTraits &traits);
void as_binary(bool *binary) const;
void as_brightness(float *brightness) const;
void as_rgb(float *red, float *green, float *blue) const;
void as_rgbw(float *red, float *green, float *blue, float *white) const;
void as_rgbww(float color_temperature_cw, float color_temperature_ww, float *red, float *green, float *blue,
float *cold_white, float *warm_white) const;
void as_cwww(float color_temperature_cw, float color_temperature_ww, float *cold_white, float *warm_white) const;
/// Compare this LightColorValues to rhs, return true iff all attributes match.
bool operator==(const LightColorValues &rhs) const;
bool operator!=(const LightColorValues &rhs) const;
float get_state() const;
bool is_on() const;
void set_state(float state);
void set_state(bool state);
float get_brightness() const;
void set_brightness(float brightness);
float get_red() const;
void set_red(float red);
float get_green() const;
void set_green(float green);
float get_blue() const;
void set_blue(float blue);
float get_white() const;
void set_white(float white);
float get_color_temperature() const;
void set_color_temperature(float color_temperature);
protected:
float state_; ///< ON / OFF, float for transition
float brightness_;
float red_;
float green_;
float blue_;
float white_;
float color_temperature_; ///< Color Temperature in Mired
};
} // namespace light
PI4HOME_NAMESPACE_END
#endif // USE_LIGHT
#endif // PI4HOME_LIGHT_LIGHT_COLOR_VALUES_H
| 32.488722 | 118 | 0.736172 | [
"object"
] |
421248fd44a1c16a1c931185c8341b1f420e605b | 2,026 | c | C | d/av_rooms/lurue/cell_cell.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/av_rooms/lurue/cell_cell.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/av_rooms/lurue/cell_cell.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | // File created with /daemon/persistent_room_d.c
#include <std.h>
inherit "/cmds/avatar/avatar_room.c";
void create()
{
::create();
set_name("cell_cell");
set_property("indoors",1);
set_property("light",1);
set_property("no teleport",1);
set_terrain("stone building");
set_travel("slick floor");
set_climate("temperate");
set_short("A secure jail cell");
set_long("%^CYAN%^This cell is sparse and undecorated. %^RESET%^Stone walls%^CYAN%^ surround the room and a %^RESET%^stone slab%^CYAN%^ about three feet off hte floor provides a place to sit and rest. A networ"
"k of %^RED%^iron bars%^CYAN%^ creates a door leading out, but the pair of locks on the door keep it tightly sealed.%^RESET%^"
);
set_smell("default","The scent of shame and depression hang in the air here.");
set_listen("default","You can just hear the sound of freedom coming from the hall beyond.");
set_items(([
"slab" : "The slab is about three feet off the ground and is made of stone. Featureless, there is nothing there for padding or comfort, but you imagine you could probably lay down and rest if you really were tired.",
]));
set_exits(([
"west" : "/d/av_rooms/lurue/cell_hall",
]));
set_door("iron door","/d/av_rooms/lurue/cell_hall","west","jail key","cell lock");
add_lock("iron door","jail key","cell lock","This lock is large and complex, requiring a key or a very clever locksmith to get through.");
set_locked("iron door",1,"cell lock");
lock_difficulty("iron door",-90,"cell lock");
set_open("iron door",0);
set_string("iron door","knock","rattles the bars on the ");
set_string("iron door","open","The bars rattle as the door is swung open.");
set_string("iron door","close","The bars rattle as the door is swung closed.");
set_door_description("iron door","A frame of thick iron slabs provide holes into which the iron bars are fitted. The bars make a mesh pattern that allows you to see through them into the next room.");
} | 46.045455 | 218 | 0.69151 | [
"mesh"
] |
42169f489bd7f898a437d5060b75ab5690ea6e32 | 3,391 | h | C | src/app/list_helper.h | SudatiSimone/color-mayo | 7e931f6565f71359fd586caf2ec144674b91aaf3 | [
"BSD-2-Clause"
] | null | null | null | src/app/list_helper.h | SudatiSimone/color-mayo | 7e931f6565f71359fd586caf2ec144674b91aaf3 | [
"BSD-2-Clause"
] | null | null | null | src/app/list_helper.h | SudatiSimone/color-mayo | 7e931f6565f71359fd586caf2ec144674b91aaf3 | [
"BSD-2-Clause"
] | null | null | null | /****************************************************************************
** Copyright (c) 2020, Fougue Ltd. <http://www.fougue.pro>
** All rights reserved.
** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt
****************************************************************************/
#pragma once
#include <QtCore/QMetaType>
#include <QtCore/QVariantAnimation>
#include <QtGui/QTextOption>
#include <QtWidgets/QStyledItemDelegate>
#include <memory>
#include <type_traits>
#include <vector>
namespace Mayo {
namespace ListHelper {
struct ModelItem {
QString name;
QString description;
QString imageUrl;
QTextOption::WrapMode textWrapMode = QTextOption::NoWrap;
};
struct ModelStorage {
virtual ~ModelStorage() {}
virtual int count() const = 0;
virtual const ModelItem* at(int i) const = 0;
};
template<typename ITEM> struct DefaultModelStorage : public ModelStorage {
static_assert(!std::is_pointer<ITEM>::value);
static_assert(std::is_base_of<ModelItem, ITEM>::value);
int count() const override { return int(m_items.size()); }
const ITEM* at(int i) const override { return &m_items.at(i); }
std::vector<ITEM> m_items;
};
class Model : public QAbstractListModel {
public:
enum DataRole {
RoleItemPtr = Qt::UserRole + 1,
RoleItemImage
};
Model(QObject* parent);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
virtual QPixmap findPixmap(const QString& url) const = 0;
static const ModelItem* itemPtrAt(const QModelIndex& index);
static QPixmap itemPixmapAt(const QModelIndex& index);
protected:
void setStorage(std::unique_ptr<ModelStorage> ptr); // Should be called in constructor
private:
bool hasStorage() const { return this->storage() != nullptr; }
const ModelStorage* storage() const { return m_storage.get(); }
std::unique_ptr<ModelStorage> m_storage;
};
class ItemDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
ItemDelegate(QObject* parent = nullptr);
void paint(
QPainter* painter,
const QStyleOptionViewItem& option,
const QModelIndex& index) const override;
QSize itemSize() const { return m_itemSize; }
void setItemSize(QSize size);
int itemSpacing() const { return m_itemSpacing; }
void setItemSpacing(int spacing) { m_itemSpacing = spacing; }
QSize itemPixmapSize() const { return m_itemPixmapSize; }
void setItemPixmapSize(QSize size) { m_itemPixmapSize = size; }
protected:
bool editorEvent(
QEvent* event,
QAbstractItemModel* model,
const QStyleOptionViewItem& option,
const QModelIndex& index) override;
virtual void clickAction(const ModelItem*) const {
}
private:
void drawItem();
QColor m_frameColor;
QColor m_pixmapColor;
QColor m_textColor;
QSize m_itemSize = { 230, 180 };
int m_itemSpacing = 10;
QSize m_itemPixmapSize = { 190, 150 };
mutable QModelIndex m_previousIndex;
mutable QVariantAnimation m_itemAnimation;
mutable QRect m_area;
mutable QAbstractItemView* m_widget;
mutable QPixmap m_blurredPixmap;
};
} // namespace ListHelper
} // namespace Mayo
Q_DECLARE_METATYPE(Mayo::ListHelper::ModelItem*)
| 29.232759 | 90 | 0.669419 | [
"vector",
"model"
] |
3f149bf5841f19ee5af78888ae3c230d3b520bd7 | 1,166 | h | C | Syl3D/renderer.h | Vivekyadavgithub/Syl3D | 9533f69d4c96d7d7d9bcc4189b218a7a9138f12a | [
"MIT"
] | null | null | null | Syl3D/renderer.h | Vivekyadavgithub/Syl3D | 9533f69d4c96d7d7d9bcc4189b218a7a9138f12a | [
"MIT"
] | null | null | null | Syl3D/renderer.h | Vivekyadavgithub/Syl3D | 9533f69d4c96d7d7d9bcc4189b218a7a9138f12a | [
"MIT"
] | null | null | null | #pragma once
#include <vector>
#include <memory>
#include "shadermanager.h"
#include "texturematerial.h"
#include "entity/rectangle.h"
#include "entity/triangle.h"
#include "entity/cube.h"
#include "entity/uvsphere.h"
#include "entity/icosphere.h"
#include "entity/terrain.h"
#include "entity/model.h"
#include "utility/modelfactory.h"
#include "lights/pointlight.h"
#include "lights/directionallight.h"
#include "lights/spotlight.h"
#include "freecamera.h"
#include "mousepicker.h"
#include "entitycontainer.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class Renderer
{
public:
Renderer();
void initialize(float window_width, float window_height);
void render();
void updateWindowDimensions(float window_width, float window_height);
void mouseRayIntersections(math::Vec3 mouseRay);
std::shared_ptr<FreeCamera> _freeCamera;
MousePicker _mousePicker;
private:
std::shared_ptr<ShaderManager> _shaderManager;
EntityContainer _entityContainer;
std::shared_ptr<light::SpotLight> _spotLight;
std::vector<std::shared_ptr<entity::Cube>> _cubes;
std::shared_ptr<TextureMaterial> _wallMaterial;
}; | 22 | 70 | 0.774443 | [
"render",
"vector",
"model"
] |
3f241cb7466732dea9b86ed8295223856f10eb9a | 8,713 | h | C | opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h | 337240552/opencore-amr-iOS | 52fdd31e00c75ac5b07af09e7d9fd19e2210ec1c | [
"Apache-2.0"
] | 192 | 2015-01-07T09:09:39.000Z | 2022-02-22T07:11:48.000Z | opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h | 337240552/opencore-amr-iOS | 52fdd31e00c75ac5b07af09e7d9fd19e2210ec1c | [
"Apache-2.0"
] | 19 | 2016-03-22T10:14:14.000Z | 2021-09-04T02:40:20.000Z | opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/int_lpc.h | 337240552/opencore-amr-iOS | 52fdd31e00c75ac5b07af09e7d9fd19e2210ec1c | [
"Apache-2.0"
] | 71 | 2015-08-31T02:31:29.000Z | 2022-03-08T10:18:07.000Z | /* ------------------------------------------------------------------
* Copyright (C) 1998-2009 PacketVideo
*
* 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.
* -------------------------------------------------------------------
*/
/****************************************************************************************
Portions of this file are derived from the following 3GPP standard:
3GPP TS 26.073
ANSI-C code for the Adaptive Multi-Rate (AMR) speech codec
Available from http://www.3gpp.org
(C) 2004, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC)
Permission to distribute, modify and use this file under the standard license
terms listed above has been obtained from the copyright holder.
****************************************************************************************/
/*
Filename: int_lpc.h
------------------------------------------------------------------------------
INCLUDE DESCRIPTION
This file contains all the constant definitions and prototype definitions
needed by the lsp_avg.c
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; CONTINUE ONLY IF NOT ALREADY DEFINED
----------------------------------------------------------------------------*/
#ifndef int_lpc_h
#define int_lpc_h "$Id $"
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "typedef.h"
/*--------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C"
{
#endif
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; DEFINES
; Include all pre-processor statements here.
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; EXTERNAL VARIABLES REFERENCES
; Declare variables used in this module but defined elsewhere
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; SIMPLE TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; ENUMERATED TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; STRUCTURES TYPEDEF'S
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
; GLOBAL FUNCTION DEFINITIONS
; Function Prototype declaration
----------------------------------------------------------------------------*/
/*
**************************************************************************
*
* Function : Int_lpc_1and3
* Purpose : Interpolates the LSPs and converts to LPC parameters
* to get a different LP filter in each subframe.
* Description : The 20 ms speech frame is divided into 4 subframes.
* The LSPs are quantized and transmitted at the 2nd and
* 4th subframes (twice per frame) and interpolated at the
* 1st and 3rd subframe.
*
* |------|------|------|------|
* sf1 sf2 sf3 sf4
* F0 Fm F1
*
* sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm
* sf2: Fm sf4: F1
* Returns : void
*
**************************************************************************
*/
OSCL_IMPORT_REF void Int_lpc_1and3(
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of
present frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of
present frame (M) */
Word16 Az[], /* o : interpolated LP parameters in all subfr.
(AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1and3_2
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
* function but we do not recompute Az() for subframe 2 and
* 4 because it is already available.
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1and3_2(
Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */
Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of
present frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th subframe of
present frame (M) */
Word16 Az[], /* o :interpolated LP parameters
in subframes 1 and 3 (AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1to3
* Purpose : Interpolates the LSPs and converts to LPC parameters
* to get a different LP filter in each subframe.
* Description : The 20 ms speech frame is divided into 4 subframes.
* The LSPs are quantized and transmitted at the 4th
* subframes (once per frame) and interpolated at the
* 1st, 2nd and 3rd subframe.
*
* |------|------|------|------|
* sf1 sf2 sf3 sf4
* F0 F1
*
* sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1
* sf2: 1/2 F0 + 1/2 F1 sf4: F1
* Returns : void
*
**************************************************************************
*/
OSCL_IMPORT_REF void Int_lpc_1to3(
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th SF of present frame (M) */
Word16 Az[], /* o : interpolated LP parameters in all SFs (AZ_SIZE) */
Flag *pOverflow
);
/*
**************************************************************************
*
* Function : Int_lpc_1to3_2
* Purpose : Interpolation of the LPC parameters. Same as the Int_lpc
* function but we do not recompute Az() for subframe 4
* because it is already available.
* Returns : void
*
**************************************************************************
*/
void Int_lpc_1to3_2(
Word16 lsp_old[], /* i : LSP vector at the 4th SF of past frame (M) */
Word16 lsp_new[], /* i : LSP vector at the 4th SF present frame (M) */
Word16 Az[], /* o :interpolated LP parameters in SFs 1, 2, 3
(AZ_SIZE) */
Flag *pOverflow
);
/*----------------------------------------------------------------------------
; END
----------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif
#endif /* _INT_LPC_H_ */
| 43.133663 | 89 | 0.356135 | [
"vector"
] |
3f2dce14e1c5c36a22b64e3a0c3bd4821fc62b6a | 1,451 | h | C | src/BabylonCpp/include/babylon/events/pointer_event_types.h | sacceus/BabylonCpp | 94669cf7cbe3214ec6e905cbf249fa0c9daf6222 | [
"Apache-2.0"
] | 277 | 2017-05-18T08:27:10.000Z | 2022-03-26T01:31:37.000Z | src/BabylonCpp/include/babylon/events/pointer_event_types.h | sacceus/BabylonCpp | 94669cf7cbe3214ec6e905cbf249fa0c9daf6222 | [
"Apache-2.0"
] | 77 | 2017-09-03T15:35:02.000Z | 2022-03-28T18:47:20.000Z | src/BabylonCpp/include/babylon/events/pointer_event_types.h | sacceus/BabylonCpp | 94669cf7cbe3214ec6e905cbf249fa0c9daf6222 | [
"Apache-2.0"
] | 37 | 2017-03-30T03:36:24.000Z | 2022-01-28T08:28:36.000Z | #ifndef BABYLON_EVENTS_POINTER_EVENT_TYPES_H
#define BABYLON_EVENTS_POINTER_EVENT_TYPES_H
namespace BABYLON {
/**
* @brief Gather the list of pointer event types as constants.
*/
enum class PointerEventTypes {
/**
* The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the
* device transitions from no buttons depressed to at least one button depressed. For touch, it is
* fired when physical contact is made with the digitizer. For pen, it is fired when the stylus
* makes physical contact with the digitizer.
*/
POINTERDOWN = 0x01,
/**
* The pointerup event is fired when a pointer is no longer active.
*/
POINTERUP = 0x02,
/**
* The pointermove event is fired when a pointer changes coordinates.
*/
POINTERMOVE = 0x04,
/**
* The pointerwheel event is fired when a mouse wheel has been rotated.
*/
POINTERWHEEL = 0x08,
/**
* The pointerpick event is fired when a mesh or sprite has been picked by the pointer.
*/
POINTERPICK = 0x10,
/**
* The pointertap event is fired when a the object has been touched and
* released without drag.
*/
POINTERTAP = 0x20,
/**
* The pointerdoubletap event is fired when a the object has been touched and released twice
* without drag.
*/
POINTERDOUBLETAP = 0x40,
}; // end of enum class PointerEventTypes
} // end of namespace BABYLON
#endif // end of BABYLON_EVENTS_POINTER_EVENT_TYPES_H
| 30.229167 | 100 | 0.71399 | [
"mesh",
"object"
] |
3f2ef4bafc97d775d04e52832699fa01379c33ec | 106,779 | c | C | SW/CreaminoSimulink/slprj/_sfprj/CreaminoSimulinkModel/_self/sfun/src/c2_CreaminoSimulinkModel.c | ArcesUnibo/creamino | d4b5ae3e244e4687ec7cb32c57e1ed2aaffbda1c | [
"MIT"
] | 10 | 2018-09-05T13:38:45.000Z | 2021-06-29T10:02:03.000Z | SW/CreaminoSimulink/slprj/_sfprj/CreaminoSimulinkModel/_self/sfun/src/c2_CreaminoSimulinkModel.c | ArcesUnibo/creamino | d4b5ae3e244e4687ec7cb32c57e1ed2aaffbda1c | [
"MIT"
] | null | null | null | SW/CreaminoSimulink/slprj/_sfprj/CreaminoSimulinkModel/_self/sfun/src/c2_CreaminoSimulinkModel.c | ArcesUnibo/creamino | d4b5ae3e244e4687ec7cb32c57e1ed2aaffbda1c | [
"MIT"
] | 1 | 2019-08-20T20:17:28.000Z | 2019-08-20T20:17:28.000Z | /* Include files */
#include <stddef.h>
#include "blas.h"
#include "CreaminoSimulinkModel_sfun.h"
#include "c2_CreaminoSimulinkModel.h"
#include "mwmathutil.h"
#define CHARTINSTANCE_CHARTNUMBER (chartInstance->chartNumber)
#define CHARTINSTANCE_INSTANCENUMBER (chartInstance->instanceNumber)
#include "CreaminoSimulinkModel_sfun_debug_macros.h"
#define _SF_MEX_LISTEN_FOR_CTRL_C(S) sf_mex_listen_for_ctrl_c(sfGlobalDebugInstanceStruct,S);
/* Type Definitions */
/* Named Constants */
#define CALL_EVENT (-1)
/* Variable Declarations */
/* Variable Definitions */
static real_T _sfTime_;
static const char * c2_debug_family_names[14] = { "ynop", "yF", "indice", "i",
"kk", "j", "u", "nargin", "nargout", "labels", "indiceGrigU2", "AnoP", "BnoP",
"yP" };
/* Function Declarations */
static void initialize_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void initialize_params_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void enable_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void disable_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void c2_update_debugger_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static const mxArray *get_sim_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void set_sim_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance, const mxArray *c2_st);
static void finalize_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void sf_gateway_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void mdl_start_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void c2_chartstep_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void initSimStructsc2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance);
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber, uint32_T c2_instanceNumber);
static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static void c2_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_b_yP, const char_T *c2_identifier, real_T
c2_c_y[6144]);
static void c2_b_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real_T c2_c_y[6144]);
static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static const mxArray *c2_e_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static real_T c2_c_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_f_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static void c2_d_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real32_T c2_c_y[16777216]);
static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static real32_T c2_e_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_g_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static void c2_f_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real_T c2_c_y[5587904]);
static void c2_e_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static const mxArray *c2_h_sf_marshallOut(void *chartInstanceVoid, real32_T
c2_b_inData_data[], int32_T c2_inData_sizes[2]);
static void c2_g_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real32_T c2_b_y_data[], int32_T c2_y_sizes[2]);
static void c2_f_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, real32_T c2_outData_data[],
int32_T c2_outData_sizes[2]);
static void c2_info_helper(const mxArray **c2_info);
static const mxArray *c2_emlrt_marshallOut(const char * c2_h_u);
static const mxArray *c2_b_emlrt_marshallOut(const uint32_T c2_h_u);
static real32_T c2_norm(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance,
real32_T c2_x[3]);
static real32_T c2_eml_xnrm2(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, real32_T c2_x[3]);
static void c2_below_threshold(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance);
static const mxArray *c2_i_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData);
static int32_T c2_h_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId);
static void c2_g_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData);
static uint8_T c2_i_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_b_is_active_c2_CreaminoSimulinkModel, const
char_T *c2_identifier);
static uint8_T c2_j_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId);
static void init_dsm_address_info(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance);
static void init_simulink_io_address(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance);
/* Function Definitions */
static void initialize_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
chartInstance->c2_sfEvent = CALL_EVENT;
_sfTime_ = sf_get_time(chartInstance->S);
chartInstance->c2_is_active_c2_CreaminoSimulinkModel = 0U;
}
static void initialize_params_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
(void)chartInstance;
}
static void enable_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
_sfTime_ = sf_get_time(chartInstance->S);
}
static void disable_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
_sfTime_ = sf_get_time(chartInstance->S);
}
static void c2_update_debugger_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
(void)chartInstance;
}
static const mxArray *get_sim_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
const mxArray *c2_st;
const mxArray *c2_c_y = NULL;
int32_T c2_i0;
real_T c2_h_u[6144];
const mxArray *c2_d_y = NULL;
uint8_T c2_hoistedGlobal;
uint8_T c2_i_u;
const mxArray *c2_e_y = NULL;
c2_st = NULL;
c2_st = NULL;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_createcellmatrix(2, 1), false);
for (c2_i0 = 0; c2_i0 < 6144; c2_i0++) {
c2_h_u[c2_i0] = (*chartInstance->c2_yP)[c2_i0];
}
c2_d_y = NULL;
sf_mex_assign(&c2_d_y, sf_mex_create("y", c2_h_u, 0, 0U, 1U, 0U, 2, 64, 96),
false);
sf_mex_setcell(c2_c_y, 0, c2_d_y);
c2_hoistedGlobal = chartInstance->c2_is_active_c2_CreaminoSimulinkModel;
c2_i_u = c2_hoistedGlobal;
c2_e_y = NULL;
sf_mex_assign(&c2_e_y, sf_mex_create("y", &c2_i_u, 3, 0U, 0U, 0U, 0), false);
sf_mex_setcell(c2_c_y, 1, c2_e_y);
sf_mex_assign(&c2_st, c2_c_y, false);
return c2_st;
}
static void set_sim_state_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance, const mxArray *c2_st)
{
const mxArray *c2_h_u;
real_T c2_dv0[6144];
int32_T c2_i1;
chartInstance->c2_doneDoubleBufferReInit = true;
c2_h_u = sf_mex_dup(c2_st);
c2_emlrt_marshallIn(chartInstance, sf_mex_dup(sf_mex_getcell(c2_h_u, 0)), "yP",
c2_dv0);
for (c2_i1 = 0; c2_i1 < 6144; c2_i1++) {
(*chartInstance->c2_yP)[c2_i1] = c2_dv0[c2_i1];
}
chartInstance->c2_is_active_c2_CreaminoSimulinkModel = c2_i_emlrt_marshallIn
(chartInstance, sf_mex_dup(sf_mex_getcell(c2_h_u, 1)),
"is_active_c2_CreaminoSimulinkModel");
sf_mex_destroy(&c2_h_u);
c2_update_debugger_state_c2_CreaminoSimulinkModel(chartInstance);
sf_mex_destroy(&c2_st);
}
static void finalize_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
(void)chartInstance;
}
static void sf_gateway_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
int32_T c2_i2;
int32_T c2_i3;
int32_T c2_i4;
int32_T c2_i5;
_SFD_SYMBOL_SCOPE_PUSH(0U, 0U);
_sfTime_ = sf_get_time(chartInstance->S);
_SFD_CC_CALL(CHART_ENTER_SFUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
for (c2_i2 = 0; c2_i2 < 16777216; c2_i2++) {
_SFD_DATA_RANGE_CHECK((real_T)(*chartInstance->c2_g_u)[c2_i2], 0U);
}
for (c2_i3 = 0; c2_i3 < 87311; c2_i3++) {
_SFD_DATA_RANGE_CHECK((real_T)(*chartInstance->c2_b_labels)[c2_i3], 1U);
}
for (c2_i4 = 0; c2_i4 < 87311; c2_i4++) {
_SFD_DATA_RANGE_CHECK((real_T)(*chartInstance->c2_b_indiceGrigU2)[c2_i4], 2U);
}
chartInstance->c2_sfEvent = CALL_EVENT;
c2_chartstep_c2_CreaminoSimulinkModel(chartInstance);
_SFD_SYMBOL_SCOPE_POP();
_SFD_CHECK_FOR_STATE_INCONSISTENCY(_CreaminoSimulinkModelMachineNumber_,
chartInstance->chartNumber, chartInstance->instanceNumber);
for (c2_i5 = 0; c2_i5 < 6144; c2_i5++) {
_SFD_DATA_RANGE_CHECK((*chartInstance->c2_yP)[c2_i5], 3U);
}
_SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c2_AnoP, 4U);
_SFD_DATA_RANGE_CHECK((real_T)*chartInstance->c2_BnoP, 5U);
}
static void mdl_start_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
(void)chartInstance;
}
static void c2_chartstep_c2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
real32_T c2_hoistedGlobal;
real32_T c2_b_hoistedGlobal;
int32_T c2_i6;
int32_T c2_i7;
int32_T c2_i8;
real32_T c2_b_AnoP;
real32_T c2_b_BnoP;
uint32_T c2_debug_family_var_map[14];
int32_T c2_ynop_sizes[2];
real_T c2_indice;
real_T c2_i;
real32_T c2_kk;
real_T c2_j;
real_T c2_nargin = 5.0;
real_T c2_nargout = 1.0;
real_T c2_b_yP[6144];
int32_T c2_i9;
int32_T c2_i10;
int32_T c2_i11;
int32_T c2_i12;
boolean_T c2_b0;
boolean_T c2_b1;
boolean_T c2_b2;
int32_T c2_i13;
boolean_T c2_b3;
boolean_T c2_b4;
boolean_T c2_b5;
int32_T c2_i14;
int32_T c2_loop_ub;
int32_T c2_i15;
int32_T c2_b_loop_ub;
int32_T c2_i16;
int32_T c2_i17;
int32_T c2_b_i;
real32_T c2_c_BnoP;
int32_T c2_i18;
int32_T c2_b_kk;
real32_T c2_ynop[3];
int32_T c2_i19;
int32_T c2_c_i;
int32_T c2_b_j;
int32_T c2_i20;
int32_T c2_i21;
boolean_T c2_b[87311];
int32_T c2_i22;
real_T c2_c_y[64];
int32_T c2_i23;
int32_T c2_i24;
int32_T c2_c_j;
int32_T c2_i25;
int32_T c2_i26;
_SFD_CC_CALL(CHART_ENTER_DURING_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
c2_hoistedGlobal = *chartInstance->c2_AnoP;
c2_b_hoistedGlobal = *chartInstance->c2_BnoP;
for (c2_i6 = 0; c2_i6 < 16777216; c2_i6++) {
chartInstance->c2_u[c2_i6] = (*chartInstance->c2_g_u)[c2_i6];
}
for (c2_i7 = 0; c2_i7 < 87311; c2_i7++) {
chartInstance->c2_labels[c2_i7] = (*chartInstance->c2_b_labels)[c2_i7];
}
for (c2_i8 = 0; c2_i8 < 87311; c2_i8++) {
chartInstance->c2_indiceGrigU2[c2_i8] = (*chartInstance->c2_b_indiceGrigU2)
[c2_i8];
}
c2_b_AnoP = c2_hoistedGlobal;
c2_b_BnoP = c2_b_hoistedGlobal;
_SFD_SYMBOL_SCOPE_PUSH_EML(0U, 14U, 15U, c2_debug_family_names,
c2_debug_family_var_map);
_SFD_SYMBOL_SCOPE_ADD_EML_DYN_IMPORTABLE(chartInstance->c2_ynop_data, (const
int32_T *)&c2_ynop_sizes, NULL, 0, 0, (void *)c2_h_sf_marshallOut, (void *)
c2_f_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(chartInstance->c2_yF, 1U,
c2_g_sf_marshallOut, c2_e_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_indice, 2U, c2_e_sf_marshallOut,
c2_b_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_i, 3U, c2_e_sf_marshallOut,
c2_b_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_kk, 4U, c2_b_sf_marshallOut,
c2_d_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_j, 5U, c2_e_sf_marshallOut,
c2_b_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(chartInstance->c2_b_u, MAX_uint32_T,
c2_f_sf_marshallOut, c2_c_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargin, 7U, c2_e_sf_marshallOut,
c2_b_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(&c2_nargout, 8U, c2_e_sf_marshallOut,
c2_b_sf_marshallIn);
_SFD_SYMBOL_SCOPE_ADD_EML(chartInstance->c2_u, 6U, c2_d_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML(chartInstance->c2_labels, 9U, c2_c_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML(chartInstance->c2_indiceGrigU2, 10U,
c2_c_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML(&c2_b_AnoP, 11U, c2_b_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML(&c2_b_BnoP, 12U, c2_b_sf_marshallOut);
_SFD_SYMBOL_SCOPE_ADD_EML_IMPORTABLE(c2_b_yP, 13U, c2_sf_marshallOut,
c2_sf_marshallIn);
CV_EML_FCN(0, 0);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 3);
c2_i9 = 0;
for (c2_i10 = 0; c2_i10 < 64; c2_i10++) {
c2_i11 = 0;
for (c2_i12 = 0; c2_i12 < 262144; c2_i12++) {
chartInstance->c2_b_u[c2_i12 + c2_i9] = chartInstance->c2_u[c2_i11 +
c2_i10];
c2_i11 += 64;
}
c2_i9 += 262144;
}
_SFD_SYMBOL_SWITCH(6U, 6U);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 4);
c2_b0 = (1.0F > c2_b_AnoP);
c2_b1 = c2_b0;
c2_b2 = c2_b1;
if (c2_b2) {
c2_i13 = 0;
} else {
c2_i13 = (int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
(real32_T)_SFD_INTEGER_CHECK("AnoP", (real_T)c2_b_AnoP), 1, 262144, 0, 0);
}
c2_b3 = (1.0F > c2_b_BnoP);
c2_b4 = c2_b3;
c2_b5 = c2_b4;
if (c2_b5) {
c2_i14 = 0;
} else {
c2_i14 = (int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("u", (int32_T)
(real32_T)_SFD_INTEGER_CHECK("BnoP", (real_T)c2_b_BnoP), 1, 64, 0, 0);
}
c2_ynop_sizes[0] = c2_i13;
c2_ynop_sizes[1] = c2_i14;
c2_loop_ub = c2_i14 - 1;
for (c2_i15 = 0; c2_i15 <= c2_loop_ub; c2_i15++) {
c2_b_loop_ub = c2_i13 - 1;
for (c2_i16 = 0; c2_i16 <= c2_b_loop_ub; c2_i16++) {
chartInstance->c2_ynop_data[c2_i16 + c2_ynop_sizes[0] * c2_i15] =
chartInstance->c2_b_u[c2_i16 + (c2_i15 << 18)];
}
}
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 5);
for (c2_i17 = 0; c2_i17 < 5587904; c2_i17++) {
chartInstance->c2_yF[c2_i17] = 0.0;
}
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 6);
c2_indice = 1.0;
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 8);
c2_i = 1.0;
c2_b_i = 0;
while (c2_b_i < 87311) {
c2_i = 1.0 + (real_T)c2_b_i;
CV_EML_FOR(0, 1, 0, 1);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 9);
c2_c_BnoP = c2_b_BnoP;
c2_i18 = (int32_T)c2_c_BnoP;
_SFD_FOR_LOOP_VECTOR_CHECK(1.0, 1.0, (real_T)c2_c_BnoP, mxSINGLE_CLASS,
c2_i18);
c2_kk = 1.0F;
c2_b_kk = 0;
while (c2_b_kk <= c2_i18 - 1) {
c2_kk = 1.0F + (real32_T)c2_b_kk;
CV_EML_FOR(0, 1, 1, 1);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 10);
c2_ynop[0] = chartInstance->c2_ynop_data[(_SFD_EML_ARRAY_BOUNDS_CHECK(
"ynop", (int32_T)c2_indice, 1, c2_ynop_sizes[0], 1, 0) + c2_ynop_sizes[0]
* ((int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("ynop", (int32_T)c2_kk,
1, c2_ynop_sizes[1], 2, 0) - 1)) - 1];
c2_ynop[1] = chartInstance->c2_ynop_data[(_SFD_EML_ARRAY_BOUNDS_CHECK(
"ynop", (int32_T)(c2_indice + 1.0), 1, c2_ynop_sizes[0], 1, 0) +
c2_ynop_sizes[0] * ((int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK(
"ynop", (int32_T)c2_kk, 1, c2_ynop_sizes[1], 2, 0) - 1)) - 1];
c2_ynop[2] = chartInstance->c2_ynop_data[(_SFD_EML_ARRAY_BOUNDS_CHECK(
"ynop", (int32_T)(c2_indice + 2.0), 1, c2_ynop_sizes[0], 1, 0) +
c2_ynop_sizes[0] * ((int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK(
"ynop", (int32_T)c2_kk, 1, c2_ynop_sizes[1], 2, 0) - 1)) - 1];
chartInstance->c2_yF[((int32_T)(real32_T)_SFD_EML_ARRAY_BOUNDS_CHECK("yF",
(int32_T)c2_kk, 1, 64, 1, 0) + (((int32_T)c2_i - 1)
<< 6)) - 1] = c2_norm(chartInstance, c2_ynop);
c2_b_kk++;
_SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
}
CV_EML_FOR(0, 1, 1, 0);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 12);
c2_indice += 3.0;
c2_b_i++;
_SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
}
CV_EML_FOR(0, 1, 0, 0);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 15);
for (c2_i19 = 0; c2_i19 < 6144; c2_i19++) {
c2_b_yP[c2_i19] = 0.0;
}
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 17);
c2_i = 1.0;
c2_c_i = 0;
while (c2_c_i < 64) {
c2_i = 1.0 + (real_T)c2_c_i;
CV_EML_FOR(0, 1, 2, 1);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 18);
c2_j = 1.0;
c2_b_j = 0;
while (c2_b_j < 96) {
c2_j = 1.0 + (real_T)c2_b_j;
CV_EML_FOR(0, 1, 3, 1);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, 19);
for (c2_i20 = 0; c2_i20 < 5587904; c2_i20++) {
chartInstance->c2_a[c2_i20] = chartInstance->c2_yF[c2_i20];
}
for (c2_i21 = 0; c2_i21 < 87311; c2_i21++) {
c2_b[c2_i21] = ((real_T)chartInstance->c2_labels[c2_i21] == c2_i);
}
for (c2_i22 = 0; c2_i22 < 64; c2_i22++) {
c2_c_y[c2_i22] = 0.0;
c2_i23 = 0;
for (c2_i24 = 0; c2_i24 < 87311; c2_i24++) {
c2_c_y[c2_i22] += chartInstance->c2_a[c2_i23 + c2_i22] * (real_T)
c2_b[c2_i24];
c2_i23 += 64;
}
}
c2_c_j = (int32_T)c2_j - 1;
for (c2_i25 = 0; c2_i25 < 64; c2_i25++) {
c2_b_yP[c2_i25 + (c2_c_j << 6)] = c2_c_y[c2_i25];
}
c2_b_j++;
_SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
}
CV_EML_FOR(0, 1, 3, 0);
c2_c_i++;
_SF_MEX_LISTEN_FOR_CTRL_C(chartInstance->S);
}
CV_EML_FOR(0, 1, 2, 0);
_SFD_EML_CALL(0U, chartInstance->c2_sfEvent, -19);
_SFD_SYMBOL_SCOPE_POP();
for (c2_i26 = 0; c2_i26 < 6144; c2_i26++) {
(*chartInstance->c2_yP)[c2_i26] = c2_b_yP[c2_i26];
}
_SFD_CC_CALL(EXIT_OUT_OF_FUNCTION_TAG, 0U, chartInstance->c2_sfEvent);
}
static void initSimStructsc2_CreaminoSimulinkModel
(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance)
{
(void)chartInstance;
}
static void init_script_number_translation(uint32_T c2_machineNumber, uint32_T
c2_chartNumber, uint32_T c2_instanceNumber)
{
(void)c2_machineNumber;
(void)c2_chartNumber;
(void)c2_instanceNumber;
}
static const mxArray *c2_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_i27;
int32_T c2_i28;
int32_T c2_i29;
real_T c2_f_inData[6144];
int32_T c2_i30;
int32_T c2_i31;
int32_T c2_i32;
real_T c2_h_u[6144];
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_i27 = 0;
for (c2_i28 = 0; c2_i28 < 96; c2_i28++) {
for (c2_i29 = 0; c2_i29 < 64; c2_i29++) {
c2_f_inData[c2_i29 + c2_i27] = (*(real_T (*)[6144])c2_e_inData)[c2_i29 +
c2_i27];
}
c2_i27 += 64;
}
c2_i30 = 0;
for (c2_i31 = 0; c2_i31 < 96; c2_i31++) {
for (c2_i32 = 0; c2_i32 < 64; c2_i32++) {
c2_h_u[c2_i32 + c2_i30] = c2_f_inData[c2_i32 + c2_i30];
}
c2_i30 += 64;
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_h_u, 0, 0U, 1U, 0U, 2, 64, 96),
false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static void c2_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_b_yP, const char_T *c2_identifier, real_T
c2_c_y[6144])
{
emlrtMsgIdentifier c2_thisId;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_yP), &c2_thisId, c2_c_y);
sf_mex_destroy(&c2_b_yP);
}
static void c2_b_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real_T c2_c_y[6144])
{
real_T c2_dv1[6144];
int32_T c2_i33;
(void)chartInstance;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), c2_dv1, 1, 0, 0U, 1, 0U, 2, 64,
96);
for (c2_i33 = 0; c2_i33 < 6144; c2_i33++) {
c2_c_y[c2_i33] = c2_dv1[c2_i33];
}
sf_mex_destroy(&c2_h_u);
}
static void c2_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_b_yP;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
real_T c2_c_y[6144];
int32_T c2_i34;
int32_T c2_i35;
int32_T c2_i36;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_b_yP = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_b_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_yP), &c2_thisId, c2_c_y);
sf_mex_destroy(&c2_b_yP);
c2_i34 = 0;
for (c2_i35 = 0; c2_i35 < 96; c2_i35++) {
for (c2_i36 = 0; c2_i36 < 64; c2_i36++) {
(*(real_T (*)[6144])c2_outData)[c2_i36 + c2_i34] = c2_c_y[c2_i36 + c2_i34];
}
c2_i34 += 64;
}
sf_mex_destroy(&c2_mxArrayInData);
}
static const mxArray *c2_b_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
real32_T c2_h_u;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_h_u = *(real32_T *)c2_e_inData;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_h_u, 1, 0U, 0U, 0U, 0), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static const mxArray *c2_c_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_i37;
int32_T c2_i38;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
for (c2_i37 = 0; c2_i37 < 87311; c2_i37++) {
chartInstance->c2_d_inData[c2_i37] = (*(real32_T (*)[87311])c2_e_inData)
[c2_i37];
}
for (c2_i38 = 0; c2_i38 < 87311; c2_i38++) {
chartInstance->c2_f_u[c2_i38] = chartInstance->c2_d_inData[c2_i38];
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", chartInstance->c2_f_u, 1, 0U, 1U, 0U,
2, 1, 87311), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static const mxArray *c2_d_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_i39;
int32_T c2_i40;
int32_T c2_i41;
int32_T c2_i42;
int32_T c2_i43;
int32_T c2_i44;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_i39 = 0;
for (c2_i40 = 0; c2_i40 < 262144; c2_i40++) {
for (c2_i41 = 0; c2_i41 < 64; c2_i41++) {
chartInstance->c2_b_inData[c2_i41 + c2_i39] = (*(real32_T (*)[16777216])
c2_e_inData)[c2_i41 + c2_i39];
}
c2_i39 += 64;
}
c2_i42 = 0;
for (c2_i43 = 0; c2_i43 < 262144; c2_i43++) {
for (c2_i44 = 0; c2_i44 < 64; c2_i44++) {
chartInstance->c2_d_u[c2_i44 + c2_i42] = chartInstance->c2_b_inData[c2_i44
+ c2_i42];
}
c2_i42 += 64;
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", chartInstance->c2_d_u, 1, 0U, 1U, 0U,
2, 64, 262144), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static const mxArray *c2_e_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
real_T c2_h_u;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_h_u = *(real_T *)c2_e_inData;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_h_u, 0, 0U, 0U, 0U, 0), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static real_T c2_c_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId)
{
real_T c2_c_y;
real_T c2_d0;
(void)chartInstance;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), &c2_d0, 1, 0, 0U, 0, 0U, 0);
c2_c_y = c2_d0;
sf_mex_destroy(&c2_h_u);
return c2_c_y;
}
static void c2_b_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_nargout;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
real_T c2_c_y;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_nargout = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_c_y = c2_c_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_nargout),
&c2_thisId);
sf_mex_destroy(&c2_nargout);
*(real_T *)c2_outData = c2_c_y;
sf_mex_destroy(&c2_mxArrayInData);
}
static const mxArray *c2_f_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_i45;
int32_T c2_i46;
int32_T c2_i47;
int32_T c2_i48;
int32_T c2_i49;
int32_T c2_i50;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_i45 = 0;
for (c2_i46 = 0; c2_i46 < 64; c2_i46++) {
for (c2_i47 = 0; c2_i47 < 262144; c2_i47++) {
chartInstance->c2_inData[c2_i47 + c2_i45] = (*(real32_T (*)[16777216])
c2_e_inData)[c2_i47 + c2_i45];
}
c2_i45 += 262144;
}
c2_i48 = 0;
for (c2_i49 = 0; c2_i49 < 64; c2_i49++) {
for (c2_i50 = 0; c2_i50 < 262144; c2_i50++) {
chartInstance->c2_c_u[c2_i50 + c2_i48] = chartInstance->c2_inData[c2_i50 +
c2_i48];
}
c2_i48 += 262144;
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", chartInstance->c2_c_u, 1, 0U, 1U, 0U,
2, 262144, 64), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static void c2_d_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real32_T c2_c_y[16777216])
{
int32_T c2_i51;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), chartInstance->c2_fv0, 1, 1, 0U,
1, 0U, 2, 262144, 64);
for (c2_i51 = 0; c2_i51 < 16777216; c2_i51++) {
c2_c_y[c2_i51] = chartInstance->c2_fv0[c2_i51];
}
sf_mex_destroy(&c2_h_u);
}
static void c2_c_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_h_u;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
int32_T c2_i52;
int32_T c2_i53;
int32_T c2_i54;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_h_u = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_d_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_h_u), &c2_thisId,
chartInstance->c2_y);
sf_mex_destroy(&c2_h_u);
c2_i52 = 0;
for (c2_i53 = 0; c2_i53 < 64; c2_i53++) {
for (c2_i54 = 0; c2_i54 < 262144; c2_i54++) {
(*(real32_T (*)[16777216])c2_outData)[c2_i54 + c2_i52] =
chartInstance->c2_y[c2_i54 + c2_i52];
}
c2_i52 += 262144;
}
sf_mex_destroy(&c2_mxArrayInData);
}
static real32_T c2_e_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId)
{
real32_T c2_c_y;
real32_T c2_f0;
(void)chartInstance;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), &c2_f0, 1, 1, 0U, 0, 0U, 0);
c2_c_y = c2_f0;
sf_mex_destroy(&c2_h_u);
return c2_c_y;
}
static void c2_d_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_kk;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
real32_T c2_c_y;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_kk = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_c_y = c2_e_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_kk), &c2_thisId);
sf_mex_destroy(&c2_kk);
*(real32_T *)c2_outData = c2_c_y;
sf_mex_destroy(&c2_mxArrayInData);
}
static const mxArray *c2_g_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_i55;
int32_T c2_i56;
int32_T c2_i57;
int32_T c2_i58;
int32_T c2_i59;
int32_T c2_i60;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_i55 = 0;
for (c2_i56 = 0; c2_i56 < 87311; c2_i56++) {
for (c2_i57 = 0; c2_i57 < 64; c2_i57++) {
chartInstance->c2_c_inData[c2_i57 + c2_i55] = (*(real_T (*)[5587904])
c2_e_inData)[c2_i57 + c2_i55];
}
c2_i55 += 64;
}
c2_i58 = 0;
for (c2_i59 = 0; c2_i59 < 87311; c2_i59++) {
for (c2_i60 = 0; c2_i60 < 64; c2_i60++) {
chartInstance->c2_e_u[c2_i60 + c2_i58] = chartInstance->c2_c_inData[c2_i60
+ c2_i58];
}
c2_i58 += 64;
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", chartInstance->c2_e_u, 0, 0U, 1U, 0U,
2, 64, 87311), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static void c2_f_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real_T c2_c_y[5587904])
{
int32_T c2_i61;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), chartInstance->c2_dv2, 1, 0, 0U,
1, 0U, 2, 64, 87311);
for (c2_i61 = 0; c2_i61 < 5587904; c2_i61++) {
c2_c_y[c2_i61] = chartInstance->c2_dv2[c2_i61];
}
sf_mex_destroy(&c2_h_u);
}
static void c2_e_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_b_yF;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
int32_T c2_i62;
int32_T c2_i63;
int32_T c2_i64;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_b_yF = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_f_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_yF), &c2_thisId,
chartInstance->c2_b_y);
sf_mex_destroy(&c2_b_yF);
c2_i62 = 0;
for (c2_i63 = 0; c2_i63 < 87311; c2_i63++) {
for (c2_i64 = 0; c2_i64 < 64; c2_i64++) {
(*(real_T (*)[5587904])c2_outData)[c2_i64 + c2_i62] =
chartInstance->c2_b_y[c2_i64 + c2_i62];
}
c2_i62 += 64;
}
sf_mex_destroy(&c2_mxArrayInData);
}
static const mxArray *c2_h_sf_marshallOut(void *chartInstanceVoid, real32_T
c2_b_inData_data[], int32_T c2_inData_sizes[2])
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_u_sizes[2];
int32_T c2_h_u;
int32_T c2_i_u;
int32_T c2_e_inData;
int32_T c2_f_inData;
int32_T c2_b_inData_sizes;
int32_T c2_loop_ub;
int32_T c2_i65;
int32_T c2_b_loop_ub;
int32_T c2_i66;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_u_sizes[0] = c2_inData_sizes[0];
c2_u_sizes[1] = c2_inData_sizes[1];
c2_h_u = c2_u_sizes[0];
c2_i_u = c2_u_sizes[1];
c2_e_inData = c2_inData_sizes[0];
c2_f_inData = c2_inData_sizes[1];
c2_b_inData_sizes = c2_e_inData * c2_f_inData;
c2_loop_ub = c2_e_inData * c2_f_inData - 1;
for (c2_i65 = 0; c2_i65 <= c2_loop_ub; c2_i65++) {
chartInstance->c2_inData_data[c2_i65] = c2_b_inData_data[c2_i65];
}
c2_b_loop_ub = c2_b_inData_sizes - 1;
for (c2_i66 = 0; c2_i66 <= c2_b_loop_ub; c2_i66++) {
chartInstance->c2_u_data[c2_i66] = chartInstance->c2_inData_data[c2_i66];
}
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", chartInstance->c2_u_data, 1, 0U, 1U,
0U, 2, c2_u_sizes[0], c2_u_sizes[1]), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static void c2_g_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId,
real32_T c2_b_y_data[], int32_T c2_y_sizes[2])
{
int32_T c2_i67;
uint32_T c2_uv0[2];
int32_T c2_i68;
boolean_T c2_bv0[2];
int32_T c2_tmp_sizes[2];
int32_T c2_c_y;
int32_T c2_d_y;
int32_T c2_loop_ub;
int32_T c2_i69;
for (c2_i67 = 0; c2_i67 < 2; c2_i67++) {
c2_uv0[c2_i67] = 262144U + (uint32_T)(-262080 * c2_i67);
}
for (c2_i68 = 0; c2_i68 < 2; c2_i68++) {
c2_bv0[c2_i68] = true;
}
sf_mex_import_vs(c2_parentId, sf_mex_dup(c2_h_u), chartInstance->c2_tmp_data,
1, 1, 0U, 1, 0U, 2, c2_bv0, c2_uv0, c2_tmp_sizes);
c2_y_sizes[0] = c2_tmp_sizes[0];
c2_y_sizes[1] = c2_tmp_sizes[1];
c2_c_y = c2_y_sizes[0];
c2_d_y = c2_y_sizes[1];
c2_loop_ub = c2_tmp_sizes[0] * c2_tmp_sizes[1] - 1;
for (c2_i69 = 0; c2_i69 <= c2_loop_ub; c2_i69++) {
c2_b_y_data[c2_i69] = chartInstance->c2_tmp_data[c2_i69];
}
sf_mex_destroy(&c2_h_u);
}
static void c2_f_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, real32_T c2_outData_data[],
int32_T c2_outData_sizes[2])
{
const mxArray *c2_ynop;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
int32_T c2_y_sizes[2];
int32_T c2_loop_ub;
int32_T c2_i70;
int32_T c2_b_loop_ub;
int32_T c2_i71;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_ynop = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_g_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_ynop), &c2_thisId,
chartInstance->c2_y_data, c2_y_sizes);
sf_mex_destroy(&c2_ynop);
c2_outData_sizes[0] = c2_y_sizes[0];
c2_outData_sizes[1] = c2_y_sizes[1];
c2_loop_ub = c2_y_sizes[1] - 1;
for (c2_i70 = 0; c2_i70 <= c2_loop_ub; c2_i70++) {
c2_b_loop_ub = c2_y_sizes[0] - 1;
for (c2_i71 = 0; c2_i71 <= c2_b_loop_ub; c2_i71++) {
c2_outData_data[c2_i71 + c2_outData_sizes[0] * c2_i70] =
chartInstance->c2_y_data[c2_i71 + c2_y_sizes[0] * c2_i70];
}
}
sf_mex_destroy(&c2_mxArrayInData);
}
const mxArray *sf_c2_CreaminoSimulinkModel_get_eml_resolved_functions_info(void)
{
const mxArray *c2_nameCaptureInfo = NULL;
c2_nameCaptureInfo = NULL;
sf_mex_assign(&c2_nameCaptureInfo, sf_mex_createstruct("structure", 2, 30, 1),
false);
c2_info_helper(&c2_nameCaptureInfo);
sf_mex_emlrtNameCapturePostProcessR2012a(&c2_nameCaptureInfo);
return c2_nameCaptureInfo;
}
static void c2_info_helper(const mxArray **c2_info)
{
const mxArray *c2_rhs0 = NULL;
const mxArray *c2_lhs0 = NULL;
const mxArray *c2_rhs1 = NULL;
const mxArray *c2_lhs1 = NULL;
const mxArray *c2_rhs2 = NULL;
const mxArray *c2_lhs2 = NULL;
const mxArray *c2_rhs3 = NULL;
const mxArray *c2_lhs3 = NULL;
const mxArray *c2_rhs4 = NULL;
const mxArray *c2_lhs4 = NULL;
const mxArray *c2_rhs5 = NULL;
const mxArray *c2_lhs5 = NULL;
const mxArray *c2_rhs6 = NULL;
const mxArray *c2_lhs6 = NULL;
const mxArray *c2_rhs7 = NULL;
const mxArray *c2_lhs7 = NULL;
const mxArray *c2_rhs8 = NULL;
const mxArray *c2_lhs8 = NULL;
const mxArray *c2_rhs9 = NULL;
const mxArray *c2_lhs9 = NULL;
const mxArray *c2_rhs10 = NULL;
const mxArray *c2_lhs10 = NULL;
const mxArray *c2_rhs11 = NULL;
const mxArray *c2_lhs11 = NULL;
const mxArray *c2_rhs12 = NULL;
const mxArray *c2_lhs12 = NULL;
const mxArray *c2_rhs13 = NULL;
const mxArray *c2_lhs13 = NULL;
const mxArray *c2_rhs14 = NULL;
const mxArray *c2_lhs14 = NULL;
const mxArray *c2_rhs15 = NULL;
const mxArray *c2_lhs15 = NULL;
const mxArray *c2_rhs16 = NULL;
const mxArray *c2_lhs16 = NULL;
const mxArray *c2_rhs17 = NULL;
const mxArray *c2_lhs17 = NULL;
const mxArray *c2_rhs18 = NULL;
const mxArray *c2_lhs18 = NULL;
const mxArray *c2_rhs19 = NULL;
const mxArray *c2_lhs19 = NULL;
const mxArray *c2_rhs20 = NULL;
const mxArray *c2_lhs20 = NULL;
const mxArray *c2_rhs21 = NULL;
const mxArray *c2_lhs21 = NULL;
const mxArray *c2_rhs22 = NULL;
const mxArray *c2_lhs22 = NULL;
const mxArray *c2_rhs23 = NULL;
const mxArray *c2_lhs23 = NULL;
const mxArray *c2_rhs24 = NULL;
const mxArray *c2_lhs24 = NULL;
const mxArray *c2_rhs25 = NULL;
const mxArray *c2_lhs25 = NULL;
const mxArray *c2_rhs26 = NULL;
const mxArray *c2_lhs26 = NULL;
const mxArray *c2_rhs27 = NULL;
const mxArray *c2_lhs27 = NULL;
const mxArray *c2_rhs28 = NULL;
const mxArray *c2_lhs28 = NULL;
const mxArray *c2_rhs29 = NULL;
const mxArray *c2_lhs29 = NULL;
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 0);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("length"), "name", "name", 0);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 0);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/length.m"), "resolved",
"resolved", 0);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1303146206U), "fileTimeLo",
"fileTimeLo", 0);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 0);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 0);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 0);
sf_mex_assign(&c2_rhs0, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs0, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs0), "rhs", "rhs", 0);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs0), "lhs", "lhs", 0);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 1);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("norm"), "name", "name", 1);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 1);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/matfun/norm.m"), "resolved",
"resolved", 1);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363713868U), "fileTimeLo",
"fileTimeLo", 1);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 1);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 1);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 1);
sf_mex_assign(&c2_rhs1, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs1, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs1), "rhs", "rhs", 1);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs1), "lhs", "lhs", 1);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/matfun/norm.m!genpnorm"),
"context", "context", 2);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_index_class"), "name",
"name", 2);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 2);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_index_class.m"),
"resolved", "resolved", 2);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1323170578U), "fileTimeLo",
"fileTimeLo", 2);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 2);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 2);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 2);
sf_mex_assign(&c2_rhs2, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs2, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs2), "rhs", "rhs", 2);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs2), "lhs", "lhs", 2);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/matfun/norm.m!genpnorm"),
"context", "context", 3);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"coder.internal.isBuiltInNumeric"), "name", "name", 3);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
"dominantType", 3);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
"resolved", "resolved", 3);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1395931856U), "fileTimeLo",
"fileTimeLo", 3);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 3);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 3);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 3);
sf_mex_assign(&c2_rhs3, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs3, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs3), "rhs", "rhs", 3);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs3), "lhs", "lhs", 3);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/matfun/norm.m!genpnorm"),
"context", "context", 4);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_xnrm2"), "name", "name", 4);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 4);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xnrm2.m"),
"resolved", "resolved", 4);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1375980692U), "fileTimeLo",
"fileTimeLo", 4);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 4);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 4);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 4);
sf_mex_assign(&c2_rhs4, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs4, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs4), "rhs", "rhs", 4);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs4), "lhs", "lhs", 4);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xnrm2.m"), "context",
"context", 5);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.blas.inline"),
"name", "name", 5);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 5);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/inline.p"),
"resolved", "resolved", 5);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1410807772U), "fileTimeLo",
"fileTimeLo", 5);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 5);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 5);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 5);
sf_mex_assign(&c2_rhs5, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs5, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs5), "rhs", "rhs", 5);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs5), "lhs", "lhs", 5);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/blas/eml_xnrm2.m"), "context",
"context", 6);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.blas.xnrm2"),
"name", "name", 6);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 6);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/xnrm2.p"),
"resolved", "resolved", 6);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1410807770U), "fileTimeLo",
"fileTimeLo", 6);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 6);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 6);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 6);
sf_mex_assign(&c2_rhs6, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs6, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs6), "rhs", "rhs", 6);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs6), "lhs", "lhs", 6);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/xnrm2.p"),
"context", "context", 7);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"coder.internal.blas.use_refblas"), "name", "name", 7);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 7);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/use_refblas.p"),
"resolved", "resolved", 7);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1410807770U), "fileTimeLo",
"fileTimeLo", 7);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 7);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 7);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 7);
sf_mex_assign(&c2_rhs7, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs7, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs7), "rhs", "rhs", 7);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs7), "lhs", "lhs", 7);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/xnrm2.p!below_threshold"),
"context", "context", 8);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.blas.threshold"),
"name", "name", 8);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 8);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/threshold.p"),
"resolved", "resolved", 8);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1410807772U), "fileTimeLo",
"fileTimeLo", 8);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 8);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 8);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 8);
sf_mex_assign(&c2_rhs8, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs8, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs8), "rhs", "rhs", 8);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs8), "lhs", "lhs", 8);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/threshold.p"),
"context", "context", 9);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_switch_helper"), "name",
"name", 9);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 9);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_switch_helper.m"),
"resolved", "resolved", 9);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1393330858U), "fileTimeLo",
"fileTimeLo", 9);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 9);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 9);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 9);
sf_mex_assign(&c2_rhs9, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs9, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs9), "rhs", "rhs", 9);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs9), "lhs", "lhs", 9);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+blas/xnrm2.p"),
"context", "context", 10);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.refblas.xnrm2"),
"name", "name", 10);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 10);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"resolved", "resolved", 10);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1410807772U), "fileTimeLo",
"fileTimeLo", 10);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 10);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 10);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 10);
sf_mex_assign(&c2_rhs10, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs10, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs10), "rhs", "rhs",
10);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs10), "lhs", "lhs",
10);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 11);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("realmin"), "name", "name", 11);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 11);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/realmin.m"), "resolved",
"resolved", 11);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1307651242U), "fileTimeLo",
"fileTimeLo", 11);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 11);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 11);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 11);
sf_mex_assign(&c2_rhs11, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs11, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs11), "rhs", "rhs",
11);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs11), "lhs", "lhs",
11);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/realmin.m"), "context",
"context", 12);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_realmin"), "name", "name",
12);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 12);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_realmin.m"), "resolved",
"resolved", 12);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1307651244U), "fileTimeLo",
"fileTimeLo", 12);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 12);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 12);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 12);
sf_mex_assign(&c2_rhs12, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs12, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs12), "rhs", "rhs",
12);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs12), "lhs", "lhs",
12);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_realmin.m"), "context",
"context", 13);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_float_model"), "name",
"name", 13);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 13);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_float_model.m"),
"resolved", "resolved", 13);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1326727996U), "fileTimeLo",
"fileTimeLo", 13);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 13);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 13);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 13);
sf_mex_assign(&c2_rhs13, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs13, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs13), "rhs", "rhs",
13);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs13), "lhs", "lhs",
13);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 14);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexMinus"),
"name", "name", 14);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
"dominantType", 14);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/indexMinus.m"),
"resolved", "resolved", 14);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1372583160U), "fileTimeLo",
"fileTimeLo", 14);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 14);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 14);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 14);
sf_mex_assign(&c2_rhs14, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs14, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs14), "rhs", "rhs",
14);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs14), "lhs", "lhs",
14);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 15);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexTimes"),
"name", "name", 15);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexInt"),
"dominantType", "dominantType", 15);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/indexTimes.m"),
"resolved", "resolved", 15);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1372583160U), "fileTimeLo",
"fileTimeLo", 15);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 15);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 15);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 15);
sf_mex_assign(&c2_rhs15, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs15, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs15), "rhs", "rhs",
15);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs15), "lhs", "lhs",
15);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 16);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexPlus"),
"name", "name", 16);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexInt"),
"dominantType", "dominantType", 16);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/indexPlus.m"),
"resolved", "resolved", 16);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1372583160U), "fileTimeLo",
"fileTimeLo", 16);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 16);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 16);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 16);
sf_mex_assign(&c2_rhs16, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs16, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs16), "rhs", "rhs",
16);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs16), "lhs", "lhs",
16);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 17);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"eml_int_forloop_overflow_check"), "name", "name", 17);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 17);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m"),
"resolved", "resolved", 17);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1397257422U), "fileTimeLo",
"fileTimeLo", 17);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 17);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 17);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 17);
sf_mex_assign(&c2_rhs17, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs17, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs17), "rhs", "rhs",
17);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs17), "lhs", "lhs",
17);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m!eml_int_forloop_overflow_check_helper"),
"context", "context", 18);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("isfi"), "name", "name", 18);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("coder.internal.indexInt"),
"dominantType", "dominantType", 18);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/fixedpoint/isfi.m"), "resolved",
"resolved", 18);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1346510358U), "fileTimeLo",
"fileTimeLo", 18);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 18);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 18);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 18);
sf_mex_assign(&c2_rhs18, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs18, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs18), "rhs", "rhs",
18);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs18), "lhs", "lhs",
18);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/fixedpoint/isfi.m"), "context",
"context", 19);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("isnumerictype"), "name",
"name", 19);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 19);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/fixedpoint/isnumerictype.m"), "resolved",
"resolved", 19);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1398875598U), "fileTimeLo",
"fileTimeLo", 19);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 19);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 19);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 19);
sf_mex_assign(&c2_rhs19, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs19, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs19), "rhs", "rhs",
19);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs19), "lhs", "lhs",
19);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m!eml_int_forloop_overflow_check_helper"),
"context", "context", 20);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("intmax"), "name", "name", 20);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 20);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmax.m"), "resolved",
"resolved", 20);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1362261882U), "fileTimeLo",
"fileTimeLo", 20);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 20);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 20);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 20);
sf_mex_assign(&c2_rhs20, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs20, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs20), "rhs", "rhs",
20);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs20), "lhs", "lhs",
20);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmax.m"), "context",
"context", 21);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_switch_helper"), "name",
"name", 21);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 21);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_switch_helper.m"),
"resolved", "resolved", 21);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1393330858U), "fileTimeLo",
"fileTimeLo", 21);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 21);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 21);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 21);
sf_mex_assign(&c2_rhs21, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs21, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs21), "rhs", "rhs",
21);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs21), "lhs", "lhs",
21);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_int_forloop_overflow_check.m!eml_int_forloop_overflow_check_helper"),
"context", "context", 22);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("intmin"), "name", "name", 22);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("char"), "dominantType",
"dominantType", 22);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmin.m"), "resolved",
"resolved", 22);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1362261882U), "fileTimeLo",
"fileTimeLo", 22);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 22);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 22);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 22);
sf_mex_assign(&c2_rhs22, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs22, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs22), "rhs", "rhs",
22);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs22), "lhs", "lhs",
22);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elmat/intmin.m"), "context",
"context", 23);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_switch_helper"), "name",
"name", 23);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 23);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/eml/eml_switch_helper.m"),
"resolved", "resolved", 23);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1393330858U), "fileTimeLo",
"fileTimeLo", 23);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 23);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 23);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 23);
sf_mex_assign(&c2_rhs23, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs23, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs23), "rhs", "rhs",
23);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs23), "lhs", "lhs",
23);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/coder/coder/+coder/+internal/+refblas/xnrm2.p"),
"context", "context", 24);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("abs"), "name", "name", 24);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 24);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"), "resolved",
"resolved", 24);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1363713852U), "fileTimeLo",
"fileTimeLo", 24);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 24);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 24);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 24);
sf_mex_assign(&c2_rhs24, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs24, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs24), "rhs", "rhs",
24);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs24), "lhs", "lhs",
24);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"), "context",
"context", 25);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"coder.internal.isBuiltInNumeric"), "name", "name", 25);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 25);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
"resolved", "resolved", 25);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1395931856U), "fileTimeLo",
"fileTimeLo", 25);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 25);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 25);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 25);
sf_mex_assign(&c2_rhs25, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs25, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs25), "rhs", "rhs",
25);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs25), "lhs", "lhs",
25);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/abs.m"), "context",
"context", 26);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_scalar_abs"), "name",
"name", 26);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("single"), "dominantType",
"dominantType", 26);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/elfun/eml_scalar_abs.m"),
"resolved", "resolved", 26);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1286818712U), "fileTimeLo",
"fileTimeLo", 26);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 26);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 26);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 26);
sf_mex_assign(&c2_rhs26, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs26, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs26), "rhs", "rhs",
26);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs26), "lhs", "lhs",
26);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "context", "context", 27);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("eml_mtimes_helper"), "name",
"name", 27);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(""), "dominantType",
"dominantType", 27);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/eml_mtimes_helper.m"),
"resolved", "resolved", 27);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1383877294U), "fileTimeLo",
"fileTimeLo", 27);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 27);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 27);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 27);
sf_mex_assign(&c2_rhs27, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs27, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs27), "rhs", "rhs",
27);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs27), "lhs", "lhs",
27);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/eml_mtimes_helper.m!common_checks"),
"context", "context", 28);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"coder.internal.isBuiltInNumeric"), "name", "name", 28);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("double"), "dominantType",
"dominantType", 28);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
"resolved", "resolved", 28);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1395931856U), "fileTimeLo",
"fileTimeLo", 28);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 28);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 28);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 28);
sf_mex_assign(&c2_rhs28, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs28, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs28), "rhs", "rhs",
28);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs28), "lhs", "lhs",
28);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/eml/lib/matlab/ops/eml_mtimes_helper.m!common_checks"),
"context", "context", 29);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"coder.internal.isBuiltInNumeric"), "name", "name", 29);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut("logical"), "dominantType",
"dominantType", 29);
sf_mex_addfield(*c2_info, c2_emlrt_marshallOut(
"[ILXE]$matlabroot$/toolbox/shared/coder/coder/+coder/+internal/isBuiltInNumeric.m"),
"resolved", "resolved", 29);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(1395931856U), "fileTimeLo",
"fileTimeLo", 29);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "fileTimeHi",
"fileTimeHi", 29);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeLo",
"mFileTimeLo", 29);
sf_mex_addfield(*c2_info, c2_b_emlrt_marshallOut(0U), "mFileTimeHi",
"mFileTimeHi", 29);
sf_mex_assign(&c2_rhs29, sf_mex_createcellmatrix(0, 1), false);
sf_mex_assign(&c2_lhs29, sf_mex_createcellmatrix(0, 1), false);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_rhs29), "rhs", "rhs",
29);
sf_mex_addfield(*c2_info, sf_mex_duplicatearraysafe(&c2_lhs29), "lhs", "lhs",
29);
sf_mex_destroy(&c2_rhs0);
sf_mex_destroy(&c2_lhs0);
sf_mex_destroy(&c2_rhs1);
sf_mex_destroy(&c2_lhs1);
sf_mex_destroy(&c2_rhs2);
sf_mex_destroy(&c2_lhs2);
sf_mex_destroy(&c2_rhs3);
sf_mex_destroy(&c2_lhs3);
sf_mex_destroy(&c2_rhs4);
sf_mex_destroy(&c2_lhs4);
sf_mex_destroy(&c2_rhs5);
sf_mex_destroy(&c2_lhs5);
sf_mex_destroy(&c2_rhs6);
sf_mex_destroy(&c2_lhs6);
sf_mex_destroy(&c2_rhs7);
sf_mex_destroy(&c2_lhs7);
sf_mex_destroy(&c2_rhs8);
sf_mex_destroy(&c2_lhs8);
sf_mex_destroy(&c2_rhs9);
sf_mex_destroy(&c2_lhs9);
sf_mex_destroy(&c2_rhs10);
sf_mex_destroy(&c2_lhs10);
sf_mex_destroy(&c2_rhs11);
sf_mex_destroy(&c2_lhs11);
sf_mex_destroy(&c2_rhs12);
sf_mex_destroy(&c2_lhs12);
sf_mex_destroy(&c2_rhs13);
sf_mex_destroy(&c2_lhs13);
sf_mex_destroy(&c2_rhs14);
sf_mex_destroy(&c2_lhs14);
sf_mex_destroy(&c2_rhs15);
sf_mex_destroy(&c2_lhs15);
sf_mex_destroy(&c2_rhs16);
sf_mex_destroy(&c2_lhs16);
sf_mex_destroy(&c2_rhs17);
sf_mex_destroy(&c2_lhs17);
sf_mex_destroy(&c2_rhs18);
sf_mex_destroy(&c2_lhs18);
sf_mex_destroy(&c2_rhs19);
sf_mex_destroy(&c2_lhs19);
sf_mex_destroy(&c2_rhs20);
sf_mex_destroy(&c2_lhs20);
sf_mex_destroy(&c2_rhs21);
sf_mex_destroy(&c2_lhs21);
sf_mex_destroy(&c2_rhs22);
sf_mex_destroy(&c2_lhs22);
sf_mex_destroy(&c2_rhs23);
sf_mex_destroy(&c2_lhs23);
sf_mex_destroy(&c2_rhs24);
sf_mex_destroy(&c2_lhs24);
sf_mex_destroy(&c2_rhs25);
sf_mex_destroy(&c2_lhs25);
sf_mex_destroy(&c2_rhs26);
sf_mex_destroy(&c2_lhs26);
sf_mex_destroy(&c2_rhs27);
sf_mex_destroy(&c2_lhs27);
sf_mex_destroy(&c2_rhs28);
sf_mex_destroy(&c2_lhs28);
sf_mex_destroy(&c2_rhs29);
sf_mex_destroy(&c2_lhs29);
}
static const mxArray *c2_emlrt_marshallOut(const char * c2_h_u)
{
const mxArray *c2_c_y = NULL;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", c2_h_u, 15, 0U, 0U, 0U, 2, 1, strlen
(c2_h_u)), false);
return c2_c_y;
}
static const mxArray *c2_b_emlrt_marshallOut(const uint32_T c2_h_u)
{
const mxArray *c2_c_y = NULL;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_h_u, 7, 0U, 0U, 0U, 0), false);
return c2_c_y;
}
static real32_T c2_norm(SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance,
real32_T c2_x[3])
{
int32_T c2_i72;
real32_T c2_b_x[3];
for (c2_i72 = 0; c2_i72 < 3; c2_i72++) {
c2_b_x[c2_i72] = c2_x[c2_i72];
}
return c2_eml_xnrm2(chartInstance, c2_b_x);
}
static real32_T c2_eml_xnrm2(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, real32_T c2_x[3])
{
real32_T c2_c_y;
real32_T c2_scale;
int32_T c2_k;
int32_T c2_b_k;
real32_T c2_b_x;
real32_T c2_c_x;
real32_T c2_absxk;
real32_T c2_t;
c2_below_threshold(chartInstance);
c2_c_y = 0.0F;
c2_scale = 1.17549435E-38F;
for (c2_k = 1; c2_k < 4; c2_k++) {
c2_b_k = c2_k - 1;
c2_b_x = c2_x[c2_b_k];
c2_c_x = c2_b_x;
c2_absxk = muSingleScalarAbs(c2_c_x);
if (c2_absxk > c2_scale) {
c2_t = c2_scale / c2_absxk;
c2_c_y = 1.0F + c2_c_y * c2_t * c2_t;
c2_scale = c2_absxk;
} else {
c2_t = c2_absxk / c2_scale;
c2_c_y += c2_t * c2_t;
}
}
return c2_scale * muSingleScalarSqrt(c2_c_y);
}
static void c2_below_threshold(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance)
{
(void)chartInstance;
}
static const mxArray *c2_i_sf_marshallOut(void *chartInstanceVoid, void
*c2_e_inData)
{
const mxArray *c2_mxArrayOutData = NULL;
int32_T c2_h_u;
const mxArray *c2_c_y = NULL;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_mxArrayOutData = NULL;
c2_h_u = *(int32_T *)c2_e_inData;
c2_c_y = NULL;
sf_mex_assign(&c2_c_y, sf_mex_create("y", &c2_h_u, 6, 0U, 0U, 0U, 0), false);
sf_mex_assign(&c2_mxArrayOutData, c2_c_y, false);
return c2_mxArrayOutData;
}
static int32_T c2_h_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId)
{
int32_T c2_c_y;
int32_T c2_i73;
(void)chartInstance;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), &c2_i73, 1, 6, 0U, 0, 0U, 0);
c2_c_y = c2_i73;
sf_mex_destroy(&c2_h_u);
return c2_c_y;
}
static void c2_g_sf_marshallIn(void *chartInstanceVoid, const mxArray
*c2_mxArrayInData, const char_T *c2_varName, void *c2_outData)
{
const mxArray *c2_b_sfEvent;
const char_T *c2_identifier;
emlrtMsgIdentifier c2_thisId;
int32_T c2_c_y;
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)chartInstanceVoid;
c2_b_sfEvent = sf_mex_dup(c2_mxArrayInData);
c2_identifier = c2_varName;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_c_y = c2_h_emlrt_marshallIn(chartInstance, sf_mex_dup(c2_b_sfEvent),
&c2_thisId);
sf_mex_destroy(&c2_b_sfEvent);
*(int32_T *)c2_outData = c2_c_y;
sf_mex_destroy(&c2_mxArrayInData);
}
static uint8_T c2_i_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_b_is_active_c2_CreaminoSimulinkModel, const
char_T *c2_identifier)
{
uint8_T c2_c_y;
emlrtMsgIdentifier c2_thisId;
c2_thisId.fIdentifier = c2_identifier;
c2_thisId.fParent = NULL;
c2_c_y = c2_j_emlrt_marshallIn(chartInstance, sf_mex_dup
(c2_b_is_active_c2_CreaminoSimulinkModel), &c2_thisId);
sf_mex_destroy(&c2_b_is_active_c2_CreaminoSimulinkModel);
return c2_c_y;
}
static uint8_T c2_j_emlrt_marshallIn(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance, const mxArray *c2_h_u, const emlrtMsgIdentifier *c2_parentId)
{
uint8_T c2_c_y;
uint8_T c2_u0;
(void)chartInstance;
sf_mex_import(c2_parentId, sf_mex_dup(c2_h_u), &c2_u0, 1, 3, 0U, 0, 0U, 0);
c2_c_y = c2_u0;
sf_mex_destroy(&c2_h_u);
return c2_c_y;
}
static void init_dsm_address_info(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance)
{
(void)chartInstance;
}
static void init_simulink_io_address(SFc2_CreaminoSimulinkModelInstanceStruct
*chartInstance)
{
chartInstance->c2_g_u = (real32_T (*)[16777216])ssGetInputPortSignal_wrapper
(chartInstance->S, 0);
chartInstance->c2_b_labels = (real32_T (*)[87311])ssGetInputPortSignal_wrapper
(chartInstance->S, 1);
chartInstance->c2_b_indiceGrigU2 = (real32_T (*)[87311])
ssGetInputPortSignal_wrapper(chartInstance->S, 2);
chartInstance->c2_yP = (real_T (*)[6144])ssGetOutputPortSignal_wrapper
(chartInstance->S, 1);
chartInstance->c2_AnoP = (real32_T *)ssGetInputPortSignal_wrapper
(chartInstance->S, 3);
chartInstance->c2_BnoP = (real32_T *)ssGetInputPortSignal_wrapper
(chartInstance->S, 4);
}
/* SFunction Glue Code */
#ifdef utFree
#undef utFree
#endif
#ifdef utMalloc
#undef utMalloc
#endif
#ifdef __cplusplus
extern "C" void *utMalloc(size_t size);
extern "C" void utFree(void*);
#else
extern void *utMalloc(size_t size);
extern void utFree(void*);
#endif
void sf_c2_CreaminoSimulinkModel_get_check_sum(mxArray *plhs[])
{
((real_T *)mxGetPr((plhs[0])))[0] = (real_T)(2470822246U);
((real_T *)mxGetPr((plhs[0])))[1] = (real_T)(239372095U);
((real_T *)mxGetPr((plhs[0])))[2] = (real_T)(1378144027U);
((real_T *)mxGetPr((plhs[0])))[3] = (real_T)(3739137644U);
}
mxArray* sf_c2_CreaminoSimulinkModel_get_post_codegen_info(void);
mxArray *sf_c2_CreaminoSimulinkModel_get_autoinheritance_info(void)
{
const char *autoinheritanceFields[] = { "checksum", "inputs", "parameters",
"outputs", "locals", "postCodegenInfo" };
mxArray *mxAutoinheritanceInfo = mxCreateStructMatrix(1, 1, sizeof
(autoinheritanceFields)/sizeof(autoinheritanceFields[0]),
autoinheritanceFields);
{
mxArray *mxChecksum = mxCreateString("oj8GhLasLo0ZZLCHidFUh");
mxSetField(mxAutoinheritanceInfo,0,"checksum",mxChecksum);
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,5,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(64);
pr[1] = (double)(262144);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(9));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(87311);
mxSetField(mxData,1,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(9));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,1,"type",mxType);
}
mxSetField(mxData,1,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(87311);
mxSetField(mxData,2,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(9));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,2,"type",mxType);
}
mxSetField(mxData,2,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,3,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(9));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,3,"type",mxType);
}
mxSetField(mxData,3,"complexity",mxCreateDoubleScalar(0));
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(1);
pr[1] = (double)(1);
mxSetField(mxData,4,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(9));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,4,"type",mxType);
}
mxSetField(mxData,4,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"inputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"parameters",mxCreateDoubleMatrix(0,0,
mxREAL));
}
{
const char *dataFields[] = { "size", "type", "complexity" };
mxArray *mxData = mxCreateStructMatrix(1,1,3,dataFields);
{
mxArray *mxSize = mxCreateDoubleMatrix(1,2,mxREAL);
double *pr = mxGetPr(mxSize);
pr[0] = (double)(64);
pr[1] = (double)(96);
mxSetField(mxData,0,"size",mxSize);
}
{
const char *typeFields[] = { "base", "fixpt" };
mxArray *mxType = mxCreateStructMatrix(1,1,2,typeFields);
mxSetField(mxType,0,"base",mxCreateDoubleScalar(10));
mxSetField(mxType,0,"fixpt",mxCreateDoubleMatrix(0,0,mxREAL));
mxSetField(mxData,0,"type",mxType);
}
mxSetField(mxData,0,"complexity",mxCreateDoubleScalar(0));
mxSetField(mxAutoinheritanceInfo,0,"outputs",mxData);
}
{
mxSetField(mxAutoinheritanceInfo,0,"locals",mxCreateDoubleMatrix(0,0,mxREAL));
}
{
mxArray* mxPostCodegenInfo =
sf_c2_CreaminoSimulinkModel_get_post_codegen_info();
mxSetField(mxAutoinheritanceInfo,0,"postCodegenInfo",mxPostCodegenInfo);
}
return(mxAutoinheritanceInfo);
}
mxArray *sf_c2_CreaminoSimulinkModel_third_party_uses_info(void)
{
mxArray * mxcell3p = mxCreateCellMatrix(1,0);
return(mxcell3p);
}
mxArray *sf_c2_CreaminoSimulinkModel_jit_fallback_info(void)
{
const char *infoFields[] = { "fallbackType", "fallbackReason",
"incompatibleSymbol", };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 3, infoFields);
mxArray *fallbackReason = mxCreateString("feature_off");
mxArray *incompatibleSymbol = mxCreateString("");
mxArray *fallbackType = mxCreateString("early");
mxSetField(mxInfo, 0, infoFields[0], fallbackType);
mxSetField(mxInfo, 0, infoFields[1], fallbackReason);
mxSetField(mxInfo, 0, infoFields[2], incompatibleSymbol);
return mxInfo;
}
mxArray *sf_c2_CreaminoSimulinkModel_updateBuildInfo_args_info(void)
{
mxArray *mxBIArgs = mxCreateCellMatrix(1,0);
return mxBIArgs;
}
mxArray* sf_c2_CreaminoSimulinkModel_get_post_codegen_info(void)
{
const char* fieldNames[] = { "exportedFunctionsUsedByThisChart",
"exportedFunctionsChecksum" };
mwSize dims[2] = { 1, 1 };
mxArray* mxPostCodegenInfo = mxCreateStructArray(2, dims, sizeof(fieldNames)/
sizeof(fieldNames[0]), fieldNames);
{
mxArray* mxExportedFunctionsChecksum = mxCreateString("");
mwSize exp_dims[2] = { 0, 1 };
mxArray* mxExportedFunctionsUsedByThisChart = mxCreateCellArray(2, exp_dims);
mxSetField(mxPostCodegenInfo, 0, "exportedFunctionsUsedByThisChart",
mxExportedFunctionsUsedByThisChart);
mxSetField(mxPostCodegenInfo, 0, "exportedFunctionsChecksum",
mxExportedFunctionsChecksum);
}
return mxPostCodegenInfo;
}
static const mxArray *sf_get_sim_state_info_c2_CreaminoSimulinkModel(void)
{
const char *infoFields[] = { "chartChecksum", "varInfo" };
mxArray *mxInfo = mxCreateStructMatrix(1, 1, 2, infoFields);
const char *infoEncStr[] = {
"100 S1x2'type','srcId','name','auxInfo'{{M[1],M[5],T\"yP\",},{M[8],M[0],T\"is_active_c2_CreaminoSimulinkModel\",}}"
};
mxArray *mxVarInfo = sf_mex_decode_encoded_mx_struct_array(infoEncStr, 2, 10);
mxArray *mxChecksum = mxCreateDoubleMatrix(1, 4, mxREAL);
sf_c2_CreaminoSimulinkModel_get_check_sum(&mxChecksum);
mxSetField(mxInfo, 0, infoFields[0], mxChecksum);
mxSetField(mxInfo, 0, infoFields[1], mxVarInfo);
return mxInfo;
}
static void chart_debug_initialization(SimStruct *S, unsigned int
fullDebuggerInitialization)
{
if (!sim_mode_is_rtw_gen(S)) {
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)
chartInfo->chartInstance;
if (ssIsFirstInitCond(S) && fullDebuggerInitialization==1) {
/* do this only if simulation is starting */
{
unsigned int chartAlreadyPresent;
chartAlreadyPresent = sf_debug_initialize_chart
(sfGlobalDebugInstanceStruct,
_CreaminoSimulinkModelMachineNumber_,
2,
1,
1,
0,
6,
0,
0,
0,
0,
0,
&(chartInstance->chartNumber),
&(chartInstance->instanceNumber),
(void *)S);
/* Each instance must initialize its own list of scripts */
init_script_number_translation(_CreaminoSimulinkModelMachineNumber_,
chartInstance->chartNumber,chartInstance->instanceNumber);
if (chartAlreadyPresent==0) {
/* this is the first instance */
sf_debug_set_chart_disable_implicit_casting
(sfGlobalDebugInstanceStruct,_CreaminoSimulinkModelMachineNumber_,
chartInstance->chartNumber,1);
sf_debug_set_chart_event_thresholds(sfGlobalDebugInstanceStruct,
_CreaminoSimulinkModelMachineNumber_,
chartInstance->chartNumber,
0,
0,
0);
_SFD_SET_DATA_PROPS(0,1,1,0,"u");
_SFD_SET_DATA_PROPS(1,1,1,0,"labels");
_SFD_SET_DATA_PROPS(2,1,1,0,"indiceGrigU2");
_SFD_SET_DATA_PROPS(3,2,0,1,"yP");
_SFD_SET_DATA_PROPS(4,1,1,0,"AnoP");
_SFD_SET_DATA_PROPS(5,1,1,0,"BnoP");
_SFD_STATE_INFO(0,0,2);
_SFD_CH_SUBSTATE_COUNT(0);
_SFD_CH_SUBSTATE_DECOMP(0);
}
_SFD_CV_INIT_CHART(0,0,0,0);
{
_SFD_CV_INIT_STATE(0,0,0,0,0,0,NULL,NULL);
}
_SFD_CV_INIT_TRANS(0,0,NULL,NULL,0,NULL);
/* Initialization of MATLAB Function Model Coverage */
_SFD_CV_INIT_EML(0,1,1,0,0,0,0,4,0,0,0);
_SFD_CV_INIT_EML_FCN(0,0,"eML_blk_kernel",0,-1,424);
_SFD_CV_INIT_EML_FOR(0,1,0,127,156,302);
_SFD_CV_INIT_EML_FOR(0,1,1,164,178,269);
_SFD_CV_INIT_EML_FOR(0,1,2,338,349,424);
_SFD_CV_INIT_EML_FOR(0,1,3,357,368,416);
{
unsigned int dimVector[2];
dimVector[0]= 64;
dimVector[1]= 262144;
_SFD_SET_DATA_COMPILED_PROPS(0,SF_SINGLE,2,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_d_sf_marshallOut,(MexInFcnForType)NULL);
}
{
unsigned int dimVector[2];
dimVector[0]= 1;
dimVector[1]= 87311;
_SFD_SET_DATA_COMPILED_PROPS(1,SF_SINGLE,2,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshallOut,(MexInFcnForType)NULL);
}
{
unsigned int dimVector[2];
dimVector[0]= 1;
dimVector[1]= 87311;
_SFD_SET_DATA_COMPILED_PROPS(2,SF_SINGLE,2,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_c_sf_marshallOut,(MexInFcnForType)NULL);
}
{
unsigned int dimVector[2];
dimVector[0]= 64;
dimVector[1]= 96;
_SFD_SET_DATA_COMPILED_PROPS(3,SF_DOUBLE,2,&(dimVector[0]),0,0,0,0.0,
1.0,0,0,(MexFcnForType)c2_sf_marshallOut,(MexInFcnForType)
c2_sf_marshallIn);
}
_SFD_SET_DATA_COMPILED_PROPS(4,SF_SINGLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
_SFD_SET_DATA_COMPILED_PROPS(5,SF_SINGLE,0,NULL,0,0,0,0.0,1.0,0,0,
(MexFcnForType)c2_b_sf_marshallOut,(MexInFcnForType)NULL);
_SFD_SET_DATA_VALUE_PTR(0U, *chartInstance->c2_g_u);
_SFD_SET_DATA_VALUE_PTR(1U, *chartInstance->c2_b_labels);
_SFD_SET_DATA_VALUE_PTR(2U, *chartInstance->c2_b_indiceGrigU2);
_SFD_SET_DATA_VALUE_PTR(3U, *chartInstance->c2_yP);
_SFD_SET_DATA_VALUE_PTR(4U, chartInstance->c2_AnoP);
_SFD_SET_DATA_VALUE_PTR(5U, chartInstance->c2_BnoP);
}
} else {
sf_debug_reset_current_state_configuration(sfGlobalDebugInstanceStruct,
_CreaminoSimulinkModelMachineNumber_,chartInstance->chartNumber,
chartInstance->instanceNumber);
}
}
}
static const char* sf_get_instance_specialization(void)
{
return "PRml3fFe3Q7EM9YDM6gDQC";
}
static void sf_opaque_initialize_c2_CreaminoSimulinkModel(void *chartInstanceVar)
{
chart_debug_initialization(((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar)->S,0);
initialize_params_c2_CreaminoSimulinkModel
((SFc2_CreaminoSimulinkModelInstanceStruct*) chartInstanceVar);
initialize_c2_CreaminoSimulinkModel((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_enable_c2_CreaminoSimulinkModel(void *chartInstanceVar)
{
enable_c2_CreaminoSimulinkModel((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_disable_c2_CreaminoSimulinkModel(void *chartInstanceVar)
{
disable_c2_CreaminoSimulinkModel((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar);
}
static void sf_opaque_gateway_c2_CreaminoSimulinkModel(void *chartInstanceVar)
{
sf_gateway_c2_CreaminoSimulinkModel((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar);
}
static const mxArray* sf_opaque_get_sim_state_c2_CreaminoSimulinkModel(SimStruct*
S)
{
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
return get_sim_state_c2_CreaminoSimulinkModel
((SFc2_CreaminoSimulinkModelInstanceStruct*)chartInfo->chartInstance);/* raw sim ctx */
}
static void sf_opaque_set_sim_state_c2_CreaminoSimulinkModel(SimStruct* S, const
mxArray *st)
{
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
set_sim_state_c2_CreaminoSimulinkModel
((SFc2_CreaminoSimulinkModelInstanceStruct*)chartInfo->chartInstance, st);
}
static void sf_opaque_terminate_c2_CreaminoSimulinkModel(void *chartInstanceVar)
{
if (chartInstanceVar!=NULL) {
SimStruct *S = ((SFc2_CreaminoSimulinkModelInstanceStruct*) chartInstanceVar)
->S;
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
sf_clear_rtw_identifier(S);
unload_CreaminoSimulinkModel_optimization_info();
}
finalize_c2_CreaminoSimulinkModel((SFc2_CreaminoSimulinkModelInstanceStruct*)
chartInstanceVar);
utFree(chartInstanceVar);
if (crtInfo != NULL) {
utFree(crtInfo);
}
ssSetUserData(S,NULL);
}
}
static void sf_opaque_init_subchart_simstructs(void *chartInstanceVar)
{
initSimStructsc2_CreaminoSimulinkModel
((SFc2_CreaminoSimulinkModelInstanceStruct*) chartInstanceVar);
}
extern unsigned int sf_machine_global_initializer_called(void);
static void mdlProcessParameters_c2_CreaminoSimulinkModel(SimStruct *S)
{
int i;
for (i=0;i<ssGetNumRunTimeParams(S);i++) {
if (ssGetSFcnParamTunable(S,i)) {
ssUpdateDlgParamAsRunTimeParam(S,i);
}
}
if (sf_machine_global_initializer_called()) {
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)(ssGetUserData(S));
ChartInfoStruct * chartInfo = (ChartInfoStruct *)(crtInfo->instanceInfo);
initialize_params_c2_CreaminoSimulinkModel
((SFc2_CreaminoSimulinkModelInstanceStruct*)(chartInfo->chartInstance));
}
}
static void mdlSetWorkWidths_c2_CreaminoSimulinkModel(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S) || sim_mode_is_external(S)) {
mxArray *infoStruct = load_CreaminoSimulinkModel_optimization_info();
int_T chartIsInlinable =
(int_T)sf_is_chart_inlinable(sf_get_instance_specialization(),infoStruct,2);
ssSetStateflowIsInlinable(S,chartIsInlinable);
ssSetRTWCG(S,sf_rtw_info_uint_prop(sf_get_instance_specialization(),
infoStruct,2,"RTWCG"));
ssSetEnableFcnIsTrivial(S,1);
ssSetDisableFcnIsTrivial(S,1);
ssSetNotMultipleInlinable(S,sf_rtw_info_uint_prop
(sf_get_instance_specialization(),infoStruct,2,
"gatewayCannotBeInlinedMultipleTimes"));
sf_update_buildInfo(sf_get_instance_specialization(),infoStruct,2);
if (chartIsInlinable) {
ssSetInputPortOptimOpts(S, 0, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 1, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 2, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 3, SS_REUSABLE_AND_LOCAL);
ssSetInputPortOptimOpts(S, 4, SS_REUSABLE_AND_LOCAL);
sf_mark_chart_expressionable_inputs(S,sf_get_instance_specialization(),
infoStruct,2,5);
sf_mark_chart_reusable_outputs(S,sf_get_instance_specialization(),
infoStruct,2,1);
}
{
unsigned int outPortIdx;
for (outPortIdx=1; outPortIdx<=1; ++outPortIdx) {
ssSetOutputPortOptimizeInIR(S, outPortIdx, 1U);
}
}
{
unsigned int inPortIdx;
for (inPortIdx=0; inPortIdx < 5; ++inPortIdx) {
ssSetInputPortOptimizeInIR(S, inPortIdx, 1U);
}
}
sf_set_rtw_dwork_info(S,sf_get_instance_specialization(),infoStruct,2);
ssSetHasSubFunctions(S,!(chartIsInlinable));
} else {
}
ssSetOptions(S,ssGetOptions(S)|SS_OPTION_WORKS_WITH_CODE_REUSE);
ssSetChecksum0(S,(2423719198U));
ssSetChecksum1(S,(3122352849U));
ssSetChecksum2(S,(1342266898U));
ssSetChecksum3(S,(3822448398U));
ssSetmdlDerivatives(S, NULL);
ssSetExplicitFCSSCtrl(S,1);
ssSupportsMultipleExecInstances(S,1);
}
static void mdlRTW_c2_CreaminoSimulinkModel(SimStruct *S)
{
if (sim_mode_is_rtw_gen(S)) {
ssWriteRTWStrParam(S, "StateflowChartType", "Embedded MATLAB");
}
}
static void mdlStart_c2_CreaminoSimulinkModel(SimStruct *S)
{
SFc2_CreaminoSimulinkModelInstanceStruct *chartInstance;
ChartRunTimeInfo * crtInfo = (ChartRunTimeInfo *)utMalloc(sizeof
(ChartRunTimeInfo));
chartInstance = (SFc2_CreaminoSimulinkModelInstanceStruct *)utMalloc(sizeof
(SFc2_CreaminoSimulinkModelInstanceStruct));
memset(chartInstance, 0, sizeof(SFc2_CreaminoSimulinkModelInstanceStruct));
if (chartInstance==NULL) {
sf_mex_error_message("Could not allocate memory for chart instance.");
}
chartInstance->chartInfo.chartInstance = chartInstance;
chartInstance->chartInfo.isEMLChart = 1;
chartInstance->chartInfo.chartInitialized = 0;
chartInstance->chartInfo.sFunctionGateway =
sf_opaque_gateway_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.initializeChart =
sf_opaque_initialize_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.terminateChart =
sf_opaque_terminate_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.enableChart =
sf_opaque_enable_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.disableChart =
sf_opaque_disable_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.getSimState =
sf_opaque_get_sim_state_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.setSimState =
sf_opaque_set_sim_state_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.getSimStateInfo =
sf_get_sim_state_info_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.zeroCrossings = NULL;
chartInstance->chartInfo.outputs = NULL;
chartInstance->chartInfo.derivatives = NULL;
chartInstance->chartInfo.mdlRTW = mdlRTW_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.mdlStart = mdlStart_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.mdlSetWorkWidths =
mdlSetWorkWidths_c2_CreaminoSimulinkModel;
chartInstance->chartInfo.extModeExec = NULL;
chartInstance->chartInfo.restoreLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.restoreBeforeLastMajorStepConfiguration = NULL;
chartInstance->chartInfo.storeCurrentConfiguration = NULL;
chartInstance->chartInfo.callAtomicSubchartUserFcn = NULL;
chartInstance->chartInfo.callAtomicSubchartAutoFcn = NULL;
chartInstance->chartInfo.debugInstance = sfGlobalDebugInstanceStruct;
chartInstance->S = S;
crtInfo->checksum = SF_RUNTIME_INFO_CHECKSUM;
crtInfo->instanceInfo = (&(chartInstance->chartInfo));
crtInfo->isJITEnabled = false;
crtInfo->compiledInfo = NULL;
ssSetUserData(S,(void *)(crtInfo)); /* register the chart instance with simstruct */
init_dsm_address_info(chartInstance);
init_simulink_io_address(chartInstance);
if (!sim_mode_is_rtw_gen(S)) {
}
sf_opaque_init_subchart_simstructs(chartInstance->chartInfo.chartInstance);
chart_debug_initialization(S,1);
}
void c2_CreaminoSimulinkModel_method_dispatcher(SimStruct *S, int_T method, void
*data)
{
switch (method) {
case SS_CALL_MDL_START:
mdlStart_c2_CreaminoSimulinkModel(S);
break;
case SS_CALL_MDL_SET_WORK_WIDTHS:
mdlSetWorkWidths_c2_CreaminoSimulinkModel(S);
break;
case SS_CALL_MDL_PROCESS_PARAMETERS:
mdlProcessParameters_c2_CreaminoSimulinkModel(S);
break;
default:
/* Unhandled method */
sf_mex_error_message("Stateflow Internal Error:\n"
"Error calling c2_CreaminoSimulinkModel_method_dispatcher.\n"
"Can't handle method %d.\n", method);
break;
}
}
| 39.72433 | 124 | 0.705682 | [
"model"
] |
3f389b5709a94da1b2ae7a761ca3b6f35f00aaa1 | 6,016 | h | C | cwp/include/tencentcloud/cwp/v20180228/model/AssetNetworkCardInfo.h | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 43 | 2019-08-14T08:14:12.000Z | 2022-03-30T12:35:09.000Z | cwp/include/tencentcloud/cwp/v20180228/model/AssetNetworkCardInfo.h | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 12 | 2019-07-15T10:44:59.000Z | 2021-11-02T12:35:00.000Z | cwp/include/tencentcloud/cwp/v20180228/model/AssetNetworkCardInfo.h | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 28 | 2019-07-12T09:06:22.000Z | 2022-03-30T08:04:18.000Z | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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.
*/
#ifndef TENCENTCLOUD_CWP_V20180228_MODEL_ASSETNETWORKCARDINFO_H_
#define TENCENTCLOUD_CWP_V20180228_MODEL_ASSETNETWORKCARDINFO_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
#include <tencentcloud/core/AbstractModel.h>
namespace TencentCloud
{
namespace Cwp
{
namespace V20180228
{
namespace Model
{
/**
* 资产管理网卡信息
*/
class AssetNetworkCardInfo : public AbstractModel
{
public:
AssetNetworkCardInfo();
~AssetNetworkCardInfo() = default;
void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const;
CoreInternalOutcome Deserialize(const rapidjson::Value &value);
/**
* 获取网卡名称
* @return Name 网卡名称
*/
std::string GetName() const;
/**
* 设置网卡名称
* @param Name 网卡名称
*/
void SetName(const std::string& _name);
/**
* 判断参数 Name 是否已赋值
* @return Name 是否已赋值
*/
bool NameHasBeenSet() const;
/**
* 获取Ipv4对应IP
* @return Ip Ipv4对应IP
*/
std::string GetIp() const;
/**
* 设置Ipv4对应IP
* @param Ip Ipv4对应IP
*/
void SetIp(const std::string& _ip);
/**
* 判断参数 Ip 是否已赋值
* @return Ip 是否已赋值
*/
bool IpHasBeenSet() const;
/**
* 获取网关
* @return GateWay 网关
*/
std::string GetGateWay() const;
/**
* 设置网关
* @param GateWay 网关
*/
void SetGateWay(const std::string& _gateWay);
/**
* 判断参数 GateWay 是否已赋值
* @return GateWay 是否已赋值
*/
bool GateWayHasBeenSet() const;
/**
* 获取MAC地址
* @return Mac MAC地址
*/
std::string GetMac() const;
/**
* 设置MAC地址
* @param Mac MAC地址
*/
void SetMac(const std::string& _mac);
/**
* 判断参数 Mac 是否已赋值
* @return Mac 是否已赋值
*/
bool MacHasBeenSet() const;
/**
* 获取Ipv6对应IP
* @return Ipv6 Ipv6对应IP
*/
std::string GetIpv6() const;
/**
* 设置Ipv6对应IP
* @param Ipv6 Ipv6对应IP
*/
void SetIpv6(const std::string& _ipv6);
/**
* 判断参数 Ipv6 是否已赋值
* @return Ipv6 是否已赋值
*/
bool Ipv6HasBeenSet() const;
/**
* 获取DNS服务器
* @return DnsServer DNS服务器
*/
std::string GetDnsServer() const;
/**
* 设置DNS服务器
* @param DnsServer DNS服务器
*/
void SetDnsServer(const std::string& _dnsServer);
/**
* 判断参数 DnsServer 是否已赋值
* @return DnsServer 是否已赋值
*/
bool DnsServerHasBeenSet() const;
private:
/**
* 网卡名称
*/
std::string m_name;
bool m_nameHasBeenSet;
/**
* Ipv4对应IP
*/
std::string m_ip;
bool m_ipHasBeenSet;
/**
* 网关
*/
std::string m_gateWay;
bool m_gateWayHasBeenSet;
/**
* MAC地址
*/
std::string m_mac;
bool m_macHasBeenSet;
/**
* Ipv6对应IP
*/
std::string m_ipv6;
bool m_ipv6HasBeenSet;
/**
* DNS服务器
*/
std::string m_dnsServer;
bool m_dnsServerHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_CWP_V20180228_MODEL_ASSETNETWORKCARDINFO_H_
| 29.782178 | 116 | 0.39262 | [
"vector",
"model"
] |
3f3a5f1ed31ee67b7edcce348976f20198972d25 | 2,091 | h | C | src/utility/wavefront_geometry.h | influenza/c8 | 2cc34f384cedce9626e76be8ea22e5967db1b69b | [
"BSD-3-Clause"
] | null | null | null | src/utility/wavefront_geometry.h | influenza/c8 | 2cc34f384cedce9626e76be8ea22e5967db1b69b | [
"BSD-3-Clause"
] | null | null | null | src/utility/wavefront_geometry.h | influenza/c8 | 2cc34f384cedce9626e76be8ea22e5967db1b69b | [
"BSD-3-Clause"
] | null | null | null | #ifndef _C8_WAVEFRONT_GEOMETRY
#define _C8_WAVEFRONT_GEOMETRY
#include "globals.h"
#include "geometry.h"
/* An element of a wavefront geometry object
*/
typedef struct { size_t num_elements; double values[4]; } wf_element;
/* A wavefront face entry comprises indices into the positions, texture coords,
* and normals collection for the mesh.
*/
typedef struct {
int position_entry;
int tex_coord_entry;
int normal_entry;
} wf_face_entry;
/* A wavefront face may be 3 elements (a triangle) or 4 (a quad).
*/
typedef struct {
size_t num_elements;
wf_face_entry entries[4];
} wf_face;
/* Load the scene described by the geometry file at `resource_path`. The
* `meshes_out` argument will point to an array of mesh pointers with its
* size indicated by `nmeshes_out`.
*
* This is the main entry point to scene loading
*/
sd_result load_wavefront_scene(const char *resource_path,
mesh **meshes_out, size_t *nmeshes_out);
/* More granular functionality follows */
/* Given a line of input text of the form "v 1.0 1.0 1.0" where the "1.0"
* values are floats, read the x, y, z, entries into the provided wf_element
* struct.
*/
void read_position(const char* input, wf_element *out);
/* Given a line of input text of the form "vt 1.0 1.0" where the "1.0"
* values are floats, read the U, V entries into the provided
* wf_element struct.
*/
void read_tex_coord(const char* input, wf_element *out);
/* Given a line of input text of the form "vn 1.0 1.0 1.0" where the "1.0"
* values are floats, read the i, j, k, entries into the provided wf_element
* struct.
*/
void read_normal(const char* input, wf_element *out);
/* Given a line of input text of one of the following forms:
* f 2/1 3/2 4/3 (position and texcoord only)
* f 2//1 3//2 4//3 (position and normal only)
* f 2/1/1 3/1/2 4/1/3 (position, texcoord, and normal)
* Read the specified element indices into the provided face object.
* Note: a face may be made of 3 or 4 entries.
*/
void read_face(const char* input, wf_face *out);
#endif
| 33.190476 | 79 | 0.7011 | [
"mesh",
"geometry",
"object"
] |
3f3c2dc35582ffdf2e24d515daa747a2b5512f52 | 4,936 | h | C | lib/inc/evolution.h | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | 3 | 2021-05-14T15:03:03.000Z | 2021-12-05T08:31:38.000Z | lib/inc/evolution.h | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | null | null | null | lib/inc/evolution.h | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | 3 | 2020-08-13T15:44:05.000Z | 2021-06-07T16:16:53.000Z | /****************************************************************************
** Copyright (c) 2017 Adrian Schneider
**
** 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.
**
*****************************************************************************/
#ifndef _EVOLUTION_H_
#define _EVOLUTION_H_
#include "simulation.h"
#include <memory>
#include <vector>
#include <mutex>
/**
* This class runs simulations and evolutions, and keeps track of the
* best networks.
*/
class Evolution
{
public:
/**
* Constructor
* @param nInitial How many random initialized genoms (first epoch)
* @param nNext How many offsprings generated among best genoms (further epochs)
* @param simFactory Factory for simulations
* @param nThreads Number of threads used for computation
*/
Evolution( size_t nInitial, size_t nNext, SimFactoryPtr simFactory, unsigned int nThreads = 4 );
virtual ~Evolution();
/**
* A single, discrete simulation step.
*/
void doStep();
/**
* Run a whole epoch. An epoch ends when all simulations died.
*/
void doEpoch();
/**
* Create the next generation.
*/
void breed();
/**
* Checks if Epoch is over. Epoch ends when all simulations died.
* @return
*/
bool isEpochOver();
/**
* Get vector of simulations ordered by fitness. Best first.
* @return Vector.
*/
std::vector<SimulationPtr> getSimulationsOrderedByFitness();
/**
* Get number of run epochs.
* @return Number of epochs.
*/
size_t getNumberOfEpochs() const;
/**
* Get the nubmer of alive and dead simulations.
*/
std::pair<size_t, size_t> getNumberAliveAndDead( ) const;
/**
* Average simulations age.
* @return seconds.
*/
double getSimulationsAverageAge() const;
/**
* Get mutation rate.
* @return Mutation rate (0.0 - 1.0)
*/
double getMutationRate() const;
/**
* Set mutation rate.
* @param mutationRate 0.0 - 1.0
*/
void setMutationRate(double mutationRate);
/**
* Are parents kept for the next epoch.
* @return True if parents are kept for next epoch.
*/
bool isKeepParents() const;
/**
* If true, parents are part of the next epoch.
* @param keepParents True -> parents are part of next epoch. Otherwise false.
*/
void setKeepParents(bool keepParents);
/**
* Kill all simulations.
*/
void killAllSimulations();
/**
* Get the number of simulation steps achieved in 1 second.
* @return Simulation rate.
*/
double getSimulationStepsPerSecond() const;
/**
* Set a new factory object.
* @param simFactory Factory.
*/
void resetFactory(SimFactoryPtr simFactory);
/**
* Safe the evolution -> the two best
* @param a_path Path to fittest
* @param b_path Path to second fittest
*/
bool save(const std::string &a_path, const std::string &b_path);
/**
* Load the evolution -> the two best
* @param a_path Path to fittest
* @param b_path Path to second fittest
* @return True if successful. Otherwise false.
*/
bool load( const std::string& a_path, const std::string& b_path );
private:
std::chrono::milliseconds now() const;
static void doStepOnFewSimulations( std::vector<SimulationPtr>& sims, std::atomic_bool& anyAlive, size_t start, size_t end );
private:
size_t m_nInitials;
size_t m_nOffsprings;
SimFactoryPtr m_simFactory;
std::vector<SimulationPtr> m_simulations;
bool m_epochOver;
size_t m_epochCount;
double m_mutationRate;
size_t m_stepCounter;
std::chrono::milliseconds m_simSpeedTime;
double m_simSpeed;
unsigned int m_nbrThreads;
bool m_keepParents;
SimulationPtr m_fittest;
std::mutex m_mutex;
};
#endif // _EVOLUTION_H_ | 27.887006 | 129 | 0.647083 | [
"object",
"vector"
] |
3f45fb1bb89fbc4844d14e415199d1eeb8446e55 | 12,674 | h | C | Modules/DiffusionImaging/DiffusionCore/include/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h | wyyrepo/MITK | d0837f3d0d44f477b888ec498e9a2ed407e79f20 | [
"BSD-3-Clause"
] | 1 | 2021-11-20T08:19:27.000Z | 2021-11-20T08:19:27.000Z | Modules/DiffusionImaging/DiffusionCore/include/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h | wyyrepo/MITK | d0837f3d0d44f477b888ec498e9a2ed407e79f20 | [
"BSD-3-Clause"
] | null | null | null | Modules/DiffusionImaging/DiffusionCore/include/Algorithms/mitkPartialVolumeAnalysisHistogramCalculator.h | wyyrepo/MITK | d0837f3d0d44f477b888ec498e9a2ed407e79f20 | [
"BSD-3-Clause"
] | null | null | null | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef _MITK_PartialVolumeAnalysisHistogramCalculator_H
#define _MITK_PartialVolumeAnalysisHistogramCalculator_H
#include "MitkDiffusionCoreExports.h"
#include <itkObject.h>
#include <itkImage.h>
#include <itkTimeStamp.h>
#include "mitkImage.h"
#include "mitkImageTimeSelector.h"
#include "mitkPlanarFigure.h"
namespace mitk
{
/**
* \brief Class for calculating statistics and histogram for an (optionally
* masked) image.
*
* Images can be masked by either a (binary) image (of the same dimensions as
* the original image) or by a closed mitk::PlanarFigure, e.g. a circle or
* polygon. When masking with a planar figure, the slice corresponding to the
* plane containing the figure is extracted and then clipped with contour
* defined by the figure. Planar figures need to be aligned along the main axes
* of the image (axial, sagittal, coronal). Planar figures on arbitrary
* rotated planes are not supported.
*
* For each operating mode (no masking, masking by image, masking by planar
* figure), the calculated statistics and histogram are cached so that, when
* switching back and forth between operation modes without modifying mask or
* image, the information doesn't need to be recalculated.
*
* Note: currently time-resolved and multi-channel pictures are not properly
* supported.
*/
class MITKDIFFUSIONCORE_EXPORT PartialVolumeAnalysisHistogramCalculator : public itk::Object
{
public:
enum
{
MASKING_MODE_NONE = 0,
MASKING_MODE_IMAGE,
MASKING_MODE_PLANARFIGURE
};
typedef mitk::Image::HistogramType HistogramType;
typedef mitk::Image::HistogramType::ConstIterator HistogramConstIteratorType;
struct Statistics
{
unsigned int N;
double Min;
double Max;
double Mean;
double Median;
double Variance;
double Sigma;
double RMS;
void Reset()
{
N = 0;
Min = 0.0;
Max = 0.0;
Mean = 0.0;
Median = 0.0;
Variance = 0.0;
Sigma = 0.0;
RMS = 0.0;
}
};
typedef Statistics StatisticsType;
typedef itk::TimeStamp TimeStampType;
typedef bool BoolType;
typedef itk::Image< unsigned char, 3 > MaskImage3DType;
typedef itk::Image< unsigned char, 2 > MaskImage2DType;
typedef itk::Image< float, 2 > InternalImage2DType;
mitkClassMacroItkParent( PartialVolumeAnalysisHistogramCalculator, itk::Object )
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
/** \brief Set image from which to compute statistics. */
void SetImage( const mitk::Image *image );
/** \brief Set binary image for masking. */
void SetImageMask( const mitk::Image *imageMask );
/** \brief Set planar figure for masking. */
void SetPlanarFigure( const mitk::PlanarFigure *planarFigure );
/** \brief Set image for which the same resampling will be applied.
and available via GetAdditionalResampledImage() */
void AddAdditionalResamplingImage( const mitk::Image *image );
/** \brief Set/Get operation mode for masking */
void SetMaskingMode( unsigned int mode );
/** \brief Set/Get operation mode for masking */
itkGetMacro( MaskingMode, unsigned int );
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToNone();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToImage();
/** \brief Set/Get operation mode for masking */
void SetMaskingModeToPlanarFigure();
/** \brief Set histogram number of bins. */
void SetNumberOfBins( unsigned int number )
{
if(m_NumberOfBins != number)
{
m_NumberOfBins = number;
SetModified();
}
}
/** \brief Get histogram number of bins. */
unsigned int GetNumberOfBins( )
{ return m_NumberOfBins; }
/** \brief Set upsampling factor. */
void SetUpsamplingFactor( float number )
{
if(m_UpsamplingFactor != number)
{
m_UpsamplingFactor = number;
SetModified();
}
}
/** \brief Get upsampling factor. */
float GetUpsamplingFactor( )
{ return m_UpsamplingFactor; }
/** \brief Set gaussian sigma. */
void SetGaussianSigma( float number )
{
if(m_GaussianSigma != number)
{
m_GaussianSigma = number;
SetModified();
}
}
/** \brief Get thickness of planar figure. */
unsigned int GetPlanarFigureThickness( )
{ return m_PlanarFigureThickness; }
/** \brief Set thickness of planar figure. */
void SetPlanarFigureThickness( unsigned int number )
{
if(m_PlanarFigureThickness != number)
{
m_PlanarFigureThickness = number;
SetModified();
}
}
/** \brief Get histogram number of bins. */
float GetGaussianSigma( )
{ return m_GaussianSigma; }
void SetModified();
/** \brief Compute statistics (together with histogram) for the current
* masking mode.
*
* Computation is not executed if statistics is already up to date. In this
* case, false is returned; otherwise, true.*/
virtual bool ComputeStatistics( );
/** \brief Retrieve the histogram depending on the current masking mode. */
const HistogramType *GetHistogram( ) const;
/** \brief Retrieve statistics depending on the current masking mode. */
const Statistics &GetStatistics( ) const;
const Image::Pointer GetInternalImage()
{
return m_InternalImage;
}
const Image::Pointer GetInternalAdditionalResampledImage(unsigned int i)
{
if(i < m_InternalAdditionalResamplingImages.size())
{
return m_InternalAdditionalResamplingImages[i];
}
else
{
return nullptr;
}
}
void SetForceUpdate(bool b)
{
m_ForceUpdate = b;
}
protected:
PartialVolumeAnalysisHistogramCalculator();
~PartialVolumeAnalysisHistogramCalculator() override;
/** \brief Depending on the masking mode, the image and mask from which to
* calculate statistics is extracted from the original input image and mask
* data.
*
* For example, a when using a PlanarFigure as mask, the 2D image slice
* corresponding to the PlanarFigure will be extracted from the original
* image. If masking is disabled, the original image is simply passed
* through. */
void ExtractImageAndMask( );
/** \brief If the passed vector matches any of the three principal axes
* of the passed geometry, the ínteger value corresponding to the axis
* is set and true is returned. */
bool GetPrincipalAxis( const Geometry3D *geometry, Vector3D vector,
unsigned int &axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsUnmasked(
const itk::Image< TPixel, VImageDimension > *image,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateStatisticsMasked(
const itk::Image< TPixel, VImageDimension > *image,
itk::Image< unsigned char, VImageDimension > *maskImage,
Statistics &statistics,
typename HistogramType::ConstPointer *histogram );
template < typename TPixel, unsigned int VImageDimension >
void InternalCalculateMaskFromPlanarFigure(
itk::Image< TPixel, VImageDimension > *image, unsigned int axis );
template < typename TPixel, unsigned int VImageDimension >
void InternalReorientImagePlane(
const itk::Image< TPixel, VImageDimension > *image, mitk::BaseGeometry* imggeo, mitk::BaseGeometry* planegeo3D, int additionalIndex );
template < typename TPixel, unsigned int VImageDimension >
void InternalResampleImageFromMask(
const itk::Image< TPixel, VImageDimension > *image, int additionalIndex );
void InternalResampleImage(
const MaskImage3DType *image/*, mitk::Geometry3D* imggeo*/ );
template < typename TPixel, unsigned int VImageDimension >
void InternalCropAdditionalImage(
itk::Image< TPixel, VImageDimension > *image, int additionalIndex );
void InternalMaskImage( mitk::Image *image );
/** Connection from ITK to VTK */
template <typename ITK_Exporter, typename VTK_Importer>
void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
/** Connection from VTK to ITK */
template <typename VTK_Exporter, typename ITK_Importer>
void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer)
{
importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback());
importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback());
importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback());
importer->SetSpacingCallback(exporter->GetSpacingCallback());
importer->SetOriginCallback(exporter->GetOriginCallback());
importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback());
importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback());
importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback());
importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback());
importer->SetDataExtentCallback(exporter->GetDataExtentCallback());
importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback());
importer->SetCallbackUserData(exporter->GetCallbackUserData());
}
void UnmaskedStatisticsProgressUpdate();
void MaskedStatisticsProgressUpdate();
mitk::Image::ConstPointer m_Image;
mitk::Image::ConstPointer m_ImageMask;
mitk::PlanarFigure::ConstPointer m_PlanarFigure;
HistogramType::ConstPointer m_ImageHistogram;
HistogramType::ConstPointer m_MaskedImageHistogram;
HistogramType::ConstPointer m_PlanarFigureHistogram;
HistogramType::Pointer m_EmptyHistogram;
StatisticsType m_ImageStatistics;
StatisticsType m_MaskedImageStatistics;
StatisticsType m_PlanarFigureStatistics;
Statistics m_EmptyStatistics;
unsigned int m_MaskingMode;
bool m_MaskingModeChanged;
mitk::Image::Pointer m_InternalImage;
MaskImage3DType::Pointer m_InternalImageMask3D;
MaskImage2DType::Pointer m_InternalImageMask2D;
itk::ImageRegion<3> m_InternalMask3D;
std::vector<mitk::Image::ConstPointer> m_AdditionalResamplingImages;
std::vector<mitk::Image::Pointer> m_InternalAdditionalResamplingImages;
TimeStampType m_ImageStatisticsTimeStamp;
TimeStampType m_MaskedImageStatisticsTimeStamp;
TimeStampType m_PlanarFigureStatisticsTimeStamp;
BoolType m_ImageStatisticsCalculationTriggerBool;
BoolType m_MaskedImageStatisticsCalculationTriggerBool;
BoolType m_PlanarFigureStatisticsCalculationTriggerBool;
unsigned int m_NumberOfBins;
float m_UpsamplingFactor;
float m_GaussianSigma;
itk::ImageRegion<3> m_CropRegion;
bool m_ForceUpdate;
unsigned int m_PlanarFigureThickness;
};
}
#endif // #define _MITK_PartialVolumeAnalysisHistogramCalculator_H
| 32.919481 | 144 | 0.707196 | [
"geometry",
"object",
"vector"
] |
3f47eeb3201993bf3b131e026daf5e130ffbf86e | 5,895 | c | C | modules/mrcp-sofiasip/src/mrcp_sofiasip_task.c | jasonaobei/unimrcp | 3f28cf1ba83ba18a092d5835e315100e51424e41 | [
"Apache-2.0"
] | 308 | 2015-07-11T09:32:28.000Z | 2022-02-14T06:20:12.000Z | modules/mrcp-sofiasip/src/mrcp_sofiasip_task.c | jasonaobei/unimrcp | 3f28cf1ba83ba18a092d5835e315100e51424e41 | [
"Apache-2.0"
] | 143 | 2015-07-11T04:07:05.000Z | 2022-03-15T00:36:40.000Z | modules/mrcp-sofiasip/src/mrcp_sofiasip_task.c | jasonaobei/unimrcp | 3f28cf1ba83ba18a092d5835e315100e51424e41 | [
"Apache-2.0"
] | 131 | 2015-07-29T01:47:28.000Z | 2022-03-15T07:27:35.000Z | /*
* Copyright 2008-2015 Arsen Chaloyan
*
* 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.
*/
typedef struct sofiasip_msg_container_t sofiasip_msg_container_t;
#define SU_MSG_ARG_T sofiasip_msg_container_t
#include <sofia-sip/su.h>
#include <sofia-sip/nua.h>
#undef strcasecmp
#undef strncasecmp
#include <apr_general.h>
#include "mrcp_sofiasip_task.h"
#include "mrcp_sofiasip_logger.h"
#include "apt_log.h"
/** Sofia-SIP task */
struct mrcp_sofia_task_t {
apr_pool_t *pool;
apt_task_t *base;
create_nua_f nua_creator;
void *obj;
su_root_t *root;
nua_t *nua;
};
struct sofiasip_msg_container_t {
apt_task_t *task;
apt_task_msg_t *msg;
};
static void mrcp_sofia_task_initialize(apt_task_t *task);
static void mrcp_sofia_task_deinitialize(apt_task_t *task);
static apt_bool_t mrcp_sofia_task_run(apt_task_t *task);
static apt_bool_t mrcp_sofia_task_on_terminate(apt_task_t *task);
static apt_bool_t mrcp_sofia_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg);
/** Create Sofia-SIP task */
APT_DECLARE(mrcp_sofia_task_t*) mrcp_sofia_task_create(
create_nua_f nua_creator,
void *obj,
apt_task_msg_pool_t *msg_pool,
apr_pool_t *pool)
{
apt_task_vtable_t *vtable;
mrcp_sofia_task_t *task;
if(!nua_creator) {
return NULL;
}
task = apr_palloc(pool,sizeof(mrcp_sofia_task_t));
task->pool = pool;
task->nua_creator = nua_creator;
task->obj = obj;
task->base = apt_task_create(task,msg_pool,pool);
if(!task->base) {
return NULL;
}
vtable = apt_task_vtable_get(task->base);
if(vtable) {
vtable->on_pre_run = mrcp_sofia_task_initialize;
vtable->on_post_run = mrcp_sofia_task_deinitialize;
vtable->run = mrcp_sofia_task_run;
vtable->terminate = mrcp_sofia_task_on_terminate;
vtable->signal_msg = mrcp_sofia_task_msg_signal;
}
task->root = NULL;
task->nua = NULL;
return task;
}
/** Destroy Sofia-SIP task */
APT_DECLARE(apt_bool_t) mrcp_sofia_task_destroy(mrcp_sofia_task_t *task)
{
return apt_task_destroy(task->base);
}
/** Start Sofia-SIP task */
APT_DECLARE(apt_bool_t) mrcp_sofia_task_start(mrcp_sofia_task_t *task)
{
return apt_task_start(task->base);
}
/** Terminate Sofia-SIP task */
APT_DECLARE(apt_bool_t) mrcp_sofia_task_terminate(mrcp_sofia_task_t *task)
{
return apt_task_terminate(task->base,TRUE);
}
/** Break main loop of Sofia-SIP task */
APT_DECLARE(void) mrcp_sofia_task_break(mrcp_sofia_task_t *task)
{
if(task->root) {
su_root_break(task->root);
}
}
/** Get task base */
APT_DECLARE(apt_task_t*) mrcp_sofia_task_base_get(const mrcp_sofia_task_t *task)
{
return task->base;
}
/** Get task vtable */
APT_DECLARE(apt_task_vtable_t*) mrcp_sofia_task_vtable_get(const mrcp_sofia_task_t *task)
{
return apt_task_vtable_get(task->base);
}
/** Get external object */
APT_DECLARE(void*) mrcp_sofia_task_object_get(const mrcp_sofia_task_t *task)
{
return task->obj;
}
/** Get su_root object */
APT_DECLARE(su_root_t*) mrcp_sofia_task_su_root_get(const mrcp_sofia_task_t *task)
{
return task->root;
}
/** Get nua object */
APT_DECLARE(nua_t*) mrcp_sofia_task_nua_get(const mrcp_sofia_task_t *task)
{
return task->nua;
}
static void mrcp_sofia_task_initialize(apt_task_t *base)
{
mrcp_sofia_task_t *task = apt_task_object_get(base);
apt_log(SIP_LOG_MARK,APT_PRIO_DEBUG,"Initialize Task [%s]", apt_task_name_get(base));
/* Initialize Sofia-SIP library and create event loop */
su_init();
task->root = su_root_create(NULL);
task->nua = task->nua_creator(task->obj,task->root);
if(!task->nua) {
apt_log(SIP_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s]", apt_task_name_get(base));
}
}
static void mrcp_sofia_task_deinitialize(apt_task_t *base)
{
mrcp_sofia_task_t *task = apt_task_object_get(base);
apt_log(SIP_LOG_MARK,APT_PRIO_DEBUG,"Deinitialize Task [%s]", apt_task_name_get(base));
if(task->nua) {
nua_destroy(task->nua);
task->nua = NULL;
}
if(task->root) {
su_root_destroy(task->root);
task->root = NULL;
}
su_deinit();
}
static apt_bool_t mrcp_sofia_task_run(apt_task_t *base)
{
mrcp_sofia_task_t *task = apt_task_object_get(base);
if(!task->root || !task->nua) {
apt_log(SIP_LOG_MARK,APT_PRIO_WARNING,"Failed to Run Sofia-SIP Task");
return FALSE;
}
/* Run event loop */
su_root_run(task->root);
apt_task_terminate_request_process(base);
return TRUE;
}
static apt_bool_t mrcp_sofia_task_on_terminate(apt_task_t *base)
{
mrcp_sofia_task_t *task = apt_task_object_get(base);
if(!task->nua) {
return FALSE;
}
apt_log(SIP_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA [%s]", apt_task_name_get(base));
nua_shutdown(task->nua);
return TRUE;
}
static void mrcp_sofia_task_msg_process(void *obj, su_msg_r msg, sofiasip_msg_container_t *container)
{
apt_log(SIP_LOG_MARK,APT_PRIO_DEBUG,"Receive Sofia-SIP Task Msg [%s]", apt_task_name_get(container->task));
apt_task_msg_process(container->task, container->msg);
}
static apt_bool_t mrcp_sofia_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg)
{
mrcp_sofia_task_t *task = apt_task_object_get(base);
sofiasip_msg_container_t *container;
su_msg_r m = SU_MSG_R_INIT;
su_msg_new(m, sizeof(sofiasip_msg_container_t));
container = su_msg_data(m);
container->task = base;
container->msg = msg;
if(su_msg_send_to(m, su_root_task(task->root), mrcp_sofia_task_msg_process) != 0)
return FALSE;
return TRUE;
}
| 25.300429 | 108 | 0.753011 | [
"object"
] |
3f4839d5d71e93eb185ddca4f61dac62d2320058 | 4,232 | h | C | ios/nexus-mobile-library.framework/Headers/TAO/API/objects/types/objects.h | KenCorma/nexus-mobile-demomode | dfb42c6cb735557215a52e525c8d5f085809d152 | [
"MIT"
] | null | null | null | ios/nexus-mobile-library.framework/Headers/TAO/API/objects/types/objects.h | KenCorma/nexus-mobile-demomode | dfb42c6cb735557215a52e525c8d5f085809d152 | [
"MIT"
] | null | null | null | ios/nexus-mobile-library.framework/Headers/TAO/API/objects/types/objects.h | KenCorma/nexus-mobile-demomode | dfb42c6cb735557215a52e525c8d5f085809d152 | [
"MIT"
] | null | null | null | /*__________________________________________________________________________________________
(c) Hash(BEGIN(Satoshi[2010]), END(Sunny[2012])) == Videlicet[2014] ++
(c) Copyright The Nexus Developers 2014 - 2019
Distributed under the MIT software license, see the accompanying
file COPYING or http://www.opensource.org/licenses/mit-license.php.
"ad vocem populi" - To the Voice of the People
____________________________________________________________________________________________*/
#pragma once
#include <TAO/API/types/base.h>
/* Global TAO namespace. */
namespace TAO
{
/* API Layer namespace. */
namespace API
{
/** Objects
*
* Objects API Class.
* Manages the function pointers for all Objects API commands.
*
**/
class Objects : public Base
{
public:
/** Default Constructor. **/
Objects()
: Base()
{
Initialize();
}
/** Initialize.
*
* Sets the function pointers for this API.
*
**/
void Initialize() final;
/** GetName
*
* Returns the name of this API.
*
**/
std::string GetName() const final
{
return "Objects";
}
/******************* STATIC HELPER METHODS BELOW THIS LINE **********************/
/** Transfer
*
* Generic method to transfer an object register .
*
* @param[in] params The parameters from the API call.
* @param[in] nType The object type to transfer.
* @param[in] strType The name of the object type, used to format error messages
*
* @return The return object in JSON.
*
**/
static json::json Transfer(const json::json& params, uint8_t nType, const std::string& strType);
/** Claim
*
* Generic method to claim a transferred object regiseter .
*
* @param[in] params The parameters from the API call.
* @param[in] nType The object type to claim
* @param[in] strType The name of the object type, used to format error messages
*
* @return The return object in JSON.
*
**/
static json::json Claim(const json::json& params, uint8_t nType, const std::string& strType);
/** History
*
* Generic method to output the history of an object register and its ownership
*
* @param[in] params The parameters from the API call.
* @param[in] nType The object type to show history for
* @param[in] strType The name of the object type, used to format error messages
*
* @return The return object in JSON.
*
**/
static json::json History(const json::json& params, uint8_t nType, const std::string& strType);
/** List
*
* Generic method to list object registers by sig chain
*
* @param[in] params The parameters from the API call.
* @param[in] nRegisterType The register type to list
* @param[in] nObjectType The object type to list
*
* @return The return object in JSON.
*
**/
static json::json List(const json::json& params, uint8_t nRegisterType, uint8_t nObjectType);
/** ListTransactions
*
* Lists all transactions for a given object register
*
* @param[in] params The parameters from the API call.
* @param[in] fHelp Trigger for help data.
*
* @return The return object in JSON.
*
**/
static json::json ListTransactions(const json::json& params, bool fHelp);
};
}
}
| 30.666667 | 108 | 0.511106 | [
"object"
] |
3f5cae0ebaa106ecf02c9838dbe6da4a64c266f0 | 827 | h | C | cases/surfers_in_channel_flow_z/param/init/objects/surfer__us_0o8__surftimeconst_2o5/pos/group/_member/passive/position/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/surfers_in_channel_flow_z/param/init/objects/surfer__us_0o8__surftimeconst_2o5/pos/group/_member/passive/position/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | cases/surfers_in_channel_flow_z/param/init/objects/surfer__us_0o8__surftimeconst_2o5/pos/group/_member/passive/position/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | #ifndef C0P_PARAM_INIT_OBJECTS_SURFER__US_0O8__SURFTIMECONST_2O5_POS_GROUP_MEMBER_PASSIVE_POSITION_CHOICE_H
#define C0P_PARAM_INIT_OBJECTS_SURFER__US_0O8__SURFTIMECONST_2O5_POS_GROUP_MEMBER_PASSIVE_POSITION_CHOICE_H
#pragma once
// THIS FILE SHOULD NOT BE EDITED DIRECTLY BY THE USERS.
// THIS FILE WILL BE AUTOMATICALLY EDITED WHEN THE
// CHOOSE COMMAND IS USED
// choose your init
#include "core/init/objects/object/init/passive/position/box/core.h"
#include "param/init/objects/surfer__us_0o8__surftimeconst_2o5/pos/group/_member/passive/position/box/parameters.h"
namespace c0p {
template<typename TypeObjectStep>
using InitSurferUs0O8Surftimeconst2O5PosGroupMemberPassivePosition = InitInitPassivePositionBox<InitSurferUs0O8Surftimeconst2O5PosGroupMemberPassivePositionBoxParameters, TypeObjectStep>;
}
#endif
| 43.526316 | 191 | 0.86578 | [
"object"
] |
3f71de78ab08771662c75c784edfc4780e94b31f | 6,091 | h | C | librf/src/spinlock.h | HungMingWu/librf | d3c568ca8c717e6e6d9607aee55e3da219a33c1e | [
"Apache-2.0"
] | 434 | 2017-09-24T06:41:06.000Z | 2022-03-29T10:24:14.000Z | librf/src/spinlock.h | HungMingWu/librf | d3c568ca8c717e6e6d9607aee55e3da219a33c1e | [
"Apache-2.0"
] | 7 | 2017-12-06T13:08:33.000Z | 2021-12-01T07:46:12.000Z | librf/src/spinlock.h | HungMingWu/librf | d3c568ca8c717e6e6d9607aee55e3da219a33c1e | [
"Apache-2.0"
] | 95 | 2017-09-24T06:14:04.000Z | 2022-03-22T06:23:14.000Z | //用于内部实现的循环锁
#pragma once
namespace resumef
{
#if defined(RESUMEF_USE_CUSTOM_SPINLOCK)
using spinlock = RESUMEF_USE_CUSTOM_SPINLOCK;
#else
/**
* @brief 一个自旋锁实现。
*/
struct spinlock
{
static const size_t MAX_ACTIVE_SPIN = 4000;
static const size_t MAX_YIELD_SPIN = 8000;
static const int FREE_VALUE = 0;
static const int LOCKED_VALUE = 1;
std::atomic<int> lck;
#if _DEBUG
std::thread::id owner_thread_id;
#endif
/**
* @brief 初始为未加锁。
*/
spinlock() noexcept
{
lck = FREE_VALUE;
}
/**
* @brief 获得锁。会一直阻塞线程直到获得锁。
*/
void lock() noexcept
{
int val = FREE_VALUE;
if (!lck.compare_exchange_weak(val, LOCKED_VALUE, std::memory_order_acq_rel))
{
#if _DEBUG
//诊断错误的用法:进行了递归锁调用
assert(owner_thread_id != std::this_thread::get_id());
#endif
size_t spinCount = 0;
auto dt = std::chrono::milliseconds{ 1 };
do
{
while (lck.load(std::memory_order_relaxed) != FREE_VALUE)
{
if (spinCount < MAX_ACTIVE_SPIN)
{
++spinCount;
}
else if (spinCount < MAX_YIELD_SPIN)
{
++spinCount;
std::this_thread::yield();
}
else
{
std::this_thread::sleep_for(dt);
dt = (std::min)(std::chrono::milliseconds{ 128 }, dt * 2);
}
}
val = FREE_VALUE;
} while (!lck.compare_exchange_weak(val, LOCKED_VALUE, std::memory_order_acq_rel));
}
#if _DEBUG
owner_thread_id = std::this_thread::get_id();
#endif
}
/**
* @brief 尝试获得锁一次。
*/
bool try_lock() noexcept
{
int val = FREE_VALUE;
bool ret = lck.compare_exchange_strong(val, LOCKED_VALUE, std::memory_order_acq_rel);
#if _DEBUG
if (ret) owner_thread_id = std::this_thread::get_id();
#endif
return ret;
}
/**
* @brief 释放锁。
*/
void unlock() noexcept
{
#if _DEBUG
owner_thread_id = std::thread::id();
#endif
lck.store(FREE_VALUE, std::memory_order_release);
}
};
#endif
#ifndef DOXYGEN_SKIP_PROPERTY
namespace detail
{
template<class _Ty, class _Cont = std::vector<_Ty>>
struct _LockVectorAssembleT
{
private:
_Cont& _Lks;
public:
_LockVectorAssembleT(_Cont& _LkN)
: _Lks(_LkN)
{}
size_t size() const
{
return _Lks.size();
}
_Ty& operator[](int _Idx)
{
return _Lks[_Idx];
}
void _Lock_ref(_Ty& _LkN) const
{
_LkN.lock();
}
bool _Try_lock_ref(_Ty& _LkN) const
{
return _LkN.try_lock();
}
void _Unlock_ref(_Ty& _LkN) const
{
_LkN.unlock();
}
void _Yield() const
{
std::this_thread::yield();
}
void _ReturnValue() const;
template<class U>
U _ReturnValue(U v) const;
};
template<class _Ty, class _Cont>
struct _LockVectorAssembleT<std::reference_wrapper<_Ty>, _Cont>
{
private:
_Cont& _Lks;
public:
_LockVectorAssembleT(_Cont& _LkN)
: _Lks(_LkN)
{}
size_t size() const
{
return _Lks.size();
}
std::reference_wrapper<_Ty> operator[](int _Idx)
{
return _Lks[_Idx];
}
void _Lock_ref(std::reference_wrapper<_Ty> _LkN) const
{
_LkN.get().lock();
}
void _Unlock_ref(std::reference_wrapper<_Ty> _LkN) const
{
_LkN.get().unlock();
}
bool _Try_lock_ref(std::reference_wrapper<_Ty> _LkN) const
{
return _LkN.get().try_lock();
}
void _Yield() const
{
std::this_thread::yield();
}
void _ReturnValue() const;
template<class U>
U _ReturnValue(U v) const;
};
#define LOCK_ASSEMBLE_NAME(fnName) scoped_lock_range_##fnName
#define LOCK_ASSEMBLE_AWAIT(a) (a)
#define LOCK_ASSEMBLE_RETURN(a) return (a)
#include "without_deadlock_assemble.inl"
#undef LOCK_ASSEMBLE_NAME
#undef LOCK_ASSEMBLE_AWAIT
#undef LOCK_ASSEMBLE_RETURN
}
#endif //DOXYGEN_SKIP_PROPERTY
/**
* @brief 无死锁的批量枷锁。
* @param _Ty 锁的类型。例如std::mutex,resumef::spinlock,resumef::mutex_t(线程用法)均可。
* @param _Cont 容纳一批锁的容器。
* @param _Assemble 与_Cont配套的锁集合,特化了如何操作_Ty。
*/
template<class _Ty, class _Cont = std::vector<_Ty>, class _Assemble = detail::_LockVectorAssembleT<_Ty, _Cont>>
class batch_lock_t
{
public:
/**
* @brief 通过锁容器构造,并立刻应用加锁算法。
*/
explicit batch_lock_t(_Cont& locks_)
: _LkN(&locks_)
, _LA(*_LkN)
{
detail::scoped_lock_range_lock_impl::_Lock_range(_LA);
}
/**
* @brief 通过锁容器和锁集合构造,并立刻应用加锁算法。
*/
explicit batch_lock_t(_Cont& locks_, _Assemble& la_)
: _LkN(&locks_)
, _LA(la_)
{
detail::scoped_lock_range_lock_impl::_Lock_range(_LA);
}
/**
* @brief 通过锁容器构造,容器里的锁已经全部获得。
*/
explicit batch_lock_t(std::adopt_lock_t, _Cont& locks_)
: _LkN(&locks_)
, _LA(*_LkN)
{ // construct but don't lock
}
/**
* @brief 通过锁容器和锁集合构造,容器里的锁已经全部获得。
*/
explicit batch_lock_t(std::adopt_lock_t, _Cont& locks_, _Assemble& la_)
: _LkN(&locks_)
, _LA(la_)
{ // construct but don't lock
}
/**
* @brief 析构函数里,释放容器里的锁。
*/
~batch_lock_t() noexcept
{
if (_LkN != nullptr)
detail::scoped_lock_range_lock_impl::_Unlock_locks(0, (int)_LA.size(), _LA);
}
/**
* @brief 手工释放容器里的锁,析构函数里将不再有释放操作。
*/
void unlock()
{
if (_LkN != nullptr)
{
_LkN = nullptr;
detail::scoped_lock_range_lock_impl::_Unlock_locks(0, (int)_LA.size(), _LA);
}
}
/**
* @brief 不支持拷贝构造。
*/
batch_lock_t(const batch_lock_t&) = delete;
/**
* @brief 不支持拷贝赋值。
*/
batch_lock_t& operator=(const batch_lock_t&) = delete;
/**
* @brief 支持移动构造。
*/
batch_lock_t(batch_lock_t&& _Right)
: _LkN(_Right._LkN)
, _LA(std::move(_Right._LA))
{
_Right._LkN = nullptr;
}
/**
* @brief 支持移动赋值。
*/
batch_lock_t& operator=(batch_lock_t&& _Right)
{
if (this != &_Right)
{
_LkN = _Right._LkN;
_Right._LkN = nullptr;
_LA = std::move(_Right._LA);
}
}
private:
_Cont* _LkN;
_Assemble _LA;
};
}
| 20.10231 | 113 | 0.60023 | [
"vector"
] |
3f72b7d2da60126627859f82d7c4bb97b3365fb7 | 5,147 | h | C | libmevent/meventmgr.h | stardog-union/rocks_snmp | 7fa1a752957c7b4999833d89e5a8023d855d8ce8 | [
"Apache-2.0"
] | null | null | null | libmevent/meventmgr.h | stardog-union/rocks_snmp | 7fa1a752957c7b4999833d89e5a8023d855d8ce8 | [
"Apache-2.0"
] | null | null | null | libmevent/meventmgr.h | stardog-union/rocks_snmp | 7fa1a752957c7b4999833d89e5a8023d855d8ce8 | [
"Apache-2.0"
] | 1 | 2020-11-14T16:41:51.000Z | 2020-11-14T16:41:51.000Z | /**
* @file meventmgr.h
* @author matthewv
* @date February 22, 2010
* @date Copyright 2011
*
* @brief Declarations for epoll based event classes
*/
#ifndef MEVENTMGR_H
#define MEVENTMGR_H
#include <atomic>
#include <chrono>
#include <iterator>
#include <map>
#include <mutex>
#include <set>
#include <sys/time.h>
#include <thread>
#include <vector>
#include "meventobj.h"
/**
* Object that manages lists of MEventObj.
* MEventMgr activates various MEventObj callback functions as events occur.
* - Derived from CircularList so it can be anchor to timer list
*/
class MEventMgr : public StateMachine {
/****************************************************************
* Member objects
****************************************************************/
public:
/// list of state nodes
enum MEventMgrNode_e {
MM_NODE_INITIALIZED = 1, //!< object initialized properly
MM_NODE_RUNNING = 2, //!< epoll loop is executing
MM_NODE_SHUTDOWN = 3, //!< epoll loop is exiting
MM_NODE_STOPPED = 4, //!< epoll loop terminated
};
/// list of state edges
enum MEventMgrEdge_e {
MM_EDGE_START = 1, //!< begin epoll loop
MM_EDGE_SHUTDOWN = 2, //!< end epoll loop
MM_EDGE_TASK_START = 3, //!< increment task tracking
MM_EDGE_TASK_END = 4, //!< decrement task tracking
MM_EDGE_ERROR = 5, //!< error happened
};
protected:
std::atomic_bool m_Running; //!< true when while loop should be active
bool m_EndStatus; //!< true loop exited without errors
int m_EpollFd; //!< file handle used by epoll
int m_SelfPipe[2]; //!< pipe to facilitate stopping epoll loop
int m_TaskCount; //!< when used, controls auto shutdown
std::mutex m_AddMutex; //!< synchronization for adding to m_ThreadedAdd
std::vector<MEventPtr> m_ThreadedAdd; //!< new events from non-manager threads
std::set<MEventPtr> m_Events;
std::multimap<std::chrono::steady_clock::time_point, MEventPtr> m_Timeouts;
std::thread m_Thread;
/****************************************************************
* Member functions
****************************************************************/
public:
MEventMgr();
virtual ~MEventMgr();
void Close();
/// test if initialization succeeded
bool IsValid() const { return (-1 != m_EpollFd && m_EndStatus); };
/// test if initialization succeeded
operator bool() const { return (IsValid()); };
#if 0
/// establish relationship with an object
void assign(MEventPtr & Obj) {Obj.assign(this);};
/// establish relationship with an object
void assign(MEventObj * Ptr)
{if (NULL!=Ptr) Ptr->assign(this);};
/// establish relationship with an object
void assign(MEventPtr & Ptr)
{if (NULL!=Ptr.get()) Ptr->assign(this);};
#endif
/// Thread safe means to add event to manager
bool AddEvent(MEventPtr &Ptr);
MEventMgrPtr GetMEventMgrPtr() {
return std::static_pointer_cast<MEventMgr>(GetStateMachinePtr());
}
//
// timer only functions
//
/// establish timer on object
bool TimerCreate(MEventPtr Obj);
/// repeat previous timer on object
bool TimerRepeat(MEventPtr &Obj);
/// accessor to first item on timer list
MEventPtr TimerFirst() { return (m_Timeouts.begin()->second); }
/// accessor to end of timer list
MEventPtr TimerLast() { return (m_Timeouts.end()->second); };
/// accessor to first item on object list
MEventPtr ObjectFirst() { return (*m_Events.begin()); };
/// accessor to end of object list
MEventPtr ObjectLast() { return (*m_Events.end()); };
//
// execution control
//
/// Single thread model start
bool StartSingle();
/// Multi thread start
bool StartThreaded();
/// Stop for both thread models, non blocking
void Stop(bool EndStatus = true);
/// Wait for previous Stop() to complete, blocking
bool ThreadWait() {
if (m_Thread.joinable()) {
m_Thread.join();
}
PurgeEvents();
return (m_EndStatus);
};
//
// Object event requests
//
// set/reset epoll monitoring for reading / writing
bool UpdateEpoll(MEventPtr &Obj, bool NewReadFlag, bool NewWriteFlag);
/// take object off the epoll list
bool ReleaseRequests(MEventPtr &Obj);
//
// StateMachine interface
//
/// Public routine to receive Edge notification
// virtual bool EdgeNotification(unsigned int EdgeId, StateMachinePtr &
// Caller,
// bool PreNotify);
/// debug
// void Dump() {printf("MEventMgr:\n m_RefCount=%u\n", m_RefCount);};
protected:
/// release all attached events
void PurgeEvents();
/// Callback used when timer value expires
virtual void TimerExpired(){};
/// ThreadControl's entry point
virtual void *ThreadStart();
/// process messages sent to manager via pipe
void ReceiveMgrMessage(unsigned Flags);
/// copy items from m_ThreadAdd to main object list
void AddEventList();
private:
MEventMgr(const MEventMgr &); //!< disabled: copy operator
MEventMgr &operator=(const MEventMgr &); //!< disabled: assignment operator
}; // class MEventMgr
#endif // ifndef MEVENTMGR_H
| 28.28022 | 80 | 0.637847 | [
"object",
"vector",
"model"
] |
3f7cbd639d25d4bf3fb5efe3defc00c40c94f4ef | 4,770 | h | C | Pods/TuyaSmartSceneKit/ios/TuyaSmartSceneKit.framework/Versions/A/Headers/TuyaSmartSceneActionModel.h | BruceZhang2017/diffuser | acd1cd585ef51c07517d99012e6027907ff3e81d | [
"MIT"
] | null | null | null | Pods/TuyaSmartSceneKit/ios/TuyaSmartSceneKit.framework/Versions/A/Headers/TuyaSmartSceneActionModel.h | BruceZhang2017/diffuser | acd1cd585ef51c07517d99012e6027907ff3e81d | [
"MIT"
] | null | null | null | Pods/TuyaSmartSceneKit/ios/TuyaSmartSceneKit.framework/Versions/A/Headers/TuyaSmartSceneActionModel.h | BruceZhang2017/diffuser | acd1cd585ef51c07517d99012e6027907ff3e81d | [
"MIT"
] | null | null | null | //
// TuyaSmartSceneActionModel.h
// TuyaSmartSceneKit
//
// Copyright (c) 2014-2021 Tuya Inc. (https://developer.tuya.com)
/// push message action
static NSString * const ACTION_EXECUTOR_APP_PUSH = @"appPushTrigger";
/// call action
static NSString * const ACTION_EXECUTOR_APP_CALL = @"mobileVoiceSend";
/// sms action
static NSString * const ACTION_EXECUTOR_SMS_SEND = @"smsSend";
/// device dp action
static NSString * const ACTION_EXECUTOR_DP_ISSUE = @"dpIssue";
/// device group dp action
static NSString * const ACTION_EXECUTOR_GROUP_DP_ISSUE = @"deviceGroupDpIssue";
/// ir device dp action
static NSString * const ACTION_EXECUTOR_IR_ISSUE = @"irIssue";
/// ir device dp action(2rd version)
static NSString * const ACTION_EXECUTOR_IR_ISSUE_VII = @"irIssueVii";
/// enable a automation
static NSString * const ACTION_EXECUTOR_RULE_ENABLE = @"ruleEnable";
/// diable a automation
static NSString * const ACTION_EXECUTOR_RULE_DISABLE = @"ruleDisable";
/// execute a scene
static NSString * const ACTION_EXECUTOR_RULE_TRIGGER = @"ruleTrigger";
/// delay action
static NSString * const ACTION_EXECUTOR_DELAY = @"delay";
/// toggle action
static NSString * const ACTION_EXECUTOR_TOGGLE = @"toggle";
/// step action
extern NSString * const ACTION_EXECUTOR_STEP;
/// The five types of action status. Provides loading, success, offline, timeout and delay types.
typedef NS_ENUM(NSInteger, TYSceneActionStatus)
{
/// The loading action type.
TYSceneActionStatusLoading = 0,
/// The success action type.
TYSceneActionStatusSuccess,
/// The offline action type.
TYSceneActionStatusOffline,
/// The timeout action type.
TYSceneActionStatusTimeout,
/// The delay action type.
TYSceneActionStatusDelay,
};
/// @brief Data model for Scene Base Action.
@interface TuyaSmartSceneActionModel : NSObject<NSCoding>
/// The action id.
@property (nonatomic, copy) NSString *actionId;
/// The entity id. If action is a device, entityId is devId, and groupId for group action, @"delay" for a delay action, sceneId of operated scene for scene action.
@property (nonatomic, copy) NSString *entityId;
/// The entity name, like "lamp", "lamp group".
@property (nonatomic, copy) NSString *entityName;
/// The scene id, can be used to save the scene's Id which this action belonged to.
@property (nonatomic, copy) NSString *scenarioId;
/// Describe what this action will do, like "Switch : Open".
@property (nonatomic, copy) NSString *actionDisplay;
/// Describe what this action will do with origin format like the below example, you can use it to create the description.
/// {
/// 1: [
/// "Switch",
/// "Open"
/// ]
/// }
@property (nonatomic, strong) NSDictionary *actionDisplayNew;
/// The action type, can be the followed types:
/// "dpIssue" :execute a device action.
/// "deviceGroupDpIssue": execute a group action.
/// "irIssue": execute an infrared device, like an air conditioner which is controlled by a remote control.
/// "irIssueVii": execute an infrared device, like an air conditioner which is controlled by a remote control.ExecutorProperty is real infrared ray remotes control code.
/// "ruleTrigger": execute a scene.
/// "ruleEnable": Enable an automation.
/// "ruleDisable": Disable an automation.
/// "delay": Delay for a while.
@property (nonatomic, copy) NSString *actionExecutor;
/// Execute property, like {"1":true, ...}, "1" is dpId, a data point's Id, value is the value you want this datapoint to set. Delay action should be like "executorProperty":{"seconds":"5","minutes":"0"}.
@property (nonatomic, strong) NSDictionary *executorProperty;
/// Local property of scene , save gId and gwId.
@property (nonatomic, strong) NSDictionary *extraProperty;
/// If this action is a device type action and this device has been removed from the current account, this flag is YES.
@property (nonatomic, assign) BOOL devDelMark;
/// If this action is a device type action, and this device has been removed from the current account, then provide this icon url to display the device icon.
@property (nonatomic, copy) NSString *deleteDevIcon;
/// Execute action status, you can use this property to store the execute status when executing.
@property (nonatomic, assign) TYSceneActionStatus status;
#pragma mark - Panel info
/// The panel id, this value will be assigned by cloud server when this action should be oprate by a React Native panel.
@property (nonatomic, copy) NSString *uiid;
#pragma mark - Recommend info
/// The recommend product id.
@property (nonatomic, copy) NSString *productId;
/// The recommend product icon.
@property (nonatomic, copy) NSString *productPic;
/// The recommend product local default icon.
@property (nonatomic, copy) NSString *defaultIconUrl;
@end
| 39.421488 | 204 | 0.741929 | [
"model"
] |
3f856753f8f9005a7f544aaa49182042e6ebf530 | 381 | h | C | app/default/param/env/objects/static/object/__chain/non_strechable/_member/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | app/default/param/env/objects/static/object/__chain/non_strechable/_member/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | app/default/param/env/objects/static/object/__chain/non_strechable/_member/choice.h | C0PEP0D/sheld0n | 497d4ee8b6b1815cd5fa1b378d1b947ee259f4bc | [
"MIT"
] | null | null | null | #ifndef C0P_PARAM_OBJECTS_OBJECT_CHAIN_NON_STRECHABLE_MEMBER_CHOICE_H
#define C0P_PARAM_OBJECTS_OBJECT_CHAIN_NON_STRECHABLE_MEMBER_CHOICE_H
#pragma once
// choose your object
#include "param/env/objects/static/object/chain/non_strechable/_member/passive/choice.h"
namespace c0p {
using ObjectChainNonStrechableMemberStep = ObjectChainNonStrechableMemberPassiveStep;
}
#endif
| 31.75 | 89 | 0.868766 | [
"object"
] |
3f8bb469d35a38526f06eb1f2a9bea38dd2ad843 | 2,328 | h | C | source/symutil.h | dos-games/vanilla-shadow_warrior | bf781c586c7e9cda0cfb0b3bc56983f535cb75c4 | [
"Unlicense"
] | 18 | 2015-07-21T03:53:29.000Z | 2021-12-20T18:42:56.000Z | source/symutil.h | Azarien/shadow-warrior | bf781c586c7e9cda0cfb0b3bc56983f535cb75c4 | [
"Unlicense"
] | null | null | null | source/symutil.h | Azarien/shadow-warrior | bf781c586c7e9cda0cfb0b3bc56983f535cb75c4 | [
"Unlicense"
] | 6 | 2016-10-17T09:06:22.000Z | 2022-02-11T10:02:17.000Z | //-------------------------------------------------------------------------
/*
Copyright (C) 1997, 2005 - 3D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
typedef struct
{
char Name[32];
long Offset;
}SYM_TABLE, *SYM_TABLEp;
extern int _nullarea;
extern int __begtext;
extern SYM_TABLEp SymTableCode;
extern SYM_TABLEp SymTableData;
extern long SymCountCode;
extern long SymCountData;
extern long SymDataSegNum;
extern long SymCodeSegNum;
extern char SymDataSegPrefix[];
extern char SymCodeSegPrefix[];
extern long SymDataSegOffset;
extern long SymCodeSegOffset;
long filesize( FILE *fp );
unsigned long SymDataPtrToOffset(char *ptr);
unsigned long SymCodePtrToOffset(char *ptr);
void * SymOffsetToDataPtr(long sym_offset);
void * SymOffsetToCodePtr(long sym_offset);
char * NextLine(char *ptr);
char * StartOfLine(char *base_ptr, char *ptr);
void FindDataSegPrefix(char *base_ptr);
void FindCodeSegPrefix(char *base_ptr);
long ParseMapFile(char *base_ptr, SYM_TABLEp SymTable, char *prefix);
SYM_TABLEp SearchSymTableByOffset(SYM_TABLEp SymTable, int count, unsigned long key_sym_offset, unsigned long *offset_from_symbol);
SYM_TABLEp SearchSymTableByName(SYM_TABLEp SymTable, int count, char *key_sym_name);
char * LoadMapFile(char *name, char *base_ptr);
void LoadSymTable(char *name, SYM_TABLEp *SymTable, long *count);
| 35.272727 | 132 | 0.715206 | [
"3d"
] |
3f912c42326b65bcbd877cb9bcf8bd2361991422 | 6,262 | h | C | Marlin-BIQUBX_ALMOST_STOCK/Marlin/src/lcd/extui/lib/btt_ui/SanityCheck.h | Ejay-3D/Marlin-Biqu | bcf9d30c2fb998ca7d2ebf8c2cb917a96eb2d018 | [
"MIT"
] | 6 | 2020-12-04T21:55:04.000Z | 2022-02-02T20:49:45.000Z | Marlin-BIQUBX_ALMOST_STOCK/Marlin/src/lcd/extui/lib/btt_ui/SanityCheck.h | Ejay-3D/Marlin-Biqu | bcf9d30c2fb998ca7d2ebf8c2cb917a96eb2d018 | [
"MIT"
] | 1 | 2021-06-16T09:37:24.000Z | 2021-06-16T09:44:32.000Z | Marlin-BIQUBX_ALMOST_STOCK/Marlin/src/lcd/extui/lib/btt_ui/SanityCheck.h | Ejay-3D/Marlin-Biqu | bcf9d30c2fb998ca7d2ebf8c2cb917a96eb2d018 | [
"MIT"
] | 3 | 2021-05-01T15:13:41.000Z | 2022-02-11T01:15:30.000Z | #ifndef _SANITYCHECK_H_
#define _SANITYCHECK_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "includes.h"
#include "TSC_Configuration.h"
#include "API/flashStore.h"
#include "API/Settings.h"
//
//check size of settings against max allocated size at compile time
#define SIZE_CHECK(object) ((void)sizeof(char[1 - 2*!!(object)]))
#if CONFIG_VERSION != CONFIG_SUPPPORT
#error "the Configuration.h is old. please use the latest Configuration.h file"
#endif
#ifdef ST7920_SPI
#ifdef CLEAN_MODE_SWITCHING_SUPPORT
#error "CLEAN_MODE_SWITCHING_SUPPORT is now SERIAL_ALWAYS_ON. Please update your configuration."
#endif
#endif
#ifdef LED_COLOR_PIN
#ifdef STARTUP_KNOB_LED_COLOR
#if STARTUP_KNOB_LED_COLOR < 0
#error "STARTUP_knob_LED_COLOR cannot be less than 1"
#endif
#if STARTUP_KNOB_LED_COLOR > 8
#error "STARTUP_knob_LED_COLOR cannot be greater than 9"
#endif
#else
#define STARTUP_KNOB_LED_COLOR 0
#endif
#else
#define STARTUP_KNOB_LED_COLOR 0
#endif
#ifdef EXTRUDE_STEPS
#error "EXTRUDE_STEPS is now auto-configured with 'M92'. Please remove EXTRUDE_STEPS from your Configuration.h file."
#endif
#ifdef AUTO_BED_LEVELING
#error "AUTO_BED_LEVELING is now auto-configured with 'M115'. Please remove AUTO_BED_LEVELING from your Configuration.h file."
#endif
#ifdef ENABLE_UBL_VALUE
#if ENABLE_UBL_VALUE > 2
#error "ENABLE_UBL_VALUE cannot be greater than 2"
#endif
#if ENABLE_UBL_VALUE < 0
#error "ENABLE_UBL_VALUE cannot be less than 0"
#endif
#endif
#ifndef ENABLE_UBL_VALUE
#define ENABLE_UBL_VALUE 2
#endif
#ifdef FRIENDLY_PROBE_OFFSET_LANGUAGE
#if FRIENDLY_PROBE_OFFSET_LANGUAGE > 1
#error "FRIENDLY_PROBE_OFFSET_LANGUAGE cannot be greater than 1"
#endif
#if FRIENDLY_PROBE_OFFSET_LANGUAGE < 0
#error "FRIENDLY_PROBE_OFFSET_LANGUAGE cannot be less than 0"
#endif
#endif
#ifndef FRIENDLY_PROBE_OFFSET_LANGUAGE
#define FRIENDLY_PROBE_OFFSET_LANGUAGE 0
#endif
#ifdef QUICK_EEPROM_BUTTON
#if QUICK_EEPROM_BUTTON > 1
#error "QUICK_EEPROM_BUTTON cannot be greater than 1"
#endif
#if QUICK_EEPROM_BUTTON < 0
#error "QUICK_EEPROM_BUTTON cannot be less than 0"
#endif
#endif
#ifndef QUICK_EEPROM_BUTTON
#define QUICK_EEPROM_BUTTON 0
#endif
#ifdef CANCEL_PRINT_GCODE
#error "CANCEL_PRINT_GCODE is now PRINT_CANCEL_GCODE. Please update your Configuration.h file."
#endif
#ifndef ST7920_BANNER_TEXT
#define ST7920_BANNER_TEXT "LCD12864 Simulator"
#endif
#ifdef TOOL_NUM
#error "TOOL_NUM is now HOTEND_NUM. Please update your Configuration.h file."
#endif
#if HOTEND_NUM > MAX_HOTEND_COUNT
#error "HOTEND_NUM can not be more than 6"
#endif
#if EXTRUDER_NUM > MAX_EXT_COUNT
#error "EXTRUDER_NUM can not be more than 6"
#endif
#if FAN_NUM > MAX_FAN_COUNT
#error "FAN_NUM can not be more than 6"
#endif
#ifdef CUSTOM_0_LABEL
#define ENABLE_CUSTOM0 1
#else
#define ENABLE_CUSTOM0 0
#define CUSTOM_0_LABEL ""
#define CUSTOM_0_GCODE ""
#endif
#ifdef CUSTOM_1_LABEL
#define ENABLE_CUSTOM1 1
#else
#define ENABLE_CUSTOM1 0
#define CUSTOM_1_LABEL ""
#define CUSTOM_1_GCODE ""
#endif
#ifdef CUSTOM_2_LABEL
#define ENABLE_CUSTOM2 1
#else
#define ENABLE_CUSTOM2 0
#define CUSTOM_2_LABEL ""
#define CUSTOM_2_GCODE ""
#endif
#ifdef CUSTOM_3_LABEL
#define ENABLE_CUSTOM3 1
#else
#define ENABLE_CUSTOM3 0
#define CUSTOM_3_LABEL ""
#define CUSTOM_3_GCODE ""
#endif
#ifdef CUSTOM_4_LABEL
#define ENABLE_CUSTOM4 1
#else
#define ENABLE_CUSTOM4 0
#define CUSTOM_4_LABEL ""
#define CUSTOM_4_GCODE ""
#endif
#ifdef CUSTOM_5_LABEL
#define ENABLE_CUSTOM5 1
#else
#define ENABLE_CUSTOM5 0
#define CUSTOM_5_LABEL ""
#define CUSTOM_5_GCODE ""
#endif
#ifdef CUSTOM_6_LABEL
#define ENABLE_CUSTOM6 1
#else
#define ENABLE_CUSTOM6 0
#define CUSTOM_6_LABEL ""
#define CUSTOM_6_GCODE ""
#endif
#ifdef CUSTOM_7_LABEL
#define ENABLE_CUSTOM7 1
#else
#define ENABLE_CUSTOM7 0
#define CUSTOM_7_LABEL ""
#define CUSTOM_7_GCODE ""
#endif
#ifdef CUSTOM_8_LABEL
#define ENABLE_CUSTOM8 1
#else
#define ENABLE_CUSTOM8 0
#define CUSTOM_8_LABEL ""
#define CUSTOM_8_GCODE ""
#endif
#ifdef CUSTOM_9_LABEL
#define ENABLE_CUSTOM9 1
#else
#define ENABLE_CUSTOM9 0
#define CUSTOM_9_LABEL ""
#define CUSTOM_9_GCODE ""
#endif
#ifdef CUSTOM_10_LABEL
#define ENABLE_CUSTOM10 1
#else
#define ENABLE_CUSTOM10 0
#define CUSTOM_10_LABEL ""
#define CUSTOM_10_GCODE ""
#endif
#ifdef CUSTOM_11_LABEL
#define ENABLE_CUSTOM11 1
#else
#define ENABLE_CUSTOM11 0
#define CUSTOM_11_LABEL ""
#define CUSTOM_11_GCODE ""
#endif
#ifdef CUSTOM_12_LABEL
#define ENABLE_CUSTOM12 1
#else
#define ENABLE_CUSTOM12 0
#define CUSTOM_12_LABEL ""
#define CUSTOM_12_GCODE ""
#endif
#ifdef CUSTOM_13_LABEL
#define ENABLE_CUSTOM13 1
#else
#define ENABLE_CUSTOM13 0
#define CUSTOM_13_LABEL ""
#define CUSTOM_13_GCODE ""
#endif
#ifdef CUSTOM_14_LABEL
#define ENABLE_CUSTOM14 1
#else
#define ENABLE_CUSTOM14 0
#define CUSTOM_14_LABEL ""
#define CUSTOM_14_GCODE ""
#endif
#define CUSTOM_GCODE_ENABLED {ENABLE_CUSTOM0, ENABLE_CUSTOM1, ENABLE_CUSTOM2, ENABLE_CUSTOM3, ENABLE_CUSTOM4,\
ENABLE_CUSTOM5, ENABLE_CUSTOM6, ENABLE_CUSTOM7, ENABLE_CUSTOM8, ENABLE_CUSTOM9,\
ENABLE_CUSTOM10,ENABLE_CUSTOM11,ENABLE_CUSTOM12,ENABLE_CUSTOM13,ENABLE_CUSTOM14}
#define CUSTOM_GCODE_LIST {CUSTOM_0_GCODE, CUSTOM_1_GCODE, CUSTOM_2_GCODE, CUSTOM_3_GCODE, CUSTOM_4_GCODE,\
CUSTOM_5_GCODE, CUSTOM_6_GCODE, CUSTOM_7_GCODE, CUSTOM_8_GCODE, CUSTOM_9_GCODE,\
CUSTOM_10_GCODE,CUSTOM_11_GCODE,CUSTOM_12_GCODE,CUSTOM_13_GCODE,CUSTOM_14_GCODE }
#define CUSTOM_GCODE_LABELS {CUSTOM_0_LABEL, CUSTOM_1_LABEL, CUSTOM_2_LABEL, CUSTOM_3_LABEL, CUSTOM_4_LABEL,\
CUSTOM_5_LABEL, CUSTOM_6_LABEL, CUSTOM_7_LABEL, CUSTOM_8_LABEL, CUSTOM_9_LABEL,\
CUSTOM_10_LABEL,CUSTOM_11_LABEL,CUSTOM_12_LABEL,CUSTOM_13_LABEL,CUSTOM_14_LABEL }
#ifdef __cplusplus
}
#endif
#endif //_SANITYCHECK_H_
| 24.460938 | 128 | 0.737624 | [
"object"
] |
3f9dc647be91bd9e247c99226372d2f83a633b1e | 2,946 | h | C | include/mav_localization/ObservationModel.h | NEU-ZJX/mav_localization | 441cb3075df3cca4766e561d56c873c164cb26bd | [
"BSD-3-Clause"
] | null | null | null | include/mav_localization/ObservationModel.h | NEU-ZJX/mav_localization | 441cb3075df3cca4766e561d56c873c164cb26bd | [
"BSD-3-Clause"
] | 1 | 2021-05-13T09:06:28.000Z | 2022-01-19T14:38:14.000Z | include/mav_localization/ObservationModel.h | castacks/mav_localization | 441cb3075df3cca4766e561d56c873c164cb26bd | [
"BSD-3-Clause"
] | 4 | 2019-03-21T06:41:48.000Z | 2021-06-24T09:13:31.000Z | /*
* 6D localization for Micro Aerial Vehicle
*
* Copyright 20014-2015 Zheng Fang, Carnegie Mellon University
* Email: fangzheng81@gmail.com
*
*
*/
#ifndef MAVLOCALIZATION_OBSERVATIONMODEL_H_
#define MAVLOCALIZATION_OBSERVATIONMODEL_H_
#include <limits>
#include<cmath>
// #include <omp.h>
#include <ros/ros.h>
#include <tf/transform_datatypes.h>
#include <pcl_ros/transforms.h>
#include <mav_localization/MAVLocalization_defs.h>
#include <mav_localization/MapModel.h>
#include <octomap/octomap.h>
#include <sensor_msgs/PointCloud2.h>
namespace MAV_localization
{
/// sqrt(2*pi)
const static double SQRT_2_PI = 2.506628274;
/// log(sqrt(2*pi))
const static double LOG_SQRT_2_PI = 0.91893853320467274178;
class ObservationModel
{
public:
ObservationModel ( ros::NodeHandle* nh, boost::shared_ptr<MapModel> mapModel, EngineT * rngEngine );
virtual ~ObservationModel();
/// Helper function to compute the log likelihood
static inline double logLikelihood ( double x, double sigma )
{
assert ( !isnan ( x ) );
return -1.0* ( LOG_SQRT_2_PI ) - log ( sigma ) - ( ( x * x ) / ( 2* sigma * sigma ) );
}
/// Helper function to compute the log likelihood based on sqared distances
static inline double logLikelihoodSq ( double x_sq, double sigma )
{
assert ( !isnan ( x_sq ) );
return -1.0* ( LOG_SQRT_2_PI ) - log ( sigma ) - ( ( x_sq ) / ( 2* sigma * sigma ) );
}
//static double logLikelihoodSimple(double x, double sigma){
// return -((x * x) / (2* sigma * sigma));
//}
/**
* Integrate a measurement in particle set, update weights accordingly
* Particle weights should be in log scale before, weights are added.
*/
virtual void integrateMeasurement ( Particles& particles, const PointCloud& pc,
const std::vector<float>& ranges, float max_range,
const tf::Transform& baseToSensor, int bestParticleIdx ) = 0;
virtual void integratePoseMeasurement ( Particles& particles, double roll, double pitch,
const tf::StampedTransform& odomToBase );
virtual void integratePoseMeasurement ( Particles& particles, double roll, double pitch, double groundHeight );
virtual void setMap ( boost::shared_ptr<octomap::OcTree> map );
protected:
virtual bool getHeightError ( const Particle& p, const tf::StampedTransform& odomToBase, double& heightError ) const = 0;
boost::shared_ptr<MapModel> m_mapModel;
EngineT m_rngEngine;
NormalGeneratorT m_rngNormal;
UniformGeneratorT m_rngUniform;
boost::shared_ptr<octomap::OcTree> m_map;
ros::Publisher m_pc_pub;
double m_weightRoll;
double m_weightPitch;
double m_weightZ;
double m_sigmaZ;
double m_sigmaRoll;
double m_sigmaPitch;
bool m_use_squared_error;
};
}
#endif /* OBSERVATIONMODEL_H_ */
| 29.168317 | 127 | 0.674813 | [
"vector",
"transform"
] |
8b5db209ceebf63c82d04068a59fc7c215d796c7 | 3,195 | h | C | lib/libc/include/any-macos-any/dlfcn.h | lukekras/zig | 6f303c01f3e06fe8203563065ea32537f6eff456 | [
"MIT"
] | 12,718 | 2018-05-25T02:00:44.000Z | 2022-03-31T23:03:51.000Z | lib/libc/include/any-macos-any/dlfcn.h | lukekras/zig | 6f303c01f3e06fe8203563065ea32537f6eff456 | [
"MIT"
] | 8,483 | 2018-05-23T16:22:39.000Z | 2022-03-31T22:18:16.000Z | lib/libc/include/any-macos-any/dlfcn.h | lukekras/zig | 6f303c01f3e06fe8203563065ea32537f6eff456 | [
"MIT"
] | 1,400 | 2018-05-24T22:35:25.000Z | 2022-03-31T21:32:48.000Z | /*
* Copyright (c) 2004-2008 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
Based on the dlcompat work done by:
Jorge Acereda <jacereda@users.sourceforge.net> &
Peter O'Gorman <ogorman@users.sourceforge.net>
*/
#ifndef _DLFCN_H_
#define _DLFCN_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/cdefs.h>
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#include <stdbool.h>
#include <Availability.h>
#ifdef __DRIVERKIT_19_0
#define __DYLDDL_DRIVERKIT_UNAVAILABLE __API_UNAVAILABLE(driverkit)
#else
#define __DYLDDL_DRIVERKIT_UNAVAILABLE
#endif
/*
* Structure filled in by dladdr().
*/
typedef struct dl_info {
const char *dli_fname; /* Pathname of shared object */
void *dli_fbase; /* Base address of shared object */
const char *dli_sname; /* Name of nearest symbol */
void *dli_saddr; /* Address of nearest symbol */
} Dl_info;
extern int dladdr(const void *, Dl_info *);
#else
#define __DYLDDL_DRIVERKIT_UNAVAILABLE
#endif /* not POSIX */
extern int dlclose(void * __handle) __DYLDDL_DRIVERKIT_UNAVAILABLE;
extern char * dlerror(void) __DYLDDL_DRIVERKIT_UNAVAILABLE;
extern void * dlopen(const char * __path, int __mode) __DYLDDL_DRIVERKIT_UNAVAILABLE;
extern void * dlsym(void * __handle, const char * __symbol) __DYLDDL_DRIVERKIT_UNAVAILABLE;
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
extern bool dlopen_preflight(const char* __path) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) __DYLDDL_DRIVERKIT_UNAVAILABLE;
#endif /* not POSIX */
#define RTLD_LAZY 0x1
#define RTLD_NOW 0x2
#define RTLD_LOCAL 0x4
#define RTLD_GLOBAL 0x8
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define RTLD_NOLOAD 0x10
#define RTLD_NODELETE 0x80
#define RTLD_FIRST 0x100 /* Mac OS X 10.5 and later */
/*
* Special handle arguments for dlsym().
*/
#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
#define RTLD_SELF ((void *) -3) /* Search this and subsequent objects (Mac OS X 10.5 and later) */
#define RTLD_MAIN_ONLY ((void *) -5) /* Search main executable only (Mac OS X 10.5 and later) */
#endif /* not POSIX */
#ifdef __cplusplus
}
#endif
#endif /* _DLFCN_H_ */ | 32.938144 | 131 | 0.734585 | [
"object"
] |
8b6253fd15d739606c9a7ae2a4566b14ffc4ab72 | 18,124 | h | C | src/table_store/table/table.h | KayzzzZ/pixie | e4d1f394ababd4bdf825debe76a6842241461ad4 | [
"Apache-2.0"
] | null | null | null | src/table_store/table/table.h | KayzzzZ/pixie | e4d1f394ababd4bdf825debe76a6842241461ad4 | [
"Apache-2.0"
] | null | null | null | src/table_store/table/table.h | KayzzzZ/pixie | e4d1f394ababd4bdf825debe76a6842241461ad4 | [
"Apache-2.0"
] | 2 | 2022-01-21T06:28:36.000Z | 2022-01-24T03:36:54.000Z | /*
* Copyright 2018- The Pixie 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <absl/synchronization/mutex.h>
#include <arrow/array.h>
#include <arrow/record_batch.h>
#include <algorithm>
#include <deque>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <variant>
#include <vector>
#include <absl/base/internal/spinlock.h>
#include <absl/strings/str_format.h>
#include "src/common/base/base.h"
#include "src/common/metrics/metrics.h"
#include "src/shared/types/column_wrapper.h"
#include "src/shared/types/types.h"
#include "src/table_store/schema/relation.h"
#include "src/table_store/schema/row_batch.h"
#include "src/table_store/schema/row_descriptor.h"
#include "src/table_store/schemapb/schema.pb.h"
#include "src/table_store/table/table_metrics.h"
DECLARE_int32(table_store_table_size_limit);
namespace px {
namespace table_store {
using RecordBatchSPtr = std::shared_ptr<arrow::RecordBatch>;
struct TableStats {
int64_t bytes;
int64_t cold_bytes;
int64_t num_batches;
int64_t batches_added;
int64_t batches_expired;
int64_t compacted_batches;
int64_t max_table_size;
int64_t min_time;
};
struct BatchSlice {
// All properties with the unsafe_ prefix should not be touched except inside of Table with the
// proper lock held.
mutable bool unsafe_is_hot;
mutable int64_t unsafe_batch_index;
mutable int64_t unsafe_row_start;
mutable int64_t unsafe_row_end;
mutable int64_t generation = -1;
int64_t uniq_row_start_idx = -1;
int64_t uniq_row_end_idx = -1;
int64_t Size() const { return uniq_row_end_idx - uniq_row_start_idx + 1; }
bool IsValid() const { return uniq_row_start_idx != -1 && uniq_row_end_idx != -1; }
static BatchSlice Invalid() { return BatchSlice{false, -1, -1, -1}; }
static BatchSlice Cold(int64_t cold_index, int64_t row_start, int64_t row_end, int64_t generation,
std::pair<int64_t, int64_t> row_ids) {
return BatchSlice{false, cold_index, row_start, row_end,
generation, row_ids.first, row_ids.second};
}
static BatchSlice Cold(int64_t cold_index, int64_t row_start, int64_t row_end, int64_t generation,
int64_t uniq_row_start_idx, int64_t uniq_row_end_idx) {
return BatchSlice{false, cold_index, row_start, row_end,
generation, uniq_row_start_idx, uniq_row_end_idx};
}
static BatchSlice Hot(int64_t hot_index, int64_t row_start, int64_t row_end, int64_t generation,
std::pair<int64_t, int64_t> row_ids) {
return BatchSlice{true, hot_index, row_start, row_end,
generation, row_ids.first, row_ids.second};
}
static BatchSlice Hot(int64_t hot_index, int64_t row_start, int64_t row_end, int64_t generation,
int64_t uniq_row_start_idx, int64_t uniq_row_end_idx) {
return BatchSlice{true, hot_index, row_start, row_end,
generation, uniq_row_start_idx, uniq_row_end_idx};
}
};
class ArrowArrayCompactor {
public:
ArrowArrayCompactor(const schema::Relation& rel, arrow::MemoryPool* mem_pool);
Status AppendColumn(int64_t col_idx, std::shared_ptr<arrow::Array> arr);
Status Finish();
const std::vector<std::shared_ptr<arrow::Array>>& output_columns() const {
return output_columns_;
}
int64_t Size() const { return bytes_; }
private:
int64_t bytes_ = 0;
std::vector<std::shared_ptr<arrow::Array>> output_columns_;
std::vector<std::unique_ptr<arrow::ArrayBuilder>> builders_;
std::vector<types::DataType> column_types_;
template <types::DataType TDataType>
Status AppendColumnTyped(int64_t col_idx, std::shared_ptr<arrow::Array> arr) {
auto builder_untyped = builders_[col_idx].get();
auto builder = static_cast<typename types::DataTypeTraits<TDataType>::arrow_builder_type*>(
builder_untyped);
auto typed_arr =
std::static_pointer_cast<typename types::DataTypeTraits<TDataType>::arrow_array_type>(arr);
PL_RETURN_IF_ERROR(builder->Reserve(typed_arr->length()));
for (int i = 0; i < typed_arr->length(); ++i) {
builder->UnsafeAppend(typed_arr->Value(i));
}
bytes_ += types::GetArrowArrayBytes<TDataType>(typed_arr.get());
return Status::OK();
}
template <types::DataType TDataType>
Status FinishTyped(int64_t col_idx) {
auto builder_untyped = builders_[col_idx].get();
auto builder = static_cast<typename types::DataTypeTraits<TDataType>::arrow_builder_type*>(
builder_untyped);
PL_RETURN_IF_ERROR(builder->Finish(&output_columns_[col_idx]));
return Status::OK();
}
};
/**
* Table stores data in two separate partitions, hot and cold. Hot data is "hot" from the
* perspective of writes, in other words data is first written to the hot partitiion, and then later
* moved to the cold partition. Reads can hit both hot and cold data. Hot data can be written in
* RecordBatch format (i.e. for writes from stirling) or schema::RowBatch format (i.e. for writes
* from MemorySinkNodes, which are not currently used). Hot data is stored in a deque, while cold
* data is stored in a ring buffer. Hot data is eventually converted to arrow arrays either during
* compaction and transfer to cold or during a read. If the conversion happens on read then we store
* the arrow array in a cache with the hot batch so that future reads, before this batch is
* transferred to cold, don't also need to convert to arrow.
*
* Synchronization Scheme:
* The hot and cold partitions are synchronized separately with spinlocks. Additionally, the
* generation of the store is protected by a spinlock.
*
* Compaction Scheme:
* Hot batches are compacted into batches of minimum size min_cold_batch_size_ bytes. The compaction
* routine should be called periodically but that is not the responsibility of this class.
*
* Time and Row Indexing:
* The first and last values of the time columns for each batch are stored as intervals in
* (hot/cold)_time_, which internally maintains a sorted list for O(logN) time lookup. Additionally,
* this class supports multiple batches with the same timestamps. In order to support this, we keep
* track of an incrementing identifier for each row (we store only the identifiers of the first and
* last rows in a batch). This allows us to support returning only valid data even if a compaction
* occurs in the middle of query execution. For example, suppose we have two batches of data all
* with the same timestamps. Suppose a query reads through all this data. Now after reading the
* first batch, compaction is called and both batches are compacted together and put into cold
* storage. Then if the query were to naively try to access the "second" batch since it already saw
* the "first" batch, there wouldn't be any more data and the query will have skipped all the rows
* in what was initially the "second" batch. Instead, the BatchSlice object stores the unique row
* identifiers of the first and last row of that batch, so that when NextBatch is called on that
* batch it can work out that it needs to return a slice of the batch with the original "second"
* batch's data.
*/
class Table : public NotCopyable {
using RecordBatchPtr = std::unique_ptr<px::types::ColumnWrapperRecordBatch>;
using ArrowArrayPtr = std::shared_ptr<arrow::Array>;
using ColumnBuffer = std::vector<ArrowArrayPtr>;
using TimeInterval = std::pair<int64_t, int64_t>;
using RowIDInterval = std::pair<int64_t, int64_t>;
struct RecordBatchWithCache {
RecordBatchPtr record_batch;
// Whenever we have to convert a hot batch to an arrow array, we store the arrow array in
// this cache. Compaction will eventually take these arrow arrays and move them into cold.
mutable std::vector<ArrowArrayPtr> arrow_cache;
mutable std::vector<bool> cache_validity;
};
using RecordOrRowBatch = std::variant<RecordBatchWithCache, schema::RowBatch>;
static inline constexpr int64_t kDefaultColdBatchMinSize = 64 * 1024;
public:
static inline constexpr int64_t kMaxBatchesPerCompactionCall = 256;
using StopPosition = int64_t;
static inline std::shared_ptr<Table> Create(std::string_view table_name,
const schema::Relation& relation) {
// Create naked pointer, because std::make_shared() cannot access the private ctor.
return std::shared_ptr<Table>(
new Table(table_name, relation, FLAGS_table_store_table_size_limit));
}
/**
* @brief Construct a new Table object along with its columns. Can be used to create
* a table (along with columns) based on a subscription message from Stirling.
*
* @param relation the relation for the table.
* @param max_table_size the maximum number of bytes that the table can hold. This is limitless
* (-1) by default.
*/
explicit Table(std::string_view table_name, const schema::Relation& relation,
size_t max_table_size)
: Table(table_name, relation, max_table_size, kDefaultColdBatchMinSize) {}
Table(std::string_view table_name, const schema::Relation& relation, size_t max_table_size,
size_t min_cold_batch_size);
/**
* Get a RowBatch of data corresponding to the passed in BatchSlice.
* @param slice the BatchSlice to get the data for.
* @param cols a vector of column indices to get data for.
* @param mem_pool the arrow memory pool to use if the slice is in hot storage.
* @return a unique ptr to a RowBatch with the requested data.
*/
StatusOr<std::unique_ptr<schema::RowBatch>> GetRowBatchSlice(const BatchSlice& slice,
const std::vector<int64_t>& cols,
arrow::MemoryPool* mem_pool) const;
/**
* Writes a row batch to the table.
* @param rb Rowbatch to write to the table.
*/
Status WriteRowBatch(const schema::RowBatch& rb);
/**
* Transfers the given record batch (from Stirling) into the Table.
*
* @param record_batch the record batch to be appended to the Table.
* @return status
*/
Status TransferRecordBatch(std::unique_ptr<px::types::ColumnWrapperRecordBatch> record_batch);
schema::Relation GetRelation() const;
StatusOr<std::vector<RecordBatchSPtr>> GetTableAsRecordBatches() const;
/**
* @param time the timestamp to search for.
* @param mem_pool the arrow memory pool.
* @return the BatchSlice of the first row with timestamp greater than or equal to the given time,
* until the end of its corresponding row batch.
*/
StatusOr<BatchSlice> FindBatchSliceGreaterThanOrEqual(int64_t time,
arrow::MemoryPool* mem_pool) const;
/**
* @param time the timestamp to search for.
* @param mem_pool the arrow memory pool.
* @return the BatchSlice of the last row with timestamp less than or equal to the given time,
* until the end of its corresponding row batch.
*/
StatusOr<StopPosition> FindStopPositionForTime(int64_t time, arrow::MemoryPool* mem_pool) const;
/**
* Covert the table and store in passed in proto.
* @param table_proto The table proto to write to.
* @return Status of conversion.
*/
Status ToProto(table_store::schemapb::Table* table_proto) const;
TableStats GetTableStats() const;
/**
* Gets the BatchSlice corresponding to the next batch after the given batch.
* The BatchSlice will be cut short to ensure it doesn't extend past the given StopPosition.
* If there are no more batches or the next BatchSlice would be entirely beyond the given
* StopPosition then an Invalid BatchSlice is returned. Using this function iteratively will
* ensure that all rows are seen even if a table compaction occurs during the iteration. This
* means in some cases NextBatch will return a BatchSlice with the same batch index as the passed
* in batch, but with a different slice of rows.
*
* @param slice The BatchSlice to get the next batch for.
* @param stop The StopPosition (unique row identifier) that the NextBatch should not extend
* beyond.
* @return A BatchSlice corresponding to the next slice of rows after the given slice but before
* the stop position.
*/
BatchSlice NextBatch(const BatchSlice& slice, StopPosition stop) const;
BatchSlice NextBatch(const BatchSlice& slice) const { return NextBatch(slice, End()); }
/**
* @returns a BatchSlice corresponding to the first batch in the table.
*/
BatchSlice FirstBatch() const;
/**
* @return A stop position 1 row past the end of the table.
*/
StopPosition End() const;
/**
* Reduces the extent of a BatchSlice to ensure that it doesn't include rows past the given stop
* position.
* @param slice the BatchSlice to cut short if its past the stop position.
* @param stop the StopPosition to cut short at.
* @return a new BatchSlice that doesn't extend past the StopPosition.
*/
BatchSlice SliceIfPastStop(const BatchSlice& slice, StopPosition stop) const;
/**
* Compacts hot batches into min_cold_batch_size_ sized cold batches. Each call to
* CompactHotToCold will create a maximum of kMaxBatchesPerCompactionCall cold batches.
* @param mem_pool arrow MemoryPool to be used for creating new cold batches.
*/
Status CompactHotToCold(arrow::MemoryPool* mem_pool);
private:
TableMetrics metrics_;
Status ExpireRowBatches(int64_t row_batch_size);
schema::Relation rel_;
mutable absl::base_internal::SpinLock stats_lock_;
int64_t batches_expired_ ABSL_GUARDED_BY(stats_lock_) = 0;
int64_t cold_bytes_ ABSL_GUARDED_BY(stats_lock_) = 0;
int64_t hot_bytes_ ABSL_GUARDED_BY(stats_lock_) = 0;
int64_t batches_added_ ABSL_GUARDED_BY(stats_lock_) = 0;
int64_t compacted_batches_ ABSL_GUARDED_BY(stats_lock_) = 0;
int64_t max_table_size_ = 0;
int64_t min_cold_batch_size_;
mutable absl::Mutex hot_lock_;
std::deque<RecordOrRowBatch> hot_batches_ ABSL_GUARDED_BY(hot_lock_);
mutable absl::Mutex cold_lock_;
std::vector<ColumnBuffer> cold_column_buffers_ ABSL_GUARDED_BY(cold_lock_);
// The generation lock must be held during compaction and
// expiration, and anytime one would like to access the unsafe_ attributes of BatchSlice.
mutable absl::Mutex generation_lock_;
// Generation of the HotColdDataStore is incremented whenever a change to the store would
// invalidate some BatchSlice', eg. during compaction or hot expiration.
int64_t generation_ ABSL_GUARDED_BY(generation_lock_);
// We store ring buffer properties at the table level rather than for each individual Column.
int64_t ring_front_idx_ ABSL_GUARDED_BY(cold_lock_) = 0;
int64_t ring_back_idx_ ABSL_GUARDED_BY(cold_lock_) = -1;
int64_t ring_capacity_ ABSL_GUARDED_BY(cold_lock_);
// Counter to assign a unique row ID to each row. Synchronized by hot_lock_ since its only
// accessed on a hot write.
int64_t next_row_id_ ABSL_GUARDED_BY(hot_lock_) = 0;
std::deque<RowIDInterval> hot_row_ids_ ABSL_GUARDED_BY(hot_lock_);
std::deque<TimeInterval> hot_time_ ABSL_GUARDED_BY(hot_lock_);
std::deque<RowIDInterval> cold_row_ids_ ABSL_GUARDED_BY(cold_lock_);
std::deque<TimeInterval> cold_time_ ABSL_GUARDED_BY(cold_lock_);
int64_t time_col_idx_ = -1;
Status WriteHot(RecordBatchPtr record_batch);
Status WriteHot(const schema::RowBatch& rb);
Status UpdateTimeRowIndices(const schema::RowBatch& rb) ABSL_EXCLUSIVE_LOCKS_REQUIRED(hot_lock_);
Status UpdateTimeRowIndices(types::ColumnWrapperRecordBatch* record_batch)
ABSL_EXCLUSIVE_LOCKS_REQUIRED(hot_lock_);
Status ExpireBatch();
Status ExpireHot();
StatusOr<bool> ExpireCold();
Status CompactSingleBatch(arrow::MemoryPool* mem_pool);
Status AddBatchSliceToRowBatch(const BatchSlice& slice, const std::vector<int64_t>& cols,
schema::RowBatch* output_rb, arrow::MemoryPool* mem_pool) const;
ArrowArrayPtr GetHotColumnUnlocked(const RecordBatchWithCache* record_batch_ptr, int64_t col_idx,
arrow::MemoryPool* mem_pool) const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(hot_lock_);
int64_t NumBatches() const;
int64_t ColdBatchLengthUnlocked(int64_t ring_index) const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
int64_t HotBatchLengthUnlocked(int64_t hot_index) const ABSL_EXCLUSIVE_LOCKS_REQUIRED(hot_lock_);
// Returns the unique identifier of the last row less than or equal to the given time.
int64_t FindStopTime(int64_t time, arrow::MemoryPool* mem_pool) const;
// Returns the index into cold_row_ids_ or cold_time_ given the ring buffer location.
int64_t RingVectorIndexUnlocked(int64_t ring_index) const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
// Returns the index into the ring buffer given a vector index into cold_row_ids_ or cold_time_.
int64_t RingIndexUnlocked(int64_t vector_index) const ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
int64_t RingSizeUnlocked() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
int64_t RingNextAddrUnlocked(int64_t ring_index) const ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
Status AdvanceRingBufferUnlocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(cold_lock_);
Status UpdateSliceUnlocked(const BatchSlice& slice) const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(generation_lock_);
BatchSlice NextBatchWithoutStop(const BatchSlice& slice) const;
};
} // namespace table_store
} // namespace px
| 45.084577 | 100 | 0.737751 | [
"object",
"vector"
] |
8b64ae11f40002af89fceb672bcca405d0ca6266 | 71,981 | c | C | tdfc2/src/common/construct/construct.c | dj3vande/tendra | 86981ad5574f55821853e3bdf5f82e373f91edb2 | [
"BSD-3-Clause"
] | null | null | null | tdfc2/src/common/construct/construct.c | dj3vande/tendra | 86981ad5574f55821853e3bdf5f82e373f91edb2 | [
"BSD-3-Clause"
] | null | null | null | tdfc2/src/common/construct/construct.c | dj3vande/tendra | 86981ad5574f55821853e3bdf5f82e373f91edb2 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2002-2011, The TenDRA Project.
* Copyright 1997-1998, United Kingdom Secretary of State for Defence.
*
* See doc/copyright/ for the full copyright terms.
*/
#include <stdio.h>
#include <shared/check.h>
#include <tdf/bitstream.h>
#include <tdf/capsule.h>
#include <utility/config.h>
#include "c_types.h"
#include <utility/error.h>
#include <utility/catalog.h>
#include <utility/option.h>
#include <utility/buffer.h>
#include <syntax/syntax.h>
#include <parse/constant.h>
#include <parse/hash.h>
#include <parse/predict.h>
#include <parse/preproc.h>
#include <construct/access.h>
#include <construct/allocate.h>
#include <construct/assign.h>
#include <construct/basetype.h>
#include <construct/cast.h>
#include <construct/check.h>
#include <construct/chktype.h>
#include <construct/class.h>
#include <construct/construct.h>
#include <construct/convert.h>
#include <construct/copy.h>
#include <construct/chktype.h>
#include <construct/declare.h>
#include <construct/derive.h>
#include <construct/destroy.h>
#include <construct/exception.h>
#include <construct/expression.h>
#include <construct/function.h>
#include <construct/identifier.h>
#include <construct/initialise.h>
#include <construct/instance.h>
#include <construct/label.h>
#include <construct/namespace.h>
#include <construct/operator.h>
#include <construct/overload.h>
#include <construct/statement.h>
#include <construct/template.h>
#include <construct/token.h>
#include <construct/link.h>
#include <output/capsule.h>
#include <output/compile.h>
#include <output/dump.h>
#include "ctype_ops.h"
#include "exp_ops.h"
#include "graph_ops.h"
#include "hashid_ops.h"
#include "id_ops.h"
#include "member_ops.h"
#include "nspace_ops.h"
#include "off_ops.h"
#include "type_ops.h"
/*
If t is a function type with an inferred return type then the actual
return type is set according to id. The routine returns the original
inferred return type.
*/
TYPE
inferred_return(TYPE t, IDENTIFIER id)
{
if (IS_type_func(t)) {
TYPE r = DEREF_type(type_func_ret(t));
if (is_type_inferred(r) == INFERRED_EMPTY) {
HASHID nm = DEREF_hashid(id_name(id));
switch (TAG_hashid(nm)) {
case hashid_constr_tag:
case hashid_destr_tag: {
/* Constructors and destructors */
COPY_type(type_func_ret(t), type_void);
break;
}
case hashid_conv_tag: {
/* Conversion functions */
TYPE s = DEREF_type(hashid_conv_type(nm));
COPY_type(type_func_ret(t), s);
break;
}
}
return r;
}
}
return NULL_type;
}
/*
This routine checks whether the function type fn has first parameter
of type '[volatile] ct &', 'const [volatile] ct &' or '[const]
[volatile] ct' with any subsequent parameters being optional. It
returns 1, 2 and 3 respectively in these cases, or 0 if fn does not
match this description.
*/
static int
check_copy_constr(TYPE fn, CLASS_TYPE ct)
{
int c = 0;
if (IS_type_templ(fn)) {
/* Allow for template constructors */
in_template_decl++;
fn = DEREF_type(type_templ_defn(fn));
c = check_copy_constr(fn, ct);
in_template_decl--;
} else {
LIST(IDENTIFIER)pids = DEREF_list(type_func_pids(fn));
if (!IS_NULL_list(pids)) {
/* Have at least one parameter */
IDENTIFIER pid = DEREF_id(HEAD_list(pids));
TYPE t = DEREF_type(id_parameter_type(pid));
/* Check for second parameter */
pids = TAIL_list(pids);
if (!IS_NULL_list(pids)) {
/* Second parameter must have a default
* argument */
EXP e;
pid = DEREF_id(HEAD_list(pids));
e = DEREF_exp(id_parameter_init(pid));
if (IS_NULL_exp(e)) {
return 0;
}
}
/* Check parameter type */
if (IS_type_ref(t)) {
TYPE s = DEREF_type(type_ref_sub(t));
if (IS_type_compound(s)) {
CLASS_TYPE cs =
DEREF_ctype(type_compound_defn(s));
if (eq_ctype(cs, ct)) {
/* Reference to same class */
CV_SPEC qual =
DEREF_cv(type_qual(s));
c = ((qual & cv_const) ? 2 : 1);
}
} else if (is_templ_type(s)) {
/* Reference to template parameter */
CV_SPEC qual = DEREF_cv(type_qual(s));
c = ((qual & cv_const)? 2 : 1);
}
} else if (IS_type_compound(t)) {
CLASS_TYPE cs =
DEREF_ctype(type_compound_defn(t));
if (eq_ctype(cs, ct)) {
c = 3;
}
} else if (is_templ_type(t)) {
/* Template parameter */
c = 1;
}
}
}
return c;
}
/*
This routine checks the function type t for the constructor id declared
in namespace ns. The check that the constructor is a non-static member
function is carried out elsewhere. Note that no return type can be given
for id - it is implicitly void. Remedial action is taken to transform
illegal copy constructors such as 'X::X ( X )' into valid constructors
such as 'X::X ( X & )'. This is to avoid having to check for infinite
loops later.
*/
TYPE
check_constr(TYPE t, IDENTIFIER id, NAMESPACE ns)
{
if (IS_type_templ(t)) {
/* Allow for template types */
TYPE s = DEREF_type(type_templ_defn(t));
s = check_constr(s, id, ns);
COPY_type(type_templ_defn(t), s);
} else {
/* Decompose function type */
TYPE r = DEREF_type(type_func_ret(t));
CV_SPEC cv = DEREF_cv(type_func_mqual(t));
/* Find underlying class */
CLASS_TYPE ct = namespace_class(ns);
/* No return type can be given for a constructor */
if (is_type_inferred(r)!= INFERRED_EMPTY) {
HASHID nm = DEREF_hashid(id_name(id));
report(crt_loc, ERR_class_ctor_ret(nm));
}
COPY_type(type_func_ret(t), type_void);
/* Check for invalid copy constructors */
if (check_copy_constr(t, ct) == 3) {
HASHID nm = DEREF_hashid(id_name(id));
report(crt_loc, ERR_class_copy_bad(nm));
}
/* A constructor cannot be cv-qualified */
if (cv & cv_qual) {
HASHID nm = DEREF_hashid(id_name(id));
report(crt_loc, ERR_class_ctor_qual(nm, cv));
}
}
return t;
}
/*
This routine checks the function type t for the destructor id. The
check that the destructor is a non-static member function is carried
out elsewhere. Note that no return type can be given for id - it is
implicitly void.
*/
TYPE
check_destr(TYPE t, IDENTIFIER id, NAMESPACE ns)
{
if (IS_type_templ(t)) {
/* Allow for template types */
TYPE s = DEREF_type(type_templ_defn(t));
s = check_destr(s, id, ns);
COPY_type(type_templ_defn(t), s);
} else {
/* Decompose function type */
TYPE r = DEREF_type(type_func_ret(t));
CV_SPEC cv = DEREF_cv(type_func_mqual(t));
int ell = DEREF_int(type_func_ellipsis(t));
LIST(TYPE)p = DEREF_list(type_func_ptypes(t));
/* Check namespace */
HASHID nm = DEREF_hashid(id_name(id));
TYPE dt = DEREF_type(hashid_destr_type(nm));
if (IS_type_compound(dt)) {
/* Check inheritance */
CLASS_TYPE dct = DEREF_ctype(type_compound_defn(dt));
NAMESPACE dns = DEREF_nspace(ctype_member(dct));
if (!EQ_nspace(dns, ns)) {
report(crt_loc, ERR_class_dtor_inherit(nm, ns));
}
}
/* No return type can be given for a destructor */
if (is_type_inferred(r)!= INFERRED_EMPTY) {
report(crt_loc, ERR_class_dtor_ret(nm));
}
COPY_type(type_func_ret(t), type_void);
/* No parameter types can be given for a destructor */
if (!IS_NULL_list(p) || ell) {
report(crt_loc, ERR_class_dtor_pars(nm));
}
/* A destructor cannot be cv-qualified */
if (cv & cv_qual) {
report(crt_loc, ERR_class_dtor_qual(nm, cv));
}
}
return t;
}
/*
This routine checks the function type t for the conversion function id.
The check that the converter is a non-static member function is carried
out elsewhere. Note that no return type can be given for id - it is
inferred from the type used in id. This may not be a legal return type,
so inject_pre_type is used to check it.
*/
TYPE
check_conv(TYPE t, IDENTIFIER id)
{
if (IS_type_templ(t)) {
/* Allow for template types */
TYPE s = DEREF_type(type_templ_defn(t));
s = check_conv(s, id);
COPY_type(type_templ_defn(t), s);
} else {
/* Find the conversion type */
HASHID nm = DEREF_hashid(id_name(id));
TYPE s = DEREF_type(hashid_conv_type(nm));
/* Decompose function type */
TYPE r = DEREF_type(type_func_ret(t));
int ell = DEREF_int(type_func_ellipsis(t));
LIST(TYPE)p = DEREF_list(type_func_ptypes(t));
/* No return type can be given for a conversion function */
if (is_type_inferred(r)!= INFERRED_EMPTY) {
/* If a return type is given it might as well be
* right */
if (eq_type(r, s)) {
report(crt_loc, ERR_class_conv_fct_ret(nm));
} else {
report(crt_loc,
ERR_class_conv_fct_ret_bad(nm, r));
}
}
COPY_type(type_func_ret(t), NULL_type);
t = inject_pre_type(t, s, 0);
/* No parameter types can be given for a conversion function */
if (!IS_NULL_list(p) || ell) {
report(crt_loc, ERR_class_conv_fct_pars(nm));
}
/* Can't have conversion to cv-qualified void */
if (IS_type_top_etc(s)) {
report(crt_loc, ERR_class_conv_fct_void(nm));
}
}
return t;
}
/*
This routine looks up the overloaded operator function 'operator op'
in the class ct.
*/
IDENTIFIER
find_operator(CLASS_TYPE ct, int op)
{
HASHID nm = lookup_op(op);
NAMESPACE cns = DEREF_nspace(ctype_member(ct));
IDENTIFIER id = search_field(cns, nm, 0, 0);
return id;
}
/*
This routine finds either a default constructor, a copy constructor,
a default destructor or a copy assignment operator of the class ct,
depending on the value of n. The null identifier is returned and
an error is added to err if such a function does not exist (including
for incomplete types).
*/
static IDENTIFIER
find_constr(CLASS_TYPE ct, int n, ERROR *err)
{
CLASS_INFO ci;
int match = 0;
int nargs = 0;
int kind = KIND_FUNC;
IDENTIFIER id = NULL_id;
IDENTIFIER qid = NULL_id;
/* Check for complete types */
complete_class(ct, 1);
ci = DEREF_cinfo(ctype_info(ct));
if (!(ci & cinfo_complete)) {
return NULL_id;
}
/* Find the basic identifier */
switch (n) {
case DEFAULT_CONSTR:
case DEFAULT_COPY:
case DEFAULT_USR: {
/* Find constructors */
id = DEREF_id(ctype_constr(ct));
if (n == DEFAULT_COPY) {
nargs = 1;
}
kind = KIND_CONSTR;
break;
}
case DEFAULT_DESTR:
case DEFAULT_DELETE: {
/* Find destructors */
id = DEREF_id(ctype_destr(ct));
nargs = 1;
break;
}
case DEFAULT_ASSIGN: {
/* Find 'operator =' */
id = find_operator(ct, lex_assign);
nargs = 2;
break;
}
}
/* Find appropriate function */
if (!IS_NULL_id(id) && IS_id_mem_func(id)) {
DECL_SPEC ds = DEREF_dspec(id_storage(id));
if (ds & dspec_template) {
/* Allow for template constructors */
match = 2;
} else {
switch (n) {
case DEFAULT_CONSTR:
case DEFAULT_DESTR:
case DEFAULT_DELETE:
case DEFAULT_USR: {
/* Should take no arguments */
IDENTIFIER pid = id;
while (!IS_NULL_id(pid)) {
TYPE t =
DEREF_type(id_mem_func_type(pid));
if (min_no_args(t) == 1) {
qid = pid;
match++;
}
pid = DEREF_id(id_mem_func_over(pid));
}
break;
}
case DEFAULT_COPY:
case DEFAULT_ASSIGN: {
/* Should be a copy constructor */
IDENTIFIER pid = id;
while (!IS_NULL_id(pid)) {
TYPE t =
DEREF_type(id_mem_func_type(pid));
if (check_copy_constr(t, ct)) {
qid = pid;
match++;
}
pid = DEREF_id(id_mem_func_over(pid));
}
break;
}
}
}
} else {
/* This can only happen for dummy classes */
return NULL_id;
}
/* Deal with ambiguous cases */
if (match > 1) {
CANDIDATE_LIST *p = &candidates;
p->size = 0;
add_candidates(p, id, 1, KIND_CONSTR);
if (p->size) {
CANDIDATE *q;
unsigned rank;
TYPE t = make_class_type(ct);
LIST(EXP)args = NULL_list(EXP);
while (nargs) {
/* Create dummy arguments */
EXP a;
MAKE_exp_value(t, a);
CONS_exp(a, args, args);
nargs--;
}
if (kind == KIND_CONSTR) {
swap_candidates(p,(unsigned)0);
}
q = resolve_overload(p, args, t, 0);
if (kind == KIND_CONSTR) {
swap_candidates(p,(unsigned)0);
}
rank = q->rank;
if (rank >= RANK_VIABLE) {
qid = q->func;
if (rank == RANK_BEST) {
/* Best match */
if (match_no_viable > 1) {
ERROR err2;
if (kind == KIND_CONSTR) {
err2 = ERR_over_match_ctor_ok(qid);
} else {
err2 = ERR_over_match_call_ok(qid);
}
add_error(err, err2);
}
match = 1;
} else {
/* Ambiguous call */
ERROR err2;
if (kind == KIND_CONSTR) {
err2 = ERR_over_match_ctor_ambig(qid);
} else {
err2 = ERR_over_match_call_ambig(qid);
}
err2 = list_candidates(err2, p, RANK_VIABLE);
add_error(err, err2);
}
} else {
/* No viable call */
qid = NULL_id;
match = 0;
}
if (!IS_NULL_list(args)) {
free_exp_list(args, 1);
}
} else {
/* No viable call */
qid = NULL_id;
match = 0;
}
}
/* Report error */
if (match == 0) {
switch (n) {
case DEFAULT_CONSTR:
case DEFAULT_USR: {
add_error(err, ERR_class_ctor_default(ct));
break;
}
case DEFAULT_COPY: {
add_error(err, ERR_class_copy_constr(ct));
break;
}
case DEFAULT_DESTR:
case DEFAULT_DELETE: {
add_error(err, ERR_class_dtor_default(ct));
break;
}
case DEFAULT_ASSIGN: {
add_error(err, ERR_class_copy_assign(ct));
break;
}
}
}
return qid;
}
/*
This routine finds the number of extra constructor arguments required
by the member function id of the class ct. For constructors and
assignment operators for classes with a virtual base the extra
argument is true to indicate that the virtual components should be
initialised. For non-trivial destructors bit 1 of the extra argument
is used to indicate that any virtual components should be destroyed,
while bit 0 is used to indicate that 'operator delete' should be
called on the argument. The macros EXTRA_* are used to represent
these values.
*/
unsigned
extra_constr_args(IDENTIFIER id, CLASS_TYPE ct)
{
DECL_SPEC ds = DEREF_dspec(id_storage(id));
if (!(ds & dspec_trivial)) {
HASHID nm = DEREF_hashid(id_name(id));
unsigned tag = TAG_hashid(nm);
if (tag == hashid_constr_tag) {
/* Constructors */
CLASS_INFO ci = DEREF_cinfo(ctype_info(ct));
if (ci & cinfo_virtual_base) {
return 1;
}
} else if (tag == hashid_destr_tag) {
/* Destructors */
return 1;
}
}
return 0;
}
/*
This flag is set to true in a constructor base class initialiser.
This overrides the value of any extra arguments passed to the
constructor.
*/
static int in_ctor_base_init = 0;
/*
This routine adds any necessary extra constructor arguments to the
member function call expression e. ct gives the associate class
type and v is the value to be passed to such arguments.
*/
EXP
add_constr_args(EXP e, CLASS_TYPE ct, int v)
{
if (IS_exp_func_id(e)) {
IDENTIFIER id = DEREF_id(exp_func_id_id(e));
unsigned n = extra_constr_args(id, ct);
if (n) {
LIST(EXP)args = DEREF_list(exp_func_id_args(e));
LIST(EXP)extra = NULL_list(EXP);
if (in_ctor_base_init) {
v = 0;
}
while (n) {
EXP a;
NAT c = small_nat[v];
MAKE_exp_int_lit(type_sint, c,
exp_int_lit_tag, a);
CONS_exp(a, extra, extra);
n--;
}
args = APPEND_list(args, extra);
COPY_list(exp_func_id_args(e), args);
}
}
return e;
}
/*
This routine constructs a default call of the constructor or destructor
id of type n. ct gives the corresponding class type and pb gives the
second argument for copy constructors and assignment operators.
*/
static EXP
call_constr(IDENTIFIER id, EXP *pb, int n, int v, CLASS_TYPE ct)
{
/* Create argument list */
TYPE t;
EXP e, a, b;
LIST(EXP)args = NULL_list(EXP);
IDENTIFIER cid = DEREF_id(ctype_name(ct));
MAKE_type_compound(cv_lvalue, ct, t);
COPY_id(type_name(t), cid);
MAKE_exp_dummy(t, NULL_exp, LINK_NONE, NULL_off, 0, a);
if (n == DEFAULT_ASSIGN || n == DEFAULT_DELETE) {
/* Don't know object type */
COPY_int(exp_dummy_virt(a), 1);
}
if (n == DEFAULT_COPY || n == DEFAULT_ASSIGN) {
/* These have two arguments */
TYPE s = t;
int virt = 1;
b = *pb;
if (!IS_NULL_exp(b)) {
s = DEREF_type(exp_type(b));
while (IS_type_array(s)) {
s = DEREF_type(type_array_sub(s));
}
s = lvalue_type(s);
if (know_type(b)) {
virt = 0;
}
}
MAKE_exp_dummy(s, b, LINK_NONE, NULL_off, DUMMY_copy, b);
COPY_int(exp_dummy_virt(b), virt);
CONS_exp(b, args, args);
*pb = b;
} else {
/* These have one argument */
b = a;
}
CONS_exp(a, args, args);
/* Call the function */
use_func_id(id, 0, suppress_usage);
e = apply_func_id(id, qual_none, NULL_graph, args);
e = add_constr_args(e, ct, v);
if (n == DEFAULT_DESTR || n == DEFAULT_DELETE) {
MAKE_exp_destr(type_void, e, a, e);
} else {
t = make_class_type(ct);
MAKE_exp_constr(t, e, a, b, n, e);
}
return e;
}
/*
This routine creates a default initialiser for an object of type t
in a constructor, destructor or assignment operator (as indicated
by n). Any resultant errors are added to err.
*/
EXP
init_default(TYPE t, EXP *pa, int n, int v, ERROR *err)
{
CV_SPEC cv;
EXP e = NULL_exp;
unsigned tag = TAG_type(t);
/* Deal with classes */
if (tag == type_compound_tag) {
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
IDENTIFIER id = find_constr(ct, n, err);
if (!IS_NULL_id(id)) {
DECL_SPEC ds = DEREF_dspec(id_storage(id));
if (!(ds & dspec_trivial)) {
/* Non-trivial constructor */
e = call_constr(id, pa, n, v, ct);
} else if (ds & dspec_implicit) {
if (!(ds & dspec_defn)) {
/* Trivial constructor */
implicit_defn(id, n);
}
}
}
return e;
}
/* Deal with arrays */
if (tag == type_array_tag) {
NAT m = DEREF_nat(type_array_size(t));
TYPE s = DEREF_type(type_array_sub(t));
e = init_default(s, pa, n, v, err);
if (!IS_NULL_exp(e)) {
/* Apply to each array element */
MAKE_exp_nof(t, NULL_exp, m, e, NULL_exp, e);
}
return e;
}
/* Everything else is alright in these cases */
if (n == DEFAULT_COPY || n == DEFAULT_DESTR || n == DEFAULT_DELETE) {
return NULL_exp;
}
/* Deal with references */
if (tag == type_ref_tag) {
add_error(err, ERR_dcl_init_ref_none());
if (n == DEFAULT_ASSIGN) {
return NULL_exp;
}
MAKE_exp_null(t, e);
return e;
}
/* Deal with const objects */
cv = DEREF_cv(type_qual(t));
if (cv & cv_const) {
add_error(err, ERR_dcl_init_const());
}
return NULL_exp;
}
/*
This routine reports the error err which occurred in the initialisation
of id in constructor or destructor fn of type n.
*/
static void
constr_error(ERROR err, IDENTIFIER id, IDENTIFIER fn, int n)
{
ERROR err1;
ERROR err2 = ERR_dcl_init_decl(id, NULL_string);
if (n == DEFAULT_USR) {
err1 = ERR_class_base_init_err(fn);
} else {
err1 = ERR_class_base_init_impl(fn);
}
err = concat_error(err2, err);
err = concat_error(err1, err);
report(crt_loc, err);
return;
}
/*
This routine creates a default initialiser for the base class gr
for the constructor or destructor fn of type n. For copy constructors
and assignment operators a dummy expression is used to indicate that
the base should be initialised from the corresponding base of the
second argument (see enc_ctor_exp).
*/
static EXP
init_empty_base(GRAPH gr, IDENTIFIER fn, int n, int m)
{
EXP e = NULL_exp;
ERROR err = NULL_err;
CLASS_TYPE ct = DEREF_ctype(graph_head(gr));
TYPE t = make_class_type(ct);
e = init_default(t, &e, m, EXTRA_NONE, &err);
if (IS_NULL_exp(e)) {
if (n == DEFAULT_USR && m != DEFAULT_DESTR) {
/* Warn about uninitialised bases */
if (!is_empty_class(t)) {
IDENTIFIER id = DEREF_id(ctype_name(ct));
err = concat_error(err, ERR_class_base_init_none(id));
}
}
if (m == DEFAULT_COPY || m == DEFAULT_ASSIGN) {
/* Dummy value for copy constructor */
MAKE_exp_value(t, e);
}
}
if (!IS_NULL_err(err)) {
IDENTIFIER id = DEREF_id(ctype_name(ct));
constr_error(err, id, fn, n);
}
return e;
}
/*
This routine creates a default initialiser for a class member id
for the constructor or destructor fn of type n. Again a dummy value
is used in copy constructors and assignment operators.
*/
static EXP
init_empty_mem(IDENTIFIER id, IDENTIFIER fn, int n, int m)
{
EXP e = NULL_exp;
ERROR err = NULL_err;
TYPE t = DEREF_type(id_member_type(id));
int v = (m == DEFAULT_DESTR ? EXTRA_DESTR : EXTRA_CONSTR);
e = init_default(t, &e, m, v, &err);
if (IS_NULL_exp(e)) {
if (m == DEFAULT_COPY || m == DEFAULT_ASSIGN) {
/* Dummy value for copy constructor */
if (IS_type_ptr(t)) {
DECL_SPEC ds = DEREF_dspec(id_storage(fn));
if (!(ds & dspec_trivial)) {
/* Warn about shallow copies */
err = concat_error(err, ERR_class_copy_ptr());
}
}
MAKE_exp_value(t, e);
}
}
if (!IS_NULL_err(err)) {
constr_error(err, id, fn, n);
}
return e;
}
/*
These lists are built up by the constructor initialisers.
*/
static LIST(GRAPH) init_bases = NULL_list(GRAPH);
static LIST(EXP) val_bases = NULL_list(EXP);
static LIST(IDENTIFIER) init_mems = NULL_list(IDENTIFIER);
static LIST(EXP) val_mems = NULL_list(EXP);
static unsigned long no_ctor_init = 0;
static int init_base_last = 1;
/*
This routine clears the lists of constructor initialisers above.
*/
static void
destroy_ctor_lists(void)
{
IGNORE check_value(OPT_VAL_ctor_initializers, no_ctor_init);
DESTROY_list(init_bases, SIZE_graph);
DESTROY_list(val_bases, SIZE_exp);
DESTROY_list(init_mems, SIZE_id);
DESTROY_list(val_mems, SIZE_exp);
init_bases = NULL_list(GRAPH);
val_bases = NULL_list(EXP);
init_mems = NULL_list(IDENTIFIER);
val_mems = NULL_list(EXP);
init_base_last = 1;
no_ctor_init = 0;
return;
}
/*
This routine finds the base class initialiser for gr in the lists
given above. If gr is a member of init_bases then the corresponding
element of val_bases is returned, otherwise the null expression is
returned.
*/
static EXP
find_base_init(GRAPH gr)
{
LIST(GRAPH)p = init_bases;
LIST(EXP)q = val_bases;
while (!IS_NULL_list(p)) {
GRAPH gs = DEREF_graph(HEAD_list(p));
if (eq_graph(gs, gr)) {
/* Found graph - return corresponding expression */
EXP e = DEREF_exp(HEAD_list(q));
return e;
}
q = TAIL_list(q);
p = TAIL_list(p);
}
return NULL_exp;
}
/*
This routine finds the class member initialiser for id in the lists
given above. If id is a member of init_mems then the corresponding
element of val_mems is returned, otherwise the null expression is
returned.
*/
static EXP
find_mem_init(IDENTIFIER id)
{
LIST(IDENTIFIER)p = init_mems;
LIST(EXP)q = val_mems;
while (!IS_NULL_list(p)) {
IDENTIFIER mid = DEREF_id(HEAD_list(p));
if (EQ_id(mid, id)) {
/* Found identifier - return corresponding expression */
EXP e = DEREF_exp(HEAD_list(q));
return e;
}
q = TAIL_list(q);
p = TAIL_list(p);
}
return NULL_exp;
}
/*
This routine marks the initialiser expression e for an object of type t
if t has a non-trivial destructor by enclosing it in parentheses.
*/
static EXP
destr_init(TYPE t, EXP e)
{
TYPE s = t;
while (IS_type_array(s)) {
s = DEREF_type(type_array_sub(s));
}
if (IS_type_compound(s)) {
CLASS_TYPE cs = DEREF_ctype(type_compound_defn(s));
IDENTIFIER id = DEREF_id(ctype_destr(cs));
if (IS_id_mem_func(id)) {
DECL_SPEC ds = DEREF_dspec(id_storage(id));
if (!(ds & dspec_trivial)) {
if (ds & dspec_implicit) {
if (!(ds & dspec_defn)) {
/* Trivial constructor */
implicit_defn(id, DEFAULT_DESTR);
}
}
MAKE_exp_paren(t, e, e);
}
}
}
return e;
}
/*
This routine creates a constructor or destructor initialiser list.
cns gives the corresponding class namespace and fn is the function
name. n and m indicate the constructor or destructor type. This can
be an implicitly declared constructor, destructor or assignment
function, or an explicitly declared constructor. In the latter
case the ctor-initialiser lists above are used to indicate the
initialiser values.
*/
static EXP
make_constr(NAMESPACE cns, IDENTIFIER fn, int n, int m)
{
EXP r;
int usr = 0;
int str = 1;
unsigned nv = 0;
unsigned nb = 0;
unsigned long no = 0;
int templ = in_template_decl;
LIST(EXP)p = NULL_list(EXP);
LIST(OFFSET)q = NULL_list(OFFSET);
/* Deconstruct class type */
CLASS_TYPE ct = namespace_class(cns);
CLASS_INFO ci = DEREF_cinfo(ctype_info(ct));
GRAPH gr = DEREF_graph(ctype_base(ct));
LIST(GRAPH)br = DEREF_list(graph_tails(gr));
LIST(GRAPH)bv = DEREF_list(ctype_vbase(ct));
MEMBER mem = DEREF_member(nspace_ctype_first(cns));
/* Mark 'this' parameter as used */
crt_access_list.inherit++;
IGNORE this_param(fn, 1);
/* Check for user-defined constructors */
if (n == DEFAULT_USR && m == DEFAULT_CONSTR) {
usr = 1;
}
/* Initialise virtual bases */
if (m != DEFAULT_ASSIGN) {
while (!IS_NULL_list(bv)) {
EXP e = NULL_exp;
GRAPH gs = DEREF_graph(HEAD_list(bv));
DECL_SPEC acc = DEREF_dspec(graph_access(gs));
if (usr) {
e = find_base_init(gs);
}
if (IS_NULL_exp(e) && !(acc & dspec_template)) {
e = init_empty_base(gs, fn, n, m);
if (templ) {
/* Only testing for template classes */
free_exp(e, 1);
e = NULL_exp;
}
}
if (m == DEFAULT_CONSTR && !templ) {
CLASS_TYPE cs = DEREF_ctype(graph_head(gs));
TYPE s = make_class_type(cs);
e = destr_init(s, e);
}
if (!IS_NULL_exp(e)) {
OFFSET off = DEREF_off(graph_off(gs));
CONS_off(off, q, q);
CONS_exp(e, p, p);
nv++;
}
bv = TAIL_list(bv);
}
}
/* Initialise direct bases */
while (!IS_NULL_list(br)) {
EXP e = NULL_exp;
GRAPH gs = DEREF_graph(HEAD_list(br));
DECL_SPEC acc = DEREF_dspec(graph_access(gs));
if (!(acc & dspec_virtual) || m == DEFAULT_ASSIGN) {
if (usr) {
e = find_base_init(gs);
}
if (IS_NULL_exp(e) && !(acc & dspec_template)) {
e = init_empty_base(gs, fn, n, m);
if (templ) {
/* Only testing for template classes */
free_exp(e, 1);
e = NULL_exp;
}
}
if (m == DEFAULT_CONSTR && !templ) {
CLASS_TYPE cs = DEREF_ctype(graph_head(gs));
TYPE s = make_class_type(cs);
e = destr_init(s, e);
}
if (!IS_NULL_exp(e)) {
OFFSET off = DEREF_off(graph_off(gs));
CONS_off(off, q, q);
CONS_exp(e, p, p);
nb++;
}
}
br = TAIL_list(br);
}
/* Initialise data members */
member_no = no;
mem = next_data_member(mem, 2);
if (usr && (ci & cinfo_union)) {
/* Check union initialisers */
unsigned ni = LENGTH_list(init_mems);
if (ni) {
if (ni > 1) {
/* More than one initialiser for union */
report(crt_loc, ERR_class_base_init_union(ct));
}
str = 0;
}
}
while (!IS_NULL_member(mem)) {
EXP e = NULL_exp;
IDENTIFIER id = DEREF_id(member_id(mem));
if (usr) {
e = find_mem_init(id);
if (!IS_NULL_exp(e)) {
if (no == member_no) {
/* More than one initialiser for
* anonymous union */
report(crt_loc,
ERR_class_base_init_anon(id));
}
no = member_no;
}
}
if (IS_NULL_exp(e) && str) {
e = init_empty_mem(id, fn, n, m);
if (templ) {
/* Only testing for template classes */
free_exp(e, 1);
e = NULL_exp;
}
}
if (m == DEFAULT_CONSTR && !templ) {
TYPE s = DEREF_type(id_member_type(id));
e = destr_init(s, e);
}
if (!IS_NULL_exp(e)) {
OFFSET off = DEREF_off(id_member_off(id));
e = check_init(e);
CONS_off(off, q, q);
CONS_exp(e, p, p);
}
if (ci & cinfo_union) {
if (!usr) {
break;
}
str = 0;
}
mem = DEREF_member(member_next(mem));
mem = next_data_member(mem, 2);
}
/* Construct the result */
crt_access_list.inherit--;
if (IS_NULL_list(p)) {
DECL_SPEC ds = DEREF_dspec(id_storage(fn));
if (ds & dspec_trivial) {
return NULL_exp;
}
if (m != DEFAULT_DESTR && !templ) {
if (ci & (cinfo_virtual_base | cinfo_polymorphic)) {
/* These require an initialiser */
/* EMPTY */
} else {
return NULL_exp;
}
}
}
if (m != DEFAULT_DESTR) {
/* Initialisers are built in reverse order */
p = REVERSE_list(p);
q = REVERSE_list(q);
}
MAKE_exp_initialiser(type_void, p, q, m, nv, nb, r);
return r;
}
/*
The destruction of the base classes and members of a class takes
place at the end of the destructor, and it is this which is handled
by make_constr. However for polymorphic classes some action is
also required at the start of the destructor, namely the resetting
of the virtual function tables. This routine creates a dummy
initialiser expression which performs this action.
*/
static EXP
make_destr_prelude(NAMESPACE cns)
{
EXP r = NULL_exp;
CLASS_TYPE ct = namespace_class(cns);
CLASS_INFO ci = DEREF_cinfo(ctype_info(ct));
if (ci & cinfo_polymorphic) {
/* Create dummy initialiser */
MAKE_exp_initialiser(type_void, NULL_list(EXP),
NULL_list(OFFSET), DEFAULT_PRELUDE, 0, 0,
r);
}
return r;
}
/*
This routine copies the constructor initialiser list of type m.
*/
EXP
copy_ctor(EXP e, int m)
{
IDENTIFIER fn = crt_func_id;
NAMESPACE cns = DEREF_nspace(id_parent(fn));
LIST(EXP)p = DEREF_list(exp_initialiser_args(e));
LIST(OFFSET)q = DEREF_list(exp_initialiser_offs(e));
if (!IS_NULL_list(p)) {
/* Copy initialisers */
while (!IS_NULL_list(p) && !IS_NULL_list(q)) {
int redo = 0;
IDENTIFIER id = NULL_id;
EXP a = DEREF_exp(HEAD_list(p));
OFFSET off = DEREF_off(HEAD_list(q));
EXP b = implicit_cast_exp(a);
if (!IS_NULL_exp(b) && !EQ_exp(b, a)) {
redo = 1;
a = b;
}
a = copy_exp(a, NULL_type, NULL_type);
if (redo && !IS_exp_initialiser(a)) {
/* Turn expression into ctor-initialiser list */
LIST(EXP)r = NULL_list(EXP);
LIST(OFFSET)s = NULL_list(OFFSET);
CONS_exp(a, r, r);
MAKE_exp_initialiser(type_void, r, s, 0, 0, 0,
a);
}
off = copy_offset(off, lex_plus);
switch (TAG_off(off)) {
case off_member_tag: {
/* Member initialiser */
id = DEREF_id(off_member_id(off));
break;
}
case off_base_tag: {
/* Direct base class initialiser */
GRAPH gr = DEREF_graph(off_base_graph(off));
CLASS_TYPE ct = DEREF_ctype(graph_head(gr));
id = DEREF_id(ctype_name(ct));
break;
}
case off_deriv_tag: {
/* Indirect base class initialiser */
GRAPH gr = DEREF_graph(off_deriv_graph(off));
CLASS_TYPE ct = DEREF_ctype(graph_head(gr));
id = DEREF_id(ctype_name(ct));
break;
}
}
if (!IS_NULL_id(id)) {
/* Add initialiser to list */
ctor_initialise(cns, id, a);
}
q = TAIL_list(q);
p = TAIL_list(p);
}
}
e = make_constr(cns, fn, DEFAULT_USR, m);
destroy_ctor_lists();
return e;
}
/*
This routine is called at the start of a ctor-initialiser list to
check that the current function is a constructor. If so it returns
the corresponding class namespace. Otherwise the null namespace
is returned.
*/
NAMESPACE
ctor_begin(void)
{
IDENTIFIER id = crt_func_id;
HASHID nm = DEREF_hashid(id_name(id));
if (IS_hashid_constr(nm)) {
TYPE t = DEREF_type(hashid_constr_type(nm));
if (IS_type_compound(t)) {
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
NAMESPACE cns = DEREF_nspace(ctype_member(ct));
return cns;
}
}
report(crt_loc, ERR_class_base_init_bad(id));
return NULL_nspace;
}
/*
This routine is called at the end of a ctor-initialiser list. cns
gives the class namespace, e is the compound statement to which
the initialisers are to be added and elem is true if the list was
not empty. The routine returns the resultant compound statement.
*/
EXP
ctor_end(NAMESPACE cns, EXP e, int elem)
{
if (!IS_NULL_nspace(cns)) {
/* Construct the constructor */
IDENTIFIER id = crt_func_id;
if (!elem) {
report(crt_loc, ERR_class_base_init_empty(id));
}
if (IS_id_mem_func(id)) {
EXP c = make_constr(cns, id, DEFAULT_USR,
DEFAULT_CONSTR);
if (!IS_NULL_exp(c)) {
e = add_compound_stmt(e, c);
}
}
destroy_ctor_lists();
}
return e;
}
/*
This routine is called for a function definition which contains no
ctor-initialiser. e gives the compound statement giving the function
body. The routine returns the value of e after any initialisers
required for constructors have been added. Any destructors which need
to be called at the end of the function are returned via p.
*/
EXP
ctor_none(EXP e, EXP *p)
{
IDENTIFIER id = crt_func_id;
if (IS_id_mem_func(id)) {
HASHID nm = DEREF_hashid(id_name(id));
switch (TAG_hashid(nm)) {
case hashid_constr_tag: {
/* Constructor declarations */
NAMESPACE cns = DEREF_nspace(id_parent(id));
EXP c = make_constr(cns, id, DEFAULT_USR,
DEFAULT_CONSTR);
if (!IS_NULL_exp(c)) {
/* Add initialiser to function body */
e = add_compound_stmt(e, c);
}
break;
}
case hashid_destr_tag: {
/* Destructor declarations */
NAMESPACE cns = DEREF_nspace(id_parent(id));
EXP c = make_destr_prelude(cns);
EXP d = make_constr(cns, id, DEFAULT_USR,
DEFAULT_DESTR);
if (!IS_NULL_exp(c)) {
/* Add destructor prelude to function body */
e = add_compound_stmt(e, c);
}
if (!IS_NULL_exp(d)) {
/* Set up destructor postlude */
IDENTIFIER lab = postlude_label();
EXP a = begin_label_stmt(lab, lex_return);
*p = end_label_stmt(a, d);
}
break;
}
}
}
return e;
}
/*
This routine adds the postlude expression d to the end of the
function body e. This is used in user declared destructors where the
default destructors need to be called after the main function body.
For convenience the code for falling out of a normal function body
is also handled by this routine.
*/
EXP
ctor_postlude(EXP e, EXP d)
{
if (!IS_NULL_exp(d)) {
/* Add postlude expression */
EXP r;
unreached_code = 0;
e = add_compound_stmt(e, d);
unreached_code = 0;
MAKE_exp_return_stmt(type_bottom, NULL_exp, r);
e = add_compound_stmt(e, r);
unreached_code = 1;
unreached_last = 0;
} else {
/* Fall out of function */
if (!unreached_code) {
EXP r = fall_return_stmt();
e = add_compound_stmt(e, r);
}
}
return e;
}
/*
This routine creates an expression which will be called in the exception
specifier for the function id. This is used in constructors to destroy
the partially complete object.
*/
EXP
except_postlude(IDENTIFIER id)
{
EXP e = NULL_exp;
HASHID nm = DEREF_hashid(id_name(id));
if (IS_hashid_constr(nm)) {
/* Have a constructor */
TYPE t = DEREF_type(hashid_constr_type(nm));
if (IS_type_compound(t)) {
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
NAMESPACE cns = DEREF_nspace(ctype_member(ct));
DECL_SPEC ds = DEREF_dspec(id_storage(id));
if (!(ds & (dspec_friend | dspec_trivial))) {
/* Constructor may throw an exception */
int ac = do_access_checks;
EXP a = DEREF_exp(id_function_etc_defn(id));
if (!IS_NULL_exp(a) && IS_exp_initialiser(a)) {
LIST(EXP)p;
p = DEREF_list(exp_initialiser_args(a));
if (LENGTH_list(p) == 1) {
/* Single initialiser in constructor */
a = DEREF_exp(HEAD_list(p));
if (!IS_NULL_exp(a)) {
TYPE s = DEREF_type(exp_type(a));
if (!IS_type_array(s)) {
return e;
}
}
}
}
do_access_checks = 0;
COPY_dspec(id_storage(id), (ds | dspec_trivial));
start_try_check(univ_type_set);
e = make_constr(cns, id, DEFAULT_DESTR, DEFAULT_DESTR);
if (!IS_NULL_exp(e)) {
/* Add destructor prelude */
EXP d = make_destr_prelude(cns);
e = join_exp(d, e);
}
e = end_try_check(id, e);
COPY_dspec(id_storage(id), ds);
do_access_checks = ac;
}
}
}
return e;
}
/*
This routine compares the order of initialisation of the base graphs
gr and gs. It returns 1 if gr is initialised before gs, -1 if gr is
initialised before gr and 0 if they are equal. Note that virtual
bases are initialised before direct bases.
*/
static int
compare_base(GRAPH gr, GRAPH gs)
{
DECL_SPEC ar, as;
LIST(GRAPH)br;
if (eq_graph(gr, gs)) {
return 0;
}
ar = DEREF_dspec(graph_access(gr));
as = DEREF_dspec(graph_access(gs));
if (ar & dspec_virtual) {
if (as & dspec_virtual) {
GRAPH gt = DEREF_graph(graph_top(gr));
CLASS_TYPE ct = DEREF_ctype(graph_head(gt));
br = DEREF_list(ctype_vbase(ct));
} else {
return 1;
}
} else {
if (as & dspec_virtual) {
return -1;
} else {
GRAPH gt = DEREF_graph(graph_top(gr));
br = DEREF_list(graph_tails(gt));
}
}
while (!IS_NULL_list(br)) {
GRAPH gt = DEREF_graph(HEAD_list(br));
if (eq_graph(gt, gr)) {
return 1;
}
if (eq_graph(gt, gs)) {
return -1;
}
br = TAIL_list(br);
}
return 0;
}
/*
This routine compares the order of initialisation of the members pid
and mid of the class namespace ns. It returns 1 if mid is initialised
before pid, -1 if pid is initialised before mid and 0 if they are equal.
*/
static int
compare_mem(NAMESPACE ns, IDENTIFIER mid, IDENTIFIER pid)
{
MEMBER mem;
if (EQ_id(mid, pid)) {
return 0;
}
mem = DEREF_member(nspace_ctype_first(ns));
while (!IS_NULL_member(mem)) {
IDENTIFIER id = DEREF_id(member_id(mem));
if (EQ_id(id, mid)) {
return 1;
}
if (EQ_id(id, pid)) {
return -1;
}
mem = DEREF_member(member_next(mem));
}
return 0;
}
/*
This routine looks up the name id as a ctor-initialiser for the class
cns. If it denotes a base class then the corresponding graph is
returned via pgr. If id is the null identifier then this is an
anachronistic way of initialising the unique direct base class of
cns, if this exists. The null identifier is returned for illegal
initialisers.
*/
static IDENTIFIER
ctor_field(NAMESPACE cns, IDENTIFIER id, GRAPH *pgr)
{
if (!IS_NULL_nspace(cns)) {
if (IS_NULL_id(id)) {
/* Search for unique base class */
ERROR err = ERR_class_base_init_old(crt_func_id);
CLASS_TYPE ct = namespace_class(cns);
GRAPH gr = uniq_base_class(ct, &err);
if (!IS_NULL_graph(gr)) {
ct = DEREF_ctype(graph_head(gr));
id = DEREF_id(ctype_name(ct));
*pgr = gr;
} else {
id = NULL_id;
}
report(crt_loc, err);
} else {
/* Look up name as class member */
GRAPH gr;
int check_base = 1;
IDENTIFIER fid = id;
NAMESPACE fns = DEREF_nspace(id_parent(fid));
if (EQ_nspace(fns, crt_namespace)) {
/* Rescan constructor parameters in enclosing
* scope */
HASHID nm = DEREF_hashid(id_name(fid));
int c = cache_lookup;
cache_lookup = 0;
remove_namespace();
fid = find_id(nm);
add_namespace(fns);
cache_lookup = c;
id = fid;
}
/* Check for class members */
gr = is_subfield(cns, fid);
if (!IS_NULL_graph(gr)) {
check_base = 0;
fid = search_subfield(cns, gr, fid);
switch (TAG_id(fid)) {
case id_member_tag: {
/* Non-static data members */
DECL_SPEC ds =
DEREF_dspec(id_storage(fid));
if (ds & dspec_inherit) {
/* Can't denote an inherited
* member */
ERROR err;
err = ERR_class_base_init_inherit(fid);
report(crt_loc, err);
id = NULL_id;
} else {
id = fid;
}
break;
}
case id_class_name_tag:
case id_class_alias_tag: {
/* Check for base classes */
check_base = 1;
break;
}
case id_undef_tag: {
/* Undeclared members */
HASHID nm = DEREF_hashid(id_name(fid));
ERROR err =
ERR_lookup_qual_undef(nm, fns);
report(crt_loc, err);
id = NULL_id;
break;
}
case id_ambig_tag: {
/* Ambiguous members */
id = report_ambiguous(fid, 0, 1, 1);
break;
}
default : {
/* Other members */
ERROR err =
ERR_class_base_init_static(fid);
report(crt_loc, err);
id = NULL_id;
break;
}
}
}
/* Check for base classes */
if (check_base) {
CLASS_TYPE cs = find_class(fid);
if (IS_NULL_ctype(cs) && IS_id_undef(fid)) {
TYPE s = check_typename(fns, fid,
btype_class);
if (!IS_NULL_type(s) &&
IS_type_compound(s)) {
cs = DEREF_ctype(type_compound_defn(s));
}
}
if (!IS_NULL_ctype(cs)) {
/* Class name found */
ERROR err = NULL_err;
CLASS_TYPE ct = namespace_class(cns);
gr = direct_base_class(ct, cs, &err);
if (!IS_NULL_err(err)) {
/* Report invalid bases */
report(crt_loc, err);
}
if (!IS_NULL_graph(gr)) {
id = DEREF_id(ctype_name(cs));
*pgr = gr;
} else {
id = NULL_id;
}
} else {
/* Invalid ctor-initialiser */
ERROR err = ERR_lookup_qual_bad(id, cns);
report(crt_loc, err);
id = NULL_id;
}
}
}
} else {
/* Invalid class namespace */
id = NULL_id;
}
return id;
}
/*
This routine processes a ctor-initialiser which sets the id component
of the current constructor function to the initialiser expression init.
cns gives the value returned by ctor_check. id may be the null
identifier indicating the anachronistic single inheritance base class
initialisation.
*/
void
ctor_initialise(NAMESPACE cns, IDENTIFIER id, EXP init)
{
TYPE t;
int n = 0;
int ok = 1;
GRAPH gr = NULL_graph;
/* Check member identifier */
IDENTIFIER mid = ctor_field(cns, id, &gr);
if (!IS_NULL_id(mid)) {
EXP e;
if (IS_id_member(mid)) {
/* Member initialiser */
e = find_mem_init(mid);
t = DEREF_type(id_member_type(mid));
n = 1;
} else {
/* Base class initialiser */
e = find_base_init(gr);
t = DEREF_type(id_class_name_etc_defn(mid));
if (in_template_decl) {
/* Allow for template parameters */
DECL_SPEC acc = DEREF_dspec(graph_access(gr));
if (acc & dspec_template) {
CLASS_TYPE ct =
DEREF_ctype(graph_head(gr));
t = DEREF_type(ctype_form(ct));
}
}
n = 2;
}
if (!IS_NULL_exp(e)) {
/* Initialiser already given */
report(crt_loc, ERR_class_base_init_dup(mid));
}
} else {
/* Invalid initialiser */
HASHID nm = KEYWORD(lex_zzzz);
mid = DEREF_id(hashid_id(nm));
t = type_error;
}
/* Check for order of initialisers */
if (init_base_last) {
/* Previous initialiser was a base */
if (n == 2) {
if (!IS_NULL_list(init_bases)) {
GRAPH gp = DEREF_graph(HEAD_list(init_bases));
int cmp = compare_base(gr, gp);
if (cmp > 0) {
ok = 0;
}
}
}
} else {
/* Previous initialiser was a member */
if (n == 1) {
if (!IS_NULL_list(init_mems)) {
IDENTIFIER pid = DEREF_id(HEAD_list(init_mems));
int cmp = compare_mem(cns, mid, pid);
if (cmp > 0) {
ok = 0;
}
}
} else if (n == 2) {
ok = 0;
}
}
if (!ok) {
/* Initialisers out of sequence */
report(crt_loc, ERR_class_base_init_order(mid));
}
/* Perform initialisation */
if (IS_exp_initialiser(init)) {
crt_access_list.inherit++;
decl_loc = crt_loc;
if (n == 2) {
in_ctor_base_init = 1;
}
init = init_general(t, init, mid, 0);
in_ctor_base_init = 0;
crt_access_list.inherit--;
}
if (n == 1) {
CONS_id(mid, init_mems, init_mems);
CONS_exp(init, val_mems, val_mems);
init_base_last = 0;
} else if (n == 2) {
CONS_graph(gr, init_bases, init_bases);
CONS_exp(init, val_bases, val_bases);
init_base_last = 1;
}
no_ctor_init++;
return;
}
/*
This routine creates a pseudo-destructor with class name given by
id1 and b1 and destructor name given by id2 and b2.
*/
IDENTIFIER
make_pseudo_destr(IDENTIFIER id1, BASE_TYPE b1, IDENTIFIER id2, BASE_TYPE b2)
{
HASHID nm;
int create = 0;
int rescan = 0;
TYPE t1 = NULL_type;
TYPE t2 = NULL_type;
NAMESPACE ns = NULL_nspace;
/* Check class name */
if (b1 == btype_none) {
if (!IS_NULL_id(id1)) {
ns = find_namespace(id1);
if (IS_id_class_name_etc(id1)) {
t1 = DEREF_type(id_class_name_etc_defn(id1));
t1 = copy_typedef(id1, t1, cv_none);
COPY_id(type_name(t1), id1);
if (IS_NULL_nspace(ns)) {
ns = DEREF_nspace(id_parent(id1));
} else {
/* Have class name */
rescan = 1;
}
use_id(id1, 0);
} else {
if (!IS_NULL_nspace(ns) && !IS_NULL_id(id2)) {
/* Namespace qualifier allowed */
create = 1;
} else {
report(crt_loc, ERR_dcl_type_simple_undef(id1));
}
}
}
} else {
t1 = make_base_type(b1);
}
/* Check destructor name */
if (b2 == btype_none) {
if (!EQ_id(id2, id1)) {
nm = DEREF_hashid(id_name(id2));
if (!IS_NULL_nspace(ns)) {
/* Rescan id2 in the context of id1 */
IDENTIFIER id3 =
find_qual_id(ns, nm, create, 1);
if (!IS_NULL_id(id3)) {
id2 = id3;
}
}
if (IS_id_class_name_etc(id2)) {
t2 = DEREF_type(id_class_name_etc_defn(id2));
t2 = copy_typedef(id2, t2, cv_none);
COPY_id(type_name(t2), id2);
use_id(id2, 0);
} else {
report(crt_loc, ERR_dcl_type_simple_undef(id2));
}
}
} else {
if (b2 != b1) {
t2 = make_base_type(b2);
}
}
/* Form pseudo-destructor name */
if (IS_NULL_type(t2)) {
t2 = t1;
if (IS_NULL_type(t2)) {
t2 = type_error;
}
} else {
if (rescan) {
/* Error will be caught in search_field */
/* EMPTY */
} else {
if (!IS_NULL_type(t1) && !eq_type(t1, t2)) {
/* If both specified, types should match */
report(crt_loc, ERR_expr_pseudo_type(t1, t2));
}
}
}
nm = lookup_destr(t2, id2);
id2 = DEREF_id(hashid_id(nm));
return id2;
}
/*
This value gives the declaration specifiers used for implicitly declared
constructors and destructors.
*/
#define dspec_constr (dspec_implicit | dspec_ignore | dspec_inline)
/*
This routine adds the list of exceptions thrown by the implicit
constructor or destructor (given by n) of the class ct to the list p.
*/
static LIST(TYPE)
add_constr_except(LIST(TYPE)p, CLASS_TYPE ct, int n)
{
IDENTIFIER id = find_constr(ct, n, KILL_err);
if (!IS_NULL_id(id) && IS_id_mem_func(id)) {
TYPE fn = DEREF_type(id_mem_func_type(id));
if (IS_type_func(fn)) {
LIST(TYPE)q = DEREF_list(type_func_except(fn));
p = union_type_set(p, q);
}
}
return p;
}
/*
This routine finds the list of exceptions thrown by the implicit
constructor or destructor (given by n) of the class ct.
*/
static LIST(TYPE)
constr_except(CLASS_TYPE ct, int n)
{
LIST(TYPE)res = NULL_list(TYPE);
GRAPH gr = DEREF_graph(ctype_base(ct));
LIST(GRAPH)br = DEREF_list(graph_tails(gr));
NAMESPACE cns = DEREF_nspace(ctype_member(ct));
MEMBER mem = DEREF_member(nspace_ctype_first(cns));
/* Scan through virtual bases */
if (n != DEFAULT_ASSIGN) {
LIST(GRAPH)bv = DEREF_list(ctype_vbase(ct));
while (!IS_NULL_list(bv)) {
GRAPH gs = DEREF_graph(HEAD_list(bv));
CLASS_TYPE cs = DEREF_ctype(graph_head(gs));
res = add_constr_except(res, cs, n);
if (EQ_list(res, univ_type_set)) {
return res;
}
bv = TAIL_list(bv);
}
}
/* Scan through direct bases */
while (!IS_NULL_list(br)) {
GRAPH gs = DEREF_graph(HEAD_list(br));
DECL_SPEC acc = DEREF_dspec(graph_access(gs));
if (!(acc & dspec_virtual) || n == DEFAULT_ASSIGN) {
CLASS_TYPE cs = DEREF_ctype(graph_head(gs));
res = add_constr_except(res, cs, n);
if (EQ_list(res, univ_type_set)) {
return res;
}
}
br = TAIL_list(br);
}
/* Scan through data members */
mem = next_data_member(mem, 2);
while (!IS_NULL_member(mem)) {
IDENTIFIER id = DEREF_id(member_id(mem));
TYPE s = DEREF_type(id_member_type(id));
while (IS_type_array(s)) {
s = DEREF_type(type_array_sub(s));
}
if (IS_type_compound(s)) {
CLASS_TYPE cs = DEREF_ctype(type_compound_defn(s));
res = add_constr_except(res, cs, n);
if (EQ_list(res, univ_type_set)) {
return res;
}
}
mem = DEREF_member(member_next(mem));
mem = next_data_member(mem, 2);
}
return res;
}
/*
This routine is called at the end of a class definition to implicitly
declare any necessary default constructors, copy constructors, assignment
operators or destructors. Note that these are only actually defined
if they are used, and errors are only detected at this definition stage.
The routine returns information on the class being defined.
*/
CLASS_INFO
implicit_decl(CLASS_TYPE ct, CLASS_INFO ci, DECL_SPEC cds)
{
TYPE t;
HASHID nm;
IDENTIFIER id;
TYPE pars[2];
CLASS_INFO cj;
LIST(TYPE)ex;
IDENTIFIER cid = DEREF_id(ctype_name(ct));
NAMESPACE ns = DEREF_nspace(ctype_member(ct));
LIST(IDENTIFIER)pals = DEREF_list(ctype_pals(ct));
/* Options being checked */
int need_copy_constr = 1;
int need_default_constr = 1;
int need_assignment_op = 1;
int need_destructor = 1;
int noncopy_constr = 0;
int access_constr = 0;
int access_destr = 0;
int three_rule = 0;
/* Find accumulated information */
cj = (ci & cinfo_implicit);
if (ci & (cinfo_virtual_base | cinfo_polymorphic)) {
cj &= ~cinfo_trivial_make;
}
ci &= ~cinfo_implicit;
/* Check constructors */
id = DEREF_id(ctype_constr(ct));
if (IS_id_mem_func(id)) {
IDENTIFIER fid = id;
while (!IS_NULL_id(fid)) {
TYPE fn = DEREF_type(id_mem_func_type(fid));
int c = check_copy_constr(fn, ct);
if (c) {
/* Copy constructor */
if (c == 2) {
ci |= cinfo_const_copy;
}
need_copy_constr = 0;
three_rule++;
} else {
/* Check access for other constructors */
DECL_SPEC acc = DEREF_dspec(id_storage(fid));
if ((acc & dspec_access)!= dspec_private) {
access_constr = 1;
}
noncopy_constr = 1;
}
fid = DEREF_id(id_mem_func_over(fid));
}
ci |= cinfo_usr_constr;
need_default_constr = 0;
} else {
/* Delete non-function meanings */
nm = DEREF_hashid(id_name(id));
clear_member(ns, nm);
}
/* Implicit declaration of default constructor */
if (need_default_constr) {
DECL_SPEC ds = (dspec_constr | cds);
if (cj & cinfo_trivial_constr) {
ci |= cinfo_trivial_constr;
ds |= dspec_trivial;
}
pars[0] = NULL_type;
ex = constr_except(ct, DEFAULT_CONSTR);
IGNORE declare_func(ds, id, NULL_type, pars, FUNC_NONE, ex);
noncopy_constr = 1;
access_constr = 1;
}
/* Implicit declaration of copy constructor */
if (need_copy_constr) {
CV_SPEC cv = cv_lvalue;
DECL_SPEC ds = (dspec_constr | cds);
if (cj & cinfo_trivial_copy) {
ci |= cinfo_trivial_copy;
ds |= dspec_trivial;
}
if (cj & cinfo_const_copy) {
ci |= cinfo_const_copy;
cv |= cv_const;
}
MAKE_type_compound(cv, ct, t);
COPY_id(type_name(t), cid);
MAKE_type_ref(cv_none, t, t);
pars[0] = t;
pars[1] = NULL_type;
ex = constr_except(ct, DEFAULT_COPY);
IGNORE declare_func(ds, id, NULL_type, pars, FUNC_NONE, ex);
}
/* Check assignment operators (ignore inheritance) */
nm = lookup_op(lex_assign);
id = search_id(ns, nm, 0, 0);
if (!IS_NULL_id(id)) {
if (IS_id_mem_func(id)) {
IDENTIFIER fid = id;
while (!IS_NULL_id(fid)) {
TYPE fn = DEREF_type(id_mem_func_type(fid));
int c = check_copy_constr(fn, ct);
if (c) {
if (c == 2 || c == 3) {
ci |= cinfo_const_assign;
}
need_assignment_op = 0;
three_rule++;
}
fid = DEREF_id(id_mem_func_over(fid));
}
} else {
/* Delete non-function meanings */
clear_member(ns, nm);
}
} else {
/* Create a dummy identifier */
id = DEREF_id(hashid_id(nm));
}
/* Implicit declaration of copy assignment operator */
if (need_assignment_op) {
CV_SPEC cv = cv_lvalue;
DECL_SPEC ds = (dspec_constr | cds);
if (cj & cinfo_trivial_assign) {
ci |= cinfo_trivial_assign;
ds |= dspec_trivial;
}
if (cj & cinfo_const_assign) {
ci |= cinfo_const_assign;
cv |= cv_const;
}
MAKE_type_compound(cv, ct, t);
COPY_id(type_name(t), cid);
MAKE_type_ref(cv_none, t, t);
pars[0] = t;
pars[1] = NULL_type;
MAKE_type_compound(cv_lvalue, ct, t);
COPY_id(type_name(t), cid);
MAKE_type_ref(cv_none, t, t);
ex = constr_except(ct, DEFAULT_ASSIGN);
IGNORE declare_func(ds, id, t, pars, FUNC_NONE, ex);
}
/* Check destructors */
id = DEREF_id(ctype_destr(ct));
if (IS_id_mem_func(id)) {
DECL_SPEC acc = DEREF_dspec(id_storage(id));
if ((acc & dspec_access)!= dspec_private) {
access_destr = 1;
}
need_destructor = 0;
three_rule++;
} else {
/* Delete non-function meanings */
nm = DEREF_hashid(id_name(id));
clear_member(ns, nm);
}
/* Implicit declaration of default destructor */
if (need_destructor) {
/* Check for trivial destructors */
DECL_SPEC ds = (dspec_constr | cds);
if (cj & cinfo_trivial_destr) {
ci |= cinfo_trivial_destr;
ds |= dspec_trivial;
}
pars[0] = NULL_type;
ex = constr_except(ct, DEFAULT_DESTR);
IGNORE declare_func(ds, id, NULL_type, pars, FUNC_NONE, ex);
access_destr = 1;
}
/* Report inaccessible constructors or destructors */
if (three_rule != 0 && three_rule != 3) {
report(crt_loc, ERR_class_dtor_three(ct));
}
if (!noncopy_constr) {
report(crt_loc, ERR_class_ctor_make(ct));
access_constr = 1;
}
if (IS_NULL_list(pals)) {
if (!access_constr) {
report(crt_loc, ERR_class_ctor_private(ct));
}
if (!access_destr) {
report(crt_loc, ERR_class_dtor_private(ct));
}
}
return ci;
}
/*
This routine finds the kind of constructor for the function id of
type t.
*/
int
constr_kind(IDENTIFIER id, TYPE t)
{
int n = DEFAULT_USR;
HASHID nm = DEREF_hashid(id_name(id));
switch (TAG_hashid(nm)) {
case hashid_constr_tag: {
if (min_no_args(t) == 1) {
n = DEFAULT_CONSTR;
} else {
n = DEFAULT_COPY;
}
break;
}
case hashid_destr_tag: {
/* Implicit default destructor */
n = DEFAULT_DESTR;
break;
}
case hashid_op_tag: {
/* Implicit assignment operator */
n = DEFAULT_ASSIGN;
break;
}
}
return n;
}
/*
This routine defines the function id, which will be one of the
implicitly declared constructors or destructors declared in
implicit_decl. n gives the constructor type or DEFAULT_USR if this
is not known.
*/
void
implicit_defn(IDENTIFIER id, int n)
{
TYPE t;
EXP c, e, r;
DECL_SPEC ds;
IDENTIFIER fn;
NAMESPACE cns;
int in_func, in_decl;
/* Check for previous definition */
if (!IS_id_mem_func(id)) {
return;
}
ds = DEREF_dspec(id_storage(id));
if (ds & dspec_inherit) {
/* Inherited functions */
id = DEREF_id(id_alias(id));
ds = DEREF_dspec(id_storage(id));
}
if (!(ds & dspec_implicit)) {
return;
}
if (ds & dspec_defn) {
return;
}
ds |= dspec_defn;
COPY_dspec(id_storage(id), ds);
/* Find constructor type */
t = DEREF_type(id_mem_func_type(id));
if (!IS_type_func(t)) {
return;
}
if (n == DEFAULT_USR) {
n = constr_kind(id, t);
}
/* Force immediate access checks */
in_func = in_function_defn;
in_decl = in_declaration;
fn = crt_func_id;
in_function_defn = 1;
in_declaration = 0;
crt_func_id = id;
/* Make initialiser list */
start_try_check(univ_type_set);
cns = DEREF_nspace(type_func_pars(t));
push_namespace(cns);
r = make_this_decl(id);
/* create a compound block so that declarations for default
* arguments of inherited constructors will be added */
c = begin_compound_stmt(1);
cns = DEREF_nspace(id_parent(id));
e = make_constr(cns, id, n, n);
if (n == DEFAULT_DESTR) {
/* Allow for destructor prelude */
if (!(ds & dspec_trivial)) {
EXP d = make_destr_prelude(cns);
e = join_exp(d, e);
}
} else if (n == DEFAULT_ASSIGN) {
/* Allow for return value */
r = make_indir_exp(r);
MAKE_exp_return_stmt(type_bottom, r, r);
e = join_exp(e, r);
}
c = add_compound_stmt(c, e);
e = end_compound_stmt(c);
IGNORE pop_namespace();
e = end_try_check(id, e);
COPY_exp(id_mem_func_defn(id), e);
define_id(id);
/* Compile the function definition */
if (!(ds & dspec_trivial)) {
if (do_dump) {
dump_implicit = 1;
dump_declare(id, &crt_loc, 1);
}
compile_function(id, 0);
}
/* Restore old values */
in_function_defn = in_func;
in_declaration = in_decl;
crt_func_id = fn;
return;
}
/*
These flags are used to indicate that an explicit constructor or
conversion function has been declared.
*/
int have_conv_expl = 0;
int have_constr_expl = 0;
/*
This routine removes all explicit constructors from the candidate list
p beginning with the mth element.
*/
static void
remove_explicit(CANDIDATE_LIST *p, unsigned m)
{
unsigned i, n = p->size;
CANDIDATE *q = p->elem + m;
for (i = m; i < n; i++) {
DECL_SPEC ds = DEREF_dspec(id_storage(q->base));
if (ds & dspec_explicit) {
q->rank = RANK_IGNORE;
}
q++;
}
return;
}
/*
This routine constructs the candidate list consisting of the constructors
for the class type t (including the explicit constructors only if cast
indicates an explicit conversion). The candidates are added to the
list p. The routine returns the first constructor for t.
*/
static IDENTIFIER
constr_candidates(CANDIDATE_LIST *p, TYPE t, unsigned cast)
{
/* Search for constructor candidates */
IDENTIFIER cid;
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
complete_class(ct, 1);
cid = DEREF_id(ctype_constr(ct));
if (IS_id_mem_func(cid)) {
unsigned i = p->size;
add_candidates(p, cid, 1, KIND_CONSTR);
swap_candidates(p, i);
if (cast == CAST_IMPLICIT && have_constr_expl) {
remove_explicit(p, i);
}
} else {
/* Can happen for incomplete types and in C */
cid = NULL_id;
}
return cid;
}
/*
This routine constructs the candidate list for the conversion functions
for the type s which can be implicitly converted to type t, plus the
constructors of t if t is a class type. The candidates are added to
the end of p. The routine returns the first constructor for t if t is
a class type, and the null identifier otherwise.
*/
IDENTIFIER
conv_candidates(CANDIDATE_LIST *p, TYPE t, TYPE s, unsigned cast)
{
/* Add constructors */
IDENTIFIER cid = NULL_id;
if (IS_type_compound(t)) {
cid = constr_candidates(p, t, cast);
}
/* Add conversion functions */
if (IS_type_compound(s)) {
LIST(IDENTIFIER)conv;
CLASS_TYPE cs = DEREF_ctype(type_compound_defn(s));
complete_class(cs, 1);
conv = DEREF_list(ctype_conv(cs));
while (!IS_NULL_list(conv)) {
IDENTIFIER id = DEREF_id(HEAD_list(conv));
TYPE fn = DEREF_type(id_function_etc_type(id));
if (IS_type_templ(fn)) {
/* Allow for template functions */
fn = deduce_conv(fn, t);
if (!IS_NULL_type(fn)) {
int eq = 0;
id = deduce_func(id, fn, &eq);
} else {
id = NULL_id;
}
}
if (!IS_NULL_id(id)) {
unsigned r;
CONVERSION c;
HASHID nm = DEREF_hashid(id_name(id));
c.from = DEREF_type(hashid_conv_type(nm));
c.to = t;
r = std_convert_seq(&c, NULL_exp, 0, 0);
if (r != CONV_NONE) {
unsigned i = p->size;
add_candidates(p, id, 1, KIND_CONV);
if (cast == CAST_IMPLICIT &&
have_conv_expl) {
remove_explicit(p, i);
}
}
}
conv = TAIL_list(conv);
}
}
return cid;
}
/*
This routine adds all the conversion functions from the type t to
types matching the type category mask kind to the candidate list p.
Note that template conversion functions are excluded - they cannot
give a non-ambiguous resolution and are beaten by any non-template
conversion function.
*/
static void
gen_candidates(CANDIDATE_LIST *p, TYPE t, unsigned kind)
{
if (IS_type_compound(t)) {
LIST(IDENTIFIER)conv;
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
complete_class(ct, 1);
conv = DEREF_list(ctype_conv(ct));
while (!IS_NULL_list(conv)) {
IDENTIFIER id = DEREF_id(HEAD_list(conv));
TYPE fn = DEREF_type(id_function_etc_type(id));
if (IS_type_func(fn)) {
TYPE r = DEREF_type(type_func_ret(fn));
unsigned c = type_category(&r);
if (c & kind) {
unsigned i = p->size;
add_candidates(p, id, 1, KIND_CONV);
if (have_conv_expl) {
remove_explicit(p, i);
}
}
}
conv = TAIL_list(conv);
}
}
return;
}
/*
This routine applies a trivial destructor to the expression a. It
is used in explicit destructor and pseudo-destructor calls.
*/
EXP
trivial_destr(EXP a)
{
EXP e = make_discard_exp(a);
MAKE_exp_cast(type_void, CONV_ELLIPSIS, e, e);
return e;
}
/*
This routine applies the trivial constructor or destructor id to
the arguments args. The null expression is returned for invalid
arguments.
*/
EXP
apply_trivial_func(IDENTIFIER id, LIST(EXP)args)
{
EXP e = NULL_exp;
TYPE t = DEREF_type(id_function_etc_type(id));
int n = constr_kind(id, t);
switch (n) {
case DEFAULT_CONSTR: {
if (LENGTH_list(args) == 1) {
/* Trivial constructor */
CLASS_TYPE ct = parent_class(id);
t = make_class_type(ct);
e = make_null_exp(t);
}
break;
}
case DEFAULT_COPY: {
if (LENGTH_list(args) == 2) {
/* Trivial copy constructor */
ERROR err = NULL_err;
LIST(TYPE)p = DEREF_list(type_func_mtypes(t));
TYPE ta = DEREF_type(HEAD_list(p));
ta = DEREF_type(type_ref_sub(ta));
e = DEREF_exp(HEAD_list(TAIL_list(args)));
e = convert_reference(e, REF_NORMAL);
e = convert_class(ta, e, &err);
if (!IS_NULL_err(err)) {
err = concat_warning(err, ERR_expr_ass_conv());
report(crt_loc, err);
}
}
break;
}
case DEFAULT_DESTR: {
if (LENGTH_list(args) == 1) {
/* Trivial destructor */
EXP a = DEREF_exp(HEAD_list(args));
e = trivial_destr(a);
}
break;
}
case DEFAULT_ASSIGN: {
if (LENGTH_list(args) == 2) {
/* Trivial assignment */
EXP a = DEREF_exp(HEAD_list(args));
EXP b = DEREF_exp(HEAD_list(TAIL_list(args)));
e = make_assign_exp(a, b, 1);
}
break;
}
}
return e;
}
/*
This routine applies the constructor id to the arguments args, using a
dummy expression for the object the constructor is applied to. The
definition of this object, whether an existing object or a temporary,
is filled in later.
*/
EXP
apply_constr(IDENTIFIER id, LIST(EXP)args)
{
TYPE t;
EXP e, a;
DECL_SPEC ds;
CLASS_TYPE ct;
IDENTIFIER cid;
CONS_exp(NULL_exp, args, args);
/* Check for trivial constructors */
ds = DEREF_dspec(id_storage(id));
if (ds & dspec_trivial) {
e = apply_trivial_func(id, args);
if (!IS_NULL_exp(e)) {
DESTROY_list(args, SIZE_exp);
return e;
}
}
/* Create dummy argument */
ct = parent_class(id);
cid = DEREF_id(ctype_name(ct));
MAKE_type_compound(cv_lvalue, ct, t);
COPY_id(type_name(t), cid);
MAKE_exp_dummy(t, NULL_exp, LINK_NONE, NULL_off, 0, a);
COPY_exp(HEAD_list(args), a);
/* Apply the constructor */
e = apply_func_id(id, qual_none, NULL_graph, args);
if (IS_exp_func_id(e)) {
int n = DEFAULT_USR;
TYPE fn = DEREF_type(id_function_etc_type(id));
if (check_copy_constr(fn, ct)) {
/* Mark copy constructor calls */
n = DEFAULT_COPY;
}
e = add_constr_args(e, ct, EXTRA_CONSTR);
t = make_class_type(ct);
MAKE_exp_constr(t, e, a, a, n, e);
}
return e;
}
/*
This routine converts the argument list args to the class type t by
constructor. The cast parameter indicates if this is an explicit
conversion. The routine is used, for example, in initialisations of
the form 't id ( args )'.
*/
EXP
convert_constr(TYPE t, LIST(EXP)args, ERROR *err, unsigned cast)
{
EXP e;
IDENTIFIER cid;
CANDIDATE_LIST *p;
/* Check for template parameters */
if (dependent_conv(t, args)) {
MAKE_exp_opn(t, lex_static_Hcast, args, e);
return e;
}
/* Construct list of candidates */
p = &candidates;
p->size = 0;
cid = constr_candidates(p, t, cast);
/* Perform overload resolution */
if (p->size) {
CANDIDATE *q = resolve_overload(p, args, NULL_type, 0);
IDENTIFIER qid = q->func;
unsigned rank = q->rank;
int kind = q->kind;
if (rank == RANK_BEST) {
/* Unambiguous resolution */
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
if (match_no_viable > 1 && overload_warn) {
add_error(err, ERR_over_match_ctor_ok(qid));
}
} else if (rank == RANK_VIABLE) {
/* Ambiguous resolution */
q = resolve_ambiguous(p, args, NULL_type, 0);
qid = q->func;
rank = q->rank;
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
if (rank == RANK_TARGET) {
ERROR err2 = ERR_over_match_ctor_target(qid);
qid = make_ambig_func(p, qid, args, qual_none,
&err2);
kind = KIND_FUNC;
add_error(err, err2);
} else if (rank == RANK_VIABLE) {
ERROR err2 = ERR_over_match_ctor_ambig(qid);
err2 = list_candidates(err2, p, RANK_VIABLE);
add_error(err, err2);
}
} else {
/* No resolution */
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
goto error_lab;
}
use_func_id(qid, 0, suppress_usage);
if (kind == KIND_CONSTR) {
e = apply_constr(qid, args);
} else {
/* Can only happen for target dependent resolutions */
e = apply_func_id(qid, qual_none, NULL_graph, args);
if (IS_exp_constr(e)) {
/* Introduce temporary variable if necessary */
TYPE s = DEREF_type(exp_type(e));
e = make_temporary(s, e, NULL_exp, 0, err);
e = convert_lvalue(e);
}
}
return e;
}
/* Deal with incomplete structures */
if (IS_NULL_id(cid)) {
ERROR err2 = check_incomplete(t);
if (!IS_NULL_err(err2)) {
add_error(err, err2);
add_error(err, ERR_expr_type_conv_incompl());
e = make_null_exp(t);
return e;
}
#if LANGUAGE_C
if (IS_NULL_list(args)) {
/* C default initialisation */
e = make_null_exp(t);
return e;
}
if (IS_NULL_list(TAIL_list(args))) {
/* C copy initialisation */
EXP a = DEREF_exp(HEAD_list(args));
a = convert_none(a);
a = convert_class(t, a, err);
a = remove_temporary(a, NULL_exp);
return a;
}
#endif
}
/* No candidates */
error_lab: {
CLASS_TYPE ct = DEREF_ctype(type_compound_defn(t));
cid = DEREF_id(ctype_constr(ct));
add_error(err, ERR_over_match_ctor_none(cid));
e = make_null_exp(t);
}
return e;
}
/*
This routine checks for user-defined conversions of a to type t.
It is identical to convert_conv except that it returns the null
expression is there are no viable conversion functions.
*/
EXP
convert_conv_aux(TYPE t, EXP a, ERROR *err, unsigned cast)
{
IDENTIFIER cid;
CANDIDATE_LIST *p;
LIST(EXP)args;
TYPE s = DEREF_type(exp_type(a));
if (IS_type_error(s)) {
EXP e = make_error_exp(0);
return e;
}
/* Check for template parameters */
CONS_exp(a, NULL_list(EXP), args);
if (dependent_conv(t, args)) {
EXP e = cast_templ_type(t, a, cast);
DESTROY_list(args, SIZE_exp);
return e;
}
/* Construct list of candidates */
p = &candidates;
p->size = 0;
cid = conv_candidates(p, t, s, cast);
/* Perform overload resolution */
if (p->size) {
EXP e;
int kind;
DECL_SPEC ds;
CANDIDATE *q;
unsigned rank;
IDENTIFIER qid;
match_this++;
q = resolve_overload(p, args, t, 0);
match_this--;
qid = q->func;
rank = q->rank;
kind = q->kind;
if (rank == RANK_BEST) {
/* Unambiguous resolution */
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
if (match_no_viable > 1 && overload_warn) {
add_error(err, ERR_over_match_conv_ok(qid));
}
} else if (rank == RANK_VIABLE) {
/* Ambiguous resolution */
q = resolve_ambiguous(p, args, t, 0);
qid = q->func;
rank = q->rank;
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
if (rank == RANK_TARGET) {
ERROR err2 = ERR_over_match_conv_target(s, t);
qid = make_ambig_func(p, qid, args, qual_none,
&err2);
kind = KIND_FUNC;
add_error(err, err2);
} else if (rank == RANK_VIABLE) {
ERROR err2 = ERR_over_match_conv_ambig(s, t);
err2 = list_candidates(err2, p, RANK_VIABLE);
add_error(err, err2);
}
} else {
/* No resolution */
if (!IS_NULL_id(cid)) {
swap_candidates(p,(unsigned)0);
}
DESTROY_list(args, SIZE_exp);
return NULL_exp;
}
/* Check conversion function */
ds = DEREF_dspec(id_storage(qid));
if (ds & dspec_trivial) {
/* Trivial copy constructor */
if (!(ds & dspec_defn)) {
implicit_defn(qid, DEFAULT_COPY);
}
CONS_exp(NULL_exp, args, args);
a = apply_trivial_func(qid, args);
DESTROY_list(args, SIZE_exp);
return a;
}
/* Apply conversion function */
use_func_id(qid, 0, suppress_usage);
if (kind == KIND_CONSTR) {
if (eq_type_unqual(t, s)) {
/* Force initialisation in copy constructor */
int depth = init_ref_force;
if (depth > 2 && IS_type_compound(t)) {
TYPE fn = DEREF_type(id_function_etc_type(qid));
CLASS_TYPE ct =
DEREF_ctype(type_compound_defn(t));
int c = check_copy_constr(fn, ct);
if (c == 3) {
/* Bad copy constructor */
HASHID nm =
DEREF_hashid(id_name(qid));
add_error(err, ERR_class_copy_bad(nm));
DESTROY_list(args, SIZE_exp);
return a;
}
}
init_ref_force = depth + 1;
e = apply_constr(qid, args);
init_ref_force = depth;
} else {
e = apply_constr(qid, args);
}
} else {
e = apply_func_id(qid, qual_none, NULL_graph, args);
if (IS_exp_constr(e)) {
/* Introduce temporary variable if necessary */
s = DEREF_type(exp_type(e));
e = make_temporary(s, e, NULL_exp, 0, err);
}
}
return e;
}
/* No candidates */
DESTROY_list(args, SIZE_exp);
return NULL_exp;
}
/*
This routine converts the expression a to the type t by user-defined
conversions. It is used, for example, in initialisations of the form
't id = a'.
*/
EXP
convert_conv(TYPE t, EXP a, ERROR *err, unsigned cast)
{
EXP e = convert_conv_aux(t, a, err, cast);
if (IS_NULL_exp(e)) {
/* No viable conversion functions */
TYPE s;
a = convert_lvalue(a);
s = DEREF_type(exp_type(a));
if (!IS_type_error(s) && !IS_type_error(t)) {
add_error(err, check_incomplete(t));
if (check_int_type(t, btype_bool)) {
e = convert_boolean(a, exp_paren_tag, err);
return e;
}
add_error(err, ERR_expr_cast_invalid(s, t));
}
e = make_null_exp(t);
} else {
/* Deal with further implicit conversions */
TYPE s = DEREF_type(exp_type(e));
if (IS_type_ref(s)) {
/* Reference conversion */
s = DEREF_type(type_ref_sub(s));
MAKE_exp_indir(s, e, e);
}
if (!IS_type_ref(t)) {
CV_SPEC cv = DEREF_cv(type_qual(s));
if (cv & cv_lvalue) {
/* lvalue conversion */
s = rvalue_type(s);
MAKE_exp_contents(s, e, e);
}
}
if (!eq_type(t, s)) {
cast = (CAST_STANDARD | CAST_IMPLICIT);
e = cast_exp(t, e, err, cast);
}
}
return e;
}
/*
This routine selects a user-defined conversion from the expression a
to a type with category matching kind. It returns the null expression
if no such conversion exists.
*/
EXP
convert_gen(unsigned kind, EXP a, ERROR *err)
{
EXP e = NULL_exp;
TYPE t = DEREF_type(exp_type(a));
/* Construct list of candidates */
CANDIDATE_LIST *p = &candidates;
p->size = 0;
gen_candidates(p, t, kind);
/* Perform overload resolution */
if (p->size) {
CANDIDATE *q;
unsigned rank;
IDENTIFIER qid;
LIST(EXP)args;
CONS_exp(a, NULL_list(EXP), args);
match_this++;
q = resolve_overload(p, args, NULL_type, 0);
match_this--;
qid = q->func;
rank = q->rank;
if (rank == RANK_BEST) {
/* Unambiguous resolution */
if (match_no_viable > 1 && overload_warn) {
add_error(err, ERR_over_match_conv_ok(qid));
}
} else if (rank == RANK_VIABLE) {
/* Ambiguous resolution */
q = resolve_ambiguous(p, args, NULL_type, 0);
qid = q->func;
rank = q->rank;
if (rank != RANK_BEST) {
/* Can't be target dependent */
ERROR err2 = ERR_over_match_conv_dup(t);
err2 = list_candidates(err2, p, RANK_VIABLE);
add_error(err, err2);
}
} else {
/* No viable candidates */
return e;
}
use_func_id(qid, 0, suppress_usage);
e = apply_func_id(qid, qual_none, NULL_graph, args);
e = convert_reference(e, REF_NORMAL);
e = convert_lvalue(e);
}
/* No candidates */
return e;
}
| 24.634155 | 77 | 0.653992 | [
"object",
"transform"
] |
8b65073d23e5fa02e3cccfdf2710ab187025febf | 3,779 | h | C | src/json.h | Vssblt/libnap | ed9d50c4d9ed08b608fc18ee108f03dc40be2796 | [
"Apache-2.0"
] | 1 | 2021-01-06T14:13:58.000Z | 2021-01-06T14:13:58.000Z | src/json.h | Vssblt/libnap | ed9d50c4d9ed08b608fc18ee108f03dc40be2796 | [
"Apache-2.0"
] | 1 | 2021-08-03T03:50:03.000Z | 2021-08-18T03:33:02.000Z | src/json.h | Vssblt/libnap | ed9d50c4d9ed08b608fc18ee108f03dc40be2796 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "binstream.h"
#include "nap_common.h"
#include <exception>
_NAP_BEGIN
#define SKIP_SPACE(N, ARR) \
while (ARR[N] == ' ' || ARR[N] == '\r' || ARR[N] == '\n' || ARR[N] == '\t') \
N++;
#define L_S '('
#define R_S ')'
#define L_M '['
#define R_M ']'
#define L_L '{'
#define R_L '}'
#define S_Q '\''
#define D_Q '\"'
#define COL ':'
#define COMMA ','
enum BasicJsonType { Number, String, Boolean };
class JsonParser;
class JsonStringify;
/*
* jsonNode
* Represents a node of the json array
*/
class JsonNode {
public:
JsonNode();
~JsonNode();
template <class T> JsonNode(const T &value);
template <class T> JsonNode(const binstream &key, const T &value);
// set & copy construct
template <class T> inline JsonNode &operator=(const T &);
template <class T> inline JsonNode &operator=(const std::vector<T> &);
binstream key();
void key(binstream);
// Basic type (number,string,float/double,boolean)
// Getter
int asInt() const;
long long asLong() const;
double asFloat() const;
std::string asString() const;
binstream asBinstream() const;
bool asBool() const;
// null support
bool asNull() const;
void setNull(bool null = true);
// Object Type
JsonNode &operator[](const binstream &key);
void append(binstream key, JsonNode);
// Array Type
JsonNode &operator[](size_t index);
void append(JsonNode);
size_t size() const;
protected:
// Basic type assignment
void set(binstream &str, BasicJsonType);
private:
binstream _key;
binstream _bindata;
BasicJsonType _bintype;
bool is_null = false;
std::vector<JsonNode> object_values; // Object array
std::vector<JsonNode> array_values; // Normal array
friend class JsonParser;
friend class JsonStringify;
};
template <class T> JsonNode::JsonNode(const T &value) { *this = value; }
template <class T> JsonNode::JsonNode(const binstream &key, const T &value) {
(*this)[key] = value;
}
template <class T>
inline JsonNode &JsonNode::operator=(const std::vector<T> &value) {
for (int i = 0; i < value.size(); i++) {
this->array_values.push_back(JsonNode(value[i]));
}
return *this;
}
template <class T> inline JsonNode &JsonNode::operator=(const T &value) {
if (typeid(T) == typeid(float) || typeid(T) == typeid(double) ||
typeid(T) == typeid(int) || typeid(T) == typeid(long long)) {
_bintype = Number;
} else if (typeid(T) == typeid(bool)) {
_bintype = Boolean;
} else {
_bintype = String;
}
_bindata = binstream::from<T>(value);
return *this;
}
template <> inline JsonNode &JsonNode::operator=(const JsonNode &old) {
// Keep your own this->_key;
this->_bindata = old._bindata;
this->is_null = old.is_null;
this->array_values = old.array_values;
this->object_values = old.object_values;
return *this;
}
// Convert json string to class
class JsonParser {
public:
// JsonParser(bool);
JsonParser(){};
bool parse(binstream);
JsonNode &root();
protected:
bool parseObject(int &pos, JsonNode &);
bool parseArray(int &pos, JsonNode &);
int getStringLen(int pos);
binstream getString(int pos, int &len);
int getBooleanLen(int pos);
int getNumberLen(int pos);
int getNullLen(int pos);
bool parseKV(int &pos, JsonNode &);
bool parseValue(int &pos, JsonNode &);
void setError(int pos, int msg = 0);
private:
binstream json;
JsonNode _root;
};
// Convert class to json string
class JsonStringify {
public:
static binstream stringify(JsonNode &);
protected:
static void strifyKV(JsonNode &, binstream &);
static void strifyValue(JsonNode &, binstream &);
static void dealArray(JsonNode &, binstream &);
static void dealObject(JsonNode &, binstream &);
};
_NAP_END
| 21.843931 | 80 | 0.658904 | [
"object",
"vector"
] |
8b679c34f86a30e6f03dfae78e7d785c8a77f9a9 | 19,799 | h | C | sys/include/libc.h | xphung/plan9_webasm | d30bb1f3a2a52927d4bcb94b3e3d8279eab1af35 | [
"MIT"
] | 11 | 2020-02-02T13:34:09.000Z | 2021-09-09T19:18:32.000Z | sys/include/libc.h | xphung/plan9_webasm | d30bb1f3a2a52927d4bcb94b3e3d8279eab1af35 | [
"MIT"
] | null | null | null | sys/include/libc.h | xphung/plan9_webasm | d30bb1f3a2a52927d4bcb94b3e3d8279eab1af35 | [
"MIT"
] | 1 | 2021-09-28T01:57:30.000Z | 2021-09-28T01:57:30.000Z | /*
* Inferno kernel and musl each have their own versions of C string and stdlib functions
*/
#ifndef _PLAN9_SOURCE
/*
* If _PLAN9_SOURCE is not set then source files are compiled using musl POSIX compliant string functions
* In this case, libc.h is an internal musl include file (completely unrelated to Plan9 libc.h)
*/
#include <libc_musl.h>
#else
/*
* If _PLAN9_SOURCE is set then source files are compiled to use Inferno 'k' versions of stdlib functions
* - Inferno stdlib strtoxx functions do not set errno
* - Inferno string functions do not have POSIX compliant const/restrict qualifiers
*/
#ifndef _PLAN9_LIBC_H
#define _PLAN9_LIBC_H
#define _STRING_H // prevent musl string.h definitions
#define _STDLIB_H // prevent musl stdlib.h definitions
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
#define offsetof(s, m) (ulong)(&(((s*)0)->m))
#define assert(x) if(x){}else _assert("x")
#define intern static inline
/*
* mem routines
*/
extern void* memset(void* p, int c, size_t n); //{ for(char *r = p; n; n--, r++) *r = c; return p; }
extern void* memcpy(void* p, const void* q, size_t n);
extern void* memccpy(void*p, const void* q, int c, size_t n);
intern void* memchr(void* p, int c, size_t n) { char *sp = p; for(c = (char)c; n > 0; n--) if(*sp++ == c) return sp-1; return 0; }
intern int memcmp(const void* p, const void* q, size_t n) { uchar *s=p, *t=q; for (;n && *s==*t; s++,t++) n--; return n ? *s-*t : 0; }
intern void* memmove(void*p, const void* q, size_t n) { return memcpy(p, q, n); }
/*
* string routines
*/
extern void* malloc(size_t size);
extern char* strchrnul(const char *s, int c);
intern char* strchr(char* s, int c) { char *r = strchrnul(s, c); return *(char *)r == (char)c ? r : 0; }
intern char* strrchr(char* s, int c) { const char *p, *f = nil; while ((p = strchr(s, c))) { f = p; s = p + 1; } return (char *) f; }
intern size_t strlen(char* s) { return (size_t) (strchrnul(s, 0) - s); }
intern int strncmp(char* l, char* r, size_t n) { if (!n--) return 0; for (; *l && *r && n && *l == *r ; l++, r++) n--; return *l - *r; }
intern int strcmp(char *p, char *q) { return strncmp(p,q, 0xFFFF); }
intern char* strncpy(char* p, char* q, long n) { q = memccpy(p, q, 0, n); if (q && q<p+n) memset(q, 0, p+n-q); return p; }
intern char* strcpy(char *p, char *q) { memccpy(p,q, 0, 0x7FFFFFFF); return p; }
intern char* strcat(char *p, char *q) { strcpy(strchrnul(p, 0), q); return p; }
intern char* strdup(const char *q) { char *p = malloc(strlen(q)+1); return p ? strcpy(p, q) : 0; }
intern char* strstr(char *r, char *s) { char f=s[0]; if(!f)return r; for(char *p=strchr(r,f); ; p=strchr(p+1,f))if(!p||!strcmp(p,s))return p; }
extern char* strecpy(char*, char*, char*);
extern int cistrncmp(char*, char*, int);
extern int cistrcmp(char*, char*);
extern char* cistrstr(char*, char*);
extern int tokenize(char*, char**, int);
enum
{
UTFmax = 4, /* maximum bytes per rune */
Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
Runeself = 0x80, /* rune and UTF sequences are the same (<) */
Runeerror = 0xFFFD, /* decoding error in UTF */
Runemax = 0x10FFFF, /* 21-bit rune */
Runemask = 0x1FFFFF, /* bits used by runes (see grep) */
};
/*
* rune routines
*/
extern int runetochar(char*, Rune*);
extern int chartorune(Rune*, char*);
extern int runelen(long);
extern int runenlen(Rune*, int);
extern int fullrune(char*, int);
extern int utflen(char*);
extern int utfnlen(char*, long);
extern char* utfrune(char*, long);
extern char* utfrrune(char*, long);
extern char* utfutf(char*, char*);
extern char* utfecpy(char*, char*, char*);
#ifndef EMU
extern Rune* runestrcat(Rune*, Rune*);
extern Rune* runestrchr(Rune*, Rune);
extern int runestrcmp(Rune*, Rune*);
extern Rune* runestrcpy(Rune*, Rune*);
extern Rune* runestrncpy(Rune*, Rune*, long);
extern Rune* runestrecpy(Rune*, Rune*, Rune*);
extern Rune* runestrdup(Rune*);
extern Rune* runestrncat(Rune*, Rune*, long);
extern int runestrncmp(Rune*, Rune*, long);
extern Rune* runestrrchr(Rune*, Rune);
extern long runestrlen(Rune*);
extern Rune* runestrstr(Rune*, Rune*);
extern Rune tolowerrune(Rune);
extern Rune totitlerune(Rune);
extern Rune toupperrune(Rune);
extern Rune tobaserune(Rune);
extern int isalpharune(Rune);
extern int isbaserune(Rune);
extern int isdigitrune(Rune);
extern int islowerrune(Rune);
extern int isspacerune(Rune);
extern int istitlerune(Rune);
extern int isupperrune(Rune);
#endif
/*
* malloc
*/
extern void* malloc(size_t);
extern void* mallocz(ulong, int);
extern void free(void*);
extern ulong msize(void*);
extern void* calloc(size_t, size_t);
extern void* realloc(void*, size_t);
extern void setmalloctag(void*, ulong);
extern void setrealloctag(void*, ulong);
extern ulong getmalloctag(void*);
extern ulong getrealloctag(void*);
extern void* malloctopoolblock(void*);
/*
* print routines
*/
typedef struct Fmt Fmt;
struct Fmt{
uchar runes; /* output buffer is runes or chars? */
void *start; /* of buffer */
void *to; /* current place in the buffer */
void *stop; /* end of the buffer; overwritten if flush fails */
int (*flush)(Fmt *); /* called when to == stop */
void *farg; /* to make flush a closure */
int nfmt; /* num chars formatted so far */
va_list args; /* args passed to dofmt */
int r; /* % format Rune */
int width;
int prec;
ulong flags;
};
enum{
FmtWidth = 1,
FmtLeft = FmtWidth << 1,
FmtPrec = FmtLeft << 1,
FmtSharp = FmtPrec << 1,
FmtSpace = FmtSharp << 1,
FmtSign = FmtSpace << 1,
FmtZero = FmtSign << 1,
FmtUnsigned = FmtZero << 1,
FmtShort = FmtUnsigned << 1,
FmtLong = FmtShort << 1,
FmtVLong = FmtLong << 1,
FmtComma = FmtVLong << 1,
FmtByte = FmtComma << 1,
FmtFlag = FmtByte << 1
};
extern int print(char*, ...);
extern char* seprint(char*, char*, char*, ...);
extern char* vseprint(char*, char*, char*, va_list);
extern int snprint(char*, int, char*, ...);
extern int vsnprint(char*, int, char*, va_list);
extern char* smprint(char*, ...);
extern char* vsmprint(char*, va_list);
extern int sprint(char*, char*, ...);
extern int fprint(int, char*, ...);
extern int vfprint(int, char*, va_list);
#ifndef EMU
extern int runesprint(Rune*, char*, ...);
extern int runesnprint(Rune*, int, char*, ...);
extern int runevsnprint(Rune*, int, char*, va_list);
extern Rune* runeseprint(Rune*, Rune*, char*, ...);
extern Rune* runevseprint(Rune*, Rune*, char*, va_list);
extern Rune* runesmprint(char*, ...);
extern Rune* runevsmprint(char*, va_list);
#endif
extern int fmtfdinit(Fmt*, int, char*, int);
extern int fmtfdflush(Fmt*);
extern int fmtstrinit(Fmt*);
extern char* fmtstrflush(Fmt*);
extern int runefmtstrinit(Fmt*);
extern Rune* runefmtstrflush(Fmt*);
#pragma varargck argpos fmtprint 2
#pragma varargck argpos fprint 2
#pragma varargck argpos print 1
#pragma varargck argpos runeseprint 3
#pragma varargck argpos runesmprint 1
#pragma varargck argpos runesnprint 3
#pragma varargck argpos runesprint 2
#pragma varargck argpos seprint 3
#pragma varargck argpos smprint 1
#pragma varargck argpos snprint 3
#pragma varargck argpos sprint 2
#pragma varargck type "lld" vlong
#pragma varargck type "llo" vlong
#pragma varargck type "llx" vlong
#pragma varargck type "llb" vlong
#pragma varargck type "lld" uvlong
#pragma varargck type "llo" uvlong
#pragma varargck type "llx" uvlong
#pragma varargck type "llb" uvlong
#pragma varargck type "ld" long
#pragma varargck type "lo" long
#pragma varargck type "lx" long
#pragma varargck type "lb" long
#pragma varargck type "ld" ulong
#pragma varargck type "lo" ulong
#pragma varargck type "lx" ulong
#pragma varargck type "lb" ulong
#pragma varargck type "d" int
#pragma varargck type "o" int
#pragma varargck type "x" int
#pragma varargck type "c" int
#pragma varargck type "C" int
#pragma varargck type "b" int
#pragma varargck type "d" uint
#pragma varargck type "x" uint
#pragma varargck type "c" uint
#pragma varargck type "C" uint
#pragma varargck type "b" uint
#pragma varargck type "f" double
#pragma varargck type "e" double
#pragma varargck type "g" double
#pragma varargck type "s" char*
#pragma varargck type "q" char*
#pragma varargck type "S" Rune*
#pragma varargck type "Q" Rune*
#pragma varargck type "r" void
#pragma varargck type "%" void
#pragma varargck type "n" int*
#pragma varargck type "p" uintptr
#pragma varargck type "p" void*
#pragma varargck flag ','
#pragma varargck flag ' '
#pragma varargck flag 'h'
#pragma varargck type "<" void*
#pragma varargck type "[" void*
#pragma varargck type "H" void*
#pragma varargck type "lH" void*
extern int fmtinstall(int, int (*)(Fmt*));
extern int dofmt(Fmt*, char*);
extern int dorfmt(Fmt*, Rune*);
extern int fmtprint(Fmt*, char*, ...);
extern int fmtvprint(Fmt*, char*, va_list);
extern int fmtrune(Fmt*, int);
extern int fmtstrcpy(Fmt*, char*);
extern int fmtrunestrcpy(Fmt*, Rune*);
/*
* error string for %r
* supplied on per os basis, not part of fmt library
*/
extern int errfmt(Fmt *f);
/*
* quoted strings
*/
extern char *unquotestrdup(char*);
extern Rune *unquoterunestrdup(Rune*);
extern char *quotestrdup(char*);
extern Rune *quoterunestrdup(Rune*);
extern int quotestrfmt(Fmt*);
extern int quoterunestrfmt(Fmt*);
extern void quotefmtinstall(void);
extern int (*doquote)(int);
/*
* random number
*/
extern void srand(long);
extern int rand(void);
extern int nrand(int);
#ifndef EMU
extern long lrand(void);
extern long lnrand(long);
extern double frand(void);
#endif
extern ulong truerand(void); /* uses /dev/random */
extern ulong ntruerand(ulong); /* uses /dev/random */
/*
* math
*/
extern double NaN(void);
extern double Inf(int);
extern int isNaN(double);
extern int isInf(double, int);
#ifndef EMU /* enforce exclusion of FP funcs within kernel */
extern ulong umuldiv(ulong, ulong, ulong);
extern long muldiv(long, long, long);
extern double pow(double, double);
extern double atan2(double, double);
extern double fabs(double);
extern double atan(double);
extern double log(double);
extern double log10(double);
extern double exp(double);
extern double floor(double);
extern double ceil(double);
extern double hypot(double, double);
extern double sin(double);
extern double cos(double);
extern double tan(double);
extern double asin(double);
extern double acos(double);
extern double sinh(double);
extern double cosh(double);
extern double tanh(double);
extern double sqrt(double);
extern double fmod(double, double);
#endif
#define HUGE 3.4028234e38
#define PIO2 1.570796326794896619231e0
#define PI (PIO2+PIO2)
#define NaN() __builtin_nan("")
#define Inf(s) __builtin_copysign(__builtin_inf(), (s))
#define isNaN(x) __builtin_isnan((x))
#define isInf(x,s) (__builtin_isinf((x)) ? ((x) > 0 ? (s) >= 0 : (s) <= 0) : 0)
/*
* time-of-day
*/
typedef struct Tm Tm;
struct Tm {
int sec;
int min;
int hour;
int mday;
int mon;
int year;
int wday;
int yday;
char zone[4];
int tzoff;
};
extern Tm* gmtime(long);
extern Tm* localtime(long);
extern char* asctime(Tm*);
extern char* ctime(long);
extern double cputime(void);
extern long times(long*);
extern long tm2sec(Tm*);
extern vlong nsec(void);
/*
* clock_gettime extension
*/
#ifndef __DEFINED_struct_timespec)
#define __DEFINED_struct_timespec
struct timespec { time_t tv_sec; long tv_nsec; };
#endif
int clock_gettime(int, struct timespec *);
/*
* one-of-a-kind
*/
extern void _assert(char*);
extern int abs(int);
extern int atexit(void(*)(void));
extern void atexitdont(void(*)(void));
extern int atnotify(int(*)(void*, char*), int);
extern vlong kstrtoll(const char*, char**, int);
intern int atoi(char *x) { return (int) kstrtoll(x, nil, 10); }
intern long atol(char *x) { return (long) kstrtoll(x, nil, 10); }
intern vlong atoll(char *x) { return kstrtoll(x, nil, 10); }
extern double charstod(int(*)(void*), void*);
extern char* cleanname(char*);
extern int dec64(uchar*, int, char*, int);
extern int enc64(char*, int, uchar*, int);
extern int dec32(uchar*, int, char*, int);
extern int enc32(char*, int, uchar*, int);
extern int dec16(uchar*, int, char*, int);
extern int enc16(char*, int, uchar*, int);
extern void _Noreturn exits(char*);
extern double frexp(double, int*);
extern ulong getcallerpc(void*);
extern char* getenv(char*);
extern int getfields(char*, char**, int, int, char*);
extern char* getuser(void);
extern char* getwd(char*, int);
extern double ipow10(int);
extern double ldexp(double, int);
extern double modf(double, double*);
extern void perror(const char*);
extern double pow10(int);
extern void qsort(void*, long, long, int (*)(void*, void*));
extern double strtod(char*, char**);
extern long strtol(char*, char**, int);
extern ulong strtoul(char*, char**, int);
extern vlong strtoll(const char*, char**, int);
extern uvlong strtoull(char*, char**, int);
extern void sysfatal(char*, ...);
extern long time(long*);
extern int tolower(int);
extern int toupper(int);
#include <ctype.h>
/*
* synchronization
*/
#ifndef EMU
typedef struct Proc Proc;
#endif
typedef struct Lock Lock;
struct Lock {
int val;
int pid;
};
extern int _tas(int*);
extern void lock(Lock*);
extern void unlock(Lock*);
extern int canlock(Lock*);
typedef struct QLock QLock;
struct QLock
{
Lock use; /* to access Qlock structure */
Proc *head; /* next process waiting for object */
Proc *tail; /* last process waiting for object */
int locked; /* flag */
};
extern void qlock(QLock*);
extern void qunlock(QLock*);
extern int canqlock(QLock*);
extern void _qlockinit(ulong (*)(ulong, ulong)); /* called only by the thread library */
typedef
struct RWLock
{
Lock l; /* Lock modify lock */
QLock x; /* Mutual exclusion lock */
QLock k; /* Lock for waiting writers */
int readers; /* Count of readers in lock */
} RWLock;
extern int canrlock(RWLock*);
extern int canwlock(RWLock*);
extern void rlock(RWLock*);
extern void runlock(RWLock*);
extern void wlock(RWLock*);
extern void wunlock(RWLock*);
/*
* network dialing
*/
#define NETPATHLEN 40
/*
* system calls
*
*/
#define getpid kgetpid
#define getwd kgetwd
#define STATMAX 65535U /* max length of machine-independent stat structure */
#define DIRMAX (sizeof(Dir)+STATMAX) /* max length of Dir structure */
#define ERRMAX 128 /* max length of error string */
#define MORDER 0x0003 /* mask for bits defining order of mounting */
#define MREPL 0x0000 /* mount replaces object */
#define MBEFORE 0x0001 /* mount goes before others in union directory */
#define MAFTER 0x0002 /* mount goes after others in union directory */
#define MCREATE 0x0004 /* permit creation in mounted directory */
#define MCACHE 0x0010 /* cache some data */
#define MMASK 0x0017 /* all bits on */
#define OREAD 0 /* open for read */
#define OWRITE 1 /* write */
#define ORDWR 2 /* read and write */
#define OEXEC 3 /* execute, == read but check execute permission */
#define OTRUNC 16 /* or'ed in (except for exec), truncate file first */
#define OCEXEC 32 /* or'ed in, close on exec */
#define ORCLOSE 64 /* or'ed in, remove on close */
#define OEXCL 0x1000 /* or'ed in, exclusive use (create only) */
#define AEXIST 0 /* accessible: exists */
#define AEXEC 1 /* execute access */
#define AWRITE 2 /* write access */
#define AREAD 4 /* read access */
/* bits in Qid.type */
#define QTDIR 0x80 /* type bit for directories */
#define QTAPPEND 0x40 /* type bit for append only files */
#define QTEXCL 0x20 /* type bit for exclusive use files */
#define QTMOUNT 0x10 /* type bit for mounted channel */
#define QTAUTH 0x08 /* type bit for authentication file */
#define QTFILE 0x00 /* plain file */
/* bits in Dir.mode */
#define DMDIR 0x80000000 /* mode bit for directories */
#define DMAPPEND 0x40000000 /* mode bit for append only files */
#define DMEXCL 0x20000000 /* mode bit for exclusive use files */
#define DMMOUNT 0x10000000 /* mode bit for mounted channel */
#define DMAUTH 0x08000000 /* mode bit for authentication file */
#define DMTMP 0x04000000 /* mode bit for non-backed-up files */
#define DMREAD 0x4 /* mode bit for read permission */
#define DMWRITE 0x2 /* mode bit for write permission */
#define DMEXEC 0x1 /* mode bit for execute permission */
/* rfork */
enum
{
RFNAMEG = (1<<0),
RFENVG = (1<<1),
RFFDG = (1<<2),
RFNOTEG = (1<<3),
RFPROC = (1<<4),
RFMEM = (1<<5),
RFNOWAIT = (1<<6),
RFCNAMEG = (1<<10),
RFCENVG = (1<<11),
RFCFDG = (1<<12),
RFREND = (1<<13),
RFNOMNT = (1<<14)
};
typedef
struct Qid
{
uvlong path;
ulong vers;
uchar type;
} Qid;
typedef
struct Dir {
/* system-modified data */
ushort type; /* server type */
uint dev; /* server subtype */
/* file data */
Qid qid; /* unique id from server */
ulong mode; /* permissions */
ulong atime; /* last read time */
ulong mtime; /* last write time */
vlong length; /* file length */
char *name; /* last element of path */
char *uid; /* owner name */
char *gid; /* group name */
char *muid; /* last modifier name */
} Dir;
typedef
struct Waitmsg
{
int pid; /* of loved one */
ulong time[3]; /* of loved one & descendants */
char *msg;
} Waitmsg;
#define bind _BIND
#define chdir _CHDIR
#define close _CLOSE
#define create _CREATE
#define dup _DUP
#define fstat _FSTAT
#define fwstat _FWSTAT
#define mount _MOUNT
#define open _OPEN
#define pipe _PIPE
#define pread _PREAD
#define pwrite _PWRITE
#define read _READ
#define remove _REMOVE
#define rfork _RFORK
#define seek _SEEK
#define stat _STAT
#define write _WRITE
#define wstat _WSTAT
extern void _exits(char*);
extern void abort(void);
extern int bind(const char*, const char*, int);
extern int chdir(const char*);
extern int close(int);
extern int create(const char*, int, ulong);
extern int dup(int, int);
extern int errstr(char*, uint);
extern int rfork(int);
extern int fstat(int, void*, int);
extern int fwstat(int, void*, int);
extern int fversion(int, int, char*, int);
extern int mount(int, int, const char*, int, const char*);
extern int noted(int);
extern int notify(void(*)(void*, char*));
extern int open(const char*, int);
extern int fd2path(int, const char*, int);
extern int pipe(int*);
extern long pread(int, void*, long, vlong);
extern long pwrite(int, const void*, long, vlong);
extern long read(int, void*, long);
extern long readn(int, void*, long);
extern int remove(const char*);
extern void* sbrk(long);
extern vlong seek(int, vlong, int);
extern int segflush(void*, ulong);
extern int sleep(long);
extern int stat(const char*, void*, int);
extern long write(int, const void*, long);
extern int wstat(const char*, void*, int);
extern void* rendezvous(void*, void*);
extern Dir* dirstat(char*);
extern Dir* dirfstat(int);
extern int dirwstat(char*, Dir*);
extern int dirfwstat(int, Dir*);
extern long dirread(int, Dir**);
extern void nulldir(Dir*);
extern long dirreadall(int, Dir**);
extern int getpid(void);
extern int getppid(void);
extern void rerrstr(char*, uint);
extern char* sysname(void);
extern void werrstr(char*, ...);
extern char *argv0;
#define ARGBEGIN for((argv0||(argv0=*argv)),argv++,argc--;\
argv[0] && argv[0][0]=='-' && argv[0][1];\
argc--, argv++) {\
char *_args, *_argt;\
Rune _argc;\
_args = &argv[0][1];\
if(_args[0]=='-' && _args[1]==0){\
argc--; argv++; break;\
}\
_argc = 0;\
while(*_args && (_args += chartorune(&_argc, _args)))\
switch(_argc)
#define ARGEND SET(_argt);USED(_argt);USED(_argc); USED(_args);}USED(argv); USED(argc);
#define ARGF() (_argt=_args, _args="",\
(*_argt? _argt: argv[1]? (argc--, *++argv): 0))
#define EARGF(x) (_argt=_args, _args="",\
(*_argt? _argt: argv[1]? (argc--, *++argv): ((x), abort(), (char*)0)))
#define ARGC() _argc
/*
* Extensions for Inferno to basic libc.h
*/
#define setbinmode()
#undef intern
#endif
#endif
| 29.817771 | 143 | 0.685136 | [
"object"
] |
8b68c9d335100d4fc76bbe6ca0758763e02dbfa4 | 17,395 | h | C | include/cutlass/gemm/kernel/gemm_grouped.h | 1div0/cutlass | a79829d333ccfb3cc81561244d56bd361ce9ca85 | [
"BSD-3-Clause"
] | 1 | 2022-03-21T01:47:47.000Z | 2022-03-21T01:47:47.000Z | include/cutlass/gemm/kernel/gemm_grouped.h | 1div0/cutlass | a79829d333ccfb3cc81561244d56bd361ce9ca85 | [
"BSD-3-Clause"
] | null | null | null | include/cutlass/gemm/kernel/gemm_grouped.h | 1div0/cutlass | a79829d333ccfb3cc81561244d56bd361ce9ca85 | [
"BSD-3-Clause"
] | null | null | null | /***************************************************************************************************
* Copyright (c) 2017-2021, NVIDIA 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 the NVIDIA 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 NVIDIA CORPORATION 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.
*
**************************************************************************************************/
/*! \file
\brief
*/
#pragma once
#include "cutlass/cutlass.h"
#include "cutlass/fast_math.h"
#include "cutlass/gemm/gemm.h"
#include "cutlass/matrix_coord.h"
#include "cutlass/complex.h"
#include "cutlass/semaphore.h"
#include "cutlass/layout/matrix.h"
#include "cutlass/trace.h"
#include "cutlass/gemm/kernel/gemm_transpose_operands.h"
/////////////////////////////////////////////////////////////////////////////////////////////////
namespace cutlass {
namespace gemm {
namespace kernel {
/////////////////////////////////////////////////////////////////////////////////////////////////
/// Visitor class to abstract away the algorithm for iterating over tiles
template <bool Transposed = false>
struct GemmGroupedProblemVisitor {
static bool const kTransposed = Transposed;
struct Params {
cutlass::gemm::GemmCoord const *problem_sizes;
int32_t problem_count;
//
// Methods
//
/// Ctor
CUTLASS_HOST_DEVICE
Params(): problem_sizes(nullptr), problem_count(0) { }
/// Ctor
CUTLASS_HOST_DEVICE
Params(
cutlass::gemm::GemmCoord const *problem_sizes,
int32_t problem_count
):
problem_sizes(problem_sizes),
problem_count(problem_count)
{}
};
struct SharedStorage {
//
// Nothing for now. As an optimization step, we could consider parallel
// argmin or prefix sums across the block.
//
};
//
// Data members
//
Params const ¶ms;
SharedStorage &shared_storage;
cutlass::MatrixCoord threadblock_shape;
int64_t tile_idx;
int64_t tile_count_sum;
int64_t problem_tile_start;
int32_t problem_idx;
//
// Methods
//
CUTLASS_DEVICE
GemmGroupedProblemVisitor(
Params const ¶ms_,
SharedStorage &shared_storage_,
cutlass::MatrixCoord threadblock_shape_,
int32_t block_idx
):
shared_storage(shared_storage_),
params(params_),
threadblock_shape(threadblock_shape_),
tile_idx(block_idx),
tile_count_sum(0),
problem_idx(0)
{
cutlass::gemm::GemmCoord problem = problem_size();
cutlass::gemm::GemmCoord grid = grid_shape(problem);
problem_tile_start = 0;
tile_count_sum = grid.m() * grid.n();
}
/// Get the grid shape
CUTLASS_HOST_DEVICE
static cutlass::gemm::GemmCoord grid_shape(
cutlass::gemm::GemmCoord problem,
cutlass::MatrixCoord const & block_shape) {
return cutlass::gemm::GemmCoord(
((problem.m() - 1 + block_shape.row()) / block_shape.row()),
((problem.n() - 1 + block_shape.column()) / block_shape.column()),
1);
}
/// Get the grid shape
CUTLASS_DEVICE
cutlass::gemm::GemmCoord grid_shape(cutlass::gemm::GemmCoord const &problem) const {
return grid_shape(problem, threadblock_shape);
}
/// Returns true if there is a tile to compute
CUTLASS_DEVICE
bool next_tile() {
if (tile_idx < tile_count_sum) {
return true;
}
do {
++problem_idx;
if (problem_idx >= params.problem_count) {
return false;
}
cutlass::gemm::GemmCoord problem = problem_size();
cutlass::gemm::GemmCoord grid = grid_shape(problem);
int64_t tile_count = grid.m() * grid.n();
problem_tile_start = tile_count_sum;
tile_count_sum += tile_count;
} while (tile_count_sum <= tile_idx);
return true;
}
/// Gets the global tile index
CUTLASS_HOST_DEVICE
int64_t tile_index() const {
return tile_idx;
}
/// Gets the index of the problem
CUTLASS_HOST_DEVICE
int32_t problem_index() const {
return problem_idx;
}
/// Returns the problem size for the current problem
CUTLASS_HOST_DEVICE
cutlass::gemm::GemmCoord problem_size() const {
GemmCoord problem = params.problem_sizes[problem_idx];
if (kTransposed) {
swap(problem.m(), problem.n());
}
return problem;
}
CUTLASS_HOST_DEVICE
int64_t threadblock_index() const {
return tile_idx - problem_tile_start;
}
CUTLASS_DEVICE
void advance(int32_t grid_size) {
tile_idx += grid_size;
}
};
/////////////////////////////////////////////////////////////////////////////////////////////////
template <
typename Mma_, ///! Threadblock-scoped matrix multiply-accumulate
typename Epilogue_, ///! Epilogue
typename ThreadblockSwizzle_, ///! Threadblock swizzling function
bool Transposed = false
>
struct GemmGrouped {
public:
using Mma = Mma_;
using Epilogue = Epilogue_;
using EpilogueOutputOp = typename Epilogue::OutputOp;
using ThreadblockSwizzle = ThreadblockSwizzle_;
static bool const kTransposed = Transposed;
// Optional transpose
using MapArguments = kernel::detail::MapArguments<
typename Mma::IteratorA::Element,
typename Mma::IteratorA::Layout,
Mma::kTransformA,
Mma::IteratorA::AccessType::kElements,
typename Mma::IteratorB::Element,
typename Mma::IteratorB::Layout,
Mma::kTransformB,
Mma::IteratorB::AccessType::kElements,
typename Mma::LayoutC,
kTransposed
>;
// Public-facing type definitions related to operand element type, layout, and complex conjugate
// operation. Must interact with the 'kTransposed' notion.
using ElementA = typename MapArguments::ElementA;
using LayoutA = typename MapArguments::LayoutA;
using ElementB = typename MapArguments::ElementB;
using LayoutB = typename MapArguments::LayoutB;
using ElementC = typename Epilogue::OutputTileIterator::Element;
using LayoutC = typename MapArguments::LayoutC;
static ComplexTransform const kTransformA = MapArguments::kTransformA;
static ComplexTransform const kTransformB = MapArguments::kTransformB;
// Type definitions about the mainloop.
using Operator = typename Mma::Operator;
using OperatorClass = typename Mma::Operator::OperatorClass;
using ThreadblockShape = typename Mma::Shape;
using WarpShape = typename Mma::Operator::Shape;
using InstructionShape = typename Mma::Policy::Operator::InstructionShape;
using ArchTag = typename Mma::ArchTag;
static int const kStages = Mma::kStages;
static int const kAlignmentA = MapArguments::kAlignmentA;
static int const kAlignmentB = MapArguments::kAlignmentB;
static int const kAlignmentC = Epilogue::OutputTileIterator::kElementsPerAccess;
/// Warp count (concept: GemmShape)
using WarpCount = typename Mma::WarpCount;
static int const kThreadCount = 32 * WarpCount::kCount;
//
// Structures
//
/// Argument structure
struct Arguments {
//
// Data members
//
GemmCoord *problem_sizes;
int problem_count;
int threadblock_count;
typename EpilogueOutputOp::Params output_op;
ElementA ** ptr_A;
ElementB ** ptr_B;
ElementC ** ptr_C;
ElementC ** ptr_D;
typename LayoutA::Stride::LongIndex *lda;
typename LayoutB::Stride::LongIndex *ldb;
typename LayoutC::Stride::LongIndex *ldc;
typename LayoutC::Stride::LongIndex *ldd;
//
// Methods
//
/// Default ctor
CUTLASS_HOST_DEVICE
Arguments():
problem_count(0),
threadblock_count(0),
ptr_A(nullptr),
ptr_B(nullptr),
ptr_C(nullptr),
ptr_D(nullptr),
lda(nullptr),
ldb(nullptr),
ldc(nullptr),
ldd(nullptr)
{
}
/// Ctor
CUTLASS_HOST_DEVICE
Arguments(
GemmCoord *problem_sizes,
int problem_count,
int threadblock_count,
typename EpilogueOutputOp::Params output_op,
ElementA ** ptr_A,
ElementB ** ptr_B,
ElementC ** ptr_C,
ElementC ** ptr_D,
typename LayoutA::Stride::LongIndex *lda,
typename LayoutB::Stride::LongIndex *ldb,
typename LayoutC::Stride::LongIndex *ldc,
typename LayoutC::Stride::LongIndex *ldd
):
problem_sizes(problem_sizes),
problem_count(problem_count),
threadblock_count(threadblock_count),
output_op(output_op),
ptr_A(ptr_A),
ptr_B(ptr_B),
ptr_C(ptr_C),
ptr_D(ptr_D),
lda(lda),
ldb(ldb),
ldc(ldc),
ldd(ldd)
{
}
};
//
// Structure for precomputing values in host memory and passing to kernels
//
/// Parameters structure
struct Params {
typename GemmGroupedProblemVisitor<kTransposed>::Params problem_visitor;
int threadblock_count;
typename EpilogueOutputOp::Params output_op;
ElementA ** ptr_A;
ElementB ** ptr_B;
ElementC ** ptr_C;
ElementC ** ptr_D;
typename LayoutA::Stride::LongIndex *lda;
typename LayoutB::Stride::LongIndex *ldb;
typename LayoutC::Stride::LongIndex *ldc;
typename LayoutC::Stride::LongIndex *ldd;
//
// Methods
//
CUTLASS_HOST_DEVICE
Params():
ptr_A(nullptr),
ptr_B(nullptr),
ptr_C(nullptr),
ptr_D(nullptr),
lda(nullptr),
ldb(nullptr),
ldc(nullptr),
ldd(nullptr)
{ }
CUTLASS_HOST_DEVICE
Params(Arguments const &args, void *workspace = nullptr):
problem_visitor(args.problem_sizes, args.problem_count),
threadblock_count(args.threadblock_count),
output_op(args.output_op),
ptr_A(args.ptr_A),
ptr_B(args.ptr_B),
ptr_C(args.ptr_C),
ptr_D(args.ptr_D),
lda(args.lda),
ldb(args.ldb),
ldc(args.ldc),
ldd(args.ldd)
{
}
CUTLASS_HOST_DEVICE
void update(
Arguments const &args,
void *workspace = nullptr) {
problem_visitor = typename GemmGroupedProblemVisitor<kTransposed>::Params(args.problem_sizes, args.problem_count);
threadblock_count = args.threadblock_count;
output_op = args.output_op;
ptr_A = args.ptr_A;
ptr_B = args.ptr_B;
ptr_C = args.ptr_C;
ptr_D = args.ptr_D;
lda = args.lda;
ldb = args.ldb;
ldc = args.ldc;
ldd = args.ldd;
}
};
/// Shared memory storage structure
union SharedStorage {
typename GemmGroupedProblemVisitor<kTransposed>::SharedStorage problem_visitor;
typename Mma::SharedStorage main_loop;
typename Epilogue::SharedStorage epilogue;
};
public:
//
// Methods
//
CUTLASS_DEVICE
GemmGrouped() { }
/// Determines whether kernel satisfies alignment
static Status can_implement(cutlass::gemm::GemmCoord const & problem_size) {
return Status::kSuccess;
}
static Status can_implement(Arguments const &args) {
return Status::kSuccess;
}
static size_t get_extra_workspace_size(
Arguments const &args,
cutlass::gemm::GemmCoord const &grid_tiled_shape) {
return 0;
}
/// Executes one GEMM
CUTLASS_DEVICE
void operator()(Params const ¶ms, SharedStorage &shared_storage) {
//
// These types shadow the type-level definitions and support the ability to implement
// a 'transposed' GEMM that computes the transposed problems.
//
using ElementA = typename Mma::IteratorA::Element;
using LayoutA = typename Mma::IteratorA::Layout;
using ElementB = typename Mma::IteratorB::Element;
using LayoutB = typename Mma::IteratorB::Layout;
using ElementC = typename Epilogue::OutputTileIterator::Element;
using LayoutC = typename Epilogue::OutputTileIterator::Layout;
//
// Problem visitor.
//
GemmGroupedProblemVisitor<kTransposed> problem_visitor(
params.problem_visitor,
shared_storage.problem_visitor,
{Mma::Shape::kM, Mma::Shape::kN},
blockIdx.x);
// Outer 'persistent' loop to iterate over tiles
while (problem_visitor.next_tile()) {
GemmCoord problem_size = problem_visitor.problem_size();
int32_t problem_idx = problem_visitor.problem_index();
int32_t cta_idx = int32_t(problem_visitor.threadblock_index());
GemmCoord grid_shape = problem_visitor.grid_shape(problem_size);
cutlass::gemm::GemmCoord threadblock_offset(
int(cta_idx / grid_shape.n()) * Mma::Shape::kM,
int(cta_idx % grid_shape.n()) * Mma::Shape::kN,
0);
// Load element pointers. Exchange pointers and strides if working on the transpose
ElementA *ptr_A = reinterpret_cast<ElementA *>((kTransposed ? params.ptr_B[problem_idx] : params.ptr_A[problem_idx]));
typename LayoutA::LongIndex ldm_A = (kTransposed ? params.ldb[problem_idx] : params.lda[problem_idx]);
ElementB *ptr_B = reinterpret_cast<ElementB *>((kTransposed ? params.ptr_A[problem_idx] : params.ptr_B[problem_idx]));
typename LayoutB::LongIndex ldm_B = (kTransposed ? params.lda[problem_idx] : params.ldb[problem_idx]);
// Compute initial location in logical coordinates
cutlass::MatrixCoord tb_offset_A{
threadblock_offset.m(),
0,
};
cutlass::MatrixCoord tb_offset_B{
0,
threadblock_offset.n()
};
// Compute position within threadblock
int thread_idx = threadIdx.x;
// Construct iterators to A and B operands
typename Mma::IteratorA iterator_A(
LayoutA(ldm_A),
ptr_A,
{problem_size.m(), problem_size.k()},
thread_idx,
tb_offset_A);
typename Mma::IteratorB iterator_B(
LayoutB(ldm_B),
ptr_B,
{problem_size.k(), problem_size.n()},
thread_idx,
tb_offset_B);
typename Mma::FragmentC accumulators;
accumulators.clear();
// Broadcast the warp_id computed by lane 0 to ensure dependent code
// is compiled as warp-uniform.
int warp_idx = __shfl_sync(0xffffffff, threadIdx.x / 32, 0);
int lane_idx = threadIdx.x % 32;
//
// Matrix multiply phase
//
// Construct thread-scoped matrix multiply
Mma mma(shared_storage.main_loop, thread_idx, warp_idx, lane_idx);
// Compute threadblock-scoped matrix multiply-add
int gemm_k_iterations = (problem_size.k() + Mma::Shape::kK - 1) / Mma::Shape::kK;
// Compute threadblock-scoped matrix multiply-add
mma(
gemm_k_iterations,
accumulators,
iterator_A,
iterator_B,
accumulators);
//
// Epilogue
//
EpilogueOutputOp output_op(params.output_op);
ElementC *ptr_C = params.ptr_C[problem_idx];
ElementC *ptr_D = params.ptr_D[problem_idx];
LayoutC layout_C(params.ldc[problem_idx]);
LayoutC layout_D(params.ldd[problem_idx]);
typename Epilogue::OutputTileIterator::Params params_C(layout_C);
typename Epilogue::OutputTileIterator::Params params_D(layout_D);
// Tile iterator loading from source tensor.
typename Epilogue::OutputTileIterator iterator_C(
params_C,
ptr_C,
problem_size.mn(),
thread_idx,
threadblock_offset.mn()
);
// Tile iterator writing to destination tensor.
typename Epilogue::OutputTileIterator iterator_D(
params_D,
ptr_D,
problem_size.mn(),
thread_idx,
threadblock_offset.mn()
);
Epilogue epilogue(
shared_storage.epilogue,
thread_idx,
warp_idx,
lane_idx);
// Execute the epilogue operator to update the destination tensor.
epilogue(
output_op,
iterator_D,
accumulators,
iterator_C);
// Next tile
problem_visitor.advance(gridDim.x);
}
}
};
/////////////////////////////////////////////////////////////////////////////////////////////////
} // namespace kernel
} // namespace gemm
} // namespace cutlass
/////////////////////////////////////////////////////////////////////////////////////////////////
| 28.238636 | 124 | 0.647082 | [
"shape"
] |
8b6dea4979ee444544105c953f628ff70804cf67 | 1,258 | h | C | ll_graphic/model/scenes.h | LoSealL/lltech | 5acb399820c99f84345e88537c7db259e13d63e4 | [
"MIT"
] | 1 | 2019-09-11T11:55:07.000Z | 2019-09-11T11:55:07.000Z | ll_graphic/model/scenes.h | LoSealL/lltech | 5acb399820c99f84345e88537c7db259e13d63e4 | [
"MIT"
] | null | null | null | ll_graphic/model/scenes.h | LoSealL/lltech | 5acb399820c99f84345e88537c7db259e13d63e4 | [
"MIT"
] | null | null | null | /********************************************************************
Copyright 2018 Tang, Wenyi. All Rights Reserved.
Description : scenes
Author : Wenyi Tang
Email : wenyi.tang@intel.com
Created : Feb. 28th, 2018
********************************************************************/
#ifndef LL_GRAPHIC_MODEL_SCENES_H_
#define LL_GRAPHIC_MODEL_SCENES_H_
#include "ll_graphic/core/renderer/renderer.h"
#include "ll_graphic/core/vertex/vertex_buffer.h"
#include "ll_graphic/engine/types.h"
#include "ll_graphic/export/export.h"
#include "ll_graphic/model/camera.h"
#include "ll_graphic/model/model.h"
namespace ll {
namespace engine {
class Env;
namespace model {
/* A scene is a container for a world */
class IXR_ENGINE_API Scene {
public:
using ShapeContainer = std::map<String, Model *>;
using ShapeVertexBuffer = std::map<Model *, core::VertexBuffer>;
Scene(Env *e);
~Scene();
void AddShape(Model *shape, const char *name = nullptr);
void RemoveShape(const char *name) noexcept;
void Draw(core::Renderer *renderer);
protected:
ShapeContainer shapes_;
ShapeVertexBuffer shapebuffers_;
engine::Env *env_;
};
} // namespace model
} // namespace engine
} // namespace ixr
#endif // LL_GRAPHIC_MODEL_SCENES_H_
| 26.765957 | 69 | 0.655803 | [
"shape",
"model"
] |
8b6e131a89c6649c631b28b18531269d8e41c1d7 | 46,542 | h | C | Class/include/perturbations.h | amoradinejad/limHaloPT | 302c139809ffa95a6e154a4268e4d48e4082cdf3 | [
"MIT"
] | null | null | null | Class/include/perturbations.h | amoradinejad/limHaloPT | 302c139809ffa95a6e154a4268e4d48e4082cdf3 | [
"MIT"
] | 11 | 2022-02-17T14:55:17.000Z | 2022-03-24T17:35:55.000Z | Class/include/perturbations.h | amoradinejad/limHaloPT | 302c139809ffa95a6e154a4268e4d48e4082cdf3 | [
"MIT"
] | null | null | null | /** @file perturbations.h Documented includes for perturbation module */
#ifndef __PERTURBATIONS__
#define __PERTURBATIONS__
#include "thermodynamics.h"
#define _scalars_ ((ppt->has_scalars == _TRUE_) && (index_md == ppt->index_md_scalars))
#define _vectors_ ((ppt->has_vectors == _TRUE_) && (index_md == ppt->index_md_vectors))
#define _tensors_ ((ppt->has_tensors == _TRUE_) && (index_md == ppt->index_md_tensors))
#define _set_source_(index) ppt->sources[index_md][index_ic * ppt->tp_size[index_md] + index][index_tau * ppt->k_size[index_md] + index_k]
/**
* flags for various approximation schemes
* (tca = tight-coupling approximation,
* rsa = radiation streaming approximation,
* ufa = massless neutrinos / ultra-relativistic relics fluid approximation)
*
* CAUTION: must be listed below in chronological order, and cannot be
* reversible. When integrating equations for a given mode, it is only
* possible to switch from left to right in the lists below.
*/
//@{
enum tca_flags {tca_on, tca_off};
enum rsa_flags {rsa_off, rsa_on};
enum tca_idm_dr_flags {tca_idm_dr_on, tca_idm_dr_off};
enum rsa_idr_flags {rsa_idr_off, rsa_idr_on};
enum ufa_flags {ufa_off, ufa_on};
enum ncdmfa_flags {ncdmfa_off, ncdmfa_on};
//@}
/**
* labels for the way in which each approximation scheme is implemented
*/
//@{
enum tca_method {first_order_MB,first_order_CAMB,first_order_CLASS,second_order_CRS,second_order_CLASS,compromise_CLASS};
enum rsa_method {rsa_null,rsa_MD,rsa_MD_with_reio,rsa_none};
enum idr_method {idr_free_streaming,idr_fluid}; /* for the idm-idr case */
enum rsa_idr_method {rsa_idr_none,rsa_idr_MD}; /* for the idm-idr case */
enum ufa_method {ufa_mb,ufa_hu,ufa_CLASS,ufa_none};
enum ncdmfa_method {ncdmfa_mb,ncdmfa_hu,ncdmfa_CLASS,ncdmfa_none};
enum tensor_methods {tm_photons_only,tm_massless_approximation,tm_exact};
//@}
/**
* List of coded gauges. More gauges can in principle be defined.
*/
//@{
enum possible_gauges {
newtonian, /**< newtonian (or longitudinal) gauge */
synchronous /**< synchronous gauge with \f$ \theta_{cdm} = 0 \f$ by convention */
};
//@}
//@{
/**
* maximum number and types of selection function (for bins of matter density or cosmic shear)
*/
#define _SELECTION_NUM_MAX_ 100
enum selection_type {gaussian,tophat,dirac};
//@}
//@{
/**
* maximum number of k-values for perturbation output
*/
#define _MAX_NUMBER_OF_K_FILES_ 30
//@}
/**
* Structure containing everything about perturbations that other
* modules need to know, in particular tabled values of the source
* functions \f$ S(k, \tau) \f$ for all requested modes
* (scalar/vector/tensor), initial conditions, types (temperature,
* E-polarization, B-polarization, lensing potential, etc), multipole
* l and wavenumber k.
*
*/
struct perturbations
{
/** @name - input parameters initialized by user in input module
* (all other quantities are computed in this module, given these
* parameters and the content of the 'precision', 'background' and
* 'thermodynamics' structures) */
//@{
short has_perturbations; /**< do we need to compute perturbations at all ? */
short has_cls; /**< do we need any harmonic space spectrum \f$ C_l \f$ (and hence Bessel functions, transfer functions, ...)? */
short has_scalars; /**< do we need scalars? */
short has_vectors; /**< do we need vectors? */
short has_tensors; /**< do we need tensors? */
short has_ad; /**< do we need adiabatic mode? */
short has_bi; /**< do we need isocurvature bi mode? */
short has_cdi; /**< do we need isocurvature cdi mode? */
short has_nid; /**< do we need isocurvature nid mode? */
short has_niv; /**< do we need isocurvature niv mode? */
/* perturbed recombination */
/** Do we want to consider perturbed temperature and ionization fraction? */
short has_perturbed_recombination;
/** Neutrino contribution to tensors */
enum tensor_methods tensor_method; /**< way to treat neutrinos in tensor perturbations(neglect, approximate as massless, take exact equations) */
short evolve_tensor_ur; /**< will we evolve ur tensor perturbations (either because we have ur species, or we have ncdm species with massless approximation) ? */
short evolve_tensor_ncdm; /**< will we evolve ncdm tensor perturbations (if we have ncdm species and we use the exact method) ? */
short has_cl_cmb_temperature; /**< do we need \f$ C_l \f$'s for CMB temperature? */
short has_cl_cmb_polarization; /**< do we need \f$ C_l \f$'s for CMB polarization? */
short has_cl_cmb_lensing_potential; /**< do we need \f$ C_l \f$'s for CMB lensing potential? */
short has_cl_lensing_potential; /**< do we need \f$ C_l \f$'s for galaxy lensing potential? */
short has_cl_number_count; /**< do we need \f$ C_l \f$'s for density number count? */
short has_pk_matter; /**< do we need matter Fourier spectrum? */
short has_density_transfers; /**< do we need to output individual matter density transfer functions? */
short has_velocity_transfers; /**< do we need to output individual matter velocity transfer functions? */
short has_metricpotential_transfers;/**< do we need to output individual transfer functions for scalar metric perturbations? */
short has_Nbody_gauge_transfers; /**< should we convert density and velocity transfer functions to Nbody gauge? */
short has_nl_corrections_based_on_delta_m; /**< do we want to compute non-linear corrections with an algorithm relying on delta_m (like halofit)? */
short has_nc_density; /**< in dCl, do we want density terms ? */
short has_nc_rsd; /**< in dCl, do we want redshift space distortion terms ? */
short has_nc_lens; /**< in dCl, do we want lensing terms ? */
short has_nc_gr; /**< in dCl, do we want gravity terms ? */
int l_scalar_max; /**< maximum l value for CMB scalars \f$ C_l \f$'s */
int l_vector_max; /**< maximum l value for CMB vectors \f$ C_l \f$'s */
int l_tensor_max; /**< maximum l value for CMB tensors \f$ C_l \f$'s */
int l_lss_max; /**< maximum l value for LSS \f$ C_l \f$'s (density and lensing potential in bins) */
double k_max_for_pk; /**< maximum value of k in 1/Mpc in P(k) (if \f$ C_l \f$'s also requested, overseeded by value kmax inferred from l_scalar_max if it is bigger) */
int selection_num; /**< number of selection functions
(i.e. bins) for matter density \f$ C_l \f$'s */
enum selection_type selection; /**< type of selection functions */
double selection_mean[_SELECTION_NUM_MAX_]; /**< centers of selection functions */
double selection_width[_SELECTION_NUM_MAX_]; /**< widths of selection functions */
int switch_sw; /**< in temperature calculation, do we want to include the intrinsic temperature + Sachs Wolfe term? */
int switch_eisw; /**< in temperature calculation, do we want to include the early integrated Sachs Wolfe term? */
int switch_lisw; /**< in temperature calculation, do we want to include the late integrated Sachs Wolfe term? */
int switch_dop; /**< in temperature calculation, do we want to include the Doppler term? */
int switch_pol; /**< in temperature calculation, do we want to include the polarization-related term? */
double eisw_lisw_split_z; /**< at which redshift do we define the cut between eisw and lisw ?*/
int store_perturbations; /**< Do we want to store perturbations? */
int k_output_values_num; /**< Number of perturbation outputs (default=0) */
double k_output_values[_MAX_NUMBER_OF_K_FILES_]; /**< List of k values where perturbation output is requested. */
double three_ceff2_ur;/**< 3 x effective squared sound speed for the ultrarelativistic perturbations */
double three_cvis2_ur;/**< 3 x effective viscosity parameter for the ultrarelativistic perturbations */
double z_max_pk; /**< when we compute only the matter spectrum / transfer functions, but not the CMB, we are sometimes interested to sample source functions at very high redshift, way before recombination. This z_max_pk will then fix the initial sampling time of the sources. */
double * alpha_idm_dr; /**< Angular contribution to collisional term at l>=2 for idm_fr-idr */
double * beta_idr; /**< Angular contribution to collisional term at l>=2 for idr-idr */
int idr_nature; /**< Nature of the interacting dark radiation (free streaming or fluid) */
//@}
/** @name - useful flags inferred from the ones above */
//@{
short has_cmb; /**< do we need CMB-related sources (temperature, polarization) ? */
short has_lss; /**< do we need LSS-related sources (lensing potential, ...) ? */
//@}
/** @name - gauge in which to perform the calculation */
//@{
enum possible_gauges gauge; /**< gauge in which to perform this calculation */
//@}
/** @name - indices running on modes (scalar, vector, tensor) */
//@{
int index_md_scalars; /**< index value for scalars */
int index_md_tensors; /**< index value for tensors */
int index_md_vectors; /**< index value for vectors */
int md_size; /**< number of modes included in computation */
//@}
/** @name - indices running on initial conditions (for scalars: ad, cdi, nid, niv; for tensors: only one) */
//@{
int index_ic_ad; /**< index value for adiabatic */
int index_ic_cdi; /**< index value for CDM isocurvature */
int index_ic_bi; /**< index value for baryon isocurvature */
int index_ic_nid; /**< index value for neutrino density isocurvature */
int index_ic_niv; /**< index value for neutrino velocity isocurvature */
int index_ic_ten; /**< index value for unique possibility for tensors */
int * ic_size; /**< for a given mode, ic_size[index_md] = number of initial conditions included in computation */
//@}
/** @name - flags and indices running on types (temperature, polarization, lensing, ...) */
//@{
short has_source_t; /**< do we need source for CMB temperature? */
short has_source_p; /**< do we need source for CMB polarization? */
short has_source_delta_m; /**< do we need source for delta of total matter? */
short has_source_delta_cb; /**< do we ALSO need source for delta of ONLY cdm and baryon? */
short has_source_delta_tot; /**< do we need source for delta total? */
short has_source_delta_g; /**< do we need source for delta of gammas? */
short has_source_delta_b; /**< do we need source for delta of baryons? */
short has_source_delta_cdm; /**< do we need source for delta of cold dark matter? */
short has_source_delta_idr; /**< do we need source for delta of interacting dark radiation? */
short has_source_delta_idm_dr;/**< do we need source for delta of interacting dark matter (with dr)? */
short has_source_delta_dcdm; /**< do we need source for delta of DCDM? */
short has_source_delta_fld; /**< do we need source for delta of dark energy? */
short has_source_delta_scf; /**< do we need source for delta from scalar field? */
short has_source_delta_dr; /**< do we need source for delta of decay radiation? */
short has_source_delta_ur; /**< do we need source for delta of ultra-relativistic neutrinos/relics? */
short has_source_delta_ncdm; /**< do we need source for delta of all non-cold dark matter species (e.g. massive neutrinos)? */
short has_source_theta_m; /**< do we need source for theta of total matter? */
short has_source_theta_cb; /**< do we ALSO need source for theta of ONLY cdm and baryon? */
short has_source_theta_tot; /**< do we need source for theta total? */
short has_source_theta_g; /**< do we need source for theta of gammas? */
short has_source_theta_b; /**< do we need source for theta of baryons? */
short has_source_theta_cdm; /**< do we need source for theta of cold dark matter? */
short has_source_theta_idr; /**< do we need source for theta of interacting dark radiation? */
short has_source_theta_idm_dr; /**< do we need source for theta of interacting dark matter (with dr)? */
short has_source_theta_dcdm; /**< do we need source for theta of DCDM? */
short has_source_theta_fld; /**< do we need source for theta of dark energy? */
short has_source_theta_scf; /**< do we need source for theta of scalar field? */
short has_source_theta_dr; /**< do we need source for theta of ultra-relativistic neutrinos/relics? */
short has_source_theta_ur; /**< do we need source for theta of ultra-relativistic neutrinos/relics? */
short has_source_theta_ncdm; /**< do we need source for theta of all non-cold dark matter species (e.g. massive neutrinos)? */
short has_source_phi; /**< do we need source for metric fluctuation phi? */
short has_source_phi_prime; /**< do we need source for metric fluctuation phi'? */
short has_source_phi_plus_psi; /**< do we need source for metric fluctuation (phi+psi)? */
short has_source_psi; /**< do we need source for metric fluctuation psi? */
short has_source_h; /**< do we need source for metric fluctuation h? */
short has_source_h_prime; /**< do we need source for metric fluctuation h'? */
short has_source_eta; /**< do we need source for metric fluctuation eta? */
short has_source_eta_prime; /**< do we need source for metric fluctuation eta'? */
short has_source_H_T_Nb_prime; /**< do we need source for metric fluctuation H_T_Nb'? */
short has_source_k2gamma_Nb; /**< do we need source for metric fluctuation gamma in Nbody gauge? */
/* remember that the temperature source function includes three
terms that we call 0,1,2 (since the strategy in class v > 1.7 is
to avoid the integration by part that would reduce the source to
a single term) */
int index_tp_t0; /**< index value for temperature (j=0 term) */
int index_tp_t1; /**< index value for temperature (j=1 term) */
int index_tp_t2; /**< index value for temperature (j=2 term) */
int index_tp_p; /**< index value for polarization */
int index_tp_delta_m; /**< index value for matter density fluctuation */
int index_tp_delta_cb; /**< index value for delta cb */
int index_tp_delta_tot; /**< index value for total density fluctuation */
int index_tp_delta_g; /**< index value for delta of gammas */
int index_tp_delta_b; /**< index value for delta of baryons */
int index_tp_delta_cdm; /**< index value for delta of cold dark matter */
int index_tp_delta_dcdm;/**< index value for delta of DCDM */
int index_tp_delta_fld; /**< index value for delta of dark energy */
int index_tp_delta_scf; /**< index value for delta of scalar field */
int index_tp_delta_dr; /**< index value for delta of decay radiation */
int index_tp_delta_ur; /**< index value for delta of ultra-relativistic neutrinos/relics */
int index_tp_delta_idr; /**< index value for delta of interacting dark radiation */
int index_tp_delta_idm_dr;/**< index value for delta of interacting dark matter (with dr)*/
int index_tp_delta_ncdm1; /**< index value for delta of first non-cold dark matter species (e.g. massive neutrinos) */
int index_tp_perturbed_recombination_delta_temp; /**< Gas temperature perturbation */
int index_tp_perturbed_recombination_delta_chi; /**< Inionization fraction perturbation */
int index_tp_theta_m; /**< index value for matter velocity fluctuation */
int index_tp_theta_cb; /**< index value for theta cb */
int index_tp_theta_tot; /**< index value for total velocity fluctuation */
int index_tp_theta_g; /**< index value for theta of gammas */
int index_tp_theta_b; /**< index value for theta of baryons */
int index_tp_theta_cdm; /**< index value for theta of cold dark matter */
int index_tp_theta_dcdm; /**< index value for theta of DCDM */
int index_tp_theta_fld; /**< index value for theta of dark energy */
int index_tp_theta_scf; /**< index value for theta of scalar field */
int index_tp_theta_ur; /**< index value for theta of ultra-relativistic neutrinos/relics */
int index_tp_theta_idr; /**< index value for theta of interacting dark radiation */
int index_tp_theta_idm_dr;/**< index value for theta of interacting dark matter (with dr)*/
int index_tp_theta_dr; /**< index value for F1 of decay radiation */
int index_tp_theta_ncdm1; /**< index value for theta of first non-cold dark matter species (e.g. massive neutrinos) */
int index_tp_phi; /**< index value for metric fluctuation phi */
int index_tp_phi_prime; /**< index value for metric fluctuation phi' */
int index_tp_phi_plus_psi; /**< index value for metric fluctuation phi+psi */
int index_tp_psi; /**< index value for metric fluctuation psi */
int index_tp_h; /**< index value for metric fluctuation h */
int index_tp_h_prime; /**< index value for metric fluctuation h' */
int index_tp_eta; /**< index value for metric fluctuation eta */
int index_tp_eta_prime; /**< index value for metric fluctuation eta' */
int index_tp_H_T_Nb_prime; /**< index value for metric fluctuation H_T_Nb' */
int index_tp_k2gamma_Nb; /**< index value for metric fluctuation gamma times k^2 in Nbody gauge */
int * tp_size; /**< number of types tp_size[index_md] included in computation for each mode */
//@}
/** @name - list of k values for each mode */
//@{
int * k_size_cmb; /**< k_size_cmb[index_md] number of k values used
for CMB calculations, requiring a fine
sampling in k-space */
int * k_size_cl; /**< k_size_cl[index_md] number of k values used
for non-CMB \f$ C_l \f$ calculations, requiring a coarse
sampling in k-space. */
int * k_size; /**< k_size[index_md] = total number of k
values, including those needed for P(k) but not
for \f$ C_l \f$'s */
double ** k; /**< k[index_md][index_k] = list of values */
double k_min; /**< minimum value (over all modes) */
double k_max; /**< maximum value (over all modes) */
//@}
/** @name - list of conformal time values in the source table
(common to all modes and types) */
//@{
double * tau_sampling; /**< array of tau values */
int tau_size; /**< number of values in this array */
double selection_min_of_tau_min; /**< used in presence of selection functions (for matter density, cosmic shear...) */
double selection_max_of_tau_max; /**< used in presence of selection functions (for matter density, cosmic shear...) */
double selection_delta_tau; /**< used in presence of selection functions (for matter density, cosmic shear...) */
double * selection_tau_min; /**< value of conformal time below which W(tau) is considered to vanish for each bin */
double * selection_tau_max; /**< value of conformal time above which W(tau) is considered to vanish for each bin */
double * selection_tau; /**< value of conformal time at the center of each bin */
double * selection_function; /**< selection function W(tau), normalized to \f$ \int W(tau) dtau=1 \f$, stored in selection_function[bin*ppt->tau_size+index_tau] */
//@}
/** @name - source functions interpolation table */
//@{
double *** sources; /**< Pointer towards the source interpolation table
sources[index_md]
[index_ic * ppt->tp_size[index_md] + index_tp]
[index_tau * ppt->k_size + index_k] */
//@}
/** @name - arrays related to the interpolation table for sources at late times, corresponding to z < z_max_pk (used for Fourier transfer function and spectra output) */
//@{
double * ln_tau; /**< log of the arrau tau_sampling, covering only the final time range required for the output of
Fourier transfer functions (used for interpolations) */
int ln_tau_size; /**< number of values in this array */
double *** late_sources; /**< Pointer towards the source interpolation table
late_sources[index_md]
[index_ic * ppt->tp_size[index_md] + index_tp]
[index_tau * ppt->k_size + index_k]
Note that this is not a replication of part of the sources table,
it is just poiting towards the same memory zone, at the place where the late_sources actually start */
double *** ddlate_sources; /**< Pointer towards the splined source interpolation table with second derivatives with respect to time
ddlate_sources[index_md]
[index_ic * ppt->tp_size[index_md] + index_tp]
[index_tau * ppt->k_size + index_k] */
//@}
/** @name - arrays storing the evolution of all sources for given k values, passed as k_output_values */
//@{
int * index_k_output_values; /**< List of indices corresponding to k-values close to k_output_values for each mode.
index_k_output_values[index_md*k_output_values_num+ik]*/
char scalar_titles[_MAXTITLESTRINGLENGTH_]; /**< _DELIMITER_ separated string of titles for scalar perturbation output files. */
char vector_titles[_MAXTITLESTRINGLENGTH_]; /**< _DELIMITER_ separated string of titles for vector perturbation output files. */
char tensor_titles[_MAXTITLESTRINGLENGTH_]; /**< _DELIMITER_ separated string of titles for tensor perturbation output files. */
int number_of_scalar_titles; /**< number of titles/columns in scalar perturbation output files */
int number_of_vector_titles; /**< number of titles/columns in vector perturbation output files*/
int number_of_tensor_titles; /**< number of titles/columns in tensor perturbation output files*/
double * scalar_perturbations_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of double pointers to perturbation output for scalars */
double * vector_perturbations_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of double pointers to perturbation output for vectors */
double * tensor_perturbations_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of double pointers to perturbation output for tensors */
int size_scalar_perturbation_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of sizes of scalar double pointers */
int size_vector_perturbation_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of sizes of vector double pointers */
int size_tensor_perturbation_data[_MAX_NUMBER_OF_K_FILES_]; /**< Array of sizes of tensor double pointers */
//@}
/** @name - technical parameters */
//@{
short perturbations_verbose; /**< flag regulating the amount of information sent to standard output (none if set to zero) */
ErrorMsg error_message; /**< zone for writing error messages */
//@}
};
/**
* Structure containing the indices and the values of the perturbation
* variables which are integrated over time (as well as their
* time-derivatives). For a given wavenumber, the size of these
* vectors changes when the approximation scheme changes.
*/
struct perturbations_vector
{
int index_pt_delta_g; /**< photon density */
int index_pt_theta_g; /**< photon velocity */
int index_pt_shear_g; /**< photon shear */
int index_pt_l3_g; /**< photon l=3 */
int l_max_g; /**< max momentum in Boltzmann hierarchy (at least 3) */
int index_pt_pol0_g; /**< photon polarization, l=0 */
int index_pt_pol1_g; /**< photon polarization, l=1 */
int index_pt_pol2_g; /**< photon polarization, l=2 */
int index_pt_pol3_g; /**< photon polarization, l=3 */
int l_max_pol_g; /**< max momentum in Boltzmann hierarchy (at least 3) */
int index_pt_delta_b; /**< baryon density */
int index_pt_theta_b; /**< baryon velocity */
int index_pt_delta_cdm; /**< cdm density */
int index_pt_theta_cdm; /**< cdm velocity */
int index_pt_delta_idm_dr;/**< idm_dr density */
int index_pt_theta_idm_dr;/**< idm_dr velocity */
int index_pt_delta_dcdm; /**< dcdm density */
int index_pt_theta_dcdm; /**< dcdm velocity */
int index_pt_delta_fld; /**< dark energy density in true fluid case */
int index_pt_theta_fld; /**< dark energy velocity in true fluid case */
int index_pt_Gamma_fld; /**< unique dark energy dynamical variable in PPF case */
int index_pt_phi_scf; /**< scalar field density */
int index_pt_phi_prime_scf; /**< scalar field velocity */
int index_pt_delta_ur; /**< density of ultra-relativistic neutrinos/relics */
int index_pt_theta_ur; /**< velocity of ultra-relativistic neutrinos/relics */
int index_pt_shear_ur; /**< shear of ultra-relativistic neutrinos/relics */
int index_pt_l3_ur; /**< l=3 of ultra-relativistic neutrinos/relics */
int l_max_ur; /**< max momentum in Boltzmann hierarchy (at least 3) */
int index_pt_delta_idr; /**< density of interacting dark radiation */
int index_pt_theta_idr; /**< velocity of interacting dark radiation */
int index_pt_shear_idr; /**< shear of interacting dark radiation */
int index_pt_l3_idr; /**< l=3 of interacting dark radiation */
int l_max_idr; /**< max momentum in Boltzmann hierarchy (at least 3) for interacting dark radiation */
/* perturbed recombination */
int index_pt_perturbed_recombination_delta_temp; /**< Gas temperature perturbation */
int index_pt_perturbed_recombination_delta_chi; /**< Inionization fraction perturbation */
/** The index to the first Legendre multipole of the DR expansion. Not
that this is not exactly the usual delta, see Kaplinghat et al.,
astro-ph/9907388. */
int index_pt_F0_dr;
int l_max_dr; /**< max momentum in Boltzmann hierarchy for dr) */
int index_pt_psi0_ncdm1; /**< first multipole of perturbation of first ncdm species, Psi_0 */
int N_ncdm; /**< number of distinct non-cold-dark-matter (ncdm) species */
int* l_max_ncdm; /**< mutipole l at which Boltzmann hierarchy is truncated (for each ncdm species) */
int* q_size_ncdm; /**< number of discrete momenta (for each ncdm species) */
int index_pt_eta; /**< synchronous gauge metric perturbation eta*/
int index_pt_phi; /**< newtonian gauge metric perturbation phi */
int index_pt_hv_prime; /**< vector metric perturbation h_v' in synchronous gauge */
int index_pt_V; /**< vector metric perturbation V in Newtonian gauge */
int index_pt_gw; /**< tensor metric perturbation h (gravitational waves) */
int index_pt_gwdot; /**< its time-derivative */
int pt_size; /**< size of perturbation vector */
double * y; /**< vector of perturbations to be integrated */
double * dy; /**< time-derivative of the same vector */
int * used_in_sources; /**< boolean array specifying which
perturbations enter in the calculation of
source functions */
};
/**
* Workspace containing, among other things, the value at a given time
* of all background/perturbed quantities, as well as their indices.
* There will be one such structure created for each mode
* (scalar/.../tensor) and each thread (in case of parallel computing)
*/
struct perturbations_workspace
{
/** @name - all possible useful indices for those metric
perturbations which are not integrated over time, but just
inferred from Einstein equations. "_mt_" stands for "metric".*/
//@{
int index_mt_psi; /**< psi in longitudinal gauge */
int index_mt_phi_prime; /**< (d phi/d conf.time) in longitudinal gauge */
int index_mt_h_prime; /**< h' (wrt conf. time) in synchronous gauge */
int index_mt_h_prime_prime; /**< h'' (wrt conf. time) in synchronous gauge */
int index_mt_eta_prime; /**< eta' (wrt conf. time) in synchronous gauge */
int index_mt_alpha; /**< \f$ \alpha = (h' + 6 \eta') / (2 k^2) \f$ in synchronous gauge */
int index_mt_alpha_prime; /**< \f$ \alpha'\f$ wrt conf. time) in synchronous gauge */
int index_mt_gw_prime_prime;/**< second derivative wrt conformal time of gravitational wave field, often called h */
int index_mt_V_prime; /**< derivative of Newtonian gauge vector metric perturbation V */
int index_mt_hv_prime_prime;/**< Second derivative of Synchronous gauge vector metric perturbation \f$ h_v\f$ */
int mt_size; /**< size of metric perturbation vector */
//@}
/** @name - value at a given time of all background/perturbed
quantities
*/
//@{
double * pvecback; /**< background quantities */
double * pvecthermo; /**< thermodynamics quantities */
double * pvecmetric; /**< metric quantities */
struct perturbations_vector * pv; /**< pointer to vector of integrated
perturbations and their
time-derivatives */
double delta_rho; /**< total density perturbation (gives delta Too) */
double rho_plus_p_theta; /**< total (rho+p)*theta perturbation (gives delta Toi) */
double rho_plus_p_shear; /**< total (rho+p)*shear (gives delta Tij) */
double delta_p; /**< total pressure perturbation (gives Tii) */
double rho_plus_p_tot; /**< total (rho+p) (used to infer theta_tot from rho_plus_p_theta) */
double gw_source; /**< stress-energy source term in Einstein's tensor equations (gives Tij[tensor]) */
double vector_source_pi; /**< first stress-energy source term in Einstein's vector equations */
double vector_source_v; /**< second stress-energy source term in Einstein's vector equations */
double tca_shear_g; /**< photon shear in tight-coupling approximation */
double tca_slip; /**< photon-baryon slip in tight-coupling approximation */
double tca_shear_idm_dr;/**< interacting dark radiation shear in tight coupling appproximation */
double rsa_delta_g; /**< photon density in radiation streaming approximation */
double rsa_theta_g; /**< photon velocity in radiation streaming approximation */
double rsa_delta_ur; /**< photon density in radiation streaming approximation */
double rsa_theta_ur; /**< photon velocity in radiation streaming approximation */
double rsa_delta_idr; /**< interacting dark radiation density in dark radiation streaming approximation */
double rsa_theta_idr; /**< interacting dark radiation velocity in dark radiation streaming approximation */
double * delta_ncdm; /**< relative density perturbation of each ncdm species */
double * theta_ncdm; /**< velocity divergence theta of each ncdm species */
double * shear_ncdm; /**< shear for each ncdm species */
double delta_m; /**< relative density perturbation of all non-relativistic species */
double theta_m; /**< velocity divergence theta of all non-relativistic species */
double delta_cb; /**< relative density perturbation of only cdm and baryon */
double theta_cb; /**< velocity divergence theta of only cdm and baryon */
double delta_rho_fld; /**< density perturbation of fluid, not so trivial in PPF scheme */
double delta_p_fld; /**< pressure perturbation of fluid, very non-trivial in PPF scheme */
double rho_plus_p_theta_fld; /**< velocity divergence of fluid, not so trivial in PPF scheme */
double S_fld; /**< S quantity sourcing Gamma_prime evolution in PPF scheme (equivalent to eq. 15 in 0808.3125) */
double Gamma_prime_fld; /**< Gamma_prime in PPF scheme (equivalent to eq. 14 in 0808.3125) */
FILE * perturbations_output_file; /**< filepointer to output file*/
int index_ikout; /**< index for output k value (when k_output_values is set) */
//@}
/** @name - indices useful for searching background/thermo quantities in tables */
//@{
short inter_mode; /**< flag defining the method used for interpolation background/thermo quantities tables */
int last_index_back; /**< the background interpolation function background_at_tau() keeps memory of the last point called through this index */
int last_index_thermo; /**< the thermodynamics interpolation function thermodynamics_at_z() keeps memory of the last point called through this index */
//@}
/** @name - approximations used at a given time */
//@{
int index_ap_tca; /**< index for tight-coupling approximation */
int index_ap_rsa; /**< index for radiation streaming approximation */
int index_ap_tca_idm_dr; /**< index for dark tight-coupling approximation (idm-idr) */
int index_ap_rsa_idr; /**< index for dark radiation streaming approximation */
int index_ap_ufa; /**< index for ur fluid approximation */
int index_ap_ncdmfa; /**< index for ncdm fluid approximation */
int ap_size; /**< number of relevant approximations for a given mode */
int * approx; /**< array of approximation flags holding at a given time: approx[index_ap] */
//@}
/** @name - approximations used at a given time */
//@{
int max_l_max; /**< maximum l_max for any multipole */
double * s_l; /**< array of freestreaming coefficients \f$ s_l = \sqrt{1-K*(l^2-1)/k^2} \f$*/
//@}
};
/**
* Structure pointing towards all what the function that perturbations_derivs
* needs to know: fixed input parameters and indices contained in the
* various structures, workspace, etc.
*/
struct perturbations_parameters_and_workspace {
struct precision * ppr; /**< pointer to the precision structure */
struct background * pba; /**< pointer to the background structure */
struct thermodynamics * pth; /**< pointer to the thermodynamics structure */
struct perturbations * ppt; /**< pointer to the precision structure */
int index_md; /**< index of mode (scalar/.../vector/tensor) */
int index_ic; /**< index of initial condition (adiabatic/isocurvature(s)/...) */
int index_k; /**< index of wavenumber */
double k; /**< current value of wavenumber in 1/Mpc */
struct perturbations_workspace * ppw; /**< workspace defined above */
};
/*************************************************************************************************************/
/* @cond INCLUDE_WITH_DOXYGEN */
/*
* Boilerplate for C++
*/
#ifdef __cplusplus
extern "C" {
#endif
int perturbations_sources_at_tau(
struct perturbations * ppt,
int index_md,
int index_ic,
int index_tp,
double tau,
double * psource_at_tau
);
int perturbations_sources_at_z(
struct background * pba,
struct perturbations * ppt,
int index_md,
int index_ic,
int index_tp,
double z,
double * psource_at_z
);
int perturbations_sources_at_k_and_z(
struct background * pba,
struct perturbations * ppt,
int index_md,
int index_ic,
int index_tp,
double k,
double z,
double * psource_at_k_and_z
);
int perturbations_output_data(
struct background * pba,
struct perturbations * ppt,
enum file_format output_format,
double z,
int number_of_titles,
double *data
);
int perturbations_output_titles(
struct background *pba,
struct perturbations *ppt,
enum file_format output_format,
char titles[_MAXTITLESTRINGLENGTH_]
);
int perturbations_output_firstline_and_ic_suffix(
struct perturbations *ppt,
int index_ic,
char first_line[_LINE_LENGTH_MAX_],
char ic_suffix[_SUFFIXNAMESIZE_]
);
int perturbations_init(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt
);
int perturbations_free_input(
struct perturbations * ppt
);
int perturbations_free(
struct perturbations * ppt
);
int perturbations_indices(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt
);
int perturbations_timesampling_for_sources(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt
);
int perturbations_get_k_list(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt
);
int perturbations_workspace_init(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
struct perturbations_workspace * ppw
);
int perturbations_workspace_free(
struct perturbations * ppt,
int index_md,
struct perturbations_workspace * ppw
);
int perturbations_solve(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
int index_ic,
int index_k,
struct perturbations_workspace * ppw
);
int perturbations_prepare_k_output(
struct background * pba,
struct perturbations * ppt
);
int perturbations_find_approximation_number(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
double k,
struct perturbations_workspace * ppw,
double tau_ini,
double tau_end,
int * interval_number,
int * interval_number_of
);
int perturbations_find_approximation_switches(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
double k,
struct perturbations_workspace * ppw,
double tau_ini,
double tau_end,
double precision,
int interval_number,
int * interval_number_of,
double * interval_limit,
int ** interval_approx
);
int perturbations_vector_init(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
int index_ic,
double k,
double tau,
struct perturbations_workspace * ppw,
int * pa_old
);
int perturbations_vector_free(
struct perturbations_vector * pv
);
int perturbations_initial_conditions(
struct precision * ppr,
struct background * pba,
struct perturbations * ppt,
int index_md,
int index_ic,
double k,
double tau,
struct perturbations_workspace * ppw
);
int perturbations_approximations(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
double k,
double tau,
struct perturbations_workspace * ppw
);
int perturbations_timescale(
double tau,
void * parameters_and_workspace,
double * timescale,
ErrorMsg error_message
);
int perturbations_einstein(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
double k,
double tau,
double * y,
struct perturbations_workspace * ppw
);
int perturbations_total_stress_energy(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
int index_md,
double k,
double * y,
struct perturbations_workspace * ppw
);
int perturbations_sources(
double tau,
double * pvecperturbations,
double * pvecderivs,
int index_tau,
void * parameters_and_workspace,
ErrorMsg error_message
);
int perturbations_print_variables(
double tau,
double * y,
double * dy,
void * parameters_and_workspace,
ErrorMsg error_message
);
int perturbations_derivs(
double tau,
double * y,
double * dy,
void * parameters_and_workspace,
ErrorMsg error_message
);
int perturbations_tca_slip_and_shear(
double * y,
void * parameters_and_workspace,
ErrorMsg error_message
);
int perturbations_rsa_delta_and_theta(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
double k,
double * y,
double a_prime_over_a,
double * pvecthermo,
struct perturbations_workspace * ppw,
ErrorMsg error_message
);
int perturbations_rsa_idr_delta_and_theta(
struct precision * ppr,
struct background * pba,
struct thermodynamics * pth,
struct perturbations * ppt,
double k,
double * y,
double a_prime_over_a,
double * pvecthermo,
struct perturbations_workspace * ppw,
ErrorMsg error_message
);
#ifdef __cplusplus
}
#endif
/**************************************************************/
#endif
/* @endcond */
| 48.888655 | 280 | 0.600576 | [
"vector"
] |
8b795b6522952a78275d5ead05f24331286487c8 | 10,061 | h | C | include/graptor/dsl/ast/dfsaop.h | hvdieren/graptor | f5fdb2e0990a925d4136f1f43780e4efc2290633 | [
"MIT"
] | 2 | 2021-11-26T16:14:09.000Z | 2021-12-10T11:15:16.000Z | include/graptor/dsl/ast/dfsaop.h | hvdieren/graptor | f5fdb2e0990a925d4136f1f43780e4efc2290633 | [
"MIT"
] | null | null | null | include/graptor/dsl/ast/dfsaop.h | hvdieren/graptor | f5fdb2e0990a925d4136f1f43780e4efc2290633 | [
"MIT"
] | null | null | null | // -*- c++ -*-
#ifndef GRAPTOR_DSL_AST_DFSAOP_H
#define GRAPTOR_DSL_AST_DFSAOP_H
#include "graptor/simd/ops.h"
#include "graptor/dsl/aval.h"
namespace expr {
/* dfsaop
* A ternary operation.
*/
template<typename S, typename U, typename C, typename DFSAOp>
struct dfsaop : public expr_base {
static_assert( S::VL == U::VL && U::VL == C::VL,
"vector lengths must match" );
using data_type = typename DFSAOp::template types<S,U,C>::result_type;
using type = typename data_type::member_type;
static constexpr unsigned short VL = S::VL;
using state_type = S;
using update_type = U;
using condition_type = C;
using op_type = DFSAOp;
static constexpr op_codes opcode = op_dfsaop;
dfsaop( state_type state, update_type update, condition_type condition,
DFSAOp )
: m_state( state ), m_update( update ), m_condition( condition ) { }
state_type state() const { return m_state; }
update_type update() const { return m_update; }
condition_type condition() const { return m_condition; }
private:
state_type m_state;
update_type m_update;
condition_type m_condition;
};
template<typename S, typename U, typename C, typename DFSAOp>
dfsaop<S,U,C,DFSAOp> make_dfsaop( S state, U update, C condition, DFSAOp op ) {
return dfsaop<S,U,C,DFSAOp>( state, update, condition, op );
}
/* dfsaop: Maximum Independent Set (application-specific)
*/
struct dfsaop_MIS {
// Relation determining new value of d:
// d\s ud ci in ou
// ud *d *d ou *d
// ci ud ud ou *d -- set ud only if d < s ...
// in *d *d ou *d
// ou *d *d *d *d
// *d: keep d as it was
enum mis_state_t {
mis_undecided = 0,
mis_conditionally_in = 1,
mis_out = 2,
mis_in = 3
};
template<typename S, typename U, typename C>
struct types {
using result_type = typename S::data_type::prefmask_traits;
};
static constexpr char const * name = "dfsaop_MIS";
template<typename VTr, layout_t Layout1, layout_t Layout2,
typename MTr, layout_t Layout3,
typename MPack>
static auto evaluate(
sb::rvalue<VTr,Layout1> s,
sb::rvalue<VTr,Layout2> u,
sb::rvalue<MTr,Layout3> c,
const MPack & mpack ) {
static_assert( VTr::VL == MTr::VL, "vector length match" );
static_assert( simd::detail::is_mask_traits_v<MTr>,
"c argument must be a mask" );
simd::detail::vec<VTr,simd::lo_unknown> r
= eval( s.value(), u.value(), c.value() );
return make_rvalue( r, mpack );
}
template<typename VTr, layout_t Layout1, layout_t Layout2,
typename MTr, layout_t Layout3,
typename I, typename Enc, bool NT, typename MPack>
static auto
evaluate( sb::lvalue<VTr,I,Enc,NT,Layout1> s,
sb::rvalue<VTr,Layout2> u,
sb::rvalue<MTr,Layout3> c,
const MPack & mpack ) {
static_assert( VTr::VL == MTr::VL, "vector length match" );
static_assert( simd::detail::is_mask_traits_v<MTr>,
"c argument must be a mask" );
auto mpack2 = mpack.template clone_and_add<MTr>();
auto upd = mpack2.template get_mask<MTr>();
simd::detail::vector_ref_impl<VTr,I,Enc,NT,Layout1> sref = s.value();
simd::vec<VTr,simd::lo_unknown> sval = sref.load( upd );
simd::vec<VTr,simd::lo_unknown> r = eval( sval, u.value(), c.value() );
sref.store( r, upd );
return make_rvalue( sval != r, mpack2 );
}
// used as a ternop (returns value like storeop and also update mask)
template<typename VTr, layout_t Layout1, typename MTr1,
typename MTr2, layout_t Layout2, typename MTr3, layout_t Layout3>
static auto evaluate(
rvalue<VTr,Layout1,MTr1> s, rvalue<VTr,Layout2,MTr2> u, rvalue<void,Layout3,MTr3> c,
std::enable_if_t<simd::matchVL<VTr,MTr1,MTr2,MTr3>::value> *
= nullptr ) {
simd::detail::vector_impl<VTr> r = eval( s.value(), u.value(), c.mask() );
return make_rvalue( r, s.mask() & u.mask() );
}
// used as dfsaop (similar to redop: return update mask, no value)
template<typename VTr, typename I, typename MTr1,
layout_t LayoutR, layout_t Layout2, typename MTr2,
layout_t Layout3, typename MTr3, typename Enc, bool NT>
static auto evaluate(
lvalue<VTr,I,MTr1,Enc,NT,LayoutR> s, rvalue<VTr,Layout2,MTr2> u, rvalue<void,Layout3,MTr3> c,
std::enable_if_t<simd::matchVL<VTr,MTr1,MTr2,MTr3>::value> *
= nullptr ) {
auto upd = s.mask() & u.mask();
simd::detail::vector_ref_impl<VTr,I,Enc,NT,LayoutR> sref = s.value();
simd::vec<VTr,simd::lo_unknown> sval = sref.load( upd );
simd::vec<VTr,simd::lo_unknown> r = eval( sval, u.value(), c.mask() );
sref.store( r, upd );
if constexpr ( std::is_void_v<MTr1> && std::is_void_v<MTr2> ) {
using Tr = typename VTr::prefmask_traits;
return make_rvalue( simd::detail::vector_impl<Tr>::true_mask() );
} else {
return make_rvalue( upd );
}
}
template<typename VTr, typename MTr1,
layout_t LayoutR, layout_t Layout2, typename MTr2,
layout_t Layout3, typename MTr3,
typename I, typename Enc, bool NT>
static GG_INLINE auto
evaluate_atomic( lvalue<VTr,I,MTr1,Enc,NT,LayoutR> s, rvalue<VTr,Layout2,MTr2> u,
rvalue<void,Layout3,MTr3> c,
std::enable_if_t<simd::matchVL<VTr,MTr1,MTr2>::value> *
= nullptr ) {
simd::detail::vector_impl<VTr> r, sval;
simd::detail::vector_ref_impl<VTr,I,Enc,NT,LayoutR> sref = s.value();
auto upd = s.mask() & u.mask();
if( upd.data() ) {
do {
sval = sref.load();
r = eval( sval, u.value(), c.mask() );
} while( ( r != sval ).data() && !sref.cas( sval, r ) );
return make_rvalue( r != sval );
} else
return make_rvalue( upd );
}
template<typename VTr, typename I, typename MTr, typename Enc, bool NT,
layout_t LayoutR,
layout_t Layout2,
layout_t Layout3,
typename MPack>
static auto
evaluate_atomic( sb::lvalue<VTr,I,Enc,NT,LayoutR> s,
sb::rvalue<VTr,Layout2> u,
sb::rvalue<MTr,Layout3> c,
const MPack & mpack ) {
simd::detail::vector_impl<VTr> r, sval;
simd::detail::vector_ref_impl<VTr,I,Enc,NT,LayoutR> sref = s.value();
auto upd = mpack.template get_any<simd::detail::mask_bool_traits>();
if( upd.data() ) {
do {
sval = sref.load();
r = eval( sval, u.value(), c.value() );
} while( ( r != sval ).data() && !sref.cas( sval, r ) );
return make_rvalue( r != sval );
} else
return make_rvalue( upd );
}
private:
template<typename VTr, typename MTr, layout_t Layout1, layout_t Layout2>
static simd::vec<VTr,simd::lo_unknown> eval(
simd::vec<VTr,Layout1> sval,
simd::vec<VTr,Layout2> uval,
simd::detail::mask_impl<MTr> c,
std::enable_if_t<simd::matchVL<VTr,MTr>::value> * = nullptr ) {
using Vec = simd::vec<VTr,simd::lo_unknown>;
using Scalar = typename VTr::member_type;
Vec u_in( (Scalar)mis_in );
Vec s_conditionally_in( (Scalar)mis_conditionally_in );
Vec s_undecided( (Scalar)mis_undecided );
Vec s_out( (Scalar)mis_out );
// Optimisation: uval < s_out is inefficient in 2-bit vectors that
// return 2-bit logical masks. Replace by tweaked instruction sequence
// Instruction sequence only works for vectorised bitfield<2>, not in
// scalar case (e.g., sparse)
if constexpr ( VTr::B == 2 && VTr::VL > 1 ) {
// Version seems to be incorrect.
Vec nval =
::iif( uval == u_in,
// false case: flags[s] != IN
::iif( join_mask<VTr>(
join_mask<VTr>( c,
sval == s_conditionally_in ),
(~uval).asmask() ), // flips top bit, becomes mask
// false case: no-op
sval,
// true case:
s_undecided ),
// true case: flags[s] == IN
s_out );
return nval;
} else {
Vec nval =
::iif( uval == u_in,
// false case: flags[s] != IN
::iif( join_mask<VTr>(
join_mask<VTr>( c,
sval == s_conditionally_in ),
uval < s_out ),
// false case: no-op
sval,
// true case:
s_undecided ),
// true case: flags[s] == IN
s_out );
return nval;
}
}
public:
// used as a redop
template<typename VTr, layout_t Layout>
static auto evaluate1( rvalue<VTr,Layout,void> v ) {
// *** THIS DEPENDS ON THE NUMERIC VALUES OF THE ENUM ***
// If any lane is out, we're out
// Else, if any lane is in, we're in
// Else, if any lane is undecided, we're undecided
// Else, if any lane is conditionally_in, we're in
// So we're looking for a maximum with in/out inverted
// Do a trick: flip lowest bit, then do maximum.
// This avoids iterating over (potentially) many lanes.
simd::detail::vector_impl<VTr> flip =
simd::detail::vector_impl<VTr>::one_val();
using VTr1 = typename VTr::template rebindVL<1>::type;
simd::detail::vector_impl<VTr1> v1 = reduce_max( v.value() ^ flip );
return make_rvalue(
simd::detail::vector_impl<VTr1>( v1.data() ^ 1 ) ); // scalar ^
}
template<typename VTr, layout_t Layout, typename MTr>
static auto
evaluate1( rvalue<VTr,Layout,MTr> v,
std::enable_if_t<!std::is_void<MTr>::value> * = nullptr ) {
// As above, now with mask
simd::detail::vector_impl<VTr> flip =
simd::detail::vector_impl<VTr>::one_val();
using VTr1 = typename VTr::template rebindVL<1>::type;
simd::detail::vector_impl<VTr1> v1
= reduce_max( v.value() ^ flip, v.mask() );
return make_rvalue(
simd::detail::vector_impl<VTr1>( v1.data() ^ 1 ), // scalar ^
reduce_logicalor( v.mask() ) );
}
};
template<typename S, typename U, typename C, typename DFSAOp>
static constexpr
std::enable_if_t<std::is_base_of<expr_base,S>::value
&& std::is_base_of<expr_base,U>::value
&& std::is_base_of<expr_base,C>::value,
dfsaop<S,U,C,DFSAOp>>
make_dfsaop( S state, U update, C condition ) {
return dfsaop<S,U,C,DFSAOp>( state, update, condition, DFSAOp() );
}
template<typename S, typename U, typename C>
static constexpr dfsaop<S,U,C,dfsaop_MIS>
make_dfsaop_MIS( S state, U update, C condition ) {
return make_dfsaop( state, update, condition, dfsaop_MIS() );
}
} // namespace expr
#endif // GRAPTOR_DSL_AST_DFSAOP_H
| 34.337884 | 94 | 0.64755 | [
"vector"
] |
8b7a300c87cc4485181449014e1d6db6eb0e2160 | 2,644 | h | C | lock.h | damodar123/pythia-core | 6b90aafed40aa63185105a652b20c61fc5a4320d | [
"BSD-3-Clause"
] | 14 | 2015-01-25T19:11:49.000Z | 2021-08-24T18:48:37.000Z | lock.h | damodar123/pythia-core | 6b90aafed40aa63185105a652b20c61fc5a4320d | [
"BSD-3-Clause"
] | null | null | null | lock.h | damodar123/pythia-core | 6b90aafed40aa63185105a652b20c61fc5a4320d | [
"BSD-3-Clause"
] | 8 | 2015-03-16T20:08:53.000Z | 2020-09-14T02:39:48.000Z | /*
* Copyright 2009, Pythia authors (see AUTHORS file).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of 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 __MYLOCK__
#define __MYLOCK__
/**
* Non-recursive spinlock. Using `xchg` and `ldstub` as in PostgresSQL.
*/
class Lock {
public:
Lock() : _l(0) { }
/** Call blocks and retunrs only when it has the lock. */
inline void lock()
{
while(tas(&_l)) {
#if defined(__i386__) || defined(__x86_64__)
__asm__ __volatile__ ("pause\n");
#endif
}
}
/** Unlocks the lock object. */
inline void unlock()
{
_l = 0;
}
/** Resets lock, guaranteed to be called non-concurrently. */
inline void reset()
{
unlock();
}
private:
inline int tas(volatile char* lock)
{
register char res = 1;
#if defined(__i386__) || defined(__x86_64__)
__asm__ __volatile__ (
"lock xchgb %0, %1\n"
: "+q"(res), "+m"(*lock)
:
: "memory", "cc");
#elif defined(__sparc__)
__asm__ __volatile__ (
"ldstub [%2], %0"
: "=r"(res), "+m"(*lock)
: "r"(lock)
: "memory");
#else
#error TAS not defined for this architecture.
#endif
return res;
}
volatile char _l;
};
#endif
| 28.12766 | 71 | 0.696293 | [
"object"
] |
8b7ab84358ce41d1e5708f730957b7b38d5f62d9 | 106,093 | h | C | arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2_v2/inc/hw_aux_sysif.h | wodishenga/zizuwang | 7f579202c2457d5973eab1219151756ddd39c5ec | [
"BSD-3-Clause"
] | 7 | 2018-09-14T13:14:57.000Z | 2022-01-17T15:58:21.000Z | arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2_v2/inc/hw_aux_sysif.h | wodishenga/zizuwang | 7f579202c2457d5973eab1219151756ddd39c5ec | [
"BSD-3-Clause"
] | 2 | 2018-11-23T02:45:17.000Z | 2020-09-28T14:14:02.000Z | arch/cpu/simplelink-cc13xx-cc26xx/lib/coresdk_cc13xx_cc26xx/source/ti/devices/cc13x2_cc26x2_v2/inc/hw_aux_sysif.h | wodishenga/zizuwang | 7f579202c2457d5973eab1219151756ddd39c5ec | [
"BSD-3-Clause"
] | 8 | 2019-05-29T07:32:25.000Z | 2021-07-06T14:54:58.000Z | /******************************************************************************
* Filename: hw_aux_sysif_h
* Revised: 2018-05-14 12:24:52 +0200 (Mon, 14 May 2018)
* Revision: 51990
*
* Copyright (c) 2015 - 2017, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1) Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2) Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3) Neither the name of the ORGANIZATION 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 __HW_AUX_SYSIF_H__
#define __HW_AUX_SYSIF_H__
//*****************************************************************************
//
// This section defines the register offsets of
// AUX_SYSIF component
//
//*****************************************************************************
// Operational Mode Request
#define AUX_SYSIF_O_OPMODEREQ 0x00000000
// Operational Mode Acknowledgement
#define AUX_SYSIF_O_OPMODEACK 0x00000004
// Programmable Wakeup 0 Configuration
#define AUX_SYSIF_O_PROGWU0CFG 0x00000008
// Programmable Wakeup 1 Configuration
#define AUX_SYSIF_O_PROGWU1CFG 0x0000000C
// Programmable Wakeup 2 Configuration
#define AUX_SYSIF_O_PROGWU2CFG 0x00000010
// Programmable Wakeup 3 Configuration
#define AUX_SYSIF_O_PROGWU3CFG 0x00000014
// Software Wakeup Triggers
#define AUX_SYSIF_O_SWWUTRIG 0x00000018
// Wakeup Flags
#define AUX_SYSIF_O_WUFLAGS 0x0000001C
// Wakeup Flags Clear
#define AUX_SYSIF_O_WUFLAGSCLR 0x00000020
// Wakeup Gate
#define AUX_SYSIF_O_WUGATE 0x00000024
// Vector Configuration 0
#define AUX_SYSIF_O_VECCFG0 0x00000028
// Vector Configuration 1
#define AUX_SYSIF_O_VECCFG1 0x0000002C
// Vector Configuration 2
#define AUX_SYSIF_O_VECCFG2 0x00000030
// Vector Configuration 3
#define AUX_SYSIF_O_VECCFG3 0x00000034
// Vector Configuration 4
#define AUX_SYSIF_O_VECCFG4 0x00000038
// Vector Configuration 5
#define AUX_SYSIF_O_VECCFG5 0x0000003C
// Vector Configuration 6
#define AUX_SYSIF_O_VECCFG6 0x00000040
// Vector Configuration 7
#define AUX_SYSIF_O_VECCFG7 0x00000044
// Event Synchronization Rate
#define AUX_SYSIF_O_EVSYNCRATE 0x00000048
// Peripheral Operational Rate
#define AUX_SYSIF_O_PEROPRATE 0x0000004C
// ADC Clock Control
#define AUX_SYSIF_O_ADCCLKCTL 0x00000050
// TDC Counter Clock Control
#define AUX_SYSIF_O_TDCCLKCTL 0x00000054
// TDC Reference Clock Control
#define AUX_SYSIF_O_TDCREFCLKCTL 0x00000058
// AUX_TIMER2 Clock Control
#define AUX_SYSIF_O_TIMER2CLKCTL 0x0000005C
// AUX_TIMER2 Clock Status
#define AUX_SYSIF_O_TIMER2CLKSTAT 0x00000060
// AUX_TIMER2 Clock Switch
#define AUX_SYSIF_O_TIMER2CLKSWITCH 0x00000064
// AUX_TIMER2 Debug Control
#define AUX_SYSIF_O_TIMER2DBGCTL 0x00000068
// Clock Shift Detection
#define AUX_SYSIF_O_CLKSHIFTDET 0x00000070
// VDDR Recharge Trigger
#define AUX_SYSIF_O_RECHARGETRIG 0x00000074
// VDDR Recharge Detection
#define AUX_SYSIF_O_RECHARGEDET 0x00000078
// Real Time Counter Sub Second Increment 0
#define AUX_SYSIF_O_RTCSUBSECINC0 0x0000007C
// Real Time Counter Sub Second Increment 1
#define AUX_SYSIF_O_RTCSUBSECINC1 0x00000080
// Real Time Counter Sub Second Increment Control
#define AUX_SYSIF_O_RTCSUBSECINCCTL 0x00000084
// Real Time Counter Second
#define AUX_SYSIF_O_RTCSEC 0x00000088
// Real Time Counter Sub-Second
#define AUX_SYSIF_O_RTCSUBSEC 0x0000008C
// AON_RTC Event Clear
#define AUX_SYSIF_O_RTCEVCLR 0x00000090
// AON_BATMON Battery Voltage Value
#define AUX_SYSIF_O_BATMONBAT 0x00000094
// AON_BATMON Temperature Value
#define AUX_SYSIF_O_BATMONTEMP 0x0000009C
// Timer Halt
#define AUX_SYSIF_O_TIMERHALT 0x000000A0
// AUX_TIMER2 Bridge
#define AUX_SYSIF_O_TIMER2BRIDGE 0x000000B0
// Software Power Profiler
#define AUX_SYSIF_O_SWPWRPROF 0x000000B4
//*****************************************************************************
//
// Register: AUX_SYSIF_O_OPMODEREQ
//
//*****************************************************************************
// Field: [1:0] REQ
//
// AUX operational mode request.
// ENUMs:
// PDLP Powerdown operational mode with wakeup to lowpower
// mode, characterized by:
// - Powerdown system power
// supply state (uLDO) request.
// -
// AON_PMCTL:AUXSCECLK.PD_SRC sets the SCE clock
// frequency (SCE_RATE).
// - An active wakeup flag
// overrides the operational mode externally to
// lowpower (LP) as long as the flag is set.
// PDA Powerdown operational mode with wakeup to active
// mode, characterized by:
// - Powerdown system power
// supply state (uLDO) request.
// -
// AON_PMCTL:AUXSCECLK.PD_SRC sets the SCE clock
// frequency (SCE_RATE).
// - An active wakeup flag
// overrides the operational mode externally to
// active (A) as long as the flag is set.
// LP Lowpower operational mode, characterized by:
// - Powerdown system power
// supply state (uLDO) request.
// - SCE clock frequency
// (SCE_RATE) equals SCLK_MF.
// - An active wakeup flag
// does not change operational mode.
// A Active operational mode, characterized by:
// - Active system power
// supply state (GLDO or DCDC) request.
// - AON_PMCTL:AUXSCECLK.SRC
// sets the SCE clock frequency (SCE_RATE).
// - An active wakeup flag
// does not change operational mode.
#define AUX_SYSIF_OPMODEREQ_REQ_W 2
#define AUX_SYSIF_OPMODEREQ_REQ_M 0x00000003
#define AUX_SYSIF_OPMODEREQ_REQ_S 0
#define AUX_SYSIF_OPMODEREQ_REQ_PDLP 0x00000003
#define AUX_SYSIF_OPMODEREQ_REQ_PDA 0x00000002
#define AUX_SYSIF_OPMODEREQ_REQ_LP 0x00000001
#define AUX_SYSIF_OPMODEREQ_REQ_A 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_OPMODEACK
//
//*****************************************************************************
// Field: [1:0] ACK
//
// AUX operational mode acknowledgement.
// ENUMs:
// PDLP Powerdown operational mode with wakeup to lowpower
// mode is acknowledged.
// PDA Powerdown operational mode with wakeup to active
// mode is acknowledged.
// LP Lowpower operational mode is acknowledged.
// A Active operational mode is acknowledged.
#define AUX_SYSIF_OPMODEACK_ACK_W 2
#define AUX_SYSIF_OPMODEACK_ACK_M 0x00000003
#define AUX_SYSIF_OPMODEACK_ACK_S 0
#define AUX_SYSIF_OPMODEACK_ACK_PDLP 0x00000003
#define AUX_SYSIF_OPMODEACK_ACK_PDA 0x00000002
#define AUX_SYSIF_OPMODEACK_ACK_LP 0x00000001
#define AUX_SYSIF_OPMODEACK_ACK_A 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_PROGWU0CFG
//
//*****************************************************************************
// Field: [7] POL
//
// Polarity of WU_SRC.
//
// The procedure used to clear the wakeup flag decides level or edge
// sensitivity, see WUFLAGSCLR.PROG_WU0.
// ENUMs:
// LOW The wakeup flag is set when WU_SRC is low or goes
// low.
// HIGH The wakeup flag is set when WU_SRC is high or goes
// high.
#define AUX_SYSIF_PROGWU0CFG_POL 0x00000080
#define AUX_SYSIF_PROGWU0CFG_POL_BITN 7
#define AUX_SYSIF_PROGWU0CFG_POL_M 0x00000080
#define AUX_SYSIF_PROGWU0CFG_POL_S 7
#define AUX_SYSIF_PROGWU0CFG_POL_LOW 0x00000080
#define AUX_SYSIF_PROGWU0CFG_POL_HIGH 0x00000000
// Field: [6] EN
//
// Programmable wakeup flag enable.
//
// 0: Disable wakeup flag.
// 1: Enable wakeup flag.
#define AUX_SYSIF_PROGWU0CFG_EN 0x00000040
#define AUX_SYSIF_PROGWU0CFG_EN_BITN 6
#define AUX_SYSIF_PROGWU0CFG_EN_M 0x00000040
#define AUX_SYSIF_PROGWU0CFG_EN_S 6
// Field: [5:0] WU_SRC
//
// Wakeup source from the asynchronous AUX event bus.
//
// Only change WU_SRC when EN is 0 or WUFLAGSCLR.PROG_WU0 is 1.
//
// If you write a non-enumerated value the behavior is identical to NO_EVENT.
// The written value is returned when read.
// ENUMs:
// NO_EVENT No event.
// AUX_SMPH_AUTOTAKE_DONE AUX_EVCTL:EVSTAT3.AUX_SMPH_AUTOTAKE_DONE
// AUX_ADC_FIFO_NOT_EMPTY AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_NOT_EMPTY
// AUX_ADC_FIFO_ALMOST_FULL AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_ALMOST_FULL
// AUX_ADC_IRQ AUX_EVCTL:EVSTAT3.AUX_ADC_IRQ
// AUX_ADC_DONE AUX_EVCTL:EVSTAT3.AUX_ADC_DONE
// AUX_ISRC_RESET_N AUX_EVCTL:EVSTAT3.AUX_ISRC_RESET_N
// AUX_TDC_DONE AUX_EVCTL:EVSTAT3.AUX_TDC_DONE
// AUX_TIMER0_EV AUX_EVCTL:EVSTAT3.AUX_TIMER0_EV
// AUX_TIMER1_EV AUX_EVCTL:EVSTAT3.AUX_TIMER1_EV
// AUX_TIMER2_PULSE AUX_EVCTL:EVSTAT3.AUX_TIMER2_PULSE
// AUX_TIMER2_EV3 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV3
// AUX_TIMER2_EV2 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV2
// AUX_TIMER2_EV1 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV1
// AUX_TIMER2_EV0 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV0
// AUX_COMPB AUX_EVCTL:EVSTAT2.AUX_COMPB
// AUX_COMPA AUX_EVCTL:EVSTAT2.AUX_COMPA
// MCU_OBSMUX1 AUX_EVCTL:EVSTAT2.MCU_OBSMUX1
// MCU_OBSMUX0 AUX_EVCTL:EVSTAT2.MCU_OBSMUX0
// MCU_EV AUX_EVCTL:EVSTAT2.MCU_EV
// ACLK_REF AUX_EVCTL:EVSTAT2.ACLK_REF
// VDDR_RECHARGE AUX_EVCTL:EVSTAT2.VDDR_RECHARGE
// MCU_ACTIVE AUX_EVCTL:EVSTAT2.MCU_ACTIVE
// PWR_DWN AUX_EVCTL:EVSTAT2.PWR_DWN
// SCLK_LF AUX_EVCTL:EVSTAT2.SCLK_LF
// AON_BATMON_TEMP_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_TEMP_UPD
// AON_BATMON_BAT_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_BAT_UPD
// AON_RTC_4KHZ AUX_EVCTL:EVSTAT2.AON_RTC_4KHZ
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// AON_RTC_CH2 AUX_EVCTL:EVSTAT2.AON_RTC_CH2
// MANUAL_EV AUX_EVCTL:EVSTAT2.MANUAL_EV
// AUXIO31 AUX_EVCTL:EVSTAT1.AUXIO31
// AUXIO30 AUX_EVCTL:EVSTAT1.AUXIO30
// AUXIO29 AUX_EVCTL:EVSTAT1.AUXIO29
// AUXIO28 AUX_EVCTL:EVSTAT1.AUXIO28
// AUXIO27 AUX_EVCTL:EVSTAT1.AUXIO27
// AUXIO26 AUX_EVCTL:EVSTAT1.AUXIO26
// AUXIO25 AUX_EVCTL:EVSTAT1.AUXIO25
// AUXIO24 AUX_EVCTL:EVSTAT1.AUXIO24
// AUXIO23 AUX_EVCTL:EVSTAT1.AUXIO23
// AUXIO22 AUX_EVCTL:EVSTAT1.AUXIO22
// AUXIO21 AUX_EVCTL:EVSTAT1.AUXIO21
// AUXIO20 AUX_EVCTL:EVSTAT1.AUXIO20
// AUXIO19 AUX_EVCTL:EVSTAT1.AUXIO19
// AUXIO18 AUX_EVCTL:EVSTAT1.AUXIO18
// AUXIO17 AUX_EVCTL:EVSTAT1.AUXIO17
// AUXIO16 AUX_EVCTL:EVSTAT1.AUXIO16
// AUXIO15 AUX_EVCTL:EVSTAT0.AUXIO15
// AUXIO14 AUX_EVCTL:EVSTAT0.AUXIO14
// AUXIO13 AUX_EVCTL:EVSTAT0.AUXIO13
// AUXIO12 AUX_EVCTL:EVSTAT0.AUXIO12
// AUXIO11 AUX_EVCTL:EVSTAT0.AUXIO11
// AUXIO10 AUX_EVCTL:EVSTAT0.AUXIO10
// AUXIO9 AUX_EVCTL:EVSTAT0.AUXIO9
// AUXIO8 AUX_EVCTL:EVSTAT0.AUXIO8
// AUXIO7 AUX_EVCTL:EVSTAT0.AUXIO7
// AUXIO6 AUX_EVCTL:EVSTAT0.AUXIO6
// AUXIO5 AUX_EVCTL:EVSTAT0.AUXIO5
// AUXIO4 AUX_EVCTL:EVSTAT0.AUXIO4
// AUXIO3 AUX_EVCTL:EVSTAT0.AUXIO3
// AUXIO2 AUX_EVCTL:EVSTAT0.AUXIO2
// AUXIO1 AUX_EVCTL:EVSTAT0.AUXIO1
// AUXIO0 AUX_EVCTL:EVSTAT0.AUXIO0
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_W 6
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_M 0x0000003F
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_S 0
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_NO_EVENT 0x0000003F
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_SMPH_AUTOTAKE_DONE 0x0000003D
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_ADC_FIFO_NOT_EMPTY 0x0000003C
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_ADC_FIFO_ALMOST_FULL 0x0000003B
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_ADC_IRQ 0x0000003A
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_ADC_DONE 0x00000039
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_ISRC_RESET_N 0x00000038
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TDC_DONE 0x00000037
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER0_EV 0x00000036
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER1_EV 0x00000035
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER2_PULSE 0x00000034
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER2_EV3 0x00000033
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER2_EV2 0x00000032
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER2_EV1 0x00000031
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_TIMER2_EV0 0x00000030
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_COMPB 0x0000002F
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUX_COMPA 0x0000002E
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_MCU_OBSMUX1 0x0000002D
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_MCU_OBSMUX0 0x0000002C
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_MCU_EV 0x0000002B
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_ACLK_REF 0x0000002A
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_VDDR_RECHARGE 0x00000029
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_MCU_ACTIVE 0x00000028
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_PWR_DWN 0x00000027
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_SCLK_LF 0x00000026
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AON_BATMON_TEMP_UPD 0x00000025
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AON_BATMON_BAT_UPD 0x00000024
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AON_RTC_4KHZ 0x00000023
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AON_RTC_CH2_DLY 0x00000022
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AON_RTC_CH2 0x00000021
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_MANUAL_EV 0x00000020
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO31 0x0000001F
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO30 0x0000001E
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO29 0x0000001D
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO28 0x0000001C
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO27 0x0000001B
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO26 0x0000001A
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO25 0x00000019
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO24 0x00000018
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO23 0x00000017
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO22 0x00000016
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO21 0x00000015
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO20 0x00000014
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO19 0x00000013
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO18 0x00000012
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO17 0x00000011
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO16 0x00000010
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO15 0x0000000F
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO14 0x0000000E
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO13 0x0000000D
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO12 0x0000000C
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO11 0x0000000B
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO10 0x0000000A
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO9 0x00000009
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO8 0x00000008
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO7 0x00000007
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO6 0x00000006
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO5 0x00000005
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO4 0x00000004
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO3 0x00000003
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO2 0x00000002
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO1 0x00000001
#define AUX_SYSIF_PROGWU0CFG_WU_SRC_AUXIO0 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_PROGWU1CFG
//
//*****************************************************************************
// Field: [7] POL
//
// Polarity of WU_SRC.
//
// The procedure used to clear the wakeup flag decides level or edge
// sensitivity, see WUFLAGSCLR.PROG_WU1.
// ENUMs:
// LOW The wakeup flag is set when WU_SRC is low or goes
// low.
// HIGH The wakeup flag is set when WU_SRC is high or goes
// high.
#define AUX_SYSIF_PROGWU1CFG_POL 0x00000080
#define AUX_SYSIF_PROGWU1CFG_POL_BITN 7
#define AUX_SYSIF_PROGWU1CFG_POL_M 0x00000080
#define AUX_SYSIF_PROGWU1CFG_POL_S 7
#define AUX_SYSIF_PROGWU1CFG_POL_LOW 0x00000080
#define AUX_SYSIF_PROGWU1CFG_POL_HIGH 0x00000000
// Field: [6] EN
//
// Programmable wakeup flag enable.
//
// 0: Disable wakeup flag.
// 1: Enable wakeup flag.
#define AUX_SYSIF_PROGWU1CFG_EN 0x00000040
#define AUX_SYSIF_PROGWU1CFG_EN_BITN 6
#define AUX_SYSIF_PROGWU1CFG_EN_M 0x00000040
#define AUX_SYSIF_PROGWU1CFG_EN_S 6
// Field: [5:0] WU_SRC
//
// Wakeup source from the asynchronous AUX event bus.
//
// Only change WU_SRC when EN is 0 or WUFLAGSCLR.PROG_WU1 is 1.
//
// If you write a non-enumerated value the behavior is identical to NO_EVENT.
// The written value is returned when read.
// ENUMs:
// NO_EVENT No event.
// AUX_SMPH_AUTOTAKE_DONE AUX_EVCTL:EVSTAT3.AUX_SMPH_AUTOTAKE_DONE
// AUX_ADC_FIFO_NOT_EMPTY AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_NOT_EMPTY
// AUX_ADC_FIFO_ALMOST_FULL AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_ALMOST_FULL
// AUX_ADC_IRQ AUX_EVCTL:EVSTAT3.AUX_ADC_IRQ
// AUX_ADC_DONE AUX_EVCTL:EVSTAT3.AUX_ADC_DONE
// AUX_ISRC_RESET_N AUX_EVCTL:EVSTAT3.AUX_ISRC_RESET_N
// AUX_TDC_DONE AUX_EVCTL:EVSTAT3.AUX_TDC_DONE
// AUX_TIMER0_EV AUX_EVCTL:EVSTAT3.AUX_TIMER0_EV
// AUX_TIMER1_EV AUX_EVCTL:EVSTAT3.AUX_TIMER1_EV
// AUX_TIMER2_PULSE AUX_EVCTL:EVSTAT3.AUX_TIMER2_PULSE
// AUX_TIMER2_EV3 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV3
// AUX_TIMER2_EV2 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV2
// AUX_TIMER2_EV1 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV1
// AUX_TIMER2_EV0 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV0
// AUX_COMPB AUX_EVCTL:EVSTAT2.AUX_COMPB
// AUX_COMPA AUX_EVCTL:EVSTAT2.AUX_COMPA
// MCU_OBSMUX1 AUX_EVCTL:EVSTAT2.MCU_OBSMUX1
// MCU_OBSMUX0 AUX_EVCTL:EVSTAT2.MCU_OBSMUX0
// MCU_EV AUX_EVCTL:EVSTAT2.MCU_EV
// ACLK_REF AUX_EVCTL:EVSTAT2.ACLK_REF
// VDDR_RECHARGE AUX_EVCTL:EVSTAT2.VDDR_RECHARGE
// MCU_ACTIVE AUX_EVCTL:EVSTAT2.MCU_ACTIVE
// PWR_DWN AUX_EVCTL:EVSTAT2.PWR_DWN
// SCLK_LF AUX_EVCTL:EVSTAT2.SCLK_LF
// AON_BATMON_TEMP_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_TEMP_UPD
// AON_BATMON_BAT_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_BAT_UPD
// AON_RTC_4KHZ AUX_EVCTL:EVSTAT2.AON_RTC_4KHZ
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// AON_RTC_CH2 AUX_EVCTL:EVSTAT2.AON_RTC_CH2
// MANUAL_EV AUX_EVCTL:EVSTAT2.MANUAL_EV
// AUXIO31 AUX_EVCTL:EVSTAT1.AUXIO31
// AUXIO30 AUX_EVCTL:EVSTAT1.AUXIO30
// AUXIO29 AUX_EVCTL:EVSTAT1.AUXIO29
// AUXIO28 AUX_EVCTL:EVSTAT1.AUXIO28
// AUXIO27 AUX_EVCTL:EVSTAT1.AUXIO27
// AUXIO26 AUX_EVCTL:EVSTAT1.AUXIO26
// AUXIO25 AUX_EVCTL:EVSTAT1.AUXIO25
// AUXIO24 AUX_EVCTL:EVSTAT1.AUXIO24
// AUXIO23 AUX_EVCTL:EVSTAT1.AUXIO23
// AUXIO22 AUX_EVCTL:EVSTAT1.AUXIO22
// AUXIO21 AUX_EVCTL:EVSTAT1.AUXIO21
// AUXIO20 AUX_EVCTL:EVSTAT1.AUXIO20
// AUXIO19 AUX_EVCTL:EVSTAT1.AUXIO19
// AUXIO18 AUX_EVCTL:EVSTAT1.AUXIO18
// AUXIO17 AUX_EVCTL:EVSTAT1.AUXIO17
// AUXIO16 AUX_EVCTL:EVSTAT1.AUXIO16
// AUXIO15 AUX_EVCTL:EVSTAT0.AUXIO15
// AUXIO14 AUX_EVCTL:EVSTAT0.AUXIO14
// AUXIO13 AUX_EVCTL:EVSTAT0.AUXIO13
// AUXIO12 AUX_EVCTL:EVSTAT0.AUXIO12
// AUXIO11 AUX_EVCTL:EVSTAT0.AUXIO11
// AUXIO10 AUX_EVCTL:EVSTAT0.AUXIO10
// AUXIO9 AUX_EVCTL:EVSTAT0.AUXIO9
// AUXIO8 AUX_EVCTL:EVSTAT0.AUXIO8
// AUXIO7 AUX_EVCTL:EVSTAT0.AUXIO7
// AUXIO6 AUX_EVCTL:EVSTAT0.AUXIO6
// AUXIO5 AUX_EVCTL:EVSTAT0.AUXIO5
// AUXIO4 AUX_EVCTL:EVSTAT0.AUXIO4
// AUXIO3 AUX_EVCTL:EVSTAT0.AUXIO3
// AUXIO2 AUX_EVCTL:EVSTAT0.AUXIO2
// AUXIO1 AUX_EVCTL:EVSTAT0.AUXIO1
// AUXIO0 AUX_EVCTL:EVSTAT0.AUXIO0
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_W 6
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_M 0x0000003F
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_S 0
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_NO_EVENT 0x0000003F
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_SMPH_AUTOTAKE_DONE 0x0000003D
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_ADC_FIFO_NOT_EMPTY 0x0000003C
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_ADC_FIFO_ALMOST_FULL 0x0000003B
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_ADC_IRQ 0x0000003A
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_ADC_DONE 0x00000039
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_ISRC_RESET_N 0x00000038
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TDC_DONE 0x00000037
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER0_EV 0x00000036
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER1_EV 0x00000035
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER2_PULSE 0x00000034
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER2_EV3 0x00000033
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER2_EV2 0x00000032
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER2_EV1 0x00000031
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_TIMER2_EV0 0x00000030
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_COMPB 0x0000002F
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUX_COMPA 0x0000002E
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_MCU_OBSMUX1 0x0000002D
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_MCU_OBSMUX0 0x0000002C
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_MCU_EV 0x0000002B
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_ACLK_REF 0x0000002A
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_VDDR_RECHARGE 0x00000029
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_MCU_ACTIVE 0x00000028
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_PWR_DWN 0x00000027
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_SCLK_LF 0x00000026
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AON_BATMON_TEMP_UPD 0x00000025
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AON_BATMON_BAT_UPD 0x00000024
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AON_RTC_4KHZ 0x00000023
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AON_RTC_CH2_DLY 0x00000022
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AON_RTC_CH2 0x00000021
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_MANUAL_EV 0x00000020
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO31 0x0000001F
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO30 0x0000001E
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO29 0x0000001D
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO28 0x0000001C
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO27 0x0000001B
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO26 0x0000001A
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO25 0x00000019
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO24 0x00000018
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO23 0x00000017
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO22 0x00000016
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO21 0x00000015
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO20 0x00000014
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO19 0x00000013
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO18 0x00000012
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO17 0x00000011
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO16 0x00000010
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO15 0x0000000F
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO14 0x0000000E
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO13 0x0000000D
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO12 0x0000000C
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO11 0x0000000B
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO10 0x0000000A
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO9 0x00000009
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO8 0x00000008
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO7 0x00000007
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO6 0x00000006
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO5 0x00000005
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO4 0x00000004
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO3 0x00000003
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO2 0x00000002
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO1 0x00000001
#define AUX_SYSIF_PROGWU1CFG_WU_SRC_AUXIO0 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_PROGWU2CFG
//
//*****************************************************************************
// Field: [7] POL
//
// Polarity of WU_SRC.
//
// The procedure used to clear the wakeup flag decides level or edge
// sensitivity, see WUFLAGSCLR.PROG_WU2.
// ENUMs:
// LOW The wakeup flag is set when WU_SRC is low or goes
// low.
// HIGH The wakeup flag is set when WU_SRC is high or goes
// high.
#define AUX_SYSIF_PROGWU2CFG_POL 0x00000080
#define AUX_SYSIF_PROGWU2CFG_POL_BITN 7
#define AUX_SYSIF_PROGWU2CFG_POL_M 0x00000080
#define AUX_SYSIF_PROGWU2CFG_POL_S 7
#define AUX_SYSIF_PROGWU2CFG_POL_LOW 0x00000080
#define AUX_SYSIF_PROGWU2CFG_POL_HIGH 0x00000000
// Field: [6] EN
//
// Programmable wakeup flag enable.
//
// 0: Disable wakeup flag.
// 1: Enable wakeup flag.
#define AUX_SYSIF_PROGWU2CFG_EN 0x00000040
#define AUX_SYSIF_PROGWU2CFG_EN_BITN 6
#define AUX_SYSIF_PROGWU2CFG_EN_M 0x00000040
#define AUX_SYSIF_PROGWU2CFG_EN_S 6
// Field: [5:0] WU_SRC
//
// Wakeup source from the asynchronous AUX event bus.
//
// Only change WU_SRC when EN is 0 or WUFLAGSCLR.PROG_WU2 is 1.
//
// If you write a non-enumerated value the behavior is identical to NO_EVENT.
// The written value is returned when read.
// ENUMs:
// NO_EVENT No event.
// AUX_SMPH_AUTOTAKE_DONE AUX_EVCTL:EVSTAT3.AUX_SMPH_AUTOTAKE_DONE
// AUX_ADC_FIFO_NOT_EMPTY AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_NOT_EMPTY
// AUX_ADC_FIFO_ALMOST_FULL AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_ALMOST_FULL
// AUX_ADC_IRQ AUX_EVCTL:EVSTAT3.AUX_ADC_IRQ
// AUX_ADC_DONE AUX_EVCTL:EVSTAT3.AUX_ADC_DONE
// AUX_ISRC_RESET_N AUX_EVCTL:EVSTAT3.AUX_ISRC_RESET_N
// AUX_TDC_DONE AUX_EVCTL:EVSTAT3.AUX_TDC_DONE
// AUX_TIMER0_EV AUX_EVCTL:EVSTAT3.AUX_TIMER0_EV
// AUX_TIMER1_EV AUX_EVCTL:EVSTAT3.AUX_TIMER1_EV
// AUX_TIMER2_PULSE AUX_EVCTL:EVSTAT3.AUX_TIMER2_PULSE
// AUX_TIMER2_EV3 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV3
// AUX_TIMER2_EV2 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV2
// AUX_TIMER2_EV1 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV1
// AUX_TIMER2_EV0 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV0
// AUX_COMPB AUX_EVCTL:EVSTAT2.AUX_COMPB
// AUX_COMPA AUX_EVCTL:EVSTAT2.AUX_COMPA
// MCU_OBSMUX1 AUX_EVCTL:EVSTAT2.MCU_OBSMUX1
// MCU_OBSMUX0 AUX_EVCTL:EVSTAT2.MCU_OBSMUX0
// MCU_EV AUX_EVCTL:EVSTAT2.MCU_EV
// ACLK_REF AUX_EVCTL:EVSTAT2.ACLK_REF
// VDDR_RECHARGE AUX_EVCTL:EVSTAT2.VDDR_RECHARGE
// MCU_ACTIVE AUX_EVCTL:EVSTAT2.MCU_ACTIVE
// PWR_DWN AUX_EVCTL:EVSTAT2.PWR_DWN
// SCLK_LF AUX_EVCTL:EVSTAT2.SCLK_LF
// AON_BATMON_TEMP_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_TEMP_UPD
// AON_BATMON_BAT_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_BAT_UPD
// AON_RTC_4KHZ AUX_EVCTL:EVSTAT2.AON_RTC_4KHZ
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// AON_RTC_CH2 AUX_EVCTL:EVSTAT2.AON_RTC_CH2
// MANUAL_EV AUX_EVCTL:EVSTAT2.MANUAL_EV
// AUXIO31 AUX_EVCTL:EVSTAT1.AUXIO31
// AUXIO30 AUX_EVCTL:EVSTAT1.AUXIO30
// AUXIO29 AUX_EVCTL:EVSTAT1.AUXIO29
// AUXIO28 AUX_EVCTL:EVSTAT1.AUXIO28
// AUXIO27 AUX_EVCTL:EVSTAT1.AUXIO27
// AUXIO26 AUX_EVCTL:EVSTAT1.AUXIO26
// AUXIO25 AUX_EVCTL:EVSTAT1.AUXIO25
// AUXIO24 AUX_EVCTL:EVSTAT1.AUXIO24
// AUXIO23 AUX_EVCTL:EVSTAT1.AUXIO23
// AUXIO22 AUX_EVCTL:EVSTAT1.AUXIO22
// AUXIO21 AUX_EVCTL:EVSTAT1.AUXIO21
// AUXIO20 AUX_EVCTL:EVSTAT1.AUXIO20
// AUXIO19 AUX_EVCTL:EVSTAT1.AUXIO19
// AUXIO18 AUX_EVCTL:EVSTAT1.AUXIO18
// AUXIO17 AUX_EVCTL:EVSTAT1.AUXIO17
// AUXIO16 AUX_EVCTL:EVSTAT1.AUXIO16
// AUXIO15 AUX_EVCTL:EVSTAT0.AUXIO15
// AUXIO14 AUX_EVCTL:EVSTAT0.AUXIO14
// AUXIO13 AUX_EVCTL:EVSTAT0.AUXIO13
// AUXIO12 AUX_EVCTL:EVSTAT0.AUXIO12
// AUXIO11 AUX_EVCTL:EVSTAT0.AUXIO11
// AUXIO10 AUX_EVCTL:EVSTAT0.AUXIO10
// AUXIO9 AUX_EVCTL:EVSTAT0.AUXIO9
// AUXIO8 AUX_EVCTL:EVSTAT0.AUXIO8
// AUXIO7 AUX_EVCTL:EVSTAT0.AUXIO7
// AUXIO6 AUX_EVCTL:EVSTAT0.AUXIO6
// AUXIO5 AUX_EVCTL:EVSTAT0.AUXIO5
// AUXIO4 AUX_EVCTL:EVSTAT0.AUXIO4
// AUXIO3 AUX_EVCTL:EVSTAT0.AUXIO3
// AUXIO2 AUX_EVCTL:EVSTAT0.AUXIO2
// AUXIO1 AUX_EVCTL:EVSTAT0.AUXIO1
// AUXIO0 AUX_EVCTL:EVSTAT0.AUXIO0
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_W 6
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_M 0x0000003F
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_S 0
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_NO_EVENT 0x0000003F
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_SMPH_AUTOTAKE_DONE 0x0000003D
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_ADC_FIFO_NOT_EMPTY 0x0000003C
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_ADC_FIFO_ALMOST_FULL 0x0000003B
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_ADC_IRQ 0x0000003A
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_ADC_DONE 0x00000039
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_ISRC_RESET_N 0x00000038
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TDC_DONE 0x00000037
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER0_EV 0x00000036
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER1_EV 0x00000035
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER2_PULSE 0x00000034
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER2_EV3 0x00000033
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER2_EV2 0x00000032
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER2_EV1 0x00000031
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_TIMER2_EV0 0x00000030
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_COMPB 0x0000002F
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUX_COMPA 0x0000002E
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_MCU_OBSMUX1 0x0000002D
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_MCU_OBSMUX0 0x0000002C
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_MCU_EV 0x0000002B
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_ACLK_REF 0x0000002A
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_VDDR_RECHARGE 0x00000029
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_MCU_ACTIVE 0x00000028
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_PWR_DWN 0x00000027
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_SCLK_LF 0x00000026
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AON_BATMON_TEMP_UPD 0x00000025
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AON_BATMON_BAT_UPD 0x00000024
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AON_RTC_4KHZ 0x00000023
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AON_RTC_CH2_DLY 0x00000022
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AON_RTC_CH2 0x00000021
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_MANUAL_EV 0x00000020
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO31 0x0000001F
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO30 0x0000001E
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO29 0x0000001D
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO28 0x0000001C
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO27 0x0000001B
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO26 0x0000001A
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO25 0x00000019
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO24 0x00000018
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO23 0x00000017
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO22 0x00000016
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO21 0x00000015
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO20 0x00000014
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO19 0x00000013
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO18 0x00000012
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO17 0x00000011
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO16 0x00000010
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO15 0x0000000F
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO14 0x0000000E
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO13 0x0000000D
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO12 0x0000000C
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO11 0x0000000B
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO10 0x0000000A
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO9 0x00000009
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO8 0x00000008
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO7 0x00000007
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO6 0x00000006
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO5 0x00000005
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO4 0x00000004
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO3 0x00000003
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO2 0x00000002
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO1 0x00000001
#define AUX_SYSIF_PROGWU2CFG_WU_SRC_AUXIO0 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_PROGWU3CFG
//
//*****************************************************************************
// Field: [7] POL
//
// Polarity of WU_SRC.
//
// The procedure used to clear the wakeup flag decides level or edge
// sensitivity, see WUFLAGSCLR.PROG_WU3.
// ENUMs:
// LOW The wakeup flag is set when WU_SRC is low or goes
// low.
// HIGH The wakeup flag is set when WU_SRC is high or goes
// high.
#define AUX_SYSIF_PROGWU3CFG_POL 0x00000080
#define AUX_SYSIF_PROGWU3CFG_POL_BITN 7
#define AUX_SYSIF_PROGWU3CFG_POL_M 0x00000080
#define AUX_SYSIF_PROGWU3CFG_POL_S 7
#define AUX_SYSIF_PROGWU3CFG_POL_LOW 0x00000080
#define AUX_SYSIF_PROGWU3CFG_POL_HIGH 0x00000000
// Field: [6] EN
//
// Programmable wakeup flag enable.
//
// 0: Disable wakeup flag.
// 1: Enable wakeup flag.
#define AUX_SYSIF_PROGWU3CFG_EN 0x00000040
#define AUX_SYSIF_PROGWU3CFG_EN_BITN 6
#define AUX_SYSIF_PROGWU3CFG_EN_M 0x00000040
#define AUX_SYSIF_PROGWU3CFG_EN_S 6
// Field: [5:0] WU_SRC
//
// Wakeup source from the asynchronous AUX event bus.
//
// Only change WU_SRC when EN is 0 or WUFLAGSCLR.PROG_WU3 is 1.
//
// If you write a non-enumerated value the behavior is identical to NO_EVENT.
// The written value is returned when read.
// ENUMs:
// NO_EVENT No event.
// AUX_SMPH_AUTOTAKE_DONE AUX_EVCTL:EVSTAT3.AUX_SMPH_AUTOTAKE_DONE
// AUX_ADC_FIFO_NOT_EMPTY AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_NOT_EMPTY
// AUX_ADC_FIFO_ALMOST_FULL AUX_EVCTL:EVSTAT3.AUX_ADC_FIFO_ALMOST_FULL
// AUX_ADC_IRQ AUX_EVCTL:EVSTAT3.AUX_ADC_IRQ
// AUX_ADC_DONE AUX_EVCTL:EVSTAT3.AUX_ADC_DONE
// AUX_ISRC_RESET_N AUX_EVCTL:EVSTAT3.AUX_ISRC_RESET_N
// AUX_TDC_DONE AUX_EVCTL:EVSTAT3.AUX_TDC_DONE
// AUX_TIMER0_EV AUX_EVCTL:EVSTAT3.AUX_TIMER0_EV
// AUX_TIMER1_EV AUX_EVCTL:EVSTAT3.AUX_TIMER1_EV
// AUX_TIMER2_PULSE AUX_EVCTL:EVSTAT3.AUX_TIMER2_PULSE
// AUX_TIMER2_EV3 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV3
// AUX_TIMER2_EV2 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV2
// AUX_TIMER2_EV1 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV1
// AUX_TIMER2_EV0 AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV0
// AUX_COMPB AUX_EVCTL:EVSTAT2.AUX_COMPB
// AUX_COMPA AUX_EVCTL:EVSTAT2.AUX_COMPA
// MCU_OBSMUX1 AUX_EVCTL:EVSTAT2.MCU_OBSMUX1
// MCU_OBSMUX0 AUX_EVCTL:EVSTAT2.MCU_OBSMUX0
// MCU_EV AUX_EVCTL:EVSTAT2.MCU_EV
// ACLK_REF AUX_EVCTL:EVSTAT2.ACLK_REF
// VDDR_RECHARGE AUX_EVCTL:EVSTAT2.VDDR_RECHARGE
// MCU_ACTIVE AUX_EVCTL:EVSTAT2.MCU_ACTIVE
// PWR_DWN AUX_EVCTL:EVSTAT2.PWR_DWN
// SCLK_LF AUX_EVCTL:EVSTAT2.SCLK_LF
// AON_BATMON_TEMP_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_TEMP_UPD
// AON_BATMON_BAT_UPD AUX_EVCTL:EVSTAT2.AON_BATMON_BAT_UPD
// AON_RTC_4KHZ AUX_EVCTL:EVSTAT2.AON_RTC_4KHZ
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// AON_RTC_CH2 AUX_EVCTL:EVSTAT2.AON_RTC_CH2
// MANUAL_EV AUX_EVCTL:EVSTAT2.MANUAL_EV
// AUXIO31 AUX_EVCTL:EVSTAT1.AUXIO31
// AUXIO30 AUX_EVCTL:EVSTAT1.AUXIO30
// AUXIO29 AUX_EVCTL:EVSTAT1.AUXIO29
// AUXIO28 AUX_EVCTL:EVSTAT1.AUXIO28
// AUXIO27 AUX_EVCTL:EVSTAT1.AUXIO27
// AUXIO26 AUX_EVCTL:EVSTAT1.AUXIO26
// AUXIO25 AUX_EVCTL:EVSTAT1.AUXIO25
// AUXIO24 AUX_EVCTL:EVSTAT1.AUXIO24
// AUXIO23 AUX_EVCTL:EVSTAT1.AUXIO23
// AUXIO22 AUX_EVCTL:EVSTAT1.AUXIO22
// AUXIO21 AUX_EVCTL:EVSTAT1.AUXIO21
// AUXIO20 AUX_EVCTL:EVSTAT1.AUXIO20
// AUXIO19 AUX_EVCTL:EVSTAT1.AUXIO19
// AUXIO18 AUX_EVCTL:EVSTAT1.AUXIO18
// AUXIO17 AUX_EVCTL:EVSTAT1.AUXIO17
// AUXIO16 AUX_EVCTL:EVSTAT1.AUXIO16
// AUXIO15 AUX_EVCTL:EVSTAT0.AUXIO15
// AUXIO14 AUX_EVCTL:EVSTAT0.AUXIO14
// AUXIO13 AUX_EVCTL:EVSTAT0.AUXIO13
// AUXIO12 AUX_EVCTL:EVSTAT0.AUXIO12
// AUXIO11 AUX_EVCTL:EVSTAT0.AUXIO11
// AUXIO10 AUX_EVCTL:EVSTAT0.AUXIO10
// AUXIO9 AUX_EVCTL:EVSTAT0.AUXIO9
// AUXIO8 AUX_EVCTL:EVSTAT0.AUXIO8
// AUXIO7 AUX_EVCTL:EVSTAT0.AUXIO7
// AUXIO6 AUX_EVCTL:EVSTAT0.AUXIO6
// AUXIO5 AUX_EVCTL:EVSTAT0.AUXIO5
// AUXIO4 AUX_EVCTL:EVSTAT0.AUXIO4
// AUXIO3 AUX_EVCTL:EVSTAT0.AUXIO3
// AUXIO2 AUX_EVCTL:EVSTAT0.AUXIO2
// AUXIO1 AUX_EVCTL:EVSTAT0.AUXIO1
// AUXIO0 AUX_EVCTL:EVSTAT0.AUXIO0
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_W 6
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_M 0x0000003F
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_S 0
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_NO_EVENT 0x0000003F
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_SMPH_AUTOTAKE_DONE 0x0000003D
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_ADC_FIFO_NOT_EMPTY 0x0000003C
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_ADC_FIFO_ALMOST_FULL 0x0000003B
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_ADC_IRQ 0x0000003A
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_ADC_DONE 0x00000039
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_ISRC_RESET_N 0x00000038
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TDC_DONE 0x00000037
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER0_EV 0x00000036
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER1_EV 0x00000035
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER2_PULSE 0x00000034
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER2_EV3 0x00000033
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER2_EV2 0x00000032
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER2_EV1 0x00000031
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_TIMER2_EV0 0x00000030
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_COMPB 0x0000002F
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUX_COMPA 0x0000002E
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_MCU_OBSMUX1 0x0000002D
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_MCU_OBSMUX0 0x0000002C
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_MCU_EV 0x0000002B
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_ACLK_REF 0x0000002A
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_VDDR_RECHARGE 0x00000029
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_MCU_ACTIVE 0x00000028
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_PWR_DWN 0x00000027
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_SCLK_LF 0x00000026
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AON_BATMON_TEMP_UPD 0x00000025
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AON_BATMON_BAT_UPD 0x00000024
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AON_RTC_4KHZ 0x00000023
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AON_RTC_CH2_DLY 0x00000022
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AON_RTC_CH2 0x00000021
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_MANUAL_EV 0x00000020
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO31 0x0000001F
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO30 0x0000001E
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO29 0x0000001D
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO28 0x0000001C
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO27 0x0000001B
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO26 0x0000001A
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO25 0x00000019
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO24 0x00000018
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO23 0x00000017
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO22 0x00000016
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO21 0x00000015
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO20 0x00000014
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO19 0x00000013
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO18 0x00000012
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO17 0x00000011
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO16 0x00000010
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO15 0x0000000F
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO14 0x0000000E
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO13 0x0000000D
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO12 0x0000000C
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO11 0x0000000B
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO10 0x0000000A
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO9 0x00000009
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO8 0x00000008
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO7 0x00000007
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO6 0x00000006
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO5 0x00000005
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO4 0x00000004
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO3 0x00000003
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO2 0x00000002
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO1 0x00000001
#define AUX_SYSIF_PROGWU3CFG_WU_SRC_AUXIO0 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_SWWUTRIG
//
//*****************************************************************************
// Field: [3] SW_WU3
//
// Software wakeup 3 trigger.
//
// 0: No effect.
// 1: Set WUFLAGS.SW_WU3 and trigger AUX wakeup.
#define AUX_SYSIF_SWWUTRIG_SW_WU3 0x00000008
#define AUX_SYSIF_SWWUTRIG_SW_WU3_BITN 3
#define AUX_SYSIF_SWWUTRIG_SW_WU3_M 0x00000008
#define AUX_SYSIF_SWWUTRIG_SW_WU3_S 3
// Field: [2] SW_WU2
//
// Software wakeup 2 trigger.
//
// 0: No effect.
// 1: Set WUFLAGS.SW_WU2 and trigger AUX wakeup.
#define AUX_SYSIF_SWWUTRIG_SW_WU2 0x00000004
#define AUX_SYSIF_SWWUTRIG_SW_WU2_BITN 2
#define AUX_SYSIF_SWWUTRIG_SW_WU2_M 0x00000004
#define AUX_SYSIF_SWWUTRIG_SW_WU2_S 2
// Field: [1] SW_WU1
//
// Software wakeup 1 trigger.
//
// 0: No effect.
// 1: Set WUFLAGS.SW_WU1 and trigger AUX wakeup.
#define AUX_SYSIF_SWWUTRIG_SW_WU1 0x00000002
#define AUX_SYSIF_SWWUTRIG_SW_WU1_BITN 1
#define AUX_SYSIF_SWWUTRIG_SW_WU1_M 0x00000002
#define AUX_SYSIF_SWWUTRIG_SW_WU1_S 1
// Field: [0] SW_WU0
//
// Software wakeup 0 trigger.
//
// 0: No effect.
// 1: Set WUFLAGS.SW_WU0 and trigger AUX wakeup.
#define AUX_SYSIF_SWWUTRIG_SW_WU0 0x00000001
#define AUX_SYSIF_SWWUTRIG_SW_WU0_BITN 0
#define AUX_SYSIF_SWWUTRIG_SW_WU0_M 0x00000001
#define AUX_SYSIF_SWWUTRIG_SW_WU0_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_WUFLAGS
//
//*****************************************************************************
// Field: [7] SW_WU3
//
// Software wakeup 3 flag.
//
// 0: Software wakeup 3 not triggered.
// 1: Software wakeup 3 triggered.
#define AUX_SYSIF_WUFLAGS_SW_WU3 0x00000080
#define AUX_SYSIF_WUFLAGS_SW_WU3_BITN 7
#define AUX_SYSIF_WUFLAGS_SW_WU3_M 0x00000080
#define AUX_SYSIF_WUFLAGS_SW_WU3_S 7
// Field: [6] SW_WU2
//
// Software wakeup 2 flag.
//
// 0: Software wakeup 2 not triggered.
// 1: Software wakeup 2 triggered.
#define AUX_SYSIF_WUFLAGS_SW_WU2 0x00000040
#define AUX_SYSIF_WUFLAGS_SW_WU2_BITN 6
#define AUX_SYSIF_WUFLAGS_SW_WU2_M 0x00000040
#define AUX_SYSIF_WUFLAGS_SW_WU2_S 6
// Field: [5] SW_WU1
//
// Software wakeup 1 flag.
//
// 0: Software wakeup 1 not triggered.
// 1: Software wakeup 1 triggered.
#define AUX_SYSIF_WUFLAGS_SW_WU1 0x00000020
#define AUX_SYSIF_WUFLAGS_SW_WU1_BITN 5
#define AUX_SYSIF_WUFLAGS_SW_WU1_M 0x00000020
#define AUX_SYSIF_WUFLAGS_SW_WU1_S 5
// Field: [4] SW_WU0
//
// Software wakeup 0 flag.
//
// 0: Software wakeup 0 not triggered.
// 1: Software wakeup 0 triggered.
#define AUX_SYSIF_WUFLAGS_SW_WU0 0x00000010
#define AUX_SYSIF_WUFLAGS_SW_WU0_BITN 4
#define AUX_SYSIF_WUFLAGS_SW_WU0_M 0x00000010
#define AUX_SYSIF_WUFLAGS_SW_WU0_S 4
// Field: [3] PROG_WU3
//
// Programmable wakeup 3.
//
// 0: Programmable wakeup 3 not triggered.
// 1: Programmable wakeup 3 triggered.
#define AUX_SYSIF_WUFLAGS_PROG_WU3 0x00000008
#define AUX_SYSIF_WUFLAGS_PROG_WU3_BITN 3
#define AUX_SYSIF_WUFLAGS_PROG_WU3_M 0x00000008
#define AUX_SYSIF_WUFLAGS_PROG_WU3_S 3
// Field: [2] PROG_WU2
//
// Programmable wakeup 2.
//
// 0: Programmable wakeup 2 not triggered.
// 1: Programmable wakeup 2 triggered.
#define AUX_SYSIF_WUFLAGS_PROG_WU2 0x00000004
#define AUX_SYSIF_WUFLAGS_PROG_WU2_BITN 2
#define AUX_SYSIF_WUFLAGS_PROG_WU2_M 0x00000004
#define AUX_SYSIF_WUFLAGS_PROG_WU2_S 2
// Field: [1] PROG_WU1
//
// Programmable wakeup 1.
//
// 0: Programmable wakeup 1 not triggered.
// 1: Programmable wakeup 1 triggered.
#define AUX_SYSIF_WUFLAGS_PROG_WU1 0x00000002
#define AUX_SYSIF_WUFLAGS_PROG_WU1_BITN 1
#define AUX_SYSIF_WUFLAGS_PROG_WU1_M 0x00000002
#define AUX_SYSIF_WUFLAGS_PROG_WU1_S 1
// Field: [0] PROG_WU0
//
// Programmable wakeup 0.
//
// 0: Programmable wakeup 0 not triggered.
// 1: Programmable wakeup 0 triggered.
#define AUX_SYSIF_WUFLAGS_PROG_WU0 0x00000001
#define AUX_SYSIF_WUFLAGS_PROG_WU0_BITN 0
#define AUX_SYSIF_WUFLAGS_PROG_WU0_M 0x00000001
#define AUX_SYSIF_WUFLAGS_PROG_WU0_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_WUFLAGSCLR
//
//*****************************************************************************
// Field: [7] SW_WU3
//
// Clear software wakeup flag 3.
//
// 0: No effect.
// 1: Clear WUFLAGS.SW_WU3. Keep high until WUFLAGS.SW_WU3 is 0.
#define AUX_SYSIF_WUFLAGSCLR_SW_WU3 0x00000080
#define AUX_SYSIF_WUFLAGSCLR_SW_WU3_BITN 7
#define AUX_SYSIF_WUFLAGSCLR_SW_WU3_M 0x00000080
#define AUX_SYSIF_WUFLAGSCLR_SW_WU3_S 7
// Field: [6] SW_WU2
//
// Clear software wakeup flag 2.
//
// 0: No effect.
// 1: Clear WUFLAGS.SW_WU2. Keep high until WUFLAGS.SW_WU2 is 0.
#define AUX_SYSIF_WUFLAGSCLR_SW_WU2 0x00000040
#define AUX_SYSIF_WUFLAGSCLR_SW_WU2_BITN 6
#define AUX_SYSIF_WUFLAGSCLR_SW_WU2_M 0x00000040
#define AUX_SYSIF_WUFLAGSCLR_SW_WU2_S 6
// Field: [5] SW_WU1
//
// Clear software wakeup flag 1.
//
// 0: No effect.
// 1: Clear WUFLAGS.SW_WU1. Keep high until WUFLAGS.SW_WU1 is 0.
#define AUX_SYSIF_WUFLAGSCLR_SW_WU1 0x00000020
#define AUX_SYSIF_WUFLAGSCLR_SW_WU1_BITN 5
#define AUX_SYSIF_WUFLAGSCLR_SW_WU1_M 0x00000020
#define AUX_SYSIF_WUFLAGSCLR_SW_WU1_S 5
// Field: [4] SW_WU0
//
// Clear software wakeup flag 0.
//
// 0: No effect.
// 1: Clear WUFLAGS.SW_WU0. Keep high until WUFLAGS.SW_WU0 is 0.
#define AUX_SYSIF_WUFLAGSCLR_SW_WU0 0x00000010
#define AUX_SYSIF_WUFLAGSCLR_SW_WU0_BITN 4
#define AUX_SYSIF_WUFLAGSCLR_SW_WU0_M 0x00000010
#define AUX_SYSIF_WUFLAGSCLR_SW_WU0_S 4
// Field: [3] PROG_WU3
//
// Programmable wakeup flag 3.
//
// 0: No effect.
// 1: Clear WUFLAGS.PROG_WU3. Keep high until WUFLAGS.PROG_WU3 is 0.
//
// The wakeup flag becomes edge sensitive if you write PROG_WU3 to 0 when
// PROGWU3CFG.EN is 1.
// The wakeup flag becomes level sensitive if you write PROG_WU3 to 0 when
// PROGWU3CFG.EN is 0, then set PROGWU3CFG.EN.
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU3 0x00000008
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU3_BITN 3
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU3_M 0x00000008
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU3_S 3
// Field: [2] PROG_WU2
//
// Programmable wakeup flag 2.
//
// 0: No effect.
// 1: Clear WUFLAGS.PROG_WU2. Keep high until WUFLAGS.PROG_WU2 is 0.
//
// The wakeup flag becomes edge sensitive if you write PROG_WU2 to 0 when
// PROGWU2CFG.EN is 1.
// The wakeup flag becomes level sensitive if you write PROG_WU2 to 0 when
// PROGWU2CFG.EN is 0, then set PROGWU2CFG.EN.
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU2 0x00000004
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU2_BITN 2
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU2_M 0x00000004
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU2_S 2
// Field: [1] PROG_WU1
//
// Programmable wakeup flag 1.
//
// 0: No effect.
// 1: Clear WUFLAGS.PROG_WU1. Keep high until WUFLAGS.PROG_WU1 is 0.
//
// The wakeup flag becomes edge sensitive if you write PROG_WU1 to 0 when
// PROGWU1CFG.EN is 1.
// The wakeup flag becomes level sensitive if you write PROG_WU1 to 0 when
// PROGWU1CFG.EN is 0, then set PROGWU1CFG.EN.
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU1 0x00000002
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU1_BITN 1
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU1_M 0x00000002
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU1_S 1
// Field: [0] PROG_WU0
//
// Programmable wakeup flag 0.
//
// 0: No effect.
// 1: Clear WUFLAGS.PROG_WU0. Keep high until WUFLAGS.PROG_WU0 is 0.
//
// The wakeup flag becomes edge sensitive if you write PROG_WU0 to 0 when
// PROGWU0CFG.EN is 1.
// The wakeup flag becomes level sensitive if you write PROG_WU0 to 0 when
// PROGWU0CFG.EN is 0, then set PROGWU0CFG.EN.
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU0 0x00000001
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU0_BITN 0
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU0_M 0x00000001
#define AUX_SYSIF_WUFLAGSCLR_PROG_WU0_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_WUGATE
//
//*****************************************************************************
// Field: [0] EN
//
// Wakeup output enable.
//
// 0: Disable AUX wakeup output.
// 1: Enable AUX wakeup output.
#define AUX_SYSIF_WUGATE_EN 0x00000001
#define AUX_SYSIF_WUGATE_EN_BITN 0
#define AUX_SYSIF_WUGATE_EN_M 0x00000001
#define AUX_SYSIF_WUGATE_EN_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG0
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 0.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG0_VEC_EV_W 4
#define AUX_SYSIF_VECCFG0_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG0_VEC_EV_S 0
#define AUX_SYSIF_VECCFG0_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG0_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG0_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG0_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG0_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG0_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG0_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG0_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG0_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG0_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG1
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 1.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG1_VEC_EV_W 4
#define AUX_SYSIF_VECCFG1_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG1_VEC_EV_S 0
#define AUX_SYSIF_VECCFG1_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG1_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG1_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG1_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG1_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG1_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG1_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG1_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG1_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG1_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG2
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 2.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG2_VEC_EV_W 4
#define AUX_SYSIF_VECCFG2_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG2_VEC_EV_S 0
#define AUX_SYSIF_VECCFG2_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG2_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG2_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG2_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG2_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG2_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG2_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG2_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG2_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG2_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG3
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 3.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG3_VEC_EV_W 4
#define AUX_SYSIF_VECCFG3_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG3_VEC_EV_S 0
#define AUX_SYSIF_VECCFG3_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG3_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG3_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG3_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG3_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG3_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG3_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG3_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG3_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG3_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG4
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 4.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG4_VEC_EV_W 4
#define AUX_SYSIF_VECCFG4_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG4_VEC_EV_S 0
#define AUX_SYSIF_VECCFG4_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG4_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG4_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG4_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG4_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG4_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG4_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG4_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG4_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG4_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG5
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 5.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG5_VEC_EV_W 4
#define AUX_SYSIF_VECCFG5_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG5_VEC_EV_S 0
#define AUX_SYSIF_VECCFG5_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG5_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG5_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG5_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG5_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG5_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG5_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG5_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG5_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG5_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG6
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 6.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG6_VEC_EV_W 4
#define AUX_SYSIF_VECCFG6_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG6_VEC_EV_S 0
#define AUX_SYSIF_VECCFG6_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG6_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG6_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG6_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG6_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG6_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG6_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG6_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG6_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG6_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_VECCFG7
//
//*****************************************************************************
// Field: [3:0] VEC_EV
//
// Select trigger event for vector 7.
//
// Non-enumerated values are treated as NONE.
// ENUMs:
// AON_RTC_CH2_DLY AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY
// SW_WU3 WUFLAGS.SW_WU3
// SW_WU2 WUFLAGS.SW_WU2
// SW_WU1 WUFLAGS.SW_WU1
// SW_WU0 WUFLAGS.SW_WU0
// PROG_WU3 WUFLAGS.PROG_WU3
// PROG_WU2 WUFLAGS.PROG_WU2
// PROG_WU1 WUFLAGS.PROG_WU1
// PROG_WU0 WUFLAGS.PROG_WU0
// NONE Vector is disabled.
#define AUX_SYSIF_VECCFG7_VEC_EV_W 4
#define AUX_SYSIF_VECCFG7_VEC_EV_M 0x0000000F
#define AUX_SYSIF_VECCFG7_VEC_EV_S 0
#define AUX_SYSIF_VECCFG7_VEC_EV_AON_RTC_CH2_DLY 0x00000009
#define AUX_SYSIF_VECCFG7_VEC_EV_SW_WU3 0x00000008
#define AUX_SYSIF_VECCFG7_VEC_EV_SW_WU2 0x00000007
#define AUX_SYSIF_VECCFG7_VEC_EV_SW_WU1 0x00000006
#define AUX_SYSIF_VECCFG7_VEC_EV_SW_WU0 0x00000005
#define AUX_SYSIF_VECCFG7_VEC_EV_PROG_WU3 0x00000004
#define AUX_SYSIF_VECCFG7_VEC_EV_PROG_WU2 0x00000003
#define AUX_SYSIF_VECCFG7_VEC_EV_PROG_WU1 0x00000002
#define AUX_SYSIF_VECCFG7_VEC_EV_PROG_WU0 0x00000001
#define AUX_SYSIF_VECCFG7_VEC_EV_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_EVSYNCRATE
//
//*****************************************************************************
// Field: [2] AUX_COMPA_SYNC_RATE
//
// Select synchronization rate for AUX_EVCTL:EVSTAT2.AUX_COMPA event.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE 0x00000004
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE_BITN 2
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE_M 0x00000004
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE_S 2
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE_BUS_RATE 0x00000004
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPA_SYNC_RATE_SCE_RATE 0x00000000
// Field: [1] AUX_COMPB_SYNC_RATE
//
// Select synchronization rate for AUX_EVCTL:EVSTAT2.AUX_COMPB event.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE 0x00000002
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE_BITN 1
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE_M 0x00000002
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE_S 1
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE_BUS_RATE 0x00000002
#define AUX_SYSIF_EVSYNCRATE_AUX_COMPB_SYNC_RATE_SCE_RATE 0x00000000
// Field: [0] AUX_TIMER2_SYNC_RATE
//
// Select synchronization rate for:
// - AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV0
// - AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV1
// - AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV2
// - AUX_EVCTL:EVSTAT3.AUX_TIMER2_EV3
// - AUX_EVCTL:EVSTAT3.AUX_TIMER2_PULSE
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE 0x00000001
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE_BITN 0
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE_M 0x00000001
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE_S 0
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE_BUS_RATE 0x00000001
#define AUX_SYSIF_EVSYNCRATE_AUX_TIMER2_SYNC_RATE_SCE_RATE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_PEROPRATE
//
//*****************************************************************************
// Field: [3] ANAIF_DAC_OP_RATE
//
// Select operational rate for AUX_ANAIF DAC sample clock state machine.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE 0x00000008
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE_BITN 3
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE_M 0x00000008
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE_S 3
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE_BUS_RATE 0x00000008
#define AUX_SYSIF_PEROPRATE_ANAIF_DAC_OP_RATE_SCE_RATE 0x00000000
// Field: [2] TIMER01_OP_RATE
//
// Select operational rate for AUX_TIMER01.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE 0x00000004
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE_BITN 2
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE_M 0x00000004
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE_S 2
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE_BUS_RATE 0x00000004
#define AUX_SYSIF_PEROPRATE_TIMER01_OP_RATE_SCE_RATE 0x00000000
// Field: [1] SPIM_OP_RATE
//
// Select operational rate for AUX_SPIM.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE 0x00000002
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE_BITN 1
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE_M 0x00000002
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE_S 1
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE_BUS_RATE 0x00000002
#define AUX_SYSIF_PEROPRATE_SPIM_OP_RATE_SCE_RATE 0x00000000
// Field: [0] MAC_OP_RATE
//
// Select operational rate for AUX_MAC.
// ENUMs:
// BUS_RATE AUX bus rate
// SCE_RATE SCE rate
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE 0x00000001
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE_BITN 0
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE_M 0x00000001
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE_S 0
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE_BUS_RATE 0x00000001
#define AUX_SYSIF_PEROPRATE_MAC_OP_RATE_SCE_RATE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_ADCCLKCTL
//
//*****************************************************************************
// Field: [1] ACK
//
// Clock acknowledgement.
//
// 0: ADC clock is disabled.
// 1: ADC clock is enabled.
#define AUX_SYSIF_ADCCLKCTL_ACK 0x00000002
#define AUX_SYSIF_ADCCLKCTL_ACK_BITN 1
#define AUX_SYSIF_ADCCLKCTL_ACK_M 0x00000002
#define AUX_SYSIF_ADCCLKCTL_ACK_S 1
// Field: [0] REQ
//
// ADC clock request.
//
// 0: Disable ADC clock.
// 1: Enable ADC clock.
//
// Only modify REQ when equal to ACK.
#define AUX_SYSIF_ADCCLKCTL_REQ 0x00000001
#define AUX_SYSIF_ADCCLKCTL_REQ_BITN 0
#define AUX_SYSIF_ADCCLKCTL_REQ_M 0x00000001
#define AUX_SYSIF_ADCCLKCTL_REQ_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TDCCLKCTL
//
//*****************************************************************************
// Field: [1] ACK
//
// TDC counter clock acknowledgement.
//
// 0: TDC counter clock is disabled.
// 1: TDC counter clock is enabled.
#define AUX_SYSIF_TDCCLKCTL_ACK 0x00000002
#define AUX_SYSIF_TDCCLKCTL_ACK_BITN 1
#define AUX_SYSIF_TDCCLKCTL_ACK_M 0x00000002
#define AUX_SYSIF_TDCCLKCTL_ACK_S 1
// Field: [0] REQ
//
// TDC counter clock request.
//
// 0: Disable TDC counter clock.
// 1: Enable TDC counter clock.
//
// Only modify REQ when equal to ACK.
#define AUX_SYSIF_TDCCLKCTL_REQ 0x00000001
#define AUX_SYSIF_TDCCLKCTL_REQ_BITN 0
#define AUX_SYSIF_TDCCLKCTL_REQ_M 0x00000001
#define AUX_SYSIF_TDCCLKCTL_REQ_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TDCREFCLKCTL
//
//*****************************************************************************
// Field: [1] ACK
//
// TDC reference clock acknowledgement.
//
// 0: TDC reference clock is disabled.
// 1: TDC reference clock is enabled.
#define AUX_SYSIF_TDCREFCLKCTL_ACK 0x00000002
#define AUX_SYSIF_TDCREFCLKCTL_ACK_BITN 1
#define AUX_SYSIF_TDCREFCLKCTL_ACK_M 0x00000002
#define AUX_SYSIF_TDCREFCLKCTL_ACK_S 1
// Field: [0] REQ
//
// TDC reference clock request.
//
// 0: Disable TDC reference clock.
// 1: Enable TDC reference clock.
//
// Only modify REQ when equal to ACK.
#define AUX_SYSIF_TDCREFCLKCTL_REQ 0x00000001
#define AUX_SYSIF_TDCREFCLKCTL_REQ_BITN 0
#define AUX_SYSIF_TDCREFCLKCTL_REQ_M 0x00000001
#define AUX_SYSIF_TDCREFCLKCTL_REQ_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMER2CLKCTL
//
//*****************************************************************************
// Field: [2:0] SRC
//
// Select clock source for AUX_TIMER2.
//
// Update is only accepted if SRC equals TIMER2CLKSTAT.STAT or
// TIMER2CLKSWITCH.RDY is 1.
//
// It is recommended to select NONE only when TIMER2BRIDGE.BUSY is 0.
//
// A non-enumerated value is ignored.
// ENUMs:
// SCLK_HFDIV2 SCLK_HF / 2
// SCLK_MF SCLK_MF
// SCLK_LF SCLK_LF
// NONE no clock
#define AUX_SYSIF_TIMER2CLKCTL_SRC_W 3
#define AUX_SYSIF_TIMER2CLKCTL_SRC_M 0x00000007
#define AUX_SYSIF_TIMER2CLKCTL_SRC_S 0
#define AUX_SYSIF_TIMER2CLKCTL_SRC_SCLK_HFDIV2 0x00000004
#define AUX_SYSIF_TIMER2CLKCTL_SRC_SCLK_MF 0x00000002
#define AUX_SYSIF_TIMER2CLKCTL_SRC_SCLK_LF 0x00000001
#define AUX_SYSIF_TIMER2CLKCTL_SRC_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMER2CLKSTAT
//
//*****************************************************************************
// Field: [2:0] STAT
//
// AUX_TIMER2 clock source status.
// ENUMs:
// SCLK_HFDIV2 SCLK_HF / 2
// SCLK_MF SCLK_MF
// SCLK_LF SCLK_LF
// NONE No clock
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_W 3
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_M 0x00000007
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_S 0
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_SCLK_HFDIV2 0x00000004
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_SCLK_MF 0x00000002
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_SCLK_LF 0x00000001
#define AUX_SYSIF_TIMER2CLKSTAT_STAT_NONE 0x00000000
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMER2CLKSWITCH
//
//*****************************************************************************
// Field: [0] RDY
//
// Status of clock switcher.
//
// 0: TIMER2CLKCTL.SRC is different from TIMER2CLKSTAT.STAT.
// 1: TIMER2CLKCTL.SRC equals TIMER2CLKSTAT.STAT.
//
// RDY connects to AUX_EVCTL:EVSTAT3.AUX_TIMER2_CLKSWITCH_RDY.
#define AUX_SYSIF_TIMER2CLKSWITCH_RDY 0x00000001
#define AUX_SYSIF_TIMER2CLKSWITCH_RDY_BITN 0
#define AUX_SYSIF_TIMER2CLKSWITCH_RDY_M 0x00000001
#define AUX_SYSIF_TIMER2CLKSWITCH_RDY_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMER2DBGCTL
//
//*****************************************************************************
// Field: [0] DBG_FREEZE_EN
//
// Debug freeze enable.
//
// 0: AUX_TIMER2 does not halt when the system CPU halts in debug mode.
// 1: Halt AUX_TIMER2 when the system CPU halts in debug mode.
#define AUX_SYSIF_TIMER2DBGCTL_DBG_FREEZE_EN 0x00000001
#define AUX_SYSIF_TIMER2DBGCTL_DBG_FREEZE_EN_BITN 0
#define AUX_SYSIF_TIMER2DBGCTL_DBG_FREEZE_EN_M 0x00000001
#define AUX_SYSIF_TIMER2DBGCTL_DBG_FREEZE_EN_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_CLKSHIFTDET
//
//*****************************************************************************
// Field: [0] STAT
//
// Clock shift detection.
//
// Write:
//
// 0: Restart clock shift detection.
// 1: Do not use.
//
// Read:
//
// 0: MCU domain did not enter or exit active state since you wrote 0 to STAT.
// 1: MCU domain entered or exited active state since you wrote 0 to STAT.
#define AUX_SYSIF_CLKSHIFTDET_STAT 0x00000001
#define AUX_SYSIF_CLKSHIFTDET_STAT_BITN 0
#define AUX_SYSIF_CLKSHIFTDET_STAT_M 0x00000001
#define AUX_SYSIF_CLKSHIFTDET_STAT_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RECHARGETRIG
//
//*****************************************************************************
// Field: [0] TRIG
//
// Recharge trigger.
//
// 0: No effect.
// 1: Request VDDR recharge.
//
// Request VDDR recharge only when AUX_EVCTL:EVSTAT2.PWR_DWN is 1.
//
// Follow this sequence when OPMODEREQ.REQ is LP:
// - Set TRIG.
// - Wait until AUX_EVCTL:EVSTAT2.VDDR_RECHARGE is 1.
// - Clear TRIG.
// - Wait until AUX_EVCTL:EVSTAT2.VDDR_RECHARGE is 0.
//
// Follow this sequence when OPMODEREQ.REQ is PDA or PDLP:
// - Set TRIG.
// - Clear TRIG.
#define AUX_SYSIF_RECHARGETRIG_TRIG 0x00000001
#define AUX_SYSIF_RECHARGETRIG_TRIG_BITN 0
#define AUX_SYSIF_RECHARGETRIG_TRIG_M 0x00000001
#define AUX_SYSIF_RECHARGETRIG_TRIG_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RECHARGEDET
//
//*****************************************************************************
// Field: [1] STAT
//
// VDDR recharge detector status.
//
// 0: No recharge of VDDR has occurred since EN was set.
// 1: Recharge of VDDR has occurred since EN was set.
#define AUX_SYSIF_RECHARGEDET_STAT 0x00000002
#define AUX_SYSIF_RECHARGEDET_STAT_BITN 1
#define AUX_SYSIF_RECHARGEDET_STAT_M 0x00000002
#define AUX_SYSIF_RECHARGEDET_STAT_S 1
// Field: [0] EN
//
// VDDR recharge detector enable.
//
// 0: Disable recharge detection. STAT becomes zero.
// 1: Enable recharge detection.
#define AUX_SYSIF_RECHARGEDET_EN 0x00000001
#define AUX_SYSIF_RECHARGEDET_EN_BITN 0
#define AUX_SYSIF_RECHARGEDET_EN_M 0x00000001
#define AUX_SYSIF_RECHARGEDET_EN_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCSUBSECINC0
//
//*****************************************************************************
// Field: [15:0] INC15_0
//
// New value for bits 15:0 in AON_RTC:SUBSECINC.
#define AUX_SYSIF_RTCSUBSECINC0_INC15_0_W 16
#define AUX_SYSIF_RTCSUBSECINC0_INC15_0_M 0x0000FFFF
#define AUX_SYSIF_RTCSUBSECINC0_INC15_0_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCSUBSECINC1
//
//*****************************************************************************
// Field: [7:0] INC23_16
//
// New value for bits 23:16 in AON_RTC:SUBSECINC.
#define AUX_SYSIF_RTCSUBSECINC1_INC23_16_W 8
#define AUX_SYSIF_RTCSUBSECINC1_INC23_16_M 0x000000FF
#define AUX_SYSIF_RTCSUBSECINC1_INC23_16_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCSUBSECINCCTL
//
//*****************************************************************************
// Field: [1] UPD_ACK
//
// Update acknowledgement.
//
// 0: AON_RTC has not acknowledged UPD_REQ.
// 1: AON_RTC has acknowledged UPD_REQ.
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_ACK 0x00000002
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_ACK_BITN 1
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_ACK_M 0x00000002
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_ACK_S 1
// Field: [0] UPD_REQ
//
// Request AON_RTC to update AON_RTC:SUBSECINC.
//
// 0: Clear request to update.
// 1: Set request to update.
//
// Only change UPD_REQ when it equals UPD_ACK. Clear UPD_REQ after UPD_ACK is
// 1.
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_REQ 0x00000001
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_REQ_BITN 0
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_REQ_M 0x00000001
#define AUX_SYSIF_RTCSUBSECINCCTL_UPD_REQ_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCSEC
//
//*****************************************************************************
// Field: [15:0] SEC
//
// Bits 15:0 in AON_RTC:SEC.VALUE.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of SEC.
// - Then read SEC until two consecutive reads are equal.
#define AUX_SYSIF_RTCSEC_SEC_W 16
#define AUX_SYSIF_RTCSEC_SEC_M 0x0000FFFF
#define AUX_SYSIF_RTCSEC_SEC_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCSUBSEC
//
//*****************************************************************************
// Field: [15:0] SUBSEC
//
// Bits 31:16 in AON_RTC:SUBSEC.VALUE.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads SUBSEC.
// - Then read SUBSEC until two consecutive reads are equal.
#define AUX_SYSIF_RTCSUBSEC_SUBSEC_W 16
#define AUX_SYSIF_RTCSUBSEC_SUBSEC_M 0x0000FFFF
#define AUX_SYSIF_RTCSUBSEC_SUBSEC_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_RTCEVCLR
//
//*****************************************************************************
// Field: [0] RTC_CH2_EV_CLR
//
// Clear events from AON_RTC channel 2.
//
// 0: No effect.
// 1: Clear events from AON_RTC channel 2.
//
// Keep RTC_CH2_EV_CLR high until AUX_EVCTL:EVSTAT2.AON_RTC_CH2 and
// AUX_EVCTL:EVSTAT2.AON_RTC_CH2_DLY are 0.
#define AUX_SYSIF_RTCEVCLR_RTC_CH2_EV_CLR 0x00000001
#define AUX_SYSIF_RTCEVCLR_RTC_CH2_EV_CLR_BITN 0
#define AUX_SYSIF_RTCEVCLR_RTC_CH2_EV_CLR_M 0x00000001
#define AUX_SYSIF_RTCEVCLR_RTC_CH2_EV_CLR_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_BATMONBAT
//
//*****************************************************************************
// Field: [10:8] INT
//
// See AON_BATMON:BAT.INT.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of INT.
// - Then read INT until two consecutive reads are equal.
#define AUX_SYSIF_BATMONBAT_INT_W 3
#define AUX_SYSIF_BATMONBAT_INT_M 0x00000700
#define AUX_SYSIF_BATMONBAT_INT_S 8
// Field: [7:0] FRAC
//
// See AON_BATMON:BAT.FRAC.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of FRAC.
// - Then read FRAC until two consecutive reads are equal.
#define AUX_SYSIF_BATMONBAT_FRAC_W 8
#define AUX_SYSIF_BATMONBAT_FRAC_M 0x000000FF
#define AUX_SYSIF_BATMONBAT_FRAC_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_BATMONTEMP
//
//*****************************************************************************
// Field: [15:11] SIGN
//
// Sign extension of INT.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of SIGN.
// - Then read SIGN until two consecutive reads are equal.
#define AUX_SYSIF_BATMONTEMP_SIGN_W 5
#define AUX_SYSIF_BATMONTEMP_SIGN_M 0x0000F800
#define AUX_SYSIF_BATMONTEMP_SIGN_S 11
// Field: [10:2] INT
//
// See AON_BATMON:TEMP.INT.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of INT.
// - Then read INT until two consecutive reads are equal.
#define AUX_SYSIF_BATMONTEMP_INT_W 9
#define AUX_SYSIF_BATMONTEMP_INT_M 0x000007FC
#define AUX_SYSIF_BATMONTEMP_INT_S 2
// Field: [1:0] FRAC
//
// See AON_BATMON:TEMP.FRAC.
//
// Follow this procedure to get the correct value:
// - Do two dummy reads of FRAC.
// - Then read FRAC until two consecutive reads are equal.
#define AUX_SYSIF_BATMONTEMP_FRAC_W 2
#define AUX_SYSIF_BATMONTEMP_FRAC_M 0x00000003
#define AUX_SYSIF_BATMONTEMP_FRAC_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMERHALT
//
//*****************************************************************************
// Field: [3] PROGDLY
//
// Halt programmable delay.
//
// 0: AUX_EVCTL:PROGDLY.VALUE decrements as normal.
// 1: Halt AUX_EVCTL:PROGDLY.VALUE decrementation.
#define AUX_SYSIF_TIMERHALT_PROGDLY 0x00000008
#define AUX_SYSIF_TIMERHALT_PROGDLY_BITN 3
#define AUX_SYSIF_TIMERHALT_PROGDLY_M 0x00000008
#define AUX_SYSIF_TIMERHALT_PROGDLY_S 3
// Field: [2] AUX_TIMER2
//
// Halt AUX_TIMER2.
//
// 0: AUX_TIMER2 operates as normal.
// 1: Halt AUX_TIMER2 operation.
#define AUX_SYSIF_TIMERHALT_AUX_TIMER2 0x00000004
#define AUX_SYSIF_TIMERHALT_AUX_TIMER2_BITN 2
#define AUX_SYSIF_TIMERHALT_AUX_TIMER2_M 0x00000004
#define AUX_SYSIF_TIMERHALT_AUX_TIMER2_S 2
// Field: [1] AUX_TIMER1
//
// Halt AUX_TIMER01 Timer 1.
//
// 0: AUX_TIMER01 Timer 1 operates as normal.
// 1: Halt AUX_TIMER01 Timer 1 operation.
#define AUX_SYSIF_TIMERHALT_AUX_TIMER1 0x00000002
#define AUX_SYSIF_TIMERHALT_AUX_TIMER1_BITN 1
#define AUX_SYSIF_TIMERHALT_AUX_TIMER1_M 0x00000002
#define AUX_SYSIF_TIMERHALT_AUX_TIMER1_S 1
// Field: [0] AUX_TIMER0
//
// Halt AUX_TIMER01 Timer 0.
//
// 0: AUX_TIMER01 Timer 0 operates as normal.
// 1: Halt AUX_TIMER01 Timer 0 operation.
#define AUX_SYSIF_TIMERHALT_AUX_TIMER0 0x00000001
#define AUX_SYSIF_TIMERHALT_AUX_TIMER0_BITN 0
#define AUX_SYSIF_TIMERHALT_AUX_TIMER0_M 0x00000001
#define AUX_SYSIF_TIMERHALT_AUX_TIMER0_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_TIMER2BRIDGE
//
//*****************************************************************************
// Field: [0] BUSY
//
// Status of bus transactions to AUX_TIMER2.
//
// 0: No unfinished bus transactions.
// 1: A bus transaction is ongoing.
#define AUX_SYSIF_TIMER2BRIDGE_BUSY 0x00000001
#define AUX_SYSIF_TIMER2BRIDGE_BUSY_BITN 0
#define AUX_SYSIF_TIMER2BRIDGE_BUSY_M 0x00000001
#define AUX_SYSIF_TIMER2BRIDGE_BUSY_S 0
//*****************************************************************************
//
// Register: AUX_SYSIF_O_SWPWRPROF
//
//*****************************************************************************
// Field: [2:0] STAT
//
// Software status bits that can be read by the power profiler.
#define AUX_SYSIF_SWPWRPROF_STAT_W 3
#define AUX_SYSIF_SWPWRPROF_STAT_M 0x00000007
#define AUX_SYSIF_SWPWRPROF_STAT_S 0
#endif // __AUX_SYSIF__
| 50.786501 | 80 | 0.551139 | [
"vector"
] |
8b7c96a61f773f67861de328d46c63a318317b3a | 2,932 | h | C | Source/PokemonRNGSystem/Colosseum/ColosseumRNGSystem.h | BigBigos/GC-pokemon-RNG-manipulation-assistant | 7afe1a9c824cdfb56a37cff31aca3474396fd6e8 | [
"MIT"
] | null | null | null | Source/PokemonRNGSystem/Colosseum/ColosseumRNGSystem.h | BigBigos/GC-pokemon-RNG-manipulation-assistant | 7afe1a9c824cdfb56a37cff31aca3474396fd6e8 | [
"MIT"
] | null | null | null | Source/PokemonRNGSystem/Colosseum/ColosseumRNGSystem.h | BigBigos/GC-pokemon-RNG-manipulation-assistant | 7afe1a9c824cdfb56a37cff31aca3474396fd6e8 | [
"MIT"
] | null | null | null | #pragma once
#include "../BaseRNGSystem.h"
#include <array>
class ColosseumRNGSystem final : public BaseRNGSystem
{
public:
enum QuickBattleTeamLeader
{
Blaziken = 0,
Entei,
Swampert,
Raikou,
Meganium,
Suicune,
Metagross,
Heracross
};
enum QuickBattlePlayerName
{
Wes = 0,
Seth,
Thomas
};
~ColosseumRNGSystem(){};
std::string getPrecalcFilename() final override;
private:
enum SecondaryPokemonIndex
{
quilava = 0,
croconaw,
bayleef,
POKEMON_COUNT
};
u32 rollRNGToBattleMenu(u32 seed, u32* counter = nullptr) final override;
bool generateBattleTeam(u32& seed, const std::vector<int> criteria,
u32* counter = nullptr) final override;
std::string getLastObtainedCriteriasString() final override;
std::vector<int> obtainTeamGenerationCritera(u32& seed) final override;
int getNbrCombinationsFirstTwoCriteria() final override;
int firstTwoCriteriaToIndex(const std::vector<int> criteria) final override;
int getMinFramesAmountNamingScreen() final override;
int getNbrStartersPrediction() final override;
std::vector<std::string> getStartersName() final override;
std::vector<std::string> getSecondariesName() final override;
u32 rollRNGNamingScreenInit(u32 seed) final override;
u32 rollRNGNamingScreenNext(u32 seed) final override;
StartersPrediction generateStarterPokemons(u32 seed) final override;
void generateAllSecondariesInSearchRange(const u32 postStarterSeed,
const int secondaryIndex) final override;
std::array<StatsRange, 6> getSecondaryStatsRange(const int secondaryIndex) final override;
u32 generatePokemonPID(u32& seed, const u32 hTrainerId, const u32 lTrainerId, const u32 dummyId,
u32* counter = nullptr, const s8 wantedGender = -1,
const u32 genderRatio = 257, const s8 wantedNature = -1);
u32 rollRNGToPokemonCompanyLogo(u32 seed, u32* counter = nullptr);
u32 rollRNGEnteringBattleMenu(u32 seed, u32* counter = nullptr);
const int secondaryRngAdvanceSearchStart = 1000000;
const int secondarySearchSeedsAmount = 1000000;
const int secondaryLevel = 30;
const u8 secondaryGenderRatio = 31;
std::array<Stats, 3> secondaryBaseStats = {{{58, 64, 58, 80, 65, 80}, // Quilava
{65, 80, 80, 59, 63, 58}, // Croconaw
{60, 62, 80, 63, 80, 60}}}; // Bayleef
std::array<StatsRange, 6> quilavaStatsRange = {
{{74, 84}, {38, 57}, {35, 53}, {47, 68}, {39, 58}, {47, 68}}};
std::array<StatsRange, 6> croconawStatsRange = {
{{79, 88}, {47, 68}, {47, 68}, {36, 53}, {37, 57}, {35, 53}}};
std::array<StatsRange, 6> bayleefStatsRange = {
{{76, 85}, {37, 56}, {47, 68}, {37, 57}, {47, 68}, {36, 55}}};
std::vector<int> m_lastObtainedCriterias = {-1, -1};
};
| 35.756098 | 98 | 0.659277 | [
"vector"
] |
8b800c955566aa1ba65aa278b1df1cf6dbc652ba | 3,139 | h | C | B2G/gecko/editor/txmgr/src/nsTransactionManager.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/editor/txmgr/src/nsTransactionManager.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/editor/txmgr/src/nsTransactionManager.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsTransactionManager_h__
#define nsTransactionManager_h__
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
#include "nsITransactionManager.h"
#include "nsTransactionStack.h"
#include "nsWeakReference.h"
#include "nscore.h"
class nsITransaction;
class nsITransactionListener;
class nsTransactionItem;
/** implementation of a transaction manager object.
*
*/
class nsTransactionManager : public nsITransactionManager
, public nsSupportsWeakReference
{
private:
int32_t mMaxTransactionCount;
nsTransactionStack mDoStack;
nsTransactionStack mUndoStack;
nsTransactionStack mRedoStack;
nsCOMArray<nsITransactionListener> mListeners;
public:
/** The default constructor.
*/
nsTransactionManager(int32_t aMaxTransactionCount=-1);
/** The default destructor.
*/
virtual ~nsTransactionManager();
/* Macro for AddRef(), Release(), and QueryInterface() */
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager,
nsITransactionManager)
/* nsITransactionManager method implementations. */
NS_DECL_NSITRANSACTIONMANAGER
/* nsTransactionManager specific methods. */
virtual nsresult ClearUndoStack(void);
virtual nsresult ClearRedoStack(void);
already_AddRefed<nsITransaction> PeekUndoStack();
already_AddRefed<nsITransaction> PeekRedoStack();
virtual nsresult WillDoNotify(nsITransaction *aTransaction, bool *aInterrupt);
virtual nsresult DidDoNotify(nsITransaction *aTransaction, nsresult aExecuteResult);
virtual nsresult WillUndoNotify(nsITransaction *aTransaction, bool *aInterrupt);
virtual nsresult DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult);
virtual nsresult WillRedoNotify(nsITransaction *aTransaction, bool *aInterrupt);
virtual nsresult DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult);
virtual nsresult WillBeginBatchNotify(bool *aInterrupt);
virtual nsresult DidBeginBatchNotify(nsresult aResult);
virtual nsresult WillEndBatchNotify(bool *aInterrupt);
virtual nsresult DidEndBatchNotify(nsresult aResult);
virtual nsresult WillMergeNotify(nsITransaction *aTop,
nsITransaction *aTransaction,
bool *aInterrupt);
virtual nsresult DidMergeNotify(nsITransaction *aTop,
nsITransaction *aTransaction,
bool aDidMerge,
nsresult aMergeResult);
private:
/* nsTransactionManager specific private methods. */
virtual nsresult BeginTransaction(nsITransaction *aTransaction);
virtual nsresult EndTransaction(void);
};
#endif // nsTransactionManager_h__
| 36.5 | 86 | 0.730806 | [
"object"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.